<template>
  <view>
	  <!-- 有文件出具的权限 -->
	  <!-- 风险报告只能有风险修改删除 -->
	  <!-- <view class="edit" v-if="ite.val=='psyjqpb'||ite.val=='gdhyjy'||ite.val=='wtdbht'" @click="getQmFn">
	  	<image :src="edit"></image>
	  	<view>在线签名</view>
	  </view> -->

	<!-- <view class="boxt" v-for="(ite,idx) in wjcjlist" :key="idx">
		<view class="txt">
			<view class="flex1 flexc">{{ite.label}}
			
			<template v-if="checkPermi(['system:fj:add'])&&datainfo.loanApplicationType!=4&&pfrom!='vote'&&pfrom!='bhxx'&&datainfo.loanApplicationType!=3">
				<template v-if="ite.val=='fxbg'||ite.val=='fkhgb'">
					<view class="editf" v-if="userId==datainfo.fUserId"  @click="getfjEdit(ite.val)">
						<image :src="editf"></image>
						<view>上传</view>
					</view>
				</template>
				<view class="editf" v-else @click="getfjEdit(ite.val)">
					<image :src="editf"></image>
					<view>上传</view>
				</view>
			</template>
			
			</view>
			
		</view>
				
		<view class="mt18" v-if="fileFj&&fileFj[ite.val]&&fileFj[ite.val].length">
			<view class="fjlists"  v-for="(fite,fidx) in fileFj[ite.val]" :key='fidx'>
				<view class="flext flex1" @click="getDown(fite.url)">
					<view class="imgl"><image :src="filico" ></image></view>
					<view class="tit">{{fite.name}}</view>
				</view>
				<template v-if="pfrom!='vote'&&pfrom!='bhxx'&&datainfo.loanApplicationType!=3&&datainfo.loanApplicationType!=4">
					<template v-if="ite.val=='fxbg'||ite.val=='fkhgb'">
						<template v-if="userId==datainfo.fUserId">
							<view class="edit" v-if="(ite.val=='gdhyjy')&&checkPermi(['word:wordFilePath:wordFilePath'])" @click="getQmFn(fite.url)">
								<image :src="edit"></image>
								<view>在线签名</view>
							</view>
							<view class="delimg flex0" v-if="checkPermi(['system:fj:remove'])" @click.stop="getDelwjFj(fite.fjId)">
								<image :src="fdelimg"></image>
							</view>
						</template>
					</template>
					<template v-else>
						<view class="edit" v-if="(ite.val=='gdhyjy')&&checkPermi(['word:wordFilePath:wordFilePath'])" @click="getQmFn(fite.url)">
							<image :src="edit"></image>
							<view>在线签名</view>
						</view>
						<view class="delimg flex0" v-if="checkPermi(['system:fj:remove'])" @click.stop="getDelwjFj(fite.fjId)">
							<image :src="fdelimg"></image>
						</view>
					</template>
				</template>
				<text class="txta" @click="getDown(fite.url)">预览</text>
			</view>
		</view>
	</view> -->
	<!-- 其他附件 -->
	<view class="boxt" >
		<view class="txt">
			<view class="flex1 flexc">其他附件
				<!-- <template v-if="checkPermi(['system:fj:add'])&&datainfo.loanApplicationType!=4&&pfrom!='vote'&&pfrom!='bhxx'&&datainfo.loanApplicationType!=3">
					<view class="editf"   @click="getQtfjEdit('qtfj')">
						<image :src="editf"></image>
						<view>上传</view>
					</view>
				</template> -->
				
			</view>
		</view>
		<!-- 文件出具信息 -->
		<view class="mt18" v-if="fileFj">
			<view v-for="(ite,name, index) in fileFj" :key="index">
				<view class="fjlists"  v-for="(fite,fidx) in ite" :key='fidx'>
					<view class="flext flex1" @click="getDown(fite.url)">
						<view class="imgl"><image :src="filico" ></image></view>
						<view class="tit">{{fite.name}}</view>
					</view>
					<!-- ||ite.val=='wtdbht' -->
					<template v-if="pfrom!='vote'&&pfrom!='bhxx'&&datainfo.loanApplicationType!=3&&datainfo.loanApplicationType!=4">
						<!-- 放款合规表 -->
						<template v-if="name=='fxbg'||name=='fkhgb'">
							<template v-if="userId==datainfo.fUserId">
								<view class="edit" v-if="(name=='gdhyjy')&&checkPermi(['word:wordFilePath:wordFilePath'])" @click="getQmFn(fite.url)">
									<image :src="edit"></image>
									<view>在线签名</view>
								</view>
								<view class="delimg flex0" v-if="checkPermi(['system:fj:remove'])" @click.stop="getDelwjFj(fite.fjId)">
									<image :src="fdelimg"></image>
								</view>
							</template>
						</template>
						<template v-else>
							<view class="edit" v-if="(name=='gdhyjy')&&checkPermi(['word:wordFilePath:wordFilePath'])" @click="getQmFn(fite.url)">
								<image :src="edit"></image>
								<view>在线签名</view>
							</view>
							<view class="delimg flex0" v-if="checkPermi(['system:fj:remove'])" @click.stop="getDelwjFj(fite.fjId)">
								<image :src="fdelimg"></image>
							</view>
						</template>
						<text class="txta coa1" v-if="checkPermi(['system:fj:edit'])" @click="getfjXiu(name,fite.fjId)">修改</text>
					</template>
					<view class="upimg" @click="getXzFn(fite)"><image :src="fupimg"></image></view>
					<text class="txta" @click="getDown(fite.url)">预览</text>
				</view>
			</view>
			
		</view>
		<!-- <text class="txta" @click="getDown(fite.url)">预览</text> -->
				<!-- <view class="delimg flex0" @click.stop="getDelFj(idx)">
					<image :src="fdelimg"></image>
				</view> -->
		<view class="mt18" v-if="qtfileFj&&qtfileFj.qtfj&&qtfileFj.qtfj.length">
			<view class="fjlists"  v-for="(fite,fidx) in qtfileFj.qtfj" :key='fidx'>
				<view class="flext flex1" @click="getDown(fite.url)">
					<view class="imgl"><image :src="filico" ></image></view>
					<view class="tit">{{fite.name}}</view>
				</view>
				<template v-if="pfrom!='vote'&&pfrom!='bhxx'&&datainfo.loanApplicationType!=3&&datainfo.loanApplicationType!=4">
					<view class="delimg flex0" v-if="checkPermi(['system:fj:remove'])&&pfrom!='vote'&&pfrom!='bhxx'&&datainfo.loanApplicationType!=3&&datainfo.loanApplicationType!=4" @click.stop="getDelwjFj(fite.fjId)">
						<image :src="fdelimg"></image>
					</view>
					<text class="txta coa1" v-if="checkPermi(['system:fj:edit'])" @click="getQtfjEdit('qtfj',fite.fjId)">修改</text>
				</template>
				<view class="upimg" @click="getXzFn(fite)"><image :src="fupimg"></image></view>
				<text class="txta" @click="getDown(fite.url)">预览</text>
			</view>
		</view>
	</view>
  </view>
</template>

<script>
	import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
	import { selectValue } from '@/utils/common.js';
	import noData from "@/components/nodata/nodata.vue"
  export default {
	props:{
		datainfo: {
			type: Object,
			default () {
				return {}
			}
		},
		fileFj:{
			type: Object,
			default () {
				return {}
			}
		},
		qtfileFj:{
			type: Object,
			default () {
				return {}
			}
		},
		wjcjlist:{
			type: Array,
			default () {
				return []
			}
		},
		pfrom:{
			type: String,
			default () {
				return ''
			}
		}
	},
	components:{
		noData
	},
	data(){
		return{
			upimg: require('@/work/static/images/up.png'),
			fupimg:require('@/work/static/images/fdown.png'),
			filico:require('@/work/static/images/filico.png'),
			edit:require('@/work/static/images/edit.png'),
			editf:require('@/work/static/images/editfile.png'),
			fdelimg:require('@/work/static/images/del.png'),
			gdfilelist:[],
			zheList:[],
			userId:this.$store.state.user.userId,
			fileList:[]
		}
	},
	onLoad: function() {
	},
	methods:{
		checkPermi, checkRole,
		kaType(ite){
			return selectValue(this.tajdlist, ite);
		},
		getZheFn(idx){
			this.zheList[idx].zheflag=!this.zheList[idx].zheflag
		},
		getfjEdit(val){
			this.$emit('getfjEdit',val)
		},
		getfjXiu(val,id){
			this.$emit('getfjXiu',val,id)
		},
		getQtfjEdit(val,id){
			this.$emit('getQtfjEdit',val,id)
		},
		getDown(url){
			this.$emit('getDown',url)
		},
		getPreview(url){
			this.$emit('getPreview',url)
		},
		getDelwjFj(id){
			this.$emit('getDelwjFj',id)
		},
		getQmFn(url){
			this.$emit('getQmFn',url)
		},
		getXzFn(ite){
			this.$emit("getXzFn",ite)
		},
	},
	
  }
</script>

<style lang="scss" scoped>
.boxt{padding:44rpx 36rpx 40rpx;border-top: 2rpx solid #E6E6E6;}
.txt{display: flex;align-items: flex-start;
	view{font-weight: bold;font-size: 30rpx;color: #222327;}
	text{color: #28C529;font-weight: 500;line-height: 40rpx;flex: 0 0 auto;margin-left: 46rpx;padding: 0 6rpx;}
}
.upimg{width:40rpx;height: 40rpx;margin-left: 18rpx;display: flex;align-items: center;justify-content: center;
		image{width: 30rpx;height: 28rpx;}
	}
.fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 20rpx;
	&:last-child{margin-bottom: 0;}
	.imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;flex: 0 0 auto;
		image{width: 26rpx;height: 24rpx;}
	}
	.tit{font-size: 26rpx;color: #222327;font-weight: 500;margin-top: 4rpx;word-break: break-all;}
	.delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;flex: 0 0 auto;
		image{width: 24rpx;height: 24rpx;}
	}
	.txta{color: #28C529;font-weight: 500;line-height: 40rpx;flex: 0 0 auto;margin-left: 18rpx;padding: 0 6rpx;
		&.coa1{color: #00A9F0;}
	}
}
.upbox{display: flex;flex-direction: column;align-items: center;padding: 56rpx 0 40rpx;border-top: 2rpx solid #E6E6E6;
	image{width: 30rpx;height: 26rpx;margin-bottom: 18rpx;transform: rotate(180deg);}
	view{font-weight: 500;font-size: 26rpx;color: #666666;}
}
.editf{flex:0 0 auto;display: flex;align-items: center;margin-left: 24rpx;
	view{font-weight: 500;font-size: 26rpx;color: #00A9F0;}
	image{width: 22rpx;height: 24rpx;margin-right:8rpx;}
}
.edit{flex:0 0 auto;display: flex;align-items: center;
	view{font-weight: 500;font-size: 26rpx;color: #00A9F0;}
	image{width: 20rpx;height: 24rpx;margin-right: 2rpx;}
}
</style>
