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
32693b81
Commit
32693b81
authored
Sep 06, 2023
by
周田
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of
http://git.linkortech.com:10020/ZutJoe/vue_django_test
parents
6471288b
7a675283
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
5 deletions
+71
-5
CollapseTable.vue
frontend/src/components/protocol/CollapseTable.vue
+49
-5
ProtocolTable.vue
frontend/src/components/protocol/ProtocolTable.vue
+2
-0
protocol.ts
frontend/src/dao/protocol.ts
+20
-0
No files found.
frontend/src/components/protocol/CollapseTable.vue
View file @
32693b81
...
...
@@ -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
,
ProtocolInit
}
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,41 @@ const open = () => {
})
})
}
async
function
getVersion
(){
await
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
);
})
}
function
Init
(){
ProtocolInit
({
protocol_name
:
props
.
name
})
.
then
((
res
)
=>
{
options
.
value
.
push
({
value
:
"init"
,
label
:
"init"
})
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
})
}
onMounted
(
async
()
=>
{
await
getVersion
()
if
(
protocol_names
.
value
.
indexOf
(
props
.
name
)
===
-
1
){
Init
()
}
})
</
script
>
<
style
>
...
...
frontend/src/components/protocol/ProtocolTable.vue
View file @
32693b81
...
...
@@ -216,6 +216,7 @@ const rules = reactive<FormRules<typeof fields>>({
const
ruleFormRef
=
ref
<
typeof
ElForm
>
()
const
addField
=
()
=>
{
flag
.
value
=
true
;
more
.
value
=
false
...
...
@@ -238,6 +239,7 @@ const addField = () => {
fields
.
value
.
operabo_out
=
0
dialogVisible
.
value
=
true
;
}
function
editField
(
data
:
CmdInfo
)
{
...
...
frontend/src/dao/protocol.ts
0 → 100644
View file @
32693b81
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
:
any
){
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