From d7c354187a85eee5e7d392bf55fdf6f2ee433a79 Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Tue, 23 Apr 2024 15:01:17 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=9A=E6=B8=85=E7=A9=BA=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E4=BB=A3=E7=A0=81=E6=97=B6=EF=BC=8C=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E6=98=8E=E7=BB=86=202=EF=BC=9A=E8=BE=93=E5=85=A5=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E5=90=8E=E8=87=AA=E5=8A=A8=E5=B8=A6=E5=87=BA?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E8=81=94=E7=B3=BB=E4=BA=BA=E3=80=81?= =?UTF-8?q?=E8=81=94=E7=B3=BB=E7=94=B5=E8=AF=9D=E3=80=81=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E4=BA=BA=E7=94=B5=E5=AD=90=E9=82=AE=E4=BB=B6=203=EF=BC=9A?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=AE=8C=E4=BE=9B=E5=BA=94=E5=95=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=B8=A6=E5=87=BA?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E7=89=A9=E6=96=99=E6=98=8E=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BasicForm/src/BasicForm.vue | 8 +++++-- src/components/Form/src/Form.vue | 7 +++++- .../supplierdeliver/purchaseMain/index.vue | 23 +++++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index 8b7c75020..0c54a52f8 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -15,6 +15,7 @@ :schema="formSchema" :is-col="true" @opensearchTable="opensearchTable" + @clearSearchInput="clearSearchInput" @onChange="onChange" @onBlur="onBlur" @onEnter="onEnter" @@ -413,7 +414,9 @@ const opensearchTable = ( ) } - +const clearSearchInput = (field)=>{ + emit('clearSearchInput',field) +} const sumFormDataByTable = () => { if(props.sumFormDataField){ const sumObject = {} @@ -603,7 +606,8 @@ const emit = defineEmits([ 'onEnter', 'inputNumberChange', 'formFormDateChange', - 'footButtonClick' + 'footButtonClick', + 'clearSearchInput' ]) //普通下拉改变事件 const formSelectChange = (field, val, row) => { diff --git a/src/components/Form/src/Form.vue b/src/components/Form/src/Form.vue index 7aa98c2a1..2c031b91e 100644 --- a/src/components/Form/src/Form.vue +++ b/src/components/Form/src/Form.vue @@ -54,7 +54,7 @@ export default defineComponent({ vLoading: propTypes.bool.def(false), labelPosition: propTypes.string.def('left'), }, - emits: ['register','opensearchTable', 'onChange', 'onBlur','onEnter'], + emits: ['register','opensearchTable','clearSearchInput', 'onChange', 'onBlur','onEnter'], setup(props, { slots, expose, emit }) { // element form 实例 const elFormRef = ref>() @@ -124,6 +124,9 @@ export default defineComponent({ emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple) } + const clearSearchInput = (field) => { + emit('clearSearchInput') + } expose({ setValues, formModel, @@ -258,6 +261,7 @@ export default defineComponent({ }else{ formModel.value[item.field] = '' } + clearSearchInput(item.field) }}> ) @@ -292,6 +296,7 @@ export default defineComponent({ }else{ formModel.value[item.field] = '' } + clearSearchInput(item.field) }}> ) diff --git a/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue b/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue index e0c19795d..a3a0a7d0c 100644 --- a/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue +++ b/src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue @@ -56,6 +56,7 @@ @handleAddTable="handleAddTable" @handleDeleteTable="handleDeleteTable" @searchTableSuccess="searchTableSuccess" + @clearSearchInput="clearSearchInput" @submitForm="submitForm" @onChange="onChangeQty" @onEnter="onEnter" @@ -120,6 +121,9 @@ console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searc }) + const clearSearchInput = (formField)=>{ + tableData.value = [] + } // 查询页面返回 const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { nextTick(async() => { @@ -140,6 +144,15 @@ console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searc message.warning(`物料代码${repeatCode.join(',')}已经存在`); } if(val.length>0){ + //frm表单回显 + const setV = {} + tableData.value = [] // 清空子表数据 + setV['contactName']=val[0]['contacts'] + setV['contactPhone']=val[0]['phone'] + setV['contactEmail']=val[0]['email'] + setV['taxRate']=val[0]['taxRate'] + formRef.setValues(setV) + //明细 val.forEach(item=>{ const newRow = {...row} newRow[formField] = item[searchField] @@ -169,8 +182,9 @@ console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searc setV['contactPhone']=val[0]['phone'] setV['contactEmail']=val[0]['email'] setV['taxRate']=val[0]['taxRate'] + formRef.setValues(setV) + onEnter('supplierCode') } - formRef.setValues(setV) } }) } @@ -516,7 +530,12 @@ console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searc } const onEnter = (field)=>{ - formRef.value.handleAddTable() + const timer = setTimeout(()=>{ + formRef.value.handleAddTable() + if(timer){ + clearTimeout(timer) + } + },500) } /** 初始化 **/ onMounted(async () => {