Explorar el Código

fix: bug

Next wzy
hear hace 3 años
padre
commit
aa0911378d

+ 1 - 1
src/pages/media/Device/Save/index.tsx

@@ -152,7 +152,7 @@ const Save = () => {
                           console.log(key);
                           setAccessType(key);
                           queryProduct(key);
-                          form.resetFields(['id']);
+                          form.resetFields(['id', 'productId']);
                         }}
                         disabled={id}
                         options={[

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

@@ -204,10 +204,10 @@ export default observer((props: Props) => {
       case 'date':
         return (
           <MTimePicker
-            type={props.format}
+            type={props.format === 'yyyy-MM-dd' ? 'time' : 'date'}
             value={moment(
               value ? value : new Date(),
-              props.format === 'HH:mm:ss' ? 'HH:mm:ss' : 'yyyy-MM-dd HH:mm:ss',
+              props.format === 'yyyy-MM-dd' ? 'HH:mm:ss' : 'yyyy-MM-dd HH:mm:ss',
             )}
             onOpen={() => {
               setOpen(false);

+ 4 - 0
src/pages/rule-engine/Scene/Save/action/DeviceOutput/actions/functionCall.tsx

@@ -16,6 +16,8 @@ interface FunctionCallProps {
   value?: any;
   onChange?: (data: any) => void;
   name?: any;
+  thenName: number;
+  branchGroup?: number;
 }
 
 export default (props: FunctionCallProps) => {
@@ -60,6 +62,8 @@ export default (props: FunctionCallProps) => {
         type={type}
         record={record}
         name={props.name}
+        branchGroup={props.branchGroup}
+        thenName={props.thenName}
         format={record?.format}
       />
     );

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

@@ -145,7 +145,12 @@ export default observer((props: Props) => {
                 name={['message', 'inputs']}
                 rules={[{ required: true, message: '请输入功能值' }]}
               >
-                <FunctionCall functionData={functionList} name={props.name} />
+                <FunctionCall
+                  functionData={functionList}
+                  name={props.name}
+                  branchGroup={props.branchGroup}
+                  thenName={props.thenName}
+                />
               </Form.Item>
             )}
           </>

+ 12 - 49
src/pages/rule-engine/Scene/Save/action/DeviceOutput/device/index.tsx

@@ -8,7 +8,7 @@ import { SceneDeviceCard } from '@/components/ProTableCard/CardItems/device';
 import { isNoCommunity } from '@/utils/util';
 import { useIntl } from 'umi';
 import { service as categoryService } from '@/pages/device/Category';
-import { service as deptService } from '@/pages/system/Department';
+// import { service as deptService } from '@/pages/system/Department';
 import DeviceModel from '../model';
 import { observer } from '@formily/reactive-react';
 import { Form, TreeSelect } from 'antd';
@@ -93,6 +93,7 @@ export default observer((props: Props) => {
       dataIndex: 'productId',
       width: 200,
       ellipsis: true,
+      hideInSearch: true,
       valueType: 'select',
       request: async () => {
         const res = await service.getProductList();
@@ -105,11 +106,10 @@ export default observer((props: Props) => {
       filterMultiple: true,
     },
     {
-      title: intl.formatMessage({
-        id: 'pages.device.instance.registrationTime',
-        defaultMessage: '注册时间',
-      }),
-      dataIndex: 'registryTime',
+      title: '创建时间',
+      dataIndex: 'createTime',
+      width: '200px',
+      valueType: 'dateTime',
     },
     {
       title: intl.formatMessage({
@@ -149,6 +149,7 @@ export default observer((props: Props) => {
       title: '产品分类',
       valueType: 'treeSelect',
       hideInTable: true,
+      hideInSearch: true,
       fieldProps: {
         fieldNames: {
           label: 'name',
@@ -165,6 +166,7 @@ export default observer((props: Props) => {
     {
       title: '网关类型',
       dataIndex: 'accessProvider',
+      hideInSearch: true,
       width: 150,
       ellipsis: true,
       valueType: 'select',
@@ -192,6 +194,7 @@ export default observer((props: Props) => {
       dataIndex: 'productId$product-info',
       title: '接入方式',
       valueType: 'select',
+      hideInSearch: true,
       hideInTable: true,
       request: () =>
         service.queryGatewayList().then((resp: any) =>
@@ -206,6 +209,7 @@ export default observer((props: Props) => {
       title: '设备类型',
       valueType: 'select',
       hideInTable: true,
+      hideInSearch: true,
       valueEnum: {
         device: {
           text: '直连设备',
@@ -221,47 +225,6 @@ export default observer((props: Props) => {
         },
       },
     },
-    {
-      dataIndex: 'id$dim-assets',
-      title: '所属组织',
-      valueType: 'treeSelect',
-      hideInTable: true,
-      fieldProps: {
-        fieldNames: {
-          label: 'name',
-          value: 'value',
-        },
-      },
-      request: () =>
-        deptService
-          .queryOrgThree({
-            paging: false,
-          })
-          .then((resp) => {
-            const formatValue = (lists: any[]) => {
-              const _list: any[] = [];
-              lists.forEach((item) => {
-                if (item.children) {
-                  item.children = formatValue(item.children);
-                }
-                _list.push({
-                  ...item,
-                  value: JSON.stringify({
-                    assetType: 'device',
-                    targets: [
-                      {
-                        type: 'org',
-                        id: item.id,
-                      },
-                    ],
-                  }),
-                });
-              });
-              return _list;
-            };
-            return formatValue(resp.result);
-          }),
-    },
   ];
 
   const filterTree = (nodes: any[]) => {
@@ -389,7 +352,7 @@ export default observer((props: Props) => {
                   },
                 }}
                 request={(params) => {
-                  const sorts: any = [{ name: 'createTime', order: 'desc' }];
+                  const sorts: any = [];
 
                   if (oldRowKey) {
                     sorts.push({
@@ -397,7 +360,7 @@ export default observer((props: Props) => {
                       value: oldRowKey,
                     });
                   }
-
+                  sorts.push({ name: 'createTime', order: 'desc' });
                   return service.query({
                     ...params,
                     sorts: sorts,

+ 3 - 3
src/pages/rule-engine/Scene/Save/action/DeviceOutput/product/index.tsx

@@ -168,7 +168,7 @@ export default observer((props: Props) => {
           .queryOrgThree({
             paging: false,
           })
-          .then((resp) => {
+          .then((resp: any) => {
             const formatValue = (list: any[]) => {
               const _list: any[] = [];
               list.forEach((item) => {
@@ -241,7 +241,7 @@ export default observer((props: Props) => {
             },
           }}
           request={(params) => {
-            const sorts: any = [{ name: 'createTime', order: 'desc' }];
+            const sorts: any = [];
 
             if (oldRowKey) {
               sorts.push({
@@ -249,7 +249,7 @@ export default observer((props: Props) => {
                 value: oldRowKey,
               });
             }
-
+            sorts.push({ name: 'createTime', order: 'desc' });
             return service.query({
               ...params,
               sorts: sorts,