CASM_web/src/views/produce/add_edit.vue

87 lines
3.0 KiB
Vue
Raw Normal View History

2024-04-03 09:02:04 +00:00
<template>
<el-dialog v-model="props.modelValue" :title="props.title" @close="close" width="800">
<el-form ref="formRef" :inline="true" :model="props.form" :rules="rules" class="demo-form-inline"
label-width="100px">
<el-form-item label="产品编码" prop="productionCode">
<el-input v-model="props.form.productionCode" placeholder="请输入产品编码" />
</el-form-item>
<el-form-item label="设备编码" prop="deviceCode">
<el-input v-model="props.form.deviceCode" placeholder="请输入设备编码" />
</el-form-item>
<el-form-item label="员工编码" prop="persionCode">
<el-input v-model="props.form.persionCode" placeholder="请输入员工编码" />
</el-form-item>
<el-form-item label="目标产量" prop="planOutput">
<el-input v-model="props.form.planOutput" placeholder="请输入目标产量" />
</el-form-item>
<el-form-item label="当前产量" prop="output">
<el-input v-model="props.form.output" placeholder="请输入当前产量" />
</el-form-item>
<el-form-item label="开始时间" prop="starttime">
<el-date-picker clearable v-model="props.form.starttime" type="date" value-format="yyyy-MM-dd" placeholder="请选择开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endtime">
<el-date-picker clearable v-model="props.form.endtime" type="date" value-format="yyyy-MM-dd" placeholder="请选择结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="批次" prop="batch">
<el-input v-model="props.form.batch" placeholder="请输入批次" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="props.form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
import { ref } from "vue";
const { proxy } = getCurrentInstance();
const emit = defineEmits();
const props = defineProps({
modelValue: [String, Object, Array],
title: String,
form: {
type: Object,
default: () => ({}),
},
});
const baseUrl = import.meta.env.VITE_APP_BASE_API;
const rules = {
productionCode: [
{ required: true, message: "产品编码不能为空", trigger: "blur" }
],
deviceCode: [
{ required: true, message: "设备编码不能为空", trigger: "blur" }
],
persionCode: [
{ required: true, message: "员工编码不能为空", trigger: "blur" }
],
}
function close() {
emit("update:modelValue", false);
}
function submitForm() {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
emit("submitForm", props.form);
}
});
}
function cancel() {
emit("update:form", {});
close();
}
</script>
<style lang="scss" scoped></style>