From bfdfeb40c7ba97511584a30477acf5ad801398ba Mon Sep 17 00:00:00 2001 From: YangYuGang <1378265336@qq.com> Date: 星期二, 11 三月 2025 11:26:34 +0800 Subject: [PATCH] 一些更改 --- src/views/tigerprojects/mes/eng/route/index.vue | 634 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 490 insertions(+), 144 deletions(-) diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue index ae4e723..3d8a93c 100644 --- a/src/views/tigerprojects/mes/eng/route/index.vue +++ b/src/views/tigerprojects/mes/eng/route/index.vue @@ -8,6 +8,8 @@ @add-lf="handleAddlf" @select-node="handleSelect" @click-blank="clickBlank" + @anchor-drop="AnchorDrop" + @anchor-dragend="AnchorDragend" @init="init" /> </LayoutContent> @@ -16,11 +18,20 @@ collapsible :reverseArrow="true" collapsedWidth="0" - width="300" - style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 10px" + width="400" + style="padding: 10px; border-left: 1px solid #d9d9d9; background: #fafafa" :zeroWidthTriggerStyle="{ 'margin-top': '-70px', 'background-color': 'gray' }" > - <PropsPanel ref="propsPanel" :activeKey="routeConfig.activeKey"> + <PropsPanel + ref="propsPanel" + :activeKey="routeConfig.activeKey" + :IsOperation="IsOperation" + :title="title" + :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`" @@ -38,10 +49,15 @@ <script lang="ts" setup> import { FlowChart } from '/@/components/FlowChart'; import { PageWrapper } from '/@/components/Page'; - import { SaveRouteData, getRouteData } from '/@/api/tigerapi/mes/router'; + import { + SaveRouteData, + SaveWoRouteData, + getRouteData, + getWoRouteData, + } from '/@/api/tigerapi/mes/router'; import { useModal } from '/@/components/Modal'; import RouteModal from './RouteModal.vue'; - import { onMounted, ref, unref, Ref, provide, reactive, nextTick } from 'vue'; + import { onMounted, ref, unref, Ref, provide, reactive, nextTick, watch } from 'vue'; import { Layout, LayoutContent, LayoutSider } from 'ant-design-vue'; import { RouteData, @@ -51,6 +67,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'; @@ -62,14 +79,17 @@ import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { useRoute } from 'vue-router'; import { useTabs } from '/@/hooks/web/useTabs'; + import LogicFlow from '@logicflow/core'; + defineOptions({ name: 'Route_View' }); + const { refreshPage } = useTabs(); 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', @@ -81,33 +101,97 @@ currentAct: {} as MES_ROUTE_NODE_ACT, routeData: {} as RouteData, activeKey: 1, - } as IRouteConfig); + isWorkOrder: false, + }); 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); + const prodCode = ref(''); + const custCode = ref(''); + const colSlots = ref<any>([]); + const crudColSlots = ref<any>([]); + const entityName = ref<any>('MES_POSITION'); + const props = defineProps({ + rotId: { type: String, default: '' }, + rotType: { type: String, default: 'Route' }, + prodCode: { type: String, default: '' }, + custCode: { type: String, default: '' }, + }); + const IsOperation = ref(false); + const title = ref(''); + const posttitle = ref(''); + let _num = 1; + let _numEdge = 1; + watch( + [() => props.rotId, () => props.prodCode, () => props.custCode], + (v) => { + if (!isNullOrEmpty(v[0]) && v[0] !== currRotId.value) { + currRotId.value = v[0]; + if (!isNullOrUnDef(unref(currlf))) { + unref(currlf).render({}); + routeData.value = { + nodes: [], + edges: [], + }; + init(currlf); + } + } + if (!isNullOrEmpty(v[1]) && v[1] !== prodCode.value) { + prodCode.value = v[1]; + } + if (!isNullOrEmpty(v[2]) && v[2] !== custCode.value) { + custCode.value = v[2]; + } + }, + { deep: true }, + ); + const currlf = ref(null) as Ref<LogicFlow | null>; console.log(currRotId.value); + + onMounted(() => {}); + /** + * @description: 宸ヨ壓璺嚎鍒濆鍖� + * @param {*} lf + * @return {*} + */ async function init(lf) { + currlf.value = unref(lf); //閫氳繃宸ヨ壓璺嚎ID鑾峰彇鍥惧舰鏁版嵁锛屽苟娓叉煋 - var _data = await getRouteData(currRotId.value); + routeConfig.isWorkOrder = props.rotType == 'Wo'; + var _data = + props.rotType == 'Route' + ? await getRouteData(currRotId.value) + : await getWoRouteData(currRotId.value); console.log('缁勪欢宸叉寕杞�', _data); //宸ヨ壓璺嚎鍏ㄤ俊鎭紝鍖呮嫭Node銆丒dge鍜孉ct routeConfig.routeData = _data.Data; if (_data.Data != null) { //宸ヨ壓璺嚎涓讳俊鎭� currRoute.value = _data.Data.route; - if (!isNullOrEmpty(currRotId.value)) { + if (!isNullOrEmpty(currRotId.value) && isNullOrEmpty(props.rotId)) { setTitle('璁捐锛氬伐鑹鸿矾绾�-' + currRoute.value.ROT_CODE); + } + if (!isNullOrEmpty(prodCode.value)) { + currRoute.value.PROD_CODE = !isNullOrEmpty(currRoute.value.PROD_CODE) + ? currRoute.value.PROD_CODE + : prodCode.value; + } + if (!isNullOrEmpty(custCode.value)) { + currRoute.value.CUST_CODE = !isNullOrEmpty(currRoute.value.CUST_CODE) + ? currRoute.value.CUST_CODE + : custCode.value; } _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) => { @@ -123,6 +207,11 @@ } } + /** + * @description: 鑾峰彇宸ヨ壓璺嚎鍥炬暟鎹� + * @param {*} lf + * @return {*} + */ const GetRotData = (lf) => { var currRotData: RouteData = { route: { @@ -138,9 +227,12 @@ ROT_VER: currRoute.value.ROT_VER, IS_ACTIVE: currRoute.value.IS_ACTIVE, REMARK: currRoute.value.REMARK, - AUTH_ORG: '', + AUTH_ORG: useUserStore().getUserInfo.orgCode, AUTH_PROD: '', AUTH_WH: '', + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: '', }, nodes: [], edges: [], @@ -148,55 +240,77 @@ }; 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), ); - routeConfig.routeData.acts = []; + 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 act: MES_ROUTE_NODE_ACT = { - ID: n.id, - CREATE_TIME: routeConfig.routeData.route.CREATE_TIME, - CREATE_USER: useUserStore().getUserInfo.userId as string, - UPDATE_TIME: routeConfig.routeData.route.UPDATE_TIME, - UPDATE_USER: useUserStore().getUserInfo.userId as string, - GHOST_ROW: false, - ROT_ID: routeConfig.routeData.route.ID, - GPH_TYPE: n.type, - GPH_X: n.x, - GPH_Y: n.y, - GPH_PROP: JSON.stringify(n.properties), - GPH_TEXT: n.text.value, - REMARK: '', - AUTH_ORG: '', - AUTH_PROD: '', - AUTH_WH: '', - OPTION_1: '', - OPTION_2: '', - OPTION_3: '', - OPTION_4: '', - OPTION_5: '', - ACT_NAME: `${routeConfig.routeData.route.ROT_CODE}_${n.text.value}_${_num}`, - NODE_ID: '', - ACT_TYPE: 0, - DO_TYPE: 0, - DO_METHOD: '', - DO_IF_PASS: '', - DO_IF_FAIL: '', - node: {} as node, - }; - var pnode = [n]; - while (pnode[0].properties.operType == 'Action') { - pnode = unref(lf).getNodeIncomingNode(pnode[0].id); - if (pnode[0].properties.operType != 'Action') { - act.NODE_ID = pnode[0].id; - break; + var _diffacts = diffacts.length > 0 ? diffacts : routeConfig.routeData.acts; + _diffacts.forEach((a) => { + if (a.ID == n.id) { + var act: MES_ROUTE_NODE_ACT = { + ID: n.id, + CREATE_TIME: routeConfig.routeData.route.CREATE_TIME, + CREATE_USER: useUserStore().getUserInfo.userId as string, + UPDATE_TIME: routeConfig.routeData.route.UPDATE_TIME, + UPDATE_USER: useUserStore().getUserInfo.userId as string, + GHOST_ROW: false, + ROT_ID: routeConfig.routeData.route.ID, + GPH_TYPE: n.type, + GPH_X: n.x, + GPH_Y: n.y, + GPH_PROP: JSON.stringify(n.properties), + GPH_TEXT: n.text.value, + REMARK: a.REMARK, + AUTH_ORG: useUserStore().getUserInfo.orgCode, + AUTH_PROD: '', + AUTH_WH: '', + OPTION_1: '', + OPTION_2: '', + OPTION_3: '', + OPTION_4: '', + OPTION_5: '', + ACT_NAME: isNullOrEmpty(a.ACT_NAME) ? `${n.text.value}_${_num}` : a.ACT_NAME, + ACT_CODE: a.ACT_CODE, + NEED_SETUP: a.NEED_SETUP, + NEED_RESET: a.NEED_RESET, + 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, + node: {} as node, + IS_ACTIVE: a.IS_ACTIVE, + WORK_ORDER: a.WORK_ORDER, + PROD_CODE: a.PROD_CODE, + CUST_CODE: a.CUST_CODE, + }; + var pnode = [n]; + while (pnode[0].properties.operType == 'Action') { + pnode = unref(lf).getNodeIncomingNode(pnode[0].id); + if (pnode[0].properties.operType != 'Action') { + act.NODE_ID = pnode[0].id; + break; + } + } + currRotData.acts.push(act); } - } - currRotData.acts.push(act); - routeConfig.routeData.acts.push(act); + }); + routeConfig.routeData.acts = _diffacts; } else { + let _nodeName = ''; + switch (n.properties.operType) { + case 'End': + _nodeName = `${n.text.value}`; + break; + default: + _nodeName = `${n.text.value}_${_num}`; + break; + } var _diffnodes = diffnodes.length > 0 ? diffnodes : routeConfig.routeData.nodes; _diffnodes.forEach((nd) => { if (nd.ID == n.id) { @@ -207,10 +321,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) ? _nodeName : nd.NODE_NAME, ROT_ID: currRotData.route.ID, - SEGMENT: '', - OPER_CODE: '', + SEGMENT: nd.SEGMENT, + OPER_CODE: isNullOrEmpty(nd.OPER_CODE) ? n.properties.operCode : nd.OPER_CODE, GPH_TYPE: n.type, GPH_X: n.x, GPH_Y: n.y, @@ -218,9 +332,10 @@ GPH_TEXT: n.text.value, IS_ACTIVE: nd.IS_ACTIVE, IS_CALC_FPY: nd.IS_CALC_FPY, + ALLOW_DFT_IN: nd.ALLOW_DFT_IN, CAN_SKIP: nd.CAN_SKIP, REMARK: nd.REMARK, - AUTH_ORG: '', + AUTH_ORG: useUserStore().getUserInfo.orgCode, AUTH_PROD: '', AUTH_WH: '', IS_FIRST_NODE: 'N', @@ -232,6 +347,9 @@ OPTION_4: '', OPTION_5: '', node: {} as node, + WORK_ORDER: nd.WORK_ORDER, + PROD_CODE: nd.PROD_CODE, + CUST_CODE: nd.CUST_CODE, }; nd.GPH_TYPE = n.type; nd.GPH_PROP = JSON.stringify(n.properties); @@ -241,6 +359,8 @@ if (unref(lf).getNodeIncomingNode(n.id).length == 0) { node.IS_FIRST_NODE = 'Y'; nd.IS_FIRST_NODE = 'Y'; + node.IS_INPUT = 'Y'; + nd.IS_INPUT = 'Y'; } currRotData.nodes.push(node); } @@ -270,7 +390,7 @@ GPH_PROP: JSON.stringify(e.properties), GPH_POTS: JSON.stringify(e.pointsList), REMARK: '', - AUTH_ORG: '', + AUTH_ORG: useUserStore().getUserInfo.orgCode, AUTH_PROD: '', AUTH_WH: '', EDGE_TYPE: 0, @@ -280,9 +400,13 @@ OPTION_4: '', OPTION_5: '', edge: {} as edge, + WORK_ORDER: routeConfig.routeData.route.WORK_ORDER, + PROD_CODE: routeConfig.routeData.route.PROD_CODE, + CUST_CODE: routeConfig.routeData.route.CUST_CODE, }; routeConfig.routeData.edges.push(edge); currRotData.edges.push(edge); + _numEdge++; }); return currRotData; }; @@ -292,7 +416,10 @@ */ async function handleSave(lf) { console.log('handleSave', unref(lf).getGraphData().nodes[0]); - if (isNullOrEmpty(currRoute.value.ROT_CODE)) { + if ( + isNullOrEmpty(currRoute.value.ROT_CODE) || + (props.rotType == 'Wo' && isNullOrEmpty(currRoute.value.WORK_ORDER)) + ) { createErrorModal({ title: t('鏈�夋嫨'), content: t('鏈�夋嫨宸ヨ壓璺嚎鎴栬�呮柊澧炲伐鑹鸿矾绾�'), @@ -300,29 +427,43 @@ }); } else { var hasError = false; + let msg = ''; unref(lf) .getGraphData() .nodes.forEach((n) => { + /* 鍒ゆ柇鏄惁鏈塏ode鏈繛鎺� */ if ( unref(lf).getNodeIncomingEdge(n.id).length == 0 && unref(lf).getNodeOutgoingEdge(n.id).length == 0 ) { hasError = true; + msg = '鏈夎妭鐐规湭杩炵嚎锛岃閲嶆柊璁捐宸ヨ壓璺嚎鍐嶄繚瀛樻暟鎹紒'; + } + if ( + unref(lf) + .getNodeOutgoingNode(n.id) + .some((q) => q.properties.operType == 'End') && + unref(lf) + .getNodeOutgoingNode(n.id) + .some((q) => q.properties.operType != 'End' && q.properties.operType != 'Action') + ) { + hasError = true; + msg = '瀹屽伐鑺傜偣涓嶆槸鍞竴鐨勬渶鍚庤妭鐐癸紝璇烽噸鏂拌璁″伐鑹鸿矾绾垮啀淇濆瓨鏁版嵁锛�'; } }); if (hasError) { createErrorModal({ title: t('璀﹀憡'), - content: t('鏈夎妭鐐规湭杩炵嚎锛岃閲嶆柊璁捐宸ヨ壓璺嚎鍐嶄繚瀛樻暟鎹紒'), + content: t(msg), getContainer: () => document.body, }); } else { - var action = await SaveRouteData(GetRotData(lf)); + var action = + props.rotType == 'Wo' + ? await SaveWoRouteData(GetRotData(lf)) + : await SaveRouteData(GetRotData(lf)); if (action.IsSuccessed) { - notification['success']({ - message: '鎿嶄綔鎴愬姛', - description: `淇濆瓨宸ヨ壓璺嚎锛�${currRoute.value.ROT_CODE} 鎴愬姛`, - }); + await refreshPage(); } } } @@ -348,87 +489,225 @@ function handleSelect(data, lf) { lf.graphModel.clearSelectElements(); lf.graphModel.getNodeModelById(data.data.id).setSelected(true); + let nnn = lf.graphModel.getNodeIncomingNode(data.data.id); selectnode.value = data.data; - if (isNullOrUnDef(routeConfig.routeData)) { - //鍏堝垵濮嬪寲routeData - routeConfig.routeData = {}; - routeConfig.routeData.route = currRoute.value; - routeConfig.routeData.nodes = []; - routeConfig.routeData.edges = []; - routeConfig.routeData.acts = []; - //鍐嶈繑鍥炲叿浣撴暟鎹� - routeConfig.routeData = GetRotData(lf); - } - var _node = routeConfig.routeData.nodes.filter((x) => x.ID == selectnode.value.id)[0]; - if (isNullOrUnDef(_node)) { - _node = { - 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, - NODE_NAME: `${currRoute.value.ROT_CODE}_${selectnode.value.text.value}_0`, - ROT_ID: currRoute.value.ID, - SEGMENT: '', - OPER_CODE: selectnode.value.type, - GPH_TYPE: selectnode.value.type, - GPH_X: selectnode.value.x, - GPH_Y: selectnode.value.y, - GPH_PROP: '', - GPH_TEXT: selectnode.value.text.value, - IS_ACTIVE: 'Y', - IS_CALC_FPY: 'N', - CAN_SKIP: 'N', - REMARK: '', - AUTH_ORG: '', - AUTH_PROD: '', - AUTH_WH: '', - IS_FIRST_NODE: '', - IS_INPUT: '', - IS_OUTPUT: '', - OPTION_1: '', - OPTION_2: '', - OPTION_3: '', - OPTION_4: '', - OPTION_5: '', - node: {} as node, - }; - routeConfig.routeData.nodes.push(_node); - } - if (selectnode.value.properties.operType && selectnode.value.properties.operType == 'Action') { - routeConfig.activeKey = 3; + if ( + unref(lf) + .getGraphData() + .nodes.some((q) => q.properties.operCode == 'EndNode' && q.id != selectnode.value.id) && + selectnode.value.properties.operType == 'End' + ) { + lf.graphModel.deleteNode(selectnode.value.id); + createErrorModal({ + title: t('璀﹀憡'), + content: t('宸茬粡瀛樺湪瀹屽伐鑺傜偣锛屼笉鑳藉啀鎷栧叆瀹屽伐鑺傜偣锛�'), + getContainer: () => document.body, + }); } else { - routeConfig.currentItem = { - 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, - NODE_NAME: _node.NODE_NAME ?? '', - ROT_ID: currRoute.value.ID, - SEGMENT: _node.SEGMENT, - OPER_CODE: _node.OPER_CODE, - GPH_TYPE: selectnode.value.type, - GPH_X: selectnode.value.x, - GPH_Y: selectnode.value.y, - GPH_PROP: '', - GPH_TEXT: selectnode.value.text.value, - IS_ACTIVE: _node.IS_ACTIVE, - IS_CALC_FPY: _node.IS_CALC_FPY, - CAN_SKIP: _node.CAN_SKIP, - IS_INPUT: _node.IS_INPUT, - IS_OUTPUT: _node.IS_OUTPUT, - REMARK: _node.REMARK, - }; - routeConfig.isCalcFpy = _node.IS_CALC_FPY == 'Y'; - routeConfig.canSkip = _node.CAN_SKIP == 'Y'; - routeConfig.isInput = _node.IS_INPUT == 'Y'; - routeConfig.isOutput = _node.IS_OUTPUT == 'Y'; + if (isNullOrUnDef(routeConfig.routeData)) { + //鍏堝垵濮嬪寲routeData + routeConfig.routeData = {}; + routeConfig.routeData.route = currRoute.value; + routeConfig.routeData.nodes = []; + routeConfig.routeData.edges = []; + routeConfig.routeData.acts = []; + //鍐嶈繑鍥炲叿浣撴暟鎹� + routeConfig.routeData = GetRotData(lf); + } - console.log(routeConfig.currentItem); - routeConfig.activeKey = 2; + var _node = routeConfig.routeData.nodes.filter((x) => x.ID == selectnode.value.id)[0]; + if (isNullOrUnDef(_node)) { + let _nodeName = ''; + switch (selectnode.value.properties.operType) { + case 'End': + _nodeName = `${selectnode.value.text.value}`; + break; + default: + _nodeName = `${selectnode.value.text.value}_${_num}`; + break; + } + _node = { + 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, + NODE_NAME: _nodeName, + ROT_ID: currRoute.value.ID, + SEGMENT: '', + OPER_CODE: selectnode.value.properties.operCode, + 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, + IS_ACTIVE: 'Y', + IS_CALC_FPY: 'N', + CAN_SKIP: 'N', + REMARK: '', + AUTH_ORG: useUserStore().getUserInfo.orgCode, + AUTH_PROD: '', + AUTH_WH: '', + IS_FIRST_NODE: '', + ALLOW_DFT_IN: '', + IS_INPUT: '', + IS_OUTPUT: '', + OPTION_1: '', + OPTION_2: '', + OPTION_3: '', + OPTION_4: '', + OPTION_5: '', + node: {} as node, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: '', + }; + routeConfig.routeData.nodes.push(_node); + _num++; + } + //鏄涓� + 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: useUserStore().getUserInfo.orgCode, + AUTH_PROD: '', + AUTH_WH: '', + ACT_NAME: `${selectnode.value.text.value}_${_numEdge}`, + 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: 'Y', + NEED_RESET: 'N', + // 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, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: '', + }; + routeConfig.routeData.acts.push(_act); + _numEdge++; + } + routeConfig.currentAct = { + 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: _act.AUTH_ORG, + AUTH_PROD: _act.AUTH_PROD, + AUTH_WH: _act.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, + 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: _act.NEED_SETUP, + NEED_RESET: _act.NEED_RESET, + // 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: '', + OPTION_3: '', + OPTION_4: '', + OPTION_5: '', + REMARK: '', + node: {} as node, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: '', + }; + const actModel = lf.getNodeModelById(selectnode.value.id); + actModel.updateText(routeConfig.currentAct?.ACT_NAME); + } else { + //鏄伐搴� + IsOperation.value = false; + routeConfig.currentItem = { + 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: _node.AUTH_ORG, + AUTH_PROD: _node.AUTH_PROD, + AUTH_WH: _node.AUTH_WH, + NODE_NAME: _node.NODE_NAME ?? '', + ROT_ID: currRoute.value.ID, + SEGMENT: _node.SEGMENT, + OPER_CODE: selectnode.value.properties.operCode, + 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, + IS_ACTIVE: _node.IS_ACTIVE, + IS_CALC_FPY: _node.IS_CALC_FPY, + CAN_SKIP: _node.CAN_SKIP, + IS_INPUT: _node.IS_INPUT, + ALLOW_DFT_IN: _node.ALLOW_DFT_IN, + IS_OUTPUT: _node.IS_OUTPUT, + REMARK: _node.REMARK, + WORK_ORDER: currRoute.value.WORK_ORDER, + PROD_CODE: currRoute.value.PROD_CODE, + CUST_CODE: '', + node: {} as node, + }; + 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.isActive = _node.IS_ACTIVE == 'Y'; + routeConfig.allowDftIn = _node.ALLOW_DFT_IN == 'Y'; + routeConfig.isInput = _node.IS_INPUT == 'Y'; + routeConfig.isOutput = _node.IS_OUTPUT == 'Y'; + setTimeout(() => { + console.log(routeConfig.currentItem); + routeConfig.activeKey = 2; + IsOperation.value = true; + title.value = '宸ュ簭'; + posttitle.value = '宀椾綅'; + }, 100); + } } } @@ -436,11 +715,57 @@ unref(lfInstance).render({}); } + /** + * @description: 鎷栧姩杈规斁寮�鏃朵簨浠� + * @param {*} data + * @param {*} lf + * @return {*} + */ + function AnchorDrop(data, lf) { + let targetNode = lf.graphModel.getNodeModelById(data.edgeModel.targetNodeId); + if (targetNode.properties['operType'] == 'End') { + if (data.nodeModel.properties['operType'] == 'Action') { + lf.graphModel.deleteEdgeById(data.edgeModel.id); + createErrorModal({ + title: t('璀﹀憡'), + content: t('琛屼负鑺傜偣涓嶈兘杩炴帴瀹屽伐鑺傜偣锛�'), + getContainer: () => document.body, + }); + } else { + if ( + unref(lf).getNodeIncomingNode(data.nodeModel.id).length == 0 && + unref(lf) + .getNodeOutgoingNode(data.nodeModel.id) + .some((q) => q.properties.operType == 'Node') + ) { + lf.graphModel.deleteEdgeById(data.edgeModel.id); + createErrorModal({ + title: t('璀﹀憡'), + content: t('寮�濮嬭妭鐐逛笉鑳界洿鎺ヨ繛鎺ュ畬宸ヨ妭鐐癸紒'), + getContainer: () => document.body, + }); + } + } + } + } + + /** + * @description: 閿氱偣杩炵嚎缁撴潫锛屼笉绠℃槸鍚﹀垱寤鸿繛绾块兘浼氳Е鍙戙�� + * @param {*} data + * @param {*} e + * @param {*} nodeModel + * @param {*} lf + * @return {*} + */ + function AnchorDragend(data, e, nodeModel, lf) {} + /* *鐐瑰嚮鐢诲竷浜嬩欢 */ function clickBlank() { routeConfig.activeKey = 1; + title.value = ''; + posttitle.value = ''; } /* @@ -460,4 +785,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