Browse Source

添加手动输入国家编码进行匹配的功能。

lighter 3 năm trước cách đây
mục cha
commit
c4956f1ad3
1 tập tin đã thay đổi với 32 bổ sung6 xóa
  1. 32 6
      src/views/dictionary/NationalSiMatch.vue

+ 32 - 6
src/views/dictionary/NationalSiMatch.vue

@@ -372,12 +372,38 @@ const beforeMatch = (row) => {
 }
 
 const getNationalItems = (row) => {
-  selectNationalItems(row).then((res) => {
-    factory.value = ''
-    data.row = row
-    data.national = res
-    showNationalList.value = true
-  })
+  selectNationalItems(row)
+    .then((res) => {
+      factory.value = ''
+      data.row = row
+      data.national = res
+      showNationalList.value = true
+    })
+    .catch((e) => {
+      if (e === '没有符合条件的国家目录。') {
+        ElMessageBox.prompt('没有符合条件的国家目录,请输入国家编码进行手动匹配:', '提示', {
+          inputValue: null,
+          confirmButtonText: '匹配',
+          cancelButtonText: '取消',
+          inputPattern: /\S/,
+          inputErrorMessage: '国家编码不能为空',
+        })
+          .then(({ value }) => {
+            data.row = row
+            data.row.nationalCode = value
+            executeMatch(data.row).then((res) => {
+              search()
+              ElMessage({
+                type: 'success',
+                message: res,
+                duration: 2000,
+                showClose: true,
+              })
+            })
+          })
+          .catch(() => {})
+      }
+    })
 }
 
 const doMatch = (row) => {