Просмотр исходного кода

学生注册:所在班级改为非必填

Xiao_123 1 месяц назад
Родитель
Сommit
5b0e3c7fc2

+ 2 - 2
src/plugins/dialogExtend/components/studentInfoForm.vue

@@ -154,14 +154,13 @@ const items = ref({
       type: 'combobox',
       key: 'schoolClassId',
       value: null,
-      label: '所在班级 *',
+      label: '所在班级',
       outlined: true,
       clearable: true,
       canBeInputted: true,
       itemTextName: 'schoolClassName',
       itemText: 'name',
       itemValue: 'id',
-      rules: [v => !!v || '请选择所在班级'],
       items: []
     },
     {
@@ -306,6 +305,7 @@ const getQuery = async () => {
   items.value.options.forEach(e => {
     if (Object.prototype.hasOwnProperty.call(e, 'data')) return obj[e.key] = e.data
     if (e.key === 'schoolClassId') {
+      if (!e.value) return obj[e.key] = null
       const classObj = e.items.find(k => k[e.itemValue] === e.value)
       if (!classObj) {
         obj[e.key] = null

+ 2 - 2
src/views/recruit/personal/PersonalCenter/student/information/index.vue

@@ -73,14 +73,13 @@ const items = ref({
       type: 'combobox',
       key: 'schoolClassId',
       value: null,
-      label: '所在班级 *',
+      label: '所在班级',
       outlined: true,
       clearable: true,
       canBeInputted: true,
       itemTextName: 'schoolClassName',
       itemText: 'name',
       itemValue: 'id',
-      rules: [v => !!v || '请选择所在班级'],
       items: []
     },
     {
@@ -184,6 +183,7 @@ const handleSubmit = async () => {
   items.value.options.forEach(item => {
     // 班级有下拉选择的,需要根据选择的值赋值
     if (item.key === 'schoolClassId') {
+      if (!item.value) return params[item.key] = null
       const classObj = item.items.find(e => e[item.itemValue] === item.value)
       if (!classObj) {
         params[item.key] = null