tableFill.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { getRandomNumber } from '@/utils';
  2. import { stemTypeList, questionNumberTypeList, scoreTypeList, switchOption, fontSizeList } from './common';
  3. export function getOption() {
  4. return { mark: getRandomNumber(), text: '', content_list: [] };
  5. }
  6. /**
  7. * 获取填表题数据模板(防止 mark 重复)
  8. * @returns {object} 判断题数据模板
  9. */
  10. export function getTableFillData() {
  11. return {
  12. type: 'table_fill', // 题型
  13. stem: '', // 题干
  14. option_header_list: [
  15. { mark: getRandomNumber(), text: '', width: 50 },
  16. { mark: getRandomNumber(), text: '', width: 50 },
  17. ], // 选项头部
  18. option_list: [
  19. [getOption(), getOption()],
  20. [getOption(), getOption()],
  21. ], // 选项列表
  22. answer: {
  23. score: 1,
  24. score_type: scoreTypeList[0].value,
  25. answer_list: [],
  26. }, // 答案
  27. // 题型属性
  28. property: {
  29. stem_type: stemTypeList[1].value, // 题干类型
  30. question_number: '1', // 题号
  31. stem_question_number_font_size: fontSizeList[5], // 题干题号
  32. score: 1, // 分值
  33. score_type: scoreTypeList[0].value, // 分值类型
  34. is_enable_number_column: switchOption[0].value, // 是否启用序号列
  35. form_width: 800, // 表格宽度 100 - 3000
  36. row_number: 2, // 行数 1 - 30
  37. column_number: 2, // 列数 2 - 5
  38. },
  39. // 其他属性
  40. other: {
  41. question_number_type: questionNumberTypeList[1].value, // 题号类型
  42. },
  43. };
  44. }