Forráskód Böngészése

fix: 修改数据采集

100011797 3 éve
szülő
commit
bb010061c5

+ 18 - 0
src/pages/iot-card/CardManagement/Detail/index.less

@@ -1,3 +1,21 @@
+.iot-card-detail-total {
+  display: flex;
+  gap: 24px;
+
+  .iot-card-detail-total-left {
+    display: flex;
+    flex-grow: 1;
+    min-width: 0;
+  }
+
+  .iot-card-detail-total-right {
+    display: flex;
+    flex-basis: 600px;
+    padding: 24px;
+    background-color: #fff;
+  }
+}
+
 .iot-card-detail-total-item {
   padding: 20px;
   color: rgba(0, 0, 0, 0.64);

+ 74 - 66
src/pages/iot-card/CardManagement/Detail/index.tsx

@@ -360,8 +360,8 @@ const CardDetail = () => {
           </Card>
         </Col>
         <Col span={24}>
-          <Row gutter={24}>
-            <Col flex={'auto'}>
+          <div className={'iot-card-detail-total'}>
+            <div className={'iot-card-detail-total-left'}>
               <DashBoard
                 ref={echartsRef}
                 title={'流量统计'}
@@ -377,70 +377,78 @@ const CardDetail = () => {
                 height={500}
                 onParamsChange={getEcharts}
               />
-            </Col>
-            <Col flex={'550px'}>
-              <Card>
-                <div
-                  style={{
-                    marginBottom: 20,
-                    color: '#323130',
-                    fontSize: 16,
-                    fontWeight: 600,
-                  }}
-                >
-                  数据统计
-                </div>
-                <div className={'iot-card-detail-total-item'}>
-                  <Row>
-                    <Col flex={'auto'}>
-                      <div className={'detail-total-item-name'}>昨日流量消耗</div>
-                      <div className={'detail-total-item-content'}>
-                        <span className={'detail-total-item-value'}>{dayTotal}</span>
-                        <span>M</span>
-                      </div>
-                    </Col>
-                    <Col flex={'240px'}>
-                      <div style={{ height: 83 }}>
-                        <Echarts options={dayOptions} />
-                      </div>
-                    </Col>
-                  </Row>
-                </div>
-                <div className={'iot-card-detail-total-item'}>
-                  <Row>
-                    <Col flex={'auto'}>
-                      <div className={'detail-total-item-name'}>当月流量消耗</div>
-                      <div className={'detail-total-item-content'}>
-                        <span className={'detail-total-item-value'}>{monthTotal}</span>
-                        <span>M</span>
-                      </div>
-                    </Col>
-                    <Col flex={'240px'}>
-                      <div style={{ height: 83 }}>
-                        <Echarts options={monthOptions} />
-                      </div>
-                    </Col>
-                  </Row>
-                </div>
-                <div className={'iot-card-detail-total-item'}>
-                  <Row>
-                    <Col flex={'auto'}>
-                      <div className={'detail-total-item-name'}>本年流量消耗</div>
-                      <div className={'detail-total-item-content'}>
-                        <span className={'detail-total-item-value'}>{yearTotal}</span>
-                        <span>M</span>
-                      </div>
-                    </Col>
-                    <Col flex={'240px'}>
-                      <div style={{ height: 84 }}>
-                        <Echarts options={yearOptions} />
-                      </div>
-                    </Col>
-                  </Row>
-                </div>
-              </Card>
-            </Col>
-          </Row>
+            </div>
+            <div className={'iot-card-detail-total-right'}>
+              <div
+                style={{
+                  marginBottom: 20,
+                  color: '#323130',
+                  fontSize: 16,
+                  fontWeight: 600,
+                }}
+              >
+                数据统计
+              </div>
+              <div className={'iot-card-detail-total-item'}>
+                <Row>
+                  <Col flex={'auto'}>
+                    <div className={'detail-total-item-name'}>昨日流量消耗</div>
+                    <div className={'detail-total-item-content'}>
+                      <span className={'detail-total-item-value'}>{dayTotal}</span>
+                      <span>M</span>
+                    </div>
+                  </Col>
+                  <Col flex={'240px'}>
+                    <div style={{ height: 83 }}>
+                      <Echarts options={dayOptions} />
+                    </div>
+                  </Col>
+                </Row>
+              </div>
+              <div className={'iot-card-detail-total-item'}>
+                <Row>
+                  <Col flex={'auto'}>
+                    <div className={'detail-total-item-name'}>当月流量消耗</div>
+                    <div className={'detail-total-item-content'}>
+                      <span className={'detail-total-item-value'}>{monthTotal}</span>
+                      <span>M</span>
+                    </div>
+                  </Col>
+                  <Col flex={'240px'}>
+                    <div style={{ height: 83 }}>
+                      <Echarts options={monthOptions} />
+                    </div>
+                  </Col>
+                </Row>
+              </div>
+              <div className={'iot-card-detail-total-item'}>
+                <Row>
+                  <Col flex={'auto'}>
+                    <div className={'detail-total-item-name'}>本年流量消耗</div>
+                    <div className={'detail-total-item-content'}>
+                      <span className={'detail-total-item-value'}>{yearTotal}</span>
+                      <span>M</span>
+                    </div>
+                  </Col>
+                  <Col flex={'240px'}>
+                    <div style={{ height: 84 }}>
+                      <Echarts options={yearOptions} />
+                    </div>
+                  </Col>
+                </Row>
+              </div>
+            </div>
+          </div>
+          {/*<Row gutter={24}>*/}
+          {/*  <Col flex={'auto'}>*/}
+          {/*    */}
+          {/*  </Col>*/}
+          {/*  <Col flex={'550px'}>*/}
+          {/*    <Card>*/}
+          {/*      */}
+          {/*    </Card>*/}
+          {/*  </Col>*/}
+          {/*</Row>*/}
         </Col>
       </Row>
     </PageContainer>

+ 5 - 3
src/pages/iot-card/CardManagement/index.tsx

@@ -49,9 +49,7 @@ const CardManagementNode = () => {
   const intl = useIntl();
   const history = useHistory();
   const location = useLocation();
-  const deleteItems = useRef<any>();
-
-  deleteItems.current = new Map();
+  const deleteItems = useRef<any>(new Map());
 
   useEffect(() => {
     const { state } = location;
@@ -467,6 +465,7 @@ const CardManagementNode = () => {
             popConfirm={{
               title: '确认删除吗?',
               onConfirm: async () => {
+                console.log(deleteItems.current.values());
                 service.removeCards([...deleteItems.current.values()]).then((res) => {
                   if (res.status === 200) {
                     setBindKeys([]);
@@ -570,6 +569,7 @@ const CardManagementNode = () => {
             <a
               onClick={() => {
                 setBindKeys([]);
+                deleteItems.current.clear();
               }}
             >
               取消选择
@@ -588,7 +588,9 @@ const CardManagementNode = () => {
             } else {
               deleteItems.current.delete(record.id);
             }
+            console.log(deleteItems.current.values());
             setBindKeys([...deleteItems.current.keys()]);
+            console.log(deleteItems.current.values());
           },
           onSelectAll: (selected, _, changeRows) => {
             if (selected) {

+ 32 - 20
src/pages/link/DataCollect/components/Channel/Save/index.tsx

@@ -35,14 +35,15 @@ export default (props: Props) => {
   });
 
   const getSecurityPolicyList = () => service.querySecurityPolicyList({});
+  const getAuthTypeList = () => service.queryAuthTypeList({});
 
   const useAsyncDataSource = (services: (arg0: Field) => Promise<any>) => (field: Field) => {
     field.loading = true;
     services(field).then(
       action.bound!((resp: any) => {
         field.dataSource = (resp?.result || []).map((item: any) => ({
-          label: item,
-          value: item,
+          label: item?.text || item,
+          value: item?.value || item,
         }));
         field.loading = false;
       }),
@@ -265,7 +266,7 @@ export default (props: Props) => {
               },
             ],
             'x-reactions': [
-              '{{useAsyncDataSource(getSecurityPolicyList)}}',
+              '{{useAsyncDataSource(getAuthTypeList)}}',
               {
                 dependencies: ['..provider'],
                 fulfill: {
@@ -286,17 +287,21 @@ export default (props: Props) => {
             'x-component-props': {
               placeholder: '请输入用户名',
             },
-            // 'x-validator': [
-            //   {
-            //     required: true,
-            //     message: '请输入用户名',
-            //   },
-            // ],
+            'x-validator': [
+              {
+                required: true,
+                message: '请输入用户名',
+              },
+              {
+                max: 64,
+                message: '最多可输入64个字符',
+              },
+            ],
             'x-reactions': {
-              dependencies: ['..provider'],
+              dependencies: ['.authType'],
               fulfill: {
                 state: {
-                  visible: '{{$deps[0]==="OPC_UA"}}',
+                  visible: '{{$deps[0]==="username"}}',
                 },
               },
             },
@@ -311,17 +316,21 @@ export default (props: Props) => {
             'x-component-props': {
               placeholder: '请输入密码',
             },
-            // 'x-validator': [
-            //   {
-            //     required: true,
-            //     message: '请输入密码',
-            //   },
-            // ],
+            'x-validator': [
+              {
+                required: true,
+                message: '请输入密码',
+              },
+              {
+                max: 64,
+                message: '最多可输入64个字符',
+              },
+            ],
             'x-reactions': {
-              dependencies: ['..provider'],
+              dependencies: ['.authType'],
               fulfill: {
                 state: {
-                  visible: '{{$deps[0]==="OPC_UA"}}',
+                  visible: '{{$deps[0]==="username"}}',
                 },
               },
             },
@@ -382,7 +391,10 @@ export default (props: Props) => {
       ]}
     >
       <Form form={form} layout="vertical">
-        <SchemaField schema={schema} scope={{ useAsyncDataSource, getSecurityPolicyList }} />
+        <SchemaField
+          schema={schema}
+          scope={{ useAsyncDataSource, getSecurityPolicyList, getAuthTypeList }}
+        />
       </Form>
     </Modal>
   );

+ 7 - 0
src/pages/link/DataCollect/service.ts

@@ -109,6 +109,13 @@ class Service {
       method: 'GET',
       params,
     });
+
+  public queryAuthTypeList = (params?: any) =>
+    request(`/${SystemConst.API_BASE}/data-collect/opc/auth-types`, {
+      method: 'GET',
+      params,
+    });
+
   public scanOpcUAList = (params: any) =>
     request(
       `/${SystemConst.API_BASE}/data-collect/opc/channel/${params.id}/nodes?nodeId=${