瀏覽代碼

院校投档线整合mx-condtion、mx-search-group

shilipojs 3 年之前
父節點
當前提交
425a4cbc1b

+ 29 - 0
src/components/MxCondition/condition-object/condition-shiftline-level.js

@@ -0,0 +1,29 @@
+import conditionObjectBase from '../condition-object-base.js'
+import {
+  selectUniversityLevels,
+} from '@/api/webApi/shiftLine'
+
+// 院校投档线  地域
+export default {
+  ...conditionObjectBase,
+  dependentKeys: ['universityLocation'],
+  key: 'universityLevel',
+  isDependencyReady(params) {
+    return params.universityLocation
+  },
+  title: '层次',
+  getList: function(param) {
+    return new Promise((resolve, reject) => {
+      selectUniversityLevels({
+        location: param.universityLocation
+      }).then(res => resolve(res.rows))
+        .catch(e => reject(e))
+    })
+  },
+  getCode: function(item) {
+    return item
+  },
+  getLabel: function(item) {
+    return item
+  }
+}

+ 29 - 0
src/components/MxCondition/condition-object/condition-shiftline-type.js

@@ -0,0 +1,29 @@
+import conditionObjectBase from '../condition-object-base.js'
+import {
+  selectUniversityTypes,
+} from '@/api/webApi/shiftLine'
+
+// 院校投档线  地域
+export default {
+  ...conditionObjectBase,
+  dependentKeys: ['universityLocation'],
+  key: 'universityType',
+  isDependencyReady(params) {
+    return params.universityLocation
+  },
+  title: '科类',
+  getList: function(param) {
+    return new Promise((resolve, reject) => {
+      selectUniversityTypes({
+        location: param.universityLocation
+      }).then(res => resolve(res.rows))
+        .catch(e => reject(e))
+    })
+  },
+  getCode: function(item) {
+    return item
+  },
+  getLabel: function(item) {
+    return item
+  }
+}

+ 23 - 0
src/components/MxCondition/condition-object/condition-shiftline-university.js

@@ -0,0 +1,23 @@
+import conditionObjectBase from '../condition-object-base.js'
+import {
+  selectUniversityLocations
+} from '@/api/webApi/shiftLine'
+
+// 院校投档线  地域
+export default {
+  ...conditionObjectBase,
+  key: 'universityLocation',
+  title: '地域',
+  getList: function(param) {
+    return new Promise((resolve, reject) => {
+      selectUniversityLocations().then(res => resolve(res.rows))
+        .catch(e => reject(e))
+    })
+  },
+  getCode: function(item) {
+    return item
+  },
+  getLabel: function(item) {
+    return item
+  }
+}

+ 31 - 0
src/components/MxCondition/condition-object/condition-shiftline-year.js

@@ -0,0 +1,31 @@
+import conditionObjectBase from '../condition-object-base.js'
+import {
+  selectUniversityYears
+} from '@/api/webApi/shiftLine'
+
+// 院校投档线  地域
+export default {
+  ...conditionObjectBase,
+  dependentKeys: ['universityLocation','universityType','universityLevel'],
+  key: 'universityYear',
+  isDependencyReady(params) {
+    return params.universityLocation && params.universityType && params.universityLevel
+  },
+  title: '年份',
+  getList: function(param) {
+    return new Promise((resolve, reject) => {
+      selectUniversityYears({
+        location: param.universityLocation,
+        level: param.universityLevel,
+        type: param.universityType
+      }).then(res => resolve(res.rows))
+        .catch(e => reject(e))
+    })
+  },
+  getCode: function(item) {
+    return item
+  },
+  getLabel: function(item) {
+    return item
+  }
+}

+ 6 - 1
src/views/career/components/UniversitiesLine.vue

@@ -58,7 +58,6 @@
     selectUniversityYears
   } from '@/api/webApi/shiftLine'
   import UniversitiesLineTable from '@/views/career/components/UniversitiesLineTable'
-
   export default {
     name: "UniversitiesLine",
     components: {UniversitiesLineTable},
@@ -102,6 +101,12 @@
       this.getUniversityYears()
     },
     methods: {
+      handleQuery() {
+
+      },
+      handleInvalidQuery() {
+
+      },
       getUniversityLocations() {
         selectUniversityLocations().then(res => {
           this.locations = res.rows

+ 81 - 72
src/views/career/components/UniversitiesLineTable.vue

@@ -1,16 +1,12 @@
 <template>
   <div id="lineTable">
-    <div style="text-align: right;margin-bottom: 10px;" class="search">
-      <el-input style="width:40%;" suffix-icon=" " placeholder="搜索" v-model="tableParams.univerName" @keyup.enter.native="clickSuffix">
-           <span slot="suffix" @click="clickSuffix" style="cursor: pointer">
-            <i class="el-icon-search" style="margin-right: 10px;"></i>
-          </span>
-      </el-input>
-    </div>
-    <el-table :data="tableData" border>
+    <mx-search-group class="mb10" justify="end" :span="6" v-model="tableParams.univerName" placeholder="搜索" @search="clickSuffix"
+    ></mx-search-group>
+    <el-table :data="tableData" v-loading="tableLoading" border>
       <el-table-column prop="code" label="院校" align="center">
         <template slot-scope="scope">
-          <el-link :underline="false" @click="goDetails(scope.row.universityId)">【{{scope.row.universityName}}】</el-link>
+          <el-link :underline="false" @click="goDetails(scope.row.universityId)">【{{ scope.row.universityName }}】
+          </el-link>
         </template>
       </el-table-column>
       <el-table-column prop="location" label="所在地" align="center"></el-table-column>
@@ -33,77 +29,90 @@
 </template>
 
 <script>
-  import {selectUniversityList} from '@/api/webApi/shiftLine'
-    export default {
-        name: "UniversitiesLineTable",
-      props:{
-        universityParams:{type:Object,default(){return {}}}
-      },
-      data(){
-        return{
-          examRecordTotal:0,
-          tableParams:{
-            pageSize:20,
-            pageNum:1,
-            level:'',
-            location:'',
-            type:'',
-            univerName:'',
-            year:''
-          },
-          tableData:[]
-        }
-      },
-      watch:{
-        universityParams:{
-          immediate:true,
-          deep:true,
-          handler(val){
-            this.tableParams.level=val.levelsRes
-            this.tableParams.location=val.locationsRes
-            this.tableParams.type=val.typeRes
-            this.tableParams.year=val.yearRes
-            this.getUniversityList()
-          }
-        }
+import { selectUniversityList } from '@/api/webApi/shiftLine'
+import MxSearchGroup from '@/components/MxSearch/mx-search-group'
+
+export default {
+  name: 'UniversitiesLineTable',
+  components: {
+    MxSearchGroup
+  },
+  props: {
+    universityParams: {
+      type: Object, default() {
+        return {}
+      }
+    }
+  },
+  data() {
+    return {
+      tableLoading: '',
+      examRecordTotal: 0,
+      tableParams: {
+        pageSize: 20,
+        pageNum: 1,
+        level: '',
+        location: '',
+        type: '',
+        univerName: '',
+        year: ''
       },
-      methods:{
-        clickSuffix(){
-          this.getUniversityList()
-        },
-        getUniversityList(){
-          console.log(this.tableParams)
-          selectUniversityList(this.tableParams).then(res=>{
-            console.log(res)
-            this.tableData=res.rows
-            this.examRecordTotal=res.total
-          })
-        },
-        sizeChange(e){
-          this.tableParams.pageSize=e
-          this.getUniversityList()
-        },
-        currentChange(e){
-          //页数
-          this.tableParams.pageNum=e
-          this.getUniversityList()
-        },
-        goDetails(id){
-          this.$router.push({ name: 'UniversityDetail', params: { id: id } })
-        }
+      tableData: []
+    }
+  },
+  watch: {
+    universityParams: {
+      immediate: true,
+      deep: true,
+      handler(val) {
+        this.tableParams.level = val.levelsRes
+        this.tableParams.location = val.locationsRes
+        this.tableParams.type = val.typeRes
+        this.tableParams.year = val.yearRes
+        this.getUniversityList()
       }
     }
+  },
+  methods: {
+    clickSuffix() {
+      this.getUniversityList()
+    },
+    getUniversityList() {
+      this.tableLoading = true
+      console.log(this.tableParams)
+      selectUniversityList(this.tableParams).then(res => {
+        console.log(res)
+        this.tableData = res.rows
+        this.examRecordTotal = res.total
+      }).finally(_ => {
+        this.tableLoading = false
+      })
+    },
+    sizeChange(e) {
+      this.tableParams.pageSize = e
+      this.getUniversityList()
+    },
+    currentChange(e) {
+      //页数
+      this.tableParams.pageNum = e
+      this.getUniversityList()
+    },
+    goDetails(id) {
+      this.$router.push({ name: 'UniversityDetail', params: { id: id } })
+    }
+  }
+}
 </script>
 
 <style lang="scss">
-  #lineTable{
-    .search{
-      .el-input {
-        .el-input__inner {
-          border-radius: 50px;
-        }
+#lineTable {
+  .search {
+    .el-input {
+      .el-input__inner {
+        border-radius: 50px;
       }
     }
   }
+}
 
 </style>