index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <view class="switchRecord-container">
  3. <!--顶部导航栏-->
  4. <scroll-view class="scroll-view" scroll-x="true" @scroll="scroll">
  5. <view class="scroll-view-item" v-for="(tab,index) in tabBars" :key="tab.id" :id="tab.id" :class="navIndex==index ? 'activite' : ''" @tap="checkIndex(index)">
  6. {{tab.name}}
  7. </view>
  8. </scroll-view>
  9. <!-- 内容 -->
  10. <swiper :current="navIndex" @change="tabChange" class="swiper_content">
  11. <swiper-item class="swiper_item">
  12. <FeedbackList :listArray="listArray" @click="onClick" />
  13. </swiper-item>
  14. <swiper-item class="swiper_item ">
  15. <FeedbackList :listArray="listArray" @click="onClick" />
  16. </swiper-item>
  17. <swiper-item class="swiper_item ">
  18. <FeedbackList :listArray="listArray" @click="onClick" />
  19. </swiper-item>
  20. <swiper-item class="swiper_item ">
  21. <FeedbackList :listArray="listArray" @click="onClick" />
  22. </swiper-item>
  23. </swiper>
  24. <!-- 新增 -->
  25. <view class="feedback-add-icon" @click="onClickAdd">
  26. <image class="add-icon" src="/static/image/add-icon.svg" mode="aspectFit"></image>
  27. </view>
  28. </view>
  29. </template>
  30. <script setup lang="ts">
  31. import { ref,onMounted } from "vue"
  32. import * as link from '@/lib/link'
  33. import rest from '@/stores/rest'
  34. import { formatDate } from '@/lib/util'
  35. import FeedbackList from './FeedbackList.vue'
  36. const queryParams = ref({
  37. pageNo: 1,
  38. pageSize: 10,
  39. fkzt: '',
  40. })
  41. const scrollTop = ref(0)
  42. const navIndex = ref(0)
  43. const tabBars = ref([
  44. {
  45. name:'全部',
  46. id: 0
  47. },
  48. {
  49. name:'待受理',
  50. id: 1
  51. },
  52. {
  53. name:'受理中 ',
  54. id: 2
  55. },
  56. {
  57. name:'已办结 ',
  58. id: 3
  59. }
  60. ])
  61. const scroll = (e: any) => {
  62. console.log("scroll",e);
  63. scrollTop.value = e.detail.scrollTop;
  64. };
  65. const checkIndex = (idx:number) => {
  66. if (navIndex.value !== idx){
  67. navIndex.value = idx;
  68. switch (idx) {
  69. case 0:
  70. queryParams.value.fkzt = ''
  71. break;
  72. case 1:
  73. queryParams.value.fkzt = '1'
  74. break;
  75. case 2:
  76. queryParams.value.fkzt = '2'
  77. break;
  78. case 3:
  79. queryParams.value.fkzt = '3'
  80. break;
  81. }
  82. getList()
  83. }
  84. }
  85. const tabChange = async(e:any) => {
  86. let _idx = e.detail.current
  87. checkIndex(_idx)
  88. }
  89. const listArray = ref([])
  90. const list = ref() //处方列表
  91. const total = ref(0)
  92. const getList = async () => {
  93. try {
  94. console.log("此时的",queryParams.value)
  95. // loaded.value = true;
  96. let res = await rest.get('/admin-api/zyyp/feedback/page', queryParams.value)
  97. let _list = res.list
  98. if (queryParams.value.pageNo === 1) {
  99. list.value = _list;
  100. } else {
  101. list.value = list.value.concat(_list);
  102. }
  103. getFormattedData(list.value)
  104. total.value = res.total
  105. if (res.total && queryParams.value.pageNo >= total.value / queryParams.value.pageSize) {
  106. status.value = "noMore"
  107. }
  108. } catch (e) {
  109. } finally {
  110. }
  111. }
  112. const titleArray = [
  113. { title: '办件编号', key: 'id' },
  114. { title: '登记时间', key: 'createTime' },
  115. ];
  116. const getFormattedData = (listData) => {
  117. const formattedData = listData.map(item => {
  118. const formattedItem = titleArray.map(titleItem => {
  119. let value = item[titleItem.key];
  120. if (titleItem.key === 'createTime') {
  121. value = formatDate(item[titleItem.key], '{y}-{m}-{d} {h}:{i}:{s}');
  122. }
  123. return {
  124. title: titleItem.title,
  125. value: value
  126. };
  127. });
  128. return {
  129. ...item,
  130. title: '中医用药一件事反馈登记',
  131. formattedData: formattedItem ,
  132. };
  133. });
  134. listArray.value = formattedData;
  135. };
  136. const onClick = (e)=> {
  137. link.goBJDetails(e.id)
  138. }
  139. const onClickAdd = ()=> {
  140. link.goBJDetails()
  141. }
  142. // 页面每次加载
  143. onMounted(() => {
  144. getList()
  145. })
  146. </script>
  147. <style lang="scss">
  148. .switchRecord-container {
  149. display: flex;
  150. background-color: #f2f2f2;
  151. flex-direction: column;
  152. height: calc(100vh - 120rpx);
  153. position: relative;
  154. .scroll-view {
  155. background-color: #fff;
  156. color: #3D3D3D;
  157. padding: 0 24rpx;
  158. display: flex;
  159. overflow-x: auto;
  160. white-space: nowrap;
  161. box-sizing: border-box;
  162. }
  163. .scroll-view-item {
  164. display: inline-block;
  165. width: calc(100% / 4);
  166. height: 88rpx;
  167. line-height: 88rpx;
  168. text-align: center;
  169. font-size: 24rpx;
  170. font-weight: 350;
  171. position: relative; /* 添加相对定位 */
  172. box-sizing: border-box; /* 确保边框在总宽度内计算 */
  173. &::after {
  174. content: '';
  175. display: inline-block;
  176. width: 50%; /* 默认宽度为50% */
  177. margin: 0 auto;
  178. position: absolute;
  179. bottom: 0;
  180. left: 25%; /* 使其居中 */
  181. height: 2rpx; /* 默认未选中的高度 */
  182. background: #fff; /* 默认未选中的颜色 */
  183. z-index: 1;
  184. }
  185. &.activite {
  186. color: #1E92F0;
  187. &::after {
  188. background: #1E92F0;
  189. height: 4rpx;
  190. width: 50%;
  191. }
  192. }
  193. }
  194. .swiper_content {
  195. background-color: #f2f2f2;
  196. flex: 1;
  197. }
  198. .feedback-add-icon {
  199. position: absolute;
  200. bottom: 300rpx;
  201. right: 100rpx;
  202. width: 120rpx;
  203. height: 120rpx;
  204. @include flex-center;
  205. border-radius: 50%;
  206. background-color: #fff;
  207. box-shadow: 0px 4px 10px 0px rgba(216, 216, 216, 0.8),inset 0px 4px 10px 0px rgba(216, 216, 216, 0.3);
  208. .add-icon {
  209. width: 60rpx;
  210. height: 60rpx;
  211. }
  212. }
  213. }
  214. </style>