index.8593fc1c.js 7.7 KB

1
  1. var x=Object.defineProperty,U=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var T=(s,d,i)=>d in s?x(s,d,{enumerable:!0,configurable:!0,writable:!0,value:i}):s[d]=i,L=(s,d)=>{for(var i in d||(d={}))q.call(d,i)&&T(s,i,d[i]);if(N)for(var i of N(d))E.call(d,i)&&T(s,i,d[i]);return s},v=(s,d)=>U(s,B(d));var m=(s,d,i)=>new Promise((o,r)=>{var t=c=>{try{g(i.next(c))}catch(u){r(u)}},w=c=>{try{g(i.throw(c))}catch(u){r(u)}},g=c=>c.done?o(c.value):Promise.resolve(c.value).then(t,w);g((i=i.apply(s,d)).next())});import{T as D}from"./index.435f1c4c.js";import{d as K,af as P,u as R,a as h,r as O,B as S,i as a,dr as z,ds as C,l as b,_ as A,ag as _,N as j,a0 as H,a9 as M,p as y,k as f,cg as I,e as V,c as G,aq as J,dn as Q}from"./index.9256ea96.js";import{d as W,e as X,g as Y,h as Z,i as $}from"./api.39041672.js";import{S as ee}from"./index.a9983230.js";import{P as ae}from"./index.9f8146c1.js";import{e as te}from"./api.ada48ea8.js";import{N as oe}from"./Cascader.db000f21.js";import{N as ne}from"./PageHeader.3737f430.js";import"./tabsView.5ee0d246.js";import"./searchs.b637f0d6.js";const le="_loading_simeq_4",ie="_rotate_simeq_1",se={loading:le,rotate:ie},de={VIDEO:"\u89C6\u9891",IMG:"\u56FE\u7247",SONG:"\u66F2\u76EE"},re=K({name:"addMaterialKnowledge",props:{parentData:{type:Object,default:()=>{}}},emits:["close"],setup(s,{emit:d}){console.log("\u{1F680} ~ props",s.parentData),P();const i=R(),o=h({loading:!1,saveLoading:!1,pagination:{page:1,rows:10,pageTotal:10},dataList:[],checkList:[]}),r=h({keyword:"",materialCategoryId:null}),t=h({list:[],index:-1,loading:!1}),w=()=>m(this,null,function*(){t.loading=!0;try{const{data:e}=yield te({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 de[e.type]}},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName"}],c=()=>m(this,null,function*(){const e=v(L({knowledgePointId:s.parentData.id},r),{courseTypeCode:s.parentData.courseTypeCode,page:o.pagination.page,rows:o.pagination.rows});return yield X(e)}),u=O(),k=()=>{o.pagination.page=1,p()},n=()=>{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}});S(()=>{w(),p()});const F=()=>m(this,null,function*(){o.saveLoading=!0;const e={knowledgePointId:s.parentData.id,materialId:o.checkList.join(",")};yield W(e),o.saveLoading=!1,i.success("\u4FDD\u5B58\u6210\u529F"),d("close")});return()=>a(_,null,[a(ee,{style:{padding:0,boxShadow:"none"},ref:u,"label-width":"",model:r,onSubmit:k,onSetModel:e=>Object.assign(r,e),saveKey:"addMaterialKnowledge-key"},{default:()=>[a(z,{gutter:14},{default:()=>[a(C,{span:6},{default:()=>[a(b,{label:"\u7D20\u6750\u540D\u79F0/\u7F16\u53F7",path:"keyword"},{default:()=>[a(A,{value:r.keyword,"onUpdate:value":e=>r.keyword=e,onKeydown:e=>{e.code==="Enter"&&k()},clearable:!0},null)]})]}),a(C,{span:6},{default:()=>[a(b,{label:"\u7D20\u6750\u5206\u7C7B",path:"materialCategoryId"},{default:()=>[a(oe,{value:r.materialCategoryId,"onUpdate:value":e=>r.materialCategoryId=e,options:t.list,checkStrategy:"child",childrenField:"subMaterialCategoryList",expandTrigger:"hover",valueField:"id",labelField:"name",clearable:!0},{empty:()=>t.loading?a(_,null,[a(j,{description:"\u52A0\u8F7D\u4E2D"},{icon:()=>a(H,{size:"30",class:se.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(C,{span:6},{default:()=>[a(b,null,{default:()=>[a(M,null,{default:()=>[a(y,{type:"primary",onClick:n},{default:()=>[f("\u641C\u7D22")]}),a(y,{type:"default",onClick:l},{default:()=>[f("\u91CD\u7F6E")]})]})]})]})]})]}),a(I,{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(ae,{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:()=>F()},{default:()=>[f("\u4FDD \u5B58")]})])}}),ve=K({name:"knowledgeDetail",setup(){const s=R(),d=P(),i=V(),o=G(),r=h({name:i.query.name,id:i.query.id,courseTypeCode:i.query.courseTypeCode}),t=h({loading:!1,dataList:[],checkList:[],isMover:!1,visiableKnowledge:!1,modalType:"add",materail:null}),w=()=>[{type:"selection"},{title:"\u7D20\u6750\u540D\u79F0",key:"materialName",render(n){return a(D,{to:{path:"/educationalManage/educationalManage",query:{id:n.materialId}}},{default:()=>[n.materialName]})}},{title:"\u7D20\u6750\u5206\u7C7B",key:"materialCategoryName"},{title:"\u5206\u6BB5\u7F16\u53F7",key:"sn",render(n){return a(D,{to:{path:"/educationalManage/educationalManage"}},{default:()=>[n.sn]})}},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName"},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(n,l){return a(M,null,{default:()=>[a(y,{text:!0,type:"primary",disabled:l===0,onClick:()=>u("up",l)},{default:()=>[f("\u4E0A\u79FB")]}),a(y,{text:!0,type:"primary",disabled:l===t.dataList.length-1,onClick:()=>u("down",l)},{default:()=>[f("\u4E0B\u79FB")]})]})}}],g=()=>m(this,null,function*(){t.loading=!0;try{const{data:n}=yield Y({knowledgePointId:r.id,page:1,rows:9999});Array.isArray(n==null?void 0:n.rows)&&(t.dataList=n.rows.map((l,p)=>v(L({},l),{relOrder:p+1})))}catch(n){}t.loading=!1});S(()=>{g()});const c=()=>{const n=d.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*(){n.loading=!0;const l=yield Z(t.checkList);n.loading=!1,(l==null?void 0:l.code)==200&&(t.checkList=[],s.success("\u5220\u9664\u6210\u529F"),g())})})},u=(n,l)=>{n==="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 n=t.dataList.map((l,p)=>({knowledgePointId:r.id,materialId:l.materialId,relOrder:p+1,id:l.id}));$(n)};return()=>a("div",{class:"section-container"},[a(ne,{"on-back":()=>o.push("/educationalManage/knowledgeManage"),title:r.name},null),a(M,{style:{padding:"15px 0"}},{default:()=>[a(y,{type:"primary",onClick:()=>t.visiableKnowledge=!0},{default:()=>[f("\u65B0\u589E\u7D20\u6750")]}),a(y,{type:"error",disabled:!t.checkList.length,onClick:()=>c()},{default:()=>[f("\u6279\u91CF\u5220\u9664")]})]}),a(I,{loading:t.loading,maxHeight:"calc(100vh - 290px)",rowKey:n=>n.id,columns:w(),data:t.dataList,onUpdateCheckedRowKeys:n=>{t.checkList=n}},null),a(J,{width:"80vw",show:t.visiableKnowledge,"onUpdate:show":n=>t.visiableKnowledge=n},{default:()=>[a(Q,{title:"\u65B0\u589E\u7D20\u6750\u5173\u8054",closable:!0},{default:()=>[a(re,{parentData:r,onClose:()=>{t.visiableKnowledge=!1,g()}},null)]})]})])}});export{ve as default};