Преглед изворни кода

fix: 数据采集修改通道新增

100011797 пре 3 година
родитељ
комит
bc8de7a25b

+ 6 - 1
src/pages/link/DataCollect/DataGathering/index.tsx

@@ -6,6 +6,7 @@ import { observer } from '@formily/reactive-react';
 import { model } from '@formily/reactive';
 import Device from '../components/Device';
 import Point from '../components/Point';
+import { Empty } from '@/components';
 
 const DataCollectModel = model<{
   id: Partial<string>;
@@ -40,7 +41,11 @@ export default observer(() => {
               }}
             />
           </div>
-          <div className={styles.right}>{obj[DataCollectModel.type]}</div>
+          {DataCollectModel?.id ? (
+            <div className={styles.right}>{obj[DataCollectModel.type]}</div>
+          ) : (
+            <Empty style={{ marginTop: 100 }} />
+          )}
         </div>
       </Card>
     </PageContainer>

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

@@ -17,7 +17,7 @@ interface Props {
 
 export default (props: Props) => {
   const [data, setData] = useState<Partial<ChannelItem>>(props.data);
-  const [loading, setLoading] = useState<boolean>(false);
+  // const [loading, setLoading] = useState<boolean>(false);
 
   useEffect(() => {
     if (props.data?.id) {
@@ -41,8 +41,8 @@ export default (props: Props) => {
     services(field).then(
       action.bound!((resp: any) => {
         field.dataSource = (resp?.result || []).map((item: any) => ({
-          label: item.name,
-          value: item.id,
+          label: item,
+          value: item,
         }));
         field.loading = false;
       }),
@@ -302,11 +302,11 @@ export default (props: Props) => {
 
   const save = async () => {
     const value = await form.submit<ChannelItem>();
-    setLoading(true);
+    // setLoading(true);
     const response: any = props.data?.id
       ? await service.updateChannel(props.data?.id, { ...props.data, ...value })
       : await service.saveChannel({ ...props.data, ...value });
-    setLoading(false);
+    // setLoading(false);
     if (response && response?.status === 200) {
       onlyMessage('操作成功');
       props.reload();
@@ -330,7 +330,7 @@ export default (props: Props) => {
           onClick={() => {
             save();
           }}
-          loading={loading}
+          // loading={loading}
         >
           确定
         </Button>,

+ 4 - 4
src/pages/link/DataCollect/service.ts

@@ -104,10 +104,10 @@ class Service {
       method: 'POST',
       data: params,
     });
-  public querySecurityPolicyList = (params: any) =>
-    request(`/${SystemConst.API_BASE}/edge/operations/local/opcua-security-policies/invoke`, {
-      method: 'POST',
-      data: params,
+  public querySecurityPolicyList = (params?: any) =>
+    request(`/${SystemConst.API_BASE}/data-collect/opc/security-policies`, {
+      method: 'GET',
+      params,
     });
   public scanOpcUAList = (params: any) =>
     request(