Browse Source

采购收货管理--供应商发票申请--新增--form金额计算:searchtable中单价总和

master_hella_20240701
yufei0306 8 months ago
parent
commit
82d58894b6
  1. 24
      src/components/BasicForm/src/BasicForm.vue
  2. 5
      src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/index.vue
  3. 1
      src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts

24
src/components/BasicForm/src/BasicForm.vue

@ -271,6 +271,11 @@ const props = defineProps({
type: Number,
required: false,
default: 0
},
sumFormData:{
type: Array,
required: false,
default: null
}
})
@ -383,6 +388,25 @@ const opensearchTable = (
_searchCondition
)
}
const changeSumFormData = () => {
if(props.sumFormData){
const sumObject = {}
props.sumFormData.forEach(sumItem=>{
sumObject[sumItem?.formField]= props.tableData.reduce((prev, item) => prev + item[sumItem?.valueField],0)
})
nextTick(()=>{
formRef.value.setValues(sumObject)
})
}
}
watch(()=>props.tableData,() => {
changeSumFormData()
},{
deep:true
})
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {

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

@ -43,6 +43,10 @@
:tableAllSchemas="SupplierinvoiceRequestDetail.allSchemas"
:tableFormRules="SupplierinvoiceRequestDetailRules"
:tableData="tableData"
:sumFormData = "[{
formField:'amount',
valueField:'singlePrice'
}]"
:apiUpdate="SupplierinvoiceRequestMainApi.updateSupplierinvoiceRequestMain"
:apiCreate="SupplierinvoiceRequestMainApi.createSupplierinvoiceRequestMain"
:isBusiness="true"
@ -148,6 +152,7 @@
newRow['recvBillNum'] = item['recvBillNum']
newRow['asnBillNum'] = item['asnBillNum']
newRow['supplierCode'] = item['supplierCode']
newRow['singlePrice'] = item['purchasePrice']// =
newRow['purchasePrice'] = item['purchasePrice']
newRow['invoicableQuantity'] = item['invoicableQuantity']
newRow['itemCode'] = item['itemCode']

1
src/views/wms/supplierManage/supplierinvoice/supplierinvoiceRequestMain/supplierinvoiceRequestMain.data.ts

@ -148,6 +148,7 @@ export const SupplierinvoiceRequestMain = useCrudSchemas(reactive<CrudSchema[]>(
componentProps: {
min: 0,
precision: 6,
disabled: true,
}
},
tableForm: {

Loading…
Cancel
Save