<template>
	<view class="schedule">
		<u-navbar ref="uNavbar" :border-bottom="false" :back-icon-color="setNav.backColor" :is-back="setNav.isdisPlayNavTitle"
		 :title-size="setNav.size" :title-bold="setNav.bold" :title="setNav.navTitle" :title-color="setNav.color" :background="setNav"></u-navbar>
		<view class="contentMain" v-if="data.length">
			<view  v-for="(item, index) in data" :key="item.id"
			 class="u-swipe-action" @click="click(item)" >
				<view class="item">
					<view class="title">{{item.message_title}}</view>
					<view class="userInfo">
						<view class="user">
							<view class="name">拟稿人：{{item.from_dept_name}}</view>
							<view class="name">发文日期：{{item.receive_time}}</view>
							<view class="name">流程结束日期：{{item.finish_time}}</view>
						</view>
						<!-- <view class="status">发文审核中</view> -->
					</view>
				</view>
			</view>
		</view>
		<view class="no-data" v-else>暂无数据</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				setNav: {
					backgroundColor: '#fff', //背景色
					color: '##343434', //字体颜色
					bold: true,
					size: '36',
					backColor: '##343434',
					isdisPlayNavTitle: true, //是否显示返回按钮
					navTitle: '待办' //导航标题
				},
				data: [],
				pageNo: 1,
				total: 0,
				userInfo: {}
			}
		},
		onReachBottom() {
			if (this.data.length >= this.total) {
				return
			}
			this.pageNo += 1
			this.init()
		},
		onLoad() {
			this.userInfo = JSON.parse(uni.getStorageSync('userInfo') || '{}');
			this.init()
		},
		computed: {

		},
		methods: {
			async init() {
				let res = await this.$u.post(`boman-web-core/message/toDoMessage`, {
					 "pageNo": this.pageNo,
			        "pageSize": 10,
			        "username": this.userInfo.userName
				})
				if (res.data && res.data.rows) {
					res.data.rows = res.data.rows.map(item => {
						return Object.assign({}, item, {
							show: false
						})
					})
					if (this.pageNo == 1) {
						this.data = res.data.rows
						this.total = res.data.total
					} else {
						this.data = this.data.concat(res.data.rows)
					}
				}
			},
			click(item) {
				// 跳转到审核页面
				uni.navigateTo({
					url: '/pages/centerView/schedule/details?id=' + item.id + '&objId=' + item.receive_id
				})
				// if (this.active === 0) {
					
				// } else {
				// 	// 跳转到审核页面
				// }
			}
		}
	}
</script>

<style lang="scss" scoped>
	.schedule {
		height: 100%;
		background: #fff;
		.contentMain {
			padding: 0 20rpx;
			.item {
				.title {
					font-size: 28rpx;
					font-weight: bold;
					color: #343434;
					padding: 30rpx 30rpx 0 30rpx;
					white-space: break-word;
					word-break:break-all;
				}

				.userInfo {
					display: flex;
					align-items: flex-end;
					border-bottom: solid 1rpx #DADADA;
					padding: 30rpx;

					.user {
						flex: 1;
						color: #666;
						font-size: 24rpx;

						.name {
							margin-bottom: 10rpx;
						}
					}

					.status {
						color: #009FE8;
						font-size: 26rpx;
						margin-bottom: 4rpx;
					}

					.statusBtn {
						color: #fff;
						font-size: 22rpx;
						margin-bottom: 4rpx;
						background: #61C320;
						padding: 10rpx 20rpx;
						border-radius: 40rpx;
					}
				}
			}
		}

	}
</style>
