123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class="content">
- <view class="top-content">
- <view class="card">
- <text>请选择具体业务:</text>
- <uni-data-select v-model="state.businessTypeVal" :localdata="state.businessRange"
- @change="changeBusiness" :clear="false"></uni-data-select>
- </view>
- <view class="example-body">
- <uni-datetime-picker v-model="state.range" type="daterange" />
- <button size="mini" style="color: #ffffff;
- backgroundColor: rgb(118, 200, 77);
- borderColor: rgb(118, 200, 77);
- font-size: 26rpx;
- flex-shrink: 0;margin-left: 20rpx;" @click="search(1)">搜索</button>
- </view>
- </view>
-
-
- <view class="uni-container" v-if="state.listData.length>0">
- <view class="list-item" v-for="(item,index) in state.listData">
- <view><text>业务类型:</text><text>{{item.serviceType}}</text></view>
- <view><text>操作时间:</text><text>{{item.operateTime}}</text></view>
- <view><text>业务标识:</text><text>{{item.uniqueId}}</text></view>
- <view><text>日志记录时间:</text><text>{{item.insertTime}}</text></view>
- </view>
- <view class="bottom-line" v-if="state.flags">我是有底线的~~~</view>
- </view>
- <view v-else class="uni-container" style="text-align: center;">
- 暂无数据
- </view>
-
- </view>
-
- </template>
-
- <script setup lang="ts">
- import { reactive } from "vue";
- import {
- businessType
- } from "@/datas/businessType.js"
- import empty from "@/components/empty/empty.vue";
- import { onLoad, onReachBottom } from "@dcloudio/uni-app";
- import { businessApi } from "@/utils/network/api.js";
- import { stringToJson } from "@/utils/network/encryption";
- import { request } from "@/utils/network/request.js";
- import { getItem, StorageKeys } from "@/utils/storage";
- const state = reactive({
- startTime: Date.now(), //日期
- businessTypeVal: "",
- businessRange: [],
- listData: [],
- range: ['', ''],
- pageSize: 10, //每页数据量
- pageNo: 1, // 当前页
- total: 0, // 数据总量
- flags: false,
- })
- onLoad((option) => {
- state.businessRange = businessType;
- search(1)
- })
- const changeBusiness = (e) => {
- state.businessTypeVal = e
- console.log(e)
- }
- //业务完成日志
- const search = (val) => {
- if (val == 1) {
- state.pageNo = 1
- }
- if (state.pageNo == 1 && state.listData.length > 0) {
- state.listData = []
- }
- var data = {
- opId: getItem(StorageKeys.OpenId),
- serviceType: state.businessTypeVal,
- startDate: state.range[0],
- endDate: state.range[1],
- pageNo: state.pageNo,
- pageSize: state.pageSize,
- };
-
- if (data.serviceType == "") {
- delete data.serviceType
- }
- const options = {
- type: 2,
- data: data,
- method: "POST",
- showLoading: true,
- };
-
- request(businessApi, options).then((res) => {
- const data = stringToJson(res.bizContent);
- state.listData = [...stringToJson(res.bizContent).data, ...state.listData]
- state.total = data.data.length
- console.log("业务完成日志", state.listData, state.pageNo,)
- });
- }
- const change = (e) => {
- console.log("e", e)
- state.pageNo = e.current
- search(2)
- }
- // 触底加载
- onReachBottom(() => {
- if (state.listData.length < state.pageNo * 10) return state.flags = true
- console.log("触底了")
- state.pageNo++
- search(2)
- })
- </script>
-
- <style scoped>
- .top-content {
- position: fixed;
- left: 0;
- top: 0;
- background-color: white;
- width: 100%;
- padding: 20rpx;
- box-sizing: border-box;
- }
-
- .content {
- font-size: 32rpx;
- padding: 20rpx 30rpx;
- background-color: #EEF7F7;
- min-height: 100vh;
- }
-
- .card {
- display: flex;
- margin: 0 20rpx;
- align-items: center;
- }
-
- .title {
- margin-bottom: 20rpx;
- }
-
- .uni-container {
- margin: 50rpx 0;
- margin-top: 200rpx;
- }
-
- /deep/.uni-table-th,
- /deep/.uni-table-td {
- padding: 0 !important;
- font-size: 12px !important;
- }
-
- /deep/.uni-date__x-input,
- /deep/.uni-select {
- font-size: 13px;
- height: 30px;
- line-height: 30px;
- }
-
- /deep/.uni-stat__select {
- width: 360rpx;
- }
-
- /deep/.uni-select__selector-empty,
- /deep/.uni-select__selector-item {
- font-size: 13px !important;
- }
-
- /deep/.uni-date {
- width: 73% !important;
- }
-
- .example-body {
- display: flex;
- align-items: center;
- margin-top: 20rpx;
- }
-
- /deep/.uni-date-x {
- height: 76rpx !important;
- }
-
- .list-item {
- width: 95%;
- border-radius: 10rpx;
- margin: 30rpx auto;
- font-size: 28rpx;
- border: 1rpx solid #ccc;
- padding: 12rpx;
- box-sizing: border-box;
- background-color: white;
- }
-
- .list-item>view {
- margin-bottom: 10rpx;
- }
-
- .bottom-line {
- text-align: center;
- margin: 30rpx 0;
- }
- </style>
|