diff --git a/package.json b/package.json index 83c930e537f928a25013719bc8632329d20d5476..e62dbb375110ae1e068899f1811cb5a7d047abc4 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 3415b1ce6324ff73d84cee67c982433651e9f914..a128093b2089181b506280bf2d04fa2ef9035388 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;