Преглед изворни кода

fix: 修改bug10.21_上午

100011797 пре 3 година
родитељ
комит
51ff95a2e7

+ 4 - 1
src/components/Metadata/EditTable/index.tsx

@@ -8,6 +8,7 @@ import { PopoverProps } from 'antd/lib/popover';
 import { useClickAway, usePrefixCls } from '@formily/antd/lib/__builtins__';
 import cls from 'classnames';
 import { get } from 'lodash';
+import { Ellipsis } from '@/components';
 /**
  * 默认Inline展示
  */
@@ -160,7 +161,9 @@ Editable.Popover = observer((props) => {
   const headTitle = () => {
     return (
       <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
-        <div>{props.title || field.title}</div>
+        <div style={{ width: 150 }}>
+          <Ellipsis title={props.title || field.title} />
+        </div>
         <CloseOutlined
           onClick={() => {
             setVisible(false);

+ 22 - 3
src/components/Metadata/EnumParam/index.tsx

@@ -1,6 +1,7 @@
 import { createSchemaField } from '@formily/react';
-import { ArrayItems, Editable, FormItem, FormLayout, Input } from '@formily/antd';
+import { ArrayItems, FormItem, FormLayout, Input } from '@formily/antd';
 import type { ISchema } from '@formily/json-schema';
+import Editable from '../EditTable';
 
 const EnumParam = () => {
   const SchemaField = createSchemaField({
@@ -42,22 +43,40 @@ const EnumParam = () => {
                 text: {
                   type: 'string',
                   title: 'Text',
-                  required: true,
                   'x-decorator': 'FormItem',
                   'x-component': 'Input',
                   'x-component-props': {
                     placeholder: '标识',
                   },
+                  'x-validator': [
+                    {
+                      max: 64,
+                      message: '最多可输入64个字符',
+                    },
+                    {
+                      required: true,
+                      message: '请输入标识',
+                    },
+                  ],
                 },
                 value: {
                   type: 'string',
                   title: 'Value',
-                  required: true,
                   'x-decorator': 'FormItem',
                   'x-component': 'Input',
                   'x-component-props': {
                     placeholder: '对该枚举项的描述',
                   },
+                  'x-validator': [
+                    {
+                      max: 64,
+                      message: '最多可输入64个字符',
+                    },
+                    {
+                      required: true,
+                      message: '请输入描述',
+                    },
+                  ],
                 },
               },
             },

+ 10 - 0
src/components/Metadata/JsonParam/index.tsx

@@ -100,6 +100,16 @@ const JsonParam = observer((props: Props) => {
                   required: true,
                   'x-decorator': 'FormItem',
                   'x-component': 'Input',
+                  'x-validator': [
+                    {
+                      max: 64,
+                      message: '最多可输入64个字符',
+                    },
+                    {
+                      required: true,
+                      message: '请输入名称',
+                    },
+                  ],
                 },
                 valueType: {
                   type: 'object',

+ 6 - 0
src/pages/device/Category/Save/index.tsx

@@ -134,6 +134,12 @@ const Save = (props: Props) => {
           min: 1,
         },
         name: 'sortIndex',
+        'x-validator': [
+          {
+            format: 'integer',
+            message: '请输入非0正整数',
+          },
+        ],
       },
       description: {
         type: 'string',

+ 12 - 1
src/pages/device/Product/Detail/Access/index.tsx

@@ -499,7 +499,18 @@ const Access = () => {
         ...itemSchema,
         storePolicy: {
           type: 'string',
-          title: <TitleComponent data={'存储策略'} />,
+          title: (
+            <TitleComponent
+              data={
+                <div className="config">
+                  存储策略
+                  <Tooltip title="若修改存储策略,需要手动做数据迁移,平台只能搜索最新存储策略中的数据">
+                    <QuestionCircleOutlined />
+                  </Tooltip>
+                </div>
+              }
+            />
+          ),
           'x-decorator': 'FormItem',
           'x-component': 'Select',
           'x-component-props': {

+ 1 - 0
src/pages/device/Product/index.tsx

@@ -498,6 +498,7 @@ const Product = observer(() => {
                     onlyMessage('请上传json格式文件', 'error');
                     return false;
                   }
+                  delete data.state;
                   const res = await service.update(data);
                   if (res.status === 200) {
                     onlyMessage('操作成功');

+ 6 - 6
src/pages/media/DashBoard/index.tsx

@@ -139,13 +139,13 @@ export default () => {
         },
         yAxis: {
           type: 'value',
-          minInterval: 1,
-        },
-        grid: {
-          left: '4%',
-          right: '2%',
-          top: '2%',
+          // minInterval: 1,
         },
+        // grid: {
+        //   left: '4%',
+        //   right: '2%',
+        //   top: '2%',
+        // },
         color: ['#2F54EB'],
         series: [
           {

+ 35 - 17
src/pages/system/User/ResetPassword/index.tsx

@@ -4,7 +4,7 @@ import { Form, FormItem, Password } from '@formily/antd';
 import { ISchema } from '@formily/json-schema';
 import { useIntl } from 'umi';
 import { useMemo } from 'react';
-import { createForm } from '@formily/core';
+import { createForm, registerValidateRules } from '@formily/core';
 import { service } from '@/pages/system/User';
 import { onlyMessage } from '@/utils/util';
 
@@ -23,6 +23,18 @@ const ResetPassword = (props: Props) => {
     },
   });
 
+  registerValidateRules({
+    checkStrength(value: string) {
+      if (/^[0-9]+$/.test(value) || /^[a-zA-Z]+$/.test(value) || /^[~!@#$%^&*]+$/.test(value)) {
+        return {
+          type: 'error',
+          message: '密码强度不够',
+        };
+      }
+      return true;
+    },
+  });
+
   const schema: ISchema = {
     type: 'object',
     properties: {
@@ -52,14 +64,14 @@ const ResetPassword = (props: Props) => {
         ],
         name: 'password',
         'x-validator': [
-          // {
-          //   max: 128,
-          //   message: '密码最多可输入128位',
-          // },
-          // {
-          //   min: 8,
-          //   message: '密码不能少于8位',
-          // },
+          {
+            max: 64,
+            message: '密码最多可输入64位',
+          },
+          {
+            min: 8,
+            message: '密码不能少于8位',
+          },
           {
             required: true,
             message: '请输入密码',
@@ -86,6 +98,9 @@ const ResetPassword = (props: Props) => {
               });
             },
           },
+          {
+            checkStrength: true,
+          },
         ],
       },
       confirmPassword: {
@@ -101,14 +116,14 @@ const ResetPassword = (props: Props) => {
           placeholder: '请再次输入密码',
         },
         'x-validator': [
-          // {
-          //   max: 128,
-          //   message: '密码最多可输入128位',
-          // },
-          // {
-          //   min: 8,
-          //   message: '密码不能少于8位',
-          // },
+          {
+            max: 64,
+            message: '密码最多可输入64位',
+          },
+          {
+            min: 8,
+            message: '密码不能少于8位',
+          },
           {
             required: true,
             message: '请输入确认密码',
@@ -135,6 +150,9 @@ const ResetPassword = (props: Props) => {
               });
             },
           },
+          {
+            checkStrength: true,
+          },
         ],
         'x-reactions': [
           {

+ 19 - 1
src/pages/system/User/Save/index.tsx

@@ -1,7 +1,7 @@
 import { TreeSelect as ATreeSelect } from 'antd';
 import { useIntl } from 'umi';
 import type { Field } from '@formily/core';
-import { createForm } from '@formily/core';
+import { createForm, registerValidateRules } from '@formily/core';
 import { createSchemaField } from '@formily/react';
 import React, { useEffect, useState } from 'react';
 import * as ICONS from '@ant-design/icons';
@@ -57,6 +57,18 @@ const Save = (props: Props) => {
     );
   };
 
+  registerValidateRules({
+    checkStrength(value: string) {
+      if (/^[0-9]+$/.test(value) || /^[a-zA-Z]+$/.test(value) || /^[~!@#$%^&*]+$/.test(value)) {
+        return {
+          type: 'error',
+          message: '密码强度不够',
+        };
+      }
+      return true;
+    },
+  });
+
   const getUser = async () => {
     if (props.data.id) {
       const response: Response<UserItem> = await service.queryDetail(props.data?.id);
@@ -227,6 +239,9 @@ const Save = (props: Props) => {
             required: model === 'add',
             message: '请输入密码',
           },
+          {
+            checkStrength: true,
+          },
         ],
       },
       confirmPassword: {
@@ -277,6 +292,9 @@ const Save = (props: Props) => {
               });
             },
           },
+          {
+            checkStrength: true,
+          },
         ],
 
         'x-reactions': [

+ 3 - 3
src/utils/util.ts

@@ -41,9 +41,9 @@ export const downloadFile = (url: string, params?: Record<string, any>) => {
 export const downloadObject = (record: Record<string, any>, fileName: string) => {
   // 创建隐藏的可下载链接
   const ghostLink = document.createElement('a');
-  ghostLink.download = `${fileName}-${
-    record?.name || moment(new Date()).format('YYYY/MM/DD HH:mm:ss')
-  }.json`;
+  ghostLink.download = `${record?.name}${fileName}_${moment(new Date()).format(
+    'YYYY/MM/DD HH:mm:ss',
+  )}.json`;
   ghostLink.style.display = 'none';
   //字符串内容转成Blob地址
   const blob = new Blob([JSON.stringify(record)]);