| 12 |
- import{cS as de,gV as me,fO as be,gv as W,h0 as se,fY as o,fw as _,cs as w,h2 as t,cy as a,cr as h,h5 as ee,cx as V,gA as f,fP as s,eV as z,B as X,cb as H,fZ as ye,cv as Ve,h3 as ke,ct as G,cu as pe,F as we,fV as $e,fh as Se,ae as Te,gQ as N,z as Pe,fB as Re,fu as Ie,fs as Me,cF as Ce}from"./admin-ChNvQhEc.js";import{_ as xe}from"./ParagraphDialog.vue_vue_type_script_setup_true_lang-Ya-QDlri.js";import"./ParagraphForm.vue_vue_type_script_setup_true_lang-D0R_9_MS.js";const ze={class:"dialog-footer"},qe=de({__name:"CreateProblemDialog",emits:["refresh"],setup(Q,{expose:E,emit:$}){const T=me(),{params:{id:b}}=T,y=H(()=>T.path.includes("shared")?"systemShare":T.path.includes("resource-management")?"systemManage":"workspace"),U=$,P=s(),k=s(!1),R=s({data:""}),C=be({data:[{required:!0,message:W("views.problem.tip.requiredMessage"),trigger:"blur"}]}),c=s(!1);se(c,n=>{n||(R.value={data:""})});const d=()=>{c.value=!0},S=async n=>{n&&await n.validate((u,v)=>{if(u){const x=R.value.data.split(`
- `).filter(function(q){return q!==""});z({type:"problem",systemType:y.value}).postProblems(b,x,k).then(q=>{X(W("common.createSuccess")),U("refresh"),c.value=!1})}})};return E({open:d}),(n,u)=>{const v=o("el-input"),x=o("el-form-item"),q=o("el-form"),D=o("el-button"),I=o("el-dialog");return _(),w(I,{title:n.$t("views.problem.createProblem"),modelValue:c.value,"onUpdate:modelValue":u[3]||(u[3]=F=>c.value=F),"close-on-click-modal":!1,"close-on-press-escape":!1,"destroy-on-close":!0},{footer:t(()=>[h("span",ze,[a(D,{onClick:u[1]||(u[1]=ee(F=>c.value=!1,["prevent"]))},{default:t(()=>[V(f(n.$t("common.cancel")),1)]),_:1}),a(D,{type:"primary",onClick:u[2]||(u[2]=F=>S(P.value)),loading:k.value},{default:t(()=>[V(f(n.$t("common.confirm")),1)]),_:1},8,["loading"])])]),default:t(()=>[a(q,{"label-position":"top",ref_key:"problemFormRef",ref:P,rules:C,model:R.value,"require-asterisk-position":"right"},{default:t(()=>[a(x,{label:n.$t("views.problem.title"),prop:"data"},{default:t(()=>[a(v,{modelValue:R.value.data,"onUpdate:modelValue":u[0]||(u[0]=F=>R.value.data=F),placeholder:n.$t("views.problem.tip.placeholder"),rows:10,type:"textarea"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},8,["rules","model"])]),_:1},8,["title","modelValue"])}}}),Be={class:"bold title align-center p-24 pb-0"},Ne={class:"p-8",style:{"padding-bottom":"8px"}},Ue={class:"flex lighter align-center"},Le={class:"p-24",style:{"padding-bottom":"8px","padding-top":"16px"}},Ae={class:"flex-between mb-16"},Ee={class:"bold title align-center"},Fe={class:"dialog-footer"},je=de({__name:"RelateProblemDialog",emits:["refresh"],setup(Q,{expose:E,emit:$}){const T=me(),{params:{id:b}}=T,y=H(()=>T.path.includes("shared")?"systemShare":T.path.includes("resource-management")?"systemManage":"workspace"),U=$,P=s(!1),k=s(!1),R=s([]),C=s([]),c=s([]),d=s(""),S=s([]),n=s([]),u=s(""),v=s(""),x=s("title"),q=s(""),D=s(!1),I=be({current_page:1,page_size:50,total:0});function F(){const l={problem_id_list:S.value,paragraph_list:n.value.map(r=>({paragraph_id:r.id,document_id:r.document_id}))};z({type:"problem",systemType:y.value}).putMulAssociationProblem(b,l,k).then(()=>{X(W("views.problem.tip.relatedSuccess")),P.value=!1})}function p(l){if(D.value)Y(l.id)?n.value.splice(n.value.indexOf(l.id),1):n.value.push(l);else{const r={paragraph_id:l.id,problem_id:d.value};Y(l.id)?z({type:"paragraph",systemType:y.value}).putDisassociationProblem(b,l.document_id,r,k).then(()=>{j(d.value)}):z({type:"paragraph",systemType:y.value}).putAssociationProblem(b,l.document_id,r,k).then(()=>{j(d.value)})}}function L(){I.current_page=1,c.value=[],u.value&&O(u.value)}function ae(l){I.current_page=1,c.value=[],u.value=l.id,O(l.id)}function te(){z({type:"document",systemType:y.value}).getDocumentList(b,k).then(l=>{C.value=l.data,R.value=l.data,u.value=C.value?.length>0?C.value[0].id:"",u.value&&O(u.value)})}function O(l){z({type:"paragraph",systemType:y.value}).getParagraphPage(b,l||u.value,I,v.value&&{[x.value]:v.value},k).then(r=>{c.value=[...c.value,...r.data.records],I.total=r.data.total})}function j(l){z({type:"problem",systemType:y.value}).getDetailProblems(b,l,k).then(r=>{n.value=r.data})}function J(l){return n.value.filter(r=>r.document_id===l).length}function Y(l){return n.value.some(r=>r.id===l)}return se(P,l=>{l||(R.value=[],C.value=[],c.value=[],n.value=[],D.value=!1,u.value="",v.value="",x.value="title",U("refresh"))}),se(q,l=>{c.value=[],R.value=l?C.value.filter(r=>r.name.includes(l)):C.value,u.value=R.value?.length>0?R.value[0].id:""}),E({open:l=>{te(),l.length==1?(d.value=l[0],j(l)):l.length>1&&(S.value=l,D.value=!0),P.value=!0}}),(l,r)=>{const K=o("el-input"),oe=o("auto-tooltip"),ne=o("el-badge"),M=o("common-list"),B=o("el-scrollbar"),le=o("el-col"),e=o("el-text"),i=o("el-option"),A=o("el-select"),ve=o("el-empty"),Z=o("CardBox"),fe=o("InfiniteScroll"),_e=o("el-row"),re=o("el-button"),ue=o("el-dialog"),ge=ye("loading");return _(),w(ue,{title:l.$t("views.problem.relateParagraph.title"),modelValue:P.value,"onUpdate:modelValue":r[5]||(r[5]=g=>P.value=g),width:"80%",class:"paragraph-dialog","destroy-on-close":"","close-on-click-modal":!1,"close-on-press-escape":!1},Ve({default:t(()=>[ke((_(),w(_e,null,{default:t(()=>[a(le,{span:6},{default:t(()=>[a(B,{height:"500","wrap-class":"paragraph-scrollbar"},{default:t(()=>[h("div",Be,f(l.$t("views.problem.relateParagraph.selectDocument")),1),h("div",Ne,[a(K,{modelValue:q.value,"onUpdate:modelValue":r[0]||(r[0]=g=>q.value=g),placeholder:l.$t("views.problem.relateParagraph.placeholder"),"prefix-icon":"Search",clearable:""},null,8,["modelValue","placeholder"]),a(M,{data:R.value,class:"mt-8",onClick:ae,"default-active":u.value},{default:t(({row:g})=>[h("span",Ue,[a(oe,{content:g.name},{default:t(()=>[V(f(g.name),1)]),_:2},1032,["content"]),J(g.id)?(_(),w(ne,{key:0,value:J(g.id),type:"primary",class:"paragraph-badge ml-4"},null,8,["value"])):G("",!0)])]),_:1},8,["data","default-active"])])]),_:1})]),_:1}),a(le,{span:18,class:"border-l"},{default:t(()=>[a(B,{height:"500","wrap-class":"paragraph-scrollbar"},{default:t(()=>[h("div",Le,[h("div",Ae,[h("div",Ee,[V(f(l.$t("components.selectParagraph.title"))+" ",1),a(e,null,{default:t(()=>[V(" ("+f(l.$t("views.problem.relateParagraph.selectedParagraph"))+":"+f(J(u.value))+" "+f(l.$t("views.problem.relateParagraph.count"))+") ",1)]),_:1})]),a(K,{modelValue:v.value,"onUpdate:modelValue":r[2]||(r[2]=g=>v.value=g),placeholder:l.$t("common.search"),class:"input-with-select",style:{width:"260px"},onChange:L},{prepend:t(()=>[a(A,{modelValue:x.value,"onUpdate:modelValue":r[1]||(r[1]=g=>x.value=g),placeholder:"Select",style:{width:"80px"}},{default:t(()=>[a(i,{label:l.$t("common.title"),value:"title"},null,8,["label"]),a(i,{label:l.$t("common.content"),value:"content"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"])]),c.value.length==0?(_(),w(ve,{key:0,description:l.$t("common.noData")},null,8,["description"])):(_(),w(fe,{key:1,size:c.value.length,total:I.total,page_size:I.page_size,current_page:I.current_page,"onUpdate:current_page":r[3]||(r[3]=g=>I.current_page=g),onLoad:O,loading:k.value},{default:t(()=>[(_(!0),pe(we,null,$e(c.value,(g,he)=>(_(),w(Z,{key:he,shadow:"hover",title:g.title||"-",description:g.content,class:Se(["paragraph-card cursor mb-16",Y(g.id)?"selected":""]),showIcon:!1,onClick:m=>p(g)},null,8,["title","description","class","onClick"]))),128))]),_:1},8,["size","total","page_size","current_page","loading"]))])]),_:1})]),_:1})]),_:1})),[[ge,k.value]])]),_:2},[D.value?{name:"footer",fn:t(()=>[h("div",Fe,[a(re,{onClick:r[4]||(r[4]=g=>P.value=!1)},{default:t(()=>[V(f(l.$t("common.cancel")),1)]),_:1}),a(re,{type:"primary",onClick:F},{default:t(()=>[V(f(l.$t("common.confirm")),1)]),_:1})])]),key:"0"}:void 0]),1032,["title","modelValue"])}}}),De=Te(je,[["__scopeId","data-v-a862ea99"]]),He={class:"p-8"},We={class:"footer-content flex-between"},Qe=de({__name:"DetailProblemDrawer",props:{currentId:{},currentContent:{},next:{},pre:{},pre_disable:{type:Boolean},next_disable:{type:Boolean}},emits:["update:currentId","update:currentContent","refresh"],setup(Q,{expose:E,emit:$}){const T=Q,b=$,y=me(),{params:{id:U}}=y,P=H(()=>y.path.includes("shared")?"systemShare":y.path.includes("resource-management")?"systemManage":"workspace"),k=H(()=>Re.knowledge[P.value]),R=s(),C=s(),c=s(!1),d=s(!1),S=s([]);function n(p){const L={paragraph_id:p.id,problem_id:T.currentId};z({type:"paragraph",systemType:P.value}).putDisassociationProblem(p.knowledge_id,p.document_id,L,c).then(()=>{D()})}function u(){R.value.open([T.currentId])}function v(p){C.value.open(p,"edit")}function x(p){if(p){const L={content:p};z({type:"problem",systemType:P.value}).putProblems(U,T.currentId,L,c).then(()=>{b("update:currentContent",p),X(W("common.modifySuccess"))})}else Pe(W("views.problem.tip.errorMessage"))}function q(){S.value=[]}function D(){T.currentId&&d.value&&z({type:"problem",systemType:P.value}).getDetailProblems(U,T.currentId,c).then(p=>{S.value=p.data})}function I(){D()}return se(()=>T.currentId,()=>{S.value=[],D()}),se(d,p=>{p||(b("update:currentId",""),b("update:currentContent",""),b("refresh"))}),E({open:()=>{D(),d.value=!0}}),(p,L)=>{const ae=o("ReadWrite"),te=o("el-form-item"),O=o("AppIcon"),j=o("el-button"),J=o("el-tooltip"),Y=o("el-scrollbar"),ie=o("Document"),l=o("el-icon"),r=o("el-text"),K=o("CardBox"),oe=o("el-form"),ne=o("el-drawer"),M=ye("loading");return _(),w(ne,{modelValue:d.value,"onUpdate:modelValue":L[1]||(L[1]=B=>d.value=B),size:"60%",onClose:q},{header:t(()=>[h("h4",null,f(p.$t("views.problem.detailProblem")),1)]),footer:t(()=>[h("div",null,[k.value.doc_edit(N(U))?(_(),w(j,{key:0,onClick:u},{default:t(()=>[V(f(p.$t("views.problem.relateParagraph.title")),1)]),_:1})):G("",!0),a(j,{onClick:Q.pre,disabled:Q.pre_disable||c.value},{default:t(()=>[V(f(p.$t("common.pages.prev")),1)]),_:1},8,["onClick","disabled"]),a(j,{onClick:Q.next,disabled:Q.next_disable||c.value},{default:t(()=>[V(f(p.$t("common.pages.next")),1)]),_:1},8,["onClick","disabled"])])]),default:t(()=>[h("div",null,[a(Y,null,{default:t(()=>[h("div",He,[ke((_(),w(oe,{"label-position":"top",onSubmit:L[0]||(L[0]=ee(()=>{},["prevent"]))},{default:t(()=>[a(te,{label:p.$t("views.problem.title")},{default:t(()=>[a(ae,{onChange:x,data:Q.currentContent,showEditIcon:k.value.problem_edit(N(U)),maxlength:256},null,8,["data","showEditIcon"])]),_:1},8,["label"]),a(te,{label:p.$t("views.problem.relateParagraph.title")},{default:t(()=>[(_(!0),pe(we,null,$e(S.value,(B,le)=>(_(),w(K,{key:le,title:B.title||"-",class:"cursor mb-8 w-full",showIcon:!1,onClick:ee(e=>k.value.doc_edit(N(U))&&v(B),["stop"]),style:{height:"210px"}},{tag:t(()=>[a(J,{effect:"dark",content:p.$t("views.problem.setting.cancelRelated"),placement:"top"},{default:t(()=>[k.value.problem_relate(N(U))?(_(),w(j,{key:0,type:"primary",text:"",onClick:ee(e=>n(B),["stop"])},{default:t(()=>[a(O,{iconName:"app-quxiaoguanlian"})]),_:1},8,["onClick"])):G("",!0)]),_:2},1032,["content"])]),footer:t(()=>[h("div",We,[a(r,null,{default:t(()=>[a(l,null,{default:t(()=>[a(ie)]),_:1}),V(" "+f(B?.document_name),1)]),_:2},1024)])]),default:t(()=>[a(Y,{height:"110"},{default:t(()=>[V(f(B.content),1)]),_:2},1024)]),_:2},1032,["title","onClick"]))),128))]),_:1},8,["label"])]),_:1})),[[M,c.value]])])]),_:1}),a(xe,{ref_key:"ParagraphDialogRef",ref:C,title:p.$t("views.paragraph.editParagraph"),apiType:P.value,onRefresh:I},null,8,["title","apiType"]),a(De,{ref_key:"RelateProblemDialogRef",ref:R,onRefresh:I},null,512)])]),_:1},8,["modelValue"])}}}),Oe={class:"document p-16-24"},Ye={class:"mb-16"},Ze={class:"main-calc-height"},Ge={class:"p-24"},Je={class:"flex-between"},Ke={key:1},Xe={class:"mr-4"},at=de({__name:"index",setup(Q){const E=me(),{params:{id:$,folderId:T}}=E,b=H(()=>E.path.includes("shared")?"systemShare":E.path.includes("resource-management")?"systemManage":E.path.includes("share/")?"workspaceShare":"workspace"),y=H(()=>Re.knowledge[b.value]),U=H(()=>T==="share"),P=s(),k=s(),R=s(),C=s(!1),c=s(""),d=s(""),S=s(""),n=be({current_page:1,page_size:10,total:0,page_sizes:[10,20,50,100,1e3]}),u=s(""),v=s([]),x=H(()=>v.value.map((e,i)=>({[e.id]:i})).reduce((e,i)=>({...e,...i}),{})),q=s(),D=s([]);function I(e){const i=[];e?i.push(e.id):D.value.map(A=>{A&&i.push(A.id)}),P.value.open(i)}function F(){R.value.open()}const p=e=>{D.value=e};function L(e){C.value=!0;const i=[e];z({type:"problem",systemType:b.value}).postProblems($,i).then(()=>{M(),X(W("common.createSuccess"))}).catch(()=>{C.value=!1})}function ae(){const e=[];D.value.map(i=>{i&&e.push(i.id)}),z({type:"problem",systemType:b.value}).putMulProblem($,e,C).then(()=>{X(W("views.document.delete.successMessage")),q.value?.clearSelection(),M()})}function te(e){z({type:"problem",systemType:b.value}).delProblems($,e.id,C).then(()=>{X(W("common.deleteSuccess")),M()})}function O(e,i){if(e){const A={content:e};z({type:"problem",systemType:b.value}).putProblems($,i,A,C).then(()=>{M(),X(W("common.modifySuccess"))})}else Pe(W("views.problem.tip.errorMessage"))}function j(e,i){i&&i.property==="content"&&(c.value=e.id)}function J(){c.value=""}const Y=()=>{let e=x.value[d.value]+1;if(e>=v.value.length){if(e+(n.current_page-1)*n.page_size>=n.total-1)return;n.current_page=n.current_page+1,M().then(()=>{e=0,d.value=v.value[e].id,S.value=v.value[e].content})}else d.value=v.value[e].id,S.value=v.value[e].content},ie=H(()=>x.value[d.value]-1<0&&n.current_page<=1),l=H(()=>{const e=x.value[d.value]+1;return e>=v.value.length&&e+(n.current_page-1)*n.page_size>=n.total-1}),r=()=>{let e=x.value[d.value]-1;if(e<0){if(n.current_page<=1)return;n.current_page=n.current_page-1,M().then(()=>{e=n.page_size-1,d.value=v.value[e].id,S.value=v.value[e].content})}else d.value=v.value[e].id,S.value=v.value[e].content};function K(e,i){i&&i.type==="selection"||E.path.includes("share/")||e.paragraph_count&&(d.value=e.id,S.value=e.content,k.value.open())}const oe=({row:e})=>d.value===e?.id?"highlight":"";function ne(){n.current_page=1,M()}function M(){return z({type:"problem",isShared:U.value,systemType:b.value}).getProblemsPage($,n,u.value&&{content:u.value},C).then(e=>{v.value=e.data.records,n.total=e.data.total})}function B(){M(),q.value?.clearSelection()}function le(){n.current_page=1,M()}return Ie(()=>{M()}),Me(()=>{}),(e,i)=>{const A=o("el-button"),ve=o("el-input"),Z=o("el-table-column"),fe=o("ReadWrite"),_e=o("el-link"),re=o("AppIcon"),ue=o("el-tooltip"),ge=o("app-table"),g=o("el-card"),he=ye("loading");return _(),pe("div",Oe,[h("h2",Ye,f(e.$t("views.problem.title")),1),a(g,{style:{"--el-card-padding":"0"}},{default:t(()=>[h("div",Ze,[h("div",Ge,[h("div",Je,[h("div",null,[y.value.problem_create(N($))?(_(),w(A,{key:0,type:"primary",onClick:F},{default:t(()=>[V(f(e.$t("views.problem.createProblem")),1)]),_:1})):G("",!0),y.value.problem_relate(N($))?(_(),w(A,{key:1,onClick:i[0]||(i[0]=m=>I()),disabled:D.value.length===0},{default:t(()=>[V(f(e.$t("views.problem.relateParagraph.title")),1)]),_:1},8,["disabled"])):G("",!0),y.value.problem_delete(N($))?(_(),w(A,{key:2,onClick:ae,disabled:D.value.length===0},{default:t(()=>[V(f(e.$t("views.problem.setting.batchDelete")),1)]),_:1},8,["disabled"])):G("",!0)]),a(ve,{modelValue:u.value,"onUpdate:modelValue":i[1]||(i[1]=m=>u.value=m),placeholder:e.$t("common.searchBar.placeholder"),"prefix-icon":"Search",class:"w-240",onChange:M,clearable:""},null,8,["modelValue","placeholder"])]),ke((_(),w(ge,{ref_key:"multipleTableRef",ref:q,class:"mt-16",data:v.value,"pagination-config":n,"quick-create":y.value.problem_create(N($)),quickCreateName:e.$t("views.problem.quickCreateName"),quickCreatePlaceholder:e.$t("views.problem.quickCreateProblem"),quickCreateMaxlength:256,onSizeChange:ne,onChangePage:M,onCellMouseEnter:j,onCellMouseLeave:J,onCreatQuick:L,onRowClick:K,onSelectionChange:p,"row-class-name":oe,"row-key":m=>m.id},{default:t(()=>[a(Z,{type:"selection",width:"55","reserve-selection":!0}),a(Z,{prop:"content",label:e.$t("views.problem.title"),"min-width":"280"},{default:t(({row:m})=>[a(fe,{onChange:ce=>O(ce,m.id),data:m.content,showEditIcon:y.value.problem_edit(N($))&&m.id===c.value,maxlength:256},null,8,["onChange","data","showEditIcon"])]),_:1},8,["label"]),a(Z,{prop:"paragraph_count",label:e.$t("views.problem.table.paragraph_count"),align:"right","min-width":"100"},{default:t(({row:m})=>[m.paragraph_count?(_(),w(_e,{key:0,type:"primary",onClick:ee(ce=>K(m),["stop"])},{default:t(()=>[V(f(m.paragraph_count),1)]),_:2},1032,["onClick"])):(_(),pe("span",Ke,f(m.paragraph_count),1))]),_:1},8,["label"]),a(Z,{prop:"create_time",label:e.$t("common.createTime"),width:"170"},{default:t(({row:m})=>[V(f(N(Ce)(m.create_time)),1)]),_:1},8,["label"]),a(Z,{prop:"update_time",label:e.$t("views.problem.table.updateTime"),width:"170"},{default:t(({row:m})=>[V(f(N(Ce)(m.update_time)),1)]),_:1},8,["label"]),a(Z,{label:e.$t("common.operation"),align:"left",fixed:"right"},{default:t(({row:m})=>[h("div",null,[h("span",Xe,[a(ue,{effect:"dark",content:e.$t("views.problem.relateParagraph.title"),placement:"top"},{default:t(()=>[y.value.problem_relate(N($))?(_(),w(A,{key:0,type:"primary",text:"",onClick:ee(ce=>I(m),["stop"])},{default:t(()=>[a(re,{iconName:"app-generate-question"})]),_:1},8,["onClick"])):G("",!0)]),_:2},1032,["content"])]),h("span",null,[a(ue,{effect:"dark",content:e.$t("common.delete"),placement:"top"},{default:t(()=>[y.value.problem_delete(N($))?(_(),w(A,{key:0,type:"primary",text:"",onClick:ee(ce=>te(m),["stop"])},{default:t(()=>[a(re,{iconName:"app-delete"})]),_:1},8,["onClick"])):G("",!0)]),_:2},1032,["content"])])])]),_:1},8,["label"])]),_:1},8,["data","pagination-config","quick-create","quickCreateName","quickCreatePlaceholder","row-key"])),[[he,C.value]])])])]),_:1}),a(qe,{ref_key:"CreateProblemDialogRef",ref:R,onRefresh:le},null,512),a(Qe,{next:Y,pre:r,ref_key:"DetailProblemRef",ref:k,currentId:d.value,"onUpdate:currentId":i[2]||(i[2]=m=>d.value=m),currentContent:S.value,"onUpdate:currentContent":i[3]||(i[3]=m=>S.value=m),pre_disable:ie.value,next_disable:l.value,onRefresh:B},null,8,["currentId","currentContent","pre_disable","next_disable"]),a(De,{ref_key:"RelateProblemDialogRef",ref:P,onRefresh:B},null,512)])}}});export{at as default};
|