Quellcode durchsuchen

辅材收费标准

linwenxin vor 1 Jahr
Ursprung
Commit
90c2736bfc

+ 88 - 88
src/views/auxiliaryFittings/auxiliaryDataManagement/auxiliaryChargeManagement/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,34 +25,76 @@ import { materialNormList, materialNormListExport, materialNormAdd, materialNorm
 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: [
+      // 表格属性
+      tableAttributes: {
+        // 启用勾选列
+        selectColumn: true
+      },
+      // 表格事件
+      tableEvents: {
+        'selection-change': this.selectionChange
+      },
+      // 勾选选中行
+      recordSelected: [],
+      /** 表单变量 */
+      formDialogType: 0,
+      formDialogTitles: ["新增", "编辑"],
+      formDialog: false,
+      formData: {
+        companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
+        "categoryId": "",
+        "companyWechatId": "",
+        "createBy": "",
+        "createTime": "",
+        "normAmount": 0,
+        "normCode": "",
+        "normId": "",
+        "normName": "",
+        "normType": "",
+        "outWebsitAmount": 0,
+        "outWorkerAmount": 0,
+        "parentCategoryId": "",
+        "remark": "",
+        "selfWebsitAmount": 0,
+        "selfWorkerAmount": 0,
+        "specification": "",
+        "status": "ON",
+        "unit": "",
+      },
+      partsUnitList: [],
+      materialCategoryTree: []
+    }
+  },
+  computed: {
+    // 事件组合
+    optionsEvensGroup() {
+      return [
         [
           [
-            {
-              name: '新建',
-              isRole: true,
+            this.optionsEvensAuth("add", {
               click: this.addData
-            }
+            }),
           ],
           [
-            {
+            this.optionsEvensAuth(["imp", "template"], {
               name: '导入物料',
               click: () => { }
-            },
-            {
-              name: '导入物料收费',
-              render: () => {
-                return this.importButton(materialNormImport, '导入物料收费')
+            }),
+            this.optionsEvensAuth("imp", ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(materialNormImport, moduleName)
+                }
               }
-            },
-            {
-              name: '下载物料收费模板',
+            }),
+            this.optionsEvensAuth("template", {
               click: () => {
                 commonTemplateDownload({ name: '辅材收费标准模板(物料收费).xlsx' }, `辅材收费标准模板(物料收费)`)
                   .then(res => {
@@ -65,21 +107,22 @@ export default {
                     this.$message.error('下载失败')
                   })
               }
-            },
+            }),
           ],
           [
-            {
+            this.optionsEvensAuth(["Import", "downloadTemplate"], {
               name: '导入服务',
               click: () => { }
-            },
-            {
-              name: '导入服务收费',
-              render: () => {
-                return this.importButton(materialNormImport2, '导入服务收费')
+            }),
+            this.optionsEvensAuth("Import", ({ moduleName }) => {
+              return {
+                name: moduleName,
+                render: () => {
+                  return this.importButton(materialNormImport2, moduleName)
+                }
               }
-            },
-            {
-              name: '下载服务收费模板',
+            }),
+            this.optionsEvensAuth("downloadTemplate", {
               click: () => {
                 commonTemplateDownload({ name: '辅材收费标准模板(服务收费).xlsx' }, `辅材收费标准模板(服务收费)`)
                   .then(res => {
@@ -92,14 +135,12 @@ export default {
                     this.$message.error('下载失败')
                   })
               }
-            },
+            }),
           ],
         ],
         [
           [
-            {
-              name: '批量上架',
-              isRole: true,
+            this.optionsEvensAuth("batchLaunch", {
               click: () => {
                 if (this.recordSelected.length) {
                   this.setRowStatus("ON")
@@ -110,12 +151,10 @@ export default {
                   });
                 }
               }
-            }
+            }),
           ],
           [
-            {
-              name: '批量下架',
-              isRole: true,
+            this.optionsEvensAuth("batchRemoval", {
               click: () => {
                 if (this.recordSelected.length) {
                   this.setRowStatus("OFF")
@@ -126,51 +165,11 @@ export default {
                   });
                 }
               }
-            }
-          ],
-        ],
-      ],
-      // 表格属性
-      tableAttributes: {
-        // 启用勾选列
-        selectColumn: true
-      },
-      // 表格事件
-      tableEvents: {
-        'selection-change': this.selectionChange
-      },
-      // 勾选选中行
-      recordSelected: [],
-      /** 表单变量 */
-      formDialogType: 0,
-      formDialogTitles: ["新增", "编辑"],
-      formDialog: false,
-      formData: {
-        companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
-        "categoryId": "",
-        "companyWechatId": "",
-        "createBy": "",
-        "createTime": "",
-        "normAmount": 0,
-        "normCode": "",
-        "normId": "",
-        "normName": "",
-        "normType": "",
-        "outWebsitAmount": 0,
-        "outWorkerAmount": 0,
-        "parentCategoryId": "",
-        "remark": "",
-        "selfWebsitAmount": 0,
-        "selfWorkerAmount": 0,
-        "specification": "",
-        "status": "ON",
-        "unit": "",
-      },
-      partsUnitList: [],
-      materialCategoryTree: []
-    }
-  },
-  computed: {
+            }),
+          ]
+        ]
+      ]
+    },
     // 更多参数
     moreParameters() {
       return []
@@ -411,20 +410,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.normId }).then(res => {
               Object.assign(this.formData, res.data)
               this.formDialogType = 1
               this.openForm()
             })
-          }}>编辑</el-button>
-        </div>
-      )
+          }
+        },
+      })
     },
+
     addData() {
       this.formDialogType = 0
       this.openForm()