From ce374a9f4920a2d0e5ebe81a9872436088db6d55 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 07 三月 2025 15:57:34 +0800 Subject: [PATCH] 高级页面主Form日期字段转换格式,否则出错 --- src/views/tigerprojects/system/lowcode/high/edit/index.vue | 128 +++++++++++++++++++++++++++++++++--------- 1 files changed, 101 insertions(+), 27 deletions(-) diff --git a/src/views/tigerprojects/system/lowcode/high/edit/index.vue b/src/views/tigerprojects/system/lowcode/high/edit/index.vue index 9160eda..e33e0dd 100644 --- a/src/views/tigerprojects/system/lowcode/high/edit/index.vue +++ b/src/views/tigerprojects/system/lowcode/high/edit/index.vue @@ -4,7 +4,7 @@ * @version: * @Date: 2024-06-18 15:09:48 * @LastEditors: Ben Lin - * @LastEditTime: 2024-07-27 12:59:25 + * @LastEditTime: 2024-08-03 10:09:25 --> <template> <PageWrapper @@ -18,7 +18,12 @@ </Suspense> <!-- <a-card :title="titleInfo['baseTableTitle']" :bordered="false" class="!mt-5"> --> <Suspense> - <Editdtl :entityName="entityName" @search="dtlFormSearch" /> + <Editdtl + :entityName="entityName" + @search="dtlFormSearch" + @gettables="GetTablesData" + @opencust="OpenCust" + /> </Suspense> <!-- </a-card> --> <a-card @@ -64,10 +69,11 @@ </template> </CustModal> </Suspense> + <GeneralModal @register="register" @success="handleCustSuccess" /> </PageWrapper> </template> <script lang="ts" setup> - import { Ref, h, nextTick, onMounted, provide, reactive, ref, unref } from 'vue'; + import { Ref, nextTick, onMounted, provide, ref, unref } from 'vue'; import { Card } from 'ant-design-vue'; import { PageWrapper } from '/@/components/Page'; import baseForm from '../baseForm.vue'; @@ -76,7 +82,7 @@ import { useGlobSetting } from '/@/hooks/setting'; import { useRoute, useRouter } from 'vue-router'; import CustModal from '/@/views/components/CustModal.vue'; - import { BasicForm, useForm } from '/@/components/Form/index'; + import { BasicForm } from '/@/components/Form/index'; import { custOnChange, OpenCustModal } from '../../data'; import { useModal } from '/@/components/Modal'; import { useLocale } from '/@/locales/useLocale'; @@ -84,7 +90,7 @@ import { useMultipleTabStore } from '/@/store/modules/multipleTab'; import { useTabs } from '/@/hooks/web/useTabs'; import { buildUUID } from '/@/utils/uuid'; - import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; + import { isNullOrUnDef } from '/@/utils/is'; import { useI18n } from '/@/hooks/web/useI18n'; import { isFunction } from 'xe-utils'; import Editdtl from './editdtl.vue'; @@ -111,7 +117,7 @@ const titleInfo = ref({}); //getTitle(objParams.value.Name); const isAllUpdate = ref(objParams.value.CODE != '0'); const globSetting = useGlobSetting(); - const formSchemas = ref({}); //寮瑰嚭妗嗘垨楂樼骇椤甸潰澶氳〃鍗曠粨鏋� + const colSlots = ref<any>(objParams.value.colSlots); const useModalData = ref({}); //琛ㄥ崟涓彃妲芥覆鏌撴寜閽墦寮�妯℃�佹useModal鏂规硶 const useFormData = ref({}); const useTableData = ref({}); @@ -135,7 +141,8 @@ provide<Ref<any>>('baseCards', baseCards); provide<Ref<any>>('useTables', useTables); - const [registerCust, { openModal: openCustomModal, closeModal }] = useModal(); + const [registerCust] = useModal(); + const [register, { openModal, closeModal }] = useModal(); const { setTitle } = useTabs(); setTitle(objParams.value.Title); //璁剧疆鏍囩椤垫爣棰� @@ -143,7 +150,7 @@ if (!isNullOrUnDef(custImport.value)) { const [{ GetHomeUrl }] = custImport.value['default'](); // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤� - go(GetHomeUrl(entityName.value)); + go(GetHomeUrl({ colSlots: colSlots.value })); } } @@ -160,32 +167,91 @@ }); /** + * @description: 鑾峰彇useTable + * @param {*} d + * @return {*} + */ + function GetTablesData(d) { + useTableData.value = d; + } + + const currTableName = ref(''); + const currRecordId = ref(''); + /** + * @description: 琛ㄦ牸鍐呮墦寮�寮规浜嬩欢 + * @param {*} d + * @return {*} + */ + function OpenCust(d) { + console.log(d.name); + currTableName.value = d.name; + currRecordId.value = d.data.ID; + data.value[d.name].map((x) => { + if (x.ID == currRecordId.value && x.VAR_TYPE != d.data.VAR_TYPE) { + x.VAR_TYPE = d.data.VAR_TYPE; + } + }); + openModal(true, d.modalSchema); + } + + /** + * @description: 琛ㄦ牸鍐呮墦寮�寮规浜嬩欢杩斿洖 + * @param {*} d + * @param {*} u + * @return {*} + */ + function handleCustSuccess(d, u) { + let currRecord = {}; + const _data = data.value[currTableName.value].map((x) => { + if (x.ID == currRecordId.value) { + x.VAR_VALUE = d.values.val; + currRecord = x; + } + return x; + }); + const [{ CustEditEnd }] = custImport.value['default'](); + data.value[currTableName.value] = []; + useTables.value[currTableName.value][1].setProps({ + dataSource: [], + }); + data.value[currTableName.value] = _data; + useTables.value[currTableName.value][1].setProps({ + dataSource: data.value[currTableName.value], + }); + useTables.value[currTableName.value][1].reload(); + /* 鍗曞厓鏍肩紪杈戝畬鎴愬悗濡傛灉鏈夎嚜瀹氫箟鏂规硶锛屽氨璋冪敤 */ + if(CustEditEnd && isFunction(CustEditEnd)){ + CustEditEnd({record:currRecord},currTableName.value, useTables.value, data); + } + } + + /** * @description: 寮傛鍏ㄩ儴鎻愪氦鏂规硶 * @return {*} */ async function submitAll() { try { const validates = await validate(); - const Keys = Object.getOwnPropertyNames(useFormData.value); - let i; - let p = [] as Promise<any>[]; - for (i = 0; i < Keys.length; i++) { - p.push( - SaveEntity( - validates[Keys[i]], - unref(isAllUpdate), - baseCards.value[i]['entityName'], - `${objParams.value['IsExist']}='${validates[Keys[i]][objParams.value['IsExist']]}'`, - true, - ), - ); - } - await Promise.all(p); if ( !custImport.value['default']()[0].SubmitAll && !isFunction(custImport.value['default']()[0].SubmitAll) ) { /* 榛樿鎻愪氦 */ + const Keys = Object.getOwnPropertyNames(useFormData.value); + let i; + let p = [] as Promise<any>[]; + for (i = 0; i < Keys.length; i++) { + p.push( + SaveEntity( + validates[Keys[i]], + unref(isAllUpdate), + baseCards.value[i]['entityName'], + `${objParams.value['IsExist']}='${validates[Keys[i]][objParams.value['IsExist']]}'`, + true, + ), + ); + } + await Promise.all(p); objParams.value['drawers'].forEach((d) => { let where = `${d['code']} = '${keyFieldValues.value[d['code']]}'`; /* type: all-琛ㄧず闇�瑕乧ode鐨勬墍鏈夌殑鍊� */ @@ -193,11 +259,11 @@ where = `${d['code']} in (${data.value[d['keyName']].map((value) => `'${value[d['code']]}'`).join(',')})`; } /* 濡傛灉楂樼骇琛ㄥ崟涓叧鑱旂殑鏄疘D(IsID == true)锛屽垯涓嶇敤鍒濆鍖朓D */ - if (!objParams.value['IsID']) { + //if (!objParams.value['IsID']) { data.value[d['name']].map((item) => { item.ID = buildUUID(); }); - } + //} AddAfterDelete(d['name'], data.value[d['name']], where).then((action) => { if (action.IsSuccessed) { cancel(); @@ -206,9 +272,17 @@ }); } else { /* 濡傛灉鑷畾涔夋彁浜ゆ柟娉曞瓨鍦ㄥ氨鐢ㄨ嚜瀹氫箟鎻愪氦 */ - custImport.value['default']()[0].SubmitAll(data, keyFieldValues, cancel); + custImport.value['default']()[0].SubmitAll( + data, + keyFieldValues, + cancel, + objParams.value['drawers'], + validates, + ); } - } catch (error) {} + } catch (error) { + console.log(error) + } } async function cancel() { try { -- Gitblit v1.9.3