|
@@ -3,18 +3,18 @@
|
|
<template #header>
|
|
<template #header>
|
|
<div class="fx-row fx-bet-cen">
|
|
<div class="fx-row fx-bet-cen">
|
|
选科报名表
|
|
选科报名表
|
|
- <el-button>选科历史记录</el-button>
|
|
|
|
|
|
+ <el-button>选科历史记录</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
- <mx-table :propDefines="propDefines" :rows="formatList">
|
|
|
|
|
|
+ <mx-table :propDefines="formatTable.cols" :rows="formatTable.rows">
|
|
<template #temp="{row}">
|
|
<template #temp="{row}">
|
|
<span class="btn-blue mr5" @click="toSelectSub(row)">选择</span>
|
|
<span class="btn-blue mr5" @click="toSelectSub(row)">选择</span>
|
|
<span class="btn-green">查看记录</span>
|
|
<span class="btn-green">查看记录</span>
|
|
<!-- <el-button>查看</el-button>-->
|
|
<!-- <el-button>查看</el-button>-->
|
|
</template>
|
|
</template>
|
|
<template #proportion="{row}">
|
|
<template #proportion="{row}">
|
|
- <span :style="{color: row.personInTime > row.personCount ? 'red' : '#42b983'}">{{row.personInTime}}</span>
|
|
|
|
- <span >/{{row.personCount}}</span>
|
|
|
|
|
|
+ <span :style="{color: row.personInTime > row.personCount ? 'red' : '#42b983'}">{{ row.personInTime }}</span>
|
|
|
|
+ <span>/{{ row.personCount }}</span>
|
|
</template>
|
|
</template>
|
|
<template #signUp="{row}">
|
|
<template #signUp="{row}">
|
|
<span class="btn-red" v-if="row.selected" @click="toUnSelect(row)">取消报名</span>
|
|
<span class="btn-red" v-if="row.selected" @click="toUnSelect(row)">取消报名</span>
|
|
@@ -23,20 +23,22 @@
|
|
<template #subjects="{row}">
|
|
<template #subjects="{row}">
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="8" v-for="subject in row.subjects">
|
|
<el-col :span="8" v-for="subject in row.subjects">
|
|
- <el-tag type="success" class="mr10 mb10" >{{ subject[0] }}</el-tag>
|
|
|
|
|
|
+ <el-tag type="success" class="mr10 mb10">{{ subject[0] }}</el-tag>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</template>
|
|
</template>
|
|
<template #colleges="{row}">
|
|
<template #colleges="{row}">
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="12" v-for="college in row.colleges">
|
|
<el-col :span="12" v-for="college in row.colleges">
|
|
- <el-tag type="success" class="mb10">{{ college.major[0] }}</el-tag>:
|
|
|
|
|
|
+ <el-tag type="success" class="mb10">{{ college.major[0] }}</el-tag>
|
|
|
|
+ :
|
|
<span>{{ college.college }}</span>
|
|
<span>{{ college.college }}</span>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</template>
|
|
</template>
|
|
</mx-table>
|
|
</mx-table>
|
|
- <p>您的选科志愿: <span v-for="(item,index) in selectedList" >{{item.groupName}}{{index+1 < selectedList.length ? '、' : '' }}</span></p>
|
|
|
|
|
|
+ <p>您的选科志愿: <span v-for="(item,index) in selectedList"
|
|
|
|
+ >{{ item.groupName }}{{ index + 1 < selectedList.length ? '、' : '' }}</span></p>
|
|
<!-- 拖拽 -->
|
|
<!-- 拖拽 -->
|
|
<test-drage ref="drage" :sortList="selectedList"></test-drage>
|
|
<test-drage ref="drage" :sortList="selectedList"></test-drage>
|
|
<el-button @click="commit" type="primary">提交</el-button>
|
|
<el-button @click="commit" type="primary">提交</el-button>
|
|
@@ -56,10 +58,9 @@
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
import MxSelectTranslate from '@/components/Cache/modules/mx-select-translate-mixin.js'
|
|
import MxSelectTranslate from '@/components/Cache/modules/mx-select-translate-mixin.js'
|
|
-import { formatSubject } from '@/utils/index'
|
|
|
|
-import TestDrage from './test-drage'
|
|
|
|
-import VueEsign from '@/components/VueEsign/index'
|
|
|
|
-import ChooseSubjectDialog from './choose-subject-dialog'
|
|
|
|
|
|
+import TestDrage from './test-drage'
|
|
|
|
+import VueEsign from '@/components/VueEsign/index'
|
|
|
|
+import ChooseSubjectDialog from './choose-subject-dialog'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -67,14 +68,48 @@ export default {
|
|
VueEsign,
|
|
VueEsign,
|
|
ChooseSubjectDialog
|
|
ChooseSubjectDialog
|
|
},
|
|
},
|
|
- mixins:[MxSelectTranslate],
|
|
|
|
|
|
+ mixins: [MxSelectTranslate],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- list: [],
|
|
|
|
preferenceCount: 3,
|
|
preferenceCount: 3,
|
|
optionalMajors: [],
|
|
optionalMajors: [],
|
|
dialogVisible: false,
|
|
dialogVisible: false,
|
|
- propDefines: {
|
|
|
|
|
|
+ modelsWrapper: {},
|
|
|
|
+ selectedList: []
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ formatTable() {
|
|
|
|
+ if (!this.modelsWrapper.models) return {}
|
|
|
|
+ if (!this.optionalMajors) return {}
|
|
|
|
+ // 行
|
|
|
|
+ const rows = this.modelsWrapper.models.map(item => {
|
|
|
|
+ item.allowSelect = item.allowSelect ? '报名中' : '无法报名'
|
|
|
|
+ item.subjects = this.optionalMajors.filter(college => {
|
|
|
|
+ if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
|
|
|
|
+ }).map(item => item.majorCategoryName)
|
|
|
|
+ item.colleges = this.optionalMajors.filter(college => {
|
|
|
|
+ if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
|
|
|
|
+ }).map(item => {
|
|
|
|
+ return {
|
|
|
|
+ college: item.collegeName,
|
|
|
|
+ major: item.majorCategoryName
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return item
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // 列
|
|
|
|
+ const statCols = {}
|
|
|
|
+ this.modelsWrapper.statColumns.map((column, index) => {
|
|
|
|
+ const prop = 'statistic_' + index
|
|
|
|
+ statCols[prop] = { label: column.name }
|
|
|
|
+ rows.forEach((row) => {
|
|
|
|
+ const descriptors = column.groupDescriptors.find(desc => desc.groupId == row.groupId) || []
|
|
|
|
+ row[prop] = `${descriptors.descriptors[0].value} / ${descriptors.descriptors[1].value}`
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ const cols = {
|
|
index: {
|
|
index: {
|
|
type: 'index',
|
|
type: 'index',
|
|
label: '编号'
|
|
label: '编号'
|
|
@@ -98,6 +133,7 @@ export default {
|
|
rankInGrade: {
|
|
rankInGrade: {
|
|
label: '选科全校排名'
|
|
label: '选科全校排名'
|
|
},
|
|
},
|
|
|
|
+ ...statCols,
|
|
allowSelect: {
|
|
allowSelect: {
|
|
label: '报名状态'
|
|
label: '报名状态'
|
|
},
|
|
},
|
|
@@ -119,55 +155,35 @@ export default {
|
|
signUp: {
|
|
signUp: {
|
|
label: '操作',
|
|
label: '操作',
|
|
slot: 'signUp',
|
|
slot: 'signUp',
|
|
- width:'100',
|
|
|
|
|
|
+ width: '100',
|
|
fixed: 'right'
|
|
fixed: 'right'
|
|
}
|
|
}
|
|
- },
|
|
|
|
- selectedList: []
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- computed: {
|
|
|
|
- formatList() {
|
|
|
|
- if (!this.list.length) return []
|
|
|
|
- if (!this.optionalMajors.length) return []
|
|
|
|
- // 格式化
|
|
|
|
- return this.list.map(item => {
|
|
|
|
- item.allowSelect = item.allowSelect ? '报名中' : '无法报名'
|
|
|
|
- item.subjects = this.optionalMajors.filter(college => {
|
|
|
|
- if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
|
|
|
|
- }).map(item => item.majorCategoryName)
|
|
|
|
- item.colleges = this.optionalMajors.filter(college => {
|
|
|
|
- if (college.matchedGroupIds.indexOf(item.groupId) != -1) return college.majorCategoryName
|
|
|
|
- }).map(item => {
|
|
|
|
- return {
|
|
|
|
- college: item.collegeName,
|
|
|
|
- major: item.majorCategoryName
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- // 增加 course0 course1
|
|
|
|
- item.course0 = this.translateCourse0(item.groupId)
|
|
|
|
- item.course1 = this.translateCourse1(item.groupId)
|
|
|
|
- return item
|
|
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ return {
|
|
|
|
+ rows,
|
|
|
|
+ cols
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
commit() {
|
|
commit() {
|
|
console.log(this.selectedList)
|
|
console.log(this.selectedList)
|
|
- const real = this.selectedList.filter(item=> {return item.selected == true})
|
|
|
|
- if(real.length < this.preferenceCount) {
|
|
|
|
|
|
+ const real = this.selectedList.filter(item => {
|
|
|
|
+ return item.selected == true
|
|
|
|
+ })
|
|
|
|
+ if (real.length < this.preferenceCount) {
|
|
this.$message.warning(`您要选择${this.preferenceCount}个志愿`)
|
|
this.$message.warning(`您要选择${this.preferenceCount}个志愿`)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
},
|
|
},
|
|
toSelect(row) {
|
|
toSelect(row) {
|
|
- const count = this.list.reduce((prev,cur) => {
|
|
|
|
|
|
+ const count = this.modelsWrapper.models.reduce((prev, cur) => {
|
|
return prev += cur.selected ? 1 : 0
|
|
return prev += cur.selected ? 1 : 0
|
|
- },0)
|
|
|
|
|
|
+ }, 0)
|
|
console.log(count)
|
|
console.log(count)
|
|
- if(count >= this.preferenceCount) {
|
|
|
|
|
|
+ if (count >= this.preferenceCount) {
|
|
this.$message.warning(`最多选择${this.preferenceCount}个志愿`)
|
|
this.$message.warning(`最多选择${this.preferenceCount}个志愿`)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -184,50 +200,37 @@ export default {
|
|
row.selected = false
|
|
row.selected = false
|
|
this.selectedList.splice(
|
|
this.selectedList.splice(
|
|
this.selectedList.indexOf(this.selectedList.find((selected) => {
|
|
this.selectedList.indexOf(this.selectedList.find((selected) => {
|
|
- return selected.groupId === row.groupId }
|
|
|
|
|
|
+ return selected.groupId === row.groupId
|
|
|
|
+ }
|
|
)
|
|
)
|
|
- ), 1);
|
|
|
|
|
|
+ ), 1)
|
|
this.$refs.drage.init(this.selectedList)
|
|
this.$refs.drage.init(this.selectedList)
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
this.$message({
|
|
this.$message({
|
|
type: 'info',
|
|
type: 'info',
|
|
message: '已取消'
|
|
message: '已取消'
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ })
|
|
|
|
+ })
|
|
},
|
|
},
|
|
- toSelectSub(row) {
|
|
|
|
- // // 首选科目
|
|
|
|
- // const groupArr = row.groupName.split('').map(item => {
|
|
|
|
- // return formatSubject(item)
|
|
|
|
- // })
|
|
|
|
- // const firstSub = groupArr[0] // 首选科目
|
|
|
|
- // const lastSub = groupArr.splice(1, 2) // 次选科目
|
|
|
|
- // console.log(groupArr)
|
|
|
|
- // console.log(firstSub)
|
|
|
|
- // console.log(lastSub)
|
|
|
|
|
|
+ toSelectSub(row) {
|
|
// 打开选科弹窗
|
|
// 打开选科弹窗
|
|
- this.$refs.chooseDialog.open(row.course0,row.course1)
|
|
|
|
|
|
+ const course0 = this.translateCourse0(row.groupId)
|
|
|
|
+ const course1 = this.translateCourse1(row.groupId)
|
|
|
|
+ this.$refs.chooseDialog.open(course0, course1)
|
|
},
|
|
},
|
|
init(list) {
|
|
init(list) {
|
|
console.log(list)
|
|
console.log(list)
|
|
-
|
|
|
|
- console.log(formatSubject('物'))
|
|
|
|
- this.list = list
|
|
|
|
|
|
+ this.modelsWrapper = list
|
|
},
|
|
},
|
|
initOption(optionalMajors) {
|
|
initOption(optionalMajors) {
|
|
console.log(optionalMajors)
|
|
console.log(optionalMajors)
|
|
this.optionalMajors = optionalMajors
|
|
this.optionalMajors = optionalMajors
|
|
}
|
|
}
|
|
- // async getOptionalMajors() {
|
|
|
|
- // const res = await getOptionalMajors()
|
|
|
|
- // this.optionalMajors = res.data
|
|
|
|
- // console.log(res)
|
|
|
|
- // }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
<style scoped>
|
|
<style scoped>
|
|
-.cell .el-tag{
|
|
|
|
|
|
+.cell .el-tag {
|
|
margin-right: 5px;
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|