Commit 975522b1 by 周田

feat:将设备的通信参数应用到 devinfo 表

parent 5f27157e
...@@ -49,7 +49,7 @@ def set_communication_to_devinfo_table(request): ...@@ -49,7 +49,7 @@ def set_communication_to_devinfo_table(request):
if type is None or type == '': if type is None or type == '':
return Response(status=status.HTTP_400_BAD_REQUEST) return Response(status=status.HTTP_400_BAD_REQUEST)
if type == 'simulate': if type == 'simulate_communicate':
communications = SimulateDeviceCommunicationParameter.objects.all() communications = SimulateDeviceCommunicationParameter.objects.all()
else: else:
communications = DeviceCommunicationParameter.objects.all() communications = DeviceCommunicationParameter.objects.all()
......
<template> <template>
<div class="text-right mb-5"> <div class="text-right mb-5">
<el-button type="primary" @click="applyComunications"> 应用 </el-button>
<el-button type="primary" @click="copy">copy to ini</el-button> <el-button type="primary" @click="copy">copy to ini</el-button>
<el-button type="primary" @click="addDevice">Add device</el-button> <el-button type="primary" @click="addDevice">Add device</el-button>
</div> </div>
...@@ -127,4 +128,26 @@ function composeConfigText(): string { ...@@ -127,4 +128,26 @@ function composeConfigText(): string {
} }
return configText return configText
} }
// 应用设备通信参数
const applyComunications = () => {
console.log('applyComunications')
axios.post('/api/device_communication/set_communication_to_devinfo_table/', {
type: props.tabType
})
.then((res) => {
console.log(res.data);
ElMessage({
message: '应用成功',
type: 'success'
})
})
.catch((err) => {
console.log(err);
ElMessage({
message: '应用失败',
type: 'error'
})
})
}
</script> </script>
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment