index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="index_container">
  3. <view class="search_container">
  4. <uni-row>
  5. <uni-col :xs="6" :sm="4">
  6. <view class="popup_button_container">
  7. <button @click="openPopup" class="button">{{ searchItem }}</button>
  8. </view>
  9. </uni-col>
  10. <uni-col :xs="18" :sm="20">
  11. <view class="search_bar">
  12. <uni-search-bar placeholder="搜索栏" @confirm="search" @cancel="searchCancel" @blur="searchOnBlur">
  13. <template v-slot:searchIcon>
  14. <uni-icons type="search" size="30"></uni-icons>
  15. </template>
  16. <template v-slot:clearIcon>
  17. <uni-icons type="clear" size="30"></uni-icons>
  18. </template>
  19. </uni-search-bar>
  20. </view>
  21. </uni-col>
  22. </uni-row>
  23. </view>
  24. <view class="segmented_control_container">
  25. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
  26. activeColor="#409eff"></uni-segmented-control>
  27. </view>
  28. <view class="process_list">
  29. <process-list :processes="processes"></process-list>
  30. </view>
  31. <view class="popup_container">
  32. <uni-popup ref="searchItemPopup" type="bottom">
  33. <uni-list>
  34. <uni-list-item @click="clickSearchItem(item)" v-for="(item, index) in candidates" :key="index" clickable :title="item">
  35. </uni-list-item>
  36. </uni-list>
  37. </uni-popup>
  38. </view>
  39. </view>
  40. </template>
  41. <script setup lang="ts">
  42. import processList from '@/components/ygoa/processList.vue'
  43. import { onMounted, reactive, ref } from 'vue';
  44. const items = reactive(['待办', '在办', '办结', '我的'])
  45. let processes = reactive([])
  46. const current = ref(-1)
  47. onMounted(() => {
  48. onClickItem({ currentIndex: 0 })
  49. candidates.value.push('全局', '请假日期', '天数')
  50. })
  51. const searchItem = ref('请假日期')
  52. const candidates = ref([])
  53. const searchItemPopup = ref(null)
  54. function openPopup() { // 打开搜索项弹出层
  55. searchItemPopup.value.open()
  56. }
  57. function closePopup() { // 关闭搜索项弹出层
  58. searchItemPopup.value.close()
  59. }
  60. function clickSearchItem(item) {
  61. searchItem.value = item
  62. closePopup()
  63. }
  64. function search(e) { // 搜索
  65. console.log('search', e)
  66. }
  67. function searchCancel() { // 取消搜索
  68. return
  69. }
  70. function searchOnBlur(e) { // 搜索栏失去焦点
  71. console.log('searchOnBlur', e);
  72. }
  73. function onClickItem({ currentIndex }) {
  74. current.value = currentIndex
  75. switch (currentIndex) {
  76. case 0:
  77. processes = [
  78. {
  79. id: 1,
  80. title: '账户1 的请假申请',
  81. user: '账户1',
  82. createTime: '2024/10/10',
  83. startTime: '2024/10/10',
  84. endTime: '2024/10/12',
  85. totalTime: '2',
  86. description: '请假说明请假说明请假说明请假说明请假说明',
  87. type: 'icon-apply-leave',
  88. step: 0
  89. },
  90. {
  91. id: 1,
  92. title: '账户2 的请假申请',
  93. user: '账户2',
  94. createTime: '2024/10/10',
  95. startTime: '2024/10/10',
  96. endTime: '2024/10/12',
  97. totalTime: '2',
  98. description: '请假说明请假说明',
  99. type: 'icon-apply-leave',
  100. step: 0
  101. }
  102. ]
  103. break;
  104. case 1:
  105. processes = []
  106. break;
  107. case 2:
  108. processes = []
  109. break;
  110. case 3:
  111. processes = []
  112. break;
  113. }
  114. }
  115. </script>
  116. <style lang="scss">
  117. @import url("@/static/font/ygoa/iconfont.css");
  118. .iconfont {
  119. font-size: 3rem;
  120. }
  121. .search_container {
  122. .popup_button_container {
  123. width: 100%;
  124. padding-top: 10px;
  125. .button {
  126. font-size: 14px;
  127. font-weight: bold;
  128. color: #ffffff;
  129. background-color: #1aad19;
  130. height: 36px;
  131. width: 100%;
  132. }
  133. }
  134. .search_bar {
  135. ::v-deep .uni-searchbar {
  136. padding-left: 0;
  137. }
  138. }
  139. }
  140. .segmented_control_container {}
  141. </style>