合同打印

This commit is contained in:
his-uncles-father 2021-04-01 14:36:58 +08:00
parent 59e30d0110
commit 4381d36e38
5 changed files with 44 additions and 18 deletions

View File

@ -78,10 +78,10 @@
vc.component.contractChangeManageInfo.moreCondition = true;
}
},
_printContract: function (_contract) {
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType);
}
_printContract: function (_contract) {
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType+"&contractId="+_contract.contractId);
}
}
});

View File

@ -79,10 +79,8 @@
}
},
_printContract: function (_contract) {
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType);
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType+"&contractId="+_contract.contractId);
}
}
});
})(window.vc);

View File

@ -77,10 +77,9 @@
}
},
_printContract: function (_contract) {
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType);
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType+"&contractId="+_contract.contractId);
}
}
});
})(window.vc);

View File

@ -78,10 +78,8 @@
}
},
_printContract: function (_contract) {
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType);
window.open("/print.html#/pages/admin/printContract?contractTypeId=" + _contract.contractType+"&contractId="+_contract.contractId);
}
}
});
})(window.vc);

View File

@ -2,7 +2,13 @@
vc.extends({
data: {
templatecontent:'',
contractdata:'',
contractTypeSpec:'',
baseRepalce:'',
attrs:[],
printContractInfo: {
contractId: '',
contractTypeId: '',
context: ''
},
@ -12,7 +18,8 @@
//vc.component._initPrintPurchaseApplyDateInfo();
$that.printContractInfo.contractTypeId = vc.getParam('contractTypeId');
$that.printContractInfo.contractId = vc.getParam('contractId');
$that._loadContract();
},
_initEvent: function () {
@ -28,24 +35,48 @@
params: {
page: 1,
row: 1,
contractId:$that.printContractInfo.contractId,
contractTypeId: $that.printContractInfo.contractTypeId
}
};
//发送get请求
vc.http.apiGet('/contract/queryContractTypeTemplate',
//发送模板get请求
vc.http.apiGet('/contract/printContractTemplate',
param,
function (json, res) {
let _info = JSON.parse(json);
let _data = _info.data;
if (_data.length > 0) {
$that.printContractInfo.context = _data[0].context;
}
$that.templatecontent = _data.contractTypeTemplate[0].context;
$that.contractdata = _data.contract[0];
$that.attrs = _data.contract[0].attrs;
$that.contractTypeSpec = _data.contractTypeSpec;
$that.contractTypeSpec.forEach(function(e){
let rname = e.specName;
let rspecCd = e.specCd;
$that.attrs.forEach(function(ea){
if(rspecCd == ea.specCd){
let reg = '#'+rname+'#';
$that.templatecontent = $that.templatecontent.replaceAll(reg, ea.value)
}
});
});
$that.baseRepalce = _data.baseRepalce;
$that.baseRepalce.forEach(function(e){
let rname = e.name;
let rkey = e.key;
var contractarr = Object.keys($that.contractdata);
for(var a in contractarr){
if(rkey == contractarr[a]){
let reg = '#'+rname+'#';
$that.templatecontent = $that.templatecontent.replaceAll(reg, $that.contractdata[contractarr[a]])
}
}
});
$that.printContractInfo.context = $that.templatecontent;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_printContractDiv: function () {