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,6 +43,7 @@ | ||
| 43 | v-model="layerWidget" | 43 | v-model="layerWidget" |
| 44 | @update="datadragEnd" | 44 | @update="datadragEnd" |
| 45 | :options="{ animation: 300 }" | 45 | :options="{ animation: 300 }" |
| 46 | + group="groupA" | ||
| 46 | > | 47 | > |
| 47 | <transition-group> | 48 | <transition-group> |
| 48 | <div | 49 | <div |
| @@ -266,7 +267,7 @@ | @@ -266,7 +267,7 @@ | ||
| 266 | @onActivated="setOptionsOnClickWidget" | 267 | @onActivated="setOptionsOnClickWidget" |
| 267 | @contextmenu.prevent.native="rightClick($event, index)" | 268 | @contextmenu.prevent.native="rightClick($event, index)" |
| 268 | @mousedown.prevent.native="widgetsClick(index)" | 269 | @mousedown.prevent.native="widgetsClick(index)" |
| 269 | - @mouseup.prevent.native="widgetsMouseup" | 270 | + @mouseup.prevent.native="widgetsMouseup($event, index)" |
| 270 | @keyup.delete.native="entryDelete(index)" | 271 | @keyup.delete.native="entryDelete(index)" |
| 271 | /> | 272 | /> |
| 272 | </div> | 273 | </div> |
| @@ -1117,6 +1118,10 @@ export default { | @@ -1117,6 +1118,10 @@ export default { | ||
| 1117 | return; | 1118 | return; |
| 1118 | } | 1119 | } |
| 1119 | this.widgetIndex = obj.index; | 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 | this.widgets[obj.index].value.position = obj; | 1125 | this.widgets[obj.index].value.position = obj; |
| 1121 | this.widgets[obj.index].options.position.forEach((el) => { | 1126 | this.widgets[obj.index].options.position.forEach((el) => { |
| 1122 | for (const key in obj) { | 1127 | for (const key in obj) { |
| @@ -1126,6 +1131,10 @@ export default { | @@ -1126,6 +1131,10 @@ export default { | ||
| 1126 | } | 1131 | } |
| 1127 | }); | 1132 | }); |
| 1128 | this.widgetOptions = this.deepClone(this.widgets[obj.index]["options"]); | 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 | widgetsClick(index) { | 1139 | widgetsClick(index) { |
| 1131 | const draggableArr = this.$refs.widgets; | 1140 | const draggableArr = this.$refs.widgets; |
| @@ -1154,7 +1163,7 @@ export default { | @@ -1154,7 +1163,7 @@ export default { | ||
| 1154 | this.grade = true; | 1163 | this.grade = true; |
| 1155 | this.widgetIndex = index; | 1164 | this.widgetIndex = index; |
| 1156 | }, | 1165 | }, |
| 1157 | - widgetsMouseup(e) { | 1166 | + widgetsMouseup(event, index) { |
| 1158 | this.grade = false; | 1167 | this.grade = false; |
| 1159 | }, | 1168 | }, |
| 1160 | handleMouseDown() { | 1169 | handleMouseDown() { |
| @@ -1348,14 +1357,34 @@ export default { | @@ -1348,14 +1357,34 @@ export default { | ||
| 1348 | this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]); | 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 | addGroupLayer() { | 1378 | addGroupLayer() { |
| 1353 | // const obj = this.widgets[this.rightClickIndex]; | 1379 | // const obj = this.widgets[this.rightClickIndex]; |
| 1354 | // this.$set(obj.value.position, "disabled", true); | 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 | delGroupLayer() { | 1390 | delGroupLayer() { |
| @@ -1387,6 +1416,16 @@ export default { | @@ -1387,6 +1416,16 @@ export default { | ||
| 1387 | this.setShiftEntFalse(); | 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 | setAlignment() { | 1430 | setAlignment() { |
| 1392 | this.selectMore = this.setUnique(this.selectMore); | 1431 | this.selectMore = this.setUnique(this.selectMore); |
src/views/bigscreenDesigner/designer/widget/widget.vue
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | :top="widgetsTop" | 8 | :top="widgetsTop" |
| 9 | ref="draggable" | 9 | ref="draggable" |
| 10 | :index="index" | 10 | :index="index" |
| 11 | + :class="{block:widgetDisabled,unblock:!widgetDisabled}" | ||
| 11 | @focus="handleFocus" | 12 | @focus="handleFocus" |
| 12 | @blur="handleBlur" | 13 | @blur="handleBlur" |
| 13 | > | 14 | > |
| @@ -170,7 +171,7 @@ export default { | @@ -170,7 +171,7 @@ export default { | ||
| 170 | this.$emit("onActivated", { index, left, top, width, height }); | 171 | this.$emit("onActivated", { index, left, top, width, height }); |
| 171 | this.$refs.draggable.setActive(true); | 172 | this.$refs.draggable.setActive(true); |
| 172 | // 处理widget超出workbench的问题 | 173 | // 处理widget超出workbench的问题 |
| 173 | - //this.handleBoundary({ index, left, top, width, height }) | 174 | + this.handleBoundary({ index, left, top, width, height }) |
| 174 | }, | 175 | }, |
| 175 | handleBoundary({ index, left, top, width, height }) { | 176 | handleBoundary({ index, left, top, width, height }) { |
| 176 | // 计算workbench的X轴边界值 | 177 | // 计算workbench的X轴边界值 |
| @@ -200,13 +201,18 @@ export default { | @@ -200,13 +201,18 @@ export default { | ||
| 200 | .vue-draggalbe { | 201 | .vue-draggalbe { |
| 201 | position: absolute; | 202 | position: absolute; |
| 202 | } | 203 | } |
| 203 | - | ||
| 204 | -.widget-active { | 204 | +.avue-draggable--active { |
| 205 | cursor: move; | 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 | .avue-draggable { | 216 | .avue-draggable { |
| 211 | padding: 0 !important; | 217 | padding: 0 !important; |
| 212 | } | 218 | } |