1
This commit is contained in:
parent
0542bb739e
commit
f32d8667f7
@ -112,12 +112,17 @@
|
|||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="所属工段" path="sectionId">
|
<n-form-item label="所属工段" path="sectionId">
|
||||||
<n-select
|
<!-- <n-select
|
||||||
v-model:value="formData.sectionId"
|
v-model:value="formData.sectionId"
|
||||||
:options="sectionList"
|
:options="sectionList"
|
||||||
placeholder="请选择所属工段"
|
placeholder="请选择所属工段"
|
||||||
clearable
|
clearable
|
||||||
style="width: 200px"
|
style="width: 200px"
|
||||||
|
/> -->
|
||||||
|
<n-tree-select
|
||||||
|
cascade
|
||||||
|
checkable
|
||||||
|
:options="sectionList"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="设备类型" path="deviceTypeId">
|
<n-form-item label="设备类型" path="deviceTypeId">
|
||||||
@ -267,12 +272,14 @@ import {deviceApi, type Device} from '@/api/device'
|
|||||||
|
|
||||||
import {dictDataApi} from '@/api/org'
|
import {dictDataApi} from '@/api/org'
|
||||||
import {sectionApi} from '@/api/section'
|
import {sectionApi} from '@/api/section'
|
||||||
import {SysUser, userApi} from '@/api/system'
|
import {deptApi, type SysDept , userApi} from '@/api/system'
|
||||||
import {DeviceAbnormalRecord, deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
|
import {DeviceAbnormalRecord, deviceAbnormalRecordApi} from "@/api/deviceAbnormalRecord.ts";
|
||||||
|
|
||||||
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
|
import DeviceAbnormalRecordPage from '@/views/biz/device/DeviceAbnomarlRecord.vue'
|
||||||
import DeviceOperationLogPage from "@/views/biz/device/DeviceOperationLog.vue";
|
import DeviceOperationLogPage from "@/views/biz/device/DeviceOperationLog.vue";
|
||||||
|
|
||||||
import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue";
|
import DeviceDispatchLogPage from "@/views/biz/device/DeviceDispatchLog.vue";
|
||||||
|
import { S } from 'vue-router/dist/router-CWoNjPRp.mjs'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
const dialog = useDialog()
|
const dialog = useDialog()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
@ -283,8 +290,15 @@ const deviceId = ref<number>(undefined)
|
|||||||
//设备负责人列表
|
//设备负责人列表
|
||||||
const deviceManagerList = ref<{ label: string, value: any }[]>([])
|
const deviceManagerList = ref<{ label: string, value: any }[]>([])
|
||||||
|
|
||||||
let sectionList = reactive<{ label: string, value: any }[]>([])
|
// 树形下拉选项递归接口
|
||||||
|
interface TreeNode {
|
||||||
|
label: string;
|
||||||
|
key: number | string;
|
||||||
|
children?: TreeNode[];
|
||||||
|
}
|
||||||
|
|
||||||
|
let sectionList = reactive<TreeNode[]>([])
|
||||||
|
// const sectionList = ref<SysDept[]>([]) // 树形数据
|
||||||
//设备异常记录
|
//设备异常记录
|
||||||
const deviceErrorLogList = ref<DeviceAbnormalRecord[]>([])
|
const deviceErrorLogList = ref<DeviceAbnormalRecord[]>([])
|
||||||
const deviceAbnormalRecordDrawerVisible = ref<Boolean>(false) //异常记录抽屉显示
|
const deviceAbnormalRecordDrawerVisible = ref<Boolean>(false) //异常记录抽屉显示
|
||||||
@ -664,11 +678,26 @@ async function loadDictOptions() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//加载工段
|
//加载工段
|
||||||
async function loadSection() {
|
async function loadSection() {
|
||||||
const data = await sectionApi.listNoParam()
|
const data = await deptApi.tree()
|
||||||
sectionList = data.map((d: any) => ({label: d.sectionName, value: (Number(d.id) || d.id)}))
|
sectionList = buildOptions(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildOptions(d: any[]): TreeNode[] {
|
||||||
|
return d.map(item => {
|
||||||
|
// 安全id转换:0也能正常转为数字,不会被||过滤
|
||||||
|
const idNum = Number(item.id);
|
||||||
|
const key = !isNaN(idNum) ? idNum : item.id;
|
||||||
|
return {
|
||||||
|
label: item.deptName,
|
||||||
|
key,
|
||||||
|
// 子节点存在且为数组才递归处理
|
||||||
|
children: Array.isArray(item.children) && item.children.length
|
||||||
|
? buildOptions(item.children)
|
||||||
|
: undefined
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载人员
|
//加载人员
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user