hear пре 3 година
родитељ
комит
0d4576c60b

+ 1 - 1
src/components/ProTableCard/index.tsx

@@ -168,7 +168,7 @@ const ProTableCard = <
     if (pageSize !== size) {
       _current = 1;
     }
-    console.log(_current);
+    // console.log(_current);
     setCurrent(_current);
     setPageIndex(_current - 1);
     setPageSize(size);

+ 14 - 4
src/pages/media/Cascade/Channel/index.tsx

@@ -27,6 +27,7 @@ const Channel = () => {
   const { permission } = PermissionButton.usePermission('media/Cascade');
   const { minHeight } = useDomFullHeight(`.cascadeDevice`, 24);
   const [pass, setPass] = useState<boolean>(true);
+  const [isnull, setIsnull] = useState<boolean>(false);
 
   const unbind = async (list: string[]) => {
     const resp = await service.unbindChannel(id, list);
@@ -44,21 +45,28 @@ const Channel = () => {
 
   const content = (record: any) => {
     return (
-      <div>
+      <div style={{ width: 250 }}>
         <Input
           value={data}
           placeholder="请输入国标ID"
           onChange={async (e) => {
             setData(e.target.value);
             if (e.target.value) {
-              const res = await service.validateId(record.cascadeId, [e.target.value]);
-              if (res.status === 200) {
-                setPass(res.result.passed);
+              if (/\s/.test(e.target.value)) {
+                setIsnull(true);
+                setPass(true);
+              } else {
+                setIsnull(false);
+                const res = await service.validateId(record.cascadeId, [e.target.value]);
+                if (res.status === 200) {
+                  setPass(res.result.passed);
+                }
               }
             }
           }}
         />
         {!pass && <div style={{ color: 'red' }}>该国标ID在同一设备下已存在</div>}
+        {isnull && <div style={{ color: 'red' }}>国标ID不能含有空格</div>}
         <Button
           type="primary"
           style={{ marginTop: 10, width: '100%' }}
@@ -129,6 +137,8 @@ const Channel = () => {
                   onClick={() => {
                     setPopvisible('');
                     setData('');
+                    setPass(true);
+                    setIsnull(false);
                   }}
                 />
               </div>

+ 14 - 8
src/pages/rule-engine/Scene/Save/action/Delay/index.tsx

@@ -1,6 +1,7 @@
 import { Modal, Select, InputNumber } from 'antd';
 import { useEffect, useState } from 'react';
 import { observer } from '@formily/react';
+import { onlyMessage } from '@/utils/util';
 
 export enum TimeUnit {
   'seconds' = 'seconds',
@@ -53,7 +54,7 @@ export default observer((props: Props) => {
 
   return (
     <Modal
-      title={'执行动作'}
+      title={'延迟执行'}
       open
       keyboard={false}
       maskClosable={false}
@@ -62,13 +63,18 @@ export default observer((props: Props) => {
         props.cancel();
       }}
       onOk={() => {
-        props.save(
-          {
-            time: value,
-            unit,
-          },
-          { name: `延迟 ${value} ${timeUnitEnum[unit]} 执行` },
-        );
+        console.log(value);
+        if (value || value === 0) {
+          props.save(
+            {
+              time: value,
+              unit,
+            },
+            { name: `${value} ${timeUnitEnum[unit]}后,执行后续动作` },
+          );
+        } else {
+          onlyMessage('请输入时间', 'error');
+        }
       }}
     >
       <InputNumber

+ 1 - 1
src/pages/rule-engine/Scene/Save/action/DeviceOutput/actions/TypeModel.tsx

@@ -65,7 +65,7 @@ export default observer((props: Props) => {
     const _params = {
       branch: props.thenName,
       branchGroup: props.branchGroup,
-      action: props.name,
+      action: props.name - 1,
     };
     queryBuiltInParams(FormModel.current, _params).then((res: any) => {
       if (res.status === 200) {

+ 0 - 1
src/pages/rule-engine/Scene/Save/action/DeviceOutput/device/Tag.tsx

@@ -38,7 +38,6 @@ export default (props: TagModalProps) => {
           value: item.value,
         };
       });
-    console.log();
     if (props.onChange) {
       props.onChange([{ value: newValue, name: '标签' }]);
     }

+ 20 - 11
src/pages/rule-engine/Scene/Save/action/DeviceOutput/device/index.tsx

@@ -14,7 +14,7 @@ import { observer } from '@formily/reactive-react';
 import { Form, TreeSelect } from 'antd';
 import '../index.less';
 import TopCard from './TopCard';
-import { ExclamationCircleOutlined } from '@ant-design/icons';
+// import { ExclamationCircleOutlined } from '@ant-design/icons';
 import { FormModel } from '../../..';
 import { BuiltInParamsHandleTreeData } from '@/pages/rule-engine/Scene/Save/components/BuiltInParams';
 import { queryBuiltInParams } from '@/pages/rule-engine/Scene/Save/action/service';
@@ -27,6 +27,7 @@ interface Props {
   parallel: boolean;
   thenName: number;
   branchGroup?: number;
+  formProductId: any;
 }
 
 export default observer((props: Props) => {
@@ -249,14 +250,19 @@ export default observer((props: Props) => {
     const _params = {
       branch: props.thenName,
       branchGroup: props.branchGroup,
-      action: props.name,
+      action: props.name - 1,
     };
     queryBuiltInParams(FormModel.current, _params).then((res: any) => {
       if (res.status === 200) {
         const _data = BuiltInParamsHandleTreeData(res.result);
         const array = filterTree(_data);
-        console.log('--------', array);
-        setBuiltInList(array);
+        // console.log('--------', array);
+        //判断相同产品才有按变量
+        if (props.formProductId === DeviceModel.productId) {
+          setBuiltInList(array);
+        } else {
+          setBuiltInList([]);
+        }
       }
     });
   };
@@ -272,7 +278,7 @@ export default observer((props: Props) => {
       }
       //标签
       const tag = JSON.parse(DeviceModel.productDetail?.metadata || '{}')?.tags;
-      if (!tag) {
+      if (tag && tag.length !== 0) {
         const array = TypeList.filter((item) => item.value === 'tag');
         _list.push(...array);
       }
@@ -426,7 +432,7 @@ export default observer((props: Props) => {
                 fieldNames={{ label: 'name', value: 'id' }}
                 placeholder={'请选择参数'}
                 onSelect={(value: any, node: any) => {
-                  console.log(value, node);
+                  // console.log(value, node);
                   DeviceModel.deviceId = value;
                   DeviceModel.deviceDetail = node;
                   DeviceModel.selectorValues = [{ value: value, name: node.description }];
@@ -471,13 +477,16 @@ export default observer((props: Props) => {
 
   return (
     <div>
-      <div className="device-title">
-        <ExclamationCircleOutlined className="device-title-icon" />
-        <span>自定义选择当前产品下的任意设备</span>
-      </div>
       <Form form={form} layout={'vertical'}>
         <Form.Item name="selector" label="选择方式" required hidden={list.length === 1}>
-          <TopCard typeList={list} />
+          <TopCard
+            typeList={list}
+            onChange={(value) => {
+              if (value) {
+                form.resetFields(['selectorValues']);
+              }
+            }}
+          />
         </Form.Item>
         {contentRender(selector)}
       </Form>

+ 10 - 1
src/pages/rule-engine/Scene/Save/action/DeviceOutput/index.tsx

@@ -10,6 +10,7 @@ import DeviceModel from './model';
 import { onlyMessage } from '@/utils/util';
 import { ActionsDeviceProps } from '../../../typings';
 import { service as api } from '@/pages/device/Instance/index';
+import { FormModel } from '../..';
 
 export const service = new Service<any>('');
 
@@ -25,6 +26,7 @@ interface Props {
 
 export default observer((props: Props) => {
   const formRef = useRef<any>();
+  const formProductIdRef = useRef<any>('');
 
   DeviceModel.steps = [
     {
@@ -41,6 +43,7 @@ export default observer((props: Props) => {
           parallel={props.parallel}
           branchGroup={props.branchGroup}
           thenName={props.thenName}
+          formProductId={formProductIdRef.current}
         />
       ),
     },
@@ -138,7 +141,7 @@ export default observer((props: Props) => {
       }));
       // console.log(_options.taglist, 'taglist')
     }
-    console.log(DeviceModel.propertiesValue, _options);
+    // console.log(DeviceModel.propertiesValue, _options);
     props.save(item, _options);
     init();
   };
@@ -161,6 +164,12 @@ export default observer((props: Props) => {
     };
   }, [props.value]);
 
+  useEffect(() => {
+    const item = FormModel.current?.branches?.[0].then?.[0]?.actions?.[0].device?.productId;
+    console.log(item);
+    formProductIdRef.current = item;
+  }, []);
+
   return (
     <Modal
       title={'执行动作'}

+ 2 - 2
src/pages/rule-engine/Scene/Save/action/ListItem/Item.tsx

@@ -152,8 +152,8 @@ export default (props: ItemProps) => {
               <img width={18} src={itemNotifyIconMap.get(data?.notify?.notifyType)} />
               微信
             </span>
-            向<span className={'notify-text-highlight'}>{options?.sendTo || ''}</span>
-            <span className={'notify-text-highlight'}>{options?.orgName || ''}</span>
+            向<span className={'notify-text-highlight'}>{options?.orgName || ''}</span>
+            <span className={'notify-text-highlight'}>{options?.sendTo || ''}</span>
             <span className={'notify-text-highlight'}>{options?.tagName || ''}</span>
             发送
             <span className={'notify-text-highlight'}>

+ 89 - 50
src/pages/system/Apply/Save/doc.tsx

@@ -15,6 +15,9 @@ const Doc = (props: Props) => {
 
   const img1 = require('/public/images/apply/1.png');
   const img2 = require('/public/images/apply/2.png');
+  const img3 = require('/public/images/apply/3.png');
+  const img4 = require('/public/images/apply/4.png');
+  const img5 = require('/public/images/apply/5.png');
 
   return (
     <div className="doc">
@@ -36,19 +39,18 @@ const Doc = (props: Props) => {
           <div>1、页面集成</div>
           <div>
             集成其他应用的<span>前端页面</span>至物联网平台中。为实现应用与物联网平台数据互联互通,
-            <span>通常还需要配置API服务</span>。集成后系统顶部将新增对应的应用管理菜单。
+            <span>通常还需要配置API服务</span>。
           </div>
           <div>2、API客户端</div>
           <div>
             <span>物联网平台</span>请求<span>其他应用</span>
-            的接口,以实现将物联网平台集成至其他应用系统。为实现应用与物联网平台数据互联互通,
-            <span>通常还需要配置单点登录</span>。
+            的接口,以实现将物联网平台集成至其他应用系统。如需实现<span>其他应用</span>
+            登录后可以访问<span>物联网平台</span>页面,<span>还需要配置单点登录</span>。
           </div>
           <div>3、API服务</div>
           <div>
-            <span>外部应用</span>请求<span>物联网平台</span>的接口,以调用物联网平台的能力。
-            <span>通常还需要配置页面集成</span>。也可<span>不配置</span>页面集成,
-            <span>自行开发</span>前端页面来调用API服务。
+            <span>外部应用</span>请求<span>物联网平台</span>的接口,实现物联网平台的服务调用能力,
+            <span>通常还需要配置页面集成</span>。
           </div>
           <div>
             配置API服务后,系统将<span>自动创建</span>对应的<span>“第三方应用”用户</span>。用户的
@@ -62,47 +64,6 @@ const Doc = (props: Props) => {
           <div>
             通过<span>第三方平台账号</span>登录到物联网平台。
           </div>
-
-          <h1>3.配置说明</h1>
-          <div>1、页面集成</div>
-          <div>接入地址:</div>
-          <div>访问其他平台的地址,url地址+端口</div>
-
-          <div>2、API客户端</div>
-          <div>接入地址:</div>
-          <div>访问API服务的地址,url地址+端口</div>
-          <div>授权地址:</div>
-          <div>认证授权地址,url地址+端口</div>
-          <div>回调地址:</div>
-          <div>授权之后跳转到具体页面的回调地址,url地址+端口</div>
-          <div>请求头:</div>
-          <div>根据不同应用的调用规范,自定义请求头内容</div>
-
-          <div>3、API服务</div>
-          <div>appid:</div>
-          <div>调用API服务时所需的用户账号</div>
-          <div>secureKey:</div>
-          <div>调用API服务时所需的用户密码</div>
-          <div>回调地址:</div>
-          <div>授权之后跳转到具体页面的回调地址,url地址+端口</div>
-          <div>角色:</div>
-          <div>为API用户分配角色,根据绑定的角色,进行系统菜单赋权</div>
-          <div>组织:</div>
-          <div>为API用户分配所属组织,根据绑定的组织,进行数据隔离</div>
-
-          <div>4、单点登录</div>
-          <div>授权地址:</div>
-          <div>oauth2授权地址,url地址+端口</div>
-          <div>回调地址:</div>
-          <div>授权之后跳转到具体页面的回调地址,url地址+端口</div>
-          <div>appid:</div>
-          <div>应用唯一标识</div>
-          <div>appkey:</div>
-          <div>与应用匹配的唯一秘钥</div>
-          <div>自动创建用户:</div>
-          <div>
-            开启后,第三方用户第一次授权登录系统时,无需进入授权绑定页面。系统默认创建一个新用户与之绑定。
-          </div>
         </>
       )}
       {type === 'internal-integrated' && (
@@ -130,9 +91,87 @@ const Doc = (props: Props) => {
           </div>
         </>
       )}
-      {type === 'dingtalk-ent-app' && <>3</>}
-      {type === 'wechat-webapp' && <>4</>}
-      {type === 'third-party' && <>5</>}
+      {type === 'dingtalk-ent-app' && (
+        <>
+          <div className={'url'}>
+            钉钉开放平台:
+            <a href="https://open-dev.dingtalk.com" target="_blank" rel="noopener noreferrer">
+              https://open-dev.dingtalk.com
+            </a>
+          </div>
+          <h1>1.概述</h1>
+          <div>
+            钉钉企业内部应用适用于通过钉钉登录<span>物联网平台</span>
+          </div>
+          <div className="image">
+            <Image width="100%" src={img4} />
+          </div>
+          <h1>2.接入方式说明</h1>
+          <div>1、单点登录</div>
+          <div>通过钉钉账号登录到物联网平台。</div>
+        </>
+      )}
+      {type === 'wechat-webapp' && (
+        <>
+          <div className={'url'}>
+            微信开放平台:
+            <a href="https://open.weixin.qq.com" target="_blank" rel="noopener noreferrer">
+              https://open.weixin.qq.com
+            </a>
+          </div>
+          <h1>1.概述</h1>
+          <div>
+            微信网站应用适用于通过微信授权登录<span>物联网平台</span>
+          </div>
+          <div className="image">
+            <Image width="100%" src={img3} />
+          </div>
+          <h1>2.接入方式说明</h1>
+          <div>1、单点登录</div>
+          <div>通过微信账号登录到物联网平台。</div>
+        </>
+      )}
+      {type === 'third-party' && (
+        <>
+          <h1>1. 概述</h1>
+          <div>
+            第三方应用适用于<span>第三方应用</span>与<span>物联网平台相互集成</span>
+            。例如将公司业务管理系统集成至物联网平台,或者将物联网平台集成至业务管理系统。以实现多处访问、集中管控的业务场景。
+          </div>
+          <div className="image">
+            <Image width="100%" src={img5} />
+          </div>
+          <h1>2.接入方式说明</h1>
+          <div>1、页面集成</div>
+          <div>
+            集成其他应用的<span>前端页面</span>至物联网平台中。为实现应用与物联网平台数据互联互通,
+            <span>还需要配置API服务</span>。
+          </div>
+          <div>2、API客户端</div>
+          <div>
+            <span>物联网平台</span>请求<span>第三方应用</span>
+            的接口,以实现将物联网平台集成至其他应用。如需实现<span>第三方应用</span>登录后可以访问
+            <span>物联网平台</span>页面,<span>还需要配置单点登录</span>。
+          </div>
+          <div>3、API服务</div>
+          <div>
+            <span>第三方应用</span>通过API服务配置,请求物联网平台接口,实现<span>物联网平台</span>
+            的服务调用能力,<span>通常还需要配置页面集成</span>。
+          </div>
+          <div>
+            配置API服务后,系统将<span>自动创建</span>对应的<span>“第三方应用”用户</span>。用户的
+            <span>账号/密码</span>分别对应appid/secureKey。
+          </div>
+          <div>
+            第三方用户<span>可调用的API服务</span>在其应用管理卡片的<span>其他-{'>'}赋权</span>
+            页面,进行<span>自定义配置</span>。
+          </div>
+          <div>4、单点登录</div>
+          <div>
+            通过<span>第三方平台账号</span>登录到物联网平台。
+          </div>
+        </>
+      )}
     </div>
   );
 };

+ 29 - 7
src/pages/system/Apply/Save/index.tsx

@@ -46,7 +46,6 @@ const Save = () => {
   const [detail, setDetail] = useState<any>({});
   const accessRef = useRef<any>([]);
   const [type, setType] = useState<any>('');
-  const typeRef = useRef<any>('');
 
   const provider1 = require('/public/images/apply/provider1.png');
   const provider2 = require('/public/images/apply/provider2.png');
@@ -265,10 +264,6 @@ const Save = () => {
     [id],
   );
 
-  useEffect(() => {
-    console.log('_________', typeRef.current);
-  }, [typeRef.current]);
-
   const handleSave = async () => {
     const data: any = await form.submit();
     const list = integrationModesList.map((item) => item.value);
@@ -346,6 +341,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: 'oauth2授权地址',
       },
       required: true,
       'x-component': 'Input',
@@ -369,6 +365,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '授权完成后跳转到具体页面的回调地址',
       },
       // required: true,
       'x-component': 'Input',
@@ -392,6 +389,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用的唯一标识',
       },
       required: true,
       'x-component': 'Input',
@@ -415,6 +413,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用的唯一标识的秘钥',
       },
       required: true,
       'x-component': 'Input',
@@ -440,6 +439,8 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip:
+          '开启后,第三方用户第一次授权登录系统时,无需进入授权绑定页面。系统默认创建一个新用户与之绑定。',
       },
       'x-component': 'Switch',
     },
@@ -454,6 +455,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用的唯一标识',
       },
       'x-reactions': {
         dependencies: ['provider'],
@@ -477,6 +479,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用的唯一标识',
       },
       required: true,
       'x-component': 'Input',
@@ -510,6 +513,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用的唯一标识的秘钥',
       },
       required: true,
       'x-component': 'Input',
@@ -537,6 +541,8 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip:
+          '开启后,第三方用户第一次授权登录系统时,无需进入授权绑定页面。系统默认创建一个新用户与之绑定。',
       },
       'x-component': 'Switch',
     },
@@ -567,6 +573,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '限制应用程序对用户账号的访问',
       },
       'x-component': 'Input',
       'x-component-props': {
@@ -592,6 +599,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用唯一标识',
       },
       'x-component': 'Input',
       'x-component-props': {
@@ -617,6 +625,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '应用唯一标识的秘钥',
       },
       'x-component': 'Input',
       'x-component-props': {
@@ -642,6 +651,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: 'oauth2授权地址',
       },
       'x-component': 'Input',
       'x-component-props': {
@@ -657,6 +667,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '设置token令牌的地址',
       },
       'x-component': 'Input',
       'x-component-props': {
@@ -799,6 +810,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '认证授权地址',
       },
       required: true,
       'x-component': 'Input',
@@ -814,6 +826,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '授权完成后跳转到具体页面的回调地址',
       },
       // required: true,
       'x-component': 'Input',
@@ -829,6 +842,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '第三方应用唯一标识',
       },
       required: true,
       'x-component': 'Input',
@@ -854,6 +868,7 @@ const Save = () => {
         gridSpan: 2,
         layout: 'vertical',
         labelAlign: 'left',
+        tooltip: '第三方应用唯一标识的密钥',
       },
       required: true,
       'x-component': 'Input',
@@ -1004,6 +1019,7 @@ const Save = () => {
                     gridSpan: 2,
                     layout: 'vertical',
                     labelAlign: 'left',
+                    tooltip: '认证授权地址',
                   },
                   required: true,
                   'x-component': 'Input',
@@ -1050,6 +1066,7 @@ const Save = () => {
                     gridSpan: 2,
                     layout: 'vertical',
                     labelAlign: 'left',
+                    tooltip: '应用唯一标识',
                   },
                   required: true,
                   'x-component': 'Input',
@@ -1062,6 +1079,7 @@ const Save = () => {
                     gridSpan: 2,
                     layout: 'vertical',
                     labelAlign: 'left',
+                    tooltip: '应用唯一标识的秘钥',
                   },
                   required: true,
                   'x-component': 'Input',
@@ -1169,6 +1187,7 @@ const Save = () => {
                   gridSpan: 2,
                   layout: 'vertical',
                   labelAlign: 'left',
+                  tooltip: '第三方应用唯一标识',
                 },
                 required: true,
                 'x-component': 'Input',
@@ -1193,6 +1212,7 @@ const Save = () => {
                   gridSpan: 2,
                   layout: 'vertical',
                   labelAlign: 'left',
+                  tooltip: '第三方应用唯一标识匹配的秘钥',
                 },
                 required: true,
                 'x-component': 'Input',
@@ -1218,6 +1238,7 @@ const Save = () => {
                   gridSpan: 2,
                   layout: 'vertical',
                   labelAlign: 'left',
+                  tooltip: '授权知道后跳转到具体页面的回调地址',
                 },
                 // required: true,
                 'x-component': 'Input',
@@ -1250,7 +1271,7 @@ const Save = () => {
                   gridSpan: 2,
                   layout: 'vertical',
                   labelAlign: 'left',
-                  tooltip: '为API用户分配角色',
+                  tooltip: '为第三方应用用户分配角色,根据绑定的角色,进行系统菜单赋权',
                   addonAfter: (
                     <PermissionButton
                       type="link"
@@ -1298,7 +1319,7 @@ const Save = () => {
                   gridSpan: 2,
                   layout: 'vertical',
                   labelAlign: 'left',
-                  tooltip: '为API用户分组所属组织',
+                  tooltip: '为第三方应用用户分配所属组织,根据绑定的组织,进行数据隔离',
                   addonAfter: (
                     <PermissionButton
                       type="link"
@@ -1452,6 +1473,7 @@ const Save = () => {
                   gridSpan: 2,
                   layout: 'vertical',
                   labelAlign: 'left',
+                  tooltip: '根据不同应用的调用规范,自定义请求头内容',
                 },
                 items: {
                   type: 'object',