From 47df576f3a56a657b97c6179417a2d0f80441471 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期三, 12 六月 2024 18:36:14 +0800 Subject: [PATCH] 岗位资源更新 --- src/views/tigerprojects/mes/eng/route/index.vue | 211 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 161 insertions(+), 50 deletions(-) diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue index ae4e723..0c3ead0 100644 --- a/src/views/tigerprojects/mes/eng/route/index.vue +++ b/src/views/tigerprojects/mes/eng/route/index.vue @@ -16,11 +16,18 @@ collapsible :reverseArrow="true" collapsedWidth="0" - width="300" + width="400" style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 10px" :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" + :colSlots="colSlots" + :crudColSlots="crudColSlots" + :entityName="entityName"> <!-- <template v-for="item of formConfig.schemas" #[`${item.component}Props`]="data"> <slot :name="`${item.component}Props`" @@ -35,13 +42,13 @@ </PageWrapper> </template> -<script lang="ts" setup> +<script lang="ts" setup name="Route_View"> import { FlowChart } from '/@/components/FlowChart'; import { PageWrapper } from '/@/components/Page'; import { SaveRouteData, getRouteData } 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, @@ -62,6 +69,8 @@ import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; import { useRoute } from 'vue-router'; import { useTabs } from '/@/hooks/web/useTabs'; + import LogicFlow from '@logicflow/core'; +import { getEntity } from '/@/api/tigerapi/system'; const [registerDrawer, { openDrawer }] = useDrawer(); const [registerModal, { openModal }] = useModal(); @@ -91,9 +100,59 @@ provide<Ref<MES_ROUTE>>('mesRoute', currRoute); const selectnode = ref({} as node); const currRotId = ref(route.params?.id); - + const colSlots = ref<any>([]); + const crudColSlots = ref<any>([]); + const entityName = ref<any>('MES_POSITION'); + const props = defineProps({ + rotId: { type: String, default: '' }, + }); + const IsOperation = ref(false); + const title = ref(''); + const posttitle = ref(''); + watch( + () => props.rotId, + (v) => { + if (v !== currRotId.value) { + currRotId.value = v; + if (!isNullOrUnDef(unref(currlf))) { + unref(currlf).render({}); + routeData.value = { + nodes: [], + edges: [], + }; + init(currlf); + } + } + }, + { deep: true }, + ); + + const currlf = ref(null) as Ref<LogicFlow | null>; console.log(currRotId.value); + + onMounted(() => { + getEntity({ + sqlcmd: `ASSEMBLY_NAME ='MES_POSITION'`, + entityName: 'SYS_LOW_CODE', + }).then((data) => { + var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); + for (const i in searchForms) { + if(!isNullOrUnDef(searchForms[i]['colSlot'])){ + colSlots.value.push('form-'+searchForms[i]['colSlot']); + } + } + + var _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); + for (const i in _cruds) { + if(!isNullOrUnDef(_cruds[i]['colSlot'])){ + crudColSlots.value.push(_cruds[i]['colSlot']); + } + } + entityName.value = 'MES_POSITION'; + }); + }); async function init(lf) { + currlf.value = unref(lf); //閫氳繃宸ヨ壓璺嚎ID鑾峰彇鍥惧舰鏁版嵁锛屽苟娓叉煋 var _data = await getRouteData(currRotId.value); console.log('缁勪欢宸叉寕杞�', _data); @@ -102,7 +161,7 @@ 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); } _data.Data.nodes.forEach((n) => { @@ -152,50 +211,58 @@ 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: '', + 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: 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, + }; + 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 { var _diffnodes = diffnodes.length > 0 ? diffnodes : routeConfig.routeData.nodes; _diffnodes.forEach((nd) => { @@ -209,8 +276,8 @@ GHOST_ROW: false, NODE_NAME: `${currRotData.route.ROT_CODE}_${n.text.value}_${_num}`, ROT_ID: currRotData.route.ID, - SEGMENT: '', - OPER_CODE: '', + SEGMENT: nd.SEGMENT, + OPER_CODE: nd.OPER_CODE, GPH_TYPE: n.type, GPH_X: n.x, GPH_Y: n.y, @@ -359,6 +426,7 @@ //鍐嶈繑鍥炲叿浣撴暟鎹� routeConfig.routeData = GetRotData(lf); } + var _node = routeConfig.routeData.nodes.filter((x) => x.ID == selectnode.value.id)[0]; if (isNullOrUnDef(_node)) { _node = { @@ -396,9 +464,47 @@ }; routeConfig.routeData.nodes.push(_node); } + //鏄涓� if (selectnode.value.properties.operType && selectnode.value.properties.operType == 'Action') { - routeConfig.activeKey = 3; + var _act = routeConfig.routeData.acts.filter((x) => x.ID == selectnode.value.id)[0]; + routeConfig.activeKey = 2; + IsOperation.value = false; + title.value = '琛屼负'; + posttitle.value = ''; + 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: '', + AUTH_PROD: '', + AUTH_WH: '', + ACT_NAME: _act.ACT_NAME, + 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, + 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, + }; } else { + //鏄伐搴� routeConfig.currentItem = { ID: selectnode.value.id, CREATE_TIME: currRoute.value.CREATE_TIME, @@ -429,6 +535,9 @@ console.log(routeConfig.currentItem); routeConfig.activeKey = 2; + IsOperation.value = true; + title.value = '宸ュ簭'; + posttitle.value = '宀椾綅'; } } @@ -441,6 +550,8 @@ */ function clickBlank() { routeConfig.activeKey = 1; + title.value = ''; + posttitle.value = ''; } /* -- Gitblit v1.9.3