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

20221115

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