wzyyy 3 年之前
父节点
当前提交
76501ea227

+ 3 - 2
config/proxy.ts

@@ -19,8 +19,9 @@ export default {
       ws: 'ws://120.77.179.54:8844/',
       ws: 'ws://120.77.179.54:8844/',
       // target: 'http://192.168.66.5:8844/',
       // target: 'http://192.168.66.5:8844/',
       // ws: 'ws://192.168.66.5:8844/',
       // ws: 'ws://192.168.66.5:8844/',
-      // ws: 'ws://demo.jetlinks.cn/jetlinks',
-      // target: 'http://demo.jetlinks.cn/jetlinks',
+      //v2环境
+      // ws: 'ws://47.109.52.230:8844',
+      // target: 'http://47.109.52.230:8844',
       changeOrigin: true,
       changeOrigin: true,
       pathRewrite: { '^/api': '' },
       pathRewrite: { '^/api': '' },
     },
     },

+ 4 - 0
src/components/SearchComponent/index.tsx

@@ -555,6 +555,10 @@ const SearchComponent = <T extends Record<string, any>>(props: Props<T>) => {
               item.value = `%${item.value}%`;
               item.value = `%${item.value}%`;
               return item;
               return item;
             }
             }
+            if (item.termType === 'nlike' && item.value && item.value !== '') {
+              item.value = `%${item.value}%`;
+              return item;
+            }
             return item;
             return item;
           });
           });
         return _term;
         return _term;

+ 15 - 0
src/pages/device/Instance/index.tsx

@@ -318,6 +318,21 @@ const Instance = () => {
           .then((resp: any) => resp.result),
           .then((resp: any) => resp.result),
     },
     },
     {
     {
+      title: '网关类型',
+      dataIndex: 'productId$product-info',
+      width: 150,
+      ellipsis: true,
+      valueType: 'select',
+      hideInTable: true,
+      request: () =>
+        service.getProviders().then((resp: any) => {
+          return (resp?.result || []).map((item: any) => ({
+            label: item.name,
+            value: `accessProvider is ${item.id}`,
+          }));
+        }),
+    },
+    {
       dataIndex: 'productId$product-info',
       dataIndex: 'productId$product-info',
       title: '接入方式',
       title: '接入方式',
       valueType: 'select',
       valueType: 'select',

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

@@ -375,6 +375,11 @@ class Service extends BaseService<DeviceInstance> {
       method: 'PUT',
       method: 'PUT',
       data,
       data,
     });
     });
+  //网关类型
+  public getProviders = () =>
+    request(`/${SystemConst.API_BASE}/gateway/device/providers`, {
+      method: 'GET',
+    });
 }
 }
 
 
 export default Service;
 export default Service;

+ 15 - 0
src/pages/device/Product/index.tsx

@@ -259,6 +259,21 @@ const Product = observer(() => {
       ellipsis: true,
       ellipsis: true,
     },
     },
     {
     {
+      title: '网关类型',
+      dataIndex: 'accessProvider',
+      width: 150,
+      ellipsis: true,
+      valueType: 'select',
+      hideInTable: true,
+      request: () =>
+        service.getProviders().then((resp: any) => {
+          return (resp?.result || []).map((item: any) => ({
+            label: item.name,
+            value: item.id,
+          }));
+        }),
+    },
+    {
       title: '接入方式',
       title: '接入方式',
       dataIndex: 'accessId',
       dataIndex: 'accessId',
       width: 150,
       width: 150,

+ 5 - 0
src/pages/device/Product/service.ts

@@ -165,6 +165,11 @@ class Service extends BaseService<ProductItem> {
         ],
         ],
       },
       },
     });
     });
+  //网关类型
+  public getProviders = () =>
+    request(`/${SystemConst.API_BASE}/gateway/device/providers`, {
+      method: 'GET',
+    });
   //获取协议详情
   //获取协议详情
   public getProtocolDetail = (id: string) =>
   public getProtocolDetail = (id: string) =>
     request(`/${SystemConst.API_BASE}/protocol/${id}/detail`, {
     request(`/${SystemConst.API_BASE}/protocol/${id}/detail`, {

+ 6 - 1
src/pages/device/components/Metadata/Base/Edit/index.tsx

@@ -32,7 +32,7 @@ import {
   FileTypeList,
   FileTypeList,
   PropertySource,
   PropertySource,
 } from '@/pages/device/data';
 } from '@/pages/device/data';
-import { useMemo, useState } from 'react';
+import { useEffect, useMemo, useState } from 'react';
 import { productModel } from '@/pages/device/Product';
 import { productModel } from '@/pages/device/Product';
 import { service } from '@/pages/device/components/Metadata';
 import { service } from '@/pages/device/components/Metadata';
 import { Store } from 'jetlinks-store';
 import { Store } from 'jetlinks-store';
@@ -57,11 +57,15 @@ import { onlyMessage } from '@/utils/util';
 
 
 interface Props {
 interface Props {
   type: 'product' | 'device';
   type: 'product' | 'device';
+  tabs?: string;
 }
 }
 
 
 const Edit = observer((props: Props) => {
 const Edit = observer((props: Props) => {
   const intl = useIntl();
   const intl = useIntl();
   const [loading, setLoading] = useState<boolean>(false);
   const [loading, setLoading] = useState<boolean>(false);
+  useEffect(() => {
+    console.log(props.tabs);
+  }, []);
   const form = useMemo(
   const form = useMemo(
     () =>
     () =>
       createForm({
       createForm({
@@ -969,6 +973,7 @@ const Edit = observer((props: Props) => {
                 state: {
                 state: {
                   visible:
                   visible:
                     props.type === 'product' &&
                     props.type === 'product' &&
+                    props.tabs !== 'tags' &&
                     "{{['int','float','double','long','date','string','boolean'].includes($deps[0])}}",
                     "{{['int','float','double','long','date','string','boolean'].includes($deps[0])}}",
                   // value: []
                   // value: []
                 },
                 },

+ 1 - 1
src/pages/device/components/Metadata/Base/index.tsx

@@ -215,7 +215,7 @@ const BaseMetadata = observer((props: Props) => {
         ]}
         ]}
       />
       />
       {MetadataModel.importMetadata && <PropertyImport type={target} />}
       {MetadataModel.importMetadata && <PropertyImport type={target} />}
-      {MetadataModel.edit && <Edit type={target} />}
+      {MetadataModel.edit && <Edit type={target} tabs={type} />}
     </>
     </>
   );
   );
 });
 });

+ 2 - 6
src/pages/link/Type/index.tsx

@@ -164,9 +164,7 @@ const Network = () => {
       render: (text, record) => [
       render: (text, record) => [
         <PermissionButton
         <PermissionButton
           type="link"
           type="link"
-          isPermission={
-            networkPermission.view || networkPermission.update || networkPermission.action
-          }
+          isPermission={networkPermission.view}
           style={{ padding: 0 }}
           style={{ padding: 0 }}
           key="view"
           key="view"
           onClick={() => {
           onClick={() => {
@@ -301,9 +299,7 @@ const Network = () => {
             detail={
             detail={
               <PermissionButton
               <PermissionButton
                 type="link"
                 type="link"
-                isPermission={
-                  networkPermission.view || networkPermission.update || networkPermission.action
-                }
+                isPermission={networkPermission.view}
                 style={{ padding: 0, fontSize: 24, color: '#fff' }}
                 style={{ padding: 0, fontSize: 24, color: '#fff' }}
                 key="view"
                 key="view"
                 onClick={() => {
                 onClick={() => {

+ 2 - 2
src/pages/media/Device/Playback/index.tsx

@@ -117,6 +117,7 @@ export default () => {
         });
         });
         setLoading(false);
         setLoading(false);
         let newList: recordsItemType[] = serviceResp.result;
         let newList: recordsItemType[] = serviceResp.result;
+        // console.log(newList)
 
 
         if (serviceResp.status === 200 && serviceResp.result) {
         if (serviceResp.status === 200 && serviceResp.result) {
           // 判断是否已下载云端视频
           // 判断是否已下载云端视频
@@ -126,7 +127,7 @@ export default () => {
               isServer: serviceResp.result.length
               isServer: serviceResp.result.length
                 ? serviceResp.result.some(
                 ? serviceResp.result.some(
                     (serverFile: any) =>
                     (serverFile: any) =>
-                      item.startTime >= serverFile.streamStartTime &&
+                      item.startTime <= serverFile.streamStartTime &&
                       serverFile.streamEndTime <= item.endTime,
                       serverFile.streamEndTime <= item.endTime,
                   )
                   )
                 : false,
                 : false,
@@ -278,7 +279,6 @@ export default () => {
               itemStyle={{ minWidth: 0, width: '100%' }}
               itemStyle={{ minWidth: 0, width: '100%' }}
               onSelect={(key: string) => {
               onSelect={(key: string) => {
                 setType(key);
                 setType(key);
-                console.log(key);
                 if (key === 'cloud') {
                 if (key === 'cloud') {
                   queryServiceRecords(time!);
                   queryServiceRecords(time!);
                 } else {
                 } else {

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

@@ -56,7 +56,6 @@ export default (props: BuiltInProps) => {
     onChange(source, undefined);
     onChange(source, undefined);
     const data = props.form.getFieldsValue();
     const data = props.form.getFieldsValue();
     const triggerData = await props.triggerRef?.getTriggerData();
     const triggerData = await props.triggerRef?.getTriggerData();
-    console.log(triggerData);
     data.terms = triggerData?.trigger;
     data.terms = triggerData?.trigger;
     const params = props.name - 1 >= 0 ? { action: props.name - 1 } : undefined;
     const params = props.name - 1 >= 0 ? { action: props.name - 1 } : undefined;
     queryBuiltInParams(data, params).then((res: any) => {
     queryBuiltInParams(data, params).then((res: any) => {
@@ -103,10 +102,11 @@ export default (props: BuiltInProps) => {
   }, [props.trigger?.trigger?.device?.productId, source]);
   }, [props.trigger?.trigger?.device?.productId, source]);
 
 
   useEffect(() => {
   useEffect(() => {
+    // console.log(props.value,11111)
     setSource(props.value?.source);
     setSource(props.value?.source);
     setValue(props.value?.value);
     setValue(props.value?.value);
     setUpperKey(props.value?.upperKey);
     setUpperKey(props.value?.upperKey);
-  }, [props.value]);
+  }, []);
 
 
   const itemOnChange = useCallback(
   const itemOnChange = useCallback(
     (_value: any) => {
     (_value: any) => {

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

@@ -384,7 +384,6 @@ export default observer((props: ActionProps) => {
                   triggerRef={props.triggerRef}
                   triggerRef={props.triggerRef}
                 />
                 />
               </Form.Item>
               </Form.Item>
-              l
             </Col>
             </Col>
             {parallelNode}
             {parallelNode}
           </Row>
           </Row>

+ 30 - 0
src/pages/rule-engine/Scene/index.tsx

@@ -6,6 +6,7 @@ import {
   DeleteOutlined,
   DeleteOutlined,
   EditOutlined,
   EditOutlined,
   EyeOutlined,
   EyeOutlined,
+  LikeOutlined,
   PlayCircleOutlined,
   PlayCircleOutlined,
   PlusOutlined,
   PlusOutlined,
   StopOutlined,
   StopOutlined,
@@ -49,6 +50,35 @@ const Scene = () => {
 
 
   const Tools = (record: any, type: 'card' | 'table'): React.ReactNode[] => {
   const Tools = (record: any, type: 'card' | 'table'): React.ReactNode[] => {
     const item = [
     const item = [
+      record.triggerType === 'manual' && (
+        <PermissionButton
+          key="trigger"
+          type="link"
+          style={{ padding: 0 }}
+          isPermission={permission.tigger}
+          tooltip={{
+            title: record.state?.value === 'disabled' ? '未启用,不能手动触发' : '手动触发',
+          }}
+          disabled={record.state?.value === 'disabled'}
+          popConfirm={{
+            disabled: record.state?.value === 'disabled',
+            title: '确认手动触发?',
+            onConfirm: async () => {
+              await service._execute(record.id);
+              onlyMessage(
+                intl.formatMessage({
+                  id: 'pages.data.option.success',
+                  defaultMessage: '操作成功!',
+                }),
+              );
+              actionRef.current?.reload();
+            },
+          }}
+        >
+          <LikeOutlined />
+          {type === 'table' ? '' : '手动触发'}
+        </PermissionButton>
+      ),
       <PermissionButton
       <PermissionButton
         key={'update'}
         key={'update'}
         type={'link'}
         type={'link'}

+ 5 - 0
src/pages/rule-engine/Scene/service.ts

@@ -23,6 +23,11 @@ class Service extends BaseService<SceneItem> {
       method: 'POST',
       method: 'POST',
       data: { terms: [{ column: 'sceneId', value: id }] },
       data: { terms: [{ column: 'sceneId', value: id }] },
     });
     });
+  _execute = (id: string) =>
+    request(`/${SystemConst.API_BASE}/scene/${id}/_execute`, {
+      method: 'POST',
+      data: {},
+    });
 }
 }
 
 
 export default Service;
 export default Service;

+ 24 - 24
src/utils/menu/index.ts

@@ -40,30 +40,30 @@ const extraRouteObj = {
   'device/Firmware': {
   'device/Firmware': {
     children: [{ code: 'Task', name: '升级任务' }],
     children: [{ code: 'Task', name: '升级任务' }],
   },
   },
-  'link/Channel': {
-    children: [
-      {
-        code: 'Opcua',
-        name: 'OPC UA',
-        children: [
-          {
-            code: 'Access',
-            name: '数据点绑定',
-          },
-        ],
-      },
-      {
-        code: 'Modbus',
-        name: 'OPC UA',
-        children: [
-          {
-            code: 'Access',
-            name: '数据点绑定',
-          },
-        ],
-      },
-    ],
-  },
+  // 'link/Channel': {
+  //   children: [
+  //     {
+  //       code: 'Opcua',
+  //       name: 'OPC UA',
+  //       children: [
+  //         {
+  //           code: 'Access',
+  //           name: '数据点绑定',
+  //         },
+  //       ],
+  //     },
+  //     {
+  //       code: 'Modbus',
+  //       name: 'Modbus',
+  //       children: [
+  //         {
+  //           code: 'Access',
+  //           name: '数据点绑定',
+  //         },
+  //       ],
+  //     },
+  //   ],
+  // },
   demo: {
   demo: {
     children: [{ code: 'AMap', name: '地图' }],
     children: [{ code: 'AMap', name: '地图' }],
   },
   },

+ 2 - 2
src/utils/menu/router.ts

@@ -38,8 +38,8 @@ export enum MENUS_CODE {
   'link/Opcua' = 'link/Opcua',
   'link/Opcua' = 'link/Opcua',
   'link/Channel/Opcua' = 'link/Channel/Opcua',
   'link/Channel/Opcua' = 'link/Channel/Opcua',
   'link/Channel/Modbus' = 'link/Channel/Modbus',
   'link/Channel/Modbus' = 'link/Channel/Modbus',
-  'link/Channel/Opcua/Access' = 'link/Channel/Opcua/Access',
-  'link/Channel/Modbus/Access' = 'link/Channel/Modbus/Access',
+  // 'link/Channel/Opcua/Access' = 'link/Channel/Opcua/Access',
+  // 'link/Channel/Modbus/Access' = 'link/Channel/Modbus/Access',
   'link/Protocol/Debug' = 'link/Protocol/Debug',
   'link/Protocol/Debug' = 'link/Protocol/Debug',
   'link/Protocol' = 'link/Protocol',
   'link/Protocol' = 'link/Protocol',
   'link/Type' = 'link/Type',
   'link/Type' = 'link/Type',