This commit is contained in:
sjl
2025-02-11 14:25:12 +08:00
parent b3aeebb7c7
commit ddeb84fcfe
2 changed files with 51 additions and 37 deletions

View File

@@ -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 }

View File

@@ -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<ProTableInstance>()
const devTypePopup = ref()
const icdOptions = ref<ICD.ResICD[]>([])
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 <span>{name?.name}</span>
},
},
{
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<DevType.ResPqDevType> = {}) => {
devTypePopup.value?.open(titleType, row)
devTypePopup.value?.open(titleType, row,icdOptions.value)
}
@@ -144,5 +153,21 @@
}
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,
}))
})
</script>