From ead6a92bd9b1ca8a44f058c281348495b3e0a89a Mon Sep 17 00:00:00 2001 From: expressgy Date: Thu, 11 Jul 2024 13:42:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2=E5=8F=98=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=8A=E7=BA=A7=E5=8F=98=E9=87=8F=E5=92=8C=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 2 +- src/views/Auth/Env/EnvForm.vue | 21 +++++---------------- src/views/Auth/Env/EnvPage.vue | 16 ++++++---------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/src/main.js b/src/main.js index 2424631..5622899 100644 --- a/src/main.js +++ b/src/main.js @@ -6,7 +6,7 @@ window.pino = Pino({ deb: 20, }, browser: { - asObject: true, + asObject: false, serialize: true }, }); diff --git a/src/views/Auth/Env/EnvForm.vue b/src/views/Auth/Env/EnvForm.vue index b98ad1f..d82390d 100644 --- a/src/views/Auth/Env/EnvForm.vue +++ b/src/views/Auth/Env/EnvForm.vue @@ -3,6 +3,7 @@ import { EnvFormRulesType, EnvFormType } from '@/views/Auth/Env/DataModal.js'; import { h, onMounted, ref, watch } from 'vue'; import { ReloadOutlined, SettingOutlined } from '@ant-design/icons-vue'; import { useBaseDataStore } from '@/stores'; +import AntdModalTemplate from '@/components/AntDesignVue/CustomAntDesignVue/AntdModalTemplate/index.vue'; const baseDataStore = useBaseDataStore(); defineOptions({ @@ -44,29 +45,16 @@ const handleAck = () => { if (Array.isArray(value.envVal) && value.envVal.length > 0) { data.envVal = value.envVal.slice(-1)[0]; } - props.data.handleAck(data).then(() => { - clearInput(); - }).catch(e => e); + props.data.handleAck(data).catch(e => e); }) .catch((err) => { formRef.value.scrollToField(err?.errorFields[0]?.name); }); }; -// ! 取消 -const handleCancel = () => { - props.data.handleCancel(); - clearInput(); -}; // ! 清除表单验证记录 function clearValidate() { formRef.value?.clearValidate(); } -// ! 清理表单内容 -function clearInput() { - formRef.value.resetFields(); - clearValidate(); -} - // ! pid watch(props.data.formData, (newVal, oldVal) => { if (newVal.pid != '') { @@ -106,6 +94,7 @@ onMounted(() => { { { diff --git a/src/views/Auth/Env/EnvPage.vue b/src/views/Auth/Env/EnvPage.vue index caba35c..20f0ed2 100644 --- a/src/views/Auth/Env/EnvPage.vue +++ b/src/views/Auth/Env/EnvPage.vue @@ -15,14 +15,7 @@ defineOptions({ }); onMounted(() => { - window.pino.info('@1 EnvPage Mounted!'); - window.pino.deb('debug@1 EnvPage Mounted!'); - window.pino.error('error@1 EnvPage Mounted!'); - window.pino.fatal('fatal@1 EnvPage Mounted!'); - window.pino.info('info@1 EnvPage Mounted!'); - window.pino.warn('warn@1 EnvPage Mounted!'); - window.pino.trace('trace@1 EnvPage Mounted!'); - console.log(window.pino); + window.pino.deb('@1 EnvPage Mounted!'); getPage(); if(baseDataStore.state.serviceList.length == 0){ baseDataStore.getServiceList(); @@ -47,7 +40,7 @@ const formData = reactive({ // 确认 handleAck: handleCreateAck, // 取消 - handleCancel: clearFormData, + handleCancel: () => clearFormData(), }); // 表格数据 const tableData = reactive({ @@ -93,6 +86,9 @@ async function handleUpdate(data) { } // @4确认更新数据 todo async function handleUpdateAck(data) { + if(!data.pid){ + data.pid = 0; + } await CoreEnv.updateEnv(formData.envId, data); Message.success('更新变量成功!'); clearFormData(); @@ -114,7 +110,7 @@ watch(tableData.pageInfo, () => { // @6获取表格数据 async function getPage() { const pageInfo = {...tableData.pageInfo}; - pageInfo.hierarchy = pageInfo.hierarchy.length > 0 ? pageInfo.hierarchy[0] : undefined + pageInfo.hierarchy = pageInfo.hierarchy.length > 0 ? pageInfo.hierarchy[0] : undefined; const resd = await CoreEnv.getEnv(pageInfo); tableData.dataSource = resd.rowData; tableData.total = Number(resd.total);