ibiz-wizard-view-controller.js 4.7 KB
Newer Older
ibizdev's avatar
ibizdev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/**
 * 向导视图控制器
 *
 * @class IBizWizardViewController
 * @extends {IBizMainViewController}
 */
var IBizWizardViewController = /** @class */ (function (_super) {
    __extends(IBizWizardViewController, _super);
    /**
     *Creates an instance of IBizWizardViewController.
     * @param {*} [opts={}]
     * @memberof IBizWizardViewController
     */
    function IBizWizardViewController(opts) {
        if (opts === void 0) { opts = {}; }
        return _super.call(this, opts) || this;
    }
    /**
     * 初始化面板
     *
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onInitComponents = function () {
        var _this_1 = this;
        _super.prototype.onInitComponents.call(this);
        var wizardpanel = this.getWizardPanel();
        if (wizardpanel) {
            // 向导面板初始化完成
            wizardpanel.on(IBizWizardPanel.WIZARDPANEL_INITED).subscribe(function (data) {
                _this_1.onWizardInited(data);
            });
            // 向导面板完成
            wizardpanel.on(IBizWizardPanel.WIZARDPANEL_FINISH).subscribe(function (data) {
                _this_1.onWizardFinesh(data);
            });
            // 向导表单保存完成
            wizardpanel.on(IBizWizardPanel.WIZARDFORMSAVED).subscribe(function (data) {
                _this_1.onWizardFormSaved(data);
            });
            // 向导表单切换
            wizardpanel.on(IBizWizardPanel.WIZARDFORMCHANGED).subscribe(function (data) {
                _this_1.onWizardFormChanged(data);
            });
            // 向导表单项更新
            wizardpanel.on(IBizWizardPanel.WIZARDFORMFIELDCHANGED).subscribe(function (data) {
                if (data) {
                    _this_1.onWizardFormFieldChanged(data.formName, data.name, data.field, data.value);
                }
            });
        }
    };
    /**
     * 加载面板数据
     *
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onLoad = function () {
        if (this.getWizardPanel()) {
            this.getWizardPanel().autoLoad(this.getViewParam());
        }
    };
    /**
     * 获取向导面板对象
     *
     * @returns {*}
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.getWizardPanel = function () {
        return this.getControl('wizardpanel');
    };
    /**
     * 向导表单保存完成
     *
     * @param {*} data
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onWizardFormSaved = function (data) {
    };
    /**
     * 向导面板初始化完成
     *
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onWizardInited = function (data) {
    };
    /**
     * 向导面板完成
     *
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onWizardFinesh = function (data) {
        var _this = this;
        _this.$vue.$emit('dataChange', data);
        _this.refreshReferView(data);
    };
    /**
     * 向导表单切换
     *
     * @param {*} data
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onWizardFormChanged = function (data) {
    };
    /**
     * 向导表单项更新
     *
     * @param {*} data
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.onWizardFormFieldChanged = function (formName, fieldname, field, value) {
    };
    /**
     * 刷新关联数据
     *
     * @param {*} data
     * @memberof IBizWizardViewController
     */
    IBizWizardViewController.prototype.refreshReferView = function (data) {
        var iBizApp = IBizApp.getInstance();
        var viewparam = this.getViewParam();
        if (iBizApp && viewparam.openerid && !Object.is(viewparam.openerid, '')) {
            iBizApp.fireRefreshView({ openerid: viewparam.openerid, viewUsage: parseInt(viewparam.pviewusage) });
        }
        if (this.isModal()) {
            var result = { ret: 'OK', activeData: data };
            this.dataChange(result);
        }
    };
    return IBizWizardViewController;
}(IBizMainViewController));