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