cc1-form 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g.cc1Form={},g.Vue,g.ElementPlus))})(this,(function(g,e,p){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(d,c)=>Array.isArray(d)?d.some(s=>typeof s=="function"?s(c):s):typeof d=="function"?d(c):d;static getRouterParams=()=>{const d=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(d).length?d:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async d=>{if(!b.moduleObj[d])throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);const c=await b.moduleObj[d]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(d,c,s={}){const f=Date.now();if(!this.tipMessages[d]||f-this.tipMessages[d]>this.tipMessagesGap){this.tipMessages[d]=f;const h=Object.assign({message:d,type:c},s);p.ElMessage(h),setTimeout(()=>{delete this.tipMessages[d]},this.tipMessagesGap)}}static fail=(d,c={})=>{this.showMessage(d,"error",c)};static success=(d,c={})=>{this.showMessage(d,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(d=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{d?this.loadingObj=p.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(d,c=!0)=>{if(c){let s=screen.width/2-500,f=screen.height/2-800/2-30;window.open(d,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+s)}else window.open(d,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=d=>new Promise(async(c,s)=>{let f=document.getElementById(d.id);const h=await b.loadModule("html2canvas");try{h(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:d.windowWidth,height:d.windowHeight,windowWidth:d.windowWidth,windowHeight:d.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(i){let t=i.toDataURL("image/png");c(t)})}catch(i){s(i)}})}class w{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static customComponent={};static findOptions=(d,c)=>{const s=d.column.find(h=>h.key===c),f=h=>h.replace(/-([a-z])/g,(i,t)=>t.toUpperCase());if(s)return s.options[f(s.type)]};static setOptionsData=(d,c,s)=>{const f=w.findOptions(d,c);f&&(f.data=s)};static form={openBefore:{parentId:(d,c,s,f)=>{d?c.type===b.EDialog.Insert?(c.form.parentId=d._id,c.form.sort=d.children.length+1):c.form.parentId=d.parentId.substring(d.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=s.length+1),w.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:s}])}}}}class V{static getIdFun=()=>StrUtil.uuid();static setId=(d,c,s)=>{c[d]||(c[d]=[]),c[d].forEach(f=>{s.forEach(h=>{let i=h.default??"";h.type==="number"&&(i=h.default??0),h.type==="boolean"&&(i=h.default??!1),h.type==="time"&&(i=h.default??new Date),f[h.value]===void 0&&(f[h.value]=i)}),f._id||(f._id=V.getIdFun())})};static add=(d,c,s,f)=>{const h=JSONUtil.cp(s);V.setId(d,c,s),c[d].push(h.reduce((i,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),i[t.value]=n,i},{_id:V.getIdFun()})),f?.(c)};static remove=(d,c,s,f)=>{c[d]=c[d].filter(h=>h._id!==s._id),f?.(c)};static getNoIdData=(d,c)=>{const s=JSONUtil.cp(d);return s.forEach(f=>{f._id&&delete f._id,c&&f[c]&&V.getNoIdData(f[c],c)}),s}}const T={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},x=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(m,{emit:d}){const c=m,s=e.reactive({show:!1,add:(h,i,t)=>{V.add(h,i,t,()=>{f("change")})},remove:(h,i,t)=>{V.remove(h,i,t,()=>{f("change")})}});e.onMounted(()=>{V.setId(c.field,c.row,c.itemFields),s.show=!0});const f=d;return(h,i)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return s.show?(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(h.$slots,"list-start",{row:m.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:i[0]||(i[0]=l=>s.add(m.field,m.row,m.itemFields))},{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.row[m.field],l=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"item-start",{item:l,row:m.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.itemFields,a=>(e.openBlock(),e.createBlock(n,{modelValue:l[a.value],"onUpdate:modelValue":o=>l[a.value]=o,style:e.normalizeStyle({width:m.inputWidth}),class:e.normalizeClass(m.inputClass),placeholder:a[m.label]||a[m.value],onChange:i[1]||(i[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:l,row:m.row}),e.createVNode(t,{link:"",type:"danger",onClick:a=>s.remove(m.field,m.row,l)},{default:e.withCtx(()=>[...i[3]||(i[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:m.row})])):e.createCommentVNode("",!0)}}}),O={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(m,{expose:d}){const c=b.isFun,s=b.EDialog,f=e.ref(),h=m,i=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||s.Insert)===s.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;i.formColumn=[];const n=[],l=h.option.form?.maxSpan||12,a=h.option.form?.defaultSpan||l;let o=[];const r=u=>{if(i.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:a},u.form.span=u.form.span??a;let C=u.form.span,k=o.reduce((B,E)=>B+E.span,C);const y=o.length;o.push({item:u,span:C}),(y===1&&o[0].span===0||k>=l||C===0&&y>1)&&(n.push(o),o=[]),u.rules&&(i.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,r(u)}),o.length>0&&n.push(o),i.formColumn=n,i.form=JSONUtil.cp(i.formDefault)},init:async()=>{i.show=!1,await e.nextTick(),i.initColumnForm()}});return i.initColumnForm(),d({ref:f,conf:i}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:f,model:i.form,rules:i.rules},{default:e.withCtx(()=>[i.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(i.formColumn,l=>(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(t.$slots,"form-start",{row:i.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(a.item.show?.form,i.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+a.item.key+"-start",{row:i.form,item:a.item}),e.renderSlot(t.$slots,"form-"+a.item.key,{row:i.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.switch,e.toHandlers(a.item.options?.switch?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:i.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:i.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:i.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:i.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+a.item.key+"-end",{row:i.form,item:a.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:i.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(d,c,s)=>{const f=await b.loadModule("xlsx"),h=d.map(n=>{const l={};return c.forEach(a=>{l[a.label]=n[a.key]}),l}),i=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,i,"Sheet1"),s?typeof s=="function"&&(s=s()):s=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${s}.xlsx`)}}const L={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(m,{expose:d}){const c=e.ref(!1),s=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,i=null;const t=a=>(a?.title&&(s.value=a.title),a?.content&&(f.value=a.content),c.value=!0,new Promise((o,r)=>{h=o,i=r})),n=()=>{c.value=!1,h?.(!0),h=null,i=null},l=()=>{c.value=!1,i?.(new Error("用户取消操作")),h=null,i=null};return d({open:t}),(a,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=r=>c.value=r),title:s.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(p.ElButton),{onClick:l},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),z={class:"col relative cc1-form-box"},j={class:"absolute row fit",style:{overflow:"hidden"}},M={class:"col column"},R={key:0,class:"relative curd-search"},H={class:"mb-10 flex justify-between items-center"},A={class:"flex items-center",style:{gap:"10px"}},J={key:0},_={key:1},W={key:2},K={class:"export-btn"},q={class:"flex items-center",style:{gap:"10px"}},G={class:"col fit-width relative"},X={class:"absolute column fit"},Q={class:"row justify-end mt-10 mb-10"},Y={class:"row form-item-content",style:{width:"100%"}},Z={class:"col"},P={class:"dialog-footer"},v={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(m,{expose:d}){const c=b.EDialog,s=m,f=e.ref(),h=e.ref(),i=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,l="请输入")=>n.text?.search?.placeholder===void 0?`${l}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};s.option.column.forEach(a=>{(typeof a.show?.search=="function"?a.show?.search(t.search.form):a.show?.search)&&(n[a.key]=t.search.form[a.key])});const l=s.option.search?.before?.(n);return l&&(n=l),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(l=>{s.option.search?.resetMode==="default"?n[l]=t.search.formDefault[l]:n[l]=void 0}),t.search.form=JSONUtil.cp(n),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:s.option.page?.size||10,sizeList:s.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:s.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,l)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=l=>{let a=[];return l.forEach(o=>{a.push(o._id),o.children&&o.children.length>0&&(a=a.concat(n(o.children)))}),a};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=s.option.api.list;try{const l=await n({[w.pageField.size]:t.page.size,[w.pageField.num]:t.page.num,...t.search.getFormData()}),a=w.resultField,o=l.data||{[a.list]:l};let r=(Array.isArray(o[a.list]),o[a.list]);t.table.data=s.option.data?await s.option.data(r):r,t.page.total=o[a.total]||0}catch(l){console.error(l)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}},exportFun:{start:async n=>{let l=await t.table.exportFun[n](),a=s.option.column;const o=JSONUtil.cp({data:l,columns:a}),r=s.option.tools?.export||{};r.before&&r.before(o),S.exportToExcel(o.data,o.columns,r.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail("请选择要导出的数据"),new Error("请选择要导出的数据");return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail("暂无数据"),new Error("暂无数据");return t.table.data},all:async()=>{t.table.loading=!0;const n=s.option.api.list;try{const{data:l}=await n({[w.pageField.size]:999999,[w.pageField.num]:1});return l[w.resultField.list]}catch(l){console.error(l)}finally{t.table.loading=!1}}},export:n=>{t.table.exportFun.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(s.option.form?.editAll)return n;let l={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(a=>{n[a]!==t.update.edit.data[a]&&(l[a]=n[a])}),l}},open:(n,l)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=n;const a=n===c.Insert;t.update.edit.data=l,t.update.title=a?"新增":"编辑",t.update.form=JSONUtil.cp(a?t.update.formDefault:l),await s.option.form?.openBefore?.(l,t.update),t.update.show=!0,t.update.showContent=!0,s.option.form?.openAfter?.(l,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(a,o)=>new Promise((r,u)=>{a||(b.fail("请检查表单数据"),u(!1)),r()})),t.update.loading=!0;const n=t.update.type===c.Insert?s.option.api.create:s.option.api.update;let l=JSONUtil.cp(t.update.form);delete l.children,await s.option.form?.submitBefore?.(l,t.update),Object.keys(l).forEach(a=>{if(typeof l[a]=="string"&&l[a].indexOf("T")>-1){const o=new Date(l[a]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(l[a]=o)}});try{await n({...l}),t.update.close(),await t.table.getList(),s.option.form?.submitAfter?.(l,t.update)}catch(a){console.error(a)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail("请选择要删除的数据");return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=s.option.api.delete;try{await n({_id:t.remove.items.map(l=>l._id),items:t.remove.items}),b.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(l){console.error(l)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const l={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:"暂无数据",highlightCurrentRow:!0}},a=s.option;Object.keys(l).forEach(o=>{a[o]=ObjectUtil.deepMerge(l[o],a[o]||{})})},initColumnOptions:()=>{const n=s.option,l=a=>{const r={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(C,k)=>{const y=a.options?.switch;try{await f.value?.open({title:"确认修改",content:`确认要${k[C]===y.activeValue?y.inactiveLabel:y.activeLabel}吗?`}),t.table.loading=!0;try{return await s.option.api.update({_id:k._id,[C]:k[C]===y.activeValue?y.inactiveValue:y.activeValue,final(B,E,U){t.table.loading=!1}}),t.table.loading=!1,b.success("操作成功"),t.table.getList(),!0}catch(B){return console.error(B),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=a;Object.keys(r).forEach(C=>{u[C]=ObjectUtil.deepMerge(r[C],u[C]||{})})};n.column.forEach(l),n.table?.column?.forEach(l)},initColumnForm:()=>{const n=s.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const l=[],a=s.option.form?.maxSpan||12,o=s.option.form?.defaultSpan||a/2;let r=[];const u=k=>{if(t.update.formDefault[k.key]=k.value,k.table.table&&(k.show.table&&t.table.column.show.list.push(k.key),k.table.table&&t.table.column.show.listSource.push(k.key)),k.isForm){k.form=k.form||{span:o},k.form.span=k.form.span??o;let y=k.form.span,B=r.reduce((U,oe)=>U+oe.span,y);const E=r.length;r.push({item:k,span:y}),(E===1&&r[0].span===0||B>=a||y===0&&E>1)&&(l.push(r),r=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};n.column.forEach(k=>{k.isForm=!0,u(k)}),s.option.table?.column?.forEach(k=>{k.isForm=!1,u(k)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(k=>k.table?.table),t.search.column.list.sort((k,y)=>k.sort?.search-y.sort?.search),t.table.column.list.sort((k,y)=>k.sort?.table-y.sort?.table),r.length>0&&l.push(r),t.update.formColumn=l;const C=s.option.search?.formDefault;C&&Object.keys(C).forEach(k=>{t.search.formDefault[k]=C[k]}),n.column.forEach(k=>{k.show?.search||(t.search.formDefault[k.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),d({conf:t}),(n,l)=>{const a=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",j,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",M,[m.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(e.unref(p.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o,"请选择"),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o,"请选择"),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(p.ElFormItem),null,{default:e.withCtx(()=>[m.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...l[8]||(l[8]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),m.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",H,[e.createElementVNode("div",A,[e.unref(i)(m.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:l[0]||(l[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),m.option.table?.selectable&&e.unref(i)(m.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",_,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:l[1]||(l[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),m.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:l[2]||(l[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...l[12]||(l[12]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),m.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:t.table.export},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownItem),{command:"select"},{default:e.withCtx(()=>[...l[14]||(l[14]=[e.createTextVNode("导出选中",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...l[15]||(l[15]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...l[16]||(l[16]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createVNode(e.unref(p.ElButton),{type:"warning"},{default:e.withCtx(()=>[...l[13]||(l[13]=[e.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",q,[e.renderSlot(n.$slots,"tools-right"),m.option.tools?.refresh===void 0||m.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:l[3]||(l[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[...l[17]||(l[17]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"})],-1)])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:t.table.data},m.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[m.option.table?.selectable&&e.unref(i)(m.option.tools?.delete)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof m.option.table?.selectable=="function"?m.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:r})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:r,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:r[o.key],"onUpdate:modelValue":u=>r[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,r)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(r[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(i)(m.option.tools?.add)||e.unref(i)(m.option.tools?.update)||e.unref(i)(m.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:1,label:"操作",width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(i)(m.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:r=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[...l[18]||(l[18]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(m.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:r=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[...l[19]||(l[19]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(m.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:r=>t.remove.open([o])},{default:e.withCtx(()=>[...l[20]||(l[20]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})]),_:3})):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[a,t.table.loading]])])]),e.createElementVNode("div",Q,[t.page.total>t.page.size?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":t.page.num,"onUpdate:currentPage":l[4]||(l[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":l[5]||(l[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":l[6]||(l[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},m.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",P,[e.createVNode(e.unref(p.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...l[21]||(l[21]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[...l[22]||(l[22]=[e.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(o.map(r=>r.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:m.option.form?.stripe===void 0?!0:m.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(r.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(r.item.form.span>0?`col-${r.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof r.item.text?.form?.label=="boolean"?!r.item.text?.form?.label:!1}),label:typeof r.item.text?.form?.label=="string"?r.item.text?.form?.label:r.item.label,prop:r.item.key,"label-width":r.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.renderSlot(n.$slots,"form-"+r.item.key+"-start",{row:t.update.form,item:r.item}),e.createElementVNode("div",Z,[e.renderSlot(n.$slots,"form-"+r.item.key,{row:t.update.form,item:r.item},()=>[r.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.input,e.toHandlers(r.item.options?.input?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.switch,{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.select,e.toHandlers(r.item.options?.select?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:r.item.key},{ref_for:!0},r.item.options?.list,e.toHandlers(r.item.options?.list?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):r.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.treeSelect,e.toHandlers(r.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.datetime,e.toHandlers(r.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[r.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[r.item.type]),e.mergeProps({key:6,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.[r.item.type],e.toHandlers(r.item.options?.[r.item.type]?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+r.item.key+"-end",{row:t.update.form,item:r.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(p.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":l[7]||(l[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",v,[e.createVNode(e.unref(p.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[...l[23]||(l[23]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[...l[24]||(l[24]=[e.createTextVNode(" 确认删除 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,"确认要删除【"+e.toDisplayString(t.remove.items.length)+"】条数据吗?",1)]),_:1},8,["modelValue","title"]),e.createVNode(I,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class ee{static async download(d,c="download.png"){const s=document.createElement("a");s.style.display="none",s.href=d,s.setAttribute("download",c),typeof s.download>"u"&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(d)}static exportJSONFile=(d,c)=>{const s=new Blob([JSON.stringify(d)],{type:"application/json"}),f=URL.createObjectURL(s),h=document.createElement("a");h.href=f,h.download=`${c||"config"}.json`,h.click()};static importFile=async d=>new Promise((c,s)=>{const f=document.createElement("input");f.type="file";const h=d?.accept||".json";f.accept=h,f.style.display="none",f.onchange=i=>{const t=i.target.files[0];if(!t){b.fail("未选择文件"),s("未选择文件");return}const n=new FileReader;n.onload=async l=>{const a=h==".json"?JSON.parse(l.target.result):l.target.result;c(a)},n.onerror=()=>{b.fail("文件读取失败"),s("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const D=(m,d)=>{if(m.component("TCurd",F),m.component("TFormList",x),m.component("TColumn",N),d?.customComponent){w.customComponent=d.customComponent;for(const c in d.customComponent)m.component(c,d.customComponent[c])}},te={install:D};g.ArrUtil=V,g.ExcelUtil=S,g.TColumn=N,g.TCurd=F,g.TFile=ee,g.TForm=w,g.TFormList=x,g.TSys=b,g.default=te,g.install=D,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.cc1Form={},b.Vue,b.ElementPlus))})(this,(function(b,e,m){"use strict";class y{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,d)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(d):r):typeof s=="function"?s(d):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async s=>{if(!y.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const d=await y.moduleObj[s]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(s,d,r={}){const f=Date.now();if(!this.tipMessages[s]||f-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=f;const h=Object.assign({message:s,type:d},r);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,d={})=>{this.showMessage(s,"error",d)};static success=(s,d={})=>{this.showMessage(s,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,d=!0)=>{if(d){let r=screen.width/2-500,f=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+r)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(d,r)=>{let f=document.getElementById(s.id);const h=await y.loadModule("html2canvas");try{h(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(c){let t=c.toDataURL("image/png");d(t)})}catch(c){r(c)}})}class w{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static customComponent={};static findOptions=(s,d)=>{const r=s.column.find(h=>h.key===d),f=h=>h.replace(/-([a-z])/g,(c,t)=>t.toUpperCase());if(r)return r.options[f(r.type)]};static setOptionsData=(s,d,r)=>{const f=w.findOptions(s,d);f&&(f.data=r)};static form={openBefore:{parentId:(s,d,r,f)=>{s?d.type===y.EDialog.Insert?(d.form.parentId=s._id,d.form.sort=s.children.length+1):d.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=r.length+1),w.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,d,r)=>{d[s]||(d[s]=[]),d[s].forEach(f=>{r.forEach(h=>{let c=h.default??"";h.type==="number"&&(c=h.default??0),h.type==="boolean"&&(c=h.default??!1),h.type==="time"&&(c=h.default??new Date),f[h.value]===void 0&&(f[h.value]=c)}),f._id||(f._id=B.getIdFun())})};static add=(s,d,r,f)=>{const h=JSONUtil.cp(r);B.setId(s,d,r),d[s].push(h.reduce((c,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),c[t.value]=n,c},{_id:B.getIdFun()})),f?.(d)};static remove=(s,d,r,f)=>{d[s]=d[s].filter(h=>h._id!==r._id),f?.(d)};static getNoIdData=(s,d)=>{const r=JSONUtil.cp(s);return r.forEach(f=>{f._id&&delete f._id,d&&f[d]&&B.getNoIdData(f[d],d)}),r}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},S=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(p,{emit:s}){const d=p,r=e.reactive({show:!1,add:(h,c,t)=>{B.add(h,c,t,()=>{f("change")})},remove:(h,c,t)=>{B.remove(h,c,t,()=>{f("change")})}});e.onMounted(()=>{B.setId(d.field,d.row,d.itemFields),r.show=!0});const f=s;return(h,c)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:c[0]||(c[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...c[2]||(c[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(n,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:c[1]||(c[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>r.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...c[3]||(c[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),_={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const d=y.isFun,r=y.EDialog,f=e.ref(),h=p,c=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||r.Insert)===r.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;c.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(c.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,g=o.reduce((E,x)=>E+x.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||g>=i||C===0&&V>1)&&(n.push(o),o=[]),u.rules&&(c.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),c.formColumn=n,c.form=JSONUtil.cp(c.formDefault)},init:async()=>{c.show=!1,await e.nextTick(),c.initColumnForm()}});return c.initColumnForm(),s({ref:f,conf:c}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:f,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.formColumn,i=>(e.openBlock(),e.createElementBlock("div",_,[e.renderSlot(t.$slots,"form-start",{row:c.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,c.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:c.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:c.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:c.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:c.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:c.form[l.item.key],"onUpdate:modelValue":o=>c.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:c.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:c.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:c.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class N{static exportToExcel=async(s,d,r)=>{if(!s||s.length===0)return;const f=await y.loadModule("xlsx"),h=s.map(n=>{const i={};return d.forEach(l=>{i[l.label]=n[l.key]}),i}),c=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,c,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${r}.xlsx`)}}function ce(p){return p}const I={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",submit:"提交",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...d){return typeof s=="function"?s(...d):(s=String(s),s.replace(/{([^}]+)}/g,(r,f,h)=>typeof d[h]<"u"?d[h]:`{${f}}`))}static tCurd(s,...d){return this.t(this.curd[s],...d)}static curd=I}const L={class:"dialog-footer"},z=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const d=e.ref(!1),r=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,c=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,a)=>{h=o,c=a})),n=()=>{d.value=!1,h?.(!0),h=null,c=null},i=()=>{d.value=!1,c?.(new Error("用户取消操作")),h=null,c=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=a=>d.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(m.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),j=(p,s)=>{const d=p.__vccOpts||p;for(const[r,f]of s)d[r]=f;return d},M={},R={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function H(p,s){return e.openBlock(),e.createElementBlock("svg",R,[...s[0]||(s[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const A=j(M,[["render",H]]),J={class:"col relative cc1-form-box"},W={class:"absolute row fit",style:{overflow:"hidden"}},K={class:"col column"},q={key:0,class:"relative curd-search"},G={class:"mb-10 flex justify-between items-center"},X={class:"flex items-center",style:{gap:"10px"}},Q={key:0},Y={key:1},Z={key:2},P={class:"export-btn"},v={class:"flex items-center",style:{gap:"10px"}},ee={class:"col fit-width relative"},te={class:"absolute column fit"},oe={class:"row justify-end mt-10 mb-10"},le={class:"row form-item-content",style:{width:"100%"}},ae={class:"col"},re={class:"dialog-footer"},ne={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const d=y.EDialog,r=p,f=e.ref(),h=e.ref(),c=y.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=k.tCurd("placeholderInput"))=>n.text?.search?.placeholder===void 0?`${i}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(n[l.key]=t.search.form[l.key])});const i=r.option.search?.before?.(n);return i&&(n=i),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(i=>{r.option.search?.resetMode==="default"?n[i]=t.search.formDefault[i]:n[i]=void 0}),t.search.form=JSONUtil.cp(n),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:r.option.page?.size||10,sizeList:r.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:r.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=i=>{let l=[];return i.forEach(o=>{l.push(o._id),o.children&&o.children.length>0&&(l=l.concat(n(o.children)))}),l};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=r.option.api.list;try{const i=await n({[w.pageField.size]:t.page.size,[w.pageField.num]:t.page.num,...t.search.getFormData()}),l=w.resultField,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=r.option.data?await r.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}}},export:{run:{start:async n=>{let i=await t.export.run[n](),l=r.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=r.option.tools?.export||{};a.before&&a.before(o),N.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw y.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw y.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all();return}const n=r.option.api.list,i=await n({[w.pageField.size]:999999,[w.pageField.num]:1});return(i.data||{[w.resultField.list]:i})[w.resultField.list]}catch(n){console.error(n)}finally{t.export.loading=!1}}},loading:!1,click:n=>{t.export.loading||t.export.run.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(l=>{n[l]!==t.update.edit.data[l]&&(i[l]=n[l])}),i}},open:(n,i)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=n;const l=n===d.Insert;t.update.edit.data=i,t.update.title=l?k.tCurd("add"):k.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await r.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(y.fail(k.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===d.Insert?r.option.api.create:r.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await r.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!n)return;await n({...i}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){y.fail(k.tCurd("selectDataToDelete"));return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=r.option.api.delete;try{if(!n)return;await n({_id:t.remove.items.map(i=>i._id),items:t.remove.items}),y.success(k.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:k.tCurd("noData"),highlightCurrentRow:!0}},l=r.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const n=r.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:k.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:k.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await f.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({_id:g._id,[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(E,x,T){t.table.loading=!1}}),t.table.loading=!1,y.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(E){return console.error(E),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};n.column.forEach(i),n.table?.column?.forEach(i)},initColumnForm:()=>{const n=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=r.option.form?.maxSpan||12,o=r.option.form?.defaultSpan||l/2;let a=[];const u=g=>{if(t.update.formDefault[g.key]=g.value,g.table.table&&(g.show.table&&t.table.column.show.list.push(g.key),g.table.table&&t.table.column.show.listSource.push(g.key)),g.isForm){g.form=g.form||{span:o},g.form.span=g.form.span??o;let V=g.form.span,E=a.reduce((T,de)=>T+de.span,V);const x=a.length;a.push({item:g,span:V}),(x===1&&a[0].span===0||E>=l||V===0&&x>1)&&(i.push(a),a=[]),g.rules&&(t.update.rules[g.key]=g.rules)}};n.column.forEach(g=>{g.isForm=!0,u(g)}),r.option.table?.column?.forEach(g=>{g.isForm=!1,u(g)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(g=>g.table?.table),t.search.column.list.sort((g,V)=>g.sort?.search-V.sort?.search),t.table.column.list.sort((g,V)=>g.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=r.option.search?.formDefault;C&&Object.keys(C).forEach(g=>{t.search.formDefault[g]=C[g]}),n.column.forEach(g=>{g.show?.search||(t.search.formDefault[g.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",J,[e.createElementVNode("div",W,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",K,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",q,[e.createVNode(e.unref(m.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(m.ElFormItem),null,{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.unref(c)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(c)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",P,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",v,[e.renderSlot(n.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(A)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ee,[e.createElementVNode("div",te,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:t.table.data},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(c)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(a[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(c)(p.option.tools?.add)||e.unref(c)(p.option.tools?.update)||e.unref(c)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:1,label:e.unref(k).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(c)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:a=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(c)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",oe,[e.createVNode(e.unref(m.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",re,[e.createVNode(e.unref(m.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",ae,[e.renderSlot(n.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(S,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ne,[e.createVNode(e.unref(m.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(z,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class se{static async download(s,d="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",d),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,d)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),f=URL.createObjectURL(r),h=document.createElement("a");h.href=f,h.download=`${d||"config"}.json`,h.click()};static importFile=async s=>new Promise((d,r)=>{const f=document.createElement("input");f.type="file";const h=s?.accept||".json";f.accept=h,f.style.display="none",f.onchange=c=>{const t=c.target.files[0];if(!t){y.fail("未选择文件"),r("未选择文件");return}const n=new FileReader;n.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;d(l)},n.onerror=()=>{y.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const U=(p,s)=>{if(p.component("TCurd",F),p.component("TFormList",S),p.component("TColumn",D),s?.customComponent){w.customComponent=s.customComponent;for(const d in s.customComponent)p.component(d,s.customComponent[d])}},ie={install:U};b.ArrUtil=B,b.ExcelUtil=N,b.TColumn=D,b.TCurd=F,b.TFile=se,b.TForm=w,b.TFormList=S,b.TSys=y,b.default=ie,b.install=U,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -140,6 +140,10 @@ export interface CurdConfig<T = any> {
140
140
  data: T[];
141
141
  columns: CurdConfigColumn[];
142
142
  }) => void;
143
+ /**
144
+ * 导出所有数据钩子
145
+ */
146
+ all: () => any;
143
147
  }>;
144
148
  }>;
145
149
  /**
@@ -206,19 +210,19 @@ export interface CurdConfig<T = any> {
206
210
  /**
207
211
  * 列表
208
212
  */
209
- list: (param?: any) => any;
213
+ list: (param?: T & Record<string, any>) => T[];
210
214
  /**
211
215
  * 新增
212
216
  */
213
- create: (param?: any) => any;
217
+ create?: (param?: T) => any;
214
218
  /**
215
219
  * 编辑
216
220
  */
217
- update: (param?: any) => any;
221
+ update?: (param?: T) => any;
218
222
  /**
219
223
  * 删除
220
224
  */
221
- delete: (param?: any) => any;
225
+ delete?: (param?: T) => any;
222
226
  };
223
227
  /**
224
228
  * 数据处理
@@ -1,7 +1,9 @@
1
1
  import TForm from '../../utils/TForm';
2
+ import TFormI18n from '../../utils/TFormI18n';
2
3
  import { type CurdConfig, type CurdConfigColumn } from '.';
3
4
  import SwitchConfirm from './com/dialog/switchConfirm.vue';
4
5
  import FormList from './com/form/list.vue';
6
+ import IconRefresh from './icon/refresh.vue';
5
7
  import { type FormInstance, ElButton, ElDatePicker, ElDialog, ElDropdown, ElDropdownItem, ElDropdownMenu, ElForm, ElFormItem, ElInput, ElOption, ElPagination, ElSelect, ElSwitch, ElTable, ElTableColumn, ElTreeSelect } from 'element-plus';
6
8
  declare const EDialog: {
7
9
  Insert: any;
@@ -213,8 +215,16 @@ declare const conf: {
213
215
  list: any[];
214
216
  change: (selection: any[]) => void;
215
217
  };
216
- exportFun: any;
217
- export: (command: any) => void;
218
+ };
219
+ export: {
220
+ run: {
221
+ start: (command: any) => Promise<void>;
222
+ select: () => any[];
223
+ page: () => any[];
224
+ all: () => Promise<any>;
225
+ };
226
+ loading: boolean;
227
+ click: (command: any) => void;
218
228
  };
219
229
  update: {
220
230
  title: string;
@@ -342,7 +352,7 @@ declare var __VLS_1: {}, __VLS_7: {
342
352
  row: Record<string, any>;
343
353
  }, __VLS_63: {
344
354
  row: Record<string, any>;
345
- }, __VLS_117: {}, __VLS_119: {}, __VLS_139: string, __VLS_140: {
355
+ }, __VLS_117: {}, __VLS_119: {}, __VLS_142: string, __VLS_143: {
346
356
  row: any;
347
357
  item: {
348
358
  key: string;
@@ -426,13 +436,13 @@ declare var __VLS_1: {}, __VLS_7: {
426
436
  table?: number | undefined;
427
437
  } | undefined;
428
438
  };
429
- }, __VLS_150: {
439
+ }, __VLS_153: {
430
440
  row: any;
431
- }, __VLS_176: {
441
+ }, __VLS_179: {
432
442
  row: any;
433
- }, __VLS_187: {}, __VLS_199: {
443
+ }, __VLS_190: {}, __VLS_202: {
434
444
  row: any;
435
- }, __VLS_206: string, __VLS_207: {
445
+ }, __VLS_209: string, __VLS_210: {
436
446
  row: any;
437
447
  item: {
438
448
  key: string;
@@ -516,7 +526,7 @@ declare var __VLS_1: {}, __VLS_7: {
516
526
  table?: number | undefined;
517
527
  } | undefined;
518
528
  };
519
- }, __VLS_210: string, __VLS_211: {
529
+ }, __VLS_213: string, __VLS_214: {
520
530
  row: any;
521
531
  item: {
522
532
  key: string;
@@ -600,7 +610,7 @@ declare var __VLS_1: {}, __VLS_7: {
600
610
  table?: number | undefined;
601
611
  } | undefined;
602
612
  };
603
- }, __VLS_245: string, __VLS_246: {
613
+ }, __VLS_248: string, __VLS_249: {
604
614
  row: any;
605
615
  item: {
606
616
  key: string;
@@ -684,19 +694,19 @@ declare var __VLS_1: {}, __VLS_7: {
684
694
  table?: number | undefined;
685
695
  } | undefined;
686
696
  };
687
- }, __VLS_248: {
697
+ }, __VLS_251: {
688
698
  row: any;
689
699
  };
690
700
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
691
701
  [K in NonNullable<typeof __VLS_14>]?: (props: typeof __VLS_15) => any;
692
702
  } & {
693
- [K in NonNullable<typeof __VLS_139>]?: (props: typeof __VLS_140) => any;
703
+ [K in NonNullable<typeof __VLS_142>]?: (props: typeof __VLS_143) => any;
694
704
  } & {
695
- [K in NonNullable<typeof __VLS_206>]?: (props: typeof __VLS_207) => any;
705
+ [K in NonNullable<typeof __VLS_209>]?: (props: typeof __VLS_210) => any;
696
706
  } & {
697
- [K in NonNullable<typeof __VLS_210>]?: (props: typeof __VLS_211) => any;
707
+ [K in NonNullable<typeof __VLS_213>]?: (props: typeof __VLS_214) => any;
698
708
  } & {
699
- [K in NonNullable<typeof __VLS_245>]?: (props: typeof __VLS_246) => any;
709
+ [K in NonNullable<typeof __VLS_248>]?: (props: typeof __VLS_249) => any;
700
710
  } & {
701
711
  'box-left'?: (props: typeof __VLS_1) => any;
702
712
  } & {
@@ -710,15 +720,15 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
710
720
  } & {
711
721
  'tools-right'?: (props: typeof __VLS_119) => any;
712
722
  } & {
713
- 'table-op-left'?: (props: typeof __VLS_150) => any;
723
+ 'table-op-left'?: (props: typeof __VLS_153) => any;
714
724
  } & {
715
- 'table-op-right'?: (props: typeof __VLS_176) => any;
725
+ 'table-op-right'?: (props: typeof __VLS_179) => any;
716
726
  } & {
717
- 'box-right'?: (props: typeof __VLS_187) => any;
727
+ 'box-right'?: (props: typeof __VLS_190) => any;
718
728
  } & {
719
- 'form-start'?: (props: typeof __VLS_199) => any;
729
+ 'form-start'?: (props: typeof __VLS_202) => any;
720
730
  } & {
721
- 'form-end'?: (props: typeof __VLS_248) => any;
731
+ 'form-end'?: (props: typeof __VLS_251) => any;
722
732
  }>;
723
733
  declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
724
734
  /**
@@ -729,8 +739,10 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
729
739
  };
730
740
  }>, {
731
741
  TForm: typeof TForm;
742
+ TFormI18n: typeof TFormI18n;
732
743
  SwitchConfirm: typeof SwitchConfirm;
733
744
  FormList: typeof FormList;
745
+ IconRefresh: typeof IconRefresh;
734
746
  ElButton: typeof ElButton;
735
747
  ElDatePicker: typeof ElDatePicker;
736
748
  ElDialog: typeof ElDialog;
@@ -972,8 +984,16 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
972
984
  list: any[];
973
985
  change: (selection: any[]) => void;
974
986
  };
975
- exportFun: any;
976
- export: (command: any) => void;
987
+ };
988
+ export: {
989
+ run: {
990
+ start: (command: any) => Promise<void>;
991
+ select: () => any[];
992
+ page: () => any[];
993
+ all: () => Promise<any>;
994
+ };
995
+ loading: boolean;
996
+ click: (command: any) => void;
977
997
  };
978
998
  update: {
979
999
  title: string;
@@ -1,11 +1,16 @@
1
1
  export default class TForm {
2
2
  /** 全局分页字段 */
3
3
  static pageField: {
4
- [key: string]: string;
4
+ num: string;
5
+ size: string;
5
6
  };
6
7
  /** 全局请求结果字段 */
7
8
  static resultField: {
8
- [key: string]: string;
9
+ list: string;
10
+ pages: string;
11
+ num: string;
12
+ size: string;
13
+ total: string;
9
14
  };
10
15
  /**
11
16
  * 自定义组件
@@ -0,0 +1,71 @@
1
+ /** 国际化值类型:字符串或返回字符串的函数 */
2
+ export type I18nValue = string | ((...params: any[]) => string);
3
+ declare const curdI18n: {
4
+ search: string;
5
+ add: string;
6
+ edit: string;
7
+ delete: string;
8
+ export: string;
9
+ exportSelect: string;
10
+ exportPage: string;
11
+ exportAll: string;
12
+ import: string;
13
+ refresh: string;
14
+ reset: string;
15
+ expandCollapse: string;
16
+ operation: string;
17
+ close: string;
18
+ submit: string;
19
+ confirmDelete: string;
20
+ confirmDeleteMessage: string;
21
+ placeholderInput: string;
22
+ placeholderSelect: string;
23
+ checkFormData: string;
24
+ selectDataToDelete: string;
25
+ selectDataToExport: string;
26
+ noData: string;
27
+ operationSuccess: string;
28
+ switchOn: string;
29
+ switchOff: string;
30
+ confirmModify: string;
31
+ confirmSwitchMessage: string;
32
+ };
33
+ /** 国际化 */
34
+ export default class TFormI18n {
35
+ /** 解析国际化值:函数则执行返回字符串,否则 */
36
+ static t(val: I18nValue, ...params: any[]): string;
37
+ /** 解析curd国际化值 */
38
+ static tCurd(key: keyof typeof curdI18n, ...params: any[]): string;
39
+ /** curd表单 */
40
+ static curd: {
41
+ search: string;
42
+ add: string;
43
+ edit: string;
44
+ delete: string;
45
+ export: string;
46
+ exportSelect: string;
47
+ exportPage: string;
48
+ exportAll: string;
49
+ import: string;
50
+ refresh: string;
51
+ reset: string;
52
+ expandCollapse: string;
53
+ operation: string;
54
+ close: string;
55
+ submit: string;
56
+ confirmDelete: string;
57
+ confirmDeleteMessage: string;
58
+ placeholderInput: string;
59
+ placeholderSelect: string;
60
+ checkFormData: string;
61
+ selectDataToDelete: string;
62
+ selectDataToExport: string;
63
+ noData: string;
64
+ operationSuccess: string;
65
+ switchOn: string;
66
+ switchOff: string;
67
+ confirmModify: string;
68
+ confirmSwitchMessage: string;
69
+ };
70
+ }
71
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",