Commit 9bd021af0168355117bf5412905501ac16fa30ce
1 parent
fdbb8bca
1、鼠标批量移动
Showing
2 changed files
with
57 additions
and
12 deletions
src/views/bigscreenDesigner/designer/index.vue
| ... | ... | @@ -43,6 +43,7 @@ |
| 43 | 43 | v-model="layerWidget" |
| 44 | 44 | @update="datadragEnd" |
| 45 | 45 | :options="{ animation: 300 }" |
| 46 | + group="groupA" | |
| 46 | 47 | > |
| 47 | 48 | <transition-group> |
| 48 | 49 | <div |
| ... | ... | @@ -266,7 +267,7 @@ |
| 266 | 267 | @onActivated="setOptionsOnClickWidget" |
| 267 | 268 | @contextmenu.prevent.native="rightClick($event, index)" |
| 268 | 269 | @mousedown.prevent.native="widgetsClick(index)" |
| 269 | - @mouseup.prevent.native="widgetsMouseup" | |
| 270 | + @mouseup.prevent.native="widgetsMouseup($event, index)" | |
| 270 | 271 | @keyup.delete.native="entryDelete(index)" |
| 271 | 272 | /> |
| 272 | 273 | </div> |
| ... | ... | @@ -1117,6 +1118,10 @@ export default { |
| 1117 | 1118 | return; |
| 1118 | 1119 | } |
| 1119 | 1120 | this.widgetIndex = obj.index; |
| 1121 | + let leftNew = obj.left; | |
| 1122 | + let topNew = obj.top; | |
| 1123 | + let leftOld = this.widgets[obj.index].value.position.left; | |
| 1124 | + let topOld = this.widgets[obj.index].value.position.top; | |
| 1120 | 1125 | this.widgets[obj.index].value.position = obj; |
| 1121 | 1126 | this.widgets[obj.index].options.position.forEach((el) => { |
| 1122 | 1127 | for (const key in obj) { |
| ... | ... | @@ -1126,6 +1131,10 @@ export default { |
| 1126 | 1131 | } |
| 1127 | 1132 | }); |
| 1128 | 1133 | this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]); |
| 1134 | + if(this.shiftEnt){ | |
| 1135 | + //批量移动 | |
| 1136 | + this.moveGroup(leftOld,leftNew,topOld,topNew); | |
| 1137 | + } | |
| 1129 | 1138 | }, |
| 1130 | 1139 | widgetsClick(index) { |
| 1131 | 1140 | const draggableArr = this.$refs.widgets; |
| ... | ... | @@ -1154,7 +1163,7 @@ export default { |
| 1154 | 1163 | this.grade = true; |
| 1155 | 1164 | this.widgetIndex = index; |
| 1156 | 1165 | }, |
| 1157 | - widgetsMouseup(e) { | |
| 1166 | + widgetsMouseup(event, index) { | |
| 1158 | 1167 | this.grade = false; |
| 1159 | 1168 | }, |
| 1160 | 1169 | handleMouseDown() { |
| ... | ... | @@ -1348,14 +1357,34 @@ export default { |
| 1348 | 1357 | this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]); |
| 1349 | 1358 | } |
| 1350 | 1359 | }, |
| 1360 | + showDialogBoxInput() { | |
| 1361 | + this.$prompt('请输入分组名称', '提示', | |
| 1362 | + {confirmButtonText: '确定',cancelButtonText: '取消'}).then(({ value }) => { | |
| 1363 | + if (!value || value.length > 20) { | |
| 1364 | + return this.$message.error('请输入不超过20字的分组名称') | |
| 1365 | + } | |
| 1366 | + const msg = "您输入了分组名称为:"+value; | |
| 1367 | + this.$message({type: 'info', message: msg}); | |
| 1368 | + | |
| 1369 | + //移除全选的选中 | |
| 1370 | + this.delSelectMore(); | |
| 1371 | + | |
| 1372 | + }).catch(() => { | |
| 1373 | + //this.$message({type: 'info', message: '取消操作'}); | |
| 1374 | + }) | |
| 1375 | + | |
| 1376 | + }, | |
| 1351 | 1377 | //添加分组 |
| 1352 | 1378 | addGroupLayer() { |
| 1353 | 1379 | // const obj = this.widgets[this.rightClickIndex]; |
| 1354 | 1380 | // this.$set(obj.value.position, "disabled", true); |
| 1355 | - this.$message({ | |
| 1356 | - type: "info", | |
| 1357 | - message: "小编正在努力开发中,尽情期待(可以选择多选后改变坐标移动哦)", | |
| 1358 | - }); | |
| 1381 | + // 显示输入弹框 | |
| 1382 | + this.showDialogBoxInput(); | |
| 1383 | + // this.$message({ | |
| 1384 | + // type: "info", | |
| 1385 | + // message: "小编正在努力开发中,尽情期待(可以选择多选后改变坐标移动哦)", | |
| 1386 | + // }); | |
| 1387 | + | |
| 1359 | 1388 | }, |
| 1360 | 1389 | //移除分组 |
| 1361 | 1390 | delGroupLayer() { |
| ... | ... | @@ -1387,6 +1416,16 @@ export default { |
| 1387 | 1416 | this.setShiftEntFalse(); |
| 1388 | 1417 | } |
| 1389 | 1418 | }, |
| 1419 | + //移除选中 | |
| 1420 | + delSelectMore(){ | |
| 1421 | + if(this.isNotBlankArray(this.selectMore)){ | |
| 1422 | + for(let i = 0; i< this.selectMore.length;i++){ | |
| 1423 | + const index = this.selectMore[i]; | |
| 1424 | + this.$refs.widgets[index].$refs.draggable.setActive(false); | |
| 1425 | + } | |
| 1426 | + this.setShiftEntFalse(); | |
| 1427 | + } | |
| 1428 | + }, | |
| 1390 | 1429 | //左对齐 |
| 1391 | 1430 | setAlignment() { |
| 1392 | 1431 | this.selectMore = this.setUnique(this.selectMore); | ... | ... |
src/views/bigscreenDesigner/designer/widget/widget.vue
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | :top="widgetsTop" |
| 9 | 9 | ref="draggable" |
| 10 | 10 | :index="index" |
| 11 | + :class="{block:widgetDisabled,unblock:!widgetDisabled}" | |
| 11 | 12 | @focus="handleFocus" |
| 12 | 13 | @blur="handleBlur" |
| 13 | 14 | > |
| ... | ... | @@ -170,7 +171,7 @@ export default { |
| 170 | 171 | this.$emit("onActivated", { index, left, top, width, height }); |
| 171 | 172 | this.$refs.draggable.setActive(true); |
| 172 | 173 | // 处理widget超出workbench的问题 |
| 173 | - //this.handleBoundary({ index, left, top, width, height }) | |
| 174 | + this.handleBoundary({ index, left, top, width, height }) | |
| 174 | 175 | }, |
| 175 | 176 | handleBoundary({ index, left, top, width, height }) { |
| 176 | 177 | // 计算workbench的X轴边界值 |
| ... | ... | @@ -200,13 +201,18 @@ export default { |
| 200 | 201 | .vue-draggalbe { |
| 201 | 202 | position: absolute; |
| 202 | 203 | } |
| 203 | - | |
| 204 | -.widget-active { | |
| 204 | +.avue-draggable--active { | |
| 205 | 205 | cursor: move; |
| 206 | - border: 1px dashed #09f; | |
| 207 | - background-color: rgba(115, 170, 229, 0.5); | |
| 206 | + //锁定颜色 | |
| 207 | + &.block { | |
| 208 | + border: 1px dashed #dc0404; | |
| 209 | + } | |
| 210 | + //未锁定颜色 | |
| 211 | + &.unblock{ | |
| 212 | + border: 1px dashed #09f; | |
| 213 | + } | |
| 214 | + background-color: rgba(115,170,229,.5); | |
| 208 | 215 | } |
| 209 | - | |
| 210 | 216 | .avue-draggable { |
| 211 | 217 | padding: 0 !important; |
| 212 | 218 | } | ... | ... |