|  | @@ -31,6 +31,7 @@ import MPopup from '@/components/m-popup';
 | 
	
		
			
				|  |  |  import CastModal from './components/cast-modal';
 | 
	
		
			
				|  |  |  import dayjs from 'dayjs';
 | 
	
		
			
				|  |  |  import { useRoute, useRouter } from 'vue-router';
 | 
	
		
			
				|  |  | +import { checkFile } from '@/helpers/toolsValidate';
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  type detailItemType = {
 | 
	
		
			
				|  |  |    id: string | number | null;
 | 
	
	
		
			
				|  | @@ -87,7 +88,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |      const forms = reactive({
 | 
	
		
			
				|  |  |        activityDetailId: route.query.id, // 活动编号
 | 
	
		
			
				|  |  |        timerStatus: false,
 | 
	
		
			
				|  |  | -      currentDate: [],
 | 
	
		
			
				|  |  | +      currentDate: [] as any,
 | 
	
		
			
				|  |  |        orchestraStatus: false, // 乐团列表状态
 | 
	
		
			
				|  |  |        orchestraColumns: [] as any,
 | 
	
		
			
				|  |  |        programType: '',
 | 
	
	
		
			
				|  | @@ -136,7 +137,6 @@ export default defineComponent({
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |          );
 | 
	
		
			
				|  |  |          const tempData = data || [];
 | 
	
		
			
				|  |  | -        console.log(tempData, 'tempData');
 | 
	
		
			
				|  |  |          forms.selectOrchestra.subjectAllList = tempData;
 | 
	
		
			
				|  |  |          forms.selectOrchestra.performerList = tempData;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -191,8 +191,99 @@ export default defineComponent({
 | 
	
		
			
				|  |  |        forms.selectOrchestra.performerList = tempList;
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    // 初始化已经先中的学生
 | 
	
		
			
				|  |  | +    const formatterStudentList = (list: any[]) => {
 | 
	
		
			
				|  |  | +      const tempList: any[] = [];
 | 
	
		
			
				|  |  | +      list.map((student: any) => {
 | 
	
		
			
				|  |  | +        let count = 0;
 | 
	
		
			
				|  |  | +        const students: any[] = [];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        student.studentList.forEach((item: any) => {
 | 
	
		
			
				|  |  | +          if (item.selected) {
 | 
	
		
			
				|  |  | +            count++;
 | 
	
		
			
				|  |  | +            students.push(item);
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (count > 0) {
 | 
	
		
			
				|  |  | +          tempList.push({
 | 
	
		
			
				|  |  | +            studentCount: students.length,
 | 
	
		
			
				|  |  | +            subjectId: student.subjectId,
 | 
	
		
			
				|  |  | +            subjectName: student.subjectName,
 | 
	
		
			
				|  |  | +            studentList: students
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      return tempList || [];
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    const getDetail = async () => {
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        const { data } = await request.get(
 | 
	
		
			
				|  |  | +          '/api-web/schoolActivity/detail/' + forms.activityDetailId
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +        const { detail, name, startTime, type } = data || {};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // startTime: forms.startTime,
 | 
	
		
			
				|  |  | +        //   endTime: forms.startTime + ' 23:59:59',
 | 
	
		
			
				|  |  | +        //   name: forms.name,
 | 
	
		
			
				|  |  | +        //   type: forms.type,
 | 
	
		
			
				|  |  | +        //   detail: [] as any[]
 | 
	
		
			
				|  |  | +        forms.startTime = dayjs(startTime).format('YYYY-MM-DD');
 | 
	
		
			
				|  |  | +        forms.name = name;
 | 
	
		
			
				|  |  | +        forms.type = type;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        forms.currentDate = [
 | 
	
		
			
				|  |  | +          dayjs(startTime).format('YYYY'),
 | 
	
		
			
				|  |  | +          dayjs(startTime).format('MM'),
 | 
	
		
			
				|  |  | +          dayjs(startTime).format('DD')
 | 
	
		
			
				|  |  | +        ];
 | 
	
		
			
				|  |  | +        const initDetails: any[] = [];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        detail.forEach((item: any) => {
 | 
	
		
			
				|  |  | +          const url: string[] = item.attachmentUrl
 | 
	
		
			
				|  |  | +            ? item.attachmentUrl.split(',')
 | 
	
		
			
				|  |  | +            : [];
 | 
	
		
			
				|  |  | +          const videoUrl: string[] = [];
 | 
	
		
			
				|  |  | +          const imgUrl: string[] = [];
 | 
	
		
			
				|  |  | +          url.forEach((url: string) => {
 | 
	
		
			
				|  |  | +            if (checkFile(url, 'image')) {
 | 
	
		
			
				|  |  | +              imgUrl.push(url);
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +              videoUrl.push(url);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +          const tmp: any = {
 | 
	
		
			
				|  |  | +            id: item.id,
 | 
	
		
			
				|  |  | +            name: item.name,
 | 
	
		
			
				|  |  | +            type: item.type,
 | 
	
		
			
				|  |  | +            musicGroupId: item.musicGroupId,
 | 
	
		
			
				|  |  | +            musicGroupName: item.musicGroupName,
 | 
	
		
			
				|  |  | +            subjectAllList: item.studentList,
 | 
	
		
			
				|  |  | +            subjectIdList: item.subjectIdList
 | 
	
		
			
				|  |  | +              ? item.subjectIdList.split(',').map((i: any) => Number(i))
 | 
	
		
			
				|  |  | +              : [],
 | 
	
		
			
				|  |  | +            time: item.time,
 | 
	
		
			
				|  |  | +            performerList: formatterStudentList(item.studentList),
 | 
	
		
			
				|  |  | +            attachmentUrl: url,
 | 
	
		
			
				|  |  | +            attachmentVideoUrl: videoUrl,
 | 
	
		
			
				|  |  | +            attachmentImgUrl: imgUrl
 | 
	
		
			
				|  |  | +          };
 | 
	
		
			
				|  |  | +          initDetails.push(tmp);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        forms.detail = initDetails;
 | 
	
		
			
				|  |  | +      } catch {
 | 
	
		
			
				|  |  | +        //
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      onMounted(() => {
 | 
	
		
			
				|  |  |        musicGroupPage();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      if (forms.activityDetailId) {
 | 
	
		
			
				|  |  | +        getDetail();
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      const checkForms = () => {
 | 
	
	
		
			
				|  | @@ -246,6 +337,7 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          if (!checkForms()) return;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          const params = {
 | 
	
		
			
				|  |  | +          id: forms.activityDetailId || null,
 | 
	
		
			
				|  |  |            startTime: forms.startTime,
 | 
	
		
			
				|  |  |            endTime: forms.startTime + ' 23:59:59',
 | 
	
		
			
				|  |  |            name: forms.name,
 | 
	
	
		
			
				|  | @@ -254,36 +346,46 @@ export default defineComponent({
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |          const tempDetail: any[] = [];
 | 
	
		
			
				|  |  |          forms.detail.forEach((item: any, index: number) => {
 | 
	
		
			
				|  |  | +          console.log(item);
 | 
	
		
			
				|  |  |            tempDetail.push({
 | 
	
		
			
				|  |  | +            id: item.id || null,
 | 
	
		
			
				|  |  |              sort: index + 1,
 | 
	
		
			
				|  |  |              name: item.name,
 | 
	
		
			
				|  |  |              type: item.type,
 | 
	
		
			
				|  |  | -            musicGroupId: item.musicGroupId,
 | 
	
		
			
				|  |  | +            musicGroupId: item.musicGroupId + '',
 | 
	
		
			
				|  |  |              subjectIdList: item.subjectIdList.join(','),
 | 
	
		
			
				|  |  |              studentNum: formatterStudents(item.performerList),
 | 
	
		
			
				|  |  |              studentList: item.performerList,
 | 
	
		
			
				|  |  |              time: item.time,
 | 
	
		
			
				|  |  |              attachmentUrl: [
 | 
	
		
			
				|  |  |                ...item.attachmentImgUrl,
 | 
	
		
			
				|  |  | -              ...item.attachmentUrl
 | 
	
		
			
				|  |  | +              ...item.attachmentVideoUrl
 | 
	
		
			
				|  |  |              ].join(',')
 | 
	
		
			
				|  |  |            });
 | 
	
		
			
				|  |  |          });
 | 
	
		
			
				|  |  |          params.detail = tempDetail;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        await request.post('/api-web/schoolActivity/save', {
 | 
	
		
			
				|  |  | -          hideLoading: false,
 | 
	
		
			
				|  |  | -          data: params
 | 
	
		
			
				|  |  | -        });
 | 
	
		
			
				|  |  | +        if (forms.activityDetailId) {
 | 
	
		
			
				|  |  | +          await request.post('/api-web/schoolActivity/update', {
 | 
	
		
			
				|  |  | +            hideLoading: false,
 | 
	
		
			
				|  |  | +            data: params
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          await request.post('/api-web/schoolActivity/save', {
 | 
	
		
			
				|  |  | +            hideLoading: false,
 | 
	
		
			
				|  |  | +            data: params
 | 
	
		
			
				|  |  | +          });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        router.push('/activity-record');
 | 
	
		
			
				|  |  | +        // router.push('/activity-record');
 | 
	
		
			
				|  |  | +        router.back();
 | 
	
		
			
				|  |  |        } catch {
 | 
	
		
			
				|  |  |          //
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |      return () => (
 | 
	
		
			
				|  |  |        <div class={styles.operation}>
 | 
	
		
			
				|  |  | -        <MHeader />
 | 
	
		
			
				|  |  | +        <MHeader title={forms.activityDetailId ? '修改活动' : '新增活动'} />
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          <CellGroup inset class={styles.topCellGroup}>
 | 
	
		
			
				|  |  |            <Field
 | 
	
	
		
			
				|  | @@ -446,6 +548,8 @@ export default defineComponent({
 | 
	
		
			
				|  |  |                    showToast('请选择表演团队');
 | 
	
		
			
				|  |  |                    return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                forms.selectOrchestra = [];
 | 
	
		
			
				|  |  | +                forms.selectOrchestra = item;
 | 
	
		
			
				|  |  |                  forms.castStatus = true;
 | 
	
		
			
				|  |  |                }}
 | 
	
		
			
				|  |  |                v-slots={{
 | 
	
	
		
			
				|  | @@ -480,19 +584,23 @@ export default defineComponent({
 | 
	
		
			
				|  |  |              <Field label="上传附件" labelAlign="top">
 | 
	
		
			
				|  |  |                {{
 | 
	
		
			
				|  |  |                  input: () => (
 | 
	
		
			
				|  |  | -                  <MUploader
 | 
	
		
			
				|  |  | -                    uploadIcon={iconUploadImg}
 | 
	
		
			
				|  |  | -                    maxCount={5}
 | 
	
		
			
				|  |  | -                    v-model:modelValue={item.attachmentImgUrl}
 | 
	
		
			
				|  |  | -                    style={{ marginTop: '6px' }}>
 | 
	
		
			
				|  |  | -                    <MUploaderInside
 | 
	
		
			
				|  |  | -                      uploadIcon={iconUploadVideo}
 | 
	
		
			
				|  |  | -                      uploadType="VIDEO"
 | 
	
		
			
				|  |  | -                      accept=".mp4"
 | 
	
		
			
				|  |  | -                      maxCount={3}
 | 
	
		
			
				|  |  | -                      v-model:modelValue={item.attachmentVideoUrl}
 | 
	
		
			
				|  |  | -                    />
 | 
	
		
			
				|  |  | -                  </MUploader>
 | 
	
		
			
				|  |  | +                  <div class={styles.uploadGroup}>
 | 
	
		
			
				|  |  | +                    <MUploader
 | 
	
		
			
				|  |  | +                      uploadIcon={iconUploadImg}
 | 
	
		
			
				|  |  | +                      maxCount={5}
 | 
	
		
			
				|  |  | +                      native
 | 
	
		
			
				|  |  | +                      v-model:modelValue={item.attachmentImgUrl}
 | 
	
		
			
				|  |  | +                      style={{ marginTop: '6px' }}>
 | 
	
		
			
				|  |  | +                      <MUploaderInside
 | 
	
		
			
				|  |  | +                        uploadIcon={iconUploadVideo}
 | 
	
		
			
				|  |  | +                        native
 | 
	
		
			
				|  |  | +                        uploadType="VIDEO"
 | 
	
		
			
				|  |  | +                        accept=".mp4"
 | 
	
		
			
				|  |  | +                        maxCount={3}
 | 
	
		
			
				|  |  | +                        v-model:modelValue={item.attachmentVideoUrl}
 | 
	
		
			
				|  |  | +                      />
 | 
	
		
			
				|  |  | +                    </MUploader>
 | 
	
		
			
				|  |  | +                  </div>
 | 
	
		
			
				|  |  |                  )
 | 
	
		
			
				|  |  |                }}
 | 
	
		
			
				|  |  |              </Field>
 | 
	
	
		
			
				|  | @@ -539,10 +647,18 @@ export default defineComponent({
 | 
	
		
			
				|  |  |              columns={forms.orchestraColumns}
 | 
	
		
			
				|  |  |              onCancel={() => (forms.orchestraStatus = false)}
 | 
	
		
			
				|  |  |              onConfirm={({ selectedOptions }) => {
 | 
	
		
			
				|  |  | -              forms.selectOrchestra.musicGroupName = selectedOptions[0].text;
 | 
	
		
			
				|  |  | -              forms.selectOrchestra.musicGroupId = selectedOptions[0].value;
 | 
	
		
			
				|  |  | -              forms.orchestraStatus = false;
 | 
	
		
			
				|  |  | -              getUserList();
 | 
	
		
			
				|  |  | +              if (
 | 
	
		
			
				|  |  | +                forms.selectOrchestra.musicGroupId != selectedOptions[0].value
 | 
	
		
			
				|  |  | +              ) {
 | 
	
		
			
				|  |  | +                forms.selectOrchestra.subjectAllList = [];
 | 
	
		
			
				|  |  | +                forms.selectOrchestra.performerList = [];
 | 
	
		
			
				|  |  | +                forms.selectOrchestra.subjectIdList = [];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                forms.selectOrchestra.musicGroupName = selectedOptions[0].text;
 | 
	
		
			
				|  |  | +                forms.selectOrchestra.musicGroupId = selectedOptions[0].value;
 | 
	
		
			
				|  |  | +                forms.orchestraStatus = false;
 | 
	
		
			
				|  |  | +                getUserList();
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  |              }}
 | 
	
		
			
				|  |  |            />
 | 
	
		
			
				|  |  |          </Popup>
 |