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 d178de9b
authored
Aug 30, 2021
by
温丽香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据列表修改
1 parent
b8a5458d
Pipeline
#3855
passed
in 1 minute 51 seconds
Changes
10
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
161 additions
and
137 deletions
.eslintrc.js
src/axios.js
src/utils/typeConversion.js
src/views/Account/index.vue
src/views/Apply/index.vue
src/views/DataList/edit.vue
src/views/DataList/index.vue
src/views/ParamsModel/detail.vue
src/views/ParamsModel/edit.vue
src/views/ParamsModel/index.vue
.eslintrc.js
View file @
d178de9
...
@@ -56,7 +56,7 @@ module.exports = {
...
@@ -56,7 +56,7 @@ module.exports = {
'no-unneeded-ternary'
:
2
,
// 禁止不必要的嵌套
'no-unneeded-ternary'
:
2
,
// 禁止不必要的嵌套
'no-nested-ternary'
:
2
,
// 禁用嵌套的三目运算符
'no-nested-ternary'
:
0
,
// 禁用嵌套的三目运算符
'no-const-assign'
:
2
,
// 禁止修改 const 变量
'no-const-assign'
:
2
,
// 禁止修改 const 变量
...
...
src/axios.js
View file @
d178de9
...
@@ -17,7 +17,9 @@ const TABLE = '/table'
...
@@ -17,7 +17,9 @@ const TABLE = '/table'
export
const
getTable
=
data
=>
axios
(
GET
,
FRONT
+
TABLE
+
'/query_list'
,
data
)
export
const
getTable
=
data
=>
axios
(
GET
,
FRONT
+
TABLE
+
'/query_list'
,
data
)
export
const
createTable
=
data
=>
axios
(
POST
,
FRONT
+
TABLE
+
'/create'
,
data
)
export
const
createTable
=
data
=>
axios
(
POST
,
FRONT
+
TABLE
+
'/create'
,
data
)
export
const
deleteTable
=
data
=>
axios
(
GET
,
FRONT
+
TABLE
+
'/delete'
,
data
)
export
const
deleteTable
=
data
=>
axios
(
GET
,
FRONT
+
TABLE
+
'/delete'
,
data
)
export
const
insertTable
=
data
=>
axios
(
POST
,
FRONT
+
TABLE
+
'/insert'
,
data
)
export
const
addData
=
data
=>
axios
(
POST
,
FRONT
+
TABLE
+
'/data/insert'
,
data
)
export
const
getData
=
data
=>
axios
(
GET
,
FRONT
+
TABLE
+
'/data/query_list'
,
data
)
export
const
deleteData
=
data
=>
axios
(
POST
,
FRONT
+
TABLE
+
'/data/delete'
,
data
)
const
APPID
=
'/appid'
const
APPID
=
'/appid'
export
const
getApp
=
data
=>
axios
(
GET
,
FRONT
+
APPID
+
'/query_list'
,
data
)
export
const
getApp
=
data
=>
axios
(
GET
,
FRONT
+
APPID
+
'/query_list'
,
data
)
...
...
src/utils/typeConversion.js
View file @
d178de9
...
@@ -36,8 +36,9 @@ export const stringToBase64 = str => {
...
@@ -36,8 +36,9 @@ export const stringToBase64 = str => {
export
const
base64ToString
=
base64
=>
{
export
const
base64ToString
=
base64
=>
{
// 对base64转编码
// 对base64转编码
const
decode
=
atob
(
base64
)
const
decode
=
atob
(
base64
)
const
temp
=
decode
.
replace
(
/%/g
,
'%25'
)
// 编码转字符串
// 编码转字符串
const
str
=
decodeURI
(
decode
)
const
str
=
decodeURI
(
temp
)
return
str
return
str
}
}
...
...
src/views/Account/index.vue
View file @
d178de9
...
@@ -44,7 +44,8 @@
...
@@ -44,7 +44,8 @@
:data=
"
{
:data=
"
{
list: tokenList,
list: tokenList,
total: total,
total: total,
}">
}"
:outerLoading="loadingStatus">
<div
slot=
"operate"
slot-scope=
"row"
>
<div
slot=
"operate"
slot-scope=
"row"
>
<span
class=
"operate"
@
click=
"handleEdit(row)"
>
编辑
</span>
<span
class=
"operate"
@
click=
"handleEdit(row)"
>
编辑
</span>
<span
class=
"operate operate-delete"
@
click=
"handleDelete(row)"
>
删除
</span>
<span
class=
"operate operate-delete"
@
click=
"handleDelete(row)"
>
删除
</span>
...
...
src/views/Apply/index.vue
View file @
d178de9
...
@@ -12,15 +12,16 @@
...
@@ -12,15 +12,16 @@
:data=
"
{
:data=
"
{
list: tokenList,
list: tokenList,
total: total,
total: total,
}">
}"
:outerLoading="loadingStatus">
<div
slot=
"secret"
slot-scope=
"row"
>
<div
slot=
"secret"
slot-scope=
"row"
>
<span
v-if=
"showSecret === row.
number"
class=
"secret-box"
>
{{
row
.
desc
}}
</span>
<span
v-if=
"showSecret === row.
appid"
class=
"secret-box"
>
{{
row
.
secret
}}
</span>
<span
v-else
class=
"secret-box"
>
********
</span>
<span
v-else
class=
"secret-box"
>
********
</span>
<i
class=
"el-icon-view eye-btn"
@
mousedown=
"showSecret = row.
number
"
@
mouseup=
"showSecret = ''"
></i>
<i
class=
"el-icon-view eye-btn"
@
mousedown=
"showSecret = row.
appid
"
@
mouseup=
"showSecret = ''"
></i>
</div>
</div>
<div
slot=
"operate"
slot-scope=
"row"
>
<div
slot=
"operate"
slot-scope=
"row"
>
<span
class=
"operate"
v-if=
"row.number === 1"
@
click=
"setHostApp"
>
设置为主应用
</span>
<span
class=
"operate"
v-if=
"row.number === 1"
@
click=
"setHostApp
(row)
"
>
设置为主应用
</span>
<span
class=
"operate"
v-else
@
click=
"
cancelHostApp
"
>
取消设置为主应用
</span>
<span
class=
"operate"
v-else
@
click=
"
setHostApp(row)
"
>
取消设置为主应用
</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>
...
@@ -31,16 +32,17 @@
...
@@ -31,16 +32,17 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
getApp
}
from
'@/axios'
import
{
getApp
,
deleteApp
,
setApp
}
from
'@/axios'
import
Dialog
from
'@/helpers/dialog'
import
Dialog
from
'@/helpers/dialog'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
showSecret
:
''
,
showSecret
:
''
,
loadingStatus
:
false
,
definitions
:
[
definitions
:
[
{
{
label
:
'APPID'
,
label
:
'APPID'
,
render
:
'
number
'
render
:
'
appid
'
},
},
{
{
label
:
'Secret'
,
label
:
'Secret'
,
...
@@ -49,15 +51,15 @@ export default {
...
@@ -49,15 +51,15 @@ export default {
},
},
{
{
label
:
'创建时间'
,
label
:
'创建时间'
,
render
:
'
typ
e'
render
:
'
create_dat
e'
},
},
{
{
label
:
'设备数量'
,
label
:
'设备数量'
,
render
:
'de
sc
'
render
:
'de
vices
'
},
},
{
{
label
:
'说明'
,
label
:
'说明'
,
render
:
'desc'
render
:
'desc
ription
'
},
},
{
{
label
:
'操作'
,
label
:
'操作'
,
...
@@ -67,7 +69,7 @@ export default {
...
@@ -67,7 +69,7 @@ export default {
},
},
],
],
tokenList
:
[],
tokenList
:
[],
total
:
34
total
:
0
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -75,24 +77,31 @@ export default {
...
@@ -75,24 +77,31 @@ export default {
},
},
methods
:
{
methods
:
{
async
getData
()
{
async
getData
()
{
this
.
loadingStatus
=
true
const
res
=
await
getApp
({
pages
:
0
,
pagesize
:
10
})
const
res
=
await
getApp
({
pages
:
0
,
pagesize
:
10
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
tokenList
=
res
.
data
.
data
.
apps
this
.
tokenList
=
res
.
data
.
data
.
apps
this
.
total
=
res
.
data
.
data
.
total
this
.
total
=
res
.
data
.
data
.
total
}
}
this
.
loadingStatus
=
false
},
},
async
handleDelete
(
row
)
{
async
handleDelete
(
row
)
{
console
.
log
(
row
)
const
confirmDelete
=
await
Dialog
.
confirm
(
'提示'
,
{
message
:
'是否删除此应用?'
})
const
confirmDelete
=
await
Dialog
.
confirm
(
'提示'
,
{
message
:
'是否删除此应用?'
})
if
(
!
confirmDelete
)
return
if
(
!
confirmDelete
)
return
const
res
=
await
this
.
getData
()
const
res
=
await
deleteApp
({
appid
:
row
.
appid
})
if
(
res
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
Toast
.
success
(
'操作成功'
)
this
.
getData
()
}
},
async
setHostApp
(
row
)
{
const
res
=
await
setApp
({
appid
:
row
.
appid
,
mainapp
:
1
,
username
:
'test'
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
Toast
.
success
(
'操作成功'
)
Toast
.
success
(
'操作成功'
)
this
.
getData
()
this
.
getData
()
}
}
},
},
setHostApp
()
{},
cancelHostApp
()
{}
cancelHostApp
()
{}
}
}
}
}
...
...
src/views/DataList/edit.vue
View file @
d178de9
...
@@ -28,22 +28,23 @@
...
@@ -28,22 +28,23 @@
<div
class=
"list-content"
>
<div
class=
"list-content"
>
<el-table
:max-height=
"flexHeight"
<el-table
:max-height=
"flexHeight"
ref=
"singleTable"
ref=
"singleTable"
:data=
"tableData"
:data=
"tableData
.concat(insertData)
"
highlight-current-row
highlight-current-row
@
current-change=
"currentChange"
@
current-change=
"currentChange"
@
row-click=
"rowClick"
@
row-click=
"rowClick"
@
cell-click=
"cellClick"
@
cell-click=
"cellClick"
style=
"width: 100%"
>
style=
"width: 100%"
v-loading=
"loadingStatus"
>
<el-table-column
label=
"序号"
width=
"100px"
>
<el-table-column
label=
"序号"
width=
"100px"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<span
style=
"margin-left: 12px"
>
{{
scope
.
row
.
fiel
d
}}
</span>
<span
style=
"margin-left: 12px"
>
{{
scope
.
row
.
i
d
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
v-for=
"
(column, index) in tableData[0].columns"
:key=
"index"
:label=
"`列${index + 1}`"
:min-width=
"index + 1
=== columnIndex ? '220px' : ''"
>
<el-table-column
v-for=
"
index of totalColumns"
:key=
"index"
:label=
"`列${index}`"
:min-width=
"index
=== columnIndex ? '220px' : ''"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<!--
<div
class=
"column-box"
>
-->
<div
style=
"display: flex"
>
<div
style=
"display: flex"
>
<pack-select
v-model=
"scope.row.columns[index].type"
@
blur=
"handleBlur"
@
change=
"value => handleTypeChange(value, scope.row.columns[index])"
placeholder=
"请选择"
class=
"none-display"
style=
"margin-right: 10px"
>
<span
type=
"text"
v-if=
"scope.row.id !== ''"
class=
"cell-span"
>
{{
scope
.
row
.
binary
[
index
-
1
]
}}
</span>
<pack-select
v-if=
"scope.row.id === ''"
v-model=
"scope.row.binary[index - 1].type"
@
blur=
"handleBlur"
@
change=
"value => handleTypeChange(value, scope.row.binary[index - 1])"
placeholder=
"请选择"
class=
"none-display"
style=
"margin-right: 10px"
>
<el-option
<el-option
v-for=
"item in typeOptions"
v-for=
"item in typeOptions"
:key=
"item.value"
:key=
"item.value"
...
@@ -51,24 +52,16 @@
...
@@ -51,24 +52,16 @@
:value=
"item.value"
>
:value=
"item.value"
>
</el-option>
</el-option>
</pack-select>
</pack-select>
<input
type=
"text"
v-model=
"scope.row.columns[index].value"
@
blur=
"handleBlur"
placeholder=
"请输入"
class=
"cell-value"
<input
type=
"text"
v-if=
"scope.row.id === ''"
v-model=
"scope.row.binary[index - 1].value"
@
blur=
"handleBlur"
placeholder=
"请输入"
class=
"cell-value"
:style=
"
{border: scope.row.columns[index].type === 'base64'
&&
!base64Pattern.test(scope.row.columns[index].value) ? '1px solid #F56C6C' : 'none'}"
:style=
"
{border: scope.row.binary[index - 1].type === 'base64'
&&
!base64Pattern.test(scope.row.binary[index - 1]) ? '1px solid #F56C6C' : 'none'}"
@input="event => checkBase64(event.target, scope.row.columns[index])"
@input="event => checkBase64(event.target, scope.row.binary[index - 1])"
@focus="event => handleFocus(event.target, scope.row.columns[index])">
@focus="event => handleFocus(event.target, scope.row.binary[index - 1])">
<!--
<el-select
v-model=
"scope.row.columns[index].type"
placeholder=
"请选择"
>
<el-option
v-for=
"item in typeOptions"
:key=
"item.value"
:label=
"item.label"
:value=
"item.value"
>
</el-option>
</el-select>
-->
</div>
</div>
</
template
>
</
template
>
</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.row)"
class=
"delete-btn"
>
删除
</span>
<span
@
click=
"handleDelete(scope.row
, scope.$index
)"
class=
"delete-btn"
>
删除
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -77,30 +70,33 @@
...
@@ -77,30 +70,33 @@
@
size-change=
"handleSizeChange"
@
size-change=
"handleSizeChange"
@
current-change=
"handlePageChange"
@
current-change=
"handlePageChange"
:current-page=
"1"
:current-page=
"1"
:page-sizes=
"[10
0, 200, 300, 4
00]"
:page-sizes=
"[10
, 20, 50, 1
00]"
:page-size=
"10
0
"
:page-size=
"10"
layout=
"total, prev, pager, next, sizes, jumper"
layout=
"total, prev, pager, next, sizes, jumper"
:total=
"
400
"
>
:total=
"
total
"
>
</el-pagination>
</el-pagination>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"buttons"
>
<div
class=
"buttons"
>
<st-button
@
click=
"cancel"
><span
class=
"text"
>
{{'取消'}}
</span></st-button>
<st-button
@
click=
"cancel"
:disabled=
"!insertData.length"
><span
class=
"text"
>
{{'取消'}}
</span></st-button>
<st-button
type=
"primary"
@
click=
"save"
><span
class=
"text"
>
{{'保存'}}
</span></st-button>
<st-button
type=
"primary"
@
click=
"save"
:disabled=
"!insertData.length"
><span
class=
"text"
>
{{'保存'}}
</span></st-button>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
{
insertTable
}
from
'@/axios'
import
{
addData
,
getData
,
deleteData
}
from
'@/axios'
import
Dialog
from
'@/helpers/dialog'
import
Dialog
from
'@/helpers/dialog'
import
{
base64ToString
,
stringToBase64
,
isASCII
}
from
'@/utils/typeConversion'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
inputVal
:
''
,
inputVal
:
''
,
isBase64
:
false
,
isBase64
:
false
,
loadingStatus
:
false
,
totalColumns
:
Number
(
this
.
$route
.
query
.
columns
),
typeOptions
:
[{
typeOptions
:
[{
value
:
'base64'
,
value
:
'base64'
,
label
:
'base64'
label
:
'base64'
...
@@ -109,52 +105,11 @@ export default {
...
@@ -109,52 +105,11 @@ export default {
label
:
'string'
label
:
'string'
}],
}],
orderOptions
:
[],
orderOptions
:
[],
tableData
:
[{
currentPage
:
1
,
field
:
'1'
,
currentSize
:
10
,
columns
:
[
tableData
:
[],
{
type
:
'base64'
,
value
:
'1222'
},
insertData
:
[],
{
type
:
'string'
,
value
:
'1222'
},
total
:
0
,
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
}
]
},
{
field
:
'2'
,
columns
:
[
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
}
]
},
{
field
:
'3'
,
columns
:
[
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
}
]
},
{
field
:
'4'
,
columns
:
[
{
type
:
'string'
,
value
:
'上海市普陀上海市普陀'
},
{
type
:
'string'
,
value
:
'上海市普陀上海市普陀'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'base64'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'1222'
},
{
type
:
'string'
,
value
:
'上海市普陀上海市普陀'
}
]
}],
total
:
34
,
agoCell
:
null
,
agoCell
:
null
,
currentInput
:
null
,
currentInput
:
null
,
base64Pattern
:
/^
([
A-Za-z0-9+
/]{4})
*
([
A-Za-z0-9+
/]{4}
|
[
A-Za-z0-9+
/]{3}
=|
[
A-Za-z0-9+
/]{2}
==
)
$/
,
base64Pattern
:
/^
([
A-Za-z0-9+
/]{4})
*
([
A-Za-z0-9+
/]{4}
|
[
A-Za-z0-9+
/]{3}
=|
[
A-Za-z0-9+
/]{2}
==
)
$/
,
...
@@ -172,8 +127,25 @@ export default {
...
@@ -172,8 +127,25 @@ export default {
this
.
setFlexHeight
()
this
.
setFlexHeight
()
},
10
)
},
10
)
}
}
this
.
getData
()
},
},
methods
:
{
methods
:
{
async
getData
()
{
this
.
loadingStatus
=
true
const
res
=
await
getData
({
name
:
this
.
$route
.
query
.
name
,
pages
:
this
.
currentPage
-
1
,
pagesize
:
this
.
currentSize
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
tableData
=
res
.
data
.
table
.
data
.
map
(
item
=>
{
item
.
binary
=
item
.
binary
.
map
(
base64
=>
{
const
decode
=
base64ToString
(
base64
)
const
str
=
decode
.
length
>
64
?
'blob'
:
isASCII
(
decode
)
?
decode
:
'blob'
return
str
})
return
item
})
this
.
total
=
res
.
data
.
table
.
total
}
this
.
loadingStatus
=
false
},
handleTypeChange
(
value
,
param
)
{
handleTypeChange
(
value
,
param
)
{
this
.
checkBase64
(
this
.
currentInput
,
param
)
this
.
checkBase64
(
this
.
currentInput
,
param
)
},
},
...
@@ -186,30 +158,47 @@ export default {
...
@@ -186,30 +158,47 @@ export default {
target
.
style
.
border
=
'none'
target
.
style
.
border
=
'none'
return
return
}
}
if
(
!
this
.
base64Pattern
.
test
(
param
.
value
))
{
if
(
param
.
type
===
'base64'
&&
param
.
value
&&
!
this
.
base64Pattern
.
test
(
param
.
value
))
{
target
.
style
.
border
=
'1px solid #F56C6C'
target
.
style
.
border
=
'1px solid #F56C6C'
}
else
{
}
else
{
target
.
style
.
border
=
'none'
target
.
style
.
border
=
'none'
}
}
},
},
cancel
()
{
cancel
()
{
// this.getData() 取消后所有修改都撤销
this
.
getData
()
// 取消后所有修改都撤销
this
.
insertData
=
[]
// 取消后所有修改都撤销
this
.
clearCell
(
this
.
agoCell
)
this
.
clearCell
(
this
.
agoCell
)
this
.
setCurrent
()
this
.
setCurrent
()
},
},
async
save
()
{
async
save
()
{
this
.
clearCell
(
this
.
agoCell
)
this
.
clearCell
(
this
.
agoCell
)
this
.
setCurrent
()
this
.
setCurrent
()
const
res
=
await
insertTable
({
const
binaryData
=
[]
name
:
'demo'
,
const
insertData
=
this
.
insertData
.
map
(
item
=>
{
binary
:
[
return
item
.
binary
[
'dGhpcyBpcyBhIHRlc3Qy'
,
'emhhbmc='
],
[
'dGhpcyBpcyBhIHRlc3Qz'
,
'c2FuY2h1'
],
[
'dGhpcyBpcyBhIHRlc3Qx'
,
'c2FuY2g1'
],
]
})
})
if
(
res
&&
res
.
data
)
{
insertData
.
map
(
item
=>
{
const
binaryItem
=
[]
item
.
map
(
ite
=>
{
if
(
ite
.
type
===
'string'
)
{
binaryItem
.
push
(
stringToBase64
(
ite
.
value
))
}
if
(
ite
.
type
===
'base64'
)
{
binaryItem
.
push
(
ite
.
value
)
}
})
if
(
binaryItem
.
length
===
Number
(
this
.
$route
.
query
.
columns
))
{
binaryData
.
push
(
binaryItem
)
}
})
const
res
=
await
addData
({
name
:
this
.
$route
.
query
.
name
,
binary
:
binaryData
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
insertData
=
[]
Toast
.
success
(
'操作成功'
)
this
.
getData
()
}
}
},
},
setFlexHeight
()
{
setFlexHeight
()
{
...
@@ -217,34 +206,29 @@ export default {
...
@@ -217,34 +206,29 @@ export default {
this
.
flexHeight
=
ele
&&
ele
.
clientHeight
this
.
flexHeight
=
ele
&&
ele
.
clientHeight
},
},
addTableData
()
{
addTableData
()
{
this
.
tableData
.
push
({
const
binary
=
[]
field
:
'5'
,
for
(
let
i
=
0
;
i
<
Number
(
this
.
$route
.
query
.
columns
);
i
++
)
{
columns
:
[
binary
.
push
({
type
:
''
,
value
:
''
})
{
type
:
'base64'
,
value
:
''
},
}
{
type
:
'string'
,
value
:
''
},
this
.
insertData
.
push
({
{
type
:
'base64'
,
value
:
''
},
id
:
''
,
{
type
:
'base64'
,
value
:
''
},
binary
{
type
:
'string'
,
value
:
''
},
{
type
:
'string'
,
value
:
''
},
{
type
:
'base64'
,
value
:
''
}
]
})
})
},
},
async
handleDelete
(
row
)
{
async
handleDelete
(
row
,
index
)
{
console
.
log
(
row
)
if
(
!
row
.
id
)
{
this
.
insertData
.
splice
(
index
-
this
.
tableData
.
length
,
1
)
return
}
const
confirmDelete
=
await
Dialog
.
confirm
(
'提示'
,
{
message
:
'是否删除此数据?'
})
const
confirmDelete
=
await
Dialog
.
confirm
(
'提示'
,
{
message
:
'是否删除此数据?'
})
if
(
!
confirmDelete
)
return
if
(
!
confirmDelete
)
return
const
res
=
await
this
.
getData
(
)
const
res
=
await
deleteData
({
name
:
this
.
$route
.
query
.
name
,
id
:
[
row
.
id
]
}
)
if
(
res
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
Toast
.
success
(
'操作成功'
)
Toast
.
success
(
'操作成功'
)
this
.
getData
()
this
.
getData
()
}
}
},
},
// handleBlur(event) {
// this.setCurrent()
// event.target && event.target.classList && event.target.classList.remove('write')
// },
handleBlur
(
event
)
{
handleBlur
(
event
)
{
event
.
path
.
map
(
item
=>
{
event
.
path
.
map
(
item
=>
{
if
(
item
.
classList
&&
Array
.
from
(
item
.
classList
).
includes
(
'cell'
))
{
if
(
item
.
classList
&&
Array
.
from
(
item
.
classList
).
includes
(
'cell'
))
{
...
@@ -261,19 +245,13 @@ export default {
...
@@ -261,19 +245,13 @@ export default {
input
&&
input
[
0
]
&&
input
[
0
].
classList
.
remove
(
'write'
)
input
&&
input
[
0
]
&&
input
[
0
].
classList
.
remove
(
'write'
)
input
&&
input
[
1
]
&&
input
[
1
].
classList
.
remove
(
'write'
)
input
&&
input
[
1
]
&&
input
[
1
].
classList
.
remove
(
'write'
)
},
},
// cellClick(row, column, cell, event) {
// if (cell.getElementsByTagName('input')[0]) {
// cell.getElementsByTagName('input')[0].classList.add('write')
// cell.getElementsByTagName('input')[0].focus()
// }
// },
cellClick
(
row
,
column
,
cell
,
event
)
{
cellClick
(
row
,
column
,
cell
,
event
)
{
if
(
column
.
label
===
'序号'
||
column
.
label
===
'操作'
)
return
if
(
column
.
label
===
'序号'
||
column
.
label
===
'操作'
)
return
if
(
this
.
agoCell
!==
cell
)
{
if
(
this
.
agoCell
!==
cell
)
{
this
.
clearCell
(
this
.
agoCell
)
this
.
clearCell
(
this
.
agoCell
)
}
}
this
.
columnIndex
=
Number
(
column
.
label
.
substring
(
1
))
this
.
columnIndex
=
Number
(
column
.
label
.
substring
(
1
))
cell
.
getElementsByClassName
(
'el-select'
)[
0
].
classList
.
remove
(
'none-display'
)
cell
.
getElementsByClassName
(
'el-select'
)[
0
]
&&
cell
.
getElementsByClassName
(
'el-select'
)[
0
]
.
classList
.
remove
(
'none-display'
)
if
(
cell
.
getElementsByTagName
(
'input'
)[
0
]
&&
cell
.
getElementsByTagName
(
'input'
)[
1
])
{
if
(
cell
.
getElementsByTagName
(
'input'
)[
0
]
&&
cell
.
getElementsByTagName
(
'input'
)[
1
])
{
cell
.
getElementsByTagName
(
'input'
)[
0
].
classList
.
add
(
'write'
)
cell
.
getElementsByTagName
(
'input'
)[
0
].
classList
.
add
(
'write'
)
cell
.
getElementsByTagName
(
'input'
)[
1
].
classList
.
add
(
'write'
)
cell
.
getElementsByTagName
(
'input'
)[
1
].
classList
.
add
(
'write'
)
...
@@ -296,8 +274,14 @@ export default {
...
@@ -296,8 +274,14 @@ export default {
this
.
setCurrent
()
this
.
setCurrent
()
}
}
},
},
handleSizeChange
()
{},
handleSizeChange
(
val
)
{
handlePageChange
()
{}
this
.
currentSize
=
val
this
.
getData
()
},
handlePageChange
(
val
)
{
this
.
currentPage
=
val
this
.
getData
()
}
}
}
}
}
</
script
>
</
script
>
...
@@ -455,6 +439,11 @@ export default {
...
@@ -455,6 +439,11 @@ export default {
font-family
:
PingFangSC-Regular
,
PingFang
SC
font-family
:
PingFangSC-Regular
,
PingFang
SC
font-weight
:
400
font-weight
:
400
color
:
#999999
!
important
color
:
#999999
!
important
.cell-span
display
:
inline-block
height
:
32px
line-height
:
32px
padding-left
:
10px
.buttons
.buttons
position
:
absolute
position
:
absolute
bottom
:
0
bottom
:
0
...
...
src/views/DataList/index.vue
View file @
d178de9
...
@@ -20,9 +20,10 @@
...
@@ -20,9 +20,10 @@
:data=
"
{
:data=
"
{
list: tokenList,
list: tokenList,
total: total,
total: total,
}">
}"
:outerLoading="loadingStatus">
<div
slot=
"operate"
slot-scope=
"row"
>
<div
slot=
"operate"
slot-scope=
"row"
>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/data/edit' })">编辑
</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>
...
@@ -66,6 +67,7 @@ export default {
...
@@ -66,6 +67,7 @@ export default {
return
{
return
{
inputVal
:
''
,
inputVal
:
''
,
showDialog
:
false
,
showDialog
:
false
,
loadingStatus
:
false
,
form
:
{},
form
:
{},
definitions
:
[
definitions
:
[
{
{
...
@@ -126,11 +128,13 @@ export default {
...
@@ -126,11 +128,13 @@ export default {
},
},
methods
:
{
methods
:
{
async
getData
()
{
async
getData
()
{
this
.
loadingStatus
=
true
const
res
=
await
getTable
({
pages
:
this
.
currentPage
-
1
,
pagesize
:
this
.
currentSize
})
const
res
=
await
getTable
({
pages
:
this
.
currentPage
-
1
,
pagesize
:
this
.
currentSize
})
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
code
===
0
)
{
this
.
tokenList
=
res
.
data
.
data
.
tables
this
.
tokenList
=
res
.
data
.
data
.
tables
this
.
total
=
res
.
data
.
data
.
total
this
.
total
=
res
.
data
.
data
.
total
}
}
this
.
loadingStatus
=
false
},
},
cancelSubmit
()
{
cancelSubmit
()
{
this
.
form
=
{}
this
.
form
=
{}
...
...
src/views/ParamsModel/detail.vue
View file @
d178de9
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
:data=
"
{
:data=
"
{
list: tokenList,
list: tokenList,
total: total,
total: total,
}">
}"
:outerLoading="loadingStatus">
<div
slot=
"value"
slot-scope=
"row"
>
<div
slot=
"value"
slot-scope=
"row"
>
<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"
>
...
@@ -54,6 +55,7 @@ export default {
...
@@ -54,6 +55,7 @@ export default {
data
()
{
data
()
{
return
{
return
{
form
:
{},
form
:
{},
loadingStatus
:
false
,
definitions
:
[
definitions
:
[
{
{
label
:
'字段'
,
label
:
'字段'
,
...
@@ -74,6 +76,7 @@ export default {
...
@@ -74,6 +76,7 @@ export default {
}
}
},
},
async
mounted
()
{
async
mounted
()
{
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
this
.
form
=
res
.
data
...
@@ -90,6 +93,7 @@ export default {
...
@@ -90,6 +93,7 @@ export default {
this
.
tokenList
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
this
.
tokenList
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
}
}
}
}
this
.
loadingStatus
=
false
},
},
methods
:
{
methods
:
{
calculateByte
:
base64
=>
calculateByte
(
base64
),
calculateByte
:
base64
=>
calculateByte
(
base64
),
...
...
src/views/ParamsModel/edit.vue
View file @
d178de9
...
@@ -62,7 +62,8 @@
...
@@ -62,7 +62,8 @@
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
@
row-click=
"rowClick"
@
row-click=
"rowClick"
@
cell-click=
"cellClick"
@
cell-click=
"cellClick"
style=
"width: 100%"
>
style=
"width: 100%"
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=
"请输入"
>
...
@@ -134,6 +135,7 @@ export default {
...
@@ -134,6 +135,7 @@ export default {
form
:
{},
form
:
{},
rules
:
[],
rules
:
[],
file
:
''
,
file
:
''
,
loadingStatus
:
false
,
typeOptions
:
[{
typeOptions
:
[{
value
:
'number'
,
value
:
'number'
,
label
:
'number'
label
:
'number'
...
@@ -184,6 +186,7 @@ export default {
...
@@ -184,6 +186,7 @@ export default {
}
}
},
},
async
getData
()
{
async
getData
()
{
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
this
.
form
=
res
.
data
...
@@ -200,6 +203,7 @@ export default {
...
@@ -200,6 +203,7 @@ export default {
this
.
tableData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
this
.
tableData
.
push
({
field
:
key
,
type
:
'table'
,
value
:
tableObj
[
key
]
})
}
}
}
}
this
.
loadingStatus
=
false
},
},
cancel
()
{
cancel
()
{
this
.
$router
.
push
({
path
:
'/params'
})
this
.
$router
.
push
({
path
:
'/params'
})
...
...
src/views/ParamsModel/index.vue
View file @
d178de9
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
}"
}"
:pagination="false"
:pagination="false"
highlight-current-row
highlight-current-row
@row-click="handleClickRow">
@row-click="handleClickRow"
:outerLoading="loadingOne">
<div
slot=
"operate"
slot-scope=
"row"
>
<div
slot=
"operate"
slot-scope=
"row"
>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/detail', query: { name: row.name }})">详情
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/detail', query: { name: row.name }})">详情
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/edit', query: { name: row.name, level: 1 } })">编辑
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/edit', query: { name: row.name, level: 1 } })">编辑
</span>
...
@@ -58,7 +59,8 @@
...
@@ -58,7 +59,8 @@
:data=
"
{
:data=
"
{
list: twoList,
list: twoList,
total: twoTotal,
total: twoTotal,
}">
}"
:outerLoading="loadingTwo">
<div
slot=
"operate"
slot-scope=
"row"
>
<div
slot=
"operate"
slot-scope=
"row"
>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/detail', query: { name: row.name } })">详情
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/detail', query: { name: row.name } })">详情
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/edit', query: { name: row.name, level: 2 } })">编辑
</span>
<span
class=
"operate"
@
click=
"$router.push(
{ path: '/params/edit', query: { name: row.name, level: 2 } })">编辑
</span>
...
@@ -91,6 +93,9 @@ export default {
...
@@ -91,6 +93,9 @@ export default {
twoTotal
:
0
,
twoTotal
:
0
,
oneCurrentPage
:
1
,
oneCurrentPage
:
1
,
twoCurrentPage
:
1
,
twoCurrentPage
:
1
,
loadingOne
:
false
,
loadingTwo
:
false
,
parentLevel
:
''
,
definitions
:
[
definitions
:
[
{
{
label
:
'序号'
,
label
:
'序号'
,
...
@@ -123,18 +128,22 @@ export default {
...
@@ -123,18 +128,22 @@ export default {
},
},
methods
:
{
methods
:
{
async
getOneData
()
{
async
getOneData
()
{
this
.
loadingOne
=
true
const
oneLevel
=
await
getParameter
({
base
:
1
,
pages
:
this
.
oneCurrentPage
-
1
,
pagesize
:
10
})
const
oneLevel
=
await
getParameter
({
base
:
1
,
pages
:
this
.
oneCurrentPage
-
1
,
pagesize
:
10
})
if
(
oneLevel
&&
oneLevel
.
data
&&
oneLevel
.
data
.
code
===
0
)
{
if
(
oneLevel
&&
oneLevel
.
data
&&
oneLevel
.
data
.
code
===
0
)
{
this
.
oneList
=
oneLevel
.
data
.
parameters
.
datas
this
.
oneList
=
oneLevel
.
data
.
parameters
.
datas
this
.
oneTotal
=
oneLevel
.
data
.
parameters
.
total
this
.
oneTotal
=
oneLevel
.
data
.
parameters
.
total
}
}
this
.
loadingOne
=
false
},
},
async
getTwoData
()
{
async
getTwoData
()
{
const
twoLevel
=
await
getParameter
({
base
:
0
,
pages
:
this
.
twoCurrentPage
-
1
,
pagesize
:
10
})
this
.
loadingTwo
=
true
const
twoLevel
=
await
getParameter
({
base
:
0
,
parent
:
this
.
parentLevel
,
pages
:
this
.
twoCurrentPage
-
1
,
pagesize
:
10
})
if
(
twoLevel
&&
twoLevel
.
data
&&
twoLevel
.
data
.
code
===
0
)
{
if
(
twoLevel
&&
twoLevel
.
data
&&
twoLevel
.
data
.
code
===
0
)
{
this
.
twoList
=
twoLevel
.
data
.
parameters
.
datas
this
.
twoList
=
twoLevel
.
data
.
parameters
.
datas
this
.
twoTotal
=
twoLevel
.
data
.
parameters
.
total
this
.
twoTotal
=
twoLevel
.
data
.
parameters
.
total
}
}
this
.
loadingTwo
=
false
},
},
async
handleDelete
(
row
,
level
)
{
async
handleDelete
(
row
,
level
)
{
const
confirmDelete
=
await
Dialog
.
confirm
(
'提示'
,
{
message
:
'是否删除此模板?'
})
const
confirmDelete
=
await
Dialog
.
confirm
(
'提示'
,
{
message
:
'是否删除此模板?'
})
...
@@ -148,7 +157,8 @@ export default {
...
@@ -148,7 +157,8 @@ export default {
}
}
},
},
handleClickRow
(
row
,
column
,
event
)
{
handleClickRow
(
row
,
column
,
event
)
{
console
.
log
(
row
)
this
.
parentLevel
=
row
.
name
this
.
getTwoData
()
},
},
handleOneCurrentChange
(
val
)
{
handleOneCurrentChange
(
val
)
{
this
.
oneCurrentPage
=
val
this
.
oneCurrentPage
=
val
...
...
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