诊断模板
This commit is contained in:
parent
51eed6510f
commit
b660ad87e5
@ -6,17 +6,20 @@ import request from '@/config/axios'
|
||||
*/
|
||||
export const DiagnosisTemplateApi = {
|
||||
/* 测试方法 */
|
||||
getOrgList: async () => {
|
||||
getOrgList: async () => {
|
||||
return await request.get({ url: `/org/org/getlist` })
|
||||
},
|
||||
getDoctorList: async () => {
|
||||
getDoctorList: async () => {
|
||||
return await request.get({ url: `/doctor/getlist` })
|
||||
},
|
||||
getPage: async (params: any) => {
|
||||
getPage: async (params: any) => {
|
||||
return await request.get({ url: `/system/reporttemplate/page`, params })
|
||||
},
|
||||
getAllList: async () => {
|
||||
return await request.get({ url: `/system/reporttemplate/getlist` })
|
||||
getRootTree: async () => {
|
||||
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) => {
|
||||
return await request.get({ url: `/system/reporttemplate/get?id=`+ id })
|
||||
|
@ -13,13 +13,15 @@
|
||||
>
|
||||
<el-row>
|
||||
<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
|
||||
v-model="formData.dataType"
|
||||
:disabled="dataType_disabled"
|
||||
@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">
|
||||
<div style="width: 60px; text-align: left">诊断模版</div>
|
||||
</el-radio-button>
|
||||
@ -27,11 +29,31 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</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-col :span="12">
|
||||
<el-form-item label="模版类型" class="item-style">
|
||||
<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">
|
||||
<div style="width: 60px; text-align: left">私有</div>
|
||||
</el-radio-button>
|
||||
@ -91,22 +113,57 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" v-if="formData.dataType == '0'">
|
||||
<el-form-item label="父节点" prop="pid" class="item-style">
|
||||
<el-select
|
||||
v-model="parentTemplateInfo"
|
||||
value-key="id"
|
||||
placeholder="请选择父节点"
|
||||
<el-form-item label="上级节点" prop="pid" class="item-style">
|
||||
<el-tree-select
|
||||
ref="parentTreeRef"
|
||||
:data="templateList"
|
||||
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"
|
||||
@change="pid_change"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in templateList"
|
||||
:key="item.id"
|
||||
:label="item.templateName"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
/>
|
||||
</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
|
||||
class="item-width"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -175,6 +232,8 @@ const emit = defineEmits(['success'])
|
||||
|
||||
/** 组件引用 **/
|
||||
const formRef = ref()
|
||||
const parentTreeRef = ref()
|
||||
const parentTreeRef_root = ref()
|
||||
|
||||
/** 数据结构 **/
|
||||
const message = useMessage()
|
||||
@ -186,7 +245,7 @@ const formType = ref('')
|
||||
const orgList = ref<any[]>([])
|
||||
const doctorList = ref<any[]>([])
|
||||
const templateList = ref<any[]>([])
|
||||
const parentTemplateInfo = ref<any>()
|
||||
const rootType = ref('')
|
||||
const templateLimitsType = ref<any>('2')
|
||||
const dataType_disabled = ref(false)
|
||||
//表单核心
|
||||
@ -221,50 +280,70 @@ const resetForm = () => {
|
||||
updateTime: undefined,
|
||||
orgId: ''
|
||||
}
|
||||
parentTemplateInfo.value = undefined
|
||||
rootType.value = ''
|
||||
templateLimitsType.value = '2'
|
||||
formRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
orgList.value = await DiagnosisTemplateApi.getOrgList()
|
||||
doctorList.value = await DiagnosisTemplateApi.getDoctorList()
|
||||
templateList.value = await DiagnosisTemplateApi.getAllList()
|
||||
if (id) {
|
||||
try {
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = await DiagnosisTemplateApi.get(id)
|
||||
formData.value = data
|
||||
if (data && !data.privateDoctorId) templateLimitsType.value = '1'
|
||||
parentTemplateInfo.value = templateList.value?.find((item) => {
|
||||
return item?.id && formData.value?.pid && item.id == formData.value.pid
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
orgList.value = await DiagnosisTemplateApi.getOrgList()
|
||||
doctorList.value = await DiagnosisTemplateApi.getDoctorList()
|
||||
const rootTree = await DiagnosisTemplateApi.getRootTree()
|
||||
if (rootTree && Array.isArray(rootTree) && rootTree.length > 0) {
|
||||
rootTree.forEach((item) => {
|
||||
if (item) item.isFirstRoot = true
|
||||
})
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
templateList.value = rootTree
|
||||
if (id) {
|
||||
try {
|
||||
const data = await DiagnosisTemplateApi.get(id)
|
||||
formData.value = data
|
||||
if (data && !data.privateDoctorId) templateLimitsType.value = '1'
|
||||
if (data && data.dataType && data.dataType.trim() == '1') {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
dataType_disabled.value = true && !!formData.value?.id
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
dataType_disabled.value = true && !!formData.value?.id
|
||||
}
|
||||
|
||||
/****** 可参考内容 ******/
|
||||
/** 组件事件 **/
|
||||
const pid_change = async (value: any) => {
|
||||
formData.value.pid = value ? value.id : ''
|
||||
}
|
||||
|
||||
const dataType_change = () => {
|
||||
formData.value.pid = ''
|
||||
if (formData.value?.dataType == '1') {
|
||||
rootType.value = '0'
|
||||
templateLimitsType.value = '2'
|
||||
formData.value.privateDoctorId = ''
|
||||
formData.value.pid = '0'
|
||||
formData.value.examDescription = ''
|
||||
formData.value.diagResults = ''
|
||||
} else if (formData.value?.dataType == '0') {
|
||||
rootType.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
const root_change = () => {
|
||||
if (rootType.value == '0') {
|
||||
formData.value.pid = ''
|
||||
} else if (rootType.value == '1') {
|
||||
formData.value.pid = '0'
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,22 +365,40 @@ const submitForm = async () => {
|
||||
return
|
||||
}
|
||||
if (data.dataType && data.dataType == '0') {
|
||||
if (templateLimitsType.value == '2' && !data.privateDoctorId) {
|
||||
await message.alertWarning('请选择医生')
|
||||
if (!data.pid) {
|
||||
await message.alertWarning('请选择上级节点')
|
||||
return
|
||||
}
|
||||
if (!data.pid || !parentTemplateInfo.value) {
|
||||
await message.alertWarning('请选择父节点')
|
||||
if (templateLimitsType.value == '2' && !data.privateDoctorId) {
|
||||
await message.alertWarning('请选择医生')
|
||||
return
|
||||
}
|
||||
if (templateLimitsType.value == '1') {
|
||||
data.privateDoctorId = ''
|
||||
}
|
||||
if (parentTemplateInfo.value) {
|
||||
data.examPart = parentTemplateInfo.value.examPart
|
||||
if (
|
||||
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') {
|
||||
data.examPart = data.templateName
|
||||
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
|
||||
}
|
||||
}
|
||||
//更新
|
||||
if (formType.value === 'create') {
|
||||
|
@ -8,7 +8,7 @@
|
||||
label-width="78px"
|
||||
label-position="right"
|
||||
label-suffix=""
|
||||
class="-mb-15px"
|
||||
class="-mb-8px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
@ -22,15 +22,34 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="模版类型" prop="templateLimitsType" class="item-style">
|
||||
<el-radio-group v-model="queryParams.templateLimitsType" class="radio-group">
|
||||
<el-radio value="0" style="margin-left: 15px; margin-right: 15px">全部</el-radio>
|
||||
<el-radio value="1" style="margin-right: 15px">公共</el-radio>
|
||||
<el-radio value="2" style="margin-right: 15px">私有</el-radio>
|
||||
<el-form-item label="模版类别" prop="templateType" class="item-style">
|
||||
<el-select
|
||||
v-model="queryParams.templateType"
|
||||
placeholder="请选择模版类别"
|
||||
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-form-item>
|
||||
</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
|
||||
@click="handleQuery"
|
||||
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' }"
|
||||
:row-style="{ height: '40px' }"
|
||||
class="list_templates"
|
||||
height="max(calc(100vh - 422px),80px)"
|
||||
height="max(calc(100vh - 464px),80px)"
|
||||
:tree-props="{ children: 'children' }"
|
||||
:row-key="
|
||||
(row) => {
|
||||
@ -87,13 +106,38 @@
|
||||
align="left"
|
||||
header-align="center"
|
||||
prop="rowNumIndex"
|
||||
width="140px"
|
||||
resizable
|
||||
min-width="190px"
|
||||
/>
|
||||
<el-table-column label="节点" align="left" header-align="center" prop="templateName" />
|
||||
<el-table-column label="所见" align="center" prop="examDescription" />
|
||||
<el-table-column label="所得" align="center" prop="diagResults" />
|
||||
<el-table-column label="操作" align="center" fixed="right" width="180px">
|
||||
<el-table-column
|
||||
label="节点"
|
||||
align="left"
|
||||
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">
|
||||
<el-button
|
||||
link
|
||||
@ -154,6 +198,7 @@ const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
templateName: '',
|
||||
templateType: '',
|
||||
templateLimitsType: '0'
|
||||
})
|
||||
//表格核心
|
||||
@ -196,6 +241,13 @@ const openForm = async (type: string, id?: any) => {
|
||||
|
||||
const handleDelete = async (id: any) => {
|
||||
try {
|
||||
//校验
|
||||
const hasChildren = await DiagnosisTemplateApi.hasChildren(id)
|
||||
if (hasChildren) {
|
||||
message.alertWarning('该节点存在子节点,所以不能删除')
|
||||
return
|
||||
}
|
||||
//删除
|
||||
await message.delConfirm()
|
||||
await DiagnosisTemplateApi.delete(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
@ -204,7 +256,7 @@ const handleDelete = async (id: any) => {
|
||||
}
|
||||
|
||||
const getList = async () => {
|
||||
expandRowKeys.value = []
|
||||
//expandRowKeys.value = [] //搜索数据闭合显示
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await DiagnosisTemplateApi.getPage(queryParams.value)
|
||||
@ -226,6 +278,7 @@ const resetQuery = async () => {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
templateName: '',
|
||||
templateType: '',
|
||||
templateLimitsType: '0'
|
||||
}
|
||||
queryFormRef.value?.clearValidate()
|
||||
@ -255,7 +308,7 @@ console.log(download)
|
||||
}
|
||||
|
||||
.item-style {
|
||||
margin-bottom: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.item-width {
|
||||
@ -274,7 +327,7 @@ console.log(download)
|
||||
--el-table-tr-bg-color: #f2f5f198;
|
||||
}
|
||||
|
||||
.list_templates :deep(tbody) tr:hover > td {
|
||||
background-color: transparent !important;
|
||||
.list_templates :deep(tbody) tr:not(.grey-row):hover > td {
|
||||
background-color: #ffffff !important;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user