var B=Object.defineProperty,q=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var P=(s,r,n)=>r in s?B(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n,C=(s,r)=>{for(var n in r||(r={}))O.call(r,n)&&P(s,n,r[n]);if(T)for(var n of T(r))j.call(r,n)&&P(s,n,r[n]);return s},b=(s,r)=>q(s,E(r));var m=(s,r,n)=>new Promise((o,d)=>{var t=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(t,f);g((n=n.apply(s,r)).next())});import{T as R}from"./index.2b7d53fc.js";import{d as K,ai as S,u as I,a as h,r as z,B as F,i as a,dq as A,dr as M,l as N,_ as H,aj as _,N as V,a0 as G,a9 as D,p as y,k as w,cg as x,e as J,c as Q,H as v,at as W,dm as X,bC as L}from"./index.16e8fdaf.js";import{d as Y,e as Z,g as $,h as ee,i as ae}from"./api.41253625.js";import{S as te}from"./index.f939e49e.js";import{P as oe}from"./index.801838ae.js";import{e as ie}from"./api.92ca8a9a.js";import{N as le}from"./Cascader.db72adcb.js";import{N as ne}from"./PageHeader.aa2b571c.js";import"./tabsView.ca24b6d8.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=K({name:"addMaterialKnowledge",props:{parentData:{type:Object,default:()=>{}}},emits:["close"],setup(s,{emit:r}){console.log("\u{1F680} ~ props",s.parentData),S();const n=I(),o=h({loading:!1,saveLoading:!1,pagination:{page:1,rows:10,pageTotal:10},dataList:[],checkList:[]}),d=h({keyword:"",materialCategoryId:null}),t=h({list:[],index:-1,loading:!1}),f=()=>m(this,null,function*(){t.loading=!0;try{const{data:e}=yield ie({page:1});t.list=(e==null?void 0:e.rows)||[]}catch(e){}t.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()},i=()=>{var e;(e=u.value)==null||e.submit()},l=()=>{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}});F(()=>{f(),p()});const U=()=>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()=>a(_,null,[a(te,{style:{padding:0,boxShadow:"none"},ref:u,"label-width":"",model:d,onSubmit:k,onSetModel:e=>Object.assign(d,e),saveKey:"addMaterialKnowledge-key"},{default:()=>[a(A,{gutter:14},{default:()=>[a(M,{span:6},{default:()=>[a(N,{label:"\u7D20\u6750\u540D\u79F0/\u7F16\u53F7",path:"keyword"},{default:()=>[a(H,{value:d.keyword,"onUpdate:value":e=>d.keyword=e,onKeydown:e=>{e.code==="Enter"&&k()},clearable:!0},null)]})]}),a(M,{span:6},{default:()=>[a(N,{label:"\u7D20\u6750\u5206\u7C7B",path:"materialCategoryId"},{default:()=>[a(le,{value:d.materialCategoryId,"onUpdate:value":e=>d.materialCategoryId=e,options:t.list,checkStrategy:"child",childrenField:"subMaterialCategoryList",expandTrigger:"hover",valueField:"id",labelField:"name",clearable:!0},{empty:()=>t.loading?a(_,null,[a(V,{description:"\u52A0\u8F7D\u4E2D"},{icon:()=>a(G,{size:"30",class:de.loading},{default:()=>[a("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 1024 1024"},[a("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})]})]}),a(M,{span:6},{default:()=>[a(N,null,{default:()=>[a(D,null,{default:()=>[a(y,{type:"primary",onClick:i},{default:()=>[w("\u641C\u7D22")]}),a(y,{type:"default",onClick:l},{default:()=>[w("\u91CD\u7F6E")]})]})]})]})]})]}),a(x,{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),a(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),a(y,{type:"primary",disabled:!o.checkList.length,loading:o.saveLoading,onClick:()=>U()},{default:()=>[w("\u4FDD \u5B58")]})])}}),be=K({name:"knowledgeDetail",setup(){const s=I(),r=S(),n=J(),o=Q(),d=h({name:n.query.name,id:n.query.id,courseTypeCode:n.query.courseTypeCode}),t=h({loading:!1,dataList:[],checkList:[],isMover:!1,visiableKnowledge:!1,modalType:"add",materail:null}),f=()=>[{type:"selection"},{title:"\u7D20\u6750\u540D\u79F0",key:"materialName",render(i){return a(R,{to:{path:"/educationalManage/educationalManage",query:{id:i.materialId}}},{default:()=>[i.materialName]})}},{title:"\u7D20\u6750\u5206\u7C7B",key:"materialCategoryName"},{title:"\u5206\u6BB5\u7F16\u53F7",key:"sn",render(i){return a(R,{to:{path:"/educationalManage/educationalManage"}},{default:()=>[i.sn]})}},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName"},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(i,l){return a(D,null,{default:()=>[v(a(y,{text:!0,type:"primary",disabled:l===0,onClick:()=>u("up",l)},{default:()=>[w("\u4E0A\u79FB")]}),[[L("auth"),"knowledgePointMaterialRelation/update1750906809085853697"]]),v(a(y,{text:!0,type:"primary",disabled:l===t.dataList.length-1,onClick:()=>u("down",l)},{default:()=>[w("\u4E0B\u79FB")]}),[[L("auth"),"knowledgePointMaterialRelation/update1750906809085853697"]])]})}}],g=()=>m(this,null,function*(){t.loading=!0;try{const{data:i}=yield $({knowledgePointId:d.id,page:1,rows:9999});Array.isArray(i==null?void 0:i.rows)&&(t.dataList=i.rows.map((l,p)=>b(C({},l),{relOrder:p+1})))}catch(i){}t.loading=!1});F(()=>{g()});const c=()=>{const i=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*(){i.loading=!0;const l=yield ee(t.checkList);i.loading=!1,(l==null?void 0:l.code)==200&&(t.checkList=[],s.success("\u5220\u9664\u6210\u529F"),g())})})},u=(i,l)=>{i==="up"?l!=0?t.dataList[l]=t.dataList.splice(l-1,1,t.dataList[l])[0]:t.dataList.push(t.dataList.shift()):l!=t.dataList.length-1?t.dataList[l]=t.dataList.splice(l+1,1,t.dataList[l])[0]:t.dataList.unshift(t.dataList.splice(l,1)[0]),t.isMover=!0,k()},k=()=>{const i=t.dataList.map((l,p)=>({knowledgePointId:d.id,materialId:l.materialId,relOrder:p+1,id:l.id}));ae(i)};return()=>a("div",{class:"section-container"},[a(ne,{"on-back":()=>o.push("/educationalManage/knowledgeManage"),title:d.name},null),a(D,{style:{padding:"15px 0"}},{default:()=>[v(a(y,{type:"primary",onClick:()=>t.visiableKnowledge=!0},{default:()=>[w("\u65B0\u589E\u7D20\u6750")]}),[[L("auth"),"knowledgePointMaterialRelation/save1604770193787420673"]]),v(a(y,{type:"error",disabled:!t.checkList.length,onClick:()=>c()},{default:()=>[w("\u6279\u91CF\u5220\u9664")]}),[[L("auth"),"knowledgePointMaterialRelation/remove1604770313480273922"]])]}),a(x,{loading:t.loading,maxHeight:"calc(100vh - 290px)",rowKey:i=>i.id,columns:f(),data:t.dataList,onUpdateCheckedRowKeys:i=>{t.checkList=i}},null),a(W,{width:"80vw",show:t.visiableKnowledge,"onUpdate:show":i=>t.visiableKnowledge=i},{default:()=>[a(X,{title:"\u65B0\u589E\u7D20\u6750\u5173\u8054",closable:!0},{default:()=>[a(ue,{parentData:d,onClose:()=>{t.visiableKnowledge=!1,g()}},null)]})]})])}});export{be as default};