|
|
@ -89,7 +89,11 @@ |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@tableFormSelectOnBlur="tableFormSelectOnBlur" |
|
|
|
@formFormDateChange="formFormDateChange" |
|
|
|
/> |
|
|
|
> |
|
|
|
<template v-slot="{row}"> |
|
|
|
<slot :row="row"></slot> |
|
|
|
</template> |
|
|
|
</TableForm> |
|
|
|
</div> |
|
|
|
<div v-if="isBusiness && formType == 'create' && fromeWhere == 'countPlan'"> |
|
|
|
<TableFormCountPlan |
|
|
@ -275,12 +279,17 @@ const props = defineProps({ |
|
|
|
//表单中展示的数据,需要用searchTable中字段计算 |
|
|
|
/***[{ |
|
|
|
formField:form中对应的field, |
|
|
|
valueField:searchtable中对应的field, |
|
|
|
tableField:searchtable中对应的field, |
|
|
|
}]*/ |
|
|
|
sumFormData:{ |
|
|
|
sumFormDataField:{ |
|
|
|
type: Array, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
}, |
|
|
|
sumFormDataByForm:{ |
|
|
|
type:Function, |
|
|
|
required: false, |
|
|
|
default: null |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
@ -395,11 +404,11 @@ const opensearchTable = ( |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const changeSumFormData = () => { |
|
|
|
if(props.sumFormData){ |
|
|
|
const sumFormDataByTable = () => { |
|
|
|
if(props.sumFormDataField){ |
|
|
|
const sumObject = {} |
|
|
|
props.sumFormData.forEach(sumItem=>{ |
|
|
|
sumObject[sumItem?.formField]= props.tableData.reduce((prev, item) => prev + item[sumItem?.valueField],0) |
|
|
|
props.sumFormDataField.forEach(sumItem=>{ |
|
|
|
sumObject[sumItem?.formField]= props.tableData.reduce((prev, item) => prev + item[sumItem?.tableField],0) |
|
|
|
}) |
|
|
|
nextTick(()=>{ |
|
|
|
formRef.value.setValues(sumObject) |
|
|
@ -407,7 +416,13 @@ const changeSumFormData = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
watch(()=>props.tableData,() => { |
|
|
|
changeSumFormData() |
|
|
|
sumFormDataByTable() |
|
|
|
|
|
|
|
},{ |
|
|
|
deep:true |
|
|
|
}) |
|
|
|
watch(()=>unref(formRef)?.formModel,() => { |
|
|
|
props?.sumFormDataByForm(formRef,unref(formRef)?.formModel) |
|
|
|
},{ |
|
|
|
deep:true |
|
|
|
}) |
|
|
|