Browse Source

fix: 设备信息调整

master
wangqi 2 months ago
parent
commit
4a46161fcf
  1. 21
      src/pages/deviceInfo/components/data-filter.vue
  2. 7
      src/pages/deviceInfo/index.vue
  3. 8
      src/pages/deviceInfo/utils.ts

21
src/pages/deviceInfo/components/data-filter.vue

@ -41,12 +41,28 @@ @@ -41,12 +41,28 @@
<el-checkbox v-model="checkbox.name" size="large" />
</div>
<div class="item">
<el-select
v-model="filterData.status"
placeholder="请选择设备状态"
style="width: 100%"
>
<el-option
v-for="item in enumToKeyValueArray(DeviceStatus)"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<el-checkbox v-model="checkbox.status" size="large" />
</div>
<div class="item">
<el-cascader
v-model="filterData.categoryId"
:options="categoryTreeData"
placeholder="请选择设备分类"
style="width: 100%;"
style="width: 100%"
:props="{
checkStrictly: true,
value: 'id',
@ -71,6 +87,7 @@ @@ -71,6 +87,7 @@
import dayjs from 'dayjs'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import EdfsButton from '@/components/dashboard/Edfs-button/index.vue'
import { DeviceStatus, enumToKeyValueArray } from '../utils'
import type { CustomerVO } from '@/api/module/eam/customer'
@ -93,6 +110,7 @@ const filterData = ref({ @@ -93,6 +110,7 @@ const filterData = ref({
startDay: '',
endDay: '',
name: '',
status: '',
serialNo: '',
categoryId: [],
})
@ -102,6 +120,7 @@ const checkbox = ref<Record<FilterKeys, boolean>>({ @@ -102,6 +120,7 @@ const checkbox = ref<Record<FilterKeys, boolean>>({
endDay: false,
name: false,
serialNo: false,
status: false,
categoryId: false,
})

7
src/pages/deviceInfo/index.vue

@ -9,6 +9,13 @@ @@ -9,6 +9,13 @@
</div>
</div>
<EdfsWrap title="设备信息列表" class="device-info-table">
<template #title-right>
<EdfsButton
type="primary"
inner-text="新增设备"
@click="addDevice"
/>
</template>
<EdfsTable
class="table"
v-loading="loading"

8
src/pages/deviceInfo/utils.ts

@ -46,3 +46,11 @@ export const testTableCol = [ @@ -46,3 +46,11 @@ export const testTableCol = [
{ label: '测试结果', prop: 'actualResult', minWidth: '20%' },
{ label: '备注', prop: 'description', minWidth: '16%' },
]
export function enumToKeyValueArray(enumObj: object): Array<{ label: string; value: number }> {
return Object.keys(enumObj)
.filter(key => isNaN(Number(key))) // 排除反向映射的数值键
.map(key => ({
label: key,
value: enumObj[key as keyof typeof enumObj] as number,
}));
}
Loading…
Cancel
Save