224 lines
5.6 KiB
Vue
224 lines
5.6 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="tagList">
|
|
<scroll-view class="scroll-view_H" scroll-x="true">
|
|
<text class="scroll-view-item_H" v-for="(ite,ind) in publicRecordInfo"
|
|
@click="handlePageScrollTo(ite.id,ind)" :class="[ind == index?'active':'']">
|
|
{{ite.name}}
|
|
</text>
|
|
</scroll-view>
|
|
</view>
|
|
|
|
<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">
|
|
<uni-icons :type="isActive.indexOf(item.id)!=-1?'checkbox-filled':'circle'" size="22"
|
|
:color="isActive.indexOf(item.id)!=-1?'#FEC407':'#dfdfdf'"></uni-icons>
|
|
</view>
|
|
<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>
|
|
</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">
|
|
<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>
|
|
<view class="check">
|
|
<uni-icons type="clear" size="22" color="#999"></uni-icons>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="pkclass" v-if="length==2">vs</view>
|
|
<view :class="{'active':length!=2}" class="btn" @click="handlePK">对比</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import RenCalendar from '@/element/ren-calendar/ren-calendar.vue';
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
data() {
|
|
return {
|
|
markDays: [],
|
|
infoList: [],
|
|
list: [],
|
|
isActive: [],
|
|
ActiveDays: [],
|
|
startM: null,
|
|
endM: null,
|
|
isShow: true,
|
|
index: 0,
|
|
}
|
|
},
|
|
components: {
|
|
RenCalendar,
|
|
},
|
|
computed: {
|
|
...mapState(["user", "PublicRecord"]),
|
|
length() {
|
|
return this.isActive.length
|
|
},
|
|
endDate() {
|
|
return this.$tools.getDate("start")
|
|
},
|
|
publicRecordInfo() {
|
|
let that = this
|
|
return that.PublicRecord
|
|
},
|
|
},
|
|
onLoad() {
|
|
let that = this
|
|
that.handlonLoad()
|
|
},
|
|
methods: {
|
|
handlePageScrollTo(id, ind) {
|
|
let that = this
|
|
that.index = ind
|
|
that.handlonLoad()
|
|
},
|
|
handlonLoad() {
|
|
let that = this
|
|
that.startM = that.$tools.getDate("m").substring(0, 10)
|
|
that.endM = that.$tools.getDate("m").substring(11, 21)
|
|
that.markDays = []
|
|
that.list = []
|
|
that.infoList = []
|
|
that.isActive = []
|
|
that.ActiveDays = []
|
|
that.$nextTick(() => {
|
|
that.isShow = true
|
|
that.getList(that.startM, that.endM)
|
|
})
|
|
},
|
|
getList(start, end) {
|
|
let that = this
|
|
that.$model.getresultdiff({
|
|
aud_id: that.user.aud_id,
|
|
s_time: start,
|
|
e_time: end,
|
|
type: that.publicRecordInfo[that.index].key_word
|
|
}).then(res => {
|
|
if (res) {
|
|
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])
|
|
}
|
|
}
|
|
console.log("对比", res, )
|
|
}
|
|
})
|
|
},
|
|
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++) {
|
|
if (Date.parse(data.date) == Date.parse(that.list[i].r_t)) { //includes 检测数组是否有某个值
|
|
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
|
|
if (that.isActive.length != 2) {
|
|
that.$tools.msg("请先选择数据!")
|
|
return
|
|
}
|
|
let info = {}
|
|
info.before_id = that.isActive[0]
|
|
info.after_id = that.isActive[1]
|
|
info.type = that.publicRecordInfo[that.index].key_word
|
|
console.log("1111", info, that.isActive)
|
|
uni.navigateTo({
|
|
url: "/pageTwo/compk/pkdetail?info=" + JSON.stringify(info)
|
|
})
|
|
},
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.tagList {
|
|
width: 100%;
|
|
height: 45px;
|
|
line-height: 45px;
|
|
background: #fff;
|
|
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
|
|
position: fixed;
|
|
top: 0;
|
|
z-index: 999;
|
|
|
|
.active {
|
|
color: $maincolor;
|
|
font-weight: bold;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.scroll-view_H {
|
|
white-space: nowrap;
|
|
width: 100%;
|
|
|
|
.scroll-view-item_H {
|
|
display: inline-block;
|
|
height: 45rpx;
|
|
line-height: 45rpx;
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
text {
|
|
color: #666;
|
|
padding: 0 15px;
|
|
}
|
|
}
|
|
|
|
.calendar{
|
|
margin-top: 50px;
|
|
}
|
|
</style> |