Procházet zdrojové kódy

附件上传按钮以及附件删除功能调整

lizhenhao před 2 roky
rodič
revize
22cfd069ac

+ 12 - 22
src/views/common/UpLoadComponent.vue

@@ -11,11 +11,13 @@
                :show-file-list="false"
                :on-change="changes"
                :on-progress="uploadVideoProcess"
-			   :disabled="auth==='view'&&uploadFlag===false"
                :file-list="fileList">
-      <el-button :loading="loading" type="primary" size="default" :disabled="auth==='view'&&uploadFlag===false"  >
-		  点击上传
-	  </el-button>
+		<template v-if="auth==='view'&&uploadFlag===false" #tip>
+			<el-button :loading="loading" type="primary" size="default" :disabled="true"> 点击上传 </el-button>
+		</template>
+		<template v-else #trigger>
+			<el-button :loading="loading" type="primary" size="default"> 点击上传 </el-button>
+		</template>
     </el-upload>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
@@ -57,7 +59,7 @@
         </el-table-column>
       </el-table>
     </div>
-    <el-image-viewer v-if="showViewer" :on-close="closeViewer" :url-list="[url]" :zIndex=9999></el-image-viewer>
+<!--    <el-image-viewer v-if="showViewer" :on-close="closeViewer" :url-list="[url]" :zIndex=9999></el-image-viewer>-->
   </div>
 </template>
 
@@ -307,23 +309,11 @@
       toHref (row) {
         toHref(row)
       },
-      deleteById (row, index) {
-	  	this.$refs.upload.handleRemove(this.dataListNew[index])
-        this.dataListNew.splice(index, 1)
-		  this.dataList.splice(index, 1)
-		  this.tableKey = Math.random()
-        // if (row.id !== null && row.id !== '' && row.id !== undefined) {
-        //   this.dataList.splice(index, 1)
-        //   // this.ossService.deleteMsgById(row.id)
-        // } else {
-        //   let num
-        //   if (this.dataList.length > 0) {
-        //     num = this.dataList.length - 1
-        //   } else {
-        //     num = 0
-        //   }
-        //   this.$refs.upload.uploadFiles.splice(index - num, 1)
-        // }
+      async deleteById (row, index) {
+	  	// this.$refs.upload.handleRemove(this.dataListNew[index])
+        await this.dataListNew.splice(index, 1)
+		await this.dataList.splice(index, 1)
+		this.tableKey = Math.random()
       },
       /**
        * 关闭dialog时使用  清除el-upload中上传的文件

+ 11 - 17
src/views/common/UpLoadComponentCcpm.vue

@@ -11,10 +11,14 @@
                :show-file-list="false"
                :on-change="changes"
                :on-progress="uploadVideoProcess"
-			   :disabled="auth==='view'&&uploadFlag===false"
                :file-list="fileList">
-      <el-button :loading="loading" type="primary" size="mini" :disabled="auth==='view'&&uploadFlag===false">点击上传</el-button>
-    </el-upload>
+		<template v-if="auth==='view'&&uploadFlag===false" #tip>
+			<el-button :loading="loading" type="primary" size="default" :disabled="true"> 点击上传 </el-button>
+		</template>
+		<template v-else #trigger>
+			<el-button :loading="loading" type="primary" size="default"> 点击上传 </el-button>
+		</template>
+	</el-upload>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
       <el-progress style="margin-left: 5em" v-if="progressFlag" :percentage="loadProgress"></el-progress>
@@ -303,20 +307,10 @@
       toHref (row) {
         toHref(row)
       },
-      deleteById (row, index) {
-        this.dataListNew.splice(index, 1)
-        if (row.id !== null && row.id !== '' && row.id !== undefined) {
-          this.dataList.splice(index, 1)
-          // this.ossService.deleteMsgById(row.id)
-        } else {
-          let num
-          if (this.dataList.length > 0) {
-            num = this.dataList.length - 1
-          } else {
-            num = 0
-          }
-          this.$refs.upload.uploadFiles.splice(index - num, 1)
-        }
+      async deleteById (row, index) {
+		  await this.dataListNew.splice(index, 1)
+		  await this.dataList.splice(index, 1)
+		  this.tableKey = Math.random()
       },
       /**
        * 关闭dialog时使用  清除el-upload中上传的文件

+ 11 - 17
src/views/common/UpLoadComponentV2.1.vue

@@ -11,10 +11,14 @@
                :show-file-list="false"
                :on-change="changes"
                :on-progress="uploadVideoProcess"
-			   :disabled="auth==='view'&&uploadFlag===false"
                :file-list="fileList">
-      <el-button :loading="loading" type="primary" @click="clickHandel" :disabled="auth==='view'&&uploadFlag===false">点击上传</el-button>
-    </el-upload>
+		<template v-if="auth==='view'&&uploadFlag===false" #tip>
+			<el-button :loading="loading" type="primary" size="default" :disabled="true"> 点击上传 </el-button>
+		</template>
+		<template v-else #trigger>
+			<el-button :loading="loading" type="primary" size="default"> 点击上传 </el-button>
+		</template>
+	</el-upload>
     <el-button v-if="showSign" :loading="loading" type="info" style="float: right;" @click="clickSign">签章</el-button>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
@@ -523,20 +527,10 @@
       toHref (row) {
         toHref(row)
       },
-      deleteById (row, index) {
-        this.dataListNew.splice(index, 1)
-        if (row.id !== null && row.id !== '' && row.id !== undefined) {
-          this.dataList.splice(index, 1)
-          // this.ossService.deleteMsgById(row.id)
-        } else {
-          let num
-          if (this.dataList.length > 0) {
-            num = this.dataList.length - 1
-          } else {
-            num = 0
-          }
-          this.$refs.upload.uploadFiles.splice(index - num, 1)
-        }
+      async deleteById (row, index) {
+		  await this.dataListNew.splice(index, 1)
+		  await this.dataList.splice(index, 1)
+		  this.tableKey = Math.random()
       },
       /**
        * 关闭dialog时使用  清除el-upload中上传的文件

+ 11 - 17
src/views/common/UpLoadComponentV2.vue

@@ -11,10 +11,14 @@
                :show-file-list="false"
                :on-change="changes"
                :on-progress="uploadVideoProcess"
-			   :disabled="auth==='view'&&uploadFlag===false"
                :file-list="fileList">
-      <el-button :loading="loading" type="primary" size="mini" @click="clickHandel" :disabled="auth==='view'&&uploadFlag===false">点击上传</el-button>
-    </el-upload>
+		<template v-if="auth==='view'&&uploadFlag===false" #tip>
+			<el-button :loading="loading" type="primary" size="default" :disabled="true"> 点击上传 </el-button>
+		</template>
+		<template v-else #trigger>
+			<el-button :loading="loading" type="primary" size="default"> 点击上传 </el-button>
+		</template>
+	</el-upload>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
       <el-progress style="margin-left: 5em" v-if="progressFlag" :percentage="loadProgress"></el-progress>
@@ -490,20 +494,10 @@
       toHref (row) {
         toHref(row)
       },
-      deleteById (row, index) {
-        this.dataListNew.splice(index, 1)
-        if (row.id !== null && row.id !== '' && row.id !== undefined) {
-          this.dataList.splice(index, 1)
-          // this.ossService.deleteMsgById(row.id)
-        } else {
-          let num
-          if (this.dataList.length > 0) {
-            num = this.dataList.length - 1
-          } else {
-            num = 0
-          }
-          this.$refs.upload.uploadFiles.splice(index - num, 1)
-        }
+      async deleteById (row, index) {
+		  await this.dataListNew.splice(index, 1)
+		  await this.dataList.splice(index, 1)
+		  this.tableKey = Math.random()
       },
       /**
        * 关闭dialog时使用  清除el-upload中上传的文件

+ 11 - 17
src/views/common/UpLoadComponentV3.1.vue

@@ -11,10 +11,14 @@
                :show-file-list="false"
                :on-change="changes"
                :on-progress="uploadVideoProcess"
-			   :disabled="auth==='view'&&uploadFlag===false"
                :file-list="fileList">
-      <el-button :loading="loading" type="primary" @click="clickHandel" :disabled="auth==='view'&&uploadFlag===false">点击上传</el-button>
-    </el-upload>
+		<template v-if="auth==='view'&&uploadFlag===false" #tip>
+			<el-button :loading="loading" type="primary" size="default" :disabled="true"> 点击上传 </el-button>
+		</template>
+		<template v-else #trigger>
+			<el-button :loading="loading" type="primary" size="default"> 点击上传 </el-button>
+		</template>
+	</el-upload>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
       <el-progress style="margin-left: 5em" v-if="progressFlag" :percentage="loadProgress"></el-progress>
@@ -420,20 +424,10 @@
       toHref (row) {
         toHref(row)
       },
-      deleteById (row, index) {
-        this.dataListNew.splice(index, 1)
-        if (row.id !== null && row.id !== '' && row.id !== undefined) {
-          this.dataList.splice(index, 1)
-          // this.ossService.deleteMsgById(row.id)
-        } else {
-          let num
-          if (this.dataList.length > 0) {
-            num = this.dataList.length - 1
-          } else {
-            num = 0
-          }
-          this.$refs.upload.uploadFiles.splice(index - num, 1)
-        }
+      async deleteById (row, index) {
+		  await this.dataListNew.splice(index, 1)
+		  await this.dataList.splice(index, 1)
+		  this.tableKey = Math.random()
       },
       /**
        * 关闭dialog时使用  清除el-upload中上传的文件

+ 11 - 17
src/views/common/UpLoadComponentV3.vue

@@ -11,10 +11,14 @@
                :show-file-list="false"
                :on-change="changes"
                :on-progress="uploadVideoProcess"
-			   :disabled="auth==='view'&&uploadFlag===false"
                :file-list="fileList">
-      <el-button :loading="loading" type="primary" size="mini" @click="clickHandel" :disabled="auth==='view'&&uploadFlag===false">点击上传</el-button>
-    </el-upload>
+		<template v-if="auth==='view'&&uploadFlag===false" #tip>
+			<el-button :loading="loading" type="primary" size="default" :disabled="true"> 点击上传 </el-button>
+		</template>
+		<template v-else #trigger>
+			<el-button :loading="loading" type="primary" size="default"> 点击上传 </el-button>
+		</template>
+	</el-upload>
     <div style="height: calc(100% - 80px);margin-top: 10px">
       <!-- 进度条 -->
       <el-progress style="margin-left: 5em" v-if="progressFlag" :percentage="loadProgress"></el-progress>
@@ -415,20 +419,10 @@
       toHref (row) {
         toHref(row)
       },
-      deleteById (row, index) {
-        this.dataListNew.splice(index, 1)
-        if (row.id !== null && row.id !== '' && row.id !== undefined) {
-          this.dataList.splice(index, 1)
-          // this.ossService.deleteMsgById(row.id)
-        } else {
-          let num
-          if (this.dataList.length > 0) {
-            num = this.dataList.length - 1
-          } else {
-            num = 0
-          }
-          this.$refs.upload.uploadFiles.splice(index - num, 1)
-        }
+      async deleteById (row, index) {
+		  await this.dataListNew.splice(index, 1)
+		  await this.dataList.splice(index, 1)
+		  this.tableKey = Math.random()
       },
       /**
        * 关闭dialog时使用  清除el-upload中上传的文件