|
@@ -0,0 +1,159 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
+ <el-col :span="24" class="one">
|
|
|
+ <cSearch :is_back="true" @toBack="toBack"></cSearch>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="two">
|
|
|
+ <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit" :disabled="disabled">
|
|
|
+ <template #type>
|
|
|
+ <el-option v-for="(i, index) in typeList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #code>
|
|
|
+ <el-option v-for="(i, index) in codeList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #password>
|
|
|
+ <el-input v-model="form.password" placeholder="请输入密码" :disabled="form._id ? true : false" show-password></el-input>
|
|
|
+ </template>
|
|
|
+ <template #area>
|
|
|
+ <el-option v-for="(i, index) in areaList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #icon="{ item }">
|
|
|
+ <cUpload
|
|
|
+ :model="item.model"
|
|
|
+ :limit="1"
|
|
|
+ url="/files/zkzx/v2/api/user/upload"
|
|
|
+ :list="form[item.model]"
|
|
|
+ listType="picture"
|
|
|
+ @change="onUpload"
|
|
|
+ ></cUpload>
|
|
|
+ </template>
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #personal_id>
|
|
|
+ <el-option v-for="(i, index) in personalList" :key="index" :label="i.name" :value="i._id"></el-option>
|
|
|
+ </template>
|
|
|
+ </cForm>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import type { FormRules } from 'element-plus';
|
|
|
+import type { Ref } from 'vue';
|
|
|
+import { ref, reactive, onMounted } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
+import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
|
|
|
+import { RoleStore } from '@common/src/stores/system/role'; // 角色
|
|
|
+import { ExpertStore } from '@common/src/stores/admins/expert'; // 角色
|
|
|
+import { PersonalStore } from '@common/src/stores/admins/personal';
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const expert = ExpertStore();
|
|
|
+const dictData = DictDataStore();
|
|
|
+const role = RoleStore();
|
|
|
+const personal = PersonalStore();
|
|
|
+const route = useRoute();
|
|
|
+const loading = ref(false);
|
|
|
+let form: Ref<any> = ref({});
|
|
|
+let roleList: Ref<any> = ref([]);
|
|
|
+let statusList: Ref<any> = ref([]);
|
|
|
+let codeList: Ref<any> = ref([]);
|
|
|
+let typeList: Ref<any> = ref([{ label: '专家', value: '6' }]);
|
|
|
+let areaList: Ref<any> = ref([]);
|
|
|
+let personalList: Ref<any> = ref([]);
|
|
|
+let disabled: Ref<any> = ref(false);
|
|
|
+// 表单
|
|
|
+let formFields: Ref<any[]> = ref([
|
|
|
+ { label: '用户类型', model: 'type', type: 'select', options: { disabled: true } },
|
|
|
+ { label: '邀请码', model: 'code', type: 'select' },
|
|
|
+ { label: '账号', model: 'account' },
|
|
|
+ { label: '密码', model: 'password', custom: true },
|
|
|
+ { label: '名称', model: 'name' },
|
|
|
+ { label: '手机号', model: 'phone' },
|
|
|
+ { label: '电子邮箱', model: 'email' },
|
|
|
+ { label: '联系地址', model: 'address' },
|
|
|
+ { label: '办公电话', model: 'work_phone' },
|
|
|
+ { label: '所属行业', model: 'industry' },
|
|
|
+ { label: '所属辖区', model: 'area', type: 'select' },
|
|
|
+ { label: '身份证号', model: 'card' },
|
|
|
+ { label: '出生日期', model: 'birth' },
|
|
|
+ { label: 'qq&&微信', model: 'qqwx' },
|
|
|
+ { label: '所在院校', model: 'school' },
|
|
|
+ { label: '最高学历', model: 'education' },
|
|
|
+ { label: '所学专业', model: 'major' },
|
|
|
+ { label: '单位名称', model: 'company' },
|
|
|
+ { label: '职务职称', model: 'zwzc' },
|
|
|
+ { label: '头像图片', model: 'icon', custom: true },
|
|
|
+ { label: '擅长领域', model: 'expertise' },
|
|
|
+ { label: '工作经历', model: 'workexperience' },
|
|
|
+ { label: '科研综述', model: 'scientific' },
|
|
|
+ { label: '承担项目', model: 'undertakingproject' },
|
|
|
+ { label: '科技奖励', model: 'scienceaward' },
|
|
|
+ { label: '社会任职', model: 'social' },
|
|
|
+ { label: '状态', model: 'status', type: 'select' },
|
|
|
+ { label: '个人用户id', model: 'personal_id', type: 'select' } //查询个人用户,选择
|
|
|
+]);
|
|
|
+const rules = reactive<FormRules>({
|
|
|
+ name: [{ required: true, message: '名称', trigger: 'blur' }],
|
|
|
+ account: [{ required: true, message: '账号', trigger: 'blur' }],
|
|
|
+ type: [{ required: true, message: '用户类型', trigger: 'blur' }]
|
|
|
+});
|
|
|
+onMounted(async () => {
|
|
|
+ loading.value = true;
|
|
|
+ if (route.query.isdisabled == 'true') disabled.value = true;
|
|
|
+ await searchOther();
|
|
|
+ await search();
|
|
|
+ loading.value = false;
|
|
|
+});
|
|
|
+const search = async () => {
|
|
|
+ if (route.query.id) {
|
|
|
+ let res: IQueryResult = await expert.fetch(route.query.id);
|
|
|
+ if (res.errcode == 0) form.value = res.data as {};
|
|
|
+ } else form.value = { type: '6', status: '1' };
|
|
|
+};
|
|
|
+const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
|
+ const { model, value } = e;
|
|
|
+ form.value[model] = value;
|
|
|
+};
|
|
|
+// 提交
|
|
|
+const onSubmit = async (data) => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ if (data._id) res = await expert.update(data);
|
|
|
+ else res = await expert.create(data);
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ ElMessage({ type: `success`, message: `维护信息成功` });
|
|
|
+ toBack();
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 返回上一页
|
|
|
+const toBack = () => {
|
|
|
+ window.history.go(-1);
|
|
|
+};
|
|
|
+const searchOther = async () => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 邀请码
|
|
|
+ res = await dictData.query({ type: 'account_code' });
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ let data: any = res.data;
|
|
|
+ codeList.value = data.filter((i) => i.value != 'CJGLY');
|
|
|
+ }
|
|
|
+ // 角色
|
|
|
+ res = await role.query();
|
|
|
+ if (res.errcode == 0) roleList.value = res.data;
|
|
|
+ // 所属辖区
|
|
|
+ res = await dictData.query({ type: 'jl_area' });
|
|
|
+ if (res.errcode == 0) areaList.value = res.data;
|
|
|
+ // 状态
|
|
|
+ res = await dictData.query({ type: 'common_status' });
|
|
|
+ if (res.errcode == 0) statusList.value = res.data;
|
|
|
+ res = await personal.query();
|
|
|
+ if (res.errcode == 0) personalList.value = res.data;
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped lang="scss"></style>
|