cc1-form 1.1.37 → 1.1.39
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.
- package/dist/cc1-form.js +1157 -1085
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +1485 -183
- package/dist/components/TCurd/com/form/list.vue.d.ts +2 -2
- package/dist/components/TCurd/formColumn.vue.d.ts +690 -40
- package/dist/components/TCurd/index.d.ts +709 -77
- package/dist/components/TCurd/index.vue.d.ts +1643 -259
- package/dist/components/TCurd/indexType.d.ts +16 -39
- package/dist/components/TCurd/tableColumn.vue.d.ts +2 -2
- package/dist/utils/TSys.d.ts +1 -1
- package/package.json +1 -1
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,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):(u=typeof globalThis<"u"?globalThis:u||self,m(u.cc1Form={},u.ElementPlus,u.VueRouter,u.Vue))})(this,(function(u,m,be,e){"use strict";class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...d)=>Array.isArray(n)?n.some(t=>typeof t=="function"?t(...d):t):typeof n=="function"?n(...d):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async n=>{if(!k.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const d=await k.moduleObj[n]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(n,d,t={}){const a=Date.now();if(!this.tipMessages[n]||a-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=a;const o=Object.assign({message:n,type:d},t);m.ElMessage(o),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,d={})=>{this.showMessage(n,"error",d)};static success=(n,d={})=>{this.showMessage(n,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,d="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,d=!0)=>{if(d){let t=screen.width/2-500,a=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="+a+", left="+t)}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(d,t)=>{let a=document.getElementById(n.id);const o=await k.loadModule("html2canvas");try{o(a,{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(l){let s=l.toDataURL("image/png");d(s)})}catch(l){t(l)}})}class b{static config={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,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=>{b.config=ObjectUtil.deepMerge(b.config,n)}}class V{static customComponent={};static findOptions=(n,d)=>{const t=n.column.find(o=>o.key===d),a=o=>o.replace(/-([a-z])/g,(l,s)=>s.toUpperCase());if(t)return t.options[a(t.type)]};static setOptionsData=(n,d,t)=>{const a=V.findOptions(n,d);a&&(a.data=t)};static form={openBefore:{parentId:(n,d,t,a)=>{const o=b.config.table.rowKey;n?d.type===k.EDialog.Insert?(d.form.parentId=n[o],d.form.sort=n.children.length+1):d.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=t.length+1),V.setOptionsData(a,"parentId",[{[o]:"0",title:"根",children:t}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,d,t)=>{d[n]||(d[n]=[]);const a=b.config.table.rowKey;d[n].forEach(o=>{t.forEach(l=>{let s=l.default??"";l.type==="number"&&(s=l.default??0),l.type==="boolean"&&(s=l.default??!1),l.type==="time"&&(s=l.default??new Date),o[l.value]===void 0&&(o[l.value]=s)}),o[a]||(o[a]=E.getIdFun())})};static add=(n,d,t,a)=>{const o=JSONUtil.cp(t);E.setId(n,d,t);const l=b.config.table.rowKey;d[n].push(o.reduce((s,f)=>{let h=f.default??"";return f.type==="number"&&(h=f.default??0),f.type==="boolean"&&(h=f.default??!1),f.type==="time"&&(h=f.default??new Date),s[f.value]=h,s},{[l]:E.getIdFun()})),a?.(d)};static remove=(n,d,t,a)=>{const o=b.config.table.rowKey;d[n]=d[n].filter(l=>l[o]!==t[o]),a?.(d)};static getNoIdData=(n,d)=>{const t=JSONUtil.cp(n),a=b.config.table.rowKey;return t.forEach(o=>{o[a]&&delete o[a],d&&o[d]&&E.getNoIdData(o[d],d)}),t}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},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:""}},emits:["change"],setup(r,{emit:n}){const d=r,t=e.reactive({show:!1,add:(o,l,s)=>{E.add(o,l,s,()=>{a("change")})},remove:(o,l,s)=>{E.remove(o,l,s,()=>{a("change")})}});e.onMounted(()=>{E.setId(d.field,d.row,d.itemFields),t.show=!0});const a=n;return(o,l)=>{const s=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return t.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(o.$slots,"list-start",{row:r.row}),e.createElementVNode("div",null,[e.createVNode(s,{link:"",type:"primary",onClick:l[0]||(l[0]=h=>t.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加")])),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.row[r.field],h=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(o.$slots,"item-start",{item:h,row:r.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.itemFields,c=>(e.openBlock(),e.createBlock(f,{modelValue:h[c.value],"onUpdate:modelValue":i=>h[c.value]=i,style:e.normalizeStyle({width:r.inputWidth}),class:e.normalizeClass(r.inputClass),placeholder:c[r.label]||c[r.value],onChange:l[1]||(l[1]=i=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(o.$slots,"item-end",{item:h,row:r.row}),e.createVNode(s,{link:"",type:"danger",onClick:c=>t.remove(r.field,r.row,h)},{default:e.withCtx(()=>l[3]||(l[3]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),e.renderSlot(o.$slots,"list-end",{row:r.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},z=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(r,{expose:n}){const d=k.isFun,t=k.EDialog,a=e.ref(),o=r,l=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:s=>s.disabled?.[(o.type||t.Insert)===t.Insert?"create":"update"],initColumnForm:async()=>{const s=o.option;l.formColumn=[];const f=[],h=o.option.form?.maxSpan||12,c=o.option.form?.defaultSpan||h;let i=[];const p=y=>{if(l.formDefault[y.key]=y.value,y.isForm){y.form=y.form||{span:c},y.form.span=y.form.span??c;let w=y.form.span,C=i.reduce((S,ye)=>S+ye.span,w);const B=i.length;i.push({item:y,span:w}),(B===1&&i[0].span===0||C>=h||w===0&&B>1)&&(f.push(i),i=[]),y.rules&&(l.rules[y.key]=y.rules)}};s.column.forEach(y=>{y.isForm=!0,p(y)}),i.length>0&&f.push(i),l.formColumn=f,l.form=JSONUtil.cp(l.formDefault)},init:async()=>{l.show=!1,await e.nextTick(),l.initColumnForm()}});return l.initColumnForm(),n({ref:a,conf:l}),(s,f)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:a,model:l.form,rules:l.rules},{default:e.withCtx(()=>[l.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.formColumn,h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(s.$slots,"form-start",{row:l.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(c.item.show?.form,l.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"form-"+c.item.key+"-start",{row:l.form,item:c.item}),e.renderSlot(s.$slots,"form-"+c.item.key,{row:l.form,item:c.item},()=>[c.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.input,e.toHandlers(c.item.options?.input?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.switch,e.toHandlers(c.item.options?.switch?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.select,e.toHandlers(c.item.options?.select?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.item.options?.select?.data,i=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:3,row:l.form,field:c.item.key,ref_for:!0},c.item.options?.list,e.toHandlers(c.item.options?.list?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):c.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.treeSelect,e.toHandlers(c.item.options?.treeSelect?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.datetime,e.toHandlers(c.item.options?.datetime?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type&&e.unref(V).customComponent[c.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[c.item.type]),e.mergeProps({key:6,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.[c.item.type],e.toHandlers(c.item.options?.[c.item.type]?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(s.$slots,"form-"+c.item.key+"-end",{row:l.form,item:c.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(s.$slots,"form-end",{row:l.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function ke(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 g{static t(n,...d){if(typeof n=="function")return n(...d);n=String(n);let t=0;return n.replace(/{([^}]+)}/g,(a,o)=>t<d.length?String(d[t++]):`{${o}}`)}static setI18n=n=>{g.curd=ObjectUtil.deepMerge(g.curd,n)};static tCurd(n,...d){return this.t(this.curd[n],...d)}static curd=x}class F{static exportToExcel=async(n,d,t)=>{if(!n||n.length===0)return;const a=await k.loadModule("xlsx"),o=n.map(f=>{const h={};return d.forEach(c=>{h[c.label]=f[c.key]}),h}),l=a.utils.json_to_sheet(o),s=a.utils.book_new();a.utils.book_append_sheet(s,l,"Sheet1"),t?typeof t=="function"&&(t=t()):t=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(s,`${t}.xlsx`)}}const N=k.EDialog,M=r=>{const n=e.ref(),d=e.ref(),t=e.reactive({option:r.option,search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,o=g.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${o}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(a[l.key]=t.search.form[l.key])});const o=r.option.search?.before?.(a);return o&&(a=o),a},reset:()=>{const a=t.search.formDefault;Object.keys(a).forEach(o=>{r.option.search?.resetMode==="none"?a[o]=void 0:a[o]=t.search.formDefault[o]}),t.search.form=JSONUtil.cp(a),t.page.num=1,r.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{num:1,total:0,layout:r.option.page?.layout||b.config.pagination.layout,showTools:r.option.page?.showTools||b.config.pagination.showTools,size:r.option.page?.size||b.config.pagination.size,sizeList:r.option.page?.sizeList||b.config.pagination.pageSizes,pagerCount:r.option.page?.pagerCount||b.config.pagination.pagerCount},table:{op:{width:(...a)=>a.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,o)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const a=o=>{let l=[];return o.forEach(s=>{l.push(s[r.option.table.rowKey]),s.children&&s.children.length>0&&(l=l.concat(a(s.children)))}),l};t.table.expand.rowKeys=a(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const a=r.option.api.list;try{await t.initApiData("init");let o={};if(t.table.sort.prop){const{props:p,order:y}=b.config.table.sort;o={[p.field]:t.table.sort.prop,[y.field]:t.table.sort.order}}const l=await a({[b.config.page.size]:t.page.size,[b.config.page.num]:t.page.num,...t.search.getFormData(),...o}),s=b.config.result,f=l.data||{[s.list]:l};let h=(Array.isArray(f[s.list]),f[s.list]);const c=t.update.formColumn.flat(),i=JSONUtil.cp(h).map(p=>(Object.keys(p).forEach(w=>{const C=c.find(B=>B.item.key===w);C&&["select","radio"].includes(C.item.type)&&(C.item.table.format||(C.item.table.format=B=>C.item.options[C.item.type].data?.find(S=>S.value==B[w])?.label||B[w]))}),p));t.table.data=r.option.data?await r.option.data(i,h):i,t.page.total=f[s.total]||0}catch(o){console.error(o)}finally{t.table.loading=!1}},selection:{list:[],change:a=>{t.table.selection.list=a}},sort:{prop:"",order:"",change:a=>{b.config.table.sort.resetPage&&(t.page.num=1);const o=b.config.table.sort;if(o.change){o.change(a,t);return}t.table.sort.prop=a.prop,a.order===null?t.table.sort.order="":t.table.sort.order=a.order==="ascending"?o.order.asc:o.order.desc,t.table.getList()}}},export:{run:{start:async a=>{let o=await t.export.run[a](),l=r.option.column;const s=JSONUtil.cp({data:o,columns:l}),f=r.option.tools?.export||{};f.before&&f.before(s),F.exportToExcel(s.data,s.columns,f.fileName)},select:()=>{if(t.table.selection.list.length===0)throw k.fail(g.tCurd("selectDataToExport")),new Error(g.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw k.fail(g.tCurd("noData")),new Error(g.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[b.config.page.size]:t.page.size,[b.config.page.num]:t.page.num,...t.search.getFormData()});return}const a=r.option.api.list,o=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(o.data||{[b.config.result.list]:o})[b.config.result.list]}catch(a){console.error(a)}finally{t.export.loading=!1}}},loading:!1,click:a=>{t.export.loading||t.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>t.update.type===N.View?a.disabled?.view===void 0?!0:a.disabled?.view:a.disabled?.[t.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(r.option.form?.editAll)return a;let o={[r.option.table?.rowKey]:t.update.edit.data[r.option.table?.rowKey]};return Object.keys(t.update.edit.data).forEach(l=>{a[l]!==t.update.edit.data[l]&&(o[l]=a[l])}),o}},view:{},open:(a,o)=>{t.update.showContent||FunUtil.throttle(async()=>{k.loading(!0);try{await t.initApiData("update");const l=a===N.Insert;if(!l&&r.option.table?.inlineEdit){t.inlineEdit.open(o);return}t.update.type=a,t.update.edit.data=o,t.update.title=g.tCurd(l?"add":a===N.View?"view":"edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:o),await r.option.form?.openBefore?.(o,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(o,t.update)}catch(l){console.error(l)}finally{k.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await d.value?.validate(async(s,f)=>new Promise((h,c)=>{s||(k.fail(g.tCurd("checkFormData")),c(!1)),h()})),t.update.loading=!0;const a=t.update.type===N.Insert?r.option.api.create:r.option.api.update;try{await r.option.form?.submitBefore?.(t.update.form,t.update)}catch{t.update.loading=!1;return}let o=JSONUtil.cp(t.update.form);delete o.children;const l=new Set(r.option.column.filter(s=>s.type==="datetime").map(s=>s.key));Object.keys(o).forEach(s=>{if(l.has(s)&&o[s]!=null){const f=new Date(o[s]).getTime();isNaN(f)||(o[s]=f)}});try{if(!a)return;await a({...o}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(o,t.update)}catch(s){console.error(s)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{t.inlineEdit.row=a,t.inlineEdit.form=JSONUtil.cp(a)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const a=r.option.api.update;let o=JSONUtil.cp(t.inlineEdit.form);delete o.children;try{if(!a)return;await a({...o}),t.inlineEdit.close(),await t.table.getList(),k.success(g.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:g.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:a=>{if(a.length===0){k.fail(g.tCurd("selectDataToDelete"));return}t.remove.items=a,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const a=r.option.api.delete;try{if(!a)return;await a({[r.option.table?.rowKey]:t.remove.items.map(o=>o[r.option.table?.rowKey]),items:t.remove.items}),k.success(g.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(o){console.error(o)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},apiDataMap:{},initApiData:async a=>{const o=[],l=s=>{if(s.children&&s.children.length){s.children.forEach(f=>l(f));return}if(s.type==="select"&&s.options?.select?.dataApi&&s.options?.select?.dataApiConfig?.[a]){if(t.apiDataMap[s.key]&&s.options?.select?.dataApiConfig?.once)return;const f=(async()=>{try{let h=await s.options?.select?.dataApi?.();if(h){const c=s.options?.select?.dataPath;c&&(h=ObjectUtil.getPathValue(h,c)),s.options.select.data=h,t.apiDataMap[s.key]=h}}catch{}})();o.push(f)}};return r.option.column.forEach(s=>{l(s)}),await Promise.all(o),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=g.tCurd("noData"),r.option.size=r.option.size||{},a.table.size=r.option.size.table||a.size.table,a.form.size=r.option.size.form||a.size.form,a.size.search=r.option.size.search||a.size.search;const o=ObjectUtil.deepMerge(a,r.option||{});Object.keys(o).forEach(l=>{r.option[l]=o[l]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:g.tCurd("switchOn"),inactiveLabel:g.tCurd("switchOff")}});const o=l=>{for(const s in a){if(s==="table"){if(l.table=ObjectUtil.deepMerge(a.table,l.table||{}),l.children){l.children.forEach(f=>{o(f)});return}}else s==="type"?l.type=l.type||a.type:l[s]=ObjectUtil.deepMerge(a[s],l[s]||{});l.options=l.options||{},l.options[l.type]=l.options[l.type]||{},l.options[l.type].size=r.option.size.form,l.options.search=l.options.search||JSONUtil.cp(l.options),l.options.search[l.type]=l.options.search[l.type]||{},l.options.search[l.type].size=r.option.size.search,l.table=ObjectUtil.deepMerge(l.table,l.options[l.type].table||{})}l.type==="switch"&&(l.options.switch.tableBeforeChange=async(s,f)=>{const h=l.options?.switch;try{await n.value?.open({title:g.tCurd("confirmModify"),content:g.tCurd("confirmSwitchMessage")}),t.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]===h.activeValue?h.inactiveValue:h.activeValue,final(c,i,p){t.table.loading=!1}}),t.table.loading=!1,k.success(g.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(c){return console.error(c),!1}finally{t.table.loading=!1}}catch{return!1}}),l.type==="treeSelect"&&(l.options.treeSelect.rowKey=r.option.table?.rowKey,l.options.treeSelect.nodeKey=r.option.table?.rowKey)};r.option.column.forEach(o),r.option.table?.column?.forEach(o)},getColumnSpan:(a,o)=>{if(a.item.form?.spanCol){const l=b.config.form.defaultSpan,f=o.filter(h=>!k.isFun(h.item.show?.form,t.update.form,t.update.type)).reduce((h,c)=>h+(c.item.form?.span||l),0);return(a.item?.form.span||l)+f}return a.item.form.span},initColumnForm:()=>{const a=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const o=[],l=r.option.form?.maxSpan||12,s=r.option.form?.defaultSpan||l/2;let f=[];const h=p=>{if(p.children){t.table.column.show.list.push(p.key),p.children.forEach(y=>{h(y)});return}if(t.update.formDefault[p.key]=p.value,p.table.table&&(p.show.table&&t.table.column.show.list.push(p.key),p.table.table&&t.table.column.show.listSource.push(p.key)),!(p.isForm&&typeof p.show?.form=="boolean")||p.show?.form){p.form=p.form||{span:s},p.form.span=p.form.span??s;let y=p.form.span,w=f.reduce((B,S)=>B+S.span,y);const C=f.length;if(f.push({item:p,span:y}),(C===1&&f[0].span===0||w>=l||y===0&&C>1)&&(o.push(f),f=[]),p.rules){const B={input:g.tCurd("placeholderInput"),select:g.tCurd("placeholderSelect")},S=(B[p.type]||B.input)+p.label;t.update.rules[p.key]=typeof p.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:p.rules}}},c=(p,y)=>{p.isForm=y,Array.isArray(p.children)&&p.children.forEach(w=>c(w,y))};a.column.forEach(p=>{p.isForm=!0,c(p,!0),h(p)}),r.option.table?.column?.forEach(p=>{c(p,!1),h(p)}),t.search.column.list=a.column.concat(a.table?.column||[]),t.table.column.list=t.search.column.list.filter(p=>p.table?.table),t.search.column.list.sort((p,y)=>p.sort?.search-y.sort?.search),t.table.column.list.sort((p,y)=>p.sort?.table-y.sort?.table),f.length>0&&o.push(f),t.update.formColumn=o;const i=r.option.search?.formDefault;i&&Object.keys(i).forEach(p=>{t.search.formDefault[p]=i[p]}),a.column.forEach(p=>{p.show?.search||(t.search.formDefault[p.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{r.option.init!==!1&&t.table.getList()}),{conf:t,switchConfirmRef:n,ruleFormRef:d}},j={class:"dialog-footer"},H=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(r,{expose:n}){const d=e.ref(!1),t=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let o=null,l=null;const s=c=>(c?.title&&(t.value=c.title),c?.content&&(a.value=c.content),d.value=!0,new Promise((i,p)=>{o=i,l=p})),f=()=>{d.value=!1,o?.(!0),o=null,l=null},h=()=>{d.value=!1,l?.(new Error("用户取消操作")),o=null,l=null};return n({open:s}),(c,i)=>{const p=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=y=>d.value=y),title:t.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(p,{size:c.size},{default:e.withCtx(()=>[e.createElementVNode("span",j,[e.createVNode(e.unref(m.ElButton),{onClick:h},{default:e.withCtx(()=>i[1]||(i[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:f},{default:e.withCtx(()=>i[2]||(i[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"])}}}),U=(r,n)=>{const d=r.__vccOpts||r;for(const[t,a]of n)d[t]=a;return d},R={},A={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function K(r,n){return e.openBlock(),e.createElementBlock("svg",A,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 J=U(R,[["render",K]]),W={},q={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function G(r,n){return e.openBlock(),e.createElementBlock("svg",q,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 X=U(W,[["render",G]]),Q={class:"row flex-center table-header-label inline"},Y={class:"table-header-tooltip"},Z=["onClick","innerHTML"],P=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(r){const n=k.isFun,d=e.getCurrentInstance().type;return(t,a)=>{const o=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[t.conf.table.column.show.list.includes(l.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:l.key,label:l.label,ref_for:!0},l.table),{header:e.withCtx(()=>[e.renderSlot(t.$slots,"table-header-"+l.key,{item:l},()=>[e.createElementVNode("div",Q,[l.table?.tooltip?(e.openBlock(),e.createBlock(o,{key:0,effect:"dark",content:l.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Y,[e.createVNode(X)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.label),1)])])]),default:e.withCtx(({row:s})=>[l.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(d)),{conf:t.conf,columnList:l.children,option:t.option},e.createSlots({_:2},[e.renderList(t.$slots,(f,h)=>({name:h,fn:e.withCtx(c=>[e.renderSlot(t.$slots,h,e.mergeProps({ref_for:!0},c||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(l.show?.form,t.conf.inlineEdit.form,e.unref(k).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.inlineEdit.row===s&&(l.type==="input"||l.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.conf.inlineEdit.form[l.key],"onUpdate:modelValue":f=>t.conf.inlineEdit.form[l.key]=f,ref_for:!0},l.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):l.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:t.conf.inlineEdit.form[l.key],"onUpdate:modelValue":f=>t.conf.inlineEdit.form[l.key]=f,ref_for:!0},l.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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(t.$slots,"table-"+l.key,{key:1,row:s,item:l},()=>[e.unref(V).customComponent[l.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[l.type??""]?.table),e.mergeProps({key:0,modelValue:s[l.key],"onUpdate:modelValue":f=>s[l.key]=f,ref_for:!0},l.options?.[l.type??""],e.toHandlers(l.options?.[l.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:s[l.key],"onUpdate:modelValue":f=>s[l.key]=f,"before-change":()=>l.options?.switch?.tableBeforeChange?.(l.key,s),ref_for:!0},l.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":l.table?.click?.color}),class:e.normalizeClass({"table-text-click":l.table?.click?.callback}),onClick:f=>l.table?.click?.callback?.(s),innerHTML:l.table?.format?l.table?.format(s):s[l.key]},null,14,Z))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),_={class:"row form-item-content",style:{width:"100%"}},v={class:"col"},ee={class:"col"},te=["innerHTML"],oe=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(r){return(n,d)=>(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",_,[e.renderSlot(n.$slots,"form-"+n.item.item.key+"-start",{row:n.conf.update.form,item:n.item.item}),e.createElementVNode("div",v,[e.createElementVNode("div",ee,[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":d[0]||(d[0]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.input,e.toHandlers(n.item.item.options?.input?.on||{}),{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":d[1]||(d[1]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.switch,{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":d[2]||(d[2]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.select,e.toHandlers(n.item.item.options?.select?.on||{}),{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.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:t.value,label:t.label,value:t.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":d[3]||(d[3]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.radio,e.toHandlers(n.item.item.options?.radio?.on||{}),{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.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:t.value,label:t.label,value:t.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.item.item.options?.list,e.toHandlers(n.item.item.options?.list?.on||{}),{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":d[4]||(d[4]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.treeSelect,e.toHandlers(n.item.item.options?.treeSelect?.on||{}),{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":d[5]||(d[5]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.datetime,e.toHandlers(n.item.item.options?.datetime?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type&&(e.unref(V).customComponent[n.item.item.type]||e.unref(V).customComponent[n.item.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[n.item.item.type]?.form||e.unref(V).customComponent[n.item.item.type]),e.mergeProps({key:7,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[6]||(d[6]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.[n.item.item.type],e.toHandlers(n.item.item.options?.[n.item.item.type]?.on||{}),{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:n.item.item.form?.tipText},null,8,te)):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"]))}}),ne={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ae={class:"flex items-center",style:{gap:"10px"}},re={key:0},ie={key:1},se={key:2},de={class:"export-btn"},ce={class:"flex items-center table-tools-right",style:{gap:"10px"}},fe={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},pe={class:"dialog-footer"},me={class:"dialog-footer"},$=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(r,{expose:n}){const d=k.EDialog,t=r,a=k.isFun,{conf:o,switchConfirmRef:l,ruleFormRef:s}=M(t);return n({conf:o}),(f,h)=>{const c=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",ne,[e.createVNode(e.unref(m.ElForm),{model:e.unref(o).search.form,inline:"",size:r.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(o).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o).search.column.list,i=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i.key},[(typeof i.show?.search=="function"?i.show?.search(e.unref(o).search.form):i.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof i.text?.search?.label=="string"?i.text?.search?.label:i.label,class:e.normalizeClass({"hide-label":typeof i.text?.search?.label=="boolean"?!i.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+i.key,{row:e.unref(o).search.form},()=>[i.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.input||i.options?.input,e.toHandlers(i.options?.search?.input?.on||i.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i,e.unref(g).tCurd("placeholderSelect")),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.switch||i.options?.switch,e.toHandlers(i.options?.search?.switch?.on||i.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.options?.switch?.activeValue,label:i.options?.switch?.activeLabel,value:i.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.options?.switch?.inactiveValue,label:i.options?.switch?.inactiveLabel,value:i.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i,e.unref(g).tCurd("placeholderSelect")),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.select||i.options?.select,e.toHandlers(i.options?.search?.select?.on||i.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,disabled:i.disabled?.search,ref_for:!0},i.options?.search?.datetime||i.options?.datetime,e.toHandlers(i.options?.search?.datetime?.on||i.options?.datetime?.on||{})),null,16,["modelValue","onUpdate:modelValue","disabled"])):i.type&&e.unref(V).customComponent[i.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[i.type]),e.mergeProps({key:4,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,ref_for:!0},i.options?.search?.[i.type]||i.options?.[i.type],e.toHandlers(i.options?.search?.[i.type]?.on||i.options?.[i.type]?.on||{}),{disabled:i.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(f.$slots,"search-"+i.key+"-right",{row:e.unref(o).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(o).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(o).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).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(o).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(o).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ae,[e.unref(a)(r.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:h[0]||(h[0]=i=>e.unref(o).update.open(e.unref(d).Insert)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.table?.selectable&&e.unref(a)(r.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:h[1]||(h[1]=i=>e.unref(o).remove.open(e.unref(o).table.selection.list)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:h[2]||(h[2]=i=>e.unref(o).table.expand.all()),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:e.unref(o).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[r.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportAll")),1)]),_:1})]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",de,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(o).export.loading,size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(f.$slots,"tools-right"),e.unref(o).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(o).page.num,"onUpdate:currentPage":h[3]||(h[3]=i=>e.unref(o).page.num=i),"page-size":e.unref(o).page.size,"onUpdate:pageSize":h[4]||(h[4]=i=>e.unref(o).page.size=i),background:"","page-sizes":e.unref(o).page.sizeList,"pager-count":e.unref(o).page.pagerCount,layout:e.unref(o).page.layout,total:e.unref(o).page.total,size:r.option.size?.table,onSizeChange:e.unref(o).table.getList,onCurrentChange:e.unref(o).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:h[5]||(h[5]=(...i)=>e.unref(o).table.getList&&e.unref(o).table.getList(...i))},[e.createVNode(J)],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(o).table.data,border:r.option.table?.border===void 0?!0:r.option.table?.border,onSelectionChange:e.unref(o).table.selection.change,onSortChange:e.unref(o).table.sort.change,"expand-row-keys":e.unref(o).table.expand.rowKeys,onExpandChange:e.unref(o).table.expand.change},r.option.table,e.toHandlers(r.option.table?.on||{})),{default:e.withCtx(()=>[r.option.table?.selectable||e.unref(a)(r.option.tools?.delete)||r.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof r.option.table?.selectable=="function"?r.option.table?.selectable:void 0,width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(P,{conf:e.unref(o),columnList:e.unref(o).table.column.list,option:r.option},e.createSlots({_:2},[e.renderList(f.$slots,(i,p)=>({name:p,fn:e.withCtx(y=>[e.renderSlot(f.$slots,p,e.normalizeProps(e.guardReactiveProps(y||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(r.option.table?.add)||e.unref(a)(r.option.table?.update)||e.unref(a)(r.option.table?.delete)||e.unref(a)(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(o).table.op.width(e.unref(a)(r.option.table?.add),e.unref(a)(r.option.table?.update),e.unref(a)(r.option.table?.delete),e.unref(a)(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(g).tCurd("operation")),1)])]),default:e.withCtx(({row:i})=>[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:i}),r.option.table?.inlineEdit&&e.unref(o).inlineEdit.row===i?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(o).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(o).inlineEdit.submit,loading:e.unref(o).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(f.$slots,"table-op-edit-right",{row:i})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(r.option.table?.add,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:p=>e.unref(o).update.open(e.unref(d).Insert,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.view,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:p=>e.unref(o).update.open(e.unref(d).View,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.update,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:p=>e.unref(o).update.open(e.unref(d).Update,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.delete,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:p=>e.unref(o).remove.open([i])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-op-right",{row:i})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[c,e.unref(o).table.loading]])],2)],2),e.createElementVNode("div",fe,[(r.option.page?.show===void 0||r.option.page?.show)&&!e.unref(o).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(o).page.num,"onUpdate:currentPage":h[6]||(h[6]=i=>e.unref(o).page.num=i),"page-size":e.unref(o).page.size,"onUpdate:pageSize":h[7]||(h[7]=i=>e.unref(o).page.size=i),background:"","page-sizes":e.unref(o).page.sizeList,"pager-count":e.unref(o).page.pagerCount,layout:e.unref(o).page.layout,total:e.unref(o).page.total,size:r.option.size?.table,onSizeChange:e.unref(o).table.getList,onCurrentChange:e.unref(o).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(o).update.show,"onUpdate:modelValue":h[8]||(h[8]=i=>e.unref(o).update.show=i),title:e.unref(o).update.title,"before-close":e.unref(o).update.close},r.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",pe,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(o).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(o).update.type!==e.unref(d).View?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(o).update.submit,loading:e.unref(o).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).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(o).update.form,rules:e.unref(o).update.rules,size:r.option.size?.form},{default:e.withCtx(()=>[e.unref(o).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(o).update.formColumn,i=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)((()=>{const p=[],y=w=>{w?.item?.children?y(w.item.children):p.push(...w.map(C=>C.item?.show?.form))};return y(i),p})(),e.unref(o).update.form,e.unref(o).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(o).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,p=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(p.item.show?.form,e.unref(o).update.form,e.unref(o).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([p.item.form.span>0?`col-${e.unref(o).getColumnSpan(p,i)}`:"col",`form-item-col-${p.item.key}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.item.children?p.children:[p],y=>(e.openBlock(),e.createBlock(oe,{key:y.item.key,conf:e.unref(o),item:y},e.createSlots({_:2},[e.renderList(f.$slots,(w,C)=>({name:C,fn:e.withCtx(B=>[e.renderSlot(f.$slots,C,e.mergeProps({ref_for:!0},B||{}))])}))]),1032,["conf","item"]))),128))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(f.$slots,"form-end",{row:e.unref(o).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(o).remove.show,"onUpdate:modelValue":h[9]||(h[9]=i=>e.unref(o).remove.show=i),title:e.unref(o).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",me,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(o).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(o).remove.submit,loading:e.unref(o).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(g).tCurd("confirmDeleteMessage",e.unref(o).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(H,{ref_key:"switchConfirmRef",ref:l,size:r.option.size?.form},null,8,["size"])],2)}}});class he{static async download(n,d="download.png"){const t=document.createElement("a");t.style.display="none",t.href=n,t.setAttribute("download",d),typeof t.download>"u"&&t.setAttribute("target","_blank"),document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,d)=>{const t=new Blob([JSON.stringify(n)],{type:"application/json"}),a=URL.createObjectURL(t),o=document.createElement("a");o.href=a,o.download=`${d||"config"}.json`,o.click()};static importFile=async n=>new Promise((d,t)=>{const a=document.createElement("input");a.type="file";const o=n?.accept||".json";a.accept=o,a.style.display="none",a.onchange=l=>{const s=l.target.files[0];if(!s){k.fail("未选择文件"),t("未选择文件");return}const f=new FileReader;f.onload=async h=>{const c=o==".json"?JSON.parse(h.target.result):h.target.result;d(c)},f.onerror=()=>{k.fail("文件读取失败"),t("文件读取失败")},f.readAsText(s),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(r,n)=>{if(r.component("TCurd",$),r.component("TFormList",D),r.component("TColumn",z),n?.customComponent){V.customComponent=n.customComponent;for(const d in n.customComponent)r.component(d,n.customComponent[d])}},ge={install:T};u.ArrUtil=E,u.ExcelUtil=F,u.TColumn=z,u.TCurd=$,u.TFile=he,u.TForm=V,u.TFormConfig=b,u.TFormI18n=g,u.TFormList=D,u.TSys=k,u.default=ge,u.install=T,Object.defineProperties(u,{__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,Ce,e){"use strict";class k{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(!k.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const c=await k.moduleObj[n]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(n,c,o={}){const r=Date.now();if(!this.tipMessages[n]||r-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=r;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,r=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="+r+", 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 r=document.getElementById(n.id);const a=await k.loadModule("html2canvas");try{a(r,{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={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,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),r=a=>a.replace(/-([a-z])/g,(t,s)=>s.toUpperCase());if(o)return o.options[r(o.type)]};static setOptionsData=(n,c,o)=>{const r=B.findOptions(n,c);r&&(r.data=o)};static form={openBefore:{parentId:(n,c,o,r)=>{const a=u.config.table.rowKey;n?c.type===k.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(r,"parentId",[{[a]:"0",title:"根",children:o}])}}}}function Be(i){return i}const A={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,(r,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=A}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,c,o)=>{c[n]||(c[n]=[]);const r=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[r]||(a[r]=E.getIdFun())})};static add=(n,c,o,r)=>{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()})),r?.(c)};static remove=(n,c,o,r)=>{const a=u.config.table.rowKey;c[n]=c[n].filter(t=>t[a]!==o[a]),r?.(c)};static getNoIdData=(n,c)=>{const o=JSONUtil.cp(n),r=u.config.table.rowKey;return o.forEach(a=>{a[r]&&delete a[r],c&&a[c]&&E.getNoIdData(a[c],c)}),o}}const M={key:0,class:"column",style:{width:"100%",gap:"10px"}},H={class:"row items-center",style:{gap:"10px",width:"100%"}},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:""}},emits:["change"],setup(i,{emit:n}){const c=i,o=e.reactive({show:!1,add:(a,t,s)=>{E.add(a,t,s,()=>{r("change")})},remove:(a,t,s)=>{E.remove(a,t,s,()=>{r("change")})}});e.onMounted(()=>{E.setId(c.field,c.row,c.itemFields),o.show=!0});const r=n;return(a,t)=>{const s=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(a.$slots,"list-start",{row:i.row}),e.createElementVNode("div",null,[e.createVNode(s,{link:"",type:"primary",onClick:t[0]||(t[0]=p=>o.add(i.field,i.row,i.itemFields))},{default:e.withCtx(()=>t[2]||(t[2]=[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":l=>p[g.value]=l,style:e.normalizeStyle({width:i.inputWidth}),class:e.normalizeClass(i.inputClass),placeholder:g[i.label]||g[i.value],onChange:t[1]||(t[1]=l=>r("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[3]||(t[3]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),e.renderSlot(a.$slots,"list-end",{row:i.row})])):e.createCommentVNode("",!0)}}}),I={class:"row form-item-content",style:{width:"100%"}},j={class:"col"},x={class:"col"},R=["innerHTML"],O=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(i,{expose:n}){const c=k.isFun,o=k.EDialog,r=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(b=>!k.isFun(b.item.show?.form,t.form,t.type)).reduce((b,y)=>b+(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}}},b=(y,w)=>{y.isForm=w,Array.isArray(y.children)&&y.children.forEach(V=>b(V,w))};s.column.forEach(y=>{b(y,!0),d(y)}),l.length>0&&f.push(l),t.formColumn=f,t.form=JSONUtil.cp(t.formDefault)}});return t.initColumnForm(),n({ref:r,conf:t}),(s,f)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:r,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: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,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||i.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",j,[e.createElementVNode("div",x,[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,R)):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 U{static exportToExcel=async(n,c,o)=>{if(!n||n.length===0)return;const r=await k.loadModule("xlsx"),a=n.map(f=>{const p={};return c.forEach(g=>{p[g.label]=f[g.key]}),p}),t=r.utils.json_to_sheet(a),s=r.utils.book_new();r.utils.book_append_sheet(s,t,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,r.writeFile(s,`${o}.xlsx`)}}const S=k.EDialog,K=i=>{const n=e.ref(),c=e.ref(),o=e.reactive({option:i.option,search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(r,a=h.tCurd("placeholderInput"))=>r.text?.search?.placeholder===void 0?`${a}${r.label}`:r.text?.search?.placeholder,getFormData:()=>{let r={};i.option.column.forEach(t=>{(typeof t.show?.search=="function"?t.show?.search(o.search.form):t.show?.search)&&(r[t.key]=o.search.form[t.key])});const a=i.option.search?.before?.(r);return a&&(r=a),r},reset:()=>{const r=o.search.formDefault;Object.keys(r).forEach(a=>{i.option.search?.resetMode==="none"?r[a]=void 0:r[a]=o.search.formDefault[a]}),o.search.form=JSONUtil.cp(r),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},table:{op:{width:(...r)=>r.filter(t=>t).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,a)=>{},all:()=>{if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const r=a=>{let t=[];return a.forEach(s=>{t.push(s[i.option.table.rowKey]),s.children&&s.children.length>0&&(t=t.concat(r(s.children)))}),t};o.table.expand.rowKeys=r(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{o.table.loading=!0;const r=i.option.api.list;try{await o.initApiData("init");let a={};if(o.table.sort.prop){const{props:d,order:b}=u.config.table.sort;a={[d.field]:o.table.sort.prop,[b.field]:o.table.sort.order}}const t=await r({[u.config.page.size]:o.page.size,[u.config.page.num]:o.page.num,...o.search.getFormData(),...a}),s=u.config.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=i.option.data?await i.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:r=>{o.table.selection.list=r}},sort:{prop:"",order:"",change:r=>{u.config.table.sort.resetPage&&(o.page.num=1);const a=u.config.table.sort;if(a.change){a.change(r,o);return}o.table.sort.prop=r.prop,r.order===null?o.table.sort.order="":o.table.sort.order=r.order==="ascending"?a.order.asc:a.order.desc,o.table.getList()}}},export:{run:{start:async r=>{let a=await o.export.run[r](),t=i.option.column;const s=JSONUtil.cp({data:a,columns:t}),f=i.option.tools?.export||{};f.before&&f.before(s),U.exportToExcel(s.data,s.columns,f.fileName)},select:()=>{if(o.table.selection.list.length===0)throw k.fail(h.tCurd("selectDataToExport")),new Error(h.tCurd("selectDataToExport"));return o.table.selection.list},page:()=>{if(o.table.data.length===0)throw k.fail(h.tCurd("noData")),new Error(h.tCurd("noData"));return o.table.data},all:async()=>{o.export.loading=!0;try{if(i.option.tools?.export?.all){await i.option.tools?.export?.all({[u.config.page.size]:o.page.size,[u.config.page.num]:o.page.num,...o.search.getFormData()});return}const r=i.option.api.list,a=await r({[u.config.page.size]:999999,[u.config.page.num]:1});return(a.data||{[u.config.result.list]:a})[u.config.result.list]}catch(r){console.error(r)}finally{o.export.loading=!1}}},loading:!1,click:r=>{o.export.loading||o.export.run.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:S.Add,form:{},formDefault:{},formColumn:[],getDisabled:r=>o.update.type===S.View?r.disabled?.view===void 0?!0:r.disabled?.view:r.disabled?.[o.update.type===S.Add?"create":"update"],getBind:r=>r.options?.[o.update.type===S.Add?"formAdd":"formUpdate"]?.[r.type]||r.options?.[r.type]||{},getOn:r=>r.options?.[o.update.type===S.Add?"formAdd":"formUpdate"]?.[r.type]?.on||r.options?.[r.type]?.on||{},getBindOnByKey:r=>{try{const t=o.update.formColumn.flat().find(s=>s.item.key===r)?.item;return t?{bind:o.update.getBind(t),on:o.update.getOn(t)}:{bind:{},on:{}}}catch{return{bind:{},on:{}}}},edit:{data:{},getApiData:r=>{if(i.option.form?.editAll)return r;let a={[i.option.table?.rowKey]:o.update.edit.data[i.option.table?.rowKey]};return Object.keys(o.update.edit.data).forEach(t=>{r[t]!==o.update.edit.data[t]&&(a[t]=r[t])}),a}},view:{},open:(r,a)=>{o.update.showContent||FunUtil.throttle(async()=>{k.loading(!0);try{o.update.type=r,await o.initApiData("update");const t=r===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":r===S.View?"view":"edit"),o.update.form=JSONUtil.cp(t?o.update.formDefault:a),await i.option.form?.openBefore?.(a,o.update),o.inlineEdit.data||(o.update.show=!0),o.update.showContent=!0,i.option.form?.openAfter?.(a,o.update)}catch(t){console.error(t)}finally{k.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await c.value?.validate(async(s,f)=>new Promise((p,g)=>{s||(k.fail(h.tCurd("checkFormData")),g(!1)),p()})),o.update.loading=!0;const r=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(!r)return;await r({...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:r=>{o.inlineEdit.data=r,o.update.open(S.Update,r)},close:()=>{o.inlineEdit.data=null,o.update.close()}},remove:{title:h.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{o.remove.show=!1},open:r=>{if(r.length===0){k.fail(h.tCurd("selectDataToDelete"));return}o.remove.items=r,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{o.remove.loading=!0;const r=i.option.api.delete;try{if(!r)return;await r({[i.option.table?.rowKey]:o.remove.items.map(a=>a[i.option.table?.rowKey]),items:o.remove.items}),k.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 r=>{const a=[],t=s=>{if(s.children&&s.children.length){s.children.forEach(f=>t(f));return}if(["select","radio"].includes(s.type)&&s.options?.[s.type]?.dataApi&&s.options?.[s.type]?.dataApiConfig?.[r]){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,r);if(p){const g=s.options?.[s.type]?.dataPath;g&&(p=ObjectUtil.getPathValue(p,g)),s.options[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 r=JSONUtil.cp(u.config);r.table.emptyText=h.tCurd("noData"),i.option.size=i.option.size||{},r.table.size=i.option.size.table||r.size.table,r.form.size=i.option.size.form||r.size.form,r.size.search=i.option.size.search||r.size.search;const a=ObjectUtil.deepMerge(r,i.option||{});Object.keys(a).forEach(t=>{i.option[t]=a[t]})},initColumnOptions:()=>{let r=JSONUtil.cp(u.config.columnConfig);r.options=ObjectUtil.deepMerge(r.options,{switch:{activeLabel:h.tCurd("switchOn"),inactiveLabel:h.tCurd("switchOff")}});const a=t=>{for(const s in r){if(s==="table"){if(t.table=ObjectUtil.deepMerge(r.table,t.table||{}),t.children){t.children.forEach(p=>{a(p)});return}}else s==="type"?t.type=t.type||r.type:t[s]=ObjectUtil.deepMerge(r[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,l,d){o.table.loading=!1}}),o.table.loading=!1,k.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:(r,a)=>{if(r.item.form?.spanCol){const t=u.config.form.defaultSpan,f=a.filter(p=>!k.isFun(p.item.show?.form,o.update.form,o.update.type)).reduce((p,g)=>p+(g.item.form?.span||t),0);return(r.item?.form.span||t)+f}return r.item.form.span},initColumnForm:()=>{const r=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(b=>{p(b)});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 b=d.form.span,y=f.reduce((V,N)=>V+N.span,b);const w=f.length;if(f.push({item:d,span:b}),(w===1&&f[0].span===0||y>=t||b===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,b)=>{d.isForm=b,Array.isArray(d.children)&&d.children.forEach(y=>g(y,b))};r.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=r.column.concat(r.table?.column||[]),o.table.column.list=o.search.column.list.filter(d=>d.table?.table),o.search.column.list.sort((d,b)=>d.sort?.search-b.sort?.search),o.table.column.list.sort((d,b)=>d.sort?.table-b.sort?.table),f.length>0&&a.push(f),o.update.formColumn=a;const l=i.option.search?.formDefault;l&&Object.keys(l).forEach(d=>{o.search.formDefault[d]=l[d]}),r.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}},J={class:"dialog-footer"},W=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(i,{expose:n}){const c=e.ref(!1),o=e.ref("确认修改"),r=e.ref("确认要修改状态吗?");let a=null,t=null;const s=g=>(g?.title&&(o.value=g.title),g?.content&&(r.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]=b=>c.value=b),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",J,[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(r.value),1)]),_:1},8,["modelValue","title"])}}}),$=(i,n)=>{const c=i.__vccOpts||i;for(const[o,r]of n)c[o]=r;return c},q={},G={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(i,n){return e.openBlock(),e.createElementBlock("svg",G,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 Q=$(q,[["render",X]]),Y={},Z={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function P(i,n){return e.openBlock(),e.createElementBlock("svg",Z,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 _=$(Y,[["render",P]]),v={class:"row flex-center table-header-label inline"},ee={class:"table-header-tooltip"},te=["onClick","innerHTML"],oe=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(i){const n=k.isFun,c=e.getCurrentInstance().type;return(o,r)=>{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",v,[t.table?.tooltip?(e.openBlock(),e.createBlock(a,{key:0,effect:"dark",content:t.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",ee,[e.createVNode(_)])]),_: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},[r[0]||(r[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(k).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?.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,te))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),ne={class:"row form-item-content",style:{width:"100%"}},ae={class:"col"},le={class:"col"},re=["innerHTML"],ie=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",ne,[e.renderSlot(n.$slots,"form-"+n.item.item.key+"-start",{row:n.conf.update.form,item:n.item.item}),e.createElementVNode("div",ae,[e.createElementVNode("div",le,[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.item.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_: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.item.item.options?.radio?.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,re)):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"]))}}),se={key:0,class:"relative curd-search fit-width"},de={class:"mb-10 flex justify-between items-center fit-width"},ce={class:"flex items-center",style:{gap:"10px"}},fe={key:0},pe={key:1},me={key:2},he={class:"export-btn"},ge={class:"flex items-center table-tools-right",style:{gap:"10px"}},ye={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},be={class:"dialog-footer"},ue={class:"dialog-footer"},T=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(i,{expose:n}){const c=k.EDialog,o=i,r=k.isFun,{conf:a,switchConfirmRef:t,ruleFormRef:s}=K(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",se,[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,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}),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",de,[e.createElementVNode("div",ce,[e.unref(r)(i.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",fe,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:p[0]||(p[0]=l=>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(r)(i.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",pe,[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: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",me,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:p[2]||(p[2]=l=>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.createBlock(e.unref(m.ElDropdown),{key:3,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.table?.selectable?(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),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).tCurd("exportAll")),1)]),_:1})]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",he,[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.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",ge,[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[3]||(p[3]=l=>e.unref(a).page.num=l),"page-size":e.unref(a).page.size,"onUpdate:pageSize":p[4]||(p[4]=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: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[5]||(p[5]=(...l)=>e.unref(a).table.getList&&e.unref(a).table.getList(...l))},[e.createVNode(Q)],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(r)(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(oe,{conf:e.unref(a),columnList:e.unref(a).table.column.list,option:i.option},e.createSlots({_:2},[e.renderList(f.$slots,(l,d)=>({name:d,fn:e.withCtx(b=>[e.renderSlot(f.$slots,d,e.normalizeProps(e.guardReactiveProps(b||{})))])}))]),1032,["conf","columnList","option"]),e.unref(r)(i.option.table?.add)||e.unref(r)(i.option.table?.update)||e.unref(r)(i.option.table?.delete)||e.unref(r)(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(r)(i.option.table?.add),e.unref(r)(i.option.table?.update),e.unref(r)(i.option.table?.delete),e.unref(r)(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:l})=>[e.createVNode(e.unref(m.ElForm),{size:i.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:l}),i.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(r)(i.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(r)(i.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(r)(i.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(r)(i.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",ye,[(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[6]||(p[6]=l=>e.unref(a).page.num=l),"page-size":e.unref(a).page.size,"onUpdate:pageSize":p[7]||(p[7]=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: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[8]||(p[8]=l=>e.unref(a).update.show=l),title:e.unref(a).update.title,"before-close":e.unref(a).update.close},i.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",be,[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,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)((()=>{const d=[],b=y=>{y?.item?.children?b(y.item.children):d.push(...y.map(w=>w.item?.show?.form))};return b(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: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(l,d=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)(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],b=>(e.openBlock(),e.createBlock(ie,{key:b.item.key,conf:e.unref(a),item:b},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[9]||(p[9]=l=>e.unref(a).remove.show=l),title:e.unref(a).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ue,[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(W,{ref_key:"switchConfirmRef",ref:t,size:i.option.size?.form},null,8,["size"])],2)}}});class ke{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"}),r=URL.createObjectURL(o),a=document.createElement("a");a.href=r,a.download=`${c||"config"}.json`,a.click()};static importFile=async n=>new Promise((c,o)=>{const r=document.createElement("input");r.type="file";const a=n?.accept||".json";r.accept=a,r.style.display="none",r.onchange=t=>{const s=t.target.files[0];if(!s){k.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=()=>{k.fail("文件读取失败"),o("文件读取失败")},f.readAsText(s),document.body.removeChild(r)},document.body.appendChild(r),r.click()})}const L=(i,n)=>{if(i.component("TCurd",T),i.component("TFormList",D),i.component("TColumn",O),n?.customComponent){B.customComponent=n.customComponent;for(const c in n.customComponent)i.component(c,n.customComponent[c])}},we={install:L};C.ArrUtil=E,C.ExcelUtil=U,C.TColumn=O,C.TCurd=T,C.TFile=ke,C.TForm=B,C.TFormConfig=u,C.TFormI18n=h,C.TFormList=D,C.TSys=k,C.default=we,C.install=L,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|