|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="wrap"> |
|
|
|
|
<div class="left"> |
|
|
|
|
<el-menu class="menu" ref="type" @open="handleOpen" @close="handleClose" @select="selectType" unique-opened :default-active="defaultType" :default-openeds="defaultOpenType"> |
|
|
|
|
<el-menu class="menu" ref="type" @open="openType" @select="selectType" unique-opened :default-active="defaultType" :default-openeds="defaultOpenType"> |
|
|
|
|
<template v-for="item in typeList"> |
|
|
|
|
<!-- 如果第一层有子菜单,则继续循环 --> |
|
|
|
|
<template v-if="item.children.length"> |
|
|
|
@ -75,7 +75,11 @@ |
|
|
|
|
<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="dataTotal" label="数据总量" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataSize" label="数据大小" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="dataSize" label="数据大小" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.row.dataSize}}M |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="updateTime" label="更新时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="操作" width="220" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
@ -245,6 +249,21 @@ export default { |
|
|
|
|
this.page = 1 |
|
|
|
|
this.getData() |
|
|
|
|
}, |
|
|
|
|
openType(index,indexPath){ |
|
|
|
|
let typeList = this.typeList |
|
|
|
|
let firstChild = typeList.find(n => n.id == index) |
|
|
|
|
let id = '' |
|
|
|
|
if(firstChild){ |
|
|
|
|
id = firstChild.children[0].id |
|
|
|
|
}else{ |
|
|
|
|
typeList.map(n => { |
|
|
|
|
n.children.map(n => { |
|
|
|
|
if(n.id == index) id = n.children[0].id |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
this.selectType(id,indexPath) |
|
|
|
|
}, |
|
|
|
|
preview(row){ |
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
this.$post(this.api.saveRecord,{ |
|
|
|
@ -271,16 +290,21 @@ export default { |
|
|
|
|
this.fields = val ? this.fieldsList.map(n => n.comment) : [] |
|
|
|
|
}, |
|
|
|
|
download(row){ |
|
|
|
|
this.curRow = row |
|
|
|
|
this.downloadVisible = true |
|
|
|
|
this.$get(`${this.api.isDownload}`,{ |
|
|
|
|
tableId: row.id, |
|
|
|
|
schoolId: this.schoolId, |
|
|
|
|
}).then(res => { |
|
|
|
|
this.curRow = row |
|
|
|
|
this.downloadVisible = true |
|
|
|
|
|
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
let comment = res.comment |
|
|
|
|
let fieldsList = [] |
|
|
|
|
comment.map(n => { |
|
|
|
|
n.field != 'id' && n.field != 'operation_time' && fieldsList.push(n) |
|
|
|
|
}) |
|
|
|
|
this.fieldsList = fieldsList |
|
|
|
|
this.$get(`${this.api.previewData}?tableName=${row.name}&tableId=${row.id}`).then(res => { |
|
|
|
|
let comment = res.comment |
|
|
|
|
let fieldsList = [] |
|
|
|
|
comment.map(n => { |
|
|
|
|
n.field != 'id' && n.field != 'operation_time' && fieldsList.push(n) |
|
|
|
|
}) |
|
|
|
|
this.fieldsList = fieldsList |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
closeDownload(){ |
|
|
|
@ -290,12 +314,6 @@ export default { |
|
|
|
|
this.endTime = '' |
|
|
|
|
this.frequency = '' |
|
|
|
|
this.$router.push('/data').catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
handleOpen(){ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
handleClose(){ |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
confirmDown(){ |
|
|
|
|
let fields = this.fields |
|
|
|
@ -334,43 +352,36 @@ export default { |
|
|
|
|
|
|
|
|
|
if(invalid) return util.warningMsg('请选择完整区间') |
|
|
|
|
|
|
|
|
|
this.$get(`${this.api.isDownload}`,{ |
|
|
|
|
tableId: this.curRow.id, |
|
|
|
|
schoolId: this.schoolId, |
|
|
|
|
}).then(res => { |
|
|
|
|
if(res.status != 200) return util.warningMsg(res.message) |
|
|
|
|
|
|
|
|
|
let newFields = [] |
|
|
|
|
let fieldsList = this.fieldsList |
|
|
|
|
fields.map(n => { |
|
|
|
|
newFields.push(fieldsList.find(e => e.comment == n).field) |
|
|
|
|
}) |
|
|
|
|
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) |
|
|
|
|
this.downloadVisible = false |
|
|
|
|
let newFields = [] |
|
|
|
|
let fieldsList = this.fieldsList |
|
|
|
|
fields.map(n => { |
|
|
|
|
newFields.push(fieldsList.find(e => e.comment == n).field) |
|
|
|
|
}) |
|
|
|
|
let msgObj = util.successMsg('数据正在生成中,请稍等片刻,生成后会自动下载,您可以先访问其他页面。',5000) |
|
|
|
|
this.downloadVisible = false |
|
|
|
|
|
|
|
|
|
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}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{ |
|
|
|
|
headers: { |
|
|
|
|
token: this.token |
|
|
|
|
}, |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}).then((res) => { |
|
|
|
|
msgObj.close() |
|
|
|
|
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') |
|
|
|
|
util.downloadFileDirect(`${this.curRow.showName}.xls`,new Blob([res.data])) |
|
|
|
|
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}&table_id=${this.curRow.id}&fields=${newFields.join()}&startTime=${startTime}&endTime=${endTime}&frequency=${frequency}`,{ |
|
|
|
|
headers: { |
|
|
|
|
token: this.token |
|
|
|
|
}, |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}).then((res) => { |
|
|
|
|
msgObj.close() |
|
|
|
|
if(res.data.type != 'multipart/form-data') return util.warningMsg('数据总数为零!') |
|
|
|
|
util.downloadFileDirect(`${this.curRow.showName}.xls`,new Blob([res.data])) |
|
|
|
|
|
|
|
|
|
this.$get(`${this.api.downloadRecord}?tableId=${this.curRow.id}&fields=${newFields.join()}` + (startTime ? `&startTime=${startTime}` : '') + (endTime ? `&endTime=${endTime}` : '') + `&frequency=${frequency}`).then(res => {}).catch(res => {}) |
|
|
|
|
this.$get(`${this.api.downloadRecord}?tableId=${this.curRow.id}&fields=${newFields.join()}` + (startTime ? `&startTime=${startTime}` : '') + (endTime ? `&endTime=${endTime}` : '') + `&frequency=${frequency}`).then(res => {}).catch(res => {}) |
|
|
|
|
|
|
|
|
|
this.$post(this.api.saveRecord,{ |
|
|
|
|
tableId: this.curRow.id, |
|
|
|
|
type: 1, |
|
|
|
|
}).then(res => {}).catch(res => {}) |
|
|
|
|
}).catch(res => { |
|
|
|
|
msgObj.close() |
|
|
|
|
}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
this.$post(this.api.saveRecord,{ |
|
|
|
|
tableId: this.curRow.id, |
|
|
|
|
type: 1, |
|
|
|
|
}).then(res => {}).catch(res => {}) |
|
|
|
|
}).catch(res => { |
|
|
|
|
msgObj.close() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|