vue自定义元素拖动

Dear 丶 2021-12-24 09:29 450阅读 0赞

岗位序列拖动交换岗位

  1. <span
  2. draggable="true"
  3. @dragstart="onDragstart($event,index,index2)"
  4. @dragend="onDragend($event)"
  5. @dragover="onDragover($event)"
  6. @drop="onDrop($event,index,index2)"
  7. slot="reference"
  8. @click="showPositonEdit(sequence,index)"
  9. :class="['el-btn-position',sequence.showNodes.length>=2?'el-btn-position-plus':'',sequence.showItem.showPosTag?'position_tag':'']"
  10. :style="{zIndex:sequence.showItem.highLightIndex?'6':'auto'}"
  11. :title="sequence.showNodes.length>=2?'':sequence.showItem.positionName"
  12. >
  13. {
  14. {sequence.showItem.positionName.substring(0,6)}}
  15. <span
  16. v-if="sequence.showNodes.length>=2 && !sequence.showItem.showPosTag"
  17. class="icon_num"
  18. >{
  19. {sequence.showNodes.length}}</span>
  20. </span>
  21. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  22. // 拖动
  23. onDragstart (e, index, index2) {
  24. this.tempDragObj = {}
  25. this.dragObj.fromMapId = ''
  26. this.dragObj.toGradeId = ''
  27. this.dragObj.toSeriesId = ''
  28. const { pid } = this.queryId(index, index2)
  29. this.dragObj.fromMapId = pid
  30. },
  31. async onDragend (e) {
  32. if (this.dragFlag) {
  33. await movePosition(this.dragObj).catch(e => console.error(e))
  34. await this.getMap(this.id).catch(e => console.error(e))
  35. // 行为日志
  36. let logData = {
  37. method: this.METHOD.MODIFY,
  38. description: this.DESCRIPTION.SINGLE,
  39. referstr1: this.dragObj,
  40. logcontent: '拖拽岗位交换位置'
  41. }
  42. this.sendBehaviorLog(logData)
  43. // this.dragFlag = false
  44. this.$emit('update:dragFlag', false)
  45. }
  46. },
  47. onDragover (e) {
  48. e.preventDefault()
  49. },
  50. onDrop (e, index, index2) {
  51. // this.dragFlag = true
  52. this.$emit('update:dragFlag', true)
  53. const { sequenceId, gradeId } = this.queryId(index, index2)
  54. this.dragObj.toGradeId = gradeId
  55. this.dragObj.toSeriesId = sequenceId
  56. },

转载于:https://www.cnblogs.com/raind/p/11081325.html

发表评论

表情:
评论列表 (有 0 条评论,450人围观)

还没有评论,来说两句吧...

相关阅读