var W=Object.defineProperty,X=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var R=(t,i,l)=>i in t?W(t,i,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[i]=l,x=(t,i)=>{for(var l in i||(i={}))A.call(i,l)&&R(t,l,i[l]);if(N)for(var l of N(i))O.call(i,l)&&R(t,l,i[l]);return t},K=(t,i)=>X(t,Y(i));var H=(t,i)=>{var l={};for(var n in t)A.call(t,n)&&i.indexOf(n)<0&&(l[n]=t[n]);if(t!=null&&N)for(var n of N(t))i.indexOf(n)<0&&O.call(t,n)&&(l[n]=t[n]);return l};var h=(t,i,l)=>new Promise((n,f)=>{var o=d=>{try{p(l.next(d))}catch(m){f(m)}},c=d=>{try{p(l.throw(d))}catch(m){f(m)}},p=d=>d.done?n(d.value):Promise.resolve(d.value).then(o,c);p((l=l.apply(t,i)).next())});import{S as Z}from"./index.d7d5ed38.js";import{P as ee}from"./index.87b9fa4d.js";import{k as ae,a as le,f as te,b as ne,c as ie}from"./api.9694f76d.js";import{k as V,l as oe}from"./knowledgeTypeData.3b15dd0b.js";import{d as G,u as J,r as q,a as U,i as a,dk as ue,q as de,l as g,_ as Q,ce as L,db as se,a8 as re,a7 as $,k as s,a9 as B,p as r,c as ce,e as me,ai as ge,B as fe,cf as pe,H as k,cg as ye,aa as be,da as M,d9 as b,aj as I,ch as ve,bC as C}from"./index.0d3a6da1.js";import{f as he}from"./dateUtil.de35d5fd.js";import"./searchs.b637f0d6.js";import"./dayjs.min.74ed5bab.js";const Te=G({name:"KnowledgeModel",emits:["handleSuccess","close"],props:["item"],setup(t,{emit:i}){var w,P,S,_,D,e,v,F;const l=J(),n=q(!1),f=q(null),o=U({id:(w=t==null?void 0:t.item)!=null&&w.id?(P=t==null?void 0:t.item)==null?void 0:P.id:null,name:((S=t==null?void 0:t.item)==null?void 0:S.name)||"",courseTypeCode:((D=(_=t==null?void 0:t.item)==null?void 0:_.courseTypeCode)==null?void 0:D.split(","))||[],autoPlayFlag:((e=t==null?void 0:t.item)==null?void 0:e.autoPlayFlag)==!0?1:0,totalMaterialTimeSecond:(v=t==null?void 0:t.item)==null?void 0:v.totalMaterialTimeSecond,parentId:((F=t==null?void 0:t.item)==null?void 0:F.parentId)||0});function c(u,y){return Array.isArray(y)&&!y.length?new Error("\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B"):!0}const p={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0",trigger:["blur","change"]}],courseTypeCode:[{validator:c,message:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",trigger:["blur","change"]}]},d=()=>{let u=[];return Object.keys(V).map(y=>{u.push({label:V[y],value:y})}),u},m=()=>{var u;(u=f.value)==null||u.validate(y=>h(this,null,function*(){var z;if(console.log("\u{1F680} ~ err",y),!y){const E=K(x({},o),{courseTypeCode:((z=o.courseTypeCode)==null?void 0:z.join(","))||""});let T=null,j="";o.id?T=yield ae(E):(T=yield le(E),j=T.data),(T==null?void 0:T.code)==200?(l.success("\u4FDD\u5B58\u6210\u529F"),i("handleSuccess",j)):l.warning("\u4FDD\u5B58\u5931\u8D25")}}))};return()=>a("div",null,[a(ue,{show:n.value},{default:()=>[a(de,{ref:f,labelPlacement:"top",model:o,rules:p,"require-mark-placement":"left"},{default:()=>[a(g,{label:"\u77E5\u8BC6\u70B9\u540D\u79F0",path:"name"},{default:()=>[a(Q,{value:o.name,"onUpdate:value":u=>o.name=u},null)]}),a(g,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseTypeCode"},{default:()=>[a(L,{multiple:!0,disabled:!!(t!=null&&t.item),value:o.courseTypeCode,"onUpdate:value":u=>o.courseTypeCode=u,options:d(),clearable:!0},null)]}),a(g,{label:"\u5EFA\u8BAE\u5B66\u4E60\u65F6\u957F",path:"totalMaterialTimeSecond",rule:[{required:!0,type:"number",min:0,message:"\u8BF7\u8F93\u5165\u6B63\u786E\u5EFA\u8BAE\u5B66\u4E60\u65F6\u957F",trigger:"blur"}]},{default:()=>[a(se,{placeholder:"\u8BF7\u8F93\u5165\u5EFA\u8BAE\u5B66\u4E60\u65F6\u957F",showButton:!1,value:o.totalMaterialTimeSecond,"onUpdate:value":u=>o.totalMaterialTimeSecond=u},{suffix:()=>"s(\u79D2)"})]}),a(g,{label:"\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u77E5\u8BC6\u70B9",path:"autoPlayFlag"},{default:()=>[a(re,{value:o.autoPlayFlag,"onUpdate:value":u=>o.autoPlayFlag=u},{default:()=>[a($,{value:1},{default:()=>[s("\u662F")]}),a($,{value:0},{default:()=>[s("\u5426")]})]})]})]}),a(B,{justify:"end"},{default:()=>[a(r,{onClick:()=>i("close")},{default:()=>[s("\u53D6\u6D88")]}),a(r,{type:"primary",onClick:m},{default:()=>[s("\u4FDD\u5B58")]})]})]})])}}),xe=G({name:"knowledge-manage",setup(){const t=ce(),i=me(),l=U({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null}),n=U({keyword:null,time:null,courseTypeCode:null,operatorId:null,enableFlag:null}),f=ge(),o=J();U({list:[],index:-1});const c=()=>h(this,null,function*(){try{l.loading=!0;const e=n,{time:v}=e,F=H(e,["time"]),{data:u}=yield te(K(x(x({},F),he(v,["startUpdateTime","endUpdateTime"])),{page:l.pagination.page,rows:l.pagination.rows}));l.loading=!1,l.pagination.pageTotal=Number(u.total),l.dataList=u.rows||[]}catch(v){l.loading=!1}});fe(()=>{console.log(i.query),i.query.keyword&&(n.keyword=i.query.keyword),c()});const p=e=>{t.push({path:"/knowledgeDetail",query:{id:e.id,name:e.name,courseTypeCode:e.courseTypeCode}})},d=()=>[{title:"\u77E5\u8BC6\u70B9",key:"id",render:e=>a("div",{style:"display: inline-flex;vertical-align: middle;"},[a(M,{labelPlacement:"left",column:1},{default:()=>[a(b,{label:"\u77E5\u8BC6\u70B9\u540D\u79F0"},{default:()=>[e.name]}),a(b,{label:"\u77E5\u8BC6\u70B9\u7F16\u53F7"},{default:()=>[e.id]})]})])},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName",render:e=>a(I,null,[a(M,{labelPlacement:"left",column:1},{default:()=>[a(b,{label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[e.courseTypeName]}),a(b,{label:"\u81EA\u52A8\u64AD\u653E"},{default:()=>[e.autoPlayFlag==1?"\u662F":"\u5426"]})]})])},{title:"\u5B66\u4E60\u4FE1\u606F",key:"totalMaterialNum",render:e=>a(I,null,[a(M,{labelPlacement:"left",column:1},{default:()=>[a(b,{label:"\u7D20\u6750\u6570\u91CF"},{default:()=>[e.totalMaterialNum]}),a(b,{label:"\u5EFA\u8BAE\u65F6\u957F"},{default:()=>[(e.totalMaterialTimeSecond||0)+"s"]})]})])},{title:"\u4E0A\u4F20\u4FE1\u606F",key:"updateTime",render:e=>a(I,null,[a(M,{labelPlacement:"left",column:1},{default:()=>[a(b,{label:"\u4FEE\u6539\u4EBA"},{default:()=>[e.operatorName]}),a(b,{label:"\u4FEE\u6539\u65F6\u95F4"},{default:()=>[e.updateTime]})]})])},{title:"\u72B6\u6001",key:"enableFlag",render(e){return a(ve,{type:e.enableFlag?"success":"warning"},{default:()=>[e.enableFlag?"\u5DF2\u542F\u7528":"\u672A\u542F\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return a(B,null,{default:()=>[k(a(r,{type:e.enableFlag?"error":"success",size:"small",text:!0,onClick:()=>P(e)},{default:()=>[e.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),[[C("auth"),"knowledgePoint/status1605123728664281090"]]),!(e.children&&e.children.length>0)&&k(a(r,{type:"primary",size:"small",text:!0,onClick:()=>p(e)},{default:()=>[s("\u8BE6\u60C5")]}),[[C("auth"),"knowledgePointListByLessonCDId1604717561400045569"]]),e.parentId<=0&&!e.materialFlag&&k(a(r,{type:"primary",size:"small",text:!0,onClick:()=>{l.modalType="add-child",l.visiableKnowledge=!0,l.materail={parentId:e.id,courseTypeCode:e.courseTypeCode}}},{default:()=>[s("\u6DFB\u52A0\u5B50\u9879")]}),[[C("auth"),"knowledgePoint/update1604688172914417665"]]),k(a(r,{type:"primary",size:"small",text:!0,onClick:()=>{l.modalType="update",l.visiableKnowledge=!0,l.materail=e}},{default:()=>[s("\u4FEE\u6539")]}),[[C("auth"),"knowledgePoint/update1604688172914417665"]]),k(a(r,{type:"primary",size:"small",disabled:!!e.enableFlag,text:!0,onClick:()=>{S(e)}},{default:()=>[s("\u5220\u9664")]}),[[C("auth"),"knowledgePoint/remove1604688068350418946"]])]})}}],m=q(),w=()=>{l.pagination.page=1,c()},P=(e,v=!0)=>h(this,null,function*(){f.warning({title:"\u8B66\u544A",content:`\u662F\u5426${e.enableFlag?"\u505C\u7528":"\u542F\u7528"}\u6B64\u77E5\u8BC6\u70B9?`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>h(this,null,function*(){console.log("row",e),(yield ne(e.id)).data&&(c(),o.success("\u4FEE\u6539\u6210\u529F"))})})}),S=e=>h(this,null,function*(){f.warning({title:"\u8B66\u544A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\u6B64\u77E5\u8BC6\u70B9?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>h(this,null,function*(){console.log("row",e),(yield ie(e.id)).data&&(w(),o.success("\u5220\u9664\u6210\u529F"))})})}),_=()=>{var e;(e=m.value)==null||e.submit()},D=()=>{var e;(e=m.value)==null||e.reset()};return()=>a("div",{class:"system-menu-container"},[a("div",{class:["section-container"]},[a(Z,{ref:m,model:n,onSubmit:w,onSetModel:e=>Object.assign(n,e)},{default:()=>[a(g,{path:"search",label:"\u5173\u952E\u5B57"},{default:()=>[a(Q,{value:n.keyword,"onUpdate:value":e=>n.keyword=e,placeholder:"\u77E5\u8BC6\u70B9\u540D\u79F0/\u7F16\u53F7",clearable:!0},null)]}),a(g,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseTypeCode"},{default:()=>[a(L,{clearable:!0,value:n.courseTypeCode,"onUpdate:value":e=>n.courseTypeCode=e,options:oe},null)]}),a(g,{path:"time",label:"\u65F6\u95F4"},{default:()=>[a(pe,{value:n.time,"onUpdate:value":e=>n.time=e,type:"daterange",clearable:!0},null)]}),a(g,{label:"\u72B6\u6001",path:"enableFlag"},{default:()=>[a(L,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",clearable:!0,value:n.enableFlag,"onUpdate:value":e=>n.enableFlag=e,options:[{label:"\u5DF2\u542F\u7528",value:1},{label:"\u672A\u542F\u7528",value:0}]},null)]}),a(g,null,{default:()=>[a(B,null,{default:()=>[a(r,{type:"primary",onClick:_},{default:()=>[s("\u641C\u7D22")]}),a(r,{type:"default",onClick:D},{default:()=>[s("\u91CD\u7F6E")]})]})]})]}),a(B,{style:{paddingBottom:"12px"}},{default:()=>[k(a(r,{type:"primary",onClick:()=>{l.visiableKnowledge=!0,l.modalType="add",l.materail=null}},{default:()=>[s("\u65B0\u589E\u77E5\u8BC6\u70B9")]}),[[C("auth"),"knowledgePoint/save1604687872153460738"]])]}),a(ye,{loading:l.loading,columns:d(),data:l.dataList,"children-key":"children","default-expand-all":!1,"row-key":e=>e.id},null),a(ee,{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:c,sync:!0},null),a(be,{show:l.visiableKnowledge,"onUpdate:show":e=>l.visiableKnowledge=e,preset:"dialog",showIcon:!1,title:l.modalType!=="update"?"\u65B0\u589E\u77E5\u8BC6\u70B9":"\u4FEE\u6539\u77E5\u8BC6\u70B9",style:{width:"500px"},onClose:()=>{l.materail=null}},{default:()=>[a(Te,{item:l.materail,onHandleSuccess:e=>{if(e){p(e);return}console.log(e),l.visiableKnowledge=!1,c()},onClose:()=>{l.visiableKnowledge=!1,l.materail=null}},null)]})])])}});export{xe as default};