|
@@ -3,7 +3,7 @@
|
|
|
<div class="page_week_main">
|
|
|
<!-- 选择周报时间 -->
|
|
|
<div class="week_time">
|
|
|
- <SelectMonth @selectYm="getSelectTime"></SelectMonth>
|
|
|
+ <SelectMonth ref="selectMonth" :queryDate="getQueryTime" @selectYm="getSelectTime"></SelectMonth>
|
|
|
<div class="select_report">
|
|
|
<div class="week_report" v-for="(item, index) in weekList" :key="index" @click="selectWeek(index, item)" :class="{weekActive:index==isWeekIndex}">
|
|
|
<div class="week_report_main">
|
|
@@ -111,6 +111,7 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ canQuery: true,
|
|
|
isWeekIndex: 0,
|
|
|
start: 0,
|
|
|
end: 0,
|
|
@@ -174,17 +175,37 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
+ mounted () {
|
|
|
const nowtime = dateFormatter(new Date(), 'yyyyMM')
|
|
|
this.getReportList(nowtime)
|
|
|
if (this.$refs.weekitempoint && this.$refs.weekitempoint.length > 0) {
|
|
|
this.$refs.weekitempoint[0].style.display = 'none'
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ getQueryTime () {
|
|
|
+ const paramsDate = this.$route.query.start
|
|
|
+ if (paramsDate) {
|
|
|
+ const paramsData = {
|
|
|
+ year: dateFormatter(paramsDate * 1000, 'yyyy'),
|
|
|
+ month: Number(dateFormatter(paramsDate * 1000, 'MM')).toString(),
|
|
|
+ ym: dateFormatter(paramsDate * 1000, 'yyyyMM'),
|
|
|
+ start: this.$route.query.start,
|
|
|
+ end: this.$route.query.end
|
|
|
+ }
|
|
|
+ return paramsData
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
dateFormatter,
|
|
|
// 周报列表
|
|
|
- getReportList (time) {
|
|
|
+ getReportList (yearMonth) {
|
|
|
+ let time = yearMonth
|
|
|
+ if (this.getQueryTime) {
|
|
|
+ time = this.getQueryTime.ym
|
|
|
+ }
|
|
|
getReportIndex({ ym: time }).then((res) => {
|
|
|
console.log(res)
|
|
|
if (res.data && res.data.list && res.data.list.length !== 0) {
|
|
@@ -201,9 +222,25 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
this.weekList = res.data.list
|
|
|
- this.getDetail(res.data.list[0].startdate, res.data.list[0].enddate)
|
|
|
- this.start = res.data.list[0].startdate
|
|
|
- this.end = res.data.list[0].enddate
|
|
|
+ const queryData = {
|
|
|
+ start: res.data.list[0].startdate,
|
|
|
+ end: res.data.list[0].enddate
|
|
|
+ }
|
|
|
+ if (this.canQuery && this.getQueryTime) {
|
|
|
+ if (this.getQueryTime.ym === time) {
|
|
|
+ queryData.start = this.getQueryTime.start
|
|
|
+ queryData.end = this.getQueryTime.end
|
|
|
+ this.weekList.forEach((v, index) => {
|
|
|
+ if (String(v.startdate) === queryData.start) {
|
|
|
+ this.isWeekIndex = index
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.canQuery = false
|
|
|
+ }
|
|
|
+ this.getDetail(queryData.start, queryData.end)
|
|
|
+ this.start = queryData.start
|
|
|
+ this.end = queryData.end
|
|
|
this.nodata = true
|
|
|
} else {
|
|
|
this.weekList = []
|