Browse Source

解决员工技能编辑选择重复技能不重置空的问题。

jiaxiaoqiang 10 months ago
parent
commit
715ed5f958
1 changed files with 23 additions and 14 deletions
  1. 23 14
      src/views/base/skill/components/edit-skill.vue

+ 23 - 14
src/views/base/skill/components/edit-skill.vue

@@ -315,22 +315,31 @@ option.value = Object.assign(option.value, {
         label: "skillDictLabel", // 下拉菜单显示的字段
         value: "skillDictValue", // 下拉菜单值的字段
       },
-      change: (row) => {
-        console.log(row);
-        data.value.forEach((item, index) => {
-          console.log("aaa", index);
-          console.log("bbbb", item);
-          if (item.skillDictValue == row.value && index != row.index) {
-            row.row.skillDictValue = "";
-            row.value = "";
-            console.log("ccc", row);
-            ElMessage({
-              message: item.$skillDictValue + " 打分项重复",
-              type: "error",
-            });
-          }
+      change: function (value, row) {
+        nextTick(() => {
+          focusedElement.value.blur();
         });
       },
+      focus: function (row) {
+        focusedElement.value = row.event.target;
+      },
+      blur: function (row) {
+        if (
+          data.value
+            .map((item) => {
+              return item.skillDictValue;
+            })
+            .includes(row.value)
+        ) {
+          ElMessage({
+            message: row.row.$skillDictValue + " 打分项重复",
+            type: "error",
+          });
+          row.row.skillDictValue = "";
+          row.row.$skillDictValue = "";
+          row.value = "";
+        }
+      },
     },
     {
       label: "分数",