index.vue 5.9 KB

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