@qxs-bns/components 0.0.80 → 0.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/es/package.json.mjs +1 -1
  2. package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
  3. package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
  4. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
  5. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
  6. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
  7. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
  8. package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
  9. package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
  10. package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
  11. package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
  12. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
  13. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
  14. package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
  15. package/es/src/subject-list/src/subject-list.vue.mjs.map +1 -1
  16. package/lib/package.json.cjs +1 -1
  17. package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
  18. package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
  19. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
  20. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
  21. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
  22. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
  23. package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
  24. package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
  25. package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
  26. package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
  27. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
  28. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
  29. package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
  30. package/lib/src/subject-list/src/subject-list.vue.cjs.map +1 -1
  31. package/package.json +4 -3
  32. package/theme-chalk/index.css +1 -1
  33. package/theme-chalk/src/image-upload.css +1 -1
  34. package/theme-chalk/src/image-upload.scss +2 -1
  35. package/theme-chalk/src/normalize.css +1 -1
  36. package/theme-chalk/src/normalize.scss +4 -132
  37. package/types/src/data-chart/src/components/area.vue.d.ts.map +1 -1
  38. package/types/src/data-chart/src/components/bar.vue.d.ts.map +1 -1
  39. package/types/src/data-chart/src/components/card.vue.d.ts.map +1 -1
  40. package/types/src/data-chart/src/components/empty.vue.d.ts.map +1 -1
  41. package/types/src/data-chart/src/components/funnel.vue.d.ts.map +1 -1
  42. package/types/src/data-chart/src/components/line.vue.d.ts.map +1 -1
  43. package/types/src/data-chart/src/components/pie.vue.d.ts.map +1 -1
  44. package/types/src/data-chart/src/components/radar.vue.d.ts.map +1 -1
  45. package/types/src/data-chart/src/components/scatter-simple.vue.d.ts.map +1 -1
  46. package/types/src/data-chart/src/components/scatter.vue.d.ts.map +1 -1
  47. package/types/src/data-chart/src/components/table.vue.d.ts.map +1 -1
  48. package/types/src/data-chart/src/data-chart.vue.d.ts.map +1 -1
  49. package/types/src/file-upload/src/file-upload.vue.d.ts.map +1 -1
  50. package/types/src/fixed-action-bar/src/fixed-action-bar.vue.d.ts.map +1 -1
  51. package/types/src/icon/src/icon.vue.d.ts.map +1 -1
  52. package/types/src/image-upload/src/image-upload.vue.d.ts +3 -3
  53. package/types/src/image-upload/src/image-upload.vue.d.ts.map +1 -1
  54. package/types/src/photo-crop-tool/src/photo-crop-tool.vue.d.ts.map +1 -1
  55. package/types/src/subject-action/src/subject-action.vue.d.ts.map +1 -1
  56. package/types/src/subject-layout/src/subject-layout.vue.d.ts.map +1 -1
  57. package/types/src/subject-list/src/components/SubjectPageEnd.vue.d.ts.map +1 -1
  58. package/types/src/subject-list/src/components/SubjectRichText.vue.d.ts.map +1 -1
  59. package/types/src/subject-list/src/components/subject-blank-fill.vue.d.ts.map +1 -1
  60. package/types/src/subject-list/src/components/subject-scale.vue.d.ts.map +1 -1
  61. package/types/src/subject-list/src/components/subject-single.vue.d.ts +1 -1
  62. package/types/src/subject-list/src/components/subject-single.vue.d.ts.map +1 -1
  63. package/types/src/subject-list/src/components/subject-text-fill.vue.d.ts.map +1 -1
  64. package/types/src/subject-list/src/subject-list.vue.d.ts.map +1 -1
  65. package/types/src/subject-type/src/subject-type.vue.d.ts.map +1 -1
  66. package/types/src/tiny-mce-editor/index.d.ts.map +1 -1
  67. package/types/src/tiny-mce-editor/src/tiny-mce-editor.vue.d.ts.map +1 -1
  68. package/types/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subject-single.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-single.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { setGuid } from '@qxs-bns/utils'\nimport { ElMessage } from 'element-plus'\nimport { computed, onMounted, ref, useAttrs, watch } from 'vue'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(props.isKey)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(props.examAnswerRelationType)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref(2)\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid(),\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n }\n else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n // 答题设置必选\n if (!answerCheckType.value) {\n ElMessage.error('请选择答题设置')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n v.relationType = v.resultItem ? 1 : (v.answerRelations?.length ? 2 : null)\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n }\n\n if (answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value,\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet ? props.examAnswerRelationType : null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div\n class=\"rich-text\"\n v-html=\"richText\"\n />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n {{ item.isCorrect ? '(支持选项)' : '' }}\n {{ examAnswerRelationType === 1 ? (item.resultItem ? '(已设置结果项)' : '(未设置结果项)') : '' }}\n {{ examAnswerRelationType === 2 ? (item.answerRelations?.length ? '(已设置关联)' : '(未设置关联)') : '' }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template\n v-if=\"isEdit\"\n #edit\n >\n <div\n class=\"flex\"\n :class=\"[{ 'margin-bottom': showRichText }]\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n />\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"label flex flex-justify-center\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项\n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div\n v-if=\"type === 'sort'\"\n class=\"margin-bottom flex flex-items-center\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n multiple\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div\n v-if=\"showRichText\"\n class=\"margin-bottom flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor\n v-model:model-value=\"richText\"\n v-bind=\"attrs\"\n style=\"width: 100%;\"\n />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :is-key=\"isKey\"\n :show-other-option=\"props.type === 'multiple' || props.type === 'single'\"\n :exam-answer-relation-type=\"props.examAnswerRelationType\"\n :answer-check-type=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @on-show-rich-text=\"showRichText = true\"\n @set-key=\"setKey\"\n @set-answer-setting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"resultItem\"\n v-bind=\"attrs\"\n style=\"width: 100%;\"\n />\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onCloseResult\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveResult\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answersIndex","ref","isKey","answerCheckType","examAnswerRelationType","answers","title","isCorrect","leastAnswerCount","analysis","showRichText","richText","startTime","showRichContent","resultItem","titlePlaceholder","computed","type","orderList","leastAnswerOptions","items","count","value","length","push","label","reverse","addAnswer","isSave","customAnswerId","setGuid","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","correctAnswerCount","forEach","v","i","trim","String","fromCharCode","relationType","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","_createElementBlock","class","_normalizeClass","_unref","e","_createVNode","SubjectLayout","_createSlots","preview","_createElementVNode","_hoisted_1","_hoisted_2","_toDisplayString","_openBlock","includes","_hoisted_4","_hoisted_5","innerHTML","_hoisted_7","_Fragment","_renderList","_createBlock","_component_el_checkbox","disabled","_hoisted_8","_component_el_radio","_hoisted_9","showAction","SubjectAction","isSet","onMoveUp","onMoveDown","onDelete","onSave","onEdit","onAdd","onOnShowRichText","onSetKey","onSetAnswerSetting","_hoisted_10","_component_el_input","$event","rows","placeholder","maxlength","_hoisted_11","_component_el_select","style","width","_component_el_option","_hoisted_12","_hoisted_13","modelValue","onChange","event","it","setCorrect","_cache","_component_el_icon","CirclePlus","onClick","Remove","splice","deleteAnswer","_component_el_link","onOpenResult","examAnswerId","customId","setRelation","_hoisted_14","_hoisted_15","multiple","showAnalysis","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","TinyMceEditor","_mergeProps","_hoisted_20","_component_el_dialog","footer","_component_el_button","plain"],"mappings":"8jEAaA,MAAMA,EAAQC,EAoBRC,EAAQC,EAERC,EAAQC,IAERC,GAAeC,EAAI,GACnBC,GAAQD,EAAIP,EAAMQ,OAClBC,GAAkBF,EAAI,GACtBG,GAAyBH,EAAIP,EAAMU,wBACnCC,GAAUJ,EAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,GAAmBP,EAAI,GACvBK,GAAQL,EAAI,IACZQ,GAAWR,EAAI,IACfS,GAAeT,GAAI,GACnBU,GAAWV,EAAI,IACfW,GAAYX,EAAI,GAChBY,GAAkBZ,GAAI,GACtBa,GAAab,EAAY,IACzBc,GAAmBC,EAAS,IACb,WAAftB,EAAMuB,KACD,MAEe,aAAfvB,EAAMuB,KACN,MAGA,OAILC,GAAYjB,EAAc,IAE1BkB,GAAqBH,EAAS,KAClC,MAAMI,EAAQ,GAEd,IAAA,IAASC,EADMhB,GAAQiB,MAAMC,OACJF,EAAQ,EAAGA,IAClCD,EAAMI,KAAK,CACTC,MAAO,OAAOJ,KACdC,MAAOD,IAGX,OAAOD,EAAMM,YAEf,SAASC,KACHjC,EAAMkC,QAGVvB,GAAQiB,MAAME,KAAK,CACjBlB,MAAO,GACPC,WAAW,EACXsB,eAAgBC,KAEpB,CA+BA,SAASC,KACPrB,GAAaY,OAAQ,EACrBX,GAASW,MAAQ,EACnB,CAEA,SAASU,KACP,IAAK1B,GAAMgB,MAET,YADAW,EAAUC,MAAM,aAIlB,IAAK/B,GAAgBmB,MAEnB,YADAW,EAAUC,MAAM,WAGlB,IAAIC,EAAM,GACNC,GAAqB,EACrBC,EAAqB,EAmBzB,GAlBmB,aAAf3C,EAAMuB,MAAsC,WA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ANVjF,MAAM,mBACNlE,KAAK,UACLoJ,MAAA,GACCvB,QAAOrF,eACT,IAEDkF,EAAA,MAAAA,EAAA,IAAA,GAFC,QAED,oBACApD,EAOY6E,GAAA,CANVjF,MAAM,mBACNlE,KAAK,UACLoJ,MAAA,GACCvB,QAAOtF,eACT,IAEDmF,EAAA,MAAAA,EAAA,IAAA,GAFC,QAED,gCAtBF,IAKE,EALF5C,IAAAQ,EAKEwD,EALFC,EAKE,CAJCrG,IAAK3D,GAAAsB,MACE,cAAaR,GAAAQ,6CAAAR,GAAUQ,MAAAqG,IACvBtC,EAAAvF,GAAK,CACbmI,MAAA,CAAAC,MAAA,UAAoB,KAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"subject-single.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-single.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElButton, ElCheckbox, ElDialog, ElIcon, ElInput, ElLink, ElMessage, ElOption, ElRadio, ElSelect } from 'element-plus'\nimport { nanoid } from 'nanoid'\nimport { computed, onMounted, ref, useAttrs, watch } from 'vue'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: string\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(props.isKey)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(props.examAnswerRelationType)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref(2)\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: nanoid(),\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n }\n else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || nanoid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n // 答题设置必选\n if (!answerCheckType.value) {\n ElMessage.error('请选择答题设置')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n v.relationType = v.resultItem ? 1 : (v.answerRelations?.length ? 2 : null)\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n }\n\n if (answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value,\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet ? props.examAnswerRelationType : null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div\n class=\"rich-text\"\n v-html=\"richText\"\n />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <ElCheckbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </ElCheckbox>\n </template>\n <template v-else>\n <ElRadio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n {{ item.isCorrect ? '(支持选项)' : '' }}\n {{ examAnswerRelationType === 1 ? (item.resultItem ? '(已设置结果项)' : '(未设置结果项)') : '' }}\n {{ examAnswerRelationType === 2 ? (item.answerRelations?.length ? '(已设置关联)' : '(未设置关联)') : '' }}\n </ElRadio>\n </template>\n </div>\n </div>\n </template>\n <template\n v-if=\"isEdit\"\n #edit\n >\n <div\n class=\"flex\"\n :class=\"[{ 'margin-bottom': showRichText }]\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <ElInput\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <ElSelect\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <ElOption\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n />\n </ElSelect>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"label flex flex-justify-center\">{{ String.fromCharCode(65 + index) }}.</span>\n <ElInput\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <ElCheckbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项\n </ElCheckbox>\n <ElIcon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </ElIcon>\n <ElIcon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </ElIcon>\n <ElLink\n v-if=\"examAnswerRelationType === 1 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </ElLink>\n <ElLink\n v-if=\"examAnswerRelationType === 2 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </ElLink>\n </div>\n </div>\n <div\n v-if=\"type === 'sort'\"\n class=\"margin-bottom flex flex-items-center\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <ElSelect\n v-model=\"orderList\"\n multiple\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <ElOption\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </ElSelect>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <ElInput\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div\n v-if=\"showRichText\"\n class=\"margin-bottom flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor\n v-model:model-value=\"richText\"\n v-bind=\"attrs\"\n style=\"width: 100%;\"\n />\n <div class=\"flex flex-justify-end\">\n <ElLink\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </ElLink>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :is-key=\"isKey\"\n :show-other-option=\"props.type === 'multiple' || props.type === 'single'\"\n :exam-answer-relation-type=\"props.examAnswerRelationType\"\n :answer-check-type=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @on-show-rich-text=\"showRichText = true\"\n @set-key=\"setKey\"\n @set-answer-setting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <ElDialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"resultItem\"\n v-bind=\"attrs\"\n style=\"width: 100%;\"\n />\n <template #footer>\n <ElButton\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onCloseResult\"\n >\n 取消\n </ElButton>\n <ElButton\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveResult\"\n >\n 保存\n </ElButton>\n </template>\n </ElDialog>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answersIndex","ref","isKey","answerCheckType","examAnswerRelationType","answers","title","isCorrect","leastAnswerCount","analysis","showRichText","richText","startTime","showRichContent","resultItem","titlePlaceholder","computed","type","orderList","leastAnswerOptions","items","count","value","length","push","label","reverse","addAnswer","isSave","customAnswerId","nanoid","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","correctAnswerCount","forEach","v","i","trim","String","fromCharCode","relationType","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","_createElementBlock","class","_normalizeClass","_unref","e","_createVNode","SubjectLayout","_createSlots","preview","_createElementVNode","_hoisted_1","_hoisted_2","_toDisplayString","_openBlock","includes","_hoisted_4","_hoisted_5","innerHTML","_hoisted_7","_Fragment","_renderList","_createBlock","ElCheckbox","disabled","_hoisted_8","ElRadio","_hoisted_9","showAction","SubjectAction","isSet","onMoveUp","onMoveDown","onDelete","onSave","onEdit","onAdd","onOnShowRichText","onSetKey","onSetAnswerSetting","_hoisted_10","ElInput","$event","rows","placeholder","maxlength","_hoisted_11","ElSelect","style","width","ElOption","_hoisted_12","_hoisted_13","modelValue","onChange","event","it","setCorrect","_cache","ElIcon","CirclePlus","onClick","Remove","splice","deleteAnswer","ElLink","onOpenResult","examAnswerId","customId","setRelation","_hoisted_14","_hoisted_15","multiple","showAnalysis","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","TinyMceEditor","_mergeProps","_h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IAOW,CAPX5E,EAOWF,EAAA+E,GAAA,CANTjF,MAAM,mBACNlE,KAAK,UACLoJ,MAAA,GACCvB,QAAOrF,eACT,IAEDkF,EAAA,MAAAA,EAAA,IAAA,GAFC,QAED,oBACApD,EAOWF,EAAA+E,GAAA,CANTjF,MAAM,mBACNlE,KAAK,UACLoJ,MAAA,GACCvB,QAAOtF,eACT,IAEDmF,EAAA,MAAAA,EAAA,IAAA,GAFC,QAED,gCAtBF,IAKE,EALF5C,IAAAQ,EAKEwD,EALFC,EAKE,CAJCrG,IAAK3D,GAAAsB,MACE,cAAaR,GAAAQ,6CAAAR,GAAUQ,MAAAqG,IACvBtC,EAAAvF,IAAK,CACbmI,MAAA,CAAAC,MAAA,UAAoB,KAAA,GAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as e,useAttrs as l,ref as t,onMounted as a,resolveComponent as i,createElementBlock as s,openBlock as n,normalizeClass as o,unref as u,createVNode as r,withCtx as d,createBlock as v,createCommentVNode as c,createElementVNode as m,Fragment as p,renderList as f,createTextVNode as x,toDisplayString as y,mergeProps as w}from"vue";import{Plus as g,CirclePlus as h,Remove as b}from"@element-plus/icons-vue";import{useNamespace as k}from"@qxs-bns/hooks";import{ElMessage as V}from"element-plus";import C from"../../../subject-action/src/subject-action.vue.mjs";import S from"../../../subject-layout/src/subject-layout.vue.mjs";import j from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const I={class:"preview"},O={class:"content"},A={class:"title"},q={key:0},_=["innerHTML"],E={class:"content flex flex-col"},T={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},U={class:"title"},B={class:"flex"},R={style:{flex:"1"},class:"margin-bottom"},L={class:"margin-bottom flex flex-items-center"},M={class:"flex"},D={style:{flex:"1"}},H={class:"margin-bottom answer-list"},N={class:"label flex flex-justify-end"},z={class:"answer-tags"},$={class:"operation"},F={key:0,class:"margin-bottom flex"},G={style:{flex:"1"}},J={key:1,class:"margin-bottom flex"},K={style:{flex:"1"}},P={class:"flex flex-justify-end"};var Q=e({__name:"subject-text-fill",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examExpand:{type:String,required:!1},examAnswerSettingVO:{type:Object,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(e,{emit:Q}){const W=e,X=Q,Y=l(),Z=t([{title:"",tag:"",showInput:!1}]),ee=t(""),le=t(""),te=t(),ae=t(""),ie=t(!1),se=t(""),ne=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],oe=t(["isInOrder","isIgnoreCase"]);function ue(){Z.value.push({title:"",tag:"",showInput:!1})}function re(){ie.value=!1,se.value=""}function de(){if(ee.value){if(te.value||ae.value){if(!te.value)return void V.error("请完善答题设置!");if(!ae.value)return void V.error("请输入问题正确答案!");if(Z.value.length!==te.value)return void V.error("关键词个数设置有误!");const e=[];if(Z.value.forEach((l,t)=>{l.title||e.push(`关键词${t+1}未设置`)}),e.length>0)return void V.error(e.join(","))}X("save",{title:ee.value,answers:Z.value.filter(e=>e.title).map(e=>({title:e.title})),analysis:le.value,isSetCorrectAnswer:!!ae.value,examExpand:ae.value,examAnswerSettingBO:{isIgnoreCase:oe.value?.includes("isIgnoreCase"),isInOrder:oe.value?.includes("isInOrder"),keywordCount:te.value},examRichTextContent:ie.value?se.value:""})}else V.error("题目标题不能为空!")}a(function(){W.title&&(ee.value=W.title),W.answerList&&W.answerList.length&&(Z.value=W.answerList),W.examAnswerSettingVO&&(oe.value=oe.value.filter(e=>"isIgnoreCase"===e&&W.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&W.examAnswerSettingVO?.isInOrder)),W.examAnswerSettingVO?.keywordCount&&(te.value=W.examAnswerSettingVO?.keywordCount),W.examExpand&&(ae.value=W.examExpand),W.analysis&&(le.value=W.analysis),W.examRichTextContent&&(se.value=W.examRichTextContent,ie.value=!0)});const ve=k("subject-text-fill");return(e,l)=>{const t=i("el-checkbox"),a=i("el-input"),k=i("el-input-number"),V=i("el-checkbox-group"),Q=i("el-tag"),ce=i("el-icon"),me=i("el-button"),pe=i("el-link");return n(),s("div",{class:o(u(ve).e("text-fill-exam"))},[r(S,{"show-edit":e.isEdit},{preview:d(()=>[m("div",I,[m("div",O,[m("span",A,y(e.orderIndex+1)+"."+y(ee.value)+"(问答题)",1),ie.value?(n(),s("div",q,[m("div",{class:"rich-text",innerHTML:se.value},null,8,_)])):c("v-if",!0),m("div",E,[Z.value.some(e=>e.title)?(n(!0),s(p,{key:0},f(Z.value,(e,l)=>(n(),v(t,{key:l,class:"radio",disabled:!0},{default:d(()=>[x(y(e.title),1)]),_:2},1024))),128)):c("v-if",!0)]),ae.value?(n(),s("div",T,[m("span",U,"正确答案:"+y(ae.value),1)])):c("v-if",!0)])])]),edit:d(()=>[m("div",B,[l[12]||(l[12]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"题目:")],-1)),m("div",R,[r(a,{modelValue:ee.value,"onUpdate:modelValue":l[0]||(l[0]=e=>ee.value=e),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:e.isSave},null,8,["modelValue","disabled"])])]),m("div",L,[l[13]||(l[13]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"答题设置:")],-1)),l[14]||(l[14]=m("span",null,"共答对",-1)),r(k,{modelValue:te.value,"onUpdate:modelValue":l[1]||(l[1]=e=>te.value=e),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),l[15]||(l[15]=m("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(n(),s(p,null,f(ne,e=>r(V,{key:e.value,modelValue:oe.value,"onUpdate:modelValue":l[2]||(l[2]=e=>oe.value=e)},{default:d(()=>[r(t,{label:e.value,class:"margin-left-10"},{default:d(()=>[x(y(e.label),1)]),_:2},1032,["label"])]),_:2},1032,["modelValue"])),64))]),m("div",M,[l[16]||(l[16]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"答案:")],-1)),m("div",D,[r(a,{modelValue:ae.value,"onUpdate:modelValue":l[3]||(l[3]=e=>ae.value=e),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:e.isSave},null,8,["modelValue","disabled"])])]),m("div",H,[l[17]||(l[17]=m("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(n(!0),s(p,null,f(Z.value,(l,t)=>(n(),s("div",{key:t,class:"answer-item flex flex-items-center"},[m("div",N,[m("span",null,"关键词"+y(t+1)+":",1)]),m("div",z,[(n(!0),s(p,null,f(l.title.split(","),e=>(n(),s(p,{key:e},[e?(n(),v(Q,{key:0,closable:"",onClose:t=>function(e,l){if(e){const t=l.title.split(","),a=t.findIndex(l=>l===e);a>-1&&(t.splice(a,1),l.title=t.join(","))}}(e,l)},{default:d(()=>[x(y(e),1)]),_:2},1032,["onClose"])):c("v-if",!0)],64))),128)),e.isSave?c("v-if",!0):(n(),s(p,{key:0},[l.showInput?(n(),v(a,{key:0,modelValue:l.tag,"onUpdate:modelValue":e=>l.tag=e,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(l)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(n(),v(me,{key:1,size:"small",onClick:e=>l.showInput=!0},{default:d(()=>[r(ce,null,{default:d(()=>[r(u(g))]),_:1}),m("span",null,y(l.title?"添加同义词":"添加关键词"),1)]),_:2},1032,["onClick"]))],64))]),m("div",$,[r(ce,{class:"icon"},{default:d(()=>[r(u(h),{class:o([{disabled:e.isSave}]),onClick:ue},null,8,["class"])]),_:1}),r(ce,{class:"icon"},{default:d(()=>[r(u(b),{class:o([{disabled:Z.value.length<2||e.isSave}]),onClick:e=>function(e){Z.value.length<2||W.isSave||Z.value.splice(e,1)}(t)},null,8,["class","onClick"])]),_:2},1024)])]))),128))]),e.showAnalysis?(n(),s("div",F,[l[18]||(l[18]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"解析:")],-1)),m("div",G,[r(a,{modelValue:le.value,"onUpdate:modelValue":l[4]||(l[4]=e=>le.value=e),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):c("v-if",!0),ie.value?(n(),s("div",J,[l[20]||(l[20]=m("div",{class:"label flex flex-justify-center"},[m("span",null,"富文本:")],-1)),m("div",K,[r(j,w({"model-value":se.value,"onUpdate:modelValue":l[5]||(l[5]=e=>se.value=e)},u(Y),{style:{width:"100%"}}),null,16,["model-value"]),m("div",P,[r(pe,{type:"danger",onClick:re},{default:d(()=>l[19]||(l[19]=[x(" 删除富文本 ",-1)])),_:1,__:[19]})])])])):c("v-if",!0)]),default:d(()=>[e.showAction?(n(),v(C,{key:0,"is-edit":e.isEdit,"is-set":e.isSet,"show-other-option":!1,"exam-answer-relation-type":W.examAnswerRelationType,onMoveUp:l[6]||(l[6]=e=>X("move","up")),onMoveDown:l[7]||(l[7]=e=>X("move","down")),onDelete:l[8]||(l[8]=e=>X("delete")),onSave:de,onEdit:l[9]||(l[9]=e=>X("edit")),onAdd:l[10]||(l[10]=e=>X("add",e)),onOnShowRichText:l[11]||(l[11]=e=>ie.value=!0)},null,8,["is-edit","is-set","exam-answer-relation-type"])):c("v-if",!0)]),_:1},8,["show-edit"])],2)}}});export{Q as default};
1
+ import{defineComponent as e,useAttrs as l,ref as a,onMounted as t,createElementBlock as i,openBlock as s,normalizeClass as n,unref as o,createVNode as u,withCtx as r,createBlock as d,createCommentVNode as v,createElementVNode as m,Fragment as c,renderList as p,createTextVNode as f,toDisplayString as x,mergeProps as y}from"vue";import{Plus as w,CirclePlus as g,Remove as h}from"@element-plus/icons-vue";import{useNamespace as b}from"@qxs-bns/hooks";import{ElInput as V,ElInputNumber as k,ElCheckboxGroup as C,ElCheckbox as S,ElTag as j,ElButton as I,ElIcon as O,ElLink as A,ElMessage as q}from"element-plus";import _ from"../../../subject-action/src/subject-action.vue.mjs";import E from"../../../subject-layout/src/subject-layout.vue.mjs";import T from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const U={class:"preview"},B={class:"content"},R={class:"title"},L={key:0},M=["innerHTML"],D={class:"content flex flex-col"},H={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},N={class:"title"},z={class:"flex"},$={style:{flex:"1"},class:"margin-bottom"},F={class:"margin-bottom flex flex-items-center"},G={class:"flex"},J={style:{flex:"1"}},K={class:"margin-bottom answer-list"},P={class:"label flex flex-justify-end"},Q={class:"answer-tags"},W={class:"operation"},X={key:0,class:"margin-bottom flex"},Y={style:{flex:"1"}},Z={key:1,class:"margin-bottom flex"},ee={style:{flex:"1"}},le={class:"flex flex-justify-end"};var ae=e({__name:"subject-text-fill",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},examExpand:{type:String,required:!1},examAnswerSettingVO:{type:Object,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(e,{emit:ae}){const te=e,ie=ae,se=l(),ne=a([{title:"",tag:"",showInput:!1}]),oe=a(""),ue=a(""),re=a(),de=a(""),ve=a(!1),me=a(""),ce=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],pe=a(["isInOrder","isIgnoreCase"]);function fe(){ne.value.push({title:"",tag:"",showInput:!1})}function xe(){ve.value=!1,me.value=""}function ye(){if(oe.value){if(re.value||de.value){if(!re.value)return void q.error("请完善答题设置!");if(!de.value)return void q.error("请输入问题正确答案!");if(ne.value.length!==re.value)return void q.error("关键词个数设置有误!");const e=[];if(ne.value.forEach((l,a)=>{l.title||e.push(`关键词${a+1}未设置`)}),e.length>0)return void q.error(e.join(","))}ie("save",{title:oe.value,answers:ne.value.filter(e=>e.title).map(e=>({title:e.title})),analysis:ue.value,isSetCorrectAnswer:!!de.value,examExpand:de.value,examAnswerSettingBO:{isIgnoreCase:pe.value?.includes("isIgnoreCase"),isInOrder:pe.value?.includes("isInOrder"),keywordCount:re.value},examRichTextContent:ve.value?me.value:""})}else q.error("题目标题不能为空!")}t(function(){te.title&&(oe.value=te.title),te.answerList&&te.answerList.length&&(ne.value=te.answerList),te.examAnswerSettingVO&&(pe.value=pe.value.filter(e=>"isIgnoreCase"===e&&te.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&te.examAnswerSettingVO?.isInOrder)),te.examAnswerSettingVO?.keywordCount&&(re.value=te.examAnswerSettingVO?.keywordCount),te.examExpand&&(de.value=te.examExpand),te.analysis&&(ue.value=te.analysis),te.examRichTextContent&&(me.value=te.examRichTextContent,ve.value=!0)});const we=b("subject-text-fill");return(e,l)=>(s(),i("div",{class:n(o(we).e("text-fill-exam"))},[u(E,{"show-edit":e.isEdit},{preview:r(()=>[m("div",U,[m("div",B,[m("span",R,x(e.orderIndex+1)+"."+x(oe.value)+"(问答题)",1),ve.value?(s(),i("div",L,[m("div",{class:"rich-text",innerHTML:me.value},null,8,M)])):v("v-if",!0),m("div",D,[ne.value.some(e=>e.title)?(s(!0),i(c,{key:0},p(ne.value,(e,l)=>(s(),d(o(S),{key:l,class:"radio",disabled:!0},{default:r(()=>[f(x(e.title),1)]),_:2},1024))),128)):v("v-if",!0)]),de.value?(s(),i("div",H,[m("span",N,"正确答案:"+x(de.value),1)])):v("v-if",!0)])])]),edit:r(()=>[m("div",z,[l[12]||(l[12]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"题目:")],-1)),m("div",$,[u(o(V),{modelValue:oe.value,"onUpdate:modelValue":l[0]||(l[0]=e=>oe.value=e),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:e.isSave},null,8,["modelValue","disabled"])])]),m("div",F,[l[13]||(l[13]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"答题设置:")],-1)),l[14]||(l[14]=m("span",null,"共答对",-1)),u(o(k),{modelValue:re.value,"onUpdate:modelValue":l[1]||(l[1]=e=>re.value=e),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),l[15]||(l[15]=m("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(s(),i(c,null,p(ce,e=>u(o(C),{key:e.value,modelValue:pe.value,"onUpdate:modelValue":l[2]||(l[2]=e=>pe.value=e)},{default:r(()=>[u(o(S),{label:e.value,class:"margin-left-10"},{default:r(()=>[f(x(e.label),1)]),_:2},1032,["label"])]),_:2},1032,["modelValue"])),64))]),m("div",G,[l[16]||(l[16]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"答案:")],-1)),m("div",J,[u(o(V),{modelValue:de.value,"onUpdate:modelValue":l[3]||(l[3]=e=>de.value=e),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:e.isSave},null,8,["modelValue","disabled"])])]),m("div",K,[l[17]||(l[17]=m("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(s(!0),i(c,null,p(ne.value,(l,a)=>(s(),i("div",{key:a,class:"answer-item flex flex-items-center"},[m("div",P,[m("span",null,"关键词"+x(a+1)+":",1)]),m("div",Q,[(s(!0),i(c,null,p(l.title.split(","),e=>(s(),i(c,{key:e},[e?(s(),d(o(j),{key:0,closable:"",onClose:a=>function(e,l){if(e){const a=l.title.split(","),t=a.findIndex(l=>l===e);t>-1&&(a.splice(t,1),l.title=a.join(","))}}(e,l)},{default:r(()=>[f(x(e),1)]),_:2},1032,["onClose"])):v("v-if",!0)],64))),128)),e.isSave?v("v-if",!0):(s(),i(c,{key:0},[l.showInput?(s(),d(o(V),{key:0,modelValue:l.tag,"onUpdate:modelValue":e=>l.tag=e,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(l)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(s(),d(o(I),{key:1,size:"small",onClick:e=>l.showInput=!0},{default:r(()=>[u(o(O),null,{default:r(()=>[u(o(w))]),_:1}),m("span",null,x(l.title?"添加同义词":"添加关键词"),1)]),_:2},1032,["onClick"]))],64))]),m("div",W,[u(o(O),{class:"icon"},{default:r(()=>[u(o(g),{class:n([{disabled:e.isSave}]),onClick:fe},null,8,["class"])]),_:1}),u(o(O),{class:"icon"},{default:r(()=>[u(o(h),{class:n([{disabled:ne.value.length<2||e.isSave}]),onClick:e=>function(e){ne.value.length<2||te.isSave||ne.value.splice(e,1)}(a)},null,8,["class","onClick"])]),_:2},1024)])]))),128))]),e.showAnalysis?(s(),i("div",X,[l[18]||(l[18]=m("div",{class:"label flex flex-justify-end"},[m("span",null,"解析:")],-1)),m("div",Y,[u(o(V),{modelValue:ue.value,"onUpdate:modelValue":l[4]||(l[4]=e=>ue.value=e),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):v("v-if",!0),ve.value?(s(),i("div",Z,[l[20]||(l[20]=m("div",{class:"label flex flex-justify-center"},[m("span",null,"富文本:")],-1)),m("div",ee,[u(T,y({"model-value":me.value,"onUpdate:modelValue":l[5]||(l[5]=e=>me.value=e)},o(se),{style:{width:"100%"}}),null,16,["model-value"]),m("div",le,[u(o(A),{type:"danger",onClick:xe},{default:r(()=>l[19]||(l[19]=[f(" 删除富文本 ",-1)])),_:1,__:[19]})])])])):v("v-if",!0)]),default:r(()=>[e.showAction?(s(),d(_,{key:0,"is-edit":e.isEdit,"is-set":e.isSet,"show-other-option":!1,"exam-answer-relation-type":te.examAnswerRelationType,onMoveUp:l[6]||(l[6]=e=>ie("move","up")),onMoveDown:l[7]||(l[7]=e=>ie("move","down")),onDelete:l[8]||(l[8]=e=>ie("delete")),onSave:ye,onEdit:l[9]||(l[9]=e=>ie("edit")),onAdd:l[10]||(l[10]=e=>ie("add",e)),onOnShowRichText:l[11]||(l[11]=e=>ve.value=!0)},null,8,["is-edit","is-set","exam-answer-relation-type"])):v("v-if",!0)]),_:1},8,["show-edit"])],2))}});export{ae as default};
2
2
  //# sourceMappingURL=subject-text-fill.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-text-fill.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-text-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Plus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\nimport { onMounted, ref, useAttrs } from 'vue'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n isEdit: boolean\n isSet: boolean\n examExpand?: string\n examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\n keywordCount: number\n }\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n tag: string\n showInput: boolean\n}[]>([{\n title: '',\n tag: '',\n showInput: false,\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst keywordCount = ref()\nconst correct = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\n\nconst checkList = [\n {\n label: '答案不分顺序',\n value: 'isInOrder',\n },\n {\n label: '忽略大小写',\n value: 'isIgnoreCase',\n },\n]\n\nconst isCheckList = ref(['isInOrder', 'isIgnoreCase'])\n\nfunction handleAddTag(item: any) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n}\n\nfunction closeTag(tag: string, item: any) {\n if (tag) {\n const tags = item.title.split(',')\n const index = tags.findIndex((i: string) => i === tag)\n if (index > -1) {\n tags.splice(index, 1)\n item.title = tags.join(',')\n }\n }\n}\n\nfunction addAnswer() {\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 2 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n\n if (keywordCount.value || correct.value) {\n if (!keywordCount.value) {\n ElMessage.error('请完善答题设置!')\n return\n }\n\n if (!correct.value) {\n ElMessage.error('请输入问题正确答案!')\n return\n }\n\n if (answers.value.length !== keywordCount.value) {\n ElMessage.error('关键词个数设置有误!')\n return\n }\n const msg: string[] = []\n answers.value.forEach((item, index) => {\n if (!item.title) {\n msg.push(`关键词${index + 1}未设置`)\n }\n })\n if (msg.length > 0) {\n ElMessage.error(msg.join(','))\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.filter((i: any) => i.title).map((item: any) => {\n return { title: item.title }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: !!correct.value,\n examExpand: correct.value,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n ...{ keywordCount: keywordCount.value },\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.examAnswerSettingVO) {\n // 仅保留与设置匹配的选项\n isCheckList.value = isCheckList.value.filter(item =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\n )\n }\n\n if (props.examAnswerSettingVO?.keywordCount) {\n keywordCount.value = props.examAnswerSettingVO?.keywordCount\n }\n\n if (props.examExpand) {\n correct.value = props.examExpand\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-text-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('text-fill-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div class=\"content\">\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(问答题)</span>\n <div v-if=\"showRichText\">\n <div\n class=\"rich-text\"\n v-html=\"richText\"\n />\n </div>\n <div class=\"content flex flex-col\">\n <template v-if=\"answers.some(item => item.title)\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n {{ item.title }}\n </el-checkbox>\n </template>\n </div>\n <div\n v-if=\"correct\"\n class=\"flex\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:{{ correct }}</span>\n </div>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>题目:</span>\n </div>\n <div\n style=\"flex: 1;\"\n class=\"margin-bottom\"\n >\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"【问答题】请输入问题\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>答题设置:</span>\n </div>\n <span>共答对</span>\n <el-input-number\n v-model=\"keywordCount\"\n style=\"width: 100px;margin: 0 10px;\"\n :min=\"1\"\n />\n <span style=\"margin-right: 10px;\">个关键词,算是正确的</span>\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox\n :label=\"item.value\"\n class=\"margin-left-10\"\n >\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\n </div>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"correct\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入正确答案\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom answer-list\">\n <span style=\"padding-left: 60px;\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>关键词{{ index + 1 }}:</span>\n </div>\n\n <div class=\"answer-tags\">\n <template\n v-for=\"i in item.title.split(',')\"\n :key=\"i\"\n >\n <el-tag\n v-if=\"i\"\n closable\n @close=\"closeTag(i, item)\"\n >\n {{ i }}\n </el-tag>\n </template>\n <template v-if=\"!isSave\">\n <el-input\n v-if=\"item.showInput\"\n v-model=\"item.tag\"\n style=\"width: 80px;\"\n @blur=\"() => handleAddTag(item)\"\n />\n <el-button\n v-else\n size=\"small\"\n @click=\"item.showInput = true\"\n >\n <el-icon><Plus /></el-icon>\n <span>{{ item.title ? '添加同义词' : '添加关键词' }}</span>\n </el-button>\n </template>\n </div>\n <div class=\"operation\">\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 2 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"margin-bottom flex\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div\n v-if=\"showRichText\"\n class=\"margin-bottom flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor\n v-model:model-value=\"richText\"\n v-bind=\"attrs\"\n style=\"width: 100%;\"\n />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :show-other-option=\"false\"\n :exam-answer-relation-type=\"props.examAnswerRelationType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"type => emits('add', type)\"\n @on-show-rich-text=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","tag","showInput","analysis","keywordCount","correct","showRichText","richText","checkList","label","value","isCheckList","addAnswer","push","deleteRichText","save","ElMessage","error","length","msg","forEach","item","index","join","filter","i","map","isSetCorrectAnswer","examExpand","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","onMounted","answerList","examAnswerSettingVO","ns","useNamespace","_createElementBlock","class","_normalizeClass","_unref","e","_createVNode","SubjectLayout","isEdit","preview","_createElementVNode","_hoisted_1","_hoisted_2","_hoisted_3","_toDisplayString","orderIndex","_hoisted_4","innerHTML","_hoisted_6","some","_openBlock","_Fragment","key","_renderList","_createBlock","_component_el_checkbox","disabled","_createTextVNode","_hoisted_7","_hoisted_8","edit","_hoisted_9","_hoisted_10","_component_el_input","$event","type","rows","placeholder","maxlength","isSave","_hoisted_11","_cache","_component_el_input_number","style","width","margin","min","_component_el_checkbox_group","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","split","_component_el_tag","closable","onClose","tags","findIndex","splice","closeTag","modelValue","onBlur","handleAddTag","_component_el_button","size","onClick","_component_el_icon","Plus","_hoisted_17","CirclePlus","Remove","deleteAnswer","showAnalysis","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","TinyMceEditor","_mergeProps","_hoisted_22","_component_el_link","showAction","SubjectAction","isSet","examAnswerRelationType","onMoveUp","onMoveDown","onDelete","onSave","onEdit","onAdd","onOnShowRichText"],"mappings":"y5DASA,MAAMA,EAAQC,EAmBRC,EAAQC,EAERC,EAAQC,IAERC,EAAUC,EAIX,CAAC,CACJC,MAAO,GACPC,IAAK,GACLC,WAAW,KAGPF,GAAQD,EAAI,IACZI,GAAWJ,EAAI,IACfK,GAAeL,IACfM,GAAUN,EAAI,IACdO,GAAeP,GAAI,GACnBQ,GAAWR,EAAI,IAEfS,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,GAAcZ,EAAI,CAAC,YAAa,iBAqBtC,SAASa,KACPd,EAAQY,MAAMG,KAAK,CACjBb,MAAO,GACPC,IAAK,GACLC,WAAW,GAEf,CASA,SAASY,KACPR,GAAaI,OAAQ,EACrBH,GAASG,MAAQ,EACnB,CAEA,SAASK,KACP,GAAKf,GAAMU,MAAX,CAKA,GAAIN,GAAaM,OAASL,GAAQK,MAAO,CACvC,IAAKN,GAAaM,MAEhB,YADAM,EAAUC,MAAM,YAIlB,IAAKZ,GAAQK,MAEX,YADAM,EAAUC,MAAM,cAIlB,GAAInB,EAAQY,MAAMQ,SAAWd,GAAaM,MAExC,YADAM,EAAUC,M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Q,OAAS,GAAK1B,EAAMqF,QAGtC/E,EAAQY,MAAMuF,OAAO3E,EAAO,EAC9B,CAkP0BwF,CAAaxF,2DAOvByF,EAAAA,cADRrD,IAAAnB,EAeM,MAfNyE,EAeM,eAXJhE,EAEM,MAAA,CAFDR,MAAM,+BAA6B,CACtCQ,EAAgB,YAAV,aAERA,EAOM,MAPNiE,EAOM,CANJrE,EAKE2B,EAAA,YAJSpE,GAAAO,2CAAAP,GAAQO,MAAA8D,GACjBC,KAAK,WACJC,KAAM,EACPC,YAAY,oDAKVrE,GAAAI,OADRgD,IAAAnB,EAsBM,MAtBN2E,EAsBM,eAlBJlE,EAEM,MAAA,CAFDR,MAAM,kCAAgC,CACzCQ,EAAiB,YAAX,cAERA,EAcM,MAdNmE,EAcM,CAbJvE,EAIEwE,EAJFC,EAIE,CAHQ,cAAa9G,GAAAG,2CAAAH,GAAQG,MAAA8D,IACrB9B,EAAA9C,GAAK,CACbqF,MAAA,CAAAC,MAAA,UAAoB,KAAA,GAAA,CAAA,gBAEtBlC,EAOM,MAPNsE,EAOM,CANJ1E,EAKU2E,GAAA,CAJR9C,KAAK,SACJ+B,QAAO1F,eACT,IAEDiE,EAAA,MAAAA,EAAA,IAAA,GAFC,WAED,oDAKR,IAaE,CAZMyC,EAAAA,gBADR1D,EAaE2D,EAAA,OAXC,UAAS3E,EAAAA,OACT,SAAQ4E,EAAAA,MACR,qBAAmB,EACnB,4BAA2BlI,EAAMmI,uBACjCC,wBAASlI,EAAK,OAAA,OACdmI,0BAAWnI,EAAK,OAAA,SAChBoI,wBAAQpI,EAAK,WACbqI,OAAMhH,GACNiH,sBAAMtI,EAAK,SACXuI,MAAGlD,EAAA,MAAAA,EAAA,IAAEN,GAAQ/E,QAAa+E,IAC1ByD,kCAAmB5H,GAAAI,OAAY"}
1
+ {"version":3,"file":"subject-text-fill.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-text-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Plus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElButton, ElCheckbox, ElCheckboxGroup, ElIcon, ElInput, ElInputNumber, ElLink, ElMessage, ElTag } from 'element-plus'\nimport { onMounted, ref, useAttrs } from 'vue'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n isEdit: boolean\n isSet: boolean\n examExpand?: string\n examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\n keywordCount: number\n }\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n tag: string\n showInput: boolean\n}[]>([{\n title: '',\n tag: '',\n showInput: false,\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst keywordCount = ref()\nconst correct = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\n\nconst checkList = [\n {\n label: '答案不分顺序',\n value: 'isInOrder',\n },\n {\n label: '忽略大小写',\n value: 'isIgnoreCase',\n },\n]\n\nconst isCheckList = ref(['isInOrder', 'isIgnoreCase'])\n\nfunction handleAddTag(item: any) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n}\n\nfunction closeTag(tag: string, item: any) {\n if (tag) {\n const tags = item.title.split(',')\n const index = tags.findIndex((i: string) => i === tag)\n if (index > -1) {\n tags.splice(index, 1)\n item.title = tags.join(',')\n }\n }\n}\n\nfunction addAnswer() {\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 2 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n\n if (keywordCount.value || correct.value) {\n if (!keywordCount.value) {\n ElMessage.error('请完善答题设置!')\n return\n }\n\n if (!correct.value) {\n ElMessage.error('请输入问题正确答案!')\n return\n }\n\n if (answers.value.length !== keywordCount.value) {\n ElMessage.error('关键词个数设置有误!')\n return\n }\n const msg: string[] = []\n answers.value.forEach((item, index) => {\n if (!item.title) {\n msg.push(`关键词${index + 1}未设置`)\n }\n })\n if (msg.length > 0) {\n ElMessage.error(msg.join(','))\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.filter((i: any) => i.title).map((item: any) => {\n return { title: item.title }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: !!correct.value,\n examExpand: correct.value,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n ...{ keywordCount: keywordCount.value },\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.examAnswerSettingVO) {\n // 仅保留与设置匹配的选项\n isCheckList.value = isCheckList.value.filter(item =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\n )\n }\n\n if (props.examAnswerSettingVO?.keywordCount) {\n keywordCount.value = props.examAnswerSettingVO?.keywordCount\n }\n\n if (props.examExpand) {\n correct.value = props.examExpand\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-text-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('text-fill-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div class=\"content\">\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(问答题)</span>\n <div v-if=\"showRichText\">\n <div\n class=\"rich-text\"\n v-html=\"richText\"\n />\n </div>\n <div class=\"content flex flex-col\">\n <template v-if=\"answers.some(item => item.title)\">\n <ElCheckbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n {{ item.title }}\n </ElCheckbox>\n </template>\n </div>\n <div\n v-if=\"correct\"\n class=\"flex\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:{{ correct }}</span>\n </div>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>题目:</span>\n </div>\n <div\n style=\"flex: 1;\"\n class=\"margin-bottom\"\n >\n <ElInput\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"【问答题】请输入问题\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>答题设置:</span>\n </div>\n <span>共答对</span>\n <ElInputNumber\n v-model=\"keywordCount\"\n style=\"width: 100px;margin: 0 10px;\"\n :min=\"1\"\n />\n <span style=\"margin-right: 10px;\">个关键词,算是正确的</span>\n <ElCheckboxGroup\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <ElCheckbox\n :label=\"item.value\"\n class=\"margin-left-10\"\n >\n {{ item.label }}\n </ElCheckbox>\n </ElCheckboxGroup>\n </div>\n <div class=\"flex\">\n <div class=\"label flex flex-justify-end\">\n <span>答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <ElInput\n v-model=\"correct\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入正确答案\"\n :maxlength=\"200\"\n show-word-limit\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"margin-bottom answer-list\">\n <span style=\"padding-left: 60px;\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>关键词{{ index + 1 }}:</span>\n </div>\n\n <div class=\"answer-tags\">\n <template\n v-for=\"i in item.title.split(',')\"\n :key=\"i\"\n >\n <ElTag\n v-if=\"i\"\n closable\n @close=\"closeTag(i, item)\"\n >\n {{ i }}\n </ElTag>\n </template>\n <template v-if=\"!isSave\">\n <ElInput\n v-if=\"item.showInput\"\n v-model=\"item.tag\"\n style=\"width: 80px;\"\n @blur=\"() => handleAddTag(item)\"\n />\n <ElButton\n v-else\n size=\"small\"\n @click=\"item.showInput = true\"\n >\n <ElIcon><Plus /></ElIcon>\n <span>{{ item.title ? '添加同义词' : '添加关键词' }}</span>\n </ElButton>\n </template>\n </div>\n <div class=\"operation\">\n <ElIcon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </ElIcon>\n <ElIcon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 2 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </ElIcon>\n </div>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"margin-bottom flex\"\n >\n <div class=\"label flex flex-justify-end\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <ElInput\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div\n v-if=\"showRichText\"\n class=\"margin-bottom flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor\n v-model:model-value=\"richText\"\n v-bind=\"attrs\"\n style=\"width: 100%;\"\n />\n <div class=\"flex flex-justify-end\">\n <ElLink\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </ElLink>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :show-other-option=\"false\"\n :exam-answer-relation-type=\"props.examAnswerRelationType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"type => emits('add', type)\"\n @on-show-rich-text=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","tag","showInput","analysis","keywordCount","correct","showRichText","richText","checkList","label","value","isCheckList","addAnswer","push","deleteRichText","save","ElMessage","error","length","msg","forEach","item","index","join","filter","i","map","isSetCorrectAnswer","examExpand","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","onMounted","answerList","examAnswerSettingVO","ns","useNamespace","_createElementBlock","class","_normalizeClass","_unref","e","_createVNode","SubjectLayout","isEdit","preview","_createElementVNode","_hoisted_1","_hoisted_2","_hoisted_3","_toDisplayString","orderIndex","_hoisted_4","innerHTML","_hoisted_6","some","_openBlock","_Fragment","key","_renderList","_createBlock","ElCheckbox","disabled","_createTextVNode","_hoisted_7","_hoisted_8","edit","_hoisted_9","_hoisted_10","ElInput","$event","type","rows","placeholder","maxlength","isSave","_hoisted_11","_cache","ElInputNumber","style","width","margin","min","ElCheckboxGroup","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","split","ElTag","closable","onClose","tags","findIndex","splice","closeTag","modelValue","onBlur","handleAddTag","ElButton","size","onClick","ElIcon","Plus","_hoisted_17","CirclePlus","Remove","deleteAnswer","showAnalysis","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","TinyMceEditor","_mergeProps","_hoisted_22","ElLink","showAction","SubjectAction","isSet","examAnswerRelationType","onMoveUp","onMoveDown","onDelete","onSave","onEdit","onAdd","onOnShowRichText"],"mappings":"6/DASA,MAAMA,GAAQC,EAmBRC,GAAQC,GAERC,GAAQC,IAERC,GAAUC,EAIX,CAAC,CACJC,MAAO,GACPC,IAAK,GACLC,WAAW,KAGPF,GAAQD,EAAI,IACZI,GAAWJ,EAAI,IACfK,GAAeL,IACfM,GAAUN,EAAI,IACdO,GAAeP,GAAI,GACnBQ,GAAWR,EAAI,IAEfS,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,GAAcZ,EAAI,CAAC,YAAa,iBAqBtC,SAASa,KACPd,GAAQY,MAAMG,KAAK,CACjBb,MAAO,GACPC,IAAK,GACLC,WAAW,GAEf,CASA,SAASY,KACPR,GAAaI,OAAQ,EACrBH,GAASG,MAAQ,EACnB,CAEA,SAASK,KACP,GAAKf,GAAMU,MAAX,CAKA,GAAIN,GAAaM,OAASL,GAAQK,MAAO,CACvC,IAAKN,GAAaM,MAEhB,YADAM,EAAUC,MAAM,YAIlB,IAAKZ,GAAQK,MAEX,YADAM,EAAUC,MAAM,cAIlB,GAAInB,GAAQY,MAAMQ,SAAWd,GAAaM,MAExC,YADAM,EAAUC,MAAM,cAGlB,MAAME,EAAgB,GAMtB,GALArB,GAAQY,MAAMU,QAAQ,CAACC,EAAMC,KACtBD,EAAKrB,OACRmB,EAAIN,KAAK,MAAMS,EAAQ,UAGvBH,EAAID,OAAS,EAEf,YADAF,EAAUC,MAAME,EAAII,KAAK,KAG7B,CAEA7B,GAAM,OAAQ,CACZM,MAAOA,GAAMU,MACbZ,QAASA,GAAQY,MAAMc,OAAQC,GAAWA,EAAEzB,OAAO0B,IAAKL,IAC/C,CAAErB,MAAOqB,EAAKrB,SAEvBG,SAAUA,GAASO,MACnBiB,qBAAsBtB,GAAQK,MAC9BkB,WAAYvB,GAAQK,MACpBmB,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,WACJC,KAAM,EACPC,YAAY,oDAKVrE,GAAAI,OADRgD,IAAAnB,EAsBM,MAtBN2E,EAsBM,eAlBJlE,EAEM,MAAA,CAFDR,MAAM,kCAAgC,CACzCQ,EAAiB,YAAX,cAERA,EAcM,MAdNmE,GAcM,CAbJvE,EAIEwE,EAJFC,EAIE,CAHQ,cAAa9G,GAAAG,2CAAAH,GAAQG,MAAA8D,IACrB9B,EAAA9C,IAAK,CACbqF,MAAA,CAAAC,MAAA,UAAoB,KAAA,GAAA,CAAA,gBAEtBlC,EAOM,MAPNsE,GAOM,CANJ1E,EAKSF,EAAA6E,GAAA,CAJP9C,KAAK,SACJ+B,QAAO1F,eACT,IAEDiE,EAAA,MAAAA,EAAA,IAAA,GAFC,WAED,oDAKR,IAaE,CAZMyC,EAAAA,gBADR1D,EAaE2D,EAAA,OAXC,UAAS3E,EAAAA,OACT,SAAQ4E,EAAAA,MACR,qBAAmB,EACnB,4BAA2BlI,GAAMmI,uBACjCC,wBAASlI,GAAK,OAAA,OACdmI,0BAAWnI,GAAK,OAAA,SAChBoI,wBAAQpI,GAAK,WACbqI,OAAMhH,GACNiH,sBAAMtI,GAAK,SACXuI,MAAGlD,EAAA,MAAAA,EAAA,IAAEN,GAAQ/E,SAAa+E,IAC1ByD,kCAAmB5H,GAAAI,OAAY"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as e,ref as t,useAttrs as s,computed as n,watch as i,createElementBlock as a,openBlock as o,normalizeClass as l,unref as r,createElementVNode as d,Fragment as c,renderList as m,createBlock as u,createCommentVNode as x,mergeProps as p}from"vue";import{useNamespace as w}from"@qxs-bns/hooks";import{setGuid as v}from"@qxs-bns/utils";import{ElMessage as y}from"element-plus";import h from"./components/subject-blank-fill.vue.mjs";import f from"./components/subject-scale.vue.mjs";import E from"./components/subject-single.vue.mjs";import T from"./components/subject-text-fill.vue.mjs";import S from"./components/SubjectPageEnd.vue.mjs";import A from"./components/SubjectRichText.vue.mjs";const R={class:"subject-list-wrapper"};var g=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:g,emit:D}){const I=e,j=D,C=t([]),b=s();g({addSubject:M,currentList:C,uploadExcel:function(e){C.value=C.value.concat(e)},addExam:function(e){console.log(e,"items");let t=1;const s=[];e.forEach(e=>{const n={...e,customId:v(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:e.answers?.map(e=>({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect}))||[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1};n.pageIndex>t&&(s.push({customId:v(),answerType:"page_end",analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:0}),t=n.pageIndex),s.push(n)}),C.value=C.value.concat(s)},setAnswerRelation:function(e,t,s){const n=C.value.find(e=>e.customId===t);if(n){const t=n.answers?.find(e=>e.customAnswerId===s);t&&(t.answerRelations=e)}}});const _=n(()=>{const e=C.value.filter(e=>"page_end"===e.answerType);return t=>{const s=e.findIndex(e=>e.customId===t);return-1!==s?s+1:0}});function k(){return e=>{let t=0,s=0;return C.value.forEach(n=>{"page_end"!==n.answerType&&(t++,e===n.customId&&(s=t))}),s-1}}function M(e,t=null,s=null){const n={customId:v(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s};null!==t?C.value.splice(t+1,0,n):C.value.push(n)}function L(e,t){if("up"===t&&e>0){const[t]=C.value.splice(e,1);C.value.splice(e-1,0,t)}else if("down"===t&&e<C.value.length-1){const[t]=C.value.splice(e,1);C.value.splice(e+1,0,t)}}function P(e,t){C.value[e]={...C.value[e],...t,isEdit:!1,examAnswerRelationType:t.examAnswerRelationType}}function q(e){C.value.splice(e,1),y.success("删除成功")}function Q(e,t){j("setRelation",e,t)}i(()=>I.subjectList,e=>{e&&(C.value=[...e])},{immediate:!0});const O=w("subject-list");return(e,t)=>(o(),a("div",{class:l(r(O).e("list-exam"))},[d("div",R,[(o(!0),a(c,null,m(C.value,(t,s)=>(o(),a("div",{key:t.customId,class:"subject-item"},[["single","multiple","sort"].includes(t.answerType)?(o(),u(E,p({key:0,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,type:t.answerType,"exam-id":t.examId,"is-key":t.isKey,"is-save":!t.isRealCanDel,"custom-id":t.customId,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"least-answer-count":t.leastAnswerCount,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,"exam-expand":t.examExpand,"answer-check-type":t.answerCheckType,"exam-rich-text-content":t.examRichTextContent,"exam-answer-relation-type":t.examAnswerRelationType,onSetRelation:Q,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:(e,t)=>M(e,s,t)}),null,16,["order-index","title","type","exam-id","is-key","is-save","custom-id","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answer-check-type","exam-rich-text-content","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===t.answerType?(o(),u(f,p({key:1,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"is-edit":t.isEdit||!1,"scale-question-list":t.scaleQuestionList,"show-action":!e.isPreview,"exam-rich-text-content":t.examRichTextContent,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===t.answerType?(o(),u(h,p({key:2,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},"exam-rich-text-content":t.examRichTextContent,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-answer-setting-v-o","exam-rich-text-content","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===t.answerType?(o(),u(T,p({key:3,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-expand":t.examExpand,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},"exam-answer-relation-type":t.examAnswerRelationType,"exam-rich-text-content":t.examRichTextContent,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","exam-answer-relation-type","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===t.answerType?(o(),u(A,p({key:4,ref_for:!0},r(b),{"order-index":k()(t.customId),"rich-text-content":t.richTextContent,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","rich-text-content","is-set","is-save","is-edit","show-action","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"page_end"===t.answerType?(o(),u(S,{key:s,"total-page":C.value.filter(e=>"page_end"===e.answerType).length,"current-page-index":_.value(t.customId),item:t,"is-edit":t.isEdit||!1,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)},null,8,["total-page","current-page-index","item","is-edit","is-set","is-save","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):x("v-if",!0)]))),128))])],2))}});export{g as default};
1
+ import{defineComponent as e,ref as t,useAttrs as s,computed as n,watch as i,createElementBlock as a,openBlock as o,normalizeClass as l,unref as r,createElementVNode as d,Fragment as c,renderList as m,createBlock as u,createCommentVNode as x,mergeProps as p}from"vue";import{useNamespace as w}from"@qxs-bns/hooks";import{ElMessage as v}from"element-plus";import{nanoid as y}from"nanoid";import h from"./components/subject-blank-fill.vue.mjs";import f from"./components/subject-scale.vue.mjs";import E from"./components/subject-single.vue.mjs";import T from"./components/subject-text-fill.vue.mjs";import S from"./components/SubjectPageEnd.vue.mjs";import A from"./components/SubjectRichText.vue.mjs";const R={class:"subject-list-wrapper"};var g=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:g,emit:D}){const I=e,j=D,C=t([]),b=s();g({addSubject:M,currentList:C,uploadExcel:function(e){C.value=C.value.concat(e)},addExam:function(e){let t=1;const s=[];e.forEach(e=>{const n={...e,customId:y(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:e.answers?.map(e=>({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect}))||[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1};n.pageIndex>t&&(s.push({customId:y(),answerType:"page_end",analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:0}),t=n.pageIndex),s.push(n)}),C.value=C.value.concat(s)},setAnswerRelation:function(e,t,s){const n=C.value.find(e=>e.customId===t);if(n){const t=n.answers?.find(e=>e.customAnswerId===s);t&&(t.answerRelations=e)}}});const _=n(()=>{const e=C.value.filter(e=>"page_end"===e.answerType);return t=>{const s=e.findIndex(e=>e.customId===t);return-1!==s?s+1:0}});function k(){return e=>{let t=0,s=0;return C.value.forEach(n=>{"page_end"!==n.answerType&&(t++,e===n.customId&&(s=t))}),s-1}}function M(e,t=null,s=null){const n={customId:y(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s};null!==t?C.value.splice(t+1,0,n):C.value.push(n)}function L(e,t){if("up"===t&&e>0){const[t]=C.value.splice(e,1);C.value.splice(e-1,0,t)}else if("down"===t&&e<C.value.length-1){const[t]=C.value.splice(e,1);C.value.splice(e+1,0,t)}}function P(e,t){C.value[e]={...C.value[e],...t,isEdit:!1,examAnswerRelationType:t.examAnswerRelationType}}function q(e){C.value.splice(e,1),v.success("删除成功")}function Q(e,t){j("setRelation",e,t)}i(()=>I.subjectList,e=>{e&&(C.value=[...e])},{immediate:!0});const O=w("subject-list");return(e,t)=>(o(),a("div",{class:l(r(O).e("list-exam"))},[d("div",R,[(o(!0),a(c,null,m(C.value,(t,s)=>(o(),a("div",{key:t.customId,class:"subject-item"},[["single","multiple","sort"].includes(t.answerType)?(o(),u(E,p({key:0,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,type:t.answerType,"exam-id":t.examId,"is-key":t.isKey,"is-save":!t.isRealCanDel,"custom-id":t.customId,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"least-answer-count":t.leastAnswerCount,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,"exam-expand":t.examExpand,"answer-check-type":t.answerCheckType,"exam-rich-text-content":t.examRichTextContent,"exam-answer-relation-type":t.examAnswerRelationType,onSetRelation:Q,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:(e,t)=>M(e,s,t)}),null,16,["order-index","title","type","exam-id","is-key","is-save","custom-id","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answer-check-type","exam-rich-text-content","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===t.answerType?(o(),u(f,p({key:1,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"is-edit":t.isEdit||!1,"scale-question-list":t.scaleQuestionList,"show-action":!e.isPreview,"exam-rich-text-content":t.examRichTextContent,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===t.answerType?(o(),u(h,p({key:2,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},"exam-rich-text-content":t.examRichTextContent,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-answer-setting-v-o","exam-rich-text-content","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===t.answerType?(o(),u(T,p({key:3,ref_for:!0},r(b),{"order-index":k()(t.customId),title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-expand":t.examExpand,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},"exam-answer-relation-type":t.examAnswerRelationType,"exam-rich-text-content":t.examRichTextContent,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","exam-answer-relation-type","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===t.answerType?(o(),u(A,p({key:4,ref_for:!0},r(b),{"order-index":k()(t.customId),"rich-text-content":t.richTextContent,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)}),null,16,["order-index","rich-text-content","is-set","is-save","is-edit","show-action","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):"page_end"===t.answerType?(o(),u(S,{key:s,"total-page":C.value.filter(e=>"page_end"===e.answerType).length,"current-page-index":_.value(t.customId),item:t,"is-edit":t.isEdit||!1,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"exam-answer-relation-type":t.examAnswerRelationType,onMove:e=>L(s,e),onDelete:e=>q(s),onSave:e=>P(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>M(e,s,null)},null,8,["total-page","current-page-index","item","is-edit","is-set","is-save","exam-answer-relation-type","onMove","onDelete","onSave","onEdit","onAdd"])):x("v-if",!0)]))),128))])],2))}});export{g as default};
2
2
  //# sourceMappingURL=subject-list.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-list.vue.mjs","sources":["../../../../../../packages/components/src/subject-list/src/subject-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { setGuid } from '@qxs-bns/utils'\nimport { ElMessage } from 'element-plus'\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport SubjectBlankFill from './components/subject-blank-fill.vue'\nimport SubjectScale from './components/subject-scale.vue'\nimport SubjectSingle from './components/subject-single.vue'\nimport SubjectTextFill from './components/subject-text-fill.vue'\nimport SubjectPageEnd from './components/SubjectPageEnd.vue'\nimport SubjectRichText from './components/SubjectRichText.vue'\n\ndefineOptions({\n name: 'QxsSubjectList',\n})\n\nconst props = defineProps<{\n subjectList: any[]\n isPreview: boolean\n}>()\nconst emits = defineEmits(['setRelation'])\nconst currentList = ref([] as any)\nconst attrs = useAttrs()\n\ndefineExpose({\n addSubject,\n currentList,\n uploadExcel,\n addExam,\n setAnswerRelation,\n})\n\nfunction totalPageIndex() {\n return currentList.value.filter((v: any) => v.answerType === 'page_end').length\n}\n\nconst currentPageIndex = computed(() => {\n const currentPageList = currentList.value.filter((v: any) => v.answerType === 'page_end')\n return (currentId: string) => {\n const currentIndex = currentPageList.findIndex((c: any) => c.customId === currentId)\n return currentIndex !== -1 ? currentIndex + 1 : 0\n }\n})\n\nfunction currentIndex() {\n return (currentExamId: string) => {\n let current = 0\n let output = 0\n\n // 遍历 currentList,过滤掉分页器,并计算题目序号\n currentList.value.forEach((v: any) => {\n if (v.answerType !== 'page_end') { // 排除分页器\n current++\n if (currentExamId === v.customId) { // 匹配当前题目 ID\n output = current\n }\n }\n })\n\n return output - 1\n }\n}\n\nfunction addSubject(type: string, index: number | null = null, examAnswerRelationType: number | null = null) {\n const newSubject = {\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType,\n }\n\n if (index !== null) {\n currentList.value.splice(index + 1, 0, newSubject)\n }\n else {\n currentList.value.push(newSubject)\n }\n}\nfunction addExam(items: any[]) {\n console.log(items, 'items')\n\n let currentIndex = 1\n const newList: any[] = []\n\n items.forEach((v: any) => {\n // 创建新的题目对象\n const newItem = {\n ...v,\n customId: setGuid(),\n answerType: v.richTextContent ? 'rich_text' : v.examTypeEnum,\n answers: v.answers?.map((c: any) => ({\n ...c,\n title: c.answer,\n answerId: c.examAnswerId,\n isCorrect: c.isCorrect,\n })) || [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n }\n\n // 如果当前题目的 pageIndex 和 currentIndex 不一致,则插入分页器\n if (newItem.pageIndex > currentIndex) {\n newList.push({\n customId: setGuid(),\n answerType: 'page_end',\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: 0,\n })\n currentIndex = newItem.pageIndex\n }\n\n // 将题目添加到 newList\n newList.push(newItem)\n })\n\n // 更新 currentList\n currentList.value = currentList.value.concat(newList)\n}\nfunction uploadExcel(list: any[]) {\n currentList.value = currentList.value.concat(list)\n}\n\nfunction move(index: number, type: 'up' | 'down') {\n if (type === 'up' && index > 0) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index - 1, 0, item)\n }\n else if (type === 'down' && index < currentList.value.length - 1) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index + 1, 0, item)\n }\n}\n\nfunction saveSubject(index: number, item: any) {\n currentList.value[index] = {\n ...currentList.value[index],\n ...item,\n isEdit: false,\n examAnswerRelationType: item.examAnswerRelationType,\n }\n}\n\nfunction deleteSubject(index: number) {\n currentList.value.splice(index, 1)\n ElMessage.success('删除成功')\n}\n\nfunction setRelation(customId: number, examAnswers: any) {\n emits('setRelation', customId, examAnswers)\n}\n\nfunction setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const targetItem = currentList.value.find((v: any) => v.customId === customId)\n if (targetItem) {\n const targetAnswer = targetItem.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (targetAnswer) {\n targetAnswer.answerRelations = answerRelations\n }\n }\n}\n\nwatch(() => props.subjectList, (newList: any) => {\n if (newList) {\n currentList.value = [...newList]\n }\n}, { immediate: true })\n\nconst ns = useNamespace('subject-list')\n</script>\n\n<template>\n <div :class=\"ns.e('list-exam')\">\n <div class=\"subject-list-wrapper\">\n <div\n v-for=\"(item, index) in currentList\"\n :key=\"item.customId\"\n class=\"subject-item\"\n >\n <template v-if=\"['single', 'multiple', 'sort'].includes(item.answerType)\">\n <SubjectSingle\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :type=\"item.answerType\"\n :exam-id=\"item.examId\"\n :is-key=\"item.isKey\"\n :is-save=\"!item.isRealCanDel\"\n :custom-id=\"item.customId\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :least-answer-count=\"item.leastAnswerCount\"\n :is-edit=\"item.isEdit || false\"\n :show-action=\"!isPreview\"\n :exam-expand=\"item.examExpand\"\n :answer-check-type=\"item.answerCheckType\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @set-relation=\"setRelation\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string, examAnswerRelationType: number) => addSubject(type, index, examAnswerRelationType)\"\n />\n </template>\n <SubjectScale\n v-else-if=\"item.answerType === 'scale'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :is-edit=\"item.isEdit || false\"\n :scale-question-list=\"item.scaleQuestionList\"\n :show-action=\"!isPreview\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectBlankFill\n v-else-if=\"item.answerType === 'blank_fill'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :show-action=\"!isPreview\"\n :is-edit=\"item.isEdit || false\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectTextFill\n v-else-if=\"item.answerType === 'text_fill'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :show-action=\"!isPreview\"\n :is-edit=\"item.isEdit || false\"\n :exam-expand=\"item.examExpand\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectRichText\n v-else-if=\"item.answerType === 'rich_text'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :rich-text-content=\"item.richTextContent\"\n :is-set=\"item.hasSet || false\"\n :is-save=\"!item.isRealCanDel\"\n :is-edit=\"item.isEdit || false\"\n :show-action=\"!isPreview\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectPageEnd\n v-else-if=\"item.answerType === 'page_end'\"\n :key=\"index\"\n :total-page=\"totalPageIndex()\"\n :current-page-index=\"currentPageIndex(item.customId)\"\n :item=\"item\"\n :is-edit=\"item.isEdit || false\"\n :is-set=\"item.hasSet || false\"\n :is-save=\"!item.isRealCanDel\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","currentList","ref","attrs","useAttrs","__expose","addSubject","uploadExcel","list","value","concat","addExam","items","console","log","currentIndex","newList","forEach","v","newItem","customId","setGuid","answerType","richTextContent","examTypeEnum","answers","map","c","title","answer","answerId","examAnswerId","isCorrect","isSave","isEdit","isRealCanDel","hasSet","pageIndex","push","analysis","scaleQuestionList","examAnswerRelationType","setAnswerRelation","answerRelations","customAnswerId","targetItem","find","targetAnswer","currentPageIndex","computed","currentPageList","filter","currentId","findIndex","currentExamId","current","output","type","index","newSubject","splice","move","item","length","saveSubject","deleteSubject","ElMessage","success","setRelation","examAnswers","watch","subjectList","immediate","ns","useNamespace","_createElementBlock","class","_normalizeClass","_unref","e","_createElementVNode","_hoisted_1","_openBlock","_Fragment","_renderList","key","includes","_createBlock","SubjectSingle","_mergeProps","examId","isKey","leastAnswerCount","isPreview","examExpand","answerCheckType","examRichTextContent","onSetRelation","onMove","onDelete","$event","onSave","onEdit","onAdd","SubjectScale","SubjectBlankFill","examAnswerSettingVO","SubjectTextFill","SubjectRichText","SubjectPageEnd"],"mappings":"m6BAgBA,MAAMA,EAAQC,EAIRC,EAAQC,EACRC,EAAcC,EAAI,IAClBC,EAAQC,IAEdC,EAAa,CACXC,aACAL,cACAM,YAuGF,SAAqBC,GACnBP,EAAYQ,MAAQR,EAAYQ,MAAMC,OAAOF,EAC/C,EAxGEG,QAuDF,SAAiBC,GACfC,QAAQC,IAAIF,EAAO,SAEnB,IAAIG,EAAe,EACnB,MAAMC,EAAiB,GAEvBJ,EAAMK,QAASC,IAEb,MAAMC,EAAU,IACXD,EACHE,SAAUC,IACVC,WAAYJ,EAAEK,gBAAkB,YAAcL,EAAEM,aAChDC,QAASP,EAAEO,SAASC,IAAKC,IAAA,IACpBA,EACHC,MAAOD,EAAEE,OACTC,SAAUH,EAAEI,aACZC,UAAWL,EAAEK,cACR,GACPC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,GAINjB,EAAQkB,UAAYtB,IACtBC,EAAQsB,KAAK,CACXlB,SAAUC,IACVC,WAAY,WACZiB,SAAU,GACVC,kBAAmB,GACnBP,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRK,uBAAwB,IAE1B1B,EAAeI,EAAQkB,WAIzBrB,EAAQsB,KAAKnB,KAIflB,EAAYQ,MAAQR,EAAYQ,MAAMC,OAAOM,EAC/C,EApGE0B,kBAsIF,SAA2BC,EAAsBvB,EAAkBwB,GACjE,MAAMC,EAAa5C,EAAYQ,MAAMqC,KAAM5B,GAAWA,EAAEE,WAAaA,GACrE,GAAIyB,EAAY,CACd,MAAME,EAAeF,EAAWpB,SAASqB,KAAMnB,GAAWA,EAAEiB,iBAAmBA,GAC3EG,IACFA,EAAaJ,gBAAkBA,EAEnC,CACF,IAvIA,MAAMK,EAAmBC,EAAS,KAChC,MAAMC,EAAkBj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yD,OAAOzC,GAAwBI,EAAKH,EAAOD,GAC3C0C,SAAMC,GAAEnC,EAAcP,GACtB2C,OAAOvC,GAAcE,EAAYN,EAAOI,GACxCwC,OAAIF,GAAEtC,EAAK5B,QAAM,EACjBqE,MAAM9C,GAAiBnD,EAAWmD,EAAMC,EAAK"}
1
+ {"version":3,"file":"subject-list.vue.mjs","sources":["../../../../../../packages/components/src/subject-list/src/subject-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport SubjectBlankFill from './components/subject-blank-fill.vue'\nimport SubjectScale from './components/subject-scale.vue'\nimport SubjectSingle from './components/subject-single.vue'\nimport SubjectTextFill from './components/subject-text-fill.vue'\nimport SubjectPageEnd from './components/SubjectPageEnd.vue'\nimport SubjectRichText from './components/SubjectRichText.vue'\n\ndefineOptions({\n name: 'QxsSubjectList',\n})\n\nconst props = defineProps<{\n subjectList: any[]\n isPreview: boolean\n}>()\nconst emits = defineEmits(['setRelation'])\nconst currentList = ref([] as any)\nconst attrs = useAttrs()\n\ndefineExpose({\n addSubject,\n currentList,\n uploadExcel,\n addExam,\n setAnswerRelation,\n})\n\nfunction totalPageIndex() {\n return currentList.value.filter((v: any) => v.answerType === 'page_end').length\n}\n\nconst currentPageIndex = computed(() => {\n const currentPageList = currentList.value.filter((v: any) => v.answerType === 'page_end')\n return (currentId: string) => {\n const currentIndex = currentPageList.findIndex((c: any) => c.customId === currentId)\n return currentIndex !== -1 ? currentIndex + 1 : 0\n }\n})\n\nfunction currentIndex() {\n return (currentExamId: string) => {\n let current = 0\n let output = 0\n\n // 遍历 currentList,过滤掉分页器,并计算题目序号\n currentList.value.forEach((v: any) => {\n if (v.answerType !== 'page_end') { // 排除分页器\n current++\n if (currentExamId === v.customId) { // 匹配当前题目 ID\n output = current\n }\n }\n })\n\n return output - 1\n }\n}\n\nfunction addSubject(type: string, index: number | null = null, examAnswerRelationType: number | null = null) {\n const newSubject = {\n customId: nanoid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType,\n }\n\n if (index !== null) {\n currentList.value.splice(index + 1, 0, newSubject)\n }\n else {\n currentList.value.push(newSubject)\n }\n}\nfunction addExam(items: any[]) {\n let currentIndex = 1\n const newList: any[] = []\n\n items.forEach((v: any) => {\n // 创建新的题目对象\n const newItem = {\n ...v,\n customId: nanoid(),\n answerType: v.richTextContent ? 'rich_text' : v.examTypeEnum,\n answers: v.answers?.map((c: any) => ({\n ...c,\n title: c.answer,\n answerId: c.examAnswerId,\n isCorrect: c.isCorrect,\n })) || [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n }\n\n // 如果当前题目的 pageIndex 和 currentIndex 不一致,则插入分页器\n if (newItem.pageIndex > currentIndex) {\n newList.push({\n customId: nanoid(),\n answerType: 'page_end',\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: 0,\n })\n currentIndex = newItem.pageIndex\n }\n\n // 将题目添加到 newList\n newList.push(newItem)\n })\n\n // 更新 currentList\n currentList.value = currentList.value.concat(newList)\n}\nfunction uploadExcel(list: any[]) {\n currentList.value = currentList.value.concat(list)\n}\n\nfunction move(index: number, type: 'up' | 'down') {\n if (type === 'up' && index > 0) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index - 1, 0, item)\n }\n else if (type === 'down' && index < currentList.value.length - 1) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index + 1, 0, item)\n }\n}\n\nfunction saveSubject(index: number, item: any) {\n currentList.value[index] = {\n ...currentList.value[index],\n ...item,\n isEdit: false,\n examAnswerRelationType: item.examAnswerRelationType,\n }\n}\n\nfunction deleteSubject(index: number) {\n currentList.value.splice(index, 1)\n ElMessage.success('删除成功')\n}\n\nfunction setRelation(customId: number, examAnswers: any) {\n emits('setRelation', customId, examAnswers)\n}\n\nfunction setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const targetItem = currentList.value.find((v: any) => v.customId === customId)\n if (targetItem) {\n const targetAnswer = targetItem.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (targetAnswer) {\n targetAnswer.answerRelations = answerRelations\n }\n }\n}\n\nwatch(() => props.subjectList, (newList: any) => {\n if (newList) {\n currentList.value = [...newList]\n }\n}, { immediate: true })\n\nconst ns = useNamespace('subject-list')\n</script>\n\n<template>\n <div :class=\"ns.e('list-exam')\">\n <div class=\"subject-list-wrapper\">\n <div\n v-for=\"(item, index) in currentList\"\n :key=\"item.customId\"\n class=\"subject-item\"\n >\n <template v-if=\"['single', 'multiple', 'sort'].includes(item.answerType)\">\n <SubjectSingle\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :type=\"item.answerType\"\n :exam-id=\"item.examId\"\n :is-key=\"item.isKey\"\n :is-save=\"!item.isRealCanDel\"\n :custom-id=\"item.customId\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :least-answer-count=\"item.leastAnswerCount\"\n :is-edit=\"item.isEdit || false\"\n :show-action=\"!isPreview\"\n :exam-expand=\"item.examExpand\"\n :answer-check-type=\"item.answerCheckType\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @set-relation=\"setRelation\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string, examAnswerRelationType: number) => addSubject(type, index, examAnswerRelationType)\"\n />\n </template>\n <SubjectScale\n v-else-if=\"item.answerType === 'scale'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :is-edit=\"item.isEdit || false\"\n :scale-question-list=\"item.scaleQuestionList\"\n :show-action=\"!isPreview\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectBlankFill\n v-else-if=\"item.answerType === 'blank_fill'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :show-action=\"!isPreview\"\n :is-edit=\"item.isEdit || false\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectTextFill\n v-else-if=\"item.answerType === 'text_fill'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\"\n :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\"\n :analysis=\"item.analysis\"\n :show-action=\"!isPreview\"\n :is-edit=\"item.isEdit || false\"\n :exam-expand=\"item.examExpand\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n :exam-rich-text-content=\"item.examRichTextContent\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectRichText\n v-else-if=\"item.answerType === 'rich_text'\"\n v-bind=\"attrs\"\n :order-index=\"currentIndex()(item.customId)\"\n :rich-text-content=\"item.richTextContent\"\n :is-set=\"item.hasSet || false\"\n :is-save=\"!item.isRealCanDel\"\n :is-edit=\"item.isEdit || false\"\n :show-action=\"!isPreview\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n <SubjectPageEnd\n v-else-if=\"item.answerType === 'page_end'\"\n :key=\"index\"\n :total-page=\"totalPageIndex()\"\n :current-page-index=\"currentPageIndex(item.customId)\"\n :item=\"item\"\n :is-edit=\"item.isEdit || false\"\n :is-set=\"item.hasSet || false\"\n :is-save=\"!item.isRealCanDel\"\n :exam-answer-relation-type=\"item.examAnswerRelationType\"\n @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\"\n @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\"\n />\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","currentList","ref","attrs","useAttrs","__expose","addSubject","uploadExcel","list","value","concat","addExam","items","currentIndex","newList","forEach","v","newItem","customId","nanoid","answerType","richTextContent","examTypeEnum","answers","map","c","title","answer","answerId","examAnswerId","isCorrect","isSave","isEdit","isRealCanDel","hasSet","pageIndex","push","analysis","scaleQuestionList","examAnswerRelationType","setAnswerRelation","answerRelations","customAnswerId","targetItem","find","targetAnswer","currentPageIndex","computed","currentPageList","filter","currentId","findIndex","currentExamId","current","output","type","index","newSubject","splice","move","item","length","saveSubject","deleteSubject","ElMessage","success","setRelation","examAnswers","watch","subjectList","immediate","ns","useNamespace","_createElementBlock","class","_normalizeClass","_unref","e","_createElementVNode","_hoisted_1","_openBlock","_Fragment","_renderList","key","includes","_createBlock","SubjectSingle","_mergeProps","examId","isKey","leastAnswerCount","isPreview","examExpand","answerCheckType","examRichTextContent","onSetRelation","onMove","onDelete","$event","onSave","onEdit","onAdd","SubjectScale","SubjectBlankFill","examAnswerSettingVO","SubjectTextFill","SubjectRichText","SubjectPageEnd"],"mappings":"05BAgBA,MAAMA,EAAQC,EAIRC,EAAQC,EACRC,EAAcC,EAAI,IAClBC,EAAQC,IAEdC,EAAa,CACXC,aACAL,cACAM,YAqGF,SAAqBC,GACnBP,EAAYQ,MAAQR,EAAYQ,MAAMC,OAAOF,EAC/C,EAtGEG,QAuDF,SAAiBC,GACf,IAAIC,EAAe,EACnB,MAAMC,EAAiB,GAEvBF,EAAMG,QAASC,IAEb,MAAMC,EAAU,IACXD,EACHE,SAAUC,IACVC,WAAYJ,EAAEK,gBAAkB,YAAcL,EAAEM,aAChDC,QAASP,EAAEO,SAASC,IAAKC,IAAA,IACpBA,EACHC,MAAOD,EAAEE,OACTC,SAAUH,EAAEI,aACZC,UAAWL,EAAEK,cACR,GACPC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,GAINjB,EAAQkB,UAAYtB,IACtBC,EAAQsB,KAAK,CACXlB,SAAUC,IACVC,WAAY,WACZiB,SAAU,GACVC,kBAAmB,GACnBP,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRK,uBAAwB,IAE1B1B,EAAeI,EAAQkB,WAIzBrB,EAAQsB,KAAKnB,KAIfhB,EAAYQ,MAAQR,EAAYQ,MAAMC,OAAOI,EAC/C,EAlGE0B,kBAoIF,SAA2BC,EAAsBvB,EAAkBwB,GACjE,MAAMC,EAAa1C,EAAYQ,MAAMmC,KAAM5B,GAAWA,EAAE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AAjBA,EAAEI,YAA2ByC,OAwQhE,qBAAoBf,EAAArC,MAAiBmD,EAAK1C,UAC1C0C,OACA,UAASA,EAAK5B,SAAM,EACpB,SAAQ4B,EAAK1B,SAAM,EACnB,WAAU0B,EAAK3B,aACf,4BAA2B2B,EAAKrB,uBAChCyD,OAAOzC,GAAwBI,EAAKH,EAAOD,GAC3C0C,SAAMC,GAAEnC,EAAcP,GACtB2C,OAAOvC,GAAcE,EAAYN,EAAOI,GACxCwC,OAAIF,GAAEtC,EAAK5B,QAAM,EACjBqE,MAAM9C,GAAiBjD,EAAWiD,EAAMC,EAAK"}
@@ -1,2 +1,2 @@
1
- "use strict";exports.version="0.0.80";
1
+ "use strict";exports.version="0.0.82";
2
2
  //# sourceMappingURL=package.json.cjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@element-plus/icons-vue"),o=require("@qxs-bns/hooks"),l=require("../../subject-type/src/subject-type.vue.cjs");const a={key:0,class:"flex-justify-between"},n={class:"flex-justify-between"},c={key:0,class:"has-set"},r={key:1,class:"flex flex-justify-end action-buttons"};var i=e.defineComponent({name:"QxsSubjectAction",__name:"subject-action",props:{isEdit:Boolean,isSet:{type:Boolean,default:!1},isKey:{type:Boolean,default:!1},answerCheckType:{type:Number,default:1},showOtherOption:{type:Boolean,default:!0},examAnswerRelationType:{type:Number,default:null},showRichText:{type:Boolean,default:!0},pageEnd:{type:Boolean,default:!1}},emits:["moveUp","moveDown","delete","save","edit","add","onShowRichText","setKey","setAnswerSetting"],setup(i,{emit:d}){const u=i,s=d,m=e.ref(u.isKey),p=e.ref(!1),v=e.ref(u.answerCheckType),f=o.useNamespace("subject-action"),V=e.ref(!0),C=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}],k=e.computed(()=>C.find(e=>e.value===v.value)?.label);function x(){p.value=!1,s("setAnswerSetting",v.value)}function h(){s("setKey",m.value)}function N(e,t){s("add",e,t?u.examAnswerRelationType:null)}return(o,d)=>{const u=e.resolveComponent("el-link"),y=e.resolveComponent("el-popover"),w=e.resolveComponent("el-checkbox"),_=e.resolveComponent("el-icon"),B=e.resolveComponent("el-button"),b=e.resolveComponent("el-radio"),g=e.resolveComponent("el-radio-group"),T=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(f).e("action-exam"))},[e.createElementVNode("div",{class:e.normalizeClass(["action flex flex-justify-between",{active:i.isEdit}])},[e.createCommentVNode(" 编辑模式 "),i.isEdit?(e.openBlock(),e.createElementBlock("div",a,[e.createVNode(y,{trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(u,{type:"primary",class:"btn-margin"},{default:e.withCtx(()=>d[15]||(d[15]=[e.createTextVNode(" +在此题后加入新题 ",-1)])),_:1,__:[15]})]),default:e.withCtx(()=>[e.createVNode(l.default,{onSelect:N})]),_:1}),i.showRichText?(e.openBlock(),e.createBlock(u,{key:0,type:"primary",class:"btn-margin",onClick:d[0]||(d[0]=e=>s("onShowRichText"))},{default:e.withCtx(()=>d[16]||(d[16]=[e.createTextVNode(" +添加题目描述(图文) ",-1)])),_:1,__:[16]})):e.createCommentVNode("v-if",!0),i.showOtherOption?(e.openBlock(),e.createBlock(u,{key:1,type:"primary",class:"btn-margin",onClick:d[1]||(d[1]=e=>p.value=!0)},{default:e.withCtx(()=>d[17]||(d[17]=[e.createTextVNode(" 答题设置 ",-1)])),_:1,__:[17]})):e.createCommentVNode("v-if",!0),i.showOtherOption?(e.openBlock(),e.createBlock(w,{key:2,modelValue:m.value,"onUpdate:modelValue":d[2]||(d[2]=e=>m.value=e),label:"核心题",onChange:h},null,8,["modelValue"])):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createCommentVNode(" 非编辑模式 "),e.createElementVNode("div",n,[i.showOtherOption?(e.openBlock(),e.createBlock(w,{key:0,modelValue:m.value,"onUpdate:modelValue":d[3]||(d[3]=e=>m.value=e),label:"核心题",disabled:""},null,8,["modelValue"])):e.createCommentVNode("v-if",!0),i.showOtherOption?(e.openBlock(),e.createBlock(w,{key:1,modelValue:V.value,"onUpdate:modelValue":d[4]||(d[4]=e=>V.value=e),label:k.value,disabled:"",class:"btn-margin"},null,8,["modelValue","label"])):e.createCommentVNode("v-if",!0)])],2112)),e.createCommentVNode(" 操作按钮 "),e.createElementVNode("div",null,[i.isSet?(e.openBlock(),e.createElementBlock("div",c," *此题设置了跳题逻辑 ")):(e.openBlock(),e.createElementBlock("div",r,[i.isEdit?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(B,{class:"btn-margin",onClick:d[9]||(d[9]=e=>s("delete"))},{default:e.withCtx(()=>d[22]||(d[22]=[e.createTextVNode(" 删除 ",-1)])),_:1,__:[22]}),e.createVNode(B,{type:"primary",onClick:d[10]||(d[10]=e=>s("save"))},{default:e.withCtx(()=>d[23]||(d[23]=[e.createTextVNode(" 完成编辑 ",-1)])),_:1,__:[23]})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.pageEnd?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(B,{key:0,onClick:d[5]||(d[5]=e=>s("edit"))},{icon:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Edit))]),_:1})]),default:e.withCtx(()=>[d[18]||(d[18]=e.createTextVNode(" 编辑 ",-1))]),_:1,__:[18]})),e.createVNode(B,{onClick:d[6]||(d[6]=e=>s("delete"))},{icon:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Delete))]),_:1})]),default:e.withCtx(()=>[d[19]||(d[19]=e.createTextVNode(" 删除 ",-1))]),_:1,__:[19]}),e.createVNode(B,{onClick:d[7]||(d[7]=e=>s("moveUp"))},{icon:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Top))]),_:1})]),default:e.withCtx(()=>[d[20]||(d[20]=e.createTextVNode(" 上移 ",-1))]),_:1,__:[20]}),e.createVNode(B,{onClick:d[8]||(d[8]=e=>s("moveDown"))},{icon:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Bottom))]),_:1})]),default:e.withCtx(()=>[d[21]||(d[21]=e.createTextVNode(" 下移 ",-1))]),_:1,__:[21]})],64))]))]),e.createCommentVNode(" 答题设置弹窗 "),e.createVNode(T,{modelValue:p.value,"onUpdate:modelValue":d[13]||(d[13]=e=>p.value=e),title:"答题设置",class:"customize-dialog",onClose:d[14]||(d[14]=e=>p.value=!1)},{footer:e.withCtx(()=>[e.createVNode(B,{class:"customize-button",type:"primary",plain:"",onClick:d[12]||(d[12]=e=>p.value=!1)},{default:e.withCtx(()=>d[24]||(d[24]=[e.createTextVNode(" 取消 ",-1)])),_:1,__:[24]}),e.createVNode(B,{class:"customize-button",type:"primary",plain:"",onClick:x},{default:e.withCtx(()=>d[25]||(d[25]=[e.createTextVNode(" 保存 ",-1)])),_:1,__:[25]})]),default:e.withCtx(()=>[e.createVNode(g,{modelValue:v.value,"onUpdate:modelValue":d[11]||(d[11]=e=>v.value=e),class:"vertical-radio-group"},{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(C,t=>e.createVNode(b,{key:t.value,value:t.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])],2)],2)}}});exports.default=i;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue"),t=require("@element-plus/icons-vue"),l=require("@qxs-bns/hooks"),o=require("element-plus"),a=require("../../subject-type/src/subject-type.vue.cjs");const n={key:0,class:"flex-justify-between"},c={class:"flex-justify-between"},r={key:0,class:"has-set"},u={key:1,class:"flex flex-justify-end action-buttons"};var i=e.defineComponent({name:"QxsSubjectAction",__name:"subject-action",props:{isEdit:Boolean,isSet:{type:Boolean,default:!1},isKey:{type:Boolean,default:!1},answerCheckType:{type:Number,default:1},showOtherOption:{type:Boolean,default:!0},examAnswerRelationType:{type:Number,default:null},showRichText:{type:Boolean,default:!0},pageEnd:{type:Boolean,default:!1}},emits:["moveUp","moveDown","delete","save","edit","add","onShowRichText","setKey","setAnswerSetting"],setup(i,{emit:d}){const s=i,m=d,f=e.ref(s.isKey),p=e.ref(!1),k=e.ref(s.answerCheckType),V=l.useNamespace("subject-action"),x=e.ref(!0),C=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}],v=e.computed(()=>C.find(e=>e.value===k.value)?.label);function h(){p.value=!1,m("setAnswerSetting",k.value)}function N(){m("setKey",f.value)}function y(e,t){m("add",e,t?s.examAnswerRelationType:null)}return(l,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(V).e("action-exam"))},[e.createElementVNode("div",{class:e.normalizeClass(["action flex flex-justify-between",{active:i.isEdit}])},[e.createCommentVNode(" 编辑模式 "),i.isEdit?(e.openBlock(),e.createElementBlock("div",n,[e.createVNode(e.unref(o.ElPopover),{trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(e.unref(o.ElLink),{type:"primary",class:"btn-margin"},{default:e.withCtx(()=>d[15]||(d[15]=[e.createTextVNode(" +在此题后加入新题 ",-1)])),_:1,__:[15]})]),default:e.withCtx(()=>[e.createVNode(a.default,{onSelect:y})]),_:1}),i.showRichText?(e.openBlock(),e.createBlock(e.unref(o.ElLink),{key:0,type:"primary",class:"btn-margin",onClick:d[0]||(d[0]=e=>m("onShowRichText"))},{default:e.withCtx(()=>d[16]||(d[16]=[e.createTextVNode(" +添加题目描述(图文) ",-1)])),_:1,__:[16]})):e.createCommentVNode("v-if",!0),i.showOtherOption?(e.openBlock(),e.createBlock(e.unref(o.ElLink),{key:1,type:"primary",class:"btn-margin",onClick:d[1]||(d[1]=e=>p.value=!0)},{default:e.withCtx(()=>d[17]||(d[17]=[e.createTextVNode(" 答题设置 ",-1)])),_:1,__:[17]})):e.createCommentVNode("v-if",!0),i.showOtherOption?(e.openBlock(),e.createBlock(e.unref(o.ElCheckbox),{key:2,modelValue:f.value,"onUpdate:modelValue":d[2]||(d[2]=e=>f.value=e),label:"核心题",onChange:N},null,8,["modelValue"])):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createCommentVNode(" 非编辑模式 "),e.createElementVNode("div",c,[i.showOtherOption?(e.openBlock(),e.createBlock(e.unref(o.ElCheckbox),{key:0,modelValue:f.value,"onUpdate:modelValue":d[3]||(d[3]=e=>f.value=e),label:"核心题",disabled:""},null,8,["modelValue"])):e.createCommentVNode("v-if",!0),i.showOtherOption?(e.openBlock(),e.createBlock(e.unref(o.ElCheckbox),{key:1,modelValue:x.value,"onUpdate:modelValue":d[4]||(d[4]=e=>x.value=e),label:v.value,disabled:"",class:"btn-margin"},null,8,["modelValue","label"])):e.createCommentVNode("v-if",!0)])],2112)),e.createCommentVNode(" 操作按钮 "),e.createElementVNode("div",null,[i.isSet?(e.openBlock(),e.createElementBlock("div",r," *此题设置了跳题逻辑 ")):(e.openBlock(),e.createElementBlock("div",u,[i.isEdit?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(o.ElButton),{class:"btn-margin",onClick:d[9]||(d[9]=e=>m("delete"))},{default:e.withCtx(()=>d[22]||(d[22]=[e.createTextVNode(" 删除 ",-1)])),_:1,__:[22]}),e.createVNode(e.unref(o.ElButton),{type:"primary",onClick:d[10]||(d[10]=e=>m("save"))},{default:e.withCtx(()=>d[23]||(d[23]=[e.createTextVNode(" 完成编辑 ",-1)])),_:1,__:[23]})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.pageEnd?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(e.unref(o.ElButton),{key:0,onClick:d[5]||(d[5]=e=>m("edit"))},{icon:e.withCtx(()=>[e.createVNode(e.unref(o.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Edit))]),_:1})]),default:e.withCtx(()=>[d[18]||(d[18]=e.createTextVNode(" 编辑 ",-1))]),_:1,__:[18]})),e.createVNode(e.unref(o.ElButton),{onClick:d[6]||(d[6]=e=>m("delete"))},{icon:e.withCtx(()=>[e.createVNode(e.unref(o.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Delete))]),_:1})]),default:e.withCtx(()=>[d[19]||(d[19]=e.createTextVNode(" 删除 ",-1))]),_:1,__:[19]}),e.createVNode(e.unref(o.ElButton),{onClick:d[7]||(d[7]=e=>m("moveUp"))},{icon:e.withCtx(()=>[e.createVNode(e.unref(o.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Top))]),_:1})]),default:e.withCtx(()=>[d[20]||(d[20]=e.createTextVNode(" 上移 ",-1))]),_:1,__:[20]}),e.createVNode(e.unref(o.ElButton),{onClick:d[8]||(d[8]=e=>m("moveDown"))},{icon:e.withCtx(()=>[e.createVNode(e.unref(o.ElIcon),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.Bottom))]),_:1})]),default:e.withCtx(()=>[d[21]||(d[21]=e.createTextVNode(" 下移 ",-1))]),_:1,__:[21]})],64))]))]),e.createCommentVNode(" 答题设置弹窗 "),e.createVNode(e.unref(o.ElDialog),{modelValue:p.value,"onUpdate:modelValue":d[13]||(d[13]=e=>p.value=e),title:"答题设置",class:"customize-dialog",onClose:d[14]||(d[14]=e=>p.value=!1)},{footer:e.withCtx(()=>[e.createVNode(e.unref(o.ElButton),{class:"customize-button",type:"primary",plain:"",onClick:d[12]||(d[12]=e=>p.value=!1)},{default:e.withCtx(()=>d[24]||(d[24]=[e.createTextVNode(" 取消 ",-1)])),_:1,__:[24]}),e.createVNode(e.unref(o.ElButton),{class:"customize-button",type:"primary",plain:"",onClick:h},{default:e.withCtx(()=>d[25]||(d[25]=[e.createTextVNode(" 保存 ",-1)])),_:1,__:[25]})]),default:e.withCtx(()=>[e.createVNode(e.unref(o.ElRadioGroup),{modelValue:k.value,"onUpdate:modelValue":d[11]||(d[11]=e=>k.value=e),class:"vertical-radio-group"},{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(C,t=>e.createVNode(e.unref(o.ElRadio),{key:t.value,value:t.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:2},1032,["value"])),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])],2)],2))}});exports.default=i;
2
2
  //# sourceMappingURL=subject-action.vue.cjs.map