|  | @@ -17,7 +17,7 @@
 | 
	
		
			
				|  |  |            placeholder="请选择声部"
 | 
	
		
			
				|  |  |          >
 | 
	
		
			
				|  |  |            <el-option
 | 
	
		
			
				|  |  | -            v-for="item in voiceList"
 | 
	
		
			
				|  |  | +            v-for="item in filterVoiceList"
 | 
	
		
			
				|  |  |              :key="item.subjectId"
 | 
	
		
			
				|  |  |              :label="item.subjectName"
 | 
	
		
			
				|  |  |              :value="item.subjectId">
 | 
	
	
		
			
				|  | @@ -36,12 +36,12 @@
 | 
	
		
			
				|  |  |          >
 | 
	
		
			
				|  |  |            <el-option
 | 
	
		
			
				|  |  |              v-for="item in musicalGoods"
 | 
	
		
			
				|  |  | -            :key="item.id"
 | 
	
		
			
				|  |  | +            :key="item.goodsIdList"
 | 
	
		
			
				|  |  |              :label="item.name"
 | 
	
		
			
				|  |  | -            :value="item.id">
 | 
	
		
			
				|  |  | +            :value="item.goodsIdList">
 | 
	
		
			
				|  |  |            </el-option>
 | 
	
		
			
				|  |  |          </el-select>
 | 
	
		
			
				|  |  | -        <span v-else-if="detail.subjectChange.changeAccessoriesGoods">{{detail.subjectChange.changeAccessoriesGoods.name}}</span>
 | 
	
		
			
				|  |  | +        <span v-else-if="item.changeMusicalGoods">{{item.changeMusicalGoods.name}}</span>
 | 
	
		
			
				|  |  |        </el-form-item>
 | 
	
		
			
				|  |  |        <el-form-item v-if="(activeAccessories.length || groupList.length) || detail.subjectChange" label="更换教辅" prop="name">
 | 
	
		
			
				|  |  |          <accessories
 | 
	
	
		
			
				|  | @@ -50,7 +50,7 @@
 | 
	
		
			
				|  |  |            @change="accessoriesChange"
 | 
	
		
			
				|  |  |            v-if="!detail.subjectChange"
 | 
	
		
			
				|  |  |          />
 | 
	
		
			
				|  |  | -        <span v-else-if="detail.subjectChange.changeAccessoriesGoods">{{changeAccessoriesGoods}}</span>
 | 
	
		
			
				|  |  | +        <span v-else-if="detail.subjectChange">{{changeAccessoriesGoods}}</span>
 | 
	
		
			
				|  |  |          <!-- <el-select style="width: 100%" v-model="form.accessories" clearable placeholder="请选择教辅">
 | 
	
		
			
				|  |  |            <el-option
 | 
	
		
			
				|  |  |              v-for="item in accessories"
 | 
	
	
		
			
				|  | @@ -89,7 +89,7 @@
 | 
	
		
			
				|  |  |    </div>
 | 
	
		
			
				|  |  |  </template>
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  | -import { getStudentOriginal, getSubjectGoodsAndInfo, subjectChangeAdd, subjectChangeCancel } from '@/api/buildTeam'
 | 
	
		
			
				|  |  | +import { getStudentOriginal, getSubjectGoodsAndInfo, subjectChangeAdd, subjectChangeCancel, getChangeInfo } from '@/api/buildTeam'
 | 
	
		
			
				|  |  |  import accessories from './accessories'
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
	
		
			
				|  | @@ -129,14 +129,14 @@ const formatAllGoods = (data, kitGroupPurchaseType) => {
 | 
	
		
			
				|  |  |              kitGroupPurchaseTypePrice: json[kitGroupPurchaseType]
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |            musicalGoods.push(_item)
 | 
	
		
			
				|  |  | -          musicalGoodsById[item.id] = _item
 | 
	
		
			
				|  |  | +          musicalGoodsById[item.goodsIdList] = _item
 | 
	
		
			
				|  |  |            if (!types.ACCESSORIES) {
 | 
	
		
			
				|  |  | -            if (!accessoriesByGoods[item.id]) {
 | 
	
		
			
				|  |  | -              accessoriesByGoods[item.id] = []
 | 
	
		
			
				|  |  | +            if (!accessoriesByGoods[item.goodsIdList]) {
 | 
	
		
			
				|  |  | +              accessoriesByGoods[item.goodsIdList] = []
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              const acs = item.goodsList[0].goodsList ? item.goodsList[0].goodsList : []
 | 
	
		
			
				|  |  |              for (const goods of acs) {
 | 
	
		
			
				|  |  | -              accessoriesByGoods[item.id].push(goods)
 | 
	
		
			
				|  |  | +              accessoriesByGoods[item.goodsIdList].push(goods)
 | 
	
		
			
				|  |  |                accessoriesById[goods.id] = goods
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |            }
 | 
	
	
		
			
				|  | @@ -196,25 +196,22 @@ export default {
 | 
	
		
			
				|  |  |    watch: {
 | 
	
		
			
				|  |  |      detail() {
 | 
	
		
			
				|  |  |        if (this.detail) {
 | 
	
		
			
				|  |  | -        console.log(this.detail, this.voiceList)
 | 
	
		
			
				|  |  | +        // console.log(this.detail, this.voiceList)
 | 
	
		
			
				|  |  |          this.fetchDetail()
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    computed: {
 | 
	
		
			
				|  |  | +    filterVoiceList() {
 | 
	
		
			
				|  |  | +      return this.voiceList.filter(item => item.subjectId !== this.detail.actualSubjectId)
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      activeAccessories() {
 | 
	
		
			
				|  |  |        const { musicalGoods } = this.form
 | 
	
		
			
				|  |  |        return musicalGoods ? this.accessoriesByGoods[musicalGoods] || [] : []
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      changeAccessoriesGoods() {
 | 
	
		
			
				|  |  | -      let names = []
 | 
	
		
			
				|  |  | -      const { subjectChange } = this.detail
 | 
	
		
			
				|  |  | -      if (subjectChange && subjectChange.changeAccessoriesGoods && subjectChange.changeAccessoriesGoods.goodsList) {
 | 
	
		
			
				|  |  | -        for (const item of subjectChange.changeAccessoriesGoods.goodsList) {
 | 
	
		
			
				|  |  | -          names.push(item.name)
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      return names.join(',')
 | 
	
		
			
				|  |  | +      const subjectChange = this.item
 | 
	
		
			
				|  |  | +      return (subjectChange.changeAccessoriesGoods || []).map(item => item.name).join(',')
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      editSpread() {
 | 
	
		
			
				|  |  |        const data = this.item
 | 
	
	
		
			
				|  | @@ -240,11 +237,7 @@ export default {
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  |      fetchDetail() {
 | 
	
		
			
				|  |  | -      getStudentOriginal({
 | 
	
		
			
				|  |  | -        musicGroupId: this.musicGroupId,
 | 
	
		
			
				|  |  | -        studentId: this.detail.studentId,
 | 
	
		
			
				|  |  | -      })
 | 
	
		
			
				|  |  | -      .then(res => {
 | 
	
		
			
				|  |  | +      const setRes = res => {
 | 
	
		
			
				|  |  |          const { data } = res
 | 
	
		
			
				|  |  |          this.item = data
 | 
	
		
			
				|  |  |          if (data) {
 | 
	
	
		
			
				|  | @@ -254,7 +247,19 @@ export default {
 | 
	
		
			
				|  |  |            this.originalMusicalGoods = data.originalMusicalGoods && data.originalMusicalGoods.name
 | 
	
		
			
				|  |  |            this.originalAccessoriesGoods = (data.originalAccessoriesGoods || []).map(item => item.name).join()
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -      })
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      if (this.detail.subjectChange) {
 | 
	
		
			
				|  |  | +        getChangeInfo({
 | 
	
		
			
				|  |  | +          id: this.detail.subjectChange.id
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .then(setRes)
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        getStudentOriginal({
 | 
	
		
			
				|  |  | +          musicGroupId: this.musicGroupId,
 | 
	
		
			
				|  |  | +          studentId: this.detail.studentId,
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .then(setRes)
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      subjectChange(id) {
 | 
	
		
			
				|  |  |        this.$set(this.form, 'musicalGoods', '')
 | 
	
	
		
			
				|  | @@ -275,12 +280,10 @@ export default {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      musicalGoodsChange(val) {
 | 
	
		
			
				|  |  |        const item = this.musicalGoodsById[val]
 | 
	
		
			
				|  |  | -      console.log(item)
 | 
	
		
			
				|  |  |        this.musicalPrice = this.numFormat(item.price)
 | 
	
		
			
				|  |  |        this.kitGroupPurchaseTypePrice = this.numFormat(item.kitGroupPurchaseTypePrice)
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      accessoriesChange(ids, money) {
 | 
	
		
			
				|  |  | -      console.log(ids, money)
 | 
	
		
			
				|  |  |        this.selectAccessories = ids
 | 
	
		
			
				|  |  |        this.selectAccessoriesMoney = money
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -314,6 +317,7 @@ export default {
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |          .then(res => {
 | 
	
		
			
				|  |  |            this.$listeners.close()
 | 
	
		
			
				|  |  | +          this.$listeners.submited()
 | 
	
		
			
				|  |  |            this.$message.success('提交成功!')
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -328,6 +332,8 @@ export default {
 | 
	
		
			
				|  |  |            id: this.detail.subjectChange.id
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |          .then(res => {
 | 
	
		
			
				|  |  | +          this.$listeners.close()
 | 
	
		
			
				|  |  | +          this.$listeners.submited()
 | 
	
		
			
				|  |  |            this.$message.success('取消成功!')
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |        })
 |