sh4wmoo 2 lat temu
rodzic
commit
042051a7cf

+ 4 - 2
package.json

@@ -11,7 +11,8 @@
     "build_lib": "vue-cli-service build --target dk --name dk dk/index.js",
     "lint": "vue-cli-service lint",
     "test:unit": "vue-cli-service test:unit",
-    "test:e2e": "vue-cli-service test:e2e"
+    "test:e2e": "vue-cli-service test:e2e",
+    "postinstall": "patch-package"
   },
   "dependencies": {
     "@antv/x6": "2.2.1",
@@ -46,6 +47,7 @@
     "js-md5": "^0.7.3",
     "jspdf": "^2.5.1",
     "lib-flexible": "^0.3.2",
+    "patch-package": "^7.0.2",
     "qrcodejs2": "0.0.2",
     "quill": "^1.3.7",
     "quill-image-drop-module": "^1.0.3",
@@ -67,7 +69,7 @@
     "vue-excel-table": "^3.1.28",
     "vue-i18n": "^7.8.0",
     "vue-jsonp": "^2.0.0",
-    "vue-plugin-hiprint": "0.0.53-beta11",
+    "vue-plugin-hiprint": "0.0.54-fix",
     "vue-printjs": "^1.0.0",
     "vue-property-decorator": "^9.1.2",
     "vue-quill-editor": "^3.0.6",

Plik diff jest za duży
+ 5 - 0
patches/vue-plugin-hiprint+0.0.54-fix.patch


+ 221 - 13
src/view/mst/label-print-layout/layout-setting.vue

@@ -500,8 +500,14 @@ export default {
       // 替换配置
       hiprint.setConfig({
         optionItems: [
-          this.fieldSetting()
+          //重写数据源
+          this.fieldSetting(),
+          //自定义元素位置坐标(mm)
+          this.coordinateMM(),
+          //自定义元素宽高大小(mm)
+          this.widthHeightMM(),
         ],
+        //隐藏的项目
         panel: {
           supportOptions: [
             { name: 'panelPaperRule', hidden: true },
@@ -516,16 +522,102 @@ export default {
             { name: 'paperNumberContinue', hidden: true },
           ]
         },
-        // qrcode:{
-          // tabs: [
-          //   {
-          //     name: '边框', // 可调整名称
-          //     // 整体替换: 相当于移除所有options, 重新插入新的参数
-          //     replace: true,
-          //     options: []
-          //   }
-          // ]
-        // }
+        //自定义项目
+        text:{
+          tabs:[
+            {
+              name:'基础',
+              options:[
+                {
+                  name:'coordinateMM',
+                  after:'coordinate',
+                  hidden:false,
+                },
+                {
+                  name:'widthHeightMM',
+                  after:'widthHeight',
+                  hidden:false,
+                }
+              ]
+            }
+          ],
+        },
+        hline:{
+          tabs:[
+            {
+              name:'基础',
+              options:[
+                {
+                  name:'coordinateMM',
+                  after:'coordinate',
+                  hidden:false,
+                },
+                {
+                  name:'widthHeightMM',
+                  after:'widthHeight',
+                  hidden:false,
+                }
+              ]
+            }
+          ],
+        },
+        vline:{
+          tabs:[
+            {
+              name:'基础',
+              options:[
+                {
+                  name:'coordinateMM',
+                  after:'coordinate',
+                  hidden:false,
+                },
+                {
+                  name:'widthHeightMM',
+                  after:'widthHeight',
+                  hidden:false,
+                }
+              ]
+            }
+          ],
+        },
+        rect:{
+          tabs:[
+            {
+              name:'基础',
+              options:[
+                {
+                  name:'coordinateMM',
+                  after:'coordinate',
+                  hidden:false,
+                },
+                {
+                  name:'widthHeightMM',
+                  after:'widthHeight',
+                  hidden:false,
+                }
+              ]
+            }
+          ],
+        },
+        oval:{
+          tabs:[
+            {
+              name:'基础',
+              options:[
+                {
+                  name:'coordinateMM',
+                  after:'coordinate',
+                  hidden:false,
+                },
+                {
+                  name:'widthHeightMM',
+                  after:'widthHeight',
+                  hidden:false,
+                }
+              ]
+            }
+          ],
+        },
       })
 
       //定义模板默认值,默认隐藏页码
@@ -589,7 +681,7 @@ export default {
 
       // 涉及修改元素样式, 添加一个 css 方法
       return t.prototype.createTarget = function () {
-        console.log('fieldSetting', self.labelPrintItemList)
+        // console.log('fieldSetting', self.labelPrintItemList)
         let list = '\n            <option value="" >无</option>'
         self.labelPrintItemList.forEach(it => {
           list += '\n            <option value="' + it.dataKey + '">' + it.itemName + '</option>'
@@ -627,7 +719,7 @@ export default {
         },
         // 设置值
         t.prototype.setValue = function (t) {
-          console.log('setValue', t)
+          // console.log('setValue', t)
           t && (this.target.find('option[value="' + t + '"]').length || this.target.find('select').prepend('<option value="' + t + '" >' + t + '</option>'))
           this.target.find('select').val(t)
         },
@@ -638,6 +730,122 @@ export default {
     },
 
     /**
+     * @desc   : 自定义参数 - 元素位置坐标(mm)
+     * @author : 张潇木
+     * @date   : 2023/7/24 10:28
+     */
+    coordinateMM(){
+      let self =this
+
+      function t() {
+        this.name = "coordinateMM";
+      }
+
+      return t.prototype.createTarget = function (t, o) {
+        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;justify-content: space-between">\n        ' +
+          '<input type="number" style="width:48%" placeholder="X位置(左)" class="auto-submit" />\n        ' +
+          '<input type="number" style="width:48%" placeholder="Y位置(上)" class="auto-submit" />\n        ' +
+          '</div>\n' +
+          '</div>');
+        return n.target;
+      },
+
+      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");
+        }
+        return null;
+      },
+
+      t.prototype.getValue = function () {
+        var v = {
+          left: 0,
+          top: 0,
+        }
+        v.left = parseFloat(this.target.find("input:first").val() || 0)
+        v.top = parseFloat(this.target.find("input:last").val() || 0)
+        return v;
+      },
+
+      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));
+      },
+
+      t.prototype.destroy = function () {
+        this.target.remove();
+      }, t;
+    },
+
+    /**
+     * @desc   : 自定义参数 - 元素宽高大小(mm)
+     * @author : 张潇木
+     * @date   : 2023/7/25 11:27
+     */
+    widthHeightMM(){
+      let self =this
+
+      function t() {
+        this.name = "widthHeightMM";
+      }
+
+      return t.prototype.createTarget = function (t, o) {
+        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        ' +
+          '<input type="number" style="width:48%" placeholder="宽" class="auto-submit" />\n        ' +
+          '<input type="number" style="width:48%" placeholder="高" class="auto-submit" />\n        ' +
+          '</div>\n' +
+          '</div>');
+        return n.target;
+      },
+
+        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");
+          }
+          return null;
+        },
+
+        t.prototype.getValue = function () {
+          var v = {
+            width: 0,
+            height: 0,
+          }
+          v.width = parseFloat(this.target.find("input:first").val() || 0)
+          v.height = parseFloat(this.target.find("input:last").val() || 0)
+          return v;
+        },
+
+        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));
+        },
+
+        t.prototype.destroy = function () {
+          this.target.remove();
+        }, t;
+    },
+
+    /**
      * @desc   : 联动处理,自动带出标题,测试数据
      * @author : 张潇木
      * @date   : 2023/6/26 16:26

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików