Переглянути джерело

fix: 解决js值判断问题

tanzx 6 днів тому
батько
коміт
8e05b8bc9c

+ 4 - 3
src/views/position/positionManagement/components/PositionEditDialog.vue

@@ -644,7 +644,7 @@ export default {
     },
     departmentOptions() {
       return this.departments.filter(
-        (item) => item.legalId === this.form.legalId,
+        (item) => String(item.legalId) === String(this.form.legalId),
       );
     },
     availableSalaryTemplates() {
@@ -1535,9 +1535,10 @@ export default {
           item.id !== this.form.id,
       );
       const department = this.departments.find(
-        (item) => item.id === this.form.deptId,
+        (item) => String(item.id) === String(this.form.deptId),
       );
-      if (!department || department.legalId !== this.form.legalId) {
+      if (this.form.deptId != null &&
+    (!department || String(department.legalId) !== String(this.form.legalId))) {
         errors.push({
           message: "所属部门必须存在且属于当前法人",
           module: "basic",