Browse Source

修改待办消息

jwyu 3 years ago
parent
commit
5edc9d8fde

+ 45 - 26
pages-approve/seal/addSeal.vue

@@ -75,15 +75,10 @@
 		</view>
 		<view class="section white-wrap" v-if="radioVal==='上传附件'">
 			<view class="section-title require">附件上传</view>
-			<image 
-				:src="img.img" 
-				mode="aspectFill" 
-				style="width: 102rpx;height: 120rpx;margin:0 10rpx 10rpx 0" 
-				v-for="img in fileUrlArr" 
-				:key="img" 
-				@click="handlePreviewFiles(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.url+')'" v-if="file.url" @click="handlePreviewFiles(file)">
+				<image class="del-icon" src="../static/del-icon.png" @click.stop="handleDeleteCheckFile"></image>
+			</div>
+			<image v-else @click="handleUpload" src="../static/upload-icon.png" mode="aspectFill" style="width: 102rpx;height: 120rpx;"></image>
 		</view>
 		
 		<!-- 流程模块 -->
@@ -168,7 +163,7 @@
 <script>
 	import steps from '../components/steps.vue'
 	import {apiFlowDetail,apiSealAdd,apiSearchCustome,apiSearchContract} from '@/api/approve/seal.js'
-	import {uploadImg,uploadFiles} from '@/utils/uploadFile.js'
+	import {uploadFiles} from '@/utils/uploadFile.js'
 	import {preViewFile} from '../utils/util.js'
 	export default{ 
 		components:{
@@ -207,7 +202,11 @@
 				ContractId:0,//合同id
 				ContractfileUrl:'',//合同文件地址 pdf
 				
-				fileUrlArr:[],//上传附件 文件地址
+				file:{
+					type:'',
+					img:'',
+					url:''
+				},//上传附件 文件
 				
 				processData:null,//流程数据
 				
@@ -220,6 +219,15 @@
 			}
 		},
 		methods: {
+			//删除上传的附件
+			handleDeleteCheckFile(){
+				this.file={
+					type:'',
+					img:'',
+					url:''
+				}
+			},
+
 			//预览文件
 			handlePreviewFiles(e){
 				if (e.type === "pdf") {
@@ -235,22 +243,19 @@
 			async handleUpload(){
 				const res=await uploadFiles({type:'all'})
 				const reg = /\.(pdf)$/;
-				let temarr=res.map((item) => {
-					if (reg.test(item)) {
-						return {
-							type: "pdf",
-							url: item,
-							img: require("@/pages-approve/static/pdf.png"),
-						};
-					} else {
-						return {
-							type: "img",
-							url: item,
-							img: item,
-						};
+				if(reg.test(res[0])){
+					this.file={
+						type:'pdf',
+						url:res[0],
+						img:require('../static/pdf.png')
 					}
-				});
-				this.fileUrlArr=[...this.fileUrlArr,...temarr]
+				}else{
+					this.file={
+						type:'img',
+						url:res[0],
+						img:res[0]
+					}
+				}
 			},
 			
 			// 客户搜索 
@@ -448,6 +453,20 @@
 </script>
 
 <style lang="scss">
+	.check-file-box{
+		width: 102rpx;
+		height: 120rpx;
+		background-size: cover;
+		position: relative;
+		.del-icon{
+			position: absolute;
+			width: 30rpx;
+			height: 30rpx;
+			top: -15rpx;
+			right: -15rpx;
+		}
+	}
+
 	.add-page{
 		width: 100%;
 		min-height: 100vh;

+ 14 - 1
pages-approve/seal/detail.vue

@@ -29,8 +29,20 @@
 			<view class="section-title require">加盖何种印章</view>
 			<view :class="opButton.CheckEdit?'section-select-box':null" :style="{color:oldSealType?'#333':'#999'}" @click="handleOperation('showType')">{{oldSealType?oldSealType:'请选择'}}</view>
 		</view>
-		<view class="section white-wrap">
+		<view class="section white-wrap" v-if="detail.ContractId>0">
+			<view class="section-title require">合同附件</view>
+			<image 
+				:src="item.img" 
+				mode="aspectFill" 
+				style="width: 102rpx;height: 120rpx;margin:0 10rpx 10rpx 0" 
+				v-for="item in files" 
+				:key="item.url"
+				@click="handlepreViewFile(item)">
+			</image>
+		</view>
+		<view class="section white-wrap" v-else>
 			<view class="section-title require">合同附件</view>
+			<!-- 合规可修改上传 -->
 			<image 
 				:src="item.img" 
 				mode="aspectFill" 
@@ -186,6 +198,7 @@
 				oldFileNum:'',
 				oldSealType:'',
 				oldRemark:'',
+				oldFile:''
 			}
 		},
 		onLoad(options) {

BIN
pages-approve/static/del-icon.png


+ 3 - 3
pages-todomessages/list/list.vue

@@ -128,17 +128,17 @@
 				let navBarTitle = ''
 				const _this = this
 				switch (type) {
-					case 'custome':
+					case '1':
 						navBarTitle = '客户待审批'
 						_this.type = 1
 						_this.avatar=require('../../static/icon-1.png')
 						break;
-					case 'contract':
+					case '2':
 						navBarTitle = '合同待审批'
 						_this.type = 2
 						_this.avatar=require('../../static/icon-2.png')
 						break;
-					case 'seal':
+					case '3':
 						navBarTitle = '用印待审批'
 						_this.type = 3
 						_this.avatar=require('../../static/icon-3.png')

+ 25 - 30
pages/index/index.vue

@@ -1,21 +1,11 @@
 <template>
 	<view class="home-page">
-		<van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="show"/>
+		<van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="list.length===0&&!loading"/>
 		<template v-else>
-			<view class="message-box flex white-wrap" @click="handleGONext('custome')" v-if="custome.Message">
-				<image class="icon" src="../../static/icon-1.png" mode="aspectFill"></image>
-				<text style="flex: 1;margin-right: 5px;" class="van-ellipsis">{{custome.Message}}</text>
-				<van-tag round type="danger" color="#FF4444" v-if="custome.Total>0">{{custome.Total}}</van-tag>
-			</view>
-			<view class="message-box flex white-wrap" @click="handleGONext('contract')" v-if="contract.Message">
-				<image class="icon" src="../../static/icon-2.png" mode="aspectFill"></image>
-				<text style="flex: 1;margin-right: 5px;" class="van-ellipsis">{{contract.Message}}</text>
-				<van-tag round type="danger" color="#FF4444" v-if="contract.Total>0">{{contract.Total}}</van-tag>
-			</view>
-			<view class="message-box flex white-wrap" @click="handleGONext('seal')" v-if="seal.Message">
-				<image class="icon" src="../../static/icon-3.png" mode="aspectFill"></image>
-				<text style="flex: 1;margin-right: 5px;" class="van-ellipsis">{{seal.Message}}</text>
-				<van-tag round type="danger" color="#FF4444" v-if="seal.Total>0">{{seal.Total}}</van-tag>
+			<view class="message-box flex white-wrap" @click="handleGONext(item.SourceType)" v-for="item in list" :key="item.SourceType">
+				<image class="icon" :src="item.img" mode="aspectFill"></image>
+				<text style="flex: 1;margin-right: 5px;" class="van-ellipsis">{{item.Message}}</text>
+				<van-tag round type="danger" color="#FF4444" v-if="item.Total>0">{{item.Total}}</van-tag>
 			</view>
 		</template>
 	</view>
@@ -25,20 +15,10 @@
 <script>
 	import {apiMessageCount} from '@/api/message.js'
 	export default {
-		computed:{
-			show(){
-				if(this.custome&&!this.custome.Message&&this.contract&&!this.contract.Message&&this.seal&&!this.seal.Message){
-					return true
-				}else{
-					return false
-				}
-			}
-		},
 		data() {
 			return {
-				custome:null,
-				contract:null,
-				seal:null
+				list:[],
+				loading:false
 			}
 		},
 		onShow() {
@@ -61,11 +41,26 @@
 			
 			//获取消息数据
 			async getMessage(){
+				this.loading=true
 				const res=await apiMessageCount()
+				this.loading=false
 				if(res.code===200){
-					this.custome=res.data.CompanyMessage
-					this.contract=res.data.ContractMessage
-					this.seal=res.data.SealMessage
+					this.list=res.data&&res.data.map(item=>{
+						let img=''
+						if(item.SourceType===1){
+							img=require('../../static/icon-1.png')
+						}
+						if(item.SourceType===2){
+							img=require('../../static/icon-2.png')
+						}
+						if(item.SourceType===3){
+							img=require('../../static/icon-3.png')
+						}
+						return {
+							...item,
+							img
+						}
+					})
 				}
 			}
 		}