<template>
	<view>
		<u-navbar
			title="维修养护" 
			:autoBack="true" 
			:titleStyle="{
				fontSize:'18px'
			}" 
			:height='44'
			:safeAreaInsetTop=true
			leftIconSize='20'
			leftIconColor='rgb(153, 153, 153)'
		>
		</u-navbar>
		<view
			style="background-color: #f0f0f0;padding: 10px;overflow: auto;margin-top: 44px;">
			<view class="content">
				<formTop  labelWidth="150rpx" :formData="formData"/>
			</view>
			<view class="content" style="margin-top: 10px;">
				<formBottom  labelWidth="150rpx" @submitForm='submitForm' :formData="formData"/>
			</view>
		</view>
		<!-- <button @click="submitForm">Submit</button> -->
	</view>
</template>

<script>
import formTop from './formTop.vue'
import formBottom from './formBottom.vue'
import moment from 'moment'

export default {
	components: { formTop,formBottom },
	data() {
		return {
			formData: {
				reportUserName:'',
				reportTime:moment().format('YYYY-MM-DD HH:mm:ss'),
				userId:''
				},
		}
	},
	onLoad(options) {
		this.formData=JSON.parse(options.item)
		console.log(this.formData,JSON.parse(options.item));
	},
	methods: {
		submitForm(params) {
			// 
			console.log({...params,...this.formData});
			uni.$http.post('/gunshiApp/ykz/maintain/service/insert',{...params,...this.formData}).then(res=>{
				if(res.data.code == 200){
					uni.$u.toast('新增成功')
					uni.navigateBack()
				}
			})
		},
		goBack() {
			console.log(12121);

			uni.navigateBack()
		},
	}
}
</script>

<style>
.content {
	/* margin: 10px; */
	padding: 10px;
	/* width: 95%; */
	background-color: #fff;
}
</style>