|
|
|
@ -53,10 +53,10 @@ |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="开始时间"> |
|
|
|
|
<el-date-picker v-model="startTime" type="date" placeholder="请选择开始时间" size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :picker-options="timeOptions" :disabled="startTimeDisabled" :default-value="timeDefault"></el-date-picker> |
|
|
|
|
<el-date-picker v-model="startTime" type="date" placeholder="请选择开始时间" size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :picker-options="timeOptions" :disabled="startTimeDisabled" :default-value="startTimeDefault" @change="timeChange"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="结束时间"> |
|
|
|
|
<el-date-picker v-model="endTime" type="date" placeholder="请选择结束时间" size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :picker-options="timeOptions" :disabled="endTimeDisabled" :default-value="timeDefault"></el-date-picker> |
|
|
|
|
<el-date-picker v-model="endTime" type="date" placeholder="请选择结束时间" size="small" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :picker-options="timeOptions" :disabled="endTimeDisabled" :default-value="endTimeDefault" @change="timeChange"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="数据频率"> |
|
|
|
|
<el-select v-model="frequency" placeholder="请选择数据频率" size="small"> |
|
|
|
@ -137,7 +137,8 @@ export default { |
|
|
|
|
startTimeDisabled: false, |
|
|
|
|
endTimeLimit: '', |
|
|
|
|
endTimeDisabled: false, |
|
|
|
|
timeDefault: '', |
|
|
|
|
startTimeDefault: '', |
|
|
|
|
endTimeDefault: '', |
|
|
|
|
timeOptions: { |
|
|
|
|
disabledDate(time) { |
|
|
|
|
return time.getTime() < startTimeLimit || time.getTime() > endTimeLimit |
|
|
|
@ -349,6 +350,7 @@ export default { |
|
|
|
|
checkAllFieldsChange(val) { |
|
|
|
|
this.fields = val ? this.fieldsList.map(n => n.comment) : [] |
|
|
|
|
}, |
|
|
|
|
// 显示下载弹框 |
|
|
|
|
download(row) { |
|
|
|
|
// 查询是否购买了该数据,只有购买了才能下载 |
|
|
|
|
this.$get(`${this.api.isDownload}`, { |
|
|
|
@ -360,13 +362,14 @@ export default { |
|
|
|
|
// 限制数据可选择的开始结束时间 |
|
|
|
|
if (row.startTime) { |
|
|
|
|
startTimeLimit = new Date(row.startTime).getTime() |
|
|
|
|
this.startTimeDefault = row.startTime |
|
|
|
|
} else { |
|
|
|
|
// 如果没有开始时间,则禁止选择开始时间 |
|
|
|
|
this.startTimeDisabled = true |
|
|
|
|
} |
|
|
|
|
if (row.endTime) { |
|
|
|
|
endTimeLimit = new Date(row.endTime).getTime() |
|
|
|
|
this.timeDefault = row.endTime |
|
|
|
|
this.endTimeDefault = row.endTime |
|
|
|
|
} else { |
|
|
|
|
// 如果没有结束时间,则禁止选择结束时间 |
|
|
|
|
this.endTimeDisabled = true |
|
|
|
@ -382,6 +385,11 @@ export default { |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 开始结束时间选择回调 |
|
|
|
|
timeChange() { |
|
|
|
|
// 如果开始时间大于结束时间,则提示 |
|
|
|
|
if (this.startTime && this.endTime && new Date(this.startTime) > new Date(this.endTime)) util.warningMsg('结束时间不能小于开始时间') |
|
|
|
|
}, |
|
|
|
|
closeDownload() { |
|
|
|
|
this.checkAllFields = false |
|
|
|
|
this.fields = [] |
|
|
|
@ -395,6 +403,7 @@ export default { |
|
|
|
|
if (!fields.length) return util.warningMsg('请选择字段') |
|
|
|
|
if (!this.startTime) return util.warningMsg('请选择开始时间') |
|
|
|
|
if (!this.endTime) return util.warningMsg('请选择结束时间') |
|
|
|
|
if (new Date(this.endTime) < new Date(this.startTime)) return util.warningMsg('结束时间不能小于开始时间') |
|
|
|
|
if (!this.frequency) return util.warningMsg('请选择数据频率') |
|
|
|
|
let invalid = false |
|
|
|
|
|
|
|
|
@ -443,8 +452,8 @@ export default { |
|
|
|
|
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。', 5000) |
|
|
|
|
this.downloadVisible = false |
|
|
|
|
|
|
|
|
|
let startTime = this.startTime ? this.startTime : '' |
|
|
|
|
let endTime = this.endTime ? this.endTime : '' |
|
|
|
|
let startTime = this.startTime || '' |
|
|
|
|
let endTime = this.endTime || '' |
|
|
|
|
let frequency = this.frequency |
|
|
|
|
axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`, { |
|
|
|
|
headers: { |
|
|
|
|