2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
/* empty css */import{n as m}from"./vueComponentNormalizer.9ef17bb1.js";import{F as y}from"./FormLayout.c7820bdd.js";import{T as g}from"./TableLayout.05a39499.js";import{D as _}from"./DialogLayout.e3af3567.js";import{S as v}from"./SearchTreeMenu.cf3d6165.js";import{Q as w}from"./QuestionItem.1944680c.js";import{Q as b}from"./QueryInput.7afa399e.js";import{s as Q,e as x,a as S,p as C,g as L,f as k,c as $,d as q,b as A}from"./questions.7b7a7919.js";import{u as f,w as F}from"./xlsx.db07aefa.js";/* empty css *//* empty css */import"./ActionBar.1725b1a3.js";/* empty css *//* empty css *//* empty css */import"./questionInfoMapJsonTrans.58e126b5.js";import"./index.f5168bf8.js";var I=function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"v-page classify_page"},[e("SearchTreeMenu",{directives:[{name:"loading",rawName:"v-loading",value:t.classify_loading,expression:"classify_loading"}],ref:"treeMenuRef",attrs:{title:"\u8BD5\u9898\u5206\u7C7B\u5217\u8868","tree-data":t.question_classify_list},on:{"current-change":t.change,onCreate:t.toCreateClassify,onDelete:t.toDeleteclassify,onEdit:t.toEditClassify}}),e("div",{directives:[{name:"loading",rawName:"v-loading",value:t.questions_list_loading,expression:"questions_list_loading"}],staticClass:"v-ctx"},[e("FormLayout",{ref:"formLayoutRef",attrs:{items:t.formItems,model:t.form,rules:t.rules,"label-width":"70px","label-position":"right",inline:!0},scopedSlots:t._u([{key:"title",fn:function(){return[e("QueryInput",{on:{query:t.pagingFindList},model:{value:t.form.title,callback:function(i){t.$set(t.form,"title",i)},expression:"form.title"}})]},proxy:!0},{key:"type",fn:function(){return[e("el-select",{staticStyle:{width:"100px"},attrs:{placeholder:"\u9898\u578B",clearable:""},on:{change:t.pagingFindList},model:{value:t.form.type,callback:function(i){t.$set(t.form,"type",i)},expression:"form.type"}},t._l(t.paramsOptions.questionType,function(i){return e("el-option",{key:i.id,attrs:{label:i.name,value:i.id}})}),1)]},proxy:!0},{key:"difficultyLevel",fn:function(){return[e("el-select",{staticStyle:{width:"100px"},attrs:{placeholder:"\u96BE\u5EA6",clearable:""},on:{change:t.pagingFindList},model:{value:t.form.difficultyLevel,callback:function(i){t.$set(t.form,"difficultyLevel",i)},expression:"form.difficultyLevel"}},t._l(t.paramsOptions.difficultyLevel,function(i){return e("el-option",{key:i.id,attrs:{label:i.name,value:i.id}})}),1)]},proxy:!0},{key:"btns",fn:function(){return[e("el-button",{attrs:{type:"danger",round:""},on:{click:t.deleteQuestions}},[t._v("\u5220\u9664\u9009\u4E2D")]),e("el-button",{attrs:{round:""},on:{click:t.importExcel}},[t._v("\u5BFC\u5165")]),e("el-button",{attrs:{round:""},on:{click:t.exportAllQuestions}},[t._v("\u5BFC\u51FA")]),e("el-button",{attrs:{type:"primary",round:""},on:{click:t.addQuestionHandler}},[t._v("\u6DFB\u52A0\u8BD5\u9898")])]},proxy:!0}])}),e("TableLayout",{attrs:{column:t.column,data:t.table_data,pageInfo:t.page_info,selection:""},on:{"current-change":function(i){return t.pagingChange({currentPage:i})},"size-change":function(i){return t.pagingChange({pageSize:i})},"selection-change":t.handleSelectionChange},scopedSlots:t._u([{key:"action",fn:function(i){return[e("el-button",{attrs:{type:"text",icon:"i-j-ksap-bianji2"},on:{click:function(n){return t.editQuestion(i.row)}}},[t._v("\u7F16\u8F91")]),e("el-button",{attrs:{type:"text",icon:"i-j-fbks-yulan"},on:{click:function(n){t.currentQuestion=i.row,t.previewQuestionShow=!0}}},[t._v("\u9884\u89C8")]),e("el-button",{staticStyle:{color:"#f04343 !important"},attrs:{type:"text",icon:"i-j-ksap-shanchu"},on:{click:function(n){return t.deleteQuestions(n,i.row)}}},[t._v("\u5220\u9664")])]}},{key:"student",fn:function(i){return[i.row.creatorId===t.$store.user.id?e("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(n){return t.changeItemStatus(n,i.row)}},model:{value:i.row.student,callback:function(n){t.$set(i.row,"student",n)},expression:"props.row.student"}}):t._e()]}}])})],1),e("DialogLayout",{attrs:{visible:t.previewQuestionShow,title:"\u9884\u89C8",actionBarOption:{noCencel:!0,noConfirm:!0},shadowBar:!1,width:"500px"},on:{onCancel:function(i){t.previewQuestionShow=!1}}},[e("div",[e("QuestionItem",{attrs:{questionInfo:t.currentQuestion,mode:6}})],1)])],1)},P=[];const T={components:{SearchTreeMenu:v,TableLayout:g,FormLayout:y,QuestionItem:w,QueryInput:b,DialogLayout:_},data:()=>({previewQuestionShow:!1,currentQuestion:null,question_classify_list:[],classify_default:[],table_data:[],page_info:{currentPage:1,pageSize:10,total:0},current_classify_id:null,classify_loading:!1,questions_list_loading:!1,form:{title:"",type:null,difficultyLevel:null},rules:[],formItems:[],paramsOptions:{},tableSelectionsList:[]}),created(){this.formItems=[{prop:"title"},{prop:"type"},{prop:"difficultyLevel"},{prop:"btns",model:{class:"gy-btns"}}],this.rules={},this.column=[{prop:"title",label:"\u9898\u76EE",width:200,align:"center","show-overflow-tooltip":!0},{prop:"classify",label:"\u8BD5\u9898\u5206\u7C7B",align:"center","show-overflow-tooltip":!0},{prop:"type",label:"\u8BD5\u9898\u7C7B\u578B",width:100,align:"center","show-overflow-tooltip":!0},{prop:"difficultyLevel",label:"\u8BD5\u9898\u96BE\u5EA6",width:100,align:"center","show-overflow-tooltip":!0},{prop:"createTime",label:"\u521B\u5EFA\u65F6\u95F4",width:100,align:"center","show-overflow-tooltip":!0},{prop:"creator",label:"\u521B\u5EFA\u4EBA",align:"center","show-overflow-tooltip":!0},{prop:"action",label:"\u64CD\u4F5C",width:200,align:"center","show-overflow-tooltip":!0},{prop:"student",label:"\u5B66\u5458\u53EF\u9009",width:80,align:"center","show-overflow-tooltip":!0}],this.findAllQuestionsClassify()},activated(){this.pagingFindList(),this.findAllQueryParams()},methods:{changeItemStatus(t,s){this.changeQuestionStudentUse(s,t)},changeQuestionStudentUse(t,s){const e={id:t.id,student:s};Q(e).then(i=>{i.code!==0&&(paperItem.student=s===1?0:1,this.$message.error("\u4FEE\u6539\u5931\u8D25"))})},exportAllQuestions(){let t=this.current_classify_id;(this.current_classify_id==="system"||!this.current_classify_id)&&(t="");const s=this.classify_default.find(e=>e.id===t);x(t).then(e=>{const{data:i}=e,n=i.reduce((a,o,c)=>{let l=a.find(h=>h.sheetName===o.\u7C7B\u578B);return l?(delete o.\u7C7B\u578B,l.data.push(o)):(l={sheetName:o.\u7C7B\u578B,data:[]},delete o.\u7C7B\u578B,l.data.push(o),a.push(l)),a},[]),r=[];n.forEach(a=>{const o=a.data,c=f.json_to_sheet(o);c["!cols"]=[{wch:60},{wch:10},{wch:30},{wch:40},{wch:40},{wch:40}],r.push({name:a.sheetName,ws:c})});const d=f.book_new();r.forEach(a=>{f.book_append_sheet(d,a.ws,a.name)});let u="";s&&(u+=s.name+" - ",this.$message(`\u60A8\u5F53\u524D\u9009\u4E2D\u7684\u3010${s.name}\u3011\u5206\u7C7B\uFF0C\u5DF2\u5BFC\u51FA\u8BE5\u5206\u7C7B\u4E0B\u7684\u8BD5\u9898`)),u+=new Date().format("yyyy-MM-dd hh-mm-ss"),F(d,u+".xlsx")})},toEditClassify(t){if(t.id==="system")return this.$message("\u6839\u5206\u7C7B\u4E0D\u80FD\u4FEE\u6539");this.$prompt("\u8BF7\u8F93\u5165\u65B0\u5206\u7C7B\u540D\uFF1A","\u7F16\u8F91",{inputPattern:/.{1,}/,inputErrorMessage:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D"}).then(({value:s})=>{this.classify_loading=!0,S({...t,name:s}).then(e=>{this.$message.success("\u4FEE\u6539\u6210\u529F"),this.findAllQuestionsClassify()}).finally(e=>{this.classify_loading=!1})}).catch(()=>{})},importExcel(){this.$router.push({path:"/assessment-evaluation/question-bank-manage/add-modify-question",query:{activeTag:-1}})},editQuestion(t){this.$router.push({path:"/assessment-evaluation/question-bank-manage/add-modify-question/"+t.id})},addQuestionHandler(){this.$router.push({path:"/assessment-evaluation/question-bank-manage/add-modify-question"})},handleSelectionChange(t){this.tableSelectionsList=t},pagingChange(t){typeof t.currentPage!="number"&&typeof t.pageSize!="number"||(this.page_info={...this.page_info,...t},this.pagingFindList())},initPageInfo(){this.page_info={currentPage:1,pageSize:this.page_info.pageSize,total:0}},pagingFindList(t){t instanceof PointerEvent&&this.initPageInfo();let s=this.current_classify_id;s==="system"&&(s=null),this.questions_list_loading=!0,C({...this.page_info,classifyId:s,...this.form}).then(e=>{const{currentPage:i,pageSize:n,total:r}=e.data;this.table_data=e.data.data,this.table_data.length===0&&this.page_info.currentPage!=1&&(this.initPageInfo(),this.pagingFindList()),this.page_info={currentPage:i,pageSize:n,total:r}}).finally(e=>{this.questions_list_loading=!1})},async findAllQueryParams(){const{data:t}=await L();this.paramsOptions=t},async findAllQuestionsClassify(){const{data:t}=await k(),s=[{id:"system",name:"\u8BD5\u9898\u5206\u7C7B",disabled:!0,children:[]}];this.classify_default=t,this.questionClassifyMap={},this.questionClassifyMap=t.toTree(),s[0].children=this.questionClassifyMap.tree,this.question_classify_list=s},async change(t){this.current_classify_id=t.id,this.pagingFindList()},toCreateClassify(t){(t==null?void 0:t.id)==="system"&&(t=null),this.$prompt("\u8BF7\u8F93\u5165\u5206\u7C7B\u540D","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88"}).then(async({value:s})=>{const e={name:s,pid:t==null?0:t.id,level:t==null?1:t.level+1};await $(e),this.findAllQuestionsClassify()}).catch(s=>{})},deleteQuestions(t,s){if(this.tableSelectionsList.length===0&&s==null)this.$message.error("\u8BF7\u5148\u9009\u62E9\u8981\u5220\u9664\u7684\u9879\u76EE");else{let e=this.tableSelectionsList;s&&(e=[s]),this.$confirm("\u786E\u8BA4\u5220\u9664\u5417?","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(i=>{this.questions_list_loading=!0,q(e.map(n=>n.id)).then(n=>{this.pagingFindList(),this.questions_list_loading=!1})})}},toDeleteclassify(t){t.id!=="system"&&new Promise((s,e)=>{this.$confirm("\u6B64\u64CD\u4F5C\u5C06\u6C38\u4E45\u5220\u9664\u6B64\u5206\u7C7B\uFF0C\u53CA\u5176\u5B50\u7EA7\u5206\u7C7B\uFF0C\u8BF7\u786E\u8BA4\u540E\u5220\u9664?","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(i=>s()).catch(i=>e())}).then(s=>{this.classify_loading=!0,A(t.id).finally(()=>{this.findAllQuestionsClassify(),this.$refs.treeMenuRef.setCurrentKey(),this.classify_loading=!1})}).catch(s=>{})}}},p={};var M=m(T,I,P,!1,E,null,null,null);function E(t){for(let s in p)this[s]=p[s]}const et=function(){return M.exports}();export{et as default};
|