cc1-form 1.0.2 → 1.0.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 +539 -543
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/com/form/column.vue.d.ts +41 -29
- package/dist/components/TCurd/com/form/list.vue.d.ts +4 -4
- package/dist/components/TCurd/index.d.ts +14 -6
- package/dist/components/TCurd/index.vue.d.ts +70 -50
- 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=(d,i)=>typeof d=="function"?d(i):d;static getRouterParams=()=>{const d=this.router.currentRoute.value.query||{},i=this.router.currentRoute.value.params||{};return Object.keys(d).length?d:Object.keys(i).length?i:{}};static moduleObj={};static loadModule=async d=>{if(!b.moduleObj[d])throw new Error(`模块${d}未加载,请赋值如:TSys.moduleObj = { ${d}: ()=>import('${d}') }`);const i=await b.moduleObj[d]();return i.default??i};static tipMessages={};static tipMessagesGap=500;static showMessage(d,i,s={}){const m=Date.now();if(!this.tipMessages[d]||m-this.tipMessages[d]>this.tipMessagesGap){this.tipMessages[d]=m;const u=Object.assign({message:d,type:i},s);p.ElMessage(u),setTimeout(()=>{delete this.tipMessages[d]},this.tipMessagesGap)}}static fail=(d,i={})=>{this.showMessage(d,"error",i)};static success=(d,i={})=>{this.showMessage(d,"success",i)};static loadingObj=null;static loadingTimer=null;static loading=(d=!0,i="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{d?this.loadingObj=p.ElLoading.service({lock:!0,text:i,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(d,i=!0)=>{if(i){let s=screen.width/2-500,m=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="+m+", 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(i,s)=>{let m=document.getElementById(d.id);const u=await b.loadModule("html2canvas");try{u(m,{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(r){let t=r.toDataURL("image/png");i(t)})}catch(r){s(r)}});static async download(d,i="download.png"){const s=document.createElement("a");s.style.display="none",s.href=d,s.setAttribute("download",i),typeof s.download>"u"&&s.setAttribute("target","_blank"),document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(d)}}class V{static customComponent={};static findOptions=(d,i)=>{const s=d.column.find(u=>u.key===i),m=u=>u.replace(/-([a-z])/g,(r,t)=>t.toUpperCase());if(s)return s.options[m(s.type)]};static setOptionsData=(d,i,s)=>{const m=V.findOptions(d,i);m&&(m.data=s)};static form={openBefore:{parentId:(d,i,s,m)=>{d?i.type===b.EDialog.Insert?(i.form.parentId=d._id,i.form.sort=d.children.length+1):i.form.parentId=d.parentId.substring(d.parentId.lastIndexOf(",")+1):(i.form.parentId="0",i.form.sort=s.length+1),V.setOptionsData(m,"parentId",[{_id:"0",title:"根",children:s}])}}}}const F={class:"row curd-row"},N=e.defineComponent({__name:"column",props:{option:{default:{}}},setup(f,{expose:d}){const i=b.isFun,s=b.EDialog,m=e.ref(),u=f,r=e.reactive({rules:{},show:!1,showContent:!1,loading:!1,type:s.Insert,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[r.type===s.Insert?"create":"update"],initColumnForm:()=>{const t=u.option;r.formColumn=[];const n=[],a=u.option.form?.maxSpan||12,c=u.option.form?.defaultSpan||a;let o=[];const l=h=>{if(r.formDefault[h.key]=h.value,h.isForm){h.form=h.form||{span:c},h.form.span=h.form.span??c;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)&&(n.push(o),o=[]),h.rules&&(r.rules[h.key]=h.rules)}};t.column.forEach(h=>{h.isForm=!0,l(h)}),o.length>0&&n.push(o),r.formColumn=n}});return r.initColumnForm(),d({ref:m,conf:r}),(t,n)=>{const a=e.resolveComponent("FormList");return e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:m,model:r.form,rules:r.rules},{default:e.withCtx(()=>[r.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.formColumn,c=>(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"form-start",{row:r.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(i)(o.item.show?.form,r.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(o.item.form.span>0?`col-${o.item.form.span}`:"col")},[e.createVNode(e.unref(p.ElFormItem),{label:o.item.label,prop:o.item.key,"label-width":o.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+o.item.key+"-start",{row:r.form,item:o.item}),e.renderSlot(t.$slots,"form-"+o.item.key,{row:r.form,item:o.item},()=>[o.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:r.form[o.item.key],"onUpdate:modelValue":l=>r.form[o.item.key]=l},{ref_for:!0},o.item.options?.input,e.toHandlers(o.item.options?.input?.on),{disabled:r.getDisabled(o.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):o.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:1,modelValue:r.form[o.item.key],"onUpdate:modelValue":l=>r.form[o.item.key]=l},{ref_for:!0},o.item.options?.switch,{disabled:r.getDisabled(o.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):o.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(p.ElSelect),e.mergeProps({key:2,modelValue:r.form[o.item.key],"onUpdate:modelValue":l=>r.form[o.item.key]=l},{ref_for:!0},o.item.options?.select,{disabled:r.getDisabled(o.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.options?.select?.data,l=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):o.item.type==="list"?(e.openBlock(),e.createBlock(a,e.mergeProps({key:3,row:r.form,field:o.item.key},{ref_for:!0},o.item.options?.list,{disabled:r.getDisabled(o.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):o.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(p.ElTreeSelect),e.mergeProps({key:4,modelValue:r.form[o.item.key],"onUpdate:modelValue":l=>r.form[o.item.key]=l},{ref_for:!0},o.item.options?.treeSelect,{disabled:r.getDisabled(o.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):o.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(p.ElDatePicker),e.mergeProps({key:5,modelValue:r.form[o.item.key],"onUpdate:modelValue":l=>r.form[o.item.key]=l},{ref_for:!0},o.item.options?.datetime,{disabled:r.getDisabled(o.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(V).customComponent[o.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(V).customComponent[o.item.type]),e.mergeProps({key:6,modelValue:r.form[o.item.key],"onUpdate:modelValue":l=>r.form[o.item.key]=l},{ref_for:!0},o.item.options?.[o.item.type],{disabled:r.getDisabled(o.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+o.item.key+"-end",{row:r.form,item:o.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 C{static getIdFun=()=>StrUtil.uuid();static setId=(d,i,s)=>{i[d]||(i[d]=[]),i[d].forEach(m=>{s.forEach(u=>{let r=u.default??"";u.type==="number"&&(r=u.default??0),u.type==="boolean"&&(r=u.default??!1),u.type==="time"&&(r=u.default??new Date),m[u.value]===void 0&&(m[u.value]=r)}),m._id||(m._id=C.getIdFun())})};static add=(d,i,s,m)=>{const u=JSONUtil.cp(s);C.setId(d,i,s),i[d].push(u.reduce((r,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),r[t.value]=n,r},{_id:C.getIdFun()})),m?.(i)};static remove=(d,i,s,m)=>{i[d]=i[d].filter(u=>u._id!==s._id),m?.(i)};static getNoIdData=(d,i)=>{const s=JSONUtil.cp(d);return s.forEach(m=>{m._id&&delete m._id,i&&m[i]&&C.getNoIdData(m[i],i)}),s}}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(f,{emit:d}){const i=f,s=e.reactive({show:!1,add:(u,r,t)=>{C.add(u,r,t,()=>{m("change")})},remove:(u,r,t)=>{C.remove(u,r,t,()=>{m("change")})}});e.onMounted(()=>{C.setId(i.field,i.row,i.itemFields),s.show=!0});const m=d;return(u,r)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return s.show?(e.openBlock(),e.createElementBlock("div",$,[e.renderSlot(u.$slots,"list-start",{row:f.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:r[0]||(r[0]=a=>s.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",T,[e.renderSlot(u.$slots,"item-start",{item:a,row:f.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.itemFields,c=>(e.openBlock(),e.createBlock(n,{modelValue:a[c.value],"onUpdate:modelValue":o=>a[c.value]=o,style:e.normalizeStyle({width:f.inputWidth}),class:e.normalizeClass(f.inputClass),placeholder:c[f.label]||c[f.value],onChange:r[1]||(r[1]=o=>m("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(u.$slots,"item-end",{item:a,row:f.row}),e.createVNode(t,{link:"",type:"danger",onClick:c=>s.remove(f.field,f.row,a)},{default:e.withCtx(()=>[...r[3]||(r[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(u.$slots,"list-end",{row:f.row})])):e.createCommentVNode("",!0)}}});class S{static exportToExcel=async(d,i,s)=>{const m=await b.loadModule("xlsx"),u=d.map(n=>{const a={};return i.forEach(c=>{a[c.label]=n[c.key]}),a}),r=m.utils.json_to_sheet(u),t=m.utils.book_new();m.utils.book_append_sheet(t,r,"Sheet1"),s?typeof s=="function"&&(s=s()):s=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,m.writeFile(t,`${s}.xlsx`)}}const O={class:"dialog-footer"},I=e.defineComponent({__name:"switchConfirm",setup(f,{expose:d}){const i=e.ref(!1),s=e.ref("确认修改"),m=e.ref("确认要修改状态吗?");let u=null,r=null;const t=c=>(c?.title&&(s.value=c.title),c?.content&&(m.value=c.content),i.value=!0,new Promise((o,l)=>{u=o,r=l})),n=()=>{i.value=!1,u?.(!0),u=null,r=null},a=()=>{i.value=!1,r?.(new Error("用户取消操作")),u=null,r=null};return d({open:t}),(c,o)=>(e.openBlock(),e.createBlock(e.unref(p.ElDialog),{modelValue:i.value,"onUpdate:modelValue":o[0]||(o[0]=l=>i.value=l),title:s.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:n},{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"}},W={key:0},A={key:1},J={key:2},K={class:"export-btn"},H={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:d}){const i=b.EDialog,s=f,m=e.ref(),u=e.ref(),r=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getFormData:()=>{let n={};s.option.column.forEach(c=>{(typeof c.show?.search=="function"?c.show?.search(t.search.form):c.show?.search)&&(n[c.key]=t.search.form[c.key])});const a=s.option.search?.before?.(n);return a&&(n=a),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(a=>{s.option.search?.resetMode==="default"?n[a]=t.search.formDefault[a]:n[a]=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,a)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=a=>{let c=[];return a.forEach(o=>{c.push(o._id),o.children&&o.children.length>0&&(c=c.concat(n(o.children)))}),c};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,a=await n({size:t.page.size,num:t.page.num,...t.search.getFormData(),final(l,h,w){t.table.loading=!1}}),c=a.data||{list:a};let o=Array.isArray(c.list)?c.list:c;t.table.data=s.option.data?await s.option.data(o):o,t.page.total=c.total||0},selection:{list:[],change:n=>{t.table.selection.list=n}},exportFun:{start:async n=>{let a=await t.table.exportFun[n](),c=s.option.column;const o=JSONUtil.cp({data:a,columns:c}),l=s.option.tools?.export||{};l.before&&l.before(o),S.exportToExcel(o.data,o.columns,l.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,{data:a}=await n({size:999999,num:1,final(c,o,l){t.table.loading=!1}});return a.list}},export:n=>{t.table.exportFun.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:i.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===i.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(s.option.form?.editAll)return n;let a={_id:t.update.edit.data._id};return Object.keys(t.update.edit.data).forEach(c=>{n[c]!==t.update.edit.data[c]&&(a[c]=n[c])}),a}},open:(n,a)=>{t.update.showContent||FunUtil.throttle(async()=>{t.update.type=n;const c=n===i.Insert;t.update.edit.data=a,t.update.title=c?"新增":"编辑",t.update.form=JSONUtil.cp(c?t.update.formDefault:a),await s.option.form?.openBefore?.(a,t.update),t.update.show=!0,t.update.showContent=!0,s.option.form?.openAfter?.(a,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await u.value?.validate(async(c,o)=>new Promise((l,h)=>{c||(b.fail("请检查表单数据"),h(!1)),l()})),t.update.loading=!0;const n=t.update.type===i.Insert?s.option.api.create:s.option.api.update;let a=JSONUtil.cp(t.update.form);delete a.children,await s.option.form?.submitBefore?.(a,t.update),Object.keys(a).forEach(c=>{if(typeof a[c]=="string"&&a[c].indexOf("T")>-1){const o=new Date(a[c]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(a[c]=o)}}),await n({...a,final(c,o,l){t.update.loading=!1}}),t.update.close(),await t.table.getList(),s.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:n=>{if(n.length===0){b.fail("请选择要删除的数据");return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.table.loading=!0;const n=s.option.api.delete;await n({_id:t.remove.items.map(a=>a._id),final(a,c,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}},c=s.option;Object.keys(a).forEach(o=>{c[o]=ObjectUtil.deepMerge(a[o],c[o]||{})})},initColumnOptions:()=>{const n=s.option,a=c=>{const l={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(w,k)=>{const g=c.options?.switch;try{return await m.value?.open({title:"确认修改",content:`确认要${k[w]===g.activeValue?g.inactiveLabel:g.activeLabel}吗?`}),t.table.loading=!0,await s.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=c;Object.keys(l).forEach(w=>{h[w]=ObjectUtil.deepMerge(l[w],h[w]||{})})};n.column.forEach(a),n.table?.column?.forEach(a)},initColumnForm:()=>{const n=s.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const a=[],c=s.option.form?.maxSpan||12,o=s.option.form?.defaultSpan||c/2;let l=[];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=l.reduce((U,te)=>U+te.span,g);const E=l.length;l.push({item:k,span:g}),(E===1&&l[0].span===0||B>=c||g===0&&E>1)&&(a.push(l),l=[]),k.rules&&(t.update.rules[k.key]=k.rules)}};n.column.forEach(k=>{k.isForm=!0,h(k)}),s.option.table?.column?.forEach(k=>{k.isForm=!1,h(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,g)=>k.sort?.search-g.sort?.search),t.table.column.list.sort((k,g)=>k.sort?.table-g.sort?.table),l.length>0&&a.push(l),t.update.formColumn=a;const w=s.option.search?.formDefault;w&&Object.keys(w).forEach(k=>{t.search.formDefault[k]=w[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,a)=>{const c=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("div",j,[e.renderSlot(n.$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(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:o.label},{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":l=>t.search.form[o.key]=l,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":l=>t.search.form[o.key]=l,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":l=>t.search.form[o.key]=l,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,l=>(e.openBlock(),e.createBlock(e.unref(p.ElOption),{key:l.value,label:l.label,value:l.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(n.$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(n.$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",W,[e.createVNode(e.unref(p.ElButton),{type:"primary",onClick:a[0]||(a[0]=o=>t.update.open(e.unref(i).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",A,[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",J,[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",K,[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(n.$slots,"tools-left")]),e.createElementVNode("div",H,[e.renderSlot(n.$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:l})=>[e.renderSlot(n.$slots,"table-"+o.key,{row:l,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(p.ElSwitch),e.mergeProps({key:0,modelValue:l[o.key],"onUpdate:modelValue":h=>l[o.key]=h,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,l)},{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(l[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)||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(r)(f.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(p.ElButton),{key:0,link:"",type:"primary",onClick:l=>t.update.open(e.unref(i).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:l=>t.update.open(e.unref(i).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:l=>t.remove.open([o])},{default:e.withCtx(()=>[...a[18]||(a[18]=[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"])),[[c,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(n.$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:u,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(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(r)(l.item.show?.form,t.update.form)?(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.createElementVNode("div",Y,[e.renderSlot(n.$slots,"form-"+l.item.key+"-start",{row:t.update.form,item:l.item}),e.createElementVNode("div",Z,[e.renderSlot(n.$slots,"form-"+l.item.key,{row:t.update.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(p.ElInput),e.mergeProps({key:0,modelValue:t.update.form[l.item.key],"onUpdate:modelValue":h=>t.update.form[l.item.key]=h},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:t.update.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:t.update.form[l.item.key],"onUpdate:modelValue":h=>t.update.form[l.item.key]=h},{ref_for:!0},l.item.options?.switch,{disabled:t.update.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:t.update.form[l.item.key],"onUpdate:modelValue":h=>t.update.form[l.item.key]=h},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:t.update.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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"])):l.item.type==="list"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,row:t.update.form,field:l.item.key},{ref_for:!0},l.item.options?.list,{disabled:t.update.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:t.update.form[l.item.key],"onUpdate:modelValue":h=>t.update.form[l.item.key]=h},{ref_for:!0},l.item.options?.treeSelect,{disabled:t.update.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:t.update.form[l.item.key],"onUpdate:modelValue":h=>t.update.form[l.item.key]=h},{ref_for:!0},l.item.options?.datetime,{disabled:t.update.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:t.update.form[l.item.key],"onUpdate:modelValue":h=>t.update.form[l.item.key]=h},{ref_for:!0},l.item.options?.[l.item.type],{disabled:t.update.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+l.item.key+"-end",{row:t.update.form,item:l.item})])]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$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,d)=>{if(f.component("TCurd",D),f.component("TFormList",x),f.component("TColumn",N),d?.customComponent){V.customComponent=d.customComponent;for(const i in d.customComponent)f.component(i,d.customComponent[i])}};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 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(s){let t=s.toDataURL("image/png");d(t)})}catch(s){i(s)}});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,(s,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 s=h.default??"";h.type==="number"&&(s=h.default??0),h.type==="boolean"&&(s=h.default??!1),h.type==="time"&&(s=h.default??new Date),m[h.value]===void 0&&(m[h.value]=s)}),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((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()})),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,s,t)=>{C.add(h,s,t,()=>{m("change")})},remove:(h,s,t)=>{C.remove(h,s,t,()=>{m("change")})}});e.onMounted(()=>{C.setId(d.field,d.row,d.itemFields),i.show=!0});const m=c;return(h,s)=>{const t=e.resolveComponent("el-button"),r=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:s[0]||(s[0]=a=>i.add(f.field,f.row,f.itemFields))},{default:e.withCtx(()=>[...s[2]||(s[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(r,{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:s[1]||(s[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(()=>[...s[3]||(s[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:{}}},setup(f,{expose:c}){const d=b.isFun,i=b.EDialog,m=e.ref(),h=f,s=e.reactive({rules:{},show:!1,showContent:!1,loading:!1,type:i.Insert,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[s.type===i.Insert?"create":"update"],initColumnForm:()=>{const t=h.option;s.formColumn=[];const r=[],a=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||a;let o=[];const n=u=>{if(s.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)&&(r.push(o),o=[]),u.rules&&(s.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,n(u)}),o.length>0&&r.push(o),s.formColumn=r}});return s.initColumnForm(),c({ref:m,conf:s}),(t,r)=>(e.openBlock(),e.createBlock(e.unref(p.ElForm),{ref_key:"ruleFormRef",ref:m,model:s.form,rules:s.rules},{default:e.withCtx(()=>[s.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(s.formColumn,a=>(e.openBlock(),e.createElementBlock("div",T,[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)?(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 m=await b.loadModule("xlsx"),h=c.map(r=>{const a={};return d.forEach(l=>{a[l.label]=r[l.key]}),a}),s=m.utils.json_to_sheet(h),t=m.utils.book_new();m.utils.book_append_sheet(t,s,"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,s=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,s=n})),r=()=>{d.value=!1,h?.(!0),h=null,s=null},a=()=>{d.value=!1,s?.(new Error("用户取消操作")),h=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(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(),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,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: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 h.value?.validate(async(l,o)=>new Promise((n,u)=>{l||(b.fail("请检查表单数据"),u(!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 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]||{})})};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 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)}};r.column.forEach(k=>{k.isForm=!0,u(k)}),i.option.table?.column?.forEach(k=>{k.isForm=!1,u(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,[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(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(()=>[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(r.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",R,[e.createElementVNode("div",_,[e.unref(s)(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(s)(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(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},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(s)(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(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":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(s)(f.option.tools?.add)||e.unref(s)(f.option.tools?.update)||e.unref(s)(f.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)(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(s)(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(s)(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(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},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(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":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(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: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,4 +1,5 @@
|
|
|
1
1
|
import TForm from '../../../../utils/TForm';
|
|
2
|
+
import FormList from './list.vue';
|
|
2
3
|
import { type FormInstance, ElDatePicker, ElForm, ElFormItem, ElInput, ElOption, ElSelect, ElSwitch, ElTreeSelect } from 'element-plus';
|
|
3
4
|
import { type CurdConfigColumn } from '../../index';
|
|
4
5
|
declare const isFun: (fun: any, data?: any) => any;
|
|
@@ -25,16 +26,18 @@ declare const conf: {
|
|
|
25
26
|
[x: string]: any;
|
|
26
27
|
input?: Record<string, any> | undefined;
|
|
27
28
|
switch?: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
on?: Record<string, any> | undefined;
|
|
30
|
+
activeValue?: any;
|
|
31
|
+
activeLabel?: string | undefined;
|
|
32
|
+
inactiveValue?: any;
|
|
33
|
+
inactiveLabel?: string | undefined;
|
|
34
|
+
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
33
35
|
} | undefined;
|
|
34
36
|
select?: Record<string, any> | undefined;
|
|
35
37
|
treeSelect?: Record<string, any> | undefined;
|
|
36
38
|
datetime?: Record<string, any> | undefined;
|
|
37
39
|
list?: {
|
|
40
|
+
on?: Record<string, any> | undefined;
|
|
38
41
|
label?: string | undefined;
|
|
39
42
|
value?: string | undefined;
|
|
40
43
|
itemFields?: ({
|
|
@@ -94,16 +97,18 @@ declare var __VLS_7: {
|
|
|
94
97
|
[x: string]: any;
|
|
95
98
|
input?: Record<string, any> | undefined;
|
|
96
99
|
switch?: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
on?: Record<string, any> | undefined;
|
|
101
|
+
activeValue?: any;
|
|
102
|
+
activeLabel?: string | undefined;
|
|
103
|
+
inactiveValue?: any;
|
|
104
|
+
inactiveLabel?: string | undefined;
|
|
105
|
+
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
102
106
|
} | undefined;
|
|
103
107
|
select?: Record<string, any> | undefined;
|
|
104
108
|
treeSelect?: Record<string, any> | undefined;
|
|
105
109
|
datetime?: Record<string, any> | undefined;
|
|
106
110
|
list?: {
|
|
111
|
+
on?: Record<string, any> | undefined;
|
|
107
112
|
label?: string | undefined;
|
|
108
113
|
value?: string | undefined;
|
|
109
114
|
itemFields?: ({
|
|
@@ -155,16 +160,18 @@ declare var __VLS_7: {
|
|
|
155
160
|
[x: string]: any;
|
|
156
161
|
input?: Record<string, any> | undefined;
|
|
157
162
|
switch?: {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
on?: Record<string, any> | undefined;
|
|
164
|
+
activeValue?: any;
|
|
165
|
+
activeLabel?: string | undefined;
|
|
166
|
+
inactiveValue?: any;
|
|
167
|
+
inactiveLabel?: string | undefined;
|
|
168
|
+
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
163
169
|
} | undefined;
|
|
164
170
|
select?: Record<string, any> | undefined;
|
|
165
171
|
treeSelect?: Record<string, any> | undefined;
|
|
166
172
|
datetime?: Record<string, any> | undefined;
|
|
167
173
|
list?: {
|
|
174
|
+
on?: Record<string, any> | undefined;
|
|
168
175
|
label?: string | undefined;
|
|
169
176
|
value?: string | undefined;
|
|
170
177
|
itemFields?: ({
|
|
@@ -201,7 +208,7 @@ declare var __VLS_7: {
|
|
|
201
208
|
table?: number | undefined;
|
|
202
209
|
} | undefined;
|
|
203
210
|
};
|
|
204
|
-
},
|
|
211
|
+
}, __VLS_53: string, __VLS_54: {
|
|
205
212
|
row: any;
|
|
206
213
|
item: {
|
|
207
214
|
key: string;
|
|
@@ -216,16 +223,18 @@ declare var __VLS_7: {
|
|
|
216
223
|
[x: string]: any;
|
|
217
224
|
input?: Record<string, any> | undefined;
|
|
218
225
|
switch?: {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
on?: Record<string, any> | undefined;
|
|
227
|
+
activeValue?: any;
|
|
228
|
+
activeLabel?: string | undefined;
|
|
229
|
+
inactiveValue?: any;
|
|
230
|
+
inactiveLabel?: string | undefined;
|
|
231
|
+
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
224
232
|
} | undefined;
|
|
225
233
|
select?: Record<string, any> | undefined;
|
|
226
234
|
treeSelect?: Record<string, any> | undefined;
|
|
227
235
|
datetime?: Record<string, any> | undefined;
|
|
228
236
|
list?: {
|
|
237
|
+
on?: Record<string, any> | undefined;
|
|
229
238
|
label?: string | undefined;
|
|
230
239
|
value?: string | undefined;
|
|
231
240
|
itemFields?: ({
|
|
@@ -262,7 +271,7 @@ declare var __VLS_7: {
|
|
|
262
271
|
table?: number | undefined;
|
|
263
272
|
} | undefined;
|
|
264
273
|
};
|
|
265
|
-
},
|
|
274
|
+
}, __VLS_56: {
|
|
266
275
|
row: any;
|
|
267
276
|
};
|
|
268
277
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
@@ -270,11 +279,11 @@ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$
|
|
|
270
279
|
} & {
|
|
271
280
|
[K in NonNullable<typeof __VLS_18>]?: (props: typeof __VLS_19) => any;
|
|
272
281
|
} & {
|
|
273
|
-
[K in NonNullable<typeof
|
|
282
|
+
[K in NonNullable<typeof __VLS_53>]?: (props: typeof __VLS_54) => any;
|
|
274
283
|
} & {
|
|
275
284
|
'form-start'?: (props: typeof __VLS_7) => any;
|
|
276
285
|
} & {
|
|
277
|
-
'form-end'?: (props: typeof
|
|
286
|
+
'form-end'?: (props: typeof __VLS_56) => any;
|
|
278
287
|
}>;
|
|
279
288
|
declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
280
289
|
/**
|
|
@@ -291,6 +300,7 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
291
300
|
};
|
|
292
301
|
}>, {
|
|
293
302
|
TForm: typeof TForm;
|
|
303
|
+
FormList: typeof FormList;
|
|
294
304
|
ElDatePicker: typeof ElDatePicker;
|
|
295
305
|
ElForm: typeof ElForm;
|
|
296
306
|
ElFormItem: typeof ElFormItem;
|
|
@@ -361,16 +371,18 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
361
371
|
[x: string]: any;
|
|
362
372
|
input?: Record<string, any> | undefined;
|
|
363
373
|
switch?: {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
374
|
+
on?: Record<string, any> | undefined;
|
|
375
|
+
activeValue?: any;
|
|
376
|
+
activeLabel?: string | undefined;
|
|
377
|
+
inactiveValue?: any;
|
|
378
|
+
inactiveLabel?: string | undefined;
|
|
379
|
+
tableBeforeChange?: ((key: string, data: any) => any) | undefined;
|
|
369
380
|
} | undefined;
|
|
370
381
|
select?: Record<string, any> | undefined;
|
|
371
382
|
treeSelect?: Record<string, any> | undefined;
|
|
372
383
|
datetime?: Record<string, any> | undefined;
|
|
373
384
|
list?: {
|
|
385
|
+
on?: Record<string, any> | undefined;
|
|
374
386
|
label?: string | undefined;
|
|
375
387
|
value?: string | undefined;
|
|
376
388
|
itemFields?: ({
|
|
@@ -79,11 +79,11 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
79
79
|
}>, {
|
|
80
80
|
label: string;
|
|
81
81
|
value: string;
|
|
82
|
+
row: any;
|
|
82
83
|
itemFields: any[];
|
|
84
|
+
field: string;
|
|
83
85
|
inputWidth: string;
|
|
84
86
|
inputClass: string;
|
|
85
|
-
row: any;
|
|
86
|
-
field: string;
|
|
87
87
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
88
88
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
89
89
|
row: {
|
|
@@ -136,11 +136,11 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
136
136
|
}>, {
|
|
137
137
|
label: string;
|
|
138
138
|
value: string;
|
|
139
|
+
row: any;
|
|
139
140
|
itemFields: any[];
|
|
141
|
+
field: string;
|
|
140
142
|
inputWidth: string;
|
|
141
143
|
inputClass: string;
|
|
142
|
-
row: any;
|
|
143
|
-
field: string;
|
|
144
144
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
145
145
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
146
146
|
export default _default;
|
|
@@ -259,28 +259,32 @@ export interface CurdConfigColumn<T = any> {
|
|
|
259
259
|
/**
|
|
260
260
|
* 开关选项
|
|
261
261
|
*/
|
|
262
|
-
switch?: {
|
|
262
|
+
switch?: Partial<{
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
* 事件
|
|
265
|
+
*/
|
|
266
|
+
on?: Record<string, any>;
|
|
267
|
+
/**
|
|
268
|
+
* 开启值 默认true
|
|
265
269
|
*/
|
|
266
270
|
activeValue: any;
|
|
267
271
|
/**
|
|
268
|
-
* 开启值标签
|
|
272
|
+
* 开启值标签 默认开启
|
|
269
273
|
*/
|
|
270
274
|
activeLabel: string;
|
|
271
275
|
/**
|
|
272
|
-
* 关闭值
|
|
276
|
+
* 关闭值 默认false
|
|
273
277
|
*/
|
|
274
278
|
inactiveValue: any;
|
|
275
279
|
/**
|
|
276
|
-
* 关闭值标签
|
|
280
|
+
* 关闭值标签 默认关闭
|
|
277
281
|
*/
|
|
278
282
|
inactiveLabel: string;
|
|
279
283
|
/**
|
|
280
284
|
* 表格直接操作切换前执行处理
|
|
281
285
|
*/
|
|
282
286
|
tableBeforeChange: (key: string, data: any) => any;
|
|
283
|
-
}
|
|
287
|
+
}>;
|
|
284
288
|
/**
|
|
285
289
|
* 选择组件属性
|
|
286
290
|
*/
|
|
@@ -303,6 +307,10 @@ export interface CurdConfigColumn<T = any> {
|
|
|
303
307
|
* 4. item-end: 列表项结束位置插槽,作用域参数:{ row, item }
|
|
304
308
|
*/
|
|
305
309
|
list?: Partial<{
|
|
310
|
+
/**
|
|
311
|
+
* 事件
|
|
312
|
+
*/
|
|
313
|
+
on: Record<string, any>;
|
|
306
314
|
/**
|
|
307
315
|
* 输入的名称字段,默认label,优先作为placeholder显示
|
|
308
316
|
*/
|