wzyyy 2 anni fa
parent
commit
29159f6cba

+ 7 - 1
src/pages/DataCollect/Collector/components/Point/Save/modbus.tsx

@@ -364,6 +364,10 @@ export default (props: Props) => {
             'x-decorator-props': {
               gridSpan: 2,
               layout: 'level',
+              style: {
+                marginBottom: '6px',
+                marginTop: '6px',
+              },
             },
             'x-component-props': {
               placeholder: '请选择非标准协议写入配置',
@@ -384,7 +388,7 @@ export default (props: Props) => {
               gridSpan: 2,
               style: {
                 backgroundColor: '#fafafa',
-                padding: 20,
+                padding: 6,
               },
             },
             'x-component': 'FormGrid',
@@ -420,6 +424,8 @@ export default (props: Props) => {
                     justifyContent: 'space-around',
                     minWidth: '130px',
                     height: '50px',
+                    marginBottom: '6px',
+                    marginTop: '6px',
                   },
                   options: [
                     { label: '是', value: true },

+ 10 - 0
src/pages/Northbound/DuerOS/Detail/index.tsx

@@ -252,6 +252,16 @@ const Save = () => {
           gridSpan: 1,
         },
         required: true,
+        'x-validator': [
+          {
+            max: 64,
+            message: '最多可输入64个字符',
+          },
+          {
+            required: true,
+            message: '请输入名称',
+          },
+        ],
         'x-component-props': {
           placeholder: '请输入名称',
         },

+ 1 - 1
src/pages/device/Firmware/Task/Detail/index.tsx

@@ -298,7 +298,7 @@ const Detail = observer(() => {
                 style={{ padding: 0 }}
                 isPermission={permission.update}
                 tooltip={{
-                  title: '重试',
+                  title: '查看',
                 }}
                 onClick={() => {
                   setVisible(true);

+ 36 - 36
src/pages/device/Firmware/Task/index.tsx

@@ -6,7 +6,7 @@ import { useRef, useState } from 'react';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import {
   ControlOutlined,
-  DeleteOutlined,
+  // DeleteOutlined,
   EyeOutlined,
   PlusOutlined,
   StopOutlined,
@@ -16,7 +16,7 @@ import { model } from '@formily/reactive';
 import { observer } from '@formily/react';
 import type { FirmwareItem } from '@/pages/device/Firmware/typings';
 import Save from './Save';
-import { onlyMessage } from '@/utils/util';
+// import { onlyMessage } from '@/utils/util';
 import { PermissionButton, AIcon } from '@/components';
 import useDomFullHeight from '@/hooks/document/useDomFullHeight';
 import usePermissions from '@/hooks/permission';
@@ -181,40 +181,40 @@ const Task = observer(() => {
           <EyeOutlined />
         </PermissionButton>,
         <UpgradeBtn data={record} actions={actionRef.current} key="btn" />,
-        <PermissionButton
-          key="delete"
-          type={'link'}
-          style={{ padding: 0 }}
-          isPermission={permission.delete}
-          tooltip={{
-            title: '删除',
-          }}
-          popConfirm={{
-            title:
-              record.waiting > 0 || record.processing > 0
-                ? '删除将导致正在进行的任务终止,确定要删除吗?'
-                : intl.formatMessage({
-                    id: 'pages.data.option.remove.tips',
-                    defaultMessage: '确认删除?',
-                  }),
-            onConfirm: async () => {
-              const resp = await service.deleteTask(record.id);
-              if (resp.status === 200) {
-                onlyMessage(
-                  intl.formatMessage({
-                    id: 'pages.data.option.success',
-                    defaultMessage: '操作成功!',
-                  }),
-                );
-                actionRef.current?.reload();
-              } else {
-                message.error(resp?.message || '删除失败!');
-              }
-            },
-          }}
-        >
-          <DeleteOutlined />
-        </PermissionButton>,
+        // <PermissionButton
+        //   key="delete"
+        //   type={'link'}
+        //   style={{ padding: 0 }}
+        //   isPermission={permission.delete}
+        //   tooltip={{
+        //     title: '删除',
+        //   }}
+        //   popConfirm={{
+        //     title:
+        //       record.waiting > 0 || record.processing > 0
+        //         ? '删除将导致正在进行的任务终止,确定要删除吗?'
+        //         : intl.formatMessage({
+        //             id: 'pages.data.option.remove.tips',
+        //             defaultMessage: '确认删除?',
+        //           }),
+        //     onConfirm: async () => {
+        //       const resp = await service.deleteTask(record.id);
+        //       if (resp.status === 200) {
+        //         onlyMessage(
+        //           intl.formatMessage({
+        //             id: 'pages.data.option.success',
+        //             defaultMessage: '操作成功!',
+        //           }),
+        //         );
+        //         actionRef.current?.reload();
+        //       } else {
+        //         message.error(resp?.message || '删除失败!');
+        //       }
+        //     },
+        //   }}
+        // >
+        //   <DeleteOutlined />
+        // </PermissionButton>,
       ],
     },
   ];

+ 2 - 2
src/pages/edge/Resource/Issue/Result.tsx

@@ -1,6 +1,6 @@
 import SystemConst from '@/utils/const';
 import Token from '@/utils/token';
-import { downloadObject } from '@/utils/util';
+import { downloadTxT } from '@/utils/util';
 import { Col, Input, Modal, Row } from 'antd';
 import { EventSourcePolyfill } from 'event-source-polyfill';
 import { useEffect, useState } from 'react';
@@ -90,7 +90,7 @@ const Publish = (props: Props) => {
               <a
                 style={{ marginLeft: 20 }}
                 onClick={() => {
-                  downloadObject(errMessage || '', '下发失败原因');
+                  downloadTxT(errMessage || '', '下发失败原因');
                 }}
               >
                 下载

+ 15 - 3
src/pages/edge/Resource/Issue/index.tsx

@@ -11,6 +11,7 @@ import styles from '@/pages/link/AccessConfig/Detail/components/Network/index.le
 import { InfoCircleOutlined } from '@ant-design/icons';
 import { onlyMessage } from '@/utils/util';
 import Result from './Result';
+import { service as api } from '@/pages/device/Instance';
 interface Props {
   data: Partial<ResourceItem>;
   cancel: () => void;
@@ -36,6 +37,14 @@ export default (props: Props) => {
       }),
       dataIndex: 'productName',
       ellipsis: true,
+      valueType: 'select',
+      request: async () => {
+        const res = await api.getProductList();
+        if (res.status === 200) {
+          return res.result.map((pItem: any) => ({ label: pItem.name, value: pItem.id }));
+        }
+        return [];
+      },
     },
     {
       title: intl.formatMessage({
@@ -50,9 +59,12 @@ export default (props: Props) => {
         id: 'pages.device.instance.registrationTime',
         defaultMessage: '注册时间',
       }),
-      dataIndex: 'registryTime',
+      dataIndex: 'registerTime',
       width: '200px',
-      render: (text: any) => (text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : ''),
+      valueType: 'dateTime',
+      render: (_: any, row) => {
+        return row.createTime ? moment(row.registerTime).format('YYYY-MM-DD HH:mm:ss') : '';
+      },
       sorter: true,
     },
     {
@@ -179,7 +191,7 @@ export default (props: Props) => {
                 type: 'and',
               },
             ],
-            sorts: [{ name: 'createTime', order: 'desc' }],
+            sorts: [{ name: 'registerTime', order: 'desc' }],
           })
         }
       />

+ 2 - 2
src/pages/edge/Resource/index.tsx

@@ -61,7 +61,7 @@ export default () => {
       tooltip={{
         title:
           type !== 'list'
-            ? `${record.state.value === 'disabled' ? '请先启用,再下发' : undefined}`
+            ? `${record.state.value === 'disabled' ? '请先启用,再下发' : ''}`
             : '下发',
       }}
       style={{ padding: 0 }}
@@ -179,7 +179,7 @@ export default () => {
     {
       title: '所属边缘网关',
       width: 150,
-      dataIndex: 'sourceId',
+      dataIndex: 'sourceName',
       ellipsis: true,
     },
     {

+ 4 - 4
src/pages/iot-card/Platform/Detail/index.tsx

@@ -179,10 +179,10 @@ const Detail = observer(() => {
                   placeholder: '请输入接口地址',
                 },
                 'x-validator': [
-                  {
-                    max: 64,
-                    message: '最多可输入64个字符',
-                  },
+                  // {
+                  //   max: 64,
+                  //   message: '最多可输入64个字符',
+                  // },
                   {
                     required: true,
                     message: '请输入接口地址',

+ 1 - 1
src/pages/media/Device/Channel/Live/index.less

@@ -54,6 +54,6 @@
 
 .media-live-tool {
   display: flex;
-  justify-content: center;
+  // justify-content: center;
   margin-top: 24px;
 }

+ 72 - 0
src/pages/notice/Config/Detail/index.tsx

@@ -248,6 +248,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入corpId',
+                  },
                 ],
               },
               corpSecret: {
@@ -271,6 +275,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入corpSecret',
+                  },
                 ],
               },
               appId: {
@@ -294,6 +302,12 @@ const Detail = observer(() => {
                 title: 'AppSecret',
                 'x-component': 'Input',
                 required: true,
+                'x-validator': [
+                  {
+                    required: true,
+                    message: '请输入secret',
+                  },
+                ],
                 'x-decorator': 'FormItem',
                 'x-component-props': {
                   placeholder: '请输入secret',
@@ -342,6 +356,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入AppKey',
+                  },
                 ],
               },
               appSecret: {
@@ -357,6 +375,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入AppSecret',
+                  },
                 ],
                 'x-reactions': {
                   dependencies: ['provider'],
@@ -375,6 +397,12 @@ const Detail = observer(() => {
                 'x-component-props': {
                   placeholder: '请输入webhook',
                 },
+                'x-validator': [
+                  {
+                    required: true,
+                    message: '请输入webhook',
+                  },
+                ],
                 'x-reactions': {
                   dependencies: ['provider'],
                   fulfill: {
@@ -422,6 +450,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入accessKeyId',
+                  },
                 ],
               },
               secret: {
@@ -437,6 +469,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入secret',
+                  },
                 ],
               },
             },
@@ -472,6 +508,12 @@ const Detail = observer(() => {
                         width: '180px',
                       },
                     },
+                    'x-validator': [
+                      {
+                        required: true,
+                        message: '请输入服务器地址',
+                      },
+                    ],
                     'x-component': 'FAutoComplete',
                     'x-decorator': 'FormItem',
                     enum: [
@@ -499,6 +541,10 @@ const Detail = observer(() => {
                         max: 65535,
                         message: '请输入1~65535之间的正整数',
                       },
+                      {
+                        required: true,
+                        message: '请输入端口',
+                      },
                     ],
                     'x-component': 'NumberPicker',
                     'x-decorator': 'FormItem',
@@ -545,6 +591,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入发件人',
+                  },
                 ],
               },
               username: {
@@ -560,6 +610,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入用户名',
+                  },
                 ],
               },
               password: {
@@ -575,6 +629,10 @@ const Detail = observer(() => {
                     max: 64,
                     message: '最多可输入64个字符',
                   },
+                  {
+                    required: true,
+                    message: '请输入密码',
+                  },
                 ],
               },
             },
@@ -597,6 +655,12 @@ const Detail = observer(() => {
                 'x-component-props': {
                   placeholder: '请输入Webhook',
                 },
+                'x-validator': [
+                  {
+                    required: true,
+                    message: '请输入Webhook',
+                  },
+                ],
                 'x-component': 'Input',
                 'x-decorator': 'FormItem',
               },
@@ -627,6 +691,10 @@ const Detail = observer(() => {
                               max: 64,
                               message: '最多可输入64个字符',
                             },
+                            {
+                              required: true,
+                              message: '请输入KEY',
+                            },
                           ],
                         },
                       },
@@ -646,6 +714,10 @@ const Detail = observer(() => {
                               max: 64,
                               message: '最多可输入64个字符',
                             },
+                            {
+                              required: true,
+                              message: '请输入VALUE',
+                            },
                           ],
                         },
                       },

+ 2 - 10
src/pages/rule-engine/Alarm/Configuration/index.tsx

@@ -238,11 +238,7 @@ const Configuration = () => {
           key="action"
           style={{ padding: 0 }}
           popConfirm={{
-            title: `${
-              record.state?.value !== 'disabled'
-                ? '禁用告警不会影响关联的场景状态,确定要禁用吗'
-                : '确认启用'
-            }?`,
+            title: `${record.state?.value !== 'disabled' ? '确认禁用' : '确认启用'}?`,
             onConfirm: async () => {
               if (record.state?.value === 'disabled') {
                 await service._enable(record.id);
@@ -375,11 +371,7 @@ const Configuration = () => {
                 isPermission={permission.action}
                 style={{ padding: 0 }}
                 popConfirm={{
-                  title: `${
-                    record.state?.value !== 'disabled'
-                      ? '禁用告警不会影响关联的场景状态,确定要禁用吗'
-                      : '确认启用'
-                  }?`,
+                  title: `${record.state?.value !== 'disabled' ? '确认禁用' : '确认启用'}?`,
                   onConfirm: async () => {
                     if (record.state?.value === 'disabled') {
                       await service._enable(record.id);

+ 17 - 0
src/utils/util.ts

@@ -67,6 +67,23 @@ export const downloadObject = (record: Record<string, any>, fileName: string, fo
   document.body.removeChild(ghostLink);
 };
 
+export const downloadTxT = (record: Record<string, any>, fileName: string, format?: string) => {
+  // 创建隐藏的可下载链接
+  const ghostLink = document.createElement('a');
+  ghostLink.download = `${fileName ? '' : record?.name}${fileName}_${moment(new Date()).format(
+    format || 'YYYY_MM_DD',
+  )}.txt`;
+  ghostLink.style.display = 'none';
+  //字符串内容转成Blob地址
+  const blob = new Blob([JSON.stringify(record)]);
+  ghostLink.href = URL.createObjectURL(blob);
+  //触发点击
+  document.body.appendChild(ghostLink);
+  ghostLink.click();
+  //移除
+  document.body.removeChild(ghostLink);
+};
+
 export const useAsyncDataSource =
   (services: (arg0: Field) => Promise<FieldDataSource>) => (field: Field) => {
     field.loading = true;