index.858711e6.js 8.7 KB

1
  1. var V=Object.defineProperty,$=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var q=(t,l,n)=>l in t?V(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,h=(t,l)=>{for(var n in l||(l={}))w.call(l,n)&&q(t,n,l[n]);if(x)for(var n of x(l))A.call(l,n)&&q(t,n,l[n]);return t},S=(t,l)=>$(t,O(l));var M=(t,l)=>{var n={};for(var s in t)w.call(t,s)&&l.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&x)for(var s of x(t))l.indexOf(s)<0&&A.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 G}from"./index.a9983230.js";import{P as J}from"./index.9f8146c1.js";import{f as Q}from"./dateUtil.2c20b8d0.js";import{l as W,m as X,n as Y,o as Z,p as ee}from"./api.e2d3a9a5.js";import{d as R,u as j,r as B,a as U,i as a,dl as ae,q as le,l as T,_ as H,ce as E,a9 as _,p as r,k as o,c as te,af as ne,e as se,B as ie,cf as ue,cg as oe,aa as de,da as K,d9 as F,ag as z,dq as L}from"./index.9256ea96.js";import{l as I}from"./knowledgeTypeData.3b15dd0b.js";import"./searchs.b637f0d6.js";import"./dayjs.min.6ba71f07.js";const re=R({name:"AddTraining",emits:["handleSuccess","close"],props:["item"],setup(t,{emit:l}){var g,v,C;console.log("\u{1F680} ~ props",t);const n=j(),s=B(!1),c=B(null),i=U({name:((g=t==null?void 0:t.item)==null?void 0:g.name)||"",courseTypeCode:((C=(v=t==null?void 0:t.item)==null?void 0:v.courseTypeCode)==null?void 0:C.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 D,e,p,N;if(console.log("\u{1F680} ~ err",b),!b){let f=null;if((D=t==null?void 0:t.item)!=null&&D.id){const P=S(h(h({},t.item),i),{courseTypeCode:((e=i.courseTypeCode)==null?void 0:e.join(","))||"",details:((p=t.item)==null?void 0:p.details)||[]});f=yield W(P)}else{const P=S(h({},i),{courseTypeCode:((N=i.courseTypeCode)==null?void 0:N.join(","))||"",trainingNum:0,details:[]});f=yield X(P)}(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(ae,{show:s.value},{default:()=>[a(le,{ref:c,labelPlacement:"top",model:i,rules:y,"require-mark-placement":"left"},{default:()=>[a(T,{label:"\u8BAD\u7EC3\u540D\u79F0",path:"name"},{default:()=>[a(H,{value:i.name,"onUpdate:value":d=>i.name=d},null)]}),a(T,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseTypeCode"},{default:()=>[a(E,{multiple:!0,disabled:!!(t!=null&&t.item),value:i.courseTypeCode,"onUpdate:value":d=>i.courseTypeCode=d,options:I,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")]})]})]})])}}),Ce=R({name:"after-class-training-manage",setup(){const t=te(),l=U({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null}),n=U({keyword:"",time:null,courseType:null,operatorId:null,enableFlag:null}),s=ne(),c=j(),i=se();U({list:[],index:-1});const m=()=>k(this,null,function*(){try{l.loading=!0;const e=n,{time:p}=e,N=M(e,["time"]),{data:f}=yield Y(S(h(h({},N),Q(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}});ie(()=>{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 ee(e.id)).data&&(C(),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(K,{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(K,{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(K,{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(L,{dot:!0,type:"success"},null),a("span",null,[o("\u5DF2\u542F\u7528")])]}):a(_,{size:"small",align:"center"},{default:()=>[a(L,{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:()=>[a(r,{type:e.enableFlag?"error":"success",size:"small",text:!0,onClick:()=>u(e)},{default:()=>[e.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),a(r,{type:"primary",size:"small",text:!0,onClick:()=>y(e)},{default:()=>[o("\u8BE6\u60C5")]}),a(r,{type:"primary",size:"small",text:!0,onClick:()=>{l.modalType="update",l.visiableKnowledge=!0,l.materail=e}},{default:()=>[o("\u4FEE\u6539")]}),a(r,{disabled:e.enableFlag,type:"primary",size:"small",text:!0,onClick:()=>{d(e)}},{default:()=>[o("\u5220\u9664")]})]})}}],v=B(),C=()=>{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 Z(e.id)).data&&(C(),c.success("\u5220\u9664\u6210\u529F"))})})}),b=()=>{var e;(e=v.value)==null||e.submit()},D=()=>{var e;(e=v.value)==null||e.reset()};return()=>a("div",{class:"system-menu-container"},[a("div",{class:["section-container"]},[a(G,{ref:v,model:n,onSubmit:C,onSetModel:e=>Object.assign(n,e),saveKey:"after-class-training-manage-key"},{default:()=>[a(T,{path:"search",label:"\u5173\u952E\u8BCD"},{default:()=>[a(H,{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(E,{clearable:!0,placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",value:n.courseType,"onUpdate:value":e=>n.courseType=e,options:I},null)]}),a(T,{label:"\u542F\u7528\u72B6\u6001",path:"enableFlag"},{default:()=>[a(E,{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(ue,{"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:D},{default:()=>[o("\u91CD\u7F6E")]})]})]})]}),a(_,{style:{paddingBottom:"12px"}},{default:()=>[a(r,{type:"primary",onClick:()=>{l.modalType="add",l.materail=null,l.visiableKnowledge=!0}},{default:()=>[o("\u65B0\u589E\u8BAD\u7EC3")]})]}),a(oe,{loading:l.loading,columns:g(),data:l.dataList},null),a(J,{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(de,{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(re,{item:l.materail,onHandleSuccess:()=>{l.visiableKnowledge=!1,m()},onClose:()=>l.visiableKnowledge=!1},null)]})])])}});export{Ce as default};