You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
16 KiB

5 months ago
import{cr as se,dk as ie,cZ as ce,cs as u,c_ as fe,cq as M,da as J,cv as s,cy as P,cG as S,cB as l,cC as g,cA as t,cF as G,cL as C,cK as v,de as j,cS as ge,e6 as De,cw as be,cM as Re,cz as he,cD as $e,cE as ye,cU as Ve,eh as Q,e4 as Me,cX as Pe,ct as ve,cu as Se,dp as Ie,cI as Ce,dl as ke,cY as xe}from"./index-6b91f299.js";import{_ as ze}from"./ParagraphDialog.vue_vue_type_script_setup_true_lang-5d3ea928.js";import"./ParagraphForm.vue_vue_type_script_setup_true_lang-afdf1031.js";const Be={class:"dialog-footer"},qe=se({__name:"CreateProblemDialog",emits:["refresh"],setup(ee,{expose:H,emit:I}){const w=ie(),{params:{id:x}}=w,{problem:U}=ce(),D=I,R=u(),k=u(!1),d=u({data:""}),m=fe({data:[{required:!0,message:M("views.problem.tip.requiredMessage"),trigger:"blur"}]}),i=u(!1);J(i,h=>{h||(d.value={data:""})});const b=()=>{i.value=!0},_=async h=>{h&&await h.validate((p,f)=>{if(p){const V=d.value.data.split(`
`).filter(function($){return $!==""});U.asyncPostProblem(x,V,k).then($=>{j(M("common.createSuccess")),D("refresh"),i.value=!1})}})};return H({open:b}),(h,p)=>{const f=s("el-input"),V=s("el-form-item"),$=s("el-form"),z=s("el-button"),q=s("el-dialog");return P(),S(q,{title:h.$t("views.problem.createProblem"),modelValue:i.value,"onUpdate:modelValue":p[3]||(p[3]=r=>i.value=r),"close-on-click-modal":!1,"close-on-press-escape":!1,"destroy-on-close":!0},{footer:l(()=>[g("span",Be,[t(z,{onClick:p[1]||(p[1]=G(r=>i.value=!1,["prevent"]))},{default:l(()=>[C(v(h.$t("common.cancel")),1)]),_:1}),t(z,{type:"primary",onClick:p[2]||(p[2]=r=>_(R.value)),loading:k.value},{default:l(()=>[C(v(h.$t("common.confirm")),1)]),_:1},8,["loading"])])]),default:l(()=>[t($,{"label-position":"top",ref_key:"problemFormRef",ref:R,rules:m,model:d.value,"require-asterisk-position":"right"},{default:l(()=>[t(V,{label:h.$t("views.problem.title"),prop:"data"},{default:l(()=>[t(f,{modelValue:d.value.data,"onUpdate:modelValue":p[0]||(p[0]=r=>d.value.data=r),placeholder:h.$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"}},Ae={class:"flex lighter align-center"},Ne={class:"p-24",style:{"padding-bottom":"8px","padding-top":"16px"}},Te={class:"flex-between mb-16"},Ee={class:"bold title align-center"},Fe={class:"dialog-footer"},we=se({__name:"RelateProblemDialog",emits:["refresh"],setup(ee,{expose:H,emit:I}){const{problem:w,document:x}=ce(),U=ie(),{params:{id:D}}=U,R=I,k=u(!1),d=u(!1),m=u([]),i=u([]),b=u([]),_=u(""),h=u([]),p=u([]),f=u(""),V=u(""),$=u("title"),z=u(""),q=u(!1),r=fe({current_page:1,page_size:50,total:0});function B(){const a={problem_id_list:h.value,paragraph_list:p.value.map(o=>({paragraph_id:o.id,document_id:o.document_id}))};Q.postMulAssociationProblem(D,a,d).then(()=>{j(M("views.problem.tip.relatedSuccess")),k.value=!1})}function X(a){q.value?E(a.id)?p.value.splice(p.value.indexOf(a.id),1):p.value.push(a):E(a.id)?w.asyncDisassociationProblem(D,a.document_id,a.id,_.value,d).then(()=>{T(_.value)}):w.asyncAssociationProblem(D,a.document_id,a.id,_.value,d).then(()=>{T(_.value)})}function K(){r.current_page=1,b.value=[],f.value&&N(f.value)}function Y(a){r.current_page=1,b.value=[],f.value=a.id,N(a.id)}function A(){x.asyncGetAllDocument(D,d).then(a=>{var o;i.value=a.data,m.value=a.data,f.value=((o=i.value)==null?void 0:o.length)>0?i.value[0].id:"",f.value&&N(f.value)})}function N(a){Me.getParagraph(D,a||f.value,r,V.value&&{[$.value]:V.value},d).then(o=>{b.value=[...b.value,...o.data.records],r.total=o.data.total})}function T(a){Q.getDetailProblems(D,a,d).then(o=>{p.value=o.data})}function W(a){return p.value.filter(o=>o.document_id===a).length}function E(a){return p.value.some(o=>o.id===a)}return J(k,a=>{a||(m.value=[],i.value=[],b.value=[],p.value=[],q.value=!1,f.value="",V.value="",$.value="title",R("refresh"))}),J(z,a=>{var o;b.value=[],m.value=a?i.value.filter(L=>L.name.includes(a)):i.value,f.value=((o=m.value)==null?void 0:o.length)>0?m.value[0].id:""}),H({open:a=>{A(),a.length==1?(_.value=a[0],T(a)):a.length>1&&(h.value=a,q.value=!0),k.value=!0}}),(a,o)=>{const L=s("el-input"),Z=s("auto-tooltip"),e=s("el-badge"),c=s("common-list"),y=s("el-scrollbar"),le=s("el-col"),F=s("el-text"),ae=s("el-option"),ue=s("el-select"),de=s("el-empty"),oe=s("CardBox"),ne=s("InfiniteScroll"),pe=s("el-row"),re=s("el-button"),me=s("el-dialog"),_e=ge("loading");return P(),S(me,{title:a.$t("views.problem.relateParagraph.title"),modelValue:k.value,"onUpdate:modelValue":o[5]||(o[5]=n=>k.value=n),width:"80%",class:"paragraph-dialog","destroy-on-close":"","close-on-click-modal":!1,"close-on-press-escape":!1},De({default:l(()=>[be((P(),S(pe,null,{default:l(()=>[t(le,{span:6},{default:l(()=>[t(y,{height:"500","wrap-class":"paragraph-scrollbar"},{default:l(()=>[g("div",Le,v(a.$t("views.problem.relateParagraph.selectDocument")),1),g("div",Ue,[t(L,{modelValue