"src/views/git@gitlab.aishuhong.com:liujiale/finance.git" did not exist on "b4ec9d5399f41000fd77647e94c53f73ad4d9bd3"
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-select v-model="item.typeCategory" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value">
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> </el-col>
<el-button type="primary" icon="el-icon-search" @click="qurey()" <el-col :xl="12" :lg="12" :md="12" :sm="12" :xs="24">
>查询</el-button <el-form-item
:label="'名称' + (index+1)"
:prop="'typeList.' + index + '.typeName'"
:rules="{
required: true, message: '类名不能为空', trigger: 'blur'
}"
> >
<el-button <div>
type="primary" <el-row :gutter="10">
icon="el-icon-refresh-right" <el-col :span="18">
@click="reset()" <el-input v-model="item.typeName"></el-input>
>重置</el-button </el-col>
> <el-col :span="4">
<el-button <el-button @click.prevent="removeDomain(item)">删除</el-button>
type="success" </el-col>
icon="el-icon-circle-plus-outline" </el-row>
@click="addtype()"
>添加类型</el-button
>
</el-form-item>
</el-form>
</div> </div>
</el-form-item>
</el-col>
</el-row>
<div class="conter">
<el-table
:data="typeList"
style="width: 100%; text-align: center"
border
>
<el-table-column label="序号" width="50px">
<template slot-scope="scope">
{{
(typeQurey.pageNum - 1) * typeQurey.pageSize + scope.$index + 1
}}
</template>
</el-table-column>
<el-table-column prop="typeName" label="类别名称" />
<el-table-column label="类别种类" >
<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-form-item>
<el-pagination <el-button type="primary" @click="submitForm()">提交</el-button>
@current-change="handleCurrentChange" <el-button @click="addDomain">新增类型</el-button>
:current-page.sync="typeQurey.pageNum" <el-button @click="resetForm()">重置</el-button>
:page-size="typeQurey.pageSize" <el-button @click="back()">返回</el-button>
layout="total, prev, pager, next" </el-form-item>
:total="total" </el-form>
> </el-col>
</el-pagination> </el-row>
</div>
</div> </div>
</template> </template>
<script> <script>
import { select } from "@/api/type";
export default { import { insert } from "@/api/type"
export default {
data() { data() {
return { return {
typeQurey: { typefrom: {
typeName: null, typeList:[
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
},
options: [
{ {
value: "0", key:Date.now(),
label: "收入类别", typeCategory:'1',
}, typeName:'',
{ companyId:this.$store.getters.companyId,
value: "1", }
label: "支出类别", ]
}, },
], options: [{
total:0, value: '0',
typeList:[] label: '收入类别'
}, {
value: '1',
label: '支出类别'
}]
}; };
}, },
created() {
this.typeQurey.companyId = this.$store.getters.companyId
this.getTypeList()
},
methods: { methods: {
//获取种类 //提交
getTypeList(){ submitForm() {
select(this.typeQurey).then((res)=>{ this.$refs.from.validate((valid) => {
if (valid) {
console.log(this.typefrom)
insert(this.typefrom.typeList).then((res)=>{
if(res.success){ if(res.success){
this.typeList = res.data.list this.$message.success("添加成功")
this.total = res.data.total this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push("/typeList")
}else{ }else{
this.$message.error(res.msg) this.$message.error(res.msg)
} }
}).catch((error)=>{ }).catch((error)=>{
this.$message.error("查询失败") console.log(error)
this.$message.error("添加失败")
}) })
}, } else {
//重置 console.log('error submit!!');
reset() { return false;
this.typeQurey = {
typeName: null,
typeCategory: null,
companyId: null,
pageNum: 1,
pageSize: 10,
} }
this.typeQurey.companyId = this.$store.getters.companyId });
this.getTypeList()
}, },
//添加类型 //重置
addtype() { resetForm() {
this.$router.push('/typeAdd') this.$refs.from.resetFields();
}, },
//修改类型 //删除
updataType(data){ removeDomain(item) {
this.$router.push({ var index = this.typefrom.typeList.indexOf(item)
path: '/typeUpdata', if (index !== -1) {
query:{ this.typefrom.typeList.splice(index, 1)
id:data.typeId,
} }
})
},
//搜索
qurey(){
this.typeQurey.pageNum = 1
this.getTypeList()
}, },
//换页 //新增类型
handleCurrentChange(val){ addDomain() {
this.typeQurey.pageNum = val this.typefrom.typeList.push(
this.getTypeList() {
key:Date.now(),
typeName:'',
typeCategory:'1',
companyId:this.$store.getters.companyId,
} }
);
}, },
}; //返回
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