lizw před 3 roky
rodič
revize
699fcd5f65
2 změnil soubory, kde provedl 66 přidání a 4 odebrání
  1. 65 3
      dist/yvan-ext.js
  2. 1 1
      dist/yvan-ext.js.map

+ 65 - 3
dist/yvan-ext.js

@@ -8490,6 +8490,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
              * onload 运行完成之后才会设置本标记为 true
              */
             this.isLoadFinish = false;
+            this._isLoading = false;
             this.model = model;
             this.originalVjson = _.cloneDeep(vjson);
             this.vjson = this.originalVjson; // this.buildVjson()
@@ -8542,8 +8543,12 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
         Scope.prototype.setLoading = function (value) {
             var _a;
             var scope = this;
+            this._isLoading = value;
             (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
         };
+        Scope.prototype.getLoading = function () {
+            return this._isLoading;
+        };
         /**
          * 以对话框模式打开当前模块
          * @param sender 发送者(按钮或Scope对象)
@@ -9736,6 +9741,27 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
     var SystemEventFu = /** @class */ (function () {
         function SystemEventFu() {
         }
+        SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
+            return function (sender, config) {
+                if (!config.listeners) {
+                    config.listeners = {};
+                }
+                config.listeners.afterrender = function (sender) {
+                    var scope = lookupScope(sender);
+                    $(sender.el.dom).on('keydown', function (e) {
+                        var xtype = Ext.fly(e.target).component.xtype;
+                        if (xtype === 'textfield' && e.keyCode === 13) {
+                            Ext.defer(function () {
+                                raiseClick(scope.refs[btnReferenceName]);
+                            });
+                            e.preventDefault();
+                            e.stopPropagation();
+                            return false;
+                        }
+                    });
+                };
+            };
+        };
         SystemEventFu.prototype.confirm = function (text, fn) {
             return function (sender) {
                 var scope = lookupScope(sender);
@@ -9954,6 +9980,19 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
         };
         __decorate([
             Lib({
+                title: '按下回车键之后默认是否按下某个按钮',
+                author: '罗一帆',
+                createAt: '2021-07-02',
+                updateAt: '2021-07-02',
+                type: 'system',
+                category: '字典',
+            }),
+            __metadata("design:type", Function),
+            __metadata("design:paramtypes", [Object]),
+            __metadata("design:returntype", void 0)
+        ], SystemEventFu.prototype, "enterToClick", null);
+        __decorate([
+            Lib({
                 title: '弹出确认对话框,回答 YES 之后调用某方法',
                 author: '罗一帆',
                 createAt: '2021-07-06',
@@ -12822,6 +12861,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
                                     {
                                         xtype: 'button',
                                         text: '查询',
+                                        reference: 'btnSearch',
                                         iconCls: 'x-fa fa-search',
                                         listeners: {
                                             click: 'scope.reload',
@@ -12841,6 +12881,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
                                 margin: '8 0 0 0'
                             },
                             items: __spread(conditionRows, sumRows),
+                            fix: ['system.enterToClick("btnSearch")'],
                         },
                         __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
                                 method: 'invoke',
@@ -12867,7 +12908,7 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
             return _this;
         }
         ReportScope.prototype.onLoad = function () {
-            this.reload();
+            // this.reload()
         };
         ReportScope.prototype.reload = function () {
             var _this = this;
@@ -13049,14 +13090,35 @@ define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'recast', 'lay-excel', 'xl
                 if (config === null || config === void 0 ? void 0 : config.nextFocus) {
                     this.on({
                         keyup: function (sender, e) {
-                            if ([10, 13, 20].includes(e.keyCode)) {
+                            if ([10, 13, 20, 40].includes(e.keyCode)) {
                                 sender._raiseNextFocus(sender);
                             }
                         }
                     });
                 }
+                var that = this;
+                this.on({
+                    keyup: function (sender, e, eOpts) {
+                        if (![10, 13, 20, 40].includes(e.keyCode)) {
+                            return;
+                        }
+                        that.keydown_fun_item(sender, e, eOpts);
+                    }
+                });
                 initComponent.call(this);
-            }
+            },
+            keydown_fun_item: _.debounce(function (sender, event, eOpts) {
+                var that = sender;
+                if ([10, 13, 20, 40].includes(event.keyCode)) {
+                    // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
+                    var value = _.trim(sender.rawValue);
+                    var r = that.fireEvent('scancode', that, value);
+                    if (r) {
+                        // 停止事件的默认处理程序,停止事件的冒泡
+                        event.stopEvent();
+                    }
+                }
+            }, 100)
         });
     }
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
dist/yvan-ext.js.map