You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

business-processie.vue 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="content">
  3. <view class="top-content">
  4. <view class="card">
  5. <text>请选择具体业务:</text>
  6. <uni-data-select v-model="state.businessTypeVal" :localdata="state.businessRange"
  7. @change="changeBusiness" :clear="false"></uni-data-select>
  8. </view>
  9. <view class="example-body">
  10. <uni-datetime-picker v-model="state.range" type="daterange" />
  11. <button size="mini" style="color: #ffffff;
  12. backgroundColor: rgb(118, 200, 77);
  13. borderColor: rgb(118, 200, 77);
  14. font-size: 26rpx;
  15. flex-shrink: 0;margin-left: 20rpx;" @click="search(1)">搜索</button>
  16. </view>
  17. </view>
  18. <view class="uni-container">
  19. <view class="list-item" v-for="(item,index) in state.listData">
  20. <view><text>业务类型:</text><text>{{item.serviceType}}</text></view>
  21. <view><text>操作时间:</text><text>{{item.operateTime}}</text></view>
  22. <view><text>业务标识:</text><text>{{item.uniqueId}}</text></view>
  23. <view><text>日志记录时间:</text><text>{{item.insertTime}}</text></view>
  24. </view>
  25. </view>
  26. <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
  27. </view>
  28. </template>
  29. <script setup lang="ts">
  30. import { reactive } from "vue";
  31. import {
  32. businessType
  33. } from "@/datas/businessType.js"
  34. import { onLoad, onReachBottom } from "@dcloudio/uni-app";
  35. import { businessApi } from "@/utils/network/api.js";
  36. import { stringToJson } from "@/utils/network/encryption";
  37. import { request } from "@/utils/network/request.js";
  38. import { getItem, StorageKeys } from "@/utils/storage";
  39. const state = reactive({
  40. startTime: Date.now(), //日期
  41. businessTypeVal: "",
  42. businessRange: [],
  43. listData: [],
  44. range: ['', ''],
  45. pageSize: 10, //每页数据量
  46. pageNo: 1, // 当前页
  47. total: 0, // 数据总量
  48. flags: false,
  49. })
  50. onLoad((option) => {
  51. state.businessRange = businessType;
  52. search(1)
  53. })
  54. const changeBusiness = (e) => {
  55. state.businessTypeVal = e
  56. console.log(e)
  57. }
  58. //业务完成日志
  59. const search = (val) => {
  60. if (val == 1) {
  61. state.pageNo = 1
  62. }
  63. if (state.pageNo == 1 && state.listData.length > 0) {
  64. state.listData = []
  65. }
  66. var data = {
  67. opId: getItem(StorageKeys.OpenId),
  68. serviceType: state.businessTypeVal,
  69. startDate: state.range[0],
  70. endDate: state.range[1],
  71. pageNo: state.pageNo,
  72. pageSize: state.pageSize,
  73. };
  74. if (data.serviceType == "") {
  75. delete data.serviceType
  76. }
  77. const options = {
  78. type: 2,
  79. data: data,
  80. method: "POST",
  81. showLoading: true,
  82. };
  83. request(businessApi, options).then((res) => {
  84. const data = stringToJson(res.bizContent);
  85. state.listData = [...stringToJson(res.bizContent).data, ...state.listData]
  86. state.total = data.data.length
  87. console.log("业务完成日志", state.listData, state.pageNo,)
  88. });
  89. }
  90. const change = (e) => {
  91. console.log("e", e)
  92. state.pageNo = e.current
  93. search(2)
  94. }
  95. // 触底加载
  96. onReachBottom(() => {
  97. if (state.listData.length < state.pageNo * 10) return state.flags = true
  98. console.log("触底了")
  99. state.pageNo++
  100. search(2)
  101. })
  102. </script>
  103. <style scoped>
  104. .top-content {
  105. position: fixed;
  106. left: 0;
  107. top: 0;
  108. background-color: white;
  109. width: 100%;
  110. padding: 20rpx;
  111. box-sizing: border-box;
  112. }
  113. .content {
  114. font-size: 32rpx;
  115. padding: 20rpx 30rpx;
  116. background-color: #EEF7F7;
  117. min-height: 100vh;
  118. }
  119. .card {
  120. display: flex;
  121. margin: 0 20rpx;
  122. align-items: center;
  123. }
  124. .title {
  125. margin-bottom: 20rpx;
  126. }
  127. .uni-container {
  128. margin: 50rpx 0;
  129. margin-top: 200rpx;
  130. }
  131. /deep/.uni-table-th,
  132. /deep/.uni-table-td {
  133. padding: 0 !important;
  134. font-size: 12px !important;
  135. }
  136. /deep/.uni-date__x-input,
  137. /deep/.uni-select {
  138. font-size: 13px;
  139. height: 30px;
  140. line-height: 30px;
  141. }
  142. /deep/.uni-stat__select {
  143. width: 360rpx;
  144. }
  145. /deep/.uni-select__selector-empty,
  146. /deep/.uni-select__selector-item {
  147. font-size: 13px !important;
  148. }
  149. /deep/.uni-date {
  150. width: 73% !important;
  151. }
  152. .example-body {
  153. display: flex;
  154. align-items: center;
  155. margin-top: 20rpx;
  156. }
  157. /deep/.uni-date-x {
  158. height: 76rpx !important;
  159. }
  160. .list-item {
  161. width: 95%;
  162. border-radius: 10rpx;
  163. margin: 30rpx auto;
  164. font-size: 28rpx;
  165. border: 1rpx solid #ccc;
  166. padding: 12rpx;
  167. box-sizing: border-box;
  168. background-color: white;
  169. }
  170. .list-item>view {
  171. margin-bottom: 10rpx;
  172. }
  173. .bottom-line {
  174. text-align: center;
  175. margin: 30rpx 0;
  176. }
  177. </style>