|
@@ -1,46 +1,60 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <el-form :model="form"
|
|
|
|
- label-suffix=": "
|
|
|
|
-
|
|
|
|
- ref="form">
|
|
|
|
- <el-form-item label="所属分部"
|
|
|
|
- prop="organId"
|
|
|
|
- :rules="[{required: true, message: '请选择所属分部', trigger: 'change'}]"
|
|
|
|
- :label-width="formLabelWidth">
|
|
|
|
- <el-select v-model.trim="form.organId"
|
|
|
|
- clearable
|
|
|
|
- placeholder="请选择所属分部"
|
|
|
|
- filterable>
|
|
|
|
- <el-option v-for="(item, index) in branchList"
|
|
|
|
- :key="index"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
|
|
+ <el-form :model="form" label-suffix=": " ref="form">
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="所属分部"
|
|
|
|
+ prop="organId"
|
|
|
|
+ :rules="[{ required: true, message: '请选择所属分部', trigger: 'change' }]"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-select
|
|
|
|
+ v-model.trim="form.organId"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择所属分部"
|
|
|
|
+ filterable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, index) in branchList"
|
|
|
|
+ :key="index"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="乐团模式"
|
|
|
|
- prop="chargeTypeId"
|
|
|
|
- :rules="[{required: true, message: '请选择乐团模式', trigger: 'change'}]"
|
|
|
|
- :label-width="formLabelWidth">
|
|
|
|
- <el-select v-model.trim="form.chargeTypeId"
|
|
|
|
- clearable
|
|
|
|
- placeholder="请选择乐团模式"
|
|
|
|
- filterable>
|
|
|
|
- <el-option v-for="(item, index) in typesList"
|
|
|
|
- :key="index"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value">
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="乐团模式"
|
|
|
|
+ prop="courseViewType"
|
|
|
|
+ :rules="[{ required: true, message: '请选择乐团模式', trigger: 'change' }]"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-select
|
|
|
|
+ v-model.trim="form.courseViewType"
|
|
|
|
+ clearable
|
|
|
|
+ placeholder="请选择乐团模式"
|
|
|
|
+ filterable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, index) in typesList"
|
|
|
|
+ :key="index"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="收费方式名称"
|
|
|
|
- prop="name"
|
|
|
|
- :rules="[{required: true, message: '请输入收费方式名称', trigger: 'blur'}]"
|
|
|
|
- :label-width="formLabelWidth">
|
|
|
|
- <el-input v-model.trim="form.name" style="width: 98% !important;"
|
|
|
|
- placeholder="请输入收费方式名称"
|
|
|
|
- clearable>
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ label="收费方式名称"
|
|
|
|
+ prop="name"
|
|
|
|
+ :rules="[{ required: true, message: '请输入收费方式名称', trigger: 'blur' }]"
|
|
|
|
+ :label-width="formLabelWidth"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ v-model.trim="form.name"
|
|
|
|
+ style="width: 98% !important"
|
|
|
|
+ placeholder="请输入收费方式名称"
|
|
|
|
+ clearable
|
|
|
|
+ >
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<div class="class-items">
|
|
<div class="class-items">
|
|
@@ -53,21 +67,24 @@
|
|
<span class="name">原价(元)</span>
|
|
<span class="name">原价(元)</span>
|
|
<span class="ctrl"></span>
|
|
<span class="ctrl"></span>
|
|
</div>
|
|
</div>
|
|
- <div class="item"
|
|
|
|
- v-for="(item, index) in form.details"
|
|
|
|
- :key="index">
|
|
|
|
- <el-form-item :prop="`details.${index}.courseType`"
|
|
|
|
- :rules="[{required: true, message: '请选择课程类型', trigger: 'change'}]">
|
|
|
|
- <el-select v-model.trim="item.courseType"
|
|
|
|
-
|
|
|
|
- clearable
|
|
|
|
- @change="() => courseItemChange(item, index)"
|
|
|
|
- filterable>
|
|
|
|
- <el-option v-for="(item, i) in courseTypes"
|
|
|
|
- :key="i"
|
|
|
|
- :label="courseType[item.courseType]"
|
|
|
|
- :disabled="isOptionDisabled(item.courseType)"
|
|
|
|
- :value="item.courseType">
|
|
|
|
|
|
+ <div class="item" v-for="(item, index) in form.details" :key="index">
|
|
|
|
+ <el-form-item
|
|
|
|
+ :prop="`details.${index}.courseType`"
|
|
|
|
+ :rules="[{ required: true, message: '请选择课程类型', trigger: 'change' }]"
|
|
|
|
+ >
|
|
|
|
+ <el-select
|
|
|
|
+ v-model.trim="item.courseType"
|
|
|
|
+ clearable
|
|
|
|
+ @change="() => courseItemChange(item, index)"
|
|
|
|
+ filterable
|
|
|
|
+ >
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="(item, i) in courseTypes"
|
|
|
|
+ :key="i"
|
|
|
|
+ :label="courseType[item.courseType]"
|
|
|
|
+ :disabled="isOptionDisabled(item.courseType)"
|
|
|
|
+ :value="item.courseType"
|
|
|
|
+ >
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -86,263 +103,280 @@
|
|
</el-form-item> -->
|
|
</el-form-item> -->
|
|
<el-form-item
|
|
<el-form-item
|
|
:prop="`details.${index}.courseTotalMinuties`"
|
|
:prop="`details.${index}.courseTotalMinuties`"
|
|
- :rules="[
|
|
|
|
- { required: true, message: '请输入课程时长', trigger: 'blur' },
|
|
|
|
- ]">
|
|
|
|
|
|
+ :rules="[{ required: true, message: '请输入课程时长', trigger: 'blur' }]"
|
|
|
|
+ >
|
|
<el-input-number
|
|
<el-input-number
|
|
- style="width: 90%!important;"
|
|
|
|
- class="number-input"
|
|
|
|
- v-model="item.courseTotalMinuties"
|
|
|
|
- :controls="false"
|
|
|
|
- :precision="0"
|
|
|
|
- :min="0"
|
|
|
|
- @change="() => courseItemChange(item, index)"
|
|
|
|
- placeholder="课程总时长" />
|
|
|
|
|
|
+ style="width: 90% !important"
|
|
|
|
+ class="number-input"
|
|
|
|
+ v-model="item.courseTotalMinuties"
|
|
|
|
+ :controls="false"
|
|
|
|
+ :precision="0"
|
|
|
|
+ :min="0"
|
|
|
|
+ @change="() => courseItemChange(item, index)"
|
|
|
|
+ placeholder="课程总时长"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item :prop="`details.${index}.courseCurrentPrice`"
|
|
|
|
- :rules="[{required: true, message: '请输入课程现价', trigger: 'blur'}]">
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ :prop="`details.${index}.courseCurrentPrice`"
|
|
|
|
+ :rules="[{ required: true, message: '请输入课程现价', trigger: 'blur' }]"
|
|
|
|
+ >
|
|
<el-input-number
|
|
<el-input-number
|
|
- style="width: 90%!important;"
|
|
|
|
- class="number-input"
|
|
|
|
- v-model="item.courseCurrentPrice"
|
|
|
|
- :controls="false"
|
|
|
|
- :min="0"
|
|
|
|
- placeholder="课程现价" />
|
|
|
|
|
|
+ style="width: 90% !important"
|
|
|
|
+ class="number-input"
|
|
|
|
+ v-model="item.courseCurrentPrice"
|
|
|
|
+ :controls="false"
|
|
|
|
+ :min="0"
|
|
|
|
+ placeholder="课程现价"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item :prop="`details.${index}.courseOriginalPrice`"
|
|
|
|
- :rules="[{required: true, message: '请输入课程原价', trigger: 'blur'}]">
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
+ :prop="`details.${index}.courseOriginalPrice`"
|
|
|
|
+ :rules="[{ required: true, message: '请输入课程原价', trigger: 'blur' }]"
|
|
|
|
+ >
|
|
<el-input-number
|
|
<el-input-number
|
|
- style="width: 90%!important;"
|
|
|
|
- class="number-input"
|
|
|
|
- v-model="item.courseOriginalPrice"
|
|
|
|
- :controls="false"
|
|
|
|
- :min="0"
|
|
|
|
- placeholder="课程原价" />
|
|
|
|
|
|
+ style="width: 90% !important"
|
|
|
|
+ class="number-input"
|
|
|
|
+ v-model="item.courseOriginalPrice"
|
|
|
|
+ :controls="false"
|
|
|
|
+ :min="0"
|
|
|
|
+ placeholder="课程原价"
|
|
|
|
+ />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<span class="ctrl">
|
|
<span class="ctrl">
|
|
- <i @click="removeItem(index)"
|
|
|
|
- v-if="form.details.length > 1"
|
|
|
|
- class="el-icon-circle-close" />
|
|
|
|
|
|
+ <i
|
|
|
|
+ @click="removeItem(index)"
|
|
|
|
+ v-if="form.details.length > 1"
|
|
|
|
+ class="el-icon-circle-close"
|
|
|
|
+ />
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <el-button icon="el-icon-circle-plus-outline"
|
|
|
|
- plain
|
|
|
|
- class="create-type-button"
|
|
|
|
- type="info"
|
|
|
|
-
|
|
|
|
- @click="addItem">新增课程类型</el-button>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ icon="el-icon-circle-plus-outline"
|
|
|
|
+ plain
|
|
|
|
+ class="create-type-button"
|
|
|
|
+ type="info"
|
|
|
|
+ @click="addItem"
|
|
|
|
+ >新增课程类型</el-button
|
|
|
|
+ >
|
|
</div>
|
|
</div>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
- <el-form-item label="原价"
|
|
|
|
- prop="totalOriginalPrice"
|
|
|
|
- label-width="50px">
|
|
|
|
- {{ totalOriginalPrice | moneyFormat}}元
|
|
|
|
|
|
+ <el-form-item label="原价" prop="totalOriginalPrice" label-width="50px">
|
|
|
|
+ {{ totalOriginalPrice | moneyFormat }}元
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
- <el-form-item label="现价"
|
|
|
|
- prop="totalCurrentPrice"
|
|
|
|
- label-width="50px">
|
|
|
|
- {{ totalCurrentPrice | moneyFormat}}元
|
|
|
|
|
|
+ <el-form-item label="现价" prop="totalCurrentPrice" label-width="50px">
|
|
|
|
+ {{ totalCurrentPrice | moneyFormat }}元
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</el-form>
|
|
</el-form>
|
|
- <span slot="footer"
|
|
|
|
- class="dialog-footer">
|
|
|
|
- <el-button @click="$listeners.close" >取 消</el-button>
|
|
|
|
- <el-button @click="submit" type="primary">确 定</el-button>
|
|
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="$listeners.close">取 消</el-button>
|
|
|
|
+ <el-button @click="submit" type="primary">确 定</el-button>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
const initItem = {
|
|
const initItem = {
|
|
- courseType: '',
|
|
|
|
- isStudentOptional: '',
|
|
|
|
- courseTotalMinuties: '',
|
|
|
|
- courseOriginalPrice: '',
|
|
|
|
- courseCurrentPrice: '',
|
|
|
|
-}
|
|
|
|
|
|
+ courseType: "",
|
|
|
|
+ isStudentOptional: "",
|
|
|
|
+ courseTotalMinuties: "",
|
|
|
|
+ courseOriginalPrice: "",
|
|
|
|
+ courseCurrentPrice: "",
|
|
|
|
+};
|
|
import {
|
|
import {
|
|
musicGroupOrganizationCourseSettingsAdd,
|
|
musicGroupOrganizationCourseSettingsAdd,
|
|
musicGroupOrganizationCourseSettingsUpdate,
|
|
musicGroupOrganizationCourseSettingsUpdate,
|
|
- getOrganizationCourseUnitPriceSettings
|
|
|
|
-} from '@/api/specialSetting'
|
|
|
|
-import { classTimeList, array2object } from '@/utils/searchArray'
|
|
|
|
-import { queryByMusicGroupOrganizationCourseSettingsId } from '../../../resetTeaming/api'
|
|
|
|
-import { courseType, boolOptions } from '@/constant'
|
|
|
|
-import { objectToOptions } from '@/utils'
|
|
|
|
-import numeral from 'numeral'
|
|
|
|
|
|
+ getOrganizationCourseUnitPriceSettings,
|
|
|
|
+} from "@/api/specialSetting";
|
|
|
|
+import { classTimeList, array2object } from "@/utils/searchArray";
|
|
|
|
+import { queryByMusicGroupOrganizationCourseSettingsId } from "../../../resetTeaming/api";
|
|
|
|
+import { courseType, boolOptions } from "@/constant";
|
|
|
|
+import { objectToOptions } from "@/utils";
|
|
|
|
+import numeral from "numeral";
|
|
|
|
|
|
const plusNum = (items = [], key) => {
|
|
const plusNum = (items = [], key) => {
|
|
- let money = 0
|
|
|
|
|
|
+ let money = 0;
|
|
for (const item of items) {
|
|
for (const item of items) {
|
|
if (item) {
|
|
if (item) {
|
|
- money += item[key] || 0
|
|
|
|
|
|
+ money += item[key] || 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return money
|
|
|
|
-}
|
|
|
|
|
|
+ return money;
|
|
|
|
+};
|
|
|
|
|
|
const initForm = {
|
|
const initForm = {
|
|
- organId: '',
|
|
|
|
- classTimeList: '',
|
|
|
|
- chargeTypeId: '',
|
|
|
|
- name: '',
|
|
|
|
|
|
+ organId: "",
|
|
|
|
+ classTimeList: "",
|
|
|
|
+ chargeTypeId: "",
|
|
|
|
+ name: "",
|
|
details: [{}],
|
|
details: [{}],
|
|
-}
|
|
|
|
|
|
+};
|
|
|
|
|
|
export default {
|
|
export default {
|
|
- name: 'modal-chargesForm',
|
|
|
|
- props: ['branchList', 'typesList', 'rowDetail'],
|
|
|
|
- data () {
|
|
|
|
|
|
+ name: "modal-chargesForm",
|
|
|
|
+ props: ["branchList", "typesList", "rowDetail"],
|
|
|
|
+ data() {
|
|
return {
|
|
return {
|
|
form: { ...initForm },
|
|
form: { ...initForm },
|
|
- formLabelWidth: '120px',
|
|
|
|
|
|
+ formLabelWidth: "120px",
|
|
courseType,
|
|
courseType,
|
|
courseTypeOptions: objectToOptions(courseType),
|
|
courseTypeOptions: objectToOptions(courseType),
|
|
boolOptions: objectToOptions(boolOptions),
|
|
boolOptions: objectToOptions(boolOptions),
|
|
courseTypes: [],
|
|
courseTypes: [],
|
|
courseTypesByType: {},
|
|
courseTypesByType: {},
|
|
loading: false,
|
|
loading: false,
|
|
- }
|
|
|
|
|
|
+ };
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- totalOriginalPrice () {
|
|
|
|
- return plusNum(this.form.details, 'courseOriginalPrice')
|
|
|
|
|
|
+ totalOriginalPrice() {
|
|
|
|
+ return plusNum(this.form.details, "courseOriginalPrice");
|
|
},
|
|
},
|
|
- totalCurrentPrice () {
|
|
|
|
- return plusNum(this.form.details, 'courseCurrentPrice')
|
|
|
|
|
|
+ totalCurrentPrice() {
|
|
|
|
+ return plusNum(this.form.details, "courseCurrentPrice");
|
|
},
|
|
},
|
|
classTimeList() {
|
|
classTimeList() {
|
|
- return array2object(classTimeList)
|
|
|
|
- }
|
|
|
|
|
|
+ return array2object(classTimeList);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
rowDetail: {
|
|
rowDetail: {
|
|
deep: true,
|
|
deep: true,
|
|
- handler () {
|
|
|
|
- this.updateForm()
|
|
|
|
|
|
+ handler() {
|
|
|
|
+ this.updateForm();
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- async 'form.organId' () {
|
|
|
|
- this.FetchOrganizationCourseUnitPriceSettings()
|
|
|
|
|
|
+ async "form.organId"() {
|
|
|
|
+ this.FetchOrganizationCourseUnitPriceSettings();
|
|
},
|
|
},
|
|
- async 'form.chargeTypeId' () {
|
|
|
|
- this.FetchOrganizationCourseUnitPriceSettings()
|
|
|
|
|
|
+ async "form.chargeTypeId"() {
|
|
|
|
+ this.FetchOrganizationCourseUnitPriceSettings();
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- mounted () {
|
|
|
|
- this.updateForm()
|
|
|
|
|
|
+ mounted() {
|
|
|
|
+ this.updateForm();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async FetchOrganizationCourseUnitPriceSettings () {
|
|
|
|
|
|
+ async FetchOrganizationCourseUnitPriceSettings() {
|
|
if (this.loading) {
|
|
if (this.loading) {
|
|
- return
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- this.loading = true
|
|
|
|
|
|
+ this.loading = true;
|
|
try {
|
|
try {
|
|
- if (this.form.organId && this.form.chargeTypeId) {
|
|
|
|
- this.$set(this.form, 'details', [{}])
|
|
|
|
|
|
+ if (this.form.organId && this.form.courseViewType) {
|
|
|
|
+ this.$set(this.form, "details", [{}]);
|
|
const res = await getOrganizationCourseUnitPriceSettings({
|
|
const res = await getOrganizationCourseUnitPriceSettings({
|
|
- chargeTypeId: this.form.chargeTypeId,
|
|
|
|
|
|
+ courseViewType: this.form.courseViewType,
|
|
organId: this.form.organId,
|
|
organId: this.form.organId,
|
|
- rows: 9999
|
|
|
|
- })
|
|
|
|
- const d = {}
|
|
|
|
- this.courseTypes = res.data.rows
|
|
|
|
|
|
+ rows: 9999,
|
|
|
|
+ });
|
|
|
|
+ const d = {};
|
|
|
|
+ this.courseTypes = res.data.rows;
|
|
for (const item of this.courseTypes) {
|
|
for (const item of this.courseTypes) {
|
|
- d[item.courseType] = item
|
|
|
|
|
|
+ d[item.courseType] = item;
|
|
}
|
|
}
|
|
- this.courseTypesByType = d
|
|
|
|
-
|
|
|
|
|
|
+ this.courseTypesByType = d;
|
|
}
|
|
}
|
|
- } catch (error) { }
|
|
|
|
- this.loading = false
|
|
|
|
|
|
+ } catch (error) {}
|
|
|
|
+ this.loading = false;
|
|
},
|
|
},
|
|
- courseItemChange (item, index) {
|
|
|
|
|
|
+ courseItemChange(item, index) {
|
|
if (item.courseType) {
|
|
if (item.courseType) {
|
|
- const active = this.courseTypesByType[item.courseType] || {}
|
|
|
|
- const _list = this.form.details
|
|
|
|
- const price = Math.round(numeral((active.unitPrice || 1)).multiply((item.courseTotalMinuties || 0)).value())
|
|
|
|
|
|
+ const active = this.courseTypesByType[item.courseType] || {};
|
|
|
|
+ const _list = this.form.details;
|
|
|
|
+ const price = Math.round(
|
|
|
|
+ numeral(active.unitPrice || 1)
|
|
|
|
+ .multiply(item.courseTotalMinuties || 0)
|
|
|
|
+ .value()
|
|
|
|
+ );
|
|
_list[index] = {
|
|
_list[index] = {
|
|
...item,
|
|
...item,
|
|
courseCurrentPrice: price,
|
|
courseCurrentPrice: price,
|
|
- courseOriginalPrice: price
|
|
|
|
- }
|
|
|
|
- this.$refs.form.validateField(`details.${index}.courseTotalMinuties`)
|
|
|
|
- this.$set(this.form, `details`, [..._list])
|
|
|
|
|
|
+ courseOriginalPrice: price,
|
|
|
|
+ };
|
|
|
|
+ this.$refs.form.validateField(`details.${index}.courseTotalMinuties`);
|
|
|
|
+ this.$set(this.form, `details`, [..._list]);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async updateForm () {
|
|
|
|
|
|
+ async updateForm() {
|
|
if (this.rowDetail) {
|
|
if (this.rowDetail) {
|
|
- const { organId, classTimeList, chargeTypeId, name } = this.rowDetail
|
|
|
|
|
|
+ const { organId, classTimeList, chargeTypeId, name } = this.rowDetail;
|
|
this.form = {
|
|
this.form = {
|
|
organId,
|
|
organId,
|
|
classTimeList,
|
|
classTimeList,
|
|
chargeTypeId,
|
|
chargeTypeId,
|
|
name,
|
|
name,
|
|
- }
|
|
|
|
|
|
+ };
|
|
try {
|
|
try {
|
|
const res = await queryByMusicGroupOrganizationCourseSettingsId({
|
|
const res = await queryByMusicGroupOrganizationCourseSettingsId({
|
|
- id: this.rowDetail.id
|
|
|
|
- })
|
|
|
|
- this.$set(this.form, 'details', res.data.map(item => ({
|
|
|
|
- ...item,
|
|
|
|
- isStudentOptional: String(item.isStudentOptional)
|
|
|
|
- })))
|
|
|
|
- } catch (error) { }
|
|
|
|
|
|
+ id: this.rowDetail.id,
|
|
|
|
+ });
|
|
|
|
+ this.$set(
|
|
|
|
+ this.form,
|
|
|
|
+ "details",
|
|
|
|
+ res.data.map((item) => ({
|
|
|
|
+ ...item,
|
|
|
|
+ isStudentOptional: String(item.isStudentOptional),
|
|
|
|
+ }))
|
|
|
|
+ );
|
|
|
|
+ } catch (error) {}
|
|
} else {
|
|
} else {
|
|
- this.form = { ...initForm }
|
|
|
|
|
|
+ this.form = { ...initForm };
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- isOptionDisabled (key) {
|
|
|
|
- const selected = this.form.details.map(item => item.courseType)
|
|
|
|
- return selected.includes(key)
|
|
|
|
|
|
+ isOptionDisabled(key) {
|
|
|
|
+ const selected = this.form.details.map((item) => item.courseType);
|
|
|
|
+ return selected.includes(key);
|
|
},
|
|
},
|
|
- addItem () {
|
|
|
|
- const _items = [...this.form.details, {}]
|
|
|
|
- this.form.details = _items
|
|
|
|
|
|
+ addItem() {
|
|
|
|
+ const _items = [...this.form.details, {}];
|
|
|
|
+ this.form.details = _items;
|
|
},
|
|
},
|
|
- removeItem (index) {
|
|
|
|
- const _items = [...this.form.details]
|
|
|
|
- _items[index] = null
|
|
|
|
- this.form.details = _items.filter(item => !!item)
|
|
|
|
|
|
+ removeItem(index) {
|
|
|
|
+ const _items = [...this.form.details];
|
|
|
|
+ _items[index] = null;
|
|
|
|
+ this.form.details = _items.filter((item) => !!item);
|
|
},
|
|
},
|
|
- submit () {
|
|
|
|
|
|
+ submit() {
|
|
this.$refs.form.validate(async (valid) => {
|
|
this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
try {
|
|
try {
|
|
if (this.rowDetail) {
|
|
if (this.rowDetail) {
|
|
const res = await musicGroupOrganizationCourseSettingsUpdate({
|
|
const res = await musicGroupOrganizationCourseSettingsUpdate({
|
|
id: this.rowDetail.id,
|
|
id: this.rowDetail.id,
|
|
- ...this.form
|
|
|
|
- })
|
|
|
|
- this.$message.success('更新成功')
|
|
|
|
|
|
+ ...this.form,
|
|
|
|
+ });
|
|
|
|
+ this.$message.success("更新成功");
|
|
} else {
|
|
} else {
|
|
- const res = await musicGroupOrganizationCourseSettingsAdd(this.form)
|
|
|
|
- this.$message.success('提交成功')
|
|
|
|
|
|
+ const res = await musicGroupOrganizationCourseSettingsAdd(this.form);
|
|
|
|
+ this.$message.success("提交成功");
|
|
}
|
|
}
|
|
- this.$listeners.close()
|
|
|
|
- this.$listeners.submited()
|
|
|
|
- } catch (error) { }
|
|
|
|
|
|
+ this.$listeners.close();
|
|
|
|
+ this.$listeners.submited();
|
|
|
|
+ } catch (error) {}
|
|
}
|
|
}
|
|
- })
|
|
|
|
|
|
+ });
|
|
},
|
|
},
|
|
validatorCourseTotalMinuties(index, item) {
|
|
validatorCourseTotalMinuties(index, item) {
|
|
return (rule, value, callback) => {
|
|
return (rule, value, callback) => {
|
|
- const { courseType } = item
|
|
|
|
- if (courseType && value && this.classTimeList[courseType] && value < this.classTimeList[courseType]) {
|
|
|
|
- callback(new Error(`单节课不得少于${this.classTimeList[courseType]}分钟`))
|
|
|
|
- return
|
|
|
|
|
|
+ const { courseType } = item;
|
|
|
|
+ if (
|
|
|
|
+ courseType &&
|
|
|
|
+ value &&
|
|
|
|
+ this.classTimeList[courseType] &&
|
|
|
|
+ value < this.classTimeList[courseType]
|
|
|
|
+ ) {
|
|
|
|
+ callback(new Error(`单节课不得少于${this.classTimeList[courseType]}分钟`));
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- callback()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ callback();
|
|
|
|
+ };
|
|
|
|
+ },
|
|
},
|
|
},
|
|
-}
|
|
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
.dialog-footer {
|
|
.dialog-footer {
|