<#assign view_base_name>WFDynaExpGridViewBase</#assign>
<#assign self_content>
    /**
     * 分割宽度
     *
     * @type {number}
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public split: number = 0.2;

    /**
     * 树导航栏数据
     *
     * @type {any}
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public wfStepModel: Array<any> = [];

    /**
     * 是否展开搜索表单
     *
     * @type {any}
     * @memberof  ${srfclassname('${view.codeName}')}Base
     */
    public isExpandSearchForm:boolean = true;

    /**
     * 是否单选
     *
     * @type {any}
     * @memberof  ${srfclassname('${view.codeName}')}Base
     */
    public isSingleSelect:boolean = true;

    /**
     * 左侧树的默认配置
     *
     * @type {any}
     * @memberof  ${srfclassname('${view.codeName}')}Base
     */
    public defaultProps:any ={
         children: 'children',
         label: 'userTaskName'
    };

    /**
     * 左侧树当前选中节点
     *
     * @type {any}
     * @memberof  ${srfclassname('${view.codeName}')}Base
     */
    public curSelectedNode:any;

    /**
     * 获取树导航栏数据
     *
     * @memberof  ${srfclassname('${view.codeName}')}Base
     */
    public getWFStepModel():Promise<any>{
        return new Promise((resolve:any, reject:any) =>{
            this.appEntityService.WFGetWFStep().then((response:any) =>{
                if (response && response.status === 200) {
                    this.wfStepModel = response.data;
                    if(this.wfStepModel && this.wfStepModel.length > 0){
                        this.curSelectedNode = this.wfStepModel[0];
                    }
                    Object.assign(this.viewparams,{'userTaskId':this.curSelectedNode['userTaskId'],'processDefinitionKey':this.curSelectedNode['processDefinitionKey']});
                    this.setTreeNodeHighLight(this.curSelectedNode);
                    resolve(response.data);
                }
                }).catch((response: any) => {
                    if (response && response.status) {
                        this.$Notice.error({ title: '错误', desc: response.message });
                        return;
                    }
                    if (!response || !response.status || !response.data) {
                        this.$Notice.error({ title: '错误', desc: '系统异常' });
                        return;
                    }
                });
        })
    }

    /**
     * 左侧树选中节点
     *
     * @type {any}
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public handleNodeClick(data:any) {
        this.curSelectedNode = data;
        this.setTreeNodeHighLight(this.curSelectedNode);
        Object.assign(this.viewparams,{'userTaskId':data['userTaskId'],'processDefinitionKey':data['processDefinitionKey']});
        (this.$refs.searchform as any).onSearch();
    }

    /**
     * 设置选中高亮
     *
     * @param {*} data
     * @memberof ${srfclassname('${view.codeName}')}Base
     */
    public setTreeNodeHighLight(data: any): void {
        this.$nextTick(() =>{
            const tree: any = this.$refs.tree;
            tree.setCurrentKey(data.userTaskId);
        })
    }
<#if view.hasPSControl('grid')>
<#assign grid = view.getPSControl('grid')>

    /**
     * 刷新数据
     *
     * @readonly
     * @type {(number | null)}
     * @memberof ${srfclassname('${view.name}')}Base
     */
    get refreshdata(): number | null {
        return this.$store.getters['viewaction/getRefreshData'](this.viewtag);
    }

    /**
     * 监控数据变化
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @returns
     * @memberof ${srfclassname('${view.name}')}Base
     */
    @Watch('refreshdata')
    onRefreshData(newVal: any, oldVal: any) {
        if (newVal === null || newVal === undefined) {
            return;
        }
        if (newVal === 0) {
            return;
        }
        const grid: any = this.$refs.${grid.name};
        if (grid) {
            grid.load({});
        }
    }
</#if>
</#assign>
<#ibizinclude>
../@MACRO/VIEW-BASE.vue.ftl
</#ibizinclude>