|
|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-dialog v-model="dialogVisible" title="排班信息" width="30%" @close="close()">
|
|
|
|
|
<el-dialog v-model="dialogVisible" title="排班信息" width="calc(40% + 80px)" @close="close()">
|
|
|
|
|
<el-form :model="ResourcesInfo" label-width="110px" v-loading="loading" style="padding-right: 40px;">
|
|
|
|
|
<el-form-item label="所属科室:" v-if="!departmentId">
|
|
|
|
|
<el-select :filterable="true" clearable v-model="ResourcesInfo.department_id" placeholder="选择科室">
|
|
|
|
|
<el-select :filterable="true" clearable v-model="ResourcesInfo.department_id" placeholder="选择科室" @change="onDepartmentChange">
|
|
|
|
|
<el-option v-for="(item,index) in EnableDepartmentList" :key="index" :label="item.department_name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
@ -62,6 +62,13 @@
|
|
|
|
|
注意:调整时令,会影响该资源下全部模板
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="执行诊室:" v-if="showExecDeptSelect">
|
|
|
|
|
<el-select v-model="ResourcesInfo.execute_department_id" clearable filterable
|
|
|
|
|
placeholder="请选择执行诊室" style="width: 100%;">
|
|
|
|
|
<el-option v-for="item in childrenDeptList" :key="item.id"
|
|
|
|
|
:label="item.department_name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
@ -82,7 +89,8 @@
|
|
|
|
|
} from 'vue'
|
|
|
|
|
import {
|
|
|
|
|
GetFilteredDepartmentList,
|
|
|
|
|
SaveDepartmentResource
|
|
|
|
|
SaveDepartmentResource,
|
|
|
|
|
GetChildrenDepartments
|
|
|
|
|
} from '@/api/api.js'
|
|
|
|
|
import {
|
|
|
|
|
ElMessage
|
|
|
|
|
@ -90,6 +98,9 @@
|
|
|
|
|
import { Delete } from '@element-plus/icons-vue'
|
|
|
|
|
let loading=ref(false);
|
|
|
|
|
let dialogVisible=ref(true);
|
|
|
|
|
let childrenDeptList = ref([])
|
|
|
|
|
let cachedExecuteDeptId = ref(null)
|
|
|
|
|
let showExecDeptSelect = ref(true)
|
|
|
|
|
let ResourcesInfo=ref({
|
|
|
|
|
id:null,
|
|
|
|
|
department_id:null,
|
|
|
|
|
@ -98,7 +109,8 @@
|
|
|
|
|
department_resources_addr:'',
|
|
|
|
|
time_mode: 0, // 0关闭 1开启
|
|
|
|
|
time_range: [], // 时令数据
|
|
|
|
|
appointment_enabled: 1 // 是否参与预约
|
|
|
|
|
appointment_enabled: 1, // 是否参与预约
|
|
|
|
|
execute_department_id: null
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 时令数据
|
|
|
|
|
@ -201,6 +213,9 @@
|
|
|
|
|
periods: convertPeriodsToObjects(season.periods)
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
if (ResourcesInfo.value.execute_department_id === null) {
|
|
|
|
|
ResourcesInfo.value.execute_department_id = 0
|
|
|
|
|
}
|
|
|
|
|
loading.value = true
|
|
|
|
|
SaveDepartmentResource({info:ResourcesInfo.value}).then(res => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
@ -222,6 +237,31 @@
|
|
|
|
|
const close = () => {
|
|
|
|
|
emit('closeAddResources')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadChildrenDepts = (deptId) => {
|
|
|
|
|
if (!deptId) return
|
|
|
|
|
GetChildrenDepartments({ department_id: deptId }).then(res => {
|
|
|
|
|
if (res.status) {
|
|
|
|
|
childrenDeptList.value = res.data.list
|
|
|
|
|
if (!res.data.list || res.data.list.length === 0) {
|
|
|
|
|
showExecDeptSelect.value = false
|
|
|
|
|
ResourcesInfo.value.execute_department_id = null
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
showExecDeptSelect.value = true
|
|
|
|
|
const hasCached = cachedExecuteDeptId.value !== null &&
|
|
|
|
|
res.data.list.some(item => item.id === cachedExecuteDeptId.value)
|
|
|
|
|
if (hasCached) {
|
|
|
|
|
ResourcesInfo.value.execute_department_id = cachedExecuteDeptId.value
|
|
|
|
|
} else {
|
|
|
|
|
ResourcesInfo.value.execute_department_id = null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const onDepartmentChange = (newDeptId) => {
|
|
|
|
|
loadChildrenDepts(newDeptId)
|
|
|
|
|
}
|
|
|
|
|
const isNotNullOrEmpty=(str)=> {
|
|
|
|
|
return str !== null && str !== '';
|
|
|
|
|
}
|
|
|
|
|
@ -238,6 +278,8 @@
|
|
|
|
|
ResourcesInfo.value.department_resources_addr=props.resourceInfo.department_resources_addr
|
|
|
|
|
ResourcesInfo.value.department_resources_status=props.resourceInfo.department_resources_status
|
|
|
|
|
ResourcesInfo.value.appointment_enabled=props.resourceInfo.appointment_enabled ?? 1
|
|
|
|
|
ResourcesInfo.value.execute_department_id=props.resourceInfo.execute_department_id
|
|
|
|
|
cachedExecuteDeptId.value=props.resourceInfo.execute_department_id
|
|
|
|
|
|
|
|
|
|
// 加载时令数据
|
|
|
|
|
ResourcesInfo.value.time_mode = props.resourceInfo.time_mode || 0
|
|
|
|
|
@ -252,6 +294,7 @@
|
|
|
|
|
}
|
|
|
|
|
ResourcesInfo.value.department_id=r_departmentId
|
|
|
|
|
|
|
|
|
|
loadChildrenDepts(r_departmentId)
|
|
|
|
|
GetDepartmentEnableList();
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|