import { $http } from '../../../containers/config/https';
import { getLodop } from'./LodopFuncs.js';

export function $loadTemplate(templateName,props) {
    let data = {};
    data={
        params: [{
            templateName: templateName,
            hospID: window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData).hospID:""
        }]
    }
    $http.post('urlS', this, {
        code: "01040087",
        data: data,
        success: function (res) {
            if (res.errorCode === '0') {
                    LODOP=getLodop(); 
                    LODOP.PRINT_INIT(templateName);     //打印初始化
                    eval(res.result);       //执行模板内容
                    eval(props);            //执行打印内容
            }   
        }
    });
}

export function $loopPrint(templateStr,printStr) {
    LODOP=getLodop(); 
    LODOP.PRINT_INIT("");     //打印初始化
    eval(templateStr);        //执行模板内容
    eval(printStr);           //执行打印内容
}