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.
83 lines
3.8 KiB
83 lines
3.8 KiB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
|
return new (P || (P = Promise))(function (resolve, reject) { |
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } |
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } |
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
|
step((generator = generator.apply(thisArg, _arguments || [])).next()); |
|
}); |
|
}; |
|
import { getToken, requestGet, requestPost } from "@component/utils"; |
|
import { isEmpty, omit } from "lodash"; |
|
import axios from "axios"; |
|
import download from "downloadjs"; |
|
export function getServiceDetail(params) { |
|
return requestGet(process.env.REACT_APP_SERVICE_URL, "/service/show", params); |
|
} |
|
export function getServiceResult(params) { |
|
return requestGet(process.env.REACT_APP_SERVICE_URL, "/service/reportShow", params); |
|
} |
|
export function saveAndSubmitServiceReport(params) { |
|
if (params.submitAction) { |
|
//补录报告的提交 |
|
if (params.reportCollection && params.status == "1") { |
|
return requestPost(process.env.REACT_APP_SERVICE_URL, "/service/reportBackTracking", omit(params, ["submitAction", "reportCollection", "status"])); |
|
} |
|
//常规报告的提交 |
|
return requestPost(process.env.REACT_APP_SERVICE_URL, "/service/submitServiceReport", omit(params, ["submitAction", "reportCollection", "status"])); |
|
} |
|
//保存报告 |
|
return requestPost(process.env.REACT_APP_SERVICE_URL, "/service/editServiceReport", params); |
|
} |
|
export function onServiceOrganReview(params) { |
|
return requestPost(process.env.REACT_APP_SERVICE_URL, "/service/serviceOrgan/auditService", params); |
|
} |
|
export function onServiceInsureOrganReview(params) { |
|
return requestPost(process.env.REACT_APP_SERVICE_URL, "/service/insureOrgan/auditService", params); |
|
} |
|
// 'http://insurance.test.jeean.cn', |
|
// '/service_report/service_report', |
|
// { |
|
// service_task_id: '27779745659817859', |
|
// task_id: '27779745659817859', |
|
// token:'6549bd8bc1b6ba6cbf55d86eea201701' |
|
// } |
|
export function serviceReportExpert(params) { |
|
return requestGet(process.env.REACT_APP_SERVICE_URL, "/serviceReport/exportPdf", omit(params, ["serviceNumber"])).then((data) => __awaiter(this, void 0, void 0, function* () { |
|
if (isEmpty(data)) { |
|
return null; |
|
} |
|
const filename = data.name; |
|
const api = process.env.REACT_APP_API_URL; |
|
yield axios.get(`${api === null || api === void 0 ? void 0 : api.replace("/base", "")}${data.url}`, { |
|
responseType: "blob", |
|
headers: { |
|
token: getToken() |
|
}, |
|
}).then((response) => { |
|
return response.data; |
|
}).then((blob) => { |
|
download(blob, filename, "application/pdf"); |
|
}); |
|
return true; |
|
})); |
|
} |
|
// 补录报告前编辑 |
|
export function updateServiceReport(params) { |
|
return requestPost(process.env.REACT_APP_SERVICE_URL, "/updateServiceReport", params); |
|
} |
|
// 专家报告预览 |
|
export function serviceReportPreviewPdf(params) { |
|
return requestGet(process.env.REACT_APP_SERVICE_URL, "/serviceReport/previewPdf", params).then((data) => __awaiter(this, void 0, void 0, function* () { |
|
if (isEmpty(data)) { |
|
return null; |
|
} |
|
const filename = data.name; |
|
yield axios.get(data.url, { responseType: "blob" }).then((response) => { |
|
return response.data; |
|
}).then((blob) => { |
|
download(blob, filename, "application/pdf"); |
|
}); |
|
return true; |
|
})); |
|
}
|
|
|