Browse Source

新增图片+文件传;列表来文字号

yin_yu820 10 months ago
parent
commit
87b01ff97c

+ 1 - 1
jp-console/jeeplus-modules/gw/src/main/java/com/jeeplus/circulation2/mapper/xml/GwCirculationCard2Mapper.xml

@@ -7,7 +7,7 @@
 		a.year_num AS "yearNum",
 		a.card_num AS "cardNum",
 		a.sending_agency AS "sendingAgency",
-        a.doc_font_size AS "docFontFize",
+        a.doc_font_size AS "docFontSize",
         a.file_source AS "fileSource",
         a.written_time AS "writtenTime",
         a.receiving_time AS "receivingTime",

+ 60 - 2
jp-ui/src/views/circulation2/GwCirculationCard2Form.vue

@@ -74,12 +74,40 @@
            </el-form-item>
         </el-col>
         <el-col :span="24">
-            <el-form-item label="来文附件" prop="attachedDocumentId"
+            <el-form-item label="来文附件图片" prop="attachedDocumentId"
                 :rules="[
                  ]">
-	            <image-upload v-model="inputForm.attachedDocumentId" :limit="3" tip="最多上传3个图片,单个图片不要超过10M"></image-upload>
+	            <image-upload v-model="inputForm.attachedDocumentId" :limit="10" tip="最多上传10个图片,单个图片不要超过10M"></image-upload>
            </el-form-item>
         </el-col>
+		<el-col :span="24">
+		    <el-form-item label="来文附件文件" prop="attachedDocumentId2"
+		        :rules="[
+		         ]">
+				<el-upload ref="attachedDocumentId2"
+				class="upload-demo"
+		         :action="`${this.$http.BASE_URL}/gwfile/upload?uploadPath=userdir`"
+		         :on-preview="(file, fileList) => {$window.location.href = (file.response && file.response.url) || file.url}"
+		         :on-success="handleSuccess"
+		         :on-remove="handleRemove"
+		         :before-remove="(file, fileList) => {
+		           return $confirm(`确定移除 ${file.name}?`)
+		         }"
+		         multiple
+		         :limit="10"
+		         :on-exceed="(files, fileList) =>{
+		           $message.warning(`当前限制选择 10 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
+		         }"
+		         :file-list="uploadfilesArra">
+		         <el-button size="small" type="primary">点击上传</el-button>
+				 <template #tip>
+				   <div class="el-upload__tip" style="min-width: 255px;">
+				   </div>
+				 </template>
+		       </el-upload>
+
+		   </el-form-item>
+		</el-col>
         <!-- <el-col :span="12">
             <el-form-item label="备注" prop="remark"
                 :rules="[
@@ -122,6 +150,7 @@
         visible: false,
         loading: false,
 		cardNum: "",
+		uploadfilesArra: [],
         inputForm: {
           id: '',
           yearNum: '',
@@ -133,6 +162,7 @@
           receivingTime: '',
           contentSummary: '',
           attachedDocumentId: '',
+		  attachedDocumentId2: '',
           remark: '',
           state: ''
         }
@@ -183,6 +213,26 @@
 
         })
       },
+
+
+	  handleSuccess(res) {
+		if(this.inputForm.attachedDocumentId2==''){
+			this.inputForm.attachedDocumentId2 = res;
+		}else{
+			this.inputForm.attachedDocumentId2 = this.inputForm.attachedDocumentId2+","+res;
+		}
+	  },
+
+	  handleRemove(res) {
+		  if(this.inputForm.attachedDocumentId2.indexOf(res.response+",")!=-1){
+			this.inputForm.attachedDocumentId2=this.inputForm.attachedDocumentId2.replace(res.response+",","")
+		  }else if(this.inputForm.attachedDocumentId2.indexOf(","+res.response)!=-1){
+			this.inputForm.attachedDocumentId2=this.inputForm.attachedDocumentId2.replace(","+res.response,"")
+		  }else{
+			this.inputForm.attachedDocumentId2=this.inputForm.attachedDocumentId2.replace(res.response,"")
+		  }
+	  },
+
       // 表单提交
       doSubmit () {
         this.$refs['inputForm'].validate((valid) => {
@@ -191,6 +241,14 @@
 			this.inputForm.writtenTime = this.inputForm.writtenTime + " 00:00:00";
 			this.inputForm.receivingTime = this.inputForm.receivingTime + " 00:00:00";
 			this.inputForm.cardNum = this.cardNum
+
+			//文件和图片文件合并
+			if(this.inputForm.attachedDocumentId2!=''){
+				this.inputForm.attachedDocumentId=this.inputForm.attachedDocumentId+","+this.inputForm.attachedDocumentId2;
+			}
+
+			console.log("图片:"+this.uploadfilesArra);
+
             gwCirculationCard2Service.save(this.inputForm).then((data) => {
               this.visible = false
               this.$message.success(data)

+ 45 - 3
jp-ui/src/views/circulation2/fileCard.vue

@@ -125,8 +125,21 @@
 						<!-- <a :href="item.url">{{item.name}}</a> -->
 					</view>
 				</view>
-				<image-upload v-model="inputForm.attachedDocumentId" :limit="3"
-					tip="最多上传3个图片,单个图片不要超过10M"></image-upload>
+				<el-upload ref="imgList"
+								class="upload-demo"
+				  disabled
+				  :on-preview="(file, fileList) => {$window.location.href = (file.response && file.response.url) || file.url}"
+
+				  multiple
+				  :limit="20"
+
+				  :file-list="imgList">
+				 <template #tip>
+				   <div class="el-upload__tip" style="min-width: 255px;">
+				   </div>
+				 </template>
+				</el-upload>
+				<image-upload v-model="inputForm.attachedDocumentId" :limit="20" disabled ></image-upload>
 			</view>
 
 
@@ -179,7 +192,8 @@ export default {
 				writtenTime: '',
 				receivingTime: '',
 				contentSummary: '',
-				attachedDocumentId: ''
+				attachedDocumentId: '',
+				attachedDocumentId2: ''
 			},
 			gwflow: {
 				id: '',
@@ -263,10 +277,38 @@ export default {
 			}
 		},
 
+		// 使用正则表达式判断文件名或URL是否为图片格式
+		isImageFormat(filename) {
+			const imageFormats = /\.(jpeg|jpg|gif|png|bmp|svg)$/i;
+			return imageFormats.test(filename);
+		},
+
 		refresh() {
 			gwCirculationCard2Service.queryById(this.gwId).then(data => {
 				this.inputForm = data
 				this.inputForm.receivingTime = this.inputForm.receivingTime.substring(5, 10)
+				//处理图片
+				let aastr=this.inputForm.attachedDocumentId.split(",");
+				let imgstr="";
+				let filestr=[];
+
+				aastr.forEach(item => {
+					if (this.isImageFormat(item)) {
+						if(imgstr==''){
+							imgstr=item
+						}else{
+							imgstr=imgstr+","+item
+						}
+					}else{
+						let as={};
+						let s1=item.split("name=");
+						as.name=s1[1];
+						as.url=this.$http.BASE_URL+item
+						filestr.push(as)
+					}
+				})
+				this.inputForm.attachedDocumentId=imgstr;
+				this.imgList=filestr;
 
 			})
 			gwFlowService.queryByGwId(this.gwId).then(data => {