wtsk-comps 1.1.6 → 1.1.8
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/wtsk-basic.cjs.js +1 -1
- package/dist/wtsk-basic.es.js +162 -153
- package/dist/wtsk-basic.umd.js +1 -1
- package/index.d.ts +23 -22
- package/package.json +1 -1
package/dist/wtsk-basic.cjs.js
CHANGED
|
@@ -1 +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;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),b=require("element-plus"),x=Object.assign({name:"WtskBtn",inheritAttrs:!1},{__name:"WtskBtn",setup(a){const k=e.useAttrs(),m=e.ref(!1);function g(i,f){const r={};for(const v in i)v!==f&&(r[v]=i[v]);return r}async function p(){m.value=!0;try{await k.onClick?.()}finally{m.value=!1}}return(i,f)=>{const r=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(r,e.mergeProps(g(i.$attrs,"onClick"),{loading:m.value,onClick:p}),{default:e.withCtx(()=>[e.renderSlot(i.$slots,"default")]),_:3},16,["loading"])}}});var P=e.defineComponent({name:"Delete",__name:"delete",setup(a){return(k,m)=>(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"})]))}}),T=P,F=e.defineComponent({name:"Edit",__name:"edit",setup(a){return(k,m)=>(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"})]))}}),w=F,z=e.defineComponent({name:"Plus",__name:"plus",setup(a){return(k,m)=>(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"})]))}}),_=z;const H={class:"wtsk-tree-box"},M={key:0,class:"wtsk-tree-box-title"},$={key:1,class:"wtsk-tree-box-filter wtsk-form"},O={style:{display:"flex","align-items":"center"},class:"wtsk-form"},W={class:"wtsk-tree-box-tree-custom"},U={style:{display:"flex","align-items":"center"},class:"wtsk-form"},A={style:{display:"flex","align-items":"center"},class:"wtsk-form"},N=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(a,{expose:k,emit:m}){const g=e.useAttrs(),p=a,i=e.ref();let f=e.ref(""),r=e.ref("");const v=m;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(V=>{B=B||V}),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):r.value.trim()!==""?(document.documentElement.click(),v("treeOperate",o,l,s,r.value)):b.ElMessage.error("名称不能为空!")}return k({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"),V=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",H,[a.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",M,e.toDisplayString(a.treeTitle),1)):e.createCommentVNode("",!0),a.treeHasFilter||a.treeHasOperate?(e.openBlock(),e.createElementBlock("div",$,[a.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),a.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(a.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[a.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(r)?r.value="":r="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(s,{modelValue:e.unref(r),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(r)?r.value=t:r=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(V,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},[a.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",W,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[a.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(w),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(r)?r.value="":r="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(s,{modelValue:e.unref(r),"onUpdate:modelValue":l[6]||(l[6]=h=>e.isRef(r)?r.value=h:r=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(w),onClick:e.withModifiers(h=>e.isRef(r)?r.value=t.label:r=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",A,[e.createVNode(s,{modelValue:e.unref(r),"onUpdate:modelValue":l[7]||(l[7]=h=>e.isRef(r)?r.value=h:r=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(T),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),E=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(a,{expose:k}){const m=a,g=e.computed(()=>m.formItems.filter(u=>!u.hidden)),p=e.useModel(a,"modelValue"),i={input:b.ElInput,number:b.ElInputNumber,select:b.ElSelect,date:b.ElDatePicker,switch:b.ElSwitch,treeSelect:b.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 r(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 k({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"),V=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(V,e.mergeProps({ref_key:"wtskFormRef",ref:v,class:["wtsk-form",a.formIsSearch?"wtsk-form-search":""]},{"label-width":a.formIsSearch?"auto":"100px",...u.$attrs},{model:p.value}),{default:e.withCtx(()=>[a.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=>r(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},S=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(a,{expose:k,emit:m}){const g=a,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=m;function r(u){i.value.pageNum=u,f("tablePageChange",{...i.value})}function v(u){i.value.pageSize=u,f("tablePageChange",{...i.value})}return k({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:a.tableData,height:a.tableHasPage?a.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.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"]),a.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,...a.tablePageProp},{total:a.tableTotal,"current-page":i.value.pageNum,"page-size":i.value.pageSize,onSizeChange:v,onCurrentChange:r}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}}),D=[{name:"WtskBtn",component:x},{name:"WtskTree",component:N},{name:"WtskForm",component:E},{name:"WtskTable",component:S}],L={install(a){D.forEach(({name:k,component:m})=>{a.component(k,m)})}};exports.WtskBtn=x;exports.WtskForm=E;exports.WtskTable=S;exports.WtskTree=N;exports.default=L;
|
package/dist/wtsk-basic.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useAttrs as L, ref as
|
|
1
|
+
import { useAttrs as L, ref as U, resolveComponent as y, openBlock as l, createBlock as k, mergeProps as S, withCtx as s, renderSlot as E, defineComponent as M, createElementBlock as f, createElementVNode as P, watch as j, toDisplayString as F, createCommentVNode as z, isRef as B, unref as T, Fragment as b, createVNode as m, withModifiers as H, createTextVNode as W, createSlots as q, computed as G, useModel as J, renderList as O, resolveDynamicComponent as I, mergeModels as Q } from "vue";
|
|
2
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
3
|
const ae = /* @__PURE__ */ Object.assign({
|
|
4
4
|
name: "WtskBtn",
|
|
@@ -6,40 +6,40 @@ const ae = /* @__PURE__ */ Object.assign({
|
|
|
6
6
|
}, {
|
|
7
7
|
__name: "WtskBtn",
|
|
8
8
|
setup(o) {
|
|
9
|
-
const
|
|
10
|
-
function w(
|
|
11
|
-
const
|
|
12
|
-
for (const V in
|
|
13
|
-
V !== _ && (
|
|
14
|
-
return
|
|
9
|
+
const h = L(), v = U(!1);
|
|
10
|
+
function w(d, _) {
|
|
11
|
+
const n = {};
|
|
12
|
+
for (const V in d)
|
|
13
|
+
V !== _ && (n[V] = d[V]);
|
|
14
|
+
return n;
|
|
15
15
|
}
|
|
16
|
-
async function
|
|
17
|
-
|
|
16
|
+
async function c() {
|
|
17
|
+
v.value = !0;
|
|
18
18
|
try {
|
|
19
|
-
await
|
|
19
|
+
await h.onClick?.();
|
|
20
20
|
} finally {
|
|
21
|
-
|
|
21
|
+
v.value = !1;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
return (
|
|
25
|
-
const
|
|
26
|
-
return l(), k(
|
|
27
|
-
loading:
|
|
28
|
-
onClick:
|
|
24
|
+
return (d, _) => {
|
|
25
|
+
const n = y("el-button");
|
|
26
|
+
return l(), k(n, S(w(d.$attrs, "onClick"), {
|
|
27
|
+
loading: v.value,
|
|
28
|
+
onClick: c
|
|
29
29
|
}), {
|
|
30
30
|
default: s(() => [
|
|
31
|
-
|
|
31
|
+
E(d.$slots, "default")
|
|
32
32
|
]),
|
|
33
33
|
_: 3
|
|
34
34
|
}, 16, ["loading"]);
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
var oe = /* @__PURE__ */
|
|
38
|
+
var oe = /* @__PURE__ */ M({
|
|
39
39
|
name: "Delete",
|
|
40
40
|
__name: "delete",
|
|
41
41
|
setup(o) {
|
|
42
|
-
return (
|
|
42
|
+
return (h, v) => (l(), f("svg", {
|
|
43
43
|
xmlns: "http://www.w3.org/2000/svg",
|
|
44
44
|
viewBox: "0 0 1024 1024"
|
|
45
45
|
}, [
|
|
@@ -49,11 +49,11 @@ var oe = /* @__PURE__ */ I({
|
|
|
49
49
|
})
|
|
50
50
|
]));
|
|
51
51
|
}
|
|
52
|
-
}),
|
|
52
|
+
}), ne = oe, re = /* @__PURE__ */ M({
|
|
53
53
|
name: "Edit",
|
|
54
54
|
__name: "edit",
|
|
55
55
|
setup(o) {
|
|
56
|
-
return (
|
|
56
|
+
return (h, v) => (l(), f("svg", {
|
|
57
57
|
xmlns: "http://www.w3.org/2000/svg",
|
|
58
58
|
viewBox: "0 0 1024 1024"
|
|
59
59
|
}, [
|
|
@@ -67,11 +67,11 @@ var oe = /* @__PURE__ */ I({
|
|
|
67
67
|
})
|
|
68
68
|
]));
|
|
69
69
|
}
|
|
70
|
-
}), R =
|
|
70
|
+
}), R = re, ue = /* @__PURE__ */ M({
|
|
71
71
|
name: "Plus",
|
|
72
72
|
__name: "plus",
|
|
73
73
|
setup(o) {
|
|
74
|
-
return (
|
|
74
|
+
return (h, v) => (l(), f("svg", {
|
|
75
75
|
xmlns: "http://www.w3.org/2000/svg",
|
|
76
76
|
viewBox: "0 0 1024 1024"
|
|
77
77
|
}, [
|
|
@@ -88,10 +88,10 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
88
88
|
}, ie = {
|
|
89
89
|
key: 1,
|
|
90
90
|
class: "wtsk-tree-box-filter wtsk-form"
|
|
91
|
-
},
|
|
91
|
+
}, ce = {
|
|
92
92
|
style: { display: "flex", "align-items": "center" },
|
|
93
93
|
class: "wtsk-form"
|
|
94
|
-
},
|
|
94
|
+
}, de = { class: "wtsk-tree-box-tree-custom" }, fe = {
|
|
95
95
|
style: { display: "flex", "align-items": "center" },
|
|
96
96
|
class: "wtsk-form"
|
|
97
97
|
}, me = {
|
|
@@ -135,55 +135,55 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
137
|
emits: ["treeOperate"],
|
|
138
|
-
setup(o, { expose:
|
|
139
|
-
const w = L(),
|
|
140
|
-
let _ =
|
|
141
|
-
const V =
|
|
138
|
+
setup(o, { expose: h, emit: v }) {
|
|
139
|
+
const w = L(), c = o, d = U();
|
|
140
|
+
let _ = U(""), n = U("");
|
|
141
|
+
const V = v;
|
|
142
142
|
j(_, (a) => {
|
|
143
|
-
|
|
143
|
+
d.value?.filter(a);
|
|
144
144
|
});
|
|
145
145
|
function i(a, t, p) {
|
|
146
|
-
const
|
|
146
|
+
const r = t.label ? t.label : w.props?.label;
|
|
147
147
|
if (!a) return !0;
|
|
148
|
-
if (
|
|
148
|
+
if (c.treeFilterType === "default") return t[r].includes(a);
|
|
149
149
|
{
|
|
150
150
|
let C = [];
|
|
151
|
-
|
|
151
|
+
N(p, C, a, r);
|
|
152
152
|
let $ = !1;
|
|
153
|
-
return C.forEach((
|
|
154
|
-
$ = $ ||
|
|
153
|
+
return C.forEach((A) => {
|
|
154
|
+
$ = $ || A;
|
|
155
155
|
}), $;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
let C = a.data && a.data[
|
|
160
|
-
C && t.push(C), !C && a.level !== 1 && a.parent &&
|
|
158
|
+
function N(a, t, p, r) {
|
|
159
|
+
let C = a.data && a.data[r] && a.data[r].includes(p);
|
|
160
|
+
C && t.push(C), !C && a.level !== 1 && a.parent && N(a.parent, t, p, r);
|
|
161
161
|
}
|
|
162
162
|
function g(a, t, p) {
|
|
163
|
-
|
|
163
|
+
c.treeCustomizeOperate || a === "delete" ? V("treeOperate", a, t, p) : n.value.trim() !== "" ? (document.documentElement.click(), V("treeOperate", a, t, p, n.value)) : X.error("名称不能为空!");
|
|
164
164
|
}
|
|
165
|
-
return
|
|
166
|
-
const p = y("el-input"),
|
|
165
|
+
return h({ wtskTreeRef: d }), (a, t) => {
|
|
166
|
+
const p = y("el-input"), r = y("el-button"), C = y("el-popover"), $ = y("el-popconfirm"), A = y("el-tree");
|
|
167
167
|
return l(), f("div", se, [
|
|
168
|
-
o.treeTitle !== "" ? (l(), f("div", pe,
|
|
168
|
+
o.treeTitle !== "" ? (l(), f("div", pe, F(o.treeTitle), 1)) : z("", !0),
|
|
169
169
|
o.treeHasFilter || o.treeHasOperate ? (l(), f("div", ie, [
|
|
170
170
|
o.treeHasFilter ? (l(), k(p, {
|
|
171
171
|
key: 0,
|
|
172
|
-
modelValue:
|
|
173
|
-
"onUpdate:modelValue": t[0] || (t[0] = (e) =>
|
|
172
|
+
modelValue: T(_),
|
|
173
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => B(_) ? _.value = e : _ = e),
|
|
174
174
|
placeholder: "输入名称进行筛选……",
|
|
175
175
|
clearable: ""
|
|
176
|
-
}, null, 8, ["modelValue"])) :
|
|
177
|
-
o.treeCustomizeOperate ? (l(), k(
|
|
176
|
+
}, null, 8, ["modelValue"])) : z("", !0),
|
|
177
|
+
o.treeCustomizeOperate ? (l(), k(r, {
|
|
178
178
|
key: 2,
|
|
179
179
|
type: "primary",
|
|
180
180
|
onClick: t[4] || (t[4] = (e) => g("addParent"))
|
|
181
181
|
}, {
|
|
182
182
|
default: s(() => [
|
|
183
|
-
|
|
183
|
+
W(F(o.treeAddParentText), 1)
|
|
184
184
|
]),
|
|
185
185
|
_: 1
|
|
186
|
-
})) : (l(), f(
|
|
186
|
+
})) : (l(), f(b, { key: 1 }, [
|
|
187
187
|
o.treeHasOperate ? (l(), k(C, {
|
|
188
188
|
key: 0,
|
|
189
189
|
placement: "bottom",
|
|
@@ -191,43 +191,43 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
191
191
|
trigger: "click"
|
|
192
192
|
}, {
|
|
193
193
|
reference: s(() => [
|
|
194
|
-
m(
|
|
194
|
+
m(r, {
|
|
195
195
|
type: "primary",
|
|
196
|
-
onClick: t[1] || (t[1] = (e) =>
|
|
196
|
+
onClick: t[1] || (t[1] = (e) => B(n) ? n.value = "" : n = "")
|
|
197
197
|
}, {
|
|
198
198
|
default: s(() => [
|
|
199
|
-
|
|
199
|
+
W(F(o.treeAddParentText), 1)
|
|
200
200
|
]),
|
|
201
201
|
_: 1
|
|
202
202
|
})
|
|
203
203
|
]),
|
|
204
204
|
default: s(() => [
|
|
205
|
-
P("div",
|
|
205
|
+
P("div", ce, [
|
|
206
206
|
m(p, {
|
|
207
|
-
modelValue:
|
|
208
|
-
"onUpdate:modelValue": t[2] || (t[2] = (e) =>
|
|
207
|
+
modelValue: T(n),
|
|
208
|
+
"onUpdate:modelValue": t[2] || (t[2] = (e) => B(n) ? n.value = e : n = e),
|
|
209
209
|
placeholder: "请输入名称",
|
|
210
210
|
clearable: ""
|
|
211
211
|
}, null, 8, ["modelValue"]),
|
|
212
|
-
m(
|
|
212
|
+
m(r, {
|
|
213
213
|
type: "primary",
|
|
214
214
|
style: { "margin-left": "10px" },
|
|
215
215
|
onClick: t[3] || (t[3] = H((e) => g("addParent"), ["stop"]))
|
|
216
216
|
}, {
|
|
217
217
|
default: s(() => [...t[9] || (t[9] = [
|
|
218
|
-
|
|
218
|
+
W("新增", -1)
|
|
219
219
|
])]),
|
|
220
220
|
_: 1
|
|
221
221
|
})
|
|
222
222
|
])
|
|
223
223
|
]),
|
|
224
224
|
_: 1
|
|
225
|
-
})) :
|
|
225
|
+
})) : z("", !0)
|
|
226
226
|
], 64))
|
|
227
|
-
])) :
|
|
228
|
-
m(
|
|
227
|
+
])) : z("", !0),
|
|
228
|
+
m(A, S({
|
|
229
229
|
ref_key: "wtskTreeRef",
|
|
230
|
-
ref:
|
|
230
|
+
ref: d,
|
|
231
231
|
class: "wtsk-tree wtsk-tree-box-tree"
|
|
232
232
|
}, {
|
|
233
233
|
"node-key": "id",
|
|
@@ -240,51 +240,51 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
240
240
|
o.treeHasOperate ? {
|
|
241
241
|
name: "default",
|
|
242
242
|
fn: s(({ node: e, data: u }) => [
|
|
243
|
-
P("div",
|
|
244
|
-
P("div", null,
|
|
243
|
+
P("div", de, [
|
|
244
|
+
P("div", null, F(e.label), 1),
|
|
245
245
|
P("div", null, [
|
|
246
|
-
o.treeCustomizeOperate ? (l(), f(
|
|
247
|
-
m(
|
|
246
|
+
o.treeCustomizeOperate ? (l(), f(b, { key: 0 }, [
|
|
247
|
+
m(r, {
|
|
248
248
|
type: "success",
|
|
249
249
|
link: "",
|
|
250
|
-
icon:
|
|
250
|
+
icon: T(D),
|
|
251
251
|
onClick: H((x) => g("add", u, e), ["stop"])
|
|
252
252
|
}, null, 8, ["icon", "onClick"]),
|
|
253
|
-
m(
|
|
253
|
+
m(r, {
|
|
254
254
|
type: "primary",
|
|
255
255
|
link: "",
|
|
256
|
-
icon:
|
|
256
|
+
icon: T(R),
|
|
257
257
|
onClick: H((x) => g("edit", u, e), ["stop"])
|
|
258
258
|
}, null, 8, ["icon", "onClick"])
|
|
259
|
-
], 64)) : (l(), f(
|
|
259
|
+
], 64)) : (l(), f(b, { key: 1 }, [
|
|
260
260
|
m(C, {
|
|
261
261
|
placement: "bottom",
|
|
262
262
|
width: 280,
|
|
263
263
|
trigger: "click"
|
|
264
264
|
}, {
|
|
265
265
|
reference: s(() => [
|
|
266
|
-
m(
|
|
266
|
+
m(r, {
|
|
267
267
|
type: "success",
|
|
268
268
|
link: "",
|
|
269
|
-
icon:
|
|
270
|
-
onClick: t[5] || (t[5] = H((x) =>
|
|
269
|
+
icon: T(D),
|
|
270
|
+
onClick: t[5] || (t[5] = H((x) => B(n) ? n.value = "" : n = "", ["stop"]))
|
|
271
271
|
}, null, 8, ["icon"])
|
|
272
272
|
]),
|
|
273
273
|
default: s(() => [
|
|
274
274
|
P("div", fe, [
|
|
275
275
|
m(p, {
|
|
276
|
-
modelValue:
|
|
277
|
-
"onUpdate:modelValue": t[6] || (t[6] = (x) =>
|
|
276
|
+
modelValue: T(n),
|
|
277
|
+
"onUpdate:modelValue": t[6] || (t[6] = (x) => B(n) ? n.value = x : n = x),
|
|
278
278
|
placeholder: "请输入名称",
|
|
279
279
|
clearable: ""
|
|
280
280
|
}, null, 8, ["modelValue"]),
|
|
281
|
-
m(
|
|
281
|
+
m(r, {
|
|
282
282
|
type: "primary",
|
|
283
283
|
style: { "margin-left": "10px" },
|
|
284
284
|
onClick: H((x) => g("add", u, e), ["stop"])
|
|
285
285
|
}, {
|
|
286
286
|
default: s(() => [...t[10] || (t[10] = [
|
|
287
|
-
|
|
287
|
+
W("新增", -1)
|
|
288
288
|
])]),
|
|
289
289
|
_: 1
|
|
290
290
|
}, 8, ["onClick"])
|
|
@@ -298,28 +298,28 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
298
298
|
trigger: "click"
|
|
299
299
|
}, {
|
|
300
300
|
reference: s(() => [
|
|
301
|
-
m(
|
|
301
|
+
m(r, {
|
|
302
302
|
type: "primary",
|
|
303
303
|
link: "",
|
|
304
|
-
icon:
|
|
305
|
-
onClick: H((x) =>
|
|
304
|
+
icon: T(R),
|
|
305
|
+
onClick: H((x) => B(n) ? n.value = e.label : n = e.label, ["stop"])
|
|
306
306
|
}, null, 8, ["icon", "onClick"])
|
|
307
307
|
]),
|
|
308
308
|
default: s(() => [
|
|
309
309
|
P("div", me, [
|
|
310
310
|
m(p, {
|
|
311
|
-
modelValue:
|
|
312
|
-
"onUpdate:modelValue": t[7] || (t[7] = (x) =>
|
|
311
|
+
modelValue: T(n),
|
|
312
|
+
"onUpdate:modelValue": t[7] || (t[7] = (x) => B(n) ? n.value = x : n = x),
|
|
313
313
|
placeholder: "请输入名称",
|
|
314
314
|
clearable: ""
|
|
315
315
|
}, null, 8, ["modelValue"]),
|
|
316
|
-
m(
|
|
316
|
+
m(r, {
|
|
317
317
|
type: "primary",
|
|
318
318
|
style: { "margin-left": "10px" },
|
|
319
319
|
onClick: H((x) => g("edit", u, e), ["stop"])
|
|
320
320
|
}, {
|
|
321
321
|
default: s(() => [...t[11] || (t[11] = [
|
|
322
|
-
|
|
322
|
+
W("修改", -1)
|
|
323
323
|
])]),
|
|
324
324
|
_: 1
|
|
325
325
|
}, 8, ["onClick"])
|
|
@@ -335,10 +335,10 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
335
335
|
onConfirm: (x) => g("delete", u, e)
|
|
336
336
|
}, {
|
|
337
337
|
reference: s(() => [
|
|
338
|
-
m(
|
|
338
|
+
m(r, {
|
|
339
339
|
type: "danger",
|
|
340
340
|
link: "",
|
|
341
|
-
icon:
|
|
341
|
+
icon: T(ne),
|
|
342
342
|
onClick: t[8] || (t[8] = H(() => {
|
|
343
343
|
}, ["stop"]))
|
|
344
344
|
}, null, 8, ["icon"])
|
|
@@ -375,8 +375,8 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
375
375
|
modelModifiers: {}
|
|
376
376
|
}),
|
|
377
377
|
emits: ["update:modelValue"],
|
|
378
|
-
setup(o, { expose:
|
|
379
|
-
const
|
|
378
|
+
setup(o, { expose: h }) {
|
|
379
|
+
const v = o, w = G(() => v.formItems.filter((i) => !i.hidden)), c = J(o, "modelValue"), d = {
|
|
380
380
|
input: le,
|
|
381
381
|
number: te,
|
|
382
382
|
select: ee,
|
|
@@ -384,9 +384,9 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
384
384
|
switch: Z,
|
|
385
385
|
treeSelect: Y
|
|
386
386
|
};
|
|
387
|
-
function _(i,
|
|
387
|
+
function _(i, N) {
|
|
388
388
|
if (!i || typeof i != "object") return;
|
|
389
|
-
const g =
|
|
389
|
+
const g = N.split(".");
|
|
390
390
|
let a = i;
|
|
391
391
|
for (const t of g) {
|
|
392
392
|
if (a === null) return;
|
|
@@ -394,78 +394,78 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
394
394
|
}
|
|
395
395
|
return a;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function n(i, N, g) {
|
|
398
398
|
if (!i || typeof i != "object") return;
|
|
399
|
-
const a =
|
|
399
|
+
const a = N.split(".");
|
|
400
400
|
let t = i;
|
|
401
401
|
for (let p = 0; p < a.length - 1; p++) {
|
|
402
|
-
const
|
|
403
|
-
(t[
|
|
402
|
+
const r = a[p];
|
|
403
|
+
(t[r] === null || typeof t[r] != "object") && (t[r] = {}), t = t[r];
|
|
404
404
|
}
|
|
405
405
|
t[a[a.length - 1]] = g;
|
|
406
406
|
}
|
|
407
|
-
const V =
|
|
408
|
-
return
|
|
409
|
-
const g = y("el-radio"), a = y("el-radio-group"), t = y("el-checkbox"), p = y("el-checkbox-group"),
|
|
410
|
-
return l(), k(
|
|
407
|
+
const V = U();
|
|
408
|
+
return h({ wtskFormRef: V }), (i, N) => {
|
|
409
|
+
const g = y("el-radio"), a = y("el-radio-group"), t = y("el-checkbox"), p = y("el-checkbox-group"), r = y("el-form-item"), C = y("el-col"), $ = y("el-row"), A = y("el-form");
|
|
410
|
+
return l(), k(A, S({
|
|
411
411
|
ref_key: "wtskFormRef",
|
|
412
412
|
ref: V,
|
|
413
413
|
class: ["wtsk-form", o.formIsSearch ? "wtsk-form-search" : ""]
|
|
414
|
-
}, { "label-width": o.formIsSearch ? "auto" : "100px", ...i.$attrs }, { model:
|
|
414
|
+
}, { "label-width": o.formIsSearch ? "auto" : "100px", ...i.$attrs }, { model: c.value }), {
|
|
415
415
|
default: s(() => [
|
|
416
|
-
o.formIsSearch ? (l(), f(
|
|
417
|
-
(l(!0), f(
|
|
416
|
+
o.formIsSearch ? (l(), f(b, { key: 0 }, [
|
|
417
|
+
(l(!0), f(b, null, O(w.value, (e) => (l(), k(r, {
|
|
418
418
|
key: e.prop,
|
|
419
419
|
label: e.label,
|
|
420
420
|
prop: e.prop
|
|
421
421
|
}, {
|
|
422
422
|
default: s(() => [
|
|
423
|
-
|
|
424
|
-
e.type === "radio" || e.type === "checkbox" ? (l(), f(
|
|
423
|
+
E(i.$slots, e.prop, {}, () => [
|
|
424
|
+
e.type === "radio" || e.type === "checkbox" ? (l(), f(b, { key: 0 }, [
|
|
425
425
|
e.type === "radio" ? (l(), k(a, {
|
|
426
426
|
key: 0,
|
|
427
|
-
modelValue:
|
|
428
|
-
"onUpdate:modelValue": (u) =>
|
|
427
|
+
modelValue: c.value[e.prop],
|
|
428
|
+
"onUpdate:modelValue": (u) => c.value[e.prop] = u
|
|
429
429
|
}, {
|
|
430
430
|
default: s(() => [
|
|
431
|
-
(l(!0), f(
|
|
431
|
+
(l(!0), f(b, null, O(e.data, (u) => (l(), k(g, {
|
|
432
432
|
value: u.value
|
|
433
433
|
}, {
|
|
434
434
|
default: s(() => [
|
|
435
|
-
|
|
435
|
+
W(F(u.label), 1)
|
|
436
436
|
]),
|
|
437
437
|
_: 2
|
|
438
438
|
}, 1032, ["value"]))), 256))
|
|
439
439
|
]),
|
|
440
440
|
_: 2
|
|
441
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])) :
|
|
441
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : z("", !0),
|
|
442
442
|
e.type === "checkbox" ? (l(), k(p, {
|
|
443
443
|
key: 1,
|
|
444
|
-
modelValue:
|
|
445
|
-
"onUpdate:modelValue": (u) =>
|
|
444
|
+
modelValue: c.value[e.prop],
|
|
445
|
+
"onUpdate:modelValue": (u) => c.value[e.prop] = u
|
|
446
446
|
}, {
|
|
447
447
|
default: s(() => [
|
|
448
|
-
(l(!0), f(
|
|
448
|
+
(l(!0), f(b, null, O(e.data, (u) => (l(), k(t, {
|
|
449
449
|
label: u.label,
|
|
450
450
|
value: u.value
|
|
451
451
|
}, null, 8, ["label", "value"]))), 256))
|
|
452
452
|
]),
|
|
453
453
|
_: 2
|
|
454
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])) :
|
|
455
|
-
], 64)) : (l(), k(
|
|
454
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : z("", !0)
|
|
455
|
+
], 64)) : (l(), k(I(d[e.type]), S({
|
|
456
456
|
key: 1,
|
|
457
457
|
ref_for: !0
|
|
458
458
|
}, e.props, {
|
|
459
|
-
"model-value": _(
|
|
460
|
-
"onUpdate:modelValue": (u) =>
|
|
459
|
+
"model-value": _(c.value, e.prop),
|
|
460
|
+
"onUpdate:modelValue": (u) => n(c.value, e.prop, u)
|
|
461
461
|
}), null, 16, ["model-value", "onUpdate:modelValue"]))
|
|
462
462
|
])
|
|
463
463
|
]),
|
|
464
464
|
_: 2
|
|
465
465
|
}, 1032, ["label", "prop"]))), 128)),
|
|
466
|
-
m(
|
|
466
|
+
m(r, null, {
|
|
467
467
|
default: s(() => [
|
|
468
|
-
|
|
468
|
+
E(i.$slots, "formSearchBtn")
|
|
469
469
|
]),
|
|
470
470
|
_: 3
|
|
471
471
|
})
|
|
@@ -474,54 +474,54 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
474
474
|
gutter: 16
|
|
475
475
|
}, {
|
|
476
476
|
default: s(() => [
|
|
477
|
-
(l(!0), f(
|
|
477
|
+
(l(!0), f(b, null, O(w.value, (e) => (l(), k(C, {
|
|
478
478
|
key: e.prop,
|
|
479
479
|
span: e.span || 24
|
|
480
480
|
}, {
|
|
481
481
|
default: s(() => [
|
|
482
|
-
m(
|
|
482
|
+
m(r, {
|
|
483
483
|
label: e.label,
|
|
484
484
|
prop: e.prop
|
|
485
485
|
}, {
|
|
486
486
|
default: s(() => [
|
|
487
|
-
|
|
488
|
-
e.type === "radio" || e.type === "checkbox" ? (l(), f(
|
|
487
|
+
E(i.$slots, e.prop, {}, () => [
|
|
488
|
+
e.type === "radio" || e.type === "checkbox" ? (l(), f(b, { key: 0 }, [
|
|
489
489
|
e.type === "radio" ? (l(), k(a, {
|
|
490
490
|
key: 0,
|
|
491
|
-
modelValue:
|
|
492
|
-
"onUpdate:modelValue": (u) =>
|
|
491
|
+
modelValue: c.value[e.prop],
|
|
492
|
+
"onUpdate:modelValue": (u) => c.value[e.prop] = u
|
|
493
493
|
}, {
|
|
494
494
|
default: s(() => [
|
|
495
|
-
(l(!0), f(
|
|
495
|
+
(l(!0), f(b, null, O(e.data, (u) => (l(), k(g, {
|
|
496
496
|
value: u.value
|
|
497
497
|
}, {
|
|
498
498
|
default: s(() => [
|
|
499
|
-
|
|
499
|
+
W(F(u.label), 1)
|
|
500
500
|
]),
|
|
501
501
|
_: 2
|
|
502
502
|
}, 1032, ["value"]))), 256))
|
|
503
503
|
]),
|
|
504
504
|
_: 2
|
|
505
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])) :
|
|
505
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : z("", !0),
|
|
506
506
|
e.type === "checkbox" ? (l(), k(p, {
|
|
507
507
|
key: 1,
|
|
508
|
-
modelValue:
|
|
509
|
-
"onUpdate:modelValue": (u) =>
|
|
508
|
+
modelValue: c.value[e.prop],
|
|
509
|
+
"onUpdate:modelValue": (u) => c.value[e.prop] = u
|
|
510
510
|
}, {
|
|
511
511
|
default: s(() => [
|
|
512
|
-
(l(!0), f(
|
|
512
|
+
(l(!0), f(b, null, O(e.data, (u) => (l(), k(t, {
|
|
513
513
|
label: u.label,
|
|
514
514
|
value: u.value
|
|
515
515
|
}, null, 8, ["label", "value"]))), 256))
|
|
516
516
|
]),
|
|
517
517
|
_: 2
|
|
518
|
-
}, 1032, ["modelValue", "onUpdate:modelValue"])) :
|
|
519
|
-
], 64)) : (l(), k(
|
|
518
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])) : z("", !0)
|
|
519
|
+
], 64)) : (l(), k(I(d[e.type]), S({
|
|
520
520
|
key: 1,
|
|
521
521
|
ref_for: !0
|
|
522
522
|
}, e.props, {
|
|
523
|
-
modelValue:
|
|
524
|
-
"onUpdate:modelValue": (u) =>
|
|
523
|
+
modelValue: c.value[e.prop],
|
|
524
|
+
"onUpdate:modelValue": (u) => c.value[e.prop] = u
|
|
525
525
|
}), null, 16, ["modelValue", "onUpdate:modelValue"]))
|
|
526
526
|
])
|
|
527
527
|
]),
|
|
@@ -586,27 +586,27 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
586
586
|
}
|
|
587
587
|
},
|
|
588
588
|
emits: ["tablePageChange"],
|
|
589
|
-
setup(o, { expose:
|
|
590
|
-
const w = o,
|
|
589
|
+
setup(o, { expose: h, emit: v }) {
|
|
590
|
+
const w = o, c = U(), d = U({
|
|
591
591
|
pageNum: w.tablePageNum,
|
|
592
592
|
pageSize: w.tablePageSize
|
|
593
593
|
});
|
|
594
594
|
j(() => w.tablePageNum, () => {
|
|
595
|
-
|
|
595
|
+
d.value.pageNum = w.tablePageNum, d.value.pageSize = w.tablePageSize;
|
|
596
596
|
});
|
|
597
|
-
const _ =
|
|
598
|
-
function
|
|
599
|
-
|
|
597
|
+
const _ = v;
|
|
598
|
+
function n(i) {
|
|
599
|
+
d.value.pageNum = i, _("tablePageChange", { ...d.value });
|
|
600
600
|
}
|
|
601
601
|
function V(i) {
|
|
602
|
-
|
|
602
|
+
d.value.pageSize = i, _("tablePageChange", { ...d.value });
|
|
603
603
|
}
|
|
604
|
-
return
|
|
604
|
+
return h({ wtskTableRef: c }), (i, N) => {
|
|
605
605
|
const g = y("el-table-column"), a = y("el-table"), t = y("el-pagination");
|
|
606
|
-
return l(), f(
|
|
606
|
+
return l(), f(b, null, [
|
|
607
607
|
m(a, S({
|
|
608
608
|
ref_key: "wtskTableRef",
|
|
609
|
-
ref:
|
|
609
|
+
ref: c,
|
|
610
610
|
class: "wtsk-table"
|
|
611
611
|
}, { "row-key": "id", "default-expand-all": !0, ...i.$attrs }, {
|
|
612
612
|
data: o.tableData,
|
|
@@ -614,7 +614,7 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
614
614
|
stripe: ""
|
|
615
615
|
}), {
|
|
616
616
|
default: s(() => [
|
|
617
|
-
(l(!0), f(
|
|
617
|
+
(l(!0), f(b, null, O(o.tableColumns, (p) => (l(), k(g, S({
|
|
618
618
|
key: p.prop
|
|
619
619
|
}, { ref_for: !0 }, {
|
|
620
620
|
align: "center",
|
|
@@ -624,15 +624,15 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
624
624
|
}), q({ _: 2 }, [
|
|
625
625
|
p.slot ? {
|
|
626
626
|
name: "default",
|
|
627
|
-
fn: s((
|
|
628
|
-
|
|
627
|
+
fn: s((r) => [
|
|
628
|
+
E(i.$slots, p.slot, S({ ref_for: !0 }, r))
|
|
629
629
|
]),
|
|
630
630
|
key: "0"
|
|
631
631
|
} : void 0,
|
|
632
632
|
p.type === "operate" ? {
|
|
633
633
|
name: "default",
|
|
634
|
-
fn: s((
|
|
635
|
-
|
|
634
|
+
fn: s((r) => [
|
|
635
|
+
E(i.$slots, "tableBtn", S({ ref_for: !0 }, r))
|
|
636
636
|
]),
|
|
637
637
|
key: "1"
|
|
638
638
|
} : void 0
|
|
@@ -648,22 +648,31 @@ const se = { class: "wtsk-tree-box" }, pe = {
|
|
|
648
648
|
...o.tablePageProp
|
|
649
649
|
}, {
|
|
650
650
|
total: o.tableTotal,
|
|
651
|
-
"current-page":
|
|
652
|
-
"page-size":
|
|
651
|
+
"current-page": d.value.pageNum,
|
|
652
|
+
"page-size": d.value.pageSize,
|
|
653
653
|
onSizeChange: V,
|
|
654
|
-
onCurrentChange:
|
|
654
|
+
onCurrentChange: n
|
|
655
655
|
}), null, 16, ["total", "current-page", "page-size"])
|
|
656
|
-
])) :
|
|
656
|
+
])) : z("", !0)
|
|
657
657
|
], 64);
|
|
658
658
|
};
|
|
659
659
|
}
|
|
660
|
-
}), be = [
|
|
660
|
+
}), be = [
|
|
661
|
+
{ name: "WtskBtn", component: ae },
|
|
662
|
+
{ name: "WtskTree", component: ke },
|
|
663
|
+
{ name: "WtskForm", component: ye },
|
|
664
|
+
{ name: "WtskTable", component: ve }
|
|
665
|
+
], we = {
|
|
661
666
|
install(o) {
|
|
662
|
-
be.forEach((
|
|
663
|
-
o.component(
|
|
667
|
+
be.forEach(({ name: h, component: v }) => {
|
|
668
|
+
o.component(h, v);
|
|
664
669
|
});
|
|
665
670
|
}
|
|
666
671
|
};
|
|
667
672
|
export {
|
|
673
|
+
ae as WtskBtn,
|
|
674
|
+
ye as WtskForm,
|
|
675
|
+
ve as WtskTable,
|
|
676
|
+
ke as WtskTree,
|
|
668
677
|
we as default
|
|
669
678
|
};
|
package/dist/wtsk-basic.umd.js
CHANGED
|
@@ -1 +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)})}}}));
|
|
1
|
+
(function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g.WtskBasic={},g.Vue,g.ElementPlus))})(this,(function(g,e,w){"use strict";const x=Object.assign({name:"WtskBtn",inheritAttrs:!1},{__name:"WtskBtn",setup(a){const y=e.useAttrs(),f=e.ref(!1);function h(d,k){const r={};for(const C in d)C!==k&&(r[C]=d[C]);return r}async function i(){f.value=!0;try{await y.onClick?.()}finally{f.value=!1}}return(d,k)=>{const r=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(r,e.mergeProps(h(d.$attrs,"onClick"),{loading:f.value,onClick:i}),{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3},16,["loading"])}}});var F=e.defineComponent({name:"Delete",__name:"delete",setup(a){return(y,f)=>(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"})]))}}),z=F,H=e.defineComponent({name:"Edit",__name:"edit",setup(a){return(y,f)=>(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"})]))}}),N=H,M=e.defineComponent({name:"Plus",__name:"plus",setup(a){return(y,f)=>(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"})]))}}),E=M;const $={class:"wtsk-tree-box"},O={key:0,class:"wtsk-tree-box-title"},W={key:1,class:"wtsk-tree-box-filter wtsk-form"},U={style:{display:"flex","align-items":"center"},class:"wtsk-form"},A={class:"wtsk-tree-box-tree-custom"},R={style:{display:"flex","align-items":"center"},class:"wtsk-form"},D={style:{display:"flex","align-items":"center"},class:"wtsk-form"},S=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(a,{expose:y,emit:f}){const h=e.useAttrs(),i=a,d=e.ref();let k=e.ref(""),r=e.ref("");const C=f;e.watch(k,o=>{d.value?.filter(o)});function p(o,l,s){const n=l.label?l.label:h.props?.label;if(!o)return!0;if(i.treeFilterType==="default")return l[n].includes(o);{let B=[];b(s,B,o,n);let _=!1;return B.forEach(u=>{_=_||u}),_}}function b(o,l,s,n){let B=o.data&&o.data[n]&&o.data[n].includes(s);B&&l.push(B),!B&&o.level!==1&&o.parent&&b(o.parent,l,s,n)}function m(o,l,s){i.treeCustomizeOperate||o==="delete"?C("treeOperate",o,l,s):r.value.trim()!==""?(document.documentElement.click(),C("treeOperate",o,l,s,r.value)):w.ElMessage.error("名称不能为空!")}return y({wtskTreeRef:d}),(o,l)=>{const s=e.resolveComponent("el-input"),n=e.resolveComponent("el-button"),B=e.resolveComponent("el-popover"),_=e.resolveComponent("el-popconfirm"),u=e.resolveComponent("el-tree");return e.openBlock(),e.createElementBlock("div",$,[a.treeTitle!==""?(e.openBlock(),e.createElementBlock("div",O,e.toDisplayString(a.treeTitle),1)):e.createCommentVNode("",!0),a.treeHasFilter||a.treeHasOperate?(e.openBlock(),e.createElementBlock("div",W,[a.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),a.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(a.treeAddParentText),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[a.treeHasOperate?(e.openBlock(),e.createBlock(B,{key:0,placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",onClick:l[1]||(l[1]=t=>e.isRef(r)?r.value="":r="")},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.treeAddParentText),1)]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(s,{modelValue:e.unref(r),"onUpdate:modelValue":l[2]||(l[2]=t=>e.isRef(r)?r.value=t:r=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(u,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},[a.treeHasOperate?{name:"default",fn:e.withCtx(({node:t,data:c})=>[e.createElementVNode("div",A,[e.createElementVNode("div",null,e.toDisplayString(t.label),1),e.createElementVNode("div",null,[a.treeCustomizeOperate?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(n,{type:"success",link:"",icon:e.unref(E),onClick:e.withModifiers(V=>m("add",c,t),["stop"])},null,8,["icon","onClick"]),e.createVNode(n,{type:"primary",link:"",icon:e.unref(N),onClick:e.withModifiers(V=>m("edit",c,t),["stop"])},null,8,["icon","onClick"])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(B,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"success",link:"",icon:e.unref(E),onClick:l[5]||(l[5]=e.withModifiers(V=>e.isRef(r)?r.value="":r="",["stop"]))},null,8,["icon"])]),default:e.withCtx(()=>[e.createElementVNode("div",R,[e.createVNode(s,{modelValue:e.unref(r),"onUpdate:modelValue":l[6]||(l[6]=V=>e.isRef(r)?r.value=V:r=V),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(V=>m("add",c,t),["stop"])},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("新增",-1)])]),_:1},8,["onClick"])])]),_:2},1024),e.createVNode(B,{placement:"bottom",width:280,trigger:"click"},{reference:e.withCtx(()=>[e.createVNode(n,{type:"primary",link:"",icon:e.unref(N),onClick:e.withModifiers(V=>e.isRef(r)?r.value=t.label:r=t.label,["stop"])},null,8,["icon","onClick"])]),default:e.withCtx(()=>[e.createElementVNode("div",D,[e.createVNode(s,{modelValue:e.unref(r),"onUpdate:modelValue":l[7]||(l[7]=V=>e.isRef(r)?r.value=V:r=V),placeholder:"请输入名称",clearable:""},null,8,["modelValue"]),e.createVNode(n,{type:"primary",style:{"margin-left":"10px"},onClick:e.withModifiers(V=>m("edit",c,t),["stop"])},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode("修改",-1)])]),_:1},8,["onClick"])])]),_:2},1024)],64)),e.createVNode(_,{title:"确定删除这条数据吗?","hide-icon":"",width:"170",onConfirm:V=>m("delete",c,t)},{reference:e.withCtx(()=>[e.createVNode(n,{type:"danger",link:"",icon:e.unref(z),onClick:l[8]||(l[8]=e.withModifiers(()=>{},["stop"]))},null,8,["icon"])]),_:1},8,["onConfirm"])])])]),key:"0"}:void 0]),1040)])}}}),T=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(a,{expose:y}){const f=a,h=e.computed(()=>f.formItems.filter(p=>!p.hidden)),i=e.useModel(a,"modelValue"),d={input:w.ElInput,number:w.ElInputNumber,select:w.ElSelect,date:w.ElDatePicker,switch:w.ElSwitch,treeSelect:w.ElTreeSelect};function k(p,b){if(!p||typeof p!="object")return;const m=b.split(".");let o=p;for(const l of m){if(o===null)return;o=o[l]}return o}function r(p,b,m){if(!p||typeof p!="object")return;const o=b.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 C=e.ref();return y({wtskFormRef:C}),(p,b)=>{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"),B=e.resolveComponent("el-col"),_=e.resolveComponent("el-row"),u=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(u,e.mergeProps({ref_key:"wtskFormRef",ref:C,class:["wtsk-form",a.formIsSearch?"wtsk-form-search":""]},{"label-width":a.formIsSearch?"auto":"100px",...p.$attrs},{model:i.value}),{default:e.withCtx(()=>[a.formIsSearch?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.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=>r(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(_,{key:1,gutter:16},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,t=>(e.openBlock(),e.createBlock(B,{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"])}}}),L={key:0},P=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(a,{expose:y,emit:f}){const h=a,i=e.ref(),d=e.ref({pageNum:h.tablePageNum,pageSize:h.tablePageSize});e.watch(()=>h.tablePageNum,()=>{d.value.pageNum=h.tablePageNum,d.value.pageSize=h.tablePageSize});const k=f;function r(p){d.value.pageNum=p,k("tablePageChange",{...d.value})}function C(p){d.value.pageSize=p,k("tablePageChange",{...d.value})}return y({wtskTableRef:i}),(p,b)=>{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:a.tableData,height:a.tableHasPage?a.tableHeight:"auto",stripe:""}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.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"]),a.tableHasPage?(e.openBlock(),e.createElementBlock("div",L,[e.createVNode(l,e.mergeProps({class:"wtsk-pagination"},{layout:"total, prev, pager, next, sizes","page-sizes":[5,10,20,50,100],background:!0,...a.tablePageProp},{total:a.tableTotal,"current-page":d.value.pageNum,"page-size":d.value.pageSize,onSizeChange:C,onCurrentChange:r}),null,16,["total","current-page","page-size"])])):e.createCommentVNode("",!0)],64)}}}),I=[{name:"WtskBtn",component:x},{name:"WtskTree",component:S},{name:"WtskForm",component:T},{name:"WtskTable",component:P}],j={install(a){I.forEach(({name:y,component:f})=>{a.component(y,f)})}};g.WtskBtn=x,g.WtskForm=T,g.WtskTable=P,g.WtskTree=S,g.default=j,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/index.d.ts
CHANGED
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
// Type definitions for wtsk-comps - WebStorm compatible
|
|
2
2
|
declare module 'wtsk-comps' {
|
|
3
3
|
import { Component } from 'vue'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
|
|
5
|
+
const WtskBtn: Component
|
|
6
|
+
const WtskForm: Component
|
|
7
|
+
const WtskTable: Component
|
|
8
|
+
const WtskTree: Component
|
|
9
|
+
|
|
10
|
+
export { WtskBtn, WtskForm, WtskTable, WtskTree }
|
|
11
|
+
|
|
10
12
|
const WtskBasic: {
|
|
11
13
|
install: (app: any) => void
|
|
12
14
|
}
|
|
13
|
-
|
|
15
|
+
|
|
14
16
|
export default WtskBasic
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
// WebStorm
|
|
18
|
-
declare
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// WebStorm component name recognition
|
|
20
|
+
declare module '@vue/runtime-core' {
|
|
21
|
+
interface GlobalComponents {
|
|
22
|
+
WtskBtn: any
|
|
23
|
+
WtskForm: any
|
|
24
|
+
WtskTable: any
|
|
25
|
+
WtskTree: any
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
//
|
|
27
|
-
declare
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
WtskTree: typeof import('wtsk-comps')['WtskTree']
|
|
33
|
-
}
|
|
29
|
+
// WebStorm specific declarations
|
|
30
|
+
declare global {
|
|
31
|
+
const WtskBtn: any
|
|
32
|
+
const WtskForm: any
|
|
33
|
+
const WtskTable: any
|
|
34
|
+
const WtskTree: any
|
|
34
35
|
}
|