数字督察一体化平台-前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

116 lines
2.6 KiB

import request from "@/api/request";
import feedback from "../../utils/feedback";
import {getToken} from "../../utils/token";
export function getComplaintCollectionPage(body) {
return request.post({
url: `/data/complaintCollection/getComplaintCollectionPageNew`,
body
});
}
export function addComplaintCollection(body) {
return request.post({
url: `/data/complaintCollection/addComplaintCollection`,
body
});
}
export function delComplaintCollection(body) {
return request.post({
url: `/data/complaintCollection/delComplaintCollection`,
body
});
}
export function updateComplaintCollection(body) {
return request.post({
url: `/data/complaintCollection/updateComplaintCollection`,
body
});
}
/**
* 查重
*/
export function maileRepeatt(body) {
return request.post({
url: `/data/complaintCollection/maileRepeatt`,
body
});
}
/**
* 导出
*/
export async function exportData(body) {
const response = await fetch('/api/v2/data/complaintCollection/exportData', {
method: 'POST',
headers: {
'Authorization': getToken(),
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
})
if (!response.ok) {
feedback.msgError('导出失败')
return
}
// 👉 关键:直接拿 blob
const blob = await response.blob()
let filename = '涉访涉诉数据.xlsx'
const disposition = response.headers.get('content-disposition')
if (disposition) {
const match = disposition.match(/filename\*=UTF-8''(.+)/)
if (match) {
filename = decodeURIComponent(match[1])
}
}
// 👉 触发下载
const url = window.URL.createObjectURL(blob)
const a = document.createElement('a')
a.href = url
a.download = filename
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(url)
}
/**
* 办理页面保存:保存涉及人员/领导等 JSON
*/
export function saveInvolveJson(body) {
return request.post({
url: `/data/complaintCollection/saveInvolveJson`,
body
});
}
/**
* 获取投诉详情(用于修改弹窗回显)
*/
export function getComplaintCollectionDetail(body) {
return request.post({
url: `/data/complaintCollection/getComplaintCollectionDetail`,
body
});
}
/**
* 初核反馈
*/
export function initialReview(body) {
return request.post({
url: `/data/complaintCollection/initialReview`,
body
});
}