mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-01-19 12:02:50 +08:00
配置 add.formData 修复 Object.assign 把个别属性去掉的问题
This commit is contained in:
parent
7554372850
commit
9478c2e960
@ -25,6 +25,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, getCurrentInstance, watch } from 'vue'
|
||||
import common from '@/scripts/common'
|
||||
const { proxy } = getCurrentInstance()
|
||||
const rules = reactive(getRules())
|
||||
const formData = ref(initFormData())
|
||||
@ -51,7 +52,7 @@
|
||||
watch(() => [props.detail && props.detail.formData, props.add && props.add.formData], (value) => {
|
||||
value.forEach(it => {
|
||||
if(it){
|
||||
Object.assign(formData.value, it)
|
||||
formData.value = common.objectAssign(formData.value, it)
|
||||
}
|
||||
})
|
||||
},{ deep: true })
|
||||
@ -61,7 +62,7 @@
|
||||
proxy.$common.setDefaultValue(props.form.props, 'labelWidth', '120px')
|
||||
|
||||
if(props.add && props.add.formData){
|
||||
Object.assign(formData.value, props.add.formData)
|
||||
formData.value = common.objectAssign(formData.value, props.add.formData)
|
||||
}
|
||||
|
||||
function getRules(){
|
||||
@ -122,7 +123,7 @@
|
||||
}
|
||||
}
|
||||
if(formData.value){
|
||||
formData.value = Object.assign(_formData, formData.value)
|
||||
formData.value = common.objectAssign(_formData, formData.value)
|
||||
} else {
|
||||
formData.value = _formData
|
||||
}
|
||||
|
@ -229,4 +229,8 @@ common.exportExcel = (options) => {
|
||||
writeFile(wb, `${options.fileName}.${options.suffix || 'xlsx'}`);
|
||||
}
|
||||
|
||||
common.objectAssign = (target, source) => {
|
||||
return Object.assign({}, JSON.parse(JSON.stringify(target)), JSON.parse(JSON.stringify(source)))
|
||||
}
|
||||
|
||||
export default common
|
||||
|
Loading…
Reference in New Issue
Block a user