Files
mp-10579/src/views/credit/creditCaseFiling/components/credit-case-filing-import.vue
赵忠林 d3345d14d6 style(credit): 格式化代码并优化表格渲染逻辑
- 统一API请求参数格式化,在多个信用模块中添加对象参数换行
- 移除多余空行和尾随逗号,保持代码整洁
- 优化信用公司组件中的表格列配置,修复被执行人字段显示逻辑
- 调整信用案件导入模板下载链接的布局格式
- 优化表格数据分页计算,改进总数判断逻辑
- 调整搜索组件中注释按钮的缩进格式
- 修复信用司法页面的导入按钮组件路径引用格式
2026-02-14 17:37:48 +08:00

94 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 司法大数据导入弹窗 -->
<template>
<ele-modal
:width="520"
:footer="null"
title="立案信息批量导入"
:visible="visible"
@update:visible="updateVisible"
>
<a-spin :spinning="loading">
<a-upload-dragger
accept=".xls,.xlsx"
:show-upload-list="false"
:customRequest="doUpload"
style="padding: 24px 0; margin-bottom: 16px"
>
<p class="ant-upload-drag-icon">
<cloud-upload-outlined />
</p>
<p class="ant-upload-hint">将文件拖到此处或点击上传</p>
</a-upload-dragger>
</a-spin>
<div class="ele-text-center">
<span>只能上传xlsxlsx文件</span>
<a :href="templateUrl" download="立案信息导入模板.xlsx"> 下载导入模板 </a>
</div>
</ele-modal>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { message } from 'ant-design-vue/es';
import { CloudUploadOutlined } from '@ant-design/icons-vue';
import { importCreditCaseFiling } from '@/api/credit/creditCaseFiling';
import { API_BASE_URL } from '@/config/setting';
const emit = defineEmits<{
(e: 'done'): void;
(e: 'update:visible', visible: boolean): void;
}>();
defineProps<{
// 是否打开弹窗
visible: boolean;
}>();
// 导入请求状态
const loading = ref(false);
// 模板下载地址,保持与当前接口域名一致
const templateUrl = computed(() => {
const base = (localStorage.getItem('ApiUrl') || API_BASE_URL || '').replace(
/\/$/,
''
);
return `${base}/credit/credit-case-filing/import/template`;
});
/* 上传 */
const doUpload = ({ file }) => {
if (
![
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
].includes(file.type)
) {
message.error('只能选择 excel 文件');
return false;
}
if (file.size / 1024 / 1024 > 10) {
message.error('大小不能超过 10MB');
return false;
}
loading.value = true;
importCreditCaseFiling(file)
.then((msg) => {
loading.value = false;
message.success(msg);
updateVisible(false);
emit('done');
})
.catch((e) => {
loading.value = false;
message.error(e.message);
});
return false;
};
/* 更新 visible */
const updateVisible = (value: boolean) => {
emit('update:visible', value);
};
</script>