Commit 825aa82a authored by xinzhedeai's avatar xinzhedeai

add:员工字典获取name处理

parent ec13edd4
......@@ -150,10 +150,10 @@
clearable
>
<el-option
v-for="item in cardIdOptions"
:key="item.cardId"
:label="item.cardId"
:value="item.cardId"
v-for="item in deptOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
......@@ -305,6 +305,16 @@ export default {
name: "Info",
data() {
return {
deptOptions: [
{
label: "部门1",
value: "1",
},
{
label: "部门2",
value: "2",
},
],
// 绑定卡对话框
bindOpen: false,
// 绑定卡表单
......@@ -616,14 +626,32 @@ export default {
this.$refs["form"].validate((valid) => {
if (valid) {
this.form.personType = "staff";
if (this.form.personId != null) {
updateInfo(this.form).then((response) => {
// 创建一个表单数据的副本,避免直接修改原表单
const formData = { ...this.form };
// 根据 deptId 查找对应的部门名称
if (
formData.deptId &&
this.deptOptions &&
this.deptOptions.length > 0
) {
const deptItem = this.deptOptions.find(
(item) => item.value === formData.deptId
);
if (deptItem) {
formData.deptName = deptItem.label; // 添加部门名称参数
}
}
if (formData.personId != null) {
updateInfo(formData).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(this.form).then((response) => {
addInfo(formData).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment