Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
admin-base
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
new-sing
admin-base
Commits
a8392967
Commit
a8392967
authored
Sep 20, 2018
by
王
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
期数老师限制
parent
b2567ce8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
15 deletions
+68
-15
dialog.vue
src/components/class/dialog.vue
+47
-9
index.vue
src/components/class/index.vue
+20
-5
userList.vue
src/components/class/userList.vue
+1
-1
No files found.
src/components/class/dialog.vue
View file @
a8392967
...
...
@@ -4,7 +4,7 @@
:visible
.
sync=
"dialogObj.show"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"120px"
>
<el-form-item
label=
"期数"
v-if=
"
this.dialogObj.type !==1
"
>
<el-form-item
label=
"期数"
v-if=
"
!this.dialogObj.periodsId
"
>
<el-cascader
:options=
"goodsList"
:props=
"
{value:'id',label:'name'}"
...
...
@@ -35,7 +35,7 @@
</
template
>
<
script
>
import
{
getTeacherListApi
,
getClassDetailApi
,
editClassApi
,
addClassApi
,
getPeriodsApi
,
getGoodsListApi
}
from
"../../service/api"
;
import
{
getTeacherListApi
,
getClassDetailApi
,
editClassApi
,
addClassApi
,
getPeriodsApi
,
getGoodsListApi
,
getPeriodsTeacherApi
}
from
"../../service/api"
;
export
default
{
props
:[
'dialogObj'
...
...
@@ -47,18 +47,55 @@
max_join_num
:
''
},
teacherList
:[],
exitTeacherList
:
[],
goodsList
:
[],
periods
:
{}
}
},
methods
:{
initPage
(){
findDifferentArray
(
array1
,
array2
){
let
newArray
=
[]
array1
.
forEach
((
val
)
=>
{
let
index
=
array2
.
findIndex
((
item
)
=>
{
return
item
.
teacher_id
==
val
.
id
})
if
(
index
===
-
1
)
{
newArray
.
push
(
val
)
}
})
return
newArray
},
getTeacher
(){
this
.
exitTeacherList
=
this
.
dialogObj
.
teacherList
.
length
>
0
?
this
.
dialogObj
.
teacherList
:
[];
getTeacherListApi
().
then
(
res
=>
{
this
.
teacherList
=
res
.
list
if
(
this
.
exitTeacherList
.
length
>
0
)
{
this
.
teacherList
=
this
.
findDifferentArray
(
res
.
list
,
this
.
exitTeacherList
)
}
else
{
this
.
teacherList
=
res
.
list
}
});
},
getTeacherByPeriods
(){
getPeriodsTeacherApi
(
this
.
periods
.
id
).
then
(
res1
=>
{
this
.
exitTeacherList
=
res1
getTeacherListApi
().
then
(
res
=>
{
if
(
this
.
exitTeacherList
.
length
>
0
)
{
this
.
teacherList
=
this
.
findDifferentArray
(
res
.
list
,
this
.
exitTeacherList
)
}
else
{
this
.
teacherList
=
res
.
list
}
});
})
},
initPage
(){
this
.
periods
=
this
.
dialogObj
.
periods
this
.
getTeacher
();
switch
(
this
.
dialogObj
.
type
)
{
case
0
:
this
.
getPeriodList
();
if
(
!
this
.
dialogObj
.
periodsId
){
this
.
getPeriodList
();
}
this
.
form
=
{
teacher_id
:
''
,
max_join_num
:
''
...
...
@@ -91,12 +128,13 @@
onSave
(){
switch
(
this
.
dialogObj
.
type
)
{
case
0
:
addClassApi
(
this
.
periods
.
id
,
this
.
form
).
then
(
res
=>
{
let
id
=
this
.
dialogObj
.
periodsId
?
this
.
dialogObj
.
periodsId
:
this
.
periods
.
id
;
addClassApi
(
id
,
this
.
form
).
then
(
res
=>
{
this
.
$message
({
type
:
'success'
,
message
:
'添加成功!'
});
this
.
$emit
(
"reflash"
);
this
.
$emit
(
"reflash"
,
this
.
periods
);
this
.
dialogObj
.
show
=
false
;
});
break
;
...
...
@@ -106,7 +144,7 @@
type
:
'success'
,
message
:
'修改成功!'
});
this
.
$emit
(
"reflash"
);
this
.
$emit
(
"reflash"
,
this
.
periods
);
this
.
dialogObj
.
show
=
false
;
})
}
...
...
@@ -121,7 +159,7 @@
if
(
data
.
length
>
1
){
let
nowGoods
=
this
.
goodsList
.
find
(
i
=>
{
return
i
.
id
===
data
[
0
]});
this
.
periods
=
nowGoods
.
children
.
find
(
i
=>
{
return
i
.
id
===
data
[
1
]});
this
.
getTeacher
()
this
.
getTeacher
ByPeriods
()
}
}
},
...
...
src/components/class/index.vue
View file @
a8392967
...
...
@@ -103,7 +103,7 @@
</el-table>
</div>
<page
:nowPage=
"nowPage"
:total=
"total"
:limit=
"limit"
@
pageChange=
"onPageChange"
/>
<class-dialog
:dialogObj=
"dialogObj"
@
reflash=
"
getClassList
"
></class-dialog>
<class-dialog
:dialogObj=
"dialogObj"
@
reflash=
"
onReflash
"
></class-dialog>
<user-list
:userObj=
"userObj"
@
reflash=
"getClassList"
/>
</div>
</template>
...
...
@@ -198,6 +198,7 @@
}
},
getTeacher
(){
if
(
!
this
.
periods
)
return
;
getPeriodsTeacherApi
(
this
.
periods
.
id
).
then
(
res
=>
{
this
.
teacherList
=
res
})
...
...
@@ -214,7 +215,13 @@
this
.
nowPage
=
val
;
this
.
getClassList
();
},
onReflash
(
periods
){
this
.
periods
=
periods
;
this
.
selectedGoods
=
[
periods
.
goods_id
,
periods
.
id
];
this
.
getClassList
();
},
getClassList
(){
if
(
!
this
.
periods
)
return
;
this
.
getTeacher
();
let
json
=
{
limit
:
this
.
limit
,
...
...
@@ -247,25 +254,33 @@
type
:
'success'
,
message
:
'删除成功!'
});
this
.
getClassList
()
});
this
.
getClassList
()
});
},
onAdd
(){
this
.
dialogObj
=
{
show
:
true
,
title
:
'添加班级'
,
periodsId
:
this
.
periods
?
this
.
periods
.
id
:
''
,
type
:
0
,
teacherList
:
this
.
teacherList
?
this
.
teacherList
:
[]
}
if
(
this
.
periods
)
{
this
.
dialogObj
.
periods
=
this
.
periods
this
.
dialogObj
.
periodsId
=
this
.
periods
.
id
}
},
editClass
(
data
){
this
.
dialogObj
=
{
show
:
true
,
title
:
'编辑班级'
,
periodsId
:
this
.
periods
.
id
,
type
:
1
,
id
:
data
.
id
id
:
data
.
id
,
teacherList
:
this
.
teacherList
?
this
.
teacherList
:
[]
}
if
(
this
.
periods
)
{
this
.
dialogObj
.
periods
=
this
.
periods
this
.
dialogObj
.
periodsId
=
this
.
periods
.
id
}
}
}
...
...
src/components/class/userList.vue
View file @
a8392967
...
...
@@ -118,7 +118,7 @@
searchFrom
:
{},
userList
:
[],
nowPage
:
1
,
limit
:
1
,
limit
:
5
,
total
:
0
,
searchFrom
:
{
userId
:
''
,
...
...
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