|
@@ -5,15 +5,17 @@
|
|
|
<p style="margin-left:30px;">计划招生人数(个):{{PlannedCount}}</p>
|
|
|
</div>
|
|
|
<div class="soundBtnWrap">
|
|
|
- <el-button type="primary">全选</el-button>
|
|
|
- <el-button type="danger">删除</el-button>
|
|
|
+ <el-button type="primary"
|
|
|
+ @click="allin">全选</el-button>
|
|
|
+ <el-button type="danger"
|
|
|
+ @click="deleteRow">删除</el-button>
|
|
|
<el-button type="primary"
|
|
|
@click="soundVisible = true">添加</el-button>
|
|
|
</div>
|
|
|
<div class="coreWrap">
|
|
|
<el-checkbox-group v-model="checkList"
|
|
|
@change='lookCheck'>
|
|
|
- <el-collapse v-model="activeSound"
|
|
|
+ <el-collapse v-model="chioseActiveSound"
|
|
|
accordion
|
|
|
@change="changeActiveSound">
|
|
|
<el-collapse-item v-for="(item,index) in activeSoundList"
|
|
@@ -51,9 +53,16 @@
|
|
|
</el-collapse>
|
|
|
</el-checkbox-group>
|
|
|
</div>
|
|
|
+ <div class="btnWrap">
|
|
|
+ <div class="PrevBtn"
|
|
|
+ @click="goback">上一步</div>
|
|
|
+ <!-- v-if="teamStatus != 'teamAudit'" -->
|
|
|
+ <div class="submitBtn"
|
|
|
+ v-permission="{child: 'musicGroup/createGroup', parent: '/teamBuild/soundMoney'}"
|
|
|
+ @click="submitInfo()">下一步</div>
|
|
|
+ </div>
|
|
|
<el-dialog title="声部选择"
|
|
|
- :visible.sync="soundVisible"
|
|
|
- :modal-append-to-body="false">
|
|
|
+ :visible.sync="soundVisible">
|
|
|
<chioseSoundList :soundList="soundList"
|
|
|
:activeSound='activeSound'
|
|
|
@chioseSound="chioseSound" />
|
|
@@ -79,13 +88,12 @@ import dayjs from 'dayjs'
|
|
|
import chioseMusic from './soundSetComponents/chioseMusic'
|
|
|
import chioseAccessory from './soundSetComponents/chioseAccessory'
|
|
|
import chioseSoundList from './soundSetComponents/chioseSoundList'
|
|
|
+import { findIndex } from 'lodash'
|
|
|
export default {
|
|
|
components: { chioseMusic, chioseAccessory, chioseSoundList },
|
|
|
data () {
|
|
|
return {
|
|
|
topfor: null, // 第一页的数据
|
|
|
- chioseSoundNum: 0,
|
|
|
- PlannedCount: 0,
|
|
|
checkList: [],
|
|
|
Fsearch: null,
|
|
|
Frules: null,
|
|
@@ -95,6 +103,7 @@ export default {
|
|
|
teamStatus: '',// 乐团状态
|
|
|
activeSoundList: [], //列表上的声部
|
|
|
activeSound: null, // 展开的列表
|
|
|
+ chioseActiveSound: null
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|
|
@@ -129,20 +138,63 @@ export default {
|
|
|
return this.initSound(item);
|
|
|
});
|
|
|
this.activeSound = activeSound;
|
|
|
-
|
|
|
- // = arr;
|
|
|
- // this.soundList.forEach((item, i) => {
|
|
|
- // item.subjects.forEach((some, j) => {
|
|
|
- // res.data.forEach((sub, x) => {
|
|
|
- // if (sub.id == some.id) {
|
|
|
- // this.soundLists[i].push(some.id);
|
|
|
- // }
|
|
|
- // });
|
|
|
- // });
|
|
|
- // });
|
|
|
- // 并且把所有soundLists 里面
|
|
|
+ this.chioseActiveSound = activeSound[0]
|
|
|
+ this.changeActiveSound(activeSound[0])
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ this.$nextTick(res => {
|
|
|
+ this.teamid = this.$route.query.id;
|
|
|
+ findMusicGroupSubjectInfo({ musicGroupId: this.teamid }).then(
|
|
|
+ res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ let activeSound = []
|
|
|
+ this.activeSoundList = res.data?.musicGroupSubjectPlans.map(item => {
|
|
|
+ activeSound.push(item.subjectId)
|
|
|
+ return {
|
|
|
+ id: parseInt(item.subjectId),
|
|
|
+ sound: item.subName,
|
|
|
+ expectedStudentNum: item.expectedStudentNum,
|
|
|
+ chioseMusic: [],
|
|
|
+ markChioseList: [],
|
|
|
+ goodsList: [],
|
|
|
+ markList: [],
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.activeSound = activeSound;
|
|
|
+ console.log(this.activeSound)
|
|
|
+ // 格式化商品和教辅
|
|
|
+
|
|
|
+ res.data.musicGroupSubjectGoodsGroups.forEach(shop => {
|
|
|
+ let index = findIndex(this.activeSoundList, (o) => {
|
|
|
+ return o.id == shop.subjectId
|
|
|
+ })
|
|
|
+
|
|
|
+ if (index != -1) {
|
|
|
+ if (shop.type == 'ACCESSORIES') {
|
|
|
+ shop.goodsIdList.split(',').forEach(item => {
|
|
|
+ this.activeSoundList[index].markChioseList.push(parseInt(item))
|
|
|
+ })
|
|
|
+ } else if (shop.type == 'INSTRUMENT') {
|
|
|
+ // 商品
|
|
|
+ let typeJson = Object.keys(JSON.parse(shop.kitGroupPurchaseTypeJson))
|
|
|
+ this.activeSoundList[index].chioseMusic.push({
|
|
|
+ musical: parseInt(shop.goodsIdList),
|
|
|
+ type: typeJson,
|
|
|
+ groupPrice: shop.price,
|
|
|
+ borrowPrice: shop.depositFee
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -153,30 +205,25 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
lookCheck (val) {
|
|
|
- console.log(val)
|
|
|
+ this.checkList = [...new Set(val)]
|
|
|
},
|
|
|
chioseSound (activeSound) {
|
|
|
// 同步数据
|
|
|
- this.activeSound = activeSound;
|
|
|
+ this.activeSound = [...new Set(activeSound)];
|
|
|
let newSoundList = []
|
|
|
|
|
|
for (let i in this.childSoundList) {
|
|
|
- if (activeSound.includes(this.childSoundList[i].id)) {
|
|
|
- console.log(this.childSoundList[i])
|
|
|
+ if (this.activeSound.includes(this.childSoundList[i].id)) {
|
|
|
newSoundList.push(this.initSound(this.childSoundList[i]))
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
let idList = this.activeSoundList.map(item => {
|
|
|
- console.log(item)
|
|
|
return item.id
|
|
|
})
|
|
|
- console.log(newSoundList, idList, this.activeSoundList)
|
|
|
for (let x in newSoundList) {
|
|
|
- if (idList.includes(newSoundList[x].id)) {
|
|
|
- console.log(x)
|
|
|
- newSoundList[x] = this.activeSoundList[x]
|
|
|
+ const indexof = idList.indexOf(newSoundList[x]?.id)
|
|
|
+ if (indexof > -1) {
|
|
|
+ newSoundList[x] = this.activeSoundList[indexof]
|
|
|
}
|
|
|
}
|
|
|
this.activeSoundList = newSoundList
|
|
@@ -187,7 +234,7 @@ export default {
|
|
|
id: item.id,
|
|
|
sound: item.name,
|
|
|
expectedStudentNum: item.expectedStudentNum,
|
|
|
- chioseMusic: [{ musical: '', type: 'GROUP', groupPrice: 0, borrowPrice: 1500 }],
|
|
|
+ chioseMusic: [{ musical: '', type: ["GROUP"], groupPrice: 0, borrowPrice: 1500 }],
|
|
|
markChioseList: [],
|
|
|
goodsList: [],
|
|
|
markList: [],
|
|
@@ -196,29 +243,204 @@ export default {
|
|
|
return obj
|
|
|
},
|
|
|
changeActiveSound (val) {
|
|
|
- this.activeSoundList.map(item => {
|
|
|
+ this.activeSoundList.forEach(item => {
|
|
|
if (item.id == val) {
|
|
|
- getSubjectGoods({ subjectId: item.id, chargeTypeId: this.topfor.type }).then(res => {
|
|
|
+ if (item.goodsList.length < 1 || item.markList.length < 1) {
|
|
|
+ getSubjectGoods({ subjectId: item.id, chargeTypeId: this.topfor.type }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ let goodList = []
|
|
|
+ let markList = []
|
|
|
+ res.data.forEach(item => {
|
|
|
+ if (item.type == 'INSTRUMENT') {
|
|
|
+ goodList.push(item)
|
|
|
+ } else if (item.type == 'ACCESSORIES') {
|
|
|
+ markList.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ item.goodsList = goodList;
|
|
|
+ item.markList = markList;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ lookMusic () {
|
|
|
+
|
|
|
+ },
|
|
|
+ goback () {
|
|
|
+ this.$emit("chiosetab", 0);
|
|
|
+ },
|
|
|
+ submitInfo () {
|
|
|
+ // 计划招生人数
|
|
|
+ // 可选乐器
|
|
|
+ // 教辅
|
|
|
+ this.activeSoundList.forEach(item => {
|
|
|
+ if (!item.expectedStudentNum) {
|
|
|
+ this.$message.error(`请填写${item.sound}的预计招生人数`)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!item.chioseMusic[0].musical) {
|
|
|
+ this.$message.error(`请至少一个选择${item.sound}的可选乐器`)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 新建团
|
|
|
+ let obj = {}
|
|
|
+ if (this.teamStatus == "newTeam") {
|
|
|
+ this.initCreateTeam(obj)
|
|
|
+ }
|
|
|
+ // 初始化声部
|
|
|
+ obj.musicGroupSubjectGoodsGroups = [];
|
|
|
+ obj.musicGroupSubjectPlans = [];
|
|
|
+ this.activeSoundList.forEach(active => {
|
|
|
+ // 格式化声部数据
|
|
|
+ let item = {
|
|
|
+ expectedStudentNum: active.expectedStudentNum,
|
|
|
+ subName: active.sound,
|
|
|
+ subjectId: active.id
|
|
|
+ };
|
|
|
+ obj.musicGroupSubjectPlans.push(item);
|
|
|
+ // 格式化商品数据 chioseMusic: [{ musical: '', type: ["GROUP"], groupPrice: 0, borrowPrice: 1500 }],
|
|
|
+ active.chioseMusic.forEach(music => {
|
|
|
+ let goodsItem = null;
|
|
|
+ let depositFee = music.borrowPrice
|
|
|
+ let price = music.groupPrice
|
|
|
+ let index = findIndex(active.goodsList, (o) => {
|
|
|
+ return o.id == music.musical
|
|
|
+ })
|
|
|
+ if (index != -1) {
|
|
|
+ goodsItem = active.goodsList[index]
|
|
|
+ }
|
|
|
+ let kitGroupPurchaseTypeJson = {}
|
|
|
+ music.type.forEach(type => {
|
|
|
+ kitGroupPurchaseTypeJson[type] = 0
|
|
|
+ })
|
|
|
+ kitGroupPurchaseTypeJson = JSON.stringify(kitGroupPurchaseTypeJson)
|
|
|
+ if (goodsItem) {
|
|
|
+ let some = {
|
|
|
+ subjectId: active.id,
|
|
|
+ type: "INSTRUMENT",
|
|
|
+ goodsIdList: music.musical,
|
|
|
+ name: goodsItem.name,
|
|
|
+ kitGroupPurchaseTypeJson,
|
|
|
+ depositFee,
|
|
|
+ price
|
|
|
+ };
|
|
|
+ obj.musicGroupSubjectGoodsGroups.push(some);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 格式化辅件
|
|
|
+ // markChioseList: [],
|
|
|
+ // goodsList: [],
|
|
|
+ // markList: [],
|
|
|
+ active.markChioseList.forEach(ass => {
|
|
|
+ let index = findIndex(active.markList, (o) => {
|
|
|
+ return o.id == ass
|
|
|
+ })
|
|
|
+ let goodsItem = null;
|
|
|
+ if (index != -1) {
|
|
|
+ goodsItem = active.markList[index]
|
|
|
+ }
|
|
|
+ if (goodsItem) {
|
|
|
+ let some = {
|
|
|
+ subjectId: active.id,
|
|
|
+ type: "ACCESSORIES",
|
|
|
+ goodsIdList: ass,
|
|
|
+ name: goodsItem.name,
|
|
|
+ price: goodsItem.groupPurchasePrice,
|
|
|
+ };
|
|
|
+ obj.musicGroupSubjectGoodsGroups.push(some);
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ if (this.teamStatus == 'newTeam') {
|
|
|
+ createTeam(obj).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ // 成功 跳转到乐团报名详情
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ obj.musicGroupId = this.teamid
|
|
|
+ obj.musicGroupStatus = "DRAFT"
|
|
|
+ updateSubjectInfo(obj).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- let goodList = []
|
|
|
- let markList = []
|
|
|
- res.data.forEach(item => {
|
|
|
- if (item.type == 'INSTRUMENT') {
|
|
|
- goodList.push(item)
|
|
|
- } else if (item.type == 'ACCESSORIES') {
|
|
|
- markList.push(item)
|
|
|
- }
|
|
|
- })
|
|
|
- item.goodsList = goodList;
|
|
|
- item.markList = markList;
|
|
|
+ this.$message.success("提交成功");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- lookMusic () {
|
|
|
- console.log(this.activeSoundList)
|
|
|
+ deleteRow () {
|
|
|
+ if (this.checkList.length < 1) {
|
|
|
+ this.$message.error('请至少勾选一个')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for (let i = 0; i < this.activeSoundList.length; i++) {
|
|
|
+ let index = this.checkList.indexOf(this.activeSoundList[i].id)
|
|
|
+ if (index != -1) {
|
|
|
+ this.activeSoundList.splice(i, 1)
|
|
|
+ this.activeSound.splice(i, 1)
|
|
|
+ i--
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.checkList = []
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ allin () {
|
|
|
+ this.checkList = []
|
|
|
+ this.activeSoundList.forEach((item, index) => {
|
|
|
+ this.checkList.push(item.id)
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ initCreateTeam (obj) {
|
|
|
+ let enrollClasses;
|
|
|
+ this.topfor.startClass
|
|
|
+ ? (enrollClasses = this.topfor.startClass.join(","))
|
|
|
+ : (enrollClasses = null);
|
|
|
+ obj.musicGroup = {
|
|
|
+ settlementType: this.topfor.salary,
|
|
|
+ applyExpireDate: dayjs(this.topfor.time).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ chargeTypeId: this.topfor.type,
|
|
|
+ cooperationOrganId: this.topfor.school,
|
|
|
+ teamTeacherId: this.topfor.boss,
|
|
|
+ educationalTeacherId: this.topfor.teacher,
|
|
|
+ enrollClasses,
|
|
|
+ name: this.topfor.name,
|
|
|
+ organId: this.topfor.section,
|
|
|
+ paymentPattern: this.topfor.paymentPattern,
|
|
|
+ paymentValidStartDate: this.topfor.paymentValidStartDate ? dayjs(this.topfor.paymentValidStartDate).format('YYYY-MM-DD') : this.topfor.paymentValidStartDate,
|
|
|
+ paymentValidEndDate: this.topfor.paymentValidEndDate ? dayjs(this.topfor.paymentValidEndDate).format('YYYY-MM-DD') : this.topfor.paymentValidEndDate,
|
|
|
+ // paymentMonths:obj.months 有待确认
|
|
|
+ schoolId: this.topfor.address,
|
|
|
+ expectStartGroupDate: this.topfor.startTime,
|
|
|
+ isClassroomLessons: this.topfor.isClass,
|
|
|
+ status,
|
|
|
+ ownershipType: this.topfor.ownershipType,
|
|
|
+ repairUserId: this.topfor.repairUserId,
|
|
|
+ feeType: this.topfor.feeType
|
|
|
+ };
|
|
|
+ return obj
|
|
|
}
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ PlannedCount () {
|
|
|
+ let Count = 0;
|
|
|
+ if (this.activeSoundList.length > 0) {
|
|
|
+ for (let item in this.activeSoundList) {
|
|
|
+ Count += parseInt(this.activeSoundList[item]?.expectedStudentNum) || 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return Count;
|
|
|
+ }, chioseSoundNum () {
|
|
|
+
|
|
|
+ return this.activeSoundList.length;
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -240,8 +462,8 @@ export default {
|
|
|
}
|
|
|
.coreItemTitle {
|
|
|
background-color: #edeef0;
|
|
|
- height: 48px;
|
|
|
- line-height: 48px;
|
|
|
+ height: 46px;
|
|
|
+ line-height: 46px;
|
|
|
padding: 0 20px;
|
|
|
}
|
|
|
.coreItem {
|
|
@@ -264,4 +486,18 @@ export default {
|
|
|
.marginLeft10 {
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
+/deep/.el-collapse-item__header {
|
|
|
+ border-bottom: 1px solid #fff;
|
|
|
+}
|
|
|
+.btnWrap {
|
|
|
+ margin-top: 40px;
|
|
|
+ .PrevBtn {
|
|
|
+ background-color: #13817a;
|
|
|
+ width: 120px;
|
|
|
+ }
|
|
|
+ .submitBtn {
|
|
|
+ background-color: #13817a;
|
|
|
+ width: 120px;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|