Browse Source

修改

develop
caoyizhong 3 years ago
parent
commit
d723b19969
  1. 46
      src/views/report/index.vue

46
src/views/report/index.vue

@ -142,12 +142,27 @@
</el-select>
</el-form-item>
<el-form-item label="报告封面:">
<el-upload action="#" :limit="limit" :http-request="uploadImg" accept="image/*">
<el-button size="small" type="primary">点击上传</el-button>
<!-- <el-upload action="#" :limit="limit" :http-request="uploadImg" accept="image/*">-->
<!-- <el-button size="small" type="primary">点击上传</el-button>-->
<!-- <div slot="tip" class="el-upload__tip">-->
<!-- 只能上传图片文件且不超过5Mb-->
<!-- </div>-->
<!-- </el-upload>-->
<el-upload
action=""
list-type="picture-card"
:limit="limit"
:file-list="editForm.previewUrl"
:http-request="uploadImg"
accept="image/*"
>
<i class="el-icon-plus avatar-uploader-icon"></i>
<div slot="tip" class="el-upload__tip">
只能上传图片文件且不超过5Mb
</div>
</el-upload>
</el-form-item>
<el-form-item label="文件类型:">
<el-select v-model="editForm.fileType" placeholder="请选择文件类型">
@ -164,10 +179,14 @@
<el-upload
v-else
action="#"
ref="myUpload"
:limit="limit"
:on-preview="handlePreview"
:file-list="editForm.filePathe"
:http-request="uploadFile"
accept=".pdf"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">
只能上传PDF文件且不超过5Mb
@ -265,6 +284,13 @@ export default {
},
},
methods: {
handlePreview(file) {
console.log(file);
//
window.location.href = file.url; //
// window.open(file.url, "_blank"); //
},
//
clearSelection() {
this.$refs.multipleTable.clearSelection();
@ -281,6 +307,10 @@ export default {
);
queryList(param).then((response) => {
this.tableData = response.data.data.records;
//console.log(this.tableData)
// this.tableData.forEach( rest => {
// rest.reportCoverPath =[{ url: rest.reportCoverPath }];
// })
this.page.total = response.data.data.total;
this.loading = false;
});
@ -306,13 +336,17 @@ export default {
//
newItem() {
this.title = "新增报告";
this.$refs.myUpload.clearFiles()
this.editForm = {};
this.dialogReadOnly = false;
this.dialogVisible = true;
},
//
editItem(row) {
console.log(row)
this.title = "编辑报告";
row.previewUrl = [{ name: row.reportName, url: row.reportCoverPath }];
row.filePathe = [{ url: row.filePath }];
this.editForm = row;
this.dialogReadOnly = false;
this.dialogVisible = true;
@ -395,9 +429,13 @@ export default {
},
uploadImg(file) {
this.saveFlag = true;
// console.log(file)
uploadFile(file).then((res) => {
if (res.data.success) {
this.editForm.reportCoverPath = res.data.data.path;
this.editForm.reportCoverPath = res.data.data.path;
this.editForm.previewUrl = [
{ name: res.data.data.fileName, url: res.data.data.previewUrl },
];
this.saveFlag = false;
}
});
@ -424,4 +462,4 @@ export default {
/deep/.el-dialog .el-form-item__content > .el-input {
width: 61%;
}
</style>
</style>

Loading…
Cancel
Save