修改科室管理和新增科室分类的字典

This commit is contained in:
叶锦涛
2025-11-11 16:46:36 +08:00
parent 3e32458b7f
commit 215fe8b889
2 changed files with 22 additions and 12 deletions

View File

@@ -41,7 +41,7 @@ export function getOrgDetail(id) {
export function initOrgTypeOption() { export function initOrgTypeOption() {
return request({ return request({
url: '/base-data-manage/organization/init', url: '/base-data-manage/organization/init',
method: 'get', method: 'get'
}) })
} }

View File

@@ -141,15 +141,7 @@
</template> </template>
<script setup name="Organization"> <script setup name="Organization">
import { import { getList, deleteOrganization, addOrganization, updateOrganization, disableOrg, initOrgTypeOption, enableOrg } from './components/api';
getList,
deleteOrganization,
addOrganization,
updateOrganization,
disableOrg,
initOrgTypeOption,
enableOrg,
} from './components/api';
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const loading = ref(true); const loading = ref(true);
@@ -181,11 +173,29 @@ const rules = ref({
getPageList(); getPageList();
initOption(); initOption();
// 使用系统标准字典获取方法
const { organization_class } = proxy.useDict('organization_class');
// 监听字典数据变化
watch(() => organization_class.value, (newVal) => {
if (newVal && newVal.length > 0) {
// 转换为组件需要的格式使用dict_label作为label
classEnumOption.value = newVal.map(item => ({
value: item.value,
info: item.label // 使用dict_label的值作为显示文本
}));
}
}, { immediate: true });
function initOption() { function initOption() {
if (orgTypeOption.value.length == 0) { if (orgTypeOption.value.length == 0) {
initOrgTypeOption().then((res) => { initOrgTypeOption().then((res) => {
orgTypeOption.value = res.data.organizationTypeOptions; orgTypeOption.value = res.data.organizationTypeOptions;
classEnumOption.value = res.data.organizationClassOptions; // 科室分类优先使用字典数据,如果没有再使用接口返回的数据
if (!classEnumOption.value || classEnumOption.value.length === 0) {
classEnumOption.value = res.data.organizationClassOptions || [];
}
}); });
} }
} }
@@ -205,7 +215,7 @@ function getPageList() {
} }
function handleAdd() { function handleAdd() {
title.value = '添加药库药房'; title.value = '添加科室';
open.value = true; open.value = true;
reset(); reset();
console.log(form.value); console.log(form.value);