mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 19:36:46 +08:00
Merge branch 'zcwy-zsx0223' into dev0223
This commit is contained in:
36
src/utils/zipdownload.js
Normal file
36
src/utils/zipdownload.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import {getCookieForName} from "@/api/method";
|
||||||
|
|
||||||
|
const mimeMap = {
|
||||||
|
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
zip: 'application/zip'
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseUrl = process.env.VUE_APP_ACT_API
|
||||||
|
export function downLoadZip(str, filename) {
|
||||||
|
var url = baseUrl + str
|
||||||
|
axios({
|
||||||
|
method: 'get',
|
||||||
|
url: url,
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: { 'Authorization': 'Bearer ' + getCookieForName("token") }
|
||||||
|
}).then(res => {
|
||||||
|
resolveBlob(res, mimeMap.zip,filename)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 解析blob响应内容并下载
|
||||||
|
* @param {*} res blob响应内容
|
||||||
|
* @param {String} mimeType MIME类型
|
||||||
|
*/
|
||||||
|
export function resolveBlob(res, mimeType,filename) {
|
||||||
|
const link = document.createElement('a');// 创建a标签
|
||||||
|
let blob = new Blob([res.data], { type: mimeType }); // 设置文件类型
|
||||||
|
link.style.display = "none";
|
||||||
|
link.href = URL.createObjectURL(blob); // 创建URL
|
||||||
|
link.setAttribute("download", `${filename}`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
URL.revokeObjectURL(link.href);
|
||||||
|
document.body.removeChild(link);
|
||||||
|
}
|
||||||
@@ -69,6 +69,7 @@ import { useRoute } from "vue-router";
|
|||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
import {boeRequest} from "@/api/request";
|
import {boeRequest} from "@/api/request";
|
||||||
|
import {downLoadZip} from "@/utils/zipdownload";
|
||||||
export default {
|
export default {
|
||||||
name: "evadown",
|
name: "evadown",
|
||||||
components: {},
|
components: {},
|
||||||
@@ -165,7 +166,8 @@ import {boeRequest} from "@/api/request";
|
|||||||
message.info('请先上传报告')
|
message.info('请先上传报告')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
window.open(`/activityApi/evaluation/download?id=${route.query.id}`);
|
// window.open(`/activityApi/evaluation/download?id=${route.query.id}`);
|
||||||
|
downLoadZip(`/evaluation/download?id=${route.query.id}`,route.query.name)
|
||||||
}
|
}
|
||||||
const listData = async () => {
|
const listData = async () => {
|
||||||
state.tableLoading = true
|
state.tableLoading = true
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
<div class="bg_body_input" style="display: flex;">
|
<div class="bg_body_input" style="display: flex;">
|
||||||
<a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
|
<a-upload name="avatar" list-type="picture-card" class="avatar-uploader" :show-upload-list="false"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:before-upload="beforeUpload">
|
:before-upload="beforeUpload" @change="handleChangeImg">
|
||||||
<img class="i_upload_img" v-if="formData.cover" :src="formData.cover" alt="avatar" />
|
<img class="i_upload_img" v-if="formData.cover" :src="formData.cover" alt="avatar" />
|
||||||
<div class="i_upload" v-else>
|
<div class="i_upload" v-else>
|
||||||
<div class="addimg">
|
<div class="addimg">
|
||||||
@@ -177,15 +177,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg_body_bt" v-if="btShowEdit">
|
<div class="bg_body_bt" v-if="btShow">
|
||||||
<div class="bg_body_bttext">上传说明</div>
|
<div class="bg_body_bttext">备注</div>
|
||||||
<div class="bg_body_input">
|
<div class="bg_body_input">
|
||||||
<span style="color: #999ba3">
|
<a-textarea placeholder="请输入备注(限200个字以内)" style="width: 334px;height: 88px;" v-model:value="formData.remarks" showCount :maxlength="200" />
|
||||||
1、仅支持1个zip压缩包和pdf报告上传;<br/>
|
|
||||||
2、单个附件命名规则:测评名称+姓名+工号(名称中间用英文输入法-连接)例如:大五职业性格测评-李玉冰-00004409.pdf
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg_body_bt" v-if="btShowEdit">
|
<div class="bg_body_bt" v-if="btShowEdit">
|
||||||
<div class="bg_body_bttext">
|
<div class="bg_body_bttext">
|
||||||
<div class="bg_body_btimg">
|
<div class="bg_body_btimg">
|
||||||
@@ -235,9 +233,12 @@
|
|||||||
: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:-95px;"
|
||||||
: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] || '' }}
|
||||||
|
<span v-if="totalNumber?.failedEntries>0||totalNumber?.successfulEntries>0" @click="failedDownload" style="color: #4ea6ff;cursor: pointer;margin-left: 5px;">
|
||||||
|
下载
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="upjd" v-if="item.percent">
|
<div class="upjd" v-if="item.percent">
|
||||||
@@ -245,16 +246,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="file_operation" @click="delUploadList(index)" style="color: #4ea6ff;cursor: pointer">
|
<div class="file_operation btn_item" @click="delUploadList(index)" style="color: #4ea6ff;cursor: pointer">
|
||||||
删除
|
<span style="width: 23px;height: 21px;" class="delete"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg_body_bt" v-if="btShow">
|
<div class="bg_body_bt" v-if="btShowEdit">
|
||||||
<div class="bg_body_bttext">备注</div>
|
<div class="bg_body_bttext">上传说明</div>
|
||||||
<div class="bg_body_input">
|
<div class="bg_body_input">
|
||||||
<a-textarea placeholder="请输入备注(限200个字以内)" style="width: 334px;height: 88px;" v-model:value="formData.remarks" showCount :maxlength="200" />
|
<span style="color: #999ba3">
|
||||||
|
1、仅支持1个zip压缩包和pdf报告上传;<br/>
|
||||||
|
2、单个附件命名规则:测评名称+姓名+工号(名称中间用英文输入法-连接)例如:大五职业性格测评-李玉冰-00004409.pdf
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg_footer">
|
<div class="bg_footer">
|
||||||
@@ -264,6 +268,8 @@
|
|||||||
<a-button
|
<a-button
|
||||||
class="btn btn6"
|
class="btn btn6"
|
||||||
:loading="uploadDownLoad"
|
:loading="uploadDownLoad"
|
||||||
|
:disabled="totalNumber?.failedEntries>0"
|
||||||
|
:style="{background: totalNumber?.failedEntries>0?'#d9d9d9':'#4ea6ff'}"
|
||||||
@click="formData.id&&btShow?showUpload():reportUpload()"
|
@click="formData.id&&btShow?showUpload():reportUpload()"
|
||||||
>
|
>
|
||||||
确定
|
确定
|
||||||
@@ -421,9 +427,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="bg_body">
|
<div class="bg_body">
|
||||||
<div>上传结果</div>
|
<div>上传结果</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 style="margin: 25px 0 0 24px;">上传的测评报告总文件数{{totalNumber.totalEntries}}个,成功{{totalNumber.successfulEntries}}个,失败{{totalNumber.failedEntries}}个;<br/>上传结果请下载查看!</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>
|
||||||
</div>
|
</div>
|
||||||
<a-button
|
<a-button
|
||||||
@@ -431,7 +437,7 @@
|
|||||||
@click="resultsUp"
|
@click="resultsUp"
|
||||||
>
|
>
|
||||||
确定
|
确定
|
||||||
</a-button>
|
</a-button> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -518,8 +524,10 @@
|
|||||||
:loading="tableLoadingAdd"
|
:loading="tableLoadingAdd"
|
||||||
:scroll="{ x: 1000,y: 500 }"
|
:scroll="{ x: 1000,y: 500 }"
|
||||||
:pagination="paginationAdd"
|
:pagination="paginationAdd"
|
||||||
|
:customRow="customRow"
|
||||||
|
:row-class-name="getRowClassName"
|
||||||
>
|
>
|
||||||
<template #addAuthority="{ record, column }">
|
<!-- <template #addAuthority="{ record, column }">
|
||||||
<a-space>
|
<a-space>
|
||||||
<a-button type="link" @click="powerSetting(record)">
|
<a-button type="link" @click="powerSetting(record)">
|
||||||
<span>权限配置</span>
|
<span>权限配置</span>
|
||||||
@@ -531,7 +539,7 @@
|
|||||||
<span class="download">删除</span>
|
<span class="download">删除</span>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template> -->
|
||||||
</a-table>
|
</a-table>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg_body">
|
<div class="bg_body">
|
||||||
@@ -692,6 +700,7 @@ import { useStore } from "vuex";
|
|||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import {timeoutUpload} from "@/api/configPublic";
|
import {timeoutUpload} from "@/api/configPublic";
|
||||||
// import md5 from 'js-md5';
|
// import md5 from 'js-md5';
|
||||||
|
import {downLoadZip} from "@/utils/zipdownload";
|
||||||
export default {
|
export default {
|
||||||
name: 'evaluationUpload',
|
name: 'evaluationUpload',
|
||||||
components:{
|
components:{
|
||||||
@@ -705,6 +714,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
const state = reactive({
|
const state = reactive({
|
||||||
activeUrl: process.env.VUE_APP_ACT_API + '/evaluation/import',
|
activeUrl: process.env.VUE_APP_ACT_API + '/evaluation/import',
|
||||||
uploadTypes: true,
|
uploadTypes: true,
|
||||||
|
selectedRow: null,
|
||||||
uploadStatusType: true,
|
uploadStatusType: true,
|
||||||
saveNotUpload: true,
|
saveNotUpload: true,
|
||||||
stateUpload: true,
|
stateUpload: true,
|
||||||
@@ -855,6 +865,15 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
saveListItem()
|
saveListItem()
|
||||||
})
|
})
|
||||||
// 添加权限
|
// 添加权限
|
||||||
|
const customRow = (record) => ({
|
||||||
|
onClick: () => {
|
||||||
|
state.selectedRow = record
|
||||||
|
state.saveList.push(record)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const getRowClassName = (record, index) => {
|
||||||
|
return state.selectedRow === record ? 'highlight-row' : '';
|
||||||
|
}
|
||||||
const paginationAdd = computed(() => ({
|
const paginationAdd = computed(() => ({
|
||||||
total: state.totalAdd,
|
total: state.totalAdd,
|
||||||
showSizeChanger: true,
|
showSizeChanger: true,
|
||||||
@@ -1033,8 +1052,8 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "工号",
|
title: "工号",
|
||||||
dataIndex: "departId",
|
dataIndex: "userNo",
|
||||||
key: "departId",
|
key: "userNo",
|
||||||
className: "h",
|
className: "h",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
align: "center",
|
align: "center",
|
||||||
@@ -1058,15 +1077,15 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
align: "center",
|
align: "center",
|
||||||
width: 100,
|
width: 100,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
title: "操作",
|
// title: "操作",
|
||||||
width: "20%",
|
// width: "20%",
|
||||||
fixed: 'right',
|
// fixed: 'right',
|
||||||
dataIndex: "id",
|
// dataIndex: "id",
|
||||||
key: "id",
|
// key: "id",
|
||||||
align: "center",
|
// align: "center",
|
||||||
slots: { customRender: "addAuthority" },
|
// slots: { customRender: "addAuthority" },
|
||||||
},
|
// },
|
||||||
])
|
])
|
||||||
const textDisabled = async (record) => {
|
const textDisabled = async (record) => {
|
||||||
await updateStatus({status:1,id:record.id}).then((res)=>{
|
await updateStatus({status:1,id:record.id}).then((res)=>{
|
||||||
@@ -1142,10 +1161,12 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
message.info('请先上传报告')
|
message.info('请先上传报告')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
window.open(`${process.env.VUE_APP_ACT_API}/evaluation/download?id=${record.id}`);
|
// window.open(`${process.env.VUE_APP_ACT_API}/evaluation/download?id=${record.id}`);
|
||||||
|
downLoadZip(`/evaluation/download?id=${record.id}`,record.evaluationName)
|
||||||
}
|
}
|
||||||
const of_exit = () => {
|
const of_exit = () => {
|
||||||
// state.tableLoading = false
|
// state.tableLoading = false
|
||||||
|
state.totalNumber = {}
|
||||||
state.uploadTypes = false
|
state.uploadTypes = false
|
||||||
state.uploadDownLoad = false
|
state.uploadDownLoad = false
|
||||||
state.bg_check = false;
|
state.bg_check = false;
|
||||||
@@ -1161,11 +1182,6 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
}
|
}
|
||||||
// 上传结果
|
// 上传结果
|
||||||
const of_results = () => {
|
const of_results = () => {
|
||||||
if(state.totalNumber.failedEntries!=0){
|
|
||||||
message.warning('上传文件含有错误信息,已自动删除,请上传正确文件')
|
|
||||||
delUploadList()
|
|
||||||
}
|
|
||||||
state.totalNumber = {}
|
|
||||||
state.bg_results = false
|
state.bg_results = false
|
||||||
}
|
}
|
||||||
const resultsUp = () => {
|
const resultsUp = () => {
|
||||||
@@ -1192,6 +1208,10 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
message.error('上传报告含有错误报告,请检查后重新上传')
|
message.error('上传报告含有错误报告,请检查后重新上传')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(state.uploadList.length==0&&state.btShowEdit){
|
||||||
|
message.error('请您上传附件')
|
||||||
|
return
|
||||||
|
}
|
||||||
// state.tableLoading = true
|
// state.tableLoading = true
|
||||||
state.uploadDownLoad = true
|
state.uploadDownLoad = true
|
||||||
if( !state.loadData&&state.loadNewDown){
|
if( !state.loadData&&state.loadNewDown){
|
||||||
@@ -1247,6 +1267,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
//上传图片
|
//上传图片
|
||||||
const headers = { token: getCookieForName("token") };
|
const headers = { token: getCookieForName("token") };
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = (file) => {
|
||||||
|
console.log(file,'file')
|
||||||
const isJpgOrPng =
|
const isJpgOrPng =
|
||||||
file.type === "image/jpeg" ||
|
file.type === "image/jpeg" ||
|
||||||
file.type === "image/png"
|
file.type === "image/png"
|
||||||
@@ -1264,11 +1285,14 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
uploadImage(formData).then((res) => {
|
uploadImage(formData).then((res) => {
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
state.formData.cover = res.data.split('Path:')[1];
|
state.formData.cover = res.data.split('elearning')[1];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
const handleChangeImg = (info) =>{
|
||||||
|
console.log(info,'info')
|
||||||
|
}
|
||||||
const beforeUpload3 = async (file) => {
|
const beforeUpload3 = async (file) => {
|
||||||
if(!state.formData.evaluationName){
|
if(!state.formData.evaluationName){
|
||||||
message.error('请先填写测评名称')
|
message.error('请先填写测评名称')
|
||||||
@@ -1374,6 +1398,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
};
|
};
|
||||||
const uploadRef = ref()
|
const uploadRef = ref()
|
||||||
const delUploadList = (i) => {
|
const delUploadList = (i) => {
|
||||||
|
state.totalNumber = {}
|
||||||
state.uploadTypes = false
|
state.uploadTypes = false
|
||||||
state.uploadDownLoad = false
|
state.uploadDownLoad = false
|
||||||
state.sussessIds = null
|
state.sussessIds = null
|
||||||
@@ -1585,6 +1610,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
downloadAll,
|
downloadAll,
|
||||||
headers,
|
headers,
|
||||||
beforeUpload,
|
beforeUpload,
|
||||||
|
handleChangeImg,
|
||||||
beforeUpload3,
|
beforeUpload3,
|
||||||
handleChange,
|
handleChange,
|
||||||
delUploadList,
|
delUploadList,
|
||||||
@@ -1604,6 +1630,8 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
changePaginationsAdd,
|
changePaginationsAdd,
|
||||||
pagination,
|
pagination,
|
||||||
paginationAdd,
|
paginationAdd,
|
||||||
|
customRow,
|
||||||
|
getRowClassName,
|
||||||
textDisabled,
|
textDisabled,
|
||||||
textDelete,
|
textDelete,
|
||||||
updateAuthority,
|
updateAuthority,
|
||||||
@@ -1617,6 +1645,9 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
::v-deep .ant-dropdown{
|
::v-deep .ant-dropdown{
|
||||||
left: 120px !important;
|
left: 120px !important;
|
||||||
}
|
}
|
||||||
|
::v-deep .highlight-row{
|
||||||
|
background: #4ea6ff !important;
|
||||||
|
}
|
||||||
.evaluationUpload{
|
.evaluationUpload{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -1806,7 +1837,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.mbl_items12 {
|
.mbl_items12 {
|
||||||
width: 334px;
|
width: 333px;
|
||||||
margin-left: 128px;
|
margin-left: 128px;
|
||||||
.item_text{
|
.item_text{
|
||||||
width: 300px;
|
width: 300px;
|
||||||
@@ -1882,7 +1913,7 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
.updataxq {
|
.updataxq {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 2px;
|
right: 2px;
|
||||||
top: -30px;
|
top: -37px;
|
||||||
color: #57c887;
|
color: #57c887;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2005,6 +2036,10 @@ import {timeoutUpload} from "@/api/configPublic";
|
|||||||
background-color: #4ea6ff;
|
background-color: #4ea6ff;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
.btndesign {
|
||||||
|
background-color: #eff4fc;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.headers{
|
.headers{
|
||||||
|
|||||||
Reference in New Issue
Block a user