Browse Source

添加按钮管理条件隐藏功能/数据引擎主键的自增自动选择

lph 1 year ago
parent
commit
178022b20c

+ 18 - 10
zkqy-ui/src/views/system/bpmnPro/components/Panel/components/ElementExecuteUser.vue

@@ -131,12 +131,16 @@ export default {
       return label;
       return label;
     },
     },
     userList() {
     userList() {
-      return this.allUserList().map((item) => {
-        return {
-          value: item.userId.toString(),
-          label: item.nickName,
-        };
-      });
+      // let
+      let list = JSON.parse(JSON.stringify(this.allUserList()));
+      let temp = [];
+      for (let i = 0; i < list.length; i++) {
+        temp.push({
+          value: list[i].userId.toString(),
+          label: list[i].nickName,
+        });
+      }
+      return temp;
     },
     },
     roleList() {
     roleList() {
       return this.allRoleList().map((item) => {
       return this.allRoleList().map((item) => {
@@ -162,9 +166,11 @@ export default {
       }
       }
       if (this.exeUserType && this.isFirst) {
       if (this.exeUserType && this.isFirst) {
         if (this.exeUserType == 3) {
         if (this.exeUserType == 3) {
-          this.exeRoleListHandler();
+          // this.exeRoleListHandler();
+          this.exeUserValueList = this.roleList;
         } else {
         } else {
-          this.exeUserListHandler();
+          // this.exeUserListHandler();
+          this.exeUserValueList = this.userList;
         }
         }
         this.isFirst = false;
         this.isFirst = false;
       }
       }
@@ -251,9 +257,11 @@ export default {
     loadListHandler() {
     loadListHandler() {
       if (!this.exeUserType) return;
       if (!this.exeUserType) return;
       if (this.exeUserType == 3) {
       if (this.exeUserType == 3) {
-        this.exeRoleListHandler();
+        // this.exeRoleListHandler();
+        this.exeUserValueList = this.roleList;
       } else {
       } else {
-        this.exeUserListHandler();
+        // this.exeUserListHandler();
+        this.exeUserValueList = this.userList;
       }
       }
     },
     },
   },
   },

+ 140 - 2
zkqy-ui/src/views/system/excuteBtnMange/index.vue

@@ -289,6 +289,7 @@
               </el-select>
               </el-select>
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
+
           <!-- 非目录 -->
           <!-- 非目录 -->
           <template v-if="btnGroupFormData.btnType != 'DIRECTORY'">
           <template v-if="btnGroupFormData.btnType != 'DIRECTORY'">
             <el-col
             <el-col
@@ -538,6 +539,98 @@
               <!-- </el-form-item> -->
               <!-- </el-form-item> -->
             </el-col>
             </el-col>
           </template>
           </template>
+          <!-- 按钮隐藏条件 -->
+          <div class="filter-table-wrap" style="width: 100%">
+            <span class="title mb10">按钮隐藏条件</span>
+            <el-table :data="btnHidenCondtionData" style="width: 100%">
+              <el-table-column label="序号" type="index" width="50">
+              </el-table-column>
+              <el-table-column
+                prop="fieldName"
+                label="字段名"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="scope">
+                  <el-select v-model="scope.row.fieldName" placeholder="请选择">
+                    <el-option
+                      v-for="item in rootFieldInfo.fieldList"
+                      :key="item.value"
+                      :label="item.value"
+                      :value="item.key"
+                    >
+                      <span style="float: left">{{ item.value }}</span>
+                      <span
+                        style="float: right; color: #8492a6; font-size: 13px"
+                        >{{ item.key }}</span
+                      >
+                    </el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="mark"
+                label="符号"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="scope">
+                  <el-select v-model="scope.row.mark" placeholder="请选择">
+                    <el-option
+                      v-for="item in markList"
+                      :key="item"
+                      :label="item"
+                      :value="item"
+                    ></el-option>
+                  </el-select>
+                </template>
+              </el-table-column>
+              <el-table-column
+                prop="refValue"
+                label="参考值"
+                width="150"
+                align="center"
+              >
+                <template slot-scope="scope">
+                  <!-- <el-button
+                          type="info"
+                          size="small"
+                          icon="el-icon-edit"
+                          @click="editFlagHandler(scope.row, scope.$index)"
+                        >
+                        </el-button> -->
+                  <el-input
+                    v-model="scope.row.refValue"
+                    placeholder="请输入默认值"
+                    size="normal"
+                    clearable
+                  >
+                  </el-input>
+                </template>
+              </el-table-column>
+              <el-table-column label="操作" align="center">
+                <template slot-scope="scope">
+                  <el-button
+                    size="mini"
+                    type="danger"
+                    icon="el-icon-delete"
+                    @click="deleteBtnHidenCondition(scope.$index)"
+                    >删除
+                  </el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+            <el-button
+              type="primary"
+              class="inline-large-button mb10"
+              icon="el-icon-plus"
+              size="mini"
+              style="width: 100%"
+              @click="addBtnHidenCondition"
+            >
+              添加参数
+            </el-button>
+          </div>
         </el-row>
         </el-row>
       </el-form>
       </el-form>
       <div slot="footer" class="dialog-footer">
       <div slot="footer" class="dialog-footer">
@@ -567,6 +660,7 @@ import IconSelect from "@/components/IconSelect";
 import { v4 as uuidv4 } from "uuid";
 import { v4 as uuidv4 } from "uuid";
 import { dragTableInfo } from "@/api/tablelist/commonTable";
 import { dragTableInfo } from "@/api/tablelist/commonTable";
 import { camelCase } from "@/utils";
 import { camelCase } from "@/utils";
+import { mark } from "@/components/updateModule/k-form-design/lib/k-form-design.common";
 export default {
 export default {
   name: "ExcuteBtnMange",
   name: "ExcuteBtnMange",
   dicts: ["sys_show_hide", "sys_normal_disable"],
   dicts: ["sys_show_hide", "sys_normal_disable"],
@@ -731,6 +825,14 @@ export default {
         //   fieldValue: "",
         //   fieldValue: "",
         // },
         // },
       ],
       ],
+      // 按钮隐藏条件
+      btnHidenCondtionData: [
+        // {
+        //   fieldName: "", //参考字段
+        //   mark: "", //参考符号
+        //   refValue: "", //参考值
+        // },
+      ],
       rootFieldInfo: {
       rootFieldInfo: {
         tableName: "",
         tableName: "",
         fieldList: [],
         fieldList: [],
@@ -751,6 +853,7 @@ export default {
           prop: "value",
           prop: "value",
         },
         },
       ],
       ],
+      markList: [">", "<", "=", ">=", "<="],
     };
     };
   },
   },
   // created() {
   // created() {
@@ -800,7 +903,7 @@ export default {
     },
     },
     // 删除query参数
     // 删除query参数
     deleteQueryItem(index) {
     deleteQueryItem(index) {
-      this.queryTableData.splice(index, index);
+      this.queryTableData.splice(index, 1);
     },
     },
     // 添加公共传参
     // 添加公共传参
     addFilterHandler() {
     addFilterHandler() {
@@ -813,6 +916,22 @@ export default {
         fieldValue: "",
         fieldValue: "",
       });
       });
     },
     },
+    // 添加按钮隐藏条件
+    addBtnHidenCondition() {
+      if (this.rootFieldInfo.fieldList.length == 0) {
+        this.$message.error("请先将按钮组绑定给表格");
+        return;
+      }
+      this.btnHidenCondtionData.push({
+        fieldName: "", //参考字段
+        mark: "", //参考符号
+        refValue: "", //参考值
+      });
+    },
+    // 删除按钮隐藏条件
+    deleteBtnHidenCondition(index) {
+      this.btnHidenCondtionData.splice(index, 1);
+    },
     // 获取根节点绑定表格的字段数据
     // 获取根节点绑定表格的字段数据
     async getRootFieldInfo(btnKey) {
     async getRootFieldInfo(btnKey) {
       let res = await checkBtn({ btnKey });
       let res = await checkBtn({ btnKey });
@@ -992,7 +1111,7 @@ export default {
       //在已知节点下新增
       //在已知节点下新增
       await this.getRootFieldInfo(row.rootKey);
       await this.getRootFieldInfo(row.rootKey);
       getBtn(row.id).then((response) => {
       getBtn(row.id).then((response) => {
-        let { btnType, btnParams } = response.data;
+        let { btnType, btnParams, btnShowCondition } = response.data;
         if ((btnType == 3 || btnType == 7) && btnParams) {
         if ((btnType == 3 || btnType == 7) && btnParams) {
           //内链或外链
           //内链或外链
           let tempObj = JSON.parse(btnParams);
           let tempObj = JSON.parse(btnParams);
@@ -1001,6 +1120,10 @@ export default {
         } else {
         } else {
           btnParams && (this.commonFieldData = JSON.parse(btnParams) || []);
           btnParams && (this.commonFieldData = JSON.parse(btnParams) || []);
         }
         }
+        this.btnHidenCondtionData = [];
+        if (btnShowCondition) {
+          this.btnHidenCondtionData = JSON.parse(btnShowCondition);
+        }
         this.btnGroupFormData = response.data;
         this.btnGroupFormData = response.data;
         this.open = true;
         this.open = true;
         this.title = "修改按钮";
         this.title = "修改按钮";
@@ -1050,6 +1173,8 @@ export default {
             tempObj.commonFieldData = JSON.stringify(this.commonFieldData);
             tempObj.commonFieldData = JSON.stringify(this.commonFieldData);
             this.btnGroupFormData.btnParams = JSON.stringify(tempObj);
             this.btnGroupFormData.btnParams = JSON.stringify(tempObj);
           }
           }
+          this.btnGroupFormData.btnShowCondition = this.getHidenConditions();
+          console.log(this.btnGroupFormData.btnShowCondition);
           if (this.editType) {
           if (this.editType) {
             // 新增按钮组
             // 新增按钮组
             this.btnGroupFormData.btnKey = uuidv4();
             this.btnGroupFormData.btnKey = uuidv4();
@@ -1074,6 +1199,19 @@ export default {
         }
         }
       });
       });
     },
     },
+    // 格式化按钮隐藏条件
+    getHidenConditions() {
+      console.log(this.btnHidenCondtionData);
+      if (this.btnHidenCondtionData.length == 0) return "";
+      let temp = this.btnHidenCondtionData.filter((item) => {
+        return item.fieldName && item.mark && item.refValue;
+      });
+      if (temp.length > 0) {
+        return JSON.stringify(temp);
+      } else {
+        return "";
+      }
+    },
     // 更新路由
     // 更新路由
     reloadRouter() {
     reloadRouter() {
       this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
       this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {

+ 1 - 0
zkqy-ui/src/views/tool/datasheet/index.vue

@@ -410,6 +410,7 @@ export default {
         }
         }
         if (index == ind && item.isPrimary == true) {
         if (index == ind && item.isPrimary == true) {
           item.isNull = true;
           item.isNull = true;
+          item.isAuto = true;
         }
         }
       });
       });
     },
     },