<template>
	<view>
		<wd-collapse v-model="value">
		  <wd-collapse-item title="表单数据" name="item1">
			  	<wd-cell title="接待类别" :value="info.jdlb" />
			  	<wd-cell title="详细类别" :value="info.jdlb2" />
			  	<wd-cell title="申请时间" :value="info.sqrq" />
			  	<wd-cell title="申请单位" :value="info.sqdw" />
			  	<wd-cell title="申请盖章领导" :value="info.gzbmld" />
			  	<wd-cell title="申请盖章厂领导" :value="info.gzcld" />
			  	<wd-cell title="活动日期" :value="info.hdrq" />
			  	<wd-cell title="来宾单位" :value="info.lbdw" />
			  	<wd-cell title="活动内容" :value="info.hdnr" />
			  	<wd-cell title="经办人" :value="info.jbr" />
				<wd-cell title="接待类别" :value="info.jdxm" />
				<wd-cell v-if="info.jdxm=='工作餐(午餐)'&&info.jdlb2=='业务招待（外部市场）'" title="午餐地点" :value="info.wcddforwbxm" />
				<wd-cell v-if="info.jdxm=='工作餐(午餐)'&&info.jdlb2!='业务招待（外部市场）'" title="午餐地点" :value="info.gzcjszwdidian" />
				<wd-cell v-if="info.jdxm=='工作餐(晚餐)'" title="晚餐开始时间" :value="info.nightstarttime" />
				<wd-cell v-if="info.jdxm=='工作餐(晚餐)'&&info.jdlb2=='业务招待（外部市场）'" title="晚餐地点" :value="info.ninghtddforwbxm" />
				<wd-cell v-if="info.jdxm=='工作餐(晚餐)'&&info.jdlb2!='业务招待（外部市场）'" title="晚餐地点" :value="info.gzcjswsdidian" />
				<wd-cell v-if="info.jdxm=='自助餐'"  title="自助餐人数" :value="info.zzcrs" />
				<wd-cell v-if="info.jdxm=='自助餐'"  title="自助餐次数" :value="info.zzccs" />
				<wd-cell title="来宾人数" :value="info.lbrs" />
				<wd-cell title="陪餐人数" :value="info.pcrs" />
				<wd-cell title="申请金额（元）" :value="info.sqje" />
				<wd-cell title="备注" :value="info.bz" />
		  </wd-collapse-item>
		  <wd-collapse-item custom-body-style="padding:0;"  title="审批附件" name="item2">
			  <SinopecEsignPage ref="sign" :procInsId="props.formData.procInsId"  :path="props.formData.path" :taskDefKey="props.formData.taskDefKey" :fileName="info.jdsqwj" @stampSuccess="getStampSuccess" ></SinopecEsignPage>
		  </wd-collapse-item>
		</wd-collapse>
		<wd-toast></wd-toast>
	</view>
</template>

<script setup>
	import {
		queryById
	} from '@/api/officialReceptions'
	import {
		processHistoryList
	} from '@/api/bpm/sign'
	import {
		imgUrl
	} from '@/utils/index'
	import SinopecEsignPage from '@/components/Esign/SinopecEsignPage.vue'
	import { useUserStore } from '@/store/user'
	import { useToast, useMessage, useNotify, dayjs } from 'wot-design-uni'
	const userStore = useUserStore()
	const toast = useToast()
	const emit = defineEmits(['getStampSuc'])

	const sign = ref(null);
	const value = ref([]);
	const info = ref({});
	const valiData = ref({});
	const ifEsign = ref(true);
	const props = defineProps({
		formData: {
			type: Object,
			default: () => {},
		},
		fileName: {
			type: String,
			default: ""
		}
	})

	const queryData = ()=>{
		console.log(props.formData)
		queryById(props.formData.dataId).then(res=>{
			if (res.success) {
				console.log(res)
				info.value = res.result.records[0]
				if(info.value.jdsqwj){
					info.value.jdsqwj = info.value.jdsqwj.replace("PdfFiles/PdfFile/",'')
				}
				console.log(info.value.jdsqwj)
			}else{
				toast.error(res.message)
			}
		})
	}
	


	  //获取印章成功事件，并将信号传给确认提交按钮。
	 const getStampSuccess=(val)=> {
		emit('getStampSuc', val)
	  }

	const signValidator = (procInsId,path)=>{
	 	//这里进行电子签章验证
		return sign.value.signValidator();
	 }

	onMounted(() => {
		queryData();
	})
	
	
	defineExpose({ //暴露方法
	  signValidator,
	  ifEsign
	})
</script>
<style lang="scss" scoped>

	
</style>