examTeamApp/pageTwo/compk/contrast.vue

170 lines
4.6 KiB
Vue
Raw Normal View History

2024-05-02 15:59:36 +08:00
<template>
<view class="content">
<view class=" calendar">
<!-- 日历 -->
<ren-calendar ref='ren' :markDays='markDays' @onDayClick='onDayClick' @onMonthClickPre='onMonthClickPre'
v-if="isShow">
</ren-calendar>
<!-- -->
<view class="box" v-if="infoList.length">
<view class="list" v-for="(item,index) in infoList" :key="index" @click="addMemberTags(item.id,item)">
<view class="item">
<view class="check">
2024-05-29 16:35:45 +08:00
<uni-icons :type="isActive.indexOf(item.id)!=-1?'checkbox-filled':'circle'" size="22"
:color="isActive.indexOf(item.id)!=-1?'#FEC407':'#dfdfdf'"></uni-icons>
2024-05-02 15:59:36 +08:00
</view>
2024-05-29 16:35:45 +08:00
<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>
2024-05-02 15:59:36 +08:00
</view>
</view>
</view>
<!-- -->
<view class="bottom">
<view class="list" v-for="(ite,ind) in ActiveDays" :key="ind" v-if="isActive"
@click="addMemberTags(ite.id,ite)">
<view class="item borderRadius">
2024-05-29 16:35:45 +08:00
<view class="time">{{ite.r_t}}</view>
<view>{{ite.v1}}<text>{{ite.v1_name}}</text></view>
<view v-if="ite.v2">{{ite.v2}}<text>{{ite.v2_name}}</text></view>
<view v-if="ite.v3">{{ite.v3}}<text>{{ite.v3_name}}</text></view>
2024-05-02 15:59:36 +08:00
<view class="check">
2024-05-29 16:35:45 +08:00
<uni-icons type="clear" size="22" color="#999"></uni-icons>
2024-05-02 15:59:36 +08:00
</view>
</view>
</view>
<view class="pkclass" v-if="length==2">vs</view>
2025-04-18 14:53:38 +08:00
<view :class="{'active':length!=2}" class="btn" @click="handlePK">{{$t("common.btnContrast")}}</view>
2024-05-02 15:59:36 +08:00
</view>
</view>
</view>
</template>
<script>
import RenCalendar from '@/element/ren-calendar/ren-calendar.vue';
2024-05-02 15:59:36 +08:00
import {
mapState
} from "vuex";
export default {
2024-05-29 16:35:45 +08:00
data() {
return {
markDays: [],
infoList: [],
list: [],
isActive: [],
ActiveDays: [],
startM: null,
endM: null,
isShow: true,
acd_id: ""
}
},
2024-05-02 15:59:36 +08:00
components: {
RenCalendar,
},
2025-04-26 13:35:30 +08:00
onReady() {
uni.setNavigationBarTitle({
title: this.$t('common.titleContrast'),
})
},
2024-05-02 15:59:36 +08:00
computed: {
...mapState(["user", "TrendPk", "appTheme"]),
length() {
return this.isActive.length
},
endDate() {
return this.$tools.getDate("start")
},
},
2024-05-29 16:35:45 +08:00
onLoad(optoins) {
2024-05-02 15:59:36 +08:00
let that = this
2024-05-29 16:35:45 +08:00
that.acd_id = optoins.acd_id
2024-05-02 15:59:36 +08:00
that.startM = that.$tools.getDate("m").substring(0, 10)
that.endM = that.$tools.getDate("m").substring(11, 21)
that.markDays = []
that.list = []
that.isActive = []
that.ActiveDays = []
2024-05-29 16:35:45 +08:00
this.$nextTick(() => {
that.isShow = true
that.getList(that.startM, that.endM)
})
2024-05-02 15:59:36 +08:00
},
methods: {
getList(start, end) {
let that = this
2024-05-29 16:35:45 +08:00
that.$model.getresultdiff({
aud_id: uni.getStorageSync('userid'),
s_time: start,
e_time: end,
type: that.acd_id
2024-05-02 15:59:36 +08:00
}).then(res => {
if (res) {
2024-07-22 14:13:19 +08:00
that.markDays = res.Dlist
that.list = res.data
for (var i = 0; i < res.data.length; i++) {
if (Date.parse(that.endDate) == Date.parse(res.data[i].r_t)) {
that.infoList.push(res.data[i])
2024-05-02 15:59:36 +08:00
}
}
2025-04-18 14:53:38 +08:00
console.log("对比", res, )
2024-05-02 15:59:36 +08:00
}
})
},
onMonthClickPre(data) {
console.log("onMonthClickPre", data)
let that = this
let start = data.substring(0, 10)
let end = data.substring(11, 21)
that.infoList = []
that.markDays = []
that.list = []
that.getList(start, end)
},
onDayClick(data) {
let that = this
this.infoList = []
for (var i = 0; i < that.list.length; i++) {
2024-05-29 16:35:45 +08:00
if (Date.parse(data.date) == Date.parse(that.list[i].r_t)) { //includes 检测数组是否有某个值
2024-05-02 15:59:36 +08:00
this.infoList.push(that.list[i]);
}
}
},
addMemberTags(index, item) {
var that = this;
console.log("addMemberTags", index, item)
// if (this.user.type != 1) return
if (that.isActive.indexOf(index) == -1) {
that.isActive.push(index);
that.ActiveDays.push(item);
} else {
that.isActive.splice(that.isActive.indexOf(index), 1);
that.ActiveDays.splice(that.ActiveDays.indexOf(item), 1);
}
if (that.isActive.length > 2) {
that.isActive.splice(0, 1)
that.ActiveDays.splice(0, 1);
}
},
handlePK() {
let that = this
2024-05-29 16:35:45 +08:00
if (that.isActive.length != 2) {
2025-04-18 14:53:38 +08:00
that.$tools.msg(that.$t("tips.verifyBontrast"))
2024-05-29 16:35:45 +08:00
return
}
2024-05-02 15:59:36 +08:00
let info = {}
2024-05-29 16:35:45 +08:00
info.type = that.acd_id
info.before_id = that.isActive[0]
info.after_id = that.isActive[1]
console.log("1111", info, that.isActive)
2024-05-02 15:59:36 +08:00
uni.navigateTo({
2024-10-11 10:04:19 +08:00
url: "/pageTwo/compk/pkdetail?info=" + JSON.stringify(info)
2024-05-02 15:59:36 +08:00
})
},
},
2024-05-29 16:35:45 +08:00
2024-05-02 15:59:36 +08:00
}
</script>
<style scoped lang="scss">
</style>