|
@@ -81,16 +81,18 @@ class MoveSignatureTool {
|
|
|
x: mousePos.x - me.activeImg.x,
|
|
|
y: mousePos.y - me.activeImg.y,
|
|
|
};
|
|
|
-
|
|
|
- const orgTargetData = this.pageObj.items[0].signature_cells.find(item => item.signatureName === target.signatureName && item.signType === target.signType);
|
|
|
- orgTargetData.isMoving = true;
|
|
|
- this.render(me);
|
|
|
-
|
|
|
- const { top, left } = $("#rptCanvas").position();
|
|
|
- $("#rptCanvas").after(`<div id='templateSignature' data-ID='${orgTargetData.signature_name}' style="background-image:url('${orgTargetData.path}');background-size: contain;cursor: move;position: absolute;top: ${y + top + 10}px;left:${x + left + 10}px;width:${width}px;height:${height}px;"/>`);
|
|
|
- $("#templateSignature").unbind('mousemove').on('mousemove', (e) => { this.templateSignatureMove(e, this) });
|
|
|
- $("#templateSignature").unbind('click').on('click', (e) => { this.templateSignatureClick(e, this) });
|
|
|
-
|
|
|
+
|
|
|
+ const curPage = zTreeOprObj.currentPage || 1;
|
|
|
+ const orgTargetData = this.pageObj.items[curPage - 1].signature_cells.find(item => item.signatureName === target.signatureName && item.signType === target.signType);
|
|
|
+ if (orgTargetData) {
|
|
|
+ orgTargetData.isMoving = true;
|
|
|
+ this.render(me);
|
|
|
+
|
|
|
+ const { top, left } = $("#rptCanvas").position();
|
|
|
+ $("#rptCanvas").after(`<div id='templateSignature' data-ID='${orgTargetData.signature_name}' style="background-image:url('${orgTargetData.path}');background-size: contain;cursor: move;position: absolute;top: ${y + top + 10}px;left:${x + left + 10}px;width:${width}px;height:${height}px;"/>`);
|
|
|
+ $("#templateSignature").unbind('mousemove').on('mousemove', (e) => { this.templateSignatureMove(e, this) });
|
|
|
+ $("#templateSignature").unbind('click').on('click', (e) => { this.templateSignatureClick(e, this) });
|
|
|
+ }
|
|
|
} else {
|
|
|
me.selected = false;
|
|
|
}
|
|
@@ -135,7 +137,8 @@ class MoveSignatureTool {
|
|
|
render(me, isHideSignature = false) {
|
|
|
let target;
|
|
|
// 因为只有一页,所以就默认取是一个数据
|
|
|
- for (const signature of me.pageObj.items[0].signature_cells) {
|
|
|
+ const curPage = zTreeOprObj.currentPage || 1;
|
|
|
+ for (const signature of me.pageObj.items[curPage - 1].signature_cells) {
|
|
|
//找到要移动的签章
|
|
|
if (signature.signature_name && me.activeImg && me.activeImg.signature_name.includes(signature.signature_name)) {
|
|
|
target = signature;
|
|
@@ -192,20 +195,23 @@ class MoveSignatureTool {
|
|
|
const { top, left } = $(event.currentTarget).position();
|
|
|
me.activeImg.y = top - canvasOuterTop - this.jpcOutput.offsetY;
|
|
|
me.activeImg.x = left - canvasOuterLeft - this.jpcOutput.offsetX;
|
|
|
- const orgTargetData = this.pageObj.items[0].signature_cells.find(item => item.signature_name === $(event.currentTarget).data('id'));
|
|
|
- orgTargetData.isMoving = false;
|
|
|
- this.saveSignature(me);
|
|
|
- if (this.pageObj.items.length > 1) {
|
|
|
- for (let idx = 0; idx < this.pageObj.items.length; idx++) {
|
|
|
- const targetCell = this.pageObj.items[idx].signature_cells.find(item => item.signatureName === orgTargetData.signatureName && item.signType === orgTargetData.signType);
|
|
|
- if (targetCell) {
|
|
|
- targetCell.area.Left = orgTargetData.area.Left;
|
|
|
- targetCell.area.Right = orgTargetData.area.Right;
|
|
|
- targetCell.area.Top = orgTargetData.area.Top;
|
|
|
- targetCell.area.Bottom = orgTargetData.area.Bottom;
|
|
|
+ const curPage = zTreeOprObj.currentPage || 1;
|
|
|
+ const orgTargetData = this.pageObj.items[curPage - 1].signature_cells.find(item => item.signature_name === $(event.currentTarget).data('id'));
|
|
|
+ if (orgTargetData) {
|
|
|
+ orgTargetData.isMoving = false;
|
|
|
+ this.saveSignature(me);
|
|
|
+ if (this.pageObj.items.length > 1) {
|
|
|
+ for (let idx = 0; idx < this.pageObj.items.length; idx++) {
|
|
|
+ const targetCell = this.pageObj.items[idx].signature_cells.find(item => item.signatureName === orgTargetData.signatureName && item.signType === orgTargetData.signType);
|
|
|
+ if (targetCell) {
|
|
|
+ targetCell.area.Left = orgTargetData.area.Left;
|
|
|
+ targetCell.area.Right = orgTargetData.area.Right;
|
|
|
+ targetCell.area.Top = orgTargetData.area.Top;
|
|
|
+ targetCell.area.Bottom = orgTargetData.area.Bottom;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ $("#templateSignature").remove();
|
|
|
}
|
|
|
- $("#templateSignature").remove();
|
|
|
}
|
|
|
}
|