@qxs-bns/components 0.0.29 → 0.0.30

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 (172) hide show
  1. package/es/package.json.mjs +1 -1
  2. package/es/src/data-chart/src/components/area.vue2.mjs +1 -1
  3. package/es/src/data-chart/src/components/area.vue2.mjs.map +1 -1
  4. package/es/src/data-chart/src/components/bar.vue.mjs +1 -1
  5. package/es/src/data-chart/src/components/bar.vue.mjs.map +1 -1
  6. package/es/src/data-chart/src/components/funnel.vue.mjs +1 -1
  7. package/es/src/data-chart/src/components/funnel.vue.mjs.map +1 -1
  8. package/es/src/data-chart/src/components/line.vue2.mjs +1 -1
  9. package/es/src/data-chart/src/components/line.vue2.mjs.map +1 -1
  10. package/es/src/data-chart/src/components/pie.vue.mjs +1 -1
  11. package/es/src/data-chart/src/components/pie.vue.mjs.map +1 -1
  12. package/es/src/data-chart/src/components/radar.vue.mjs +1 -1
  13. package/es/src/data-chart/src/components/radar.vue.mjs.map +1 -1
  14. package/es/src/data-chart/src/components/scatter-simple.vue.mjs +1 -1
  15. package/es/src/data-chart/src/components/scatter-simple.vue.mjs.map +1 -1
  16. package/es/src/data-chart/src/components/scatter.vue.mjs +1 -1
  17. package/es/src/data-chart/src/components/scatter.vue.mjs.map +1 -1
  18. package/es/src/data-chart/src/components/table.vue.mjs +1 -1
  19. package/es/src/data-chart/src/components/table.vue.mjs.map +1 -1
  20. package/es/src/data-chart/src/data-chart.vue.mjs +1 -1
  21. package/es/src/data-chart/src/data-chart.vue.mjs.map +1 -1
  22. package/es/src/data-chart/src/utils/useCharts.mjs +1 -1
  23. package/es/src/data-chart/src/utils/useCharts.mjs.map +1 -1
  24. package/es/src/file-upload/src/file-upload.vue.mjs +1 -1
  25. package/es/src/file-upload/src/file-upload.vue.mjs.map +1 -1
  26. package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs +1 -1
  27. package/es/src/fixed-action-bar/src/fixed-action-bar.vue.mjs.map +1 -1
  28. package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
  29. package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
  30. package/es/src/photo-crop-tool/src/composables.mjs +1 -1
  31. package/es/src/photo-crop-tool/src/composables.mjs.map +1 -1
  32. package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs +1 -1
  33. package/es/src/photo-crop-tool/src/photo-crop-tool.vue.mjs.map +1 -1
  34. package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
  35. package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
  36. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
  37. package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
  38. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs +1 -1
  39. package/es/src/subject-list/src/components/SubjectRichText.vue.mjs.map +1 -1
  40. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
  41. package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
  42. package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
  43. package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
  44. package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
  45. package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
  46. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
  47. package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
  48. package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
  49. package/es/src/subject-list/src/subject-list.vue.mjs.map +1 -1
  50. package/es/src/subject-type/src/subject-type.vue.mjs +1 -1
  51. package/es/src/subject-type/src/subject-type.vue.mjs.map +1 -1
  52. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +1 -1
  53. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs.map +1 -1
  54. package/lib/package.json.cjs +1 -1
  55. package/lib/src/data-chart/src/components/area.vue2.cjs +1 -1
  56. package/lib/src/data-chart/src/components/area.vue2.cjs.map +1 -1
  57. package/lib/src/data-chart/src/components/bar.vue.cjs +1 -1
  58. package/lib/src/data-chart/src/components/bar.vue.cjs.map +1 -1
  59. package/lib/src/data-chart/src/components/funnel.vue.cjs +1 -1
  60. package/lib/src/data-chart/src/components/funnel.vue.cjs.map +1 -1
  61. package/lib/src/data-chart/src/components/line.vue2.cjs +1 -1
  62. package/lib/src/data-chart/src/components/line.vue2.cjs.map +1 -1
  63. package/lib/src/data-chart/src/components/pie.vue.cjs +1 -1
  64. package/lib/src/data-chart/src/components/pie.vue.cjs.map +1 -1
  65. package/lib/src/data-chart/src/components/radar.vue.cjs +1 -1
  66. package/lib/src/data-chart/src/components/radar.vue.cjs.map +1 -1
  67. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs +1 -1
  68. package/lib/src/data-chart/src/components/scatter-simple.vue.cjs.map +1 -1
  69. package/lib/src/data-chart/src/components/scatter.vue.cjs +1 -1
  70. package/lib/src/data-chart/src/components/scatter.vue.cjs.map +1 -1
  71. package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
  72. package/lib/src/data-chart/src/components/table.vue.cjs.map +1 -1
  73. package/lib/src/data-chart/src/data-chart.vue.cjs +1 -1
  74. package/lib/src/data-chart/src/data-chart.vue.cjs.map +1 -1
  75. package/lib/src/data-chart/src/utils/useCharts.cjs +1 -1
  76. package/lib/src/data-chart/src/utils/useCharts.cjs.map +1 -1
  77. package/lib/src/file-upload/src/file-upload.vue.cjs +1 -1
  78. package/lib/src/file-upload/src/file-upload.vue.cjs.map +1 -1
  79. package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs +1 -1
  80. package/lib/src/fixed-action-bar/src/fixed-action-bar.vue.cjs.map +1 -1
  81. package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
  82. package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
  83. package/lib/src/photo-crop-tool/src/composables.cjs +1 -1
  84. package/lib/src/photo-crop-tool/src/composables.cjs.map +1 -1
  85. package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs +1 -1
  86. package/lib/src/photo-crop-tool/src/photo-crop-tool.vue.cjs.map +1 -1
  87. package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
  88. package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
  89. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
  90. package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
  91. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs +1 -1
  92. package/lib/src/subject-list/src/components/SubjectRichText.vue.cjs.map +1 -1
  93. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
  94. package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
  95. package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
  96. package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
  97. package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
  98. package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
  99. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
  100. package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
  101. package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
  102. package/lib/src/subject-list/src/subject-list.vue.cjs.map +1 -1
  103. package/lib/src/subject-type/src/subject-type.vue.cjs +1 -1
  104. package/lib/src/subject-type/src/subject-type.vue.cjs.map +1 -1
  105. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +1 -1
  106. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs.map +1 -1
  107. package/package.json +8 -6
  108. package/types/index.d.ts +0 -6
  109. package/types/index.d.ts.map +0 -1
  110. package/types/src/base/style/css.d.ts +0 -2
  111. package/types/src/base/style/css.d.ts.map +0 -1
  112. package/types/src/base/style/index.d.ts +0 -2
  113. package/types/src/base/style/index.d.ts.map +0 -1
  114. package/types/src/components.d.ts +0 -11
  115. package/types/src/components.d.ts.map +0 -1
  116. package/types/src/data-chart/index.d.ts +0 -4
  117. package/types/src/data-chart/index.d.ts.map +0 -1
  118. package/types/src/data-chart/src/analyze.d.ts +0 -23
  119. package/types/src/data-chart/src/analyze.d.ts.map +0 -1
  120. package/types/src/data-chart/src/utils/config.d.ts +0 -41
  121. package/types/src/data-chart/src/utils/config.d.ts.map +0 -1
  122. package/types/src/data-chart/src/utils/injectionKeys.d.ts +0 -3
  123. package/types/src/data-chart/src/utils/injectionKeys.d.ts.map +0 -1
  124. package/types/src/data-chart/src/utils/useCharts.d.ts +0 -16
  125. package/types/src/data-chart/src/utils/useCharts.d.ts.map +0 -1
  126. package/types/src/data-chart/style/index.d.ts +0 -3
  127. package/types/src/data-chart/style/index.d.ts.map +0 -1
  128. package/types/src/defaults.d.ts +0 -6
  129. package/types/src/defaults.d.ts.map +0 -1
  130. package/types/src/file-upload/index.d.ts +0 -4
  131. package/types/src/file-upload/index.d.ts.map +0 -1
  132. package/types/src/file-upload/style/index.d.ts +0 -3
  133. package/types/src/file-upload/style/index.d.ts.map +0 -1
  134. package/types/src/fixed-action-bar/index.d.ts +0 -4
  135. package/types/src/fixed-action-bar/index.d.ts.map +0 -1
  136. package/types/src/fixed-action-bar/style/index.d.ts +0 -3
  137. package/types/src/fixed-action-bar/style/index.d.ts.map +0 -1
  138. package/types/src/image-upload/index.d.ts +0 -4
  139. package/types/src/image-upload/index.d.ts.map +0 -1
  140. package/types/src/image-upload/style/index.d.ts +0 -3
  141. package/types/src/image-upload/style/index.d.ts.map +0 -1
  142. package/types/src/make-installer.d.ts +0 -9
  143. package/types/src/make-installer.d.ts.map +0 -1
  144. package/types/src/photo-crop-tool/index.d.ts +0 -4
  145. package/types/src/photo-crop-tool/index.d.ts.map +0 -1
  146. package/types/src/photo-crop-tool/src/composables.d.ts +0 -7
  147. package/types/src/photo-crop-tool/src/composables.d.ts.map +0 -1
  148. package/types/src/photo-crop-tool/style/index.d.ts +0 -3
  149. package/types/src/photo-crop-tool/style/index.d.ts.map +0 -1
  150. package/types/src/subject-action/index.d.ts +0 -4
  151. package/types/src/subject-action/index.d.ts.map +0 -1
  152. package/types/src/subject-action/style/index.d.ts +0 -3
  153. package/types/src/subject-action/style/index.d.ts.map +0 -1
  154. package/types/src/subject-layout/index.d.ts +0 -4
  155. package/types/src/subject-layout/index.d.ts.map +0 -1
  156. package/types/src/subject-layout/style/index.d.ts +0 -3
  157. package/types/src/subject-layout/style/index.d.ts.map +0 -1
  158. package/types/src/subject-list/index.d.ts +0 -4
  159. package/types/src/subject-list/index.d.ts.map +0 -1
  160. package/types/src/subject-list/style/index.d.ts +0 -3
  161. package/types/src/subject-list/style/index.d.ts.map +0 -1
  162. package/types/src/subject-type/index.d.ts +0 -4
  163. package/types/src/subject-type/index.d.ts.map +0 -1
  164. package/types/src/subject-type/style/index.d.ts +0 -3
  165. package/types/src/subject-type/style/index.d.ts.map +0 -1
  166. package/types/src/tiny-mce-editor/index.d.ts +0 -4
  167. package/types/src/tiny-mce-editor/index.d.ts.map +0 -1
  168. package/types/src/tiny-mce-editor/style/index.d.ts +0 -3
  169. package/types/src/tiny-mce-editor/style/index.d.ts.map +0 -1
  170. package/types/src/withInstall.d.ts +0 -4
  171. package/types/src/withInstall.d.ts.map +0 -1
  172. package/types/tsconfig.tsbuildinfo +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subject-blank-fill.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-blank-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Plus } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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 examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\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\nconst title = ref('')\nconst analysis = 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(['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 addBlank() {\n title.value += ' ______'\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\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 (answers.value.length < 1) {\n ElMessage.error('至少添加一个填空符!')\n return\n }\n\n emits('save', {\n title: title.value.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.value.map((item: any) => {\n return { title: item.title, isCorrect: true }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: true,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title.replaceAll(/<filter><\\/filter>/g, ' ______')\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: any) =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\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}\n\nwatch(() => title.value, () => {\n const [...matchs] = title.value.matchAll(/ ______/g)\n if (matchs.length !== answers.value.length) {\n const differ = answers.value.length - matchs.length\n answers.value.splice(answers.value.length - differ, differ)\n }\n})\n\nonMounted(init)\nconst ns = useNamespace('subject-blank-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('blank-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 v-html=\"richText\" />\n </div>\n <div\n v-if=\"answers.some((item) => item.title)\"\n class=\"flex flex-wrap\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"flex flex-wrap flex-items-center\"\n style=\"margin-right: 10px;\"\n >\n <span>填空{{ index + 1 }}:</span>\n <span>{{ item.title }}</span>\n </div>\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 style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"7\"\n show-word-limit\n maxlength=\"400\"\n placeholder=\"【填空题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"flex flex-justify-end\">\n <!-- <el-link\n v-if=\"!showRichText\"\n type=\"primary\"\n @click=\"showRichText = true\"\n >\n 添加富文本\n </el-link> -->\n <el-link\n class=\"margin-left-10\"\n type=\"primary\"\n :disabled=\"isSave\"\n @click=\"addBlank\"\n >\n 插入填空符\n </el-link>\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\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox :value=\"item.value\" class=\"margin-left-10\">\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\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 <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>\n </div>\n <div v-if=\"showAnalysis\" class=\"margin-bottom 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=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"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 @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","showRichText","richText","checkList","label","value","isCheckList","addBlank","push","tag","showInput","deleteRichText","save","length","ElMessage","error","replaceAll","map","item","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","watch","matchs","matchAll","differ","splice","onMounted","answerList","examAnswerSettingVO","filter","ns","useNamespace","tags","split","index","findIndex","i","join"],"mappings":"q5DAQA,MAAMA,EAAQC,EAiBRC,EAAQC,EAERC,GAAQC,IAERC,GAAUC,EAIX,IAECC,GAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAeH,GAAI,GACnBI,GAAWJ,EAAI,IAEfK,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,GAAcR,EAAI,CAAC,iBAqBzB,SAASS,KACPR,GAAMM,OAAS,UACfR,GAAQQ,MAAMG,KAAK,CACjBT,MAAO,GACPU,IAAK,GACLC,WAAW,GACZ,CAGH,SAASC,KACPV,GAAaI,OAAQ,EACrBH,GAASG,MAAQ,EAAA,CAGnB,SAASO,KACFb,GAAMM,MAKPR,GAAQQ,MAAMQ,OAAS,EACzBC,EAAUC,MAAM,cAIlBtB,EAAM,OAAQ,CACZM,MAAOA,GAAMM,MAAMW,WAAW,WAAY,qBAC1CnB,QAASA,GAAQQ,MAAMY,KAAKC,IACnB,CAAEnB,MAAOmB,EAAKnB,MAAOoB,WAAW,MAEzCnB,SAAUA,GAASK,MACnBe,oBAAoB,EACpBC,oBAAqB,CACnBC,aAAchB,GAAYD,OAAOkB,SAAS,gBAC1CC,UAAWlB,GAAYD,OAAOkB,SAAS,cAEzCE,oBAAqBxB,GAAaI,MAAQH,GAASG,MAAQ,KApB3DS,EAAUC,MAAM,YAqBjB,CA8BGW,GAAA,IAAM3B,GAAMM,QAAO,KACvB,SAAUsB,GAAU5B,GAAMM,MAAMuB,SAAS,YACzC,GAAID,EAAOd,SAAWhB,GAAQQ,MAAMQ,OAAQ,CAC1C,MAAMgB,EAAShC,GAAQQ,MAAMQ,OAASc,EAAOd,OAC7ChB,GAAQQ,MAAMyB,OAAOjC,GAAQQ,MAAMQ,OAASgB,EAAQA,EAAM,KAI9DE,GAnCA,WACMxC,EAAMQ,QACRA,GAAMM,MAAQd,EAAMQ,MAAMiB,WAAW,sBAAuB,YAG1DzB,EAAMyC,YAAczC,EAAMyC,WAAWnB,SACvChB,GAAQQ,MAAQd,EAAMyC,YAGpBzC,EAAM0C,sBAEI3B,GAAAD,MAAQC,GAAYD,MAAM6B,QAAQhB,GAClC,iBAATA,GAA2B3B,EAAM0C,qBAAqBX,cAC1C,cAATJ,GAAwB3B,EAAM0C,qBAAqBT,aAIvDjC,EAAMS,WACRA,GAASK,MAAQd,EAAMS,UAGrBT,EAAMkC,sBACRvB,GAASG,MAAQd,EAAMkC,oBACvBxB,GAAaI,OAAQ,EACvB,IAYI,MAAA8B,GAAKC,EAAa,g6DAvFf,SAAS3B,EAAaS,GAC7B,GAAIT,EAAK,CACP,MAAM4B,EAAOnB,EAAKnB,MAAMuC,MAAM,KACxBC,EAAQF,EAAKG,WAAWC,GAAcA,IAAMhC,IAC9C8B,GAAQ,IACLF,EAAAP,OAAOS,EAAO,GACdrB,EAAAnB,MAAQsC,EAAKK,KAAK,KACzB,CACF,+OAhBF,SAAsBxB,GACpBA,EAAKR,WAAY,EACbQ,EAAKT,MACPS,EAAKnB,MAAQmB,EAAKnB,MAAQ,CAACmB,EAAKnB,MAAOmB,EAAKT,KAAKiC,KAAK,KAAOxB,EAAKT,IAClES,EAAKT,IAAM,GACb"}
1
+ {"version":3,"file":"subject-blank-fill.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-blank-fill.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Plus } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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 examAnswerSettingVO?: {\n isInOrder: boolean\n isIgnoreCase: boolean\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\nconst title = ref('')\nconst analysis = 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(['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 addBlank() {\n title.value += ' ______'\n answers.value.push({\n title: '',\n tag: '',\n showInput: false,\n })\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 (answers.value.length < 1) {\n ElMessage.error('至少添加一个填空符!')\n return\n }\n\n emits('save', {\n title: title.value.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.value.map((item: any) => {\n return { title: item.title, isCorrect: true }\n }),\n analysis: analysis.value,\n isSetCorrectAnswer: true,\n examAnswerSettingBO: {\n isIgnoreCase: isCheckList.value?.includes('isIgnoreCase'),\n isInOrder: isCheckList.value?.includes('isInOrder'),\n },\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title.replaceAll(/<filter><\\/filter>/g, ' ______')\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: any) =>\n (item === 'isIgnoreCase' && props.examAnswerSettingVO?.isIgnoreCase)\n || (item === 'isInOrder' && props.examAnswerSettingVO?.isInOrder),\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}\n\nwatch(() => title.value, () => {\n const [...matchs] = title.value.matchAll(/ ______/g)\n if (matchs.length !== answers.value.length) {\n const differ = answers.value.length - matchs.length\n answers.value.splice(answers.value.length - differ, differ)\n }\n})\n\nonMounted(init)\nconst ns = useNamespace('subject-blank-fill')\n</script>\n\n<template>\n <div :class=\"ns.e('blank-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 v-html=\"richText\" />\n </div>\n <div\n v-if=\"answers.some((item) => item.title)\"\n class=\"flex flex-wrap\"\n style=\"margin-top: 10px;color: #a8abb2;\"\n >\n <span class=\"title\">正确答案:</span>\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"flex flex-wrap flex-items-center\"\n style=\"margin-right: 10px;\"\n >\n <span>填空{{ index + 1 }}:</span>\n <span>{{ item.title }}</span>\n </div>\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 style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"7\"\n show-word-limit\n maxlength=\"400\"\n placeholder=\"【填空题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"flex flex-justify-end\">\n <!-- <el-link\n v-if=\"!showRichText\"\n type=\"primary\"\n @click=\"showRichText = true\"\n >\n 添加富文本\n </el-link> -->\n <el-link\n class=\"margin-left-10\"\n type=\"primary\"\n :disabled=\"isSave\"\n @click=\"addBlank\"\n >\n 插入填空符\n </el-link>\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\n <el-checkbox-group\n v-for=\"item in checkList\"\n :key=\"item.value\"\n v-model=\"isCheckList\"\n >\n <el-checkbox :value=\"item.value\" class=\"margin-left-10\">\n {{ item.label }}\n </el-checkbox>\n </el-checkbox-group>\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 <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>\n </div>\n <div v-if=\"showAnalysis\" class=\"margin-bottom 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=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"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 @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","showRichText","richText","checkList","label","value","isCheckList","addBlank","push","tag","showInput","deleteRichText","save","length","ElMessage","error","replaceAll","map","item","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","isIgnoreCase","includes","isInOrder","examRichTextContent","watch","matchs","matchAll","differ","splice","onMounted","answerList","examAnswerSettingVO","filter","ns","useNamespace","tags","split","index","findIndex","i","join"],"mappings":"+3DAQA,MAAMA,EAAQC,EAiBRC,EAAQC,EAERC,GAAQC,IAERC,GAAUC,EAIX,IAECC,GAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAeH,GAAI,GACnBI,GAAWJ,EAAI,IAEfK,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,GAAcR,EAAI,CAAC,iBAqBzB,SAASS,KACPR,GAAMM,OAAS,UACfR,GAAQQ,MAAMG,KAAK,CACjBT,MAAO,GACPU,IAAK,GACLC,WAAW,GACZ,CAGH,SAASC,KACPV,GAAaI,OAAQ,EACrBH,GAASG,MAAQ,EAAA,CAGnB,SAASO,KACFb,GAAMM,MAKPR,GAAQQ,MAAMQ,OAAS,EACzBC,EAAUC,MAAM,cAIlBtB,EAAM,OAAQ,CACZM,MAAOA,GAAMM,MAAMW,WAAW,WAAY,qBAC1CnB,QAASA,GAAQQ,MAAMY,KAAKC,IACnB,CAAEnB,MAAOmB,EAAKnB,MAAOoB,WAAW,MAEzCnB,SAAUA,GAASK,MACnBe,oBAAoB,EACpBC,oBAAqB,CACnBC,aAAchB,GAAYD,OAAOkB,SAAS,gBAC1CC,UAAWlB,GAAYD,OAAOkB,SAAS,cAEzCE,oBAAqBxB,GAAaI,MAAQH,GAASG,MAAQ,KApB3DS,EAAUC,MAAM,YAqBjB,CA8BGW,GAAA,IAAM3B,GAAMM,QAAO,KACvB,SAAUsB,GAAU5B,GAAMM,MAAMuB,SAAS,YACzC,GAAID,EAAOd,SAAWhB,GAAQQ,MAAMQ,OAAQ,CAC1C,MAAMgB,EAAShC,GAAQQ,MAAMQ,OAASc,EAAOd,OAC7ChB,GAAQQ,MAAMyB,OAAOjC,GAAQQ,MAAMQ,OAASgB,EAAQA,EAAM,KAI9DE,GAnCA,WACMxC,EAAMQ,QACRA,GAAMM,MAAQd,EAAMQ,MAAMiB,WAAW,sBAAuB,YAG1DzB,EAAMyC,YAAczC,EAAMyC,WAAWnB,SACvChB,GAAQQ,MAAQd,EAAMyC,YAGpBzC,EAAM0C,sBAEI3B,GAAAD,MAAQC,GAAYD,MAAM6B,QAAQhB,GAClC,iBAATA,GAA2B3B,EAAM0C,qBAAqBX,cAC1C,cAATJ,GAAwB3B,EAAM0C,qBAAqBT,aAIvDjC,EAAMS,WACRA,GAASK,MAAQd,EAAMS,UAGrBT,EAAMkC,sBACRvB,GAASG,MAAQd,EAAMkC,oBACvBxB,GAAaI,OAAQ,EACvB,IAYI,MAAA8B,GAAKC,EAAa,g6DAvFf,SAAS3B,EAAaS,GAC7B,GAAIT,EAAK,CACP,MAAM4B,EAAOnB,EAAKnB,MAAMuC,MAAM,KACxBC,EAAQF,EAAKG,WAAWC,GAAcA,IAAMhC,IAC9C8B,GAAQ,IACLF,EAAAP,OAAOS,EAAO,GACdrB,EAAAnB,MAAQsC,EAAKK,KAAK,KACzB,CACF,+OAhBF,SAAsBxB,GACpBA,EAAKR,WAAY,EACbQ,EAAKT,MACPS,EAAKnB,MAAQmB,EAAKnB,MAAQ,CAACmB,EAAKnB,MAAOmB,EAAKT,KAAKiC,KAAK,KAAOxB,EAAKT,IAClES,EAAKT,IAAM,GACb"}
@@ -1,2 +1,2 @@
1
- import{ElInput as e,ElIcon as l,ElLink as t,ElRow as a,ElCol as s,ElRadio as i}from"element-plus/es";import{defineComponent as n,createElementBlock as o,openBlock as r,normalizeClass as u,unref as d,createVNode as c,withCtx as p,createBlock as v,createCommentVNode as m,createElementVNode as f,isRef as x,Fragment as y,renderList as h,toDisplayString as w,mergeProps as b,createTextVNode as g}from"vue";import{CirclePlus as j,Remove as C}from"@element-plus/icons-vue";import{useNamespace as S}from"@qxs-bns/hooks";import{ElMessage as k}from"element-plus";import V from"../../../subject-action/src/subject-action.vue.mjs";import q from"../../../subject-layout/src/subject-layout.vue.mjs";import T from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{useAttrs as _,ref as L,computed as A,onMounted as R}from"vue-demi";const M={class:"preview"},U={class:"title"},E={key:0},O=["innerHTML"],Q={class:"answer-radio flex flex-col"},B={style:{flex:"1"}},D={class:"answer flex"},H={class:"flex"},I={class:"answer-list flex-col"},N={class:"order"},$={class:"flex",style:{"margin-bottom":"20px"}},P={style:{flex:"1"}},z={key:0,class:"margin-bottom flex"},F={style:{flex:"1"}},G={class:"flex flex-justify-end"};var J=n({name:"QxsSubjectScale",__name:"subject-scale",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},rowTitle:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},scaleQuestionList:{type:null,required:!1},examRichTextContent:{type:String,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(n,{emit:J}){const K=n,W=J,X=_(),Y=L([{title:""},{title:""},{title:""},{title:""},{title:""}]),Z=L(""),ee=L(""),le=L(""),te=L(!1),ae=L(""),se=L([]),ie=A((()=>Math.ceil(24/(Y.value.length+1))));function ne(){5!==Y.value.length&&Y.value.push({title:""})}function oe(){te.value=!1,ae.value=""}function re(){if(!Z.value)return void k.error("题目标题不能为空!");let e="";Y.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?k.error(e):le.value?(se.value=le.value.split("\n").filter((e=>e)),W("save",{title:Z.value,answers:Y.value,analysis:ee.value,scaleQuestionList:se.value,examRichTextContent:te.value?ae.value:""})):k.error("行标题不能为空!")}R((function(){K.title&&(Z.value=K.title),K.answerList&&K.answerList.length&&(Y.value=K.answerList),K.analysis&&(ee.value=K.analysis),K.scaleQuestionList&&(se.value=K.scaleQuestionList,le.value=se.value.join("\n")),K.examRichTextContent&&(ae.value=K.examRichTextContent,te.value=!0)}));const ue=S("subject-scale");return(n,S)=>{const k=s,_=a,L=i,A=e,R=l,J=t;return r(),o("div",{class:u(d(ue).e("scale-exam"))},[c(q,{"show-edit":n.isEdit},{preview:p((()=>[f("div",M,[f("div",null,[f("span",U,w(n.orderIndex+1)+"."+w(d(Z))+"(量表题)",1),d(te)?(r(),o("div",E,[f("div",{innerHTML:d(ae)},null,8,O)])):m("v-if",!0)]),f("div",Q,[c(_,{style:{padding:"10px 0"}},{default:p((()=>[c(k,{span:d(ie)},null,8,["span"]),(r(!0),o(y,null,h(d(Y),(e=>(r(),v(k,{key:e.title,class:"flex flex-center",span:d(ie)},{default:p((()=>[f("span",null,w(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(r(!0),o(y,null,h(d(se),(e=>(r(),v(_,{key:e,style:{padding:"10px 0"}},{default:p((()=>[c(k,{span:d(ie),class:"flex flex-center"},{default:p((()=>[f("span",null,w(e),1)])),_:2},1032,["span"]),(r(!0),o(y,null,h(d(Y).length,(e=>(r(),v(k,{key:e,class:"radio-item flex flex-center",span:d(ie)},{default:p((()=>[c(L,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:p((()=>[f("div",{class:u(["flex",[{"margin-bottom":d(te)}]])},[S[10]||(S[10]=f("div",{class:"label flex flex-justify-center"},[f("span",null,"题目:")],-1)),f("div",B,[c(A,{modelValue:d(Z),"onUpdate:modelValue":S[0]||(S[0]=e=>x(Z)?Z.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:n.isSave},null,8,["modelValue","disabled"])])],2),f("div",D,[S[11]||(S[11]=f("div",{class:"label flex flex-justify-center"},[f("span",null,"行标题:")],-1)),f("div",H,[c(A,{modelValue:d(le),"onUpdate:modelValue":S[1]||(S[1]=e=>x(le)?le.value=e:null),modelModifiers:{trim:!0},type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),f("div",I,[(r(!0),o(y,null,h(d(Y),((e,l)=>(r(),o("div",{key:l,class:"answer-item flex flex-items-center"},[f("span",N,w(String.fromCharCode(65+l))+".",1),c(A,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+l)}`,disabled:n.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),m(' <PlusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length === 5 }]"\n @click="addAnswer"\n />\n <MinusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length < 3 }]"\n @click="deleteAnswer(index)"\n /> '),c(R,{class:"icon"},{default:p((()=>[c(d(j),{class:u([{disabled:5===d(Y).length}]),onClick:ne},null,8,["class"])])),_:1}),c(R,{class:"icon"},{default:p((()=>[c(d(C),{class:u([{disabled:d(Y).length<3}]),onClick:e=>function(e){Y.value.length<3||Y.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),f("div",$,[S[12]||(S[12]=f("div",{class:"label flex flex-justify-center"},[f("span",null,"解析:")],-1)),f("div",P,[c(A,{modelValue:d(ee),"onUpdate:modelValue":S[2]||(S[2]=e=>x(ee)?ee.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),d(te)?(r(),o("div",z,[S[14]||(S[14]=f("div",{class:"label flex flex-justify-center"},[f("span",null,"富文本:")],-1)),f("div",F,[c(T,b({"model-value":d(ae),"onUpdate:modelValue":S[3]||(S[3]=e=>x(ae)?ae.value=e:null)},d(X),{style:{width:"100%"}}),null,16,["model-value"]),f("div",G,[c(J,{type:"danger",onClick:oe},{default:p((()=>S[13]||(S[13]=[g(" 删除富文本 ")]))),_:1})])])])):m("v-if",!0)])),default:p((()=>[n.showAction?(r(),v(V,{key:0,"is-edit":n.isEdit,"is-set":n.isSet,showOtherOption:!1,examAnswerRelationType:K.examAnswerRelationType,onMoveUp:S[4]||(S[4]=e=>W("move","up")),onMoveDown:S[5]||(S[5]=e=>W("move","down")),onDelete:S[6]||(S[6]=e=>W("delete")),onSave:re,onEdit:S[7]||(S[7]=e=>W("edit")),onAdd:S[8]||(S[8]=e=>W("add",e)),onOnShowRichText:S[9]||(S[9]=e=>te.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):m("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{J as default};
1
+ import{ElInput as e,ElIcon as l,ElLink as t,ElRow as a,ElCol as s,ElRadio as n}from"element-plus/es";import{defineComponent as i,useAttrs as o,ref as u,computed as r,onMounted as d,createElementBlock as c,openBlock as p,normalizeClass as v,unref as m,createVNode as f,withCtx as x,createBlock as y,createCommentVNode as h,createElementVNode as w,isRef as b,Fragment as g,renderList as j,toDisplayString as C,mergeProps as S,createTextVNode as k}from"vue";import{CirclePlus as V,Remove as q}from"@element-plus/icons-vue";import{useNamespace as T}from"@qxs-bns/hooks";import{ElMessage as _}from"element-plus";import L from"../../../subject-action/src/subject-action.vue.mjs";import A from"../../../subject-layout/src/subject-layout.vue.mjs";import R from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const M={class:"preview"},U={class:"title"},E={key:0},O=["innerHTML"],Q={class:"answer-radio flex flex-col"},B={style:{flex:"1"}},D={class:"answer flex"},H={class:"flex"},I={class:"answer-list flex-col"},N={class:"order"},$={class:"flex",style:{"margin-bottom":"20px"}},P={style:{flex:"1"}},z={key:0,class:"margin-bottom flex"},F={style:{flex:"1"}},G={class:"flex flex-justify-end"};var J=i({name:"QxsSubjectScale",__name:"subject-scale",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},rowTitle:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},scaleQuestionList:{type:null,required:!1},examRichTextContent:{type:String,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(i,{emit:J}){const K=i,W=J,X=o(),Y=u([{title:""},{title:""},{title:""},{title:""},{title:""}]),Z=u(""),ee=u(""),le=u(""),te=u(!1),ae=u(""),se=u([]),ne=r((()=>Math.ceil(24/(Y.value.length+1))));function ie(){5!==Y.value.length&&Y.value.push({title:""})}function oe(){te.value=!1,ae.value=""}function ue(){if(!Z.value)return void _.error("题目标题不能为空!");let e="";Y.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?_.error(e):le.value?(se.value=le.value.split("\n").filter((e=>e)),W("save",{title:Z.value,answers:Y.value,analysis:ee.value,scaleQuestionList:se.value,examRichTextContent:te.value?ae.value:""})):_.error("行标题不能为空!")}d((function(){K.title&&(Z.value=K.title),K.answerList&&K.answerList.length&&(Y.value=K.answerList),K.analysis&&(ee.value=K.analysis),K.scaleQuestionList&&(se.value=K.scaleQuestionList,le.value=se.value.join("\n")),K.examRichTextContent&&(ae.value=K.examRichTextContent,te.value=!0)}));const re=T("subject-scale");return(i,o)=>{const u=s,r=a,d=n,T=e,_=l,J=t;return p(),c("div",{class:v(m(re).e("scale-exam"))},[f(A,{"show-edit":i.isEdit},{preview:x((()=>[w("div",M,[w("div",null,[w("span",U,C(i.orderIndex+1)+"."+C(m(Z))+"(量表题)",1),m(te)?(p(),c("div",E,[w("div",{innerHTML:m(ae)},null,8,O)])):h("v-if",!0)]),w("div",Q,[f(r,{style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne)},null,8,["span"]),(p(!0),c(g,null,j(m(Y),(e=>(p(),y(u,{key:e.title,class:"flex flex-center",span:m(ne)},{default:x((()=>[w("span",null,C(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(p(!0),c(g,null,j(m(se),(e=>(p(),y(r,{key:e,style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne),class:"flex flex-center"},{default:x((()=>[w("span",null,C(e),1)])),_:2},1032,["span"]),(p(!0),c(g,null,j(m(Y).length,(e=>(p(),y(u,{key:e,class:"radio-item flex flex-center",span:m(ne)},{default:x((()=>[f(d,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:x((()=>[w("div",{class:v(["flex",[{"margin-bottom":m(te)}]])},[o[10]||(o[10]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"题目:")],-1)),w("div",B,[f(T,{modelValue:m(Z),"onUpdate:modelValue":o[0]||(o[0]=e=>b(Z)?Z.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:i.isSave},null,8,["modelValue","disabled"])])],2),w("div",D,[o[11]||(o[11]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"行标题:")],-1)),w("div",H,[f(T,{modelValue:m(le),"onUpdate:modelValue":o[1]||(o[1]=e=>b(le)?le.value=e:null),modelModifiers:{trim:!0},type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),w("div",I,[(p(!0),c(g,null,j(m(Y),((e,l)=>(p(),c("div",{key:l,class:"answer-item flex flex-items-center"},[w("span",N,C(String.fromCharCode(65+l))+".",1),f(T,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+l)}`,disabled:i.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),h(' <PlusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length === 5 }]"\n @click="addAnswer"\n />\n <MinusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length < 3 }]"\n @click="deleteAnswer(index)"\n /> '),f(_,{class:"icon"},{default:x((()=>[f(m(V),{class:v([{disabled:5===m(Y).length}]),onClick:ie},null,8,["class"])])),_:1}),f(_,{class:"icon"},{default:x((()=>[f(m(q),{class:v([{disabled:m(Y).length<3}]),onClick:e=>function(e){Y.value.length<3||Y.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),w("div",$,[o[12]||(o[12]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"解析:")],-1)),w("div",P,[f(T,{modelValue:m(ee),"onUpdate:modelValue":o[2]||(o[2]=e=>b(ee)?ee.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),m(te)?(p(),c("div",z,[o[14]||(o[14]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"富文本:")],-1)),w("div",F,[f(R,S({"model-value":m(ae),"onUpdate:modelValue":o[3]||(o[3]=e=>b(ae)?ae.value=e:null)},m(X),{style:{width:"100%"}}),null,16,["model-value"]),w("div",G,[f(J,{type:"danger",onClick:oe},{default:x((()=>o[13]||(o[13]=[k(" 删除富文本 ")]))),_:1})])])])):h("v-if",!0)])),default:x((()=>[i.showAction?(p(),y(L,{key:0,"is-edit":i.isEdit,"is-set":i.isSet,showOtherOption:!1,examAnswerRelationType:K.examAnswerRelationType,onMoveUp:o[4]||(o[4]=e=>W("move","up")),onMoveDown:o[5]||(o[5]=e=>W("move","down")),onDelete:o[6]||(o[6]=e=>W("delete")),onSave:ue,onEdit:o[7]||(o[7]=e=>W("edit")),onAdd:o[8]||(o[8]=e=>W("add",e)),onOnShowRichText:o[9]||(o[9]=e=>te.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):h("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{J as default};
2
2
  //# sourceMappingURL=subject-scale.vue.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-scale.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-scale.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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: 'QxsSubjectScale',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n rowTitle?: string\n isEdit: boolean\n isSet: boolean\n scaleQuestionList?: any\n examRichTextContent?: string\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n}[]>([{\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst rowTitle = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst scaleQuestionList = ref<string[]>([])\nconst span = computed(() => Math.ceil(24 / (answers.value.length + 1)))\nfunction addAnswer() {\n if (answers.value.length === 5) {\n return\n }\n answers.value.push({\n title: '',\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3) {\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 let msg = ''\n answers.value.forEach((v, i) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n })\n\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n if (!rowTitle.value) {\n ElMessage.error('行标题不能为空!')\n return\n }\n\n scaleQuestionList.value = rowTitle.value.split('\\n').filter(i => i)\n\n emits('save', {\n title: title.value,\n answers: answers.value,\n analysis: analysis.value,\n scaleQuestionList: scaleQuestionList.value,\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.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.scaleQuestionList) {\n scaleQuestionList.value = props.scaleQuestionList\n rowTitle.value = scaleQuestionList.value.join('\\n')\n }\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-scale')\n</script>\n\n<template>\n <div :class=\"ns.e('scale-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(量表题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n </div>\n <div class=\"answer-radio flex flex-col\">\n <el-row style=\"padding: 10px 0;\">\n <el-col :span=\"span\" />\n <el-col\n v-for=\"item in answers\"\n :key=\"item.title\"\n class=\"flex flex-center\"\n :span=\"span\"\n >\n <span>{{ item.title }}</span>\n </el-col>\n </el-row>\n <el-row\n v-for=\"item in scaleQuestionList\"\n :key=\"item\"\n style=\"padding: 10px 0;\"\n >\n <el-col :span=\"span\" class=\"flex flex-center\">\n <span>{{ item }}</span>\n </el-col>\n <el-col\n v-for=\"i in answers.length\"\n :key=\"i\"\n class=\"radio-item flex flex-center\"\n :span=\"span\"\n >\n <el-radio :disabled=\"true\" />\n </el-col>\n </el-row>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\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=\"【量表题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"answer flex\">\n <div class=\"label flex flex-justify-center\">\n <span>行标题:</span>\n </div>\n <div class=\"flex\">\n <el-input\n v-model.trim=\"rowTitle\"\n type=\"textarea\"\n placeholder=\"请输入行标题\"\n style=\"width: 160px;\"\n :rows=\"10\"\n />\n <div class=\"answer-list flex-col\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n :maxlength=\"10\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <!-- <PlusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n <MinusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n /> -->\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex\" style=\"margin-bottom: 20px;\">\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 v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"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: any) => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","rowTitle","showRichText","richText","scaleQuestionList","span","computed","Math","ceil","value","length","addAnswer","push","deleteRichText","save","ElMessage","error","msg","forEach","v","i","String","fromCharCode","split","filter","examRichTextContent","onMounted","answerList","join","ns","useNamespace","index","splice"],"mappings":"2vDAWA,MAAMA,EAAQC,EAcRC,EAAQC,EAERC,EAAQC,IAERC,EAAUC,EAEX,CAAC,CACJC,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,MAGHA,EAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAWH,EAAI,IACfI,GAAeJ,GAAI,GACnBK,GAAWL,EAAI,IACfM,GAAoBN,EAAc,IAClCO,GAAOC,GAAS,IAAMC,KAAKC,KAAK,IAAMX,EAAQY,MAAMC,OAAS,MACnE,SAASC,KACsB,IAAzBd,EAAQY,MAAMC,QAGlBb,EAAQY,MAAMG,KAAK,CACjBb,MAAO,IACR,CAUH,SAASc,KACPX,GAAaO,OAAQ,EACrBN,GAASM,MAAQ,EAAA,CAGnB,SAASK,KACH,IAACf,EAAMU,MAET,YADAM,EAAUC,MAAM,aAGlB,IAAIC,EAAM,GACVpB,EAAQY,MAAMS,SAAQ,CAACC,EAAGC,KACnBD,EAAEpB,QACLkB,GAAO,KAAKI,OAAOC,aAAa,GAAKF,SAAE,IAIvCH,EACFF,EAAUC,MAAMC,GAIbhB,GAASQ,OAKIL,GAAAK,MAAQR,GAASQ,MAAMc,MAAM,MAAMC,WAAYJ,IAEjE3B,EAAM,OAAQ,CACZM,MAAOA,EAAMU,MACbZ,QAASA,EAAQY,MACjBT,SAAUA,GAASS,MACnBL,kBAAmBA,GAAkBK,MACrCgB,oBAAqBvB,GAAaO,MAAQN,GAASM,MAAQ,MAX3DM,EAAUC,MAAM,WAYjB,CA0BHU,GAvBA,WACMnC,EAAMQ,QACRA,EAAMU,MAAQlB,EAAMQ,OAGlBR,EAAMoC,YAAcpC,EAAMoC,WAAWjB,SACvCb,EAAQY,MAAQlB,EAAMoC,YAGpBpC,EAAMS,WACRA,GAASS,MAAQlB,EAAMS,UAGrBT,EAAMa,oBACRA,GAAkBK,MAAQlB,EAAMa,kBAChCH,GAASQ,MAAQL,GAAkBK,MAAMmB,KAAK,OAE5CrC,EAAMkC,sBACRtB,GAASM,MAAQlB,EAAMkC,oBACvBvB,GAAaO,OAAQ,EACvB,IAII,MAAAoB,GAAKC,EAAa,2iFArExB,SAAsBC,GAChBlC,EAAQY,MAAMC,OAAS,GAGnBb,EAAAY,MAAMuB,OAAOD,EAAO,EAAC"}
1
+ {"version":3,"file":"subject-scale.vue.mjs","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-scale.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\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: 'QxsSubjectScale',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n rowTitle?: string\n isEdit: boolean\n isSet: boolean\n scaleQuestionList?: any\n examRichTextContent?: string\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n}[]>([{\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst rowTitle = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst scaleQuestionList = ref<string[]>([])\nconst span = computed(() => Math.ceil(24 / (answers.value.length + 1)))\nfunction addAnswer() {\n if (answers.value.length === 5) {\n return\n }\n answers.value.push({\n title: '',\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3) {\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 let msg = ''\n answers.value.forEach((v, i) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n })\n\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n if (!rowTitle.value) {\n ElMessage.error('行标题不能为空!')\n return\n }\n\n scaleQuestionList.value = rowTitle.value.split('\\n').filter(i => i)\n\n emits('save', {\n title: title.value,\n answers: answers.value,\n analysis: analysis.value,\n scaleQuestionList: scaleQuestionList.value,\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.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.scaleQuestionList) {\n scaleQuestionList.value = props.scaleQuestionList\n rowTitle.value = scaleQuestionList.value.join('\\n')\n }\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-scale')\n</script>\n\n<template>\n <div :class=\"ns.e('scale-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(量表题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n </div>\n <div class=\"answer-radio flex flex-col\">\n <el-row style=\"padding: 10px 0;\">\n <el-col :span=\"span\" />\n <el-col\n v-for=\"item in answers\"\n :key=\"item.title\"\n class=\"flex flex-center\"\n :span=\"span\"\n >\n <span>{{ item.title }}</span>\n </el-col>\n </el-row>\n <el-row\n v-for=\"item in scaleQuestionList\"\n :key=\"item\"\n style=\"padding: 10px 0;\"\n >\n <el-col :span=\"span\" class=\"flex flex-center\">\n <span>{{ item }}</span>\n </el-col>\n <el-col\n v-for=\"i in answers.length\"\n :key=\"i\"\n class=\"radio-item flex flex-center\"\n :span=\"span\"\n >\n <el-radio :disabled=\"true\" />\n </el-col>\n </el-row>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\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=\"【量表题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"answer flex\">\n <div class=\"label flex flex-justify-center\">\n <span>行标题:</span>\n </div>\n <div class=\"flex\">\n <el-input\n v-model.trim=\"rowTitle\"\n type=\"textarea\"\n placeholder=\"请输入行标题\"\n style=\"width: 160px;\"\n :rows=\"10\"\n />\n <div class=\"answer-list flex-col\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n :maxlength=\"10\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <!-- <PlusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n <MinusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n /> -->\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex\" style=\"margin-bottom: 20px;\">\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 v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"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: any) => emits('add', type)\"\n @onShowRichText=\"showRichText = true\"\n />\n </SubjectLayout>\n </div>\n</template>\n"],"names":["props","__props","emits","__emit","attrs","useAttrs","answers","ref","title","analysis","rowTitle","showRichText","richText","scaleQuestionList","span","computed","Math","ceil","value","length","addAnswer","push","deleteRichText","save","ElMessage","error","msg","forEach","v","i","String","fromCharCode","split","filter","examRichTextContent","onMounted","answerList","join","ns","useNamespace","index","splice"],"mappings":"quDAWA,MAAMA,EAAQC,EAcRC,EAAQC,EAERC,EAAQC,IAERC,EAAUC,EAEX,CAAC,CACJC,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,MAGHA,EAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAWH,EAAI,IACfI,GAAeJ,GAAI,GACnBK,GAAWL,EAAI,IACfM,GAAoBN,EAAc,IAClCO,GAAOC,GAAS,IAAMC,KAAKC,KAAK,IAAMX,EAAQY,MAAMC,OAAS,MACnE,SAASC,KACsB,IAAzBd,EAAQY,MAAMC,QAGlBb,EAAQY,MAAMG,KAAK,CACjBb,MAAO,IACR,CAUH,SAASc,KACPX,GAAaO,OAAQ,EACrBN,GAASM,MAAQ,EAAA,CAGnB,SAASK,KACH,IAACf,EAAMU,MAET,YADAM,EAAUC,MAAM,aAGlB,IAAIC,EAAM,GACVpB,EAAQY,MAAMS,SAAQ,CAACC,EAAGC,KACnBD,EAAEpB,QACLkB,GAAO,KAAKI,OAAOC,aAAa,GAAKF,SAAE,IAIvCH,EACFF,EAAUC,MAAMC,GAIbhB,GAASQ,OAKIL,GAAAK,MAAQR,GAASQ,MAAMc,MAAM,MAAMC,WAAYJ,IAEjE3B,EAAM,OAAQ,CACZM,MAAOA,EAAMU,MACbZ,QAASA,EAAQY,MACjBT,SAAUA,GAASS,MACnBL,kBAAmBA,GAAkBK,MACrCgB,oBAAqBvB,GAAaO,MAAQN,GAASM,MAAQ,MAX3DM,EAAUC,MAAM,WAYjB,CA0BHU,GAvBA,WACMnC,EAAMQ,QACRA,EAAMU,MAAQlB,EAAMQ,OAGlBR,EAAMoC,YAAcpC,EAAMoC,WAAWjB,SACvCb,EAAQY,MAAQlB,EAAMoC,YAGpBpC,EAAMS,WACRA,GAASS,MAAQlB,EAAMS,UAGrBT,EAAMa,oBACRA,GAAkBK,MAAQlB,EAAMa,kBAChCH,GAASQ,MAAQL,GAAkBK,MAAMmB,KAAK,OAE5CrC,EAAMkC,sBACRtB,GAASM,MAAQlB,EAAMkC,oBACvBvB,GAAaO,OAAQ,EACvB,IAII,MAAAoB,GAAKC,EAAa,2iFArExB,SAAsBC,GAChBlC,EAAQY,MAAMC,OAAS,GAGnBb,EAAAY,MAAMuB,OAAOD,EAAO,EAAC"}
@@ -1,2 +1,2 @@
1
- import{ElCheckbox as e,ElRadio as l,ElInput as t,ElSelect as a,ElOption as i,ElIcon as s,ElLink as n,ElDialog as r,ElButton as o}from"element-plus/es";import{defineComponent as u,createElementBlock as d,openBlock as m,normalizeClass as c,unref as p,createVNode as v,createSlots as y,withCtx as f,createBlock as x,createCommentVNode as w,createElementVNode as h,createTextVNode as C,toDisplayString as g,Fragment as b,renderList as k,isRef as S,mergeProps as A}from"vue";import{CirclePlus as V,Remove as T}from"@element-plus/icons-vue";import{useNamespace as q}from"@qxs-bns/hooks";import R from"../../../subject-action/src/subject-action.vue.mjs";import j from"../../../subject-layout/src/subject-layout.vue.mjs";import _ from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{setGuid as E}from"@qxs-bns/utils";import{ElMessage as I}from"element-plus";import{useAttrs as U,ref as B,computed as K,watch as L,onMounted as $}from"vue-demi";const N={class:"preview"},z={class:"title"},M={key:0},D={key:1},H={key:0},O=["innerHTML"],Q={class:"preview-answer"},F={class:"order"},G={class:"order"},J={style:{flex:"1"}},P={class:"margin-bottom flex flex-items-center"},W={class:"margin-bottom answer-list"},X={class:"order"},Y={key:0,class:"margin-bottom flex flex-items-center"},Z={style:{flex:"1"}},ee={key:1,class:"flex"},le={style:{flex:"1"}},te={key:2,class:"margin-bottom flex"},ae={style:{flex:"1"}},ie={class:"flex flex-justify-end"};var se=u({name:"QxsSubjectSingle",__name:"subject-single",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},type:{type:String,required:!0},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},answerList:{type:null,required:!1},leastAnswerCount:{type:Number,required:!1},analysis:{type:String,required:!1},examExpand:{type:String,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1},customId:{type:Number,required:!1},examId:{type:Number,required:!1},isKey:{type:Boolean,required:!0},answerCheckType:{type:Number,required:!0}},emits:["move","save","delete","edit","add","setRelation"],setup(u,{emit:se}){const ne=u,re=se,oe=U(),ue=B(0),de=B(!1),me=B(1),ce=B(1),pe=B([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),ve=B(),ye=B(""),fe=B(""),xe=B(!1),we=B(""),he=B(0),Ce=B(!1),ge=B(""),be=K((()=>"single"===ne.type?"单选题":"multiple"===ne.type?"多选题":"排序题")),ke=B([]),Se=K((()=>{const e=[];for(let l=pe.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Ae(){ne.isSave||pe.value.push({title:"",isCorrect:!1,customAnswerId:E()})}function Ve(){xe.value=!1,we.value=""}function Te(){if(!ye.value)return void I.error("题目标题不能为空!");let e="",l=!1,t=0;if("multiple"===ne.type||"single"===ne.type?pe.value.forEach(((a,i)=>{a.title||(e+=`选项${String.fromCharCode(65+i)}未填写。`),a.isCorrect&&(l=!0,t++)})):"sort"===ne.type&&ke.value.length&&(l=!0),e)return void I.error(e);if(new Set(pe.value.map((e=>e.title))).size===pe.value.length){if("multiple"===ne.type){if(1===t)return void I.error("请至少设置两个支持选项");if(l&&t<ve.value)return void I.error("至少选几项与支持选项数不符")}console.log(me.value,111),2!==me.value&&3!==me.value||l?re("save",{title:ye.value,answers:pe.value.map(((e,l)=>({...e,orderIndex:l+1}))),examExpand:ke.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:fe.value,isSetCorrectAnswer:l,leastAnswerCount:ve.value,examRichTextContent:xe.value?we.value:"",examAnswerRelationType:ce.value,isKey:de.value,answerCheckType:me.value}):I.error("请设置支持选项")}else I.error("选项不能重复")}function qe(){pe.value[ue.value].resultItem=ge.value||"",Ce.value=!1}function Re(){Ce.value=!1,ge.value=""}function je(e){de.value=e}function _e(e){me.value=e}function Ee(e,l){re("add",e,l?ne.examAnswerRelationType:null)}L((()=>ne.isEdit),(()=>{ne.isEdit&&(he.value=(new Date).getTime())}));const Ie=K((()=>e=>{let l=0;return e.forEach((e=>{e.relationAnswers&&(l+=e.relationAnswers.length)})),l})),Ue=q("subject-single");return $((function(){if(ne.title&&(ye.value=ne.title),ne.answerCheckType&&(me.value=ne.answerCheckType),ne.isKey&&(de.value=ne.isKey),ne.examAnswerRelationType&&(ce.value=ne.examAnswerRelationType),ne.answerList&&ne.answerList.length&&(pe.value=ne.answerList),ne.leastAnswerCount&&(ve.value=ne.leastAnswerCount),ne.examExpand&&ne.examExpand){const e=ne.examExpand.split(",");ke.value=e.map((e=>{const l=ne.answerList.find((l=>l.answerId?.toString()===e));return l?String.fromCharCode(65+l.orderIndex-1):e})).filter(Boolean)}ne.analysis&&(fe.value=ne.analysis),ne.examRichTextContent&&(we.value=ne.examRichTextContent,xe.value=!0)})),(u,q)=>{const I=e,U=l,B=t,K=i,L=a,$=s,se=n,he=o,Be=r;return m(),d("div",{class:c(p(Ue).e("single-exam"))},[v(j,{"show-edit":u.isEdit},y({preview:f((()=>[h("div",N,[h("div",null,[h("span",z,[C(g(u.orderIndex+1)+"."+g(p(ye))+" ",1),"single"===u.type?(m(),d("span",M,"(单选题)")):["multiple","sort"].includes(u.type)?(m(),d("span",D," ("+g(p(be))+g(p(ve)?`至少选${p(ve)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):w("v-if",!0)])]),p(xe)?(m(),d("div",H,[h("div",{innerHTML:p(we)},null,8,O)])):w("v-if",!0),h("div",Q,["sort"===u.type?(m(!0),d(b,{key:0},k(p(pe),((e,l)=>(m(),x(I,{key:l,class:"radio",disabled:!0},{default:f((()=>[h("span",F,g(String.fromCharCode(65+l))+". ",1),C(" "+g(e.title),1)])),_:2},1024)))),128)):(m(!0),d(b,{key:1},k(p(pe),((e,l)=>(m(),x(U,{key:l,class:"radio",value:"disabled",disabled:""},{default:f((()=>[h("span",G,g(String.fromCharCode(65+l))+". ",1),C(" "+g(e.title)+" "+g(e.isCorrect?"(支持选项)":"")+" "+g(1===p(ce)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+g(2===p(ce)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:f((()=>[u.showAction?(m(),x(R,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:p(de),examAnswerRelationType:ne.examAnswerRelationType,answerCheckType:p(me),onMoveUp:q[5]||(q[5]=e=>re("move","up")),onMoveDown:q[6]||(q[6]=e=>re("move","down")),onDelete:q[7]||(q[7]=e=>re("delete")),onSave:Te,onEdit:q[8]||(q[8]=e=>re("edit")),onAdd:Ee,onOnShowRichText:q[9]||(q[9]=e=>xe.value=!0),onSetKey:je,onSetAnswerSetting:_e},null,8,["is-edit","is-set","isKey","examAnswerRelationType","answerCheckType"])):w("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:f((()=>[h("div",{class:c(["flex",[{"margin-bottom":p(xe)}]])},[q[12]||(q[12]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"题目:")],-1)),h("div",J,[v(B,{modelValue:p(ye),"onUpdate:modelValue":q[0]||(q[0]=e=>S(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:`【${p(be)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),h("div",P,[q[13]||(q[13]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(m(),x(L,{key:0,modelValue:p(ve),"onUpdate:modelValue":q[1]||(q[1]=e=>S(ve)?ve.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:f((()=>[(m(!0),d(b,null,k(p(Se),(e=>(m(),x(K,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):w("v-if",!0)]),h("div",W,[(m(!0),d(b,null,k(p(pe),((e,l)=>(m(),d("div",{key:l,class:"answer-item flex flex-items-center"},[h("span",X,g(String.fromCharCode(65+l))+".",1),v(B,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+l)}`,disabled:u.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(u.type)?(m(),x(I,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":l=>e.isCorrect=l,class:c([{"is-correct":e.isCorrect}]),disabled:u.isSave,style:{"margin-left":"10px"},onChange:l=>function(e,l){"single"===ne.type?(l&&pe.value.forEach((l=>{l!==e&&(l.isCorrect=!1)})),e.isCorrect=l):"multiple"===ne.type&&(e.isCorrect=l)}(e,l)},{default:f((()=>[...q[14]||(q[14]=[C(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):w("v-if",!0),v($,{class:"icon"},{default:f((()=>[v(p(V),{class:c([{disabled:u.isSave}]),onClick:Ae},null,8,["class"])])),_:1}),v($,{class:"icon"},{default:f((()=>[v(p(T),{class:c([{disabled:p(pe).length<3||u.isSave}]),onClick:e=>function(e){pe.value.length<3||ne.isSave||pe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024),1===p(ce)?(m(),x(se,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,ge.value=pe.value[t].resultItem||"",void(Ce.value=!0);var t}},{default:f((()=>[h("span",null,g(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):w("v-if",!0),2===p(ce)?(m(),x(se,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){e.customAnswerId=e.examAnswerId||E(),re("setRelation",ne.customId,e)}(e)},{default:f((()=>[h("span",null,g(e.answerRelations?.length?`关联了${p(Ie)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):w("v-if",!0)])))),128))]),"sort"===u.type?(m(),d("div",Y,[q[15]||(q[15]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"排序答案:")],-1)),h("div",Z,[v(L,{modelValue:p(ke),"onUpdate:modelValue":q[2]||(q[2]=e=>S(ke)?ke.value=e:null),mode:"multiple",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:f((()=>[w(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(m(!0),d(b,null,k(p(pe),((e,l)=>(m(),x(K,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):w("v-if",!0),u.showAnalysis?(m(),d("div",ee,[q[16]||(q[16]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"解析:")],-1)),h("div",le,[v(B,{modelValue:p(fe),"onUpdate:modelValue":q[3]||(q[3]=e=>S(fe)?fe.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):w("v-if",!0),p(xe)?(m(),d("div",te,[q[18]||(q[18]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"富文本:")],-1)),h("div",ae,[v(_,A({"model-value":p(we),"onUpdate:modelValue":q[4]||(q[4]=e=>S(we)?we.value=e:null)},p(oe),{style:{width:"100%"}}),null,16,["model-value"]),h("div",ie,[v(se,{type:"danger",onClick:Ve},{default:f((()=>q[17]||(q[17]=[C(" 删除富文本 ")]))),_:1})])])])):w("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),v(Be,{modelValue:p(Ce),"onUpdate:modelValue":q[11]||(q[11]=e=>S(Ce)?Ce.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:f((()=>[v(he,{class:"customize-button",type:"primary",plain:"",onClick:Re},{default:f((()=>q[19]||(q[19]=[C(" 取消 ")]))),_:1}),v(he,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:f((()=>q[20]||(q[20]=[C(" 保存 ")]))),_:1})])),default:f((()=>[(m(),x(_,A({key:p(ue),"model-value":p(ge),"onUpdate:modelValue":q[10]||(q[10]=e=>S(ge)?ge.value=e:null)},p(oe),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});export{se as default};
1
+ import{ElCheckbox as e,ElRadio as l,ElInput as t,ElSelect as a,ElOption as i,ElIcon as s,ElLink as n,ElDialog as r,ElButton as o}from"element-plus/es";import{defineComponent as u,useAttrs as d,ref as m,computed as c,watch as p,onMounted as v,createElementBlock as y,openBlock as f,normalizeClass as x,unref as w,createVNode as h,createSlots as C,withCtx as g,createBlock as b,createCommentVNode as k,createElementVNode as S,createTextVNode as A,toDisplayString as V,Fragment as T,renderList as q,isRef as R,mergeProps as j}from"vue";import{CirclePlus as _,Remove as E}from"@element-plus/icons-vue";import{useNamespace as I}from"@qxs-bns/hooks";import U from"../../../subject-action/src/subject-action.vue.mjs";import B from"../../../subject-layout/src/subject-layout.vue.mjs";import K from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{setGuid as L}from"@qxs-bns/utils";import{ElMessage as $}from"element-plus";const N={class:"preview"},z={class:"title"},M={key:0},D={key:1},H={key:0},O=["innerHTML"],Q={class:"preview-answer"},F={class:"order"},G={class:"order"},J={style:{flex:"1"}},P={class:"margin-bottom flex flex-items-center"},W={class:"margin-bottom answer-list"},X={class:"order"},Y={key:0,class:"margin-bottom flex flex-items-center"},Z={style:{flex:"1"}},ee={key:1,class:"flex"},le={style:{flex:"1"}},te={key:2,class:"margin-bottom flex"},ae={style:{flex:"1"}},ie={class:"flex flex-justify-end"};var se=u({name:"QxsSubjectSingle",__name:"subject-single",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},type:{type:String,required:!0},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},answerList:{type:null,required:!1},leastAnswerCount:{type:Number,required:!1},analysis:{type:String,required:!1},examExpand:{type:String,required:!1},examRichTextContent:{type:String,required:!1},showAnalysis:{type:Boolean,required:!1},examAnswerRelationType:{type:Number,required:!1},customId:{type:Number,required:!1},examId:{type:Number,required:!1},isKey:{type:Boolean,required:!0},answerCheckType:{type:Number,required:!0}},emits:["move","save","delete","edit","add","setRelation"],setup(u,{emit:se}){const ne=u,re=se,oe=d(),ue=m(0),de=m(!1),me=m(1),ce=m(1),pe=m([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),ve=m(),ye=m(""),fe=m(""),xe=m(!1),we=m(""),he=m(0),Ce=m(!1),ge=m(""),be=c((()=>"single"===ne.type?"单选题":"multiple"===ne.type?"多选题":"排序题")),ke=m([]),Se=c((()=>{const e=[];for(let l=pe.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Ae(){ne.isSave||pe.value.push({title:"",isCorrect:!1,customAnswerId:L()})}function Ve(){xe.value=!1,we.value=""}function Te(){if(!ye.value)return void $.error("题目标题不能为空!");let e="",l=!1,t=0;if("multiple"===ne.type||"single"===ne.type?pe.value.forEach(((a,i)=>{a.title||(e+=`选项${String.fromCharCode(65+i)}未填写。`),a.isCorrect&&(l=!0,t++)})):"sort"===ne.type&&ke.value.length&&(l=!0),e)return void $.error(e);if(new Set(pe.value.map((e=>e.title))).size===pe.value.length){if("multiple"===ne.type){if(1===t)return void $.error("请至少设置两个支持选项");if(l&&t<ve.value)return void $.error("至少选几项与支持选项数不符")}console.log(me.value,111),2!==me.value&&3!==me.value||l?re("save",{title:ye.value,answers:pe.value.map(((e,l)=>({...e,orderIndex:l+1}))),examExpand:ke.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:fe.value,isSetCorrectAnswer:l,leastAnswerCount:ve.value,examRichTextContent:xe.value?we.value:"",examAnswerRelationType:ce.value,isKey:de.value,answerCheckType:me.value}):$.error("请设置支持选项")}else $.error("选项不能重复")}function qe(){pe.value[ue.value].resultItem=ge.value||"",Ce.value=!1}function Re(){Ce.value=!1,ge.value=""}function je(e){de.value=e}function _e(e){me.value=e}function Ee(e,l){re("add",e,l?ne.examAnswerRelationType:null)}p((()=>ne.isEdit),(()=>{ne.isEdit&&(he.value=(new Date).getTime())}));const Ie=c((()=>e=>{let l=0;return e.forEach((e=>{e.relationAnswers&&(l+=e.relationAnswers.length)})),l})),Ue=I("subject-single");return v((function(){if(ne.title&&(ye.value=ne.title),ne.answerCheckType&&(me.value=ne.answerCheckType),ne.isKey&&(de.value=ne.isKey),ne.examAnswerRelationType&&(ce.value=ne.examAnswerRelationType),ne.answerList&&ne.answerList.length&&(pe.value=ne.answerList),ne.leastAnswerCount&&(ve.value=ne.leastAnswerCount),ne.examExpand&&ne.examExpand){const e=ne.examExpand.split(",");ke.value=e.map((e=>{const l=ne.answerList.find((l=>l.answerId?.toString()===e));return l?String.fromCharCode(65+l.orderIndex-1):e})).filter(Boolean)}ne.analysis&&(fe.value=ne.analysis),ne.examRichTextContent&&(we.value=ne.examRichTextContent,xe.value=!0)})),(u,d)=>{const m=e,c=l,p=t,v=i,I=a,$=s,se=n,he=o,Be=r;return f(),y("div",{class:x(w(Ue).e("single-exam"))},[h(B,{"show-edit":u.isEdit},C({preview:g((()=>[S("div",N,[S("div",null,[S("span",z,[A(V(u.orderIndex+1)+"."+V(w(ye))+" ",1),"single"===u.type?(f(),y("span",M,"(单选题)")):["multiple","sort"].includes(u.type)?(f(),y("span",D," ("+V(w(be))+V(w(ve)?`至少选${w(ve)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):k("v-if",!0)])]),w(xe)?(f(),y("div",H,[S("div",{innerHTML:w(we)},null,8,O)])):k("v-if",!0),S("div",Q,["sort"===u.type?(f(!0),y(T,{key:0},q(w(pe),((e,l)=>(f(),b(m,{key:l,class:"radio",disabled:!0},{default:g((()=>[S("span",F,V(String.fromCharCode(65+l))+". ",1),A(" "+V(e.title),1)])),_:2},1024)))),128)):(f(!0),y(T,{key:1},q(w(pe),((e,l)=>(f(),b(c,{key:l,class:"radio",value:"disabled",disabled:""},{default:g((()=>[S("span",G,V(String.fromCharCode(65+l))+". ",1),A(" "+V(e.title)+" "+V(e.isCorrect?"(支持选项)":"")+" "+V(1===w(ce)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+V(2===w(ce)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:g((()=>[u.showAction?(f(),b(U,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:w(de),examAnswerRelationType:ne.examAnswerRelationType,answerCheckType:w(me),onMoveUp:d[5]||(d[5]=e=>re("move","up")),onMoveDown:d[6]||(d[6]=e=>re("move","down")),onDelete:d[7]||(d[7]=e=>re("delete")),onSave:Te,onEdit:d[8]||(d[8]=e=>re("edit")),onAdd:Ee,onOnShowRichText:d[9]||(d[9]=e=>xe.value=!0),onSetKey:je,onSetAnswerSetting:_e},null,8,["is-edit","is-set","isKey","examAnswerRelationType","answerCheckType"])):k("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:g((()=>[S("div",{class:x(["flex",[{"margin-bottom":w(xe)}]])},[d[12]||(d[12]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"题目:")],-1)),S("div",J,[h(p,{modelValue:w(ye),"onUpdate:modelValue":d[0]||(d[0]=e=>R(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:`【${w(be)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),S("div",P,[d[13]||(d[13]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(f(),b(I,{key:0,modelValue:w(ve),"onUpdate:modelValue":d[1]||(d[1]=e=>R(ve)?ve.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:g((()=>[(f(!0),y(T,null,q(w(Se),(e=>(f(),b(v,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):k("v-if",!0)]),S("div",W,[(f(!0),y(T,null,q(w(pe),((e,l)=>(f(),y("div",{key:l,class:"answer-item flex flex-items-center"},[S("span",X,V(String.fromCharCode(65+l))+".",1),h(p,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+l)}`,disabled:u.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(u.type)?(f(),b(m,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":l=>e.isCorrect=l,class:x([{"is-correct":e.isCorrect}]),disabled:u.isSave,style:{"margin-left":"10px"},onChange:l=>function(e,l){"single"===ne.type?(l&&pe.value.forEach((l=>{l!==e&&(l.isCorrect=!1)})),e.isCorrect=l):"multiple"===ne.type&&(e.isCorrect=l)}(e,l)},{default:g((()=>[...d[14]||(d[14]=[A(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):k("v-if",!0),h($,{class:"icon"},{default:g((()=>[h(w(_),{class:x([{disabled:u.isSave}]),onClick:Ae},null,8,["class"])])),_:1}),h($,{class:"icon"},{default:g((()=>[h(w(E),{class:x([{disabled:w(pe).length<3||u.isSave}]),onClick:e=>function(e){pe.value.length<3||ne.isSave||pe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024),1===w(ce)?(f(),b(se,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,ge.value=pe.value[t].resultItem||"",void(Ce.value=!0);var t}},{default:g((()=>[S("span",null,V(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):k("v-if",!0),2===w(ce)?(f(),b(se,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){e.customAnswerId=e.examAnswerId||L(),re("setRelation",ne.customId,e)}(e)},{default:g((()=>[S("span",null,V(e.answerRelations?.length?`关联了${w(Ie)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):k("v-if",!0)])))),128))]),"sort"===u.type?(f(),y("div",Y,[d[15]||(d[15]=S("div",{class:"label flex flex-justify-end"},[S("span",null,"排序答案:")],-1)),S("div",Z,[h(I,{modelValue:w(ke),"onUpdate:modelValue":d[2]||(d[2]=e=>R(ke)?ke.value=e:null),mode:"multiple",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:g((()=>[k(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(f(!0),y(T,null,q(w(pe),((e,l)=>(f(),b(v,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):k("v-if",!0),u.showAnalysis?(f(),y("div",ee,[d[16]||(d[16]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"解析:")],-1)),S("div",le,[h(p,{modelValue:w(fe),"onUpdate:modelValue":d[3]||(d[3]=e=>R(fe)?fe.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):k("v-if",!0),w(xe)?(f(),y("div",te,[d[18]||(d[18]=S("div",{class:"label flex flex-justify-center"},[S("span",null,"富文本:")],-1)),S("div",ae,[h(K,j({"model-value":w(we),"onUpdate:modelValue":d[4]||(d[4]=e=>R(we)?we.value=e:null)},w(oe),{style:{width:"100%"}}),null,16,["model-value"]),S("div",ie,[h(se,{type:"danger",onClick:Ve},{default:g((()=>d[17]||(d[17]=[A(" 删除富文本 ")]))),_:1})])])])):k("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),h(Be,{modelValue:w(Ce),"onUpdate:modelValue":d[11]||(d[11]=e=>R(Ce)?Ce.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:g((()=>[h(he,{class:"customize-button",type:"primary",plain:"",onClick:Re},{default:g((()=>d[19]||(d[19]=[A(" 取消 ")]))),_:1}),h(he,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:g((()=>d[20]||(d[20]=[A(" 保存 ")]))),_:1})])),default:g((()=>[(f(),b(K,j({key:w(ue),"model-value":w(ge),"onUpdate:modelValue":d[10]||(d[10]=e=>R(ge)?ge.value=e:null)},w(oe),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});export{se as default};
2
2
  //# sourceMappingURL=subject-single.vue.mjs.map
@@ -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 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'\nimport { setGuid } from '@qxs-bns/utils'\nimport { ElMessage } from 'element-plus'\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(false)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(1)\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()\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 } 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 let msg = ''\n let isSetCorrectAnswer = false\n // let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n // if (v.resultItem) {\n // examAnswerRelationType = 1\n // }\n // if (v.answerRelations?.length) {\n // examAnswerRelationType = 2\n // }\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 console.log(answerCheckType.value, 111)\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 // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\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 v-html=\"richText\" />\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 v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\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-option>\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=\"order\">{{ 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\"\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\"\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 v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\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 mode=\"multiple\"\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\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 v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :isKey=\"isKey\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"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 @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"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 <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","String","fromCharCode","Set","map","item","size","console","log","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","it","event","splice","examAnswerId","customId"],"mappings":"8sEAYA,MAAMA,GAAQC,EAoBRC,GAAQC,GAERC,GAAQC,IAERC,GAAeC,EAAI,GACnBC,GAAQD,GAAI,GACZE,GAAkBF,EAAI,GACtBG,GAAyBH,EAAI,GAC7BI,GAAUJ,EAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,GAAmBP,IACnBK,GAAQL,EAAI,IACZQ,GAAWR,EAAI,IACfS,GAAeT,GAAI,GACnBU,GAAWV,EAAI,IACfW,GAAYX,EAAI,GAChBY,GAAkBZ,GAAI,GACtBa,GAAab,EAAY,IACzBc,GAAmBC,GAAS,IACb,WAAftB,GAAMuB,KACD,MAEe,aAAfvB,GAAMuB,KACN,MAGA,QAILC,GAAYjB,EAAc,IAE1BkB,GAAqBH,GAAS,KAClC,MAAMI,EAAQ,GAEd,IAAA,IAASC,EADMhB,GAAQiB,MAAMC,OACJF,EAAQ,EAAGA,IAClCD,EAAMI,KAAK,CACTC,MAAO,OAAOJ,KACdC,MAAOD,IAGX,OAAOD,EAAMM,SAAQ,IAEvB,SAASC,KACHjC,GAAMkC,QAGVvB,GAAQiB,MAAME,KAAK,CACjBlB,MAAO,GACPC,WAAW,EACXsB,eAAgBC,KACjB,CA+BH,SAASC,KACPrB,GAAaY,OAAQ,EACrBX,GAASW,MAAQ,EAAA,CAGnB,SAASU,KACH,IAAC1B,GAAMgB,MAET,YADAW,EAAUC,MAAM,aAGlB,IAAIC,EAAM,GACNC,GAAqB,EAErBC,EAAqB,EAwBzB,GAvBmB,aAAf3C,GAAMuB,MAAsC,WAAfvB,GAAMuB,KACrCZ,GAAQiB,MAAMgB,SAAQ,CAACC,EAAQC,KACxBD,EAAEjC,QACL6B,GAAO,KAAKM,OAAOC,aAAa,GAAKF,UAEnCD,EAAEhC,YACiB6B,GAAA,EACrBC,IAAA,IAUkB,SAAf3C,GAAMuB,MAETC,GAAUI,MAAMC,SACGa,GAAA,GAGrBD,EAEF,YADAF,EAAUC,MAAMC,GAMlB,GAFqB,IAAIQ,IAAItC,GAAQiB,MAAMsB,KAAKC,GAAcA,EAAKvC,SAElDwC,OAASzC,GAAQiB,MAAMC,OAAxC,CAKI,GAAe,aAAf7B,GAAMuB,KAAqB,CAC7B,GAA2B,IAAvBoB,EAEF,YADAJ,EAAUC,MAAM,eAId,GAAAE,GAAsBC,EAAqB7B,GAAiBc,MAE9D,YADAW,EAAUC,MAAM,gBAElB,CAEMa,QAAAC,IAAI7C,GAAgBmB,MAAO,KAGN,IAA1BnB,GAAgBmB,OAAyC,IAA1BnB,GAAgBmB,OAE3Cc,EAMPxC,GAAM,OAAQ,CACZU,MAAOA,GAAMgB,MACbjB,QAASA,GAAQiB,MAAMsB,KAAI,CAACC,EAAWI,KAC9B,IAAKJ,EAAMK,WAAYD,EAAQ,MAExCE,WAAYjC,GAAUI,MAAMsB,KAAKJ,GAAcA,EAAEY,WAAW,GAAK,GAAK,IAAGC,KAAK,KAC9E5C,SAAUA,GAASa,MACnBc,qBACA5B,iBAAkBA,GAAiBc,MACnCgC,oBAAqB5C,GAAaY,MAAQX,GAASW,MAAQ,GAC3DlB,uBAAwBA,GAAuBkB,MAC/CpB,MAAOA,GAAMoB,MACbnB,gBAAiBA,GAAgBmB,QAjB/BW,EAAUC,MAAM,UApBlB,MADAD,EAAUC,MAAM,SAuCjB,CAwDH,SAASqB,KACPlD,GAAQiB,MAAMtB,GAAasB,OAAOR,WAAaA,GAAWQ,OAAS,GACnET,GAAgBS,OAAQ,CAAA,CAE1B,SAASkC,KACP3C,GAAgBS,OAAQ,EACxBR,GAAWQ,MAAQ,EAAA,CAErB,SAASmC,GAAOC,GACdxD,GAAMoB,MAAQoC,CAAA,CAEhB,SAASC,GAAiB1C,GACxBd,GAAgBmB,MAAQL,CAAA,CAGjB,SAAA2C,GAAI3C,EAAc4C,GACvBjE,GAAM,MAAOqB,EAAM4C,EAAQnE,GAAMU,uBAAwB,KAAI,CAG3D0D,GAAA,IAAMpE,GAAMqE,SAAQ,KACpBrE,GAAMqE,SACRnD,GAAUU,OAAQ,IAAI0C,MAAOC,UAAQ,IAInC,MAAAC,GAAiBlD,GAAS,IACtBuB,IACN,IAAIlB,EAAQ,EAML,OALLkB,EAAAD,SAASO,IACLA,EAAKsB,kBACP9C,GAASwB,EAAKsB,gBAAgB5C,OAAA,IAG3BF,CAAA,IAIL+C,GAAKC,EAAa,yBAExBC,GA5FA,WAyBE,GAxBI5E,GAAMY,QACRA,GAAMgB,MAAQ5B,GAAMY,OAIlBZ,GAAMS,kBACRA,GAAgBmB,MAAQ5B,GAAMS,iBAE5BT,GAAMQ,QACRA,GAAMoB,MAAQ5B,GAAMQ,OAGlBR,GAAMU,yBACRA,GAAuBkB,MAAQ5B,GAAMU,wBAGnCV,GAAM6E,YAAc7E,GAAM6E,WAAWhD,SACvClB,GAAQiB,MAAQ5B,GAAM6E,YAGpB7E,GAAMc,mBACRA,GAAiBc,MAAQ5B,GAAMc,kBAG7Bd,GAAMyD,YAEJzD,GAAMyD,WAAY,CACpB,MAAMqB,EAAsB9E,GAAMyD,WAAWsB,MAAM,KAGnDvD,GAAUI,MAAQkD,EAAoB5B,KAAK8B,IACnC,MAAAC,EAASjF,GAAM6E,WAAWK,MAAM/B,GAAcA,EAAKgC,UAAUC,aAAeJ,IAClF,OAAOC,EAASlC,OAAOC,aAAa,GAAKiC,EAAOzB,WAAa,GAAKwB,CAAA,IACjEK,OAAOC,QAAO,CAIjBtF,GAAMe,WACRA,GAASa,MAAQ5B,GAAMe,UAGrBf,GAAM4D,sBACR3C,GAASW,MAAQ5B,GAAM4D,oBACvB5C,GAAaY,OAAQ,EACvB,0kGAzJO,SAAW2D,EAASC,GACR,WAAfxF,GAAMuB,MAEJiE,GACM7E,GAAAiB,MAAMgB,SAASqC,IACjBA,IAAWM,IACbN,EAAOpE,WAAY,EAAA,IAIzB0E,EAAG1E,UAAY2E,GACS,aAAfxF,GAAMuB,OAEfgE,EAAG1E,UAAY2E,EACjB,gXArBF,SAAsBjC,GAChB5C,GAAQiB,MAAMC,OAAS,GAAK7B,GAAMkC,QAG9BvB,GAAAiB,MAAM6D,OAAOlC,EAAO,EAAC,oIA8JTT,IACpBxC,GAAasB,MAAQkB,EACrB1B,GAAWQ,MAAQjB,GAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,GAAgBS,OAAQ,GAH1B,IAAsBkB,wLA3ItB,SAAqBK,GACdA,EAAAhB,eAAiBgB,EAAKuC,cAAgBtD,IACrClC,GAAA,cAAeF,GAAM2F,SAAUxC,EAAI"}
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 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'\nimport { setGuid } from '@qxs-bns/utils'\nimport { ElMessage } from 'element-plus'\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(false)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(1)\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()\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 } 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 let msg = ''\n let isSetCorrectAnswer = false\n // let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n // if (v.resultItem) {\n // examAnswerRelationType = 1\n // }\n // if (v.answerRelations?.length) {\n // examAnswerRelationType = 2\n // }\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 console.log(answerCheckType.value, 111)\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 // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\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 v-html=\"richText\" />\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 v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\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-option>\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=\"order\">{{ 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\"\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\"\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 v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\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 mode=\"multiple\"\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\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 v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :isKey=\"isKey\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"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 @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"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 <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","String","fromCharCode","Set","map","item","size","console","log","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","it","event","splice","examAnswerId","customId"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{ElInput as e,ElInputNumber as l,ElCheckboxGroup as t,ElCheckbox as a,ElTag as i,ElButton as s,ElIcon as n,ElLink as o}from"element-plus/es";import{defineComponent as u,createElementBlock as r,openBlock as d,normalizeClass as v,unref as m,createVNode as c,withCtx as p,createBlock as f,createCommentVNode as x,createElementVNode as y,isRef as w,Fragment as g,renderList as h,createTextVNode as b,toDisplayString as V,mergeProps as k}from"vue";import{Plus as C,CirclePlus as S,Remove as j}from"@element-plus/icons-vue";import{useNamespace as I}from"@qxs-bns/hooks";import{ElMessage as O}from"element-plus";import A from"../../../subject-action/src/subject-action.vue.mjs";import q from"../../../subject-layout/src/subject-layout.vue.mjs";import _ from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{useAttrs as T,ref as E,onMounted as R}from"vue-demi";const U={class:"preview"},B={class:"content"},L={class:"title"},M={key:0},D=["innerHTML"],H={class:"content flex flex-col"},N={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},z={class:"title"},$={class:"flex"},F={style:{flex:"1"},class:"margin-bottom"},G={class:"margin-bottom flex flex-items-center"},J={class:"flex"},K={style:{flex:"1"}},P={class:"margin-bottom answer-list"},Q={class:"label flex flex-justify-end"},W={class:"answer-tags"},X={class:"operation"},Y={key:0,class:"margin-bottom flex"},Z={style:{flex:"1"}},ee={key:1,class:"margin-bottom flex"},le={style:{flex:"1"}},te={class:"flex flex-justify-end"};var ae=u({__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(u,{emit:ae}){const ie=u,se=ae,ne=T(),oe=E([{title:"",tag:"",showInput:!1}]),ue=E(""),re=E(""),de=E(),ve=E(""),me=E(!1),ce=E(""),pe=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],fe=E(["isInOrder","isIgnoreCase"]);function xe(){oe.value.push({title:"",tag:"",showInput:!1})}function ye(){me.value=!1,ce.value=""}function we(){if(ue.value){if(de.value||ve.value){if(!de.value)return void O.error("请完善答题设置!");if(!ve.value)return void O.error("请输入问题正确答案!");if(oe.value.length!==de.value)return void O.error("关键词个数设置有误!");const e=[];if(oe.value.forEach(((l,t)=>{l.title||e.push(`关键词${t+1}未设置`)})),e.length>0)return void O.error(e.join(","))}se("save",{title:ue.value,answers:oe.value.filter((e=>e.title)).map((e=>({title:e.title}))),analysis:re.value,isSetCorrectAnswer:!!ve.value,examExpand:ve.value,examAnswerSettingBO:{isIgnoreCase:fe.value?.includes("isIgnoreCase"),isInOrder:fe.value?.includes("isInOrder"),keywordCount:de.value},examRichTextContent:me.value?ce.value:""})}else O.error("题目标题不能为空!")}R((function(){ie.title&&(ue.value=ie.title),ie.answerList&&ie.answerList.length&&(oe.value=ie.answerList),ie.examAnswerSettingVO&&(fe.value=fe.value.filter((e=>"isIgnoreCase"===e&&ie.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&ie.examAnswerSettingVO?.isInOrder))),ie.examAnswerSettingVO?.keywordCount&&(de.value=ie.examAnswerSettingVO?.keywordCount),ie.examExpand&&(ve.value=ie.examExpand),ie.analysis&&(re.value=ie.analysis),ie.examRichTextContent&&(ce.value=ie.examRichTextContent,me.value=!0)}));const ge=I("subject-text-fill");return(u,I)=>{const O=a,T=e,E=l,R=t,ae=i,he=n,be=s,Ve=o;return d(),r("div",{class:v(m(ge).e("text-fill-exam"))},[c(q,{"show-edit":u.isEdit},{preview:p((()=>[y("div",U,[y("div",B,[y("span",L,V(u.orderIndex+1)+"."+V(m(ue))+"(问答题)",1),m(me)?(d(),r("div",M,[y("div",{innerHTML:m(ce)},null,8,D)])):x("v-if",!0),y("div",H,[m(oe).some((e=>e.title))?(d(!0),r(g,{key:0},h(m(oe),((e,l)=>(d(),f(O,{key:l,class:"radio",disabled:!0},{default:p((()=>[b(V(e.title),1)])),_:2},1024)))),128)):x("v-if",!0)]),m(ve)?(d(),r("div",N,[y("span",z,"正确答案:"+V(m(ve)),1)])):x("v-if",!0)])])])),edit:p((()=>[y("div",$,[I[12]||(I[12]=y("div",{class:"label flex flex-justify-end"},[y("span",null,"题目:")],-1)),y("div",F,[c(T,{modelValue:m(ue),"onUpdate:modelValue":I[0]||(I[0]=e=>w(ue)?ue.value=e:null),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:u.isSave},null,8,["modelValue","disabled"])])]),y("div",G,[I[13]||(I[13]=y("div",{class:"label flex flex-justify-end"},[y("span",null,"答题设置:")],-1)),I[14]||(I[14]=y("span",null,"共答对",-1)),c(E,{modelValue:m(de),"onUpdate:modelValue":I[1]||(I[1]=e=>w(de)?de.value=e:null),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),I[15]||(I[15]=y("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(d(),r(g,null,h(pe,(e=>c(R,{key:e.value,modelValue:m(fe),"onUpdate:modelValue":I[2]||(I[2]=e=>w(fe)?fe.value=e:null)},{default:p((()=>[c(O,{label:e.value,class:"margin-left-10"},{default:p((()=>[b(V(e.label),1)])),_:2},1032,["label"])])),_:2},1032,["modelValue"]))),64))]),y("div",J,[I[16]||(I[16]=y("div",{class:"label flex flex-justify-end"},[y("span",null,"答案:")],-1)),y("div",K,[c(T,{modelValue:m(ve),"onUpdate:modelValue":I[3]||(I[3]=e=>w(ve)?ve.value=e:null),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:u.isSave},null,8,["modelValue","disabled"])])]),y("div",P,[I[17]||(I[17]=y("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(d(!0),r(g,null,h(m(oe),((e,l)=>(d(),r("div",{key:l,class:"answer-item flex flex-items-center"},[y("div",Q,[y("span",null,"关键词"+V(l+1)+":",1)]),y("div",W,[(d(!0),r(g,null,h(e.title.split(","),(l=>(d(),r(g,{key:l},[l?(d(),f(ae,{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(","))}}(l,e)},{default:p((()=>[b(V(l),1)])),_:2},1032,["onClose"])):x("v-if",!0)],64)))),128)),u.isSave?x("v-if",!0):(d(),r(g,{key:0},[e.showInput?(d(),f(T,{key:0,modelValue:e.tag,"onUpdate:modelValue":l=>e.tag=l,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(d(),f(be,{key:1,size:"small",onClick:l=>e.showInput=!0},{default:p((()=>[c(he,null,{default:p((()=>[c(m(C))])),_:1}),y("span",null,V(e.title?"添加同义词":"添加关键词"),1)])),_:2},1032,["onClick"]))],64))]),y("div",X,[c(he,{class:"icon"},{default:p((()=>[c(m(S),{class:v([{disabled:u.isSave}]),onClick:xe},null,8,["class"])])),_:1}),c(he,{class:"icon"},{default:p((()=>[c(m(j),{class:v([{disabled:m(oe).length<2||u.isSave}]),onClick:e=>function(e){oe.value.length<2||ie.isSave||oe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])])))),128))]),u.showAnalysis?(d(),r("div",Y,[I[18]||(I[18]=y("div",{class:"label flex flex-justify-end"},[y("span",null,"解析:")],-1)),y("div",Z,[c(T,{modelValue:m(re),"onUpdate:modelValue":I[4]||(I[4]=e=>w(re)?re.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):x("v-if",!0),m(me)?(d(),r("div",ee,[I[20]||(I[20]=y("div",{class:"label flex flex-justify-center"},[y("span",null,"富文本:")],-1)),y("div",le,[c(_,k({"model-value":m(ce),"onUpdate:modelValue":I[5]||(I[5]=e=>w(ce)?ce.value=e:null)},m(ne),{style:{width:"100%"}}),null,16,["model-value"]),y("div",te,[c(Ve,{type:"danger",onClick:ye},{default:p((()=>I[19]||(I[19]=[b(" 删除富文本 ")]))),_:1})])])])):x("v-if",!0)])),default:p((()=>[u.showAction?(d(),f(A,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,showOtherOption:!1,examAnswerRelationType:ie.examAnswerRelationType,onMoveUp:I[6]||(I[6]=e=>se("move","up")),onMoveDown:I[7]||(I[7]=e=>se("move","down")),onDelete:I[8]||(I[8]=e=>se("delete")),onSave:we,onEdit:I[9]||(I[9]=e=>se("edit")),onAdd:I[10]||(I[10]=e=>se("add",e)),onOnShowRichText:I[11]||(I[11]=e=>me.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):x("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{ae as default};
1
+ import{ElInput as e,ElInputNumber as l,ElCheckboxGroup as t,ElCheckbox as a,ElTag as i,ElButton as s,ElIcon as n,ElLink as o}from"element-plus/es";import{defineComponent as u,useAttrs as r,ref as d,onMounted as v,createElementBlock as m,openBlock as c,normalizeClass as p,unref as f,createVNode as x,withCtx as y,createBlock as w,createCommentVNode as g,createElementVNode as h,isRef as b,Fragment as V,renderList as k,createTextVNode as C,toDisplayString as S,mergeProps as j}from"vue";import{Plus as I,CirclePlus as O,Remove as A}from"@element-plus/icons-vue";import{useNamespace as q}from"@qxs-bns/hooks";import{ElMessage as _}from"element-plus";import T from"../../../subject-action/src/subject-action.vue.mjs";import E from"../../../subject-layout/src/subject-layout.vue.mjs";import R from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";const U={class:"preview"},B={class:"content"},L={class:"title"},M={key:0},D=["innerHTML"],H={class:"content flex flex-col"},N={key:1,class:"flex",style:{"margin-top":"10px",color:"#a8abb2"}},z={class:"title"},$={class:"flex"},F={style:{flex:"1"},class:"margin-bottom"},G={class:"margin-bottom flex flex-items-center"},J={class:"flex"},K={style:{flex:"1"}},P={class:"margin-bottom answer-list"},Q={class:"label flex flex-justify-end"},W={class:"answer-tags"},X={class:"operation"},Y={key:0,class:"margin-bottom flex"},Z={style:{flex:"1"}},ee={key:1,class:"margin-bottom flex"},le={style:{flex:"1"}},te={class:"flex flex-justify-end"};var ae=u({__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(u,{emit:ae}){const ie=u,se=ae,ne=r(),oe=d([{title:"",tag:"",showInput:!1}]),ue=d(""),re=d(""),de=d(),ve=d(""),me=d(!1),ce=d(""),pe=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],fe=d(["isInOrder","isIgnoreCase"]);function xe(){oe.value.push({title:"",tag:"",showInput:!1})}function ye(){me.value=!1,ce.value=""}function we(){if(ue.value){if(de.value||ve.value){if(!de.value)return void _.error("请完善答题设置!");if(!ve.value)return void _.error("请输入问题正确答案!");if(oe.value.length!==de.value)return void _.error("关键词个数设置有误!");const e=[];if(oe.value.forEach(((l,t)=>{l.title||e.push(`关键词${t+1}未设置`)})),e.length>0)return void _.error(e.join(","))}se("save",{title:ue.value,answers:oe.value.filter((e=>e.title)).map((e=>({title:e.title}))),analysis:re.value,isSetCorrectAnswer:!!ve.value,examExpand:ve.value,examAnswerSettingBO:{isIgnoreCase:fe.value?.includes("isIgnoreCase"),isInOrder:fe.value?.includes("isInOrder"),keywordCount:de.value},examRichTextContent:me.value?ce.value:""})}else _.error("题目标题不能为空!")}v((function(){ie.title&&(ue.value=ie.title),ie.answerList&&ie.answerList.length&&(oe.value=ie.answerList),ie.examAnswerSettingVO&&(fe.value=fe.value.filter((e=>"isIgnoreCase"===e&&ie.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&ie.examAnswerSettingVO?.isInOrder))),ie.examAnswerSettingVO?.keywordCount&&(de.value=ie.examAnswerSettingVO?.keywordCount),ie.examExpand&&(ve.value=ie.examExpand),ie.analysis&&(re.value=ie.analysis),ie.examRichTextContent&&(ce.value=ie.examRichTextContent,me.value=!0)}));const ge=q("subject-text-fill");return(u,r)=>{const d=a,v=e,q=l,_=t,ae=i,he=n,be=s,Ve=o;return c(),m("div",{class:p(f(ge).e("text-fill-exam"))},[x(E,{"show-edit":u.isEdit},{preview:y((()=>[h("div",U,[h("div",B,[h("span",L,S(u.orderIndex+1)+"."+S(f(ue))+"(问答题)",1),f(me)?(c(),m("div",M,[h("div",{innerHTML:f(ce)},null,8,D)])):g("v-if",!0),h("div",H,[f(oe).some((e=>e.title))?(c(!0),m(V,{key:0},k(f(oe),((e,l)=>(c(),w(d,{key:l,class:"radio",disabled:!0},{default:y((()=>[C(S(e.title),1)])),_:2},1024)))),128)):g("v-if",!0)]),f(ve)?(c(),m("div",N,[h("span",z,"正确答案:"+S(f(ve)),1)])):g("v-if",!0)])])])),edit:y((()=>[h("div",$,[r[12]||(r[12]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"题目:")],-1)),h("div",F,[x(v,{modelValue:f(ue),"onUpdate:modelValue":r[0]||(r[0]=e=>b(ue)?ue.value=e:null),type:"textarea",rows:2,placeholder:"【问答题】请输入问题",maxlength:200,"show-word-limit":"",disabled:u.isSave},null,8,["modelValue","disabled"])])]),h("div",G,[r[13]||(r[13]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"答题设置:")],-1)),r[14]||(r[14]=h("span",null,"共答对",-1)),x(q,{modelValue:f(de),"onUpdate:modelValue":r[1]||(r[1]=e=>b(de)?de.value=e:null),style:{width:"100px",margin:"0 10px"},min:1},null,8,["modelValue"]),r[15]||(r[15]=h("span",{style:{"margin-right":"10px"}},"个关键词,算是正确的",-1)),(c(),m(V,null,k(pe,(e=>x(_,{key:e.value,modelValue:f(fe),"onUpdate:modelValue":r[2]||(r[2]=e=>b(fe)?fe.value=e:null)},{default:y((()=>[x(d,{label:e.value,class:"margin-left-10"},{default:y((()=>[C(S(e.label),1)])),_:2},1032,["label"])])),_:2},1032,["modelValue"]))),64))]),h("div",J,[r[16]||(r[16]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"答案:")],-1)),h("div",K,[x(v,{modelValue:f(ve),"onUpdate:modelValue":r[3]||(r[3]=e=>b(ve)?ve.value=e:null),type:"textarea",rows:2,placeholder:"请输入正确答案",maxlength:200,"show-word-limit":"",disabled:u.isSave},null,8,["modelValue","disabled"])])]),h("div",P,[r[17]||(r[17]=h("span",{style:{"padding-left":"60px"}},"*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'",-1)),(c(!0),m(V,null,k(f(oe),((e,l)=>(c(),m("div",{key:l,class:"answer-item flex flex-items-center"},[h("div",Q,[h("span",null,"关键词"+S(l+1)+":",1)]),h("div",W,[(c(!0),m(V,null,k(e.title.split(","),(l=>(c(),m(V,{key:l},[l?(c(),w(ae,{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(","))}}(l,e)},{default:y((()=>[C(S(l),1)])),_:2},1032,["onClose"])):g("v-if",!0)],64)))),128)),u.isSave?g("v-if",!0):(c(),m(V,{key:0},[e.showInput?(c(),w(v,{key:0,modelValue:e.tag,"onUpdate:modelValue":l=>e.tag=l,style:{width:"80px"},onBlur:()=>function(e){e.showInput=!1,e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag="")}(e)},null,8,["modelValue","onUpdate:modelValue","onBlur"])):(c(),w(be,{key:1,size:"small",onClick:l=>e.showInput=!0},{default:y((()=>[x(he,null,{default:y((()=>[x(f(I))])),_:1}),h("span",null,S(e.title?"添加同义词":"添加关键词"),1)])),_:2},1032,["onClick"]))],64))]),h("div",X,[x(he,{class:"icon"},{default:y((()=>[x(f(O),{class:p([{disabled:u.isSave}]),onClick:xe},null,8,["class"])])),_:1}),x(he,{class:"icon"},{default:y((()=>[x(f(A),{class:p([{disabled:f(oe).length<2||u.isSave}]),onClick:e=>function(e){oe.value.length<2||ie.isSave||oe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])])))),128))]),u.showAnalysis?(c(),m("div",Y,[r[18]||(r[18]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"解析:")],-1)),h("div",Z,[x(v,{modelValue:f(re),"onUpdate:modelValue":r[4]||(r[4]=e=>b(re)?re.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):g("v-if",!0),f(me)?(c(),m("div",ee,[r[20]||(r[20]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"富文本:")],-1)),h("div",le,[x(R,j({"model-value":f(ce),"onUpdate:modelValue":r[5]||(r[5]=e=>b(ce)?ce.value=e:null)},f(ne),{style:{width:"100%"}}),null,16,["model-value"]),h("div",te,[x(Ve,{type:"danger",onClick:ye},{default:y((()=>r[19]||(r[19]=[C(" 删除富文本 ")]))),_:1})])])])):g("v-if",!0)])),default:y((()=>[u.showAction?(c(),w(T,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,showOtherOption:!1,examAnswerRelationType:ie.examAnswerRelationType,onMoveUp:r[6]||(r[6]=e=>se("move","up")),onMoveDown:r[7]||(r[7]=e=>se("move","down")),onDelete:r[8]||(r[8]=e=>se("delete")),onSave:we,onEdit:r[9]||(r[9]=e=>se("edit")),onAdd:r[10]||(r[10]=e=>se("add",e)),onOnShowRichText:r[11]||(r[11]=e=>me.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):g("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 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 v-html=\"richText\" />\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 style=\"flex: 1;\" class=\"margin-bottom\">\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 :label=\"item.value\" class=\"margin-left-10\">\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 v-if=\"showAnalysis\" class=\"margin-bottom 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=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"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 @onShowRichText=\"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","tags","split","findIndex","splice","isSave"],"mappings":"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"}
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 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 v-html=\"richText\" />\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 style=\"flex: 1;\" class=\"margin-bottom\">\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 :label=\"item.value\" class=\"margin-left-10\">\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 v-if=\"showAnalysis\" class=\"margin-bottom 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=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\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 :showOtherOption=\"false\"\n :examAnswerRelationType=\"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 @onShowRichText=\"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","tags","split","findIndex","splice","isSave"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as e,createElementBlock as t,openBlock as s,normalizeClass as n,unref as i,createElementVNode as a,Fragment as o,renderList as l,createBlock as r,createCommentVNode as d,mergeProps as c}from"vue";import m from"./components/subject-blank-fill.vue.mjs";import x from"./components/subject-scale.vue.mjs";import u from"./components/subject-single.vue.mjs";import p from"./components/subject-text-fill.vue.mjs";import w from"./components/SubjectRichText.vue.mjs";import v from"./components/SubjectPageEnd.vue.mjs";import{useNamespace as y}from"@qxs-bns/hooks";import{setGuid as h}from"@qxs-bns/utils";import{ref as T,useAttrs as f,watch as A}from"vue-demi";import{ElMessage as R}from"element-plus/es";const E={class:"subject-list-wrapper"};var S=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:S,emit:g}){const C=e,D=T([]),j=g,b=f();function _(){let e=0,t=!1;return D.value.map(((s,n,i)=>{"page_end"===s.answerType&&(e++,t=n===i.length-1)})),t?e:e+1}function k(e,t,s){console.log(t,"index"),t||0===t?D.value.splice(t+1,0,{customId:h(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s}):D.value.push({customId:h(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s})}function I(e,t){if("up"===t&&e>0){const[t]=D.value.splice(e,1);D.value.splice(e-1,0,t)}else if("down"===t&&e<D.value.length-1){const[t]=D.value.splice(e,1);D.value.splice(e+1,0,t)}}function M(e,t){for(let s=0;s<D.value.length;s++)e===s&&(D.value[e]={...D.value[e],...t,isEdit:!1,examAnswerRelationType:t.examAnswerRelationType})}function L(e){D.value.splice(e,1),R.success("删除成功")}function P(e,t){j("setRelation",e,t)}S({addSubject:k,currentList:D,uploadExcel:function(e){D.value=D.value.concat(e)},addExam:function(e){const t=[];e.answers?.map((e=>{t.push({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})})),D.value.push({...e,customId:h(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:t,isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1})},setAnswerRelation:function(e,t,s){console.log(e,t,s,111),console.log(D.value,222),e.length&&D.value.forEach((n=>{n.customId===t&&n.answer.forEach((t=>{t.customAnswerId===s&&(t.answerRelations=e)}))}))}}),A((()=>C.subjectList),(e=>{e&&(D.value=[...e])}),{immediate:!0});const q=y("subject-list");return(e,y)=>(s(),t("div",{class:n(i(q).e("list-exam"))},[a("div",E,[(s(!0),t(o,null,l(i(D),((n,a)=>(s(),t("div",{key:a+n.examId||n.title},[["single","multiple","sort"].includes(n.answerType)?(s(),r(u,c({key:0,ref_for:!0},i(b),{"order-index":a,title:n.title,type:n.answerType,"exam-id":n.examId,isKey:n.isKey,"is-save":!n.isRealCanDel,customId:n.customId,"is-set":n.hasSet||!1,"answer-list":n.answers,analysis:n.analysis,"least-answer-count":n.leastAnswerCount,"is-edit":n.isEdit||!1,"show-action":!e.isPreview,"exam-expand":n.examExpand,answerCheckType:n.answerCheckType,"exam-rich-text-content":n.examRichTextContent,examAnswerRelationType:n.examAnswerRelationType,onSetRelation:P,onMove:e=>I(a,e),onDelete:e=>L(a),onSave:e=>M(a,e),onEdit:e=>n.isEdit=!0,onAdd:(e,t)=>k(e,a,t)}),null,16,["order-index","title","type","exam-id","isKey","is-save","customId","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answerCheckType","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===n.answerType?(s(),r(x,c({key:1,ref_for:!0},i(b),{"order-index":a,title:n.title,"is-save":!n.isRealCanDel,"is-set":n.hasSet||!1,"answer-list":n.answers,analysis:n.analysis,"is-edit":n.isEdit||!1,"scale-question-list":n.scaleQuestionList,"show-action":!e.isPreview,"exam-rich-text-content":n.examRichTextContent,examAnswerRelationType:n.examAnswerRelationType,onMove:e=>I(a,e),onDelete:e=>L(a),onSave:e=>M(a,e),onEdit:e=>n.isEdit=!0,onAdd:e=>k(e,a,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===n.answerType?(s(),r(m,c({key:2,ref_for:!0},i(b),{"order-index":a,title:n.title,"is-save":!n.isRealCanDel,"is-set":n.hasSet||!1,"answer-list":n.answers,analysis:n.analysis,"show-action":!e.isPreview,"is-edit":n.isEdit||!1,"exam-answer-setting-v-o":n.examAnswerSettingVO||{},"exam-rich-text-content":n.examRichTextContent,examAnswerRelationType:n.examAnswerRelationType,onMove:e=>I(a,e),onDelete:e=>L(a),onSave:e=>M(a,e),onEdit:e=>n.isEdit=!0,onAdd:e=>k(e,a,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","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===n.answerType?(s(),r(p,c({key:3,ref_for:!0},i(b),{"order-index":a,title:n.title,"is-save":!n.isRealCanDel,"is-set":n.hasSet||!1,"answer-list":n.answers,analysis:n.analysis,"show-action":!e.isPreview,"is-edit":n.isEdit||!1,"exam-expand":n.examExpand,"exam-answer-setting-v-o":n.examAnswerSettingVO||{},examAnswerRelationType:n.examAnswerRelationType,"exam-rich-text-content":n.examRichTextContent,onMove:e=>I(a,e),onDelete:e=>L(a),onSave:e=>M(a,e),onEdit:e=>n.isEdit=!0,onAdd:e=>k(e,a,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","examAnswerRelationType","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===n.answerType?(s(),r(w,c({key:4,ref_for:!0},i(b),{"order-index":a,richTextContent:n.richTextContent,"is-set":n.hasSet||!1,"is-save":!n.isRealCanDel,"is-edit":n.isEdit||!1,"show-action":!e.isPreview,onMove:e=>I(a,e),onDelete:e=>L(a),examAnswerRelationType:n.examAnswerRelationType,onSave:e=>M(a,e),onEdit:e=>n.isEdit=!0,onAdd:e=>k(e,a,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===n.answerType?(s(),r(v,{"total-page":_(),key:a,"current-page-index":(e=>{const t=D.value.filter((e=>"page_end"===e.answerType));let s=0;return t.forEach(((t,n)=>{e===t.id&&(s=n+1)})),s})(n.id),item:n,"order-index":a,"is-edit":n.isEdit||!1,"is-set":n.hasSet||!1,"is-save":!n.isRealCanDel,examAnswerRelationType:n.examAnswerRelationType,onMove:e=>I(a,e),onDelete:e=>L(a),onSave:e=>M(a,e),onEdit:e=>n.isEdit=!0,onAdd:e=>k(e,a,null)},null,8,["total-page","current-page-index","item","order-index","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):d("v-if",!0)])))),128))])],2))}});export{S as default};
1
+ import{defineComponent as e,ref as t,useAttrs as s,watch as n,createElementBlock as i,openBlock as a,normalizeClass as o,unref as l,createElementVNode as r,Fragment as d,renderList as c,createBlock as m,createCommentVNode as x,mergeProps as u}from"vue";import p from"./components/subject-blank-fill.vue.mjs";import w from"./components/subject-scale.vue.mjs";import v from"./components/subject-single.vue.mjs";import y from"./components/subject-text-fill.vue.mjs";import h from"./components/SubjectRichText.vue.mjs";import T from"./components/SubjectPageEnd.vue.mjs";import{useNamespace as A}from"@qxs-bns/hooks";import{setGuid as R}from"@qxs-bns/utils";import{ElMessage as f}from"element-plus/es";const E={class:"subject-list-wrapper"};var S=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:S,emit:C}){const g=e,D=t([]),j=C,b=s();function _(){let e=0,t=!1;return D.value.map(((s,n,i)=>{"page_end"===s.answerType&&(e++,t=n===i.length-1)})),t?e:e+1}function k(e,t,s){console.log(t,"index"),t||0===t?D.value.splice(t+1,0,{customId:R(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s}):D.value.push({customId:R(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s})}function I(e,t){if("up"===t&&e>0){const[t]=D.value.splice(e,1);D.value.splice(e-1,0,t)}else if("down"===t&&e<D.value.length-1){const[t]=D.value.splice(e,1);D.value.splice(e+1,0,t)}}function M(e,t){for(let s=0;s<D.value.length;s++)e===s&&(D.value[e]={...D.value[e],...t,isEdit:!1,examAnswerRelationType:t.examAnswerRelationType})}function L(e){D.value.splice(e,1),f.success("删除成功")}function P(e,t){j("setRelation",e,t)}S({addSubject:k,currentList:D,uploadExcel:function(e){D.value=D.value.concat(e)},addExam:function(e){const t=[];e.answers?.map((e=>{t.push({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})})),D.value.push({...e,customId:R(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:t,isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1})},setAnswerRelation:function(e,t,s){e.length&&D.value?.map((n=>{n.customId===t&&n.answers?.map((t=>{t.customAnswerId===s&&(t.answerRelations=e)}))}))}}),n((()=>g.subjectList),(e=>{e&&(D.value=[...e])}),{immediate:!0});const q=A("subject-list");return(e,t)=>(a(),i("div",{class:o(l(q).e("list-exam"))},[r("div",E,[(a(!0),i(d,null,c(l(D),((t,s)=>(a(),i("div",{key:s+t.examId||t.title},[["single","multiple","sort"].includes(t.answerType)?(a(),m(v,u({key:0,ref_for:!0},l(b),{"order-index":s,title:t.title,type:t.answerType,"exam-id":t.examId,isKey:t.isKey,"is-save":!t.isRealCanDel,customId: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,answerCheckType:t.answerCheckType,"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onSetRelation:P,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:(e,t)=>k(e,s,t)}),null,16,["order-index","title","type","exam-id","isKey","is-save","customId","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answerCheckType","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===t.answerType?(a(),m(w,u({key:1,ref_for:!0},l(b),{"order-index":s,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,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(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","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===t.answerType?(a(),m(p,u({key:2,ref_for:!0},l(b),{"order-index":s,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,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(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","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===t.answerType?(a(),m(y,u({key:3,ref_for:!0},l(b),{"order-index":s,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||{},examAnswerRelationType:t.examAnswerRelationType,"exam-rich-text-content":t.examRichTextContent,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(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","examAnswerRelationType","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===t.answerType?(a(),m(h,u({key:4,ref_for:!0},l(b),{"order-index":s,richTextContent:t.richTextContent,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,onMove:e=>I(s,e),onDelete:e=>L(s),examAnswerRelationType:t.examAnswerRelationType,onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===t.answerType?(a(),m(T,{"total-page":_(),key:s,"current-page-index":(e=>{const t=D.value.filter((e=>"page_end"===e.answerType));let s=0;return t?.forEach(((t,n)=>{e===t.id&&(s=n+1)})),s})(t.id),item:t,"order-index":s,"is-edit":t.isEdit||!1,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)},null,8,["total-page","current-page-index","item","order-index","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):x("v-if",!0)])))),128))])],2))}});export{S as default};
2
2
  //# sourceMappingURL=subject-list.vue.mjs.map