Procházet zdrojové kódy

crm_8.7 用印审批,支持上传多个附件,显示合同来源

hbchen před 2 roky
rodič
revize
bd59dbe9fb

+ 1 - 1
api/approve/seal.js

@@ -19,7 +19,7 @@ export const apiFlowDetail=params=>{
  * @param {string} CompanyName 客户名称,甲方名称
  * @param {int}  ContractId	系统合同id
  * @param {int}  CreditCode	社会统一信用代码
- * @param {string}  FileUrl	文件附件地址
+ * @param {string}  FileUrls	文件附件地址数据 crm_8.7 支持上传多个附件
  * @param {int}		FileNum	文件份数
  * @param {string}  Remark 备注
  * @param {string} SealType 加盖印章类型,枚举值:'合同章', '公章', '法人章'

+ 30 - 20
pages-approve/seal/addSeal.vue

@@ -85,10 +85,14 @@
 		</view>
 		<view class="section white-wrap" v-if="radioVal==='上传附件'">
 			<view class="section-title require">附件上传</view>
-			<div class="check-file-box" :style="'background-image:url('+file.img+')'" v-if="file.url" @click="handlePreviewFiles(file)">
-				<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile"></image>
+			<div class="check-file-contain">
+				<image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" 
+				style="width: 102rpx;height: 120rpx;margin: 0 16rpx 24rpx 16rpx;"></image>
+				<div class="check-file-box" :style="'background-image:url('+item.img+')'"
+				@click="handlePreviewFiles(item)" v-for="(item,index) in fileList" :key="item.url">
+					<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile(item)"></image>
+				</div>
 			</div>
-			<image v-else @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;"></image>
 		</view>
 		
 		<!-- 流程模块 -->
@@ -217,18 +221,18 @@
 			
 			// 提交申请
 			async handleSubmit(){
-				let fileUrl=''
+				let fileUrls=''
 				if(this.radioVal==='系统合同'){
-					fileUrl=this.ContractfileUrl
+					fileUrls=[this.ContractfileUrl]
 				}else{
-					fileUrl=this.file.url
+					fileUrls=this.fileList.map(item => item.url)
 				}
 				
 				let params={
 					CompanyName:this.customeName,
 					ContractId:this.ContractId,
 					CreditCode:this.CreditCode,
-					FileUrl:fileUrl,
+					FileUrls:fileUrls,
 					FileNum:Number(this.fileNum),
 					Remark:this.remark,
 					SealType:this.type.join(','),
@@ -286,7 +290,7 @@
 					})
 					return
 				}
-				if(!params.FileUrl){
+				if(!params.FileUrls){
 					uni.showToast({
 						title:'请上传文件',
 						icon:"none"
@@ -329,21 +333,27 @@
 </script>
 
 <style lang="scss">
-	.check-file-box{
-		width: 102rpx;
-		height: 120rpx;
-		background-size: cover;
-		background-position: center;
-		position: relative;
-		.del-icon{
-			position: absolute;
-			width: 30rpx;
-			height: 30rpx;
-			top: -15rpx;
-			right: -15rpx;
+	.check-file-contain{
+		display: flex;
+		flex-wrap: wrap;
+		.check-file-box{
+			width: 102rpx;
+			height: 120rpx;
+			background-size: cover;
+			background-position: center;
+			position: relative;
+			margin: 0 16rpx;
+			.del-icon{
+				position: absolute;
+				width: 30rpx;
+				height: 30rpx;
+				top: -15rpx;
+				right: -15rpx;
+			}
 		}
 	}
 
+
 	.add-page{
 		width: 100%;
 		min-height: 100vh;

+ 93 - 73
pages-approve/seal/detail.vue

@@ -30,21 +30,27 @@
 			<view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:typeLength?'#333':'#999'}" @click="handleOperation('showType')">{{newSealType.length>0?newSealType.join(','):'请选择'}}</view>
 		</view>
 		<view class="section white-wrap" v-if="detail.ContractId>0">
-			<view class="section-title require">合同附件</view>
+			<view class="section-title require">合同附件<span>(合同来源:系统合同)</span> </view>
 			<image 
-				:src="files.img" 
+				:src="fileList[0].img" 
 				mode="aspectFill" 
 				style="width: 102rpx;height: 120rpx" 
-				@click="handlepreViewFile(files)">
+				@click="handlepreViewFile(fileList[0])">
 			</image>
 		</view>
 		<view class="section white-wrap" v-else>
-			<view class="section-title require">合同附件</view>
+			<view class="section-title require">合同附件<span>(合同来源:上传附件)</span></view>
 			<!-- 合规可修改上传 -->
-			<div class="check-file-box" :style="'background-image:url('+files.img+')'" v-if="files.url" @click="handlepreViewFile(files)">
-				<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile" v-if="opButton.CheckEdit"></image>
+			<!-- crm_8.7 支持上传多个附件 -->
+			<div class="check-file-contain">
+				<image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" 
+				style="width: 102rpx;height: 120rpx;margin: 0 16rpx 24rpx 16rpx;"></image>
+				<div class="check-file-box" :style="'background-image:url('+item.img+')'"
+				@click="handlepreViewFile(item)" v-for="(item,index) in fileList" :key="item.url">
+					<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile(item)"></image>
+				</div>
 			</div>
-			<image v-else @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;"></image>
+			
 		</view>
 		<view class="section white-wrap" v-if="detail.Status==='已驳回'">
 			<view class="section-title">驳回理由</view>
@@ -251,12 +257,13 @@
 				processData:null,
 				detail:{},
 				opButton:{},
-				files:{
-					type:'',
-					img:'',
-					url:''
-				},//合同附件
-				
+				// files:{
+				// 	type:'',
+				// 	img:'',
+				// 	url:''
+				// },//合同附件
+				// 上传的附件列表 需求更改,可上传多个附件 crm-8.7
+				fileList:[],
 				showPurpose:false,//显示用印用途选项
 				purposeArr: ["销售合同", "代付合同", "总对总协议", "渠道合同", "付款通知函", "招投标", "战略合作协议"],
 
@@ -434,37 +441,33 @@
 			},
 
 			// 合规删除合同附件
-			handleDeleteCheckFile(){
-				this.files={
-					type:'',
-					img:'',
-					url:''
-				}
+			handleDeleteCheckFile(file){
+				this.fileList = this.fileList.filter(item => item.url!= file.url)
 			},
 
 			//合规上传附件
 			async handleUpload(){
 				const res=await uploadFiles({type:'all'})
 				const reg = /\.(pdf)$/;
-				const reg2=	/\.doc|\.docx$/
-				if(reg.test(res[0])){
-					this.files={
-						type:'pdf',
-						url:res[0],
-						img:require('../static/pdf.png')
-					}
-				}else if(reg2.test(res[0])){
-					this.files={
-						type:'word',
-						url:res[0],
-						img:require('../static/word.png')
-					}
-				}else{
-					this.files={
-						type:'img',
-						url:res[0],
-						img:res[0]
-					}
+				const reg2 = /\.doc|\.docx$/;
+				if (reg.test(res[0])) {
+					this.fileList.push({
+						type: "pdf",
+						url: res[0],
+						img: require("../static/pdf.png"),
+					});
+				} else if (reg2.test(res[0])) {
+					this.fileList.push({
+						type: "word",
+						url: res[0],
+						img: require("../static/word.png"),
+					});
+				} else {
+					this.fileList.push({
+						type: "img",
+						url: res[0],
+						img: res[0],
+					});
 				}
 			},
 
@@ -548,7 +551,7 @@
 				// const flag3=this.newSealType.join(',')===this.detail.SealType
 				const flag3=this.isArrEqual(this.newSealType,this.detail.SealType.split(','))
 				const flag4=this.newRemark===this.detail.Remark
-				const flag5=this.files.url===this.detail.FileUrl
+				const flag5= JSON.stringify(this.fileList.map(file => file.url))===JSON.stringify(this.detail.FileUrls)
 				if(flag1&&flag2&&flag3&&flag4&&flag5){
 					this.handleApprovalPass()
 				}else{
@@ -591,7 +594,7 @@
 					})
 					return
 				}
-				if(!this.files.url){
+				if(!this.fileList || this.fileList.length==0){
 					uni.showToast({
 						title:'合同附件不能为空',
 						icon:"none"
@@ -604,7 +607,7 @@
 					SealId:Number(this.detail.SealId),
 					SealType:this.newSealType.join(','),
 					Use:this.newUse,
-					FileUrl:this.files.url
+					FileUrls:this.fileList.map(file => file.url)
 				})
 				if(res.code===200){
 					this.$dialog.alert({
@@ -748,33 +751,37 @@
 					this.newRemark=res.data.SealDetail.Remark
 					this.processData=res.data.FlowNodeList
 					this.opButton=res.data.OpButton
-					this.handleFile(res.data.SealDetail.FileUrl)
+					this.handleFile(res.data.SealDetail.FileUrls)
 				}
 			},
 			
 			//处理文件
-			handleFile(filesUrl){
+			handleFile(filesUrls){
+				// 清空 防止操作成功后再获取详情 数组叠加
+				this.fileList=[]
 				const reg = /\.(pdf)$/;
 				const reg2=	/\.doc|\.docx$/
-				if(reg.test(filesUrl)){
-					this.files={
-						type: "pdf",
-						url: filesUrl,
-						img: require("../static/pdf.png"),
-					}
-				}else if(reg2.test(filesUrl)){
-					this.files={
-						type: "word",
-						url: filesUrl,
-						img: require("../static/word.png"),
-					}
-				}else{
-					this.files={
-						type: "img",
-						url: filesUrl,
-						img: filesUrl,
+				filesUrls.map(filesUrl=>{
+					if(reg.test(filesUrl)){
+						this.fileList.push({
+							type: "pdf",
+							url: filesUrl,
+							img: require("../static/pdf.png"),
+						})
+					}else if(reg2.test(filesUrl)){
+						this.fileList.push({
+							type: "word",
+							url: filesUrl,
+							img: require("../static/word.png"),
+						})
+					}else{
+						this.fileList.push({
+							type: "img",
+							url: filesUrl,
+							img: filesUrl,
+						})
 					}
-				}
+				})
 			},
 		},
 	}
@@ -811,18 +818,23 @@
 			}
 		}
 	}
-	.check-file-box{
-		width: 102rpx;
-		height: 120rpx;
-		background-size: cover;
-		background-position: center;
-		position: relative;
-		.del-icon{
-			position: absolute;
-			width: 30rpx;
-			height: 30rpx;
-			top: -15rpx;
-			right: -15rpx;
+	.check-file-contain{
+		display: flex;
+		flex-wrap: wrap;
+		.check-file-box{
+			width: 102rpx;
+			height: 120rpx;
+			background-size: cover;
+			background-position: center;
+			position: relative;
+			margin: 0 16rpx;
+			.del-icon{
+				position: absolute;
+				width: 30rpx;
+				height: 30rpx;
+				top: -15rpx;
+				right: -15rpx;
+			}
 		}
 	}
 	.detail{
@@ -847,6 +859,14 @@
 		.section-title{
 			font-size: 16px;
 			margin-bottom: 20rpx;
+			span{
+				font-size: 28rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				font-weight: 400;
+				color: #999999;
+				-webkit-background-clip: text;
+				background-clip: text;
+			}
 		}
 		.require::before{
 			content: '*';

+ 52 - 42
pages-approve/seal/edit.vue

@@ -72,18 +72,21 @@
 			<view class="section-title">备注</view>
 			<textarea type="text" auto-height v-model="remark" placeholder="请填写备注"></textarea>
 		</view>
-		<view class="section white-wrap" v-if="radioVal==='系统合同'&&file">
+		<view class="section white-wrap" v-if="radioVal==='系统合同'&& fileList &&fileList.length>0">
 			<view class="section-title require">合同附件</view>
-			<image src="../static/pdf.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;" @click="handlePreviewFiles(file)"></image>
+			<image src="../static/pdf.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;" @click="handlePreviewFiles(fileList[0])"></image>
 		</view>
 		<view class="section white-wrap" v-if="radioVal==='上传附件'">
 			<view class="section-title require">附件上传</view>
-			<!-- <image :src="img" mode="aspectFill" style="width: 102rpx;height: 120rpx;margin:0 10rpx 10rpx 0" v-for="img in fileUrlArr" :key="img"></image>
-			<image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;margin:0 10rpx 10rpx 0"></image> -->
-			<div class="check-file-box" :style="'background-image:url('+file.img+')'" v-if="file.url" @click="handlePreviewFiles(file)">
-				<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile"></image>
+			<!-- crm_8.7 支持上传多个附件 -->
+			<div class="check-file-contain">
+				<image @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" 
+				style="width: 102rpx;height: 120rpx;margin: 0 16rpx 24rpx 16rpx;"></image>
+				<div class="check-file-box" :style="'background-image:url('+item.img+')'"
+				@click="handlePreviewFiles(item)" v-for="(item,index) in fileList" :key="item.url">
+					<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile(item)"></image>
+				</div>
 			</div>
-			<image v-else @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;"></image>
 		</view>
 		
 		<!-- 流程模块 -->
@@ -214,35 +217,37 @@
 					this.CreditCode=res.data.SealDetail.CreditCode
 					this.UseCompanyName=res.data.SealDetail.UseCompanyName
 					// this.ContractfileUrl=res.data.SealDetail.FileUrl
-					this.handleFile(res.data.SealDetail.FileUrl)
+					this.handleFile(res.data.SealDetail.FileUrls)
 					this.ContractId=res.data.SealDetail.ContractId
 					this.getProcessData()
 				}
 			},
 
 			//处理文件
-			handleFile(filesUrl){
+			handleFile(filesUrls){
 				const reg = /\.(pdf)$/;
 				const reg2=	/\.doc|\.docx$/
-				if(reg.test(filesUrl)){
-					this.file={
-						type: "pdf",
-						url: filesUrl,
-						img: require("../static/pdf.png"),
-					}
-				}else if(reg2.test(filesUrl)){
-					this.file={
-						type: "word",
-						url: filesUrl,
-						img: require("../static/word.png"),
-					}
-				}else{
-					this.file={
-						type: "img",
-						url: filesUrl,
-						img: filesUrl,
+				filesUrls.map(filesUrl=>{
+					if(reg.test(filesUrl)){
+						this.fileList.push({
+							type: "pdf",
+							url: filesUrl,
+							img: require("../static/pdf.png"),
+						})
+					}else if(reg2.test(filesUrl)){
+						this.fileList.push({
+							type: "word",
+							url: filesUrl,
+							img: require("../static/word.png"),
+						})
+					}else{
+						this.fileList.push({
+							type: "img",
+							url: filesUrl,
+							img: filesUrl,
+						})
 					}
-				}
+				})
 			},
 			
 			// 选择合同 更新表单数据
@@ -254,7 +259,7 @@
 				this.UseCompanyName=e.ContractBusinessType=='代付合同'?e.UseCompanyName:e.CompanyName
 				this.ContractId=e.ContractId
 				// this.ContractfileUrl=e.FileUrl
-				this.handleFile(e.FileUrl)
+				this.handleFile([e.FileUrl])
 				// 关闭搜索弹窗
 				this.showCustome=false
 				this.searchCustomeVal=''
@@ -269,7 +274,7 @@
 					CompanyName:this.customeName,
 					ContractId:this.ContractId,
 					CreditCode:this.CreditCode,
-					FileUrl:this.file.url,
+					FileUrls:this.fileList.map(file => file.url),
 					FileNum:Number(this.fileNum),
 					Remark:this.remark,
 					SealType:this.type.join(','),
@@ -328,7 +333,7 @@
 					})
 					return
 				}
-				if(!params.FileUrl){
+				if(!params.FileUrls){
 					uni.showToast({
 						title:'请上传文件',
 						icon:"none"
@@ -365,18 +370,23 @@
 </script>
 
 <style lang="scss">
-	.check-file-box{
-		width: 102rpx;
-		height: 120rpx;
-		background-size: cover;
-		background-position: center;
-		position: relative;
-		.del-icon{
-			position: absolute;
-			width: 30rpx;
-			height: 30rpx;
-			top: -15rpx;
-			right: -15rpx;
+	.check-file-contain{
+		display: flex;
+		flex-wrap: wrap;
+		.check-file-box{
+			width: 102rpx;
+			height: 120rpx;
+			background-size: cover;
+			background-position: center;
+			position: relative;
+			margin: 0 16rpx;
+			.del-icon{
+				position: absolute;
+				width: 30rpx;
+				height: 30rpx;
+				top: -15rpx;
+				right: -15rpx;
+			}
 		}
 	}
 	.add-page{

+ 15 - 18
pages-approve/seal/mixin.js

@@ -49,12 +49,13 @@ export const sealMixin = {
             UseCompanyName: "", //实际使用方客户名称
             ContractId: 0, //合同id
 
-            file: {
-                type: "",
-                img: "",
-                url: "",
-            }, //上传附件 文件
-
+            // file: {
+            //     type: "",
+            //     img: "",
+            //     url: "",
+            // }, //上传附件 文件
+			// 上传的附件列表 需求更改,可上传多个附件 crm-8.7
+			fileList:[],
             processData: null, //流程数据
 
             radioVal: "系统合同",
@@ -75,12 +76,8 @@ export const sealMixin = {
     },
     methods: {
         //删除上传的附件
-        handleDeleteCheckFile() {
-            this.file = {
-                type: "",
-                img: "",
-                url: "",
-            };
+        handleDeleteCheckFile(file) {
+			this.fileList = this.fileList.filter(item => item.url!= file.url)
         },
 
         //预览文件
@@ -100,23 +97,23 @@ export const sealMixin = {
             const reg = /\.(pdf)$/;
             const reg2 = /\.doc|\.docx$/;
             if (reg.test(res[0])) {
-                this.file = {
+                this.fileList.push({
                     type: "pdf",
                     url: res[0],
                     img: require("../static/pdf.png"),
-                };
+                });
             } else if (reg2.test(res[0])) {
-                this.file = {
+                this.fileList.push({
                     type: "word",
                     url: res[0],
                     img: require("../static/word.png"),
-                };
+                });
             } else {
-                this.file = {
+                this.fileList.push({
                     type: "img",
                     url: res[0],
                     img: res[0],
-                };
+                });
             }
         },