@qxs-bns/components 0.0.23 → 0.0.25

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.
@@ -1,2 +1,2 @@
1
- var r="0.0.23";export{r as version};
1
+ var r="0.0.25";export{r as version};
2
2
  //# sourceMappingURL=package.json.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-action.vue.js","sources":["../../../../../../packages/components/src/subject-action/src/subject-action.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Bottom, Delete, Edit, Top } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectType from '../../subject-type/src/subject-type.vue'\n\ndefineOptions({\n name: 'QxsSubjectAction',\n})\nconst props = defineProps({\n isEdit: {\n type: Boolean,\n },\n isSet: {\n type: Boolean,\n default: false,\n },\n isKey: {\n type: Boolean,\n default: false,\n },\n answerCheckType: {\n type: Number,\n default: 2\n },\n showOtherOption: {\n type: Boolean,\n default: true,\n },\n examAnswerRelationType: {\n type: Number,\n default: null\n },\n pageEnd: {\n type: Boolean,\n default: false\n }\n})\nconst key = ref(props.isKey)\nconst showAnswerSetting = ref(false)\nconst emits = defineEmits(['moveUp', 'moveDown', 'delete', 'save', 'edit', 'add', 'onShowRichText', 'setKey', 'setAnswerSetting'])\nconst answerType = ref(props.answerCheckType)\nconst ns = useNamespace('subject-action')\n\nfunction onSaveSetting() {\n showAnswerSetting.value = false\n emits('setAnswerSetting', answerType)\n}\n\nfunction selectExam(type:string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n</script>\n\n<template>\n <div :class=\"ns.e('action-exam')\">\n <div class=\"action flex flex-justify-between\" :class=\"[{ active: isEdit }]\">\n <el-popover trigger=\"click\">\n <template #reference>\n <el-link type=\"primary\">\n +在此题后加入新题\n </el-link>\n </template>\n <SubjectType @select=\"selectExam\" />\n </el-popover>\n <el-link type=\"primary\" @click=\"emits('onShowRichText')\" v-if=\"showOtherOption\">\n +添加题目描述(图文)\n </el-link>\n <el-link type=\"primary\" @click=\"showAnswerSetting = true\" v-if=\"showOtherOption\">\n 答题设置\n </el-link>\n <el-checkbox v-model=\"key\" label=\"核心题\" @change=\"emits('setKey', key)\" v-if=\"showOtherOption\"/>\n <div>\n <div v-if=\"isSet\" class=\"has-set\">\n *此题设置了跳题逻辑\n </div>\n <div v-else class=\"flex flex-justify-end\" style=\"width: 100%;\">\n <template v-if=\"!isEdit\">\n <el-button class=\"btn-margin\" @click=\"emits('edit')\" v-if=\"!pageEnd\">\n <template #icon>\n <el-icon>\n <Edit />\n </el-icon>\n </template>\n 编辑\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n <template #icon>\n <el-icon>\n <Delete />\n </el-icon>\n </template>\n 删除\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveUp')\">\n <template #icon>\n <el-icon>\n <Top />\n </el-icon>\n </template>\n 上移\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveDown')\">\n <template #icon>\n <el-icon>\n <Bottom />\n </el-icon>\n </template>\n 下移\n </el-button>\n </template>\n <template v-else>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n 删除\n </el-button>\n <el-button type=\"primary\" @click=\"emits('save')\">\n 完成编辑\n </el-button>\n </template>\n </div>\n </div>\n <el-dialog\n v-model=\"showAnswerSetting\"\n title=\"答题设置\"\n class=\"customize-dialog\"\n >\n <el-radio-group v-model=\"answerType\" class=\"vertical-radio-group\">\n <el-radio :value=\"1\">必须全部都是支持选项,方可下一步</el-radio>\n <el-radio :value=\"2\">无需判断是否是支持选项</el-radio>\n <el-radio :value=\"3\">包含全部支持选项,即可下一步</el-radio>\n </el-radio-group>\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"showAnswerSetting = false\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveSetting\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n </div>\n</template>\n"],"names":["props","__props","key","ref","isKey","showAnswerSetting","emits","__emit","answerType","answerCheckType","ns","useNamespace","onSaveSetting","value","selectExam","type","canSet","examAnswerRelationType"],"mappings":"2lCAQA,MAAMA,EAAQC,EA6BRC,EAAMC,EAAIH,EAAMI,OAChBC,EAAoBF,GAAI,GACxBG,EAAQC,EACRC,EAAaL,EAAIH,EAAMS,iBACvBC,EAAKC,EAAa,kBAExB,SAASC,IACPP,EAAkBQ,OAAQ,EAC1BP,EAAM,mBAAoBE,EAAU,CAG7B,SAAAM,EAAWC,EAAaC,GAChCV,EAAM,MAAOS,EAAMC,EAAQhB,EAAMiB,uBAAwB,KAAI"}
1
+ {"version":3,"file":"subject-action.vue.js","sources":["../../../../../../packages/components/src/subject-action/src/subject-action.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Bottom, Delete, Edit, Top } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectType from '../../subject-type/src/subject-type.vue'\n\ndefineOptions({\n name: 'QxsSubjectAction',\n})\nconst props = defineProps({\n isEdit: {\n type: Boolean,\n },\n isSet: {\n type: Boolean,\n default: false,\n },\n isKey: {\n type: Boolean,\n default: false,\n },\n answerCheckType: {\n type: Number,\n default: 2\n },\n showOtherOption: {\n type: Boolean,\n default: true,\n },\n examAnswerRelationType: {\n type: Number,\n default: null\n },\n pageEnd: {\n type: Boolean,\n default: false\n }\n})\nconst isKey = ref(props.isKey)\nconst showAnswerSetting = ref(false)\nconst emits = defineEmits(['moveUp', 'moveDown', 'delete', 'save', 'edit', 'add', 'onShowRichText', 'setKey', 'setAnswerSetting'])\nconst answerType = ref(props.answerCheckType)\nconst ns = useNamespace('subject-action')\n\nfunction onSaveSetting() {\n showAnswerSetting.value = false\n emits('setAnswerSetting', answerType)\n}\n\nfunction selectExam(type:string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n</script>\n\n<template>\n <div :class=\"ns.e('action-exam')\">\n <div class=\"action flex flex-justify-between\" :class=\"[{ active: isEdit }]\">\n <el-popover trigger=\"click\">\n <template #reference>\n <el-link type=\"primary\">\n +在此题后加入新题\n </el-link>\n </template>\n <SubjectType @select=\"selectExam\" />\n </el-popover>\n <el-link type=\"primary\" @click=\"emits('onShowRichText')\" v-if=\"showOtherOption\">\n +添加题目描述(图文)\n </el-link>\n <el-link type=\"primary\" @click=\"showAnswerSetting = true\" v-if=\"showOtherOption\">\n 答题设置\n </el-link>\n <el-checkbox v-model=\"isKey\" label=\"核心题\" @change=\"emits('setKey', isKey)\" v-if=\"showOtherOption\"/>\n <div>\n <div v-if=\"isSet\" class=\"has-set\">\n *此题设置了跳题逻辑\n </div>\n <div v-else class=\"flex flex-justify-end\" style=\"width: 100%;\">\n <template v-if=\"!isEdit\">\n <el-button class=\"btn-margin\" @click=\"emits('edit')\" v-if=\"!pageEnd\">\n <template #icon>\n <el-icon>\n <Edit />\n </el-icon>\n </template>\n 编辑\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n <template #icon>\n <el-icon>\n <Delete />\n </el-icon>\n </template>\n 删除\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveUp')\">\n <template #icon>\n <el-icon>\n <Top />\n </el-icon>\n </template>\n 上移\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveDown')\">\n <template #icon>\n <el-icon>\n <Bottom />\n </el-icon>\n </template>\n 下移\n </el-button>\n </template>\n <template v-else>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n 删除\n </el-button>\n <el-button type=\"primary\" @click=\"emits('save')\">\n 完成编辑\n </el-button>\n </template>\n </div>\n </div>\n <el-dialog\n v-model=\"showAnswerSetting\"\n title=\"答题设置\"\n class=\"customize-dialog\"\n >\n <el-radio-group v-model=\"answerType\" class=\"vertical-radio-group\">\n <el-radio :value=\"1\">必须全部都是支持选项,方可下一步</el-radio>\n <el-radio :value=\"2\">无需判断是否是支持选项</el-radio>\n <el-radio :value=\"3\">包含全部支持选项,即可下一步</el-radio>\n </el-radio-group>\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"showAnswerSetting = false\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveSetting\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n </div>\n</template>\n"],"names":["props","__props","isKey","ref","showAnswerSetting","emits","__emit","answerType","answerCheckType","ns","useNamespace","onSaveSetting","value","selectExam","type","canSet","examAnswerRelationType"],"mappings":"2lCAQA,MAAMA,EAAQC,EA6BRC,EAAQC,EAAIH,EAAME,OAClBE,EAAoBD,GAAI,GACxBE,EAAQC,EACRC,EAAaJ,EAAIH,EAAMQ,iBACvBC,EAAKC,EAAa,kBAExB,SAASC,IACPP,EAAkBQ,OAAQ,EAC1BP,EAAM,mBAAoBE,EAAU,CAG7B,SAAAM,EAAWC,EAAaC,GAChCV,EAAM,MAAOS,EAAMC,EAAQf,EAAMgB,uBAAwB,KAAI"}
@@ -1,2 +1,2 @@
1
- import{ElInput as e,ElIcon as l,ElLink as t,ElRow as a,ElCol as s,ElRadio as n}from"element-plus/es";import{defineComponent as i,useAttrs as o,ref as u,computed as r,onMounted as d,createElementBlock as c,openBlock as p,normalizeClass as v,unref as m,createVNode as f,withCtx as x,createBlock as y,createCommentVNode as h,createElementVNode as w,isRef as b,Fragment as g,renderList as j,toDisplayString as C,mergeProps as S,createTextVNode as k}from"vue";import{CirclePlus as V,Remove as q}from"@element-plus/icons-vue";import{useNamespace as T}from"@qxs-bns/hooks";import{ElMessage as _}from"element-plus";import L from"../../../subject-action/src/subject-action.vue.js";import A from"../../../subject-layout/src/subject-layout.vue.js";import R from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.js";const M={class:"preview"},U={class:"title"},E={key:0},O=["innerHTML"],Q={class:"answer-radio flex flex-col"},B={style:{flex:"1"}},D={class:"answer flex"},H={class:"flex"},I={class:"answer-list flex-col"},N={class:"order"},$={class:"flex",style:{"margin-bottom":"20px"}},P={style:{flex:"1"}},z={key:0,class:"margin-bottom flex"},F={style:{flex:"1"}},G={class:"flex flex-justify-end"};var J=i({name:"QxsSubjectScale",__name:"subject-scale",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},rowTitle:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},scaleQuestionList:{type:null,required:!1},examRichTextContent:{type:String,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(i,{emit:J}){const K=i,W=J,X=o(),Y=u([{title:""},{title:""},{title:""},{title:""},{title:""}]),Z=u(""),ee=u(""),le=u(""),te=u(!1),ae=u(""),se=u([]),ne=r((()=>Math.ceil(24/(Y.value.length+1))));function ie(){5!==Y.value.length&&Y.value.push({title:""})}function oe(){te.value=!1,ae.value=""}function ue(){if(!Z.value)return void _.error("题目标题不能为空!");let e="";Y.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?_.error(e):le.value?(se.value=le.value.split("\n").filter((e=>e)),W("save",{title:Z.value,answers:Y.value,analysis:ee.value,scaleQuestionList:se.value,examRichTextContent:te.value?ae.value:""})):_.error("行标题不能为空!")}u(!1),d((function(){K.title&&(Z.value=K.title),K.answerList&&K.answerList.length&&(Y.value=K.answerList),K.analysis&&(ee.value=K.analysis),K.scaleQuestionList&&(se.value=K.scaleQuestionList,le.value=se.value.join("\n")),K.examRichTextContent&&(ae.value=K.examRichTextContent,te.value=!0)}));const re=T("subject-scale");return(i,o)=>{const u=s,r=a,d=n,T=e,_=l,J=t;return p(),c("div",{class:v(m(re).e("scale-exam"))},[f(A,{"show-edit":i.isEdit},{preview:x((()=>[w("div",M,[w("div",null,[w("span",U,C(i.orderIndex+1)+"."+C(m(Z))+"(量表题)",1),m(te)?(p(),c("div",E,[w("div",{innerHTML:m(ae)},null,8,O)])):h("v-if",!0)]),w("div",Q,[f(r,{style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne)},null,8,["span"]),(p(!0),c(g,null,j(m(Y),(e=>(p(),y(u,{key:e.title,class:"flex flex-center",span:m(ne)},{default:x((()=>[w("span",null,C(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(p(!0),c(g,null,j(m(se),(e=>(p(),y(r,{key:e,style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne),class:"flex flex-center"},{default:x((()=>[w("span",null,C(e),1)])),_:2},1032,["span"]),(p(!0),c(g,null,j(m(Y).length,(e=>(p(),y(u,{key:e,class:"radio-item flex flex-center",span:m(ne)},{default:x((()=>[f(d,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:x((()=>[w("div",{class:v(["flex",[{"margin-bottom":m(te)}]])},[o[10]||(o[10]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"题目:")],-1)),w("div",B,[f(T,{modelValue:m(Z),"onUpdate:modelValue":o[0]||(o[0]=e=>b(Z)?Z.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:i.isSave},null,8,["modelValue","disabled"])])],2),w("div",D,[o[11]||(o[11]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"行标题:")],-1)),w("div",H,[f(T,{modelValue:m(le),"onUpdate:modelValue":o[1]||(o[1]=e=>b(le)?le.value=e:null),modelModifiers:{trim:!0},type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),w("div",I,[(p(!0),c(g,null,j(m(Y),((e,l)=>(p(),c("div",{key:l,class:"answer-item flex flex-items-center"},[w("span",N,C(String.fromCharCode(65+l))+".",1),f(T,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+l)}`,disabled:i.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),h(' <PlusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length === 5 }]"\n @click="addAnswer"\n />\n <MinusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length < 3 }]"\n @click="deleteAnswer(index)"\n /> '),f(_,{class:"icon"},{default:x((()=>[f(m(V),{class:v([{disabled:5===m(Y).length}]),onClick:ie},null,8,["class"])])),_:1}),f(_,{class:"icon"},{default:x((()=>[f(m(q),{class:v([{disabled:m(Y).length<3}]),onClick:e=>function(e){Y.value.length<3||Y.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),w("div",$,[o[12]||(o[12]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"解析:")],-1)),w("div",P,[f(T,{modelValue:m(ee),"onUpdate:modelValue":o[2]||(o[2]=e=>b(ee)?ee.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),m(te)?(p(),c("div",z,[o[14]||(o[14]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"富文本:")],-1)),w("div",F,[f(R,S({"model-value":m(ae),"onUpdate:modelValue":o[3]||(o[3]=e=>b(ae)?ae.value=e:null)},m(X),{style:{width:"100%"}}),null,16,["model-value"]),w("div",G,[f(J,{type:"danger",onClick:oe},{default:x((()=>o[13]||(o[13]=[k(" 删除富文本 ")]))),_:1})])])])):h("v-if",!0)])),default:x((()=>[i.showAction?(p(),y(L,{key:0,"is-edit":i.isEdit,"is-set":i.isSet,showOtherOption:!1,examAnswerRelationType:K.examAnswerRelationType,onMoveUp:o[4]||(o[4]=e=>W("move","up")),onMoveDown:o[5]||(o[5]=e=>W("move","down")),onDelete:o[6]||(o[6]=e=>W("delete")),onSave:ue,onEdit:o[7]||(o[7]=e=>W("edit")),onAdd:o[8]||(o[8]=e=>W("add",e)),onOnShowRichText:o[9]||(o[9]=e=>te.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):h("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{J as default};
1
+ import{ElInput as e,ElIcon as l,ElLink as t,ElRow as a,ElCol as s,ElRadio as n}from"element-plus/es";import{defineComponent as i,useAttrs as o,ref as u,computed as r,onMounted as d,createElementBlock as c,openBlock as p,normalizeClass as v,unref as m,createVNode as f,withCtx as x,createBlock as y,createCommentVNode as h,createElementVNode as w,isRef as b,Fragment as g,renderList as j,toDisplayString as C,mergeProps as S,createTextVNode as k}from"vue";import{CirclePlus as V,Remove as q}from"@element-plus/icons-vue";import{useNamespace as T}from"@qxs-bns/hooks";import{ElMessage as _}from"element-plus";import L from"../../../subject-action/src/subject-action.vue.js";import A from"../../../subject-layout/src/subject-layout.vue.js";import R from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.js";const M={class:"preview"},U={class:"title"},E={key:0},O=["innerHTML"],Q={class:"answer-radio flex flex-col"},B={style:{flex:"1"}},D={class:"answer flex"},H={class:"flex"},I={class:"answer-list flex-col"},N={class:"order"},$={class:"flex",style:{"margin-bottom":"20px"}},P={style:{flex:"1"}},z={key:0,class:"margin-bottom flex"},F={style:{flex:"1"}},G={class:"flex flex-justify-end"};var J=i({name:"QxsSubjectScale",__name:"subject-scale",props:{orderIndex:{type:Number,required:!0},title:{type:String,required:!1},isSave:{type:Boolean,required:!0},showAction:{type:Boolean,required:!1},answerList:{type:null,required:!1},analysis:{type:String,required:!1},rowTitle:{type:String,required:!1},isEdit:{type:Boolean,required:!0},isSet:{type:Boolean,required:!0},scaleQuestionList:{type:null,required:!1},examRichTextContent:{type:String,required:!1},examAnswerRelationType:{type:Number,required:!1}},emits:["move","save","delete","edit","add"],setup(i,{emit:J}){const K=i,W=J,X=o(),Y=u([{title:""},{title:""},{title:""},{title:""},{title:""}]),Z=u(""),ee=u(""),le=u(""),te=u(!1),ae=u(""),se=u([]),ne=r((()=>Math.ceil(24/(Y.value.length+1))));function ie(){5!==Y.value.length&&Y.value.push({title:""})}function oe(){te.value=!1,ae.value=""}function ue(){if(!Z.value)return void _.error("题目标题不能为空!");let e="";Y.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?_.error(e):le.value?(se.value=le.value.split("\n").filter((e=>e)),W("save",{title:Z.value,answers:Y.value,analysis:ee.value,scaleQuestionList:se.value,examRichTextContent:te.value?ae.value:""})):_.error("行标题不能为空!")}d((function(){K.title&&(Z.value=K.title),K.answerList&&K.answerList.length&&(Y.value=K.answerList),K.analysis&&(ee.value=K.analysis),K.scaleQuestionList&&(se.value=K.scaleQuestionList,le.value=se.value.join("\n")),K.examRichTextContent&&(ae.value=K.examRichTextContent,te.value=!0)}));const re=T("subject-scale");return(i,o)=>{const u=s,r=a,d=n,T=e,_=l,J=t;return p(),c("div",{class:v(m(re).e("scale-exam"))},[f(A,{"show-edit":i.isEdit},{preview:x((()=>[w("div",M,[w("div",null,[w("span",U,C(i.orderIndex+1)+"."+C(m(Z))+"(量表题)",1),m(te)?(p(),c("div",E,[w("div",{innerHTML:m(ae)},null,8,O)])):h("v-if",!0)]),w("div",Q,[f(r,{style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne)},null,8,["span"]),(p(!0),c(g,null,j(m(Y),(e=>(p(),y(u,{key:e.title,class:"flex flex-center",span:m(ne)},{default:x((()=>[w("span",null,C(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(p(!0),c(g,null,j(m(se),(e=>(p(),y(r,{key:e,style:{padding:"10px 0"}},{default:x((()=>[f(u,{span:m(ne),class:"flex flex-center"},{default:x((()=>[w("span",null,C(e),1)])),_:2},1032,["span"]),(p(!0),c(g,null,j(m(Y).length,(e=>(p(),y(u,{key:e,class:"radio-item flex flex-center",span:m(ne)},{default:x((()=>[f(d,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:x((()=>[w("div",{class:v(["flex",[{"margin-bottom":m(te)}]])},[o[10]||(o[10]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"题目:")],-1)),w("div",B,[f(T,{modelValue:m(Z),"onUpdate:modelValue":o[0]||(o[0]=e=>b(Z)?Z.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:i.isSave},null,8,["modelValue","disabled"])])],2),w("div",D,[o[11]||(o[11]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"行标题:")],-1)),w("div",H,[f(T,{modelValue:m(le),"onUpdate:modelValue":o[1]||(o[1]=e=>b(le)?le.value=e:null),modelModifiers:{trim:!0},type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),w("div",I,[(p(!0),c(g,null,j(m(Y),((e,l)=>(p(),c("div",{key:l,class:"answer-item flex flex-items-center"},[w("span",N,C(String.fromCharCode(65+l))+".",1),f(T,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+l)}`,disabled:i.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),h(' <PlusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length === 5 }]"\n @click="addAnswer"\n />\n <MinusCircleOutlined\n class="icon"\n :class="[{ disabled: answers.length < 3 }]"\n @click="deleteAnswer(index)"\n /> '),f(_,{class:"icon"},{default:x((()=>[f(m(V),{class:v([{disabled:5===m(Y).length}]),onClick:ie},null,8,["class"])])),_:1}),f(_,{class:"icon"},{default:x((()=>[f(m(q),{class:v([{disabled:m(Y).length<3}]),onClick:e=>function(e){Y.value.length<3||Y.value.splice(e,1)}(l)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),w("div",$,[o[12]||(o[12]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"解析:")],-1)),w("div",P,[f(T,{modelValue:m(ee),"onUpdate:modelValue":o[2]||(o[2]=e=>b(ee)?ee.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),m(te)?(p(),c("div",z,[o[14]||(o[14]=w("div",{class:"label flex flex-justify-center"},[w("span",null,"富文本:")],-1)),w("div",F,[f(R,S({"model-value":m(ae),"onUpdate:modelValue":o[3]||(o[3]=e=>b(ae)?ae.value=e:null)},m(X),{style:{width:"100%"}}),null,16,["model-value"]),w("div",G,[f(J,{type:"danger",onClick:oe},{default:x((()=>o[13]||(o[13]=[k(" 删除富文本 ")]))),_:1})])])])):h("v-if",!0)])),default:x((()=>[i.showAction?(p(),y(L,{key:0,"is-edit":i.isEdit,"is-set":i.isSet,showOtherOption:!1,examAnswerRelationType:K.examAnswerRelationType,onMoveUp:o[4]||(o[4]=e=>W("move","up")),onMoveDown:o[5]||(o[5]=e=>W("move","down")),onDelete:o[6]||(o[6]=e=>W("delete")),onSave:ue,onEdit:o[7]||(o[7]=e=>W("edit")),onAdd:o[8]||(o[8]=e=>W("add",e)),onOnShowRichText:o[9]||(o[9]=e=>te.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):h("v-if",!0)])),_:1},8,["show-edit"])],2)}}});export{J as default};
2
2
  //# sourceMappingURL=subject-scale.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-scale.vue.js","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)))\nconst isKey = ref(false)\nfunction addAnswer() {\n if (answers.value.length === 5) {\n return\n }\n answers.value.push({\n title: '',\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n answers.value.forEach((v, i) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n })\n\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n if (!rowTitle.value) {\n ElMessage.error('行标题不能为空!')\n return\n }\n\n scaleQuestionList.value = rowTitle.value.split('\\n').filter(i => i)\n\n emits('save', {\n title: title.value,\n answers: answers.value,\n analysis: analysis.value,\n scaleQuestionList: scaleQuestionList.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.scaleQuestionList) {\n scaleQuestionList.value = props.scaleQuestionList\n rowTitle.value = scaleQuestionList.value.join('\\n')\n }\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-scale')\n</script>\n\n<template>\n <div :class=\"ns.e('scale-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(量表题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n </div>\n <div class=\"answer-radio flex flex-col\">\n <el-row style=\"padding: 10px 0;\">\n <el-col :span=\"span\" />\n <el-col\n v-for=\"item in answers\"\n :key=\"item.title\"\n class=\"flex flex-center\"\n :span=\"span\"\n >\n <span>{{ item.title }}</span>\n </el-col>\n </el-row>\n <el-row\n v-for=\"item in scaleQuestionList\"\n :key=\"item\"\n style=\"padding: 10px 0;\"\n >\n <el-col :span=\"span\" class=\"flex flex-center\">\n <span>{{ item }}</span>\n </el-col>\n <el-col\n v-for=\"i in answers.length\"\n :key=\"i\"\n class=\"radio-item flex flex-center\"\n :span=\"span\"\n >\n <el-radio :disabled=\"true\" />\n </el-col>\n </el-row>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"【量表题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"answer flex\">\n <div class=\"label flex flex-justify-center\">\n <span>行标题:</span>\n </div>\n <div class=\"flex\">\n <el-input\n v-model.trim=\"rowTitle\"\n type=\"textarea\"\n placeholder=\"请输入行标题\"\n style=\"width: 160px;\"\n :rows=\"10\"\n />\n <div class=\"answer-list flex-col\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n :maxlength=\"10\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <!-- <PlusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n <MinusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n /> -->\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex\" style=\"margin-bottom: 20px;\">\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"type => 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":"kuDAWA,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,MAEnE,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,CApDWlB,GAAI,GA8ElB4B,GAvBA,WACMnC,EAAMQ,QACRA,EAAMU,MAAQlB,EAAMQ,OAGlBR,EAAMoC,YAAcpC,EAAMoC,WAAWjB,SACvCb,EAAQY,MAAQlB,EAAMoC,YAGpBpC,EAAMS,WACRA,GAASS,MAAQlB,EAAMS,UAGrBT,EAAMa,oBACRA,GAAkBK,MAAQlB,EAAMa,kBAChCH,GAASQ,MAAQL,GAAkBK,MAAMmB,KAAK,OAE5CrC,EAAMkC,sBACRtB,GAASM,MAAQlB,EAAMkC,oBACvBvB,GAAaO,OAAQ,EACvB,IAII,MAAAoB,GAAKC,EAAa,2iFArExB,SAAsBC,GAChBlC,EAAQY,MAAMC,OAAS,GAGnBb,EAAAY,MAAMuB,OAAOD,EAAO,EAAC"}
1
+ {"version":3,"file":"subject-scale.vue.js","sources":["../../../../../../../packages/components/src/subject-list/src/components/subject-scale.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { CirclePlus, Remove } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { ElMessage } from 'element-plus'\nimport SubjectAction from '../../../subject-action/src/subject-action.vue'\nimport SubjectLayout from '../../../subject-layout/src/subject-layout.vue'\nimport TinyMceEditor from '../../../tiny-mce-editor/src/tiny-mce-editor.vue'\n\ndefineOptions({\n name: 'QxsSubjectScale',\n})\nconst props = defineProps<{\n orderIndex: number\n title?: string\n isSave: boolean\n showAction?: boolean\n answerList?: any\n analysis?: string\n rowTitle?: string\n isEdit: boolean\n isSet: boolean\n scaleQuestionList?: any\n examRichTextContent?: string\n examAnswerRelationType?: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add'])\n\nconst attrs = useAttrs()\n\nconst answers = ref<{\n title: string\n}[]>([{\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}, {\n title: '',\n}])\n\nconst title = ref('')\nconst analysis = ref('')\nconst rowTitle = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst scaleQuestionList = ref<string[]>([])\nconst span = computed(() => Math.ceil(24 / (answers.value.length + 1)))\nfunction addAnswer() {\n if (answers.value.length === 5) {\n return\n }\n answers.value.push({\n title: '',\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n answers.value.forEach((v, i) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n })\n\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n if (!rowTitle.value) {\n ElMessage.error('行标题不能为空!')\n return\n }\n\n scaleQuestionList.value = rowTitle.value.split('\\n').filter(i => i)\n\n emits('save', {\n title: title.value,\n answers: answers.value,\n analysis: analysis.value,\n scaleQuestionList: scaleQuestionList.value,\n examRichTextContent: showRichText.value ? richText.value : '',\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList\n }\n\n if (props.analysis) {\n analysis.value = props.analysis\n }\n\n if (props.scaleQuestionList) {\n scaleQuestionList.value = props.scaleQuestionList\n rowTitle.value = scaleQuestionList.value.join('\\n')\n }\n if (props.examRichTextContent) {\n richText.value = props.examRichTextContent\n showRichText.value = true\n }\n}\n\nonMounted(init)\nconst ns = useNamespace('subject-scale')\n</script>\n\n<template>\n <div :class=\"ns.e('scale-exam')\">\n <SubjectLayout :show-edit=\"isEdit\">\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">{{ orderIndex + 1 }}.{{ title }}(量表题)</span>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n </div>\n <div class=\"answer-radio flex flex-col\">\n <el-row style=\"padding: 10px 0;\">\n <el-col :span=\"span\" />\n <el-col\n v-for=\"item in answers\"\n :key=\"item.title\"\n class=\"flex flex-center\"\n :span=\"span\"\n >\n <span>{{ item.title }}</span>\n </el-col>\n </el-row>\n <el-row\n v-for=\"item in scaleQuestionList\"\n :key=\"item\"\n style=\"padding: 10px 0;\"\n >\n <el-col :span=\"span\" class=\"flex flex-center\">\n <span>{{ item }}</span>\n </el-col>\n <el-col\n v-for=\"i in answers.length\"\n :key=\"i\"\n class=\"radio-item flex flex-center\"\n :span=\"span\"\n >\n <el-radio :disabled=\"true\" />\n </el-col>\n </el-row>\n </div>\n </div>\n </template>\n <template #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"【量表题】请输入问题\"\n :disabled=\"isSave\"\n />\n </div>\n </div>\n <div class=\"answer flex\">\n <div class=\"label flex flex-justify-center\">\n <span>行标题:</span>\n </div>\n <div class=\"flex\">\n <el-input\n v-model.trim=\"rowTitle\"\n type=\"textarea\"\n placeholder=\"请输入行标题\"\n style=\"width: 160px;\"\n :rows=\"10\"\n />\n <div class=\"answer-list flex-col\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n :maxlength=\"10\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <!-- <PlusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n <MinusCircleOutlined\n class=\"icon\"\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n /> -->\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: answers.length === 5 }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex\" style=\"margin-bottom: 20px;\">\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :showOtherOption=\"false\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"type => 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":"kuDAWA,MAAMA,EAAQC,EAcRC,EAAQC,EAERC,EAAQC,IAERC,EAAUC,EAEX,CAAC,CACJC,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,IACN,CACDA,MAAO,MAGHA,EAAQD,EAAI,IACZE,GAAWF,EAAI,IACfG,GAAWH,EAAI,IACfI,GAAeJ,GAAI,GACnBK,GAAWL,EAAI,IACfM,GAAoBN,EAAc,IAClCO,GAAOC,GAAS,IAAMC,KAAKC,KAAK,IAAMX,EAAQY,MAAMC,OAAS,MACnE,SAASC,KACsB,IAAzBd,EAAQY,MAAMC,QAGlBb,EAAQY,MAAMG,KAAK,CACjBb,MAAO,IACR,CAUH,SAASc,KACPX,GAAaO,OAAQ,EACrBN,GAASM,MAAQ,EAAA,CAGnB,SAASK,KACH,IAACf,EAAMU,MAET,YADAM,EAAUC,MAAM,aAGlB,IAAIC,EAAM,GACVpB,EAAQY,MAAMS,SAAQ,CAACC,EAAGC,KACnBD,EAAEpB,QACLkB,GAAO,KAAKI,OAAOC,aAAa,GAAKF,SAAE,IAIvCH,EACFF,EAAUC,MAAMC,GAIbhB,GAASQ,OAKIL,GAAAK,MAAQR,GAASQ,MAAMc,MAAM,MAAMC,WAAYJ,IAEjE3B,EAAM,OAAQ,CACZM,MAAOA,EAAMU,MACbZ,QAASA,EAAQY,MACjBT,SAAUA,GAASS,MACnBL,kBAAmBA,GAAkBK,MACrCgB,oBAAqBvB,GAAaO,MAAQN,GAASM,MAAQ,MAX3DM,EAAUC,MAAM,WAYjB,CA0BHU,GAvBA,WACMnC,EAAMQ,QACRA,EAAMU,MAAQlB,EAAMQ,OAGlBR,EAAMoC,YAAcpC,EAAMoC,WAAWjB,SACvCb,EAAQY,MAAQlB,EAAMoC,YAGpBpC,EAAMS,WACRA,GAASS,MAAQlB,EAAMS,UAGrBT,EAAMa,oBACRA,GAAkBK,MAAQlB,EAAMa,kBAChCH,GAASQ,MAAQL,GAAkBK,MAAMmB,KAAK,OAE5CrC,EAAMkC,sBACRtB,GAASM,MAAQlB,EAAMkC,oBACvBvB,GAAaO,OAAQ,EACvB,IAII,MAAAoB,GAAKC,EAAa,2iFArExB,SAAsBC,GAChBlC,EAAQY,MAAMC,OAAS,GAGnBb,EAAAY,MAAMuB,OAAOD,EAAO,EAAC"}
@@ -1,2 +1,2 @@
1
- import{ElCheckbox as e,ElRadio as l,ElInput as t,ElSelect as a,ElOption as i,ElIcon as s,ElLink as n,ElDialog as r,ElButton as o,ElMessage as u}from"element-plus/es";import{defineComponent as d,useAttrs as m,ref as c,computed as p,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 V,createTextVNode as A,toDisplayString as T,Fragment as q,renderList as R,isRef as j,mergeProps as _}from"vue";import{CirclePlus as E,Remove as I}from"@element-plus/icons-vue";import{useNamespace as U}from"@qxs-bns/hooks";import B from"../../../subject-action/src/subject-action.vue.js";import K from"../../../subject-layout/src/subject-layout.vue.js";import L from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.js";import{setGuid as $}from"@qxs-bns/utils";const z={class:"preview"},M={class:"title"},N={key:0},D={key:1},H={key:0},O=["innerHTML"],Q={class:"preview-answer"},F={class:"order"},G={class:"order"},J={style:{flex:"1"}},P={class:"margin-bottom flex flex-items-center"},W={class:"margin-bottom answer-list"},X={class:"order"},Y={key:0,class:"margin-bottom flex flex-items-center"},Z={style:{flex:"1"}},ee={key:1,class:"flex"},le={style:{flex:"1"}},te={key:2,class:"margin-bottom flex"},ae={style:{flex:"1"}},ie={class:"flex flex-justify-end"};var se=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},id:{type:String,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=c(0),de=c(!1),me=c(2),ce=c([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),pe=c(),ve=c(""),ye=c(""),fe=c(!1),xe=c(""),we=c(0),he=c(!1),Ce=c(""),ge=p((()=>"single"===ne.type?"单选题":"multiple"===ne.type?"多选题":"排序题")),be=c([]),ke=p((()=>{const e=[];for(let l=ce.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Se(){ne.isSave||ce.value.push({title:"",isCorrect:!1,customAnswerId:$()})}const Ve=ne.id||$();function Ae(){fe.value=!1,xe.value=""}function Te(){if(!ve.value)return void u.error("题目标题不能为空!");let e="",l=!1,t=null,a=0;if("multiple"===ne.type||"single"===ne.type?ce.value.forEach(((i,s)=>{i.title||(e+=`选项${String.fromCharCode(65+s)}未填写。`),i.isCorrect&&(l=!0,a++),i.resultItem&&(t=1),i.answerRelations?.length&&(t=2)})):"sort"===ne.type&&be.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===a)return void u.error("请至少设置两个正确答案");if(l&&a<pe.value)return void u.error("至少选几项与正确答案数不符")}re("save",{title:ve.value,answers:ce.value.map(((e,l)=>({...e,orderIndex:l+1}))),examExpand:be.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:ye.value,isSetCorrectAnswer:l,leastAnswerCount:pe.value,examRichTextContent:fe.value?xe.value:"",examAnswerRelationType:t,isKey:de.value,answerCheckType:me.value})}else u.error("选项不能重复")}function qe(){he.value=!1,Ce.value=""}function Re(){he.value=!1}function je(e){de.value=e}function _e(e){me.value=e}function Ee(e,l){re("add",e,l?ne.examAnswerRelationType:null)}v((()=>ne.isEdit),(()=>{ne.isEdit&&(we.value=(new Date).getTime())}));const Ie=U("subject-single");return y((function(){if(ne.title&&(ve.value=ne.title),ne.isKey&&(de.value=ne.isKey),ne.answerList&&ne.answerList.length&&(ce.value=ne.answerList.map((e=>({...e,customAnswerId:e.examAnswerId||$()})))),ne.leastAnswerCount&&(pe.value=ne.leastAnswerCount),ne.examExpand&&ne.examExpand){const e=ne.examExpand.split(",");be.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&&(ye.value=ne.analysis),ne.examRichTextContent&&(xe.value=ne.examRichTextContent,fe.value=!0)})),(u,d)=>{const m=e,c=l,p=t,v=i,y=a,U=s,$=n,se=o,we=r;return x(),f("div",{class:w(h(Ie).e("single-exam"))},[C(K,{"show-edit":u.isEdit},g({preview:b((()=>[V("div",z,[V("div",null,[V("span",M,[A(T(u.orderIndex+1)+"."+T(h(ve))+" ",1),"single"===u.type?(x(),f("span",N,"(单选题)")):["multiple","sort"].includes(u.type)?(x(),f("span",D," ("+T(h(ge))+T(h(pe)?`至少选${h(pe)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):S("v-if",!0)])]),h(fe)?(x(),f("div",H,[V("div",{innerHTML:h(xe)},null,8,O)])):S("v-if",!0),V("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((()=>[V("span",F,T(String.fromCharCode(65+l))+". ",1),A(" "+T(e.title),1)])),_:2},1024)))),128)):(x(!0),f(q,{key:1},R(h(ce),((e,l)=>(x(),k(c,{key:l,class:"radio",value:"disabled",disabled:""},{default:b((()=>[V("span",G,T(String.fromCharCode(65+l))+". ",1),A(" "+T(e.title),1)])),_:2},1024)))),128))])])])),default:b((()=>[u.showAction?(x(),k(B,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:h(de),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:Ee,onOnShowRichText:d[9]||(d[9]=e=>fe.value=!0),onSetKey:je,onSetAnswerSetting:_e},null,8,["is-edit","is-set","isKey","examAnswerRelationType","answerCheckType"])):S("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:b((()=>[V("div",{class:w(["flex",[{"margin-bottom":h(fe)}]])},[d[12]||(d[12]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"题目:")],-1)),V("div",J,[C(p,{modelValue:h(ve),"onUpdate:modelValue":d[0]||(d[0]=e=>j(ve)?ve.value=e:null),type:"textarea",rows:2,placeholder:`【${h(ge)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),V("div",P,[d[13]||(d[13]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(x(),k(y,{key:0,modelValue:h(pe),"onUpdate:modelValue":d[1]||(d[1]=e=>j(pe)?pe.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:b((()=>[(x(!0),f(q,null,R(h(ke),(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)]),V("div",W,[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),f("div",{key:l,class:"answer-item flex flex-items-center"},[V("span",X,T(String.fromCharCode(65+l))+".",1),C(p,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+l)}`,disabled:u.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(u.type)?(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]=[A(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):S("v-if",!0),C(U,{class:"icon"},{default:b((()=>[C(h(E),{class:w([{disabled:u.isSave}]),onClick:Se},null,8,["class"])])),_:1}),C(U,{class:"icon"},{default:b((()=>[C(h(I),{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===u.examAnswerRelationType?(x(),k($,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,void(he.value=!0);var t}},{default:b((()=>[A(T(e.resultItem)+" ",1),V("span",null,T(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):S("v-if",!0),2===u.examAnswerRelationType?(x(),k($,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){re("setRelation",Ve,e)}(e)},{default:b((()=>[V("span",null,T(e.answerRelations?.length?`关联了${e.answerRelations?.length}项`:"关联检查"),1)])),_:2},1032,["onClick"])):S("v-if",!0)])))),128))]),"sort"===u.type?(x(),f("div",Y,[d[15]||(d[15]=V("div",{class:"label flex flex-justify-end"},[V("span",null,"排序答案:")],-1)),V("div",Z,[C(y,{modelValue:h(be),"onUpdate:modelValue":d[2]||(d[2]=e=>j(be)?be.value=e:null),mode:"multiple",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:b((()=>[S(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(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]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"解析:")],-1)),V("div",le,[C(p,{modelValue:h(ye),"onUpdate:modelValue":d[3]||(d[3]=e=>j(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):S("v-if",!0),h(fe)?(x(),f("div",te,[d[18]||(d[18]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"富文本:")],-1)),V("div",ae,[C(L,_({"model-value":h(xe),"onUpdate:modelValue":d[4]||(d[4]=e=>j(xe)?xe.value=e:null)},h(oe),{style:{width:"100%"}}),null,16,["model-value"]),V("div",ie,[C($,{type:"danger",onClick:Ae},{default:b((()=>d[17]||(d[17]=[A(" 删除富文本 ")]))),_:1})])])])):S("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),C(we,{modelValue:h(he),"onUpdate:modelValue":d[11]||(d[11]=e=>j(he)?he.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:b((()=>[C(se,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:b((()=>d[19]||(d[19]=[A(" 取消 ")]))),_:1}),C(se,{class:"customize-button",type:"primary",plain:"",onClick:Re},{default:b((()=>d[20]||(d[20]=[A(" 保存 ")]))),_:1})])),default:b((()=>[(x(),k(L,_({key:h(ue),"model-value":h(ce)[h(ue)].resultItem,"onUpdate:modelValue":d[10]||(d[10]=e=>h(ce)[h(ue)].resultItem=e)},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 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 c,computed as p,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 V,createTextVNode as A,toDisplayString as T,Fragment as q,renderList as R,isRef as j,mergeProps as _}from"vue";import{CirclePlus as I,Remove as E}from"@element-plus/icons-vue";import{useNamespace as U}from"@qxs-bns/hooks";import B from"../../../subject-action/src/subject-action.vue.js";import L from"../../../subject-layout/src/subject-layout.vue.js";import $ from"../../../tiny-mce-editor/src/tiny-mce-editor.vue.js";import{setGuid as K}from"@qxs-bns/utils";const z={class:"preview"},M={class:"title"},N={key:0},D={key:1},H={key:0},O=["innerHTML"],Q={class:"preview-answer"},F={class:"order"},G={class:"order"},J={style:{flex:"1"}},P={class:"margin-bottom flex flex-items-center"},W={class:"margin-bottom answer-list"},X={class:"order"},Y={key:0,class:"margin-bottom flex flex-items-center"},Z={style:{flex:"1"}},ee={key:1,class:"flex"},le={style:{flex:"1"}},te={key:2,class:"margin-bottom flex"},ae={style:{flex:"1"}},ie={class:"flex flex-justify-end"};var se=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:String,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=c(0),de=c(ne.isKey),me=c(2),ce=c([{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}]),pe=c(),ve=c(""),ye=c(""),fe=c(!1),xe=c(""),we=c(0),he=c(!1),Ce=c(""),ge=p((()=>"single"===ne.type?"单选题":"multiple"===ne.type?"多选题":"排序题")),be=c([]),ke=p((()=>{const e=[];for(let l=ce.value.length;l>1;l--)e.push({label:`至少选择${l}项`,value:l});return e.reverse()}));function Se(){ne.isSave||ce.value.push({title:"",isCorrect:!1,customAnswerId:K()})}function Ve(){fe.value=!1,xe.value=""}function Ae(){if(!ve.value)return void u.error("题目标题不能为空!");let e="",l=!1,t=null,a=0;if("multiple"===ne.type||"single"===ne.type?ce.value.forEach(((i,s)=>{i.title||(e+=`选项${String.fromCharCode(65+s)}未填写。`),i.isCorrect&&(l=!0,a++),i.resultItem&&(t=1),i.answerRelations?.length&&(t=2)})):"sort"===ne.type&&be.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===a)return void u.error("请至少设置两个正确答案");if(l&&a<pe.value)return void u.error("至少选几项与正确答案数不符")}re("save",{title:ve.value,answers:ce.value.map(((e,l)=>({...e,orderIndex:l+1}))),examExpand:be.value.map((e=>e.charCodeAt(0)-65+1)).join(","),analysis:ye.value,isSetCorrectAnswer:l,leastAnswerCount:pe.value,examRichTextContent:fe.value?xe.value:"",examAnswerRelationType:t,isKey:de.value,answerCheckType:me.value})}else u.error("选项不能重复")}function Te(){he.value=!1,Ce.value=""}function qe(){he.value=!1}function Re(e){de.value=e}function je(e){me.value=e}function _e(e,l){re("add",e,l?ne.examAnswerRelationType:null)}v((()=>ne.isEdit),(()=>{ne.isEdit&&(we.value=(new Date).getTime())}));const Ie=U("subject-single");return y((function(){if(ne.title&&(ve.value=ne.title),ne.answerCheckType&&(me.value=ne.answerCheckType),ne.answerList&&ne.answerList.length&&(ce.value=ne.answerList.map((e=>({...e,customAnswerId:e.examAnswerId||K()})))),ne.leastAnswerCount&&(pe.value=ne.leastAnswerCount),ne.examExpand&&ne.examExpand){const e=ne.examExpand.split(",");be.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&&(ye.value=ne.analysis),ne.examRichTextContent&&(xe.value=ne.examRichTextContent,fe.value=!0)})),(u,d)=>{const m=e,c=l,p=t,v=i,y=a,U=s,K=n,se=o,we=r;return x(),f("div",{class:w(h(Ie).e("single-exam"))},[C(L,{"show-edit":u.isEdit},g({preview:b((()=>[V("div",z,[V("div",null,[V("span",M,[A(T(u.orderIndex+1)+"."+T(h(ve))+" ",1),"single"===u.type?(x(),f("span",N,"(单选题)")):["multiple","sort"].includes(u.type)?(x(),f("span",D," ("+T(h(ge))+T(h(pe)?`至少选${h(pe)}项${"sort"===u.type?"并排序":""}`:"")+") ",1)):S("v-if",!0)])]),h(fe)?(x(),f("div",H,[V("div",{innerHTML:h(xe)},null,8,O)])):S("v-if",!0),V("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((()=>[V("span",F,T(String.fromCharCode(65+l))+". ",1),A(" "+T(e.title),1)])),_:2},1024)))),128)):(x(!0),f(q,{key:1},R(h(ce),((e,l)=>(x(),k(c,{key:l,class:"radio",value:"disabled",disabled:""},{default:b((()=>[V("span",G,T(String.fromCharCode(65+l))+". ",1),A(" "+T(e.title)+" "+T(e.isCorrect?"(支持选项)":"")+" "+T(e.resultItem?"(已设置结果项)":"(未设置结果项)")+" "+T(e.answerRelations?.length?"(已设置关联)":"(未设置关联)"),1)])),_:2},1024)))),128))])])])),default:b((()=>[u.showAction?(x(),k(B,{key:0,"is-edit":u.isEdit,"is-set":u.isSet,isKey:h(de),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:Ae,onEdit:d[8]||(d[8]=e=>re("edit")),onAdd:_e,onOnShowRichText:d[9]||(d[9]=e=>fe.value=!0),onSetKey:Re,onSetAnswerSetting:je},null,8,["is-edit","is-set","isKey","examAnswerRelationType","answerCheckType"])):S("v-if",!0)])),_:2},[u.isEdit?{name:"edit",fn:b((()=>[V("div",{class:w(["flex",[{"margin-bottom":h(fe)}]])},[d[12]||(d[12]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"题目:")],-1)),V("div",J,[C(p,{modelValue:h(ve),"onUpdate:modelValue":d[0]||(d[0]=e=>j(ve)?ve.value=e:null),type:"textarea",rows:2,placeholder:`【${h(ge)}】请输入问题`,disabled:u.isSave,"show-word-limit":"",maxlength:"200",class:"margin-bottom"},null,8,["modelValue","placeholder","disabled"])])],2),V("div",P,[d[13]||(d[13]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"设置:")],-1)),["multiple","sort"].includes(u.type)?(x(),k(y,{key:0,modelValue:h(pe),"onUpdate:modelValue":d[1]||(d[1]=e=>j(pe)?pe.value=e:null),style:{width:"150px"},placeholder:"至少选择几项",disabled:u.isSave},{default:b((()=>[(x(!0),f(q,null,R(h(ke),(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)]),V("div",W,[(x(!0),f(q,null,R(h(ce),((e,l)=>(x(),f("div",{key:l,class:"answer-item flex flex-items-center"},[V("span",X,T(String.fromCharCode(65+l))+".",1),C(p,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:"100",placeholder:`选项${String.fromCharCode(65+l)}`,disabled:u.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),["single","multiple"].includes(u.type)?(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]=[A(" 支持选项 ")])])),_:2},1032,["modelValue","onUpdate:modelValue","class","disabled","onChange"])):S("v-if",!0),C(U,{class:"icon"},{default:b((()=>[C(h(I),{class:w([{disabled:u.isSave}]),onClick:Se},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===u.examAnswerRelationType?(x(),k(K,{key:1,type:"primary",class:"margin-left-10",onClick:e=>{return t=l,ue.value=t,void(he.value=!0);var t}},{default:b((()=>[V("span",null,T(e.resultItem?"编辑结果":"添加结果"),1)])),_:2},1032,["onClick"])):S("v-if",!0),2===u.examAnswerRelationType?(x(),k(K,{key:2,type:"primary",class:"margin-left-10",onClick:l=>function(e){re("setRelation",ne.customId,e)}(e)},{default:b((()=>[V("span",null,T(e.answerRelations?.length?`关联了${e.answerRelations?.length}项`:"关联检查"),1)])),_:2},1032,["onClick"])):S("v-if",!0)])))),128))]),"sort"===u.type?(x(),f("div",Y,[d[15]||(d[15]=V("div",{class:"label flex flex-justify-end"},[V("span",null,"排序答案:")],-1)),V("div",Z,[C(y,{modelValue:h(be),"onUpdate:modelValue":d[2]||(d[2]=e=>j(be)?be.value=e:null),mode:"multiple",style:{width:"360px"},placeholder:"请按顺序选择排序答案","show-arrow":!0},{default:b((()=>[S(' :options="[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))" '),(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]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"解析:")],-1)),V("div",le,[C(p,{modelValue:h(ye),"onUpdate:modelValue":d[3]||(d[3]=e=>j(ye)?ye.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])])):S("v-if",!0),h(fe)?(x(),f("div",te,[d[18]||(d[18]=V("div",{class:"label flex flex-justify-center"},[V("span",null,"富文本:")],-1)),V("div",ae,[C($,_({"model-value":h(xe),"onUpdate:modelValue":d[4]||(d[4]=e=>j(xe)?xe.value=e:null)},h(oe),{style:{width:"100%"}}),null,16,["model-value"]),V("div",ie,[C(K,{type:"danger",onClick:Ve},{default:b((()=>d[17]||(d[17]=[A(" 删除富文本 ")]))),_:1})])])])):S("v-if",!0)])),key:"0"}:void 0]),1032,["show-edit"]),C(we,{modelValue:h(he),"onUpdate:modelValue":d[11]||(d[11]=e=>j(he)?he.value=e:null),title:"添加结果",class:"customize-dialog"},{footer:b((()=>[C(se,{class:"customize-button",type:"primary",plain:"",onClick:Te},{default:b((()=>d[19]||(d[19]=[A(" 取消 ")]))),_:1}),C(se,{class:"customize-button",type:"primary",plain:"",onClick:qe},{default:b((()=>d[20]||(d[20]=[A(" 保存 ")]))),_:1})])),default:b((()=>[(x(),k($,_({key:h(ue),"model-value":h(ce)[h(ue)].resultItem,"onUpdate:modelValue":d[10]||(d[10]=e=>h(ce)[h(ue)].resultItem=e)},h(oe),{style:{width:"100%"}}),null,16,["model-value"]))])),_:1},8,["modelValue"])],2)}}});export{se as default};
2
2
  //# sourceMappingURL=subject-single.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-single.vue.js","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 id?: string\n isKey: boolean\n answerCheckType: number\n}>()\nconst emits = defineEmits(['move', 'save', 'delete', 'edit', 'add', 'setRelation'])\n\nconst attrs = useAttrs()\n\nconst answersIndex = ref(0)\nconst isKey = ref(false)\nconst answerCheckType = ref(2)\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 title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref()\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个正确答案\n if (event) {\n answers.value.forEach((answer) => {\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}\nconst customId = props.id || setGuid()\nfunction setRelation(item: any) {\n emits('setRelation', customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n if (v.resultItem) {\n examAnswerRelationType = 1\n }\n if (v.answerRelations?.length) {\n examAnswerRelationType = 2\n }\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了正确答案\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个正确答案')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与正确答案数不符')\n return\n }\n }\n\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,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n if (props.isKey) {\n isKey.value = props.isKey\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList.map((item: any) => {\n return { ...item, customAnswerId: item.examAnswerId || setGuid() }\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}\n\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\n\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n // console.log(answers.value[i].resultItem, 1);\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}\n\nfunction setKey(key: boolean) {\n isKey.value = key\n}\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})\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n >\n </el-option>\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n {{ item.resultItem }}\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${item.answerRelations?.length}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n mode=\"multiple\"\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :isKey=\"isKey\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"(answers[answersIndex].resultItem as string)\" \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","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","customId","id","deleteRichText","save","ElMessage","error","msg","isSetCorrectAnswer","examAnswerRelationType","correctAnswerCount","forEach","v","i","String","fromCharCode","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onCloseResult","onSaveResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","ns","useNamespace","onMounted","answerList","examAnswerId","correctAnswerIdList","split","answer","find","answerId","toString","filter","Boolean","it","event","splice"],"mappings":"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"}
1
+ {"version":3,"file":"subject-single.vue.js","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?: string\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(2)\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 title: '',\n isCorrect: false,\n}])\n\nconst leastAnswerCount = ref()\nconst title = ref('')\nconst analysis = ref('')\nconst showRichText = ref(false)\nconst richText = ref('')\nconst startTime = ref(0)\nconst showRichContent = ref(false)\nconst resultItem = ref<string>('')\nconst titlePlaceholder = computed(() => {\n if (props.type === 'single') {\n return '单选题'\n }\n else if (props.type === 'multiple') {\n return '多选题'\n }\n else {\n return '排序题'\n }\n})\n\nconst orderList = ref<string[]>([])\n\nconst leastAnswerOptions = computed(() => {\n const items = []\n const length = answers.value.length\n for (let count = length; count > 1; count--) {\n items.push({\n label: `至少选择${count}项`,\n value: count,\n })\n }\n return items.reverse()\n})\nfunction addAnswer() {\n if (props.isSave) {\n return\n }\n answers.value.push({\n title: '',\n isCorrect: false,\n customAnswerId: setGuid()\n })\n}\n\nfunction deleteAnswer(index: number) {\n if (answers.value.length < 3 || props.isSave) {\n return\n }\n answers.value.splice(index, 1)\n}\n\nfunction setCorrect(it: any, event: any) {\n if (props.type === 'single') {\n // 单选题:确保只有一个正确答案\n if (event) {\n answers.value.forEach((answer) => {\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 emits('setRelation', props.customId, item)\n}\n\nfunction deleteRichText() {\n showRichText.value = false\n richText.value = ''\n}\n\nfunction save() {\n if (!title.value) {\n ElMessage.error('题目标题不能为空!')\n return\n }\n let msg = ''\n let isSetCorrectAnswer = false\n let examAnswerRelationType = null\n let correctAnswerCount = 0\n if (props.type === 'multiple' || props.type === 'single') {\n answers.value.forEach((v: any, i: number) => {\n if (!v.title) {\n msg += `选项${String.fromCharCode(65 + i)}未填写。`\n }\n if (v.isCorrect) {\n isSetCorrectAnswer = true\n correctAnswerCount++\n }\n if (v.resultItem) {\n examAnswerRelationType = 1\n }\n if (v.answerRelations?.length) {\n examAnswerRelationType = 2\n }\n })\n }\n else if (props.type === 'sort') {\n // 如果设置了正确答案\n if (orderList.value.length) {\n isSetCorrectAnswer = true\n }\n }\n if (msg) {\n ElMessage.error(msg)\n return\n }\n\n const uniqueAnswer = new Set(answers.value.map((item: any) => item.title))\n\n if (uniqueAnswer.size !== answers.value.length) {\n ElMessage.error('选项不能重复')\n return\n }\n\n if (props.type === 'multiple') {\n if (correctAnswerCount === 1) {\n ElMessage.error('请至少设置两个正确答案')\n return\n }\n\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount.value) {\n ElMessage.error('至少选几项与正确答案数不符')\n return\n }\n }\n\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,\n isKey: isKey.value,\n answerCheckType: answerCheckType.value\n })\n}\n\nfunction init() {\n if (props.title) {\n title.value = props.title\n }\n // const customId = props.id || setGuid()\n\n if (props.answerCheckType) {\n answerCheckType.value = props.answerCheckType\n }\n\n if (props.answerList && props.answerList.length) {\n answers.value = props.answerList.map((item: any) => {\n return { ...item, customAnswerId: item.examAnswerId || setGuid() }\n })\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}\n\nfunction onCloseResult() {\n showRichContent.value = false\n resultItem.value = ''\n}\n\nfunction onOpenResult(i: number) {\n answersIndex.value = i\n // console.log(answers.value[i].resultItem, 1);\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}\n\nfunction setKey(key: boolean) {\n isKey.value = key\n}\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})\nconst ns = useNamespace('subject-single')\n\nonMounted(init)\n</script>\n\n<template>\n <div :class=\"ns.e('single-exam')\">\n <SubjectLayout\n :show-edit=\"isEdit\"\n >\n <template #preview>\n <div class=\"preview\">\n <div>\n <span class=\"title\">\n {{ orderIndex + 1 }}.{{ title }}\n <span v-if=\"type === 'single'\">(单选题)</span>\n <span v-else-if=\"['multiple', 'sort'].includes(type)\">\n ({{ titlePlaceholder }}{{ leastAnswerCount ? `至少选${leastAnswerCount}项${type === 'sort' ? '并排序' : ''}` : '' }})\n </span>\n </span>\n </div>\n <div v-if=\"showRichText\">\n <div v-html=\"richText\" />\n </div>\n <div class=\"preview-answer\">\n <template v-if=\"type === 'sort'\">\n <el-checkbox\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n :disabled=\"true\"\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }}\n </el-checkbox>\n </template>\n <template v-else>\n <el-radio\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"radio\"\n value=\"disabled\"\n disabled\n >\n <span class=\"order\">\n {{ String.fromCharCode(65 + index) }}.\n </span>\n {{ item.title }} \n {{ item.isCorrect ? '(支持选项)' : '' }} \n {{ item.resultItem? '(已设置结果项)' : '(未设置结果项)' }} \n {{ item.answerRelations?.length ? '(已设置关联)' : '(未设置关联)' }}\n </el-radio>\n </template>\n </div>\n </div>\n </template>\n <template v-if=\"isEdit\" #edit>\n <div class=\"flex\" :class=\"[{ 'margin-bottom': showRichText }]\">\n <div class=\"label flex flex-justify-center\">\n <span>题目:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"title\"\n type=\"textarea\"\n :rows=\"2\"\n :placeholder=\"`【${titlePlaceholder}】请输入问题`\"\n :disabled=\"isSave\"\n show-word-limit\n maxlength=\"200\"\n class=\"margin-bottom\"\n />\n </div>\n </div>\n <div class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-center\">\n <span>设置:</span>\n </div>\n <el-select\n v-if=\"['multiple', 'sort'].includes(type)\"\n v-model=\"leastAnswerCount\"\n style=\"width: 150px;\"\n placeholder=\"至少选择几项\"\n :disabled=\"isSave\"\n >\n <el-option\n v-for=\"item in leastAnswerOptions\"\n :key=\"item.value\"\n :value=\"item.value\"\n :label=\"item.label\"\n >\n </el-option>\n </el-select>\n </div>\n <div class=\"margin-bottom answer-list\">\n <div\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n class=\"answer-item flex flex-items-center\"\n >\n <span class=\"order\">{{ String.fromCharCode(65 + index) }}.</span>\n <el-input\n v-model=\"item.title\"\n class=\"input\"\n show-word-limit\n maxlength=\"100\"\n :placeholder=\"`选项${String.fromCharCode(65 + index)}`\"\n :disabled=\"isSave\"\n />\n <el-checkbox\n v-if=\"['single', 'multiple'].includes(type)\"\n v-model=\"item.isCorrect\"\n :class=\"[{ 'is-correct': item.isCorrect }]\"\n :disabled=\"isSave\"\n style=\"margin-left: 10px;\"\n @change=\"(event) => setCorrect(item, event)\"\n >\n 支持选项 \n </el-checkbox>\n <el-icon class=\"icon\">\n <CirclePlus\n :class=\"[{ disabled: isSave }]\"\n @click=\"addAnswer\"\n />\n </el-icon>\n <el-icon class=\"icon\">\n <Remove\n :class=\"[{ disabled: answers.length < 3 || isSave }]\"\n @click=\"deleteAnswer(index)\"\n />\n </el-icon>\n <el-link\n v-if=\"examAnswerRelationType === 1\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"onOpenResult(index)\"\n >\n <span>{{ item.resultItem ? '编辑结果' : '添加结果' }}</span>\n </el-link>\n <el-link\n v-if=\"examAnswerRelationType === 2\"\n type=\"primary\"\n class=\"margin-left-10\"\n @click=\"setRelation(item)\"\n >\n <span>{{ item.answerRelations?.length ? `关联了${item.answerRelations?.length}项` : '关联检查' }}</span>\n </el-link>\n </div>\n </div>\n <div v-if=\"type === 'sort'\" class=\"margin-bottom flex flex-items-center\">\n <div class=\"label flex flex-justify-end\">\n <span>排序答案:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-select\n v-model=\"orderList\"\n mode=\"multiple\"\n style=\"width: 360px;\"\n placeholder=\"请按顺序选择排序答案\"\n :show-arrow=\"true\"\n >\n <!-- :options=\"[...Array(answers.length)].map((_, i) => ({ value: String.fromCharCode(65 + i) }))\" -->\n <el-option\n v-for=\"(item, index) in answers\"\n :key=\"index\"\n :label=\"item.title\"\n :value=\"String.fromCharCode(65 + index)\"\n />\n </el-select>\n </div>\n </div>\n <div\n v-if=\"showAnalysis\"\n class=\"flex\"\n >\n <div class=\"label flex flex-justify-center\">\n <span>解析:</span>\n </div>\n <div style=\"flex: 1;\">\n <el-input\n v-model=\"analysis\"\n type=\"textarea\"\n :rows=\"2\"\n placeholder=\"请输入题目解析\"\n />\n </div>\n </div>\n <div v-if=\"showRichText\" class=\"margin-bottom flex\">\n <div class=\"label flex flex-justify-center\">\n <span>富文本:</span>\n </div>\n <div style=\"flex: 1;\">\n <TinyMceEditor v-model:model-value=\"richText\" v-bind=\"attrs\" style=\"width: 100%;\" />\n <div class=\"flex flex-justify-end\">\n <el-link\n type=\"danger\"\n @click=\"deleteRichText\"\n >\n 删除富文本\n </el-link>\n </div>\n </div>\n </div>\n </template>\n <SubjectAction\n v-if=\"showAction\"\n :is-edit=\"isEdit\"\n :is-set=\"isSet\"\n :isKey=\"isKey\"\n :examAnswerRelationType=\"props.examAnswerRelationType\"\n :answerCheckType=\"answerCheckType\"\n @move-up=\"emits('move', 'up')\"\n @move-down=\"emits('move', 'down')\"\n @delete=\"emits('delete')\"\n @save=\"save\"\n @edit=\"emits('edit')\"\n @add=\"add\"\n @onShowRichText=\"showRichText = true\"\n @setKey=\"setKey\"\n @setAnswerSetting=\"setAnswerSetting\"\n />\n </SubjectLayout>\n <el-dialog\n v-model=\"showRichContent\"\n title=\"添加结果\"\n class=\"customize-dialog\"\n >\n <TinyMceEditor\n :key=\"answersIndex\"\n v-model:model-value=\"(answers[answersIndex].resultItem as string)\" \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","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","examAnswerRelationType","correctAnswerCount","forEach","v","i","String","fromCharCode","answerRelations","Set","map","item","size","index","orderIndex","examExpand","charCodeAt","join","examRichTextContent","onCloseResult","onSaveResult","setKey","key","setAnswerSetting","add","canSet","watch","isEdit","Date","getTime","ns","useNamespace","onMounted","answerList","examAnswerId","correctAnswerIdList","split","id","answer","find","answerId","toString","filter","Boolean","it","event","splice","customId"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- import{defineComponent as e,ref as t,useAttrs as n,watch as s,createElementBlock as i,openBlock as a,normalizeClass as o,unref as l,createElementVNode as r,Fragment as d,renderList as c,createBlock as x,createCommentVNode as p,mergeProps as m}from"vue";import u from"./components/subject-blank-fill.vue.js";import w from"./components/subject-scale.vue.js";import v from"./components/subject-single.vue.js";import y from"./components/subject-text-fill.vue.js";import h from"./components/SubjectRichText.vue.js";import T from"./components/SubjectPageEnd.vue.js";import{useNamespace as f}from"@qxs-bns/hooks";import{ElMessage as A}from"element-plus/es";const R={class:"subject-list-wrapper"};var E=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:E,emit:S}){const C=e,g=t([]),D=S,j=n();function b(){let e=0,t=!1;return g.value.map(((n,s,i)=>{"page_end"===n.answerType&&(e++,t=s===i.length-1)})),t?e:e+1}function _(e,t,n){console.log(t,"index"),t||0===t?g.value.splice(t+1,0,{answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:n}):g.value.push({answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:n})}function k(e,t){if("up"===t&&e>0){const[t]=g.value.splice(e,1);g.value.splice(e-1,0,t)}else if("down"===t&&e<g.value.length-1){const[t]=g.value.splice(e,1);g.value.splice(e+1,0,t)}}function M(e,t){for(let n=0;n<g.value.length;n++)e===n&&(g.value[e]={...g.value[e],...t,isEdit:!1})}function L(e){g.value.splice(e,1),A.success("删除成功")}function P(e,t){D("setRelation",e,t)}E({addSubject:_,currentList:g,uploadExcel:function(e){g.value=g.value.concat(e)},addExam:function(e){const t=[];e.answers?.map((e=>{t.push({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})})),g.value.push({...e,answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:t,isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1})},setAnswerRelation:function(e,t,n){e.length&&g.value.forEach((s=>{s.customId===t&&s.answer.forEach((t=>{t.customAnswerId===n&&(t.answerRelations=e)}))}))}}),s((()=>C.subjectList),(e=>{e&&(g.value=[...e])}),{immediate:!0});const I=f("subject-list");return(e,t)=>(a(),i("div",{class:o(l(I).e("list-exam"))},[r("div",R,[(a(!0),i(d,null,c(l(g),((t,n)=>(a(),i("div",{key:n+t.examId||t.title},[["single","multiple","sort"].includes(t.answerType)?(a(),x(v,m({key:0,ref_for:!0},l(j),{"order-index":n,title:t.title,type:t.answerType,isKey:t.isKey,"is-save":!t.isRealCanDel,id:t.examId,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"least-answer-count":t.leastAnswerCount,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,"exam-expand":t.examExpand,answerCheckType:t.answerCheckType,"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onSetRelation:P,onMove:e=>k(n,e),onDelete:e=>L(n),onSave:e=>M(n,e),onEdit:e=>t.isEdit=!0,onAdd:(e,t)=>_(e,n,t)}),null,16,["order-index","title","type","isKey","is-save","id","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answerCheckType","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===t.answerType?(a(),x(w,m({key:1,ref_for:!0},l(j),{"order-index":n,title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"is-edit":t.isEdit||!1,"scale-question-list":t.scaleQuestionList,"show-action":!e.isPreview,"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>k(n,e),onDelete:e=>L(n),onSave:e=>M(n,e),onEdit:e=>t.isEdit=!0,onAdd:e=>_(e,n,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===t.answerType?(a(),x(u,m({key:2,ref_for:!0},l(j),{"order-index":n,title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>k(n,e),onDelete:e=>L(n),onSave:e=>M(n,e),onEdit:e=>t.isEdit=!0,onAdd:e=>_(e,n,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-answer-setting-v-o","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===t.answerType?(a(),x(y,m({key:3,ref_for:!0},l(j),{"order-index":n,title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-expand":t.examExpand,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},examAnswerRelationType:t.examAnswerRelationType,"exam-rich-text-content":t.examRichTextContent,onMove:e=>k(n,e),onDelete:e=>L(n),onSave:e=>M(n,e),onEdit:e=>t.isEdit=!0,onAdd:e=>_(e,n,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","examAnswerRelationType","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===t.answerType?(a(),x(h,m({key:4,ref_for:!0},l(j),{"order-index":n,richTextContent:t.richTextContent,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,onMove:e=>k(n,e),onDelete:e=>L(n),examAnswerRelationType:t.examAnswerRelationType,onSave:e=>M(n,e),onEdit:e=>t.isEdit=!0,onAdd:e=>_(e,n,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===t.answerType?(a(),x(T,{"total-page":b(),key:n,"current-page-index":(e=>{const t=g.value.filter((e=>"page_end"===e.answerType));let n=0;return t.forEach(((t,s)=>{e===t.id&&(n=s+1)})),n})(t.id),item:t,"order-index":n,"is-edit":t.isEdit||!1,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>k(n,e),onDelete:e=>L(n),onSave:e=>M(n,e),onEdit:e=>t.isEdit=!0,onAdd:e=>_(e,n,null)},null,8,["total-page","current-page-index","item","order-index","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):p("v-if",!0)])))),128))])],2))}});export{E as default};
1
+ import{defineComponent as e,ref as t,useAttrs as s,watch as n,createElementBlock as i,openBlock as a,normalizeClass as o,unref as l,createElementVNode as r,Fragment as d,renderList as c,createBlock as x,createCommentVNode as m,mergeProps as u}from"vue";import p from"./components/subject-blank-fill.vue.js";import w from"./components/subject-scale.vue.js";import v from"./components/subject-single.vue.js";import y from"./components/subject-text-fill.vue.js";import h from"./components/SubjectRichText.vue.js";import T from"./components/SubjectPageEnd.vue.js";import{useNamespace as f}from"@qxs-bns/hooks";import{setGuid as A}from"@qxs-bns/utils";import{ElMessage as R}from"element-plus/es";const E={class:"subject-list-wrapper"};var S=e({name:"QxsSubjectList",__name:"subject-list",props:{subjectList:{type:Array,required:!0},isPreview:{type:Boolean,required:!0}},emits:["setRelation"],setup(e,{expose:S,emit:C}){const g=e,D=t([]),j=C,b=s();function _(){let e=0,t=!1;return D.value.map(((s,n,i)=>{"page_end"===s.answerType&&(e++,t=n===i.length-1)})),t?e:e+1}function k(e,t,s){console.log(t,"index"),t||0===t?D.value.splice(t+1,0,{customId:A(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s}):D.value.push({customId:A(),answerType:e,analysis:"",scaleQuestionList:[],isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:s})}function I(e,t){if("up"===t&&e>0){const[t]=D.value.splice(e,1);D.value.splice(e-1,0,t)}else if("down"===t&&e<D.value.length-1){const[t]=D.value.splice(e,1);D.value.splice(e+1,0,t)}}function M(e,t){for(let s=0;s<D.value.length;s++)e===s&&(D.value[e]={...D.value[e],...t,isEdit:!1})}function L(e){D.value.splice(e,1),R.success("删除成功")}function P(e,t){j("setRelation",e,t)}S({addSubject:k,currentList:D,uploadExcel:function(e){D.value=D.value.concat(e)},addExam:function(e){const t=[];e.answers?.map((e=>{t.push({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect})})),D.value.push({...e,customId:e.examId||A(),answerType:e.richTextContent?"rich_text":e.examTypeEnum,answers:t,isSave:!1,isEdit:!0,isRealCanDel:!0,hasSet:!1})},setAnswerRelation:function(e,t,s){e.length&&D.value.forEach((n=>{n.customId===t&&n.answer.forEach((t=>{t.customAnswerId===s&&(t.answerRelations=e)}))}))}}),n((()=>g.subjectList),(e=>{e&&(D.value=[...e])}),{immediate:!0});const q=f("subject-list");return(e,t)=>(a(),i("div",{class:o(l(q).e("list-exam"))},[r("div",E,[(a(!0),i(d,null,c(l(D),((t,s)=>(a(),i("div",{key:s+t.examId||t.title},[["single","multiple","sort"].includes(t.answerType)?(a(),x(v,u({key:0,ref_for:!0},l(b),{"order-index":s,title:t.title,type:t.answerType,isKey:t.isKey,"is-save":!t.isRealCanDel,customId:t.customId,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"least-answer-count":t.leastAnswerCount,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,"exam-expand":t.examExpand,answerCheckType:t.answerCheckType,"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onSetRelation:P,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:(e,t)=>k(e,s,t)}),null,16,["order-index","title","type","isKey","is-save","customId","is-set","answer-list","analysis","least-answer-count","is-edit","show-action","exam-expand","answerCheckType","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"scale"===t.answerType?(a(),x(w,u({key:1,ref_for:!0},l(b),{"order-index":s,title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"is-edit":t.isEdit||!1,"scale-question-list":t.scaleQuestionList,"show-action":!e.isPreview,"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","is-edit","scale-question-list","show-action","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"blank_fill"===t.answerType?(a(),x(p,u({key:2,ref_for:!0},l(b),{"order-index":s,title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},"exam-rich-text-content":t.examRichTextContent,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-answer-setting-v-o","exam-rich-text-content","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):"text_fill"===t.answerType?(a(),x(y,u({key:3,ref_for:!0},l(b),{"order-index":s,title:t.title,"is-save":!t.isRealCanDel,"is-set":t.hasSet||!1,"answer-list":t.answers,analysis:t.analysis,"show-action":!e.isPreview,"is-edit":t.isEdit||!1,"exam-expand":t.examExpand,"exam-answer-setting-v-o":t.examAnswerSettingVO||{},examAnswerRelationType:t.examAnswerRelationType,"exam-rich-text-content":t.examRichTextContent,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)}),null,16,["order-index","title","is-save","is-set","answer-list","analysis","show-action","is-edit","exam-expand","exam-answer-setting-v-o","examAnswerRelationType","exam-rich-text-content","onMove","onDelete","onSave","onEdit","onAdd"])):"rich_text"===t.answerType?(a(),x(h,u({key:4,ref_for:!0},l(b),{"order-index":s,richTextContent:t.richTextContent,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,"is-edit":t.isEdit||!1,"show-action":!e.isPreview,onMove:e=>I(s,e),onDelete:e=>L(s),examAnswerRelationType:t.examAnswerRelationType,onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)}),null,16,["order-index","richTextContent","is-set","is-save","is-edit","show-action","onMove","onDelete","examAnswerRelationType","onSave","onEdit","onAdd"])):"page_end"===t.answerType?(a(),x(T,{"total-page":_(),key:s,"current-page-index":(e=>{const t=D.value.filter((e=>"page_end"===e.answerType));let s=0;return t.forEach(((t,n)=>{e===t.id&&(s=n+1)})),s})(t.id),item:t,"order-index":s,"is-edit":t.isEdit||!1,"is-set":t.hasSet||!1,"is-save":!t.isRealCanDel,examAnswerRelationType:t.examAnswerRelationType,onMove:e=>I(s,e),onDelete:e=>L(s),onSave:e=>M(s,e),onEdit:e=>t.isEdit=!0,onAdd:e=>k(e,s,null)},null,8,["total-page","current-page-index","item","order-index","is-edit","is-set","is-save","examAnswerRelationType","onMove","onDelete","onSave","onEdit","onAdd"])):m("v-if",!0)])))),128))])],2))}});export{S as default};
2
2
  //# sourceMappingURL=subject-list.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-list.vue.js","sources":["../../../../../../packages/components/src/subject-list/src/subject-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// import isEqual from 'lodash/isEqual'\nimport SubjectBlankFill from './components/subject-blank-fill.vue'\nimport SubjectScale from './components/subject-scale.vue'\nimport SubjectSingle from './components/subject-single.vue'\nimport SubjectTextFill from './components/subject-text-fill.vue'\nimport SubjectRichText from './components/SubjectRichText.vue'\nimport SubjectPageEnd from './components/SubjectPageEnd.vue'\nimport { useNamespace } from '@qxs-bns/hooks'\ndefineOptions({\n name: 'QxsSubjectList',\n})\n\nconst props = defineProps<{\n subjectList: any[]\n isPreview: boolean\n}>()\nconst currentList = ref([] as any)\nconst emits = defineEmits(['setRelation'])\n\nconst attrs = useAttrs()\n\ndefineExpose({\n addSubject,\n currentList,\n uploadExcel,\n addExam,\n setAnswerRelation,\n})\n\nfunction totalPageIndex() {\n let totalPageIndex = 0\n let isLastPageIndex = false\n currentList.value.map((v: any, i: number, arr: any) => {\n if (v.answerType === 'page_end') {\n totalPageIndex++\n isLastPageIndex = i === arr.length - 1\n }\n })\n // 假设最后是一个分页器认为是最后一页\n return isLastPageIndex ? totalPageIndex : totalPageIndex + 1\n}\n\nfunction currentPageIndex() {\n return (currentId: any) => {\n const currentPageList = currentList.value.filter(\n (v: any) => v.answerType === 'page_end'\n )\n let currentIndex = 0\n currentPageList.forEach((c: any, i: number) => {\n if (currentId === c.id) {\n currentIndex = i + 1\n }\n })\n return currentIndex\n }\n}\n\nfunction addSubject(type: string, index: number, examAnswerRelationType: number | null) {\n console.log(index, 'index')\n if (index || index === 0) {\n currentList.value.splice(index + 1, 0, {\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n else {\n currentList.value.push({\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n}\n\nfunction addExam(item: any) {\n const answerList: any[] = []\n item.answers?.map((v: any) => {\n answerList.push({\n ...v,\n title: v.answer,\n answerId: v.examAnswerId,\n isCorrect: v.isCorrect,\n })\n })\n currentList.value.push({\n ...item,\n answerType: item.richTextContent ? 'rich_text' : item.examTypeEnum,\n answers: answerList,\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n })\n}\nfunction uploadExcel(list: any[]) {\n currentList.value = currentList.value.concat(list)\n}\n\nfunction move(index: number, type: 'up' | 'down') {\n if (type === 'up' && index > 0) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index - 1, 0, item)\n }\n else if (type === 'down' && index < currentList.value.length - 1) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index + 1, 0, item)\n }\n}\n\nfunction saveSubject(index: number, item: any) {\n for (let idx = 0; idx < currentList.value.length; idx++) {\n if (index === idx) {\n currentList.value[index] =\n {\n ...currentList.value[index],\n ...item,\n isEdit: false,\n }\n }\n }\n}\n\nfunction deleteSubject(index: number) {\n currentList.value.splice(index, 1)\n ElMessage.success('删除成功')\n}\n\nfunction setRelation(examId: string, examAnswers: any) {\n emits('setRelation', examId, examAnswers)\n}\n\nfunction setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string,) {\n // 给examId设置答案关联\n if (answerRelations.length) {\n currentList.value.forEach((c: any) => {\n if (c.customId === customId) {\n c.answer.forEach((c: any) => {\n if (c.customAnswerId === customAnswerId) {\n c.answerRelations = answerRelations\n }\n })\n }\n })\n }\n}\nwatch(() => props.subjectList, (newList: any) => {\n if (newList) {\n currentList.value = [...newList]\n }\n}, { immediate: true })\nconst ns = useNamespace('subject-list')\n</script>\n\n<template>\n <div :class=\"ns.e('list-exam')\">\n <div class=\"subject-list-wrapper\">\n <div v-for=\"(item, index) in currentList\" :key=\"index + item.examId || item.title\">\n <template v-if=\"['single', 'multiple', 'sort'].includes(item.answerType)\">\n <SubjectSingle v-bind=\"attrs\" :order-index=\"index\" :title=\"item.title\" :type=\"item.answerType\"\n :isKey=\"item.isKey\" :is-save=\"!item.isRealCanDel\" :id=\"item.examId\" :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\" :analysis=\"item.analysis\" :least-answer-count=\"item.leastAnswerCount\"\n :is-edit=\"item.isEdit || false\" :show-action=\"!isPreview\" :exam-expand=\"item.examExpand\"\n :answerCheckType=\"item.answerCheckType\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @setRelation=\"setRelation\"\n @move=\"(type: 'up' | 'down') => move(index, type)\" @delete=\"deleteSubject(index)\"\n @save=\"item => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type, examAnswerRelationType) => addSubject(type, index, examAnswerRelationType)\" />\n </template>\n <SubjectScale v-bind=\"attrs\" v-else-if=\"item.answerType === 'scale'\" :order-index=\"index\" :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :is-edit=\"item.isEdit || false\" :scale-question-list=\"item.scaleQuestionList\"\n :show-action=\"!isPreview\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectBlankFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'blank_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectTextFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'text_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-expand=\"item.examExpand\" :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" :exam-rich-text-content=\"item.examRichTextContent\"\n @move=\"(type: 'up' | 'down') => move(index, type)\" @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectRichText v-bind=\"attrs\" v-else-if=\"item.answerType === 'rich_text'\" :order-index=\"index\"\n :richTextContent=\"item.richTextContent\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :is-edit=\"item.isEdit || false\" :show-action=\"!isPreview\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" :examAnswerRelationType=\"item.examAnswerRelationType\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectPageEnd v-else-if=\"item.answerType === 'page_end'\" :total-page=\"totalPageIndex()\" :key=\"index\"\n :current-page-index=\"currentPageIndex()(item.id)\" :item=\"item\" :order-index=\"index\"\n :is-edit=\"item.isEdit || false\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","currentList","ref","emits","__emit","attrs","useAttrs","totalPageIndex","isLastPageIndex","value","map","v","i","arr","answerType","length","addSubject","type","index","examAnswerRelationType","console","log","splice","analysis","scaleQuestionList","isSave","isEdit","isRealCanDel","hasSet","push","move","item","saveSubject","idx","deleteSubject","ElMessage","success","setRelation","examId","examAnswers","__expose","uploadExcel","list","concat","addExam","answerList","answers","title","answer","answerId","examAnswerId","isCorrect","richTextContent","examTypeEnum","setAnswerRelation","answerRelations","customId","customAnswerId","forEach","c","watch","subjectList","newList","immediate","ns","useNamespace","currentId","currentPageList","filter","currentIndex","id"],"mappings":"y2BAaA,MAAMA,EAAQC,EAIRC,EAAcC,EAAI,IAClBC,EAAQC,EAERC,EAAQC,IAUd,SAASC,IACP,IAAIA,EAAiB,EACjBC,GAAkB,EAQf,OAPPP,EAAYQ,MAAMC,KAAI,CAACC,EAAQC,EAAWC,KACnB,aAAjBF,EAAEG,aACJP,IACkBC,EAAAI,IAAMC,EAAIE,OAAS,EAAA,IAIlCP,EAAkBD,EAAiBA,EAAiB,CAAA,CAkBpD,SAAAS,EAAWC,EAAcC,EAAeC,GACvCC,QAAAC,IAAIH,EAAO,SACfA,GAAmB,IAAVA,EACXjB,EAAYQ,MAAMa,OAAOJ,EAAQ,EAAG,EAAG,CACrCJ,WAAYG,EACZM,SAAU,GACVC,kBAAmB,GACnBC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRT,2BAIFlB,EAAYQ,MAAMoB,KAAK,CACrBf,WAAYG,EACZM,SAAU,GACVC,kBAAmB,GACnBC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRT,0BAEJ,CA2BO,SAAAW,EAAKZ,EAAeD,GACvB,GAAS,OAATA,GAAiBC,EAAQ,EAAG,CAC9B,MAAOa,GAAQ9B,EAAYQ,MAAMa,OAAOJ,EAAO,GAC/CjB,EAAYQ,MAAMa,OAAOJ,EAAQ,EAAG,EAAGa,EAAI,SAE3B,SAATd,GAAmBC,EAAQjB,EAAYQ,MAAMM,OAAS,EAAG,CAChE,MAAOgB,GAAQ9B,EAAYQ,MAAMa,OAAOJ,EAAO,GAC/CjB,EAAYQ,MAAMa,OAAOJ,EAAQ,EAAG,EAAGa,EAAI,CAC7C,CAGO,SAAAC,EAAYd,EAAea,GAClC,IAAA,IAASE,EAAM,EAAGA,EAAMhC,EAAYQ,MAAMM,OAAQkB,IAC5Cf,IAAUe,IACAhC,EAAAQ,MAAMS,GAClB,IACKjB,EAAYQ,MAAMS,MAClBa,EACHL,QAAQ,GAGd,CAGF,SAASQ,EAAchB,GACTjB,EAAAQ,MAAMa,OAAOJ,EAAO,GAChCiB,EAAUC,QAAQ,OAAM,CAGjB,SAAAC,EAAYC,EAAgBC,GAC7BpC,EAAA,cAAemC,EAAQC,EAAW,CAtH7BC,EAAA,CACXxB,aACAf,cACAwC,YAiFF,SAAqBC,GACnBzC,EAAYQ,MAAQR,EAAYQ,MAAMkC,OAAOD,EAAI,EAjFjDE,QA4DF,SAAiBb,GACf,MAAMc,EAAoB,GACrBd,EAAAe,SAASpC,KAAKC,IACjBkC,EAAWhB,KAAK,IACXlB,EACHoC,MAAOpC,EAAEqC,OACTC,SAAUtC,EAAEuC,aACZC,UAAWxC,EAAEwC,WACd,IAEHlD,EAAYQ,MAAMoB,KAAK,IAClBE,EACHjB,WAAYiB,EAAKqB,gBAAkB,YAAcrB,EAAKsB,aACtDP,QAASD,EACTpB,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,QAAQ,GACT,EA7ED0B,kBAoHO,SAAkBC,EAAsBC,EAAkBC,GAE7DF,EAAgBxC,QACNd,EAAAQ,MAAMiD,SAASC,IACrBA,EAAEH,WAAaA,GACfG,EAAAX,OAAOU,SAASC,IACZA,EAAEF,iBAAmBA,IACvBE,EAAEJ,gBAAkBA,EAAA,GAEvB,GAGP,IAEFK,GAAM,IAAM7D,EAAM8D,cAAcC,IAC1BA,IACU7D,EAAAQ,MAAQ,IAAIqD,GAAO,GAEhC,CAAEC,WAAW,IACV,MAAAC,EAAKC,EAAa,mrHAtHf,CAACC,IACA,MAAAC,EAAkBlE,EAAYQ,MAAM2D,QACvCzD,GAA4B,aAAjBA,EAAEG,aAEhB,IAAIuD,EAAe,EAMZ,OALSF,EAAAT,SAAQ,CAACC,EAAQ/C,KAC3BsD,IAAcP,EAAEW,KAClBD,EAAezD,EAAI,EAAA,IAGhByD,CAAA"}
1
+ {"version":3,"file":"subject-list.vue.js","sources":["../../../../../../packages/components/src/subject-list/src/subject-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\n// import isEqual from 'lodash/isEqual'\nimport SubjectBlankFill from './components/subject-blank-fill.vue'\nimport SubjectScale from './components/subject-scale.vue'\nimport SubjectSingle from './components/subject-single.vue'\nimport SubjectTextFill from './components/subject-text-fill.vue'\nimport SubjectRichText from './components/SubjectRichText.vue'\nimport SubjectPageEnd from './components/SubjectPageEnd.vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport { setGuid } from '@qxs-bns/utils'\n\ndefineOptions({\n name: 'QxsSubjectList',\n})\n\nconst props = defineProps<{\n subjectList: any[]\n isPreview: boolean\n}>()\nconst currentList = ref([] as any)\nconst emits = defineEmits(['setRelation'])\n\nconst attrs = useAttrs()\n\ndefineExpose({\n addSubject,\n currentList,\n uploadExcel,\n addExam,\n setAnswerRelation,\n})\n\nfunction totalPageIndex() {\n let totalPageIndex = 0\n let isLastPageIndex = false\n currentList.value.map((v: any, i: number, arr: any) => {\n if (v.answerType === 'page_end') {\n totalPageIndex++\n isLastPageIndex = i === arr.length - 1\n }\n })\n // 假设最后是一个分页器认为是最后一页\n return isLastPageIndex ? totalPageIndex : totalPageIndex + 1\n}\n\nfunction currentPageIndex() {\n return (currentId: any) => {\n const currentPageList = currentList.value.filter(\n (v: any) => v.answerType === 'page_end'\n )\n let currentIndex = 0\n currentPageList.forEach((c: any, i: number) => {\n if (currentId === c.id) {\n currentIndex = i + 1\n }\n })\n return currentIndex\n }\n}\n\nfunction addSubject(type: string, index: number, examAnswerRelationType: number | null) {\n console.log(index, 'index')\n if (index || index === 0) {\n currentList.value.splice(index + 1, 0, {\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n else {\n currentList.value.push({\n customId: setGuid(),\n answerType: type,\n analysis: '',\n scaleQuestionList: [],\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n examAnswerRelationType: examAnswerRelationType,\n })\n }\n}\n\nfunction addExam(item: any) {\n const answerList: any[] = []\n item.answers?.map((v: any) => {\n answerList.push({\n ...v,\n title: v.answer,\n answerId: v.examAnswerId,\n isCorrect: v.isCorrect,\n })\n })\n currentList.value.push({\n ...item,\n customId: item.examId || setGuid(),\n answerType: item.richTextContent ? 'rich_text' : item.examTypeEnum,\n answers: answerList,\n isSave: false,\n isEdit: true,\n isRealCanDel: true,\n hasSet: false,\n })\n}\nfunction uploadExcel(list: any[]) {\n currentList.value = currentList.value.concat(list)\n}\n\nfunction move(index: number, type: 'up' | 'down') {\n if (type === 'up' && index > 0) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index - 1, 0, item)\n }\n else if (type === 'down' && index < currentList.value.length - 1) {\n const [item] = currentList.value.splice(index, 1)\n currentList.value.splice(index + 1, 0, item)\n }\n}\n\nfunction saveSubject(index: number, item: any) {\n for (let idx = 0; idx < currentList.value.length; idx++) {\n if (index === idx) {\n currentList.value[index] =\n {\n ...currentList.value[index],\n ...item,\n isEdit: false,\n }\n }\n }\n}\n\nfunction deleteSubject(index: number) {\n currentList.value.splice(index, 1)\n ElMessage.success('删除成功')\n}\n\nfunction setRelation(examId: string, examAnswers: any) {\n emits('setRelation', examId, examAnswers)\n}\n\nfunction setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string,) {\n // 给examId设置答案关联\n if (answerRelations.length) {\n currentList.value.forEach((c: any) => {\n if (c.customId === customId) {\n c.answer.forEach((c: any) => {\n if (c.customAnswerId === customAnswerId) {\n c.answerRelations = answerRelations\n }\n })\n }\n })\n }\n}\nwatch(() => props.subjectList, (newList: any) => {\n if (newList) {\n currentList.value = [...newList]\n }\n}, { immediate: true })\nconst ns = useNamespace('subject-list')\n</script>\n\n<template>\n <div :class=\"ns.e('list-exam')\">\n <div class=\"subject-list-wrapper\">\n <div v-for=\"(item, index) in currentList\" :key=\"index + item.examId || item.title\">\n <template v-if=\"['single', 'multiple', 'sort'].includes(item.answerType)\">\n <SubjectSingle v-bind=\"attrs\" :order-index=\"index\" :title=\"item.title\" :type=\"item.answerType\"\n :isKey=\"item.isKey\" :is-save=\"!item.isRealCanDel\" :customId=\"item.customId\" :is-set=\"item.hasSet || false\"\n :answer-list=\"item.answers\" :analysis=\"item.analysis\" :least-answer-count=\"item.leastAnswerCount\"\n :is-edit=\"item.isEdit || false\" :show-action=\"!isPreview\" :exam-expand=\"item.examExpand\"\n :answerCheckType=\"item.answerCheckType\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @setRelation=\"setRelation\"\n @move=\"(type: 'up' | 'down') => move(index, type)\" @delete=\"deleteSubject(index)\"\n @save=\"item => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type, examAnswerRelationType) => addSubject(type, index, examAnswerRelationType)\" />\n </template>\n <SubjectScale v-bind=\"attrs\" v-else-if=\"item.answerType === 'scale'\" :order-index=\"index\" :title=\"item.title\"\n :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :is-edit=\"item.isEdit || false\" :scale-question-list=\"item.scaleQuestionList\"\n :show-action=\"!isPreview\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectBlankFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'blank_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\" :exam-rich-text-content=\"item.examRichTextContent\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectTextFill v-bind=\"attrs\" v-else-if=\"item.answerType === 'text_fill'\" :order-index=\"index\"\n :title=\"item.title\" :is-save=\"!item.isRealCanDel\" :is-set=\"item.hasSet || false\" :answer-list=\"item.answers\"\n :analysis=\"item.analysis\" :show-action=\"!isPreview\" :is-edit=\"item.isEdit || false\"\n :exam-expand=\"item.examExpand\" :exam-answer-setting-v-o=\"item.examAnswerSettingVO || {}\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" :exam-rich-text-content=\"item.examRichTextContent\"\n @move=\"(type: 'up' | 'down') => move(index, type)\" @delete=\"deleteSubject(index)\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectRichText v-bind=\"attrs\" v-else-if=\"item.answerType === 'rich_text'\" :order-index=\"index\"\n :richTextContent=\"item.richTextContent\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :is-edit=\"item.isEdit || false\" :show-action=\"!isPreview\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" :examAnswerRelationType=\"item.examAnswerRelationType\"\n @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n <SubjectPageEnd v-else-if=\"item.answerType === 'page_end'\" :total-page=\"totalPageIndex()\" :key=\"index\"\n :current-page-index=\"currentPageIndex()(item.id)\" :item=\"item\" :order-index=\"index\"\n :is-edit=\"item.isEdit || false\" :is-set=\"item.hasSet || false\" :is-save=\"!item.isRealCanDel\"\n :examAnswerRelationType=\"item.examAnswerRelationType\" @move=\"(type: 'up' | 'down') => move(index, type)\"\n @delete=\"deleteSubject(index)\" @save=\"(item: any) => saveSubject(index, item)\" @edit=\"item.isEdit = true\"\n @add=\"(type: string) => addSubject(type, index, null)\" />\n </div>\n </div>\n </div>\n</template>\n"],"names":["props","__props","currentList","ref","emits","__emit","attrs","useAttrs","totalPageIndex","isLastPageIndex","value","map","v","i","arr","answerType","length","addSubject","type","index","examAnswerRelationType","console","log","splice","customId","setGuid","analysis","scaleQuestionList","isSave","isEdit","isRealCanDel","hasSet","push","move","item","saveSubject","idx","deleteSubject","ElMessage","success","setRelation","examId","examAnswers","__expose","uploadExcel","list","concat","addExam","answerList","answers","title","answer","answerId","examAnswerId","isCorrect","richTextContent","examTypeEnum","setAnswerRelation","answerRelations","customAnswerId","forEach","c","watch","subjectList","newList","immediate","ns","useNamespace","currentId","currentPageList","filter","currentIndex","id"],"mappings":"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"}
@@ -1,2 +1,2 @@
1
- "use strict";exports.version="0.0.23";
1
+ "use strict";exports.version="0.0.25";
2
2
  //# sourceMappingURL=package.json.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subject-action.vue.js","sources":["../../../../../../packages/components/src/subject-action/src/subject-action.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Bottom, Delete, Edit, Top } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectType from '../../subject-type/src/subject-type.vue'\n\ndefineOptions({\n name: 'QxsSubjectAction',\n})\nconst props = defineProps({\n isEdit: {\n type: Boolean,\n },\n isSet: {\n type: Boolean,\n default: false,\n },\n isKey: {\n type: Boolean,\n default: false,\n },\n answerCheckType: {\n type: Number,\n default: 2\n },\n showOtherOption: {\n type: Boolean,\n default: true,\n },\n examAnswerRelationType: {\n type: Number,\n default: null\n },\n pageEnd: {\n type: Boolean,\n default: false\n }\n})\nconst key = ref(props.isKey)\nconst showAnswerSetting = ref(false)\nconst emits = defineEmits(['moveUp', 'moveDown', 'delete', 'save', 'edit', 'add', 'onShowRichText', 'setKey', 'setAnswerSetting'])\nconst answerType = ref(props.answerCheckType)\nconst ns = useNamespace('subject-action')\n\nfunction onSaveSetting() {\n showAnswerSetting.value = false\n emits('setAnswerSetting', answerType)\n}\n\nfunction selectExam(type:string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n</script>\n\n<template>\n <div :class=\"ns.e('action-exam')\">\n <div class=\"action flex flex-justify-between\" :class=\"[{ active: isEdit }]\">\n <el-popover trigger=\"click\">\n <template #reference>\n <el-link type=\"primary\">\n +在此题后加入新题\n </el-link>\n </template>\n <SubjectType @select=\"selectExam\" />\n </el-popover>\n <el-link type=\"primary\" @click=\"emits('onShowRichText')\" v-if=\"showOtherOption\">\n +添加题目描述(图文)\n </el-link>\n <el-link type=\"primary\" @click=\"showAnswerSetting = true\" v-if=\"showOtherOption\">\n 答题设置\n </el-link>\n <el-checkbox v-model=\"key\" label=\"核心题\" @change=\"emits('setKey', key)\" v-if=\"showOtherOption\"/>\n <div>\n <div v-if=\"isSet\" class=\"has-set\">\n *此题设置了跳题逻辑\n </div>\n <div v-else class=\"flex flex-justify-end\" style=\"width: 100%;\">\n <template v-if=\"!isEdit\">\n <el-button class=\"btn-margin\" @click=\"emits('edit')\" v-if=\"!pageEnd\">\n <template #icon>\n <el-icon>\n <Edit />\n </el-icon>\n </template>\n 编辑\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n <template #icon>\n <el-icon>\n <Delete />\n </el-icon>\n </template>\n 删除\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveUp')\">\n <template #icon>\n <el-icon>\n <Top />\n </el-icon>\n </template>\n 上移\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveDown')\">\n <template #icon>\n <el-icon>\n <Bottom />\n </el-icon>\n </template>\n 下移\n </el-button>\n </template>\n <template v-else>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n 删除\n </el-button>\n <el-button type=\"primary\" @click=\"emits('save')\">\n 完成编辑\n </el-button>\n </template>\n </div>\n </div>\n <el-dialog\n v-model=\"showAnswerSetting\"\n title=\"答题设置\"\n class=\"customize-dialog\"\n >\n <el-radio-group v-model=\"answerType\" class=\"vertical-radio-group\">\n <el-radio :value=\"1\">必须全部都是支持选项,方可下一步</el-radio>\n <el-radio :value=\"2\">无需判断是否是支持选项</el-radio>\n <el-radio :value=\"3\">包含全部支持选项,即可下一步</el-radio>\n </el-radio-group>\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"showAnswerSetting = false\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveSetting\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n </div>\n</template>\n"],"names":["props","__props","key","ref","isKey","showAnswerSetting","emits","__emit","answerType","answerCheckType","ns","useNamespace","onSaveSetting","value","selectExam","type","canSet","examAnswerRelationType"],"mappings":"ixBAQA,MAAMA,EAAQC,EA6BRC,EAAMC,EAAAA,IAAIH,EAAMI,OAChBC,EAAoBF,OAAI,GACxBG,EAAQC,EACRC,EAAaL,EAAAA,IAAIH,EAAMS,iBACvBC,EAAKC,eAAa,kBAExB,SAASC,IACPP,EAAkBQ,OAAQ,EAC1BP,EAAM,mBAAoBE,EAAU,CAG7B,SAAAM,EAAWC,EAAaC,GAChCV,EAAM,MAAOS,EAAMC,EAAQhB,EAAMiB,uBAAwB,KAAI"}
1
+ {"version":3,"file":"subject-action.vue.js","sources":["../../../../../../packages/components/src/subject-action/src/subject-action.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Bottom, Delete, Edit, Top } from '@element-plus/icons-vue'\nimport { useNamespace } from '@qxs-bns/hooks'\nimport SubjectType from '../../subject-type/src/subject-type.vue'\n\ndefineOptions({\n name: 'QxsSubjectAction',\n})\nconst props = defineProps({\n isEdit: {\n type: Boolean,\n },\n isSet: {\n type: Boolean,\n default: false,\n },\n isKey: {\n type: Boolean,\n default: false,\n },\n answerCheckType: {\n type: Number,\n default: 2\n },\n showOtherOption: {\n type: Boolean,\n default: true,\n },\n examAnswerRelationType: {\n type: Number,\n default: null\n },\n pageEnd: {\n type: Boolean,\n default: false\n }\n})\nconst isKey = ref(props.isKey)\nconst showAnswerSetting = ref(false)\nconst emits = defineEmits(['moveUp', 'moveDown', 'delete', 'save', 'edit', 'add', 'onShowRichText', 'setKey', 'setAnswerSetting'])\nconst answerType = ref(props.answerCheckType)\nconst ns = useNamespace('subject-action')\n\nfunction onSaveSetting() {\n showAnswerSetting.value = false\n emits('setAnswerSetting', answerType)\n}\n\nfunction selectExam(type:string, canSet: boolean) {\n emits('add', type, canSet? props.examAnswerRelationType: null)\n}\n</script>\n\n<template>\n <div :class=\"ns.e('action-exam')\">\n <div class=\"action flex flex-justify-between\" :class=\"[{ active: isEdit }]\">\n <el-popover trigger=\"click\">\n <template #reference>\n <el-link type=\"primary\">\n +在此题后加入新题\n </el-link>\n </template>\n <SubjectType @select=\"selectExam\" />\n </el-popover>\n <el-link type=\"primary\" @click=\"emits('onShowRichText')\" v-if=\"showOtherOption\">\n +添加题目描述(图文)\n </el-link>\n <el-link type=\"primary\" @click=\"showAnswerSetting = true\" v-if=\"showOtherOption\">\n 答题设置\n </el-link>\n <el-checkbox v-model=\"isKey\" label=\"核心题\" @change=\"emits('setKey', isKey)\" v-if=\"showOtherOption\"/>\n <div>\n <div v-if=\"isSet\" class=\"has-set\">\n *此题设置了跳题逻辑\n </div>\n <div v-else class=\"flex flex-justify-end\" style=\"width: 100%;\">\n <template v-if=\"!isEdit\">\n <el-button class=\"btn-margin\" @click=\"emits('edit')\" v-if=\"!pageEnd\">\n <template #icon>\n <el-icon>\n <Edit />\n </el-icon>\n </template>\n 编辑\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n <template #icon>\n <el-icon>\n <Delete />\n </el-icon>\n </template>\n 删除\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveUp')\">\n <template #icon>\n <el-icon>\n <Top />\n </el-icon>\n </template>\n 上移\n </el-button>\n <el-button class=\"btn-margin\" @click=\"emits('moveDown')\">\n <template #icon>\n <el-icon>\n <Bottom />\n </el-icon>\n </template>\n 下移\n </el-button>\n </template>\n <template v-else>\n <el-button class=\"btn-margin\" @click=\"emits('delete')\">\n 删除\n </el-button>\n <el-button type=\"primary\" @click=\"emits('save')\">\n 完成编辑\n </el-button>\n </template>\n </div>\n </div>\n <el-dialog\n v-model=\"showAnswerSetting\"\n title=\"答题设置\"\n class=\"customize-dialog\"\n >\n <el-radio-group v-model=\"answerType\" class=\"vertical-radio-group\">\n <el-radio :value=\"1\">必须全部都是支持选项,方可下一步</el-radio>\n <el-radio :value=\"2\">无需判断是否是支持选项</el-radio>\n <el-radio :value=\"3\">包含全部支持选项,即可下一步</el-radio>\n </el-radio-group>\n <template #footer>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"showAnswerSetting = false\"\n >\n 取消\n </el-button>\n <el-button\n class=\"customize-button\"\n type=\"primary\"\n plain\n @click=\"onSaveSetting\"\n >\n 保存\n </el-button>\n </template>\n </el-dialog>\n </div>\n </div>\n</template>\n"],"names":["props","__props","isKey","ref","showAnswerSetting","emits","__emit","answerType","answerCheckType","ns","useNamespace","onSaveSetting","value","selectExam","type","canSet","examAnswerRelationType"],"mappings":"ixBAQA,MAAMA,EAAQC,EA6BRC,EAAQC,EAAAA,IAAIH,EAAME,OAClBE,EAAoBD,OAAI,GACxBE,EAAQC,EACRC,EAAaJ,EAAAA,IAAIH,EAAMQ,iBACvBC,EAAKC,eAAa,kBAExB,SAASC,IACPP,EAAkBQ,OAAQ,EAC1BP,EAAM,mBAAoBE,EAAU,CAG7B,SAAAM,EAAWC,EAAaC,GAChCV,EAAM,MAAOS,EAAMC,EAAQf,EAAMgB,uBAAwB,KAAI"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es"),l=require("vue"),t=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),n=require("element-plus"),r=require("../../../subject-action/src/subject-action.vue.js"),s=require("../../../subject-layout/src/subject-layout.vue.js"),o=require("../../../tiny-mce-editor/src/tiny-mce-editor.vue.js");const i={class:"preview"},d={class:"title"},c={key:0},u=["innerHTML"],m={class:"answer-radio flex flex-col"},f={style:{flex:"1"}},p={class:"answer flex"},v={class:"flex"},x={class:"answer-list flex-col"},V={class:"order"},y={class:"flex",style:{"margin-bottom":"20px"}},h={style:{flex:"1"}},N={key:0,class:"margin-bottom flex"},w={style:{flex:"1"}},E={class:"flex flex-justify-end"};var k=l.defineComponent({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(k,{emit:C}){const g=k,B=C,b=l.useAttrs(),q=l.ref([{title:""},{title:""},{title:""},{title:""},{title:""}]),S=l.ref(""),j=l.ref(""),R=l.ref(""),L=l.ref(!1),T=l.ref(""),_=l.ref([]),M=l.computed((()=>Math.ceil(24/(q.value.length+1))));function A(){5!==q.value.length&&q.value.push({title:""})}function D(){L.value=!1,T.value=""}function U(){if(!S.value)return void n.ElMessage.error("题目标题不能为空!");let e="";q.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?n.ElMessage.error(e):R.value?(_.value=R.value.split("\n").filter((e=>e)),B("save",{title:S.value,answers:q.value,analysis:j.value,scaleQuestionList:_.value,examRichTextContent:L.value?T.value:""})):n.ElMessage.error("行标题不能为空!")}l.ref(!1),l.onMounted((function(){g.title&&(S.value=g.title),g.answerList&&g.answerList.length&&(q.value=g.answerList),g.analysis&&(j.value=g.analysis),g.scaleQuestionList&&(_.value=g.scaleQuestionList,R.value=_.value.join("\n")),g.examRichTextContent&&(T.value=g.examRichTextContent,L.value=!0)}));const O=a.useNamespace("subject-scale");return(a,n)=>{const k=e.ElCol,C=e.ElRow,Q=e.ElRadio,z=e.ElInput,F=e.ElIcon,I=e.ElLink;return l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(l.unref(O).e("scale-exam"))},[l.createVNode(s.default,{"show-edit":a.isEdit},{preview:l.withCtx((()=>[l.createElementVNode("div",i,[l.createElementVNode("div",null,[l.createElementVNode("span",d,l.toDisplayString(a.orderIndex+1)+"."+l.toDisplayString(l.unref(S))+"(量表题)",1),l.unref(L)?(l.openBlock(),l.createElementBlock("div",c,[l.createElementVNode("div",{innerHTML:l.unref(T)},null,8,u)])):l.createCommentVNode("v-if",!0)]),l.createElementVNode("div",m,[l.createVNode(C,{style:{padding:"10px 0"}},{default:l.withCtx((()=>[l.createVNode(k,{span:l.unref(M)},null,8,["span"]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(q),(e=>(l.openBlock(),l.createBlock(k,{key:e.title,class:"flex flex-center",span:l.unref(M)},{default:l.withCtx((()=>[l.createElementVNode("span",null,l.toDisplayString(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(_),(e=>(l.openBlock(),l.createBlock(C,{key:e,style:{padding:"10px 0"}},{default:l.withCtx((()=>[l.createVNode(k,{span:l.unref(M),class:"flex flex-center"},{default:l.withCtx((()=>[l.createElementVNode("span",null,l.toDisplayString(e),1)])),_:2},1032,["span"]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(q).length,(e=>(l.openBlock(),l.createBlock(k,{key:e,class:"radio-item flex flex-center",span:l.unref(M)},{default:l.withCtx((()=>[l.createVNode(Q,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:l.withCtx((()=>[l.createElementVNode("div",{class:l.normalizeClass(["flex",[{"margin-bottom":l.unref(L)}]])},[n[10]||(n[10]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"题目:")],-1)),l.createElementVNode("div",f,[l.createVNode(z,{modelValue:l.unref(S),"onUpdate:modelValue":n[0]||(n[0]=e=>l.isRef(S)?S.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:a.isSave},null,8,["modelValue","disabled"])])],2),l.createElementVNode("div",p,[n[11]||(n[11]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"行标题:")],-1)),l.createElementVNode("div",v,[l.createVNode(z,{modelValue:l.unref(R),"onUpdate:modelValue":n[1]||(n[1]=e=>l.isRef(R)?R.value=e:null),modelModifiers:{trim:!0},type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),l.createElementVNode("div",x,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(q),((e,n)=>(l.openBlock(),l.createElementBlock("div",{key:n,class:"answer-item flex flex-items-center"},[l.createElementVNode("span",V,l.toDisplayString(String.fromCharCode(65+n))+".",1),l.createVNode(z,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+n)}`,disabled:a.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),l.createCommentVNode(' <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 /> '),l.createVNode(F,{class:"icon"},{default:l.withCtx((()=>[l.createVNode(l.unref(t.CirclePlus),{class:l.normalizeClass([{disabled:5===l.unref(q).length}]),onClick:A},null,8,["class"])])),_:1}),l.createVNode(F,{class:"icon"},{default:l.withCtx((()=>[l.createVNode(l.unref(t.Remove),{class:l.normalizeClass([{disabled:l.unref(q).length<3}]),onClick:e=>function(e){q.value.length<3||q.value.splice(e,1)}(n)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),l.createElementVNode("div",y,[n[12]||(n[12]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"解析:")],-1)),l.createElementVNode("div",h,[l.createVNode(z,{modelValue:l.unref(j),"onUpdate:modelValue":n[2]||(n[2]=e=>l.isRef(j)?j.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),l.unref(L)?(l.openBlock(),l.createElementBlock("div",N,[n[14]||(n[14]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"富文本:")],-1)),l.createElementVNode("div",w,[l.createVNode(o.default,l.mergeProps({"model-value":l.unref(T),"onUpdate:modelValue":n[3]||(n[3]=e=>l.isRef(T)?T.value=e:null)},l.unref(b),{style:{width:"100%"}}),null,16,["model-value"]),l.createElementVNode("div",E,[l.createVNode(I,{type:"danger",onClick:D},{default:l.withCtx((()=>n[13]||(n[13]=[l.createTextVNode(" 删除富文本 ")]))),_:1})])])])):l.createCommentVNode("v-if",!0)])),default:l.withCtx((()=>[a.showAction?(l.openBlock(),l.createBlock(r.default,{key:0,"is-edit":a.isEdit,"is-set":a.isSet,showOtherOption:!1,examAnswerRelationType:g.examAnswerRelationType,onMoveUp:n[4]||(n[4]=e=>B("move","up")),onMoveDown:n[5]||(n[5]=e=>B("move","down")),onDelete:n[6]||(n[6]=e=>B("delete")),onSave:U,onEdit:n[7]||(n[7]=e=>B("edit")),onAdd:n[8]||(n[8]=e=>B("add",e)),onOnShowRichText:n[9]||(n[9]=e=>L.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):l.createCommentVNode("v-if",!0)])),_:1},8,["show-edit"])],2)}}});exports.default=k;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("element-plus/es"),l=require("vue"),t=require("@element-plus/icons-vue"),a=require("@qxs-bns/hooks"),n=require("element-plus"),r=require("../../../subject-action/src/subject-action.vue.js"),s=require("../../../subject-layout/src/subject-layout.vue.js"),o=require("../../../tiny-mce-editor/src/tiny-mce-editor.vue.js");const i={class:"preview"},d={class:"title"},c={key:0},u=["innerHTML"],m={class:"answer-radio flex flex-col"},f={style:{flex:"1"}},p={class:"answer flex"},v={class:"flex"},x={class:"answer-list flex-col"},V={class:"order"},y={class:"flex",style:{"margin-bottom":"20px"}},h={style:{flex:"1"}},N={key:0,class:"margin-bottom flex"},w={style:{flex:"1"}},E={class:"flex flex-justify-end"};var k=l.defineComponent({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(k,{emit:C}){const g=k,B=C,b=l.useAttrs(),q=l.ref([{title:""},{title:""},{title:""},{title:""},{title:""}]),S=l.ref(""),j=l.ref(""),R=l.ref(""),L=l.ref(!1),T=l.ref(""),_=l.ref([]),M=l.computed((()=>Math.ceil(24/(q.value.length+1))));function A(){5!==q.value.length&&q.value.push({title:""})}function D(){L.value=!1,T.value=""}function U(){if(!S.value)return void n.ElMessage.error("题目标题不能为空!");let e="";q.value.forEach(((l,t)=>{l.title||(e+=`选项${String.fromCharCode(65+t)}未填写。`)})),e?n.ElMessage.error(e):R.value?(_.value=R.value.split("\n").filter((e=>e)),B("save",{title:S.value,answers:q.value,analysis:j.value,scaleQuestionList:_.value,examRichTextContent:L.value?T.value:""})):n.ElMessage.error("行标题不能为空!")}l.onMounted((function(){g.title&&(S.value=g.title),g.answerList&&g.answerList.length&&(q.value=g.answerList),g.analysis&&(j.value=g.analysis),g.scaleQuestionList&&(_.value=g.scaleQuestionList,R.value=_.value.join("\n")),g.examRichTextContent&&(T.value=g.examRichTextContent,L.value=!0)}));const O=a.useNamespace("subject-scale");return(a,n)=>{const k=e.ElCol,C=e.ElRow,Q=e.ElRadio,z=e.ElInput,F=e.ElIcon,I=e.ElLink;return l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(l.unref(O).e("scale-exam"))},[l.createVNode(s.default,{"show-edit":a.isEdit},{preview:l.withCtx((()=>[l.createElementVNode("div",i,[l.createElementVNode("div",null,[l.createElementVNode("span",d,l.toDisplayString(a.orderIndex+1)+"."+l.toDisplayString(l.unref(S))+"(量表题)",1),l.unref(L)?(l.openBlock(),l.createElementBlock("div",c,[l.createElementVNode("div",{innerHTML:l.unref(T)},null,8,u)])):l.createCommentVNode("v-if",!0)]),l.createElementVNode("div",m,[l.createVNode(C,{style:{padding:"10px 0"}},{default:l.withCtx((()=>[l.createVNode(k,{span:l.unref(M)},null,8,["span"]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(q),(e=>(l.openBlock(),l.createBlock(k,{key:e.title,class:"flex flex-center",span:l.unref(M)},{default:l.withCtx((()=>[l.createElementVNode("span",null,l.toDisplayString(e.title),1)])),_:2},1032,["span"])))),128))])),_:1}),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(_),(e=>(l.openBlock(),l.createBlock(C,{key:e,style:{padding:"10px 0"}},{default:l.withCtx((()=>[l.createVNode(k,{span:l.unref(M),class:"flex flex-center"},{default:l.withCtx((()=>[l.createElementVNode("span",null,l.toDisplayString(e),1)])),_:2},1032,["span"]),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(q).length,(e=>(l.openBlock(),l.createBlock(k,{key:e,class:"radio-item flex flex-center",span:l.unref(M)},{default:l.withCtx((()=>[l.createVNode(Q,{disabled:!0})])),_:2},1032,["span"])))),128))])),_:2},1024)))),128))])])])),edit:l.withCtx((()=>[l.createElementVNode("div",{class:l.normalizeClass(["flex",[{"margin-bottom":l.unref(L)}]])},[n[10]||(n[10]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"题目:")],-1)),l.createElementVNode("div",f,[l.createVNode(z,{modelValue:l.unref(S),"onUpdate:modelValue":n[0]||(n[0]=e=>l.isRef(S)?S.value=e:null),type:"textarea",rows:2,placeholder:"【量表题】请输入问题",disabled:a.isSave},null,8,["modelValue","disabled"])])],2),l.createElementVNode("div",p,[n[11]||(n[11]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"行标题:")],-1)),l.createElementVNode("div",v,[l.createVNode(z,{modelValue:l.unref(R),"onUpdate:modelValue":n[1]||(n[1]=e=>l.isRef(R)?R.value=e:null),modelModifiers:{trim:!0},type:"textarea",placeholder:"请输入行标题",style:{width:"160px"},rows:10},null,8,["modelValue"]),l.createElementVNode("div",x,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(q),((e,n)=>(l.openBlock(),l.createElementBlock("div",{key:n,class:"answer-item flex flex-items-center"},[l.createElementVNode("span",V,l.toDisplayString(String.fromCharCode(65+n))+".",1),l.createVNode(z,{modelValue:e.title,"onUpdate:modelValue":l=>e.title=l,class:"input","show-word-limit":"",maxlength:10,placeholder:`选项${String.fromCharCode(65+n)}`,disabled:a.isSave},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),l.createCommentVNode(' <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 /> '),l.createVNode(F,{class:"icon"},{default:l.withCtx((()=>[l.createVNode(l.unref(t.CirclePlus),{class:l.normalizeClass([{disabled:5===l.unref(q).length}]),onClick:A},null,8,["class"])])),_:1}),l.createVNode(F,{class:"icon"},{default:l.withCtx((()=>[l.createVNode(l.unref(t.Remove),{class:l.normalizeClass([{disabled:l.unref(q).length<3}]),onClick:e=>function(e){q.value.length<3||q.value.splice(e,1)}(n)},null,8,["class","onClick"])])),_:2},1024)])))),128))])])]),l.createElementVNode("div",y,[n[12]||(n[12]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"解析:")],-1)),l.createElementVNode("div",h,[l.createVNode(z,{modelValue:l.unref(j),"onUpdate:modelValue":n[2]||(n[2]=e=>l.isRef(j)?j.value=e:null),type:"textarea",rows:2,placeholder:"请输入题目解析"},null,8,["modelValue"])])]),l.unref(L)?(l.openBlock(),l.createElementBlock("div",N,[n[14]||(n[14]=l.createElementVNode("div",{class:"label flex flex-justify-center"},[l.createElementVNode("span",null,"富文本:")],-1)),l.createElementVNode("div",w,[l.createVNode(o.default,l.mergeProps({"model-value":l.unref(T),"onUpdate:modelValue":n[3]||(n[3]=e=>l.isRef(T)?T.value=e:null)},l.unref(b),{style:{width:"100%"}}),null,16,["model-value"]),l.createElementVNode("div",E,[l.createVNode(I,{type:"danger",onClick:D},{default:l.withCtx((()=>n[13]||(n[13]=[l.createTextVNode(" 删除富文本 ")]))),_:1})])])])):l.createCommentVNode("v-if",!0)])),default:l.withCtx((()=>[a.showAction?(l.openBlock(),l.createBlock(r.default,{key:0,"is-edit":a.isEdit,"is-set":a.isSet,showOtherOption:!1,examAnswerRelationType:g.examAnswerRelationType,onMoveUp:n[4]||(n[4]=e=>B("move","up")),onMoveDown:n[5]||(n[5]=e=>B("move","down")),onDelete:n[6]||(n[6]=e=>B("delete")),onSave:U,onEdit:n[7]||(n[7]=e=>B("edit")),onAdd:n[8]||(n[8]=e=>B("add",e)),onOnShowRichText:n[9]||(n[9]=e=>L.value=!0)},null,8,["is-edit","is-set","examAnswerRelationType"])):l.createCommentVNode("v-if",!0)])),_:1},8,["show-edit"])],2)}}});exports.default=k;
2
2
  //# sourceMappingURL=subject-scale.vue.js.map