Просмотр исходного кода

fix: bug#8934.8926.8883.8850.8798.8787.8766

wzyyy 3 лет назад
Родитель
Сommit
fa73550920

+ 6 - 1
src/components/Upload/Image/index.tsx

@@ -21,6 +21,7 @@ interface UploadImageProps {
   size?: number;
   style?: React.CSSProperties;
   backgroundSize?: string;
+  errorMessage?: string;
 }
 
 export default ({ onChange, value, ...extraProps }: UploadImageProps) => {
@@ -49,7 +50,11 @@ export default ({ onChange, value, ...extraProps }: UploadImageProps) => {
   const beforeUpload = (file: RcFile) => {
     const isType = imageTypes.includes(file.type);
     if (!isType) {
-      message.error(`图片格式错误,必须是${imageTypes.toString()}格式`);
+      if (extraProps.errorMessage) {
+        message.error(extraProps.errorMessage);
+      } else {
+        message.error(`图片格式错误,必须是${imageTypes.toString()}格式`);
+      }
       return false;
     }
     const isSize = file.size / 1024 / 1024 < (extraProps.size || 4);

+ 4 - 145
src/pages/device/DashBoard/index.tsx

@@ -280,7 +280,10 @@ const DeviceBoard = () => {
       },
     ]);
     if (res.status === 200) {
-      const x = res.result.map((item: any) => item.data.timeString).reverse();
+      // const x = res.result.map((item: any) => item.data.timeString).reverse();
+      const x = res.result
+        .map((item: any) => (_time === '1h' ? `${item.data.timeString}时` : item.data.timeString))
+        .reverse();
       const y = res.result.map((item: any) => item.data.value).reverse();
       setOptions({
         xAxis: {
@@ -334,150 +337,6 @@ const DeviceBoard = () => {
         ],
       });
     }
-    // if (data && data.time.type !== 'today') {
-    //   const res = await service.dashboard([
-    //     {
-    //       dashboard: 'device',
-    //       object: 'message',
-    //       measurement: 'quantity',
-    //       dimension: 'agg',
-    //       group: 'device_msg',
-    //       params: {
-    //         time: '1d',
-    //         format: 'yyyy.MM.dd',
-    //         limit: Math.ceil((data.time.end - data.time.start) / (1 * 24 * 3600 * 1000) + 1),
-    //         // from: moment(data.time.start).format('yyyy-MM-DD HH:MM:SS'),
-    //         // to: moment(data.time.end).format('yyyy-MM-DD HH:MM:SS'),
-    //         from: data.time.start,
-    //         to: data.time.end,
-    //       },
-    //     },
-    //   ]);
-    //   if (res.status === 200) {
-    //     const x = res.result.map((item: any) => item.data.timeString).reverse();
-    //     const y = res.result.map((item: any) => item.data.value).reverse();
-    //     setOptions({
-    //       xAxis: {
-    //         type: 'category',
-    //         boundaryGap: false,
-    //         data: x,
-    //       },
-    //       yAxis: {
-    //         type: 'value',
-    //       },
-    //       tooltip: {
-    //         trigger: 'axis',
-    //         // axisPointer: {
-    //         //   type: 'shadow',
-    //         // },
-    //       },
-    //       grid: {
-    //         top: '2%',
-    //         bottom: '5%',
-    //         left: '50px',
-    //         right: '50px',
-    //       },
-    //       series: [
-    //         {
-    //           name: '消息量',
-    //           data: y,
-    //           type: 'line',
-    //           smooth: true,
-    //           color: '#685DEB',
-    //           areaStyle: {
-    //             color: {
-    //               type: 'linear',
-    //               x: 0,
-    //               y: 0,
-    //               x2: 0,
-    //               y2: 1,
-    //               colorStops: [
-    //                 {
-    //                   offset: 0,
-    //                   color: '#685DEB', // 100% 处的颜色
-    //                 },
-    //                 {
-    //                   offset: 1,
-    //                   color: '#FFFFFF', //   0% 处的颜色
-    //                 },
-    //               ],
-    //               global: false, // 缺省为 false
-    //             },
-    //           },
-    //         },
-    //       ],
-    //     });
-    //   }
-    // } else {
-    //   const res = await service.dashboard([
-    //     {
-    //       dashboard: 'device',
-    //       object: 'message',
-    //       measurement: 'quantity',
-    //       dimension: 'agg',
-    //       group: 'device_msg',
-    //       params: {
-    //         time: '1h',
-    //         format: 'yyyy.MM.dd HH:MM:SS',
-    //         limit: 24,
-    //         from: data.time.start,
-    //         to: data.time.end,
-    //       },
-    //     },
-    //   ]);
-    //   if (res.status === 200) {
-    //     const x = res.result.map((item: any) => item.data.timeString).reverse();
-    //     const y = res.result.map((item: any) => item.data.value).reverse();
-    //     setOptions({
-    //       xAxis: {
-    //         type: 'category',
-    //         boundaryGap: false,
-    //         data: x,
-    //       },
-    //       yAxis: {
-    //         type: 'value',
-    //       },
-    //       tooltip: {
-    //         trigger: 'axis',
-    //       },
-    //       grid: {
-    //         top: '2%',
-    //         bottom: '5%',
-    //         left: '2%',
-    //         right: '2%',
-    //       },
-    //       series: [
-    //         {
-    //           name: '消息量',
-    //           data: y,
-    //           type: 'line',
-    //           smooth: true,
-    //           color: '#685DEB',
-    //           areaStyle: {
-    //             color: {
-    //               type: 'linear',
-    //               x: 0,
-    //               y: 0,
-    //               x2: 0,
-    //               y2: 1,
-    //               colorStops: [
-    //                 {
-    //                   offset: 0,
-    //                   color: '#685DEB', // 100% 处的颜色
-    //                 },
-    //                 {
-    //                   offset: 1,
-    //                   color: '#FFFFFF', //   0% 处的颜色
-    //                 },
-    //               ],
-    //               global: false, // 缺省为 false
-    //             },
-    //           },
-    //         },
-    //       ],
-    //     });
-    //   }
-    // }
   };
   //地图数据
   const geo = async (data?: any) => {

+ 1 - 1
src/pages/device/Instance/Detail/Functions/form.tsx

@@ -76,7 +76,7 @@ export default (props: FunctionProps) => {
           //   }
           // </>
           // @ts-ignore
-          <DatePicker format={'YYYY-MM-DD HH:mm:ss'} style={{ width: '100%' }} />
+          <DatePicker format={'YYYY-MM-DD HH:mm:ss'} style={{ width: '100%' }} showTime />
         );
       default:
         return <Input placeholder={'请输入' + name} />;

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

@@ -193,7 +193,7 @@ const InstanceDetail = observer(() => {
       if (response.result.protocol === 'modbus-tcp') {
         datalist.push({
           key: 'modbus',
-          tab: 'Modbus',
+          tab: 'Modbus TCP',
           component: <MapChannel data={InstanceModel.detail} type="MODBUS_TCP" />,
         });
       }

+ 12 - 3
src/pages/system/Basis/index.tsx

@@ -131,7 +131,7 @@ const Basis = () => {
                       </>
                     }
                   >
-                    <UploadImage />
+                    <UploadImage errorMessage={'请上传.jpg.png.jfif.pjp.pjpeg.jpeg格式的图片'} />
                   </Form.Item>
                 </Col>
                 <Col>
@@ -146,7 +146,12 @@ const Basis = () => {
                       </>
                     }
                   >
-                    <UploadImage size={1} types={['image/x-icon']} backgroundSize={'inherit'} />
+                    <UploadImage
+                      size={1}
+                      types={['image/x-icon', 'image/jpeg', 'image/png']}
+                      backgroundSize={'inherit'}
+                      errorMessage={'请上传.ico.jpg.png.jfif.pjp.pjpeg.jpeg格式的图片'}
+                    />
                   </Form.Item>
                 </Col>
               </Row>
@@ -163,7 +168,11 @@ const Basis = () => {
                 }
                 rules={[{ required: true, message: '请上传背景图' }]}
               >
-                <UploadImage size={4} style={{ width: 570, height: 415 }} />
+                <UploadImage
+                  size={4}
+                  style={{ width: 570, height: 415 }}
+                  errorMessage={'请上传.jpg.png.jfif.pjp.pjpeg.jpeg格式的图片'}
+                />
               </Form.Item>
             </Col>
           </Row>

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

@@ -1,7 +1,7 @@
 import type { ProColumns } from '@jetlinks/pro-table';
 import ProTable from '@jetlinks/pro-table';
 import { Modal } from 'antd';
-import { useRef, useState } from 'react';
+import { useEffect, useRef, useState } from 'react';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { service } from '@/pages/system/User/index';
 import Service from '@/pages/system/Role/service';
@@ -53,6 +53,10 @@ const BindUser = (props: Props) => {
     },
   ];
 
+  useEffect(() => {
+    actionRef.current?.reset?.();
+  }, [props.visible]);
+
   return (
     <Modal
       title="添加"