修试平衡表

This commit is contained in:
bb_pan 2025-03-26 16:04:04 +08:00
parent 541bd8c192
commit 2ecbe09cfd
2 changed files with 44 additions and 45 deletions

View File

@ -6,14 +6,14 @@
</div>
<div class="f-count">{{ state.count }}</div>
<div class="f-14">
<span v-if="state.isReduce">
<span v-if="!state.isIncrease">
较上月降低
<span style="color: red">{{ state.num || 0 }}</span>
<span style="color: red">{{ state.increase || 0 }}</span>
%
</span>
<span v-else>较上月增长 {{ state.num || 0 }} %</span>
<span v-else>较上月增长 {{ state.increase || 0 }} %</span>
<svg-icon v-if="state.isReduce" icon-class="down_arrow" />
<svg-icon v-if="!state.isIncrease" icon-class="down_arrow" />
<svg-icon v-else icon-class="up_arrow" />
</div>
</div>

View File

@ -82,6 +82,7 @@
<script>
import { getRepairHomeTotalListApi, getRepairHomeListApi } from '@/api/home/maintain-balance'
import CardModel from './components/card-model' //
export default {
components: {
CardModel
@ -105,41 +106,41 @@ export default {
title: '总接收量',
theme: '#5ad55a',
icon: 'In_the_library',
isReduce: false,
num: '19.5',
count: 185483
isIncrease: true,
increase: 0,
count: 0
},
{
title: '已修数量',
theme: '#0099ff',
icon: 'In_use',
isReduce: true,
num: '15.5',
count: 473892
isIncrease: true,
increase: 0,
count: 0
},
{
title: '在修数量',
theme: '#8167f5',
icon: 'In_repair',
isReduce: false,
num: '10.5',
count: 293874
isIncrease: true,
increase: 0,
count: 0
},
{
title: '报废数量',
theme: '#bfbf00',
icon: 'scrapped',
isReduce: true,
num: '16.5',
count: 842390
isIncrease: true,
increase: 0,
count: 0
},
{
title: '试验数量',
theme: '#b8741a',
icon: 'repair_store',
isReduce: true,
num: '10.5',
count: 184324
isIncrease: true,
increase: 0,
count: 0
}
],
pickerOptions: {
@ -167,7 +168,6 @@ export default {
},
created() {
this.queryDate = this.getDefaultDateRange()
this.getAllNum()
this.getList()
},
methods: {
@ -179,43 +179,47 @@ export default {
this.queryParams.startTime = ''
this.queryParams.endTime = ''
}
const loading = this.$loading({ text: '加载中...' })
// console.log('🚀 ~ getList ~ this.queryParams:', this.queryParams)
try {
const res = await getRepairHomeListApi(this.queryParams)
// console.log('🚀 ~ getList ~ res:', res)
this.tableList = res.data.rows
this.total = res.data.total
const res2 = await getRepairHomeTotalListApi(this.queryParams)
if (res2.code === 200 && res2.data) {
res2.data.forEach((item, index) => {
this.cardList_2[index].increase = item.increase
this.cardList_2[index].isIncrease = item.isIncrease
if (index === 0) {
this.cardList_2[0].count = item.backNum
} else if (index === 1) {
this.cardList_2[1].count = item.repairedNum
} else if (index === 2) {
this.cardList_2[2].count = item.repairingNum
} else if (index === 3) {
this.cardList_2[3].count = item.scrapNum
} else if (index === 4) {
this.cardList_2[4].count = item.testNum
}
})
}
loading.close()
} catch (error) {
console.log('🚀 ~ getList ~ error:', error)
}
},
async getAllNum() {
if (this.queryDate) {
this.queryParams.startTime = this.queryDate[0]
this.queryParams.endTime = this.queryDate[1]
} else {
this.queryParams.startTime = ''
this.queryParams.endTime = ''
}
try {
const res = await getRepairHomeTotalListApi(this.queryParams)
// console.log('🚀 ~ getAllNum ~ res:', res)
} catch (error) {
console.log('🚀 ~ getAllNum ~ error:', error)
loading.close()
}
},
//
onHandleSearch() {
this.queryParams.pageNum = 1
this.getList()
this.getAllNum()
},
//
onHandleReset() {
this.queryDate = this.getDefaultDateRange()
this.$refs.queryFormRef.resetFields()
this.getList()
this.getAllNum()
},
//
getDefaultDateRange() {
@ -243,11 +247,6 @@ export default {
},
//
handleExport() {
//
this.$message({
type: 'warning',
message: '导出功能尚开发中,敬请期待!'
})
if (this.queryDate) {
this.queryParams.startTime = this.queryDate[0]
this.queryParams.endTime = this.queryDate[1]
@ -256,11 +255,11 @@ export default {
this.queryParams.endTime = ''
}
try {
let fileName = `数据_${new Date().getTime()}.xLsx`
let url = ''
let fileName = `修试平衡表_${new Date().getTime()}.xLsx`
let url = '/material/repair_audit_details/exportRepairHomeList'
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
// this.download(url, params, fileName)
this.download(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}