From 2757e52dbcdd01923b892dee0afb0208e2252b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B9=A6=E6=9F=B1?= Date: Sat, 25 Jun 2022 23:06:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E5=85=A5=E6=96=B0=E7=9A=84=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=8F=92=E4=BB=B6=EF=BC=8C=E4=BC=98=E5=8C=96=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=A4=B4=E7=9A=84=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- src/hiprint/hiprint.bundle.js | 41 ++++++++++++++++++----------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 83c930e..e62dbb3 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "jquery": "^3.6.0", "jsbarcode": "^3.11.5", "jspdf": "^2.5.1", - "socket.io-client": "^3.1.3" + "socket.io-client": "^3.1.3", + "sortablejs": "^1.15.0" }, "peerDependencies": { "@claviska/jquery-minicolors": "^2.3.6", diff --git a/src/hiprint/hiprint.bundle.js b/src/hiprint/hiprint.bundle.js index 3415b1c..a128093 100644 --- a/src/hiprint/hiprint.bundle.js +++ b/src/hiprint/hiprint.bundle.js @@ -37,6 +37,9 @@ function _typeof(obj) { */ window.$ = window.jQuery = require('jquery') window.autoConnect = true; + +//排序插件 +import Sortable from 'sortablejs'; // 调用浏览器打印js import './plugins/jquery.hiwprint.js' // js颜色选择 @@ -3749,7 +3752,9 @@ var hiprint = function (t) { return t.prototype.createTarget = function () { $('
').appendTo("body"); - return " \n \n ", this.target = $('
\n
\n
\n
\n
'), this.target; + + + return " \n \n ", this.target = $('
\n
\n
\n
\n
'), this.target; }, t.prototype.getValue = function () { return this.buildData(); }, t.prototype.setValue = function (t, e, n) { @@ -3764,9 +3769,11 @@ var hiprint = function (t) { var e = new rt.a(t); return e.checked = !1, e; }); - this.allColumns = t[0].columns.concat(r), t && 1 == t.length && (this.target.find("ul").html(this.allColumns.map(function (t, e) { + this.allColumns = t[0].columns.concat(r), + t && 1 == t.length && (this.target.find("ul").html(this.allColumns.map(function (t, e) { return '
  • \n ' + (t.checked ? '' : '') + '\n
    \n \n
    \n
    ' + (t.title || t.descTitle || "") + "
  • "; - }).join("")), this.target.find("input").change(function (e) { + }).join("")), + this.target.find("input").change(function (e) { var checked = e.target.checked, id = e.target.attributes['column-id'].nodeValue || ''; var idx = i.allColumns.findIndex(function (e) { return e.field == id || e.id == id; @@ -3775,23 +3782,17 @@ var hiprint = function (t) { i.allColumns[idx]['checked'] = checked } i.submit(); - }), this.printElementType.columnDisplayIndexEditable && this.target.find("li").hidraggable({ - revert: !0, - handle: ".column-title", - moveUnit: "pt", - deltaX: 0, - deltaY: 0 - }).hidroppable({ - onDragOver: function onDragOver(t, e) { - $(this).css("border-bottom-color", "red"); - }, - onDragLeave: function onDragLeave(t, e) { - $(this).css("border-bottom-color", ""); - }, - onDrop: function onDrop(t, e) { - $(e).insertAfter(this), $(this).css("border-bottom-color", ""), o.submit(); - } - })); + })), + this.printElementType.columnDisplayIndexEditable && Sortable.create(this.target.find('#hiprint-option-table-selected-columns')[0],{ + onEnd:function(evt){ + var temp = '' + temp = i.allColumns[evt.oldIndex] + i.allColumns[evt.oldIndex] = i.allColumns[evt.newIndex] + i.allColumns[evt.newIndex] = temp + console.log('更新了',evt,i) + i.submit() + } + }) }, t.prototype.buildData = function () { var t = this, e = t.allColumns; -- Gitee