| | |
| | | } from './model/systemModel'; |
| | | import { defHttp } from '/@/utils/http/axios'; |
| | | import { isNullOrEmpty, isTimeType } from '/@/utils/is'; |
| | | import { MES_ROUTE_EDGE, MES_ROUTE_NODE } from './model/router'; |
| | | |
| | | export enum Api { |
| | | QueryUrl = '/Base/Query', |
| | |
| | | }, |
| | | ); |
| | | }; |
| | | |
| | | /* |
| | | * 转换工艺路线为树形json |
| | | */ |
| | | function convertRouteToTreeData( |
| | | nodes: MES_ROUTE_NODE[], |
| | | edges: MES_ROUTE_EDGE[], |
| | | parentId: string, |
| | | id: string, |
| | | pid?: string, |
| | | ) { |
| | | const result: treeParamsListItem[] = []; |
| | | let temp: treeParamsListItem[] = []; |
| | | const _pid = pid == undefined ? '' : pid; |
| | | for (let i = 0; i < nodes.length; i++) { |
| | | const currPid = data[i][parentId] == null ? '' : data[i][parentId]; |
| | | if (currPid === _pid) { |
| | | const obj: treeParamsListItem = data[i]; |
| | | obj.PARAM_TYPE = _pid == '' ? '0' : '1'; //增加类型 |
| | | temp = convertToTreeData(data, parentId, id, data[i][id]); |
| | | if (temp.length > 0) { |
| | | obj.children = temp; |
| | | } |
| | | result.push(obj); |
| | | } |
| | | } |
| | | return result; |
| | | } |