@newview/report-tools 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/report-tools.js +45 -5
- package/dist/report-tools.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/readme.md +3 -0
package/dist/report-tools.js
CHANGED
|
@@ -358428,7 +358428,7 @@ class SendDocMgmtTmplInstance extends BaseInstance {
|
|
|
358428
358428
|
});
|
|
358429
358429
|
}
|
|
358430
358430
|
}
|
|
358431
|
-
const
|
|
358431
|
+
const ReportView_vue_vue_type_style_index_0_scoped_e572bde8_lang = "";
|
|
358432
358432
|
const _hoisted_1 = { id: "reportPrintContainer" };
|
|
358433
358433
|
const _hoisted_2 = ["id"];
|
|
358434
358434
|
const _hoisted_3 = { key: 0 };
|
|
@@ -358445,6 +358445,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
358445
358445
|
key: page.name
|
|
358446
358446
|
}, [
|
|
358447
358447
|
createBaseVNode("div", {
|
|
358448
|
+
id: "table_container",
|
|
358448
358449
|
style: normalizeStyle([{ "position": "relative" }, { width: Number((_a2 = page.width) == null ? void 0 : _a2.replace("px", "")) + 0 + "px", backgroundColor: "white" }])
|
|
358449
358450
|
}, [
|
|
358450
358451
|
createBaseVNode("table", {
|
|
@@ -358501,7 +358502,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
358501
358502
|
}), 128))
|
|
358502
358503
|
]);
|
|
358503
358504
|
}
|
|
358504
|
-
const ReportView = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-
|
|
358505
|
+
const ReportView = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e572bde8"]]);
|
|
358505
358506
|
class reportTool extends BaseInstance {
|
|
358506
358507
|
constructor(direction, pageSize) {
|
|
358507
358508
|
super();
|
|
@@ -358608,6 +358609,7 @@ class reportTool extends BaseInstance {
|
|
|
358608
358609
|
let sheetTag = JSON.parse(((_b = (_a2 = page.data[0][0]) == null ? void 0 : _a2.flag) == null ? void 0 : _b.sheettag) ?? "{}");
|
|
358609
358610
|
let rows = [];
|
|
358610
358611
|
let alias = page.config.alias;
|
|
358612
|
+
let textBox = this.getTextBox(page.textBoxs);
|
|
358611
358613
|
page.data.forEach((row, rowIndex) => {
|
|
358612
358614
|
let cols = [];
|
|
358613
358615
|
row.forEach((tdObj, colIndex) => {
|
|
@@ -358696,7 +358698,8 @@ class reportTool extends BaseInstance {
|
|
|
358696
358698
|
rows,
|
|
358697
358699
|
width: this.sumForArray(layoutData.columnWidths) + "px",
|
|
358698
358700
|
height: this.sumForArray(layoutData.rowHeights) + "px",
|
|
358699
|
-
sheetTag
|
|
358701
|
+
sheetTag,
|
|
358702
|
+
textBox
|
|
358700
358703
|
});
|
|
358701
358704
|
}
|
|
358702
358705
|
this.pageInfo = {
|
|
@@ -358750,6 +358753,28 @@ class reportTool extends BaseInstance {
|
|
|
358750
358753
|
}
|
|
358751
358754
|
return value;
|
|
358752
358755
|
}
|
|
358756
|
+
/**
|
|
358757
|
+
* 获取文本框信息
|
|
358758
|
+
* */
|
|
358759
|
+
getTextBox(textBox) {
|
|
358760
|
+
let arr = [];
|
|
358761
|
+
if (Object.keys(textBox).length !== 0) {
|
|
358762
|
+
for (let key2 in textBox) {
|
|
358763
|
+
let item2 = textBox[key2];
|
|
358764
|
+
arr.push(
|
|
358765
|
+
{
|
|
358766
|
+
alias: item2.alias,
|
|
358767
|
+
width: item2.default.width,
|
|
358768
|
+
height: item2.default.height,
|
|
358769
|
+
top: item2.default.top,
|
|
358770
|
+
left: item2.default.left,
|
|
358771
|
+
innerHtml: ""
|
|
358772
|
+
}
|
|
358773
|
+
);
|
|
358774
|
+
}
|
|
358775
|
+
}
|
|
358776
|
+
return arr;
|
|
358777
|
+
}
|
|
358753
358778
|
/**
|
|
358754
358779
|
* 获取单元格合并信息
|
|
358755
358780
|
*/
|
|
@@ -359073,6 +359098,22 @@ class reportTool extends BaseInstance {
|
|
|
359073
359098
|
}
|
|
359074
359099
|
}
|
|
359075
359100
|
}
|
|
359101
|
+
/**
|
|
359102
|
+
* 根据别名向文本框添加图片
|
|
359103
|
+
* @param alias 别名
|
|
359104
|
+
* @param base64 图片base64码
|
|
359105
|
+
* @param sheetHandle 页码-从0开始
|
|
359106
|
+
* @returns
|
|
359107
|
+
*/
|
|
359108
|
+
setTextBoxByAlias(alias, base64, sheetHandle) {
|
|
359109
|
+
let sheetIndex = sheetHandle || 0;
|
|
359110
|
+
let textBox = this.pageInfo.sheets[sheetIndex].textBox;
|
|
359111
|
+
for (let i2 = 0; i2 < textBox.length; i2++) {
|
|
359112
|
+
if (textBox[i2].alias == alias) {
|
|
359113
|
+
textBox[i2].innerHtml = `<img src="${base64}" style="height: 100%;width: 100%;object-fit: contain;" />`;
|
|
359114
|
+
}
|
|
359115
|
+
}
|
|
359116
|
+
}
|
|
359076
359117
|
/**
|
|
359077
359118
|
* 根据别名添加图片
|
|
359078
359119
|
* @param alias 别名
|
|
@@ -359159,8 +359200,7 @@ class reportTool extends BaseInstance {
|
|
|
359159
359200
|
*/
|
|
359160
359201
|
getPrintBody(element2, printSize) {
|
|
359161
359202
|
let containerGraParent = $(`<div class="reportPrintContainer" style="width: ${printSize.isTransverse ? printSize.height : printSize.width}; height: ${printSize.isTransverse ? printSize.width : printSize.height}; position: relative; background-color: white; border: 2px solid #fff; overflow: visible; box-sizing: border-box; break-after: page;"></div>`);
|
|
359162
|
-
let cloneElement =
|
|
359163
|
-
cloneElement.css("display", "block");
|
|
359203
|
+
let cloneElement = element2.querySelector("#table_container").cloneNode(true);
|
|
359164
359204
|
if (($(element2).width() ?? 0) > ($(element2).height() ?? 0)) {
|
|
359165
359205
|
let horizontalContainer = $(`<div style="display: block; text-align: center; width: ${printSize.width}; height: ${printSize.height};padding: 20mm 20mm 20mm 25mm; box-sizing: border-box; transform: rotate(-90deg); margin-top: ${printSize.reportPaperType == 1 ? "42.8885mm" : "60.7885mm"}; margin-left:${printSize.reportPaperType == 1 ? "-43.5923mm" : "-62.3923mm"} ;"></div>`);
|
|
359166
359206
|
let horizontalContainerParent = $(`<div style="display: inline-block; position: relative;"></div>`);
|