230 lines
5.3 KiB
Vue
230 lines
5.3 KiB
Vue
<template>
|
|
<view class="common">
|
|
<view class="history" v-if="ranklist.length">
|
|
<view class="list" v-for="(item, index) in ranklist" :key="index" @click="clickItemMethod(item)">
|
|
<uni-swipe-action>
|
|
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event, index)">
|
|
<view class="time">
|
|
<icon class="t-icon t-icon-shijian-mianxing-0"></icon>
|
|
<text>{{item.record_time}}</text>
|
|
</view>
|
|
<view class="item">
|
|
<view>{{item.v1}}<text>{{item.v1_name}}</text></view>
|
|
<view v-if="item.v2">{{item.v2}}<text>{{item.v2_name}}</text></view>
|
|
<view v-if="item.v3">{{item.v3}}<text>{{item.v3_name}}</text></view>
|
|
<uni-icons type="right" v-if="acd_id!=6"></uni-icons>
|
|
</view>
|
|
</uni-swipe-action-item>
|
|
</uni-swipe-action>
|
|
</view>
|
|
<view class="endtext" v-if="!lastPage || page >= lastPage">—— {{$t("tips.msgBottom")}} ——</view>
|
|
</view>
|
|
<view class="nolist" v-if="!ranklist.length||!lastPage">
|
|
<image src="../../static/none.png"></image>
|
|
<text>{{$t("index.none")}}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
computed: {
|
|
...mapState(['user']),
|
|
endDate() {
|
|
return this.$tools.getDate("start")
|
|
},
|
|
startDate() {
|
|
return this.$tools.GetDateStr(-90);
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
ranklist: [],
|
|
page: 1,
|
|
isDelete: false,
|
|
lastPage: '',
|
|
isActive: null,
|
|
acd_id: "",
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
let that = this
|
|
that.acd_id = options.acd_id
|
|
that.getList()
|
|
console.log("options", options)
|
|
},
|
|
onReady() {
|
|
uni.setNavigationBarTitle({
|
|
title: this.$t('common.titleHistory'),
|
|
})
|
|
},
|
|
onUnload() {
|
|
console.log('关闭页面');
|
|
let that = this
|
|
var pages = getCurrentPages();
|
|
var Page = pages[pages.length - 1]; //当前页
|
|
var prevPage = pages[pages.length - 2];
|
|
if (that.isDelete) { //确定要返回到相应页面,在触发
|
|
prevPage.$vm.reload()
|
|
}
|
|
},
|
|
onReachBottom() {
|
|
let that = this
|
|
console.log("onReachBottom", this.lastPage)
|
|
if (!this.lastPage || this.page >= this.lastPage) {
|
|
uni.showToast({
|
|
title: that.$t("tips.msgNoMoreData"),
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
this.page++
|
|
this.getList(this.page)
|
|
},
|
|
methods: {
|
|
swipeClick(e, index) {
|
|
let that = this
|
|
let id = that.ranklist[index].id
|
|
uni.showModal({
|
|
title: that.$t("tips.msgTitle"),
|
|
content: that.$t("tips.verifyDeleteHistory"),
|
|
cancelText: that.$t("tips.btnSancellation"),
|
|
confirmText: that.$t("tips.btnConfirm"),
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.$model.gethistorydelete({
|
|
id: id,
|
|
type: that.acd_id,
|
|
}).then((res) => {
|
|
if (res.code != 0) {
|
|
that.$tools.msg(res.msg)
|
|
return
|
|
}
|
|
that.ranklist.splice(index, 1)
|
|
if (that.user.measure_model == "1") {
|
|
that.$store.dispatch("getUserInfo", {
|
|
aud_id: uni.getStorageSync('userid')
|
|
})
|
|
}
|
|
if (that.acd_id == 2) {
|
|
that.$store.dispatch("getResult", {
|
|
aud_id: uni.getStorageSync('userid')
|
|
})
|
|
} else {
|
|
that.isDelete = true
|
|
}
|
|
|
|
that.$tools.msg(that.$t("tips.msgDelete"))
|
|
})
|
|
} else if (res.cancel) {
|
|
that.$tools.msg(that.$t("tips.msgCancel"));
|
|
}
|
|
},
|
|
})
|
|
},
|
|
clickItemMethod(item) {
|
|
let that = this
|
|
if (that.acd_id == "6") return
|
|
uni.navigateTo({
|
|
url: "/pageTwo/history/historyDetail?type=" + that.acd_id + '&id=' + item.id
|
|
})
|
|
},
|
|
getList(page) {
|
|
let that = this
|
|
that.$model.gethistory({
|
|
aud_id: uni.getStorageSync('userid'),
|
|
type: that.acd_id,
|
|
page: that.page,
|
|
}).then((res) => {
|
|
console.log("历史记录", res)
|
|
if (res.code != 0) return
|
|
let options = [{
|
|
text: that.$t("tips.btnDelete"),
|
|
style: {
|
|
backgroundColor: '#dd524d'
|
|
}
|
|
}]
|
|
res.data.rows.forEach(item => {
|
|
item.options = options
|
|
})
|
|
this.ranklist = this.ranklist.concat(res.data.rows)
|
|
this.lastPage = res.data.totalpage
|
|
})
|
|
},
|
|
handleEdit(id) {
|
|
let that = this
|
|
that.isActive = that.isActive == id ? null : id
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped="scoped" lang="scss">
|
|
.common {
|
|
width: 100%;
|
|
min-height: 100.5vh; // 重点
|
|
overflow-y: scroll;
|
|
background-color: #f7f7f7;
|
|
}
|
|
|
|
.history {
|
|
width: calc(100% - 30px);
|
|
height: auto;
|
|
margin: 15px 15px 0;
|
|
padding-bottom: 40px;
|
|
|
|
.list {
|
|
width: 100%;
|
|
margin-top: 12px;
|
|
position: relative;
|
|
|
|
.item {
|
|
width: calc(100% - 20px);
|
|
height: auto;
|
|
background: #fff;
|
|
padding: 6px 10px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
border-radius: 10px;
|
|
align-items: center;
|
|
font-weight: 700;
|
|
line-height: 50rpx;
|
|
font-size: 36rpx !important;
|
|
|
|
text {
|
|
display: block;
|
|
color: #666;
|
|
text-align: center;
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
}
|
|
}
|
|
|
|
.time {
|
|
font-size: 28rpx;
|
|
color: #666;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 100%;
|
|
margin-bottom: 5px;
|
|
|
|
icon {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
margin-right: 5px;
|
|
}
|
|
|
|
text {
|
|
font-size: 32rpx;
|
|
margin-top: 3px;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |