Browse Source

generation - push setting ok

hare8999@163.com 3 years ago
parent
commit
9ff68ebcf1

+ 3 - 1
doc/Mind/ElectiveGeneration.cs

@@ -112,6 +112,8 @@ namespace mxdemo.Mind
         DateTime end;
         bool onlyRecommand; // 仅允许学生选择推荐组合, 否则允许学生填报有空缺的组合
         bool onlyAgree; // 调剂阶段,只允许学生选择同意, 否则允许学生拒绝
+        bool useRecommandWhileDisagree; // 如果拒绝,按推荐报名处理
+        bool useRecommandWhileNonaction; // 如果不报名,按推荐报名处理
     }
 
     public class ElectiveEsign
@@ -496,7 +498,7 @@ namespace mxdemo.Mind
         /// <summary>
         /// 决策完毕时,推进下一代进行
         /// </summary>
-        /// <param name="setting"></param>
+        /// <param name="setting">推进配置</param>
         void pushGenerationSetting(FlowPushSetting setting);
 
         /// <summary>

+ 3 - 3
mock/modules/elective-generation.js

@@ -1,7 +1,7 @@
 const Mock = require('mockjs')
 const Random = Mock['Random']
 
-const mockGeneration = 8 // primary
+const mockGeneration = 2 // primary
 const mockGroups = [1, 2, 3, 4, 5, 6]
 const mockPreferenceCount = 3 // 1 or 3 // 1志愿/3志愿
 
@@ -32,9 +32,9 @@ module.exports = [
 
           // +
           disenrollCount: Random.integer(20, 100), // 未录人数
-          enablePushNextDMGeneration: Random.boolean(1, 10, 8),
+          enablePushNextDMGeneration: true,
           allowDMAlgorithm: true,
-          doneDMAlgorithm: Random.boolean(1, 10, 8),
+          doneDMAlgorithm: true,
           allowForce: Random.boolean(1, 10, 8)
         }
       }

+ 22 - 1
src/views/elective/generation/components/elective-generation-commands.vue

@@ -11,6 +11,13 @@
       <el-button v-if="showRankBalance" type="primary" @click="jumpRankBalance">排名均衡</el-button>
       <el-button v-if="showClassDispatch" type="primary" @click="jumpTerminate">选科分班</el-button>
     </div>
+    <el-dialog :visible.sync="pushSettingFormVisible" :title="nextStepName+'设置'" width="350">
+      <elective-generation-push-setting ref="settingForm"/>
+      <div class="fx-row fx-end-cen mt15">
+        <el-button @click="pushSettingFormVisible=false">取消</el-button>
+        <el-button type="primary" @click="commitPushSetting">确认</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -18,13 +25,15 @@
 import {
   applyElectiveDMAlgorithm,
   flushIntoGenerationDM,
-  jumpGenerationRankBalance,
+  jumpGenerationRankBalance, pushGenerationSetting,
   terminateGeneration
 } from '@/api/webApi/elective/generation'
 import config from '@/common/mx-config'
+import ElectiveGenerationPushSetting from '@/views/elective/generation/components/elective-generation-push-setting'
 
 export default {
   name: 'elective-generation-commands',
+  components: { ElectiveGenerationPushSetting },
   inject: ['refreshData'],
   props: ['chartBinding', 'disabled'],
   computed: {
@@ -64,6 +73,11 @@ export default {
       return this.status.allMatched && this.generation.current <= options.rankBalance.value
     }
   },
+  data() {
+    return {
+      pushSettingFormVisible: false
+    }
+  },
   methods: {
     applyAlgorithm() {
       // 暂时只支持一种算法,不排队以后会支持多种
@@ -83,6 +97,13 @@ export default {
     pushGeneration() {
       // show dialog form for push settings
       // then call push api
+      this.pushSettingFormVisible = true
+    },
+    async commitPushSetting() {
+      const setting = await this.$refs.settingForm.validate()
+      setting.roundId = this.status.roundId
+      const res = await pushGenerationSetting(setting)
+      this.refreshData()
     },
     jumpRankBalance() {
       jumpGenerationRankBalance().then(res => {

+ 69 - 0
src/views/elective/generation/components/elective-generation-push-setting.vue

@@ -0,0 +1,69 @@
+<template>
+  <el-form ref="form" :model="model" :rules="rules" label-width="80px" label-position="right">
+    <el-form-item prop="dateRange" label="时间">
+      <mx-date-range-picker v-model="model.dateRange" emit-all-changes></mx-date-range-picker>
+    </el-form-item>
+    <div class="fx-row fx-wrap">
+      <el-form-item prop="onlyRecommand" class="form-item-readonly">
+        <el-checkbox v-model="model.onlyRecommand">仅允许学生选择推荐组合</el-checkbox>
+      </el-form-item>
+      <el-form-item prop="onlyAgree" class="form-item-readonly">
+        <el-checkbox v-model="model.onlyAgree">只允许学生选择同意</el-checkbox>
+      </el-form-item>
+    </div>
+    <div class="fx-row fx-wrap">
+      <el-form-item prop="useRecommandWhileDisagree" class="form-item-readonly">
+        <el-checkbox v-model="model.useRecommandWhileDisagree">如果拒绝,按推荐报名处理</el-checkbox>
+      </el-form-item>
+      <el-form-item prop="useRecommandWhileNonaction" class="form-item-readonly">
+        <el-checkbox v-model="model.useRecommandWhileNonaction">如果不报名,按推荐报名处理</el-checkbox>
+      </el-form-item>
+    </div>
+  </el-form>
+</template>
+
+<script>
+import { getDefaultSelectRange } from '@/utils'
+
+export default {
+  name: 'elective-generation-push-setting',
+  data() {
+    return {
+      model: {
+        dateRange: getDefaultSelectRange(7),
+        onlyRecommand: false, // 仅允许学生选择推荐组合, 否则允许学生填报有空缺的组合
+        onlyAgree: false, // 调剂阶段,只允许学生选择同意, 否则允许学生拒绝
+        useRecommandWhileDisagree: false, // 如果拒绝,按推荐报名处理
+        useRecommandWhileNonaction: false // 如果不报名,按推荐报名处理
+      },
+      rules: {
+        dateRange: [{
+          message: '时间必填',
+          validator: function(r, v, cb) {
+            if (v.length === 2 && v.first() && v.last()) {
+              cb()
+              return
+            }
+            cb(r.message)
+          }
+        }]
+      }
+    }
+  },
+  methods: {
+    async validate() {
+      const res = await this.$refs.form.validate()
+      // to standard model
+      const commit = { ...this.model }
+      commit.begin = commit.dateRange.first()
+      commit.end = commit.dateRange.last()
+      delete commit.dateRange
+      return Promise.resolve(commit)
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 0 - 21
src/views/permission/components/round-settings.vue

@@ -88,27 +88,6 @@ export default {
       },
       // modify
       settingModel: {},
-      settingRules: {
-        year: [{
-          required: true,
-          message: '学年必填'
-        }],
-        name: [{
-          required: true,
-          message: '名称必填'
-        }],
-        dateRange: [{
-          required: true,
-          message: '时间必填',
-          validator: function(r, v, cb) {
-            if (v.length === 2 && v.first() && v.last()) {
-              cb()
-              return
-            }
-            cb(r.message)
-          }
-        }]
-      },
       settingDialogVisible: false
     }
   },

+ 0 - 1
src/views/permission/components/steps/round-setting-publish.vue

@@ -85,7 +85,6 @@ export default {
           message: '模型必选'
         }],
         dateRange: [{
-          required: true,
           message: '时间必填',
           validator: function(r, v, cb) {
             if (v.length === 2 && v.first() && v.last()) {