/**
 * 流程图
 *
 * @class IBizWFStepDataTraceChartViewController
 * @extends {IBizMDViewController}
 */
class IBizWFStepDataTraceChartViewController extends IBizMDViewController {

    /**
     * 实体名称
     *
     * @type {string}
     * @memberof IBizWFStepDataTraceChartViewController
     */
    public srfdeid: string = '';

    /**
     * base64 图片
     *
     * @type {string}
     * @memberof IBizWFStepDataTraceChartViewController
     */
    public base64img: string = '';

    /**
     *Creates an instance of IBizWFStepDataTraceChartViewController.
     * @param {*} [opts={}]
     * @memberof IBizWFStepDataTraceChartViewController
     */
    constructor(opts: any = {}) {
        super(opts);
    }

    /**
     * 视图加载
     *
     * @memberof IBizWFStepDataTraceChartViewController
     */
    public onLoad(): void {
        super.onLoad();
        this.loadImg();
    }

    /**
     * 记载图片
     *
     * @memberof IBizWFStepDataTraceChartViewController
     */
    public loadImg(): void {
        if (!IBizEnvironment.WfActivitiTraceChart) {
            return;
        }
        const params: any = {};
        Object.assign(params, this.getViewParam());
        this.iBizHttp.post(IBizEnvironment.WfActivitiTraceChart, params).subscribe((data) => {
            if (data.ret !== 0) {
                return;
            }
            if (data.content && !Object.is(data.content, '')) {
                this.base64img = `data:image/png;base64, ${data.content}`;
            }
        }, (error: any) => {
        });
    }

    /**
     * 获取部件对象
     *
     * @returns {*}
     * @memberof IBizWFStepDataTraceChartViewController
     */
    public getMDCtrl(): any {
        return undefined;
    }

    /**
     * 获取图片路径
     *
     * @returns {string}
     * @memberof IBizWFStepDataTraceChartViewController
     */
    public getImgPath(): string {
        return this.base64img;
    }
}