Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue_django_test
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周田
vue_django_test
Commits
c140e230
Commit
c140e230
authored
Sep 06, 2023
by
qianmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:获取协议版本接口
parent
1e522526
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
5 deletions
+56
-5
CollapseTable.vue
frontend/src/components/protocol/CollapseTable.vue
+36
-5
protocol.ts
frontend/src/dao/protocol.ts
+20
-0
No files found.
frontend/src/components/protocol/CollapseTable.vue
View file @
c140e230
...
@@ -3,9 +3,16 @@
...
@@ -3,9 +3,16 @@
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"left"
>
<div
class=
"left"
>
<div
class=
"mr-4"
>
协议版本
</div>
<div
class=
"mr-4"
>
协议版本
</div>
<el-select>
<el-select
v-model=
"value"
>
<!-- TODO: 选择协议版本 -->
<!-- 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>
</el-select>
</div>
</div>
<div
class=
"right"
>
<div
class=
"right"
>
...
@@ -68,14 +75,16 @@
...
@@ -68,14 +75,16 @@
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
}
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
ProtocolTable
from
"./ProtocolTable.vue"
;
import
ProtocolTable
from
"./ProtocolTable.vue"
;
import
type
{
DeviceProtocolResponse
,
ProtocolCmdResponse
}
from
'./types'
;
import
type
{
DeviceProtocolResponse
,
ProtocolCmdResponse
}
from
'./types'
;
const
addCmd
=
ref
<
boolean
>
(
false
)
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'
const
formLabelWidth
=
'140px'
type
propsType
=
{
type
propsType
=
{
...
@@ -108,6 +117,28 @@ const open = () => {
...
@@ -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
>
</
script
>
<
style
>
<
style
>
...
...
frontend/src/dao/protocol.ts
0 → 100644
View file @
c140e230
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment