Compare commits

...

2 Commits

  1. 35
      src/views/super/Ranking/RankBatchList.vue

35
src/views/super/Ranking/RankBatchList.vue

@ -2,7 +2,7 @@
<div class="demo-wrap main-content12"> <div class="demo-wrap main-content12">
<div class="flex-between flex-end pagetitle"> <div class="flex-between flex-end pagetitle">
<h4>{{ pageTitle }}</h4> <h4>{{ pageTitle }}</h4>
<CustomDropdown ref="dropdownRef" :placeholder="'('+viewDesc[this.view]+')'+text" width="280px"> <CustomDropdown ref="dropdownRef" :placeholder="textDesc" width="280px">
<DateSelect slot="normal" :view="view" v-model="selectedDate" @update-count="handleUpdateView" <DateSelect slot="normal" :view="view" v-model="selectedDate" @update-count="handleUpdateView"
@change="handleDateChange" /> @change="handleDateChange" />
</CustomDropdown> </CustomDropdown>
@ -23,8 +23,8 @@
</div> </div>
<div class=" flex-common" id=""> <div class=" flex-common" id="">
<el-form> <el-form>
<GuipTable :tableData="tableData" style="width: 100%" :border="true" @sort-change="handleSortChange" <GuipTable :tableData="tableData" style="width: 100%" :border="true" @sort-change="handleSortChange" :loading="loading"
:loading="loading" @cell-mouse-enter="handleRowHover"> @cell-mouse-enter="handleRowHover">
<el-table-column fixed="left" prop="sort" label="排序" width="70"></el-table-column> <el-table-column fixed="left" prop="sort" label="排序" width="70"></el-table-column>
<el-table-column fixed="left" <el-table-column fixed="left"
v-if="(dataRank == 1 || dataRank == 2) && (dataType == 'ver_type' || dataType == 'check_type')" v-if="(dataRank == 1 || dataRank == 2) && (dataType == 'ver_type' || dataType == 'check_type')"
@ -229,10 +229,10 @@ export default {
'check_type': '服务名称', 'check_type': '服务名称',
}, },
type_select: { type_select: {
'ver_type': '按品牌名称', 'ver_type': '按品牌名称',//2
'check_type': '按服务名称', 'check_type': '按服务名称',//1
}, },
selectedType: 'ver_type', selectedType: 'check_type',
view: 'month', view: 'month',
labels: ['', '', '', ''], labels: ['', '', '', ''],
current_month: '', current_month: '',
@ -243,6 +243,7 @@ export default {
sort_by: 4, sort_by: 4,
sort_order: 2, sort_order: 2,
text: '',// text: '',//
textDesc: '',//
selectedDate: new Date(),// selectedDate: new Date(),//
dataType: '', dataType: '',
dataRank: '', dataRank: '',
@ -263,11 +264,15 @@ export default {
}, },
methods: { methods: {
init() { init() {
this.selectedType = this.type;
document.title = this.pageTitle; document.title = this.pageTitle;
this.text = this.getNowDate() this.text = this.getNowDate()
this.dataType = this.type this.dataType = this.type
this.dataRank = this.rank_type const dataRankObj = {
'check_type':'1',
'ver_type':'2'
}
this.dataRank = dataRankObj[this.selectedType]
this.getRankingData(); this.getRankingData();
}, },
@ -275,10 +280,12 @@ export default {
this.view = newView; this.view = newView;
}, },
getNowDate() { getNowDate() {
const viewdesc = this.viewDesc[this.view];
const now = new Date(); const now = new Date();
const year = now.getFullYear(); const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); // 0 const month = String(now.getMonth() + 1).padStart(2, '0'); // 0
const currentYearMonth = `${year}-${month}`; const currentYearMonth = `${year}-${month}`;
this.textDesc = viewdesc + currentYearMonth;
return `${currentYearMonth}` return `${currentYearMonth}`
}, },
getDate(dateStr) { getDate(dateStr) {
@ -292,7 +299,9 @@ export default {
} }
}, },
handleDateChange(date) { handleDateChange(date) {
const viewdesc = this.viewDesc[this.view];
this.text = this.getDate(date) this.text = this.getDate(date)
this.textDesc = viewdesc + this.text;
this.selectedDate = date; this.selectedDate = date;
localStorage.setItem('date', JSON.stringify(date)) localStorage.setItem('date', JSON.stringify(date))
@ -441,9 +450,9 @@ export default {
this.dataRank = dataRankObj[this.selectedType] this.dataRank = dataRankObj[this.selectedType]
this.getRankingData() this.getRankingData()
}, },
//
getRankingData() { getRankingData() {
this.setLabelText(); this.setLabelText();
if (this.dataType == 'agent') { if (this.dataType == 'agent') {
this.getAgentRanking() this.getAgentRanking()
} }
@ -466,11 +475,11 @@ export default {
if (this.view === 'month' && year == currentYear && month == currentMonth) { if (this.view === 'month' && year == currentYear && month == currentMonth) {
this.current_month = '(当月)'; this.current_month = '(当月)';
} }
// label
this.labels = []; this.labels = [];
if (this.view === 'year') { if (this.view === 'year') {
for (let i = 3; i >= 0; i--) { for (let i = 3; i >= 0; i--) {
this.labels.push((year - i) + '年' + this.rank_type_desc[this.dataRank]); this.labels.push((year - i) + '年' + this.rank_type_desc[this.rank_type]);
} }
} else { } else {
const monthLabels = []; const monthLabels = [];
@ -478,7 +487,7 @@ export default {
let m = month - i; let m = month - i;
if (m <= 0) m += 12; if (m <= 0) m += 12;
monthLabels.push(m + '月' + this.rank_type_desc[this.dataRank]); monthLabels.push(m + '月' + this.rank_type_desc[this.rank_type]);
} }
this.labels = monthLabels; this.labels = monthLabels;
} }
@ -526,6 +535,7 @@ export default {
}) })
}, },
getTypeRanking() { getTypeRanking() {
console.log(this.dataRank,'that.dataRank===');
// //
const that = this const that = this
that.tableData = [] that.tableData = []
@ -546,6 +556,7 @@ export default {
that.total = response.data.total that.total = response.data.total
}) })
}).catch(error => { }).catch(error => {
this.loading = false;
console.error(error, 'error') console.error(error, 'error')
}) })
}, },

Loading…
Cancel
Save