diff --git a/src/utils/zipdownload.js b/src/utils/zipdownload.js
new file mode 100644
index 00000000..d42e85c2
--- /dev/null
+++ b/src/utils/zipdownload.js
@@ -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);
+}
diff --git a/src/views/evaluation/EvaDown.vue b/src/views/evaluation/EvaDown.vue
index cda8484d..a502f703 100644
--- a/src/views/evaluation/EvaDown.vue
+++ b/src/views/evaluation/EvaDown.vue
@@ -69,6 +69,7 @@ import { useRoute } from "vue-router";
import { message } from "ant-design-vue";
import { useStore } from "vuex";
import {boeRequest} from "@/api/request";
+import {downLoadZip} from "@/utils/zipdownload";
export default {
name: "evadown",
components: {},
@@ -165,7 +166,8 @@ import {boeRequest} from "@/api/request";
message.info('请先上传报告')
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 () => {
state.tableLoading = true
diff --git a/src/views/evaluation/evaluationUpload.vue b/src/views/evaluation/evaluationUpload.vue
index 153daf2b..5fd58aca 100644
--- a/src/views/evaluation/evaluationUpload.vue
+++ b/src/views/evaluation/evaluationUpload.vue
@@ -161,7 +161,7 @@
+ :before-upload="beforeUpload" @change="handleChangeImg">
-
-
上传说明
+
+
备注
-
- 1、仅支持1个zip压缩包和pdf报告上传;
- 2、单个附件命名规则:测评名称+姓名+工号(名称中间用英文输入法-连接)例如:大五职业性格测评-李玉冰-00004409.pdf
-
+
+
@@ -235,9 +233,12 @@
:class="`${{uploading: 'updatacolor3', done: 'updatacolor' ,error: 'updatacolor2'}[item.status] || 'updatacolor'}`"
:style="{width:`${item.status==='uploading'?parseInt(item.percent):100}%`}">
- {{ {uploading: '正在上传', done: '上传完成', error: '上传失败'}[item.status] || '' }}
+ {{ {uploading: '正在上传', done: '上传完成', error: '报告错误'}[item.status] || '' }}
+
+ 下载
+
@@ -245,16 +246,19 @@
-
-
-
备注
+
+
上传说明
-
+
+ 1、仅支持1个zip压缩包和pdf报告上传;
+ 2、单个附件命名规则:测评名称+姓名+工号(名称中间用英文输入法-连接)例如:大五职业性格测评-李玉冰-00004409.pdf
+
上传结果
-
上传的测评报告总文件数{{totalNumber.totalEntries}}个,成功{{totalNumber.successfulEntries}}个,失败{{totalNumber.failedEntries}}个;
上传结果请下载查看!
+
上传的测评报告总文件数{{totalNumber.totalEntries}}个,成功{{totalNumber.successfulEntries}}个,失败{{totalNumber.failedEntries}}个;
上传结果请下载查看!
@@ -518,8 +524,10 @@
:loading="tableLoadingAdd"
:scroll="{ x: 1000,y: 500 }"
:pagination="paginationAdd"
+ :customRow="customRow"
+ :row-class-name="getRowClassName"
>
-
+
@@ -692,6 +700,7 @@ import { useStore } from "vuex";
import { message } from "ant-design-vue";
import {timeoutUpload} from "@/api/configPublic";
// import md5 from 'js-md5';
+import {downLoadZip} from "@/utils/zipdownload";
export default {
name: 'evaluationUpload',
components:{
@@ -705,6 +714,7 @@ import {timeoutUpload} from "@/api/configPublic";
const state = reactive({
activeUrl: process.env.VUE_APP_ACT_API + '/evaluation/import',
uploadTypes: true,
+ selectedRow: null,
uploadStatusType: true,
saveNotUpload: true,
stateUpload: true,
@@ -855,6 +865,15 @@ import {timeoutUpload} from "@/api/configPublic";
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(() => ({
total: state.totalAdd,
showSizeChanger: true,
@@ -1033,8 +1052,8 @@ import {timeoutUpload} from "@/api/configPublic";
},
{
title: "工号",
- dataIndex: "departId",
- key: "departId",
+ dataIndex: "userNo",
+ key: "userNo",
className: "h",
ellipsis: true,
align: "center",
@@ -1058,15 +1077,15 @@ import {timeoutUpload} from "@/api/configPublic";
align: "center",
width: 100,
},
- {
- title: "操作",
- width: "20%",
- fixed: 'right',
- dataIndex: "id",
- key: "id",
- align: "center",
- slots: { customRender: "addAuthority" },
- },
+ // {
+ // title: "操作",
+ // width: "20%",
+ // fixed: 'right',
+ // dataIndex: "id",
+ // key: "id",
+ // align: "center",
+ // slots: { customRender: "addAuthority" },
+ // },
])
const textDisabled = async (record) => {
await updateStatus({status:1,id:record.id}).then((res)=>{
@@ -1142,10 +1161,12 @@ import {timeoutUpload} from "@/api/configPublic";
message.info('请先上传报告')
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 = () => {
// state.tableLoading = false
+ state.totalNumber = {}
state.uploadTypes = false
state.uploadDownLoad = false
state.bg_check = false;
@@ -1161,11 +1182,6 @@ import {timeoutUpload} from "@/api/configPublic";
}
// 上传结果
const of_results = () => {
- if(state.totalNumber.failedEntries!=0){
- message.warning('上传文件含有错误信息,已自动删除,请上传正确文件')
- delUploadList()
- }
- state.totalNumber = {}
state.bg_results = false
}
const resultsUp = () => {
@@ -1192,6 +1208,10 @@ import {timeoutUpload} from "@/api/configPublic";
message.error('上传报告含有错误报告,请检查后重新上传')
return
}
+ if(state.uploadList.length==0&&state.btShowEdit){
+ message.error('请您上传附件')
+ return
+ }
// state.tableLoading = true
state.uploadDownLoad = true
if( !state.loadData&&state.loadNewDown){
@@ -1247,6 +1267,7 @@ import {timeoutUpload} from "@/api/configPublic";
//上传图片
const headers = { token: getCookieForName("token") };
const beforeUpload = (file) => {
+ console.log(file,'file')
const isJpgOrPng =
file.type === "image/jpeg" ||
file.type === "image/png"
@@ -1264,11 +1285,14 @@ import {timeoutUpload} from "@/api/configPublic";
formData.append("file", file);
uploadImage(formData).then((res) => {
if (res.status === 200) {
- state.formData.cover = res.data.split('Path:')[1];
+ state.formData.cover = res.data.split('elearning')[1];
}
});
return false;
};
+ const handleChangeImg = (info) =>{
+ console.log(info,'info')
+ }
const beforeUpload3 = async (file) => {
if(!state.formData.evaluationName){
message.error('请先填写测评名称')
@@ -1374,6 +1398,7 @@ import {timeoutUpload} from "@/api/configPublic";
};
const uploadRef = ref()
const delUploadList = (i) => {
+ state.totalNumber = {}
state.uploadTypes = false
state.uploadDownLoad = false
state.sussessIds = null
@@ -1585,6 +1610,7 @@ import {timeoutUpload} from "@/api/configPublic";
downloadAll,
headers,
beforeUpload,
+ handleChangeImg,
beforeUpload3,
handleChange,
delUploadList,
@@ -1604,6 +1630,8 @@ import {timeoutUpload} from "@/api/configPublic";
changePaginationsAdd,
pagination,
paginationAdd,
+ customRow,
+ getRowClassName,
textDisabled,
textDelete,
updateAuthority,
@@ -1617,6 +1645,9 @@ import {timeoutUpload} from "@/api/configPublic";
::v-deep .ant-dropdown{
left: 120px !important;
}
+::v-deep .highlight-row{
+ background: #4ea6ff !important;
+}
.evaluationUpload{
width: 100%;
height: 100%;
@@ -1806,7 +1837,7 @@ import {timeoutUpload} from "@/api/configPublic";
}
}
.mbl_items12 {
- width: 334px;
+ width: 333px;
margin-left: 128px;
.item_text{
width: 300px;
@@ -1882,7 +1913,7 @@ import {timeoutUpload} from "@/api/configPublic";
.updataxq {
position: absolute;
right: 2px;
- top: -30px;
+ top: -37px;
color: #57c887;
}
@@ -2005,6 +2036,10 @@ import {timeoutUpload} from "@/api/configPublic";
background-color: #4ea6ff;
color: #ffffff;
}
+ .btndesign {
+ background-color: #eff4fc;
+ color: #ffffff;
+ }
}
}
.headers{