var O=Object.defineProperty,G=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var M=(t,l,n)=>l in t?O(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,C=(t,l)=>{for(var n in l||(l={}))q.call(l,n)&&M(t,n,l[n]);if(U)for(var n of U(l))j.call(l,n)&&M(t,n,l[n]);return t},P=(t,l)=>G(t,J(l));var L=(t,l)=>{var n={};for(var s in t)q.call(t,s)&&l.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&U)for(var s of U(t))l.indexOf(s)<0&&j.call(t,s)&&(n[s]=t[s]);return n};var k=(t,l,n)=>new Promise((s,c)=>{var i=u=>{try{y(n.next(u))}catch(g){c(g)}},m=u=>{try{y(n.throw(u))}catch(g){c(g)}},y=u=>u.done?s(u.value):Promise.resolve(u.value).then(i,m);y((n=n.apply(t,l)).next())});import{S as Q}from"./index.e6fc9d6c.js";import{P as W}from"./index.c2964e13.js";import{f as X}from"./dateUtil.134dfe1f.js";import{l as Y,m as Z,n as ee,o as ae,p as le}from"./api.fe2aadc7.js";import{d as H,u as I,r as B,a as E,i as a,dk as te,q as ne,l as T,_ as V,ce as A,a9 as _,p as r,k as o,c as se,ai as ie,e as ue,B as oe,cf as de,H as D,cg as re,aa as ce,da as w,d9 as F,aj as z,dp as R,bC as N}from"./index.fd264fea.js";import{l as $}from"./knowledgeTypeData.3b15dd0b.js";import"./searchs.b637f0d6.js";import"./dayjs.min.bd923176.js";const me=H({name:"AddTraining",emits:["handleSuccess","close"],props:["item"],setup(t,{emit:l}){var g,v,h;console.log("\u{1F680} ~ props",t);const n=I(),s=B(!1),c=B(null),i=E({name:((g=t==null?void 0:t.item)==null?void 0:g.name)||"",courseTypeCode:((h=(v=t==null?void 0:t.item)==null?void 0:v.courseTypeCode)==null?void 0:h.split(","))||[]});function m(d,b){return Array.isArray(b)&&!b.length?new Error("\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B"):!0}const y={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BAD\u7EC3\u540D\u79F0",trigger:["blur","change"]}],courseTypeCode:[{validator:m,message:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",trigger:["blur","change"]}]},u=()=>{var d;(d=c.value)==null||d.validate(b=>k(this,null,function*(){var x,e,p,S;if(console.log("\u{1F680} ~ err",b),!b){let f=null;if((x=t==null?void 0:t.item)!=null&&x.id){const K=P(C(C({},t.item),i),{courseTypeCode:((e=i.courseTypeCode)==null?void 0:e.join(","))||"",details:((p=t.item)==null?void 0:p.details)||[]});f=yield Y(K)}else{const K=P(C({},i),{courseTypeCode:((S=i.courseTypeCode)==null?void 0:S.join(","))||"",trainingNum:0,details:[]});f=yield Z(K)}(f==null?void 0:f.code)==200?(n.success("\u4FDD\u5B58\u6210\u529F"),l("handleSuccess")):n.warning("\u4FDD\u5B58\u5931\u8D25")}}))};return()=>a("div",null,[a(te,{show:s.value},{default:()=>[a(ne,{ref:c,labelPlacement:"top",model:i,rules:y,"require-mark-placement":"left"},{default:()=>[a(T,{label:"\u8BAD\u7EC3\u540D\u79F0",path:"name"},{default:()=>[a(V,{value:i.name,"onUpdate:value":d=>i.name=d},null)]}),a(T,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseTypeCode"},{default:()=>[a(A,{multiple:!0,disabled:!!(t!=null&&t.item),value:i.courseTypeCode,"onUpdate:value":d=>i.courseTypeCode=d,options:$,clearable:!0},null)]})]}),a(_,{justify:"end"},{default:()=>[a(r,{onClick:()=>l("close")},{default:()=>[o("\u53D6\u6D88")]}),a(r,{type:"primary",onClick:u},{default:()=>[o("\u4FDD\u5B58")]})]})]})])}}),ke=H({name:"after-class-training-manage",setup(){const t=se(),l=E({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null}),n=E({keyword:"",time:null,courseType:null,operatorId:null,enableFlag:null}),s=ie(),c=I(),i=ue();E({list:[],index:-1});const m=()=>k(this,null,function*(){try{l.loading=!0;const e=n,{time:p}=e,S=L(e,["time"]),{data:f}=yield ee(P(C(C({},S),X(p,["startUpdateTime","endUpdateTime"])),{page:l.pagination.page,rows:l.pagination.rows}));l.loading=!1,l.pagination.pageTotal=Number(f.total),l.dataList=f.rows||[]}catch(p){l.loading=!1}});oe(()=>{i.query.id&&(n.keyword=i.query.id),m()});const y=e=>{t.push({path:"/afterClassTrainingDetail",query:{id:e==null?void 0:e.id,name:e==null?void 0:e.name,courseTypeCode:e==null?void 0:e.courseTypeCode}})},u=e=>{s.warning({title:"\u8B66\u544A",content:e.enableFlag?"\u662F\u5426\u505C\u7528\u8BFE\u540E\u4F5C\u4E1A?":"\u662F\u5426\u542F\u7528\u8BFE\u540E\u4F5C\u4E1A",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>k(this,null,function*(){try{(yield le(e.id)).data&&(h(),c.success(`${e.enableFlag?"\u505C\u7528":"\u542F\u7528 "}\u6210\u529F`))}catch(p){}})})},g=()=>[{title:"\u8BAD\u7EC3\u4FE1\u606F",key:"name",render:e=>a(z,null,[a(w,{labelPlacement:"left",column:1},{default:()=>[a(F,{label:"\u8BAD\u7EC3\u540D\u79F0"},{default:()=>[e.name]}),a(F,{label:"\u8BAD\u7EC3\u7F16\u53F7"},{default:()=>[e.id]})]})])},{title:"\u8BFE\u7A0B\u4FE1\u606F",key:"courseTypeName",width:200,ellipsis:!0,render:e=>a(z,null,[a(w,{labelPlacement:"left",column:1},{default:()=>[a(F,{label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[e.courseTypeName]}),a(F,{label:"\u8BAD\u7EC3\u6761\u6570"},{default:()=>[e.trainingNum]})]})])},{title:"\u66F4\u65B0\u4FE1\u606F",key:"updateTime",render:e=>a(z,null,[a(w,{labelPlacement:"left",column:1},{default:()=>[a(F,{label:"\u66F4\u65B0\u4EBA"},{default:()=>[e.operatorName]}),a(F,{label:"\u66F4\u65B0\u65F6\u95F4"},{default:()=>[e.updateTime]})]})])},{title:"\u542F\u7528\u72B6\u6001",key:"enableFlag",render(e){return e.enableFlag?a(_,{size:"small",align:"center"},{default:()=>[a(R,{dot:!0,type:"success"},null),a("span",null,[o("\u5DF2\u542F\u7528")])]}):a(_,{size:"small",align:"center"},{default:()=>[a(R,{dot:!0,type:"error"},null),a("span",null,[o("\u672A\u542F\u7528")])]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return a(_,null,{default:()=>[D(a(r,{type:e.enableFlag?"error":"success",size:"small",text:!0,onClick:()=>u(e)},{default:()=>[e.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),[[N("auth"),"lessonTraining/updateEnableFlag1609121324747563009"]]),D(a(r,{type:"primary",size:"small",text:!0,onClick:()=>y(e)},{default:()=>[o("\u8BE6\u60C5")]}),[[N("auth"),"afterClassTrainingDetail1605020347316629505"]]),D(a(r,{type:"primary",size:"small",text:!0,onClick:()=>{l.modalType="update",l.visiableKnowledge=!0,l.materail=e}},{default:()=>[o("\u4FEE\u6539")]}),[[N("auth"),"lessonTraining/update1608022285733867521"]]),D(a(r,{disabled:e.enableFlag,type:"primary",size:"small",text:!0,onClick:()=>{d(e)}},{default:()=>[o("\u5220\u9664")]}),[[N("auth"),"lessonTraining/remove1608280377226768386"]])]})}}],v=B(),h=()=>{l.pagination.page=1,m()},d=e=>k(this,null,function*(){s.warning({title:"\u8B66\u544A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\u6B64\u8BAD\u7EC3?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>k(this,null,function*(){console.log("row",e),(yield ae(e.id)).data&&(h(),c.success("\u5220\u9664\u6210\u529F"))})})}),b=()=>{var e;(e=v.value)==null||e.submit()},x=()=>{var e;(e=v.value)==null||e.reset()};return()=>a("div",{class:"system-menu-container"},[a("div",{class:["section-container"]},[a(Q,{ref:v,model:n,onSubmit:h,onSetModel:e=>Object.assign(n,e),saveKey:"after-class-training-manage-key"},{default:()=>[a(T,{path:"search",label:"\u5173\u952E\u8BCD"},{default:()=>[a(V,{value:n.keyword,"onUpdate:value":e=>n.keyword=e,placeholder:"\u8BAD\u7EC3\u540D\u79F0/\u7F16\u53F7",clearable:!0},null)]}),a(T,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseType"},{default:()=>[a(A,{clearable:!0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",value:n.courseType,"onUpdate:value":e=>n.courseType=e,options:$},null)]}),a(T,{label:"\u542F\u7528\u72B6\u6001",path:"enableFlag"},{default:()=>[a(A,{placeholder:"\u8BF7\u9009\u62E9\u542F\u7528\u72B6\u6001",clearable:!0,value:n.enableFlag,"onUpdate:value":e=>n.enableFlag=e,options:[{label:"\u5DF2\u542F\u7528",value:!0},{label:"\u672A\u542F\u7528",value:!1}]},null)]}),a(T,{path:"time",label:"\u65F6\u95F4"},{default:()=>[a(de,{"value-format":"yyyy-MM-dd HH:mm:dd",value:n.time,"onUpdate:value":e=>n.time=e,type:"daterange",clearable:!0},null)]}),a(T,null,{default:()=>[a(_,null,{default:()=>[a(r,{type:"primary",onClick:b},{default:()=>[o("\u641C\u7D22")]}),a(r,{type:"default",onClick:x},{default:()=>[o("\u91CD\u7F6E")]})]})]})]}),a(_,{style:{paddingBottom:"12px"}},{default:()=>[D(a(r,{type:"primary",onClick:()=>{l.modalType="add",l.materail=null,l.visiableKnowledge=!0}},{default:()=>[o("\u65B0\u589E\u8BAD\u7EC3")]}),[[N("auth"),"lessonTraining/save1608371861011681281"]])]}),a(re,{loading:l.loading,columns:g(),data:l.dataList},null),a(W,{saveKey:"after-class-training-manage-key",page:l.pagination.page,"onUpdate:page":e=>l.pagination.page=e,pageSize:l.pagination.rows,"onUpdate:pageSize":e=>l.pagination.rows=e,pageTotal:l.pagination.pageTotal,"onUpdate:pageTotal":e=>l.pagination.pageTotal=e,onList:m,sync:!0},null),a(ce,{show:l.visiableKnowledge,"onUpdate:show":e=>l.visiableKnowledge=e,preset:"dialog",showIcon:!1,title:l.modalType==="add"?"\u65B0\u589E\u8BAD\u7EC3":"\u4FEE\u6539\u8BAD\u7EC3",style:{width:"400px"},onClose:()=>{l.materail=null}},{default:()=>[a(me,{item:l.materail,onHandleSuccess:()=>{l.visiableKnowledge=!1,m()},onClose:()=>l.visiableKnowledge=!1},null)]})])])}});export{ke as default};