自定义报表加入打印功能

This commit is contained in:
java110 2022-08-02 09:50:03 +08:00
parent 5dd1cfd250
commit f41c544f45
6 changed files with 111 additions and 41 deletions

View File

@ -1,5 +1,4 @@
<div id="editPropertyCompanyModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div id="editPropertyCompanyModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
@ -40,7 +39,7 @@
<div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="地标" namespace="editPropertyCompany"></vc:i18n></span></label>
<div class="col-sm-10">
<input v-model="editPropertyCompanyInfo.nearbyLandmarks" type="text" :placeholder="vc.i18n('必填,请填写地标','editPropertyCompany')" class="form-control">
<input v-model="editPropertyCompanyInfo.nearByLandmarks" type="text" :placeholder="vc.i18n('必填,请填写地标','editPropertyCompany')" class="form-control">
</div>
</div>
<div class="ibox-content">
@ -53,4 +52,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
(function (vc, vm) {
(function(vc, vm) {
vc.extends({
data: {
editPropertyCompanyInfo: {
@ -11,28 +11,28 @@
nearByLandmarks: ''
}
},
_initMethod: function () {
vc.initDate('editFoundingTime', function (_value) {
_initMethod: function() {
vc.initDate('editFoundingTime', function(_value) {
$that.editPropertyCompanyInfo.foundingTime = _value;
});
},
_initEvent: function () {
vc.on('editPropertyCompany', 'openEditPropertyCompanyModal', function (_params) {
_initEvent: function() {
vc.on('editPropertyCompany', 'openEditPropertyCompanyModal', function(_params) {
vc.component.refreshEditPropertyCompanyInfo();
$('#editPropertyCompanyModel').modal('show');
vc.copyObject(_params, vc.component.editPropertyCompanyInfo);
});
},
methods: {
editPropertyCompanyValidate: function () {
editPropertyCompanyValidate: function() {
return vc.validate.validate({
editPropertyCompanyInfo: vc.component.editPropertyCompanyInfo
}, {
'editPropertyCompanyInfo.name': [{
limit: "required",
param: "",
errInfo: "名称不能为空"
},
limit: "required",
param: "",
errInfo: "名称不能为空"
},
{
limit: "maxLength",
param: "100",
@ -40,10 +40,10 @@
},
],
'editPropertyCompanyInfo.address': [{
limit: "required",
param: "",
errInfo: "地址不能为空"
},
limit: "required",
param: "",
errInfo: "地址不能为空"
},
{
limit: "maxLength",
param: "200",
@ -51,10 +51,10 @@
},
],
'editPropertyCompanyInfo.tel': [{
limit: "required",
param: "",
errInfo: "电话不能为空"
},
limit: "required",
param: "",
errInfo: "电话不能为空"
},
{
limit: "maxLength",
param: "11",
@ -62,10 +62,10 @@
},
],
'editPropertyCompanyInfo.corporation': [{
limit: "required",
param: "",
errInfo: "公司法人不能为空"
},
limit: "required",
param: "",
errInfo: "公司法人不能为空"
},
{
limit: "maxLength",
param: "64",
@ -73,10 +73,10 @@
},
],
'editPropertyCompanyInfo.foundingTime': [{
limit: "required",
param: "",
errInfo: "成立日期不能为空"
},
limit: "required",
param: "",
errInfo: "成立日期不能为空"
},
{
limit: "maxLength",
param: "64",
@ -84,10 +84,10 @@
},
],
'editPropertyCompanyInfo.nearByLandmarks': [{
limit: "required",
param: "",
errInfo: "地标不能为空"
},
limit: "required",
param: "",
errInfo: "地标不能为空"
},
{
limit: "maxLength",
param: "200",
@ -101,7 +101,7 @@
}]
});
},
editPropertyCompany: function () {
editPropertyCompany: function() {
if (!vc.component.editPropertyCompanyValidate()) {
vc.toast(vc.validate.errInfo);
return;
@ -111,7 +111,7 @@
JSON.stringify(vc.component.editPropertyCompanyInfo), {
emulateJSON: true
},
function (json, res) {
function(json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
@ -122,12 +122,12 @@
return;
}
},
function (errInfo, error) {
function(errInfo, error) {
console.log('请求失败处理');
vc.toast(errInfo);
});
},
refreshEditPropertyCompanyInfo: function () {
refreshEditPropertyCompanyInfo: function() {
vc.component.editPropertyCompanyInfo = {
storeId: '',
name: '',

View File

@ -35,6 +35,9 @@
<button type="button" class="btn btn-white btn-sm" v-on:click="_exportReportTableMethod(item)">
导出
</button>
<button type="button" class="btn btn-white btn-sm" v-on:click="_printReportTableMethod(item)">
打印
</button>
</div>
</div>
<div class="ibox-content">
@ -73,4 +76,4 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -201,9 +201,11 @@
}
let urlParam = _result.join('&');
vc.jumpToPage('/callComponent/importAndExportFee/exportCustomReportTableData?' + urlParam)
},
_printReportTableMethod: function(_data) {
vc.saveData('printCommonReportTableData', _data);
window.open('/print.html#/pages/property/printCommonReportTable');
}
}
});

View File

@ -0,0 +1,33 @@
<div>
<div class="top-1 ">
<h1 class="text-center" style="color:#000;font-weight: 400;">{{printCommonReportTableInfo.componentName}}</h1>
</div>
<div class="context-1">
<table class="table vc-table-border" style="color:#000;font-size:20px">
<thead>
<tr>
<th class="text-center" v-for="(itemTh,indexTh) in printCommonReportTableInfo.th">{{itemTh}}</th>
</tr>
</thead>
<tbody class="vc-table-border" style="color:#000;font-size:20px">
<tr v-for="(itemData,indexData) in printCommonReportTableInfo.data" class="vc-table-border">
<td class="text-center" v-for="(tmpItemTh,key) in printCommonReportTableInfo.th">
{{itemData[tmpItemTh]}}</td>
</tr>
</tbody>
</table>
<div class="row padding-left" v-if="printCommonReportTableInfo.footer" style="color:#000;font-size:20px">
<span class="col-md-2" v-for="(tmpItemTh,key) of printCommonReportTableInfo.footer">
<div class="row">{{key}}: {{tmpItemTh}}</div>
</span>
</div>
<div class="text-right" id="print-btn">
<button class="btn btn-primary float-right" type="button" v-on:click="_printPurchaseApplyDiv()">
<i class="fa fa-check"></i>&nbsp;打印
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" v-on:click="_closePage()"><span><vc:i18n name="取消" namespace="printPayFeeBangTai"></vc:i18n></span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,33 @@
/**
入驻小区
**/
(function(vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
printCommonReportTableInfo: {}
},
_initMethod: function() {
$that.printCommonReportTableInfo = vc.getData('printCommonReportTableData')
},
methods: {
_printPurchaseApplyDiv: function() {
$that.printFlag = '1';
console.log('console.log($that.printFlag);', $that.printFlag);
document.getElementById("print-btn").style.display = "none"; //隐藏
window.print();
//$that.printFlag = false;
window.opener = null;
window.close();
},
_closePage: function() {
window.opener = null;
window.close();
},
}
});
})(window.vc);