问卷星:发布、答卷、答卷查询

This commit is contained in:
曹磊 2024-05-09 20:22:02 +08:00
parent 0701cc5aa1
commit abaeb190d5
11 changed files with 613 additions and 52 deletions

View File

@ -54,6 +54,17 @@ const zuoye: AppRouteModule = {
title: '课程工具',
},
},
{
path: 'dqkcWenjuan',
name: 'dqkcWenjuan',
component: () => import('/@/views/kc/wjxWjxx/WjxWjxxList.vue'),
meta: {
title: '当前问卷',
},
},
]
}

View File

@ -22,6 +22,18 @@ export const columns: BasicColumn[] = [
align: "center",
dataIndex: 'title'
},
{
title: '问卷类型',
align: "center",
dataIndex: 'atype',
customRender: ({ text }) => {
let dictMap = {
'1': '调查',
'6': '考试',
}
return dictMap[text??''];
}
},
{
title: '问卷描述',
align: "center",

View File

@ -44,6 +44,8 @@
<!-- 表单区域 -->
<WjxWjxxModal ref="registerModal" @success="handleSuccess"></WjxWjxxModal>
<WjxWjxxTmlbModal ref="WjxWjxxTmlbModalPage" @success="handleSuccess"></WjxWjxxTmlbModal>
<WjxWjxxTmlbDjModal ref="WjxWjxxTmlbDjModalPage" @success="handleSuccess"></WjxWjxxTmlbDjModal>
<WjxWjxxTmlbDjjgModal ref="WjxWjxxTmlbDjjgModalPage" @success="handleSuccess"></WjxWjxxTmlbDjjgModal>
</div>
</template>
@ -57,12 +59,15 @@
import { downloadFile } from '/@/utils/common/renderUtils';
import WjxWjxxModal from './components/WjxWjxxModal.vue'
import WjxWjxxTmlbModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbModal.vue'
import WjxWjxxTmlbDjModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjModal.vue'
import WjxWjxxTmlbDjjgModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgModal.vue'
const queryParam = ref<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const WjxWjxxTmlbModalPage = ref();
const WjxWjxxTmlbDjModalPage = ref();
const WjxWjxxTmlbDjjgModalPage = ref();
//table
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
@ -115,11 +120,38 @@
registerModal.value.edit(record);
}
/**
* 配置
*/
function handlePeizhi(record: Recordable) {
WjxWjxxTmlbModalPage.value.disableSubmit = false;
WjxWjxxTmlbModalPage.value.edit(record);
}
/**
* 配置详情
*/
function handlePeizhiXq(record: Recordable) {
WjxWjxxTmlbDjModalPage.value.disableSubmit = true;
WjxWjxxTmlbDjModalPage.value.edit(record,true);
}
/**
* 答卷详情
*/
function handlePeizhiDj(record: Recordable) {
WjxWjxxTmlbDjModalPage.value.disableSubmit = false;
WjxWjxxTmlbDjModalPage.value.edit(record,false);
}
/**
* 答卷详情
*/
function handlePeizhiDjjg(record: Recordable) {
WjxWjxxTmlbDjjgModalPage.value.disableSubmit = true;
WjxWjxxTmlbDjjgModalPage.value.edit(record,false);
}
/**
* 详情
*/
@ -130,7 +162,7 @@
function handleFabu(record: Recordable) {
defHttp.get({ url: '/wjxWjxx/wjxWjxx/fbwj', params: { id: record.id } }).then(res => {
console.log("fabu------>",res);
reload();
});
}
/**
@ -158,30 +190,51 @@
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
label: '配置',
onClick: handlePeizhi.bind(null, record),
},
{
label: '发布',
onClick: handleFabu.bind(null, record),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
if(record.qpublish == '1'){
return [
{
label: '配置详情',
onClick: handlePeizhiXq.bind(null, record),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
},
{
label: '答卷',
onClick: handlePeizhiDj.bind(null, record),
},
{
label: '答卷结果',
onClick: handlePeizhiDjjg.bind(null, record),
},
]
}else{
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
},
{
label: '配置',
onClick: handlePeizhi.bind(null, record),
},
{
label: '发布',
onClick: handleFabu.bind(null, record),
},
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
}
];
]
};
}
/**

View File

@ -7,6 +7,18 @@
<a-input v-model:value="formData.title" placeholder="请输入问卷名称" :disabled="disabled"></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="问卷类型" v-bind="validateInfos.title">
<a-select
ref="select"
v-model:value="formData.atype"
style="width: 120px"
>
<a-select-option value="1">调查</a-select-option>
<a-select-option value="6">考试</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="问卷描述" v-bind="validateInfos.content">
<a-textarea v-model:value="formData.content" rows="4" placeholder="请输入问卷描述" :disabled="disabled"/>
@ -42,6 +54,7 @@
const formData = reactive<Record<string, any>>({
id: '',
title: '',
atype: '1',
content: '',
// qpublish: '',
});

View File

@ -0,0 +1,177 @@
<template>
<a-spin :spinning="confirmLoading">
<a-row style="height: calc(80vh);">
<a-col :span="24" style="overflow-y: scroll;height: calc(80vh);">
<div style="text-align: center;width: 100%;font-weight: bold;font-size: 20px;padding: 20px;">
{{ title }}</div>
<!-- 题干信息 -->
<div style="width:100%;" v-for="(item,index) in tiganData" :key="index">
<!-- 单选题 -->
<div style="width: 100%;" v-if="item.wjType==3">
<div style="text-align: left;width: 100%;font-weight: bold;font-size: 18px;padding: 20px;">单选题</div>
<a-card >
<template #title>
<span>{{index+1}}</span><span v-html:value="item.wjTitle" style="white-space:pre-wrap;word-wrap : break-word"></span>
</template>
<template #extra>
<span style="margin-left: 40px;">题目分值 {{item.wjScore}} </span>
</template>
<a-radio-group v-model:value="item.itemSelected" style="width: 100%" size="default" :disabled="disabled" >
<div style="width: 100%" v-for="(tmxx,index) in item.wjxWjxxTmxxList">
<a-radio :value="tmxx.itemIndex+``" style="width: 100%;margin-bottom: 5px;">
<span v-html:value="tmxx.itemTitle" style="width:80%;font-size: 16px;"></span>
</a-radio>
</div>
</a-radio-group>
</a-card>
</div>
<!-- 多选题 -->
<div style="width: 100%;" v-else-if="item.wjType==4">
<div style="text-align: left;width: 100%;font-weight: bold;font-size: 18px;padding: 20px;">多选题</div>
<a-card >
<template #title>
<span>{{index+1}}</span><span v-html:value="item.wjTitle" style="white-space:pre-wrap;word-wrap : break-word"/>
</template>
<template #extra>
<span style="margin-left: 40px;">题目分值 {{item.wjScore}} </span>
</template>
<a-checkbox-group v-model:value="item.itemSelected" style="width: 100%" size="default" :disabled="disabled" >
<a-row>
<a-col :span="24" v-for="(tmxx,index) in item.wjxWjxxTmxxList">
<a-checkbox :value="tmxx.itemIndex" style="width: 100%;margin-bottom: 5px;">
<span v-html:value="tmxx.itemTitle" style="width:80%;font-size: 16px;"></span>
</a-checkbox>
</a-col>
</a-row>
</a-checkbox-group>
</a-card>
</div>
<div v-else>
无对应类型
</div>
</div>
</a-col>
</a-row>
</a-spin>
</template>
<script lang="ts" name="wjxWjxx-add" setup>
import { ref, nextTick, defineExpose } from 'vue';
import { Icon } from '/@/components/Icon';
import { useMessage } from '/@/hooks/web/useMessage';
import { defHttp } from '/@/utils/http/axios';
import {
queryWjxWjxxTmxxListByMainId,
queryDataById,
saveOrUpdate,
djtj
} from '/@/views/kc/wjxWjxxTmlb/WjxWjxxTmlb.api';
const title = ref<string>('');
const mainId = ref<string>('');
const disabled = ref<boolean>(false);
const confirmLoading = ref<boolean>(false);
const tiganData = ref<any>([]);
const tmxxPar = ref<any>({});
const openTime = ref<string>('');
const { createMessage } = useMessage();
const emit = defineEmits(['ok', 'closeLoading']);
//
function edit(record,isDisabled){
openTime.value = getCurrentTimeFormat();
tiganData.value = [];
disabled.value = isDisabled;
title.value = record.title;
mainId.value = record.id;
defHttp.get({url:'/wjxWjxxTmlb/wjxWjxxTmlb/queryByMainId',params:{id:record.id}}).then(res =>{
console.log(`🚀 ~ defHttp.get ~ res:`, res)
var list = res;
for(var i=0;i<list.length;i++){
var par = list[i];
if(disabled.value){
if(par.wjType==4){
var lssj = par.itemSelected.split(",");
const numArray = lssj.map(str => parseInt(str));
list[i].itemSelected = numArray;
}
}else{
par.itemSelected = null;
}
}
tiganData.value = res;
})
}
//
async function submitForm(){
const data = tiganData.value;
console.log(`🚀 ~ submitForm ~ data:`, data)
const values = Object.assign([], data);
for(var i=0;i<values.length;i++){
var param = values[i];
if(param.itemSelected == null){
emit('closeLoading');
createMessage.warning("有题目没有作答,请检查试卷,完成所有作答!");
return;
}
values[i].itemSelected = param.itemSelected+"";
values[i].openTime = openTime.value;
}
const isUpdate = false
await djtj(values, isUpdate);
//
emit('ok');
}
function getCurrentTimeFormat() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
const hour = now.getHours();
const minute = now.getMinutes();
const second = now.getSeconds();
return `${year}-${padZero(month)}-${padZero(day)} ${padZero(hour)}:${padZero(minute)}:${padZero(second)}`;
}
function padZero(num) {
return num < 10 ? `0${num}` : `${num}`;
}
defineExpose({
edit,
submitForm,
});
</script>
<style lang="less" scoped>
/deep/span.ant-radio + * {
width: 100%;
}
/deep/.ant-checkbox-wrapper {
box-sizing: border-box;
margin: 0;
padding: 0;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5715;
list-style: none;
font-feature-settings: tnum;
display: inline-flex;
align-items: baseline;
line-height: unset;
cursor: pointer;
width: 80%;
}
/deep/.ant-checkbox + span {
padding-right: 8px;
padding-left: 8px;
width: 100%;
}
</style>

View File

@ -0,0 +1,75 @@
<template>
<a-modal :title="title" :width="width" centered :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit }, loading: loading }" @cancel="handleCancel" cancelText="关闭">
<WjxWjxxTmlbDjForm ref="registerForm" @ok="submitCallback" @closeLoading="closeLoading" :formDisabled="disableSubmit" :formBpm="false"></WjxWjxxTmlbDjForm>
</a-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import WjxWjxxTmlbDjForm from './WjxWjxxTmlbDjForm.vue'
const title = ref<string>('');
const width = ref<string>('80%');
const visible = ref<boolean>(false);
const loading = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 编辑
* @param record
*/
function edit(record,isDisabled) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
loading.value = false;
nextTick(() => {
registerForm.value.edit(record,isDisabled);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
loading.value = true;
registerForm.value.submitForm();
}
/**
* 确定按钮点击事件
*/
function closeLoading() {
loading.value = false;
}
/**
* form保存回调事件
*/
function submitCallback() {
loading.value = false;
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
edit,
disableSubmit,
});
</script>
<style>
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>

View File

@ -0,0 +1,145 @@
<template>
<a-spin :spinning="confirmLoading">
<a-row style="height: calc(80vh);">
<a-col :span="24" style="overflow-y: scroll;height: calc(80vh);">
<div style="text-align: center;width: 100%;font-weight: bold;font-size: 20px;padding: 20px;">{{ djxxData.title }}</div>
<div style="text-align: right;font-size: 16px;padding-right: 20px;">
<span v-if="djxxData.atype == 6" style="text-decoration: underline;margin-right: 15px;">总分{{ djxxData.totalScore }} </span>
<span v-if="djxxData.atype == 6" style="text-decoration: underline;margin-right: 15px;">得分{{ djxxData.score }} </span>
<span style="text-decoration: underline;margin-right: 15px;">用时{{djxxData.answerSfm}} </span>
</div>
<!-- 题干信息 -->
<div style="width:100%;" v-for="(item,index) in tiganData" :key="index">
<!-- 单选题 -->
<div style="width: 100%;" v-if="item.wjType==3">
<div style="text-align: left;width: 100%;font-weight: bold;font-size: 18px;padding: 20px;">单选题</div>
<a-card >
<template #title>
<span>{{index+1}}</span><span v-html:value="item.wjTitle" style="white-space:pre-wrap;word-wrap : break-word"></span>
</template>
<template #extra v-if="djxxData.atype == 6">
<div style="margin-left: 40px;">题目分值 {{item.wjScore}} </div>
<div style="margin-left: 40px;">所得分值 {{item.itemScore}} </div>
</template>
<a-radio-group v-model:value="item.itemSelected" style="width: 100%" size="default" disabled>
<div style="width: 100%" v-for="(tmxx,index) in item.wjxWjxxTmxxList">
<a-radio :value="tmxx.itemIndex+``" style="width: 100%;margin-bottom: 5px;">
<span v-html:value="tmxx.itemTitle" style="width:80%;font-size: 16px;"></span>
</a-radio>
</div>
</a-radio-group>
</a-card>
</div>
<!-- 多选题 -->
<div style="width: 100%;" v-else-if="item.wjType==4">
<div style="text-align: left;width: 100%;font-weight: bold;font-size: 18px;padding: 20px;">多选题</div>
<a-card >
<template #title>
<span>{{index+1}}</span><span v-html:value="item.wjTitle" style="white-space:pre-wrap;word-wrap : break-word"/>
</template>
<template #extra v-if="djxxData.atype == 6">
<div style="margin-left: 40px;">题目分值 {{item.wjScore}} </div>
<div style="margin-left: 40px;">所得分值 {{item.itemScore}} </div>
</template>
<a-checkbox-group v-model:value="item.itemSelected" style="width: 100%" size="default" disabled>
<a-row>
<a-col :span="24" v-for="(tmxx,index) in item.wjxWjxxTmxxList">
<a-checkbox :value="tmxx.itemIndex" style="width: 100%;margin-bottom: 5px;">
<span v-html:value="tmxx.itemTitle" style="width:80%;font-size: 16px;"></span>
</a-checkbox>
</a-col>
</a-row>
</a-checkbox-group>
</a-card>
</div>
<div v-else>
无对应类型
</div>
</div>
</a-col>
</a-row>
</a-spin>
</template>
<script lang="ts" name="wjxWjxx-add" setup>
import { ref, nextTick, defineExpose } from 'vue';
import { Icon } from '/@/components/Icon';
import { useMessage } from '/@/hooks/web/useMessage';
import { defHttp } from '/@/utils/http/axios';
import {
queryWjxWjxxTmxxListByMainId,
queryDataById,
saveOrUpdate,
djtj
} from '/@/views/kc/wjxWjxxTmlb/WjxWjxxTmlb.api';
const title = ref<string>('');
const mainId = ref<string>('');
const confirmLoading = ref<boolean>(false);
const tiganData = ref<any>([]);
const djxxData = ref<any>({});
const { createMessage } = useMessage();
const emit = defineEmits(['register', 'success']);
//
function edit(record){
tiganData.value = [];
mainId.value = record.id;
defHttp.get({url:'/wjxDjxx/queryByMainId',params:{id:record.id}}).then(res =>{
console.log(`🚀 ~ defHttp.get ~ res:`, res)
let djxx = res;
let list = djxx.wjxDjxxTmxxList;
for(let i=0;i<list.length;i++){
let par = list[i];
console.log(par);
if(par.wjType==4){
let lssj = par.itemSelected.split(",");
const numArray = lssj.map(str => parseInt(str));
list[i].itemSelected = numArray;
}
}
tiganData.value = list;
djxxData.value = djxx;
})
}
//
async function submitForm(){
emit('ok');
}
defineExpose({
edit,
submitForm,
});
</script>
<style lang="less" scoped>
/deep/span.ant-radio + * {
width: 100%;
}
/deep/.ant-checkbox-wrapper {
box-sizing: border-box;
margin: 0;
padding: 0;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5715;
list-style: none;
font-feature-settings: tnum;
display: inline-flex;
align-items: baseline;
line-height: unset;
cursor: pointer;
width: 80%;
}
/deep/.ant-checkbox + span {
padding-right: 8px;
padding-left: 8px;
width: 100%;
}
</style>

View File

@ -0,0 +1,63 @@
<template>
<a-modal :title="title" :width="width" centered :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<WjxWjxxTmlbDjjgForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></WjxWjxxTmlbDjjgForm>
</a-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import WjxWjxxTmlbDjjgForm from './WjxWjxxTmlbDjjgForm.vue'
const title = ref<string>('');
const width = ref<string>('80%');
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '答卷结果' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
edit,
disableSubmit,
});
</script>
<style>
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>

View File

@ -9,14 +9,15 @@
</a-card>
</a-col>
<a-col :span="20" style="overflow-y: scroll;height: calc(80vh);">
<div style="text-align: center;width: 100%;font-weight: bold;font-size: 20px;padding: 20px;">问卷标题</div>
<div style="text-align: center;width: 100%;font-weight: bold;font-size: 20px;padding: 20px;">
{{ title }}</div>
<!-- 题干信息 -->
<div style="width:100%;" v-for="(item,index) in tiganData" :key="index">
<!-- 单选题 -->
<div style="width: 100%;" v-if="item.wjType==3">
<a-card >
<template #title>
<span>{{index+1}}</span><a-input placeholder="请填写单选题题干" v-model:value="item.wjTitle" style="width: 50%" :bordered="false" />
<span>{{index+1}}</span><a-textarea placeholder="请填写单选题题干" v-model:value="item.wjTitle" style="width: 75%" auto-size/>
</template>
<template #extra>
<a-tooltip placement="topRight" title="题目分数">
@ -44,7 +45,7 @@
<div style="width: 100%;" v-else-if="item.wjType==4">
<a-card >
<template #title>
<span>{{index+1}}</span><a-input placeholder="请填写多选题题干" v-model:value="item.wjTitle" style="width: 50%" :bordered="false" />
<span>{{index+1}}</span><a-textarea placeholder="请填写多选题题干" v-model:value="item.wjTitle" style="width: 75%" auto-size/>
</template>
<template #extra>
<a-tooltip placement="topRight" title="题目分数">
@ -84,7 +85,7 @@ import { Icon } from '/@/components/Icon';
import { useMessage } from '/@/hooks/web/useMessage';
import { defHttp } from '/@/utils/http/axios';
import { queryWjxWjxxTmxxListByMainId, queryDataById, saveOrUpdate } from '/@/views/kc/wjxWjxxTmlb/WjxWjxxTmlb.api';
const value1 = ref<string>('');
const title = ref<string>('');
const mainId = ref<string>('');
const confirmLoading = ref<boolean>(false);
const tiganData = ref<any>([]);
@ -149,8 +150,8 @@ function getType(value,type){
//
function edit(record){
tiganData.value = [];
title.value = record.title;
mainId.value = record.id;
defHttp.get({url:'/wjxWjxxTmlb/wjxWjxxTmlb/queryByMainId',params:{id:record.id}}).then(res =>{
console.log(`🚀 ~ defHttp.get ~ res:`, res)
var list = res;

View File

@ -13,6 +13,7 @@ enum Api {
exportXls = '/wjxWjxxTmlb/wjxWjxxTmlb/exportXls',
queryDataById = '/wjxWjxxTmlb/wjxWjxxTmlb/queryById',
wjxWjxxTmxxList = '/wjxWjxxTmlb/wjxWjxxTmlb/queryWjxWjxxTmxxByMainId',
djtj = '/wjxDjxx/djtj',
}
/**
* api
@ -79,3 +80,11 @@ export const saveOrUpdate = (params, isUpdate) => {
*/
export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }});
/**
*
* @param params
*/
export const djtj = (params, isUpdate) => {
let url = Api.djtj;
return defHttp.post({url: url, params});
}

View File

@ -20,7 +20,7 @@
</a-sub-menu>
<a-sub-menu key="sub3">
<template #title>问卷管理</template>
<a-menu-item key="6">当前问卷</a-menu-item>
<a-menu-item key="6" @click="getGzt('dqwj')">当前问卷</a-menu-item>
<a-menu-item key="7">历史问卷</a-menu-item>
</a-sub-menu>
<a-menu-item key="sub4">
@ -61,6 +61,8 @@
var href = "/zy/dqkcDqzy";
if(zytype=='dqzy'){
href = "/zy/dqkcDqzy";
}else if(type=='dqwj'){
href = "/zy/dqkcWenjuan";
}else if(zytype=='lszy'){
href = "/zy/dqkcLszy";
}