修改工位交接页面获取工段
This commit is contained in:
parent
d80a5983d4
commit
b19dffa3cf
@ -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 => {
|
||||
// 安全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
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
//加载设备/工位
|
||||
async function loadDevice(sectionIdList:number[]) {
|
||||
const sectionIds = sectionIdList != null ?JSON.stringify(sectionIdList) :null
|
||||
Loading…
Reference in New Issue
Block a user