|
@@ -0,0 +1,88 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <data-form :fields="fields" :data="data" @save="toSave" returns="/adminCenter/expert">
|
|
|
+ <template #custom="{ item }">
|
|
|
+ <template v-if="item.model === 'img_path'">
|
|
|
+ <e-upload url="/files/cysci/expert_image/upload" :limit="1" v-model="data[item.model]"></e-upload>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+const _ = require('lodash');
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: expert } = createNamespacedHelpers('expert');
|
|
|
+export default {
|
|
|
+ name: 'expertDetail',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ data: {
|
|
|
+ img_path: [],
|
|
|
+ },
|
|
|
+ fields: [
|
|
|
+ { label: '姓名', model: 'name' },
|
|
|
+ { label: '电话号码', model: 'phone', options: { maxLength: 11 } },
|
|
|
+ { label: '地址', model: 'addr' },
|
|
|
+ { label: '办公电话', model: 'office_phone' },
|
|
|
+ { label: '所属行业', model: 'profession' },
|
|
|
+ { label: '最高学历', model: 'education' },
|
|
|
+ { label: '毕业院校', model: 'school' },
|
|
|
+ { label: '出生日期', model: 'birthDate', type: 'date' },
|
|
|
+ { label: 'qq&微信', model: 'qqwx' },
|
|
|
+ { label: '邮箱', model: 'email' },
|
|
|
+ { label: '单位名称', model: 'company' },
|
|
|
+ { label: '职务职称', model: 'zwzc' },
|
|
|
+ { label: '擅长领域', model: 'expertise' },
|
|
|
+ { label: '头像图片', model: 'img_path', custom: true },
|
|
|
+ { label: '工作经历', model: 'workexperience', type: 'textarea', options: { maxRows: 5, minRows: 3 } },
|
|
|
+ { label: '科研综述', model: 'scientific', type: 'textarea', options: { maxRows: 5, minRows: 3 } },
|
|
|
+ { label: '承担项目', model: 'undertakingproject' },
|
|
|
+ { label: '科技奖励', model: 'scienceaward' },
|
|
|
+ { label: '社会任职', model: 'social' },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ if (this.id) this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...expert(['fetch', 'create', 'update']),
|
|
|
+ async search() {
|
|
|
+ const res = await this.fetch(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `data`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toSave({ data }) {
|
|
|
+ let dup = _.cloneDeep(data);
|
|
|
+ let res;
|
|
|
+ if (_.get(dup, 'id')) {
|
|
|
+ res = await this.update(dup);
|
|
|
+ } else {
|
|
|
+ res = await this.create(dup);
|
|
|
+ }
|
|
|
+ if (this.$checkRes(res, '保存成功', '保存失败')) {
|
|
|
+ if (!this.$dev_mode) this.$router.push('/adminCenter/expert');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user', 'menuParams']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|