XieYongHong 3 лет назад
Родитель
Сommit
b81d5f9484

Разница между файлами не показана из-за своего большого размера
+ 87 - 40
src/pages/device/Instance/Detail/Parsing/index.tsx


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

@@ -177,7 +177,8 @@ const InstanceDetail = observer(() => {
           component: <MetadataMap type="device" />,
         });
       }
-      if (response.result.transport === 'MQTT' || response.result.transport === 'HTTP') {
+      const paring = response.result?.features?.find((item: any) => item.id === 'transparentCodec');
+      if (paring) {
         datalist.push({
           key: 'parsing',
           tab: intl.formatMessage({

+ 1 - 1
src/pages/device/Instance/index.tsx

@@ -285,7 +285,7 @@ const Instance = () => {
       filterMultiple: false,
     },
     {
-      dataIndex: 'categoryId',
+      dataIndex: 'classifiedId',
       title: '产品分类',
       valueType: 'treeSelect',
       hideInTable: true,

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

@@ -336,6 +336,16 @@ class Service extends BaseService<DeviceInstance> {
     request(`/${SystemConst.API_BASE}/protocol/${id}/transport/${transport}`, {
       method: 'GET',
     });
+  //删除设备解析规则
+  public delDeviceCode = (productId: string, deviceId: string) =>
+    request(`/${SystemConst.API_BASE}/device/transparent-codec/${productId}/${deviceId}`, {
+      method: 'DELETE',
+    });
+  //删除产品解析规则
+  public delProductCode = (productId: string) =>
+    request(`/${SystemConst.API_BASE}/device/transparent-codec/${productId}`, {
+      method: 'DELETE',
+    });
 }
 
 export default Service;

+ 2 - 2
src/pages/device/Product/Detail/Access/index.tsx

@@ -35,7 +35,7 @@ const Access = () => {
   const [visible, setVisible] = useState<boolean>(true);
   const [config, setConfig] = useState<any>();
   const [access, setAccess] = useState<any>();
-  const { permission } = usePermissions('link/AccessConfig');
+  const { permission } = usePermissions('device/Product');
   const [dataSource, setDataSource] = useState<any[]>([]);
 
   const MetworkTypeMapping = new Map();
@@ -360,7 +360,7 @@ const Access = () => {
         <div style={{ padding: '100px 0' }}>
           <Empty
             description={
-              permission.add ? (
+              permission.update ? (
                 <span>
                   请先
                   <Button

+ 33 - 84
src/pages/device/Product/Detail/index.tsx

@@ -154,7 +154,29 @@ const ProductDetail = observer(() => {
   };
 
   useEffect(() => {
-    console.log(productModel.current);
+    if (productModel.current?.messageProtocol) {
+      service.getProtocolDetail(productModel.current?.messageProtocol).then((res) => {
+        if (res.status === 200) {
+          const paring = res.result?.transports[0]?.features?.find(
+            (item: any) => item.id === 'transparentCodec',
+          );
+          // console.log(paring)
+          if (paring) {
+            setList([
+              ...initList,
+              {
+                key: 'parsing',
+                tab: intl.formatMessage({
+                  id: 'pages.device.instanceDetail.parsing',
+                  defaultMessage: '数据解析',
+                }),
+                component: <Parsing tag="product" data={productModel.current} />,
+              },
+            ]);
+          }
+        }
+      });
+    }
     if (
       productModel.current?.accessProvider &&
       pList.includes(productModel.current?.accessProvider)
@@ -170,22 +192,6 @@ const ProductDetail = observer(() => {
     } else {
       setList([...initList]);
     }
-    if (
-      productModel.current?.transportProtocol === 'MQTT' ||
-      productModel.current?.transportProtocol === 'HTTP'
-    ) {
-      setList([
-        ...initList,
-        {
-          key: 'parsing',
-          tab: intl.formatMessage({
-            id: 'pages.device.instanceDetail.parsing',
-            defaultMessage: '数据解析',
-          }),
-          component: <Parsing tag="product" data={productModel.current} />,
-        },
-      ]);
-    }
   }, [productModel.current]);
 
   useEffect(() => {
@@ -276,6 +282,7 @@ const ProductDetail = observer(() => {
       extraContent={<Space size={24} />}
       onTabChange={(key) => {
         setMode(key);
+        // console.log(key)
       }}
       tabList={list}
       tabActiveKey={mode}
@@ -373,73 +380,15 @@ const ProductDetail = observer(() => {
         </PermissionButton>,
       ]}
     >
-      <Card className={'product-detail-body'} style={{ minHeight }}>
-        {list.find((k) => k.key === mode)?.component}
-        {/* <Tabs
-          defaultActiveKey={ModelEnum.base}
-          activeKey={mode}
-          onChange={(key) => {
-            setMode(key);
-          }}
-        >
-          <Tabs.TabPane
-            tab={intl.formatMessage({
-              id: 'pages.device.productDetail.base',
-              defaultMessage: '配置信息',
-            })}
-            key={ModelEnum.base}
-          >
-            <BaseInfo />
-          </Tabs.TabPane>
-          <Tabs.TabPane
-            tab={
-              <>
-                {intl.formatMessage({
-                  id: 'pages.device.productDetail.metadata',
-                  defaultMessage: '物模型',
-                })}
-                <Tooltip
-                  placement="right"
-                  title={
-                    <div>
-                      <p>
-                        属性:
-                        <br />
-                        用于描述设备运行时具体信息和状态。
-                        例如,环境监测设备所读取的当前环境温度、智能灯开关状态、电风扇风力等级等。
-                      </p>
-                      功能:
-                      <br />
-                      <p>
-                        指设备可供外部调用的指令或方法。功能调用中可设置输入和输出参数。输入参数是服务执行时的参数,输出参数是服务执行后的结果。
-                        相比于属性,功能可通过一条指令实现更复杂的业务逻辑,例如执行某项特定的任务。
-                        功能分为异步和同步两种调用方式。
-                      </p>
-                      <p> 事件:</p>
-                      <p>
-                        设备运行时,主动上报给云端的信息,一般包含需要被外部感知和处理的信息、告警和故障。事件中可包含多个输出参数。
-                        例如,某项任务完成后的通知信息;设备发生故障时的温度、时间信息;设备告警时的运行状态等。
-                      </p>
-                      <p> 标签:</p>
-                      <p>
-                        统一为设备添加拓展字段,添加后将在设备信息页显示。可用于对设备基本信息描述的补充。
-                      </p>
-                    </div>
-                  }
-                >
-                  <QuestionCircleOutlined style={{ marginLeft: '5px' }} />
-                </Tooltip>
-              </>
-            }
-            key={ModelEnum.metadata}
-          >
-            <Metadata type="product" />
-          </Tabs.TabPane>
-          <Tabs.TabPane tab={'设备接入'} key={ModelEnum.access}>
-            <Access />
-          </Tabs.TabPane>
-        </Tabs> */}
-      </Card>
+      {mode == 'parsing' ? (
+        <>{list.find((k) => k.key === mode)?.component}</>
+      ) : (
+        <>
+          <Card className={'product-detail-body'} style={{ minHeight }}>
+            {list.find((k) => k.key === mode)?.component}
+          </Card>
+        </>
+      )}
     </PageContainer>
   );
 });

+ 1 - 0
src/pages/device/Product/Save/index.tsx

@@ -275,6 +275,7 @@ const Save = (props: Props) => {
             <Form.Item label={'分类'} name={'classifiedId'}>
               <TreeSelect
                 showSearch
+                allowClear
                 onSelect={(_: any, node: any) => {
                   form.setFieldsValue({
                     classifiedName: node.name,

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

@@ -159,6 +159,11 @@ class Service extends BaseService<ProductItem> {
         paging: false,
       },
     });
+  //获取协议详情
+  public getProtocolDetail = (id: string) =>
+    request(`/${SystemConst.API_BASE}/protocol/${id}/detail`, {
+      method: 'POST',
+    });
 }
 
 export default Service;

+ 1 - 1
src/pages/link/AccessConfig/Detail/Cloud/Finish/index.tsx

@@ -122,7 +122,7 @@ const Finish = (props: Props) => {
               </p>
             ) : (
               <p>
-                3、添加设备,为每一台设备设置唯一的IMEI、SN、PSK码(需与CTWingt平台中填写的值一致,若CTWing平台没有对应的设备,将会通
+                3、添加设备,为每一台设备设置唯一的IMEI、SN、PSK码(需与CTWingt平台中填写的值一致,若CTWing平台没有对应的设备,将会通过CTWing平台提供的LWM2M协议自动创建)
               </p>
             )}
           </div>

+ 1 - 1
src/pages/link/Type/Detail/index.tsx

@@ -822,7 +822,7 @@ const Save = observer(() => {
 
   const { getOtherPermission } = usePermissions('link/Type');
   return (
-    <PageContainer className={'page-title-show'} onBack={() => history.back()}>
+    <PageContainer>
       <Card>
         <Form form={form} layout="vertical" style={{ padding: 30 }}>
           <SchemaField

+ 1 - 1
src/pages/link/Type/index.tsx

@@ -330,7 +330,7 @@ const Network = () => {
               </PermissionButton>,
               <PermissionButton
                 type="link"
-                key="other-delete"
+                key="delete"
                 style={{ padding: 0 }}
                 isPermission={networkPermission.delete}
                 disabled={record.state.value === 'enabled'}

+ 58 - 27
src/pages/media/Device/Save/index.tsx

@@ -68,6 +68,12 @@ const Save = () => {
     const formData = await form.validateFields();
     if (formData) {
       const { provider, ...extraFormData } = formData;
+      if (formData.password === oldPassword) {
+        delete extraFormData.password;
+      }
+      if (formData.id === '') {
+        delete extraFormData.id;
+      }
       // if (formData.password === oldPassword) {
       //   delete extraFormData.password;
       // }
@@ -163,30 +169,55 @@ const Save = () => {
                     </Form.Item>
                   </Col>
                   <Col span={16}>
-                    <Form.Item
-                      label={'ID'}
-                      name={'id'}
-                      required
-                      rules={[
-                        { required: true, message: '请输入ID' },
-                        {
-                          pattern: /^[a-zA-Z0-9_\-]+$/,
-                          message: intl.formatMessage({
-                            id: 'pages.form.tip.id',
-                            defaultMessage: '请输入英文或者数字或者-或者_',
-                          }),
-                        },
-                        {
-                          max: 64,
-                          message: intl.formatMessage({
-                            id: 'pages.form.tip.max64',
-                            defaultMessage: '最多输入64个字符',
-                          }),
-                        },
-                      ]}
-                    >
-                      <Input placeholder={'请输入ID'} disabled={!!id} />
-                    </Form.Item>
+                    {accessType === DefaultAccessType ? (
+                      <Form.Item
+                        label={'ID'}
+                        name={'id'}
+                        rules={[
+                          { required: true, message: '请输入ID' },
+                          {
+                            pattern: /^[a-zA-Z0-9_\-]+$/,
+                            message: intl.formatMessage({
+                              id: 'pages.form.tip.id',
+                              defaultMessage: '请输入英文或者数字或者-或者_',
+                            }),
+                          },
+                          {
+                            max: 64,
+                            message: intl.formatMessage({
+                              id: 'pages.form.tip.max64',
+                              defaultMessage: '最多输入64个字符',
+                            }),
+                          },
+                        ]}
+                      >
+                        <Input placeholder={'请输入ID'} disabled={!!id} />
+                      </Form.Item>
+                    ) : (
+                      <Form.Item
+                        label={'ID'}
+                        name={'id'}
+                        rules={[
+                          {
+                            pattern: /^[a-zA-Z0-9_\-]+$/,
+                            message: intl.formatMessage({
+                              id: 'pages.form.tip.id',
+                              defaultMessage: '请输入英文或者数字或者-或者_',
+                            }),
+                          },
+                          {
+                            max: 64,
+                            message: intl.formatMessage({
+                              id: 'pages.form.tip.max64',
+                              defaultMessage: '最多输入64个字符',
+                            }),
+                          },
+                        ]}
+                      >
+                        <Input placeholder={'请输入ID'} disabled={!!id} />
+                      </Form.Item>
+                    )}
+
                     <Form.Item
                       label={'设备名称'}
                       name={'name'}
@@ -351,7 +382,7 @@ const Save = () => {
                   <h1>2.配置说明</h1>
                   <h1>平台端配置</h1>
                   <h2>1、ID</h2>
-                  <div>设备唯一标识,若不填写,系统将自动生成唯一标识</div>
+                  <div>设备唯一标识,请填写设备端配置的设备编号。</div>
                   <h2>2、所属产品</h2>
                   <div>
                     只能选择接入方式为GB/T28281的产品,若当前无对应产品,可点击右侧快速添加按钮,填写产品名称和选择GB/T28181类型的网关完成产品创建
@@ -396,8 +427,8 @@ const Save = () => {
                 <div className={styles.doc} style={{ height: 600 }}>
                   <h1>1.概述</h1>
                   <div>视频设备通过RTSP、RTMP固定地址接入平台分为2步。</div>
-                  <div>1.添加视频设备</div>
-                  <div>2.添加视频下的通道地址。</div>
+                  <div>1添加视频设备</div>
+                  <div>2添加视频下的通道地址。</div>
                   <div>注:当前页面为新增视频设备,新增完成后点击设备的“通道”按钮,添加通道。</div>
                   <h1>2.配置说明</h1>
                   <h2>1、ID</h2>

+ 0 - 1
src/pages/system/Menu/Detail/index.tsx

@@ -47,7 +47,6 @@ export default () => {
 
   return (
     <PageContainer
-      className={'page-title-show'}
       tabList={[
         {
           tab: intl.formatMessage({

+ 26 - 26
src/pages/system/Menu/components/permission.tsx

@@ -3,7 +3,7 @@ import { Checkbox } from 'antd';
 import './permission.less';
 import type { CheckboxChangeEvent } from 'antd/es/checkbox';
 import type { PermissionInfo } from '../typing';
-import { useIntl } from 'umi';
+// import { useIntl } from 'umi';
 
 type PermissionDataType = {
   action: string;
@@ -121,11 +121,11 @@ const ParentNode = (props: ParentNodeType) => {
 };
 
 export default (props: PermissionType) => {
-  const [indeterminate, setIndeterminate] = useState(false);
-  const [checkAll, setCheckAll] = useState(false);
+  // const [indeterminate, setIndeterminate] = useState(false);
+  // const [checkAll, setCheckAll] = useState(false);
   const [nodes, setNodes] = useState<React.ReactNode>([]);
   const checkListRef = useRef<CheckItem[]>([]);
-  const intl = useIntl();
+  // const intl = useIntl();
 
   const onChange = (list: CheckItem[]) => {
     if (props.onChange) {
@@ -143,22 +143,22 @@ export default (props: PermissionType) => {
    * 全选或者全部取消
    * @param e
    */
-  const onChangeAll = (e: CheckboxChangeEvent) => {
-    const _list = props.data.map((item) => {
-      return {
-        ...item,
-        actions: item.actions.map((a) => ({ ...a, checked: e.target.checked })),
-        state: false,
-        checked: e.target.checked,
-      };
-    });
-    setIndeterminate(false);
-    setCheckAll(e.target.checked);
-    // setCheckedList(_list)
-    checkListRef.current = _list;
-    onChange(_list);
-    setNodes(createContentNode(_list));
-  };
+  // const onChangeAll = (e: CheckboxChangeEvent) => {
+  //   const _list = props.data.map((item) => {
+  //     return {
+  //       ...item,
+  //       actions: item.actions.map((a) => ({ ...a, checked: e.target.checked })),
+  //       state: false,
+  //       checked: e.target.checked,
+  //     };
+  //   });
+  //   setIndeterminate(false);
+  //   setCheckAll(e.target.checked);
+  //   // setCheckedList(_list)
+  //   checkListRef.current = _list;
+  //   onChange(_list);
+  //   setNodes(createContentNode(_list));
+  // };
 
   const parentChange = (value: ParentNodeChange) => {
     let indeterminateCount = 0;
@@ -187,10 +187,10 @@ export default (props: PermissionType) => {
       };
     });
     // 如果全部选中,则取消半选状态
-    const isIndeterminate =
-      _checkAll === list.length && _checkAll !== 0 ? false : !!indeterminateCount;
-    setIndeterminate(isIndeterminate);
-    setCheckAll(_checkAll === list.length && _checkAll !== 0);
+    // const isIndeterminate =
+    //   _checkAll === list.length && _checkAll !== 0 ? false : !!indeterminateCount;
+    // setIndeterminate(isIndeterminate);
+    // setCheckAll(_checkAll === list.length && _checkAll !== 0);
     // setCheckedList(list)
     checkListRef.current = list;
     onChange(list);
@@ -258,7 +258,7 @@ export default (props: PermissionType) => {
         <span>权限操作</span>
       </div>
       <div className="permission-content">
-        <div className="permission-items">
+        {/* <div className="permission-items">
           <div className="permission-parent">
             <Checkbox
               onChange={onChangeAll}
@@ -272,7 +272,7 @@ export default (props: PermissionType) => {
               })}
             </Checkbox>
           </div>
-        </div>
+        </div> */}
         {nodes}
       </div>
     </div>

+ 1 - 0
src/pages/system/Platforms/Api/leftTree.tsx

@@ -156,6 +156,7 @@ export default (props: LeftTreeType) => {
       showIcon
       showLine={{ showLeafIcon: false }}
       height={700}
+      style={{ minWidth: 145 }}
       fieldNames={{
         title: 'name',
         key: 'id',

+ 3 - 2
src/pages/system/Platforms/Home/index.tsx

@@ -91,6 +91,7 @@ const Home = () => {
             <Table
               dataSource={data}
               pagination={false}
+              size="small"
               columns={[
                 {
                   title: '示例数据类型',
@@ -117,7 +118,7 @@ const Home = () => {
         <div>
           <h3>服务器验签流程</h3>
           <div>
-            <img src={require('/public/images/apiHome.png')} />
+            <img src={require('/public/images/apiHome.png')} style={{ width: '80%' }} />
           </div>
         </div>
         <div style={{ width: 400 }}>
@@ -126,7 +127,7 @@ const Home = () => {
             <p>使用和签名相同的算法(不需要对响应结果排序)</p>
             <div>
               <MonacoEditor
-                width={400}
+                width={'100%'}
                 height={744}
                 theme="vs"
                 language={'java'}

+ 6 - 2
src/pages/system/Role/Detail/UserManage/BindUser.tsx

@@ -119,10 +119,14 @@ const BindUser = (props: Props) => {
             ],
           });
           return {
-            result: { data: response.result.data },
+            result: {
+              data: response.result.data,
+              pageSize: response.result.pageSize,
+              pageIndex: response.result.pageIndex,
+              total: response.result.total,
+            },
             success: true,
             status: 200,
-            total: response.result.total,
           } as any;
         }}
         columns={columns}

+ 2 - 3
src/pages/system/Role/Detail/index.tsx

@@ -1,7 +1,6 @@
 import { observer } from '@formily/react';
 import { PageContainer } from '@ant-design/pro-layout';
 import { useState } from 'react';
-import { history } from 'umi';
 import UserManage from '@/pages/system/Role/Detail/UserManage';
 import Permission from '@/pages/system/Role/Detail/Permission';
 import { useIntl } from '@@/plugin-locale/localeExports';
@@ -31,8 +30,8 @@ const RoleEdit = observer(() => {
 
   return (
     <PageContainer
-      className={'page-title-show'}
-      onBack={history.goBack}
+      // className={'page-title-show'}
+      // onBack={history.goBack}
       tabList={list}
       onTabChange={setTab}
     >

+ 2 - 3
src/pages/system/User/index.tsx

@@ -9,14 +9,13 @@ import {
   EditOutlined,
   PlayCircleOutlined,
   PlusOutlined,
-  SafetyOutlined,
   StopOutlined,
 } from '@ant-design/icons';
 import { useIntl } from '@@/plugin-locale/localeExports';
 import { useRef, useState } from 'react';
 import Save from './Save';
 import { observer } from '@formily/react';
-import { PermissionButton } from '@/components';
+import { AIcon, PermissionButton } from '@/components';
 import usePermissions from '@/hooks/permission';
 import ResetPassword from '@/pages/system/User/ResetPassword';
 import { useDomFullHeight } from '@/hooks';
@@ -192,7 +191,7 @@ const User = observer(() => {
           }}
           isPermission={userPermission.update}
         >
-          <SafetyOutlined />
+          <AIcon type={'icon-zhongzhimima'} />
         </PermissionButton>,
         <PermissionButton
           type="link"

+ 3 - 1
src/pages/user/Login/index.less

@@ -82,8 +82,10 @@
               margin: auto;
               font-size: 16px;
             }
+            .ant-formily-item-size-large .ant-formily-item-help {
+              text-align: left;
+            }
           }
-
           .icon {
             margin-left: 16px;
             color: rgba(0, 0, 0, 0.2);

+ 1 - 1
src/pages/user/Login/index.tsx

@@ -107,7 +107,7 @@ const Login: React.FC = () => {
       },
       password: {
         type: 'string',
-        'x-validator': { required: true, message: '请输入用户名!' },
+        'x-validator': { required: true, message: '请输入密码!' },
         'x-decorator': 'FormItem',
         'x-component': 'Password',
         'x-component-props': {