DESKTOP-USV654P\pc пре 3 месеци
родитељ
комит
959bd19b81

+ 2 - 9
src/views/educational/banding/task/division.vue

@@ -11,12 +11,7 @@
     @close="handelClose"
     :defaultFullscreen="true"
   >
-    <FormDivision
-      ref="formDivisionRef"
-      :taskId="modelRef?.id"
-      :status="modelRef?.status"
-      @success="handelSuccess"
-    />
+    <FormDivision ref="formDivisionRef" @success="handelSuccess" />
   </BasicModal>
 </template>
 <script setup lang="ts">
@@ -33,9 +28,7 @@
     setModalProps({ confirmLoading: false });
     isUpdate.value = !!data?.isUpdate;
     modelRef.value = { ...data.baseData };
-    setTimeout(() => {
-      formDivisionRef.value?.reload();
-    }, 500);
+    formDivisionRef.value?.reload({ ...data.baseData });
   });
 
   const getTitle = computed(() => (!unref(isUpdate) ? '新生分配' : '新生分配'));

+ 12 - 11
src/views/educational/division/components/DsionStep1.vue

@@ -16,18 +16,13 @@
 <script setup lang="ts">
   import { Checkbox, Radio, CheckboxOptionType } from 'ant-design-vue';
   import { CheckboxValueType } from 'ant-design-vue/lib/checkbox/interface';
-  import { onMounted, reactive, watch } from 'vue';
+  import { onMounted, reactive } from 'vue';
 
   import {
     getBandingTaskRuleList,
     postBandingTaskSetRule,
   } from '/@/services/apis/BandingTaskController';
 
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
-  });
-
   const state = reactive<{
     gradeId: String;
     enrollType: String;
@@ -35,6 +30,8 @@
     radioItem: CheckboxValueType;
     checkedOptions: CheckboxOptionType[];
     radioOptions: CheckboxOptionType[];
+    taskId: String;
+    status: Number;
   }>({
     gradeId: '',
     enrollType: '',
@@ -42,6 +39,8 @@
     radioItem: '',
     checkedOptions: [],
     radioOptions: [],
+    taskId: '',
+    status: 0,
   });
 
   // watch(
@@ -53,12 +52,14 @@
   //   },
   // );
 
-  const reloadStep = () => {
-    getRule(props.taskId);
+  const reloadStep = (data) => {
+    state.taskId = data.taskId;
+    state.status = data.status;
+    getRule();
   };
 
-  const getRule = async (taskId) => {
-    const data = await getBandingTaskRuleList({ id: taskId });
+  const getRule = async () => {
+    const data = await getBandingTaskRuleList({ id: state.taskId });
     const checkboxItem: CheckboxValueType[] = [];
     let radioItem = '';
 
@@ -90,7 +91,7 @@
       if (state.radioItem) {
         bandingRuleIds.push(state.radioItem);
       }
-      await postBandingTaskSetRule({ bandingRuleIds: bandingRuleIds, bandingTaskId: props.taskId });
+      await postBandingTaskSetRule({ bandingRuleIds: bandingRuleIds, bandingTaskId: state.taskId });
       return true;
     } catch {
       return false;

+ 30 - 35
src/views/educational/division/components/DsionStep2_1.vue

@@ -2,16 +2,18 @@
   <div class="dsion-step2">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelImport" :disabled="status === 1">导入</a-button>
-        <a-button type="primary" @click="handelAdd" :disabled="status === 1">添加</a-button>
-        <a-button type="primary" @click="handelSave" :disabled="status === 1">保存</a-button>
+        <a-button type="primary" @click="handelImport" :disabled="state.status === 1">
+          导入
+        </a-button>
+        <a-button type="primary" @click="handelAdd" :disabled="state.status === 1">添加</a-button>
+        <a-button type="primary" @click="handelSave" :disabled="state.status === 1">保存</a-button>
       </template>
 
       <template #majorSetId="{ record, column }">
         <Select
           v-model:value="record[column.dataIndex]"
           :options="majorSetOptions"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           :showSearch="true"
           :filterOption="filterOption"
           style="margin: -5px 0; width: 100%"
@@ -21,7 +23,7 @@
         <Select
           v-model:value="record[column.dataIndex]"
           :options="classTypeOptions"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           :showSearch="true"
           :filterOption="filterOption"
           style="margin: -5px 0; width: 100%"
@@ -31,7 +33,7 @@
         <a-input
           v-model:value="record[column.dataIndex]"
           placeholder="班级名称"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -39,7 +41,7 @@
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="班级人数"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -47,7 +49,7 @@
         <Select
           v-model:value="record[column.dataIndex]"
           :options="teacherOptions"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           :showSearch="true"
           :filterOption="filterOption"
           style="margin: -5px 0; width: 100%"
@@ -57,20 +59,20 @@
         <Select
           v-model:value="record[column.dataIndex]"
           :options="classroomOptions"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           :showSearch="true"
           :filterOption="filterOption"
           style="margin: -5px 0; width: 100%"
         />
       </template>
       <template #isOrderClass="{ record, column }">
-        <Checkbox :disabled="status === 1" v-model:checked="record[column.dataIndex]" />
+        <Checkbox :disabled="state.status === 1" v-model:checked="record[column.dataIndex]" />
       </template>
       <template #sortCode="{ record, column }">
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="排序"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -79,13 +81,13 @@
           :actions="[
             {
               label: '保存',
-              disabled: status === 1,
+              disabled: state.status === 1,
               onClick: handleSave.bind(null, record),
             },
             {
               label: '删除',
               color: 'error',
-              disabled: status === 1,
+              disabled: state.status === 1,
               onClick: handleDelete.bind(null, record),
             },
           ]"
@@ -98,7 +100,7 @@
 </template>
 
 <script setup lang="ts">
-  import { reactive, ref, watch, onMounted } from 'vue';
+  import { reactive, ref, onMounted } from 'vue';
   import { BasicTable, useTable, TableAction, EditRecordRow } from '/@/components/Table';
   import { table2Columns } from '../data.config';
   import { useMessage } from '/@/hooks/web/useMessage';
@@ -108,7 +110,6 @@
   import {
     deleteBandingBandingTaskClass,
     getBandingTaskClassList,
-    postBandingBandingTaskClass,
     putBandingBandingTaskClass,
   } from '/@/services/apis/BandingTaskClassController';
   import { getMajorSetOption } from '/@/api/userMagic';
@@ -148,20 +149,11 @@
 
   const searchInfo = reactive<Recordable>({});
 
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
+  const state = reactive({
+    taskId: '',
+    status: 0,
   });
 
-  watch(
-    () => props.taskId,
-    async (newVal) => {
-      if (newVal) {
-        searchInfo.bandingTaskId = newVal;
-      }
-    },
-  );
-
   const { createMessage } = useMessage();
 
   const handelAdd = () => {
@@ -189,7 +181,7 @@
         await putBandingBandingTaskClass([
           {
             ...data,
-            bandingTaskId: props.taskId,
+            bandingTaskId: state.taskId,
           },
         ]);
       } else {
@@ -215,7 +207,7 @@
       dataItem['isOrderClass'] = dataItem['isOrderClass'] || dataItem['isOrderClass'] === 1 ? 1 : 0;
       if (item._newRow) {
         delete dataItem.id;
-        Object.assign(dataItem, { bandingTaskId: props.taskId });
+        Object.assign(dataItem, { bandingTaskId: state.taskId });
       }
       postData.push(dataItem);
     });
@@ -231,7 +223,7 @@
   };
 
   const handelImport = () => {
-    openImportModal(true, { baseData: { taskId: props.taskId } });
+    openImportModal(true, { baseData: { taskId: state.taskId } });
   };
 
   const handleSuccess = () => {
@@ -241,14 +233,17 @@
   const validateStep = () => {
     return true;
   };
-  const reloadStep = () => {
+  const reloadStep = (data) => {
+    state.taskId = data.taskId;
+    state.status = data.status;
+    searchInfo.bandingTaskId = data.taskId;
     reload();
   };
 
-  const majorSetOptions = ref([]);
-  const teacherOptions = ref([]);
-  const classroomOptions = ref([]);
-  const classTypeOptions = ref([]);
+  const majorSetOptions = ref<Recordable[]>([]);
+  const teacherOptions = ref<Recordable[]>([]);
+  const classroomOptions = ref<Recordable[]>([]);
+  const classTypeOptions = ref<Recordable[]>([]);
 
   onMounted(async () => {
     majorSetOptions.value = await getMajorSetOption();

+ 18 - 23
src/views/educational/division/components/DsionStep3.vue

@@ -2,9 +2,11 @@
   <div class="dsion-step3">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelConfirm" :disabled="status === 1">开始分班</a-button>
+        <a-button type="primary" @click="handelConfirm" :disabled="state.status === 1">
+          开始分班
+        </a-button>
         <!-- <a-button type="warning">撤回</a-button> -->
-        <a-button type="error" @click="handelReset" :disabled="status === 1">重置</a-button>
+        <a-button type="error" @click="handelReset" :disabled="state.status === 1">重置</a-button>
       </template>
       <template #satisfyCount="{ record, text }">
         <a-button type="link" @click="handelSatisfy(record)">{{ text }}</a-button>
@@ -17,14 +19,14 @@
           :actions="[
             {
               label: '锁定',
-              disabled: status === 1,
+              disabled: state.status === 1,
               ifShow: record.status === 0,
               onClick: handleLock.bind(null, record, 1),
             },
             {
               label: '解锁',
               color: 'error',
-              disabled: status === 1,
+              disabled: state.status === 1,
               ifShow: record.status === 1,
               onClick: handleLock.bind(null, record, 0),
             },
@@ -38,7 +40,7 @@
 </template>
 
 <script setup lang="ts">
-  import { reactive, watch } from 'vue';
+  import { reactive } from 'vue';
   import { BasicTable, useTable, TableAction } from '/@/components/Table';
   import { searchForm3Schema, table3Columns } from '../data.config';
   import {
@@ -81,27 +83,17 @@
   const [registerSurplusModal, { openModal: openSurplusModal }] = useModal();
 
   const searchInfo = reactive<Recordable>({});
-
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
+  const state = reactive({
+    taskId: '',
+    status: 0,
   });
 
-  watch(
-    () => props.taskId,
-    async (newVal) => {
-      if (newVal) {
-        searchInfo.bandingTaskId = newVal;
-      }
-    },
-  );
-
   const validateStep = () => {
     return true;
   };
 
   const handelReset = async () => {
-    await postBandingTaskClassReset({ bandingTaskId: props.taskId });
+    await postBandingTaskClassReset({ bandingTaskId: state.taskId });
     reload();
   };
 
@@ -111,18 +103,21 @@
   };
 
   const handelSatisfy = (record: Recordable) => {
-    openSatisfyModal(true, { baseData: { ...record }, status: props.status });
+    openSatisfyModal(true, { baseData: { ...record }, status: state.status });
   };
   const handelSurplus = (record: Recordable) => {
-    openSurplusModal(true, { baseData: { ...record }, status: props.status });
+    openSurplusModal(true, { baseData: { ...record }, status: state.status });
   };
 
   const handelConfirm = async () => {
-    await postBandingTaskAutomaticBanding({ bandingTaskId: props.taskId });
+    await postBandingTaskAutomaticBanding({ bandingTaskId: state.taskId });
     handleSuccess();
   };
 
-  const reloadStep = () => {
+  const reloadStep = (data) => {
+    state.taskId = data.taskId;
+    state.status = data.status;
+    searchInfo.bandingTaskId = data.taskId;
     handleSuccess();
   };
 

+ 12 - 16
src/views/educational/division/components/DsionStep4.vue

@@ -2,7 +2,9 @@
   <div class="dsion-step4">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelAjd" :disabled="status === 1">调整班级</a-button>
+        <a-button type="primary" @click="handelAjd" :disabled="state.status === 1">
+          调整班级
+        </a-button>
         <a-button type="primary" @click="handelExport">导出</a-button>
       </template>
     </BasicTable>
@@ -11,7 +13,7 @@
 </template>
 
 <script setup lang="ts">
-  import { reactive, watch } from 'vue';
+  import { reactive } from 'vue';
   import { BasicTable, useTable } from '/@/components/Table';
   import { table4Columns, searchForm4Schema } from '../data.config';
   import {
@@ -47,25 +49,19 @@
 
   const searchInfo = reactive<Recordable>({});
 
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
+  const state = reactive({
+    taskId: '',
+    status: 0,
   });
 
-  watch(
-    () => props.taskId,
-    async (newVal) => {
-      if (newVal) {
-        searchInfo.bandingTaskId = newVal;
-      }
-    },
-  );
-
   const validateStep = () => {
     return true;
   };
 
-  const reloadStep = () => {
+  const reloadStep = (data) => {
+    state.taskId = data.taskId;
+    state.status = data.status;
+    searchInfo.bandingTaskId = data.taskId;
     handleSuccess();
   };
 
@@ -74,7 +70,7 @@
     if (selectRows.length > 0) {
       openModal(true, {
         isUpdate: false,
-        bandingTaskId: props.taskId,
+        bandingTaskId: state.taskId,
         baseData: [...selectRows],
       });
     }

+ 10 - 16
src/views/educational/division/components/DsionStep5.vue

@@ -6,7 +6,7 @@
           type="primary"
           @click="handelConfirm"
           :loading="loadingRef"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
         >
           分班确认
         </a-button>
@@ -16,7 +16,7 @@
 </template>
 
 <script setup lang="ts">
-  import { reactive, ref, watch } from 'vue';
+  import { reactive, ref } from 'vue';
   import { BasicTable, useTable } from '/@/components/Table';
   import { table5Columns } from '../data.config';
   import { getBandingTaskClassClassSure } from '/@/services/apis/BandingTaskClassController';
@@ -42,32 +42,26 @@
 
   const searchInfo = reactive<Recordable>({});
 
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
+  const state = reactive({
+    taskId: '',
+    status: 0,
   });
 
-  watch(
-    () => props.taskId,
-    async (newVal) => {
-      if (newVal) {
-        searchInfo.bandingTaskId = newVal;
-      }
-    },
-  );
-
   const validateStep = () => {
     return true;
   };
 
-  const reloadStep = () => {
+  const reloadStep = (data) => {
+    state.taskId = data.taskId;
+    state.status = data.status;
+    searchInfo.bandingTaskId = data.taskId;
     reload();
   };
 
   const handelConfirm = async () => {
     try {
       loadingRef.value = true;
-      await postBandingTaskSure({ id: props.taskId });
+      await postBandingTaskSure({ id: state.taskId });
       emit('success');
     } finally {
       loadingRef.value = false;

+ 14 - 18
src/views/educational/division/components/DsionStep6.vue

@@ -2,13 +2,15 @@
   <div class="dsion-step6">
     <BasicTable @register="registerTable" :searchInfo="searchInfo">
       <template #toolbar>
-        <a-button type="primary" @click="handelSave" :disabled="status === 1">保存</a-button>
+        <a-button type="primary" @click="handelSave" :disabled="state.status === 1">
+          保存
+        </a-button>
       </template>
       <template #height="{ record, column }">
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="请设置限制条件"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -16,7 +18,7 @@
         <a-input-number
           v-model:value="record[column.dataIndex]"
           placeholder="请设置限制条件"
-          :disabled="status === 1"
+          :disabled="state.status === 1"
           style="margin: -5px 0; width: 100%"
         />
       </template>
@@ -25,7 +27,7 @@
 </template>
 
 <script setup lang="ts">
-  import { reactive, watch } from 'vue';
+  import { reactive } from 'vue';
   import { BasicTable, useTable } from '/@/components/Table';
   import { searchForm6Schema, table6Columns } from '../data.config';
   import { Recordable } from 'vite-plugin-mock';
@@ -59,20 +61,11 @@
   const [openFullLoading, closeFullLoading] = useLoading({
     tip: '处理中...',
   });
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
+  const state = reactive({
+    taskId: '',
+    status: 0,
   });
 
-  watch(
-    () => props.taskId,
-    async (newVal) => {
-      if (newVal) {
-        searchInfo.bandingTaskId = newVal;
-      }
-    },
-  );
-
   const validateStep = async () => {
     return true;
   };
@@ -91,7 +84,7 @@
         });
       });
 
-      await postBandingTaskMajorConditionSave({ bandingTaskId: props.taskId, conditionList: list });
+      await postBandingTaskMajorConditionSave({ bandingTaskId: state.taskId, conditionList: list });
       createMessage.success('保存成功');
     } catch {
       createMessage.success('保存失败');
@@ -100,7 +93,10 @@
     }
   };
 
-  const reloadStep = () => {
+  const reloadStep = (data) => {
+    state.taskId = data.taskId;
+    state.status = data.status;
+    searchInfo.bandingTaskId = data.taskId;
     reload();
     redoHeight();
   };

+ 0 - 1
src/views/educational/division/components/satisfy.vue

@@ -1,6 +1,5 @@
 <script setup lang="ts">
   import { useModalInner, BasicModal } from '/@/components/Modal';
-  import { PageWrapper } from '/@/components/Page';
   import { useTable, BasicTable, TableAction } from '/@/components/Table';
   import { reactive, ref } from 'vue';
   import { Recordable } from 'vite-plugin-mock';

+ 0 - 1
src/views/educational/division/components/surplus.vue

@@ -1,6 +1,5 @@
 <script setup lang="ts">
   import { useModalInner, BasicModal } from '/@/components/Modal';
-  import { PageWrapper } from '/@/components/Page';
   import { useTable, BasicTable, TableAction } from '/@/components/Table';
   import { reactive, ref } from 'vue';
   import { Recordable } from 'vite-plugin-mock';

+ 22 - 49
src/views/educational/division/index.vue

@@ -8,43 +8,12 @@
       </Steps>
     </div>
     <div class="page-dsion-body">
-      <DsionStep1
-        ref="dsionStep1Ref"
-        :taskId="taskId"
-        :status="status"
-        v-show="state.stepIndex === 0"
-      />
-      <DsionStep6
-        ref="dsionStep6Ref"
-        :taskId="taskId"
-        :status="status"
-        v-show="state.stepIndex === 1"
-      />
-      <DsionStep2
-        ref="dsionStep2Ref"
-        :taskId="taskId"
-        :status="status"
-        v-show="state.stepIndex === 2"
-      />
-      <DsionStep3
-        ref="dsionStep3Ref"
-        :taskId="taskId"
-        :status="status"
-        v-show="state.stepIndex === 3"
-      />
-      <DsionStep4
-        ref="dsionStep4Ref"
-        :taskId="taskId"
-        :status="status"
-        v-show="state.stepIndex === 4"
-      />
-      <DsionStep5
-        ref="dsionStep5Ref"
-        :taskId="taskId"
-        :status="status"
-        v-show="state.stepIndex === 5"
-        @success="handleSubmit"
-      />
+      <DsionStep1 ref="dsionStep1Ref" v-show="state.stepIndex === 0" />
+      <DsionStep6 ref="dsionStep6Ref" v-show="state.stepIndex === 1" />
+      <DsionStep2 ref="dsionStep2Ref" v-show="state.stepIndex === 2" />
+      <DsionStep3 ref="dsionStep3Ref" v-show="state.stepIndex === 3" />
+      <DsionStep4 ref="dsionStep4Ref" v-show="state.stepIndex === 4" />
+      <DsionStep5 ref="dsionStep5Ref" v-show="state.stepIndex === 5" @success="handleSubmit" />
     </div>
     <div class="page-dsion-floor">
       <a-button v-show="state.stepIndex !== 0" @click="handleStep(0)" class="ml-[24px]">
@@ -62,7 +31,7 @@
         v-show="state.stepIndex === 5"
         type="primary"
         class="ml-[24px]"
-        :disabled="status === 1"
+        :disabled="state.status === 1"
         @click="handleSubmit"
       >
         确认
@@ -84,10 +53,10 @@
   // import { postBandingTaskSure } from '/@/services/apis/BandingTaskController';
   // import { useMessage } from '/@/hooks/web/useMessage';
 
-  const props = defineProps({
-    taskId: { type: String, default: '' },
-    status: { type: Number, default: 0 },
-  });
+  // const props = defineProps({
+  //   taskId: { type: String, default: '' },
+  //   status: { type: Number, default: 0 },
+  // });
 
   const emits = defineEmits(['success']);
   // const { createMessage } = useMessage();
@@ -109,6 +78,8 @@
       { title: '班级调整' },
       { title: '分班确认' },
     ],
+    taskId: '',
+    status: 0,
   });
 
   const handleSubmit = async () => {
@@ -140,15 +111,17 @@
   };
 
   const stepReload = {
-    0: () => dsionStep1Ref.value.reloadStep(),
-    1: () => dsionStep6Ref.value.reloadStep(),
-    2: () => dsionStep2Ref.value.reloadStep(),
-    3: () => dsionStep3Ref.value.reloadStep(),
-    4: () => dsionStep4Ref.value.reloadStep(),
-    5: () => dsionStep5Ref.value.reloadStep(),
+    0: () => dsionStep1Ref.value.reloadStep({ taskId: state.taskId, status: state.status }),
+    1: () => dsionStep6Ref.value.reloadStep({ taskId: state.taskId, status: state.status }),
+    2: () => dsionStep2Ref.value.reloadStep({ taskId: state.taskId, status: state.status }),
+    3: () => dsionStep3Ref.value.reloadStep({ taskId: state.taskId, status: state.status }),
+    4: () => dsionStep4Ref.value.reloadStep({ taskId: state.taskId, status: state.status }),
+    5: () => dsionStep5Ref.value.reloadStep({ taskId: state.taskId, status: state.status }),
   };
 
-  const reload = () => {
+  const reload = (data) => {
+    state.taskId = data.id;
+    state.status = data.status;
     stepReload[0]();
   };