mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-16 14:26:45 +08:00
--fix 面授课不可添加重复的
This commit is contained in:
@@ -25,14 +25,16 @@
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script setup>
|
||||
import {defineEmits, defineProps, ref} from "vue";
|
||||
import {computed, defineEmits, defineProps, ref} from "vue";
|
||||
import {Form, message} from "ant-design-vue";
|
||||
import FaceClassAll from "@/components/drawers/FeaceClassAll.vue";
|
||||
import {useResetRef} from "@/utils/useCommon";
|
||||
|
||||
const props = defineProps({
|
||||
type: Number,
|
||||
taskList: []
|
||||
taskList: [],
|
||||
chapterList: [],
|
||||
infoType: Number,
|
||||
});
|
||||
const visible = ref(false);
|
||||
const formData = useResetRef({
|
||||
@@ -58,6 +60,8 @@ const rulesRef = ref({
|
||||
|
||||
const { validate } = Form.useForm(formData, rulesRef);
|
||||
|
||||
const selectIds = computed(()=>props.chapterList.flatMap(t=>props.infoType===1?t.taskDraftDtoList:t.draftTaskList)?.filter(s=>s?.type==props.type).map(t=>t.courseId).join(',') || '')
|
||||
|
||||
const closeDrawer = () => {
|
||||
visible.value = false;
|
||||
taskIndex.value = -1;
|
||||
@@ -69,6 +73,11 @@ async function confirm() {
|
||||
message.warning(errorFields[0].errors.join());
|
||||
throw Error("数据校验不通过");
|
||||
});
|
||||
if (selectIds.value.includes(formData.value.courseId)) {
|
||||
message.warning("本项目中已经包含此在线课!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taskIndex.value === -1) {
|
||||
const list = props.taskList;
|
||||
list.push({
|
||||
|
||||
Reference in New Issue
Block a user