var A=Object.defineProperty;var L=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var x=(o,t,l)=>t in o?A(o,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):o[t]=l,I=(o,t)=>{for(var l in t||(t={}))P.call(t,l)&&x(o,l,t[l]);if(L)for(var l of L(t))z.call(t,l)&&x(o,l,t[l]);return o};var m=(o,t,l)=>new Promise((E,d)=>{var F=u=>{try{y(l.next(u))}catch(p){d(p)}},D=u=>{try{y(l.throw(u))}catch(p){d(p)}},y=u=>u.done?E(u.value):Promise.resolve(u.value).then(F,D);y((l=l.apply(o,t)).next())});import{S as q}from"./index.499ab265.js";import{P as M}from"./index.2e16308a.js";import{w as O,x as V,y as j,z as K}from"./api.9a0c39cd.js";import{d as Y,c as H,a as v,ai as G,u as W,B as $,r as J,i as a,dk as Q,l as h,_ as X,ce as T,a9 as w,p as r,k as n,H as f,cd as Z,cg as ee,da as C,d9 as i,aj as k,ae,bC as g}from"./index.bfa8babc.js";import{l as te,k as le}from"./knowledgeTypeData.3b15dd0b.js";import{q as oe}from"./api.c9ec8f44.js";import{a as se}from"./uploadFile.87df876c.js";import"./searchs.b637f0d6.js";import"./oss-file-upload.5e9de1eb.js";const B={SINGLE_DELIVERY:"\u5355\u4EA4\u4ED8\u56E2",MULTIPLE_DELIVERY:"\u591A\u4EA4\u4ED8\u5E38\u89C4\u56E2",MULTIPLE_DELIVERY_SCHOOL:"\u591A\u4EA4\u4ED8\u6821\u56E2"},ye=Y({name:"courseware-manage",setup(){const o=H(),t=v({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null,staffList:[],orchestraTypeList:[]}),l=v({orchestraType:null,name:"",keyword:"",enableFlag:null,operatorId:null,courseTypeCode:null}),E=G(),d=W();v({list:[],index:-1});const F=()=>m(this,null,function*(){try{t.loading=!0;const e=I({page:t.pagination.page,rows:t.pagination.rows},l),{data:s}=yield O(e);t.loading=!1,t.pagination.pageTotal=Number(s.total),t.dataList=s.rows||[]}catch(e){t.loading=!1}}),D=()=>m(this,null,function*(){try{const{data:e}=yield oe({page:1,rows:999});Array.isArray(e.rows)&&(t.staffList=e.rows.map(s=>({label:s.nickname,value:s.id})))}catch(e){}});$(()=>{D(),F();for(let e in B)t.orchestraTypeList.push({label:B[e],value:e})});const y=(e,s)=>{E.warning({title:"\u8B66\u544A",content:s?"\u662F\u5426\u786E\u8BA4\u542F\u7528\u8BFE\u4EF6?":"\u662F\u5426\u786E\u8BA4\u505C\u7528\u8BFE\u4EF6?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>m(this,null,function*(){(yield K({id:e.id,enableFlag:s})).data&&(_(),d.success("\u64CD\u4F5C\u6210\u529F"))})})},u=()=>[{title:"\u8BFE\u4EF6\u4FE1\u606F",key:"id",render:e=>a(k,null,[a(C,{labelPlacement:"left",column:1},{default:()=>[a(i,{label:"\u8BFE\u7A0B\u540D\u79F0"},{default:()=>[e.name]}),a(i,{label:"\u8BFE\u4EF6\u7F16\u53F7"},{default:()=>[e.id]})]})])},{title:"\u8BFE\u4EF6\u5C01\u9762",key:"coverImg",render(e){return a(ae,{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(i,{label:"\u4E50\u56E2\u7C7B\u578B"},{default:()=>[B[e.orchestraType]]}),a(i,{label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[e.courseTypeCode?le[e.courseTypeCode]:"--"]})]})])},{title:"\u8BFE\u4EF6\u5185\u5BB9",key:"courseNum",render:e=>a(k,null,[a(C,{labelPlacement:"left",column:1},{default:()=>[a(i,{label:"\u8BFE\u65F6\u6570"},{default:()=>[e.courseNum]}),a(i,{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(i,{label:"\u66F4\u65B0\u4EBA"},{default:()=>[e.operatorName]}),a(i,{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?f(a(r,{type:"error",size:"small",text:!0,onClick:()=>y(e,!1)},{default:()=>[n("\u505C\u7528")]}),[[g("auth"),"lessonCourseware/updateEnableFlag1608067923699892226"]]):f(a(r,{type:"primary",size:"small",text:!0,onClick:()=>y(e,!0)},{default:()=>[n("\u542F\u7528")]}),[[g("auth"),"lessonCourseware/updateEnableFlag1608067923699892226"]]),f(a(r,{type:"primary",size:"small",text:!0,onClick:()=>{o.push({path:"/coursewareDetail",query:{id:e.id}})}},{default:()=>[n("\u8BE6\u60C5")]}),[[g("auth"),"coursewareDetail1607207526805606402"]]),f(a(r,{type:"primary",size:"small",text:!0,onClick:()=>U(e)},{default:()=>[n("\u5220\u9664")]}),[[g("auth"),"lessonCourseware/delete1610257235044466690"]])]})}}],p=J(),_=()=>{t.pagination.page=1,F()},U=e=>m(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:()=>m(this,null,function*(){console.log("row",e),(yield j(e.id)).data&&(_(),d.success("\u5220\u9664\u6210\u529F"))})})}),N=()=>{var e;(e=p.value)==null||e.submit()},R=()=>{var e;(e=p.value)==null||e.reset()},b=v({loading:!1,importRef:null}),S=e=>m(this,null,function*(){console.log(e.file),b.loading=!0;try{const s=yield se(e.file.file,()=>{}),c=yield V({dataType:"COURSEWARE",fileName:e.file.name,importUrl:s});if(console.log("\u{1F680} ~ res:",c),b.loading=!1,c.data){if(c.data.insertRow===0&&c.data.invalidRow===0){d.error("\u5BFC\u5165\u5931\u8D25\uFF0C\u8868\u683C\u4E3A\u7A7A");return}if(c.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:c.data.respUrl,download:!0},[n("\u4E0B\u8F7D")])]})});return}d.success("\u5BFC\u5165\u6210\u529F")}}catch(s){}b.loading=!1});return()=>a("div",{class:"system-menu-container"},[a(Q,{show:b.loading},{default:()=>[a("div",{class:["section-container"]},[a(q,{ref:p,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(T,{placeholder:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",clearable:!0,value:l.courseTypeCode,"onUpdate:value":e=>l.courseTypeCode=e,options:te},null)]}),a(h,{path:"enableFlag",label:"\u662F\u5426\u542F\u7528"},{default:()=>[a(T,{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(T,{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(T,{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(r,{type:"primary",onClick:N},{default:()=>[n("\u641C\u7D22")]}),a(r,{type:"default",onClick:R},{default:()=>[n("\u91CD\u7F6E")]})]})]})]}),a(w,{style:{paddingBottom:"12px"},justify:"space-between"},{default:()=>[f(a(r,{type:"primary",onClick:()=>{t.visiableKnowledge=!0,o.push({path:"/coursewareDetail"})}},{default:()=>[n("\u65B0\u589E\u8BFE\u4EF6")]}),[[g("auth"),"coursewareDetail1607207526805606402"]]),a(w,null,{default:()=>[f(a(r,{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")]}),[[g("auth"),"downloadCoursewareTemplate1793540443017875457"]]),f(a("div",null,[a(Z,{ref:e=>b.importRef=e,showFileList:!1,accept:".xlsx",customRequest:S},{default:()=>[a(r,{type:"primary",onClick:()=>{var e;(e=b.importRef)==null||e.clear()}},{default:()=>[n("\u5BFC\u5165\u8BFE\u4EF6")]})]})]),[[g("auth"),"Importcourseware1793540542561292290"]])]})]}),a(ee,{loading:t.loading,columns:u(),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{ye as default};