فهرست منبع

修改mm单位对打印预览的影响

sh4wmoo 2 سال پیش
والد
کامیت
9f9ef5e05f
1فایلهای تغییر یافته به همراه31 افزوده شده و 19 حذف شده
  1. 31 19
      src/view/mst/label-print-layout/layout-setting.vue

+ 31 - 19
src/view/mst/label-print-layout/layout-setting.vue

@@ -576,6 +576,7 @@ export default {
                   after:'widthHeight',
                   hidden:false,
                 }
+
               ]
             }
           ],
@@ -595,6 +596,7 @@ export default {
                   after:'widthHeight',
                   hidden:false,
                 }
+
               ]
             }
           ],
@@ -756,12 +758,15 @@ export default {
       t.prototype.css = function (t) {
         if (t && t.length && this.target) {
           // 仅当前元素被选中才更新坐标位置, 以避免冲突
-          var v = this.getValue();
-          // 设置option值,避免再次点击的时值错乱
-          self.hiprintTemplate.getSelectEls()[0].options.left=hinnn.mm.toPt(v.left)
-          self.hiprintTemplate.getSelectEls()[0].options.top=hinnn.mm.toPt(v.top)
-          // 位置调整
-          return t.css("left", hinnn.mm.toPt(v.left)+"pt").css("top", hinnn.mm.toPt(v.top)+"pt");
+          if (('block' == t.find('.resize-panel').css('display') || t[0].className.includes('table')) ) {
+            var v = this.getValue();
+            // 设置option值,避免再次点击的时值错乱
+            self.hiprintTemplate.getSelectEls()[0].options.left=hinnn.mm.toPt(v.left)
+            self.hiprintTemplate.getSelectEls()[0].options.top=hinnn.mm.toPt(v.top)
+            // 位置调整
+            return t.css("left", hinnn.mm.toPt(v.left)+"pt").css("top", hinnn.mm.toPt(v.top)+"pt");
+          }
+
         }
         return null;
       },
@@ -777,9 +782,12 @@ export default {
       },
 
       t.prototype.setValue = function (t, el) {
-        let { left , top }=self.hiprintTemplate.getSelectEls()?.[0]?.options
-        this.target.find("input:first").val(hinnn.pt.toMm(left));
-        this.target.find("input:last").val(hinnn.pt.toMm(top));
+        self.$nextTick(()=>{
+          let { left , top }=self.hiprintTemplate.getSelectEls()?.[0]?.options
+          console.log( left , top)
+          this.target.find("input:first").val(hinnn.pt.toMm(left));
+          this.target.find("input:last").val(hinnn.pt.toMm(top));
+        })
       },
 
       t.prototype.destroy = function () {
@@ -803,7 +811,7 @@ export default {
         var n = this;
         n.target = $('<div class="hiprint-option-item hiprint-option-item-row">' +
           '<div class="hiprint-option-item-label">\n        宽高大小(mm)\n        </div>' +
-          '<div class="hiprint-option-item-field" style="display: flex;align-items: baseline;">\n        ' +
+          '<div class="hiprint-option-item-field" style="display: flex;align-items: baseline;justify-content: space-between">\n        ' +
           '<input type="number" style="width:48%" placeholder="宽" class="auto-submit" />\n        ' +
           '<input type="number" style="width:48%" placeholder="高" class="auto-submit" />\n        ' +
           '</div>\n' +
@@ -814,12 +822,14 @@ export default {
         t.prototype.css = function (t) {
           if (t && t.length && this.target) {
             // 仅当前元素被选中才更新宽高大小, 以避免冲突
-            var v = this.getValue();
-            // 设置option值,避免再次点击的时值错乱
-            self.hiprintTemplate.getSelectEls()[0].options.width=hinnn.mm.toPt(v.width)
-            self.hiprintTemplate.getSelectEls()[0].options.height=hinnn.mm.toPt(v.height)
-            // 位置调整
-            return t.css("width", hinnn.mm.toPt(v.width)+"pt").css("height", hinnn.mm.toPt(v.height)+"pt");
+            if (('block' == t.find('.resize-panel').css('display') || t[0].className.includes('table')) ) {
+              var v = this.getValue();
+              // 设置option值,避免再次点击的时值错乱
+              self.hiprintTemplate.getSelectEls()[0].options.width=hinnn.mm.toPt(v.width)
+              self.hiprintTemplate.getSelectEls()[0].options.height=hinnn.mm.toPt(v.height)
+              // 位置调整
+              return t.css("width", hinnn.mm.toPt(v.width)+"pt").css("height", hinnn.mm.toPt(v.height)+"pt");
+            }
           }
           return null;
         },
@@ -835,9 +845,11 @@ export default {
         },
 
         t.prototype.setValue = function (t, el) {
-          let { width , height }=self.hiprintTemplate.getSelectEls()?.[0]?.options
-          this.target.find("input:first").val(hinnn.pt.toMm(width));
-          this.target.find("input:last").val(hinnn.pt.toMm(height));
+          self.$nextTick(()=>{
+            let { width , height }=self.hiprintTemplate.getSelectEls()?.[0]?.options
+            this.target.find("input:first").val(hinnn.pt.toMm(width));
+            this.target.find("input:last").val(hinnn.pt.toMm(height));
+          })
         },
 
         t.prototype.destroy = function () {