mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 11:26:45 +08:00
测评上传修改上传逻辑与错误信息展示
This commit is contained in:
@@ -199,13 +199,14 @@
|
|||||||
<div class="bg_body_input">
|
<div class="bg_body_input">
|
||||||
<a-upload
|
<a-upload
|
||||||
name="file"
|
name="file"
|
||||||
v-model:file-list="fileList"
|
v-model:file-list="files"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:show-upload-list="false"
|
:show-upload-list="false"
|
||||||
:before-upload="beforeUpload3"
|
:before-upload="beforeUpload3"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
action="/activityApi/evaluation/import"
|
action="/activityApi/evaluation/import"
|
||||||
:data="uploadParameters"
|
:data="uploadParameters"
|
||||||
|
ref="uploadRef"
|
||||||
>
|
>
|
||||||
<div class="upload_box">
|
<div class="upload_box">
|
||||||
<span>选择文件</span>
|
<span>选择文件</span>
|
||||||
@@ -234,7 +235,7 @@
|
|||||||
:class="`${{uploading: 'updatacolor3', done: 'updatacolor' ,error: 'updatacolor2'}[item.status] || 'updatacolor'}`"
|
:class="`${{uploading: 'updatacolor3', done: 'updatacolor' ,error: 'updatacolor2'}[item.status] || 'updatacolor'}`"
|
||||||
:style="{width:`${item.status==='uploading'?parseInt(item.percent):100}%`}"></div>
|
:style="{width:`${item.status==='uploading'?parseInt(item.percent):100}%`}"></div>
|
||||||
<div v-if="item.status"
|
<div v-if="item.status"
|
||||||
style="right:-62px"
|
style="right:-62px;"
|
||||||
:class="`${{uploading: 'updataxq1', done: 'updataxq' ,error: 'updataxq2'}[item.status] || 'updataxq'}`">
|
:class="`${{uploading: 'updataxq1', done: 'updataxq' ,error: 'updataxq2'}[item.status] || 'updataxq'}`">
|
||||||
{{ {uploading: '正在上传', done: '上传完成', error: '上传失败'}[item.status] || '' }}
|
{{ {uploading: '正在上传', done: '上传完成', error: '上传失败'}[item.status] || '' }}
|
||||||
</div>
|
</div>
|
||||||
@@ -702,12 +703,15 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
const userInfo = computed(() => store.state.userInfo);
|
const userInfo = computed(() => store.state.userInfo);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
saveNotUpload: true,
|
||||||
stateUpload: true,
|
stateUpload: true,
|
||||||
uploadParameters: {},
|
uploadParameters: {},
|
||||||
uploadList: [],
|
uploadList: [],
|
||||||
isRegularAdministrator: '',
|
isRegularAdministrator: '',
|
||||||
loadNewDown:false,
|
loadNewDown:false,
|
||||||
totalNumber: {},
|
totalNumber: {},
|
||||||
|
sussessIds: [],
|
||||||
|
failedId: '',
|
||||||
uploadDownLoad: false,
|
uploadDownLoad: false,
|
||||||
uploadDownId: null,
|
uploadDownId: null,
|
||||||
loadData: false,
|
loadData: false,
|
||||||
@@ -715,8 +719,6 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
powerStatus:{},
|
powerStatus:{},
|
||||||
saveListPid: '',
|
saveListPid: '',
|
||||||
idValue: null,
|
idValue: null,
|
||||||
downloadUrl:null,
|
|
||||||
valueAll: [],
|
|
||||||
uploadStatus: true,
|
uploadStatus: true,
|
||||||
uploadId: '',
|
uploadId: '',
|
||||||
uploadName: '',
|
uploadName: '',
|
||||||
@@ -775,13 +777,12 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
timeoutUpload(1000*60*5)
|
timeoutUpload(1000*60*5)
|
||||||
state.tableLoading = true
|
state.tableLoading = true
|
||||||
console.log(userInfo.value,'sssss')
|
|
||||||
listData()
|
listData()
|
||||||
})
|
})
|
||||||
const uploadAdmin = (aaaa)=>{
|
const uploadAdmin = (admin)=>{
|
||||||
const aaa = userInfo.value.roleList.map((item)=>item.roleCode)
|
const aaa = userInfo.value.roleList.map((item)=>item.roleCode)
|
||||||
if (aaaa){
|
if (admin){
|
||||||
return aaa.some(t => t == aaaa)
|
return aaa.some(t => t == admin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const trueFalse = (per,i) => {
|
const trueFalse = (per,i) => {
|
||||||
@@ -1114,9 +1115,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
const bgupload = () => {
|
const bgupload = () => {
|
||||||
state.loadNewDown = false
|
state.loadNewDown = false
|
||||||
state.uploadDownId = null
|
state.uploadDownId = null
|
||||||
state.downloadUrl = null
|
|
||||||
state.uploadId = ''
|
state.uploadId = ''
|
||||||
state.valueAll = []
|
|
||||||
state.uploadList = []
|
state.uploadList = []
|
||||||
state.btShow = true
|
state.btShow = true
|
||||||
state.bg_check = true;
|
state.bg_check = true;
|
||||||
@@ -1124,8 +1123,6 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
}
|
}
|
||||||
const bgupload1 = (record) => {
|
const bgupload1 = (record) => {
|
||||||
state.loadNewDown = true
|
state.loadNewDown = true
|
||||||
state.downloadUrl = null
|
|
||||||
state.valueAll = []
|
|
||||||
state.uploadList = []
|
state.uploadList = []
|
||||||
state.uploadDownId =record.id
|
state.uploadDownId =record.id
|
||||||
state.btShowEdit = trueFalse(record.permission,2)
|
state.btShowEdit = trueFalse(record.permission,2)
|
||||||
@@ -1146,8 +1143,9 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
const of_exit = () => {
|
const of_exit = () => {
|
||||||
state.bg_check = false;
|
state.bg_check = false;
|
||||||
state.errorMessage = ''
|
state.errorMessage = ''
|
||||||
// state.uploadDownId = ''
|
state.saveNotUpload = true
|
||||||
// state.uploadId = ''
|
state.failedId = ''
|
||||||
|
state.sussessIds = null
|
||||||
state.uploadName = ''
|
state.uploadName = ''
|
||||||
state.loadData = false
|
state.loadData = false
|
||||||
state.uploadStatus = true
|
state.uploadStatus = true
|
||||||
@@ -1164,7 +1162,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
state.bg_results = false
|
state.bg_results = false
|
||||||
}
|
}
|
||||||
const failedDownload = () => {
|
const failedDownload = () => {
|
||||||
const ids = [...state.totalNumber.failedIds,...state.totalNumber.importTrue].join(',')
|
const ids = state.totalNumber.successId+','+state.totalNumber.failedId
|
||||||
window.open(`/activityApi/evaluation/download-failed?ids=${ids}`)
|
window.open(`/activityApi/evaluation/download-failed?ids=${ids}`)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1173,92 +1171,45 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
message.error('请输入测评标题名称')
|
message.error('请输入测评标题名称')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if(state.totalNumber.failedEntries&&state.valueAll.length!=0){
|
if(state.failedId){
|
||||||
// message.error('请先下载失败数据,并修改后重新上传')
|
message.error('上传报告含有错误报告,请检查后重新上传')
|
||||||
// state.bg_results = true
|
return
|
||||||
// state.bg_check = false
|
}
|
||||||
// return
|
|
||||||
// }
|
|
||||||
state.tableLoading = true
|
state.tableLoading = true
|
||||||
state.uploadDownLoad = true
|
state.uploadDownLoad = true
|
||||||
if(state.valueAll.length != 0 && !state.loadData&&state.loadNewDown){
|
if( !state.loadData&&state.loadNewDown){
|
||||||
state.totalNumber.failedEntisTrue = '0'
|
|
||||||
if(state.valueAll.length >1){
|
|
||||||
state.totalNumber.failedEntisTrue = state.totalNumber.failedEntries == 0 ? '0' : '1'
|
|
||||||
state.bg_results = true
|
|
||||||
}
|
|
||||||
state.valueAll.forEach((item)=>{
|
|
||||||
if(item.createId){
|
|
||||||
item.createId = userInfo.value.userId
|
|
||||||
}
|
|
||||||
})
|
|
||||||
// 保存上传文件
|
// 保存上传文件
|
||||||
await boeRequest('/activityApi/evaluation/detail/saveEvaluationDetail post',{
|
await boeRequest('/activityApi/evaluation/detail/saveEvaluationDetail post',{
|
||||||
evaluationDetailListlist:state.valueAll,
|
id:state.uploadId,
|
||||||
pid:state.uploadId,
|
successIds:state.sussessIds
|
||||||
isUpload: state.totalNumber.failedEntisTrue,
|
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
state.uploadDownLoad = false
|
state.uploadDownLoad = false
|
||||||
if(res.code == 200){
|
state.saveNotUpload = false
|
||||||
if(res.data.length!=0){
|
// if(res.code == 200){
|
||||||
if(state.valueAll.length>=1&&state.totalNumber.totalEntries){
|
// state.bg_check = false
|
||||||
state.totalNumber.failedEntries = state.totalNumber.failedEntries + res.data.failedIds.length
|
// return
|
||||||
state.totalNumber.successfulEntries = state.totalNumber.successfulEntries - res.data.failedIds.length
|
|
||||||
}else{
|
// }
|
||||||
state.totalNumber.totalEntries = 1
|
// if(res.data.code == -1){
|
||||||
state.totalNumber.failedEntries = res.data.failedIds.length
|
// message.error('保存失败')
|
||||||
state.totalNumber.successfulEntries = res.data.successIds.length
|
// }
|
||||||
}
|
|
||||||
if(res.data.failedIds.length!=0){
|
|
||||||
message.error('请先下载失败数据,并修改后重新上传')
|
|
||||||
}
|
|
||||||
state.totalNumber.failedIds = [...res.data.failedIds,...res.data.successIds]
|
|
||||||
state.bg_results = true
|
|
||||||
state.bg_check = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(res.data.code == -1){
|
|
||||||
message.error('保存失败')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(state.uploadStatus||state.btShow){
|
if(state.uploadStatus||state.btShow){
|
||||||
state.totalNumber.failedEntisTrue = '0'
|
|
||||||
if(state.valueAll.length >1){
|
|
||||||
state.totalNumber.failedEntisTrue = state.totalNumber.failedEntries == 0 ? '0' : '1'
|
|
||||||
}
|
|
||||||
await boeRequest('/activityApi/evaluation/save post',{
|
await boeRequest('/activityApi/evaluation/save post',{
|
||||||
isUpload: state.totalNumber.failedEntisTrue,
|
|
||||||
id: state.uploadDownId,
|
id: state.uploadDownId,
|
||||||
createId:userInfo.value.userId,
|
createId:userInfo.value.userId,
|
||||||
createName:userInfo.value.realName,
|
createName:userInfo.value.realName,
|
||||||
prefix:'',
|
prefix:'',
|
||||||
remarks:state.formData.remarks,
|
remarks:state.formData.remarks,
|
||||||
evaluationName:state.formData.evaluationName,
|
evaluationName:state.formData.evaluationName,
|
||||||
// detailIds:state.idValue,
|
|
||||||
evaluationDetailList:!state.loadNewDown?state.valueAll:null,
|
|
||||||
workNum: userInfo.value.userNo,
|
workNum: userInfo.value.userNo,
|
||||||
// downloadUrls:state.downloadUrl,
|
imagePath:state.formData.cover,
|
||||||
imagePath:state.formData.cover
|
successIds:state.saveNotUpload?state.sussessIds:null
|
||||||
}).then((res)=>{
|
}).then((res)=>{
|
||||||
state.uploadDownLoad = false
|
if(res.code == 200){
|
||||||
if(res.data.failedIds!=null||res.data.successIds!=null){
|
state.uploadDownLoad = false
|
||||||
if(state.valueAll.length>=1&&state.totalNumber.totalEntries){
|
|
||||||
state.totalNumber.failedEntries = state.totalNumber.failedEntries + res.data.failedIds.length
|
|
||||||
state.totalNumber.successfulEntries = state.totalNumber.successfulEntries - res.data.failedIds.length
|
|
||||||
}else{
|
|
||||||
state.totalNumber.totalEntries = 1
|
|
||||||
state.totalNumber.failedEntries = res.data.failedIds.length
|
|
||||||
state.totalNumber.successfulEntries = res.data.successIds.length
|
|
||||||
}
|
|
||||||
if(res.data.failedIds.length!=0){
|
|
||||||
message.error('请先下载失败数据,并修改后重新上传')
|
|
||||||
}
|
|
||||||
state.totalNumber.failedIds = [...res.data.failedIds,...res.data.successIds]
|
|
||||||
state.bg_results = true
|
|
||||||
state.bg_check = false
|
state.bg_check = false
|
||||||
return
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1218,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
}
|
}
|
||||||
const showUpload = () => {
|
const showUpload = () => {
|
||||||
reportUpload()
|
reportUpload()
|
||||||
of_exit()
|
// of_exit()
|
||||||
}
|
}
|
||||||
//上传图片
|
//上传图片
|
||||||
const headers = { token: getCookieForName("token") };
|
const headers = { token: getCookieForName("token") };
|
||||||
@@ -1359,38 +1310,14 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
// message.error('无法计算文件MD5,请重试');
|
// message.error('无法计算文件MD5,请重试');
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// boeRequest('/activityApi/evaluation/import post formData',formData).then((res)=>{
|
|
||||||
// if(res.code === 200){
|
|
||||||
// if(state.stateType == "application/pdf"){
|
|
||||||
// // state.idValue = res.data.map(item=>item.id)
|
|
||||||
// state.downloadUrl = res.data.map(item=>item.downloadUrl)
|
|
||||||
// state.valueAll = res.data
|
|
||||||
// state.totalNumber.importTrue = []
|
|
||||||
// }else{
|
|
||||||
// // state.idValue = res.data.evaluationDetailList.map(item=>item.id)
|
|
||||||
// state.downloadUrl = res.data.evaluationDetailList.map(item=>item.downloadUrl)
|
|
||||||
// state.totalNumber = res.data
|
|
||||||
// state.totalNumber.importTrue = res.data.failedIds
|
|
||||||
// state.valueAll = res.data.evaluationDetailList
|
|
||||||
// }
|
|
||||||
// state.uploadDownLoad = false
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// return false
|
|
||||||
}
|
}
|
||||||
const handleChange = ({file, fileList,event}) => {
|
const handleChange = ({file, fileList,event}) => {
|
||||||
|
console.log(file.response)
|
||||||
if(file.response && file.response.code === 200){
|
if(file.response && file.response.code === 200){
|
||||||
if(file.type == "application/pdf"){
|
|
||||||
state.downloadUrl = file.response.data.map(item=>item.downloadUrl)
|
|
||||||
state.valueAll = file.response.data
|
|
||||||
state.totalNumber.importTrue = []
|
|
||||||
}else{
|
|
||||||
state.downloadUrl = file.response.data.evaluationDetailList.map(item=>item.downloadUrl)
|
|
||||||
state.totalNumber = file.response.data
|
state.totalNumber = file.response.data
|
||||||
state.totalNumber.importTrue = file.response.data.failedIds
|
state.sussessIds = file.response.data.successId.split(',')
|
||||||
state.valueAll = file.response.data.evaluationDetailList
|
state.failedId = file.response.data.failedId
|
||||||
}
|
state.bg_results = true
|
||||||
state.uploadDownLoad = false
|
state.uploadDownLoad = false
|
||||||
}
|
}
|
||||||
if(state.stateUpload){
|
if(state.stateUpload){
|
||||||
@@ -1398,9 +1325,11 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
}
|
}
|
||||||
state.stateUpload = true
|
state.stateUpload = true
|
||||||
};
|
};
|
||||||
const delUploadList = () => {
|
const uploadRef = ref()
|
||||||
|
const delUploadList = (i) => {
|
||||||
|
state.sussessIds = null
|
||||||
|
state.failedId = ''
|
||||||
state.uploadList = []
|
state.uploadList = []
|
||||||
state.valueAll = []
|
|
||||||
}
|
}
|
||||||
const deleteItem = (record) => {
|
const deleteItem = (record) => {
|
||||||
dialog({
|
dialog({
|
||||||
@@ -1610,6 +1539,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
beforeUpload3,
|
beforeUpload3,
|
||||||
handleChange,
|
handleChange,
|
||||||
delUploadList,
|
delUploadList,
|
||||||
|
uploadRef,
|
||||||
bgcheck,
|
bgcheck,
|
||||||
deleteItem,
|
deleteItem,
|
||||||
emptyItem,
|
emptyItem,
|
||||||
@@ -1838,7 +1768,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
.i12_box1 {
|
.i12_box1 {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 17px 0px 17px 21px;
|
padding: 10px 0px 17px 21px;
|
||||||
border: 1px solid #eff4fc;
|
border: 1px solid #eff4fc;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -1896,6 +1826,9 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
background-color: #4ea6ff;
|
background-color: #4ea6ff;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
.updataxq1{
|
||||||
|
margin-top: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
.updataxq {
|
.updataxq {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user