xieyonghong 3 лет назад
Родитель
Сommit
289fc6e84b

+ 8 - 3
src/components/SearchComponent/index.tsx

@@ -198,13 +198,18 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
                 state.componentProps = { showTime: true };
               });
               f.setFieldState(typeFiled.query('.termType'), async (state) => {
-                state.value = 'gt';
+                state.value = 'gte';
               });
             } else {
               f.setFieldState(typeFiled.query('.value'), async (state) => {
                 state.componentType = 'Input';
               });
             }
+            if (_column === 'id') {
+              f.setFieldState(typeFiled.query('.termType'), async (state) => {
+                state.value = 'eq';
+              });
+            }
           });
         },
       }),
@@ -455,10 +460,10 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
   };
 
   useEffect(() => {
-    if (defaultParam) {
+    if (defaultParam || initParam) {
       handleSearch();
     }
-  }, []);
+  }, [defaultParam, initParam]);
 
   const handleSaveLog = async () => {
     const value = await form.submit<SearchTermsUI>();

+ 36 - 11
src/pages/Log/Access/index.tsx

@@ -37,17 +37,30 @@ const Access = () => {
       title: '请求方法',
       dataIndex: 'httpMethod',
       ellipsis: true,
-    },
-    {
-      title: intl.formatMessage({
-        id: 'pages.table.description',
-        defaultMessage: '说明',
-      }),
-      dataIndex: 'describe',
-      ellipsis: true,
-      // render: (text, record) => {
-      //   return `${record.action}-${record.describe}`;
-      // },
+      valueType: 'select',
+      width: 80,
+      valueEnum: {
+        POST: {
+          text: 'POST',
+          status: 'POST',
+        },
+        GET: {
+          text: 'GET',
+          status: 'GET',
+        },
+        PATCH: {
+          text: 'PATCH',
+          status: 'PATCH',
+        },
+        DELETE: {
+          text: 'DELETE',
+          status: 'DELETE',
+        },
+        PUT: {
+          text: 'PUT',
+          status: 'PUT',
+        },
+      },
     },
     {
       title: intl.formatMessage({
@@ -67,6 +80,7 @@ const Access = () => {
         id: 'pages.log.access.requestTimeConsuming',
         defaultMessage: '请求耗时',
       }),
+      width: 80,
       renderText: (record: AccessLogItem) => (
         <Tag color="purple">{record.responseTime - record.requestTime}ms</Tag>
       ),
@@ -83,6 +97,17 @@ const Access = () => {
     },
     {
       title: intl.formatMessage({
+        id: 'pages.table.description',
+        defaultMessage: '说明',
+      }),
+      dataIndex: 'describe',
+      ellipsis: true,
+      // render: (text, record) => {
+      //   return `${record.action}-${record.describe}`;
+      // },
+    },
+    {
+      title: intl.formatMessage({
         id: 'pages.data.option',
         defaultMessage: '操作',
       }),

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

@@ -291,7 +291,7 @@ const Product = observer(() => {
         id: 'pages.system.description',
         defaultMessage: '说明',
       }),
-      hideInSearch: true,
+      // hideInSearch: true,
     },
     {
       title: intl.formatMessage({

+ 11 - 0
src/pages/link/Protocol/index.tsx

@@ -57,6 +57,17 @@ const Protocol = () => {
       dataIndex: 'type',
       title: '类型',
       ellipsis: true,
+      valueType: 'select',
+      valueEnum: {
+        jar: {
+          text: 'jar',
+          status: 'jar',
+        },
+        local: {
+          text: 'local',
+          status: 'local',
+        },
+      },
     },
     {
       dataIndex: 'state',

+ 3 - 2
src/pages/link/Type/Detail/index.tsx

@@ -755,7 +755,8 @@ const Save = observer(() => {
     },
   };
 
-  const handleSave = async (data: any) => {
+  const handleSave = async () => {
+    const data: any = await form.submit();
     if (data.shareCluster === false) {
       data.cluster = data.cluster?.map((item: any) => ({
         serverId: item.serverId,
@@ -791,7 +792,7 @@ const Save = observer(() => {
               <PermissionButton
                 type="primary"
                 isPermission={getOtherPermission(['add', 'update'])}
-                onClick={handleSave}
+                onClick={() => handleSave()}
               >
                 保存
               </PermissionButton>

+ 30 - 0
src/pages/link/Type/index.tsx

@@ -61,11 +61,30 @@ const Network = () => {
         id: 'pages.link.type',
         defaultMessage: '类型',
       }),
+      valueType: 'select',
+      request: () =>
+        service.getSupports().then((resp) =>
+          resp.result.map((item: any) => ({
+            label: item.name,
+            value: item.id,
+          })),
+        ),
     },
     {
       dataIndex: 'shareCluster',
       title: '集群',
       renderText: (text) => (text ? '共享配置' : '独立配置'),
+      valueType: 'select',
+      valueEnum: {
+        true: {
+          text: '共享配置',
+          status: true,
+        },
+        false: {
+          text: '独立配置',
+          status: false,
+        },
+      },
     },
     {
       dataIndex: 'configuration',
@@ -102,6 +121,17 @@ const Network = () => {
         id: 'pages.searchTable.titleStatus',
         defaultMessage: '状态',
       }),
+      valueType: 'select',
+      valueEnum: {
+        disabled: {
+          text: '已停止',
+          status: 'disabled',
+        },
+        enabled: {
+          text: '已启动',
+          status: 'enabled',
+        },
+      },
       render: (text, record) => {
         if (record.state.value === 'enabled') {
           return <Badge color="lime" text="正常" />;

+ 11 - 0
src/pages/media/Cascade/Channel/index.tsx

@@ -107,6 +107,17 @@ const Channel = () => {
     {
       dataIndex: 'status',
       title: '在线状态',
+      valueType: 'select',
+      valueEnum: {
+        online: {
+          text: '已连接',
+          status: 'online',
+        },
+        offline: {
+          text: '离线',
+          status: 'offline',
+        },
+      },
       render: (text: any, record: any) => (
         <BadgeStatus
           status={record.status?.value}

+ 12 - 1
src/pages/media/Device/Channel/index.tsx

@@ -100,6 +100,17 @@ export default () => {
         id: 'pages.searchTable.titleStatus',
         defaultMessage: '状态',
       }),
+      valueType: 'select',
+      valueEnum: {
+        online: {
+          text: '已连接',
+          status: 'online',
+        },
+        offline: {
+          text: '离线',
+          status: 'offline',
+        },
+      },
       render: (_, record) => (
         <BadgeStatus
           status={record.status.value}
@@ -129,8 +140,8 @@ export default () => {
           })}
         >
           <Button
-            type={'link'}
             style={{ padding: 0 }}
+            type="link"
             onClick={() => {
               setCurrent(record);
               setVisible(true);

+ 1 - 0
src/pages/media/Device/index.tsx

@@ -115,6 +115,7 @@ const Device = () => {
         defaultMessage: '通道数量',
       }),
       valueType: 'digit',
+      hideInSearch: true,
     },
     {
       dataIndex: 'manufacturer',

+ 7 - 1
src/pages/notice/Config/Debug/index.tsx

@@ -34,7 +34,12 @@ const Debug = observer(() => {
             const list = Store.get('notice-template-list');
 
             const _template = list.find((item: any) => item.id === value);
-            form1.setValuesIn('variableDefinitions', _template.variableDefinitions);
+            if (_template?.variableDefinitions?.length > 0) {
+              form1.setFieldState('variableDefinitions', (_state) => {
+                _state.visible = true;
+                _state.value = _template.variableDefinitions;
+              });
+            }
           });
           onFieldReact('variableDefinitions.*.type', (field) => {
             const value = (field as Field).value;
@@ -109,6 +114,7 @@ const Debug = observer(() => {
           pagination: { pageSize: 9999 },
           scroll: { x: '100%' },
         },
+        'x-visible': false,
         items: {
           type: 'object',
           properties: {

+ 8 - 4
src/pages/notice/Template/Debug/index.tsx

@@ -36,10 +36,8 @@ const Debug = observer(() => {
             if (target && target.variableDefinitions) {
               form1.setValuesIn('variableDefinitions', target.variableDefinitions);
             }
-            //
-            // 获取 变量列表
-            // 然后set 值
           });
+
           onFieldReact('variableDefinitions.*.type', (field) => {
             const value = (field as Field).value;
             const format = field.query('.value').take() as any;
@@ -70,7 +68,12 @@ const Debug = observer(() => {
 
   useEffect(() => {
     const data = state.current;
-    form.setValuesIn('variableDefinitions', data?.variableDefinitions);
+    if (data?.variableDefinitions?.length > 0) {
+      form.setFieldState('variableDefinitions', (state1) => {
+        state1.visible = true;
+        state1.value = data?.variableDefinitions;
+      });
+    }
   }, [state.current]);
 
   const SchemaField = createSchemaField({
@@ -121,6 +124,7 @@ const Debug = observer(() => {
           pagination: { pageSize: 9999 },
           scroll: { x: '100%' },
         },
+        'x-visible': false,
         items: {
           type: 'object',
           properties: {

+ 13 - 1
src/pages/notice/Template/Detail/index.tsx

@@ -216,6 +216,11 @@ const Detail = observer(() => {
                 ?.match(pattern)
                 ?.filter((i: string) => i)
                 .map((item: string) => ({ id: item, type: 'string', format: '--' }));
+            if (idList && idList.length > 0) {
+              form1.setFieldState('variableDefinitions', (state1) => {
+                state1.visible = true;
+              });
+            }
             if (form1.modified) {
               form1.setValuesIn('variableDefinitions', idList);
             }
@@ -343,6 +348,9 @@ const Detail = observer(() => {
         type: 'string',
         'x-decorator': 'FormItem',
         'x-component': 'Input',
+        'x-component-props': {
+          placeholder: '请输入名称',
+        },
         name: 'name',
         'x-validator': [
           {
@@ -913,6 +921,9 @@ const Detail = observer(() => {
                 'x-decorator-props': {
                   tip: '多个收件人用换行分隔 \n最大支持1000个号码',
                 },
+                'x-component-props': {
+                  placeholder: '请输入收件人邮箱,多个收件人用换行分隔',
+                },
               },
               attachments: {
                 type: 'array',
@@ -944,7 +955,7 @@ const Detail = observer(() => {
                       'x-component-props': {
                         type: 'file',
                         display: 'name',
-                        placeholder: '请上传文件',
+                        placeholder: '请上传文件或输入文件名称',
                       },
                     },
                     remove: {
@@ -999,6 +1010,7 @@ const Detail = observer(() => {
           pagination: { pageSize: 9999 },
           scroll: { x: '100%' },
         },
+        'x-visible': false,
         items: {
           type: 'object',
           properties: {