feat(credit): 更新客户信息编辑组件功能

- 替换城市输入框为省市区级联选择组件
- 新增步骤下拉选择框用于流程状态管理
- 集成文件选择组件替代原有文件路径输入框
- 实现文件上传和删除功能
- 添加文件列表管理和同步逻辑
- 优化搜索组件中关键词搜索框位置
- 完善查询参数过滤逻辑支持数组和单一值处理
This commit is contained in:
2026-03-19 17:19:03 +08:00
parent 56063e9bcd
commit a0a4cc7a8d
2 changed files with 75 additions and 8 deletions

View File

@@ -34,9 +34,9 @@
</a-button>
</a-upload>
<a-upload
v-else
v-else-if="type == 'image'"
:show-upload-list="false"
:accept="'image/*,application/*'"
:accept="'image/*'"
:customRequest="onUpload"
>
<a-button type="primary" class="ele-btn-icon">
@@ -46,6 +46,19 @@
<span>上传图片</span>
</a-button>
</a-upload>
<a-upload
v-else
:show-upload-list="false"
:accept="'image/*,application/*,text/*'"
:customRequest="onUpload"
>
<a-button type="primary" class="ele-btn-icon">
<template #icon>
<UploadOutlined />
</template>
<span>上传文件</span>
</a-button>
</a-upload>
<a-select
show-search
allow-clear
@@ -274,16 +287,36 @@
// 上传文件
const onUpload = (item) => {
const { file } = item;
if (!file.type.startsWith('image') && props.type != 'video') {
message.error('只能选择图片');
if (props.type == 'video') {
if (!file.type.startsWith('video')) {
message.error('只能选择视频');
return;
}
if (props.type == 'video') {
if (file.size / 1024 / 1024 > 100) {
message.error('大小不能超过 100MB');
return;
}
} else if (props.type == 'image') {
if (!file.type.startsWith('image')) {
message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 10) {
message.error('大小不能超过 10MB');
return;
}
} else {
// 默认:允许图片/文档等附件
const isAllowed =
file.type.startsWith('image') ||
file.type.startsWith('application') ||
file.type.startsWith('text') ||
file.type === 'application/octet-stream' ||
file.type === '';
if (!isAllowed) {
message.error('只能选择图片或文件');
return;
}
if (file.size / 1024 / 1024 > 10) {
message.error('大小不能超过 10MB');
return;

View File

@@ -16,7 +16,16 @@
</a>
</div>
<div v-else class="image-upload-item">
<YoutubeOutlined />
<a
class="file-item"
:href="item.url"
target="_blank"
rel="noopener noreferrer"
:style="{ width: width + 'px', height: height + 'px' }"
>
<FileOutlined />
<span class="file-name">{{ item.name || guessNameFromUrl(item.url) }}</span>
</a>
<a class="image-upload-close" @click="onDeleteItem(index)">
<CloseOutlined />
</a>
@@ -47,7 +56,7 @@
import {
PlusOutlined,
CloseOutlined,
YoutubeOutlined
FileOutlined
} from '@ant-design/icons-vue';
import { ref } from 'vue';
import SelectData from './components/select-data.vue';
@@ -98,6 +107,16 @@
const onDeleteItem = (index: number) => {
emit('del', index);
};
const guessNameFromUrl = (url: string) => {
const cleanUrl = (url?.split('?')[0] ?? '').trim();
const last = cleanUrl.split('/').pop() || '';
try {
return decodeURIComponent(last) || url;
} catch {
return last || url;
}
};
</script>
<style lang="less" scoped>
.select-picture-btn {
@@ -112,6 +131,21 @@
.image-upload-item {
position: relative;
}
.file-item {
display: inline-flex;
align-items: center;
gap: 6px;
border: 1px dashed var(--grey-7);
padding: 0 10px;
border-radius: 4px;
max-width: 240px;
color: inherit;
}
.file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.image-upload-close {
width: 18px;
height: 18px;