Kaynağa Gözat

feat(merge): merge sc

fix: 阿里云
Lind 3 yıl önce
ebeveyn
işleme
f76dd0ec4a

+ 9 - 0
src/pages/Northbound/AliCloud/Detail/index.tsx

@@ -204,6 +204,9 @@ const Detail = observer(() => {
         'x-component': 'Select',
         'x-component-props': {
           placeholder: '请选择网桥产品',
+          showSearch: true,
+          filterOption: (input: string, option: any) =>
+            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
         },
         'x-decorator-props': {
           tooltip: '物联网平台对应的阿里云产品',
@@ -239,6 +242,9 @@ const Detail = observer(() => {
                   'x-component': 'Select',
                   'x-component-props': {
                     placeholder: '请选择阿里云产品',
+                    showSearch: true,
+                    filterOption: (input: string, option: any) =>
+                      option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
                   },
                   'x-decorator-props': {
                     gridSpan: 12,
@@ -257,6 +263,9 @@ const Detail = observer(() => {
                   },
                   'x-component-props': {
                     placeholder: '请选择平台产品',
+                    showSearch: true,
+                    filterOption: (input: string, option: any) =>
+                      option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0,
                   },
                   'x-reactions': ['{{useAsyncDataSource(queryProductList)}}'],
                 },

+ 5 - 6
src/pages/Northbound/AliCloud/service.ts

@@ -1,7 +1,6 @@
 import BaseService from '@/utils/BaseService';
 import { request } from 'umi';
 import SystemConst from '@/utils/const';
-
 class Service extends BaseService<AliCloudType> {
   // 获取服务地址的下拉列表
   public getRegionsList = (params?: any) =>
@@ -9,7 +8,7 @@ class Service extends BaseService<AliCloudType> {
       method: 'GET',
       params,
     }).then((resp: any) => {
-      return resp.result?.map((item: any) => ({
+      return (resp?.result || []).map((item: any) => ({
         label: item.name,
         value: item.id,
       }));
@@ -20,9 +19,9 @@ class Service extends BaseService<AliCloudType> {
       method: 'POST',
       data,
     }).then((resp: any) => {
-      return resp.result.data?.map((item: any) => ({
-        label: item.productName,
-        value: item.productKey,
+      return (resp?.result?.data || []).map((item: any) => ({
+        label: item?.productName,
+        value: item?.productKey,
       }));
     });
 
@@ -32,7 +31,7 @@ class Service extends BaseService<AliCloudType> {
       method: 'POST',
       data,
     }).then((resp: any) => {
-      return resp.result?.map((item: any) => ({
+      return (resp?.result || []).map((item: any) => ({
         label: item.name,
         value: item.id,
       }));