<template>
	<view class="blacklog-container">
		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" @clickLeft="close">
		</uni-nav-bar>
		<!-- 		<div style="height: 88rpx;width: 100%;"></div> -->

		<fileMain ref="fileMainRef" @getFiles="getFiles" @close="close"></fileMain>
	</view>
</template>

<script>
	import Vue from "vue";
	import fileMain from '@/pages/doc/docList.vue';
	
	export default {
		components: {
			fileMain
		},
		data() {
			return {
				isShow: false,
				title: '申请',
				fileIds: []
			}
		},

		methods: {
			getFiles(val = []) {
				console.log(val, '选择的文件ID')
				// 通过事件传递选中的文件ID
				uni.$emit('selectFilesResult', {
					files: val
				})
			},
			close() {
				uni.navigateBack()
			}
		},
		mounted() {
	
		},


		async onLoad(option = {}) {
			console.log(option, 'filesChoose onLoad')
			if (option.files) {
				try {
					this.fileIds = JSON.parse(decodeURIComponent(option.files)) || []
				} catch (e) {
					this.fileIds = []
				}
			}

            console.log(this.fileIds, 'fileIds')
			this.$nextTick(() => {
				if (this.$refs.fileMainRef) {
					this.$refs.fileMainRef.open(this.fileIds, option.isEdit)
				}
			})
		},
	}
</script>

<style>
</style>