cc1-form 1.1.27 → 1.1.28
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.css +1 -1
- package/dist/cc1-form.js +409 -386
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +10 -0
- package/dist/components/TCurd/index.d.ts +17 -4
- package/dist/components/TCurd/index.vue.d.ts +30 -0
- package/dist/components/TCurd/indexType.d.ts +10 -4
- package/dist/utils/TFormConfig.d.ts +4 -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,Ve,e){"use strict";class y{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...s)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...s):o):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(!y.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const s=await y.moduleObj[n]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(n,s,o={}){const r=Date.now();if(!this.tipMessages[n]||r-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=r;const t=Object.assign({message:n,type:s},o);m.ElMessage(t),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 o=screen.width/2-500,r=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+r+", left="+o)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(s,o)=>{let r=document.getElementById(n.id);const t=await y.loadModule("html2canvas");try{t(r,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(l){let c=l.toDataURL("image/png");s(c)})}catch(l){o(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},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0}},columnConfig:{type:"input",form:{labelWidth:"100px",width:"100%"},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},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 o=n.column.find(t=>t.key===s),r=t=>t.replace(/-([a-z])/g,(l,c)=>c.toUpperCase());if(o)return o.options[r(o.type)]};static setOptionsData=(n,s,o)=>{const r=B.findOptions(n,s);r&&(r.data=o)};static form={openBefore:{parentId:(n,s,o,r)=>{const t=b.config.table.rowKey;n?s.type===y.EDialog.Insert?(s.form.parentId=n[t],s.form.sort=n.children.length+1):s.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=o.length+1),B.setOptionsData(r,"parentId",[{[t]:"0",title:"根",children:o}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,s,o)=>{s[n]||(s[n]=[]);const r=b.config.table.rowKey;s[n].forEach(t=>{o.forEach(l=>{let c=l.default??"";l.type==="number"&&(c=l.default??0),l.type==="boolean"&&(c=l.default??!1),l.type==="time"&&(c=l.default??new Date),t[l.value]===void 0&&(t[l.value]=c)}),t[r]||(t[r]=E.getIdFun())})};static add=(n,s,o,r)=>{const t=JSONUtil.cp(o);E.setId(n,s,o);const l=b.config.table.rowKey;s[n].push(t.reduce((c,p)=>{let h=p.default??"";return p.type==="number"&&(h=p.default??0),p.type==="boolean"&&(h=p.default??!1),p.type==="time"&&(h=p.default??new Date),c[p.value]=h,c},{[l]:E.getIdFun()})),r?.(s)};static remove=(n,s,o,r)=>{const t=b.config.table.rowKey;s[n]=s[n].filter(l=>l[t]!==o[t]),r?.(s)};static getNoIdData=(n,s)=>{const o=JSONUtil.cp(n),r=b.config.table.rowKey;return o.forEach(t=>{t[r]&&delete t[r],s&&t[s]&&E.getNoIdData(t[s],s)}),o}}const L={key:0,class:"column",style:{width:"100%",gap:"10px"}},I={class:"row items-center",style:{gap:"10px",width:"100%"}},D=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""}},emits:["change"],setup(i,{emit:n}){const s=i,o=e.reactive({show:!1,add:(t,l,c)=>{E.add(t,l,c,()=>{r("change")})},remove:(t,l,c)=>{E.remove(t,l,c,()=>{r("change")})}});e.onMounted(()=>{E.setId(s.field,s.row,s.itemFields),o.show=!0});const r=n;return(t,l)=>{const c=e.resolveComponent("el-button"),p=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"list-start",{row:i.row}),e.createElementVNode("div",null,[e.createVNode(c,{link:"",type:"primary",onClick:l[0]||(l[0]=h=>o.add(i.field,i.row,i.itemFields))},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加")])),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.row[i.field],h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"item-start",{item:h,row:i.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.itemFields,f=>(e.openBlock(),e.createBlock(p,{modelValue:h[f.value],"onUpdate:modelValue":a=>h[f.value]=a,style:e.normalizeStyle({width:i.inputWidth}),class:e.normalizeClass(i.inputClass),placeholder:f[i.label]||f[i.value],onChange:l[1]||(l[1]=a=>r("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:i.row}),e.createVNode(c,{link:"",type:"danger",onClick:f=>o.remove(i.field,i.row,h)},{default:e.withCtx(()=>l[3]||(l[3]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:i.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},F=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(i,{expose:n}){const s=y.isFun,o=y.EDialog,r=e.ref(),t=i,l=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:c=>c.disabled?.[(t.type||o.Insert)===o.Insert?"create":"update"],initColumnForm:async()=>{const c=t.option;l.formColumn=[];const p=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let a=[];const d=g=>{if(l.formDefault[g.key]=g.value,g.isForm){g.form=g.form||{span:f},g.form.span=g.form.span??f;let w=g.form.span,C=a.reduce((S,Ce)=>S+Ce.span,w);const V=a.length;a.push({item:g,span:w}),(V===1&&a[0].span===0||C>=h||w===0&&V>1)&&(p.push(a),a=[]),g.rules&&(l.rules[g.key]=g.rules)}};c.column.forEach(g=>{g.isForm=!0,d(g)}),a.length>0&&p.push(a),l.formColumn=p,l.form=JSONUtil.cp(l.formDefault)},init:async()=>{l.show=!1,await e.nextTick(),l.initColumnForm()}});return l.initColumnForm(),n({ref:r,conf:l}),(c,p)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:r,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",M,[e.renderSlot(c.$slots,"form-start",{row:l.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(f.item.show?.form,l.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f.item.form.span>0?`col-${f.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"form-"+f.item.key+"-start",{row:l.form,item:f.item}),e.renderSlot(c.$slots,"form-"+f.item.key,{row:l.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:l.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:3,row:l.form,field:f.item.key,ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:l.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:l.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(B).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(c.$slots,"form-"+f.item.key+"-end",{row:l.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(c.$slots,"form-end",{row:l.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Be(i){return i}const j={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 k{static t(n,...s){if(typeof n=="function")return n(...s);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(r,t)=>o<s.length?String(s[o++]):`{${t}}`)}static setI18n=n=>{k.curd=ObjectUtil.deepMerge(k.curd,n)};static tCurd(n,...s){return this.t(this.curd[n],...s)}static curd=j}class U{static exportToExcel=async(n,s,o)=>{if(!n||n.length===0)return;const r=await y.loadModule("xlsx"),t=n.map(p=>{const h={};return s.forEach(f=>{h[f.label]=p[f.key]}),h}),l=r.utils.json_to_sheet(t),c=r.utils.book_new();r.utils.book_append_sheet(c,l,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,r.writeFile(c,`${o}.xlsx`)}}const N=y.EDialog,z=i=>{const n=e.ref(),s=e.ref(),o=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(r,t=k.tCurd("placeholderInput"))=>r.text?.search?.placeholder===void 0?`${t}${r.label}`:r.text?.search?.placeholder,getFormData:()=>{let r={};i.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(o.search.form):l.show?.search)&&(r[l.key]=o.search.form[l.key])});const t=i.option.search?.before?.(r);return t&&(r=t),r},reset:()=>{const r=o.search.formDefault;Object.keys(r).forEach(t=>{i.option.search?.resetMode==="none"?r[t]=void 0:r[t]=o.search.formDefault[t]}),o.search.form=JSONUtil.cp(r),o.page.num=1,i.option.init!==!1&&o.table.getList()},submit:()=>{o.page.num=1,o.table.getList()}},page:{size:i.option.page?.size||10,sizeList:i.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:i.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...r)=>r.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,t)=>{},all:()=>{if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const r=t=>{let l=[];return t.forEach(c=>{l.push(c[i.option.table.rowKey]),c.children&&c.children.length>0&&(l=l.concat(r(c.children)))}),l};o.table.expand.rowKeys=r(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{o.table.loading=!0;const r=i.option.api.list;try{await o.initApiData("init");let t={};if(o.table.sort.prop){const{props:d,order:g}=b.config.table.sort;t={[d.field]:o.table.sort.prop,[g.field]:o.table.sort.order}}const l=await r({[b.config.page.size]:o.page.size,[b.config.page.num]:o.page.num,...o.search.getFormData(),...t}),c=b.config.result,p=l.data||{[c.list]:l};let h=(Array.isArray(p[c.list]),p[c.list]);const f=o.update.formColumn.flat(),a=JSONUtil.cp(h).map(d=>(Object.keys(d).forEach(w=>{const C=f.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]))}),d));o.table.data=i.option.data?await i.option.data(a,h):a,o.page.total=p[c.total]||0}catch(t){console.error(t)}finally{o.table.loading=!1}},selection:{list:[],change:r=>{o.table.selection.list=r}},sort:{prop:"",order:"",change:r=>{b.config.table.sort.resetPage&&(o.page.num=1);const t=b.config.table.sort;if(t.change){t.change(r,o);return}o.table.sort.prop=r.prop,r.order===null?o.table.sort.order="":o.table.sort.order=r.order==="ascending"?t.order.asc:t.order.desc,o.table.getList()}}},export:{run:{start:async r=>{let t=await o.export.run[r](),l=i.option.column;const c=JSONUtil.cp({data:t,columns:l}),p=i.option.tools?.export||{};p.before&&p.before(c),U.exportToExcel(c.data,c.columns,p.fileName)},select:()=>{if(o.table.selection.list.length===0)throw y.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return o.table.selection.list},page:()=>{if(o.table.data.length===0)throw y.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return o.table.data},all:async()=>{o.export.loading=!0;try{if(i.option.tools?.export?.all){await i.option.tools?.export?.all({[b.config.page.size]:o.page.size,[b.config.page.num]:o.page.num,...o.search.getFormData()});return}const r=i.option.api.list,t=await r({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(r){console.error(r)}finally{o.export.loading=!1}}},loading:!1,click:r=>{o.export.loading||o.export.run.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:r=>o.update.type===N.View?!0:r.disabled?.[o.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:r=>{if(i.option.form?.editAll)return r;let t={[i.option.table?.rowKey]:o.update.edit.data[i.option.table?.rowKey]};return Object.keys(o.update.edit.data).forEach(l=>{r[l]!==o.update.edit.data[l]&&(t[l]=r[l])}),t}},view:{},open:(r,t)=>{o.update.showContent||FunUtil.throttle(async()=>{y.loading(!0);try{await o.initApiData("update");const l=r===N.Insert;if(!l&&i.option.table?.inlineEdit){o.inlineEdit.open(t);return}o.update.type=r,o.update.edit.data=t,o.update.title=k.tCurd(l?"add":r===N.View?"view":"edit"),o.update.form=JSONUtil.cp(l?o.update.formDefault:t),await i.option.form?.openBefore?.(t,o.update),o.update.show=!0,o.update.showContent=!0,i.option.form?.openAfter?.(t,o.update)}catch(l){console.error(l)}finally{y.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(c,p)=>new Promise((h,f)=>{c||(y.fail(k.tCurd("checkFormData")),f(!1)),h()})),o.update.loading=!0;const r=o.update.type===N.Insert?i.option.api.create:i.option.api.update;let t=JSONUtil.cp(o.update.form);delete t.children,await i.option.form?.submitBefore?.(t,o.update);const l=new Set(i.option.column.filter(c=>c.type==="datetime").map(c=>c.key));Object.keys(t).forEach(c=>{if(l.has(c)&&t[c]!=null){const p=new Date(t[c]).getTime();isNaN(p)||(t[c]=p)}});try{if(!r)return;await r({...t}),o.update.close(),await o.table.getList(),i.option.form?.submitAfter?.(t,o.update)}catch(c){console.error(c)}finally{o.update.loading=!1}})},close:()=>{o.update.show=!1,setTimeout(()=>{o.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:r=>{o.inlineEdit.row=r,o.inlineEdit.form=JSONUtil.cp(r)},close:()=>{o.inlineEdit.row=null,o.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{o.inlineEdit.loading=!0;const r=i.option.api.update;let t=JSONUtil.cp(o.inlineEdit.form);delete t.children;try{if(!r)return;await r({...t}),o.inlineEdit.close(),await o.table.getList(),y.success(k.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{o.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{o.remove.show=!1},open:r=>{if(r.length===0){y.fail(k.tCurd("selectDataToDelete"));return}o.remove.items=r,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{o.remove.loading=!0;const r=i.option.api.delete;try{if(!r)return;await r({[i.option.table?.rowKey]:o.remove.items.map(t=>t[i.option.table?.rowKey]),items:o.remove.items}),y.success(k.tCurd("operationSuccess")),o.table.data.length<=1&&o.page.num>1&&(o.page.num-=1),o.remove.close(),await o.table.getList()}catch(t){console.error(t)}finally{o.remove.loading=!1}})}},init:()=>{o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},apiDataMap:{},initApiData:async r=>{const t=[],l=c=>{if(c.children&&c.children.length){c.children.forEach(p=>l(p));return}if(c.type==="select"&&c.options?.select?.dataApi&&c.options?.select?.dataApiConfig?.[r]){if(o.apiDataMap[c.key]&&c.options?.select?.dataApiConfig?.once)return;const p=(async()=>{try{let h=await c.options?.select?.dataApi?.();if(h){const f=c.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),c.options.select.data=h,o.apiDataMap[c.key]=h}}catch{}})();t.push(p)}};return i.option.column.forEach(c=>{l(c)}),await Promise.all(t),!0},initCurdConfig:()=>{const r=JSONUtil.cp(b.config);r.table.emptyText=k.tCurd("noData");const t=ObjectUtil.deepMerge(r,i.option||{});Object.keys(t).forEach(l=>{i.option[l]=t[l]})},initColumnOptions:()=>{let r=JSONUtil.cp(b.config.columnConfig);r.options=ObjectUtil.deepMerge(r.options,{switch:{activeLabel:k.tCurd("switchOn"),inactiveLabel:k.tCurd("switchOff")}});const t=l=>{if(l.table=ObjectUtil.deepMerge(r.table,l.table||{}),l.children){l.children.forEach(c=>{t(c)});return}l.options=ObjectUtil.deepMerge(r.options,l.options||{}),l.form=ObjectUtil.deepMerge(r.form,l.form||{}),l.show=ObjectUtil.deepMerge(r.show,l.show||{}),l.sort=ObjectUtil.deepMerge(r.sort,l.sort||{}),l.type=l.type||r.type,l.type==="switch"&&(l.options.switch.tableBeforeChange=async(c,p)=>{const h=l.options?.switch;try{await n.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),o.table.loading=!0;try{return i.option.api.update?(await i.option.api.update({[i.option.table?.rowKey]:p[i.option.table?.rowKey],[c]:p[c]===h.activeValue?h.inactiveValue:h.activeValue,final(f,a,d){o.table.loading=!1}}),o.table.loading=!1,y.success(k.tCurd("operationSuccess")),o.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{o.table.loading=!1}}catch{return!1}}),l.type==="tree-select"&&(l.options.treeSelect.rowKey=i.option.table?.rowKey,l.options.treeSelect.nodeKey=i.option.table?.rowKey)};i.option.column.forEach(t),i.option.table?.column?.forEach(t)},initColumnForm:()=>{const r=i.option;o.update.formColumn=[],o.table.column.show={list:[],listSource:[]};const t=[],l=i.option.form?.maxSpan||12,c=i.option.form?.defaultSpan||l/2;let p=[];const h=d=>{if(d.children){o.table.column.show.list.push(d.key),d.children.forEach(g=>{h(g)});return}if(o.update.formDefault[d.key]=d.value,d.table.table&&(d.show.table&&o.table.column.show.list.push(d.key),d.table.table&&o.table.column.show.listSource.push(d.key)),d.isForm){d.form=d.form||{span:c},d.form.span=d.form.span??c;let g=d.form.span,w=p.reduce((V,S)=>V+S.span,g);const C=p.length;if(p.push({item:d,span:g}),(C===1&&p[0].span===0||w>=l||g===0&&C>1)&&(t.push(p),p=[]),d.rules){const V={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},S=(V[d.type]||V.input)+d.label;o.update.rules[d.key]=typeof d.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:d.rules}}},f=(d,g)=>{d.isForm=g,Array.isArray(d.children)&&d.children.forEach(w=>f(w,g))};r.column.forEach(d=>{d.isForm=!0,f(d,!0),h(d)}),i.option.table?.column?.forEach(d=>{f(d,!1),h(d)}),o.search.column.list=r.column.concat(r.table?.column||[]),o.table.column.list=o.search.column.list.filter(d=>d.table?.table),o.search.column.list.sort((d,g)=>d.sort?.search-g.sort?.search),o.table.column.list.sort((d,g)=>d.sort?.table-g.sort?.table),p.length>0&&t.push(p),o.update.formColumn=t;const a=i.option.search?.formDefault;a&&Object.keys(a).forEach(d=>{o.search.formDefault[d]=a[d]}),r.column.forEach(d=>{d.show?.search||(o.search.formDefault[d.key]=void 0)}),o.search.form=JSONUtil.cp(o.search.formDefault)}});return o.init(),e.onMounted(()=>{i.option.init!==!1&&o.table.getList()}),{conf:o,switchConfirmRef:n,ruleFormRef:s}},R={class:"dialog-footer"},A=e.defineComponent({__name:"switchConfirm",setup(i,{expose:n}){const s=e.ref(!1),o=e.ref("确认修改"),r=e.ref("确认要修改状态吗?");let t=null,l=null;const c=f=>(f?.title&&(o.value=f.title),f?.content&&(r.value=f.content),s.value=!0,new Promise((a,d)=>{t=a,l=d})),p=()=>{s.value=!1,t?.(!0),t=null,l=null},h=()=>{s.value=!1,l?.(new Error("用户取消操作")),t=null,l=null};return n({open:c}),(f,a)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=d=>s.value=d),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",R,[e.createVNode(e.unref(m.ElButton),{onClick:h},{default:e.withCtx(()=>a[1]||(a[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:p},{default:e.withCtx(()=>a[2]||(a[2]=[e.createTextVNode("确认")])),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(r.value),1)]),_:1},8,["modelValue","title"]))}}),$=(i,n)=>{const s=i.__vccOpts||i;for(const[o,r]of n)s[o]=r;return s},H={},K={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(i,n){return e.openBlock(),e.createElementBlock("svg",K,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 W=$(H,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(i,n){return e.openBlock(),e.createElementBlock("svg",G,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"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 Q=$(q,[["render",X]]),Y={class:"row flex-center table-header-label inline"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(i){const n=y.isFun,s=e.getCurrentInstance().type;return(o,r)=>{const t=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[o.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(o.$slots,"table-header-"+l.key,{item:l},()=>[e.createElementVNode("div",Y,[l.table?.tooltip?(e.openBlock(),e.createBlock(t,{key:0,effect:"dark",content:l.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.label),1)])])]),default:e.withCtx(({row:c})=>[l.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r[0]||(r[0]=e.createTextVNode(" ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s)),{conf:o.conf,columnList:l.children,option:o.option},e.createSlots({_:2},[e.renderList(o.$slots,(p,h)=>({name:h,fn:e.withCtx(f=>[e.renderSlot(o.$slots,h,e.mergeProps({ref_for:!0},f||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(l.show?.form,o.conf.inlineEdit.form,e.unref(y).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===c&&(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:o.conf.inlineEdit.form[l.key],"onUpdate:modelValue":p=>o.conf.inlineEdit.form[l.key]=p,ref_for:!0},l.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.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:o.conf.inlineEdit.form[l.key],"onUpdate:modelValue":p=>o.conf.inlineEdit.form[l.key]=p,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,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"])):e.createCommentVNode("",!0)],64)):e.renderSlot(o.$slots,"table-"+l.key,{key:1,row:c,item:l},()=>[l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:c[l.key],"onUpdate:modelValue":p=>c[l.key]=p,"before-change":()=>l.options?.switch?.tableBeforeChange?.(l.key,c),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:p=>l.table?.click?.callback?.(c)},e.toDisplayString(l.table?.format?l.table?.format(c):c[l.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),O=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(i){return(n,s)=>{const o=e.resolveComponent("el-radio"),r=e.resolveComponent("el-radio-group");return 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(r,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(o,{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)}}}),v={class:"col relative cc1-form-box"},ee={class:"absolute row fit",style:{overflow:"hidden"}},te={class:"col column fit-width no-wrap"},oe={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ne={class:"flex items-center",style:{gap:"10px"}},re={key:0},ae={key:1},ie={key:2},se={class:"export-btn"},de={class:"flex items-center",style:{gap:"10px"}},ce={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},pe={class:"row justify-end mt-10 mb-10"},me={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ge={class:"row form-item-content",style:{width:"100%"}},ke={class:"col"},ye={class:"dialog-footer"},be={class:"dialog-footer"},x=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(i,{expose:n}){const s=y.EDialog,o=i,r=y.isFun,{conf:t,switchConfirmRef:l,ruleFormRef:c}=z(o);return n({conf:t}),(p,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(p.$slots,"box-left"),e.createElementVNode("div",te,[i.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(m.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.key},[(typeof a.show?.search=="function"?a.show?.search(e.unref(t).search.form):a.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof a.text?.search?.label=="string"?a.text?.search?.label:a.label,class:e.normalizeClass({"hide-label":typeof a.text?.search?.label=="boolean"?!a.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"search-"+a.key,{row:e.unref(t).search.form},()=>[a.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":d=>e.unref(t).search.form[a.key]=d,placeholder:e.unref(t).search.getPlaceholder(a),clearable:"",disabled:a.disabled?.search,ref_for:!0},a.options?.input,e.toHandlers(a.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":d=>e.unref(t).search.form[a.key]=d,placeholder:e.unref(t).search.getPlaceholder(a,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:a.disabled?.search,ref_for:!0},a.options?.switch,e.toHandlers(a.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.options?.switch?.activeValue,label:a.options?.switch?.activeLabel,value:a.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.options?.switch?.inactiveValue,label:a.options?.switch?.inactiveLabel,value:a.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":d=>e.unref(t).search.form[a.key]=d,placeholder:e.unref(t).search.getPlaceholder(a,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:a.disabled?.search,ref_for:!0},a.options?.select,e.toHandlers(a.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.options?.select?.data,d=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:d.value,label:d.label,value:d.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":d=>e.unref(t).search.form[a.key]=d,ref_for:!0},a.options?.datetime,e.toHandlers(a.options?.datetime?.on||{}),{disabled:a.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.type&&e.unref(B).customComponent[a.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[a.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":d=>e.unref(t).search.form[a.key]=d,ref_for:!0},a.options?.[a.type],e.toHandlers(a.options?.[a.type]?.on||{}),{disabled:a.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(p.$slots,"search-"+a.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(p.$slots,"search-center",{row:e.unref(t).search.form}),i.option.tools?.search||i.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0},{default:e.withCtx(()=>[i.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),i.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(p.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.unref(r)(i.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:h[0]||(h[0]=a=>e.unref(t).update.open(e.unref(s).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),i.option.table?.selectable&&e.unref(r)(i.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:h[1]||(h[1]=a=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),i.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:h[2]||(h[2]=a=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),i.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[i.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(t).export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(p.$slots,"tools-left")]),e.createElementVNode("div",de,[e.renderSlot(p.$slots,"tools-right"),i.option.tools?.refresh===void 0||i.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...a)=>e.unref(t).table.getList&&e.unref(t).table.getList(...a))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ce,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:e.unref(t).table.data,border:i.option.table?.border===void 0?!0:i.option.table?.border,onSelectionChange:e.unref(t).table.selection.change,onSortChange:e.unref(t).table.sort.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change},i.option.table,e.toHandlers(i.option.table?.on||{})),{default:e.withCtx(()=>[i.option.table?.selectable||e.unref(r)(i.option.tools?.delete)||i.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof i.option.table?.selectable=="function"?i.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(_,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:i.option},e.createSlots({_:2},[e.renderList(p.$slots,(a,d)=>({name:d,fn:e.withCtx(g=>[e.renderSlot(p.$slots,d,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["conf","columnList","option"]),e.unref(r)(i.option.table?.add)||e.unref(r)(i.option.table?.update)||e.unref(r)(i.option.table?.delete)||e.unref(r)(i.option.table?.view)||p.$slots["table-op-left"]||p.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(r)(i.option.table?.add),e.unref(r)(i.option.table?.update),e.unref(r)(i.option.table?.delete),e.unref(r)(i.option.table?.view),p.$slots["table-op-left"],p.$slots["table-op-right"]),align:"center",fixed:"right"},i.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(p.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("operation")),1)])]),default:e.withCtx(({row:a})=>[e.renderSlot(p.$slots,"table-op-left",{row:a}),i.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===a?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(t).inlineEdit.submit,loading:e.unref(t).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(p.$slots,"table-op-edit-right",{row:a})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(r)(i.option.table?.add,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:d=>e.unref(t).update.open(e.unref(s).Insert,a)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(i.option.table?.view,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:d=>e.unref(t).update.open(e.unref(s).View,a)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(i.option.table?.update,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:d=>e.unref(t).update.open(e.unref(s).Update,a)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(i.option.table?.delete,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:d=>e.unref(t).remove.open([a])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(p.$slots,"table-op-right",{row:a})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",pe,[i.option.page?.show===void 0||i.option.page?.show?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=a=>e.unref(t).page.num=a),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=a=>e.unref(t).page.size=a),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":7,layout:e.unref(t).page.layout,total:e.unref(t).page.total,onSizeChange:e.unref(t).table.getList,onCurrentChange:e.unref(t).table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(p.$slots,"box-right")]),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=a=>e.unref(t).update.show=a),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},i.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ye,[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(s).View?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:c,model:e.unref(t).update.form,rules:e.unref(t).update.rules},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(t).update.formColumn,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)(()=>{const d=[],g=w=>{if(w.children)return g(w.children);d.push(...w.map(C=>C.item.show?.form))};return g(a),d},e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:i.option.form?.stripe===void 0?!0:i.option.form?.stripe}])},[e.renderSlot(p.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,d=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)(d.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(d.item.form.span>0?`col-${d.item.form.span}`:"col")},[d.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.children,g=>(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof g.item.text?.form?.label=="boolean"?!g.item.text?.form?.label:!1}),label:typeof g.item.text?.form?.label=="string"?g.item.text?.form?.label:g.item.label,prop:g.item.key,"label-width":g.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",me,[e.renderSlot(p.$slots,"form-"+g.item.key+"-start",{row:e.unref(t).update.form,item:g.item}),e.createElementVNode("div",he,[e.renderSlot(p.$slots,"form-"+g.item.key,{row:e.unref(t).update.form,item:g.item},()=>[e.createVNode(O,{conf:e.unref(t),item:d},null,8,["conf","item"])]),e.renderSlot(p.$slots,"form-"+g.item.key+"-right",{row:e.unref(t).update.form,item:g.item})]),e.renderSlot(p.$slots,"form-"+g.item.key+"-end",{row:e.unref(t).update.form,item:g.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof d.item.text?.form?.label=="boolean"?!d.item.text?.form?.label:!1}),label:typeof d.item.text?.form?.label=="string"?d.item.text?.form?.label:d.item.label,prop:d.item.key,"label-width":d.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.renderSlot(p.$slots,"form-"+d.item.key+"-start",{row:e.unref(t).update.form,item:d.item}),e.createElementVNode("div",ke,[e.renderSlot(p.$slots,"form-"+d.item.key,{row:e.unref(t).update.form,item:d.item},()=>[e.createVNode(O,{conf:e.unref(t),item:d},null,8,["conf","item"])]),e.renderSlot(p.$slots,"form-"+d.item.key+"-right",{row:e.unref(t).update.form,item:d.item})]),e.renderSlot(p.$slots,"form-"+d.item.key+"-end",{row:e.unref(t).update.form,item:d.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(p.$slots,"form-end",{row:e.unref(t).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=a=>e.unref(t).remove.show=a),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(A,{ref_key:"switchConfirmRef",ref:l},null,512)])}}});class ue{static async download(n,s="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",s),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,s)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),r=URL.createObjectURL(o),t=document.createElement("a");t.href=r,t.download=`${s||"config"}.json`,t.click()};static importFile=async n=>new Promise((s,o)=>{const r=document.createElement("input");r.type="file";const t=n?.accept||".json";r.accept=t,r.style.display="none",r.onchange=l=>{const c=l.target.files[0];if(!c){y.fail("未选择文件"),o("未选择文件");return}const p=new FileReader;p.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},p.onerror=()=>{y.fail("文件读取失败"),o("文件读取失败")},p.readAsText(c),document.body.removeChild(r)},document.body.appendChild(r),r.click()})}const T=(i,n)=>{if(i.component("TCurd",x),i.component("TFormList",D),i.component("TColumn",F),n?.customComponent){B.customComponent=n.customComponent;for(const s in n.customComponent)i.component(s,n.customComponent[s])}},we={install:T};u.ArrUtil=E,u.ExcelUtil=U,u.TColumn=F,u.TCurd=x,u.TFile=ue,u.TForm=B,u.TFormConfig=b,u.TFormI18n=k,u.TFormList=D,u.TSys=y,u.default=we,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,Se,e){"use strict";class y{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...d)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...d):o):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(!y.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const d=await y.moduleObj[n]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(n,d,o={}){const r=Date.now();if(!this.tipMessages[n]||r-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=r;const t=Object.assign({message:n,type:d},o);m.ElMessage(t),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 o=screen.width/2-500,r=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+r+", left="+o)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(d,o)=>{let r=document.getElementById(n.id);const t=await y.loadModule("html2canvas");try{t(r,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(l){let c=l.toDataURL("image/png");d(c)})}catch(l){o(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},tools:{refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,fileName:"Export Data "}},form:{stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0}},columnConfig:{type:"input",form:{labelWidth:"100px",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},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,d)=>{const o=n.column.find(t=>t.key===d),r=t=>t.replace(/-([a-z])/g,(l,c)=>c.toUpperCase());if(o)return o.options[r(o.type)]};static setOptionsData=(n,d,o)=>{const r=B.findOptions(n,d);r&&(r.data=o)};static form={openBefore:{parentId:(n,d,o,r)=>{const t=b.config.table.rowKey;n?d.type===y.EDialog.Insert?(d.form.parentId=n[t],d.form.sort=n.children.length+1):d.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=o.length+1),B.setOptionsData(r,"parentId",[{[t]:"0",title:"根",children:o}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(n,d,o)=>{d[n]||(d[n]=[]);const r=b.config.table.rowKey;d[n].forEach(t=>{o.forEach(l=>{let c=l.default??"";l.type==="number"&&(c=l.default??0),l.type==="boolean"&&(c=l.default??!1),l.type==="time"&&(c=l.default??new Date),t[l.value]===void 0&&(t[l.value]=c)}),t[r]||(t[r]=E.getIdFun())})};static add=(n,d,o,r)=>{const t=JSONUtil.cp(o);E.setId(n,d,o);const l=b.config.table.rowKey;d[n].push(t.reduce((c,p)=>{let h=p.default??"";return p.type==="number"&&(h=p.default??0),p.type==="boolean"&&(h=p.default??!1),p.type==="time"&&(h=p.default??new Date),c[p.value]=h,c},{[l]:E.getIdFun()})),r?.(d)};static remove=(n,d,o,r)=>{const t=b.config.table.rowKey;d[n]=d[n].filter(l=>l[t]!==o[t]),r?.(d)};static getNoIdData=(n,d)=>{const o=JSONUtil.cp(n),r=b.config.table.rowKey;return o.forEach(t=>{t[r]&&delete t[r],d&&t[d]&&E.getNoIdData(t[d],d)}),o}}const I={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(i,{emit:n}){const d=i,o=e.reactive({show:!1,add:(t,l,c)=>{E.add(t,l,c,()=>{r("change")})},remove:(t,l,c)=>{E.remove(t,l,c,()=>{r("change")})}});e.onMounted(()=>{E.setId(d.field,d.row,d.itemFields),o.show=!0});const r=n;return(t,l)=>{const c=e.resolveComponent("el-button"),p=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"list-start",{row:i.row}),e.createElementVNode("div",null,[e.createVNode(c,{link:"",type:"primary",onClick:l[0]||(l[0]=h=>o.add(i.field,i.row,i.itemFields))},{default:e.withCtx(()=>l[2]||(l[2]=[e.createTextVNode("添加")])),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.row[i.field],h=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"item-start",{item:h,row:i.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.itemFields,f=>(e.openBlock(),e.createBlock(p,{modelValue:h[f.value],"onUpdate:modelValue":a=>h[f.value]=a,style:e.normalizeStyle({width:i.inputWidth}),class:e.normalizeClass(i.inputClass),placeholder:f[i.label]||f[i.value],onChange:l[1]||(l[1]=a=>r("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:i.row}),e.createVNode(c,{link:"",type:"danger",onClick:f=>o.remove(i.field,i.row,h)},{default:e.withCtx(()=>l[3]||(l[3]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:i.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},F=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(i,{expose:n}){const d=y.isFun,o=y.EDialog,r=e.ref(),t=i,l=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:c=>c.disabled?.[(t.type||o.Insert)===o.Insert?"create":"update"],initColumnForm:async()=>{const c=t.option;l.formColumn=[];const p=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let a=[];const s=g=>{if(l.formDefault[g.key]=g.value,g.isForm){g.form=g.form||{span:f},g.form.span=g.form.span??f;let w=g.form.span,C=a.reduce((S,Ee)=>S+Ee.span,w);const V=a.length;a.push({item:g,span:w}),(V===1&&a[0].span===0||C>=h||w===0&&V>1)&&(p.push(a),a=[]),g.rules&&(l.rules[g.key]=g.rules)}};c.column.forEach(g=>{g.isForm=!0,s(g)}),a.length>0&&p.push(a),l.formColumn=p,l.form=JSONUtil.cp(l.formDefault)},init:async()=>{l.show=!1,await e.nextTick(),l.initColumnForm()}});return l.initColumnForm(),n({ref:r,conf:l}),(c,p)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:r,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",M,[e.renderSlot(c.$slots,"form-start",{row:l.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h,f=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(f.item.show?.form,l.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(f.item.form.span>0?`col-${f.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"form-"+f.item.key+"-start",{row:l.form,item:f.item}),e.renderSlot(c.$slots,"form-"+f.item.key,{row:l.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:l.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(D,e.mergeProps({key:3,row:l.form,field:f.item.key,ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:l.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:l.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(B).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:l.form[f.item.key],"onUpdate:modelValue":a=>l.form[f.item.key]=a,ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:l.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(c.$slots,"form-"+f.item.key+"-end",{row:l.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(c.$slots,"form-end",{row:l.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ne(i){return i}const j={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 k{static t(n,...d){if(typeof n=="function")return n(...d);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(r,t)=>o<d.length?String(d[o++]):`{${t}}`)}static setI18n=n=>{k.curd=ObjectUtil.deepMerge(k.curd,n)};static tCurd(n,...d){return this.t(this.curd[n],...d)}static curd=j}class U{static exportToExcel=async(n,d,o)=>{if(!n||n.length===0)return;const r=await y.loadModule("xlsx"),t=n.map(p=>{const h={};return d.forEach(f=>{h[f.label]=p[f.key]}),h}),l=r.utils.json_to_sheet(t),c=r.utils.book_new();r.utils.book_append_sheet(c,l,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,r.writeFile(c,`${o}.xlsx`)}}const N=y.EDialog,z=i=>{const n=e.ref(),d=e.ref(),o=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(r,t=k.tCurd("placeholderInput"))=>r.text?.search?.placeholder===void 0?`${t}${r.label}`:r.text?.search?.placeholder,getFormData:()=>{let r={};i.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(o.search.form):l.show?.search)&&(r[l.key]=o.search.form[l.key])});const t=i.option.search?.before?.(r);return t&&(r=t),r},reset:()=>{const r=o.search.formDefault;Object.keys(r).forEach(t=>{i.option.search?.resetMode==="none"?r[t]=void 0:r[t]=o.search.formDefault[t]}),o.search.form=JSONUtil.cp(r),o.page.num=1,i.option.init!==!1&&o.table.getList()},submit:()=>{o.page.num=1,o.table.getList()}},page:{size:i.option.page?.size||10,sizeList:i.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:i.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...r)=>r.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,t)=>{},all:()=>{if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const r=t=>{let l=[];return t.forEach(c=>{l.push(c[i.option.table.rowKey]),c.children&&c.children.length>0&&(l=l.concat(r(c.children)))}),l};o.table.expand.rowKeys=r(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{o.table.loading=!0;const r=i.option.api.list;try{await o.initApiData("init");let t={};if(o.table.sort.prop){const{props:s,order:g}=b.config.table.sort;t={[s.field]:o.table.sort.prop,[g.field]:o.table.sort.order}}const l=await r({[b.config.page.size]:o.page.size,[b.config.page.num]:o.page.num,...o.search.getFormData(),...t}),c=b.config.result,p=l.data||{[c.list]:l};let h=(Array.isArray(p[c.list]),p[c.list]);const f=o.update.formColumn.flat(),a=JSONUtil.cp(h).map(s=>(Object.keys(s).forEach(w=>{const C=f.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]))}),s));o.table.data=i.option.data?await i.option.data(a,h):a,o.page.total=p[c.total]||0}catch(t){console.error(t)}finally{o.table.loading=!1}},selection:{list:[],change:r=>{o.table.selection.list=r}},sort:{prop:"",order:"",change:r=>{b.config.table.sort.resetPage&&(o.page.num=1);const t=b.config.table.sort;if(t.change){t.change(r,o);return}o.table.sort.prop=r.prop,r.order===null?o.table.sort.order="":o.table.sort.order=r.order==="ascending"?t.order.asc:t.order.desc,o.table.getList()}}},export:{run:{start:async r=>{let t=await o.export.run[r](),l=i.option.column;const c=JSONUtil.cp({data:t,columns:l}),p=i.option.tools?.export||{};p.before&&p.before(c),U.exportToExcel(c.data,c.columns,p.fileName)},select:()=>{if(o.table.selection.list.length===0)throw y.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return o.table.selection.list},page:()=>{if(o.table.data.length===0)throw y.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return o.table.data},all:async()=>{o.export.loading=!0;try{if(i.option.tools?.export?.all){await i.option.tools?.export?.all({[b.config.page.size]:o.page.size,[b.config.page.num]:o.page.num,...o.search.getFormData()});return}const r=i.option.api.list,t=await r({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(r){console.error(r)}finally{o.export.loading=!1}}},loading:!1,click:r=>{o.export.loading||o.export.run.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:N.Insert,form:{},formDefault:{},formColumn:[],getDisabled:r=>o.update.type===N.View?!0:r.disabled?.[o.update.type===N.Insert?"create":"update"],edit:{data:{},getApiData:r=>{if(i.option.form?.editAll)return r;let t={[i.option.table?.rowKey]:o.update.edit.data[i.option.table?.rowKey]};return Object.keys(o.update.edit.data).forEach(l=>{r[l]!==o.update.edit.data[l]&&(t[l]=r[l])}),t}},view:{},open:(r,t)=>{o.update.showContent||FunUtil.throttle(async()=>{y.loading(!0);try{await o.initApiData("update");const l=r===N.Insert;if(!l&&i.option.table?.inlineEdit){o.inlineEdit.open(t);return}o.update.type=r,o.update.edit.data=t,o.update.title=k.tCurd(l?"add":r===N.View?"view":"edit"),o.update.form=JSONUtil.cp(l?o.update.formDefault:t),await i.option.form?.openBefore?.(t,o.update),o.update.show=!0,o.update.showContent=!0,i.option.form?.openAfter?.(t,o.update)}catch(l){console.error(l)}finally{y.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await d.value?.validate(async(c,p)=>new Promise((h,f)=>{c||(y.fail(k.tCurd("checkFormData")),f(!1)),h()})),o.update.loading=!0;const r=o.update.type===N.Insert?i.option.api.create:i.option.api.update;let t=JSONUtil.cp(o.update.form);delete t.children,await i.option.form?.submitBefore?.(t,o.update);const l=new Set(i.option.column.filter(c=>c.type==="datetime").map(c=>c.key));Object.keys(t).forEach(c=>{if(l.has(c)&&t[c]!=null){const p=new Date(t[c]).getTime();isNaN(p)||(t[c]=p)}});try{if(!r)return;await r({...t}),o.update.close(),await o.table.getList(),i.option.form?.submitAfter?.(t,o.update)}catch(c){console.error(c)}finally{o.update.loading=!1}})},close:()=>{o.update.show=!1,setTimeout(()=>{o.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:r=>{o.inlineEdit.row=r,o.inlineEdit.form=JSONUtil.cp(r)},close:()=>{o.inlineEdit.row=null,o.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{o.inlineEdit.loading=!0;const r=i.option.api.update;let t=JSONUtil.cp(o.inlineEdit.form);delete t.children;try{if(!r)return;await r({...t}),o.inlineEdit.close(),await o.table.getList(),y.success(k.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{o.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{o.remove.show=!1},open:r=>{if(r.length===0){y.fail(k.tCurd("selectDataToDelete"));return}o.remove.items=r,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{o.remove.loading=!0;const r=i.option.api.delete;try{if(!r)return;await r({[i.option.table?.rowKey]:o.remove.items.map(t=>t[i.option.table?.rowKey]),items:o.remove.items}),y.success(k.tCurd("operationSuccess")),o.table.data.length<=1&&o.page.num>1&&(o.page.num-=1),o.remove.close(),await o.table.getList()}catch(t){console.error(t)}finally{o.remove.loading=!1}})}},init:()=>{o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},apiDataMap:{},initApiData:async r=>{const t=[],l=c=>{if(c.children&&c.children.length){c.children.forEach(p=>l(p));return}if(c.type==="select"&&c.options?.select?.dataApi&&c.options?.select?.dataApiConfig?.[r]){if(o.apiDataMap[c.key]&&c.options?.select?.dataApiConfig?.once)return;const p=(async()=>{try{let h=await c.options?.select?.dataApi?.();if(h){const f=c.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),c.options.select.data=h,o.apiDataMap[c.key]=h}}catch{}})();t.push(p)}};return i.option.column.forEach(c=>{l(c)}),await Promise.all(t),!0},initCurdConfig:()=>{const r=JSONUtil.cp(b.config);r.table.emptyText=k.tCurd("noData");const t=ObjectUtil.deepMerge(r,i.option||{});Object.keys(t).forEach(l=>{i.option[l]=t[l]})},initColumnOptions:()=>{let r=JSONUtil.cp(b.config.columnConfig);r.options=ObjectUtil.deepMerge(r.options,{switch:{activeLabel:k.tCurd("switchOn"),inactiveLabel:k.tCurd("switchOff")}});const t=l=>{if(l.table=ObjectUtil.deepMerge(r.table,l.table||{}),l.children){l.children.forEach(c=>{t(c)});return}l.options=ObjectUtil.deepMerge(r.options,l.options||{}),l.form=ObjectUtil.deepMerge(r.form,l.form||{}),l.show=ObjectUtil.deepMerge(r.show,l.show||{}),l.sort=ObjectUtil.deepMerge(r.sort,l.sort||{}),l.type=l.type||r.type,l.type==="switch"&&(l.options.switch.tableBeforeChange=async(c,p)=>{const h=l.options?.switch;try{await n.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),o.table.loading=!0;try{return i.option.api.update?(await i.option.api.update({[i.option.table?.rowKey]:p[i.option.table?.rowKey],[c]:p[c]===h.activeValue?h.inactiveValue:h.activeValue,final(f,a,s){o.table.loading=!1}}),o.table.loading=!1,y.success(k.tCurd("operationSuccess")),o.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{o.table.loading=!1}}catch{return!1}}),l.type==="tree-select"&&(l.options.treeSelect.rowKey=i.option.table?.rowKey,l.options.treeSelect.nodeKey=i.option.table?.rowKey)};i.option.column.forEach(t),i.option.table?.column?.forEach(t)},getColumnSpan:(r,t)=>{if(r.item.form?.spanCol){const l=b.config.form.defaultSpan,p=t.filter(h=>!y.isFun(h.item.show?.form,o.update.form,o.update.type)).reduce((h,f)=>h+(f.item.form?.span||l),0);return(r.item?.form.span||l)+p}return r.item.form.span},initColumnForm:()=>{const r=i.option;o.update.formColumn=[],o.table.column.show={list:[],listSource:[]};const t=[],l=i.option.form?.maxSpan||12,c=i.option.form?.defaultSpan||l/2;let p=[];const h=s=>{if(s.children){o.table.column.show.list.push(s.key),s.children.forEach(g=>{h(g)});return}if(o.update.formDefault[s.key]=s.value,s.table.table&&(s.show.table&&o.table.column.show.list.push(s.key),s.table.table&&o.table.column.show.listSource.push(s.key)),!(s.isForm&&typeof s.show?.form=="boolean")||s.show?.form){s.form=s.form||{span:c},s.form.span=s.form.span??c;let g=s.form.span,w=p.reduce((V,S)=>V+S.span,g);const C=p.length;if(p.push({item:s,span:g}),(C===1&&p[0].span===0||w>=l||g===0&&C>1)&&(t.push(p),p=[]),s.rules){const V={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},S=(V[s.type]||V.input)+s.label;o.update.rules[s.key]=typeof s.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:s.rules}}},f=(s,g)=>{s.isForm=g,Array.isArray(s.children)&&s.children.forEach(w=>f(w,g))};r.column.forEach(s=>{s.isForm=!0,f(s,!0),h(s)}),i.option.table?.column?.forEach(s=>{f(s,!1),h(s)}),o.search.column.list=r.column.concat(r.table?.column||[]),o.table.column.list=o.search.column.list.filter(s=>s.table?.table),o.search.column.list.sort((s,g)=>s.sort?.search-g.sort?.search),o.table.column.list.sort((s,g)=>s.sort?.table-g.sort?.table),p.length>0&&t.push(p),o.update.formColumn=t;const a=i.option.search?.formDefault;a&&Object.keys(a).forEach(s=>{o.search.formDefault[s]=a[s]}),r.column.forEach(s=>{s.show?.search||(o.search.formDefault[s.key]=void 0)}),o.search.form=JSONUtil.cp(o.search.formDefault)}});return o.init(),e.onMounted(()=>{i.option.init!==!1&&o.table.getList()}),{conf:o,switchConfirmRef:n,ruleFormRef:d}},R={class:"dialog-footer"},A=e.defineComponent({__name:"switchConfirm",setup(i,{expose:n}){const d=e.ref(!1),o=e.ref("确认修改"),r=e.ref("确认要修改状态吗?");let t=null,l=null;const c=f=>(f?.title&&(o.value=f.title),f?.content&&(r.value=f.content),d.value=!0,new Promise((a,s)=>{t=a,l=s})),p=()=>{d.value=!1,t?.(!0),t=null,l=null},h=()=>{d.value=!1,l?.(new Error("用户取消操作")),t=null,l=null};return n({open:c}),(f,a)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=s=>d.value=s),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",R,[e.createVNode(e.unref(m.ElButton),{onClick:h},{default:e.withCtx(()=>a[1]||(a[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:p},{default:e.withCtx(()=>a[2]||(a[2]=[e.createTextVNode("确认")])),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(r.value),1)]),_:1},8,["modelValue","title"]))}}),$=(i,n)=>{const d=i.__vccOpts||i;for(const[o,r]of n)d[o]=r;return d},H={},K={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(i,n){return e.openBlock(),e.createElementBlock("svg",K,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 W=$(H,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(i,n){return e.openBlock(),e.createElementBlock("svg",G,n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"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 Q=$(q,[["render",X]]),Y={class:"row flex-center table-header-label inline"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(i){const n=y.isFun,d=e.getCurrentInstance().type;return(o,r)=>{const t=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[o.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(o.$slots,"table-header-"+l.key,{item:l},()=>[e.createElementVNode("div",Y,[l.table?.tooltip?(e.openBlock(),e.createBlock(t,{key:0,effect:"dark",content:l.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:2},1032,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.label),1)])])]),default:e.withCtx(({row:c})=>[l.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r[0]||(r[0]=e.createTextVNode(" ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(d)),{conf:o.conf,columnList:l.children,option:o.option},e.createSlots({_:2},[e.renderList(o.$slots,(p,h)=>({name:h,fn:e.withCtx(f=>[e.renderSlot(o.$slots,h,e.mergeProps({ref_for:!0},f||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(n)(l.show?.form,o.conf.inlineEdit.form,e.unref(y).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===c&&(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:o.conf.inlineEdit.form[l.key],"onUpdate:modelValue":p=>o.conf.inlineEdit.form[l.key]=p,ref_for:!0},l.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.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:o.conf.inlineEdit.form[l.key],"onUpdate:modelValue":p=>o.conf.inlineEdit.form[l.key]=p,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,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"])):e.createCommentVNode("",!0)],64)):e.renderSlot(o.$slots,"table-"+l.key,{key:1,row:c,item:l},()=>[l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:c[l.key],"onUpdate:modelValue":p=>c[l.key]=p,"before-change":()=>l.options?.switch?.tableBeforeChange?.(l.key,c),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:p=>l.table?.click?.callback?.(c)},e.toDisplayString(l.table?.format?l.table?.format(c):c[l.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),x=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(i){return(n,d)=>{const o=e.resolveComponent("el-radio"),r=e.resolveComponent("el-radio-group");return 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(r,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(o,{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":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(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":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)}}}),v={class:"col relative cc1-form-box"},ee={class:"absolute row fit",style:{overflow:"hidden"}},te={class:"col column fit-width no-wrap"},oe={key:0,class:"relative curd-search fit-width"},le={class:"mb-10 flex justify-between items-center fit-width"},ne={class:"flex items-center",style:{gap:"10px"}},re={key:0},ae={key:1},ie={key:2},se={class:"export-btn"},de={class:"flex items-center",style:{gap:"10px"}},ce={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},pe={class:"row justify-end mt-10 mb-10"},me={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ge={key:0,class:"form-tip-text"},ke={class:"row form-item-content",style:{width:"100%"}},ye={class:"col"},be={class:"col"},ue={key:0,class:"form-tip-text"},we={class:"dialog-footer"},Ce={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(i,{expose:n}){const d=y.EDialog,o=i,r=y.isFun,{conf:t,switchConfirmRef:l,ruleFormRef:c}=z(o);return n({conf:t}),(p,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(p.$slots,"box-left"),e.createElementVNode("div",te,[i.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(m.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.key},[(typeof a.show?.search=="function"?a.show?.search(e.unref(t).search.form):a.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof a.text?.search?.label=="string"?a.text?.search?.label:a.label,class:e.normalizeClass({"hide-label":typeof a.text?.search?.label=="boolean"?!a.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(p.$slots,"search-"+a.key,{row:e.unref(t).search.form},()=>[a.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":s=>e.unref(t).search.form[a.key]=s,placeholder:e.unref(t).search.getPlaceholder(a),clearable:"",disabled:a.disabled?.search,ref_for:!0},a.options?.input,e.toHandlers(a.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":s=>e.unref(t).search.form[a.key]=s,placeholder:e.unref(t).search.getPlaceholder(a,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:a.disabled?.search,ref_for:!0},a.options?.switch,e.toHandlers(a.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.options?.switch?.activeValue,label:a.options?.switch?.activeLabel,value:a.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:a.options?.switch?.inactiveValue,label:a.options?.switch?.inactiveLabel,value:a.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":s=>e.unref(t).search.form[a.key]=s,placeholder:e.unref(t).search.getPlaceholder(a,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:a.disabled?.search,ref_for:!0},a.options?.select,e.toHandlers(a.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.options?.select?.data,s=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":s=>e.unref(t).search.form[a.key]=s,ref_for:!0},a.options?.datetime,e.toHandlers(a.options?.datetime?.on||{}),{disabled:a.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.type&&e.unref(B).customComponent[a.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[a.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[a.key],"onUpdate:modelValue":s=>e.unref(t).search.form[a.key]=s,ref_for:!0},a.options?.[a.type],e.toHandlers(a.options?.[a.type]?.on||{}),{disabled:a.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(p.$slots,"search-"+a.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(p.$slots,"search-center",{row:e.unref(t).search.form}),i.option.tools?.search||i.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0},{default:e.withCtx(()=>[i.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),i.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(p.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",le,[e.createElementVNode("div",ne,[e.unref(r)(i.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:h[0]||(h[0]=a=>e.unref(t).update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),i.option.table?.selectable&&e.unref(r)(i.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:h[1]||(h[1]=a=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),i.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:h[2]||(h[2]=a=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),i.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[i.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:e.unref(t).export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(p.$slots,"tools-left")]),e.createElementVNode("div",de,[e.renderSlot(p.$slots,"tools-right"),i.option.tools?.refresh===void 0||i.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...a)=>e.unref(t).table.getList&&e.unref(t).table.getList(...a))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ce,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:e.unref(t).table.data,border:i.option.table?.border===void 0?!0:i.option.table?.border,onSelectionChange:e.unref(t).table.selection.change,onSortChange:e.unref(t).table.sort.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change},i.option.table,e.toHandlers(i.option.table?.on||{})),{default:e.withCtx(()=>[i.option.table?.selectable||e.unref(r)(i.option.tools?.delete)||i.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof i.option.table?.selectable=="function"?i.option.table?.selectable:void 0,width:"40",align:"center","show-overflow-tooltip":!1},null,8,["selectable"])):e.createCommentVNode("",!0),e.createVNode(_,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:i.option},e.createSlots({_:2},[e.renderList(p.$slots,(a,s)=>({name:s,fn:e.withCtx(g=>[e.renderSlot(p.$slots,s,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["conf","columnList","option"]),e.unref(r)(i.option.table?.add)||e.unref(r)(i.option.table?.update)||e.unref(r)(i.option.table?.delete)||e.unref(r)(i.option.table?.view)||p.$slots["table-op-left"]||p.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(r)(i.option.table?.add),e.unref(r)(i.option.table?.update),e.unref(r)(i.option.table?.delete),e.unref(r)(i.option.table?.view),p.$slots["table-op-left"],p.$slots["table-op-right"]),align:"center",fixed:"right"},i.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(p.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("operation")),1)])]),default:e.withCtx(({row:a})=>[e.renderSlot(p.$slots,"table-op-left",{row:a}),i.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===a?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(m.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{link:"",type:"primary",onClick:e.unref(t).inlineEdit.submit,loading:e.unref(t).inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(p.$slots,"table-op-edit-right",{row:a})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(r)(i.option.table?.add,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:s=>e.unref(t).update.open(e.unref(d).Insert,a)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(i.option.table?.view,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"primary",onClick:s=>e.unref(t).update.open(e.unref(d).View,a)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(i.option.table?.update,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"warning",onClick:s=>e.unref(t).update.open(e.unref(d).Update,a)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(i.option.table?.delete,a)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:3,link:"",type:"danger",onClick:s=>e.unref(t).remove.open([a])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(p.$slots,"table-op-right",{row:a})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",pe,[i.option.page?.show===void 0||i.option.page?.show?(e.openBlock(),e.createBlock(e.unref(m.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=a=>e.unref(t).page.num=a),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=a=>e.unref(t).page.size=a),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":7,layout:e.unref(t).page.layout,total:e.unref(t).page.total,onSizeChange:e.unref(t).table.getList,onCurrentChange:e.unref(t).table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(p.$slots,"box-right")]),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=a=>e.unref(t).update.show=a),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},i.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",we,[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(d).View?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:c,model:e.unref(t).update.form,rules:e.unref(t).update.rules},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(t).update.formColumn,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)((()=>{const s=[],g=w=>{w?.item?.children?g(w.item.children):s.push(...w.map(C=>C.item?.show?.form))};return g(a),s})(),e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:i.option.form?.stripe===void 0?!0:i.option.form?.stripe}])},[e.renderSlot(p.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,s=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)(s.item.show?.form,e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass([s.item.form.span>0?`col-${e.unref(t).getColumnSpan(s,a)}`:"col",`form-item-col-${s.item.key}`])},[s.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.children,g=>(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof g.item.text?.form?.label=="boolean"?!g.item.text?.form?.label:!1}),label:typeof g.item.text?.form?.label=="string"?g.item.text?.form?.label:g.item.label,prop:g.item.key,"label-width":g.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",me,[e.renderSlot(p.$slots,"form-"+g.item.key+"-start",{row:e.unref(t).update.form,item:g.item}),e.createElementVNode("div",he,[e.createElementVNode("div",null,[e.renderSlot(p.$slots,"form-"+g.item.key,{row:e.unref(t).update.form,item:g.item},()=>[e.createVNode(x,{conf:e.unref(t),item:s},null,8,["conf","item"])]),e.renderSlot(p.$slots,"form-"+g.item.key+"-right",{row:e.unref(t).update.form,item:g.item})]),g.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",ge,e.toDisplayString(g.item.form?.tipText),1)):e.createCommentVNode("",!0)]),e.renderSlot(p.$slots,"form-"+g.item.key+"-end",{row:e.unref(t).update.form,item:g.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof s.item.text?.form?.label=="boolean"?!s.item.text?.form?.label:!1}),label:typeof s.item.text?.form?.label=="string"?s.item.text?.form?.label:s.item.label,prop:s.item.key,"label-width":s.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ke,[e.renderSlot(p.$slots,"form-"+s.item.key+"-start",{row:e.unref(t).update.form,item:s.item}),e.createElementVNode("div",ye,[e.createElementVNode("div",be,[e.renderSlot(p.$slots,"form-"+s.item.key,{row:e.unref(t).update.form,item:s.item},()=>[e.createVNode(x,{conf:e.unref(t),item:s},null,8,["conf","item"])]),e.renderSlot(p.$slots,"form-"+s.item.key+"-right",{row:e.unref(t).update.form,item:s.item})]),s.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",ue,e.toDisplayString(s.item.form?.tipText),1)):e.createCommentVNode("",!0)]),e.renderSlot(p.$slots,"form-"+s.item.key+"-end",{row:e.unref(t).update.form,item:s.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(p.$slots,"form-end",{row:e.unref(t).update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=a=>e.unref(t).remove.show=a),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Ce,[e.createVNode(e.unref(m.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(A,{ref_key:"switchConfirmRef",ref:l},null,512)])}}});class Ve{static async download(n,d="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",d),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,d)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),r=URL.createObjectURL(o),t=document.createElement("a");t.href=r,t.download=`${d||"config"}.json`,t.click()};static importFile=async n=>new Promise((d,o)=>{const r=document.createElement("input");r.type="file";const t=n?.accept||".json";r.accept=t,r.style.display="none",r.onchange=l=>{const c=l.target.files[0];if(!c){y.fail("未选择文件"),o("未选择文件");return}const p=new FileReader;p.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;d(f)},p.onerror=()=>{y.fail("文件读取失败"),o("文件读取失败")},p.readAsText(c),document.body.removeChild(r)},document.body.appendChild(r),r.click()})}const T=(i,n)=>{if(i.component("TCurd",O),i.component("TFormList",D),i.component("TColumn",F),n?.customComponent){B.customComponent=n.customComponent;for(const d in n.customComponent)i.component(d,n.customComponent[d])}},Be={install:T};u.ArrUtil=E,u.ExcelUtil=U,u.TColumn=F,u.TCurd=O,u.TFile=Ve,u.TForm=B,u.TFormConfig=b,u.TFormI18n=k,u.TFormList=D,u.TSys=y,u.default=Be,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -90,6 +90,8 @@ declare const conf: {
|
|
|
90
90
|
labelWidth?: string | undefined;
|
|
91
91
|
width?: string | undefined;
|
|
92
92
|
span?: number | undefined;
|
|
93
|
+
spanCol?: boolean | undefined;
|
|
94
|
+
tipText?: string | undefined;
|
|
93
95
|
} | undefined;
|
|
94
96
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
95
97
|
table?: {
|
|
@@ -217,6 +219,8 @@ declare var __VLS_7: {
|
|
|
217
219
|
labelWidth?: string | undefined;
|
|
218
220
|
width?: string | undefined;
|
|
219
221
|
span?: number | undefined;
|
|
222
|
+
spanCol?: boolean | undefined;
|
|
223
|
+
tipText?: string | undefined;
|
|
220
224
|
} | undefined;
|
|
221
225
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
222
226
|
table?: {
|
|
@@ -335,6 +339,8 @@ declare var __VLS_7: {
|
|
|
335
339
|
labelWidth?: string | undefined;
|
|
336
340
|
width?: string | undefined;
|
|
337
341
|
span?: number | undefined;
|
|
342
|
+
spanCol?: boolean | undefined;
|
|
343
|
+
tipText?: string | undefined;
|
|
338
344
|
} | undefined;
|
|
339
345
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
340
346
|
table?: {
|
|
@@ -453,6 +459,8 @@ declare var __VLS_7: {
|
|
|
453
459
|
labelWidth?: string | undefined;
|
|
454
460
|
width?: string | undefined;
|
|
455
461
|
span?: number | undefined;
|
|
462
|
+
spanCol?: boolean | undefined;
|
|
463
|
+
tipText?: string | undefined;
|
|
456
464
|
} | undefined;
|
|
457
465
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
458
466
|
table?: {
|
|
@@ -680,6 +688,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
680
688
|
labelWidth?: string | undefined;
|
|
681
689
|
width?: string | undefined;
|
|
682
690
|
span?: number | undefined;
|
|
691
|
+
spanCol?: boolean | undefined;
|
|
692
|
+
tipText?: string | undefined;
|
|
683
693
|
} | undefined;
|
|
684
694
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
685
695
|
table?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import TSys from '../../utils/TSys';
|
|
2
2
|
import { type FormInstance } from 'element-plus';
|
|
3
|
-
import type { CurdConfig, CurdConfigColumn } from './indexType';
|
|
3
|
+
import type { CurdConfig, CurdConfigColumn, CurdFormColumn } from './indexType';
|
|
4
4
|
declare const EDialog: {
|
|
5
5
|
Insert: any;
|
|
6
6
|
Update: any;
|
|
@@ -92,6 +92,8 @@ export declare const curdConf: (props: {
|
|
|
92
92
|
labelWidth?: string | undefined;
|
|
93
93
|
width?: string | undefined;
|
|
94
94
|
span?: number | undefined;
|
|
95
|
+
spanCol?: boolean | undefined;
|
|
96
|
+
tipText?: string | undefined;
|
|
95
97
|
} | undefined;
|
|
96
98
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
97
99
|
table?: {
|
|
@@ -121,7 +123,9 @@ export declare const curdConf: (props: {
|
|
|
121
123
|
show?: {
|
|
122
124
|
table?: boolean | undefined;
|
|
123
125
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
124
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert /**
|
|
126
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert /** 待删除数据项集合 */ | typeof TSys.EDialog.Update | typeof TSys.
|
|
127
|
+
/** 删除操作loading */
|
|
128
|
+
EDialog /** 删除操作loading */.View) => boolean) | undefined;
|
|
125
129
|
} | undefined;
|
|
126
130
|
sort?: {
|
|
127
131
|
search?: number | undefined;
|
|
@@ -236,6 +240,8 @@ export declare const curdConf: (props: {
|
|
|
236
240
|
labelWidth?: string | undefined;
|
|
237
241
|
width?: string | undefined;
|
|
238
242
|
span?: number | undefined;
|
|
243
|
+
spanCol?: boolean | undefined;
|
|
244
|
+
tipText?: string | undefined;
|
|
239
245
|
} | undefined;
|
|
240
246
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
241
247
|
table?: {
|
|
@@ -265,7 +271,9 @@ export declare const curdConf: (props: {
|
|
|
265
271
|
show?: {
|
|
266
272
|
table?: boolean | undefined;
|
|
267
273
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
268
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert /**
|
|
274
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert /** 待删除数据项集合 */ | typeof TSys.EDialog.Update | typeof TSys.
|
|
275
|
+
/** 删除操作loading */
|
|
276
|
+
EDialog /** 删除操作loading */.View) => boolean) | undefined;
|
|
269
277
|
} | undefined;
|
|
270
278
|
sort?: {
|
|
271
279
|
search?: number | undefined;
|
|
@@ -397,6 +405,8 @@ export declare const curdConf: (props: {
|
|
|
397
405
|
labelWidth?: string | undefined;
|
|
398
406
|
width?: string | undefined;
|
|
399
407
|
span?: number | undefined;
|
|
408
|
+
spanCol?: boolean | undefined;
|
|
409
|
+
tipText?: string | undefined;
|
|
400
410
|
} | undefined;
|
|
401
411
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
402
412
|
table?: {
|
|
@@ -426,7 +436,9 @@ export declare const curdConf: (props: {
|
|
|
426
436
|
show?: {
|
|
427
437
|
table?: boolean | undefined;
|
|
428
438
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
429
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert /**
|
|
439
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert /** 待删除数据项集合 */ | typeof TSys.EDialog.Update | typeof TSys.
|
|
440
|
+
/** 删除操作loading */
|
|
441
|
+
EDialog /** 删除操作loading */.View) => boolean) | undefined;
|
|
430
442
|
} | undefined;
|
|
431
443
|
sort?: {
|
|
432
444
|
search?: number | undefined;
|
|
@@ -469,6 +481,7 @@ export declare const curdConf: (props: {
|
|
|
469
481
|
initApiData: (tag: "update" | "init") => Promise<boolean>;
|
|
470
482
|
initCurdConfig: () => void;
|
|
471
483
|
initColumnOptions: () => void;
|
|
484
|
+
getColumnSpan: (column: CurdFormColumn, itemConfig: CurdFormColumn[]) => number | undefined;
|
|
472
485
|
initColumnForm: () => void;
|
|
473
486
|
};
|
|
474
487
|
switchConfirmRef: import("vue").Ref<any, any>;
|
|
@@ -96,6 +96,8 @@ declare const conf: {
|
|
|
96
96
|
labelWidth?: string | undefined;
|
|
97
97
|
width?: string | undefined;
|
|
98
98
|
span?: number | undefined;
|
|
99
|
+
spanCol?: boolean | undefined;
|
|
100
|
+
tipText?: string | undefined;
|
|
99
101
|
} | undefined;
|
|
100
102
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
101
103
|
table?: {
|
|
@@ -240,6 +242,8 @@ declare const conf: {
|
|
|
240
242
|
labelWidth?: string | undefined;
|
|
241
243
|
width?: string | undefined;
|
|
242
244
|
span?: number | undefined;
|
|
245
|
+
spanCol?: boolean | undefined;
|
|
246
|
+
tipText?: string | undefined;
|
|
243
247
|
} | undefined;
|
|
244
248
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
245
249
|
table?: {
|
|
@@ -401,6 +405,8 @@ declare const conf: {
|
|
|
401
405
|
labelWidth?: string | undefined;
|
|
402
406
|
width?: string | undefined;
|
|
403
407
|
span?: number | undefined;
|
|
408
|
+
spanCol?: boolean | undefined;
|
|
409
|
+
tipText?: string | undefined;
|
|
404
410
|
} | undefined;
|
|
405
411
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
406
412
|
table?: {
|
|
@@ -478,6 +484,7 @@ declare const conf: {
|
|
|
478
484
|
initApiData: (tag: "update" | "init") => Promise<boolean>;
|
|
479
485
|
initCurdConfig: () => void;
|
|
480
486
|
initColumnOptions: () => void;
|
|
487
|
+
getColumnSpan: (column: import("./indexType").CurdFormColumn, itemConfig: import("./indexType").CurdFormColumn[]) => number | undefined;
|
|
481
488
|
initColumnForm: () => void;
|
|
482
489
|
}, switchConfirmRef: import("vue").Ref<any, any>, ruleFormRef: import("vue").Ref<import("element-plus").FormInstance | undefined, import("element-plus").FormInstance | undefined>;
|
|
483
490
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
@@ -580,6 +587,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
580
587
|
labelWidth?: string | undefined;
|
|
581
588
|
width?: string | undefined;
|
|
582
589
|
span?: number | undefined;
|
|
590
|
+
spanCol?: boolean | undefined;
|
|
591
|
+
tipText?: string | undefined;
|
|
583
592
|
} | undefined;
|
|
584
593
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
585
594
|
table?: {
|
|
@@ -698,6 +707,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
698
707
|
labelWidth?: string | undefined;
|
|
699
708
|
width?: string | undefined;
|
|
700
709
|
span?: number | undefined;
|
|
710
|
+
spanCol?: boolean | undefined;
|
|
711
|
+
tipText?: string | undefined;
|
|
701
712
|
} | undefined;
|
|
702
713
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
703
714
|
table?: {
|
|
@@ -816,6 +827,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
816
827
|
labelWidth?: string | undefined;
|
|
817
828
|
width?: string | undefined;
|
|
818
829
|
span?: number | undefined;
|
|
830
|
+
spanCol?: boolean | undefined;
|
|
831
|
+
tipText?: string | undefined;
|
|
819
832
|
} | undefined;
|
|
820
833
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
821
834
|
table?: {
|
|
@@ -934,6 +947,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
934
947
|
labelWidth?: string | undefined;
|
|
935
948
|
width?: string | undefined;
|
|
936
949
|
span?: number | undefined;
|
|
950
|
+
spanCol?: boolean | undefined;
|
|
951
|
+
tipText?: string | undefined;
|
|
937
952
|
} | undefined;
|
|
938
953
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
939
954
|
table?: {
|
|
@@ -1052,6 +1067,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1052
1067
|
labelWidth?: string | undefined;
|
|
1053
1068
|
width?: string | undefined;
|
|
1054
1069
|
span?: number | undefined;
|
|
1070
|
+
spanCol?: boolean | undefined;
|
|
1071
|
+
tipText?: string | undefined;
|
|
1055
1072
|
} | undefined;
|
|
1056
1073
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1057
1074
|
table?: {
|
|
@@ -1170,6 +1187,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1170
1187
|
labelWidth?: string | undefined;
|
|
1171
1188
|
width?: string | undefined;
|
|
1172
1189
|
span?: number | undefined;
|
|
1190
|
+
spanCol?: boolean | undefined;
|
|
1191
|
+
tipText?: string | undefined;
|
|
1173
1192
|
} | undefined;
|
|
1174
1193
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1175
1194
|
table?: {
|
|
@@ -1288,6 +1307,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1288
1307
|
labelWidth?: string | undefined;
|
|
1289
1308
|
width?: string | undefined;
|
|
1290
1309
|
span?: number | undefined;
|
|
1310
|
+
spanCol?: boolean | undefined;
|
|
1311
|
+
tipText?: string | undefined;
|
|
1291
1312
|
} | undefined;
|
|
1292
1313
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1293
1314
|
table?: {
|
|
@@ -1406,6 +1427,8 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1406
1427
|
labelWidth?: string | undefined;
|
|
1407
1428
|
width?: string | undefined;
|
|
1408
1429
|
span?: number | undefined;
|
|
1430
|
+
spanCol?: boolean | undefined;
|
|
1431
|
+
tipText?: string | undefined;
|
|
1409
1432
|
} | undefined;
|
|
1410
1433
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1411
1434
|
table?: {
|
|
@@ -1628,6 +1651,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1628
1651
|
labelWidth?: string | undefined;
|
|
1629
1652
|
width?: string | undefined;
|
|
1630
1653
|
span?: number | undefined;
|
|
1654
|
+
spanCol?: boolean | undefined;
|
|
1655
|
+
tipText?: string | undefined;
|
|
1631
1656
|
} | undefined;
|
|
1632
1657
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1633
1658
|
table?: {
|
|
@@ -1772,6 +1797,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1772
1797
|
labelWidth?: string | undefined;
|
|
1773
1798
|
width?: string | undefined;
|
|
1774
1799
|
span?: number | undefined;
|
|
1800
|
+
spanCol?: boolean | undefined;
|
|
1801
|
+
tipText?: string | undefined;
|
|
1775
1802
|
} | undefined;
|
|
1776
1803
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1777
1804
|
table?: {
|
|
@@ -1933,6 +1960,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1933
1960
|
labelWidth?: string | undefined;
|
|
1934
1961
|
width?: string | undefined;
|
|
1935
1962
|
span?: number | undefined;
|
|
1963
|
+
spanCol?: boolean | undefined;
|
|
1964
|
+
tipText?: string | undefined;
|
|
1936
1965
|
} | undefined;
|
|
1937
1966
|
type?: "input" | "select" | "switch" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list" | undefined;
|
|
1938
1967
|
table?: {
|
|
@@ -2010,6 +2039,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
2010
2039
|
initApiData: (tag: "update" | "init") => Promise<boolean>;
|
|
2011
2040
|
initCurdConfig: () => void;
|
|
2012
2041
|
initColumnOptions: () => void;
|
|
2042
|
+
getColumnSpan: (column: import("./indexType").CurdFormColumn, itemConfig: import("./indexType").CurdFormColumn[]) => number | undefined;
|
|
2013
2043
|
initColumnForm: () => void;
|
|
2014
2044
|
};
|
|
2015
2045
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -132,7 +132,7 @@ export interface CurdConfig<T = any> {
|
|
|
132
132
|
/**
|
|
133
133
|
* 额外的表格列信息,可配置是否可搜索,不参与新增编辑表单
|
|
134
134
|
*/
|
|
135
|
-
column: CurdConfigColumn[];
|
|
135
|
+
column: CurdConfigColumn<T>[];
|
|
136
136
|
/**
|
|
137
137
|
* 是否显示溢出提示 默认显示
|
|
138
138
|
*/
|
|
@@ -217,7 +217,7 @@ export interface CurdConfig<T = any> {
|
|
|
217
217
|
*/
|
|
218
218
|
before: (param: {
|
|
219
219
|
data: T[];
|
|
220
|
-
columns: CurdConfigColumn[];
|
|
220
|
+
columns: CurdConfigColumn<T>[];
|
|
221
221
|
}) => void;
|
|
222
222
|
/**
|
|
223
223
|
* 导出所有数据钩子
|
|
@@ -281,7 +281,7 @@ export interface CurdConfig<T = any> {
|
|
|
281
281
|
/**
|
|
282
282
|
* 表格列和新增编辑表单字段
|
|
283
283
|
*/
|
|
284
|
-
column: CurdConfigColumn[];
|
|
284
|
+
column: CurdConfigColumn<T>[];
|
|
285
285
|
/**
|
|
286
286
|
* 接口
|
|
287
287
|
*/
|
|
@@ -352,7 +352,7 @@ export interface CurdConfigColumn<T = any> {
|
|
|
352
352
|
/**
|
|
353
353
|
* 表头存在子字段时,子字段列表配置
|
|
354
354
|
*/
|
|
355
|
-
children?: CurdConfigColumn<
|
|
355
|
+
children?: CurdConfigColumn<T>[];
|
|
356
356
|
/**
|
|
357
357
|
* 是否禁止操作
|
|
358
358
|
*/
|
|
@@ -558,6 +558,12 @@ export interface CurdConfigColumn<T = any> {
|
|
|
558
558
|
* 栅格占比-一行最多12列,0为铺满剩余空间
|
|
559
559
|
*/
|
|
560
560
|
span: number;
|
|
561
|
+
/** 是否补充其他列空间 默认为false */
|
|
562
|
+
spanCol: boolean;
|
|
563
|
+
/**
|
|
564
|
+
* 提示文本
|
|
565
|
+
*/
|
|
566
|
+
tipText: string;
|
|
561
567
|
}>;
|
|
562
568
|
/**
|
|
563
569
|
* 字段控件类型,决定在搜索、表格、表单中使用哪种 UI 组件渲染
|