Explorar o código

fix: 修改批量删除

100011797 %!s(int64=3) %!d(string=hai) anos
pai
achega
8c6ac81237

+ 38 - 42
src/pages/link/DataCollect/components/Point/CollectorCard/index.tsx

@@ -127,26 +127,24 @@ const CollectorCard = (props: PointCardProps) => {
                       <Ellipsis title={`${dataValue?.parseData}(${dataValue?.dataType})`} />
                     </div>
                     <div className={'card-item-content-item-header-action'}>
-                      {item.accessModes?.length === 1 &&
-                        item.accessModes.map((i) => i.value)?.includes('write') && (
-                          <EditOutlined
-                            style={{ marginLeft: 15 }}
-                            onClick={(e) => {
-                              e?.stopPropagation();
-                              props.update(item, true);
-                            }}
-                          />
-                        )}
-                      {item.accessModes?.length === 1 &&
-                        item.accessModes.map((i) => i.value)?.includes('read') && (
-                          <RedoOutlined
-                            style={{ marginLeft: 15 }}
-                            onClick={(e) => {
-                              e?.stopPropagation();
-                              read();
-                            }}
-                          />
-                        )}
+                      {item.accessModes && item.accessModes.map((i) => i.value)?.includes('write') && (
+                        <EditOutlined
+                          style={{ marginLeft: 15 }}
+                          onClick={(e) => {
+                            e?.stopPropagation();
+                            props.update(item, true);
+                          }}
+                        />
+                      )}
+                      {item.accessModes && item.accessModes.map((i) => i.value)?.includes('read') && (
+                        <RedoOutlined
+                          style={{ marginLeft: 15 }}
+                          onClick={(e) => {
+                            e?.stopPropagation();
+                            read();
+                          }}
+                        />
+                      )}
                     </div>
                   </div>
                   <div className={'card-item-content-item-text'}>
@@ -168,28 +166,26 @@ const CollectorCard = (props: PointCardProps) => {
                     <span className={'action'} style={{ fontWeight: 600, color: '#000' }}>
                       --
                     </span>
-                    {item.accessModes?.length === 1 &&
-                      item.accessModes.map((i) => i.value)?.includes('write') && (
-                        <EditOutlined
-                          className={'action'}
-                          style={{ marginLeft: 15 }}
-                          onClick={(e) => {
-                            e?.stopPropagation();
-                            props.update(item, true);
-                          }}
-                        />
-                      )}
-                    {item.accessModes?.length === 1 &&
-                      item.accessModes.map((i) => i.value)?.includes('read') && (
-                        <RedoOutlined
-                          style={{ marginLeft: 15 }}
-                          className={'action'}
-                          onClick={(e) => {
-                            e?.stopPropagation();
-                            read();
-                          }}
-                        />
-                      )}
+                    {item.accessModes && item.accessModes.map((i) => i.value)?.includes('write') && (
+                      <EditOutlined
+                        className={'action'}
+                        style={{ marginLeft: 15 }}
+                        onClick={(e) => {
+                          e?.stopPropagation();
+                          props.update(item, true);
+                        }}
+                      />
+                    )}
+                    {item.accessModes && item.accessModes.map((i) => i.value)?.includes('read') && (
+                      <RedoOutlined
+                        style={{ marginLeft: 15 }}
+                        className={'action'}
+                        onClick={(e) => {
+                          e?.stopPropagation();
+                          read();
+                        }}
+                      />
+                    )}
                   </div>
                 </div>
               )}

+ 5 - 5
src/pages/link/DataCollect/components/Point/index.tsx

@@ -165,11 +165,11 @@ const PointCard = observer((props: PointCardProps) => {
           popConfirm={{
             title: '确认删除?',
             onConfirm: async () => {
-              // const resp = await service.batchDeletePoint(PointModel.selectKey);
-              // if(resp.status === 200) {
-              //   handleSearch(param);
-              //   onlyMessage('操作成功!')
-              // }
+              const resp = await service.batchDeletePoint(PointModel.selectKey);
+              if (resp.status === 200) {
+                handleSearch(param);
+                onlyMessage('操作成功!');
+              }
             },
           }}
         >

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

@@ -166,7 +166,7 @@ class Service {
     });
   public batchDeletePoint = (params: any) =>
     request(`/${SystemConst.API_BASE}/data-collect/point/batch/_delete`, {
-      method: 'PUT',
+      method: 'POST',
       data: params,
     });
 }