人员管理模块优化
This commit is contained in:
parent
e49f216474
commit
ed7d25f1c0
|
|
@ -9,7 +9,7 @@ export const buildFormColumns = (
|
||||||
) => [
|
) => [
|
||||||
{
|
{
|
||||||
type: 'input',
|
type: 'input',
|
||||||
prop: 'personName',
|
prop: 'name',
|
||||||
placeholder: '请输入姓名',
|
placeholder: '请输入姓名',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
<el-switch
|
<el-switch
|
||||||
active-value="1"
|
active-value="1"
|
||||||
inactive-value="0"
|
inactive-value="0"
|
||||||
v-model="row.longTermSecondment"
|
:model-value="getLongTermSecondmentValue(row)"
|
||||||
@change="onHandleLongTermSecondmentChange(row)"
|
@change="onHandleLongTermSecondmentChange($event, row)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</ComTable>
|
</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) => {
|
const onHandleLongTermSecondmentChange = (value, row) => {
|
||||||
console.log(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>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue