Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
supervise-wecom
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a2877b73
authored
Jun 04, 2026
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 添加课程多选组件到审批提交页面,优化课程选择逻辑
1 parent
432e2f71
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
436 additions
and
10 deletions
src/api/mine.js
src/views/mine/components/courseMultiSelect.vue
src/views/mine/view/approvalDetail.vue
src/views/mine/view/approvalSubmit.vue
src/api/mine.js
View file @
a2877b7
...
...
@@ -13,6 +13,9 @@ export default {
getFlightSupervisorList
(
data
)
{
return
api
.
post
(
"dj.api.supervisor.mini.list.flightSupervisor"
,
data
,
"supervisorUrl"
);
},
getAllCoursePage
(
data
)
{
return
api
.
post
(
"dj.supervisor.mini.api.all.course.page"
,
data
,
"supervisorUrl"
);
},
submitApproval
(
data
)
{
return
api
.
post
(
"dj.api.supervisor.mini.approval.submit"
,
data
,
"supervisorUrl"
);
},
...
...
src/views/mine/components/courseMultiSelect.vue
0 → 100644
View file @
a2877b7
<
template
>
<div
class=
"course-select"
@
click=
"openPicker"
>
<div
class=
"course-row-header"
>
<span>
{{
label
}}
<em
v-if=
"required"
>
*
</em></span>
<div
class=
"course-row-link"
>
<span
class=
"placeholder"
>
{{
placeholder
}}
</span>
<van-icon
name=
"arrow"
/>
</div>
</div>
<div
v-if=
"selectedCourses.length"
class=
"course-tags"
>
<span
v-for=
"course in selectedCourses"
:key=
"course.id"
class=
"course-tag"
>
<span
class=
"course-tag-text"
>
{{
course
.
name
}}
</span>
<van-icon
name=
"cross"
@
click
.
stop=
"removeCourse(course)"
/>
</span>
</div>
<van-popup
v-model=
"show"
class=
"course-popup"
position=
"bottom"
round
>
<div
class=
"course-picker"
>
<div
class=
"course-picker-title"
>
课程选择
</div>
<van-search
v-model
.
trim=
"keyword"
placeholder=
"搜索"
shape=
"round"
/>
<div
class=
"course-list"
>
<div
v-if=
"loading"
class=
"course-empty"
>
加载中...
</div>
<div
v-else-if=
"!filteredCourses.length"
class=
"course-empty"
>
暂无课程
</div>
<template
v-else
>
<div
v-for=
"course in filteredCourses"
:key=
"course.id"
class=
"course-option"
:class=
"
{ selected: isSelected(course) }"
@click.stop="toggleCourse(course)">
<span>
{{
course
.
name
}}
</span>
<van-icon
v-if=
"isSelected(course)"
name=
"success"
/>
</div>
</
template
>
</div>
<div
class=
"course-actions"
>
<button
class=
"course-cancel"
type=
"button"
@
click
.
stop=
"show = false"
>
取消
</button>
<button
class=
"course-confirm"
type=
"button"
@
click
.
stop=
"confirm"
>
确认
</button>
</div>
</div>
</van-popup>
</div>
</template>
<
script
>
export
default
{
name
:
"CourseMultiSelect"
,
props
:
{
value
:
{
type
:
Array
,
default
:
()
=>
[],
},
courses
:
{
type
:
Array
,
default
:
()
=>
[],
},
label
:
{
type
:
String
,
default
:
"推送课程"
,
},
placeholder
:
{
type
:
String
,
default
:
"点击选择(可多选)"
,
},
required
:
{
type
:
Boolean
,
default
:
false
,
},
loading
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
show
:
false
,
keyword
:
""
,
tempSelected
:
[],
};
},
computed
:
{
selectedCourses
()
{
return
this
.
courses
.
filter
(
course
=>
this
.
value
.
includes
(
course
.
id
));
},
filteredCourses
()
{
const
keyword
=
this
.
keyword
.
trim
().
toLowerCase
();
if
(
!
keyword
)
return
this
.
courses
;
return
this
.
courses
.
filter
(
course
=>
course
.
name
.
toLowerCase
().
includes
(
keyword
));
},
},
methods
:
{
openPicker
()
{
this
.
keyword
=
""
;
this
.
tempSelected
=
[...
this
.
value
];
this
.
show
=
true
;
this
.
$emit
(
"open"
);
},
isSelected
(
course
)
{
return
this
.
tempSelected
.
includes
(
course
.
id
);
},
toggleCourse
(
course
)
{
const
index
=
this
.
tempSelected
.
indexOf
(
course
.
id
);
if
(
index
>
-
1
)
{
this
.
tempSelected
.
splice
(
index
,
1
);
return
;
}
this
.
tempSelected
.
push
(
course
.
id
);
},
confirm
()
{
this
.
updateValue
(
this
.
tempSelected
);
this
.
show
=
false
;
},
removeCourse
(
course
)
{
this
.
updateValue
(
this
.
value
.
filter
(
id
=>
id
!==
course
.
id
));
},
updateValue
(
ids
)
{
const
selectedSet
=
new
Set
(
ids
);
const
selectedCourses
=
this
.
courses
.
filter
(
course
=>
selectedSet
.
has
(
course
.
id
));
this
.
$emit
(
"input"
,
selectedCourses
.
map
(
course
=>
course
.
id
));
this
.
$emit
(
"change"
,
selectedCourses
);
},
},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.course-select
{
width
:
100%
;
}
.course-row-header
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
min-height
:
22px
;
em
{
color
:
#ee0a24
;
font-style
:
normal
;
}
}
.course-row-link
{
flex
:
1
;
min-width
:
0
;
margin-left
:
14px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-end
;
.placeholder
{
min-width
:
0
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
color
:
#00000040
;
}
.van-icon
{
margin-left
:
4px
;
color
:
#00000040
;
}
}
.course-tags
{
display
:
flex
;
flex-wrap
:
wrap
;
gap
:
7px
;
justify-content
:
flex-start
;
margin-top
:
8px
;
}
.course-tag
{
max-width
:
100%
;
height
:
22px
;
line-height
:
20px
;
padding
:
0
8px
;
box-sizing
:
border-box
;
border
:
1px
solid
#dfe3eb
;
border-radius
:
3px
;
background
:
#f7f8fa
;
color
:
#1f2d3d
;
font-size
:
13px
;
display
:
inline-flex
;
align-items
:
center
;
min-width
:
0
;
.van-icon
{
flex
:
0
0
auto
;
margin-left
:
6px
;
color
:
#8a93a3
;
font-size
:
12px
;
}
}
.course-tag-text
{
min-width
:
0
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.course-popup
{
background
:
#fff
;
}
.course-picker
{
height
:
712px
;
max-height
:
84vh
;
display
:
flex
;
flex-direction
:
column
;
background
:
#fff
;
}
.course-picker-title
{
height
:
50px
;
line-height
:
50px
;
text-align
:
center
;
font-size
:
17px
;
font-weight
:
600
;
color
:
#1f2d3d
;
border-bottom
:
1px
solid
#edf0f5
;
}
.course-list
{
flex
:
1
;
min-height
:
0
;
overflow-y
:
auto
;
padding
:
10px
18px
0
;
box-sizing
:
border-box
;
}
.course-option
{
min-height
:
50px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
border-bottom
:
1px
solid
#edf0f5
;
color
:
#1f2d3d
;
font-size
:
14px
;
line-height
:
20px
;
span
{
flex
:
1
;
min-width
:
0
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.van-icon
{
margin-left
:
12px
;
color
:
#2f66f6
;
font-size
:
18px
;
}
&
.selected
{
color
:
#2f66f6
;
}
}
.course-empty
{
padding
:
50px
0
;
text-align
:
center
;
color
:
#969799
;
font-size
:
14px
;
}
.course-actions
{
display
:
flex
;
gap
:
14px
;
padding
:
14px
18px
20px
;
box-sizing
:
border-box
;
border-top
:
1px
solid
#f0f0f0
;
button
{
flex
:
1
;
height
:
40px
;
border
:
0
;
border-radius
:
8px
;
font-size
:
16px
;
}
}
.course-cancel
{
background
:
#f5f6f8
;
color
:
#1f2d3d
;
}
.course-confirm
{
background
:
#2f66f6
;
color
:
#fff
;
}
</
style
>
src/views/mine/view/approvalDetail.vue
View file @
a2877b7
...
...
@@ -113,7 +113,8 @@ export default {
<
style
lang=
"scss"
scoped
>
.approval-page
{
min-height
:
100%
;
height
:
100%
;
overflow
:
auto
;
background
:
#f2f3f7
;
box-sizing
:
border-box
;
padding
:
0
12px
96px
;
...
...
src/views/mine/view/approvalSubmit.vue
View file @
a2877b7
...
...
@@ -4,14 +4,27 @@
<div
v-for=
"item in approveFormItems"
:key=
"item.key"
class=
"form-row"
@
click=
"handleFormItemClick(item)"
>
<span>
{{
item
.
label
}}
<em
v-if=
"item.required"
>
*
</em></span>
<div
class=
"row-value"
>
<span
:class=
"
{ placeholder: !getFormValue(item) }">
{{
getFormValue
(
item
)
||
item
.
placeholder
}}
</span>
<van-icon
name=
"arrow"
/>
</div>
:class=
"
{ 'course-form-row': item.type === 'course' }"
@click="item.type !== 'course'
&&
handleFormItemClick(item)">
<template
v-if=
"item.type === 'course'"
>
<CourseMultiSelect
:courses=
"dicts.course"
:label=
"item.label"
:loading=
"courseLoading"
:placeholder=
"item.placeholder"
:required=
"item.required"
:value=
"courseIdList"
@
change=
"setSelectedCourses"
@
open=
"loadCourseList"
/>
</
template
>
<
template
v-else
>
<span>
{{
item
.
label
}}
<em
v-if=
"item.required"
>
*
</em></span>
<div
class=
"row-value"
>
<span
:class=
"
{ placeholder: !getFormValue(item) }">
{{
getFormValue
(
item
)
||
item
.
placeholder
}}
</span>
<van-icon
name=
"arrow"
/>
</div>
</
template
>
</div>
</div>
...
...
@@ -68,6 +81,7 @@ import dayjs from "dayjs";
import
{
Toast
}
from
"vant"
;
import
api
from
"@/api/mine"
;
import
util
from
"@/utils/util"
;
import
CourseMultiSelect
from
"../components/courseMultiSelect.vue"
;
const
DICT_CONFIG
=
{
scene
:
{
typeCode
:
"teaching_scene"
,
title
:
"选择带教场景"
},
...
...
@@ -109,6 +123,15 @@ const APPROVE_FORM_CONFIG = [
placeholder
:
"点击选择"
,
},
{
key
:
"course"
,
label
:
"推送课程"
,
required
:
true
,
requiredKey
:
"selectedCourseIds"
,
valueKey
:
"selectedCourseNames"
,
type
:
"course"
,
placeholder
:
"点击选择(可多选)"
,
},
{
key
:
"topic"
,
label
:
"带教主题"
,
valueKey
:
"teachingTopicName"
,
...
...
@@ -162,12 +185,17 @@ const APPROVE_SUBMIT_KEYS = [
"teachingTime"
,
"teachingMethodCode"
,
"teachingMethodName"
,
"selectedCourseIds"
,
"selectedCourseNames"
,
"teachingTopicCode"
,
"teachingTopicName"
,
];
export
default
{
name
:
"MineApprovalSubmit"
,
components
:
{
CourseMultiSelect
,
},
data
()
{
return
{
userInfo
:
{},
...
...
@@ -181,12 +209,14 @@ export default {
methodOnline
:
[],
methodOffline
:
[],
topic
:
[],
course
:
[],
},
picker
:
{
show
:
false
,
key
:
""
,
title
:
""
,
},
courseLoading
:
false
,
submitting
:
false
,
form
:
{
assignedSupervisorPhone
:
""
,
...
...
@@ -197,6 +227,8 @@ export default {
teachingTime
:
""
,
teachingMethodCode
:
""
,
teachingMethodName
:
""
,
selectedCourseIds
:
""
,
selectedCourseNames
:
""
,
teachingTopicCode
:
""
,
teachingTopicName
:
""
,
rejectReason
:
""
,
...
...
@@ -211,7 +243,7 @@ export default {
return
this
.
isApprove
?
"通过"
:
"驳回"
;
},
approveFormItems
()
{
return
APPROVE_FORM_CONFIG
;
return
APPROVE_FORM_CONFIG
.
filter
(
item
=>
item
.
key
!==
"course"
||
this
.
shouldShowCoursePicker
)
;
},
rejectFormItems
()
{
return
REJECT_FORM_CONFIG
;
...
...
@@ -226,6 +258,23 @@ export default {
const
sceneText
=
`
${
this
.
form
.
teachingSceneCode
}${
this
.
form
.
teachingSceneName
}
`
;
return
sceneText
.
includes
(
"线下"
)
||
sceneText
.
includes
(
"offline"
)
?
"methodOffline"
:
"methodOnline"
;
},
isOnlineScene
()
{
const
sceneText
=
`
${
this
.
form
.
teachingSceneCode
}${
this
.
form
.
teachingSceneName
}
`
.
toLowerCase
();
return
Boolean
(
sceneText
)
&&
!
sceneText
.
includes
(
"线下"
)
&&
!
sceneText
.
includes
(
"offline"
);
},
isCoursePushMethod
()
{
const
methodText
=
`
${
this
.
form
.
teachingMethodCode
}${
this
.
form
.
teachingMethodName
}
`
;
return
methodText
.
includes
(
"课程推送"
);
},
shouldShowCoursePicker
()
{
return
this
.
isOnlineScene
&&
this
.
isCoursePushMethod
;
},
courseIdList
()
{
return
this
.
form
.
selectedCourseIds
?
this
.
form
.
selectedCourseIds
.
split
(
","
).
filter
(
Boolean
)
:
[];
},
selectedCourses
()
{
return
this
.
dicts
.
course
.
filter
(
course
=>
this
.
courseIdList
.
includes
(
course
.
id
));
},
pickerColumns
()
{
if
(
this
.
picker
.
key
===
"supervisor"
)
return
this
.
dicts
.
supervisor
;
...
...
@@ -284,11 +333,24 @@ export default {
uuid
:
item
.
uuid
||
""
,
};
},
normalizeCourseItem
(
item
)
{
const
id
=
item
.
courseId
||
item
.
id
||
item
.
courseCode
||
item
.
code
||
item
.
uuid
||
""
;
const
name
=
item
.
courseName
||
item
.
name
||
item
.
title
||
item
.
label
||
""
;
return
{
...
item
,
id
:
String
(
id
),
name
,
};
},
handleFormItemClick
(
item
)
{
if
(
item
.
type
===
"datetime"
)
{
this
.
showTimePicker
=
true
;
return
;
}
if
(
item
.
key
===
"method"
&&
!
this
.
form
.
teachingSceneCode
&&
!
this
.
form
.
teachingSceneName
)
{
Toast
(
"请先选带教场景。"
);
return
;
}
this
.
openPicker
(
item
);
},
openPicker
(
item
)
{
...
...
@@ -306,6 +368,7 @@ export default {
return
;
}
this
.
applyPickerValue
(
item
);
this
.
afterPickerValueChanged
();
this
.
picker
.
show
=
false
;
},
applyPickerValue
(
item
)
{
...
...
@@ -318,6 +381,39 @@ export default {
this
.
form
.
teachingTime
=
dayjs
(
value
).
format
(
"YYYY-MM-DD HH:mm"
);
this
.
showTimePicker
=
false
;
},
afterPickerValueChanged
()
{
if
(
this
.
picker
.
key
===
"scene"
||
this
.
picker
.
key
===
"method"
)
this
.
clearSelectedCourses
();
},
clearSelectedCourses
()
{
this
.
form
.
selectedCourseIds
=
""
;
this
.
form
.
selectedCourseNames
=
""
;
},
async
loadCourseList
()
{
if
(
this
.
dicts
.
course
.
length
)
return
;
this
.
courseLoading
=
true
;
try
{
const
res
=
await
api
.
getAllCoursePage
({
pageNum
:
1
,
pageSize
:
9999
,
sortType
:
0
,
sortOrder
:
"desc"
,
staffPhone
:
this
.
userInfo
.
phone
,
});
const
data
=
res
.
data
||
res
||
{};
const
list
=
data
.
list
||
data
.
records
||
data
.
rows
||
data
||
[];
this
.
dicts
.
course
=
(
Array
.
isArray
(
list
)
?
list
:
[]).
map
(
this
.
normalizeCourseItem
).
filter
(
item
=>
item
.
id
&&
item
.
name
);
}
catch
(
error
)
{
Toast
(
"课程加载失败"
);
}
finally
{
this
.
courseLoading
=
false
;
}
},
setSelectedCourses
(
courses
)
{
this
.
form
.
selectedCourseIds
=
courses
.
map
(
course
=>
course
.
id
).
join
(
","
);
this
.
form
.
selectedCourseNames
=
courses
.
map
(
course
=>
course
.
name
).
join
(
","
);
},
getFormValue
(
item
)
{
return
this
.
form
[
item
.
valueKey
];
},
...
...
@@ -354,6 +450,7 @@ export default {
return
{
...
params
,
...
this
.
pickFormValues
(
APPROVE_SUBMIT_KEYS
),
courseList
:
this
.
selectedCourses
.
map
(
course
=>
({
bcCourseId
:
course
.
id
,
bcCourseName
:
course
.
name
})),
};
},
pickFormValues
(
keys
)
{
...
...
@@ -423,6 +520,7 @@ export default {
background
:
#fff
;
border-radius
:
8px
;
overflow
:
hidden
;
margin
:
4px
0
;
}
.form-row
{
...
...
@@ -446,6 +544,14 @@ export default {
}
}
.course-form-row
{
height
:
auto
;
min-height
:
52px
;
display
:
block
;
padding-top
:
12px
;
padding-bottom
:
8px
;
}
.row-value
{
flex
:
1
;
min-width
:
0
;
...
...
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