|
@@ -20,10 +20,22 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-dialog title="专家信息管理" :close-on-click-modal="false" width="40%" :visible.sync="dialog" @closed="handleClose" :destroy-on-close="true">
|
|
|
+ <el-form :inline="true">
|
|
|
+ <el-form-item label="专家领域">
|
|
|
+ <el-select v-model="filters.expertise" placeholder="请选择专家的领域以便找到专家" filterable style="width:250px ;">
|
|
|
+ <el-option v-for="(i, index) in fieldsList" :key="`expertise${index}`" :label="i" :value="i"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="专家工作单位">
|
|
|
+ <el-select v-model="filters.company" placeholder="请选择专家的单位以便找到专家" filterable style="width:250px ;">
|
|
|
+ <el-option v-for="(i, index) in companyList" :key="`company${index}`" :label="i" :value="i"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<data-form :data="form" :fields="formfields" :rules="rules" @save="toSave" @filterReturn="expertSelect">
|
|
|
<template #options="{item}">
|
|
|
<template v-if="item.model === 'expert_user_id'">
|
|
|
- <el-option v-for="(i, index) in expertList" :key="`expert${index}`" :label="i.name" :value="i.user_id"></el-option>
|
|
|
+ <el-option v-for="(i, index) in getExpert()" :key="`expert${index}`" :label="`${i.name}`" :value="i.user_id"></el-option>
|
|
|
</template>
|
|
|
</template>
|
|
|
</data-form>
|
|
@@ -35,7 +47,6 @@
|
|
|
import dataTable from '@common/src/components/frame/filter-page-table.vue';
|
|
|
import dataForm from '@common/src/components/frame/form.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-const { mapActions: expert } = createNamespacedHelpers('expert');
|
|
|
const { mapActions: achieveExpert } = createNamespacedHelpers('achieveExpert');
|
|
|
export default {
|
|
|
name: 'index',
|
|
@@ -49,16 +60,16 @@ export default {
|
|
|
method: 'edit',
|
|
|
display: i => i.status === '0',
|
|
|
},
|
|
|
- {
|
|
|
- label: '冻结',
|
|
|
- method: 'delete',
|
|
|
- display: i => i.status === '0',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '解冻',
|
|
|
- method: 'restore',
|
|
|
- display: i => i.status === '1',
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // label: '冻结',
|
|
|
+ // method: 'delete',
|
|
|
+ // display: i => i.status === '0',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '解冻',
|
|
|
+ // method: 'restore',
|
|
|
+ // display: i => i.status === '1',
|
|
|
+ // },
|
|
|
],
|
|
|
fields: [
|
|
|
{ label: '评价专家组职务', prop: 'group_zw' },
|
|
@@ -91,6 +102,10 @@ export default {
|
|
|
// 评分详情
|
|
|
info: {},
|
|
|
expertList: [],
|
|
|
+ // 专家条件查询
|
|
|
+ fieldsList: [],
|
|
|
+ companyList: [],
|
|
|
+ filters: {},
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -98,11 +113,10 @@ export default {
|
|
|
this.toGetExpert();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...achieveExpert(['query', 'create', 'update', 'delete', 'restore']),
|
|
|
- ...expert({ getExpert: 'query' }),
|
|
|
+ ...achieveExpert(['query', 'create', 'update', 'delete', 'restore', 'getExpertList']),
|
|
|
// 查询列表
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- const res = await this.query({ skip, limit, ...info });
|
|
|
+ const res = await this.query({ skip, limit, ...info, status: '0' });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
@@ -118,6 +132,7 @@ export default {
|
|
|
let method = _.get(duplicate, '_id') ? 'update' : 'create';
|
|
|
let res = await this[method](duplicate);
|
|
|
if (this.$checkRes(res, '专家保存成功', res.errmsg || '专家保存失败')) this.handleClose();
|
|
|
+ this.toGetExpert();
|
|
|
},
|
|
|
// 修改
|
|
|
toEdit({ data }) {
|
|
@@ -158,8 +173,27 @@ export default {
|
|
|
},
|
|
|
// 获取专家列表
|
|
|
async toGetExpert() {
|
|
|
- const res = await this.getExpert();
|
|
|
- if (this.$checkRes(res)) this.$set(this, 'expertList', res.data);
|
|
|
+ const res = await this.getExpertList();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, 'expertList', res.data);
|
|
|
+ // 将专业领域和工作单位过滤出来
|
|
|
+ const expertise = _.uniq(res.data.map(i => i.expertise));
|
|
|
+ const company = _.uniq(res.data.map(i => i.company));
|
|
|
+ this.$set(this, `fieldsList`, expertise);
|
|
|
+ this.$set(this, `companyList`, company);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getExpert() {
|
|
|
+ let arr = _.cloneDeep(this.expertList);
|
|
|
+ if (!this.form._id) {
|
|
|
+ arr = arr.filter(f => !f.cant_use);
|
|
|
+ } else {
|
|
|
+ arr = arr.filter(f => !f.cant_use || f.user_id === this.form.expert_user_id);
|
|
|
+ }
|
|
|
+ const keys = Object.keys(this.filters);
|
|
|
+ if (keys.length == 0) return arr;
|
|
|
+ arr = this.expertList.filter(f => keys.every(key => this.filters[key] === f[key]));
|
|
|
+ return arr;
|
|
|
},
|
|
|
},
|
|
|
computed: {
|