123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <template>
- <div class="fx-row fx-bet-cen">
- <div class="fx-1">
- <el-button v-if="showDMAlgorithm" type="primary" @click="applyAlgorithm">智能匹配</el-button>
- <el-button v-if="showDMAlgorithmResults" type="primary" @click="goDetailPage">查看匹配明细</el-button>
- <el-button v-if="showForceAdjust" type="primary" @click="goDetailPage">查看/调剂</el-button>
- </div>
- <div>
- <el-button v-if="showFastPush" type="primary" @click="flushIntoDM">提前进入{{ nextStepName }}</el-button>
- <el-button v-if="showSend" type="primary" @click="pushGeneration">发送</el-button>
- <el-button v-if="showRankBalance" type="primary" @click="jumpRankBalance">排名均衡</el-button>
- <el-button v-if="showClassDispatch" type="primary" @click="terminateAndJumpDispatch">选科分班</el-button>
- <el-button v-else type="primary" @click="jumpDispatch">选科分班</el-button>
- </div>
- <el-dialog v-if="pushSettingFormVisible" :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>
- <script>
- import {
- applyElectiveDMAlgorithm,
- flushIntoGenerationDM,
- 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'
- import transferMixin from '@/components/mx-transfer-mixin'
- export default {
- mixins: [transferMixin],
- name: 'elective-generation-commands',
- components: { ElectiveGenerationPushSetting },
- inject: ['refreshData'],
- props: ['chartBinding', 'disabled'],
- computed: {
- generation() {
- return this.chartBinding.generation || {}
- },
- status() {
- return this.generation?.status || {}
- },
- // buttons control
- showDMAlgorithm() {
- return this.status.allowDMAlgorithm
- },
- showDMAlgorithmResults() {
- return this.status.doneDMAlgorithm && !this.status.allowForce
- },
- showForceAdjust() {
- return this.status.doneDMAlgorithm && this.status.allowForce
- },
- showFastPush() {
- return this.status.enablePushNextDMGeneration
- },
- nextStepName() {
- const options = this.generation.options
- const next = this.generation.current + 1
- return Object.values(options).find(opt => opt.value == next).title
- },
- showSend() {
- return this.status.doneDMAlgorithm && !this.status.allMatched
- },
- showRankBalance() {
- const options = this.generation.options
- return this.status.allMatched && this.generation.current < options.rankBalance.value
- },
- showClassDispatch() {
- const options = this.generation.options
- return this.status.allMatched && this.generation.current <= options.rankBalance.value
- }
- },
- data() {
- return {
- pushSettingFormVisible: false
- }
- },
- methods: {
- notifyRootRefresh() {
- this.refreshData()
- },
- applyAlgorithm() {
- // 暂时只支持一种算法,不排队以后会支持多种
- const algorithm = config.electiveDMAlgorithm.rankFirst.value
- applyElectiveDMAlgorithm(algorithm).finally(() => {
- this.notifyRootRefresh()
- })
- },
- goDetailPage() {
- // 默认跳第1个可查询项 // 外抛让table子组件处理
- this.$emit('jumpDetail')
- },
- flushIntoDM() {
- flushIntoGenerationDM().finally(() => {
- this.notifyRootRefresh()
- })
- },
- 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
- pushGenerationSetting(setting).finally(() => {
- this.notifyRootRefresh()
- })
- },
- jumpRankBalance() {
- jumpGenerationRankBalance().finally(() => {
- this.notifyRootRefresh()
- })
- },
- terminateAndJumpDispatch() {
- terminateGeneration().then(res => {
- // this.refreshData()
- this.jumpDispatch()
- }).catch(_ => this.notifyRootRefresh())
- },
- jumpDispatch() {
- const path = '/evaluating/master-manage/permission/elective/dispatch/index'
- this.transferTo(path)
- }
- }
- }
- </script>
- <style scoped>
- </style>
|