|
@@ -0,0 +1,93 @@
|
|
|
+<template>
|
|
|
+ <BasicModal
|
|
|
+ @ok="handleSubmit"
|
|
|
+ :destroyOnClose="true"
|
|
|
+ :maskClosable="false"
|
|
|
+ v-bind="$attrs"
|
|
|
+ @register="registerModal"
|
|
|
+ :title="getTitle"
|
|
|
+ :width="1002"
|
|
|
+ >
|
|
|
+ <BasicForm @register="registerForm">
|
|
|
+ <template #studentIds>
|
|
|
+ <div class="flex" style="flex-wrap: wrap">
|
|
|
+ <div v-for="(item, index) in modelRef" :key="index">
|
|
|
+ <div style="margin: 4px" v-if="index < 6"> {{ item.name }}</div>
|
|
|
+ </div>
|
|
|
+ <div style="margin: 4px" v-if="modelRef.length > 6"> ... 等{{ modelRef.length }}个 </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </BasicForm>
|
|
|
+ </BasicModal>
|
|
|
+</template>
|
|
|
+<script setup lang="ts">
|
|
|
+ import { ref, computed, unref } from 'vue';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ import { BasicModal, useModalInner } from '/@/components/Modal';
|
|
|
+ import { BasicForm, useForm } from '/@/components/Form/index';
|
|
|
+
|
|
|
+ import { deleteBaseNewStudentDeleteByUserIds } from '/@/services/apis/BaseNewStudentController';
|
|
|
+
|
|
|
+ const isUpdate = ref(true);
|
|
|
+ const modelRef = ref<Recordable[]>([]);
|
|
|
+ const emit = defineEmits(['success', 'register']);
|
|
|
+ const { createMessage } = useMessage();
|
|
|
+ const [registerForm, { validate, resetFields }] = useForm({
|
|
|
+ labelWidth: 100,
|
|
|
+ schemas: [
|
|
|
+ {
|
|
|
+ field: 'studentIds',
|
|
|
+ label: '删除学生',
|
|
|
+ component: 'Input',
|
|
|
+ colProps: { span: 24 },
|
|
|
+ slot: 'studentIds',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'deleteReason',
|
|
|
+ label: '删除原因',
|
|
|
+ component: 'Input',
|
|
|
+ colProps: { span: 24 },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ showActionButtonGroup: false,
|
|
|
+ });
|
|
|
+
|
|
|
+ const [registerModal, { closeModal, setModalProps }] = useModalInner(async (data) => {
|
|
|
+ resetFields();
|
|
|
+ setModalProps({ confirmLoading: false });
|
|
|
+ isUpdate.value = !!data?.isUpdate;
|
|
|
+ modelRef.value = [...data.baseData];
|
|
|
+ });
|
|
|
+
|
|
|
+ const getTitle = computed(() => (!unref(isUpdate) ? '删除' : '删除'));
|
|
|
+ const handleSubmit = async () => {
|
|
|
+ try {
|
|
|
+ const values = await validate();
|
|
|
+ setModalProps({ confirmLoading: true });
|
|
|
+
|
|
|
+ const ids: string[] = [];
|
|
|
+ const userIds: string[] = [];
|
|
|
+
|
|
|
+ modelRef.value.forEach((item) => {
|
|
|
+ ids.push(item.id);
|
|
|
+ userIds.push(item.userId);
|
|
|
+ });
|
|
|
+
|
|
|
+ const postParams = {
|
|
|
+ ids: ids,
|
|
|
+ userIds: userIds,
|
|
|
+ };
|
|
|
+ Object.assign(postParams, values);
|
|
|
+
|
|
|
+ await deleteBaseNewStudentDeleteByUserIds(postParams);
|
|
|
+
|
|
|
+ createMessage.success('操作成功');
|
|
|
+ closeModal();
|
|
|
+ emit('success');
|
|
|
+ } finally {
|
|
|
+ setModalProps({ confirmLoading: false });
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less"></style>
|