|
|
@ -71,7 +71,7 @@ |
|
|
|
<h6 class="title">数据介绍</h6> |
|
|
|
<h6 class="title">数据介绍</h6> |
|
|
|
<div class="desc">{{introduce}}</div> |
|
|
|
<div class="desc">{{introduce}}</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="listData" class="table" stripe header-align="center" row-key="id"> |
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" row-key="id"> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column prop="showName" label="数据表名称" align="center"></el-table-column> |
|
|
|
<el-table-column prop="showName" label="数据表名称" align="center"></el-table-column> |
|
|
|
<el-table-column prop="dataTotal" label="数据总量" align="center"></el-table-column> |
|
|
|
<el-table-column prop="dataTotal" label="数据总量" align="center"></el-table-column> |
|
|
@ -94,11 +94,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="previewData" class="table" stripe header-align="center" row-key="id"> |
|
|
|
<el-table :data="previewData" class="table" stripe header-align="center" row-key="id"> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
<el-table-column v-for="(item,index) in previewHead" :prop="item.field" :label="item.comment" align="center"></el-table-column> |
|
|
|
<el-table-column v-for="(item,index) in previewHead" :prop="item.field" :key="index" :label="item.comment" align="center"></el-table-column> |
|
|
|
</el-table> |
|
|
|
</el-table> |
|
|
|
<div class="pagination"> |
|
|
|
|
|
|
|
<el-pagination background @current-change="handlePreviewCurrentChange" :current-page="pagePreview" layout="total, prev, pager, next" :total="totalPreview"></el-pagination> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
@ -106,8 +103,9 @@ |
|
|
|
<el-form ref="form" label-width="100px" label-suffix=":"> |
|
|
|
<el-form ref="form" label-width="100px" label-suffix=":"> |
|
|
|
<el-form-item label="数据筛选"> |
|
|
|
<el-form-item label="数据筛选"> |
|
|
|
<div class="checkboxs"> |
|
|
|
<div class="checkboxs"> |
|
|
|
|
|
|
|
<el-checkbox v-model="checkAllFields" @change="checkAllFieldsChange">全选</el-checkbox> |
|
|
|
<el-checkbox-group v-model="fields"> |
|
|
|
<el-checkbox-group v-model="fields"> |
|
|
|
<el-checkbox v-for="(item,index) in previewHead" :key="index" :label="item.comment"></el-checkbox> |
|
|
|
<el-checkbox v-for="(item,index) in fieldsList" :key="index" :label="item.comment"></el-checkbox> |
|
|
|
</el-checkbox-group> |
|
|
|
</el-checkbox-group> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
@ -151,8 +149,10 @@ export default { |
|
|
|
pageSizePreview: 10, |
|
|
|
pageSizePreview: 10, |
|
|
|
totalPreview: 0, |
|
|
|
totalPreview: 0, |
|
|
|
downloadVisible: false, |
|
|
|
downloadVisible: false, |
|
|
|
tableName: '', |
|
|
|
curRow: {}, |
|
|
|
|
|
|
|
checkAllFields: false, |
|
|
|
fields: [], |
|
|
|
fields: [], |
|
|
|
|
|
|
|
fieldsList: [], |
|
|
|
startTime: '', |
|
|
|
startTime: '', |
|
|
|
endTime: '', |
|
|
|
endTime: '', |
|
|
|
frequency: '', |
|
|
|
frequency: '', |
|
|
@ -174,19 +174,15 @@ export default { |
|
|
|
name: '年频' |
|
|
|
name: '年频' |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
], |
|
|
|
fieldList: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
id: 1, |
|
|
|
|
|
|
|
name: '代码' |
|
|
|
|
|
|
|
},{ |
|
|
|
|
|
|
|
id: 2, |
|
|
|
|
|
|
|
name: '名称' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
this.getType() |
|
|
|
this.getType() |
|
|
|
|
|
|
|
if(this.$route.query.download){ |
|
|
|
|
|
|
|
this.download({ |
|
|
|
|
|
|
|
name: this.$route.query.name |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
getType(){ |
|
|
|
getType(){ |
|
|
@ -194,7 +190,10 @@ export default { |
|
|
|
res.map(n => { |
|
|
|
res.map(n => { |
|
|
|
n.id = String(n.id) |
|
|
|
n.id = String(n.id) |
|
|
|
n.children.map(n => { |
|
|
|
n.children.map(n => { |
|
|
|
n.id = String(n.id) |
|
|
|
n.id = String(n.id) |
|
|
|
|
|
|
|
n.children.map(n => { |
|
|
|
|
|
|
|
n.id = String(n.id) |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.typeList = res |
|
|
|
this.typeList = res |
|
|
@ -208,20 +207,7 @@ export default { |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
getData(){ |
|
|
|
getData(){ |
|
|
|
let data = { |
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.active}&showName=&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=`).then(res => { |
|
|
|
endTime: '', |
|
|
|
|
|
|
|
fields: [], |
|
|
|
|
|
|
|
frequency: '', |
|
|
|
|
|
|
|
startTime: '', |
|
|
|
|
|
|
|
tableName: '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// util.successMsg('数据正在生成中,请稍等。') |
|
|
|
|
|
|
|
// location.href = 'http://192.168.31.125:8888/data/data/download?endTime=&frequency=&startTime=&tableName=' |
|
|
|
|
|
|
|
// this.$get(this.api.download,data).then(res => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }).catch(res => {}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.active}&showName=&pageNum=${this.page}&pageSize=${this.pageSize}`).then(res => { |
|
|
|
|
|
|
|
this.listData = res.list |
|
|
|
this.listData = res.list |
|
|
|
this.total = res.totalCount |
|
|
|
this.total = res.totalCount |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
@ -236,40 +222,50 @@ export default { |
|
|
|
this.introduce = this.typeList.find(n => n.id == indexPath[0]).introduce |
|
|
|
this.introduce = this.typeList.find(n => n.id == indexPath[0]).introduce |
|
|
|
this.previewHead = [] |
|
|
|
this.previewHead = [] |
|
|
|
this.previewData = [] |
|
|
|
this.previewData = [] |
|
|
|
this.getData() |
|
|
|
this.page = 1 |
|
|
|
}, |
|
|
|
|
|
|
|
handlePreviewCurrentChange(val) { |
|
|
|
|
|
|
|
this.pagePreview = val |
|
|
|
|
|
|
|
this.$refs.table.clearSelection() |
|
|
|
|
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
preview(row){ |
|
|
|
preview(row){ |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}`).then(res => { |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
let comment = res.comment |
|
|
|
let comment = res.comment |
|
|
|
let previewHead = [] |
|
|
|
let previewHead = [] |
|
|
|
comment.map(n => { |
|
|
|
comment.map(n => { |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.previewHead = previewHead |
|
|
|
this.previewHead = previewHead |
|
|
|
this.previewData = res.data |
|
|
|
|
|
|
|
|
|
|
|
let data = res.data |
|
|
|
|
|
|
|
data.map(n => { |
|
|
|
|
|
|
|
for(let i in n){ |
|
|
|
|
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = util.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.previewData = data |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
checkAllFieldsChange(val) { |
|
|
|
|
|
|
|
this.fields = val ? this.fieldsList.map(n => n.comment) : [] |
|
|
|
|
|
|
|
}, |
|
|
|
download(row){ |
|
|
|
download(row){ |
|
|
|
this.tableName = row.name |
|
|
|
this.curRow = row |
|
|
|
this.downloadVisible = true |
|
|
|
this.downloadVisible = true |
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}`).then(res => { |
|
|
|
|
|
|
|
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
let comment = res.comment |
|
|
|
let comment = res.comment |
|
|
|
let previewHead = [] |
|
|
|
let fieldsList = [] |
|
|
|
comment.map(n => { |
|
|
|
comment.map(n => { |
|
|
|
n.field != 'id' && n.field != 'operation_time' && previewHead.push(n) |
|
|
|
n.field != 'id' && n.field != 'operation_time' && fieldsList.push(n) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.previewHead = previewHead |
|
|
|
this.fieldsList = fieldsList |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
closeDownload(){ |
|
|
|
closeDownload(){ |
|
|
|
|
|
|
|
this.checkAllFields = false |
|
|
|
|
|
|
|
this.fields = [] |
|
|
|
|
|
|
|
this.startTime = '' |
|
|
|
|
|
|
|
this.endTime = '' |
|
|
|
|
|
|
|
this.frequency = '' |
|
|
|
|
|
|
|
this.$router.push('/data') |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleOpen(){ |
|
|
|
handleOpen(){ |
|
|
|
|
|
|
|
|
|
|
@ -278,17 +274,72 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
confirmDown(){ |
|
|
|
confirmDown(){ |
|
|
|
// return console.log(this.startTime,this.endTime) |
|
|
|
|
|
|
|
let fields = this.fields |
|
|
|
let fields = this.fields |
|
|
|
|
|
|
|
if(!fields.length) return util.warningMsg('请选择字段') |
|
|
|
|
|
|
|
if(!this.frequency) return util.warningMsg('请选择数据频率') |
|
|
|
|
|
|
|
let invalid = false |
|
|
|
|
|
|
|
if(this.startTime && this.endTime){ |
|
|
|
|
|
|
|
let startTime = new Date(this.startTime) |
|
|
|
|
|
|
|
let endTime = new Date(this.endTime) |
|
|
|
|
|
|
|
let frequency = this.frequency |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(frequency == 2){ |
|
|
|
|
|
|
|
let week = [] |
|
|
|
|
|
|
|
while(startTime <= endTime){ |
|
|
|
|
|
|
|
let weekNum = startTime.getDay() |
|
|
|
|
|
|
|
if(weekNum == 0) weekNum = 7 |
|
|
|
|
|
|
|
week.push(weekNum) |
|
|
|
|
|
|
|
startTime.setTime(startTime.getTime() + 86400000) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(let i = 1;i <= 5;i++){ |
|
|
|
|
|
|
|
if(!week.includes(i)){ |
|
|
|
|
|
|
|
invalid = true |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else if(frequency == 3){ |
|
|
|
|
|
|
|
if((endTime.getTime() - startTime.getTime()) / 86400000 < 30) invalid = true |
|
|
|
|
|
|
|
}else if(frequency == 4){ |
|
|
|
|
|
|
|
if((endTime.getTime() - startTime.getTime()) / 86400000 < 90) invalid = true |
|
|
|
|
|
|
|
}else if(frequency == 5){ |
|
|
|
|
|
|
|
if((endTime.getTime() - startTime.getTime()) / 86400000 < 365) invalid = true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(invalid) return util.warningMsg('请选择完整区间') |
|
|
|
|
|
|
|
|
|
|
|
let newFields = [] |
|
|
|
let newFields = [] |
|
|
|
let previewHead = this.previewHead |
|
|
|
let fieldsList = this.fieldsList |
|
|
|
fields.map(n => { |
|
|
|
fields.map(n => { |
|
|
|
newFields.push(`fields=${previewHead.find(e => e.comment == n).field}`) |
|
|
|
newFields.push(`fields=${fieldsList.find(e => e.comment == n).field}`) |
|
|
|
}) |
|
|
|
}) |
|
|
|
// return console.log(this.fields,newFields) |
|
|
|
util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) |
|
|
|
this.$get(`${this.api.downloadData}?tableName=${this.tableName}&${newFields.join('&')}&startTime=${this.startTime}&endTime=${this.endTime}&frequency=${this.frequency}`).then(res => { |
|
|
|
this.downloadVisible = false |
|
|
|
|
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
let startTime = this.startTime ? this.startTime : '' |
|
|
|
|
|
|
|
let endTime = this.endTime ? this.endTime : '' |
|
|
|
|
|
|
|
let frequency = this.frequency |
|
|
|
|
|
|
|
axios.get(`${this.api.downloadData}?tableName=${this.curRow.name}&${newFields.join('&')}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{ |
|
|
|
|
|
|
|
responseType: 'blob' |
|
|
|
|
|
|
|
}).then((res) => { |
|
|
|
|
|
|
|
console.log(22,res.data) |
|
|
|
|
|
|
|
const blob = new Blob([res.data]) |
|
|
|
|
|
|
|
const fileName = `${this.curRow.showName}.xls` |
|
|
|
|
|
|
|
if ('download' in document.createElement('a')) { // 非IE下载 |
|
|
|
|
|
|
|
const elink = document.createElement('a') |
|
|
|
|
|
|
|
elink.download = fileName |
|
|
|
|
|
|
|
elink.style.display = 'none' |
|
|
|
|
|
|
|
elink.href = URL.createObjectURL(blob) |
|
|
|
|
|
|
|
document.body.appendChild(elink) |
|
|
|
|
|
|
|
elink.click() |
|
|
|
|
|
|
|
URL.revokeObjectURL(elink.href) // 释放URL 对象 |
|
|
|
|
|
|
|
document.body.removeChild(elink) |
|
|
|
|
|
|
|
} else { // IE10+下载 |
|
|
|
|
|
|
|
navigator.msSaveBlob(blob, fileName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.$get(`${this.api.downloadRecord}?platformUserId=4&tableId=${this.curRow.id}&${newFields.join('&')}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`).then(res => {}).catch(res => {}) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -313,6 +364,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
.right{ |
|
|
|
.right{ |
|
|
|
flex: 1; |
|
|
|
flex: 1; |
|
|
|
|
|
|
|
max-width: calc(100% - 220px); |
|
|
|
.block{ |
|
|
|
.block{ |
|
|
|
padding: 34px; |
|
|
|
padding: 34px; |
|
|
|
margin-bottom: 20px; |
|
|
|
margin-bottom: 20px; |
|
|
|