change workscope
This commit is contained in:
parent
762b9616ff
commit
781ea35fe2
|
@ -34,3 +34,38 @@ export function deleteTestRule(id) {
|
|||
method: 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
export function getWorkScopeAll() {
|
||||
return request({
|
||||
url: '/examtest/workscope/',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function getWorkScopDetail(id){
|
||||
return request({
|
||||
url: `/examtest/workscope/${id}/`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function createWorkScope(data) {
|
||||
return request({
|
||||
url: '/examtest/workscope/',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updateWorkScope(id, data) {
|
||||
return request({
|
||||
url: `/examtest/workscope/${id}/`,
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function deleteWorkScope(id) {
|
||||
return request({
|
||||
url: `/examtest/workscope/${id}/`,
|
||||
method: 'delete',
|
||||
})
|
||||
}
|
|
@ -101,7 +101,7 @@ export const asyncRoutes = [
|
|||
path: 'questioncat',
|
||||
name: 'questioncat',
|
||||
component: () => import('@/views/question/questioncat.vue'),
|
||||
meta: { title: '题库分类', icon: '', perms: ['questioncat_manage'] }
|
||||
meta: { title: '科目分类', icon: '', perms: ['questioncat_manage'] }
|
||||
},
|
||||
{
|
||||
path: 'question',
|
||||
|
@ -116,13 +116,19 @@ export const asyncRoutes = [
|
|||
component: Layout,
|
||||
redirect: '/sjmanage/',
|
||||
name: 'Sjmanage',
|
||||
meta: { title: '试卷管理', icon: 'component'},
|
||||
meta: { title: '出卷管理', icon: 'component'},
|
||||
children: [
|
||||
{
|
||||
path: 'testrule',
|
||||
name: 'TestRule',
|
||||
component: () => import('@/views/examtest/rule.vue'),
|
||||
meta: { title: '模考规则', icon: '', perms: ['testrule_manage'] },
|
||||
meta: { title: '试卷结构', icon: '', perms: ['testrule_manage'] },
|
||||
},
|
||||
{
|
||||
path: 'workscope',
|
||||
name: 'workscope',
|
||||
component: () => import('@/views/examtest/workscope.vue'),
|
||||
meta: { title: '工作类别', icon: '', perms: ['workscope_manage'] },
|
||||
},
|
||||
{
|
||||
path: 'testpaper',
|
||||
|
@ -134,14 +140,28 @@ export const asyncRoutes = [
|
|||
path: 'testrule/create',
|
||||
name: 'CreateRule',
|
||||
component: () => import('@/views/examtest/rulecreate.vue'),
|
||||
meta: { title: '新建模考规则', noCache: true, icon: '', perms: ['testrule_add']},
|
||||
meta: { title: '新建试卷结构', noCache: true, icon: '', perms: ['testrule_add']},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'testrule/update',
|
||||
name: 'UpdateRule',
|
||||
component: () => import('@/views/examtest/ruleupdate.vue'),
|
||||
meta: { title: '编辑模考规则', noCache: true, icon: '', perms: ['testrule_update']},
|
||||
meta: { title: '编辑试卷结构', noCache: true, icon: '', perms: ['testrule_update']},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'workscope/create',
|
||||
name: 'CreateWorkscope',
|
||||
component: () => import('@/views/examtest/workscopecreate.vue'),
|
||||
meta: { title: '新建工作类别', noCache: true, icon: '', perms: ['workscope_add']},
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: 'workscope/update',
|
||||
name: 'UpdateWorkscope',
|
||||
component: () => import('@/views/examtest/workscopeupdate.vue'),
|
||||
meta: { title: '编辑工作类别', noCache: true, icon: '', perms: ['workscope_update']},
|
||||
hidden: true
|
||||
},
|
||||
]
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
v-if="scope.row.company_name != null"
|
||||
>{{ scope.row.company_name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="缴费科目">
|
||||
<el-table-column align="center" label="缴费学科">
|
||||
<template slot-scope="scope" >
|
||||
<el-tag
|
||||
v-for="item in scope.row.subjects_name"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div style="margin-top:10px">
|
||||
<el-input
|
||||
v-model="search"
|
||||
placeholder="输入规则名称进行搜索"
|
||||
placeholder="输入名称进行搜索"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
|
@ -23,14 +23,6 @@
|
|||
<el-table-column align="center" label="名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="简述">
|
||||
<template slot-scope="scope">{{ scope.row.desc }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所属学科">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" v-if="scope.row.subject">{{scope.row.subject.name}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.create_time }}</span>
|
||||
|
@ -97,7 +89,7 @@ export default {
|
|||
this.$router.push({path:"/sjmanage/testrule/update",query:{id:scope.row.id}})
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm('此操作将永久删除该规则, 是否继续?', '提示', {
|
||||
this.$confirm('确认删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
|
|
|
@ -7,46 +7,22 @@
|
|||
label-width="100px"
|
||||
status-icon
|
||||
>
|
||||
<el-form-item label="规则名称" prop="name">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="Form.name" style="width:400px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则简述" prop="desc">
|
||||
<el-input v-model="Form.desc" style="width:400px" type="textarea"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属学科" prop="subject">
|
||||
<el-select v-model="Form.subject" placeholder="请选择所属学科" style="width:400px">
|
||||
<el-option
|
||||
v-for="item in subjectData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题库范围" prop="questioncat">
|
||||
<el-select
|
||||
v-model="Form.questioncat" multiple placeholder="请选择题库范围" style="width:400px" >
|
||||
<el-option
|
||||
v-for="item in questioncatData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单选题">
|
||||
共有<span style="color:darkred;font-weight:bold"> {{typecount.danxuan}} </span>道,选取
|
||||
<el-input-number v-model="Form.danxuan_count" :min="0" :max="maxDanxuan()"></el-input-number>道,每道
|
||||
选取
|
||||
<el-input-number v-model="Form.danxuan_count" :min="0" ></el-input-number>道,每道
|
||||
<el-input-number v-model="Form.danxuan_score" :min="0"></el-input-number>分
|
||||
</el-form-item>
|
||||
<el-form-item label="多选题">
|
||||
共有<span style="color:darkred;font-weight:bold"> {{typecount.duoxuan}} </span>道,选取
|
||||
<el-input-number v-model="Form.duoxuan_count" :min="0" :max="maxDuoxuan()"></el-input-number>道,每道
|
||||
选取
|
||||
<el-input-number v-model="Form.duoxuan_count" :min="0" ></el-input-number>道,每道
|
||||
<el-input-number v-model="Form.duoxuan_score" :min="0"></el-input-number>分
|
||||
</el-form-item>
|
||||
<el-form-item label="判断题">
|
||||
共有<span style="color:darkred;font-weight:bold"> {{typecount.panduan}} </span>道,选取
|
||||
<el-input-number v-model="Form.panduan_count" :min="0" :max="maxPanduan()"></el-input-number>道,每道
|
||||
选取
|
||||
<el-input-number v-model="Form.panduan_count" :min="0" ></el-input-number>道,每道
|
||||
<el-input-number v-model="Form.panduan_score" :min="0"></el-input-number>分
|
||||
</el-form-item>
|
||||
<el-form-item label="时间限制" prop="limit">
|
||||
|
@ -75,9 +51,6 @@ export default {
|
|||
return {
|
||||
Form: {
|
||||
name: "",
|
||||
desc:"",
|
||||
subject: null,
|
||||
questioncat: [],
|
||||
danxuan_count:0,
|
||||
danxuan_score:0,
|
||||
duoxuan_count:0,
|
||||
|
@ -88,22 +61,12 @@ export default {
|
|||
total_score:0,
|
||||
pass_score:0
|
||||
},
|
||||
typecount:{
|
||||
danxuan:0,
|
||||
duoxuan:0,
|
||||
panduan:0
|
||||
},
|
||||
subjectData:[],
|
||||
questioncatData:[],
|
||||
submitLoding:false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
// { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
|
||||
],
|
||||
questioncat: [
|
||||
{ required: true, message: "题库范围不能为空", trigger: "change" }
|
||||
],
|
||||
limit: [
|
||||
{ required: true, message: "时间限制不能为空"},
|
||||
{ type: "number", message: "时间限制必须是数字"}
|
||||
|
@ -121,22 +84,10 @@ export default {
|
|||
handler:'calScore',
|
||||
deep:true
|
||||
},
|
||||
'Form.subject':'getQuestioncatAll',
|
||||
'Form.questioncat':'getQuestionCount'
|
||||
},
|
||||
created() {
|
||||
this.getSubjectAll();
|
||||
},
|
||||
methods: {
|
||||
maxDanxuan() {
|
||||
return this.typecount.danxuan
|
||||
},
|
||||
maxDuoxuan() {
|
||||
return this.typecount.duoxuan
|
||||
},
|
||||
maxPanduan() {
|
||||
return this.typecount.panduan
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
|
@ -154,21 +105,6 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
getSubjectAll() {
|
||||
getSubjectAll().then(response => {
|
||||
this.subjectData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getQuestioncatAll() {
|
||||
getQuestioncatAll({pid:this.Form.subject}).then(response => {
|
||||
this.questioncatData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getQuestionCount() {
|
||||
getQuestionCount({ids:this.Form.questioncat}).then(response => {
|
||||
this.typecount = response.data
|
||||
});
|
||||
},
|
||||
calScore(current,old) {
|
||||
let form = this.Form
|
||||
let score = form.danxuan_count * form.danxuan_score + form.duoxuan_count * form.duoxuan_score + form.panduan_count * form.panduan_score
|
||||
|
|
|
@ -7,45 +7,21 @@
|
|||
label-width="100px"
|
||||
status-icon
|
||||
>
|
||||
<el-form-item label="规则名称" prop="name">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="Form.name" style="width:400px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则简述" prop="desc">
|
||||
<el-input v-model="Form.desc" style="width:400px" type="textarea"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属学科" prop="subject">
|
||||
<el-select v-model="Form.subject" placeholder="请选择所属学科" style="width:400px" @change="getQuestioncatAll">
|
||||
<el-option
|
||||
v-for="item in subjectData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="题库范围" prop="questioncat">
|
||||
<el-select
|
||||
v-model="Form.questioncat" multiple placeholder="请选择题库范围" style="width:400px" >
|
||||
<el-option
|
||||
v-for="item in questioncatData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单选题">
|
||||
共有<span style="color:darkred;font-weight:bold"> {{typecount.danxuan}} </span>道,选取
|
||||
选取
|
||||
<el-input-number v-model="Form.danxuan_count" :min="0" ></el-input-number>道,每道
|
||||
<el-input-number v-model="Form.danxuan_score" :min="0"></el-input-number>分
|
||||
</el-form-item>
|
||||
<el-form-item label="多选题">
|
||||
共有<span style="color:darkred;font-weight:bold"> {{typecount.duoxuan}} </span>道,选取
|
||||
选取
|
||||
<el-input-number v-model="Form.duoxuan_count" :min="0" ></el-input-number>道,每道
|
||||
<el-input-number v-model="Form.duoxuan_score" :min="0"></el-input-number>分
|
||||
</el-form-item>
|
||||
<el-form-item label="判断题">
|
||||
共有<span style="color:darkred;font-weight:bold"> {{typecount.panduan}} </span>道,选取
|
||||
选取
|
||||
<el-input-number v-model="Form.panduan_count" :min="0" ></el-input-number>道,每道
|
||||
<el-input-number v-model="Form.panduan_score" :min="0"></el-input-number>分
|
||||
</el-form-item>
|
||||
|
@ -68,16 +44,13 @@
|
|||
</template>
|
||||
<script>
|
||||
import { updateTestRule , getTestRuleDetail} from "@/api/examtest";
|
||||
import { getSubjectAll, getQuestioncatAll, getQuestionCount } from "@/api/question";
|
||||
import { getSubjectAll, getQuestioncatAll} from "@/api/question";
|
||||
import { genTree } from "@/utils";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Form: {
|
||||
name: "",
|
||||
desc:"",
|
||||
subject: null,
|
||||
questioncat: [],
|
||||
danxuan_count:0,
|
||||
danxuan_score:0,
|
||||
duoxuan_count:0,
|
||||
|
@ -88,22 +61,12 @@ export default {
|
|||
total_score:0,
|
||||
pass_score:0
|
||||
},
|
||||
typecount:{
|
||||
danxuan:0,
|
||||
duoxuan:0,
|
||||
panduan:0
|
||||
},
|
||||
subjectData:[],
|
||||
questioncatData:[],
|
||||
submitLoding:false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
// { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
|
||||
],
|
||||
questioncat: [
|
||||
{ required: true, message: "题库范围不能为空", trigger: "change" }
|
||||
],
|
||||
limit: [
|
||||
{ required: true, message: "时间限制不能为空"},
|
||||
{ type: "number", message: "时间限制必须是数字"}
|
||||
|
@ -121,24 +84,12 @@ export default {
|
|||
handler:'calScore',
|
||||
deep:true
|
||||
},
|
||||
'Form.subject':'getQuestioncatAll',
|
||||
'Form.questioncat':'getQuestionCount'
|
||||
},
|
||||
created() {
|
||||
this.Form.id = this.$route.query.id //接收参数
|
||||
this.getSubjectAll();
|
||||
this.getTestRuleDetail();
|
||||
},
|
||||
methods: {
|
||||
maxDanxuan() {
|
||||
return this.typecount.danxuan
|
||||
},
|
||||
maxDuoxuan() {
|
||||
return this.typecount.duoxuan
|
||||
},
|
||||
maxPanduan() {
|
||||
return this.typecount.panduan
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
|
@ -161,21 +112,6 @@ export default {
|
|||
this.Form = response.data ;
|
||||
});
|
||||
},
|
||||
getSubjectAll() {
|
||||
getSubjectAll().then(response => {
|
||||
this.subjectData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getQuestioncatAll() {
|
||||
getQuestioncatAll({pid:this.Form.id}).then(response => {
|
||||
this.questioncatData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getQuestionCount(val) {
|
||||
getQuestionCount({ids:this.Form.questioncat}).then(response => {
|
||||
this.typecount = response.data
|
||||
});
|
||||
},
|
||||
calScore(current,old) {
|
||||
let form = this.Form
|
||||
let score = form.danxuan_count * form.danxuan_score + form.duoxuan_count * form.duoxuan_score + form.panduan_count * form.panduan_score
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div style="margin-top:10px">
|
||||
<el-input
|
||||
v-model="search"
|
||||
placeholder="输入名称进行搜索"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
/>
|
||||
<el-button type="primary" @click="handleAdd" icon="el-icon-plus">新增</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
:data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
|
||||
style="width: 100%;margin-top:10px;"
|
||||
border
|
||||
fit
|
||||
v-loading="listLoading"
|
||||
highlight-current-row
|
||||
max-height="600"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column align="center" label="名称">
|
||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所属学科">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" >{{scope.row.subject_name}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.create_time }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleEdit(scope)"
|
||||
icon="el-icon-edit"
|
||||
:disabled="!checkPermission(['workrule_edit'])"
|
||||
></el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="handleDelete(scope)"
|
||||
icon="el-icon-delete"
|
||||
:disabled="!checkPermission(['workrule_delete'])"
|
||||
></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getWorkScopeAll,
|
||||
deleteWorkScope
|
||||
} from "@/api/examtest";
|
||||
import checkPermission from "@/utils/permission";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
search: "",
|
||||
tableData: [],
|
||||
listLoading: true,
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
checkPermission,
|
||||
getList() {
|
||||
this.listLoading = true;
|
||||
getWorkScopeAll().then(response => {
|
||||
this.tableData = response.data;
|
||||
this.listLoading = false;
|
||||
});
|
||||
},
|
||||
resetFilter() {
|
||||
this.search = ""
|
||||
this.getList();
|
||||
},
|
||||
handleAdd() {
|
||||
this.$router.push({path:"/sjmanage/workscope/create"})
|
||||
},
|
||||
handleEdit(scope) {
|
||||
this.$router.push({path:"/sjmanage/workscope/update",query:{id:scope.row.id}})
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm('确定删除?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteWorkScope(scope.row.id).then(response => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
this.getList()
|
||||
});
|
||||
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,132 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="Form"
|
||||
:rules="rules"
|
||||
ref="Form"
|
||||
label-width="100px"
|
||||
status-icon
|
||||
>
|
||||
<el-form-item label="工作类别" prop="name">
|
||||
<el-input v-model="Form.name" style="width:400px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属学科" prop="subject">
|
||||
<el-select v-model="Form.subject" placeholder="请选择所属学科" style="width:400px">
|
||||
<el-option
|
||||
v-for="item in subjectData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="具体科目" prop="questioncat">
|
||||
<el-select
|
||||
v-model="Form.questioncat" multiple placeholder="请选择题库范围" style="width:400px" >
|
||||
<el-option
|
||||
v-for="item in questioncatData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="试卷结构" prop="subject">
|
||||
<el-select v-model="Form.rule" placeholder="请选择试卷结构" style="width:400px">
|
||||
<el-option
|
||||
v-for="item in ruleData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-button type="primary" @click="submitForm('Form')" :loading="submitLoding">立即创建</el-button>
|
||||
<el-button @click="resetForm('Form')">重置</el-button>
|
||||
<el-button type="warning" @click="goBack()">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { createWorkScope, getTestRuleAll } from "@/api/examtest";
|
||||
import { getSubjectAll, getQuestioncatAll } from "@/api/question";
|
||||
import { genTree } from "@/utils";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Form: {
|
||||
name: "",
|
||||
subject: null,
|
||||
questioncat: [],
|
||||
},
|
||||
subjectData:[],
|
||||
questioncatData:[],
|
||||
ruleData:[],
|
||||
submitLoding:false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
// { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
|
||||
],
|
||||
subject: [
|
||||
{ required: true, message: "学科不能为空", trigger: "change" }
|
||||
],
|
||||
questioncat: [
|
||||
{ required: true, message: "题库范围不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
'Form.subject':'getQuestioncatAll',
|
||||
},
|
||||
created() {
|
||||
this.getSubjectAll();
|
||||
this.getTestRuleAll();
|
||||
},
|
||||
methods: {
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
this.submitLoding = true
|
||||
createWorkScope(this.Form).then(response => {
|
||||
this.submitLoding = false
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "新建成功!"
|
||||
});
|
||||
this.goBack()
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
getSubjectAll() {
|
||||
getSubjectAll().then(response => {
|
||||
this.subjectData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getQuestioncatAll() {
|
||||
getQuestioncatAll({pid:this.Form.subject}).then(response => {
|
||||
this.questioncatData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getTestRuleAll() {
|
||||
getTestRuleAll().then(response => {
|
||||
this.ruleData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.typecount.danxuan = 0;
|
||||
this.typecount.duoxuan = 0;
|
||||
this.typecount.panduan = 0;
|
||||
},
|
||||
goBack() {
|
||||
this.$router.replace('/sjmanage/workscope/')
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,139 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="Form"
|
||||
:rules="rules"
|
||||
ref="Form"
|
||||
label-width="100px"
|
||||
status-icon
|
||||
>
|
||||
<el-form-item label="工作类别" prop="name">
|
||||
<el-input v-model="Form.name" style="width:400px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属学科" prop="subject">
|
||||
<el-select v-model="Form.subject" placeholder="请选择所属学科" style="width:400px">
|
||||
<el-option
|
||||
v-for="item in subjectData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="具体科目" prop="questioncat">
|
||||
<el-select
|
||||
v-model="Form.questioncat" multiple placeholder="请选择题库范围" style="width:400px" >
|
||||
<el-option
|
||||
v-for="item in questioncatData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="试卷结构" prop="subject">
|
||||
<el-select v-model="Form.rule" placeholder="请选择试卷结构" style="width:400px">
|
||||
<el-option
|
||||
v-for="item in ruleData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-button type="primary" @click="submitForm('Form')" :loading="submitLoding">保存</el-button>
|
||||
<el-button @click="resetForm('Form')">重置</el-button>
|
||||
<el-button type="warning" @click="goBack()">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { updateTestRule, getTestRuleAll, getWorkScopDetail, updateWorkScope} from "@/api/examtest";
|
||||
import { getSubjectAll, getQuestioncatAll } from "@/api/question";
|
||||
import { genTree } from "@/utils";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
Form: {
|
||||
name: "",
|
||||
subject: null,
|
||||
questioncat: [],
|
||||
},
|
||||
subjectData:[],
|
||||
questioncatData:[],
|
||||
ruleData:[],
|
||||
submitLoding:false,
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
// { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
|
||||
],
|
||||
subject: [
|
||||
{ required: true, message: "学科不能为空", trigger: "change" }
|
||||
],
|
||||
questioncat: [
|
||||
{ required: true, message: "题库范围不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
'Form.subject':'getQuestioncatAll',
|
||||
},
|
||||
created() {
|
||||
this.Form.id = this.$route.query.id //接收参数
|
||||
this.getWorkScopDetail();
|
||||
this.getSubjectAll();
|
||||
this.getTestRuleAll();
|
||||
},
|
||||
methods: {
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate(valid => {
|
||||
if (valid) {
|
||||
this.submitLoding = true
|
||||
updateWorkScope(this.Form.id,this.Form).then(response => {
|
||||
this.submitLoding = false
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "编辑成功!"
|
||||
});
|
||||
this.goBack()
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
getSubjectAll() {
|
||||
getSubjectAll().then(response => {
|
||||
this.subjectData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getWorkScopDetail() {
|
||||
getWorkScopDetail(this.Form.id).then(response => {
|
||||
this.Form = response.data ;
|
||||
});
|
||||
},
|
||||
getQuestioncatAll() {
|
||||
getQuestioncatAll({pid:this.Form.subject}).then(response => {
|
||||
this.questioncatData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
getTestRuleAll() {
|
||||
getTestRuleAll().then(response => {
|
||||
this.ruleData = genTree(response.data) ;
|
||||
});
|
||||
},
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields();
|
||||
this.typecount.danxuan = 0;
|
||||
this.typecount.duoxuan = 0;
|
||||
this.typecount.panduan = 0;
|
||||
},
|
||||
goBack() {
|
||||
this.$router.replace('/sjmanage/workscope/')
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -32,7 +32,10 @@
|
|||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="所属学科">
|
||||
<template slot-scope="scope">{{ scope.row.subject_name }}</template>
|
||||
<template slot-scope="scope"><el-tag >{{scope.row.subject_name}}</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="科目类型">
|
||||
<template slot-scope="scope"><el-tag >{{scope.row.type}}</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
|
@ -76,6 +79,16 @@
|
|||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="questioncat.name" placeholder="名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="pid">
|
||||
<el-select v-model="questioncat.type" placeholder="请选择" style="width:100%">
|
||||
<el-option
|
||||
v-for="item in typeData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学科" prop="pid">
|
||||
<el-select v-model="questioncat.pid" placeholder="请选择" style="width:100%">
|
||||
<el-option
|
||||
|
@ -132,7 +145,14 @@ export default {
|
|||
rule1: {
|
||||
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
||||
pid: [{ required: true, message: "请选择分类", trigger: "change" }]
|
||||
}
|
||||
},
|
||||
typeData: [{
|
||||
value: '公共',
|
||||
label: '公共'
|
||||
}, {
|
||||
value: '专业',
|
||||
label: '专业'
|
||||
}],
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
|
|
|
@ -20,6 +20,10 @@ App({
|
|||
wx.reLaunch({
|
||||
url: '/pages/login/login',
|
||||
})
|
||||
}else if(res.data.userinfo.subjects){
|
||||
try {
|
||||
wx.setStorageSync('nowSubject', {id:res.data.userinfo.subjects[0],name:res.data.userinfo.subjects_name[0]})
|
||||
} catch (e) { }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
"pages/test/sheet",
|
||||
"pages/test/list",
|
||||
"pages/my/index",
|
||||
"pages/collect/main"
|
||||
"pages/collect/main",
|
||||
"pages/workscope/index"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
|
|
|
@ -15,10 +15,10 @@ Page({
|
|||
*/
|
||||
onLoad: function () {
|
||||
try {
|
||||
var value = wx.getStorageSync('nowSubject')
|
||||
var value = wx.getStorageSync('nowWork')
|
||||
if (value) {
|
||||
this.setData({
|
||||
questioncatId: value.id
|
||||
workscopeId: value.id
|
||||
})
|
||||
} else{
|
||||
wx.switchTab({
|
||||
|
@ -44,24 +44,22 @@ Page({
|
|||
},
|
||||
getList: function (){
|
||||
var that = this
|
||||
if(that.data.questioncatId){
|
||||
api.request('question/questioncat/subject/', 'GET', { 'id': that.data.questioncatId }).then(res => {
|
||||
if (res.code == 200) {
|
||||
let questioncatData = []
|
||||
if (res.data.length > 0) {
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
let questioncat = {}
|
||||
questioncat['id'] = res.data[i].id
|
||||
questioncat['name'] = res.data[i].name
|
||||
questioncat['tmtotal'] = res.data[i].tmtotal
|
||||
questioncat['ydtmtotal'] = 0
|
||||
questioncatData.push(questioncat)
|
||||
}
|
||||
that.setData({
|
||||
questioncatData: that.showYd(questioncatData)
|
||||
})
|
||||
}
|
||||
}
|
||||
if(that.data.workscopeId){
|
||||
api.request('question/questioncat/workscope/', 'GET', { 'id': that.data.workscopeId }).then(res => {
|
||||
let questioncatData = []
|
||||
if (res.data.length > 0) {
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
let questioncat = {}
|
||||
questioncat['id'] = res.data[i].id
|
||||
questioncat['name'] = res.data[i].name
|
||||
questioncat['tmtotal'] = res.data[i].tmtotal
|
||||
questioncat['ydtmtotal'] = 0
|
||||
questioncatData.push(questioncat)
|
||||
}
|
||||
that.setData({
|
||||
questioncatData: that.showYd(questioncatData)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!--pages/lianxi/index.wxml-->
|
||||
<view class="page">
|
||||
<view class="page__bd">
|
||||
<view class="weui-panel__hd">当前学科题库子类</view>
|
||||
<view class="weui-panel__hd">当前工作类别题库子类</view>
|
||||
<view class="weui-panel__bd">
|
||||
<block wx:for="{{questioncatData}}" wx:key="unique">
|
||||
<view class="weui-media-box weui-media-box_appmsg">
|
||||
|
|
|
@ -41,6 +41,7 @@ Page({
|
|||
previousMargin: 0,
|
||||
// 后边距,可用于露出后一项的一小部分,接受 px 和 rpx 值
|
||||
nextMargin: 0,
|
||||
nowWork:null
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -70,9 +71,9 @@ Page({
|
|||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
if(wx.getStorageSync('nowSubject')){
|
||||
if(wx.getStorageSync('nowWork')){
|
||||
this.setData({
|
||||
nowSubject: wx.getStorageSync('nowSubject')
|
||||
nowWork: wx.getStorageSync('nowWork')
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -111,34 +112,34 @@ Page({
|
|||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
chooseSubject: function () {
|
||||
chooseWork: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/subject/index',
|
||||
url: '/pages/workscope/index',
|
||||
})
|
||||
},
|
||||
goLianxi: function () {
|
||||
let nowSubject = wx.getStorageSync('nowSubject')
|
||||
if (nowSubject){
|
||||
let nowWork = wx.getStorageSync('nowWork')
|
||||
if (nowWork){
|
||||
wx.navigateTo({
|
||||
url: '/pages/lianxi/index',
|
||||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: '请先选择学科',
|
||||
title: '请先选择工作类别',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
}
|
||||
},
|
||||
goMoni: function () {
|
||||
let nowSubject = wx.getStorageSync('nowSubject')
|
||||
if (nowSubject) {
|
||||
let nowWork = wx.getStorageSync('nowWork')
|
||||
if (nowWork) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/moni/index',
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '请先选择学科',
|
||||
title: '请先选择工作类别',
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
</block>
|
||||
</swiper>
|
||||
<view style="margin-top:4px">
|
||||
<a class="weui-btn weui-btn_primary" bindtap="chooseSubject">选择学科</a>
|
||||
<a class="weui-btn weui-btn_primary" bindtap="chooseWork">选择工作类别</a>
|
||||
<view style="color:blue;font-weight:bold;text-align:center">
|
||||
当前学科:
|
||||
<span style="color:orange;font-weight:bold" wx:if="{{nowSubject}}">{{nowSubject.name}}</span>
|
||||
当前工作类别:
|
||||
<span style="color:orange;font-weight:bold" wx:if="{{nowWork}}">{{nowWork.name}}</span>
|
||||
<span style="color:orange;font-weight:bold" wx:else>未选择</span>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -15,10 +15,15 @@ Page({
|
|||
*/
|
||||
onLoad: function () {
|
||||
try {
|
||||
var value = wx.getStorageSync('nowSubject')
|
||||
var value = wx.getStorageSync('nowWork')
|
||||
if (value) {
|
||||
this.setData({
|
||||
subjectId: value.id
|
||||
workId: value.id
|
||||
})
|
||||
this.genPaper()
|
||||
}else{
|
||||
wx.navigateBack({
|
||||
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -38,19 +43,6 @@ Page({
|
|||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
this.getList()
|
||||
},
|
||||
getList: function () {
|
||||
var that = this
|
||||
api.request('examtest/testrule/', 'GET', { 'subject': that.data.subjectId }).then(res => {
|
||||
if (res.code == 200) {
|
||||
if (res.data.length > 0) {
|
||||
that.setData({
|
||||
ruleData: res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
|
@ -87,11 +79,11 @@ Page({
|
|||
|
||||
},
|
||||
|
||||
genPaper: function (e) {
|
||||
genPaper: function () {
|
||||
wx.showLoading({
|
||||
title: '正在生成试卷',
|
||||
})
|
||||
api.request('examtest/testrule/' + e.currentTarget.id + '/monitest', 'GET').then(res => {
|
||||
api.request('examtest/workscope/' + this.data.workId + '/monitest', 'GET').then(res => {
|
||||
try {
|
||||
wx.setStorageSync('monitest', res.data)
|
||||
} catch (e) { }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!--pages/lianxi/index.wxml-->
|
||||
<view class="page">
|
||||
<!-- <view class="page">
|
||||
<view class="page__bd">
|
||||
<view class="weui-panel__hd">当前学科出题规则</view>
|
||||
<view class="weui-panel__bd">
|
||||
|
@ -16,4 +16,4 @@
|
|||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
|
|
@ -8,7 +8,8 @@ Page({
|
|||
data: {
|
||||
total:0,
|
||||
avg_score:0,
|
||||
pass_rate:0
|
||||
pass_rate:0,
|
||||
nowSubject:'点击选择'
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -31,6 +32,15 @@ Page({
|
|||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
try {
|
||||
var value = wx.getStorageSync('nowSubject')
|
||||
if (value) {
|
||||
this.setData({
|
||||
nowSubject: value.name
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
api.request('examtest/myexamtestfx', 'GET').then(res => {
|
||||
this.setData(res.data)
|
||||
})
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
</view>
|
||||
<view class="weui-cells__title">统计分析</view>
|
||||
<view class="weui-cells weui-cells_after-title">
|
||||
<navigator class="weui-cell" url="/pages/subject/index">
|
||||
<view class="weui-cell__bd">当前学科</view>
|
||||
<view class="weui-cell__ft" style="font-weight:bold;color:darkblue">{{nowSubject}}</view>
|
||||
</navigator>
|
||||
<view class="weui-cell">
|
||||
<view class="weui-cell__bd">自助模考数量</view>
|
||||
<view class="weui-cell__ft" style="font-weight:bold;color:darkblue">{{total}}</view>
|
||||
|
|
|
@ -96,7 +96,7 @@ Page({
|
|||
})
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: '暂未开放微信支付,请联系顾问师圆:18355135390',
|
||||
title: '请联系顾问师圆:18355135390',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -38,7 +38,10 @@
|
|||
<view class="weui-article">
|
||||
<view class="weui-article__h2" wx:if="{{tm_current.is_right}}" style="color:green;font-weight:bold">回答正确!</view>
|
||||
<view class="weui-article__h2" wx:else style="color:red;font-weight:bold">回答有误!</view>
|
||||
<view class="weui-article__h2">正确答案是{{tm_current.question.right}},你的答案是{{tm_current.user_answer}}</view>
|
||||
<view class="weui-article__h2">正确答案是{{tm_current.question.right}},
|
||||
<span wx:if="{{tm_current.user_answer}}">你的答案是{{tm_current.user_answer}}</span>
|
||||
<span wx:else>你未作答</span>
|
||||
</view>
|
||||
<view class="weui-article__title">
|
||||
<span style="color:blue">解析: </span>
|
||||
<span wx:if="{{tm_current.question.resolution != null}}">{{tm_current.question.resolution}}</span>
|
||||
|
|
|
@ -233,7 +233,7 @@ Page({
|
|||
for (var i = 0, len = that.data.tms.length; i < len; i++) {
|
||||
let tm_result = that.panTi(that.data.tms[i])
|
||||
that.data.tms[i].is_right = tm_result.is_right
|
||||
if (tm_result.is_right == false){
|
||||
if (tm_result.is_right == false && that.data.tms[i].user_answer){
|
||||
that.data.ctms.unshift(that.data.tms[i])
|
||||
if (that.data.ctms.length > 40) {
|
||||
that.data.ctms.length = 40
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
// pages/subject/index.js
|
||||
const api = require("../../utils/request.js");
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var that = this
|
||||
try {
|
||||
var value = wx.getStorageSync('nowSubject')
|
||||
if (value) {
|
||||
api.request('examtest/workscope/', 'GET', { subject:value.id}).then(res => {
|
||||
that.setData({
|
||||
workData:res.data
|
||||
})
|
||||
})
|
||||
}else{
|
||||
wx.showModal({
|
||||
content: '请先选择学科!',
|
||||
showCancel:false,
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
wx.redirectTo({
|
||||
url: '/pages/subject/index',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
},
|
||||
|
||||
chooseWork: function (e) {
|
||||
let work = e.currentTarget.dataset
|
||||
wx.setStorageSync('nowWork', work)
|
||||
wx.navigateBack({
|
||||
})
|
||||
|
||||
},
|
||||
})
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "选择工作类别"
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<!--pages/lianxi/index.wxml-->
|
||||
<view class="page">
|
||||
<view class="page__bd">
|
||||
<view class="weui-panel__hd">所有学科</view>
|
||||
<view class="weui-panel__bd">
|
||||
<block wx:for="{{workData}}" wx:key="unique">
|
||||
<view class="weui-media-box weui-media-box_appmsg" bindtap="chooseWork" data-id="{{item.id}}" data-name="{{item.name}}">
|
||||
<view class="weui-media-box__hd">
|
||||
<image class="weui-media-box__thumb" src="/images/fushe.svg" alt></image>
|
||||
</view>
|
||||
<view class="weui-media-box__bd">
|
||||
<h4 class="weui-media-box__title">{{item.name}}</h4>
|
||||
<view class="weui-media-box__desc">
|
||||
<span style="font-weight:bold;color:darkblue" >{{item.subject_name}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
|
@ -0,0 +1 @@
|
|||
/* pages/workscope/index.wxss */
|
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-25 03:50
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('question', '0008_auto_20200325_0959'),
|
||||
('examtest', '0012_auto_20200320_1439'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='WorkScope',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
|
||||
('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
|
||||
('is_delete', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
|
||||
('name', models.CharField(max_length=200, unique=True, verbose_name='名称')),
|
||||
('questioncat', models.ManyToManyField(to='question.Questioncat', verbose_name='所选科目')),
|
||||
('rule', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='examtest.TestRule', verbose_name='试卷结构')),
|
||||
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='workscope_subject', to='question.Questioncat', verbose_name='所属学科')),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,25 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-25 04:52
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('examtest', '0013_workscope'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='testrule',
|
||||
name='desc',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='testrule',
|
||||
name='questioncat',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='testrule',
|
||||
name='subject',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,27 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-25 07:59
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('examtest', '0014_auto_20200325_1252'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='workscope',
|
||||
options={'verbose_name': '工作类别', 'verbose_name_plural': '工作类别'},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='examtest',
|
||||
name='rule',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='examtest',
|
||||
name='workscope',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='examtest.WorkScope', verbose_name='工作类别'),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.0.4 on 2020-03-25 08:10
|
||||
|
||||
import django.contrib.postgres.fields.jsonb
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('examtest', '0015_auto_20200325_1559'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='answerdetail',
|
||||
name='user_answer',
|
||||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -9,9 +9,6 @@ from crm.models import Consumer
|
|||
# Create your models here.
|
||||
class TestRule(SoftCommonModel):
|
||||
name = models.CharField(max_length=200, unique=True, verbose_name='名称')
|
||||
desc = models.TextField(verbose_name='描述', default='')
|
||||
subject = models.ForeignKey(Questioncat, blank=True, null=True, on_delete=models.CASCADE, verbose_name='所属学科', related_name='subject')
|
||||
questioncat = models.ManyToManyField(Questioncat, verbose_name='所选题库')
|
||||
danxuan_count = models.IntegerField(default=0, verbose_name='单选数量')
|
||||
danxuan_score = models.FloatField(default=0, verbose_name='单选分数')
|
||||
duoxuan_count = models.IntegerField(default=0, verbose_name='多选数量')
|
||||
|
@ -32,9 +29,17 @@ class TestRule(SoftCommonModel):
|
|||
|
||||
class WorkScope(SoftCommonModel):
|
||||
name = models.CharField(max_length=200, unique=True, verbose_name='名称')
|
||||
questioncat = models.ManyToManyField(Questioncat, verbose_name='所选题库')
|
||||
subject = models.ForeignKey(Questioncat, verbose_name='所属学科', on_delete=models.CASCADE , related_name='workscope_subject')
|
||||
questioncat = models.ManyToManyField(Questioncat, verbose_name='所选科目')
|
||||
rule = models.ForeignKey(TestRule, on_delete=models.CASCADE, verbose_name='试卷结构')
|
||||
|
||||
class Meta:
|
||||
verbose_name = '工作类别'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Paper(SoftCommonModel):
|
||||
name = models.CharField(max_length=200, verbose_name='名称')
|
||||
|
||||
|
@ -49,7 +54,7 @@ class ExamTest(CommonModel):
|
|||
name = models.CharField(max_length=200, verbose_name='名称')
|
||||
type = models.CharField(max_length=50, default='自助模考',choices = type_choices, verbose_name='考试类型')
|
||||
limit = models.IntegerField(default=0, verbose_name='限时(分钟)')
|
||||
rule = models.ForeignKey(TestRule, on_delete=models.CASCADE, verbose_name='所用规则', null=True, blank=True)
|
||||
workscope = models.ForeignKey(WorkScope, on_delete=models.CASCADE, verbose_name='工作类别', null=True, blank=True)
|
||||
paper = models.ForeignKey(Paper, on_delete=models.CASCADE, verbose_name='所用试卷', null=True, blank=True)
|
||||
consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE, verbose_name='模考人')
|
||||
total_score = models.FloatField(default=0, verbose_name='总分')
|
||||
|
@ -67,7 +72,7 @@ class ExamTest(CommonModel):
|
|||
class AnswerDetail(SoftCommonModel):
|
||||
examtest = models.ForeignKey(ExamTest, on_delete=models.CASCADE)
|
||||
question = models.ForeignKey(Question, on_delete=models.CASCADE)
|
||||
user_answer = JSONField()
|
||||
user_answer = JSONField(null=True,blank=True)
|
||||
score = models.FloatField(default=0, verbose_name='本题得分')
|
||||
is_right = models.BooleanField(default=False, verbose_name='是否正确')
|
||||
class Meta:
|
||||
|
|
|
@ -1,22 +1,10 @@
|
|||
from rest_framework import serializers
|
||||
from question.models import Questioncat
|
||||
from crm.models import Consumer
|
||||
from .models import TestRule, ExamTest, AnswerDetail
|
||||
from .models import TestRule, ExamTest, AnswerDetail, WorkScope
|
||||
|
||||
|
||||
|
||||
class TestRuleListSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
规则列表序列化
|
||||
"""
|
||||
create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||
update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||
class Meta:
|
||||
model = TestRule
|
||||
fields = ('id', 'name', 'create_time', 'update_time', 'subject', 'desc')
|
||||
depth = 1
|
||||
|
||||
|
||||
class TestRuleSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
规则序列化
|
||||
|
@ -27,6 +15,17 @@ class TestRuleSerializer(serializers.ModelSerializer):
|
|||
model = TestRule
|
||||
fields = '__all__'
|
||||
|
||||
class WorkScopeSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
工作类别序列化
|
||||
"""
|
||||
create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||
update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||
subject_name = serializers.StringRelatedField(source='subject',read_only=True)
|
||||
class Meta:
|
||||
model = WorkScope
|
||||
fields = '__all__'
|
||||
|
||||
class MoniTestSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
自助模考序列化
|
||||
|
@ -34,7 +33,6 @@ class MoniTestSerializer(serializers.ModelSerializer):
|
|||
start_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S")
|
||||
end_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S")
|
||||
consumer = serializers.PrimaryKeyRelatedField(queryset=Consumer.objects.all(), required=False)
|
||||
rule = serializers.PrimaryKeyRelatedField(queryset=TestRule.objects.all(), required=True)
|
||||
create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||
update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||
class Meta:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
from django.urls import path,include
|
||||
from .views import TestRuleViewSet, MoniTestView, MyExamTestView, AnswerDetailView, MyExamTestFxView
|
||||
from .views import TestRuleViewSet, MoniTestView, MyExamTestView, AnswerDetailView, MyExamTestFxView, WorkScopeViewSet
|
||||
from rest_framework import routers
|
||||
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register('testrule', TestRuleViewSet, basename="testrule")
|
||||
router.register('workscope', WorkScopeViewSet, basename="workscope")
|
||||
|
||||
urlpatterns = [
|
||||
path('monitest/',MoniTestView.as_view()),
|
||||
|
|
|
@ -16,8 +16,8 @@ from utils.custom import CommonPagination
|
|||
from rbac.permission import RbacPermission
|
||||
from question.models import Question
|
||||
from question.serializers import QuestionSerializer
|
||||
from .models import TestRule, ExamTest, AnswerDetail
|
||||
from .serializers import TestRuleSerializer, TestRuleListSerializer, MoniTestSerializer, AnswerDetailSerializer, ExamTestListSerializer, AnswerDetailCreateSerializer
|
||||
from .models import TestRule, ExamTest, AnswerDetail, WorkScope
|
||||
from .serializers import TestRuleSerializer, MoniTestSerializer, AnswerDetailSerializer, ExamTestListSerializer, AnswerDetailCreateSerializer, WorkScopeSerializer
|
||||
from server import settings
|
||||
from crm.authentication import ConsumerTokenAuthentication
|
||||
from utils.custom import CommonPagination
|
||||
|
@ -87,32 +87,22 @@ class AnswerDetailView(APIView):
|
|||
return Response(serializer.data)
|
||||
|
||||
|
||||
class TestRuleViewSet(ModelViewSet):
|
||||
class WorkScopeViewSet(ModelViewSet):
|
||||
"""
|
||||
模考规则:增删改查
|
||||
工作类别:增删改查
|
||||
"""
|
||||
perms_map = (
|
||||
{'*': 'admin'}, {'*': 'TestRule_all'}, {'get': 'TestRule_list'}, {'post': 'TestRule_create'},
|
||||
{'put': 'TestRule_update'}, {'delete': 'TestRule_delete'})
|
||||
{'*': 'admin'}, {'*': 'WorkScope_all'}, {'get': 'WorkScope_list'}, {'post': 'WorkScope_create'},
|
||||
{'put': 'WorkScope_update'}, {'delete': 'WorkScope_delete'})
|
||||
pagination_class = None
|
||||
queryset = TestRule.objects.filter(is_delete=0).all().order_by("id")
|
||||
serializer_class = TestRuleSerializer
|
||||
queryset = WorkScope.objects.filter(is_delete=0).all().order_by("id")
|
||||
serializer_class = WorkScopeSerializer
|
||||
ordering_fields = ('id',)
|
||||
ordering = ['id']
|
||||
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
||||
filterset_fields = ['subject']
|
||||
search_fields = ('^name',)
|
||||
|
||||
def get_serializer(self, *args, **kwargs):
|
||||
"""
|
||||
Return the serializer instance that should be used for validating and
|
||||
deserializing input, and for serializing output.
|
||||
"""
|
||||
if self.action == 'list':
|
||||
serializer_class = TestRuleListSerializer
|
||||
else:
|
||||
serializer_class = TestRuleSerializer
|
||||
kwargs['context'] = self.get_serializer_context()
|
||||
return serializer_class(*args, **kwargs)
|
||||
|
||||
def get_authenticators(self):
|
||||
"""
|
||||
GET请求不做登陆验证
|
||||
|
@ -136,21 +126,21 @@ class TestRuleViewSet(ModelViewSet):
|
|||
生成自助模拟考试
|
||||
'''
|
||||
ret = {}
|
||||
testrule = self.get_object()
|
||||
workscope = self.get_object()
|
||||
ret['name'] = '自助模考' + datetime.now().strftime('%Y%m%d%H%M')
|
||||
ret['type'] = '自助模考' # 自助模拟考试
|
||||
ret['rule'] = testrule.id
|
||||
ret['limit'] = testrule.limit
|
||||
ret['total_score'] = testrule.total_score
|
||||
ret['pass_score'] = testrule.pass_score
|
||||
ret['danxuan_count'] = testrule.danxuan_count
|
||||
ret['danxuan_score'] = testrule.danxuan_score
|
||||
ret['duoxuan_count'] = testrule.duoxuan_count
|
||||
ret['duoxuan_score'] = testrule.duoxuan_score
|
||||
ret['panduan_count'] = testrule.panduan_count
|
||||
ret['panduan_score'] = testrule.panduan_score
|
||||
ret['workscope'] = workscope.id
|
||||
ret['limit'] = workscope.rule.limit
|
||||
ret['total_score'] = workscope.rule.total_score
|
||||
ret['pass_score'] = workscope.rule.pass_score
|
||||
ret['danxuan_count'] = workscope.rule.danxuan_count
|
||||
ret['danxuan_score'] = workscope.rule.danxuan_score
|
||||
ret['duoxuan_count'] = workscope.rule.duoxuan_count
|
||||
ret['duoxuan_score'] = workscope.rule.duoxuan_score
|
||||
ret['panduan_count'] = workscope.rule.panduan_count
|
||||
ret['panduan_score'] = workscope.rule.panduan_score
|
||||
question_queryset = Question.objects.none()
|
||||
queryset = Question.objects.filter(is_delete=0,questioncat__in = testrule.questioncat.all())
|
||||
queryset = Question.objects.filter(is_delete=0,questioncat__in = workscope.questioncat.all())
|
||||
if ret['danxuan_count']:
|
||||
danxuan = queryset.filter(type='单选').order_by('?')[:ret['danxuan_count']]
|
||||
question_queryset = question_queryset | danxuan
|
||||
|
@ -162,11 +152,43 @@ class TestRuleViewSet(ModelViewSet):
|
|||
question_queryset = question_queryset | panduan
|
||||
questions = QuestionSerializer(instance=question_queryset.order_by('type'),many=True).data
|
||||
for i in questions:
|
||||
if i['type'] == 1:
|
||||
if i['type'] == '单选':
|
||||
i['total_score'] = ret['danxuan_score']
|
||||
elif i['type'] == 2:
|
||||
elif i['type'] == '多选':
|
||||
i['total_score'] = ret['duoxuan_score']
|
||||
else:
|
||||
i['total_score'] = ret['panduan_score']
|
||||
ret['questions'] = questions
|
||||
return Response(ret)
|
||||
|
||||
|
||||
class TestRuleViewSet(ModelViewSet):
|
||||
"""
|
||||
模考规则:增删改查
|
||||
"""
|
||||
perms_map = (
|
||||
{'*': 'admin'}, {'*': 'TestRule_all'}, {'get': 'TestRule_list'}, {'post': 'TestRule_create'},
|
||||
{'put': 'TestRule_update'}, {'delete': 'TestRule_delete'})
|
||||
pagination_class = None
|
||||
queryset = TestRule.objects.filter(is_delete=0).all().order_by("id")
|
||||
serializer_class = TestRuleSerializer
|
||||
ordering_fields = ('id',)
|
||||
ordering = ['id']
|
||||
search_fields = ('^name',)
|
||||
|
||||
def get_authenticators(self):
|
||||
"""
|
||||
GET请求不做登陆验证
|
||||
"""
|
||||
if self.request.method == 'GET':
|
||||
self.authentication_classes = []
|
||||
return [auth() for auth in self.authentication_classes]
|
||||
|
||||
def get_permissions(self):
|
||||
"""
|
||||
GET请求不做权限验证
|
||||
"""
|
||||
if self.request.method == 'GET':
|
||||
self.permission_classes = []
|
||||
return [permission() for permission in self.permission_classes]
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ from .serializers import QuestioncatSerializer, QuestionSerializer, SubjectSeria
|
|||
from server import settings
|
||||
from crm.authentication import ConsumerTokenAuthentication
|
||||
from crm.models import PaySubject
|
||||
from examtest.models import WorkScope
|
||||
|
||||
|
||||
class SubjectViewSet(ModelViewSet):
|
||||
|
@ -104,6 +105,16 @@ class QuestioncatViewSet(ModelViewSet):
|
|||
serializer = QuestioncatSerializer(instance=queryset,many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
@action(methods=['get'], detail=False, authentication_classes=[], permission_classes=[],
|
||||
url_path='workscope', url_name='questioncat_workscope', pagination_class = None)
|
||||
def subject(self, request):
|
||||
"""
|
||||
工作类别下的全部分类
|
||||
"""
|
||||
queryset = WorkScope.objects.get(id=request.query_params.get('id')).questioncat.all().order_by('type')
|
||||
serializer = QuestioncatSerializer(instance=queryset,many=True)
|
||||
return Response(serializer.data)
|
||||
|
||||
|
||||
class QuestionViewSet(ModelViewSet):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue