|
@@ -27,6 +27,8 @@
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
|
|
<el-button type="primary" style="margin-left: 5px" icon="el-icon-search" @click="dataQuery">查询
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+ <el-button type="primary" style="margin-left: 5px" icon="el-icon-download" @click="exportFile">导出
|
|
|
|
+ </el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
@@ -732,6 +734,32 @@ export default {
|
|
this.currentPage = currentPage
|
|
this.currentPage = currentPage
|
|
this.pageSize = pageSize
|
|
this.pageSize = pageSize
|
|
},
|
|
},
|
|
|
|
+ exportFile(){
|
|
|
|
+ if (this.tableData.length>0){
|
|
|
|
+ const item = this.stationList.find(item => item.value === this.stationCode)
|
|
|
|
+ let filename = item.label
|
|
|
|
+ // 文件名日期
|
|
|
|
+ let startTime = this.$moment(this.dateTime[0]).format('YYYY-MM-DD')
|
|
|
|
+ let endTime = this.$moment(this.dateTime[1]).format('YYYY-MM-DD')
|
|
|
|
+ if (startTime===endTime){
|
|
|
|
+ filename=filename+startTime
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ filename=filename+startTime+'至'+endTime
|
|
|
|
+ }
|
|
|
|
+ this.$refs.xTable.exportData({
|
|
|
|
+ filename: filename,
|
|
|
|
+ type: 'csv',
|
|
|
|
+ isHeader: true,
|
|
|
|
+ isFooter: true,
|
|
|
|
+ data: this.tableData
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ this.$message.error("列表无数据不能导出文件!")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async dataQuery() {
|
|
async dataQuery() {
|
|
let startTime = Math.round(this.dateTime[0])
|
|
let startTime = Math.round(this.dateTime[0])
|
|
let endTime = Math.round(this.dateTime[1])
|
|
let endTime = Math.round(this.dateTime[1])
|