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.4KB

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