<template>
	<view class="container">
		<view class="example">
			<!-- <uni-forms ref="form" :model="tjform" labelWidth="100px">
				<uni-forms-item label="图斑编号：" name="dkbh">
					<uni-easyinput v-model="tjform.dkbh" disabled />
				</uni-forms-item>
			</uni-forms> -->
			图斑编号：{{tjform.dkbh}}
			<div class="tit">
				确定对该图斑数据进行提交吗？提交后无法进行修改。
			</div>
			<div v-for="(note, nkey) in JSON.parse(tjform.notes)" :key="nkey">
				{{ note.stepValue }}：{{ note.notes }}
			</div>
			<div>提交数据包括图斑核查数据、审核数据、合法性判定数据。</div>
			<button type="primary" @click="submit">确 定</button>
		</view>
	</view>
</template>

<script>
	import {
		getTjInfo,
		tjWork
	} from "@/api/dkjbxx.js";


	export default {
		data() {
			return {
				obj: {},
				tjform: {
					"id": "",
					"confirmState": "",
					"confirmType": "",
					"confirmNotse": "",
					"auditflowStep": "WYTJ"
				},
			}
		},

		onLoad() {
			let obj = uni.$globalData || {}
			let pram = {
				dkid: obj.dkjdxxId,
				auditflowStep: 'WYTJ',
				auditflowId: obj.auditflowId,
				fieldworkId: obj.id
			};
			this.getInfo(pram)
		},
		onReady() {
			// this.$refs.form.setRules(this.rules)
		},
		methods: {
			getInfo(pram) {
				getTjInfo(pram).then(response => {
					if (response.data)
						this.tjform = response.data
					else
						this.$modal.msgError("提交信息获取失败")
					this.tjform.auditflowStep = pram.auditflowStep
				})
			},
			submit(ref) {
				// this.$refs.form.validate().then(res => {
					tjWork(this.tjform).then(response => {
						this.$modal.msgSuccess("提交成功")
						this.$tab.navigateTo('/pages/index')
					})
				// })
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #ffffff;
	}

	.example {
		padding: 15px;
		background-color: #fff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
		flex: 1;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		line-height: 35px;
		margin-left: 10px;
	}
</style>