<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: DY
 * @LastEditTime: 2023-11-15 16:23:49
 * @Description:
-->
<template>
	<el-form
		:model="dataForm"
		:rules="dataRule"
		ref="dataForm"
		@keyup.enter.native="dataFormSubmit()"
		label-width="100px">
		<el-row :gutter="20">
			<el-col :span="12">
				<el-form-item label="原料名称" prop="name">
					<el-input v-model="dataForm.name" clearable placeholder="请输入原料名称" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="原料编号" prop="code">
					<el-input v-model="dataForm.code" clearable placeholder="请输入原料编号" />
				</el-form-item>
			</el-col>
		</el-row>
		<el-row :gutter="20">
			<el-col :span="12">
				<el-form-item label="每日消耗量" prop="dailyCost">
					<el-input-number v-model="dataForm.dailyCost" controls-position="right" clearable placeholder="请输入每日消耗量" style="width: 100%" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="单位" prop="unit">
					<el-select
						v-model="dataForm.unit"
						filterable
						style="width: 100%"
						placeholder="请选择单位">
						<el-option
							v-for="dict in getDictDatas('unit_dict')"
							:key="dict.value"
							:label="dict.label"
							:value="dict.value" />
					</el-select>
				</el-form-item>
			</el-col>
		</el-row>
	</el-form>
</template>

<script>
import basicAdd from '../../core/mixins/basic-add';
import { createHotMaterial, updateHotMaterial, getHotMaterial, getCode } from "@/api/base/coreHotMaterial";
import { getDictDatas} from "@/utils/dict";

export default {
	mixins: [basicAdd],
	data() {
		return {
			urlOptions: {
			  isGetCode: true,
        codeURL: getCode,
				createURL: createHotMaterial,
				updateURL: updateHotMaterial,
				infoURL: getHotMaterial,
			},
			dataForm: {
        id: undefined,
        code: undefined,
        name: undefined,
        unit: undefined,
        dailyCost: undefined
			},
			departmentlList: [],
			menuOptions: [],
			dataRule: {
        code: [{ required: true, message: "原料编码不能为空", trigger: "blur" }],
        name: [{ required: true, message: "原料名称不能为空", trigger: "blur" }]
      }
		};
	},
	mounted() {},
	methods: {}
};
</script>
