|  | @@ -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>
 |