Commit c140e230 by qianmo

add:获取协议版本接口

parent 1e522526
......@@ -3,9 +3,16 @@
<div class="container">
<div class="left">
<div class="mr-4">协议版本</div>
<el-select>
<el-select v-model="value">
<!-- TODO: 选择协议版本 -->
<el-option :value="option"></el-option>
<el-option
v-for="option in options"
:key="option.value"
:label="option.label"
:value="option.value"
>
</el-option>
</el-select>
</div>
<div class="right">
......@@ -68,14 +75,16 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref,onMounted } from 'vue'
import { ElMessage, ElMessageBox } from "element-plus";
import { GetProtocolVersion } from "@/dao/protocol"
import ProtocolTable from "./ProtocolTable.vue";
import type { DeviceProtocolResponse, ProtocolCmdResponse } from './types';
const addCmd = ref<boolean>(false)
const option = ref<string>('option')
const value = ref('')
const options = ref<Array>([])
const protocol_names = ref<Array>([])
const formLabelWidth = '140px'
type propsType = {
......@@ -108,6 +117,28 @@ const open = () => {
})
})
}
function getVersion(){
GetProtocolVersion()
.then((res) => {
for (const item of res){
protocol_names.value.push(item.protocol_name)
if (item.protocol_name === props.name){
let version_paths = JSON.parse(item.version_paths)
for (const item2 of version_paths){
options.value.push({value: item2.version, label: item2.version})
}
}
}
})
.catch((err) => {
console.log(err);
})
}
onMounted(async () => {
getVersion()
})
</script>
<style>
......
import axios from "axios"
const baseURL = 'http://192.168.0.214:8000/op'
export function GetProtocolVersion(){
return axios.get('/api/all_protocol_version/').then(
function (responese){
return responese.data
}
)
}
export function ProtocolInit(protocol_name: string){
return axios.post('api/protocol_version_manage/init/', protocol_name).then(
function (response){
return response.data
}
)
}
\ No newline at end of file
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