|
|
|
|
@ -344,14 +344,12 @@
|
|
|
|
|
<el-table-column
|
|
|
|
|
:label="t('EquipmentManagement.EquipmentLedger.deviceType')"
|
|
|
|
|
align="center"
|
|
|
|
|
prop="deviceType"
|
|
|
|
|
prop="typeName"
|
|
|
|
|
min-width="110px"
|
|
|
|
|
sortable
|
|
|
|
|
>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag effect="light">
|
|
|
|
|
{{ getDeviceTypeName(scope.row.typeName ?? scope.row.deviceType) }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
<el-tag effect="light">{{ scope.row.typeName || '-' }}</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
@ -735,20 +733,8 @@ const typeTreeProps = { label: 'name', children: 'children' }
|
|
|
|
|
const treeSelectProps = { label: 'name', children: 'children' }
|
|
|
|
|
const typeTreeExpandedKeys = ref<number[]>([])
|
|
|
|
|
const deviceTypeTree = ref<DeviceTypeTreeVO[]>([])
|
|
|
|
|
const deviceTypeNameMap = ref<Record<string, string>>({})
|
|
|
|
|
const ALL_TYPE_NODE_ID = -1
|
|
|
|
|
|
|
|
|
|
const buildDeviceTypeNameMap = (nodes: DeviceTypeTreeVO[]) => {
|
|
|
|
|
const map: Record<string, string> = {}
|
|
|
|
|
const stack = [...nodes]
|
|
|
|
|
while (stack.length) {
|
|
|
|
|
const node = stack.pop()!
|
|
|
|
|
if (node.id != null) map[String(node.id)] = node.name
|
|
|
|
|
if (Array.isArray(node.children) && node.children.length) stack.push(...node.children)
|
|
|
|
|
}
|
|
|
|
|
deviceTypeNameMap.value = map
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isAllTypeNode = (node: any) => Number(node?.id) === ALL_TYPE_NODE_ID
|
|
|
|
|
|
|
|
|
|
const buildTypeTreeWithAll = (nodes: DeviceLineTreeVO[]) => {
|
|
|
|
|
@ -785,7 +771,6 @@ const getDeviceTypeTree = async () => {
|
|
|
|
|
const data = await DeviceTypeApi.getDeviceTypeTree({})
|
|
|
|
|
const treeData = JSON.parse(JSON.stringify(data ?? []))
|
|
|
|
|
deviceTypeTree.value = treeData
|
|
|
|
|
buildDeviceTypeNameMap(treeData)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleTypeNodeClick = (node: any) => {
|
|
|
|
|
@ -972,11 +957,7 @@ const buildTreeQrcodePrintData = () => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getDeviceTypeName = (value: any) => {
|
|
|
|
|
const id = String(value ?? '')
|
|
|
|
|
if (deviceTypeNameMap.value[id]) return deviceTypeNameMap.value[id]
|
|
|
|
|
return value ?? ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const formatScheduleLabel = (value: any) => {
|
|
|
|
|
return Number(value) === 1
|
|
|
|
|
|