db-formsearch-plus
Version:
基于 element-Plus 和 vue3 封装的 PC 后台管理系统搜索组件
2 lines (1 loc) • 7.54 kB
JavaScript
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n["db-formsearch-plus"]={},n.Vue))})(this,function(n,e){"use strict";/*! Element Plus v2.2.29 */var F={name:"zh-cn",el:{colorpicker:{confirm:"确定",clear:"清空"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!"},upload:{deleteTip:"按 delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"}}};const L="",V={class:"form"},D={class:"form_item_lable"},C={class:"form_item_val"},b={class:"form_item_lable"},g={class:"form_item_val"},N={class:"form_item_lable"},A={class:"form_item_val"},x={class:"form_item_lable"},z={class:"form_item_val"},Y={class:"form_item_lable"},T={class:"form_item_val"},w={key:0,class:"form_item"},r={__name:"index",props:{opts:{type:Array,default:()=>[]},span:{type:Number,default:6},searchBtn:{type:Boolean,default:!0}},emits:["formSearch"],setup(u,{expose:c,emit:m}){const i=u,M=e.ref(F);let l=e.reactive({});const s=e.reactive({});e.reactive({});const P=e.computed(()=>i.opts),E=()=>{const a={...l,...s};m("formSearch",a)},f=()=>{for(const a in l)l[a]="";m("formSearch",{})},h=(a,p)=>{const d=l[a];p&&(s[a]=d[0],s[p]=d[1])};return c({formData:l,search:E,reset:f}),(a,p)=>{const d=e.resolveComponent("el-input"),_=e.resolveComponent("el-option"),k=e.resolveComponent("el-select"),y=e.resolveComponent("el-date-picker"),j=e.resolveComponent("el-config-provider"),B=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",V,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(P),t=>(e.openBlock(),e.createElementBlock("div",{class:"form_item",key:t.key},[t.type==="input"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",D,e.toDisplayString(t.label),1),e.createElementVNode("div",C,[e.createVNode(d,{modelValue:e.unref(l)[t.key],"onUpdate:modelValue":o=>e.unref(l)[t.key]=o,placeholder:"请输入姓名",size:t.size||"default",clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder","size"])])],64)):e.createCommentVNode("",!0),t.type==="select"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",b,e.toDisplayString(t.label),1),e.createElementVNode("div",g,[e.createVNode(k,{modelValue:e.unref(l)[t.key],"onUpdate:modelValue":o=>e.unref(l)[t.key]=o,multiple:t.multiple,filterable:!!t.filterable,clearable:!!t.clearable,style:{width:"100%"},placeholder:t.placeholder?t.placeholder:"请输入"+t.label,size:t.size||"default"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.selects,o=>(e.openBlock(),e.createBlock(_,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","multiple","filterable","clearable","placeholder","size"])])],64)):e.createCommentVNode("",!0),t.type==="date"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",N,e.toDisplayString(t.label),1),e.createElementVNode("div",A,[e.createVNode(y,{modelValue:e.unref(l)[t.key],"onUpdate:modelValue":o=>e.unref(l)[t.key]=o,style:{width:"100%"},type:t.dateType,size:t.size||"default",format:t.format||"YYYY","value-format":t.format||"YYYY",placeholder:t.placeholder,onChange:o=>h(t.key)},null,8,["modelValue","onUpdate:modelValue","type","size","format","value-format","placeholder","onChange"])])],64)):e.createCommentVNode("",!0),t.type==="remoteSelect"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",x,e.toDisplayString(t.label),1),e.createElementVNode("div",z,[e.createVNode(k,{modelValue:e.unref(l)[t.key],"onUpdate:modelValue":o=>e.unref(l)[t.key]=o,multiple:"",filterable:!!t.filterable,style:{width:"100%"},placeholder:t.placeholder?t.placeholder:"请输入"+t.label,clearable:!!t.clearable,remote:!!t.remote,size:t.size||"default"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.selects,o=>(e.openBlock(),e.createBlock(_,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","filterable","placeholder","clearable","remote","size"])])],64)):e.createCommentVNode("",!0),t.type==="daterange"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createElementVNode("div",Y,e.toDisplayString(t.label),1),e.createElementVNode("div",T,[e.createVNode(j,{locale:e.unref(M)},{default:e.withCtx(()=>[e.createVNode(y,{style:{width:"94%"},modelValue:e.unref(l)[t.key],"onUpdate:modelValue":o=>e.unref(l)[t.key]=o,type:"monthrange",size:t.size||"default","value-format":t.format||"YYYY",format:t.format||"YYYY","range-separator":"~","start-placeholder":t.starPlaceholder?t.starPlaceholder:"开始日期","end-placeholder":t.endPlaceholder?t.endPlaceholder:"结束日期",onChange:o=>h(t.key,t.key2||"")},null,8,["modelValue","onUpdate:modelValue","size","value-format","format","start-placeholder","end-placeholder","onChange"])]),_:2},1032,["locale"])])],64)):e.createCommentVNode("",!0),t.type==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[t.name?e.renderSlot(a.$slots,t.name,{key:0}):e.renderSlot(a.$slots,"default",{key:1})],64)):e.createCommentVNode("",!0)]))),128)),i.searchBtn?(e.openBlock(),e.createElementBlock("div",w,[e.createVNode(B,{onClick:E,type:"primary"},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1}),e.createVNode(B,{onClick:f,type:"info"},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1})])):e.createCommentVNode("",!0)])}}};r.install=function(u){u.component(r.name,r)};const S=[r],U={install:u=>{S.forEach(c=>{u.components(c.name,c)})}};n.default=U,n.formSearch=r,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});