Parcourir la source

fix(bugs): fix bug

lind il y a 3 ans
Parent
commit
c96f28bca1
1 fichiers modifiés avec 10 ajouts et 7 suppressions
  1. 10 7
      src/pages/Northbound/DuerOS/Detail/index.tsx

+ 10 - 7
src/pages/Northbound/DuerOS/Detail/index.tsx

@@ -63,8 +63,10 @@ const Save = () => {
 
   const getProduct = () =>
     service.getProduct().then((resp) => {
-      Store.set('product-list', resp.result);
-      return resp.result;
+      const _temp = resp.result.map((item: any) => ({ label: item.name, value: item.id }));
+      Store.set('product-list', _temp);
+      console.log(_temp, 'tmp');
+      return _temp;
     });
 
   const getTypes = () =>
@@ -88,7 +90,8 @@ const Save = () => {
             if (_data) {
               _data.applianceType = _data?.applianceType?.value;
             }
-            form1.setInitialValues(_data);
+            console.log(_data, 'data');
+            form1.setValues(_data);
           });
           onFieldReact('actionMappings.*.layout.action', (field, f) => {
             const productType = field.query('applianceType').value();
@@ -255,10 +258,10 @@ const Save = () => {
             'x-component': 'Select',
             'x-component-props': {
               placeholder: '请选择产品',
-              fieldNames: {
-                label: 'name',
-                value: 'id',
-              },
+              // fieldNames: {
+              //   label: 'name',
+              //   value: 'id',
+              // },
               showSearch: true,
               showArrow: true,
               filterOption: (input: string, option: any) =>