|
@@ -40,7 +40,16 @@
|
|
|
></el-input-number>
|
|
|
<span class="el-input-tips">*指一行显示空位数量</span>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="小题空数:">
|
|
|
+ <el-form-item label="小题空数类型:">
|
|
|
+ <el-radio-group v-model="modalForm.questionLineType" size="small">
|
|
|
+ <el-radio-button label="norm">标准</el-radio-button>
|
|
|
+ <el-radio-button label="custom">自定义</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item
|
|
|
+ v-if="modalForm.questionLineType === 'norm'"
|
|
|
+ label="小题空数:"
|
|
|
+ >
|
|
|
<el-input-number
|
|
|
v-model="modalForm.fillCount"
|
|
|
style="width: 125px"
|
|
@@ -52,6 +61,29 @@
|
|
|
></el-input-number>
|
|
|
<span class="el-input-tips">*指每一小题的空位数量</span>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item v-else prop="questionLineNums" label="各小题空数:">
|
|
|
+ <table class="table table-white table-narrow">
|
|
|
+ <tr>
|
|
|
+ <th>小题号</th>
|
|
|
+ <th>空数</th>
|
|
|
+ </tr>
|
|
|
+ <tr v-for="option in questionLineNumOptions" :key="option.no">
|
|
|
+ <td>{{ option.questionNo }}</td>
|
|
|
+ <td>
|
|
|
+ <el-input-number
|
|
|
+ v-model="option.fillCount"
|
|
|
+ size="mini"
|
|
|
+ :min="1"
|
|
|
+ :max="50"
|
|
|
+ :step="1"
|
|
|
+ step-strictly
|
|
|
+ :controls="false"
|
|
|
+ style="width: 125px"
|
|
|
+ ></el-input-number>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -65,6 +97,7 @@ const initModalForm = {
|
|
|
fillCountPerLine: 1,
|
|
|
lineSpacing: 40,
|
|
|
fillCount: null,
|
|
|
+ questionLineType: "custom",
|
|
|
};
|
|
|
|
|
|
export default {
|
|
@@ -81,7 +114,7 @@ export default {
|
|
|
return {
|
|
|
modalForm: { ...initModalForm },
|
|
|
DIRECTION_TYPE,
|
|
|
- questionLineNumOptions: [{ no: 1, count: 1 }],
|
|
|
+ questionLineNumOptions: [],
|
|
|
rules: {
|
|
|
topicName: [
|
|
|
{
|
|
@@ -117,12 +150,29 @@ export default {
|
|
|
const valInfo = val.parent;
|
|
|
this.modalForm = this.$objAssign(initModalForm, valInfo);
|
|
|
if (!valInfo.fillCount) this.modalForm.fillCount = undefined;
|
|
|
+ this.questionLineNumOptions = valInfo.paperStruct.questions.map(
|
|
|
+ (item) => {
|
|
|
+ return { ...item };
|
|
|
+ }
|
|
|
+ );
|
|
|
},
|
|
|
async submit() {
|
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
|
if (!valid) return;
|
|
|
const data = this.$objAssign(this.instance.parent, this.modalForm);
|
|
|
- if (!data.fillCount) data.fillCount = null;
|
|
|
+ if (data.questionLineType === "norm") {
|
|
|
+ if (!data.fillCount) data.fillCount = null;
|
|
|
+ } else {
|
|
|
+ data.fillCount = null;
|
|
|
+ const unfinishedQnos = this.questionLineNumOptions
|
|
|
+ .filter((item) => !item.fillCount)
|
|
|
+ .map((item) => item.questionNo);
|
|
|
+ if (unfinishedQnos.length) {
|
|
|
+ this.$message.error(`请输入小题${unfinishedQnos.join("、")}的空数`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ data.paperStruct.questions = this.questionLineNumOptions;
|
|
|
+ }
|
|
|
this.$emit("modified", data);
|
|
|
},
|
|
|
},
|