|
|
@@ -316,18 +316,18 @@ import {
|
|
|
// ==================== 选项配置 ====================
|
|
|
const typeList = ref([])
|
|
|
const typeOptions = computed(() => {
|
|
|
- return typeList.value.map(item => ({ label: item.typeName, value: item.typeId }))
|
|
|
+ return typeList.value.map(item => ({ label: item.typeName, value: item.id }))
|
|
|
})
|
|
|
|
|
|
const drainageTypeOptions = computed(() => {
|
|
|
- // 找到排水父类记录(typeId为'drainage'且parentTypeId为'0')
|
|
|
- const drainageParent = typeList.value.find(item => item.typeId === 'drainage' && item.parentTypeId === '0')
|
|
|
+ // 找到排水父类记录(主键 id=2 且 parentId 为 0)
|
|
|
+ const drainageParent = typeList.value.find(item => Number(item.id) === 2 && String(item.parentId) === '0')
|
|
|
if (!drainageParent) {
|
|
|
// 如果找不到父类,返回所有非顶级的类型
|
|
|
- return typeList.value.filter(item => item.parentTypeId !== '0' && item.parentTypeId !== null).map(item => ({ label: item.typeName, value: item.id }))
|
|
|
+ return typeList.value.filter(item => item.parentId !== null && String(item.parentId) !== '0').map(item => ({ label: item.typeName, value: item.id }))
|
|
|
}
|
|
|
- // 返回parentTypeId等于drainage父类id的子类型
|
|
|
- return typeList.value.filter(item => String(item.parentTypeId) === String(drainageParent.id)).map(item => ({ label: item.typeName, value: item.id }))
|
|
|
+ // 返回parentId等于drainage父类id的子类型
|
|
|
+ return typeList.value.filter(item => String(item.parentId) === String(drainageParent.id)).map(item => ({ label: item.typeName, value: item.id }))
|
|
|
})
|
|
|
|
|
|
const statusOptions = [
|
|
|
@@ -339,7 +339,7 @@ const statusOptions = [
|
|
|
]
|
|
|
|
|
|
function typeText(val) {
|
|
|
- const item = typeList.value.find(t => t.typeId === val)
|
|
|
+ const item = typeList.value.find(t => String(t.id) === String(val))
|
|
|
return item ? item.typeName : '-'
|
|
|
}
|
|
|
|
|
|
@@ -409,9 +409,9 @@ async function loadTypeList() {
|
|
|
try {
|
|
|
const res = await getEquipmentTypeList()
|
|
|
typeList.value = (res.code !== undefined ? res.data : res) || []
|
|
|
- // 分页接口要求传 equipment_type.id,不能传业务编码 drainage。
|
|
|
+ // 分页接口要求传 equipment_type.id(2=排水设备)
|
|
|
const drainageParent = typeList.value.find(item =>
|
|
|
- item.typeId === 'drainage' && String(item.parentTypeId) === '0'
|
|
|
+ Number(item.id) === 2 && String(item.parentId) === '0'
|
|
|
)
|
|
|
queryParams.value.equipmentTypeId = drainageParent ? String(drainageParent.id) : ''
|
|
|
} catch (error) {
|