cc1-form 1.1.43 → 1.2.0

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(C,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("element-plus"),require("vue-router"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue-router","vue"],m):(C=typeof globalThis<"u"?globalThis:C||self,m(C.cc1Form={},C.ElementPlus,C.VueRouter,C.Vue))})(this,(function(C,m,Ee,e){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Add:"Add",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...c)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...c):o):typeof n=="function"?n(...c):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async n=>{if(!b.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const c=await b.moduleObj[n]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(n,c,o={}){const l=Date.now();if(!this.tipMessages[n]||l-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=l;const a=Object.assign({message:n,type:c},o);m.ElMessage(a),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,c={})=>{this.showMessage(n,"error",c)};static success=(n,c={})=>{this.showMessage(n,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,c="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=m.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,c=!0)=>{if(c){let o=screen.width/2-500,l=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+l+", left="+o)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(c,o)=>{let l=document.getElementById(n.id);const a=await b.loadModule("html2canvas");try{a(l,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(t){let s=t.toDataURL("image/png");c(s)})}catch(t){o(t)}})}class u{static config={field:{page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"}},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,dropdown:{show:!0,select:!0,page:!0,all:!0},fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=n=>{u.config=ObjectUtil.deepMerge(u.config,n)}}class B{static customComponent={};static findOptions=(n,c)=>{const o=n.column.find(a=>a.key===c),l=a=>a.replace(/-([a-z])/g,(t,s)=>s.toUpperCase());if(o)return o.options[l(o.type)]};static setOptionsData=(n,c,o)=>{const l=B.findOptions(n,c);l&&(l.data=o)};static form={openBefore:{parentId:(n,c,o,l)=>{const a=u.config.table.rowKey;n?c.type===b.EDialog.Add?(c.form.parentId=n[a],c.form.sort=n.children.length+1):c.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=o.length+1),B.setOptionsData(l,"parentId",[{[a]:"0",title:"根",children:o}])}}}}function Se(i){return i}const x={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class h{static t(n,...c){if(typeof n=="function")return n(...c);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(l,a)=>o<c.length?String(c[o++]):`{${a}}`)}static setI18n=n=>{h.curd=ObjectUtil.deepMerge(h.curd,n)};static tCurd(n,...c){return this.t(this.curd[n],...c)}static curd=x}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,c,o)=>{c[n]||(c[n]=[]);const l=u.config.table.rowKey;c[n].forEach(a=>{o.forEach(t=>{let s=t.default??"";t.type==="number"&&(s=t.default??0),t.type==="boolean"&&(s=t.default??!1),t.type==="time"&&(s=t.default??new Date),a[t.value]===void 0&&(a[t.value]=s)}),a[l]||(a[l]=E.getIdFun())})};static add=(n,c,o,l)=>{const a=JSONUtil.cp(o);E.setId(n,c,o);const t=u.config.table.rowKey;c[n].push(a.reduce((s,f)=>{let p=f.default??"";return f.type==="number"&&(p=f.default??0),f.type==="boolean"&&(p=f.default??!1),f.type==="time"&&(p=f.default??new Date),s[f.value]=p,s},{[t]:E.getIdFun()})),l?.(c)};static remove=(n,c,o,l)=>{const a=u.config.table.rowKey;c[n]=c[n].filter(t=>t[a]!==o[a]),l?.(c)};static getNoIdData=(n,c)=>{const o=JSONUtil.cp(n),l=u.config.table.rowKey;return o.forEach(a=>{a[l]&&delete a[l],c&&a[c]&&E.getNoIdData(a[c],c)}),o}}const A={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},M={key:0},H={class:"row items-center",style:{gap:"10px",width:"100%"}},I={key:1},D=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:""},addBottom:{default:!1}},emits:["change"],setup(i,{emit:n}){const c=i,o=e.reactive({show:!1,add:(a,t,s)=>{E.add(a,t,s,()=>{l("change")})},remove:(a,t,s)=>{E.remove(a,t,s,()=>{l("change")})}});e.onMounted(()=>{E.setId(c.field,c.row,c.itemFields),o.show=!0});const l=n;return(a,t)=>{const s=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(a.$slots,"list-start",{row:i.row}),i.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(s,{link:"",type:"primary",onClick:t[0]||(t[0]=p=>o.add(i.field,i.row,i.itemFields))},{default:e.withCtx(()=>t[3]||(t[3]=[e.createTextVNode("添加")])),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.row[i.field],p=>(e.openBlock(),e.createElementBlock("div",H,[e.renderSlot(a.$slots,"item-start",{item:p,row:i.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.itemFields,g=>(e.openBlock(),e.createBlock(f,{modelValue:p[g.value],"onUpdate:modelValue":r=>p[g.value]=r,style:e.normalizeStyle({width:i.inputWidth}),class:e.normalizeClass(i.inputClass),placeholder:g[i.label]||g[i.value],onChange:t[1]||(t[1]=r=>l("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(a.$slots,"item-end",{item:p,row:i.row}),e.createVNode(s,{link:"",type:"danger",onClick:g=>o.remove(i.field,i.row,p)},{default:e.withCtx(()=>t[4]||(t[4]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),i.addBottom?(e.openBlock(),e.createElementBlock("div",I,[e.createVNode(s,{link:"",type:"primary",onClick:t[2]||(t[2]=p=>o.add(i.field,i.row,i.itemFields))},{default:e.withCtx(()=>t[5]||(t[5]=[e.createTextVNode("添加")])),_:1})])):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"list-end",{row:i.row})])):e.createCommentVNode("",!0)}}}),j={class:"row form-item-content",style:{width:"100%"}},R={class:"col"},K={class:"col"},J=["innerHTML"],$=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(i,{expose:n}){const c=b.isFun,o=b.EDialog,l=e.ref(),a=i,t=e.reactive({rules:{},show:!0,form:{},formDefault:{},type:a.type||o.Add,formColumn:[],getDisabled:s=>t.type===o.View?s.disabled?.view===void 0?!0:s.disabled?.view:s.disabled?.[t.type===o.Add?"create":"update"],getBind:s=>s.options?.[t.type===o.Add?"formAdd":"formUpdate"]?.[s.type]||s.options?.[s.type]||{},getOn:s=>s.options?.[t.type===o.Add?"formAdd":"formUpdate"]?.[s.type]?.on||s.options?.[s.type]?.on||{},getColumnSpan:(s,f)=>{if(s.item.form?.spanCol){const p=a.option.form?.maxSpan||12,g=a.option.form?.defaultSpan||p/2,d=f.filter(k=>!b.isFun(k.item.show?.form,t.form,t.type)).reduce((k,y)=>k+(y.item.form?.span||g),0);return(s.item.form?.span||g)+d}return s.item.form?.span},initColumnForm:()=>{const s=a.option;t.formColumn=[],t.rules={},t.formDefault={};const f=[],p=a.option.form?.maxSpan||12,g=a.option.form?.defaultSpan||p/2;let r=[];const d=y=>{if(y.children){y.children.forEach(w=>{d(w)});return}if(t.formDefault[y.key]=y.value,y.isForm&&(typeof y.show?.form!="boolean"||y.show?.form)){y.form=y.form||{span:g},y.form.span=y.form.span??g;const w=y.form.span,V=r.reduce((z,F)=>z+F.span,w),N=r.length;if(r.push({item:y,span:w}),(N===1&&r[0].span===0||V>=p||w===0&&N>1)&&(f.push(r),r=[]),y.rules){const z={input:h.tCurd("placeholderInput"),select:h.tCurd("placeholderSelect")},F=(z[y.type]||z.input)+y.label;t.rules[y.key]=typeof y.rules=="boolean"?[{required:!0,message:F,trigger:"blur"}]:y.rules}}},k=(y,w)=>{y.isForm=w,Array.isArray(y.children)&&y.children.forEach(V=>k(V,w))};s.column.forEach(y=>{k(y,!0),d(y)}),r.length>0&&f.push(r),t.formColumn=f,t.form=JSONUtil.cp(t.formDefault)}});return t.initColumnForm(),n({ref:l,conf:t}),(s,f)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:l,model:t.form,rules:t.rules},{default:e.withCtx(()=>[t.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.formColumn,(p,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[e.unref(c)(p.map(r=>r.item?.show?.form),t.form,t.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:i.option.form?.stripe===void 0?!0:i.option.form?.stripe}])},[e.renderSlot(s.$slots,"form-start",{row:t.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.item.key},[e.unref(c)(r.item.show?.form,t.form,t.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([r.item.form.span>0?`col-${t.getColumnSpan(r,p)}`:"col",`form-item-col-${r.item.key}`])},[e.createVNode(e.unref(m.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||i.option.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",j,[e.renderSlot(s.$slots,"form-"+r.item.key+"-start",{row:t.form,item:r.item}),e.createElementVNode("div",R,[e.createElementVNode("div",K,[e.renderSlot(s.$slots,"form-"+r.item.key,{row:t.form,item:r.item},()=>[r.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.item.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(m.ElRadioGroup),e.mergeProps({key:3,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.item.options?.radio?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:4,row:t.form,field:r.item.key,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):r.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:5,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:6,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type&&(e.unref(B).customComponent[r.item.type]||e.unref(B).customComponent[r.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[r.item.type]?.form||e.unref(B).customComponent[r.item.type]),e.mergeProps({key:7,modelValue:t.form[r.item.key],"onUpdate:modelValue":d=>t.form[r.item.key]=d,ref_for:!0},t.getBind(r.item),e.toHandlers(t.getOn(r.item)),{disabled:t.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(s.$slots,"form-"+r.item.key+"-right",{row:t.form,item:r.item})]),e.renderSlot(s.$slots,"form-"+r.item.key+"-tip",{row:t.form,item:r.item},()=>[r.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:typeof r.item.form?.tipText=="function"?r.item.form?.tipText(t.form,t.type):r.item.form?.tipText},null,8,J)):e.createCommentVNode("",!0)])]),e.renderSlot(s.$slots,"form-"+r.item.key+"-end",{row:t.form,item:r.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(s.$slots,"form-end",{row:t.form})],2)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class O{static exportToExcel=async(n,c,o)=>{if(!n||n.length===0)return;const l=await b.loadModule("xlsx"),a=n.map(f=>{const p={};return c.forEach(g=>{p[g.label]=f[g.key]}),p}),t=l.utils.json_to_sheet(a),s=l.utils.book_new();l.utils.book_append_sheet(s,t,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,l.writeFile(s,`${o}.xlsx`)}}const S=b.EDialog,W=i=>{const n=e.ref(),c=e.ref(),o=e.reactive({option:i.option,search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(l,a=h.tCurd("placeholderInput"))=>l.text?.search?.placeholder===void 0?`${a}${l.label}`:l.text?.search?.placeholder,getFormData:()=>{let l={};i.option.column.forEach(t=>{(typeof t.show?.search=="function"?t.show?.search(o.search.form):t.show?.search)&&(l[t.key]=o.search.form[t.key])});const a=i.option.search?.before?.(l);return a&&(l=a),l},reset:()=>{const l=o.search.formDefault;Object.keys(l).forEach(a=>{i.option.search?.resetMode==="none"?l[a]=void 0:l[a]=o.search.formDefault[a]}),o.search.form=JSONUtil.cp(l),o.page.num=1,i.option.init!==!1&&o.table.getList()},submit:()=>{o.page.num=1,o.table.getList()}},page:{num:1,total:0,layout:i.option.page?.layout||u.config.pagination.layout,showTools:i.option.page?.showTools||u.config.pagination.showTools,size:i.option.page?.size||u.config.pagination.size,sizeList:i.option.page?.sizeList||u.config.pagination.pageSizes,pagerCount:i.option.page?.pagerCount||u.config.pagination.pagerCount,getQuery:(l={})=>({[u.config.field.page.size]:l.size||o.page.size,[u.config.field.page.num]:l.num||o.page.num,...o.search.getFormData()})},table:{op:{width:(...l)=>l.filter(t=>t).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(l,a)=>{},all:()=>{if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const l=a=>{let t=[];return a.forEach(s=>{t.push(s[i.option.table.rowKey]),s.children&&s.children.length>0&&(t=t.concat(l(s.children)))}),t};o.table.expand.rowKeys=l(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{o.table.loading=!0;const l=i.option.api.list;try{await o.initApiData("init");let a={};if(o.table.sort.prop){const{props:d,order:k}=u.config.table.sort;a={[d.field]:o.table.sort.prop,[k.field]:o.table.sort.order}}const t=await l({...o.page.getQuery(),...a}),s=u.config.field.result,f=t.data||{[s.list]:t};let p=(Array.isArray(f[s.list]),f[s.list]);const g=o.update.formColumn.flat(),r=JSONUtil.cp(p).map(d=>(Object.keys(d).forEach(y=>{const w=g.find(V=>V.item.key===y);w&&["select","radio"].includes(w.item.type)&&(w.item.table.format||(w.item.table.format=V=>w.item.options[w.item.type].data?.find(N=>N.value==V[y])?.label||V[y]))}),d));o.table.data=i.option.data?await i.option.data(r,p):r,o.page.total=f[s.total]||0}catch(a){console.error(a)}finally{o.table.loading=!1}},selection:{list:[],change:l=>{o.table.selection.list=l}},sort:{prop:"",order:"",change:l=>{u.config.table.sort.resetPage&&(o.page.num=1);const a=u.config.table.sort;if(a.change){a.change(l,o);return}o.table.sort.prop=l.prop,l.order===null?o.table.sort.order="":o.table.sort.order=l.order==="ascending"?a.order.asc:a.order.desc,o.table.getList()}}},export:{run:{start:async l=>{let a=await o.export.run[l](),t=i.option.column;const s=JSONUtil.cp({data:a,columns:t}),f=i.option.tools?.export||{};f.before&&f.before(s),O.exportToExcel(s.data,s.columns,f.fileName)},select:async()=>{o.export.loading=!0;try{if(i.option.tools?.export?.select){await i.option.tools?.export?.select({...o.page.getQuery(),items:o.table.selection.list});return}if(o.table.selection.list.length===0)throw b.fail(h.tCurd("selectDataToExport")),new Error(h.tCurd("selectDataToExport"));return o.table.selection.list}catch(l){console.error(l)}finally{o.export.loading=!1}},page:async()=>{o.export.loading=!0;try{if(i.option.tools?.export?.page){await i.option.tools?.export?.page({...o.page.getQuery()});return}if(o.table.data.length===0)throw b.fail(h.tCurd("noData")),new Error(h.tCurd("noData"));return o.table.data}catch(l){console.error(l)}finally{o.export.loading=!1}},all:async()=>{o.export.loading=!0;try{if(i.option.tools?.export?.all){await i.option.tools?.export?.all({...o.page.getQuery()});return}const l=i.option.api.list,a=await l({...o.page.getQuery({size:999999,num:1})});return(a.data||{[u.config.field.result.list]:a})[u.config.field.result.list]}catch(l){console.error(l)}finally{o.export.loading=!1}}},loading:!1,click:l=>{o.export.loading||o.export.run.start(l)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:S.Add,form:{},formDefault:{},formColumn:[],getDisabled:l=>o.update.type===S.View?l.disabled?.view===void 0?!0:l.disabled?.view:l.disabled?.[o.update.type===S.Add?"create":"update"],getBind:l=>l.options?.[o.update.type===S.Add?"formAdd":"formUpdate"]?.[l.type]||l.options?.[l.type]||{},getOn:l=>l.options?.[o.update.type===S.Add?"formAdd":"formUpdate"]?.[l.type]?.on||l.options?.[l.type]?.on||{},getOptions:l=>{try{const t=o.update.formColumn.flat().find(s=>s.item.key===l)?.item;return t?{options:t.options,bind:o.update.getBind(t)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:l=>{if(i.option.form?.editAll)return l;let a={[i.option.table?.rowKey]:o.update.edit.data[i.option.table?.rowKey]};return Object.keys(o.update.edit.data).forEach(t=>{l[t]!==o.update.edit.data[t]&&(a[t]=l[t])}),a}},view:{},open:(l,a)=>{o.update.showContent||FunUtil.throttle(async()=>{b.loading(!0);try{o.update.type=l,await o.initApiData("update");const t=l===S.Add;if(!t&&i.option.table?.inlineEdit){o.inlineEdit.open(a);return}o.update.edit.data=a,o.update.title=h.tCurd(t?"add":l===S.View?"view":"edit"),o.update.form=JSONUtil.cp(t?o.update.formDefault:a),await i.option.form?.openBefore?.(o.update.form,o.update),o.inlineEdit.data||(o.update.show=!0),o.update.showContent=!0,i.option.form?.openAfter?.(o.update.form,o.update)}catch(t){console.error(t)}finally{b.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await c.value?.validate(async(s,f)=>new Promise((p,g)=>{s||(b.fail(h.tCurd("checkFormData")),g(!1)),p()})),o.update.loading=!0;const l=o.update.type===S.Add?i.option.api.create:i.option.api.update;try{await i.option.form?.submitBefore?.(o.update.form,o.update)}catch{o.update.loading=!1;return}let a=JSONUtil.cp(o.update.form);delete a.children;const t=new Set(i.option.column.filter(s=>s.type==="datetime").map(s=>s.key));Object.keys(a).forEach(s=>{if(t.has(s)&&a[s]!=null){const f=new Date(a[s]).getTime();isNaN(f)||(a[s]=f)}});try{if(!l)return;await l({...a}),o.update.close(),await o.table.getList(),i.option.form?.submitAfter?.(a,o.update)}catch(s){console.error(s)}finally{o.update.loading=!1}})},close:()=>{o.update.show=!1,setTimeout(()=>{o.update.showContent=!1},350)}},inlineEdit:{data:null,open:l=>{o.inlineEdit.data=l,o.update.open(S.Update,l)},close:()=>{o.inlineEdit.data=null,o.update.close()}},remove:{title:h.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{o.remove.show=!1},open:l=>{if(l.length===0){b.fail(h.tCurd("selectDataToDelete"));return}o.remove.items=l,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{o.remove.loading=!0;const l=i.option.api.delete;try{if(!l)return;await l({[i.option.table?.rowKey]:o.remove.items.map(a=>a[i.option.table?.rowKey]),items:o.remove.items}),b.success(h.tCurd("operationSuccess")),o.table.data.length<=1&&o.page.num>1&&(o.page.num-=1),o.remove.close(),await o.table.getList()}catch(a){console.error(a)}finally{o.remove.loading=!1}})}},init:()=>{o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},apiDataMap:{},initApiData:async l=>{const a=[],t=s=>{if(s.children&&s.children.length){s.children.forEach(f=>t(f));return}if(s.options?.[s.type]?.dataApi&&s.options?.[s.type]?.dataApiConfig?.[l]){if(o.apiDataMap[s.key]&&s.options?.[s.type]?.dataApiConfig?.once)return;const f=(async()=>{try{let p=await s.options?.[s.type]?.dataApi?.(o.update.form,l);if(p){const g=s.options?.[s.type]?.dataPath;g&&(p=ObjectUtil.getPathValue(p,g)),s.options[s.type].data=p,s.options.search[s.type].data=p,s.options.formAdd[s.type].data=p,s.options.formUpdate[s.type].data=p,o.apiDataMap[s.key]=p}}catch{}})();a.push(f)}};return i.option.column.forEach(s=>{t(s)}),await Promise.all(a),!0},initCurdConfig:()=>{const l=JSONUtil.cp(u.config);l.table.emptyText=h.tCurd("noData"),i.option.size=i.option.size||{},l.table.size=i.option.size.table||l.size.table,l.form.size=i.option.size.form||l.size.form,l.size.search=i.option.size.search||l.size.search;const a=ObjectUtil.deepMerge(l,i.option||{});Object.keys(a).forEach(t=>{i.option[t]=a[t]})},initColumnOptions:()=>{let l=JSONUtil.cp(u.config.columnConfig);l.options=ObjectUtil.deepMerge(l.options,{switch:{activeLabel:h.tCurd("switchOn"),inactiveLabel:h.tCurd("switchOff")}});const a=t=>{for(const s in l){if(s==="table"){if(t.table=ObjectUtil.deepMerge(l.table,t.table||{}),t.children){t.children.forEach(p=>{a(p)});return}}else s==="type"?t.type=t.type||l.type:t[s]=ObjectUtil.deepMerge(l[s],t[s]||{});t.options=t.options||{},t.options[t.type]=t.options[t.type]||{},t.options[t.type].size=i.option.size.form,["search","formAdd","formUpdate"].forEach(p=>{t.options[p]=t.options[p]||JSONUtil.cp(t.options),t.options[p][t.type]=t.options[p][t.type]||{},t.options[p][t.type].size=p==="search"?i.option.size.search:i.option.size.form}),t.table=ObjectUtil.deepMerge(t.table,t.options[t.type].table||{})}t.type==="switch"&&(t.options.switch.tableBeforeChange=async(s,f)=>{const p=t.options?.switch;try{await n.value?.open({title:h.tCurd("confirmModify"),content:h.tCurd("confirmSwitchMessage")}),o.table.loading=!0;try{return i.option.api.update?(await i.option.api.update({[i.option.table?.rowKey]:f[i.option.table?.rowKey],[s]:f[s]===p.activeValue?p.inactiveValue:p.activeValue,final(g,r,d){o.table.loading=!1}}),o.table.loading=!1,b.success(h.tCurd("operationSuccess")),o.table.getList(),!0):void 0}catch(g){return console.error(g),!1}finally{o.table.loading=!1}}catch{return!1}}),t.type==="treeSelect"&&(t.options.treeSelect.rowKey=i.option.table?.rowKey,t.options.treeSelect.nodeKey=i.option.table?.rowKey)};i.option.column.forEach(a),i.option.table?.column?.forEach(a)},getColumnSpan:(l,a)=>{if(l.item.form?.spanCol){const t=u.config.form.defaultSpan,f=a.filter(p=>!b.isFun(p.item.show?.form,o.update.form,o.update.type)).reduce((p,g)=>p+(g.item.form?.span||t),0);return(l.item?.form.span||t)+f}return l.item.form.span},initColumnForm:()=>{const l=i.option;o.update.formColumn=[],o.table.column.show={list:[],listSource:[]};const a=[],t=i.option.form?.maxSpan||12,s=i.option.form?.defaultSpan||t/2;let f=[];const p=d=>{if(d.children){o.table.column.show.list.push(d.key),d.children.forEach(k=>{p(k)});return}if(o.update.formDefault[d.key]=d.value,d.table.table&&(d.show.table&&o.table.column.show.list.push(d.key),d.table.table&&o.table.column.show.listSource.push(d.key)),!(d.isForm&&typeof d.show?.form=="boolean")||d.show?.form){d.form=d.form||{span:s},d.form.span=d.form.span??s;let k=d.form.span,y=f.reduce((V,N)=>V+N.span,k);const w=f.length;if(f.push({item:d,span:k}),(w===1&&f[0].span===0||y>=t||k===0&&w>1)&&(a.push(f),f=[]),d.rules){const V={input:h.tCurd("placeholderInput"),select:h.tCurd("placeholderSelect")},N=(V[d.type]||V.input)+d.label;o.update.rules[d.key]=typeof d.rules=="boolean"?[{required:!0,message:N,trigger:"blur"}]:d.rules}}},g=(d,k)=>{d.isForm=k,Array.isArray(d.children)&&d.children.forEach(y=>g(y,k))};l.column.forEach(d=>{d.isForm=!0,g(d,!0),p(d)}),i.option.table?.column?.forEach(d=>{g(d,!1),p(d)}),o.search.column.list=l.column.concat(l.table?.column||[]),o.table.column.list=o.search.column.list.filter(d=>d.table?.table),o.search.column.list.sort((d,k)=>d.sort?.search-k.sort?.search),o.table.column.list.sort((d,k)=>d.sort?.table-k.sort?.table),f.length>0&&a.push(f),o.update.formColumn=a;const r=i.option.search?.formDefault;r&&Object.keys(r).forEach(d=>{o.search.formDefault[d]=r[d]}),l.column.forEach(d=>{d.show?.search||(o.search.formDefault[d.key]=void 0)}),o.search.form=JSONUtil.cp(o.search.formDefault)}});return o.init(),e.onMounted(()=>{i.option.init!==!1&&o.table.getList()}),{conf:o,switchConfirmRef:n,ruleFormRef:c}},q={class:"dialog-footer"},Q=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(i,{expose:n}){const c=e.ref(!1),o=e.ref("确认修改"),l=e.ref("确认要修改状态吗?");let a=null,t=null;const s=g=>(g?.title&&(o.value=g.title),g?.content&&(l.value=g.content),c.value=!0,new Promise((r,d)=>{a=r,t=d})),f=()=>{c.value=!1,a?.(!0),a=null,t=null},p=()=>{c.value=!1,t?.(new Error("用户取消操作")),a=null,t=null};return n({open:s}),(g,r)=>{const d=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:c.value,"onUpdate:modelValue":r[0]||(r[0]=k=>c.value=k),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(d,{size:g.size},{default:e.withCtx(()=>[e.createElementVNode("span",q,[e.createVNode(e.unref(m.ElButton),{onClick:p},{default:e.withCtx(()=>r[1]||(r[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:f},{default:e.withCtx(()=>r[2]||(r[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(l.value),1)]),_:1},8,["modelValue","title"])}}}),U=(i,n)=>{const c=i.__vccOpts||i;for(const[o,l]of n)c[o]=l;return c},G={},X={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Y(i,n){return e.openBlock(),e.createElementBlock("svg",X,n[0]||(n[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 Z=U(G,[["render",Y]]),P={},_={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function v(i,n){return e.openBlock(),e.createElementBlock("svg",_,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)]))}const ee=U(P,[["render",v]]),te={class:"row flex-center table-header-label inline"},oe={class:"table-header-tooltip"},ne=["onClick","innerHTML"],ae=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(i){const n=b.isFun,c=e.getCurrentInstance().type;return(o,l)=>{const a=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.key},[o.conf.table.column.show.list.includes(t.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:t.key,label:t.label,ref_for:!0},t.table),{header:e.withCtx(()=>[e.renderSlot(o.$slots,"table-header-"+t.key,{item:t},()=>[e.createElementVNode("div",te,[t.table?.tooltip?(e.openBlock(),e.createBlock(a,{key:0,effect:"dark",content:t.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",oe,[e.createVNode(ee)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.label),1)])])]),default:e.withCtx(({row:s})=>[t.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l[0]||(l[0]=e.createTextVNode("   ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(c)),{conf:o.conf,columnList:t.children,option:o.option},e.createSlots({_:2},[e.renderList(o.$slots,(f,p)=>({name:p,fn:e.withCtx(g=>[e.renderSlot(o.$slots,p,e.mergeProps({ref_for:!0},g||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(t.show?.form,o.conf.update.form,e.unref(b).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.data===s&&(t.type==="input"||t.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[t.key],"onUpdate:modelValue":f=>o.conf.update.form[t.key]=f,ref_for:!0},o.conf.update.getBind(t),e.toHandlers(o.conf.update.getOn(t)),{style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:o.conf.update.form[t.key],"onUpdate:modelValue":f=>o.conf.update.form[t.key]=f,ref_for:!0},o.conf.update.getBind(t),e.toHandlers(o.conf.update.getOn(t)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options?.search?.select?.data||t.options?.select?.data,f=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(o.$slots,"table-"+t.key,{key:1,row:s,item:t},()=>[e.unref(B).customComponent[t.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[t.type??""]?.table),e.mergeProps({key:0,modelValue:s[t.key],"onUpdate:modelValue":f=>s[t.key]=f,ref_for:!0},t.options?.[t.type??""],e.toHandlers(t.options?.[t.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:s[t.key],"onUpdate:modelValue":f=>s[t.key]=f,"before-change":()=>t.options?.switch?.tableBeforeChange?.(t.key,s),ref_for:!0},t.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":t.table?.click?.color}),class:e.normalizeClass({"table-text-click":t.table?.click?.callback}),onClick:f=>t.table?.click?.callback?.(s),innerHTML:t.table?.format?t.table?.format(s):s[t.key]},null,14,ne))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),re={class:"row form-item-content",style:{width:"100%"}},le={class:"col column form-item-content-item"},ie={class:"col"},se=["innerHTML"],de=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(i){return(n,c)=>(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof n.item.item.text?.form?.label=="boolean"?!n.item.item.text?.form?.label:!1}),label:typeof n.item.item.text?.form?.label=="string"?n.item.item.text?.form?.label:n.item.item.label,prop:n.item.item.key,"label-width":n.item.item.form?.labelWidth||n.conf.option.form?.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.renderSlot(n.$slots,"form-"+n.item.item.key+"-start",{row:n.conf.update.form,item:n.item.item}),e.createElementVNode("div",le,[e.createElementVNode("div",ie,[e.renderSlot(n.$slots,"form-"+n.item.item.key,{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[0]||(c[0]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[1]||(c[1]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[2]||(c[2]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.conf.update.getBind(n.item.item).data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(m.ElRadioGroup),e.mergeProps({key:3,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[3]||(c[3]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.conf.update.getBind(n.item.item).data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:4,row:n.conf.update.form,field:n.item.item.key},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:5,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[4]||(c[4]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):n.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:6,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[5]||(c[5]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type&&(e.unref(B).customComponent[n.item.item.type]||e.unref(B).customComponent[n.item.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[n.item.item.type]?.form||e.unref(B).customComponent[n.item.item.type]),e.mergeProps({key:7,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[6]||(c[6]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-right",{row:n.conf.update.form,item:n.item.item})]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-tip",{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:typeof n.item.item.form?.tipText=="function"?n.item.item.form?.tipText(n.conf.update.form,n.conf.update.type):n.item.item.form?.tipText},null,8,se)):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-end",{row:n.conf.update.form,item:n.item.item})])]),_:3},8,["class","label","prop","label-width"]))}}),ce={key:0,class:"relative curd-search fit-width"},fe={class:"mb-10 flex justify-between items-center fit-width"},pe={class:"flex items-center",style:{gap:"10px"}},me={key:0},he={key:1},ge={key:2},ye={class:"export-btn"},ke={key:1,class:"export-btn"},be={class:"flex items-center table-tools-right",style:{gap:"10px"}},ue={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},we={class:"dialog-footer"},Ce={class:"dialog-footer"},T=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(i,{expose:n}){const c=b.EDialog,o=i,l=b.isFun,{conf:a,switchConfirmRef:t,ruleFormRef:s}=W(o);return n({conf:a}),(f,p)=>{const g=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[i.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[i.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(f.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[i.option.table?.fitHeight?"col":""]])},[i.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(e.unref(m.ElForm),{model:e.unref(a).search.form,inline:"",size:i.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(a).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).search.column.list,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(a).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+r.key,{row:e.unref(a).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(a).search.form[r.key],"onUpdate:modelValue":d=>e.unref(a).search.form[r.key]=d,placeholder:e.unref(a).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search,ref_for:!0},r.options?.search?.input||r.options?.input,e.toHandlers(r.options?.search?.input?.on||r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(a).search.form[r.key],"onUpdate:modelValue":d=>e.unref(a).search.form[r.key]=d,placeholder:e.unref(a).search.getPlaceholder(r,e.unref(h).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search,ref_for:!0},r.options?.search?.switch||r.options?.switch,e.toHandlers(r.options?.search?.switch?.on||r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(a).search.form[r.key],"onUpdate:modelValue":d=>e.unref(a).search.form[r.key]=d,placeholder:e.unref(a).search.getPlaceholder(r,e.unref(h).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search,ref_for:!0},r.options?.search?.select||r.options?.select,e.toHandlers(r.options?.search?.select?.on||r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(a).search.form[r.key],"onUpdate:modelValue":d=>e.unref(a).search.form[r.key]=d,disabled:r.disabled?.search,ref_for:!0},r.options?.search?.datetime||r.options?.datetime,e.toHandlers(r.options?.search?.datetime?.on||r.options?.datetime?.on||{})),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(B).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(a).search.form[r.key],"onUpdate:modelValue":d=>e.unref(a).search.form[r.key]=d,ref_for:!0},r.options?.search?.[r.type]||r.options?.[r.type],e.toHandlers(r.options?.search?.[r.type]?.on||r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(f.$slots,"search-"+r.key+"-right",{row:e.unref(a).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(a).search.form}),i.option.tools?.search||i.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0},{default:e.withCtx(()=>[i.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(a).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),i.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:e.unref(a).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(a).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",fe,[e.createElementVNode("div",pe,[e.unref(l)(i.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",me,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:p[0]||(p[0]=r=>e.unref(a).update.open(e.unref(c).Add)),size:i.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),i.option.table?.selectable&&e.unref(l)(i.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:p[1]||(p[1]=r=>e.unref(a).remove.open(e.unref(a).table.selection.list)),size:i.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),i.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:p[2]||(p[2]=r=>e.unref(a).table.expand.all()),size:i.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),i.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[i.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:0,onCommand:e.unref(a).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),{size:i.option.size?.search},{default:e.withCtx(()=>[i.option.tools?.export?.dropdown?.select&&(i.option.table?.selectable||e.unref(l)(i.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),i.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),i.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:2,command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportAll")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",ye,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(a).export.loading,size:i.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(a).export.loading,size:i.option.size?.search,onClick:p[3]||(p[3]=r=>e.unref(a).export.run.start("all"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("export")),1)]),_:1},8,["loading","size"])]))],64)):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",be,[e.renderSlot(f.$slots,"tools-right"),e.unref(a).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(a).page.num,"onUpdate:currentPage":p[4]||(p[4]=r=>e.unref(a).page.num=r),"page-size":e.unref(a).page.size,"onUpdate:pageSize":p[5]||(p[5]=r=>e.unref(a).page.size=r),background:"","page-sizes":e.unref(a).page.sizeList,"pager-count":e.unref(a).page.pagerCount,layout:e.unref(a).page.layout,total:e.unref(a).page.total,size:i.option.size?.table,onSizeChange:e.unref(a).table.getList,onCurrentChange:e.unref(a).table.getList},i.option.page?.pagination||{},e.toHandlers(i.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),i.option.tools?.refresh===void 0||i.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["refresh-btn",[i.option.size?.search]]),onClick:p[6]||(p[6]=(...r)=>e.unref(a).table.getList&&e.unref(a).table.getList(...r))},[e.createVNode(Z)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[i.option.table?.fitHeight?"col ":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[i.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:e.unref(a).table.data,border:i.option.table?.border===void 0?!0:i.option.table?.border,onSelectionChange:e.unref(a).table.selection.change,onSortChange:e.unref(a).table.sort.change,"expand-row-keys":e.unref(a).table.expand.rowKeys,onExpandChange:e.unref(a).table.expand.change},i.option.table,e.toHandlers(i.option.table?.on||{})),{default:e.withCtx(()=>[i.option.table?.selectable||e.unref(l)(i.option.tools?.delete)||i.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof i.option.table?.selectable=="function"?i.option.table?.selectable:void 0,width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(ae,{conf:e.unref(a),columnList:e.unref(a).table.column.list,option:i.option},e.createSlots({_:2},[e.renderList(f.$slots,(r,d)=>({name:d,fn:e.withCtx(k=>[e.renderSlot(f.$slots,d,e.normalizeProps(e.guardReactiveProps(k||{})))])}))]),1032,["conf","columnList","option"]),e.unref(l)(i.option.table?.add)||e.unref(l)(i.option.table?.update)||e.unref(l)(i.option.table?.delete)||e.unref(l)(i.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:1,width:e.unref(a).table.op.width(e.unref(l)(i.option.table?.add),e.unref(l)(i.option.table?.update),e.unref(l)(i.option.table?.delete),e.unref(l)(i.option.table?.view),f.$slots["table-op-left"],f.$slots["table-op-right"]),align:"center",fixed:"right"},i.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.createVNode(e.unref(m.ElForm),{size:i.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:r}),i.option.table?.inlineEdit&&e.unref(a).inlineEdit.data===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(a).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(a).update.submit,loading:e.unref(a).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(f.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(l)(i.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:d=>e.unref(a).update.open(e.unref(c).Add,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(l)(i.option.table?.view,r)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:d=>e.unref(a).update.open(e.unref(c).View,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(l)(i.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:d=>e.unref(a).update.open(e.unref(c).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(l)(i.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:d=>e.unref(a).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-op-right",{row:r})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[g,e.unref(a).table.loading]])],2)],2),e.createElementVNode("div",ue,[(i.option.page?.show===void 0||i.option.page?.show)&&!e.unref(a).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(a).page.num,"onUpdate:currentPage":p[7]||(p[7]=r=>e.unref(a).page.num=r),"page-size":e.unref(a).page.size,"onUpdate:pageSize":p[8]||(p[8]=r=>e.unref(a).page.size=r),background:"","page-sizes":e.unref(a).page.sizeList,"pager-count":e.unref(a).page.pagerCount,layout:e.unref(a).page.layout,total:e.unref(a).page.total,size:i.option.size?.table,onSizeChange:e.unref(a).table.getList,onCurrentChange:e.unref(a).table.getList},i.option.page?.pagination||{},e.toHandlers(i.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(f.$slots,"box-right")],2),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:e.unref(a).update.show,"onUpdate:modelValue":p[9]||(p[9]=r=>e.unref(a).update.show=r),title:e.unref(a).update.title,"before-close":e.unref(a).update.close},i.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",we,[e.createVNode(e.unref(m.ElForm),{size:i.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(a).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(a).update.type!==e.unref(c).View?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(a).update.submit,loading:e.unref(a).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:s,model:e.unref(a).update.form,rules:e.unref(a).update.rules,size:i.option.size?.form},{default:e.withCtx(()=>[e.unref(a).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(a).update.formColumn,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(l)((()=>{const d=[],k=y=>{y?.item?.children?k(y.item.children):d.push(...y.map(w=>w.item?.show?.form))};return k(r),d})(),e.unref(a).update.form,e.unref(a).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:i.option.form?.stripe===void 0?!0:i.option.form?.stripe}])},[e.renderSlot(f.$slots,"form-start",{row:e.unref(a).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,d=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(l)(d.item.show?.form,e.unref(a).update.form,e.unref(a).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([d.item.form.span>0?`col-${e.unref(a).getColumnSpan(d,r)}`:"col",`form-item-col-${d.item.key}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.item.children?d.children:[d],k=>(e.openBlock(),e.createBlock(de,{key:k.item.key,conf:e.unref(a),item:k},e.createSlots({_:2},[e.renderList(f.$slots,(y,w)=>({name:w,fn:e.withCtx(V=>[e.renderSlot(f.$slots,w,e.mergeProps({ref_for:!0},V||{}))])}))]),1032,["conf","item"]))),128))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(f.$slots,"form-end",{row:e.unref(a).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules","size"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:e.unref(a).remove.show,"onUpdate:modelValue":p[10]||(p[10]=r=>e.unref(a).remove.show=r),title:e.unref(a).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Ce,[e.createVNode(e.unref(m.ElForm),{size:i.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(a).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(a).remove.submit,loading:e.unref(a).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(h).tCurd("confirmDeleteMessage",e.unref(a).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(Q,{ref_key:"switchConfirmRef",ref:t,size:i.option.size?.form},null,8,["size"])],2)}}});class Be{static async download(n,c="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",c),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,c)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),l=URL.createObjectURL(o),a=document.createElement("a");a.href=l,a.download=`${c||"config"}.json`,a.click()};static importFile=async n=>new Promise((c,o)=>{const l=document.createElement("input");l.type="file";const a=n?.accept||".json";l.accept=a,l.style.display="none",l.onchange=t=>{const s=t.target.files[0];if(!s){b.fail("未选择文件"),o("未选择文件");return}const f=new FileReader;f.onload=async p=>{const g=a==".json"?JSON.parse(p.target.result):p.target.result;c(g)},f.onerror=()=>{b.fail("文件读取失败"),o("文件读取失败")},f.readAsText(s),document.body.removeChild(l)},document.body.appendChild(l),l.click()})}const L=(i,n)=>{if(i.component("TCurd",T),i.component("TFormList",D),i.component("TColumn",$),n?.customComponent){B.customComponent=n.customComponent;for(const c in n.customComponent)i.component(c,n.customComponent[c])}},Ve={install:L};C.ArrUtil=E,C.ExcelUtil=O,C.TColumn=$,C.TCurd=T,C.TFile=Be,C.TForm=B,C.TFormConfig=u,C.TFormI18n=h,C.TFormList=D,C.TSys=b,C.default=Ve,C.install=L,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(C,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("element-plus"),require("vue-router"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue-router","vue"],m):(C=typeof globalThis<"u"?globalThis:C||self,m(C.cc1Form={},C.ElementPlus,C.VueRouter,C.Vue))})(this,(function(C,m,Ee,e){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Add:"Add",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...c)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...c):o):typeof n=="function"?n(...c):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async n=>{if(!b.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const c=await b.moduleObj[n]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(n,c,o={}){const i=Date.now();if(!this.tipMessages[n]||i-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=i;const a=Object.assign({message:n,type:c},o);m.ElMessage(a),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,c={})=>{this.showMessage(n,"error",c)};static success=(n,c={})=>{this.showMessage(n,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,c="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=m.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,c=!0)=>{if(c){let o=screen.width/2-500,i=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+i+", left="+o)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(c,o)=>{let i=document.getElementById(n.id);const a=await b.loadModule("html2canvas");try{a(i,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(t){let s=t.toDataURL("image/png");c(s)})}catch(t){o(t)}})}class u{static config={field:{page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"}},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,dropdown:{show:!0,select:!0,page:!0,all:!0},fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=n=>{u.config=ObjectUtil.deepMerge(u.config,n)}}class B{static customComponent={};static findOptions=(n,c)=>{const o=n.column.find(a=>a.key===c),i=a=>a.replace(/-([a-z])/g,(t,s)=>s.toUpperCase());if(o)return o.options[i(o.type)]};static setOptionsData=(n,c,o)=>{const i=B.findOptions(n,c);i&&(i.data=o)};static form={openBefore:{parentId:(n,c,o,i)=>{const a=u.config.table.rowKey;n?c.type===b.EDialog.Add?(c.form.parentId=n[a],c.form.sort=n.children.length+1):c.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=o.length+1),B.setOptionsData(i,"parentId",[{[a]:"0",title:"根",children:o}])}}}}function Se(r){return r}const x={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class h{static t(n,...c){if(typeof n=="function")return n(...c);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(i,a)=>o<c.length?String(c[o++]):`{${a}}`)}static setI18n=n=>{h.curd=ObjectUtil.deepMerge(h.curd,n)};static tCurd(n,...c){return this.t(this.curd[n],...c)}static curd=x}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,c,o)=>{c[n]||(c[n]=[]);const i=u.config.table.rowKey;c[n].forEach(a=>{o.forEach(t=>{let s=t.default??"";t.type==="number"&&(s=t.default??0),t.type==="boolean"&&(s=t.default??!1),t.type==="time"&&(s=t.default??new Date),a[t.value]===void 0&&(a[t.value]=s)}),a[i]||(a[i]=E.getIdFun())})};static add=(n,c,o,i)=>{const a=JSONUtil.cp(o);E.setId(n,c,o);const t=u.config.table.rowKey;c[n].push(a.reduce((s,f)=>{let p=f.default??"";return f.type==="number"&&(p=f.default??0),f.type==="boolean"&&(p=f.default??!1),f.type==="time"&&(p=f.default??new Date),s[f.value]=p,s},{[t]:E.getIdFun()})),i?.(c)};static remove=(n,c,o,i)=>{const a=u.config.table.rowKey;c[n]=c[n].filter(t=>t[a]!==o[a]),i?.(c)};static getNoIdData=(n,c)=>{const o=JSONUtil.cp(n),i=u.config.table.rowKey;return o.forEach(a=>{a[i]&&delete a[i],c&&a[c]&&E.getNoIdData(a[c],c)}),o}}const A={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},M={key:0},H={class:"row items-center",style:{gap:"10px",width:"100%"}},j={key:1},D=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:""},addBottom:{default:!1}},emits:["change"],setup(r,{emit:n}){const c=r,o=e.reactive({show:!1,add:(a,t,s)=>{E.add(a,t,s,()=>{i("change")})},remove:(a,t,s)=>{E.remove(a,t,s,()=>{i("change")})}});e.onMounted(()=>{E.setId(c.field,c.row,c.itemFields),o.show=!0});const i=n;return(a,t)=>{const s=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(a.$slots,"list-start",{row:r.row}),r.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(s,{link:"",type:"primary",onClick:t[0]||(t[0]=p=>o.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>t[3]||(t[3]=[e.createTextVNode("添加")])),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.row[r.field],p=>(e.openBlock(),e.createElementBlock("div",H,[e.renderSlot(a.$slots,"item-start",{item:p,row:r.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.itemFields,g=>(e.openBlock(),e.createBlock(f,{modelValue:p[g.value],"onUpdate:modelValue":l=>p[g.value]=l,style:e.normalizeStyle({width:r.inputWidth}),class:e.normalizeClass(r.inputClass),placeholder:g[r.label]||g[r.value],onChange:t[1]||(t[1]=l=>i("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(a.$slots,"item-end",{item:p,row:r.row}),e.createVNode(s,{link:"",type:"danger",onClick:g=>o.remove(r.field,r.row,p)},{default:e.withCtx(()=>t[4]||(t[4]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),r.addBottom?(e.openBlock(),e.createElementBlock("div",j,[e.createVNode(s,{link:"",type:"primary",onClick:t[2]||(t[2]=p=>o.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>t[5]||(t[5]=[e.createTextVNode("添加")])),_:1})])):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"list-end",{row:r.row})])):e.createCommentVNode("",!0)}}}),I={class:"row form-item-content",style:{width:"100%"}},R={class:"col"},K={class:"col"},J=["innerHTML"],$=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(r,{expose:n}){const c=b.isFun,o=b.EDialog,i=e.ref(),a=r,t=e.reactive({rules:{},show:!0,form:{},formDefault:{},type:a.type||o.Add,formColumn:[],getDisabled:s=>t.type===o.View?s.disabled?.view===void 0?!0:s.disabled?.view:s.disabled?.[t.type===o.Add?"create":"update"],getBind:s=>s.options?.[t.type===o.Add?"formAdd":"formUpdate"]?.[s.type]||s.options?.[s.type]||{},getOn:s=>s.options?.[t.type===o.Add?"formAdd":"formUpdate"]?.[s.type]?.on||s.options?.[s.type]?.on||{},getColumnSpan:(s,f)=>{if(s.item.form?.spanCol){const p=a.option.form?.maxSpan||12,g=a.option.form?.defaultSpan||p/2,d=f.filter(k=>!b.isFun(k.item.show?.form,t.form,t.type)).reduce((k,y)=>k+(y.item.form?.span||g),0);return(s.item.form?.span||g)+d}return s.item.form?.span},initColumnForm:()=>{const s=a.option;t.formColumn=[],t.rules={},t.formDefault={};const f=[],p=a.option.form?.maxSpan||12,g=a.option.form?.defaultSpan||p/2;let l=[];const d=y=>{if(y.children){y.children.forEach(w=>{d(w)});return}if(t.formDefault[y.key]=y.value,y.isForm&&(typeof y.show?.form!="boolean"||y.show?.form)){y.form=y.form||{span:g},y.form.span=y.form.span??g;const w=y.form.span,V=l.reduce((z,F)=>z+F.span,w),N=l.length;if(l.push({item:y,span:w}),(N===1&&l[0].span===0||V>=p||w===0&&N>1)&&(f.push(l),l=[]),y.rules){const z={input:h.tCurd("placeholderInput"),select:h.tCurd("placeholderSelect")},F=(z[y.type]||z.input)+y.label;t.rules[y.key]=typeof y.rules=="boolean"?[{required:!0,message:F,trigger:"blur"}]:y.rules}}},k=(y,w)=>{y.isForm=w,Array.isArray(y.children)&&y.children.forEach(V=>k(V,w))};s.column.forEach(y=>{k(y,!0),d(y)}),l.length>0&&f.push(l),t.formColumn=f,t.form=JSONUtil.cp(t.formDefault)}});return t.initColumnForm(),n({ref:i,conf:t}),(s,f)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:i,model:t.form,rules:t.rules},{default:e.withCtx(()=>[t.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.formColumn,(p,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[e.unref(c)(p.map(l=>l.item?.show?.form),t.form,t.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:r.option.form?.stripe===void 0?!0:r.option.form?.stripe}])},[e.renderSlot(s.$slots,"form-start",{row:t.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.item.key},[e.unref(c)(l.item.show?.form,t.form,t.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([l.item.form.span>0?`col-${t.getColumnSpan(l,p)}`:"col",`form-item-col-${l.item.key}`])},[e.createVNode(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof l.item.text?.form?.label=="boolean"?!l.item.text?.form?.label:!1}),label:typeof l.item.text?.form?.label=="string"?l.item.text?.form?.label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||r.option.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",I,[e.renderSlot(s.$slots,"form-"+l.item.key+"-start",{row:t.form,item:l.item}),e.createElementVNode("div",R,[e.createElementVNode("div",K,[e.renderSlot(s.$slots,"form-"+l.item.key,{row:t.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.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:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.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:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(m.ElRadioGroup),e.mergeProps({key:3,modelValue:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.radio?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:4,row:t.form,field:l.item.key,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:5,modelValue:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.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:6,modelValue:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type&&(e.unref(B).customComponent[l.item.type]||e.unref(B).customComponent[l.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[l.item.type]?.form||e.unref(B).customComponent[l.item.type]),e.mergeProps({key:7,modelValue:t.form[l.item.key],"onUpdate:modelValue":d=>t.form[l.item.key]=d,ref_for:!0},t.getBind(l.item),e.toHandlers(t.getOn(l.item)),{disabled:t.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(s.$slots,"form-"+l.item.key+"-right",{row:t.form,item:l.item})]),e.renderSlot(s.$slots,"form-"+l.item.key+"-tip",{row:t.form,item:l.item},()=>[l.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:typeof l.item.form?.tipText=="function"?l.item.form?.tipText(t.form,t.type):l.item.form?.tipText},null,8,J)):e.createCommentVNode("",!0)])]),e.renderSlot(s.$slots,"form-"+l.item.key+"-end",{row:t.form,item:l.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(s.$slots,"form-end",{row:t.form})],2)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class O{static exportToExcel=async(n,c,o)=>{if(!n||n.length===0)return;const i=await b.loadModule("xlsx"),a=n.map(f=>{const p={};return c.forEach(g=>{p[g.label]=f[g.key]}),p}),t=i.utils.json_to_sheet(a),s=i.utils.book_new();i.utils.book_append_sheet(s,t,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,i.writeFile(s,`${o}.xlsx`)}}const S=b.EDialog,W=r=>{const n=e.ref(),c=e.ref(),o=e.reactive({option:r.option,search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(i,a=h.tCurd("placeholderInput"))=>i.text?.search?.placeholder===void 0?`${a}${i.label}`:i.text?.search?.placeholder,getFormData:()=>{let i={};r.option.column.forEach(t=>{(typeof t.show?.search=="function"?t.show?.search(o.search.form):t.show?.search)&&(i[t.key]=o.search.form[t.key])});const a=r.option.search?.before?.(i);return a&&(i=a),i},reset:()=>{const i=o.search.formDefault;Object.keys(i).forEach(a=>{r.option.search?.resetMode==="none"?i[a]=void 0:i[a]=o.search.formDefault[a]}),o.search.form=JSONUtil.cp(i),o.page.num=1,r.option.init!==!1&&o.table.getList()},submit:()=>{o.page.num=1,o.table.getList()}},page:{num:1,total:0,layout:r.option.page?.layout||u.config.pagination.layout,showTools:r.option.page?.showTools||u.config.pagination.showTools,size:r.option.page?.size||u.config.pagination.size,sizeList:r.option.page?.sizeList||u.config.pagination.pageSizes,pagerCount:r.option.page?.pagerCount||u.config.pagination.pagerCount,getQuery:(i={})=>({[u.config.field.page.size]:i.size||o.page.size,[u.config.field.page.num]:i.num||o.page.num,...o.search.getFormData()})},table:{op:{width:(...i)=>i.filter(t=>t).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(i,a)=>{},all:()=>{if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const i=a=>{let t=[];return a.forEach(s=>{t.push(s[r.option.table.rowKey]),s.children&&s.children.length>0&&(t=t.concat(i(s.children)))}),t};o.table.expand.rowKeys=i(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{o.table.loading=!0;const i=r.option.api.list;try{await o.initApiData("init");let a={};if(o.table.sort.prop){const{props:d,order:k}=u.config.table.sort;a={[d.field]:o.table.sort.prop,[k.field]:o.table.sort.order}}const t=await i({...o.page.getQuery(),...a}),s=u.config.field.result,f=t.data||{[s.list]:t};let p=(Array.isArray(f[s.list]),f[s.list]);const g=o.update.formColumn.flat(),l=JSONUtil.cp(p).map(d=>(Object.keys(d).forEach(y=>{const w=g.find(V=>V.item.key===y);w&&["select","radio"].includes(w.item.type)&&(w.item.table.format||(w.item.table.format=V=>w.item.options[w.item.type].data?.find(N=>N.value==V[y])?.label||V[y]))}),d));o.table.data=r.option.data?await r.option.data(l,p):l,o.page.total=f[s.total]||0}catch(a){console.error(a)}finally{o.table.loading=!1}},selection:{list:[],change:i=>{o.table.selection.list=i}},sort:{prop:"",order:"",change:i=>{u.config.table.sort.resetPage&&(o.page.num=1);const a=u.config.table.sort;if(a.change){a.change(i,o);return}o.table.sort.prop=i.prop,i.order===null?o.table.sort.order="":o.table.sort.order=i.order==="ascending"?a.order.asc:a.order.desc,o.table.getList()}}},export:{run:{start:async i=>{let a=await o.export.run[i](),t=r.option.column;const s=JSONUtil.cp({data:a,columns:t}),f=r.option.tools?.export||{};f.before&&f.before(s),O.exportToExcel(s.data,s.columns,f.fileName)},select:async()=>{o.export.loading=!0;try{if(r.option.tools?.export?.select){await r.option.tools?.export?.select({...o.page.getQuery(),items:o.table.selection.list});return}if(o.table.selection.list.length===0)throw b.fail(h.tCurd("selectDataToExport")),new Error(h.tCurd("selectDataToExport"));return o.table.selection.list}catch(i){console.error(i)}finally{o.export.loading=!1}},page:async()=>{o.export.loading=!0;try{if(r.option.tools?.export?.page){await r.option.tools?.export?.page({...o.page.getQuery()});return}if(o.table.data.length===0)throw b.fail(h.tCurd("noData")),new Error(h.tCurd("noData"));return o.table.data}catch(i){console.error(i)}finally{o.export.loading=!1}},all:async()=>{o.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({...o.page.getQuery()});return}const i=r.option.api.list,a=await i({...o.page.getQuery({size:999999,num:1})});return(a.data||{[u.config.field.result.list]:a})[u.config.field.result.list]}catch(i){console.error(i)}finally{o.export.loading=!1}}},loading:!1,click:i=>{o.export.loading||o.export.run.start(i)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:S.Add,form:{},formDefault:{},formColumn:[],getDisabled:i=>o.update.type===S.View?i.disabled?.view===void 0?!0:i.disabled?.view:i.disabled?.[o.update.type===S.Add?"create":"update"],getBind:i=>i.options?.[o.update.type===S.Add?"formAdd":"formUpdate"]?.[i.type]||i.options?.[i.type]||{},getOn:i=>i.options?.[o.update.type===S.Add?"formAdd":"formUpdate"]?.[i.type]?.on||i.options?.[i.type]?.on||{},getOptions:i=>{try{const t=o.update.formColumn.flat().find(s=>s.item.key===i)?.item;return t?{options:t.options,bind:o.update.getBind(t)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:i=>{if(r.option.form?.editAll)return i;let a={[r.option.table?.rowKey]:o.update.edit.data[r.option.table?.rowKey]};return Object.keys(o.update.edit.data).forEach(t=>{i[t]!==o.update.edit.data[t]&&(a[t]=i[t])}),a}},view:{},open:(i,a)=>{o.update.showContent||FunUtil.throttle(async()=>{b.loading(!0);try{o.update.type=i,await o.initApiData("update");const t=i===S.Add;o.update.edit.data=a,o.update.title=h.tCurd(t?"add":i===S.View?"view":"edit"),o.update.form=JSONUtil.cp(t?o.update.formDefault:a),await r.option.form?.openBefore?.(o.update.form,o.update),!t&&r.option.table?.inlineEdit?o.inlineEdit.open(a):(o.update.show=!0,o.update.showContent=!0),r.option.form?.openAfter?.(o.update.form,o.update)}catch(t){console.error(t)}finally{b.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await c.value?.validate(async(s,f)=>new Promise((p,g)=>{s||(b.fail(h.tCurd("checkFormData")),g(!1)),p()})),o.update.loading=!0;const i=o.update.type===S.Add?r.option.api.create:r.option.api.update;try{await r.option.form?.submitBefore?.(o.update.form,o.update)}catch{o.update.loading=!1;return}let a=JSONUtil.cp(o.update.form);delete a.children;const t=new Set(r.option.column.filter(s=>s.type==="datetime").map(s=>s.key));Object.keys(a).forEach(s=>{if(t.has(s)&&a[s]!=null){const f=new Date(a[s]).getTime();isNaN(f)||(a[s]=f)}});try{if(!i)return;await i({...a}),o.update.close(),await o.table.getList(),r.option.form?.submitAfter?.(a,o.update)}catch(s){console.error(s)}finally{o.update.loading=!1}})},close:()=>{o.update.show=!1,setTimeout(()=>{o.update.showContent=!1},350)}},inlineEdit:{data:null,open:i=>{o.inlineEdit.data=i,o.update.open(S.Update,i)},close:()=>{o.inlineEdit.data=null,o.update.close()}},remove:{title:h.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{o.remove.show=!1},open:i=>{if(i.length===0){b.fail(h.tCurd("selectDataToDelete"));return}o.remove.items=i,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{o.remove.loading=!0;const i=r.option.api.delete;try{if(!i)return;await i({[r.option.table?.rowKey]:o.remove.items.map(a=>a[r.option.table?.rowKey]),items:o.remove.items}),b.success(h.tCurd("operationSuccess")),o.table.data.length<=1&&o.page.num>1&&(o.page.num-=1),o.remove.close(),await o.table.getList()}catch(a){console.error(a)}finally{o.remove.loading=!1}})}},init:()=>{o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},apiDataMap:{},initApiData:async i=>{const a=[],t=s=>{if(s.children&&s.children.length){s.children.forEach(f=>t(f));return}if(s.options?.[s.type]?.dataApi&&s.options?.[s.type]?.dataApiConfig?.[i]){if(o.apiDataMap[s.key]&&s.options?.[s.type]?.dataApiConfig?.once)return;const f=(async()=>{try{let p=await s.options?.[s.type]?.dataApi?.(o.update.form,i);if(p){const g=s.options?.[s.type]?.dataPath;g&&(p=ObjectUtil.getPathValue(p,g)),s.options[s.type].data=p,s.options.search[s.type].data=p,s.options.formAdd[s.type].data=p,s.options.formUpdate[s.type].data=p,o.apiDataMap[s.key]=p}}catch{}})();a.push(f)}};return r.option.column.forEach(s=>{t(s)}),await Promise.all(a),!0},initCurdConfig:()=>{const i=JSONUtil.cp(u.config);i.table.emptyText=h.tCurd("noData"),r.option.size=r.option.size||{},i.table.size=r.option.size.table||i.size.table,i.form.size=r.option.size.form||i.size.form,i.size.search=r.option.size.search||i.size.search;const a=ObjectUtil.deepMerge(i,r.option||{});Object.keys(a).forEach(t=>{r.option[t]=a[t]})},initColumnOptions:()=>{let i=JSONUtil.cp(u.config.columnConfig);i.options=ObjectUtil.deepMerge(i.options,{switch:{activeLabel:h.tCurd("switchOn"),inactiveLabel:h.tCurd("switchOff")}});const a=t=>{for(const s in i){if(s==="table"){if(t.table=ObjectUtil.deepMerge(i.table,t.table||{}),t.children){t.children.forEach(p=>{a(p)});return}}else s==="type"?t.type=t.type||i.type:t[s]=ObjectUtil.deepMerge(i[s],t[s]||{});t.options=t.options||{},t.options[t.type]=t.options[t.type]||{},t.options[t.type].size=r.option.size.form,["search","formAdd","formUpdate"].forEach(p=>{t.options[p]=t.options[p]||JSONUtil.cp(t.options),t.options[p][t.type]=t.options[p][t.type]||{},t.options[p][t.type].size=p==="search"?r.option.size.search:r.option.size.form}),t.table=ObjectUtil.deepMerge(t.table,t.options[t.type].table||{})}t.type==="switch"&&(t.options.switch.tableBeforeChange=async(s,f)=>{const p=t.options?.switch;try{await n.value?.open({title:h.tCurd("confirmModify"),content:h.tCurd("confirmSwitchMessage")}),o.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[r.option.table?.rowKey]:f[r.option.table?.rowKey],[s]:f[s]===p.activeValue?p.inactiveValue:p.activeValue,final(g,l,d){o.table.loading=!1}}),o.table.loading=!1,b.success(h.tCurd("operationSuccess")),o.table.getList(),!0):void 0}catch(g){return console.error(g),!1}finally{o.table.loading=!1}}catch{return!1}}),t.type==="treeSelect"&&(t.options.treeSelect.rowKey=r.option.table?.rowKey,t.options.treeSelect.nodeKey=r.option.table?.rowKey)};r.option.column.forEach(a),r.option.table?.column?.forEach(a)},getColumnSpan:(i,a)=>{if(i.item.form?.spanCol){const t=u.config.form.defaultSpan,f=a.filter(p=>!b.isFun(p.item.show?.form,o.update.form,o.update.type)).reduce((p,g)=>p+(g.item.form?.span||t),0);return(i.item?.form.span||t)+f}return i.item.form.span},initColumnForm:()=>{const i=r.option;o.update.formColumn=[],o.table.column.show={list:[],listSource:[]};const a=[],t=r.option.form?.maxSpan||12,s=r.option.form?.defaultSpan||t/2;let f=[];const p=d=>{if(d.children){o.table.column.show.list.push(d.key),d.children.forEach(k=>{p(k)});return}if(o.update.formDefault[d.key]=d.value,d.table.table&&(d.show.table&&o.table.column.show.list.push(d.key),d.table.table&&o.table.column.show.listSource.push(d.key)),!(d.isForm&&typeof d.show?.form=="boolean")||d.show?.form){d.form=d.form||{span:s},d.form.span=d.form.span??s;let k=d.form.span,y=f.reduce((V,N)=>V+N.span,k);const w=f.length;if(f.push({item:d,span:k}),(w===1&&f[0].span===0||y>=t||k===0&&w>1)&&(a.push(f),f=[]),d.rules){const V={input:h.tCurd("placeholderInput"),select:h.tCurd("placeholderSelect")},N=(V[d.type]||V.input)+d.label;o.update.rules[d.key]=typeof d.rules=="boolean"?[{required:!0,message:N,trigger:"blur"}]:d.rules}}},g=(d,k)=>{d.isForm=k,Array.isArray(d.children)&&d.children.forEach(y=>g(y,k))};i.column.forEach(d=>{d.isForm=!0,g(d,!0),p(d)}),r.option.table?.column?.forEach(d=>{g(d,!1),p(d)}),o.search.column.list=i.column.concat(i.table?.column||[]),o.table.column.list=o.search.column.list.filter(d=>d.table?.table),o.search.column.list.sort((d,k)=>d.sort?.search-k.sort?.search),o.table.column.list.sort((d,k)=>d.sort?.table-k.sort?.table),f.length>0&&a.push(f),o.update.formColumn=a;const l=r.option.search?.formDefault;l&&Object.keys(l).forEach(d=>{o.search.formDefault[d]=l[d]}),i.column.forEach(d=>{d.show?.search||(o.search.formDefault[d.key]=void 0)}),o.search.form=JSONUtil.cp(o.search.formDefault)}});return o.init(),e.onMounted(()=>{r.option.init!==!1&&o.table.getList()}),{conf:o,switchConfirmRef:n,ruleFormRef:c}},q={class:"dialog-footer"},Q=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(r,{expose:n}){const c=e.ref(!1),o=e.ref("确认修改"),i=e.ref("确认要修改状态吗?");let a=null,t=null;const s=g=>(g?.title&&(o.value=g.title),g?.content&&(i.value=g.content),c.value=!0,new Promise((l,d)=>{a=l,t=d})),f=()=>{c.value=!1,a?.(!0),a=null,t=null},p=()=>{c.value=!1,t?.(new Error("用户取消操作")),a=null,t=null};return n({open:s}),(g,l)=>{const d=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:c.value,"onUpdate:modelValue":l[0]||(l[0]=k=>c.value=k),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(d,{size:g.size},{default:e.withCtx(()=>[e.createElementVNode("span",q,[e.createVNode(e.unref(m.ElButton),{onClick:p},{default:e.withCtx(()=>l[1]||(l[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:f},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(i.value),1)]),_:1},8,["modelValue","title"])}}}),U=(r,n)=>{const c=r.__vccOpts||r;for(const[o,i]of n)c[o]=i;return c},G={},X={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Y(r,n){return e.openBlock(),e.createElementBlock("svg",X,n[0]||(n[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 Z=U(G,[["render",Y]]),P={},_={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function v(r,n){return e.openBlock(),e.createElementBlock("svg",_,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)]))}const ee=U(P,[["render",v]]),te={class:"row flex-center table-header-label inline"},oe={class:"table-header-tooltip"},ne=["onClick","innerHTML"],ae=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(r){const n=b.isFun,c=e.getCurrentInstance().type;return(o,i)=>{const a=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.key},[o.conf.table.column.show.list.includes(t.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:t.key,label:t.label,ref_for:!0},t.table),{header:e.withCtx(()=>[e.renderSlot(o.$slots,"table-header-"+t.key,{item:t},()=>[e.createElementVNode("div",te,[t.table?.tooltip?(e.openBlock(),e.createBlock(a,{key:0,effect:"dark",content:t.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",oe,[e.createVNode(ee)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(t.label),1)])])]),default:e.withCtx(({row:s})=>[t.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i[0]||(i[0]=e.createTextVNode("   ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(c)),{conf:o.conf,columnList:t.children,option:o.option},e.createSlots({_:2},[e.renderList(o.$slots,(f,p)=>({name:p,fn:e.withCtx(g=>[e.renderSlot(o.$slots,p,e.mergeProps({ref_for:!0},g||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(t.show?.form,o.conf.update.form,e.unref(b).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.data===s&&(t.type==="input"||t.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[t.key],"onUpdate:modelValue":f=>o.conf.update.form[t.key]=f,ref_for:!0},o.conf.update.getBind(t),e.toHandlers(o.conf.update.getOn(t)),{style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:o.conf.update.form[t.key],"onUpdate:modelValue":f=>o.conf.update.form[t.key]=f,ref_for:!0},o.conf.update.getBind(t),e.toHandlers(o.conf.update.getOn(t)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options?.search?.select?.data||t.options?.select?.data,f=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(o.$slots,"table-"+t.key,{key:1,row:s,item:t},()=>[e.unref(B).customComponent[t.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[t.type??""]?.table),e.mergeProps({key:0,modelValue:s[t.key],"onUpdate:modelValue":f=>s[t.key]=f,ref_for:!0},t.options?.[t.type??""],e.toHandlers(t.options?.[t.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:s[t.key],"onUpdate:modelValue":f=>s[t.key]=f,"before-change":()=>t.options?.switch?.tableBeforeChange?.(t.key,s),ref_for:!0},t.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":t.table?.click?.color}),class:e.normalizeClass({"table-text-click":t.table?.click?.callback}),onClick:f=>t.table?.click?.callback?.(s),innerHTML:t.table?.format?t.table?.format(s):s[t.key]},null,14,ne))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),le={class:"row form-item-content",style:{width:"100%"}},re={class:"col column form-item-content-item"},ie={class:"col"},se=["innerHTML"],de=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(r){return(n,c)=>(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof n.item.item.text?.form?.label=="boolean"?!n.item.item.text?.form?.label:!1}),label:typeof n.item.item.text?.form?.label=="string"?n.item.item.text?.form?.label:n.item.item.label,prop:n.item.item.key,"label-width":n.item.item.form?.labelWidth||n.conf.option.form?.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.renderSlot(n.$slots,"form-"+n.item.item.key+"-start",{row:n.conf.update.form,item:n.item.item}),e.createElementVNode("div",re,[e.createElementVNode("div",ie,[e.renderSlot(n.$slots,"form-"+n.item.item.key,{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[0]||(c[0]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[1]||(c[1]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[2]||(c[2]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.conf.update.getBind(n.item.item).data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(m.ElRadioGroup),e.mergeProps({key:3,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[3]||(c[3]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.conf.update.getBind(n.item.item).data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:4,row:n.conf.update.form,field:n.item.item.key},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:5,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[4]||(c[4]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):n.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:6,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[5]||(c[5]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type&&(e.unref(B).customComponent[n.item.item.type]||e.unref(B).customComponent[n.item.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[n.item.item.type]?.form||e.unref(B).customComponent[n.item.item.type]),e.mergeProps({key:7,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":c[6]||(c[6]=o=>n.conf.update.form[n.item.item.key]=o)},n.conf.update.getBind(n.item.item),e.toHandlers(n.conf.update.getOn(n.item.item)),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-right",{row:n.conf.update.form,item:n.item.item})]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-tip",{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:typeof n.item.item.form?.tipText=="function"?n.item.item.form?.tipText(n.conf.update.form,n.conf.update.type):n.item.item.form?.tipText},null,8,se)):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-end",{row:n.conf.update.form,item:n.item.item})])]),_:3},8,["class","label","prop","label-width"]))}}),ce={key:0,class:"relative curd-search fit-width"},fe={class:"mb-10 flex justify-between items-center fit-width"},pe={class:"flex items-center",style:{gap:"10px"}},me={key:0},he={key:1},ge={key:2},ye={class:"export-btn"},ke={key:1,class:"export-btn"},be={class:"flex items-center table-tools-right",style:{gap:"10px"}},ue={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},we={class:"dialog-footer"},Ce={class:"dialog-footer"},T=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(r,{expose:n}){const c=b.EDialog,o=r,i=b.isFun,{conf:a,switchConfirmRef:t,ruleFormRef:s}=W(o);return n({conf:a}),(f,p)=>{const g=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[r.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[r.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(f.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[r.option.table?.fitHeight?"col":""]])},[r.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(e.unref(m.ElForm),{model:e.unref(a).search.form,inline:"",size:r.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(a).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).search.column.list,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[(typeof l.show?.search=="function"?l.show?.search(e.unref(a).search.form):l.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof l.text?.search?.label=="string"?l.text?.search?.label:l.label,class:e.normalizeClass({"hide-label":typeof l.text?.search?.label=="boolean"?!l.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+l.key,{row:e.unref(a).search.form},()=>[l.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(a).search.form[l.key],"onUpdate:modelValue":d=>e.unref(a).search.form[l.key]=d,placeholder:e.unref(a).search.getPlaceholder(l),clearable:"",disabled:l.disabled?.search,ref_for:!0},l.options?.search?.input||l.options?.input,e.toHandlers(l.options?.search?.input?.on||l.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(a).search.form[l.key],"onUpdate:modelValue":d=>e.unref(a).search.form[l.key]=d,placeholder:e.unref(a).search.getPlaceholder(l,e.unref(h).tCurd("placeholderSelect")),clearable:"",disabled:l.disabled?.search,ref_for:!0},l.options?.search?.switch||l.options?.switch,e.toHandlers(l.options?.search?.switch?.on||l.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:l.options?.switch?.activeValue,label:l.options?.switch?.activeLabel,value:l.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:l.options?.switch?.inactiveValue,label:l.options?.switch?.inactiveLabel,value:l.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(a).search.form[l.key],"onUpdate:modelValue":d=>e.unref(a).search.form[l.key]=d,placeholder:e.unref(a).search.getPlaceholder(l,e.unref(h).tCurd("placeholderSelect")),clearable:"",disabled:l.disabled?.search,ref_for:!0},l.options?.search?.select||l.options?.select,e.toHandlers(l.options?.search?.select?.on||l.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):l.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(a).search.form[l.key],"onUpdate:modelValue":d=>e.unref(a).search.form[l.key]=d,disabled:l.disabled?.search,ref_for:!0},l.options?.search?.datetime||l.options?.datetime,e.toHandlers(l.options?.search?.datetime?.on||l.options?.datetime?.on||{})),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.type&&e.unref(B).customComponent[l.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[l.type]),e.mergeProps({key:4,modelValue:e.unref(a).search.form[l.key],"onUpdate:modelValue":d=>e.unref(a).search.form[l.key]=d,ref_for:!0},l.options?.search?.[l.type]||l.options?.[l.type],e.toHandlers(l.options?.search?.[l.type]?.on||l.options?.[l.type]?.on||{}),{disabled:l.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(f.$slots,"search-"+l.key+"-right",{row:e.unref(a).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(a).search.form}),r.option.tools?.search||r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0},{default:e.withCtx(()=>[r.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(a).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:e.unref(a).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(a).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",fe,[e.createElementVNode("div",pe,[e.unref(i)(r.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",me,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:p[0]||(p[0]=l=>e.unref(a).update.open(e.unref(c).Add)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.table?.selectable&&e.unref(i)(r.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:p[1]||(p[1]=l=>e.unref(a).remove.open(e.unref(a).table.selection.list)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:p[2]||(p[2]=l=>e.unref(a).table.expand.all()),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[r.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:0,onCommand:e.unref(a).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[r.option.tools?.export?.dropdown?.select&&(r.option.table?.selectable||e.unref(i)(r.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),r.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),r.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:2,command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportAll")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",ye,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(a).export.loading,size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(a).export.loading,size:r.option.size?.search,onClick:p[3]||(p[3]=l=>e.unref(a).export.run.start("all"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("export")),1)]),_:1},8,["loading","size"])]))],64)):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",be,[e.renderSlot(f.$slots,"tools-right"),e.unref(a).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(a).page.num,"onUpdate:currentPage":p[4]||(p[4]=l=>e.unref(a).page.num=l),"page-size":e.unref(a).page.size,"onUpdate:pageSize":p[5]||(p[5]=l=>e.unref(a).page.size=l),background:"","page-sizes":e.unref(a).page.sizeList,"pager-count":e.unref(a).page.pagerCount,layout:e.unref(a).page.layout,total:e.unref(a).page.total,size:r.option.size?.table,onSizeChange:e.unref(a).table.getList,onCurrentChange:e.unref(a).table.getList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),r.option.tools?.refresh===void 0||r.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:p[6]||(p[6]=(...l)=>e.unref(a).table.getList&&e.unref(a).table.getList(...l))},[e.createVNode(Z)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[r.option.table?.fitHeight?"col ":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[r.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:e.unref(a).table.data,border:r.option.table?.border===void 0?!0:r.option.table?.border,onSelectionChange:e.unref(a).table.selection.change,onSortChange:e.unref(a).table.sort.change,"expand-row-keys":e.unref(a).table.expand.rowKeys,onExpandChange:e.unref(a).table.expand.change},r.option.table,e.toHandlers(r.option.table?.on||{})),{default:e.withCtx(()=>[(typeof r.option.table?.selectable=="object"?r.option.table?.selectable?.show:r.option.table?.selectable)||e.unref(i)(r.option.tools?.delete)||r.option.tools?.export?.show&&r.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof r.option.table?.selectable=="object"?r.option.table?.selectable:{},e.toHandlers(typeof r.option.table?.selectable=="object"?r.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.createVNode(ae,{conf:e.unref(a),columnList:e.unref(a).table.column.list,option:r.option},e.createSlots({_:2},[e.renderList(f.$slots,(l,d)=>({name:d,fn:e.withCtx(k=>[e.renderSlot(f.$slots,d,e.normalizeProps(e.guardReactiveProps(k||{})))])}))]),1032,["conf","columnList","option"]),e.unref(i)(r.option.table?.add)||e.unref(i)(r.option.table?.update)||e.unref(i)(r.option.table?.delete)||e.unref(i)(r.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:1,width:e.unref(a).table.op.width(e.unref(i)(r.option.table?.add),e.unref(i)(r.option.table?.update),e.unref(i)(r.option.table?.delete),e.unref(i)(r.option.table?.view),f.$slots["table-op-left"],f.$slots["table-op-right"]),align:"center",fixed:"right"},r.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("operation")),1)])]),default:e.withCtx(({row:l})=>[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:l}),r.option.table?.inlineEdit&&e.unref(a).inlineEdit.data===l?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(a).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(a).update.submit,loading:e.unref(a).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(f.$slots,"table-op-edit-right",{row:l})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(r.option.table?.add,l)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:d=>e.unref(a).update.open(e.unref(c).Add,l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(r.option.table?.view,l)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:d=>e.unref(a).update.open(e.unref(c).View,l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(r.option.table?.update,l)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:d=>e.unref(a).update.open(e.unref(c).Update,l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(r.option.table?.delete,l)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:d=>e.unref(a).remove.open([l])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-op-right",{row:l})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[g,e.unref(a).table.loading]])],2)],2),e.createElementVNode("div",ue,[(r.option.page?.show===void 0||r.option.page?.show)&&!e.unref(a).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(a).page.num,"onUpdate:currentPage":p[7]||(p[7]=l=>e.unref(a).page.num=l),"page-size":e.unref(a).page.size,"onUpdate:pageSize":p[8]||(p[8]=l=>e.unref(a).page.size=l),background:"","page-sizes":e.unref(a).page.sizeList,"pager-count":e.unref(a).page.pagerCount,layout:e.unref(a).page.layout,total:e.unref(a).page.total,size:r.option.size?.table,onSizeChange:e.unref(a).table.getList,onCurrentChange:e.unref(a).table.getList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(f.$slots,"box-right")],2),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:e.unref(a).update.show,"onUpdate:modelValue":p[9]||(p[9]=l=>e.unref(a).update.show=l),title:e.unref(a).update.title,"before-close":e.unref(a).update.close},r.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",we,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(a).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(a).update.type!==e.unref(c).View?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(a).update.submit,loading:e.unref(a).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:s,model:e.unref(a).update.form,rules:e.unref(a).update.rules,size:r.option.size?.form},{default:e.withCtx(()=>[e.unref(a).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(a).update.formColumn,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)((()=>{const d=[],k=y=>{y?.item?.children?k(y.item.children):d.push(...y.map(w=>w.item?.show?.form))};return k(l),d})(),e.unref(a).update.form,e.unref(a).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:r.option.form?.stripe===void 0?!0:r.option.form?.stripe}])},[e.renderSlot(f.$slots,"form-start",{row:e.unref(a).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,d=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(d.item.show?.form,e.unref(a).update.form,e.unref(a).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([d.item.form.span>0?`col-${e.unref(a).getColumnSpan(d,l)}`:"col",`form-item-col-${d.item.key}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.item.children?d.children:[d],k=>(e.openBlock(),e.createBlock(de,{key:k.item.key,conf:e.unref(a),item:k},e.createSlots({_:2},[e.renderList(f.$slots,(y,w)=>({name:w,fn:e.withCtx(V=>[e.renderSlot(f.$slots,w,e.mergeProps({ref_for:!0},V||{}))])}))]),1032,["conf","item"]))),128))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(f.$slots,"form-end",{row:e.unref(a).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules","size"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:e.unref(a).remove.show,"onUpdate:modelValue":p[10]||(p[10]=l=>e.unref(a).remove.show=l),title:e.unref(a).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Ce,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(a).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(a).remove.submit,loading:e.unref(a).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(h).tCurd("confirmDeleteMessage",e.unref(a).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(Q,{ref_key:"switchConfirmRef",ref:t,size:r.option.size?.form},null,8,["size"])],2)}}});class Be{static async download(n,c="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",c),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,c)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),i=URL.createObjectURL(o),a=document.createElement("a");a.href=i,a.download=`${c||"config"}.json`,a.click()};static importFile=async n=>new Promise((c,o)=>{const i=document.createElement("input");i.type="file";const a=n?.accept||".json";i.accept=a,i.style.display="none",i.onchange=t=>{const s=t.target.files[0];if(!s){b.fail("未选择文件"),o("未选择文件");return}const f=new FileReader;f.onload=async p=>{const g=a==".json"?JSON.parse(p.target.result):p.target.result;c(g)},f.onerror=()=>{b.fail("文件读取失败"),o("文件读取失败")},f.readAsText(s),document.body.removeChild(i)},document.body.appendChild(i),i.click()})}const L=(r,n)=>{if(r.component("TCurd",T),r.component("TFormList",D),r.component("TColumn",$),n?.customComponent){B.customComponent=n.customComponent;for(const c in n.customComponent)r.component(c,n.customComponent[c])}},Ve={install:L};C.ArrUtil=E,C.ExcelUtil=O,C.TColumn=$,C.TCurd=T,C.TFile=Be,C.TForm=B,C.TFormConfig=u,C.TFormI18n=h,C.TFormList=D,C.TSys=b,C.default=Ve,C.install=L,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -44,7 +44,11 @@ export declare const curdConf: (props: {
44
44
  table?: {
45
45
  rowKey?: string | undefined;
46
46
  border?: boolean | undefined;
47
- selectable?: boolean | ((data: any) => boolean) | undefined;
47
+ selectable?: boolean | ((data: any) => boolean) | {
48
+ [x: string]: any;
49
+ show?: boolean | ((data: any) => boolean) | undefined;
50
+ on?: any;
51
+ } | undefined;
48
52
  column?: {
49
53
  key: string;
50
54
  label: string;
@@ -465,12 +469,10 @@ export declare const curdConf: (props: {
465
469
  maxSpan?: number | undefined;
466
470
  defaultSpan?: number | undefined;
467
471
  openBefore?: ((data: any, update: curdConfType["conf"]["update"]) => any) | undefined;
468
- openAfter?: ((data: any, update:
469
- /** 表格多选相关配置 */
470
- curdConfType["conf"]["update"]) => any) | undefined;
472
+ openAfter?: ((data: any, update: curdConfType["conf"]["update"]) => any) | undefined;
471
473
  closeBefore?: ((data: any) => any) | undefined;
472
474
  submitBefore?: ((form: any, update: curdConfType["conf"]["update"]) => any) | undefined;
473
- submitAfter?: ((form: any, update: curdConfType["conf"] /** 当前排序顺序值 */["update"]) => any) | undefined;
475
+ submitAfter?: ((form: any, update: curdConfType["conf"]["update"]) => any) | undefined;
474
476
  } | undefined;
475
477
  column: {
476
478
  key: string;
@@ -48,7 +48,11 @@ declare const conf: {
48
48
  table?: {
49
49
  rowKey?: string | undefined;
50
50
  border?: boolean | undefined;
51
- selectable?: boolean | ((data: any) => boolean) | undefined;
51
+ selectable?: boolean | ((data: any) => boolean) | {
52
+ [x: string]: any;
53
+ show?: boolean | ((data: any) => boolean) | undefined;
54
+ on?: any;
55
+ } | undefined;
52
56
  column?: {
53
57
  key: string;
54
58
  label: string;
@@ -2595,7 +2599,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
2595
2599
  table?: {
2596
2600
  rowKey?: string | undefined;
2597
2601
  border?: boolean | undefined;
2598
- selectable?: boolean | ((data: any) => boolean) | undefined;
2602
+ selectable?: boolean | ((data: any) => boolean) | {
2603
+ [x: string]: any;
2604
+ show?: boolean | ((data: any) => boolean) | undefined;
2605
+ on?: any;
2606
+ } | undefined;
2599
2607
  column?: {
2600
2608
  key: string;
2601
2609
  label: string;
@@ -159,7 +159,13 @@ export interface CurdConfig<T = any> {
159
159
  * 是否可多选 - 通过conf.table.selection.list获取已选数据
160
160
  * 默认不显示
161
161
  */
162
- selectable: ((data: T) => boolean) | boolean;
162
+ selectable: Partial<{
163
+ [key: string]: any;
164
+ /** 是否显示选择 */
165
+ show: ((data: T) => boolean) | boolean;
166
+ /** 选择事件 */
167
+ on: any;
168
+ }> | ((data: T) => boolean) | boolean;
163
169
  /**
164
170
  * 额外的表格列信息,可配置是否可搜索,不参与新增编辑表单
165
171
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.1.43",
3
+ "version": "1.2.0",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",