|
|
|
@ -2,7 +2,7 @@ |
|
|
|
<div class="demo-wrap main-content12"> |
|
|
|
<div class="flex-between flex-end pagetitle"> |
|
|
|
<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" |
|
|
|
@change="handleDateChange" /> |
|
|
|
</CustomDropdown> |
|
|
|
@ -23,8 +23,8 @@ |
|
|
|
</div> |
|
|
|
<div class=" flex-common" id=""> |
|
|
|
<el-form> |
|
|
|
<GuipTable :tableData="tableData" style="width: 100%" :border="true" @sort-change="handleSortChange" |
|
|
|
:loading="loading" @cell-mouse-enter="handleRowHover"> |
|
|
|
<GuipTable :tableData="tableData" style="width: 100%" :border="true" @sort-change="handleSortChange" :loading="loading" |
|
|
|
@cell-mouse-enter="handleRowHover"> |
|
|
|
<el-table-column fixed="left" prop="sort" label="排序" width="70"></el-table-column> |
|
|
|
<el-table-column fixed="left" |
|
|
|
v-if="(dataRank == 1 || dataRank == 2) && (dataType == 'ver_type' || dataType == 'check_type')" |
|
|
|
@ -229,10 +229,10 @@ export default { |
|
|
|
'check_type': '服务名称', |
|
|
|
}, |
|
|
|
type_select: { |
|
|
|
'ver_type': '按品牌名称', |
|
|
|
'check_type': '按服务名称', |
|
|
|
'ver_type': '按品牌名称',//2 |
|
|
|
'check_type': '按服务名称',//1 |
|
|
|
}, |
|
|
|
selectedType: 'ver_type', |
|
|
|
selectedType: 'check_type', |
|
|
|
view: 'month', |
|
|
|
labels: ['', '', '', ''], |
|
|
|
current_month: '', |
|
|
|
@ -243,6 +243,7 @@ export default { |
|
|
|
sort_by: 4, |
|
|
|
sort_order: 2, |
|
|
|
text: '',//下拉框显示具体文案 |
|
|
|
textDesc: '',//下拉框显示具体文案 |
|
|
|
selectedDate: new Date(),//默认当天日期 |
|
|
|
dataType: '', |
|
|
|
dataRank: '', |
|
|
|
@ -263,11 +264,15 @@ export default { |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
init() { |
|
|
|
this.selectedType = this.type; |
|
|
|
document.title = this.pageTitle; |
|
|
|
|
|
|
|
this.text = this.getNowDate() |
|
|
|
this.dataType = this.type |
|
|
|
this.dataRank = this.rank_type |
|
|
|
const dataRankObj = { |
|
|
|
'check_type':'1', |
|
|
|
'ver_type':'2' |
|
|
|
} |
|
|
|
this.dataRank = dataRankObj[this.selectedType] |
|
|
|
|
|
|
|
this.getRankingData(); |
|
|
|
}, |
|
|
|
@ -275,10 +280,12 @@ export default { |
|
|
|
this.view = newView; |
|
|
|
}, |
|
|
|
getNowDate() { |
|
|
|
const viewdesc = this.viewDesc[this.view]; |
|
|
|
const now = new Date(); |
|
|
|
const year = now.getFullYear(); |
|
|
|
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,补零 |
|
|
|
const currentYearMonth = `${year}-${month}`; |
|
|
|
this.textDesc = viewdesc + currentYearMonth; |
|
|
|
return `${currentYearMonth}` |
|
|
|
}, |
|
|
|
getDate(dateStr) { |
|
|
|
@ -292,7 +299,9 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
handleDateChange(date) { |
|
|
|
const viewdesc = this.viewDesc[this.view]; |
|
|
|
this.text = this.getDate(date) |
|
|
|
this.textDesc = viewdesc + this.text; |
|
|
|
this.selectedDate = date; |
|
|
|
localStorage.setItem('date', JSON.stringify(date)) |
|
|
|
|
|
|
|
@ -441,9 +450,9 @@ export default { |
|
|
|
this.dataRank = dataRankObj[this.selectedType] |
|
|
|
this.getRankingData() |
|
|
|
}, |
|
|
|
// 获取排名数据:根据当前选择的数据类型调用相应的排名接口 |
|
|
|
getRankingData() { |
|
|
|
this.setLabelText(); |
|
|
|
|
|
|
|
if (this.dataType == 'agent') { |
|
|
|
this.getAgentRanking() |
|
|
|
} |
|
|
|
@ -466,11 +475,11 @@ export default { |
|
|
|
if (this.view === 'month' && year == currentYear && month == currentMonth) { |
|
|
|
this.current_month = '(当月)'; |
|
|
|
} |
|
|
|
|
|
|
|
//表格 头部label |
|
|
|
this.labels = []; |
|
|
|
if (this.view === 'year') { |
|
|
|
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 { |
|
|
|
const monthLabels = []; |
|
|
|
@ -478,7 +487,7 @@ export default { |
|
|
|
let m = month - i; |
|
|
|
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; |
|
|
|
} |
|
|
|
@ -526,6 +535,7 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
getTypeRanking() { |
|
|
|
console.log(this.dataRank,'that.dataRank==='); |
|
|
|
//产品排行 |
|
|
|
const that = this |
|
|
|
that.tableData = [] |
|
|
|
@ -546,6 +556,7 @@ export default { |
|
|
|
that.total = response.data.total |
|
|
|
}) |
|
|
|
}).catch(error => { |
|
|
|
this.loading = false; |
|
|
|
console.error(error, 'error') |
|
|
|
}) |
|
|
|
}, |
|
|
|
|