表单调整

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