Browse Source

用印列表增加已签回、详情增加上传签回附件功能

jwyu 3 years ago
parent
commit
185f563f91
4 changed files with 161 additions and 18 deletions
  1. 9 0
      api/approve/seal.js
  2. 10 10
      pages-approve/contract/detail.vue
  3. 140 7
      pages-approve/seal/detail.vue
  4. 2 1
      pages-approve/seal/list.vue

+ 9 - 0
api/approve/seal.js

@@ -124,4 +124,13 @@ export const apiSealCancelApply=params=>{
  */
 export const apiSealList=params=>{
 	return httpGet('/seal/list',params)
+}
+
+/** 
+ * 上传用印签回附件
+ * @param {int}  SealId 用印id
+ * @param {string}  FileUrl  文件地址 多个用#隔开
+ */
+export const apiSealCheckBackFiles=params=>{
+	return httpPost('/seal/upload_check_back_file',params)
 }

+ 10 - 10
pages-approve/contract/detail.vue

@@ -154,7 +154,7 @@
 			</view>
 		</van-popup>
 		
-		<!-- 上传回签附件弹窗 -->
+		<!-- 上传回签附件弹窗确认弹窗 -->
 		<van-popup :show="showUpload" @close="showUpload=false" position="bottom" round>
 			<view class="uploadfile-wrap">
 				<view style="text-align: center;font-size: 16px;font-weight: bold;">上传回签附件</view>
@@ -605,18 +605,18 @@
 
 	.variety-list{
 		.variety-item {
-			padding-top: 24rpx;
-			padding-bottom: 24rpx;
-			border-bottom: 1px dashed rgba(112, 112, 112, 0.2);
+			// padding-top: 24rpx;
+			padding-bottom: 20rpx;
+			// border-bottom: 1px dashed rgba(97, 97, 97, 0.2);
 		}
 
-		.variety-item:first-child {
-			padding-top: 0;
-		}
+		// .variety-item:first-child {
+		// 	padding-top: 0;
+		// }
 
-		.variety-item:last-child {
-			border-bottom: none;
-		}
+		// .variety-item:last-child {
+		// 	border-bottom: none;
+		// }
 
 		.tag {
 			margin-right: 10rpx;

+ 140 - 7
pages-approve/seal/detail.vue

@@ -54,6 +54,18 @@
 			<view class="section-title">备注</view>
 			<textarea type="text" auto-height v-model="oldRemark" placeholder="请填写备注" :disabled="!opButton.CheckEdit"></textarea>
 		</view>
+		<!-- 签回附件模块 -->
+		<view class="section white-wrap" v-if="checkBackFilesRes.length>0">
+			<view class="section-title">签回附件</view>
+			<image 
+				v-for="item in checkBackFilesRes"
+				:key="item.url"
+				:src="item.img" 
+				mode="aspectFill" 
+				style="width: 102rpx;height: 120rpx" 
+				@click="handlepreViewFile(item)">
+			</image>
+		</view>
 		<!-- 流程模块 -->
 		<view class="section white-wrap process-wrap">
 			<view class="title" style="font-size: 16px;font-weight: bold;">审批流程</view>
@@ -62,16 +74,19 @@
 		
 		<!-- 审批/撤回申请 -->
 		<view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Approval||opButton.Cancel">
-			<div class="flex" style="justify-content: space-between;width:100%">
+			<view class="flex" style="justify-content: space-between;width:100%">
 				<van-button type="info" color="#3385FF" style="flex:1;" custom-class="btn-small" round @click="handleClickPass" v-if="opButton.Approval">通过</van-button>
 				<van-button type="info" color="#F55768" style="flex:1;" custom-class="btn-small" round @click="handleApprovalReject" v-if="opButton.Approval">驳回</van-button>
 				<van-button type="info" color="#F55768" style="flex:1;" :custom-class="opButton.Approval?'btn-small':'btn-big'" round @click="handleCancelApply" v-if="opButton.Cancel">撤回申请</van-button>
-			</div>
+			</view>
 		</view>
 		<!-- 作废 -->
-		<view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Invalid">
-			<view v-if="detail.ContractId>0" style="margin-bottom: 10rpx;" @click="checked=!checked"><radio value="同时作废合同" :checked="checked" color="#3385FF" style="transform:scale(0.8)"/>是否同时作废合同?</view>
-			<van-button type="info" color="#F55768" custom-class="btn-big" round @click="handleSealInvalid">用印作废</van-button>
+		<view class="fix-bottom-wrap flex" style="text-align: center;align-items:flex-end" v-if="opButton.Invalid||opButton.UploadFile">
+			<view style="flex:1" v-if="opButton.Invalid">
+				<view v-if="detail.ContractId>0" style="margin-bottom: 10rpx;" @click="checked=!checked"><radio value="同时作废合同" :checked="checked" color="#3385FF" style="transform:scale(0.8)"/>是否同时作废合同?</view>
+				<van-button type="info" color="#F55768" :custom-class="opButton.UploadFile?'btn-small':'btn-big'" round @click="handleSealInvalid">用印作废</van-button>
+			</view>
+			<van-button v-if="opButton.UploadFile" style="flex:1" type="info" color="#3385FF" :custom-class="opButton.Invalid?'btn-small':'btn-big'" round @click="handleUploadCheckFile">{{checkBackFilesRes.length>0?'更新回签附件':'上传回签附件'}}</van-button>
 		</view>
 		<!-- 重新提交 -->
 		<view class="fix-bottom-wrap" style="text-align: center;" v-if="opButton.Edit">
@@ -133,6 +148,20 @@
 				</view>
 			</view>
 		</van-popup>
+
+		<!-- 上传回签附件弹窗确认弹窗 -->
+		<van-popup :show="showConfirmCheckBackfile" @close="showConfirmCheckBackfile=false" position="bottom" round>
+			<view class="uploadfile-wrap">
+				<view style="text-align: center;font-size: 16px;font-weight: bold;">上传回签附件</view>
+				<view class="contract-list" style="height: 30vh;">
+					<view class="contract-item" v-for="item in checkBackFiles" :key="item.url"
+						@click="handlepreViewFile(item)">
+						<image class="contract-img" mode="aspectFill" :src="item.img"></image>
+					</view>
+				</view>
+				<button style="width: 450rpx;" @click='handleConfirmCheckBackFile'>确定</button>
+			</view>
+		</van-popup>
 		
 		<van-dialog id="van-dialog" />
 	</view>
@@ -147,7 +176,8 @@
 		apiInvalidSeal,
 		apiApprovalPassModify,
 		apiSealCancelApply,
-		apiFlowDetail
+		apiFlowDetail,
+		apiSealCheckBackFiles
 		} from '@/api/approve/seal.js'
 	import steps from '../components/steps.vue'
 	import {preViewFile} from '../utils/util.js'
@@ -169,10 +199,32 @@
 				}else if(this.detail.Status==='已作废'){
 					return require('../static/cancel-icon.png')
 				}
-			}
+			},
+			//页面显示的回签附件
+			checkBackFilesRes(){
+				const reg = /\.(pdf)$/;
+				return this.detail&&this.detail.CheckBackFileUrl&&this.detail.CheckBackFileUrl.split("#").map((item) => {
+					if (reg.test(item)) {
+						return {
+							type: "pdf",
+							url: item,
+							img: require("@/pages-approve/static/pdf.png"),
+						};
+					} else {
+						return {
+							type: "word",
+							url: item,
+							img: require("@/pages-approve/static/word.png"),
+						};
+					}
+				});
+			},
 		},
 		data() {
 			return {
+				checkBackFiles:[],// 上传的签回附件文件
+				showConfirmCheckBackfile:false,//确认上传的签回附件弹窗
+
 				val:'',
 				ContractApprovalId:0,
 				ContractApprovalRecordId:0,
@@ -224,6 +276,57 @@
 			},1000)
 		},
 		methods: {
+			// 上传(更新)签回附件
+			async handleUploadCheckFile(){
+				const res=await uploadFiles({type:'file'})
+				const reg = /\.(pdf)$/;
+				const reg2=	/\.doc|\.docx$/
+				if(reg.test(res[0])){
+					this.checkBackFiles=[{
+						type:'pdf',
+						url:res[0],
+						img:require('../static/pdf.png')
+					}]
+					this.showConfirmCheckBackfile=true
+				}else if(reg2.test(res[0])){
+					this.checkBackFiles=[{
+						type:'word',
+						url:res[0],
+						img:require('../static/word.png')
+					}]
+					this.showConfirmCheckBackfile=true
+				}else{
+					uni.showToast({
+						title:'请上传pdf/word格式文件',
+						icon:"none"
+					})
+				}
+			},
+
+			//确认上传的签回附件
+			async handleConfirmCheckBackFile(){
+				let FileUrlarr=this.checkBackFiles.map(item=>item.url)
+				const res=await apiSealCheckBackFiles({
+					SealId:Number(this.detail.SealId),
+					FileUrl:FileUrlarr.join('#')
+				})
+				if(res.code===200){
+					uni.showToast({
+						title:'操作成功',
+						icon:'none'
+					})
+					// 如果是已审批上传回签附件则更新列表页
+					if(this.detail.Status==='已审批'){
+						this.handleUpdateList()
+					}
+					setTimeout(()=>{
+						this.checkBackFiles=[]
+						this.showConfirmCheckBackfile=false
+						this.getDetail()
+					},500)
+				}
+			},
+
 			// 更新列表页
 			handleUpdateList(){
 				uni.$emit('sealApproveListUpdate',{
@@ -567,6 +670,36 @@
 </script>
 
 <style lang="scss">
+	.uploadfile-wrap{
+		width: 100%;
+		height: 50vh;
+		background-color: #FFFFFF;
+		padding: 32rpx;
+		button {
+			margin-left: auto;
+			margin-right: auto;
+			width: 260rpx;
+			height: 70rpx;
+			display: block;
+			border-radius: 28px;
+			border: none;
+			font-size: 15px;
+			color: #fff;
+			line-height: 70rpx;
+			background-color: #5890fb;
+		}
+		.contract-list {
+			display: flex;
+			flex-wrap: wrap;
+		
+			.contract-img {
+				width: 102rpx;
+				height: 120rpx;
+				margin-right: 20rpx;
+				margin-bottom: 20rpx;
+			}
+		}
+	}
 	.check-file-box{
 		width: 102rpx;
 		height: 120rpx;

+ 2 - 1
pages-approve/seal/list.vue

@@ -44,7 +44,7 @@
 		},
 		data() {
 			return {
-				tabList:['待审批','处理中','已审批','其它'],
+				tabList:['待审批','处理中','已审批','已签回','其它'],
 				status: '待审批',
 				list:[],
 				page:1,
@@ -169,6 +169,7 @@
 								approveTime:item.ApproveTime,
 								backTime:item.ModifyTime,
 								cancelTime:item.InvalidTime,
+								checkBackTime:item.CheckBackFileTime,
 								status:item.Status,
 								applyType:item.SealType,
 								ContractApprovalId:item.ContractApprovalId||0,