Browse Source

1:清空供应商代码时,清空明细

2:输入供应商后自动带出供应商联系人、联系电话、联系人电子邮件
3:筛选完供应商代码后,自动带出供应商物料明细
master_hella_20240701
yufei0306 5 months ago
parent
commit
d7c354187a
  1. 8
      src/components/BasicForm/src/BasicForm.vue
  2. 7
      src/components/Form/src/Form.vue
  3. 23
      src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue

8
src/components/BasicForm/src/BasicForm.vue

@ -15,6 +15,7 @@
:schema="formSchema" :schema="formSchema"
:is-col="true" :is-col="true"
@opensearchTable="opensearchTable" @opensearchTable="opensearchTable"
@clearSearchInput="clearSearchInput"
@onChange="onChange" @onChange="onChange"
@onBlur="onBlur" @onBlur="onBlur"
@onEnter="onEnter" @onEnter="onEnter"
@ -413,7 +414,9 @@ const opensearchTable = (
) )
} }
const clearSearchInput = (field)=>{
emit('clearSearchInput',field)
}
const sumFormDataByTable = () => { const sumFormDataByTable = () => {
if(props.sumFormDataField){ if(props.sumFormDataField){
const sumObject = {} const sumObject = {}
@ -603,7 +606,8 @@ const emit = defineEmits([
'onEnter', 'onEnter',
'inputNumberChange', 'inputNumberChange',
'formFormDateChange', 'formFormDateChange',
'footButtonClick' 'footButtonClick',
'clearSearchInput'
]) ])
// //
const formSelectChange = (field, val, row) => { const formSelectChange = (field, val, row) => {

7
src/components/Form/src/Form.vue

@ -54,7 +54,7 @@ export default defineComponent({
vLoading: propTypes.bool.def(false), vLoading: propTypes.bool.def(false),
labelPosition: propTypes.string.def('left'), labelPosition: propTypes.string.def('left'),
}, },
emits: ['register','opensearchTable', 'onChange', 'onBlur','onEnter'], emits: ['register','opensearchTable','clearSearchInput', 'onChange', 'onBlur','onEnter'],
setup(props, { slots, expose, emit }) { setup(props, { slots, expose, emit }) {
// element form // element form
const elFormRef = ref<ComponentRef<typeof ElForm>>() const elFormRef = ref<ComponentRef<typeof ElForm>>()
@ -124,6 +124,9 @@ export default defineComponent({
emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple) emit('opensearchTable',field, searchField, searchTitle, searchAllSchemas, searchPage, searchCondition,multiple)
} }
const clearSearchInput = (field) => {
emit('clearSearchInput')
}
expose({ expose({
setValues, setValues,
formModel, formModel,
@ -258,6 +261,7 @@ export default defineComponent({
}else{ }else{
formModel.value[item.field] = '' formModel.value[item.field] = ''
} }
clearSearchInput(item.field)
}}> }}>
</ElButton> </ElButton>
) )
@ -292,6 +296,7 @@ export default defineComponent({
}else{ }else{
formModel.value[item.field] = '' formModel.value[item.field] = ''
} }
clearSearchInput(item.field)
}}> }}>
</ElButton> </ElButton>
) )

23
src/views/wms/purchasereceiptManage/supplierdeliver/purchaseMain/index.vue

@ -56,6 +56,7 @@
@handleAddTable="handleAddTable" @handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable" @handleDeleteTable="handleDeleteTable"
@searchTableSuccess="searchTableSuccess" @searchTableSuccess="searchTableSuccess"
@clearSearchInput="clearSearchInput"
@submitForm="submitForm" @submitForm="submitForm"
@onChange="onChangeQty" @onChange="onChangeQty"
@onEnter="onEnter" @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) => { const searchTableSuccess = (formField, searchField, val, formRef, type, row) => {
nextTick(async() => { nextTick(async() => {
@ -140,6 +144,15 @@ console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searc
message.warning(`物料代码${repeatCode.join(',')}已经存在`); message.warning(`物料代码${repeatCode.join(',')}已经存在`);
} }
if(val.length>0){ 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=>{ val.forEach(item=>{
const newRow = {...row} const newRow = {...row}
newRow[formField] = item[searchField] newRow[formField] = item[searchField]
@ -169,8 +182,9 @@ console.log('PurchaseMain.allSchemas.searchSchema',PurchaseMain.allSchemas.searc
setV['contactPhone']=val[0]['phone'] setV['contactPhone']=val[0]['phone']
setV['contactEmail']=val[0]['email'] setV['contactEmail']=val[0]['email']
setV['taxRate']=val[0]['taxRate'] 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)=>{ const onEnter = (field)=>{
formRef.value.handleAddTable() const timer = setTimeout(()=>{
formRef.value.handleAddTable()
if(timer){
clearTimeout(timer)
}
},500)
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {

Loading…
Cancel
Save