Commit 1d96b060 by yancanhua

fix: 自测问题修改

1 parent 98163d4e
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
<a-button @click="handleBatchBind(2)">批量解绑</a-button> <a-button @click="handleBatchBind(2)">批量解绑</a-button>
</div> </div>
<div class="flex justify-end" style="float: right;"> <div class="flex justify-end" style="float: right;">
<a-button type="primary" @click="downloadExcel" :disabled="exporting">导出</a-button> <a-button type="primary" @click="modalVisible = true, excelValue = '1'" :disabled="exporting">
导出
</a-button>
</div> </div>
</div> </div>
...@@ -91,6 +93,18 @@ ...@@ -91,6 +93,18 @@
</template> </template>
</a-table> </a-table>
<bind-dialog ref="bindDialogRef" @emitOk="handlePageReload" /> <bind-dialog ref="bindDialogRef" @emitOk="handlePageReload" />
<a-modal :visible="modalVisible" @ok="handleVisibleOk" @cancel="modalVisible = false" title="导出范围"
width="420px">
<div>
<div class="visible-title">请选择导出范围 <span class="validate">*</span> </div>
<a-select v-model:value="excelValue" style="width: 100%" placeholder="请选择导出范围">
<a-select-option value="1">导出全部</a-select-option>
<a-select-option value="2">导出当前筛选结果</a-select-option>
</a-select>
</div>
</a-modal>
</a-card> </a-card>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -123,6 +137,9 @@ export default class DetectionReportPage extends PaginationComponent<Vehicle> { ...@@ -123,6 +137,9 @@ export default class DetectionReportPage extends PaginationComponent<Vehicle> {
{ label: '未绑定', value: 2 }, { label: '未绑定', value: 2 },
]; ];
modalVisible = false;
excelValue = '1';
vehicleStateList = [ vehicleStateList = [
{ label: '待入库', value: 'INVENTORY' }, { label: '待入库', value: 'INVENTORY' },
{ label: '场地待维护', value: 'VENUE' }, { label: '场地待维护', value: 'VENUE' },
...@@ -232,11 +249,30 @@ export default class DetectionReportPage extends PaginationComponent<Vehicle> { ...@@ -232,11 +249,30 @@ export default class DetectionReportPage extends PaginationComponent<Vehicle> {
}); });
} }
//导出Excel handleVisibleOk() {
this.modalVisible = false;
this.downloadExcel();
}
downloadExcel(): void { downloadExcel(): void {
this.exporting = true; this.exporting = true;
DetectionController.inspectReportExport(this.axios, this.pagination.requestParams, { responseType: 'blob' }).then(response => { let paramsData = {
message.success('导出任务已创建,请稍后在浏览器下载列表中查看'); ...this.pagination.requestParams,
}
if (this.excelValue == '2') {
if (!this.selectIds.length) {
message.error('请选择需要导出的数据');
this.exporting = false;
return false
} else {
if (!paramsData.filters) {
paramsData.filters = []
}
paramsData.filters.push({ field: "id", logic: "and", operator: "in", value: this.selectIds, })
}
}
DetectionController.inspectReportExport(this.axios, paramsData, { responseType: 'blob' }).then(response => {
message.success('导出任务已创建,请在下载中心查看');
ExportUtil.downloadExcelFile(response.data, this.getNewTime() + '-检测报告管理'); ExportUtil.downloadExcelFile(response.data, this.getNewTime() + '-检测报告管理');
}).catch(error => { }).catch(error => {
console.error('Error downloading Word file:', error); console.error('Error downloading Word file:', error);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!