diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 923126c..62c2bdd 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 77307e5..42d90a6 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 cf76a27..6f95081 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; + } + } + }); } };