<template>
|
<div class="workstation-scanner-config">
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="扫码间隔(ms)">
|
<el-input-number
|
v-model="config.scanIntervalMs"
|
:min="1000"
|
:max="60000"
|
:step="1000"
|
style="width: 100%;"
|
/>
|
<span class="form-tip">定时扫描MES写区的时间间隔,默认10000ms(10秒)</span>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="产线编号">
|
<el-input-number
|
v-model="config.workLine"
|
:min="1"
|
:max="100"
|
:step="1"
|
style="width: 100%;"
|
/>
|
<span class="form-tip">产线编号,用于过滤玻璃信息</span>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="自动确认">
|
<el-switch v-model="config.autoAck" />
|
<span class="form-tip">是否自动确认MES发送的玻璃信息(回写mesSend=0)</span>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
</template>
|
|
<script setup>
|
import { ref, watch } from 'vue'
|
|
const props = defineProps({
|
modelValue: {
|
type: Object,
|
default: () => ({})
|
}
|
})
|
|
const emit = defineEmits(['update:modelValue'])
|
|
// 配置数据
|
const config = ref({
|
scanIntervalMs: 10000,
|
workLine: null,
|
autoAck: true
|
})
|
|
// 监听props变化
|
watch(() => props.modelValue, (newVal) => {
|
if (newVal && Object.keys(newVal).length > 0) {
|
config.value = {
|
scanIntervalMs: newVal.scanIntervalMs ?? 10000,
|
workLine: newVal.workLine ?? null,
|
autoAck: newVal.autoAck ?? true
|
}
|
}
|
}, { immediate: true, deep: true })
|
|
// 监听config变化,同步到父组件
|
watch(config, (newVal) => {
|
emit('update:modelValue', { ...newVal })
|
}, { deep: true })
|
</script>
|
|
<style scoped>
|
.form-tip {
|
margin-left: 10px;
|
font-size: 12px;
|
color: #909399;
|
}
|
</style>
|