From 36acf8daf78fdc005a42ea682efec7174f4e283b Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 20 六月 2024 11:58:42 +0800 Subject: [PATCH] 产品工艺路线 --- src/views/tigerprojects/mes/eng/route/index.vue | 118 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 92 insertions(+), 26 deletions(-) diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue index 6aa493a..b9bcebd 100644 --- a/src/views/tigerprojects/mes/eng/route/index.vue +++ b/src/views/tigerprojects/mes/eng/route/index.vue @@ -6,10 +6,11 @@ @click-blank="clickBlank" @init="init" /> </LayoutContent> <LayoutSider :class="`right`" collapsible :reverseArrow="true" collapsedWidth="0" width="400" - style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 10px" + style=" padding: 10px; border-left: 1px solid #d9d9d9;background: #fafafa" :zeroWidthTriggerStyle="{ 'margin-top': '-70px', 'background-color': 'gray' }"> <PropsPanel ref="propsPanel" :activeKey="routeConfig.activeKey" :IsOperation="IsOperation" :title="title" - :posttitle="posttitle" :colSlots="colSlots" :crudColSlots="crudColSlots" :entityName="entityName"> + :posttitle="posttitle" :entityName="entityName" @change-name="changeName" + @change-node-name="changeNodeName"> <!-- <template v-for="item of formConfig.schemas" #[`${item.component}Props`]="data"> <slot :name="`${item.component}Props`" @@ -24,7 +25,7 @@ </PageWrapper> </template> -<script lang="ts" setup name="Route_View"> +<script lang="ts" setup> import { FlowChart } from '/@/components/FlowChart'; import { PageWrapper } from '/@/components/Page'; import { SaveRouteData, getRouteData } from '/@/api/tigerapi/mes/router'; @@ -40,6 +41,7 @@ MES_ROUTE_EDGE, MES_ROUTE_NODE_ACT, MES_ROUTE, + nodeText, } from '/@/api/tigerapi/model/router'; import { useUserStore } from '/@/store/modules/user'; import RouteDrawer from './RouteDrawer.vue'; @@ -54,13 +56,14 @@ import LogicFlow from '@logicflow/core'; import { getEntity } from '/@/api/tigerapi/system'; +defineOptions({name: 'Route_View',}); const [registerDrawer, { openDrawer }] = useDrawer(); const [registerModal, { openModal }] = useModal(); const { t } = useI18n(); const route = useRoute(); const { setTitle } = useTabs(); const { notification, createErrorModal } = useMessage(); -const routeConfig = reactive({ +const routeConfig = reactive<IRouteConfig>({ // 琛ㄥ崟閰嶇疆 schemas: [], layout: 'horizontal', @@ -72,13 +75,13 @@ currentAct: {} as MES_ROUTE_NODE_ACT, routeData: {} as RouteData, activeKey: 1, -} as IRouteConfig); +}); const currRoute = ref({} as MES_ROUTE); const routeData = ref({ nodes: [], edges: [], }); -provide<Ref<IRouteConfig>>('routeConfig', routeConfig); +provide<Ref<IRouteConfig>>('routeConfig', routeConfig as unknown as Ref<IRouteConfig>); provide<Ref<MES_ROUTE>>('mesRoute', currRoute); const selectnode = ref({} as node); const currRotId = ref(route.params?.id); @@ -133,7 +136,8 @@ } _data.Data.nodes.forEach((n) => { n.node.properties = JSON.parse(n.node.properties); - routeData.value.nodes.push(n.node); + n['node']['text']['value'] = n.NODE_NAME; + routeData.value.nodes.push(n['node']); }); console.log('111', routeData.value); _data.Data.edges.forEach((e) => { @@ -175,12 +179,8 @@ var _nodes = unref(lf).getGraphData().nodes as node[]; var _edges = unref(lf).getGraphData().edges as edge[]; var _num = 1; - const diffnodes = routeConfig.routeData.nodes.filter((itemA) => - _nodes.some((itemB) => itemB.id === itemA.ID), - ); - const diffacts = routeConfig.routeData.acts.filter((itemA) => - _nodes.some((itemB) => itemB.id === itemA.ID), - ); + const diffnodes = routeConfig.routeData.nodes.filter((itemA) => _nodes.some((itemB) => itemB.id === itemA.ID)); + const diffacts = routeConfig.routeData.acts.filter((itemA) => _nodes.some((itemB) => itemB.id === itemA.ID),); _nodes.forEach((n) => { if (n.properties.operType && n.properties.operType == 'Action') { var _diffacts = diffacts.length > 0 ? diffacts : routeConfig.routeData.acts; @@ -208,13 +208,15 @@ OPTION_3: '', OPTION_4: '', OPTION_5: '', - ACT_NAME: `${routeConfig.routeData.route.ROT_CODE}_${n.text.value}_${_num}`, + ACT_NAME: isNullOrEmpty(a.ACT_NAME) ? `${n.text.value}_${_num}` : a.ACT_NAME, + ACT_CODE: a.ACT_CODE, + NEED_SETUP: a.NEED_SETUP, NODE_ID: a.NODE_ID, ACT_TYPE: a.ACT_TYPE, - DO_TYPE: a.DO_TYPE, - DO_METHOD: a.DO_METHOD, - DO_IF_PASS: a.DO_IF_PASS, - DO_IF_FAIL: a.DO_IF_FAIL, + // DO_TYPE: a.DO_TYPE, + // DO_METHOD: a.DO_METHOD, + // DO_IF_PASS: a.DO_IF_PASS, + // DO_IF_FAIL: a.DO_IF_FAIL, node: {} as node, IS_ACTIVE: a.IS_ACTIVE, }; @@ -241,10 +243,10 @@ UPDATE_TIME: currRotData.route.UPDATE_TIME, UPDATE_USER: useUserStore().getUserInfo.userId as string, GHOST_ROW: false, - NODE_NAME: `${currRotData.route.ROT_CODE}_${n.text.value}_${_num}`, + NODE_NAME: isNullOrEmpty(nd.NODE_NAME) ? `${n.text.value}_${_num}` : nd.NODE_NAME, ROT_ID: currRotData.route.ID, SEGMENT: nd.SEGMENT, - OPER_CODE: nd.OPER_CODE, + OPER_CODE: isNullOrEmpty(nd.OPER_CODE) ? n.type : nd.OPER_CODE, GPH_TYPE: n.type, GPH_X: n.x, GPH_Y: n.y, @@ -403,7 +405,7 @@ UPDATE_TIME: currRoute.value.UPDATE_TIME, UPDATE_USER: useUserStore().getUserInfo.userId as string, GHOST_ROW: false, - NODE_NAME: `${currRoute.value.ROT_CODE}_${selectnode.value.text.value}_0`, + NODE_NAME: `${selectnode.value.text.value}_0`, ROT_ID: currRoute.value.ID, SEGMENT: '', OPER_CODE: selectnode.value.type, @@ -432,12 +434,49 @@ routeConfig.routeData.nodes.push(_node); } //鏄涓� - if (selectnode.value.properties.operType && selectnode.value.properties.operType == 'Action') { + if (selectnode.value.properties['operType'] && selectnode.value.properties['operType'] == 'Action') { var _act = routeConfig.routeData.acts.filter((x) => x.ID == selectnode.value.id)[0]; routeConfig.activeKey = 2; IsOperation.value = false; title.value = '琛屼负'; posttitle.value = ''; + if (isNullOrUnDef(_act)) { + _act = { + ID: selectnode.value.id, + CREATE_TIME: currRoute.value.CREATE_TIME, + CREATE_USER: useUserStore().getUserInfo.userId as string, + UPDATE_TIME: currRoute.value.UPDATE_TIME, + UPDATE_USER: useUserStore().getUserInfo.userId as string, + GHOST_ROW: false, + AUTH_ORG: '', + AUTH_PROD: '', + AUTH_WH: '', + ACT_NAME: `${selectnode.value.text.value}_0`, + ACT_CODE: '', + ROT_ID: currRoute.value.ID, + NODE_ID: '', + ACT_TYPE: 0, + GPH_TYPE: selectnode.value.type, + GPH_X: selectnode.value.x, + GPH_Y: selectnode.value.y, + GPH_PROP: JSON.stringify(selectnode.value.properties), + GPH_TEXT: selectnode.value.text.value, + NEED_SETUP: 0, + // DO_TYPE: 0, + // DO_METHOD: '', + // DO_IF_PASS: '', + // DO_IF_FAIL: '', + IS_ACTIVE: '', + OPTION_1: '', + OPTION_2: '', + OPTION_3: '', + OPTION_4: '', + OPTION_5: '', + REMARK: '', + node: {} as node, + } + routeConfig.routeData.acts.push(_act); + } routeConfig.currentAct = { ID: selectnode.value.id, CREATE_TIME: currRoute.value.CREATE_TIME, @@ -449,6 +488,7 @@ AUTH_PROD: '', AUTH_WH: '', ACT_NAME: _act.ACT_NAME, + ACT_CODE: _act.ACT_CODE, ROT_ID: currRoute.value.ID, NODE_ID: _act.NODE_ID, ACT_TYPE: _act.ACT_TYPE, @@ -457,10 +497,11 @@ GPH_Y: selectnode.value.y, GPH_PROP: JSON.stringify(selectnode.value.properties), GPH_TEXT: selectnode.value.text.value, - DO_TYPE: _act.DO_TYPE, - DO_METHOD: _act.DO_METHOD, - DO_IF_PASS: _act.DO_IF_PASS, - DO_IF_FAIL: _act.DO_IF_FAIL, + NEED_SETUP: _act.NEED_SETUP, + // DO_TYPE: _act.DO_TYPE, + // DO_METHOD: _act.DO_METHOD, + // DO_IF_PASS: _act.DO_IF_PASS, + // DO_IF_FAIL: _act.DO_IF_FAIL, IS_ACTIVE: _act.IS_ACTIVE, OPTION_1: '', OPTION_2: '', @@ -470,6 +511,8 @@ REMARK: '', node: {} as node, }; + const actModel = lf.getNodeModelById(selectnode.value.id); + actModel.updateText(routeConfig.currentAct?.ACT_NAME); } else { //鏄伐搴� IsOperation.value = false; @@ -496,6 +539,8 @@ IS_OUTPUT: _node.IS_OUTPUT, REMARK: _node.REMARK, }; + const nodeModel = lf.getNodeModelById(selectnode.value.id); + nodeModel.updateText(_node.NODE_NAME); routeConfig.isCalcFpy = _node.IS_CALC_FPY == 'Y'; routeConfig.canSkip = _node.CAN_SKIP == 'Y'; routeConfig.isInput = _node.IS_INPUT == 'Y'; @@ -540,4 +585,25 @@ //鍐嶈繑鍥炲叿浣撴暟鎹� routeConfig.routeData = GetRotData(unref(lfInstance)); } + +/** + * @description: 鍚嶇О鏀瑰彉鍥炶皟鏂规硶锛岃繑鍥炲悗鏇存柊鑺傜偣鏂囨湰 + * @param {*} e + * @return {*} + */ +function changeName(e) { + console.log(e.val); + const nodeModel = unref(currlf)?.getNodeModelById(e.id); + nodeModel?.updateText(e.val); + } +/** + * @description: 鍚嶇О鏀瑰彉鍥炶皟鏂规硶锛岃繑鍥炲悗鏇存柊鑺傜偣鏂囨湰 + * @param {*} e + * @return {*} + */ +function changeNodeName(e) { + console.log(e.val); + const nodeModel = unref(currlf)?.getNodeModelById(e.id); + nodeModel?.updateText(e.val); + } </script> -- Gitblit v1.9.3