浏览代码

补全保存的所有节点数据/表格多选分页显示已勾选数据

lph 1 年之前
父节点
当前提交
9a4ae33b7c

+ 17 - 1
ruoyi-ui/src/views/bpmprocess/index.vue

@@ -139,6 +139,7 @@
       v-loading="loading"
       :data="processList"
       @selection-change="handleSelectionChange"
+      ref="tableRef"
     >
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="主键" align="center" prop="processId" />
@@ -366,6 +367,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -426,10 +429,22 @@ export default {
     /** 查询流程定义列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listProcess(this.queryParams).then((response) => {
-        this.processList = response.rows;
+        response.rows = response.rows.filter(
+          (item) =>
+            !tempSelection.find((val) => val.processId == item.processId)
+        );
+        this.processList = [...tempSelection, ...response.rows];
         this.total = response.total;
         this.loading = false;
+        if (tempSelection.length) {
+          this.$nextTick(() => {
+            tempSelection.forEach((item) => {
+              this.$refs.tableRef.toggleRowSelection(item);
+            });
+          });
+        }
       });
     },
     // 取消按钮
@@ -475,6 +490,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.processId);
+      this.selection = selection;
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },

+ 20 - 5
ruoyi-ui/src/views/dragform/index.vue

@@ -150,6 +150,7 @@
       tooltip-effect="dark"
       v-loading="loading"
       :data="formList"
+      ref="tableRef"
       @selection-change="handleSelectionChange"
     >
       <el-table-column
@@ -370,6 +371,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -414,11 +417,21 @@ export default {
      列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listForm(this.queryParams).then((response) => {
-        console.log(response);
-        this.formList = response.rows;
+        response.rows = response.rows.filter(
+          (item) => !tempSelection.find((val) => val.fId == item.fId)
+        );
+        this.formList = [...tempSelection, ...response.rows];
         this.total = response.total;
         this.loading = false;
+        if (tempSelection.length) {
+          this.$nextTick(() => {
+            tempSelection.forEach((item) => {
+              this.$refs.tableRef.toggleRowSelection(item);
+            });
+          });
+        }
       });
     },
     // 取消按钮
@@ -462,6 +475,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.fId);
+      this, (selection = selection);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
@@ -523,13 +537,14 @@ export default {
           ...this.queryParams,
         },
         `form_${new Date().getTime()}.xlsx`
-      );0
+      );
+      0;
     },
   },
 };
 </script>
 <style scoped lang="scss">
-::v-deep .el-form-item__label{
+::v-deep .el-form-item__label {
   width: 85px !important;
 }
-</style>
+</style>

+ 16 - 1
ruoyi-ui/src/views/dragform/tableList.vue

@@ -90,6 +90,7 @@
     <el-table
       v-loading="loading"
       :data="tableList"
+      ref="tableRef"
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
@@ -235,6 +236,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       Keys: [],
       menuIds: [],
       // 非单个禁用
@@ -284,10 +287,21 @@ export default {
     /** 查询动态格列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listTable(this.queryParams).then((response) => {
-        this.tableList = response.rows;
+        response.rows = response.rows.filter(
+          (item) => !tempSelection.find((val) => val.tId == item.tId)
+        );
+        this.tableList = [...tempSelection, ...response.rows];
         this.total = response.total;
         this.loading = false;
+        if (tempSelection.length) {
+          this.$nextTick(() => {
+            tempSelection.forEach((item) => {
+              this.$refs.tableRef.toggleRowSelection(item);
+            });
+          });
+        }
       });
     },
     // 取消按钮
@@ -333,6 +347,7 @@ export default {
       this.ids = selection.map((item) => item.tId);
       this.Keys = selection.map((item) => item.sqlKey);
       this.menuIds = selection.map((item) => item.menuId);
+      this.selection = selection;
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },

+ 0 - 1
ruoyi-ui/src/views/system/bpmnPro/components/Designer/initModeler.js

@@ -56,7 +56,6 @@ export default function (designerDom, moduleAndExtensions, context) {
     return event;
   });
   modeler.on("commandStack.shape.replace.preExecute", (event) => {
-    debugger;
     const {
       context: { newShape, newData }
     } = event;

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

@@ -6,7 +6,7 @@
       </collapse-title>
     </template>
     <div class="element-after-node">
-      <edit-item label="节点后" :label-width="100">
+      <edit-item label="节点后操作" :label-width="100">
         <el-input
           v-model="afterNodeValue"
           maxlength="32"

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

@@ -45,7 +45,7 @@ export default {
 };
 </script>
 <style scoped lang="scss">
-::v-deep .edit-item_label{
+::v-deep .edit-item_label {
   width: 55px !important;
 }
-</style>
+</style>

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

@@ -150,8 +150,8 @@ export default {
       this.renderComponents.push(ElementExtensionProperties);
       isExecutable(element) &&
         this.renderComponents.push(ElementExecutionListeners);
-      isAsynchronous(element) &&
-        this.renderComponents.push(ElementAsyncContinuations);
+      // isAsynchronous(element) &&
+      // this.renderComponents.push(ElementAsyncContinuations);
       isStartInitializable(element) &&
         this.renderComponents.push(ElementStartInitiator);
       this.renderComponents.push(ElementExtensionField);

+ 31 - 0
ruoyi-ui/src/views/system/bpmnPro/components/Toolbar/tools/Previews.vue

@@ -23,10 +23,14 @@
       width="72vw"
       append-to-body
       destroy-on-close
+      :center="true"
     >
       <div class="preview-model">
         <highlightjs :code="codeString" :language="codeLanguage" />
       </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="copyHandler(codeString)">复制</el-button>
+      </span>
     </el-dialog>
   </el-button>
 </template>
@@ -82,6 +86,33 @@ export default {
         catchError(e);
       }
     },
+    copyHandler(fileValue) {
+      var text = fileValue;
+      try {
+        if (navigator.clipboard) {
+          // clipboard api 复制
+          navigator.clipboard.writeText(text);
+        } else {
+          var textarea = document.createElement("textarea");
+          document.body.appendChild(textarea);
+          // 隐藏此输入框
+          textarea.style.position = "fixed";
+          textarea.style.clip = "rect(0 0 0 0)";
+          textarea.style.top = "10px";
+          // 赋值
+          textarea.value = text;
+          // 选中
+          textarea.select();
+          // 复制
+          document.execCommand("copy", true);
+          // 移除输入框
+          document.body.removeChild(textarea);
+        }
+        this.$message.success("已复制到剪切板");
+      } catch (error) {
+        this.$message.error("复制失败");
+      }
+    },
   },
 };
 </script>

+ 18 - 8
ruoyi-ui/src/views/system/bpmnPro/components/Toolbar/tools/Save.vue

@@ -101,9 +101,6 @@ export default {
       let _this = this;
       let formData = _this.formData() || {}; // 当前流程表单详细数据
       let processJsonObj = await this.getProcessJson(); // xml标签转换json
-      console.log(processJsonObj);
-      // this.saveNodeMsg(processJsonObj);
-      // return;
       let validateRes = formDataValidate(processJsonObj);
       if (!validateRes.flag) {
         this.$message.error(validateRes.msg);
@@ -124,7 +121,7 @@ export default {
       formData.processType = "0"; //流程类型
       // 获取xml标签内容标签内容
       let xmlPro = await this.getProcess("xml");
-      let xmlObj = this.xmlStr2XmlObj(xmlPro);
+      var xmlObj = this.xmlStr2XmlObj(xmlPro);
       formData.startEventType =
         xmlObj
           .getElementsByTagName("bpmn:process")[0]
@@ -148,7 +145,7 @@ export default {
         updateProcess(subformData).then((res) => {
           if (res.code == 200) {
             _this.$message.success("修改成功");
-            this.saveNodeMsg(processJsonObj);
+            this.saveNodeMsg(xmlObj);
           } else {
             _this.$message.error("修改失败");
           }
@@ -157,7 +154,7 @@ export default {
         addProcess(subformData).then((res) => {
           if (res.code == 200) {
             _this.$message.success("保存成功");
-            this.saveNodeMsg(processJsonObj);
+            this.saveNodeMsg(xmlObj);
           } else {
             _this.$message.error("保存失败");
           }
@@ -165,10 +162,11 @@ export default {
       }
     },
     async saveNodeMsg(obj) {
-      let data = getNodeMsg(obj.warnings);
+      let data = getNodeMsg(obj);
+      if (!data.length) return;
       data.forEach((item) => {
         item.createBy = this.$store.state.user.name;
-        item.nodeProcessKey = obj.rootElement.rootElements[0].id;
+        item.nodeProcessKey = obj.id;
       });
       try {
         let res = await addConfiguration(data);
@@ -176,6 +174,18 @@ export default {
         console.log(error);
       }
     },
+    async updateNodeMsg(obj) {
+      let data = getNodeMsg(obj.warnings);
+      data.forEach((item) => {
+        item.createBy = this.$store.state.user.name;
+        item.nodeProcessKey = obj.id || "";
+      });
+      try {
+        let res = await updateConfiguration(data);
+      } catch (error) {
+        console.log(error);
+      }
+    },
   },
 };
 </script>

+ 54 - 21
ruoyi-ui/src/views/system/bpmnPro/components/bo-utils/getNodeMsg.js

@@ -1,31 +1,64 @@
+import { getProcessEngine } from "@packages/bpmn-utils/BpmnDesignerUtils";
 
 function getSecondStr(str) {
   return str.split(':')[1];
 }
 
 
-export function getNodeMsg(nodeList = []) {
-  if (!nodeList.length) return [];
-  let nodeObj = {};
-  nodeList.forEach(item => {
-    let nodeType = getSecondStr(item.element.$type);
-    let valueType = getSecondStr(item.property);
-    if (nodeObj[nodeType]) {
-      nodeObj[nodeType][valueType] = item.value;
-      nodeObj[nodeType].nodeKey = item.element.id;
-    } else {
-      nodeObj[nodeType] = {};
-      nodeObj[nodeType][valueType] = item.value;
-      nodeObj[nodeType].nodeKey = item.element.id;
-    }
-  })
-  let res = Object.keys(nodeObj).map((item) => {
-    let temp = {};
-    temp.nodeType = item;
-    Object.assign(temp, nodeObj[item])
-    return temp;
+// export function getNodeMsg(nodeList = []) {
+//   if (!nodeList.length) return [];
+//   let nodeObj = {};
+//   nodeList.forEach(item => {
+//     let nodeType = getSecondStr(item.element.$type);
+//     let valueType = getSecondStr(item.property);
+//     if (nodeObj[nodeType]) {
+//       nodeObj[nodeType][valueType] = item.value;
+//       nodeObj[nodeType].nodeKey = item.element.id;
+//     } else {
+//       nodeObj[nodeType] = {};
+//       nodeObj[nodeType][valueType] = item.value;
+//       nodeObj[nodeType].nodeKey = item.element.id;
+//     }
+//   })
+//   let res = Object.keys(nodeObj).map((item) => {
+//     let temp = {};
+//     temp.nodeType = item;
+//     Object.assign(temp, nodeObj[item])
+//     return temp;
+//   })
+//   return res;
+// }
 
+export function getNodeMsg(xmlObj) {
+  let prefix = getProcessEngine();
+  let { attributes, childNodes } = xmlObj
+    .getElementsByTagName("bpmn:process")[0];
+  let res = [], attributeArray = ['nodeKey', 'nodeFormKey', 'nodeProcessKey', 'nodeType', 'nodeBefore', 'nodeAfter', 'nodeRolePremission', 'spare1', 'spare2', 'spare3', 'createBy', 'updateBy', 'remark'];
+  childNodes.forEach((node) => {
+    console.dir(node);
+    let nodeObj = {
+      nodeKey: '',
+      nodeFormKey: '',
+      nodeProcessKey: '',
+      nodeType: '',
+      nodeBefore: '',
+      nodeAfter: '',
+      nodeRolePremission: '',
+      spare1: '',
+      spare2: '',
+      spare3: '',
+      createBy: '',
+      updateBy: '',
+      remark: '',
+    }
+    attributeArray.forEach(attr => {
+      let tempAttr = prefix + ':' + attr
+      nodeObj[attr] = node.attributes[tempAttr]?.nodeValue || ''
+    });
+    nodeObj.nodeKey = node.id;
+    nodeObj.nodeType = node.localName;
+    if (nodeObj.nodeType == "sequenceFlow") return;
+    res.push(nodeObj)
   })
-
   return res;
 }

+ 16 - 1
ruoyi-ui/src/views/system/post/index.vue

@@ -107,6 +107,7 @@
 
     <el-table
       v-loading="loading"
+      ref="tableRef"
       :data="postList"
       @selection-change="handleSelectionChange"
     >
@@ -257,6 +258,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -302,10 +305,21 @@ export default {
     /** 查询岗位列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listPost(this.queryParams).then((response) => {
-        this.postList = response.rows;
+        response.rows = response.rows.filter(
+          (item) => !tempSelection.find((val) => val.postId == item.postId)
+        );
+        this.postList = [...tempSelection, ...response.rows];
         this.total = response.total;
         this.loading = false;
+        if (tempSelection.length) {
+          this.$nextTick(() => {
+            tempSelection.forEach((item) => {
+              this.$refs.tableRef.toggleRowSelection(item);
+            });
+          });
+        }
       });
     },
     // 取消按钮
@@ -338,6 +352,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.postId);
+      this.selection = selection;
       this.single = selection.length != 1;
       this.multiple = !selection.length;
     },

+ 16 - 1
ruoyi-ui/src/views/system/role/index.vue

@@ -130,6 +130,7 @@
     <el-table
       v-loading="loading"
       :data="roleList"
+      ref="tableRef"
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
@@ -432,6 +433,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -517,11 +520,22 @@ export default {
     /** 查询角色列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
         (response) => {
-          this.roleList = response.rows;
+          response.rows = response.rows.filter(
+            (item) => !tempSelection.find((val) => val.roleId == item.roleId)
+          );
+          this.roleList = [...tempSelection, ...response.rows];
           this.total = response.total;
           this.loading = false;
+          if (tempSelection.length) {
+            this.$nextTick(() => {
+              tempSelection.forEach((item) => {
+                this.$refs.tableRef.toggleRowSelection(item);
+              });
+            });
+          }
         }
       );
     },
@@ -624,6 +638,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
+      this.selection = selection;
       this.ids = selection.map((item) => item.roleId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;

+ 16 - 1
ruoyi-ui/src/views/system/tenant/dict/index.vue

@@ -133,6 +133,7 @@
     <el-table
       v-loading="loading"
       :data="typeList"
+      ref="tableRef"
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
@@ -295,6 +296,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -339,11 +342,22 @@ export default {
     /** 查询字典类型列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listType(this.addDateRange(this.queryParams, this.dateRange)).then(
         (response) => {
-          this.typeList = response.rows;
+          response.rows = response.rows.filter(
+            (item) => !tempSelection.find((val) => val.dictId == item.dictId)
+          );
+          this.typeList = [...tempSelection, ...response.rows];
           this.total = response.total;
           this.loading = false;
+          if (tempSelection.length) {
+            this.$nextTick(() => {
+              tempSelection.forEach((item) => {
+                this.$refs.tableRef.toggleRowSelection(item);
+              });
+            });
+          }
         }
       );
     },
@@ -383,6 +397,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.dictId);
+      this.selection = selection;
       this.single = selection.length != 1;
       this.multiple = !selection.length;
     },

+ 16 - 1
ruoyi-ui/src/views/system/user/index.vue

@@ -172,6 +172,7 @@
         <el-table
           v-loading="loading"
           :data="userList"
+          ref="tableRef"
           @selection-change="handleSelectionChange"
         >
           <el-table-column type="selection" width="50" align="center" />
@@ -577,6 +578,8 @@ export default {
       loading: true,
       // 选中数组
       ids: [],
+      // 选中数组(包含所有数据)
+      selection: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -720,11 +723,22 @@ export default {
     /** 查询用户列表 */
     getList() {
       this.loading = true;
+      let tempSelection = JSON.parse(JSON.stringify(this.selection));
       listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
         (response) => {
-          this.userList = response.rows;
+          response.rows = response.rows.filter(
+            (item) => !tempSelection.find((val) => val.userId == item.userId)
+          );
+          this.userList = [...tempSelection, ...response.rows];
           this.total = response.total;
           this.loading = false;
+          if (tempSelection.length) {
+            this.$nextTick(() => {
+              tempSelection.forEach((item) => {
+                this.$refs.tableRef.toggleRowSelection(item);
+              });
+            });
+          }
         }
       );
     },
@@ -798,6 +812,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map((item) => item.userId);
+      this.selection = selection;
       this.single = selection.length != 1;
       this.multiple = !selection.length;
     },

+ 7 - 1
ruoyi-ui/src/views/tablelist/commonTable/listInfo.vue

@@ -116,8 +116,14 @@
       v-loading="loading"
       :data="tableList"
       @selection-change="handleSelectionChange"
+      row-key="id"
     >
-      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column
+        type="selection"
+        width="55"
+        reserve-selection
+        align="center"
+      />
       <!-- <span v-for="(key, val) in columns" :key="key">
         <el-table-column :label="key" align="center" :prop="val" />
       </span> -->