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
fce834bf
Commit
fce834bf
authored
Aug 18, 2023
by
qianmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 增加/修改/删除字段完成时不刷新整个页面
parent
6d6c3ac1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
4 deletions
+26
-4
protpcol-table.vue
frontend/src/components/protpcol-table.vue
+17
-4
device.js
frontend/src/dao/device.js
+9
-0
xdc.sqlite
xdc.sqlite
+0
-0
No files found.
frontend/src/components/protpcol-table.vue
View file @
fce834bf
...
...
@@ -159,7 +159,7 @@
<
script
setup
>
import
{
ref
,
toRefs
}
from
'vue'
import
{
ElMessage
,
ElMessageBox
}
from
"element-plus"
;
import
{
DeleteProtocolCmd
,
EditProtocolCmd
}
from
"../dao/device"
;
import
{
AddProtocolCMd
,
DeleteProtocolCmd
,
EditProtocolCmd
}
from
"../dao/device"
;
const
flag
=
ref
(
false
)
const
dialogVisible
=
ref
(
false
)
...
...
@@ -242,6 +242,7 @@ const addField = () => {
}
fields
.
value
[
'cmd_name'
]
=
toRefs
(
props
).
info
.
value
fields
.
value
[
'cmd_type'
]
=
toRefs
(
props
).
type
.
value
fields
.
value
[
'fieldindex'
]
=
tableData
.
value
.
length
+
1
fields
.
value
[
'minvalue'
]
=
'null'
fields
.
value
[
'maxvalue'
]
=
'null'
fields
.
value
[
'lua_script_in'
]
=
'null'
...
...
@@ -283,6 +284,10 @@ async function Delete(id){
await
DeleteProtocolCmd
(
id
)
}
async
function
Add
(
params
){
await
AddProtocolCMd
(
params
)
}
function
confirm
(
str
,
data
){
if
(
str
===
'delete'
){
operation
=
'删除'
...
...
@@ -316,11 +321,19 @@ function confirm(str, data){
}
}
Edit
(
params
[
'id'
],
params
)
window
.
location
.
reload
()
for
(
const
item
of
Object
.
keys
(
fields
.
value
)){
tableData
.
value
[
fields
.
value
[
'fieldindex'
]
-
1
][
item
]
=
fields
.
value
[
item
]
}
}
else
if
(
operation
===
'删除'
){
console
.
log
(
"id"
,
data
[
'id'
])
Delete
(
data
[
'id'
])
window
.
location
.
reload
()
tableData
.
value
.
splice
(
data
[
'fieldindex'
]
-
1
,
1
)
}
else
if
(
operation
===
'增加'
){
Add
(
fields
.
value
)
let
params
=
{}
for
(
const
item
of
Object
.
keys
(
fields
.
value
)){
params
[
item
]
=
fields
.
value
[
item
]
}
tableData
.
value
.
push
(
params
)
}
})
.
catch
(()
=>
{
...
...
frontend/src/dao/device.js
View file @
fce834bf
...
...
@@ -29,4 +29,12 @@ export function DeleteProtocolCmd(id){
return
response
.
data
}
)
}
export
function
AddProtocolCMd
(
params
){
return
axios
.
post
(
'http://192.168.0.214:8000/op/all_dev_cmd_define/'
,
params
).
then
(
function
(
response
){
return
response
.
data
}
)
}
\ No newline at end of file
xdc.sqlite
View file @
fce834bf
No preview for this file type
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