Browse Source

Merge branch 'master' of http://git.cc-lotus.info/count/webnew-count

reloaded 5 years ago
parent
commit
26a0e51fdc

+ 1 - 1
src/layout/common/menus.vue

@@ -4,7 +4,7 @@
       <el-col :span="24">
         <el-menu :default-active="$route.path" router class="el-menu-demo" mode="horizontal">
           <el-menu-item index="/news/index">新闻动态</el-menu-item>
-          <el-menu-item index="/achievement/index?col_name=平台建设">成果展示</el-menu-item>
+          <el-menu-item index="/achievement/index?col_name=平台建设&&display=0">成果展示</el-menu-item>
           <el-menu-item index="/service/index">计算服务</el-menu-item>
           <el-menu-item index="/communication/index">交流互动</el-menu-item>
           <el-menu-item index="/partisan/index">党建学苑</el-menu-item>

+ 3 - 1
src/layout/news/infoList.vue

@@ -9,7 +9,7 @@
             <span @click="$router.push({ path: '/news/listDetail', query: { col_name: '科技资讯', display: '0' } })">MORE</span>
           </el-col>
           <el-col :span="24" class="list">
-            <el-col :span="24" class="oneList" @click.native="zixun(item.id)" v-for="(item, index) in oneList" :key="index">
+            <el-col :span="24" class="oneList" @click.native="zixun(item)" v-for="(item, index) in oneList" :key="index">
               <span></span>
               <span class="textOver">{{ item.title }}</span>
               <span>{{ item.date }}</span>
@@ -68,6 +68,8 @@ export default {
       if (item.url) {
         window.open(item.url);
       } else {
+        console.log(item);
+
         this.$router.push({ path: '/news/listDetail', query: { col_name: '工作动态', id: item.id, display: '1' } });
       }
     },

+ 41 - 0
src/store/comment.js

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

+ 2 - 0
src/store/index.js

@@ -11,6 +11,7 @@ import login from './login';
 import user from './user';
 import news from './news';
 import demand from './demand';
+import comment from './comment';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -27,5 +28,6 @@ export default new Vuex.Store({
     user,
     news,
     demand,
+    comment,
   },
 });

+ 30 - 33
src/views/communication/list.vue

@@ -33,23 +33,23 @@
                 </el-col>
                 <el-col :span="24" class="list">
                   <span v-if="columnName == '专题研讨'">
-                    <topicList :list="list" :total="total" @detailBtn="detailBtn"></topicList>
+                    <topicList :list="list" :total="total" @detailBtn="detailBtn" @query="searchinfo"></topicList>
                   </span>
 
                   <span v-else-if="columnName == '技术问答'">
-                    <technologyList :list="list" :total="total" @detailBtn="detailBtn"></technologyList>
+                    <technologyList :list="list" :total="total" @detailBtn="detailBtn" @query="searchinfo"></technologyList>
                   </span>
                   <span v-else-if="columnName == '行业研究'">
-                    <industryList :list="list" :total="total" @detailBtn="detailBtn"></industryList>
+                    <industryList :list="list" :total="total" @detailBtn="detailBtn" @query="searchinfo"></industryList>
                   </span>
                   <span v-else-if="columnName == '科技培训'">
-                    <scienceList :list="list" :total="total" @detailBtn="detailBtn"></scienceList>
+                    <scienceList :list="list" :total="total" @detailBtn="detailBtn" @query="searchinfo"></scienceList>
                   </span>
                 </el-col>
               </span>
               <span v-else>
                 <span v-if="columnName == '专题研讨'">
-                  <topicDetail :details="details"></topicDetail>
+                  <topicDetail :newsid="newsid" :details="details"></topicDetail>
                 </span>
                 <span v-else-if="columnName == '技术问答'">
                   <technologyDetail :details="details"></technologyDetail>
@@ -124,6 +124,8 @@ export default {
       ],
       // 总数
       total: 10,
+      limit: 14,
+      newsid: '',
       // 详情
       details: {
         title: '信息标题',
@@ -135,6 +137,7 @@ export default {
   },
   created() {
     this.changeColumn();
+    this.search();
   },
   methods: {
     ...news({ newsQuery: 'query', newsFetch: 'fetch' }),
@@ -144,48 +147,25 @@ export default {
         this.menuIndex = 0;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        if (this.display == '0') {
-          let name = this.columnName;
-          this.changeMenu(name);
-        } else {
-          this.detailBtn();
-        }
-
         this.$set(this, `displays`, this.display);
       } else if (this.col_name == '技术问答') {
         this.menuIndex = 1;
         this.columnName = this.col_name;
         console.log('cc');
-
         this.menuColor = 'rgb(5,73,130)';
-        if (this.display == '0') {
-          let name = this.columnName;
-          this.changeMenu(name);
-        } else {
-          this.detailBtn();
-        }
+
         this.$set(this, `displays`, this.display);
       } else if (this.col_name == '行业研究') {
         this.menuIndex = 2;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        if (this.display == '0') {
-          let name = this.columnName;
-          this.changeMenu(name);
-        } else {
-          this.detailBtn();
-        }
+
         this.$set(this, `displays`, this.display);
       } else if (this.col_name == '科技培训') {
         this.menuIndex = 3;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        if (this.display == '0') {
-          let name = this.columnName;
-          this.changeMenu(name);
-        } else {
-          this.detailBtn();
-        }
+
         this.$set(this, `displays`, this.display);
       }
     },
@@ -198,9 +178,26 @@ export default {
       this.menuColor = 'rgb(5,73,130)';
       this.$set(this, `displays`, 0);
     },
+
+    async search() {
+      let res = await this.newsQuery({ skip: 0, limit: 14, col_name: this.col_name, status: 2 });
+      if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+    },
+
+    async searchinfo(skip, limit) {
+      let res = await this.newsQuery({ skip, limit: 14, col_name: this.col_name, status: 2 });
+      if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+    },
+
     // 点击详情
-    detailBtn(id) {
-      this.$set(this, `displays`, 1);
+    detailBtn(item) {
+      console.log(item);
+      if (item.url) {
+        window.open(item.url);
+      } else {
+        this.$set(this, `displays`, 1);
+        this.$set(this, `newsid`, item.id);
+      }
     },
   },
   computed: {

+ 5 - 4
src/views/communication/parts/industryList.vue

@@ -2,13 +2,13 @@
   <div id="newsList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="detailBtn(item.id)" v-for="(item, index) in list" :key="index">
+        <el-col :span="24" class="list" @click.native="detailBtn(item)" v-for="(item, index) in list" :key="index">
           <span></span>
           <span class="textOver">{{ item.title }}</span>
           <span>{{ item.date }}</span>
         </el-col>
         <el-col :span="24" class="page">
-          <pagination :total="total"></pagination>
+          <pagination :total="total" :limit="limit" v-on="$listeners"> </pagination>
         </el-col>
       </el-col>
     </el-row>
@@ -23,6 +23,7 @@ export default {
   props: {
     list: null,
     total: null,
+    limit: null,
   },
   components: {
     pagination,
@@ -32,8 +33,8 @@ export default {
   },
   created() {},
   methods: {
-    detailBtn(id) {
-      this.$emit('detailBtn', id);
+    detailBtn(item) {
+      this.$emit('detailBtn', item);
     },
   },
   computed: {

+ 5 - 4
src/views/communication/parts/scienceList.vue

@@ -2,13 +2,13 @@
   <div id="newsList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="detailBtn(item.id)" v-for="(item, index) in list" :key="index">
+        <el-col :span="24" class="list" @click.native="detailBtn(item)" v-for="(item, index) in list" :key="index">
           <span></span>
           <span class="textOver">{{ item.title }}</span>
           <span>{{ item.date }}</span>
         </el-col>
         <el-col :span="24" class="page">
-          <pagination :total="total"></pagination>
+          <pagination :total="total" :limit="limit" v-on="$listeners"></pagination>
         </el-col>
       </el-col>
     </el-row>
@@ -23,6 +23,7 @@ export default {
   props: {
     list: null,
     total: null,
+    limit: null,
   },
   components: {
     pagination,
@@ -32,8 +33,8 @@ export default {
   },
   created() {},
   methods: {
-    detailBtn(id) {
-      this.$emit('detailBtn', id);
+    detailBtn(item) {
+      this.$emit('detailBtn', item);
     },
   },
   computed: {

+ 5 - 4
src/views/communication/parts/technologyList.vue

@@ -2,13 +2,13 @@
   <div id="newsList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="detailBtn(item.id)" v-for="(item, index) in list" :key="index">
+        <el-col :span="24" class="list" @click.native="detailBtn(item)" v-for="(item, index) in list" :key="index">
           <span></span>
           <span class="textOver">{{ item.title }}</span>
           <span>{{ item.date }}</span>
         </el-col>
         <el-col :span="24" class="page">
-          <pagination :total="total"></pagination>
+          <pagination :total="total" :limit="limit" v-on="$listeners"></pagination>
         </el-col>
       </el-col>
     </el-row>
@@ -23,6 +23,7 @@ export default {
   props: {
     list: null,
     total: null,
+    limit: null,
   },
   components: {
     pagination,
@@ -32,8 +33,8 @@ export default {
   },
   created() {},
   methods: {
-    detailBtn(id) {
-      this.$emit('detailBtn', id);
+    detailBtn(item) {
+      this.$emit('detailBtn', item);
     },
   },
   computed: {

+ 33 - 31
src/views/communication/parts/topicDetail.vue

@@ -19,14 +19,14 @@
                   <el-col :span="24" class="leftDown">
                     <el-image :src="squareImage"></el-image>
                     <el-col :span="24" class="jobname">
-                      {{ detail.uname }}
+                      {{ detail.publish_unit }}
                     </el-col>
                   </el-col>
                 </el-col>
                 <el-col :span="21" class="right">
                   <el-col :span="24" class="date">
                     <i class="el-icon-user icon"></i>
-                    <span>文章发表于{{ detail.meta | getDate }}</span>
+                    <span>文章发表于{{ detail.publish_time }}</span>
                     <span>1楼</span>
                   </el-col>
                   <el-col :span="24" class="info">
@@ -45,14 +45,14 @@
                   <el-col :span="24" class="leftDown">
                     <el-image :src="squareImage"></el-image>
                     <el-col :span="24" class="jobname">
-                      {{ item.uname }}
+                      {{ item.publish_unit }}
                     </el-col>
                   </el-col>
                 </el-col>
                 <el-col :span="21" class="right">
                   <el-col :span="24" class="date">
                     <i class="el-icon-user icon"></i>
-                    <span>评论发布于{{ item.meta | getDate }}</span>
+                    <span>评论发布于{{ publish_time }}</span>
                     <span>{{ index + 2 }}楼</span>
                   </el-col>
                   <el-col :span="24" class="info">
@@ -91,8 +91,8 @@
 import wangEditor from '@/components/wang-editor.vue';
 import page from '@/components/pagination.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
-// const { mapActions: comment } = createNamespacedHelpers('comment');
-// const { mapActions: news } = createNamespacedHelpers('news');
+const { mapActions: comment } = createNamespacedHelpers('comment');
+const { mapActions: news } = createNamespacedHelpers('news');
 export default {
   name: 'semDetail',
   props: {
@@ -110,7 +110,7 @@ export default {
   }),
   created() {
     this.search();
-    // this.searchinfo();
+    this.searchinfo();
   },
   computed: {
     id() {
@@ -125,33 +125,35 @@ export default {
     return { title: this.$route.meta.title };
   },
   methods: {
-    // ...news(['fetch']),
-    // ...comment({ commentquery: 'query', commentCreate: 'create', commentUpdate: 'update' }),
-    // async searchinfo() {
-    //   let id = this.newsid;
-    //   console.log(id);
-    //   const res = await this.fetch(id);
-    //   this.$set(this, `detail`, res.data);
-    // },
+    ...news(['fetch']),
+    ...comment({ commentquery: 'query', commentCreate: 'create', commentUpdate: 'update' }),
+    async searchinfo() {
+      if (this.id) {
+      } else {
+        let id = this.newsid;
+        const res = await this.fetch(id);
+        this.$set(this, `detail`, res.data);
+      }
+    },
     async search({ skip = 0, limit = this.limit, newsid = this.newsid } = { skip: 0, limit: this.limit }) {
-      //   let res = await this.commentquery({ skip, limit, newsid });
-      //   console.log(res);
-      //   this.$set(this, `list`, res.data);
-      //   this.$set(this, `total`, res.total);
+      let res = await this.commentquery({ skip, limit, newsid });
+      console.log(res);
+      this.$set(this, `list`, res.data);
+      this.$set(this, `total`, res.total);
     },
     async submit() {
-      //   if (!this.user.uid) {
-      //     this.$message.error('游客身份无法评论,请先登录');
-      //     return;
-      //   } else {
-      //     this.form.newsid = this.newsid;
-      //     this.form.uid = this.user.uid;
-      //     let data = this.form;
-      //     let res = await this.commentCreate(data);
-      //     console.log(res);
-      //     this.$checkRes(res, '评论成功', '评论失败');
-      //     this.search();
-      //   }
+      if (!this.user.uid) {
+        this.$message.error('游客身份无法评论,请先登录');
+        return;
+      } else {
+        this.form.newsid = this.newsid;
+        this.form.uid = this.user.uid;
+        let data = this.form;
+        let res = await this.commentCreate(data);
+        console.log(res);
+        this.$checkRes(res, '评论成功', '评论失败');
+        this.search();
+      }
     },
   },
   filters: {

+ 5 - 4
src/views/communication/parts/topicList.vue

@@ -2,13 +2,13 @@
   <div id="newsList">
     <el-row>
       <el-col :span="24" class="info">
-        <el-col :span="24" class="list" @click.native="detailBtn(item.id)" v-for="(item, index) in list" :key="index">
+        <el-col :span="24" class="list" @click.native="detailBtn(item)" v-for="(item, index) in list" :key="index">
           <span></span>
           <span class="textOver">{{ item.title }}</span>
           <span>{{ item.date }}</span>
         </el-col>
         <el-col :span="24" class="page">
-          <pagination :total="total"></pagination>
+          <pagination :total="total" :limit="limit" v-on="$listeners"></pagination>
         </el-col>
       </el-col>
     </el-row>
@@ -23,6 +23,7 @@ export default {
   props: {
     list: null,
     total: null,
+    limit: null,
   },
   components: {
     pagination,
@@ -32,8 +33,8 @@ export default {
   },
   created() {},
   methods: {
-    detailBtn(id) {
-      this.$emit('detailBtn', id);
+    detailBtn(item) {
+      this.$emit('detailBtn', item);
     },
   },
   computed: {

+ 13 - 31
src/views/news/listDetail.vue

@@ -101,6 +101,7 @@ export default {
   },
   created() {
     this.changeColumn();
+    this.newsearch();
   },
   methods: {
     ...news({ newsQuery: 'query', newsFetch: 'fetch' }),
@@ -110,55 +111,24 @@ export default {
         this.menuIndex = 0;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        let name = this.columnName;
-        if (this.display == '0') {
-          this.changeMenu(name);
-        } else {
-          console.log('sda');
 
-          this.detail();
-        }
         this.$set(this, `displays`, this.display);
       } else if (this.col_name == '技术前沿') {
         this.menuIndex = 1;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        let name = this.columnName;
-
-        if (this.display == '0') {
-          this.changeMenu(name);
-        } else {
-          console.log('sda');
-
-          this.detail();
-        }
 
         this.$set(this, `displays`, this.display);
       } else if (this.col_name == '工作动态') {
         this.menuIndex = 2;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        let name = this.columnName;
-
-        if (this.display == '0') {
-          this.changeMenu(name);
-        } else {
-          console.log('1111');
-          this.detail();
-        }
 
         this.$set(this, `displays`, this.display);
       } else if (this.col_name == '通知通告') {
         this.menuIndex = 3;
         this.columnName = this.col_name;
         this.menuColor = 'rgb(5,73,130)';
-        let name = this.columnName;
-        if (this.display == '0') {
-          this.changeMenu(name);
-        } else {
-          console.log('sda');
-          this.detail();
-        }
 
         this.$set(this, `displays`, this.display);
       }
@@ -191,6 +161,18 @@ export default {
         this.$set(this, `displays`, 1);
       }
     },
+
+    async newsearch() {
+      console.log(this.id);
+
+      if (this.id) {
+        let res = await this.newsFetch(this.id);
+        if (this.$checkRes(res)) this.$set(this, `details`, res.data);
+      } else {
+        let res = await this.newsQuery({ skip: 0, limit: 14, col_name: this.columnName, status: 2 });
+        if (this.$checkRes(res)) this.$set(this, `list`, res.data);
+      }
+    },
     async detail() {
       let res = await this.newsFetch(this.id);
       if (this.$checkRes(res)) this.$set(this, `details`, res.data);

+ 55 - 16
src/views/pcenter/parts/personnelAdmin.vue

@@ -9,9 +9,11 @@
           <el-col :span="24" class="list">
             <el-table :data="list" stripe style="width: 100%" border>
               <el-table-column prop="name" label="姓名" align="center"> </el-table-column>
+              <el-table-column prop="phone" label="手机号" align="center"> </el-table-column>
+              <el-table-column prop="birthday" label="出生日期" align="center"> </el-table-column>
               <el-table-column label="操作" align="center" width="220">
                 <template slot-scope="scope">
-                  <el-button size="mini" type="primary" v-if="scope.row.status == '0'" @click="editBtn(scope.row.id)">编辑</el-button>
+                  <el-button size="mini" type="primary" @click="editBtn(scope.row)">编辑</el-button>
                   <el-button size="mini" type="danger" @click="deleteBtn(scope.row.id)">删除</el-button>
                 </template>
               </el-table-column>
@@ -49,14 +51,20 @@
               <el-form-item label="身份证号" prop="id_number">
                 <el-input v-model="form.id_number" placeholder="请输入身份证号"></el-input>
               </el-form-item>
+              <el-form-item label="用户类别" prop="type">
+                <el-radio-group v-model="form.type">
+                  <el-radio label="0">超级管理员</el-radio>
+                  <el-radio label="1">管理员</el-radio>
+                </el-radio-group>
+              </el-form-item>
               <el-form-item label="部门" prop="dept_id">
                 <el-select v-model="form.dept_id" filterable placeholder="请选择部门" @change="selectChild">
-                  <el-option v-for="(item, index) in deptList" :key="index" :label="item.name" :value="item._id"></el-option>
+                  <el-option v-for="(item, index) in deptList" :key="index" :label="item.name" :value="item.id"></el-option>
                 </el-select>
               </el-form-item>
               <el-form-item label="职务" prop="level_id">
                 <el-select v-model="form.level_id" filterable placeholder="请选择职务">
-                  <el-option v-for="(item, index) in levelList" :key="index" :label="item.name" :value="item._id"></el-option>
+                  <el-option v-for="(item, index) in levelList" :key="index" :label="item.name" :value="item.id"></el-option>
                 </el-select>
               </el-form-item>
               <el-col :span="24" style="text-align:center;">
@@ -103,6 +111,7 @@ export default {
         id_number: [{ required: false, message: '请输入身份证号', trigger: 'blur' }],
         dept_id: [{ required: true, message: '请输入部门', trigger: 'blur' }],
         level_id: [{ required: true, message: '请输入职务', trigger: 'blur' }],
+        type: [{ required: true, message: '请选择用户类型', trigger: 'blur' }],
       },
       // 部门
       deptList: [],
@@ -117,17 +126,25 @@ export default {
     ...department({ departmentQuery: 'query', departmentFetch: 'fetch' }),
     ...level({ levelQuery: 'query', levelFetch: 'fetch' }),
     ...registers(['create']),
-    async searchInfo() {
-      let res = await this.departmentQuery();
+    ...staff({ staffQuery: 'query', staffUpdate: 'update', staffDelete: 'delete', staffFetch: 'fetch' }),
+    async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
+      let res = await this.staffQuery({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+      // 部門
+      let arr = await this.departmentQuery();
       if (this.$checkRes(res)) {
-        this.$set(this, `deptList`, res.data);
+        this.$set(this, `deptList`, arr.data);
       }
+      this.selectChild(res.data.dept_id);
     },
     // 职务
     async selectChild(dept_id) {
+      this.$set(this.form, `level_id`, undefined);
       let res = await this.levelQuery({ dept_id });
       if (this.$checkRes(res)) {
-        console.log(res.data);
         this.$set(this, `levelList`, res.data);
       }
     },
@@ -140,23 +157,45 @@ export default {
       this.display = 'list';
     },
     // 编辑
-    editBtn(id) {
+    async editBtn(data) {
+      this.$set(this, `form`, data);
       this.display = 'detail';
     },
     // 删除
-    deleteBtn(id) {
-      console.log('删除');
+    async deleteBtn(id) {
+      let res = await this.staffDelete(id);
+      if (this.$checkRes(res)) {
+        this.$message({
+          message: '删除信息成功',
+          type: 'success',
+        });
+        this.searchInfo();
+      }
     },
     // 保存
     submitForm(formName) {
       this.$refs[formName].validate(async valid => {
         if (valid) {
-          let res = await this.create(this.form);
-          if (this.$checkRes(res)) {
-            this.$message({
-              message: '恭喜你,注册成功',
-              type: 'success',
-            });
+          if (this.form.id) {
+            let res = await this.staffUpdate(this.form);
+            if (this.$checkRes(res)) {
+              this.$message({
+                message: '修改信息成功',
+                type: 'success',
+              });
+              this.display = 'list';
+              this.searchInfo();
+            }
+          } else {
+            let res = await this.create(this.form);
+            if (this.$checkRes(res)) {
+              this.$message({
+                message: '恭喜你,注册成功',
+                type: 'success',
+              });
+              this.display = 'list';
+              this.searchInfo();
+            }
           }
         } else {
           console.log('error submit!!');

+ 3 - 3
src/views/pcenter/pinfo.vue

@@ -30,12 +30,12 @@
           </el-form-item>
           <el-form-item v-if="this.user.type === '0' || this.user.type === '1'" label="部门">
             <el-select v-model="form.dept_id" filterable placeholder="请选择部门" @change="selectChild">
-              <el-option v-for="(item, index) in deptList" :key="index" :label="item.name" :value="item._id"></el-option>
+              <el-option v-for="(item, index) in deptList" :key="index" :label="item.name" :value="item.id"></el-option>
             </el-select>
           </el-form-item>
           <el-form-item v-if="this.user.type === '0' || this.user.type === '1'" label="职务">
             <el-select v-model="form.level_id" filterable placeholder="请选择职务">
-              <el-option v-for="(item, index) in levelList" :key="index" :label="item.name" :value="item._id"></el-option>
+              <el-option v-for="(item, index) in levelList" :key="index" :label="item.name" :value="item.id"></el-option>
             </el-select>
           </el-form-item>
           <el-form-item v-if="this.user.type === '2'" label="邮箱" prop="email">
@@ -160,7 +160,7 @@ export default {
     },
     // 职务
     async selectChild(dept_id) {
-      console.log(dept_id);
+      this.$set(this.form, `level_id`, undefined);
       let res = await this.levelQuery({ dept_id });
       if (this.$checkRes(res)) {
         this.$set(this, `levelList`, res.data);

+ 2 - 1
src/views/register.vue

@@ -222,7 +222,8 @@ export default {
     },
     // 职务
     async selectChild(dept_id) {
-      let res = await this.levelQuery(dept_id);
+      this.$set(this.form, `level_id`, undefined);
+      let res = await this.levelQuery({ dept_id });
       if (this.$checkRes(res)) {
         this.$set(this, `levelList`, res.data);
       }