修改试卷组别逻辑
This commit is contained in:
parent
5d38863f4d
commit
33b290c61f
15
.idea/inspectionProfiles/Project_Default.xml
Normal file
15
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="1">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="scss" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myCustomValuesEnabled" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
@ -28,6 +28,13 @@ const api = {
|
|||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
getExamGroupList: data => { // 获取试卷组别
|
||||||
|
return service({
|
||||||
|
url: '/exam/type',
|
||||||
|
method: 'get',
|
||||||
|
params:data
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
export default api
|
export default api
|
||||||
|
@ -107,7 +107,7 @@ const custom = {
|
|||||||
var m = time.getMonth()+1;
|
var m = time.getMonth()+1;
|
||||||
var d = time.getDate();
|
var d = time.getDate();
|
||||||
const date = `${y}-${m}-${d}`
|
const date = `${y}-${m}-${d}`
|
||||||
console.log(date)
|
// console.log(date)
|
||||||
return date
|
return date
|
||||||
},
|
},
|
||||||
getSTdPerson(num) {
|
getSTdPerson(num) {
|
||||||
|
@ -49,6 +49,9 @@ async function getSubjectList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function addTreeFormatSubject(data) {
|
function addTreeFormatSubject(data) {
|
||||||
|
if(!data) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
data.map( item => {
|
data.map( item => {
|
||||||
item.label = item.name
|
item.label = item.name
|
||||||
item.value = item.id
|
item.value = item.id
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
// import api from '@/api/course'
|
// import api from '@/api/course'
|
||||||
// import com_api from '@/api/common'
|
// import com_api from '@/api/common'
|
||||||
// import WarningBar from '@/components/warningBar/warningBar.vue'
|
// import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||||
import api from '@/api/course'
|
import _ from "lodash"
|
||||||
|
import api from '@/api/examination'
|
||||||
import { ref, onMounted, watch, inject, nextTick } from 'vue'
|
import { ref, onMounted, watch, inject, nextTick } from 'vue'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
@ -12,76 +13,52 @@ const route = useRoute()
|
|||||||
import { useUserStore } from '@/pinia/modules/user'
|
import { useUserStore } from '@/pinia/modules/user'
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
// import chapterCom from '../components/chapter.vue'
|
// import chapterCom from '../components/chapter.vue'
|
||||||
const props = defineProps(['exam_types','exam_id','seleted_arr'])
|
const props = defineProps(['exam_types','exam_id'])
|
||||||
const emit = defineEmits(['addFunc'])
|
const emit = defineEmits(['addFunc'])
|
||||||
|
// const history_num = ref('')
|
||||||
// import { clients, getNowDate } from '@/utils'
|
// import { clients, getNowDate } from '@/utils'
|
||||||
import custom from '@/utils/custom'
|
import custom from '@/utils/custom'
|
||||||
// import { getToken } from '@/utils/auth'
|
// import { getToken } from '@/utils/auth'
|
||||||
// 监听
|
// 监听
|
||||||
watch(props,(val1,val2) => {
|
watch(props,(val1,val2) => {
|
||||||
selected_exam_ids.value = val1.seleted_arr || []
|
has_exam_types.value = _.cloneDeep(val1.exam_types) || []
|
||||||
exam_types.value = val1.exam_types || []
|
|
||||||
})
|
})
|
||||||
// 变量
|
// 变量
|
||||||
const exam_types = ref([])
|
const has_exam_types = ref(_.cloneDeep(props.exam_types) || [])
|
||||||
const selected_exam_ids = ref(props.seleted_arr || [])
|
|
||||||
console.log(props.exam_types)
|
|
||||||
// const headers = ref({ Authorization: 'Bearer ' + getToken() })
|
|
||||||
const drawer = ref(false)
|
const drawer = ref(false)
|
||||||
const queryParams =ref({
|
const queryParams =ref({
|
||||||
page:1,
|
page:1,
|
||||||
pageSize:10,
|
pageSize:10,
|
||||||
version:'',
|
term:'',
|
||||||
type:'',
|
persons:'',
|
||||||
|
examId:''
|
||||||
})
|
})
|
||||||
// const typeList = custom.getExercisesTypeList()
|
|
||||||
const tableData =ref([])
|
const tableData =ref([])
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
const course_ids = ref([])
|
const dfVisible = ref(false)
|
||||||
|
const type_list = ref([])
|
||||||
// 生命周期
|
// 生命周期
|
||||||
const typeList = inject('typeList')
|
|
||||||
// console.log(typeList.value)
|
|
||||||
// const current_subject =getSubjectId(inject('current_subject'))
|
|
||||||
const current_subject_str = inject('current_subject')
|
|
||||||
const current_subject = ref(null)
|
|
||||||
watch(current_subject_str,(val1,val2) => {
|
|
||||||
console.log(val1)
|
|
||||||
queryParams.value.subject = getSubjectId(val1)
|
|
||||||
console.log(queryParams.value.subject)
|
|
||||||
})
|
|
||||||
// queryParams.value.subject = current_subject
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// console.log(headers.value)
|
queryParams.value.examId = props.exam_id
|
||||||
// getCourseList()
|
getExamGroupList()
|
||||||
})
|
})
|
||||||
// 方法
|
// 方法
|
||||||
function getSubjectId(str) {
|
async function getExamGroupList() {
|
||||||
// console.log(str)
|
const res = await api.getExamGroupList(queryParams.value)
|
||||||
let s_id = null
|
|
||||||
for(let item of typeList.value) {
|
|
||||||
if(item.name === str) {
|
|
||||||
s_id = item.id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s_id
|
|
||||||
}
|
|
||||||
async function getCourseList() {
|
|
||||||
const res = await api.getCourseList(queryParams.value)
|
|
||||||
if(res.code === 0) {
|
if(res.code === 0) {
|
||||||
tableData.value = res.data.records
|
type_list.value = res.data.records
|
||||||
total.value = res.data.total
|
total.value = res.data.total
|
||||||
await nextTick()
|
|
||||||
toggleSelection(tableData.value)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function chooseChapterChildExercises() {
|
function chooseChapterChildExercises() {
|
||||||
|
has_exam_types.value = _.cloneDeep(props.exam_types) || []
|
||||||
drawer.value = true
|
drawer.value = true
|
||||||
// getCourseList()
|
|
||||||
onSubmit()
|
onSubmit()
|
||||||
}
|
}
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
queryParams.value.page = 1
|
queryParams.value.page = 1
|
||||||
getCourseList()
|
getExamGroupList()
|
||||||
}
|
}
|
||||||
function onReset() {
|
function onReset() {
|
||||||
queryParams.value = {
|
queryParams.value = {
|
||||||
@ -92,65 +69,165 @@ function onReset() {
|
|||||||
status:'',
|
status:'',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleSelectionChange = (val) => {
|
|
||||||
course_ids.value = val
|
|
||||||
}
|
|
||||||
function handleCurrentChange(val) {
|
function handleCurrentChange(val) {
|
||||||
queryParams.value.page = val
|
queryParams.value.page = val
|
||||||
getCourseList()
|
getExamGroupList()
|
||||||
}
|
}
|
||||||
function handleSizeChange(val) {
|
function handleSizeChange(val) {
|
||||||
queryParams.value.pageSize = val
|
queryParams.value.pageSize = val
|
||||||
getCourseList()
|
getExamGroupList()
|
||||||
}
|
|
||||||
function addFunc() {
|
|
||||||
const list = course_ids.value.map((item,i) => {
|
|
||||||
return item.course_id
|
|
||||||
})
|
|
||||||
emit('addFunc',list)
|
|
||||||
drawer.value = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const multipleTableRef = ref(null)
|
const multipleTableRef = ref(null)
|
||||||
const toggleSelection = (rows) => { // 判断是否被选中
|
function closeDf() {
|
||||||
if (rows) {
|
gform.value = {}
|
||||||
rows.forEach((row) => {
|
dfVisible.value = false
|
||||||
if(selected_exam_ids.value.length>0 && selected_exam_ids.value.includes(row.course_id)) {
|
}
|
||||||
multipleTableRef.value.toggleRowSelection(row, true)
|
// 新增组别
|
||||||
|
const rules = ref({
|
||||||
|
persons: [{ required: true, message: '请输入报名人数', trigger: 'blur' }]
|
||||||
|
})
|
||||||
|
const gform = ref({})
|
||||||
|
const times = ref(1)
|
||||||
|
const dlTitle = ref('新增组别')
|
||||||
|
function addWindow() {
|
||||||
|
edit_flag.value = false
|
||||||
|
openWindow()
|
||||||
|
}
|
||||||
|
function openWindow() {
|
||||||
|
dfVisible.value = true
|
||||||
|
}
|
||||||
|
function oFunc(val) {
|
||||||
|
if(times.value+val<1 || times.value+val>9) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
multipleTableRef.value.toggleRowSelection(row, false)
|
times.value+=val
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
multipleTableRef.value.clearSelection()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function viewCourseFunc(row) { // 查看课程
|
function checkFunc(row) { // 检查合法性
|
||||||
router.push({name:'viewCourse',params:{course_id:row.course_id}})
|
let flag = true
|
||||||
|
for(let item of has_exam_types.value) {
|
||||||
|
if(item.persons == row.persons) { // 相同人数(级别)
|
||||||
|
if( item.expiry_date > Date.parse(new Date())) { // 没有过期
|
||||||
|
flag = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag
|
||||||
|
}
|
||||||
|
function assigntTermFunc() { // 赋值期数
|
||||||
|
let term = 1
|
||||||
|
for(let item of has_exam_types.value) {
|
||||||
|
if(item.persons == gform.value.persons) { // 相同人数(级别)
|
||||||
|
term++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return term
|
||||||
|
}
|
||||||
|
function enterDb() { // 确认新增/编辑
|
||||||
|
if(edit_flag.value) { // 编辑
|
||||||
|
|
||||||
|
}
|
||||||
|
else{ // 新增
|
||||||
|
let f = checkFunc(gform.value)
|
||||||
|
if(!f) { // 有相同人数且没有过期,无法再次创建
|
||||||
|
ElMessage.error('该级别组数已存在!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!edit_flag.value) { // 新增
|
||||||
|
gform.value.term = assigntTermFunc()
|
||||||
|
// 添加临时id
|
||||||
|
gform.value.temp_id = Date.parse(new Date())
|
||||||
|
has_exam_types.value.push(_.cloneDeep(gform.value))
|
||||||
|
type_list.value.push(_.cloneDeep(gform.value))
|
||||||
|
}
|
||||||
|
else{ // 编辑
|
||||||
|
if(gform.value.temp_id) { // 临时数据编辑
|
||||||
|
for(let i=0; i<has_exam_types.value.length;i++ ) {
|
||||||
|
if(has_exam_types.value[i].temp_id && has_exam_types.value[i].temp_id === gform.value.temp_id) {
|
||||||
|
has_exam_types.value[i] = _.cloneDeep(gform.value)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(let i=0; i<type_list.value.length;i++ ) {
|
||||||
|
if(type_list.value[i].temp_id && type_list.value[i].temp_id === gform.value.temp_id) {
|
||||||
|
type_list.value[i] = _.cloneDeep(gform.value)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{ // 根据id编辑
|
||||||
|
for(let i=0; i<has_exam_types.value.length;i++ ) {
|
||||||
|
if(has_exam_types.value[i].exam_id === gform.value.exam_id) {
|
||||||
|
has_exam_types.value[i] = _.cloneDeep(gform.value)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(let i=0; i<type_list.value.length;i++ ) {
|
||||||
|
if(type_list.value[i].exam_id === gform.value.exam_id) {
|
||||||
|
type_list.value[i] = _.cloneDeep(gform.value)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closeDf()
|
||||||
|
}
|
||||||
|
function addFunc() { // 确认提交
|
||||||
|
emit('addFunc',has_exam_types.value)
|
||||||
|
drawer.value = false
|
||||||
|
}
|
||||||
|
function changeFunc() {
|
||||||
|
gform.value.first = gform.value.persons
|
||||||
|
gform.value.second = gform.value.persons*0.04
|
||||||
|
gform.value.third = gform.value.persons*0.01
|
||||||
|
}
|
||||||
|
const edit_flag = ref(false)
|
||||||
|
function editGroupFunc(row) {
|
||||||
|
dlTitle.value = '编辑组别'
|
||||||
|
edit_flag.value = true
|
||||||
|
gform.value = _.cloneDeep(row)
|
||||||
|
openWindow()
|
||||||
|
}
|
||||||
|
function delGroupFunc(row) { // 删除组别
|
||||||
|
let del_index = -1
|
||||||
|
for(let i=0;i<has_exam_types.value.length;i++) {
|
||||||
|
if(has_exam_types.value[i].exam_type_id === row.exam_type_id) {
|
||||||
|
del_index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
has_exam_types.value.splice(del_index,1)
|
||||||
|
// 当前展示列表==
|
||||||
|
let del_index2 = -1
|
||||||
|
for(let i=0;i<type_list.value.length;i++) {
|
||||||
|
if(type_list.value[i].exam_type_id === row.exam_type_id) {
|
||||||
|
del_index2 = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type_list.value.splice(del_index2,1)
|
||||||
|
}
|
||||||
|
function close_draw() {
|
||||||
|
has_exam_types.value = _.cloneDeep(props.exam_types) || []
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-button v-if="selected_exam_ids.length==0" size="small" @click="chooseChapterChildExercises">添加组别</el-button>
|
<el-button v-if="has_exam_types.length==0" size="small" @click="chooseChapterChildExercises">添加组别</el-button>
|
||||||
<el-button v-else size="small" @click="chooseChapterChildExercises" type="plain">点击查看(已选{{selected_exam_ids.length}}组)</el-button>
|
<el-button v-else size="small" @click="chooseChapterChildExercises" type="plain">点击查看(已发布{{has_exam_types.length}}组)</el-button>
|
||||||
<div v-if="url_name">{{url_name}}</div>
|
<el-drawer v-model="drawer" @close="close_draw" title="组别库" size="60%">
|
||||||
<el-drawer v-model="drawer" title="课程库" size="60%">
|
|
||||||
<div class="drawer-section">
|
<div class="drawer-section">
|
||||||
<!-- 搜索框-->
|
<!-- 搜索框-->
|
||||||
<div class="search-box gva-btn-list">
|
<div class="search-box gva-btn-list">
|
||||||
<el-form ref="searchForm" :inline="true" :model="queryParams">
|
<el-form ref="searchForm" :inline="true" :model="queryParams">
|
||||||
<!-- <el-form-item label="分组历史">-->
|
<el-form-item label="分组历史">
|
||||||
<!-- <el-select v-model="queryParams.subject" clearable placeholder="请选择">-->
|
<el-input type="number" v-model="queryParams.term" placeholder="请输入分组历史期数" />
|
||||||
<!-- <el-option-->
|
</el-form-item>
|
||||||
<!-- v-for="item in custom.getExamGroupType()"-->
|
|
||||||
<!-- :key="item.id"-->
|
|
||||||
<!-- :label="item.name"-->
|
|
||||||
<!-- :value="item.id"-->
|
|
||||||
<!-- />-->
|
|
||||||
<!-- </el-select>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<el-form-item label="组别分类">
|
<el-form-item label="组别分类">
|
||||||
<el-select v-model="queryParams.type" clearable placeholder="请选择">
|
<el-select v-model="queryParams.persons" clearable placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in custom.getExamGroupType()"
|
v-for="item in custom.getExamGroupType()"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@ -162,18 +239,13 @@ function viewCourseFunc(row) { // 查看课程
|
|||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
|
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||||
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
|
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
|
||||||
|
<el-button size="small" type="primary" icon="plus" @click="addWindow">新增</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<!-- 数据列表-->
|
<!-- 数据列表-->
|
||||||
<div class="list-box">
|
<div class="list-box">
|
||||||
<el-table ref="multipleTableRef" :data="exam_types">
|
<el-table ref="multipleTableRef" :data="type_list">
|
||||||
<!-- <el-table-column-->
|
|
||||||
<!-- type="selection"-->
|
|
||||||
<!-- width="55"-->
|
|
||||||
<!-- reserve-selection="true"-->
|
|
||||||
<!-- />-->
|
|
||||||
<!-- <el-table-column align="left" label="id" min-width="60" prop="exam_id" sortable="custom" />-->
|
|
||||||
<el-table-column align="left" label="人数级别" min-width="150" prop="persons">
|
<el-table-column align="left" label="人数级别" min-width="150" prop="persons">
|
||||||
<template #default="scope">{{custom.getSTdPerson(scope.row.persons)}}</template>
|
<template #default="scope">{{custom.getSTdPerson(scope.row.persons)}}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -185,7 +257,7 @@ function viewCourseFunc(row) { // 查看课程
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="版本" min-width="150" prop="status">
|
<el-table-column align="left" label="版本" min-width="150" prop="status">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
ver{{scope.row.version}}
|
第{{scope.row.term}}期
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="left" label="报名人数" min-width="150" prop="enroll_num" />
|
<el-table-column align="left" label="报名人数" min-width="150" prop="enroll_num" />
|
||||||
@ -193,12 +265,20 @@ function viewCourseFunc(row) { // 查看课程
|
|||||||
<el-table-column align="left" fixed="right" label="操作" width="200">
|
<el-table-column align="left" fixed="right" label="操作" width="200">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button
|
<el-button
|
||||||
icon="view"
|
icon="edit"
|
||||||
size="small"
|
size="small"
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
@click="viewCourseFunc(scope.row)"
|
@click="editGroupFunc(scope.row)"
|
||||||
>查看</el-button>
|
>编辑</el-button>
|
||||||
|
<el-button
|
||||||
|
icon="delete"
|
||||||
|
size="small"
|
||||||
|
type="danger"
|
||||||
|
link
|
||||||
|
v-if="!checkFunc(scope.row)"
|
||||||
|
@click="delGroupFunc(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -216,13 +296,91 @@ function viewCourseFunc(row) { // 查看课程
|
|||||||
</div>
|
</div>
|
||||||
<!-- 按钮-->
|
<!-- 按钮-->
|
||||||
<div class="btn-box" style="text-align: right">
|
<div class="btn-box" style="text-align: right">
|
||||||
<el-button size="small" type="primary" icon="plus" @click="addFunc">添加</el-button>
|
<el-button size="small" type="primary" @click="addFunc">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
<el-dialog v-model="dfVisible" :before-close="closeDf" :title="dlTitle">
|
||||||
|
<el-form ref="apiForm" :model="gform" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="报名人数" >
|
||||||
|
<el-select @change="changeFunc" v-model="gform.persons" clearable placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in custom.getExamGroupType()"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<div class="more-info-text" v-if="gform.persons">
|
||||||
|
第一名:{{gform.first}}元;第二名:{{gform.second}}元;第三名:{{gform.third}}元。(*满员参加的情况下)
|
||||||
|
</div>
|
||||||
|
<!-- <div class="operator-box" >-->
|
||||||
|
<!-- <div class="ob-btn ob-reduce" @click="oFunc(-1)">-->
|
||||||
|
<!-- <el-icon color="#000"><Minus /></el-icon>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="ob-input">-->
|
||||||
|
<!-- {{times}}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="ob-btn ob-add" @click="oFunc(1)">-->
|
||||||
|
<!-- <el-icon color="#000"><Plus /></el-icon>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="截止时间" >
|
||||||
|
<el-date-picker class="oi-item" style="margin-left:5px"
|
||||||
|
v-model="gform.expiry_date"
|
||||||
|
type="date"
|
||||||
|
placeholder="截至日期"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
|
value-format="x"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="公开时间" >
|
||||||
|
<el-date-picker class="oi-item" style="margin-left:5px"
|
||||||
|
v-model="gform.public_date"
|
||||||
|
type="date"
|
||||||
|
placeholder="截至日期"
|
||||||
|
format="YYYY-MM-DD"
|
||||||
|
value-format="x"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button size="small" @click="closeDf">取 消</el-button>
|
||||||
|
<el-button size="small" type="primary" @click="enterDb">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style>
|
||||||
|
.el-form-item{
|
||||||
|
margin-bottom: 18px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.more-info-text{
|
||||||
|
color: gray;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 0 10px;
|
||||||
|
}
|
||||||
|
.operator-box{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid #dfdfdf;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin-left: 10px;
|
||||||
|
.ob-btn{
|
||||||
|
padding: 0 5px;
|
||||||
|
background: #dfdfdf;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.ob-input{
|
||||||
|
padding: 0 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.drawer-section{
|
.drawer-section{
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,6 @@ function openDialog(type) {
|
|||||||
// router.push({name:'addCourse',params})
|
// router.push({name:'addCourse',params})
|
||||||
}
|
}
|
||||||
async function onDelete() {
|
async function onDelete() {
|
||||||
// console.log(question_ids.value)
|
|
||||||
const ids = exam_ids.value
|
const ids = exam_ids.value
|
||||||
const res = await api.delExamination({ exam_ids:ids })
|
const res = await api.delExamination({ exam_ids:ids })
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
@ -128,15 +127,12 @@ async function onDelete() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleSelectionChange = (val) => {
|
const handleSelectionChange = (val) => {
|
||||||
// console.log(val)
|
|
||||||
exam_ids.value = val.map((item) => {
|
exam_ids.value = val.map((item) => {
|
||||||
return item.exam.exam_id
|
return item.exam.exam_id
|
||||||
})
|
})
|
||||||
// console.log(exam_ids.value)
|
|
||||||
}
|
}
|
||||||
const exam_id = ref(null)
|
const exam_id = ref(null)
|
||||||
function editCourseFunc(row) {
|
function editCourseFunc(row) {
|
||||||
console.log(row)
|
|
||||||
// row.exam.course_ids = JSON.parse(row.exam.course_ids)
|
// row.exam.course_ids = JSON.parse(row.exam.course_ids)
|
||||||
// row.exam.question_ids = JSON.parse(row.exam.question_ids)
|
// row.exam.question_ids = JSON.parse(row.exam.question_ids)
|
||||||
exam_id.value = row.exam.exam_id
|
exam_id.value = row.exam.exam_id
|
||||||
@ -155,7 +151,6 @@ function editCourseFunc(row) {
|
|||||||
openDialog('edit')
|
openDialog('edit')
|
||||||
}
|
}
|
||||||
function deleteExamFunc(row) {
|
function deleteExamFunc(row) {
|
||||||
// console.log(row); return
|
|
||||||
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
@ -189,7 +184,6 @@ function closeDialog(){
|
|||||||
form.value = {}
|
form.value = {}
|
||||||
}
|
}
|
||||||
async function enterDialog() { // 提交
|
async function enterDialog() { // 提交
|
||||||
// console.log(Object.keys(std_group.value))
|
|
||||||
form.value.teacher_id = 0
|
form.value.teacher_id = 0
|
||||||
form.value.exam_type = exam_types.value.map((item) => {
|
form.value.exam_type = exam_types.value.map((item) => {
|
||||||
for(let prop in item) {
|
for(let prop in item) {
|
||||||
@ -208,7 +202,6 @@ async function enterDialog() { // 提交
|
|||||||
}
|
}
|
||||||
params.question_ids = JSON.stringify(form.value.question_ids)
|
params.question_ids = JSON.stringify(form.value.question_ids)
|
||||||
params.course_ids = JSON.stringify(form.value.course_ids)
|
params.course_ids = JSON.stringify(form.value.course_ids)
|
||||||
// console.log(params)
|
|
||||||
// return
|
// return
|
||||||
let func_name = 'addExamination'
|
let func_name = 'addExamination'
|
||||||
if(form.value.exam_id) { // 编辑
|
if(form.value.exam_id) { // 编辑
|
||||||
@ -228,7 +221,6 @@ function viewCourseFunc(row) { // 查看课程
|
|||||||
router.push({name:'viewCourse',params:{question_id:row.question_id}})
|
router.push({name:'viewCourse',params:{question_id:row.question_id}})
|
||||||
}
|
}
|
||||||
function getExercisesName(row) {
|
function getExercisesName(row) {
|
||||||
// console.log(JSON.parse(row.question))
|
|
||||||
return JSON.parse(row.question).title
|
return JSON.parse(row.question).title
|
||||||
}
|
}
|
||||||
// const std_options_title = ref(['A','B','C','D','E','F'])
|
// const std_options_title = ref(['A','B','C','D','E','F'])
|
||||||
@ -274,8 +266,8 @@ function addExercisesFunc(data) {
|
|||||||
function addCourseFunc(data) {
|
function addCourseFunc(data) {
|
||||||
form.value.course_ids = data
|
form.value.course_ids = data
|
||||||
}
|
}
|
||||||
function addGroupFunc() {
|
function addGroupFunc(data) {
|
||||||
|
exam_types.value = _.clone(data)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
@ -414,48 +406,47 @@ function addGroupFunc() {
|
|||||||
<el-form-item label="测试时长" >
|
<el-form-item label="测试时长" >
|
||||||
<el-input type="number" v-model="form.duration" placeholder="请输入测试时长(分钟)" />
|
<el-input type="number" v-model="form.duration" placeholder="请输入测试时长(分钟)" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="测试组别" >-->
|
||||||
|
<!-- <div class="options-box" style="width: 100%">-->
|
||||||
|
<!-- <div class="option-item" v-if="exam_types.length>0" v-for="(item,i) in exam_types">-->
|
||||||
|
<!-- <el-form :model="item" >-->
|
||||||
|
<!-- <div class="oi-row">-->
|
||||||
|
<!-- <div class="oi-item">{{i+1}}</div>-->
|
||||||
|
<!-- <el-input class="oi-item" type="number" style="margin-left:5px;width: 30%" v-model="item.persons" placeholder="请输入组别人数" />-->
|
||||||
|
<!-- <el-date-picker class="oi-item" style="margin-left:5px"-->
|
||||||
|
<!-- v-model="item.expiry_date"-->
|
||||||
|
<!-- type="date"-->
|
||||||
|
<!-- placeholder="截至日期"-->
|
||||||
|
<!-- format="YYYY-MM-DD"-->
|
||||||
|
<!-- value-format="x"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- <el-date-picker class="oi-item" style="margin-left:5px"-->
|
||||||
|
<!-- v-model="item.public_date"-->
|
||||||
|
<!-- type="date"-->
|
||||||
|
<!-- placeholder="成绩公布日期"-->
|
||||||
|
<!-- format="YYYY-MM-DD"-->
|
||||||
|
<!-- value-format="x"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- <el-icon class="oi-item" style="margin-left: 5px;cursor: pointer" @click="delet_func(i)"><Delete /></el-icon>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="reward-box">-->
|
||||||
|
<!-- <el-form-item class="rb-item" style="margin-right:10px;display: flex" label="第一名">-->
|
||||||
|
<!-- <el-input style="width:auto;margin-right: 5px" type="number" v-model="item.first" placeholder="请输入第一名奖励" /><div>元</div>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<!-- <el-form-item class="rb-item" style="margin-right:10px;" label="第二名">-->
|
||||||
|
<!-- <el-input style="width:auto;margin-right: 5px" type="number" v-model="item.second" placeholder="请输入第二名奖励" />元-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<!-- <el-form-item class="rb-item" style="margin-right:10px;" label="第三名">-->
|
||||||
|
<!-- <el-input style="width:auto;margin-right: 5px" type="number" v-model="item.third" placeholder="请输入第三名奖励" />元-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </el-form>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <el-button @click="addOptionFunc">添加组别</el-button>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </el-form-item>-->
|
||||||
<el-form-item label="测试组别" >
|
<el-form-item label="测试组别" >
|
||||||
<!-- <el-input v-model="form.score" placeholder="请输入分值" />-->
|
<groupPool @addFunc="addGroupFunc" :exam_types="exam_types" :exam_id="form.exam_id" />
|
||||||
<div class="options-box" style="width: 100%">
|
|
||||||
<div class="option-item" v-if="exam_types.length>0" v-for="(item,i) in exam_types">
|
|
||||||
<el-form :model="item" >
|
|
||||||
<div class="oi-row">
|
|
||||||
<div class="oi-item">{{i+1}}</div>
|
|
||||||
<el-input class="oi-item" type="number" style="margin-left:5px;width: 30%" v-model="item.persons" placeholder="请输入组别人数" />
|
|
||||||
<el-date-picker class="oi-item" style="margin-left:5px"
|
|
||||||
v-model="item.expiry_date"
|
|
||||||
type="date"
|
|
||||||
placeholder="截至日期"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="x"
|
|
||||||
/>
|
|
||||||
<el-date-picker class="oi-item" style="margin-left:5px"
|
|
||||||
v-model="item.public_date"
|
|
||||||
type="date"
|
|
||||||
placeholder="成绩公布日期"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="x"
|
|
||||||
/>
|
|
||||||
<el-icon class="oi-item" style="margin-left: 5px;cursor: pointer" @click="delet_func(i)"><Delete /></el-icon>
|
|
||||||
</div>
|
|
||||||
<div class="reward-box">
|
|
||||||
<el-form-item class="rb-item" style="margin-right:10px;display: flex" label="第一名">
|
|
||||||
<el-input style="width:auto;margin-right: 5px" type="number" v-model="item.first" placeholder="请输入第一名奖励" /><div>元</div>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item class="rb-item" style="margin-right:10px;" label="第二名">
|
|
||||||
<el-input style="width:auto;margin-right: 5px" type="number" v-model="item.second" placeholder="请输入第二名奖励" />元
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item class="rb-item" style="margin-right:10px;" label="第三名">
|
|
||||||
<el-input style="width:auto;margin-right: 5px" type="number" v-model="item.third" placeholder="请输入第三名奖励" />元
|
|
||||||
</el-form-item>
|
|
||||||
</div>
|
|
||||||
</el-form>
|
|
||||||
</div>
|
|
||||||
<el-button @click="addOptionFunc">添加组别</el-button>
|
|
||||||
</div>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="测试组别" >
|
|
||||||
<groupPool @addFunc="addGroupFunc" :exam_types="exam_types" :exam_id="exam_id" :seleted_arr="exam_type_ids" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="添加习题" >
|
<el-form-item label="添加习题" >
|
||||||
<exercisesPool @addFunc="addExercisesFunc" :seleted_arr="form.question_ids" />
|
<exercisesPool @addFunc="addExercisesFunc" :seleted_arr="form.question_ids" />
|
||||||
|
Loading…
Reference in New Issue
Block a user