报告查询

This commit is contained in:
hayu 2025-10-30 10:12:16 +08:00
parent 4fc8bb6606
commit 9f24743e4f
2 changed files with 971 additions and 1 deletions

View File

@ -180,3 +180,31 @@ export function getScrapDetailsListApi(query) {
params: query
})
}
//报表查询
export function getReportList(query) {
return request({
url: '/material/bm_report/reportList',
method: 'get',
params: query,
})
}
export function downloadFileApi(data) {
return request({
url: '/material/bm_report/downloadSingle',
method: 'post',
data,
responseType: 'arraybuffer'
})
}
export function batchDownloadFileApi(data) {
return request({
url: '/material/bm_report/downloadBulk',
method: 'post',
data,
responseType: 'arraybuffer'
})
}

View File

@ -0,0 +1,942 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="分公司" prop="impUnitName">
<el-select
v-model="queryParams.impUnitName"
placeholder="请选择分公司"
clearable
filterable
style="width: 240px"
@change="handleImpUnitChange"
>
<el-option
v-for="item in impUnitOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="项目部" prop="departName">
<el-select
v-model="queryParams.departName"
placeholder="请选择项目部"
clearable
filterable
style="width: 240px"
@change="handleDepartChange"
>
<el-option
v-for="item in departOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="工程" prop="proName">
<el-select
v-model="queryParams.proName"
placeholder="请选择工程"
clearable
filterable
style="width: 240px"
>
<el-option
v-for="item in proOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="物资名称" prop="typeName">
<el-select
v-model="queryParams.typeName"
placeholder="请选择物资名称"
clearable
filterable
style="width: 240px"
@change="handleMaModel"
>
<el-option
v-for="item in materialNameList"
:key="item.value"
:label="item.label"
:value="item.label"
/>
</el-select>
</el-form-item>
<el-form-item label="规格型号" prop="typeModelName">
<el-select
v-model="queryParams.typeModelName"
placeholder="请选择规格型号"
clearable
filterable
style="width: 240px"
>
<el-option
v-for="item in materialModelList"
:key="item.value"
:label="item.label"
:value="item.label"
/>
</el-select>
</el-form-item>
<el-form-item label="机具类型" prop="jiJuType">
<el-select
v-model="queryParams.jiJuType"
placeholder="请选择机具类型"
clearable
style="width: 240px"
>
<el-option label="施工机具" :value="1" />
<el-option label="安全工器具" :value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-download" size="mini" @click="handleBulkDownload">一键下载</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList" ref="multipleTable" row-key="id" @selection-change="handleSelectionChange" border>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" align="center" width="70" type="index">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="分公司" align="center" prop="impUnitName" :show-overflow-tooltip="true"/>
<el-table-column label="项目部" align="center" prop="departName" :show-overflow-tooltip="true"/>
<el-table-column label="工程名称" align="center" prop="proName" :show-overflow-tooltip="true"/>
<el-table-column label="物资名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="计量单位" align="center" prop="unit" :show-overflow-tooltip="true"/>
<el-table-column label="数量" align="center" prop="num" :show-overflow-tooltip="true"/>
<el-table-column label="编码" align="center" prop="maCode" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span
v-if="scope.row.maCode"
:style="{
color: scope.row.qrCode ? '#3EA7F1' : '#000000',
cursor: scope.row.qrCode ? 'pointer' : 'default'
}"
@click="scope.row.qrCode && handleViewQrCode(scope.row)"
>
{{ scope.row.maCode }}
</span>
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="领用日期" align="center" prop="leaseTime" :show-overflow-tooltip="true"/>
<el-table-column label="出库检验报告" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<span
@click="handleReport(scope.row)"
style="color: #3EA7F1; text-decoration: none; cursor: pointer;"
>查看</span>
</template>
</el-table-column>
<el-table-column label="合格证" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="!scope.row.qualifiedUrl"></span>
<span
v-else
@click="handleFileView(scope.row.qualifiedUrl)"
style="color: #3EA7F1; text-decoration: none; cursor: pointer;"
>查看</span>
</template>
</el-table-column>
<el-table-column label="型式试验报告" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="!scope.row.testReportUrl"></span>
<span
v-else
@click="handleFileView(scope.row.testReportUrl)"
style="color: #3EA7F1; text-decoration: none; cursor: pointer;"
>查看</span>
</template>
</el-table-column>
<el-table-column label="第三方检测报告" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="!scope.row.thirdReportUrl"></span>
<span
v-else
@click="handleFileView(scope.row.thirdReportUrl)"
style="color: #3EA7F1; text-decoration: none; cursor: pointer;"
>查看</span>
</template>
</el-table-column>
<el-table-column label="出厂检测报告" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="!scope.row.factoryReportUrl"></span>
<span
v-else
@click="handleFileView(scope.row.factoryReportUrl)"
style="color: #3EA7F1; text-decoration: none; cursor: pointer;"
>查看</span>
</template>
</el-table-column>
<el-table-column label="其他" align="center" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="!scope.row.otherReportUrl"></span>
<span
v-else
@click="handleFileView(scope.row.otherReportUrl)"
style="color: #3EA7F1; text-decoration: none; cursor: pointer;"
>查看</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="140">
<template slot-scope="scope">
<el-button size="mini" type="primary" @click="handleDownload(scope.row)">下载</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 验收单弹窗 -->
<el-dialog :title="title" :visible.sync="openOutReport" width="70%" append-to-body>
<div style="height: 600px; overflow-y: scroll; padding: 0 20px">
<vue-easy-print tableShow ref="remarksPrintRefCheck" class="print" :printable="'checkId1'">
<div id="checkId1">
<div class="title" style="text-align: center; font-weight: 600; font-size: 16px">
施工机具设备出库检验记录表
</div>
<div class="info" style="margin-top: 10px; display: flex; flex-wrap: wrap">
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
<span>领用工程</span>
{{ checkDataInfo.leaseProject }}
</div>
<div class="item" style="width: 50%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px">
<span>使用单位</span>
{{ checkDataInfo.leaseUnit }}
</div>
</div>
<table
class="print-table"
style="margin-top: 20px; width: 100%; border-collapse: collapse"
border="1"
>
<thead>
<tr>
<th style="text-align: center">机具名称</th>
<th style="text-align: center">规格型号</th>
<th style="text-align: center">单位</th>
<th style="text-align: center">数量</th>
<th style="text-align: center">设备编码</th>
<th style="text-align: center">额定载荷KN</th>
<th style="text-align: center">试验载荷KN</th>
<th style="text-align: center">持荷时间min</th>
<th style="text-align: center; width: 100px">试验日期</th>
<th style="text-align: center; width: 100px">下次试验日期</th>
<th style="text-align: center">检验结论</th>
<th style="text-align: center">备注</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in printTableData" :key="index">
<td style="text-align: center">{{ item.typeName }}</td>
<td style="text-align: center">{{ item.typeModelName }}</td>
<td style="text-align: center">{{ item.unit }}</td>
<td style="text-align: center">{{ item.num }}</td>
<td style="text-align: center">{{ item.maCode }}</td>
<td style="text-align: center">{{ item.ratedLoad }}</td>
<td style="text-align: center">{{ item.testLoad }}</td>
<td style="text-align: center">{{ item.holdingTime }}</td>
<td style="text-align: center">{{ item.testTime }}</td>
<td style="text-align: center">{{ item.nextTestTime }}</td>
<td style="text-align: center">{{ item.checkResult }}</td>
<td style="text-align: center">{{ item.remark }}</td>
</tr>
</tbody>
</table>
<div
class="fillIn"
style="margin-top: 20px; display: flex; align-items: center; justify-content: right"
>
<div class="item" style="width: 30%; align-items: center; position: relative">
<div>
<span>检验单位</span>
</div>
<div v-if="openOutReport">
<canvas
id="canvas"
width="165"
height="165"
style="
position: absolute;
top: 180%;
left: 90%;
transform: translate(-100%, -50%);
z-index: 9999;
"
></canvas>
</div>
</div>
</div>
</div>
</vue-easy-print>
</div>
<div slot="footer" class="dialog-footer" style="text-align: center">
<!-- <el-button type="primary" @click="handleExportCheck">导出</el-button>-->
<el-button type="primary" @click="printCheck"> </el-button>
<el-button @click="closeDialogAndRefresh"> </el-button>
</div>
</el-dialog>
<!-- 二维码下载对话框 -->
<el-dialog title="二维码查看" :visible.sync="uploadOpen" width="450px" append-to-body :close-on-click-modal="false">
<div style="text-align: center" ref="codeQr" v-if="uploadOpen">
<div class="uploadImg">
<div id="qrcode" class="qrcode" ref="codeItem"></div>
</div>
<div class="boxCode">{{ rowObj.maCode }}</div>
</div>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="downloadQrCode(rowObj)"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import vueEasyPrint from "vue-easy-print";
import {batchDownloadFileApi, downloadFileApi, getReportList} from "@/api/report/report";
import {getDepartListByImpUnitApi, getImpUnitListApi, getProListByDepartApi} from "@/api/materialsStation";
import {getDeviceType} from "@/api/ma/device";
import {getCheckInfo} from "@/api/lease/apply";
import printJS from "print-js";
import QRCode from "qrcodejs2";
import axios from 'axios'
import {downloadFile} from "@/utils/download";
export default {
name: "PartAccept",
dicts: ['part_task_status'],
components: { vueEasyPrint },
data() {
return {
//
loading: false,
//
single: true,
//
multiple: true,
//
showSearch: true,
showHouse: false,
dateRange:[],
ids: [],
infos: [],
//
total: 0,
//
tableList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord:undefined,
taskStatus:undefined,
},
impUnitOptions: [], //
departOptions: [], //
proOptions: [], //
materialNameList: [],
materialModelList: [],
openOutReport: false,
checkDataInfo: {},
printTableData: [],
uploadOpen: false,
rowObj: {},
};
},
created() {
this.getList();
this.getImpUnitOptions()
this.handleImpUnitChange()
this.handleDepartChange()
this.getDeviceType()
},
methods: {
/** 获取分公司下拉 */
async getImpUnitOptions() {
try {
const res = await getImpUnitListApi() //
this.impUnitOptions = res.data.map(item => ({
label: item.impUnitName, //
value: item.impUnitName
}))
} catch (e) {
console.error('获取分公司下拉失败:', e)
}
},
/** 分公司选择变化,加载项目部 */
async handleImpUnitChange() {
this.queryParams.departName = null //
this.departOptions = [] //
try {
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName:this.queryParams.teamName,
subUnitName:this.queryParams.subUnitName,
}
const res = await getDepartListByImpUnitApi(params)
this.departOptions = res.data.map(item => ({
label: item.departName, //
value: item.departName
}))
} catch (e) {
console.error('获取项目部下拉失败:', e)
}
},
/** 项目部选择变化,加载工程 */
async handleDepartChange() {
this.queryParams.proName = null //
this.proOptions = [] //
try {
//
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName:this.queryParams.teamName,
subUnitName:this.queryParams.subUnitName,
}
const res = await getProListByDepartApi(params)
this.proOptions = res.data.map(item => ({
label: item.proName, //
value: item.proName
}))
} catch (e) {
console.error('获取工程下拉失败:', e)
}
},
getDeviceType() {
getDeviceType({ level: 3, skipPermission: 1 }).then(response => {
let matNameRes = response.data
this.materialNameList = matNameRes.map((item) => {
return {
label: item.typeName,
value: item.typeId
}
})
})
getDeviceType({ level: 4, skipPermission: 1 }).then(response => {
let matModelRes = response.data
this.materialModelList = matModelRes.map((item) => {
return {
label: item.typeName,
value: item.typeId
}
})
})
},
// change
handleMaModel(e) {
this.queryParams.typeModelName=null
this.materialModelList = []
let typeId = null
if (!e) {
typeId = null
} else {
typeId = this.materialNameList.find(item => item.label == e).value
}
console.log('🚀 ~ handleMaModel ~ typeId:', typeId)
getDeviceType({ level: 4, skipPermission: 1, typeId }).then(response => {
let matModelRes = response.data
this.materialModelList = matModelRes.map((item) => {
return {
label: item.typeName,
value: item.typeId
}
})
})
},
/** 查询列表 */
getList() {
this.loading = true;
if(this.dateRange.length>0){
this.queryParams.startTime=this.dateRange[0]
this.queryParams.endTime=this.dateRange[1]
}else{
this.queryParams.startTime=undefined
this.queryParams.endTime=undefined
}
this.queryParams.taskStage = 3
getReportList(this.queryParams).then(response => {
this.tableList = response.data.rows;
this.total = response.data.total;
this.loading = false;
});
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.dateRange=[]
this.queryParams.keyWord=null;
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.infos = selection.map(item => ({ id: item.id }))
this.single = selection.length != 1
this.multiple = !selection.length
},
//
handleView(row){
console.log(row)
let query = { Id:row.id,taskId: row.taskId,isView:"true" }
this.$tab.closeOpenPage({
path: '/part/partAcceptDetail',
query,
})
},
//
handleFileView(url) {
if (!url) return;
//
const fileExt = url.split('.').pop().toLowerCase();
//
const imgExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
const pdfExts = ['pdf'];
const docExts = ['doc', 'docx', 'xls', 'xlsx'];
if (imgExts.includes(fileExt)) {
//
this.$viewerApi ? this.$viewerApi({ images: [url] }) : window.open(url);
} else if (pdfExts.includes(fileExt)) {
// PDF
window.open(url);
} else if (docExts.includes(fileExt)) {
// WordExcel
this.downloadFile(url);
} else {
//
this.downloadFile(url);
}
},
//
downloadFile(url) {
const link = document.createElement('a');
link.href = url;
const fileName = url.substring(url.lastIndexOf('/') + 1);
link.setAttribute('download', fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
//
async handleReport(row) {
this.checkDataInfo = {
leaseProject:row.proName,
leaseUnit:row.departName
}
this.printTableData = [
{
typeName:row.typeName,
typeModelName:row.typeModelName,
unit:row.unit,
num:row.num,
maCode:row.maCode,
ratedLoad:row.ratedLoad,
testLoad:row.testLoad,
holdingTime:row.holdingTime,
testTime:row.testTime,
nextTestTime:row.nextTestTime,
checkResult:row.checkResult,
remark: ''
}
]
setTimeout(() => {
this.chapter('检验专用章', '安徽送变电工程有限公司机具(物流)分公司')
}, 200)
this.openOutReport = true
this.title = '出库检验单'
},
//
printCheck() {
// this.$refs.remarksPrintRefCheck.print()
// printJS({
// printable: 'checkId1',
// type: 'html',
// targetStyles: ['*']
// //
// })
this.$nextTick(() => {
printJS({
printable: 'checkId1',
type: 'html',
style: `
@page { size: A4; margin: 0; }
body { margin: 0.5cm; font-family: SimSun; }
#passId { font-size: 18px; padding: 0 20px; }
`,
scanStyles: false
})
})
},
//
closeDialogAndRefresh() {
this.openOutReport = false
},
chapter(text, companyName) {
let canvas = document.getElementById('canvas')
let context = canvas.getContext('2d')
canvas.width = canvas.width
context.height = canvas.height
// //
// context.clearRect(0, 0, canvas.width, canvas.height);
//let text = "XXX";
//let companyName = "XXX";
//
let width = canvas.width / 2
let height = canvas.height / 2
context.lineWidth = 3
context.strokeStyle = '#f00'
context.beginPath()
context.arc(width, height, 80, 0, Math.PI * 2) //
context.stroke()
//
this.create5star(context, width, height, 20, '#f00', 0)
//
context.font = '100 13px 宋体'
context.textBaseline = 'middle' //
context.textAlign = 'center' //
context.lineWidth = 1
context.strokeStyle = '#ff2f2f'
context.strokeText(text, width, height + 50)
//
context.translate(width, height) // ,
context.font = '100 13px 宋体'
let count = companyName.length //
let angle = (4 * Math.PI) / (3 * (count - 1)) //
let chars = companyName.split('')
let c
for (let i = 0; i < count; i++) {
c = chars[i] //
if (i == 0) {
context.rotate((5 * Math.PI) / 6)
} else {
context.rotate(angle)
}
context.save()
context.translate(65, 0) // ,x
context.rotate(Math.PI / 2) // 90,x
context.strokeStyle = '#ff5050' //
context.strokeText(c, 0, 0) //
context.restore()
}
},
//
create5star(context, sx, sy, radius, color, rotato) {
context.save()
context.fillStyle = color
context.translate(sx, sy) //
context.rotate(Math.PI + rotato) //
context.beginPath() //
// let x = Math.sin(0);
// let y = Math.cos(0);
let dig = (Math.PI / 5) * 4
for (let i = 0; i < 5; i++) {
//
let x = Math.sin(i * dig)
let y = Math.cos(i * dig)
context.lineTo(x * radius, y * radius)
}
context.closePath()
context.stroke()
context.fill()
context.restore()
},
//
handleViewQrCode(row) {
console.log('🚀 ~ handleViewQrCode ~ row:', row)
this.rowObj = row
this.uploadOpen = true
this.qrCode = row.qrCode
let str = 'http://ahjj.jypxks.com:9988/imw/backstage/machine/qrCodePage?qrcode=' + row.qrCode
console.log('🚀 ~ handleViewQrCode ~ str:', str)
this.$nextTick(() => {
this.$refs.codeItem.innerHTML = ''
var qrcode = new QRCode(this.$refs.codeItem, {
text: str, //
width: 256,
height: 256,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
}, 500)
},
downloadQrCode(row) {
const qrContainer = document.createElement('div')
document.body.appendChild(qrContainer)
const qrSize = 512 //
const padding = 20 //
const fontSize = 68 //
const maxTextWidth = qrSize
const qrcode = new QRCode(qrContainer, {
text: 'http://ahjj.jypxks.com:9988/imw/backstage/machine/qrCodePage?qrcode=' + row.qrCode,
width: qrSize,
height: qrSize,
colorDark: '#000000',
colorLight: '#ffffff',
correctLevel: QRCode.CorrectLevel.H
})
setTimeout(() => {
const img = qrContainer.querySelector('img') || qrContainer.querySelector('canvas')
const text = row.maCode || ''
//
const ctxMeasure = document.createElement('canvas').getContext('2d')
ctxMeasure.font = `${fontSize}px Arial`
const words = text.split('')
let line = ''
const lines = []
for (let i = 0; i < words.length; i++) {
const testLine = line + words[i]
if (ctxMeasure.measureText(testLine).width > maxTextWidth) {
lines.push(line)
line = words[i]
} else {
line = testLine
}
}
lines.push(line)
//
const lineHeight = fontSize + 10
const qrCanvas = document.createElement('canvas')
qrCanvas.width = qrSize + padding * 2
qrCanvas.height = qrSize + padding * 2 + lines.length * lineHeight
const ctx = qrCanvas.getContext('2d')
ctx.fillStyle = '#fff'
ctx.fillRect(0, 0, qrCanvas.width, qrCanvas.height)
ctx.drawImage(img, padding, padding, qrSize, qrSize)
//
ctx.fillStyle = '#000'
ctx.font = `${fontSize}px Arial`
ctx.textAlign = 'center'
lines.forEach((ln, index) => {
ctx.fillText(ln, qrCanvas.width / 2, qrSize + padding + fontSize / 1.2 + index * lineHeight)
})
//
const a = document.createElement('a')
a.href = qrCanvas.toDataURL('image/png')
a.download = text + '.png'
a.click()
document.body.removeChild(qrContainer)
}, 500)
},
/** 单条下载 */
handleDownload(row) {
//
const payload = {
items: [
{
proName: row.proName || '',
departName: row.departName || '',
typeName: row.typeName || '',
typeModelName: row.typeModelName || '',
qualifiedUrl: row.qualifiedUrl || null,
testReportUrl: row.testReportUrl || null,
thirdReportUrl: row.thirdReportUrl || null,
factoryReportUrl: row.factoryReportUrl || null,
otherReportUrl: row.otherReportUrl || null,
unit:row.unit || '',
num:row.num || '',
maCode:row.maCode || '',
ratedLoad:row.ratedLoad || '',
testLoad:row.testLoad || '',
holdingTime:row.holdingTime || '',
testTime:row.testTime || '',
nextTestTime:row.nextTestTime || '',
checkResult:row.checkResult || '',
remark: ''
},
],
zipName: row.proName || 'report',
};
// 访
downloadFileApi(payload)
.then((res) => {
downloadFile({
fileName: (row.proName || '文件档案下载') + '.zip',
fileData: res,
fileType: 'application/zip',
});
})
.catch((err) => {
console.error('单条下载失败:', err);
this.$message.error('下载失败');
});
},
/**
* 一键下载多选
*/
async handleBulkDownload() {
const grouped = {};
try {
if (!this.infos || !this.infos.length) {
this.$message.warning('请先勾选要下载的行');
return;
}
// items
const items = this.infos.map((x) => {
const r = this.tableList.find(t => t.id === x.id) || {};
return {
proName: r.proName || '',
departName: r.departName || '',
typeName: r.typeName || '',
typeModelName: r.typeModelName || '',
qualifiedUrl: r.qualifiedUrl || null,
testReportUrl: r.testReportUrl || null,
thirdReportUrl: r.thirdReportUrl || null,
factoryReportUrl: r.factoryReportUrl || null,
otherReportUrl: r.otherReportUrl || null,
unit: r.unit || '',
num: r.num || '',
maCode: r.maCode || '',
ratedLoad: r.ratedLoad || '',
testLoad: r.testLoad || '',
holdingTime: r.holdingTime || '',
testTime: r.testTime || '',
nextTestTime: r.nextTestTime || '',
checkResult: r.checkResult || '',
remark: ''
};
});
// -> -> -
items.forEach(item => {
const proName = item.proName || "";
const leaseDate = item.testTime || "";
const typeFolder = `${item.typeName || ""}-${item.typeModelName || ""}`;
if (!grouped[proName]) grouped[proName] = {};
if (!grouped[proName][leaseDate]) grouped[proName][leaseDate] = {};
if (!grouped[proName][leaseDate][typeFolder]) grouped[proName][leaseDate][typeFolder] = [];
grouped[proName][leaseDate][typeFolder].push(item);
});
//
const flatItems = [];
Object.keys(grouped).forEach(proName => {
Object.keys(grouped[proName]).forEach(leaseDate => {
Object.keys(grouped[proName][leaseDate]).forEach(typeFolder => {
grouped[proName][leaseDate][typeFolder].forEach(item => {
// leaseDate item.testTime使
flatItems.push({ ...item, testTime: leaseDate });
});
});
});
});
const payload = {
items: flatItems,
zipName: `报告下载_${(new Date()).toISOString().slice(0,10)}`,
};
//
const res = await batchDownloadFileApi(payload);
//
downloadFile({
fileName: payload.zipName + '.zip',
fileData: res,
fileType: 'application/zip'
});
} catch (err) {
console.error('一键下载失败', err);
this.$message.error('一键下载失败');
}
}
}
};
</script>
<style lang="scss" scoped>
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
//css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
</style>