feat(hjmCar): 添加保单图片上传功能
- 在车辆模型中新增保单图片字段 bdImg - 车辆编辑页面增加保单图片上传组件 - 实现保单图片的选择与删除逻辑- 提交表单时包含保单图片数据 - 初始化及重置时清空保单图片列表 - 编辑回显时解析并展示保单图片fix(hjmViolation): 更新违规状态标签及删除接口参数- 修改违规状态标签文案和颜色:待处理、已处理 -修正单条删除接口调用参数 hjmViolationId为 id -修正批量删除接口调用参数 hjmViolationId 为 id
This commit is contained in:
@@ -21,6 +21,8 @@ export interface HjmCar {
|
|||||||
code?: string;
|
code?: string;
|
||||||
// 车架号
|
// 车架号
|
||||||
vinCode?: string;
|
vinCode?: string;
|
||||||
|
// 保单图片
|
||||||
|
bdImg?: string;
|
||||||
// 绑定操作员
|
// 绑定操作员
|
||||||
driverId?: number;
|
driverId?: number;
|
||||||
// 操作员名称
|
// 操作员名称
|
||||||
|
|||||||
@@ -45,6 +45,15 @@
|
|||||||
@done="chooseInsuranceStatus"
|
@done="chooseInsuranceStatus"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</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">
|
<a-form-item label="电子围栏" name="fenceName">
|
||||||
<SelectFence
|
<SelectFence
|
||||||
:placeholder="`选择电子围栏`"
|
:placeholder="`选择电子围栏`"
|
||||||
@@ -180,6 +189,7 @@ const maxable = ref(true);
|
|||||||
// 表格选中数据
|
// 表格选中数据
|
||||||
const formRef = ref<FormInstance | null>(null);
|
const formRef = ref<FormInstance | null>(null);
|
||||||
const images = ref<ItemType[]>([]);
|
const images = ref<ItemType[]>([]);
|
||||||
|
const bgImages = ref<ItemType[]>([]);
|
||||||
// 是否显示地图选择弹窗
|
// 是否显示地图选择弹窗
|
||||||
const showMap = ref(false);
|
const showMap = ref(false);
|
||||||
const users = ref<User[]>([]);
|
const users = ref<User[]>([]);
|
||||||
@@ -191,6 +201,7 @@ const form = reactive<HjmCar>({
|
|||||||
id: undefined,
|
id: undefined,
|
||||||
name: undefined,
|
name: undefined,
|
||||||
image: undefined,
|
image: undefined,
|
||||||
|
bdImg: undefined,
|
||||||
type: undefined,
|
type: undefined,
|
||||||
kuaidi: undefined,
|
kuaidi: undefined,
|
||||||
kuaidiAdmin: undefined,
|
kuaidiAdmin: undefined,
|
||||||
@@ -354,6 +365,18 @@ const onDeleteItem = (index: number) => {
|
|||||||
images.value.splice(index, 1);
|
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);
|
const {resetFields} = useForm(form, rules);
|
||||||
|
|
||||||
/* 保存编辑 */
|
/* 保存编辑 */
|
||||||
@@ -371,7 +394,8 @@ const save = () => {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
const formData = {
|
const formData = {
|
||||||
...form,
|
...form,
|
||||||
image: JSON.stringify(images.value)
|
image: JSON.stringify(images.value),
|
||||||
|
bdImg: JSON.stringify(bgImages.value),
|
||||||
};
|
};
|
||||||
const saveOrUpdate = isUpdate.value ? updateHjmCar : addHjmCar;
|
const saveOrUpdate = isUpdate.value ? updateHjmCar : addHjmCar;
|
||||||
saveOrUpdate(formData)
|
saveOrUpdate(formData)
|
||||||
@@ -395,6 +419,7 @@ watch(
|
|||||||
(visible) => {
|
(visible) => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
images.value = [];
|
images.value = [];
|
||||||
|
bgImages.value = [];
|
||||||
// 加载机构
|
// 加载机构
|
||||||
listOrganizations()
|
listOrganizations()
|
||||||
.then((list) => {
|
.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) {
|
if (props.data.organizationParentId) {
|
||||||
organizationId.value = props.data.organizationParentId;
|
organizationId.value = props.data.organizationParentId;
|
||||||
getUsers();
|
getUsers();
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
<a-image :src="record.image" :width="50"/>
|
<a-image :src="record.image" :width="50"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'status'">
|
<template v-if="column.key === 'status'">
|
||||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
<a-tag v-if="record.status === 0">待处理</a-tag>
|
||||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
<a-tag v-if="record.status === 1" color="green">已处理</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<a-space>
|
<a-space>
|
||||||
@@ -174,7 +174,7 @@ const openMove = () => {
|
|||||||
/* 删除单个 */
|
/* 删除单个 */
|
||||||
const remove = (row: HjmViolation) => {
|
const remove = (row: HjmViolation) => {
|
||||||
const hide = message.loading('请求中..', 0);
|
const hide = message.loading('请求中..', 0);
|
||||||
removeHjmViolation(row.hjmViolationId)
|
removeHjmViolation(row.id)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
message.success(msg);
|
message.success(msg);
|
||||||
@@ -199,7 +199,7 @@ const removeBatch = () => {
|
|||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
const hide = message.loading('请求中..', 0);
|
const hide = message.loading('请求中..', 0);
|
||||||
removeBatchHjmViolation(selection.value.map((d) => d.hjmViolationId))
|
removeBatchHjmViolation(selection.value.map((d) => d.id))
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
hide();
|
hide();
|
||||||
message.success(msg);
|
message.success(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user