Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
seeta-device
/
deviceManage
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4f17e150
authored
Sep 29, 2021
by
温丽香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模板参数修改
1 parent
fc27b493
Pipeline
#4816
passed
in 2 minutes 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
15 deletions
src/views/ParamsModel/edit.vue
src/views/ParamsModel/edit.vue
View file @
4f17e15
...
@@ -66,12 +66,12 @@
...
@@ -66,12 +66,12 @@
v-loading=
"loadingStatus"
>
v-loading=
"loadingStatus"
>
<el-table-column
label=
"字段"
>
<el-table-column
label=
"字段"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<input
type=
"text"
v-model=
"scope.row.field"
@
blur=
"handleBlur"
placeholder=
"请输入"
>
<input
type=
"text"
v-model=
"scope.row.field"
@
blur=
"handleBlur"
placeholder=
"请输入"
:disabled=
"!scope.row.level"
>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"类型"
>
<el-table-column
label=
"类型"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<pack-select
v-model=
"scope.row.type"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
@
change=
"handleChange(scope.row)"
>
<pack-select
v-model=
"scope.row.type"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
@
change=
"handleChange(scope.row)"
:disabled=
"!scope.row.level"
>
<el-option
<el-option
v-for=
"item in typeOptions"
v-for=
"item in typeOptions"
:key=
"item.value"
:key=
"item.value"
...
@@ -83,17 +83,17 @@
...
@@ -83,17 +83,17 @@
</el-table-column>
</el-table-column>
<el-table-column
label=
"值"
>
<el-table-column
label=
"值"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<input
v-if=
"scope.row.type === 'string' || scope.row.type === 'number'"
type=
"text"
v-model=
"scope.row.value"
@
blur=
"handleBlur"
placeholder=
"请输入"
>
<input
v-if=
"scope.row.type === 'string' || scope.row.type === 'number'"
type=
"text"
v-model=
"scope.row.value"
@
blur=
"handleBlur"
placeholder=
"请输入"
:disabled=
"!scope.row.level"
>
<div
class=
"btn-box"
v-if=
"scope.row.type === 'blob'"
>
<div
class=
"btn-box"
v-if=
"scope.row.type === 'blob'"
>
<span
class=
"upload-btn"
v-if=
"!scope.row.value"
>
Select File
</span>
<span
class=
"upload-btn"
v-if=
"!scope.row.value"
>
Select File
</span>
<input
type=
"file"
@
blur=
"handleBlur"
@
change=
"(event) => handleUpload(event, scope.row)"
class=
"input-btn"
v-if=
"!scope.row.value"
>
<input
type=
"file"
@
blur=
"handleBlur"
@
change=
"(event) => handleUpload(event, scope.row)"
class=
"input-btn"
v-if=
"!scope.row.value"
:disabled=
"!scope.row.level"
>
<span
v-if=
"scope.row.value"
style=
"float: left;margin-right: 10px"
>
{{
parseInt
(
calculateByte
(
scope
.
row
.
value
))
}}
字节
</span>
<span
v-if=
"scope.row.value"
style=
"float: left;margin-right: 10px"
>
{{
parseInt
(
calculateByte
(
scope
.
row
.
value
))
}}
字节
</span>
<el-image
v-if=
"scope.row.value"
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"scope.row.value"
fit=
"fit"
>
<el-image
v-if=
"scope.row.value"
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"scope.row.value"
fit=
"fit"
>
<div
slot=
"error"
style=
"width: 80px; height: 28px;overflow: visible"
>
(不可预览)
</div>
<div
slot=
"error"
style=
"width: 80px; height: 28px;overflow: visible"
>
(不可预览)
</div>
</el-image>
</el-image>
</div>
</div>
<div
v-if=
"scope.row.type === 'table'"
>
<div
v-if=
"scope.row.type === 'table'"
>
<pack-select
v-model=
"scope.row.value"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
>
<pack-select
v-model=
"scope.row.value"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
:disabled=
"!scope.row.level"
>
<el-option
<el-option
v-for=
"item in tableOptions"
v-for=
"item in tableOptions"
:key=
"item.name"
:key=
"item.name"
...
@@ -106,7 +106,8 @@
...
@@ -106,7 +106,8 @@
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
>
<el-table-column
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span
@
click=
"handleDelete(scope.$index)"
class=
"delete-btn"
>
删除
</span>
<span
@
click=
"handleRestore(scope.$index, scope.row)"
v-if=
"scope.row.restore"
class=
"delete-btn"
>
撤销覆盖
</span>
<span
@
click=
"handleDelete(scope.$index, scope.row)"
v-else
class=
"delete-btn"
>
删除
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -148,10 +149,15 @@ export default {
...
@@ -148,10 +149,15 @@ export default {
},
{
},
{
value
:
'blob'
,
value
:
'blob'
,
label
:
'blob'
label
:
'blob'
},
{
value
:
'object'
,
label
:
'null'
}],
}],
tableOptions
:
[],
tableOptions
:
[],
baseOptions
:
[],
baseOptions
:
[],
tableData
:
[],
tableData
:
[],
baseData
:
[],
currentData
:
[],
flexHeight
:
0
,
flexHeight
:
0
,
currentRow
:
''
currentRow
:
''
}
}
...
@@ -194,13 +200,46 @@ export default {
...
@@ -194,13 +200,46 @@ export default {
const
scalarsObj
=
res
.
data
.
parameters
.
scalars
const
scalarsObj
=
res
.
data
.
parameters
.
scalars
const
tableObj
=
res
.
data
.
parameters
.
table
const
tableObj
=
res
.
data
.
parameters
.
table
for
(
const
key
in
binaryObj
)
{
for
(
const
key
in
binaryObj
)
{
this
.
table
Data
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
]
})
this
.
current
Data
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
]
})
}
}
for
(
const
key
in
scalarsObj
)
{
for
(
const
key
in
scalarsObj
)
{
this
.
table
Data
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
]
})
this
.
current
Data
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
]
})
}
}
for
(
const
key
in
tableObj
)
{
for
(
const
key
in
tableObj
)
{
this
.
tableData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
this
.
currentData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
}
if
(
this
.
$route
.
query
.
level
===
'2'
)
{
const
base
=
await
detailParameter
({
name
:
res
.
data
.
base
})
if
(
base
&&
base
.
data
&&
base
.
data
.
code
===
0
)
{
const
binaryObj1
=
base
.
data
.
parameters
.
binary
const
scalarsObj1
=
base
.
data
.
parameters
.
scalars
const
tableObj1
=
base
.
data
.
parameters
.
table
for
(
const
key
in
binaryObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj1
[
key
]
})
}
for
(
const
key
in
scalarsObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj1
[
key
],
value
:
scalarsObj1
[
key
]
})
}
for
(
const
key
in
tableObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj1
[
key
]
})
}
}
}
const
tableData
=
[]
for
(
const
value
of
this
.
baseData
)
{
tableData
.
push
({
...
value
,
level
:
0
})
}
for
(
const
value
of
this
.
currentData
)
{
tableData
.
push
({
...
value
,
emit
:
true
,
level
:
1
})
}
const
temp
=
[]
for
(
let
i
=
0
;
i
<
tableData
.
length
;
i
++
)
{
if
(
temp
.
includes
(
tableData
[
i
].
field
))
{
this
.
tableData
[
temp
.
indexOf
(
tableData
[
i
].
field
)]
=
{
...
tableData
[
i
],
level
:
0
,
restore
:
true
}
}
else
{
temp
.
push
(
tableData
[
i
].
field
)
this
.
tableData
.
push
(
tableData
[
i
])
}
}
}
}
}
this
.
loadingStatus
=
false
this
.
loadingStatus
=
false
...
@@ -208,9 +247,30 @@ export default {
...
@@ -208,9 +247,30 @@ export default {
cancel
()
{
cancel
()
{
this
.
$router
.
push
({
path
:
'/params'
})
this
.
$router
.
push
({
path
:
'/params'
})
},
},
handleRestore
(
index
,
row
)
{
const
temp
=
this
.
baseData
[
index
]
this
.
tableData
[
index
]
=
{
...
temp
,
restore
:
false
,
emit
:
false
}
this
.
$forceUpdate
()
},
handleDelete
(
index
,
row
)
{
if
(
!
row
.
emit
)
{
this
.
tableData
[
index
]
=
{
...
row
,
type
:
'null'
,
value
:
null
,
emit
:
true
,
restore
:
true
}
}
else
{
this
.
tableData
.
splice
(
index
,
1
)
}
this
.
$forceUpdate
()
},
async
save
()
{
async
save
()
{
const
tableData
=
this
.
tableData
.
filter
(
item
=>
item
.
field
&&
item
.
value
)
const
tableDataTemp
=
this
.
tableData
.
filter
(
item
=>
item
.
field
!==
''
&&
item
.
value
!==
''
&&
item
.
emit
)
const
scalarsArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'string'
||
item
.
type
===
'number'
)
const
temp
=
[]
const
tableData
=
[]
for
(
let
i
=
0
;
i
<
tableDataTemp
.
length
;
i
++
)
{
if
(
!
temp
.
includes
(
tableDataTemp
[
i
].
field
))
{
temp
.
push
(
tableDataTemp
[
i
].
field
)
tableData
.
push
(
tableDataTemp
[
i
])
}
}
const
scalarsArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'string'
||
item
.
type
===
'number'
||
item
.
type
===
'null'
)
const
binaryArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'blob'
)
const
binaryArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'blob'
)
const
tableArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'table'
)
const
tableArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'table'
)
const
scalarsObj
=
{}
const
scalarsObj
=
{}
...
@@ -242,10 +302,7 @@ export default {
...
@@ -242,10 +302,7 @@ export default {
row
.
value
=
await
fileToBase64
(
event
.
target
.
files
[
0
])
row
.
value
=
await
fileToBase64
(
event
.
target
.
files
[
0
])
},
},
insertTableData
()
{
insertTableData
()
{
this
.
tableData
.
push
({
field
:
''
,
type
:
''
,
value
:
''
})
this
.
tableData
.
push
({
field
:
''
,
type
:
''
,
value
:
''
,
emit
:
true
,
level
:
1
})
},
handleDelete
(
index
)
{
this
.
tableData
.
splice
(
index
,
1
)
},
},
handleChange
(
row
)
{
handleChange
(
row
)
{
row
.
value
=
''
row
.
value
=
''
...
@@ -264,6 +321,7 @@ export default {
...
@@ -264,6 +321,7 @@ export default {
event
.
target
&&
event
.
target
.
classList
&&
event
.
target
.
classList
.
remove
(
'write'
)
event
.
target
&&
event
.
target
.
classList
&&
event
.
target
.
classList
.
remove
(
'write'
)
},
},
cellClick
(
row
,
column
,
cell
,
event
)
{
cellClick
(
row
,
column
,
cell
,
event
)
{
if
(
!
row
.
level
)
return
if
(
cell
.
getElementsByTagName
(
'input'
)[
0
])
{
if
(
cell
.
getElementsByTagName
(
'input'
)[
0
])
{
cell
.
getElementsByTagName
(
'input'
)[
0
].
classList
.
add
(
'write'
)
cell
.
getElementsByTagName
(
'input'
)[
0
].
classList
.
add
(
'write'
)
cell
.
getElementsByTagName
(
'input'
)[
0
].
focus
()
cell
.
getElementsByTagName
(
'input'
)[
0
].
focus
()
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment