100011797 3 лет назад
Родитель
Сommit
f7d743a4f8

+ 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>
                       ) : (
                         ''

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

@@ -41,6 +41,7 @@ const Info = observer(() => {
           column={3}
           bordered
           labelStyle={{ width: 150 }}
+          contentStyle={{ minWidth: 'calc(100% / 3 - 150px)' }}
           title={[
             <span key={1}>设备信息</span>,
             <PermissionButton

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

+ 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={() => {