<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2025-11-12 15:35:21
 * @Description:
-->
<template>
	<el-form
		:model="dataForm"
		:rules="dataRule"
		ref="dataForm"
		@keyup.enter.native="dataFormSubmit()"
		label-width="80px">
		<el-row :gutter="20">
			<el-col :span="12">
				<el-form-item label="产品编码" prop="code">
					<el-input
						v-model="dataForm.code"
						clearable
						placeholder="请输入产品编码" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="产品名称" prop="name">
					<el-input
						v-model="dataForm.name"
						clearable
						placeholder="请输入产品名称" />
				</el-form-item>
			</el-col>
		</el-row>
		<el-row :gutter="20">
			<el-col :span="12">
				<el-form-item label="产品规格" prop="address">
					<el-input
						v-model="dataForm.address"
						clearable
						placeholder="请输入产品规格" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="产品类型" prop="name">
					<el-select
						v-model="dataForm.name"
						disabled
						:style="{ width: '100%' }"
						placeholder="请选择产品类型">
						<el-option
							v-for="item in typeArr"
							:key="item.name"
							:label="item.label"
							:value="item.name"></el-option>
					</el-select>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="启用状态" prop="enabled">
					<el-select
						:style="{ width: '100%' }" v-model="dataForm.enabled" placeholder="请选择启用状态">
						<el-option
							v-for="dict in this.getDictDatas(DICT_TYPE.INFRA_BOOLEAN_STRING)"
							: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 '@/mixins/basic-add';
import {
	createFactory,
	updateFactory,
	getFactory,
	getCode,
} from '@/api/core/base/factory';

export default {
	mixins: [basicAdd],
	data() {
		return {
			urlOptions: {
				isGetCode: true,
				codeURL: getCode,
				createURL: createFactory,
				updateURL: updateFactory,
				infoURL: getFactory,
			},
			dataForm: {
				id: undefined,
				code: undefined,
				name: undefined,
				address: undefined,
        enabled:'1',
				remark: undefined,
			},
      typeArr: [],
			dataRule: {
				code: [
					{ required: true, message: '产品编码不能为空', trigger: 'blur' },
				],
				name: [
					{ required: true, message: '产品名称不能为空', trigger: 'blur' },
				],
			},
		};
	},
	methods: {},
};
</script>
