Browse Source

签章移动相关功能优化

lishihao 2 years ago
parent
commit
74355e5a7a
2 changed files with 20 additions and 13 deletions
  1. 3 1
      app/public/report/js/jpc_output.js
  2. 17 12
      app/public/report/js/rpt_move_signature.js

+ 3 - 1
app/public/report/js/jpc_output.js

@@ -421,6 +421,8 @@ let JpcCanvasOutput = {
             ctx.save();
             ctx.translate(0.5,0.5);
             let style = styles[cell[JV.PROP_STYLE]];
+            // 印章的cell表框都要去掉
+            if(cell.path) style =  'Default_None';
             if (style) {
                 let isNeedMergeBand = private_chkIfInMergedBand(mergedBand, cell);
                 private_drawLine(cell, ctx, style, JV.PROP_TOP, [JV.PROP_LEFT, JV.PROP_TOP],[JV.PROP_RIGHT, JV.PROP_TOP], mergedBand, styles, isNeedMergeBand);
@@ -533,7 +535,7 @@ let JpcCanvasOutput = {
         function private_drawImage(cell, control, imageData,moveSignatureTool, orgSize = false, offsetArea) {
             // 新增签章数据到移动工具中
             if(moveSignatureTool){
-                const {Left,Right,Top,Bottom}=cell.area;
+                const {Left,Right,Top,Bottom}=cell.area; 
                 moveSignatureTool.setSignature(
                     imageData, 
                     Left* JpcCanvasOutput.scaleFactor, 

+ 17 - 12
app/public/report/js/rpt_move_signature.js

@@ -20,17 +20,21 @@ class MoveSignatureTool {
     }
 
     setSignature(obj, x, y, width, height, signature_name, signatureName, signType) {
-        this.signatureList.push({
-            obj,
-            x,
-            y,
-            width,
-            height,
-            crossOrigin: 'Anonymous',
-            signature_name,
-            signatureName,
-            signType
-        })
+        // 只有签章才能移动
+        if(signType){
+            this.signatureList.push({
+                obj,
+                x,
+                y,
+                width,
+                height,
+                crossOrigin: 'Anonymous',
+                signature_name,
+                signatureName,
+                signType
+            })
+        }
+        
     }
     //获取鼠标在canvas中的位置
     getMousePos(event, me) {
@@ -83,9 +87,10 @@ class MoveSignatureTool {
             this.render(me);
 
             const { top, left } = $("#rptCanvas").position();
-            $("#rptCanvas").after(`<image id='templateSignature' data-ID='${orgTargetData.signature_name}' src='${orgTargetData.path}' style=" cursor: move;position: absolute;top: ${y + top + 10}px;left:${x + left + 10}px;width:${width}px;height:${height}px;" />`);
+            $("#rptCanvas").after(`<div id='templateSignature' data-ID='${orgTargetData.signature_name}' style="background-image:url('${orgTargetData.path}')  ;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;
         }