Ver Fonte

elective - student global search

hare8999@163.com há 2 anos atrás
pai
commit
11c6806b12

+ 3 - 2
doc/Mind/ElectiveGeneration.cs

@@ -360,6 +360,7 @@ namespace mxdemo.Mind
             int groupId { get; set; }
             string groupName { get; set; }
             string datetime { get; set; }
+            string userName { get; set; }
         }
 
         public class ElectiveGenerationRankDescriptor
@@ -441,7 +442,7 @@ namespace mxdemo.Mind
         /// </summary>
         public class ElectiveGenerationOptionalMajor
         {
-            ElectiveOptionalMajor[] majors; // 自选专业列表
+            ElectiveOptionalMajor[] marjors; // 自选专业列表
 
             int bestMatchedGroupId; // 最佳匹配
         }
@@ -553,7 +554,7 @@ namespace mxdemo.Mind
         /// 重用getElectiveGenerationDetails, query=active=current
         /// <param name="keywords">姓名/学号/账号</param>
         /// </summary>
-        ElectiveGenerationDetailWrapper[] searchElectiveGenerationDetails(int pageNum, int pageSize, int roundId, string keywords);
+        ElectiveGenerationDetail[] searchElectiveGenerationDetails(int pageNum, int pageSize, int roundId, string keywords);
         #endregion
     }
 }

+ 10 - 0
src/api/webApi/elective/generation.js

@@ -113,3 +113,13 @@ export function resetMockGeneration() {
     method: 'get'
   })
 }
+
+// front/elective/generation/searchElectiveGenerationDetails
+// 重用getElectiveGenerationDetails, query=active=current
+export function searchElectiveGenerationDetails(params) {
+  return request({
+    url: '/front/elective/generation/searchElectiveGenerationDetails',
+    method: 'get',
+    params
+  })
+}

+ 94 - 0
src/views/elective/generation/components/elective-generation-command-search.vue

@@ -0,0 +1,94 @@
+<template>
+  <div class="fx-row">
+    <el-button v-show="!inputVisible" class="el-icon-search" circle @click="inputVisible=!inputVisible"></el-button>
+    <transition>
+      <el-popover ref="pop" trigger="manual" :class="{'zero-padding-popover':details.length>0}">
+        <i v-if="searching" class="el-icon-loading"></i>
+        <span v-else-if="details.length">暂无结果</span>
+        <template v-else>
+          <el-button plain type="text" v-for="stu in details" @click="handleStudentClick(stu)">
+            {{ stu.studentName }}({{ stu.className }}) {{ stu.userName }}
+          </el-button>
+        </template>
+        <el-input slot="reference" v-show="inputVisible" v-model="keywords" placeholder="姓名/学号/账号"
+                  @blur="handleInputBlur" clearable>
+          <el-button :disabled="searching" slot="prepend" class="el-icon-caret-left" circle
+                     @click="inputVisible=false"></el-button>
+          <el-button :disabled="searching" slot="append" class="el-icon-search" circle
+                     @click="handleSearch"></el-button>
+        </el-input>
+      </el-popover>
+    </transition>
+    <el-dialog title="选科流程明细" v-if="logVisible" :visible.sync="logVisible" :width="logDialogWidth">
+      <elective-generation-flow-log :groups="generation.roundGroups" :histories="logDetail.histories"
+                                    :matched-majors="logMajors"/>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getGenerationOptionalMajorsBatch, searchElectiveGenerationDetails } from '@/api/webApi/elective/generation'
+import ElectiveGenerationFlowLog from '@/views/elective/generation/components/elective-generation-flow-log'
+
+export default {
+  name: 'elective-generation-command-search',
+  components: { ElectiveGenerationFlowLog },
+  props: ['generation'],
+  data() {
+    return {
+      inputVisible: false,
+      keywords: '',
+      searching: false,
+      details: [],
+      logVisible: false,
+      logDetail: null,
+      logMajors: null
+    }
+  },
+  computed: {
+    logDialogWidth() {
+      const expectedWidth = (this.generation.roundGroups.length + 3) * 160 // 假定elective-generation-flow-log 单格宽160
+      const finalWidth = Math.min(expectedWidth, window.innerWidth * 0.8)
+      return finalWidth + 'px'
+    }
+  },
+  methods: {
+    handleSearch() {
+      if (!this.keywords) {
+        this.$alert('请输入学生姓名、学号或账号信息')
+        return
+      }
+      this.searching = true
+      const params = {
+        pageNum: 1,
+        pageSize: 10,
+        roundId: this.generation.status.roundId,
+        keywords: this.keywords
+      }
+      searchElectiveGenerationDetails(params).then(res => {
+        this.details = res.data
+        this.$refs.pop.doShow()
+      }).finally(() => {
+        this.searching = false
+      })
+    },
+    handleInputBlur() {
+      this.$refs.pop.doClose()
+    },
+    handleStudentClick(detail) {
+      this.logDetail = detail
+      getGenerationOptionalMajorsBatch({
+        roundId: this.generation.status.roundId,
+        studentIds: detail.studentId
+      }).then(res => {
+        this.logMajors = res.data[detail.studentId] || {}
+        this.logVisible = true
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

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

@@ -140,7 +140,7 @@ export default {
       }).finally(() => this.notifyRootRefresh())
     },
     jumpDispatch() {
-      const path = '/evaluating/master-manage/selectCourse/elective/dispatch/index'
+      const path = '/new-gaokao/selectCourse/elective/dispatch/index'
       this.transferTo(path)
     },
     jumpReport() {

+ 1 - 1
src/views/elective/generation/components/elective-generation-master.vue

@@ -3,7 +3,7 @@
     <evaluation-empty v-if="isUnPassedStep" :shadow="false" :title="emptyTitle"></evaluation-empty>
     <template v-else>
       <div class="fx-row fx-bet-cen mb15">
-        <div>
+        <div class="fx-row mr30">
           <slot name="header-prefix"></slot>
         </div>
         <div class="fx-1">

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

@@ -218,7 +218,7 @@ export default {
 
         const studentIds = res.data.details?.map(d => d['studentId']).toString()
         if (!studentIds) return Promise.resolve({ data: {} })
-        return getGenerationOptionalMajorsBatch({ studentIds })
+        return getGenerationOptionalMajorsBatch({ roundId: this.prevData.roundId, studentIds })
       }).then(res => {
         this.majorsMap = res.data
       }).finally(() => this.loading = false)

+ 4 - 2
src/views/elective/generation/index.vue

@@ -10,7 +10,8 @@
       </template>
       <elective-generation-master :generation="generation">
         <template #header-prefix>
-          <el-button circle icon="el-icon-refresh" @click="handleQuery" class="mr30"></el-button>
+          <el-button circle icon="el-icon-refresh" @click="handleQuery"></el-button>
+          <elective-generation-command-search v-if="false" :generation="generation" class="ml10"/>
         </template>
       </elective-generation-master>
     </el-card>
@@ -27,11 +28,12 @@ import ElectiveGenerationSteps from '@/views/elective/generation/components/elec
 import ElectiveGenerationMaster from '@/views/elective/generation/components/elective-generation-master'
 import MxGroupTranslateMixin from '@/components/Cache/modules/mx-select-translate-mixin'
 import EventBus from '@/components/EventBus'
+import ElectiveGenerationCommandSearch from '@/views/elective/generation/components/elective-generation-command-search'
 
 export default {
   mixins: [MxGroupTranslateMixin],
   name: 'ElectiveGenerationIndex',
-  components: { ElectiveGenerationMaster, ElectiveGenerationSteps, MxCondition },
+  components: { ElectiveGenerationCommandSearch, ElectiveGenerationMaster, ElectiveGenerationSteps, MxCondition },
   data() {
     return {
       // query