| | |
| | | <el-divider v-if="tags.length !== 0"></el-divider> |
| | | <el-form :model="saveParam" class="demo-form-inline" label-position="left" label-width="auto" :rules="rules"> |
| | | <el-form-item label="流程模板"> |
| | | <el-input placeholder="流程模板" v-model="saveParam.modelName" disabled ></el-input> |
| | | <el-input placeholder="流程模板" v-model="saveParam.modelName" disabled></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="流程名称" prop="processName"> |
| | | <el-input placeholder="流程名称" v-model="saveParam.processName" > |
| | | <el-input placeholder="流程名称" v-model="saveParam.processName"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="流程描述"> |
| | | <el-input placeholder="流程描述" type="textarea" :rows="4" v-model="saveParam.processDesc" > |
| | | <el-input placeholder="流程描述" type="textarea" :rows="4" v-model="saveParam.processDesc"> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | |
| | | </div> |
| | | <el-form :model="collectParam" class="demo-form-inline" label-position="left" label-width="auto"> |
| | | <el-form-item :label="item.taskName" v-for="(item, index) in initFrom" :key="index"> |
| | | <el-select style="width: 80%;" filterable v-model="collectParam.flowTaskUsers[index]['userId']" |
| | | <el-select style="width: 80%;" filterable v-model="collectParam.flowTaskUsers[index]['userId']" |
| | | :placeholder="item.taskName" @change="handleSelect($event, index)"> |
| | | <el-option :label="key.userNames" :value="key.userId" v-for="(key, keyi) in typeName" |
| | | :key="keyi"></el-option> |
| | |
| | | default: () => { |
| | | return { |
| | | ids: 'ids', |
| | | flowName: 'flowName', |
| | | flowTemplate: 'flowTemplate', |
| | | code: 'code', |
| | | type: 'type' |
| | |
| | | watch: { |
| | | visible(n) { |
| | | this.dialogVisible = n; |
| | | if (n) { |
| | | this.apiInit() |
| | | this.apiDict() |
| | | } |
| | | }, |
| | | dialogVisible(n) { |
| | | this.$emit('update:visible', n) |
| | | }, |
| | | users:{ |
| | | handler(val){ |
| | | console.log('监听users',val) |
| | | this.collectParam.flowTaskUsers = val |
| | | }, |
| | | deep:true, |
| | | immediate:true |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | |
| | | mounted() { |
| | | this.apiInit() |
| | | this.apiDict() |
| | | // this.apiInit() |
| | | // this.apiDict() |
| | | }, |
| | | methods: { |
| | | saveParam() { |
| | | return { |
| | | modelName: this.parameter[this.parameterKeys.flowName], |
| | | processName: this.parameter[this.parameterKeys.flowTemplate], |
| | | topName: this.title, |
| | | ids: this.parameter[this.parameterKeys.ids], |
| | | } |
| | | }, |
| | | userIndex(arr1) { |
| | | return this.initFrom.findIndex(i => i.taskId === arr1) |
| | | }, |
| | | async apiInit() { |
| | | const response = await personnelInit({ type: this.parameter[this.parameterKeys.type], templateId: this.parameter[this.parameterKeys.code] }) |
| | |
| | | console.log(response) |
| | | this.initFrom = response.data.data.user |
| | | this.tags = response.data.data.collect |
| | | const { modelKey, templateId } = response.data.data.flow |
| | | const { modelKey, templateId, modelName } = response.data.data.flow |
| | | let flowTaskUsers = response.data.data.user |
| | | this.collectParam = { modelKey, templateId, flowTaskUsers: flowTaskUsers } |
| | | this.saveParam = { ...this.saveParam, modelKey, templateId } |
| | | this.handleClickTag(this.tags[0]) |
| | | console.log(this.collectParam) |
| | | this.saveParam = { ...this.saveParam, modelKey, templateId, modelName } |
| | | if (this.tags.length !== 0) this.handleClickTag(this.tags[0]) |
| | | } |
| | | }, |
| | | async apiDict() { |
| | | const response = await personnelDict() |
| | | console.log(response) |
| | | if (response.status === 200) { |
| | | console.log(response) |
| | | const data = response.data.data |
| | |
| | | this.collectParam = { ...this.collectParam, name: value } |
| | | console.log(this.collectParam) |
| | | const response = await personnelCollect(this.collectParam) |
| | | console.log(response) |
| | | if (response.status === 200) { |
| | | this.$nextTick(() => { |
| | | this.apiInit() |
| | | }) |
| | | console.log(response) |
| | | } |
| | | }).catch(() => { |
| | | |
| | |
| | | }, |
| | | async apiSave() { |
| | | try { |
| | | const response = await personnelSave(this.saveParam) |
| | | if (response.status === 200) { |
| | | console.log(response) |
| | | const len = this.collectParam.flowTaskUsers.length |
| | | console.log(this.collectParam.flowTaskUsers) |
| | | console.log(len == 0) |
| | | console.log(len != this.initFrom.length) |
| | | if (len == 0 && len != this.initFrom.length) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: response.data.msg |
| | | type: "error", |
| | | message: "请选择节点!" |
| | | }); |
| | | this.done() |
| | | } else { |
| | | console.log('baoc') |
| | | // const response = await personnelSave({ ...this.saveParam, flowTaskUsers: this.collectParam.flowTaskUsers }) |
| | | // if (response.status === 200) { |
| | | // console.log(response) |
| | | // this.$message({ |
| | | // type: 'success', |
| | | // message: response.data.msg |
| | | // }); |
| | | // this.done() |
| | | // } |
| | | } |
| | | |
| | | } catch { |
| | | console.error('接口调用失败') |
| | | } |
| | | }, |
| | | handleClickTag(event) { |
| | | console.log(event) |
| | | const flowTaskUsers = event.flowTaskUsers |
| | | this.collectParam.flowTaskUsers = flowTaskUsers.map(item => { |
| | | const { taskId, taskName, userId, userName } = item |
| | | return { taskId, taskName, userId, userName } |
| | | console.log(event.flowTaskUsers) |
| | | |
| | | console.log(this.collectParam.flowTaskUsers) |
| | | let flowTaskUsers = this.collectParam.flowTaskUsers |
| | | this.collectParam.flowTaskUsers = flowTaskUsers.map((item, index) => { |
| | | for (let i = 0; i < event.flowTaskUsers.length; i++) { |
| | | if (item.taskId == event.flowTaskUsers[i].taskId) { |
| | | item['userName'] = event.flowTaskUsers[i]['userName'] |
| | | item['userId'] = event.flowTaskUsers[i]['userId'] |
| | | } |
| | | } |
| | | return item |
| | | }) |
| | | this.users = this.collectParam.flowTaskUsers |
| | | // const flowTaskUsers = event.flowTaskUsers//collet.flowTaskUsers |
| | | // let tasks = this.collectParam.flowTaskUsers;//user |
| | | // for (let i = 0; i < tasks.length; i++) { |
| | | // let thisFlowTaskUsers = tasks[i]; |
| | | // for (let j = 0; j < flowTaskUsers.length; j++) { |
| | | // let thisFflowTaskUsers = flowTaskUsers[j]; |
| | | // if (thisFlowTaskUsers.taskId == thisFflowTaskUsers.taskId) { |
| | | // thisFlowTaskUsers['userName'] = thisFflowTaskUsers.userName; |
| | | // thisFlowTaskUsers['userId'] = thisFflowTaskUsers.userId; |
| | | // } |
| | | // } |
| | | // } |
| | | // this.collectParam.flowTaskUsers = {...this.collectParam.flowTaskUsers,userId,userName} |
| | | }, |
| | | handleCloseTag(event) { |
| | | console.log(event) |
| | |
| | | handleSelect(event, index) { |
| | | const res = this.typeName.find(item => item.userId === event) |
| | | const { userName } = res |
| | | let users = { ... this.collectParam.flowTaskUsers[index], userName } |
| | | console.log(users) |
| | | this.users[index] = users |
| | | this.$set(this.users, index, { ... this.collectParam.flowTaskUsers[index], userName }) |
| | | // this.users[index] = { ... this.collectParam.flowTaskUsers[index], userName } |
| | | console.log(this.users) |
| | | }, |
| | | done() { |
| | | this.dialogVisible = false |
| | |
| | | justify-content: end; |
| | | padding-bottom: 10px; |
| | | } |
| | | </style> |
| | | </style> |