| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-15 22:05:16 |
| | | * @LastEditTime: 2024-08-01 17:17:09 |
| | | */ |
| | | |
| | | import { Ref, h, ref, render, unref } from 'vue'; |
| | | import { GetRoutePTree, RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router'; |
| | | import { DeleteProdRoute, GetRoutePTree, RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router'; |
| | | import { GetEnum, SaveEntity, convertToTree, getEntity } from '/@/api/tigerapi/system'; |
| | | import { useLocale } from '/@/locales/useLocale'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | |
| | | import { FormSchema } from '/@/components/Table'; |
| | | import { initRoute } from '../data'; |
| | | import { CustModalParams } from '/@/api/tigerapi/model/systemModel'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { EventDataNode } from 'ant-design-vue/lib/tree'; |
| | | import { ContextMenuItem } from '/@/components/TigerTree'; |
| | | |
| | | const { t } = useI18n(); |
| | | const { createErrorModal } = useMessage(); |
| | |
| | | */ |
| | | fetchTreeData: async (type: string, itemCode: string) => { |
| | | let data = { title: '', treeData: [] as any[], fieldNames: {} }; |
| | | let prodTreeData = await GetRoutePTree(itemCode); |
| | | let prodTreeData = await GetRoutePTree({prodCode: itemCode, orgCode: useUserStore().getUserInfo.orgCode}); |
| | | // 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); |
| | |
| | | CAN_SKIP: res.Data.Items[0].CAN_SKIP, |
| | | IS_INPUT: res.Data.Items[0].IS_INPUT, |
| | | IS_OUTPUT: res.Data.Items[0].IS_OUTPUT, |
| | | ALLOW_DFT_IN: res.Data.Items[0].ALLOW_DFT_IN, |
| | | REMARK: res.Data.Items[0].REMARK, |
| | | PROD_CODE: params['objParams'].value['CODE'], |
| | | CUST_CODE: params['selectedNodes'].value[0].cust, |
| | |
| | | entityName = 'MES_PROD_OPER'; |
| | | break; |
| | | } |
| | | values.AUTH_ORG = useUserStore().getUserInfo.orgCode; |
| | | values.AUTH_PROD = useUserStore().getUserInfo.prodCode; |
| | | SaveEntity(values, true, entityName).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | emit('success'); |
| | |
| | | value = { |
| | | pkgRULE_CODE: d.values['val'], |
| | | }; |
| | | break; |
| | | case 'addRoute': |
| | | if (isNullOrEmpty(args[1]['CODE'])) { |
| | | createErrorModal({ |
| | |
| | | ], |
| | | tableName: 'MES_ROUTE', |
| | | rowKey: 'ROT_CODE', |
| | | returnFieldName: 'ROUTE_CODE', //返回值要赋值的字段名称 |
| | | returnFieldName: ['ROUTE_CODE'], //返回值要赋值的字段名称 |
| | | searchInfo: { TABLE_NAME: 'MES_ROUTE' }, |
| | | which: action, |
| | | }); |
| | |
| | | }, |
| | | GetUseForm: () => { |
| | | return {}; |
| | | }, |
| | | /** |
| | | * @description: 获取右键菜单列表 |
| | | * @param {EventDataNode} node |
| | | * @return {*} |
| | | */ |
| | | GetRightMenuList: (node: EventDataNode, ...args): ContextMenuItem[] => { |
| | | const emit = args[0]; |
| | | const menu = [ |
| | | // { |
| | | // label: '新增', |
| | | // handler: () => { |
| | | // console.log('点击了新增', node); |
| | | // }, |
| | | // icon: 'bi:plus', |
| | | // }, |
| | | { |
| | | label: '删除', |
| | | handler: () => { |
| | | console.log('点击了删除', node); |
| | | DeleteProdRoute({rotId:node.id,rotCode: node.code, prodCode: args[1]}).then((action) => { |
| | | if(action.IsSuccessed){ |
| | | emit('deletenode', node); |
| | | }else{ |
| | | createErrorModal({ |
| | | title: t('sys.api.errorTip'), |
| | | content: t(action.LocaleMsg), |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | icon: 'bx:bxs-folder-open', |
| | | }, |
| | | ]; |
| | | return node.type == 'Route'? menu: []; |
| | | }, |
| | | }; |
| | | |
| | |
| | | field: 'RULE_CODE', |
| | | label: '扫码验证', |
| | | component: 'Input', |
| | | colProps: { span: 10 }, |
| | | colProps: { span: 11 }, |
| | | ifShow: ({ values }) => isScan(values.ACT_TYPE), |
| | | }, |
| | | { |
| | |
| | | label: '1', |
| | | defaultValue: '', |
| | | component: 'Input', |
| | | colProps: { span: 2, pull: 1 }, |
| | | colProps: { span: 1, pull: 1 }, |
| | | ifShow: ({ values }) => isScan(values.ACT_TYPE), |
| | | colSlot: 'scanadd', |
| | | }, |
| | | { |
| | | field: 'ITEM_CODE', |
| | | label: '组装上料', |
| | | colProps: { span: 10 }, |
| | | colProps: { span: 11 }, |
| | | component: 'Input', |
| | | ifShow: ({ values }) => isAssy(values.ACT_TYPE), |
| | | }, |
| | |
| | | label: '1', |
| | | defaultValue: '', |
| | | component: 'Input', |
| | | colProps: { span: 2, pull: 1 }, |
| | | colProps: { span: 1, pull: 1 }, |
| | | ifShow: ({ values }) => isAssy(values.ACT_TYPE), |
| | | colSlot: 'assyadd', |
| | | }, |
| | | { |
| | | field: 'TEST_CODE', |
| | | label: '产品测试', |
| | | colProps: { span: 10 }, |
| | | colProps: { span: 11 }, |
| | | component: 'Input', |
| | | ifShow: ({ values }) => isTest(values.ACT_TYPE), |
| | | }, |
| | |
| | | label: '1', |
| | | defaultValue: '', |
| | | component: 'Input', |
| | | colProps: { span: 2, pull: 1 }, |
| | | colProps: { span: 1, pull: 1 }, |
| | | ifShow: ({ values }) => isTest(values.ACT_TYPE), |
| | | colSlot: 'testadd', |
| | | }, |
| | | { |
| | | field: 'SAPL_CODE', |
| | | label: '产品抽检', |
| | | colProps: { span: 10 }, |
| | | colProps: { span: 11 }, |
| | | component: 'Input', |
| | | ifShow: ({ values }) => isAudit(values.ACT_TYPE), |
| | | }, |
| | |
| | | label: '1', |
| | | defaultValue: '', |
| | | component: 'Input', |
| | | colProps: { span: 2, pull: 1 }, |
| | | colProps: { span: 1, pull: 1 }, |
| | | ifShow: ({ values }) => isAudit(values.ACT_TYPE), |
| | | colSlot: 'auditadd', |
| | | }, |
| | | { |
| | | field: 'LABEL_CODE', |
| | | label: '标签打印', |
| | | colProps: { span: 10 }, |
| | | colProps: { span: 11 }, |
| | | component: 'Input', |
| | | ifShow: ({ values }) => isPrint(values.ACT_TYPE), |
| | | }, |
| | |
| | | label: '1', |
| | | defaultValue: '', |
| | | component: 'Input', |
| | | colProps: { span: 2, pull: 1 }, |
| | | colProps: { span: 1, pull: 1 }, |
| | | ifShow: ({ values }) => isPrint(values.ACT_TYPE), |
| | | colSlot: 'printadd', |
| | | }, |
| | | { |
| | | field: 'pkgRULE_CODE', |
| | | label: '包装规则', |
| | | colProps: { span: 10 }, |
| | | colProps: { span: 11 }, |
| | | component: 'Input', |
| | | ifShow: ({ values }) => isPackage(values.ACT_TYPE), |
| | | }, |
| | |
| | | label: '1', |
| | | defaultValue: '', |
| | | component: 'Input', |
| | | colProps: { span: 2, pull: 1 }, |
| | | colProps: { span: 1, pull: 1 }, |
| | | ifShow: ({ values }) => isPackage(values.ACT_TYPE), |
| | | colSlot: 'pkgadd', |
| | | }, |
| | |
| | | }, |
| | | }, |
| | | { |
| | | field: 'ALLOW_DFT_IN', |
| | | label: '是否允许不良品进站', |
| | | required: true, |
| | | component: 'Select', |
| | | colProps: { span: 12 }, |
| | | componentProps: { |
| | | options: [ |
| | | { |
| | | label: '是', |
| | | value: 'Y', |
| | | key: 'Y', |
| | | }, |
| | | { |
| | | label: '否', |
| | | value: 'N', |
| | | key: 'N', |
| | | }, |
| | | ], |
| | | }, |
| | | }, |
| | | { |
| | | field: 'REMARK', |
| | | label: '备注', |
| | | component: 'Input', |