From 8a12783afd1d6c4881d90e66bb0a52010a1598ae Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 27 二月 2025 00:52:57 +0800 Subject: [PATCH] 一些更改 --- src/views/tigerprojects/system/lowcode/detail/index.vue | 109 ++++++------------------------------------------------ 1 files changed, 13 insertions(+), 96 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/detail/index.vue b/src/views/tigerprojects/system/lowcode/detail/index.vue index 8d2fc58..f64f685 100644 --- a/src/views/tigerprojects/system/lowcode/detail/index.vue +++ b/src/views/tigerprojects/system/lowcode/detail/index.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-05-30 13:28:20 * @LastEditors: Ben Lin - * @LastEditTime: 2024-06-23 22:58:33 + * @LastEditTime: 2024-07-22 01:55:07 --> <template> <PageWrapper :title="pageTitle" :content="contentStr" contentBackground @back="goBack"> @@ -20,61 +20,31 @@ <detail :entityName="entityName" /> </Suspense> </div> - <div v-if="currentKey == 'detailsecond'"> - <Suspense></Suspense> - </div> </div> - <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> </PageWrapper> </template> <script lang="ts" setup> - import { ref, provide, Ref } from 'vue'; + import { ref, provide, Ref, defineAsyncComponent } from 'vue'; import { useRoute } from 'vue-router'; import { PageWrapper } from '/@/components/Page'; import { useTabs } from '/@/hooks/web/useTabs'; import { Tabs } from 'ant-design-vue'; import { useGo } from '/@/hooks/web/usePage'; import { OpenCustModal, custOnChange } from '../data'; - import detail from './detail.vue'; import { useI18n } from '/@/hooks/web/useI18n'; import { useMessage } from '/@/hooks/web/useMessage'; - import GeneralModal from '/@/views/components/GeneralModal.vue'; - import CustModal from '/@/views/components/CustModal.vue'; - import { BasicForm } from '/@/components/Form/index'; import { useGlobSetting } from '/@/hooks/setting'; - import { useModal } from '/@/components/Modal'; const { t } = useI18n(); - + const detail = defineAsyncComponent(() => import('./detail.vue')); const { createMessage } = useMessage(); const route = useRoute(); - const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); + // const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); + 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 ATabs = ref(Tabs); const ATabPane = ref(Tabs.TabPane); var ITEM_CODE = ref(''); @@ -83,21 +53,13 @@ const contentStr = ref(objParams.value.contentStr); const firstTabName = ref(objParams.value.firstTabName); const secondTabName = ref(objParams.value.secondTabName); - const entityName = ref(objParams.value.Name); + const entityName = ref(routeParams.value.Name); const detailName = ref(objParams.value.detailName); const globSetting = useGlobSetting(); - const formSchemas = ref({}); //寮瑰嚭妗嗗琛ㄥ崟缁撴瀯 - const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 - const useFormData = ref({}); - const secondColSlots = ref<any>(objParams.value.secondColSlots); //鎸夐挳鎻掓Ы const crudColSlots = ref<any>(objParams.value.colSlots); - const cType = ref(''); - const dtlSlots = ref([] as any[]); - const selectVals = ref({}); - const others = ref<any>(null); + const keyFieldValues = ref<any>(null); provide<Ref<any>>('objParams', objParams.value); - provide<Ref<any>>('others', others); - const [registerCust] = useModal(); + provide<Ref<any>>('keyFieldValues', keyFieldValues); var currentKey = ref('detailfirst'); const { setTitle } = useTabs(); @@ -109,11 +71,11 @@ function goBack() { /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ try { - import(/* @vite-ignore */ `../entityts/${entityName.value}`) + import(`../entityts/${entityName.value}.ts`) .then((m) => { const [{ GetHomeUrl }] = m.default(); // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤� - go(GetHomeUrl(entityName.value)); + go(GetHomeUrl({ colSlots: crudColSlots.value })); }) .catch(() => {}); } catch (e) {} @@ -140,50 +102,5 @@ }; }; } - } - - /** - * @description: 鑷畾涔夊脊鍑烘纭畾杩斿洖 - * @param {*} d - * @return {*} - */ - function custSuccess(d) { - // reload(); - } - - /** - * @description: 鍚勮〃鍗曞唴寮瑰嚭閫夋嫨妗嗛�夋嫨鎴愬姛鍚庢柟娉� - * @param {*} d - * @param {*} u - * @param {*} item - * @return {*} - */ - function handleEntSuccess(d, u, item) { - /* 鍔ㄦ�乮mport瀹炰綋鍚�.ts鐨勮嚜瀹氫箟鏂规硶 */ - try { - import(/* @vite-ignore */ `../entityts/${cType.value}`).then((m) => { - const [{ GetSelectSuccess }] = m.default(); - var values = GetSelectSuccess(d, u); - selectVals.value = values; //淇濆瓨寮瑰嚭妗嗛�夋嫨鐨勭粨鏋� - let _val = {}; - _val[d.returnFieldName] = values[d.returnFieldName]; - useFormData.value[item][1].setFieldsValue(_val); - }); - } catch (e) {} - } - - /** - * @description: 鎵撳紑鑷畾涔夋ā鎬佹 - * @param {*} item - * @return {*} - */ - function handleCustClick(item) { - OpenCustModal( - useModalData.value[item][1].openModal, //甯﹀叆openModal鏂规硶 - cType.value, - item, - [], - // selectVals.value['ROUTE_CODE'], - ); //[openRvModal], selectVals.value['ID']杩欐槸鑷畾涔夊弬鏁帮紝鎸夊疄闄呴渶姹� } </script> -- Gitblit v1.9.3