diff --git a/src/api/applyregistration/diagnosisTemplate/index.ts b/src/api/applyregistration/diagnosisTemplate/index.ts
index c296ad3c..86305456 100644
--- a/src/api/applyregistration/diagnosisTemplate/index.ts
+++ b/src/api/applyregistration/diagnosisTemplate/index.ts
@@ -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 })
diff --git a/src/views/applyregistration/diagnosisTemplate/DiagnosisTemplateForm.vue b/src/views/applyregistration/diagnosisTemplate/DiagnosisTemplateForm.vue
index 76a13be1..6cd0506b 100644
--- a/src/views/applyregistration/diagnosisTemplate/DiagnosisTemplateForm.vue
+++ b/src/views/applyregistration/diagnosisTemplate/DiagnosisTemplateForm.vue
@@ -13,13 +13,15 @@
>
-
+
- 节点
+
+ 节点
+
诊断模版
@@ -27,11 +29,31 @@
+
+
+
+
+
+ 根节点
+
+
+ 普通节点
+
+
+
+
+
- 公有
+
+ 公有
+
私有
@@ -91,22 +113,57 @@
-
-
+
-
-
+ />
+
+
+
+
+
+
+
@@ -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([])
const doctorList = ref([])
const templateList = ref([])
-const parentTemplateInfo = ref()
+const rootType = ref('')
const templateLimitsType = ref('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') {
diff --git a/src/views/applyregistration/diagnosisTemplate/index.vue b/src/views/applyregistration/diagnosisTemplate/index.vue
index 225b63c0..db32c6fe 100644
--- a/src/views/applyregistration/diagnosisTemplate/index.vue
+++ b/src/views/applyregistration/diagnosisTemplate/index.vue
@@ -8,7 +8,7 @@
label-width="78px"
label-position="right"
label-suffix=""
- class="-mb-15px"
+ class="-mb-8px"
>
@@ -22,15 +22,34 @@
-
-
- 全部
- 公共
- 私有
+
+
+
+
+
+
+
+
+
+
+
+ 全部
+ 公共
+ 私有
-
+
+
+
-
-
-
-
+
+
+
+
+
+ 公共
+
+
+ 私有
+
+
+
+
+
+
{
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;
}