浏览代码

自定义弹窗按钮组的渲染及功能

lph 1 年之前
父节点
当前提交
79f6690154
共有 2 个文件被更改,包括 61 次插入5 次删除
  1. 1 1
      ruoyi-ui/src/views/bussiness/processMange.vue
  2. 60 4
      ruoyi-ui/src/views/dialogTemplate/components/index.vue

+ 1 - 1
ruoyi-ui/src/views/bussiness/processMange.vue

@@ -385,7 +385,7 @@ export default {
         taskNodeKey: nodeId, //当前执行节点唯一编码
         nextNodeKey: nextNodeId, //下一节点编码
         implementationName: this.row.benmTaskAutomaticScriptTriggerType, //当前节点绑定的脚本名
-        taskProcessXmlContent: this.row.bepTaskProcessXmlContent, //当前流程xml
+        // taskProcessXmlContent: this.row.bepTaskProcessXmlContent, //当前流程xml
         tableName: this.tableName,
         formDataMap: JSON.stringify(formData), //自定义表单组件收集的表单数据
       };

+ 60 - 4
ruoyi-ui/src/views/dialogTemplate/components/index.vue

@@ -26,7 +26,7 @@
       <el-button-group>
         <el-button v-for="(item, index) in controlBtnArr" :key="index">
           <template>
-            <span @click="clickHandler(item, row)"
+            <span @click="clickHandler(item, index)"
               ><svg-icon
                 v-if="item.btnIcon"
                 class="pre-icon"
@@ -120,6 +120,7 @@ import {
   getStatisticList,
   addTableData,
   delTableData,
+  batchEdit,
 } from "@/api/tablelist/commonTable";
 import { camelCase } from "@/utils";
 import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
@@ -142,11 +143,14 @@ export default {
       // 是否外协
       checked: false,
       topTableCountInfo: [], //上部状态统计信息
+      topInfo: {},
+      topData: {},
       // 表格数据
       tableData: [],
       columns: [],
       tableBtnInfo: {},
       subTableName: "",
+      subTableInfo: {},
       subCount: [], //表格统计数据
       // 动态增加表格数据
       editData: [],
@@ -264,6 +268,7 @@ export default {
     async setTableData(tableInfo, tableData) {
       let { dtColumnNameEcho, dragTableBtnList, tableKey, dtTableName } =
         tableInfo;
+      this.subTableInfo = tableInfo;
       this.tableData =
         tableData.map((item) => {
           return item.resultMap;
@@ -290,7 +295,7 @@ export default {
     // 设置顶部状态数据
     setTopData(baseObj, dataObj) {
       let { dtColumnNameEcho, dragTableBtnList, tableKey } = baseObj;
-      console.log(dragTableBtnList);
+      this.controlBtnArr = dragTableBtnList[0].children;
       let temp = JSON.parse(dtColumnNameEcho) || [];
       this.topTableCountInfo = temp.map((item) => {
         let prop = camelCase(Object.keys(item)[0]);
@@ -300,6 +305,8 @@ export default {
           value: dataObj.resultMap[prop] || "未知状态",
         };
       });
+      this.topInfo = baseObj;
+      this.topData = dataObj.resultMap;
     },
     // 获取统计数据
     async getStatisticsData(tableKey) {
@@ -506,8 +513,33 @@ export default {
     // 删除回调
     async deleteHandler(index, row) {
       if (row.id) {
+        let { primaryKey } = this.subTableInfo;
+        let ids = [];
+        ids.push(row[camelCase(primaryKey)]);
+        let payload = {
+          basicMap: {
+            tableName: this.subTableName,
+          },
+          conditionMap: {
+            // id: delIds,
+          },
+        };
+        payload.conditionMap[camelCase(primaryKey)] = ids;
         // 发送请求 删除数据
-        let res = await delTableData();
+        this.$modal
+          .confirm('是否确认删除"' + ids + '"的数据项?')
+          .then(function () {
+            return delTableData(payload);
+            // return btnCommonApi(data);
+          })
+          .then(() => {
+            // 调用子组件查询方法 目的是携带上子组件中的查询参数
+            // this.$refs.mychild.pageList();
+            this.reloadInfo();
+            this.$modal.msgSuccess("删除成功");
+          })
+          .catch(() => {});
+        // let res = await delTableData(payload);
       } else {
         this.tableData.splice(index, 1);
       }
@@ -564,7 +596,31 @@ export default {
       console.log(row);
     },
     // 按钮组点击
-    clickHandler(item, row) {},
+    async clickHandler(btnData) {
+      console.log(this.topInfo, this.topData);
+      let { primaryKey, dtName } = this.topInfo;
+      let { btnParams, btnType, btnKey } = btnData;
+      let payload = {
+        basicMap: {
+          tableName: dtName,
+          // btnKey: btnData.btnKey,
+        },
+        conditionMap: {},
+        commMap: {},
+        // btnParametersMap: {},
+      };
+      payload.conditionMap[primaryKey] = this.topData[primaryKey];
+      if (btnParams) {
+        let tempParams = JSON.parse(btnParams)[0];
+        payload.commMap[tempParams.fieldName] = tempParams.fieldValue;
+      }
+      let res = await batchEdit(payload);
+      if (res.code == 200) {
+        this.reloadInfo();
+      } else {
+        this.$message.error("网络异常请稍后再试");
+      }
+    },
   },
   mounted() {
     // this.getLists()