Browse Source

更新anji-crud组件

qianlishi 3 years ago
parent
commit
7574eea59b

+ 166 - 83
report-ui/src/components/AnjiPlus/anji-crud/anji-crud.vue

@@ -147,38 +147,57 @@
         </el-form>
         <!-- 查询表单结束 -->
         <!-- 批量操作 -->
-        <div style="padding-bottom: 8px">
-          <slot name="buttonLeftOnTable" :selection="checkRecords" />
-          <el-button
-            v-if="
-              option.buttons.add.isShow == undefined
-                ? true
-                : option.buttons.add.isShow
-            "
-            v-permission="option.buttons.add.permission"
-            class="button"
-            plain
-            icon="el-icon-plus"
-            @click="handleOpenEditView('add')"
-            >新增</el-button
-          >
-          <el-button
-            v-if="
-              option.buttons.delete.isShow == undefined
-                ? true
-                : option.buttons.delete.isShow
-            "
-            v-permission="option.buttons.delete.permission"
-            class="button"
-            plain
-            :disabled="disableBatchDelete"
-            type="danger"
-            icon="el-icon-delete"
-            @click="handleDeleteBatch()"
-            >删除</el-button
-          >
-          <slot name="buttonRightOnTable" :selection="checkRecords" />
-        </div>
+        <template v-if="!option.tableButtons">
+          <div style="padding-bottom: 8px">
+            <slot name="buttonLeftOnTable" :selection="checkRecords" />
+            <el-button
+              v-if="
+                option.buttons.add.isShow == undefined
+                  ? true
+                  : option.buttons.add.isShow
+              "
+              v-permission="option.buttons.add.permission"
+              class="button"
+              plain
+              icon="el-icon-plus"
+              @click="handleOpenEditView('add')"
+              >新增</el-button
+            >
+            <el-button
+              v-if="
+                option.buttons.delete.isShow == undefined
+                  ? true
+                  : option.buttons.delete.isShow
+              "
+              v-permission="option.buttons.delete.permission"
+              class="button"
+              plain
+              :disabled="disableBatchDelete"
+              type="danger"
+              icon="el-icon-delete"
+              @click="handleDeleteBatch()"
+              >删除</el-button
+            >
+            <slot name="buttonRightOnTable" :selection="checkRecords" />
+          </div>
+        </template>
+        <template v-else>
+          <div style="padding-bottom: 8px">
+            <slot name="tableButtons" :selection="checkRecords" />
+            <el-button
+              v-for="(item, index) in option.tableButtons"
+              :key="index"
+              v-permission="item.permission"
+              class="tableButton"
+              :plain="item.plain"
+              :icon="item.icon"
+              :type="item.type"
+              :disabled="isDisabledButton(item, checkRecords)"
+              @click="item.click(checkRecords)"
+              >{{ handlegetLable(checkRecords, item.label) }}</el-button
+            >
+          </div>
+        </template>
       </div>
 
       <!-- 表格开始 -->
@@ -282,59 +301,108 @@
               align="center"
               fixed="right"
               label="操作"
-              :width="
-                option.buttons.customButton &&
-                option.buttons.customButton.operationWidth
-                  ? option.buttons.customButton.operationWidth
-                  : 100
-              "
+              :width="option.buttons.rowButtonsWidth || 100"
             >
+              <!-- 插槽 -->
               <template slot-scope="scope">
-                <slot name="rowButton" :msg="scope.row" />
-                <el-button
-                  v-if="
-                    option.buttons.edit.isShow == undefined
-                      ? true
-                      : option.buttons.edit.isShow
-                  "
-                  type="text"
-                  size="small"
-                  @click="handleOpenEditView('edit', scope.row)"
-                  >编辑</el-button
-                >
-                <el-button
-                  v-if="
-                    hasCustomButtonInRowMore == false &&
-                    option.buttons.delete.isShow == undefined
-                      ? true
-                      : option.buttons.edit.isShow
-                  "
-                  type="text"
-                  size="small"
-                  @click="handleDeleteBatch(scope.row)"
-                  >删除</el-button
-                >
-                <el-dropdown v-if="hasCustomButtonInRowMore" trigger="click">
-                  <span class="el-dropdown-link"
-                    >更多<i class="el-icon-caret-bottom el-icon--right" />
-                  </span>
-                  <el-dropdown-menu slot="dropdown">
-                    <el-dropdown-item class="clearfix">
-                      <slot name="rowButtonInMore" :msg="scope.row" />
-                      <el-button
-                        v-if="
-                          option.buttons.delete.isShow == undefined
-                            ? true
-                            : option.buttons.edit.isShow
-                        "
-                        type="text"
-                        size="small"
-                        @click="handleDeleteBatch(scope.row)"
-                        >删除</el-button
-                      >
-                    </el-dropdown-item>
-                  </el-dropdown-menu>
-                </el-dropdown>
+                <template v-if="!option.rowButtons">
+                  <slot name="rowButton" :msg="scope.row" />
+                  <el-button
+                    v-if="
+                      option.buttons.edit.isShow == undefined
+                        ? true
+                        : option.buttons.edit.isShow
+                    "
+                    type="text"
+                    size="small"
+                    @click="handleOpenEditView('edit', scope.row)"
+                    >编辑</el-button
+                  >
+                  <el-button
+                    v-if="
+                      hasCustomButtonInRowMore == false &&
+                      option.buttons.delete.isShow == undefined
+                        ? true
+                        : option.buttons.edit.isShow
+                    "
+                    type="text"
+                    size="small"
+                    @click="handleDeleteBatch(scope.row)"
+                    >删除</el-button
+                  >
+                  <el-dropdown v-if="hasCustomButtonInRowMore" trigger="click">
+                    <span class="el-dropdown-link"
+                      >更多<i class="el-icon-caret-bottom el-icon--right" />
+                    </span>
+                    <el-dropdown-menu slot="dropdown">
+                      <el-dropdown-item class="clearfix">
+                        <slot name="rowButtonInMore" :msg="scope.row" />
+                        <el-button
+                          v-if="
+                            option.buttons.delete.isShow == undefined
+                              ? true
+                              : option.buttons.edit.isShow
+                          "
+                          type="text"
+                          size="small"
+                          @click="handleDeleteBatch(scope.row)"
+                          >删除</el-button
+                        >
+                      </el-dropdown-item>
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                </template>
+                <template v-else>
+                  <div v-if="option.rowButtons.length <= 2">
+                    <el-button
+                      v-for="(item, index) in option.rowButtons"
+                      :key="index"
+                      v-permission="item.permission"
+                      :disabled="isDisabledButton(item, scope.row)"
+                      :type="item.type || 'text'"
+                      size="small"
+                      @click="item.click(scope.row)"
+                      >{{ handlegetLable(scope.row, item.label) }}</el-button
+                    >
+                  </div>
+                  <div v-else>
+                    <el-button
+                      v-permission="option.rowButtons[0].permission"
+                      :type="option.rowButtons[0].type || 'text'"
+                      :disabled="
+                        isDisabledButton(option.rowButtons[0], scope.row)
+                      "
+                      @click="option.rowButtons[0].click(scope.row)"
+                      >{{
+                        handlegetLable(scope.row, option.rowButtons[0].label)
+                      }}</el-button
+                    >
+                    <el-dropdown trigger="click">
+                      <span class="el-dropdown-link">
+                        更多
+                        <i class="el-icon-caret-bottom el-icon--right" />
+                      </span>
+                      <el-dropdown-menu slot="dropdown">
+                        <el-dropdown-item class="clearfix">
+                          <el-button
+                            v-for="(item, index) in option.rowButtons.filter(
+                              (el, index) => index > 0
+                            )"
+                            :key="index"
+                            v-permission="item.permission"
+                            :type="item.type || 'text'"
+                            :disabled="isDisabledButton(item, scope.row)"
+                            size="small"
+                            @click="item.click(scope.row)"
+                            >{{
+                              handlegetLable(scope.row, item.label)
+                            }}</el-button
+                          >
+                        </el-dropdown-item>
+                      </el-dropdown-menu>
+                    </el-dropdown>
+                  </div>
+                </template>
               </template>
             </el-table-column>
           </el-table>
@@ -668,6 +736,21 @@ export default {
       };
       this.$emit("handleCustomValue", obj);
     },
+    handlegetLable(item, label) {
+      if (typeof label == "function") {
+        return label(item);
+      } else {
+        return label;
+      }
+    },
+    // 是否disabled
+    isDisabledButton(item, row) {
+      if (typeof item.isDisable === "function") {
+        return item.isDisable(row);
+      } else {
+        return !!item.disabled;
+      }
+    },
     // 弹框被关闭时的回调事件
     editDialogClosedEvent(value) {
       // 把列表页中弹框打开标记改成已关闭

+ 1 - 0
report-ui/src/mixins/common.js

@@ -272,6 +272,7 @@ export default {
       return { top: top, left: left }
     },
     objToOne (obj) {
+      console.log(obj)
       let tmpData = {}
       for (let index in obj) {
         if (typeof obj[index] == 'object' && !this.isArrayFn(obj[index])) {

+ 42 - 4
report-ui/src/views/accessAuthority/index.vue

@@ -4,7 +4,7 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-13 12:20:56
+ * @LastEditTime: 2022-03-09 09:22:40
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption" />
@@ -67,6 +67,46 @@ export default {
             field: "actionName"
           }
         ],
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "新增",
+            type: "", // primary、success、info、warning、danger
+            permission: "authorityManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.$refs.listPage.handleOpenEditView("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "authorityManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "authorityManage:update",
+            click: row => {
+              return this.$refs.listPage.handleOpenEditView("edit", row);
+            }
+          },
+          {
+            label: "删除",
+            permission: "authorityManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
           query: {
@@ -89,9 +129,7 @@ export default {
             api: accessAuthorityUpdate,
             permission: "authorityManage:update"
           },
-          customButton: {
-            operationWidth: "150px"
-          }
+          rowButtonsWidth: 150 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [

+ 48 - 14
report-ui/src/views/accessRole/index.vue

@@ -4,19 +4,10 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-13 12:20:46
+ * @LastEditTime: 2022-03-09 09:40:01
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
-    <template slot="rowButtonInMore" slot-scope="props">
-      <el-button
-        type="text"
-        @click="handleOpenDialogSetAuthorityForRole(props)"
-        v-permission="'roleManage:grantAuthority'"
-        >分配权限</el-button
-      >
-    </template>
-    <!--自定义的卡片插槽,将在编辑详情页面,出现在底部新卡片-->
     <template v-slot:pageSection>
       <RoleAuthority
         :role-code="roleCode"
@@ -52,6 +43,51 @@ export default {
         title: "角色管理",
         // 详情页中输入框左边文字宽度
         labelWidth: "160px",
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "新增",
+            type: "", // primary、success、info、warning、danger
+            permission: "roleManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.$refs.listPage.handleOpenEditView("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "roleManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "roleManage:update",
+            click: row => {
+              return this.$refs.listPage.handleOpenEditView("edit", row);
+            }
+          },
+          {
+            label: "分配权限",
+            permission: "roleManage:grantAuthority",
+            click: this.handleOpenDialogSetAuthorityForRole
+          },
+          {
+            label: "删除",
+            permission: "roleManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 查询表单条件
         queryFormFields: [
           {
@@ -95,9 +131,7 @@ export default {
             api: accessRoleUpdate,
             permission: "roleManage:update"
           },
-          customButton: {
-            operationWidth: "160px"
-          }
+          rowButtonsWidth: 140 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [
@@ -200,7 +234,7 @@ export default {
   },
   methods: {
     handleOpenDialogSetAuthorityForRole(props) {
-      this.roleCode = props.msg.roleCode;
+      this.roleCode = props.roleCode;
       this.dialogVisibleSetAuthorityForRole = true;
     }
   }

+ 48 - 13
report-ui/src/views/accessUser/index.vue

@@ -4,18 +4,10 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-13 12:20:35
+ * @LastEditTime: 2022-03-09 09:40:56
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
-    <template slot="rowButtonInMore" slot-scope="props">
-      <el-button
-        type="text"
-        @click="handleOpenDialogSetRoleForUser(props)"
-        v-permission="'userManage:grantRole'"
-        >分配角色</el-button
-      >
-    </template>
     <template v-slot:pageSection>
       <UserRole
         :login-name="loginName"
@@ -77,6 +69,51 @@ export default {
             field: "phone"
           }
         ],
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "新增",
+            type: "roleManage:insert", // primary、success、info、warning、danger
+            permission: "userManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.$refs.listPage.handleOpenEditView("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "userManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "userManage:update",
+            click: row => {
+              return this.$refs.listPage.handleOpenEditView("edit", row);
+            }
+          },
+          {
+            label: "分配权限",
+            permission: "userManage:grantRole",
+            click: this.handleOpenDialogSetRoleForUser
+          },
+          {
+            label: "删除",
+            permission: "userManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
           query: {
@@ -99,9 +136,7 @@ export default {
             api: accessUserUpdate,
             permission: "userManage:update"
           },
-          customButton: {
-            operationWidth: "150px"
-          }
+          rowButtonsWidth: 150 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [
@@ -261,7 +296,7 @@ export default {
   },
   methods: {
     handleOpenDialogSetRoleForUser(props) {
-      this.loginName = props.msg.loginName;
+      this.loginName = props.loginName;
       this.dialogVisibleSetRoleForUser = true;
     }
   }

+ 0 - 0
report-ui/src/views/bigscreenDesigner/designer/designer.js


+ 6 - 9
report-ui/src/views/bigscreenDesigner/designer/widget/widget.vue

@@ -17,7 +17,7 @@
     @focus="handleFocus"
     @blur="handleBlur"
   >
-    <component :is="type" :value="value"/>
+    <component :is="type" :value="value" />
   </avue-draggable>
 </template>
 
@@ -95,8 +95,7 @@ export default {
     bigscreen: Object,
     value: {
       type: [Object],
-      default: () => {
-      }
+      default: () => {}
     },
     step: Number
   },
@@ -126,13 +125,11 @@ export default {
       return this.value.position.zIndex || 1;
     }
   },
-  mounted() {
-  },
+  mounted() {},
   methods: {
-    handleFocus({index, left, top, width, height}) {
-    },
-    handleBlur({index, left, top, width, height}) {
-      this.$emit("onActivated", {index, left, top, width, height});
+    handleFocus({ index, left, top, width, height }) {},
+    handleBlur({ index, left, top, width, height }) {
+      this.$emit("onActivated", { index, left, top, width, height });
       this.$refs.draggable.setActive(true);
     }
   }

+ 43 - 23
report-ui/src/views/datasource/index.vue

@@ -4,28 +4,10 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-24 14:00:47
+ * @LastEditTime: 2022-03-09 09:43:31
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
-    <template v-slot:buttonLeftOnTable>
-      <el-button
-        type="primary"
-        icon="el-icon-plus"
-        @click="operateDatasource('add')"
-        v-permission="'datasourceManage:insert'"
-        >新增</el-button
-      >
-    </template>
-
-    <template slot="rowButton" slot-scope="props">
-      <el-button
-        type="text"
-        @click="operateDatasource('edit', props)"
-        v-permission="'datasourceManage:update'"
-        >编辑</el-button
-      >
-    </template>
     <template v-slot:pageSection>
       <EditDataSource
         ref="EditDataSource"
@@ -60,6 +42,46 @@ export default {
         title: "数据源",
         // 详情页中输入框左边文字宽度
         labelWidth: "120px",
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "新增",
+            type: "", // primary、success、info、warning、danger
+            permission: "datasourceManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.operateDatasource("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "datasourceManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "datasourceManage:update",
+            click: row => {
+              return this.operateDatasource("edit", row);
+            }
+          },
+          {
+            label: "删除",
+            permission: "datasourceManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 查询表单条件
         queryFormFields: [
           {
@@ -83,9 +105,7 @@ export default {
         ],
         // 操作按钮
         buttons: {
-          customButton: {
-            operationWidth: 150
-          },
+          rowButtonsWidth: 150, // row自定义按钮表格宽度
           query: {
             api: reportDataSourceList,
             permission: "datasourceManage:query",
@@ -218,7 +238,7 @@ export default {
     operateDatasource(type, prop) {
       this.dialogVisibleSetDataSource = true;
       if (prop) {
-        this.dataSource = prop.msg;
+        this.dataSource = prop;
       } else {
         this.dataSource = {};
       }

+ 41 - 3
report-ui/src/views/dict/dict-item.vue

@@ -64,6 +64,46 @@ export default {
             field: "locale"
           }
         ],
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "新增",
+            type: "", // primary、success、info、warning、danger
+            permission: "dictItemManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.$refs.listPage.handleOpenEditView("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "dictItemManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "dictItemManage:update",
+            click: row => {
+              return this.$refs.listPage.handleOpenEditView("edit", row);
+            }
+          },
+          {
+            label: "删除",
+            permission: "dictItemManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
           query: {
@@ -86,9 +126,7 @@ export default {
             api: dictItemEdit,
             permission: "dictItemManage:update"
           },
-          customButton: {
-            operationWidth: "150px"
-          }
+          rowButtonsWidth: 150 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [

+ 62 - 7
report-ui/src/views/dict/index.vue

@@ -4,7 +4,7 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-13 13:46:33
+ * @LastEditTime: 2022-03-09 10:02:26
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
@@ -75,6 +75,64 @@ export default {
             that.$store.commit("user/SET_PROJECT", queryForm["project"]);
           }
         },
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "刷新字典项",
+            type: "primary", // primary、success、info、warning、danger
+            permission: "dictManage:fresh", // 按钮权限码
+            icon: "el-icon-edit",
+            plain: true,
+            click: this.dictRefresh
+          },
+          {
+            label: "新增",
+            type: "", // primary、success、info、warning、danger
+            permission: "dictManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.$refs.listPage.handleOpenEditView("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "dictManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "dictManage:update",
+            click: row => {
+              return this.$refs.listPage.handleOpenEditView("edit", row);
+            }
+          },
+          {
+            label: "编辑字典项",
+            permission: "dictItemManage:query",
+            click: this.editItem
+          },
+          {
+            label: "刷新字典项",
+            permission: "dictManage:fresh",
+            click: this.itemRefresh
+          },
+          {
+            label: "删除",
+            permission: "dictManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
           query: {
@@ -97,10 +155,7 @@ export default {
             api: dictEdit,
             permission: "dictManage:update"
           },
-          // 自定义按钮
-          customButton: {
-            operationWidth: 160 // row自定义按钮表格宽度
-          }
+          rowButtonsWidth: 150 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [
@@ -200,7 +255,7 @@ export default {
     },
     // 刷新某个字典
     async itemRefresh(val) {
-      const selectedList = val.msg;
+      const selectedList = val;
       let dictCodes = [];
       if (selectedList.length > 0) {
         dictCodes = selectedList.map(item => item.dictCode);
@@ -214,7 +269,7 @@ export default {
       this.$router.push({
         path: "/system/dictItem",
         query: {
-          dictCode: val.msg.dictCode,
+          dictCode: val.dictCode,
           project: this.$store.state.user.project
         }
       });

+ 36 - 8
report-ui/src/views/fileManagement/index.vue

@@ -4,11 +4,11 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-13 13:47:02
+ * @LastEditTime: 2022-03-09 09:57:17
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
-    <template v-slot:buttonLeftOnTable>
+    <template v-slot:tableButtons>
       <el-upload
         class="el-upload"
         ref="upload"
@@ -61,6 +61,37 @@ export default {
             field: "filePath"
           }
         ],
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "删除",
+            type: "danger",
+            permission: "fileManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "复制url",
+            click: this.copyUrlPath
+          },
+          {
+            label: "下载",
+            click: this.customButtom
+          },
+          {
+            label: "删除",
+            permission: "fileManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
           query: {
@@ -87,10 +118,7 @@ export default {
             permission: "fileManage:update",
             isShow: false
           },
-          // 自定义按钮
-          customButton: {
-            operationWidth: 160 // row自定义按钮表格宽度
-          }
+          rowButtonsWidth: 150 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [
@@ -233,10 +261,10 @@ export default {
       window.open(row.urlPath);
     },
     customButtom(val) {
-      this.downloadFile(val.msg);
+      this.downloadFile(val);
     },
     copyUrlPath(val) {
-      this.copyToClip(val.msg.urlPath);
+      this.copyToClip(val.urlPath);
       this.$message({
         message: "已将url路径复制至剪切板!",
         type: "success"

+ 57 - 25
report-ui/src/views/reportManage/index.vue

@@ -4,31 +4,10 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-13 12:20:46
+ * @LastEditTime: 2022-03-09 09:54:15
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
-    <template slot="rowButtonInMore" slot-scope="props">
-      <el-button
-        type="text"
-        @click="preview(props.msg)"
-        v-permission="'bigScreenManage:view'"
-        >预览</el-button
-      >
-      <el-button
-        type="text"
-        @click="design(props.msg)"
-        v-permission="'bigScreenManage:design'"
-        >设计</el-button
-      >
-      <el-button
-        type="text"
-        @click="shareReport(props.msg)"
-        v-permission="'bigScreenManage:share'"
-        >分享</el-button
-      >
-    </template>
-
     <template v-slot:pageSection>
       <Share
         :visib="visibleForShareDialog"
@@ -92,6 +71,61 @@ export default {
             field: "reportAuthor"
           }
         ],
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "新增",
+            type: "", // primary、success、info、warning、danger
+            permission: "reportManage:insert", // 按钮权限码
+            icon: "el-icon-plus",
+            plain: true,
+            click: () => {
+              return this.$refs.listPage.handleOpenEditView("add");
+            }
+          },
+          {
+            label: "删除",
+            type: "danger",
+            permission: "reportManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "reportManage:update",
+            click: row => {
+              return this.$refs.listPage.handleOpenEditView("edit", row);
+            }
+          },
+          {
+            label: "预览",
+            permission: "bigScreenManage:view",
+            click: this.preview
+          },
+          {
+            label: "设计",
+            permission: "bigScreenManage:design",
+            click: this.design
+          },
+          {
+            label: "分享",
+            permission: "bigScreenManage:share",
+            click: this.shareReport
+          },
+          {
+            label: "删除",
+            permission: "reportManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
           query: {
@@ -116,9 +150,7 @@ export default {
             api: reportUpdate,
             permission: "reportManage:update"
           },
-          customButton: {
-            operationWidth: "150px"
-          }
+          rowButtonsWidth: 150 // row自定义按钮表格宽度
         },
         // 表格列
         columns: [

+ 43 - 27
report-ui/src/views/resultset/index.vue

@@ -4,11 +4,11 @@
  * @Author: qianlishi
  * @Date: 2021-12-11 14:48:27
  * @LastEditors: qianlishi
- * @LastEditTime: 2021-12-24 14:01:19
+ * @LastEditTime: 2022-03-09 09:49:23
 -->
 <template>
   <anji-crud ref="listPage" :option="crudOption">
-    <template v-slot:buttonLeftOnTable>
+    <template v-slot:tableButtons>
       <el-dropdown placement="bottom" @command="operateDataset">
         <el-button type="primary" icon="el-icon-plus">
           新增
@@ -21,23 +21,6 @@
       </el-dropdown>
     </template>
 
-    <template slot="rowButton" slot-scope="props">
-      <el-button
-        type="text"
-        @click="operateDataset('edit', props)"
-        v-permission="'resultsetManage:update'"
-        >编辑
-      </el-button>
-    </template>
-
-    <template slot="rowButtonInMore" slot-scope="props">
-      <el-button
-        type="text"
-        @click="dataView(props)"
-        v-permission="'resultsetManage:query'"
-        >数据预览
-      </el-button>
-    </template>
     <template v-slot:pageSection>
       <EditDataSet
         ref="EditDataSet"
@@ -113,11 +96,44 @@ export default {
             field: "setType"
           }
         ],
+        // 表头按钮
+        tableButtons: [
+          {
+            label: "删除",
+            type: "danger",
+            permission: "resultsetManage:delete",
+            icon: "el-icon-delete",
+            plain: false,
+            click: () => {
+              return this.$refs.listPage.handleDeleteBatch();
+            }
+          }
+        ],
+        // 表格行按钮
+        rowButtons: [
+          {
+            label: "编辑",
+            permission: "resultsetManage:update",
+            click: row => {
+              return this.operateDataset("edit", row);
+            }
+          },
+          {
+            label: "数据预览",
+            permission: "resultsetManage:query",
+            click: this.dataView
+          },
+          {
+            label: "删除",
+            permission: "resultsetManage:delete",
+            click: row => {
+              return this.$refs.listPage.handleDeleteBatch(row);
+            }
+          }
+        ],
         // 操作按钮
         buttons: {
-          customButton: {
-            operationWidth: 180
-          },
+          rowButtonsWidth: 180, // row自定义按钮表格宽度
           query: {
             api: reportDataSetList,
             permission: "resultsetManage:query",
@@ -275,9 +291,9 @@ export default {
   methods: {
     operateDataset(type, prop) {
       this.dialogVisibleSetDataSet = true;
-      if (prop && prop.msg) {
-        this.dataSet = prop.msg;
-        type = prop.msg.setType;
+      if (prop && prop) {
+        this.dataSet = prop;
+        type = prop.setType;
       } else {
         this.dataSet = {};
       }
@@ -289,8 +305,8 @@ export default {
     dataView(prop) {
       this.dialogCaseResult = true;
       this.$refs.DataView.dataViewPreview(
-        prop.msg.setName,
-        JSON.parse(prop.msg.caseResult)
+        prop.setName,
+        JSON.parse(prop.caseResult)
       );
     }
   }