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