下载方式修改

main
wanglei 1 month ago
parent c879dac412
commit 3f41355c99

@ -7,12 +7,12 @@
<div class="_title">考核任务{{ item.pingceName }}</div>
<div class="_time">{{ item.sTime + ' - ' + item.eTime }}</div>
<div>
<el-tag
<el-tag v-hasPermi="['kaohe:vote_emp:edit']"
type="success"
v-if="(new Date(item.sTime) < (new Date())) && (new Date(item.eTime) > (new Date()))"
@click="goVotepage(item)"
>
<i class="el-icon-thumb" v-hasPermi="['kaohe:vote_emp:edit']"></i>
<i class="el-icon-thumb"></i> 去评
</el-tag>
<el-tag type="info" v-if="new Date(item.sTime) > (new Date())"></el-tag>
<el-tag type="info" v-if="(new Date(item.sTime) < (new Date())) && (new Date(item.eTime) < (new Date()))"></el-tag>
@ -76,7 +76,7 @@ export default {
}else {
listVote_recard({
pageNum: 1,
pageSize: 1000000000,
pageSize: 10000000,
voteId: row.id,
userId: this.$store.state.user.id,
}).then(response => {

@ -310,7 +310,8 @@
<span>已有附件</span>
</div>
<div v-for="(item,index) in uploadFJ.fileList" :key="item.url" class="yy_fj_list">
<a :href="item.url" :download="item.name" target="_blank">{{ item.name }}</a>
<!-- <a :href="item.url" :download="item.name" target="_blank">{{ item.name }}</a>-->
<el-link type="primary" @click="downloadFJ(item)">{{ item.name }}</el-link>
<i class="el-icon-close" @click="uploadFJListRemove(index)"></i>
</div>
</el-card>
@ -348,7 +349,8 @@
<span>附件</span>
</div>
<div v-for="(item,index) in viewUploadFJ.fileList" :key="item.url" class="yy_fj_list1">
<a :href="item.url" :download="item.name" target="_blank">{{ item.name }}</a>
<!-- <a :href="item.url" :download="item.name" target="_blank">{{ item.name }}</a>-->
<el-link type="primary" @click="downloadFJ(item)">{{ item.name }}</el-link>
</div>
</el-card>
<div slot="footer" class="dialog-footer">
@ -365,6 +367,7 @@ import { getToken } from "@/utils/auth"
import { deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import axios from "axios";
export default {
name: "Employee",
@ -715,6 +718,26 @@ export default {
this.getList();
})
}
},
//
downloadFJ(row){
axios({
url: row.url,
method: 'get',
responseType: 'blob'
}).then(res => {
const blob = new Blob([res.data], { type: res.headers['content-type'] });
const fileName = row.name; //
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
document.body.appendChild(link);
link.click();
URL.revokeObjectURL(link.href);
document.body.removeChild(link);
}).catch(err => {
console.error('下载失败', err);
});
}
}
}

@ -342,7 +342,8 @@
<span>附件</span>
</div>
<div v-for="(item,index) in viewUploadFJ.fileList" :key="item.url" class="yy_fj_list1">
<a :href="item.url" :download="item.name" target="_blank">{{ item.name }}</a>
<!-- <a :href="item.url" :download="item.name" target="_blank">{{ item.name }}</a>-->
<el-link type="primary" @click="downloadFJ(item)">{{ item.name }}</el-link>
</div>
</el-card>
<div slot="footer" class="dialog-footer">
@ -359,6 +360,7 @@ import { getToken } from "@/utils/auth"
import { deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import axios from 'axios'
export default {
name: "Employee",
@ -719,14 +721,25 @@ export default {
}
this.viewUploadFJ.open = true;
},
downloadByBlob(blob, fileName) {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = fileName;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
//
downloadFJ(row){
axios({
url: row.url,
method: 'get',
responseType: 'blob'
}).then(res => {
const blob = new Blob([res.data], { type: res.headers['content-type'] });
const fileName = row.name; //
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
document.body.appendChild(link);
link.click();
URL.revokeObjectURL(link.href);
document.body.removeChild(link);
}).catch(err => {
console.error('下载失败', err);
});
}
}
}

Loading…
Cancel
Save