wuhongyuq 5 years ago
parent
commit
40654cfd94

+ 1 - 1
src/layout/government/messageInfo.vue

@@ -14,7 +14,7 @@
           <template>
             <el-table :data="message" style="width: 100%">
               <el-table-column prop="title" label="标题" align="center"> </el-table-column>
-              <el-table-column prop="column_name" label="所属栏目" align="center"> </el-table-column>
+              <el-table-column prop=" column_name" label="所属栏目" align="center"> </el-table-column>
               <!-- <el-table-column prop="state" label="状态" align="center"> </el-table-column> -->
               <el-table-column label="操作" align="center">
                 <template slot-scope="scope">

+ 12 - 0
src/layout/personnel/informateDetail.vue

@@ -27,6 +27,9 @@
                 <el-option label="学习实践" value="xxsj"></el-option>
                 <el-option label="勤工俭学" value="qgjx"></el-option>
                 <el-option label="工作顾问" value="gzgw"></el-option>
+            <el-form-item label="所属栏目" placeholder="请选择所属栏目">
+              <el-select v-model="form.column_id" filterable @change="selectChild">
+                <el-option v-for="(item, index) in columnList" :key="index" :value="item.id" :label="item.name"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="信息类型">
@@ -62,6 +65,7 @@ export default {
   name: 'recruitDetail',
   props: {
     form: null,
+    columnList: null,
     loading: null,
   },
   components: {
@@ -101,6 +105,14 @@ export default {
     returnBtn() {
       this.$router.push({ path: '/personnel/informate' });
     },
+    selectChild(column_id) {
+      let res = this.columnList.filter(fil => fil.id === column_id);
+      if (res.length > 0) {
+        console.log(res[0].name);
+        this.$set(this.form, `column_name`, res[0].name);
+      }
+      this.$forceUpdate();
+    },
     // async otherList(type) {
     //   console.log(type);
     //   let result = await this.dicOperation('xl');

+ 7 - 3
src/views/personnel/informate.vue

@@ -16,6 +16,7 @@ import topInfo from '@/layout/public/top.vue';
 import informateInfo from '@/layout/personnel/informate.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapColumn } = createNamespacedHelpers('talentInformation');
+const { mapActions: mapTalentColumn } = createNamespacedHelpers('talentColumn');
 export default {
   name: 'informate',
   props: {},
@@ -34,12 +35,15 @@ export default {
   computed: {},
   methods: {
     ...mapColumn(['query', 'delete', 'fetch']),
+    ...mapTalentColumn({ columnDetail: 'fetch' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ skip, limit, ...info });
-      if (this.$checkRes(res)) {
-        this.$set(this, `informateInfo`, res.data);
-        this.$set(this, `total`, res.total);
+      for (const val of res.data) {
+        const result = await this.columnDetail(val.column_id);
+        val.column_name = result.data.name;
       }
+      this.$set(this, `informateInfo`, res.data);
+      this.$set(this, `total`, res.total);
     },
     async deleteData(item) {
       const res = await this.delete(item.id);

+ 12 - 1
src/views/personnel/informateDetail.vue

@@ -5,7 +5,7 @@
         <topInfo :topTitle="topTitle"></topInfo>
       </el-col>
       <el-col :span="24" class="main">
-        <column :form="form" @submitDate="onSubmit" :loading="loading"></column>
+        <column :form="form" :columnList="columnList" @submitDate="onSubmit" :loading="loading"></column>
       </el-col>
     </el-row>
   </div>
@@ -16,6 +16,7 @@ import topInfo from '@/layout/public/top.vue';
 import column from '@/layout/personnel/informateDetail.vue';
 import { createNamespacedHelpers, mapGetters } from 'vuex';
 const { mapActions: mapTalentRecruitment } = createNamespacedHelpers('talentInformation');
+const { mapActions: mapColumn } = createNamespacedHelpers('talentColumn');
 export default {
   name: 'informateDetail',
   props: {},
@@ -26,10 +27,12 @@ export default {
   data: () => ({
     topTitle: '添加基本信息',
     form: {},
+    columnList: [],
     loading: true,
   }),
   created() {
     this.search();
+    this.searchColumn();
   },
   computed: {
     id() {
@@ -43,6 +46,7 @@ export default {
   },
   methods: {
     ...mapTalentRecruitment(['fetch', 'create', 'update']),
+    ...mapColumn({ queryList: 'query' }),
     async search() {
       this.loading = false;
       if (this.$route.query.id) {
@@ -65,6 +69,13 @@ export default {
       }
       if (this.$checkRes(res, msg)) this.$router.push({ path: '/personnel/informate' });
     },
+    async searchColumn({ ...info } = {}) {
+      const res = await this.queryList({ ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `columnList`, res.data);
+        console.log(res.data);
+      }
+    },
   },
 };
 </script>