فهرست منبع

feat:修改活动赛事

DESKTOP-USV654P\pc 3 ماه پیش
والد
کامیت
497bd5b72d

+ 1 - 1
src/views/activity/contest/data.config.ts

@@ -195,7 +195,7 @@ export const formSchema: FormSchema[] = [
   },
   {
     label: '报名范围',
-    field: 'rangeUser',
+    field: 'activityEnrollRangeList',
     component: 'Input',
     required: true,
     colProps: { span: 24 },

+ 12 - 11
src/views/activity/contest/edit.vue

@@ -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
@@ -46,8 +46,6 @@
   const emit = defineEmits(['success', 'register']);
   const { createMessage } = useMessage();
 
-  const selectUserValue = ref<Recordable[]>([]);
-
   const [registerForm, { validate, setFieldsValue, resetFields, setProps }] = useForm({
     labelWidth: 100,
     schemas: formSchema,
@@ -75,34 +73,35 @@
       });
     }
     modelRef.value = { ...data.baseData };
-    selectUserValue.value = [];
+    const selectUserValue: Recordable[] = [];
     if (unref(isUpdate)) {
       const resData = await getActivityInfoInfo({ id: data.baseData.id });
       resData['date'] = [resData['startDate'], resData['endDate']];
       resData['activityEnrollRangeList'] &&
         resData['activityEnrollRangeList'].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,
             });
           }
         });
+      resData['activityEnrollRangeList'] = selectUserValue;
       modelRef.value = { ...resData };
       setFieldsValue({
         ...resData,
@@ -124,7 +123,9 @@
 
       const activityEnrollRangeList: Recordable[] = [];
 
-      selectUserValue.value.forEach((item: Recordable) => {
+      const selectUserValue = postParams['activityEnrollRangeList'] || [];
+
+      selectUserValue.forEach((item: Recordable) => {
         if (item.relationType === 1) {
           activityEnrollRangeList.push({
             deptId: item.relationId,
@@ -163,8 +164,8 @@
     }
   };
 
-  const handleUserChange = (data: Recordable[]) => {
-    selectUserValue.value = data;
+  const handleUserChange = (model, field, data: Recordable[]) => {
+    model[field] = data;
   };
 </script>
 

+ 1 - 1
src/views/activity/cooperate/data.config.ts

@@ -209,7 +209,7 @@ export const formSchema: FormSchema[] = [
   },
   {
     label: '报名范围',
-    field: 'rangeUser',
+    field: 'activityEnrollRangeList',
     component: 'Input',
     required: true,
     colProps: { span: 24 },

+ 12 - 11
src/views/activity/cooperate/edit.vue

@@ -9,8 +9,8 @@
     :width="1002"
   >
     <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
@@ -45,8 +45,6 @@
   const emit = defineEmits(['success', 'register']);
   const { createMessage } = useMessage();
 
-  const selectUserValue = ref<Recordable[]>([]);
-
   const [registerForm, { validate, setFieldsValue, resetFields, setProps }] = useForm({
     labelWidth: 100,
     schemas: formSchema,
@@ -74,34 +72,35 @@
       });
     }
     modelRef.value = { ...data.baseData };
-    selectUserValue.value = [];
+    const selectUserValue: Recordable[] = [];
     if (unref(isUpdate)) {
       const resData = await getActivityInfoInfo({ id: data.baseData.id });
       resData['date'] = [resData['startDate'], resData['endDate']];
       resData['activityEnrollRangeList'] &&
         resData['activityEnrollRangeList'].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,
             });
           }
         });
+      resData['activityEnrollRangeList'] = selectUserValue;
       modelRef.value = { ...resData };
       setFieldsValue({
         ...resData,
@@ -123,7 +122,9 @@
 
       const activityEnrollRangeList: Recordable[] = [];
 
-      selectUserValue.value.forEach((item: Recordable) => {
+      const selectUserValue = postParams['activityEnrollRangeList'] || [];
+
+      selectUserValue.forEach((item: Recordable) => {
         if (item.relationType === 1) {
           activityEnrollRangeList.push({
             deptId: item.relationId,
@@ -162,8 +163,8 @@
     }
   };
 
-  const handleUserChange = (data: Recordable[]) => {
-    selectUserValue.value = data;
+  const handleUserChange = (model, field, data: Recordable[]) => {
+    model[field] = data;
   };
 </script>
 

+ 1 - 1
src/views/educational/classroom/data.config.ts

@@ -148,7 +148,7 @@ export const formSchema: FormSchema[] = [
   },
   {
     label: '报名范围',
-    field: 'rangeUser',
+    field: 'secondCourseEnrollRangeList',
     component: 'Input',
     required: true,
     colProps: { span: 24 },

+ 13 - 10
src/views/educational/classroom/edit.vue

@@ -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() {