测评上传

This commit is contained in:
zhangsir
2024-03-28 17:12:37 +08:00
parent 60944ee86c
commit 2f1aeb5ff2

View File

@@ -414,7 +414,7 @@
</div> </div>
<div class="bg_body"> <div class="bg_body">
<div>上传结果</div> <div>上传结果</div>
<div style="margin: 25px 0 0 24px;">上传的测评报告总文件数200个成功190个失败10<br/>上传结果<span @click="tan" style="color: #4ea6ff;cursor: pointer;">请下载</span>查看</div> <div style="margin: 25px 0 0 24px;">上传的测评报告总文件数{{totalNumber.totalEntries}}成功{{totalNumber.successfulEntries}}失败{{totalNumber.failedEntries}}<br/>上传结果<span @click="failedDownload" style="color: #4ea6ff;cursor: pointer;">请下载</span>查看</div>
<div class="bg_footer" style="margin-left: 90px;"> <div class="bg_footer" style="margin-left: 90px;">
<div class="btn btn6" @click="of_results"> <div class="btn btn6" @click="of_results">
<div class="btnText">取消</div> <div class="btnText">取消</div>
@@ -693,6 +693,7 @@ import { message } from "ant-design-vue";
const userInfo = computed(() => store.state.userInfo); const userInfo = computed(() => store.state.userInfo);
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
totalNumber: {},
stateType:'', stateType:'',
uploadDownLoad: false, uploadDownLoad: false,
uploadDownId: '', uploadDownId: '',
@@ -901,7 +902,7 @@ import { message } from "ant-design-vue";
key: "organizationalDepartment", key: "organizationalDepartment",
className: "h", className: "h",
ellipsis: true, ellipsis: true,
width: 100, width: 150,
customRender: ({ text }) => { customRender: ({ text }) => {
return text ? text : ""; return text ? text : "";
}, },
@@ -912,7 +913,7 @@ import { message } from "ant-design-vue";
key: "updateTime", key: "updateTime",
className: "h", className: "h",
ellipsis: true, ellipsis: true,
width: 100, width: 200,
}, },
{ {
title: "权限", title: "权限",
@@ -920,7 +921,7 @@ import { message } from "ant-design-vue";
key: "permission", key: "permission",
className: "h", className: "h",
ellipsis: true, ellipsis: true,
width: 100, width: 200,
customRender: ({ text }) => { customRender: ({ text }) => {
if(text == null){ if(text == null){
return "" return ""
@@ -969,7 +970,7 @@ import { message } from "ant-design-vue";
}, },
{ {
title: "操作", title: "操作",
width: "20%", width: "150",
dataIndex: "id", dataIndex: "id",
key: "id", key: "id",
align: "center", align: "center",
@@ -1071,6 +1072,7 @@ import { message } from "ant-design-vue";
}; };
//报告上传 //报告上传
const bgupload = () => { const bgupload = () => {
state.uploadId = ''
state.valueAll = [] state.valueAll = []
state.bg_check = true; state.bg_check = true;
state.formData = {} state.formData = {}
@@ -1107,8 +1109,9 @@ import { message } from "ant-design-vue";
const resultsUp = () => { const resultsUp = () => {
state.bg_results = false state.bg_results = false
} }
const tan = () => { const failedDownload = () => {
console.log('aaa') console.log('aaa')
window.open(`/activityApi/evaluation/download?id=${state.totalNumber.failedIds}`);
} }
const reportUpload = async () => { const reportUpload = async () => {
if(!state.formData.evaluationName){ if(!state.formData.evaluationName){
@@ -1188,9 +1191,9 @@ import { message } from "ant-design-vue";
message.error("图片大小超过2MB!"); message.error("图片大小超过2MB!");
return false; return false;
} }
const formDatas = new FormData(); const formData = new FormData();
formDatas.append("file", file); formData.append("file", file);
uploadImage(formDatas).then((res) => { uploadImage(formData).then((res) => {
if (res.status === 200) { if (res.status === 200) {
state.formData.imageUrl = res.data.split('Path:')[1]; state.formData.imageUrl = res.data.split('Path:')[1];
} }
@@ -1214,19 +1217,30 @@ import { message } from "ant-design-vue";
return false; return false;
} }
state.uploadDownLoad = true state.uploadDownLoad = true
const formDatas = new FormData(); // const formData = new FormData();
formDatas.append("file", file); const formData = {
if(state.uploadId){ file: file
formDatas.append("pid", state.uploadId);
formDatas.append("uploadName", userInfo.value.realName);
formDatas.append("createId", userInfo.value.userId);
formDatas.append("createName", userInfo.value.realName);
}else{
formDatas.append("uploadName", userInfo.value.realName);
formDatas.append("createId", userInfo.value.userId);
formDatas.append("createName", userInfo.value.realName);
} }
await importList(formDatas).then((res)=>{ // formData.append("file", file);
if(state.uploadId){
formData.pid= state.uploadId,
formData.uploadName=userInfo.value.realName,
formData.createId= userInfo.value.userId,
formData.createName= userInfo.value.realName
// formData.append("pid", state.uploadId);
// formData.append("uploadName", userInfo.value.realName);
// formData.append("createId", userInfo.value.userId);
// formData.append("createName", userInfo.value.realName);
}else{
// formData.append("uploadName", userInfo.value.realName);
// formData.append("createId", userInfo.value.userId);
// formData.append("createName", userInfo.value.realName);
// pid: state.uploadId,
formData.uploadName=userInfo.value.realName,
formData.createId= userInfo.value.userId,
formData.createName= userInfo.value.realName
}
boeRequest('/activityApi/evaluation/import post formData',formData).then((res)=>{
if(res.code === 200){ if(res.code === 200){
if(state.stateType == "application/pdf"){ if(state.stateType == "application/pdf"){
state.idValue = res.data.map(item=>item.id) state.idValue = res.data.map(item=>item.id)
@@ -1234,16 +1248,31 @@ import { message } from "ant-design-vue";
}else{ }else{
state.idValue = res.data.evaluationDetailList.map(item=>item.id) state.idValue = res.data.evaluationDetailList.map(item=>item.id)
state.valueAll = res.data.evaluationDetailList state.valueAll = res.data.evaluationDetailList
state.totalNumber = res.data
} }
console.log(state.valueAll,'state.valueAll') console.log(state.valueAll,'state.valueAll')
state.uploadDownLoad = false state.uploadDownLoad = false
} }
}).catch((err)=>{
state.uploadDownLoad = false
console.log(err,'err')
}) })
// await importList(formData).then((res)=>{
// if(res.code === 200){
// if(state.stateType == "application/pdf"){
// state.idValue = res.data.map(item=>item.id)
// state.valueAll = res.data
// }else{
// state.idValue = res.data.evaluationDetailList.map(item=>item.id)
// state.valueAll = res.data.evaluationDetailList
// state.totalNumber = res.data
// }
// console.log(state.valueAll,'state.valueAll')
// state.uploadDownLoad = false
// }
// }).catch((err)=>{
// state.uploadDownLoad = false
// console.log(err,'err')
// })
// try { // try {
// const response = await axios.post('/activityApi/evaluation/import', formDatas); // const response = await axios.post('/activityApi/evaluation/import', formData);
// const jsonData = JSONbig({ storeAsString: true }).parse(response.data); // const jsonData = JSONbig({ storeAsString: true }).parse(response.data);
// if (jsonData.code === 200) { // if (jsonData.code === 200) {
@@ -1551,7 +1580,7 @@ import { message } from "ant-design-vue";
showUpload, showUpload,
of_results, of_results,
resultsUp, resultsUp,
tan, failedDownload,
of_setting, of_setting,
settingUp, settingUp,
// of_edit, // of_edit,