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