From 328b0158c3d97f87efc7da22a1e3f5a7c258b127 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 04 七月 2024 19:17:17 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue | 264 ++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 194 insertions(+), 70 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue b/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue index ac10977..b374b46 100644 --- a/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue +++ b/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue @@ -6,14 +6,18 @@ :width="width" append-to-body="true" class="avue-dialog" - style="margin-top: -10% !important;" title="鍚姩娴佺▼" - top="0" @close="dialogClose"> - <el-form :model="saveParam" :rules="rules" class="demo-form-inline" label-position="left" label-width="auto"> + <el-divider content-position="left">娴佺▼淇℃伅</el-divider> + + <el-form ref="nodeForm" :model="saveParam" :rules="rules" class="demo-form-inline" label-position="left" + label-width="auto"> <el-form-item label="娴佺▼妯℃澘"> - <el-input v-model="saveParam.modelName" disabled placeholder="娴佺▼妯℃澘"></el-input> + <el-select v-model="saveParam.processTemplate" filterable style="width: 100%;" @change="proTemSelect($event)"> + <el-option v-for="(item, key) in processTemplateList" :key="key" :label="item.value" + :value="item.value"></el-option> + </el-select> </el-form-item> <el-form-item label="娴佺▼鍚嶇О" prop="processName"> <el-input v-model="saveParam.processName" placeholder="娴佺▼鍚嶇О"> @@ -25,30 +29,33 @@ </el-form-item> </el-form> - <el-divider></el-divider> - <!-- <div class="btns-icon">--> - <!-- <el-button circle icon="el-icon-star-off" @click="handleCollect"></el-button>--> - <!-- </div>--> - <el-form :model="collectParam" class="demo-form-inline" label-position="left" label-width="auto"> - <el-form-item v-for="(item, index) in initFrom" :key="index" :label="`鑺傜偣${index + 1}`"> - <el-select style="width: 100%;" filterable v-model="collectParam.flowTaskUsers[index]['userId']" - :placeholder="item.value" @change="handleSelect($event, index)"> - <el-option :label="key.name" :value="key.name" v-for="(key, keyi) in item.processNodes" - :key="keyi"></el-option> - </el-select> + <el-divider content-position="left">娴佺▼鑺傜偣</el-divider> + + + <el-form :key="formKey" v-loading="nodeLoading" :model="collectParam" :rules="nodeRules" class="demo-form-inline" + label-position="left" + label-width="auto"> + <el-form-item v-for="(item, index) in initFrom" :key="index" :label="item.name" prop="node"> + <div @click="nodeChange(item)"> + <el-input v-model="collectParam[item.name+'name']" readonly="true" suffix-icon="el-icon-zoom-in"></el-input> + </div> </el-form-item> </el-form> - <div slot="footer" class="dialog-footer"> - <el-button @click="handleCancel">鍙� 娑�</el-button> - <el-button type="primary" @click="handleConfirm">纭� 瀹�</el-button> - </div> + <div slot="footer" class="dialog-footer"> + <el-button size="small" @click="handleCancel">鍙� 娑�</el-button> + <el-button size="small" type="primary" @click="handleConfirm">纭� 瀹�</el-button> + </div> + <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData" + :title="`涓恒��${this.nodeName}銆戦�夊彇鍊糮" :transferTitle="transferTitle" :bottomValue="bottomValue" + @transferSend="roleSendHandler"></transfer> </el-dialog> + </template> <script> import {validatenull} from "@/util/validate"; -import {getTemplateByType, getAllProcessNode} from "@/api/base/startWork/index" +import {getTemplateByType, getAllProcessNode, startProcess} from "@/api/base/startWork/index" export default { name: "startWorkFlow", @@ -71,34 +78,67 @@ data() { return { visible: false, - saveParam: {}, // 瀵硅薄鍖呭惈 {modelName娴佺▼妯℃澘(鐢辨帴鍙h繑鍥炲綋鍓嶆祦绋嬫ā鏉�) , processName娴佺▼鍚嶇О锛堜负褰撳墠鐢ㄦ埛+'鍚姩娴佺▼'+褰撳墠鍒嗙被锛� , processDesc娴佺▼鎻忚堪 } + saveParam: { + processName: '' + }, // 瀵硅薄鍖呭惈 {processTemplate娴佺▼妯℃澘(鐢辨帴鍙h繑鍥炲綋鍓嶆祦绋嬫ā鏉�) , processName娴佺▼鍚嶇О锛堜负褰撳墠鐢ㄦ埛+'鍚姩娴佺▼'+褰撳墠鍒嗙被锛� , processDesc娴佺▼鎻忚堪 } + processTemplateList: [], // 娴佺▼妯℃澘涓嬫媺鏁扮粍 initFrom: [], // 褰撳墠娴佺▼鑺傜偣寰幆鏁扮粍 collectParam: {}, // 娴佺▼鑺傜偣涓嬫媺妗嗗弻鍚戠粦瀹氬睘鎬� typeName: [], // 娴佺▼鑺傜偣option寰幆閫夐」 + nodeLoading: false, rules: { processName: [ {required: true, message: '娴佺▼鍚嶇О涓嶈兘涓虹┖', trigger: 'blur'}, {min: 3, max: 50, message: '闀垮害鍦� 3 鍒� 50 涓瓧绗�', trigger: 'blur'} ] - } + }, + nodeRules: { + node: [ + {required: true, message: '閫夋嫨鍐呭涓嶈兘涓虹┖', trigger: 'change'}, + ] + }, + bottomValue:'', + leftRoleData: [], + rightRoleData: [], + transferTitle: [], + nodeName: '', // 褰撳墠鑺傜偣鍚嶇О + userVo: [ + { + "children": [], + "id": "zkjs", + "leaf": true, + "name": "鎬讳細璁″笀", + "oid": "1241AC3B-26AF-9B86-7870-53DA8D78A742", + "secret": -1, + "secretText": "", + "type": "user" + }, + { + "children": [], + "id": "1", + "leaf": true, + "name": "娴嬭瘯", + "oid": "921D71F8-C2BB-3BCE-B744-AD0C3812F41A", + "secret": -1, + "secretText": "", + "type": "user" + }, + { + "children": [], + "id": "5", + "leaf": true, + "name": "鎬讳細璁″笀", + "oid": "34ddb5a8-ab95-4070-b72f-abaaa48cf8b1", + "secret": -1, + "secretText": "", + "type": "user" + } + ], + formKey: 0, + } }, - watch: { - users: { - handler(val) { - this.collectParam.flowTaskUsers = val - }, - deep: true, - immediate: true - }, - parameter: { - handler(newval, oldval) { - this.saveParam = Object.assign({processName: '', processDesc: '',}, newval); - }, - deep: true, - immediate: true - } - }, + watch: {}, computed: { fullscreen() { if (this.paramVOS.width || this.paramVOS.height) { @@ -121,7 +161,7 @@ }, }, created() { - this.modelNameChange(); + // this.modelNameChange(); this.getWorkByType(); }, mounted() { @@ -131,30 +171,43 @@ getWorkByType() { let params = { type: '鏂囨。瀹$娴佺▼', - filterTemplate: "" + filterTemplate: "鏂囨。瀹$娴佺▼" } getTemplateByType(params).then(res => { const data = res.data.data; - data.forEach(item => { - this.getProcessNode(item); - }) - this.initFrom = data; - }).catch(error => { - console.log(error); + const userInfo = JSON.parse(localStorage.getItem('saber-userInfo')); + + this.processTemplateList = data; + this.saveParam.processTemplate = data[0].value; + this.saveParam.processName = this.paramVOS.processName || userInfo.content.userName + '-' + data[0].value; // 瀵规祦绋嬫ā鏉� 娴佺▼鍚嶇О璧嬮粯璁ゅ�� + + this.getProcessNode(data[0].attributes.oid); // 棣栨杩涘叆璋冪敤绗竴涓ā鏉跨殑鎵�鏈夎妭鐐� + }).catch(err => { + this.$message.error(err); }) }, // 璇锋眰娴佺▼鑺傜偣 - getProcessNode(item) { + getProcessNode(oid) { let params = { - processOid: item.attributes.oid, + processOid: oid, maxSecret: -1 } getAllProcessNode(params).then(res => { const nodes = res.data.data; - item.processNodes = nodes; - }).catch(error => { - console.log(error); + this.initFrom = nodes; + nodes.forEach(item => { + // let name = item.processUserVO[0].children.map(name => name.name).join(','); + // let ids = item.processUserVO[0].children.map(id => id.id).join(','); + let name = this.userVo.map(name => name.name).join(','); + let ids = this.userVo.map(id => id.id).join(','); + this.bottomValue = name; + this.collectParam[item.name + 'name'] = name; + this.collectParam[item.name] = ids; + }) + this.nodeLoading = false; + }).catch(err => { + this.$message.error(err); }) }, @@ -163,38 +216,109 @@ this.visible = false; }, - handleSelect() { - - }, - - handleCollect() { - - }, handleCancel() { this.dialogClose(); }, handleConfirm() { - console.log(this.initFrom); + const oids = this.dataStore.map(item => item.oid).join(','); + let params = { + deployid:this.processTemplateList[0].attributes.deploymentId, + title:this.saveParam.processName, + description:this.saveParam.processDesc, + btmType:this.processTemplateList[0].attributes.taskType, + uiType:this.processTemplateList[0].attributes.taskType, + oids:oids, // 褰撳墠鏁版嵁oid锛屽涓敤,鍒嗛殧 + detailInfoUrl:this.paramVOS.detailInfoUrl || '', // 鐢ㄦ埛閰嶇疆灞炴�� + resetStatus:'Editing', + nodeUsers:{ + ...this.collectParam + } + } + startProcess(params).then(res => { + if(res.data.obj.status === 200){ + this.dialogClose(); + this.$message.success('鍚姩娴佺▼鎴愬姛'); + }else { + this.$message.error(res.data.obj.error); + } + }).catch(err => { + this.$message.error(err); + }) }, - // 娴佺▼鍚嶇О鍒濆鍖栫粦瀹� - modelNameChange() { - var userInfo = JSON.parse(localStorage.getItem('saber-userInfo')); + // 鍒囨崲娴佺▼妯℃澘 + proTemSelect(event) { + this.nodeLoading = true; + this.getProcessNode(event); + this.$refs.nodeForm.clearValidate(); + }, - if (this.paramVOS && this.paramVOS.modelName) { - this.saveParam.modelName = this.paramVOS.modelName; - } else if (userInfo.content && userInfo.content.userName) { - this.saveParam.modelName = userInfo.content.userName + '鍚姩娴佺▼'; - } else { - this.saveParam.modelName = ''; - } - } + // 鑺傜偣鐐瑰嚮浜嬩欢 + nodeChange(item) { + this.nodeName = item.name; + this.transferTitle = [`[${item.name}]鏈�夌敤鎴穈, `[${item.name}]宸查�夌敤鎴穈] + this.leftRoleData = [ + { + "children": [], + "id": "zkjs", + "leaf": true, + "name": "鎬讳細璁″笀", + "oid": "1241AC3B-26AF-9B86-7870-53DA8D78A742", + "secret": -1, + "secretText": "", + "type": "user" + }, + { + "children": [], + "id": "1", + "leaf": true, + "name": "娴嬭瘯", + "oid": "921D71F8-C2BB-3BCE-B744-AD0C3812F41A", + "secret": -1, + "secretText": "", + "type": "user" + }, + { + "children": [], + "id": "5", + "leaf": true, + "name": "鎬讳細璁″笀", + "oid": "34ddb5a8-ab95-4070-b72f-abaaa48cf8b1", + "secret": -1, + "secretText": "", + "type": "user" + } + ]; + this.rightRoleData = this.userVo.map(item => item.oid); + this.$refs.transfer.visible = true; + }, + + // 绌挎妗嗗洖濉� + roleSendHandler(data) { + let filterData; + filterData = this.userVo.filter(item => { + return data.includes(item.oid); + }); + const filterName = filterData.map(item => item.name).join(','); + this.$set(this.collectParam, this.nodeName + 'name', filterName); + this.formKey += 1; // 鍒锋柊琛ㄥ崟 鍥犱负鍙屽悜缁戝畾鐨則his.collectParam[this.nodeName + 'name']鏄姩鎬佸�� vue鏃犳硶妫�娴嬪埌鍊肩殑鏇存柊 + }, } } </script> <style lang="scss" scoped> +.el-form-item { + margin-bottom: 25px; +} +.el-divider--horizontal { + margin-bottom: 20px !important; +} + +.el-divider__text.is-left { + color: #8b8989 !important; +} </style> -- Gitblit v1.9.3