1 |
- var J=Object.defineProperty,Q=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var j=(t,l,n)=>l in t?J(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n,x=(t,l)=>{for(var n in l||(l={}))q.call(l,n)&&j(t,n,l[n]);if(N)for(var n of N(l))R.call(l,n)&&j(t,n,l[n]);return t},U=(t,l)=>Q(t,W(l));var A=(t,l)=>{var n={};for(var u in t)q.call(t,u)&&l.indexOf(u)<0&&(n[u]=t[u]);if(t!=null&&N)for(var u of N(t))l.indexOf(u)<0&&R.call(t,u)&&(n[u]=t[u]);return n};var T=(t,l,n)=>new Promise((u,m)=>{var i=d=>{try{y(n.next(d))}catch(g){m(g)}},v=d=>{try{y(n.throw(d))}catch(g){m(g)}},y=d=>d.done?u(d.value):Promise.resolve(d.value).then(i,v);y((n=n.apply(t,l)).next())});import{S as X}from"./index.a9983230.js";import{P as Y}from"./index.9f8146c1.js";import{k as Z,a as ee,f as ae,b as le,c as te}from"./api.39041672.js";import{k as O,l as ne}from"./knowledgeTypeData.3b15dd0b.js";import{d as $,u as G,r as B,a as D,i as a,dl as ie,q as ue,l as c,_ as H,ce as I,db as oe,a8 as de,a7 as V,k as s,a9 as M,p as r,c as se,af as re,B as ce,cf as me,cg as ge,aa as fe,da as P,d9 as p,ag as K,ch as pe}from"./index.9256ea96.js";import{f as ye}from"./dateUtil.2c20b8d0.js";import"./searchs.b637f0d6.js";import"./dayjs.min.6ba71f07.js";const be=$({name:"KnowledgeModel",emits:["handleSuccess","close"],props:["item"],setup(t,{emit:l}){var F,w,S,_,e,b,C,k;const n=G(),u=B(!1),m=B(null),i=D({id:(F=t==null?void 0:t.item)!=null&&F.id?(w=t==null?void 0:t.item)==null?void 0:w.id:null,name:((S=t==null?void 0:t.item)==null?void 0:S.name)||"",courseTypeCode:((e=(_=t==null?void 0:t.item)==null?void 0:_.courseTypeCode)==null?void 0:e.split(","))||[],autoPlayFlag:((b=t==null?void 0:t.item)==null?void 0:b.autoPlayFlag)==!0?1:0,totalMaterialTimeSecond:(C=t==null?void 0:t.item)==null?void 0:C.totalMaterialTimeSecond,parentId:((k=t==null?void 0:t.item)==null?void 0:k.parentId)||0});function v(o,f){return Array.isArray(f)&&!f.length?new Error("\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B"):!0}const y={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u77E5\u8BC6\u70B9\u540D\u79F0",trigger:["blur","change"]}],courseTypeCode:[{validator:v,message:"\u8BF7\u9009\u62E9\u8BFE\u7A0B\u7C7B\u578B",trigger:["blur","change"]}]},d=()=>{let o=[];return Object.keys(O).map(f=>{o.push({label:O[f],value:f})}),o},g=()=>{var o;(o=m.value)==null||o.validate(f=>T(this,null,function*(){var z;if(console.log("\u{1F680} ~ err",f),!f){const E=U(x({},i),{courseTypeCode:((z=i.courseTypeCode)==null?void 0:z.join(","))||""});let h=null,L="";i.id?h=yield Z(E):(h=yield ee(E),L=h.data),(h==null?void 0:h.code)==200?(n.success("\u4FDD\u5B58\u6210\u529F"),l("handleSuccess",L)):n.warning("\u4FDD\u5B58\u5931\u8D25")}}))};return()=>a("div",null,[a(ie,{show:u.value},{default:()=>[a(ue,{ref:m,labelPlacement:"top",model:i,rules:y,"require-mark-placement":"left"},{default:()=>[a(c,{label:"\u77E5\u8BC6\u70B9\u540D\u79F0",path:"name"},{default:()=>[a(H,{value:i.name,"onUpdate:value":o=>i.name=o},null)]}),a(c,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseTypeCode"},{default:()=>[a(I,{multiple:!0,disabled:!!(t!=null&&t.item),value:i.courseTypeCode,"onUpdate:value":o=>i.courseTypeCode=o,options:d(),clearable:!0},null)]}),a(c,{label:"\u5EFA\u8BAE\u5B66\u4E60\u65F6\u957F",path:"totalMaterialTimeSecond",rule:[{required:!0,type:"number",min:0,message:"\u8BF7\u8F93\u5165\u6B63\u786E\u5EFA\u8BAE\u5B66\u4E60\u65F6\u957F",trigger:"blur"}]},{default:()=>[a(oe,{placeholder:"\u8BF7\u8F93\u5165\u5EFA\u8BAE\u5B66\u4E60\u65F6\u957F",showButton:!1,value:i.totalMaterialTimeSecond,"onUpdate:value":o=>i.totalMaterialTimeSecond=o},{suffix:()=>"s(\u79D2)"})]}),a(c,{label:"\u81EA\u52A8\u64AD\u653E\u4E0B\u4E00\u77E5\u8BC6\u70B9",path:"autoPlayFlag"},{default:()=>[a(de,{value:i.autoPlayFlag,"onUpdate:value":o=>i.autoPlayFlag=o},{default:()=>[a(V,{value:1},{default:()=>[s("\u662F")]}),a(V,{value:0},{default:()=>[s("\u5426")]})]})]})]}),a(M,{justify:"end"},{default:()=>[a(r,{onClick:()=>l("close")},{default:()=>[s("\u53D6\u6D88")]}),a(r,{type:"primary",onClick:g},{default:()=>[s("\u4FDD\u5B58")]})]})]})])}}),Ne=$({name:"knowledge-manage",setup(){const t=se(),l=D({loading:!1,pagination:{page:1,rows:10,pageTotal:0},dataList:[],visiableKnowledge:!1,modalType:"add",materail:null}),n=D({keyword:null,time:null,courseTypeCode:null,operatorId:null,enableFlag:null}),u=re(),m=G();D({list:[],index:-1});const i=()=>T(this,null,function*(){try{l.loading=!0;const e=n,{time:b}=e,C=A(e,["time"]),{data:k}=yield ae(U(x(x({},C),ye(b,["startUpdateTime","endUpdateTime"])),{page:l.pagination.page,rows:l.pagination.rows}));l.loading=!1,l.pagination.pageTotal=Number(k.total),l.dataList=k.rows||[]}catch(b){l.loading=!1}});ce(()=>{i()});const v=e=>{t.push({path:"/knowledgeDetail",query:{id:e.id,name:e.name,courseTypeCode:e.courseTypeCode}})},y=()=>[{title:"\u77E5\u8BC6\u70B9",key:"id",render:e=>a("div",{style:"display: inline-flex;vertical-align: middle;"},[a(P,{labelPlacement:"left",column:1},{default:()=>[a(p,{label:"\u77E5\u8BC6\u70B9\u540D\u79F0"},{default:()=>[e.name]}),a(p,{label:"\u77E5\u8BC6\u70B9\u7F16\u53F7"},{default:()=>[e.id]})]})])},{title:"\u8BFE\u7A0B\u7C7B\u578B",key:"courseTypeName",render:e=>a(K,null,[a(P,{labelPlacement:"left",column:1},{default:()=>[a(p,{label:"\u8BFE\u7A0B\u7C7B\u578B"},{default:()=>[e.courseTypeName]}),a(p,{label:"\u81EA\u52A8\u64AD\u653E"},{default:()=>[e.autoPlayFlag==1?"\u662F":"\u5426"]})]})])},{title:"\u5B66\u4E60\u4FE1\u606F",key:"totalMaterialNum",render:e=>a(K,null,[a(P,{labelPlacement:"left",column:1},{default:()=>[a(p,{label:"\u7D20\u6750\u6570\u91CF"},{default:()=>[e.totalMaterialNum]}),a(p,{label:"\u5EFA\u8BAE\u65F6\u957F"},{default:()=>[(e.totalMaterialTimeSecond||0)+"s"]})]})])},{title:"\u4E0A\u4F20\u4FE1\u606F",key:"updateTime",render:e=>a(K,null,[a(P,{labelPlacement:"left",column:1},{default:()=>[a(p,{label:"\u4FEE\u6539\u4EBA"},{default:()=>[e.operatorName]}),a(p,{label:"\u4FEE\u6539\u65F6\u95F4"},{default:()=>[e.updateTime]})]})])},{title:"\u72B6\u6001",key:"enableFlag",render(e){return a(pe,{type:e.enableFlag?"success":"warning"},{default:()=>[e.enableFlag?"\u5DF2\u542F\u7528":"\u672A\u542F\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",fixed:"right",render(e){return a(M,null,{default:()=>[a(r,{type:e.enableFlag?"error":"success",size:"small",text:!0,onClick:()=>F(e)},{default:()=>[e.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),!(e.children&&e.children.length>0)&&a(r,{type:"primary",size:"small",text:!0,onClick:()=>v(e)},{default:()=>[s("\u8BE6\u60C5")]}),e.parentId<=0&&!e.materialFlag&&a(r,{type:"primary",size:"small",text:!0,onClick:()=>{l.modalType="add-child",l.visiableKnowledge=!0,l.materail={parentId:e.id,courseTypeCode:e.courseTypeCode}}},{default:()=>[s("\u6DFB\u52A0\u5B50\u9879")]}),a(r,{type:"primary",size:"small",text:!0,onClick:()=>{l.modalType="update",l.visiableKnowledge=!0,l.materail=e}},{default:()=>[s("\u4FEE\u6539")]}),a(r,{type:"primary",size:"small",disabled:!!e.enableFlag,text:!0,onClick:()=>{w(e)}},{default:()=>[s("\u5220\u9664")]})]})}}],d=B(),g=()=>{l.pagination.page=1,i()},F=(e,b=!0)=>T(this,null,function*(){u.warning({title:"\u8B66\u544A",content:`\u662F\u5426${e.enableFlag?"\u505C\u7528":"\u542F\u7528"}\u6B64\u77E5\u8BC6\u70B9?`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>T(this,null,function*(){console.log("row",e),(yield le(e.id)).data&&(i(),m.success("\u4FEE\u6539\u6210\u529F"))})})}),w=e=>T(this,null,function*(){u.warning({title:"\u8B66\u544A",content:"\u662F\u5426\u786E\u8BA4\u5220\u9664\u6B64\u77E5\u8BC6\u70B9?",positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>T(this,null,function*(){console.log("row",e),(yield te(e.id)).data&&(g(),m.success("\u5220\u9664\u6210\u529F"))})})}),S=()=>{var e;(e=d.value)==null||e.submit()},_=()=>{var e;(e=d.value)==null||e.reset()};return()=>a("div",{class:"system-menu-container"},[a("div",{class:["section-container"]},[a(X,{ref:d,model:n,onSubmit:g,onSetModel:e=>Object.assign(n,e)},{default:()=>[a(c,{path:"search",label:"\u5173\u952E\u5B57"},{default:()=>[a(H,{value:n.keyword,"onUpdate:value":e=>n.keyword=e,placeholder:"\u77E5\u8BC6\u7EC4\u540D\u79F0/\u7F16\u53F7",clearable:!0},null)]}),a(c,{label:"\u8BFE\u7A0B\u7C7B\u578B",path:"courseTypeCode"},{default:()=>[a(I,{clearable:!0,value:n.courseTypeCode,"onUpdate:value":e=>n.courseTypeCode=e,options:ne},null)]}),a(c,{path:"time",label:"\u65F6\u95F4"},{default:()=>[a(me,{value:n.time,"onUpdate:value":e=>n.time=e,type:"daterange",clearable:!0},null)]}),a(c,{label:"\u72B6\u6001",path:"enableFlag"},{default:()=>[a(I,{placeholder:"\u8BF7\u9009\u62E9\u72B6\u6001",clearable:!0,value:n.enableFlag,"onUpdate:value":e=>n.enableFlag=e,options:[{label:"\u5DF2\u542F\u7528",value:1},{label:"\u672A\u542F\u7528",value:0}]},null)]}),a(c,null,{default:()=>[a(M,null,{default:()=>[a(r,{type:"primary",onClick:S},{default:()=>[s("\u641C\u7D22")]}),a(r,{type:"default",onClick:_},{default:()=>[s("\u91CD\u7F6E")]})]})]})]}),a(M,{style:{paddingBottom:"12px"}},{default:()=>[a(r,{type:"primary",onClick:()=>{l.visiableKnowledge=!0,l.modalType="add",l.materail=null}},{default:()=>[s("\u65B0\u589E\u77E5\u8BC6\u70B9")]})]}),a(ge,{loading:l.loading,columns:y(),data:l.dataList,"children-key":"children","default-expand-all":!1,"row-key":e=>e.id},null),a(Y,{page:l.pagination.page,"onUpdate:page":e=>l.pagination.page=e,pageSize:l.pagination.rows,"onUpdate:pageSize":e=>l.pagination.rows=e,pageTotal:l.pagination.pageTotal,"onUpdate:pageTotal":e=>l.pagination.pageTotal=e,onList:i,sync:!0},null),a(fe,{show:l.visiableKnowledge,"onUpdate:show":e=>l.visiableKnowledge=e,preset:"dialog",showIcon:!1,title:l.modalType!=="update"?"\u65B0\u589E\u77E5\u8BC6\u70B9":"\u4FEE\u6539\u77E5\u8BC6\u70B9",style:{width:"500px"},onClose:()=>{l.materail=null}},{default:()=>[a(be,{item:l.materail,onHandleSuccess:e=>{if(e){v(e);return}console.log(e),l.visiableKnowledge=!1,i()},onClose:()=>{l.visiableKnowledge=!1,l.materail=null}},null)]})])])}});export{Ne as default};
|