Browse Source

其他用户表增加字段

reloaded 5 years ago
parent
commit
8719d41f50
2 changed files with 23 additions and 1 deletions
  1. 6 0
      src/layout/otheruser/otheruserForm.vue
  2. 17 1
      src/views/otheruser/detail.vue

+ 6 - 0
src/layout/otheruser/otheruserForm.vue

@@ -16,6 +16,11 @@
               <el-option label="政府用户" value="2"></el-option>
             </el-select>
           </el-form-item>
+          <el-form-item label="用户角色" prop="characterid">
+            <el-select v-model="ruleForm.characterid" placeholder="请选择用户角色">
+              <el-option v-for="(item, index) in charList" :key="index" :label="item.name" :value="item.id"></el-option>
+            </el-select>
+          </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>
@@ -31,6 +36,7 @@ export default {
   name: 'otheruserForm',
   props: {
     ruleForm: null,
+    charList: null,
   },
   components: {},
   data: () => ({

+ 17 - 1
src/views/otheruser/detail.vue

@@ -10,7 +10,7 @@
             <detailTop @goBack="goBack"></detailTop>
           </el-col>
           <el-col :span="24" class="info">
-            <otheruserForm :ruleForm="ruleForm" @submitForm="submitForm" @resetForm="resetForm"></otheruserForm>
+            <otheruserForm :ruleForm="ruleForm" :charList="charList" @submitForm="submitForm" @resetForm="resetForm"></otheruserForm>
           </el-col>
         </el-col>
       </el-col>
@@ -24,6 +24,7 @@ import detailTop from '@/layout/common/detailTop.vue';
 import otheruserForm from '@/layout/otheruser/otheruserForm.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: otheruser } = createNamespacedHelpers('otheruser');
+const { mapActions: character } = createNamespacedHelpers('character');
 export default {
   name: 'detail',
   props: {},
@@ -37,10 +38,15 @@ export default {
     topTitle: '用户信息管理',
     ruleForm: {
       passwd: '123456',
+      characterid: '',
+    },
+    charList: {
+      name: '10',
     },
   }),
   created() {
     this.searchInfo();
+    this.searchChar();
   },
   computed: {
     id() {
@@ -49,12 +55,22 @@ export default {
   },
   methods: {
     ...otheruser(['query', 'fetch', 'update', 'create']),
+    ...character({ charquery: 'query', charFetch: 'fetch' }),
     async searchInfo() {
       if (this.id) {
         const res = await this.fetch(this.id);
         this.$set(this, `ruleForm`, res.data);
       }
     },
+    async searchChar() {
+      const res = await this.charquery();
+      if (`${res.errcode}` === '0') {
+        console.log(res.data);
+        this.$set(this, `charList`, res.data);
+      } else {
+        this.$message.error(result.errmsg ? result.errmsg : 'error');
+      }
+    },
     // 提交
     async submitForm({ data }) {
       let res;