Files
xj-admin/src/views/archivesManage/employee/fileMaintenance/components/tab2.vue
T
2025-06-27 17:42:38 +08:00

715 lines
30 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div style="position: relative">
<BasicForm @register="registerForm" class="jeecg-form">
<template #first>
<div class="sub">基本信息</div>
</template>
<template #second>
<div class="sub">住院信息</div>
</template>
<template #third>
<div class="sub">分类信息</div>
</template>
<template #A>
<a-form :model="data1" class="option-form" ref="optionForm">
<a-form-item-rest>
<div class="table-d">
<div class="table-td-d d1">大病名称</div>
<div class="table-td-d d1">确诊年份</div>
<div class="table-td-d d1">确诊医院</div>
<div class="table-td-d d1">大病状态</div>
<div class="table-td-d d1">治疗情况</div>
<div class="table-td-d d1">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="addItem('a')"> 添加 </span>
<span v-else>-</span>
</div>
</div>
<template v-for="(item, index) in data1.option" :key="`temp${index}`">
<div class="table-d table-d-d">
<div class="table-td-d tabled-td-d-d d1">
<a-form-item
:name="['option', index, 'name']"
:rules="{
required: true,
// message: `请输入第${index}个大病名称`,
message: '',
}"
:disabled="props.editType === '1'"
>
<JDictSelectTag
style="max-width: 100%"
v-model:value="item.name"
placeholder="请选择大病名称"
dictCode="ill_type"
:disabled="props.editType === '1'"
/>
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d1">
<a-form-item :name="['option', index, 'time']">
<a-date-picker
:disabled="props.editType === '1'"
v-model:value="item.time"
picker="year"
value-format="YYYY"
/>
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d1">
<a-form-item :name="['option', index, 'hospital']">
<a-input :disabled="props.editType === '1'" v-model:value="item.hospital" placeholder="请输入确诊医院" />
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d1 user-group">
<a-form-item
:name="['option', index, 'status']"
:rules="{
required: true,
// message: `请选择第${index}个大病状态`,
message: '',
}"
>
<JDictSelectTag
style="max-width: 100%"
v-model:value="item.status"
placeholder="请选择大病状态"
dictCode="archives_ill_status"
:disabled="props.editType === '1'"
/>
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d1">
<a-form-item :name="['option', index, 'cure']">
<a-input :disabled="props.editType === '1'" v-model:value="item.cure" placeholder="请输入治疗情况" />
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d1">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="delItem('a', index)">
删除
</span>
<span v-else>-</span>
</div>
</div>
</template>
</a-form-item-rest>
</a-form>
</template>
<template #B>
<a-form :model="data2" class="option-form" ref="optionForm">
<a-form-item-rest>
<div class="table-d">
<div class="table-td-d d2">慢病名称</div>
<div class="table-td-d d2">确诊年份</div>
<div class="table-td-d d2">确诊医院</div>
<div class="table-td-d d2">治疗情况</div>
<div class="table-td-d d2">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="addItem('b')"> 添加 </span>
<span v-else>-</span>
</div>
</div>
<template v-for="(item, index) in data2.option" :key="`temp${index}`">
<div class="table-d table-d-d">
<div class="table-td-d tabled-td-d-d d2">
<a-form-item
:name="['option', index, 'name']"
:rules="{
required: true,
// message: `请输入第${index}个大病名称`,
message: '',
}"
>
<JDictSelectTag
style="max-width: 100%"
v-model:value="item.name"
placeholder="请选择慢病名称"
dictCode="hms_disease_type"
:disabled="props.editType === '1'"
/>
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d2">
<a-form-item :name="['option', index, 'time']">
<a-date-picker
:disabled="props.editType === '1'"
v-model:value="item.time"
picker="year"
value-format="YYYY"
/>
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d2">
<a-form-item :name="['option', index, 'hospital']">
<a-input :disabled="props.editType === '1'" v-model:value="item.hospital" placeholder="请输入确诊医院" />
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d2">
<a-form-item :name="['option', index, 'cure']">
<a-input :disabled="props.editType === '1'" v-model:value="item.cure" placeholder="请输入治疗情况" />
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d2">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="delItem('b', index)">
删除
</span>
<span v-else>-</span>
</div>
</div>
</template>
</a-form-item-rest>
</a-form>
</template>
<template #C>
<a-form :model="data3" class="option-form" ref="optionForm">
<a-form-item-rest>
<div class="table-d">
<div class="table-td-d d3">指标名称</div>
<div class="table-td-d d3">指标值</div>
<div class="table-td-d d3">参考范围</div>
<div class="table-td-d d3">确诊年份</div>
<div class="table-td-d d3">确诊医院</div>
<div class="table-td-d d3">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="addItem('c')"> 添加 </span>
<span v-else>-</span>
</div>
</div>
<template v-for="(item, index) in data3.option" :key="`temp${index}`">
<div class="table-d table-d-d">
<div class="table-td-d tabled-td-d-d d3">
<a-input :disabled="props.editType === '1'" v-model:value="item.name" readonly />
</div>
<div class="table-td-d tabled-td-d-d d3">
<a-input :disabled="props.editType === '1'" v-model:value="item.value" readonly />
</div>
<div class="table-td-d tabled-td-d-d d3">
<a-input :disabled="props.editType === '1'" v-model:value="item.scope" readonly />
</div>
<div class="table-td-d tabled-td-d-d d3">
<a-form-item :name="['option', index, 'hospital']">
<a-input :disabled="props.editType === '1'" v-model:value="item.time" readonly />
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d3">
<a-form-item :name="['option', index, 'hospital']">
<a-input :disabled="props.editType === '1'" v-model:value="item.hospital" readonly />
</a-form-item>
</div>
<div class="table-td-d tabled-td-d-d d3">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="delItem('c', index)">
删除
</span>
<span v-else>-</span>
</div>
</div>
</template>
</a-form-item-rest>
</a-form>
</template>
<template #D>
<a-form :model="data4" class="option-form" ref="optionForm">
<a-form-item-rest>
<div class="table-d">
<div class="table-td-d d4">疾病名称</div>
<div class="table-td-d d4">风险等级</div>
<div class="table-td-d d4">评估年份</div>
<div class="table-td-d d4">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="addItem('d')"> 添加 </span>
<span v-else>-</span>
</div>
</div>
<template v-for="(item, index) in data4.option" :key="`temp${index}`">
<div class="table-d table-d-d">
<div class="table-td-d tabled-td-d-d d4">
<a-input :disabled="props.editType === '1'" v-model:value="item.name" readonly />
</div>
<div class="table-td-d tabled-td-d-d d4">
<a-input :disabled="props.editType === '1'" v-model:value="item.levelDesc" readonly />
</div>
<div class="table-td-d tabled-td-d-d d4">
<a-input :disabled="props.editType === '1'" v-model:value="item.time" readonly />
</div>
<div class="table-td-d tabled-td-d-d d4">
<span v-if="props.editType !== '1'" style="color: #1890ff; cursor: pointer" @click="delItem('d', index)">
删除
</span>
<span v-else>-</span>
</div>
</div>
</template>
</a-form-item-rest>
</a-form>
</template>
</BasicForm>
<a-button type="primary" @click="handleSubmit" style="position: absolute; right: 10px; bottom: 10px" v-if="props.editType !== '1'"
>保存</a-button
>
<ChooseSome
class="choose-some"
:width="1000"
@register="examinationModal"
@select-some="onSelectUserOk"
title="体检报告"
zIndex="1001"
:tableprops="tableProps"
selection-type="checkbox"
/>
<ChooseSome
class="choose-some"
:width="1000"
@register="examinationModal1"
@select-some="onSelectUserOk1"
title="评估结果"
zIndex="1001"
:tableprops="tableProps1"
selection-type="checkbox"
/>
</div>
</template>
<script setup lang="ts">
import BasicForm from '/@/components/Form/src/BasicForm.vue';
import { useDrawer, useDrawerInner } from '/@/components/Drawer';
import { useForm } from '/@/components/Form';
import { mSearchSchema, mColumns, mSearchSchema1, mColumns1 } from '/@/views/archive/fiveClassPeople/index.data';
import { onMounted, ref, watch } from 'vue';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import {
groupUserAApi,
groupUserBApi,
groupUserCApi,
groupUserDApi,
groupUserEApi,
groupUserCLatestReportApi,
groupUserDLatestReportApi,
detailAApi,
detailBApi,
detailCApi,
detailDApi,
groupUserExtByUserIdApi,
editByUserIdApi,
} from '/@/views/archive/fiveClassPeople/index.api';
import ChooseSome from '/@/views/compoents/chooseSome/index.vue';
import { tab2schemas } from '/@/views/archivesManage/employee/fileMaintenance/maintenance.data';
const props = defineProps({
userInfo: {
type: Object,
default: () => ({}),
},
editType: {
type: String,
default: () => '0',
},
});
const data1 = ref<object>({
option: [],
});
const itemA = ref<object>({
name: '',
time: '',
hospital: '',
status: '',
});
const data2 = ref<object>({
option: [],
});
const itemB = ref<object>({
name: '',
time: '',
hospital: '',
});
const data3 = ref<object>({
option: [],
});
const data4 = ref<object>({
option: [],
});
const [examinationModal, { openDrawer }] = useDrawer();
const [examinationModal1, { openDrawer: openDrawer1 }] = useDrawer();
const tableProps = ref({
tableProps: {
api: groupUserCLatestReportApi,
columns: mColumns,
canResize: false,
immediate: false,
clearSelectOnPageChange: false,
rowKey: (record: Recordable) => {
return JSON.stringify({
peItemName: record?.peItemName,
peResult: record?.peResult,
printContext: record?.printContext,
medicalYear: record?.medicalYear,
hospitalName: record?.hospitalName,
uniItemId: record?.uniItemId,
});
},
beforeFetch: (params) => {
params['userId'] = props.userInfo.id;
return params;
},
afterFetch: (data) => {
let result: any[] = [];
data.length > 0 &&
data.map((item) => {
if (item?.senResultRes && item?.senResultRes.length > 0) {
item?.senResultRes.map((it) => {
if (it?.thirdResultRes && it?.thirdResultRes.length > 0) {
result = result.concat(it?.thirdResultRes);
}
});
}
});
return result;
},
formConfig: {
schemas: mSearchSchema,
autoSubmitOnEnter: true,
showAdvancedButton: false,
fieldMapToNumber: [],
fieldMapToTime: [],
labelWidth: 140,
baseColProps: {
xs: 12,
sm: 12,
md: 12,
lg: 12,
xl: 12,
xxl: 12,
},
actionColOptions: {
style: {
paddingLeft: '144px',
},
span: 24,
offset: 0,
xs: 12,
sm: 12,
md: 12,
lg: 12,
xl: 12,
xxl: 12,
},
},
showActionColumn: false,
},
});
const tableProps1 = ref({
tableProps: {
api: groupUserDLatestReportApi,
columns: mColumns1,
canResize: false,
immediate: false,
clearSelectOnPageChange: false,
rowKey: (record: Recordable) => {
return JSON.stringify({
name: record?.name,
levelDesc: record?.levelDesc,
level: record?.level,
year: record?.year + '',
});
},
beforeFetch: (params) => {
params['userId'] = props.userInfo.id;
return params;
},
showTableSetting: true,
tableSetting: {
redo: true,
setting: false,
},
// afterFetch: (data) => {
// let result: any[] = [];
//
// data.length > 0 &&
// data.map((item) => {
// if (item?.senResultRes && item?.senResultRes.length > 0) {
// item?.senResultRes.map((it) => {
// if (it?.thirdResultRes && it?.thirdResultRes.length > 0) {
// result = result.concat(it?.thirdResultRes);
// }
// });
// }
// });
//
// return result;
// },
useSearchForm: false,
formConfig: {
schemas: mSearchSchema1,
autoSubmitOnEnter: true,
showAdvancedButton: false,
fieldMapToNumber: [],
fieldMapToTime: [],
labelWidth: 120,
baseColProps: {
xs: 12,
sm: 12,
md: 12,
lg: 12,
xl: 12,
xxl: 12,
},
actionColOptions: {
style: {
paddingLeft: '122px',
},
span: 24,
offset: 0,
xs: 12,
sm: 12,
md: 12,
lg: 12,
xl: 12,
xxl: 12,
},
},
showActionColumn: false,
},
});
onMounted(async () => {
await resetFields();
data1.value.option = [];
data2.value.option = [];
data3.value.option = [];
data4.value.option = [];
await preData();
if (props.editType === '1') {
await setProps({ disabled: true });
}
});
watch(
() => props.userInfo,
async () => {
await preData();
}
);
async function preData() {
let res = {};
switch (props.userInfo.userGroup) {
case 'a':
const { records: r1 } = await detailAApi({ pageNo: 1, pageSize: 9999, userId: props.userInfo.id });
res = await groupUserExtByUserIdApi({ pageNo: 1, pageSize: 9999, userId: props.userInfo.id });
data1.value.option = r1;
break;
case 'b':
const { records: r2 } = await detailBApi({ pageNo: 1, pageSize: 9999, userId: props.userInfo.id });
res = await groupUserExtByUserIdApi({ pageNo: 1, pageSize: 9999, userId: props.userInfo.id });
data2.value.option = r2;
break;
case 'c':
const { records: r3 } = await detailCApi({ pageNo: 1, pageSize: 9999, userId: props.userInfo.id });
data3.value.option = r3;
break;
case 'd':
const { records: r4 } = await detailDApi({ pageNo: 1, pageSize: 9999, userId: props.userInfo.id });
data4.value.option = r4.map((item: any) => ({
name: item?.name,
levelDesc: item?.levelDesc,
level: item?.level,
time: item?.time,
}));
console.log(data4.value.option);
break;
case 'e':
break;
}
await setFieldsValue({
...props.userInfo,
...res,
});
}
function addItem(type) {
console.log(type);
switch (type) {
case 'a':
data1.value?.option.push(JSON.parse(JSON.stringify(itemA.value)));
break;
case 'b':
data2.value?.option.push(JSON.parse(JSON.stringify(itemB.value)));
break;
case 'c':
const list = data3.value.option.map((item: any) => {
console.log(item);
return JSON.stringify({
peItemName: item?.name,
peResult: item?.value,
printContext: item?.scope,
medicalYear: item?.time,
hospitalName: item?.hospital,
uniItemId: item?.uniItemId,
});
});
openDrawer(true, {
selectedRowKeys: list,
});
break;
case 'd':
const list1 = data4.value.option.map((item: any) => {
return JSON.stringify({
name: item?.name,
levelDesc: item?.levelDesc,
level: item?.level,
year: item?.time + '',
});
});
console.log(list1, 1);
openDrawer1(true, {
selectedRowKeys: list1,
});
break;
}
}
function delItem(type, index) {
switch (type) {
case 'a':
data1.value?.option.splice(index, 1);
break;
case 'b':
data2.value?.option.splice(index, 1);
break;
case 'c':
data3.value?.option.splice(index, 1);
break;
case 'd':
data4.value?.option.splice(index, 1);
break;
}
}
const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue, setProps }] = useForm({
schemas: tab2schemas,
showAdvancedButton: false,
showActionButtonGroup: false,
labelWidth: 130,
});
const optionForm = ref();
async function handleSubmit() {
try {
const values = await validate();
let values1;
// if (values['userGroup'] != 'e') {
if (!['c', 'd', 'e'].includes(values['userGroup'])) {
values1 = await optionForm.value.validate();
}
let params =
values['userGroup'] == 'e'
? { userId: values.userId }
: {
userId: values.userId,
userGroup: values.userGroup,
list: values['userGroup'] === 'c' ? data3.value.option : values['userGroup'] === 'd' ? data4.value.option : values1?.option,
};
switch (values['userGroup']) {
case 'a':
await editByUserIdApi(values);
await groupUserAApi(params);
break;
case 'b':
await editByUserIdApi(values);
await groupUserBApi(params);
break;
case 'c':
await groupUserCApi(params);
break;
case 'd':
await groupUserDApi(params);
break;
case 'e':
await groupUserEApi(params);
break;
}
} finally {
}
}
function onSelectUserOk(e) {
data3.value.option =
e.length > 0
? e.map((item) => {
return {
name: JSON.parse(item)?.peItemName,
value: JSON.parse(item)?.peResult,
scope: JSON.parse(item)?.printContext,
time: JSON.parse(item)?.medicalYear,
hospital: JSON.parse(item)?.hospitalName,
uniItemId: JSON.parse(item)?.uniItemId,
};
})
: [];
}
function onSelectUserOk1(e) {
console.log(e);
data4.value.option =
e.length > 0
? e.map((item) => {
return {
name: JSON.parse(item)?.name,
levelDesc: JSON.parse(item)?.levelDesc,
level: JSON.parse(item)?.level,
time: JSON.parse(item)?.year,
};
})
: [];
}
</script>
<style scoped lang="less">
.table-d {
width: 100%;
display: flex;
border-top: 1px solid #f0f0f0;
border-right: 1px solid #f0f0f0;
.table-td-d {
border-left: 1px solid #f0f0f0;
border-bottom: 1px solid #f0f0f0;
background-color: #fafafa;
height: 50px;
line-height: 50px !important;
text-align: center;
}
.d1 {
width: calc(100% / 6);
}
.d2 {
width: 20%;
}
.d4 {
width: 25%;
}
.d3 {
width: calc(100% / 6);
}
.table-d-d {
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
}
.option-form {
.ant-form-item {
line-height: 50px !important;
}
}
:deep(.user-group .ant-select-selector) {
padding: 0 !important;
}
.sub {
font-size: 16px;
font-weight: bold;
padding-left: 10px;
}
</style>