diff --git a/src/views/system/dept/editDept.vue b/src/views/system/dept/editDept.vue index aaf7291..ab6fe72 100644 --- a/src/views/system/dept/editDept.vue +++ b/src/views/system/dept/editDept.vue @@ -7,6 +7,7 @@ import { addDept, getDeptTypeList, updateDept } from '@/api/system/dept' import useDictStore from '@/store/modules/dict' import DeptSelect from '@/components/DeptSelect/index.vue' +import { getDictByCode } from '@/api/system/dict' // ----------------------- 以下是字段定义 emits props --------------------- const emits = defineEmits(['closeRefresh']) @@ -128,7 +129,14 @@ }) } getDeptType() - +const deptTypeList1 = ref([]) +const fetchDict = () => { + getDictByCode('eqptDeviceType').then(res => { + // console.log(res.data, '111') + deptTypeList1.value = res.data + }) +} +fetchDict() // ----------初始化、关闭对话框相关----------------- function initDialog(dialogstatus: string, row: DeptInfo) { dialogStatus.value = dialogstatus @@ -213,8 +221,11 @@ - - + + + + + diff --git a/src/views/system/dept/editDept.vue b/src/views/system/dept/editDept.vue index aaf7291..ab6fe72 100644 --- a/src/views/system/dept/editDept.vue +++ b/src/views/system/dept/editDept.vue @@ -7,6 +7,7 @@ import { addDept, getDeptTypeList, updateDept } from '@/api/system/dept' import useDictStore from '@/store/modules/dict' import DeptSelect from '@/components/DeptSelect/index.vue' +import { getDictByCode } from '@/api/system/dict' // ----------------------- 以下是字段定义 emits props --------------------- const emits = defineEmits(['closeRefresh']) @@ -128,7 +129,14 @@ }) } getDeptType() - +const deptTypeList1 = ref([]) +const fetchDict = () => { + getDictByCode('eqptDeviceType').then(res => { + // console.log(res.data, '111') + deptTypeList1.value = res.data + }) +} +fetchDict() // ----------初始化、关闭对话框相关----------------- function initDialog(dialogstatus: string, row: DeptInfo) { dialogStatus.value = dialogstatus @@ -213,8 +221,11 @@ - - + + + + + diff --git a/src/views/system/dept/listDept.vue b/src/views/system/dept/listDept.vue index 95dd3c2..82e6d0d 100644 --- a/src/views/system/dept/listDept.vue +++ b/src/views/system/dept/listDept.vue @@ -7,7 +7,7 @@ import SystemEditDept from './editDept.vue' import { delDept, getDeptList } from '@/api/system/dept' import { toTreeList } from '@/utils/structure' - +import { getDictByCode } from '@/api/system/dict' const { proxy } = getCurrentInstance() as any // 默认查询条件 @@ -16,6 +16,7 @@ // } // 查询条件 const listQuery = reactive({ deptName: '' }) +const deptTypeList = ref([]) // 搜索重置 // function reset() { // Object.assign(listQuery, defaultQuery) @@ -25,7 +26,7 @@ const columns = ref([ { text: '组织名称', value: 'simpleName', align: 'left' }, { text: '组织全称', value: 'fullName' }, - { text: '备注', value: 'tips' }, + { text: '部门分类', value: 'tipsName' }, { text: '排序', value: 'num', width: 80, align: 'center' }, ]) // 数据列表 @@ -41,7 +42,10 @@ loading.value = true console.log(listQuery, 'listQuery') getDeptList(listQuery).then((res) => { - const treeData = toTreeList(res.data.list, '0', false) + const treeData = toTreeList(res.data.list.map((item:any) => ({ + ...item, + tipsName: deptTypeList.value.filter(citem => citem.value === item.tips)[0]?.name || '' + })), '0', false) list.value = treeData loading.value = false }) @@ -91,7 +95,12 @@ }) } -onMounted(() => { +const fetch = async () => { + const res = await getDictByCode('eqptDeviceType') + deptTypeList.value = res.data +} +onMounted(async () => { + await fetch() fetchData() })