zhouhao пре 2 година
родитељ
комит
1f496a311f
3 измењених фајлова са 75 додато и 53 уклоњено
  1. 18 0
      src/api/user.js
  2. 51 50
      src/components/template/template-page-1.vue
  3. 6 3
      src/permission.js

+ 18 - 0
src/api/user.js

@@ -68,3 +68,21 @@ export function getAdminUserSmsCode(params) {
     params
   })
 }
+
+// 保存配置的列表字段
+export function zfireSave(data, moduleId) {
+  return request({
+    url: `/zfire/save?moduleId=${moduleId}`,
+    method: "post",
+    data
+  });
+}
+// 删除配置的列表字段
+
+export function zfireDel(data, adminUserId, moduleId) {
+  return request({
+    url: `/zfire/delete?adminUserId=${adminUserId}&moduleId=${moduleId}`,
+    method: "post",
+    data
+  });
+}

+ 51 - 50
src/components/template/template-page-1.vue

@@ -14,7 +14,7 @@
     :operation-column-width="operationColumnWidth"
     :show-table="showTable"
     :code-gather="codeGather"
-    @columnWidthChange="columnWidthChange"
+    @columnWidthChange="columnWidthChange" 
     @columnListChange="columnListChange"
   >
     <sel-export-column-list
@@ -28,6 +28,7 @@
 
 <script>
 
+import { zfireSave, zfireDel } from "@/api/user";
 import SelExportColumnList from './sel-export-column-list'
 
 export default {
@@ -180,61 +181,61 @@ export default {
     },
     // 监听列表显示状态与排序变化
     columnListChange(columnList) {
-      // zfireSave(
-      //   this.$refs.zjpage.columnList.map((item, index) => {
-      //     var data = {
-      //       ...item.exportField,
-      //       sortNum: index,
-      //       isCopy: item.isCopy,
-      //       isTotal: item.isTotal,
-      //       isShow: !item.hidden,
-      //       moduleId: this.moduleId,
-      //       adminUserId: this.userid
-      //     }
-      //     return data
-      //   }),
-      //   this.moduleId
-      // )
-      //   .then(res => {
-      //   })
-      //   .catch(err => {
-      //     this.$message.error('保存失败')
-      //   })
+      zfireSave(
+        this.$refs.zjpage.columnList.map((item, index) => {
+          var data = {
+            ...item.exportField,
+            sortNum: index,
+            isCopy: item.isCopy,
+            isTotal: item.isTotal,
+            isShow: !item.hidden,
+            moduleId: this.moduleId,
+            adminUserId: this.userid
+          }
+          return data
+        }),
+        this.moduleId
+      )
+        .then(res => {
+        })
+        .catch(err => {
+          this.$message.error('保存失败')
+        })
     },
     // 监听列宽度变化
     columnWidthChange({ newWidth, oldWidth, column }) {
-      // zfireSave(
-      //   this.$refs.zjpage.columnList.map((item, index) => {
-      //     if (item.exportField.jname === column.property) {
-      //       item.exportField.width = newWidth
-      //     }
-      //     return {
-      //       ...item.exportField,
-      //       sortNum: index,
-      //       isCopy: item.isCopy,
-      //       isTotal: item.isTotal,
-      //       isShow: !item.hidden,
-      //       moduleId: this.moduleId,
-      //       adminUserId: this.userid
-      //     }
-      //   }),
-      //   this.moduleId
-      // )
-      //   .then(res => {
-      //   })
-      //   .catch(err => {
-      //     this.$message.error('保存失败')
-      //   })
+      zfireSave(
+        this.$refs.zjpage.columnList.map((item, index) => {
+          if (item.exportField.jname === column.property) {
+            item.exportField.width = newWidth
+          }
+          return {
+            ...item.exportField,
+            sortNum: index,
+            isCopy: item.isCopy,
+            isTotal: item.isTotal,
+            isShow: !item.hidden,
+            moduleId: this.moduleId,
+            adminUserId: this.userid
+          }
+        }),
+        this.moduleId
+      )
+        .then(res => {
+        })
+        .catch(err => {
+          this.$message.error('保存失败')
+        })
     },
     // 表格恢复初始默认状态
     reduction() {
-      // zfireDel({}, this.userid, this.moduleId)
-      //   .then(res => {
-      //     this.$refs.zjpage.refresh()
-      //   })
-      //   .catch(err => {
-      //     this.$message.error('操作失败')
-      //   })
+      zfireDel({}, this.userid, this.moduleId)
+        .then(res => {
+          this.$refs.zjpage.refresh()
+        })
+        .catch(err => {
+          this.$message.error('操作失败')
+        })
     },
     // 导出
     export() {

+ 6 - 3
src/permission.js

@@ -140,7 +140,8 @@ function buildRootRoute(route) {
   item.name = fullUrl || code
   item.meta = {
     title: moduleName,
-    icon: icon
+    icon: icon,
+    moduleId
   }
   if (code == 'index') {
     item.path = '/'
@@ -213,7 +214,8 @@ function buildRoute(route, p_url) {
   item.name = fullUrl || code
   item.meta = {
     title: moduleName,
-    icon: icon
+    icon: icon,
+    moduleId
   }
   if (route.children && type == 2) {
     const roles = []
@@ -254,7 +256,8 @@ function buildThirdRoute(route, p_url) {
 
   item.meta = {
     title: moduleName,
-    icon: icon
+    icon: icon,
+    moduleId
   }
   if (route.children && type == 2) {
     const roles = []