撤回按钮

This commit is contained in:
2025-10-22 11:51:32 +08:00
parent 081939df01
commit e29366525d
4 changed files with 99 additions and 8 deletions

View File

@@ -124,9 +124,20 @@
<el-form-item label="家庭人口数">
<el-input v-model="editForm.familyNum" />
</el-form-item>
<el-form-item label="家庭住址">
<el-input v-model="editForm.homeAddr" type="textarea" />
</el-form-item>
<el-form-item label="家庭月总收入">
<el-input v-model="editForm.monthMoney" />
</el-form-item>
<!-- 困难类型 -->
<el-form-item label="困难类型">
<el-select v-model="editForm.hardType" placeholder="请选择">
<el-option label="一般困难" value="一般困难" />
<el-option label="比较困难" value="比较困难" />
<el-option label="特别困难" value="特别困难" />
</el-select>
</el-form-item>
<el-form-item label="人均月收入">
<el-input v-model="editForm.perMoney" />
</el-form-item>
@@ -273,6 +284,7 @@ export default {
zcpmbl: '',
zpm: '',
zpmbl: '',
hardType: '',
hardFile: '',
softFile: ''
},
@@ -447,17 +459,16 @@ export default {
},
async handleEditSave() {
const sdata = { ...this.editForm }
// 保存前兼容:若意外为数组则取首项
if (Array.isArray(sdata.hardType)) {
sdata.hardType = sdata.hardType[0] || ''
}
const loading = fullLoading(this)
const res =await doEdit(sdata)
loading.close()
if (res.code == 200) {
this.$message.success('保存成功')
if (this.editV) {
this.editForm = { ...this.editForm, ...payload }
this.editV = false
} else {
this.lookForm = { ...this.lookForm, ...payload }
}
this.editV = false
this.getList()
} else {
this.$message.error(res.msg || '保存失败')
@@ -515,6 +526,15 @@ export default {
if (res.code === 200) {
// 直接使用后端返回的完整数据作为编辑表单数据
this.editForm = { ...res.data }
// 兼容困难类型为字符串/数组/逗号分隔字符串的回填(单选)
const ht = this.editForm.hardType
if (Array.isArray(ht)) {
this.editForm.hardType = ht[0] || ''
} else if (typeof ht === 'string' && ht.trim()) {
this.editForm.hardType = ht.includes(',') ? ht.split(',')[0].trim() : ht
} else {
this.editForm.hardType = ''
}
this.editV = true
} else {
this.$message.error(res.msg || '获取详情失败')