Commit 7a675283 by qianmo

add:init

parent c140e230
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref,onMounted } from 'vue' import { ref,onMounted } from 'vue'
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import { GetProtocolVersion } from "@/dao/protocol" import { GetProtocolVersion,ProtocolInit } from "@/dao/protocol"
import ProtocolTable from "./ProtocolTable.vue"; import ProtocolTable from "./ProtocolTable.vue";
import type { DeviceProtocolResponse, ProtocolCmdResponse } from './types'; import type { DeviceProtocolResponse, ProtocolCmdResponse } from './types';
...@@ -118,8 +118,8 @@ const open = () => { ...@@ -118,8 +118,8 @@ const open = () => {
}) })
} }
function getVersion(){ async function getVersion(){
GetProtocolVersion() await GetProtocolVersion()
.then((res) => { .then((res) => {
for (const item of res){ for (const item of res){
protocol_names.value.push(item.protocol_name) protocol_names.value.push(item.protocol_name)
...@@ -136,8 +136,21 @@ function getVersion(){ ...@@ -136,8 +136,21 @@ function getVersion(){
}) })
} }
function Init(){
ProtocolInit({protocol_name: props.name})
.then((res) => {
options.value.push({value: "init", label: "init"})
})
.catch((err) => {
console.log(err);
})
}
onMounted(async () => { onMounted(async () => {
getVersion() await getVersion()
if (protocol_names.value.indexOf(props.name) === -1){
Init()
}
}) })
</script> </script>
......
...@@ -10,7 +10,7 @@ export function GetProtocolVersion(){ ...@@ -10,7 +10,7 @@ export function GetProtocolVersion(){
) )
} }
export function ProtocolInit(protocol_name: string){ export function ProtocolInit(protocol_name: any){
return axios.post('api/protocol_version_manage/init/', protocol_name).then( return axios.post('api/protocol_version_manage/init/', protocol_name).then(
function (response){ function (response){
return response.data return response.data
......
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