Przeglądaj źródła

fix: 修改功能没参数必填的情况

100011797 2 lat temu
rodzic
commit
92f018df63

+ 6 - 6
src/components/ProTableCard/CardItems/Scene/index.tsx

@@ -533,11 +533,11 @@ const ActionRender = (data: ActionRenderProps) => {
               >
                 <div className={styles['card-item-content-action-item-right-item']}>
                   {/*触发条件*/}
-                  {type === 'device' && (item.shakeLimit?.enabled || data.options?.when?.[index]) && (
+                  {type === 'device' && (item?.shakeLimit?.enabled || data.options?.when?.[index]) && (
                     <div
                       className={styles['right-item-left']}
                       style={{
-                        maxWidth: Array.isArray(item.then) && item?.then.length ? '15%' : '100%',
+                        maxWidth: Array.isArray(item?.then) && item?.then.length ? '15%' : '100%',
                       }}
                     >
                       <MyTooltip
@@ -548,13 +548,13 @@ const ActionRender = (data: ActionRenderProps) => {
                           {conditionsRender(data.options?.when || [], index)}
                         </div>
                       </MyTooltip>
-                      {item.shakeLimit?.enabled && (
+                      {item?.shakeLimit?.enabled && (
                         <MyTooltip
-                          title={`(${item.shakeLimit?.time}秒内发生${item.shakeLimit?.threshold}
+                          title={`(${item?.shakeLimit?.time}秒内发生${item?.shakeLimit?.threshold}
                             次以上时执行一次)`}
                         >
                           <div className={classNames(styles['trigger-shake'], 'ellipsis')}>
-                            ({item.shakeLimit?.time}秒内发生{item.shakeLimit?.threshold}
+                            ({item?.shakeLimit?.time}秒内发生{item?.shakeLimit?.threshold}
                             次以上时执行一次)
                           </div>
                         </MyTooltip>
@@ -562,7 +562,7 @@ const ActionRender = (data: ActionRenderProps) => {
                     </div>
                   )}
                   {/*执行动作*/}
-                  {Array.isArray(item.then) && item?.then.length ? (
+                  {Array.isArray(item?.then) && item?.then.length ? (
                     <div
                       className={styles['right-item-right']}
                       style={{ maxWidth: type === 'device' ? '85%' : '100%' }}

+ 7 - 4
src/pages/Northbound/DuerOS/Detail/index.tsx

@@ -92,15 +92,17 @@ const Save = () => {
         effects() {
           onFormInit(async (form1) => {
             await getTypes();
-            await getProduct();
-            if (id === ':id') return;
+            if (!id || id === ':id') {
+              await getProduct();
+              return;
+            }
+            await getProduct({ value: id } as any);
             const resp = await service.detail(id);
             /// 单独处理一下applianceType
             const _data = resp.result;
             if (_data) {
               _data.applianceType = _data?.applianceType?.value;
             }
-            console.log(_data, 'data');
             form1.setValues(_data);
           });
           onFieldReact('actionMappings.*.layout.action', (field, f) => {
@@ -561,7 +563,8 @@ const Save = () => {
                             dependencies: ['..messageType'],
                             fulfill: {
                               state: {
-                                visible: '{{["INVOKE_FUNCTION"].includes($deps[0])}}',
+                                visible:
+                                  '{{["INVOKE_FUNCTION"].includes($deps[0]) && $self.value && $self.value?.length}}',
                               },
                             },
                           },

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

@@ -156,7 +156,7 @@ export default observer((props: Props) => {
                 }}
               />
             </Form.Item>
-            {functionId && (
+            {functionId && !!functionList.length && (
               <Form.Item
                 name={['message', 'inputs']}
                 rules={[{ required: true, message: '请输入功能值' }]}

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

@@ -29,8 +29,8 @@ export default (props: ActionsProps) => {
   const firstLockRef = useRef(true);
 
   useEffect(() => {
-    const parallelArr = props.thenOptions.filter((item) => item.parallel);
-    const serialArr = props.thenOptions.filter((item) => !item.parallel);
+    const parallelArr = props.thenOptions.filter((item) => item && item.parallel);
+    const serialArr = props.thenOptions.filter((item) => item && !item.parallel);
     setParallelArray(parallelArr);
     setSerialArray(serialArr);
     const isSerialActions = serialArr.some((item) => {

+ 1 - 1
src/pages/system/Department/Assets/deivce/bind.tsx

@@ -30,7 +30,7 @@ const Bind = observer((props: Props) => {
   const [searchParam, setSearchParam] = useState({});
   const [loading, setLoading] = useState(false);
   const [checkAssets, setCheckAssets] = useState<string[]>(['read']);
-  const [isAll, setIsAll] = useState<boolean>(false);
+  const [isAll, setIsAll] = useState<boolean>(true);
   const bindChecks = useRef(new Map());
 
   const columns: ProColumns<DeviceItem>[] = [