smallwei 6 anni fa
parent
commit
7eeeabadae

+ 1 - 0
src/const/crud/user.js

@@ -44,6 +44,7 @@ export const tableOption = {
         editDisabled: true,
         addVisdiplay: false,
     }, {
+        width: 150,
         fixed: true,
         label: '用户名',
         prop: 'username',

+ 1 - 1
src/page/index/sidebar/sidebarItem.vue

@@ -27,7 +27,7 @@
             <span slot="title">{{child[labelKey]}}</span>
           </el-menu-item>
           <sidebar-item v-else
-                        :menu="child[childrenKey]"
+                        :menu="[child]"
                         :key="cindex"
                         :props="props"
                         :screen="screen"

+ 1 - 0
src/router/axios.js

@@ -59,6 +59,7 @@ axios.interceptors.response.use(res => {
         })
         return Promise.reject(new Error(message))
     }
+    if (status !== 200) return Promise.reject(res);
     return res;
 }, error => {
     NProgress.done()

+ 11 - 0
src/router/views/index.js

@@ -19,6 +19,17 @@ export default [{
         component: () =>
             import ( /* webpackChunkName: "views" */ '@/views/crud/index')
     }]
+}, {
+    path: '/info',
+    component: Layout,
+    redirect: '/info/index',
+    children: [{
+        path: 'index',
+        name: '个人信息',
+        component: () =>
+            import ( /* webpackChunkName: "page" */ '@/views/admin/user/info'),
+    }]
+
 }, {
     path: '/activti',
     component: Layout,

+ 1 - 1
src/store/modules/user.js

@@ -101,7 +101,7 @@ const user = {
                     commit('SET_ROLES', data.roles || []);
                     commit('SET_PERMISSIONS', data.permissions || [])
                     resolve(data);
-                }).catch(() => {
+                }).catch((err) => {
                     reject();
                 })
             })

+ 16 - 14
src/views/admin/dept/index.vue

@@ -204,7 +204,9 @@ export default {
         } else {
           this.form = data;
         }
-        this.$refs.form.clearValidate();
+        setTimeout(() => {
+          this.$refs.form.clearValidate();
+        }, 0);
       })
     },
     handlerEdit (data) {
@@ -218,6 +220,9 @@ export default {
       if (validatenull(this.obj)) {
         this.form.parentId = 0;
         this.form.parentName = '';
+        setTimeout(() => {
+          this.$refs.form.clearValidate();
+        }, 0);
       } else {
         this.show(this.obj);
       }
@@ -247,17 +252,14 @@ export default {
       })
     },
     update () {
-      this.$refs.form.validate((valid) => {
-        if (!valid) return
-        putObj(this.form).then(() => {
-          this.onCancel();
-          this.getList()
-          this.$notify({
-            title: '成功',
-            message: '更新成功',
-            type: 'success',
-            duration: 2000
-          })
+      putObj(this.form).then(() => {
+        this.onCancel();
+        this.getList()
+        this.$notify({
+          title: '成功',
+          message: '更新成功',
+          type: 'success',
+          duration: 2000
         })
       })
 
@@ -277,10 +279,10 @@ export default {
     onCancel () {
       this.formStatus = ''
       this.editFlag = false;
+      this.$refs.form.resetForm();
       setTimeout(() => {
-        this.$refs.form.resetForm();
         this.$refs.form.clearValidate();
-      }, 0)
+      }, 0);
     }
   }
 }

+ 69 - 69
src/views/admin/log/index.vue

@@ -16,7 +16,7 @@
   -->
 
 <template>
-  <div class="app-container pull-auto">
+  <div class="log">
     <basic-container>
       <avue-crud ref="crud"
                  :page="page"
@@ -42,80 +42,80 @@
 </template>
 
 <script>
-  import { fetchList, delObj } from '@/api/log'
-  import { tableOption } from '@/const/crud/log'
-  import { mapGetters } from 'vuex'
-  export default {
-    name: 'log',
-    data() {
-      return {
-        tableData: [],
-        page: {
-          total: 0, // 总页数
-          currentPage: 1, // 当前页数
-          pageSize: 20 // 每页显示多少条
-        },
-        tableLoading: false,
-        tableOption: tableOption
-      }
-    },
-    created() {
+import { fetchList, delObj } from '@/api/log'
+import { tableOption } from '@/const/crud/log'
+import { mapGetters } from 'vuex'
+export default {
+  name: 'log',
+  data () {
+    return {
+      tableData: [],
+      page: {
+        total: 0, // 总页数
+        currentPage: 1, // 当前页数
+        pageSize: 20 // 每页显示多少条
+      },
+      tableLoading: false,
+      tableOption: tableOption
+    }
+  },
+  created () {
+  },
+  mounted: function () { },
+  computed: {
+    ...mapGetters(['permissions'])
+  },
+  methods: {
+    getList (page, params) {
+      this.tableLoading = true
+      fetchList(Object.assign({
+        orderByField: 'create_time',
+        isAsc: false,
+        page: page.currentPage,
+        limit: page.pageSize
+      }, params)).then(response => {
+        this.tableData = response.data.data.records
+        this.page.total = response.data.data.total
+        this.tableLoading = false
+      })
     },
-    mounted: function() { },
-    computed: {
-      ...mapGetters(['permissions'])
+    handleDel (row, index) {
+      this.$refs.crud.rowDel(row, index)
     },
-    methods: {
-      getList(page,params) {
-        this.tableLoading = true
-        fetchList(Object.assign({
-            orderByField: 'create_time',
-            isAsc: false,
-            page: page.currentPage,
-            limit: page.pageSize
-        }, params)).then(response => {
-          this.tableData = response.data.data.records
-          this.page.total = response.data.data.total
-          this.tableLoading = false
-        })
-      },
-      handleDel(row, index) {
-        this.$refs.crud.rowDel(row, index)
-      },
-      rowDel: function(row, index) {
-        var _this = this
-        this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
+    rowDel: function (row, index) {
+      var _this = this
+      this.$confirm('是否确认删除ID为"' + row.id + '"的日志?', '警告', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(function () {
+          return delObj(row.id)
         })
-          .then(function() {
-            return delObj(row.id)
+        .then(data => {
+          this.getList(this.page)
+          _this.$message({
+            showClose: true,
+            message: '删除成功',
+            type: 'success'
           })
-          .then(data => {
-            this.getList(this.page)
-            _this.$message({
-              showClose: true,
-              message: '删除成功',
-              type: 'success'
-            })
-          })
-          .catch(function(err) { })
-      },
-      /**
-       * 搜索回调
-       */
-      searchChange(form) {
-        this.getList(this.page,form)
-      },
-      /**
-       * 刷新回调
-       */
-      refreshChange() {
-        this.getList(this.page)
-      }
+        })
+        .catch(function (err) { })
+    },
+    /**
+     * 搜索回调
+     */
+    searchChange (form) {
+      this.getList(this.page, form)
+    },
+    /**
+     * 刷新回调
+     */
+    refreshChange () {
+      this.getList(this.page)
     }
   }
+}
 </script>
 
 <style lang="scss" scoped>

+ 5 - 5
src/views/admin/role/index.vue

@@ -136,11 +136,11 @@ export default {
     ...mapGetters(['elements', 'permissions'])
   },
   methods: {
-    getList (page,params) {
+    getList (page, params) {
       this.listLoading = true
       fetchList(Object.assign({
-          page: page.currentPage,
-          limit: page.pageSize
+        page: page.currentPage,
+        limit: page.pageSize
       }, params)).then(response => {
         this.list = response.data.data.records
         this.page.total = response.data.data.total
@@ -152,7 +152,7 @@ export default {
     },
     handleFilter (param) {
       this.page.page = 1;
-      this.getList(this.page,param);
+      this.getList(this.page, param);
     },
     handleCreate () {
       this.$refs.crud.rowAdd();
@@ -170,7 +170,7 @@ export default {
           return fetchTree()
         })
         .then(response => {
-          this.form = response.data.data
+          this.treeData = response.data.data
           // 解析出所有的太监节点
           this.checkedKeys = this.resolveAllEunuchNodeId(this.treeData, this.checkedKeys, [])
           this.dialogStatus = 'permission'