From ed04c24eb35a16c122e4c32b2cc703b5c385760f Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 1 Apr 2020 09:52:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=88=97?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=8B=96=E5=8A=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/package.json | 1 + ruoyi-ui/src/assets/styles/ruoyi.scss | 7 +++++++ ruoyi-ui/src/views/tool/gen/editTable.vue | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 923126cc..62c2bddb 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -54,6 +54,7 @@ "nprogress": "0.2.0", "path-to-regexp": "2.4.0", "screenfull": "4.2.0", + "sortablejs": "1.8.4", "vue": "2.6.10", "vue-count-to": "1.0.13", "vue-quill-editor": "3.0.6", diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss index 77307e57..42d90a60 100644 --- a/ruoyi-ui/src/assets/styles/ruoyi.scss +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -187,4 +187,11 @@ border-radius: 50%; box-shadow: 0 0 4px #ccc; overflow: hidden; +} + +/* 拖拽列样式 */ +.sortable-ghost{ + opacity: .8; + color: #fff!important; + background: #42b983!important; } \ No newline at end of file diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue index cf76a27d..6f950814 100644 --- a/ruoyi-ui/src/views/tool/gen/editTable.vue +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -5,7 +5,7 @@ - + table > tbody")[0]; + const sortable = Sortable.create(el, { + onEnd: evt => { + const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0]; + this.cloumns.splice(evt.newIndex, 0, targetRow); + for (let index in this.cloumns) { + this.cloumns[index].sort = parseInt(index) + 1; + } + } + }); } };