Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
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
周远喜
mes-ui
Commits
c0623cee
Commit
c0623cee
authored
Jul 28, 2020
by
仇晓婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
样式修改
parent
b7759b27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
297 additions
and
224 deletions
+297
-224
add.vue
pages/system/set_menu/add.vue
+28
-29
detail.vue
pages/system/set_menu/detail.vue
+66
-71
index.vue
pages/system/set_menu/index.vue
+203
-124
No files found.
pages/system/set_menu/add.vue
View file @
c0623cee
<
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"24"
>
<FormItem
:label=
"l('title')"
prop=
"title"
>
...
...
@@ -14,13 +14,12 @@
</Col>
<Col
:span=
"24"
>
<FormItem
:label=
"l('menuIds')"
style=
"margin-bottom:0px"
></FormItem>
<FormItem
:label=
"l('menuIds')"
style=
"margin-bottom:0px"
></FormItem>
</Col>
<Col
:span=
"24"
>
<div
style=
"overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px"
>
<Tree
ref=
"tree"
:data=
"menuData"
show-checkbox
multiple
></Tree>
</div>
<div
style=
"overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px"
>
<Tree
ref=
"tree"
:data=
"menuData"
show-checkbox
multiple
></Tree>
</div>
</Col>
</Row>
<FormItem>
...
...
@@ -31,43 +30,43 @@
</
template
>
<
script
>
import
Api
from
"./api"
;
import
api1
from
'../menu/api'
import
api1
from
"../menu/api"
;
export
default
{
name
:
"Add"
,
data
()
{
return
{
disabled
:
false
,
entity
:
{
status
:
1
},
menuData
:
[],
//菜单树数据
menuIds
:
[],
//勾选的菜单数组
entity
:
{
status
:
1
},
menuData
:
[],
//菜单树数据
menuIds
:
[],
//勾选的菜单数组
rules
:
{
title
:
[{
required
:
true
,
message
:
"必填"
}],
status
:
[{
required
:
true
,
message
:
"必填"
}]
}
title
:
[{
required
:
true
,
message
:
"必填"
}],
status
:
[{
required
:
true
,
message
:
"必填"
}],
}
,
};
},
props
:
{
v
:
Object
v
:
Object
,
},
mounted
(){
api1
.
getTree
().
then
((
v
)
=>
{
this
.
menuData
=
v
.
result
})
mounted
()
{
api1
.
getTree
().
then
((
v
)
=>
{
this
.
menuData
=
v
.
result
;
});
},
methods
:
{
handleSubmit
()
{
this
.
$refs
.
form
.
validate
(
v
=>
{
this
.
$refs
.
form
.
validate
(
(
v
)
=>
{
if
(
v
)
{
this
.
disabled
=
true
;
//获取选中和半选的节点
let
node
=
this
.
$refs
.
tree
.
getCheckedAndIndeterminateNodes
();
let
menuId
=
node
.
map
(
item
=>
{
return
item
.
id
})
this
.
entity
.
menuIds
=
this
.
menuIds
=
menuId
let
node
=
this
.
$refs
.
tree
.
getCheckedAndIndeterminateNodes
();
let
menuId
=
node
.
map
((
item
)
=>
{
return
item
.
id
;
})
;
this
.
entity
.
menuIds
=
this
.
menuIds
=
menuId
;
//console.log(menuId)
Api
.
create
(
this
.
entity
)
.
then
(
r
=>
{
.
then
(
(
r
)
=>
{
this
.
disabled
=
false
;
if
(
r
.
success
)
{
this
.
$Message
.
success
(
"保存成功"
);
...
...
@@ -76,7 +75,7 @@ export default {
this
.
$Message
.
error
(
"保存失败"
);
}
})
.
catch
(
err
=>
{
.
catch
(
(
err
)
=>
{
this
.
disabled
=
false
;
this
.
$Message
.
error
(
"保存失败"
);
console
.
warn
(
err
);
...
...
@@ -90,12 +89,12 @@ export default {
l
(
key
)
{
key
=
"set_menu"
+
"."
+
key
;
return
this
.
$t
(
key
);
}
}
,
},
watch
:
{
v
()
{
this
.
entity
=
this
.
$u
.
clone
(
this
.
v
);
}
}
}
,
}
,
};
</
script
>
\ No newline at end of file
pages/system/set_menu/detail.vue
View file @
c0623cee
<
template
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Form
ref=
"form"
:model=
"entity"
:rules=
"rules"
:label-width=
"90"
>
<Row>
<Col
:span=
"24"
>
<FormItem
:label=
"l('title')"
prop=
"title"
>
...
...
@@ -14,83 +14,78 @@
</Col>
<Col
:span=
"24"
>
<FormItem
:label=
"l('menuIds')"
style=
"margin-bottom:0px"
></FormItem>
<FormItem
:label=
"l('menuIds')"
style=
"margin-bottom:0px"
></FormItem>
</Col>
<Col
:span=
"24"
>
<div
style=
"overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px"
>
<Tree
ref=
"tree"
:data=
"menuData"
show-checkbox
multiple
></Tree>
</div>
<div
style=
"overflow:auto;height:320px;margin-left: 60px;margin-bottom:16px"
>
<Tree
ref=
"tree"
:data=
"menuData"
show-checkbox
multiple
></Tree>
</div>
</Col>
</Row>
</Form>
</
template
>
<
script
>
import
Api
from
'./api'
import
api1
from
'../menu/api'
export
default
{
name
:
'Add'
,
data
()
{
return
{
entity
:
{},
menuData
:[],
menuIds
:[],
rules
:
{
name
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}],
code
:
[{
required
:
true
,
message
:
'必填'
,
trigger
:
'blur'
}]
}
}
},
mounted
(){
api1
.
getTree
().
then
((
v
)
=>
{
this
.
menuData
=
v
.
result
})
},
props
:
{
eid
:
Number
},
methods
:
{
load
(
v
)
{
Api
.
get
({
id
:
v
}).
then
(
r
=>
{
this
.
entity
=
r
.
result
;
this
.
menuIds
=
this
.
entity
.
menuIds
;
this
.
setChecked
(
this
.
menuData
,
this
.
menuIds
)
this
.
$emit
(
'on-load'
)
})
},
setChecked
(
data
,
ids
){
if
(
ids
.
length
==
0
){
return
data
;
}
data
.
forEach
(
item
=>
{
if
(
!
item
.
children
||
item
.
children
.
length
==
0
){
if
(
ids
.
indexOf
(
item
.
id
)
>-
1
){
this
.
$set
(
item
,
"checked"
,
true
);
}
}
else
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
this
.
setChecked
(
item
.
children
,
ids
)
}
})
},
handleClose
()
{
this
.
$emit
(
'on-close'
)
},
l
(
key
)
{
key
=
"set_menu"
+
"."
+
key
;
return
this
.
$t
(
key
)
import
Api
from
"./api"
;
import
api1
from
"../menu/api"
;
export
default
{
name
:
"Add"
,
data
()
{
return
{
entity
:
{},
menuData
:
[],
menuIds
:
[],
rules
:
{
name
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
code
:
[{
required
:
true
,
message
:
"必填"
,
trigger
:
"blur"
}],
},
};
},
mounted
()
{
api1
.
getTree
().
then
((
v
)
=>
{
this
.
menuData
=
v
.
result
;
});
},
props
:
{
eid
:
Number
,
},
methods
:
{
load
(
v
)
{
Api
.
get
({
id
:
v
}).
then
((
r
)
=>
{
this
.
entity
=
r
.
result
;
this
.
menuIds
=
this
.
entity
.
menuIds
;
this
.
setChecked
(
this
.
menuData
,
this
.
menuIds
);
this
.
$emit
(
"on-load"
);
});
},
setChecked
(
data
,
ids
)
{
if
(
ids
.
length
==
0
)
{
return
data
;
}
},
watch
:
{
eid
(
v
)
{
if
(
v
!=
0
)
{
this
.
load
(
v
);
}
}
data
.
forEach
((
item
)
=>
{
if
(
!
item
.
children
||
item
.
children
.
length
==
0
)
{
if
(
ids
.
indexOf
(
item
.
id
)
>
-
1
)
{
this
.
$set
(
item
,
"checked"
,
true
);
}
}
else
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
this
.
setChecked
(
item
.
children
,
ids
);
}
}
});
},
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
l
(
key
)
{
key
=
"set_menu"
+
"."
+
key
;
return
this
.
$t
(
key
);
},
},
watch
:
{
eid
(
v
)
{
if
(
v
!=
0
)
{
this
.
load
(
v
);
}
},
},
};
</
script
>
\ No newline at end of file
pages/system/set_menu/index.vue
View file @
c0623cee
This diff is collapsed.
Click to expand it.
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