自定义时间选择

This commit is contained in:
liuye
2022-07-19 09:43:11 +08:00
parent a5bc5689a3
commit 4b67e33ae9

View File

@@ -100,6 +100,13 @@
</div> </div>
<div id="departBarChart"></div> <div id="departBarChart"></div>
</div> </div>
<ai-dialog :visible.sync="dialogDate" title="选择时间" width="500px" customFooter :show-close="false">
<el-date-picker v-model="timeList" size="small" type="daterange" value-format="yyyy-MM-dd"
range-separator="" start-placeholder="开始日期" end-placeholder="结束日期">
</el-date-picker>
<el-button slot="footer" @click="selectDete" type="primary">确认</el-button>
</ai-dialog>
</template> </template>
</ai-list> </ai-list>
</template> </template>
@@ -132,7 +139,8 @@
dateTypeList: ['近7天', '近30天', '近1年', '自定义'], dateTypeList: ['近7天', '近30天', '近1年', '自定义'],
departData: {}, departData: {},
departBarChart: null, departBarChart: null,
dialogDate: false,
timeList: '',
type: '', type: '',
} }
@@ -188,6 +196,22 @@
this.dict.load("mstSendType") this.dict.load("mstSendType")
}, },
methods: { methods: {
selectDete() {
console.log(this.timeList)
if(!this.timeList || !this.timeList.length) {
return this.$message.error('请选择自定义时间');
}
if(this.effectType == 3) { //宣发效果
this.getEffect()
}
if(this.departType == 3) { //宣发明细
this.getDepart()
}
this.dialogDate = false
},
searchMonthChange() { searchMonthChange() {
this.calendarDate = this.searchMonth + '-1' this.calendarDate = this.searchMonth + '-1'
}, },
@@ -204,10 +228,16 @@
}, },
changeEffectType(type) { changeEffectType(type) {
this.effectType = type this.effectType = type
this.getEffect() if(type == 3) {
this.dialogDate = true
this.timeList = []
}else {
this.getEffect()
}
}, },
getEffect() { getEffect() {
this.instance.post(`/app/appmasssendingtask/statisticsEffect?type=${this.effectType}`).then(res => { var startTime = this.timeList[0] || '' , endTime = this.timeList[1] || ''
this.instance.post(`/app/appmasssendingtask/statisticsEffect?type=${this.effectType}&startTime=${startTime}&endTime=${endTime}`).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.effectData = res.data this.effectData = res.data
var xData = [], createData = [], executeData = [], receiveData = [] var xData = [], createData = [], executeData = [], receiveData = []
@@ -259,10 +289,16 @@
}, },
changeDepartType(type) { changeDepartType(type) {
this.departType = type this.departType = type
this.getDepart() if(type == 3) {
this.dialogDate = true
this.timeList = []
}else {
this.getDepart()
}
}, },
getDepart() { // ${this.departType} getDepart() {
this.instance.post(`/app/appmasssendingtask/statisticsDepart?type=1`).then(res => { var startTime = this.timeList[0] || '' , endTime = this.timeList[1] || ''
this.instance.post(`/app/appmasssendingtask/statisticsDepart?type=${this.departType}&startTime=${startTime}&endTime=${endTime}`).then(res => {
if (res.code == 0) { if (res.code == 0) {
// this.dateList = res.data // this.dateList = res.data
// this.getTaskList(this.chooseDay) // this.getTaskList(this.chooseDay)
@@ -291,16 +327,16 @@
bottom: 90, bottom: 90,
containLabel: true containLabel: true
}, },
toolbox: { // toolbox: {
feature: { // feature: {
dataZoom: { // dataZoom: {
yAxisIndex: false // yAxisIndex: false
}, // },
saveAsImage: { // saveAsImage: {
pixelRatio: 2 // pixelRatio: 2
} // }
} // }
}, // },
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
axisPointer: { axisPointer: {
@@ -501,6 +537,7 @@
border: 1px solid #D0D4DC; border: 1px solid #D0D4DC;
margin-right: 8px; margin-right: 8px;
box-sizing: border-box; box-sizing: border-box;
cursor: pointer;
} }
.active{ .active{
border: 1px solid #26f; border: 1px solid #26f;