This commit is contained in:
parent
83334bc090
commit
3c394a9c2e
|
|
@ -117,12 +117,31 @@ const actionColumns = [
|
|||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
editId.value = row.personId
|
||||
editId.value = row.id
|
||||
dialogConfig.outerTitle = '编辑人员'
|
||||
dialogConfig.outerVisible = true
|
||||
// 2. 使用 nextTick 确保弹框和子组件挂载后再回显数据
|
||||
nextTick(() => {
|
||||
Object.assign(addAndEditForm.value, row)
|
||||
const {
|
||||
inspectionStationId,
|
||||
name,
|
||||
phone,
|
||||
sex,
|
||||
positionId,
|
||||
personnelNatureId,
|
||||
personnelClassificationId,
|
||||
longTermSecondment,
|
||||
} = row
|
||||
Object.assign(addAndEditForm.value, {
|
||||
inspectionStationId: inspectionStationId + '',
|
||||
name,
|
||||
phone,
|
||||
sex: sex * 1,
|
||||
positionId: positionId + '',
|
||||
personnelNatureId: personnelNatureId + '',
|
||||
personnelClassificationId: personnelClassificationId + '',
|
||||
longTermSecondment,
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
@ -132,7 +151,7 @@ const actionColumns = [
|
|||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该人员?').then(async () => {
|
||||
const result = await delPersonAPI(row.personId)
|
||||
const result = await delPersonAPI({ id: row.id })
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh()
|
||||
|
|
@ -164,8 +183,9 @@ const onHandleSave = async () => {
|
|||
// 3. 调用子组件暴露的 validate 方法
|
||||
await formRef.value.validate()
|
||||
const API = editId.value ? updatePersonAPI : addPersonAPI
|
||||
|
||||
const result = await API(addAndEditForm.value)
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.id = editId.value) : null
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
dialogConfig.outerVisible = false
|
||||
|
|
|
|||
Loading…
Reference in New Issue