cc1-form 1.0.4 → 1.0.6
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 +372 -335
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +94 -22
- package/dist/components/TCurd/index.d.ts +29 -5
- package/dist/components/TCurd/index.vue.d.ts +160 -40
- package/dist/index.d.ts +2 -1
- package/dist/utils/TFile.d.ts +20 -0
- package/dist/utils/TSys.d.ts +0 -4
- package/package.json +1 -1
package/dist/cc1-form.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y.cc1Form={},y.Vue,y.ElementPlus))})(this,(function(y,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=(c,d)=>typeof c=="function"?c(d):c;static getRouterParams=()=>{const c=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(c).length?c:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async c=>{if(!b.moduleObj[c])throw new Error(`模块${c}未加载,请赋值如:TSys.moduleObj = { ${c}: ()=>import('${c}') }`);const d=await b.moduleObj[c]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(c,d,i={}){const m=Date.now();if(!this.tipMessages[c]||m-this.tipMessages[c]>this.tipMessagesGap){this.tipMessages[c]=m;const h=Object.assign({message:c,type:d},i);p.ElMessage(h),setTimeout(()=>{delete this.tipMessages[c]},this.tipMessagesGap)}}static fail=(c,d={})=>{this.showMessage(c,"error",d)};static success=(c,d={})=>{this.showMessage(c,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(c=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{c?this.loadingObj=p.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(c,d=!0)=>{if(d){let i=screen.width/2-500,m=screen.height/2-800/2-30;window.open(c,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+m+", left="+i)}else window.open(c,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=c=>new Promise(async(d,i)=>{let m=document.getElementById(c.id);const h=await b.loadModule("html2canvas");try{h(m,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:c.windowWidth,height:c.windowHeight,windowWidth:c.windowWidth,windowHeight:c.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(r){let t=r.toDataURL("image/png");d(t)})}catch(r){i(r)}});static async download(c,d="download.png"){const i=document.createElement("a");i.style.display="none",i.href=c,i.setAttribute("download",d),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(c)}}class V{static customComponent={};static findOptions=(c,d)=>{const i=c.column.find(h=>h.key===d),m=h=>h.replace(/-([a-z])/g,(r,t)=>t.toUpperCase());if(i)return i.options[m(i.type)]};static setOptionsData=(c,d,i)=>{const m=V.findOptions(c,d);m&&(m.data=i)};static form={openBefore:{parentId:(c,d,i,m)=>{c?d.type===b.EDialog.Insert?(d.form.parentId=c._id,d.form.sort=c.children.length+1):d.form.parentId=c.parentId.substring(c.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=i.length+1),V.setOptionsData(m,"parentId",[{_id:"0",title:"根",children:i}])}}}}class C{static getIdFun=()=>StrUtil.uuid();static setId=(c,d,i)=>{d[c]||(d[c]=[]),d[c].forEach(m=>{i.forEach(h=>{let r=h.default??"";h.type==="number"&&(r=h.default??0),h.type==="boolean"&&(r=h.default??!1),h.type==="time"&&(r=h.default??new Date),m[h.value]===void 0&&(m[h.value]=r)}),m._id||(m._id=C.getIdFun())})};static add=(c,d,i,m)=>{const h=JSONUtil.cp(i);C.setId(c,d,i),d[c].push(h.reduce((r,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),r[t.value]=s,r},{_id:C.getIdFun()})),m?.(d)};static remove=(c,d,i,m)=>{d[c]=d[c].filter(h=>h._id!==i._id),m?.(d)};static getNoIdData=(c,d)=>{const i=JSONUtil.cp(c);return i.forEach(m=>{m._id&&delete m._id,d&&m[d]&&C.getNoIdData(m[d],d)}),i}}const F={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(f,{emit:c}){const d=f,i=e.reactive({show:!1,add:(h,r,t)=>{C.add(h,r,t,()=>{m("change")})},remove:(h,r,t)=>{C.remove(h,r,t,()=>{m("change")})}});e.onMounted(()=>{C.setId(d.field,d.row,d.itemFields),i.show=!0});const m=c;return(h,r)=>{const t=e.resolveComponent("el-button"),s=e.resolveComponent("el-input");return i.show?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(h.$slots,"list-start",{row:f.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:r[0]||(r[0]=a=>i.add(f.field,f.row,f.itemFields))},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.row[f.field],a=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(h.$slots,"item-start",{item:a,row:f.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.itemFields,l=>(e.openBlock(),e.createBlock(s,{modelValue:a[l.value],"onUpdate:modelValue":o=>a[l.value]=o,style:e.normalizeStyle({width:f.inputWidth}),class:e.normalizeClass(f.inputClass),placeholder:l[f.label]||l[f.value],onChange:r[1]||(r[1]=o=>m("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:a,row:f.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>i.remove(f.field,f.row,a)},{default:e.withCtx(()=>[...r[3]||(r[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:f.row})])):e.createCommentVNode("",!0)}}}),T={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(f,{expose:c}){const d=b.isFun,i=b.EDialog,m=e.ref(),h=f,r=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||i.Insert)===i.Insert?"create":"update"],initColumnForm:()=>{const t=h.option;r.formColumn=[];const s=[],a=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||a;let o=[];const n=u=>{if(r.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let w=u.form.span,k=o.reduce((B,E)=>B+E.span,w);const g=o.length;o.push({item:u,span:w}),(g===1&&o[0].span===0||k>=a||w===0&&g>1)&&(s.push(o),o=[]),u.rules&&(r.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,n(u)}),o.length>0&&s.push(o),r.formColumn=s},init:async()=>{r.show=!1,await e.nextTick(),r.initColumnForm(),r.show=!0}});return r.initColumnForm(),c({ref:m,conf:r}),(t,s)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:m,model:r.form,rules:r.rules},{default:e.withCtx(()=>[r.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.formColumn,a=>(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(t.$slots,"form-start",{row:r.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,r.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(p.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:r.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:r.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:r.form[l.item.key],"onUpdate:modelValue":o=>r.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on),{disabled:r.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:r.form[l.item.key],"onUpdate:modelValue":o=>r.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:r.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:r.form[l.item.key],"onUpdate:modelValue":o=>r.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:r.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(p.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:r.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:r.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:r.form[l.item.key],"onUpdate:modelValue":o=>r.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:r.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:r.form[l.item.key],"onUpdate:modelValue":o=>r.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:r.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:r.form[l.item.key],"onUpdate:modelValue":o=>r.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:r.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:r.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:r.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(c,d,i)=>{const m=await b.loadModule("xlsx"),h=c.map(s=>{const a={};return d.forEach(l=>{a[l.label]=s[l.key]}),a}),r=m.utils.json_to_sheet(h),t=m.utils.book_new();m.utils.book_append_sheet(t,r,"Sheet1"),i?typeof i=="function"&&(i=i()):i=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,m.writeFile(t,`${i}.xlsx`)}}const O={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(f,{expose:c}){const d=e.ref(!1),i=e.ref("确认修改"),m=e.ref("确认要修改状态吗?");let h=null,r=null;const t=l=>(l?.title&&(i.value=l.title),l?.content&&(m.value=l.content),d.value=!0,new Promise((o,n)=>{h=o,r=n})),s=()=>{d.value=!1,h?.(!0),h=null,r=null},a=()=>{d.value=!1,r?.(new Error("用户取消操作")),h=null,r=null};return c({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=n=>d.value=n),title:i.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",O,[e.createVNode(e.unref(p.ElButton),{onClick:a},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.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(m.value),1)]),_:1},8,["modelValue","title"]))}}),L={class:"col relative cc1-form-box"},j={class:"absolute row fit",style:{overflow:"hidden"}},z={class:"col column"},M={key:0,class:"relative curd-search"},R={class:"mb-20 flex justify-between items-center"},_={class:"flex items-center",style:{gap:"10px"}},H={key:0},W={key:1},A={key:2},J={class:"export-btn"},K={class:"flex items-center",style:{gap:"10px"}},q={class:"col fit-width relative"},G={class:"absolute column fit"},X={class:"row justify-end mt-20 mb-20"},Q={class:"row curd-row"},Y={class:"row form-item-content",style:{width:"100%"}},Z={class:"col"},P={class:"dialog-footer"},v={class:"dialog-footer"},D=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(f,{expose:c}){const d=b.EDialog,i=f,m=e.ref(),h=e.ref(),r=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getFormData:()=>{let s={};i.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=i.option.search?.before?.(s);return a&&(s=a),s},reset:()=>{const s=t.search.formDefault;Object.keys(s).forEach(a=>{i.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:i.option.page?.size||10,sizeList:i.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:i.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{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=i.option.api.list,a=await s({size:t.page.size,num:t.page.num,...t.search.getFormData(),final(n,u,w){t.table.loading=!1}}),l=a.data||{list:a};let o=Array.isArray(l.list)?l.list:l;t.table.data=i.option.data?await i.option.data(o):o,t.page.total=l.total||0},selection:{list:[],change:s=>{t.table.selection.list=s}},exportFun:{start:async s=>{let a=await t.table.exportFun[s](),l=i.option.column;const o=JSONUtil.cp({data:a,columns:l}),n=i.option.tools?.export||{};n.before&&n.before(o),S.exportToExcel(o.data,o.columns,n.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 s=i.option.api.list,{data:a}=await s({size:999999,num:1,final(l,o,n){t.table.loading=!1}});return a.list}},export:s=>{t.table.exportFun.start(s)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:s=>s.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:s=>{if(i.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===d.Insert;t.update.edit.data=a,t.update.title=l?"新增":"编辑",t.update.form=JSONUtil.cp(l?t.update.formDefault:a),await i.option.form?.openBefore?.(a,t.update),t.update.show=!0,t.update.showContent=!0,i.option.form?.openAfter?.(a,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((n,u)=>{l||(b.fail("请检查表单数据"),u(!1)),n()})),t.update.loading=!0;const s=t.update.type===d.Insert?i.option.api.create:i.option.api.update;let a=JSONUtil.cp(t.update.form);delete a.children,await i.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)}}),await s({...a,final(l,o,n){t.update.loading=!1}}),t.update.close(),await t.table.getList(),i.option.form?.submitAfter?.(a,t.update)})},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){b.fail("请选择要删除的数据");return}t.remove.items=s,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.table.loading=!0;const s=i.option.api.delete;await s({_id:t.remove.items.map(a=>a._id),final(a,l,o){t.table.loading=!1}}),b.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()})}},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=i.option;Object.keys(a).forEach(o=>{l[o]=ObjectUtil.deepMerge(a[o],l[o]||{})})},initColumnOptions:()=>{const s=i.option,a=l=>{const n={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(w,k)=>{const g=l.options?.switch;try{return await m.value?.open({title:"确认修改",content:`确认要${k[w]===g.activeValue?g.inactiveLabel:g.activeLabel}吗?`}),t.table.loading=!0,await i.option.api.update({_id:k._id,[w]:k[w]===g.activeValue?g.inactiveValue:g.activeValue,final(B,E,U){t.table.loading=!1}}),b.success("操作成功"),t.table.getList(),!0}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(n).forEach(w=>{u[w]=ObjectUtil.deepMerge(n[w],u[w]||{})})};s.column.forEach(a),s.table?.column?.forEach(a)},initColumnForm:()=>{const s=i.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const a=[],l=i.option.form?.maxSpan||12,o=i.option.form?.defaultSpan||l/2;let n=[];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 g=k.form.span,B=n.reduce((U,te)=>U+te.span,g);const E=n.length;n.push({item:k,span:g}),(E===1&&n[0].span===0||B>=l||g===0&&E>1)&&(a.push(n),n=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};s.column.forEach(k=>{k.isForm=!0,u(k)}),i.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,g)=>k.sort?.search-g.sort?.search),t.table.column.list.sort((k,g)=>k.sort?.table-g.sort?.table),n.length>0&&a.push(n),t.update.formColumn=a;const w=i.option.search?.formDefault;w&&Object.keys(w).forEach(k=>{t.search.formDefault[k]=w[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()}),c({conf:t}),(s,a)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.renderSlot(s.$slots,"box-left"),e.createElementVNode("div",z,[f.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(e.unref(p.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(p.ElFormItem),{key:0,label:o.label},{default:e.withCtx(()=>[e.renderSlot(s.$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":n=>t.search.form[o.key]=n,placeholder:`请输入${o.label}`,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":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,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":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,n=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(s.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(p.ElFormItem),null,{default:e.withCtx(()=>[f.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),f.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...a[8]||(a[8]=[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",R,[e.createElementVNode("div",_,[e.unref(r)(f.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:a[0]||(a[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),f.option.table?.selectable&&e.unref(r)(f.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",W,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:a[1]||(a[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),f.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:a[2]||(a[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),f.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(()=>[...a[13]||(a[13]=[e.createTextVNode("导出选中",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",J,[e.createVNode(e.unref(p.ElButton),{type:"warning"},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"tools-left")]),e.createElementVNode("div",K,[e.renderSlot(s.$slots,"tools-right")])]),e.createElementVNode("div",q,[e.createElementVNode("div",G,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:t.table.data},f.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[f.option.table?.selectable&&e.unref(r)(f.option.tools?.delete)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof f.option.table?.selectable=="function"?f.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:n})=>[e.renderSlot(s.$slots,"table-"+o.key,{row:n,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:n[o.key],"onUpdate:modelValue":u=>n[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,n)},{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(n[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(r)(f.option.tools?.add)||e.unref(r)(f.option.tools?.update)||e.unref(r)(f.option.tools?.delete)||s.$slots["table-op-left"]||s.$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(s.$slots,"table-op-left",{row:o}),e.unref(r)(f.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:n=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(f.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:n=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[...a[17]||(a[17]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(f.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:n=>t.remove.open([o])},{default:e.withCtx(()=>[...a[18]||(a[18]=[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",X,[t.page.total>t.page.size?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":t.page.num,"onUpdate:currentPage":a[3]||(a[3]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":a[4]||(a[4]=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(s.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":a[5]||(a[5]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},f.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",P,[e.createVNode(e.unref(p.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...a[19]||(a[19]=[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(()=>[...a[20]||(a[20]=[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("div",Q,[e.renderSlot(s.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,n=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)(n.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(n.item.form.span>0?`col-${n.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:n.item.label,prop:n.item.key,"label-width":n.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.renderSlot(s.$slots,"form-"+n.item.key+"-start",{row:t.update.form,item:n.item}),e.createElementVNode("div",Z,[e.renderSlot(s.$slots,"form-"+n.item.key,{row:t.update.form,item:n.item},()=>[n.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":u=>t.update.form[n.item.key]=u},{ref_for:!0},n.item.options?.input,e.toHandlers(n.item.options?.input?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":u=>t.update.form[n.item.key]=u},{ref_for:!0},n.item.options?.switch,{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":u=>t.update.form[n.item.key]=u},{ref_for:!0},n.item.options?.select,e.toHandlers(n.item.options?.select?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.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"])):n.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:n.item.key},{ref_for:!0},n.item.options?.list,e.toHandlers(n.item.options?.list?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":u=>t.update.form[n.item.key]=u},{ref_for:!0},n.item.options?.treeSelect,e.toHandlers(n.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":u=>t.update.form[n.item.key]=u},{ref_for:!0},n.item.options?.datetime,e.toHandlers(n.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[n.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[n.item.type]),e.mergeProps({key:6,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":u=>t.update.form[n.item.key]=u},{ref_for:!0},n.item.options?.[n.item.type],e.toHandlers(n.item.options?.[n.item.type]?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(s.$slots,"form-"+n.item.key+"-end",{row:t.update.form,item:n.item})])]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(s.$slots,"form-end",{row:t.update.form})]))),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":a[6]||(a[6]=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(()=>[...a[21]||(a[21]=[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(()=>[...a[22]||(a[22]=[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:m},null,512)])}}}),ee=(f,c)=>{if(f.component("TCurd",D),f.component("TFormList",x),f.component("TColumn",N),c?.customComponent){V.customComponent=c.customComponent;for(const d in c.customComponent)f.component(d,c.customComponent[d])}};y.ArrUtil=C,y.ExcelUtil=S,y.TColumn=N,y.TCurd=D,y.TForm=V,y.TFormList=x,y.TSys=b,y.install=ee,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(y,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):(y=typeof globalThis<"u"?globalThis:y||self,e(y.cc1Form={},y.Vue,y.ElementPlus))})(this,(function(y,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=(c,d)=>typeof c=="function"?c(d):c;static getRouterParams=()=>{const c=this.router.currentRoute.value.query||{},d=this.router.currentRoute.value.params||{};return Object.keys(c).length?c:Object.keys(d).length?d:{}};static moduleObj={};static loadModule=async c=>{if(!b.moduleObj[c])throw new Error(`模块${c}未加载,请赋值如:TSys.moduleObj = { ${c}: ()=>import('${c}') }`);const d=await b.moduleObj[c]();return d.default??d};static tipMessages={};static tipMessagesGap=500;static showMessage(c,d,i={}){const f=Date.now();if(!this.tipMessages[c]||f-this.tipMessages[c]>this.tipMessagesGap){this.tipMessages[c]=f;const m=Object.assign({message:c,type:d},i);p.ElMessage(m),setTimeout(()=>{delete this.tipMessages[c]},this.tipMessagesGap)}}static fail=(c,d={})=>{this.showMessage(c,"error",d)};static success=(c,d={})=>{this.showMessage(c,"success",d)};static loadingObj=null;static loadingTimer=null;static loading=(c=!0,d="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{c?this.loadingObj=p.ElLoading.service({lock:!0,text:d,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(c,d=!0)=>{if(d){let i=screen.width/2-500,f=screen.height/2-800/2-30;window.open(c,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+f+", left="+i)}else window.open(c,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=c=>new Promise(async(d,i)=>{let f=document.getElementById(c.id);const m=await b.loadModule("html2canvas");try{m(f,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:c.windowWidth,height:c.windowHeight,windowWidth:c.windowWidth,windowHeight:c.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(s){let t=s.toDataURL("image/png");d(t)})}catch(s){i(s)}})}class V{static customComponent={};static findOptions=(c,d)=>{const i=c.column.find(m=>m.key===d),f=m=>m.replace(/-([a-z])/g,(s,t)=>t.toUpperCase());if(i)return i.options[f(i.type)]};static setOptionsData=(c,d,i)=>{const f=V.findOptions(c,d);f&&(f.data=i)};static form={openBefore:{parentId:(c,d,i,f)=>{c?d.type===b.EDialog.Insert?(d.form.parentId=c._id,d.form.sort=c.children.length+1):d.form.parentId=c.parentId.substring(c.parentId.lastIndexOf(",")+1):(d.form.parentId="0",d.form.sort=i.length+1),V.setOptionsData(f,"parentId",[{_id:"0",title:"根",children:i}])}}}}class C{static getIdFun=()=>StrUtil.uuid();static setId=(c,d,i)=>{d[c]||(d[c]=[]),d[c].forEach(f=>{i.forEach(m=>{let s=m.default??"";m.type==="number"&&(s=m.default??0),m.type==="boolean"&&(s=m.default??!1),m.type==="time"&&(s=m.default??new Date),f[m.value]===void 0&&(f[m.value]=s)}),f._id||(f._id=C.getIdFun())})};static add=(c,d,i,f)=>{const m=JSONUtil.cp(i);C.setId(c,d,i),d[c].push(m.reduce((s,t)=>{let r=t.default??"";return t.type==="number"&&(r=t.default??0),t.type==="boolean"&&(r=t.default??!1),t.type==="time"&&(r=t.default??new Date),s[t.value]=r,s},{_id:C.getIdFun()})),f?.(d)};static remove=(c,d,i,f)=>{d[c]=d[c].filter(m=>m._id!==i._id),f?.(d)};static getNoIdData=(c,d)=>{const i=JSONUtil.cp(c);return i.forEach(f=>{f._id&&delete f._id,d&&f[d]&&C.getNoIdData(f[d],d)}),i}}const F={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(u,{emit:c}){const d=u,i=e.reactive({show:!1,add:(m,s,t)=>{C.add(m,s,t,()=>{f("change")})},remove:(m,s,t)=>{C.remove(m,s,t,()=>{f("change")})}});e.onMounted(()=>{C.setId(d.field,d.row,d.itemFields),i.show=!0});const f=c;return(m,s)=>{const t=e.resolveComponent("el-button"),r=e.resolveComponent("el-input");return i.show?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(m.$slots,"list-start",{row:u.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:s[0]||(s[0]=a=>i.add(u.field,u.row,u.itemFields))},{default:e.withCtx(()=>[...s[2]||(s[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.row[u.field],a=>(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(m.$slots,"item-start",{item:a,row:u.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.itemFields,l=>(e.openBlock(),e.createBlock(r,{modelValue:a[l.value],"onUpdate:modelValue":o=>a[l.value]=o,style:e.normalizeStyle({width:u.inputWidth}),class:e.normalizeClass(u.inputClass),placeholder:l[u.label]||l[u.value],onChange:s[1]||(s[1]=o=>f("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(m.$slots,"item-end",{item:a,row:u.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>i.remove(u.field,u.row,a)},{default:e.withCtx(()=>[...s[3]||(s[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(m.$slots,"list-end",{row:u.row})])):e.createCommentVNode("",!0)}}}),$={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(u,{expose:c}){const d=b.isFun,i=b.EDialog,f=e.ref(),m=u,s=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(m.type||i.Insert)===i.Insert?"create":"update"],initColumnForm:async()=>{const t=m.option;s.formColumn=[];const r=[],a=m.option.form?.maxSpan||12,l=m.option.form?.defaultSpan||a;let o=[];const n=h=>{if(s.formDefault[h.key]=h.value,h.isForm){h.form=h.form||{span:l},h.form.span=h.form.span??l;let w=h.form.span,k=o.reduce((B,E)=>B+E.span,w);const g=o.length;o.push({item:h,span:w}),(g===1&&o[0].span===0||k>=a||w===0&&g>1)&&(r.push(o),o=[]),h.rules&&(s.rules[h.key]=h.rules)}};t.column.forEach(h=>{h.isForm=!0,n(h)}),o.length>0&&r.push(o),s.formColumn=r,s.form=JSONUtil.cp(s.formDefault)},init:async()=>{s.show=!1,await e.nextTick(),s.initColumnForm()}});return s.initColumnForm(),c({ref:f,conf:s}),(t,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:f,model:s.form,rules:s.rules},{default:e.withCtx(()=>[s.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.formColumn,a=>(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(t.$slots,"form-start",{row:s.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(l.item.show?.form,s.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(p.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:s.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:s.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:s.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(p.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:s.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:s.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:s.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:s.form[l.item.key],"onUpdate:modelValue":o=>s.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:s.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:s.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:s.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class S{static exportToExcel=async(c,d,i)=>{const f=await b.loadModule("xlsx"),m=c.map(r=>{const a={};return d.forEach(l=>{a[l.label]=r[l.key]}),a}),s=f.utils.json_to_sheet(m),t=f.utils.book_new();f.utils.book_append_sheet(t,s,"Sheet1"),i?typeof i=="function"&&(i=i()):i=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,f.writeFile(t,`${i}.xlsx`)}}const O={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(u,{expose:c}){const d=e.ref(!1),i=e.ref("确认修改"),f=e.ref("确认要修改状态吗?");let m=null,s=null;const t=l=>(l?.title&&(i.value=l.title),l?.content&&(f.value=l.content),d.value=!0,new Promise((o,n)=>{m=o,s=n})),r=()=>{d.value=!1,m?.(!0),m=null,s=null},a=()=>{d.value=!1,s?.(new Error("用户取消操作")),m=null,s=null};return c({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:d.value,"onUpdate:modelValue":o[0]||(o[0]=n=>d.value=n),title:i.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",O,[e.createVNode(e.unref(p.ElButton),{onClick:a},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:r},{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"]))}}),L={class:"col relative cc1-form-box"},j={class:"absolute row fit",style:{overflow:"hidden"}},z={class:"col column"},R={key:0,class:"relative curd-search"},M={class:"mb-20 flex justify-between items-center"},_={class:"flex items-center",style:{gap:"10px"}},H={key:0},J={key:1},A={key:2},W={class:"export-btn"},K={class:"flex items-center",style:{gap:"10px"}},q={class:"col fit-width relative"},G={class:"absolute column fit"},X={class:"row justify-end mt-20 mb-20"},Q={class:"row curd-row"},Y={class:"row form-item-content",style:{width:"100%"}},Z={class:"col"},P={class:"dialog-footer"},v={class:"dialog-footer"},D=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(u,{expose:c}){const d=b.EDialog,i=u,f=e.ref(),m=e.ref(),s=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getFormData:()=>{let r={};i.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(r[l.key]=t.search.form[l.key])});const a=i.option.search?.before?.(r);return a&&(r=a),r},reset:()=>{const r=t.search.formDefault;Object.keys(r).forEach(a=>{i.option.search?.resetMode==="default"?r[a]=t.search.formDefault[a]:r[a]=void 0}),t.search.form=JSONUtil.cp(r),t.page.num=1,t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:i.option.page?.size||10,sizeList:i.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:i.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(r,a)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const r=a=>{let l=[];return a.forEach(o=>{l.push(o._id),o.children&&o.children.length>0&&(l=l.concat(r(o.children)))}),l};t.table.expand.rowKeys=r(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const r=i.option.api.list,a=await r({size:t.page.size,num:t.page.num,...t.search.getFormData(),final(n,h,w){t.table.loading=!1}}),l=a.data||{list:a};let o=Array.isArray(l.list)?l.list:l;t.table.data=i.option.data?await i.option.data(o):o,t.page.total=l.total||0},selection:{list:[],change:r=>{t.table.selection.list=r}},exportFun:{start:async r=>{let a=await t.table.exportFun[r](),l=i.option.column;const o=JSONUtil.cp({data:a,columns:l}),n=i.option.tools?.export||{};n.before&&n.before(o),S.exportToExcel(o.data,o.columns,n.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 r=i.option.api.list,{data:a}=await r({size:999999,num:1,final(l,o,n){t.table.loading=!1}});return a.list}},export:r=>{t.table.exportFun.start(r)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:r=>r.disabled?.[t.update.type===d.Insert?"create":"update"],edit:{data:{},getApiData:r=>{if(i.option.form?.editAll)return r;let a={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(l=>{r[l]!==t.update.edit.data[l]&&(a[l]=r[l])}),a}},open:(r,a)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=r;const l=r===d.Insert;t.update.edit.data=a,t.update.title=l?"新增":"编辑",t.update.form=JSONUtil.cp(l?t.update.formDefault:a),await i.option.form?.openBefore?.(a,t.update),t.update.show=!0,t.update.showContent=!0,i.option.form?.openAfter?.(a,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await m.value?.validate(async(l,o)=>new Promise((n,h)=>{l||(b.fail("请检查表单数据"),h(!1)),n()})),t.update.loading=!0;const r=t.update.type===d.Insert?i.option.api.create:i.option.api.update;let a=JSONUtil.cp(t.update.form);delete a.children,await i.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)}}),await r({...a,final(l,o,n){t.update.loading=!1}}),t.update.close(),await t.table.getList(),i.option.form?.submitAfter?.(a,t.update)})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:r=>{if(r.length===0){b.fail("请选择要删除的数据");return}t.remove.items=r,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.table.loading=!0;const r=i.option.api.delete;await r({_id:t.remove.items.map(a=>a._id),final(a,l,o){t.table.loading=!1}}),b.success("操作成功"),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()})}},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=i.option;Object.keys(a).forEach(o=>{l[o]=ObjectUtil.deepMerge(a[o],l[o]||{})})},initColumnOptions:()=>{const r=i.option,a=l=>{const n={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(w,k)=>{const g=l.options?.switch;try{return await f.value?.open({title:"确认修改",content:`确认要${k[w]===g.activeValue?g.inactiveLabel:g.activeLabel}吗?`}),t.table.loading=!0,await i.option.api.update({_id:k._id,[w]:k[w]===g.activeValue?g.inactiveValue:g.activeValue,final(B,E,U){t.table.loading=!1}}),b.success("操作成功"),t.table.getList(),!0}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}},h=l;Object.keys(n).forEach(w=>{h[w]=ObjectUtil.deepMerge(n[w],h[w]||{})})};r.column.forEach(a),r.table?.column?.forEach(a)},initColumnForm:()=>{const r=i.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const a=[],l=i.option.form?.maxSpan||12,o=i.option.form?.defaultSpan||l/2;let n=[];const h=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 g=k.form.span,B=n.reduce((U,oe)=>U+oe.span,g);const E=n.length;n.push({item:k,span:g}),(E===1&&n[0].span===0||B>=l||g===0&&E>1)&&(a.push(n),n=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};r.column.forEach(k=>{k.isForm=!0,h(k)}),i.option.table?.column?.forEach(k=>{k.isForm=!1,h(k)}),t.search.column.list=r.column.concat(r.table?.column||[]),t.table.column.list=t.search.column.list.filter(k=>k.table?.table),t.search.column.list.sort((k,g)=>k.sort?.search-g.sort?.search),t.table.column.list.sort((k,g)=>k.sort?.table-g.sort?.table),n.length>0&&a.push(n),t.update.formColumn=a;const w=i.option.search?.formDefault;w&&Object.keys(w).forEach(k=>{t.search.formDefault[k]=w[k]}),r.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()}),c({conf:t}),(r,a)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.renderSlot(r.$slots,"box-left"),e.createElementVNode("div",z,[u.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(r.$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:o.label},{default:e.withCtx(()=>[e.renderSlot(r.$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":n=>t.search.form[o.key]=n,placeholder:`请输入${o.label}`,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":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,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":n=>t.search.form[o.key]=n,placeholder:`请选择${o.label}`,clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,n=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):e.createCommentVNode("",!0)])]),_:2},1032,["label"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(r.$slots,"search-center",{row:t.search.form}),e.createVNode(e.unref(p.ElFormItem),null,{default:e.withCtx(()=>[u.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[...a[7]||(a[7]=[e.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),u.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[...a[8]||(a[8]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1}),e.renderSlot(r.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",M,[e.createElementVNode("div",_,[e.unref(s)(u.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:a[0]||(a[0]=o=>t.update.open(e.unref(d).Insert))},{default:e.withCtx(()=>[...a[9]||(a[9]=[e.createTextVNode("新增",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.table?.selectable&&e.unref(s)(u.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",J,[e.createVNode(e.unref(p.ElButton),{type:"danger",onClick:a[1]||(a[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[...a[10]||(a[10]=[e.createTextVNode(" 删除 ",-1)])]),_:1})])):e.createCommentVNode("",!0),u.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(e.unref(p.ElButton),{type:"warning",onClick:a[2]||(a[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[...a[11]||(a[11]=[e.createTextVNode("展开/收缩",-1)])]),_:1})])):e.createCommentVNode("",!0),u.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(()=>[...a[13]||(a[13]=[e.createTextVNode("导出选中",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[...a[14]||(a[14]=[e.createTextVNode("导出本页",-1)])]),_:1}),e.createVNode(e.unref(p.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[...a[15]||(a[15]=[e.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(p.ElButton),{type:"warning"},{default:e.withCtx(()=>[...a[12]||(a[12]=[e.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"tools-left")]),e.createElementVNode("div",K,[e.renderSlot(r.$slots,"tools-right")])]),e.createElementVNode("div",q,[e.createElementVNode("div",G,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(p.ElTable),e.mergeProps({data:t.table.data},u.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[u.option.table?.selectable&&e.unref(s)(u.option.tools?.delete)?(e.openBlock(),e.createBlock(e.unref(p.ElTableColumn),{key:0,type:"selection",selectable:typeof u.option.table?.selectable=="function"?u.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:n})=>[e.renderSlot(r.$slots,"table-"+o.key,{row:n,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:n[o.key],"onUpdate:modelValue":h=>n[o.key]=h,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,n)},{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(n[o.key]),1)],64))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(s)(u.option.tools?.add)||e.unref(s)(u.option.tools?.update)||e.unref(s)(u.option.tools?.delete)||r.$slots["table-op-left"]||r.$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(r.$slots,"table-op-left",{row:o}),e.unref(s)(u.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:n=>t.update.open(e.unref(d).Insert,o)},{default:e.withCtx(()=>[...a[16]||(a[16]=[e.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(s)(u.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:1,link:"",type:"warning",onClick:n=>t.update.open(e.unref(d).Update,o)},{default:e.withCtx(()=>[...a[17]||(a[17]=[e.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(s)(u.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:2,link:"",type:"danger",onClick:n=>t.remove.open([o])},{default:e.withCtx(()=>[...a[18]||(a[18]=[e.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(r.$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",X,[t.page.total>t.page.size?(e.openBlock(),e.createBlock(e.unref(p.ElPagination),{key:0,"current-page":t.page.num,"onUpdate:currentPage":a[3]||(a[3]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":a[4]||(a[4]=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(r.$slots,"box-right")]),e.createVNode(e.unref(p.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":a[5]||(a[5]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},u.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",P,[e.createVNode(e.unref(p.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[...a[19]||(a[19]=[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(()=>[...a[20]||(a[20]=[e.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:m,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("div",Q,[e.renderSlot(r.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,n=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(s)(n.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(n.item.form.span>0?`col-${n.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:n.item.label,prop:n.item.key,"label-width":n.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.renderSlot(r.$slots,"form-"+n.item.key+"-start",{row:t.update.form,item:n.item}),e.createElementVNode("div",Z,[e.renderSlot(r.$slots,"form-"+n.item.key,{row:t.update.form,item:n.item},()=>[n.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.input,e.toHandlers(n.item.options?.input?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.switch,{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.select,e.toHandlers(n.item.options?.select?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.item.options?.select?.data,h=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:n.item.key},{ref_for:!0},n.item.options?.list,e.toHandlers(n.item.options?.list?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.treeSelect,e.toHandlers(n.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.datetime,e.toHandlers(n.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[n.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[n.item.type]),e.mergeProps({key:6,modelValue:t.update.form[n.item.key],"onUpdate:modelValue":h=>t.update.form[n.item.key]=h},{ref_for:!0},n.item.options?.[n.item.type],e.toHandlers(n.item.options?.[n.item.type]?.on||{}),{disabled:t.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(r.$slots,"form-"+n.item.key+"-end",{row:t.update.form,item:n.item})])]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(r.$slots,"form-end",{row:t.update.form})]))),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":a[6]||(a[6]=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(()=>[...a[21]||(a[21]=[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(()=>[...a[22]||(a[22]=[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(c,d="download.png"){const i=document.createElement("a");i.style.display="none",i.href=c,i.setAttribute("download",d),typeof i.download>"u"&&i.setAttribute("target","_blank"),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(c)}static exportJSONFile=(c,d)=>{const i=new Blob([JSON.stringify(c)],{type:"application/json"}),f=URL.createObjectURL(i),m=document.createElement("a");m.href=f,m.download=`${d||"config"}.json`,m.click()};static importFile=async c=>new Promise((d,i)=>{const f=document.createElement("input");f.type="file";const m=c?.accept||".json";f.accept=m,f.style.display="none",f.onchange=s=>{const t=s.target.files[0];if(!t){b.fail("未选择文件"),i("未选择文件");return}const r=new FileReader;r.onload=async a=>{const l=m==".json"?JSON.parse(a.target.result):a.target.result;d(l)},r.onerror=()=>{b.fail("文件读取失败"),i("文件读取失败")},r.readAsText(t),document.body.removeChild(f)},document.body.appendChild(f),f.click()})}const te=(u,c)=>{if(u.component("TCurd",D),u.component("TFormList",x),u.component("TColumn",N),c?.customComponent){V.customComponent=c.customComponent;for(const d in c.customComponent)u.component(d,c.customComponent[d])}};y.ArrUtil=C,y.ExcelUtil=S,y.TColumn=N,y.TCurd=D,y.TFile=ee,y.TForm=V,y.TFormList=x,y.TSys=b,y.install=te,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -21,7 +21,10 @@ declare const conf: {
|
|
|
21
21
|
} | undefined;
|
|
22
22
|
options?: {
|
|
23
23
|
[x: string]: any;
|
|
24
|
-
input?:
|
|
24
|
+
input?: {
|
|
25
|
+
[x: string]: any;
|
|
26
|
+
on?: any;
|
|
27
|
+
} | undefined;
|
|
25
28
|
switch?: {
|
|
26
29
|
on?: Record<string, any> | undefined;
|
|
27
30
|
activeValue?: any;
|
|
@@ -30,9 +33,18 @@ declare const conf: {
|
|
|
30
33
|
inactiveLabel?: string | undefined;
|
|
31
34
|
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
32
35
|
} | undefined;
|
|
33
|
-
select?:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
select?: {
|
|
37
|
+
[x: string]: any;
|
|
38
|
+
on?: any;
|
|
39
|
+
} | undefined;
|
|
40
|
+
treeSelect?: {
|
|
41
|
+
[x: string]: any;
|
|
42
|
+
on?: any;
|
|
43
|
+
} | undefined;
|
|
44
|
+
datetime?: {
|
|
45
|
+
[x: string]: any;
|
|
46
|
+
on?: any;
|
|
47
|
+
} | undefined;
|
|
36
48
|
list?: {
|
|
37
49
|
on?: Record<string, any> | undefined;
|
|
38
50
|
label?: string | undefined;
|
|
@@ -74,7 +86,7 @@ declare const conf: {
|
|
|
74
86
|
span: number;
|
|
75
87
|
}[][];
|
|
76
88
|
getDisabled: (item: CurdConfigColumn) => boolean | undefined;
|
|
77
|
-
initColumnForm: () => void
|
|
89
|
+
initColumnForm: () => Promise<void>;
|
|
78
90
|
init: () => Promise<void>;
|
|
79
91
|
};
|
|
80
92
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
@@ -93,7 +105,10 @@ declare var __VLS_7: {
|
|
|
93
105
|
} | undefined;
|
|
94
106
|
options?: {
|
|
95
107
|
[x: string]: any;
|
|
96
|
-
input?:
|
|
108
|
+
input?: {
|
|
109
|
+
[x: string]: any;
|
|
110
|
+
on?: any;
|
|
111
|
+
} | undefined;
|
|
97
112
|
switch?: {
|
|
98
113
|
on?: Record<string, any> | undefined;
|
|
99
114
|
activeValue?: any;
|
|
@@ -102,9 +117,18 @@ declare var __VLS_7: {
|
|
|
102
117
|
inactiveLabel?: string | undefined;
|
|
103
118
|
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
104
119
|
} | undefined;
|
|
105
|
-
select?:
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
select?: {
|
|
121
|
+
[x: string]: any;
|
|
122
|
+
on?: any;
|
|
123
|
+
} | undefined;
|
|
124
|
+
treeSelect?: {
|
|
125
|
+
[x: string]: any;
|
|
126
|
+
on?: any;
|
|
127
|
+
} | undefined;
|
|
128
|
+
datetime?: {
|
|
129
|
+
[x: string]: any;
|
|
130
|
+
on?: any;
|
|
131
|
+
} | undefined;
|
|
108
132
|
list?: {
|
|
109
133
|
on?: Record<string, any> | undefined;
|
|
110
134
|
label?: string | undefined;
|
|
@@ -156,7 +180,10 @@ declare var __VLS_7: {
|
|
|
156
180
|
} | undefined;
|
|
157
181
|
options?: {
|
|
158
182
|
[x: string]: any;
|
|
159
|
-
input?:
|
|
183
|
+
input?: {
|
|
184
|
+
[x: string]: any;
|
|
185
|
+
on?: any;
|
|
186
|
+
} | undefined;
|
|
160
187
|
switch?: {
|
|
161
188
|
on?: Record<string, any> | undefined;
|
|
162
189
|
activeValue?: any;
|
|
@@ -165,9 +192,18 @@ declare var __VLS_7: {
|
|
|
165
192
|
inactiveLabel?: string | undefined;
|
|
166
193
|
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
167
194
|
} | undefined;
|
|
168
|
-
select?:
|
|
169
|
-
|
|
170
|
-
|
|
195
|
+
select?: {
|
|
196
|
+
[x: string]: any;
|
|
197
|
+
on?: any;
|
|
198
|
+
} | undefined;
|
|
199
|
+
treeSelect?: {
|
|
200
|
+
[x: string]: any;
|
|
201
|
+
on?: any;
|
|
202
|
+
} | undefined;
|
|
203
|
+
datetime?: {
|
|
204
|
+
[x: string]: any;
|
|
205
|
+
on?: any;
|
|
206
|
+
} | undefined;
|
|
171
207
|
list?: {
|
|
172
208
|
on?: Record<string, any> | undefined;
|
|
173
209
|
label?: string | undefined;
|
|
@@ -219,7 +255,10 @@ declare var __VLS_7: {
|
|
|
219
255
|
} | undefined;
|
|
220
256
|
options?: {
|
|
221
257
|
[x: string]: any;
|
|
222
|
-
input?:
|
|
258
|
+
input?: {
|
|
259
|
+
[x: string]: any;
|
|
260
|
+
on?: any;
|
|
261
|
+
} | undefined;
|
|
223
262
|
switch?: {
|
|
224
263
|
on?: Record<string, any> | undefined;
|
|
225
264
|
activeValue?: any;
|
|
@@ -228,9 +267,18 @@ declare var __VLS_7: {
|
|
|
228
267
|
inactiveLabel?: string | undefined;
|
|
229
268
|
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
230
269
|
} | undefined;
|
|
231
|
-
select?:
|
|
232
|
-
|
|
233
|
-
|
|
270
|
+
select?: {
|
|
271
|
+
[x: string]: any;
|
|
272
|
+
on?: any;
|
|
273
|
+
} | undefined;
|
|
274
|
+
treeSelect?: {
|
|
275
|
+
[x: string]: any;
|
|
276
|
+
on?: any;
|
|
277
|
+
} | undefined;
|
|
278
|
+
datetime?: {
|
|
279
|
+
[x: string]: any;
|
|
280
|
+
on?: any;
|
|
281
|
+
} | undefined;
|
|
234
282
|
list?: {
|
|
235
283
|
on?: Record<string, any> | undefined;
|
|
236
284
|
label?: string | undefined;
|
|
@@ -292,6 +340,8 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
292
340
|
form?: {
|
|
293
341
|
maxSpan?: number;
|
|
294
342
|
defaultSpan?: number;
|
|
343
|
+
openBefore?: (item: any, conf: any) => any;
|
|
344
|
+
openAfter?: (item: any, conf: any) => any;
|
|
295
345
|
};
|
|
296
346
|
column: CurdConfigColumn[];
|
|
297
347
|
};
|
|
@@ -325,6 +375,8 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
325
375
|
form?: {
|
|
326
376
|
maxSpan?: number;
|
|
327
377
|
defaultSpan?: number;
|
|
378
|
+
openBefore?: (item: any, conf: any) => any;
|
|
379
|
+
openAfter?: (item: any, conf: any) => any;
|
|
328
380
|
};
|
|
329
381
|
column: CurdConfigColumn[];
|
|
330
382
|
};
|
|
@@ -341,6 +393,8 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
341
393
|
form?: {
|
|
342
394
|
maxSpan?: number;
|
|
343
395
|
defaultSpan?: number;
|
|
396
|
+
openBefore?: (item: any, conf: any) => any;
|
|
397
|
+
openAfter?: (item: any, conf: any) => any;
|
|
344
398
|
};
|
|
345
399
|
column: CurdConfigColumn[];
|
|
346
400
|
};
|
|
@@ -354,6 +408,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
354
408
|
form?: {
|
|
355
409
|
maxSpan?: number;
|
|
356
410
|
defaultSpan?: number;
|
|
411
|
+
openBefore?: (item: any, conf: any) => any;
|
|
412
|
+
openAfter?: (item: any, conf: any) => any;
|
|
357
413
|
};
|
|
358
414
|
column: CurdConfigColumn[];
|
|
359
415
|
};
|
|
@@ -383,7 +439,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
383
439
|
} | undefined;
|
|
384
440
|
options?: {
|
|
385
441
|
[x: string]: any;
|
|
386
|
-
input?:
|
|
442
|
+
input?: {
|
|
443
|
+
[x: string]: any;
|
|
444
|
+
on?: any;
|
|
445
|
+
} | undefined;
|
|
387
446
|
switch?: {
|
|
388
447
|
on?: Record<string, any> | undefined;
|
|
389
448
|
activeValue?: any;
|
|
@@ -392,9 +451,18 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
392
451
|
inactiveLabel?: string | undefined;
|
|
393
452
|
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
394
453
|
} | undefined;
|
|
395
|
-
select?:
|
|
396
|
-
|
|
397
|
-
|
|
454
|
+
select?: {
|
|
455
|
+
[x: string]: any;
|
|
456
|
+
on?: any;
|
|
457
|
+
} | undefined;
|
|
458
|
+
treeSelect?: {
|
|
459
|
+
[x: string]: any;
|
|
460
|
+
on?: any;
|
|
461
|
+
} | undefined;
|
|
462
|
+
datetime?: {
|
|
463
|
+
[x: string]: any;
|
|
464
|
+
on?: any;
|
|
465
|
+
} | undefined;
|
|
398
466
|
list?: {
|
|
399
467
|
on?: Record<string, any> | undefined;
|
|
400
468
|
label?: string | undefined;
|
|
@@ -436,7 +504,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
436
504
|
span: number;
|
|
437
505
|
}[][];
|
|
438
506
|
getDisabled: (item: CurdConfigColumn) => boolean | undefined;
|
|
439
|
-
initColumnForm: () => void
|
|
507
|
+
initColumnForm: () => Promise<void>;
|
|
440
508
|
init: () => Promise<void>;
|
|
441
509
|
};
|
|
442
510
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -448,6 +516,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
448
516
|
form?: {
|
|
449
517
|
maxSpan?: number;
|
|
450
518
|
defaultSpan?: number;
|
|
519
|
+
openBefore?: (item: any, conf: any) => any;
|
|
520
|
+
openAfter?: (item: any, conf: any) => any;
|
|
451
521
|
};
|
|
452
522
|
column: CurdConfigColumn[];
|
|
453
523
|
};
|
|
@@ -464,6 +534,8 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
464
534
|
form?: {
|
|
465
535
|
maxSpan?: number;
|
|
466
536
|
defaultSpan?: number;
|
|
537
|
+
openBefore?: (item: any, conf: any) => any;
|
|
538
|
+
openAfter?: (item: any, conf: any) => any;
|
|
467
539
|
};
|
|
468
540
|
column: CurdConfigColumn[];
|
|
469
541
|
};
|
|
@@ -255,7 +255,13 @@ export interface CurdConfigColumn<T = any> {
|
|
|
255
255
|
/**
|
|
256
256
|
* 输入框选项
|
|
257
257
|
*/
|
|
258
|
-
input?:
|
|
258
|
+
input?: Partial<{
|
|
259
|
+
[key: string]: any;
|
|
260
|
+
/**
|
|
261
|
+
* 事件
|
|
262
|
+
*/
|
|
263
|
+
on: any;
|
|
264
|
+
}>;
|
|
259
265
|
/**
|
|
260
266
|
* 开关选项
|
|
261
267
|
*/
|
|
@@ -263,7 +269,7 @@ export interface CurdConfigColumn<T = any> {
|
|
|
263
269
|
/**
|
|
264
270
|
* 事件
|
|
265
271
|
*/
|
|
266
|
-
on
|
|
272
|
+
on: Record<string, any>;
|
|
267
273
|
/**
|
|
268
274
|
* 开启值 默认true
|
|
269
275
|
*/
|
|
@@ -288,15 +294,33 @@ export interface CurdConfigColumn<T = any> {
|
|
|
288
294
|
/**
|
|
289
295
|
* 选择组件属性
|
|
290
296
|
*/
|
|
291
|
-
select?:
|
|
297
|
+
select?: Partial<{
|
|
298
|
+
[key: string]: any;
|
|
299
|
+
/**
|
|
300
|
+
* 事件
|
|
301
|
+
*/
|
|
302
|
+
on: any;
|
|
303
|
+
}>;
|
|
292
304
|
/**
|
|
293
305
|
* 树选择组件属性
|
|
294
306
|
*/
|
|
295
|
-
treeSelect?:
|
|
307
|
+
treeSelect?: Partial<{
|
|
308
|
+
[key: string]: any;
|
|
309
|
+
/**
|
|
310
|
+
* 事件
|
|
311
|
+
*/
|
|
312
|
+
on: any;
|
|
313
|
+
}>;
|
|
296
314
|
/**
|
|
297
315
|
* 时间选择组件属性
|
|
298
316
|
*/
|
|
299
|
-
datetime?:
|
|
317
|
+
datetime?: Partial<{
|
|
318
|
+
[key: string]: any;
|
|
319
|
+
/**
|
|
320
|
+
* 事件
|
|
321
|
+
*/
|
|
322
|
+
on: any;
|
|
323
|
+
}>;
|
|
300
324
|
/**
|
|
301
325
|
* 列表组件属性
|
|
302
326
|
* @example
|