<style lang="scss">
	.container{
		background:#F6F6F6;
		min-height: 100%;
		padding:30rpx 0;

		.card{
			min-height:1000rpx;
		}
	}
</style>
<template>
	<view class="container">
		<u-form class="card inline" labelWidth="auto" :model="formData" :rules="rules">
			<d-form v-for="(v,k) in fields" :key="k" v-bind="v" :field="k" :required="!!rules[k]"/>
		</u-form>

		<button class="cu-btn round bg-green shadow submit">保存</button>
	</view>
</template>
<script>
export default {
	data(){
		return{
			fields:{
				name:{label:"物品名称"},
				unit:{label:"物品单位",type:"select"},
				type:{label:"物品类型",type:"select"},
				supplier:{label:"供应商"},
				remarks:{label:"备注",type:"textarea"},
			},
			formData:{name:""},
			rules:{
				name:{required:true, message:"物品名称必填！", trigger:"blur"},
				unit:{required:true, message:"物品单位必选！", trigger:"blur"},
				type:{required:true, message:"物品类型必选！", trigger:"blur"},
				supplier:{required:true, message:"供应商必填！", trigger:"blur"},
			}
		}
	}
}
</script>