61ae9219b44df43e8c377de4acf19354ec74d600.svn-base 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <a-dropdown :trigger="['click']">
  3. <div class="j-vxe-ds-icons">
  4. <a-icon type="align-left"/>
  5. <a-icon type="align-right"/>
  6. </div>
  7. <!-- <div class="j-vxe-ds-btns">-->
  8. <!-- <a-button icon="caret-up" size="small" :disabled="disabledMoveUp" @click="handleRowMoveUp"/>-->
  9. <!-- <a-button icon="caret-down" size="small" :disabled="disabledMoveDown" @click="handleRowMoveDown"/>-->
  10. <!-- </div>-->
  11. <a-menu slot="overlay">
  12. <a-menu-item key="0" :disabled="disabledMoveUp" @click="handleRowMoveUp">向上移</a-menu-item>
  13. <a-menu-item key="1" :disabled="disabledMoveDown" @click="handleRowMoveDown">向下移</a-menu-item>
  14. <a-menu-divider/>
  15. <a-menu-item key="3" @click="handleRowInsertDown">插入一行</a-menu-item>
  16. </a-menu>
  17. </a-dropdown>
  18. </template>
  19. <script>
  20. import JVxeCellMixins from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
  21. export default {
  22. name: 'JVxeDragSortCell',
  23. mixins: [JVxeCellMixins],
  24. computed: {
  25. // 排序结果保存字段
  26. dragSortKey() {
  27. return this.renderOptions.dragSortKey || 'orderNum'
  28. },
  29. disabledMoveUp() {
  30. return this.rowIndex === 0
  31. },
  32. disabledMoveDown() {
  33. return this.rowIndex === (this.fullDataLength - 1)
  34. },
  35. },
  36. methods: {
  37. /** 向上移 */
  38. handleRowMoveUp(event) {
  39. // event.target.blur()
  40. if (!this.disabledMoveUp) {
  41. this.trigger('rowMoveUp', this.rowIndex)
  42. }
  43. },
  44. /** 向下移 */
  45. handleRowMoveDown(event) {
  46. // event.target.blur()
  47. if (!this.disabledMoveDown) {
  48. this.trigger('rowMoveDown', this.rowIndex)
  49. }
  50. },
  51. /** 插入一行 */
  52. handleRowInsertDown() {
  53. this.trigger('rowInsertDown', this.rowIndex)
  54. },
  55. },
  56. // 【组件增强】注释详见:JVxeCellMixins.js
  57. enhanced: {
  58. // 【功能开关】
  59. switches: {
  60. editRender: false
  61. },
  62. },
  63. }
  64. </script>
  65. <style lang="less">
  66. .j-vxe-ds-icons {
  67. position: relative;
  68. /*cursor: move;*/
  69. cursor: pointer;
  70. width: 14px;
  71. height: 100%;
  72. display: inline-block;
  73. .anticon-align-left,
  74. .anticon-align-right {
  75. position: absolute;
  76. top: 30%;
  77. }
  78. .anticon-align-left {
  79. left: 0;
  80. }
  81. .anticon-align-right {
  82. right: 0;
  83. }
  84. }
  85. .j-vxe-ds-btns {
  86. position: relative;
  87. cursor: pointer;
  88. width: 24px;
  89. height: 100%;
  90. display: flex;
  91. justify-content: center;
  92. flex-direction: column;
  93. align-content: center;
  94. .ant-btn {
  95. border: none;
  96. z-index: 0;
  97. padding: 0;
  98. width: 100%;
  99. /*height: 30%;*/
  100. height: 40%;
  101. display: block;
  102. border-radius: 0;
  103. &:hover {
  104. z-index: 1;
  105. /* height: 40%;*/
  106. /* & .anticon-caret-up,*/
  107. /* & .anticon-caret-down {*/
  108. /* top: 2px;*/
  109. /* }*/
  110. }
  111. &:last-child {
  112. margin-top: -1px;
  113. }
  114. & .anticon-caret-up,
  115. & .anticon-caret-down {
  116. vertical-align: top;
  117. position: relative;
  118. top: 0;
  119. transition: top 0.3s;
  120. }
  121. }
  122. }
  123. </style>