|
@@ -3,7 +3,7 @@
|
|
|
<div v-if="type === 'button'" class="picture_list">
|
|
<div v-if="type === 'button'" class="picture_list">
|
|
|
<div class="flex-align-center flex-between pionter" v-for="(img,index) in fileLinkList" :key="img.index">
|
|
<div class="flex-align-center flex-between pionter" v-for="(img,index) in fileLinkList" :key="img.index">
|
|
|
<div class="flex-align-center">
|
|
<div class="flex-align-center">
|
|
|
- <img width="30" :src="img.type.split('/')[0] === 'image'?img.url:require('@/assets/file_icons/file.svg')" class="inline-16" alt="">
|
|
|
|
|
|
|
+ <img width="30" :src="img.url" class="inline-16" alt="">
|
|
|
<div class="file__link inline-16">
|
|
<div class="file__link inline-16">
|
|
|
<p>{{img.name}}</p>
|
|
<p>{{img.name}}</p>
|
|
|
</div>
|
|
</div>
|
|
@@ -22,7 +22,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else class="flex-align-stretch">
|
|
<div v-else class="flex-align-stretch">
|
|
|
<div v-for="(img,index) in fileLinkList" :key="index" class="upload_image__panel">
|
|
<div v-for="(img,index) in fileLinkList" :key="index" class="upload_image__panel">
|
|
|
- <img :src="img.type.split('/')[0] === 'image'?img.url:require('@/assets/file_icons/file.svg')" alt="">
|
|
|
|
|
|
|
+ <img :src="img.url" alt="">
|
|
|
<div class="upload_image__panel_mod flex-align-center flex-around">
|
|
<div class="upload_image__panel_mod flex-align-center flex-around">
|
|
|
<i class="el-icon-delete" style="font-size:16px" @click="handleRemove(index)"></i>
|
|
<i class="el-icon-delete" style="font-size:16px" @click="handleRemove(index)"></i>
|
|
|
</div>
|
|
</div>
|
|
@@ -43,6 +43,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+import removeFile from '@/utils/removeFile'
|
|
|
export default {
|
|
export default {
|
|
|
props:['folderid','bindData','type','accept','multiple','one'],
|
|
props:['folderid','bindData','type','accept','multiple','one'],
|
|
|
data() {
|
|
data() {
|
|
@@ -50,6 +51,7 @@ export default {
|
|
|
imageUrl:'',
|
|
imageUrl:'',
|
|
|
fileList:[],
|
|
fileList:[],
|
|
|
fileLinkList:[],
|
|
fileLinkList:[],
|
|
|
|
|
+ deleteArr:[],
|
|
|
params: {
|
|
params: {
|
|
|
"classname": "system.attachment.huawei.OBS",
|
|
"classname": "system.attachment.huawei.OBS",
|
|
|
"method": "getFileName",
|
|
"method": "getFileName",
|
|
@@ -78,12 +80,19 @@ export default {
|
|
|
fileReader.onload = function(e) {
|
|
fileReader.onload = function(e) {
|
|
|
var result = e.target.result;
|
|
var result = e.target.result;
|
|
|
that.fileLinkList.unshift({url:result,type:file.type,name:file.name})
|
|
that.fileLinkList.unshift({url:result,type:file.type,name:file.name})
|
|
|
|
|
+ console.log(that.fileLinkList,'111');
|
|
|
|
|
+
|
|
|
if (that.fileLinkList.length > 1 && that.one) {
|
|
if (that.fileLinkList.length > 1 && that.one) {
|
|
|
- that.fileLinkList = that.fileLinkList.splice(0,1)
|
|
|
|
|
|
|
+ that.deleteArr[0] = that.fileLinkList.pop()
|
|
|
|
|
+ console.log(that.deleteArr);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
handleRemove (index) {
|
|
handleRemove (index) {
|
|
|
|
|
+ removeFile.removeFileList([this.fileList[index]]).then(() => {
|
|
|
|
|
+ this.$emit('deleteSuccess')
|
|
|
|
|
+ })
|
|
|
this.fileList = this.fileList.filter((e,idx)=>{
|
|
this.fileList = this.fileList.filter((e,idx)=>{
|
|
|
if (idx !== index) {
|
|
if (idx !== index) {
|
|
|
return e
|
|
return e
|
|
@@ -129,6 +138,12 @@ export default {
|
|
|
|
|
|
|
|
// 上传成功以后生成附件记录
|
|
// 上传成功以后生成附件记录
|
|
|
async createFileRecord (obsfilename,attinfos) {
|
|
async createFileRecord (obsfilename,attinfos) {
|
|
|
|
|
+ console.log(this.deleteArr.length,this.one);
|
|
|
|
|
+
|
|
|
|
|
+ if(this.deleteArr.length && this.one) {
|
|
|
|
|
+ this.deleteFun()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
let obj = {
|
|
let obj = {
|
|
|
"serialfilename": obsfilename
|
|
"serialfilename": obsfilename
|
|
|
}
|
|
}
|
|
@@ -148,6 +163,11 @@ export default {
|
|
|
console.log(this.fileList)
|
|
console.log(this.fileList)
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
|
|
+ deleteFun () {
|
|
|
|
|
+ console.log(this.deleteArr,'删除数据');
|
|
|
|
|
+
|
|
|
|
|
+ removeFile.removeFileList(this.deleteArr)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|