123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- <template>
- <div >
- <div class="content-box">
- <div>
- <el-row class="radioInput">
- <div>
- <span class="radiaTitle">年份:</span>
- </div>
- <el-radio-group v-model="selected.years" @change="yearChange">
- <el-radio-button
- v-for="item in form.years"
- :key="item"
- :label="item"
- style="margin-bottom: 10px"
- ></el-radio-button>
- </el-radio-group>
- </el-row>
- <el-row class="radioInput radioScience">
- <div v-if="selectCourse.course0 ? selectCourse.course0.length : selectCourse.course0" class="fx-row">
- <span class="radiaTitle">首选科目:</span>
- <el-checkbox-group v-model="selected.sciences[0]" @change="onScienceChanged" size="mini" :max="1">
- <el-checkbox-button v-for="item in selectCourse.course0" :key="item" :label="item">
- {{item}}
- </el-checkbox-button>
- </el-checkbox-group>
- </div>
- <div class="fx-row">
- <span class="radiaTitle">{{ gkType == 1 ? '再选科目' : '选科科目' }}:</span>
- <el-checkbox-group v-model="selected.sciences[1]" @change="onScienceChanged" size="mini" :max="gkType == 1 ? 2 : 3">
- <el-checkbox-button v-for="item in selectCourse.course1" :key="item" :label="item">
- {{item}}
- </el-checkbox-button>
- </el-checkbox-group>
- </div>
- </el-row>
- <filter-form :filter="filter_form"></filter-form>
- </div>
- <div class="content">
- <mx-search-group class="mb10" justify="end" :span="12" v-model="keyword" placeholder="请输入内容" @search="httpGetXkcxList"
- ></mx-search-group>
- <div class="concerned-college-container" v-loading="loading">
- <mx-table :rows="dataList" :propDefines="propDefines">
- <template #collect="{ row }">
- <img
- class="college-icon"
- v-if="row.collect"
- @click="httpCollectRemove(row)"
- src="@/assets/images/subject/icon_shoucang_pre.png"
- />
- <img
- class="college-icon"
- v-else
- @click="httpCollectAdd(row)"
- src="@/assets/images/subject/icon_shoucang_n.png"
- />
- </template>
- <template #select="{ row }">
- <div @click="saveCourseCollect(row)">
- <i class="el-icon el-icon-success" style="color: #42b983" v-if="row.isSelectCourse"></i>
- <i class="el-icon el-icon-success" v-else></i>
- </div>
- </template>
- </mx-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="pageNum"
- :limit.sync="pageSize"
- :page-size="20"
- @pagination="onChangePage"
- />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {collectAdd, collectRemove, xkcxlist, xkcxYears,saveSelectCourse,getSelectCourse} from "@/api/webApi/webQue";
- import MxSearchGroup from "@/components/MxSearch/mx-search-group";
- import FilterForm from '@/views/career/components/FilterForm';
- export default {
- props: {
- course0:{
- type: String,
- default: ''
- },
- course1:{
- type: String,
- default: ''
- },
- readonly: {
- type: Boolean,
- default: false
- }
- },
- components : {
- MxSearchGroup,
- FilterForm
- },
- data() {
- return {
- // 初始条件
- form: {
- years: [],
- },
- selectCourse:{},
- gkType: 1, // 1 4选2 2 6选3
- filter_form:{
- location:'',
- natureTypeCN:'',
- type:'',
- level:'',
- features:'',
- },
- // 选中条件
- selected: { years:'', sciences:[[],[]]},
- pageNum: 1,
- pageSize: 20,
- total: 0,
- loading: false,
- keyword: "",
- // 查询结果
- dataList: [],
- isShowTabl: true,
- propDefines: {
- universityName: {
- label: "院校名称",
- },
- marjorName: {
- label: "专业(类)名称",
- },
- marjorBelongs: {
- label: "专业备注",
- align: "left",
- },
- level: {
- label: "专业层次",
- },
- courseRemark0: {
- label: "首选科目范围",
- align: "left",
- },
- courseRemark1: {
- label: "再选科目范围",
- align: "left",
- },
- year: {
- label: "年份",
- align: "left",
- },
- collect: {
- hidden: this.readonly,
- label: "收藏",
- align: "left",
- slot: "collect",
- width: "100px",
- },
- subjectCollect: {
- hidden: this.readonly,
- label: "选科收藏",
- align: "left",
- slot: "select",
- width: "100px",
- },
- },
- };
- },
- watch:{
- filter_form:{
- deep:true,
- handler(val) {
- this.httpGetXkcxList()
- }
- },
- },
- created() {
- this.selected.sciences[0] = this.course0 ? [this.course0] : []
- this.selected.sciences[1] = this.course1? this.course1.split(',') :[]
- if(this.course0 && this.course1) this.httpGetXkcxList()
- this.getYears();
- this.getSelectCourse()
- },
- methods: {
- getSelectCourse(){
- getSelectCourse().then(res => {
- this.selectCourse = res.data
- if(!res.data.course0.length) {
- this.gkType = 2
- }else {
- this.gkType = 1
- }
- })
- },
- // 有效年份
- getYears() {
- xkcxYears().then((res) => {
- this.form.years = res.data || [];
- this.selected.years = this.form.years[0]
- });
- },
- yearChange(value) {
- this.httpGetXkcxList();
- },
- onScienceChanged(value) {
- this.httpGetXkcxList();
- },
- httpGetXkcxList() {
- const course = [...this.selected.sciences[0],...this.selected.sciences[1]]
- if (course.length<3) return;
- //console.log(this.selected);return;
- this.loading = true
- xkcxlist({
- keyword: this.keyword,
- course0: this.selected.sciences[0].toString(),
- course1: this.selected.sciences[1].toString(),
- year: this.selected.years.toString(),
- ...this.filter_form,
- pageNum: this.pageNum,
- marjors: [],
- pageSize: this.pageSize,
- })
- .then((res) => {
- this.dataList = res.rows;
- this.total = res.total;
- this.isShowTable = true;
- })
- .catch((err) => {
- console.log("请求出错!");
- this.cleanSchoolSelect();
- }).finally(() => {
- this.loading = false
- })
- },
- onChangePage(page) {
- this.pageSize = page.limit;
- this.pageNum = page.page;
- this.httpGetXkcxList();
- },
- // 收藏
- httpCollectAdd(row) {
- row.collect = true;
- collectAdd({
- refId: row.id,
- });
- },
- // 选科收藏 取消和收藏
- saveCourseCollect(row) {
- saveSelectCourse({
- refId:row.id,
- isSelectCourse: !row.isSelectCourse
- }).then(res =>{
- if(res.code== 200){
- row.isSelectCourse = !row.isSelectCourse
- this.$message.success(res.msg)
- }
- })
- },
- // 取消收藏
- httpCollectRemove(row) {
- row.collect = false;
- collectRemove({
- refId: row.id,
- });
- },
- },
- };
- </script>
- <style scoped>
- .el-icon-success{
- cursor: pointer;
- }
- .college-icon {
- cursor: pointer;
- }
- .search_header {
- margin-left: auto;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: flex-end;
- position: relative;
- margin-right: 20px;
- }
- .search_header img {
- position: absolute;
- right: 20px;
- cursor: pointer;
- top: 6px;
- }
- .search_header input {
- background: #f7f7ff;
- border-radius: 20px;
- border: 1px solid #c6cbf5;
- outline: none;
- width: 340px;
- height: 32px;
- padding-left: 24px;
- }
- .popup-item-title span {
- font-size: 14px;
- font-weight: 500;
- }
- </style>
- <style lang="scss" scoped>
- .layui-bg-orange {
- background-color: var(--themeColor);
- margin-left: 0;
- }
- </style>
- <style lang="scss">
- .el-checkbox-button {
- margin-bottom: 10px;
- .el-checkbox-button__inner {
- font-size: 14px;
- }
- }
- .radioInput {
- background-color: #ffffff;font-size: 14px;padding:5px;
- .el-radio {
- .el-radio__input {
- display: none;
- }
- }
- }
- .radioInput.radioScience {
- .el-radio-button {
- border: 1px solid #47C6A2;
- border-radius: 3px;
- margin-right: 10px;
- }
- }
- .radioInput {
- display: flex;
- .el-radio-button .el-radio-button__inner {
- border-radius: 4px !important;
- border: none;
- padding: 5px 10px !important;
- font-weight: 400;
- font-family: PingFangSC-Regular, PingFang SC;
- }
- .el-radio-button__orig-radio:checked + .el-radio-button__inner {
- box-shadow: none;
- }
- .radiaTitle {
- display: inline-block;
- width: 80px;
- font-size: 14px;
- text-align: right;
- margin-top: 2px;
- margin-right: 10px;
- }
- }
- //.radioInput02 {
- // display: flex;
- // align-items: center;
- // .radiaTitle {
- // display: inline-block;
- // width: 130px;
- // font-size: 14px;
- // text-align: right;
- // margin-top: 2px;
- // }
- // .el-input--medium .el-input__inner {
- // border-radius: 50px;
- // }
- //}
- </style>
|