فهرست منبع

调整选科分班ui问题,修复选科报名bug

shilipojs 3 سال پیش
والد
کامیت
dad3217002

+ 17 - 10
src/views/elective/dispatch/components/choose-class.vue

@@ -72,7 +72,8 @@ export default {
       if (!this.year) return []
       // 获取该年份下的年级
       const classTree = this.classTree[this.classTree.findIndex(i => i.year = this.year)]
-      this.form.gradeId = classTree.gradeId
+      console.log(classTree.gradeId)
+      this.form.gradeId = classTree.grade
       this.form.year = classTree.year
       return this.classTree[this.classTree.findIndex(i => i.year = this.year)].classList.map(item => {
         item['disabled'] = this.settingContainer.some(c => c.classId == item.classId && c.groupId !== this.roundGroup.groupId)
@@ -81,9 +82,6 @@ export default {
     }
   },
   methods: {
-    close() {
-      this.handleInputConfirm()
-    },
     validate() {
       //
       if (this.tmpClassIds.length !== this.roundGroup.classCount) return false
@@ -132,12 +130,21 @@ export default {
       })
     },
     addClass() {
-      busiClass.add(this.form).then(res => {
-        this.form.name = ''
-        this.msgSuccess('保存成功')
-        // this.getClassTreeByCache(false)
-        this.refreshClassTree()
-      }).finally()
+      this.$confirm(`是否要创建名称为${this.form.name}的班级`, {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        busiClass.add(this.form).then(res => {
+          this.form.name = ''
+          this.msgSuccess('保存成功')
+          // this.getClassTreeByCache(false)
+          this.refreshClassTree()
+        }).finally()
+      }).catch(() => {
+        this.$message.warning('已取消创建')
+      });
+      console.log(this.form)
     },
     refreshClassTree() {
       this.$store.dispatch('GetInfo') // 借机清除了用户缓存 // clear cache

+ 16 - 16
src/views/elective/dispatch/components/dispatch-table.vue

@@ -2,7 +2,7 @@
   <el-row>
     <mx-table  :propDefines="propDefines" :rows="displayRows">
       <template #classCount="{row,$index}">
-        <el-input-number size="small" v-model="row.classCount" @change="classCountChange(row,$index)" :min="0"
+        <el-input-number size="mini" v-model="row.classCount" @change="classCountChange(row,$index)" :min="0"
                          :disabled="row.classCount != 0" label="label"
         ></el-input-number>
       </template>
@@ -35,8 +35,6 @@
           @click="adjust(row)"
         >调整
         </el-button>
-      </template>
-      <template #detail="{row}">
         <el-button
           type="success"
           plain
@@ -93,7 +91,8 @@ export default {
         },
         classCount: {
           label: '班级数',
-          slot: 'classCount'
+          slot: 'classCount',
+          width: 150
         },
         edit: {
           label: '分班编辑',
@@ -106,17 +105,14 @@ export default {
         expectedCount: {
           label: '人数'
         },
+        proportion: {
+          label: '男女比例',
+        },
         adjust: {
           label: '操作',
+          width: 200,
           slot: 'adjust'
         },
-        proportion: {
-          label: '男女比例',
-        },
-        detail: {
-          label: '详情',
-          slot: 'detail'
-        }
       }
     }
   },
@@ -146,9 +142,7 @@ export default {
       return rows
     }
   },
-  created() {
-
-  },
+  inject: ['parentQuery'],
   methods: {
     openEditDialog(row) {
       if (!row.classCount) {
@@ -168,10 +162,16 @@ export default {
       this.$refs.adjustDialog.open(row,this.settings.filter(item => item.groupId == row.groupId))
     },
     toDetail(row,classId ='') {
+      const filterSettings = this.settings.filter(item => item.groupId == row.groupId)
+      if(filterSettings.length == 0){
+        this.$message.warning('该组合还未设定班级')
+        return
+      }
       console.log(classId)
-      const params = {group: row,classId:classId,groupIds: (this.round.groupIds &&this.round.groupIds.split(','))||[]}
+      const params = {group: row,classId:classId,groupIds: (this.round.groupIds &&this.round.groupIds.split(','))||[],
+      parentQuery: this.parentQuery
+      }
       const path = '/elective/dispatch/detail'
-      console.log('prev transfer', row, this.round)
       this.transferTo(path, params)
     },
     editCount(row) {

+ 7 - 1
src/views/elective/dispatch/components/edit-group.vue

@@ -20,7 +20,7 @@
       </div>
     </div>
     <span slot="footer" class="dialog-footer">
-      <el-button @click="show = false">取 消</el-button>
+      <el-button @click="hidden">取 消</el-button>
       <el-button type="primary" @click="save()" :disabled="active != 1">确 定</el-button>
     </span>
   </el-dialog>
@@ -50,6 +50,12 @@ export default {
     }
   },
   methods: {
+    hidden() {
+      this.show = false
+      if(this.active == 0) {
+        this.$refs.editClassDialog.handleInputConfirm()
+      }
+    },
     open(roundGroup, settingContainer) {
       this.active = 0
       this.show = true

+ 17 - 0
src/views/elective/dispatch/detail.vue

@@ -1,6 +1,12 @@
 <template>
   <!-- 分班完成的详情 -->
   <div class="app-container">
+    <evaluation-title
+      navBackButton
+      :title="`${title}(分班完成名单)`"
+      :navAction="closeDetail"
+    ></evaluation-title>
+
     <el-card class="box-card" style="margin-bottom: 10px;">
       <mx-condition :query-params="queryParams" :require-fields="requireFields" :local-data="groupSource"
                     @query="handleGroupQuery" class="mb10"
@@ -17,6 +23,7 @@ import MxCondition from '@/components/MxCondition/mx-condition'
 import MxTransferMixin from '@/components/mx-transfer-mixin.js'
 import ClassTable from '@/views/elective/dispatch/components/class-table'
 import { classesResult } from '@/api/webApi/elective/dispatch'
+import { mapGetters } from 'vuex'
 
 export default {
   mixins: [MxTransferMixin, MxSelectTranslateMixin],
@@ -30,6 +37,7 @@ export default {
     }
   },
   computed: {
+    ...mapGetters(['school']),
     groupSource() {
       if (!this.listGroupsOptions.length) return {}
       if (!this.prevData.groupIds?.length) return {}
@@ -49,9 +57,18 @@ export default {
         dispatchRoundId: this.prevData.group.roundId
       })
       return source
+    },
+    title() {
+      const school = this.school.schoolName
+      // const round = this.prevData.parentQuery.round  暂时只能取到Id
+      const year = this.prevData.parentQuery.year + '届'
+      return `${school}${year}选科分班`
     }
   },
   methods: {
+    closeDetail()  {
+      this.$router.go(-1)
+    },
     handleGroupQuery() {
        this.getDispatchResult()
     },

+ 15 - 1
src/views/elective/dispatch/index.vue

@@ -5,6 +5,7 @@
                     @invalid="handleInvalidQuery"
       ></mx-condition>
     </el-card>
+    <p class="text-right mb10"><el-button @click="lockDispatch" type="primary">发布分班</el-button></p>
     <dispatch-table :loading="loading" :round="round" :settings="settings"></dispatch-table>
   </div>
 </template>
@@ -32,7 +33,8 @@ export default {
   },
   provide() {
     return {
-      refreshData: this.handleQuery
+      refreshData: this.handleQuery,
+      parentQuery: this.queryParams
     }
   },
   methods: {
@@ -40,6 +42,18 @@ export default {
       this.getRound()
       this.getSettings()
     },
+    lockDispatch() {
+      // 班级数累计
+      const classCounts = this.round.roundGroups.reduce((prev,cur) => {
+        return prev += cur.classCount
+      },0)
+      console.log(classCounts)
+      if(classCounts > this.settings.length){
+        this.$message.warning('还有组合未分班')
+        return
+      }
+
+    },
     // 获取批次的setting
     getSettings() {
       getSettings({

+ 1 - 0
src/views/idc/EvaluationDatabase/detailList.bak.vue

@@ -259,6 +259,7 @@ export default {
   data() {
     return {
       loading: false,
+
       evaluation: {},
       queryParams: {
         evaluationClassId: "",

+ 6 - 0
src/views/system/user/profile/components/report-table.vue

@@ -39,6 +39,7 @@
     <p>您的选科志愿: <span v-for="(item,index) in selectedList" >{{item.groupName}}{{index+1 < selectedList.length ? '、' : '' }}</span></p>
     <!-- 拖拽 -->
     <test-drage ref="drage" :sortList="selectedList"></test-drage>
+    <el-button @click="commit" type="primary">提交</el-button>
   </el-card>
 </template>
 <script>
@@ -111,6 +112,7 @@ export default {
       if (!this.optionalMajors.length) return []
       // 格式化
       return this.list.map(item => {
+        item.allowSelect = item.allowSelect ? '报名中' : '无法报名'
         item.subjects = this.optionalMajors.filter(college => {
           if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
         }).map(item => item.majorCategoryName)
@@ -128,6 +130,10 @@ export default {
 
   },
   methods: {
+    commit() {
+      console.log(this.selectedList)
+      this.selectedList.map(item=> {console.log(item.groupName)})
+    },
     toSelect(row) {
       const count = this.list.reduce((prev,cur) => {
         return prev += cur.selected ? 1 : 0

+ 23 - 14
src/views/system/user/profile/components/test-drage.vue

@@ -5,16 +5,16 @@
                     tag="ul"
   >
     <li
-      @dragenter="dragenter($event, index)"
-      @dragover="dragover($event, index)"
-      @dragstart="dragstart(index)"
-      draggable
       v-for="(item, index) in sortList"
       :key="item.groupId"
-      class="list-item"
     >
-      <span>{{`第${index + 1}志愿`}}</span>
-      {{ item.groupName }}
+      <span>{{`第${index + 1}志愿:`}}</span>
+      <span @dragenter="dragenter($event, index)"
+            @dragover="dragover($event, index)"
+            @dragstart="dragstart(index)"
+            class="list-item"
+            draggable>{{ item.groupName }}</span>
+      <el-tag style="cursor: pointer" @click="del(index)" type="danger">删除</el-tag>
     </li>
   </transition-group>
 </template>
@@ -47,7 +47,6 @@ export default {
         const source = this.sortList[this.dragIndex]
         this.sortList.splice(this.dragIndex, 1)
         this.sortList.splice(index, 0, source)
-        console.log(this.sortList)
         // 排序变化后目标对象的索引变成源对象的索引
         this.dragIndex = index
       }
@@ -55,6 +54,10 @@ export default {
     shuffle() {
       this.sortList = this.$shuffle(this.sortList)
     },
+    del(index) {
+      this.sortList[index].selected = false
+      this.sortList.splice(index,1)
+    },
     dragover(e, index) {
       e.preventDefault()
     }
@@ -63,21 +66,27 @@ export default {
 </script>
 <style lang="scss" scoped>
 .list {
+  padding-left: 0;
   list-style: none;
 
   .drag-move {
     transition: transform .3s;
   }
-
+  li{
+    font-size: 14px;
+    margin-bottom: 6px;
+  }
   .list-item {
     cursor: move;
-    width: 300px;
-    background: #EA6E59;
+    display:inline-block ;
+    margin: 0 10px;
+    width: 160px;
+    background: #42b983;
     border-radius: 4px;
+    font-size: 14px;
     color: #FFF;
-    margin-bottom: 6px;
-    height: 50px;
-    line-height: 50px;
+    height: 30px;
+    line-height: 30px;
     text-align: center;
   }
 }