Browse Source

feat:修改课程删除与节假调班

DESKTOP-USV654P\pc 4 months ago
parent
commit
39c3e3d764

+ 1 - 1
.env.development

@@ -15,8 +15,8 @@ VITE_DROP_CONSOLE = false
 
 # 接口地址
 # 如果没有跨域问题,直接在这里配置即可
+ VITE_GLOB_API_URL=http://localhost:8080
 # VITE_GLOB_API_URL=http://10.150.10.139:8888/api
- VITE_GLOB_API_URL=http://10.150.10.139:8888/api
 
 #VITE_GLOB_API_URL=http://172.21.92.28:8080
 # 文件上传接口  可选

+ 2 - 0
src/views/course/erasure/components/edit.vue

@@ -50,6 +50,7 @@
       const resData = await getClassTimeDeleteInfo({ id: data.baseData.id });
       resData['date'] = [resData['startDate'], resData['endDate']];
       modelRef.value = { ...resData };
+      resData['timePeriod'] = resData['timePeriod']?.split(',') || [];
       setFieldsValue({
         ...resData,
       });
@@ -66,6 +67,7 @@
       postParams['endDate'] = values['date'][1];
       Object.assign(postParams, values);
       delete postParams['date'];
+      postParams['timePeriod'] = postParams['timePeriod'].join(',');
 
       if (unref(isUpdate)) {
         await putClasstimeClassTimeDelete(postParams as API.UpdateClassTimeDeleteDto);

+ 24 - 11
src/views/course/erasure/data.config.ts

@@ -46,6 +46,19 @@ export const tableColumns: BasicColumn[] = [
       return `${formatToDate(record.startDate)}~${formatToDate(record.endDate)}`;
     },
   },
+  {
+    title: '删除课程',
+    dataIndex: 'timePeriod',
+    align: 'left',
+    width: 300,
+    customRender: ({ text }) => {
+      const timePeriod = text?.split(',');
+      const timePeriodArr = timePeriod?.map((item) => {
+        return timeOptions.find((option) => option.value == item)?.label;
+      });
+      return timePeriodArr?.join(',');
+    },
+  },
   {
     title: '删除说明',
     dataIndex: 'remark',
@@ -162,15 +175,15 @@ export const formSchema: FormSchema[] = [
     component: 'InputTextArea',
     colProps: { span: 24 },
   },
-  // {
-  //   label: '删除课程',
-  //   field: 'time',
-  //   component: 'CheckboxGroup',
-  //   required: true,
-  //   colProps: { span: 24 },
-  //   componentProps: {
-  //     options: timeOptions,
-  //     getPopupContainer: () => document.body,
-  //   },
-  // },
+  {
+    label: '删除课程',
+    field: 'timePeriod',
+    component: 'CheckboxGroup',
+    required: true,
+    colProps: { span: 24 },
+    componentProps: {
+      options: timeOptions,
+      getPopupContainer: () => document.body,
+    },
+  },
 ];

+ 25 - 28
src/views/course/holiday/components/edit.vue

@@ -30,12 +30,7 @@
     putClasstimeClassTimeCalendar,
   } from '/@/services/apis/ClassTimeCalendarController';
   import { timeOptions } from '../../erasure/data.config';
-  import { BasicOptionModel } from '/@/api/model/baseModel';
-
-  const typeOptions: BasicOptionModel[] = [
-    { label: '选中覆盖', value: 0 },
-    { label: '全天覆盖(未选中则覆盖为空)', value: 1 },
-  ];
+  import { typeOptions } from '../data.config';
 
   const isUpdate = ref(true);
   const modelRef = ref<Recordable>({});
@@ -71,28 +66,28 @@
           getPopupContainer: () => document.body,
         },
       },
-      // {
-      //   label: '补课课程',
-      //   field: 'time',
-      //   component: 'CheckboxGroup',
-      //   required: true,
-      //   colProps: { span: 24 },
-      //   componentProps: {
-      //     options: timeOptions,
-      //     getPopupContainer: () => document.body,
-      //   },
-      // },
-      // {
-      //   label: '覆盖方式',
-      //   field: 'timeType',
-      //   component: 'RadioGroup',
-      //   required: true,
-      //   colProps: { span: 24 },
-      //   componentProps: {
-      //     options: typeOptions,
-      //     getPopupContainer: () => document.body,
-      //   },
-      // },
+      {
+        label: '补课课程',
+        field: 'timePeriod',
+        component: 'CheckboxGroup',
+        required: true,
+        colProps: { span: 24 },
+        componentProps: {
+          options: timeOptions,
+          getPopupContainer: () => document.body,
+        },
+      },
+      {
+        label: '覆盖方式',
+        field: 'coverType',
+        component: 'RadioGroup',
+        required: true,
+        colProps: { span: 24 },
+        componentProps: {
+          options: typeOptions,
+          getPopupContainer: () => document.body,
+        },
+      },
       {
         field: 'remark',
         label: ' ',
@@ -129,6 +124,7 @@
       const resData = await getHolidayDateInfo({ id: data.baseData.id });
       resData['startDate'] = [resData['startDate'], resData['endDate']];
       modelRef.value = { ...resData };
+      resData['timePeriod'] = resData['timePeriod']?.split(',') || [];
       setFieldsValue({
         ...resData,
       });
@@ -142,6 +138,7 @@
       setModalProps({ confirmLoading: true });
       const postParams = unref(modelRef);
       Object.assign(postParams, values);
+      postParams['timePeriod'] = postParams['timePeriod'].join(',');
 
       if (unref(isUpdate)) {
         await putClasstimeClassTimeCalendar(postParams as API.UpdateClassTimeCalendarDto);

+ 34 - 5
src/views/course/holiday/data.config.ts

@@ -1,9 +1,16 @@
+import { timeOptions } from '../erasure/data.config';
+import { BasicOptionModel } from '/@/api/model/baseModel';
 import { BasicColumn, FormSchema } from '/@/components/Table';
 
-export const statusOptions = [
-  { lable: '生效', value: 0 },
-  { lable: '锁定', value: 1 },
-  { lable: '作废', value: 2 },
+export const statusOptions: BasicOptionModel[] = [
+  { label: '生效', value: 0 },
+  { label: '锁定', value: 1 },
+  { label: '作废', value: 2 },
+];
+
+export const typeOptions: BasicOptionModel[] = [
+  { label: '选中覆盖', value: 1 },
+  { label: '全天覆盖', value: 0 },
 ];
 
 export const tableColumns: BasicColumn[] = [
@@ -11,6 +18,7 @@ export const tableColumns: BasicColumn[] = [
     title: '补班日期',
     dataIndex: 'supplementDate',
     align: 'left',
+    width: 150,
   },
   {
     title: '补课日期',
@@ -18,13 +26,34 @@ export const tableColumns: BasicColumn[] = [
     align: 'left',
     width: 150,
   },
+  {
+    title: '覆盖方式',
+    dataIndex: 'coverType',
+    align: 'left',
+    width: 80,
+    customRender: ({ text }) => {
+      return typeOptions.find((item) => item.value === text)?.label;
+    },
+  },
+  {
+    title: '补课课程',
+    dataIndex: 'timePeriod',
+    align: 'left',
+    customRender: ({ text }) => {
+      const timePeriod = text?.split(',');
+      const timePeriodArr = timePeriod?.map((item) => {
+        return timeOptions.find((option) => option.value == item)?.label;
+      });
+      return timePeriodArr?.join(',');
+    },
+  },
   {
     title: '状态',
     dataIndex: 'status',
     align: 'left',
     width: 150,
     customRender: ({ record }) => {
-      return statusOptions.find((item) => item.value === record.status)?.lable;
+      return statusOptions.find((item) => item.value === record.status)?.label;
     },
   },
 ];