update AttachmentDialog

This commit is contained in:
lb 2023-07-10 11:25:03 +08:00
parent e12d6d161b
commit c193a18252

View File

@ -7,6 +7,9 @@
:visible.sync="visible"> :visible.sync="visible">
<!-- upload --> <!-- upload -->
<div class="upload"> <div class="upload">
<!-- actionUrl() {
return window.SITE_CONFIG["apiURL"] + this.urls.importUrl;
}, -->
<el-upload <el-upload
class="upload-demo" class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/" action="https://jsonplaceholder.typicode.com/posts/"
@ -16,14 +19,14 @@
:on-success="handleSuccess" :on-success="handleSuccess"
multiple multiple
:show-file-list="false"> :show-file-list="false">
<el-button size="small" type="primary" class='btn-upload'>上传</el-button> <el-button size="small" type="primary" class="btn-upload">上传</el-button>
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> --> <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> -->
</el-upload> </el-upload>
<!-- filelist --> <!-- filelist -->
<div class="filelist"> <div class="filelist">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6" v-for="file in fileList" :key="file.name"> <el-col :span="6" v-for="file in fileList" :key="file.name + Math.random()">
<div class="fileListItem"> <div class="fileListItem">
<div class="filename">{{ file.name }}</div> <div class="filename">{{ file.name }}</div>
<div class="file-actions"> <div class="file-actions">
@ -47,16 +50,34 @@ export default {
return { return {
visible: false, visible: false,
fileList: [], fileList: [],
shapeId: null,
shapeInfo: null
}; };
}, },
inject: ["urls"],
mounted() {}, mounted() {},
methods: { methods: {
init() { init(shapeId) {
this.shapeId = shapeId;
this.getFileList();
this.visible = true; this.visible = true;
}, },
close() { close() {
this.visible = false; this.visible = false;
}, },
// requests
async getFileList() {
// get shape info
try {
this.shapeInfo = await this.$http.get(this.urls.base + `/${this.shapeId}`);
// extract filelist and save filelist seperately
this.fileList = this.shapeInfo.files;
// TODO....
} catch (error) {
this.$message.error(error.msg);
}
},
// operations // operations
handlePreview(file) {}, handlePreview(file) {},
handleDownload(file) {}, handleDownload(file) {},