|
@@ -10,8 +10,8 @@
|
|
showFooter
|
|
showFooter
|
|
>
|
|
>
|
|
<BasicForm @register="registerForm">
|
|
<BasicForm @register="registerForm">
|
|
- <template #selectUser>
|
|
|
|
- <SelectUser v-model:value="selectUserValue" @change="handleUserChange" />
|
|
|
|
|
|
+ <template #selectUser="{ model, field }">
|
|
|
|
+ <SelectUser v-model:value="model[field]" @change="handleUserChange(model, field, $event)" />
|
|
</template>
|
|
</template>
|
|
<template #coverFileId="{ model, field }">
|
|
<template #coverFileId="{ model, field }">
|
|
<Upload
|
|
<Upload
|
|
@@ -110,7 +110,6 @@
|
|
const emit = defineEmits(['success', 'register']);
|
|
const emit = defineEmits(['success', 'register']);
|
|
const { createMessage } = useMessage();
|
|
const { createMessage } = useMessage();
|
|
|
|
|
|
- const selectUserValue = ref<Recordable[]>([]);
|
|
|
|
const tableRef = ref<ElRef>(null);
|
|
const tableRef = ref<ElRef>(null);
|
|
const weekOptions = reactive([
|
|
const weekOptions = reactive([
|
|
{ label: '星期一', value: '星期一' },
|
|
{ label: '星期一', value: '星期一' },
|
|
@@ -154,27 +153,27 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
modelRef.value = { ...data.baseData };
|
|
modelRef.value = { ...data.baseData };
|
|
- selectUserValue.value = [];
|
|
|
|
|
|
+ const selectUserValue: Recordable[] = [];
|
|
if (unref(isUpdate)) {
|
|
if (unref(isUpdate)) {
|
|
const resData = await getSecondCourseInfo({ id: data.baseData.id });
|
|
const resData = await getSecondCourseInfo({ id: data.baseData.id });
|
|
resData['secondCourseEnrollRangeList'] &&
|
|
resData['secondCourseEnrollRangeList'] &&
|
|
resData['secondCourseEnrollRangeList'].forEach((item) => {
|
|
resData['secondCourseEnrollRangeList'].forEach((item) => {
|
|
if (item.deptId) {
|
|
if (item.deptId) {
|
|
- selectUserValue.value.push({
|
|
|
|
|
|
+ selectUserValue.push({
|
|
relationId: item.deptId,
|
|
relationId: item.deptId,
|
|
relationName: item.name || '',
|
|
relationName: item.name || '',
|
|
relationType: 1,
|
|
relationType: 1,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (item.classId) {
|
|
if (item.classId) {
|
|
- selectUserValue.value.push({
|
|
|
|
|
|
+ selectUserValue.push({
|
|
relationId: item.classId,
|
|
relationId: item.classId,
|
|
relationName: item.name || '',
|
|
relationName: item.name || '',
|
|
relationType: 2,
|
|
relationType: 2,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
if (item.userId) {
|
|
if (item.userId) {
|
|
- selectUserValue.value.push({
|
|
|
|
|
|
+ selectUserValue.push({
|
|
relationId: item.userId,
|
|
relationId: item.userId,
|
|
relationName: item.name || '',
|
|
relationName: item.name || '',
|
|
relationType: 3,
|
|
relationType: 3,
|
|
@@ -182,6 +181,8 @@
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ resData['secondCourseEnrollRangeList'] = selectUserValue;
|
|
|
|
+
|
|
resData['secondCourseTimeList'] &&
|
|
resData['secondCourseTimeList'] &&
|
|
resData['secondCourseTimeList'].forEach((item) => {
|
|
resData['secondCourseTimeList'].forEach((item) => {
|
|
item['time'] = [item['startTime'], item['endTime']];
|
|
item['time'] = [item['startTime'], item['endTime']];
|
|
@@ -206,7 +207,9 @@
|
|
|
|
|
|
const secondCourseEnrollRangeList: Recordable[] = [];
|
|
const secondCourseEnrollRangeList: Recordable[] = [];
|
|
|
|
|
|
- selectUserValue.value.forEach((item: Recordable) => {
|
|
|
|
|
|
+ const selectUserValue = postParams['secondCourseEnrollRangeList'] || [];
|
|
|
|
+
|
|
|
|
+ selectUserValue.forEach((item: Recordable) => {
|
|
if (item.relationType === 1) {
|
|
if (item.relationType === 1) {
|
|
secondCourseEnrollRangeList.push({
|
|
secondCourseEnrollRangeList.push({
|
|
deptId: item.relationId,
|
|
deptId: item.relationId,
|
|
@@ -278,8 +281,8 @@
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- const handleUserChange = (data: Recordable[]) => {
|
|
|
|
- selectUserValue.value = data;
|
|
|
|
|
|
+ const handleUserChange = (model, field, data: Recordable[]) => {
|
|
|
|
+ model[field] = data;
|
|
};
|
|
};
|
|
|
|
|
|
function getTableAction() {
|
|
function getTableAction() {
|