mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-09 02:46:45 +08:00
测评上传
This commit is contained in:
@@ -13,7 +13,9 @@ export const save = (obj) => http.post(`${ACTIVITYAPI}/evaluation/save`,obj)
|
||||
//保存测评详情
|
||||
export const saveEvaluationDetail = (obj) => http.post(`${ACTIVITYAPI}/evaluation/detail/saveEvaluationDetail`,obj)
|
||||
//测评封面上传
|
||||
export const uploadImage = (obj) => http.post(`${ACTIVITYAPI}/evaluation/upload-image`,obj)
|
||||
export const uploadImage = (obj) => http.post(`${ACTIVITYAPI}/evaluation/upload-image`,obj,{
|
||||
headers: { "Content-Type": "multipart/form-data",token:getCookieForName("token") },
|
||||
})
|
||||
//权限管理
|
||||
export const adminList = (obj) => http.post(`${ACTIVITYAPI}/permission/adminList`,obj)
|
||||
//权限启用
|
||||
|
||||
@@ -202,12 +202,12 @@
|
||||
<div class="bg_body_input">
|
||||
<a-upload
|
||||
name="file"
|
||||
:file-list="filesList"
|
||||
:headers="headers"
|
||||
:file-list="filesList"
|
||||
:before-upload="beforeUpload3"
|
||||
>
|
||||
<!-- action="/activityApi/evaluation/import"
|
||||
@change="handleChange" -->
|
||||
<!-- @change="handleChange" -->
|
||||
<!-- action="/activityApi/evaluation/import" -->
|
||||
<div class="upload_box">
|
||||
<span>选择文件</span>
|
||||
</div>
|
||||
@@ -218,7 +218,7 @@
|
||||
<div class="mbl_items12">
|
||||
<div
|
||||
class="i12_box1"
|
||||
v-for="(item, index) in filesList"
|
||||
v-for="(item, index) in valueAll"
|
||||
:key="index"
|
||||
>
|
||||
<div class="file_img"></div>
|
||||
@@ -255,6 +255,7 @@
|
||||
</div>
|
||||
<a-button
|
||||
class="btn btn6"
|
||||
:loading="uploadDownLoad"
|
||||
@click="formData.id&&btShow?showUpload():reportUpload()"
|
||||
>
|
||||
确定
|
||||
@@ -594,6 +595,9 @@
|
||||
</div>
|
||||
</a-modal>
|
||||
</div>
|
||||
<div class="aeLoading" style="z-index:999999" :style="{ display: uploadDownLoad ? 'flex' : 'none' }">
|
||||
<a-spin :spinning="uploadDownLoad" tip="" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -632,6 +636,9 @@ import { message } from "ant-design-vue";
|
||||
const userInfo = computed(() => store.state.userInfo);
|
||||
const router = useRouter();
|
||||
const state = reactive({
|
||||
stateType:'',
|
||||
uploadDownLoad: false,
|
||||
uploadDownId: '',
|
||||
loadData: false,
|
||||
saveList: [],
|
||||
powerStatus:{},
|
||||
@@ -1002,6 +1009,7 @@ import { message } from "ant-design-vue";
|
||||
}
|
||||
const bgupload1 = (record) => {
|
||||
console.log(record,'record')
|
||||
state.uploadDownId =record.id
|
||||
state.btShowEdit = trueFalse(record.permission,2)
|
||||
state.uploadId = record.id
|
||||
state.uploadName = userInfo.value.realName
|
||||
@@ -1039,21 +1047,24 @@ import { message } from "ant-design-vue";
|
||||
return
|
||||
}
|
||||
state.tableLoading = true
|
||||
state.bg_results = true
|
||||
|
||||
if(state.uploadStatus){
|
||||
console.log(state.uploadStatus,'state.uploadStatus')
|
||||
await save({
|
||||
id: state.uploadDownId,
|
||||
creatId:userInfo.value.userId,
|
||||
creatName:userInfo.value.realName,
|
||||
prefix:'',
|
||||
remarks:state.formData.remarks,
|
||||
evaluationName:state.formData.evaluationName,
|
||||
detailIds:state.idValue,
|
||||
imagePath:state.formData.imageUrl
|
||||
}).then((res)=>{
|
||||
console.log(res.data,'data')
|
||||
})
|
||||
}
|
||||
if(state.valueAll.length != 0 && !state.loadData){
|
||||
state.bg_results = true
|
||||
state.valueAll.forEach((item)=>{
|
||||
if(item.createId){
|
||||
item.createId = userInfo.value.userId
|
||||
@@ -1063,6 +1074,17 @@ import { message } from "ant-design-vue";
|
||||
console.log(res.data,'json')
|
||||
})
|
||||
}
|
||||
//else{
|
||||
// state.bg_results = true
|
||||
// state.valueAll.forEach((item)=>{
|
||||
// if(item.createId){
|
||||
// item.createId = userInfo.value.userId
|
||||
// }
|
||||
// })
|
||||
// await saveEvaluationDetail({evaluationDetailListlist:state.valueAll,pid:state.uploadId}).then((res)=>{
|
||||
// console.log(res.data,'json')
|
||||
// })
|
||||
// }
|
||||
of_exit()
|
||||
listData()
|
||||
}
|
||||
@@ -1073,6 +1095,7 @@ import { message } from "ant-design-vue";
|
||||
//上传图片
|
||||
const headers = { token: getCookieForName("token") };
|
||||
const beforeUpload = (file) => {
|
||||
console.log(file,'file')
|
||||
const isJpgOrPng =
|
||||
file.type === "image/jpg" ||
|
||||
file.type === "image/png"
|
||||
@@ -1088,21 +1111,18 @@ import { message } from "ant-design-vue";
|
||||
return false;
|
||||
}
|
||||
const formDatas = new FormData();
|
||||
console.log(formDatas.append("file", file),'formDatas')
|
||||
formDatas.append("file", file);
|
||||
console.log(formDatas, 'aaaa')
|
||||
uploadImage(formDatas).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
console.log(res.data.data, 45);
|
||||
state.formData.imageUrl = process.env.VUE_APP_FILE_PATH + res.data.data;
|
||||
formData.value.liveCover = process.env.VUE_APP_FILE_PATH + res.data.data;
|
||||
if (res.status === 200) {
|
||||
state.formData.imageUrl = res.data.split('Path:')[1];
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
const beforeUpload3 = async (file) => {
|
||||
state.stateType = file.type
|
||||
const pattern = /^([0-9\u4e00-\u9fa5\a-z\A-Z]+-){2}[0-9\u4e00-\u9fa5\a-z\A-Z]+\.\w*$/;
|
||||
console.log(file, 'aaaa')
|
||||
console.log(file,'file')
|
||||
if (!pattern.test(file.name)) {
|
||||
message.error('上传文件名称格式不对')
|
||||
return false
|
||||
@@ -1115,6 +1135,7 @@ import { message } from "ant-design-vue";
|
||||
message.error("仅支持zip、pdf格式!");
|
||||
return false;
|
||||
}
|
||||
state.uploadDownLoad = true
|
||||
const formDatas = new FormData();
|
||||
formDatas.append("file", file);
|
||||
if(state.uploadId){
|
||||
@@ -1129,10 +1150,19 @@ import { message } from "ant-design-vue";
|
||||
}
|
||||
await importList(formDatas).then((res)=>{
|
||||
if(res.code === 200){
|
||||
state.idValue = res.data.map(item=>item.id)
|
||||
state.valueAll = res.data
|
||||
console.log(state.valueAll,'valueAll')
|
||||
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
|
||||
}
|
||||
console.log(state.valueAll,'state.valueAll')
|
||||
state.uploadDownLoad = false
|
||||
}
|
||||
}).catch((err)=>{
|
||||
state.uploadDownLoad = false
|
||||
console.log(err,'err')
|
||||
})
|
||||
// try {
|
||||
// const response = await axios.post('/activityApi/evaluation/import', formDatas);
|
||||
@@ -1147,6 +1177,8 @@ import { message } from "ant-design-vue";
|
||||
return false
|
||||
}
|
||||
const handleChange = (info) => {
|
||||
// return
|
||||
console.log(info,'inffofofoffo')
|
||||
let resFileList = [...info.fileList];
|
||||
|
||||
resFileList = resFileList.slice(-2);
|
||||
@@ -1201,6 +1233,7 @@ import { message } from "ant-design-vue";
|
||||
// }
|
||||
// 编辑
|
||||
const openEdit = (record) => {
|
||||
state.uploadDownId =record.id
|
||||
state.bg_check = true
|
||||
state.btShow = true
|
||||
state.btShowEdit = false
|
||||
@@ -1296,6 +1329,7 @@ import { message } from "ant-design-vue";
|
||||
await savePermission({userList:state.saveList,pid:state.saveListPid})
|
||||
saveListItem()
|
||||
of_addsetting()
|
||||
listData()
|
||||
}
|
||||
const powerSetting = async (record) => {
|
||||
state.powerStatus = (record)
|
||||
@@ -1599,7 +1633,12 @@ import { message } from "ant-design-vue";
|
||||
.mbl_items12 {
|
||||
// width: 300px;
|
||||
margin-left: 128px;
|
||||
|
||||
.item_text{
|
||||
width: 300px;
|
||||
white-space: nowrap; /* 不换行 */
|
||||
overflow: hidden; /* 超出部分隐藏 */
|
||||
text-overflow: ellipsis; /* 使用省略号表示被隐藏的部分 */
|
||||
}
|
||||
.i12_box1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user