var I=Object.defineProperty;var R=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var x=(s,t,l)=>t in s?I(s,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[t]=l,S=(s,t)=>{for(var l in t||(t={}))P.call(t,l)&&x(s,l,t[l]);if(R)for(var l of R(t))z.call(t,l)&&x(s,l,t[l]);return s};var m=(s,t,l)=>new Promise((v,c)=>{var F=u=>{try{h(l.next(u))}catch(f){c(f)}},_=u=>{try{h(l.throw(u))}catch(f){c(f)}},h=u=>u.done?v(u.value):Promise.resolve(u.value).then(F,_);h((l=l.apply(s,t)).next())});import{S as O}from"./index.43f1d419.js";import{P as j}from"./index.0202f458.js";import{w as q,x as K,y as M,z as V}from"./api.46dbfc37.js";import{d as W,c as H,a as C,ai as $,u as G,B as J,r as Q,i as a,dk as X,l as g,_ as Y,ce as T,a9 as w,p,k as n,H as y,cd as Z,a1 as ee,cg as ae,da as E,d9 as d,aj as k,ae as te,bn as le,bC as b}from"./index.17aa86ea.js";import{l as oe,k as se}from"./knowledgeTypeData.3b15dd0b.js";import{o as B,c as ne,g as re}from"./teachingData.8ab9ee13.js";import{q as ue}from"./api.bac88ad3.js";import{a as ie}from"./uploadFile.0e9ae452.js";import"./searchs.b637f0d6.js";import"./oss-file-upload.2b02b3e6.js";function pe(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!le(s)}const we=W({name:"courseware-manage",setup(){const s=H(),t=C({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null,staffList:[],orchestraTypeList:[]}),l=C({orchestraType:null,name:"",keyword:"",enableFlag:null,operatorId:null,level:null,courseTypeCode:null}),v=$(),c=G();C({list:[],index:-1});const F=()=>m(this,null,function*(){try{t.loading=!0;const e=S({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}}),_=()=>m(this,null,function*(){try{const{data:e}=yield ue({page:1,rows:999});Array.isArray(e.rows)&&(t.staffList=e.rows.map(o=>({label:o.nickname,value:o.id})))}catch(e){}});J(()=>{_(),F();for(let e in B)t.orchestraTypeList.push({label:B[e],value:e})});const h=(e,o)=>{v.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:()=>m(this,null,function*(){(yield V({id:e.id,enableFlag:o})).data&&(D(),c.success("\u64CD\u4F5C\u6210\u529F"))})})},u=()=>[{title:"\u8BFE\u4EF6\u4FE1\u606F",key:"id",render:e=>{let o;return a(k,null,[a(E,{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]}),a(d,{label:"\u8BFE\u4EF6\u7EA7\u522B"},pe(o=re(e.level))?o:{default:()=>[o]})]})])}},{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(E,{labelPlacement:"left",column:1},{default:()=>[a(d,{label:"\u4E50\u56E2\u7C7B\u578B"},{default:()=>[B[e.orchestraType]]}),a(d,{label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[e.courseTypeCode?se[e.courseTypeCode]:"--"]})]})])},{title:"\u8BFE\u4EF6\u5185\u5BB9",key:"courseNum",render:e=>a(k,null,[a(E,{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(E,{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?y(a(p,{type:"error",size:"small",text:!0,onClick:()=>h(e,!1)},{default:()=>[n("\u505C\u7528")]}),[[b("auth"),"lessonCourseware/updateEnableFlag1608067923699892226"]]):y(a(p,{type:"primary",size:"small",text:!0,onClick:()=>h(e,!0)},{default:()=>[n("\u542F\u7528")]}),[[b("auth"),"lessonCourseware/updateEnableFlag1608067923699892226"]]),y(a(p,{type:"primary",size:"small",text:!0,onClick:()=>{s.push({path:"/coursewareDetail",query:{id:e.id}})}},{default:()=>[n("\u8BE6\u60C5")]}),[[b("auth"),"coursewareDetail1607207526805606402"]]),y(a(p,{type:"primary",size:"small",text:!0,onClick:()=>U(e)},{default:()=>[n("\u5220\u9664")]}),[[b("auth"),"lessonCourseware/delete1610257235044466690"]])]})}}],f=Q(),D=()=>{t.pagination.page=1,F()},U=e=>m(this,null,function*(){v.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 M(e.id)).data&&(D(),c.success("\u5220\u9664\u6210\u529F"))})})}),L=()=>{var e;(e=f.value)==null||e.submit()},N=()=>{var e;(e=f.value)==null||e.reset()},r=C({loading:!1,dataType:"COURSEWARE",importRef:null}),A=e=>m(this,null,function*(){console.log(e.file),r.loading=!0;try{const o=yield ie(e.file.file,()=>{}),i=yield K({dataType:r.dataType,fileName:e.file.name,importUrl:o});if(r.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){v.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){}r.loading=!1});return()=>a("div",{class:"system-menu-container"},[a(X,{show:r.loading},{default:()=>[a("div",{class:["section-container"]},[a(O,{ref:f,model:l,onSubmit:D,onSetModel:e=>Object.assign(l,e),saveKey:"courseware-manage-ad-key"},{default:()=>[a(g,{path:"keyword",label:"\u5173\u952E\u5B57"},{default:()=>[a(Y,{value:l.keyword,"onUpdate:value":e=>l.keyword=e,placeholder:"\u8BF7\u8F93\u5165\u8BFE\u4EF6\u540D\u79F0/\u7F16\u53F7",clearable:!0},null)]}),a(g,{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:oe},null)]}),a(g,{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(g,{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(g,{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(g,{path:"level",label:"\u8BFE\u4EF6\u7EA7\u522B"},{default:()=>[a(T,{placeholder:"\u8BF7\u8F93\u5165\u8BFE\u4EF6\u7EA7\u522B",clearable:!0,value:l.level,"onUpdate:value":e=>l.level=e,options:ne,filterable:!0},null)]}),a(g,null,{default:()=>[a(w,null,{default:()=>[a(p,{type:"primary",onClick:L},{default:()=>[n("\u641C\u7D22")]}),a(p,{type:"default",onClick:N},{default:()=>[n("\u91CD\u7F6E")]})]})]})]}),a(w,{style:{paddingBottom:"12px"},justify:"space-between"},{default:()=>[y(a(p,{type:"primary",onClick:()=>{t.visiableKnowledge=!0,s.push({path:"/coursewareDetail"})}},{default:()=>[n("\u65B0\u589E\u8BFE\u4EF6")]}),[[b("auth"),"coursewareDetail1607207526805606402"]]),a(w,null,{default:()=>[y(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")]}),[[b("auth"),"downloadCoursewareTemplate1793540443017875457"]]),y(a("div",null,[a(Z,{multiple:!1,ref:e=>r.importRef=e,showFileList:!1,accept:".xlsx",customRequest:A},{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;r.dataType=e,console.log(r.importRef),(o=r.importRef)==null||o.clear(),(i=r.importRef)==null||i.openOpenFileDialog()}},{default:()=>[a(p,{type:"primary",onClick:e=>e.stopPropagation()},{default:()=>[n("\u5BFC\u5165\u6570\u636E")]})]})]})]),[[b("auth"),"Importcourseware1793540542561292290"]])]})]}),a(ae,{loading:t.loading,columns:u(),data:t.dataList},null),a(j,{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{we as default};