@qxs-bns/components 0.0.46 → 0.0.48
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.
- package/es/index.css +83 -0
- package/es/package.json.mjs +1 -1
- package/es/src/data-chart/src/components/area.vue.mjs +1 -1
- package/es/src/data-chart/src/components/card.vue.mjs +1 -1
- package/es/src/data-chart/src/components/card.vue2.mjs +1 -1
- package/es/src/data-chart/src/components/card.vue2.mjs.map +1 -1
- package/es/src/data-chart/src/components/line.vue.mjs +1 -1
- package/es/src/data-chart/src/components/table.vue.mjs +1 -1
- package/es/src/data-chart/src/components/table.vue.mjs.map +1 -1
- package/es/src/file-upload/src/file-upload.vue.mjs +1 -1
- package/es/src/file-upload/src/file-upload.vue.mjs.map +1 -1
- package/es/src/image-upload/src/image-upload.vue.mjs +1 -1
- package/es/src/image-upload/src/image-upload.vue.mjs.map +1 -1
- package/es/src/subject-action/src/subject-action.vue.mjs +1 -1
- package/es/src/subject-action/src/subject-action.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs +1 -1
- package/es/src/subject-list/src/components/SubjectPageEnd.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-blank-fill.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-scale.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-scale.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-single.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-single.vue.mjs.map +1 -1
- package/es/src/subject-list/src/components/subject-text-fill.vue.mjs +1 -1
- package/es/src/subject-list/src/components/subject-text-fill.vue.mjs.map +1 -1
- package/es/src/subject-list/src/subject-list.vue.mjs +1 -1
- package/es/src/subject-list/src/subject-list.vue.mjs.map +1 -1
- package/es/src/tiny-mce-editor/index.mjs.map +1 -1
- package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +1 -1
- package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs.map +1 -1
- package/lib/index.css +83 -0
- package/lib/package.json.cjs +1 -1
- package/lib/src/data-chart/src/components/area.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/card.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/card.vue2.cjs +1 -1
- package/lib/src/data-chart/src/components/card.vue2.cjs.map +1 -1
- package/lib/src/data-chart/src/components/line.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/table.vue.cjs +1 -1
- package/lib/src/data-chart/src/components/table.vue.cjs.map +1 -1
- package/lib/src/file-upload/src/file-upload.vue.cjs +1 -1
- package/lib/src/file-upload/src/file-upload.vue.cjs.map +1 -1
- package/lib/src/image-upload/src/image-upload.vue.cjs +1 -1
- package/lib/src/image-upload/src/image-upload.vue.cjs.map +1 -1
- package/lib/src/subject-action/src/subject-action.vue.cjs +1 -1
- package/lib/src/subject-action/src/subject-action.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/SubjectPageEnd.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-blank-fill.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-scale.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-scale.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-single.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-single.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs +1 -1
- package/lib/src/subject-list/src/components/subject-text-fill.vue.cjs.map +1 -1
- package/lib/src/subject-list/src/subject-list.vue.cjs +1 -1
- package/lib/src/subject-list/src/subject-list.vue.cjs.map +1 -1
- package/lib/src/tiny-mce-editor/index.cjs.map +1 -1
- package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +1 -1
- package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs.map +1 -1
- package/package.json +5 -8
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/index.scss +13 -0
- package/theme-chalk/src/base.css +1 -0
- package/theme-chalk/src/base.scss +16 -0
- package/theme-chalk/src/common/element-plus.css +1 -0
- package/theme-chalk/src/common/element-plus.scss +606 -0
- package/theme-chalk/src/data-chart/empty.css +1 -0
- package/theme-chalk/src/data-chart/empty.scss +24 -0
- package/theme-chalk/src/data-chart/index.css +1 -0
- package/theme-chalk/src/data-chart/index.scss +9 -0
- package/theme-chalk/src/data-chart/table.css +1 -0
- package/theme-chalk/src/data-chart/table.scss +39 -0
- package/theme-chalk/src/file-upload.css +1 -0
- package/theme-chalk/src/file-upload.scss +34 -0
- package/theme-chalk/src/fixed-action-bar.css +1 -0
- package/theme-chalk/src/fixed-action-bar.scss +18 -0
- package/theme-chalk/src/image-upload.css +1 -0
- package/theme-chalk/src/image-upload.scss +135 -0
- package/theme-chalk/src/mixins/_var.css +0 -0
- package/theme-chalk/src/mixins/_var.scss +24 -0
- package/theme-chalk/src/mixins/config.css +0 -0
- package/theme-chalk/src/mixins/config.scss +14 -0
- package/theme-chalk/src/mixins/function.css +0 -0
- package/theme-chalk/src/mixins/function.scss +95 -0
- package/theme-chalk/src/mixins/mixins.css +0 -0
- package/theme-chalk/src/mixins/mixins.scss +103 -0
- package/theme-chalk/src/photo-crop-tool.css +1 -0
- package/theme-chalk/src/photo-crop-tool.scss +84 -0
- package/theme-chalk/{subject-action.css → src/subject-action.css} +1 -1
- package/theme-chalk/src/subject-action.scss +36 -0
- package/theme-chalk/src/subject-layout.css +1 -0
- package/theme-chalk/src/subject-layout.scss +28 -0
- package/theme-chalk/src/subject-list.css +1 -0
- package/theme-chalk/src/subject-list.scss +289 -0
- package/theme-chalk/src/subject-template.scss +5 -0
- package/theme-chalk/src/subject-type.css +1 -0
- package/theme-chalk/src/subject-type.scss +32 -0
- package/theme-chalk/src/tiny-mce-editor.css +1 -0
- package/theme-chalk/src/tiny-mce-editor.scss +27 -0
- package/types/src/image-upload/index.d.ts +3 -40
- package/types/src/image-upload/index.d.ts.map +1 -1
- package/types/src/image-upload/src/image-upload.vue.d.ts +11 -20
- package/types/src/image-upload/src/image-upload.vue.d.ts.map +1 -1
- package/types/src/subject-layout/src/subject-layout.vue.d.ts.map +1 -1
- package/types/src/tiny-mce-editor/index.d.ts +1 -1
- package/types/src/tiny-mce-editor/index.d.ts.map +1 -1
- package/types/src/tiny-mce-editor/src/tiny-mce-editor.vue.d.ts +19 -19
- package/types/src/tiny-mce-editor/src/tiny-mce-editor.vue.d.ts.map +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs +0 -2
- package/es/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs.map +0 -1
- package/es/src/data-chart/src/components/area.vue3.mjs +0 -2
- package/es/src/data-chart/src/components/area.vue3.mjs.map +0 -1
- package/es/src/data-chart/src/components/card.vue3.mjs +0 -2
- package/es/src/data-chart/src/components/card.vue3.mjs.map +0 -1
- package/es/src/data-chart/src/components/line.vue3.mjs +0 -2
- package/es/src/data-chart/src/components/line.vue3.mjs.map +0 -1
- package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.cjs +0 -2
- package/lib/node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.cjs.map +0 -1
- package/lib/src/data-chart/src/components/area.vue3.cjs +0 -2
- package/lib/src/data-chart/src/components/area.vue3.cjs.map +0 -1
- package/lib/src/data-chart/src/components/card.vue3.cjs +0 -2
- package/lib/src/data-chart/src/components/card.vue3.cjs.map +0 -1
- package/lib/src/data-chart/src/components/line.vue3.cjs +0 -2
- package/lib/src/data-chart/src/components/line.vue3.cjs.map +0 -1
- package/theme-chalk/base.css +0 -1
- package/theme-chalk/file-upload.css +0 -1
- package/theme-chalk/fixed-action-bar.css +0 -1
- package/theme-chalk/image-upload.css +0 -1
- package/theme-chalk/photo-crop-tool.css +0 -1
- package/theme-chalk/src/base.scss.js +0 -4
- package/theme-chalk/src/base.scss.js.map +0 -1
- package/theme-chalk/src/file-upload.scss.js +0 -4
- package/theme-chalk/src/file-upload.scss.js.map +0 -1
- package/theme-chalk/src/fixed-action-bar.scss.js +0 -4
- package/theme-chalk/src/fixed-action-bar.scss.js.map +0 -1
- package/theme-chalk/src/image-upload.scss.js +0 -4
- package/theme-chalk/src/image-upload.scss.js.map +0 -1
- package/theme-chalk/src/index.scss.js +0 -4
- package/theme-chalk/src/index.scss.js.map +0 -1
- package/theme-chalk/src/photo-crop-tool.scss.js +0 -4
- package/theme-chalk/src/photo-crop-tool.scss.js.map +0 -1
- package/theme-chalk/src/subject-action.scss.js +0 -4
- package/theme-chalk/src/subject-action.scss.js.map +0 -1
- package/theme-chalk/src/subject-layout.scss.js +0 -4
- package/theme-chalk/src/subject-layout.scss.js.map +0 -1
- package/theme-chalk/src/subject-list.scss.js +0 -4
- package/theme-chalk/src/subject-list.scss.js.map +0 -1
- package/theme-chalk/src/subject-template.scss.js +0 -4
- package/theme-chalk/src/subject-template.scss.js.map +0 -1
- package/theme-chalk/src/subject-type.scss.js +0 -4
- package/theme-chalk/src/subject-type.scss.js.map +0 -1
- package/theme-chalk/src/tiny-mce-editor.scss.js +0 -4
- package/theme-chalk/src/tiny-mce-editor.scss.js.map +0 -1
- package/theme-chalk/subject-layout.css +0 -1
- package/theme-chalk/subject-list.css +0 -1
- package/theme-chalk/subject-type.css +0 -1
- package/theme-chalk/tiny-mce-editor.css +0 -1
- /package/theme-chalk/{subject-template.css → src/subject-template.css} +0 -0
@@ -1,2 +1,2 @@
|
|
1
|
-
import{ElInput as e,ElIcon as l,ElLink as t,ElRow as
|
1
|
+
import{ElInput as e,ElIcon as l,ElLink as t,ElRow as s,ElCol as n,ElRadio as a}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/link/style/index";import"element-plus/es/components/icon/style/index";import"element-plus/es/components/input/style/index";import"element-plus/es/components/radio/style/index";import"element-plus/es/components/row/style/index";import"element-plus/es/components/col/style/index";import{defineComponent as i,useAttrs as o,ref as u,computed as r,onMounted as d,createElementBlock as c,openBlock as p,normalizeClass as m,unref as v,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 U={class:"preview"},M={class:"title"},E={key:0},O=["innerHTML"],Q={class:"answer-radio 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),se=u(""),ne=u([]),ae=r((()=>Math.ceil(24/(Y.value.length+1))));function ie(){5!==Y.value.length&&Y.value.push({title:""})}function oe(){te.value=!1,se.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?(ne.value=le.value.split("\n").filter((e=>e)),W("save",{title:Z.value,answers:Y.value,analysis:ee.value,scaleQuestionList:ne.value,examRichTextContent:te.value?se.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&&(ne.value=K.scaleQuestionList,le.value=ne.value.join("\n")),K.examRichTextContent&&(se.value=K.examRichTextContent,te.value=!0)}));const re=T("subject-scale");return(i,o)=>{const u=n,r=s,d=a,T=e,_=l,J=t;return p(),c("div",{class:m(v(re).e("scale-exam"))},[f(A,{"show-edit":i.isEdit},{preview:x((()=>[w("div",U,[w("div",null,[w("span",M,C(i.orderIndex+1)+"."+C(v(Z))+"(量表题)",1),v(te)?(p(),c("div",E,[w("div",{innerHTML:v(se),class:"rich-text"},null,8,O)])):h("v-if",!0)]),w("div",Q,[f(r,{style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:v(ae)},null,8,["span"]),(p(!0),c(g,null,j(v(Y),(e=>(p(),y(u,{key:e.title,class:"flex flex-center",span:v(ae)},{default:x((()=>[w("span",null,C(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(p(!0),c(g,null,j(v(ne),(e=>(p(),y(r,{key:e,style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:v(ae),class:"flex flex-center"},{default:x((()=>[w("span",null,C(e),1)])),_:2},1032,["span"]),(p(!0),c(g,null,j(v(Y).length,(e=>(p(),y(u,{key:e,class:"radio-item flex flex-center",span:v(ae)},{default:x((()=>[f(d,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:x((()=>[w("div",{class:m(["flex",[{"margin-bottom":v(te)}]])},[o[10]||(o[10]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"题目:")],-1)),w("div",B,[f(T,{modelValue:v(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:v(le),"onUpdate:modelValue":o[1]||(o[1]=e=>b(le)?le.value=e:null),type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),w("div",I,[(p(!0),c(g,null,j(v(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(v(V),{class:m([{disabled:5===v(Y).length}]),onClick:ie},null,8,["class"])])),_:1}),f(_,{class:"icon"},{default:x((()=>[f(v(q),{class:m([{disabled:v(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:v(ee),"onUpdate:modelValue":o[2]||(o[2]=e=>b(ee)?ee.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),v(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":v(se),"onUpdate:modelValue":o[3]||(o[3]=e=>b(se)?se.value=e:null)},v(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\" class=\"rich-text\"/>\n </div>\n </div>\n <div class=\"answer-radio 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=\"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","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MAAQL,GAAkBK,MAAMmB,KAAK,OAE5CrC,EAAMkC,sBACRtB,GAASM,MAAQlB,EAAMkC,oBACvBvB,GAAaO,OAAQ,EACvB,IAII,MAAAoB,GAAKC,EAAa,oiFArExB,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\" class=\"rich-text\"/>\n </div>\n </div>\n <div class=\"answer-radio 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=\"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":"4kEAWA,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,oiFArExB,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,ElMessage as u}from"element-plus/es";import{defineComponent as d,useAttrs as m,ref as p,computed as c,watch as v,onMounted as y,createElementBlock as f,openBlock as x,normalizeClass as w,unref as h,createVNode as C,createSlots as g,withCtx as b,createBlock as k,createCommentVNode as S,createElementVNode as A,createTextVNode as V,toDisplayString as T,Fragment as q,renderList as R,isRef as j,mergeProps as I}from"vue";import{CirclePlus as _,Remove as E}from"@element-plus/icons-vue";import{useNamespace as U}from"@qxs-bns/hooks";import K from"../../../subject-action/src/subject-action.vue.mjs";import B from"../../../subject-layout/src/subject-layout.vue.mjs";import L from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{setGuid as $}from"@qxs-bns/utils";const N={class:"preview"},O={class:"title"},z={key:0},M={key:1},D={key:0},H=["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:"label flex flex-justify-center"},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=d({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(d,{emit:se}){const ne=d,re=se,oe=m(),ue=p(0),de=p(ne.isKey),me=p(1),pe=p(ne.examAnswerRelationType),ce=p([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),ve=p(2),ye=p(""),fe=p(""),xe=p(!1),we=p(""),he=p(0),Ce=p(!1),ge=p(""),be=c((()=>"single"===ne.type?"单选题":"multiple"===ne.type?"多选题":"排序题")),ke=p([]),Se=c((()=>{const e=[];for(let l=ce.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Ae(){ne.isSave||ce.value.push({title:"",isCorrect:!1,customAnswerId:$()})}function Ve(){xe.value=!1,we.value=""}function Te(){if(!ye.value)return void u.error("题目标题不能为空!");if(!me.value)return void u.error("请选择答题设置");let e="",l=!1,t=0;if("multiple"===ne.type||"single"===ne.type?ce.value.forEach(((a,i)=>{a.title?.trim()||(e+=`选项${String.fromCharCode(65+i)}未填写。`),a.isCorrect&&(l=!0,t++),a.relationType=a.resultItem?1:a.answerRelations?.length?2:null})):"sort"===ne.type&&ke.value.length&&(l=!0),e)return void u.error(e);if(new Set(ce.value.map((e=>e.title))).size===ce.value.length){if("multiple"===ne.type){if(1===t)return void u.error("请至少设置两个支持选项");if(l&&t<ve.value)return void u.error("至少选几项与支持选项数不符")}2!==me.value&&3!==me.value||l?re("save",{title:ye.value,answers:ce.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:pe.value,isKey:de.value,answerCheckType:me.value}):u.error("请设置支持选项")}else u.error("选项不能重复")}function qe(){ce.value[ue.value].resultItem=ge.value||"",Ce.value=!1}function Re(){Ce.value=!1,ge.value=""}function je(e){de.value=e}function Ie(e){me.value=e}function _e(e,l){re("add",e,l?ne.examAnswerRelationType:null)}v((()=>ne.isEdit),(()=>{ne.isEdit&&(he.value=(new Date).getTime())}));const Ee=c((()=>e=>{let l=0;return e.forEach((e=>{e.relationAnswers&&(l+=e.relationAnswers.length)})),l})),Ue=U("subject-single");return y((function(){if(ne.title&&(ye.value=ne.title),ne.answerCheckType&&(me.value=ne.answerCheckType),ne.isKey&&(de.value=ne.isKey),ne.examAnswerRelationType&&(pe.value=ne.examAnswerRelationType),ne.answerList&&ne.answerList.length&&(ce.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,p=l,c=t,v=i,y=a,U=s,se=n,he=o,Ke=r;return x(),f("div",{class:w(h(Ue).e("single-exam"))},[C(B,{"show-edit":u.isEdit},g({preview:b((()=>[A("div",N,[A("div",null,[A("span",O,[V(T(u.orderIndex+1)+"."+T(h(ye))+" ",1),"single"===u.type?(x(),f("span",z,"(单选题)")):["multiple","sort"].includes(u.type)?(x(),f("span",M," ("+T(h(be))+T(h(ve)?`至少选${h(ve)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):S("v-if",!0)])]),h(xe)?(x(),f("div",D,[A("div",{innerHTML:h(we),class:"rich-text"},null,8,H)])):S("v-if",!0),A("div",Q,["sort"===u.type?(x(!0),f(q,{key:0},R(h(ce),((e,l)=>(x(),k(m,{key:l,class:"radio",disabled:!0},{default:b((()=>[A("span",F,T(String.fromCharCode(65+l))+". ",1),V(" "+T(e.title),1)])),_:2},1024)))),128)):(x(!0),f(q,{key:1},R(h(ce),((e,l)=>(x(),k(p,{key:l,class:"radio",value:"disabled",disabled:""},{default:b((()=>[A("span",G,T(String.fromCharCode(65+l))+". ",1),V(" "+T(e.title)+" "+T(e.isCorrect?"(支持选项)":"")+" "+T(1===h(pe)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+T(2===h(pe)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:b((()=>[u.showAction?(x(),k(K,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:h(de),showOtherOption:"multiple"===ne.type||"single"===ne.type,examAnswerRelationType:ne.examAnswerRelationType,answerCheckType:h(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:_e,onOnShowRichText:d[9]||(d[9]=e=>xe.value=!0),onSetKey:je,onSetAnswerSetting:Ie},null,8,["is-edit","is-set","isKey","showOtherOption","examAnswerRelationType","answerCheckType"])):S("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:b((()=>[A("div",{class:w(["flex",[{"margin-bottom":h(xe)}]])},[d[12]||(d[12]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"题目:")],-1)),A("div",J,[C(c,{modelValue:h(ye),"onUpdate:modelValue":d[0]||(d[0]=e=>j(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:`【${h(be)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),A("div",P,[d[13]||(d[13]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(x(),k(y,{key:0,modelValue:h(ve),"onUpdate:modelValue":d[1]||(d[1]=e=>j(ve)?ve.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:b((()=>[(x(!0),f(q,null,R(h(Se),(e=>(x(),k(v,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):S("v-if",!0)]),A("div",W,[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),f("div",{key:l,class:"answer-item flex flex-items-center"},[A("span",X,T(String.fromCharCode(65+l))+".",1),C(c,{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)?(x(),k(m,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":l=>e.isCorrect=l,class:w([{"is-correct":e.isCorrect}]),disabled:u.isSave,style:{"margin-left":"10px"},onChange:l=>function(e,l){"single"===ne.type?(l&&ce.value.forEach((l=>{l!==e&&(l.isCorrect=!1)})),e.isCorrect=l):"multiple"===ne.type&&(e.isCorrect=l)}(e,l)},{default:b((()=>[...d[14]||(d[14]=[V(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):S("v-if",!0),C(U,{class:"icon"},{default:b((()=>[C(h(_),{class:w([{disabled:u.isSave}]),onClick:Ae},null,8,["class"])])),_:1}),C(U,{class:"icon"},{default:b((()=>[C(h(E),{class:w([{disabled:h(ce).length<3||u.isSave}]),onClick:e=>function(e){ce.value.length<3||ne.isSave||ce.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024),1===h(pe)&&"sort"!==u.type?(x(),k(se,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,ge.value=ce.value[t].resultItem||"",void(Ce.value=!0);var t}},{default:b((()=>[A("span",null,T(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):S("v-if",!0),2===h(pe)&&"sort"!==u.type?(x(),k(se,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){e.customAnswerId=e.examAnswerId||$(),re("setRelation",ne.customId,e)}(e)},{default:b((()=>[A("span",null,T(e.answerRelations?.length?`关联了${h(Ee)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):S("v-if",!0)])))),128))]),"sort"===u.type?(x(),f("div",Y,[d[15]||(d[15]=A("div",{class:"label flex flex-justify-end"},[A("span",null,"排序答案:")],-1)),A("div",Z,[C(y,{modelValue:h(ke),"onUpdate:modelValue":d[2]||(d[2]=e=>j(ke)?ke.value=e:null),multiple:"",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:b((()=>[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),k(v,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):S("v-if",!0),u.showAnalysis?(x(),f("div",ee,[d[16]||(d[16]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"解析:")],-1)),A("div",le,[C(c,{modelValue:h(fe),"onUpdate:modelValue":d[3]||(d[3]=e=>j(fe)?fe.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):S("v-if",!0),h(xe)?(x(),f("div",te,[d[18]||(d[18]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"富文本:")],-1)),A("div",ae,[C(L,I({"model-value":h(we),"onUpdate:modelValue":d[4]||(d[4]=e=>j(we)?we.value=e:null)},h(oe),{style:{width:"100%"}}),null,16,["model-value"]),A("div",ie,[C(se,{type:"danger",onClick:Ve},{default:b((()=>d[17]||(d[17]=[V(" 删除富文本 ")]))),_:1})])])])):S("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),C(Ke,{modelValue:h(Ce),"onUpdate:modelValue":d[11]||(d[11]=e=>j(Ce)?Ce.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:b((()=>[C(he,{class:"customize-button",type:"primary",plain:"",onClick:Re},{default:b((()=>d[19]||(d[19]=[V(" 取消 ")]))),_:1}),C(he,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:b((()=>d[20]||(d[20]=[V(" 保存 ")]))),_:1})])),default:b((()=>[(x(),k(L,I({key:h(ue),"model-value":h(ge),"onUpdate:modelValue":d[10]||(d[10]=e=>j(ge)?ge.value=e:null)},h(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 s,ElOption as a,ElIcon as n,ElLink as i,ElDialog as o,ElButton as r,ElMessage as u}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/dialog/style/index";import"element-plus/es/components/button/style/index";import"element-plus/es/components/link/style/index";import"element-plus/es/components/icon/style/index";import"element-plus/es/components/select/style/index";import"element-plus/es/components/option/style/index";import"element-plus/es/components/input/style/index";import"element-plus/es/components/radio/style/index";import"element-plus/es/components/checkbox/style/index";import{defineComponent as d,useAttrs as m,ref as p,computed as c,watch as v,onMounted as y,createElementBlock as f,openBlock as x,normalizeClass as w,unref as h,createVNode as C,createSlots as g,withCtx as b,createBlock as k,createCommentVNode as S,createElementVNode as A,createTextVNode as V,toDisplayString as T,Fragment as q,renderList as R,isRef as j,mergeProps as I}from"vue";import{CirclePlus as _,Remove as E}from"@element-plus/icons-vue";import{useNamespace as U}from"@qxs-bns/hooks";import K from"../../../subject-action/src/subject-action.vue.mjs";import B from"../../../subject-layout/src/subject-layout.vue.mjs";import L from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.mjs";import{setGuid as $}from"@qxs-bns/utils";import"element-plus/es/components/message/style/index";const N={class:"preview"},O={class:"title"},z={key:0},M={key:1},D={key:0},H=["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:"label flex flex-justify-center"},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"},se={style:{flex:"1"}},ae={class:"flex flex-justify-end"};var ne=d({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(d,{emit:ne}){const ie=d,oe=ne,re=m(),ue=p(0),de=p(ie.isKey),me=p(1),pe=p(ie.examAnswerRelationType),ce=p([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),ve=p(2),ye=p(""),fe=p(""),xe=p(!1),we=p(""),he=p(0),Ce=p(!1),ge=p(""),be=c((()=>"single"===ie.type?"单选题":"multiple"===ie.type?"多选题":"排序题")),ke=p([]),Se=c((()=>{const e=[];for(let l=ce.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Ae(){ie.isSave||ce.value.push({title:"",isCorrect:!1,customAnswerId:$()})}function Ve(){xe.value=!1,we.value=""}function Te(){if(!ye.value)return void u.error("题目标题不能为空!");if(!me.value)return void u.error("请选择答题设置");let e="",l=!1,t=0;if("multiple"===ie.type||"single"===ie.type?ce.value.forEach(((s,a)=>{s.title?.trim()||(e+=`选项${String.fromCharCode(65+a)}未填写。`),s.isCorrect&&(l=!0,t++),s.relationType=s.resultItem?1:s.answerRelations?.length?2:null})):"sort"===ie.type&&ke.value.length&&(l=!0),e)return void u.error(e);if(new Set(ce.value.map((e=>e.title))).size===ce.value.length){if("multiple"===ie.type){if(1===t)return void u.error("请至少设置两个支持选项");if(l&&t<ve.value)return void u.error("至少选几项与支持选项数不符")}2!==me.value&&3!==me.value||l?oe("save",{title:ye.value,answers:ce.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:pe.value,isKey:de.value,answerCheckType:me.value}):u.error("请设置支持选项")}else u.error("选项不能重复")}function qe(){ce.value[ue.value].resultItem=ge.value||"",Ce.value=!1}function Re(){Ce.value=!1,ge.value=""}function je(e){de.value=e}function Ie(e){me.value=e}function _e(e,l){oe("add",e,l?ie.examAnswerRelationType:null)}v((()=>ie.isEdit),(()=>{ie.isEdit&&(he.value=(new Date).getTime())}));const Ee=c((()=>e=>{let l=0;return e.forEach((e=>{e.relationAnswers&&(l+=e.relationAnswers.length)})),l})),Ue=U("subject-single");return y((function(){if(ie.title&&(ye.value=ie.title),ie.answerCheckType&&(me.value=ie.answerCheckType),ie.isKey&&(de.value=ie.isKey),ie.examAnswerRelationType&&(pe.value=ie.examAnswerRelationType),ie.answerList&&ie.answerList.length&&(ce.value=ie.answerList),ie.leastAnswerCount&&(ve.value=ie.leastAnswerCount),ie.examExpand&&ie.examExpand){const e=ie.examExpand.split(",");ke.value=e.map((e=>{const l=ie.answerList.find((l=>l.answerId?.toString()===e));return l?String.fromCharCode(65+l.orderIndex-1):e})).filter(Boolean)}ie.analysis&&(fe.value=ie.analysis),ie.examRichTextContent&&(we.value=ie.examRichTextContent,xe.value=!0)})),(u,d)=>{const m=e,p=l,c=t,v=a,y=s,U=n,ne=i,he=r,Ke=o;return x(),f("div",{class:w(h(Ue).e("single-exam"))},[C(B,{"show-edit":u.isEdit},g({preview:b((()=>[A("div",N,[A("div",null,[A("span",O,[V(T(u.orderIndex+1)+"."+T(h(ye))+" ",1),"single"===u.type?(x(),f("span",z,"(单选题)")):["multiple","sort"].includes(u.type)?(x(),f("span",M," ("+T(h(be))+T(h(ve)?`至少选${h(ve)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):S("v-if",!0)])]),h(xe)?(x(),f("div",D,[A("div",{innerHTML:h(we),class:"rich-text"},null,8,H)])):S("v-if",!0),A("div",Q,["sort"===u.type?(x(!0),f(q,{key:0},R(h(ce),((e,l)=>(x(),k(m,{key:l,class:"radio",disabled:!0},{default:b((()=>[A("span",F,T(String.fromCharCode(65+l))+". ",1),V(" "+T(e.title),1)])),_:2},1024)))),128)):(x(!0),f(q,{key:1},R(h(ce),((e,l)=>(x(),k(p,{key:l,class:"radio",value:"disabled",disabled:""},{default:b((()=>[A("span",G,T(String.fromCharCode(65+l))+". ",1),V(" "+T(e.title)+" "+T(e.isCorrect?"(支持选项)":"")+" "+T(1===h(pe)?e.resultItem?"(已设置结果项)":"(未设置结果项)":"")+" "+T(2===h(pe)?e.answerRelations?.length?"(已设置关联)":"(未设置关联)":""),1)])),_:2},1024)))),128))])])])),default:b((()=>[u.showAction?(x(),k(K,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:h(de),showOtherOption:"multiple"===ie.type||"single"===ie.type,examAnswerRelationType:ie.examAnswerRelationType,answerCheckType:h(me),onMoveUp:d[5]||(d[5]=e=>oe("move","up")),onMoveDown:d[6]||(d[6]=e=>oe("move","down")),onDelete:d[7]||(d[7]=e=>oe("delete")),onSave:Te,onEdit:d[8]||(d[8]=e=>oe("edit")),onAdd:_e,onOnShowRichText:d[9]||(d[9]=e=>xe.value=!0),onSetKey:je,onSetAnswerSetting:Ie},null,8,["is-edit","is-set","isKey","showOtherOption","examAnswerRelationType","answerCheckType"])):S("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:b((()=>[A("div",{class:w(["flex",[{"margin-bottom":h(xe)}]])},[d[12]||(d[12]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"题目:")],-1)),A("div",J,[C(c,{modelValue:h(ye),"onUpdate:modelValue":d[0]||(d[0]=e=>j(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:`【${h(be)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),A("div",P,[d[13]||(d[13]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(x(),k(y,{key:0,modelValue:h(ve),"onUpdate:modelValue":d[1]||(d[1]=e=>j(ve)?ve.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:b((()=>[(x(!0),f(q,null,R(h(Se),(e=>(x(),k(v,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","disabled"])):S("v-if",!0)]),A("div",W,[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),f("div",{key:l,class:"answer-item flex flex-items-center"},[A("span",X,T(String.fromCharCode(65+l))+".",1),C(c,{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)?(x(),k(m,{key:0,modelValue:e.isCorrect,"onUpdate:modelValue":l=>e.isCorrect=l,class:w([{"is-correct":e.isCorrect}]),disabled:u.isSave,style:{"margin-left":"10px"},onChange:l=>function(e,l){"single"===ie.type?(l&&ce.value.forEach((l=>{l!==e&&(l.isCorrect=!1)})),e.isCorrect=l):"multiple"===ie.type&&(e.isCorrect=l)}(e,l)},{default:b((()=>[...d[14]||(d[14]=[V(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):S("v-if",!0),C(U,{class:"icon"},{default:b((()=>[C(h(_),{class:w([{disabled:u.isSave}]),onClick:Ae},null,8,["class"])])),_:1}),C(U,{class:"icon"},{default:b((()=>[C(h(E),{class:w([{disabled:h(ce).length<3||u.isSave}]),onClick:e=>function(e){ce.value.length<3||ie.isSave||ce.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024),1===h(pe)&&"sort"!==u.type?(x(),k(ne,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,ge.value=ce.value[t].resultItem||"",void(Ce.value=!0);var t}},{default:b((()=>[A("span",null,T(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):S("v-if",!0),2===h(pe)&&"sort"!==u.type?(x(),k(ne,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){e.customAnswerId=e.examAnswerId||$(),oe("setRelation",ie.customId,e)}(e)},{default:b((()=>[A("span",null,T(e.answerRelations?.length?`关联了${h(Ee)(e.answerRelations)}项`:"关联检查"),1)])),_:2},1032,["onClick"])):S("v-if",!0)])))),128))]),"sort"===u.type?(x(),f("div",Y,[d[15]||(d[15]=A("div",{class:"label flex flex-justify-end"},[A("span",null,"排序答案:")],-1)),A("div",Z,[C(y,{modelValue:h(ke),"onUpdate:modelValue":d[2]||(d[2]=e=>j(ke)?ke.value=e:null),multiple:"",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:b((()=>[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),k(v,{key:l,label:e.title,value:String.fromCharCode(65+l)},null,8,["label","value"])))),128))])),_:1},8,["modelValue"])])])):S("v-if",!0),u.showAnalysis?(x(),f("div",ee,[d[16]||(d[16]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"解析:")],-1)),A("div",le,[C(c,{modelValue:h(fe),"onUpdate:modelValue":d[3]||(d[3]=e=>j(fe)?fe.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):S("v-if",!0),h(xe)?(x(),f("div",te,[d[18]||(d[18]=A("div",{class:"label flex flex-justify-center"},[A("span",null,"富文本:")],-1)),A("div",se,[C(L,I({"model-value":h(we),"onUpdate:modelValue":d[4]||(d[4]=e=>j(we)?we.value=e:null)},h(re),{style:{width:"100%"}}),null,16,["model-value"]),A("div",ae,[C(ne,{type:"danger",onClick:Ve},{default:b((()=>d[17]||(d[17]=[V(" 删除富文本 ")]))),_:1})])])])):S("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),C(Ke,{modelValue:h(Ce),"onUpdate:modelValue":d[11]||(d[11]=e=>j(Ce)?Ce.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:b((()=>[C(he,{class:"customize-button",type:"primary",plain:"",onClick:Re},{default:b((()=>d[19]||(d[19]=[V(" 取消 ")]))),_:1}),C(he,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:b((()=>d[20]||(d[20]=[V(" 保存 ")]))),_:1})])),default:b((()=>[(x(),k(L,I({key:h(ue),"model-value":h(ge),"onUpdate:modelValue":d[10]||(d[10]=e=>j(ge)?ge.value=e:null)},h(re),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});export{ne 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'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(props.isKey)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(props.examAnswerRelationType)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref(2)\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n } else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n // 答题设置必选\n if(!answerCheckType.value) {\n ElMessage.error('请选择答题设置')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n v.relationType = v.resultItem ? 1 : (v.answerRelations?.length ? 2 : null)\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n } \n\n if(answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" class=\"rich-text\"/>\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=\"label flex flex-justify-center\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div 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 multiple\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div 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 :showOtherOption=\"props.type === 'multiple' || props.type === 'single'\"\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","trim","String","fromCharCode","relationType","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","examAnswerId","customId"],"mappings":"urEAWA,MAAMA,GAAQC,EAoBRC,GAAQC,GAERC,GAAQC,IAERC,GAAeC,EAAI,GACnBC,GAAQD,EAAIP,GAAMQ,OAClBC,GAAkBF,EAAI,GACtBG,GAAyBH,EAAIP,GAAMU,wBACnCC,GAAUJ,EAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,KAGPC,GAAmBP,EAAI,GACvBK,GAAQL,EAAI,IACZQ,GAAWR,EAAI,IACfS,GAAeT,GAAI,GACnBU,GAAWV,EAAI,IACfW,GAAYX,EAAI,GAChBY,GAAkBZ,GAAI,GACtBa,GAAab,EAAY,IACzBc,GAAmBC,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,C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B,MAAMqB,EAAsB/E,GAAM0D,WAAWsB,MAAM,KAGnDxD,GAAUI,MAAQmD,EAAoB1B,KAAK4B,IACnC,MAAAC,EAASlF,GAAM8E,WAAWK,MAAM7B,GAAcA,EAAK8B,UAAUC,aAAeJ,IAClF,OAAOC,EAASlC,OAAOC,aAAa,GAAKiC,EAAOzB,WAAa,GAAKwB,CAAA,IACjEK,OAAOC,QAAO,CAIjBvF,GAAMe,WACRA,GAASa,MAAQ5B,GAAMe,UAGrBf,GAAM6D,sBACR5C,GAASW,MAAQ5B,GAAM6D,oBACvB7C,GAAaY,OAAQ,EACvB,uqGAtJO,SAAW4D,EAASC,GACR,WAAfzF,GAAMuB,MAEJkE,GACM9E,GAAAiB,MAAMgB,SAASsC,IACjBA,IAAWM,IACbN,EAAOrE,WAAY,EAAA,IAIzB2E,EAAG3E,UAAY4E,GACS,aAAfzF,GAAMuB,OAEfiE,EAAG3E,UAAY4E,EACjB,gXArBF,SAAsBjC,GAChB7C,GAAQiB,MAAMC,OAAS,GAAK7B,GAAMkC,QAG9BvB,GAAAiB,MAAM8D,OAAOlC,EAAO,EAAC,qJA2JTV,IACpBxC,GAAasB,MAAQkB,EACrB1B,GAAWQ,MAAQjB,GAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,GAAgBS,OAAQ,GAH1B,IAAsBkB,yMAxItB,SAAqBQ,GACdA,EAAAnB,eAAiBmB,EAAKqC,cAAgBvD,IACrClC,GAAA,cAAeF,GAAM4F,SAAUtC,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'\n\ndefineOptions({\n name: 'QxsSubjectSingle',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n type: 'single' | 'multiple' | 'sort'\n isEdit: boolean\n isSet: boolean\n answerList?: any\n leastAnswerCount?: number\n analysis?: string\n examExpand?: string\n examRichTextContent?: string\n showAnalysis?: boolean\n examAnswerRelationType?: number\n customId?: number\n examId?: number\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(props.isKey)\nconst answerCheckType = ref(1)\nconst examAnswerRelationType = ref(props.examAnswerRelationType)\nconst answers = ref<{\n title: string\n isCorrect: boolean\n orderIndex?: number\n resultItem?: string\n customAnswerId?: string\n answerRelations?: {\n relationExamId: number\n relationAnswers: {\n relationAnswerId: number\n relationAnswerIndex: number\n }[]\n }[]\n}[]>([{\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}, {\n title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref(2)\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个支持选项\n if (event) {\n answers.value.forEach((answer: any) => {\n if (answer !== it) {\n answer.isCorrect = false\n }\n })\n }\n it.isCorrect = event\n } else if (props.type === 'multiple') {\n // 多选题:可以有多个支持选项\n it.isCorrect = event\n }\n}\nfunction setRelation(item: any) {\n item.customAnswerId = item.examAnswerId || setGuid()\n emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n // 答题设置必选\n if(!answerCheckType.value) {\n ElMessage.error('请选择答题设置')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n v.relationType = v.resultItem ? 1 : (v.answerRelations?.length ? 2 : null)\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了支持选项\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个支持选项')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与支持选项数不符')\n return\n }\n } \n\n if(answerCheckType.value === 2 || answerCheckType.value === 3) {\n // 必须有设置支持选项\n if (!isSetCorrectAnswer) {\n ElMessage.error('请设置支持选项')\n return\n }\n }\n\n emits('save', {\n title: title.value,\n answers: answers.value.map((item: any, index: number) => {\n return { ...item, orderIndex: index + 1 }\n }),\n examExpand: orderList.value.map((i: string) => i.charCodeAt(0) - 65 + 1).join(','),\n analysis: analysis.value,\n isSetCorrectAnswer,\n leastAnswerCount: leastAnswerCount.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n examAnswerRelationType: examAnswerRelationType.value,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.examAnswerRelationType) {\n examAnswerRelationType.value = props.examAnswerRelationType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.leastAnswerCount) {\n leastAnswerCount.value = props.leastAnswerCount\n }\n\n if (props.examExpand) {\n // 设置支持选项 props.examExpand里是答案id\n if (props.examExpand) {\n const correctAnswerIdList = props.examExpand.split(',')\n\n // 遍历 correctAnswerIdList,直接在 props.answerList 中查找对应的 orderIndex 并转换成字母\n orderList.value = correctAnswerIdList.map((id: string) => {\n const answer = props.answerList.find((item: any) => item.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean) // 过滤掉任何可能的空字符串\n }\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n resultItem.value = answers.value[i].resultItem || ''\n showRichContent.value = true\n}\n\nfunction onSaveResult() {\n answers.value[answersIndex.value].resultItem = resultItem.value || ''\n showRichContent.value = false\n}\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\nfunction setKey(key: boolean) {\n isKey.value = key\n}\nfunction setAnswerSetting(type: number) {\n answerCheckType.value = type\n}\n\nfunction add(type: string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n// 监听isEdit\nwatch(() => props.isEdit, () => {\n if (props.isEdit) {\n startTime.value = new Date().getTime()\n }\n})\n\nconst relationLength = computed(() => {\n return (v: any) => {\n let count = 0\n v.forEach((item: any) => {\n if (item.relationAnswers) {\n count += item.relationAnswers.length\n }\n })\n return count\n }\n})\n\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" class=\"rich-text\"/>\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=\"label flex flex-justify-center\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event: any) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2 && type !== 'sort'\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${relationLength(item.answerRelations)}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div 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 multiple\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div 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 :showOtherOption=\"props.type === 'multiple' || props.type === 'single'\"\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","trim","String","fromCharCode","relationType","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onSaveResult","onCloseResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","relationLength","relationAnswers","ns","useNamespace","onMounted","answerList","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","examAnswerId","customId"],"mappings":"owFAWA,MAAMA,GAAQC,EAoBRC,GAAQC,GAERC,GAAQC,IAERC,GAAeC,EAAI,GACnBC,GAAQD,EAAIP,GAAMQ,OAClBC,GAAkBF,EAAI,GACtBG,GAAyBH,EAAIP,GAAMU,wBACnCC,GAAUJ,EAaX,CAAC,CACJK,MAAO,GACPC,WAAW,GACV,CACDD,MAAO,GACPC,WAAW,GACV,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AAM8D,OAAOlC,EAAO,EAAC,qJA2JTV,IACpBxC,GAAasB,MAAQkB,EACrB1B,GAAWQ,MAAQjB,GAAQiB,MAAMkB,GAAG1B,YAAc,QAClDD,GAAgBS,OAAQ,GAH1B,IAAsBkB,yMAxItB,SAAqBQ,GACdA,EAAAnB,eAAiBmB,EAAKqC,cAAgBvD,IACrClC,GAAA,cAAeF,GAAM4F,SAAUtC,EAAI"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{ElInput as e,ElInputNumber as l,ElCheckboxGroup as t,ElCheckbox as
|
1
|
+
import{ElInput as e,ElInputNumber as l,ElCheckboxGroup as t,ElCheckbox as s,ElTag as n,ElButton as i,ElIcon as a,ElLink as o}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/link/style/index";import"element-plus/es/components/button/style/index";import"element-plus/es/components/icon/style/index";import"element-plus/es/components/tag/style/index";import"element-plus/es/components/checkbox-group/style/index";import"element-plus/es/components/input-number/style/index";import"element-plus/es/components/input/style/index";import"element-plus/es/components/checkbox/style/index";import{defineComponent as u,useAttrs as r,ref as d,onMounted as m,createElementBlock as p,openBlock as c,normalizeClass as v,unref as x,createVNode as f,withCtx as y,createBlock as w,createCommentVNode as g,createElementVNode as h,isRef as b,Fragment as k,renderList as V,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 se=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:se}){const ne=u,ie=se,ae=r(),oe=d([{title:"",tag:"",showInput:!1}]),ue=d(""),re=d(""),de=d(),me=d(""),pe=d(!1),ce=d(""),ve=[{label:"答案不分顺序",value:"isInOrder"},{label:"忽略大小写",value:"isIgnoreCase"}],xe=d(["isInOrder","isIgnoreCase"]);function fe(){oe.value.push({title:"",tag:"",showInput:!1})}function ye(){pe.value=!1,ce.value=""}function we(){if(ue.value){if(de.value||me.value){if(!de.value)return void _.error("请完善答题设置!");if(!me.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(","))}ie("save",{title:ue.value,answers:oe.value.filter((e=>e.title)).map((e=>({title:e.title}))),analysis:re.value,isSetCorrectAnswer:!!me.value,examExpand:me.value,examAnswerSettingBO:{isIgnoreCase:xe.value?.includes("isIgnoreCase"),isInOrder:xe.value?.includes("isInOrder"),keywordCount:de.value},examRichTextContent:pe.value?ce.value:""})}else _.error("题目标题不能为空!")}m((function(){ne.title&&(ue.value=ne.title),ne.answerList&&ne.answerList.length&&(oe.value=ne.answerList),ne.examAnswerSettingVO&&(xe.value=xe.value.filter((e=>"isIgnoreCase"===e&&ne.examAnswerSettingVO?.isIgnoreCase||"isInOrder"===e&&ne.examAnswerSettingVO?.isInOrder))),ne.examAnswerSettingVO?.keywordCount&&(de.value=ne.examAnswerSettingVO?.keywordCount),ne.examExpand&&(me.value=ne.examExpand),ne.analysis&&(re.value=ne.analysis),ne.examRichTextContent&&(ce.value=ne.examRichTextContent,pe.value=!0)}));const ge=q("subject-text-fill");return(u,r)=>{const d=s,m=e,q=l,_=t,se=n,he=a,be=i,ke=o;return c(),p("div",{class:v(x(ge).e("text-fill-exam"))},[f(E,{"show-edit":u.isEdit},{preview:y((()=>[h("div",U,[h("div",B,[h("span",L,S(u.orderIndex+1)+"."+S(x(ue))+"(问答题)",1),x(pe)?(c(),p("div",M,[h("div",{innerHTML:x(ce),class:"rich-text"},null,8,D)])):g("v-if",!0),h("div",H,[x(oe).some((e=>e.title))?(c(!0),p(k,{key:0},V(x(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)]),x(me)?(c(),p("div",N,[h("span",z,"正确答案:"+S(x(me)),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,[f(m,{modelValue:x(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)),f(q,{modelValue:x(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(),p(k,null,V(ve,(e=>f(_,{key:e.value,modelValue:x(xe),"onUpdate:modelValue":r[2]||(r[2]=e=>b(xe)?xe.value=e:null)},{default:y((()=>[f(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,[f(m,{modelValue:x(me),"onUpdate:modelValue":r[3]||(r[3]=e=>b(me)?me.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),p(k,null,V(x(oe),((e,l)=>(c(),p("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),p(k,null,V(e.title.split(","),(l=>(c(),p(k,{key:l},[l?(c(),w(se,{key:0,closable:"",onClose:t=>function(e,l){if(e){const t=l.title.split(","),s=t.findIndex((l=>l===e));s>-1&&(t.splice(s,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(),p(k,{key:0},[e.showInput?(c(),w(m,{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((()=>[f(he,null,{default:y((()=>[f(x(I))])),_:1}),h("span",null,S(e.title?"添加同义词":"添加关键词"),1)])),_:2},1032,["onClick"]))],64))]),h("div",X,[f(he,{class:"icon"},{default:y((()=>[f(x(O),{class:v([{disabled:u.isSave}]),onClick:fe},null,8,["class"])])),_:1}),f(he,{class:"icon"},{default:y((()=>[f(x(A),{class:v([{disabled:x(oe).length<2||u.isSave}]),onClick:e=>function(e){oe.value.length<2||ne.isSave||oe.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])])))),128))]),u.showAnalysis?(c(),p("div",Y,[r[18]||(r[18]=h("div",{class:"label flex flex-justify-end"},[h("span",null,"解析:")],-1)),h("div",Z,[f(m,{modelValue:x(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),x(pe)?(c(),p("div",ee,[r[20]||(r[20]=h("div",{class:"label flex flex-justify-center"},[h("span",null,"富文本:")],-1)),h("div",le,[f(R,j({"model-value":x(ce),"onUpdate:modelValue":r[5]||(r[5]=e=>b(ce)?ce.value=e:null)},x(ae),{style:{width:"100%"}}),null,16,["model-value"]),h("div",te,[f(ke,{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:ne.examAnswerRelationType,onMoveUp:r[6]||(r[6]=e=>ie("move","up")),onMoveDown:r[7]||(r[7]=e=>ie("move","down")),onDelete:r[8]||(r[8]=e=>ie("delete")),onSave:we,onEdit:r[9]||(r[9]=e=>ie("edit")),onAdd:r[10]||(r[10]=e=>ie("add",e)),onOnShowRichText:r[11]||(r[11]=e=>pe.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):g("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{se 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\" class=\"rich-text\" />\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":"siEAQA,MAAMA,GAAQC,EAmBRC,GAAQC,GAERC,GAAQC,IAERC,GAAUC,EAIX,CAAC,CACJC,MAAO,GACPC,IAAK,GACLC,WAAW,KAGPF,GAAQD,EAAI,IACZI,GAAWJ,EAAI,IACfK,GAAeL,IACfM,GAAUN,EAAI,IACdO,GAAeP,GAAI,GACnBQ,GAAWR,EAAI,IAEfS,GAAY,CAChB,CACEC,MAAO,SACPC,MAAO,aAET,CACED,MAAO,QACPC,MAAO,iBAILC,GAAcZ,EAAI,CAAC,YAAa,iBAqBtC,SAASa,KACPd,GAAQY,MAAMG,KAAK,CACjBb,MAAO,GACPC,IAAK,GACLC,WAAW,GACZ,CAUH,SAASY,KACPR,GAAaI,OAAQ,EACrBH,GAASG,MAAQ,EAAA,CAGnB,SAASK,KACH,GAACf,GAAMU,MAAP,CAKA,GAAAN,GAAaM,OAASL,GAAQK,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yC,sBACR1B,GAASG,MAAQlB,GAAMyC,oBACvB3B,GAAaI,OAAQ,EACvB,IAII,MAAA2B,GAAKC,EAAa,+uEArHf,SAASrC,EAAaoB,GAC7B,GAAIpB,EAAK,CACP,MAAMsC,EAAOlB,EAAKrB,MAAMwC,MAAM,KACxBlB,EAAQiB,EAAKE,WAAWhB,GAAcA,IAAMxB,IAC9CqB,GAAQ,IACLiB,EAAAG,OAAOpB,EAAO,GACdD,EAAArB,MAAQuC,EAAKhB,KAAK,KACzB,CACF,+OAhBF,SAAsBF,GACpBA,EAAKnB,WAAY,EACbmB,EAAKpB,MACPoB,EAAKrB,MAAQqB,EAAKrB,MAAQ,CAACqB,EAAKrB,MAAOqB,EAAKpB,KAAKsB,KAAK,KAAOF,EAAKpB,IAClEoB,EAAKpB,IAAM,GACb,ueAsBF,SAAsBqB,GAChBxB,GAAQY,MAAMQ,OAAS,GAAK1B,GAAMmD,QAG9B7C,GAAAY,MAAMgC,OAAOpB,EAAO,EAAC"}
|
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\" class=\"rich-text\" />\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","exam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,2 @@
|
|
1
|
-
import{defineComponent as e,ref as
|
1
|
+
import{defineComponent as e,ref as s,useAttrs as t,computed as n,watch as i,createElementBlock as a,openBlock as o,normalizeClass as l,unref as r,createElementVNode as d,Fragment as c,renderList as m,createBlock as u,createCommentVNode as p,mergeProps as x}from"vue";import w from"./components/subject-blank-fill.vue.mjs";import v from"./components/subject-scale.vue.mjs";import y from"./components/subject-single.vue.mjs";import h from"./components/subject-text-fill.vue.mjs";import T from"./components/SubjectRichText.vue.mjs";import f from"./components/SubjectPageEnd.vue.mjs";import{useNamespace as A}from"@qxs-bns/hooks";import{setGuid as R}from"@qxs-bns/utils";import{ElMessage as E}from"element-plus/es";import"element-plus/es/components/base/style/index";import"element-plus/es/components/message/style/index";const S={class:"subject-list-wrapper"};var g=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:g,emit:C}){const I=e,D=s([]),j=C,b=t();g({addSubject:M,currentList:D,uploadExcel:function(e){D.value=D.value.concat(e)},addExam:function(e){console.log(e,"items");let s=1;const t=[];e.forEach((e=>{const n={...e,customId:R(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:e.answers?.map((e=>({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})))||[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1};n.pageIndex>s&&(t.push({customId:R(),answerType:"page_end",analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:0}),s=n.pageIndex),t.push(n)})),D.value=D.value.concat(t)},setAnswerRelation:function(e,s,t){const n=D.value.find((e=>e.customId===s));if(n){const s=n.answers?.find((e=>e.customAnswerId===t));s&&(s.answerRelations=e)}}});const _=n((()=>{const e=D.value.filter((e=>"page_end"===e.answerType));return s=>{const t=e.findIndex((e=>e.customId===s));return-1!==t?t+1:0}}));function k(){return e=>{let s=0,t=0;return D.value.forEach((n=>{"page_end"!==n.answerType&&(s++,e===n.customId&&(t=s))})),t-1}}function M(e,s=null,t=null){const n={customId:R(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:t};null!==s?D.value.splice(s+1,0,n):D.value.push(n)}function L(e,s){if("up"===s&&e>0){const[s]=D.value.splice(e,1);D.value.splice(e-1,0,s)}else if("down"===s&&e<D.value.length-1){const[s]=D.value.splice(e,1);D.value.splice(e+1,0,s)}}function P(e,s){D.value[e]={...D.value[e],...s,isEdit:!1,examAnswerRelationType:s.examAnswerRelationType}}function q(e){D.value.splice(e,1),E.success("删除成功")}function Q(e,s){j("setRelation",e,s)}i((()=>I.subjectList),(e=>{e&&(D.value=[...e])}),{immediate:!0});const K=A("subject-list");return(e,s)=>(o(),a("div",{class:l(r(K).e("list-exam"))},[d("div",S,[(o(!0),a(c,null,m(r(D),((s,t)=>(o(),a("div",{key:s.customId,class:"subject-item"},[["single","multiple","sort"].includes(s.answerType)?(o(),u(y,x({key:0,ref_for:!0},r(b),{"order-index":k()(s.customId),title:s.title,type:s.answerType,"exam-id":s.examId,isKey:s.isKey,"is-save":!s.isRealCanDel,customId:s.customId,"is-set":s.hasSet||!1,"answer-list":s.answers,analysis:s.analysis,"least-answer-count":s.leastAnswerCount,"is-edit":s.isEdit||!1,"show-action":!e.isPreview,"exam-expand":s.examExpand,answerCheckType:s.answerCheckType,"exam-rich-text-content":s.examRichTextContent,examAnswerRelationType:s.examAnswerRelationType,onSetRelation:Q,onMove:e=>L(t,e),onDelete:e=>q(t),onSave:e=>P(t,e),onEdit:e=>s.isEdit=!0,onAdd:(e,s)=>M(e,t,s)}),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"===s.answerType?(o(),u(v,x({key:1,ref_for:!0},r(b),{"order-index":k()(s.customId),title:s.title,"is-save":!s.isRealCanDel,"is-set":s.hasSet||!1,"answer-list":s.answers,analysis:s.analysis,"is-edit":s.isEdit||!1,"scale-question-list":s.scaleQuestionList,"show-action":!e.isPreview,"exam-rich-text-content":s.examRichTextContent,examAnswerRelationType:s.examAnswerRelationType,onMove:e=>L(t,e),onDelete:e=>q(t),onSave:e=>P(t,e),onEdit:e=>s.isEdit=!0,onAdd:e=>M(e,t,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"===s.answerType?(o(),u(w,x({key:2,ref_for:!0},r(b),{"order-index":k()(s.customId),title:s.title,"is-save":!s.isRealCanDel,"is-set":s.hasSet||!1,"answer-list":s.answers,analysis:s.analysis,"show-action":!e.isPreview,"is-edit":s.isEdit||!1,"exam-answer-setting-v-o":s.examAnswerSettingVO||{},"exam-rich-text-content":s.examRichTextContent,examAnswerRelationType:s.examAnswerRelationType,onMove:e=>L(t,e),onDelete:e=>q(t),onSave:e=>P(t,e),onEdit:e=>s.isEdit=!0,onAdd:e=>M(e,t,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"===s.answerType?(o(),u(h,x({key:3,ref_for:!0},r(b),{"order-index":k()(s.customId),title:s.title,"is-save":!s.isRealCanDel,"is-set":s.hasSet||!1,"answer-list":s.answers,analysis:s.analysis,"show-action":!e.isPreview,"is-edit":s.isEdit||!1,"exam-expand":s.examExpand,"exam-answer-setting-v-o":s.examAnswerSettingVO||{},examAnswerRelationType:s.examAnswerRelationType,"exam-rich-text-content":s.examRichTextContent,onMove:e=>L(t,e),onDelete:e=>q(t),onSave:e=>P(t,e),onEdit:e=>s.isEdit=!0,onAdd:e=>M(e,t,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"===s.answerType?(o(),u(T,x({key:4,ref_for:!0},r(b),{"order-index":k()(s.customId),richTextContent:s.richTextContent,"is-set":s.hasSet||!1,"is-save":!s.isRealCanDel,"is-edit":s.isEdit||!1,"show-action":!e.isPreview,onMove:e=>L(t,e),onDelete:e=>q(t),examAnswerRelationType:s.examAnswerRelationType,onSave:e=>P(t,e),onEdit:e=>s.isEdit=!0,onAdd:e=>M(e,t,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===s.answerType?(o(),u(f,{"total-page":D.value.filter((e=>"page_end"===e.answerType)).length,key:t,"current-page-index":r(_)(s.customId),item:s,"is-edit":s.isEdit||!1,"is-set":s.hasSet||!1,"is-save":!s.isRealCanDel,examAnswerRelationType:s.examAnswerRelationType,onMove:e=>L(t,e),onDelete:e=>q(t),onSave:e=>P(t,e),onEdit:e=>s.isEdit=!0,onAdd:e=>M(e,t,null)},null,8,["total-page","current-page-index","item","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):p("v-if",!0)])))),128))])],2))}});export{g as default};
|
2
2
|
//# sourceMappingURL=subject-list.vue.mjs.map
|