瀏覽代碼

zhiyuan update

hare8999@163.com 2 年之前
父節點
當前提交
1b79b767fa

+ 7 - 0
src/api/webApi/professlib.js

@@ -83,3 +83,10 @@ export function saveZhiyuan(data) {
     data:data,
   })
 }
+
+export function getVoluntaryData() {
+  return request({
+    url: 'front/syzy/zytb/getVoluntaryData',
+    method: 'get'
+  })
+}

+ 67 - 59
src/views/career/zhiyuan/NewSimulatedVolunteer.vue

@@ -1,10 +1,11 @@
 <template>
   <div class="zhiyuan-wrapper">
-    <div  class="bar">
+    <div class="bar">
       <!--  步骤条-->
       <div class="step-list line">
         <div class="step-item right" v-for="(item, index) in topStep" :key="index">
-          <div class="step-number" :class="active.name == item.label ? 'curindex' : ''" v-if="active.index < item.index">
+          <div class="step-number" :class="active.name == item.label ? 'curindex' : ''"
+               v-if="active.index < item.index">
             {{ item.index + 1 }}
           </div>
           <i v-else class="el-icon-check"></i>
@@ -12,17 +13,17 @@
         </div>
       </div>
       <div>
-        <h1 class="text-center f-primary" >{{active.title}}</h1>
+        <h1 class="text-center f-primary">{{ active.title }}</h1>
       </div>
     </div>
     <div class="content">
-      <score ref="score" v-show="active.index == 0" ></score>
+      <score ref="score" :form="this.form" v-show="active.index == 0"></score>
       <phase @onFillIn="onFillIn" v-if="active.index == 1" :list="zytbBatchesList" :formSubject="form"></phase>
       <recommend :batch="batch" v-if="active.index == 2" :formSubject="form"></recommend>
     </div>
     <div class="text-center mt15">
-      <el-button plain  @click="toReport">查看记录</el-button>
-      <el-button type="primary" @click="toBackPage"  :disabled="currentStep == 0">上一步</el-button>
+      <el-button plain @click="toReport">查看记录</el-button>
+      <el-button type="primary" @click="toBackPage" :disabled="currentStep == 0">上一步</el-button>
       <el-button type="primary" @click="next" v-if="currentStep <= 1">下一步</el-button>
     </div>
   </div>
@@ -32,23 +33,24 @@ import Score from './components/score'
 import Phase from './components/phase'
 import Recommend from './components/recommend'
 import { zytbBatches } from '@/api/webApi/webQue'
+
 export default {
-  components:{
+  components: {
     Recommend,
     Phase,
-    Score,
+    Score
   },
   data() {
     return {
-      input:'',
-      show:false,
+      input: '',
+      show: false,
       topStep: [
-        { index: 0, label: "高考分数",title:'(一)输入高考的成绩' },
-        { index: 1, label: "填报批次",title:'(二)选择填报批次'  },
-        { index: 2, label: "院校专业",title:'(三)选择院校专业'  },
-        { index: 3, label: "保存志愿",title:'(四)我的志愿'  },
+        { index: 0, label: '高考分数', title: '(一)输入高考的成绩' },
+        { index: 1, label: '填报批次', title: '(二)选择填报批次' },
+        { index: 2, label: '院校专业', title: '(三)选择院校专业' },
+        { index: 3, label: '保存志愿', title: '(四)我的志愿' }
       ],
-      batch:{},
+      batch: {},
       form: {
         score: '',
         firstSubject: '',
@@ -61,23 +63,19 @@ export default {
   },
   computed: {
     active() {
-      return  this.topStep.find(item => {
+      return this.topStep.find(item => {
         return item.index == this.currentStep
       })
-    },
-  },
-  mounted() {
-    // 初始化
-    this.$refs.score.init(this.form)
+    }
   },
-  methods:{
+  methods: {
     toReport() {
-      this.$router.push({ name:'VolunteerList' })
+      this.$router.push({ name: 'VolunteerList' })
     },
     save() {
       console.log('保存志愿')
     },
-    onFillIn(item)  {
+    onFillIn(item) {
       console.log(item)
       this.batch = item
       this.currentStep = 2
@@ -87,47 +85,45 @@ export default {
       switch (currentActive) {
         case 0:
           this.submitScore()
-          break;
+          break
         case 1:
           this.$message.warning('请点击批次按钮进行填写')
-          break;
+          break
       }
     },
     submitScore() {
-      this.$refs.score.validate(() => {
-        // 成功下一步
-        this.httpzytbBatches()
-      })
+      this.$refs.score.validate().then(() => this.httpzytbBatches())
     },
     toBackPage() {
       if (this.currentStep <= 0) {
-        return;
+        return
       }
-      this.currentStep --;
+      this.currentStep--
       // this.$refs.score.init(this.form)
     },
     httpzytbBatches() {
-      const mode =  [this.form.firstSubject, ...this.form.lastSubject].toString()
+      const mode = [this.form.firstSubject, ...this.form.lastSubject].toString()
       console.log(mode)
       zytbBatches({
         score: this.form.score,
-        mode: mode,
+        mode: mode
       }).then((res) => {
-        this.zytbBatchesList = res.rows;
+        this.zytbBatchesList = res.rows
         this.currentStep = 1
-      });
-    },
+      })
+    }
   }
 }
 </script>
 
 <style scoped>
-.zhiyuan-wrapper{
+.zhiyuan-wrapper {
   padding: 20px 0;
   margin: 30px auto;
   background-color: #fff;
 }
-.bar{
+
+.bar {
   padding: 0 100px 20px;
   border-bottom: 1px solid #d6d6d6;
 }
@@ -139,6 +135,7 @@ export default {
   position: relative;
   margin-bottom: 50px;
 }
+
 .step-list.line::before {
   position: absolute;
   content: "";
@@ -148,6 +145,7 @@ export default {
   background: #6cd1b5;
   z-index: 0;
 }
+
 .step-item {
   position: relative;
   background: #fff;
@@ -162,6 +160,7 @@ export default {
   align-items: center;
   justify-content: center;
 }
+
 .step-label {
   font-weight: bolder;
   color: #555555;
@@ -171,10 +170,12 @@ export default {
   position: absolute;
   bottom: -40px;
 }
+
 .step-number {
   line-height: 48px;
   text-align: center;
 }
+
 .step-number.curindex {
   width: 48px;
   height: 48px;
@@ -183,21 +184,25 @@ export default {
   border-radius: 50%;
   color: #fff;
 }
-.right_cart{
+
+.right_cart {
   position: fixed;
   top: 50%;
   right: -320px;
-  transform: translate(0%,-50%);
+  transform: translate(0%, -50%);
   transition: all 1s ease;
 }
-.active{
+
+.active {
   right: 0;
 }
-.right_cart{
+
+.right_cart {
   display: flex;
   z-index: 9999;
 }
-.right_cart .btn-wrap{
+
+.right_cart .btn-wrap {
   cursor: pointer;
   align-self: baseline;
   border-radius: 5px 0 0 5px;
@@ -209,7 +214,8 @@ export default {
   margin-top: 10px;
   padding: 7px;
 }
-.content-wrap{
+
+.content-wrap {
   padding: 10px 0;
   background: #fff;
   width: 320px;
@@ -219,33 +225,35 @@ export default {
 
   border: 1px solid #f2f2f2;
 }
-.content{
+
+.content {
   height: 100%;
 }
 
-.content .list{
+.content .list {
   min-height: 188px;
 }
-.content-wrap .input{
+
+.content-wrap .input {
   padding: 0 15px;
 }
 
-.content-wrap .btn{
-  width: 100% ;
+.content-wrap .btn {
+  width: 100%;
   padding: 0 15px;
 }
 
 
-.mask{
+.mask {
   z-index: 2009;
-   position: absolute;
-   top: 0;
-   right: 0;
-   bottom: 0;
-   left: 0;
-   overflow: auto;
-   opacity: 0.5;
-   margin: 0;
+  position: absolute;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  overflow: auto;
+  opacity: 0.5;
+  margin: 0;
 }
 
 </style>

+ 179 - 141
src/views/career/zhiyuan/components/recommend.vue

@@ -1,10 +1,10 @@
 <template>
-  <div style="width: 90%; margin:0 auto" >
-    <div class="zhiyuan-filter" >
+  <div style="width: 90%; margin:0 auto">
+    <div class="zhiyuan-filter">
       <div class="header">
         <h3 class="f-666">您的选考科目为:<em>{{ formSubject.firstSubject }}<em v-for="item in formSubject.lastSubject"
-        >,{{ item }}</em> </em>,  <span class="mr20">总分:<em  class="f-primary">{{ formSubject.score }}</em></span>
-          <span class="mr20">位次:<em  class="f-primary">{{ formSubject.rank.lowestRank }}</em></span>请手动选择志愿</h3>
+        >,{{ item }}</em> </em>, <span class="mr20">总分:<em class="f-primary">{{ formSubject.score }}</em></span>
+          <span class="mr20">位次:<em class="f-primary">{{ formSubject.rank.lowestRank }}</em></span>请手动选择志愿</h3>
       </div>
       <div class="filters">
         <!-- 院校筛选条件 -->
@@ -30,21 +30,24 @@
           </div>
           <div class="items fx-row">
             <div class="no_limited">
-              <el-checkbox @change="changeAll"   v-model="isAll">全部</el-checkbox>
+              <el-checkbox @change="changeAll" v-model="isAll">全部</el-checkbox>
             </div>
             <el-checkbox-group v-model="checkedList" :max="10">
-              <el-checkbox  v-for="item in childrenMajors" :label="item.name" :key="item.name">{{item.name}}</el-checkbox>
+              <el-checkbox v-for="item in childrenMajors" :label="item.name" :key="item.name">{{ item.name }}
+              </el-checkbox>
             </el-checkbox-group>
           </div>
         </el-row>
       </div>
       <div class="selected">
-         <span class="f14 f-666">您已选择:</span>
-         <div class="tags" style="width: 100%">
-           <el-tag  @close="handleClose(item)" type="success" class="mr5 mb5"  closable v-for="item in checkedListName">{{item.name}}</el-tag>
-         </div>
-        <el-button plain size="mini"  @click="confirm">确认</el-button>
-        <el-button plain size="mini"  @click="clear">清除</el-button>
+        <span class="f14 f-666">您已选择:</span>
+        <div class="tags" style="width: 100%">
+          <el-tag @close="handleClose(item)" type="success" class="mr5 mb5" closable v-for="item in checkedListName">
+            {{ item.name }}
+          </el-tag>
+        </div>
+        <el-button plain size="mini" @click="confirm">确认</el-button>
+        <el-button plain size="mini" @click="clear">清除</el-button>
       </div>
       <div class="radioInput">
         <!--其他筛选 -->
@@ -54,7 +57,8 @@
           </div>
           <el-radio-group v-model="filter_form.pickType">
             <el-radio-button label="">所有</el-radio-button>
-            <el-radio-button v-for="item in localFilters.picks" :key="item.value" :label="item.value" style="margin-bottom:10px"
+            <el-radio-button v-for="item in localFilters.picks" :key="item.value" :label="item.value"
+                             style="margin-bottom:10px"
             >
               {{ item.label }}
             </el-radio-button>
@@ -67,7 +71,7 @@
     <div class="zhiyuan-list">
       <zhiyuan-list :loading="loading" :tableList="rows" @apply="apply" :cols="cols" @expand="expand"></zhiyuan-list>
     </div>
-    <div :class="{'active':show,'right_cart': true}" >
+    <div :class="{'active':show,'right_cart': true}">
       <div class="btn-wrap" @click="show = !show">
         当前志愿表
       </div>
@@ -78,19 +82,19 @@
             <div class="list-item" v-for="(college,collegeIndex) in this.formatZhiyuan">
               <div class="head-college f16">
                 <el-tag type="success" size="mini" class="mr12">{{ collegeIndex + 1 }}</el-tag>
-                {{ `${college.university.name}(${college.recruitPlan.collegeCode })` }}
+                {{ `${college.university.name}(${college.recruitPlan.collegeCode})` }}
               </div>
               <div class="majors f12">
                 <div class="major mt10" v-for="(major,majorIndex) in college.majors">
-                  <span class="mr12 ml10">{{majorIndex + 1}}</span>
-                  {{major.marjorName}}
-                  <i  class="el-icon-delete delete-icon" @click="deleteMajor(major)"></i>
+                  <span class="mr12 ml10">{{ majorIndex + 1 }}</span>
+                  {{ major.marjorName }}
+                  <i class="el-icon-delete delete-icon" @click="deleteMajor(major)"></i>
                 </div>
               </div>
             </div>
           </div>
           <div class="btn">
-            <el-button style="width: 100%;height: 30px"  type="primary" @click="save">保存志愿表</el-button>
+            <el-button style="width: 100%;height: 30px" type="primary" @click="save">保存志愿表</el-button>
           </div>
         </div>
       </transition>
@@ -98,10 +102,17 @@
   </div>
 </template>
 <script>
-import FilterForm from '@/views/career/components/FilterForm';
-import ZhiyuanList from '@/views/career/zhiyuan/components/zhiyuan-list';
-import { allMajor,getRecommendVoluntary,getVoluntaryMarjors,getVoluntaryHeaders,saveZhiyuan } from '@/api/webApi/professlib'
+import FilterForm from '@/views/career/components/FilterForm'
+import ZhiyuanList from '@/views/career/zhiyuan/components/zhiyuan-list'
+import {
+  allMajor,
+  getRecommendVoluntary,
+  getVoluntaryHeaders,
+  getVoluntaryMarjors,
+  saveZhiyuan
+} from '@/api/webApi/professlib'
 import MxSearchGroup from '@/components/MxSearch/mx-search-group'
+
 export default {
   props: {
     formSubject: {
@@ -113,43 +124,43 @@ export default {
       default: {}
     }
   },
-  components:{
+  components: {
     FilterForm,
     ZhiyuanList,
     MxSearchGroup
   },
   data() {
     return {
-      indeterminate:false,
-      checkedList:[],
-      filter_form:{
-        location:'',
-        natureTypeCN:'',
-        type:'',
-        features:'',
-        pickType:'',
-        name:''
+      indeterminate: false,
+      checkedList: [],
+      filter_form: {
+        location: '',
+        natureTypeCN: '',
+        type: '',
+        features: '',
+        pickType: '',
+        name: ''
       },
-      name:'',
-      currentMajor:'',
-      majorList:[],
+      name: '',
+      currentMajor: '',
+      majorList: [],
       show: false,
       localFilters: {
         picks: [
-          { label: '冲刺型', value:0 },
-          { label: '稳妥型', value:1 },
-          { label: '保守型', value:2 }
+          { label: '冲刺型', value: 0 },
+          { label: '稳妥型', value: 1 },
+          { label: '保守型', value: 2 }
         ]
       },
       pageForm: {
         pageSize: 10,
-        pageNum:1
+        pageNum: 1
       },
       total: 0,
       rows: [],
       cols: [],
-      selectedList:[],
-      loading:false
+      selectedList: [],
+      loading: false
     }
   },
   created() {
@@ -160,29 +171,33 @@ export default {
     })
   },
   mounted() {
-    let dom = document.querySelector(".el-table__body-wrapper");
+    let dom = document.querySelector('.el-table__body-wrapper')
     console.log(dom)
-    dom.addEventListener("scroll", (v) => {
-      const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
+    dom.addEventListener('scroll', (v) => {
+      const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight
       // 判断是否到底,可以加载下一页
       if (scrollDistance <= 0.5) {
         this.load()
       }
-    });
+    })
   },
-  watch:{
-    filter_form:{
-      deep:true,
-      handler(){
+  watch: {
+    filter_form: {
+      deep: true,
+      handler() {
         this.confirm()
       }
     },
-    selectedList:{
-      deep:true,
-      handler(selectedList){
-        const index= selectedList.findIndex(item => { return item.majors.filter(major =>{ return  major.selected }).length <= 0 })
-        if(index != -1) {
-          this.selectedList.splice(index,1)
+    selectedList: {
+      deep: true,
+      handler(selectedList) {
+        const index = selectedList.findIndex(item => {
+          return item.majors.filter(major => {
+            return major.selected
+          }).length <= 0
+        })
+        if (index != -1) {
+          this.selectedList.splice(index, 1)
         }
       }
     }
@@ -192,7 +207,7 @@ export default {
     majorAllChildren() {
       let arr = []
       this.majorList.map(item => {
-        arr = [...arr,...item.children]
+        arr = [...arr, ...item.children]
       })
       return arr
     },
@@ -202,40 +217,44 @@ export default {
       }) || []
     },
     childrenMajors() {
-      if(!this.currentMajor) return []
+      if (!this.currentMajor) return []
       return this.majorList.find(item => {
         return item.code == this.currentMajor
       }).children || []
     },
     formatZhiyuan() {
-      if(!this.selectedList.length) return []
+      if (!this.selectedList.length) return []
       return this.selectedList.map(item => {
         return {
           university: item.university,
-          majors:item.majors.filter(major =>{ return  major.selected }),
+          majors: item.majors.filter(major => {
+            return major.selected
+          }),
           recruitPlan: item.recruitPlan
         }
       }).filter(item => {
-        return  item.majors.length > 0
+        return item.majors.length > 0
       })
     },
-    isAll:{
-      get(){
+    isAll: {
+      get() {
         // 当前children 全选
         let count = 0
         const childrenMajors = this.childrenMajors
         this.checkedList.forEach(item => {
-          if(childrenMajors.findIndex(major => {return major.name == item}) != -1){
+          if (childrenMajors.findIndex(major => {
+            return major.name == item
+          }) != -1) {
             count++
           }
         })
-        console.log('选中数',count)
+        console.log('选中数', count)
         return count == childrenMajors.length
       },
-      set(){
+      set() {
 
       }
-    },
+    }
   },
   methods: {
     getListByName() {
@@ -246,90 +265,94 @@ export default {
       this.getList()
       //在执行完跳转页码的数据请求后
       this.$nextTick(() => {
-        document.querySelector(".el-table__body-wrapper").scrollTop = 0;
+        document.querySelector('.el-table__body-wrapper').scrollTop = 0
       })
     },
     load() {
       if (Math.ceil(this.total / this.pageForm.pageSize) > this.pageForm.pageNum) {
         // 标识正在请求
         // 加载下一页方法
-        if(!this.loading){
+        if (!this.loading) {
           //当前页数小于总页数就请求
-          this.pageForm.pageNum++; //当前页数自增
+          this.pageForm.pageNum++ //当前页数自增
           this.getList('push')
         }
-      }else {
-        this.$message.warning("已经见底了 ~");
+      } else {
+        this.$message.warning('已经见底了 ~')
       }
     },
-    save(){
-      const wishes = this.selectedList.map(item =>{
+    save() {
+      const wishes = this.selectedList.map(item => {
         return {
-          universityId:item.university.id,
+          universityId: item.university.id,
           collegeCode: item.recruitPlan.collegeCode,
-          code:item.university.code,
-          name:item.university.name,
-          marjors:item.majors.filter(major => {return major.selected}).map(major=> {
+          code: item.university.code,
+          name: item.university.name,
+          pickType: item.pickType,
+          marjors: item.majors.filter(major => {
+            return major.selected
+          }).map(major => {
             return {
               id: major.id,
               code: major.marjorBelongs,
               name: major.marjorName,
+              pickType: item.pickType,
+              submitMajorId: major.history.id
             }
           })
         }
       })
-       if(wishes.length < 3) {
+      if (wishes.length < 3) {
         this.$message.warning('至少选择三个专业组')
-         return
+        return
       }
       const data = {
         batch: this.batch.batch,
-        detail:{
-          batch:{
-            batch:this.batch.batch,
-            name:this.batch.name,
+        detail: {
+          batch: {
+            batch: this.batch.batch,
+            name: this.batch.name,
             recommand: true,
-            scores:[],
-            wishes:wishes,
+            scores: [],
+            wishes: wishes
           },
-          mode:`${this.formSubject.firstSubject},${this.formSubject.lastSubject}`,
-          score:this.formSubject.score
+          mode: `${this.formSubject.firstSubject},${this.formSubject.lastSubject}`,
+          score: this.formSubject.score
         },
         id: 0,
         name: ''
       }
-      saveZhiyuan(data).then(res =>{
-        this.$router.push({ name:'VolunteerList' })
+      saveZhiyuan(data).then(res => {
+        this.$router.push({ name: 'VolunteerList' })
       })
     },
-    apply(item,index) {
+    apply(major, recommend) {
       //  有无院校  ?
-      const codeFlag = this.selectedList.find(item => item.recruitPlan.collegeCode == this.rows[index].recruitPlan.collegeCode)
-      console.log(!codeFlag)
-      if(!codeFlag){
-        this.selectedList.push(this.rows[index])
+      const codeFlag = this.selectedList.find(item => item == recommend)
+      if (!codeFlag) {
+        this.selectedList.push(recommend)
       }
-      item.selected = !item.selected
+      major.selected = !major.selected
     },
-    deleteMajor(major){
+    deleteMajor(major) {
       major.selected = false
     },
     expand(item) {
       console.log(item)
-      if(item.isExpand) {
+      if (item.isExpand) {
         // 取消
         return
-      }else {
+      } else {
         item.isExpand = true
         this.getVoluntaryMarjors(item)
       }
     },
     getCols() {
       getVoluntaryHeaders({
-        mode:`${this.formSubject.firstSubject},${this.formSubject.lastSubject}`,
+        mode: `${this.formSubject.firstSubject},${this.formSubject.lastSubject}`,
         year: this.batch.year
       }).then(res => {
-          this.cols = res.data
+        this.cols = res.data
       })
     },
     getList(type) {
@@ -340,10 +363,10 @@ export default {
         majors: this.checkedList,
         mode: `${this.formSubject.firstSubject},${this.formSubject.lastSubject}`,
         // mode1: string,
-        pickType:  this.filter_form.pickType,
+        pickType: this.filter_form.pickType,
         // "rank": 0,
         score: this.formSubject.score,
-        batchMinScore:this.batch.score2 || this.batch.score1,
+        batchMinScore: this.batch.score2 || this.batch.score1,
         university: {
           // "code": "string",
           features: this.filter_form.features,
@@ -351,12 +374,12 @@ export default {
           location: this.filter_form.location,
           type: this.filter_form.type,
           natureTypeCN: this.filter_form.natureTypeCN,
-          name:this.filter_form.name,
+          name: this.filter_form.name
           // "status": 0,
           // "type": "string"
-        },
+        }
       }
-      getRecommendVoluntary({ ...data }, { ...this.pageForm }).then(res =>{
+      getRecommendVoluntary({ ...data }, { ...this.pageForm }).then(res => {
         console.log(res)
         this.total = res.total
         let rows = {}
@@ -366,19 +389,19 @@ export default {
           return item
         })
         // 回显
-        if(this.selectedList.length) {
+        if (this.selectedList.length) {
           rows = rows.map(row => {
-           const flagIndex =  this.selectedList.findIndex(selected => {
+            const flagIndex = this.selectedList.findIndex(selected => {
               return selected.recruitPlan.collegeCode == row.recruitPlan.collegeCode
             })
-            if(flagIndex == -1) {
+            if (flagIndex == -1) {
               return row
-            }else {
+            } else {
               return this.selectedList[flagIndex]
             }
           })
         }
-        if(type == 'push') {
+        if (type == 'push') {
           this.rows.push(...rows)
           return
         }
@@ -394,7 +417,8 @@ export default {
           collegeCode: item.recruitPlan.collegeCode,
           mode: this.formSubject.firstSubject,
           universityId: item.recruitPlan.universityId,
-          year: item.recruitPlan.year,}
+          year: item.recruitPlan.year
+        }
       ).then(res => {
         item.majors = res.data.map(item => {
           item.selected = false
@@ -405,32 +429,32 @@ export default {
     },
     handleClose(item) {
       const index = this.checkedList.findIndex(code => code == item.code)
-      this.checkedList.splice(index,1)
+      this.checkedList.splice(index, 1)
     },
     clear() {
-      if(!this.checkedList.length) return
+      if (!this.checkedList.length) return
       this.checkedList = []
       this.getList()
     },
-    changeAll(val){
-      const checkedList =  this.checkedList
+    changeAll(val) {
+      const checkedList = this.checkedList
 
-      if(val) {
+      if (val) {
         // 添加
         this.childrenMajors.forEach(item => {
-          if(this.checkedList.length >= 10) {
+          if (this.checkedList.length >= 10) {
             this.$message.warning('最多选择10个专业')
             throw Error('最多选择10个专业')
           }
-          if(this.checkedList.findIndex(code => code == item.code) == -1 ){
+          if (this.checkedList.findIndex(code => code == item.code) == -1) {
             this.checkedList.push(item.code)
           }
         })
-      }else {
+      } else {
         // 移除
         this.childrenMajors.forEach(item => {
           for (let i = 0; i < checkedList.length; i++) {
-            if(item.code == checkedList[i]){
+            if (item.code == checkedList[i]) {
               this.checkedList.remove(item.code)
             }
           }
@@ -440,17 +464,17 @@ export default {
       console.log(val)
     },
     handleCheckAllChange(val) {
-      this.isIndeterminate = false;
+      this.isIndeterminate = false
     },
-    getAllMajor(){
+    getAllMajor() {
       allMajor({
-        level:2,
-        batch:this.batch.batch
+        level: 2,
+        batch: this.batch.batch
       }).then(res => {
         this.majorList = res.data
         console.log(res)
       })
-    },
+    }
   }
 }
 </script>
@@ -459,26 +483,30 @@ export default {
 .more span {
   margin-right: 10px;
 }
-.selected{
+
+.selected {
   display: flex;
   align-items: center;
   justify-content: space-between;
   padding: 10px;
   margin-bottom: 20px;
   background: #42b98340;
-  span{
+
+  span {
     flex-shrink: 0;
   }
 }
+
 .filters {
   padding: 10px 0px;
   border: 1px solid #eee;
 }
 
-.delete-icon{
+.delete-icon {
   float: right;
   cursor: pointer;
 }
+
 .filter_name {
   box-sizing: border-box;
   width: 70px;
@@ -530,7 +558,10 @@ em {
 }
 
 .radioInput ::v-deep {
-  background-color: #ffffff;font-size: 14px;padding:5px;
+  background-color: #ffffff;
+  font-size: 14px;
+  padding: 5px;
+
   .el-radio {
     .el-radio__input {
       display: none;
@@ -562,21 +593,25 @@ em {
     margin-right: 10px;
   }
 }
-.right_cart{
+
+.right_cart {
   position: fixed;
   top: 50%;
   right: -320px;
-  transform: translate(0%,-50%);
+  transform: translate(0%, -50%);
   transition: all 1s ease;
 }
-.active{
+
+.active {
   right: 0;
 }
-.right_cart{
+
+.right_cart {
   display: flex;
   z-index: 9999;
 }
-.right_cart .btn-wrap{
+
+.right_cart .btn-wrap {
   cursor: pointer;
   align-self: baseline;
   border-radius: 5px 0 0 5px;
@@ -587,7 +622,8 @@ em {
   font-size: 16px;
   padding: 7px;
 }
-.content-wrap{
+
+.content-wrap {
   padding: 10px 0;
   background: #fff;
   width: 320px;
@@ -597,28 +633,30 @@ em {
 
   border: 1px solid #f2f2f2;
 }
-.content{
+
+.content {
   height: 100%;
   overflow-y: auto;
   padding: 0 20px
 }
 
 
-.content-wrap .input{
+.content-wrap .input {
   padding: 0 15px;
 }
 
-.content-wrap .btn{
-  width: 100% ;
+.content-wrap .btn {
+  width: 100%;
   padding: 0 15px;
 }
-.list-item{
+
+.list-item {
   margin-bottom: 10px;
   border-bottom: 1px solid #e6e6e6;
   padding-bottom: 20px;
 }
 
-.mask{
+.mask {
   z-index: 2009;
   position: absolute;
   top: 0;

+ 65 - 74
src/views/career/zhiyuan/components/score.vue

@@ -1,25 +1,21 @@
 <template>
-  <div class="form" v-if="initReady">
+  <div class="form" v-if="voluntaryData">
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-        <el-form-item label="您的总分" prop="score">
-          <el-input  v-model="form.score" placeholder="请输入分数"></el-input>
-        </el-form-item>
-      <el-form-item label="您的首选科目" prop="firstSubject">
-        <el-radio-group v-model="form.firstSubject" >
-          <el-radio label="物理"></el-radio>
-          <el-radio label="历史"></el-radio>
+      <el-form-item label="您的总分" prop="score">
+        <el-input v-model="form.score" placeholder="请输入分数"></el-input>
+      </el-form-item>
+      <el-form-item :label="voluntaryData.isNewGaokao?`您的首选科目`:`您的科目`" prop="firstSubject">
+        <el-radio-group v-model="form.firstSubject">
+          <el-radio v-for="item in voluntaryData.course0" :key="item" :label="item"></el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item label="您的次选科目" prop="lastSubject">
+      <el-form-item v-if="voluntaryData.isNewGaokao" label="您的次选科目" prop="lastSubject">
         <el-checkbox-group v-model="form.lastSubject" :max="2">
-          <el-checkbox label="化学" name="type"></el-checkbox>
-          <el-checkbox label="生物" name="type"></el-checkbox>
-          <el-checkbox label="政治" name="type"></el-checkbox>
-          <el-checkbox label="地理" name="type"></el-checkbox>
+          <el-checkbox v-for="item in voluntaryData.course1" :key="item" :label="item"></el-checkbox>
         </el-checkbox-group>
       </el-form-item>
       <el-form-item label="您的位次">
-        <el-input   disabled placeholder="输入分数后查看位次" :value="form.rank.lowestRank"></el-input>
+        <el-input disabled placeholder="输入分数后查看位次" :value="form.rank.lowestRank"></el-input>
         <span class="f12 f-666 ml10">当前为估分模拟,不需填写排名</span>
       </el-form-item>
     </el-form>
@@ -28,103 +24,98 @@
 <script>
 
 import { getRankByScore } from '@/api/webApi/career-course'
+import { getVoluntaryData } from '@/api/webApi/professlib'
 
 export default {
+  props: ['form'],
   data() {
-    var coustomValid = (rule, value, callback) => {
-      if (rule.field == 'score' &&  value > 750) {
-        return callback(new Error('成绩超出当前省份满分'));
-      }
-
-      if (rule.field == 'lastSubject' &&  value.length < 2) {
-        return callback(new Error('请选择两项次选科目'));
-      }
-      callback();
-    };
     return {
-      form: {
-        score:'',
-        firstSubject:'',
-        lastSubject:'',
+      voluntaryData: {
+        isNewGaokao: false,
+        minScore: 0,
+        maxScore: 0,
+        course0: [],
+        course1: []
       },
-      initReady: false,
       rules: {
-        score:  [
+        score: [
           { required: true, message: '请输入你的总分', trigger: 'blur' },
-          { validator: coustomValid, trigger: 'blur'  }
+          {
+            validator: (r, v, cb) => {
+              if (v > this.voluntaryData.maxScore) {
+                cb(`成绩超出当前省份满分${this.voluntaryData.maxScore}`)
+              } else {
+                cb()
+              }
+            }, trigger: 'blur'
+          }
         ],
         firstSubject: [
-          { required: true, message: '请选择首选科目', trigger: 'change' }
+          { required: true, message: '请选择科目', trigger: 'change' }
         ],
-        lastSubject:[
+        lastSubject: [
           { required: true, message: '请选择次选科目', trigger: 'change' },
-          { validator: coustomValid, trigger: 'change'  }
+          {
+            validator: (r, v, cb) => {
+              if (v.length < 2) {
+                cb('请选择两项次选科目')
+              } else {
+                cb()
+              }
+            }, trigger: 'change'
+          }
         ]
-      },
-      rank:{}
+      }
     }
   },
-  watch:{
-    'form.score':{
-      handler(val) {
-        if(this.form.firstSubject && this.form.score != ''){
-          this.getRankByScore()
-        }
-        if(val == ''){
-          this.rank = {}
-        }
-      }
-    },
-    'form.firstSubject':{
-      handler(val) {
-          if(this.form.firstSubject && this.form.score){
-            this.getRankByScore()
-          }
-      }
+  watch: {
+    'form.score': function() {
+      this.setRankByScore()
     },
+    'form.firstSubject': function() {
+      this.setRankByScore()
+    }
+  },
+  mounted() {
+    getVoluntaryData().then(res => this.voluntaryData = res.data)
   },
   methods: {
-    init(form) {
-      this.form = form
-      this.initReady = true
-    },
-    getRankByScore() {
-      getRankByScore({mode:this.form.firstSubject,scoreRank:this.form.score}).then(res => {
-        this.form.rank = res.data
-        console.log(res)
+    setRankByScore() {
+      if (!this.form.firstSubject || !this.form.score) {
+        this.$set(this.form, 'rank', {})
+        return
+      }
+      getRankByScore({ mode: this.form.firstSubject, scoreRank: this.form.score }).then(res => {
+        this.$set(this.form, 'rank', res.data)
       })
     },
-    validate(cb) {
-      this.$refs.form.validate((valid) => {
-        if (valid) {
-          console.log('success submit!!');
-          cb && cb()
-        } else {
-          console.log('error submit!!');
-        }
-      })
+    validate() {
+      return this.$refs.form.validate()
     }
   }
 }
 </script>
 
 <style scoped lang="scss">
-.form{
+.form {
   width: 620px;
   padding: 40px 0;
   margin: 0 auto;
 }
+
 .form {
   ::v-deep {
     .el-form-item__label {
       padding-right: 25px;
     }
+
     .el-input {
-       width: 300px;
-     }
+      width: 300px;
+    }
   }
 }
-.btn{
+
+.btn {
   width: 120px;
   margin-left: 83px;
   margin-top: 30px;

+ 131 - 121
src/views/career/zhiyuan/components/zhiyuan-list.vue

@@ -1,113 +1,120 @@
 <template>
-    <dynamic-table v-loading="loading" ref="table"  height="800px"  :rows="tableList" :columns="columns" @expand-change="expand" >
-      <template #t0="{row}">
-        <!--    录取概率 -->
-        <div>
-<!--          <p class="mb10"><span class="f18">{{ row.enrollRatio }}</span>%</p>-->
-<!--          <p class="mb10 f-9b f12">{{ row.enrollRatioText }}</p>-->
-          <p>
-            <el-tag type="danger" v-if="row.pickType == 0">冲</el-tag>
-            <el-tag type="warning" v-if="row.pickType == 1">稳</el-tag>
-            <el-tag type="success" v-if="row.pickType == 2">保</el-tag>
-          </p>
-        </div>
-      </template>
-      <template #t1="{row}">
-        <!-- 院校 -->
-        <div>
-          <p class="mb10"><span class="pointer">{{ `${row.university.name}` || '' }}</span></p>
-          <p class="mb5 f-9b f12">{{ row.university.features.split(',').join(' ') }}</p>
-          <p class="mb5 f-9b f12">{{ row.university.location }} {{ row.university.cityName }}
-            排名{{ row.university.ranking }}</p>
-          <p class="f-9b f12">代码 {{ row.recruitPlan.collegeCode }}</p>
-        </div>
-      </template>
-      <template #t2="{row}">
-        <!-- 招生计划 -->
-        <div>
-          <p><span class="f18">{{ row.recruitPlan.planCount }}</span>人</p>
-          <p class="f-9b f12">{{ row.recruitPlan.course }}</p>
-        </div>
-      </template>
-      <template #t3="{row}">
-        <!--   历年 -->
-        <div class="f14">
-          <p>{{ row.history? row.history.year || '-' : '-' }}</p>
-        </div>
-      </template>
-      <template #t4="{row}">
-        <div class="f14">
-            <p>{{ row.history? row.history.numReal || '-' : '-'}}</p>
-        </div>
-      </template>
-      <template #t5="{row}">
-        <div class="f14">
-            <p>{{ row.history? row.history.score || '-' : '-' }}</p>
-        </div>
-      </template>
-      <template #t6="{row}">
-        <div class="f14">
-            <p>{{  row.history? row.history.seat || '-' : '-'}}</p>
-        </div>
-      </template>
-      <template #t7="{row}">
-        <p type="primary"> {{ `专业(${row.recruitPlan.majorCount}个)` }}</p>
-        <p class="f12 f-primary" v-show="row.majors.filter(major => {return major.selected}).length">  已填  <span>{{ row.majors.filter(major => {return major.selected}).length }}</span> </p>
-      </template>
-      <template #expand="{row,$index}">
-        <div>
-          <dynamic-table :columns="majorCol" :show-header="false" :rows="row.majors">
-            <template #t0="{row}">
-              <!--    录取概率 -->
-              <div>
-              </div>
-            </template>
-            <template #t1="{row}">
-              <div>
-                <p class="mb10"><span class="pointer">{{ row.marjorName }}</span></p>
-                <p class="f-9b f12">代码 {{ row.marjorBelongs }}</p>
-              </div>
-            </template>
-            <template #t2="{row}">
-              <div>
-                <p><span class="f18">{{ row.planCount || '-' }}</span>人</p>
-                <p class="f-9b f12">{{ `${row.xuezhi} ¥${row.xuefei}` }}</p>
-              </div>
-            </template>
-            <template #t3="{row}">
-              <div class="f14">
-                <p>{{ row.history? row.history.year || '-' : '-' }}</p>
-              </div>
-            </template>
-            <template #t4="{row}">
-              <div class="f14">
-                  <p>{{ row.history? row.history.numReal || '-' : '-' }}</p>
-              </div>
-            </template>
-            <template #t5="{row}">
-              <div class="f14">
-                  <p>{{ row.history ? row.history.score || '-' : '-' }}</p>
-              </div>
-            </template>
-            <template #t6="{row}">
-              <div class="f14">
-                  <p>{{ row.history? row.history.seat || '-' : '-' }}</p>
-              </div>
-            </template>
-            <template #t7="{row}">
-              <el-button :type="row.selected ? 'danger' : 'primary'" @click="apply(row,$index)"> {{row.selected ?'取消' :  '填报' }}</el-button>
-            </template>
-          </dynamic-table>
-        </div>
-      </template>
-    </dynamic-table>
+  <dynamic-table v-loading="loading" ref="table" height="800px" :rows="tableList" :columns="columns"
+                 @expand-change="expand">
+    <template #t0="{row}">
+      <!--    录取概率 -->
+      <div>
+        <!--          <p class="mb10"><span class="f18">{{ row.enrollRatio }}</span>%</p>-->
+        <!--          <p class="mb10 f-9b f12">{{ row.enrollRatioText }}</p>-->
+        <p>
+          <el-tag type="danger" v-if="row.pickType == 0">冲</el-tag>
+          <el-tag type="warning" v-if="row.pickType == 1">稳</el-tag>
+          <el-tag type="success" v-if="row.pickType == 2">保</el-tag>
+        </p>
+      </div>
+    </template>
+    <template #t1="{row}">
+      <!-- 院校 -->
+      <div>
+        <p class="mb10"><span class="pointer">{{ `${row.university.name}` || '' }}</span></p>
+        <p class="mb5 f-9b f12">{{ row.university.features.split(',').join(' ') }}</p>
+        <p class="mb5 f-9b f12">{{ row.university.location }} {{ row.university.cityName }}
+          排名{{ row.university.ranking }}</p>
+        <p class="f-9b f12">代码 {{ row.recruitPlan.collegeCode }}</p>
+      </div>
+    </template>
+    <template #t2="{row}">
+      <!-- 招生计划 -->
+      <div>
+        <p><span class="f18">{{ row.recruitPlan.planCount }}</span>人</p>
+        <p class="f-9b f12">{{ row.recruitPlan.course }}</p>
+      </div>
+    </template>
+    <template #t3="{row}">
+      <!--   历年 -->
+      <div class="f14">
+        <p>{{ row.history ? row.history.year || '-' : '-' }}</p>
+      </div>
+    </template>
+    <template #t4="{row}">
+      <div class="f14">
+        <p>{{ row.history ? row.history.numReal || '-' : '-' }}</p>
+      </div>
+    </template>
+    <template #t5="{row}">
+      <div class="f14">
+        <p>{{ row.history ? row.history.score || '-' : '-' }}</p>
+      </div>
+    </template>
+    <template #t6="{row}">
+      <div class="f14">
+        <p>{{ row.history ? row.history.seat || '-' : '-' }}</p>
+      </div>
+    </template>
+    <template #t7="{row}">
+      <p type="primary"> {{ `专业(${row.recruitPlan.majorCount}个)` }}</p>
+      <p class="f12 f-primary" v-show="row.majors.filter(major => {return major.selected}).length"> 已填 <span>{{
+          row.majors.filter(major => {
+            return major.selected
+          }).length
+        }}</span></p>
+    </template>
+    <template #expand="{row: recommend,$index}">
+      <div>
+        <dynamic-table :columns="majorCol" :show-header="false" :rows="recommend.majors">
+          <template #t0="{row}">
+            <!--    录取概率 -->
+            <div>
+            </div>
+          </template>
+          <template #t1="{row}">
+            <div>
+              <p class="mb10"><span class="pointer">{{ row.marjorName }}</span></p>
+              <p class="f-9b f12">代码 {{ row.marjorBelongs }}</p>
+            </div>
+          </template>
+          <template #t2="{row}">
+            <div>
+              <p><span class="f18">{{ row.planCount || '-' }}</span>人</p>
+              <p class="f-9b f12">{{ `${row.xuezhi} ¥${row.xuefei}` }}</p>
+            </div>
+          </template>
+          <template #t3="{row}">
+            <div class="f14">
+              <p>{{ row.history ? row.history.year || '-' : '-' }}</p>
+            </div>
+          </template>
+          <template #t4="{row}">
+            <div class="f14">
+              <p>{{ row.history ? row.history.numReal || '-' : '-' }}</p>
+            </div>
+          </template>
+          <template #t5="{row}">
+            <div class="f14">
+              <p>{{ row.history ? row.history.score || '-' : '-' }}</p>
+            </div>
+          </template>
+          <template #t6="{row}">
+            <div class="f14">
+              <p>{{ row.history ? row.history.seat || '-' : '-' }}</p>
+            </div>
+          </template>
+          <template #t7="{row}">
+            <el-button :type="row.selected ? 'danger' : 'primary'" @click="apply(row,recommend)">
+              {{ row.selected ? '取消' : '填报' }}
+            </el-button>
+          </template>
+        </dynamic-table>
+      </div>
+    </template>
+  </dynamic-table>
 </template>
 <script>
 import DynamicTable from '@/components/dynamic-table'
 
 export default {
   components: {
-    DynamicTable,
+    DynamicTable
   },
   props: {
     tableList: {
@@ -118,38 +125,38 @@ export default {
       type: Array,
       default: []
     },
-    loading:{
+    loading: {
       type: Boolean,
       default: []
     }
   },
   data() {
     return {
-      show:false,
-      input:'',
-      selectedList:[]
+      show: false,
+      input: '',
+      selectedList: []
     }
   },
   computed: {
     columns() {
-      if(!this.cols.length) return []
+      if (!this.cols.length) return []
       const columns = [
-      //   {
-      //   type: 'expand',
-      //   slotBody: 'expand'
-      // }
+        //   {
+        //   type: 'expand',
+        //   slotBody: 'expand'
+        // }
       ]
       this.cols.map((item, index) => {
         columns.push({
           label: item,
           slotBody: 't' + index,
-          width: index >= 2 || index == 0 ? 100+'px' : ''
+          width: index >= 2 || index == 0 ? 100 + 'px' : ''
         })
       })
       columns.push({
         type: 'expand',
         slotBody: 'expand',
-        label:'查看'
+        label: '查看'
       })
       return columns
     },
@@ -158,10 +165,10 @@ export default {
         return {
           label: item,
           slotBody: 't' + index,
-          width: index >= 2 || index == 0 ? 100+'px' : ''
+          width: index >= 2 || index == 0 ? 100 + 'px' : ''
         }
       })
-    },
+    }
   },
   methods: {
     expand(item) {
@@ -170,9 +177,9 @@ export default {
     scrollTop() {
       this.$refs.table.toScrollTop()
     },
-    apply(item,index) {
-      this.$emit('apply',item,index)
-    },
+    apply(item, parent) {
+      this.$emit('apply', item, parent)
+    }
   }
 }
 </script>
@@ -180,16 +187,19 @@ export default {
 .f-9b {
   color: #9b9b9b;
 }
+
 ::v-deep .el-table__expanded-cell {
   padding-top: 0;
   //padding-right: 50;
   padding-bottom: 0;
   padding-left: 0;
 }
-::v-deep .el-table__expand-icon{
+
+::v-deep .el-table__expand-icon {
   font-size: 18px;
   color: #666;
-  .el-icon-arrow-right{
+
+  .el-icon-arrow-right {
     font-weight: bold;
   }
 }