guhongwei 4 роки тому
батько
коміт
1721d65c08
3 змінених файлів з 54 додано та 96 видалено
  1. 2 0
      src/store/index.js
  2. 39 0
      src/store/lunbo.js
  3. 13 96
      src/views/test/index.vue

+ 2 - 0
src/store/index.js

@@ -3,6 +3,7 @@ import Vuex from 'vuex';
 import * as ustate from './user/state';
 import * as umutations from './user/mutations';
 import login from './login';
+import lunbo from './lunbo';
 
 Vue.use(Vuex);
 
@@ -12,5 +13,6 @@ export default new Vuex.Store({
   actions: {},
   modules: {
     login,
+    lunbo,
   },
 });

+ 39 - 0
src/store/lunbo.js

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

+ 13 - 96
src/views/test/index.vue

@@ -1,110 +1,36 @@
 <template>
   <div id="index">
     <el-row>
-      <el-col :span="24" class="main">
-        <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
-        <el-col :span="24" class="container info">
-          <el-col :span="24" class="top">
-            <el-button type="primary" size="mini" @click="dialog = true">添加</el-button>
-          </el-col>
-          <el-col :span="24" class="list">
-            <data-table :fields="fields" :opera="opera" :data="list" :total="total" @edit="toEdit" @delete="toDelete" @query="search"></data-table>
-          </el-col>
-        </el-col>
+      <el-col :span="24">
+        <p>index</p>
       </el-col>
     </el-row>
-    <el-dialog :visible.sync="dialog" title="增加菜单" @close="toClose" :destroy-on-close="true" width="50%">
-      <data-form :data="form" :fields="formFields" :rules="rules" @save="turnSave">
-        <template #custom="{item}">
-          <template v-if="item.model == 'icon'">
-            <el-radio-group v-model="form.icon">
-              <el-radio v-for="(item, index) in iconlist" :key="index" :label="item.iconkey"><i :class="item.iconkey"></i></el-radio>
-            </el-radio-group>
-          </template>
-        </template>
-      </data-form>
-    </el-dialog>
   </div>
 </template>
 
 <script>
-import { iconmenu } from '@/util/iconmenu';
-import breadcrumb from '@c/common/breadcrumb.vue';
-import dataTable from '@/components/frame/filter-page-table.vue';
-import dataForm from '@/components/frame/form.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: lunbo } = createNamespacedHelpers('lunbo');
 export default {
   metaInfo() {
-    return { title: this.$route.meta.title };
+    return { title: this.route.meta.title };
   },
   name: 'index',
   props: {},
-  components: {
-    breadcrumb,
-    dataTable,
-    dataForm,
-  },
+  components: {},
   data: function() {
-    return {
-      opera: [
-        {
-          label: '修改',
-          icon: 'el-icon-edit',
-          method: 'edit',
-        },
-        {
-          label: '删除',
-          icon: 'el-icon-delete',
-          method: 'delete',
-        },
-      ],
-      fields: [
-        { label: '菜单名称', prop: 'title' },
-        { label: '菜单地址', prop: 'index' },
-        { label: '菜单图标', prop: 'icon' },
-      ],
-      list: [],
-      total: 0,
-      // 增加菜单
-      dialog: false,
-      formFields: [
-        { label: '菜单名称', required: true, model: 'title' },
-        { label: '菜单地址', required: true, model: 'index' },
-        { label: '菜单图标', required: true, model: 'icon', custom: true },
-      ],
-      form: {},
-      rules: {
-        title: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
-        index: [{ required: true, message: '请输入菜单地址', trigger: 'blur' }],
-        icon: [{ required: true, message: '请输入菜单图标', trigger: 'blur' }],
-      },
-      // 图标
-      iconlist: iconmenu,
-    };
+    return {};
   },
   created() {
     this.search();
   },
   methods: {
-    // 查询列表
-    search({ skip = 0, limit = 10, ...info } = {}) {},
-    // 修改
-    toEdit({ data }) {
-      console.log(data);
-    },
-    // 删除
-    toDelete({ data }) {
-      console.log(data);
-    },
-    // 增加菜单
-    // 保存
-    turnSave({ data }) {
-      console.log(data);
-    },
-    // 取消增加
-    toClose() {
-      this.form = {};
-      this.dialog = false;
+    ...lunbo(['query']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        console.log(res);
+      }
     },
   },
   computed: {
@@ -113,13 +39,4 @@ export default {
 };
 </script>
 
-<style lang="less" scoped>
-.main {
-  .info {
-    .top {
-      text-align: right;
-      margin: 15px 0;
-    }
-  }
-}
-</style>
+<style lang="less" scoped></style>