|
@@ -62,8 +62,8 @@
|
|
|
clearable
|
|
|
@change="() => courseItemChange(item, index)"
|
|
|
filterable>
|
|
|
- <el-option v-for="item in courseTypes"
|
|
|
- :key="item.courseType"
|
|
|
+ <el-option v-for="(item, i) in courseTypes"
|
|
|
+ :key="i"
|
|
|
:label="courseType[item.courseType]"
|
|
|
:disabled="isOptionDisabled(item.courseType)"
|
|
|
:value="item.courseType">
|
|
@@ -182,6 +182,7 @@ import {
|
|
|
musicGroupOrganizationCourseSettingsUpdate,
|
|
|
getOrganizationCourseUnitPriceSettings
|
|
|
} from '@/api/specialSetting'
|
|
|
+import { queryByMusicGroupOrganizationCourseSettingsId } from '../../../resetTeaming/api'
|
|
|
import { classTimeList } from '@/utils/searchArray'
|
|
|
import { courseType, boolOptions } from '@/constant'
|
|
|
import { objectToOptions } from '@/utils'
|
|
@@ -189,9 +190,10 @@ import numeral from 'numeral'
|
|
|
|
|
|
const plusNum = (items = [], key) => {
|
|
|
let money = 0
|
|
|
- const _items = items.filter(item => item.isStudentOptional === 'false')
|
|
|
- for (const item of _items) {
|
|
|
- money += parseFloat(parseFloat(item[key] || 0).toFixed(2) || 0)
|
|
|
+ for (const item of items) {
|
|
|
+ if (item) {
|
|
|
+ money += parseFloat(parseFloat(item[key] || 0).toFixed(2) || 0)
|
|
|
+ }
|
|
|
}
|
|
|
return money
|
|
|
}
|
|
@@ -230,25 +232,34 @@ export default {
|
|
|
rowDetail() {
|
|
|
this.updateForm()
|
|
|
},
|
|
|
+ async 'form.organId'() {
|
|
|
+ this.FetchOrganizationCourseUnitPriceSettings()
|
|
|
+ },
|
|
|
async 'form.chargeTypeId'() {
|
|
|
- try {
|
|
|
- const res = await getOrganizationCourseUnitPriceSettings({
|
|
|
- chargeTypeId: this.form.chargeTypeId,
|
|
|
- rows: 9999
|
|
|
- })
|
|
|
- const d = {}
|
|
|
- this.courseTypes = res.data.rows
|
|
|
- for (const item of this.courseTypes) {
|
|
|
- d[item.courseType] = item
|
|
|
- }
|
|
|
- this.courseTypesByType = d
|
|
|
- } catch (error) {}
|
|
|
+ this.FetchOrganizationCourseUnitPriceSettings()
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.updateForm()
|
|
|
},
|
|
|
methods: {
|
|
|
+ async FetchOrganizationCourseUnitPriceSettings() {
|
|
|
+ try {
|
|
|
+ if (this.form.organId && this.form.chargeTypeId) {
|
|
|
+ const res = await getOrganizationCourseUnitPriceSettings({
|
|
|
+ chargeTypeId: this.form.chargeTypeId,
|
|
|
+ organId: this.form.organId,
|
|
|
+ rows: 9999
|
|
|
+ })
|
|
|
+ const d = {}
|
|
|
+ this.courseTypes = res.data.rows
|
|
|
+ for (const item of this.courseTypes) {
|
|
|
+ d[item.courseType] = item
|
|
|
+ }
|
|
|
+ this.courseTypesByType = d
|
|
|
+ }
|
|
|
+ } catch (error) {}
|
|
|
+ },
|
|
|
courseItemChange(item, index) {
|
|
|
if (item.courseType) {
|
|
|
const active = this.courseTypesByType[item.courseType] || {}
|
|
@@ -261,7 +272,7 @@ export default {
|
|
|
this.$set(this.form, `details`, [..._list])
|
|
|
}
|
|
|
},
|
|
|
- updateForm() {
|
|
|
+ async updateForm() {
|
|
|
if (this.rowDetail) {
|
|
|
const { organId, classTimeList, chargeTypeId, name, details } = this.rowDetail
|
|
|
this.form = {
|
|
@@ -269,11 +280,16 @@ export default {
|
|
|
classTimeList,
|
|
|
chargeTypeId,
|
|
|
name,
|
|
|
- details: details.map(item => ({
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await queryByMusicGroupOrganizationCourseSettingsId({
|
|
|
+ id: this.rowDetail.id
|
|
|
+ })
|
|
|
+ this.$set(this.form, 'details', res.data.map(item => ({
|
|
|
...item,
|
|
|
isStudentOptional: String(item.isStudentOptional)
|
|
|
- }))
|
|
|
- }
|
|
|
+ })))
|
|
|
+ } catch (error) {}
|
|
|
} else {
|
|
|
this.form = {...initForm}
|
|
|
}
|