Эх сурвалжийг харах

操作按钮管理修改按钮类型及表单渲染校验逻辑

lph 1 жил өмнө
parent
commit
f83b0f15d8

+ 10 - 0
ruoyi-ui/src/api/bpmprocess/run/executeProcess.js

@@ -62,3 +62,13 @@ export function runProcessNodeExecution(data) {
     baseURL: process.env.VUE_APP_BASE_API4
   })
 }
+
+// 运行节点 请求节点的表单数据
+export function getProcessNodeFormTemplate(query) {
+  return request({
+    url: '/system/runbpm/process/ProcessNodeFormTemplate',
+    method: 'get',
+    params: query,
+    baseURL: process.env.VUE_APP_BASE_API4,
+  })
+}

+ 7 - 3
ruoyi-ui/src/utils/bpmn/getNodeSequence.js

@@ -9,12 +9,15 @@ export default function getNodeSequence(xmlObj) {
     return;
   }
   let nextNodeId = getNodeId(startNode, true, nodeList);
+  let index = 1;
   res.push({
     nodeId: startNode.id,
     preNodeId: null,
     nextNodeId: nextNodeId,
-    nodeInfo: getNodeInfo(startNode.id, nodeList)
+    nodeInfo: getNodeInfo(startNode.id, nodeList),
+    num: index,
   })
+  index++;
   while (nextNodeId) {
     if (!nextNodeId) break
     let currentId = nextNodeId;
@@ -26,11 +29,12 @@ export default function getNodeSequence(xmlObj) {
         nodeId: currentId,
         preNodeId,
         nextNodeId,
-        nodeInfo: getNodeInfo(currentId, nodeList)
+        nodeInfo: getNodeInfo(currentId, nodeList),
+        num: index,
       }
     )
+    index++;
   }
-  console.log(res);
   return res
 
 }

+ 1 - 1
ruoyi-ui/src/views/bussiness/components/TaskItem.vue

@@ -7,7 +7,7 @@
     }"
   >
     <div class="task-title">
-      <span class="mr5">{{ number }}.</span>
+      <span class="mr5">{{ cardData.num }}.</span>
       <span>{{ cardData.nodeInfo.name }}</span>
     </div>
     <div class="msg-list">

+ 1 - 82
ruoyi-ui/src/views/bussiness/components/taskList.vue

@@ -57,88 +57,7 @@ export default {
       baseInfo: {},
       start: 0,
       end: 5,
-      taskItemList: [
-        {
-          index: 1,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 2,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 3,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 4,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 5,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 6,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 7,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 8,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 9,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-        {
-          index: 10,
-          title: "工艺校验",
-          taskKey: uuid(),
-          excuteUser: "admin",
-          taskType: "工艺类",
-          taskstatus: true,
-        },
-      ],
+      taskItemList: [],
     };
   },
   computed: {

+ 22 - 4
ruoyi-ui/src/views/bussiness/processMange.vue

@@ -200,6 +200,7 @@
 import {
   processList,
   runProcessNodeExecution,
+  getProcessNodeFormTemplate,
 } from "@/api/bpmprocess/run/executeProcess";
 import { triggerExceptionNode } from "@/api/bpmprocess/process";
 
@@ -338,7 +339,6 @@ export default {
     },
     // 打开运行节点弹窗
     async opneExecuteNode(row) {
-      console.log(row);
       this.resetDialogForm();
       let preFix = row.benTaskNodeName.split("-")[0];
       let {
@@ -347,12 +347,30 @@ export default {
         bepTaskPlanKey,
         bepTaskKey,
         bepTaskNodeKey,
+        benTaskProcessKey,
+        benmTaskAutomaticScriptTriggerType,
+        bepTaskNodeNextKey,
       } = row;
+      // 新的运行逻辑
+      let payLoad = {
+        taskNodeKey: bepTaskNodeNextKey,
+        taskProcessKey: benTaskProcessKey,
+        taskScriptKey: benmTaskAutomaticScriptTriggerType,
+      };
+
+      let formData = await getProcessNodeFormTemplate(payLoad);
+      console.log(formData);
       if (benTaskNodeFormKey) {
         if (benTaskNodeFormType == "dragForm") {
+          let templateInfo = formData.data[0]?.template;
           //拖拽表单
           this.formType = "dragForm";
-          await this.getDragFormInfo(benTaskNodeFormKey);
+          this.jsonData = JSON.parse(templateInfo.dfVueTemplate);
+          this.tableName = templateInfo.dfTableName;
+          if (Object.keys(JSON.parse(templateInfo.dfFormSql)).length) {
+            this.dynamicData = JSON.parse(templateInfo.dfFormSql);
+          }
+          // await this.getDragFormInfo(benTaskNodeFormKey);
         } else if (benTaskNodeFormType == "composeForm") {
           //工艺组合表单
           this.formType = "composeForm";
@@ -371,7 +389,7 @@ export default {
         this.myForm = preFix;
       }
       this.row = row; //记录当前行数据
-      if (!this.formType) return; //没有表单,直接掉运行逻辑
+      // if (!this.formType) return; //没有表单,直接掉运行逻辑
       this.open = true; // 打开弹窗
       // 根据当前节点绑定的表单信息查询对应的表单进行展示
     },
@@ -438,7 +456,7 @@ export default {
           }
         } else {
           console.log(res);
-          this.$message.error("网络异常,请稍后再试");
+          throw new Error(res);
         }
       } catch (error) {
         console.log(error);

+ 0 - 2
ruoyi-ui/src/views/bussiness/progressShow.vue

@@ -83,7 +83,6 @@ export default {
             res.rows.map((item) => item.resultMap)
           );
           this.total = res.total;
-          console.log(this.tableData);
         } else {
           this.$message.error("网络异常,请稍后再试");
         }
@@ -101,7 +100,6 @@ export default {
           cardList: [],
         };
         let xmlObj = xmlStr2XmlObj(item.bepTaskProcessXmlContent);
-        console.dir(xmlObj);
         baseObj.cardList = getNodeSequence(xmlObj);
         return baseObj;
       });

+ 0 - 8
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementAsyncContinuations.vue

@@ -135,20 +135,12 @@ export default {
       this.asyncScriptKey = "";
     },
     async getScriptList(industryType) {
-      let res = await listScript({
-        isEnablePaging: false,
-        industryType,
-      });
       this.scriptList = filterUtil({ industryType }, this.allScriptList()).map(
         (item) => ({
           value: item.scriptKey,
           label: item.scriptName,
         })
       );
-      // this.scriptList = res.rows.map((item) => ({
-      //   value: item.scriptKey,
-      //   label: item.scriptName,
-      // }));
     },
   },
 };

+ 4 - 6
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementExecuteForm.vue

@@ -67,12 +67,10 @@ export default {
   },
   methods: {
     async initFormData() {
-      this.formKey = [
-        getNodeFormType(getActive()),
-        Number(getFormKey(getActive())),
-      ];
+      this.formKey = [getNodeFormType(getActive()), getFormKey(getActive())];
     },
     updateFormKey(value) {
+      console.log(value);
       setNodeFormType(getActive(), value[0]);
       setFormKey(getActive(), value[1]);
     },
@@ -113,13 +111,13 @@ export default {
           list[0].children = res.rows.map((item) => {
             return {
               label: item.dfName,
-              value: item.fId,
+              value: item.fId + "",
             };
           });
           list[1].children = dialogList.rows.map((item) => {
             return {
               label: item.groupName,
-              value: item.groupKey,
+              value: item.groupKey + "",
             };
           });
           this.formList = list;

+ 25 - 1
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementUnusualTasks.vue

@@ -142,6 +142,7 @@
           v-if="newUnusualTask.formType == 'designForm'"
           label="表单:"
           size="normal"
+          prop="composeName"
         >
           <el-col :span="8">
             <el-input
@@ -225,6 +226,20 @@ export default {
           trigger: ["change"],
           message: "任务脚本不能为空",
         },
+        formType: {
+          required: true,
+          trigger: ["change"],
+          message: "表单类型不能为空",
+        },
+        formId: {
+          required: true,
+          trigger: ["change"],
+          message: "表单不能为空",
+        },
+        composeName: {
+          validator: this.composeNameValidate,
+          trigger: "blur",
+        },
         // scriptTriggerType: {
         //   required: true,
         //   trigger: ["blur", "change"],
@@ -274,6 +289,16 @@ export default {
     },
   },
   methods: {
+    // 自定义表单规则
+    composeNameValidate(rule, value, callback) {
+      if (!this.newUnusualTask) return;
+      let { formType, compName, scriptName } = this.newUnusualTask;
+      if (formType == "composeForm" && (!compName || !scriptName)) {
+        callback(new Error("请完善自定义表单名字"));
+      } else {
+        callback();
+      }
+    },
     reloadExtensionListeners() {
       this.modelVisible = false;
 
@@ -281,7 +306,6 @@ export default {
       this.scriptForm.scriptTriggerType = getScriptTriggerType(getActive());
 
       this.listeners = getUnusualTaskTableData(this._listenersRaw);
-      console.log(this.listeners);
     },
 
     updateScriptType(value) {

+ 4 - 2
ruoyi-ui/src/views/system/bpmnPro/components/bo-utils/getNodeMsg.js

@@ -82,7 +82,6 @@ export function getNodeMsg(xmlObj) {
       nodeObj.nodeAfter = 'true';
     }
     bpmProcessConfigurationList.push(nodeObj)
-    console.log(bpmProcessConfigurationList);
   })
   return {
     bpmProcessConfigurationList,
@@ -235,7 +234,6 @@ const blackArr = [
  */
 export function validateNode(xmlObj) {
   let preFix = getProcessEngine()
-  console.dir(xmlObj);
   let res = { flag: true }, nodeList = xmlObj.all;
   for (let index = 0; index < nodeList.length; index++) {
     const element = nodeList[index];
@@ -244,6 +242,10 @@ export function validateNode(xmlObj) {
       res.flag = false;
       res.msg = `${element.localName}必须绑定正常节点`
     }
+    if (!element.getAttribute(`${preFix}:nodeFormKey`)) {
+      res.flag = false;
+      res.msg = `${element.localName}必须绑定正常节点`
+    }
   }
   return res
 }