소스 검색

优化流程相关接口请求逻辑

lph 1 년 전
부모
커밋
ed6b6a5459

+ 3 - 2
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementAsyncContinuations.vue

@@ -78,7 +78,8 @@ import { filterUtil } from "@packages/bo-utils/filterUtil.js";
 export default {
   name: "ElementAsyncContinuations",
   dicts: ["industry_type"],
-  props: ["allScriptList"],
+  // props: ["allScriptList"],
+  inject: ["allScriptList"],
   data() {
     return {
       acBefore: true,
@@ -138,7 +139,7 @@ export default {
         isEnablePaging: false,
         industryType,
       });
-      this.scriptList = filterUtil({ industryType }, this.allScriptList);
+      this.scriptList = filterUtil({ industryType }, this.allScriptList());
       // this.scriptList = res.rows.map((item) => ({
       //   value: item.scriptKey,
       //   label: item.scriptName,

+ 5 - 4
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementExecuteUser.vue

@@ -81,7 +81,8 @@ import { filterUtil } from "@packages/bo-utils/filterUtil.js";
 
 export default {
   name: "ElementExecuteUser",
-  props: ["allUserList", "allRoleList"],
+  // props: ["allUserList", "allRoleList"],
+  inject: ["allUserList", "allRoleList"],
   data() {
     return {
       userTypeList: [
@@ -130,7 +131,7 @@ export default {
       return label;
     },
     userList() {
-      return this.allUserList.map((item) => {
+      return this.allUserList().map((item) => {
         return {
           value: item.userId.toString(),
           label: item.nickName,
@@ -138,7 +139,7 @@ export default {
       });
     },
     roleList() {
-      return this.allRoleList.map((item) => {
+      return this.allRoleList().map((item) => {
         return {
           value: item.roleKey,
           label: item.roleName,
@@ -190,7 +191,7 @@ export default {
       }
     },
     async exeUserListHandler() {
-      this.allUserList.forEach((item) => {
+      this.allUserList().forEach((item) => {
         this.exeUserValueList.push({
           value: item.userId.toString(),
           label: item.nickName,

+ 3 - 2
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementNormalTask.vue

@@ -89,7 +89,8 @@ import { filterUtil } from "@packages/bo-utils/filterUtil.js";
 export default {
   name: "ElementNormalTask",
   dicts: ["industry_type", "script_trigger_type"],
-  props: ["allScriptList"],
+  // props: ["allScriptList"],
+  inject: ["allScriptList"],
   data() {
     return {
       scriptList: [],
@@ -130,7 +131,7 @@ export default {
       // });
       this.scriptList = filterUtil(
         { scriptType: 1, industryType },
-        this.allScriptList
+        this.allScriptList()
       ).map((item) => ({
         value: item.scriptKey,
         label: item.scriptName,

+ 8 - 4
ruoyi-ui/src/views/system/bpmnPro/components/Panel/components/ElementUnusualTasks.vue

@@ -209,7 +209,8 @@ import { filterUtil } from "@packages/bo-utils/filterUtil.js";
 export default {
   name: "ElementUnusualTasks",
   dicts: ["script_trigger_type", "bpm_script_type", "industry_type"],
-  props: ["allScriptList"],
+  // props: ["allScriptList"],
+  inject: ["allScriptList"],
   data() {
     return {
       modelVisible: false,
@@ -260,10 +261,14 @@ export default {
   },
 
   mounted() {
-    console.log("allScriptList", this.allScriptList);
     this.reloadExtensionListeners();
     EventEmitter.on("element-update", this.reloadExtensionListeners);
   },
+  computed: {
+    filteredScriptList() {
+      console.log(this.scriptKeyList, this.listeners);
+    },
+  },
   methods: {
     reloadExtensionListeners() {
       this.modelVisible = false;
@@ -272,7 +277,6 @@ export default {
       this.scriptForm.scriptTriggerType = getScriptTriggerType(getActive());
 
       this.listeners = getUnusualTaskTableData(this._listenersRaw);
-      console.log(this.listeners);
     },
 
     updateScriptType(value) {
@@ -359,7 +363,7 @@ export default {
         scriptType: "0",
         industryType,
       };
-      this.scriptKeyList = filterUtil(condition, this.allScriptList).map(
+      this.scriptKeyList = filterUtil(condition, this.allScriptList()).map(
         (item) => ({
           value: item.scriptKey,
           label: item.scriptName,

+ 12 - 15
ruoyi-ui/src/views/system/bpmnPro/components/Panel/index.vue

@@ -6,14 +6,7 @@
       <p>{{ customTranslate(currentElementType || "Process") }}</p>
     </div>
     <el-collapse>
-      <component
-        v-for="cp in this.renderComponents"
-        :key="cp.name"
-        :is="cp"
-        :allScriptList="allScriptList"
-        :allUserList="allUserList"
-        :allRoleList="allRoleList"
-      />
+      <component v-for="cp in this.renderComponents" :key="cp.name" :is="cp" />
     </el-collapse>
   </div>
 </template>
@@ -88,10 +81,13 @@ export default {
       currentElementId: undefined,
       customTranslate,
       renderComponents: [],
-      // 列表选择数据
-      allScriptList: [],
-      allUserList: [],
-      allRoleList: [],
+    };
+  },
+  provide() {
+    return {
+      // allScriptList: this.allScriptList,
+      // allUserList: this.allUserList,
+      // allRoleList: this.allRoleList,
     };
   },
   created() {
@@ -113,9 +109,9 @@ export default {
     });
   },
   mounted() {
-    this.getAllScriptList();
-    this.getAllRoleList();
-    this.getAllUserList();
+    // this.getAllScriptList();
+    // this.getAllRoleList();
+    // this.getAllUserList();
     !this.currentElementId && this.setCurrentElement();
   },
   methods: {
@@ -210,6 +206,7 @@ export default {
           throw Error(res?.msg);
         }
       } catch (error) {
+        // console.log(object);
         this.$message.warning("网络异常,请稍后再试");
       }
     },

+ 67 - 0
ruoyi-ui/src/views/system/bpmnPro/index.vue

@@ -38,6 +38,10 @@ import "bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css";
 
 import { getProcess, getNodeData } from "@/api/bpmprocess/process";
 
+import { listScript } from "@/api/bpmprocess/process";
+import { listUser } from "@/api/system/user";
+import { listRole } from "@/api/system/role";
+
 export default {
   name: "App",
   components: {
@@ -52,6 +56,10 @@ export default {
       formData: undefined,
       xmlString: undefined,
       nodeData: undefined,
+      // 列表选择数据
+      allScriptList: [],
+      allUserList: [],
+      allRoleList: [],
     };
   },
   computed: {
@@ -61,15 +69,74 @@ export default {
     return {
       formData: () => this.formData,
       nodeData: () => this.nodeData,
+      allScriptList: () => this.allScriptList,
+      allUserList: () => this.allUserList,
+      allRoleList: () => this.allRoleList,
     };
   },
   methods: {
     Provence(ev) {
       ev.preventDefault();
     },
+    // 获取所有脚本列表
+    async getAllScriptList() {
+      try {
+        let res = await listScript({ isEnablePaging: false });
+        // console.log(res);
+        if (res.code == 200) {
+          this.allScriptList = res.rows;
+        } else {
+          throw Error(res?.msg);
+        }
+      } catch (error) {
+        this.$message.warning("网络异常,请稍后再试");
+      }
+    },
+    // 获取所有用户列表
+    async getAllUserList() {
+      try {
+        let res = await listUser({ isEnablePaging: false });
+        if (res.code == 200) {
+          // res.rows.forEach((item) => {
+          // this.exeUserValueList.push({
+          //   value: item.userId.toString(),
+          //   label: item.nickName,
+          // });
+
+          // });
+          this.allUserList = res.rows;
+        } else {
+          throw Error(res?.msg);
+        }
+      } catch (error) {
+        this.$message.warning("网络异常,请稍后再试");
+      }
+    },
+    // 获取所有角色列表
+    async getAllRoleList() {
+      try {
+        let res = await listRole(this.queryParams);
+        if (res.code == 200) {
+          // res.rows.forEach((item) => {
+          //   this.exeUserValueList.push({
+          //     value: item.roleKey,
+          //     label: item.roleName,
+          //   });
+          // });
+          this.allRoleList = res.rows;
+        } else {
+          throw Error(res?.msg);
+        }
+      } catch (error) {
+        this.$message.warning("网络异常,请稍后再试");
+      }
+    },
   },
   async mounted() {
     document.body.addEventListener("contextmenu", this.Provence);
+    this.getAllScriptList();
+    this.getAllRoleList();
+    this.getAllUserList();
   },
   async created() {
     if (this.$route.query?.id) {