소스 검색

Merge branch 'master' of http://121.4.203.192:9000/mingxue/front

shilipojs 3 년 전
부모
커밋
2c35c96187

+ 9 - 1
doc/Mind/ElectiveGeneration.cs

@@ -222,7 +222,7 @@ namespace mxdemo.Mind
             // 展示字段
             int groupId; // 组合ID,没有组合为0比如未参与报名人数(实际只有两种统计数据,针对某个组合的统计和不针对组合的统计)
             int value; // 数值
-            string color; // 支持'R','G','B','',或者'#FA1234'等hexString
+            string color; // 常用值:'R,G,B,P,Y'(不分大小写,也可以hexString),R:红,G:绿,B:蓝,P:主题绿,Y:橙
             bool bold; // 加粗,重点展示
             bool star; // 带*,重点展示
 
@@ -396,6 +396,14 @@ namespace mxdemo.Mind
             // 5.5 hht 如果允许强制调剂,禁止调剂到哪个组合?一般禁止调剂到被录取组合,因为原地不动不叫调剂。没有禁止的给0或者null
             public int disableForceGroupId;
 
+            // 5.12 hht 增加颜色控制,常用值:'R,G,B,P,Y'(不分大小写,也可以hexString),R:红,G:绿,B:蓝,P:主题绿,Y:橙
+            // 颜色逻辑:currentGeneration>1
+            //          ?录取
+            //            ?当前查询组合录取?'G':'Y'
+            //            :'R'
+            //          :''
+            public string color;
+
             public long id { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
             public string category { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
             public EnumElectiveGeneration generation { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }

+ 2 - 0
src/common/mx-config.js

@@ -5,6 +5,8 @@ export default {
     primary_up: '#51C9A7',
     primary_down: '#D2F1E8',
     primary_report: '#2EC7C9',
+    success: '#13ce66',
+    warning: '#ffba00',
     yellow_up: '#F5AB86',
     yellow_down: '#FDEAE1',
     yellow_report: '#FFA400',

+ 13 - 2
src/layout/components/AppMain.vue

@@ -1,7 +1,7 @@
 <template>
   <section class="app-main">
     <transition name="fade-transform" mode="out-in">
-      <keep-alive :include="cachedViews">
+      <keep-alive :max="maxCacheCount">
         <router-view :key="key"/>
       </keep-alive>
     </transition>
@@ -11,12 +11,23 @@
 <script>
 export default {
   name: 'AppMain',
+  data() {
+    return {
+      maxCacheCount: 5 // 最多缓存尺寸 // 5.11 hht 加个尺寸控制,防止key值缓存过多
+    }
+  },
   computed: {
     cachedViews() {
       return this.$store.state.tagsView.cachedViews
     },
     key() {
-      return this.$route.path
+      // TODO: 5.11 hht keep-alive的include/exclude结合router-view好像不能正常工作, 目前没有弄清原因
+      // NOTE: 先通过key的途径解决缓存刷新的问题
+      const meta = this.$route.meta
+      const useCache = meta && meta.hasOwnProperty('noCache') && meta.noCache === false
+      const fullPath = this.$route.fullPath
+      const cacheControlArgs = useCache ? '' : ('_' + new Date().getTime())
+      return fullPath + cacheControlArgs
     }
   }
 }

+ 27 - 10
src/views/elective/generation/components/elective-generation-table.vue

@@ -1,16 +1,15 @@
 <template>
   <mx-table ref="table" :prop-defines="resolvedTable.columns" :rows="resolvedTable.rows" border>
     <template #elective-cell="{value, label, prop}">
-      <el-popover trigger="hover" :disabled="(value&&value.disabled)||!!!prop.queryCode"
-                  popper-class="zero-padding-popover">
-        <div class="fx-column">
-          <el-button plain type="text" @click="goDetails(value, label)">查看名单</el-button>
+      <el-tooltip :disabled="(value&&value.disabled)||!!!prop.queryCode" effect="light">
+        <div slot="content">
+          查看名单
         </div>
-        <div slot="reference" v-if="value" :style="getCellStyles(value)">
+        <div v-if="value" class="pointer" :style="getCellStyles(value)" @click="goDetails(value, label, $event)">
           <span v-if="value.star">*</span>
           <span>{{ value && value.value }}</span>
         </div>
-      </el-popover>
+      </el-tooltip>
     </template>
   </mx-table>
 </template>
@@ -135,16 +134,34 @@ export default {
         const map = {
           R: config.color.error,
           r: config.color.error,
-          G: config.color.yellow_up,
-          g: config.color.yellow_up,
+          G: config.color.success,
+          g: config.color.success,
           B: config.color.blue_up,
-          b: config.color.blue_up
+          b: config.color.blue_up,
+          p: config.color.primary,
+          P: config.color.primary,
+          y: config.color.yellow_report,
+          Y: config.color.yellow_report
         }
         styles.color = map[option.color] || option.color
       }
       return styles
     },
-    goDetails(option) {
+    goDetails(option, label, e) {
+      // try close accessor el-popover
+      // const $btn = e?.currentTarget?.__vue__
+      // if ($btn) {
+      //   let parent = $btn.$parent
+      //   while (parent) {
+      //     if (parent.$options.name === 'ElPopover') {
+      //       parent.doClose()
+      //       break
+      //     }
+      //     parent = parent.$parent
+      //   }
+      // }
+
+      // jump logic
       const path = '/elective/generation/detail'
       const nextData = {
         year: this.chartBinding.generation.status.year,

+ 1 - 1
src/views/elective/generation/index.vue

@@ -28,7 +28,7 @@ import MxGroupTranslateMixin from '@/components/Cache/modules/mx-select-translat
 
 export default {
   mixins: [MxGroupTranslateMixin],
-  name: 'generation-index',
+  name: 'ElectiveGenerationIndex',
   components: { ElectiveGenerationMaster, ElectiveGenerationSteps, MxCondition },
   data() {
     return {

+ 25 - 14
src/views/permission/components/steps/round-setting-group.vue

@@ -41,19 +41,22 @@
     <!--  师资填写  -->
     <div class="mt20 mb5">
       <el-button-group>
-        <el-button :type="enableFacultyForm?'primary':''" size="small" @click="openFacultyForm">AI师资匹配</el-button>
-        <el-button v-if="enableFacultyForm||enableFacultyResult" size="small" :plain="!groupModel.completed"
+        <el-button v-if="groupsValid" :type="enableFacultyForm?'primary':''" size="small"
+                   @click="openFacultyForm">AI师资匹配
+        </el-button>
+        <el-button v-if="groupsValid&&(enableFacultyForm||enableFacultyResult)" size="small"
+                   :plain="!groupModel.completed"
                    :type="groupModel.completed?enableFacultyResult?'primary':'':'warning'"
                    @click="calculateFacultyResult">
           {{ groupModel.completed ? '' : '生成' }}师资匹配结果
         </el-button>
       </el-button-group>
     </div>
-    <faculty-forms ref="formFaculty" v-if="enableFacultyForm" :rows="groupModel.faculties"
+    <faculty-forms ref="formFaculty" v-if="groupsValid&&enableFacultyForm" :rows="groupModel.faculties"
                    @change="resetCalculateStatus"></faculty-forms>
 
     <!--  师资结果  -->
-    <faculty-result v-if="enableFacultyResult" :rows="groupModel.faculties"></faculty-result>
+    <faculty-result v-if="groupsValid&&enableFacultyResult" :rows="groupModel.faculties"></faculty-result>
 
     <!--  操作  -->
     <div class="fx-row mt20">
@@ -96,9 +99,10 @@ import FacultyForms from '@/views/permission/components/steps/fauclty/faculty-fo
 import RoundModelConvert from '../round-model-convert'
 import { calculateFaculties, generateFaculties } from '@/api/webApi/selection'
 import FacultyResult from '@/views/permission/components/steps/fauclty/faculty-result'
-import GroupQueryDialog from'../group-query-dialog'
+import GroupQueryDialog from '../group-query-dialog'
+
 export default {
-  components: { FacultyResult, FacultyForms, RoundScoreQuery,ChooseSubjectDialog,GroupQueryDialog },
+  components: { FacultyResult, FacultyForms, RoundScoreQuery, ChooseSubjectDialog, GroupQueryDialog },
   mixins: [selectTranslateMixin, RoundModelConvert],
   name: 'round-setting-group',
   props: {
@@ -157,6 +161,9 @@ export default {
     }
   },
   computed: {
+    groupsValid() {
+      return !!this.groupModel.groupIds.length
+    },
     roundGroups() {
       // 按选项显示顺序排序
       if (!this.groupModel?.groupIds?.length) return []
@@ -254,9 +261,15 @@ export default {
     resetCalculateStatus() {
       this.groupModel.completed = false
       const clearFields = ['levelClassCount', 'qualifiedClassCount', 'requiredClassesCount', 'actualClassesCount', 'missingClassesCount', 'missingTeacherCount']
-      this.groupModel.faculties?.forEach(faculty => {
-        clearFields.forEach(field => faculty[field] = 0)
-      })
+      if (!this.groupsValid) {
+        this.enableFacultyForm = false
+        this.enableFacultyResult = false
+        this.groupModel.faculties = []
+      } else {
+        this.groupModel.faculties?.forEach(faculty => {
+          clearFields.forEach(field => faculty[field] = 0)
+        })
+      }
       if (this.enableFacultyForm || this.enableFacultyResult) {
         this.enableFacultyForm = true
         this.enableFacultyResult = !this.enableFacultyForm
@@ -280,18 +293,16 @@ export default {
         this.scoreQueryGroupId = row.groupId
         this.scoreQueryVisible = true
       }
-      console.log(row,key)
-      if(key == 'dataQuery') {
+      if (key == 'dataQuery') {
         const year = this.settingModel.year
         this.$refs.groupQueryDialog.open(year)
       }
-      if(key == 'majorQuery') {
+      if (key == 'majorQuery') {
         // 打开选科弹窗
         const course0 = this.translateCourse0(row.groupId)
         const course1 = this.translateCourse1(row.groupId)
-        console.log(year)
         const year = this.settingModel.year
-        this.$refs.chooseDialog.open(course0, course1,year)
+        this.$refs.chooseDialog.open(course0, course1, year)
       }
     }
   }

+ 3 - 1
src/views/permission/components/steps/round-setting-score.vue

@@ -40,7 +40,9 @@ export default {
     },
     shouldGoNext() {
       if (!this.settingModel.importWeight?.length) {
-        return this.$confirm('您没有导入选科成绩,后续系统将无法使用成绩来做AI选科决策,确认继续?!')
+        const error = '请先导入选科成绩,否则系统将无法进行AI选科决策'
+        this.$alert(error, '错误提示', { type: 'error' })
+        return Promise.reject(error)
       }
       return Promise.resolve(this.settingModel)
     }

+ 7 - 10
src/views/permission/components/steps/round-setting-weight.vue

@@ -45,16 +45,13 @@ export default {
   },
   methods: {
     shouldGoNext() {
-      return new Promise((resolve, reject) => {
-        const sumWeight = this.settingModel.importWeight.sum(s => s.weight)
-        if (sumWeight != 1) {
-          const error = '全部成绩的权重和必须为1'
-          this.$alert(error)
-          reject(error)
-          return
-        }
-        resolve(this.settingModel)
-      })
+      const sumWeight = this.settingModel.importWeight.sum(s => s.weight)
+      if (sumWeight != 1) {
+        const error = '全部成绩的权重和必须为1'
+        this.$alert(error, '错误提示', { type: 'error' })
+        return Promise.reject(error)
+      }
+      return Promise.resolve(this.settingModel)
     },
     handleDelete(row) {
       this.$confirm(`确定删除[${row.scoreName}]`).then(_ => {