|
@@ -35,6 +35,8 @@
|
|
|
<el-input v-model="con1" style="width:200px" clearable></el-input>
|
|
|
</el-form-item>
|
|
|
<el-button type="primary" @click="search">查询</el-button>
|
|
|
+ <el-button type="primary" @click="exportExcel">导出</el-button>
|
|
|
+
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
@click="addEditTime"
|
|
@@ -46,6 +48,7 @@
|
|
|
</div>
|
|
|
<div class="table">
|
|
|
<dilTable
|
|
|
+ @func="func"
|
|
|
v-bind.sync="options"
|
|
|
@radio-change="radioChange"
|
|
|
:showSummaryList="showSummaryList"
|
|
@@ -247,7 +250,9 @@ export default {
|
|
|
selectedRowData: {},
|
|
|
updateInsertVisible: false,
|
|
|
updateInsertForm: {},
|
|
|
- showSummaryList: ['materialNumber', 'netWeight', 'theoryWeight']
|
|
|
+ showSummaryList: ['materialNumber', 'netWeight', 'theoryWeight'],
|
|
|
+ tableData: [],
|
|
|
+ tableTop: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -275,6 +280,43 @@ export default {
|
|
|
this.getRequestUrl()
|
|
|
},
|
|
|
methods: {
|
|
|
+ func(res) {
|
|
|
+ console.log(res, 'res')
|
|
|
+ this.tableTop = res.columnData
|
|
|
+ },
|
|
|
+ exportExcel() {
|
|
|
+ //创建工作簿对象
|
|
|
+ let wb = XLSX.utils.book_new()
|
|
|
+ let data = []
|
|
|
+ let queryMap = {}
|
|
|
+ queryMap[this.screen] = this.con
|
|
|
+ queryMap[this.screen1] = this.con1
|
|
|
+ if (this.loginName != null) {
|
|
|
+ queryMap['consigneeName'] = this.loginName
|
|
|
+ }
|
|
|
+ if (this.orgCode == 'xiaoshouyewuyuan') {
|
|
|
+ queryMap['saler'] = getCookie('loginName')
|
|
|
+ }
|
|
|
+ queryMap.isExcel = 1
|
|
|
+ this.axios
|
|
|
+ .post('/api/v1/wms/getOyeRealTimeResult', queryMap)
|
|
|
+ .then(res => {
|
|
|
+ this.tableData = res.data.data
|
|
|
+ this.tableData.forEach((item, index) => {
|
|
|
+ let temp = {}
|
|
|
+ this.tableTop.forEach(col => {
|
|
|
+ temp[col.label] = item[col.prop]
|
|
|
+ })
|
|
|
+ data.push(temp)
|
|
|
+ })
|
|
|
+ //将json数组转换成sheet
|
|
|
+ let table_sheet = XLSX.utils.json_to_sheet(data)
|
|
|
+ //为工作簿添加sheet
|
|
|
+ XLSX.utils.book_append_sheet(wb, table_sheet, '欧冶实时库存')
|
|
|
+ //导出
|
|
|
+ XLSX.writeFile(wb, '欧冶实时库存' + '.xlsx')
|
|
|
+ })
|
|
|
+ },
|
|
|
returnClassName({ row, column, rowIndex, columnIndex }) {
|
|
|
return {
|
|
|
fontWeight: '500 !important',
|