index.vue 6.1 KB

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