index.vue 6.5 KB

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