Bladeren bron

修改翻译

tangning 2 jaren geleden
bovenliggende
commit
51b34d34a7

+ 4 - 4
src/components/Form/src/BasicForm.vue

@@ -231,10 +231,10 @@
 
       function setFormModel(key: string, value: any) {
         formModel[key] = value;
-        const { validateTrigger } = unref(getBindValue);
-        if (!validateTrigger || validateTrigger === 'change') {
-          validateFields([key]).catch((_) => {});
-        }
+        // const { validateTrigger } = unref(getBindValue);
+        // if (!validateTrigger || validateTrigger === 'change') {
+        //   validateFields([key]).catch((_) => {});
+        // }
       }
 
       function handleEnterPress(e: KeyboardEvent) {

+ 12 - 0
src/components/Form/src/components/FormItem.vue

@@ -14,6 +14,7 @@
   import { upperFirst, cloneDeep } from 'lodash-es';
   import { useItemLabelWidth } from '../hooks/useLabelWidth';
   import { useI18n } from '/@/hooks/web/useI18n';
+  import type { NamePath, ValidateOptions } from 'ant-design-vue/lib/form/interface';
 
   export default defineComponent({
     name: 'BasicFormItem',
@@ -45,6 +46,10 @@
       formActionType: {
         type: Object as PropType<FormActionType>,
       },
+      validateFields: {
+      type: Function as PropType<(nameList?: NamePath[], options?: ValidateOptions) => Promise >,
+      default: null,
+      },
     },
     setup(props, { slots }) {
       const { t } = useI18n();
@@ -214,6 +219,7 @@
             rules[characterInx].message ||
             t('component.form.maxTip', [rules[characterInx].max] as Recordable);
         }
+        rules.forEach((item) => !item.trigger && (item.trigger = 'change'));
         return rules;
       }
 
@@ -239,6 +245,12 @@
             const target = e ? e.target : null;
             const value = target ? (isCheck ? target.checked : target.value) : e;
             props.setFormModel(field, value);
+            // 这个也要添加
+            // 这个也要添加
+            props.validateFields([field], { triggerName: 'change' }).catch(() => {});
+            },
+            onBlur: () => {
+            props.validateFields([field], { triggerName: 'blur' }).catch(() => {});
           },
         };
         const Comp = componentMap.get(component) as ReturnType<typeof defineComponent>;

+ 1 - 1
src/components/Form/src/hooks/useForm.ts

@@ -6,7 +6,7 @@ import { isProdMode } from '/@/utils/env';
 import { error } from '/@/utils/log';
 import { getDynamicProps } from '/@/utils';
 
-export declare type ValidateFields = (nameList?: NamePath[]) => Promise<Recordable>;
+export declare type ValidateFields = (nameList?: NamePath[],options?: ValidateOptions,) => Promise<Recordable>;
 
 type Props = Partial<DynamicProps<FormProps>>;
 

+ 3 - 3
src/components/Form/src/hooks/useFormEvents.ts

@@ -1,6 +1,6 @@
 import type { ComputedRef, Ref } from 'vue';
 import type { FormProps, FormSchema, FormActionType } from '../types/form';
-import type { NamePath } from 'ant-design-vue/lib/form/interface';
+import type { NamePath, ValidateOptions  } from 'ant-design-vue/lib/form/interface';
 import { unref, toRaw } from 'vue';
 import { isArray, isFunction, isObject, isString } from '/@/utils/is';
 import { deepMerge } from '/@/utils';
@@ -210,8 +210,8 @@ export function useFormEvents({
     });
   }
 
-  async function validateFields(nameList?: NamePath[] | undefined) {
-    return unref(formElRef)?.validateFields(nameList);
+  async function validateFields(nameList?: NamePath[] | undefined,options?: ValidateOptions | undefined) {
+    return unref(formElRef)?.validateFields(nameList, options);
   }
 
   async function validate(nameList?: NamePath[] | undefined) {

+ 2 - 2
src/components/Form/src/types/form.ts

@@ -1,4 +1,4 @@
-import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface';
+import type { NamePath, RuleObject, ValidateOptions } from 'ant-design-vue/lib/form/interface';
 import type { VNode } from 'vue';
 import type { ButtonProps as AntdButtonProps } from '/@/components/Button';
 import type { FormItem } from './formItem';
@@ -39,7 +39,7 @@ export interface FormActionType {
     prefixField: string | undefined,
     first?: boolean | undefined,
   ) => Promise<void>;
-  validateFields: (nameList?: NamePath[]) => Promise<any>;
+  validateFields: (nameList?: NamePath[], options?: ValidateOptions) => Promise<any>;
   validate: (nameList?: NamePath[]) => Promise<any>;
   scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>;
 }

+ 1 - 1
src/locales/lang/en/common.ts

@@ -18,5 +18,5 @@ export default {
   light: 'Light',
   dark: 'Dark',
   reminder:'reminder',
-  operating:'operation',
+  operating:'Operation',
 };

+ 5 - 4
src/locales/lang/en/routes/dashboard.ts

@@ -3,8 +3,9 @@ export default {
   about: 'About',
   workbench: 'Workbench',
   analysis: 'Analysis',
-  devices: 'device management',
-  equity:'Equity management',
-  scene:'Scenario management',
-  finance:'Settlement statistics',
+  devices: 'Equipment Management',
+  equity:'Subscription Management',
+  scene:'Scene Management',
+  finance:'Sales Statistics',
+  cameraScene: 'Scene Management',
 };

+ 2 - 2
src/locales/lang/en/routes/device.ts

@@ -3,10 +3,10 @@ export default {
   wifiName:'Wifi',
   deviceType:'Type',
   activatedTime:'Time',
-  userName:'Account',
+  userName:'Bound account',
   NoBind:'Unbound',
   type:{
-    0:'Old binocular camera',
+    0:'4DKanKan Lite',
     1:'4DKanKan',
     2:'4DMinion',
     3:'4DMega',

+ 19 - 18
src/locales/lang/en/routes/equity.ts

@@ -8,20 +8,21 @@ export default {
   payTime:'Payment Time',
   invoiceTime:'Invoicing application time',
   money:'Invoiced Amount',
-  id:'EquityID',
-  timeList:'Time',
+  id:'ID',
+  dowmCount:'Download Time',
+  timeList:'Authorization Time',
   expiryTime: 'Expiry Date', 
-  newTime:'Latest authorization time',
+  newTime:'Latest Authorization Time',
   time:'Start Date',
-  Type:'type',
-  giveType:'Authorization',
+  Type:'Type',
+  giveType:'Authorization Methods',
   nickName:'Nickname',
-  userName1:'Account Number',
-  email:'Mailbox',
-  userCount:'Authorized quantity',
+  userName1:'Account',
+  email:'Email',
+  userCount:'Authorized Quantity',
   incrementType:{
-    0:'Membership Interests',
-    1:'Scene download',
+    0:'Membership Subscription',
+    1:'Scene Download',
   },
   equityType:{
     0:'Professional member',
@@ -30,11 +31,11 @@ export default {
   },
   zhTips:'Chinese characters are not supported',
   listTitle:'Sales Statistics List',
-  exportExcel:'Export Excel',
+  exportExcel:'Export to Excel',
   excelTitle:'Are you sure you want to export excel?',
-  CardMajorNum: 'Professional Members Last Month (Year)',
-  CardHighNum: 'Senior Members Last Month (Month)',
-  CardDownNum: 'Sales Scene Download Last Month',
+  CardMajorNum: "Last Month's Premium Membership Sales (Yearly)",
+  CardHighNum: "Last Month's Senior Membership Sales (Monthly)",
+  CardDownNum: "Last Month's Download Sales",
   syks:'surplus',
   rules:{
     userName:'Please enter the user account',
@@ -42,10 +43,10 @@ export default {
     userName2:'The account does not exist',
   },
   unit:{
-    1:'individual',
-    2:'second',
-    '-1':'year',
-    '-2':'month',
+    1:'',
+    2:'',
+    '-1':'Year',
+    '-2':'Month',
   }
 }
 

+ 4 - 4
src/locales/lang/en/routes/finance.ts

@@ -12,14 +12,14 @@ export default {
   updateBtn: 'Change Password',
   password: 'Change Password',
   equityType: {
-    0: 'Professional Members (Years)',
-    1: 'Senior Members (Months)',
+    0: 'Premium (Yearly)',
+    1: 'Senior (Monthly)',
     2: 'Scene Download',
   },
   giveType: {
-    0: 'Distributor Authorization',
+    0: 'Dealer Authorization',
     1: 'Reseller Renewal',
-    2: 'Official Self-Purchase',
+    2: 'Official Website Purchase',
     3: 'Platform Authorization',
   },
 };

+ 6 - 6
src/locales/lang/en/routes/scene.ts

@@ -3,21 +3,21 @@ export default {
     0:'4DKanKan',
     1:'4DMinion',
     2:'4DMega',
-    3:'Old binocular camera',
+    3:'4DKanKan Lite',
   },
   transfer:'transfer',
   copy:'copy',
   down:'download',
   canlenDown:'Cancel Download',
   sceneName:'Scene Title',
-  num:'Scene code',
-  createTime:'Shooting time',
-  amount:'Calculation completion time',
-  snCode:'S/N',
+  num:'Scene Code',
+  createTime:'Shooting Time',
+  amount:'Calculation Completion Time',
+  snCode:'SN',
   sceneSize:'Scene Size',
   userName:'Bind account',
   viewCount:'Views',
-  status:'state',
+  status:'Status',
   statusType:{
     '0':'In calculation',
     '1':'Calculation succeeded',

+ 1 - 1
src/locales/lang/zh-CN/routes/dashboard.ts

@@ -53,7 +53,7 @@ export default {
   feedback: '反馈管理',
   feedbackList: '反馈列表',
   productOperation: '产品运营管理',
-  cameraScene: '相机场景管理',
+  cameraScene: '场景管理',
   kankanScene: '四维看看',
   MinionScene: '四维看见',
   laserScene: '四维深时',