import{r as n,c as x,u as g,f as k,w as z}from"./framework.e8f655c8.js";import{s as C}from"./dom.1d8ecbf3.js";import{e as w}from"./dashboard_expert_config.6f434fa1.js";import{n as L,e as S}from"./index.8c202964.js";function T(u,t={},e){const l=n(1),i=n(10),a=x(()=>({[e.paramProps.page]:l.value,[e.paramProps.pageSize]:i.value,...g(t)}));e={...{immediate:!0,resultHandle(m){const{rows:f,total:y}=m.data;e.append?s.value=[...s.value,...f]:s.value=f,o.value=y},append:!1,paramProps:{page:"pageNum",pageSize:"pageSize"}},...e};const o=n(0),s=n([]),c=n(!1);function d(){c.value=!0,u(a.value).then(e.resultHandle).finally(()=>{c.value=!1,C(0)})}function v(m=10){l.value=1,i.value=m,d()}return e.immediate&&d(),{total:o,isLoading:c,search:d,refresh:v,pageNum:l,pageSize:i,tableData:s}}const P={name:"AdvancedSearch",props:{formModel:Array,relationSelList:{type:Array,default:()=>[{label:"\u4E0E",value:"must"},{label:"\u6216",value:"should"}]},searchRuleList:{type:Array,default:()=>[{label:"\u6A21\u7CCA",value:"fuzzy"},{label:"\u7CBE\u51C6",value:"term"}]},listNum:{type:String,default:"1"},advancedRetrievalParams:Array,searchValue:{type:String,default:""}},emits:["close"],setup(u,{emit:t}){let{advancedRetrievalParams:e,searchValue:l}=k(u),i=n(!1),a=n(w);const _=x(()=>{let[r,b]=u.listNum.split("-");if(r=Number(r),b){let{fieldList:p}=a.value.find(h=>h.id===r);if(p&&p.length)return g(p).find(h=>h.value===b)}else return a.value.find(p=>p.id===r)}),o=()=>({relation:"must",field:"",keyword:"",match:"fuzzy"});let s=n([o()]);const c=()=>{s.value=[o()]};z(e,r=>{r&&r.length&&!l.value&&(s.value=r)},{immediate:!0});const d=()=>{if(s.value.length>4){S("\u6761\u4EF6\u592A\u591A\u4E86");return}s.value.push({relation:"must",field:"",keyword:"",match:"fuzzy"})},v=r=>{s.value.splice(r,1)};function m(){i.value=!0,console.log("\u6267\u884C")}function f(){i.value=!1}function y(){for(let r of g(s))if(!r.relation||!r.field||!r.keyword)return S("\u8FD8\u6709\u4FE1\u606F\u6CA1\u6709\u586B\u5199"),!1;f(),t("advancedSearch",s)}return{expertFormList:s,renderType:_,getDefaultFormItem:o,addExpertItem:d,removeExpertItem:v,resetSearch:c,dialogVisible:i,showDialog:m,advancedSearch:y}}};var A=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{width:"530",visible:t.dialogVisible,"lock-scroll":!1},on:{"update:visible":function(l){t.dialogVisible=l}},scopedSlots:t._u([{key:"title",fn:function(){return[e("div",{staticClass:"exp_title"},[t._v("\u9AD8\u7EA7\u68C0\u7D22")])]},proxy:!0},{key:"footer",fn:function(){return[e("div",{staticClass:"dialog_footer text-center"},[e("el-button",{staticStyle:{width:"237px"},attrs:{type:"primary",icon:"el-icon-refresh"},on:{click:function(l){return l.stopPropagation(),t.resetSearch.apply(null,arguments)}}},[t._v("\u91CD\u7F6E")]),e("el-button",{staticStyle:{width:"555px"},attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(l){return l.stopPropagation(),t.advancedSearch.apply(null,arguments)}}},[t._v("\u68C0\u7D22")])],1)]},proxy:!0}])},[t._t("header-content"),e("div",{staticClass:"expertSearch_list"},[e("div",{staticClass:"advanced_search"},t._l(t.expertFormList,function(l,i){return e("div",{key:i,staticClass:"form-item flex-center-align"},[e("div",{staticClass:"relation-item margin-right-medium"},[i!==0?e("CustomSelect",{attrs:{size:"medium","popper-append-to-body":!1},model:{value:l.relation,callback:function(a){t.$set(l,"relation",a)},expression:"item.relation"}},t._l(t.relationSelList,function(a){return e("el-option",{key:a.value,attrs:{value:a.value,label:a.label}})}),1):t._e()],1),e("div",{staticClass:"type-item margin-right-medium"},[e("CustomSelect",{staticClass:"chart-type test",attrs:{size:"medium","popper-append-to-body":!1},model:{value:l.field,callback:function(a){t.$set(l,"field",a)},expression:"item.field"}},[e("el-option-group",{attrs:{label:t.renderType.name}},t._l(t.renderType.fieldList,function(a){return e("el-option",{key:a.value,attrs:{value:a.value,label:a.label}})}),1)],1)],1),e("div",{staticClass:"keyword-item margin-right-medium"},[e("el-input",{attrs:{maxlength:40,size:"medium"},model:{value:l.keyword,callback:function(a){t.$set(l,"keyword",typeof a=="string"?a.trim():a)},expression:"item.keyword"}})],1),e("div",{staticClass:"rule-item margin-right-medium"},[e("CustomSelect",{staticClass:"search-type",attrs:{size:"medium","popper-append-to-body":!1},model:{value:l.match,callback:function(a){t.$set(l,"match",a)},expression:"item.match"}},t._l(t.searchRuleList,function(a){return e("el-option",{key:a.value,attrs:{value:a.value,label:a.label}})}),1)],1),e("div",{staticClass:"searchBtnItem"},[i===0?e("el-button",{attrs:{type:"primary",size:"medium"},on:{click:t.addExpertItem}},[t._v("\u65B0\u589E")]):e("el-button",{attrs:{type:"primary",size:"medium"},on:{click:function(a){return t.removeExpertItem(i)}}},[t._v("\u5220\u9664")])],1)])}),0)])],2)},I=[],N=L(P,A,I,!1,null,"448d7a1b",null,null);const O=N.exports;export{O as A,T as u};
