@xmszm/core 0.0.3 → 0.0.4
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/index.cjs +1 -1
- package/dist/index.mjs +110 -110
- package/examples/package.json +1 -1
- package/examples/pnpm-lock.yaml +0 -1
- package/examples/pnpm-workspace.yaml +0 -1
- package/package.json +1 -1
- package/src/dialog/commonDialog.tsx +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var ve=Object.defineProperty;var Ye=(t,n,l)=>n in t?ve(t,n,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[n]=l;var ee=(t,n,l)=>Ye(t,typeof n!="symbol"?n+"":n,l);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=require("naive-ui"),z=require("@vicons/ionicons5"),le=require("vue-router"),E=require("dayjs"),Ne=require("lodash-es"),Le=require("./plugin/vite/initRouteMeta.cjs"),R="name",U="id";function re(t,{labelField:n=R,valueField:l=U}={}){return Object.keys(t).reduce((r,o)=>{const s=ze(t[o],o),a={...s};return a[n]=s==null?void 0:s[n],a[l]=s==null?void 0:s[l],r.concat(a)},[])}function ze(t,n){const l={[R]:e.unref(t),[U]:Number.isNaN(Number(n))?n:Number(n)};return typeof e.unref(t)=="object"?{...e.unref(t),[U]:Number.isNaN(Number(n))?n:Number(n)}:l}const ne={style:{cursor:"pointer"},tooltip:{flip:!0,arrowPointToCenter:!0,contentStyle:{minWidth:"100px",maxWidth:"300px",maxHeight:"300px",overflowY:"auto",whiteSpace:"pre-line",boxSizing:"border-box",margin:"0 -14px",padding:"0 14px"},arrowStyle:{backgroundColor:"--n-color"}}},H=(t,n)=>{const l=t.__vccOpts||t;for(const[r,o]of n)l[r]=o;return l},je={class:"filter-box"},He={class:"filter-footer"},We={__name:"FilterDialog",props:{type:{type:String,default:()=>"primary"},filterItem:{type:Array,default:()=>[]},selectItem:{type:Array,default:()=>[]},defaultItem:{type:Array,default:()=>[]},filterButtonKey:{type:Array,default:()=>["all","selectDefault"]}},emits:["submit"],setup(t,{emit:n}){var b,h;e.useCssVars(x=>({e0ecc754:e.unref(o).infoColor}));const l=t,r=n,o=V.useThemeVars(),s=e.ref([]);e.watchEffect(()=>{s.value=l.selectItem});const a=e.ref([]),d=[{key:"all",label:"全选",onCheck:()=>{var x;return s.value=(x=l.filterItem)==null?void 0:x.map(m=>m.key)},unCheck:()=>s.value=[]},{key:"selectDefault",label:"选中默认",onCheck:()=>s.value=l.defaultItem,unCheck:()=>s.value=l.selectItem},{key:"currentSelect",label:"选中当前列表",onCheck:()=>s.value=l.selectItem,unCheck:()=>s.value=l.selectItem}];e.watchEffect(()=>{a.value=d.filter(x=>l.filterButtonKey.includes(x.key)),console.log(l.filterButtonKey)});function i(){r("submit",s.value)}const c=e.ref(((b=l.filterItem)==null?void 0:b.length)===((h=l.selectItem)==null?void 0:h.length)?["all"]:[]);function y(x,m){var S,D,u,_;console.log(x),console.log(m),m.actionType==="uncheck"?((D=(S=a.value)==null?void 0:S.find(g=>(g==null?void 0:g.key)===m.value))==null||D.unCheck(),c.value=[]):((_=(u=a.value)==null?void 0:u.find(g=>(g==null?void 0:g.key)===m.value))==null||_.onCheck(),c.value=[m.value])}return(x,m)=>{const S=e.resolveComponent("n-ellipsis"),D=e.resolveComponent("n-checkbox"),u=e.resolveComponent("n-checkbox-group"),_=e.resolveComponent("n-button");return e.openBlock(),e.createElementBlock("div",je,[e.createVNode(u,{value:s.value,"onUpdate:value":m[0]||(m[0]=g=>s.value=g),class:"filter-main"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filterItem,g=>(e.openBlock(),e.createBlock(D,{key:g.key,value:g.key,class:"filter-item"},{default:e.withCtx(()=>[e.createVNode(S,{style:{"max-width":"100px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.title),1)]),_:2},1024)]),_:2},1032,["value"]))),128))]),_:1},8,["value"]),e.createElementVNode("div",He,[e.createVNode(u,{type:l.type,value:c.value,"onUpdate:value":y},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,g=>(e.openBlock(),e.createBlock(D,{key:g.key,value:g.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["type","value"]),e.createVNode(_,{class:"submit-btn",type:l.type,onClick:i},{default:e.withCtx(()=>[...m[1]||(m[1]=[e.createTextVNode(" 保存 ",-1)])]),_:1},8,["type"])])])}}},Ke=H(We,[["__scopeId","data-v-2aba8b9e"]]),B={baseURL:"",hasPermission:null,uploadMethod:null,dialog:{instance:null,inheritTheme:!0,themeOverrides:null}};function Ve(t={}){if(t.baseURL!==void 0&&(B.baseURL=t.baseURL),t.hasPermission!==void 0){if(typeof t.hasPermission!="function")throw new TypeError("hasPermission 必须是一个函数");B.hasPermission=t.hasPermission}if(t.uploadMethod!==void 0){if(typeof t.uploadMethod!="function")throw new TypeError("uploadMethod 必须是一个函数");B.uploadMethod=t.uploadMethod}if(t.dialog!==void 0){if(typeof t.dialog!="object")throw new TypeError("dialog 必须是一个对象");t.dialog.instance!==void 0&&(B.dialog.instance=t.dialog.instance),t.dialog.inheritTheme!==void 0&&(B.dialog.inheritTheme=t.dialog.inheritTheme),t.dialog.themeOverrides!==void 0&&(B.dialog.themeOverrides=t.dialog.themeOverrides)}return B}function Qe(){return{...B}}function _e(){return B.baseURL}function Ge(){return B.hasPermission}function Oe(){return B.uploadMethod}function De(){return{...B.dialog}}function oe(t){B.dialog.instance=t}function Ae(){return B.dialog.instance}function K(t){return B.hasPermission?B.hasPermission(t):(console.warn("hasPermission 未配置,默认返回 true。请使用 setupConfig 配置权限检查函数。"),!0)}const Se={mounted(t,n){const l=n.value;if(!l)return;(Array.isArray(l)?l:[l]).some(s=>K(s))||(t.style.display="none",t._originalDisplay=t.style.display||"")},updated(t,n){const l=n.value;if(!l){t._originalDisplay!==void 0?t.style.display=t._originalDisplay||"":t.style.display="";return}(Array.isArray(l)?l:[l]).some(s=>K(s))?t._originalDisplay!==void 0?t.style.display=t._originalDisplay||"":t.style.display="":t.style.display="none"},unmounted(t){delete t._originalDisplay}};let Pe=null;function v(t){var n;t&&(Pe=t,(n=t._context.directives)!=null&&n.corePermission||t.directive("corePermission",Se))}function Je(){var t;try{const n=typeof require<"u"?require("vue"):null;if(!n)return!1;const{getCurrentInstance:l}=n,r=l==null?void 0:l();if((t=r==null?void 0:r.appContext)!=null&&t.app)return v(r.appContext.app),!0}catch{}return!1}function Me(){return Pe}const be="filter_key",Xe=e.defineComponent({__name:"DataTable",props:{data:{default:()=>[]},pagination:{default:void 0},columns:{default:()=>[{title:"测试案例"}]},oprColumns:{default:null},selectColumns:{default:null},defaultColumns:{default:()=>[]},summaryColumns:{type:Function,default:null},emptyText:{default:"没有数据"},emptyIcon:{default:""},isFilter:{type:Boolean,default:!1},isEllipsis:{type:Boolean,default:!0},virtual:{type:[Object,Boolean],default:()=>({})},singleColumn:{type:Boolean,default:!1}},emits:["sorted"],setup(t,{expose:n,emit:l}){var N;const r=e.getCurrentInstance();(N=r==null?void 0:r.appContext)!=null&&N.app&&v(r.appContext.app);const o=t,s=le.useRoute(),a=l,d=()=>{try{return(s==null?void 0:s.fullPath)||(s==null?void 0:s.path)||""}catch{return""}},i=e.computed(()=>(console.log("table -data",o.data),o.data));function c(p){window.localStorage.setItem(be,JSON.stringify(p))}function y(){return JSON.parse(window.localStorage.getItem(be)||"{}")||{}}const b=e.ref(y()),h=e.ref([]),x=e.ref(0);function m(p){if(o.summaryColumns)return[o.selectColumns,...e.unref(o.columns||[]),o.oprColumns].reduce((f,w)=>{var M,F;return w!=null&&w.key?f[w.key]=((F=(M=o.summaryColumns)==null?void 0:M.call(o,p))==null?void 0:F[w.key])||{value:null}:f[Ne.uniqueId("table")]={value:null},f},{})}const S=e.ref([]);e.watch(()=>e.unref(o.columns),()=>{D()},{immediate:!0}),e.watch(()=>o.oprColumns,p=>{console.log("oprColumns",p)});function D(){var F;const p=e.unref(o.columns||[]),f=d();h.value=f&&((F=b.value)==null?void 0:F[f])||(p==null?void 0:p.map((I,O)=>(I==null?void 0:I.key)||String(E().valueOf()+O)));const w=o.isFilter?p.filter(I=>{var O;return(O=h.value)==null?void 0:O.includes(I.key)}):[...p];o.selectColumns&&w.unshift({key:"selectKey",...o.selectColumns}),o.oprColumns&&w.push(o.oprColumns);let M=0;S.value=w.reduce((I,O)=>{var Y;if(O!=null&&O.display&&console.log("display",O==null?void 0:O.display),!((O==null?void 0:O.display)??!0))return I;const P={align:"center",width:120,...O,key:(O==null?void 0:O.key)||Ne.uniqueId("table"),ellipsis:O!=null&&O.ellipsis||o.isEllipsis?O!=null&&O.ellipsisProp?O==null?void 0:O.ellipsisProp(ne):ne:!1,"ellipsis-component":"ellipsis",title:()=>{const q=(O==null?void 0:O.label)||(O==null?void 0:O.title)||"";return e.createVNode("div",{style:{width:"100%",whiteSpace:"pre-wrap"}},[typeof q=="string"?q:q==null?void 0:q()])}};return O!=null&&O.sorter&&(P.renderSorterIcon=({order:q})=>{const{Icon:G,title:J}=W[q];return e.createVNode(V.NTooltip,null,{trigger:()=>G,default:()=>J})},P.sorter={multiple:1,fn:O.sorter}),M+=P!=null&&P.width?Number.parseInt(String(P==null?void 0:P.width)):(typeof(P==null?void 0:P.title)=="string"?((Y=P==null?void 0:P.title)==null?void 0:Y.length)*30:0)||0,I.push(P),I},[]),x.value=M,console.log("计算")}function u(){return e.createVNode(V.NButton,{type:"info",onClick:()=>_()},{default:()=>"筛选字段",icon:()=>e.createVNode(z.Funnel,null,null)})}function _(){const{cancel:p}=ce({title:"筛选字段",read:!0,options:[{key:"filter-dialog",render:()=>e.createVNode(Ke,{style:{width:"100%",margin:"0",padding:0},filterItem:e.unref(o.columns||[]),selectItem:h.value,defaultItem:o.defaultColumns,onSubmit:f=>{const w=d();w&&(b.value[w]=f,c(b.value)),D(),p()}},null)}]},{closable:!1,style:{width:"500px"}})}function g(p){if(console.log("onSorter",p),!p)return;Q(p).forEach(w=>{var M,F,I;console.log("v",w),w!=null&&w.sorter&&((I=(M=w==null?void 0:w.sorter)==null?void 0:M.fn)==null||I.call(M,(O,P,Y)=>{var q;(q=W[w.order])==null||q.fn(O,Y),P.fetchData()},{field:w==null?void 0:w.columnKey,value:(F=W[w==null?void 0:w.order])==null?void 0:F.value,isClick:!e.isProxy(w)}))}),a("sorted")}return n({filterHandle:_,filterButton:u,initColumns:D}),e.onMounted(()=>{}),(p,f)=>{const w=e.resolveComponent("n-empty");return e.openBlock(),e.createBlock(e.unref(V.NDataTable),{data:i.value,columns:S.value,"scroll-x":x.value,"single-column":o.singleColumn,summary:o.summaryColumns?m:void 0,"summary-placement":"bottom",pagination:o.pagination,"row-props":()=>({style:{height:"60px"}}),"flex-height":"",remote:"","virtual-scroll":!!(o.virtual??o.data.length>1e3),style:{flex:"1"},"onUpdate:sorter":g},{empty:e.withCtx(()=>[e.renderSlot(p.$slots,"empty",{},()=>[e.createVNode(w,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.emptyText),1)]),_:1})],!0)]),_:3},8,["data","columns","scroll-x","single-column","summary","pagination","virtual-scroll"])}}}),Ie=H(Xe,[["__scopeId","data-v-9de17e68"]]);function Ze(t){Ve({uploadMethod:t})}function Be(...t){const n=Oe();if(typeof n!="function")throw new TypeError("请先通过 setupConfig({ uploadMethod: fn }) 或 registryUpload(fn) 注册上传实现");return n(...t)}function T(t,n=null){if(t&&!(t!=null&&t.startsWith("http"))){const l=_e();return l?n?`${l}${t}?x-oss-process=style/w${n}`:`${l}${t}`:(console.warn('BASE_URL 未配置,返回原始 URL。请使用 setupConfig({ baseURL: "..." }) 配置。'),t)}return t}const et="/admin/file",tt={__name:"ImagesUpload",props:{value:{type:[Array,String],default:()=>[]},max:{type:Number,default:()=>5},lib:{type:Boolean,default:()=>!0},clip:{type:Boolean,default:()=>!1},read:{type:Boolean,default:()=>!1},size:{type:Number,default:()=>100},width:{type:Number,default:()=>100},height:{type:Number,default:()=>100},mode:{type:String,default:()=>"fill"},formData:{type:Object,default:()=>{}}},emits:["update:value","complete"],setup(t,{emit:n}){const l=t,r=n,o=e.ref([]);e.watch(()=>l.value,i=>{console.log("props.value",i),o.value=l.max===1?i?typeof i!="string"?i!=null&&i.length?[{id:E().valueOf(),name:`img${E().valueOf()}`,url:T(i[0]),thumbnailUrl:T(i[0]),fullPath:i[0],status:"finished"}]:[]:[{id:E().valueOf(),name:`img${E().valueOf()}`,url:T(i),fullPath:i,thumbnailUrl:T(i),status:"finished"}]:[]:(i==null?void 0:i.map((c,y)=>({id:E().valueOf()+y,name:`img${E().valueOf()}`,url:T(c),fullPath:c,thumbnailUrl:T(c),status:"finished"})))||[],console.log("1",o.value)},{immediate:!0});function s(...i){a(i[0])}async function a({file:i,onFinish:c,onError:y,onProgress:b},h){const x=new FormData;i.status==="pending"&&(x.append("file",i.file),l.formData&&Object.keys(l.formData).length&&Object.keys(l.formData).forEach(m=>{x.append(m,l.formData[m])}),Be({url:et,data:x,method:"post",onUploadProgress:({percent:m})=>b({percent:m})}).then(m=>{const{url:S}=m.data;i.url=T(S),i.fullPath=S,i.thumbnailUrl=T(S),c(),d()}).catch(()=>{i=null,y()}).finally(()=>{}))}function d(){console.log("onSubmit",o.value);const i=o.value.reduce((c,y)=>(y.status==="finished"&&(y!=null&&y.fullPath)&&c.push(y.fullPath),c),[]);l.max===1&&i.length===1?r("update:value",i[0]):i.length?r("update:value",i):r("update:value",l.max===1?null:[])}return(i,c)=>{const y=e.resolveComponent("n-upload"),b=e.resolveComponent("n-space");return e.openBlock(),e.createBlock(b,{align:"end","wrap-item":!1},{default:e.withCtx(()=>[e.createVNode(y,{"file-list":o.value,"onUpdate:fileList":c[0]||(c[0]=h=>o.value=h),accept:".jpeg,.jpg,.png","list-type":"image-card","custom-request":s,max:l.read?Array.isArray(l.value)?l.value.length:1:l.max,"show-retry-button":!1,"show-remove-button":!l.read,class:"upload-box",style:e.normalizeStyle({...l.size?{"--image-w":`${l.size}px`,"--image-h":`${l.size}px`}:{"--image-w":`${l.width}px`,"--image-h":`${l.height}px`},"--image-mode":l.mode}),onFinish:c[1]||(c[1]=()=>{d(),r("complete")}),onRemove:c[2]||(c[2]=(h,x)=>(o.value.splice(x,1),d(),!1))},null,8,["file-list","max","show-remove-button","style"])]),_:1})}}},lt=H(tt,[["__scopeId","data-v-54e2cc87"]]);function ae(t=[],n=R,l=U){return e.unref(t).reduce((r,o)=>(r[o[l]]={...o,[n]:o[n],[l]:o[l]},r),{})}function Q(t){return Array.isArray(t)?t:[t]}function xe(t,n="YYYY-MM-DD",l={emptyText:""}){return t?E(Number.isNaN(Number(t))?t:Number(t)).format(n):(l==null?void 0:l.emptyText)||""}function nt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const at={input:({label:t,key:n,props:l,readProps:r,format:o=null,read:s},{_value:a,_isRead:d})=>{const i=e.unref(a),c=e.unref(d);return s??c?e.createVNode(V.NEllipsis,r,{default:()=>[o?o==null?void 0:o(i[n],i):i[n]]}):e.createVNode(V.NInput,e.mergeProps({value:i[n],"onUpdate:value":y=>i[n]=y,clearable:!0,placeholder:`请输入${e.unref(t)}`},l),{...(l==null?void 0:l.slots)||{}})},select:({label:t,key:n,props:l,options:r=[],loading:o=!1,format:s=null,read:a},{_value:d,_isRead:i})=>{var h,x;const c=e.unref(d),y=e.unref(i),b=Array.isArray(r)?r:typeof r=="function"?r(c[n]):[];return a??y?e.createVNode("div",null,[s?s==null?void 0:s(c[n],b):((x=(h=ae(b,(l==null?void 0:l.labelField)||R,(l==null?void 0:l.valueField)||U))==null?void 0:h[c[n]])==null?void 0:x[(l==null?void 0:l.labelField)||R])||c[n]]):e.createVNode(V.NSelect,e.mergeProps({value:c[n],"onUpdate:value":m=>c[n]=m,options:b,loading:e.unref(o),clearable:!0,filterable:!0,"fallback-option":()=>(l!=null&&l.asyncFallback||(c[n]=null),!1),labelField:(l==null?void 0:l.labelField)||R,valueField:(l==null?void 0:l.valueField)||U,placeholder:`请选择${e.unref(t)}`,style:"width:100%","max-tag-count":"responsive"},l),{...(l==null?void 0:l.slots)||{}})},date:({label:t,key:n,props:l,formatTime:r="YYYY-MM-DD",type:o="date",format:s,read:a},{_value:d,_isRead:i})=>{const c=e.unref(d),y=e.unref(i);return a??y?e.createVNode("div",null,[s?s==null?void 0:s(c[n]):xe(c[n],r)]):e.createVNode(V.NDatePicker,e.mergeProps({"formatted-value":c[n],"onUpdate:formatted-value":b=>{c[n]=b},type:o,clearable:!0,placeholder:`请选择${e.unref(t)}`,"update-value-on-close":!["year"].includes(l==null?void 0:l.type),style:"width:100%"},l),{...(l==null?void 0:l.slots)||{}})},time:({label:t,key:n,props:l,format:r,formatTime:o="YYYY-MM-DD",read:s},{_value:a,_isRead:d})=>{const i=e.unref(a),c=e.unref(d);return s??c?e.createVNode("div",null,[r?r==null?void 0:r(i[n]):xe(i[n],o)]):e.createVNode(V.NTimePicker,e.mergeProps({"formatted-value":i[n],"onUpdate:value":(y,b)=>{console.log("v",b),i[n]=b},clearable:!0,format:"HH:mm:ss",style:"width:100%",placeholder:`请选择${e.unref(t)}`},l),{...(l==null?void 0:l.slots)||{}})},dateRange:({key:t,props:n,type:l="datetimerange",read:r},{_value:o,_isRead:s})=>{var y,b;const a=e.unref(o),d=e.unref(s),i={date:"YYYY-MM-DD",datetime:"YYYY-MM-DD HH:mm:ss",time:"HH:mm:ss",datetimerange:"YYYY-MM-DD HH:mm:ss",daterange:"YYYY-MM-DD"},c=n!=null&&n.format?(b=(y=n==null?void 0:n.format)==null?void 0:y.replace("yyyy","YYYY"))==null?void 0:b.replace("dd","DD"):i[(n==null?void 0:n.type)||l];return console.log("formatStr type",l),console.log("formatStr",c),r??d?e.createVNode("div",null,[Array.isArray(t)?`${a==null?void 0:a[t==null?void 0:t[0]]} - ${a==null?void 0:a[t==null?void 0:t[1]]}`:a==null?void 0:a[t]]):e.createVNode(V.NDatePicker,e.mergeProps({"formatted-value":Array.isArray(t)?a!=null&&a[t==null?void 0:t[0]]&&(a!=null&&a[t==null?void 0:t[1]])?[E(a==null?void 0:a[t==null?void 0:t[0]]).format(c),E(a==null?void 0:a[t==null?void 0:t[1]]).format(c)]:null:(a==null?void 0:a[t])||null,"onUpdate:formatted-value":h=>{console.log(h),h&&![i.datetime,i.datetimerange].includes(c)&&(h=h.map((x,m)=>E(x,c)[m?"endOf":"startOf"]("day").format(c))),Array.isArray(t)?(a[t==null?void 0:t[0]]=h==null?void 0:h[0],a[t==null?void 0:t[1]]=h==null?void 0:h[1]):a[t]=h},"update-value-on-close":!["year","month"].includes(n==null?void 0:n.type),type:l,clearable:!0,style:"width:100%"},n),{...(n==null?void 0:n.slots)||{}})},radio:({key:t,options:n=[],props:l,radioLabelProps:r,read:o},{_value:s,_isRead:a,labelField:d,valueField:i})=>{var b,h;const c=e.unref(s),y=e.unref(a);return o??y?e.createVNode("div",null,[(h=(b=ae(Array.isArray(n)?n:[],(l==null?void 0:l.labelField)||d||R,(l==null?void 0:l.valueField)||i||U))==null?void 0:b[c[t]])==null?void 0:h[(l==null?void 0:l.labelField)||d||R]]):e.createVNode(V.NRadioGroup,e.mergeProps({style:{width:"100%"},value:c[t],"onUpdate:value":x=>c[t]=x},l),{...(l==null?void 0:l.slots)||{},default:()=>e.createVNode(V.NSpace,e.mergeProps({"item-wrap":!1},(l==null?void 0:l.radioProps)||{}),{default:()=>{var x;return[(x=Array.isArray(n)?n:[])==null?void 0:x.map(m=>e.createVNode(V.NRadio,{key:m.value,value:m==null?void 0:m[(l==null?void 0:l.valueField)||i||U],class:"items-center"},{default:()=>[e.createVNode("div",(r==null?void 0:r(m))||{},[m==null?void 0:m[(l==null?void 0:l.labelField)||d||R]])]}))]}})})},inputPhone:({label:t,key:n,props:l,read:r},{_value:o,_isRead:s})=>{const a=e.unref(o),d=e.unref(s);return r??d?e.createVNode("div",null,[a[n]]):e.createVNode(V.NInput,e.mergeProps({value:a[n],"onUpdate:value":i=>a[n]=i,clearable:!0,style:"width:100%","allow-input":i=>!i||/^\d$/.test(i)||i.length<=11,placeholder:`请输入${e.unref(t)}`},l),{...l==null?void 0:l.slots})},inputNumber:({label:t,key:n,props:l,read:r},{_value:o,_isRead:s})=>{const a=e.unref(o),d=e.unref(s);return r??d?e.createVNode("div",null,[a[n]]):e.createVNode(V.NInputNumber,e.mergeProps({value:typeof a[n]=="string"&&a[n]?Number(a[n]):a[n],"onUpdate:value":i=>{a[n]=i},showButton:!1,clearable:!0,style:"width:100%",placeholder:`请输入${e.unref(t)}`,min:0},l),{...(l==null?void 0:l.slots)||{}})},uploadFile:({key:t,props:n},{_value:l})=>{const r=e.unref(l);return e.createVNode(V.NUpload,e.mergeProps({multiple:!0,max:1,accept:".xls,.xlsx","file-list":r[t],"onUpdate:file-list":o=>r[t]=o},n),{default:()=>[e.createVNode(V.NUploadDragger,null,{default:()=>[e.createVNode("div",{style:"margin-bottom: 12px"},[e.createVNode(V.NIcon,{size:"48",depth:3},{default:()=>[e.createVNode(z.ArchiveOutline,null,null)]})]),e.createVNode(V.NText,{style:"font-size: 16px"},{default:()=>[e.createTextVNode("点击或者拖动文件到该区域来上传")]})]})]})},dataTable:({key:t,loading:n=!1,props:l,options:r,opr:o,pageState:s},{_value:a,_isRead:d})=>{var h;const i=e.unref(a);console.log(n),console.log(s);const c=(h=s==null?void 0:s.data)!=null&&h.length?s.data:i[t],y=Array.isArray(r)?r:typeof r=="function"?r(i[t]):[],b={data:c,columns:y,maxHeight:200,minHeight:200,isEllipsis:!1,oprColumns:o,loading:s==null?void 0:s.loading,...l};return e.createVNode(Ie,b,null)},progress:({key:t,props:n},{_value:l})=>{const r=e.unref(l);return e.createVNode(V.NProgress,e.mergeProps({percentage:r[t]},n),null)},line:()=>e.createVNode(V.NDivider,null,null),image:({key:t,props:n,read:l},{_isRead:r,_value:o})=>{const s=e.unref(o),a=e.unref(r);return e.createVNode(lt,e.mergeProps({value:s[t],"onUpdate:value":d=>s[t]=d,max:1},n,{read:l??a}),null)},button:({onClick:t,props:n,text:l},{_value:r})=>{const o=e.unref(r);return e.createVNode(V.NButton,e.mergeProps({type:"info"},n,{onClick:()=>n!=null&&n.onClick?n==null?void 0:n.onClick(o):t==null?void 0:t(o)}),nt(l)?l:{default:()=>[l]})},switch:({key:t,props:n,read:l},{_isRead:r,_value:o})=>{const s=e.unref(o),a=e.unref(r);return l??a?e.createVNode("div",null,[s[t]?"是":"否"]):e.createVNode(V.NSwitch,e.mergeProps({value:s[t],"onUpdate:value":d=>s[t]=d},n),{...(n==null?void 0:n.slots)||{}})},checkbox:({key:t,options:n=[],props:l,read:r},{_value:o,_isRead:s,labelField:a,valueField:d})=>{var y,b,h;const i=e.unref(o),c=e.unref(s);return r??c?e.createVNode("div",null,[(h=(b=(y=Array.isArray(n)?n:[])==null?void 0:y.filter(x=>{var m;return(m=i[t])==null?void 0:m.includes(x[(l==null?void 0:l.valueField)||d||U])}))==null?void 0:b.map(x=>x[(l==null?void 0:l.labelField)||a||R]))==null?void 0:h.join("、")]):e.createVNode(V.NCheckboxGroup,e.mergeProps({value:i[t],"onUpdate:value":x=>i[t]=x,style:{width:"100%"}},l),{...(l==null?void 0:l.slots)||{},default:()=>e.createVNode(V.NSpace,(l==null?void 0:l.checkBoxProps)||{},{default:()=>{var x;return[(x=Array.isArray(n)?n:[])==null?void 0:x.map(m=>e.createVNode(V.NCheckbox,{key:m==null?void 0:m[(l==null?void 0:l.valueField)||d||U],value:m==null?void 0:m[(l==null?void 0:l.valueField)||d||U]},{default:()=>[m==null?void 0:m[(l==null?void 0:l.labelField)||a||R]]}))]}})})},filterList:({key:t,props:n,options:l},{_value:r})=>(e.unref(r),e.createVNode("div",null,[e.createTextVNode("FilterSelect 组件需要外部提供")]))};let L={};class rt{constructor(){ee(this,"defaultMap",null);ee(this,"extendOptions",null);console.log("DefaultOptions init"),this.defaultMap=null,this.init()}set(n,l){this.defaultMap&&this.defaultMap.set(n,l)}get(n){if(this.defaultMap)return this.defaultMap.get(n)}clear(){var n;(n=this.defaultMap)==null||n.clear()}setupOptions(n,l){if(!this.defaultMap)return;const r=this.defaultMap.size>0?[...this.defaultMap.keys()]:[];if(this.defaultMap.has(n))return console.error(`${n} 已存在,不能使用${r==null?void 0:r.join("、")}`);this.defaultMap.set(n,l)}setupExtendOptions(n,l){L||(L={}),L!=null&&L[n]||(L[n]=l)}getAllOptions(){var l;const n={};return(l=this.defaultMap)==null||l.forEach((r,o)=>{n[o]=r}),n}getOptions(n=[]){console.log("getOptions",this.defaultMap);const l={};return n.forEach(r=>{var o;(o=this.defaultMap)!=null&&o.has(r)&&(l[r]=this.defaultMap.get(r))}),l}initOptions(n={}){Object.keys(n).forEach(l=>{this.setupOptions(l,n[l])})}initSetup(n){this.defaultMap&&this.clear(),this.defaultMap=new Map,this.initOptions(at),n&&n(),this.initOptions(L)}init(n){this.initSetup(n)}}const ue=new rt,ie=(t=[])=>ue.getOptions(t);function ot(){return ue.getAllOptions()}function ut(t,n){return ue.setupExtendOptions(t,n)}const it=["xlink:href","fill"],st=e.defineComponent({__name:"SvgIcon",props:{name:{type:String,required:!0},color:{type:String,default:""}},setup(t){const n=t,l=e.computed(()=>`#svg-${n.name}`);return(r,o)=>(e.openBlock(),e.createElementBlock("svg",e.mergeProps({class:"svg-icon"},r.$attrs,{style:{color:t.color},"aria-hidden":""}),[e.createElementVNode("use",{"xlink:href":l.value,fill:t.color},null,8,it)],16))}}),ct=H(st,[["__scopeId","data-v-9dbe5f10"]]);function ft(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const Fe=e.defineComponent((t,{emit:n})=>{var D;const l=e.getCurrentInstance();if((D=l==null?void 0:l.appContext)!=null&&D.app)v(l.appContext.app);else{const u=Me();u&&v(u)}const r=e.ref(t.value||{}),o=e.computed(()=>t.read||!1);let s=t.formRef;e.watch(()=>t.formRef,u=>s=u);const a=e.computed(()=>t.option||[]);function d(u){return u.reduce((_,g)=>{_.push((g==null?void 0:g.way)??"input");const N=[g==null?void 0:g.default,g==null?void 0:g.suffix,g==null?void 0:g.prefix].reduce((p,f)=>{var w;return Array.isArray(f)?p=p.concat(f):f&&((w=Object.keys(f))!=null&&w.length)&&p.push(f),p},[]);return console.log(N),N.length&&N.forEach(p=>_.push((p==null?void 0:p.way)??"input")),_},[])}const i=e.computed(()=>[...new Set(d(t.option||[]))]),c=ie(i.value);console.log(t.option),console.log("defaultOption",c,i.value),e.watch(()=>r.value,u=>{n("update:value",u)},{immediate:!0});function y(u,_){let g={};const N=typeof u;let p=null;try{return u?N==="string"||N==="object"?p=u:N==="function"&&(p=u(e.unref(r),{formRef:s,resetForm:()=>{var f;return(f=s==null?void 0:s.value)==null?void 0:f.restoreValidation()},close:()=>{var f;return(f=t.cancel)==null?void 0:f.call(t)},setValue:b})):p=u,typeof p=="object"&&!Array.isArray(p)?Object.keys(p).forEach(f=>{const w=p[f];e.isRef(w)?g[f]=e.unref(w):g[f]=w}):g=p,g}catch{return{}}}e.watch(()=>t.value,u=>{console.log(u),r.value=u||{}},{immediate:!0});function b(u){r.value=u}function h(u){return e.createVNode(V.NSpace,e.mergeProps({"wrap-item":!1,wrap:!!(u!=null&&u.isWrap),align:"center",style:{width:"100%"}},(u==null?void 0:u.contentProps)||{}),{default:()=>[x(u==null?void 0:u.prefix),x((u==null?void 0:u.default)||u),x(u==null?void 0:u.suffix)]})}function x(u){if(!u)return;let _=u;return typeof u=="function"&&(_=y(u)),_=y(_),e.isVNode(_)?(console.log("??? isVNode"),_):typeof _=="string"?(console.log("??? string"),_):Array.isArray(_)?(console.log("???"),e.createVNode(e.Fragment,null,[_.map((g,N)=>e.createVNode(S,{item:g,index:N},null))])):typeof _=="object"?(console.log("??? object"),_.props=y((_==null?void 0:_.props)??{}),e.unref(e.computed(()=>{var g;return(g=c==null?void 0:c[(_==null?void 0:_.way)||"input"])==null?void 0:g.call(c,m(_),{_value:_!=null&&_.queryType?e.unref(r)[_==null?void 0:_.queryType]:e.unref(r),_formRef:e.unref(s),_isRead:e.unref(o),labelField:R,valueField:U})}))):null}function m(u){return e.unref(u.enum)&&(u.options=re(e.unref(u.enum))),u}function S({item:u,index:_}){var g,N,p,f,w,M;return u.formItemProps=y(u==null?void 0:u.formItemProps),u.formItemProps||(u.formItemProps={}),!((g=u.formItemProps)!=null&&g.labelWidth)&&((N=t.formProps)!=null&&N.labelWidth)&&(u.formItemProps.labelWidth=(p=t.formProps)==null?void 0:p.labelWidth),e.withDirectives(e.createVNode(V.NFormItem,e.mergeProps({key:_,showLabel:!(u!=null&&u.noLabel)},u==null?void 0:u.formItemProps,{labelWidth:((f=u==null?void 0:u.formItemProps)==null?void 0:f.labelWidth)||"auto",feedback:y((w=u==null?void 0:u.formItemProps)==null?void 0:w.feedback),style:{padding:"0 15px",boxSizing:"border-box",width:"100%",...((M=u==null?void 0:u.formItemProps)==null?void 0:M.style)||{}},path:String(u.key)}),{default:()=>h(u),label:()=>{var F,I;return e.createVNode("div",{class:u!=null&&u.labelClass||u!=null&&u.labelSuffix?` ${u==null?void 0:u.labelClass} flex items-center gap-col-9px`:""},[u!=null&&u.labelSuffix?typeof(u==null?void 0:u.labelSuffix)=="string"?e.createVNode(V.NIcon,{class:"wh-20px c-inherit",...u==null?void 0:u.labelSuffixProps},{default:()=>[e.createVNode(ct,{name:u==null?void 0:u.labelSuffix},null)]}):(F=u==null?void 0:u.labelSuffix)==null?void 0:F.call(u):e.createVNode(e.Fragment,null,null),`${e.unref(typeof(u==null?void 0:u[t.labelField||"label"])=="function"?(I=u==null?void 0:u[t.labelField||"label"])==null?void 0:I.call(u):u==null?void 0:u[t.labelField||"label"])||""} ${o.value||u.read," "}
|
|
2
|
-
`])}}),[[e.resolveDirective("corePermission"),u==null?void 0:u.permission]])}return()=>{let u;return e.createVNode(V.NSpace,{"wrap-item":!1,size:[0,8],style:{width:"100%",minHeight:"100%",alignContent:"baseline",...t.style}},ft(u=a.value.map(({isRender:_=!0,...g},N)=>(typeof e.unref(_)!="boolean"?_!=null&&_(e.unref(r)):e.unref(_))?g!=null&&g.render?g==null?void 0:g.render(e.unref(r),N,{setValue:b,value:e.unref(r)}):e.createVNode(S,{item:g,index:N},null):null))?u:{default:()=>[u]})}},{props:{option:{type:Array,default:()=>[]},value:{type:Object,default:()=>({})},read:{type:Boolean,default:()=>!1},labelField:{type:String,default:()=>R},valueField:{type:String,default:()=>U},style:{type:Object,default:()=>({})},formRef:{type:Object,default:()=>({})},formProps:{type:Object,default:()=>({})}},emits:["update:value"]}),dt={showIcon:!1,autoFocus:!1};function Re({options:t=[],model:n,labelField:l="label",formOpr:r={}}){return e.computed(()=>(t==null?void 0:t.reduce((o,{fields:s,...a})=>{var i,c;Array.isArray(a==null?void 0:a.key)&&a.key.forEach(y=>{a!=null&&a.required&&(o[String(y)]={key:y,type:"any",required:a!=null&&a.required?typeof(a==null?void 0:a.required)=="function"?a==null?void 0:a.required(e.unref(n),{...r}):a==null?void 0:a.required:!1,message:(a==null?void 0:a.message)||`请选择${a==null?void 0:a[l]}`,fields:s})});const d=a!=null&&a.rule?typeof(a==null?void 0:a.rule)!="function"?a==null?void 0:a.rule:a==null?void 0:a.rule(e.unref(n),{...r}):s?{key:a==null?void 0:a.key,type:"any",required:a!=null&&a.required?typeof(a==null?void 0:a.required)=="function"?a==null?void 0:a.required(e.unref(n),{...r}):a==null?void 0:a.required:!1,message:(a==null?void 0:a.message)||`请${(i=a==null?void 0:a.options)!=null&&i.length?"选择":"输入"}${a==null?void 0:a[l]}`,fields:s}:{key:a==null?void 0:a.key,type:"any",required:a!=null&&a.required?typeof(a==null?void 0:a.required)=="function"?a==null?void 0:a.required(e.unref(n),{...r}):a==null?void 0:a.required:!1,message:(a==null?void 0:a.message)||`请${(c=a==null?void 0:a.options)!=null&&c.length?"选择":"输入"}${a==null?void 0:a[l]}`,...Array.isArray(a==null?void 0:a.key)?{validator:y=>(console.log(y),!(a==null?void 0:a.key.every(h=>e.unref(n)[h]))&&(a!=null&&a.required)?new Error(y==null?void 0:y.message):!0)}:{}};return d!=null&&d.required&&(o[String(a==null?void 0:a.key)]=d),o},{}))||{})}const se=e.defineComponent({__name:"DataForm",props:e.mergeModels({value:{},options:{default:()=>[]},isNo:{type:Boolean,default:!0},read:{type:Boolean,default:!1},labelField:{default:"label"},contentStyle:{default:()=>({})},rules:{default:()=>({})},formProps:{default:()=>({})},formItemProps:{default:()=>({})},dialog:{type:Boolean,default:!1}},{value:{type:Object,default:()=>({})},valueModifiers:{}}),emits:["update:value"],setup(t,{expose:n}){var i;const l=e.getCurrentInstance();(i=l==null?void 0:l.appContext)!=null&&i.app&&v(l.appContext.app);const r=t,o=e.computed(()=>r.options),s=e.ref(),a=e.useModel(t,"value"),d=e.computed(()=>e.unref(o.value?Re({options:o.value,model:a,labelField:r.labelField,formOpr:{formRef:s}}):{}));return console.log(d.value),n({formRef:s,getRule:()=>d.value,valid:(c=[])=>(console.log("?? valid",c),new Promise((y,b)=>{var x;const h=Q(c);(x=s.value)==null||x.validate(m=>{if(m)return b(m);y()},m=>h.length?h.includes(m==null?void 0:m.key):!0)})),confirm:c=>new Promise((y,b)=>{var h;(h=s.value)==null||h.validate(x=>{if(x)return b(x);c&&c(e.unref(a)),y(e.unref(a))})})}),(c,y)=>(e.openBlock(),e.createBlock(e.unref(V.NForm),e.mergeProps({ref_key:"formRef",ref:s,model:a.value,rules:r.read?{}:d.value,"label-placement":"left","label-width":"100px","require-mark-placement":"right-hanging",class:r.dialog?r.read?"core-dialog-content":"core-dialog-main":"",style:{minHeight:r.isNo?"unset":null}},r.formProps),{default:e.withCtx(()=>[e.createVNode(e.unref(Fe),{value:a.value,"onUpdate:value":y[0]||(y[0]=b=>a.value=b),"form-ref":s.value,option:r.options,"label-field":r.labelField,read:r.read,style:e.normalizeStyle(r.contentStyle),"form-props":r.formProps},null,8,["value","form-ref","option","label-field","read","style","form-props"])]),_:1},16,["model","rules","class","style"]))}});function yt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}let k=null,te=null;function gt(){if(k)return k;if(typeof $dialog<"u"&&$dialog)return k=$dialog,k;try{const t=V.useDialog();if(t)return k=t,k}catch{}if(!te){const{dialog:t}=V.createDiscreteApi(["dialog"]);te={dialog:t}}return k=te.dialog,k}function ce({title:t="",noTitle:n=!1,titleFull:l=null,options:r=[],mode:o="add",modeEnum:s={},labelField:a="label",isNo:d=!0,formProps:i={},interfaceFn:c=null,interfaceFnCancel:y=null,valueData:b,read:h,isRead:x,action:m=null,contentStyle:S={},actionProps:D={}}={title:"自定义弹窗",noTitle:!1,action:[],options:[],read:!1,isRead:!1,valueData:{}},u=null){var ye;const _=gt(),g={none:{sub:"",read:!1},create:{sub:"创建",read:!1},add:{sub:"添加",read:!1},edit:{sub:"编辑",read:!1},view:{sub:"查看",read:!0},export:{sub:"导出",read:!1},import:{sub:"导入",read:!1},delete:{sub:"删除",read:!1},copy:{sub:"复制",read:!1},...s},N=e.ref(),p=e.reactive([]),f=e.ref({...b}),w={justify:"end",wrapItem:!1,style:{width:"100%"}},M={width:"120px"},F=[{label:"取消",props:{type:"primary",ghost:!0},onClick:({cancel:A})=>{y?y(e.unref(f),{close:A}):A()}},{label:"确定",valid:!0,onClick:async({cancel:A,hideLoading:C})=>c?await c(e.unref(f),{close:A,hideLoading:C}):A()}];(Array.isArray(m)?m:F).forEach((A,C)=>{p[C]=!1});const I=typeof l=="function"?()=>{var A;return l(((A=g[o])==null?void 0:A.sub)||"")}:l,O=e.ref();function P(){var A;console.log("取消",f.value),(A=O.value)==null||A.destroy()}async function Y(A=[]){var C;console.log("开启验证"),await((C=N.value)==null?void 0:C.valid())}async function q(A){return A&&A()}const G=h??x?null:typeof m=="function"?()=>m({formRef:N,data:e.unref(f),d:O.value,close:P}):()=>{let A;return e.createVNode(V.NSpace,e.mergeProps(w,D,{style:{...w==null?void 0:w.style,...(D==null?void 0:D.style)||{}}}),yt(A=(Array.isArray(m)?m:F).map((C,X)=>{var ge;return C!=null&&C.render?(ge=C==null?void 0:C.render)==null?void 0:ge.call(C):e.createVNode(V.NButton,e.mergeProps({type:"primary",ghost:C.mode==="cancel"},(C==null?void 0:C.props)||{},(D==null?void 0:D.buttonProps)||{},{style:{...M,...(C==null?void 0:C.style)||{}},loading:p[X],onClick:async()=>{var me,he;if(C.mode==="cancel")(me=O.value)==null||me.destroy();else{const Z=()=>p[X]=!0,pe=()=>p[X]=!1;C!=null&&C.loading&&Z();try{console.log("model",e.unref(f)),C!=null&&C.valid&&await Y(),console.log(C==null?void 0:C.valid),(C!=null&&C.valid||C!=null&&C.loading)&&Z(),await((he=C==null?void 0:C.onClick)==null?void 0:he.call(C,{model:e.unref(f),comfirm:q,cancel:P,validate:Y,showLoading:Z,hideLoading:pe}))}catch($e){console.log($e)}finally{(C!=null&&C.valid||C!=null&&C.loading)&&pe()}}}}),{default:()=>[C.label||""]})}))?A:{default:()=>[A]})},J=_.create({type:"info",...dt,...n?{}:{title:I||(((ye=g[o])==null?void 0:ye.sub)??"")+t},style:{width:"500px"},content:()=>e.createVNode(se,{ref:A=>{N.value=A},options:r,value:f,"onUpdate:value":A=>f=A,isNo:d,read:h??x,labelField:a,formProps:i,contentStyle:S,dialog:!0},null),action:G,...u,class:`core-dialog ${h??x?"core-dialog-read":""} ${(u==null?void 0:u.class)||""}`});return O.value=J,{cancel:P,setValue:(A,C)=>C?f.value[C]=A:f.value={...f.value,...A},model:e.unref(f),modeEnum:g}}function mt(){const t=V.useDialog();return oe(t),(n,l)=>ce(n,l)}const ht={class:"flex-1"},pt=e.defineComponent({__name:"CommonQuery",props:e.mergeModels({query:{default:()=>({})},options:{default:()=>[]},inlineText:{type:Boolean,default:!0},selectCount:{default:1},type:{default:"primary"},noButton:{type:Boolean,default:!1},isRead:{type:Boolean,default:!1},btn:{default:()=>["reset","search"]},size:{default:"medium"}},{query:{type:Object,default:()=>({})},queryModifiers:{}}),emits:e.mergeModels(["update:query","submit","reset"],["update:query"]),setup(t,{emit:n}){var _;const l=e.getCurrentInstance();(_=l==null?void 0:l.appContext)!=null&&_.app&&v(l.appContext.app);function r(g,N){let p;return function(...f){clearTimeout(p),p=setTimeout(()=>{g.apply(this,f)},N)}}const o=n,s=t;function a(g){return g.map(N=>({...N,props:{...N.props,...!N.way||N.way==="input"?{onUpdateValue:(...p)=>{var f,w;(w=(f=N.props)==null?void 0:f.onUpdateValue)==null||w.call(f,...p),d()}}:{},...(N==null?void 0:N.way)==="select"?{onUpdateValue:(...p)=>{var f,w;(w=(f=N.props)==null?void 0:f.onUpdateValue)==null||w.call(f,...p),d()}}:{}}}))}const d=r(()=>{o("submit")},500);function i(){d()}const c=e.ref(!1),y=e.useModel(t,"query"),b={style:{width:"33%"}},h=e.computed(()=>{var g;return(g=s.options)==null?void 0:g.map(N=>(N==null?void 0:N.way)||"input")});ie(h.value);const x=e.computed(()=>{var g;try{const N=[];for(let p=0;p<(((g=s.options)==null?void 0:g.length)||0);p++){const f=s.options[p];if(f!=null&&f.enum&&!(f!=null&&f.options)&&(f.options=re(f.enum)),f!=null&&f.props||(f.props={size:s.size}),!(f!=null&&f.formItemProps))f.formItemProps={...b};else{const M=typeof f.formItemProps=="function"?f.formItemProps({},{}):f.formItemProps;f.formItemProps={...b,...M,style:{...b.style,...M==null?void 0:M.style}}}const w=(f==null?void 0:f.key)||(f==null?void 0:f.value);if(!w)throw new Error("key no set");N.push({...f,key:w})}return a(N)}catch(N){return console.warn("error",N),[]}}),m={style:{borderRadius:"3px"}},S={search:()=>e.createVNode(V.NButton,e.mergeProps({type:s.type,loading:c.value,"default-props":{attrType:"submit"},onClick:()=>i()},m),{default:()=>"搜索",icon:()=>e.createVNode(z.SearchOutline,null,null)}),reset:()=>e.createVNode(V.NButton,e.mergeProps({type:"default",onClick:()=>{D()}},m),{default:()=>"重置",icon:()=>e.createVNode(z.RefreshOutline,null,null)})};function D(){var g;(g=s.options)==null||g.forEach(N=>{const p=(N==null?void 0:N.key)||(N==null?void 0:N.value);p&&(N!=null&&N.queryType?(y.value[N.queryType]||(y.value[N.queryType]={}),y.value[N.queryType][p]=null):y.value[p]=null)}),o("reset")}function u(g){g.key==="Enter"&&i()}return e.onMounted(()=>{document.addEventListener("keydown",u)}),e.onUnmounted(()=>{document.removeEventListener("keydown",u)}),(g,N)=>(e.openBlock(),e.createBlock(e.unref(V.NSpace),{"wrap-item":!1,justify:"space-between",align:"center",wrap:!1},{default:e.withCtx(()=>[e.createElementVNode("div",ht,[e.createVNode(se,{value:y.value,"onUpdate:value":N[0]||(N[0]=p=>y.value=p),options:x.value,"form-props":{showFeedback:!1}},null,8,["value","options"])]),s.noButton?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(V.NSpace),{key:0,align:"center",wrap:!1},{default:e.withCtx(()=>[e.renderSlot(g.$slots,"left-btn",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.btn,(p,f)=>{var w;return e.openBlock(),e.createBlock(e.resolveDynamicComponent((w=S==null?void 0:S[p])==null?void 0:w.call(S)),{key:f})}),128)),e.renderSlot(g.$slots,"right-btn",{},void 0,!0)]),_:3}))]),_:3}))}}),Nt=H(pt,[["__scopeId","data-v-643f6214"]]),fe=e.defineComponent(({action:t,row:n,index:l})=>{const{onClick:r,disabled:o,type:s="primary",loading:a=!1,label:d=null,...i}=t||{},c=e.ref(!1);return()=>e.createVNode(V.NButton,e.mergeProps({text:!0,onClick:async()=>{if(r)try{a&&(c.value=!0),await r(n)}finally{setTimeout(()=>c.value=!1,500)}},disabled:typeof o=="function"?o(n):o,loading:c.value,type:typeof o=="function"&&o(n)?"default":s},i),{default:()=>[typeof d=="function"?d==null?void 0:d(n):d]})},{props:{action:{type:[Object,null],default:null},row:{type:[Object,null],default:null},index:{type:Number,default:0}}}),de=e.defineComponent(({onClick:t,row:n,index:l,action:r},{slots:o})=>{const s=e.ref(!1);return()=>e.createVNode(V.NPopconfirm,{"positive-button-props":{type:"warning",loading:s.value},onPositiveClick:async()=>{try{if(t)return s.value=!0,await t(n,l),s.value=!1,!0}catch{return s.value=!1,!1}return!1}},{trigger:o.default,default:()=>{var a;return((a=r==null?void 0:r.popProps)==null?void 0:a.content)||(r==null?void 0:r.content)||"确定删除该记录?"}})},{props:{onClick:{type:Function,default:null},row:{type:[Object,null],default:null},action:{type:[Object,null],default:null},index:{type:Number,default:0}}});function we(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const bt=e.defineComponent(t=>{const n=t.options.length,l=e.ref(!1),r=e.computed(()=>t.options.slice(0,l.value?n:t.max)),o=e.computed(()=>t.options.slice(t.max));function s(a){return a==null?void 0:a.map(({isRender:d=()=>!0,onClick:i=null,mode:c=null,disabled:y=!1,type:b="primary",...h},x)=>(typeof d=="function"?d(t.data):d)?c==="pop"?e.createVNode(de,{onClick:i,row:t.data,index:t.index,action:h,key:j(t.data,t.index)+x},{default:()=>[e.createVNode(V.NButton,e.mergeProps({text:!0,disabled:typeof y=="function"?y(t.data):y,type:typeof y=="function"&&y(t.data)?"default":b},h),{default:()=>[typeof(h==null?void 0:h.label)=="function"?h==null?void 0:h.label(t.data):h==null?void 0:h.label]})]}):e.createVNode(fe,{row:t.data,action:{...h,disabled:y,onClick:i,type:b},index:t.index,key:j(t.data,t.index)+x},null):void 0).filter(d=>d!==void 0)}return()=>{let a;return e.createVNode(V.NSpace,{style:{width:"100%"},"wrap-item":!1,justify:"center",align:"center"},{default:()=>[e.createVNode(V.NSpace,{"wrap-item":!1,align:"center"},we(a=s(r.value))?a:{default:()=>[a]}),e.createVNode(V.NPopover,{trigger:"click"},{trigger:()=>e.createVNode(V.NButton,{text:!0,type:"info"},{default:()=>[e.createTextVNode("更多")]}),default:()=>{let d;return e.createVNode(V.NSpace,{"wrap-item":!1,align:"center",style:{width:"250px",padding:"5px"}},we(d=s(o.value))?d:{default:()=>[d]})}})]})}},{name:"DataColumnCollet",props:{options:{type:Array,default:()=>[]},max:{type:Number,default:3},data:{type:Object,default:()=>({})},index:{type:Number,default:0}}});function xt(){var n;const t=Ae();if(t)return t;try{const l=e.getCurrentInstance();if((n=l==null?void 0:l.appContext)!=null&&n.app)return null}catch{}return null}function $(t={},n=null){const l=De();return!l.inheritTheme&&l.themeOverrides?{...t,themeOverrides:{...l.themeOverrides,...t.themeOverrides||{}}}:t}function wt(t,n={}){if(!t)throw new Error("dialogInstance 是必需的。请在组件中使用 useDialog() 获取实例,然后传递给此函数。");const l=$(n,t);return t.create(l)}function Ct(t){if(!t)throw new Error("dialogInstance 是必需的。请在组件中使用 useDialog() 获取实例。");return{info:n=>{const l=$({type:"info",...n},t);return t.info(l)},success:n=>{const l=$({type:"success",...n},t);return t.success(l)},warning:n=>{const l=$({type:"warning",...n},t);return t.warning(l)},error:n=>{const l=$({type:"error",...n},t);return t.error(l)},create:n=>{const l=$(n,t);return t.create(l)}}}function Vt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const j=(t,n)=>t?JSON.stringify(t):String(n);function _t(t,n=null,l){const r={max:4,width:80};let o=!1;if(typeof l=="boolean"?o=r:typeof l=="object"&&(o={...r,...l}),console.log("collect",o),console.log(Array.isArray(t)),!Array.isArray(t))throw new TypeError("需要配置数组");console.log("ddd");let s=[],a=0;const d=[];return Array.isArray(t)&&(s=t,s.forEach((i,c)=>{var y,b;i.permission?K(i.permission)&&((!l||typeof o=="object"&&c<o.max)&&(a+=(typeof(i==null?void 0:i.label)=="string"?(y=i==null?void 0:i.label)==null?void 0:y.length:10)*12+36),d.push(i)):((!l||typeof o=="object"&&c<o.max)&&(a+=(typeof(i==null?void 0:i.label)=="string"?(b=i==null?void 0:i.label)==null?void 0:b.length:10)*12+36),d.push(i))})),a=Math.max(80,a),a+=0,o&&(a+=2),d.length?{title:"操作",key:"opr",fixed:"right",align:"left",width:a,...n,render(i,c){const y=o?e.createVNode(bt,{data:i,index:c,max:o.max,options:d},null):d.map(({isRender:b=()=>!0,onClick:h=null,mode:x=null,disabled:m=!1,type:S="primary",...D},u)=>(typeof b=="function"?b(i):b)?x==="pop"?e.createVNode(de,{onClick:h,row:i,index:c,action:D,key:j(i,c)+u},{default:()=>[e.createVNode(V.NButton,e.mergeProps({text:!0,disabled:typeof m=="function"?m(i):m,type:typeof m=="function"&&m(i)?"default":S},D),{default:()=>[typeof(D==null?void 0:D.label)=="function"?D==null?void 0:D.label(i):D==null?void 0:D.label]})]}):e.createVNode(fe,{row:i,action:{...D,disabled:m,onClick:h,type:S},index:c,key:j(i,c)+u},null):void 0).filter(b=>b!==void 0);return n!=null&&n.isRender?n==null?void 0:n.render(i):e.createVNode(V.NSpace,{align:"center","wrap-item":!1,size:18,key:j(i,c)},Vt(y)?y:{default:()=>[y]})}}:void 0}async function Ue(t,n=null){const l=xt();if(!l)throw new Error("无法获取 dialog 实例。请使用 useQRCode hook 或在组件中通过 setupConfig 注册 dialog 实例。");const r=e.ref(null),o=e.ref(!1),s=$({type:"info",showIcon:!1,style:{width:"350px",height:"350px"},content:()=>e.createVNode("div",{class:"qr-box"},[o.value?e.createVNode(V.NSpin,{class:"qr-spin",show:!0},null):"",e.createVNode("div",{class:"qr-img"},[e.createVNode(V.NImage,{src:r.value,style:{width:"100%"}},null)]),e.createVNode("div",{class:"qr-title"},[o.value?"":t.name])])},l);return l.info(s),n&&(o.value=!0,r.value=await n(),o.value=!1),!0}function Ot(){const t=V.useDialog();return oe(t),(n,l)=>Ue(n,l)}function qe(t){var n,l;if((n=t==null?void 0:t.children)!=null&&n.length){const r=[];t.children.forEach(o=>{var a,d,i,c;qe(o);let s=[];typeof((a=o==null?void 0:o.meta)==null?void 0:a.permission)=="string"?s=[o.meta.permission]:Array.isArray((d=o.meta)==null?void 0:d.permission)?s.push(...o.meta.permission):typeof((i=o.meta)==null?void 0:i.permission)=="object"?s.push(...Dt(Ee(o.meta.permission))):(c=o==null?void 0:o.meta)!=null&&c.permission||(s=null),o.meta.permission=s,r.push(...new Set(s))}),(l=t==null?void 0:t.meta)!=null&&l.permission?t.meta.permission=[...new Set(t.meta.permission.concat(r))]:t.meta.permission=r}return t}function Dt(...t){const n=t==null?void 0:t.map(l=>Array.isArray(l)?l:l==null?void 0:l.ALL);return[].concat(...n)}function Ee(t){return t?Object.keys(t).reduce((n,l)=>(typeof t[l]!="string"?n.concat(Ee(t[l])):n.push(t[l]),n),[]):[]}function At(...t){return{...Te("auth",t)}}function St(...t){return{...Te("api",t)}}function Pt(t,n={}){const l=Object.keys(n);return l.length&&l.forEach(r=>{const o=new RegExp(`${r}`,"g");t=t==null?void 0:t.replace(o,n[r])}),t}function Te(t,n){var a;const l=le.useRoute(),r=le.useRouter(),o=Ce(((a=l==null?void 0:l.meta)==null?void 0:a[t])??{}),s=Q(n[0]);return s!=null&&s.length&&r.getRoutes().filter(i=>s.includes(i.name)).forEach(i=>{var c;(c=i.meta)!=null&&c[t]&&(o[i.name]=Ce(i.meta[t]))}),{...o}}function Ce(t={}){return Object.keys(t).reduce((n,l)=>{const r=t[l];return typeof r=="object"?n[l]=r==null?void 0:r.key:typeof r=="string"&&(n[l]=String(r)),n},{})}const W={ascend:{title:"升序",value:!0,Icon:e.h(z.ChevronUp),fn:(t,n)=>{t.desc=!0,t.sortFieldName=n}},descend:{title:"降序",value:!1,Icon:e.h(z.ChevronDown),fn:t=>{t.sortFieldName="",t.desc=!0}},false:{title:"默认",value:null,Icon:e.h(z.Code,{style:"transform:rotateZ(90deg)"}),fn:t=>{t.desc=!1,t.sortFieldName=""}}};function ke(t,n={}){v(t)}const Mt={install:ke};exports.initRouteMeta=Le.initRouteMeta;exports.ArrayToObject=ae;exports.CommonQuery=Nt;exports.CorePlugin=Mt;exports.DataForm=se;exports.DataTable=Ie;exports.ObjectToArray=re;exports.OprButton=fe;exports.Options=Fe;exports.Pop=de;exports.autoRegisterDirectives=Je;exports.cellectChildenPermission=qe;exports.checkPermission=K;exports.commonDialogMethod=ce;exports.createActionColumnJsx=_t;exports.createDialog=wt;exports.createDialogMethods=Ct;exports.createDialogOptions=$;exports.createQRCode=Ue;exports.customUpload=Be;exports.ellipsis=ne;exports.getAllOptions=ot;exports.getBaseURL=_e;exports.getConfig=Qe;exports.getDialogConfig=De;exports.getDialogInstance=Ae;exports.getFileUrl=T;exports.getGlobalApp=Me;exports.getHasPermission=Ge;exports.getOptions=ie;exports.getUploadMethod=Oe;exports.globalLabelField=R;exports.globalValueField=U;exports.handleParams=Pt;exports.initRules=Re;exports.install=ke;exports.orderEnum=W;exports.permissionDirective=Se;exports.registerDialogInstance=oe;exports.registerDirectives=v;exports.registryUpload=Ze;exports.setupConfig=Ve;exports.setupOptions=ut;exports.toArray=Q;exports.useApiConfig=St;exports.useAuthPermission=At;exports.useCommonDialog=mt;exports.useQRCode=Ot;
|
|
2
|
+
`])}}),[[e.resolveDirective("corePermission"),u==null?void 0:u.permission]])}return()=>{let u;return e.createVNode(V.NSpace,{"wrap-item":!1,size:[0,8],style:{width:"100%",minHeight:"100%",alignContent:"baseline",...t.style}},ft(u=a.value.map(({isRender:_=!0,...g},N)=>(typeof e.unref(_)!="boolean"?_!=null&&_(e.unref(r)):e.unref(_))?g!=null&&g.render?g==null?void 0:g.render(e.unref(r),N,{setValue:b,value:e.unref(r)}):e.createVNode(S,{item:g,index:N},null):null))?u:{default:()=>[u]})}},{props:{option:{type:Array,default:()=>[]},value:{type:Object,default:()=>({})},read:{type:Boolean,default:()=>!1},labelField:{type:String,default:()=>R},valueField:{type:String,default:()=>U},style:{type:Object,default:()=>({})},formRef:{type:Object,default:()=>({})},formProps:{type:Object,default:()=>({})}},emits:["update:value"]}),dt={showIcon:!1,autoFocus:!1};function Re({options:t=[],model:n,labelField:l="label",formOpr:r={}}){return e.computed(()=>(t==null?void 0:t.reduce((o,{fields:s,...a})=>{var i,c;Array.isArray(a==null?void 0:a.key)&&a.key.forEach(y=>{a!=null&&a.required&&(o[String(y)]={key:y,type:"any",required:a!=null&&a.required?typeof(a==null?void 0:a.required)=="function"?a==null?void 0:a.required(e.unref(n),{...r}):a==null?void 0:a.required:!1,message:(a==null?void 0:a.message)||`请选择${a==null?void 0:a[l]}`,fields:s})});const d=a!=null&&a.rule?typeof(a==null?void 0:a.rule)!="function"?a==null?void 0:a.rule:a==null?void 0:a.rule(e.unref(n),{...r}):s?{key:a==null?void 0:a.key,type:"any",required:a!=null&&a.required?typeof(a==null?void 0:a.required)=="function"?a==null?void 0:a.required(e.unref(n),{...r}):a==null?void 0:a.required:!1,message:(a==null?void 0:a.message)||`请${(i=a==null?void 0:a.options)!=null&&i.length?"选择":"输入"}${a==null?void 0:a[l]}`,fields:s}:{key:a==null?void 0:a.key,type:"any",required:a!=null&&a.required?typeof(a==null?void 0:a.required)=="function"?a==null?void 0:a.required(e.unref(n),{...r}):a==null?void 0:a.required:!1,message:(a==null?void 0:a.message)||`请${(c=a==null?void 0:a.options)!=null&&c.length?"选择":"输入"}${a==null?void 0:a[l]}`,...Array.isArray(a==null?void 0:a.key)?{validator:y=>(console.log(y),!(a==null?void 0:a.key.every(h=>e.unref(n)[h]))&&(a!=null&&a.required)?new Error(y==null?void 0:y.message):!0)}:{}};return d!=null&&d.required&&(o[String(a==null?void 0:a.key)]=d),o},{}))||{})}const se=e.defineComponent({__name:"DataForm",props:e.mergeModels({value:{},options:{default:()=>[]},isNo:{type:Boolean,default:!0},read:{type:Boolean,default:!1},labelField:{default:"label"},contentStyle:{default:()=>({})},rules:{default:()=>({})},formProps:{default:()=>({})},formItemProps:{default:()=>({})},dialog:{type:Boolean,default:!1}},{value:{type:Object,default:()=>({})},valueModifiers:{}}),emits:["update:value"],setup(t,{expose:n}){var i;const l=e.getCurrentInstance();(i=l==null?void 0:l.appContext)!=null&&i.app&&v(l.appContext.app);const r=t,o=e.computed(()=>r.options),s=e.ref(),a=e.useModel(t,"value"),d=e.computed(()=>e.unref(o.value?Re({options:o.value,model:a,labelField:r.labelField,formOpr:{formRef:s}}):{}));return console.log(d.value),n({formRef:s,getRule:()=>d.value,valid:(c=[])=>(console.log("?? valid",c),new Promise((y,b)=>{var x;const h=Q(c);(x=s.value)==null||x.validate(m=>{if(m)return b(m);y()},m=>h.length?h.includes(m==null?void 0:m.key):!0)})),confirm:c=>new Promise((y,b)=>{var h;(h=s.value)==null||h.validate(x=>{if(x)return b(x);c&&c(e.unref(a)),y(e.unref(a))})})}),(c,y)=>(e.openBlock(),e.createBlock(e.unref(V.NForm),e.mergeProps({ref_key:"formRef",ref:s,model:a.value,rules:r.read?{}:d.value,"label-placement":"left","label-width":"100px","require-mark-placement":"right-hanging",class:r.dialog?r.read?"core-dialog-content":"core-dialog-main":"",style:{minHeight:r.isNo?"unset":null}},r.formProps),{default:e.withCtx(()=>[e.createVNode(e.unref(Fe),{value:a.value,"onUpdate:value":y[0]||(y[0]=b=>a.value=b),"form-ref":s.value,option:r.options,"label-field":r.labelField,read:r.read,style:e.normalizeStyle(r.contentStyle),"form-props":r.formProps},null,8,["value","form-ref","option","label-field","read","style","form-props"])]),_:1},16,["model","rules","class","style"]))}});function yt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}let k=null,te=null;function gt(){if(k)return k;if(typeof $dialog<"u"&&$dialog)return k=$dialog,k;try{const t=V.useDialog();if(t)return k=t,k}catch{}if(!te){const{dialog:t}=V.createDiscreteApi(["dialog"]);te={dialog:t}}return k=te.dialog,k}function ce({title:t="",noTitle:n=!1,titleFull:l=null,options:r=[],mode:o="add",modeEnum:s={},labelField:a="label",isNo:d=!0,formProps:i={},interfaceFn:c=null,interfaceFnCancel:y=null,valueData:b,read:h,isRead:x,action:m=null,contentStyle:S={},actionProps:D={}}={title:"自定义弹窗",noTitle:!1,action:[],options:[],read:!1,isRead:!1,valueData:{}},u=null){var ye;const _=gt(),g={none:{sub:"",read:!1},create:{sub:"创建",read:!1},add:{sub:"添加",read:!1},edit:{sub:"编辑",read:!1},view:{sub:"查看",read:!0},export:{sub:"导出",read:!1},import:{sub:"导入",read:!1},delete:{sub:"删除",read:!1},copy:{sub:"复制",read:!1},...s},N=e.ref(),p=e.reactive([]),f=e.ref({...b}),w={justify:"end",wrapItem:!1,style:{width:"100%"}},M={width:"120px"},F=[{label:"取消",props:{type:"primary",ghost:!0},onClick:({cancel:A})=>{y?y(e.unref(f),{close:A}):A()}},{label:"确定",valid:!0,onClick:async({cancel:A,hideLoading:C})=>c?await c(e.unref(f),{close:A,hideLoading:C}):A()}];(Array.isArray(m)?m:F).forEach((A,C)=>{p[C]=!1});const I=typeof l=="function"?()=>{var A;return l(((A=g[o])==null?void 0:A.sub)||"")}:l,O=e.ref();function P(){var A;console.log("取消",f.value),(A=O.value)==null||A.destroy()}async function Y(A=[]){var C;console.log("开启验证"),await((C=N.value)==null?void 0:C.valid())}async function q(A){return A&&A()}const G=h??x?null:typeof m=="function"?()=>m({formRef:N,data:e.unref(f),d:O.value,close:P}):()=>{let A;return e.createVNode(V.NSpace,e.mergeProps(w,D,{style:{...w==null?void 0:w.style,...(D==null?void 0:D.style)||{}}}),yt(A=(Array.isArray(m)?m:F).map((C,X)=>{var ge;return C!=null&&C.render?(ge=C==null?void 0:C.render)==null?void 0:ge.call(C):e.createVNode(V.NButton,e.mergeProps({type:"primary",ghost:C.mode==="cancel"},(C==null?void 0:C.props)||{},(D==null?void 0:D.buttonProps)||{},{style:{...M,...(C==null?void 0:C.style)||{}},loading:p[X],onClick:async()=>{var me,he;if(C.mode==="cancel")(me=O.value)==null||me.destroy();else{const Z=()=>p[X]=!0,pe=()=>p[X]=!1;C!=null&&C.loading&&Z();try{console.log("model",e.unref(f)),C!=null&&C.valid&&await Y(),console.log(C==null?void 0:C.valid),(C!=null&&C.valid||C!=null&&C.loading)&&Z(),await((he=C==null?void 0:C.onClick)==null?void 0:he.call(C,{model:e.unref(f),comfirm:q,cancel:P,validate:Y,showLoading:Z,hideLoading:pe}))}catch($e){console.log($e)}finally{(C!=null&&C.valid||C!=null&&C.loading)&&pe()}}}}),{default:()=>[C.label||""]})}))?A:{default:()=>[A]})},J=_.create({type:"info",...dt,...n?{}:{title:I||(((ye=g[o])==null?void 0:ye.sub)??"")+t},style:{width:"500px"},content:()=>e.createVNode(se,{ref:A=>{N.value=A},options:r,value:e.unref(f),"onUpdate:value":A=>f.value=A,isNo:d,read:h??x,labelField:a,formProps:i,contentStyle:S,dialog:!0},null),action:G,...u,class:`core-dialog ${h??x?"core-dialog-read":""} ${(u==null?void 0:u.class)||""}`});return O.value=J,{cancel:P,setValue:(A,C)=>C?f.value[C]=A:f.value={...f.value,...A},model:e.unref(f),modeEnum:g}}function mt(){const t=V.useDialog();return oe(t),(n,l)=>ce(n,l)}const ht={class:"flex-1"},pt=e.defineComponent({__name:"CommonQuery",props:e.mergeModels({query:{default:()=>({})},options:{default:()=>[]},inlineText:{type:Boolean,default:!0},selectCount:{default:1},type:{default:"primary"},noButton:{type:Boolean,default:!1},isRead:{type:Boolean,default:!1},btn:{default:()=>["reset","search"]},size:{default:"medium"}},{query:{type:Object,default:()=>({})},queryModifiers:{}}),emits:e.mergeModels(["update:query","submit","reset"],["update:query"]),setup(t,{emit:n}){var _;const l=e.getCurrentInstance();(_=l==null?void 0:l.appContext)!=null&&_.app&&v(l.appContext.app);function r(g,N){let p;return function(...f){clearTimeout(p),p=setTimeout(()=>{g.apply(this,f)},N)}}const o=n,s=t;function a(g){return g.map(N=>({...N,props:{...N.props,...!N.way||N.way==="input"?{onUpdateValue:(...p)=>{var f,w;(w=(f=N.props)==null?void 0:f.onUpdateValue)==null||w.call(f,...p),d()}}:{},...(N==null?void 0:N.way)==="select"?{onUpdateValue:(...p)=>{var f,w;(w=(f=N.props)==null?void 0:f.onUpdateValue)==null||w.call(f,...p),d()}}:{}}}))}const d=r(()=>{o("submit")},500);function i(){d()}const c=e.ref(!1),y=e.useModel(t,"query"),b={style:{width:"33%"}},h=e.computed(()=>{var g;return(g=s.options)==null?void 0:g.map(N=>(N==null?void 0:N.way)||"input")});ie(h.value);const x=e.computed(()=>{var g;try{const N=[];for(let p=0;p<(((g=s.options)==null?void 0:g.length)||0);p++){const f=s.options[p];if(f!=null&&f.enum&&!(f!=null&&f.options)&&(f.options=re(f.enum)),f!=null&&f.props||(f.props={size:s.size}),!(f!=null&&f.formItemProps))f.formItemProps={...b};else{const M=typeof f.formItemProps=="function"?f.formItemProps({},{}):f.formItemProps;f.formItemProps={...b,...M,style:{...b.style,...M==null?void 0:M.style}}}const w=(f==null?void 0:f.key)||(f==null?void 0:f.value);if(!w)throw new Error("key no set");N.push({...f,key:w})}return a(N)}catch(N){return console.warn("error",N),[]}}),m={style:{borderRadius:"3px"}},S={search:()=>e.createVNode(V.NButton,e.mergeProps({type:s.type,loading:c.value,"default-props":{attrType:"submit"},onClick:()=>i()},m),{default:()=>"搜索",icon:()=>e.createVNode(z.SearchOutline,null,null)}),reset:()=>e.createVNode(V.NButton,e.mergeProps({type:"default",onClick:()=>{D()}},m),{default:()=>"重置",icon:()=>e.createVNode(z.RefreshOutline,null,null)})};function D(){var g;(g=s.options)==null||g.forEach(N=>{const p=(N==null?void 0:N.key)||(N==null?void 0:N.value);p&&(N!=null&&N.queryType?(y.value[N.queryType]||(y.value[N.queryType]={}),y.value[N.queryType][p]=null):y.value[p]=null)}),o("reset")}function u(g){g.key==="Enter"&&i()}return e.onMounted(()=>{document.addEventListener("keydown",u)}),e.onUnmounted(()=>{document.removeEventListener("keydown",u)}),(g,N)=>(e.openBlock(),e.createBlock(e.unref(V.NSpace),{"wrap-item":!1,justify:"space-between",align:"center",wrap:!1},{default:e.withCtx(()=>[e.createElementVNode("div",ht,[e.createVNode(se,{value:y.value,"onUpdate:value":N[0]||(N[0]=p=>y.value=p),options:x.value,"form-props":{showFeedback:!1}},null,8,["value","options"])]),s.noButton?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(V.NSpace),{key:0,align:"center",wrap:!1},{default:e.withCtx(()=>[e.renderSlot(g.$slots,"left-btn",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.btn,(p,f)=>{var w;return e.openBlock(),e.createBlock(e.resolveDynamicComponent((w=S==null?void 0:S[p])==null?void 0:w.call(S)),{key:f})}),128)),e.renderSlot(g.$slots,"right-btn",{},void 0,!0)]),_:3}))]),_:3}))}}),Nt=H(pt,[["__scopeId","data-v-643f6214"]]),fe=e.defineComponent(({action:t,row:n,index:l})=>{const{onClick:r,disabled:o,type:s="primary",loading:a=!1,label:d=null,...i}=t||{},c=e.ref(!1);return()=>e.createVNode(V.NButton,e.mergeProps({text:!0,onClick:async()=>{if(r)try{a&&(c.value=!0),await r(n)}finally{setTimeout(()=>c.value=!1,500)}},disabled:typeof o=="function"?o(n):o,loading:c.value,type:typeof o=="function"&&o(n)?"default":s},i),{default:()=>[typeof d=="function"?d==null?void 0:d(n):d]})},{props:{action:{type:[Object,null],default:null},row:{type:[Object,null],default:null},index:{type:Number,default:0}}}),de=e.defineComponent(({onClick:t,row:n,index:l,action:r},{slots:o})=>{const s=e.ref(!1);return()=>e.createVNode(V.NPopconfirm,{"positive-button-props":{type:"warning",loading:s.value},onPositiveClick:async()=>{try{if(t)return s.value=!0,await t(n,l),s.value=!1,!0}catch{return s.value=!1,!1}return!1}},{trigger:o.default,default:()=>{var a;return((a=r==null?void 0:r.popProps)==null?void 0:a.content)||(r==null?void 0:r.content)||"确定删除该记录?"}})},{props:{onClick:{type:Function,default:null},row:{type:[Object,null],default:null},action:{type:[Object,null],default:null},index:{type:Number,default:0}}});function we(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const bt=e.defineComponent(t=>{const n=t.options.length,l=e.ref(!1),r=e.computed(()=>t.options.slice(0,l.value?n:t.max)),o=e.computed(()=>t.options.slice(t.max));function s(a){return a==null?void 0:a.map(({isRender:d=()=>!0,onClick:i=null,mode:c=null,disabled:y=!1,type:b="primary",...h},x)=>(typeof d=="function"?d(t.data):d)?c==="pop"?e.createVNode(de,{onClick:i,row:t.data,index:t.index,action:h,key:j(t.data,t.index)+x},{default:()=>[e.createVNode(V.NButton,e.mergeProps({text:!0,disabled:typeof y=="function"?y(t.data):y,type:typeof y=="function"&&y(t.data)?"default":b},h),{default:()=>[typeof(h==null?void 0:h.label)=="function"?h==null?void 0:h.label(t.data):h==null?void 0:h.label]})]}):e.createVNode(fe,{row:t.data,action:{...h,disabled:y,onClick:i,type:b},index:t.index,key:j(t.data,t.index)+x},null):void 0).filter(d=>d!==void 0)}return()=>{let a;return e.createVNode(V.NSpace,{style:{width:"100%"},"wrap-item":!1,justify:"center",align:"center"},{default:()=>[e.createVNode(V.NSpace,{"wrap-item":!1,align:"center"},we(a=s(r.value))?a:{default:()=>[a]}),e.createVNode(V.NPopover,{trigger:"click"},{trigger:()=>e.createVNode(V.NButton,{text:!0,type:"info"},{default:()=>[e.createTextVNode("更多")]}),default:()=>{let d;return e.createVNode(V.NSpace,{"wrap-item":!1,align:"center",style:{width:"250px",padding:"5px"}},we(d=s(o.value))?d:{default:()=>[d]})}})]})}},{name:"DataColumnCollet",props:{options:{type:Array,default:()=>[]},max:{type:Number,default:3},data:{type:Object,default:()=>({})},index:{type:Number,default:0}}});function xt(){var n;const t=Ae();if(t)return t;try{const l=e.getCurrentInstance();if((n=l==null?void 0:l.appContext)!=null&&n.app)return null}catch{}return null}function $(t={},n=null){const l=De();return!l.inheritTheme&&l.themeOverrides?{...t,themeOverrides:{...l.themeOverrides,...t.themeOverrides||{}}}:t}function wt(t,n={}){if(!t)throw new Error("dialogInstance 是必需的。请在组件中使用 useDialog() 获取实例,然后传递给此函数。");const l=$(n,t);return t.create(l)}function Ct(t){if(!t)throw new Error("dialogInstance 是必需的。请在组件中使用 useDialog() 获取实例。");return{info:n=>{const l=$({type:"info",...n},t);return t.info(l)},success:n=>{const l=$({type:"success",...n},t);return t.success(l)},warning:n=>{const l=$({type:"warning",...n},t);return t.warning(l)},error:n=>{const l=$({type:"error",...n},t);return t.error(l)},create:n=>{const l=$(n,t);return t.create(l)}}}function Vt(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const j=(t,n)=>t?JSON.stringify(t):String(n);function _t(t,n=null,l){const r={max:4,width:80};let o=!1;if(typeof l=="boolean"?o=r:typeof l=="object"&&(o={...r,...l}),console.log("collect",o),console.log(Array.isArray(t)),!Array.isArray(t))throw new TypeError("需要配置数组");console.log("ddd");let s=[],a=0;const d=[];return Array.isArray(t)&&(s=t,s.forEach((i,c)=>{var y,b;i.permission?K(i.permission)&&((!l||typeof o=="object"&&c<o.max)&&(a+=(typeof(i==null?void 0:i.label)=="string"?(y=i==null?void 0:i.label)==null?void 0:y.length:10)*12+36),d.push(i)):((!l||typeof o=="object"&&c<o.max)&&(a+=(typeof(i==null?void 0:i.label)=="string"?(b=i==null?void 0:i.label)==null?void 0:b.length:10)*12+36),d.push(i))})),a=Math.max(80,a),a+=0,o&&(a+=2),d.length?{title:"操作",key:"opr",fixed:"right",align:"left",width:a,...n,render(i,c){const y=o?e.createVNode(bt,{data:i,index:c,max:o.max,options:d},null):d.map(({isRender:b=()=>!0,onClick:h=null,mode:x=null,disabled:m=!1,type:S="primary",...D},u)=>(typeof b=="function"?b(i):b)?x==="pop"?e.createVNode(de,{onClick:h,row:i,index:c,action:D,key:j(i,c)+u},{default:()=>[e.createVNode(V.NButton,e.mergeProps({text:!0,disabled:typeof m=="function"?m(i):m,type:typeof m=="function"&&m(i)?"default":S},D),{default:()=>[typeof(D==null?void 0:D.label)=="function"?D==null?void 0:D.label(i):D==null?void 0:D.label]})]}):e.createVNode(fe,{row:i,action:{...D,disabled:m,onClick:h,type:S},index:c,key:j(i,c)+u},null):void 0).filter(b=>b!==void 0);return n!=null&&n.isRender?n==null?void 0:n.render(i):e.createVNode(V.NSpace,{align:"center","wrap-item":!1,size:18,key:j(i,c)},Vt(y)?y:{default:()=>[y]})}}:void 0}async function Ue(t,n=null){const l=xt();if(!l)throw new Error("无法获取 dialog 实例。请使用 useQRCode hook 或在组件中通过 setupConfig 注册 dialog 实例。");const r=e.ref(null),o=e.ref(!1),s=$({type:"info",showIcon:!1,style:{width:"350px",height:"350px"},content:()=>e.createVNode("div",{class:"qr-box"},[o.value?e.createVNode(V.NSpin,{class:"qr-spin",show:!0},null):"",e.createVNode("div",{class:"qr-img"},[e.createVNode(V.NImage,{src:r.value,style:{width:"100%"}},null)]),e.createVNode("div",{class:"qr-title"},[o.value?"":t.name])])},l);return l.info(s),n&&(o.value=!0,r.value=await n(),o.value=!1),!0}function Ot(){const t=V.useDialog();return oe(t),(n,l)=>Ue(n,l)}function qe(t){var n,l;if((n=t==null?void 0:t.children)!=null&&n.length){const r=[];t.children.forEach(o=>{var a,d,i,c;qe(o);let s=[];typeof((a=o==null?void 0:o.meta)==null?void 0:a.permission)=="string"?s=[o.meta.permission]:Array.isArray((d=o.meta)==null?void 0:d.permission)?s.push(...o.meta.permission):typeof((i=o.meta)==null?void 0:i.permission)=="object"?s.push(...Dt(Ee(o.meta.permission))):(c=o==null?void 0:o.meta)!=null&&c.permission||(s=null),o.meta.permission=s,r.push(...new Set(s))}),(l=t==null?void 0:t.meta)!=null&&l.permission?t.meta.permission=[...new Set(t.meta.permission.concat(r))]:t.meta.permission=r}return t}function Dt(...t){const n=t==null?void 0:t.map(l=>Array.isArray(l)?l:l==null?void 0:l.ALL);return[].concat(...n)}function Ee(t){return t?Object.keys(t).reduce((n,l)=>(typeof t[l]!="string"?n.concat(Ee(t[l])):n.push(t[l]),n),[]):[]}function At(...t){return{...Te("auth",t)}}function St(...t){return{...Te("api",t)}}function Pt(t,n={}){const l=Object.keys(n);return l.length&&l.forEach(r=>{const o=new RegExp(`${r}`,"g");t=t==null?void 0:t.replace(o,n[r])}),t}function Te(t,n){var a;const l=le.useRoute(),r=le.useRouter(),o=Ce(((a=l==null?void 0:l.meta)==null?void 0:a[t])??{}),s=Q(n[0]);return s!=null&&s.length&&r.getRoutes().filter(i=>s.includes(i.name)).forEach(i=>{var c;(c=i.meta)!=null&&c[t]&&(o[i.name]=Ce(i.meta[t]))}),{...o}}function Ce(t={}){return Object.keys(t).reduce((n,l)=>{const r=t[l];return typeof r=="object"?n[l]=r==null?void 0:r.key:typeof r=="string"&&(n[l]=String(r)),n},{})}const W={ascend:{title:"升序",value:!0,Icon:e.h(z.ChevronUp),fn:(t,n)=>{t.desc=!0,t.sortFieldName=n}},descend:{title:"降序",value:!1,Icon:e.h(z.ChevronDown),fn:t=>{t.sortFieldName="",t.desc=!0}},false:{title:"默认",value:null,Icon:e.h(z.Code,{style:"transform:rotateZ(90deg)"}),fn:t=>{t.desc=!1,t.sortFieldName=""}}};function ke(t,n={}){v(t)}const Mt={install:ke};exports.initRouteMeta=Le.initRouteMeta;exports.ArrayToObject=ae;exports.CommonQuery=Nt;exports.CorePlugin=Mt;exports.DataForm=se;exports.DataTable=Ie;exports.ObjectToArray=re;exports.OprButton=fe;exports.Options=Fe;exports.Pop=de;exports.autoRegisterDirectives=Je;exports.cellectChildenPermission=qe;exports.checkPermission=K;exports.commonDialogMethod=ce;exports.createActionColumnJsx=_t;exports.createDialog=wt;exports.createDialogMethods=Ct;exports.createDialogOptions=$;exports.createQRCode=Ue;exports.customUpload=Be;exports.ellipsis=ne;exports.getAllOptions=ot;exports.getBaseURL=_e;exports.getConfig=Qe;exports.getDialogConfig=De;exports.getDialogInstance=Ae;exports.getFileUrl=T;exports.getGlobalApp=Me;exports.getHasPermission=Ge;exports.getOptions=ie;exports.getUploadMethod=Oe;exports.globalLabelField=R;exports.globalValueField=U;exports.handleParams=Pt;exports.initRules=Re;exports.install=ke;exports.orderEnum=W;exports.permissionDirective=Se;exports.registerDialogInstance=oe;exports.registerDirectives=v;exports.registryUpload=Ze;exports.setupConfig=Ve;exports.setupOptions=ut;exports.toArray=Q;exports.useApiConfig=St;exports.useAuthPermission=At;exports.useCommonDialog=mt;exports.useQRCode=Ot;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var lt = Object.defineProperty;
|
|
2
2
|
var nt = (e, l, t) => l in e ? lt(e, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[l] = t;
|
|
3
3
|
var de = (e, l, t) => nt(e, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
-
import { unref as
|
|
4
|
+
import { unref as y, useCssVars as at, ref as P, watchEffect as Fe, resolveComponent as X, createElementBlock as ne, openBlock as B, createVNode as f, createElementVNode as _e, withCtx as v, Fragment as ue, renderList as he, createBlock as K, createTextVNode as Z, toDisplayString as pe, defineComponent as j, getCurrentInstance as re, computed as Y, watch as te, onMounted as ke, renderSlot as be, isProxy as ut, normalizeStyle as ve, mergeProps as I, isVNode as le, withDirectives as rt, resolveDirective as ot, isRef as it, mergeModels as xe, useModel as Le, reactive as st, onUnmounted as ft, createCommentVNode as ct, resolveDynamicComponent as dt, h as ye } from "vue";
|
|
5
5
|
import { useThemeVars as yt, NDataTable as gt, NTooltip as mt, NButton as z, NCheckboxGroup as ht, NSpace as V, NCheckbox as pt, NSwitch as bt, NDivider as xt, NProgress as wt, NUpload as _t, NUploadDragger as Ct, NIcon as Ve, NText as Ot, NInputNumber as At, NInput as Ue, NRadioGroup as Dt, NRadio as Nt, NDatePicker as Pe, NTimePicker as St, NSelect as It, NEllipsis as Mt, NFormItem as Ft, NForm as Ut, useDialog as Ce, createDiscreteApi as Pt, NPopconfirm as Rt, NPopover as qt, NSpin as Et, NImage as $t } from "naive-ui";
|
|
6
6
|
import { Funnel as Tt, ArchiveOutline as Bt, RefreshOutline as Yt, SearchOutline as kt, Code as vt, ChevronDown as Lt, ChevronUp as Vt } from "@vicons/ionicons5";
|
|
7
7
|
import { useRoute as ze, useRouter as zt } from "vue-router";
|
|
@@ -19,11 +19,11 @@ function We(e, { labelField: l = $, valueField: t = T } = {}) {
|
|
|
19
19
|
}
|
|
20
20
|
function Wt(e, l) {
|
|
21
21
|
const t = {
|
|
22
|
-
[$]:
|
|
22
|
+
[$]: y(e),
|
|
23
23
|
[T]: Number.isNaN(Number(l)) ? l : Number(l)
|
|
24
24
|
};
|
|
25
|
-
return typeof
|
|
26
|
-
...
|
|
25
|
+
return typeof y(e) == "object" ? {
|
|
26
|
+
...y(e),
|
|
27
27
|
[T]: Number.isNaN(Number(l)) ? l : Number(l)
|
|
28
28
|
} : t;
|
|
29
29
|
}
|
|
@@ -82,7 +82,7 @@ const qe = {
|
|
|
82
82
|
setup(e, { emit: l }) {
|
|
83
83
|
var w, p;
|
|
84
84
|
at((_) => ({
|
|
85
|
-
e0ecc754:
|
|
85
|
+
e0ecc754: y(u).infoColor
|
|
86
86
|
}));
|
|
87
87
|
const t = e, a = l, u = yt(), i = P([]);
|
|
88
88
|
Fe(() => {
|
|
@@ -122,7 +122,7 @@ const qe = {
|
|
|
122
122
|
const s = P(
|
|
123
123
|
((w = t.filterItem) == null ? void 0 : w.length) === ((p = t.selectItem) == null ? void 0 : p.length) ? ["all"] : []
|
|
124
124
|
);
|
|
125
|
-
function
|
|
125
|
+
function g(_, h) {
|
|
126
126
|
var M, N, r, A;
|
|
127
127
|
console.log(_), console.log(h), h.actionType === "uncheck" ? ((N = (M = n.value) == null ? void 0 : M.find((m) => (m == null ? void 0 : m.key) === h.value)) == null || N.unCheck(), s.value = []) : ((A = (r = n.value) == null ? void 0 : r.find((m) => (m == null ? void 0 : m.key) === h.value)) == null || A.onCheck(), s.value = [h.value]);
|
|
128
128
|
}
|
|
@@ -157,7 +157,7 @@ const qe = {
|
|
|
157
157
|
f(r, {
|
|
158
158
|
type: t.type,
|
|
159
159
|
value: s.value,
|
|
160
|
-
"onUpdate:value":
|
|
160
|
+
"onUpdate:value": g
|
|
161
161
|
}, {
|
|
162
162
|
default: v(() => [
|
|
163
163
|
(B(!0), ne(ue, null, he(n.value, (m) => (B(), K(N, {
|
|
@@ -352,13 +352,13 @@ const Ee = "filter_key", nl = /* @__PURE__ */ j({
|
|
|
352
352
|
function s(b) {
|
|
353
353
|
window.localStorage.setItem(Ee, JSON.stringify(b));
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function g() {
|
|
356
356
|
return JSON.parse(window.localStorage.getItem(Ee) || "{}") || {};
|
|
357
357
|
}
|
|
358
|
-
const w = P(
|
|
358
|
+
const w = P(g()), p = P([]), _ = P(0);
|
|
359
359
|
function h(b) {
|
|
360
360
|
if (u.summaryColumns)
|
|
361
|
-
return [u.selectColumns, ...
|
|
361
|
+
return [u.selectColumns, ...y(u.columns || []), u.oprColumns].reduce((c, C) => {
|
|
362
362
|
var U, E;
|
|
363
363
|
return C != null && C.key ? c[C.key] = ((E = (U = u.summaryColumns) == null ? void 0 : U.call(u, b)) == null ? void 0 : E[C.key]) || {
|
|
364
364
|
value: null
|
|
@@ -368,7 +368,7 @@ const Ee = "filter_key", nl = /* @__PURE__ */ j({
|
|
|
368
368
|
}, {});
|
|
369
369
|
}
|
|
370
370
|
const M = P([]);
|
|
371
|
-
te(() =>
|
|
371
|
+
te(() => y(u.columns), () => {
|
|
372
372
|
N();
|
|
373
373
|
}, {
|
|
374
374
|
immediate: !0
|
|
@@ -377,7 +377,7 @@ const Ee = "filter_key", nl = /* @__PURE__ */ j({
|
|
|
377
377
|
});
|
|
378
378
|
function N() {
|
|
379
379
|
var E;
|
|
380
|
-
const b =
|
|
380
|
+
const b = y(u.columns || []), c = d();
|
|
381
381
|
p.value = c && ((E = w.value) == null ? void 0 : E[c]) || (b == null ? void 0 : b.map((R, D) => (R == null ? void 0 : R.key) || String(L().valueOf() + D)));
|
|
382
382
|
const C = u.isFilter ? b.filter((R) => {
|
|
383
383
|
var D;
|
|
@@ -448,7 +448,7 @@ const Ee = "filter_key", nl = /* @__PURE__ */ j({
|
|
|
448
448
|
margin: "0",
|
|
449
449
|
padding: 0
|
|
450
450
|
},
|
|
451
|
-
filterItem:
|
|
451
|
+
filterItem: y(u.columns || []),
|
|
452
452
|
selectItem: p.value,
|
|
453
453
|
defaultItem: u.defaultColumns,
|
|
454
454
|
onSubmit: (c) => {
|
|
@@ -485,7 +485,7 @@ const Ee = "filter_key", nl = /* @__PURE__ */ j({
|
|
|
485
485
|
}), ke(() => {
|
|
486
486
|
}), (b, c) => {
|
|
487
487
|
const C = X("n-empty");
|
|
488
|
-
return B(), K(
|
|
488
|
+
return B(), K(y(gt), {
|
|
489
489
|
data: o.value,
|
|
490
490
|
columns: M.value,
|
|
491
491
|
"scroll-x": _.value,
|
|
@@ -596,8 +596,8 @@ const rl = "/admin/file", ol = {
|
|
|
596
596
|
fullPath: o,
|
|
597
597
|
thumbnailUrl: W(o),
|
|
598
598
|
status: "finished"
|
|
599
|
-
}] : [] : (o == null ? void 0 : o.map((s,
|
|
600
|
-
id: L().valueOf() +
|
|
599
|
+
}] : [] : (o == null ? void 0 : o.map((s, g) => ({
|
|
600
|
+
id: L().valueOf() + g,
|
|
601
601
|
name: `img${L().valueOf()}`,
|
|
602
602
|
url: W(s),
|
|
603
603
|
fullPath: s,
|
|
@@ -613,7 +613,7 @@ const rl = "/admin/file", ol = {
|
|
|
613
613
|
async function n({
|
|
614
614
|
file: o,
|
|
615
615
|
onFinish: s,
|
|
616
|
-
onError:
|
|
616
|
+
onError: g,
|
|
617
617
|
onProgress: w
|
|
618
618
|
}, p) {
|
|
619
619
|
const _ = new FormData();
|
|
@@ -634,22 +634,22 @@ const rl = "/admin/file", ol = {
|
|
|
634
634
|
} = h.data;
|
|
635
635
|
o.url = W(M), o.fullPath = M, o.thumbnailUrl = W(M), s(), d();
|
|
636
636
|
}).catch(() => {
|
|
637
|
-
o = null,
|
|
637
|
+
o = null, g();
|
|
638
638
|
}).finally(() => {
|
|
639
639
|
}));
|
|
640
640
|
}
|
|
641
641
|
function d() {
|
|
642
642
|
console.log("onSubmit", u.value);
|
|
643
|
-
const o = u.value.reduce((s,
|
|
643
|
+
const o = u.value.reduce((s, g) => (g.status === "finished" && (g != null && g.fullPath) && s.push(g.fullPath), s), []);
|
|
644
644
|
t.max === 1 && o.length === 1 ? a("update:value", o[0]) : o.length ? a("update:value", o) : a("update:value", t.max === 1 ? null : []);
|
|
645
645
|
}
|
|
646
646
|
return (o, s) => {
|
|
647
|
-
const
|
|
647
|
+
const g = X("n-upload"), w = X("n-space");
|
|
648
648
|
return B(), K(w, {
|
|
649
649
|
align: "end",
|
|
650
650
|
"wrap-item": !1
|
|
651
651
|
}, {
|
|
652
|
-
default: v(() => [f(
|
|
652
|
+
default: v(() => [f(g, {
|
|
653
653
|
"file-list": u.value,
|
|
654
654
|
"onUpdate:fileList": s[0] || (s[0] = (p) => u.value = p),
|
|
655
655
|
accept: ".jpeg,.jpg,.png",
|
|
@@ -680,7 +680,7 @@ const rl = "/admin/file", ol = {
|
|
|
680
680
|
}
|
|
681
681
|
}, il = /* @__PURE__ */ oe(ol, [["__scopeId", "data-v-54e2cc87"]]);
|
|
682
682
|
function $e(e = [], l = $, t = T) {
|
|
683
|
-
return
|
|
683
|
+
return y(e).reduce((a, u) => (a[u[t]] = {
|
|
684
684
|
...u,
|
|
685
685
|
[l]: u[l],
|
|
686
686
|
[t]: u[t]
|
|
@@ -707,14 +707,14 @@ const fl = {
|
|
|
707
707
|
_value: n,
|
|
708
708
|
_isRead: d
|
|
709
709
|
}) => {
|
|
710
|
-
const o =
|
|
710
|
+
const o = y(n), s = y(d);
|
|
711
711
|
return i ?? s ? f(Mt, a, {
|
|
712
712
|
default: () => [u ? u == null ? void 0 : u(o[l], o) : o[l]]
|
|
713
713
|
}) : f(Ue, I({
|
|
714
714
|
value: o[l],
|
|
715
|
-
"onUpdate:value": (
|
|
715
|
+
"onUpdate:value": (g) => o[l] = g,
|
|
716
716
|
clearable: !0,
|
|
717
|
-
placeholder: `请输入${
|
|
717
|
+
placeholder: `请输入${y(e)}`
|
|
718
718
|
}, t), {
|
|
719
719
|
...(t == null ? void 0 : t.slots) || {}
|
|
720
720
|
});
|
|
@@ -732,18 +732,18 @@ const fl = {
|
|
|
732
732
|
_isRead: o
|
|
733
733
|
}) => {
|
|
734
734
|
var p, _;
|
|
735
|
-
const s =
|
|
736
|
-
return n ??
|
|
735
|
+
const s = y(d), g = y(o), w = Array.isArray(a) ? a : typeof a == "function" ? a(s[l]) : [];
|
|
736
|
+
return n ?? g ? f("div", null, [i ? i == null ? void 0 : i(s[l], w) : ((_ = (p = $e(w, (t == null ? void 0 : t.labelField) || $, (t == null ? void 0 : t.valueField) || T)) == null ? void 0 : p[s[l]]) == null ? void 0 : _[(t == null ? void 0 : t.labelField) || $]) || s[l]]) : f(It, I({
|
|
737
737
|
value: s[l],
|
|
738
738
|
"onUpdate:value": (h) => s[l] = h,
|
|
739
739
|
options: w,
|
|
740
|
-
loading:
|
|
740
|
+
loading: y(u),
|
|
741
741
|
clearable: !0,
|
|
742
742
|
filterable: !0,
|
|
743
743
|
"fallback-option": () => (t != null && t.asyncFallback || (s[l] = null), !1),
|
|
744
744
|
labelField: (t == null ? void 0 : t.labelField) || $,
|
|
745
745
|
valueField: (t == null ? void 0 : t.valueField) || T,
|
|
746
|
-
placeholder: `请选择${
|
|
746
|
+
placeholder: `请选择${y(e)}`,
|
|
747
747
|
style: "width:100%",
|
|
748
748
|
"max-tag-count": "responsive"
|
|
749
749
|
}, t), {
|
|
@@ -762,15 +762,15 @@ const fl = {
|
|
|
762
762
|
_value: d,
|
|
763
763
|
_isRead: o
|
|
764
764
|
}) => {
|
|
765
|
-
const s =
|
|
766
|
-
return n ??
|
|
765
|
+
const s = y(d), g = y(o);
|
|
766
|
+
return n ?? g ? f("div", null, [i ? i == null ? void 0 : i(s[l]) : Te(s[l], a)]) : f(Pe, I({
|
|
767
767
|
"formatted-value": s[l],
|
|
768
768
|
"onUpdate:formatted-value": (w) => {
|
|
769
769
|
s[l] = w;
|
|
770
770
|
},
|
|
771
771
|
type: u,
|
|
772
772
|
clearable: !0,
|
|
773
|
-
placeholder: `请选择${
|
|
773
|
+
placeholder: `请选择${y(e)}`,
|
|
774
774
|
"update-value-on-close": !["year"].includes(t == null ? void 0 : t.type),
|
|
775
775
|
style: "width:100%"
|
|
776
776
|
}, t), {
|
|
@@ -788,16 +788,16 @@ const fl = {
|
|
|
788
788
|
_value: n,
|
|
789
789
|
_isRead: d
|
|
790
790
|
}) => {
|
|
791
|
-
const o =
|
|
791
|
+
const o = y(n), s = y(d);
|
|
792
792
|
return i ?? s ? f("div", null, [a ? a == null ? void 0 : a(o[l]) : Te(o[l], u)]) : f(St, I({
|
|
793
793
|
"formatted-value": o[l],
|
|
794
|
-
"onUpdate:value": (
|
|
794
|
+
"onUpdate:value": (g, w) => {
|
|
795
795
|
console.log("v", w), o[l] = w;
|
|
796
796
|
},
|
|
797
797
|
clearable: !0,
|
|
798
798
|
format: "HH:mm:ss",
|
|
799
799
|
style: "width:100%",
|
|
800
|
-
placeholder: `请选择${
|
|
800
|
+
placeholder: `请选择${y(e)}`
|
|
801
801
|
}, t), {
|
|
802
802
|
...(t == null ? void 0 : t.slots) || {}
|
|
803
803
|
});
|
|
@@ -811,14 +811,14 @@ const fl = {
|
|
|
811
811
|
_value: u,
|
|
812
812
|
_isRead: i
|
|
813
813
|
}) => {
|
|
814
|
-
var
|
|
815
|
-
const n =
|
|
814
|
+
var g, w;
|
|
815
|
+
const n = y(u), d = y(i), o = {
|
|
816
816
|
date: "YYYY-MM-DD",
|
|
817
817
|
datetime: "YYYY-MM-DD HH:mm:ss",
|
|
818
818
|
time: "HH:mm:ss",
|
|
819
819
|
datetimerange: "YYYY-MM-DD HH:mm:ss",
|
|
820
820
|
daterange: "YYYY-MM-DD"
|
|
821
|
-
}, s = l != null && l.format ? (w = (
|
|
821
|
+
}, s = l != null && l.format ? (w = (g = l == null ? void 0 : l.format) == null ? void 0 : g.replace("yyyy", "YYYY")) == null ? void 0 : w.replace("dd", "DD") : o[(l == null ? void 0 : l.type) || t];
|
|
822
822
|
return console.log("formatStr type", t), console.log("formatStr", s), a ?? d ? f("div", null, [Array.isArray(e) ? `${n == null ? void 0 : n[e == null ? void 0 : e[0]]} - ${n == null ? void 0 : n[e == null ? void 0 : e[1]]}` : n == null ? void 0 : n[e]]) : f(Pe, I({
|
|
823
823
|
"formatted-value": Array.isArray(e) ? n != null && n[e == null ? void 0 : e[0]] && (n != null && n[e == null ? void 0 : e[1]]) ? [L(n == null ? void 0 : n[e == null ? void 0 : e[0]]).format(s), L(n == null ? void 0 : n[e == null ? void 0 : e[1]]).format(s)] : null : (n == null ? void 0 : n[e]) || null,
|
|
824
824
|
"onUpdate:formatted-value": (p) => {
|
|
@@ -845,8 +845,8 @@ const fl = {
|
|
|
845
845
|
valueField: o
|
|
846
846
|
}) => {
|
|
847
847
|
var w, p;
|
|
848
|
-
const s =
|
|
849
|
-
return u ??
|
|
848
|
+
const s = y(i), g = y(n);
|
|
849
|
+
return u ?? g ? f("div", null, [(p = (w = $e(Array.isArray(l) ? l : [], (t == null ? void 0 : t.labelField) || d || $, (t == null ? void 0 : t.valueField) || o || T)) == null ? void 0 : w[s[e]]) == null ? void 0 : p[(t == null ? void 0 : t.labelField) || d || $]]) : f(Dt, I({
|
|
850
850
|
style: {
|
|
851
851
|
width: "100%"
|
|
852
852
|
},
|
|
@@ -879,14 +879,14 @@ const fl = {
|
|
|
879
879
|
_value: u,
|
|
880
880
|
_isRead: i
|
|
881
881
|
}) => {
|
|
882
|
-
const n =
|
|
882
|
+
const n = y(u), d = y(i);
|
|
883
883
|
return a ?? d ? f("div", null, [n[l]]) : f(Ue, I({
|
|
884
884
|
value: n[l],
|
|
885
885
|
"onUpdate:value": (o) => n[l] = o,
|
|
886
886
|
clearable: !0,
|
|
887
887
|
style: "width:100%",
|
|
888
888
|
"allow-input": (o) => !o || /^\d$/.test(o) || o.length <= 11,
|
|
889
|
-
placeholder: `请输入${
|
|
889
|
+
placeholder: `请输入${y(e)}`
|
|
890
890
|
}, t), {
|
|
891
891
|
...t == null ? void 0 : t.slots
|
|
892
892
|
});
|
|
@@ -900,7 +900,7 @@ const fl = {
|
|
|
900
900
|
_value: u,
|
|
901
901
|
_isRead: i
|
|
902
902
|
}) => {
|
|
903
|
-
const n =
|
|
903
|
+
const n = y(u), d = y(i);
|
|
904
904
|
return a ?? d ? f("div", null, [n[l]]) : f(At, I({
|
|
905
905
|
value: typeof n[l] == "string" && n[l] ? Number(n[l]) : n[l],
|
|
906
906
|
"onUpdate:value": (o) => {
|
|
@@ -909,7 +909,7 @@ const fl = {
|
|
|
909
909
|
showButton: !1,
|
|
910
910
|
clearable: !0,
|
|
911
911
|
style: "width:100%",
|
|
912
|
-
placeholder: `请输入${
|
|
912
|
+
placeholder: `请输入${y(e)}`,
|
|
913
913
|
min: 0
|
|
914
914
|
}, t), {
|
|
915
915
|
...(t == null ? void 0 : t.slots) || {}
|
|
@@ -921,7 +921,7 @@ const fl = {
|
|
|
921
921
|
}, {
|
|
922
922
|
_value: t
|
|
923
923
|
}) => {
|
|
924
|
-
const a =
|
|
924
|
+
const a = y(t);
|
|
925
925
|
return f(_t, I({
|
|
926
926
|
multiple: !0,
|
|
927
927
|
max: 1,
|
|
@@ -957,11 +957,11 @@ const fl = {
|
|
|
957
957
|
_isRead: d
|
|
958
958
|
}) => {
|
|
959
959
|
var p;
|
|
960
|
-
const o =
|
|
960
|
+
const o = y(n);
|
|
961
961
|
console.log(l), console.log(i);
|
|
962
|
-
const s = (p = i == null ? void 0 : i.data) != null && p.length ? i.data : o[e],
|
|
962
|
+
const s = (p = i == null ? void 0 : i.data) != null && p.length ? i.data : o[e], g = Array.isArray(a) ? a : typeof a == "function" ? a(o[e]) : [], w = {
|
|
963
963
|
data: s,
|
|
964
|
-
columns:
|
|
964
|
+
columns: g,
|
|
965
965
|
maxHeight: 200,
|
|
966
966
|
minHeight: 200,
|
|
967
967
|
isEllipsis: !1,
|
|
@@ -977,7 +977,7 @@ const fl = {
|
|
|
977
977
|
}, {
|
|
978
978
|
_value: t
|
|
979
979
|
}) => {
|
|
980
|
-
const a =
|
|
980
|
+
const a = y(t);
|
|
981
981
|
return f(wt, I({
|
|
982
982
|
percentage: a[e]
|
|
983
983
|
}, l), null);
|
|
@@ -991,7 +991,7 @@ const fl = {
|
|
|
991
991
|
_isRead: a,
|
|
992
992
|
_value: u
|
|
993
993
|
}) => {
|
|
994
|
-
const i =
|
|
994
|
+
const i = y(u), n = y(a);
|
|
995
995
|
return f(il, I({
|
|
996
996
|
value: i[e],
|
|
997
997
|
"onUpdate:value": (d) => i[e] = d,
|
|
@@ -1007,7 +1007,7 @@ const fl = {
|
|
|
1007
1007
|
}, {
|
|
1008
1008
|
_value: a
|
|
1009
1009
|
}) => {
|
|
1010
|
-
const u =
|
|
1010
|
+
const u = y(a);
|
|
1011
1011
|
return f(z, I({
|
|
1012
1012
|
type: "info"
|
|
1013
1013
|
}, l, {
|
|
@@ -1024,7 +1024,7 @@ const fl = {
|
|
|
1024
1024
|
_isRead: a,
|
|
1025
1025
|
_value: u
|
|
1026
1026
|
}) => {
|
|
1027
|
-
const i =
|
|
1027
|
+
const i = y(u), n = y(a);
|
|
1028
1028
|
return t ?? n ? f("div", null, [i[e] ? "是" : "否"]) : f(bt, I({
|
|
1029
1029
|
value: i[e],
|
|
1030
1030
|
"onUpdate:value": (d) => i[e] = d
|
|
@@ -1043,9 +1043,9 @@ const fl = {
|
|
|
1043
1043
|
labelField: n,
|
|
1044
1044
|
valueField: d
|
|
1045
1045
|
}) => {
|
|
1046
|
-
var
|
|
1047
|
-
const o =
|
|
1048
|
-
return a ?? s ? f("div", null, [(p = (w = (
|
|
1046
|
+
var g, w, p;
|
|
1047
|
+
const o = y(u), s = y(i);
|
|
1048
|
+
return a ?? s ? f("div", null, [(p = (w = (g = Array.isArray(l) ? l : []) == null ? void 0 : g.filter((_) => {
|
|
1049
1049
|
var h;
|
|
1050
1050
|
return (h = o[e]) == null ? void 0 : h.includes(_[(t == null ? void 0 : t.valueField) || d || T]);
|
|
1051
1051
|
})) == null ? void 0 : w.map((_) => _[(t == null ? void 0 : t.labelField) || n || $])) == null ? void 0 : p.join("、")]) : f(ht, I({
|
|
@@ -1075,7 +1075,7 @@ const fl = {
|
|
|
1075
1075
|
options: t
|
|
1076
1076
|
}, {
|
|
1077
1077
|
_value: a
|
|
1078
|
-
}) => (
|
|
1078
|
+
}) => (y(a), f("div", null, [Z("FilterSelect 组件需要外部提供")]))
|
|
1079
1079
|
};
|
|
1080
1080
|
let J = {};
|
|
1081
1081
|
class cl {
|
|
@@ -1197,12 +1197,12 @@ const hl = /* @__PURE__ */ j((e, {
|
|
|
1197
1197
|
}, {
|
|
1198
1198
|
immediate: !0
|
|
1199
1199
|
});
|
|
1200
|
-
function
|
|
1200
|
+
function g(r, A) {
|
|
1201
1201
|
let m = {};
|
|
1202
1202
|
const x = typeof r;
|
|
1203
1203
|
let b = null;
|
|
1204
1204
|
try {
|
|
1205
|
-
return r ? x === "string" || x === "object" ? b = r : x === "function" && (b = r(
|
|
1205
|
+
return r ? x === "string" || x === "object" ? b = r : x === "function" && (b = r(y(a), {
|
|
1206
1206
|
formRef: i,
|
|
1207
1207
|
resetForm: () => {
|
|
1208
1208
|
var c;
|
|
@@ -1215,7 +1215,7 @@ const hl = /* @__PURE__ */ j((e, {
|
|
|
1215
1215
|
setValue: w
|
|
1216
1216
|
})) : b = r, typeof b == "object" && !Array.isArray(b) ? Object.keys(b).forEach((c) => {
|
|
1217
1217
|
const C = b[c];
|
|
1218
|
-
it(C) ? m[c] =
|
|
1218
|
+
it(C) ? m[c] = y(C) : m[c] = C;
|
|
1219
1219
|
}) : m = b, m;
|
|
1220
1220
|
} catch {
|
|
1221
1221
|
return {};
|
|
@@ -1244,34 +1244,34 @@ const hl = /* @__PURE__ */ j((e, {
|
|
|
1244
1244
|
function _(r) {
|
|
1245
1245
|
if (!r) return;
|
|
1246
1246
|
let A = r;
|
|
1247
|
-
return typeof r == "function" && (A =
|
|
1247
|
+
return typeof r == "function" && (A = g(r)), A = g(A), le(A) ? (console.log("??? isVNode"), A) : typeof A == "string" ? (console.log("??? string"), A) : Array.isArray(A) ? (console.log("???"), f(ue, null, [A.map((m, x) => f(M, {
|
|
1248
1248
|
item: m,
|
|
1249
1249
|
index: x
|
|
1250
|
-
}, null))])) : typeof A == "object" ? (console.log("??? object"), A.props =
|
|
1250
|
+
}, null))])) : typeof A == "object" ? (console.log("??? object"), A.props = g((A == null ? void 0 : A.props) ?? {}), y(Y(() => {
|
|
1251
1251
|
var m;
|
|
1252
1252
|
return (m = s == null ? void 0 : s[(A == null ? void 0 : A.way) || "input"]) == null ? void 0 : m.call(s, h(A), {
|
|
1253
|
-
_value: A != null && A.queryType ?
|
|
1254
|
-
_formRef:
|
|
1255
|
-
_isRead:
|
|
1253
|
+
_value: A != null && A.queryType ? y(a)[A == null ? void 0 : A.queryType] : y(a),
|
|
1254
|
+
_formRef: y(i),
|
|
1255
|
+
_isRead: y(u),
|
|
1256
1256
|
labelField: $,
|
|
1257
1257
|
valueField: T
|
|
1258
1258
|
});
|
|
1259
1259
|
}))) : null;
|
|
1260
1260
|
}
|
|
1261
1261
|
function h(r) {
|
|
1262
|
-
return
|
|
1262
|
+
return y(r.enum) && (r.options = We(y(r.enum))), r;
|
|
1263
1263
|
}
|
|
1264
1264
|
function M({
|
|
1265
1265
|
item: r,
|
|
1266
1266
|
index: A
|
|
1267
1267
|
}) {
|
|
1268
1268
|
var m, x, b, c, C, U;
|
|
1269
|
-
return r.formItemProps =
|
|
1269
|
+
return r.formItemProps = g(r == null ? void 0 : r.formItemProps), r.formItemProps || (r.formItemProps = {}), !((m = r.formItemProps) != null && m.labelWidth) && ((x = e.formProps) != null && x.labelWidth) && (r.formItemProps.labelWidth = (b = e.formProps) == null ? void 0 : b.labelWidth), rt(f(Ft, I({
|
|
1270
1270
|
key: A,
|
|
1271
1271
|
showLabel: !(r != null && r.noLabel)
|
|
1272
1272
|
}, r == null ? void 0 : r.formItemProps, {
|
|
1273
1273
|
labelWidth: ((c = r == null ? void 0 : r.formItemProps) == null ? void 0 : c.labelWidth) || "auto",
|
|
1274
|
-
feedback:
|
|
1274
|
+
feedback: g((C = r == null ? void 0 : r.formItemProps) == null ? void 0 : C.feedback),
|
|
1275
1275
|
style: {
|
|
1276
1276
|
padding: "0 15px",
|
|
1277
1277
|
boxSizing: "border-box",
|
|
@@ -1292,7 +1292,7 @@ const hl = /* @__PURE__ */ j((e, {
|
|
|
1292
1292
|
default: () => [f(gl, {
|
|
1293
1293
|
name: r == null ? void 0 : r.labelSuffix
|
|
1294
1294
|
}, null)]
|
|
1295
|
-
}) : (E = r == null ? void 0 : r.labelSuffix) == null ? void 0 : E.call(r) : f(ue, null, null), `${
|
|
1295
|
+
}) : (E = r == null ? void 0 : r.labelSuffix) == null ? void 0 : E.call(r) : f(ue, null, null), `${y(typeof (r == null ? void 0 : r[e.labelField || "label"]) == "function" ? (R = r == null ? void 0 : r[e.labelField || "label"]) == null ? void 0 : R.call(r) : r == null ? void 0 : r[e.labelField || "label"]) || ""} ${u.value || r.read, " "}
|
|
1296
1296
|
`]);
|
|
1297
1297
|
}
|
|
1298
1298
|
}), [[ot("corePermission"), r == null ? void 0 : r.permission]]);
|
|
@@ -1311,9 +1311,9 @@ const hl = /* @__PURE__ */ j((e, {
|
|
|
1311
1311
|
}, ml(r = n.value.map(({
|
|
1312
1312
|
isRender: A = !0,
|
|
1313
1313
|
...m
|
|
1314
|
-
}, x) => (typeof
|
|
1314
|
+
}, x) => (typeof y(A) != "boolean" ? A != null && A(y(a)) : y(A)) ? m != null && m.render ? m == null ? void 0 : m.render(y(a), x, {
|
|
1315
1315
|
setValue: w,
|
|
1316
|
-
value:
|
|
1316
|
+
value: y(a)
|
|
1317
1317
|
}) : f(M, {
|
|
1318
1318
|
item: m,
|
|
1319
1319
|
index: x
|
|
@@ -1370,28 +1370,28 @@ function bl({
|
|
|
1370
1370
|
return Y(
|
|
1371
1371
|
() => (e == null ? void 0 : e.reduce((u, { fields: i, ...n }) => {
|
|
1372
1372
|
var o, s;
|
|
1373
|
-
Array.isArray(n == null ? void 0 : n.key) && n.key.forEach((
|
|
1374
|
-
n != null && n.required && (u[String(
|
|
1375
|
-
key:
|
|
1373
|
+
Array.isArray(n == null ? void 0 : n.key) && n.key.forEach((g) => {
|
|
1374
|
+
n != null && n.required && (u[String(g)] = {
|
|
1375
|
+
key: g,
|
|
1376
1376
|
type: "any",
|
|
1377
|
-
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(
|
|
1377
|
+
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(y(l), { ...a }) : n == null ? void 0 : n.required : !1,
|
|
1378
1378
|
message: (n == null ? void 0 : n.message) || `请选择${n == null ? void 0 : n[t]}`,
|
|
1379
1379
|
fields: i
|
|
1380
1380
|
});
|
|
1381
1381
|
});
|
|
1382
|
-
const d = n != null && n.rule ? typeof (n == null ? void 0 : n.rule) != "function" ? n == null ? void 0 : n.rule : n == null ? void 0 : n.rule(
|
|
1382
|
+
const d = n != null && n.rule ? typeof (n == null ? void 0 : n.rule) != "function" ? n == null ? void 0 : n.rule : n == null ? void 0 : n.rule(y(l), { ...a }) : i ? {
|
|
1383
1383
|
key: n == null ? void 0 : n.key,
|
|
1384
1384
|
type: "any",
|
|
1385
|
-
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(
|
|
1385
|
+
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(y(l), { ...a }) : n == null ? void 0 : n.required : !1,
|
|
1386
1386
|
message: (n == null ? void 0 : n.message) || `请${(o = n == null ? void 0 : n.options) != null && o.length ? "选择" : "输入"}${n == null ? void 0 : n[t]}`,
|
|
1387
1387
|
fields: i
|
|
1388
1388
|
} : {
|
|
1389
1389
|
key: n == null ? void 0 : n.key,
|
|
1390
1390
|
type: "any",
|
|
1391
|
-
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(
|
|
1391
|
+
required: n != null && n.required ? typeof (n == null ? void 0 : n.required) == "function" ? n == null ? void 0 : n.required(y(l), { ...a }) : n == null ? void 0 : n.required : !1,
|
|
1392
1392
|
message: (n == null ? void 0 : n.message) || `请${(s = n == null ? void 0 : n.options) != null && s.length ? "选择" : "输入"}${n == null ? void 0 : n[t]}`,
|
|
1393
1393
|
...Array.isArray(n == null ? void 0 : n.key) ? {
|
|
1394
|
-
validator: (
|
|
1394
|
+
validator: (g) => (console.log(g), !(n == null ? void 0 : n.key.every((p) => y(l)[p])) && (n != null && n.required) ? new Error(g == null ? void 0 : g.message) : !0)
|
|
1395
1395
|
} : {}
|
|
1396
1396
|
};
|
|
1397
1397
|
return d != null && d.required && (u[String(n == null ? void 0 : n.key)] = d), u;
|
|
@@ -1423,7 +1423,7 @@ const Ge = /* @__PURE__ */ j({
|
|
|
1423
1423
|
var o;
|
|
1424
1424
|
const t = re();
|
|
1425
1425
|
(o = t == null ? void 0 : t.appContext) != null && o.app && ee(t.appContext.app);
|
|
1426
|
-
const a = e, u = Y(() => a.options), i = P(), n = Le(e, "value"), d = Y(() =>
|
|
1426
|
+
const a = e, u = Y(() => a.options), i = P(), n = Le(e, "value"), d = Y(() => y(
|
|
1427
1427
|
u.value ? bl({
|
|
1428
1428
|
options: u.value,
|
|
1429
1429
|
model: n,
|
|
@@ -1434,22 +1434,22 @@ const Ge = /* @__PURE__ */ j({
|
|
|
1434
1434
|
return console.log(d.value), l({
|
|
1435
1435
|
formRef: i,
|
|
1436
1436
|
getRule: () => d.value,
|
|
1437
|
-
valid: (s = []) => (console.log("?? valid", s), new Promise((
|
|
1437
|
+
valid: (s = []) => (console.log("?? valid", s), new Promise((g, w) => {
|
|
1438
1438
|
var _;
|
|
1439
1439
|
const p = Oe(s);
|
|
1440
1440
|
(_ = i.value) == null || _.validate((h) => {
|
|
1441
1441
|
if (h) return w(h);
|
|
1442
|
-
|
|
1442
|
+
g();
|
|
1443
1443
|
}, (h) => p.length ? p.includes(h == null ? void 0 : h.key) : !0);
|
|
1444
1444
|
})),
|
|
1445
|
-
confirm: (s) => new Promise((
|
|
1445
|
+
confirm: (s) => new Promise((g, w) => {
|
|
1446
1446
|
var p;
|
|
1447
1447
|
(p = i.value) == null || p.validate((_) => {
|
|
1448
1448
|
if (_) return w(_);
|
|
1449
|
-
s && s(
|
|
1449
|
+
s && s(y(n)), g(y(n));
|
|
1450
1450
|
});
|
|
1451
1451
|
})
|
|
1452
|
-
}), (s,
|
|
1452
|
+
}), (s, g) => (B(), K(y(Ut), I({
|
|
1453
1453
|
ref_key: "formRef",
|
|
1454
1454
|
ref: i,
|
|
1455
1455
|
model: n.value,
|
|
@@ -1461,9 +1461,9 @@ const Ge = /* @__PURE__ */ j({
|
|
|
1461
1461
|
style: { minHeight: a.isNo ? "unset" : null }
|
|
1462
1462
|
}, a.formProps), {
|
|
1463
1463
|
default: v(() => [
|
|
1464
|
-
f(
|
|
1464
|
+
f(y(hl), {
|
|
1465
1465
|
value: n.value,
|
|
1466
|
-
"onUpdate:value":
|
|
1466
|
+
"onUpdate:value": g[0] || (g[0] = (w) => n.value = w),
|
|
1467
1467
|
"form-ref": i.value,
|
|
1468
1468
|
option: a.options,
|
|
1469
1469
|
"label-field": a.labelField,
|
|
@@ -1511,7 +1511,7 @@ function Je({
|
|
|
1511
1511
|
isNo: d = !0,
|
|
1512
1512
|
formProps: o = {},
|
|
1513
1513
|
interfaceFn: s = null,
|
|
1514
|
-
interfaceFnCancel:
|
|
1514
|
+
interfaceFnCancel: g = null,
|
|
1515
1515
|
valueData: w,
|
|
1516
1516
|
read: p,
|
|
1517
1517
|
isRead: _,
|
|
@@ -1585,7 +1585,7 @@ function Je({
|
|
|
1585
1585
|
onClick: ({
|
|
1586
1586
|
cancel: S
|
|
1587
1587
|
}) => {
|
|
1588
|
-
|
|
1588
|
+
g ? g(y(c), {
|
|
1589
1589
|
close: S
|
|
1590
1590
|
}) : S();
|
|
1591
1591
|
}
|
|
@@ -1595,7 +1595,7 @@ function Je({
|
|
|
1595
1595
|
onClick: async ({
|
|
1596
1596
|
cancel: S,
|
|
1597
1597
|
hideLoading: O
|
|
1598
|
-
}) => s ? await s(
|
|
1598
|
+
}) => s ? await s(y(c), {
|
|
1599
1599
|
close: S,
|
|
1600
1600
|
hideLoading: O
|
|
1601
1601
|
}) : S()
|
|
@@ -1620,7 +1620,7 @@ function Je({
|
|
|
1620
1620
|
}
|
|
1621
1621
|
const ie = p ?? _ ? null : typeof h == "function" ? () => h({
|
|
1622
1622
|
formRef: x,
|
|
1623
|
-
data:
|
|
1623
|
+
data: y(c),
|
|
1624
1624
|
d: D.value,
|
|
1625
1625
|
close: F
|
|
1626
1626
|
}) : () => {
|
|
@@ -1649,8 +1649,8 @@ function Je({
|
|
|
1649
1649
|
const ce = () => b[fe] = !0, Me = () => b[fe] = !1;
|
|
1650
1650
|
O != null && O.loading && ce();
|
|
1651
1651
|
try {
|
|
1652
|
-
console.log("model",
|
|
1653
|
-
model:
|
|
1652
|
+
console.log("model", y(c)), O != null && O.valid && await G(), console.log(O == null ? void 0 : O.valid), (O != null && O.valid || O != null && O.loading) && ce(), await ((Ie = O == null ? void 0 : O.onClick) == null ? void 0 : Ie.call(O, {
|
|
1653
|
+
model: y(c),
|
|
1654
1654
|
comfirm: k,
|
|
1655
1655
|
cancel: F,
|
|
1656
1656
|
validate: G,
|
|
@@ -1684,8 +1684,8 @@ function Je({
|
|
|
1684
1684
|
x.value = S;
|
|
1685
1685
|
},
|
|
1686
1686
|
options: a,
|
|
1687
|
-
value: c,
|
|
1688
|
-
"onUpdate:value": (S) => c = S,
|
|
1687
|
+
value: y(c),
|
|
1688
|
+
"onUpdate:value": (S) => c.value = S,
|
|
1689
1689
|
isNo: d,
|
|
1690
1690
|
read: p ?? _,
|
|
1691
1691
|
labelField: n,
|
|
@@ -1704,7 +1704,7 @@ function Je({
|
|
|
1704
1704
|
...c.value,
|
|
1705
1705
|
...S
|
|
1706
1706
|
},
|
|
1707
|
-
model:
|
|
1707
|
+
model: y(c),
|
|
1708
1708
|
modeEnum: m
|
|
1709
1709
|
};
|
|
1710
1710
|
}
|
|
@@ -1796,7 +1796,7 @@ const _l = {
|
|
|
1796
1796
|
function o() {
|
|
1797
1797
|
d();
|
|
1798
1798
|
}
|
|
1799
|
-
const s = P(!1),
|
|
1799
|
+
const s = P(!1), g = Le(e, "query"), w = {
|
|
1800
1800
|
style: {
|
|
1801
1801
|
width: "33%"
|
|
1802
1802
|
}
|
|
@@ -1869,7 +1869,7 @@ const _l = {
|
|
|
1869
1869
|
var m;
|
|
1870
1870
|
(m = i.options) == null || m.forEach((x) => {
|
|
1871
1871
|
const b = (x == null ? void 0 : x.key) || (x == null ? void 0 : x.value);
|
|
1872
|
-
b && (x != null && x.queryType ? (
|
|
1872
|
+
b && (x != null && x.queryType ? (g.value[x.queryType] || (g.value[x.queryType] = {}), g.value[x.queryType][b] = null) : g.value[b] = null);
|
|
1873
1873
|
}), u("reset");
|
|
1874
1874
|
}
|
|
1875
1875
|
function r(m) {
|
|
@@ -1879,20 +1879,20 @@ const _l = {
|
|
|
1879
1879
|
document.addEventListener("keydown", r);
|
|
1880
1880
|
}), ft(() => {
|
|
1881
1881
|
document.removeEventListener("keydown", r);
|
|
1882
|
-
}), (m, x) => (B(), K(
|
|
1882
|
+
}), (m, x) => (B(), K(y(V), {
|
|
1883
1883
|
"wrap-item": !1,
|
|
1884
1884
|
justify: "space-between",
|
|
1885
1885
|
align: "center",
|
|
1886
1886
|
wrap: !1
|
|
1887
1887
|
}, {
|
|
1888
1888
|
default: v(() => [_e("div", _l, [f(Ge, {
|
|
1889
|
-
value:
|
|
1890
|
-
"onUpdate:value": x[0] || (x[0] = (b) =>
|
|
1889
|
+
value: g.value,
|
|
1890
|
+
"onUpdate:value": x[0] || (x[0] = (b) => g.value = b),
|
|
1891
1891
|
options: _.value,
|
|
1892
1892
|
"form-props": {
|
|
1893
1893
|
showFeedback: !1
|
|
1894
1894
|
}
|
|
1895
|
-
}, null, 8, ["value", "options"])]), i.noButton ? ct("", !0) : (B(), K(
|
|
1895
|
+
}, null, 8, ["value", "options"])]), i.noButton ? ct("", !0) : (B(), K(y(V), {
|
|
1896
1896
|
key: 0,
|
|
1897
1897
|
align: "center",
|
|
1898
1898
|
wrap: !1
|
|
@@ -2012,7 +2012,7 @@ const Ol = /* @__PURE__ */ j((e) => {
|
|
|
2012
2012
|
isRender: d = () => !0,
|
|
2013
2013
|
onClick: o = null,
|
|
2014
2014
|
mode: s = null,
|
|
2015
|
-
disabled:
|
|
2015
|
+
disabled: g = !1,
|
|
2016
2016
|
type: w = "primary",
|
|
2017
2017
|
...p
|
|
2018
2018
|
}, _) => (typeof d == "function" ? d(e.data) : d) ? s === "pop" ? f(Xe, {
|
|
@@ -2024,8 +2024,8 @@ const Ol = /* @__PURE__ */ j((e) => {
|
|
|
2024
2024
|
}, {
|
|
2025
2025
|
default: () => [f(z, I({
|
|
2026
2026
|
text: !0,
|
|
2027
|
-
disabled: typeof
|
|
2028
|
-
type: typeof
|
|
2027
|
+
disabled: typeof g == "function" ? g(e.data) : g,
|
|
2028
|
+
type: typeof g == "function" && g(e.data) ? "default" : w
|
|
2029
2029
|
}, p), {
|
|
2030
2030
|
default: () => [typeof (p == null ? void 0 : p.label) == "function" ? p == null ? void 0 : p.label(e.data) : p == null ? void 0 : p.label]
|
|
2031
2031
|
})]
|
|
@@ -2033,7 +2033,7 @@ const Ol = /* @__PURE__ */ j((e) => {
|
|
|
2033
2033
|
row: e.data,
|
|
2034
2034
|
action: {
|
|
2035
2035
|
...p,
|
|
2036
|
-
disabled:
|
|
2036
|
+
disabled: g,
|
|
2037
2037
|
onClick: o,
|
|
2038
2038
|
type: w
|
|
2039
2039
|
},
|
|
@@ -2176,8 +2176,8 @@ function Kl(e, l = null, t) {
|
|
|
2176
2176
|
let i = [], n = 0;
|
|
2177
2177
|
const d = [];
|
|
2178
2178
|
return Array.isArray(e) && (i = e, i.forEach((o, s) => {
|
|
2179
|
-
var
|
|
2180
|
-
o.permission ? we(o.permission) && ((!t || typeof u == "object" && s < u.max) && (n += (typeof (o == null ? void 0 : o.label) == "string" ? (
|
|
2179
|
+
var g, w;
|
|
2180
|
+
o.permission ? we(o.permission) && ((!t || typeof u == "object" && s < u.max) && (n += (typeof (o == null ? void 0 : o.label) == "string" ? (g = o == null ? void 0 : o.label) == null ? void 0 : g.length : 10) * 12 + 36), d.push(o)) : ((!t || typeof u == "object" && s < u.max) && (n += (typeof (o == null ? void 0 : o.label) == "string" ? (w = o == null ? void 0 : o.label) == null ? void 0 : w.length : 10) * 12 + 36), d.push(o));
|
|
2181
2181
|
})), n = Math.max(80, n), n += 0, u && (n += 2), d.length ? {
|
|
2182
2182
|
title: "操作",
|
|
2183
2183
|
key: "opr",
|
|
@@ -2186,7 +2186,7 @@ function Kl(e, l = null, t) {
|
|
|
2186
2186
|
width: n,
|
|
2187
2187
|
...l,
|
|
2188
2188
|
render(o, s) {
|
|
2189
|
-
const
|
|
2189
|
+
const g = u ? f(Ol, {
|
|
2190
2190
|
data: o,
|
|
2191
2191
|
index: s,
|
|
2192
2192
|
max: u.max,
|
|
@@ -2228,8 +2228,8 @@ function Kl(e, l = null, t) {
|
|
|
2228
2228
|
"wrap-item": !1,
|
|
2229
2229
|
size: 18,
|
|
2230
2230
|
key: ae(o, s)
|
|
2231
|
-
}, Dl(
|
|
2232
|
-
default: () => [
|
|
2231
|
+
}, Dl(g) ? g : {
|
|
2232
|
+
default: () => [g]
|
|
2233
2233
|
});
|
|
2234
2234
|
}
|
|
2235
2235
|
} : void 0;
|
package/examples/package.json
CHANGED
package/examples/pnpm-lock.yaml
CHANGED
package/package.json
CHANGED