CalendarViewBase.tsx 1.7 KB
Newer Older
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
import { MDViewBase } from './MDViewBase';

/**
 * 日历视图基类
 *
 * @export
 * @class CalendarViewBase
 * @extends {MDViewBase}
 */
export class CalendarViewBase extends MDViewBase {

    /**
     * 快速搜索
     *
     * @protected
     * @memberof ListViewBase
     */
    protected onSearch(): void {
        const calendar: any = this.$refs.calendar;
        if (calendar) {
            calendar.load(this.context, true);
        }
    }

    /**
     * calendar 的 beforeload 事件
     *
     * @param {*} arg
     * @memberof CalendarViewBase
     */
    public onBeforeLoad(arg: any): void {
        if (this.viewparams && Object.keys(this.viewparams).length > 0) {
            Object.assign(arg, this.viewparams);
        }
        if (this.$refs.searchform && this.isExpandSearchForm) {
            Object.assign(arg, (this.$refs.searchform as any).getData());
        }
        if (this && !this.isExpandSearchForm) {
            Object.assign(arg, { query: this.query });
        }
        // 快速分组和快速搜索栏
        const otherQueryParam: any = {};
        if (this.quickGroupData) {
            Object.assign(otherQueryParam, this.quickGroupData);
        }
        if (this.quickFormData) {
            Object.assign(otherQueryParam, this.quickFormData);
        }
        Object.assign(arg, { viewparams: otherQueryParam });
    }

    /**
     * searchform 部件 search 事件
     *
     * @param {*} $event
     * @memberof CalendarViewBase
     */
    public searchform_search() {
        this.onSearch();
    }

    /**
     * searchform 部件 load 事件
     *
     * @param {*} $event
     * @memberof CalendarViewBase
     */
    public searchform_load() {
        this.onSearch();
    }

}