Forráskód Böngészése

fix: 修改bug12.21

100011797 3 éve
szülő
commit
0cc06e1db2

+ 2 - 0
src/pages/device/Instance/Detail/Config/index.tsx

@@ -156,6 +156,8 @@ const Config = () => {
               size="small"
               column={3}
               bordered
+              labelStyle={{ width: 150 }}
+              contentStyle={{ minWidth: 100 }}
               title={<h4 style={{ fontSize: 15 }}>{i.name}</h4>}
             >
               {(i?.properties || []).map((item: any) => (

+ 1 - 0
src/pages/device/Instance/Detail/Diagnose/Message/Dialog/index.tsx

@@ -31,6 +31,7 @@ const Dialog = (props: Props) => {
   return (
     <div className={classNames('dialog-item', { 'dialog-active': !data?.upstream })} key={data.key}>
       <div className="dialog-card">
+        {/*<div>{data.key}</div>*/}
         {data.list.map((item: any) => (
           <div key={item.key} className="dialog-list">
             <div

+ 20 - 27
src/pages/device/Instance/Detail/Diagnose/Message/index.tsx

@@ -26,6 +26,7 @@ import { observer } from '@formily/reactive-react';
 import DiagnoseForm from './form';
 import { model } from '@formily/reactive';
 import { Empty } from '@/components';
+import _ from 'lodash';
 
 export const DiagnoseMessageModel = model<{
   input: any;
@@ -62,20 +63,18 @@ const Message = observer(() => {
             },
           ];
         } else {
-          DiagnoseStatusModel.allDialogList = [
-            ...DiagnoseStatusModel.logList,
-            { key: randomString(), ...payload },
-          ];
+          const data = { key: randomString(), ...payload };
+          DiagnoseStatusModel.allDialogList.push(data);
           const flag = [...DiagnoseStatusModel.allDialogList]
             .filter(
               (i) =>
-                i.traceId === payload.traceId &&
-                (payload.downstream === i.downstream || payload.upstream === i.upstream),
+                i.traceId === data.traceId &&
+                (data.downstream === i.downstream || data.upstream === i.upstream),
             )
             .every((item) => {
               return !item.error;
             });
-          if (!payload.upstream) {
+          if (!data.upstream) {
             DiagnoseStatusModel.message.down = {
               text: !flag ? '下行消息通信异常' : '下行消息通信正常',
               status: !flag ? 'error' : 'success',
@@ -86,37 +85,31 @@ const Message = observer(() => {
               status: !flag ? 'error' : 'success',
             };
           }
-          const list = [...DiagnoseStatusModel.dialogList];
+          const list: any[] = _.cloneDeep(DiagnoseStatusModel.dialogList);
           const t = list.find(
             (item) =>
-              item.traceId === payload.traceId &&
-              payload.downstream === item.downstream &&
-              payload.upstream === item.upstream,
+              item.traceId === data.traceId &&
+              data.downstream === item.downstream &&
+              data.upstream === item.upstream,
           );
           if (t) {
-            list.map((item) => {
-              if (item.key === payload.traceId) {
-                item.list.push({
-                  key: randomString(),
-                  ...payload,
-                });
+            const arr = list.map((item) => {
+              if (item.traceId === data.traceId) {
+                item.list.push(data);
               }
+              return item;
             });
+            DiagnoseStatusModel.dialogList = _.cloneDeep(arr);
           } else {
             list.push({
               key: randomString(),
-              traceId: payload.traceId,
-              downstream: payload.downstream,
-              upstream: payload.upstream,
-              list: [
-                {
-                  key: randomString(),
-                  ...payload,
-                },
-              ],
+              traceId: data.traceId,
+              downstream: data.downstream,
+              upstream: data.upstream,
+              list: [data],
             });
+            DiagnoseStatusModel.dialogList = _.cloneDeep(list);
           }
-          DiagnoseStatusModel.dialogList = [...list];
         }
         const chatBox = document.getElementById('dialog');
         if (chatBox) {

+ 7 - 3
src/pages/device/Instance/Detail/Diagnose/Status/model.ts

@@ -228,7 +228,7 @@ export const mediaInitList: ListProps[] = [
   },
 ];
 
-export const DiagnoseStatusModel = model<{
+interface DiagnoseStatusModelProps {
   list: ListProps[];
   product: Partial<ProductItem>;
   gateway: any;
@@ -255,7 +255,9 @@ export const DiagnoseStatusModel = model<{
     };
   };
   flag: boolean; // 离开页面后让还未执行的方法停止
-}>({
+}
+
+export const DiagnoseStatusModelInit: DiagnoseStatusModelProps = {
   list: [],
   product: {},
   parent: {},
@@ -282,7 +284,9 @@ export const DiagnoseStatusModel = model<{
     },
   },
   flag: true,
-});
+};
+
+export const DiagnoseStatusModel = model<DiagnoseStatusModelProps>({ ...DiagnoseStatusModelInit });
 
 export const gatewayList = [
   'websocket-server',

+ 6 - 9
src/pages/device/Instance/Detail/Diagnose/index.tsx

@@ -8,6 +8,7 @@ import { InstanceModel } from '@/pages/device/Instance';
 import { observer } from '@formily/reactive-react';
 import {
   DiagnoseStatusModel,
+  DiagnoseStatusModelInit,
   headerColorMap,
   headerDescMap,
   headerImgMap,
@@ -45,20 +46,16 @@ const Diagnose = observer(() => {
     }
     DiagnoseStatusModel.state = 'loading';
     return () => {
-      DiagnoseStatusModel.list = [];
-      DiagnoseStatusModel.count = 0;
-      DiagnoseStatusModel.percent = 0;
-      DiagnoseStatusModel.status = 'loading';
-      DiagnoseStatusModel.state = 'loading';
-      DiagnoseStatusModel.flag = false;
+      console.log('ren');
+      Object.keys(DiagnoseStatusModelInit).map((key) => {
+        DiagnoseStatusModel[key] = DiagnoseStatusModelInit[key];
+      });
       DiagnoseMessageModel.inputs = [];
       DiagnoseMessageModel.data = { type: 'function' };
       DiagnoseMessageModel.input = {};
       DiagnoseMessageModel._inputs = {};
-      DiagnoseStatusModel.logList = [];
-      DiagnoseStatusModel.dialogList = [];
     };
-  }, [InstanceModel.active]);
+  }, []); // InstanceModel.active
 
   const activeStyle = {
     background: '#FFFFFF',

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

@@ -40,6 +40,7 @@ const Info = observer(() => {
           size="small"
           column={3}
           bordered
+          labelStyle={{ width: 150 }}
           title={[
             <span key={1}>设备信息</span>,
             <PermissionButton

+ 2 - 0
src/pages/device/Instance/Detail/Reation/index.tsx

@@ -38,6 +38,8 @@ const Reation = () => {
         bordered
         column={3}
         size="small"
+        labelStyle={{ width: 150 }}
+        contentStyle={{ minWidth: 100 }}
         title={
           <span>
             关系信息

+ 2 - 0
src/pages/device/Instance/Detail/Tags/index.tsx

@@ -33,6 +33,8 @@ const Tags = () => {
         style={{ marginBottom: 20 }}
         bordered
         column={2}
+        labelStyle={{ width: 150 }}
+        contentStyle={{ minWidth: 100 }}
         size="small"
         title={
           <span>

+ 1 - 1
src/pages/link/DashBoard/index.tsx

@@ -253,7 +253,7 @@ export default () => {
         left: 50,
         right: 0,
         top: 10,
-        bottom: 10,
+        bottom: 20,
       },
       color: ['#979AFF'],
       series: Object.keys(data).length

+ 5 - 5
src/pages/notice/Config/Detail/index.tsx

@@ -443,11 +443,11 @@ const Detail = observer(() => {
                           value: 465,
                         },
                       },
-                      otherwise: {
-                        state: {
-                          value: 25,
-                        },
-                      },
+                      // otherwise: {
+                      //   state: {
+                      //     value: 25,
+                      //   },
+                      // },
                     },
                   },
                   ssl: {

+ 17 - 0
src/pages/system/Role/Detail/Permission/Allocate/MenuPermission.tsx

@@ -12,6 +12,7 @@ interface Props {
   assetsList?: any[];
   change: (data: any) => void;
   checkChange?: (data: any) => void;
+  checkBoxChange?: (data: boolean) => void;
 }
 
 const MenuPermission = (props: Props) => {
@@ -151,6 +152,9 @@ const MenuPermission = (props: Props) => {
                   buttons: [...buttons],
                   children: checkAllData(value.children || [], e.target.checked, cvalue),
                 });
+                if (props.checkBoxChange) {
+                  props?.checkBoxChange(false);
+                }
               }}
             >
               {value?.name}
@@ -214,6 +218,9 @@ const MenuPermission = (props: Props) => {
                     buttons: [...buttons],
                   };
                   props.change(d);
+                  if (props.checkBoxChange) {
+                    props?.checkBoxChange(false);
+                  }
                 }}
                 style={{ width: '100%' }}
                 options={(value?.buttons || []).map((i: any) => ({
@@ -300,6 +307,9 @@ const MenuPermission = (props: Props) => {
                         assetAccesses: [...access],
                       };
                       props.change(d);
+                      if (props.checkBoxChange) {
+                        props?.checkBoxChange(false);
+                      }
                     }}
                   >
                     {value?.assetAccesses.map((item: any) => (
@@ -343,6 +353,13 @@ const MenuPermission = (props: Props) => {
                 }
                 props.change({ ...value, check, children });
               }}
+              checkBoxChange={(dt: boolean) => {
+                if (props.checkBoxChange) {
+                  props?.checkBoxChange(false);
+                } else {
+                  setCheckbox(dt);
+                }
+              }}
             />
           </div>
         ))}

+ 10 - 6
src/pages/system/Role/Detail/Permission/Allocate/index.tsx

@@ -98,12 +98,16 @@ const Allocate = (props: Props) => {
       return arr.map((item) => {
         let li: any[] = [];
         if (item?.assetAccesses.length > 0) {
-          li = item.assetAccesses.map((i: any) => {
-            return {
-              ...i,
-              granted: i.supportId === str,
-            };
-          });
+          if (_.map(item.assetAccesses, 'supportId').includes(str)) {
+            li = item.assetAccesses.map((i: any) => {
+              return {
+                ...i,
+                granted: i.supportId === str,
+              };
+            });
+          } else {
+            li = item.assetAccesses;
+          }
         }
         return {
           ...item,

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

@@ -41,7 +41,7 @@ const Save = (props: Props) => {
 
   const getRole = () => service.queryRoleList();
 
-  const getOrg = () => service.queryOrgList();
+  const getOrg = () => service.queryOrgList({ paging: false });
 
   const useAsyncDataSource = (api: any) => (field: Field) => {
     field.loading = true;