feat(hjmCar): 添加保单图片上传功能

- 在车辆模型中新增保单图片字段 bdImg
- 车辆编辑页面增加保单图片上传组件
- 实现保单图片的选择与删除逻辑- 提交表单时包含保单图片数据
- 初始化及重置时清空保单图片列表
- 编辑回显时解析并展示保单图片fix(hjmViolation): 更新违规状态标签及删除接口参数- 修改违规状态标签文案和颜色:待处理、已处理
-修正单条删除接口调用参数 hjmViolationId为 id
-修正批量删除接口调用参数 hjmViolationId 为 id
This commit is contained in:
2025-10-15 00:25:53 +08:00
parent f9aecf3ccf
commit bc097367da
3 changed files with 42 additions and 5 deletions

View File

@@ -21,6 +21,8 @@ export interface HjmCar {
code?: string;
// 车架号
vinCode?: string;
// 保单图片
bdImg?: string;
// 绑定操作员
driverId?: number;
// 操作员名称

View File

@@ -45,6 +45,15 @@
@done="chooseInsuranceStatus"
/>
</a-form-item>
<a-form-item label="保单上传" name="bdImg">
<SelectFile
:placeholder="`保单上传`"
:limit="1"
:data="bgImages"
@done="chooseBdImg"
@del="onDeleteBdImg"
/>
</a-form-item>
<a-form-item label="电子围栏" name="fenceName">
<SelectFence
:placeholder="`选择电子围栏`"
@@ -180,6 +189,7 @@ const maxable = ref(true);
// 表格选中数据
const formRef = ref<FormInstance | null>(null);
const images = ref<ItemType[]>([]);
const bgImages = ref<ItemType[]>([]);
// 是否显示地图选择弹窗
const showMap = ref(false);
const users = ref<User[]>([]);
@@ -191,6 +201,7 @@ const form = reactive<HjmCar>({
id: undefined,
name: undefined,
image: undefined,
bdImg: undefined,
type: undefined,
kuaidi: undefined,
kuaidiAdmin: undefined,
@@ -354,6 +365,18 @@ const onDeleteItem = (index: number) => {
images.value.splice(index, 1);
};
// 保单图片
const chooseBdImg = (data: FileRecord) => {
bgImages.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
};
const onDeleteBdImg = (index: number) => {
bgImages.value.splice(index, 1);
}
const {resetFields} = useForm(form, rules);
/* 保存编辑 */
@@ -371,7 +394,8 @@ const save = () => {
loading.value = true;
const formData = {
...form,
image: JSON.stringify(images.value)
image: JSON.stringify(images.value),
bdImg: JSON.stringify(bgImages.value),
};
const saveOrUpdate = isUpdate.value ? updateHjmCar : addHjmCar;
saveOrUpdate(formData)
@@ -395,6 +419,7 @@ watch(
(visible) => {
if (visible) {
images.value = [];
bgImages.value = [];
// 加载机构
listOrganizations()
.then((list) => {
@@ -426,6 +451,16 @@ watch(
});
});
}
if (props.data.bdImg) {
const arr = JSON.parse(props.data.bdImg);
arr.map((item) => {
bgImages.value.push({
uid: uuid(),
url: item.url,
status: 'done'
});
});
}
if (props.data.organizationParentId) {
organizationId.value = props.data.organizationParentId;
getUsers();

View File

@@ -24,8 +24,8 @@
<a-image :src="record.image" :width="50"/>
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
<a-tag v-if="record.status === 0">待处理</a-tag>
<a-tag v-if="record.status === 1" color="green">已处理</a-tag>
</template>
<template v-if="column.key === 'action'">
<a-space>
@@ -174,7 +174,7 @@ const openMove = () => {
/* 删除单个 */
const remove = (row: HjmViolation) => {
const hide = message.loading('请求中..', 0);
removeHjmViolation(row.hjmViolationId)
removeHjmViolation(row.id)
.then((msg) => {
hide();
message.success(msg);
@@ -199,7 +199,7 @@ const removeBatch = () => {
maskClosable: true,
onOk: () => {
const hide = message.loading('请求中..', 0);
removeBatchHjmViolation(selection.value.map((d) => d.hjmViolationId))
removeBatchHjmViolation(selection.value.map((d) => d.id))
.then((msg) => {
hide();
message.success(msg);