表单调整

This commit is contained in:
Jam committed 2023-03-09 22:56:18 +08:00
1 parent 1232d10528
commit 444e1e026c
4 files changed
+48 -48

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@
:rules="validationRules.requireRules"
class="jh-v-input"
dense single-line filled
label="班级ID"
label=""
v-model="formItem.answer"
:readonly="readonly"
></v-text-field>
@@ -42,31 +42,31 @@
dense>
<v-list-item>
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
<v-radio-group :disabled="true" :label="(index+1) + '. ' + formItem.component.statement">
<v-radio hide-details v-for="(option, optionIndex) in formItem.component.property.selectOptionList"
:key="optionIndex" :label="option.value" :value="option.value"></v-radio>
<v-list-item-content v-if="formItem.type === 'single'">
<v-radio-group :disabled="true" :label="(index+1) + '. ' + formItem.statement">
<v-radio hide-details v-for="(option, optionIndex) in formItem.optionList"
:key="optionIndex" :label="option" :value="option"></v-radio>
</v-radio-group>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-content v-if="formItem.type === 'multiple'">
<v-list-item-title class="formItem-title">{{ index + 1 }}. {{
formItem.component.statement
formItem.statement
}}
</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox hide-details style="margin-top: 0px;" :disabled="true" :label="option.value" hide-details
<div v-for="(option, optionIndex) in formItem.optionList" :key="optionIndex">
<v-checkbox hide-details style="margin-top: 0px;" :disabled="true" :label="option" hide-details
color="red"></v-checkbox>
</div>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'textarea'">
<v-list-item-content v-if="formItem.type === 'textarea'">
<v-textarea dense outlined placeholder="请输入答案" hide-details :disabled="true" :rows="4"
:label="(index+1) + '. ' + formItem.component.statement"/>
:label="(index+1) + '. ' + formItem.statement"/>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'input'">
<v-text-field class="cus-v-input" dense outlined :label="(index+1) + '. ' + formItem.component.statement"
<v-list-item-content v-if="formItem.type === 'input'">
<v-text-field class="cus-v-input" dense outlined :label="(index+1) + '. ' + formItem.statement"
:disabled="true"></v-text-field>
</v-list-item-content>
@@ -100,26 +100,26 @@
</div>
<div v-if="selectCanvaIndex >= 0 && formItemList[selectCanvaIndex]">
<v-card class="mt-5" flat
v-if="formItemList[selectCanvaIndex].component.type === 'singleSelect' || formItemList[selectCanvaIndex].component.type === 'multipleSelect'">
v-if="formItemList[selectCanvaIndex].type === 'single' || formItemList[selectCanvaIndex].type === 'multiple'">
<v-row no-gutters>
<v-col cols="12">
<v-text-field class="cus-v-input mr-2" dense filled single-line prefix="标题: " color="success"
v-model="formItemList[selectCanvaIndex].component.statement"></v-text-field>
v-model="formItemList[selectCanvaIndex].statement"></v-text-field>
<div style="display: flex; flex-direction: row;justify-content: space-between; align-items: center;">
<v-subheader class="pa-0">选项列表</v-subheader>
<v-btn icon
@click.stop="propertyAddOption(formItemList[selectCanvaIndex].component.property.selectOptionList.length)">
@click.stop="propertyAddOption(formItemList[selectCanvaIndex].optionList.length)">
<v-icon dark color="grey lighten-1">mdi-plus-box</v-icon>
</v-btn>
</div>
<v-list class="propertyList" dense style="max-height: 300px; overflow-y: auto;">
<v-list-item
class="pa-0"
v-for="(option, index) in formItemList[selectCanvaIndex].component.property.selectOptionList"
v-for="(option, index) in formItemList[selectCanvaIndex].optionList"
:key="index">
<v-list-item-content>
<v-text-field
v-model="option.value"
v-model="formItemList[selectCanvaIndex].optionList[index]"
prefix="选项:"
color="success"
filled single-line
@@ -138,13 +138,13 @@
</v-col>
</v-row>
</v-card>
<v-card class="mt-5" flat v-if="formItemList[selectCanvaIndex].component.type === 'textarea'">
<v-card class="mt-5" flat v-if="formItemList[selectCanvaIndex].type === 'textarea'">
<v-text-field class="cus-v-input" dense filled single-line label="多行文本"
v-model="formItemList[selectCanvaIndex].component.statement"></v-text-field>
v-model="formItemList[selectCanvaIndex].statement"></v-text-field>
</v-card>
<v-card class="mt-5" flat v-if="formItemList[selectCanvaIndex].component.type === 'input'">
<v-card class="mt-5" flat v-if="formItemList[selectCanvaIndex].type === 'input'">
<v-text-field class="cus-v-input" dense filled single-line label="单行文本"
v-model="formItemList[selectCanvaIndex].component.statement"></v-text-field>
v-model="formItemList[selectCanvaIndex].statement"></v-text-field>
</v-card>
</div>
</v-card>
@@ -174,16 +174,16 @@ Vue.component("form-item-list-generator", {
{typeName: '多行文本', type: 'textarea', statement: '多行文本', property: {}, icon: 'mdi-form-textarea'},
{
typeName: '单选',
type: 'singleSelect',
type: 'single',
statement: '单选',
property: {selectOptionList: []},
optionList: [],
icon: 'mdi-checkbox-marked-circle'
},
{
typeName: '多选',
type: 'multipleSelect',
type: 'multiple',
statement: '多选',
property: {selectOptionList: []},
optionList: [],
icon: 'mdi-checkbox-marked'
},
],
@@ -250,7 +250,7 @@ Vue.component("form-item-list-generator", {
},
formItemCopy(index, formItem) {
const newFormItem = _.cloneDeep(formItem);
newFormItem.id = `${newFormItem.component.type}_${this.uuid(8)}`,
newFormItem.id = `${newFormItem.type}_${this.uuid(8)}`,
this.formItemList.splice(index + 1, 0, newFormItem);
},
emptyCanva() {
@@ -263,10 +263,10 @@ Vue.component("form-item-list-generator", {
}
},
propertyAddOption(index) {
this.formItemList[this.selectCanvaIndex].component.property.selectOptionList.splice(index, 0, {value: ""});
this.formItemList[this.selectCanvaIndex].optionList.splice(index, 0, "");
},
propertyDeleteOption(index) {
this.formItemList[this.selectCanvaIndex].component.property.selectOptionList.splice(index, 1);
this.formItemList[this.selectCanvaIndex].optionList.splice(index, 1);
},
uuid(t = 21) {
let e = "", r = crypto.getRandomValues(new Uint8Array(t));
+18 -18
View File
@@ -1,26 +1,26 @@
<template id="form-item-list-review">
<div class="form-item-list-review-container">
<!-- 单选 -->
<template v-if="formItem.component.type === 'singleSelect'">
<span class="jh-input-label">{{ formItem.component.statement }}</span>
<template v-if="formItem.type === 'single'">
<span class="jh-input-label">{{ formItem.statement }}</span>
<v-radio-group readonly v-model="formItem.user.answer">
<v-radio
v-for="(option, optionIndex) in formItem.component.selectOptionList" :key="optionIndex"
v-for="(option, optionIndex) in formItem.optionList" :key="optionIndex"
:label="assignmentOptionKey[optionIndex]+': '+option" :value="option"></v-radio>
</v-radio-group>
</template>
<!-- 多选和填空 -->
<template v-if="['fillBlank', 'multipleSelect'].includes(formItem.component.type)">
<span class="jh-input-label" style="white-space:nowrap !important;" v-if="formItem.component.type === 'fillBlank'">
<template v-for="(blank, blankIndex) in formItem.component.statement" :key="blankIndex">
<template v-if="['fillBlank', 'multiple'].includes(formItem.type)">
<span class="jh-input-label" style="white-space:nowrap !important;" v-if="formItem.type === 'fillBlank'">
<template v-for="(blank, blankIndex) in formItem.statement" :key="blankIndex">
<span class="fill-blank fill-blank-input" v-if="blank.type === 'input'">{{
formItem.user.answer[blank.id] }}</span>
<span v-else>{{ blank.value }}</span>
</template>
</span>
<span class="jh-input-label" v-else>{{ formItem.component.statement }}</span>
<template v-if="formItem.component.type === 'multipleSelect'">
<template v-for="(option, optionIndex) in formItem.component.selectOptionList" :key="optionIndex">
<span class="jh-input-label" v-else>{{ formItem.statement }}</span>
<template v-if="formItem.type === 'multiple'">
<template v-for="(option, optionIndex) in formItem.optionList" :key="optionIndex">
<v-checkbox
readonly style="margin-top: 0px;" v-model="formItem.user.answer" :value="option"
:label="assignmentOptionKey[optionIndex]+': '+option" hide-details color="red"></v-checkbox>
@@ -28,9 +28,9 @@
</template>
</template>
<!-- 多行文本,问答和markdown -->
<template v-if="['textarea', 'questionAnswer', 'markdown'].includes(formItem.component.type)">
<span class="jh-input-label">{{ formItem.component.statement }}</span>
<template v-if="formItem.component.type === 'markdown'" cols="12">
<template v-if="['textarea', 'questionAnswer', 'markdown'].includes(formItem.type)">
<span class="jh-input-label">{{ formItem.statement }}</span>
<template v-if="formItem.type === 'markdown'" cols="12">
<md2html :article-content="formItem.user.answer" @complete="isContentLoading = false"></md2html>
</template>
<template v-else cols="12">
@@ -38,17 +38,17 @@
</template>
</template>
<!-- 题目组 -->
<template v-if="formItem.component.type === 'questionGroup'">
<span class="jh-input-label">{{ formItem.component.statement }}</span>
<md2html :article-content="formItem.component.markdownContent" @complete="isContentLoading = false">
<template v-if="formItem.type === 'questionGroup'">
<span class="jh-input-label">{{ formItem.statement }}</span>
<md2html :article-content="formItem.markdownContent" @complete="isContentLoading = false">
</md2html>
<form-item-list-review
:form-item-list="formItem.component.itemList" :review-data="reviewData"
:form-item-list="formItem.itemList" :review-data="reviewData"
:answer-check="answerCheck" />
</template>
<!-- 纯标题 -->
<v-list-item-content v-if="formItem.component.type === 'displayText'">
<p>{{formItem.component.statement}}</p>
<v-list-item-content v-if="formItem.type === 'displayText'">
<p>{{formItem.statement}}</p>
</v-list-item-content>
</div>
</template>
+1 -1
View File
@@ -229,7 +229,7 @@ new Vue({
this.constantObj.workflowFormList = [];
for (const item of this.formObj.workflowForm) {
this.constantObj.workflowFormList.push({
text: item.component.outline,
text: item.statement,
value: item.id
})
}