cc1-form 1.1.2 → 1.1.3
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 +432 -411
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/icon/edit.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/export.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/plus.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/refresh.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/remove.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/search.vue.d.ts +2 -0
- package/dist/components/TCurd/icon/view.vue.d.ts +2 -0
- package/dist/components/TCurd/index.d.ts +7 -0
- package/dist/components/TCurd/index.vue.d.ts +39 -21
- package/package.json +1 -1
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g.cc1Form={},g.Vue,g.ElementPlus))})(this,(function(g,e,p){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(d,c)=>Array.isArray(d)?d.some(s=>typeof s=="function"?s(c):s):typeof d=="function"?d(c):d;static getRouterParams=()=>{const d=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(d).length?d:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async d=>{if(!b.moduleObj[d])throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);const c=await b.moduleObj[d]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(d,c,s={}){const f=Date.now();if(!this.tipMessages[d]||f-this.tipMessages[d]>this.tipMessagesGap){this.tipMessages[d]=f;const h=Object.assign({message:d,type:c},s);p.ElMessage(h),setTimeout(()=>{delete this.tipMessages[d]},this.tipMessagesGap)}}static fail=(d,c={})=>{this.showMessage(d,"error",c)};static success=(d,c={})=>{this.showMessage(d,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(d=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{d?this.loadingObj=p.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(d,c=!0)=>{if(c){let s=screen.width/2-500,f=screen.height/2-800/2-30;window.open(d,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+s)}else window.open(d,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=d=>new Promise(async(c,s)=>{let f=document.getElementById(d.id);const h=await b.loadModule("html2canvas");try{h(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:d.windowWidth,height:d.windowHeight,windowWidth:d.windowWidth,windowHeight:d.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(i){let t=i.toDataURL("image/png");c(t)})}catch(i){s(i)}})}class w{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static customComponent={};static findOptions=(d,c)=>{const s=d.column.find(h=>h.key===c),f=h=>h.replace(/-([a-z])/g,(i,t)=>t.toUpperCase());if(s)return s.options[f(s.type)]};static setOptionsData=(d,c,s)=>{const f=w.findOptions(d,c);f&&(f.data=s)};static form={openBefore:{parentId:(d,c,s,f)=>{d?c.type===b.EDialog.Insert?(c.form.parentId=d._id,c.form.sort=d.children.length+1):c.form.parentId=d.parentId.substring(d.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=s.length+1),w.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:s}])}}}}class V{static getIdFun=()=>StrUtil.uuid();static setId=(d,c,s)=>{c[d]||(c[d]=[]),c[d].forEach(f=>{s.forEach(h=>{let i=h.default??"";h.type==="number"&&(i=h.default??0),h.type==="boolean"&&(i=h.default??!1),h.type==="time"&&(i=h.default??new Date),f[h.value]===void 0&&(f[h.value]=i)}),f._id||(f._id=V.getIdFun())})};static add=(d,c,s,f)=>{const h=JSONUtil.cp(s);V.setId(d,c,s),c[d].push(h.reduce((i,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),i[t.value]=n,i},{_id:V.getIdFun()})),f?.(c)};static remove=(d,c,s,f)=>{c[d]=c[d].filter(h=>h._id!==s._id),f?.(c)};static getNoIdData=(d,c)=>{const s=JSONUtil.cp(d);return s.forEach(f=>{f._id&&delete f._id,c&&f[c]&&V.getNoIdData(f[c],c)}),s}}const T={key:0,class:"column",style:{width:"100%",gap:"10px"}},$={class:"row items-center",style:{gap:"10px",width:"100%"}},x=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(m,{emit:d}){const c=m,s=e.reactive({show:!1,add:(h,i,t)=>{V.add(h,i,t,()=>{f("change")})},remove:(h,i,t)=>{V.remove(h,i,t,()=>{f("change")})}});e.onMounted(()=>{V.setId(c.field,c.row,c.itemFields),s.show=!0});const f=d;return(h,i)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return s.show?(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(h.$slots,"list-start",{row:m.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:i[0]||(i[0]=l=>s.add(m.field,m.row,m.itemFields))},{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.row[m.field],l=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"item-start",{item:l,row:m.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.itemFields,a=>(e.openBlock(),e.createBlock(n,{modelValue:l[a.value],"onUpdate:modelValue":o=>l[a.value]=o,style:e.normalizeStyle({width:m.inputWidth}),class:e.normalizeClass(m.inputClass),placeholder:a[m.label]||a[m.value],onChange:i[1]||(i[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:l,row:m.row}),e.createVNode(t,{link:"",type:"danger",onClick:a=>s.remove(m.field,m.row,l)},{default:e.withCtx(()=>[...i[3]||(i[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:m.row})])):e.createCommentVNode("",!0)}}}),O={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(m,{expose:d}){const c=b.isFun,s=b.EDialog,f=e.ref(),h=m,i=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||s.Insert)===s.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;i.formColumn=[];const n=[],l=h.option.form?.maxSpan||12,a=h.option.form?.defaultSpan||l;let o=[];const r=u=>{if(i.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:a},u.form.span=u.form.span??a;let C=u.form.span,k=o.reduce((B,E)=>B+E.span,C);const y=o.length;o.push({item:u,span:C}),(y===1&&o[0].span===0||k>=l||C===0&&y>1)&&(n.push(o),o=[]),u.rules&&(i.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,r(u)}),o.length>0&&n.push(o),i.formColumn=n,i.form=JSONUtil.cp(i.formDefault)},init:async()=>{i.show=!1,await e.nextTick(),i.initColumnForm()}});return i.initColumnForm(),d({ref:f,conf:i}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:f,model:i.form,rules:i.rules},{default:e.withCtx(()=>[i.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(i.formColumn,l=>(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(t.$slots,"form-start",{row:i.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(a.item.show?.form,i.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+a.item.key+"-start",{row:i.form,item:a.item}),e.renderSlot(t.$slots,"form-"+a.item.key,{row:i.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.switch,e.toHandlers(a.item.options?.switch?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:i.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:i.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:i.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:i.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:i.form[a.item.key],"onUpdate:modelValue":o=>i.form[a.item.key]=o},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:i.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+a.item.key+"-end",{row:i.form,item:a.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:i.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(d,c,s)=>{const f=await b.loadModule("xlsx"),h=d.map(n=>{const l={};return c.forEach(a=>{l[a.label]=n[a.key]}),l}),i=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,i,"Sheet1"),s?typeof s=="function"&&(s=s()):s=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${s}.xlsx`)}}const L={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(m,{expose:d}){const c=e.ref(!1),s=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,i=null;const t=a=>(a?.title&&(s.value=a.title),a?.content&&(f.value=a.content),c.value=!0,new Promise((o,r)=>{h=o,i=r})),n=()=>{c.value=!1,h?.(!0),h=null,i=null},l=()=>{c.value=!1,i?.(new Error("用户取消操作")),h=null,i=null};return d({open:t}),(a,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=r=>c.value=r),title:s.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",L,[e.createVNode(e.unref(p.ElButton),{onClick:l},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),z={class:"col relative cc1-form-box"},j={class:"absolute row fit",style:{overflow:"hidden"}},M={class:"col column"},R={key:0,class:"relative curd-search"},H={class:"mb-10 flex justify-between items-center"},A={class:"flex items-center",style:{gap:"10px"}},J={key:0},_={key:1},W={key:2},K={class:"export-btn"},q={class:"flex items-center",style:{gap:"10px"}},G={class:"col fit-width relative"},X={class:"absolute column fit"},Q={class:"row justify-end mt-10 mb-10"},Y={class:"row form-item-content",style:{width:"100%"}},Z={class:"col"},P={class:"dialog-footer"},v={class:"dialog-footer"},F=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(m,{expose:d}){const c=b.EDialog,s=m,f=e.ref(),h=e.ref(),i=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,l="请输入")=>n.text?.search?.placeholder===void 0?`${l}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};s.option.column.forEach(a=>{(typeof a.show?.search=="function"?a.show?.search(t.search.form):a.show?.search)&&(n[a.key]=t.search.form[a.key])});const l=s.option.search?.before?.(n);return l&&(n=l),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(l=>{s.option.search?.resetMode==="default"?n[l]=t.search.formDefault[l]:n[l]=void 0}),t.search.form=JSONUtil.cp(n),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:s.option.page?.size||10,sizeList:s.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:s.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,l)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=l=>{let a=[];return l.forEach(o=>{a.push(o._id),o.children&&o.children.length>0&&(a=a.concat(n(o.children)))}),a};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=s.option.api.list;try{const l=await n({[w.pageField.size]:t.page.size,[w.pageField.num]:t.page.num,...t.search.getFormData()}),a=w.resultField,o=l.data||{[a.list]:l};let r=(Array.isArray(o[a.list]),o[a.list]);t.table.data=s.option.data?await s.option.data(r):r,t.page.total=o[a.total]||0}catch(l){console.error(l)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}},exportFun:{start:async n=>{let l=await t.table.exportFun[n](),a=s.option.column;const o=JSONUtil.cp({data:l,columns:a}),r=s.option.tools?.export||{};r.before&&r.before(o),S.exportToExcel(o.data,o.columns,r.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail("请选择要导出的数据"),new Error("请选择要导出的数据");return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail("暂无数据"),new Error("暂无数据");return t.table.data},all:async()=>{t.table.loading=!0;const n=s.option.api.list;try{const{data:l}=await n({[w.pageField.size]:999999,[w.pageField.num]:1});return l[w.resultField.list]}catch(l){console.error(l)}finally{t.table.loading=!1}}},export:n=>{t.table.exportFun.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(s.option.form?.editAll)return n;let l={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(a=>{n[a]!==t.update.edit.data[a]&&(l[a]=n[a])}),l}},open:(n,l)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=n;const a=n===c.Insert;t.update.edit.data=l,t.update.title=a?"新增":"编辑",t.update.form=JSONUtil.cp(a?t.update.formDefault:l),await s.option.form?.openBefore?.(l,t.update),t.update.show=!0,t.update.showContent=!0,s.option.form?.openAfter?.(l,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(a,o)=>new Promise((r,u)=>{a||(b.fail("请检查表单数据"),u(!1)),r()})),t.update.loading=!0;const n=t.update.type===c.Insert?s.option.api.create:s.option.api.update;let l=JSONUtil.cp(t.update.form);delete l.children,await s.option.form?.submitBefore?.(l,t.update),Object.keys(l).forEach(a=>{if(typeof l[a]=="string"&&l[a].indexOf("T")>-1){const o=new Date(l[a]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(l[a]=o)}});try{await n({...l}),t.update.close(),await t.table.getList(),s.option.form?.submitAfter?.(l,t.update)}catch(a){console.error(a)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail("请选择要删除的数据");return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=s.option.api.delete;try{await n({_id:t.remove.items.map(l=>l._id),items:t.remove.items}),b.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(l){console.error(l)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const l={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:"暂无数据",highlightCurrentRow:!0}},a=s.option;Object.keys(l).forEach(o=>{a[o]=ObjectUtil.deepMerge(l[o],a[o]||{})})},initColumnOptions:()=>{const n=s.option,l=a=>{const r={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(C,k)=>{const y=a.options?.switch;try{await f.value?.open({title:"确认修改",content:`确认要${k[C]===y.activeValue?y.inactiveLabel:y.activeLabel}吗?`}),t.table.loading=!0;try{return await s.option.api.update({_id:k._id,[C]:k[C]===y.activeValue?y.inactiveValue:y.activeValue,final(B,E,U){t.table.loading=!1}}),t.table.loading=!1,b.success("操作成功"),t.table.getList(),!0}catch(B){return console.error(B),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=a;Object.keys(r).forEach(C=>{u[C]=ObjectUtil.deepMerge(r[C],u[C]||{})})};n.column.forEach(l),n.table?.column?.forEach(l)},initColumnForm:()=>{const n=s.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const l=[],a=s.option.form?.maxSpan||12,o=s.option.form?.defaultSpan||a/2;let r=[];const u=k=>{if(t.update.formDefault[k.key]=k.value,k.table.table&&(k.show.table&&t.table.column.show.list.push(k.key),k.table.table&&t.table.column.show.listSource.push(k.key)),k.isForm){k.form=k.form||{span:o},k.form.span=k.form.span??o;let y=k.form.span,B=r.reduce((U,oe)=>U+oe.span,y);const E=r.length;r.push({item:k,span:y}),(E===1&&r[0].span===0||B>=a||y===0&&E>1)&&(l.push(r),r=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};n.column.forEach(k=>{k.isForm=!0,u(k)}),s.option.table?.column?.forEach(k=>{k.isForm=!1,u(k)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(k=>k.table?.table),t.search.column.list.sort((k,y)=>k.sort?.search-y.sort?.search),t.table.column.list.sort((k,y)=>k.sort?.table-y.sort?.table),r.length>0&&l.push(r),t.update.formColumn=l;const C=s.option.search?.formDefault;C&&Object.keys(C).forEach(k=>{t.search.formDefault[k]=C[k]}),n.column.forEach(k=>{k.show?.search||(t.search.formDefault[k.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),d({conf:t}),(n,l)=>{const a=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",j,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",M,[m.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(e.unref(p.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(p.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o,"请选择"),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o,"请选择"),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.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},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(p.ElFormItem),null,{default:e.withCtx(()=>[m.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...l[8]||(l[8]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),m.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",H,[e.createElementVNode("div",A,[e.unref(i)(m.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:l[0]||(l[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),m.option.table?.selectable&&e.unref(i)(m.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",_,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:l[1]||(l[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),m.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:l[2]||(l[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...l[12]||(l[12]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),m.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(p.ElDropdown),{key:3,onCommand:t.table.export},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownMenu),null,{default:e.withCtx(()=>[e.createVNode(e.unref(p.ElDropdownItem),{command:"select"},{default:e.withCtx(()=>[...l[14]||(l[14]=[e.createTextVNode("导出选中",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...l[15]||(l[15]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...l[16]||(l[16]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createVNode(e.unref(p.ElButton),{type:"warning"},{default:e.withCtx(()=>[...l[13]||(l[13]=[e.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",q,[e.renderSlot(n.$slots,"tools-right"),m.option.tools?.refresh===void 0||m.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:l[3]||(l[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[...l[17]||(l[17]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[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"})],-1)])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",G,[e.createElementVNode("div",X,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:t.table.data},m.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[m.option.table?.selectable&&e.unref(i)(m.option.tools?.delete)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof m.option.table?.selectable=="function"?m.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:r})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:r,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:r[o.key],"onUpdate:modelValue":u=>r[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,r)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(r[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(i)(m.option.tools?.add)||e.unref(i)(m.option.tools?.update)||e.unref(i)(m.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:1,label:"操作",width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(i)(m.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:r=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[...l[18]||(l[18]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(m.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:r=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[...l[19]||(l[19]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(m.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:r=>t.remove.open([o])},{default:e.withCtx(()=>[...l[20]||(l[20]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})]),_:3})):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[a,t.table.loading]])])]),e.createElementVNode("div",Q,[t.page.total>t.page.size?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":t.page.num,"onUpdate:currentPage":l[4]||(l[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":l[5]||(l[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":l[6]||(l[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},m.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",P,[e.createVNode(e.unref(p.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...l[21]||(l[21]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[...l[22]||(l[22]=[e.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(o.map(r=>r.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:m.option.form?.stripe===void 0?!0:m.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(r.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(r.item.form.span>0?`col-${r.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{class:e.normalizeClass({"hide-label":typeof r.item.text?.form?.label=="boolean"?!r.item.text?.form?.label:!1}),label:typeof r.item.text?.form?.label=="string"?r.item.text?.form?.label:r.item.label,prop:r.item.key,"label-width":r.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.renderSlot(n.$slots,"form-"+r.item.key+"-start",{row:t.update.form,item:r.item}),e.createElementVNode("div",Z,[e.renderSlot(n.$slots,"form-"+r.item.key,{row:t.update.form,item:r.item},()=>[r.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.input,e.toHandlers(r.item.options?.input?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.switch,{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.select,e.toHandlers(r.item.options?.select?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:r.item.key},{ref_for:!0},r.item.options?.list,e.toHandlers(r.item.options?.list?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):r.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.treeSelect,e.toHandlers(r.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.datetime,e.toHandlers(r.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[r.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[r.item.type]),e.mergeProps({key:6,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.[r.item.type],e.toHandlers(r.item.options?.[r.item.type]?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+r.item.key+"-end",{row:t.update.form,item:r.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row: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:t.remove.show,"onUpdate:modelValue":l[7]||(l[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",v,[e.createVNode(e.unref(p.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[...l[23]||(l[23]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[...l[24]||(l[24]=[e.createTextVNode(" 确认删除 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,"确认要删除【"+e.toDisplayString(t.remove.items.length)+"】条数据吗?",1)]),_:1},8,["modelValue","title"]),e.createVNode(I,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class ee{static async download(d,c="download.png"){const s=document.createElement("a");s.style.display="none",s.href=d,s.setAttribute("download",c),typeof s.download>"u"&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(d)}static exportJSONFile=(d,c)=>{const s=new Blob([JSON.stringify(d)],{type:"application/json"}),f=URL.createObjectURL(s),h=document.createElement("a");h.href=f,h.download=`${c||"config"}.json`,h.click()};static importFile=async d=>new Promise((c,s)=>{const f=document.createElement("input");f.type="file";const h=d?.accept||".json";f.accept=h,f.style.display="none",f.onchange=i=>{const t=i.target.files[0];if(!t){b.fail("未选择文件"),s("未选择文件");return}const n=new FileReader;n.onload=async l=>{const a=h==".json"?JSON.parse(l.target.result):l.target.result;c(a)},n.onerror=()=>{b.fail("文件读取失败"),s("文件读取失败")},n.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const D=(m,d)=>{if(m.component("TCurd",F),m.component("TFormList",x),m.component("TColumn",N),d?.customComponent){w.customComponent=d.customComponent;for(const c in d.customComponent)m.component(c,d.customComponent[c])}},te={install:D};g.ArrUtil=V,g.ExcelUtil=S,g.TColumn=N,g.TCurd=F,g.TFile=ee,g.TForm=w,g.TFormList=x,g.TSys=b,g.default=te,g.install=D,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.cc1Form={},b.Vue,b.ElementPlus))})(this,(function(b,e,m){"use strict";class g{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(d,c)=>Array.isArray(d)?d.some(n=>typeof n=="function"?n(c):n):typeof d=="function"?d(c):d;static getRouterParams=()=>{const d=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(d).length?d:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async d=>{if(!g.moduleObj[d])throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);const c=await g.moduleObj[d]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(d,c,n={}){const f=Date.now();if(!this.tipMessages[d]||f-this.tipMessages[d]>this.tipMessagesGap){this.tipMessages[d]=f;const h=Object.assign({message:d,type:c},n);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[d]},this.tipMessagesGap)}}static fail=(d,c={})=>{this.showMessage(d,"error",c)};static success=(d,c={})=>{this.showMessage(d,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(d=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{d?this.loadingObj=m.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(d,c=!0)=>{if(c){let n=screen.width/2-500,f=screen.height/2-800/2-30;window.open(d,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+n)}else window.open(d,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=d=>new Promise(async(c,n)=>{let f=document.getElementById(d.id);const h=await g.loadModule("html2canvas");try{h(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:d.windowWidth,height:d.windowHeight,windowWidth:d.windowWidth,windowHeight:d.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(i){let t=i.toDataURL("image/png");c(t)})}catch(i){n(i)}})}class w{static pageField={num:"num",size:"size"};static resultField={list:"list",pages:"pages",num:"num",size:"size",total:"total"};static customComponent={};static findOptions=(d,c)=>{const n=d.column.find(h=>h.key===c),f=h=>h.replace(/-([a-z])/g,(i,t)=>t.toUpperCase());if(n)return n.options[f(n.type)]};static setOptionsData=(d,c,n)=>{const f=w.findOptions(d,c);f&&(f.data=n)};static form={openBefore:{parentId:(d,c,n,f)=>{d?c.type===g.EDialog.Insert?(c.form.parentId=d._id,c.form.sort=d.children.length+1):c.form.parentId=d.parentId.substring(d.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=n.length+1),w.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:n}])}}}}class V{static getIdFun=()=>StrUtil.uuid();static setId=(d,c,n)=>{c[d]||(c[d]=[]),c[d].forEach(f=>{n.forEach(h=>{let i=h.default??"";h.type==="number"&&(i=h.default??0),h.type==="boolean"&&(i=h.default??!1),h.type==="time"&&(i=h.default??new Date),f[h.value]===void 0&&(f[h.value]=i)}),f._id||(f._id=V.getIdFun())})};static add=(d,c,n,f)=>{const h=JSONUtil.cp(n);V.setId(d,c,n),c[d].push(h.reduce((i,t)=>{let s=t.default??"";return t.type==="number"&&(s=t.default??0),t.type==="boolean"&&(s=t.default??!1),t.type==="time"&&(s=t.default??new Date),i[t.value]=s,i},{_id:V.getIdFun()})),f?.(c)};static remove=(d,c,n,f)=>{c[d]=c[d].filter(h=>h._id!==n._id),f?.(c)};static getNoIdData=(d,c)=>{const n=JSONUtil.cp(d);return n.forEach(f=>{f._id&&delete f._id,c&&f[c]&&V.getNoIdData(f[c],c)}),n}}const $={key:0,class:"column",style:{width:"100%",gap:"10px"}},T={class:"row items-center",style:{gap:"10px",width:"100%"}},x=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(p,{emit:d}){const c=p,n=e.reactive({show:!1,add:(h,i,t)=>{V.add(h,i,t,()=>{f("change")})},remove:(h,i,t)=>{V.remove(h,i,t,()=>{f("change")})}});e.onMounted(()=>{V.setId(c.field,c.row,c.itemFields),n.show=!0});const f=d;return(h,i)=>{const t=e.resolveComponent("el-button"),s=e.resolveComponent("el-input");return n.show?(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:i[0]||(i[0]=a=>n.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...i[2]||(i[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],a=>(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(h.$slots,"item-start",{item:a,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(s,{modelValue:a[l.value],"onUpdate:modelValue":o=>a[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:i[1]||(i[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:a,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>n.remove(p.field,p.row,a)},{default:e.withCtx(()=>[...i[3]||(i[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),O={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:d}){const c=g.isFun,n=g.EDialog,f=e.ref(),h=p,i=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||n.Insert)===n.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;i.formColumn=[];const s=[],a=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||a;let o=[];const r=u=>{if(i.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,k=o.reduce((B,E)=>B+E.span,C);const y=o.length;o.push({item:u,span:C}),(y===1&&o[0].span===0||k>=a||C===0&&y>1)&&(s.push(o),o=[]),u.rules&&(i.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,r(u)}),o.length>0&&s.push(o),i.formColumn=s,i.form=JSONUtil.cp(i.formDefault)},init:async()=>{i.show=!1,await e.nextTick(),i.initColumnForm()}});return i.initColumnForm(),d({ref:f,conf:i}),(t,s)=>(e.openBlock(),e.createBlock(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:f,model:i.form,rules:i.rules},{default:e.withCtx(()=>[i.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(i.formColumn,a=>(e.openBlock(),e.createElementBlock("div",O,[e.renderSlot(t.$slots,"form-start",{row:i.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(l.item.show?.form,i.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:i.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:i.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:i.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:i.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:i.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:i.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:i.form[l.item.key],"onUpdate:modelValue":o=>i.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:i.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:i.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:i.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(d,c,n)=>{if(!d||d.length===0)return;const f=await g.loadModule("xlsx"),h=d.map(s=>{const a={};return c.forEach(l=>{a[l.label]=s[l.key]}),a}),i=f.utils.json_to_sheet(h),t=f.utils.book_new();f.utils.book_append_sheet(t,i,"Sheet1"),n?typeof n=="function"&&(n=n()):n=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${n}.xlsx`)}}const I={class:"dialog-footer"},L=e.defineComponent({__name:"switchConfirm",setup(p,{expose:d}){const c=e.ref(!1),n=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let h=null,i=null;const t=l=>(l?.title&&(n.value=l.title),l?.content&&(f.value=l.content),c.value=!0,new Promise((o,r)=>{h=o,i=r})),s=()=>{c.value=!1,h?.(!0),h=null,i=null},a=()=>{c.value=!1,i?.(new Error("用户取消操作")),h=null,i=null};return d({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(m.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=r=>c.value=r),title:n.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",I,[e.createVNode(e.unref(m.ElButton),{onClick:a},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:s},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(f.value),1)]),_:1},8,["modelValue","title"]))}}),z=(p,d)=>{const c=p.__vccOpts||p;for(const[n,f]of d)c[n]=f;return c},j={},M={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function R(p,d){return e.openBlock(),e.createElementBlock("svg",M,[...d[0]||(d[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 H=z(j,[["render",R]]),_={class:"col relative cc1-form-box"},A={class:"absolute row fit",style:{overflow:"hidden"}},J={class:"col column"},W={key:0,class:"relative curd-search"},K={class:"mb-10 flex justify-between items-center"},q={class:"flex items-center",style:{gap:"10px"}},G={key:0},X={key:1},Q={key:2},Y={class:"export-btn"},Z={class:"flex items-center",style:{gap:"10px"}},P={class:"col fit-width relative"},v={class:"absolute column fit"},ee={class:"row justify-end mt-10 mb-10"},te={class:"row form-item-content",style:{width:"100%"}},oe={class:"col"},le={class:"dialog-footer"},ae={class:"dialog-footer"},D=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:d}){const c=g.EDialog,n=p,f=e.ref(),h=e.ref(),i=g.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(s,a="请输入")=>s.text?.search?.placeholder===void 0?`${a}${s.label}`:s.text?.search?.placeholder,getFormData:()=>{let s={};n.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(s[l.key]=t.search.form[l.key])});const a=n.option.search?.before?.(s);return a&&(s=a),s},reset:()=>{const s=t.search.formDefault;Object.keys(s).forEach(a=>{n.option.search?.resetMode==="default"?s[a]=t.search.formDefault[a]:s[a]=void 0}),t.search.form=JSONUtil.cp(s),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:n.option.page?.size||10,sizeList:n.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:n.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(s,a)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const s=a=>{let l=[];return a.forEach(o=>{l.push(o._id),o.children&&o.children.length>0&&(l=l.concat(s(o.children)))}),l};t.table.expand.rowKeys=s(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const s=n.option.api.list;try{const a=await s({[w.pageField.size]:t.page.size,[w.pageField.num]:t.page.num,...t.search.getFormData()}),l=w.resultField,o=a.data||{[l.list]:a};let r=(Array.isArray(o[l.list]),o[l.list]);t.table.data=n.option.data?await n.option.data(r):r,t.page.total=o[l.total]||0}catch(a){console.error(a)}finally{t.table.loading=!1}},selection:{list:[],change:s=>{t.table.selection.list=s}}},export:{run:{start:async s=>{let a=await t.export.run[s](),l=n.option.column;const o=JSONUtil.cp({data:a,columns:l}),r=n.option.tools?.export||{};r.before&&r.before(o),S.exportToExcel(o.data,o.columns,r.fileName)},select:()=>{if(t.table.selection.list.length===0)throw g.fail("请选择要导出的数据"),new Error("请选择要导出的数据");return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw g.fail("暂无数据"),new Error("暂无数据");return t.table.data},all:async()=>{t.export.loading=!0;try{if(n.option.export?.all){await n.option.export.all();return}const s=n.option.api.list,{data:a}=await s({[w.pageField.size]:999999,[w.pageField.num]:1});return a[w.resultField.list]}catch(s){console.error(s)}finally{t.export.loading=!1}}},loading:!1,click:s=>{t.export.loading||t.export.run.start(s)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:s=>s.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:s=>{if(n.option.form?.editAll)return s;let a={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(l=>{s[l]!==t.update.edit.data[l]&&(a[l]=s[l])}),a}},open:(s,a)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=s;const l=s===c.Insert;t.update.edit.data=a,t.update.title=l?"新增":"编辑",t.update.form=JSONUtil.cp(l?t.update.formDefault:a),await n.option.form?.openBefore?.(a,t.update),t.update.show=!0,t.update.showContent=!0,n.option.form?.openAfter?.(a,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((r,u)=>{l||(g.fail("请检查表单数据"),u(!1)),r()})),t.update.loading=!0;const s=t.update.type===c.Insert?n.option.api.create:n.option.api.update;let a=JSONUtil.cp(t.update.form);delete a.children,await n.option.form?.submitBefore?.(a,t.update),Object.keys(a).forEach(l=>{if(typeof a[l]=="string"&&a[l].indexOf("T")>-1){const o=new Date(a[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(a[l]=o)}});try{await s({...a}),t.update.close(),await t.table.getList(),n.option.form?.submitAfter?.(a,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:s=>{if(s.length===0){g.fail("请选择要删除的数据");return}t.remove.items=s,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const s=n.option.api.delete;try{await s({_id:t.remove.items.map(a=>a._id),items:t.remove.items}),g.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(a){console.error(a)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const a={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:"暂无数据",highlightCurrentRow:!0}},l=n.option;Object.keys(a).forEach(o=>{l[o]=ObjectUtil.deepMerge(a[o],l[o]||{})})},initColumnOptions:()=>{const s=n.option,a=l=>{const r={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(C,k)=>{const y=l.options?.switch;try{await f.value?.open({title:"确认修改",content:`确认要${k[C]===y.activeValue?y.inactiveLabel:y.activeLabel}吗?`}),t.table.loading=!0;try{return await n.option.api.update({_id:k._id,[C]:k[C]===y.activeValue?y.inactiveValue:y.activeValue,final(B,E,U){t.table.loading=!1}}),t.table.loading=!1,g.success("操作成功"),t.table.getList(),!0}catch(B){return console.error(B),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},u=l;Object.keys(r).forEach(C=>{u[C]=ObjectUtil.deepMerge(r[C],u[C]||{})})};s.column.forEach(a),s.table?.column?.forEach(a)},initColumnForm:()=>{const s=n.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const a=[],l=n.option.form?.maxSpan||12,o=n.option.form?.defaultSpan||l/2;let r=[];const u=k=>{if(t.update.formDefault[k.key]=k.value,k.table.table&&(k.show.table&&t.table.column.show.list.push(k.key),k.table.table&&t.table.column.show.listSource.push(k.key)),k.isForm){k.form=k.form||{span:o},k.form.span=k.form.span??o;let y=k.form.span,B=r.reduce((U,se)=>U+se.span,y);const E=r.length;r.push({item:k,span:y}),(E===1&&r[0].span===0||B>=l||y===0&&E>1)&&(a.push(r),r=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};s.column.forEach(k=>{k.isForm=!0,u(k)}),n.option.table?.column?.forEach(k=>{k.isForm=!1,u(k)}),t.search.column.list=s.column.concat(s.table?.column||[]),t.table.column.list=t.search.column.list.filter(k=>k.table?.table),t.search.column.list.sort((k,y)=>k.sort?.search-y.sort?.search),t.table.column.list.sort((k,y)=>k.sort?.table-y.sort?.table),r.length>0&&a.push(r),t.update.formColumn=a;const C=n.option.search?.formDefault;C&&Object.keys(C).forEach(k=>{t.search.formDefault[k]=C[k]}),s.column.forEach(k=>{k.show?.search||(t.search.formDefault[k.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{t.table.getList()}),d({conf:t}),(s,a)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",A,[e.renderSlot(s.$slots,"box-left"),e.createElementVNode("div",J,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(e.unref(m.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(m.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o,"请选择"),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":r=>t.search.form[o.key]=r,placeholder:t.search.getPlaceholder(o,"请选择"),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,r=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(s.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(m.ElFormItem),null,{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(s.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",K,[e.createElementVNode("div",q,[e.unref(i)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",G,[e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:a[0]||(a[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(i)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",X,[e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:a[1]||(a[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Q,[e.createVNode(e.unref(m.ElButton),{type:"warning",onClick:a[2]||(a[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(m.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(m.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(m.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createTextVNode(" 导出选中 ",-1)])]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(m.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(m.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.createVNode(e.unref(m.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[...a[13]||(a[13]=[e.createTextVNode("导出",-1)])]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"tools-left")]),e.createElementVNode("div",Z,[e.renderSlot(s.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:a[3]||(a[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(H)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",P,[e.createElementVNode("div",v,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(m.ElTable),e.mergeProps({data:t.table.data},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(i)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:r})=>[e.renderSlot(s.$slots,"table-"+o.key,{row:r,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:0,modelValue:r[o.key],"onUpdate:modelValue":u=>r[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,r)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(r[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(i)(p.option.tools?.add)||e.unref(i)(p.option.tools?.update)||e.unref(i)(p.option.tools?.delete)||s.$slots["table-op-left"]||s.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(m.ElTableColumn),{key:1,label:"操作",width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(s.$slots,"table-op-left",{row:o}),e.unref(i)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:r=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[...a[17]||(a[17]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:r=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[...a[18]||(a[18]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(m.ElButton),{key:2,link:"",type:"danger",onClick:r=>t.remove.open([o])},{default:e.withCtx(()=>[...a[19]||(a[19]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"table-op-right",{row:o})]),_:3})):e.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",ee,[e.createVNode(e.unref(m.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":a[4]||(a[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":a[5]||(a[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(s.$slots,"box-right")]),e.createVNode(e.unref(m.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":a[6]||(a[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",le,[e.createVNode(e.unref(m.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...a[20]||(a[20]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[...a[21]||(a[21]=[e.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(m.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(o.map(r=>r.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(s.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,r=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(r.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(r.item.form.span>0?`col-${r.item.form.span}`:"col")},[e.createVNode(e.unref(m.ElFormItem),{class:e.normalizeClass({"hide-label":typeof r.item.text?.form?.label=="boolean"?!r.item.text?.form?.label:!1}),label:typeof r.item.text?.form?.label=="string"?r.item.text?.form?.label:r.item.label,prop:r.item.key,"label-width":r.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",te,[e.renderSlot(s.$slots,"form-"+r.item.key+"-start",{row:t.update.form,item:r.item}),e.createElementVNode("div",oe,[e.renderSlot(s.$slots,"form-"+r.item.key,{row:t.update.form,item:r.item},()=>[r.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(m.ElInput),e.mergeProps({key:0,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.input,e.toHandlers(r.item.options?.input?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(m.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.switch,{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(m.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.select,e.toHandlers(r.item.options?.select?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(m.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:r.item.key},{ref_for:!0},r.item.options?.list,e.toHandlers(r.item.options?.list?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):r.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(m.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.treeSelect,e.toHandlers(r.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(r.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):r.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(m.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.datetime,e.toHandlers(r.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(w).customComponent[r.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(w).customComponent[r.item.type]),e.mergeProps({key:6,modelValue:t.update.form[r.item.key],"onUpdate:modelValue":u=>t.update.form[r.item.key]=u},{ref_for:!0},r.item.options?.[r.item.type],e.toHandlers(r.item.options?.[r.item.type]?.on||{}),{disabled:t.update.getDisabled(r.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(s.$slots,"form-"+r.item.key+"-end",{row:t.update.form,item:r.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(s.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(m.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":a[7]||(a[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ae,[e.createVNode(e.unref(m.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[...a[22]||(a[22]=[e.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),e.createVNode(e.unref(m.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[...a[23]||(a[23]=[e.createTextVNode(" 确认删除 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,"确认要删除【"+e.toDisplayString(t.remove.items.length)+"】条数据吗?",1)]),_:1},8,["modelValue","title"]),e.createVNode(L,{ref_key:"switchConfirmRef",ref:f},null,512)])}}});class re{static async download(d,c="download.png"){const n=document.createElement("a");n.style.display="none",n.href=d,n.setAttribute("download",c),typeof n.download>"u"&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(d)}static exportJSONFile=(d,c)=>{const n=new Blob([JSON.stringify(d)],{type:"application/json"}),f=URL.createObjectURL(n),h=document.createElement("a");h.href=f,h.download=`${c||"config"}.json`,h.click()};static importFile=async d=>new Promise((c,n)=>{const f=document.createElement("input");f.type="file";const h=d?.accept||".json";f.accept=h,f.style.display="none",f.onchange=i=>{const t=i.target.files[0];if(!t){g.fail("未选择文件"),n("未选择文件");return}const s=new FileReader;s.onload=async a=>{const l=h==".json"?JSON.parse(a.target.result):a.target.result;c(l)},s.onerror=()=>{g.fail("文件读取失败"),n("文件读取失败")},s.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const F=(p,d)=>{if(p.component("TCurd",D),p.component("TFormList",x),p.component("TColumn",N),d?.customComponent){w.customComponent=d.customComponent;for(const c in d.customComponent)p.component(c,d.customComponent[c])}},ne={install:F};b.ArrUtil=V,b.ExcelUtil=S,b.TColumn=N,b.TCurd=D,b.TFile=re,b.TForm=w,b.TFormList=x,b.TSys=g,b.default=ne,b.install=F,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
export default _default;
|
|
@@ -224,6 +224,13 @@ export interface CurdConfig<T = any> {
|
|
|
224
224
|
* 数据处理
|
|
225
225
|
*/
|
|
226
226
|
data?: (data: T[]) => T[];
|
|
227
|
+
/** 导出处理 */
|
|
228
|
+
export: Partial<{
|
|
229
|
+
/**
|
|
230
|
+
* 导出所有数据钩子
|
|
231
|
+
*/
|
|
232
|
+
all: () => any;
|
|
233
|
+
}>;
|
|
227
234
|
}
|
|
228
235
|
export interface CurdConfigColumn<T = any> {
|
|
229
236
|
/**
|
|
@@ -2,6 +2,7 @@ import TForm from '../../utils/TForm';
|
|
|
2
2
|
import { type CurdConfig, type CurdConfigColumn } from '.';
|
|
3
3
|
import SwitchConfirm from './com/dialog/switchConfirm.vue';
|
|
4
4
|
import FormList from './com/form/list.vue';
|
|
5
|
+
import IconRefresh from './icon/refresh.vue';
|
|
5
6
|
import { type FormInstance, ElButton, ElDatePicker, ElDialog, ElDropdown, ElDropdownItem, ElDropdownMenu, ElForm, ElFormItem, ElInput, ElOption, ElPagination, ElSelect, ElSwitch, ElTable, ElTableColumn, ElTreeSelect } from 'element-plus';
|
|
6
7
|
declare const EDialog: {
|
|
7
8
|
Insert: any;
|
|
@@ -213,8 +214,16 @@ declare const conf: {
|
|
|
213
214
|
list: any[];
|
|
214
215
|
change: (selection: any[]) => void;
|
|
215
216
|
};
|
|
216
|
-
|
|
217
|
-
|
|
217
|
+
};
|
|
218
|
+
export: {
|
|
219
|
+
run: {
|
|
220
|
+
start: (command: any) => Promise<void>;
|
|
221
|
+
select: () => any[];
|
|
222
|
+
page: () => any[];
|
|
223
|
+
all: () => Promise<any>;
|
|
224
|
+
};
|
|
225
|
+
loading: boolean;
|
|
226
|
+
click: (command: any) => void;
|
|
218
227
|
};
|
|
219
228
|
update: {
|
|
220
229
|
title: string;
|
|
@@ -342,7 +351,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
342
351
|
row: Record<string, any>;
|
|
343
352
|
}, __VLS_63: {
|
|
344
353
|
row: Record<string, any>;
|
|
345
|
-
}, __VLS_117: {}, __VLS_119: {},
|
|
354
|
+
}, __VLS_117: {}, __VLS_119: {}, __VLS_142: string, __VLS_143: {
|
|
346
355
|
row: any;
|
|
347
356
|
item: {
|
|
348
357
|
key: string;
|
|
@@ -426,13 +435,13 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
426
435
|
table?: number | undefined;
|
|
427
436
|
} | undefined;
|
|
428
437
|
};
|
|
429
|
-
},
|
|
438
|
+
}, __VLS_153: {
|
|
430
439
|
row: any;
|
|
431
|
-
},
|
|
440
|
+
}, __VLS_179: {
|
|
432
441
|
row: any;
|
|
433
|
-
},
|
|
442
|
+
}, __VLS_190: {}, __VLS_202: {
|
|
434
443
|
row: any;
|
|
435
|
-
},
|
|
444
|
+
}, __VLS_209: string, __VLS_210: {
|
|
436
445
|
row: any;
|
|
437
446
|
item: {
|
|
438
447
|
key: string;
|
|
@@ -516,7 +525,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
516
525
|
table?: number | undefined;
|
|
517
526
|
} | undefined;
|
|
518
527
|
};
|
|
519
|
-
},
|
|
528
|
+
}, __VLS_213: string, __VLS_214: {
|
|
520
529
|
row: any;
|
|
521
530
|
item: {
|
|
522
531
|
key: string;
|
|
@@ -600,7 +609,7 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
600
609
|
table?: number | undefined;
|
|
601
610
|
} | undefined;
|
|
602
611
|
};
|
|
603
|
-
},
|
|
612
|
+
}, __VLS_248: string, __VLS_249: {
|
|
604
613
|
row: any;
|
|
605
614
|
item: {
|
|
606
615
|
key: string;
|
|
@@ -684,19 +693,19 @@ declare var __VLS_1: {}, __VLS_7: {
|
|
|
684
693
|
table?: number | undefined;
|
|
685
694
|
} | undefined;
|
|
686
695
|
};
|
|
687
|
-
},
|
|
696
|
+
}, __VLS_251: {
|
|
688
697
|
row: any;
|
|
689
698
|
};
|
|
690
699
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
691
700
|
[K in NonNullable<typeof __VLS_14>]?: (props: typeof __VLS_15) => any;
|
|
692
701
|
} & {
|
|
693
|
-
[K in NonNullable<typeof
|
|
702
|
+
[K in NonNullable<typeof __VLS_142>]?: (props: typeof __VLS_143) => any;
|
|
694
703
|
} & {
|
|
695
|
-
[K in NonNullable<typeof
|
|
704
|
+
[K in NonNullable<typeof __VLS_209>]?: (props: typeof __VLS_210) => any;
|
|
696
705
|
} & {
|
|
697
|
-
[K in NonNullable<typeof
|
|
706
|
+
[K in NonNullable<typeof __VLS_213>]?: (props: typeof __VLS_214) => any;
|
|
698
707
|
} & {
|
|
699
|
-
[K in NonNullable<typeof
|
|
708
|
+
[K in NonNullable<typeof __VLS_248>]?: (props: typeof __VLS_249) => any;
|
|
700
709
|
} & {
|
|
701
710
|
'box-left'?: (props: typeof __VLS_1) => any;
|
|
702
711
|
} & {
|
|
@@ -710,15 +719,15 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
710
719
|
} & {
|
|
711
720
|
'tools-right'?: (props: typeof __VLS_119) => any;
|
|
712
721
|
} & {
|
|
713
|
-
'table-op-left'?: (props: typeof
|
|
722
|
+
'table-op-left'?: (props: typeof __VLS_153) => any;
|
|
714
723
|
} & {
|
|
715
|
-
'table-op-right'?: (props: typeof
|
|
724
|
+
'table-op-right'?: (props: typeof __VLS_179) => any;
|
|
716
725
|
} & {
|
|
717
|
-
'box-right'?: (props: typeof
|
|
726
|
+
'box-right'?: (props: typeof __VLS_190) => any;
|
|
718
727
|
} & {
|
|
719
|
-
'form-start'?: (props: typeof
|
|
728
|
+
'form-start'?: (props: typeof __VLS_202) => any;
|
|
720
729
|
} & {
|
|
721
|
-
'form-end'?: (props: typeof
|
|
730
|
+
'form-end'?: (props: typeof __VLS_251) => any;
|
|
722
731
|
}>;
|
|
723
732
|
declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
724
733
|
/**
|
|
@@ -731,6 +740,7 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
731
740
|
TForm: typeof TForm;
|
|
732
741
|
SwitchConfirm: typeof SwitchConfirm;
|
|
733
742
|
FormList: typeof FormList;
|
|
743
|
+
IconRefresh: typeof IconRefresh;
|
|
734
744
|
ElButton: typeof ElButton;
|
|
735
745
|
ElDatePicker: typeof ElDatePicker;
|
|
736
746
|
ElDialog: typeof ElDialog;
|
|
@@ -972,8 +982,16 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
972
982
|
list: any[];
|
|
973
983
|
change: (selection: any[]) => void;
|
|
974
984
|
};
|
|
975
|
-
|
|
976
|
-
|
|
985
|
+
};
|
|
986
|
+
export: {
|
|
987
|
+
run: {
|
|
988
|
+
start: (command: any) => Promise<void>;
|
|
989
|
+
select: () => any[];
|
|
990
|
+
page: () => any[];
|
|
991
|
+
all: () => Promise<any>;
|
|
992
|
+
};
|
|
993
|
+
loading: boolean;
|
|
994
|
+
click: (command: any) => void;
|
|
977
995
|
};
|
|
978
996
|
update: {
|
|
979
997
|
title: string;
|