Pārlūkot izejas kodu

fix: 产品查看及边缘端映射

Wzyyy98 3 gadi atpakaļ
vecāks
revīzija
271ff5d621

+ 1 - 1
src/components/ProTableCard/CardItems/product.tsx

@@ -229,7 +229,7 @@ export default (props: ProductCardProps) => {
   const intl = useIntl();
   return (
     <TableCard
-      showMask={false}
+      // showMask={false}
       showTool={props.showTool}
       detail={props.detail}
       actions={props.actions}

+ 3 - 1
src/pages/device/Instance/Detail/ChildDevice/SaveChild/index.tsx

@@ -42,6 +42,7 @@ const SaveChild = (props: Props) => {
             metadataId: item.id,
             metadataName: `${item.name}(${item.id})`,
             metadataType: 'property',
+            name: item.name,
           }),
         );
         if (metadata && metadata.length !== 0) {
@@ -126,9 +127,10 @@ const SaveChild = (props: Props) => {
                     metadataType: 'property',
                     metadataName: `${i.name}(${i.id})`,
                     metadataId: i.id,
+                    name: i.name,
                   }));
                   setMetaData(array);
-                  console.log(array);
+                  // console.log(array);
                 }}
               >
                 {productList.map((item: any) => (

+ 6 - 6
src/pages/device/Instance/Detail/EdgeMap/mapTable/index.tsx

@@ -28,7 +28,7 @@ const MapTable = (props: Props) => {
   const { metaData, deviceId, reload, edgeId, productList } = props;
   const [visible, setVisible] = useState<boolean>(false);
   const [channelList, setChannelList] = useState<any>([]);
-  const [deviceData, seyDeviceData] = useState<any>({});
+  const [deviceData, setDeviceData] = useState<any>({});
 
   const remove = async (params: any) => {
     const res = await service.removeMap(edgeId, {
@@ -408,7 +408,7 @@ const MapTable = (props: Props) => {
   };
 
   useEffect(() => {
-    console.log(metaData, 1111111);
+    // console.log(metaData, 1111111);
     service.edgeChannel(edgeId).then((res) => {
       if (res.status === 200) {
         const list = res.result?.[0].map((item: any) => ({
@@ -428,16 +428,16 @@ const MapTable = (props: Props) => {
         <Button
           style={{ marginRight: 10 }}
           onClick={async () => {
-            const value = await props.formRef.validateFields();
+            setVisible(true);
+            const value = await props.formRef?.validateFields();
             if (value) {
               const formData = {
                 ...value,
-                productName: productList.find((item: any) => item.id === value.productId).name,
+                productName: productList.find((item: any) => item.id === value.productId)?.name,
                 parentId: edgeId,
                 // id: deviceId ? deviceId : undefined,
               };
-              seyDeviceData(formData);
-              setVisible(true);
+              setDeviceData(formData);
             }
           }}
         >

+ 3 - 1
src/pages/device/Instance/Detail/EdgeMap/mapTree/index.tsx

@@ -64,11 +64,13 @@ const MapTree = (props: Props) => {
       params.push(...array);
     });
     const filterParms = params.filter((item) => !!item.metadataId);
+    console.log(metaData);
+    console.log('filterParms', filterParms);
     if (deviceId) {
       if (filterParms && filterParms.length !== 0) {
         const res = await service.saveMap(edgeId, {
           deviceId: deviceId,
-          provider: filterParms[0].provider,
+          provider: filterParms[0]?.provider,
           requestList: filterParms,
         });
         if (res.status === 200) {