wtsk-comps 1.1.0
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/README.md +3 -0
- package/dist/wtsk-basic.cjs.js +1 -0
- package/dist/wtsk-basic.css +1 -0
- package/dist/wtsk-basic.es.js +669 -0
- package/dist/wtsk-basic.umd.js +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),V=require("element-plus"),x=Object.assign({name:"WtskBtn",inheritAttrs:!1},{__name:"WtskBtn",setup(r){const m=e.useAttrs(),k=e.ref(!1);function g(i,f){const a={};for(const v in i)v!==f&&(a[v]=i[v]);return a}async function p(){k.value=!0;try{await m.onClick?.()}finally{k.value=!1}}return(i,f)=>{const a=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(a,e.mergeProps(g(i.$attrs,"onClick"),{loading:k.value,onClick:p}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},16,["loading"])}}});var N=e.defineComponent({name:"Delete",__name:"delete",setup(r){return(m,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),E=N,P=e.defineComponent({name:"Edit",__name:"edit",setup(r){return(m,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),b=P,S=e.defineComponent({name:"Plus",__name:"plus",setup(r){return(m,k)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),_=S;const T={class:"wtsk-tree-box"},F={key:0,class:"wtsk-tree-box-title"},z={key:1,class:"wtsk-tree-box-filter wtsk-form"},H={style:{display:"flex","align-items":"center"},class:"wtsk-form"},$={class:"wtsk-tree-box-tree-custom"},M={style:{display:"flex","align-items":"center"},class:"wtsk-form"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},U=Object.assign({name:"WtskTree",inheritAttrs:!1},{__name:"WtskTree",props:{treeTitle:{type:String,default:""},treeHasFilter:{type:Boolean,default:!1},treeFilterType:{type:String,default:"default"},treeHasOperate:{type:Boolean,default:!1},treeCustomizeOperate:{type:Boolean,default:!1},treeAddParentText:{type:String,default:"新增一级"}},emits:["treeOperate"],setup(r,{expose:m,emit:k}){const g=e.useAttrs(),p=r,i=e.ref();let f=e.ref(""),a=e.ref("");const v=k;e.watch(f,o=>{i.value?.filter(o)});function u(o,l,s){const n=l.label?l.label:g.props?.label;if(!o)return!0;if(p.treeFilterType==="default")return l[n].includes(o);{let y=[];C(s,y,o,n);let B=!1;return y.forEach(w=>{B=B||w}),B}}function C(o,l,s,n){let y=o.data&&o.data[n]&&o.data[n].includes(s);y&&l.push(y),!y&&o.level!==1&&o.parent&&C(o.parent,l,s,n)}function d(o,l,s){p.treeCustomizeOperate||o==="delete"?v("treeOperate",o,l,s):a.value.trim()!==""?(document.documentElement.click(),v("treeOperate",o,l,s,a.value)):V.ElMessage.error("名称不能为空!")}return m({wtskTreeRef:i}),(o,l)=>{const s=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),y=e.resolveComponent("el-popover"),B=e.resolveComponent("el-popconfirm"),w=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",T,[r.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(r.treeTitle),1)):e.createCommentVNode("",!0),r.treeHasFilter||r.treeHasOperate?(e.openBlock(),e.createElementBlock("div",z,[r.treeHasFilter?(e.openBlock(),e.createBlock(s,{key:0,modelValue:e.unref(f),"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(f)?f.value=t:f=t),placeholder:"输入名称进行筛选……",clearable:""},null,8,["modelValue"])):e.createCommentVNode("",!0),r.treeCustomizeOperate?(e.openBlock(),e.createBlock(n,{key:2,type:"primary",onClick:l[4]||(l[4]=t=>d("addParent"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[r.treeHasOperate?(e.openBlock(),e.createBlock(y,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(a)?a.value="":a="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createVNode(s,{modelValue:e.unref(a),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(a)?a.value=t:a=t),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:l[3]||(l[3]=e.withModifiers(t=>d("addParent"),["stop"]))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("新增",-1)])]),_:1})])]),_:1})):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0),e.createVNode(w,e.mergeProps({ref_key:"wtskTreeRef",ref:i,class:"wtsk-tree wtsk-tree-box-tree"},{"node-key":"id","highlight-current":!0,"default-expand-all":!0,"expand-on-click-node":!1,"check-on-click-leaf":!1,...o.$attrs},{"filter-node-method":u}),e.createSlots({_:2},[r.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",$,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[r.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(_),onClick:e.withModifiers(h=>d("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(b),onClick:e.withModifiers(h=>d("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(y,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(_),onClick:l[5]||(l[5]=e.withModifiers(h=>e.isRef(a)?a.value="":a="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createVNode(s,{modelValue:e.unref(a),"onUpdate:modelValue":l[6]||(l[6]=h=>e.isRef(a)?a.value=h:a=h),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(h=>d("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(y,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(b),onClick:e.withModifiers(h=>e.isRef(a)?a.value=t.label:a=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(s,{modelValue:e.unref(a),"onUpdate:modelValue":l[7]||(l[7]=h=>e.isRef(a)?a.value=h:a=h),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(h=>d("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(B,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:h=>d("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(E),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),A=Object.assign({name:"WtskForm",inheritAttrs:!1},{__name:"WtskForm",props:e.mergeModels({formIsSearch:{type:Boolean,default:!1},formItems:{type:Array,default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:m}){const k=r,g=e.computed(()=>k.formItems.filter(u=>!u.hidden)),p=e.useModel(r,"modelValue"),i={input:V.ElInput,number:V.ElInputNumber,select:V.ElSelect,date:V.ElDatePicker,switch:V.ElSwitch,treeSelect:V.ElTreeSelect};function f(u,C){if(!u||typeof u!="object")return;const d=C.split(".");let o=u;for(const l of d){if(o===null)return;o=o[l]}return o}function a(u,C,d){if(!u||typeof u!="object")return;const o=C.split(".");let l=u;for(let s=0;s<o.length-1;s++){const n=o[s];(l[n]===null||typeof l[n]!="object")&&(l[n]={}),l=l[n]}l[o[o.length-1]]=d}const v=e.ref();return m({wtskFormRef:v}),(u,C)=>{const d=e.resolveComponent("el-radio"),o=e.resolveComponent("el-radio-group"),l=e.resolveComponent("el-checkbox"),s=e.resolveComponent("el-checkbox-group"),n=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-col"),B=e.resolveComponent("el-row"),w=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(w,e.mergeProps({ref_key:"wtskFormRef",ref:v,class:["wtsk-form",r.formIsSearch?"wtsk-form-search":""]},{"label-width":r.formIsSearch?"auto":"100px",...u.$attrs},{model:p.value}),{default:e.withCtx(()=>[r.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,t=>(e.openBlock(),e.createBlock(n,{key:t.prop,label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(u.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:p.value[t.prop],"onUpdate:modelValue":c=>p.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(d,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(s,{key:1,modelValue:p.value[t.prop],"onUpdate:modelValue":c=>p.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{"model-value":f(p.value,t.prop),"onUpdate:modelValue":c=>a(p.value,t.prop,c)}),null,16,["model-value","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"]))),128)),e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(u.$slots,"formSearchBtn")]),_:3})],64)):(e.openBlock(),e.createBlock(B,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,t=>(e.openBlock(),e.createBlock(y,{key:t.prop,span:t.span||24},{default:e.withCtx(()=>[e.createVNode(n,{label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(u.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:p.value[t.prop],"onUpdate:modelValue":c=>p.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(d,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(s,{key:1,modelValue:p.value[t.prop],"onUpdate:modelValue":c=>p.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{modelValue:p.value[t.prop],"onUpdate:modelValue":c=>p.value[t.prop]=c}),null,16,["modelValue","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:3}))]),_:3},16,["class","model"])}}}),R={key:0},D=Object.assign({name:"WtskTable",inheritAttrs:!1},{__name:"WtskTable",props:{tableData:{type:Array,default:()=>[]},tableHeight:{type:String,default:"550px"},tableColumns:{type:Array,default:()=>[]},tableHasPage:{type:Boolean,default:!0},tableTotal:{type:Number,default:0},tablePageNum:{type:Number,default:1},tablePageSize:{type:Number,default:10},tablePageProp:{type:Object,default:null}},emits:["tablePageChange"],setup(r,{expose:m,emit:k}){const g=r,p=e.ref(),i=e.ref({pageNum:g.tablePageNum,pageSize:g.tablePageSize});e.watch(()=>g.tablePageNum,()=>{i.value.pageNum=g.tablePageNum,i.value.pageSize=g.tablePageSize});const f=k;function a(u){i.value.pageNum=u,f("tablePageChange",{...i.value})}function v(u){i.value.pageSize=u,f("tablePageChange",{...i.value})}return m({wtskTableRef:p}),(u,C)=>{const d=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-table"),l=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,e.mergeProps({ref_key:"wtskTableRef",ref:p,class:"wtsk-table"},{"row-key":"id","default-expand-all":!0,...u.$attrs},{data:r.tableData,height:r.tableHasPage?r.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.tableColumns,s=>(e.openBlock(),e.createBlock(d,e.mergeProps({key:s.prop},{ref_for:!0},{align:"center","reserve-selection":!0,"show-overflow-tooltip":!0,...s}),e.createSlots({_:2},[s.slot?{name:"default",fn:e.withCtx(n=>[e.renderSlot(u.$slots,s.slot,e.mergeProps({ref_for:!0},n))]),key:"0"}:void 0,s.type==="operate"?{name:"default",fn:e.withCtx(n=>[e.renderSlot(u.$slots,"tableBtn",e.mergeProps({ref_for:!0},n))]),key:"1"}:void 0]),1040))),128))]),_:3},16,["data","height"]),r.tableHasPage?(e.openBlock(),e.createElementBlock("div",R,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...r.tablePageProp},{total:r.tableTotal,"current-page":i.value.pageNum,"page-size":i.value.pageSize,onSizeChange:v,onCurrentChange:a}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}}),L=[x,U,A,D],I={install(r){L.forEach(m=>{r.component(m.name,m)})}};module.exports=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.wtsk-form .el-input,.wtsk-form .el-select,.wtsk-form .el-date-editor,.wtsk-form .el-input-number{width:100%}.wtsk-form .el-form-item__label-wrap,.wtsk-form .el-form-item__label{font-weight:700}.wtsk-form .el-input__wrapper,.wtsk-form .el-select__wrapper,.wtsk-form .el-textarea__inner{background:#ffffff80;border:1px solid rgba(64,158,255,.3);box-shadow:none!important}.wtsk-form .el-input-group__append{box-shadow:none;border:1px solid rgba(64,158,255,.3);border-left:0}.wtsk-form .el-input-group__append .el-button{border:0}.wtsk-form .el-input-group__append .el-button .el-icon{color:#409eff}.wtsk-form.wtsk-form-search{display:flex;gap:20px}.wtsk-form.wtsk-form-search .el-input,.wtsk-form.wtsk-form-search .el-select,.wtsk-form.wtsk-form-search .el-date-editor,.wtsk-form.wtsk-form-search .el-input-number{width:200px}.wtsk-form.wtsk-form-search .el-input.el-date-editor--datetimerange,.wtsk-form.wtsk-form-search .el-select.el-date-editor--datetimerange,.wtsk-form.wtsk-form-search .el-date-editor.el-date-editor--datetimerange,.wtsk-form.wtsk-form-search .el-input-number.el-date-editor--datetimerange{width:initial}.wtsk-form.wtsk-form-search .el-form-item{margin:0}.el-table.wtsk-table{background:transparent}.el-table.wtsk-table .el-table__inner-wrapper:before{background-color:transparent!important}.el-table.wtsk-table tr{background:transparent!important}.el-table.wtsk-table tr.el-table__row--striped td{background:#ffffff70!important;border-top:1px solid #fff!important;border-bottom:1px solid #fff!important}.el-table.wtsk-table tr.current-row td{background:#409eff0f!important}.el-table.wtsk-table th{padding:0;height:50px;background-color:#409eff26!important;border:0!important;font-size:14px;color:#333}.el-table.wtsk-table th:nth-of-type(1){border-radius:4px 0 0 4px}.el-table.wtsk-table th:nth-last-of-type(1){border-radius:0 4px 4px 0}.el-table.wtsk-table td{padding:0;height:50px;background:transparent!important;border:0!important}.el-table.wtsk-table td .el-button.is-link{position:relative;padding:4px 5px;margin-left:0;color:#409eff;outline:0}.el-table.wtsk-table td .el-button.is-link:hover{text-decoration:underline}.el-table.wtsk-table.wtsk-table-small th,.el-table.wtsk-table.wtsk-table-small td{height:40px!important}.el-pagination.wtsk-pagination{justify-content:flex-end;margin-top:10px}.el-pagination.wtsk-pagination .btn-prev,.el-pagination.wtsk-pagination .btn-next,.el-pagination.wtsk-pagination .el-select__wrapper,.el-pagination.wtsk-pagination .el-pager li{background:#ffffff80!important;border:1px solid rgba(64,158,255,.5)!important;box-shadow:none!important}.el-pagination.wtsk-pagination .btn-prev.is-active,.el-pagination.wtsk-pagination .btn-next.is-active,.el-pagination.wtsk-pagination .el-select__wrapper.is-active,.el-pagination.wtsk-pagination .el-pager li.is-active{background-color:#409eff!important}.el-tree.wtsk-tree,.el-tree.wtsk-tree .el-tree-node .el-tree-node__content{background:transparent}.el-tree.wtsk-tree .el-tree-node.is-current>.el-tree-node__content{background:#409eff26!important;border-radius:4px}*{box-sizing:border-box;outline:none!important}*::selection{background-color:transparent;color:#409eff}html,body,#app{position:relative;margin:0;padding:0;width:100%;height:100%;overflow:hidden}a{color:initial;text-decoration:none}a:hover{color:#409eff}::-webkit-scrollbar{width:6px;height:8px;border:0!important}::-webkit-scrollbar-corner{background:transparent;border-radius:0}::-webkit-scrollbar-thumb{background-color:#409eff1a;border-radius:8px}.el-scrollbar__thumb{background-color:#409eff4d}.wtsk-tree-box{position:relative;width:100%;height:100%;display:flex;flex-direction:column}.wtsk-tree-box .wtsk-tree-box-title{line-height:40px;border-bottom:1px solid #eee;text-align:center;font-size:17px;color:#333}.wtsk-tree-box .wtsk-tree-box-filter{padding:5px;display:flex;align-items:center;justify-content:center;gap:10px}.wtsk-tree-box .wtsk-tree-box-tree{flex:1;overflow-x:hidden;overflow-y:auto}.wtsk-tree-box .wtsk-tree-box-tree .wtsk-tree-box-tree-custom{width:calc(100% - 24px);display:flex;align-items:center;justify-content:space-between}.wtsk-tree-box .wtsk-tree-box-tree .wtsk-tree-box-tree-custom>div:nth-of-type(1){width:calc(100% - 60px);overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.wtsk-tree-box .wtsk-tree-box-tree .wtsk-tree-box-tree-custom>div:nth-of-type(2){width:60px}.wtsk-tree-box .wtsk-tree-box-tree .wtsk-tree-box-tree-custom>div:nth-of-type(2) button{margin:0}
|
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import { useAttrs as L, ref as E, resolveComponent as y, openBlock as l, createBlock as k, mergeProps as S, withCtx as s, renderSlot as F, defineComponent as I, createElementBlock as f, createElementVNode as P, watch as j, toDisplayString as A, createCommentVNode as N, isRef as O, unref as z, Fragment as v, createVNode as m, withModifiers as H, createTextVNode as U, createSlots as q, computed as G, useModel as J, renderList as B, resolveDynamicComponent as W, mergeModels as Q } from "vue";
|
|
2
|
+
import { ElMessage as X, ElTreeSelect as Y, ElSwitch as Z, ElDatePicker as K, ElSelect as ee, ElInputNumber as te, ElInput as le } from "element-plus";
|
|
3
|
+
const ae = /* @__PURE__ */ Object.assign({
|
|
4
|
+
name: "WtskBtn",
|
|
5
|
+
inheritAttrs: !1
|
|
6
|
+
}, {
|
|
7
|
+
__name: "WtskBtn",
|
|
8
|
+
setup(o) {
|
|
9
|
+
const b = L(), h = E(!1);
|
|
10
|
+
function w(c, _) {
|
|
11
|
+
const r = {};
|
|
12
|
+
for (const V in c)
|
|
13
|
+
V !== _ && (r[V] = c[V]);
|
|
14
|
+
return r;
|
|
15
|
+
}
|
|
16
|
+
async function d() {
|
|
17
|
+
h.value = !0;
|
|
18
|
+
try {
|
|
19
|
+
await b.onClick?.();
|
|
20
|
+
} finally {
|
|
21
|
+
h.value = !1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return (c, _) => {
|
|
25
|
+
const r = y("el-button");
|
|
26
|
+
return l(), k(r, S(w(c.$attrs, "onClick"), {
|
|
27
|
+
loading: h.value,
|
|
28
|
+
onClick: d
|
|
29
|
+
}), {
|
|
30
|
+
default: s(() => [
|
|
31
|
+
F(c.$slots, "default")
|
|
32
|
+
]),
|
|
33
|
+
_: 3
|
|
34
|
+
}, 16, ["loading"]);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var oe = /* @__PURE__ */ I({
|
|
39
|
+
name: "Delete",
|
|
40
|
+
__name: "delete",
|
|
41
|
+
setup(o) {
|
|
42
|
+
return (b, h) => (l(), f("svg", {
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
viewBox: "0 0 1024 1024"
|
|
45
|
+
}, [
|
|
46
|
+
P("path", {
|
|
47
|
+
fill: "currentColor",
|
|
48
|
+
d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
|
|
49
|
+
})
|
|
50
|
+
]));
|
|
51
|
+
}
|
|
52
|
+
}), re = oe, ne = /* @__PURE__ */ I({
|
|
53
|
+
name: "Edit",
|
|
54
|
+
__name: "edit",
|
|
55
|
+
setup(o) {
|
|
56
|
+
return (b, h) => (l(), f("svg", {
|
|
57
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
58
|
+
viewBox: "0 0 1024 1024"
|
|
59
|
+
}, [
|
|
60
|
+
P("path", {
|
|
61
|
+
fill: "currentColor",
|
|
62
|
+
d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"
|
|
63
|
+
}),
|
|
64
|
+
P("path", {
|
|
65
|
+
fill: "currentColor",
|
|
66
|
+
d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
|
|
67
|
+
})
|
|
68
|
+
]));
|
|
69
|
+
}
|
|
70
|
+
}), R = ne, ue = /* @__PURE__ */ I({
|
|
71
|
+
name: "Plus",
|
|
72
|
+
__name: "plus",
|
|
73
|
+
setup(o) {
|
|
74
|
+
return (b, h) => (l(), f("svg", {
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
viewBox: "0 0 1024 1024"
|
|
77
|
+
}, [
|
|
78
|
+
P("path", {
|
|
79
|
+
fill: "currentColor",
|
|
80
|
+
d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
|
|
81
|
+
})
|
|
82
|
+
]));
|
|
83
|
+
}
|
|
84
|
+
}), D = ue;
|
|
85
|
+
const se = { class: "wtsk-tree-box" }, pe = {
|
|
86
|
+
key: 0,
|
|
87
|
+
class: "wtsk-tree-box-title"
|
|
88
|
+
}, ie = {
|
|
89
|
+
key: 1,
|
|
90
|
+
class: "wtsk-tree-box-filter wtsk-form"
|
|
91
|
+
}, de = {
|
|
92
|
+
style: { display: "flex", "align-items": "center" },
|
|
93
|
+
class: "wtsk-form"
|
|
94
|
+
}, ce = { class: "wtsk-tree-box-tree-custom" }, fe = {
|
|
95
|
+
style: { display: "flex", "align-items": "center" },
|
|
96
|
+
class: "wtsk-form"
|
|
97
|
+
}, me = {
|
|
98
|
+
style: { display: "flex", "align-items": "center" },
|
|
99
|
+
class: "wtsk-form"
|
|
100
|
+
}, ke = /* @__PURE__ */ Object.assign({
|
|
101
|
+
name: "WtskTree",
|
|
102
|
+
inheritAttrs: !1
|
|
103
|
+
}, {
|
|
104
|
+
__name: "WtskTree",
|
|
105
|
+
props: {
|
|
106
|
+
// 树标题
|
|
107
|
+
treeTitle: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: ""
|
|
110
|
+
},
|
|
111
|
+
// 是否有筛选框
|
|
112
|
+
treeHasFilter: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: !1
|
|
115
|
+
},
|
|
116
|
+
// 筛选类型(default:默认,只展示筛选节点,detail:详细,展示筛选节点及子节点)
|
|
117
|
+
treeFilterType: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: "default"
|
|
120
|
+
},
|
|
121
|
+
// 是否有操作按钮
|
|
122
|
+
treeHasOperate: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: !1
|
|
125
|
+
},
|
|
126
|
+
// 操作是否自定义
|
|
127
|
+
treeCustomizeOperate: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: !1
|
|
130
|
+
},
|
|
131
|
+
// 树顶部按钮文本
|
|
132
|
+
treeAddParentText: {
|
|
133
|
+
type: String,
|
|
134
|
+
default: "新增一级"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
emits: ["treeOperate"],
|
|
138
|
+
setup(o, { expose: b, emit: h }) {
|
|
139
|
+
const w = L(), d = o, c = E();
|
|
140
|
+
let _ = E(""), r = E("");
|
|
141
|
+
const V = h;
|
|
142
|
+
j(_, (a) => {
|
|
143
|
+
c.value?.filter(a);
|
|
144
|
+
});
|
|
145
|
+
function i(a, t, p) {
|
|
146
|
+
const n = t.label ? t.label : w.props?.label;
|
|
147
|
+
if (!a) return !0;
|
|
148
|
+
if (d.treeFilterType === "default") return t[n].includes(a);
|
|
149
|
+
{
|
|
150
|
+
let C = [];
|
|
151
|
+
T(p, C, a, n);
|
|
152
|
+
let $ = !1;
|
|
153
|
+
return C.forEach((M) => {
|
|
154
|
+
$ = $ || M;
|
|
155
|
+
}), $;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function T(a, t, p, n) {
|
|
159
|
+
let C = a.data && a.data[n] && a.data[n].includes(p);
|
|
160
|
+
C && t.push(C), !C && a.level !== 1 && a.parent && T(a.parent, t, p, n);
|
|
161
|
+
}
|
|
162
|
+
function g(a, t, p) {
|
|
163
|
+
d.treeCustomizeOperate || a === "delete" ? V("treeOperate", a, t, p) : r.value.trim() !== "" ? (document.documentElement.click(), V("treeOperate", a, t, p, r.value)) : X.error("名称不能为空!");
|
|
164
|
+
}
|
|
165
|
+
return b({ wtskTreeRef: c }), (a, t) => {
|
|
166
|
+
const p = y("el-input"), n = y("el-button"), C = y("el-popover"), $ = y("el-popconfirm"), M = y("el-tree");
|
|
167
|
+
return l(), f("div", se, [
|
|
168
|
+
o.treeTitle !== "" ? (l(), f("div", pe, A(o.treeTitle), 1)) : N("", !0),
|
|
169
|
+
o.treeHasFilter || o.treeHasOperate ? (l(), f("div", ie, [
|
|
170
|
+
o.treeHasFilter ? (l(), k(p, {
|
|
171
|
+
key: 0,
|
|
172
|
+
modelValue: z(_),
|
|
173
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => O(_) ? _.value = e : _ = e),
|
|
174
|
+
placeholder: "输入名称进行筛选……",
|
|
175
|
+
clearable: ""
|
|
176
|
+
}, null, 8, ["modelValue"])) : N("", !0),
|
|
177
|
+
o.treeCustomizeOperate ? (l(), k(n, {
|
|
178
|
+
key: 2,
|
|
179
|
+
type: "primary",
|
|
180
|
+
onClick: t[4] || (t[4] = (e) => g("addParent"))
|
|
181
|
+
}, {
|
|
182
|
+
default: s(() => [
|
|
183
|
+
U(A(o.treeAddParentText), 1)
|
|
184
|
+
]),
|
|
185
|
+
_: 1
|
|
186
|
+
})) : (l(), f(v, { key: 1 }, [
|
|
187
|
+
o.treeHasOperate ? (l(), k(C, {
|
|
188
|
+
key: 0,
|
|
189
|
+
placement: "bottom",
|
|
190
|
+
width: 280,
|
|
191
|
+
trigger: "click"
|
|
192
|
+
}, {
|
|
193
|
+
reference: s(() => [
|
|
194
|
+
m(n, {
|
|
195
|
+
type: "primary",
|
|
196
|
+
onClick: t[1] || (t[1] = (e) => O(r) ? r.value = "" : r = "")
|
|
197
|
+
}, {
|
|
198
|
+
default: s(() => [
|
|
199
|
+
U(A(o.treeAddParentText), 1)
|
|
200
|
+
]),
|
|
201
|
+
_: 1
|
|
202
|
+
})
|
|
203
|
+
]),
|
|
204
|
+
default: s(() => [
|
|
205
|
+
P("div", de, [
|
|
206
|
+
m(p, {
|
|
207
|
+
modelValue: z(r),
|
|
208
|
+
"onUpdate:modelValue": t[2] || (t[2] = (e) => O(r) ? r.value = e : r = e),
|
|
209
|
+
placeholder: "请输入名称",
|
|
210
|
+
clearable: ""
|
|
211
|
+
}, null, 8, ["modelValue"]),
|
|
212
|
+
m(n, {
|
|
213
|
+
type: "primary",
|
|
214
|
+
style: { "margin-left": "10px" },
|
|
215
|
+
onClick: t[3] || (t[3] = H((e) => g("addParent"), ["stop"]))
|
|
216
|
+
}, {
|
|
217
|
+
default: s(() => [...t[9] || (t[9] = [
|
|
218
|
+
U("新增", -1)
|
|
219
|
+
])]),
|
|
220
|
+
_: 1
|
|
221
|
+
})
|
|
222
|
+
])
|
|
223
|
+
]),
|
|
224
|
+
_: 1
|
|
225
|
+
})) : N("", !0)
|
|
226
|
+
], 64))
|
|
227
|
+
])) : N("", !0),
|
|
228
|
+
m(M, S({
|
|
229
|
+
ref_key: "wtskTreeRef",
|
|
230
|
+
ref: c,
|
|
231
|
+
class: "wtsk-tree wtsk-tree-box-tree"
|
|
232
|
+
}, {
|
|
233
|
+
"node-key": "id",
|
|
234
|
+
"highlight-current": !0,
|
|
235
|
+
"default-expand-all": !0,
|
|
236
|
+
"expand-on-click-node": !1,
|
|
237
|
+
"check-on-click-leaf": !1,
|
|
238
|
+
...a.$attrs
|
|
239
|
+
}, { "filter-node-method": i }), q({ _: 2 }, [
|
|
240
|
+
o.treeHasOperate ? {
|
|
241
|
+
name: "default",
|
|
242
|
+
fn: s(({ node: e, data: u }) => [
|
|
243
|
+
P("div", ce, [
|
|
244
|
+
P("div", null, A(e.label), 1),
|
|
245
|
+
P("div", null, [
|
|
246
|
+
o.treeCustomizeOperate ? (l(), f(v, { key: 0 }, [
|
|
247
|
+
m(n, {
|
|
248
|
+
type: "success",
|
|
249
|
+
link: "",
|
|
250
|
+
icon: z(D),
|
|
251
|
+
onClick: H((x) => g("add", u, e), ["stop"])
|
|
252
|
+
}, null, 8, ["icon", "onClick"]),
|
|
253
|
+
m(n, {
|
|
254
|
+
type: "primary",
|
|
255
|
+
link: "",
|
|
256
|
+
icon: z(R),
|
|
257
|
+
onClick: H((x) => g("edit", u, e), ["stop"])
|
|
258
|
+
}, null, 8, ["icon", "onClick"])
|
|
259
|
+
], 64)) : (l(), f(v, { key: 1 }, [
|
|
260
|
+
m(C, {
|
|
261
|
+
placement: "bottom",
|
|
262
|
+
width: 280,
|
|
263
|
+
trigger: "click"
|
|
264
|
+
}, {
|
|
265
|
+
reference: s(() => [
|
|
266
|
+
m(n, {
|
|
267
|
+
type: "success",
|
|
268
|
+
link: "",
|
|
269
|
+
icon: z(D),
|
|
270
|
+
onClick: t[5] || (t[5] = H((x) => O(r) ? r.value = "" : r = "", ["stop"]))
|
|
271
|
+
}, null, 8, ["icon"])
|
|
272
|
+
]),
|
|
273
|
+
default: s(() => [
|
|
274
|
+
P("div", fe, [
|
|
275
|
+
m(p, {
|
|
276
|
+
modelValue: z(r),
|
|
277
|
+
"onUpdate:modelValue": t[6] || (t[6] = (x) => O(r) ? r.value = x : r = x),
|
|
278
|
+
placeholder: "请输入名称",
|
|
279
|
+
clearable: ""
|
|
280
|
+
}, null, 8, ["modelValue"]),
|
|
281
|
+
m(n, {
|
|
282
|
+
type: "primary",
|
|
283
|
+
style: { "margin-left": "10px" },
|
|
284
|
+
onClick: H((x) => g("add", u, e), ["stop"])
|
|
285
|
+
}, {
|
|
286
|
+
default: s(() => [...t[10] || (t[10] = [
|
|
287
|
+
U("新增", -1)
|
|
288
|
+
])]),
|
|
289
|
+
_: 1
|
|
290
|
+
}, 8, ["onClick"])
|
|
291
|
+
])
|
|
292
|
+
]),
|
|
293
|
+
_: 2
|
|
294
|
+
}, 1024),
|
|
295
|
+
m(C, {
|
|
296
|
+
placement: "bottom",
|
|
297
|
+
width: 280,
|
|
298
|
+
trigger: "click"
|
|
299
|
+
}, {
|
|
300
|
+
reference: s(() => [
|
|
301
|
+
m(n, {
|
|
302
|
+
type: "primary",
|
|
303
|
+
link: "",
|
|
304
|
+
icon: z(R),
|
|
305
|
+
onClick: H((x) => O(r) ? r.value = e.label : r = e.label, ["stop"])
|
|
306
|
+
}, null, 8, ["icon", "onClick"])
|
|
307
|
+
]),
|
|
308
|
+
default: s(() => [
|
|
309
|
+
P("div", me, [
|
|
310
|
+
m(p, {
|
|
311
|
+
modelValue: z(r),
|
|
312
|
+
"onUpdate:modelValue": t[7] || (t[7] = (x) => O(r) ? r.value = x : r = x),
|
|
313
|
+
placeholder: "请输入名称",
|
|
314
|
+
clearable: ""
|
|
315
|
+
}, null, 8, ["modelValue"]),
|
|
316
|
+
m(n, {
|
|
317
|
+
type: "primary",
|
|
318
|
+
style: { "margin-left": "10px" },
|
|
319
|
+
onClick: H((x) => g("edit", u, e), ["stop"])
|
|
320
|
+
}, {
|
|
321
|
+
default: s(() => [...t[11] || (t[11] = [
|
|
322
|
+
U("修改", -1)
|
|
323
|
+
])]),
|
|
324
|
+
_: 1
|
|
325
|
+
}, 8, ["onClick"])
|
|
326
|
+
])
|
|
327
|
+
]),
|
|
328
|
+
_: 2
|
|
329
|
+
}, 1024)
|
|
330
|
+
], 64)),
|
|
331
|
+
m($, {
|
|
332
|
+
title: "确定删除这条数据吗?",
|
|
333
|
+
"hide-icon": "",
|
|
334
|
+
width: "170",
|
|
335
|
+
onConfirm: (x) => g("delete", u, e)
|
|
336
|
+
}, {
|
|
337
|
+
reference: s(() => [
|
|
338
|
+
m(n, {
|
|
339
|
+
type: "danger",
|
|
340
|
+
link: "",
|
|
341
|
+
icon: z(re),
|
|
342
|
+
onClick: t[8] || (t[8] = H(() => {
|
|
343
|
+
}, ["stop"]))
|
|
344
|
+
}, null, 8, ["icon"])
|
|
345
|
+
]),
|
|
346
|
+
_: 1
|
|
347
|
+
}, 8, ["onConfirm"])
|
|
348
|
+
])
|
|
349
|
+
])
|
|
350
|
+
]),
|
|
351
|
+
key: "0"
|
|
352
|
+
} : void 0
|
|
353
|
+
]), 1040)
|
|
354
|
+
]);
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
}), ye = /* @__PURE__ */ Object.assign({
|
|
358
|
+
name: "WtskForm",
|
|
359
|
+
inheritAttrs: !1
|
|
360
|
+
}, {
|
|
361
|
+
__name: "WtskForm",
|
|
362
|
+
props: /* @__PURE__ */ Q({
|
|
363
|
+
// 表单是否是搜索类型
|
|
364
|
+
formIsSearch: {
|
|
365
|
+
type: Boolean,
|
|
366
|
+
default: !1
|
|
367
|
+
},
|
|
368
|
+
// 表单配置项
|
|
369
|
+
formItems: {
|
|
370
|
+
type: Array,
|
|
371
|
+
default: () => []
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
modelValue: {},
|
|
375
|
+
modelModifiers: {}
|
|
376
|
+
}),
|
|
377
|
+
emits: ["update:modelValue"],
|
|
378
|
+
setup(o, { expose: b }) {
|
|
379
|
+
const h = o, w = G(() => h.formItems.filter((i) => !i.hidden)), d = J(o, "modelValue"), c = {
|
|
380
|
+
input: le,
|
|
381
|
+
number: te,
|
|
382
|
+
select: ee,
|
|
383
|
+
date: K,
|
|
384
|
+
switch: Z,
|
|
385
|
+
treeSelect: Y
|
|
386
|
+
};
|
|
387
|
+
function _(i, T) {
|
|
388
|
+
if (!i || typeof i != "object") return;
|
|
389
|
+
const g = T.split(".");
|
|
390
|
+
let a = i;
|
|
391
|
+
for (const t of g) {
|
|
392
|
+
if (a === null) return;
|
|
393
|
+
a = a[t];
|
|
394
|
+
}
|
|
395
|
+
return a;
|
|
396
|
+
}
|
|
397
|
+
function r(i, T, g) {
|
|
398
|
+
if (!i || typeof i != "object") return;
|
|
399
|
+
const a = T.split(".");
|
|
400
|
+
let t = i;
|
|
401
|
+
for (let p = 0; p < a.length - 1; p++) {
|
|
402
|
+
const n = a[p];
|
|
403
|
+
(t[n] === null || typeof t[n] != "object") && (t[n] = {}), t = t[n];
|
|
404
|
+
}
|
|
405
|
+
t[a[a.length - 1]] = g;
|
|
406
|
+
}
|
|
407
|
+
const V = E();
|
|
408
|
+
return b({ wtskFormRef: V }), (i, T) => {
|
|
409
|
+
const g = y("el-radio"), a = y("el-radio-group"), t = y("el-checkbox"), p = y("el-checkbox-group"), n = y("el-form-item"), C = y("el-col"), $ = y("el-row"), M = y("el-form");
|
|
410
|
+
return l(), k(M, S({
|
|
411
|
+
ref_key: "wtskFormRef",
|
|
412
|
+
ref: V,
|
|
413
|
+
class: ["wtsk-form", o.formIsSearch ? "wtsk-form-search" : ""]
|
|
414
|
+
}, { "label-width": o.formIsSearch ? "auto" : "100px", ...i.$attrs }, { model: d.value }), {
|
|
415
|
+
default: s(() => [
|
|
416
|
+
o.formIsSearch ? (l(), f(v, { key: 0 }, [
|
|
417
|
+
(l(!0), f(v, null, B(w.value, (e) => (l(), k(n, {
|
|
418
|
+
key: e.prop,
|
|
419
|
+
label: e.label,
|
|
420
|
+
prop: e.prop
|
|
421
|
+
}, {
|
|
422
|
+
default: s(() => [
|
|
423
|
+
F(i.$slots, e.prop, {}, () => [
|
|
424
|
+
e.type === "radio" || e.type === "checkbox" ? (l(), f(v, { key: 0 }, [
|
|
425
|
+
e.type === "radio" ? (l(), k(a, {
|
|
426
|
+
key: 0,
|
|
427
|
+
modelValue: d.value[e.prop],
|
|
428
|
+
"onUpdate:modelValue": (u) => d.value[e.prop] = u
|
|
429
|
+
}, {
|
|
430
|
+
default: s(() => [
|
|
431
|
+
(l(!0), f(v, null, B(e.data, (u) => (l(), k(g, {
|
|
432
|
+
value: u.value
|
|
433
|
+
}, {
|
|
434
|
+
default: s(() => [
|
|
435
|
+
U(A(u.label), 1)
|
|
436
|
+
]),
|
|
437
|
+
_: 2
|
|
438
|
+
}, 1032, ["value"]))), 256))
|
|
439
|
+
]),
|
|
440
|
+
_: 2
|
|
441
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : N("", !0),
|
|
442
|
+
e.type === "checkbox" ? (l(), k(p, {
|
|
443
|
+
key: 1,
|
|
444
|
+
modelValue: d.value[e.prop],
|
|
445
|
+
"onUpdate:modelValue": (u) => d.value[e.prop] = u
|
|
446
|
+
}, {
|
|
447
|
+
default: s(() => [
|
|
448
|
+
(l(!0), f(v, null, B(e.data, (u) => (l(), k(t, {
|
|
449
|
+
label: u.label,
|
|
450
|
+
value: u.value
|
|
451
|
+
}, null, 8, ["label", "value"]))), 256))
|
|
452
|
+
]),
|
|
453
|
+
_: 2
|
|
454
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : N("", !0)
|
|
455
|
+
], 64)) : (l(), k(W(c[e.type]), S({
|
|
456
|
+
key: 1,
|
|
457
|
+
ref_for: !0
|
|
458
|
+
}, e.props, {
|
|
459
|
+
"model-value": _(d.value, e.prop),
|
|
460
|
+
"onUpdate:modelValue": (u) => r(d.value, e.prop, u)
|
|
461
|
+
}), null, 16, ["model-value", "onUpdate:modelValue"]))
|
|
462
|
+
])
|
|
463
|
+
]),
|
|
464
|
+
_: 2
|
|
465
|
+
}, 1032, ["label", "prop"]))), 128)),
|
|
466
|
+
m(n, null, {
|
|
467
|
+
default: s(() => [
|
|
468
|
+
F(i.$slots, "formSearchBtn")
|
|
469
|
+
]),
|
|
470
|
+
_: 3
|
|
471
|
+
})
|
|
472
|
+
], 64)) : (l(), k($, {
|
|
473
|
+
key: 1,
|
|
474
|
+
gutter: 16
|
|
475
|
+
}, {
|
|
476
|
+
default: s(() => [
|
|
477
|
+
(l(!0), f(v, null, B(w.value, (e) => (l(), k(C, {
|
|
478
|
+
key: e.prop,
|
|
479
|
+
span: e.span || 24
|
|
480
|
+
}, {
|
|
481
|
+
default: s(() => [
|
|
482
|
+
m(n, {
|
|
483
|
+
label: e.label,
|
|
484
|
+
prop: e.prop
|
|
485
|
+
}, {
|
|
486
|
+
default: s(() => [
|
|
487
|
+
F(i.$slots, e.prop, {}, () => [
|
|
488
|
+
e.type === "radio" || e.type === "checkbox" ? (l(), f(v, { key: 0 }, [
|
|
489
|
+
e.type === "radio" ? (l(), k(a, {
|
|
490
|
+
key: 0,
|
|
491
|
+
modelValue: d.value[e.prop],
|
|
492
|
+
"onUpdate:modelValue": (u) => d.value[e.prop] = u
|
|
493
|
+
}, {
|
|
494
|
+
default: s(() => [
|
|
495
|
+
(l(!0), f(v, null, B(e.data, (u) => (l(), k(g, {
|
|
496
|
+
value: u.value
|
|
497
|
+
}, {
|
|
498
|
+
default: s(() => [
|
|
499
|
+
U(A(u.label), 1)
|
|
500
|
+
]),
|
|
501
|
+
_: 2
|
|
502
|
+
}, 1032, ["value"]))), 256))
|
|
503
|
+
]),
|
|
504
|
+
_: 2
|
|
505
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : N("", !0),
|
|
506
|
+
e.type === "checkbox" ? (l(), k(p, {
|
|
507
|
+
key: 1,
|
|
508
|
+
modelValue: d.value[e.prop],
|
|
509
|
+
"onUpdate:modelValue": (u) => d.value[e.prop] = u
|
|
510
|
+
}, {
|
|
511
|
+
default: s(() => [
|
|
512
|
+
(l(!0), f(v, null, B(e.data, (u) => (l(), k(t, {
|
|
513
|
+
label: u.label,
|
|
514
|
+
value: u.value
|
|
515
|
+
}, null, 8, ["label", "value"]))), 256))
|
|
516
|
+
]),
|
|
517
|
+
_: 2
|
|
518
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : N("", !0)
|
|
519
|
+
], 64)) : (l(), k(W(c[e.type]), S({
|
|
520
|
+
key: 1,
|
|
521
|
+
ref_for: !0
|
|
522
|
+
}, e.props, {
|
|
523
|
+
modelValue: d.value[e.prop],
|
|
524
|
+
"onUpdate:modelValue": (u) => d.value[e.prop] = u
|
|
525
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue"]))
|
|
526
|
+
])
|
|
527
|
+
]),
|
|
528
|
+
_: 2
|
|
529
|
+
}, 1032, ["label", "prop"])
|
|
530
|
+
]),
|
|
531
|
+
_: 2
|
|
532
|
+
}, 1032, ["span"]))), 128))
|
|
533
|
+
]),
|
|
534
|
+
_: 3
|
|
535
|
+
}))
|
|
536
|
+
]),
|
|
537
|
+
_: 3
|
|
538
|
+
}, 16, ["class", "model"]);
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
}), ge = { key: 0 }, ve = /* @__PURE__ */ Object.assign({
|
|
542
|
+
name: "WtskTable",
|
|
543
|
+
inheritAttrs: !1
|
|
544
|
+
}, {
|
|
545
|
+
__name: "WtskTable",
|
|
546
|
+
props: {
|
|
547
|
+
// 表格数据
|
|
548
|
+
tableData: {
|
|
549
|
+
type: Array,
|
|
550
|
+
default: () => []
|
|
551
|
+
},
|
|
552
|
+
// 表格高度
|
|
553
|
+
tableHeight: {
|
|
554
|
+
type: String,
|
|
555
|
+
default: "550px"
|
|
556
|
+
},
|
|
557
|
+
// 表格表头配置
|
|
558
|
+
tableColumns: {
|
|
559
|
+
type: Array,
|
|
560
|
+
default: () => []
|
|
561
|
+
},
|
|
562
|
+
// 表格是否有分页
|
|
563
|
+
tableHasPage: {
|
|
564
|
+
type: Boolean,
|
|
565
|
+
default: !0
|
|
566
|
+
},
|
|
567
|
+
// 表格总数
|
|
568
|
+
tableTotal: {
|
|
569
|
+
type: Number,
|
|
570
|
+
default: 0
|
|
571
|
+
},
|
|
572
|
+
// 表格当前页码
|
|
573
|
+
tablePageNum: {
|
|
574
|
+
type: Number,
|
|
575
|
+
default: 1
|
|
576
|
+
},
|
|
577
|
+
// 表格每页页数
|
|
578
|
+
tablePageSize: {
|
|
579
|
+
type: Number,
|
|
580
|
+
default: 10
|
|
581
|
+
},
|
|
582
|
+
// 表格分页额外信息
|
|
583
|
+
tablePageProp: {
|
|
584
|
+
type: Object,
|
|
585
|
+
default: null
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
emits: ["tablePageChange"],
|
|
589
|
+
setup(o, { expose: b, emit: h }) {
|
|
590
|
+
const w = o, d = E(), c = E({
|
|
591
|
+
pageNum: w.tablePageNum,
|
|
592
|
+
pageSize: w.tablePageSize
|
|
593
|
+
});
|
|
594
|
+
j(() => w.tablePageNum, () => {
|
|
595
|
+
c.value.pageNum = w.tablePageNum, c.value.pageSize = w.tablePageSize;
|
|
596
|
+
});
|
|
597
|
+
const _ = h;
|
|
598
|
+
function r(i) {
|
|
599
|
+
c.value.pageNum = i, _("tablePageChange", { ...c.value });
|
|
600
|
+
}
|
|
601
|
+
function V(i) {
|
|
602
|
+
c.value.pageSize = i, _("tablePageChange", { ...c.value });
|
|
603
|
+
}
|
|
604
|
+
return b({ wtskTableRef: d }), (i, T) => {
|
|
605
|
+
const g = y("el-table-column"), a = y("el-table"), t = y("el-pagination");
|
|
606
|
+
return l(), f(v, null, [
|
|
607
|
+
m(a, S({
|
|
608
|
+
ref_key: "wtskTableRef",
|
|
609
|
+
ref: d,
|
|
610
|
+
class: "wtsk-table"
|
|
611
|
+
}, { "row-key": "id", "default-expand-all": !0, ...i.$attrs }, {
|
|
612
|
+
data: o.tableData,
|
|
613
|
+
height: o.tableHasPage ? o.tableHeight : "auto",
|
|
614
|
+
stripe: ""
|
|
615
|
+
}), {
|
|
616
|
+
default: s(() => [
|
|
617
|
+
(l(!0), f(v, null, B(o.tableColumns, (p) => (l(), k(g, S({
|
|
618
|
+
key: p.prop
|
|
619
|
+
}, { ref_for: !0 }, {
|
|
620
|
+
align: "center",
|
|
621
|
+
"reserve-selection": !0,
|
|
622
|
+
"show-overflow-tooltip": !0,
|
|
623
|
+
...p
|
|
624
|
+
}), q({ _: 2 }, [
|
|
625
|
+
p.slot ? {
|
|
626
|
+
name: "default",
|
|
627
|
+
fn: s((n) => [
|
|
628
|
+
F(i.$slots, p.slot, S({ ref_for: !0 }, n))
|
|
629
|
+
]),
|
|
630
|
+
key: "0"
|
|
631
|
+
} : void 0,
|
|
632
|
+
p.type === "operate" ? {
|
|
633
|
+
name: "default",
|
|
634
|
+
fn: s((n) => [
|
|
635
|
+
F(i.$slots, "tableBtn", S({ ref_for: !0 }, n))
|
|
636
|
+
]),
|
|
637
|
+
key: "1"
|
|
638
|
+
} : void 0
|
|
639
|
+
]), 1040))), 128))
|
|
640
|
+
]),
|
|
641
|
+
_: 3
|
|
642
|
+
}, 16, ["data", "height"]),
|
|
643
|
+
o.tableHasPage ? (l(), f("div", ge, [
|
|
644
|
+
m(t, S({ class: "wtsk-pagination" }, {
|
|
645
|
+
layout: "total, prev, pager, next, sizes",
|
|
646
|
+
"page-sizes": [5, 10, 20, 50, 100],
|
|
647
|
+
background: !0,
|
|
648
|
+
...o.tablePageProp
|
|
649
|
+
}, {
|
|
650
|
+
total: o.tableTotal,
|
|
651
|
+
"current-page": c.value.pageNum,
|
|
652
|
+
"page-size": c.value.pageSize,
|
|
653
|
+
onSizeChange: V,
|
|
654
|
+
onCurrentChange: r
|
|
655
|
+
}), null, 16, ["total", "current-page", "page-size"])
|
|
656
|
+
])) : N("", !0)
|
|
657
|
+
], 64);
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
}), be = [ae, ke, ye, ve], we = {
|
|
661
|
+
install(o) {
|
|
662
|
+
be.forEach((b) => {
|
|
663
|
+
o.component(b.name, b);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
export {
|
|
668
|
+
we as default
|
|
669
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,V){typeof exports=="object"&&typeof module<"u"?module.exports=V(require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["vue","element-plus"],V):(e=typeof globalThis<"u"?globalThis:e||self,e.WtskBasic=V(e.Vue,e.ElementPlus))})(this,(function(e,V){"use strict";const N=Object.assign({name:"WtskBtn",inheritAttrs:!1},{__name:"WtskBtn",setup(r){const f=e.useAttrs(),g=e.ref(!1);function y(d,k){const a={};for(const h in d)h!==k&&(a[h]=d[h]);return a}async function i(){g.value=!0;try{await f.onClick?.()}finally{g.value=!1}}return(d,k)=>{const a=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(a,e.mergeProps(y(d.$attrs,"onClick"),{loading:g.value,onClick:i}),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3},16,["loading"])}}});var E=e.defineComponent({name:"Delete",__name:"delete",setup(r){return(f,g)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"})]))}}),S=E,P=e.defineComponent({name:"Edit",__name:"edit",setup(r){return(f,g)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640z"}),e.createElementVNode("path",{fill:"currentColor",d:"m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"})]))}}),x=P,T=e.defineComponent({name:"Plus",__name:"plus",setup(r){return(f,g)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),u=T;const F={class:"wtsk-tree-box"},z={key:0,class:"wtsk-tree-box-title"},H={key:1,class:"wtsk-tree-box-filter wtsk-form"},$={style:{display:"flex","align-items":"center"},class:"wtsk-form"},M={class:"wtsk-tree-box-tree-custom"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},U={style:{display:"flex","align-items":"center"},class:"wtsk-form"},A=Object.assign({name:"WtskTree",inheritAttrs:!1},{__name:"WtskTree",props:{treeTitle:{type:String,default:""},treeHasFilter:{type:Boolean,default:!1},treeFilterType:{type:String,default:"default"},treeHasOperate:{type:Boolean,default:!1},treeCustomizeOperate:{type:Boolean,default:!1},treeAddParentText:{type:String,default:"新增一级"}},emits:["treeOperate"],setup(r,{expose:f,emit:g}){const y=e.useAttrs(),i=r,d=e.ref();let k=e.ref(""),a=e.ref("");const h=g;e.watch(k,o=>{d.value?.filter(o)});function p(o,l,s){const n=l.label?l.label:y.props?.label;if(!o)return!0;if(i.treeFilterType==="default")return l[n].includes(o);{let C=[];w(s,C,o,n);let b=!1;return C.forEach(_=>{b=b||_}),b}}function w(o,l,s,n){let C=o.data&&o.data[n]&&o.data[n].includes(s);C&&l.push(C),!C&&o.level!==1&&o.parent&&w(o.parent,l,s,n)}function m(o,l,s){i.treeCustomizeOperate||o==="delete"?h("treeOperate",o,l,s):a.value.trim()!==""?(document.documentElement.click(),h("treeOperate",o,l,s,a.value)):V.ElMessage.error("名称不能为空!")}return f({wtskTreeRef:d}),(o,l)=>{const s=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),C=e.resolveComponent("el-popover"),b=e.resolveComponent("el-popconfirm"),_=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",F,[r.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",z,e.toDisplayString(r.treeTitle),1)):e.createCommentVNode("",!0),r.treeHasFilter||r.treeHasOperate?(e.openBlock(),e.createElementBlock("div",H,[r.treeHasFilter?(e.openBlock(),e.createBlock(s,{key:0,modelValue:e.unref(k),"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(k)?k.value=t:k=t),placeholder:"输入名称进行筛选……",clearable:""},null,8,["modelValue"])):e.createCommentVNode("",!0),r.treeCustomizeOperate?(e.openBlock(),e.createBlock(n,{key:2,type:"primary",onClick:l[4]||(l[4]=t=>m("addParent"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[r.treeHasOperate?(e.openBlock(),e.createBlock(C,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(a)?a.value="":a="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",$,[e.createVNode(s,{modelValue:e.unref(a),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(a)?a.value=t:a=t),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:l[3]||(l[3]=e.withModifiers(t=>m("addParent"),["stop"]))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("新增",-1)])]),_:1})])]),_:1})):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0),e.createVNode(_,e.mergeProps({ref_key:"wtskTreeRef",ref:d,class:"wtsk-tree wtsk-tree-box-tree"},{"node-key":"id","highlight-current":!0,"default-expand-all":!0,"expand-on-click-node":!1,"check-on-click-leaf":!1,...o.$attrs},{"filter-node-method":p}),e.createSlots({_:2},[r.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",M,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[r.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(u),onClick:e.withModifiers(B=>m("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(x),onClick:e.withModifiers(B=>m("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(C,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(u),onClick:l[5]||(l[5]=e.withModifiers(B=>e.isRef(a)?a.value="":a="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(s,{modelValue:e.unref(a),"onUpdate:modelValue":l[6]||(l[6]=B=>e.isRef(a)?a.value=B:a=B),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(B=>m("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(C,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(x),onClick:e.withModifiers(B=>e.isRef(a)?a.value=t.label:a=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(s,{modelValue:e.unref(a),"onUpdate:modelValue":l[7]||(l[7]=B=>e.isRef(a)?a.value=B:a=B),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(B=>m("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(b,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:B=>m("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(S),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),R=Object.assign({name:"WtskForm",inheritAttrs:!1},{__name:"WtskForm",props:e.mergeModels({formIsSearch:{type:Boolean,default:!1},formItems:{type:Array,default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:f}){const g=r,y=e.computed(()=>g.formItems.filter(p=>!p.hidden)),i=e.useModel(r,"modelValue"),d={input:V.ElInput,number:V.ElInputNumber,select:V.ElSelect,date:V.ElDatePicker,switch:V.ElSwitch,treeSelect:V.ElTreeSelect};function k(p,w){if(!p||typeof p!="object")return;const m=w.split(".");let o=p;for(const l of m){if(o===null)return;o=o[l]}return o}function a(p,w,m){if(!p||typeof p!="object")return;const o=w.split(".");let l=p;for(let s=0;s<o.length-1;s++){const n=o[s];(l[n]===null||typeof l[n]!="object")&&(l[n]={}),l=l[n]}l[o[o.length-1]]=m}const h=e.ref();return f({wtskFormRef:h}),(p,w)=>{const m=e.resolveComponent("el-radio"),o=e.resolveComponent("el-radio-group"),l=e.resolveComponent("el-checkbox"),s=e.resolveComponent("el-checkbox-group"),n=e.resolveComponent("el-form-item"),C=e.resolveComponent("el-col"),b=e.resolveComponent("el-row"),_=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(_,e.mergeProps({ref_key:"wtskFormRef",ref:h,class:["wtsk-form",r.formIsSearch?"wtsk-form-search":""]},{"label-width":r.formIsSearch?"auto":"100px",...p.$attrs},{model:i.value}),{default:e.withCtx(()=>[r.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,t=>(e.openBlock(),e.createBlock(n,{key:t.prop,label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(p.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(m,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(s,{key:1,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{"model-value":k(i.value,t.prop),"onUpdate:modelValue":c=>a(i.value,t.prop,c)}),null,16,["model-value","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"]))),128)),e.createVNode(n,null,{default:e.withCtx(()=>[e.renderSlot(p.$slots,"formSearchBtn")]),_:3})],64)):(e.openBlock(),e.createBlock(b,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,t=>(e.openBlock(),e.createBlock(C,{key:t.prop,span:t.span||24},{default:e.withCtx(()=>[e.createVNode(n,{label:t.label,prop:t.prop},{default:e.withCtx(()=>[e.renderSlot(p.$slots,t.prop,{},()=>[t.type==="radio"||t.type==="checkbox"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[t.type==="radio"?(e.openBlock(),e.createBlock(o,{key:0,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(m,{value:c.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0),t.type==="checkbox"?(e.openBlock(),e.createBlock(s,{key:1,modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.data,c=>(e.openBlock(),e.createBlock(l,{label:c.label,value:c.value},null,8,["label","value"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d[t.type]),e.mergeProps({key:1,ref_for:!0},t.props,{modelValue:i.value[t.prop],"onUpdate:modelValue":c=>i.value[t.prop]=c}),null,16,["modelValue","onUpdate:modelValue"]))])]),_:2},1032,["label","prop"])]),_:2},1032,["span"]))),128))]),_:3}))]),_:3},16,["class","model"])}}}),D={key:0},W=[N,A,R,Object.assign({name:"WtskTable",inheritAttrs:!1},{__name:"WtskTable",props:{tableData:{type:Array,default:()=>[]},tableHeight:{type:String,default:"550px"},tableColumns:{type:Array,default:()=>[]},tableHasPage:{type:Boolean,default:!0},tableTotal:{type:Number,default:0},tablePageNum:{type:Number,default:1},tablePageSize:{type:Number,default:10},tablePageProp:{type:Object,default:null}},emits:["tablePageChange"],setup(r,{expose:f,emit:g}){const y=r,i=e.ref(),d=e.ref({pageNum:y.tablePageNum,pageSize:y.tablePageSize});e.watch(()=>y.tablePageNum,()=>{d.value.pageNum=y.tablePageNum,d.value.pageSize=y.tablePageSize});const k=g;function a(p){d.value.pageNum=p,k("tablePageChange",{...d.value})}function h(p){d.value.pageSize=p,k("tablePageChange",{...d.value})}return f({wtskTableRef:i}),(p,w)=>{const m=e.resolveComponent("el-table-column"),o=e.resolveComponent("el-table"),l=e.resolveComponent("el-pagination");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(o,e.mergeProps({ref_key:"wtskTableRef",ref:i,class:"wtsk-table"},{"row-key":"id","default-expand-all":!0,...p.$attrs},{data:r.tableData,height:r.tableHasPage?r.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.tableColumns,s=>(e.openBlock(),e.createBlock(m,e.mergeProps({key:s.prop},{ref_for:!0},{align:"center","reserve-selection":!0,"show-overflow-tooltip":!0,...s}),e.createSlots({_:2},[s.slot?{name:"default",fn:e.withCtx(n=>[e.renderSlot(p.$slots,s.slot,e.mergeProps({ref_for:!0},n))]),key:"0"}:void 0,s.type==="operate"?{name:"default",fn:e.withCtx(n=>[e.renderSlot(p.$slots,"tableBtn",e.mergeProps({ref_for:!0},n))]),key:"1"}:void 0]),1040))),128))]),_:3},16,["data","height"]),r.tableHasPage?(e.openBlock(),e.createElementBlock("div",D,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...r.tablePageProp},{total:r.tableTotal,"current-page":d.value.pageNum,"page-size":d.value.pageSize,onSizeChange:h,onCurrentChange:a}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}})];return{install(r){W.forEach(f=>{r.component(f.name,f)})}}}));
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wtsk-comps",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Vue3+Element Plus基础组件库(wtsk-btn/form/table/tree)",
|
|
5
|
+
"author": "lujh",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": ["vue3", "element-plus", "wtsk-basic"],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "dist/wtsk-basic.cjs.js",
|
|
10
|
+
"module": "dist/wtsk-basic.es.js",
|
|
11
|
+
"unpkg": "dist/wtsk-basic.umd.js",
|
|
12
|
+
"style": "dist/wtsk-basic.css",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/wtsk-basic.es.js",
|
|
16
|
+
"require": "./dist/wtsk-basic.cjs.js"
|
|
17
|
+
},
|
|
18
|
+
"./style": "./dist/wtsk-basic.css"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"vue": "^3.2.0 || ^3.3.0 || ^3.4.0",
|
|
25
|
+
"element-plus": "^2.10.0"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20.0.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"build": "vite build",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"element-plus": "^2.13.2",
|
|
37
|
+
"sass": "^1.97.3",
|
|
38
|
+
"vue": "^3.5.24"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
42
|
+
"vite": "^7.2.4"
|
|
43
|
+
}
|
|
44
|
+
}
|