96 lines
2.1 KiB
TypeScript
96 lines
2.1 KiB
TypeScript
import http from '@/utils/http'
|
|
const { request } = http
|
|
import type { AttachInfoData, BusinessTypeResult } from './type'
|
|
|
|
/**
|
|
* 批量新增附件信息
|
|
* @param businessType 业务类型
|
|
* @param files 文件列表
|
|
*/
|
|
export function batchAddAttachment(businessType: string, formData: FormData) {
|
|
return request<AttachInfoData[]>({
|
|
url: `/attach-info/batch/${businessType}`,
|
|
method: 'post',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 新增单个附件信息
|
|
* @param businessType 业务类型
|
|
* @param formData 表单数据
|
|
*/
|
|
export function addAttachment(formData: FormData) {
|
|
return request<AttachInfoData>({
|
|
url: `/attach-info/model`,
|
|
method: 'post',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
})
|
|
}
|
|
/**
|
|
* 新增单个附件信息
|
|
* @param businessType 业务类型
|
|
* @param formData 表单数据
|
|
*/
|
|
export function addAttachmentByDefectMarkPic(formData: FormData) {
|
|
return request<AttachInfoData>({
|
|
url: `/attach-info/defect_mark_pic`,
|
|
method: 'post',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
})
|
|
}
|
|
/**
|
|
* 新增单个附件信息
|
|
* @param businessType 业务类型
|
|
* @param formData 表单数据
|
|
*/
|
|
export function addAttachInsurance(formData: FormData) {
|
|
return request<AttachInfoData>({
|
|
url: `/attach-info/insurance_file`,
|
|
method: 'post',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data'
|
|
}
|
|
})
|
|
}
|
|
/**
|
|
* 查询附件业务类型
|
|
*/
|
|
export function getAttachBusinessTypes() {
|
|
return request<BusinessTypeResult>({
|
|
url: '/common/list/attach-business_type',
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取附件列表
|
|
* @param businessType 业务类型
|
|
*/
|
|
export function getAttachmentList(businessType: string) {
|
|
return request<AttachInfoData[]>({
|
|
url: `/attach-info/list/${businessType}`,
|
|
method: 'get'
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 删除附件
|
|
* @param id 附件ID
|
|
*/
|
|
export function deleteAttachment(id: string | number) {
|
|
return request<boolean>({
|
|
url: `/attach-info/${id}`,
|
|
method: 'delete'
|
|
})
|
|
}
|