|
@@ -12,7 +12,13 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-dialog title="专家信息管理" width="40%" :visible.sync="dialog" @closed="handleClose" :destroy-on-close="true">
|
|
|
- <data-form :data="form" :fields="formfields" :rules="rules" @save="toSave"> </data-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>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
</el-dialog>
|
|
|
<el-dialog title="评分详情" width="40%" :visible.sync="scoreDialog" @closed="handleClose" :destroy-on-close="true">
|
|
|
<scoreInfo :form="info"></scoreInfo>
|
|
@@ -21,10 +27,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+const _ = require('lodash');
|
|
|
import scoreInfo from './parts/scoreInfo.vue';
|
|
|
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 {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
@@ -42,66 +51,57 @@ export default {
|
|
|
{
|
|
|
label: '编辑',
|
|
|
method: 'edit',
|
|
|
+ display: i => !_.isObject(i.verify),
|
|
|
},
|
|
|
{
|
|
|
label: '删除',
|
|
|
method: 'delete',
|
|
|
+ display: i => !_.isObject(i.verify),
|
|
|
},
|
|
|
{
|
|
|
label: '评分详情',
|
|
|
method: 'view',
|
|
|
- // 只有专家已评分,才可看评分相亲
|
|
|
- display: item => {
|
|
|
- return item.status == '1' ? true : false;
|
|
|
- },
|
|
|
+ display: i => _.isObject(i.verify),
|
|
|
},
|
|
|
],
|
|
|
fields: [
|
|
|
- { label: '专家姓名', prop: 'name', filter: 'input', showTip: true },
|
|
|
+ { label: '专家姓名', prop: 'expert_name', filter: 'input', showTip: true },
|
|
|
{ label: '联系电话', prop: 'phone', showTip: true },
|
|
|
- { label: '登录密码', prop: 'password', showTip: true },
|
|
|
- { label: '评分', prop: 'score', showTip: true },
|
|
|
- { label: '状态', prop: 'status' },
|
|
|
- ],
|
|
|
- list: [
|
|
|
- {
|
|
|
- name: '专家姓名',
|
|
|
- phone: '17319450324',
|
|
|
- password: '123456',
|
|
|
- score: '10',
|
|
|
- content: '评分详情',
|
|
|
- status: '0',
|
|
|
- },
|
|
|
- {
|
|
|
- name: '专家姓名',
|
|
|
- phone: '17319450324',
|
|
|
- password: '123456',
|
|
|
- score: '10',
|
|
|
- content: '评分详情',
|
|
|
- status: '1',
|
|
|
- },
|
|
|
+ { label: '评分', prop: 'verify.score', showTip: true },
|
|
|
+ { label: '状态', prop: 'verify', format: i => (_.isObject(i) ? '已评分' : '未评分') },
|
|
|
],
|
|
|
+ list: [],
|
|
|
total: 0,
|
|
|
// 创建专家账号
|
|
|
dialog: false,
|
|
|
form: {},
|
|
|
rules: {},
|
|
|
formfields: [
|
|
|
- { label: '姓名', model: 'name' },
|
|
|
+ { label: '专家', model: 'expert_user_id', type: 'select', filterReturn: true },
|
|
|
{ label: '联系电话', model: 'phone' },
|
|
|
{ label: '登录密码', model: 'password', type: 'password' },
|
|
|
],
|
|
|
// 评分详情
|
|
|
scoreDialog: false,
|
|
|
info: {},
|
|
|
+ expertList: [],
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
|
await this.search();
|
|
|
+ this.toGetExpert();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...achieveExpert(['query', 'create', 'update', 'delete']),
|
|
|
+ ...expert({ getExpert: 'query' }),
|
|
|
// 查询列表
|
|
|
- async search({ skip = 0, limit = 10, ...info } = {}) {},
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ const res = await this.query({ skip, limit, ...info, apply_id: this.id });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 专家评分查看
|
|
|
toView({ data }) {
|
|
|
this.$set(this, `info`, data);
|
|
@@ -112,19 +112,24 @@ export default {
|
|
|
this.dialog = true;
|
|
|
},
|
|
|
// 提交
|
|
|
- toSave({ data }) {
|
|
|
- console.log(data);
|
|
|
- this.handleClose();
|
|
|
+ async toSave({ data }) {
|
|
|
+ const duplicate = _.cloneDeep(data);
|
|
|
+ duplicate.apply_id = this.id;
|
|
|
+ let method = _.get(duplicate, '_id') ? 'update' : 'create';
|
|
|
+ let res = await this[method](duplicate);
|
|
|
+ if (this.$checkRes(res, '专家保存成功', res.errmsg || '专家保存失败')) this.handleClose();
|
|
|
},
|
|
|
// 修改
|
|
|
toEdit({ data }) {
|
|
|
- console.log(data);
|
|
|
+ this.$set(this, 'form', _.cloneDeep(data));
|
|
|
this.dialog = true;
|
|
|
},
|
|
|
// 删除
|
|
|
- toDelete({ data }) {
|
|
|
- console.log(data);
|
|
|
- this.search();
|
|
|
+ async toDelete({ data }) {
|
|
|
+ const res = await this.delete(data._id);
|
|
|
+ if (this.$checkRes(res, '删除成功', res.errmsg || '删除失败')) {
|
|
|
+ this.search();
|
|
|
+ }
|
|
|
},
|
|
|
// 取消
|
|
|
handleClose() {
|
|
@@ -136,9 +141,28 @@ export default {
|
|
|
back() {
|
|
|
this.$router.push({ path: '/adminScore' });
|
|
|
},
|
|
|
+ // 选择专家,返回电话
|
|
|
+ expertSelect({ data, model }) {
|
|
|
+ if (model === 'expert_user_id') {
|
|
|
+ const res = this.expertList.find(f => f.user_id === data);
|
|
|
+ if (res) {
|
|
|
+ const { phone, name } = res;
|
|
|
+ this.$set(this.form, 'phone', phone);
|
|
|
+ this.$set(this.form, 'expert_name', name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取专家列表
|
|
|
+ async toGetExpert() {
|
|
|
+ const res = await this.getExpert();
|
|
|
+ if (this.$checkRes(res)) this.$set(this, 'expertList', res.data);
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
},
|
|
|
watch: {},
|
|
|
};
|