var N=Object.defineProperty;var R=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var B=(s,t,l)=>t in s?N(s,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[t]=l,x=(s,t)=>{for(var l in t||(t={}))P.call(t,l)&&B(s,l,t[l]);if(R)for(var l of R(t))z.call(t,l)&&B(s,l,t[l]);return s};var f=(s,t,l)=>new Promise((E,c)=>{var F=r=>{try{b(l.next(r))}catch(m){c(m)}},D=r=>{try{b(l.throw(r))}catch(m){c(m)}},b=r=>r.done?E(r.value):Promise.resolve(r.value).then(F,D);b((l=l.apply(s,t)).next())});import{S as O}from"./index.326b402b.js";import{P as M}from"./index.8bcb0a62.js";import{w as q,x as V,y as j,z as K}from"./api.6c203a50.js";import{d as W,c as Y,a as T,ai as H,u as G,B as $,r as J,i as a,dk as Q,l as h,_ as X,ce as v,a9 as w,p,k as n,H as g,cd as Z,a1 as ee,cg as ae,da as C,d9 as d,aj as k,ae as te,bC as y}from"./index.4dd4953c.js";import{l as le,k as oe}from"./knowledgeTypeData.3b15dd0b.js";import{q as se}from"./api.1d817932.js";import{a as ne}from"./uploadFile.1891be8d.js";import"./searchs.b637f0d6.js";import"./oss-file-upload.064bf654.js";const L={SINGLE_DELIVERY:"\u5355\u4EA4\u4ED8\u56E2",MULTIPLE_DELIVERY:"\u591A\u4EA4\u4ED8\u5E38\u89C4\u56E2",MULTIPLE_DELIVERY_SCHOOL:"\u591A\u4EA4\u4ED8\u6821\u56E2"},be=W({name:"courseware-manage",setup(){const s=Y(),t=T({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null,staffList:[],orchestraTypeList:[]}),l=T({orchestraType:null,name:"",keyword:"",enableFlag:null,operatorId:null,courseTypeCode:null}),E=H(),c=G();T({list:[],index:-1});const F=()=>f(this,null,function*(){try{t.loading=!0;const e=x({page:t.pagination.page,rows:t.pagination.rows},l),{data:o}=yield q(e);t.loading=!1,t.pagination.pageTotal=Number(o.total),t.dataList=o.rows||[]}catch(e){t.loading=!1}}),D=()=>f(this,null,function*(){try{const{data:e}=yield se({page:1,rows:999});Array.isArray(e.rows)&&(t.staffList=e.rows.map(o=>({label:o.nickname,value:o.id})))}catch(e){}});$(()=>{D(),F();for(let e in L)t.orchestraTypeList.push({label:L[e],value:e})});const b=(e,o)=>{E.warning({title:"\u8B66\u544A",content:o?"\u662F\u5426\u786E\u8BA4\u542F\u7528\u8BFE\u4EF6?":"\u662F\u5426\u786E\u8BA4\u505C\u7528\u8BFE\u4EF6?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>f(this,null,function*(){(yield K({id:e.id,enableFlag:o})).data&&(_(),c.success("\u64CD\u4F5C\u6210\u529F"))})})},r=()=>[{title:"\u8BFE\u4EF6\u4FE1\u606F",key:"id",render:e=>a(k,null,[a(C,{labelPlacement:"left",column:1},{default:()=>[a(d,{label:"\u8BFE\u7A0B\u540D\u79F0"},{default:()=>[e.name]}),a(d,{label:"\u8BFE\u4EF6\u7F16\u53F7"},{default:()=>[e.id]})]})])},{title:"\u8BFE\u4EF6\u5C01\u9762",key:"coverImg",render(e){return a(te,{width:80,height:80,objectFit:"contain",src:e.coverImg},null)}},{title:"\u7C7B\u578B",key:"orchestraType",render:e=>a(k,null,[a(C,{labelPlacement:"left",column:1},{default:()=>[a(d,{label:"\u4E50\u56E2\u7C7B\u578B"},{default:()=>[L[e.orchestraType]]}),a(d,{label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[e.courseTypeCode?oe[e.courseTypeCode]:"--"]})]})])},{title:"\u8BFE\u4EF6\u5185\u5BB9",key:"courseNum",render:e=>a(k,null,[a(C,{labelPlacement:"left",column:1},{default:()=>[a(d,{label:"\u8BFE\u65F6\u6570"},{default:()=>[e.courseNum]}),a(d,{label:"\u9636\u6BB5\u81EA\u6D4B"},{default:()=>[e.unitTestNum]})]})])},{title:"\u66F4\u65B0\u4FE1\u606F",key:"updateTime",render:e=>a(k,null,[a(C,{labelPlacement:"left",column:1},{default:()=>[a(d,{label:"\u66F4\u65B0\u4EBA"},{default:()=>[e.operatorName]}),a(d,{label:"\u66F4\u65B0\u65F6\u95F4"},{default:()=>[e.updateTime]})]})])},{title:"\u72B6\u6001",key:"enableFlag",render(e){return e.enableFlag?"\u5DF2\u542F\u7528":"\u672A\u542F\u7528"}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return a(w,null,{default:()=>[e.enableFlag?g(a(p,{type:"error",size:"small",text:!0,onClick:()=>b(e,!1)},{default:()=>[n("\u505C\u7528")]}),[[y("auth"),"lessonCourseware/updateEnableFlag1608067923699892226"]]):g(a(p,{type:"primary",size:"small",text:!0,onClick:()=>b(e,!0)},{default:()=>[n("\u542F\u7528")]}),[[y("auth"),"lessonCourseware/updateEnableFlag1608067923699892226"]]),g(a(p,{type:"primary",size:"small",text:!0,onClick:()=>{s.push({path:"/coursewareDetail",query:{id:e.id}})}},{default:()=>[n("\u8BE6\u60C5")]}),[[y("auth"),"coursewareDetail1607207526805606402"]]),g(a(p,{type:"primary",size:"small",text:!0,onClick:()=>U(e)},{default:()=>[n("\u5220\u9664")]}),[[y("auth"),"lessonCourseware/delete1610257235044466690"]])]})}}],m=J(),_=()=>{t.pagination.page=1,F()},U=e=>f(this,null,function*(){E.warning({title:"\u8B66\u544A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\u6B64\u8BFE\u4EF6?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>f(this,null,function*(){console.log("row",e),(yield j(e.id)).data&&(_(),c.success("\u5220\u9664\u6210\u529F"))})})}),A=()=>{var e;(e=m.value)==null||e.submit()},I=()=>{var e;(e=m.value)==null||e.reset()},u=T({loading:!1,dataType:"COURSEWARE",importRef:null}),S=e=>f(this,null,function*(){console.log(e.file),u.loading=!0;try{const o=yield ne(e.file.file,()=>{}),i=yield V({dataType:u.dataType,fileName:e.file.name,importUrl:o});if(u.loading=!1,i.data){if(i.data.insertRow===0&&i.data.invalidRow===0){c.error("\u5BFC\u5165\u5931\u8D25\uFF0C\u8868\u683C\u4E3A\u7A7A");return}if(i.data.respUrl){E.error({title:"\u4FE1\u606F",content:()=>a(w,null,{default:()=>[a("div",null,[n("\u5BFC\u5165\u5931\u8D25\uFF0C\u70B9\u51FB\u4E0B\u8F7D\u9519\u8BEF\u4FE1\u606F")]),a("a",{href:i.data.respUrl,download:!0},[n("\u4E0B\u8F7D")])]})});return}c.success("\u5BFC\u5165\u6210\u529F")}}catch(o){}u.loading=!1});return()=>a("div",{class:"system-menu-container"},[a(Q,{show:u.loading},{default:()=>[a("div",{class:["section-container"]},[a(O,{ref:m,model:l,onSubmit:_,onSetModel:e=>Object.assign(l,e),saveKey:"courseware-manage-ad-key"},{default:()=>[a(h,{path:"keyword",label:"\u5173\u952E\u5B57"},{default:()=>[a(X,{value:l.keyword,"onUpdate:value":e=>l.keyword=e,placeholder:"\u8BF7\u8F93\u5165\u8BFE\u4EF6\u540D\u79F0/\u7F16\u53F7",clearable:!0},null)]}),a(h,{path:"courseTypeCode",label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[a(v,{placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",clearable:!0,value:l.courseTypeCode,"onUpdate:value":e=>l.courseTypeCode=e,options:le},null)]}),a(h,{path:"enableFlag",label:"\u662F\u5426\u542F\u7528"},{default:()=>[a(v,{placeholder:"\u662F\u5426\u542F\u7528",clearable:!0,value:l.enableFlag,"onUpdate:value":e=>l.enableFlag=e,options:[{label:"\u662F",value:1},{label:"\u5426",value:0}]},null)]}),a(h,{path:"orchestraType",label:"\u4E50\u56E2\u7C7B\u578B"},{default:()=>[a(v,{placeholder:"\u8BF7\u8F93\u5165\u4E50\u56E2\u7C7B\u578B",clearable:!0,value:l.orchestraType,"onUpdate:value":e=>l.orchestraType=e,options:t.orchestraTypeList},null)]}),a(h,{path:"operatorId",label:"\u66F4\u65B0\u4EBA"},{default:()=>[a(v,{placeholder:"\u8BF7\u8F93\u5165\u66F4\u65B0\u4EBA",clearable:!0,value:l.operatorId,"onUpdate:value":e=>l.operatorId=e,options:t.staffList,filterable:!0},null)]}),a(h,null,{default:()=>[a(w,null,{default:()=>[a(p,{type:"primary",onClick:A},{default:()=>[n("\u641C\u7D22")]}),a(p,{type:"default",onClick:I},{default:()=>[n("\u91CD\u7F6E")]})]})]})]}),a(w,{style:{paddingBottom:"12px"},justify:"space-between"},{default:()=>[g(a(p,{type:"primary",onClick:()=>{t.visiableKnowledge=!0,s.push({path:"/coursewareDetail"})}},{default:()=>[n("\u65B0\u589E\u8BFE\u4EF6")]}),[[y("auth"),"coursewareDetail1607207526805606402"]]),a(w,null,{default:()=>[g(a(p,{type:"primary",tag:"a",href:"https://oss.dayaedu.com/daya-docs/%E8%AF%BE%E4%BB%B6%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx",download:!0},{default:()=>[n("\u4E0B\u8F7D\u8BFE\u4EF6\u6A21\u677F")]}),[[y("auth"),"downloadCoursewareTemplate1793540443017875457"]]),g(a("div",null,[a(Z,{multiple:!1,ref:e=>u.importRef=e,showFileList:!1,accept:".xlsx",customRequest:S},{default:()=>[a(ee,{size:"huge",trigger:"hover",options:[{label:"\u8BFE\u4EF6",key:"COURSEWARE"},{label:"\u7D20\u6750\u5173\u8054\u66F2\u76EE",key:"COURSEWARE_REF_MATERIAL"}],onSelect:e=>{var o,i;u.dataType=e,console.log(u.importRef),(o=u.importRef)==null||o.clear(),(i=u.importRef)==null||i.openOpenFileDialog()}},{default:()=>[a(p,{type:"primary",onClick:e=>e.stopPropagation()},{default:()=>[n("\u5BFC\u5165\u6570\u636E")]})]})]})]),[[y("auth"),"Importcourseware1793540542561292290"]])]})]}),a(ae,{loading:t.loading,columns:r(),data:t.dataList},null),a(M,{saveKey:"courseware-manage-ad-key",page:t.pagination.page,"onUpdate:page":e=>t.pagination.page=e,pageSize:t.pagination.rows,"onUpdate:pageSize":e=>t.pagination.rows=e,pageTotal:t.pagination.pageTotal,"onUpdate:pageTotal":e=>t.pagination.pageTotal=e,onList:F,sync:!0},null)])]})])}});export{be as default};