|
|
@ -39,6 +39,7 @@ |
|
|
<el-form-item label=" "> |
|
|
<el-form-item label=" "> |
|
|
<el-button type="primary" @click="handleQuery">查询</el-button> |
|
|
<el-button type="primary" @click="handleQuery">查询</el-button> |
|
|
<el-button @click="resetQuery">重置</el-button> |
|
|
<el-button @click="resetQuery">重置</el-button> |
|
|
|
|
|
<el-button type="primary" :loading="exportLoading" @click="exportExcel">导出</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
|
|
|
|
|
|
@ -70,12 +71,22 @@ |
|
|
{{ formatNumber(scope.row.transQty) }} |
|
|
{{ formatNumber(scope.row.transQty) }} |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
<el-table-column prop="orderTotalAmount" label="总金额" min-width="120" align="right"> |
|
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
{{ formatNumber(scope.row.orderTotalAmount) }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</el-table-column> |
|
|
<el-table-column prop="batchNo" label="序列号" min-width="130" align="center"></el-table-column> |
|
|
<el-table-column prop="batchNo" label="序列号" min-width="130" align="center"></el-table-column> |
|
|
<el-table-column prop="transDate" label="出库时间" min-width="160" align="center"></el-table-column> |
|
|
<el-table-column prop="transDate" label="出库时间" min-width="160" align="center"></el-table-column> |
|
|
<el-table-column prop="transType" label="记录类型" min-width="100" align="center"></el-table-column> |
|
|
<el-table-column prop="transType" label="记录类型" min-width="100" align="center"></el-table-column> |
|
|
<el-table-column prop="operateUserName" label="操作人" min-width="120" align="center"></el-table-column> |
|
|
<el-table-column prop="operateUserName" label="操作人" min-width="120" align="center"></el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
|
|
<div class="total-amount-bar"> |
|
|
|
|
|
<span class="total-amount-label">金额合计:</span> |
|
|
|
|
|
<span>{{ formatNumber(queryTotalAmount) }}</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<el-pagination |
|
|
<el-pagination |
|
|
style="margin-top: 8px" |
|
|
style="margin-top: 8px" |
|
|
@size-change="sizeChangeHandle" |
|
|
@size-change="sizeChangeHandle" |
|
|
@ -90,7 +101,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { getRepairWorkOrderPartSpareList } from '@/api/partspare/repairtransdetail.js' |
|
|
|
|
|
|
|
|
import { getRepairWorkOrderPartSpareList, exportRepairWorkOrderPartSpareList } from '@/api/partspare/repairtransdetail.js' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: 'workOrderSpareQuery', |
|
|
name: 'workOrderSpareQuery', |
|
|
@ -108,13 +119,15 @@ export default { |
|
|
startTransDate: defaultDateRange.startTransDate, |
|
|
startTransDate: defaultDateRange.startTransDate, |
|
|
endTransDate: defaultDateRange.endTransDate, |
|
|
endTransDate: defaultDateRange.endTransDate, |
|
|
page: 1, |
|
|
page: 1, |
|
|
limit: 20 |
|
|
|
|
|
|
|
|
limit: 50 |
|
|
}, |
|
|
}, |
|
|
dataList: [], |
|
|
dataList: [], |
|
|
dataListLoading: false, |
|
|
dataListLoading: false, |
|
|
|
|
|
exportLoading: false, |
|
|
pageIndex: 1, |
|
|
pageIndex: 1, |
|
|
pageSize: 20, |
|
|
|
|
|
totalPage: 0 |
|
|
|
|
|
|
|
|
pageSize: 50, |
|
|
|
|
|
totalPage: 0, |
|
|
|
|
|
queryTotalAmount: 0 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
activated () { |
|
|
activated () { |
|
|
@ -140,7 +153,7 @@ export default { |
|
|
const tableTop = this.$refs.mainTable && this.$refs.mainTable.$el |
|
|
const tableTop = this.$refs.mainTable && this.$refs.mainTable.$el |
|
|
? this.$refs.mainTable.$el.getBoundingClientRect().top |
|
|
? this.$refs.mainTable.$el.getBoundingClientRect().top |
|
|
: 220 |
|
|
: 220 |
|
|
const paginationHeight = 90 |
|
|
|
|
|
|
|
|
const paginationHeight = 120 |
|
|
const minHeight = 240 |
|
|
const minHeight = 240 |
|
|
this.height = Math.max(window.innerHeight - tableTop - paginationHeight, minHeight) |
|
|
this.height = Math.max(window.innerHeight - tableTop - paginationHeight, minHeight) |
|
|
}) |
|
|
}) |
|
|
@ -182,18 +195,61 @@ export default { |
|
|
this.pageIndex = data.page.currPage |
|
|
this.pageIndex = data.page.currPage |
|
|
this.pageSize = data.page.pageSize |
|
|
this.pageSize = data.page.pageSize |
|
|
this.totalPage = data.page.totalCount |
|
|
this.totalPage = data.page.totalCount |
|
|
|
|
|
if (this.dataList.length > 0) { |
|
|
|
|
|
const totalAmount = Number(this.dataList[0].totalAmount) |
|
|
|
|
|
this.queryTotalAmount = isNaN(totalAmount) ? 0 : totalAmount |
|
|
|
|
|
} else { |
|
|
|
|
|
this.queryTotalAmount = 0 |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
this.dataList = [] |
|
|
this.dataList = [] |
|
|
this.totalPage = 0 |
|
|
this.totalPage = 0 |
|
|
|
|
|
this.queryTotalAmount = 0 |
|
|
this.$message.error(data.msg || '查询失败') |
|
|
this.$message.error(data.msg || '查询失败') |
|
|
} |
|
|
} |
|
|
}).catch(() => { |
|
|
}).catch(() => { |
|
|
this.dataListLoading = false |
|
|
this.dataListLoading = false |
|
|
this.dataList = [] |
|
|
this.dataList = [] |
|
|
this.totalPage = 0 |
|
|
this.totalPage = 0 |
|
|
|
|
|
this.queryTotalAmount = 0 |
|
|
this.$message.error('查询失败') |
|
|
this.$message.error('查询失败') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
async exportExcel () { |
|
|
|
|
|
try { |
|
|
|
|
|
this.exportLoading = true |
|
|
|
|
|
const params = { |
|
|
|
|
|
...this.queryForm, |
|
|
|
|
|
userName: this.$store.state.user.name |
|
|
|
|
|
} |
|
|
|
|
|
const response = await exportRepairWorkOrderPartSpareList(params) |
|
|
|
|
|
|
|
|
|
|
|
const now = new Date() |
|
|
|
|
|
const pad = n => n.toString().padStart(2, '0') |
|
|
|
|
|
const timeStr = |
|
|
|
|
|
now.getFullYear() + |
|
|
|
|
|
pad(now.getMonth() + 1) + |
|
|
|
|
|
pad(now.getDate()) + |
|
|
|
|
|
pad(now.getHours()) + |
|
|
|
|
|
pad(now.getMinutes()) + |
|
|
|
|
|
pad(now.getSeconds()) |
|
|
|
|
|
const fileName = `维修工单备件查询_${timeStr}.xlsx` |
|
|
|
|
|
|
|
|
|
|
|
const url = window.URL.createObjectURL(new Blob([response.data])) |
|
|
|
|
|
const link = document.createElement('a') |
|
|
|
|
|
link.href = url |
|
|
|
|
|
link.setAttribute('download', fileName) |
|
|
|
|
|
document.body.appendChild(link) |
|
|
|
|
|
link.click() |
|
|
|
|
|
link.remove() |
|
|
|
|
|
window.URL.revokeObjectURL(url) |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('导出失败:', error) |
|
|
|
|
|
this.$message.error('导出失败') |
|
|
|
|
|
} finally { |
|
|
|
|
|
this.exportLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
formatNumber (value) { |
|
|
formatNumber (value) { |
|
|
if (value === null || value === undefined || value === '') { |
|
|
if (value === null || value === undefined || value === '') { |
|
|
return '' |
|
|
return '' |
|
|
@ -214,4 +270,20 @@ export default { |
|
|
width: 16px; |
|
|
width: 16px; |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.total-amount-bar { |
|
|
|
|
|
display: flex; |
|
|
|
|
|
justify-content: flex-end; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
margin-top: 8px; |
|
|
|
|
|
padding: 8px 12px; |
|
|
|
|
|
border: 1px solid #ebeef5; |
|
|
|
|
|
background: #f5f7fa; |
|
|
|
|
|
color: #303133; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.total-amount-label { |
|
|
|
|
|
margin-right: 6px; |
|
|
|
|
|
font-weight: 600; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |