/* empty css */import{n as o}from"./vueComponentNormalizer.9ef17bb1.js";import{F as c}from"./FormLayout.c7820bdd.js";import{T as u}from"./TableLayout.05a39499.js";/* empty css */import{S as f}from"./SearchTreeMenu.cf3d6165.js";import{e as p,p as d,f as h,c as _,b as g,d as m}from"./exam.a3ef7d5b.js";import{Q as y}from"./QueryInput.7afa399e.js";/* empty css *//* empty css *//* empty css */import"./index.f5168bf8.js";var v=function(){var t=this,a=t.$createElement,e=t._self._c||a;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:"\u8003\u8BD5\u5206\u7C7B\u5217\u8868","tree-data":t.paper_classify_list},on:{"current-change":t.change,onEdit:t.toEditClassify,onCreate:t.toCreateClassify,onDelete:t.toDeleteclassify}}),e("div",{directives:[{name:"loading",rawName:"v-loading",value:t.paper_list_loading,expression:"paper_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:"btns",fn:function(){return[e("el-button",{attrs:{type:"danger",round:""},on:{click:t.deletePapers}},[t._v("\u5220\u9664\u9009\u4E2D")]),e("el-button",{attrs:{type:"primary",round:""},on:{click:t.addPaperHandler}},[t._v("\u53D1\u5E03\u8003\u8BD5")])]},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:"examStartTime",fn:function(i){return[e("div",[e("p",[t._v("\u5F00\u59CB\u65F6\u95F4\uFF1A"+t._s(i.row.examStartTime))]),e("p",[t._v("\u7ED3\u675F\u65F6\u95F4\uFF1A"+t._s(i.row.examEndTime))])])]}},{key:"passPercent",fn:function(i){return[e("p",[t._v(t._s(Math.round(i.row.passPercent*i.row.totalScore/100)))])]}},{key:"status",fn:function(i){return[e("div",{staticClass:"exam-status",style:{"background-color":["#10a6b4","#01c883","#999999"][i.row.status]}},[t._v(" "+t._s(["\u5F85\u5F00\u8003","\u8003\u8BD5\u4E2D","\u5DF2\u7ED3\u675F"][i.row.status])+" ")])]}},{key:"action",fn:function(i){return[i.row.status==0?e("el-button",{attrs:{type:"text",icon:"i-j-ksap-bianji2",disabled:i.row.status==1},on:{click:function(s){return t.editExam(i.row)}}},[t._v("\u7F16\u8F91")]):t._e(),i.row.status==0?e("el-button",{attrs:{type:"text",icon:"i-j-ksap-fuzhi",disabled:i.row.status==1},on:{click:function(s){return t.editExam(i.row,"copy")}}},[t._v("\u590D\u5236")]):t._e(),i.row.status==2?e("el-button",{attrs:{type:"text",icon:"i-j-ksap-fuzhi",disabled:i.row.status==1},on:{click:function(s){return t.editExam(i.row,"again")}}},[t._v("\u590D\u5236\u518D\u8003")]):t._e(),e("el-button",{staticStyle:{color:"#f04343 !important"},attrs:{type:"text",icon:"i-j-ksap-shanchu"},on:{click:function(s){return t.deletePapers(s,i.row)}}},[t._v("\u5220\u9664")])]}}])})],1)],1)},w=[];const x={components:{SearchTreeMenu:f,TableLayout:u,FormLayout:c,QueryInput:y},data:()=>({paper_classify_list:[],table_data:[],page_info:{currentPage:1,pageSize:10,total:0},current_classify_id:null,classify_loading:!1,paper_list_loading:!1,form:{title:""},tableSelectionsList:[]}),created(){this.formItems=[{prop:"title"},{prop:"btns",model:{class:"gy-btns"}}],this.rules={},this.column=[{prop:"title",label:"\u8003\u8BD5\u540D\u79F0","min-width":130,align:"center","show-overflow-tooltip":!0},{prop:"classify",label:"\u8003\u8BD5\u5206\u7C7B","min-width":130,align:"center","show-overflow-tooltip":!0},{prop:"totalScore",label:"\u603B\u5206",width:80,align:"center","show-overflow-tooltip":!0},{prop:"passPercent",label:"\u53CA\u683C\u5206",width:80,align:"center","show-overflow-tooltip":!0},{prop:"creator",label:"\u521B\u5EFA\u4EBA",align:"center","show-overflow-tooltip":!0},{prop:"examStartTime",label:"\u8003\u8BD5\u65F6\u95F4",width:250,align:"center","show-overflow-tooltip":!0},{prop:"status",label:"\u72B6\u6001",width:80,align:"center","show-overflow-tooltip":!0},{prop:"action",label:"\u64CD\u4F5C",width:250,align:"center","show-overflow-tooltip":!0}],this.findAllQuestionsClassify()},activated(){this.pagingFindList()},methods:{toEditClassify(t){if(t.id==="system")return this.$message.error("\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:a})=>{this.classify_loading=!0,p({...t,name:a}).then(e=>{this.$message.success("\u4FEE\u6539\u6210\u529F"),this.findAllQuestionsClassify()}).finally(e=>{this.classify_loading=!1})}).catch(()=>{})},editExam(t,a){let e="/assessment-evaluation/exam-arrangement/add-modify-exam/"+t.id;a&&(e+="/"+a),this.$router.push({path:e})},addPaperHandler(){this.$router.push({path:"/assessment-evaluation/exam-arrangement/add-modify-exam"})},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 a=this.current_classify_id;a==="system"&&(a=null),this.paper_list_loading=!0,d({...this.page_info,classifyId:a,...this.form}).then(e=>{const{currentPage:i,pageSize:s,total:n}=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:s,total:n}}).finally(e=>{this.paper_list_loading=!1})},async findAllQuestionsClassify(){const{data:t}=await h(),a=[{id:"system",name:"\u8003\u8BD5\u5206\u7C7B",disabled:!0,children:[]}];this.questionClassifyMap={},this.questionClassifyMap=t.toTree(),a[0].children=this.questionClassifyMap.tree,this.paper_classify_list=a},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:a})=>{const e={name:a,pid:t==null?0:t.id,level:t==null?1:t.level+1};await _(e),this.findAllQuestionsClassify()}).catch(a=>{})},deletePapers(t,a){if(this.tableSelectionsList.length===0&&a==null)this.$message.error("\u8BF7\u5148\u9009\u62E9\u8981\u5220\u9664\u7684\u9879\u76EE");else{let e=this.tableSelectionsList;a&&(e=[a]);const s=e.filter(n=>+n.status!=1).length!==e.length?"\u9009\u4E2D\u9879\u4E2D\u5305\u542B\u5DF2\u5F00\u8003\u7684\u8003\u8BD5\uFF0C\u786E\u8BA4\u5220\u9664\u5417\uFF1F":"\u786E\u8BA4\u5220\u9664\u5417?";this.$confirm(s,"\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(n=>{this.paper_list_loading=!0,g(e.map(r=>r.id)).then(r=>{this.pagingFindList(),this.paper_list_loading=!1})}).catch(n=>{})}},toDeleteclassify(t){t.id!=="system"&&new Promise((a,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=>a()).catch(i=>e())}).then(a=>{this.classify_loading=!0,m(t.id).finally(()=>{this.findAllQuestionsClassify(),this.$refs.treeMenuRef.setCurrentKey(),this.classify_loading=!1})}).catch(a=>{})}}},l={};var b=o(x,v,w,!1,C,"727cb378",null,null);function C(t){for(let a in l)this[a]=l[a]}const I=function(){return b.exports}();export{I as default};