cc1-form 1.1.36 → 1.1.37
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 +267 -254
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +5 -5
- package/dist/components/TCurd/formColumn.vue.d.ts +5 -5
- package/dist/components/TCurd/index.d.ts +5 -5
- package/dist/components/TCurd/index.vue.d.ts +11 -11
- package/dist/components/TCurd/indexType.d.ts +1 -1
- package/dist/components/TCurd/tableColumn.vue.d.ts +2 -0
- package/dist/utils/TForm.d.ts +1 -0
- package/dist/utils/TFormConfig.d.ts +1 -0
- package/package.json +1 -1
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("element-plus"),require("vue-router"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue-router","vue"],m):(u=typeof globalThis<"u"?globalThis:u||self,m(u.cc1Form={},u.ElementPlus,u.VueRouter,u.Vue))})(this,(function(u,m,be,e){"use strict";class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...s)=>Array.isArray(n)?n.some(t=>typeof t=="function"?t(...s):t):typeof n=="function"?n(...s):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async n=>{if(!k.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const s=await k.moduleObj[n]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(n,s,t={}){const a=Date.now();if(!this.tipMessages[n]||a-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=a;const o=Object.assign({message:n,type:s},t);m.ElMessage(o),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,s={})=>{this.showMessage(n,"error",s)};static success=(n,s={})=>{this.showMessage(n,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?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=(n,s=!0)=>{if(s){let t=screen.width/2-500,a=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+t)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(s,t)=>{let a=document.getElementById(n.id);const o=await k.loadModule("html2canvas");try{o(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(l){let d=l.toDataURL("image/png");s(d)})}catch(l){t(l)}})}class b{static config={page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=n=>{b.config=ObjectUtil.deepMerge(b.config,n)}}class B{static customComponent={};static findOptions=(n,s)=>{const t=n.column.find(o=>o.key===s),a=o=>o.replace(/-([a-z])/g,(l,d)=>d.toUpperCase());if(t)return t.options[a(t.type)]};static setOptionsData=(n,s,t)=>{const a=B.findOptions(n,s);a&&(a.data=t)};static form={openBefore:{parentId:(n,s,t,a)=>{const o=b.config.table.rowKey;n?s.type===k.EDialog.Insert?(s.form.parentId=n[o],s.form.sort=n.children.length+1):s.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=t.length+1),B.setOptionsData(a,"parentId",[{[o]:"0",title:"根",children:t}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,s,t)=>{s[n]||(s[n]=[]);const a=b.config.table.rowKey;s[n].forEach(o=>{t.forEach(l=>{let d=l.default??"";l.type==="number"&&(d=l.default??0),l.type==="boolean"&&(d=l.default??!1),l.type==="time"&&(d=l.default??new Date),o[l.value]===void 0&&(o[l.value]=d)}),o[a]||(o[a]=E.getIdFun())})};static add=(n,s,t,a)=>{const o=JSONUtil.cp(t);E.setId(n,s,t);const l=b.config.table.rowKey;s[n].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},{[l]:E.getIdFun()})),a?.(s)};static remove=(n,s,t,a)=>{const o=b.config.table.rowKey;s[n]=s[n].filter(l=>l[o]!==t[o]),a?.(s)};static getNoIdData=(n,s)=>{const t=JSONUtil.cp(n),a=b.config.table.rowKey;return t.forEach(o=>{o[a]&&delete o[a],s&&o[s]&&E.getNoIdData(o[s],s)}),t}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},D=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(r,{emit:n}){const s=r,t=e.reactive({show:!1,add:(o,l,d)=>{E.add(o,l,d,()=>{a("change")})},remove:(o,l,d)=>{E.remove(o,l,d,()=>{a("change")})}});e.onMounted(()=>{E.setId(s.field,s.row,s.itemFields),t.show=!0});const a=n;return(o,l)=>{const d=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return t.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(o.$slots,"list-start",{row:r.row}),e.createElementVNode("div",null,[e.createVNode(d,{link:"",type:"primary",onClick:l[0]||(l[0]=h=>t.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加")])),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.row[r.field],h=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(o.$slots,"item-start",{item:h,row:r.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.itemFields,c=>(e.openBlock(),e.createBlock(f,{modelValue:h[c.value],"onUpdate:modelValue":i=>h[c.value]=i,style:e.normalizeStyle({width:r.inputWidth}),class:e.normalizeClass(r.inputClass),placeholder:c[r.label]||c[r.value],onChange:l[1]||(l[1]=i=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(o.$slots,"item-end",{item:h,row:r.row}),e.createVNode(d,{link:"",type:"danger",onClick:c=>t.remove(r.field,r.row,h)},{default:e.withCtx(()=>l[3]||(l[3]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),e.renderSlot(o.$slots,"list-end",{row:r.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},z=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(r,{expose:n}){const s=k.isFun,t=k.EDialog,a=e.ref(),o=r,l=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;l.formColumn=[];const f=[],h=o.option.form?.maxSpan||12,c=o.option.form?.defaultSpan||h;let i=[];const p=y=>{if(l.formDefault[y.key]=y.value,y.isForm){y.form=y.form||{span:c},y.form.span=y.form.span??c;let w=y.form.span,C=i.reduce((S,ye)=>S+ye.span,w);const V=i.length;i.push({item:y,span:w}),(V===1&&i[0].span===0||C>=h||w===0&&V>1)&&(f.push(i),i=[]),y.rules&&(l.rules[y.key]=y.rules)}};d.column.forEach(y=>{y.isForm=!0,p(y)}),i.length>0&&f.push(i),l.formColumn=f,l.form=JSONUtil.cp(l.formDefault)},init:async()=>{l.show=!1,await e.nextTick(),l.initColumnForm()}});return l.initColumnForm(),n({ref:a,conf:l}),(d,f)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:a,model:l.form,rules:l.rules},{default:e.withCtx(()=>[l.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.formColumn,h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(d.$slots,"form-start",{row:l.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(c.item.show?.form,l.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"form-"+c.item.key+"-start",{row:l.form,item:c.item}),e.renderSlot(d.$slots,"form-"+c.item.key,{row:l.form,item:c.item},()=>[c.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.input,e.toHandlers(c.item.options?.input?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.switch,e.toHandlers(c.item.options?.switch?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.select,e.toHandlers(c.item.options?.select?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.item.options?.select?.data,i=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:3,row:l.form,field:c.item.key,ref_for:!0},c.item.options?.list,e.toHandlers(c.item.options?.list?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):c.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.treeSelect,e.toHandlers(c.item.options?.treeSelect?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.datetime,e.toHandlers(c.item.options?.datetime?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type&&e.unref(B).customComponent[c.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[c.item.type]),e.mergeProps({key:6,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.[c.item.type],e.toHandlers(c.item.options?.[c.item.type]?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(d.$slots,"form-"+c.item.key+"-end",{row:l.form,item:c.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(d.$slots,"form-end",{row:l.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function ke(r){return r}const x={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class g{static t(n,...s){if(typeof n=="function")return n(...s);n=String(n);let t=0;return n.replace(/{([^}]+)}/g,(a,o)=>t<s.length?String(s[t++]):`{${o}}`)}static setI18n=n=>{g.curd=ObjectUtil.deepMerge(g.curd,n)};static tCurd(n,...s){return this.t(this.curd[n],...s)}static curd=x}class F{static exportToExcel=async(n,s,t)=>{if(!n||n.length===0)return;const a=await k.loadModule("xlsx"),o=n.map(f=>{const h={};return s.forEach(c=>{h[c.label]=f[c.key]}),h}),l=a.utils.json_to_sheet(o),d=a.utils.book_new();a.utils.book_append_sheet(d,l,"Sheet1"),t?typeof t=="function"&&(t=t()):t=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(d,`${t}.xlsx`)}}const N=k.EDialog,M=r=>{const n=e.ref(),s=e.ref(),t=e.reactive({option:r.option,search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,o=g.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${o}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(a[l.key]=t.search.form[l.key])});const o=r.option.search?.before?.(a);return o&&(a=o),a},reset:()=>{const a=t.search.formDefault;Object.keys(a).forEach(o=>{r.option.search?.resetMode==="none"?a[o]=void 0:a[o]=t.search.formDefault[o]}),t.search.form=JSONUtil.cp(a),t.page.num=1,r.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{num:1,total:0,layout:r.option.page?.layout||b.config.pagination.layout,showTools:r.option.page?.showTools||b.config.pagination.showTools,size:r.option.page?.size||b.config.pagination.size,sizeList:r.option.page?.sizeList||b.config.pagination.pageSizes,pagerCount:r.option.page?.pagerCount||b.config.pagination.pagerCount},table:{op:{width:(...a)=>a.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,o)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const a=o=>{let l=[];return o.forEach(d=>{l.push(d[r.option.table.rowKey]),d.children&&d.children.length>0&&(l=l.concat(a(d.children)))}),l};t.table.expand.rowKeys=a(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const a=r.option.api.list;try{await t.initApiData("init");let o={};if(t.table.sort.prop){const{props:p,order:y}=b.config.table.sort;o={[p.field]:t.table.sort.prop,[y.field]:t.table.sort.order}}const l=await a({[b.config.page.size]:t.page.size,[b.config.page.num]:t.page.num,...t.search.getFormData(),...o}),d=b.config.result,f=l.data||{[d.list]:l};let h=(Array.isArray(f[d.list]),f[d.list]);const c=t.update.formColumn.flat(),i=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=r.option.data?await r.option.data(i,h):i,t.page.total=f[d.total]||0}catch(o){console.error(o)}finally{t.table.loading=!1}},selection:{list:[],change:a=>{t.table.selection.list=a}},sort:{prop:"",order:"",change:a=>{b.config.table.sort.resetPage&&(t.page.num=1);const o=b.config.table.sort;if(o.change){o.change(a,t);return}t.table.sort.prop=a.prop,a.order===null?t.table.sort.order="":t.table.sort.order=a.order==="ascending"?o.order.asc:o.order.desc,t.table.getList()}}},export:{run:{start:async a=>{let o=await t.export.run[a](),l=r.option.column;const d=JSONUtil.cp({data:o,columns:l}),f=r.option.tools?.export||{};f.before&&f.before(d),F.exportToExcel(d.data,d.columns,f.fileName)},select:()=>{if(t.table.selection.list.length===0)throw k.fail(g.tCurd("selectDataToExport")),new Error(g.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw k.fail(g.tCurd("noData")),new Error(g.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[b.config.page.size]:t.page.size,[b.config.page.num]:t.page.num,...t.search.getFormData()});return}const a=r.option.api.list,o=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(o.data||{[b.config.result.list]:o})[b.config.result.list]}catch(a){console.error(a)}finally{t.export.loading=!1}}},loading:!1,click:a=>{t.export.loading||t.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>t.update.type===N.View?a.disabled?.view===void 0?!0:a.disabled?.view:a.disabled?.[t.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(r.option.form?.editAll)return a;let o={[r.option.table?.rowKey]:t.update.edit.data[r.option.table?.rowKey]};return Object.keys(t.update.edit.data).forEach(l=>{a[l]!==t.update.edit.data[l]&&(o[l]=a[l])}),o}},view:{},open:(a,o)=>{t.update.showContent||FunUtil.throttle(async()=>{k.loading(!0);try{await t.initApiData("update");const l=a===N.Insert;if(!l&&r.option.table?.inlineEdit){t.inlineEdit.open(o);return}t.update.type=a,t.update.edit.data=o,t.update.title=g.tCurd(l?"add":a===N.View?"view":"edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:o),await r.option.form?.openBefore?.(o,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(o,t.update)}catch(l){console.error(l)}finally{k.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(d,f)=>new Promise((h,c)=>{d||(k.fail(g.tCurd("checkFormData")),c(!1)),h()})),t.update.loading=!0;const a=t.update.type===N.Insert?r.option.api.create:r.option.api.update;let o=JSONUtil.cp(t.update.form);delete o.children,await r.option.form?.submitBefore?.(o,t.update);const l=new Set(r.option.column.filter(d=>d.type==="datetime").map(d=>d.key));Object.keys(o).forEach(d=>{if(l.has(d)&&o[d]!=null){const f=new Date(o[d]).getTime();isNaN(f)||(o[d]=f)}});try{if(!a)return;await a({...o}),t.update.close(),await t.table.getList(),r.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:a=>{t.inlineEdit.row=a,t.inlineEdit.form=JSONUtil.cp(a)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const a=r.option.api.update;let o=JSONUtil.cp(t.inlineEdit.form);delete o.children;try{if(!a)return;await a({...o}),t.inlineEdit.close(),await t.table.getList(),k.success(g.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:g.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:a=>{if(a.length===0){k.fail(g.tCurd("selectDataToDelete"));return}t.remove.items=a,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const a=r.option.api.delete;try{if(!a)return;await a({[r.option.table?.rowKey]:t.remove.items.map(o=>o[r.option.table?.rowKey]),items:t.remove.items}),k.success(g.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(o){console.error(o)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},apiDataMap:{},initApiData:async a=>{const o=[],l=d=>{if(d.children&&d.children.length){d.children.forEach(f=>l(f));return}if(d.type==="select"&&d.options?.select?.dataApi&&d.options?.select?.dataApiConfig?.[a]){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 r.option.column.forEach(d=>{l(d)}),await Promise.all(o),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=g.tCurd("noData"),r.option.size=r.option.size||{},a.table.size=r.option.size.table||a.size.table,a.form.size=r.option.size.form||a.size.form,a.size.search=r.option.size.search||a.size.search;const o=ObjectUtil.deepMerge(a,r.option||{});Object.keys(o).forEach(l=>{r.option[l]=o[l]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:g.tCurd("switchOn"),inactiveLabel:g.tCurd("switchOff")}});const o=l=>{for(const d in a){if(d==="table"){if(l.table=ObjectUtil.deepMerge(a.table,l.table||{}),l.children){l.children.forEach(f=>{o(f)});return}}else d==="type"?l.type=l.type||a.type:l[d]=ObjectUtil.deepMerge(a[d],l[d]||{});l.options=l.options||{},l.options[l.type]=l.options[l.type]||{},l.options[l.type].size=r.option.size.form,l.options.search=l.options.search||JSONUtil.cp(l.options),l.options.search[l.type]=l.options.search[l.type]||{},l.options.search[l.type].size=r.option.size.search}l.type==="switch"&&(l.options.switch.tableBeforeChange=async(d,f)=>{const h=l.options?.switch;try{await n.value?.open({title:g.tCurd("confirmModify"),content:g.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[r.option.table?.rowKey]:f[r.option.table?.rowKey],[d]:f[d]===h.activeValue?h.inactiveValue:h.activeValue,final(c,i,p){t.table.loading=!1}}),t.table.loading=!1,k.success(g.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(c){return console.error(c),!1}finally{t.table.loading=!1}}catch{return!1}}),l.type==="tree-select"&&(l.options.treeSelect.rowKey=r.option.table?.rowKey,l.options.treeSelect.nodeKey=r.option.table?.rowKey)};r.option.column.forEach(o),r.option.table?.column?.forEach(o)},getColumnSpan:(a,o)=>{if(a.item.form?.spanCol){const l=b.config.form.defaultSpan,f=o.filter(h=>!k.isFun(h.item.show?.form,t.update.form,t.update.type)).reduce((h,c)=>h+(c.item.form?.span||l),0);return(a.item?.form.span||l)+f}return a.item.form.span},initColumnForm:()=>{const a=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const o=[],l=r.option.form?.maxSpan||12,d=r.option.form?.defaultSpan||l/2;let f=[];const h=p=>{if(p.children){t.table.column.show.list.push(p.key),p.children.forEach(y=>{h(y)});return}if(t.update.formDefault[p.key]=p.value,p.table.table&&(p.show.table&&t.table.column.show.list.push(p.key),p.table.table&&t.table.column.show.listSource.push(p.key)),!(p.isForm&&typeof p.show?.form=="boolean")||p.show?.form){p.form=p.form||{span:d},p.form.span=p.form.span??d;let y=p.form.span,w=f.reduce((V,S)=>V+S.span,y);const C=f.length;if(f.push({item:p,span:y}),(C===1&&f[0].span===0||w>=l||y===0&&C>1)&&(o.push(f),f=[]),p.rules){const 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,y)=>{p.isForm=y,Array.isArray(p.children)&&p.children.forEach(w=>c(w,y))};a.column.forEach(p=>{p.isForm=!0,c(p,!0),h(p)}),r.option.table?.column?.forEach(p=>{c(p,!1),h(p)}),t.search.column.list=a.column.concat(a.table?.column||[]),t.table.column.list=t.search.column.list.filter(p=>p.table?.table),t.search.column.list.sort((p,y)=>p.sort?.search-y.sort?.search),t.table.column.list.sort((p,y)=>p.sort?.table-y.sort?.table),f.length>0&&o.push(f),t.update.formColumn=o;const i=r.option.search?.formDefault;i&&Object.keys(i).forEach(p=>{t.search.formDefault[p]=i[p]}),a.column.forEach(p=>{p.show?.search||(t.search.formDefault[p.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{r.option.init!==!1&&t.table.getList()}),{conf:t,switchConfirmRef:n,ruleFormRef:s}},j={class:"dialog-footer"},H=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(r,{expose:n}){const s=e.ref(!1),t=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let o=null,l=null;const d=c=>(c?.title&&(t.value=c.title),c?.content&&(a.value=c.content),s.value=!0,new Promise((i,p)=>{o=i,l=p})),f=()=>{s.value=!1,o?.(!0),o=null,l=null},h=()=>{s.value=!1,l?.(new Error("用户取消操作")),o=null,l=null};return n({open:d}),(c,i)=>{const p=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:s.value,"onUpdate:modelValue":i[0]||(i[0]=y=>s.value=y),title:t.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(p,{size:c.size},{default:e.withCtx(()=>[e.createElementVNode("span",j,[e.createVNode(e.unref(m.ElButton),{onClick:h},{default:e.withCtx(()=>i[1]||(i[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:f},{default:e.withCtx(()=>i[2]||(i[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"])}}}),$=(r,n)=>{const s=r.__vccOpts||r;for(const[t,a]of n)s[t]=a;return s},R={},A={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function K(r,n){return e.openBlock(),e.createElementBlock("svg",A,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)]))}const J=$(R,[["render",K]]),W={},q={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function G(r,n){return e.openBlock(),e.createElementBlock("svg",q,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)]))}const X=$(W,[["render",G]]),Q={class:"row flex-center table-header-label inline"},Y={class:"table-header-tooltip"},Z=["onClick","innerHTML"],P=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(r){const n=k.isFun,s=e.getCurrentInstance().type;return(t,a)=>{const o=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[t.conf.table.column.show.list.includes(l.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:l.key,label:l.label,ref_for:!0},l.table),{header:e.withCtx(()=>[e.renderSlot(t.$slots,"table-header-"+l.key,{item:l},()=>[e.createElementVNode("div",Q,[l.table?.tooltip?(e.openBlock(),e.createBlock(o,{key:0,effect:"dark",content:l.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Y,[e.createVNode(X)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.label),1)])])]),default:e.withCtx(({row:d})=>[l.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s)),{conf:t.conf,columnList:l.children,option:t.option},e.createSlots({_:2},[e.renderList(t.$slots,(f,h)=>({name:h,fn:e.withCtx(c=>[e.renderSlot(t.$slots,h,e.mergeProps({ref_for:!0},c||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(l.show?.form,t.conf.inlineEdit.form,e.unref(k).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.inlineEdit.row===d&&(l.type==="input"||l.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.conf.inlineEdit.form[l.key],"onUpdate:modelValue":f=>t.conf.inlineEdit.form[l.key]=f,ref_for:!0},l.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):l.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:t.conf.inlineEdit.form[l.key],"onUpdate:modelValue":f=>t.conf.inlineEdit.form[l.key]=f,ref_for:!0},l.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options?.select?.data,f=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(t.$slots,"table-"+l.key,{key:1,row:d,item:l},()=>[l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:d[l.key],"onUpdate:modelValue":f=>d[l.key]=f,"before-change":()=>l.options?.switch?.tableBeforeChange?.(l.key,d),ref_for:!0},l.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":l.table?.click?.color}),class:e.normalizeClass({"table-text-click":l.table?.click?.callback}),onClick:f=>l.table?.click?.callback?.(d),innerHTML:l.table?.format?l.table?.format(d):d[l.key]},null,14,Z))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),_={class:"row form-item-content",style:{width:"100%"}},v={class:"col"},ee={class:"col"},te=["innerHTML"],oe=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(r){return(n,s)=>(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof n.item.item.text?.form?.label=="boolean"?!n.item.item.text?.form?.label:!1}),label:typeof n.item.item.text?.form?.label=="string"?n.item.item.text?.form?.label:n.item.item.label,prop:n.item.item.key,"label-width":n.item.item.form?.labelWidth||n.conf.option.form?.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",_,[e.renderSlot(n.$slots,"form-"+n.item.item.key+"-start",{row:n.conf.update.form,item:n.item.item}),e.createElementVNode("div",v,[e.createElementVNode("div",ee,[e.renderSlot(n.$slots,"form-"+n.item.item.key,{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.input,e.toHandlers(n.item.item.options?.input?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.switch,{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.select,e.toHandlers(n.item.item.options?.select?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(m.ElRadioGroup),e.mergeProps({key:3,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.radio,e.toHandlers(n.item.item.options?.radio?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:4,row:n.conf.update.form,field:n.item.item.key},n.item.item.options?.list,e.toHandlers(n.item.item.options?.list?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:5,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.treeSelect,e.toHandlers(n.item.item.options?.treeSelect?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):n.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:6,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.datetime,e.toHandlers(n.item.item.options?.datetime?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type&&e.unref(B).customComponent[n.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[n.item.item.type]),e.mergeProps({key:7,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":s[6]||(s[6]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.[n.item.item.type],e.toHandlers(n.item.item.options?.[n.item.item.type]?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-right",{row:n.conf.update.form,item:n.item.item})]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-tip",{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:n.item.item.form?.tipText},null,8,te)):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-end",{row:n.conf.update.form,item:n.item.item})])]),_:3},8,["class","label","prop","label-width"]))}}),ne={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ae={class:"flex items-center",style:{gap:"10px"}},re={key:0},ie={key:1},se={key:2},de={class:"export-btn"},ce={class:"flex items-center table-tools-right",style:{gap:"10px"}},fe={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},pe={class:"dialog-footer"},me={class:"dialog-footer"},U=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(r,{expose:n}){const s=k.EDialog,t=r,a=k.isFun,{conf:o,switchConfirmRef:l,ruleFormRef:d}=M(t);return n({conf:o}),(f,h)=>{const c=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[r.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[r.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(f.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[r.option.table?.fitHeight?"col":""]])},[r.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(m.ElForm),{model:e.unref(o).search.form,inline:"",size:r.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(o).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o).search.column.list,i=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i.key},[(typeof i.show?.search=="function"?i.show?.search(e.unref(o).search.form):i.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof i.text?.search?.label=="string"?i.text?.search?.label:i.label,class:e.normalizeClass({"hide-label":typeof i.text?.search?.label=="boolean"?!i.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+i.key,{row:e.unref(o).search.form},()=>[i.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.input||i.options?.input,e.toHandlers(i.options?.search?.input?.on||i.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i,e.unref(g).tCurd("placeholderSelect")),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.switch||i.options?.switch,e.toHandlers(i.options?.search?.switch?.on||i.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.options?.switch?.activeValue,label:i.options?.switch?.activeLabel,value:i.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.options?.switch?.inactiveValue,label:i.options?.switch?.inactiveLabel,value:i.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i,e.unref(g).tCurd("placeholderSelect")),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.select||i.options?.select,e.toHandlers(i.options?.search?.select?.on||i.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,disabled:i.disabled?.search,ref_for:!0},i.options?.search?.datetime||i.options?.datetime,e.toHandlers(i.options?.search?.datetime?.on||i.options?.datetime?.on||{})),null,16,["modelValue","onUpdate:modelValue","disabled"])):i.type&&e.unref(B).customComponent[i.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[i.type]),e.mergeProps({key:4,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,ref_for:!0},i.options?.search?.[i.type]||i.options?.[i.type],e.toHandlers(i.options?.search?.[i.type]?.on||i.options?.[i.type]?.on||{}),{disabled:i.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(f.$slots,"search-"+i.key+"-right",{row:e.unref(o).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(o).search.form}),r.option.tools?.search||r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0},{default:e.withCtx(()=>[r.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(o).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:e.unref(o).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(o).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ae,[e.unref(a)(r.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:h[0]||(h[0]=i=>e.unref(o).update.open(e.unref(s).Insert)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.table?.selectable&&e.unref(a)(r.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:h[1]||(h[1]=i=>e.unref(o).remove.open(e.unref(o).table.selection.list)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:h[2]||(h[2]=i=>e.unref(o).table.expand.all()),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:e.unref(o).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[r.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportAll")),1)]),_:1})]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",de,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(o).export.loading,size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(f.$slots,"tools-right"),e.unref(o).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(o).page.num,"onUpdate:currentPage":h[3]||(h[3]=i=>e.unref(o).page.num=i),"page-size":e.unref(o).page.size,"onUpdate:pageSize":h[4]||(h[4]=i=>e.unref(o).page.size=i),background:"","page-sizes":e.unref(o).page.sizeList,"pager-count":e.unref(o).page.pagerCount,layout:e.unref(o).page.layout,total:e.unref(o).page.total,size:r.option.size?.table,onSizeChange:e.unref(o).table.getList,onCurrentChange:e.unref(o).table.getList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),r.option.tools?.refresh===void 0||r.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:h[5]||(h[5]=(...i)=>e.unref(o).table.getList&&e.unref(o).table.getList(...i))},[e.createVNode(J)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[r.option.table?.fitHeight?"col ":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[r.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:e.unref(o).table.data,border:r.option.table?.border===void 0?!0:r.option.table?.border,onSelectionChange:e.unref(o).table.selection.change,onSortChange:e.unref(o).table.sort.change,"expand-row-keys":e.unref(o).table.expand.rowKeys,onExpandChange:e.unref(o).table.expand.change},r.option.table,e.toHandlers(r.option.table?.on||{})),{default:e.withCtx(()=>[r.option.table?.selectable||e.unref(a)(r.option.tools?.delete)||r.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof r.option.table?.selectable=="function"?r.option.table?.selectable:void 0,width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(P,{conf:e.unref(o),columnList:e.unref(o).table.column.list,option:r.option},e.createSlots({_:2},[e.renderList(f.$slots,(i,p)=>({name:p,fn:e.withCtx(y=>[e.renderSlot(f.$slots,p,e.normalizeProps(e.guardReactiveProps(y||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(r.option.table?.add)||e.unref(a)(r.option.table?.update)||e.unref(a)(r.option.table?.delete)||e.unref(a)(r.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:1,width:e.unref(o).table.op.width(e.unref(a)(r.option.table?.add),e.unref(a)(r.option.table?.update),e.unref(a)(r.option.table?.delete),e.unref(a)(r.option.table?.view),f.$slots["table-op-left"],f.$slots["table-op-right"]),align:"center",fixed:"right"},r.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("operation")),1)])]),default:e.withCtx(({row:i})=>[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:i}),r.option.table?.inlineEdit&&e.unref(o).inlineEdit.row===i?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(o).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(o).inlineEdit.submit,loading:e.unref(o).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(f.$slots,"table-op-edit-right",{row:i})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(r.option.table?.add,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:p=>e.unref(o).update.open(e.unref(s).Insert,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.view,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:p=>e.unref(o).update.open(e.unref(s).View,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.update,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:p=>e.unref(o).update.open(e.unref(s).Update,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.delete,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:p=>e.unref(o).remove.open([i])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-op-right",{row:i})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[c,e.unref(o).table.loading]])],2)],2),e.createElementVNode("div",fe,[(r.option.page?.show===void 0||r.option.page?.show)&&!e.unref(o).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(o).page.num,"onUpdate:currentPage":h[6]||(h[6]=i=>e.unref(o).page.num=i),"page-size":e.unref(o).page.size,"onUpdate:pageSize":h[7]||(h[7]=i=>e.unref(o).page.size=i),background:"","page-sizes":e.unref(o).page.sizeList,"pager-count":e.unref(o).page.pagerCount,layout:e.unref(o).page.layout,total:e.unref(o).page.total,size:r.option.size?.table,onSizeChange:e.unref(o).table.getList,onCurrentChange:e.unref(o).table.getList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(f.$slots,"box-right")],2),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:e.unref(o).update.show,"onUpdate:modelValue":h[8]||(h[8]=i=>e.unref(o).update.show=i),title:e.unref(o).update.title,"before-close":e.unref(o).update.close},r.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",pe,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(o).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(o).update.type!==e.unref(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)]),_:1},8,["size"])])]),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,size:r.option.size?.form},{default:e.withCtx(()=>[e.unref(o).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(o).update.formColumn,i=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)((()=>{const p=[],y=w=>{w?.item?.children?y(w.item.children):p.push(...w.map(C=>C.item?.show?.form))};return y(i),p})(),e.unref(o).update.form,e.unref(o).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:r.option.form?.stripe===void 0?!0:r.option.form?.stripe}])},[e.renderSlot(f.$slots,"form-start",{row:e.unref(o).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,p=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(p.item.show?.form,e.unref(o).update.form,e.unref(o).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([p.item.form.span>0?`col-${e.unref(o).getColumnSpan(p,i)}`:"col",`form-item-col-${p.item.key}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.item.children?p.children:[p],y=>(e.openBlock(),e.createBlock(oe,{key:y.item.key,conf:e.unref(o),item:y},e.createSlots({_:2},[e.renderList(f.$slots,(w,C)=>({name:C,fn:e.withCtx(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","size"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:e.unref(o).remove.show,"onUpdate:modelValue":h[9]||(h[9]=i=>e.unref(o).remove.show=i),title:e.unref(o).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",me,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(o).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(o).remove.submit,loading:e.unref(o).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(g).tCurd("confirmDeleteMessage",e.unref(o).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(H,{ref_key:"switchConfirmRef",ref:l,size:r.option.size?.form},null,8,["size"])],2)}}});class he{static async download(n,s="download.png"){const t=document.createElement("a");t.style.display="none",t.href=n,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(n)}static exportJSONFile=(n,s)=>{const t=new Blob([JSON.stringify(n)],{type:"application/json"}),a=URL.createObjectURL(t),o=document.createElement("a");o.href=a,o.download=`${s||"config"}.json`,o.click()};static importFile=async n=>new Promise((s,t)=>{const a=document.createElement("input");a.type="file";const o=n?.accept||".json";a.accept=o,a.style.display="none",a.onchange=l=>{const d=l.target.files[0];if(!d){k.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=()=>{k.fail("文件读取失败"),t("文件读取失败")},f.readAsText(d),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(r,n)=>{if(r.component("TCurd",U),r.component("TFormList",D),r.component("TColumn",z),n?.customComponent){B.customComponent=n.customComponent;for(const s in n.customComponent)r.component(s,n.customComponent[s])}},ge={install:T};u.ArrUtil=E,u.ExcelUtil=F,u.TColumn=z,u.TCurd=U,u.TFile=he,u.TForm=B,u.TFormConfig=b,u.TFormI18n=g,u.TFormList=D,u.TSys=k,u.default=ge,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(u,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("element-plus"),require("vue-router"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue-router","vue"],m):(u=typeof globalThis<"u"?globalThis:u||self,m(u.cc1Form={},u.ElementPlus,u.VueRouter,u.Vue))})(this,(function(u,m,be,e){"use strict";class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...d)=>Array.isArray(n)?n.some(t=>typeof t=="function"?t(...d):t):typeof n=="function"?n(...d):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async n=>{if(!k.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const d=await k.moduleObj[n]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(n,d,t={}){const a=Date.now();if(!this.tipMessages[n]||a-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=a;const o=Object.assign({message:n,type:d},t);m.ElMessage(o),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,d={})=>{this.showMessage(n,"error",d)};static success=(n,d={})=>{this.showMessage(n,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,d="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=m.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,d=!0)=>{if(d){let t=screen.width/2-500,a=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+t)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(d,t)=>{let a=document.getElementById(n.id);const o=await k.loadModule("html2canvas");try{o(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(l){let s=l.toDataURL("image/png");d(s)})}catch(l){t(l)}})}class b{static config={page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=n=>{b.config=ObjectUtil.deepMerge(b.config,n)}}class V{static customComponent={};static findOptions=(n,d)=>{const t=n.column.find(o=>o.key===d),a=o=>o.replace(/-([a-z])/g,(l,s)=>s.toUpperCase());if(t)return t.options[a(t.type)]};static setOptionsData=(n,d,t)=>{const a=V.findOptions(n,d);a&&(a.data=t)};static form={openBefore:{parentId:(n,d,t,a)=>{const o=b.config.table.rowKey;n?d.type===k.EDialog.Insert?(d.form.parentId=n[o],d.form.sort=n.children.length+1):d.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=t.length+1),V.setOptionsData(a,"parentId",[{[o]:"0",title:"根",children:t}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,d,t)=>{d[n]||(d[n]=[]);const a=b.config.table.rowKey;d[n].forEach(o=>{t.forEach(l=>{let s=l.default??"";l.type==="number"&&(s=l.default??0),l.type==="boolean"&&(s=l.default??!1),l.type==="time"&&(s=l.default??new Date),o[l.value]===void 0&&(o[l.value]=s)}),o[a]||(o[a]=E.getIdFun())})};static add=(n,d,t,a)=>{const o=JSONUtil.cp(t);E.setId(n,d,t);const l=b.config.table.rowKey;d[n].push(o.reduce((s,f)=>{let h=f.default??"";return f.type==="number"&&(h=f.default??0),f.type==="boolean"&&(h=f.default??!1),f.type==="time"&&(h=f.default??new Date),s[f.value]=h,s},{[l]:E.getIdFun()})),a?.(d)};static remove=(n,d,t,a)=>{const o=b.config.table.rowKey;d[n]=d[n].filter(l=>l[o]!==t[o]),a?.(d)};static getNoIdData=(n,d)=>{const t=JSONUtil.cp(n),a=b.config.table.rowKey;return t.forEach(o=>{o[a]&&delete o[a],d&&o[d]&&E.getNoIdData(o[d],d)}),t}}const O={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},D=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(r,{emit:n}){const d=r,t=e.reactive({show:!1,add:(o,l,s)=>{E.add(o,l,s,()=>{a("change")})},remove:(o,l,s)=>{E.remove(o,l,s,()=>{a("change")})}});e.onMounted(()=>{E.setId(d.field,d.row,d.itemFields),t.show=!0});const a=n;return(o,l)=>{const s=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return t.show?(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(o.$slots,"list-start",{row:r.row}),e.createElementVNode("div",null,[e.createVNode(s,{link:"",type:"primary",onClick:l[0]||(l[0]=h=>t.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加")])),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.row[r.field],h=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(o.$slots,"item-start",{item:h,row:r.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.itemFields,c=>(e.openBlock(),e.createBlock(f,{modelValue:h[c.value],"onUpdate:modelValue":i=>h[c.value]=i,style:e.normalizeStyle({width:r.inputWidth}),class:e.normalizeClass(r.inputClass),placeholder:c[r.label]||c[r.value],onChange:l[1]||(l[1]=i=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(o.$slots,"item-end",{item:h,row:r.row}),e.createVNode(s,{link:"",type:"danger",onClick:c=>t.remove(r.field,r.row,h)},{default:e.withCtx(()=>l[3]||(l[3]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),e.renderSlot(o.$slots,"list-end",{row:r.row})])):e.createCommentVNode("",!0)}}}),I={class:"row curd-row"},z=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(r,{expose:n}){const d=k.isFun,t=k.EDialog,a=e.ref(),o=r,l=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:s=>s.disabled?.[(o.type||t.Insert)===t.Insert?"create":"update"],initColumnForm:async()=>{const s=o.option;l.formColumn=[];const f=[],h=o.option.form?.maxSpan||12,c=o.option.form?.defaultSpan||h;let i=[];const p=y=>{if(l.formDefault[y.key]=y.value,y.isForm){y.form=y.form||{span:c},y.form.span=y.form.span??c;let w=y.form.span,C=i.reduce((S,ye)=>S+ye.span,w);const B=i.length;i.push({item:y,span:w}),(B===1&&i[0].span===0||C>=h||w===0&&B>1)&&(f.push(i),i=[]),y.rules&&(l.rules[y.key]=y.rules)}};s.column.forEach(y=>{y.isForm=!0,p(y)}),i.length>0&&f.push(i),l.formColumn=f,l.form=JSONUtil.cp(l.formDefault)},init:async()=>{l.show=!1,await e.nextTick(),l.initColumnForm()}});return l.initColumnForm(),n({ref:a,conf:l}),(s,f)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:a,model:l.form,rules:l.rules},{default:e.withCtx(()=>[l.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.formColumn,h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(s.$slots,"form-start",{row:l.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(c.item.show?.form,l.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"form-"+c.item.key+"-start",{row:l.form,item:c.item}),e.renderSlot(s.$slots,"form-"+c.item.key,{row:l.form,item:c.item},()=>[c.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.input,e.toHandlers(c.item.options?.input?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.switch,e.toHandlers(c.item.options?.switch?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.select,e.toHandlers(c.item.options?.select?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.item.options?.select?.data,i=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:3,row:l.form,field:c.item.key,ref_for:!0},c.item.options?.list,e.toHandlers(c.item.options?.list?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):c.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.treeSelect,e.toHandlers(c.item.options?.treeSelect?.on||{}),{disabled:l.getDisabled(c.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.datetime,e.toHandlers(c.item.options?.datetime?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):c.item.type&&e.unref(V).customComponent[c.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[c.item.type]),e.mergeProps({key:6,modelValue:l.form[c.item.key],"onUpdate:modelValue":i=>l.form[c.item.key]=i,ref_for:!0},c.item.options?.[c.item.type],e.toHandlers(c.item.options?.[c.item.type]?.on||{}),{disabled:l.getDisabled(c.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(s.$slots,"form-"+c.item.key+"-end",{row:l.form,item:c.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(s.$slots,"form-end",{row:l.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function ke(r){return r}const x={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class g{static t(n,...d){if(typeof n=="function")return n(...d);n=String(n);let t=0;return n.replace(/{([^}]+)}/g,(a,o)=>t<d.length?String(d[t++]):`{${o}}`)}static setI18n=n=>{g.curd=ObjectUtil.deepMerge(g.curd,n)};static tCurd(n,...d){return this.t(this.curd[n],...d)}static curd=x}class F{static exportToExcel=async(n,d,t)=>{if(!n||n.length===0)return;const a=await k.loadModule("xlsx"),o=n.map(f=>{const h={};return d.forEach(c=>{h[c.label]=f[c.key]}),h}),l=a.utils.json_to_sheet(o),s=a.utils.book_new();a.utils.book_append_sheet(s,l,"Sheet1"),t?typeof t=="function"&&(t=t()):t=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(s,`${t}.xlsx`)}}const N=k.EDialog,M=r=>{const n=e.ref(),d=e.ref(),t=e.reactive({option:r.option,search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,o=g.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${o}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(a[l.key]=t.search.form[l.key])});const o=r.option.search?.before?.(a);return o&&(a=o),a},reset:()=>{const a=t.search.formDefault;Object.keys(a).forEach(o=>{r.option.search?.resetMode==="none"?a[o]=void 0:a[o]=t.search.formDefault[o]}),t.search.form=JSONUtil.cp(a),t.page.num=1,r.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{num:1,total:0,layout:r.option.page?.layout||b.config.pagination.layout,showTools:r.option.page?.showTools||b.config.pagination.showTools,size:r.option.page?.size||b.config.pagination.size,sizeList:r.option.page?.sizeList||b.config.pagination.pageSizes,pagerCount:r.option.page?.pagerCount||b.config.pagination.pagerCount},table:{op:{width:(...a)=>a.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,o)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const a=o=>{let l=[];return o.forEach(s=>{l.push(s[r.option.table.rowKey]),s.children&&s.children.length>0&&(l=l.concat(a(s.children)))}),l};t.table.expand.rowKeys=a(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const a=r.option.api.list;try{await t.initApiData("init");let o={};if(t.table.sort.prop){const{props:p,order:y}=b.config.table.sort;o={[p.field]:t.table.sort.prop,[y.field]:t.table.sort.order}}const l=await a({[b.config.page.size]:t.page.size,[b.config.page.num]:t.page.num,...t.search.getFormData(),...o}),s=b.config.result,f=l.data||{[s.list]:l};let h=(Array.isArray(f[s.list]),f[s.list]);const c=t.update.formColumn.flat(),i=JSONUtil.cp(h).map(p=>(Object.keys(p).forEach(w=>{const C=c.find(B=>B.item.key===w);C&&["select","radio"].includes(C.item.type)&&(C.item.table.format||(C.item.table.format=B=>C.item.options[C.item.type].data?.find(S=>S.value==B[w])?.label||B[w]))}),p));t.table.data=r.option.data?await r.option.data(i,h):i,t.page.total=f[s.total]||0}catch(o){console.error(o)}finally{t.table.loading=!1}},selection:{list:[],change:a=>{t.table.selection.list=a}},sort:{prop:"",order:"",change:a=>{b.config.table.sort.resetPage&&(t.page.num=1);const o=b.config.table.sort;if(o.change){o.change(a,t);return}t.table.sort.prop=a.prop,a.order===null?t.table.sort.order="":t.table.sort.order=a.order==="ascending"?o.order.asc:o.order.desc,t.table.getList()}}},export:{run:{start:async a=>{let o=await t.export.run[a](),l=r.option.column;const s=JSONUtil.cp({data:o,columns:l}),f=r.option.tools?.export||{};f.before&&f.before(s),F.exportToExcel(s.data,s.columns,f.fileName)},select:()=>{if(t.table.selection.list.length===0)throw k.fail(g.tCurd("selectDataToExport")),new Error(g.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw k.fail(g.tCurd("noData")),new Error(g.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[b.config.page.size]:t.page.size,[b.config.page.num]:t.page.num,...t.search.getFormData()});return}const a=r.option.api.list,o=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(o.data||{[b.config.result.list]:o})[b.config.result.list]}catch(a){console.error(a)}finally{t.export.loading=!1}}},loading:!1,click:a=>{t.export.loading||t.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>t.update.type===N.View?a.disabled?.view===void 0?!0:a.disabled?.view:a.disabled?.[t.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(r.option.form?.editAll)return a;let o={[r.option.table?.rowKey]:t.update.edit.data[r.option.table?.rowKey]};return Object.keys(t.update.edit.data).forEach(l=>{a[l]!==t.update.edit.data[l]&&(o[l]=a[l])}),o}},view:{},open:(a,o)=>{t.update.showContent||FunUtil.throttle(async()=>{k.loading(!0);try{await t.initApiData("update");const l=a===N.Insert;if(!l&&r.option.table?.inlineEdit){t.inlineEdit.open(o);return}t.update.type=a,t.update.edit.data=o,t.update.title=g.tCurd(l?"add":a===N.View?"view":"edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:o),await r.option.form?.openBefore?.(o,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(o,t.update)}catch(l){console.error(l)}finally{k.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await d.value?.validate(async(s,f)=>new Promise((h,c)=>{s||(k.fail(g.tCurd("checkFormData")),c(!1)),h()})),t.update.loading=!0;const a=t.update.type===N.Insert?r.option.api.create:r.option.api.update;try{await r.option.form?.submitBefore?.(t.update.form,t.update)}catch{t.update.loading=!1;return}let o=JSONUtil.cp(t.update.form);delete o.children;const l=new Set(r.option.column.filter(s=>s.type==="datetime").map(s=>s.key));Object.keys(o).forEach(s=>{if(l.has(s)&&o[s]!=null){const f=new Date(o[s]).getTime();isNaN(f)||(o[s]=f)}});try{if(!a)return;await a({...o}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(o,t.update)}catch(s){console.error(s)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{t.inlineEdit.row=a,t.inlineEdit.form=JSONUtil.cp(a)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const a=r.option.api.update;let o=JSONUtil.cp(t.inlineEdit.form);delete o.children;try{if(!a)return;await a({...o}),t.inlineEdit.close(),await t.table.getList(),k.success(g.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:g.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:a=>{if(a.length===0){k.fail(g.tCurd("selectDataToDelete"));return}t.remove.items=a,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const a=r.option.api.delete;try{if(!a)return;await a({[r.option.table?.rowKey]:t.remove.items.map(o=>o[r.option.table?.rowKey]),items:t.remove.items}),k.success(g.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(o){console.error(o)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},apiDataMap:{},initApiData:async a=>{const o=[],l=s=>{if(s.children&&s.children.length){s.children.forEach(f=>l(f));return}if(s.type==="select"&&s.options?.select?.dataApi&&s.options?.select?.dataApiConfig?.[a]){if(t.apiDataMap[s.key]&&s.options?.select?.dataApiConfig?.once)return;const f=(async()=>{try{let h=await s.options?.select?.dataApi?.();if(h){const c=s.options?.select?.dataPath;c&&(h=ObjectUtil.getPathValue(h,c)),s.options.select.data=h,t.apiDataMap[s.key]=h}}catch{}})();o.push(f)}};return r.option.column.forEach(s=>{l(s)}),await Promise.all(o),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=g.tCurd("noData"),r.option.size=r.option.size||{},a.table.size=r.option.size.table||a.size.table,a.form.size=r.option.size.form||a.size.form,a.size.search=r.option.size.search||a.size.search;const o=ObjectUtil.deepMerge(a,r.option||{});Object.keys(o).forEach(l=>{r.option[l]=o[l]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:g.tCurd("switchOn"),inactiveLabel:g.tCurd("switchOff")}});const o=l=>{for(const s in a){if(s==="table"){if(l.table=ObjectUtil.deepMerge(a.table,l.table||{}),l.children){l.children.forEach(f=>{o(f)});return}}else s==="type"?l.type=l.type||a.type:l[s]=ObjectUtil.deepMerge(a[s],l[s]||{});l.options=l.options||{},l.options[l.type]=l.options[l.type]||{},l.options[l.type].size=r.option.size.form,l.options.search=l.options.search||JSONUtil.cp(l.options),l.options.search[l.type]=l.options.search[l.type]||{},l.options.search[l.type].size=r.option.size.search,l.table=ObjectUtil.deepMerge(l.table,l.options[l.type].table||{})}l.type==="switch"&&(l.options.switch.tableBeforeChange=async(s,f)=>{const h=l.options?.switch;try{await n.value?.open({title:g.tCurd("confirmModify"),content:g.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[r.option.table?.rowKey]:f[r.option.table?.rowKey],[s]:f[s]===h.activeValue?h.inactiveValue:h.activeValue,final(c,i,p){t.table.loading=!1}}),t.table.loading=!1,k.success(g.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(c){return console.error(c),!1}finally{t.table.loading=!1}}catch{return!1}}),l.type==="treeSelect"&&(l.options.treeSelect.rowKey=r.option.table?.rowKey,l.options.treeSelect.nodeKey=r.option.table?.rowKey)};r.option.column.forEach(o),r.option.table?.column?.forEach(o)},getColumnSpan:(a,o)=>{if(a.item.form?.spanCol){const l=b.config.form.defaultSpan,f=o.filter(h=>!k.isFun(h.item.show?.form,t.update.form,t.update.type)).reduce((h,c)=>h+(c.item.form?.span||l),0);return(a.item?.form.span||l)+f}return a.item.form.span},initColumnForm:()=>{const a=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const o=[],l=r.option.form?.maxSpan||12,s=r.option.form?.defaultSpan||l/2;let f=[];const h=p=>{if(p.children){t.table.column.show.list.push(p.key),p.children.forEach(y=>{h(y)});return}if(t.update.formDefault[p.key]=p.value,p.table.table&&(p.show.table&&t.table.column.show.list.push(p.key),p.table.table&&t.table.column.show.listSource.push(p.key)),!(p.isForm&&typeof p.show?.form=="boolean")||p.show?.form){p.form=p.form||{span:s},p.form.span=p.form.span??s;let y=p.form.span,w=f.reduce((B,S)=>B+S.span,y);const C=f.length;if(f.push({item:p,span:y}),(C===1&&f[0].span===0||w>=l||y===0&&C>1)&&(o.push(f),f=[]),p.rules){const B={input:g.tCurd("placeholderInput"),select:g.tCurd("placeholderSelect")},S=(B[p.type]||B.input)+p.label;t.update.rules[p.key]=typeof p.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:p.rules}}},c=(p,y)=>{p.isForm=y,Array.isArray(p.children)&&p.children.forEach(w=>c(w,y))};a.column.forEach(p=>{p.isForm=!0,c(p,!0),h(p)}),r.option.table?.column?.forEach(p=>{c(p,!1),h(p)}),t.search.column.list=a.column.concat(a.table?.column||[]),t.table.column.list=t.search.column.list.filter(p=>p.table?.table),t.search.column.list.sort((p,y)=>p.sort?.search-y.sort?.search),t.table.column.list.sort((p,y)=>p.sort?.table-y.sort?.table),f.length>0&&o.push(f),t.update.formColumn=o;const i=r.option.search?.formDefault;i&&Object.keys(i).forEach(p=>{t.search.formDefault[p]=i[p]}),a.column.forEach(p=>{p.show?.search||(t.search.formDefault[p.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{r.option.init!==!1&&t.table.getList()}),{conf:t,switchConfirmRef:n,ruleFormRef:d}},j={class:"dialog-footer"},H=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(r,{expose:n}){const d=e.ref(!1),t=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let o=null,l=null;const s=c=>(c?.title&&(t.value=c.title),c?.content&&(a.value=c.content),d.value=!0,new Promise((i,p)=>{o=i,l=p})),f=()=>{d.value=!1,o?.(!0),o=null,l=null},h=()=>{d.value=!1,l?.(new Error("用户取消操作")),o=null,l=null};return n({open:s}),(c,i)=>{const p=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=y=>d.value=y),title:t.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(p,{size:c.size},{default:e.withCtx(()=>[e.createElementVNode("span",j,[e.createVNode(e.unref(m.ElButton),{onClick:h},{default:e.withCtx(()=>i[1]||(i[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:f},{default:e.withCtx(()=>i[2]||(i[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"])}}}),U=(r,n)=>{const d=r.__vccOpts||r;for(const[t,a]of n)d[t]=a;return d},R={},A={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function K(r,n){return e.openBlock(),e.createElementBlock("svg",A,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)]))}const J=U(R,[["render",K]]),W={},q={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function G(r,n){return e.openBlock(),e.createElementBlock("svg",q,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)]))}const X=U(W,[["render",G]]),Q={class:"row flex-center table-header-label inline"},Y={class:"table-header-tooltip"},Z=["onClick","innerHTML"],P=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(r){const n=k.isFun,d=e.getCurrentInstance().type;return(t,a)=>{const o=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[t.conf.table.column.show.list.includes(l.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:l.key,label:l.label,ref_for:!0},l.table),{header:e.withCtx(()=>[e.renderSlot(t.$slots,"table-header-"+l.key,{item:l},()=>[e.createElementVNode("div",Q,[l.table?.tooltip?(e.openBlock(),e.createBlock(o,{key:0,effect:"dark",content:l.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Y,[e.createVNode(X)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.label),1)])])]),default:e.withCtx(({row:s})=>[l.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(d)),{conf:t.conf,columnList:l.children,option:t.option},e.createSlots({_:2},[e.renderList(t.$slots,(f,h)=>({name:h,fn:e.withCtx(c=>[e.renderSlot(t.$slots,h,e.mergeProps({ref_for:!0},c||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(l.show?.form,t.conf.inlineEdit.form,e.unref(k).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.inlineEdit.row===s&&(l.type==="input"||l.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.conf.inlineEdit.form[l.key],"onUpdate:modelValue":f=>t.conf.inlineEdit.form[l.key]=f,ref_for:!0},l.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):l.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:t.conf.inlineEdit.form[l.key],"onUpdate:modelValue":f=>t.conf.inlineEdit.form[l.key]=f,ref_for:!0},l.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options?.select?.data,f=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(t.$slots,"table-"+l.key,{key:1,row:s,item:l},()=>[e.unref(V).customComponent[l.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[l.type??""]?.table),e.mergeProps({key:0,modelValue:s[l.key],"onUpdate:modelValue":f=>s[l.key]=f,ref_for:!0},l.options?.[l.type??""],e.toHandlers(l.options?.[l.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:s[l.key],"onUpdate:modelValue":f=>s[l.key]=f,"before-change":()=>l.options?.switch?.tableBeforeChange?.(l.key,s),ref_for:!0},l.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":l.table?.click?.color}),class:e.normalizeClass({"table-text-click":l.table?.click?.callback}),onClick:f=>l.table?.click?.callback?.(s),innerHTML:l.table?.format?l.table?.format(s):s[l.key]},null,14,Z))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),_={class:"row form-item-content",style:{width:"100%"}},v={class:"col"},ee={class:"col"},te=["innerHTML"],oe=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(r){return(n,d)=>(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof n.item.item.text?.form?.label=="boolean"?!n.item.item.text?.form?.label:!1}),label:typeof n.item.item.text?.form?.label=="string"?n.item.item.text?.form?.label:n.item.item.label,prop:n.item.item.key,"label-width":n.item.item.form?.labelWidth||n.conf.option.form?.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",_,[e.renderSlot(n.$slots,"form-"+n.item.item.key+"-start",{row:n.conf.update.form,item:n.item.item}),e.createElementVNode("div",v,[e.createElementVNode("div",ee,[e.renderSlot(n.$slots,"form-"+n.item.item.key,{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[0]||(d[0]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.input,e.toHandlers(n.item.item.options?.input?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[1]||(d[1]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.switch,{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[2]||(d[2]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.select,e.toHandlers(n.item.item.options?.select?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(m.ElRadioGroup),e.mergeProps({key:3,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[3]||(d[3]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.radio,e.toHandlers(n.item.item.options?.radio?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(e.unref(m.ElRadio),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):n.item.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:4,row:n.conf.update.form,field:n.item.item.key},n.item.item.options?.list,e.toHandlers(n.item.item.options?.list?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:5,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[4]||(d[4]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.treeSelect,e.toHandlers(n.item.item.options?.treeSelect?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):n.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:6,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[5]||(d[5]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.datetime,e.toHandlers(n.item.item.options?.datetime?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):n.item.item.type&&(e.unref(V).customComponent[n.item.item.type]||e.unref(V).customComponent[n.item.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[n.item.item.type]?.form||e.unref(V).customComponent[n.item.item.type]),e.mergeProps({key:7,modelValue:n.conf.update.form[n.item.item.key],"onUpdate:modelValue":d[6]||(d[6]=t=>n.conf.update.form[n.item.item.key]=t)},n.item.item.options?.[n.item.item.type],e.toHandlers(n.item.item.options?.[n.item.item.type]?.on||{}),{disabled:n.conf.update.getDisabled(n.item.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-right",{row:n.conf.update.form,item:n.item.item})]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-tip",{row:n.conf.update.form,item:n.item.item},()=>[n.item.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:n.item.item.form?.tipText},null,8,te)):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+n.item.item.key+"-end",{row:n.conf.update.form,item:n.item.item})])]),_:3},8,["class","label","prop","label-width"]))}}),ne={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ae={class:"flex items-center",style:{gap:"10px"}},re={key:0},ie={key:1},se={key:2},de={class:"export-btn"},ce={class:"flex items-center table-tools-right",style:{gap:"10px"}},fe={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},pe={class:"dialog-footer"},me={class:"dialog-footer"},$=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(r,{expose:n}){const d=k.EDialog,t=r,a=k.isFun,{conf:o,switchConfirmRef:l,ruleFormRef:s}=M(t);return n({conf:o}),(f,h)=>{const c=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[r.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[r.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(f.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[r.option.table?.fitHeight?"col":""]])},[r.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(m.ElForm),{model:e.unref(o).search.form,inline:"",size:r.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(o).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(o).search.column.list,i=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i.key},[(typeof i.show?.search=="function"?i.show?.search(e.unref(o).search.form):i.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof i.text?.search?.label=="string"?i.text?.search?.label:i.label,class:e.normalizeClass({"hide-label":typeof i.text?.search?.label=="boolean"?!i.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+i.key,{row:e.unref(o).search.form},()=>[i.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.input||i.options?.input,e.toHandlers(i.options?.search?.input?.on||i.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i,e.unref(g).tCurd("placeholderSelect")),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.switch||i.options?.switch,e.toHandlers(i.options?.search?.switch?.on||i.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.options?.switch?.activeValue,label:i.options?.switch?.activeLabel,value:i.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:i.options?.switch?.inactiveValue,label:i.options?.switch?.inactiveLabel,value:i.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,placeholder:e.unref(o).search.getPlaceholder(i,e.unref(g).tCurd("placeholderSelect")),clearable:"",disabled:i.disabled?.search,ref_for:!0},i.options?.search?.select||i.options?.select,e.toHandlers(i.options?.search?.select?.on||i.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):i.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,disabled:i.disabled?.search,ref_for:!0},i.options?.search?.datetime||i.options?.datetime,e.toHandlers(i.options?.search?.datetime?.on||i.options?.datetime?.on||{})),null,16,["modelValue","onUpdate:modelValue","disabled"])):i.type&&e.unref(V).customComponent[i.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[i.type]),e.mergeProps({key:4,modelValue:e.unref(o).search.form[i.key],"onUpdate:modelValue":p=>e.unref(o).search.form[i.key]=p,ref_for:!0},i.options?.search?.[i.type]||i.options?.[i.type],e.toHandlers(i.options?.search?.[i.type]?.on||i.options?.[i.type]?.on||{}),{disabled:i.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(f.$slots,"search-"+i.key+"-right",{row:e.unref(o).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(o).search.form}),r.option.tools?.search||r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0},{default:e.withCtx(()=>[r.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(o).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:e.unref(o).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(o).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ae,[e.unref(a)(r.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:h[0]||(h[0]=i=>e.unref(o).update.open(e.unref(d).Insert)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.table?.selectable&&e.unref(a)(r.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:h[1]||(h[1]=i=>e.unref(o).remove.open(e.unref(o).table.selection.list)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:h[2]||(h[2]=i=>e.unref(o).table.expand.all()),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:e.unref(o).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[r.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("exportAll")),1)]),_:1})]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",de,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(o).export.loading,size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(f.$slots,"tools-right"),e.unref(o).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(o).page.num,"onUpdate:currentPage":h[3]||(h[3]=i=>e.unref(o).page.num=i),"page-size":e.unref(o).page.size,"onUpdate:pageSize":h[4]||(h[4]=i=>e.unref(o).page.size=i),background:"","page-sizes":e.unref(o).page.sizeList,"pager-count":e.unref(o).page.pagerCount,layout:e.unref(o).page.layout,total:e.unref(o).page.total,size:r.option.size?.table,onSizeChange:e.unref(o).table.getList,onCurrentChange:e.unref(o).table.getList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),r.option.tools?.refresh===void 0||r.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:h[5]||(h[5]=(...i)=>e.unref(o).table.getList&&e.unref(o).table.getList(...i))},[e.createVNode(J)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[r.option.table?.fitHeight?"col ":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[r.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:e.unref(o).table.data,border:r.option.table?.border===void 0?!0:r.option.table?.border,onSelectionChange:e.unref(o).table.selection.change,onSortChange:e.unref(o).table.sort.change,"expand-row-keys":e.unref(o).table.expand.rowKeys,onExpandChange:e.unref(o).table.expand.change},r.option.table,e.toHandlers(r.option.table?.on||{})),{default:e.withCtx(()=>[r.option.table?.selectable||e.unref(a)(r.option.tools?.delete)||r.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof r.option.table?.selectable=="function"?r.option.table?.selectable:void 0,width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(P,{conf:e.unref(o),columnList:e.unref(o).table.column.list,option:r.option},e.createSlots({_:2},[e.renderList(f.$slots,(i,p)=>({name:p,fn:e.withCtx(y=>[e.renderSlot(f.$slots,p,e.normalizeProps(e.guardReactiveProps(y||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(r.option.table?.add)||e.unref(a)(r.option.table?.update)||e.unref(a)(r.option.table?.delete)||e.unref(a)(r.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:1,width:e.unref(o).table.op.width(e.unref(a)(r.option.table?.add),e.unref(a)(r.option.table?.update),e.unref(a)(r.option.table?.delete),e.unref(a)(r.option.table?.view),f.$slots["table-op-left"],f.$slots["table-op-right"]),align:"center",fixed:"right"},r.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("operation")),1)])]),default:e.withCtx(({row:i})=>[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:i}),r.option.table?.inlineEdit&&e.unref(o).inlineEdit.row===i?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(o).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(o).inlineEdit.submit,loading:e.unref(o).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(f.$slots,"table-op-edit-right",{row:i})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(r.option.table?.add,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:p=>e.unref(o).update.open(e.unref(d).Insert,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.view,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:p=>e.unref(o).update.open(e.unref(d).View,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.update,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:p=>e.unref(o).update.open(e.unref(d).Update,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.delete,i)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:p=>e.unref(o).remove.open([i])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-op-right",{row:i})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[c,e.unref(o).table.loading]])],2)],2),e.createElementVNode("div",fe,[(r.option.page?.show===void 0||r.option.page?.show)&&!e.unref(o).page.showTools?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),e.mergeProps({key:0,"current-page":e.unref(o).page.num,"onUpdate:currentPage":h[6]||(h[6]=i=>e.unref(o).page.num=i),"page-size":e.unref(o).page.size,"onUpdate:pageSize":h[7]||(h[7]=i=>e.unref(o).page.size=i),background:"","page-sizes":e.unref(o).page.sizeList,"pager-count":e.unref(o).page.pagerCount,layout:e.unref(o).page.layout,total:e.unref(o).page.total,size:r.option.size?.table,onSizeChange:e.unref(o).table.getList,onCurrentChange:e.unref(o).table.getList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(f.$slots,"box-right")],2),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:e.unref(o).update.show,"onUpdate:modelValue":h[8]||(h[8]=i=>e.unref(o).update.show=i),title:e.unref(o).update.title,"before-close":e.unref(o).update.close},r.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",pe,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(o).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(o).update.type!==e.unref(d).View?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(o).update.submit,loading:e.unref(o).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:s,model:e.unref(o).update.form,rules:e.unref(o).update.rules,size:r.option.size?.form},{default:e.withCtx(()=>[e.unref(o).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(o).update.formColumn,i=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)((()=>{const p=[],y=w=>{w?.item?.children?y(w.item.children):p.push(...w.map(C=>C.item?.show?.form))};return y(i),p})(),e.unref(o).update.form,e.unref(o).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:r.option.form?.stripe===void 0?!0:r.option.form?.stripe}])},[e.renderSlot(f.$slots,"form-start",{row:e.unref(o).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,p=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(p.item.show?.form,e.unref(o).update.form,e.unref(o).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([p.item.form.span>0?`col-${e.unref(o).getColumnSpan(p,i)}`:"col",`form-item-col-${p.item.key}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.item.children?p.children:[p],y=>(e.openBlock(),e.createBlock(oe,{key:y.item.key,conf:e.unref(o),item:y},e.createSlots({_:2},[e.renderList(f.$slots,(w,C)=>({name:C,fn:e.withCtx(B=>[e.renderSlot(f.$slots,C,e.mergeProps({ref_for:!0},B||{}))])}))]),1032,["conf","item"]))),128))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(f.$slots,"form-end",{row:e.unref(o).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules","size"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:e.unref(o).remove.show,"onUpdate:modelValue":h[9]||(h[9]=i=>e.unref(o).remove.show=i),title:e.unref(o).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",me,[e.createVNode(e.unref(m.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(o).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(o).remove.submit,loading:e.unref(o).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(g).tCurd("confirmDeleteMessage",e.unref(o).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(H,{ref_key:"switchConfirmRef",ref:l,size:r.option.size?.form},null,8,["size"])],2)}}});class he{static async download(n,d="download.png"){const t=document.createElement("a");t.style.display="none",t.href=n,t.setAttribute("download",d),typeof t.download>"u"&&t.setAttribute("target","_blank"),document.body.appendChild(t),t.click(),document.body.removeChild(t),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,d)=>{const t=new Blob([JSON.stringify(n)],{type:"application/json"}),a=URL.createObjectURL(t),o=document.createElement("a");o.href=a,o.download=`${d||"config"}.json`,o.click()};static importFile=async n=>new Promise((d,t)=>{const a=document.createElement("input");a.type="file";const o=n?.accept||".json";a.accept=o,a.style.display="none",a.onchange=l=>{const s=l.target.files[0];if(!s){k.fail("未选择文件"),t("未选择文件");return}const f=new FileReader;f.onload=async h=>{const c=o==".json"?JSON.parse(h.target.result):h.target.result;d(c)},f.onerror=()=>{k.fail("文件读取失败"),t("文件读取失败")},f.readAsText(s),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(r,n)=>{if(r.component("TCurd",$),r.component("TFormList",D),r.component("TColumn",z),n?.customComponent){V.customComponent=n.customComponent;for(const d in n.customComponent)r.component(d,n.customComponent[d])}},ge={install:T};u.ArrUtil=E,u.ExcelUtil=F,u.TColumn=z,u.TCurd=$,u.TFile=he,u.TForm=V,u.TFormConfig=b,u.TFormI18n=g,u.TFormList=D,u.TSys=k,u.default=ge,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -159,7 +159,7 @@ declare const conf: {
|
|
|
159
159
|
spanCol?: boolean | undefined;
|
|
160
160
|
tipText?: string | undefined;
|
|
161
161
|
} | undefined;
|
|
162
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
162
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
163
163
|
table?: {
|
|
164
164
|
table?: boolean | undefined;
|
|
165
165
|
minWidth?: any;
|
|
@@ -354,7 +354,7 @@ declare var __VLS_7: {
|
|
|
354
354
|
spanCol?: boolean | undefined;
|
|
355
355
|
tipText?: string | undefined;
|
|
356
356
|
} | undefined;
|
|
357
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
357
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
358
358
|
table?: {
|
|
359
359
|
table?: boolean | undefined;
|
|
360
360
|
minWidth?: any;
|
|
@@ -540,7 +540,7 @@ declare var __VLS_7: {
|
|
|
540
540
|
spanCol?: boolean | undefined;
|
|
541
541
|
tipText?: string | undefined;
|
|
542
542
|
} | undefined;
|
|
543
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
543
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
544
544
|
table?: {
|
|
545
545
|
table?: boolean | undefined;
|
|
546
546
|
minWidth?: any;
|
|
@@ -726,7 +726,7 @@ declare var __VLS_7: {
|
|
|
726
726
|
spanCol?: boolean | undefined;
|
|
727
727
|
tipText?: string | undefined;
|
|
728
728
|
} | undefined;
|
|
729
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
729
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
730
730
|
table?: {
|
|
731
731
|
table?: boolean | undefined;
|
|
732
732
|
minWidth?: any;
|
|
@@ -1021,7 +1021,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1021
1021
|
spanCol?: boolean | undefined;
|
|
1022
1022
|
tipText?: string | undefined;
|
|
1023
1023
|
} | undefined;
|
|
1024
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
1024
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
1025
1025
|
table?: {
|
|
1026
1026
|
table?: boolean | undefined;
|
|
1027
1027
|
minWidth?: any;
|
|
@@ -157,7 +157,7 @@ declare var __VLS_7: string, __VLS_8: {
|
|
|
157
157
|
spanCol?: boolean | undefined;
|
|
158
158
|
tipText?: string | undefined;
|
|
159
159
|
} | undefined;
|
|
160
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
160
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
161
161
|
table?: {
|
|
162
162
|
table?: boolean | undefined;
|
|
163
163
|
minWidth?: any;
|
|
@@ -343,7 +343,7 @@ declare var __VLS_7: string, __VLS_8: {
|
|
|
343
343
|
spanCol?: boolean | undefined;
|
|
344
344
|
tipText?: string | undefined;
|
|
345
345
|
} | undefined;
|
|
346
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
346
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
347
347
|
table?: {
|
|
348
348
|
table?: boolean | undefined;
|
|
349
349
|
minWidth?: any;
|
|
@@ -529,7 +529,7 @@ declare var __VLS_7: string, __VLS_8: {
|
|
|
529
529
|
spanCol?: boolean | undefined;
|
|
530
530
|
tipText?: string | undefined;
|
|
531
531
|
} | undefined;
|
|
532
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
532
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
533
533
|
table?: {
|
|
534
534
|
table?: boolean | undefined;
|
|
535
535
|
minWidth?: any;
|
|
@@ -715,7 +715,7 @@ declare var __VLS_7: string, __VLS_8: {
|
|
|
715
715
|
spanCol?: boolean | undefined;
|
|
716
716
|
tipText?: string | undefined;
|
|
717
717
|
} | undefined;
|
|
718
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
718
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
719
719
|
table?: {
|
|
720
720
|
table?: boolean | undefined;
|
|
721
721
|
minWidth?: any;
|
|
@@ -901,7 +901,7 @@ declare var __VLS_7: string, __VLS_8: {
|
|
|
901
901
|
spanCol?: boolean | undefined;
|
|
902
902
|
tipText?: string | undefined;
|
|
903
903
|
} | undefined;
|
|
904
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
904
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
905
905
|
table?: {
|
|
906
906
|
table?: boolean | undefined;
|
|
907
907
|
minWidth?: any;
|
|
@@ -192,7 +192,7 @@ export declare const curdConf: (props: {
|
|
|
192
192
|
spanCol?: boolean | undefined;
|
|
193
193
|
tipText?: string | undefined;
|
|
194
194
|
} | undefined;
|
|
195
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
195
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
196
196
|
table?: {
|
|
197
197
|
table?: boolean | undefined;
|
|
198
198
|
minWidth?: any;
|
|
@@ -439,7 +439,7 @@ export declare const curdConf: (props: {
|
|
|
439
439
|
spanCol?: boolean | undefined;
|
|
440
440
|
tipText?: string | undefined;
|
|
441
441
|
} | undefined;
|
|
442
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
442
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
443
443
|
table?: {
|
|
444
444
|
table?: boolean | undefined;
|
|
445
445
|
minWidth?: any;
|
|
@@ -635,7 +635,7 @@ export declare const curdConf: (props: {
|
|
|
635
635
|
spanCol?: boolean | undefined;
|
|
636
636
|
tipText?: string | undefined;
|
|
637
637
|
} | undefined;
|
|
638
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
638
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
639
639
|
table?: {
|
|
640
640
|
table?: boolean | undefined;
|
|
641
641
|
minWidth?: any;
|
|
@@ -849,7 +849,7 @@ export declare const curdConf: (props: {
|
|
|
849
849
|
spanCol?: boolean | undefined;
|
|
850
850
|
tipText?: string | undefined;
|
|
851
851
|
} | undefined;
|
|
852
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
852
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
853
853
|
table?: {
|
|
854
854
|
table?: boolean | undefined;
|
|
855
855
|
minWidth?: any;
|
|
@@ -1078,7 +1078,7 @@ export declare const curdConf: (props: {
|
|
|
1078
1078
|
spanCol?: boolean | undefined;
|
|
1079
1079
|
tipText?: string | undefined;
|
|
1080
1080
|
} | undefined;
|
|
1081
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
1081
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
1082
1082
|
table?: {
|
|
1083
1083
|
table?: boolean | undefined;
|
|
1084
1084
|
minWidth?: any;
|
|
@@ -196,7 +196,7 @@ declare const conf: {
|
|
|
196
196
|
spanCol?: boolean | undefined;
|
|
197
197
|
tipText?: string | undefined;
|
|
198
198
|
} | undefined;
|
|
199
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
199
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
200
200
|
table?: {
|
|
201
201
|
table?: boolean | undefined;
|
|
202
202
|
minWidth?: any;
|
|
@@ -443,7 +443,7 @@ declare const conf: {
|
|
|
443
443
|
spanCol?: boolean | undefined;
|
|
444
444
|
tipText?: string | undefined;
|
|
445
445
|
} | undefined;
|
|
446
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
446
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
447
447
|
table?: {
|
|
448
448
|
table?: boolean | undefined;
|
|
449
449
|
minWidth?: any;
|
|
@@ -639,7 +639,7 @@ declare const conf: {
|
|
|
639
639
|
spanCol?: boolean | undefined;
|
|
640
640
|
tipText?: string | undefined;
|
|
641
641
|
} | undefined;
|
|
642
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
642
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
643
643
|
table?: {
|
|
644
644
|
table?: boolean | undefined;
|
|
645
645
|
minWidth?: any;
|
|
@@ -853,7 +853,7 @@ declare const conf: {
|
|
|
853
853
|
spanCol?: boolean | undefined;
|
|
854
854
|
tipText?: string | undefined;
|
|
855
855
|
} | undefined;
|
|
856
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
856
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
857
857
|
table?: {
|
|
858
858
|
table?: boolean | undefined;
|
|
859
859
|
minWidth?: any;
|
|
@@ -1082,7 +1082,7 @@ declare const conf: {
|
|
|
1082
1082
|
spanCol?: boolean | undefined;
|
|
1083
1083
|
tipText?: string | undefined;
|
|
1084
1084
|
} | undefined;
|
|
1085
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
1085
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
1086
1086
|
table?: {
|
|
1087
1087
|
table?: boolean | undefined;
|
|
1088
1088
|
minWidth?: any;
|
|
@@ -1330,7 +1330,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1330
1330
|
spanCol?: boolean | undefined;
|
|
1331
1331
|
tipText?: string | undefined;
|
|
1332
1332
|
} | undefined;
|
|
1333
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
1333
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
1334
1334
|
table?: {
|
|
1335
1335
|
table?: boolean | undefined;
|
|
1336
1336
|
minWidth?: any;
|
|
@@ -1637,7 +1637,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1637
1637
|
spanCol?: boolean | undefined;
|
|
1638
1638
|
tipText?: string | undefined;
|
|
1639
1639
|
} | undefined;
|
|
1640
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
1640
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
1641
1641
|
table?: {
|
|
1642
1642
|
table?: boolean | undefined;
|
|
1643
1643
|
minWidth?: any;
|
|
@@ -1884,7 +1884,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1884
1884
|
spanCol?: boolean | undefined;
|
|
1885
1885
|
tipText?: string | undefined;
|
|
1886
1886
|
} | undefined;
|
|
1887
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
1887
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
1888
1888
|
table?: {
|
|
1889
1889
|
table?: boolean | undefined;
|
|
1890
1890
|
minWidth?: any;
|
|
@@ -2080,7 +2080,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
2080
2080
|
spanCol?: boolean | undefined;
|
|
2081
2081
|
tipText?: string | undefined;
|
|
2082
2082
|
} | undefined;
|
|
2083
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
2083
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
2084
2084
|
table?: {
|
|
2085
2085
|
table?: boolean | undefined;
|
|
2086
2086
|
minWidth?: any;
|
|
@@ -2294,7 +2294,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
2294
2294
|
spanCol?: boolean | undefined;
|
|
2295
2295
|
tipText?: string | undefined;
|
|
2296
2296
|
} | undefined;
|
|
2297
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
2297
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
2298
2298
|
table?: {
|
|
2299
2299
|
table?: boolean | undefined;
|
|
2300
2300
|
minWidth?: any;
|
|
@@ -2523,7 +2523,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
2523
2523
|
spanCol?: boolean | undefined;
|
|
2524
2524
|
tipText?: string | undefined;
|
|
2525
2525
|
} | undefined;
|
|
2526
|
-
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "
|
|
2526
|
+
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "treeSelect" | "list" | undefined;
|
|
2527
2527
|
table?: {
|
|
2528
2528
|
table?: boolean | undefined;
|
|
2529
2529
|
minWidth?: any;
|
|
@@ -490,7 +490,7 @@ export interface CurdConfigColumn<T = any> {
|
|
|
490
490
|
* options: { 'my-upload': { accept: 'image/*', limit: 1 } } }
|
|
491
491
|
* ```
|
|
492
492
|
*/
|
|
493
|
-
type?: 'input' | 'select' | 'switch' | 'radio' | 'checkbox' | 'date' | 'time' | 'datetime' | 'number' | 'color' | 'icon' | 'slider' | 'upload' | 'editor' | 'tree' | '
|
|
493
|
+
type?: 'input' | 'select' | 'switch' | 'radio' | 'checkbox' | 'date' | 'time' | 'datetime' | 'number' | 'color' | 'icon' | 'slider' | 'upload' | 'editor' | 'tree' | 'treeSelect' | 'list';
|
|
494
494
|
/**
|
|
495
495
|
* 表格配置
|
|
496
496
|
*/
|
|
@@ -3,6 +3,7 @@ import type { CurdConfig, CurdConfigColumn } from './indexType';
|
|
|
3
3
|
import questionFilled from './icon/questionFilled.vue';
|
|
4
4
|
import { ElInput, ElOption, ElSelect, ElSwitch, ElTableColumn } from 'element-plus';
|
|
5
5
|
import TSys from '../../utils/TSys';
|
|
6
|
+
import TForm from '../../utils/TForm';
|
|
6
7
|
declare const isFun: (fun: any, ...args: any[]) => any;
|
|
7
8
|
type __VLS_Props = {
|
|
8
9
|
conf: ReturnType<typeof curdConf>['conf'];
|
|
@@ -32,6 +33,7 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
|
32
33
|
ElSwitch: typeof ElSwitch;
|
|
33
34
|
ElTableColumn: typeof ElTableColumn;
|
|
34
35
|
TSys: typeof TSys;
|
|
36
|
+
TForm: typeof TForm;
|
|
35
37
|
isFun: typeof isFun;
|
|
36
38
|
self: typeof self;
|
|
37
39
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
package/dist/utils/TForm.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export default class TForm {
|
|
|
17
17
|
* 通常由插件安装时自动设置,也可手动注册:
|
|
18
18
|
* ```ts
|
|
19
19
|
* TForm.customComponent['my-editor'] = MyEditorComponent
|
|
20
|
+
* TForm.customComponent['my-editor'] = { form: MyEditorComponent, table: MyEditorComponent }
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
22
23
|
static customComponent: {
|