Files
mp-10579/src/views/credit/creditUser/components/credit-user-import.vue
赵忠林 424e5641bb feat(credit): 赊账客户模块更名为招投标信息模块
- 修改.env.development中的API地址注释为启用状态
- 将赊账客户相关组件及接口重命名为招投标信息相关
- 更新导入模板文件名为"招投标导入模板.xlsx"
- 调整编辑表单字段,将"唯一标识"改为"发布日期"
- 移除部分冗余表单项如类型、上级ID、国家省市等字段
- 修改列表展示字段,优化列标题如"客户名称"改为"项目名称"
- 更新API模型定义文件,调整字段描述和部分字段类型
- 删除部分无用的搜索条件和表格列配置项
- 调整表单校验提示信息与新业务场景匹配
- 清理废弃代码及注释内容,统一命名规范
2025-12-16 14:59:30 +08:00

94 lines
2.4 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 { importCreditUsers } from '@/api/credit/creditUser';
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-user/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;
importCreditUsers(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>