|
|
|
|
@ -350,7 +350,7 @@
|
|
|
|
|
>
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag effect="light">
|
|
|
|
|
{{ getDeviceTypeName(scope.row.deviceTypeName ?? scope.row.deviceType) }}
|
|
|
|
|
{{ getDeviceTypeName(scope.row.typeName ?? scope.row.deviceType) }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
@ -677,7 +677,7 @@ const { t } = useI18n() // 国际化
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const list = ref<DeviceLedgerVO[]>([]) // 列表的数据
|
|
|
|
|
const total = ref(0) // 列表的总页数
|
|
|
|
|
const selectedDeviceLineId = ref<number | undefined>(undefined)
|
|
|
|
|
const selectedDeviceLineId = ref<string | undefined>(undefined)
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
@ -687,8 +687,8 @@ const queryParams = reactive({
|
|
|
|
|
deviceBrand: undefined,
|
|
|
|
|
sn: undefined,
|
|
|
|
|
outgoingTime: undefined,
|
|
|
|
|
deviceType: undefined as number | undefined,
|
|
|
|
|
deviceLine: undefined as number | undefined
|
|
|
|
|
deviceType: undefined as string | undefined,
|
|
|
|
|
deviceLine: undefined as string | undefined
|
|
|
|
|
})
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const exportLoading = ref(false)
|
|
|
|
|
@ -705,7 +705,7 @@ const updatePlanTableMaxHeight = async () => {
|
|
|
|
|
const availableHeight = window.innerHeight - tableTop - paginationHeight - pageBottomGap
|
|
|
|
|
planTableMaxHeight.value = Math.min(window.innerHeight, Math.max(240, Math.floor(availableHeight)))
|
|
|
|
|
}
|
|
|
|
|
const selectedIds = ref<number[]>([])
|
|
|
|
|
const selectedIds = ref<string[]>([])
|
|
|
|
|
const handleSelectionChange = (rows: any[]) => {
|
|
|
|
|
selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? []
|
|
|
|
|
}
|
|
|
|
|
@ -735,15 +735,15 @@ const typeTreeProps = { label: 'name', children: 'children' }
|
|
|
|
|
const treeSelectProps = { label: 'name', children: 'children' }
|
|
|
|
|
const typeTreeExpandedKeys = ref<number[]>([])
|
|
|
|
|
const deviceTypeTree = ref<DeviceTypeTreeVO[]>([])
|
|
|
|
|
const deviceTypeNameMap = ref<Record<number, string>>({})
|
|
|
|
|
const deviceTypeNameMap = ref<Record<string, string>>({})
|
|
|
|
|
const ALL_TYPE_NODE_ID = -1
|
|
|
|
|
|
|
|
|
|
const buildDeviceTypeNameMap = (nodes: DeviceTypeTreeVO[]) => {
|
|
|
|
|
const map: Record<number, string> = {}
|
|
|
|
|
const map: Record<string, string> = {}
|
|
|
|
|
const stack = [...nodes]
|
|
|
|
|
while (stack.length) {
|
|
|
|
|
const node = stack.pop()!
|
|
|
|
|
if (typeof node.id === 'number') map[node.id] = node.name
|
|
|
|
|
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
|
|
|
|
|
@ -809,7 +809,7 @@ const treeFormLoading = ref(false)
|
|
|
|
|
const treeFormMode = ref<'create' | 'update'>('create')
|
|
|
|
|
const treeFormRef = ref()
|
|
|
|
|
const treeFormData = ref({
|
|
|
|
|
id: undefined as number | undefined,
|
|
|
|
|
id: undefined as string | undefined,
|
|
|
|
|
code: '',
|
|
|
|
|
isCode: true,
|
|
|
|
|
name: '',
|
|
|
|
|
@ -973,8 +973,8 @@ const buildTreeQrcodePrintData = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getDeviceTypeName = (value: any) => {
|
|
|
|
|
const id = typeof value === 'number' ? value : Number(value)
|
|
|
|
|
if (!Number.isNaN(id) && deviceTypeNameMap.value[id]) return deviceTypeNameMap.value[id]
|
|
|
|
|
const id = String(value ?? '')
|
|
|
|
|
if (deviceTypeNameMap.value[id]) return deviceTypeNameMap.value[id]
|
|
|
|
|
return value ?? ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1012,7 +1012,7 @@ const handleDetail = (id: number) => {
|
|
|
|
|
router.push({ name: 'MesDeviceLedgerDetail', params: { id } })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleEditDetail = (id: number) => {
|
|
|
|
|
const handleEditDetail = (id: string) => {
|
|
|
|
|
router.push({ name: 'MesDeviceLedgerEditDetail', params: { id } })
|
|
|
|
|
}
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
@ -1054,18 +1054,18 @@ const resetQuery = () => {
|
|
|
|
|
/** 添加/修改操作 */
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
const formVisible = ref(false)
|
|
|
|
|
const openForm = async (type: string, id?: number) => {
|
|
|
|
|
const openForm = async (type: string, id?: string) => {
|
|
|
|
|
formVisible.value = true
|
|
|
|
|
await nextTick()
|
|
|
|
|
formRef.value.open(type, id, queryParams.deviceType, selectedDeviceLineId.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const buildIdsParam = (ids: number | number[]) => {
|
|
|
|
|
const buildIdsParam = (ids: string | string[]) => {
|
|
|
|
|
return Array.isArray(ids) ? ids.join(',') : String(ids)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleDelete = async (ids: number | number[]) => {
|
|
|
|
|
const handleDelete = async (ids: string | string[]) => {
|
|
|
|
|
try {
|
|
|
|
|
// 删除的二次确认
|
|
|
|
|
await message.delConfirm()
|
|
|
|
|
|