Commit 149f135a authored by 柳 佳乐's avatar 柳 佳乐
Browse files

20221115

parent 2423ec69
...@@ -56,8 +56,7 @@ ...@@ -56,8 +56,7 @@
</template> </template>
<script> <script>
import {chinaIdentityValid,bankAccountValid,checkPhone} from '@/utils/myValidate' import {bankAccountValid} from '@/utils/myValidate'
import { getRoles} from '@/api/role'
import {getOneself,update,staffpassword} from '@/api/user' import {getOneself,update,staffpassword} from '@/api/user'
export default { export default {
data(){ data(){
...@@ -78,11 +77,11 @@ export default { ...@@ -78,11 +77,11 @@ export default {
rolesList:[], rolesList:[],
options: [ options: [
{ {
value: 1, value: '1',
label: "", label: "",
}, },
{ {
value: 0, value: '0',
label: "", label: "",
}, },
], ],
......
<template> <template>
<div class="container"> <div class="container">
<div> <el-row>
<el-form :inline="true" :model="typeQurey"> <el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="24">
<el-form-item label="类别名称"> <el-form :model="typefrom" ref="from" label-width="60px" class="demo-dynamic" >
<el-input <el-row v-for="(item, index) in typefrom.typeList" :key="item.key">
v-model="typeQurey.typeName" <el-col :xl="6" :lg="8" :md="8" :sm="10" :xs="24">
placeholder="类别名称" <el-form-item
></el-input> :label="'种类' + (index+1)"
</el-form-item> :prop="'typeList.' + index + '.typeCategory'"
<el-form-item label="列别"> :rules="{
<el-select v-model="typeQurey.typeCategory" placeholder="请选择"> required: true, message: '种类不能为空', trigger: 'blur'
<el-option }"
v-for="item in options" >
:key="item.value" <el-select v-model="item.typeCategory" placeholder="请选择">
:label="item.label" <el-option
:value="item.value" v-for="item in options"
> :key="item.value"
</el-option> :label="item.label"
</el-select> :value="item.value">
</el-form-item> </el-option>
<el-form-item> </el-select>
<el-button type="primary" icon="el-icon-search" @click="qurey()" </el-form-item>
>查询</el-button </el-col>
> <el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="24">
<el-button <el-form-item
type="primary" :label="'名称' + (index+1)"
icon="el-icon-refresh-right" :prop="'typeList.' + index + '.typeName'"
@click="reset()" :rules="{
>重置</el-button required: true, message: '类名不能为空', trigger: 'blur'
> }"
<el-button >
type="success" <div>
icon="el-icon-circle-plus-outline" <el-row :gutter="10">
@click="addtype()" <el-col :span="18">
>添加类型</el-button <el-input v-model="item.typeName"></el-input>
> </el-col>
</el-form-item> <el-col :span="4">
</el-form> <el-button @click.prevent="removeDomain(item)">删除</el-button>
</div> </el-col>
</el-row>
<div class="conter"> </div>
<el-table </el-form-item>
:data="typeList" </el-col>
style="width: 100%; text-align: center" </el-row>
border
>
<el-table-column label="序号" width="50px"> <el-form-item>
<template slot-scope="scope"> <el-button type="primary" @click="submitForm()">提交</el-button>
{{ <el-button @click="addDomain">新增类型</el-button>
(typeQurey.pageNum - 1) * typeQurey.pageSize + scope.$index + 1 <el-button @click="resetForm()">重置</el-button>
}} <el-button @click="back()">返回</el-button>
</template> </el-form-item>
</el-table-column> </el-form>
<el-table-column prop="typeName" label="类别名称" /> </el-col>
<el-table-column label="类别种类" > </el-row>
<template slot-scope="scope">
<el-tag
:type="scope.row.typeCategory == '0' ? 'success' : 'danger' "
>
{{scope.row.typeCategory == '0' ? '收入类别' : '支出类别'}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button style="margin:5px" size="mini" icon="el-icon-edit" type="info" @click="updataType(scope.row)">修改信息</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="footer">
<el-pagination
@current-change="handleCurrentChange"
:current-page.sync="typeQurey.pageNum"
:page-size="typeQurey.pageSize"
layout="total, prev, pager, next"
:total="total"
>
</el-pagination>
</div>
</div> </div>
</template> </template>
<script> <script>
import { select } from "@/api/type";
export default { import { insert } from "@/api/type"
data() {
return { export default {
typeQurey: { data() {
typeName: null, return {
typeCategory: null, typefrom: {
companyId: null, typeList:[
pageNum: 1, {
pageSize: 10, key:Date.now(),
}, typeCategory:'1',
options: [ typeName:'',
{ companyId:this.$store.getters.companyId,
value: "0", }
label: "收入类别", ]
},
{
value: "1",
label: "支出类别",
}, },
], options: [{
total:0, value: '0',
typeList:[] label: '收入类别'
}; }, {
}, value: '1',
created() { label: '支出类别'
this.typeQurey.companyId = this.$store.getters.companyId }]
this.getTypeList() };
},
methods: {
//获取种类
getTypeList(){
select(this.typeQurey).then((res)=>{
if(res.success){
this.typeList = res.data.list
this.total = res.data.total
}else{
this.$message.error(res.msg)
}
}).catch((error)=>{
this.$message.error("查询失败")
})
},
//重置
reset() {
this.typeQurey = {
typeName: null,
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
}
this.typeQurey.companyId = this.$store.getters.companyId
this.getTypeList()
}, },
//添加类型 methods: {
addtype() { //提交
this.$router.push('/typeAdd') submitForm() {
}, this.$refs.from.validate((valid) => {
//修改类型 if (valid) {
updataType(data){ console.log(this.typefrom)
this.$router.push({ insert(this.typefrom.typeList).then((res)=>{
path: '/typeUpdata', if(res.success){
query:{ this.$message.success("添加成功")
id:data.typeId, this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push("/typeList")
}else{
this.$message.error(res.msg)
}
}).catch((error)=>{
console.log(error)
this.$message.error("添加失败")
})
} else {
console.log('error submit!!');
return false;
}
});
},
//重置
resetForm() {
this.$refs.from.resetFields();
},
//删除
removeDomain(item) {
var index = this.typefrom.typeList.indexOf(item)
if (index !== -1) {
this.typefrom.typeList.splice(index, 1)
} }
}) },
}, //新增类型
//搜索 addDomain() {
qurey(){ this.typefrom.typeList.push(
this.typeQurey.pageNum = 1 {
this.getTypeList() key:Date.now(),
}, typeName:'',
//换页 typeCategory:'1',
handleCurrentChange(val){ companyId:this.$store.getters.companyId,
this.typeQurey.pageNum = val }
this.getTypeList() );
},
//返回
back(){
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push("/typeList")
}
} }
}, }
};
</script> </script>
<style scoped>
<style scoped>
.container { .container {
padding: 10px; padding: 10px;
} }
.conter {
margin-bottom: 10px;
}
.footer {
text-align: right;
}
</style> </style>
\ No newline at end of file
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" > <el-table-column label="操作" width="130">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button style="margin:5px" size="mini" icon="el-icon-edit" type="info" @click="updataType(scope.row)">修改信息</el-button> <el-button style="margin:5px" size="mini" icon="el-icon-edit" type="info" @click="updataType(scope.row)">修改信息</el-button>
</template> </template>
...@@ -103,10 +103,6 @@ export default { ...@@ -103,10 +103,6 @@ export default {
{ {
value: "1", value: "1",
label: "支出类别", label: "支出类别",
},
{
value: "2",
label: "报销类别",
} }
], ],
total:0, total:0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment