YY 2 anni fa
parent
commit
21e505eb6f

+ 2 - 0
src/store/index.js

@@ -12,6 +12,7 @@ import outBill from './module/statistics/outBill';
 import dictIndex from './module/dev/dictIndex';
 import dictData from './module/dev/dictData';
 import menus from './module/dev/menus';
+import role from './module/dev/role';
 
 import goodsTags from './module/system/goodsTags';
 import banner from './module/system/banner';
@@ -48,6 +49,7 @@ export default new Vuex.Store({
     dictIndex,
     dictData,
     menus,
+    role,
     goodsTags,
     banner,
     indexModule,

+ 44 - 0
src/store/module/dev/role.js

@@ -0,0 +1,44 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+const _ = require('lodash');
+Vue.use(Vuex);
+const api = {
+  url: '/point/v1/api/role',
+};
+
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.url}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.url}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.url}/${payload}`);
+    return res;
+  },
+  async update({ commit }, payload) {
+    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const res = await this.$axios.$post(`${api.url}/${id}`, payload);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.url}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 0 - 4
src/views/dev/menu/index.vue

@@ -76,9 +76,6 @@
             <el-form-item label="备注">
               <el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :autosize="{ minRows: 5, maxRows: 5 }"></el-input>
             </el-form-item>
-            <!-- <el-form-item>
-              
-            </el-form-item> -->
           </el-form>
         </el-tab-pane>
         <el-tab-pane label="设置" name="config" v-if="form.type && form.type !== '0'">
@@ -153,7 +150,6 @@ export default {
     async search() {
       let res = await this.query();
       if (this.$checkRes(res)) {
-        console.log(res.data);
         this.$set(this, `list`, res.data);
       }
     },

+ 19 - 17
src/views/dev/role/index.vue

@@ -12,6 +12,7 @@
           <data-table
             :fields="fields"
             :opera="opera"
+            :vOpera="false"
             :data="list"
             @query="search"
             :total="total"
@@ -38,8 +39,8 @@ import btn1 from '@/layout/btn-1.vue';
 import search1 from './parts/search-1.vue';
 import form1 from './parts/form-1.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-// const { mapActions } = createNamespacedHelpers('role');
-// const { mapActions: menu } = createNamespacedHelpers('menus');
+const { mapActions } = createNamespacedHelpers('role');
+const { mapActions: menu } = createNamespacedHelpers('menus');
 // const { mapActions: sysdictdata } = createNamespacedHelpers('dictData');
 export default {
   name: 'index',
@@ -53,11 +54,11 @@ export default {
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
       ],
       fields: [
-        { label: '角色名称', prop: 'name' },
-        { label: '角色代码', prop: 'code' },
+        { label: '角色名称', model: 'name' },
+        { label: '角色代码', model: 'code' },
         {
           label: '角色状态',
-          prop: 'status',
+          model: 'status',
           format: (i) => (i === '0' ? '使用' : '停用'),
         },
       ],
@@ -82,17 +83,18 @@ export default {
     await this.search();
   },
   methods: {
-    // ...menu({ menuQuery: 'query' }),
+    ...menu({ menuQuery: 'query' }),
     // ...sysdictdata({ sQuery: 'query' }),
-    // ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
     async search({ skip = 0, limit = 10, ...info } = {}) {
       const condition = _.cloneDeep(this.searchForm);
-      // let res = await this.query({ skip, limit, ...condition, ...info });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      //   this.$set(this, `total`, res.total);
-      // }
+      let res = await this.query({ skip, limit, ...condition, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+      console.log(this.list);
     },
     // 新增
     toAdd() {
@@ -143,11 +145,11 @@ export default {
     },
     // 查询其他信息
     async searchOther() {
-      // let res = await this.menuQuery({ status: '0' });
-      // if (this.$checkRes(res)) {
-      //   let data = res.data;
-      //   this.$set(this, `menuList`, res.data);
-      // }
+      let res = await this.menuQuery({ status: '0' });
+      if (this.$checkRes(res)) {
+        let data = res.data;
+        this.$set(this, `menuList`, res.data);
+      }
     },
   },
   computed: {