| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-10-05 16:49:39 |
| | | * @LastEditTime: 2024-10-17 21:13:17 |
| | | */ |
| | | |
| | | import { Ref, h, ref, render, unref } from 'vue'; |
| | |
| | | import { ContextMenuItem } from '/@/components/TigerTree'; |
| | | import { AddOrEditLabelVarByWorkOrder, UpdateWoStatus } from '/@/api/tigerapi/mes/wo'; |
| | | import { useForm } from '/@/components/Form'; |
| | | import { BAS_LABEL_VAR_WO } from '/@/api/tigerapi/model/mesModel'; |
| | | import { BAS_LABEL_VAR_WO, MesRotTree } from '/@/api/tigerapi/model/mesModel'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { mesApi } from '/@/api/tigerapi/mes/mesApi'; |
| | | import { useProdRouteStore } from '/@/store/modules/prodRoute'; |
| | | |
| | | const { t } = useI18n(); |
| | | const { createErrorModal } = useMessage(); |
| | | const useProdRoute = useProdRouteStore(); |
| | | const { getLocale } = useLocale(); |
| | | function _default() { |
| | | /* 定义变量 */ |
| | |
| | | fetchTreeData: async (type: string, wo: string) => { |
| | | let data = { title: '', treeData: [] as any[], fieldNames: {} }; |
| | | let prodTreeData = await GetWoPTree({ wo: wo }); |
| | | // let uniqueArr = prodTreeData.reduce((acc, current) => { |
| | | // if (!acc.some((x) => x.pid == current.pid && x.id == current.id && x.seq == current.seq && x.type == current.type)) { |
| | | // acc.push(current); |
| | | // } |
| | | // return acc; |
| | | // }, [] as V_MES_ROUTE_PTREE[]); |
| | | data.treeData = convertToTree(prodTreeData, 'pid', 'tid', 'root'); |
| | | let _treeData = convertToTree(prodTreeData, 'pid', 'tid', 'root'); |
| | | if (data.treeData.length == 0) { |
| | | data.treeData.push({ |
| | | pid: 'root', |
| | |
| | | } |
| | | data.title = '工单工艺路线'; |
| | | data.fieldNames = { key: 'tid', title: 'name' }; |
| | | /* 保存工艺树形数据到状态管理 */ |
| | | useProdRoute.setCurProdRotTree(_treeData as unknown as MesRotTree[]); |
| | | data.treeData = useProdRoute.getCurProdRotTree; |
| | | return data; |
| | | }, |
| | | /** |
| | |
| | | ItemCode: false, |
| | | }; |
| | | } |
| | | useProdRoute.setcurDtl(result); |
| | | resolve(result); |
| | | } catch (e) { |
| | | reject(e); |
| | |
| | | } |
| | | values.AUTH_ORG = useUserStore().getUserInfo.orgCode; |
| | | values.AUTH_PROD = useUserStore().getUserInfo.prodCode; |
| | | if(type == 'Action'){ |
| | | values.OPTION_1 = JSON.stringify(useProdRoute.getcurDtl['BAS_PKG_DTL']) |
| | | } |
| | | SaveEntity(values, true, entityName).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | emit('success'); |