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

fix: Merge branch next into next-hub

jackhoo_98 3 лет назад
Родитель
Сommit
f8b589b00f
23 измененных файлов с 225 добавлено и 156 удалено
  1. 9 4
      src/components/ProTableCard/CardItems/Scene/index.less
  2. 65 47
      src/components/ProTableCard/CardItems/Scene/index.tsx
  3. 2 0
      src/pages/device/Instance/Detail/Config/index.tsx
  4. 1 0
      src/pages/device/Instance/Detail/Diagnose/Message/Dialog/index.tsx
  5. 27 29
      src/pages/device/Instance/Detail/Diagnose/Message/index.tsx
  6. 7 3
      src/pages/device/Instance/Detail/Diagnose/Status/model.ts
  7. 24 14
      src/pages/device/Instance/Detail/Diagnose/index.tsx
  8. 2 0
      src/pages/device/Instance/Detail/Info/index.tsx
  9. 2 0
      src/pages/device/Instance/Detail/Reation/index.tsx
  10. 2 0
      src/pages/device/Instance/Detail/Tags/index.tsx
  11. 4 0
      src/pages/device/Instance/service.ts
  12. 5 1
      src/pages/edge/Device/index.tsx
  13. 1 1
      src/pages/link/Certificate/Detail/index.tsx
  14. 13 3
      src/pages/link/DashBoard/index.tsx
  15. 5 5
      src/pages/notice/Config/Detail/index.tsx
  16. 6 2
      src/pages/rule-engine/Alarm/Configuration/Save/Base/index.tsx
  17. 1 1
      src/pages/rule-engine/Alarm/Configuration/Save/index.tsx
  18. 19 37
      src/pages/rule-engine/Scene/Save/action/notify/VariableDefinitions.tsx
  19. 1 1
      src/pages/rule-engine/Scene/Save/device/addModel.tsx
  20. 1 1
      src/pages/rule-engine/Scene/Save/timer/TimerTrigger/index.tsx
  21. 17 0
      src/pages/system/Role/Detail/Permission/Allocate/MenuPermission.tsx
  22. 10 6
      src/pages/system/Role/Detail/Permission/Allocate/index.tsx
  23. 1 1
      src/pages/system/User/Save/index.tsx

+ 9 - 4
src/components/ProTableCard/CardItems/Scene/index.less

@@ -43,13 +43,13 @@
       margin-top: 5px;
       .card-item-content-action-item-left {
         width: 40px;
-        margin-right: 20px;
+        margin-right: 8px;
         color: #6968be;
         font-weight: bold;
         font-size: 18px;
       }
       .card-item-content-action-item-right {
-        width: calc(100% - 58px);
+        width: calc(100% - 48px);
         padding: 5px;
         border: 1px solid rgba(0, 0, 0, 0.08);
         .card-item-content-action-item-right-item {
@@ -60,6 +60,9 @@
             font-weight: bold;
           }
           .right-item-left {
+            display: flex;
+            flex-direction: column;
+            justify-content: center;
             width: 15%;
             .trigger-conditions {
               color: #fab247;
@@ -73,17 +76,19 @@
             .right-item-right-item {
               display: flex;
               width: 100%;
+              overflow: hidden;
               .trigger-ways {
                 width: 70px;
                 margin-right: 18px;
                 color: rgba(0, 0, 0, 0.85);
                 font-size: 16px;
+                white-space: nowrap;
               }
               .right-item-right-item-contents {
                 display: flex;
                 align-items: center;
-                width: calc(100% - 88px);
-                overflow: hidden;
+                min-width: calc(100% - 88px);
+                max-width: 100%;
                 .right-item-right-item-contents-text {
                   display: flex;
                   .right-item-right-item-contents-item {

+ 65 - 47
src/components/ProTableCard/CardItems/Scene/index.tsx

@@ -272,73 +272,91 @@ const ContentRender = (data: SceneCardProps) => {
             (item: any, index) => {
               return (
                 <div className={styles['card-item-content-action-item']} key={item?.key || index}>
-                  <div className={styles['card-item-content-action-item-left']}>
-                    {type === 'device' ? (index === 0 ? '当' : '否则') : '执行'}
-                  </div>
-                  <div className={styles['card-item-content-action-item-right']}>
+                  {type === 'device' && (
+                    <div className={styles['card-item-content-action-item-left']}>
+                      {index === 0 ? '当' : '否则'}
+                    </div>
+                  )}
+                  <div
+                    style={{ width: type === 'device' ? 'calc(100% - 48px)' : '100%' }}
+                    className={styles['card-item-content-action-item-right']}
+                  >
                     <div className={styles['card-item-content-action-item-right-item']}>
-                      {type === 'device' && (
-                        <div
-                          className={styles['right-item-left']}
-                          style={{
-                            width: Array.isArray(item.then) && item?.then.length ? '15%' : '100%',
-                          }}
-                        >
-                          <MyTooltip
-                            placement={'topLeft'}
-                            title={conditionsRender(data.options?.when || [], index)}
+                      {type === 'device' &&
+                        (item.shakeLimit?.enabled || data.options?.when?.[index]) && (
+                          <div
+                            className={styles['right-item-left']}
+                            style={{
+                              width: Array.isArray(item.then) && item?.then.length ? '15%' : '100%',
+                            }}
                           >
-                            <div className={classNames(styles['trigger-conditions'], 'ellipsis')}>
-                              {conditionsRender(data.options?.when || [], index)}
-                            </div>
-                          </MyTooltip>
-                          {item.shakeLimit?.enabled && (
                             <MyTooltip
-                              title={`(${item.shakeLimit?.time}秒内发生${item.shakeLimit?.threshold}
-                            次以上时执行一次)`}
+                              placement={'topLeft'}
+                              title={conditionsRender(data.options?.when || [], index)}
                             >
-                              <div className={classNames(styles['trigger-shake'], 'ellipsis')}>
-                                ({item.shakeLimit?.time}秒内发生{item.shakeLimit?.threshold}
-                                次以上时执行一次)
+                              <div className={classNames(styles['trigger-conditions'], 'ellipsis')}>
+                                {conditionsRender(data.options?.when || [], index)}
                               </div>
                             </MyTooltip>
-                          )}
-                        </div>
-                      )}
+                            {item.shakeLimit?.enabled && (
+                              <MyTooltip
+                                title={`(${item.shakeLimit?.time}秒内发生${item.shakeLimit?.threshold}
+                            次以上时执行一次)`}
+                              >
+                                <div className={classNames(styles['trigger-shake'], 'ellipsis')}>
+                                  ({item.shakeLimit?.time}秒内发生{item.shakeLimit?.threshold}
+                                  次以上时执行一次)
+                                </div>
+                              </MyTooltip>
+                            )}
+                          </div>
+                        )}
                       {Array.isArray(item.then) && item?.then.length ? (
                         <div
                           className={styles['right-item-right']}
                           style={{ width: type === 'device' ? '85%' : '100%' }}
                         >
-                          {(item?.then || []).map((i: BranchesThen, _index: number) => (
-                            <div key={i?.key || _index} className={styles['right-item-right-item']}>
-                              <div className={styles['trigger-ways']}>
-                                {i ? (i.parallel ? '并行执行' : '串行执行') : ''}
-                              </div>
-                              {Array.isArray(i?.actions) && (
+                          {(item?.then || []).map((i: BranchesThen, _index: number) => {
+                            if (Array.isArray(i?.actions) && i?.actions.length) {
+                              return (
                                 <div
-                                  className={classNames(styles['right-item-right-item-contents'])}
+                                  key={i?.key || _index}
+                                  className={styles['right-item-right-item']}
                                 >
-                                  <div
-                                    className={classNames(
-                                      styles['right-item-right-item-contents-text'],
-                                    )}
-                                  >
-                                    {branchesActionRender(i?.actions)}
-                                  </div>
-                                  {i?.actions.length > 3 && (
+                                  {item?.then?.length > 1 && (
+                                    <div className={styles['trigger-ways']}>
+                                      {i ? (i.parallel ? '并行执行' : '串行执行') : ''}
+                                    </div>
+                                  )}
+                                  {Array.isArray(i?.actions) && (
                                     <div
                                       className={classNames(
-                                        styles['right-item-right-item-contents-extra'],
+                                        styles['right-item-right-item-contents'],
                                       )}
                                     >
-                                      等{i?.actions.length}个执行动作
+                                      <div
+                                        className={classNames(
+                                          styles['right-item-right-item-contents-text'],
+                                        )}
+                                      >
+                                        {branchesActionRender(i?.actions)}
+                                      </div>
+                                      {i?.actions.length > 3 && (
+                                        <div
+                                          className={classNames(
+                                            styles['right-item-right-item-contents-extra'],
+                                          )}
+                                        >
+                                          等{i?.actions.length}个执行动作
+                                        </div>
+                                      )}
                                     </div>
                                   )}
                                 </div>
-                              )}
-                            </div>
-                          ))}
+                              );
+                            }
+                            return null;
+                          })}
                         </div>
                       ) : (
                         ''

+ 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

+ 27 - 29
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;
@@ -44,13 +45,14 @@ export const DiagnoseMessageModel = model<{
 const Message = observer(() => {
   const [subscribeTopic] = useSendWebsocketMessage();
   const DiagnoseFormRef = useRef<{ save: any }>();
+  const diagnoseRef = useRef<any>();
 
   const metadata = JSON.parse(InstanceModel.detail?.metadata || '{}');
 
   const subscribeLog = () => {
     const id = `device-debug-${InstanceModel.detail?.id}`;
     const topic = `/debug/device/${InstanceModel.detail?.id}/trace`;
-    subscribeTopic!(id, topic, {})
+    diagnoseRef.current = subscribeTopic!(id, topic, {})
       ?.pipe(map((res) => res.payload))
       .subscribe((payload: any) => {
         if (payload.type === 'log') {
@@ -62,20 +64,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 +86,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) {
@@ -127,9 +121,13 @@ const Message = observer(() => {
 
   useEffect(() => {
     if (DiagnoseStatusModel.state === 'success') {
-      DiagnoseStatusModel.dialogList = [];
       subscribeLog();
     }
+    return () => {
+      if (diagnoseRef.current) {
+        diagnoseRef.current.unsubscribe();
+      }
+    };
   }, [DiagnoseStatusModel.state]);
 
   const _form = useMemo(

+ 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',

+ 24 - 14
src/pages/device/Instance/Detail/Diagnose/index.tsx

@@ -30,6 +30,29 @@ const Diagnose = observer(() => {
   };
 
   useEffect(() => {
+    DiagnoseStatusModel.list = [];
+    DiagnoseStatusModel.count = 0;
+    DiagnoseStatusModel.percent = 0;
+    DiagnoseStatusModel.status = 'loading';
+    DiagnoseStatusModel.state = 'loading';
+    DiagnoseStatusModel.flag = false;
+    DiagnoseStatusModel.logList = [];
+    DiagnoseStatusModel.dialogList = [];
+    DiagnoseStatusModel.allDialogList = [];
+    DiagnoseStatusModel.message = {
+      up: {
+        text: '上行消息诊断中',
+        status: 'loading',
+      },
+      down: {
+        text: '下行消息诊断中',
+        status: 'loading',
+      },
+    };
+    DiagnoseMessageModel.inputs = [];
+    DiagnoseMessageModel.data = { type: 'function' };
+    DiagnoseMessageModel.input = {};
+    DiagnoseMessageModel._inputs = {};
     setCurrent('status');
     const provider = InstanceModel.detail?.accessProvider;
     if (provider === 'fixed-media' || provider === 'gb28181-2016') {
@@ -44,20 +67,7 @@ const Diagnose = observer(() => {
       setProviderType('network');
     }
     DiagnoseStatusModel.state = 'loading';
-    return () => {
-      DiagnoseStatusModel.list = [];
-      DiagnoseStatusModel.count = 0;
-      DiagnoseStatusModel.percent = 0;
-      DiagnoseStatusModel.status = 'loading';
-      DiagnoseStatusModel.state = 'loading';
-      DiagnoseStatusModel.flag = false;
-      DiagnoseMessageModel.inputs = [];
-      DiagnoseMessageModel.data = { type: 'function' };
-      DiagnoseMessageModel.input = {};
-      DiagnoseMessageModel._inputs = {};
-      DiagnoseStatusModel.logList = [];
-      DiagnoseStatusModel.dialogList = [];
-    };
+    return () => {};
   }, [InstanceModel.active]);
 
   const activeStyle = {

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

@@ -40,6 +40,8 @@ const Info = observer(() => {
           size="small"
           column={3}
           bordered
+          labelStyle={{ width: 150 }}
+          contentStyle={{ minWidth: 'calc(100% / 3 - 150px)' }}
           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>

+ 4 - 0
src/pages/device/Instance/service.ts

@@ -390,6 +390,10 @@ class Service extends BaseService<DeviceInstance> {
     request(`/${SystemConst.API_BASE}/edge/operations/${id}/auth-user-password-reset/invoke`, {
       method: 'POST',
     });
+  public _control = (deviceId: string) =>
+    request(`/${SystemConst.API_BASE}/edge/remote/${deviceId}/url`, {
+      method: 'GET',
+    });
 }
 
 export default Service;

+ 5 - 1
src/pages/edge/Device/index.tsx

@@ -78,7 +78,11 @@ export default () => {
     <PermissionButton
       type={'link'}
       onClick={() => {
-        onlyMessage('暂未开发', 'error');
+        service._control(record.id).then((resp: any) => {
+          if (resp.status === 200) {
+            window.open(resp.result);
+          }
+        });
       }}
       isPermission={permission.setting}
       style={{ padding: 0 }}

+ 1 - 1
src/pages/link/Certificate/Detail/index.tsx

@@ -106,7 +106,7 @@ const Detail = observer(() => {
       },
       'configs.key': {
         title: '证书私钥',
-        'x-component': 'Input.TextArea',
+        'x-component': 'CertificateFile',
         'x-decorator': 'FormItem',
         required: true,
         'x-component-props': {

+ 13 - 3
src/pages/link/DashBoard/index.tsx

@@ -235,6 +235,16 @@ export default () => {
     }
   };
 
+  const networkValueRender = (value: number) => {
+    if (value >= 1024 && value < 1024 * 1024) {
+      return `${Number((value / 1024).toFixed(2))}M`;
+    } else if (value >= 1024 * 1024) {
+      return `${Number((value / 1024 / 1024).toFixed(2))}KB`;
+    } else {
+      return `${value}B`;
+    }
+  };
+
   const handleNetworkOptions = (data: Record<string, any>, xAxis: string[]) => {
     setNetworkOptions({
       xAxis: {
@@ -244,7 +254,7 @@ export default () => {
       },
       tooltip: {
         trigger: 'axis',
-        valueFormatter: (value) => `${value}M`,
+        valueFormatter: (value) => networkValueRender(Number(value)),
       },
       yAxis: {
         type: 'value',
@@ -253,12 +263,12 @@ export default () => {
         left: 50,
         right: 0,
         top: 10,
-        bottom: 10,
+        bottom: 20,
       },
       color: ['#979AFF'],
       series: Object.keys(data).length
         ? Object.keys(data).map((key) => ({
-            data: data[key]._data.map((item: number) => Number((item / 1024 / 1024).toFixed(2))),
+            data: data[key]._data, //.map((item: number) => Number((item / 1024 / 1024).toFixed(2))),
             name: key,
             type: 'line',
             smooth: true,

+ 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: {

+ 6 - 2
src/pages/rule-engine/Alarm/Configuration/Save/Base/index.tsx

@@ -34,7 +34,11 @@ const createImageLabel = (image: string, text: string) => {
   );
 };
 
-export default () => {
+interface Props {
+  tab: string;
+}
+
+export default (props: Props) => {
   const { getOtherPermission } = PermissionButton.usePermission('rule-engine/Alarm/Configuration');
   const history = useHistory();
   const location = useLocation();
@@ -101,7 +105,7 @@ export default () => {
           });
         },
       }),
-    [id],
+    [id, props.tab],
   );
 
   const getSupports = () => service.getTargetTypes();

+ 1 - 1
src/pages/rule-engine/Alarm/Configuration/Save/index.tsx

@@ -27,7 +27,7 @@ export default () => {
             {
               label: `基础配置`,
               key: '1',
-              children: <Base />,
+              children: <Base tab={tab} />,
             },
             {
               label: `关联场景联动`,

+ 19 - 37
src/pages/rule-engine/Scene/Save/action/notify/VariableDefinitions.tsx

@@ -38,12 +38,29 @@ export default forwardRef((props: Props, ref) => {
       const rules: any[] = [];
       rules.push({
         validator: async (_: any, value: any) => {
+          console.log(value, type);
           if ((type === 'file' || type === 'link') && !value) {
             return Promise.reject(new Error('请输入' + item.name));
           } else if (type === 'tag' && !value) {
             return Promise.reject(new Error('请选择' + item.name));
-          } else if (['date', 'org'].includes(type) && (!value || !value.value)) {
-            return Promise.reject(new Error('请选择' + item.name));
+          } else if (['date', 'org'].includes(type)) {
+            if (!value) {
+              return Promise.reject(new Error('请选择' + item.name));
+            } else {
+              if (value?.source === 'upper') {
+                if (!value.upperKey) {
+                  return Promise.reject(new Error('请选择' + item.name));
+                } else {
+                  return Promise.resolve();
+                }
+              } else {
+                if (!value.value) {
+                  return Promise.reject(new Error('请选择' + item.name));
+                } else {
+                  return Promise.resolve();
+                }
+              }
+            }
           } else if (value.source === 'fixed' && !value.value) {
             return Promise.reject(new Error('请输入' + item.name));
           } else if (value.source === 'relation' && !value.value && !value.relation) {
@@ -102,41 +119,6 @@ export default forwardRef((props: Props, ref) => {
         const formData = await form.validateFields().catch(() => {
           resolve(false);
         });
-        // if (
-        //   NotifyModel.notify.notifyType &&
-        //   ['dingTalk', 'weixin'].includes(NotifyModel.notify.notifyType)
-        // ) {
-        //   const arr = NotifyModel.variable.map((item) => {
-        //     return { type: item.expands?.businessType || item?.type, id: item.id };
-        //   });
-        //   const org = arr.find((i) => i.type === 'org')?.id;
-        //   const user = arr.find((i) => i.type === 'user')?.id;
-        //   if (org && user) {
-        //     if (
-        //       (formData[org]?.source && formData[org]?.value) ||
-        //       (!formData[org]?.source && formData[org]) ||
-        //       (formData[user]?.source && (formData[user]?.value || formData[user]?.relation)) ||
-        //       (!formData[user]?.source && formData[user])
-        //     ) {
-        //       resolve(formData);
-        //     } else {
-        //       onlyMessage('收信人和收信部门必填一个', 'error');
-        //       resolve(false);
-        //     }
-        //   } else {
-        //     if (formData) {
-        //       resolve(formData);
-        //     } else {
-        //       resolve(false);
-        //     }
-        //   }
-        // } else {
-        //   if (formData) {
-        //     resolve(formData);
-        //   } else {
-        //     resolve(false);
-        //   }
-        // }
         if (formData) {
           resolve(formData);
         } else {

+ 1 - 1
src/pages/rule-engine/Scene/Save/device/addModel.tsx

@@ -310,7 +310,7 @@ export default observer((props: AddProps) => {
   return (
     <Modal
       visible
-      title="执行规则"
+      title="触发规则"
       width={820}
       keyboard={false}
       maskClosable={false}

+ 1 - 1
src/pages/rule-engine/Scene/Save/timer/TimerTrigger/index.tsx

@@ -57,7 +57,7 @@ export default (props: Props) => {
 
   return (
     <Modal
-      title={'定时触发'}
+      title={'触发规则'}
       maskClosable={false}
       visible
       onCancel={() => {

+ 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;