UnisKB/static/chat/assets/index-eGk5XSHm.js

3 lines
18 KiB
JavaScript
Raw Normal View History

import{aW as de,aX as me,aY as W,aZ as s,ba as he,aU as F,bb as se,a$ as o,b0 as f,b1 as $,b2 as t,b3 as l,b5 as g,b6 as ee,b7 as S,b8 as _,b9 as z,bm as K,bq as ye,b$ as Se,br as ke,bk as G,bc as pe,bd as $e,be as we,cf as Ve,ce as Te,a_ as Pe,bl as U,c7 as Re,bp as Ie,cZ as Me,c3 as Ce}from"./chat-CYsuYSTF.js";import{_ as xe}from"./ParagraphDialog.vue_vue_type_script_setup_true_lang-DMdRj0_9.js";import"./ParagraphForm.vue_vue_type_script_setup_true_lang-C1ZjhYRC.js";const qe={class:"dialog-footer"},ze=de({__name:"CreateProblemDialog",emits:["refresh"],setup(Q,{expose:E,emit:w}){const T=me(),{params:{id:h}}=T,y=W(()=>T.path.includes("shared")?"systemShare":T.path.includes("resource-management")?"systemManage":"workspace"),B=w,P=s(),k=s(!1),R=s({data:""}),C=he({data:[{required:!0,message:F("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(L){return L!==""});z({type:"problem",systemType:y.value}).postProblems(h,x,k).then(L=>{K(F("common.createSuccess")),B("refresh"),c.value=!1})}})};return E({open:d}),(n,u)=>{const v=o("el-input"),x=o("el-form-item"),L=o("el-form"),D=o("el-button"),I=o("el-dialog");return f(),$(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(()=>[g("span",qe,[l(D,{onClick:u[1]||(u[1]=ee(j=>c.value=!1,["prevent"]))},{default:t(()=>[S(_(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(_(n.$t("common.confirm")),1)]),_:1},8,["loading"])])]),default:t(()=>[l(L,{"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"])}}}),Le={class:"bold title align-center p-24 pb-0"},Ue={class:"p-8",style:{"padding-bottom":"8px"}},Be={class:"flex lighter align-center"},Ne={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"},He=de({__name:"RelateProblemDialog",emits:["refresh"],setup(Q,{expose:E,emit:w}){const T=me(),{params:{id:h}}=T,y=W(()=>T.path.includes("shared")?"systemShare":T.path.includes("resource-management")?"systemManage":"workspace"),B=w,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"),L=s(""),D=s(!1),I=he({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}))};z({type:"problem",systemType:y.value}).putMulAssociationProblem(h,a,k).then(()=>{K(F("views.problem.tip.relatedSuccess")),P.value=!1})}function p(a){if(D.value)X(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};X(a.id)?z({type:"paragraph",systemType:y.value}).putDisassociationProblem(h,a.document_id,r,k).then(()=>{H(d.value)}):z({type:"paragraph",systemType:y.value}).putAssociationProblem(h,a.document_id,r,k).then(()=>{H(d.value)})}}function N(){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(){z({type:"document",systemType:y.value}).getDocumentList(h,k).then(a=>{var r;C.value=a.data,R.value=a.data,u.value=((r=C.value)==null?void 0:r.length)>0?C.value[0].id:"",u.value&&O(u.value)})}function O(a){z({type:"paragraph",systemType:y.value}).getParagraphPage(h,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 H(a){z({type:"problem",systemType:y.value}).getDetailProblems(h,a,k).then(r=>{n.value=r.data})}function J(a){return n.value.filter(r=>r.document_id===a).length}function X(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",B("refresh"))}),se(L,a=>{var r;c.value=[],R.value=a?C.value.filter(Z=>Z.name.includes(a)):C.value,u.value=((r=R.value)==null?void 0:r.length)>0?R.value[0].id:""}),E({open:a=>{te(),a.length==1?(d.value=a[0],H(a)):a.length>1&&(V.value=a,D.value=!0),P.value=!0}}),(a,r)=>{const Z=o("el-input"),oe=o("auto-tooltip"),ne=o("el-badge"),M=o("common-list"),q=o("el-scrollbar"),ae=o("el-col"),e=o("el-text"),i=o("el-option"),A=o("el-select"),ve=o("el-empty"),Y=o("CardBox"),_e=o("InfiniteScroll"),fe=o("el-row"),re=o("el-button"),ue=o("el-dialog"),be=ye("loading");return f(),$(ue,{title:a.$t("views.problem.relateParagraph.title"),modelValue:P.value,"onUpdate:modelValue":r[5]||(