<template>
	<el-form
		ref="unPrintEdit"
		:rules="rules"
		label-width="130px"
		:model="form">
		<el-row :gutter="20">
			<el-col :span="24">
				<el-form-item
					label="成品周转编号"
					prop="packagingCode">
					<el-input
						readonly
						v-model="form.packagingCode"></el-input>
				</el-form-item>
			</el-col>
			<el-col :span="24">
				<el-form-item
					label="片数"
					prop="num">
					<el-input-number
						v-model="form.num"
						:min="0"
						:max="999999"
						style="width: 100%"
						label="片数"></el-input-number>
				</el-form-item>
			</el-col>
		</el-row>
	</el-form>
</template>
<script>
import { getPacking } from '@/api/base/packingInfo';
export default {
	name: 'UnPrintEdit',
	data() {
		return {
			form: {
				id: '',
				packagingCode: '',
				num: null,
			},
			rules: {
				num: [{ required: true, message: '片数不能为空', trigger: 'blur' }],
			},
		};
	},
	methods: {
		init(id) {
			console.log('init');
			this.form.id = id;
			getPacking(id).then((res) => {
				console.log(res);
			});
		},
		submitForm() {
			this.$refs['unPrintEdit'].validate((valid) => {
				if (valid) {
					console.log('保存');
					this.$emit('successSubmit');
				}
			});
		},
		formClear() {
			this.$refs.unPrintEdit.resetFields();
		},
	},
};
</script>
