leftBox.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <div>
  3. <boxTop title="打孔机管理" />
  4. <div class="leftBox">
  5. <div class="search-bar">
  6. <input
  7. v-model="leftBox.input"
  8. type="text"
  9. placeholder="输入关键字进行搜索"
  10. @keyup.enter="searchFn"
  11. />
  12. <div class="icons">
  13. <span class="icon i-mdi-search" @click="searchFn"></span>
  14. <span class="icon i-mdi-delete" @click="clearFn"></span>
  15. <span class="icon i-mdi-swap-horizontal" @click="sortFn"></span>
  16. </div>
  17. </div>
  18. <item class="listItem" :list="leftBox.list" />
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import item from './item.vue'
  24. import boxTop from '@/components/boxTop/index.vue'
  25. export default {
  26. data() {
  27. return {
  28. leftBox: {
  29. input: ``,
  30. list: [],
  31. sortIndex: 0,
  32. sortList: [`投入时间`, `状态`],
  33. },
  34. }
  35. },
  36. components: {
  37. boxTop,
  38. item,
  39. },
  40. async created() {
  41. this.searchFn()
  42. },
  43. methods: {
  44. async searchFn() {
  45. console.log(`search`, this.leftBox.input)
  46. const data = await this.$http.get(`/holePunchingMachine`, {
  47. params: {
  48. _sort:
  49. this.leftBox.sortList[
  50. this.leftBox.sortIndex % this.leftBox.sortList.length
  51. ] || undefined,
  52. 名称_like: this.leftBox.input || undefined,
  53. },
  54. })
  55. this.leftBox.list = data
  56. },
  57. clearFn() {
  58. this.leftBox.input = ``
  59. this.searchFn()
  60. console.log(`clearFn`)
  61. },
  62. sortFn() {
  63. this.leftBox.sortIndex++
  64. this.searchFn()
  65. console.log(`sortFn`)
  66. },
  67. },
  68. }
  69. </script>
  70. <style lang="less" scoped>
  71. .leftBox {
  72. background: rgba(48, 42, 42, 0.3);
  73. backdrop-filter: blur(8px);
  74. .listItem {
  75. height: 800px;
  76. }
  77. .search-bar {
  78. display: flex;
  79. align-items: center;
  80. background-color: #2c2f3f;
  81. height: 48px;
  82. padding: 10px;
  83. border-radius: 4px;
  84. background: rgba(37, 34, 59, 0.31);
  85. border: 0.5px solid;
  86. box-sizing: border-box;
  87. border-image: linear-gradient(
  88. 180deg,
  89. #8a8989,
  90. #bec1cc 27%,
  91. rgba(255, 255, 255, 0.72) 59%,
  92. #bec1cc 82%,
  93. rgba(255, 255, 255, 0.76) 99%
  94. )
  95. 0.5 0.5;
  96. input {
  97. flex: 1;
  98. padding: 10px;
  99. border: none;
  100. background-color: transparent;
  101. color: #fff;
  102. font-size: 14px;
  103. height: 35px;
  104. line-height: 35px;
  105. outline: none;
  106. }
  107. .icons {
  108. display: flex;
  109. align-items: center;
  110. margin-left: 10px;
  111. span {
  112. margin-right: 10px;
  113. color: #fff;
  114. font-size: 18px;
  115. }
  116. .icon {
  117. cursor: pointer;
  118. }
  119. }
  120. }
  121. }
  122. </style>