<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2023-10-11 16:30:10
 * @Description:
-->
<template>
	<el-form
		:model="dataForm"
		:rules="dataRule"
		ref="dataForm"
    style="margin-right: 50px;"
		@keyup.enter.native="dataFormSubmit()"
		label-width="120px">
		<el-row :gutter="20">
			<el-col :span="12">
				<el-form-item label="产品编码" prop="goodSpecificationCode">
					<el-input
						v-model="dataForm.goodSpecificationCode"
						clearable
						placeholder="请输入产品编码" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="产品名称" prop="goodSpecificationName">
					<el-input
						v-model="dataForm.goodSpecificationName"
						clearable
						placeholder="请输入产品名称" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="产品规格" prop="specification">
					<el-select
						v-model="dataForm.specification"
						clearable
						placeholder="请选择产品规格">
						<el-option
							v-for="item in options"
							:key="item.value"
							:label="item.label"
							:value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="需要熟化时间" prop="cureTime">
					<el-input-number
						v-model="dataForm.cureTime"
						controls-position="right"
						:min="0"></el-input-number>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="是否需要熟化" prop="cure">
					<el-select
						v-model="dataForm.cure"
						placeholder="请选择">
						<el-option
							v-for="item in options1"
							:key="item.value"
							:label="item.label"
							:value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="是否启用" prop="deactivate">
					<el-select
						v-model="dataForm.deactivate"
						placeholder="请选择">
						<el-option
							v-for="item in options1"
							:key="item.value"
							:label="item.label"
							:value="item.value"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
	</el-form>
</template>

<script>
import basicAdd from '../mixins/basic-add';
import {
	createGoodSpecification,
	updateGoodSpecification,
	getGoodSpecification,
	getCode,
} from '@/api/asrs/goodSpecification';

export default {
	mixins: [basicAdd],
	data() {
		return {
			urlOptions: {
				isGetCode: true,
				codeURL: getCode,
				codeName: 'goodSpecificationCode',
				createURL: createGoodSpecification,
				updateURL: updateGoodSpecification,
				infoURL: getGoodSpecification,
			},
			dataForm: {
				id: undefined,
				goodSpecificationCode: undefined,
				goodSpecificationName: undefined,
				specification: undefined,
				cureTime: undefined,
				cure: 1,
				deactivate: 1,
			},
			options: [
				{
					value: 0,
					label: '卷',
				},
			],
      options1: [
				{
					value: 0,
					label: '否',
				},
				{
					value: 1,
					label: '是',
				},
			],
			dataRule: {
				goodSpecificationCode: [
					{ required: true, message: '产品编码不能为空', trigger: 'blur' },
				],
				goodSpecificationName: [
					{ required: true, message: '产品名称不能为空', trigger: 'blur' },
				],
			},
		};
	},
	methods: {},
};
</script>
