Browse Source

feat:修改教职工和学生基本信息

DESKTOP-USV654P\pc 4 months ago
parent
commit
c5133dfd20

+ 68 - 15
src/views/educational/stdudentBaseManager/components/data.config.ts

@@ -3,6 +3,8 @@ import { BasicColumn } from '/@/components/Table';
 import { getDataOption } from '/@/api/system/dic';
 import { getAreaOption, getClassOption, getGradeOption, getMajorSetOption } from '/@/api/userMagic';
 import { getDepartmentTree } from '/@/api/system/department';
+import { filterOption } from 'ant-design-vue/lib/vc-mentions/src/util';
+import { requestMagicApi } from '/@/api/magicApi';
 
 export const columns1: BasicColumn[] = [
   {
@@ -349,6 +351,7 @@ export const fromSchema: FormSchema[] = [
     field: 'gender',
     label: '性别',
     component: 'ApiSelect',
+    required: true,
     componentProps: {
       getPopupContainer: () => document.body,
       api: getDataOption,
@@ -434,7 +437,7 @@ export const fromSchema: FormSchema[] = [
     field: 'dayOfBirth',
     label: '出生日期',
     component: 'DatePicker',
-    required: true,
+    // required: true,
     componentProps: {
       valueFormat: 'YYYY-MM-DD',
     },
@@ -444,7 +447,7 @@ export const fromSchema: FormSchema[] = [
     field: 'birthType',
     label: '生日类型',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'date_type' });
@@ -456,7 +459,7 @@ export const fromSchema: FormSchema[] = [
     field: 'nation',
     label: '民族',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'nation' });
@@ -784,7 +787,7 @@ export const fromSchema: FormSchema[] = [
   },
   {
     field: 'departmentIds',
-    label: '所属机构',
+    label: '所属部门',
     component: 'ApiTreeSelect',
     componentProps: {
       api: getDepartmentTree,
@@ -839,13 +842,13 @@ export const schoolRoll: FormSchema[] = [
     field: 'rollNumber',
     label: '学籍号',
     component: 'InputNumber',
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
   {
     field: 'archivesNumber',
     label: '学生档案编号',
-    required: true,
+    // required: true,
     component: 'Input',
     colProps: { span: 7 },
   },
@@ -875,10 +878,40 @@ export const schoolRoll: FormSchema[] = [
     label: '入学年级',
     component: 'ApiSelect',
     required: true,
-    componentProps: {
-      api: () => {
-        return getGradeOption();
-      },
+    componentProps: ({ formActionType }) => {
+      return {
+        getPopupContainer: () => document.body,
+        api: getGradeOption,
+        showSearch: true,
+        filterOption: (input: string, option: any) => {
+          return (
+            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+            option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+          );
+        },
+        onChange: async (vlaue) => {
+          const {  updateSchema } = formActionType;
+          const classData = await requestMagicApi({
+            url: 'educational/class-by',
+            query: { grade_id: vlaue },
+          } as any);
+          updateSchema({
+            field: 'classId',
+            component: 'Select',
+            componentProps: {
+              getPopupContainer: () => document.body,
+              options: classData,
+              showSearch: true,
+              filterOption: (input: string, option: any) => {
+                return (
+                  option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+                  option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                );
+              },
+            },
+          });
+        },
+      };
     },
     colProps: { span: 7 },
   },
@@ -891,7 +924,7 @@ export const schoolRoll: FormSchema[] = [
         return getDataOption({ code: 'enroll_type' });
       },
     },
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
   {
@@ -909,6 +942,13 @@ export const schoolRoll: FormSchema[] = [
             formModel.studyYear = res.find((item) => item.value === value)?.year;
           });
         },
+        showSearch: true,
+        filterOption: (input: string, option: any) => {
+          return (
+            option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+            option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+          );
+        },
       };
     },
     colProps: { span: 7 },
@@ -926,8 +966,14 @@ export const schoolRoll: FormSchema[] = [
     component: 'ApiSelect',
     required: true,
     componentProps: {
-      api: () => {
-        return getClassOption();
+      api: getClassOption,
+      getPopupContainer: () => document.body,
+      showSearch: true,
+      filterOption: (input: string, option: any) => {
+        return (
+          option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+          option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+        );
       },
     },
     colProps: { span: 7 },
@@ -944,7 +990,7 @@ export const schoolRoll: FormSchema[] = [
     field: 'studentSource',
     label: '学生来源',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'student_type' });
@@ -973,6 +1019,13 @@ export const schoolRoll: FormSchema[] = [
       api: () => {
         return getDataOption({ code: 'archives_status' });
       },
+      showSearch: true,
+      filterOption: (input: string, option: any) => {
+        return (
+          option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
+          option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
+        );
+      },
     },
     colProps: { span: 7 },
   },
@@ -980,7 +1033,7 @@ export const schoolRoll: FormSchema[] = [
     field: 'learnStatus',
     label: '学习形式',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'roll_modality' });

+ 2 - 0
src/views/educational/teacherbasemanager/components/TeacherbaseManagerDrawer.vue

@@ -245,6 +245,7 @@
       state.rowId = data.id;
       const record = await getXjrUser(data.id);
       record['departmentIds'] = record['departmentIds'].split(',');
+      record['postIds'] = record['postIds'] === '' ? [] : record['postIds'].split(',');
       Promise.all([
         setContactValue(record.baseTeacherContactList[0]),
         setFamilyValue(record.baseTeacherFamilyList[0]),
@@ -293,6 +294,7 @@
           credentialNumber: values[0].credentialNumber,
           credentialType: values[0].credentialType,
           departmentIds: values[0].departmentIds?.join(),
+          postIds: values[0].postIds?.join(),
         };
         if (state.isUpdate) {
           formValues['id'] = state.rowId;

+ 42 - 26
src/views/educational/teacherbasemanager/components/data.config.ts

@@ -3,6 +3,7 @@ import { BasicColumn } from '/@/components/Table';
 import { getDataOption } from '/@/api/system/dic';
 import { getAreaOption, getMajorOption, getSubjectOption } from '/@/api/userMagic';
 import { getDepartmentTree } from '/@/api/system/department';
+import { getPostList } from '/@/api/system/post';
 
 export const sexOptions = [
   {
@@ -156,6 +157,7 @@ export const baseFromSchema: FormSchema[] = [
   {
     field: 'gender',
     label: '性别',
+    required: true,
     component: 'ApiSelect',
     componentProps: {
       getPopupContainer: () => document.body,
@@ -169,11 +171,11 @@ export const baseFromSchema: FormSchema[] = [
     label: '邮箱',
     component: 'Input',
     rules: [
-      {
-        required: true,
-        message: '请输入邮箱',
-        trigger: 'blur',
-      },
+      // {
+      //   required: true,
+      //   message: '请输入邮箱',
+      //   trigger: 'blur',
+      // },
       {
         type: 'email',
         message: '请输入正确的邮箱地址',
@@ -247,7 +249,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'dayOfBirth',
     label: '出生日期',
     component: 'DatePicker',
-    required: true,
+    // required: true,
     componentProps: {
       format: 'YYYY-MM-DD',
     },
@@ -257,7 +259,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'birthType',
     label: '生日类型',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'date_type' });
@@ -269,7 +271,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'nation',
     label: '民族',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'nation' });
@@ -281,7 +283,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'bloodType',
     label: '血型',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'blood_type' });
@@ -293,7 +295,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'maritalState',
     label: '健康状况',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'health' });
@@ -305,7 +307,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'politicalState',
     label: '政治面貌',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'political_state' });
@@ -317,7 +319,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'nationality',
     label: '国籍地区',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'nationality' });
@@ -399,7 +401,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'houseHoldAddress',
     label: '户籍地址',
     component: 'Input',
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
   {
@@ -436,7 +438,7 @@ export const baseFromSchema: FormSchema[] = [
     field: 'employWay',
     label: '聘用方式',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'employ_type' });
@@ -446,7 +448,7 @@ export const baseFromSchema: FormSchema[] = [
   },
   {
     field: 'departmentIds',
-    label: '所属机构',
+    label: '所属部门',
     component: 'ApiTreeSelect',
     componentProps: {
       api: getDepartmentTree,
@@ -461,6 +463,20 @@ export const baseFromSchema: FormSchema[] = [
     required: true,
     colProps: { span: 24 },
   },
+  {
+    field: 'postIds',
+    label: '所在岗位',
+    component: 'ApiSelect',
+    componentProps: {
+      api: getPostList,
+      mode: 'multiple',
+      labelField: 'name',
+      valueField: 'id',
+      getPopupContainer: () => document.body,
+    },
+    required: true,
+    colProps: { span: 24 },
+  },
 ];
 
 export const contactFormSchema: FormSchema[] = [
@@ -486,7 +502,7 @@ export const contactFormSchema: FormSchema[] = [
     field: 'address',
     label: '现住地址',
     component: 'Input',
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
   {
@@ -526,7 +542,7 @@ export const regularFormSchema: FormSchema[] = [
     field: 'certificateType',
     label: '教师资格证种类',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'certificate_type' });
@@ -538,7 +554,7 @@ export const regularFormSchema: FormSchema[] = [
     field: 'belongOrg',
     label: '所属系统',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'belong_org' });
@@ -550,7 +566,7 @@ export const regularFormSchema: FormSchema[] = [
     field: 'mandarinLevel',
     label: '普通话等级',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'mandarin_level' });
@@ -562,7 +578,7 @@ export const regularFormSchema: FormSchema[] = [
     field: 'startTeachTime',
     label: '从教起始年月',
     component: 'DatePicker',
-    required: true,
+    // required: true,
     componentProps: {
       format: 'YYYY-MM-DD',
     },
@@ -572,7 +588,7 @@ export const regularFormSchema: FormSchema[] = [
     field: 'teachingStatus',
     label: '任课状况',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       mode: 'multiple',
       api: () => {
@@ -629,14 +645,14 @@ export const educationFormSchema: FormSchema[] = [
     field: 'specialty',
     label: '所学专业',
     component: 'Input',
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
   {
     field: 'education',
     label: '最高学历',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'education' });
@@ -648,14 +664,14 @@ export const educationFormSchema: FormSchema[] = [
     field: 'educationCollege',
     label: '最高学历的院校',
     component: 'Input',
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
   {
     field: 'degree',
     label: '最高学位',
     component: 'ApiSelect',
-    required: true,
+    // required: true,
     componentProps: {
       api: () => {
         return getDataOption({ code: 'degree' });
@@ -667,7 +683,7 @@ export const educationFormSchema: FormSchema[] = [
     field: 'degreeCollege',
     label: '最高学位的院校',
     component: 'Input',
-    required: true,
+    // required: true,
     colProps: { span: 7 },
   },
 ];