Browse Source

供应商发票金额计算

master_hella_20240701
yufei0306 7 months ago
parent
commit
338f83ab30
  1. 8
      src/components/BasicForm/src/BasicForm.vue
  2. 15
      src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue

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

@ -292,6 +292,11 @@ const props = defineProps({
type:Function, type:Function,
required: false, required: false,
default: null default: null
},
sumFormDataByTableCustom:{
type:Function,
required: false,
default: null
} }
}) })
@ -419,6 +424,9 @@ const sumFormDataByTable = () => {
} }
watch(()=>props.tableData,() => { watch(()=>props.tableData,() => {
sumFormDataByTable() sumFormDataByTable()
if(props?.sumFormDataByTableCustom&&unref(formRef)?.formModel&&props.tableData){
props?.sumFormDataByTableCustom(formRef,unref(formRef)?.formModel,props.tableData)
}
},{ },{
deep:true deep:true

15
src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue

@ -45,17 +45,20 @@
:tableAllSchemas="SupplierinvoiceRequestDetail.allSchemas" :tableAllSchemas="SupplierinvoiceRequestDetail.allSchemas"
:tableFormRules="SupplierinvoiceRequestDetailRules" :tableFormRules="SupplierinvoiceRequestDetailRules"
:tableData="tableData" :tableData="tableData"
:sumFormDataField = "[{
formField:'amount',
tableField:'singlePrice'
}]"
:sumFormDataByForm ="(formRef,formModel)=>{ :sumFormDataByForm ="(formRef,formModel)=>{
const {taxRate=0,amount=0} = formModel const {taxRate=0,amount=0} = formModel
formRef.value.setValues({ formRef.value.setValues({
taxAmount:taxRate*amount, taxAmount:taxRate*amount*0.01,
afterTaxAmount:amount+taxRate*amount afterTaxAmount:amount+taxRate*amount*0.01
}) })
}" }"
:sumFormDataByTableCustom ="(formRef,formModel,tableData)=>{
const sumObject = {
amount:tableData.reduce((prev, item) => prev + (item['singlePrice']*item['invoicableQuantity']),0)
}
formRef.value.setValues(sumObject)
}"
:apiUpdate="SupplierinvoiceRequestMainApi.updateSupplierinvoiceRequestMain" :apiUpdate="SupplierinvoiceRequestMainApi.updateSupplierinvoiceRequestMain"
:apiCreate="SupplierinvoiceRequestMainApi.createSupplierinvoiceRequestMain" :apiCreate="SupplierinvoiceRequestMainApi.createSupplierinvoiceRequestMain"
:isBusiness="true" :isBusiness="true"

Loading…
Cancel
Save