Explorar o código

feat(system): set table copyable=false;maskClosable=false

Lind %!s(int64=3) %!d(string=hai) anos
pai
achega
5d9cf5dfe3

+ 1 - 0
src/components/BaseCrud/save/index.tsx

@@ -125,6 +125,7 @@ const Save = <T extends Record<string, any>>(props: Props<T>) => {
         id: `pages.data.option.${model}`,
         id: `pages.data.option.${model}`,
         defaultMessage: '编辑',
         defaultMessage: '编辑',
       })}
       })}
+      maskClosable={false}
       visible={visible}
       visible={visible}
       onCancel={CurdModel.close}
       onCancel={CurdModel.close}
       onOk={save}
       onOk={save}

+ 1 - 1
src/components/BindUser/index.tsx

@@ -17,7 +17,7 @@ export const columns: ProColumns<UserItem>[] = [
   {
   {
     title: '姓名',
     title: '姓名',
     dataIndex: 'name',
     dataIndex: 'name',
-    copyable: true,
+    // copyable: true,
     ellipsis: true,
     ellipsis: true,
     align: 'center',
     align: 'center',
   },
   },

+ 1 - 1
src/pages/device/Instance/Detail/MetadataLog/Property/index.tsx

@@ -39,7 +39,7 @@ const PropertyLog = (props: Props) => {
           {
           {
             dataIndex: 'formatValue',
             dataIndex: 'formatValue',
             title: '数据',
             title: '数据',
-            copyable: true,
+            // copyable: true,
           },
           },
         ]}
         ]}
       />
       />

+ 50 - 37
src/pages/device/Product/Save/index.tsx

@@ -1,4 +1,4 @@
-import { Button, Drawer, message } from 'antd';
+import { message, Modal } from 'antd';
 import type { Field } from '@formily/core';
 import type { Field } from '@formily/core';
 import { createForm, onFieldValueChange } from '@formily/core';
 import { createForm, onFieldValueChange } from '@formily/core';
 import { TreeSelect, Form, FormItem, FormLayout, Input, Radio, Select } from '@formily/antd';
 import { TreeSelect, Form, FormItem, FormLayout, Input, Radio, Select } from '@formily/antd';
@@ -142,11 +142,24 @@ const Save = (props: Props) => {
             title: 'ID',
             title: 'ID',
             'x-component': 'Input',
             'x-component': 'Input',
             'x-decorator': 'FormItem',
             'x-decorator': 'FormItem',
+            'x-decorator-props': {
+              tooltip: <div>若不填写,系统将自动生成唯一ID</div>,
+            },
           },
           },
           name: {
           name: {
             title: '名称',
             title: '名称',
             'x-component': 'Input',
             'x-component': 'Input',
             'x-decorator': 'FormItem',
             'x-decorator': 'FormItem',
+            'x-validator': [
+              {
+                required: true,
+                message: '请输入名称',
+              },
+              {
+                max: 64,
+                message: '最多可输入64个字符',
+              },
+            ],
           },
           },
           classifiedId: {
           classifiedId: {
             title: '所属品类',
             title: '所属品类',
@@ -157,29 +170,29 @@ const Save = (props: Props) => {
             },
             },
             'x-reactions': ['{{useAsyncDataSource("classifiedId")}}'],
             'x-reactions': ['{{useAsyncDataSource("classifiedId")}}'],
           },
           },
-          orgId: {
-            title: '所属机构',
-            'x-component': 'Select',
-            'x-decorator': 'FormItem',
-            'x-reactions': ['{{useAsyncDataSource("org")}}'],
-          },
-          messageProtocol: {
-            title: '消息协议',
-            'x-component': 'Select',
-            'x-decorator': 'FormItem',
-            'x-reactions': ['{{useAsyncDataSource("protocol")}}'],
-          },
-          transportProtocol: {
-            title: '传输协议',
-            'x-component': 'Select',
-            'x-decorator': 'FormItem',
-          },
-          storePolicy: {
-            title: '存储策略',
-            'x-component': 'Select',
-            'x-decorator': 'FormItem',
-            'x-reactions': ['{{useAsyncDataSource("storePolicy")}}'],
-          },
+          // orgId: {
+          //   title: '所属机构',
+          //   'x-component': 'Select',
+          //   'x-decorator': 'FormItem',
+          //   'x-reactions': ['{{useAsyncDataSource("org")}}'],
+          // },
+          // messageProtocol: {
+          //   title: '消息协议',
+          //   'x-component': 'Select',
+          //   'x-decorator': 'FormItem',
+          //   'x-reactions': ['{{useAsyncDataSource("protocol")}}'],
+          // },
+          // transportProtocol: {
+          //   title: '传输协议',
+          //   'x-component': 'Select',
+          //   'x-decorator': 'FormItem',
+          // },
+          // storePolicy: {
+          //   title: '存储策略',
+          //   'x-component': 'Select',
+          //   'x-decorator': 'FormItem',
+          //   'x-reactions': ['{{useAsyncDataSource("storePolicy")}}'],
+          // },
           deviceType: {
           deviceType: {
             title: '设备类型',
             title: '设备类型',
             'x-component': 'Radio.Group',
             'x-component': 'Radio.Group',
@@ -189,32 +202,32 @@ const Save = (props: Props) => {
               { label: '网关子设备', value: 'childrenDevice' },
               { label: '网关子设备', value: 'childrenDevice' },
               { label: '网关设备', value: 'gateway' },
               { label: '网关设备', value: 'gateway' },
             ],
             ],
+            'x-validator': [
+              {
+                required: true,
+                message: '请选择设备类型',
+              },
+            ],
           },
           },
           describe: {
           describe: {
             title: '描述',
             title: '描述',
             'x-component': 'Input.TextArea',
             'x-component': 'Input.TextArea',
             'x-decorator': 'FormItem',
             'x-decorator': 'FormItem',
+            'x-component-props': {
+              showCount: true,
+              maxLength: 200,
+            },
           },
           },
         },
         },
       },
       },
     },
     },
   };
   };
   return (
   return (
-    <Drawer
-      visible={visible}
-      onClose={() => close()}
-      width="25vw"
-      title="新增产品"
-      extra={
-        <Button type="primary" onClick={handleSave}>
-          保存数据
-        </Button>
-      }
-    >
-      <Form form={form} size="small">
+    <Modal visible={visible} onCancel={() => close()} width="30vw" title="新增" onOk={handleSave}>
+      <Form form={form}>
         <SchemaField schema={schema} scope={{ useAsyncDataSource }} />
         <SchemaField schema={schema} scope={{ useAsyncDataSource }} />
       </Form>
       </Form>
-    </Drawer>
+    </Modal>
   );
   );
 };
 };
 export default Save;
 export default Save;

+ 6 - 0
src/pages/device/components/Metadata/Base/Edit/index.tsx

@@ -42,6 +42,7 @@ import DB from '@/db';
 import _ from 'lodash';
 import _ from 'lodash';
 import { useParams } from 'umi';
 import { useParams } from 'umi';
 import { InstanceModel } from '@/pages/device/Instance';
 import { InstanceModel } from '@/pages/device/Instance';
+import FRuleEditor from '@/components/FRuleEditor';
 
 
 interface Props {
 interface Props {
   type: 'product' | 'device';
   type: 'product' | 'device';
@@ -96,6 +97,7 @@ const Edit = (props: Props) => {
       EnumParam,
       EnumParam,
       BooleanEnum,
       BooleanEnum,
       ConfigParam,
       ConfigParam,
+      FRuleEditor,
     },
     },
     scope: {
     scope: {
       async asyncOtherConfig(field: Field) {
       async asyncOtherConfig(field: Field) {
@@ -356,6 +358,10 @@ const Edit = (props: Props) => {
             'x-component': 'Select',
             'x-component': 'Select',
             enum: PropertySource,
             enum: PropertySource,
           },
           },
+          rule: {
+            type: 'string',
+            'x-component': 'FRuleEditor',
+          },
           readOnly: {
           readOnly: {
             title: intl.formatMessage({
             title: intl.formatMessage({
               id: 'pages.device.productDetail.metadata.whetherReadOnly',
               id: 'pages.device.productDetail.metadata.whetherReadOnly',

+ 1 - 0
src/pages/system/Department/save.tsx

@@ -109,6 +109,7 @@ const Save = <T extends object>(props: SaveModalProps<T>) => {
               defaultMessage: '新增',
               defaultMessage: '新增',
             })
             })
       }
       }
+      maskClosable={false}
       visible={props.visible}
       visible={props.visible}
       onOk={saveData}
       onOk={saveData}
       onCancel={() => {
       onCancel={() => {

+ 2 - 2
src/pages/system/Permission/index.tsx

@@ -126,7 +126,7 @@ const Permission: React.FC = observer(() => {
         defaultMessage: '标识',
         defaultMessage: '标识',
       }),
       }),
       dataIndex: 'id',
       dataIndex: 'id',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       align: 'center',
       align: 'center',
       // sorter: true,
       // sorter: true,
@@ -138,7 +138,7 @@ const Permission: React.FC = observer(() => {
         defaultMessage: '名称',
         defaultMessage: '名称',
       }),
       }),
       dataIndex: 'name',
       dataIndex: 'name',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       align: 'center',
       align: 'center',
     },
     },

+ 1 - 1
src/pages/system/Role/Edit/UserManage/BindUser.tsx

@@ -29,7 +29,7 @@ const BindUser = (props: Props) => {
         defaultMessage: '名称',
         defaultMessage: '名称',
       }),
       }),
       dataIndex: 'name',
       dataIndex: 'name',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       tip: intl.formatMessage({
       tip: intl.formatMessage({
         id: 'pages.system.userName.tips',
         id: 'pages.system.userName.tips',

+ 1 - 1
src/pages/system/Role/Edit/UserManage/index.tsx

@@ -37,7 +37,7 @@ const UserManage = () => {
         defaultMessage: '名称',
         defaultMessage: '名称',
       }),
       }),
       dataIndex: 'name',
       dataIndex: 'name',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       tip: intl.formatMessage({
       tip: intl.formatMessage({
         id: 'pages.system.userName.tips',
         id: 'pages.system.userName.tips',

+ 2 - 2
src/pages/system/Role/index.tsx

@@ -30,7 +30,7 @@ const Role: React.FC = observer(() => {
         defaultMessage: '标识',
         defaultMessage: '标识',
       }),
       }),
       dataIndex: 'id',
       dataIndex: 'id',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       // sorter: true,
       // sorter: true,
       // defaultSortOrder: 'ascend',
       // defaultSortOrder: 'ascend',
@@ -49,7 +49,7 @@ const Role: React.FC = observer(() => {
         defaultMessage: '名称',
         defaultMessage: '名称',
       }),
       }),
       dataIndex: 'name',
       dataIndex: 'name',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       // tip: intl.formatMessage({
       // tip: intl.formatMessage({
       //   id: 'pages.system.userName.tips',
       //   id: 'pages.system.userName.tips',

+ 2 - 2
src/pages/system/User/index.tsx

@@ -36,7 +36,7 @@ const User = observer(() => {
         defaultMessage: '姓名',
         defaultMessage: '姓名',
       }),
       }),
       dataIndex: 'name',
       dataIndex: 'name',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       align: 'center',
       align: 'center',
       // tip: intl.formatMessage({
       // tip: intl.formatMessage({
@@ -63,7 +63,7 @@ const User = observer(() => {
         defaultMessage: '用户名',
         defaultMessage: '用户名',
       }),
       }),
       dataIndex: 'username',
       dataIndex: 'username',
-      copyable: true,
+      // copyable: true,
       ellipsis: true,
       ellipsis: true,
       align: 'center',
       align: 'center',
       // tip: intl.formatMessage({
       // tip: intl.formatMessage({