|
@@ -0,0 +1,221 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main">
|
|
|
+ <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
|
|
|
+ <el-col :span="24" class="container">
|
|
|
+ <el-col :span="24" class="add">
|
|
|
+ <el-button type="primary" size="mini" @click="back()">返回</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" v-if="loading">
|
|
|
+ <data-form :data="form" :fields="Fields" :rules="{}" @save="turnSave">
|
|
|
+ <template #options="{item}">
|
|
|
+ <template v-if="item.model == 'eduback'">
|
|
|
+ <el-option v-for="(item, index) in educationList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.model == 'nation'">
|
|
|
+ <el-option v-for="(item, index) in naticeList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.model == 'cardtype'">
|
|
|
+ <el-option label="身份证" value="身份证"></el-option>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="item.model == 'technical'">
|
|
|
+ <el-option label="初级职称" value="初级职称"></el-option>
|
|
|
+ <el-option label="中级职称" value="中级职称"></el-option>
|
|
|
+ <el-option label="高级职称" value="高级职称"></el-option>
|
|
|
+ <el-option label="其他" value="其他"></el-option>
|
|
|
+ <el-option label="无" value="无"></el-option>
|
|
|
+ </template>
|
|
|
+ <template v-if="item.model == 'degree'">
|
|
|
+ <el-option v-for="(item, index) in degreeList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ </template>
|
|
|
+ <template v-if="item.model == 'field'">
|
|
|
+ <el-option v-for="(item, index) in fieldList" :key="index" :label="item.name" :value="item.name"></el-option>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template #radios="{item}">
|
|
|
+ <template v-if="item.model === 'gender'">
|
|
|
+ <el-radio label="男">男</el-radio>
|
|
|
+ <el-radio label="女">女</el-radio>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <template #custom="{item,form}">
|
|
|
+ <template v-if="item.model == 'imgpath'">
|
|
|
+ <upload :limit="1" :data="form.imgpath" type="imgpath" :url="'/files/imgpath/upload'" @upload="uploadSuccess"></upload>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import breadcrumb from '@c/common/breadcrumb.vue';
|
|
|
+import dataForm from '@c/frame/form.vue';
|
|
|
+import upload from '@c/frame/uploadone.vue';
|
|
|
+// 获取民族
|
|
|
+import { nationList } from '@/util/nationList';
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: talentExperts } = createNamespacedHelpers('talentExperts');
|
|
|
+export default {
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+ name: 'detail',
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ breadcrumb,
|
|
|
+ dataForm,
|
|
|
+ upload,
|
|
|
+ },
|
|
|
+ data: function() {
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ Fields: [
|
|
|
+ { label: '姓名', model: 'name' },
|
|
|
+ { label: '头像', model: 'imgpath', custom: true },
|
|
|
+ { label: '性别', model: 'gender', type: 'radio' },
|
|
|
+ { label: '出生年月', model: 'birth', type: 'date' },
|
|
|
+ { label: '民族', model: 'nation', type: 'select' },
|
|
|
+ { label: '证件类型', model: 'cardtype', type: 'select' },
|
|
|
+ { label: '身份证号', model: 'cardnumber' },
|
|
|
+ { label: '职称', model: 'technical', type: 'select' },
|
|
|
+ { label: '具体职称', model: 'technical_actual' },
|
|
|
+ { label: '职务', model: 'position' },
|
|
|
+ { label: '毕业院校', model: 'school' },
|
|
|
+ { label: '学历', model: 'eduback', type: 'select' },
|
|
|
+ { label: '学位', model: 'degree', type: 'select' },
|
|
|
+ { label: '所学专业', model: 'major_studied' },
|
|
|
+ { label: '从事专业', model: 'professional' },
|
|
|
+ { label: '邮箱', model: 'email' },
|
|
|
+ { label: '办公电话', model: 'tel' },
|
|
|
+ { label: '手机号', model: 'phone' },
|
|
|
+ { label: '业务工作简介', model: 'job_profile', type: 'textarea' },
|
|
|
+ { label: '主持或参与项目情况', model: 'project_profile', type: 'textarea' },
|
|
|
+ { label: '主要学术成就及获奖情况', model: 'achievement', type: 'textarea' },
|
|
|
+ { label: '论文论著', model: 'paper', type: 'textarea' },
|
|
|
+ { label: '备注', model: 'remark', type: 'textarea' },
|
|
|
+ { label: '可咨询领域', model: 'field', type: 'select' },
|
|
|
+ { label: '领域拼音', model: 'field_py', type: 'textarea' },
|
|
|
+ ],
|
|
|
+ loading: true,
|
|
|
+ // 学历
|
|
|
+ educationList: [{ name: '中专及以上' }, { name: '大专及以上' }, { name: '本科及以上' }, { name: '研究生及以上' }],
|
|
|
+ naticeList: nationList,
|
|
|
+ degreeList: [
|
|
|
+ {
|
|
|
+ name: '学士',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '学士',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '博士',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '其他',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ fieldList: [
|
|
|
+ { name: '计算机' },
|
|
|
+ { name: 'VR' },
|
|
|
+ { name: 'MR' },
|
|
|
+ { name: '生化' },
|
|
|
+ { name: '养生' },
|
|
|
+ { name: '艺术' },
|
|
|
+ { name: '绘画' },
|
|
|
+ { name: '音乐' },
|
|
|
+ { name: '花道' },
|
|
|
+ { name: '茶道' },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ await this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...talentExperts({ newfetch: 'fetch', newcreate: 'create', newupdate: 'update' }),
|
|
|
+ // 查询详情
|
|
|
+ async search() {
|
|
|
+ if (this.id) {
|
|
|
+ this.loading = false;
|
|
|
+ const res = await this.newfetch(this.id);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ console.log(res.data);
|
|
|
+ this.$set(this, `form`, res.data);
|
|
|
+ this.loading = true;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存信息
|
|
|
+ async turnSave({ data }) {
|
|
|
+ if (data.id) {
|
|
|
+ const res = await this.newupdate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.back();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const res = await this.newcreate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.back();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 返回
|
|
|
+ back() {
|
|
|
+ this.form = {};
|
|
|
+ this.$router.push({ path: '/experts' });
|
|
|
+ },
|
|
|
+ uploadSuccess({ type, data }) {
|
|
|
+ this.$set(this.form, `${type}`, data.uri);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ id() {
|
|
|
+ return this.$route.query.id;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ id: {
|
|
|
+ deep: true,
|
|
|
+ immediate: true,
|
|
|
+ handler(val) {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped>
|
|
|
+.add {
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+</style>
|