|
@@ -116,7 +116,7 @@
|
|
|
</el-table-column> -->
|
|
|
<el-table-column label="下载次数" align="center" prop="download">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ scope.row.download?scope.row.download:'暂无下载' }}
|
|
|
+ {{ scope.row.download ? scope.row.download : "暂无下载" }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
@@ -192,7 +192,7 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="文件名称" prop="serviceName">
|
|
|
- <el-input v-model="form.serviceName"></el-input>
|
|
|
+ <el-input v-model="form.serviceName" disabled></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -211,9 +211,10 @@ import {
|
|
|
addOPSERVICE,
|
|
|
updateOPSERVICE,
|
|
|
upload,
|
|
|
- download
|
|
|
+ download,
|
|
|
} from "@/api/portal/OPSERVICE/OPSERVICE.js";
|
|
|
|
|
|
+import { saveAs } from "file-saver";
|
|
|
export default {
|
|
|
name: "OPSERVICE",
|
|
|
data() {
|
|
@@ -284,6 +285,8 @@ export default {
|
|
|
{ required: true, message: "服务类型不能为空", trigger: "change" },
|
|
|
],
|
|
|
},
|
|
|
+ setFileName: "", //保存文件名,点击下载时使用这个名字
|
|
|
+ downloadLoadingInstance:'',
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -299,17 +302,20 @@ export default {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
- handleDownload(row){
|
|
|
- let fileName = row.serviceName
|
|
|
- download(fileName).then(res=>{
|
|
|
- })
|
|
|
+ handleDownload(row) {
|
|
|
+ this.setFileName = row.serviceName;
|
|
|
+ download(row.linkUrl,row.id).then((res) => {
|
|
|
+ const blob = new Blob([res]);
|
|
|
+ saveAs(blob, this.setFileName);
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
},
|
|
|
httprequest() {},
|
|
|
uploadFile(file) {
|
|
|
let formData = new FormData();
|
|
|
formData.append("file", file);
|
|
|
upload(formData).then((res) => {
|
|
|
- this.form.linkUrl = res.url;
|
|
|
+ this.form.linkUrl = res.fileName;
|
|
|
this.$set(this.form, "serviceName", res.originalFilename);
|
|
|
});
|
|
|
},
|
|
@@ -398,7 +404,7 @@ export default {
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
|
this.$modal
|
|
|
- .confirm('确定删除吗?')
|
|
|
+ .confirm("确定删除吗?")
|
|
|
.then(function () {
|
|
|
return delOPSERVICE(ids);
|
|
|
})
|