| 12 |
- import{cR as de,gS as me,fL as be,gs as W,gZ as se,fV as o,ft as _,cr as w,g$ as t,cx as l,cq as h,h2 as ee,cw as S,gx as f,fM as s,eT as q,y as Y,ca as H,fW as ye,cu as Se,h0 as ke,cs as J,ct as pe,F as we,fS as $e,fe as Ve,ac as Te,gN as B,x as Pe,fy as Re,fr as Ie,fp as Me,cE as Ce}from"./chat-Bi4P_Zr8.js";import{_ as xe}from"./ParagraphDialog.vue_vue_type_script_setup_true_lang-D_IIrPaF.js";import"./ParagraphForm.vue_vue_type_script_setup_true_lang-gu0O2eml.js";const qe={class:"dialog-footer"},ze=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"),L=$,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},V=async n=>{n&&await n.validate((u,v)=>{if(u){const x=R.value.data.split(`
- `).filter(function(z){return z!==""});q({type:"problem",systemType:y.value}).postProblems(b,x,k).then(z=>{Y(W("common.createSuccess")),L("refresh"),c.value=!1})}})};return E({open:d}),(n,u)=>{const v=o("el-input"),x=o("el-form-item"),z=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]=j=>c.value=j),"close-on-click-modal":!1,"close-on-press-escape":!1,"destroy-on-close":!0},{footer:t(()=>[h("span",qe,[l(D,{onClick:u[1]||(u[1]=ee(j=>c.value=!1,["prevent"]))},{default:t(()=>[S(f(n.$t("common.cancel")),1)]),_:1}),l(D,{type:"primary",onClick:u[2]||(u[2]=j=>V(P.value)),loading:k.value},{default:t(()=>[S(f(n.$t("common.confirm")),1)]),_:1},8,["loading"])])]),default:t(()=>[l(z,{"label-position":"top",ref_key:"problemFormRef",ref:P,rules:C,model:R.value,"require-asterisk-position":"right"},{default:t(()=>[l(x,{label:n.$t("views.problem.title"),prop:"data"},{default:t(()=>[l(v,{modelValue:R.value.data,"onUpdate:modelValue":u[0]||(u[0]=j=>R.value.data=j),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"])}}}),Ne={class:"bold title align-center p-24 pb-0"},Be={class:"p-8",style:{"padding-bottom":"8px"}},Le={class:"flex lighter align-center"},Ue={class:"p-24",style:{"padding-bottom":"8px","padding-top":"16px"}},Ae={class:"flex-between mb-16"},Ee={class:"bold title align-center"},je={class:"dialog-footer"},Fe=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"),L=$,P=s(!1),k=s(!1),R=s([]),C=s([]),c=s([]),d=s(""),V=s([]),n=s([]),u=s(""),v=s(""),x=s("title"),z=s(""),D=s(!1),I=be({current_page:1,page_size:50,total:0});function j(){const a={problem_id_list:V.value,paragraph_list:n.value.map(r=>({paragraph_id:r.id,document_id:r.document_id}))};q({type:"problem",systemType:y.value}).putMulAssociationProblem(b,a,k).then(()=>{Y(W("views.problem.tip.relatedSuccess")),P.value=!1})}function p(a){if(D.value)Z(a.id)?n.value.splice(n.value.indexOf(a.id),1):n.value.push(a);else{const r={paragraph_id:a.id,problem_id:d.value};Z(a.id)?q({type:"paragraph",systemType:y.value}).putDisassociationProblem(b,a.document_id,r,k).then(()=>{F(d.value)}):q({type:"paragraph",systemType:y.value}).putAssociationProblem(b,a.document_id,r,k).then(()=>{F(d.value)})}}function U(){I.current_page=1,c.value=[],u.value&&O(u.value)}function le(a){I.current_page=1,c.value=[],u.value=a.id,O(a.id)}function te(){q({type:"document",systemType:y.value}).getDocumentList(b,k).then(a=>{C.value=a.data,R.value=a.data,u.value=C.value?.length>0?C.value[0].id:"",u.value&&O(u.value)})}function O(a){q({type:"paragraph",systemType:y.value}).getParagraphPage(b,a||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 F(a){q({type:"problem",systemType:y.value}).getDetailProblems(b,a,k).then(r=>{n.value=r.data})}function K(a){return n.value.filter(r=>r.document_id===a).length}function Z(a){return n.value.some(r=>r.id===a)}return se(P,a=>{a||(R.value=[],C.value=[],c.value=[],n.value=[],D.value=!1,u.value="",v.value="",x.value="title",L("refresh"))}),se(z,a=>{c.value=[],R.value=a?C.value.filter(r=>r.name.includes(a)):C.value,u.value=R.value?.length>0?R.value[0].id:""}),E({open:a=>{te(),a.length==1?(d.value=a[0],F(a)):a.length>1&&(V.value=a,D.value=!0),P.value=!0}}),(a,r)=>{const X=o("el-input"),oe=o("auto-tooltip"),ne=o("el-badge"),M=o("common-list"),N=o("el-scrollbar"),ae=o("el-col"),e=o("el-text"),i=o("el-option"),A=o("el-select"),ve=o("el-empty"),G=o("CardBox"),fe=o("InfiniteScroll"),_e=o("el-row"),re=o("el-button"),ue=o("el-dialog"),ge=ye("loading");return _(),w(ue,{title:a.$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},Se({default:t(()=>[ke((_(),w(_e,null,{default:t(()=>[l(ae,{span:6},{default:t(()=>[l(N,{height:"500","wrap-class":"paragraph-scrollbar"},{default:t(()=>[h("div",Ne,f(a.$t("views.problem.relateParagraph.selectDocument")),1),h("div",Be,[l(X,{modelValue:z.value,"onUpdate:modelValue":r[0]||(r[0]=g=>z.value=g),placeholder:a.$t("views.problem.relateParagraph.placeholder"),"prefix-icon":"Search",clearable:""},null,8,["modelValue","placeholder"]),l(M,{data:R.value,class:"mt-8",onClick:le,"default-active":u.value},{default:t(({row:g})=>[h("span",Le,[l(oe,{content:g.name},{default:t(()=>[S(f(g.name),1)]),_:2},1032,["content"]),K(g.id)?(_(),w(ne,{key:0,value:K(g.id),type:"primary",class:"paragraph-badge ml-4"},null,8,["value"])):J("",!0)])]),_:1},8,["data","default-active"])])]),_:1})]),_:1}),l(ae,{span:18,class:"border-l"},{default:t(()=>[l(N,{height:"500","wrap-class":"paragraph-scrollbar"},{default:t(()=>[h("div",Ue,[h("div",Ae,[h("div",Ee,[S(f(a.$t("components.selectParagraph.title"))+" ",1),l(e,null,{default:t(()=>[S(" ("+f(a.$t("views.problem.relateParagraph.selectedParagraph"))+":"+f(K(u.value))+" "+f(a.$t("views.problem.relateParagraph.count"))+") ",1)]),_:1})]),l(X,{modelValue:v.value,"onUpdate:modelValue":r[2]||(r[2]=g=>v.value=g),placeholder:a.$t("common.search"),class:"input-with-select",style:{width:"260px"},onChange:U},{prepend:t(()=>[l(A,{modelValue:x.value,"onUpdate:modelValue":r[1]||(r[1]=g=>x.value=g),placeholder:"Select",style:{width:"80px"}},{default:t(()=>[l(i,{label:a.$t("common.title"),value:"title"},null,8,["label"]),l(i,{label:a.$t("common.content"),value:"content"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["modelValue","placeholder"])]),c.value.length==0?(_(),w(ve,{key:0,description:a.$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(G,{key:he,shadow:"hover",title:g.title||"-",description:g.content,class:Ve(["paragraph-card cursor mb-16",Z(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",je,[l(re,{onClick:r[4]||(r[4]=g=>P.value=!1)},{default:t(()=>[S(f(a.$t("common.cancel")),1)]),_:1}),l(re,{type:"primary",onClick:j},{default:t(()=>[S(f(a.$t("common.confirm")),1)]),_:1})])]),key:"0"}:void 0]),1032,["title","modelValue"])}}}),De=Te(Fe,[["__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:L}}=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),V=s([]);function n(p){const U={paragraph_id:p.id,problem_id:T.currentId};q({type:"paragraph",systemType:P.value}).putDisassociationProblem(p.knowledge_id,p.document_id,U,c).then(()=>{D()})}function u(){R.value.open([T.currentId])}function v(p){C.value.open(p,"edit")}function x(p){if(p){const U={content:p};q({type:"problem",systemType:P.value}).putProblems(L,T.currentId,U,c).then(()=>{b("update:currentContent",p),Y(W("common.modifySuccess"))})}else Pe(W("views.problem.tip.errorMessage"))}function z(){V.value=[]}function D(){T.currentId&&d.value&&q({type:"problem",systemType:P.value}).getDetailProblems(L,T.currentId,c).then(p=>{V.value=p.data})}function I(){D()}return se(()=>T.currentId,()=>{V.value=[],D()}),se(d,p=>{p||(b("update:currentId",""),b("update:currentContent",""),b("refresh"))}),E({open:()=>{D(),d.value=!0}}),(p,U)=>{const le=o("ReadWrite"),te=o("el-form-item"),O=o("AppIcon"),F=o("el-button"),K=o("el-tooltip"),Z=o("el-scrollbar"),ie=o("Document"),a=o("el-icon"),r=o("el-text"),X=o("CardBox"),oe=o("el-form"),ne=o("el-drawer"),M=ye("loading");return _(),w(ne,{modelValue:d.value,"onUpdate:modelValue":U[1]||(U[1]=N=>d.value=N),size:"60%",onClose:z},{header:t(()=>[h("h4",null,f(p.$t("views.problem.detailProblem")),1)]),footer:t(()=>[h("div",null,[k.value.doc_edit(B(L))?(_(),w(F,{key:0,onClick:u},{default:t(()=>[S(f(p.$t("views.problem.relateParagraph.title")),1)]),_:1})):J("",!0),l(F,{onClick:Q.pre,disabled:Q.pre_disable||c.value},{default:t(()=>[S(f(p.$t("common.pages.prev")),1)]),_:1},8,["onClick","disabled"]),l(F,{onClick:Q.next,disabled:Q.next_disable||c.value},{default:t(()=>[S(f(p.$t("common.pages.next")),1)]),_:1},8,["onClick","disabled"])])]),default:t(()=>[h("div",null,[l(Z,null,{default:t(()=>[h("div",He,[ke((_(),w(oe,{"label-position":"top",onSubmit:U[0]||(U[0]=ee(()=>{},["prevent"]))},{default:t(()=>[l(te,{label:p.$t("views.problem.title")},{default:t(()=>[l(le,{onChange:x,data:Q.currentContent,showEditIcon:k.value.problem_edit(B(L)),maxlength:256},null,8,["data","showEditIcon"])]),_:1},8,["label"]),l(te,{label:p.$t("views.problem.relateParagraph.title")},{default:t(()=>[(_(!0),pe(we,null,$e(V.value,(N,ae)=>(_(),w(X,{key:ae,title:N.title||"-",class:"cursor mb-8 w-full",showIcon:!1,onClick:ee(e=>k.value.doc_edit(B(L))&&v(N),["stop"]),style:{height:"210px"}},{tag:t(()=>[l(K,{effect:"dark",content:p.$t("views.problem.setting.cancelRelated"),placement:"top"},{default:t(()=>[k.value.problem_relate(B(L))?(_(),w(F,{key:0,type:"primary",text:"",onClick:ee(e=>n(N),["stop"])},{default:t(()=>[l(O,{iconName:"app-quxiaoguanlian"})]),_:1},8,["onClick"])):J("",!0)]),_:2},1032,["content"])]),footer:t(()=>[h("div",We,[l(r,null,{default:t(()=>[l(a,null,{default:t(()=>[l(ie)]),_:1}),S(" "+f(N?.document_name),1)]),_:2},1024)])]),default:t(()=>[l(Z,{height:"110"},{default:t(()=>[S(f(N.content),1)]),_:2},1024)]),_:2},1032,["title","onClick"]))),128))]),_:1},8,["label"])]),_:1})),[[M,c.value]])])]),_:1}),l(xe,{ref_key:"ParagraphDialogRef",ref:C,title:p.$t("views.paragraph.editParagraph"),apiType:P.value,onRefresh:I},null,8,["title","apiType"]),l(De,{ref_key:"RelateProblemDialogRef",ref:R,onRefresh:I},null,512)])]),_:1},8,["modelValue"])}}}),Oe={class:"document p-16-24"},Ze={class:"mb-16"},Ge={class:"main-calc-height"},Je={class:"p-24"},Ke={class:"flex-between"},Xe={key:1},Ye={class:"mr-4"},lt=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]),L=H(()=>T==="share"),P=s(),k=s(),R=s(),C=s(!1),c=s(""),d=s(""),V=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}),{})),z=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 j(){R.value.open()}const p=e=>{D.value=e};function U(e){C.value=!0;const i=[e];q({type:"problem",systemType:b.value}).postProblems($,i).then(()=>{M(),Y(W("common.createSuccess"))}).catch(()=>{C.value=!1})}function le(){const e=[];D.value.map(i=>{i&&e.push(i.id)}),q({type:"problem",systemType:b.value}).putMulProblem($,e,C).then(()=>{Y(W("views.document.delete.successMessage")),z.value?.clearSelection(),M()})}function te(e){q({type:"problem",systemType:b.value}).delProblems($,e.id,C).then(()=>{Y(W("common.deleteSuccess")),M()})}function O(e,i){if(e){const A={content:e};q({type:"problem",systemType:b.value}).putProblems($,i,A,C).then(()=>{M(),Y(W("common.modifySuccess"))})}else Pe(W("views.problem.tip.errorMessage"))}function F(e,i){i&&i.property==="content"&&(c.value=e.id)}function K(){c.value=""}const Z=()=>{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,V.value=v.value[e].content})}else d.value=v.value[e].id,V.value=v.value[e].content},ie=H(()=>x.value[d.value]-1<0&&n.current_page<=1),a=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,V.value=v.value[e].content})}else d.value=v.value[e].id,V.value=v.value[e].content};function X(e,i){i&&i.type==="selection"||E.path.includes("share/")||e.paragraph_count&&(d.value=e.id,V.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 q({type:"problem",isShared:L.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 N(){M(),z.value?.clearSelection()}function ae(){n.current_page=1,M()}return Ie(()=>{M()}),Me(()=>{}),(e,i)=>{const A=o("el-button"),ve=o("el-input"),G=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",Ze,f(e.$t("views.problem.title")),1),l(g,{style:{"--el-card-padding":"0"}},{default:t(()=>[h("div",Ge,[h("div",Je,[h("div",Ke,[h("div",null,[y.value.problem_create(B($))?(_(),w(A,{key:0,type:"primary",onClick:j},{default:t(()=>[S(f(e.$t("views.problem.createProblem")),1)]),_:1})):J("",!0),y.value.problem_relate(B($))?(_(),w(A,{key:1,onClick:i[0]||(i[0]=m=>I()),disabled:D.value.length===0},{default:t(()=>[S(f(e.$t("views.problem.relateParagraph.title")),1)]),_:1},8,["disabled"])):J("",!0),y.value.problem_delete(B($))?(_(),w(A,{key:2,onClick:le,disabled:D.value.length===0},{default:t(()=>[S(f(e.$t("views.problem.setting.batchDelete")),1)]),_:1},8,["disabled"])):J("",!0)]),l(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:z,class:"mt-16",data:v.value,"pagination-config":n,"quick-create":y.value.problem_create(B($)),quickCreateName:e.$t("views.problem.quickCreateName"),quickCreatePlaceholder:e.$t("views.problem.quickCreateProblem"),quickCreateMaxlength:256,onSizeChange:ne,onChangePage:M,onCellMouseEnter:F,onCellMouseLeave:K,onCreatQuick:U,onRowClick:X,onSelectionChange:p,"row-class-name":oe,"row-key":m=>m.id},{default:t(()=>[l(G,{type:"selection",width:"55","reserve-selection":!0}),l(G,{prop:"content",label:e.$t("views.problem.title"),"min-width":"280"},{default:t(({row:m})=>[l(fe,{onChange:ce=>O(ce,m.id),data:m.content,showEditIcon:y.value.problem_edit(B($))&&m.id===c.value,maxlength:256},null,8,["onChange","data","showEditIcon"])]),_:1},8,["label"]),l(G,{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=>X(m),["stop"])},{default:t(()=>[S(f(m.paragraph_count),1)]),_:2},1032,["onClick"])):(_(),pe("span",Xe,f(m.paragraph_count),1))]),_:1},8,["label"]),l(G,{prop:"create_time",label:e.$t("common.createTime"),width:"170"},{default:t(({row:m})=>[S(f(B(Ce)(m.create_time)),1)]),_:1},8,["label"]),l(G,{prop:"update_time",label:e.$t("views.problem.table.updateTime"),width:"170"},{default:t(({row:m})=>[S(f(B(Ce)(m.update_time)),1)]),_:1},8,["label"]),l(G,{label:e.$t("common.operation"),align:"left",fixed:"right"},{default:t(({row:m})=>[h("div",null,[h("span",Ye,[l(ue,{effect:"dark",content:e.$t("views.problem.relateParagraph.title"),placement:"top"},{default:t(()=>[y.value.problem_relate(B($))?(_(),w(A,{key:0,type:"primary",text:"",onClick:ee(ce=>I(m),["stop"])},{default:t(()=>[l(re,{iconName:"app-generate-question"})]),_:1},8,["onClick"])):J("",!0)]),_:2},1032,["content"])]),h("span",null,[l(ue,{effect:"dark",content:e.$t("common.delete"),placement:"top"},{default:t(()=>[y.value.problem_delete(B($))?(_(),w(A,{key:0,type:"primary",text:"",onClick:ee(ce=>te(m),["stop"])},{default:t(()=>[l(re,{iconName:"app-delete"})]),_:1},8,["onClick"])):J("",!0)]),_:2},1032,["content"])])])]),_:1},8,["label"])]),_:1},8,["data","pagination-config","quick-create","quickCreateName","quickCreatePlaceholder","row-key"])),[[he,C.value]])])])]),_:1}),l(ze,{ref_key:"CreateProblemDialogRef",ref:R,onRefresh:ae},null,512),l(Qe,{next:Z,pre:r,ref_key:"DetailProblemRef",ref:k,currentId:d.value,"onUpdate:currentId":i[2]||(i[2]=m=>d.value=m),currentContent:V.value,"onUpdate:currentContent":i[3]||(i[3]=m=>V.value=m),pre_disable:ie.value,next_disable:a.value,onRefresh:N},null,8,["currentId","currentContent","pre_disable","next_disable"]),l(De,{ref_key:"RelateProblemDialogRef",ref:P,onRefresh:N},null,512)])}}});export{lt as default};
|