ManualSorting.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="ManualSorting">
  3. <div
  4. v-for="(item,key) in sort"
  5. :key="key"
  6. class="flexBetween flexItemsC"
  7. style="width:100%;font-size:16px;height:30px;"
  8. >
  9. <div>
  10. <span>{{key+1}}</span>
  11. <span class="marleft20">{{item.deptName}}</span>
  12. </div>
  13. <div class="flexItemsC">
  14. <i
  15. @click="shangshen(key)"
  16. class="el-icon-top"
  17. :style="{'font-size':'20px','color':key==0 ?'#aaa':'#0A8CD5', 'cursor': key!=0?'pointer':'default'}"
  18. ></i>
  19. <i
  20. @click="xiajiang(key)"
  21. class="el-icon-bottom marleft5"
  22. :style="{'font-size':'20px','color':key==sort.length-1?'#aaa':'#0A8CD5', 'cursor': key!=sort.length-1?'pointer':'default'}"
  23. ></i>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. props: ['sort'],
  31. methods: {
  32. xiajiang (key) {
  33. if (key != this.sort.length - 1) {
  34. let da = this.sort[key]
  35. this.sort[key] = this.sort[key + 1]
  36. this.sort[key + 1] = da
  37. this.$emit('bianhua')
  38. }
  39. console.log(this.sort);
  40. },
  41. shangshen (key) {
  42. if (key != 0) {
  43. let da = this.sort[key]
  44. this.sort[key] = this.sort[key - 1]
  45. this.sort[key - 1] = da
  46. this.$emit('bianhua')
  47. }
  48. },
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .ManualSorting {
  54. width: 100%;
  55. height: 100%;
  56. }
  57. </style>