2 lines
4.5 KiB
Java
2 lines
4.5 KiB
Java
var f=(k,n,r)=>new Promise((e,p)=>{var l=s=>{try{d(r.next(s))}catch(m){p(m)}},a=s=>{try{d(r.throw(s))}catch(m){p(m)}},d=s=>s.done?e(s.value):Promise.resolve(s.value).then(l,a);d((r=r.apply(k,n)).next())});import{M as b}from"./BasicModal-xH56XuRZ.js";import"./index-BDvqZ5j4.js";import{l as B}from"./AiragPrompts.api-CMJu92vx.js";import{bL as O,b$ as A,cG as D,au as E,bY as F,aH as N}from"./index-X7Y8jykP.js";import{a as U}from"./useModal-DaJ3Bflg.js";import{b as G,r as v,y as S,z as h,A as g,K as x,Q as i,f as C,C as I,F as R,D as V,J as j,G as w}from"./vue-vendor-DNhG1Cve.js";import{C as q}from"./index-BwqG9R3y.js";import{O as H}from"./index-CuWaQdlK.js";import{A as J}from"./index-DO7ZhK45.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useTimeout-D5AmIBZw.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./index-BzChaRPg.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./useAppInject-DPZGPcR3.js";const K={name:"AiAppPromptMarketModal",components:{BasicModal:b,Pagination:A,Empty:O},emits:["ok","register","select"],setup(k,{emit:n}){const r=v([]),e=v(!1),p=v(""),l=v(null),a=G({current:1,pageSize:12,total:0}),[d,{closeModal:s,setModalProps:m}]=U(()=>f(null,null,function*(){e.value=!1,z(),yield _(),m({title:"选择提示词",height:600,bodyStyle:{padding:"24px"}})}));function z(){r.value=[],l.value=null,p.value="",a.current=1}function _(){return f(this,null,function*(){e.value=!0;try{const c={pageNo:a.current,pageSize:a.pageSize,name:p.value?`*${p.value}*`:""},o=yield B(c);o!=null&&o.records?(r.value=(o==null?void 0:o.records)||[],a.total=(o==null?void 0:o.total)||0):(r.value=[],a.total=0)}catch(c){r.value=[],a.total=0}finally{e.value=!1}})}function y(){a.current=1,_()}function P(c,o){a.current=c,a.pageSize=o,_()}function t(c,o){a.current=c,a.pageSize=o,_()}function u(c){l.value=c}function M(c){return D(c)}function L(){return f(this,null,function*(){l.value?(n("select",l.value),n("ok",l.value.content)):n("ok"),T()})}function T(){s()}return{registerModal:d,handleOk:L,handleCancel:T,promptList:r,loading:e,searchText:p,selectedPrompt:l,pagination:a,handleSearch:y,handlePageChange:P,handleSizeChange:t,handleSelectPrompt:u,formatTime:M}}},Q={class:"prompt-market-content"},X={class:"search-section"},Y={class:"prompt-list-section"},W=["onClick"],Z={class:"card-title"},$={class:"title-text"},ee={class:"card-content"},te=["title"],ae={class:"card-footer"},oe={class:"create-time"},ne={class:"pagination-section"};function re(k,n,r,e,p,l){const a=F,d=q,s=J,m=H,z=x("empty"),_=N,y=x("Pagination"),P=x("BasicModal");return h(),S(P,{destroyOnClose:"",onRegister:e.registerModal,canFullscreen:!1,width:"1000px",onOk:e.handleOk,onCancel:e.handleCancel,okText:"使用",wrapClassName:"ai-rag-generate-prompt-modal",confirmLoading:e.loading},{default:g(()=>[i("div",Q,[i("div",X,[C(a,{value:e.searchText,"onUpdate:value":n[0]||(n[0]=t=>e.searchText=t),placeholder:"搜索提示词名称或描述",style:{width:"300px"},onSearch:e.handleSearch,onPressEnter:e.handleSearch},null,8,["value","onSearch","onPressEnter"])]),i("div",Y,[C(_,{spinning:e.loading},{default:g(()=>[e.promptList.length>0?(h(),S(m,{key:0,gutter:[24,24]},{default:g(()=>[(h(!0),I(R,null,V(e.promptList,t=>(h(),S(s,{key:t.id,xs:24,sm:12,md:8,lg:8},{default:g(()=>{var u;return[i("div",{class:"prompt-card",onClick:M=>e.handleSelectPrompt(t)},[C(d,{class:j(["prompt-item-card",{selected:((u=e.selectedPrompt)==null?void 0:u.id)===t.id}]),hoverable:!0,size:"small"},{title:g(()=>[i("div",Z,[i("span",$,w(t.name),1)])]),default:g(()=>[i("div",ee,[i("p",{class:"description",title:t.description||t.desc},w(t.description||t.desc),9,te),i("div",ae,[i("span",oe,w(e.formatTime(t.createTime)),1)])])]),_:2},1032,["class"])],8,W)]}),_:2},1024))),128))]),_:1})):(h(),S(z,{key:1,description:"暂无提示词数据",class:"empty-state"}))]),_:1},8,["spinning"])]),i("div",ne,[C(y,{current:e.pagination.current,"onUpdate:current":n[1]||(n[1]=t=>e.pagination.current=t),pageSize:e.pagination.pageSize,"onUpdate:pageSize":n[2]||(n[2]=t=>e.pagination.pageSize=t),total:e.pagination.total,"show-size-changer":!0,"page-size-options":["10","20","30","50"],"show-quick-jumper":!0,onChange:e.handlePageChange,onShowSizeChange:e.handleSizeChange},null,8,["current","pageSize","total","onChange","onShowSizeChange"])])])]),_:1},8,["onRegister","onOk","onCancel","confirmLoading"])}const Le=E(K,[["render",re],["__scopeId","data-v-b2c00ce5"]]);export{Le as default};
|