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

InfoWindowResource/uniqueByNo 修改返回值。

YangZhiJie пре 1 година
родитељ
комит
244ea34d22
1 измењених фајлова са 31 додато и 25 уклоњено
  1. 31 25
      src/sheetWindow/SearchFieldService.js

+ 31 - 25
src/sheetWindow/SearchFieldService.js

@@ -1,3 +1,4 @@
+import { response } from 'express';
 import InfoWindowResource from '../api/dic/InfoWindowResource.js';
 
 /**
@@ -28,33 +29,38 @@ export default {
 
     let column1 = column;
     return new Promise((resolve, reject) => {
-      InfoWindowResource.uniqueByNo(infoWindowNo).then(infoWindowDto => {
-        if (infoWindowDto != null && infoWindowDto.infoGridFields != null) {
-          var infoGridFields = infoWindowDto.infoGridFields;
-          for (var gridIndex = 0; gridIndex < infoGridFields.length; gridIndex++) {
-            var infoGridField = infoGridFields[gridIndex];
-            column1.handsontable.colHeaders.push(infoGridField.name);
-            var columnDef = {
-              data: _self.infoWindowFieldValue(infoGridField.fieldName),
+      InfoWindowResource.uniqueByNo(infoWindowNo).then(response => {
+        if(response.errorCode == 0){
+          const infoWindowDto = response.data;
+          if (infoWindowDto != null && infoWindowDto.infoGridFields != null) {
+            var infoGridFields = infoWindowDto.infoGridFields;
+            for (var gridIndex = 0; gridIndex < infoGridFields.length; gridIndex++) {
+              var infoGridField = infoGridFields[gridIndex];
+              column1.handsontable.colHeaders.push(infoGridField.name);
+              var columnDef = {
+                data: _self.infoWindowFieldValue(infoGridField.fieldName),
+              };
+              column1.handsontable.columns.push(columnDef);
+            }
+  
+            var whereClause = tabGridField.whereClause;
+  
+            column1.handsontable.source = function(modelData, text){
+              return _self.source(infoWindowDto, whereClause, null, modelData, text);
             };
-            column1.handsontable.columns.push(columnDef);
+  
+            _self.source(infoWindowDto, whereClause, null, null, '').then(successData => {
+              column1.handsontable.data = successData;                        
+              resolve();
+            }, errorData => {
+              reject(errorData);
+            });
+  
+          } else {
+            reject();
           }
-
-          var whereClause = tabGridField.whereClause;
-
-          column1.handsontable.source = function(modelData, text){
-            return _self.source(infoWindowDto, whereClause, null, modelData, text);
-          };
-
-          _self.source(infoWindowDto, whereClause, null, null, '').then(successData => {
-            column1.handsontable.data = successData;                        
-            resolve();
-          }, errorData => {
-            reject(errorData);
-          });
-
-        } else {
-          reject();
+        }else{
+          reject(response.errorMessage);
         }
       });
     });