<!--
 * @Author: zwq
 * @Date: 2021-11-18 14:16:25
 * @LastEditors: zwq
 * @LastEditTime: 2025-02-26 16:37:29
 * @Description:
-->
<template>
	<el-row :gutter="20">
		<el-form
			:model="dataForm"
			:rules="dataRule"
			ref="dataForm"
			@keyup.enter.native="dataFormSubmit()"
			label-width="80px">
			<el-col :span="12">
				<el-form-item label="关联表名" prop="plcTableName">
					<el-input
						v-model="dataForm.plcTableName"
						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-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="enName">
					<el-input
						v-model="dataForm.enName"
						clearable
						placeholder="请输入英文名" />
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="是否采集" prop="collection">
					<el-switch
						v-model="dataForm.collection"
						:active-value="1"
						:inactive-value="0"></el-switch>
				</el-form-item>
			</el-col>
			<el-col :span="12">
				<el-form-item label="描述" prop="description">
					<el-input
						v-model="dataForm.description"
						clearable
						placeholder="请输入描述" />
				</el-form-item>
			</el-col>
		</el-form>
	</el-row>
</template>

<script>
import basicAdd from '@/mixins/basic-add';

import {
	createEquipmentPlc,
	updateEquipmentPlc,
	getEquipmentPlc,
	getCode,
} from '@/api/base/equipmentPlc';

export default {
	mixins: [basicAdd],
	data() {
		return {
			urlOptions: {
				isGetCode: true,
				codeURL: getCode,
				createURL: createEquipmentPlc,
				updateURL: updateEquipmentPlc,
				infoURL: getEquipmentPlc,
			},
			dataForm: {
				id: undefined,
				plcTableName: undefined,
				code: undefined,
				name: undefined,
				enName: undefined,
				collection: 1,
				description: undefined,
			},
			dataRule: {
				plcTableName: [
					{ required: true, message: '关联表名不能为空', trigger: 'blur' },
				],
				code: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
				name: [{ required: true, message: '标识不能为空', trigger: 'blur' }],
			},
		};
	},
	methods: {},
};
</script>
