|
@@ -73,10 +73,10 @@
|
|
|
clearable
|
|
|
multiple
|
|
|
placeholder="请选择">
|
|
|
- <el-option v-for="item in vipGroupCategoryList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value.toString()"> </el-option>
|
|
|
+ <el-option v-for="item in selects.vipGroupCategory"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id.toString()"> </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -89,10 +89,10 @@
|
|
|
@change="onSubjectChange('search')"
|
|
|
v-model.trim="result.organId"
|
|
|
placeholder="请选择">
|
|
|
- <el-option v-for="item in branchList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value.toString()"> </el-option>
|
|
|
+ <el-option v-for="item in selects.branchs"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id.toString()"> </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -106,15 +106,10 @@
|
|
|
@change="onSubjectChange('search')"
|
|
|
v-model.trim="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"
|
|
|
+ <el-option v-for="(item, i) in selects.subjects"
|
|
|
:key="i"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value.toString()">
|
|
|
- </el-option>
|
|
|
- </el-option-group>
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id.toString()"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -144,7 +139,6 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import store from '@/store'
|
|
|
import { getEmployeeOrgan, getSoundTree } from '@/api/buildTeam'
|
|
|
import { courseScheduleRewardsQuery, getUserRole, courseScheduleRewardsAdd, courseScheduleRewardsUpdate, findTeacherByOrganId } from '@/api/systemManage'
|
|
|
import { vipGroupCategory } from "@/api/vipSeting"
|
|
@@ -155,12 +149,7 @@ export default {
|
|
|
organId: null,
|
|
|
pageType: this.$route.query.type,
|
|
|
id: this.$route.query.id,
|
|
|
- pageInfo: this.$route.query.pageInfo,
|
|
|
- searchForm: this.$route.query.searchForm,
|
|
|
- branchList: [],
|
|
|
teacherList: [], // 老师列表
|
|
|
- subjectTreeList: [], // 声部列表
|
|
|
- vipGroupCategoryList: [],
|
|
|
result: {
|
|
|
name: null,
|
|
|
rewardMode: null,
|
|
@@ -189,91 +178,46 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
|
- this.pageType = this.$route.query.type
|
|
|
- this.id = this.$route.query.id
|
|
|
- this.pageInfo = this.$route.query.pageInfo
|
|
|
- this.searchForm = this.$route.query.searchForm
|
|
|
- this.__init()
|
|
|
- },
|
|
|
- activated () {
|
|
|
- this.pageType = this.$route.query.type
|
|
|
- this.id = this.$route.query.id
|
|
|
- this.pageInfo = this.$route.query.pageInfo
|
|
|
- this.searchForm = this.$route.query.searchForm
|
|
|
this.__init()
|
|
|
},
|
|
|
methods: {
|
|
|
async __init () {
|
|
|
this.$refs.form.resetFields()
|
|
|
- let vipGroupCategoryList = await vipGroupCategory({ page: 1, rows: 9999 })
|
|
|
- if (vipGroupCategoryList.code == 200) {
|
|
|
- this.vipGroupCategoryList = []
|
|
|
- vipGroupCategoryList.data.forEach(item => {
|
|
|
- this.vipGroupCategoryList.push({
|
|
|
- label: item.name,
|
|
|
- value: item.id
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- let branchList = await getEmployeeOrgan({ delFlag: 0, rows: 9999 })
|
|
|
- if (branchList.code == 200) {
|
|
|
- this.branchList = []
|
|
|
- branchList.data.forEach(item => {
|
|
|
- let tempArr = {}
|
|
|
- tempArr = {
|
|
|
- label: item.name,
|
|
|
- value: item.id
|
|
|
- }
|
|
|
- this.branchList.push(tempArr)
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- 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)
|
|
|
- })
|
|
|
- }
|
|
|
+ // 获取类型
|
|
|
+ this.$store.dispatch('setVipGroupCategory')
|
|
|
+ // 获取分部
|
|
|
+ this.$store.dispatch('setBranchs')
|
|
|
+ // 获取声部
|
|
|
+ this.$store.dispatch('setSubjects')
|
|
|
|
|
|
if (this.pageType == 'update') {
|
|
|
let courseScheduleRewards = await courseScheduleRewardsQuery({ id: this.id })
|
|
|
if (courseScheduleRewards.code == 200) {
|
|
|
let data = courseScheduleRewards.data
|
|
|
- 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,
|
|
|
- domains: data.rewardsRulesJson ?
|
|
|
- JSON.parse(data.rewardsRulesJson) : [{
|
|
|
- min: null,
|
|
|
- max: null,
|
|
|
- money: null,
|
|
|
- disabled: false,
|
|
|
- key: Date.now()
|
|
|
- }],
|
|
|
- errorText: null
|
|
|
- }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ 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,
|
|
|
+ domains: data.rewardsRulesJson ?
|
|
|
+ JSON.parse(data.rewardsRulesJson) : [{
|
|
|
+ min: null,
|
|
|
+ max: null,
|
|
|
+ money: null,
|
|
|
+ disabled: false,
|
|
|
+ key: Date.now()
|
|
|
+ }],
|
|
|
+ errorText: null
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
} else {
|
|
|
this.resetForm()
|