|
|
@ -186,6 +186,79 @@
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<!--<el-row :gutter="20" style="margin-top: 20px">-->
|
|
|
|
|
|
|
|
<!-- <el-col :span="8" class="el-col">-->
|
|
|
|
|
|
|
|
<!-- <el-form-item label="是否手动解码:" prop="scanMaxCount" style="margin-bottom: 0">-->
|
|
|
|
|
|
|
|
<!-- <el-radio-group v-model="formData.isAutoCodec">-->
|
|
|
|
|
|
|
|
<!-- <el-radio :label="true">是</el-radio>-->
|
|
|
|
|
|
|
|
<!-- <el-radio :label="false">否</el-radio>-->
|
|
|
|
|
|
|
|
<!-- </el-radio-group>-->
|
|
|
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
|
|
|
<!--</el-row>-->
|
|
|
|
|
|
|
|
</el-collapse-item>
|
|
|
|
|
|
|
|
<el-collapse-item name="4">
|
|
|
|
|
|
|
|
<template slot="title">
|
|
|
|
|
|
|
|
<p class="form-title">高拍仪扫码设置</p>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
|
|
|
<el-col :span="8" class="el-col">
|
|
|
|
|
|
|
|
<el-form-item label="扫码数量设置:" prop="scanMaxCount" style="margin-bottom: 0">
|
|
|
|
|
|
|
|
<el-input
|
|
|
|
|
|
|
|
style="width: 90%"
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
type='number'
|
|
|
|
|
|
|
|
splaceholder="请输入内容"
|
|
|
|
|
|
|
|
v-model="formData.FixedCount"
|
|
|
|
|
|
|
|
></el-input>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
<!--<el-col :span="8" class="el-col">-->
|
|
|
|
|
|
|
|
<!-- <el-form-item label="PAD扫码数量设置:" prop="pdaMaxCount" style="margin-bottom: 0">-->
|
|
|
|
|
|
|
|
<!-- <el-input-->
|
|
|
|
|
|
|
|
<!-- style="width: 90%"-->
|
|
|
|
|
|
|
|
<!-- size="small"-->
|
|
|
|
|
|
|
|
<!-- type='number'-->
|
|
|
|
|
|
|
|
<!-- splaceholder="请输入内容"-->
|
|
|
|
|
|
|
|
<!-- v-model="formData.pdaMaxCount"-->
|
|
|
|
|
|
|
|
<!-- ></el-input>-->
|
|
|
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
|
|
|
<!--</el-col>-->
|
|
|
|
|
|
|
|
<!--<el-col :span="8" class="el-col">-->
|
|
|
|
|
|
|
|
<!-- <el-form-item label="工控扫码数量设置:" prop="ipcMaxCount" style="margin-bottom: 0">-->
|
|
|
|
|
|
|
|
<!-- <el-input-->
|
|
|
|
|
|
|
|
<!-- style="width: 90%"-->
|
|
|
|
|
|
|
|
<!-- size="small"-->
|
|
|
|
|
|
|
|
<!-- type='number'-->
|
|
|
|
|
|
|
|
<!-- splaceholder="请输入内容"-->
|
|
|
|
|
|
|
|
<!-- v-model="formData.ipcMaxCount"-->
|
|
|
|
|
|
|
|
<!-- ></el-input>-->
|
|
|
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
|
|
|
<!--</el-col>-->
|
|
|
|
|
|
|
|
<el-col :span="8" class="el-col">
|
|
|
|
|
|
|
|
<el-form-item label="是否自动解码:" prop="AutoDecode" style="margin-bottom: 0">
|
|
|
|
|
|
|
|
<el-select v-model="formData.AutoDecode" placeholder="选择是否自动解码">
|
|
|
|
|
|
|
|
<el-option label="否" :value="0"></el-option>
|
|
|
|
|
|
|
|
<el-option label="是" :value="1"></el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-col :span="8" class="el-col">
|
|
|
|
|
|
|
|
<el-form-item label="输出顺序:" prop="OutputMode" >
|
|
|
|
|
|
|
|
<el-select v-model="formData.OutputMode" placeholder="选择输出顺序">
|
|
|
|
|
|
|
|
<el-option label="不排序" :value="0"></el-option>
|
|
|
|
|
|
|
|
<el-option label="从左到右" :value="1"></el-option>
|
|
|
|
|
|
|
|
<el-option label="从右到左" :value="2"></el-option>
|
|
|
|
|
|
|
|
<el-option label="从上到下" :value="3"></el-option>
|
|
|
|
|
|
|
|
<el-option label="从下到上" :value="4"></el-option>
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
</el-col>
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-row :gutter="20" style="margin-top: 20px">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-row>
|
|
|
|
</el-collapse-item>
|
|
|
|
</el-collapse-item>
|
|
|
|
</el-collapse>
|
|
|
|
</el-collapse>
|
|
|
|
|
|
|
|
|
|
|
@ -204,8 +277,6 @@
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</ShelfDisplay>
|
|
|
|
</ShelfDisplay>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</el-card>
|
|
|
|
</el-card>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -298,11 +369,14 @@ export default {
|
|
|
|
lastCodeSplit: true,
|
|
|
|
lastCodeSplit: true,
|
|
|
|
isScanCodeCheck: true,
|
|
|
|
isScanCodeCheck: true,
|
|
|
|
getSplitConfirm: false,
|
|
|
|
getSplitConfirm: false,
|
|
|
|
scanMaxCount:null,
|
|
|
|
FixedCount:null,
|
|
|
|
pdaMaxCount: null,
|
|
|
|
pdaMaxCount: null,
|
|
|
|
ipcMaxCount: null,
|
|
|
|
ipcMaxCount: null,
|
|
|
|
|
|
|
|
AutoDecode:1,
|
|
|
|
|
|
|
|
OutputMode:1
|
|
|
|
},
|
|
|
|
},
|
|
|
|
systemParam: null,
|
|
|
|
systemParam: null,
|
|
|
|
|
|
|
|
socket:null,
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -319,6 +393,8 @@ export default {
|
|
|
|
getSet().then((response) => {
|
|
|
|
getSet().then((response) => {
|
|
|
|
if (response.code == 20000) {
|
|
|
|
if (response.code == 20000) {
|
|
|
|
this.formData = response.data
|
|
|
|
this.formData = response.data
|
|
|
|
|
|
|
|
// this.formData.AutoDecode = 1
|
|
|
|
|
|
|
|
// this.formData.OutputMode = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -345,13 +421,73 @@ export default {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
.catch(() => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (this.socket && this.socket.readyState === WebSocket.OPEN){
|
|
|
|
|
|
|
|
if (!isBlank(this.formData.AutoDecode)){
|
|
|
|
|
|
|
|
var setStr = "AutoDecode=" + this.formData.AutoDecode
|
|
|
|
|
|
|
|
this.sendData(setStr)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isBlank(this.formData.FixedCount)){
|
|
|
|
|
|
|
|
var setStr = "FixedCount=" + this.formData.FixedCount
|
|
|
|
|
|
|
|
this.sendData(setStr)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 连接 WebSocket
|
|
|
|
|
|
|
|
connectWebSocket() {
|
|
|
|
|
|
|
|
// WebSocket 服务器地址
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建 WebSocket 连接
|
|
|
|
|
|
|
|
this.socket = new WebSocket('ws://127.0.0.1:9988')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 监听连接成功事件
|
|
|
|
|
|
|
|
this.socket.onopen = () => {
|
|
|
|
|
|
|
|
console.log("WebSocket connected!");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 监听接收消息事件
|
|
|
|
|
|
|
|
this.socket.onmessage = (event) => {
|
|
|
|
|
|
|
|
this.receivedMessage = event.data; // 更新接收到的消息
|
|
|
|
|
|
|
|
console.log("Received message:", event.data);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 监听错误事件
|
|
|
|
|
|
|
|
this.socket.onerror = (error) => {
|
|
|
|
|
|
|
|
console.error("WebSocket error:", error);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 监听连接关闭事件
|
|
|
|
|
|
|
|
this.socket.onclose = () => {
|
|
|
|
|
|
|
|
console.log("WebSocket connection closed.");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 发送数据
|
|
|
|
|
|
|
|
sendData(data) {
|
|
|
|
|
|
|
|
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
|
|
|
|
|
|
|
// const data = JSON.stringify({ action: "subscribe", channel: "updates" }); // 发送的参数
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.socket.send(data); // 发送数据
|
|
|
|
|
|
|
|
console.log("Data sent:", data);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
console.error("WebSocket is not connected.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
// 在组件挂载时创建 WebSocket 连接
|
|
|
|
|
|
|
|
this.connectWebSocket();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
this.selectSysParam()
|
|
|
|
this.selectSysParam()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
|
|
|
// 组件销毁前关闭 WebSocket 连接
|
|
|
|
|
|
|
|
if (this.socket) {
|
|
|
|
|
|
|
|
this.socket.close();
|
|
|
|
|
|
|
|
console.log("WebSocket connection closed in beforeDestroy.");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|