(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-be2dc83c"],{"055b":function(t,e,o){"use strict";o.d(e,"l",(function(){return r})),o.d(e,"h",(function(){return i})),o.d(e,"b",(function(){return s})),o.d(e,"n",(function(){return a})),o.d(e,"d",(function(){return l})),o.d(e,"k",(function(){return c})),o.d(e,"f",(function(){return u})),o.d(e,"e",(function(){return d})),o.d(e,"j",(function(){return p})),o.d(e,"a",(function(){return m})),o.d(e,"m",(function(){return f})),o.d(e,"c",(function(){return h})),o.d(e,"g",(function(){return b})),o.d(e,"i",(function(){return y}));var n=o("b775");function r(t){return Object(n["b"])({url:"/question/question/list",method:"get",params:t})}function i(t){return Object(n["b"])({url:"/question/question/"+t,method:"get"})}function s(t){return Object(n["b"])({url:"/question/question/add",method:"post",data:t})}function a(t){return Object(n["b"])({url:"/question/question/edit",method:"post",data:t})}function l(t){return Object(n["b"])({url:"/question/question/"+t,method:"delete"})}function c(t){return Object(n["b"])({url:"/question/category/tree",method:"get",params:t})}function u(t){return Object(n["b"])({url:"/question/question/enable/"+t,method:"post"})}function d(t){return Object(n["b"])({url:"/question/question/disable/"+t,method:"post"})}function p(){return Object(n["b"])({url:"/question/category/select",method:"get"})}function m(t){return Object(n["b"])({url:"/question/category/add",method:"post",data:t})}function f(t){return Object(n["b"])({url:"/question/category/edit",method:"post",data:t})}function h(t){return Object(n["b"])({url:"/question/category/"+t,method:"delete"})}function b(t){return Object(n["b"])({url:"/question/category/"+t,method:"get"})}function y(t){return Object(n["b"])({url:"/question/question/importData",method:"post",data:t})}},"8b98":function(t,e,o){},c616:function(t,e,o){"use strict";o.r(e);o("a9e3"),o("b0c0"),o("4e82");var n=function(){var t=this,e=t._self._c;return e("a-modal",{attrs:{width:"50%","label-col":t.labelCol,"wrapper-col":t.wrapperCol,visible:t.open,title:t.formTitle,footer:null},on:{cancel:t.cancel,ok:t.submitForm}},[e("a-form-model",{ref:"form",attrs:{model:t.form}},[e("a-row",[e("a-col",{staticStyle:{position:"relative"},attrs:{span:12}},[e("a-form-model-item",{attrs:{label:"题型",labelCol:t.labelCol,wrapperCol:t.wrapperCol,prop:"type"}},[e("a-select",{attrs:{placeholder:"请选择题型","allow-clear":"",disabled:1!=t.formType},on:{change:t.typeChange},model:{value:t.form.type,callback:function(e){t.$set(t.form,"type",e)},expression:"form.type"}},t._l(t.typeOptions,(function(o,n){return e("a-select-option",{key:n,attrs:{value:Number(o.dictValue)}},[t._v(t._s(o.dictLabel))])})),1)],1),1===t.formType?e("div",{staticClass:"tips"},[t._v("保存后无法修改")]):t._e()],1),e("a-col",{attrs:{span:12}},[e("a-form-model-item",{attrs:{label:"所属分类",labelCol:t.labelCol,wrapperCol:t.wrapperCol,prop:"categoryId"}},[e("a-tree-select",{staticStyle:{width:"100%"},attrs:{"show-search":"","tree-node-filter-prop":"title",treeData:t.categoryOptions,"dropdown-style":{maxHeight:"400px",overflow:"auto"},placeholder:"请选择所属分类(可搜索)",replaceFields:{children:"children",title:"title",key:"key",value:"key"},"allow-clear":"",disabled:3==t.formType},model:{value:t.form.categoryId,callback:function(e){t.$set(t.form,"categoryId",e)},expression:"form.categoryId"}})],1)],1),e("a-col",{attrs:{span:24}},[e("a-form-model-item",{attrs:{label:"题目题干",labelCol:{xs:{span:24},sm:{span:4}},wrapperCol:{xs:{span:24},sm:{span:20}},prop:"name"}},[e("a-input",{attrs:{placeholder:"请输入题目题干",type:"textarea","allow-clear":"",disabled:3===t.formType},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1)],1),e("a-col",{attrs:{span:24}},[e("a-form-model-item",{attrs:{label:"题目选项",labelCol:{xs:{span:24},sm:{span:4}},wrapperCol:{xs:{span:24},sm:{span:20}},prop:"options"}},[e("a-table",{attrs:{loading:t.loading,size:t.tableSize,rowKey:"optionId",bordered:"",columns:t.questionColumns,"data-source":t.form.options,pagination:!1},scopedSlots:t._u([{key:"sort",fn:function(o,n){return e("span",{},[t._v(" "+t._s(String.fromCharCode(64+n.sort))+" ")])}},{key:"name",fn:function(o,n){return e("span",{},[e("a-input",{attrs:{"allow-clear":"",disabled:3===t.formType},model:{value:n.name,callback:function(e){t.$set(n,"name",e)},expression:"record.name"}})],1)}},{key:"isCorrect",fn:function(o,n,r){return e("span",{},[2===t.form.type?e("a-checkbox",{attrs:{disabled:3===t.formType,checked:n.isCorrect},on:{change:function(e){return t.checkChange(n.isCorrect,r)}}}):e("a-radio-group",{attrs:{name:"radio"},model:{value:t.radioCorrect,callback:function(e){t.radioCorrect=e},expression:"radioCorrect"}},[e("a-radio",{attrs:{value:n.isCorrect,disabled:3===t.formType},on:{click:function(e){return t.radioChange(r)}}})],1)],1)}},{key:"operation",fn:function(o,n,r){return e("span",{},[e("a",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:["system:question:remove"],expression:"['system:question:remove']"}],on:{click:function(e){return t.optionDel(n,r)}}},[e("a-icon",{attrs:{type:"delete"}}),t._v("删除 ")],1)])}}])}),1===t.formType&&3!==t.form.type?e("a-button",{attrs:{type:"primary"},on:{click:t.addOption}},[t._v("添加选项")]):t._e()],1)],1)],1)],1)],1)},r=[],i=(o("a434"),o("d81d"),o("055b")),s={name:"CreateForm",props:{categoryOptions:{type:Array,required:!0}},components:{},data:function(){return{loading:!1,formTitle:"",labelCol:{xs:{span:24},sm:{span:8}},wrapperCol:{xs:{span:24},sm:{span:16}},form:{id:null,categoryId:null,type:1,name:null,image:null,status:1,options:[{isCorrect:!1,name:null,optionId:"1",sort:1},{isCorrect:!1,name:null,optionId:"2",sort:2}]},formType:1,open:!1,typeOptions:[{dictLabel:"单选题",dictValue:"1"},{dictLabel:"多选题",dictValue:"2"},{dictLabel:"判断题",dictValue:"3"}],questionColumns:[],dataList:[],statusOptions:[{dictLabel:"启用",dictValue:"1"},{dictLabel:"禁用",dictValue:"2"}],radioCorrect:!0}},filters:{},created:function(){},computed:{},watch:{},mounted:function(){},methods:{columnsFilters:function(){3===this.form.type||3===this.formType?this.questionColumns=[{title:"序号",dataIndex:"sort",ellipsis:!0,scopedSlots:{customRender:"sort"},width:"15%",align:"center"},{title:"选项内容",dataIndex:"name",scopedSlots:{customRender:"name"},ellipsis:!0,align:"center"},{title:"正确答案",dataIndex:"isCorrect",scopedSlots:{customRender:"isCorrect"},ellipsis:!0,width:"15%",align:"center"}]:this.questionColumns=[{title:"序号",dataIndex:"sort",ellipsis:!0,width:"15%",align:"center",scopedSlots:{customRender:"sort"}},{title:"选项内容",dataIndex:"name",scopedSlots:{customRender:"name"},ellipsis:!0,align:"center"},{title:"正确答案",dataIndex:"isCorrect",scopedSlots:{customRender:"isCorrect"},ellipsis:!0,width:"15%",align:"center"},{title:"操作",dataIndex:"operation",width:"15%",scopedSlots:{customRender:"operation"},align:"center"}]},onClose:function(){this.open=!1},cancel:function(){this.open=!1,this.reset()},reset:function(){this.formType=1,this.form={id:null,categoryId:null,type:1,name:null,image:null,status:1,options:[{isCorrect:!1,name:null,optionId:"1",sort:1},{isCorrect:!1,name:null,optionId:"2",sort:2}]}},handleAdd:function(t){this.reset(),this.formType=1,this.open=!0,this.formTitle="添加",this.columnsFilters()},handleUpdate:function(t,e){var o=this;this.reset(),this.formType=2;var n=t?t.id:e;Object(i["h"])(n).then((function(t){o.form=t.data,o.open=!0,o.formTitle="修改",o.columnsFilters()}))},getDetail:function(t){var e=this;this.reset(),this.formType=3,Object(i["h"])(t).then((function(t){e.form=t.data,e.open=!0,e.formTitle="预览",e.columnsFilters()}))},submitForm:function(){var t=this;3===this.formType?this.open=!1:this.$refs.form.validate((function(e){if(!e)return!1;void 0!==t.form.id&&null!==t.form.id?Object(i["n"])(t.form).then((function(e){t.$message.success("修改成功",3),t.open=!1,t.$emit("ok")})):Object(i["b"])(t.form).then((function(e){t.$message.success("新增成功",3),t.open=!1,t.$emit("ok")}))}))},optionDel:function(t,e){var o=this;o.$confirm({title:"确认删除所选中数据?",onOk:function(){o.form.options.splice(e,1)}})},radioChange:function(t){var e=this;this.$set(this.form.options[t],"isCorrect",!0),this.form.options.map((function(o,n){n!==t&&e.$set(e.form.options[n],"isCorrect",!1)}))},checkChange:function(t,e){this.$set(this.form.options[e],"isCorrect",!t)},addOption:function(){this.form.options.push({isCorrect:!1,name:null,optionId:this.form.options.length+1,sort:this.form.options.length+1})},typeChange:function(t){this.columnsFilters(),this.form.options.map((function(t){t.isCorrect=!1})),3===t?this.form.options=[{isCorrect:!1,name:"对",optionId:"1",sort:1},{isCorrect:!1,name:"错",optionId:"2",sort:2}]:this.form.options.map((function(t){t.name=null}))}}},a=s,l=(o("cfcc"),o("2877")),c=Object(l["a"])(a,n,r,!1,null,"5f7ef609",null);e["default"]=c.exports},cfcc:function(t,e,o){"use strict";o("8b98")}}]);