import{e,r as a,a9 as t,aa as s,f as l,g as n,h as i,w as o,co as r,ah as d,x as p,cp as u,z as m,o as _,i as c,N as f,_ as h,m as g,cn as y}from"./index-DXvjTqMr.js";import{_ as v}from"./uni-search-bar.CxwyNur9.js";import{n as W,f as j}from"./folderList.BUcoSTA5.js";import{_ as w}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.Dxt3pfrw.js";/* empty css */import"./uni-dateformat.R_eYMhRe.js";import"./uni-list.DC8Q_4GY.js";import"./uni-badge.BiEW0hVl.js";import"./index.Bd3eRv6X.js";/* empty css *//* empty css */import"./uni-row.DufxBgTC.js";import"./index.DXrcG6jD.js";import"./index.DjbgqkKg.js";import"./uni-popup.BpvJsdxE.js";import"./uni-popup.vue_vue_type_style_index_0_scoped_90b62717_lang.BoqUbMLw.js";/* empty css */import"./uni-easyinput.D7PPGXPC.js";/* empty css */import"./uni-popup-dialog.CT6ZRSND.js";const x=w({__name:"search",setup(w){const x=e({type:"newes",name:"",rightIcon:[{type:1,icon:"icon-sousuo",types:"icon"}],newesWhere:{pid:"",name:"",page:1,limit:10},newesData:[],folderWhere:{pid:"",name:"",page:1,limit:10},folderData:[],isLoadingFolder:!1,listWhere:{pid:"",name:"",page:1,limit:10},folderId:"",defaultType:1,defaultTitle:"记事本"});a(null);const b=a(!1);t((e=>{e.tab&&(x.type=e.tab,e.id&&(x.defaultType=0),x.defaultTitle="",x.folderId=e.id)}));const D=(e=!1)=>{r(x.folderWhere).then((a=>{e&&(x.folderData=[]),a.data.list.length>0&&a.data.list.map((e=>{e.folder_type=1})),a.data.parent&&(x.defaultTitle=a.data.parent.name),x.folderData.push(...a.data.list);const t=Math.ceil(a.data.count/x.folderWhere.limit);x.folderData.length<=0||x.folderWhere.page>=t?(b.value=!1,x.isLoadingFolder=!0,I()):b.value=!0})).catch((e=>{d(),p.error(e.message)}))},I=()=>{u(x.listWhere).then((e=>{x.folderData.push(...e.data.list);const a=Math.ceil(e.data.count/x.listWhere.limit);x.folderData.length<=0||x.listWhere.page>=a?b.value=!1:b.value=!0})).catch((e=>{d(),p.error(e.message)}))},C=()=>{x.name="","newes"===x.type?x.newesData=[]:x.folderData=[]},F=()=>{h()},T=()=>{x.name?"newes"===x.type?(x.newesWhere.name=x.name,x.newesWhere.page=1,((e=!1)=>{y(x.newesWhere).then((a=>{e&&(x.newesData=[]),x.newesData.push(...a.data.list);const t=Math.ceil(a.data.count/x.newesWhere.limit);x.newesData.length<=0||x.newesWhere.page>=t?b.value=!1:b.value=!0})).catch((e=>{d(),p.error(e.message)}))})(!0)):(x.folderWhere.name=x.name,x.listWhere.name=x.name,x.folderWhere.pid=x.folderId,x.listWhere.pid=x.folderId,x.folderWhere.page=1,x.listWhere.page=1,D(!0)):C()};s((()=>{"newes"===x.type||(x.isLoadingFolder?b.value&&(x.listWhere.page++,I()):b.value&&(x.folderWhere.page++,D()))}));const L=e=>{if(1===e.type)x.folderId=e.id,g(`/pages/users/memorandum/index?tab=folder&id=${x.folderId}`);else if(2===e.type){x.folderId=e.id;const a={pid:e.id,name:e.name};saveMemorialCate(a)}};return(e,a)=>{const t=m,s=l(n("uni-search-bar"),v);return _(),i(t,{class:"content"},{default:o((()=>[c(t,{class:"cr-position-header"},{default:o((()=>[c(t,{class:"status_bar"}),c(t,{class:"default-search"},{default:o((()=>[c(s,{onConfirm:T,onFocus:T,focus:!0,bgColor:"#F0F1F5",modelValue:x.name,"onUpdate:modelValue":a[0]||(a[0]=e=>x.name=e),onClear:C,onCancel:F},null,8,["modelValue"])])),_:1})])),_:1}),c(t,{class:"report-content m10"},{default:o((()=>["newes"===x.type?(_(),i(W,{key:0,"list-data":x.newesData,"empty-title":"暂无搜索的最新内容~"},null,8,["list-data"])):f("",!0),"folder"===x.type?(_(),i(j,{key:1,"list-data":x.folderData,onBtnClick:L,"empty-title":"暂无搜索的内容~"},null,8,["list-data"])):f("",!0)])),_:1})])),_:1})}}},[["__scopeId","data-v-88764a42"]]);export{x as default};