|
|
|
@ -18,10 +18,12 @@
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" @click="onSubmit">查询</el-button>
|
|
|
|
|
<el-button @click="resetForm('form')">重置</el-button>
|
|
|
|
|
<el-button type="success" @click="exportExcel('导出')">导出</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
ref="report-table"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
style="width: 100%">
|
|
|
|
|
<el-table-column
|
|
|
|
@ -63,6 +65,8 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import FileSaver from 'file-saver'
|
|
|
|
|
import {utils,write} from 'xlsx'
|
|
|
|
|
import {findProductLineList} from '@//api/base/productLine'
|
|
|
|
|
import {parseTime} from '@//utils/ruoyi'
|
|
|
|
|
import {
|
|
|
|
@ -99,7 +103,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
onSubmit() {
|
|
|
|
|
if(!this.form.year){
|
|
|
|
|
if (!this.form.year) {
|
|
|
|
|
this.form.year = new Date().getFullYear().toString()
|
|
|
|
|
}
|
|
|
|
|
adverseRecordYearOnYearList({year: this.form.year, productionLine: this.form.productionLine}).then(response => {
|
|
|
|
@ -126,6 +130,25 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
this.tableTimeHead = head
|
|
|
|
|
},
|
|
|
|
|
exportExcel(excelName) {
|
|
|
|
|
try {
|
|
|
|
|
//获取表格
|
|
|
|
|
const $e = this.$refs['report-table'].$el
|
|
|
|
|
let $table = $e.querySelector('.el-table__fixed')
|
|
|
|
|
if (!$table) {
|
|
|
|
|
$table = $e
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const wb = utils.table_to_book($table, {raw: true})
|
|
|
|
|
const wbout = write(wb, {bookType: 'xlsx', bookSST: true, type: 'array'})
|
|
|
|
|
FileSaver.saveAs(
|
|
|
|
|
new Blob([wbout], {type: 'application/octet-stream'}),
|
|
|
|
|
`${excelName}.xlsx`,
|
|
|
|
|
)
|
|
|
|
|
} catch (e) {
|
|
|
|
|
if (typeof console !== 'undefined') console.error(e)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|