|
@@ -0,0 +1,315 @@
|
|
|
+<template>
|
|
|
+ <div id="detail">
|
|
|
+ <van-row>
|
|
|
+ <van-col span="24" class="main animate__animated animate__backInRight">
|
|
|
+ <van-col span="24" class="one">
|
|
|
+ <van-form @submit="toSave" label-width="auto">
|
|
|
+ <van-cell-group>
|
|
|
+ <van-field
|
|
|
+ v-model="form.act_time"
|
|
|
+ is-link
|
|
|
+ readonly
|
|
|
+ name="act_time"
|
|
|
+ label="活动时间"
|
|
|
+ placeholder="点击选择"
|
|
|
+ @click="toPopup({ type: 'act_time' })"
|
|
|
+ />
|
|
|
+ <van-field v-model="form.lab_id" name="lab_id" style="display: none" />
|
|
|
+ <van-field v-model="form.lab_name" name="lab_name" label="实验室名称" placeholder="请输入实验室名称" readonly />
|
|
|
+ <van-field v-model="form.name" name="name" type="textarea" rows="1" autosize label="姓名" placeholder="请输入姓名" />
|
|
|
+ <van-field v-model="form.age" name="age" type="textarea" rows="1" autosize label="年龄" placeholder="请输入年龄" />
|
|
|
+ <van-field v-model="form.unit" name="unit" type="textarea" rows="1" autosize label="工作单位及部门" placeholder="请输入工作单位及部门" />
|
|
|
+ <van-field v-model="form.zwzc" name="zwzc" type="textarea" rows="1" autosize label="职务职称" placeholder="请输入职务职称" />
|
|
|
+ <van-field v-model="form.zwzc" name="zwzc" type="textarea" rows="1" autosize label="身份证号" placeholder="请输入身份证号" />
|
|
|
+ <van-field v-model="form.zwzc" name="zwzc" type="textarea" rows="1" autosize label="学历" placeholder="请输入学历" />
|
|
|
+ <van-field v-model="form.zwzc" name="zwzc" type="textarea" rows="1" autosize label="现从事专业" placeholder="请输入现从事专业" />
|
|
|
+ <van-field
|
|
|
+ v-model="form.direction"
|
|
|
+ is-link
|
|
|
+ readonly
|
|
|
+ name="direction"
|
|
|
+ label="研究方向"
|
|
|
+ placeholder="点击选择"
|
|
|
+ @click="toPopup({ type: 'direction' })"
|
|
|
+ />
|
|
|
+ <van-field v-model="form.is_show" is-link readonly name="is_show" label="是否公开" placeholder="点击选择" @click="toPopup({ type: 'is_show' })" />
|
|
|
+ <van-field name="logs" label="任职记录">
|
|
|
+ <template #input>
|
|
|
+ <van-col span="24" class="logs">
|
|
|
+ <van-col span="24" class="logs_1">
|
|
|
+ <van-button type="primary" size="small" @click="addLogs()">添加记录</van-button>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="24" class="logs_2">
|
|
|
+ <van-col span="24" class="list" v-for="(i, index) in form.logs" :key="index">
|
|
|
+ <van-col span="24" class="list_1">
|
|
|
+ <van-col span="20" class="list_1_type">{{ index + 1 }}.{{ i.type }}</van-col>
|
|
|
+ <van-col span="4" class="list_1_btn">
|
|
|
+ <van-button type="danger" size="mini" @click="delLogs(i)">删除</van-button>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="24" class="list_2">时间:{{ i.time }}</van-col>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ </van-cell-group>
|
|
|
+ <div class="btn">
|
|
|
+ <van-button type="primary" size="small" native-type="submit"> 提交保存 </van-button>
|
|
|
+ </div>
|
|
|
+ </van-form>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-popup v-model:show="popup.show" position="bottom">
|
|
|
+ <template v-if="popup.type == 'act_time'">
|
|
|
+ <van-picker :columns="actList" :columns-field-names="{ text: 'name', value: '_id' }" @confirm="popChange" @cancel="toCancel" />
|
|
|
+ </template>
|
|
|
+ <template v-else-if="popup.type == 'direction'">
|
|
|
+ <van-picker :columns="directionList" :columns-field-names="{ text: 'name', value: '_id' }" @confirm="popChange" @cancel="toCancel" />
|
|
|
+ </template>
|
|
|
+ <template v-else-if="popup.type == 'is_show'">
|
|
|
+ <van-picker :columns="showList" :columns-field-names="{ text: 'dict_label', value: 'dict_value' }" @confirm="popChange" @cancel="toCancel" />
|
|
|
+ </template>
|
|
|
+ </van-popup>
|
|
|
+ <cPopup :popupInfo="popupInfo">
|
|
|
+ <template v-slot:info>
|
|
|
+ <van-col span="24" class="popup_one" v-if="popupInfo.type == '1'">
|
|
|
+ <van-form @submit="logsSave" label-width="auto">
|
|
|
+ <van-cell-group>
|
|
|
+ <van-field name="type" label="注册用户类型">
|
|
|
+ <template #input>
|
|
|
+ <van-radio-group v-model="logsForm.type" direction="horizontal">
|
|
|
+ <van-radio :name="i.value" v-for="i in typeList" :key="i.value">{{ i.label }}</van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <van-field v-model="logsForm.time" is-link readonly name="time" label="时间" placeholder="点击选择" @click="logsShow = true" />
|
|
|
+ <van-popup v-model:show="logsShow" position="bottom">
|
|
|
+ <van-date-picker :columns-type="['year', 'month', 'day']" @confirm="logstimeChange" @cancel="logsShow = false" />
|
|
|
+ </van-popup>
|
|
|
+ <div class="btn">
|
|
|
+ <van-button type="primary" size="small" native-type="submit"> 提交保存 </van-button>
|
|
|
+ </div>
|
|
|
+ </van-cell-group>
|
|
|
+ </van-form>
|
|
|
+ </van-col>
|
|
|
+ </template>
|
|
|
+ </cPopup>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+// 基础
|
|
|
+// import _ from 'lodash';
|
|
|
+import moment from 'moment';
|
|
|
+import type { Ref } from 'vue';
|
|
|
+import { onMounted, ref } from 'vue';
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
+import { showToast } from 'vant';
|
|
|
+// 接口
|
|
|
+import { BasicStore } from '@common/src/stores/basic/basic';
|
|
|
+import { ActivitysStore } from '@common/src/stores/basic/activitys';
|
|
|
+import { FixedpersonnelStore } from '@common/src/stores/basic/fixedpersonnel';
|
|
|
+import { DirectionStore } from '@common/src/stores/basic/direction';
|
|
|
+import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
|
|
|
+
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+import store from '@/stores/counter';
|
|
|
+const basicAxios = BasicStore();
|
|
|
+const actAxios = ActivitysStore();
|
|
|
+const fixedperAxios = FixedpersonnelStore();
|
|
|
+const directionAxios = DirectionStore();
|
|
|
+const dictAxios = DictDataStore();
|
|
|
+
|
|
|
+// 路由
|
|
|
+const route = useRoute();
|
|
|
+
|
|
|
+// 实验室基础信息
|
|
|
+const lab_id: Ref<any> = ref('');
|
|
|
+const basicInfo: Ref<any> = ref({});
|
|
|
+const labList: Ref<any> = ref([]);
|
|
|
+// 活动时间
|
|
|
+const actList: Ref<any> = ref([]);
|
|
|
+
|
|
|
+const id: Ref<any> = ref('');
|
|
|
+// 表单
|
|
|
+const form: Ref<any> = ref({ logs: [] });
|
|
|
+
|
|
|
+// 弹框
|
|
|
+const popup: Ref<any> = ref({ show: false, type: '' });
|
|
|
+// 弹出层
|
|
|
+const popupInfo: Ref<any> = ref({ show: false, type: '1', title: '任职记录' });
|
|
|
+// 任职记录
|
|
|
+const logsForm: Ref<any> = ref({});
|
|
|
+const logsShow: Ref<any> = ref(false);
|
|
|
+// 字典表
|
|
|
+const typeList: Ref<any> = ref([
|
|
|
+ { value: '入驻', label: '入驻' },
|
|
|
+ { value: '退出', label: '退出' }
|
|
|
+]);
|
|
|
+const directionList: Ref<any> = ref([]);
|
|
|
+const showList: Ref<any> = ref([]);
|
|
|
+
|
|
|
+// 请求
|
|
|
+onMounted(async () => {
|
|
|
+ // 实验室id
|
|
|
+ lab_id.value = store.getters.lab_id;
|
|
|
+ id.value = route.query.id;
|
|
|
+ // 查询基础信息
|
|
|
+ await searchBasic();
|
|
|
+ // 查询其他信息
|
|
|
+ await searchOther();
|
|
|
+ await search();
|
|
|
+});
|
|
|
+// 查询基础信息
|
|
|
+const searchBasic = async () => {
|
|
|
+ let res: IQueryResult = await basicAxios.fetch(lab_id.value);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let data = res.data as any;
|
|
|
+ basicInfo.value = data;
|
|
|
+ labList.value = [data];
|
|
|
+ form.value.lab_id = data._id;
|
|
|
+ form.value.lab_name = data.name;
|
|
|
+ // 查询活动时间
|
|
|
+ const isInAct = store.state.isInAct;
|
|
|
+ if (!isInAct) searchAct(data);
|
|
|
+ }
|
|
|
+};
|
|
|
+// 查询活动时间
|
|
|
+const searchAct = async (e) => {
|
|
|
+ const query = { is_use: '0', type: '' };
|
|
|
+ if (e.status == '1') query.type = '-1';
|
|
|
+ else if (e.status == '2') query.type = '2';
|
|
|
+ else query.type = '1';
|
|
|
+ let res: IQueryResult = await actAxios.query(query);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ actList.value = res.data;
|
|
|
+ }
|
|
|
+};
|
|
|
+const search = async () => {
|
|
|
+ if (id.value) {
|
|
|
+ let res: IQueryResult = await fixedperAxios.fetch(id.value);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ let data = res.data as any;
|
|
|
+ form.value = data;
|
|
|
+ form.value.lab_name = basicInfo.value.name;
|
|
|
+ form.value.act_time = data.act_time._id;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+// 选择
|
|
|
+const toPopup = (e) => {
|
|
|
+ popup.value = { show: true, type: e.type };
|
|
|
+};
|
|
|
+const popChange = (e) => {
|
|
|
+ let value = e.selectedValues;
|
|
|
+ if (popup.value.type == 'act_time') {
|
|
|
+ form.value.act_time = value[0];
|
|
|
+ } else if (popup.value.type == 'direction') {
|
|
|
+ form.value.direction = value[0];
|
|
|
+ } else if (popup.value.type == 'is_show') {
|
|
|
+ form.value.is_show = value[0];
|
|
|
+ }
|
|
|
+ toCancel();
|
|
|
+};
|
|
|
+// 关闭
|
|
|
+const toCancel = () => {
|
|
|
+ popup.value = { show: false };
|
|
|
+};
|
|
|
+// 添加记录
|
|
|
+const addLogs = () => {
|
|
|
+ popupInfo.value = { show: true, type: '1', title: '任职记录' };
|
|
|
+};
|
|
|
+// 选择时间
|
|
|
+const logstimeChange = (e) => {
|
|
|
+ let value = e.selectedValues;
|
|
|
+ logsForm.value.time = value.join('-');
|
|
|
+ logsShow.value = false;
|
|
|
+};
|
|
|
+// 任职记录保存
|
|
|
+const logsSave = (e) => {
|
|
|
+ let logs = form.value.logs || [];
|
|
|
+ logs.push({ ...e, id: moment().valueOf() });
|
|
|
+ form.value.logs = logs;
|
|
|
+ popupInfo.value = { show: false };
|
|
|
+};
|
|
|
+// 任职记录删除
|
|
|
+const delLogs = (e) => {
|
|
|
+ let logs = form.value.logs.filter((i: any) => i.id != e.id);
|
|
|
+ form.value.logs = logs;
|
|
|
+};
|
|
|
+// 保存
|
|
|
+const toSave = async (e) => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ delete e.lab_name;
|
|
|
+ if (id.value) {
|
|
|
+ // if (_.isObject(e.act_time)) e.act_time = e.act_time._id;
|
|
|
+ e.logs = form.value.logs;
|
|
|
+ res = await fixedperAxios.update({ ...e, _id: id.value });
|
|
|
+ } else res = await fixedperAxios.create(e);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ showToast({ message: '信息删除成功', type: 'success', duration: 500 });
|
|
|
+ toBack();
|
|
|
+ } else {
|
|
|
+ showToast({ message: `${res.errmsg}`, type: 'fail', duration: 500 });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 查询其他信息
|
|
|
+const searchOther = async () => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 所属研究方向
|
|
|
+ res = await directionAxios.query({ lab_id: lab_id.value });
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ directionList.value = res.data;
|
|
|
+ }
|
|
|
+ // 是否公开
|
|
|
+ res = await dictAxios.query({ dict_type: 'info_show' });
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ showList.value = res.data;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 返回;
|
|
|
+const toBack = () => {
|
|
|
+ window.history.go(-1);
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped lang="scss">
|
|
|
+.main {
|
|
|
+ .one {
|
|
|
+ .btn {
|
|
|
+ text-align: center;
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.logs {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ .logs_1 {
|
|
|
+ margin: 0 0 5px 0;
|
|
|
+ }
|
|
|
+ .logs_2 {
|
|
|
+ .list {
|
|
|
+ border: 1px solid #858585;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin: 0 0 5px 0;
|
|
|
+ padding: 5px;
|
|
|
+ .list_1 {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ .list_1_btn {
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.popup_one {
|
|
|
+ .btn {
|
|
|
+ text-align: center;
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|