浏览代码

分班分页

shilipojs 2 年之前
父节点
当前提交
a2a1b525bd

+ 1 - 1
src/api/webApi/elective/dispatch.js

@@ -59,7 +59,7 @@ export function resultDispatch(data) {
 // 锁定分班
 export function lockDispatch(params) {
   return request({
-    url: '/front/elective/classes',
+    url: '/front/elective/classes/',
     method: 'post',
     params
   })

+ 19 - 11
src/views/elective/dispatch/components/class-table.vue

@@ -3,14 +3,8 @@
     <mx-table :propDefines="propDefines" :rows="list" @selection-change="handleSelectionChange">
     </mx-table>
     <!-- 操作 确认和分页-->
-    <div class="tmp">
-
-    <!-- <el-button v-if="list.length > 0 && selected.length > 0" type="primary" @click="confirm">确认选择</el-button>-->
-      <el-pagination
-        layout="prev, pager, next"
-        :total="10">
-      </el-pagination>
-    </div>
+      <pagination class="mt10" :total="pageForm.total" :autoScroll="false" @pagination="onChangePage" :page.sync="pageForm.pageNum"
+                  :limit.sync="pageForm.pageSize"></pagination>
   </div>
 
 </template>
@@ -18,13 +12,23 @@
 export default {
   props: {
     type: {
-      String: '',  //1 用于class-adjust 2 用于完成分班展示
+      String: '',  // 1 用于class-adjust 2 用于完成分班展示
       default: '1'
     },
     list: {
       required: true,
       type: Array,
       default: () => []
+    },
+    pageForm: {
+      type: Object,
+      default: () =>  {
+        return {
+          pageSize: 10,
+          pageNum: 1,
+          total: 0
+        }
+      }
     }
   },
   data() {
@@ -62,12 +66,16 @@ export default {
   computed: {
   },
   methods: {
+    onChangePage(page){
+      this.pageForm.pageSize = page.limit;
+      this.pageForm.pageNum = page.page;
+      this.$emit("update:pageForm",this.pageForm)
+      // this.getBatchList();
+    },
     handleSelectionChange(row) {
       this.selected = row
       this.$emit('confirm',this.selected)
     },
-    confirm() {
-    }
   }
 }
 

+ 4 - 2
src/views/elective/dispatch/components/dispatch-table.vue

@@ -34,6 +34,7 @@
           icon="el-icon-edit"
           size="mini"
           @click="adjust(row)"
+          v-if="!round.dispatchCompleted"
         >调整
         </el-button>
         <el-button
@@ -94,7 +95,8 @@ export default {
         },
         edit: {
           label: '分班编辑',
-          slot: 'edit'
+          slot: 'edit',
+          hidden:this.round.dispatchCompleted
         },
         groupClass: {
           label: '班级名称',
@@ -109,7 +111,7 @@ export default {
         adjust: {
           label: '操作',
           width: 200,
-          slot: 'adjust'
+          slot: 'adjust',
         }
       }
     }

+ 18 - 1
src/views/elective/dispatch/detail.vue

@@ -12,7 +12,7 @@
                     @query="handleGroupQuery" class="mb10"
       ></mx-condition>
     </el-card>
-    <class-table type="2" :list="studentList"></class-table>
+    <class-table :pageForm="pageForm"  type="2" :list="studentList"></class-table>
   </div>
 </template>
 <!--:setting-model="settingModel" :group-model-index="groupModelIndex"-->
@@ -29,10 +29,23 @@ export default {
   mixins: [MxTransferMixin, MxSelectTranslateMixin],
   components: { ClassTable, MxCondition },
   name: 'dispatch-detail',
+  watch: {
+    pageForm:{
+      deep:true,
+      handler() {
+        this.getDispatchResult()
+      }
+    }
+  },
   data() {
     return {
       requireFields: ['localGroupId'],
       studentList: [],
+      pageForm:{
+        pageNum: 1,
+        pageSize: 10,
+        total: 0
+      },
       queryParams: null
     }
   },
@@ -70,16 +83,20 @@ export default {
       this.$router.go(-1)
     },
     handleGroupQuery() {
+       this.pageForm.pageNum = 1
        this.getDispatchResult()
     },
     getDispatchResult() {
       classesResult({
         classId: this.queryParams.dispatchClassId,
         groupId: this.queryParams.localGroupId,
+        pageSize: this.pageForm.pageSize,
+        pageNum: this.pageForm.pageNum,
         roundId: this.queryParams.dispatchRoundId,
         sex: this.queryParams.dispatchGender || null,
       }).then(res => {
         console.log(res)
+        this.pageForm.total = res.total
         this.studentList = res.rows.map(item => {
           item.groupName = this.translateGroup(this.queryParams.localGroupId)
           return item

+ 10 - 2
src/views/elective/dispatch/index.vue

@@ -12,7 +12,7 @@
 </template>
 <script>
 import DispatchTable from "./components/dispatch-table.vue";
-import { getRound,getSettings } from '@/api/webApi/elective/dispatch'
+import { getRound,getSettings,lockDispatch } from '@/api/webApi/elective/dispatch'
 import MxCondition from '@/components/MxCondition/mx-condition'
 
 export default {
@@ -49,7 +49,7 @@ export default {
       this.getRound()
       this.getSettings()
     },
-    lockDispatch() {
+    async lockDispatch() {
       // 班级数累计
       const classCounts = this.round.roundGroups.reduce((prev,cur) => {
         return prev += cur.classCount
@@ -59,6 +59,14 @@ export default {
         this.$message.warning('还有组合未分班')
         return
       }
+      // 分班锁定
+      await this.$confirm(`确定要发布分班?`)
+      lockDispatch({roundId:this.queryParams.roundId}).then(res => {
+         if(res.code == '200'){
+           this.$message.success('成功发布分班')
+           this.handleQuery()
+         }
+      })
 
     },
     // 获取批次的setting