var U=Object.defineProperty,B=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var P=(s,r,n)=>r in s?U(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n,C=(s,r)=>{for(var n in r||(r={}))E.call(r,n)&&P(s,n,r[n]);if(T)for(var n of T(r))O.call(r,n)&&P(s,n,r[n]);return s},b=(s,r)=>B(s,q(r));var m=(s,r,n)=>new Promise((o,d)=>{var a=c=>{try{g(n.next(c))}catch(u){d(u)}},f=c=>{try{g(n.throw(c))}catch(u){d(u)}},g=c=>c.done?o(c.value):Promise.resolve(c.value).then(a,f);g((n=n.apply(s,r)).next())});import{T as j}from"./index.23ea742f.js";import{d as _,ai as K,u as S,a as h,r as z,B as I,i as t,dq as A,dr as M,l as N,_ as H,aj as R,N as V,a0 as G,a9 as D,p as y,k as w,cg as F,e as J,c as Q,H as v,at as W,dm as X,bC as L}from"./index.dbedee1d.js";import{d as Y,e as Z,g as $,h as ee,i as ae}from"./api.863d7b76.js";import{S as te}from"./index.77470f2a.js";import{P as oe}from"./index.6c1f867a.js";import{e as ie}from"./api.307d238d.js";import{N as le}from"./Cascader.cc98a5ae.js";import{N as ne}from"./PageHeader.bb0e2f3a.js";import"./tabsView.379fb8fa.js";import"./searchs.b637f0d6.js";const se="_loading_simeq_4",re="_rotate_simeq_1",de={loading:se,rotate:re},ce={VIDEO:"\u89C6\u9891",IMG:"\u56FE\u7247",SONG:"\u66F2\u76EE"},ue=_({name:"addMaterialKnowledge",props:{parentData:{type:Object,default:()=>{}}},emits:["close"],setup(s,{emit:r}){console.log("\u{1F680} ~ props",s.parentData),K();const n=S(),o=h({loading:!1,saveLoading:!1,pagination:{page:1,rows:10,pageTotal:10},dataList:[],checkList:[]}),d=h({keyword:"",materialCategoryId:null}),a=h({list:[],index:-1,loading:!1}),f=()=>m(this,null,function*(){a.loading=!0;try{const{data:e}=yield ie({page:1});a.list=(e==null?void 0:e.rows)||[]}catch(e){}a.loading=!1}),g=()=>[{type:"selection"},{title:"\u7D20\u6750\u540D\u79F0",key:"name",fixed:"left"},{title:"\u7D20\u6750\u5206\u7C7B",key:"materialCategoryName"},{title:"\u5206\u6BB5\u7F16\u53F7",key:"sn"},{title:"\u7D20\u6750\u7C7B\u578B",key:"type",render(e){return ce[e.type]}},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName"}],c=()=>m(this,null,function*(){const e=b(C({knowledgePointId:s.parentData.id},d),{courseTypeCode:s.parentData.courseTypeCode,page:o.pagination.page,rows:o.pagination.rows});return yield Z(e)}),u=z(),k=()=>{o.pagination.page=1,p()},l=()=>{var e;(e=u.value)==null||e.submit()},i=()=>{var e;(e=u.value)==null||e.reset()},p=()=>m(this,null,function*(){try{o.loading=!0;const{data:e}=yield c();o.loading=!1,o.pagination.pageTotal=Number(e.total),o.dataList=e.rows||[]}catch(e){o.loading=!1}});I(()=>{f(),p()});const x=()=>m(this,null,function*(){o.saveLoading=!0;const e={knowledgePointId:s.parentData.id,materialId:o.checkList.join(",")};yield Y(e),o.saveLoading=!1,n.success("\u4FDD\u5B58\u6210\u529F"),r("close")});return()=>t(R,null,[t(te,{style:{padding:0,boxShadow:"none"},ref:u,"label-width":"",model:d,onSubmit:k,onSetModel:e=>Object.assign(d,e),saveKey:"addMaterialKnowledge-key"},{default:()=>[t(A,{gutter:14},{default:()=>[t(M,{span:6},{default:()=>[t(N,{label:"\u7D20\u6750\u540D\u79F0/\u7F16\u53F7",path:"keyword"},{default:()=>[t(H,{value:d.keyword,"onUpdate:value":e=>d.keyword=e,onKeydown:e=>{e.code==="Enter"&&k()},clearable:!0},null)]})]}),t(M,{span:6},{default:()=>[t(N,{label:"\u7D20\u6750\u5206\u7C7B",path:"materialCategoryId"},{default:()=>[t(le,{value:d.materialCategoryId,"onUpdate:value":e=>d.materialCategoryId=e,options:a.list,checkStrategy:"child",childrenField:"subMaterialCategoryList",expandTrigger:"hover",valueField:"id",labelField:"name",clearable:!0},{empty:()=>a.loading?t(R,null,[t(V,{description:"\u52A0\u8F7D\u4E2D"},{icon:()=>t(G,{size:"30",class:de.loading},{default:()=>[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},[t("path",{d:"M988 548c-19.9 0-36-16.1-36-36c0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9a437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7c26.7 63.1 40.2 130.2 40.2 199.3c.1 19.9-16 36-35.9 36z",fill:"currentColor"},null)])]})})]):null})]})]}),t(M,{span:6},{default:()=>[t(N,null,{default:()=>[t(D,null,{default:()=>[t(y,{type:"primary",onClick:l},{default:()=>[w("\u641C\u7D22")]}),t(y,{type:"default",onClick:i},{default:()=>[w("\u91CD\u7F6E")]})]})]})]})]})]}),t(F,{loading:o.loading,maxHeight:"calc(100vh - 270px)",rowKey:e=>e.materialId,columns:g(),data:o.dataList,checkedRowKeys:o.checkList,"onUpdate:checkedRowKeys":e=>o.checkList=e},null),t(oe,{page:o.pagination.page,"onUpdate:page":e=>o.pagination.page=e,pageTotal:o.pagination.pageTotal,"onUpdate:pageTotal":e=>o.pagination.pageTotal=e,pageSize:o.pagination.rows,"onUpdate:pageSize":e=>o.pagination.rows=e,onList:p},null),t(y,{type:"primary",disabled:!o.checkList.length,loading:o.saveLoading,onClick:()=>x()},{default:()=>[w("\u4FDD \u5B58")]})])}}),be=_({name:"knowledgeDetail",setup(){const s=S(),r=K(),n=J(),o=Q(),d=h({name:n.query.name,id:n.query.id,courseTypeCode:n.query.courseTypeCode}),a=h({loading:!1,dataList:[],checkList:[],isMover:!1,visiableKnowledge:!1,modalType:"add",materail:null}),f=()=>[{type:"selection"},{title:"\u7D20\u6750\u540D\u79F0",key:"materialName",render(l){return t(j,{authLink:"material/page1750897012676493314",to:{path:"/educationalManage/educationalManage",query:{id:l.materialId}}},{default:()=>[l.materialName]})}},{title:"\u7D20\u6750\u5206\u7C7B",key:"materialCategoryName"},{title:"\u5206\u6BB5\u7F16\u53F7",key:"sn"},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName"},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(l,i){return t(D,null,{default:()=>[v(t(y,{text:!0,type:"primary",disabled:i===0,onClick:()=>u("up",i)},{default:()=>[w("\u4E0A\u79FB")]}),[[L("auth"),"knowledgePointMaterialRelation/update1750906809085853697"]]),v(t(y,{text:!0,type:"primary",disabled:i===a.dataList.length-1,onClick:()=>u("down",i)},{default:()=>[w("\u4E0B\u79FB")]}),[[L("auth"),"knowledgePointMaterialRelation/update1750906809085853697"]])]})}}],g=()=>m(this,null,function*(){a.loading=!0;try{const{data:l}=yield $({knowledgePointId:d.id,page:1,rows:9999});Array.isArray(l==null?void 0:l.rows)&&(a.dataList=l.rows.map((i,p)=>b(C({},i),{relOrder:p+1})))}catch(l){}a.loading=!1});I(()=>{g()});const c=()=>{const l=r.warning({title:"\u8B66\u544A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\u8FD9\u4E9B\u7D20\u6750\u77E5\u8BC6\u70B9\u5173\u8054?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>m(this,null,function*(){l.loading=!0;const i=yield ee(a.checkList);l.loading=!1,(i==null?void 0:i.code)==200&&(a.checkList=[],s.success("\u5220\u9664\u6210\u529F"),g())})})},u=(l,i)=>{l==="up"?i!=0?a.dataList[i]=a.dataList.splice(i-1,1,a.dataList[i])[0]:a.dataList.push(a.dataList.shift()):i!=a.dataList.length-1?a.dataList[i]=a.dataList.splice(i+1,1,a.dataList[i])[0]:a.dataList.unshift(a.dataList.splice(i,1)[0]),a.isMover=!0,k()},k=()=>{const l=a.dataList.map((i,p)=>({knowledgePointId:d.id,materialId:i.materialId,relOrder:p+1,id:i.id}));ae(l)};return()=>t("div",{class:"section-container"},[t(ne,{"on-back":()=>o.push("/educationalManage/knowledgeManage"),title:d.name},null),t(D,{style:{padding:"15px 0"}},{default:()=>[v(t(y,{type:"primary",onClick:()=>a.visiableKnowledge=!0},{default:()=>[w("\u65B0\u589E\u7D20\u6750")]}),[[L("auth"),"knowledgePointMaterialRelation/save1604770193787420673"]]),v(t(y,{type:"error",disabled:!a.checkList.length,onClick:()=>c()},{default:()=>[w("\u6279\u91CF\u5220\u9664")]}),[[L("auth"),"knowledgePointMaterialRelation/remove1604770313480273922"]])]}),t(F,{loading:a.loading,maxHeight:"calc(100vh - 290px)",rowKey:l=>l.id,columns:f(),data:a.dataList,onUpdateCheckedRowKeys:l=>{a.checkList=l}},null),t(W,{width:"80vw",show:a.visiableKnowledge,"onUpdate:show":l=>a.visiableKnowledge=l},{default:()=>[t(X,{title:"\u65B0\u589E\u7D20\u6750\u5173\u8054",closable:!0},{default:()=>[t(ue,{parentData:d,onClose:()=>{a.visiableKnowledge=!1,g()}},null)]})]})])}});export{be as default};