From c24509087b1193c18ee4c87487b0fc4bf8ee0918 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期一, 22 七月 2024 18:40:26 +0800 Subject: [PATCH] 工单更新 --- src/views/tigerprojects/system/lowcode/composition/index.vue | 138 ++++++++++++++++++++++++++++++++------------- 1 files changed, 98 insertions(+), 40 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/composition/index.vue b/src/views/tigerprojects/system/lowcode/composition/index.vue index 7d1bda7..5422a86 100644 --- a/src/views/tigerprojects/system/lowcode/composition/index.vue +++ b/src/views/tigerprojects/system/lowcode/composition/index.vue @@ -1,3 +1,11 @@ +<!-- + * @Description: 閫氱敤缁勫悎椤甸潰锛屽乏杈规槸鏍戯紝鍙宠竟鏄厤缃� + * @Author: Ben Lin + * @version: + * @Date: 2024-06-18 23:30:30 + * @LastEditors: Ben Lin + * @LastEditTime: 2024-07-22 16:25:39 +--> <template> <PageWrapper :dense="dense" @@ -9,12 +17,19 @@ @back="goBack" > <Suspense class="w-1/4 xl:w-1/5"> - <LeftTree @select="NodeSelect"/> + <LeftTree @select="NodeSelect" /> </Suspense> <Suspense> <div class="w-3/4 xl:w-4/5 p-5"> - <CarGridNav v-if="showNav" /> - <Config v-if="showConfig" @success="configSuccess"/> + <CarGridNav v-if="showNav" :configType="configType" :nodes="nodes"> + <template #[item] v-for="item in otherSlots" :key="item"> + <!-- 鑷畾涔夊唴瀹� --> + <div class="h-full" style="height: 400px"> + <FlowChartView :data="routeData" @init="init" /> + </div> + </template> + </CarGridNav> + <Config v-if="showConfig" :configType="configType" @success="configSuccess" /> </div> </Suspense> <!-- <BasicTable class="w-3/4 xl:w-4/5" @register="registerTable"> @@ -28,32 +43,35 @@ </template> </BasicTable> --> <!-- <normalDrawer @register="registerDrawer" @success="handleSuccess" /> --> - <CustModal - @register="registerCust" - @success="custSuccess" - :type="cType" - :detailSlots="dtlSlots" - > - <!-- 鐢ㄦ彃妲借嚜瀹氫箟澶氳〃鍗� --> - <template #[item.name] v-for="item in dtlSlots" :key="item.name"> - <BasicForm @register="useFormData[item.name][0]" v-if="useFormData[item.name]"> - <!-- 鐢ㄦ彃妲借嚜瀹氫箟寮瑰嚭閫夋嫨妗� --> - <template #[name]="{ field }" v-for="name in item.slots" :key="name"> - <a-button - class="mt-1 ml-1" - size="small" - @click="handleCustClick(field)" - :preIcon="item.preIcons[name]" - /> - <GeneralModal - @register="useModalData[name][0]" - @success="(d, u) => handleEntSuccess(d, u, item.name)" - /> - </template> - </BasicForm> - <!-- 鑷畾涔夊唴瀹� --> - </template> - </CustModal> + <Suspense> + <CustModal + @register="registerCust" + @success="custSuccess" + :type="cType" + :detailSlots="dtlSlots" + :entityName="entityName" + > + <!-- 鐢ㄦ彃妲借嚜瀹氫箟澶氳〃鍗� --> + <template #[item.name] v-for="item in dtlSlots" :key="item.name"> + <BasicForm @register="useFormData[item.name][0]" v-if="useFormData[item.name]"> + <!-- 鐢ㄦ彃妲借嚜瀹氫箟寮瑰嚭閫夋嫨妗� --> + <template #[name]="{ field }" v-for="name in item.slots" :key="name"> + <a-button + class="mt-1 ml-1" + size="small" + @click="handleCustClick(field)" + :preIcon="item.preIcons[name]" + /> + <GeneralModal + @register="useModalData[name][0]" + @success="(d, u) => handleEntSuccess(d, u, item.name)" + /> + </template> + </BasicForm> + <!-- 鑷畾涔夊唴瀹� --> + </template> + </CustModal> + </Suspense> </PageWrapper> </template> <script lang="ts" setup> @@ -64,14 +82,16 @@ import Config from './Config.vue'; import LeftTree from './LeftTree.vue'; import CustModal from '/@/views/components/CustModal.vue'; - import { OpenCustModal } from '../data'; - import { Ref, onMounted, provide, ref } from 'vue'; + import { OpenCustModal, initRoute } from '../data'; + import { Ref, VNode, onMounted, provide, ref, unref } from 'vue'; + import { FlowChartView } from '/@/components/FlowChart'; import { useRoute } from 'vue-router'; import { BasicForm, useForm } from '/@/components/Form/index'; import { useTabs } from '/@/hooks/web/useTabs'; import { isNullOrUnDef } from '/@/utils/is'; import { useGo } from '/@/hooks/web/usePage'; import { useMessage } from '/@/hooks/web/useMessage'; + import LogicFlow from '@logicflow/core'; defineOptions({ name: 'DeptManagement' }); @@ -79,26 +99,36 @@ const go = useGo(); const route = useRoute(); const { setTitle } = useTabs(); - const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); //ref(JSON.parse(history.state.obj)) - const entityName = ref(objParams.value.Name); + // const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); //ref(JSON.parse(history.state.obj)) + const routeParams = ref(JSON.parse(decodeURI(route.params?.id as string))); + // 浠巗essionStorage涓鍙栧弬鏁板苟杞崲鍥炲璞� + const savedParams = sessionStorage.getItem(`${routeParams.value.sName}_params`); + const objParams = savedParams ? ref(JSON.parse(decodeURI(savedParams))) : ref({}); + const entityName = ref(routeParams.value.Name); const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 const useFormData = ref({}); const cType = ref(''); const dtlSlots = ref([] as any[]); + const otherSlots = ref<any[]>([]); const selectVals = ref({}); const dense = isNullOrUnDef(objParams.value.dense) ? ref(false) : ref(objParams.value.dense); const pageTitle = ref(objParams.value.pageTitle); const pageContent = ref(objParams.value.pageContent); - const nodeType = ref(''); + const colSlots = ref<any>(objParams.value.colSlots); const selectedNodes = ref([]); const isMounted = ref(false); const showNav = ref(false); const showConfig = ref(false); + const configType = ref(''); + const nodes = ref([]); + const routeData = ref({ + nodes: [], + edges: [], + }); const custImport = ref<any>(null); const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); - provide<Ref<string>>('nodeType', nodeType); provide<Ref<any>>('objParams', objParams); - provide<Ref<any>>('selectedNodes', selectedNodes); + provide<Ref<any>>('selectedNodes', nodes); setTitle(objParams.value.Title); //璁剧疆鏍囩椤垫爣棰� /** @@ -109,7 +139,7 @@ if (!isNullOrUnDef(custImport.value)) { const [{ GetHomeUrl }] = custImport.value['default'](); // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤� - go(GetHomeUrl(entityName.value)); + go(GetHomeUrl({colSlots:colSlots.value})); } } @@ -122,20 +152,46 @@ /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { custImport.value = await import(`../entityts/${entityName.value}.ts`); + if (custImport.value['default']) { + otherSlots.value = custImport.value['default']()[0]['GetSlots'](); + } isMounted.value = true; - } catch (e) {} + } catch (e) { + console.log(e); + } }); + + const currlf = ref(null) as Ref<LogicFlow | null>; + /** + * @description: 宸ヨ壓璺嚎鍒濆鍖� + * @param {*} lf + * @return {*} + */ + async function init(lf, rotId) { + initRoute(lf, rotId, routeData, currlf); + } /** * @description: 閫夋嫨鑺傜偣鏃舵牴鎹繑鍥炵殑浜嬩欢鍙傛暟鏄剧ず闅愯棌鐩稿簲缁勪欢 * @param {*} e * @return {*} - */ + */ function NodeSelect(e) { showConfig.value = e.showConfig; showNav.value = e.showNav; + configType.value = e.type; + nodes.value = e.nodes; + routeData.value = { + nodes: [], + edges: [], + }; + initRoute(currlf, e.nodes[0].id, routeData, currlf); } + /** + * @description: 淇濆瓨閰嶇疆鎴愬姛杩斿洖鏂规硶 + * @return {*} + */ function configSuccess() { notification.success({ message: '鎴愬姛淇濆瓨琛屼负閰嶇疆鏁版嵁' }); } @@ -164,7 +220,9 @@ var values = GetSelectSuccess(d, u); selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋� let _val = {}; - _val[d.returnFieldName] = values[d.returnFieldName]; + d.returnFieldName.map((x) => { + _val[x] = values[x]; + }); useFormData.value[item][1].setFieldsValue(_val); }); } catch (e) {} -- Gitblit v1.9.3