Browse Source

elective - master student search

hare8999@163.com 2 năm trước cách đây
mục cha
commit
b3ff80f148

+ 8 - 7
src/views/elective/generation/components/elective-generation-command-search.vue

@@ -2,14 +2,14 @@
   <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}">
+      <el-popover ref="pop" trigger="manual" :popper-class="details.length>0?'zero-padding-popover':''">
         <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 }}
+        <span v-else-if="!details.length">暂无结果</span>
+        <div v-else class="fx-column">
+          <el-button plain type="text" v-for="stu in details" class="ml0 pl10 pr10" @click="handleStudentClick(stu)">
+            {{ stu.studentName }}<span v-if="stu.className">({{ stu.className }})</span> {{ stu.userName }}
           </el-button>
-        </template>
+        </div>
         <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
@@ -66,7 +66,8 @@ export default {
         keywords: this.keywords
       }
       searchElectiveGenerationDetails(params).then(res => {
-        this.details = res.data
+        const safeResults = (res.data || []).slice(0, params.pageSize)
+        this.details = safeResults
         this.$refs.pop.doShow()
       }).finally(() => {
         this.searching = false

+ 1 - 1
src/views/elective/generation/components/elective-generation-flow-log.vue

@@ -25,7 +25,7 @@ export default {
   props: ['groups', 'matchedMajors', 'histories'],
   computed: {
     logTable() {
-      if (!this.histories.length) return {}
+      if (!this.histories?.length) return {}
       const maxGeneration = this.histories.last().generation
       const options = Object.values(config.electiveGenerationOptions)
       // columns & rows

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

@@ -11,7 +11,7 @@
       <elective-generation-master :generation="generation">
         <template #header-prefix>
           <el-button circle icon="el-icon-refresh" @click="handleQuery"></el-button>
-          <elective-generation-command-search v-if="false" :generation="generation" class="ml10"/>
+          <elective-generation-command-search :generation="generation" class="ml10"/>
         </template>
       </elective-generation-master>
     </el-card>