修改工位交接页面获取工段

This commit is contained in:
shaoleiliu-netizen123 2026-08-03 15:05:30 +08:00
parent d80a5983d4
commit b19dffa3cf

View File

@ -6,14 +6,13 @@
<div class="search-form">
<n-form inline :model="searchForm" label-placement="left">
<n-form-item label="设备工段">
<n-select
placeholder="请指定工段"
clearable
multiple
style="width: 200px"
<n-tree-select
style="width: 400px"
cascade
checkable
:options="sectionList"
@update:value="handleUpdateValue"
/>
/>
</n-form-item>
<n-form-item label="设备/工位">
<n-select
@ -140,6 +139,8 @@ import { sectionApi,Section } from '@/api/section'
import { deviceApi,Device} from '@/api/device'
import { userApi,SysUser } from '@/api/system'
import { label } from 'three/tsl'
import {deptApi} from "@/api/org.ts";
import {TreeNode} from "echarts/types/src/data/Tree";
const message = useMessage()
@ -404,15 +405,11 @@ async function handleImportUpload({ file }: UploadCustomRequestOptions) {
async function loadDictOptions() {
}
//
//
async function loadSection() {
const res = await sectionApi.listNoParam();
sectionList.value = res.map((n:any) =>{
return {
label:n.sectionName,
value:n.id
}
})
const data = await deptApi.tree()
sectionList.value = buildOptions(data);
}
function handleUpdateValue(key:any) {
@ -420,6 +417,23 @@ function handleUpdateValue(key:any) {
loadDevice(key)
}
function buildOptions(d: any[]): TreeNode[] {
return d.map(item => {
// id0||
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
};
});
}
///
async function loadDevice(sectionIdList:number[]) {
const sectionIds = sectionIdList != null ?JSON.stringify(sectionIdList) :null