浏览代码

供应商档案-名字简称自动转为大写

jingbb 2 周之前
父节点
当前提交
0f1e30df9c
共有 1 个文件被更改,包括 32 次插入4 次删除
  1. 32 4
      src/views/cuspCode/SupplierProfile/CuspSupplierProfile.data.ts

+ 32 - 4
src/views/cuspCode/SupplierProfile/CuspSupplierProfile.data.ts

@@ -255,8 +255,22 @@ export const formSchema: FormSchema[] = [
     component: 'Input',
     labelWidth: 200,
     required: true,
-    componentProps: {
-      AutoComplete: 'off',
+    componentProps: ({ formModel }) => {
+      return {
+        AutoComplete: 'off',
+        onblur: ({ currentTarget }) => {
+          const stringLog = currentTarget.value;
+          let newString = '';
+          for (let i = 0; i < stringLog.length; i++) {
+            if (/^[A-Za-z]$/.test(stringLog[i]) && /^[a-z]$/.test(stringLog[i])) {
+              newString = newString + stringLog[i].toUpperCase();
+            } else {
+              newString = newString + stringLog[i];
+            }
+          }
+          formModel.name = newString;
+        },
+      };
     },
   },
   {
@@ -265,8 +279,22 @@ export const formSchema: FormSchema[] = [
     colProps: { span: 12 },
     labelWidth: 200,
     component: 'Input',
-    componentProps: {
-      AutoComplete: 'off',
+    componentProps: ({ formModel }) => {
+      return {
+        AutoComplete: 'off',
+        onblur: ({ currentTarget }) => {
+          const stringLog = currentTarget.value;
+          let newString = '';
+          for (let i = 0; i < stringLog.length; i++) {
+            if (/^[A-Za-z]$/.test(stringLog[i]) && /^[a-z]$/.test(stringLog[i])) {
+              newString = newString + stringLog[i].toUpperCase();
+            } else {
+              newString = newString + stringLog[i];
+            }
+          }
+          formModel.abbreviation = newString;
+        },
+      };
     },
   },
   {