소스 검색

Merge branch 'leng_dev' into big

冷冷 5 년 전
부모
커밋
f2c69c3f13
5개의 변경된 파일151개의 추가작업 그리고 119개의 파일을 삭제
  1. 31 4
      src/const/crud/admin/menu.js
  2. 1 1
      src/router/avue-router.js
  3. 49 41
      src/views/admin/dict/index.vue
  4. 61 65
      src/views/admin/log/index.vue
  5. 9 8
      src/views/admin/menu/index.vue

+ 31 - 4
src/const/crud/admin/menu.js

@@ -18,7 +18,7 @@ import iconList from '@/const/iconList'
 
 export const tableOption = {
   tip: false,
-  lazy:true,
+  lazy: true,
   dialogWidth: "60%",
   tree: true,
   border: true,
@@ -41,9 +41,9 @@ export const tableOption = {
     {
       label: "类型",
       prop: "type",
-      type: "radio",
+      type: "select",
       slot: true,
-      border:true,
+      border: true,
       valueFormat: "string",
       dicData: [
         {
@@ -120,7 +120,7 @@ export const tableOption = {
     },
     {
       label: "权限标识",
-      prop: "code",
+      prop: "permission",
       addDisplay: true,
       editDisplay: true,
       rules: [
@@ -131,6 +131,33 @@ export const tableOption = {
         }
       ]
     },
+    {
+      hide: true,
+      addDisplay: true,
+      editDisplay: true,
+      label: "路由缓冲",
+      prop: "keepAlive",
+      type: "radio",
+      border: true,
+      valueFormat: "string",
+      dicData: [
+        {
+          label: "关闭",
+          value: "0"
+        },
+        {
+          label: "打开",
+          value: "1"
+        },
+      ],
+      rules: [
+        {
+          required: true,
+          message: "请选择上级菜单",
+          trigger: "click",
+        }
+      ]
+    },
     {
       label: "排序",
       prop: "sort",

+ 1 - 1
src/router/avue-router.js

@@ -95,7 +95,7 @@ RouterPlugin.install = function(router, store) {
         const children = oMenu[propsDefault.children]
 
         const meta = {
-          keepAlive: Number(oMenu['keepAlive']) === 0
+          keepAlive: Number(oMenu['keepAlive']) === 1
         }
         const isChild = children.length !== 0
         const oRouter = {

+ 49 - 41
src/views/admin/dict/index.vue

@@ -47,18 +47,19 @@
     </basic-container>
     <el-dialog
       :visible.sync="dialogFormVisible"
-      :table-loading="tableLoading"
       title="字典项管理"
       width="90%"
       @close="dialogFormVisible=false">
       <avue-crud
         ref="crudItem"
+        :page="itemPage"
         :data="tableDictItemData"
         :permission="permissionList"
         v-model="form"
         :before-open="handleBeforeOpen"
         :option="tableDictItemOption"
-        :table-loading="tableLoading"
+        @size-change="itemSizeChange"
+        @current-change="itemCurrentChange"
         @row-update="handleItemUpdate"
         @row-save="handleItemSave"
         @row-del="rowItemDel"/>
@@ -90,15 +91,16 @@
           currentPage: 1, // 当前页数
           pageSize: 20 // 每页显示多少条
         },
+        itemPage: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
         tableLoading: false,
         tableOption: tableOption,
         tableDictItemOption: tableDictItemOption
       }
     },
-    created() {
-    },
-    mounted: function () {
-    },
     computed: {
       ...mapGetters(['permissions']),
       permissionList() {
@@ -110,6 +112,7 @@
       }
     },
     methods: {
+      //======字典表格相关=====
       getList(page, params) {
         this.tableLoading = true
         fetchList(Object.assign({
@@ -121,27 +124,7 @@
           this.tableLoading = false
         })
       },
-
-      getDictItemList(dictId, type) {
-        this.dictType = type
-        this.dictId = dictId
-        this.dialogFormVisible = true
-        this.tableLoading = true
-        fetchItemList(Object.assign({
-          current: this.page.currentPage,
-          size: this.page.pageSize
-        }, {dictId: dictId})).then(response => {
-          this.tableDictItemData = response.data.data.records
-          this.tableLoading = false
-        })
-      },
-      handleBeforeOpen(done) {
-        this.form.type = this.dictType
-        this.form.dictId = this.dictId
-        done()
-      },
       rowDel: function (row) {
-        var _this = this
         this.$confirm('是否确认删除数据类型为"' + row.type + '"的数据项?', '警告', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
@@ -150,7 +133,7 @@
           return delObj(row)
         }).then(() => {
           this.getList(this.page)
-          _this.$message.success('删除成功')
+          this.$message.success('删除成功')
         }).catch(function () {
         })
       },
@@ -168,6 +151,38 @@
           done()
         })
       },
+      searchChange(form, done) {
+        this.searchForm = form
+        this.getList(this.page, form)
+        done()
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize
+      },
+      currentChange(current) {
+        this.page.currentPage = current
+      },
+      //======字典项表格相关=====
+      handleItem: function (row) {
+        this.getDictItemList(row.id, row.type)
+      },
+      getDictItemList(dictId, type) {
+        this.dictType = type
+        this.dictId = dictId
+        this.dialogFormVisible = true
+        fetchItemList(Object.assign({
+          current: this.itemPage.currentPage,
+          size: this.itemPage.pageSize
+        }, {dictId: dictId})).then(response => {
+          this.tableDictItemData = response.data.data.records
+          this.itemPage.total = response.data.data.total
+        })
+      },
+      handleBeforeOpen(done) {
+        this.form.type = this.dictType
+        this.form.dictId = this.dictId
+        done()
+      },
       handleItemSave: function (row, done) {
         addItemObj(row).then(() => {
           this.$message.success('添加成功')
@@ -182,22 +197,15 @@
           done()
         })
       },
-      searchChange(form, done) {
-        this.searchForm = form
-        this.getList(this.page, form)
-        done()
-      },
-      sizeChange(pageSize) {
-        this.page.pageSize = pageSize
-      },
-      currentChange(current) {
-        this.page.currentPage = current
+      itemSizeChange(pageSize) {
+        this.itemPage.pageSize = pageSize
+        this.getDictItemList(this.dictId, this.type)
       },
-      handleItem: function (row) {
-        this.getDictItemList(row.id, row.type)
+      itemCurrentChange(current) {
+        this.itemPage.currentPage = current
+        this.getDictItemList(this.dictId, this.type)
       },
       rowItemDel: function (row) {
-        var _this = this
         this.$confirm('是否确认删除数据为"' + row.label + '"的数据项?', '警告', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
@@ -206,7 +214,7 @@
           return delItemObj(row.id)
         }).then(() => {
           this.getDictItemList(row.dictId, row.type)
-          _this.$message.success('删除成功')
+          this.$message.success('删除成功')
         }).catch(function () {
         })
       }

+ 61 - 65
src/views/admin/log/index.vue

@@ -36,76 +36,72 @@
 </template>
 
 <script>
-import { delObj, fetchList } from '@/api/admin/log'
-import { tableOption } from '@/const/crud/admin/log'
-import { mapGetters } from 'vuex'
+  import {delObj, fetchList} from '@/api/admin/log'
+  import {tableOption} from '@/const/crud/admin/log'
+  import {mapGetters} from 'vuex'
 
-export default {
-  name: 'Log',
-  data() {
-    return {
-      tableData: [],
-      searchForm: {},
-      page: {
-        total: 0, // 总页数
-        currentPage: 1, // 当前页数
-        pageSize: 20 // 每页显示多少条
-      },
-      tableLoading: false,
-      tableOption: tableOption
-    }
-  },
-  created() {
-  },
-  mounted: function() {
-  },
-  computed: {
-    ...mapGetters(['permissions']),
-    permissionList() {
+  export default {
+    name: 'Log',
+    data() {
       return {
-        delBtn: this.vaildData(this.permissions.sys_log_del, false)
+        tableData: [],
+        searchForm: {},
+        page: {
+          total: 0, // 总页数
+          currentPage: 1, // 当前页数
+          pageSize: 20 // 每页显示多少条
+        },
+        tableLoading: false,
+        tableOption: tableOption
       }
-    }
-  },
-  methods: {
-    getList(page, params) {
-      this.tableLoading = true
-      fetchList(Object.assign({
-        descs: 'create_time',
-        current: page.currentPage,
-        size: page.pageSize
-      }, params, this.searchForm)).then(response => {
-        this.tableData = response.data.data.records
-        this.page.total = response.data.data.total
-        this.tableLoading = false
-      })
-    },
-    handleDel: function(row) {
-      this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      }).then(function() {
-        return delObj(row.id)
-      }).then(() => {
-        this.getList(this.page)
-        this.$message.success('删除成功')
-      })
-    },
-    searchChange(form, done) {
-      this.searchForm = form
-      this.getList(this.page, form)
-      done()
     },
-    sizeChange(pageSize){
-      this.page.pageSize = pageSize
-    },
-    currentChange(current){
-      this.page.currentPage = current
+    computed: {
+      ...mapGetters(['permissions']),
+      permissionList() {
+        return {
+          delBtn: this.vaildData(this.permissions.sys_log_del, false)
+        }
+      }
     },
-    refreshChange() {
-      this.getList(this.page)
+    methods: {
+      getList(page, params) {
+        this.tableLoading = true
+        fetchList(Object.assign({
+          descs: 'create_time',
+          current: page.currentPage,
+          size: page.pageSize
+        }, params, this.searchForm)).then(response => {
+          this.tableData = response.data.data.records
+          this.page.total = response.data.data.total
+          this.tableLoading = false
+        })
+      },
+      handleDel: function (row) {
+        this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(function () {
+          return delObj(row.id)
+        }).then(() => {
+          this.getList(this.page)
+          this.$message.success('删除成功')
+        })
+      },
+      searchChange(form, done) {
+        this.searchForm = form
+        this.getList(this.page, form)
+        done()
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize
+      },
+      currentChange(current) {
+        this.page.currentPage = current
+      },
+      refreshChange() {
+        this.getList(this.page)
+      }
     }
   }
-}
 </script>

+ 9 - 8
src/views/admin/menu/index.vue

@@ -124,14 +124,8 @@
             item.editDisplay = this.form.type !== "1"
           }
 
-          // 是按钮类型输入code
-          if (item.prop === "code") {
-            item.addDisplay = this.form.type === "1"
-            item.editDisplay = this.form.type === "1"
-          }
-
-          // 是按钮类型输入code
-          if (item.prop === "code") {
+          // 是按钮类型输入permission
+          if (item.prop === "permission") {
             item.addDisplay = this.form.type === "1"
             item.editDisplay = this.form.type === "1"
           }
@@ -146,6 +140,13 @@
           if (item.prop === "parentId") {
             item.rules[0].required = this.form.type === "1"
           }
+
+          // 菜单开启 keepAlive 选择
+          if (item.prop === "keepAlive") {
+            item.addDisplay = this.form.type === "0"
+            item.editDisplay = this.form.type === "0"
+            item.rules[0].required = this.form.type === "0"
+          }
         });
       }
     }