From 0cd35d78a4edc361d377370bbc85417215610a67 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 02 七月 2024 10:41:00 +0800
Subject: [PATCH] 启动流程展示样式更改 添加启动流程节点选择穿梭框 调试模板查询 节点查询 启用流程默认接口
---
Source/plt-web/plt-web-ui/src/components/PLT-basic-component/transfer.vue | 79 ++++++-----
Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue | 261 +++++++++++++++++++++++++++---------
Source/plt-web/plt-web-ui/src/views/system/user/index.vue | 7
Source/plt-web/plt-web-ui/src/api/base/startWork/index.js | 22 +++
4 files changed, 262 insertions(+), 107 deletions(-)
diff --git a/Source/plt-web/plt-web-ui/src/api/base/startWork/index.js b/Source/plt-web/plt-web-ui/src/api/base/startWork/index.js
index 102dc35..265f67a 100644
--- a/Source/plt-web/plt-web-ui/src/api/base/startWork/index.js
+++ b/Source/plt-web/plt-web-ui/src/api/base/startWork/index.js
@@ -18,3 +18,25 @@
params: params,
});
}
+
+//鍚姩娴佺▼
+export const startProcess = (params) => {
+ let formData = new FormData()
+ for (let key in params) {
+ // 濡傛灉鏄� nodeUsers 瀵硅薄锛屽垯鐗规畩澶勭悊
+ if (key === 'nodeUsers' && typeof params[key] === 'object' && params[key] !== null) {
+ for (let innerKey in params[key]) {
+ formData.append(`${key}[${innerKey}]`, params[key][innerKey]);
+ }
+ } else {
+ // 闈瀗odeUsers灞炴�э紝鐩存帴娣诲姞鍒� formData 涓�
+ formData.append(key.replaceAll('"', ''), params[key]);
+ }
+ }
+ return request({
+ url: '/api/processDefineController/startProcess',
+ method: 'post',
+ data:formData
+ });
+}
+
diff --git a/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/transfer.vue b/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/transfer.vue
index 8afee4f..68f7a40 100644
--- a/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/transfer.vue
+++ b/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/transfer.vue
@@ -1,59 +1,59 @@
<template>
- <el-dialog
- v-dialogDrag
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :title="title"
- :visible.sync="visible"
- append-to-body="true"
- class="avue-dialog"
- style="text-align: center"
- width="40%"
- @close="dialogClose">
- <el-transfer
- v-model="rightRoleData"
- v-loading="loading"
- :data="data"
- :filter-method="filterMethod"
- :render-content="renderFunc"
- :titles="['鐜版湁瑙掕壊', '鎷ユ湁瑙掕壊']"
- filter-placeholder="瑙掕壊鍚嶇О鎼滅储"
- filterable
- style="text-align: left; display: inline-block;">
- </el-transfer>
- <span slot="footer" class="dialog-footer">
- <el-button @click="visible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="sendHandler">纭� 瀹�</el-button>
- </span>
- </el-dialog>
+ <el-dialog
+ v-dialogDrag
+ :close-on-click-modal="false"
+ :destroy-on-close="true"
+ :title="title"
+ :visible.sync="visible"
+ append-to-body="true"
+ class="avue-dialog"
+ style="text-align: center"
+ width="50%"
+ @close="dialogClose">
+ <el-transfer
+ v-model="rightRoleData"
+ v-loading="loading"
+ :data="data"
+ :filter-method="filterMethod"
+ :render-content="renderFunc"
+ :titles="transferTitle"
+ filter-placeholder="鍏抽敭璇嶆悳绱�"
+ filterable
+ style="text-align: left; display: inline-block;">
+ </el-transfer>
+ <div slot="footer" class="dialog-footer">
+ <div class="valueInfo" v-if="bottomValue">宸茶缃殑鍊间负锛歔{{bottomValue}}]</div>
+ <el-button @click="visible = false" size="small">鍙� 娑�</el-button>
+ <el-button type="primary" @click="sendHandler" size="small">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
</template>
<script>
export default {
name: "transfer",
- props: ['title', 'leftRoleData', 'rightRoleData'],
+ props: ['title', 'leftRoleData', 'rightRoleData', 'transferTitle' , 'bottomValue'],
data() {
return {
visible: false, // 閫氳繃 this.$refs.transfer.visible = true; 寮�鍚瓙缁勪欢瀵硅瘽妗�
data: [],
- value: [],
loading: false,
filterMethod(query, item) {
return item.label.indexOf(query) > -1;
},
renderFunc(h, option) {
- return <span><i class="el-icon-s-custom"></i> { option.label }</span>;
+ return <span><i class="el-icon-s-custom"></i> {option.label}</span>;
}
}
},
watch: {
//娓叉煋绌挎妗�
leftRoleData: {
- handler(newval, oldval) {
+ handler(newval) {
if (newval) {
// 娓呯┖data鏁扮粍
this.data = [];
- newval.forEach((city, index) => {
+ newval.forEach((city) => {
this.data.push({
label: city.name,
key: city.oid,
@@ -82,11 +82,20 @@
</script>
<style lang="scss" scoped>
-/deep/ .el-transfer-panel{ /* 宸﹀彸涓や釜绌挎妗嗙殑楂樺害鍜屽搴� */
- height: 450px;
+/deep/ .el-transfer-panel {
+ height: 450px; /* 宸﹀彸涓や釜绌挎妗嗙殑楂樺害鍜屽搴� */
+ width: 300px;
}
+
/deep/ .el-transfer-panel__list.is-filterable {
height: 323px; /* 绌挎妗嗗垪琛ㄩ珮搴� */
}
-
+.valueInfo{
+ float: left;
+ border: 1px solid #E9E7E7;
+ display: inline-block;
+ vertical-align: middle;
+ padding: 6px 12px;
+ line-height: 1;
+}
</style>
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..7b1d72e 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() {
@@ -135,26 +175,39 @@
}
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 = 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,108 @@
this.visible = false;
},
- handleSelect() {
-
- },
-
- handleCollect() {
-
- },
handleCancel() {
this.dialogClose();
},
handleConfirm() {
- console.log(this.initFrom);
+ 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:'', // 褰撳墠鏁版嵁oid锛屽涓敤,鍒嗛殧
+ 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>
diff --git a/Source/plt-web/plt-web-ui/src/views/system/user/index.vue b/Source/plt-web/plt-web-ui/src/views/system/user/index.vue
index 45970cc..ab0c3d1 100644
--- a/Source/plt-web/plt-web-ui/src/views/system/user/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/system/user/index.vue
@@ -41,7 +41,7 @@
<el-button icon="el-icon-download" plain size="small" type="primary">涓嬭浇瀵煎叆妯℃澘</el-button>
</template>
</avue-crud>
- <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData" title="鍒嗛厤瑙掕壊"
+ <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData" :transferTitle="transferTitle" title="鍒嗛厤瑙掕壊"
@transferSend="roleSendHandler"></transfer>
</basic-container>
</template>
@@ -71,8 +71,9 @@
},
searchParams: {},
selectList: [],
- leftRoleData: [], // 鍒嗛厤瑙掕壊绌挎妗嗗乏渚ч粯璁ゆ暟鎹�
- rightRoleData: [], // 鍒嗛厤瑙掕壊绌挎妗嗗彸渚ч粯璁ゆ暟鎹�
+ leftRoleData: [], // 鍒嗛厤瑙掕壊绌挎妗嗗乏渚у垵濮嬫暟鎹�
+ rightRoleData: [], // 鍒嗛厤瑙掕壊绌挎妗嗗彸渚у垵濮嬫暟鎹�
+ transferTitle:['鐜版湁瑙掕壊', '鎷ユ湁瑙掕壊']
}
},
created() {
--
Gitblit v1.9.3