yuliang 2 gadi atpakaļ
vecāks
revīzija
3590863c17
2 mainītis faili ar 55 papildinājumiem un 37 dzēšanām
  1. 54 36
      dist/yvan-ext.js
  2. 1 1
      dist/yvan-ext.js.map

+ 54 - 36
dist/yvan-ext.js

@@ -4842,7 +4842,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
 
     var Scope = /** @class */ (function () {
         function Scope(_a) {
-            var model = _a.model, vjson = _a.vjson;
+            var model = _a.model, vjson = _a.vjson, i18n = _a.i18n;
             /**
              * 业务模块的唯一编号
              */
@@ -4862,6 +4862,20 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
             }
             this.originalVjson = _$2.cloneDeep(vjson);
             this.vjson = this.originalVjson; // this.buildVjson()
+            var WMSTranslate = window["WMSTranslate"];
+            if (WMSTranslate) {
+                var i18nPath_1 = this.constructor.name;
+                if (i18n) {
+                    WMSTranslate[i18nPath_1] = i18n;
+                }
+                this.vjson.i18nPath = i18nPath_1;
+                deepTravVJson(this.vjson, function (obj) {
+                    if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
+                        return;
+                    }
+                    obj.i18nPath = i18nPath_1;
+                });
+            }
             var extScope = getScopeOnCreate();
             if (typeof extScope === 'function') {
                 extScope({ vjson: vjson, model: model }, this);
@@ -22412,6 +22426,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
         var ct = Ext.Component.prototype.constructor;
         Ext.Component.override({
             constructor: function (config) {
+                var _a;
                 if (!isDesignMode(this, config)) {
                     var me_1 = this;
                     // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
@@ -22419,43 +22434,16 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
                         process.call(me_1, me_1, config);
                     });
                 }
+                if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
+                    config.i18nPath = config.$initParent.i18nPath;
+                }
                 var WMSTranslate = window["WMSTranslate"];
                 if (WMSTranslate) {
-                    if (config.hasOwnProperty('text')) {
-                        var t = WMSTranslate[config.text];
-                        if (typeof t === "function") {
-                            config.text = t();
-                        }
-                        else if (t) {
-                            config.text = t;
-                        }
-                    }
-                    if (config.hasOwnProperty('title')) {
-                        var t = WMSTranslate[config.title];
-                        if (typeof t === "function") {
-                            config.title = t();
-                        }
-                        else if (t) {
-                            config.title = t;
-                        }
-                    }
-                    if (config.hasOwnProperty('header')) {
-                        var t = WMSTranslate[config.header];
-                        if (typeof t === "function") {
-                            config.header = t();
-                        }
-                        else if (t) {
-                            config.header = t;
-                        }
-                    }
-                    if (config.hasOwnProperty('fieldLabel')) {
-                        var t = WMSTranslate[config.fieldLabel];
-                        if (typeof t === "function") {
-                            config.fieldLabel = t();
-                        }
-                        else if (t) {
-                            config.fieldLabel = t;
-                        }
+                    if (typeof window['viewTranslate'] === 'function') {
+                        window['viewTranslate'](config, config.text, "text");
+                        window['viewTranslate'](config, config.title, "title");
+                        window['viewTranslate'](config, config.header, "header");
+                        window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
                     }
                 }
                 ct.call(this, config);
@@ -22930,6 +22918,28 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
             });
         }
     }
+    function deepTravJson(obj, resolver) {
+        if (_$2.isArray(obj)) {
+            _$2.forEach(obj, function (value, idx) {
+                if (typeof value === 'string') {
+                    resolver(obj, value, idx);
+                }
+                else {
+                    deepTravJson(value, resolver);
+                }
+            });
+        }
+        else if (_$2.isPlainObject(obj)) {
+            _$2.forOwn(obj, function (value, key) {
+                if (typeof value === 'string') {
+                    resolver(obj, value, key);
+                }
+                else {
+                    deepTravJson(value, resolver);
+                }
+            });
+        }
+    }
     /**
      * 根据表达式进入写值
      * express="{query.a}"   写值就是 viewModel.set('query.a', value)
@@ -24377,6 +24387,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
         mergeViewModel: mergeViewModel,
         flatRow: flatRow,
         replaceNA: replaceNA,
+        deepTravJson: deepTravJson,
         tryWriteByExpress: tryWriteByExpress,
         tryWriteObject: tryWriteObject,
         tryVarSimple: tryVarSimple,
@@ -24790,6 +24801,9 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
                             if (typeof window['ajaxProcess'] === 'function') {
                                 window['ajaxProcess'](data);
                             }
+                            if (typeof window['apiTranslate'] === 'function') {
+                                window['apiTranslate'](data, dataSource.url);
+                            }
                             if (typeof grid._transform === 'function') {
                                 // 系统转换函数
                                 grid._transform(data.data);
@@ -31777,6 +31791,9 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
                         errors: resolverRaw.data.errors,
                         headers: resolverRaw.headers
                     };
+                    if (typeof window['apiTranslate'] === 'function') {
+                        window['apiTranslate'](apiResult.rawData, option.url);
+                    }
                     resolver(apiResult);
                 }).catch(function (reason) {
                     reject(reason);
@@ -32736,6 +32753,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx'
     exports.confirm = confirm;
     exports.createAjax = createAjax;
     exports.createUUID = createUUID;
+    exports.deepTravJson = deepTravJson;
     exports.downLoad = downLoad;
     exports.evalFunction = evalFunction;
     exports.extend = extend;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
dist/yvan-ext.js.map