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