浏览代码

辅材列表

linwenxin 1 年之前
父节点
当前提交
d957186839
共有 1 个文件被更改,包括 83 次插入84 次删除
  1. 83 84
      src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryPriceManagement/index.vue

+ 83 - 84
src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryPriceManagement/index.vue

@@ -1,7 +1,7 @@
 <template>
   <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
     :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
-    :operation="operation" :exportList="exportList">
+    :operation="operation()" :exportList="exportList">
     <el-dialog title="" width="860px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
       :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
       <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
@@ -25,84 +25,12 @@ import { websitGoodsmImport, materialNormList, materialNormListExport, materialN
 import { materialCategoryTree } from "@/api/auxiliaryMaterialClass";
 import { getTypeList } from "@/api/auxiliaryFittings/attachmentProfile";
 import { commonTemplateDownload } from '@/api/common.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin],
+  mixins: [import_mixin, operation_mixin],
   data() {
     return {
-      // 事件组合
-      optionsEvensGroup: [
-        [
-          [
-            {
-              name: '新建',
-              isRole: true,
-              click: this.addData
-            }
-          ],
-          [
-            {
-              name: '导入辅材',
-              click: () => { }
-            },
-            {
-              name: '导入辅材模板',
-              render: () => {
-                return this.importButton(websitGoodsmImport, '导入辅材模板')
-              }
-            },
-            {
-              name: '下载辅材模板',
-              click: () => {
-                commonTemplateDownload({ name: '辅材模板.xlsx' }, `辅材模板`)
-                  .then(res => {
-                    this.$message({
-                      message: '下载成功',
-                      type: 'success'
-                    })
-                  })
-                  .catch(err => {
-                    this.$message.error('下载失败')
-                  })
-              }
-            },
-          ],
-        ],
-        [
-          [
-            {
-              name: '批量上架',
-              isRole: true,
-              click: () => {
-                if (this.recordSelected.length) {
-                  this.setRowStatus("ON")
-                } else {
-                  this.$message({
-                    type: 'warning',
-                    message: `请先勾选需要设置的数据!`,
-                  });
-                }
-              }
-            }
-          ],
-          [
-            {
-              name: '批量下架',
-              isRole: true,
-              click: () => {
-                if (this.recordSelected.length) {
-                  this.setRowStatus("OFF")
-                } else {
-                  this.$message({
-                    type: 'warning',
-                    message: `请先勾选需要设置的数据!`,
-                  });
-                }
-              }
-            }
-          ],
-        ],
-      ],
       // 表格属性
       tableAttributes: {
         // 启用勾选列
@@ -153,6 +81,76 @@ export default {
     }
   },
   computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth("add", {
+              click: this.addData
+            }),
+          ],
+          [
+            this.optionsEvensAuth(["imp", "template"], {
+              name: '导入辅材',
+              click: () => { }
+            }),
+            this.optionsEvensAuth("imp", ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(websitGoodsmImport, moduleName)
+                }
+              }
+            }),
+            this.optionsEvensAuth("template", {
+              click: () => {
+                commonTemplateDownload({ name: '辅材模板.xlsx' }, `辅材模板`)
+                  .then(res => {
+                    this.$message({
+                      message: '下载成功',
+                      type: 'success'
+                    })
+                  })
+                  .catch(err => {
+                    this.$message.error('下载失败')
+                  })
+              }
+            }),
+          ],
+        ],
+        [
+          [
+            this.optionsEvensAuth("batchLaunch", {
+              click: () => {
+                if (this.recordSelected.length) {
+                  this.setRowStatus("ON")
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: `请先勾选需要设置的数据!`,
+                  });
+                }
+              }
+            }),
+          ],
+          [
+            this.optionsEvensAuth("batchRemoval", {
+              click: () => {
+                if (this.recordSelected.length) {
+                  this.setRowStatus("OFF")
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: `请先勾选需要设置的数据!`,
+                  });
+                }
+              }
+            }),
+          ]
+        ]
+      ]
+    },
     // 更多参数
     moreParameters() {
       return []
@@ -304,20 +302,21 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
-    // 表格操作列
-    operation(h, { row, index, column }) {
-      return (
-        <div class='operation-btns'>
-          <el-button type="text" onClick={() => {
+
+    operation() {
+			return this.operationBtn({
+				edit: {
+					click: ({ row, index, column }) => {
             materialNormDetail({ id: row.goodsId }).then(res => {
               Object.assign(this.formData, res.data)
               this.formDialogType = 1
               this.openForm()
             })
-          }}>编辑</el-button>
-        </div>
-      )
-    },
+					}
+				},
+			})
+		},
+
     addData() {
       this.formDialogType = 0
       this.openForm()