Parcourir la source

项目登记附件类型验证

sangwenwei il y a 4 mois
Parent
commit
d3c32222b7

+ 18 - 2
src/views/common/UpLoadComponent.vue

@@ -72,6 +72,7 @@
     fileName,
     // eslint-disable-next-line no-unused-vars
     beforeAvatarUpload,
+	  exnameFix,
     // eslint-disable-next-line no-unused-vars
     openWindowOnUrl,
     // eslint-disable-next-line no-unused-vars
@@ -102,7 +103,8 @@
         createBy: '',
         showDivider: true,
         loading: false,
-        dataListLength: ''
+        dataListLength: '',
+		  fileType:''
       }
     },
     watch: {
@@ -160,8 +162,9 @@
        * @param showDivider  ‘附件‘Divider是否展示
        *    注:值为空时,默认值为true
        *    showDivider=false时 ‘附件‘Divider隐藏
+	   * @param fileType 附件类型
        */
-      async newUpload (auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider) {
+      async newUpload (auth, fileList, directory, maxValue, dividerName, uploadFlag, delFlag, showDivider,fileType) {
         await this.fileLoadingFalse()
         if (this.commonJS.isEmpty(fileList)) {
           this.fileLoading = true
@@ -203,6 +206,11 @@
             this.delFlag = delFlag
           }
         }
+		  if (this.commonJS.isEmpty(fileType)){
+			  this.fileType = ''
+		  }else {
+			  this.fileType = fileType
+		  }
         for await (let item of fileList) {
           await this.ossService.getFileSizeByUrl(item.url).then((data) => {
             item.lsUrl = data.url
@@ -262,6 +270,14 @@
         }
       },
 		async changes (file, fileList) {
+			if (!exnameFix(file, '1', this.fileType)) {
+				for (let i = 0; i <fileList.length ; i++) {
+					this.deleteById(fileList[i],i,this.dataListNew)
+				}
+				this.fileList = []
+				this.dataListNew = []
+				return
+			}
 			// if (file.status !== 'ready') {
 			//   return
 			// }

+ 4 - 4
src/views/cw/reportManagement/ProjectRecordsInfoForm.vue

@@ -1503,7 +1503,7 @@
 										type="primary"
 										size="small"
 										:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-										@click="openFileForm(scope.row.id,this.inputForm4.id)"
+										@click="openFileForm(scope.row)"
 									>编辑</el-button>
 									<el-button
 										v-if="scope.row.levelFlag === 3"
@@ -3177,9 +3177,9 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			console.log('this.id', id )
-			this.$refs.fileForm.init("add", id,this.inputForm4.projectId)
+		openFileForm(row){
+			console.log('this.id', row.id )
+			this.$refs.fileForm.init("add", row.id,this.inputForm4.projectId,row.type)
 		},
 		toHref (row) {
 			console.log("toHref",row)

+ 3 - 3
src/views/cw/reportManagement/ReportManagementFormNew.vue

@@ -458,7 +458,7 @@
 									type="primary"
 									size="small"
 									:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-									@click="openFileForm(scope.row.id,this.inputForm.id)"
+									@click="openFileForm(scope.row)"
 								>编辑</el-button>
 								<el-button
 									v-if="scope.row.levelFlag === 3"
@@ -1023,8 +1023,8 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+		openFileForm(row){
+			this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 		},
 		toHref (row) {
 			toHref(row)

+ 3 - 3
src/views/cw/reportManagement/ReportManagementFormNew1.vue

@@ -340,7 +340,7 @@
 									type="primary"
 									size="small"
 									:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-									@click="openFileForm(scope.row.id,this.inputForm.id)"
+									@click="openFileForm(scope.row)"
 								>编辑</el-button>
 								<el-button
 									v-if="scope.row.levelFlag === 3"
@@ -905,8 +905,8 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+		openFileForm(row){
+			this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 		},
 		toHref (row) {
 			toHref(row)

+ 3 - 3
src/views/cw/reportManagement/ReportManagementFormNew2.vue

@@ -456,7 +456,7 @@
 									type="primary"
 									size="small"
 									:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-									@click="openFileForm(scope.row.id,this.inputForm.id)"
+									@click="openFileForm(scope.row)"
 								>编辑</el-button>
 								<el-button
 									v-if="scope.row.levelFlag === 3"
@@ -1024,8 +1024,8 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+		openFileForm(row){
+			this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 		},
 		toHref (row) {
 			toHref(row)

+ 3 - 3
src/views/cw/reportManagement/ReportManagementFormNew3.vue

@@ -420,7 +420,7 @@
 									type="primary"
 									size="small"
 									:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-									@click="openFileForm(scope.row.id,this.inputForm.id)"
+									@click="openFileForm(scope.row)"
 								>编辑</el-button>
 								<el-button
 									v-if="scope.row.levelFlag === 3"
@@ -985,8 +985,8 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+		openFileForm(row){
+			this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 		},
 		toHref (row) {
 			toHref(row)

+ 4 - 4
src/views/cw/reportManagement/onlineArchiving/ReportOnlineArchiving.vue

@@ -165,7 +165,7 @@
 										type="primary"
 										size="small"
 										:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-										@click="openFileForm(scope.row.id,this.inputForm.id)"
+										@click="openFileForm(scope.row)"
 									>编辑</el-button>
 									<el-button
 										v-if="scope.row.levelFlag === 3"
@@ -615,9 +615,9 @@
 				}
 			},
 			//测试按钮
-			openFileForm(id,typeId){
-				console.log('this.id', id )
-				this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+			openFileForm(row){
+				console.log('this.id', row.id )
+				this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 			},
 			toHref (row) {
 				console.log("toHref",row)

+ 2 - 2
src/views/cw/reportManagement/reportReview/FileForm.vue

@@ -64,7 +64,7 @@
         this.url = ''
         this.showViewer = false
       },
-      async init (method, id,projectId) {
+      async init (method, id,projectId,fileType) {
       	console.log('id', id )
       	console.log('projectId', projectId )
       	this.attachmentId = id
@@ -92,7 +92,7 @@
 		  this.$nextTick(() => {
           // this.$refs.upload.clearFiles()
           this.$refs.inputForm.resetFields()
-            this.$refs.uploadComponent.newUpload(method, this.dataList, 'workClient', 300)
+            this.$refs.uploadComponent.newUpload(method, this.dataList, 'workClient', 300,'附件',false,false,true,fileType)
           this.loading = false
         })
       },

+ 4 - 4
src/views/cw/reportManagement/reportReview/ReportReviewForm.vue

@@ -534,7 +534,7 @@
 								  type="primary"
 								  size="small"
 								  :disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-								  @click="openFileForm(scope.row.id,this.inputForm.id)"
+								  @click="openFileForm(scope.row)"
 							  >编辑</el-button>
 							  <el-button
 								  v-if="scope.row.levelFlag === 3"
@@ -1489,9 +1489,9 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			console.log('this.id', id )
-			this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+		openFileForm(row){
+			console.log('this.id', row.id )
+			this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 		},
 		toHref (row) {
 			console.log("toHref",row)

+ 4 - 4
src/views/cw/reportManagement/reportReview/ReportReviewForm2.vue

@@ -417,7 +417,7 @@
 								  type="primary"
 								  size="small"
 								  :disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-								  @click="openFileForm(scope.row.id,this.inputForm.id)"
+								  @click="openFileForm(scope.row)"
 							  >编辑</el-button>
 							  <el-button
 								  v-if="scope.row.levelFlag === 3"
@@ -1272,9 +1272,9 @@
 			}
 		},
 		//测试按钮
-		openFileForm(id,typeId){
-			console.log('this.id', id )
-			this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+		openFileForm(row){
+			console.log('this.id', row.id )
+			this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 		},
 		toHref (row) {
 			console.log("toHref",row)

+ 4 - 4
src/views/cw/reportManagement/signAndIssue/ReportSignAndIssue.vue

@@ -327,7 +327,7 @@
 										type="primary"
 										size="small"
 										:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
-										@click="openFileForm(scope.row.id,this.inputForm.id)"
+										@click="openFileForm(scope.row)"
 									>编辑</el-button>
 									<el-button
 										v-if="scope.row.levelFlag === 3"
@@ -949,9 +949,9 @@
 				}
 			},
 			//测试按钮
-			openFileForm(id,typeId){
-				console.log('this.id', id )
-				this.$refs.fileForm.init("add", id,this.inputForm.projectId)
+			openFileForm(row){
+				console.log('this.id', row.id )
+				this.$refs.fileForm.init("add", row.id,this.inputForm.projectId,row.type)
 			},
 			toHref (row) {
 				console.log("toHref",row)