wuhongyuq há 5 anos atrás
pai
commit
19a1a05458

+ 51 - 0
src/layout/lanmu/lanmu.vue

@@ -0,0 +1,51 @@
+<template>
+  <div id="columnDetail">
+    <el-row>
+      <el-col :span="24">
+        <el-col :span="24" class="top"> </el-col>
+        <el-col :span="24" class="messgae">
+          <el-form ref="form" :model="form" label-width="80px">
+            <el-form-item label="栏目名称">
+              <el-input v-model="form.name"></el-input>
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" @click="onSubmit()">提交</el-button>
+            </el-form-item>
+          </el-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'columnDetail',
+  props: {
+    form: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {
+    onSubmit() {
+      this.$emit('submitDate', { data: this.form });
+    },
+    returnBtn() {},
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.top {
+  padding: 15px 0;
+}
+.top .topTitle {
+  text-align: left;
+}
+.top .topBtn {
+  text-align: right;
+  padding: 0 5px;
+}
+</style>

+ 38 - 20
src/layout/layout-part/newmenu.vue

@@ -23,7 +23,8 @@
 <script>
 import { system, personnel, government, record, serve, enterprise, duijiehui, site, user, links, permission, dictionary } from '@/util/role_menu.js';
 import * as menus from '@/util/role_menu.js';
-import { mapState } from 'vuex';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('marketcolumn');
 import _ from 'lodash';
 export default {
   name: 'sideMenu',
@@ -34,36 +35,53 @@ export default {
     };
   },
   computed: {
-    ...mapState({
-      menuList: state => state.publics.menuList,
-    }),
+    ...mapState(['user']),
   },
   created() {
     this.serrch();
     if (this.menu.length === 0) this.getMenuList();
   },
   methods: {
+    ...mapActions(['fetch', 'create', 'update', 'query']),
+    async serrch() {
+      const res = await this.query();
+      for (const val of this.user.columnid) {
+        var result = res.data.filter(item => item.id == val);
+        for (const acc of result) {
+          if (acc.name == system.name) {
+            this.menu.push(system);
+          } else if (acc.name == personnel.name) {
+            this.menu.push(personnel);
+          } else if (acc.name == government.name) {
+            this.menu.push(government);
+          } else if (acc.name == record.name) {
+            this.menu.push(record);
+          } else if (acc.name == serve.name) {
+            this.menu.push(serve);
+          } else if (acc.name == enterprise.name) {
+            this.menu.push(enterprise);
+          } else if (acc.name == site.name) {
+            this.menu.push(site);
+          } else if (acc.name == user.name) {
+            this.menu.push(user);
+          } else if (acc.name == links.name) {
+            this.menu.push(links);
+          } else if (acc.name == permission.name) {
+            this.menu.push(permission);
+          } else if (acc.name == dictionary.name) {
+            this.menu.push(dictionary);
+          }
+          console.log(this.menu);
+        }
+      }
+    },
+
     turnTo(uri) {
       this.$router.push({ path: uri });
     },
-    async serrch() {
-      this.menu.push(system);
-      this.menu.push(personnel);
-      this.menu.push(government);
-      this.menu.push(record);
-      this.menu.push(serve);
-      this.menu.push(enterprise);
-      this.menu.push(duijiehui);
-      this.menu.push(site);
-      this.menu.push(user);
-      this.menu.push(links);
-      this.menu.push(permission);
-      this.menu.push(dictionary);
 
-      this.$set(this, `menu`, this.menu);
-    },
     getMenuList() {
-      let res = _.uniqBy(this.menuList, 'menu_id');
+      let res = _.uniqBy(this.menuList, 'menuid');
       for (const item of res) {
         this.menu.push(_.get(menus, item.code));
       }

+ 7 - 18
src/layout/pesmisson/pesmissondetail.vue

@@ -4,10 +4,11 @@
       <el-col :span="24" class="linksForm">
         <el-form ref="form" :model="form" label-width="100px">
           <el-form-item label="分配权限">
-            <el-select v-model="form.value2" multiple collapse-tags style="margin-left: 20px;" placeholder="请选择">
-              <el-option v-for="item in option" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select
-            >
+            <el-select v-model="form.columnid" multiple>
+              <el-option v-for="item in option" :key="item.value" :label="item.name" :value="item.id"> </el-option>
+            </el-select>
           </el-form-item>
+
           <el-form-item>
             <el-button @click="handleCancel">返回</el-button>
             <el-button type="primary" @click="handleSave()">提交</el-button>
@@ -17,7 +18,6 @@
     </el-row>
   </div>
 </template>
-
 <script>
 import upload from '@/components/upload.vue';
 import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
@@ -27,11 +27,10 @@ export default {
   props: {
     dataList: null,
     option: null,
+    form: null,
   },
   components: {},
-  data: () => ({
-    form: {},
-  }),
+  data: () => ({}),
   created() {},
   methods: {
     async handleSave() {
@@ -49,17 +48,7 @@ export default {
       return this.$route.query.id ? false : true;
     },
   },
-  watch: {
-    isNew: {
-      handler(val) {
-        if (!val) {
-          console.log('in function:');
-          this.search();
-        }
-      },
-      immediate: true,
-    },
-  },
+  watch: {},
 };
 </script>
 

+ 5 - 0
src/router/index.js

@@ -224,6 +224,11 @@ const routes = [
     path: '/permission/detail',
     component: () => import('../views/permission/detail.vue'),
   },
+  //模块
+  {
+    path: '/lanmu/detali',
+    component: () => import('../views/lanmu/detali.vue'),
+  },
 ];
 
 const router = new VueRouter({

+ 3 - 0
src/store/index.js

@@ -27,6 +27,8 @@ import transaction from './transaction';
 import live from './live';
 import apply from './apply';
 
+import marketcolumn from './marketcolumn';
+
 import users from './user';
 import codeCategory from './code-category';
 import codeItem from './code-item';
@@ -62,6 +64,7 @@ export default new Vuex.Store({
     transaction,
     live,
     apply,
+    marketcolumn,
   },
   state: { ...ustate },
   mutations: { ...umutations },

+ 38 - 0
src/store/marketcolumn.js

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

+ 71 - 0
src/views/lanmu/detali.vue

@@ -0,0 +1,71 @@
+<template>
+  <div id="columnDetail">
+    <el-row>
+      <el-col :span="24" class="top">
+        <topInfo :topTitle="topTitle"></topInfo>
+      </el-col>
+      <el-col :span="24" class="main">
+        <lanmu :form="form" @submitDate="onSubmit"></lanmu>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import topInfo from '@/layout/public/top.vue';
+import lanmu from '@/layout/lanmu/lanmu.vue';
+import { createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('marketcolumn');
+export default {
+  name: 'columnDetail',
+  props: {},
+  components: {
+    lanmu,
+    topInfo,
+  },
+  data: () => ({
+    topTitle: '添加模块',
+    form: {},
+  }),
+  created() {
+    this.search();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+    keyWord() {
+      let meta = this.$route.meta;
+      let main = meta.title || '';
+      return main;
+    },
+  },
+  methods: {
+    ...mapActions(['fetch', 'create', 'update']),
+    async search() {
+      if (this.$route.query.id) {
+        const res = await this.fetch(this.id);
+        this.$set(this, `form`, res.data);
+      }
+    },
+    async onSubmit(form) {
+      let data = this.form;
+      console.log(data);
+      let res;
+      let msg;
+
+      res = await this.create(data);
+      msg = `${this.keyWord}添加`;
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  padding: 20px;
+  margin: 10px 20px;
+  border: 1px solid #ccc;
+  width: 96%;
+}
+</style>

+ 37 - 23
src/views/permission/detail.vue

@@ -16,6 +16,9 @@
 <script>
 import topInfo from '@/layout/public/top.vue';
 import pesmissondetail from '@/layout/pesmisson/pesmissondetail.vue';
+import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: users } = createNamespacedHelpers('users');
+const { mapActions: marketcolumn } = createNamespacedHelpers('marketcolumn');
 export default {
   name: 'detail',
   props: {},
@@ -26,31 +29,42 @@ export default {
   data: () => ({
     topTitle: '权限角色添加',
     form: {},
-    option: [
-      { value: '1', label: '首页' },
-      {
-        value: '2',
-        label: '科技人才',
-      },
-      {
-        value: '3',
-        label: '科技政务',
-      },
-      {
-        value: '4',
-        label: '科技数据',
-      },
-      {
-        value: '5',
-        label: '北京烤鸭',
-      },
-    ],
+    option: [],
   }),
-  created() {},
-  computed: {},
+  created() {
+    this.serarch();
+    this.serarchinfo();
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
   methods: {
-    handleSave({ data }) {
-      console.log(data);
+    ...users(['query', 'delete', 'update', 'fetch']),
+    ...marketcolumn({ marketcolumquery: 'query' }),
+
+    async serarch() {
+      const res = await this.marketcolumquery();
+      console.log(res.data);
+      this.$set(this, `option`, res.data);
+    },
+
+    async serarchinfo() {
+      const res = await this.fetch(this.id);
+      console.log(res.data);
+      this.$set(this, `form`, res.data);
+    },
+
+    async handleSave({ data }) {
+      const res = await this.fetch(this.id);
+      console.log();
+      let datas = res.data;
+      datas.columnid = data.columnid;
+      console.log(datas);
+      let acc = await this.update(datas);
+      this.$checkRes(res, '权限赋予成功', '审核失败');
     },
   },
 };

+ 8 - 7
src/views/permission/index.vue

@@ -21,7 +21,7 @@
 import topInfo from '@/layout/public/top.vue';
 import dataTable from '@/components/data-table.vue';
 import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
-// const { mapActions: users } = createNamespacedHelpers('users');
+const { mapActions: users } = createNamespacedHelpers('users');
 export default {
   name: 'index',
   props: {},
@@ -53,13 +53,14 @@ export default {
   },
   computed: {},
   methods: {
-    // ...users(['query', 'delete', 'update']),
+    ...users(['query', 'delete', 'update']),
     async search({ skip = 0, limit = 10, ...info } = {}) {
-      // const res = await this.query({ skip, limit, ...info });
-      // if (this.$checkRes(res)) {
-      //   this.$set(this, `list`, res.data);
-      //   this.$set(this, `total`, res.total);
-      // }
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        console.log(res.data);
+        this.$set(this, `total`, res.total);
+      }
     },
     toEdit({ data }) {
       this.$router.push({ path: './detail', query: { id: data.id } });