Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api-gateway
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
API
api-gateway
Commits
37c48cb5
Commit
37c48cb5
authored
Aug 30, 2019
by
无尘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改配置
parent
5a272b81
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
6 deletions
+104
-6
back-table-right.vue
src/components/createApi/back-table-right.vue
+104
-6
No files found.
src/components/createApi/back-table-right.vue
View file @
37c48cb5
...
...
@@ -74,7 +74,10 @@ export default {
},
data
()
{
return
{
trData
:
{}
trData
:
{},
tempArr
:
[],
newItemData
:
{},
allDataList
:
[]
};
},
methods
:
{
...
...
@@ -88,12 +91,47 @@ export default {
that.$delete(that.itemData.properties, oldKey);
} */
},
async
handleDisable
(
obj
,
flag
,
parentKey
)
{
const
that
=
this
;
for
(
let
k
in
obj
)
{
if
(
obj
[
k
].
currentKey
==
parentKey
)
{
obj
[
k
].
isRootKeyFlag
=
flag
?
true
:
false
;
}
if
(
obj
[
k
].
type
==
'object'
&&
Object
.
keys
(
obj
[
k
].
properties
).
length
)
{
await
that
.
handleDisable
(
obj
[
k
].
properties
,
flag
,
parentKey
);
}
if
(
obj
[
k
].
type
==
'array'
&&
Object
.
keys
(
obj
[
k
].
items
.
properties
).
length
)
{
await
that
.
handleDisable
(
obj
[
k
].
items
.
properties
,
flag
,
parentKey
);
}
}
},
/**
* 改变checkbox
*/
/* eslint-disable */
async
changeCheck
(
obj
,
key
)
{
const
that
=
this
;
// console.log('改变checkbox:', obj, key);
console
.
log
(
'改变checkbox:'
,
obj
,
key
,
that
.
itemData
);
// 查找父级禁用和不禁用
if
(
obj
.
backendOriginType
==
'body'
&&
obj
.
level
>
2
)
{
if
(
obj
.
parentKey
==
'bodyRoot'
)
{
that
.
itemData
.
isRootKeyFlag
=
obj
.
isRootKey
?
true
:
false
;
}
else
{
for
(
let
pk
in
that
.
newItemData
.
properties
)
{
if
(
that
.
newItemData
.
properties
[
pk
].
currentKey
==
obj
.
parentKey
)
{
that
.
newItemData
.
properties
[
pk
].
isRootKeyFlag
=
obj
.
isRootKey
?
true
:
false
;
}
else
{
if
(
that
.
newItemData
.
properties
[
pk
].
type
==
'object'
&&
Object
.
keys
(
that
.
newItemData
.
properties
[
pk
].
properties
).
length
){
await
that
.
handleDisable
(
that
.
newItemData
.
properties
[
pk
].
properties
,
obj
.
isRootKey
,
obj
.
parentKey
)
}
if
(
that
.
newItemData
.
properties
[
pk
].
type
==
'array'
&&
Object
.
keys
(
that
.
newItemData
.
properties
[
pk
].
items
.
properties
).
length
){
await
that
.
handleDisable
(
that
.
newItemData
.
properties
[
pk
].
items
.
properties
,
obj
.
isRootKey
,
obj
.
parentKey
)
}
}
}
}
}
// 设置子级禁用和不禁用
if
(
obj
.
type
==
'object'
&&
Object
.
keys
(
obj
.
properties
).
length
)
{
obj
.
isRootKeyFlag
=
false
;
...
...
@@ -110,17 +148,19 @@ export default {
if
(
obj
.
type
==
'array'
&&
Object
.
keys
(
obj
.
items
.
properties
).
length
)
{
obj
.
isRootKeyFlag
=
false
;
for
(
let
key
in
obj
.
items
.
properties
)
{
obj
.
items
.
properties
[
key
].
isRootKeyFlag
=
tru
e
;
if
(
obj
.
properties
[
key
].
type
==
'array
'
&&
Object
.
keys
(
obj
.
items
.
properties
[
key
].
properties
).
length
)
{
obj
.
items
.
properties
[
key
].
isRootKeyFlag
=
obj
.
isRootKey
?
true
:
fals
e
;
if
(
obj
.
items
.
properties
[
key
].
type
==
'object
'
&&
Object
.
keys
(
obj
.
items
.
properties
[
key
].
properties
).
length
)
{
obj
.
isRootKey
?
await
that
.
checkArrObjData
(
obj
.
items
.
properties
[
key
].
properties
)
:
await
that
.
checkArrObjFalse
(
obj
.
items
.
properties
[
key
].
properties
);
}
if
(
obj
.
items
.
properties
[
key
].
type
==
'array'
&&
Object
.
keys
(
obj
.
items
.
properties
[
key
].
properties
).
length
)
{
obj
.
isRootKey
?
await
that
.
checkArrObjData
(
obj
.
items
.
properties
[
key
].
items
.
properties
)
:
await
that
.
checkArrObjFalse
(
obj
.
items
.
properties
[
key
].
items
.
properties
);
}
}
}
that
.
$forceUpdate
();
},
async
checkArrObjData
(
item
)
{
const
that
=
this
;
// console.log(item);
for
(
let
k
in
item
)
{
item
[
k
].
isRootKeyFlag
=
true
;
if
(
item
[
k
].
type
==
'object'
&&
Object
.
keys
(
item
[
k
].
properties
).
length
)
{
...
...
@@ -146,18 +186,76 @@ export default {
await
that
.
checkArrObjData
(
item
[
k
].
items
.
properties
);
}
}
},
/**
* 处理
*/
async
handleToArr
()
{
const
that
=
this
;
if
(
that
.
itemData
.
level
==
1
&&
that
.
itemData
.
properties
.
hasOwnProperty
(
'bodyRoot'
))
{
let
arrObj
=
[];
let
newItemData
=
JSON
.
parse
(
JSON
.
stringify
(
that
.
itemData
));
that
.
newItemData
=
JSON
.
parse
(
JSON
.
stringify
(
that
.
itemData
));
if
(
Object
.
keys
(
newItemData
.
properties
.
bodyRoot
.
properties
).
length
)
{
for
(
let
key
in
newItemData
.
properties
.
bodyRoot
.
properties
)
{
let
innerArr
=
[];
innerArr
.
push
(
newItemData
.
properties
.
bodyRoot
);
let
returnArr
=
await
that
.
handleLoop
(
newItemData
.
properties
.
bodyRoot
.
properties
[
key
],
innerArr
);
returnArr
.
forEach
(
ele
=>
{
if
(
Array
.
isArray
(
ele
))
{
arrObj
.
push
(
ele
);
}
})
if
(
Array
.
isArray
(
returnArr
[
0
]))
{
continue
;
}
arrObj
.
push
(
returnArr
);
}
that
.
allDataList
=
arrObj
;
}
}
},
async
handleLoop
(
item
,
innerArr
)
{
const
that
=
this
;
innerArr
.
push
(
item
);
if
(
item
.
type
!=
'object'
&&
item
.
type
!=
'array'
){
return
innerArr
;
}
let
arrRet
=
[];
if
(
item
.
type
==
'object'
&&
Object
.
keys
(
item
.
properties
).
length
)
{
for
(
let
key
in
item
.
properties
)
{
let
mid
=
JSON
.
parse
(
JSON
.
stringify
(
innerArr
));
let
arrMid
=
await
that
.
handleLoop
(
item
.
properties
[
key
],
mid
);
arrRet
.
push
(
arrMid
);
}
}
if
(
item
.
type
==
'array'
&&
Object
.
keys
(
item
.
items
.
properties
).
length
)
{
for
(
let
key
in
item
.
items
.
properties
)
{
let
mid
=
JSON
.
parse
(
JSON
.
stringify
(
innerArr
));
let
arrMid
=
await
that
.
handleLoop
(
item
.
items
.
properties
[
key
],
mid
);
arrRet
.
push
(
arrMid
);
}
}
return
arrRet
;
}
},
watch
:
{
itemData
:
function
(
newData
,
oldData
)
{
const
that
=
this
;
that
.
trData
=
JSON
.
parse
(
JSON
.
stringify
(
newData
));
that
.
handleToArr
();
}
},
mounted
()
{
const
that
=
this
;
that
.
trData
=
JSON
.
parse
(
JSON
.
stringify
(
that
.
itemData
));
}
that
.
handleToArr
();
},
beforeDestroy
()
{
this
.
tempArr
=
[];
},
};
</
script
>
<
style
lang=
"less"
scoped
>
...
...
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