account-pickup-view-base.vue 6.4 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
<template>
<studio-view-style2 viewName="accountpickupview" viewTitle="客户数据选择视图" class='depickupview account-pickup-view'>
    <div class="content-container pickup-view">
                <view_pickupviewpanel 
                    :viewState="viewState"  
                    :viewparams="JSON.parse(JSON.stringify(viewparams))" 
                    :context="JSON.parse(JSON.stringify(context))" 
                    :isSingleSelect="isSingleSelect"
                    :selectedData="selectedData"
                    :isShowButton="isShowButton"
                    name="pickupviewpanel"  
                    ref='pickupviewpanel' 
                    @selectionchange="pickupviewpanel_selectionchange($event)"  
                    @activated="pickupviewpanel_activated($event)"  
                    @load="pickupviewpanel_load($event)"  
                    @closeview="closeView($event)">
                </view_pickupviewpanel>
            <card v-if="isShowButton" :dis-hover="true" :bordered="false" class="footer">
                <row :style="{ textAlign: 'right' }">
                    <i-button type="primary" :disabled="this.viewSelections.length > 0 ? false : true" @click="onClickOk">{{this.containerModel.view_okbtn.text}}</i-button>
                        &nbsp;&nbsp;
                    <i-button @click="onClickCancel">{{this.containerModel.view_cancelbtn.text}}</i-button>
                </row>
            </card>
        </div>
</studio-view-style2>
</template>


<script lang='tsx'>
31
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
32
import { Subject } from 'rxjs';
33
import { UIActionTool, Util } from '@/utils';
34 35 36 37 38
import AccountService from '@/service/account/account-service';

import PickupViewEngine from '@engine/view/pickup-view-engine';


39 40 41 42 43 44 45 46
/**
 * 客户数据选择视图视图基类
 *
 * @export
 * @class AccountPickupViewBase
 * @extends {Vue}
 */
@Component({})
47 48 49 50 51 52 53 54
export default class AccountPickupViewBase extends Vue {

    /**
     * 实体服务对象
     *
     * @type {AccountService}
     * @memberof AccountPickupViewBase
     */
55
    protected appEntityService: AccountService = new AccountService;
56 57 58 59 60


    /**
     * 计数器服务对象集合
     *
61
     * @protected
62 63 64
     * @type {Array<*>}
     * @memberof AccountPickupViewBase
     */    
65
    protected counterServiceArray: Array<any> = [];
66 67 68 69

	/**
	 * 自定义视图导航上下文集合
	 *
70
     * @protected
71 72 73
	 * @type {*}
	 * @memberof AccountPickupViewBase
	 */
74
    protected customViewNavContexts: any = {
75 76 77 78 79
    };

	/**
	 * 自定义视图导航参数集合
	 *
80
     * @protected
81 82 83
	 * @type {*}
	 * @memberof AccountPickupViewBase
	 */
84
    protected customViewParams: any = {
85 86 87 88 89
    };

    /**
     * 视图模型数据
     *
90
     * @protected
91 92 93
     * @type {*}
     * @memberof AccountPickupViewBase
     */
94
    protected model: any = {
95 96 97 98 99 100 101 102 103
        srfCaption: 'entities.account.views.pickupview.caption',
        srfTitle: 'entities.account.views.pickupview.title',
        srfSubTitle: 'entities.account.views.pickupview.subtitle',
        dataInfo: ''
    }

    /**
     * 容器模型
     *
104
     * @protected
105 106 107
     * @type {*}
     * @memberof AccountPickupViewBase
     */
108
    protected containerModel: any = {
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 145 146 147 148 149 150 151 152
        view_pickupviewpanel: { name: 'pickupviewpanel', type: 'PICKUPVIEWPANEL' },
        view_okbtn: { name: 'okbtn', type: 'button', text: '确定', disabled: true },
        view_cancelbtn: { name: 'cancelbtn', type: 'button', text: '取消', disabled: false },
        view_leftbtn: { name: 'leftbtn', type: 'button', text: '左移', disabled: true },
        view_rightbtn: { name: 'rightbtn', type: 'button', text: '右移', disabled: true },
        view_allleftbtn: { name: 'allleftbtn', type: 'button', text: '全部左移', disabled: true },
        view_allrightbtn: { name: 'allrightbtn', type: 'button', text: '全部右移', disabled: true },
    };




    /**
     * 视图引擎
     *
     * @public
     * @type {Engine}
     * @memberof AccountPickupViewBase
     */
    public engine: PickupViewEngine = new PickupViewEngine();

    /**
     * 引擎初始化
     *
     * @public
     * @memberof AccountPickupViewBase
     */
    public engineInit(): void {
        this.engine.init({
            view: this,
            pickupviewpanel: this.$refs.pickupviewpanel,
            keyPSDEField: 'account',
            majorPSDEField: 'accountname',
            isLoadDefault: true,
        });
    }

    /**
     * pickupviewpanel 部件 selectionchange 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof AccountPickupViewBase
     */
153
    public pickupviewpanel_selectionchange($event: any, $event2?: any): void {
154 155 156 157 158 159 160 161 162 163
        this.engine.onCtrlEvent('pickupviewpanel', 'selectionchange', $event);
    }

    /**
     * pickupviewpanel 部件 activated 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof AccountPickupViewBase
     */
164
    public pickupviewpanel_activated($event: any, $event2?: any): void {
165 166 167 168 169 170 171 172 173 174
        this.engine.onCtrlEvent('pickupviewpanel', 'activated', $event);
    }

    /**
     * pickupviewpanel 部件 load 事件
     *
     * @param {*} [args={}]
     * @param {*} $event
     * @memberof AccountPickupViewBase
     */
175
    public pickupviewpanel_load($event: any, $event2?: any): void {
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
        this.engine.onCtrlEvent('pickupviewpanel', 'load', $event);
    }

    /**
     * 选中数据的字符串
     *
     * @type {string}
     * @memberof AccountPickupView
     */
    public selectedData: string = "";

    /**
     * 视图选中数据
     *
     * @type {any[]}
     * @memberof AccountPickupViewBase
     */
    public viewSelections:any[] = [];

    /**
     * 是否显示按钮
     *
     * @type {boolean}
     * @memberof AccountPickupViewBase
     */
    @Prop({default: true}) public isShowButton!: boolean;

    /**
     * 是否单选
     *
     * @type {boolean}
     * @memberof AccountPickupViewBase
     */
    public isSingleSelect: boolean = true;

    /**
     * 确定
     *
     * @memberof AccountPickupViewBase
     */
    public onClickOk(): void {
        this.$emit('viewdataschange', this.viewSelections);
        this.$emit('close', null);
    }

    /**
     * 取消
     *
     * @memberof AccountPickupViewBase
     */
    public onClickCancel(): void {
        this.$emit('close', null);
    }

}
</script>

<style lang='less'>
@import './account-pickup-view.less';
</style>