cc1-form 1.1.25 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cc1-form.js +318 -271
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +5 -10
- package/dist/components/TCurd/index.d.ts +9 -0
- package/dist/components/TCurd/index.vue.d.ts +47 -29
- package/dist/components/TCurd/indexType.d.ts +4 -0
- package/dist/utils/TFormConfig.d.ts +26 -0
- package/package.json +1 -1
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("element-plus"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.cc1Form={},u.ElementPlus,u.Vue))})(this,(function(u,p,e){"use strict";class g{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(i,...s)=>Array.isArray(i)?i.some(l=>typeof l=="function"?l(...s):l):typeof i=="function"?i(...s):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async i=>{if(!g.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const s=await g.moduleObj[i]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(i,s,l={}){const a=Date.now();if(!this.tipMessages[i]||a-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=a;const t=Object.assign({message:i,type:s},l);p.ElMessage(t),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,s={})=>{this.showMessage(i,"error",s)};static success=(i,s={})=>{this.showMessage(i,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=p.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,s=!0)=>{if(s){let l=screen.width/2-500,a=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+l)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(s,l)=>{let a=document.getElementById(i.id);const t=await g.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let d=n.toDataURL("image/png");s(d)})}catch(n){l(n)}})}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},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=i=>{b.config=ObjectUtil.deepMerge(b.config,i)}}class C{static customComponent={};static findOptions=(i,s)=>{const l=i.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(n,d)=>d.toUpperCase());if(l)return l.options[a(l.type)]};static setOptionsData=(i,s,l)=>{const a=C.findOptions(i,s);a&&(a.data=l)};static form={openBefore:{parentId:(i,s,l,a)=>{const t=b.config.table.rowKey;i?s.type===g.EDialog.Insert?(s.form.parentId=i[t],s.form.sort=i.children.length+1):s.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=l.length+1),C.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:l}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(i,s,l)=>{s[i]||(s[i]=[]);const a=b.config.table.rowKey;s[i].forEach(t=>{l.forEach(n=>{let d=n.default??"";n.type==="number"&&(d=n.default??0),n.type==="boolean"&&(d=n.default??!1),n.type==="time"&&(d=n.default??new Date),t[n.value]===void 0&&(t[n.value]=d)}),t[a]||(t[a]=B.getIdFun())})};static add=(i,s,l,a)=>{const t=JSONUtil.cp(l);B.setId(i,s,l);const n=b.config.table.rowKey;s[i].push(t.reduce((d,m)=>{let h=m.default??"";return m.type==="number"&&(h=m.default??0),m.type==="boolean"&&(h=m.default??!1),m.type==="time"&&(h=m.default??new Date),d[m.value]=h,d},{[n]:B.getIdFun()})),a?.(s)};static remove=(i,s,l,a)=>{const t=b.config.table.rowKey;s[i]=s[i].filter(n=>n[t]!==l[t]),a?.(s)};static getNoIdData=(i,s)=>{const l=JSONUtil.cp(i),a=b.config.table.rowKey;return l.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&B.getNoIdData(t[s],s)}),l}}const L={key:0,class:"column",style:{width:"100%",gap:"10px"}},I={class:"row items-center",style:{gap:"10px",width:"100%"}},N=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(o,{emit:i}){const s=o,l=e.reactive({show:!1,add:(t,n,d)=>{B.add(t,n,d,()=>{a("change")})},remove:(t,n,d)=>{B.remove(t,n,d,()=>{a("change")})}});e.onMounted(()=>{B.setId(s.field,s.row,s.itemFields),l.show=!0});const a=i;return(t,n)=>{const d=e.resolveComponent("el-button"),m=e.resolveComponent("el-input");return l.show?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"list-start",{row:o.row}),e.createElementVNode("div",null,[e.createVNode(d,{link:"",type:"primary",onClick:n[0]||(n[0]=h=>l.add(o.field,o.row,o.itemFields))},{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.row[o.field],h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"item-start",{item:h,row:o.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.itemFields,f=>(e.openBlock(),e.createBlock(m,{modelValue:h[f.value],"onUpdate:modelValue":r=>h[f.value]=r,style:e.normalizeStyle({width:o.inputWidth}),class:e.normalizeClass(o.inputClass),placeholder:f[o.label]||f[o.value],onChange:n[1]||(n[1]=r=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:o.row}),e.createVNode(d,{link:"",type:"danger",onClick:f=>l.remove(o.field,o.row,h)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:o.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(o,{expose:i}){const s=g.isFun,l=g.EDialog,a=e.ref(),t=o,n=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:d=>d.disabled?.[(t.type||l.Insert)===l.Insert?"create":"update"],initColumnForm:async()=>{const d=t.option;n.formColumn=[];const m=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let r=[];const c=k=>{if(n.formDefault[k.key]=k.value,k.isForm){k.form=k.form||{span:f},k.form.span=k.form.span??f;let w=k.form.span,V=r.reduce((S,Ce)=>S+Ce.span,w);const E=r.length;r.push({item:k,span:w}),(E===1&&r[0].span===0||V>=h||w===0&&E>1)&&(m.push(r),r=[]),k.rules&&(n.rules[k.key]=k.rules)}};d.column.forEach(k=>{k.isForm=!0,c(k)}),r.length>0&&m.push(r),n.formColumn=m,n.form=JSONUtil.cp(n.formDefault)},init:async()=>{n.show=!1,await e.nextTick(),n.initColumnForm()}});return n.initColumnForm(),i({ref:a,conf:n}),(d,m)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:a,model:n.form,rules:n.rules},{default:e.withCtx(()=>[n.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.formColumn,h=>(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(d.$slots,"form-start",{row:n.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,n.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(p.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"form-"+f.item.key+"-start",{row:n.form,item:f.item}),e.renderSlot(d.$slots,"form-"+f.item.key,{row:n.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:n.form,field:f.item.key},{ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type&&e.unref(C).customComponent[f.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[f.item.type]),e.mergeProps({key:6,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(d.$slots,"form-"+f.item.key+"-end",{row:n.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(d.$slots,"form-end",{row:n.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ve(o){return o}const z={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 y{static t(i,...s){if(typeof i=="function")return i(...s);i=String(i);let l=0;return i.replace(/{([^}]+)}/g,(a,t)=>l<s.length?String(s[l++]):`{${t}}`)}static setI18n=i=>{y.curd=ObjectUtil.deepMerge(y.curd,i)};static tCurd(i,...s){return this.t(this.curd[i],...s)}static curd=z}class F{static exportToExcel=async(i,s,l)=>{if(!i||i.length===0)return;const a=await g.loadModule("xlsx"),t=i.map(m=>{const h={};return s.forEach(f=>{h[f.label]=m[f.key]}),h}),n=a.utils.json_to_sheet(t),d=a.utils.book_new();a.utils.book_append_sheet(d,n,"Sheet1"),l?typeof l=="function"&&(l=l()):l=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(d,`${l}.xlsx`)}}const x=g.EDialog,j=o=>{const i=e.ref(),s=e.ref(),l=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,t=y.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${t}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};o.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(l.search.form):n.show?.search)&&(a[n.key]=l.search.form[n.key])});const t=o.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const a=l.search.formDefault;Object.keys(a).forEach(t=>{o.option.search?.resetMode==="none"?a[t]=void 0:a[t]=l.search.formDefault[t]}),l.search.form=JSONUtil.cp(a),l.page.num=1,o.option.init!==!1&&l.table.getList()},submit:()=>{l.page.num=1,l.table.getList()}},page:{size:o.option.page?.size||10,sizeList:o.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:o.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...a)=>a.filter(n=>n).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{if(l.table.expand.isExpand)l.table.expand.rowKeys=[];else{const a=t=>{let n=[];return t.forEach(d=>{n.push(d[o.option.table.rowKey]),d.children&&d.children.length>0&&(n=n.concat(a(d.children)))}),n};l.table.expand.rowKeys=a(l.table.data)}l.table.expand.isExpand=!l.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{l.table.loading=!0;const a=o.option.api.list;try{await l.initApiData("init");const t=await a({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()}),n=b.config.result,d=t.data||{[n.list]:t};let m=(Array.isArray(d[n.list]),d[n.list]);const h=l.update.formColumn.flat(),f=JSONUtil.cp(m).map(r=>(Object.keys(r).forEach(k=>{const w=h.find(V=>V.item.key===k);w&&["select","radio"].includes(w.item.type)&&(w.item.table.format||(w.item.table.format=V=>w.item.options[w.item.type].data?.find(E=>E.value==V[k])?.label||V[k]))}),r));l.table.data=o.option.data?await o.option.data(f,m):f,l.page.total=d[n.total]||0}catch(t){console.error(t)}finally{l.table.loading=!1}},selection:{list:[],change:a=>{l.table.selection.list=a}}},export:{run:{start:async a=>{let t=await l.export.run[a](),n=o.option.column;const d=JSONUtil.cp({data:t,columns:n}),m=o.option.tools?.export||{};m.before&&m.before(d),F.exportToExcel(d.data,d.columns,m.fileName)},select:()=>{if(l.table.selection.list.length===0)throw g.fail(y.tCurd("selectDataToExport")),new Error(y.tCurd("selectDataToExport"));return l.table.selection.list},page:()=>{if(l.table.data.length===0)throw g.fail(y.tCurd("noData")),new Error(y.tCurd("noData"));return l.table.data},all:async()=>{l.export.loading=!0;try{if(o.option.tools?.export?.all){await o.option.tools?.export?.all({[b.config.page.size]:l.page.size,[b.config.page.num]:l.page.num,...l.search.getFormData()});return}const a=o.option.api.list,t=await a({[b.config.page.size]:999999,[b.config.page.num]:1});return(t.data||{[b.config.result.list]:t})[b.config.result.list]}catch(a){console.error(a)}finally{l.export.loading=!1}}},loading:!1,click:a=>{l.export.loading||l.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:x.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>l.update.type===x.View?!0:a.disabled?.[l.update.type===x.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(o.option.form?.editAll)return a;let t={[o.option.table?.rowKey]:l.update.edit.data[o.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(n=>{a[n]!==l.update.edit.data[n]&&(t[n]=a[n])}),t}},view:{},open:(a,t)=>{l.update.showContent||FunUtil.throttle(async()=>{g.loading(!0);try{await l.initApiData("update");const n=a===x.Insert;if(!n&&o.option.table?.inlineEdit){l.inlineEdit.open(t);return}l.update.type=a,l.update.edit.data=t,l.update.title=y.tCurd(n?"add":a===x.View?"view":"edit"),l.update.form=JSONUtil.cp(n?l.update.formDefault:t),await o.option.form?.openBefore?.(t,l.update),l.update.show=!0,l.update.showContent=!0,o.option.form?.openAfter?.(t,l.update)}catch(n){console.error(n)}finally{g.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(d,m)=>new Promise((h,f)=>{d||(g.fail(y.tCurd("checkFormData")),f(!1)),h()})),l.update.loading=!0;const a=l.update.type===x.Insert?o.option.api.create:o.option.api.update;let t=JSONUtil.cp(l.update.form);delete t.children,await o.option.form?.submitBefore?.(t,l.update);const n=new Set(o.option.column.filter(d=>d.type==="datetime").map(d=>d.key));Object.keys(t).forEach(d=>{if(n.has(d)&&t[d]!=null){const m=new Date(t[d]).getTime();isNaN(m)||(t[d]=m)}});try{if(!a)return;await a({...t}),l.update.close(),await l.table.getList(),o.option.form?.submitAfter?.(t,l.update)}catch(d){console.error(d)}finally{l.update.loading=!1}})},close:()=>{l.update.show=!1,setTimeout(()=>{l.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{l.inlineEdit.row=a,l.inlineEdit.form=JSONUtil.cp(a)},close:()=>{l.inlineEdit.row=null,l.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{l.inlineEdit.loading=!0;const a=o.option.api.update;let t=JSONUtil.cp(l.inlineEdit.form);delete t.children;try{if(!a)return;await a({...t}),l.inlineEdit.close(),await l.table.getList(),g.success(y.tCurd("operationSuccess"))}catch(n){console.error(n)}finally{l.inlineEdit.loading=!1}})}},remove:{title:y.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{l.remove.show=!1},open:a=>{if(a.length===0){g.fail(y.tCurd("selectDataToDelete"));return}l.remove.items=a,l.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{l.remove.loading=!0;const a=o.option.api.delete;try{if(!a)return;await a({[o.option.table?.rowKey]:l.remove.items.map(t=>t[o.option.table?.rowKey]),items:l.remove.items}),g.success(y.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(t){console.error(t)}finally{l.remove.loading=!1}})}},init:()=>{l.initCurdConfig(),l.initColumnOptions(),l.initColumnForm()},apiDataMap:{},initApiData:async a=>{const t=[],n=d=>{if(d.children&&d.children.length){d.children.forEach(m=>n(m));return}if(d.type==="select"&&d.options?.select?.dataApi&&d.options?.select?.dataApiConfig?.[a]){if(l.apiDataMap[d.key]&&d.options?.select?.dataApiConfig?.once)return;const m=(async()=>{try{let h=await d.options?.select?.dataApi?.();if(h){const f=d.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),d.options.select.data=h,l.apiDataMap[d.key]=h}}catch{}})();t.push(m)}};return o.option.column.forEach(d=>{n(d)}),await Promise.all(t),!0},initCurdConfig:()=>{const a=JSONUtil.cp(b.config);a.table.emptyText=y.tCurd("noData");const t=ObjectUtil.deepMerge(a,o.option||{});Object.keys(t).forEach(n=>{o.option[n]=t[n]})},initColumnOptions:()=>{let a=JSONUtil.cp(b.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:y.tCurd("switchOn"),inactiveLabel:y.tCurd("switchOff")}});const t=n=>{if(n.table=ObjectUtil.deepMerge(a.table,n.table||{}),n.children){n.children.forEach(d=>{t(d)});return}n.options=ObjectUtil.deepMerge(a.options,n.options||{}),n.form=ObjectUtil.deepMerge(a.form,n.form||{}),n.show=ObjectUtil.deepMerge(a.show,n.show||{}),n.sort=ObjectUtil.deepMerge(a.sort,n.sort||{}),n.type=n.type||a.type,n.type==="switch"&&(n.options.switch.tableBeforeChange=async(d,m)=>{const h=n.options?.switch;try{await i.value?.open({title:y.tCurd("confirmModify"),content:y.tCurd("confirmSwitchMessage")}),l.table.loading=!0;try{return o.option.api.update?(await o.option.api.update({[o.option.table?.rowKey]:m[o.option.table?.rowKey],[d]:m[d]===h.activeValue?h.inactiveValue:h.activeValue,final(f,r,c){l.table.loading=!1}}),l.table.loading=!1,g.success(y.tCurd("operationSuccess")),l.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{l.table.loading=!1}}catch{return!1}}),n.type==="tree-select"&&(n.options.treeSelect.rowKey=o.option.table?.rowKey,n.options.treeSelect.nodeKey=o.option.table?.rowKey)};o.option.column.forEach(t),o.option.table?.column?.forEach(t)},initColumnForm:()=>{const a=o.option;l.update.formColumn=[],l.table.column.show={list:[],listSource:[]};const t=[],n=o.option.form?.maxSpan||12,d=o.option.form?.defaultSpan||n/2;let m=[];const h=c=>{if(c.children){l.table.column.show.list.push(c.key),c.children.forEach(k=>{h(k)});return}if(l.update.formDefault[c.key]=c.value,c.table.table&&(c.show.table&&l.table.column.show.list.push(c.key),c.table.table&&l.table.column.show.listSource.push(c.key)),c.isForm){c.form=c.form||{span:d},c.form.span=c.form.span??d;let k=c.form.span,w=m.reduce((E,S)=>E+S.span,k);const V=m.length;if(m.push({item:c,span:k}),(V===1&&m[0].span===0||w>=n||k===0&&V>1)&&(t.push(m),m=[]),c.rules){const E={input:y.tCurd("placeholderInput"),select:y.tCurd("placeholderSelect")},S=(E[c.type]||E.input)+c.label;l.update.rules[c.key]=typeof c.rules=="boolean"?[{required:!0,message:S,trigger:"blur"}]:c.rules}}},f=(c,k)=>{c.isForm=k,Array.isArray(c.children)&&c.children.forEach(w=>f(w,k))};a.column.forEach(c=>{c.isForm=!0,f(c,!0),h(c)}),o.option.table?.column?.forEach(c=>{f(c,!1),h(c)}),l.search.column.list=a.column.concat(a.table?.column||[]),l.table.column.list=l.search.column.list.filter(c=>c.table?.table),l.search.column.list.sort((c,k)=>c.sort?.search-k.sort?.search),l.table.column.list.sort((c,k)=>c.sort?.table-k.sort?.table),m.length>0&&t.push(m),l.update.formColumn=t;const r=o.option.search?.formDefault;r&&Object.keys(r).forEach(c=>{l.search.formDefault[c]=r[c]}),a.column.forEach(c=>{c.show?.search||(l.search.formDefault[c.key]=void 0)}),l.search.form=JSONUtil.cp(l.search.formDefault)}});return l.init(),e.onMounted(()=>{o.option.init!==!1&&l.table.getList()}),{conf:l,switchConfirmRef:i,ruleFormRef:s}},A={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(o,{expose:i}){const s=e.ref(!1),l=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,n=null;const d=f=>(f?.title&&(l.value=f.title),f?.content&&(a.value=f.content),s.value=!0,new Promise((r,c)=>{t=r,n=c})),m=()=>{s.value=!1,t?.(!0),t=null,n=null},h=()=>{s.value=!1,n?.(new Error("用户取消操作")),t=null,n=null};return i({open:d}),(f,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=c=>s.value=c),title:l.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",A,[e.createVNode(e.unref(p.ElButton),{onClick:h},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:m},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"]))}}),U=(o,i)=>{const s=o.__vccOpts||o;for(const[l,a]of i)s[l]=a;return s},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(o,i){return e.openBlock(),e.createElementBlock("svg",H,[...i[0]||(i[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=U(K,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(o,i){return e.openBlock(),e.createElementBlock("svg",G,[...i[0]||(i[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=U(q,[["render",X]]),Y={class:"row flex-center table-header-label"},Z={class:"table-header-tooltip"},P=["onClick"],_=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(o){const i=g.isFun,s=e.getCurrentInstance().type;return(l,a)=>{const t=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.key},[o.conf.table.column.show.list.includes(n.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:n.key,label:n.label},{ref_for:!0},n.table),{header:e.withCtx(()=>[e.renderSlot(l.$slots,"table-header-"+n.key,{item:n},()=>[e.createElementVNode("div",Y,[n.table?.tooltip?(e.openBlock(),e.createBlock(t,{key:0,effect:"dark",content:n.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:1},8,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])])]),default:e.withCtx(({row:d})=>[n.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s)),{conf:o.conf,columnList:n.children,option:o.option},e.createSlots({_:2},[e.renderList(l.$slots,(m,h)=>({name:h,fn:e.withCtx(f=>[e.renderSlot(l.$slots,h,e.mergeProps({ref_for:!0},f||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(n.show?.form,o.conf.inlineEdit.form,e.unref(g).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===d&&(n.type==="input"||n.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.select?.data,m=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(l.$slots,"table-"+n.key,{key:1,row:d,item:n},()=>[n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":m=>d[n.key]=m,"before-change":()=>n.options?.switch?.tableBeforeChange?.(n.key,d)},{ref_for:!0},n.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":n.table?.click?.color}),class:e.normalizeClass({"table-text-click":n.table?.click?.callback}),onClick:m=>n.table?.click?.callback?.(d)},e.toDisplayString(n.table?.format?n.table?.format(d):d[n.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),$=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(o){return(i,s)=>{const l=e.resolveComponent("el-radio"),a=e.resolveComponent("el-radio-group");return o.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.input,e.toHandlers(o.item.item.options?.input?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.switch,{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.select,e.toHandlers(o.item.item.options?.select?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="radio"?(e.openBlock(),e.createBlock(a,e.mergeProps({key:3,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.radio,e.toHandlers(o.item.item.options?.radio?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(l,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:4,row:o.conf.update.form,field:o.item.item.key},o.item.item.options?.list,e.toHandlers(o.item.item.options?.list?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:5,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.treeSelect,e.toHandlers(o.item.item.options?.treeSelect?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):o.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:6,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.datetime,e.toHandlers(o.item.item.options?.datetime?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type&&e.unref(C).customComponent[o.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[o.item.item.type]),e.mergeProps({key:7,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[6]||(s[6]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.[o.item.item.type],e.toHandlers(o.item.item.options?.[o.item.item.type]?.on||{}),{disabled:o.conf.update.getDisabled(o.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"}},ae={key:0},re={key:1},ie={key:2},se={class:"export-btn"},ce={class:"flex items-center",style:{gap:"10px"}},de={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},me={class:"row justify-end mt-10 mb-10"},pe={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ke={class:"row form-item-content",style:{width:"100%"}},ye={class:"col"},ge={class:"dialog-footer"},be={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(o,{expose:i}){const s=g.EDialog,l=o,a=g.isFun,{conf:t,switchConfirmRef:n,ruleFormRef:d}=j(l);return i({conf:t}),(m,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(m.$slots,"box-left"),e.createElementVNode("div",te,[o.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(p.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(m.$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,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(t).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-"+r.key,{row:e.unref(t).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.input,e.toHandlers(r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.switch,e.toHandlers(r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(y).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.select,e.toHandlers(r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.datetime,e.toHandlers(r.options?.datetime?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(C).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(C).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.[r.type],e.toHandlers(r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(m.$slots,"search-"+r.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(m.$slots,"search-center",{row:e.unref(t).search.form}),o.option.tools?.search||o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0},{default:e.withCtx(()=>[o.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$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(a)(o.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:h[0]||(h[0]=r=>e.unref(t).update.open(e.unref(s).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.table?.selectable&&e.unref(a)(o.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:h[1]||(h[1]=r=>e.unref(t).remove.open(e.unref(t).table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:h[2]||(h[2]=r=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[o.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(p.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",se,[e.createVNode(e.unref(p.ElButton),{type:"warning",loading:e.unref(t).export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(m.$slots,"tools-right"),o.option.tools?.refresh===void 0||o.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...r)=>e.unref(t).table.getList&&e.unref(t).table.getList(...r))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",de,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:e.unref(t).table.data,border:o.option.table?.border===void 0?!0:o.option.table?.border},o.option.table,{onSelectionChange:e.unref(t).table.selection.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change}),{default:e.withCtx(()=>[o.option.table?.selectable||e.unref(a)(o.option.tools?.delete)||o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof o.option.table?.selectable=="function"?o.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:o.option},e.createSlots({_:2},[e.renderList(m.$slots,(r,c)=>({name:c,fn:e.withCtx(k=>[e.renderSlot(m.$slots,c,e.normalizeProps(e.guardReactiveProps(k||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(o.option.table?.add)||e.unref(a)(o.option.table?.update)||e.unref(a)(o.option.table?.delete)||e.unref(a)(o.option.table?.view)||m.$slots["table-op-left"]||m.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(a)(o.option.table?.add),e.unref(a)(o.option.table?.update),e.unref(a)(o.option.table?.delete),e.unref(a)(o.option.table?.view),m.$slots["table-op-left"],m.$slots["table-op-right"]),align:"center",fixed:"right"},o.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(m.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.renderSlot(m.$slots,"table-op-left",{row:r}),o.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(p.ElButton),{link:"",type:"info",onClick:e.unref(t).inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.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(y).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(m.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(o.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).Insert,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.view,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).View,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"warning",onClick:c=>e.unref(t).update.open(e.unref(s).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:3,link:"",type:"danger",onClick:c=>e.unref(t).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-op-right",{row:r})],64))]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[f,e.unref(t).table.loading]])])]),e.createElementVNode("div",me,[o.option.page?.show===void 0||o.option.page?.show?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=r=>e.unref(t).page.num=r),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=r=>e.unref(t).page.size=r),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(m.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=r=>e.unref(t).update.show=r),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},o.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ge,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(s).View?(e.openBlock(),e.createBlock(e.unref(p.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(y).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:d,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,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(()=>{const c=[],k=w=>{if(w.children)return k(w.children);c.push(...w.map(V=>V.item.show?.form))};return k(r),c},e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:o.option.form?.stripe===void 0?!0:o.option.form?.stripe}])},[e.renderSlot(m.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(c.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[c.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.children,k=>(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof k.item.text?.form?.label=="boolean"?!k.item.text?.form?.label:!1}),label:typeof k.item.text?.form?.label=="string"?k.item.text?.form?.label:k.item.label,prop:k.item.key,"label-width":k.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",pe,[e.renderSlot(m.$slots,"form-"+k.item.key+"-start",{row:e.unref(t).update.form,item:k.item}),e.createElementVNode("div",he,[e.renderSlot(m.$slots,"form-"+k.item.key,{row:e.unref(t).update.form,item:k.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+k.item.key+"-right",{row:e.unref(t).update.form,item:k.item})]),e.renderSlot(m.$slots,"form-"+k.item.key+"-end",{row:e.unref(t).update.form,item:k.item})])]),_:2},1032,["class","label","prop","label-width"]))),256)):(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof c.item.text?.form?.label=="boolean"?!c.item.text?.form?.label:!1}),label:typeof c.item.text?.form?.label=="string"?c.item.text?.form?.label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ke,[e.renderSlot(m.$slots,"form-"+c.item.key+"-start",{row:e.unref(t).update.form,item:c.item}),e.createElementVNode("div",ye,[e.renderSlot(m.$slots,"form-"+c.item.key,{row:e.unref(t).update.form,item:c.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+c.item.key+"-right",{row:e.unref(t).update.form,item:c.item})]),e.renderSlot(m.$slots,"form-"+c.item.key+"-end",{row:e.unref(t).update.form,item:c.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(m.$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(p.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=r=>e.unref(t).remove.show=r),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(p.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(y).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(y).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(R,{ref_key:"switchConfirmRef",ref:n},null,512)])}}});class ue{static async download(i,s="download.png"){const l=document.createElement("a");l.style.display="none",l.href=i,l.setAttribute("download",s),typeof l.download>"u"&&l.setAttribute("target","_blank"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i)}static exportJSONFile=(i,s)=>{const l=new Blob([JSON.stringify(i)],{type:"application/json"}),a=URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async i=>new Promise((s,l)=>{const a=document.createElement("input");a.type="file";const t=i?.accept||".json";a.accept=t,a.style.display="none",a.onchange=n=>{const d=n.target.files[0];if(!d){g.fail("未选择文件"),l("未选择文件");return}const m=new FileReader;m.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},m.onerror=()=>{g.fail("文件读取失败"),l("文件读取失败")},m.readAsText(d),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(o,i)=>{if(o.component("TCurd",O),o.component("TFormList",N),o.component("TColumn",D),i?.customComponent){C.customComponent=i.customComponent;for(const s in i.customComponent)o.component(s,i.customComponent[s])}},we={install:T};u.ArrUtil=B,u.ExcelUtil=F,u.TColumn=D,u.TCurd=O,u.TFile=ue,u.TForm=C,u.TFormConfig=b,u.TFormI18n=y,u.TFormList=N,u.TSys=g,u.default=we,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("element-plus"),require("vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.cc1Form={},u.ElementPlus,u.Vue))})(this,(function(u,p,e){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",View:"View",Remove:"Remove"};static isFun=(i,...s)=>Array.isArray(i)?i.some(l=>typeof l=="function"?l(...s):l):typeof i=="function"?i(...s):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(s).length?s:{}};static moduleObj={};static loadModule=async i=>{if(!b.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const s=await b.moduleObj[i]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(i,s,l={}){const a=Date.now();if(!this.tipMessages[i]||a-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=a;const t=Object.assign({message:i,type:s},l);p.ElMessage(t),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,s={})=>{this.showMessage(i,"error",s)};static success=(i,s={})=>{this.showMessage(i,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=p.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,s=!0)=>{if(s){let l=screen.width/2-500,a=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+l)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(s,l)=>{let a=document.getElementById(i.id);const t=await b.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let d=n.toDataURL("image/png");s(d)})}catch(n){l(n)}})}class y{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=i=>{y.config=ObjectUtil.deepMerge(y.config,i)}}class B{static customComponent={};static findOptions=(i,s)=>{const l=i.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(n,d)=>d.toUpperCase());if(l)return l.options[a(l.type)]};static setOptionsData=(i,s,l)=>{const a=B.findOptions(i,s);a&&(a.data=l)};static form={openBefore:{parentId:(i,s,l,a)=>{const t=y.config.table.rowKey;i?s.type===b.EDialog.Insert?(s.form.parentId=i[t],s.form.sort=i.children.length+1):s.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=l.length+1),B.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:l}])}}}}class E{static getIdFun=()=>StrUtil.uuid();static setId=(i,s,l)=>{s[i]||(s[i]=[]);const a=y.config.table.rowKey;s[i].forEach(t=>{l.forEach(n=>{let d=n.default??"";n.type==="number"&&(d=n.default??0),n.type==="boolean"&&(d=n.default??!1),n.type==="time"&&(d=n.default??new Date),t[n.value]===void 0&&(t[n.value]=d)}),t[a]||(t[a]=E.getIdFun())})};static add=(i,s,l,a)=>{const t=JSONUtil.cp(l);E.setId(i,s,l);const n=y.config.table.rowKey;s[i].push(t.reduce((d,m)=>{let h=m.default??"";return m.type==="number"&&(h=m.default??0),m.type==="boolean"&&(h=m.default??!1),m.type==="time"&&(h=m.default??new Date),d[m.value]=h,d},{[n]:E.getIdFun()})),a?.(s)};static remove=(i,s,l,a)=>{const t=y.config.table.rowKey;s[i]=s[i].filter(n=>n[t]!==l[t]),a?.(s)};static getNoIdData=(i,s)=>{const l=JSONUtil.cp(i),a=y.config.table.rowKey;return l.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&E.getNoIdData(t[s],s)}),l}}const L={key:0,class:"column",style:{width:"100%",gap:"10px"}},I={class:"row items-center",style:{gap:"10px",width:"100%"}},N=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(o,{emit:i}){const s=o,l=e.reactive({show:!1,add:(t,n,d)=>{E.add(t,n,d,()=>{a("change")})},remove:(t,n,d)=>{E.remove(t,n,d,()=>{a("change")})}});e.onMounted(()=>{E.setId(s.field,s.row,s.itemFields),l.show=!0});const a=i;return(t,n)=>{const d=e.resolveComponent("el-button"),m=e.resolveComponent("el-input");return l.show?(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(t.$slots,"list-start",{row:o.row}),e.createElementVNode("div",null,[e.createVNode(d,{link:"",type:"primary",onClick:n[0]||(n[0]=h=>l.add(o.field,o.row,o.itemFields))},{default:e.withCtx(()=>[...n[2]||(n[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.row[o.field],h=>(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(t.$slots,"item-start",{item:h,row:o.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.itemFields,f=>(e.openBlock(),e.createBlock(m,{modelValue:h[f.value],"onUpdate:modelValue":r=>h[f.value]=r,style:e.normalizeStyle({width:o.inputWidth}),class:e.normalizeClass(o.inputClass),placeholder:f[o.label]||f[o.value],onChange:n[1]||(n[1]=r=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:h,row:o.row}),e.createVNode(d,{link:"",type:"danger",onClick:f=>l.remove(o.field,o.row,h)},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(t.$slots,"list-end",{row:o.row})])):e.createCommentVNode("",!0)}}}),M={class:"row curd-row"},D=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(o,{expose:i}){const s=b.isFun,l=b.EDialog,a=e.ref(),t=o,n=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:d=>d.disabled?.[(t.type||l.Insert)===l.Insert?"create":"update"],initColumnForm:async()=>{const d=t.option;n.formColumn=[];const m=[],h=t.option.form?.maxSpan||12,f=t.option.form?.defaultSpan||h;let r=[];const c=g=>{if(n.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=r.reduce((x,Ce)=>x+Ce.span,w);const V=r.length;r.push({item:g,span:w}),(V===1&&r[0].span===0||C>=h||w===0&&V>1)&&(m.push(r),r=[]),g.rules&&(n.rules[g.key]=g.rules)}};d.column.forEach(g=>{g.isForm=!0,c(g)}),r.length>0&&m.push(r),n.formColumn=m,n.form=JSONUtil.cp(n.formDefault)},init:async()=>{n.show=!1,await e.nextTick(),n.initColumnForm()}});return n.initColumnForm(),i({ref:a,conf:n}),(d,m)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:a,model:n.form,rules:n.rules},{default:e.withCtx(()=>[n.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.formColumn,h=>(e.openBlock(),e.createElementBlock("div",M,[e.renderSlot(d.$slots,"form-start",{row:n.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,n.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(p.ElFormItem),{label:f.item.label,prop:f.item.key,"label-width":f.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"form-"+f.item.key+"-start",{row:n.form,item:f.item}),e.renderSlot(d.$slots,"form-"+f.item.key,{row:n.form,item:f.item},()=>[f.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.input,e.toHandlers(f.item.options?.input?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.switch,e.toHandlers(f.item.options?.switch?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.select,e.toHandlers(f.item.options?.select?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.item.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:n.form,field:f.item.key},{ref_for:!0},f.item.options?.list,e.toHandlers(f.item.options?.list?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):f.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.treeSelect,e.toHandlers(f.item.options?.treeSelect?.on||{}),{disabled:n.getDisabled(f.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):f.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.datetime,e.toHandlers(f.item.options?.datetime?.on||{}),{disabled:n.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:n.form[f.item.key],"onUpdate:modelValue":r=>n.form[f.item.key]=r},{ref_for:!0},f.item.options?.[f.item.type],e.toHandlers(f.item.options?.[f.item.type]?.on||{}),{disabled:n.getDisabled(f.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(d.$slots,"form-"+f.item.key+"-end",{row:n.form,item:f.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(d.$slots,"form-end",{row:n.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});function Ve(o){return o}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(i,...s){if(typeof i=="function")return i(...s);i=String(i);let l=0;return i.replace(/{([^}]+)}/g,(a,t)=>l<s.length?String(s[l++]):`{${t}}`)}static setI18n=i=>{k.curd=ObjectUtil.deepMerge(k.curd,i)};static tCurd(i,...s){return this.t(this.curd[i],...s)}static curd=j}class F{static exportToExcel=async(i,s,l)=>{if(!i||i.length===0)return;const a=await b.loadModule("xlsx"),t=i.map(m=>{const h={};return s.forEach(f=>{h[f.label]=m[f.key]}),h}),n=a.utils.json_to_sheet(t),d=a.utils.book_new();a.utils.book_append_sheet(d,n,"Sheet1"),l?typeof l=="function"&&(l=l()):l=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(d,`${l}.xlsx`)}}const S=b.EDialog,z=o=>{const i=e.ref(),s=e.ref(),l=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(a,t=k.tCurd("placeholderInput"))=>a.text?.search?.placeholder===void 0?`${t}${a.label}`:a.text?.search?.placeholder,getFormData:()=>{let a={};o.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(l.search.form):n.show?.search)&&(a[n.key]=l.search.form[n.key])});const t=o.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const a=l.search.formDefault;Object.keys(a).forEach(t=>{o.option.search?.resetMode==="none"?a[t]=void 0:a[t]=l.search.formDefault[t]}),l.search.form=JSONUtil.cp(a),l.page.num=1,o.option.init!==!1&&l.table.getList()},submit:()=>{l.page.num=1,l.table.getList()}},page:{size:o.option.page?.size||10,sizeList:o.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:o.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{op:{width:(...a)=>a.filter(n=>n).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{if(l.table.expand.isExpand)l.table.expand.rowKeys=[];else{const a=t=>{let n=[];return t.forEach(d=>{n.push(d[o.option.table.rowKey]),d.children&&d.children.length>0&&(n=n.concat(a(d.children)))}),n};l.table.expand.rowKeys=a(l.table.data)}l.table.expand.isExpand=!l.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{l.table.loading=!0;const a=o.option.api.list;try{await l.initApiData("init");let t={};if(l.table.sort.prop){const{props:c,order:g}=y.config.table.sort;t={[c.field]:l.table.sort.prop,[g.field]:l.table.sort.order}}const n=await a({[y.config.page.size]:l.page.size,[y.config.page.num]:l.page.num,...l.search.getFormData(),...t}),d=y.config.result,m=n.data||{[d.list]:n};let h=(Array.isArray(m[d.list]),m[d.list]);const f=l.update.formColumn.flat(),r=JSONUtil.cp(h).map(c=>(Object.keys(c).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(x=>x.value==V[w])?.label||V[w]))}),c));l.table.data=o.option.data?await o.option.data(r,h):r,l.page.total=m[d.total]||0}catch(t){console.error(t)}finally{l.table.loading=!1}},selection:{list:[],change:a=>{l.table.selection.list=a}},sort:{prop:"",order:"",change:a=>{y.config.table.sort.resetPage&&(l.page.num=1);const t=y.config.table.sort;if(t.change){t.change(a,l);return}l.table.sort.prop=a.prop,a.order===null?l.table.sort.order="":l.table.sort.order=a.order==="ascending"?t.order.asc:t.order.desc,l.table.getList()}}},export:{run:{start:async a=>{let t=await l.export.run[a](),n=o.option.column;const d=JSONUtil.cp({data:t,columns:n}),m=o.option.tools?.export||{};m.before&&m.before(d),F.exportToExcel(d.data,d.columns,m.fileName)},select:()=>{if(l.table.selection.list.length===0)throw b.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return l.table.selection.list},page:()=>{if(l.table.data.length===0)throw b.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return l.table.data},all:async()=>{l.export.loading=!0;try{if(o.option.tools?.export?.all){await o.option.tools?.export?.all({[y.config.page.size]:l.page.size,[y.config.page.num]:l.page.num,...l.search.getFormData()});return}const a=o.option.api.list,t=await a({[y.config.page.size]:999999,[y.config.page.num]:1});return(t.data||{[y.config.result.list]:t})[y.config.result.list]}catch(a){console.error(a)}finally{l.export.loading=!1}}},loading:!1,click:a=>{l.export.loading||l.export.run.start(a)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:S.Insert,form:{},formDefault:{},formColumn:[],getDisabled:a=>l.update.type===S.View?!0:a.disabled?.[l.update.type===S.Insert?"create":"update"],edit:{data:{},getApiData:a=>{if(o.option.form?.editAll)return a;let t={[o.option.table?.rowKey]:l.update.edit.data[o.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(n=>{a[n]!==l.update.edit.data[n]&&(t[n]=a[n])}),t}},view:{},open:(a,t)=>{l.update.showContent||FunUtil.throttle(async()=>{b.loading(!0);try{await l.initApiData("update");const n=a===S.Insert;if(!n&&o.option.table?.inlineEdit){l.inlineEdit.open(t);return}l.update.type=a,l.update.edit.data=t,l.update.title=k.tCurd(n?"add":a===S.View?"view":"edit"),l.update.form=JSONUtil.cp(n?l.update.formDefault:t),await o.option.form?.openBefore?.(t,l.update),l.update.show=!0,l.update.showContent=!0,o.option.form?.openAfter?.(t,l.update)}catch(n){console.error(n)}finally{b.loading(!1)}})},submit:()=>{FunUtil.throttle(async()=>{await s.value?.validate(async(d,m)=>new Promise((h,f)=>{d||(b.fail(k.tCurd("checkFormData")),f(!1)),h()})),l.update.loading=!0;const a=l.update.type===S.Insert?o.option.api.create:o.option.api.update;let t=JSONUtil.cp(l.update.form);delete t.children,await o.option.form?.submitBefore?.(t,l.update);const n=new Set(o.option.column.filter(d=>d.type==="datetime").map(d=>d.key));Object.keys(t).forEach(d=>{if(n.has(d)&&t[d]!=null){const m=new Date(t[d]).getTime();isNaN(m)||(t[d]=m)}});try{if(!a)return;await a({...t}),l.update.close(),await l.table.getList(),o.option.form?.submitAfter?.(t,l.update)}catch(d){console.error(d)}finally{l.update.loading=!1}})},close:()=>{l.update.show=!1,setTimeout(()=>{l.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:a=>{l.inlineEdit.row=a,l.inlineEdit.form=JSONUtil.cp(a)},close:()=>{l.inlineEdit.row=null,l.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{l.inlineEdit.loading=!0;const a=o.option.api.update;let t=JSONUtil.cp(l.inlineEdit.form);delete t.children;try{if(!a)return;await a({...t}),l.inlineEdit.close(),await l.table.getList(),b.success(k.tCurd("operationSuccess"))}catch(n){console.error(n)}finally{l.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{l.remove.show=!1},open:a=>{if(a.length===0){b.fail(k.tCurd("selectDataToDelete"));return}l.remove.items=a,l.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{l.remove.loading=!0;const a=o.option.api.delete;try{if(!a)return;await a({[o.option.table?.rowKey]:l.remove.items.map(t=>t[o.option.table?.rowKey]),items:l.remove.items}),b.success(k.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(t){console.error(t)}finally{l.remove.loading=!1}})}},init:()=>{l.initCurdConfig(),l.initColumnOptions(),l.initColumnForm()},apiDataMap:{},initApiData:async a=>{const t=[],n=d=>{if(d.children&&d.children.length){d.children.forEach(m=>n(m));return}if(d.type==="select"&&d.options?.select?.dataApi&&d.options?.select?.dataApiConfig?.[a]){if(l.apiDataMap[d.key]&&d.options?.select?.dataApiConfig?.once)return;const m=(async()=>{try{let h=await d.options?.select?.dataApi?.();if(h){const f=d.options?.select?.dataPath;f&&(h=ObjectUtil.getPathValue(h,f)),d.options.select.data=h,l.apiDataMap[d.key]=h}}catch{}})();t.push(m)}};return o.option.column.forEach(d=>{n(d)}),await Promise.all(t),!0},initCurdConfig:()=>{const a=JSONUtil.cp(y.config);a.table.emptyText=k.tCurd("noData");const t=ObjectUtil.deepMerge(a,o.option||{});Object.keys(t).forEach(n=>{o.option[n]=t[n]})},initColumnOptions:()=>{let a=JSONUtil.cp(y.config.columnConfig);a.options=ObjectUtil.deepMerge(a.options,{switch:{activeLabel:k.tCurd("switchOn"),inactiveLabel:k.tCurd("switchOff")}});const t=n=>{if(n.table=ObjectUtil.deepMerge(a.table,n.table||{}),n.children){n.children.forEach(d=>{t(d)});return}n.options=ObjectUtil.deepMerge(a.options,n.options||{}),n.form=ObjectUtil.deepMerge(a.form,n.form||{}),n.show=ObjectUtil.deepMerge(a.show,n.show||{}),n.sort=ObjectUtil.deepMerge(a.sort,n.sort||{}),n.type=n.type||a.type,n.type==="switch"&&(n.options.switch.tableBeforeChange=async(d,m)=>{const h=n.options?.switch;try{await i.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),l.table.loading=!0;try{return o.option.api.update?(await o.option.api.update({[o.option.table?.rowKey]:m[o.option.table?.rowKey],[d]:m[d]===h.activeValue?h.inactiveValue:h.activeValue,final(f,r,c){l.table.loading=!1}}),l.table.loading=!1,b.success(k.tCurd("operationSuccess")),l.table.getList(),!0):void 0}catch(f){return console.error(f),!1}finally{l.table.loading=!1}}catch{return!1}}),n.type==="tree-select"&&(n.options.treeSelect.rowKey=o.option.table?.rowKey,n.options.treeSelect.nodeKey=o.option.table?.rowKey)};o.option.column.forEach(t),o.option.table?.column?.forEach(t)},initColumnForm:()=>{const a=o.option;l.update.formColumn=[],l.table.column.show={list:[],listSource:[]};const t=[],n=o.option.form?.maxSpan||12,d=o.option.form?.defaultSpan||n/2;let m=[];const h=c=>{if(c.children){l.table.column.show.list.push(c.key),c.children.forEach(g=>{h(g)});return}if(l.update.formDefault[c.key]=c.value,c.table.table&&(c.show.table&&l.table.column.show.list.push(c.key),c.table.table&&l.table.column.show.listSource.push(c.key)),c.isForm){c.form=c.form||{span:d},c.form.span=c.form.span??d;let g=c.form.span,w=m.reduce((V,x)=>V+x.span,g);const C=m.length;if(m.push({item:c,span:g}),(C===1&&m[0].span===0||w>=n||g===0&&C>1)&&(t.push(m),m=[]),c.rules){const V={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},x=(V[c.type]||V.input)+c.label;l.update.rules[c.key]=typeof c.rules=="boolean"?[{required:!0,message:x,trigger:"blur"}]:c.rules}}},f=(c,g)=>{c.isForm=g,Array.isArray(c.children)&&c.children.forEach(w=>f(w,g))};a.column.forEach(c=>{c.isForm=!0,f(c,!0),h(c)}),o.option.table?.column?.forEach(c=>{f(c,!1),h(c)}),l.search.column.list=a.column.concat(a.table?.column||[]),l.table.column.list=l.search.column.list.filter(c=>c.table?.table),l.search.column.list.sort((c,g)=>c.sort?.search-g.sort?.search),l.table.column.list.sort((c,g)=>c.sort?.table-g.sort?.table),m.length>0&&t.push(m),l.update.formColumn=t;const r=o.option.search?.formDefault;r&&Object.keys(r).forEach(c=>{l.search.formDefault[c]=r[c]}),a.column.forEach(c=>{c.show?.search||(l.search.formDefault[c.key]=void 0)}),l.search.form=JSONUtil.cp(l.search.formDefault)}});return l.init(),e.onMounted(()=>{o.option.init!==!1&&l.table.getList()}),{conf:l,switchConfirmRef:i,ruleFormRef:s}},A={class:"dialog-footer"},R=e.defineComponent({__name:"switchConfirm",setup(o,{expose:i}){const s=e.ref(!1),l=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,n=null;const d=f=>(f?.title&&(l.value=f.title),f?.content&&(a.value=f.content),s.value=!0,new Promise((r,c)=>{t=r,n=c})),m=()=>{s.value=!1,t?.(!0),t=null,n=null},h=()=>{s.value=!1,n?.(new Error("用户取消操作")),t=null,n=null};return i({open:d}),(f,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=c=>s.value=c),title:l.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",A,[e.createVNode(e.unref(p.ElButton),{onClick:h},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:m},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"]))}}),U=(o,i)=>{const s=o.__vccOpts||o;for(const[l,a]of i)s[l]=a;return s},H={},K={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function J(o,i){return e.openBlock(),e.createElementBlock("svg",K,[...i[0]||(i[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=U(H,[["render",J]]),q={},G={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function X(o,i){return e.openBlock(),e.createElementBlock("svg",G,[...i[0]||(i[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=U(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(o){const i=b.isFun,s=e.getCurrentInstance().type;return(l,a)=>{const t=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.columnList,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.key},[o.conf.table.column.show.list.includes(n.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:n.key,label:n.label},{ref_for:!0},n.table),{header:e.withCtx(()=>[e.renderSlot(l.$slots,"table-header-"+n.key,{item:n},()=>[e.createElementVNode("div",Y,[n.table?.tooltip?(e.openBlock(),e.createBlock(t,{key:0,effect:"dark",content:n.table?.tooltip,placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",Z,[e.createVNode(Q)])]),_:1},8,["content"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label),1)])])]),default:e.withCtx(({row:d})=>[n.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a[0]||(a[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(s)),{conf:o.conf,columnList:n.children,option:o.option},e.createSlots({_:2},[e.renderList(l.$slots,(m,h)=>({name:h,fn:e.withCtx(f=>[e.renderSlot(l.$slots,h,e.mergeProps({ref_for:!0},f||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(n.show?.form,o.conf.inlineEdit.form,e.unref(b).EDialog.Update)&&o.option.table?.inlineEdit&&o.conf.inlineEdit.row===d&&(n.type==="input"||n.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(o.conf.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:o.conf.inlineEdit.form[n.key],"onUpdate:modelValue":m=>o.conf.inlineEdit.form[n.key]=m},{ref_for:!0},n.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.select?.data,m=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(l.$slots,"table-"+n.key,{key:1,row:d,item:n},()=>[n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":m=>d[n.key]=m,"before-change":()=>n.options?.switch?.tableBeforeChange?.(n.key,d)},{ref_for:!0},n.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":n.table?.click?.color}),class:e.normalizeClass({"table-text-click":n.table?.click?.callback}),onClick:m=>n.table?.click?.callback?.(d)},e.toDisplayString(n.table?.format?n.table?.format(d):d[n.key]),15,P))])],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)}}}),$=e.defineComponent({__name:"formColumn",props:{conf:{},item:{}},setup(o){return(i,s)=>{const l=e.resolveComponent("el-radio"),a=e.resolveComponent("el-radio-group");return o.item.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[0]||(s[0]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.input,e.toHandlers(o.item.item.options?.input?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[1]||(s[1]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.switch,{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[2]||(s[2]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.select,e.toHandlers(o.item.item.options?.select?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.select?.data,t=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="radio"?(e.openBlock(),e.createBlock(a,e.mergeProps({key:3,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[3]||(s[3]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.radio,e.toHandlers(o.item.item.options?.radio?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(l,{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.item.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:4,row:o.conf.update.form,field:o.item.item.key},o.item.item.options?.list,e.toHandlers(o.item.item.options?.list?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:5,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[4]||(s[4]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.treeSelect,e.toHandlers(o.item.item.options?.treeSelect?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):o.item.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:6,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[5]||(s[5]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.datetime,e.toHandlers(o.item.item.options?.datetime?.on||{}),{disabled:o.conf.update.getDisabled(o.item.item)}),null,16,["modelValue","disabled"])):o.item.item.type&&e.unref(B).customComponent[o.item.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[o.item.item.type]),e.mergeProps({key:7,modelValue:o.conf.update.form[o.item.item.key],"onUpdate:modelValue":s[6]||(s[6]=t=>o.conf.update.form[o.item.item.key]=t)},o.item.item.options?.[o.item.item.type],e.toHandlers(o.item.item.options?.[o.item.item.type]?.on||{}),{disabled:o.conf.update.getDisabled(o.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"}},ae={key:0},re={key:1},ie={key:2},se={class:"export-btn"},ce={class:"flex items-center",style:{gap:"10px"}},de={class:"col fit-width relative form-box"},fe={class:"absolute column fit form-box-content"},me={class:"row justify-end mt-10 mb-10"},pe={class:"row form-item-content",style:{width:"100%"}},he={class:"col"},ge={class:"row form-item-content",style:{width:"100%"}},ke={class:"col"},be={class:"dialog-footer"},ye={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(o,{expose:i}){const s=b.EDialog,l=o,a=b.isFun,{conf:t,switchConfirmRef:n,ruleFormRef:d}=z(l);return i({conf:t}),(m,h)=>{const f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("div",ee,[e.renderSlot(m.$slots,"box-left"),e.createElementVNode("div",te,[o.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(p.ElForm),{model:e.unref(t).search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(m.$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,r=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.key},[(typeof r.show?.search=="function"?r.show?.search(e.unref(t).search.form):r.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof r.text?.search?.label=="string"?r.text?.search?.label:r.label,class:e.normalizeClass({"hide-label":typeof r.text?.search?.label=="boolean"?!r.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(m.$slots,"search-"+r.key,{row:e.unref(t).search.form},()=>[r.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.input,e.toHandlers(r.options?.input?.on||{})),null,16,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:1,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.switch,e.toHandlers(r.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.activeValue,label:r.options?.switch?.activeLabel,value:r.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:r.options?.switch?.inactiveValue,label:r.options?.switch?.inactiveLabel,value:r.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c,placeholder:e.unref(t).search.getPlaceholder(r,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:r.disabled?.search},{ref_for:!0},r.options?.select,e.toHandlers(r.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","placeholder","disabled"])):r.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:3,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.datetime,e.toHandlers(r.options?.datetime?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.type&&e.unref(B).customComponent[r.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(B).customComponent[r.type]),e.mergeProps({key:4,modelValue:e.unref(t).search.form[r.key],"onUpdate:modelValue":c=>e.unref(t).search.form[r.key]=c},{ref_for:!0},r.options?.[r.type],e.toHandlers(r.options?.[r.type]?.on||{}),{disabled:r.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(m.$slots,"search-"+r.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(m.$slots,"search-center",{row:e.unref(t).search.form}),o.option.tools?.search||o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0},{default:e.withCtx(()=>[o.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.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),o.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.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(m.$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(a)(o.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:h[0]||(h[0]=r=>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),o.option.table?.selectable&&e.unref(a)(o.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:h[1]||(h[1]=r=>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),o.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",ie,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:h[2]||(h[2]=r=>e.unref(t).table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[o.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(p.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(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(p.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(p.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(m.$slots,"tools-left")]),e.createElementVNode("div",ce,[e.renderSlot(m.$slots,"tools-right"),o.option.tools?.refresh===void 0||o.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:h[3]||(h[3]=(...r)=>e.unref(t).table.getList&&e.unref(t).table.getList(...r))},[e.createVNode(W)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",de,[e.createElementVNode("div",fe,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:e.unref(t).table.data,border:o.option.table?.border===void 0?!0:o.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},o.option.table,e.toHandlers(o.option.table?.on||{})),{default:e.withCtx(()=>[o.option.table?.selectable||e.unref(a)(o.option.tools?.delete)||o.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof o.option.table?.selectable=="function"?o.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:o.option},e.createSlots({_:2},[e.renderList(m.$slots,(r,c)=>({name:c,fn:e.withCtx(g=>[e.renderSlot(m.$slots,c,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(o.option.table?.add)||e.unref(a)(o.option.table?.update)||e.unref(a)(o.option.table?.delete)||e.unref(a)(o.option.table?.view)||m.$slots["table-op-left"]||m.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:1,width:e.unref(t).table.op.width(e.unref(a)(o.option.table?.add),e.unref(a)(o.option.table?.update),e.unref(a)(o.option.table?.delete),e.unref(a)(o.option.table?.view),m.$slots["table-op-left"],m.$slots["table-op-right"]),align:"center",fixed:"right"},o.option.table?.operate),{header:e.withCtx(()=>[e.renderSlot(m.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("operation")),1)])]),default:e.withCtx(({row:r})=>[e.renderSlot(m.$slots,"table-op-left",{row:r}),o.option.table?.inlineEdit&&e.unref(t).inlineEdit.row===r?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(p.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(p.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(m.$slots,"table-op-edit-right",{row:r})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a)(o.option.table?.add,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).Insert,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.view,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"primary",onClick:c=>e.unref(t).update.open(e.unref(s).View,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.update,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"warning",onClick:c=>e.unref(t).update.open(e.unref(s).Update,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(o.option.table?.delete,r)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:3,link:"",type:"danger",onClick:c=>e.unref(t).remove.open([r])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"table-op-right",{row:r})],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",me,[o.option.page?.show===void 0||o.option.page?.show?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":h[4]||(h[4]=r=>e.unref(t).page.num=r),"page-size":e.unref(t).page.size,"onUpdate:pageSize":h[5]||(h[5]=r=>e.unref(t).page.size=r),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(m.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":h[6]||(h[6]=r=>e.unref(t).update.show=r),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},o.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",be,[e.createVNode(e.unref(p.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(p.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(p.ElForm),{ref_key:"ruleFormRef",ref:d,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,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(()=>{const c=[],g=w=>{if(w.children)return g(w.children);c.push(...w.map(C=>C.item.show?.form))};return g(r),c},e.unref(t).update.form,e.unref(t).update.type)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:o.option.form?.stripe===void 0?!0:o.option.form?.stripe}])},[e.renderSlot(m.$slots,"form-start",{row:e.unref(t).update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,c=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(a)(c.item.show?.form,e.unref(t).update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.item.form.span>0?`col-${c.item.form.span}`:"col")},[c.item.children?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.children,g=>(e.openBlock(),e.createBlock(e.unref(p.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",pe,[e.renderSlot(m.$slots,"form-"+g.item.key+"-start",{row:e.unref(t).update.form,item:g.item}),e.createElementVNode("div",he,[e.renderSlot(m.$slots,"form-"+g.item.key,{row:e.unref(t).update.form,item:g.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+g.item.key+"-right",{row:e.unref(t).update.form,item:g.item})]),e.renderSlot(m.$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(p.ElFormItem),{key:1,class:e.normalizeClass({"hide-label":typeof c.item.text?.form?.label=="boolean"?!c.item.text?.form?.label:!1}),label:typeof c.item.text?.form?.label=="string"?c.item.text?.form?.label:c.item.label,prop:c.item.key,"label-width":c.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",ge,[e.renderSlot(m.$slots,"form-"+c.item.key+"-start",{row:e.unref(t).update.form,item:c.item}),e.createElementVNode("div",ke,[e.renderSlot(m.$slots,"form-"+c.item.key,{row:e.unref(t).update.form,item:c.item},()=>[e.createVNode($,{conf:e.unref(t),item:c},null,8,["conf","item"])]),e.renderSlot(m.$slots,"form-"+c.item.key+"-right",{row:e.unref(t).update.form,item:c.item})]),e.renderSlot(m.$slots,"form-"+c.item.key+"-end",{row:e.unref(t).update.form,item:c.item})])]),_:2},1032,["class","label","prop","label-width"]))],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(m.$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(p.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":h[7]||(h[7]=r=>e.unref(t).remove.show=r),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ye,[e.createVNode(e.unref(p.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(p.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(R,{ref_key:"switchConfirmRef",ref:n},null,512)])}}});class ue{static async download(i,s="download.png"){const l=document.createElement("a");l.style.display="none",l.href=i,l.setAttribute("download",s),typeof l.download>"u"&&l.setAttribute("target","_blank"),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(i)}static exportJSONFile=(i,s)=>{const l=new Blob([JSON.stringify(i)],{type:"application/json"}),a=URL.createObjectURL(l),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async i=>new Promise((s,l)=>{const a=document.createElement("input");a.type="file";const t=i?.accept||".json";a.accept=t,a.style.display="none",a.onchange=n=>{const d=n.target.files[0];if(!d){b.fail("未选择文件"),l("未选择文件");return}const m=new FileReader;m.onload=async h=>{const f=t==".json"?JSON.parse(h.target.result):h.target.result;s(f)},m.onerror=()=>{b.fail("文件读取失败"),l("文件读取失败")},m.readAsText(d),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const T=(o,i)=>{if(o.component("TCurd",O),o.component("TFormList",N),o.component("TColumn",D),i?.customComponent){B.customComponent=i.customComponent;for(const s in i.customComponent)o.component(s,i.customComponent[s])}},we={install:T};u.ArrUtil=E,u.ExcelUtil=F,u.TColumn=D,u.TCurd=O,u.TFile=ue,u.TForm=B,u.TFormConfig=y,u.TFormI18n=k,u.TFormList=N,u.TSys=b,u.default=we,u.install=T,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -119,8 +119,7 @@ declare const conf: {
|
|
|
119
119
|
show?: {
|
|
120
120
|
table?: boolean | undefined;
|
|
121
121
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
122
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof
|
|
123
|
-
/** @type {typeof __VLS_ctx.ruleFormRef} */ TSys.EDialog.View) => boolean) | undefined;
|
|
122
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof TSys.EDialog.View) => boolean) | undefined;
|
|
124
123
|
} | undefined;
|
|
125
124
|
sort?: {
|
|
126
125
|
search?: number | undefined;
|
|
@@ -247,8 +246,7 @@ declare var __VLS_7: {
|
|
|
247
246
|
show?: {
|
|
248
247
|
table?: boolean | undefined;
|
|
249
248
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
250
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof
|
|
251
|
-
/** @type {typeof __VLS_ctx.ruleFormRef} */ TSys.EDialog.View) => boolean) | undefined;
|
|
249
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof TSys.EDialog.View) => boolean) | undefined;
|
|
252
250
|
} | undefined;
|
|
253
251
|
sort?: {
|
|
254
252
|
search?: number | undefined;
|
|
@@ -366,8 +364,7 @@ declare var __VLS_7: {
|
|
|
366
364
|
show?: {
|
|
367
365
|
table?: boolean | undefined;
|
|
368
366
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
369
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof
|
|
370
|
-
/** @type {typeof __VLS_ctx.ruleFormRef} */ TSys.EDialog.View) => boolean) | undefined;
|
|
367
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof TSys.EDialog.View) => boolean) | undefined;
|
|
371
368
|
} | undefined;
|
|
372
369
|
sort?: {
|
|
373
370
|
search?: number | undefined;
|
|
@@ -485,8 +482,7 @@ declare var __VLS_7: {
|
|
|
485
482
|
show?: {
|
|
486
483
|
table?: boolean | undefined;
|
|
487
484
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
488
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof
|
|
489
|
-
/** @type {typeof __VLS_ctx.ruleFormRef} */ TSys.EDialog.View) => boolean) | undefined;
|
|
485
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof TSys.EDialog.View) => boolean) | undefined;
|
|
490
486
|
} | undefined;
|
|
491
487
|
sort?: {
|
|
492
488
|
search?: number | undefined;
|
|
@@ -713,8 +709,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
713
709
|
show?: {
|
|
714
710
|
table?: boolean | undefined;
|
|
715
711
|
search?: boolean | ((data: any) => boolean) | undefined;
|
|
716
|
-
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof
|
|
717
|
-
/** @type {typeof __VLS_ctx.ruleFormRef} */ TSys.EDialog.View) => boolean) | undefined;
|
|
712
|
+
form?: boolean | ((data: any, type: typeof TSys.EDialog.Insert | typeof TSys.EDialog.Update | typeof TSys.EDialog.View) => boolean) | undefined;
|
|
718
713
|
} | undefined;
|
|
719
714
|
sort?: {
|
|
720
715
|
search?: number | undefined;
|
|
@@ -283,6 +283,15 @@ export declare const curdConf: (props: {
|
|
|
283
283
|
list: any[];
|
|
284
284
|
change: (selection: any[]) => void;
|
|
285
285
|
};
|
|
286
|
+
sort: {
|
|
287
|
+
prop: string;
|
|
288
|
+
order: string;
|
|
289
|
+
change: (row: {
|
|
290
|
+
column: any;
|
|
291
|
+
prop: string;
|
|
292
|
+
order: "ascending" | "descending" | null;
|
|
293
|
+
}) => void;
|
|
294
|
+
};
|
|
286
295
|
};
|
|
287
296
|
export: {
|
|
288
297
|
run: {
|
|
@@ -287,6 +287,15 @@ declare const conf: {
|
|
|
287
287
|
list: any[];
|
|
288
288
|
change: (selection: any[]) => void;
|
|
289
289
|
};
|
|
290
|
+
sort: {
|
|
291
|
+
prop: string;
|
|
292
|
+
order: string;
|
|
293
|
+
change: (row: {
|
|
294
|
+
column: any;
|
|
295
|
+
prop: string;
|
|
296
|
+
order: "ascending" | "descending" | null;
|
|
297
|
+
}) => void;
|
|
298
|
+
};
|
|
290
299
|
};
|
|
291
300
|
export: {
|
|
292
301
|
run: {
|
|
@@ -482,15 +491,15 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
482
491
|
row: Record<string, any>;
|
|
483
492
|
}, __VLS_75: {
|
|
484
493
|
row: Record<string, any>;
|
|
485
|
-
}, __VLS_129: {}, __VLS_131: {},
|
|
494
|
+
}, __VLS_129: {}, __VLS_131: {}, __VLS_154: string | number, __VLS_155: any, __VLS_161: {}, __VLS_163: {
|
|
486
495
|
row: any;
|
|
487
|
-
},
|
|
496
|
+
}, __VLS_181: {
|
|
488
497
|
row: any;
|
|
489
|
-
},
|
|
498
|
+
}, __VLS_215: {
|
|
490
499
|
row: any;
|
|
491
|
-
},
|
|
500
|
+
}, __VLS_226: {}, __VLS_238: {
|
|
492
501
|
row: any;
|
|
493
|
-
},
|
|
502
|
+
}, __VLS_245: string, __VLS_246: {
|
|
494
503
|
row: any;
|
|
495
504
|
item: {
|
|
496
505
|
key: string;
|
|
@@ -608,7 +617,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
608
617
|
form?: number | undefined;
|
|
609
618
|
} | undefined;
|
|
610
619
|
};
|
|
611
|
-
},
|
|
620
|
+
}, __VLS_249: string, __VLS_250: {
|
|
612
621
|
row: any;
|
|
613
622
|
item: {
|
|
614
623
|
key: string;
|
|
@@ -726,7 +735,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
726
735
|
form?: number | undefined;
|
|
727
736
|
} | undefined;
|
|
728
737
|
};
|
|
729
|
-
},
|
|
738
|
+
}, __VLS_256: string, __VLS_257: {
|
|
730
739
|
row: any;
|
|
731
740
|
item: {
|
|
732
741
|
key: string;
|
|
@@ -844,7 +853,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
844
853
|
form?: number | undefined;
|
|
845
854
|
} | undefined;
|
|
846
855
|
};
|
|
847
|
-
},
|
|
856
|
+
}, __VLS_260: string, __VLS_261: {
|
|
848
857
|
row: any;
|
|
849
858
|
item: {
|
|
850
859
|
key: string;
|
|
@@ -962,7 +971,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
962
971
|
form?: number | undefined;
|
|
963
972
|
} | undefined;
|
|
964
973
|
};
|
|
965
|
-
},
|
|
974
|
+
}, __VLS_268: string, __VLS_269: {
|
|
966
975
|
row: any;
|
|
967
976
|
item: {
|
|
968
977
|
key: string;
|
|
@@ -1080,7 +1089,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1080
1089
|
form?: number | undefined;
|
|
1081
1090
|
} | undefined;
|
|
1082
1091
|
};
|
|
1083
|
-
},
|
|
1092
|
+
}, __VLS_272: string, __VLS_273: {
|
|
1084
1093
|
row: any;
|
|
1085
1094
|
item: {
|
|
1086
1095
|
key: string;
|
|
@@ -1198,7 +1207,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1198
1207
|
form?: number | undefined;
|
|
1199
1208
|
} | undefined;
|
|
1200
1209
|
};
|
|
1201
|
-
},
|
|
1210
|
+
}, __VLS_279: string, __VLS_280: {
|
|
1202
1211
|
row: any;
|
|
1203
1212
|
item: {
|
|
1204
1213
|
key: string;
|
|
@@ -1316,7 +1325,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1316
1325
|
form?: number | undefined;
|
|
1317
1326
|
} | undefined;
|
|
1318
1327
|
};
|
|
1319
|
-
},
|
|
1328
|
+
}, __VLS_283: string, __VLS_284: {
|
|
1320
1329
|
row: any;
|
|
1321
1330
|
item: {
|
|
1322
1331
|
key: string;
|
|
@@ -1434,7 +1443,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
1434
1443
|
form?: number | undefined;
|
|
1435
1444
|
} | undefined;
|
|
1436
1445
|
};
|
|
1437
|
-
},
|
|
1446
|
+
}, __VLS_286: {
|
|
1438
1447
|
row: any;
|
|
1439
1448
|
};
|
|
1440
1449
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -1442,23 +1451,23 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
1442
1451
|
} & {
|
|
1443
1452
|
[K in NonNullable<typeof __VLS_50>]?: (props: typeof __VLS_51) => any;
|
|
1444
1453
|
} & {
|
|
1445
|
-
[K in NonNullable<typeof
|
|
1454
|
+
[K in NonNullable<typeof __VLS_154>]?: (props: typeof __VLS_155) => any;
|
|
1446
1455
|
} & {
|
|
1447
|
-
[K in NonNullable<typeof
|
|
1456
|
+
[K in NonNullable<typeof __VLS_245>]?: (props: typeof __VLS_246) => any;
|
|
1448
1457
|
} & {
|
|
1449
|
-
[K in NonNullable<typeof
|
|
1458
|
+
[K in NonNullable<typeof __VLS_249>]?: (props: typeof __VLS_250) => any;
|
|
1450
1459
|
} & {
|
|
1451
|
-
[K in NonNullable<typeof
|
|
1460
|
+
[K in NonNullable<typeof __VLS_256>]?: (props: typeof __VLS_257) => any;
|
|
1452
1461
|
} & {
|
|
1453
|
-
[K in NonNullable<typeof
|
|
1462
|
+
[K in NonNullable<typeof __VLS_260>]?: (props: typeof __VLS_261) => any;
|
|
1454
1463
|
} & {
|
|
1455
|
-
[K in NonNullable<typeof
|
|
1464
|
+
[K in NonNullable<typeof __VLS_268>]?: (props: typeof __VLS_269) => any;
|
|
1456
1465
|
} & {
|
|
1457
|
-
[K in NonNullable<typeof
|
|
1466
|
+
[K in NonNullable<typeof __VLS_272>]?: (props: typeof __VLS_273) => any;
|
|
1458
1467
|
} & {
|
|
1459
|
-
[K in NonNullable<typeof
|
|
1468
|
+
[K in NonNullable<typeof __VLS_279>]?: (props: typeof __VLS_280) => any;
|
|
1460
1469
|
} & {
|
|
1461
|
-
[K in NonNullable<typeof
|
|
1470
|
+
[K in NonNullable<typeof __VLS_283>]?: (props: typeof __VLS_284) => any;
|
|
1462
1471
|
} & {
|
|
1463
1472
|
'box-left'?: (props: typeof __VLS_1) => any;
|
|
1464
1473
|
} & {
|
|
@@ -1472,19 +1481,19 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
1472
1481
|
} & {
|
|
1473
1482
|
'tools-right'?: (props: typeof __VLS_131) => any;
|
|
1474
1483
|
} & {
|
|
1475
|
-
'table-header-op'?: (props: typeof
|
|
1484
|
+
'table-header-op'?: (props: typeof __VLS_161) => any;
|
|
1476
1485
|
} & {
|
|
1477
|
-
'table-op-left'?: (props: typeof
|
|
1486
|
+
'table-op-left'?: (props: typeof __VLS_163) => any;
|
|
1478
1487
|
} & {
|
|
1479
|
-
'table-op-edit-right'?: (props: typeof
|
|
1488
|
+
'table-op-edit-right'?: (props: typeof __VLS_181) => any;
|
|
1480
1489
|
} & {
|
|
1481
|
-
'table-op-right'?: (props: typeof
|
|
1490
|
+
'table-op-right'?: (props: typeof __VLS_215) => any;
|
|
1482
1491
|
} & {
|
|
1483
|
-
'box-right'?: (props: typeof
|
|
1492
|
+
'box-right'?: (props: typeof __VLS_226) => any;
|
|
1484
1493
|
} & {
|
|
1485
|
-
'form-start'?: (props: typeof
|
|
1494
|
+
'form-start'?: (props: typeof __VLS_238) => any;
|
|
1486
1495
|
} & {
|
|
1487
|
-
'form-end'?: (props: typeof
|
|
1496
|
+
'form-end'?: (props: typeof __VLS_286) => any;
|
|
1488
1497
|
}>;
|
|
1489
1498
|
declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
1490
1499
|
/**
|
|
@@ -1810,6 +1819,15 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
1810
1819
|
list: any[];
|
|
1811
1820
|
change: (selection: any[]) => void;
|
|
1812
1821
|
};
|
|
1822
|
+
sort: {
|
|
1823
|
+
prop: string;
|
|
1824
|
+
order: string;
|
|
1825
|
+
change: (row: {
|
|
1826
|
+
column: any;
|
|
1827
|
+
prop: string;
|
|
1828
|
+
order: "ascending" | "descending" | null;
|
|
1829
|
+
}) => void;
|
|
1830
|
+
};
|
|
1813
1831
|
};
|
|
1814
1832
|
export: {
|
|
1815
1833
|
run: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { curdConfType } from '../components/TCurd';
|
|
1
2
|
/** 递归将对象每一层属性都变为可选 */
|
|
2
3
|
type DeepPartial<T> = {
|
|
3
4
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
@@ -182,6 +183,31 @@ export default class TFormConfig {
|
|
|
182
183
|
* 行内操作是否显示删除 - 默认显示
|
|
183
184
|
*/
|
|
184
185
|
delete: boolean;
|
|
186
|
+
/** 表格排序配置 */
|
|
187
|
+
sort: {
|
|
188
|
+
/** 排序属性字段配置 */
|
|
189
|
+
props: {
|
|
190
|
+
/** 排序字段名 - 默认sortField */
|
|
191
|
+
field: string;
|
|
192
|
+
};
|
|
193
|
+
/** 排序 */
|
|
194
|
+
order: {
|
|
195
|
+
/** 排序字段名 - 默认sortOrder */
|
|
196
|
+
field: string;
|
|
197
|
+
/** 升序字段值 - 默认asc */
|
|
198
|
+
asc: string;
|
|
199
|
+
/** 降序字段值 - 默认desc */
|
|
200
|
+
desc: string;
|
|
201
|
+
};
|
|
202
|
+
/** 排序触发时是否重置分页,默认不重置 */
|
|
203
|
+
resetPage: boolean;
|
|
204
|
+
/** 排序变更回调 传入(row: { column: any; prop: string; order: 'ascending' | 'descending' | null },conf: curdConfType) => void */
|
|
205
|
+
change: ((row: {
|
|
206
|
+
column: any;
|
|
207
|
+
prop: string;
|
|
208
|
+
order: "ascending" | "descending" | null;
|
|
209
|
+
}, conf: curdConfType["conf"]) => void) | undefined;
|
|
210
|
+
};
|
|
185
211
|
};
|
|
186
212
|
columnConfig: {
|
|
187
213
|
type: any;
|