| | |
| | | * @param {string} childId |
| | | * @return {*} |
| | | */ |
| | | export function findParent(tree: any[], nodeId: number): any | undefined { |
| | | export function findParent(tree: any[], nodeId: string): any | undefined { |
| | | for (const node of tree) { |
| | | if (node.children) { |
| | | for (const child of node.children) { |
| | |
| | | * @version: |
| | | * @Date: 2024-06-18 15:09:47 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-10-16 00:41:53 |
| | | * @LastEditTime: 2024-10-17 14:43:28 |
| | | */ |
| | | import { defineStore } from 'pinia'; |
| | | import { store } from '@/store'; |
| | |
| | | |
| | | interface ProdRouteState { |
| | | curProdRotTree: MesRotTree[]; |
| | | curPkgConfig: any; |
| | | curConfig: any; |
| | | curSelectedNodes: any; |
| | | ItemCode: string; |
| | | curDtl: any |
| | | } |
| | | |
| | | export const useProdRouteStore = defineStore({ |
| | | id: 'app-prodrot', |
| | | state: (): ProdRouteState => ({ |
| | | curProdRotTree: [], |
| | | curPkgConfig: {}, |
| | | curConfig: {}, |
| | | curSelectedNodes: {}, |
| | | ItemCode: '' |
| | | ItemCode: '', |
| | | curDtl: {} |
| | | }), |
| | | getters: { |
| | | getCurProdRotTree(state): MesRotTree[] { |
| | | return state.curProdRotTree; |
| | | }, |
| | | getCurPkgConfig(state): any { |
| | | return state.curPkgConfig; |
| | | getCurConfig(state): any { |
| | | return state.curConfig; |
| | | }, |
| | | getCurSelectedNodes(state): any { |
| | | return state.curSelectedNodes; |
| | |
| | | getItemCodes(state): string { |
| | | return state.ItemCode; |
| | | }, |
| | | getcurDtl(state): any { |
| | | return state.curDtl; |
| | | }, |
| | | }, |
| | | actions: { |
| | | setCurPkgConfig(val: any) { |
| | | this.curPkgConfig = val; |
| | | this.curConfig = val; |
| | | }, |
| | | setCurProdRotTree(info: MesRotTree[]) { |
| | | this.curProdRotTree = info; |
| | |
| | | setItemCode(val: string) { |
| | | this.ItemCode = val; |
| | | }, |
| | | setcurDtl(val: any) { |
| | | this.curDtl = val; |
| | | }, |
| | | resetState() { |
| | | this.curProdRotTree = []; |
| | | this.curPkgConfig = {}; |
| | | this.curConfig = {}; |
| | | this.curSelectedNodes = {}; |
| | | this.curDtl = {}; |
| | | }, |
| | | /** |
| | | * @description: 设置默认工艺路线 |
| | |
| | | * @return {*} |
| | | */ |
| | | getParent(tid: string): MesRotTree{ |
| | | return findParent(this.getCurProdRotTree,tid) as unknown as MesRotTree; |
| | | return findParent(this.getCurProdRotTree, tid) as unknown as MesRotTree; |
| | | } |
| | | }, |
| | | }); |
| | |
| | | <template> |
| | | <BasicModal |
| | | :width="width" |
| | | :height="650" |
| | | :height="750" |
| | | v-bind="$attrs" |
| | | @register="register" |
| | | :title="title" |
| | |
| | | <template> |
| | | <BasicModal |
| | | width="800px" |
| | | :height="600" |
| | | :height="450" |
| | | v-bind="$attrs" |
| | | @register="register" |
| | | :title="title" |
| | |
| | | }, |
| | | useSearchForm: true, |
| | | showTableSetting: false, |
| | | scroll: { y: 350 }, |
| | | canResize: false, |
| | | rowKey: rowKey, |
| | | rowSelection: { |
| | | selectedRowKeys: checkedKeys.value, |
| | |
| | | }, |
| | | bordered: true, |
| | | showIndexColumn: false, |
| | | // actionColumn: { |
| | | // width: 80, |
| | | // title: '操作', |
| | | // dataIndex: 'action', |
| | | // slots: { customRender: 'action' }, |
| | | // fixed: 'right' //undefined, |
| | | // }, |
| | | }); |
| | | const [register, { setModalProps, closeModal }] = useModalInner((data) => { |
| | | setModalProps({ confirmLoading: false }); |
| | |
| | | * @version: |
| | | * @Date: 2024-06-24 23:44:31 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-09-29 16:23:30 |
| | | * @LastEditTime: 2024-10-17 20:28:47 |
| | | --> |
| | | <template> |
| | | <Card :title="GetTitle(configType)['configTitle']"> |
| | |
| | | <Card |
| | | :title="GetTitle(configType, item)['tableTitle']" |
| | | :bordered="false" |
| | | class="!mt-5" |
| | | v-for="item in OtherTables" |
| | | :key="item" |
| | | v-show="showOtherTable[item]" |
| | | class="mt-1" |
| | | > |
| | | <div :style="custTableStyle" > |
| | | <BasicTable @register="useTables[item][0]" v-if="showOtherTable[item]"> |
| | | <template #action="{ record }"> |
| | | <TableAction :actions="createActions(record, item)" /> |
| | | </template> |
| | | </BasicTable> |
| | | </div> |
| | | <normalDrawer @register="useDrawers[item][0]" @success="(d, u) => EditSuccess(d, u, item)" /> |
| | | <GeneralCrudModal @register="useModalsCrud[item][0]"></GeneralCrudModal> |
| | | </Card> |
| | |
| | | import { useDrawer } from '/@/components/Drawer'; |
| | | import normalDrawer from '../normalDrawer.vue'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { useProdRouteStore } from '/@/store/modules/prodRoute'; |
| | | import { storeToRefs } from 'pinia'; |
| | | |
| | | const { t } = useI18n(); |
| | | const emit = defineEmits(['success', 'register']); |
| | |
| | | ] = isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | |
| | | const useProdRoute = useProdRouteStore(); |
| | | const { curDtl } = storeToRefs(useProdRoute); |
| | | const useModalData = ref(GetUseModals()); |
| | | const data = ref({}); |
| | | const useTables = ref(GetUseTables(data, emit)); |
| | | // const data = ref({}); |
| | | const useTables = ref(GetUseTables(curDtl, emit)); |
| | | const useForms = ref(GetUseForm()); |
| | | const useDrawers = ref({}); |
| | | const useModalsCrud = ref({}); |
| | |
| | | showOtherTable.value[x] = false; |
| | | useDrawers.value[x] = useDrawer(); |
| | | useModalsCrud.value[x] = useModal(); |
| | | }); |
| | | const custTableStyle = ref({ |
| | | height: window.screen.width == 1366? '350px': '450px' |
| | | }); |
| | | |
| | | /* 注入选中节点数据 */ |
| | |
| | | const name = result['name']; |
| | | if (showOtherTable.value[name]) { |
| | | showOtherTable.value[name] = false; |
| | | data.value[name] = result[name]; |
| | | data.value['Action'] = result['Action']; |
| | | useTables.value = GetUseTables(data, emit); |
| | | // data.value[name] = curDtl.value[name]; //result[name]; |
| | | // data.value['Action'] = curDtl.value['Action']; //result['Action']; |
| | | useTables.value = GetUseTables(curDtl, emit); |
| | | setTimeout(() => { |
| | | showOtherTable.value[name] = true; |
| | | }, 10); |
| | |
| | | const nodes = selectedNodes.value; |
| | | nodeChange({ useForms, objParams, selectedNodes: nodes }).then((result) => { |
| | | showOtherTable.value = result.isShow; |
| | | data.value[configType.value as string] = result[configType.value as string]; |
| | | useTables.value = GetUseTables(data, emit); |
| | | if (showOtherTable.value[result['name']]) { |
| | | data.value[result['name']] = result[result['name']]; |
| | | // data.value[configType.value as string] = curDtl.value[configType.value as string]; //result[configType.value as string]; |
| | | useTables.value = GetUseTables(curDtl, emit); |
| | | if (showOtherTable.value[curDtl.value['name']]) { |
| | | // curDtl.value[result['name']] = curDtl.value[result['name']]; |
| | | // useTables.value[result['name']][1].setProps({ |
| | | // dataSource: [], |
| | | // }); |
| | |
| | | CustFunc({ |
| | | ctype: item, |
| | | values: d, |
| | | data: data, |
| | | data: curDtl, |
| | | }).then(() => { |
| | | /* 显示其他表格 */ |
| | | if (showOtherTable.value[item]) { |
| | |
| | | setTimeout(() => { |
| | | showOtherTable.value[item] = true; |
| | | }, 10); |
| | | useTables.value = GetUseTables(data, emit); |
| | | useTables.value = GetUseTables(curDtl, emit); |
| | | setTimeout(() => { |
| | | useTables.value[item][1].reload(); |
| | | useForms.value[configType.value as string][1].resetFields(); |
| | | useForms.value[configType.value as string][1].setFieldsValue( |
| | | data.value[configType.value as string][0], |
| | | curDtl.value[configType.value as string][0], |
| | | ); |
| | | }, 10); |
| | | } |
| | |
| | | function SelectInFormSuccess(d, u, item) { |
| | | GetSelectSuccess(d, u, item).then((result) => { |
| | | useForms.value[configType.value][1].setFieldsValue(result['value']); |
| | | if (!isNullOrUnDef(data.value[configType.value as string])) { |
| | | data.value[configType.value as string].map((x) => { |
| | | if (!isNullOrUnDef(curDtl.value[configType.value as string])) { |
| | | curDtl.value[configType.value as string].map((x) => { |
| | | Object.getOwnPropertyNames(result['value']).forEach((key) => { |
| | | x[key] = result['value'][key]; |
| | | }); |
| | | }); |
| | | } |
| | | showOtherTable.value = result['isShow']; |
| | | data.value[result.name] = result['data']; |
| | | curDtl.value[result.name] = result['data']; |
| | | /* 重新useTable,否则数据不刷新 */ |
| | | useTables.value = GetUseTables(data, emit); |
| | | useTables.value = GetUseTables(curDtl, emit); |
| | | if (showOtherTable.value[result.name]) { |
| | | showOtherTable.value[result.name] = false; |
| | | setTimeout(() => { |
| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-10-16 00:10:37 |
| | | * @LastEditTime: 2024-10-17 20:56:33 |
| | | */ |
| | | |
| | | import { Ref, h, ref, render, unref } from 'vue'; |
| | |
| | | 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'); |
| | |
| | | // searchInfo: { TABLE_NAME: 'V_BAS_PKG_DTL' }, |
| | | dataSource: data.value['BAS_PKG_DTL'], |
| | | columns: GetBaseColumns('BAS_PKG_DTL', args[0], data), |
| | | maxHeight: 520, |
| | | // maxHeight: 520, |
| | | // scroll: { y: window.screen.width == 1366? 400: 450 }, |
| | | isCanResizeParent: true, |
| | | useSearchForm: false, |
| | | showTableSetting: false, |
| | | bordered: true, |
| | | canResize: true, |
| | | // canResize: false, |
| | | showIndexColumn: false, |
| | | // rowSelection: { |
| | | // type: 'radio', //'checkbox' |
| | |
| | | { |
| | | title: '默认值', |
| | | dataIndex: 'DEFAULT_VALUE', |
| | | editRow: true, |
| | | editRule: true, |
| | | // editRow: true, |
| | | // editRule: true, |
| | | }, |
| | | ] as BasicColumn[]; |
| | | |
| | |
| | | * @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'); |