|
@@ -86,7 +86,7 @@
|
|
|
<el-select style="width: 100% !important;"
|
|
|
filterable
|
|
|
clearable
|
|
|
- @change="onBranchChange"
|
|
|
+ @change="onSubjectChange('search')"
|
|
|
v-model="result.organId"
|
|
|
placeholder="请选择">
|
|
|
<el-option v-for="item in branchList"
|
|
@@ -96,20 +96,45 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item prop="subjectIds"
|
|
|
+ label="所属声部"
|
|
|
+ style="width: 500px">
|
|
|
+ <el-select style="width: 100% !important;"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ multiple
|
|
|
+ @change="onSubjectChange('search')"
|
|
|
+ v-model="result.subjectIds"
|
|
|
+ placeholder="请选择">
|
|
|
+ <el-option-group
|
|
|
+ v-for="(group, index) in subjectTreeList"
|
|
|
+ :key="index"
|
|
|
+ :label="group.label">
|
|
|
+ <el-option
|
|
|
+ v-for="(item, i) in group.options"
|
|
|
+ :key="i"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value.toString()">
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item prop="teacherId"
|
|
|
label="老师"
|
|
|
style="width: 500px">
|
|
|
- <el-select style="width: 100% !important;"
|
|
|
+ <el-select style="width: 80% !important;"
|
|
|
v-model="result.teacherId"
|
|
|
filterable
|
|
|
clearable
|
|
|
multiple
|
|
|
placeholder="请选择">
|
|
|
- <el-option v-for="item in teacherList"
|
|
|
- :key="item.value"
|
|
|
+ <el-option v-for="(item, index) in teacherList"
|
|
|
+ :key="index"
|
|
|
:label="item.label"
|
|
|
:value="item.value.toString()"> </el-option>
|
|
|
</el-select>
|
|
|
+ <el-button @click="onCheckAll">全选</el-button>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button @click="resetForm">重置</el-button>
|
|
@@ -122,7 +147,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import store from '@/store'
|
|
|
-import { getEmployeeOrgan } from '@/api/buildTeam'
|
|
|
+import { getEmployeeOrgan, getSoundTree } from '@/api/buildTeam'
|
|
|
import { courseScheduleRewardsQuery, getUserRole, courseScheduleRewardsAdd, courseScheduleRewardsUpdate, findTeacherByOrganId } from '@/api/systemManage'
|
|
|
import { vipGroupCategory } from "@/api/vipSeting"
|
|
|
export default {
|
|
@@ -135,6 +160,7 @@ export default {
|
|
|
searchForm: this.$route.query.searchForm,
|
|
|
branchList: [],
|
|
|
teacherList: [], // 老师列表
|
|
|
+ subjectTreeList: [], // 声部列表
|
|
|
vipGroupCategoryList: [],
|
|
|
result: {
|
|
|
name: null,
|
|
@@ -142,6 +168,7 @@ export default {
|
|
|
vipGroupCategoryIdList: null,
|
|
|
organId: null,
|
|
|
teacherId: null,
|
|
|
+ subjectIds: null,
|
|
|
courseScheduleType: 'VIP',
|
|
|
domains: [{
|
|
|
min: null,
|
|
@@ -157,6 +184,7 @@ export default {
|
|
|
rewardMode: [{ required: true, message: '请选择活动类型', trigger: 'change' }],
|
|
|
vipGroupCategoryIdList: [{ type: 'array', required: true, message: '请选择课程类型', trigger: 'change' }],
|
|
|
organId: [{ required: true, message: '请选择所属分部', trigger: 'change' }],
|
|
|
+ subjectIds: [{ type: 'array', required: true, message: '请选择所属声部', trigger: 'change' }],
|
|
|
teacherId: [{ type: 'array', required: true, message: '请选择老师', trigger: 'change' }]
|
|
|
}
|
|
|
}
|
|
@@ -189,16 +217,38 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ let subjectTree = await getSoundTree({ delFlag: 0, rows: 9999 })
|
|
|
+ if(subjectTree.code == 200) {
|
|
|
+ let subjectResult = subjectTree.data
|
|
|
+ subjectResult.rows.forEach(element => {
|
|
|
+ let tempElement = {}
|
|
|
+ tempElement = { label: element.name, options: [] }
|
|
|
+ // 判断子级声部是否为空
|
|
|
+ if(element.subjects) {
|
|
|
+ element.subjects.forEach(subject => {
|
|
|
+ tempElement.options.push({
|
|
|
+ value: subject.id,
|
|
|
+ label: subject.name
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.subjectTreeList.push(tempElement)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
if (this.pageType == 'update') {
|
|
|
let courseScheduleRewards = await courseScheduleRewardsQuery({ id: this.id })
|
|
|
if (courseScheduleRewards.code == 200) {
|
|
|
let data = courseScheduleRewards.data
|
|
|
- this.onBranchChange(data.organId)
|
|
|
+ this.result.organId = data.organId
|
|
|
+ this.result.subjectIds = data.subjectIds ? data.subjectIds.split(',') : data.subjectIds
|
|
|
+ this.onSubjectChange('update')
|
|
|
this.result = {
|
|
|
id: data.id,
|
|
|
name: data.name,
|
|
|
rewardMode: data.rewardMode,
|
|
|
organId: data.organId,
|
|
|
+ subjectIds: data.subjectIds ? data.subjectIds.split(',') : data.subjectIds,
|
|
|
vipGroupCategoryIdList: data.vipGroupCategoryIdList ? data.vipGroupCategoryIdList.split(',') : data.vipGroupCategoryIdList,
|
|
|
teacherId: data.teacherId ? data.teacherId.split(',') : data.teacherId,
|
|
|
courseScheduleType: data.courseScheduleType,
|
|
@@ -215,9 +265,22 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onBranchChange (value) {
|
|
|
- findTeacherByOrganId({ organId: value }).then(res => {
|
|
|
+ async onSubjectChange(type) {
|
|
|
+ let organId = this.result.organId
|
|
|
+ let subject = this.result.subjectIds
|
|
|
+ // 判断是否有分部和声部
|
|
|
+ if(subject.length <= 0 || !organId || organId == '') {
|
|
|
+ this.teacherList = []
|
|
|
+ this.result.teacherId = []
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let subjectIds = Object.assign([], subject).join(',')
|
|
|
+ await findTeacherByOrganId({ organId: organId, subjectIds: subjectIds, jobNature: 'FULL_TIME' }).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
+ if(type != 'update') {
|
|
|
+ this.teacherList = []
|
|
|
+ this.result.teacherId = []
|
|
|
+ }
|
|
|
res.data.forEach(item => {
|
|
|
this.teacherList.push({
|
|
|
label: item.realName,
|
|
@@ -227,10 +290,19 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ onCheckAll() { // 全选老师
|
|
|
+ if(this.teacherList.length <= 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.result.teacherId = []
|
|
|
+ this.teacherList.forEach(item => {
|
|
|
+ this.result.teacherId.push(item.value.toString())
|
|
|
+ })
|
|
|
+ },
|
|
|
onSubmit (formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
- this.addDomain(this.result, true)
|
|
|
let result = JSON.parse(JSON.stringify(this.result))
|
|
|
+ this.addDomain(result, true)
|
|
|
if (valid && !result.errorText) {
|
|
|
// 如果奖励金额为空时,默认为0
|
|
|
result.domains.forEach(item => {
|
|
@@ -244,6 +316,7 @@ export default {
|
|
|
teacherId: result.teacherId.join(','),
|
|
|
courseScheduleType: result.courseScheduleType,
|
|
|
rewardMode: result.rewardMode,
|
|
|
+ subjectIds: result.subjectIds.join(','),
|
|
|
rewardsRulesJson: JSON.stringify(result.domains),
|
|
|
name: result.name
|
|
|
}
|
|
@@ -276,10 +349,13 @@ export default {
|
|
|
this.$router.push({ path: '/vipClassSet/branchActive', query: { rules: this.pageInfo, searchForm: this.searchForm } })
|
|
|
},
|
|
|
resetForm () {
|
|
|
+ this.teacherList = []
|
|
|
this.result = {
|
|
|
name: null,
|
|
|
rewardMode: null,
|
|
|
organId: null,
|
|
|
+ subjectIds: [],
|
|
|
+ teacherId: [],
|
|
|
courseScheduleType: 'VIP',
|
|
|
domains: [{
|
|
|
min: null,
|