Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
8dc66ffd
Commit
8dc66ffd
authored
May 14, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
4eff8998
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
45 deletions
+154
-45
iview-admin/src/view/components/tables/biztables.vue
+48
-17
iview-admin/src/view/components/tables/forms/jsoneditor.vue
+28
-12
iview-admin/src/view/roleinfo/roleinfo_page.vue
+4
-0
iview-admin/src/view/userinfo/orginfo_page.vue
+45
-5
iview-admin/src/view/userinfo/userinfo_page.vue
+29
-11
No files found.
iview-admin/src/view/components/tables/biztables.vue
View file @
8dc66ffd
...
@@ -171,12 +171,18 @@ export default {
...
@@ -171,12 +171,18 @@ export default {
// }
// }
},
},
savebefore
:
{
savebefore
:
{
type
:
Function
,
type
:
Function
default
(){
// default(){
return
(
key
,
row
,
cbk
)
=>
{
// return (key,row,cbk)=>{
return
cbk
(
row
)
// return cbk(row)
}
// }
}
// }
},
editbefore
:
{
type
:
Function
},
addbefore
:
{
type
:
Function
}
}
},
},
data
()
{
data
()
{
...
@@ -312,19 +318,42 @@ export default {
...
@@ -312,19 +318,42 @@ export default {
}
}
}
}
if
(
key
==
"edit"
)
{
if
(
key
==
"edit"
)
{
this
.
fm_status
=
"edit"
;
//实现编辑前回调
this
.
showedform
=
true
;
if
(
this
.
editbefore
)
{
this
.
$emit
(
"onedit"
);
this
.
editbefore
(
row
,
data
=>
{
this
.
$nextTick
(()
=>
{
if
(
data
.
value
)
{
this
.
$refs
.
edform
.
formModel
=
this
.
deepclone
(
row
);
this
.
fm_status
=
"edit"
;
this
.
$refs
.
edform
.
activeChildTables
(
false
);
this
.
showedform
=
true
;
});
this
.
$emit
(
"onedit"
);
this
.
$nextTick
(()
=>
{
this
.
$refs
.
edform
.
formModel
=
this
.
deepclone
(
row
);
this
.
$refs
.
edform
.
activeChildTables
(
false
);
});
}
else
{
this
.
$Modal
.
error
({
title
:
"提示"
,
content
:
data
.
message
});
}
});
}
}
}
if
(
key
==
"create"
)
{
if
(
key
==
"create"
)
{
this
.
fm_status
=
"create"
;
if
(
this
.
addbefore
)
{
this
.
showedform
=
true
;
this
.
addbefore
(
row
,
data
=>
{
this
.
$refs
.
edform
.
activeChildTables
(
true
);
if
(
data
.
value
)
{
this
.
$emit
(
"onnew"
);
this
.
fm_status
=
"create"
;
this
.
showedform
=
true
;
this
.
$refs
.
edform
.
activeChildTables
(
true
);
this
.
$emit
(
"onnew"
);
}
else
{
this
.
$Modal
.
error
({
title
:
"提示"
,
content
:
data
.
message
});
}
});
}
}
}
if
(
key
==
"save"
)
{
if
(
key
==
"save"
)
{
console
.
log
(
console
.
log
(
...
@@ -375,6 +404,8 @@ export default {
...
@@ -375,6 +404,8 @@ export default {
}
}
});
});
});
});
}
else
{
throw
new
Error
(
"请绑定组件的savebore属性方法"
);
}
}
});
});
}
else
{
}
else
{
...
...
iview-admin/src/view/components/tables/forms/jsoneditor.vue
View file @
8dc66ffd
...
@@ -3,10 +3,9 @@
...
@@ -3,10 +3,9 @@
<Card
style=
"height:100%"
>
<Card
style=
"height:100%"
>
<Alert
type=
"error"
>
<Alert
type=
"error"
>
<template
slot=
"desc"
>
<template
slot=
"desc"
>
<Icon
type=
"ios-alert-outline"
/>
<Icon
type=
"ios-alert-outline"
/>
双击编辑,单击选择
双击编辑,单击选择
<br>
<br/>
当前节点:
当前节点:
{{
currentData
?
currentData
.
title
:
"请选择操作节点"
}}
{{
currentData
?
currentData
.
title
:
"请选择操作节点"
}}
</
template
>
</
template
>
</Alert>
</Alert>
...
@@ -56,7 +55,9 @@ export default {
...
@@ -56,7 +55,9 @@ export default {
data
()
{
data
()
{
return
{
return
{
isupdate
:
false
,
isupdate
:
false
,
rootNode
:
null
,
currentData
:
null
,
currentData
:
null
,
currentNode
:
null
,
code
:
"root"
,
code
:
"root"
,
treedata
:
[],
treedata
:
[],
originalMetaInfo
:
[
originalMetaInfo
:
[
...
@@ -137,8 +138,13 @@ export default {
...
@@ -137,8 +138,13 @@ export default {
"span"
,
"span"
,
{
{
on
:
{
on
:
{
"dblclick"
:
()
=>
{
dblclick
:
()
=>
{
this
.
onselnode
(
node
,
data
);
this
.
onselnode
(
node
,
data
);
},
click
:
()
=>
{
this
.
currentData
=
data
;
this
.
currentNode
=
node
;
this
.
rootNode
=
root
;
}
}
}
}
},
},
...
@@ -166,14 +172,14 @@ export default {
...
@@ -166,14 +172,14 @@ export default {
[
[
h
(
"Button"
,
{
h
(
"Button"
,
{
props
:
Object
.
assign
({},
this
.
buttonProps
,
{
props
:
Object
.
assign
({},
this
.
buttonProps
,
{
icon
:
"
ios
-add"
,
icon
:
"
md
-add"
,
type
:
"
primary
"
type
:
"
text
"
}),
}),
style
:
{
style
:
{
width
:
"64px"
width
:
"64px"
},
},
on
:
{
on
:
{
"click"
:
()
=>
{
click
:
()
=>
{
this
.
append
(
data
);
this
.
append
(
data
);
}
}
}
}
...
@@ -206,19 +212,17 @@ export default {
...
@@ -206,19 +212,17 @@ export default {
treedata
.
forEach
(
item
=>
{
treedata
.
forEach
(
item
=>
{
if
(
item
.
nodeKey
==
newobj
.
nodeKey
)
{
if
(
item
.
nodeKey
==
newobj
.
nodeKey
)
{
item
=
Object
.
assign
(
item
,
newobj
);
item
=
Object
.
assign
(
item
,
newobj
);
}
}
if
(
item
.
children
)
{
if
(
item
.
children
)
{
if
(
parentitem
)
{
if
(
parentitem
)
{
item
.
orgpath
=
parentitem
.
orgpath
+
"/"
+
item
.
code
;
item
.
orgpath
=
parentitem
.
orgpath
+
"/"
+
item
.
code
;
}
else
{
}
else
{
item
.
orgpath
=
item
.
code
;
item
.
orgpath
=
item
.
code
;
}
}
item
.
children
.
sort
((
item1
,
item2
)
=>
{
item
.
children
.
sort
((
item1
,
item2
)
=>
{
return
item1
.
seq
<
item2
.
seq
;
return
item1
.
seq
<
item2
.
seq
;
});
});
modiTreeNodeByCode
(
item
.
children
,
newobj
,
item
);
modiTreeNodeByCode
(
item
.
children
,
newobj
,
item
);
}
else
{
}
else
{
if
(
parentitem
)
{
if
(
parentitem
)
{
item
.
orgpath
=
parentitem
.
orgpath
+
"/"
+
item
.
code
;
item
.
orgpath
=
parentitem
.
orgpath
+
"/"
+
item
.
code
;
...
@@ -275,6 +279,7 @@ export default {
...
@@ -275,6 +279,7 @@ export default {
onselnode
(
node
,
data
)
{
onselnode
(
node
,
data
)
{
this
.
showedform
=
true
;
this
.
showedform
=
true
;
this
.
currentData
=
data
;
this
.
currentData
=
data
;
this
.
currentNode
=
node
;
let
nd
=
this
.
deepclone
(
data
);
let
nd
=
this
.
deepclone
(
data
);
this
.
$refs
.
nodeform
.
resetForm
();
this
.
$refs
.
nodeform
.
resetForm
();
this
.
$refs
.
nodeform
.
formModel
=
nd
;
this
.
$refs
.
nodeform
.
formModel
=
nd
;
...
@@ -328,13 +333,19 @@ export default {
...
@@ -328,13 +333,19 @@ export default {
"span"
,
"span"
,
{
{
on
:
{
on
:
{
"dblclick"
:
$event
=>
{
dblclick
:
$event
=>
{
$
(
"span"
,
".ptree"
).
removeClass
(
"spansel"
);
$
(
"span"
,
".ptree"
).
removeClass
(
"spansel"
);
$
(
$event
.
target
)
$
(
$event
.
target
)
.
parent
()
.
parent
()
.
parent
()
.
parent
()
.
addClass
(
"spansel"
);
.
addClass
(
"spansel"
);
this
.
onselnode
(
node
,
data
);
this
.
onselnode
(
node
,
data
);
},
click
:
()
=>
{
this
.
currentData
=
data
;
this
.
currentNode
=
node
;
this
.
rootNode
=
root
;
}
}
}
}
},
},
...
@@ -404,6 +415,11 @@ export default {
...
@@ -404,6 +415,11 @@ export default {
const
parent
=
root
.
find
(
el
=>
el
.
nodeKey
===
parentKey
).
node
;
const
parent
=
root
.
find
(
el
=>
el
.
nodeKey
===
parentKey
).
node
;
const
index
=
parent
.
children
.
indexOf
(
data
);
const
index
=
parent
.
children
.
indexOf
(
data
);
parent
.
children
.
splice
(
index
,
1
);
parent
.
children
.
splice
(
index
,
1
);
},
findParentByNode
(
node
)
{
const
parentKey
=
this
.
rootNode
.
find
(
el
=>
el
===
node
).
parent
;
const
parent
=
this
.
rootNode
.
find
(
el
=>
el
.
nodeKey
===
parentKey
).
node
;
return
parent
}
}
}
}
};
};
...
...
iview-admin/src/view/roleinfo/roleinfo_page.vue
View file @
8dc66ffd
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
packageName=
"auth"
packageName=
"auth"
isMulti
isMulti
@
onexec=
"onexec"
@
onexec=
"onexec"
:savebefore=
"savebefore"
></BizTable>
></BizTable>
</div>
</div>
</
template
>
</
template
>
...
@@ -21,6 +22,9 @@ export default {
...
@@ -21,6 +22,9 @@ export default {
BizTable
BizTable
},
},
methods
:
{
methods
:
{
savebefore
(
key
,
row
,
cbk
){
return
cbk
(
row
)
},
onexec
(
k
,
row
)
{
onexec
(
k
,
row
)
{
if
(
k
==
"auth"
){
if
(
k
==
"auth"
){
this
.
$router
.
push
({
name
:
"role_auth"
,
query
:{
roleid
:
row
.
id
,
rolecode
:
row
.
code
}})
this
.
$router
.
push
({
name
:
"role_auth"
,
query
:{
roleid
:
row
.
id
,
rolecode
:
row
.
code
}})
...
...
iview-admin/src/view/userinfo/orginfo_page.vue
View file @
8dc66ffd
...
@@ -9,7 +9,13 @@
...
@@ -9,7 +9,13 @@
@
controlctl=
"controlctl"
@
controlctl=
"controlctl"
@
drawaction=
"drawaction"
@
drawaction=
"drawaction"
></OrgEditor>
></OrgEditor>
<UserInfo
ref=
"userinfo"
slot=
"right"
:beforesave=
"beforesave"
></UserInfo>
<UserInfo
ref=
"userinfo"
slot=
"right"
:beforesave=
"beforesave"
:beforedit=
"beforedit"
:beforeadd=
"beforeadd"
></UserInfo>
</SplitPanel>
</SplitPanel>
</div>
</div>
</
template
>
</
template
>
...
@@ -99,13 +105,35 @@ export default {
...
@@ -99,13 +105,35 @@ export default {
});
});
},
},
methods
:
{
methods
:
{
beforeadd
(
row
,
cbk
)
{
if
(
!
this
.
$refs
.
orgtree
.
currentData
)
{
return
cbk
({
value
:
false
,
message
:
"请选择岗位节点"
});
}
else
{
if
(
!
this
.
$refs
.
orgtree
.
currentData
.
isPosition
)
{
return
cbk
({
value
:
false
,
message
:
"请选择岗位节点"
});
}
else
{
return
cbk
({
value
:
true
,
message
:
null
});
}
}
},
beforedit
(
row
,
cbk
)
{
return
cbk
({
value
:
true
,
message
:
null
});
// if(!this.$refs.orgtree.currentData){
// return cbk({value:false,message:"请选择组织结构"})
// }else{
// return cbk({value:true,message:null})
// }
},
beforesave
(
key
,
row
,
cbk
)
{
beforesave
(
key
,
row
,
cbk
)
{
//对row添加组织结构需要的字段
//对row添加组织结构需要的字段
if
(
this
.
$refs
.
orgtree
.
currentData
&&
this
.
$refs
.
orgtree
.
currentData
.
isPosition
){
if
(
row
.
opath
=
this
.
$refs
.
orgtree
.
currentData
.
orgpath
this
.
$refs
.
orgtree
.
currentData
&&
this
.
$refs
.
orgtree
.
currentData
.
isPosition
)
{
row
.
opath
=
this
.
$refs
.
orgtree
.
currentData
.
orgpath
;
}
}
console
.
log
(
"before.save"
,
key
,
row
)
console
.
log
(
"before.save"
,
key
,
row
);
return
cbk
(
row
)
return
cbk
(
row
)
;
},
},
setHeight
()
{
setHeight
()
{
let
$orgdiv
=
$
(
"#orgdiv"
);
let
$orgdiv
=
$
(
"#orgdiv"
);
...
@@ -126,6 +154,18 @@ export default {
...
@@ -126,6 +154,18 @@ export default {
}
}
},
},
controlctl
(
v
,
prop
,
fm
)
{
controlctl
(
v
,
prop
,
fm
)
{
if
(
prop
==
"isMain"
){
let
cnode
=
this
.
$refs
.
orgtree
.
currentNode
let
pnode
=
this
.
$refs
.
orgtree
.
findParentByNode
(
cnode
)
let
fmodel
=
fm
.
formModel
if
(
fmodel
.
orgtag
&&
fmodel
.
orgtag
.
indexOf
(
pnode
.
code
)
<
0
){
let
ttmp
=
fmodel
.
orgtag
.
split
(
","
).
push
(
pnode
.
code
).
join
(
","
)
fmodel
.
orgtag
=
ttmp
}
else
{
fmodel
.
orgtag
=
pnode
.
code
}
}
if
(
prop
==
"isPosition"
)
{
if
(
prop
==
"isPosition"
)
{
if
(
v
)
{
if
(
v
)
{
fm
.
setCtlVisable
(
"isMain"
,
true
);
fm
.
setCtlVisable
(
"isMain"
,
true
);
...
...
iview-admin/src/view/userinfo/userinfo_page.vue
View file @
8dc66ffd
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
@
onnew=
"onnew"
@
onnew=
"onnew"
@
onedit=
"onedit"
@
onedit=
"onedit"
:savebefore=
"beforesave"
:savebefore=
"beforesave"
:editbefore=
"beforedit"
:addbefore=
"beforeadd"
></BizTable>
></BizTable>
</div>
</div>
</
template
>
</
template
>
...
@@ -22,19 +24,35 @@ export default {
...
@@ -22,19 +24,35 @@ export default {
components
:
{
components
:
{
BizTable
BizTable
},
},
props
:{
props
:
{
beforesave
:{
beforesave
:
{
type
:
Function
,
type
:
Function
,
default
(){
default
()
{
return
(
key
,
row
,
cbk
)
=>
{
return
(
key
,
row
,
cbk
)
=>
{
return
cbk
(
row
)
return
cbk
(
row
);
}
};
}
}
}
},
beforedit
:
{
type
:
Function
,
default
()
{
return
(
row
,
cbk
)
=>
{
return
cbk
({
value
:
true
,
message
:
null
});
};
}
},
beforeadd
:
{
type
:
Function
,
default
()
{
return
(
row
,
cbk
)
=>
{
return
cbk
({
value
:
true
,
message
:
null
});
};
}
}
},
},
methods
:
{
methods
:
{
setHeight
(
h
){
setHeight
(
h
)
{
this
.
$refs
.
bt
.
setHeight
(
h
)
this
.
$refs
.
bt
.
setHeight
(
h
);
},
},
onnew
()
{
onnew
()
{
this
.
$refs
.
bt
.
setFormCtlVisable
(
"userName"
,
true
);
this
.
$refs
.
bt
.
setFormCtlVisable
(
"userName"
,
true
);
...
...
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