|
@@ -129,14 +129,42 @@
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
+ <template slot="userMold" slot-scope="{ row, index }">
|
|
|
+ <el-select
|
|
|
+ v-model="row.userMold"
|
|
|
+ filterable
|
|
|
+ placeholder="请选择规则"
|
|
|
+ @change="userMoldChange(row)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in ruleData"
|
|
|
+ :key="index"
|
|
|
+ :value="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <template slot="auditMoldId" slot-scope="{ row, index }">
|
|
|
+ <el-cascader
|
|
|
+ v-model="row.auditMoldId"
|
|
|
+ :disabled="!row.userMold || row.userMold == 3"
|
|
|
+ :options="row.userMold == 1? roleData: row.userMold == 2? deptData: []"
|
|
|
+ :props="props"
|
|
|
+ collapse-tags
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="auditChange(row)"
|
|
|
+ ></el-cascader>
|
|
|
+ </template>
|
|
|
<template slot="auditUserId" slot-scope="{row,index}">
|
|
|
<el-select
|
|
|
v-model="row.auditUserId"
|
|
|
filterable
|
|
|
collapse-tags
|
|
|
+ multiple
|
|
|
placeholder="审核人"
|
|
|
>
|
|
|
- <el-option v-for="(item,index) in auditUserIdDic"
|
|
|
+ <el-option v-for="(item,index) in row.userList"
|
|
|
:key="index"
|
|
|
:label="item.realName"
|
|
|
:value="item.id"
|
|
@@ -171,8 +199,14 @@
|
|
|
<script>
|
|
|
import option from "./config/mainList.json";
|
|
|
import detailOption from "./config/detail.json";
|
|
|
-import { getList, modify, removeList, detailData ,getUserList,getUserApprovalList} from "@/api/approval/processConfig";
|
|
|
+import { getList,
|
|
|
+ modify,
|
|
|
+ removeList,
|
|
|
+ detailData ,userList,
|
|
|
+ getUserApprovalList} from "@/api/approval/processConfig";
|
|
|
import _ from "lodash";
|
|
|
+import {getDeptTree} from "@/api/system/dept";
|
|
|
+import {getRoleTree} from "@/api/system/role";
|
|
|
|
|
|
export default {
|
|
|
name: "index",
|
|
@@ -208,6 +242,21 @@ export default {
|
|
|
status: 'A',
|
|
|
},
|
|
|
dataRule: {},
|
|
|
+ tenantId: null, // 租户
|
|
|
+ // dicData: [],
|
|
|
+ props: {
|
|
|
+ multiple: true,
|
|
|
+ value: 'id',
|
|
|
+ label: 'title',
|
|
|
+ emitPath: false,
|
|
|
+ },
|
|
|
+ roleData: [],
|
|
|
+ deptData: [],
|
|
|
+ ruleData: [
|
|
|
+ {value: 1, label: '角色'},
|
|
|
+ {value: 2, label: '部门'},
|
|
|
+ {value: 3, label: '用户'},
|
|
|
+ ], //指定规则
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
@@ -218,6 +267,14 @@ export default {
|
|
|
this.auditUserIdDic = res.data.data
|
|
|
})
|
|
|
|
|
|
+ this.tenantId = this.$store.getters.userInfo.tenant_id;
|
|
|
+ getRoleTree(this.tenantId).then(res => {
|
|
|
+ this.roleData = res.data.data;
|
|
|
+ });
|
|
|
+ getDeptTree(this.tenantId).then(res => {
|
|
|
+ this.deptData = res.data.data;
|
|
|
+ });
|
|
|
+
|
|
|
let i = 0;
|
|
|
this.option.column.forEach(item => {
|
|
|
if (item.search) i++
|
|
@@ -253,6 +310,27 @@ export default {
|
|
|
detailData({id: row.id}).then(res => {
|
|
|
this.dataForm = res.data.data
|
|
|
this.detailData = res.data.data.auditPathsLevels
|
|
|
+ this.detailData.map(e => {
|
|
|
+ let params = {};
|
|
|
+ if (e.auditMoldId && e.auditMoldId.length > 0) {
|
|
|
+ if (e.userMold === 1) {
|
|
|
+ this.$set(params, 'roleId', e.auditMoldId)
|
|
|
+ } else if (e.userMold === 2) {
|
|
|
+ this.$set(params, 'deptId', e.auditMoldId)
|
|
|
+ }
|
|
|
+ userList(params).then(response => {
|
|
|
+ this.$set(e, 'userList', response.data.data);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$set(e, 'userList', this.auditUserIdDic);
|
|
|
+ }
|
|
|
+ if (e.auditMoldId) {
|
|
|
+ e.auditMoldId = e.auditMoldId.split(',')
|
|
|
+ }
|
|
|
+ if (e.auditUserId) {
|
|
|
+ e.auditUserId = e.auditUserId.split(',')
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
this.title = '修改';
|
|
|
this.visible = !this.visible
|
|
@@ -304,6 +382,7 @@ export default {
|
|
|
},
|
|
|
addDetail() {
|
|
|
this.detailData.push({
|
|
|
+ userList: this.auditUserIdDic,
|
|
|
levelName: null,
|
|
|
auditUserId: [],
|
|
|
iffixAuditUser: 'T',
|
|
@@ -330,18 +409,22 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
-
|
|
|
- this.detailData.map(item=>{
|
|
|
+ }
|
|
|
+ let params ={
|
|
|
+ ...this.dataForm,
|
|
|
+ auditPathsLevels: JSON.parse(JSON.stringify(this.detailData))
|
|
|
+ }
|
|
|
+ for (let item of params.auditPathsLevels){
|
|
|
item.levelId = _.add(item.$index,1)
|
|
|
delete item.id
|
|
|
- })
|
|
|
-
|
|
|
- const params ={
|
|
|
- ...this.dataForm,
|
|
|
- auditPathsLevels : this.detailData
|
|
|
+ if (item.auditMoldId) {
|
|
|
+ console.log(item.auditMoldId)
|
|
|
+ item.auditMoldId = item.auditMoldId.join(',');
|
|
|
+ }
|
|
|
+ if (item.auditUserId) {
|
|
|
+ item.auditUserId = item.auditUserId.join(',');
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
modify(params).then(res =>{
|
|
|
if(res.data.success){
|
|
|
this.$message.success("操作成功!")
|
|
@@ -350,6 +433,28 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ auditChange(row) {
|
|
|
+ let params = {};
|
|
|
+ row.auditUserId = null;
|
|
|
+ if (row.auditMoldId && row.auditMoldId.length > 0) {
|
|
|
+ const data = row.auditMoldId.join(',');
|
|
|
+ if (row.userMold === 1) {
|
|
|
+ this.$set(params, 'roleId', data)
|
|
|
+ } else if (row.userMold === 2) {
|
|
|
+ this.$set(params, 'deptId', data)
|
|
|
+ }
|
|
|
+ userList(params).then(res => {
|
|
|
+ this.$set(row, 'userList', res.data.data);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$set(row, 'userList', [])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userMoldChange(row) {
|
|
|
+ row.auditUserId = null;
|
|
|
+ row.auditMoldId = null;
|
|
|
+ this.$set(row, 'userList', row.userMold == 3? this.auditUserIdDic: []);
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|