|
@@ -31,6 +31,7 @@ import MPopup from '@/components/m-popup';
|
|
import CastModal from './components/cast-modal';
|
|
import CastModal from './components/cast-modal';
|
|
import dayjs from 'dayjs';
|
|
import dayjs from 'dayjs';
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
|
+import { checkFile } from '@/helpers/toolsValidate';
|
|
|
|
|
|
type detailItemType = {
|
|
type detailItemType = {
|
|
id: string | number | null;
|
|
id: string | number | null;
|
|
@@ -87,7 +88,7 @@ export default defineComponent({
|
|
const forms = reactive({
|
|
const forms = reactive({
|
|
activityDetailId: route.query.id, // 活动编号
|
|
activityDetailId: route.query.id, // 活动编号
|
|
timerStatus: false,
|
|
timerStatus: false,
|
|
- currentDate: [],
|
|
|
|
|
|
+ currentDate: [] as any,
|
|
orchestraStatus: false, // 乐团列表状态
|
|
orchestraStatus: false, // 乐团列表状态
|
|
orchestraColumns: [] as any,
|
|
orchestraColumns: [] as any,
|
|
programType: '',
|
|
programType: '',
|
|
@@ -136,7 +137,6 @@ export default defineComponent({
|
|
}
|
|
}
|
|
);
|
|
);
|
|
const tempData = data || [];
|
|
const tempData = data || [];
|
|
- console.log(tempData, 'tempData');
|
|
|
|
forms.selectOrchestra.subjectAllList = tempData;
|
|
forms.selectOrchestra.subjectAllList = tempData;
|
|
forms.selectOrchestra.performerList = tempData;
|
|
forms.selectOrchestra.performerList = tempData;
|
|
|
|
|
|
@@ -191,8 +191,99 @@ export default defineComponent({
|
|
forms.selectOrchestra.performerList = tempList;
|
|
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(() => {
|
|
onMounted(() => {
|
|
musicGroupPage();
|
|
musicGroupPage();
|
|
|
|
+
|
|
|
|
+ if (forms.activityDetailId) {
|
|
|
|
+ getDetail();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
const checkForms = () => {
|
|
const checkForms = () => {
|
|
@@ -246,6 +337,7 @@ export default defineComponent({
|
|
if (!checkForms()) return;
|
|
if (!checkForms()) return;
|
|
|
|
|
|
const params = {
|
|
const params = {
|
|
|
|
+ id: forms.activityDetailId || null,
|
|
startTime: forms.startTime,
|
|
startTime: forms.startTime,
|
|
endTime: forms.startTime + ' 23:59:59',
|
|
endTime: forms.startTime + ' 23:59:59',
|
|
name: forms.name,
|
|
name: forms.name,
|
|
@@ -254,36 +346,46 @@ export default defineComponent({
|
|
};
|
|
};
|
|
const tempDetail: any[] = [];
|
|
const tempDetail: any[] = [];
|
|
forms.detail.forEach((item: any, index: number) => {
|
|
forms.detail.forEach((item: any, index: number) => {
|
|
|
|
+ console.log(item);
|
|
tempDetail.push({
|
|
tempDetail.push({
|
|
|
|
+ id: item.id || null,
|
|
sort: index + 1,
|
|
sort: index + 1,
|
|
name: item.name,
|
|
name: item.name,
|
|
type: item.type,
|
|
type: item.type,
|
|
- musicGroupId: item.musicGroupId,
|
|
|
|
|
|
+ musicGroupId: item.musicGroupId + '',
|
|
subjectIdList: item.subjectIdList.join(','),
|
|
subjectIdList: item.subjectIdList.join(','),
|
|
studentNum: formatterStudents(item.performerList),
|
|
studentNum: formatterStudents(item.performerList),
|
|
studentList: item.performerList,
|
|
studentList: item.performerList,
|
|
time: item.time,
|
|
time: item.time,
|
|
attachmentUrl: [
|
|
attachmentUrl: [
|
|
...item.attachmentImgUrl,
|
|
...item.attachmentImgUrl,
|
|
- ...item.attachmentUrl
|
|
|
|
|
|
+ ...item.attachmentVideoUrl
|
|
].join(',')
|
|
].join(',')
|
|
});
|
|
});
|
|
});
|
|
});
|
|
params.detail = tempDetail;
|
|
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 {
|
|
} catch {
|
|
//
|
|
//
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return () => (
|
|
return () => (
|
|
<div class={styles.operation}>
|
|
<div class={styles.operation}>
|
|
- <MHeader />
|
|
|
|
|
|
+ <MHeader title={forms.activityDetailId ? '修改活动' : '新增活动'} />
|
|
|
|
|
|
<CellGroup inset class={styles.topCellGroup}>
|
|
<CellGroup inset class={styles.topCellGroup}>
|
|
<Field
|
|
<Field
|
|
@@ -446,6 +548,8 @@ export default defineComponent({
|
|
showToast('请选择表演团队');
|
|
showToast('请选择表演团队');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ forms.selectOrchestra = [];
|
|
|
|
+ forms.selectOrchestra = item;
|
|
forms.castStatus = true;
|
|
forms.castStatus = true;
|
|
}}
|
|
}}
|
|
v-slots={{
|
|
v-slots={{
|
|
@@ -480,19 +584,23 @@ export default defineComponent({
|
|
<Field label="上传附件" labelAlign="top">
|
|
<Field label="上传附件" labelAlign="top">
|
|
{{
|
|
{{
|
|
input: () => (
|
|
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>
|
|
</Field>
|
|
@@ -539,10 +647,18 @@ export default defineComponent({
|
|
columns={forms.orchestraColumns}
|
|
columns={forms.orchestraColumns}
|
|
onCancel={() => (forms.orchestraStatus = false)}
|
|
onCancel={() => (forms.orchestraStatus = false)}
|
|
onConfirm={({ selectedOptions }) => {
|
|
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>
|
|
</Popup>
|