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