诊断模板

This commit is contained in:
旺仔 2024-09-13 13:40:56 +08:00
parent 51eed6510f
commit b660ad87e5
3 changed files with 224 additions and 71 deletions

View File

@ -15,8 +15,11 @@ export const DiagnosisTemplateApi = {
getPage: async (params: any) => { getPage: async (params: any) => {
return await request.get({ url: `/system/reporttemplate/page`, params }) return await request.get({ url: `/system/reporttemplate/page`, params })
}, },
getAllList: async () => { getRootTree: async () => {
return await request.get({ url: `/system/reporttemplate/getlist` }) return await request.get({ url: `/system/reporttemplate/getroot` })
},
hasChildren: async (id: any) => {
return await request.get({ url: `/system/reporttemplate/hasChildren?id=`+ id })
}, },
get: async (id: any) => { get: async (id: any) => {
return await request.get({ url: `/system/reporttemplate/get?id=`+ id }) return await request.get({ url: `/system/reporttemplate/get?id=`+ id })

View File

@ -13,13 +13,15 @@
> >
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="节点类型" prop="dataType" class="item-style"> <el-form-item label="数据类型" prop="dataType" class="item-style">
<el-radio-group <el-radio-group
v-model="formData.dataType" v-model="formData.dataType"
:disabled="dataType_disabled" :disabled="dataType_disabled"
@change="dataType_change" @change="dataType_change"
> >
<el-radio-button value="1">节点</el-radio-button> <el-radio-button value="1">
<div style="width: 40px; text-align: left">节点</div>
</el-radio-button>
<el-radio-button value="0"> <el-radio-button value="0">
<div style="width: 60px; text-align: left">诊断模版</div> <div style="width: 60px; text-align: left">诊断模版</div>
</el-radio-button> </el-radio-button>
@ -27,11 +29,31 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="formData.dataType == '1'">
<el-col :span="12">
<el-form-item label="节点类型" class="item-style">
<el-radio-group
v-model="rootType"
:disabled="dataType_disabled"
@change="root_change"
>
<el-radio-button value="1">
<div style="width: 40px; text-align: left">根节点</div>
</el-radio-button>
<el-radio-button value="0">
<div style="width: 60px; text-align: left">普通节点</div>
</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="formData.dataType == '0'"> <el-row v-if="formData.dataType == '0'">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="模版类型" class="item-style"> <el-form-item label="模版类型" class="item-style">
<el-radio-group v-model="templateLimitsType"> <el-radio-group v-model="templateLimitsType">
<el-radio-button value="1">公有</el-radio-button> <el-radio-button value="1">
<div style="width: 40px; text-align: left">公有</div>
</el-radio-button>
<el-radio-button value="2"> <el-radio-button value="2">
<div style="width: 60px; text-align: left">私有</div> <div style="width: 60px; text-align: left">私有</div>
</el-radio-button> </el-radio-button>
@ -91,22 +113,57 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24" v-if="formData.dataType == '0'"> <el-col :span="24" v-if="formData.dataType == '0'">
<el-form-item label="父节点" prop="pid" class="item-style"> <el-form-item label="上级节点" prop="pid" class="item-style">
<el-select <el-tree-select
v-model="parentTemplateInfo" ref="parentTreeRef"
value-key="id" :data="templateList"
placeholder="请选择父节点" v-model="formData.pid"
node-key="id"
:props="{
label: 'templateName',
children: 'children',
disabled: (data) => {
if (data && true == data.isFirstRoot) return true
else return false
}
}"
:show-checkbox="true"
:check-strictly="true"
:default-expand-all="true"
:highlight-current="true"
empty-text="暂无数据"
placeholder="请选择上级节点"
clearable
class="item-width"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" v-if="formData.dataType == '1' && rootType == '0'">
<el-form-item label="上级节点" prop="pid" class="item-style">
<el-tree-select
ref="parentTreeRef_root"
:data="templateList"
v-model="formData.pid"
node-key="id"
:props="{
label: 'templateName',
children: 'children',
disabled: (data) => {
if (data && true == data.isFirstRoot) return false
else return true
}
}"
:show-checkbox="true"
:check-strictly="true"
:default-expand-all="false"
:highlight-current="true"
empty-text="暂无数据"
placeholder="请选择上级节点"
clearable clearable
class="item-width" class="item-width"
@change="pid_change"
>
<el-option
v-for="item in templateList"
:key="item.id"
:label="item.templateName"
:value="item"
/> />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -175,6 +232,8 @@ const emit = defineEmits(['success'])
/** 组件引用 **/ /** 组件引用 **/
const formRef = ref() const formRef = ref()
const parentTreeRef = ref()
const parentTreeRef_root = ref()
/** 数据结构 **/ /** 数据结构 **/
const message = useMessage() const message = useMessage()
@ -186,7 +245,7 @@ const formType = ref('')
const orgList = ref<any[]>([]) const orgList = ref<any[]>([])
const doctorList = ref<any[]>([]) const doctorList = ref<any[]>([])
const templateList = ref<any[]>([]) const templateList = ref<any[]>([])
const parentTemplateInfo = ref<any>() const rootType = ref('')
const templateLimitsType = ref<any>('2') const templateLimitsType = ref<any>('2')
const dataType_disabled = ref(false) const dataType_disabled = ref(false)
// //
@ -221,50 +280,70 @@ const resetForm = () => {
updateTime: undefined, updateTime: undefined,
orgId: '' orgId: ''
} }
parentTemplateInfo.value = undefined rootType.value = ''
templateLimitsType.value = '2' templateLimitsType.value = '2'
formRef.value?.clearValidate() formRef.value?.clearValidate()
} }
const open = async (type: string, id?: number) => { const open = async (type: string, id?: number) => {
try {
formLoading.value = true
dialogVisible.value = true dialogVisible.value = true
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
formType.value = type formType.value = type
resetForm() resetForm()
orgList.value = await DiagnosisTemplateApi.getOrgList() orgList.value = await DiagnosisTemplateApi.getOrgList()
doctorList.value = await DiagnosisTemplateApi.getDoctorList() doctorList.value = await DiagnosisTemplateApi.getDoctorList()
templateList.value = await DiagnosisTemplateApi.getAllList() const rootTree = await DiagnosisTemplateApi.getRootTree()
if (rootTree && Array.isArray(rootTree) && rootTree.length > 0) {
rootTree.forEach((item) => {
if (item) item.isFirstRoot = true
})
}
templateList.value = rootTree
if (id) { if (id) {
formLoading.value = true
try { try {
const data = await DiagnosisTemplateApi.get(id) const data = await DiagnosisTemplateApi.get(id)
formData.value = data formData.value = data
if (data && !data.privateDoctorId) templateLimitsType.value = '1' if (data && !data.privateDoctorId) templateLimitsType.value = '1'
parentTemplateInfo.value = templateList.value?.find((item) => { if (data && data.dataType && data.dataType.trim() == '1') {
return item?.id && formData.value?.pid && item.id == formData.value.pid if (data.pid && data.pid.trim() == '0') rootType.value = '1'
}) else rootType.value = '0'
}
//
//if (data && data.dataType && data.dataType.trim() == '0')
//parentTemplateInfo.value = templateList.value?.find((item) => {
// return item?.id && formData.value?.pid && item.id == formData.value.pid
//})
} finally { } finally {
formLoading.value = false
} }
} }
dataType_disabled.value = true && !!formData.value?.id dataType_disabled.value = true && !!formData.value?.id
} finally {
formLoading.value = false
}
} }
/****** 可参考内容 ******/ /****** 可参考内容 ******/
/** 组件事件 **/ /** 组件事件 **/
const pid_change = async (value: any) => {
formData.value.pid = value ? value.id : ''
}
const dataType_change = () => { const dataType_change = () => {
formData.value.pid = ''
if (formData.value?.dataType == '1') { if (formData.value?.dataType == '1') {
rootType.value = '0'
templateLimitsType.value = '2' templateLimitsType.value = '2'
formData.value.privateDoctorId = '' formData.value.privateDoctorId = ''
formData.value.pid = '0'
formData.value.examDescription = '' formData.value.examDescription = ''
formData.value.diagResults = '' formData.value.diagResults = ''
} else if (formData.value?.dataType == '0') { } else if (formData.value?.dataType == '0') {
rootType.value = ''
}
}
const root_change = () => {
if (rootType.value == '0') {
formData.value.pid = '' formData.value.pid = ''
} else if (rootType.value == '1') {
formData.value.pid = '0'
} }
} }
@ -286,23 +365,41 @@ const submitForm = async () => {
return return
} }
if (data.dataType && data.dataType == '0') { if (data.dataType && data.dataType == '0') {
if (templateLimitsType.value == '2' && !data.privateDoctorId) { if (!data.pid) {
await message.alertWarning('请选择医生') await message.alertWarning('请选择上级节点')
return return
} }
if (!data.pid || !parentTemplateInfo.value) { if (templateLimitsType.value == '2' && !data.privateDoctorId) {
await message.alertWarning('请选择父节点') await message.alertWarning('请选择医生')
return return
} }
if (templateLimitsType.value == '1') { if (templateLimitsType.value == '1') {
data.privateDoctorId = '' data.privateDoctorId = ''
} }
if (parentTemplateInfo.value) { if (
data.examPart = parentTemplateInfo.value.examPart parentTreeRef.value &&
Array.isArray(parentTreeRef.value.getCheckedNodes()) &&
parentTreeRef.value.getCheckedNodes().length > 0
) {
data.examPart = parentTreeRef.value.getCheckedNodes()[0].examPart
} }
} else if (data.dataType && data.dataType == '1') { } else if (data.dataType && data.dataType == '1') {
if (rootType.value == '0') {
if (!data.pid) {
await message.alertWarning('请选择上级节点')
return
}
if (
parentTreeRef_root.value &&
Array.isArray(parentTreeRef_root.value.getCheckedNodes()) &&
parentTreeRef_root.value.getCheckedNodes().length > 0
) {
data.examPart = parentTreeRef_root.value.getCheckedNodes()[0].examPart
}
} else if (rootType.value == '1') {
data.examPart = data.templateName data.examPart = data.templateName
} }
}
// //
if (formType.value === 'create') { if (formType.value === 'create') {
await DiagnosisTemplateApi.create(data) await DiagnosisTemplateApi.create(data)

View File

@ -8,7 +8,7 @@
label-width="78px" label-width="78px"
label-position="right" label-position="right"
label-suffix="" label-suffix=""
class="-mb-15px" class="-mb-8px"
> >
<el-row> <el-row>
<el-col :span="9"> <el-col :span="9">
@ -22,15 +22,34 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="模版类型" prop="templateLimitsType" class="item-style"> <el-form-item label="模版类别" prop="templateType" class="item-style">
<el-radio-group v-model="queryParams.templateLimitsType" class="radio-group"> <el-select
<el-radio value="0" style="margin-left: 15px; margin-right: 15px">全部</el-radio> v-model="queryParams.templateType"
<el-radio value="1" style="margin-right: 15px">公共</el-radio> placeholder="请选择模版类别"
<el-radio value="2" style="margin-right: 15px">私有</el-radio> clearable
class="item-width"
>
<el-option label="体检模版" value="体检模版" />
<el-option label="门诊模版" value="门诊模版" />
<el-option label="住院模版" value="住院模版" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="模板类型" prop="templateLimitsType" class="item-style">
<el-radio-group
v-model="queryParams.templateLimitsType"
class="item-width radio-group"
>
<el-radio value="0" style="margin-left: 15px; margin-right: 25px">全部</el-radio>
<el-radio value="1" style="margin-right: 25px">公共</el-radio>
<el-radio value="2">私有</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7" style="text-align: right"> </el-row>
<el-row>
<el-col :offset="16" :span="8" style="text-align: right">
<el-button <el-button
@click="handleQuery" @click="handleQuery"
style="background-color: rgba(56, 119, 246, 1); color: rgba(255, 255, 255, 1)" style="background-color: rgba(56, 119, 246, 1); color: rgba(255, 255, 255, 1)"
@ -70,7 +89,7 @@
:header-cell-style="{ background: 'rgb(235, 241, 250)', height: '40px', color: '#333333' }" :header-cell-style="{ background: 'rgb(235, 241, 250)', height: '40px', color: '#333333' }"
:row-style="{ height: '40px' }" :row-style="{ height: '40px' }"
class="list_templates" class="list_templates"
height="max(calc(100vh - 422px),80px)" height="max(calc(100vh - 464px),80px)"
:tree-props="{ children: 'children' }" :tree-props="{ children: 'children' }"
:row-key=" :row-key="
(row) => { (row) => {
@ -87,13 +106,38 @@
align="left" align="left"
header-align="center" header-align="center"
prop="rowNumIndex" prop="rowNumIndex"
width="140px" min-width="190px"
resizable
/> />
<el-table-column label="节点" align="left" header-align="center" prop="templateName" /> <el-table-column
<el-table-column label="所见" align="center" prop="examDescription" /> label="节点"
<el-table-column label="所得" align="center" prop="diagResults" /> align="left"
<el-table-column label="操作" align="center" fixed="right" width="180px"> header-align="left"
prop="templateName"
min-width="250px"
/>
<el-table-column label="模板类别" align="center" prop="templateType" width="100px" />
<el-table-column label="模板类型" align="center" prop="privateDoctorId" width="100px">
<template #default="scope">
<el-tag
v-if="scope.row.dataType == '0' && !scope.row.privateDoctorId"
effect="plain"
style="width: 74px"
>
公共
</el-tag>
<el-tag
v-else-if="scope.row.dataType == '0' && scope.row.privateDoctorId"
effect="plain"
type="warning"
style="width: 74px"
>
私有
</el-tag>
</template>
</el-table-column>
<el-table-column label="所见" align="left" prop="examDescription" min-width="230px" />
<el-table-column label="所得" align="left" prop="diagResults" min-width="230px" />
<el-table-column label="操作" align="center" fixed="right" width="150px">
<template #default="scope"> <template #default="scope">
<el-button <el-button
link link
@ -154,6 +198,7 @@ const queryParams = ref({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
templateName: '', templateName: '',
templateType: '',
templateLimitsType: '0' templateLimitsType: '0'
}) })
// //
@ -196,6 +241,13 @@ const openForm = async (type: string, id?: any) => {
const handleDelete = async (id: any) => { const handleDelete = async (id: any) => {
try { try {
//
const hasChildren = await DiagnosisTemplateApi.hasChildren(id)
if (hasChildren) {
message.alertWarning('该节点存在子节点,所以不能删除')
return
}
//
await message.delConfirm() await message.delConfirm()
await DiagnosisTemplateApi.delete(id) await DiagnosisTemplateApi.delete(id)
message.success(t('common.delSuccess')) message.success(t('common.delSuccess'))
@ -204,7 +256,7 @@ const handleDelete = async (id: any) => {
} }
const getList = async () => { const getList = async () => {
expandRowKeys.value = [] //expandRowKeys.value = [] //
loading.value = true loading.value = true
try { try {
const data = await DiagnosisTemplateApi.getPage(queryParams.value) const data = await DiagnosisTemplateApi.getPage(queryParams.value)
@ -226,6 +278,7 @@ const resetQuery = async () => {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
templateName: '', templateName: '',
templateType: '',
templateLimitsType: '0' templateLimitsType: '0'
} }
queryFormRef.value?.clearValidate() queryFormRef.value?.clearValidate()
@ -255,7 +308,7 @@ console.log(download)
} }
.item-style { .item-style {
margin-bottom: 6px; margin-bottom: 8px;
} }
.item-width { .item-width {
@ -274,7 +327,7 @@ console.log(download)
--el-table-tr-bg-color: #f2f5f198; --el-table-tr-bg-color: #f2f5f198;
} }
.list_templates :deep(tbody) tr:hover > td { .list_templates :deep(tbody) tr:not(.grey-row):hover > td {
background-color: transparent !important; background-color: #ffffff !important;
} }
</style> </style>