人员管理模块优化

This commit is contained in:
BianLzhaoMin 2025-12-26 10:36:01 +08:00
parent e49f216474
commit ed7d25f1c0
2 changed files with 29 additions and 5 deletions

View File

@ -9,7 +9,7 @@ export const buildFormColumns = (
) => [
{
type: 'input',
prop: 'personName',
prop: 'name',
placeholder: '请输入姓名',
},
{

View File

@ -17,8 +17,8 @@
<el-switch
active-value="1"
inactive-value="0"
v-model="row.longTermSecondment"
@change="onHandleLongTermSecondmentChange(row)"
:model-value="getLongTermSecondmentValue(row)"
@change="onHandleLongTermSecondmentChange($event, row)"
/>
</template>
</ComTable>
@ -207,8 +207,32 @@ const onCloseDialogOuter = (visible) => {
}
}
// longTermSecondment
const getLongTermSecondmentValue = (row) => {
const value = row.longTermSecondment
if (value === null || value === undefined) {
return '0'
}
//
return String(value)
}
//
const onHandleLongTermSecondmentChange = (row) => {
console.log(row)
const onHandleLongTermSecondmentChange = (value, row) => {
// row switch
row.longTermSecondment = value
// '1' -> 1, '0' -> 0
const params = {
id: row.id,
longTermSecondment: value === '1' ? 1 : 0,
}
updatePersonAPI(params).then((res) => {
if (res.code === 200) {
proxy.$modal.msgSuccess('更新成功')
comTableRef.value?.refresh()
}
})
}
</script>