Explorar el Código

Merge branch 'master' of http://git.cc-lotus.info/financial_platform/admin-cms

wuhongyuq hace 5 años
padre
commit
6fd215eb7a

+ 1 - 0
src/layout/layout-part/menus.vue

@@ -51,6 +51,7 @@
       <el-menu-item index="/companyup/index"> <i class="el-icon-s-grid"></i>企业信息管理</el-menu-item>
       <el-menu-item index="/companyidentify/index"> <i class="el-icon-s-grid"></i>企业认证管理</el-menu-item>
       <el-menu-item index="/character/index"> <i class="el-icon-s-grid"></i>角色管理</el-menu-item>
+      <el-menu-item index="/region/index"> <i class="el-icon-s-grid"></i>地区管理</el-menu-item>
     </el-menu>
   </div>
 </template>

+ 55 - 0
src/layout/region/regionForm.vue

@@ -0,0 +1,55 @@
+<template>
+  <div id="characterForm">
+    <el-row>
+      <el-col :span="24" class="form">
+        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
+          <el-form-item label="地区名称" prop="name">
+            <el-input v-model="ruleForm.name" placeholder="请输入地区名称"></el-input>
+          </el-form-item>
+          <el-form-item label="路径" prop="url">
+            <el-input v-model="ruleForm.url" placeholder="请输入路径"></el-input>
+          </el-form-item>
+          <el-form-item label="排序" prop="order">
+            <el-input v-model="ruleForm.order" placeholder="请输入排序"></el-input>
+          </el-form-item>
+          <el-form-item>
+            <el-button size="small" @click="resetForm('ruleForm')">取消</el-button>
+            <el-button type="primary" size="small" @click="submitForm('ruleForm')">提交</el-button>
+          </el-form-item>
+        </el-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'characterForm',
+  props: {
+    ruleForm: null,
+    rolesList: null,
+  },
+  components: {},
+  data: () => ({
+    rules: {
+      name: [{ required: true, message: '请输入地区名称', trigger: 'blur' }],
+    },
+  }),
+  created() {},
+  computed: {},
+  methods: {
+    submitForm() {
+      this.$emit('submitForm', { data: this.ruleForm });
+    },
+    resetForm() {
+      this.$emit('resetForm');
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.form {
+  padding: 0 200px 0 0;
+}
+</style>

+ 39 - 0
src/layout/region/regionList.vue

@@ -0,0 +1,39 @@
+<template>
+  <div id="regionList">
+    <el-row>
+      <el-col :span="24">
+        <el-table ref="debtTable" :data="debtTable" style="width: 100%" border>
+          <el-table-column type="index" label="序号" width="50" align="center"> </el-table-column>
+          <el-table-column property="name" label="地区名称" align="center"> </el-table-column>
+          <el-table-column property="order" label="排序" align="center"> </el-table-column>
+          <el-table-column fixed="right" label="操作" align="center">
+            <template slot-scope="scope">
+              <el-button @click="$router.push({ path: '/region/detail', query: { id: scope.row.id } })" type="text"><i class="el-icon-edit"></i></el-button>
+              <el-button @click.prevent="deleteRow(scope.row.id)" type="text"><i class="el-icon-delete"></i></el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'regionList',
+  props: {
+    debtTable: null,
+  },
+  components: {},
+  data: () => ({}),
+  created() {},
+  computed: {},
+  methods: {
+    deleteRow(id) {
+      this.$emit('deleteRow', id);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 10 - 0
src/router/index.js

@@ -98,6 +98,16 @@ const routes = [
     path: '/character/detail',
     component: () => import('../views/character/detail.vue'),
   },
+  // 地区管理-列表
+  {
+    path: '/region/index',
+    component: () => import('../views/region/index.vue'),
+  },
+  // 地区管理-详情
+  {
+    path: '/region/detail',
+    component: () => import('../views/region/detail.vue'),
+  },
 ];
 
 const router = new VueRouter({

+ 2 - 1
src/store/index.js

@@ -7,8 +7,8 @@ import companyuser from './companyuser';
 import institution from './institution';
 import character from './character';
 import menurole from './menurole';
+import region from './region';
 import profession from './profession';
-;
 
 Vue.use(Vuex);
 
@@ -21,6 +21,7 @@ export default new Vuex.Store({
     institution,
     character,
     menurole,
+    region,
     profession,
   },
   state: {},

+ 38 - 0
src/store/region.js

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

+ 115 - 0
src/views/region/detail.vue

@@ -0,0 +1,115 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="debt">
+        <el-col :span="24" class="top">
+          <topInfo :topTitle="topTitle" :display="display"></topInfo>
+        </el-col>
+        <el-col :span="24" class="main">
+          <el-col :span="24" class="back">
+            <detailTop @goBack="goBack"></detailTop>
+          </el-col>
+          <el-col :span="24" class="info">
+            <regionForm :ruleForm="ruleForm" :rolesList="rolesList" @submitForm="submitForm" @resetForm="resetForm"></regionForm>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import topInfo from '@/layout/common/topInfo.vue';
+import detailTop from '@/layout/common/detailTop.vue';
+import regionForm from '@/layout/region/regionForm.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: region } = createNamespacedHelpers('region');
+export default {
+  name: 'detail',
+  props: {},
+  components: {
+    topInfo, //头部导航
+    detailTop, //头部返回
+    regionForm, //添加其他用户
+  },
+  data: () => ({
+    display: 'none',
+    topTitle: '用户信息管理',
+    ruleForm: {
+      passwd: '123456',
+      roles: [],
+    },
+  }),
+  created() {
+    this.searchInfo();
+    this.searchRole();
+  },
+  computed: {
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  methods: {
+    ...region(['query', 'fetch', 'update', 'create']),
+    async searchInfo() {
+      if (this.id) {
+        const res = await this.fetch(this.id);
+        if (`${res.errcode}` === '0') {
+          this.$set(this, `ruleForm`, res.data);
+        } else {
+          this.$message.error(result.errmsg ? result.errmsg : 'error');
+        }
+      }
+    },
+    // 提交
+    async submitForm({ data }) {
+      let res;
+      if (this.id) {
+        res = await this.update(data);
+        if (res.errcode === 0) {
+          this.$message({
+            message: '信息修改成功',
+            type: 'success',
+          });
+        }
+      } else {
+        res = await this.create(data);
+        if (res.errcode === 0) {
+          this.$message({
+            message: '信息创建成功',
+            type: 'success',
+          });
+        }
+      }
+      if (this.$checkRes(res)) this.resetForm();
+
+      console.log(res.data);
+    },
+    // 取消
+    resetForm() {
+      this.$router.push({ path: '/region/index' });
+    },
+    // 返回
+    goBack() {
+      this.$router.go(-1);
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.debt {
+  padding: 20px;
+}
+.top {
+  border-bottom: 1px solid #ccc;
+}
+.main {
+  border-radius: 10px;
+  margin: 20px 0 0 0;
+  box-shadow: 0 0 3px #666;
+}
+.main .back {
+  padding: 10px 0 10px 15px;
+}
+</style>

+ 68 - 0
src/views/region/index.vue

@@ -0,0 +1,68 @@
+<template>
+  <div id="index">
+    <el-col :span="24" class="debt">
+      <el-col :span="24" class="top">
+        <topInfo :topTitle="topTitle" :display="display" @clickBtn="clickBtn"></topInfo>
+      </el-col>
+      <el-col :span="24" class="search">
+        <searchInfo></searchInfo>
+      </el-col>
+      <el-col :span="24" class="main">
+        <regionList :debtTable="debtTable" @deleteRow="deleteRow"></regionList>
+      </el-col>
+    </el-col>
+  </div>
+</template>
+
+<script>
+import topInfo from '@/layout/common/topInfo.vue';
+import searchInfo from '@/layout/common/searchInfo.vue';
+import regionList from '@/layout/region/regionList.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: region } = createNamespacedHelpers('region');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    topInfo, //头部导航
+    searchInfo, //搜素
+    regionList, //角色列表
+  },
+  data: () => ({
+    topTitle: '角色管理',
+    display: 'block',
+    debtTable: [],
+  }),
+  created() {
+    this.searchInfo();
+  },
+  computed: {},
+  methods: {
+    ...region(['query', 'delete']),
+
+    async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      this.$set(this, `debtTable`, res.data);
+    },
+    // 添加
+    clickBtn() {
+      this.$router.push({ path: '/region/detail' });
+    },
+    // 删除
+    async deleteRow(id) {
+      const res = await this.delete(id);
+      this.$checkRes(res, '删除成功', '删除失败');
+      this.searchInfo();
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.debt {
+  padding: 20px;
+}
+.top {
+  border-bottom: 1px solid #ccc;
+}
+</style>