<template>
	<view class="container">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
		<view class="ul fs-p20">
			<view class="li fs-bg__white fs-p30 fs-size__h4 fs-radius__sm fs-mt20" v-for="(item, index) in dataList">
				<view @click="toDetails(item.id)">
					<view class="fs-flex fs-mt20">
						<view class="fs-flex1">编码：{{item.maintainNo}}</view>
						<view class="fs-flex1">植物类型：{{item.plantTypeName}}</view>
					</view>
					<view class="fs-flex fs-mt20">
						<view class="fs-flex1">操作人：{{item.userName}}</view>
						<view class="fs-flex1">完成比例：{{item.currentFinishPercent}}%</view>
					</view>
					<view class="fs-flex fs-mt20">
						<view class="fs-flex1">提交时间：{{item.commitDate}}</view>
					</view>
				</view>
			</view>
		</view>
		</z-paging>
	</view>
</template>

<script>
import { apiMaintainRecord } from '@/api/work'
export default {
	data() {
		return {
			maintainNo: '',
			currentPlanNum: 0,
			maintainTypeId: 0,
			dataList: []
		}
	},
	onLoad(options) {
		this.maintainNo = options.plan_no
		this.currentPlanNum = options.current_plan_num
		this.maintainTypeId = options.maintainTypeId
	},
	methods: {
		// 获取养护记录
		queryList(pageNo, pageSize) {
			const params = {
				pageReq: {isAsc: 'desc', orderByColumn: 'id', pageNum: pageNo, pageSize: pageSize},
				maintainNo: this.maintainNo,
				currentPlanNum: this.currentPlanNum,
				// maintainTypeId: this.maintainTypeId,
				sourceType: 1
			}
			apiMaintainRecord({data:params}).then(res => {
				this.$refs.paging.complete(res.rows)
			})
		},
		// 跳转详情
		toDetails(id) {
			uni.$tui.href(`/pages/work/daily/maintain/recordDetails?id=${id}`)
		}
	}
}
</script>

<style lang="scss" scoped>
.ul .li:first-child {
	margin-top: 0;
}
</style>
