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 5a70ba20
authored
Oct 09, 2021
by
温丽香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
参数模板修改完成
1 parent
092017ee
Pipeline
#4936
passed
in 2 minutes 14 seconds
Changes
5
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
201 additions
and
90 deletions
src/views/DataList/edit.vue
src/views/DataList/index.vue
src/views/ParamsModel/add.vue
src/views/ParamsModel/detail.vue
src/views/ParamsModel/edit.vue
src/views/DataList/edit.vue
View file @
5a70ba2
...
@@ -98,7 +98,7 @@ export default {
...
@@ -98,7 +98,7 @@ export default {
content
:
''
,
content
:
''
,
isBase64
:
false
,
isBase64
:
false
,
loadingStatus
:
false
,
loadingStatus
:
false
,
totalColumns
:
0
,
totalColumns
:
Number
(
this
.
$route
.
query
.
columns
)
,
typeOptions
:
[{
typeOptions
:
[{
value
:
'base64'
,
value
:
'base64'
,
label
:
'base64'
label
:
'base64'
...
@@ -142,7 +142,6 @@ export default {
...
@@ -142,7 +142,6 @@ export default {
const
str
=
decode
.
length
>
64
?
'blob'
:
isASCII
(
decode
)
?
decode
:
'blob'
const
str
=
decode
.
length
>
64
?
'blob'
:
isASCII
(
decode
)
?
decode
:
'blob'
return
str
return
str
})
})
this
.
totalColumns
=
item
.
binary
.
length
return
item
return
item
})
})
this
.
total
=
res
.
data
.
table
.
total
this
.
total
=
res
.
data
.
table
.
total
...
...
src/views/DataList/index.vue
View file @
5a70ba2
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
}"
}"
:outerLoading="loadingStatus">
:outerLoading="loadingStatus">
<div
slot=
"operate"
slot-scope=
"row"
>
<div
slot=
"operate"
slot-scope=
"row"
>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/data/edit', query: { name: row.name } })">编辑
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/data/edit', query: { name: row.name
, columns: row.columns
} })">编辑
</span>
<span
class=
"operate operate-delete"
@
click=
"handleDelete(row)"
>
删除
</span>
<span
class=
"operate operate-delete"
@
click=
"handleDelete(row)"
>
删除
</span>
</div>
</div>
</st-table>
</st-table>
...
...
src/views/ParamsModel/add.vue
View file @
5a70ba2
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
clearable
clearable
>
>
</st-select>
-->
</st-select>
-->
<el-select
v-model=
"form.base"
placeholder=
"请选择"
style=
"width: 400px;height: 32px;line-height: 32px"
>
<el-select
v-model=
"form.base"
placeholder=
"请选择"
style=
"width: 400px;height: 32px;line-height: 32px"
@
change=
"handleSelectBase"
>
<el-option
<el-option
v-for=
"item in baseOptions"
v-for=
"item in baseOptions"
:key=
"item.name"
:key=
"item.name"
...
@@ -65,12 +65,12 @@
...
@@ -65,12 +65,12 @@
style=
"width: 100%"
>
style=
"width: 100%"
>
<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=
"Boolean(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=
"Boolean(scope.row.level)"
>
<el-option
<el-option
v-for=
"item in typeOptions"
v-for=
"item in typeOptions"
:key=
"item.value"
:key=
"item.value"
...
@@ -87,8 +87,8 @@
...
@@ -87,8 +87,8 @@
<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"
>
<span
v-if=
"scope.row.value"
>
<span
v-if=
"scope.row.value"
>
<span
style=
"float: left;margin-right: 10px"
>
{{
calculateByte
(
scope
.
row
.
value
)
}}
字节
</span>
<span
style=
"float: left;margin-right: 10px"
@
click=
"scope.row.value = ''"
>
{{
calculateByte
(
scope
.
row
.
value
)
}}
字节
</span>
<el-image
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"scope.row.value"
fit=
"fit"
>
<el-image
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"scope.row.value"
fit=
"fit"
:preview-src-list=
"[scope.row.value]"
>
<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>
</span>
</span>
...
@@ -107,7 +107,9 @@
...
@@ -107,7 +107,9 @@
</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=
"handleHidden(scope.row)"
class=
"delete-btn"
style=
"color: #E6A23C"
v-if=
"scope.row.level"
>
隐藏
</span>
<span
@
click=
"handleReturnBack(scope.row, scope.$index)"
style=
"color: #409EFF"
class=
"delete-btn"
v-if=
"scope.row.level && scope.row.value != originalData[scope.$index].value"
>
撤回
</span>
<span
@
click=
"handleDelete(scope.$index)"
class=
"delete-btn"
v-if=
"!scope.row.level"
>
删除
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -126,7 +128,7 @@
...
@@ -126,7 +128,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
createParameter
,
getTable
,
getParameter
}
from
'@/axios'
import
{
createParameter
,
getTable
,
getParameter
,
detailParameter
}
from
'@/axios'
import
{
fileToBase64
}
from
'@/utils/typeConversion'
import
{
fileToBase64
}
from
'@/utils/typeConversion'
import
{
calculateByte
}
from
'@/utils/system'
import
{
calculateByte
}
from
'@/utils/system'
import
Dialog
from
'@/helpers/dialog'
import
Dialog
from
'@/helpers/dialog'
...
@@ -151,6 +153,7 @@ export default {
...
@@ -151,6 +153,7 @@ export default {
tableOptions
:
[],
tableOptions
:
[],
baseOptions
:
[],
baseOptions
:
[],
tableData
:
[],
tableData
:
[],
originalData
:
[],
flexHeight
:
0
,
flexHeight
:
0
,
currentRow
:
''
currentRow
:
''
}
}
...
@@ -183,8 +186,36 @@ export default {
...
@@ -183,8 +186,36 @@ export default {
this
.
baseOptions
=
res
.
data
.
parameters
.
datas
this
.
baseOptions
=
res
.
data
.
parameters
.
datas
}
}
},
},
async
handleSelectBase
(
value
)
{
const
res
=
await
detailParameter
({
name
:
value
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
tableData
=
[]
const
binaryObj
=
res
.
data
.
parameters
.
binary
const
scalarsObj
=
res
.
data
.
parameters
.
scalars
const
tableObj
=
res
.
data
.
parameters
.
table
for
(
const
key
in
binaryObj
)
{
this
.
tableData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
],
level
:
1
})
}
for
(
const
key
in
scalarsObj
)
{
this
.
tableData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
],
level
:
1
})
}
for
(
const
key
in
tableObj
)
{
this
.
tableData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
],
level
:
1
})
}
this
.
originalData
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableData
))
}
},
async
save
()
{
async
save
()
{
const
tableData
=
this
.
tableData
.
filter
(
item
=>
item
.
field
&&
item
.
value
)
const
tableDataTemp
=
this
.
tableData
.
filter
(
item
=>
item
.
field
!==
''
&&
item
.
type
!==
''
&&
item
.
value
!==
''
)
// 最终提交的数据字段名不重复
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'
)
const
scalarsArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'string'
||
item
.
type
===
'number'
)
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'
)
...
@@ -192,7 +223,7 @@ export default {
...
@@ -192,7 +223,7 @@ export default {
const
binaryObj
=
{}
const
binaryObj
=
{}
const
tableObj
=
{}
const
tableObj
=
{}
for
(
let
i
=
0
;
i
<
scalarsArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
scalarsArr
.
length
;
i
++
)
{
scalarsObj
[
scalarsArr
[
i
].
field
]
=
scalarsArr
[
i
].
value
scalarsObj
[
scalarsArr
[
i
].
field
]
=
scalarsArr
[
i
].
value
===
null
?
null
:
(
scalarsArr
[
i
].
type
===
'number'
?
Number
(
scalarsArr
[
i
].
value
)
:
String
(
scalarsArr
[
i
].
value
))
}
}
for
(
let
j
=
0
;
j
<
binaryArr
.
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
binaryArr
.
length
;
j
++
)
{
binaryObj
[
binaryArr
[
j
].
field
]
=
binaryArr
[
j
].
value
binaryObj
[
binaryArr
[
j
].
field
]
=
binaryArr
[
j
].
value
...
@@ -210,11 +241,13 @@ export default {
...
@@ -210,11 +241,13 @@ export default {
})
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
Toast
.
success
(
'操作成功'
)
Toast
.
success
(
'操作成功'
)
this
.
$router
.
push
({
path
:
'/params'
})
//
this.$router.push({ path: '/params' })
}
}
},
},
cancel
()
{
cancel
()
{
this
.
$router
.
push
({
path
:
'/params'
})
// this.$router.push({ path: '/params' })
this
.
form
=
{}
this
.
tableData
=
[]
},
},
async
handleUpload
(
event
,
row
)
{
async
handleUpload
(
event
,
row
)
{
row
.
value
=
await
fileToBase64
(
event
.
target
.
files
[
0
])
row
.
value
=
await
fileToBase64
(
event
.
target
.
files
[
0
])
...
@@ -222,8 +255,17 @@ export default {
...
@@ -222,8 +255,17 @@ export default {
insertTableData
()
{
insertTableData
()
{
this
.
tableData
.
push
({
field
:
''
,
type
:
''
,
value
:
''
})
this
.
tableData
.
push
({
field
:
''
,
type
:
''
,
value
:
''
})
},
},
handleReturnBack
(
row
,
index
)
{
row
.
value
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
originalData
[
index
])).
value
this
.
$forceUpdate
()
},
handleHidden
(
row
)
{
row
.
value
=
null
this
.
$forceUpdate
()
},
handleDelete
(
index
)
{
handleDelete
(
index
)
{
this
.
tableData
.
splice
(
index
,
1
)
this
.
tableData
.
splice
(
index
,
1
)
this
.
$forceUpdate
()
},
},
setFlexHeight
()
{
setFlexHeight
()
{
const
ele
=
document
.
getElementsByClassName
(
'flex-item'
)
&&
document
.
getElementsByClassName
(
'flex-item'
)[
0
]
const
ele
=
document
.
getElementsByClassName
(
'flex-item'
)
&&
document
.
getElementsByClassName
(
'flex-item'
)[
0
]
...
@@ -242,6 +284,7 @@ export default {
...
@@ -242,6 +284,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
&&
(
column
.
label
===
'字段'
||
column
.
label
===
'类型'
))
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
()
...
...
src/views/ParamsModel/detail.vue
View file @
5a70ba2
...
@@ -26,20 +26,22 @@
...
@@ -26,20 +26,22 @@
:options=
"definitions"
:options=
"definitions"
:pagination=
"false"
:pagination=
"false"
:data=
"
{
:data=
"
{
list: t
okenList
,
list: t
ableData
,
total: total,
total: total,
}"
}"
:outerLoading="loadingStatus">
:outerLoading="loadingStatus">
<div
slot=
"value"
slot-scope=
"row"
>
<div
slot=
"value"
slot-scope=
"row"
>
<span
v-if=
"row.value === null"
class=
"cell-null"
>
null
</span>
<span
v-else
>
<span
v-if=
"row.type === 'number' || row.type === 'string'"
>
{{
row
.
value
}}
</span>
<span
v-if=
"row.type === 'number' || row.type === 'string'"
>
{{
row
.
value
}}
</span>
<span
v-if=
"row.type === 'blob'"
style=
"line-height: 28px"
>
<span
v-if=
"row.type === 'blob'"
style=
"line-height: 28px"
>
<!-- TODO -->
<span
style=
"float: left;margin-right: 10px"
>
{{
parseInt
(
calculateByte
(
row
.
value
))
}}
字节
</span>
<span
style=
"float: left;margin-right: 10px"
>
{{
parseInt
(
calculateByte
(
row
.
value
))
}}
字节
</span>
<el-image
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"row.value"
fit=
"fit
"
>
<el-image
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"row.value"
fit=
"fit"
:preview-src-list=
"[row.value]
"
>
<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>
</span>
</span>
<span
v-if=
"row.type === 'table'"
style=
"color: #409EFF; cursor: pointer"
@
click=
"$router.push(
{ path: '/data/edit', query: { name: row.value } })">
{{
row
.
value
}}
</span>
<span
v-if=
"row.type === 'table'"
style=
"color: #409EFF; cursor: pointer"
@
click=
"handleToTableDetail(row.value)"
>
{{
row
.
value
}}
</span>
</span>
</div>
</div>
</st-table>
</st-table>
</st-form-item>
</st-form-item>
...
@@ -49,7 +51,7 @@
...
@@ -49,7 +51,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
detailParameter
}
from
'@/axios'
import
{
detailParameter
,
getTable
}
from
'@/axios'
import
{
calculateByte
}
from
'@/utils/system'
import
{
calculateByte
}
from
'@/utils/system'
export
default
{
export
default
{
data
()
{
data
()
{
...
@@ -71,7 +73,8 @@ export default {
...
@@ -71,7 +73,8 @@ export default {
slotName
:
'value'
slotName
:
'value'
}
}
],
],
tokenList
:
[],
baseData
:
[],
tableData
:
[],
total
:
0
total
:
0
}
}
},
},
...
@@ -79,24 +82,69 @@ export default {
...
@@ -79,24 +82,69 @@ export default {
this
.
loadingStatus
=
true
this
.
loadingStatus
=
true
const
res
=
await
detailParameter
({
name
:
this
.
$route
.
query
.
name
})
const
res
=
await
detailParameter
({
name
:
this
.
$route
.
query
.
name
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
let
binaryObj
=
{}
let
scalarsObj
=
{}
let
tableObj
=
{}
let
binaryObj1
=
{}
let
scalarsObj1
=
{}
let
tableObj1
=
{}
if
(
res
.
data
.
base
)
{
const
base
=
await
detailParameter
({
name
:
res
.
data
.
base
})
if
(
base
&&
base
.
data
&&
base
.
data
.
code
===
0
)
{
binaryObj1
=
base
.
data
.
parameters
.
binary
scalarsObj1
=
base
.
data
.
parameters
.
scalars
tableObj1
=
base
.
data
.
parameters
.
table
this
.
baseObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
binaryObj1
)),
JSON
.
parse
(
JSON
.
stringify
(
scalarsObj1
)),
JSON
.
parse
(
JSON
.
stringify
(
tableObj1
)))
for
(
const
key
in
binaryObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj1
[
key
],
level
:
1
})
}
for
(
const
key
in
scalarsObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj1
[
key
],
value
:
scalarsObj1
[
key
],
level
:
1
})
}
for
(
const
key
in
tableObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj1
[
key
],
level
:
1
})
}
}
}
this
.
form
=
res
.
data
this
.
form
=
res
.
data
const
binaryObj
=
res
.
data
.
parameters
.
binary
binaryObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
binaryObj1
)),
res
.
data
.
parameters
.
binary
)
const
scalarsObj
=
res
.
data
.
parameters
.
scalars
scalarsObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
scalarsObj1
)),
res
.
data
.
parameters
.
scalars
)
const
tableObj
=
res
.
data
.
parameters
.
table
tableObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
tableObj1
)),
res
.
data
.
parameters
.
table
)
const
frontData
=
[]
const
endData
=
[]
for
(
const
key
in
binaryObj
)
{
for
(
const
key
in
binaryObj
)
{
this
.
tokenList
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
]
})
if
(
binaryObj1
[
key
])
{
frontData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
],
level
:
1
})
}
else
{
endData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
]
})
}
}
}
for
(
const
key
in
scalarsObj
)
{
for
(
const
key
in
scalarsObj
)
{
this
.
tokenList
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
]
})
if
(
scalarsObj1
[
key
])
{
frontData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
],
level
:
1
})
}
else
{
endData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
]
})
}
}
}
for
(
const
key
in
tableObj
)
{
for
(
const
key
in
tableObj
)
{
this
.
tokenList
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
if
(
tableObj1
[
key
])
{
frontData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
],
level
:
1
})
}
else
{
endData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
}
}
}
this
.
tableData
=
frontData
.
concat
(
endData
)
}
}
this
.
loadingStatus
=
false
this
.
loadingStatus
=
false
},
},
methods
:
{
methods
:
{
calculateByte
:
base64
=>
calculateByte
(
base64
),
calculateByte
:
base64
=>
calculateByte
(
base64
),
async
handleToTableDetail
(
name
)
{
const
res
=
await
getTable
({
pages
:
0
,
pagesize
:
1
,
name
:
name
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
$router
.
push
({
path
:
'/data/edit'
,
query
:
{
name
:
name
,
columns
:
res
.
data
.
data
&&
res
.
data
.
data
.
tables
.
length
&&
res
.
data
.
data
.
tables
[
0
].
columns
}
})
}
}
}
}
}
}
</
script
>
</
script
>
...
@@ -121,4 +169,12 @@ export default {
...
@@ -121,4 +169,12 @@ export default {
::v-deep
.cell
::v-deep
.cell
height
:
28px
height
:
28px
line-height
:
28px
!
important
line-height
:
28px
!
important
.cell-null
display
:
inline-block
height
:
26px
line-height
:
26px
padding
:
0
10px
color
:
#fff
background
:
#ccc
border-radius
:
4px
</
style
>
</
style
>
src/views/ParamsModel/edit.vue
View file @
5a70ba2
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
<st-form-item
<st-form-item
:label=
"'模板类型'+':'"
:label=
"'模板类型'+':'"
prop=
"type"
>
prop=
"type"
>
<st-input
v-model=
"form.type"
></st-input>
<st-input
v-model=
"form.type"
:disabled=
"true"
></st-input>
</st-form-item>
</st-form-item>
<st-form-item
<st-form-item
:label=
"'基础模板'+':'"
:label=
"'基础模板'+':'"
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
clearable
clearable
>
>
</st-select>
-->
</st-select>
-->
<el-select
v-model=
"form.base"
placeholder=
"请选择"
style=
"width: 400px;height: 32px;line-height: 32px"
>
<el-select
v-model=
"form.base"
placeholder=
"请选择"
style=
"width: 400px;height: 32px;line-height: 32px"
:disabled=
"true"
>
<el-option
<el-option
v-for=
"item in baseOptions"
v-for=
"item in baseOptions"
:key=
"item.name"
:key=
"item.name"
...
@@ -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=
"请输入"
:disabled=
"
!scope.row.level
"
>
<input
type=
"text"
v-model=
"scope.row.field"
@
blur=
"handleBlur"
placeholder=
"请输入"
:disabled=
"
Boolean(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)"
:disabled=
"
!scope.row.level
"
>
<pack-select
v-model=
"scope.row.type"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
@
change=
"handleChange(scope.row)"
:disabled=
"
Boolean(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,22 @@
...
@@ -83,17 +83,22 @@
</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=
"请输入"
:disabled=
"!scope.row.level"
>
<!-- string number -->
<input
v-if=
"scope.row.type === 'string' || scope.row.type === 'number'"
type=
"text"
v-model=
"scope.row.value"
@
blur=
"handleBlur"
placeholder=
"请输入"
:style=
"
{color: scope.row.value != freezeData[scope.$index].value ? '#F56C6C' : ''}">
<!-- blob -->
<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"
:disabled=
"!scope.row.level"
>
<input
type=
"file"
@
blur=
"handleBlur"
@
change=
"(event) => handleUpload(event, scope.row)"
class=
"input-btn"
v-if=
"!scope.row.value"
>
<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=
"
{color: scope.row.value != freezeData[scope.$index].value ? '#F56C6C' : ''}">
<el-image
v-if=
"scope.row.value"
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"scope.row.value"
fit=
"fit"
>
<span
style=
"float: left;margin-right: 10px"
@
click=
"scope.row.value = ''"
>
{{
parseInt
(
calculateByte
(
scope
.
row
.
value
))
}}
字节
</span>
<el-image
style=
"width: 42px; height: 28px;overflow: visible"
:src=
"scope.row.value"
fit=
"fit"
:preview-src-list=
"[scope.row.value]"
>
<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>
</span>
</div>
</div>
<div
v-if=
"scope.row.type === 'table'"
>
<!-- table -->
<pack-select
v-model=
"scope.row.value"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
:disabled=
"!scope.row.level"
>
<div
v-if=
"scope.row.type === 'table'"
:class=
"
{updated: scope.row.value != freezeData[scope.$index].value ? true : false}">
<pack-select
v-model=
"scope.row.value"
placeholder=
"请选择"
@
blur=
"handleBlur"
@
visible-change=
"handleVisibleChange"
>
<el-option
<el-option
v-for=
"item in tableOptions"
v-for=
"item in tableOptions"
:key=
"item.name"
:key=
"item.name"
...
@@ -106,8 +111,9 @@
...
@@ -106,8 +111,9 @@
</el-table-column>
</el-table-column>
<el-table-column
label=
"操作"
>
<el-table-column
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span
@
click=
"handleRestore(scope.$index, scope.row)"
v-if=
"scope.row.restore"
class=
"delete-btn"
>
撤销覆盖
</span>
<span
@
click=
"handleHidden(scope.row)"
class=
"delete-btn"
style=
"color: #E6A23C"
v-if=
"scope.row.level"
>
隐藏
</span>
<span
@
click=
"handleDelete(scope.$index, scope.row)"
v-else
class=
"delete-btn"
>
删除
</span>
<span
@
click=
"handleReturnBack(scope.row, scope.$index)"
style=
"color: #409EFF"
class=
"delete-btn"
v-if=
"scope.row.level && baseObj[scope.row.field] != scope.row.value"
>
撤回
</span>
<span
@
click=
"handleDelete(scope.$index)"
class=
"delete-btn"
v-if=
"!scope.row.level"
>
删除
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -149,15 +155,14 @@ export default {
...
@@ -149,15 +155,14 @@ export default {
},
{
},
{
value
:
'blob'
,
value
:
'blob'
,
label
:
'blob'
label
:
'blob'
},
{
value
:
'object'
,
label
:
'null'
}],
}],
tableOptions
:
[],
tableOptions
:
[],
baseOptions
:
[],
baseOptions
:
[],
tableData
:
[],
tableData
:
[],
freezeData
:
[],
baseData
:
[],
baseData
:
[],
currentData
:
[],
tableObj
:
{},
baseObj
:
{},
flexHeight
:
0
,
flexHeight
:
0
,
currentRow
:
''
currentRow
:
''
}
}
...
@@ -195,77 +200,81 @@ export default {
...
@@ -195,77 +200,81 @@ export default {
this
.
loadingStatus
=
true
this
.
loadingStatus
=
true
const
res
=
await
detailParameter
({
name
:
this
.
$route
.
query
.
name
})
const
res
=
await
detailParameter
({
name
:
this
.
$route
.
query
.
name
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
form
=
res
.
data
let
binaryObj
=
{}
const
binaryObj
=
res
.
data
.
parameters
.
binary
let
scalarsObj
=
{}
const
scalarsObj
=
res
.
data
.
parameters
.
scalars
let
tableObj
=
{}
const
tableObj
=
res
.
data
.
parameters
.
table
let
binaryObj1
=
{}
for
(
const
key
in
binaryObj
)
{
let
scalarsObj1
=
{}
this
.
currentData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
]
})
let
tableObj1
=
{}
}
if
(
this
.
$route
.
query
.
level
===
'2'
&&
res
.
data
.
base
)
{
for
(
const
key
in
scalarsObj
)
{
this
.
currentData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
]
})
}
for
(
const
key
in
tableObj
)
{
this
.
currentData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
}
if
(
this
.
$route
.
query
.
level
===
'2'
)
{
const
base
=
await
detailParameter
({
name
:
res
.
data
.
base
})
const
base
=
await
detailParameter
({
name
:
res
.
data
.
base
})
if
(
base
&&
base
.
data
&&
base
.
data
.
code
===
0
)
{
if
(
base
&&
base
.
data
&&
base
.
data
.
code
===
0
)
{
const
binaryObj1
=
base
.
data
.
parameters
.
binary
binaryObj1
=
base
.
data
.
parameters
.
binary
const
scalarsObj1
=
base
.
data
.
parameters
.
scalars
scalarsObj1
=
base
.
data
.
parameters
.
scalars
const
tableObj1
=
base
.
data
.
parameters
.
table
tableObj1
=
base
.
data
.
parameters
.
table
this
.
baseObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
binaryObj1
)),
JSON
.
parse
(
JSON
.
stringify
(
scalarsObj1
)),
JSON
.
parse
(
JSON
.
stringify
(
tableObj1
)))
for
(
const
key
in
binaryObj1
)
{
for
(
const
key
in
binaryObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj1
[
key
]
})
this
.
baseData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj1
[
key
]
,
level
:
1
})
}
}
for
(
const
key
in
scalarsObj1
)
{
for
(
const
key
in
scalarsObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj1
[
key
],
value
:
scalarsObj1
[
key
]
})
this
.
baseData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj1
[
key
],
value
:
scalarsObj1
[
key
]
,
level
:
1
})
}
}
for
(
const
key
in
tableObj1
)
{
for
(
const
key
in
tableObj1
)
{
this
.
baseData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj1
[
key
]
})
this
.
baseData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj1
[
key
]
,
level
:
1
})
}
}
}
}
}
}
const
tableData
=
[]
this
.
form
=
res
.
data
for
(
const
value
of
this
.
baseData
)
{
binaryObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
binaryObj1
)),
res
.
data
.
parameters
.
binary
)
if
(
value
.
type
===
'object'
)
{
scalarsObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
scalarsObj1
)),
res
.
data
.
parameters
.
scalars
)
tableData
.
push
({
...
value
,
emit
:
true
,
level
:
0
})
tableObj
=
Object
.
assign
(
JSON
.
parse
(
JSON
.
stringify
(
tableObj1
)),
res
.
data
.
parameters
.
table
)
const
frontData
=
[]
const
endData
=
[]
for
(
const
key
in
binaryObj
)
{
if
(
binaryObj1
[
key
])
{
frontData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
],
level
:
1
})
}
else
{
}
else
{
tableData
.
push
({
...
value
,
level
:
0
})
endData
.
push
({
field
:
key
,
type
:
'blob'
,
value
:
binaryObj
[
key
]
})
}
}
}
}
for
(
const
value
of
this
.
currentData
)
{
for
(
const
key
in
scalarsObj
)
{
tableData
.
push
({
...
value
,
emit
:
true
,
level
:
1
})
if
(
scalarsObj1
[
key
])
{
frontData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj1
[
key
],
value
:
scalarsObj
[
key
],
level
:
1
})
}
else
{
endData
.
push
({
field
:
key
,
type
:
typeof
scalarsObj
[
key
],
value
:
scalarsObj
[
key
]
})
}
}
const
temp
=
[]
}
for
(
let
i
=
0
;
i
<
tableData
.
length
;
i
++
)
{
for
(
const
key
in
tableObj
)
{
if
(
t
emp
.
includes
(
tableData
[
i
].
field
)
)
{
if
(
t
ableObj1
[
key
]
)
{
this
.
tableData
[
temp
.
indexOf
(
tableData
[
i
].
field
)]
=
{
...
tableData
[
i
],
level
:
0
,
restore
:
true
}
frontData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
],
level
:
1
})
}
else
{
}
else
{
temp
.
push
(
tableData
[
i
].
field
)
endData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
this
.
tableData
.
push
(
tableData
[
i
])
}
}
}
}
this
.
tableData
=
frontData
.
concat
(
endData
)
this
.
freezeData
=
Object
.
freeze
(
JSON
.
parse
(
JSON
.
stringify
(
this
.
tableData
)))
}
}
this
.
loadingStatus
=
false
this
.
loadingStatus
=
false
},
},
cancel
()
{
cancel
()
{
this
.
$router
.
push
({
path
:
'/params'
})
this
.
getData
()
// this.$router.push({ path: '/params' })
},
},
handleRestore
(
index
,
row
)
{
handleHidden
(
row
)
{
const
temp
=
this
.
baseData
[
index
]
row
.
value
=
null
this
.
tableData
[
index
]
=
{
...
temp
,
restore
:
false
,
emit
:
false
}
this
.
$forceUpdate
()
this
.
$forceUpdate
()
},
},
handleDelete
(
index
,
row
)
{
handleReturnBack
(
row
,
index
)
{
if
(
!
row
.
emit
)
{
row
.
value
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
baseData
[
index
])).
value
this
.
tableData
[
index
]
=
{
...
row
,
type
:
'object'
,
value
:
null
,
emit
:
true
,
restore
:
true
}
this
.
$forceUpdate
()
}
else
{
},
handleDelete
(
index
)
{
this
.
tableData
.
splice
(
index
,
1
)
this
.
tableData
.
splice
(
index
,
1
)
}
this
.
$forceUpdate
()
this
.
$forceUpdate
()
},
},
async
save
()
{
async
save
()
{
const
tableDataTemp
=
this
.
tableData
.
filter
(
item
=>
item
.
field
!==
''
&&
item
.
value
!==
''
&&
item
.
emit
)
const
tableDataTemp
=
this
.
tableData
.
filter
(
item
=>
item
.
field
!==
''
&&
item
.
type
!==
''
&&
item
.
value
!==
''
)
// 最终提交的数据字段名不重复
const
temp
=
[]
const
temp
=
[]
const
tableData
=
[]
const
tableData
=
[]
for
(
let
i
=
0
;
i
<
tableDataTemp
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
tableDataTemp
.
length
;
i
++
)
{
...
@@ -274,14 +283,14 @@ export default {
...
@@ -274,14 +283,14 @@ export default {
tableData
.
push
(
tableDataTemp
[
i
])
tableData
.
push
(
tableDataTemp
[
i
])
}
}
}
}
const
scalarsArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'string'
||
item
.
type
===
'number'
||
item
.
type
===
'object'
)
const
scalarsArr
=
tableData
.
filter
(
item
=>
item
.
type
===
'string'
||
item
.
type
===
'number'
)
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
=
{}
const
binaryObj
=
{}
const
binaryObj
=
{}
const
tableObj
=
{}
const
tableObj
=
{}
for
(
let
i
=
0
;
i
<
scalarsArr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
scalarsArr
.
length
;
i
++
)
{
scalarsObj
[
scalarsArr
[
i
].
field
]
=
scalarsArr
[
i
].
value
scalarsObj
[
scalarsArr
[
i
].
field
]
=
scalarsArr
[
i
].
value
===
null
?
null
:
(
scalarsArr
[
i
].
type
===
'number'
?
Number
(
scalarsArr
[
i
].
value
)
:
String
(
scalarsArr
[
i
].
value
))
}
}
for
(
let
j
=
0
;
j
<
binaryArr
.
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
binaryArr
.
length
;
j
++
)
{
binaryObj
[
binaryArr
[
j
].
field
]
=
binaryArr
[
j
].
value
binaryObj
[
binaryArr
[
j
].
field
]
=
binaryArr
[
j
].
value
...
@@ -299,14 +308,15 @@ export default {
...
@@ -299,14 +308,15 @@ export default {
})
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
Toast
.
success
(
'操作成功'
)
Toast
.
success
(
'操作成功'
)
this
.
$router
.
push
({
path
:
'/params'
})
this
.
getData
()
// this.$router.push({ path: '/params' })
}
}
},
},
async
handleUpload
(
event
,
row
)
{
async
handleUpload
(
event
,
row
)
{
row
.
value
=
await
fileToBase64
(
event
.
target
.
files
[
0
])
row
.
value
=
await
fileToBase64
(
event
.
target
.
files
[
0
])
},
},
insertTableData
()
{
insertTableData
()
{
this
.
tableData
.
push
({
field
:
''
,
type
:
''
,
value
:
''
,
emit
:
true
,
level
:
1
})
this
.
tableData
.
push
({
field
:
''
,
type
:
''
,
value
:
''
})
},
},
handleChange
(
row
)
{
handleChange
(
row
)
{
row
.
value
=
''
row
.
value
=
''
...
@@ -325,7 +335,7 @@ export default {
...
@@ -325,7 +335,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
(
row
.
level
&&
(
column
.
label
===
'字段'
||
column
.
label
===
'类型'
)
)
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
()
...
@@ -401,6 +411,9 @@ export default {
...
@@ -401,6 +411,9 @@ export default {
color
:
#666
color
:
#666
background
:
rgba
(
0
,
0
,
0
,
0
)
background
:
rgba
(
0
,
0
,
0
,
0
)
height
:
32px
height
:
32px
.updated
::v-deep
input
[
type
=
text
],
::v-deep
input
[
type
=
password
],
::v-deep
input
[
type
=
number
],
::v-deep
textarea
color
:
#F56C6C
!
important
::v-deep
thead
::v-deep
thead
font-size
:
14px
font-size
:
14px
font-family
:
PingFang-SC-Bold
,
PingFang-SC
font-family
:
PingFang-SC-Bold
,
PingFang-SC
...
...
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