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