diff --git a/frontend/src/views/machine/devType/components/devTypePopup.vue b/frontend/src/views/machine/devType/components/devTypePopup.vue index ff1f00f..595f625 100644 --- a/frontend/src/views/machine/devType/components/devTypePopup.vue +++ b/frontend/src/views/machine/devType/components/devTypePopup.vue @@ -193,24 +193,13 @@ const close = () => { } // 打开弹窗,可能是新增,也可能是编辑 - const open = async (sign: string, data: DevType.ResPqDevType) => { + const open = async (sign: string, data: DevType.ResPqDevType,icd: ICD.ResICD[]) => { // 重置表单 dialogFormRef.value?.resetFields() titleType.value = sign dialogVisible.value = true - const response = await getICDAllList({ - id: '', - name: '', - path: '', - state: 1 - }) - icdOptions.value = (response.data as ICD.ResICD[]).map(item => ({ - id: item.id, - name: item.name, - path: item.path, - state: item.state, - })) + icdOptions.value = icd if (data.id) { formContent.value = { ...data } diff --git a/frontend/src/views/machine/devType/index.vue b/frontend/src/views/machine/devType/index.vue index 44a67bb..f55be32 100644 --- a/frontend/src/views/machine/devType/index.vue +++ b/frontend/src/views/machine/devType/index.vue @@ -41,25 +41,23 @@ getDevTypeList, deleteDevType, } from '@/api/device/devType/index.ts' - import { reactive, ref } from 'vue' + import { onBeforeMount, reactive, ref } from 'vue' import { useModeStore, useAppSceneStore } from '@/stores/modules/mode' +import { getICDAllList } from '@/api/device/icd' +import type { ICD } from '@/api/device/interface/icd' - defineOptions({ - name: 'devType', - }) + // defineOptions({ + // name: 'devType', + // }) const modeStore = useModeStore() const dictStore = useDictStore() // ProTable 实例 const proTable = ref() const devTypePopup = ref() - + const icdOptions = ref([]) const getTableList = async (params: any) => { let newParams = JSON.parse(JSON.stringify(params)) - // newParams.searchEndTime = endDate.value - // newParams.searchBeginTime = startDate.value - // const patternId = dictStore.getDictData('Pattern').find(item => item.name === modeStore.currentMode)?.id//获取数据字典中对应的id - // newParams.pattern = patternId return getDevTypeList(newParams) } @@ -72,25 +70,42 @@ prop: 'name', label: '名称', search: { el: 'input' }, - minWidth: 200, + minWidth: 150, + }, + { + prop: 'power', + label: '工作电源', + minWidth: 150, }, { prop: 'devChns', label: '通道数', - minWidth: 110, - + minWidth: 100, }, { prop: 'devVolt', label: '额定电压(V)', - minWidth: 130, - + minWidth: 100, }, { prop: 'devCurr', label: '额定电流(A)', - minWidth: 130, - + minWidth: 100, + }, + { + prop: 'reportName', + label: '报告模版名称', + minWidth: 150, + }, + { + prop: 'icd', + label: '设备关联ICD', + minWidth: 200, + render: (scope) => { + // 查找ICD名称 + const name = icdOptions.value.find(option => option.id === scope.row.icd) + return {name?.name} + }, }, { prop: 'createTime', @@ -114,16 +129,10 @@ ]) - // 处理日期变化的回调函数 - const startDate = ref('') - const endDate = ref('') - const handleDateChange = (startDateTemp: string, endDateTemp: string) => { - startDate.value = startDateTemp - endDate.value = endDateTemp - } + // 打开 drawer(新增、编辑) const openDialog = (titleType: string, row: Partial = {}) => { - devTypePopup.value?.open(titleType, row) + devTypePopup.value?.open(titleType, row,icdOptions.value) } @@ -143,6 +152,22 @@ proTable.value?.getTableList() } + + + onBeforeMount(async () => { + const response = await getICDAllList({ + id: '', + name: '', + path: '', + state: 1 + }) + icdOptions.value = (response.data as ICD.ResICD[]).map(item => ({ + id: item.id, + name: item.name, + path: item.path, + state: item.state, + })) +}) \ No newline at end of file