vue3-curd 1.0.21 → 1.0.23
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/style.css +1 -1
- package/dist/vue3-curd.es.js +1068 -1024
- package/dist/vue3-curd.es.js.map +1 -1
- package/dist/vue3-curd.umd.js +1 -1
- package/dist/vue3-curd.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/vue3-curd.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(M,B){typeof exports=="object"&&typeof module<"u"?B(exports,require("element-plus/es"),require("vue"),require("vue-types"),require("@element-plus/icons-vue"),require("axios"),require("image-conversion"),require("pinia"),require("@vueup/vue-quill/dist/vue-quill.snow.css"),require("@vueup/vue-quill"),require("vue-i18n"),require("dayjs"),require("file-saver")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","vue","vue-types","@element-plus/icons-vue","axios","image-conversion","pinia","@vueup/vue-quill/dist/vue-quill.snow.css","@vueup/vue-quill","vue-i18n","dayjs","file-saver"],B):(M=typeof globalThis<"u"?globalThis:M||self,B(M.Vue3Curd={},M.ElementPlus,M.Vue,M.VueTypes,M.ElementPlusIconsVue,M.axios,M.imageConversion,M.Pinia,null,M.VueQuill,M.VueI18n,M.dayjs,M.FileSaver))})(this,(function(M,B,e,nt,me,ct,st,Te,Ul,$e,xe,it,dt){"use strict";const Q=nt.createTypes({func:void 0,bool:void 0,string:void 0,number:void 0,object:void 0,integer:void 0}),pt=["xlink:href","fill"],ft=e.defineComponent({__name:"index",props:{iconClass:Q.string.isRequired,className:Q.string.def(""),color:Q.string.def("")},setup(t){const o=t,a=e.computed(()=>`#icon-${o.iconClass}`),l=e.computed(()=>o.className?`svg-icon ${o.className}`:"svg-icon");return(c,r)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(e.unref(l)),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":e.unref(a),fill:t.color},null,8,pt)],2))}}),te=(t,o)=>{const a=t.__vccOpts||t;for(const[l,c]of o)a[l]=c;return a},ce=te(ft,[["__scopeId","data-v-ed552a8d"]]),he=e.defineComponent({__name:"index",props:{options:{type:Array,default:null},value:{type:[Number,String,Array,void 0],default:""},separator:{type:String,default:"、"}},setup(t){const o=t,a=e.computed(()=>{const l=o.value;if(l===""||l===null||typeof l>"u")return"";const c=r=>{var m;const i=(m=o.options)==null?void 0:m.find(f=>f.value==r||f.label==r);return(i==null?void 0:i.label)??""};if(Array.isArray(l))return l.map(r=>c(r)).filter(Boolean).join(o.separator);if(typeof l=="string"){let r=[];if(l.indexOf(",")>-1?r=l.split(","):l.indexOf("、")>-1&&(r=l.split("、")),r.length>0)return r.map(i=>c(i)).filter(Boolean).join(o.separator)}return c(l)||l});return(l,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(e.unref(a)),1))}}),ge=te(e.defineComponent({__name:"index",props:{options:{type:Array,default:null},value:{type:[Number,String,Array,void 0],default:""}},setup(t){const o=t,a=e.computed(()=>{const l=o.value;if(l===""||l===null||typeof l>"u")return"";if(Array.isArray(l)){const c=[];return o.options.map(r=>{(l.indexOf(r.value)>-1||l.indexOf(r.label)>-1)&&c.push(r)}),c}else if(typeof l=="string"){let c=[];if(l.indexOf(",")>-1?c=l.split(","):l.indexOf("、")>-1&&(c=l.split("、")),c.length>0){const r=[];return o.options.map(i=>{(c.indexOf(i.value)>-1||c.indexOf(i.label)>-1)&&r.push(i)}),r}}return o.options.find(c=>c.value==l||c.label==l)||l});return(l,c)=>{const r=B.ElTag;return Array.isArray(e.unref(a))?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(a),i=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[i.label?(e.openBlock(),e.createBlock(r,{"disable-transitions":!0,key:i.value,type:i.elTagType||"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:2},1032,["type"])):e.createCommentVNode("",!0)],64))),256)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a).label?(e.openBlock(),e.createBlock(r,{"disable-transitions":!0,key:e.unref(a).value,type:e.unref(a).elTagType||"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a).label),1)]),_:1},8,["type"])):e.createCommentVNode("",!0)],64))}}}),[["__scopeId","data-v-9a5060d2"]]);let se=null,Ne=()=>({}),ye="";const ut=()=>{const t=ct.create({baseURL:ye,timeout:5e4});return t.interceptors.response.use(o=>o.data,o=>Promise.reject(o)),t},oe=()=>(se||(se=ut()),se),Ue=t=>{se=t},ie=()=>Ne(),Ae=t=>{Ne=t},de=()=>ye,Ie=t=>{ye=t||""};function ke(t){return oe()({url:"/resource/oss/listByIds/"+t,method:"get"})}function Le(t){return oe()({url:"/resource/oss/"+t,method:"delete"})}const mt={class:"image-slot"},ht={key:1},be=te(e.defineComponent({__name:"index",props:{modelValue:[String,Object,Array,Number],width:{type:[Number,String],default:""},height:{type:[Number,String],default:""}},setup(t){const o=t,a=e.ref(""),l=e.computed(()=>a.value?a.value.split(",")[0]:void 0),c=e.computed(()=>{if(!a.value)return;const i=a.value.split(","),m=[];return i.forEach(f=>m.push(f)),m}),r=e.computed(()=>{const i=o.width;return typeof i=="string"?i:`${i}px`});return e.computed(()=>{const i=o.height;return typeof i=="string"?i:`${i}px`}),e.watch(()=>o.modelValue,async i=>{if(i){let m;Array.isArray(i)?m=i:m=(await ke(i)).data,a.value=m.map(f=>f.url).join(",")}else a.value=""},{immediate:!0,deep:!0}),(i,m)=>{const f=B.ElIcon,w=B.ElImage;return e.openBlock(),e.createElementBlock("div",null,[e.unref(l)?(e.openBlock(),e.createBlock(w,{key:0,src:`${e.unref(l)}`,fit:"scale-down",loading:"lazy",style:e.normalizeStyle(`width:${e.unref(r)};height:${e.unref(r)};`),"preview-src-list":e.unref(c),"preview-teleported":""},{error:e.withCtx(()=>[e.createElementVNode("div",mt,[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(e.unref(me.PictureFilled))]),_:1})])]),_:1},8,["src","style","preview-src-list"])):(e.openBlock(),e.createElementBlock("div",ht,[e.createElementVNode("div",{class:"image-slot",style:e.normalizeStyle(`width:${e.unref(r)};height:${e.unref(r)};`)},[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(e.unref(me.PictureFilled))]),_:1})],4)]))])}}}),[["__scopeId","data-v-dc163acb"]]),gt={class:"image-slot"},Be=te(e.defineComponent({__name:"index",props:{data:{type:Object,default:()=>({})},width:{type:[Number,String],default:60},height:{type:[Number,String],default:60}},setup(t){const o=t,a=e.computed(()=>typeof o.width=="string"?o.width:`${o.width}px`),l=e.computed(()=>typeof o.height=="string"?o.height:`${o.height}px`);return(c,r)=>{const i=B.ElIcon,m=B.ElImage,f=ce;return e.openBlock(),e.createElementBlock("span",null,[[".jpg",".png",".jpeg"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(m,{key:0,src:t.data.url,fit:"cover","preview-src-list":[t.data.url],style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`),"preview-teleported":""},{error:e.withCtx(()=>[e.createElementVNode("div",gt,[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(me.PictureFilled))]),_:1})])]),_:1},8,["src","preview-src-list","style"])):[".xls",".xlsx",".csv"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:1,"icon-class":"excel",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".doc",".docx"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:2,"icon-class":"word",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".pdf"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:3,"icon-class":"pdf",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".tet"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:4,"icon-class":"tet",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".zip"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:5,"icon-class":"zip",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):(e.openBlock(),e.createBlock(f,{key:6,"icon-class":"unknown",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"]))])}}}),[["__scopeId","data-v-a3763021"]]),Pe={bool:[{label:"是",value:"1"},{label:"否",value:"0"},{label:"是",value:"True"},{label:"否",value:"False"}]},yt=[{prop:"createTime",width:"165px"},{prop:"createBy",width:"100px"},{prop:"orderNum",width:"80px"},{prop:"sort",width:"80px"},{prop:"code",width:"120px"},{prop:"updateTime",width:"165px"}],kt=[10,15,20,30,50,100],Fe={pageSize:15,pageNum:1,total:0,orderByColumn:"",isAsc:""},we={FULL:"total, sizes, prev, pager, next",SIMPLE:"total"},Oe=30,bt=28;function Ve(t){if(!t)return{};const o={};for(const a in t){const l=t[a];l!==""&&l!==null&&l!==void 0&&(!Array.isArray(l)||l.length>0)&&(o[a]=l)}return o}function Bt(t){if(t.width)return String(t.width);const o=yt.find(a=>a.prop===t.prop);return o?o.width:t.prop.includes("time")?"100px":"auto"}function wt(t,o){if(!o.prop)return"";let a;if(o.prop.includes(".")?a=o.prop.split(".").reduce((c,r)=>c==null?void 0:c[r],t):a=t[o.prop],a!=null){const l=o.prefix||"",c=o.suffix||"";return`${l}${a}${c}`}return""}function Vt(t){t.forEach(o=>{o.form||(o.form={order:100}),o.form.order==null&&(o.form.order=100),!o.form.type&&o.type&&(o.form.type=o.type),!o.form.prop&&o.prop&&(o.form.prop=o.prop),o.search&&!o.search.dictType&&o.dictType&&(o.search.dictType=o.dictType),!o.form.dictType&&o.dictType&&(o.form.dictType=o.dictType),!o.form.inactiveValue&&o.inactiveValue&&(o.form.inactiveValue=o.inactiveValue),!o.form.activeValue&&o.activeValue&&(o.form.activeValue=o.activeValue),o.form.type==="checkbox"&&(o.label=""),o.search&&(o.search.prop=o.search.prop??o.prop)})}function Ct(t){t.forEach(o=>{if(!o.form)return;const a=o.form.rules||[];o.form.required&&a.push({required:!0,message:`${o.label}必填`,trigger:"blur"}),o.form.rules=a.length>0?a:void 0})}function ze(t,o="order"){return[...t].sort((a,l)=>{const c=(m,f)=>{const w=f.split(".");let p=m;for(const I of w)p=p==null?void 0:p[I];return p??100},r=c(a,o),i=c(l,o);return r-i})}function St(t,o,a){return t.filter(l=>!(l.canEdit===!1||a&&l.canUpdate===!1||!a&&l.canCreate===!1))}function _t(t,o){if(!o.show)return!0;for(const a in o.show)if(o.show[a].includes(t[a]))return!0;return!1}function Dt(t,o){if(!o.disable&&!o.enable)return!1;for(const a in o.disable)if(o.disable[a].includes(t[a]))return!0;for(const a in o.enable)if(!o.enable[a].includes(t[a]))return!0;return!1}function Et(t,o,a,l){o&&o[0]&&o[1]&&(t[a]=`${o[0]},${o[1]}`,l==null||l.addDateRange(t,o,a))}function Tt(t){const{proxy:o}=e.getCurrentInstance(),a=e.ref([]),l=e.ref(!1),c=e.ref([]),r=e.ref({}),i=e.ref(),m=e.ref({...Fe,pageSize:t.initialPageSize??Fe.pageSize}),f=e.ref(kt),w=e.ref(we.FULL),p=async()=>{var E;if(!t.listApi){t.data?a.value=Array.isArray(t.data)?t.data:((E=t.data)==null?void 0:E.value)||[]:a.value=[];return}l.value=!0;try{const y=await I(null),D=await t.listApi(y);t.afterQuery&&await t.afterQuery(D);let $=D.rows||D.data;t.treeProps&&($=o==null?void 0:o.handleTree(D.data,t.rowKey)),a.value=$,m.value.total=D.total;const z=D.total/m.value.pageSize<=1;w.value=z?we.SIMPLE:we.FULL,o==null||o.$forceUpdate()}catch(y){console.error("Query failed:",y)}finally{l.value=!1}},I=async E=>{E&&(r.value=Ve(E));let y=t.queryParams||{};if(t.beforeQuery){const D=await t.beforeQuery({});y={...m.value,...y,...r.value,...D}}else y={...m.value,...y,...r.value};return y},S=E=>{E&&(r.value=Ve(E)),p()},L=E=>{m.value.pageNum=E,p()},x=E=>{m.value.pageSize=E,p()},P=E=>{E.order&&(m.value.orderByColumn=E.prop,m.value.isAsc=E.order),p()},j=E=>{c.value=E,t.selectionChange&&t.selectionChange(E)},H=()=>{const E=t.queryParams||{};E.orderByColumn&&(m.value.orderByColumn=E.orderByColumn,i.value={prop:E.orderByColumn,order:E.isAsc==="asc"?"ascending":"descending"}),E.isAsc&&(m.value.isAsc=E.isAsc)};return{listData:a,loading:l,multipleSelection:c,pageOptions:m,listSize:f,pagingLayout:w,defaultSort:i,executeQuery:p,getQueryParams:I,refreshTable:S,handlePageChange:L,handleSizeChange:x,handleSortChange:P,handleSelectionChange:j,initData:async()=>{H(),await p()}}}function Me(){const{proxy:t}=e.getCurrentInstance(),o=async r=>{for(const i of r)if(i.type==="dictTag"||i.type==="dictText"){const m=await(t==null?void 0:t.useOneDict(i.dictType));i.data=e.toRaw(m)}else if(i.type==="commonDictTag"||i.type==="commonDictText"){const m=await(t==null?void 0:t.useOneCommonDict(i.dictType));i.data=e.toRaw(m)}},a=async r=>{if(!r.search)return;switch(r.search.type){case"selectApi":r.search.api?await l(r):console.error(`${r.prop}中search对象未设置api参数`);break;case"treeSelectApi":r.search.api?await c(r):console.error(`${r.prop}中search对象未设置api参数`);break;case"selectCommonDict":r.search.data=await(t==null?void 0:t.useOneCommonDict(r.search.dictType));break;case"selectDict":r.search.data=await(t==null?void 0:t.useOneDict(r.search.dictType));break}},l=async r=>{var m;if(!((m=r.search)!=null&&m.api))return;const i={pageNum:1,pageSize:1e3,filedName:r.prop,...r.search.apiParams||{}};try{const f=await r.search.api(i);r.search.data=f.data||f.rows}catch(f){console.error(`Failed to load API data for ${r.prop}:`,f)}},c=async r=>{var i;if((i=r.search)!=null&&i.api)try{const m=await r.search.api({pageNum:1,pageSize:1e3});if(r.search.data=m.data||m.rows||m,r.search.data&&Array.isArray(r.search.data)){const w=(r.search.props||{value:"id",label:"label",children:"children"}).value||"id";r.search.defaultExpandedKeys=r.search.data.map(p=>p[w])}}catch(m){console.error(`Failed to load tree API data for ${r.prop}:`,m)}};return{initColumnDicts:o,initSearchDicts:a,initSelectApi:l}}let Ce=()=>!0,Re=()=>!0;const Ye=t=>{t.hasPermi&&(Ce=t.hasPermi),t.hasRoles&&(Re=t.hasRoles)},pe=t=>{if(t==null)return!0;const o=Array.isArray(t)?t:[t];return o.length===0?!0:Ce(o)},$t={mounted(t,o){var l;const{value:a}=o;a!=null&&Array.isArray(a)&&a.length>0&&(Ce(a)||(l=t.parentNode)==null||l.removeChild(t))}},xt={mounted(t,o){var l;const{value:a}=o;a!=null&&Array.isArray(a)&&a.length>0&&(Re(a)||(l=t.parentNode)==null||l.removeChild(t))}},Nt={key:2,class:"image-style"},Ut={key:3,class:"image-style"},At={key:8,class:"color-cell"},It={style:{margin:"20px 0px"}},je=te(e.defineComponent({__name:"curdTable",props:{dataSource:{},maxHeight:{}},emits:["actionEvent","selectionChange","rowClick"],setup(t,{expose:o,emit:a}){const{proxy:l}=e.getCurrentInstance(),c=a,r=t,i=e.computed(()=>r.dataSource.maxHeight??r.maxHeight),m=e.ref(),{listData:f,loading:w,multipleSelection:p,pageOptions:I,listSize:S,pagingLayout:L,defaultSort:x,refreshTable:P,handlePageChange:j,handleSizeChange:H,handleSortChange:C,handleSelectionChange:E,initData:y,getQueryParams:D}=Tt(r.dataSource),{initColumnDicts:$}=Me(),z=e.ref(Pe),V=b=>b==null?void 0:b[r.dataSource.rowKey],d=e.computed(()=>r.dataSource.actions?r.dataSource.actions.filter(b=>b.action!=="create"&&b.action!=="back"&&(!b.position||b.position==="table")&&pe(b.permission)):[]),_=b=>{var O;return!((O=r.dataSource.disabledCheckedRowKeys)!=null&&O.includes(V(b)))},T=e.computed(()=>{const b=r.dataSource.actionColumnWidth;if(b!=null&&b!=="")return typeof b=="number"?`${b}px`:b;let O=d.value.length*bt;return O<Oe&&(O=Oe),`${O+40}px`}),F=(b,O)=>_t(b,O),Y=(b,O)=>Dt(b,O),J=b=>Bt(b),k=b=>pe(b==null?void 0:b.permission),N=b=>{var q;const O=b.align||r.dataSource.align;return O||(((q=b.label)==null?void 0:q.indexOf("時間"))>-1||!1||b.type=="dictTag"||b.type=="image"||b.type=="switch"?"center":"left")},R=(b,O)=>{const q=l==null?void 0:l.useDict(b.dictType)[b.dictType];if(q!=null){const W=O[b.prop],K=q.filter(ae=>ae.value==W);return K.length==0?"":K[0].label}else console.error(b.dictType+" 字典不存在")},A=(b,O)=>{const q=z.value[b.dictType];if(q!=null){const W=O[b.prop],K=q.find(ae=>ae.value==W);return K==null?"":K.label}else console.error(b.dictType+" 字典不存在")},G=(b,O)=>{if(b.data!=null){const q=O[b.prop],W=b.data.find(K=>K.value==q);return W==null?"":W.label}else console.error("未配置data屬性")},Z=(b,O)=>{if(b.data!=null){const q=O[b.prop],W=b.data.find(K=>K.value==q);return W==null?"info":W.tagType}else console.error("未配置data屬性")},ee=(b,O)=>wt(b,O),X=b=>{const O=Array.isArray(b)?b:[];E(O),c("selectionChange",O)},le=(b,O,q)=>{var W,K;return(K=(W=r.dataSource).rowClick)==null?void 0:K.call(W,b,O,q)},s=(b,O)=>c("actionEvent",b,O),u=()=>p.value,n=async()=>{var O,q;if(!r.dataSource.showSelection||!((O=r.dataSource.checkedRowKeys)!=null&&O.length))return;await e.nextTick();const b=m.value;if(b!=null&&b.toggleRowSelection)for(const W of f.value){const K=V(W);if(K==null)continue;const ae=String(K);(q=r.dataSource.checkedRowKeys)!=null&&q.includes(ae)&&b.toggleRowSelection(W,!0)}},h=async()=>{var O,q;if(!r.dataSource.showSelection||!((O=r.dataSource.disabledCheckedRowKeys)!=null&&O.length))return;await e.nextTick();const b=m.value;if(b!=null&&b.toggleRowSelection)for(const W of f.value){const K=V(W);if(K==null)continue;const ae=String(K);(q=r.dataSource.disabledCheckedRowKeys)!=null&&q.includes(ae)&&b.toggleRowSelection(W,!0)}},rt=async()=>{await $(r.dataSource.columns),await y(),await h(),await n()};return e.onMounted(()=>rt()),o({refreshTable:P,getSelection:u,initData:rt,getQueryParams:D}),(b,O)=>{const q=B.ElTableColumn,W=B.ElImage,K=B.ElCheckbox,ae=B.ElSwitch,ne=B.ElTag,_l=ge,Dl=he,El=ce,fe=B.ElButton,Tl=B.ElTooltip,$l=B.ElTable,xl=B.ElPagination,ue=e.resolveDirective("hasPermi"),Nl=B.ElLoadingDirective;return e.openBlock(),e.createElementBlock("div",null,[e.withDirectives((e.openBlock(),e.createBlock($l,{ref_key:"curdTableRef",ref:m,data:e.unref(f),"row-key":r.dataSource.rowKey,"element-loading-text":b.$t("數據加載中..."),stripe:"","tree-props":r.dataSource.treeProps,"default-sort":e.unref(x),onSelectionChange:X,onSortChange:e.unref(C),onRowClick:le,"default-expand-all":r.dataSource.treeDefaultExpandAll??!1,"max-height":e.unref(i),"highlight-current-row":""},{empty:e.withCtx(()=>[e.createElementVNode("div",It,e.toDisplayString(b.$t("未查詢到數據")),1)]),default:e.withCtx(()=>[r.dataSource.showSelection?(e.openBlock(),e.createBlock(q,{key:0,type:"selection",width:"60",selectable:_,align:"center"})):e.createCommentVNode("",!0),r.dataSource.showIndex?(e.openBlock(),e.createBlock(q,{key:1,type:"index",width:"70",align:"center",label:"序號"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.dataSource.columns,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.prop||g.key},[g.width!==0&&k(g)?(e.openBlock(),e.createBlock(q,{key:0,label:g.label,width:J(g),"min-width":g.minWidth,prop:g.prop,align:N(g),sortable:g.sort?"custom":!1,"show-overflow-tooltip":g.showOverflowTooltip||!0,fixed:g.fixed},{default:e.withCtx(({row:U})=>[g.slot?e.renderSlot(b.$slots,g.slot,{key:0,row:U,column:g,value:U[g.prop]},void 0,!0):g.type==="image"&&U[g.prop]?(e.openBlock(),e.createBlock(be,{key:1,modelValue:U[g.prop],"onUpdate:modelValue":v=>U[g.prop]=v,class:"image-preview",width:24,height:24},null,8,["modelValue","onUpdate:modelValue"])):g.type==="networkImage"?(e.openBlock(),e.createElementBlock("view",Nt,[e.createVNode(W,{src:U[g.prop],fit:"cover",style:{height:"24px"}},null,8,["src"])])):g.type==="imageUrl"?(e.openBlock(),e.createElementBlock("view",Ut,[e.createVNode(W,{src:U[g.prop],fit:"cover",style:{height:"24px"}},null,8,["src"])])):g.type==="date"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(b.parseTime(U[g.prop],"{y}-{m}-{d}")),1)],64)):g.type==="timestamp"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[e.createTextVNode(e.toDisplayString(b.parseTime(U[g.prop])),1)],64)):g.type==="bool"?(e.openBlock(),e.createBlock(K,{key:6,modelValue:U[g.prop],"onUpdate:modelValue":v=>U[g.prop]=v,onClick:O[0]||(O[0]=e.withModifiers(()=>{},["stop","prevent"]))},null,8,["modelValue","onUpdate:modelValue"])):g.type==="switch"?(e.openBlock(),e.createBlock(ae,{key:7,modelValue:U[g.prop],"onUpdate:modelValue":v=>U[g.prop]=v,"active-value":g.activeValue||"0","inactive-value":g.inactiveValue||"1",size:"small","before-change":()=>!1},null,8,["modelValue","onUpdate:modelValue","active-value","inactive-value"])):g.type==="color"?(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("div",{class:"color-cell-item",style:e.normalizeStyle({backgroundColor:U[g.prop]||"#ffffff"})},null,4)])):g.type==="fromDict"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},[e.createTextVNode(e.toDisplayString(R(g,U)),1)],64)):g.type==="fromDataTag"?(e.openBlock(),e.createBlock(ne,{key:10,type:Z(g,U),effect:g.tagEffect??"light",class:"el-column-tag"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(G(g,U)),1)]),_:2},1032,["type","effect"])):g.type==="localDict"?(e.openBlock(),e.createBlock(ne,{key:11,type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(A(g,U)),1)]),_:2},1032,["type","effect"])):g.type==="tag"?(e.openBlock(),e.createBlock(ne,{key:12,type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag",plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(U[g.prop]),1)]),_:2},1032,["type","effect"])):g.type==="tagArrayObj"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:13},e.renderList(U[g.prop],v=>(e.openBlock(),e.createBlock(ne,{type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag",key:v[g.displayField],plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v[g.displayField]),1)]),_:2},1032,["type","effect"]))),128)):g.type==="tags"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:14},e.renderList(U[g.prop],v=>(e.openBlock(),e.createBlock(ne,{type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag",key:v[g.tagLabel],plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v[g.tagLabel]),1)]),_:2},1032,["type","effect"]))),128)):g.type==="dictTag"||g.type==="commonDictTag"?(e.openBlock(),e.createBlock(_l,{key:15,options:g.data||[],value:U[g.prop]},null,8,["options","value"])):g.type==="dictText"||g.type==="commonDictText"?(e.openBlock(),e.createBlock(Dl,{key:16,options:g.data||[],value:U[g.prop]},null,8,["options","value"])):g.type==="svg"?(e.openBlock(),e.createBlock(El,{key:17,"icon-class":U.icon},null,8,["icon-class"])):g.type==="ossFile"?(e.openBlock(),e.createBlock(Be,{key:18,data:U,width:32,height:32},null,8,["data"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:19},[e.createTextVNode(e.toDisplayString(ee(U,g)),1)],64))]),_:2},1032,["label","width","min-width","prop","align","sortable","show-overflow-tooltip","fixed"])):e.createCommentVNode("",!0)],64))),128)),e.unref(d).length>0?(e.openBlock(),e.createBlock(q,{key:2,align:"center",fixed:"right",label:b.$t("操作"),width:e.unref(T)},{default:e.withCtx(({row:g})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(d),U=>(e.openBlock(),e.createBlock(Tl,{content:U.text,placement:"top",key:U.action},{default:e.withCtx(()=>[F(g,U)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[U.action==="update"?e.withDirectives((e.openBlock(),e.createBlock(fe,{key:0,link:"",type:"primary",icon:"Edit",onClick:v=>s(U,g),disabled:Y(g,U)},null,8,["onClick","disabled"])),[[ue,U.permission||null]]):U.action==="delete"?e.withDirectives((e.openBlock(),e.createBlock(fe,{key:1,link:"",type:"primary",icon:"Delete",onClick:v=>s(U,g),disabled:Y(g,U)},null,8,["onClick","disabled"])),[[ue,U.permission||null]]):U.action==="view"||U.action==="viewDetail"?e.withDirectives((e.openBlock(),e.createBlock(fe,{key:2,link:"",type:"primary",icon:"View",onClick:v=>s(U,g),disabled:Y(g,U)},null,8,["onClick","disabled"])),[[ue,U.permission||null]]):e.withDirectives((e.openBlock(),e.createBlock(fe,{key:3,link:"",type:"primary",icon:U.icon,onClick:v=>s(U,g),disabled:Y(g,U)},null,8,["icon","onClick","disabled"])),[[ue,U.permission||null]])],64)):e.createCommentVNode("",!0)]),_:2},1032,["content"]))),128))]),_:1},8,["label","width"])):e.createCommentVNode("",!0)]),_:3},8,["data","row-key","element-loading-text","tree-props","default-sort","onSortChange","default-expand-all","max-height"])),[[Nl,e.unref(w)]]),r.dataSource.paging!==!1?(e.openBlock(),e.createBlock(xl,{key:0,class:"paging",background:"",layout:e.unref(L),onSizeChange:e.unref(H),onCurrentChange:e.unref(j),"page-size":e.unref(I).pageSize,"current-page":e.unref(I).pageNum,"onUpdate:currentPage":O[1]||(O[1]=g=>e.unref(I).pageNum=g),total:e.unref(I).total,"page-sizes":e.unref(S)},null,8,["layout","onSizeChange","onCurrentChange","page-size","current-page","total","page-sizes"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-c59f4080"]]),Lt={class:"upload-file"},Pt={key:0,class:"el-upload__tip"},Ft={style:{color:"#f56c6c"}},Ot={style:{color:"#f56c6c"}},zt={class:"el-icon-document"},Mt={class:"ele-upload-list__item-content-action"},Rt=e.defineComponent({__name:"index",props:{modelValue:[String,Object,Array],limit:Q.number.def(5),fileSize:Q.number.def(5),fileType:Q.array.def(["doc","xls","ppt","txt","pdf"]),showTip:Q.bool.def(!0),showFileList:Q.bool.def(!0)},emits:["update:modelValue"],setup(t,{emit:o}){const a=t,{proxy:l}=e.getCurrentInstance(),c=o,r=e.ref(0),i=e.ref([]),m=de(),f=e.ref(m+"/resource/oss/upload"),w=e.ref(ie()),p=e.ref([]),I=e.computed(()=>a.showTip&&(a.fileType||a.fileSize)),S=e.ref();e.watch(()=>a.modelValue,async D=>{if(D){if(!a.showFileList)return;let $=1,z=[];Array.isArray(D)?z=D:z=(await ke(D)).data.map(d=>({name:d.originalName,url:d.url,ossId:d.ossId})),p.value=z.map(V=>(V={name:V.name,url:V.url,ossId:V.ossId},V.uid=V.uid||new Date().getTime()+$++,V))}else return p.value=[],[]},{deep:!0,immediate:!0});const L=D=>{if(a.fileType.length){const $=D.name.split("."),z=$[$.length-1];if(!(a.fileType.indexOf(z)>=0))return l==null||l.$modal.msgError(`文件格式不正確, 請上傳${a.fileType.join("/")}格式文件!`),!1}return a.fileSize&&!(D.size/1024/1024<a.fileSize)?(l==null||l.$modal.msgError(`上傳文件大小不超過 ${a.fileSize} MB!`),!1):(l==null||l.$modal.loading("正在上傳文件,請稍等..."),r.value++,!0)},x=()=>{l==null||l.$modal.msgError(`上傳文件數量不能超過 ${a.limit} 个!`)},P=()=>{l==null||l.$modal.msgError("上傳文件失敗")},j=(D,$)=>{var z;D.code===200?(i.value.push({name:D.data.fileName,url:D.data.url,ossId:D.data.ossId}),C()):(r.value--,l==null||l.$modal.closeLoading(),l==null||l.$modal.msgError(D.msg),(z=S.value)==null||z.handleRemove($),C())},H=D=>{const $=p.value[D].ossId;Le($),p.value.splice(D,1),c("update:modelValue",y(p.value))},C=()=>{r.value>0&&i.value.length===r.value&&(p.value=p.value.filter(D=>D.url!==void 0).concat(i.value),i.value=[],r.value=0,c("update:modelValue",y(p.value)),l==null||l.$modal.closeLoading())},E=D=>D.lastIndexOf("/")>-1?D.slice(D.lastIndexOf("/")+1):D,y=(D,$)=>{let z="";return $=$||",",D.forEach(V=>{V.ossId&&(z+=V.ossId+$)}),z!=""?z.substring(0,z.length-1):""};return(D,$)=>{const z=B.ElButton,V=B.ElUpload,d=B.ElLink;return e.openBlock(),e.createElementBlock("div",Lt,[e.createVNode(V,{multiple:"",action:e.unref(f),"before-upload":L,"file-list":e.unref(p),limit:t.limit,"on-error":P,"on-exceed":x,"on-success":j,"show-file-list":!1,headers:e.unref(w),class:"upload-file-uploader",ref_key:"fileUploadRef",ref:S},{default:e.withCtx(()=>[e.createVNode(z,{type:"primary"},{default:e.withCtx(()=>$[0]||($[0]=[e.createTextVNode("选取文件")])),_:1})]),_:1},8,["action","file-list","limit","headers"]),e.unref(I)?(e.openBlock(),e.createElementBlock("div",Pt,[$[3]||($[3]=e.createTextVNode(" 請上傳 ")),t.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[$[1]||($[1]=e.createTextVNode(" 大小不超過 ")),e.createElementVNode("b",Ft,e.toDisplayString(t.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),t.fileType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[$[2]||($[2]=e.createTextVNode(" 格式為 ")),e.createElementVNode("b",Ot,e.toDisplayString(t.fileType.join("/")),1)],64)):e.createCommentVNode("",!0),$[4]||($[4]=e.createTextVNode(" 的文件 "))])):e.createCommentVNode("",!0),t.showFileList?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:1,class:"upload-file-list el-upload-list el-upload-list--text",name:"el-fade-in-linear",tag:"ul"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(_,T)=>(e.openBlock(),e.createElementBlock("li",{key:_.uid,class:"el-upload-list__item ele-upload-list__item-content"},[e.createVNode(d,{href:`${_.url}`,underline:!1,target:"_blank"},{default:e.withCtx(()=>[e.createElementVNode("span",zt,e.toDisplayString(E(_.name)),1)]),_:2},1032,["href"]),e.createElementVNode("div",Mt,[e.createVNode(d,{underline:!1,onClick:F=>H(T),type:"danger"},{default:e.withCtx(()=>$[5]||($[5]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])])]))),128))]),_:1})):e.createCommentVNode("",!0)])}}}),Se=te(Rt,[["__scopeId","data-v-027e6121"]]),Yt={key:0,class:"el-upload__tip"},jt={style:{color:"#f56c6c"}},Ht={style:{color:"#f56c6c"}},qt={style:{color:"#f56c6c"}},Kt=["src"],Wt=e.defineComponent({__name:"index",props:{modelValue:{type:[String,Object,Array],default:()=>[]},limit:Q.number.def(5),fileSize:Q.number.def(5),fileType:Q.array.def(["png","jpg","jpeg"]),isShowTip:{type:Boolean,default:!0},imageSize:Q.string.def(""),compressSupport:{type:Boolean,default:!1},compressTargetSize:Q.number.def(300),height:Q.string.def("148px")},emits:["update:modelValue"],setup(t,{emit:o}){e.useCssVars(V=>({"9d14746a":a.height}));const a=t,{proxy:l}=e.getCurrentInstance(),c=o,r=e.ref(0),i=e.ref([]),m=e.ref(""),f=e.ref(!1),w=de(),p=e.ref(w+"/resource/oss/upload"),I=e.ref(ie()),S=e.ref([]),L=e.computed(()=>a.isShowTip&&(a.fileType||a.fileSize||a.imageSize)),x=e.ref(),P=e.computed(()=>a.fileType.map(V=>`.${V}`).join(","));e.watch(()=>a.modelValue,async V=>{if(V){let d=[];Array.isArray(V)?d=V:d=(await ke(V)).data,S.value=d.map(_=>{let T;return typeof _=="string"?T={name:_,url:_}:T={name:_.ossId,url:_.url,ossId:_.ossId},T})}else return S.value=[],[]},{deep:!0,immediate:!0});const j=V=>{let d=!1;if(a.fileType.length){let _="";V.name.lastIndexOf(".")>-1&&(_=V.name.slice(V.name.lastIndexOf(".")+1)),d=a.fileType.some(T=>!!(V.type.indexOf(T)>-1||_&&_.indexOf(T)>-1))}else d=V.type.indexOf("image")>-1;if(!d)return l==null||l.$modal.msgError(`文件格式不正確, 請上傳${a.fileType.join("/")}圖片格式文件!`),!1;if(V.name.includes(","))return l==null||l.$modal.msgError("文件名不正確,不能包含英文逗號!"),!1;if(a.fileSize&&!(V.size/1024/1024<a.fileSize))return l==null||l.$modal.msgError(`上傳圖片大小不能超過 ${a.fileSize} MB!`),!1;if(a.compressSupport&&V.size/1024>a.compressTargetSize)return l==null||l.$modal.loading("正在上傳圖片,請稍候..."),r.value++,st.compressAccurately(V,a.compressTargetSize);l==null||l.$modal.loading("正在上傳圖片,請稍候..."),r.value++},H=()=>{l==null||l.$modal.msgError(`上傳文件數量不能超過 ${a.limit} 個!`)},C=(V,d)=>{var _;V.code===200?(i.value.push({name:V.data.fileName,url:V.data.url,ossId:V.data.ossId}),y()):(r.value--,l==null||l.$modal.closeLoading(),l==null||l.$modal.msgError(V.msg),(_=x.value)==null||_.handleRemove(d),y())},E=V=>{const d=S.value.map(_=>_.name).indexOf(V.name);if(d>-1&&i.value.length===r.value){const _=S.value[d].ossId;return Le(_),S.value.splice(d,1),c("update:modelValue",z(S.value)),!1}return!0},y=()=>{r.value>0&&i.value.length===r.value&&(S.value=S.value.filter(V=>V.url!==void 0).concat(i.value),i.value=[],r.value=0,c("update:modelValue",z(S.value)),l==null||l.$modal.closeLoading())},D=()=>{l==null||l.$modal.msgError("上傳圖片失敗"),l==null||l.$modal.closeLoading()},$=V=>{m.value=V.url,f.value=!0},z=(V,d)=>{let _="";d=d||",";for(const T in V)V[T].ossId!==void 0&&V[T].url.indexOf("blob:")!==0&&(_+=V[T].ossId+d);return _!=""?_.substring(0,_.length-1):""};return(V,d)=>{const _=e.resolveComponent("plus"),T=B.ElIcon,F=B.ElUpload,Y=B.ElDialog;return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(F,{ref_key:"imageUploadRef",ref:x,multiple:"",action:e.unref(p),"list-type":"picture-card","on-success":C,"before-upload":j,limit:t.limit,accept:e.unref(P),"on-error":D,"on-exceed":H,"before-remove":E,"show-file-list":!0,headers:e.unref(I),"file-list":e.unref(S),"on-preview":$,class:e.normalizeClass({hide:e.unref(S).length>=t.limit})},{default:e.withCtx(()=>[e.createVNode(T,{class:"avatar-uploader-icon"},{default:e.withCtx(()=>[e.createVNode(_)]),_:1})]),_:1},8,["action","limit","accept","headers","file-list","class"]),e.unref(L)?(e.openBlock(),e.createElementBlock("div",Yt,[d[4]||(d[4]=e.createTextVNode(" 請上傳 ")),t.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d[1]||(d[1]=e.createTextVNode(" 大小不超過 ")),e.createElementVNode("b",jt,e.toDisplayString(t.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),t.fileType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("、")],64)):e.createCommentVNode("",!0),d[2]||(d[2]=e.createTextVNode("格式為 ")),e.createElementVNode("b",Ht,e.toDisplayString(t.fileType.join("/")),1)],64)):e.createCommentVNode("",!0),t.imageSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[t.fileSize||t.fileType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("。")],64)):e.createCommentVNode("",!0),d[3]||(d[3]=e.createTextVNode("建議尺寸 ")),e.createElementVNode("b",qt,e.toDisplayString(t.imageSize),1)],64)):e.createCommentVNode("",!0),d[5]||(d[5]=e.createTextVNode(" 的文件 "))])):e.createCommentVNode("",!0),e.createVNode(Y,{modelValue:e.unref(f),"onUpdate:modelValue":d[0]||(d[0]=J=>e.isRef(f)?f.value=J:null),title:"預覽",width:"800px","append-to-body":""},{default:e.withCtx(()=>[e.createElementVNode("img",{src:e.unref(m),style:{display:"block","max-width":"100%",margin:"0 auto"}},null,8,Kt)]),_:1},8,["modelValue"])])}}}),_e=te(Wt,[["__scopeId","data-v-c17cf859"]]),Qt=t=>oe()({url:"/app/translation/getByName",method:"post",headers:{repeatSubmit:!1},data:{name:t}}),Gt=t=>oe()({url:"/app/translation/batchAdd",method:"post",data:t}),He=Te.defineStore("translation",()=>{const t=e.ref([]);return{translation:t,getTranslation:c=>{if(c==null&&c=="")return null;try{for(let r=0;r<t.value.length;r++)if(t.value[r].key==c)return t.value[r].value}catch{return null}return null},setTranslation:(c,r)=>{c!==null&&c!==""&&t.value.push({key:c,value:r})},clearTranslation:()=>{t.value=[]}}}),Jt=async t=>{const o=e.ref({}),a=He().getTranslation(t);if(a)o.value[t]=a;else{const{data:l}=await Qt(t);o.value[t]=l,He().setTranslation(t,l)}return o.value},Xt={style:{width:"100%"}},Zt={style:{"margin-bottom":"2px"}},De=e.defineComponent({__name:"index",props:["modelValue","placeholder","disabled","type","rows","showWordLimit","maxlength"],emits:["update:modelValue","focus"],setup(t,{expose:o,emit:a}){const l=a,c=t,r=e.ref([{name:"繁體",id:"zhHk",selected:!0,text:""},{name:"簡體",id:"zhCn",selected:!1,text:""},{name:"英文",id:"enUs",selected:!1,text:""}]),i=e.ref(!1),m=e.ref(!1),f=(x,P)=>{x.text=P,x.id=="zhHk"&&l("update:modelValue",P)},w=async x=>{x.id=="zhHk"&&await p()},p=async()=>{if(i.value)return;const x=r.value[0].text;if(x!=""){i.value=!0;const P=await Jt(x);if(i.value=!1,P[x]!=null){for(let j=0;j<r.value.length;j++)if(!r.value[j].text){const H=r.value[j];H.text=P[x][H.id]}}}},I=async x=>{r.value.map(P=>P.selected=!1),x.selected=!0},S=()=>{const x={name:r.value[0].text};return r.value.forEach(P=>x[P.id]=P.text),x},L=()=>l("focus");return e.watch(()=>c.modelValue,x=>{if(x){const P=r.value.filter(j=>j.selected)[0];P.text=x,m.value||p(),m.value=!0}},{immediate:!0,deep:!0}),o({getTranslate:S}),(x,P)=>{const j=B.ElButton,H=B.ElInput;return e.openBlock(),e.createElementBlock("div",Xt,[e.createElementVNode("div",Zt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),C=>(e.openBlock(),e.createBlock(j,{size:"small",key:C.id,type:C.selected?"primary":"default",onClick:E=>I(C),style:{"margin-right":"-8px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.name),1)]),_:2},1032,["type","onClick"]))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),C=>e.withDirectives((e.openBlock(),e.createBlock(H,{key:C.id,modelValue:C.text,"onUpdate:modelValue":E=>C.text=E,type:c.type,placeholder:c.placeholder+"("+C.name+")",disabled:c.disabled,rows:c.rows,"show-word-limit":c.showWordLimit,maxlength:c.maxlength,onInput:E=>f(C,E),onBlur:E=>w(C),onFocus:P[0]||(P[0]=E=>L())},null,8,["modelValue","onUpdate:modelValue","type","placeholder","disabled","rows","show-word-limit","maxlength","onInput","onBlur"])),[[e.vShow,C.selected]])),128))])}}}),vt={class:"editor"},Ee=e.defineComponent({__name:"index",props:{modelValue:Q.string,height:Q.number.def(400),minHeight:Q.number.def(400),readOnly:Q.bool.def(!1),fileSize:Q.number.def(5),type:Q.string.def("url")},emits:["update:modelValue"],setup(t){const o=t,{proxy:a}=e.getCurrentInstance(),l=e.reactive({headers:ie(),url:de()+"/resource/oss/upload"}),c=e.ref(),r=e.ref(),i=e.ref({theme:"snow",bounds:document.body,debug:"warn",modules:{toolbar:{container:[["bold","italic","underline","strike"],["blockquote","code-block"],[{list:"ordered"},{list:"bullet"}],[{indent:"-1"},{indent:"+1"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],["clean"],["link","image","video"]],handlers:{image:S=>{S?r.value.click():$e.Quill.format("image",!0)}}}},placeholder:"请输入内容",readOnly:o.readOnly}),m=e.computed(()=>{const S={};return o.minHeight&&(S.minHeight=`${o.minHeight}px`),o.height&&(S.height=`${o.height}px`),S}),f=e.ref("");e.watch(()=>o.modelValue,S=>{S!==f.value&&(f.value=S||"<p></p>")},{immediate:!0});const w=S=>{if(S.code===200){const L=e.toRaw(c.value).getQuill(),x=L.selection.savedRange.index;L.insertEmbed(x,"image",S.data.url),L.setSelection(x+1),a==null||a.$modal.closeLoading()}else a==null||a.$modal.msgError("图片插入失败"),a==null||a.$modal.closeLoading()},p=S=>["image/jpeg","image/jpg","image/png","image/svg"].includes(S.type)?o.fileSize&&!(S.size/1024/1024<o.fileSize)?(a==null||a.$modal.msgError(`上传文件大小不能超过 ${o.fileSize} MB!`),!1):(a==null||a.$modal.loading("正在上传文件,请稍候..."),!0):(a==null||a.$modal.msgError("图片格式错误!"),!1),I=S=>{a==null||a.$modal.msgError("上传文件失败")};return(S,L)=>{const x=B.ElUpload;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",null,[t.type==="url"?(e.openBlock(),e.createBlock(x,{key:0,action:e.unref(l).url,"before-upload":p,"on-success":w,"on-error":I,class:"editor-img-uploader",name:"file","show-file-list":!1,headers:e.unref(l).headers},{default:e.withCtx(()=>[e.createElementVNode("i",{ref_key:"uploadRef",ref:r},null,512)]),_:1},8,["action","headers"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",vt,[e.createVNode(e.unref($e.QuillEditor),{ref_key:"quillEditorRef",ref:c,content:e.unref(f),"onUpdate:content":L[0]||(L[0]=P=>e.isRef(f)?f.value=P:null),"content-type":"html",options:e.unref(i),style:e.normalizeStyle(e.unref(m)),onTextChange:L[1]||(L[1]=P=>S.$emit("update:modelValue",e.unref(f)))},null,8,["content","options","style"])])],64)}}});function el(t,o){if(arguments.length===0||!t)return null;const a=o||"{y}-{m}-{d} {h}:{i}:{s}";let l;typeof t=="object"?l=t:(typeof t=="string"&&/^[0-9]+$/.test(t)?t=parseInt(t):typeof t=="string"&&(t=t.replace(new RegExp(/-/gm),"/").replace("T"," ").replace(new RegExp(/\.[\d]{3}/gm),"")),typeof t=="number"&&t.toString().length===10&&(t=t*1e3),l=new Date(t));const c={y:l.getFullYear(),m:l.getMonth()+1,d:l.getDate(),h:l.getHours(),i:l.getMinutes(),s:l.getSeconds(),a:l.getDay()};return a.replace(/{(y|m|d|h|i|s|a)+}/g,(r,i)=>{let m=c[i];return i==="a"?["日","一","二","三","四","五","六"][m]:(r.length>0&&m<10&&(m="0"+m),m||0)})}const tl=(t,o,a)=>{const l=t;return l.params=typeof l.params=="object"&&l.params!==null&&!Array.isArray(l.params)?l.params:{},o=Array.isArray(o)?o:[],o[0]&&o[0].length==10&&(o[0]=o[0]+" 00:00:00",o[1]=o[1]+" 23:59:59"),typeof a>"u"?(l.params.beginTime=o[0],l.params.endTime=o[1]):(a=a.charAt(0).toUpperCase()+a.slice(1),l.params["begin"+a]=o[0],l.params["end"+a]=o[1]),l},ll=(t,o)=>{if(o===void 0)return"";const a=[];return Object.keys(t).some(l=>{if(t[l].value==""+o)return a.push(t[l].label),!0}),a.length===0&&a.push(o),a.join("")},al=(t,o,a)=>{if(o===void 0||o.length===0)return"";Array.isArray(o)&&(o=o.join(","));const l=[],c=a===void 0?",":a,r=o.split(c);return Object.keys(o.split(c)).some(i=>{let m=!1;Object.keys(t).some(f=>{t[f].value==""+r[i]&&(l.push(t[f].label+c),m=!0)}),m||l.push(r[i]+c)}),l.join("").substring(0,l.join("").length-1)},ol=(t,o,a,l)=>{const c={id:o||"id",parentId:a||"parentId",childrenList:l||"children"},r={},i=[];for(const m of t){const f=m[c.id];r[f]=m,m[c.childrenList]||(m[c.childrenList]=[])}for(const m of t){const f=m[c.parentId],w=r[f];w?w[c.childrenList].push(m):i.push(m)}return i},rl=t=>{let o="";for(const a of Object.keys(t)){const l=t[a],c=encodeURIComponent(a)+"=";if(l!==null&&l!==""&&typeof l<"u")if(typeof l=="object"){for(const r of Object.keys(l))if(l[r]!==null&&l[r]!==""&&typeof l[r]<"u"){const i=a+"["+r+"]",m=encodeURIComponent(i)+"=";o+=m+encodeURIComponent(l[r])+"&"}}else o+=c+encodeURIComponent(l)+"&"}return o},nl=t=>t.type!=="application/json",qe=t=>{if(!t&&typeof t!="object")throw new Error("error arguments","deepClone");const o=t.constructor===Array?[]:{};return Object.keys(t).forEach(a=>{t[a]&&typeof t[a]=="object"?o[a]=qe(t[a]):o[a]=t[a]}),o};function cl(t,o){const{proxy:a}=e.getCurrentInstance(),l=e.ref({}),c=async f=>{const w=f.form;if(!w)return"";switch(w.type){case"checkboxGroup":case"checkboxDict":return[];case"treeSelectApi":if(w.api){const p=await w.api({pageNum:1,pageSize:1e3,...w.apiParams});if(w.data=p.rows||p.data,w.data&&Array.isArray(w.data)&&!Array.isArray(w.defaultExpandedKeys)&&w.autoExpandFirstLevel!==!1){const I=w.props||{value:"id"},S=w.valueKey||I.value||"id";w.defaultExpandedKeys=w.data.map(L=>L[S])}}return"";case"radioApi":case"selectApi":if(w.api){const p=await w.api({pageNum:1,pageSize:1e3,...w.apiParams});w.data=p.rows||p.data}return"";case"checkboxCommonDict":return w.data=await(a==null?void 0:a.useOneCommonDict(w.dictType)),[];case"radioCommonDict":case"selectCommonDict":return w.data=await(a==null?void 0:a.useOneCommonDict(w.dictType)),"";case"radioDict":case"selectDict":return w.data=await(a==null?void 0:a.useOneDict(w.dictType)),"";case"daterange":case"timerange":return[];default:return""}},r=async f=>{var S;let w={};const p=t.columns,I=f!==void 0?f:o;for(const L of p){const x=((S=L.form)==null?void 0:S.prop)||L.prop;w[x]=await c(L)}if(I&&typeof I=="object"){const L=qe(I);w={...w,...L}}t.initEditData&&t.initEditData(w),t.beforeInitEdit&&t.beforeInitEdit(w),i(w),l.value=w},i=f=>{t.columns.forEach(p=>{var L,x,P,j,H;const I=(L=p.form)==null?void 0:L.type,S=((x=p.form)==null?void 0:x.prop)||p.prop;switch(I){case"checkboxCommonDict":Array.isArray(f[S])&&(f[S]=f[S].map(y=>y[p.form.value]||y));break;case"selectDict":case"radioDict":case"switch":f[S]=f[S]||((P=p.form)==null?void 0:P.defaultValue);break;case"daterange":case"timerange":const C=(j=p.form)==null?void 0:j.rangeBeginProp,E=(H=p.form)==null?void 0:H.rangeEndProp;C&&E&&f[C]&&f[E]?f[S]=[f[C],f[E]]:typeof f[S]=="string"&&f[S].includes(",")?f[S]=f[S].split(","):(!f[S]||!Array.isArray(f[S]))&&(f[S]=f[S]||[]);break}})};return{formData:l,initFormData:r,prepareSaveData:async f=>{const w={...l.value,...f};if(t.columns.forEach(p=>{var L,x,P,j;const I=(L=p.form)==null?void 0:L.type,S=((x=p.form)==null?void 0:x.prop)||p.prop;if((I==="daterange"||I==="timerange")&&Array.isArray(w[S])){const H=w[S],C=(P=p.form)==null?void 0:P.rangeBeginProp,E=(j=p.form)==null?void 0:j.rangeEndProp;C&&E&&H.length>=2&&(w[C]=H[0],w[E]=H[1])}}),delete w.orderByColumn,delete w.isAsc,t.beforeSave){const p=await t.beforeSave(w);if(p===!1)return!1;p&&typeof p=="object"?Object.assign(f,p):Object.assign(f,w)}else Object.assign(f,w);return!0}}}const sl={key:20},il={class:"color-picker-tips"},Ke=te(e.defineComponent({__name:"curdEdit",props:{dataSource:{},editData:{},action:{},modelValue:{type:Boolean}},emits:["close","actionEvent"],setup(t,{emit:o}){const{t:a}=xe.useI18n(),{proxy:l}=e.getCurrentInstance(),c=t,r=e.ref(!1),i=e.ref(),m=o,f=e.ref(),w=e.ref(Pe),{formData:p,initFormData:I,prepareSaveData:S}=cl(c.dataSource,c.editData),L=e.computed(()=>{const D=!!c.editData[c.dataSource.rowKey],$=St(c.dataSource.columns,D,D);return ze($,"form.order")}),x=e.computed(()=>c.dataSource.formInline||!1),P=y=>{if(Array.isArray(y.defaultExpandedKeys))return y.defaultExpandedKeys;if(y.autoExpandFirstLevel===!1)return[];const D=y.data||[],$=y.props||{value:"id"},z=y.valueKey||$.value||"id";return Array.isArray(D)?D.map(V=>V[z]).filter(V=>V!==void 0):[]},j=()=>Ct(c.dataSource.columns),H=()=>{var y;(y=f.value)==null||y.validate(async D=>{var $,z,V,d,_;if(!D)return!1;try{const T={...c.dataSource.queryParams||{}};if(await S(T)===!1)return!1;c.editData[c.dataSource.rowKey]?await((z=($=c.dataSource).updateApi)==null?void 0:z.call($,T)):await((d=(V=c.dataSource).addApi)==null?void 0:d.call(V,T)),await C(),E(!0),l==null||l.$modal.msgSuccess(a("數據存儲成功")),(_=f.value)==null||_.resetFields()}catch(T){console.error("Save failed:",T)}return!1})},C=async()=>{const y=i.value;if(y!=null){const D=[];for(let $=0;$<y.length;$++){const z=y[$].getTranslate();D.push(z)}await Gt(D)}},E=(y=!1)=>{var D;(D=f.value)==null||D.resetFields(),m("close",y)};return e.watch(()=>c.modelValue,y=>{y&&(j(),I(c.editData)),r.value=y}),(y,D)=>{const $=B.ElInputNumber,z=B.ElOption,V=B.ElSelect,d=B.ElDatePicker,_=_e,T=Se,F=B.ElInput,Y=B.ElCheckbox,J=B.ElCheckboxGroup,k=B.ElSwitch,N=B.ElRadio,R=B.ElRadioGroup,A=B.ElTreeSelect,G=B.ElColorPicker,Z=B.ElFormItem,ee=B.ElCol,X=B.ElRow,le=B.ElForm,s=B.ElButton,u=B.ElDialog;return e.openBlock(),e.createBlock(u,{title:c.action.title||c.action.text,modelValue:e.unref(r),"onUpdate:modelValue":D[1]||(D[1]=n=>e.isRef(r)?r.value=n:null),onClose:E,"destroy-on-close":"","append-to-bod":"",width:c.action.width||(e.unref(x)?750:550),class:"curdEditDialog"},{footer:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(s,{onClick:D[0]||(D[0]=n=>E(!1))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.$t("關閉")),1)]),_:1}),e.createVNode(s,{type:"primary",onClick:H},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.$t("存儲")),1)]),_:1})])]),default:e.withCtx(()=>[e.createVNode(le,{model:e.unref(p),ref_key:"curdFormRef",ref:f,"label-width":c.action.labelWidth||c.dataSource.formLabelWidth||"auto","label-position":c.action.labelPosition||"right",class:"p-l-3 p-r-3"},{default:e.withCtx(()=>[e.createVNode(X,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),n=>(e.openBlock(),e.createBlock(ee,{span:n.form.inline===!1?24:e.unref(x)?12:24,key:n.prop,class:"el-p"},{default:e.withCtx(()=>[e.createVNode(Z,{prop:n.form.prop||n.prop,label:n.label,name:n.form.prop||n.prop,rules:n.form.rules,required:n.form.required},{default:e.withCtx(()=>[n.form.type==="number"?(e.openBlock(),e.createBlock($,{key:0,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,style:{width:"100%"},min:n.form.min,max:n.form.max,placeholder:y.$t("請輸入")},null,8,["modelValue","onUpdate:modelValue","min","max","placeholder"])):n.form.type==="select"?(e.openBlock(),e.createBlock(V,{key:1,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h[n.form.value]||h.value,label:h[n.form.label]||h.label,value:h[n.form.value]||h.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="selectDict"?(e.openBlock(),e.createBlock(V,{key:2,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h[n.form.value]||h.value,label:h[n.form.label]||h.label,value:h[n.form.value]||h.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="selectCommonDict"?(e.openBlock(),e.createBlock(V,{key:3,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="selectApi"?(e.openBlock(),e.createBlock(V,{key:4,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h[n.form.value],label:h[n.form.label],value:h[n.form.value]},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="date"?(e.openBlock(),e.createBlock(d,{key:5,format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"date",placeholder:y.$t("請選擇日期"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):n.form.type==="datetime"?(e.openBlock(),e.createBlock(d,{key:6,format:"YYYY-MM-DD HH:mm:ss","value-format":"YYYY-MM-DD HH:mm:ss",modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"datetime",placeholder:y.$t("請選擇日期時間"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):n.form.type==="daterange"?(e.openBlock(),e.createBlock(d,{key:7,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"daterange",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD","range-separator":y.$t("至"),"start-placeholder":y.$t("開始日期"),"end-placeholder":y.$t("結束日期"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):n.form.type==="timerange"?(e.openBlock(),e.createBlock(d,{key:8,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"datetimerange",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm:ss","range-separator":y.$t("至"),"start-placeholder":y.$t("開始時間"),"end-placeholder":y.$t("結束時間"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):n.form.type==="image"?(e.openBlock(),e.createBlock(_,{key:9,limit:n.form.limit||1,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},null,8,["limit","modelValue","onUpdate:modelValue"])):n.form.type==="file"?(e.openBlock(),e.createBlock(T,{key:10,limit:n.form.limit||1,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,fileType:n.form.fileType,fileSize:n.form.fileSize},null,8,["limit","modelValue","onUpdate:modelValue","fileType","fileSize"])):n.form.type==="password"?(e.openBlock(),e.createBlock(F,{key:11,"auto-complete":"new-password",modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"password",placeholder:y.$t("請輸入")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):n.form.type==="checkboxGroup"?(e.openBlock(),e.createBlock(J,{key:12,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.list,h=>(e.openBlock(),e.createBlock(Y,{key:h[n.form.value],label:h[n.form.label],value:h[n.form.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="checkboxCommonDict"?(e.openBlock(),e.createBlock(J,{key:13,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(Y,{label:h.value,key:h.value,value:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="switch"?(e.openBlock(),e.createBlock(k,{key:14,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,"active-value":n.form.activeValue||"0","inactive-value":n.form.inactiveValue||"1"},null,8,["modelValue","onUpdate:modelValue","active-value","inactive-value"])):n.form.type==="radioDict"?(e.openBlock(),e.createBlock(R,{key:15,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(N,{key:h.value,value:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="treeSelectApi"?(e.openBlock(),e.createBlock(A,{key:16,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,data:n.form.data,props:n.form.props,"value-key":n.form.valueKey,"default-expanded-keys":P(n.form),filterable:n.form.filterable??!0,placeholder:y.$t("請選擇"),"check-strictly":""},null,8,["modelValue","onUpdate:modelValue","data","props","value-key","default-expanded-keys","filterable","placeholder"])):n.form.type==="radioCommonDict"?(e.openBlock(),e.createBlock(R,{key:17,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(N,{key:h.value,label:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="radioLocalDict"?(e.openBlock(),e.createBlock(R,{key:18,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w)[n.form.dictType],h=>(e.openBlock(),e.createBlock(N,{key:h.value,label:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="checkbox"?(e.openBlock(),e.createBlock(Y,{key:19,label:n.label,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},null,8,["label","modelValue","onUpdate:modelValue"])):n.form.type==="color"?(e.openBlock(),e.createElementBlock("div",sl,[e.createVNode(G,{modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},null,8,["modelValue","onUpdate:modelValue"]),e.createElementVNode("span",il,e.toDisplayString(y.$t("需点击选择器中的确定按钮")),1)])):n.form.type==="inputNumber"?(e.openBlock(),e.createBlock($,{key:21,min:n.form.min||0,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,step:1},null,8,["min","modelValue","onUpdate:modelValue"])):n.form.type==="richtext"?(e.openBlock(),e.createBlock(Ee,{key:22,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,height:n.form.max||320,"min-height":n.form.min||220},null,8,["modelValue","onUpdate:modelValue","height","min-height"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:23},[n.form.translate===!0?(e.openBlock(),e.createBlock(De,{ref_for:!0,ref_key:"translateInputRef",ref:i,key:e.unref(p)[y.dataSource.rowKey],modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,disabled:n.form.disabled||!1,type:n.form.type,placeholder:y.$t("請輸入"),rows:n.form.rows||3,"show-word-limit":n.form.showWordLimit||!1,maxlength:n.form.limit||-1},null,8,["modelValue","onUpdate:modelValue","disabled","type","placeholder","rows","show-word-limit","maxlength"])):(e.openBlock(),e.createBlock(F,{key:1,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,disabled:n.form.disabled||!1,type:n.form.type,placeholder:y.$t("請輸入"),rows:n.form.rows||3,"show-word-limit":n.form.showWordLimit||!1,maxlength:n.form.limit||-1},e.createSlots({_:2},[n.form.suffix?{name:"suffix",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.form.suffix),1)]),key:"0"}:void 0,n.form.prefix?{name:"prefix",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.form.prefix),1)]),key:"1"}:void 0]),1032,["modelValue","onUpdate:modelValue","disabled","type","placeholder","rows","show-word-limit","maxlength"]))],64))]),_:2},1032,["prop","label","name","rules","required"])]),_:2},1032,["span"]))),128))]),_:1})]),_:1},8,["model","label-width","label-position"])]),_:1},8,["title","modelValue","width"])}}}),[["__scopeId","data-v-03727126"]]),dl={key:1,class:"curd-search-card",style:{"margin-bottom":"0px !important"}},pl={key:2,class:"curd-search-card"},fl=te(e.defineComponent({__name:"curdSearch",props:{dataSource:{},selectedCount:{default:0}},emits:["actionEvent"],setup(t,{expose:o,emit:a}){const{t:l}=xe.useI18n(),{proxy:c}=e.getCurrentInstance(),r=a,i=t,m=e.computed(()=>{const d=i.dataSource.actions;return d==null?[]:d.filter(T=>T.position==="top"||T.action==="create"||T.action==="back").map(T=>{const F={...T};return F.action==="create"?(F.cssType="primary",F.icon="Plus"):F.action==="back"&&(F.icon="ArrowLeft"),F})}),f=e.computed(()=>m.value.find(d=>d.action==="create")??null),w=e.computed(()=>{var d;return((d=i.dataSource.actions)==null?void 0:d.find(_=>_.action==="delete"))??null}),p=e.computed(()=>m.value.filter(d=>d.action!=="create")),I=d=>{r("actionEvent",d)},S=e.computed(()=>i.dataSource.searchColumnsPerRow??4),L=e.computed(()=>Math.floor(24/S.value)),x=e.computed(()=>i.dataSource.showSearchCard??!0),P=e.computed(()=>{if(i.dataSource.searchActionColSpan!=null)return i.dataSource.searchActionColSpan;const d=E.value.length%S.value,T=24-(d===0?S.value:d)*L.value;return T<=0?24:T}),j=e.computed(()=>E.value.length%S.value===0?"15px !important":"0px !important"),{initSearchDicts:H}=Me(),C=e.ref({}),E=e.ref([]),y=()=>{r("actionEvent",{action:"filter"})},D=async()=>{try{let d=$();if(d={...i.dataSource.queryParams||{},...d},i.dataSource.beforeExport&&await i.dataSource.beforeExport(d)===!1)return;const _=it().format("YYYYMMDDHHmmss");let T=i.dataSource.exportFileName?`${i.dataSource.exportFileName}`:"export";T+=`_${_}.xlsx`,c==null||c.download(i.dataSource.exportUrl,d,T)}catch(d){console.error("Export failed:",d),c==null||c.$modal.msgError(l("導出失敗"))}},$=()=>{const d={...C.value};return E.value.forEach(_=>{var T,F;if(((T=_.search)==null?void 0:T.type)==="daterange"||((F=_.search)==null?void 0:F.type)==="timerange"){const Y=d[_.search.prop];Y&&Y[0]&&Y[1]&&Et(d,Y,_.search.prop,c),delete d[_.search.prop]}}),Ve(d)},z=async()=>{await V(),r("actionEvent",{action:"filter"},{})},V=async()=>{const d=i.dataSource.columns.filter(T=>T.search&&pe(T.search.permission??T.permission));E.value=ze(d.map((T,F)=>(T.search.order||(T.search.order=F+100),T)),"search.order"),await e.nextTick();const _={};for(let T=0;T<d.length;T++){const F=d[T];if(!F.search)continue;const Y=F.search.prop||"",J=F.search.type||"";J==="daterange"||J==="timerange"?_[Y]=F.search.default?F.search.default.split(","):[]:((J==="selectApi"||J==="treeSelectApi"||J==="selectDict")&&await H(F),_[Y]=F.search.default)}C.value=_};return e.onMounted(()=>V()),o({initData:V,getQueryParams:$}),(d,_)=>{var le;const T=B.ElDatePicker,F=B.ElOption,Y=B.ElSelect,J=B.ElTreeSelect,k=B.ElInput,N=B.ElFormItem,R=B.ElCol,A=B.ElButton,G=B.ElRow,Z=B.ElForm,ee=B.ElCard,X=e.resolveDirective("hasPermi");return e.unref(E).length>0&&e.unref(x)?(e.openBlock(),e.createBlock(ee,{key:0,class:"curd-search-card",shadow:"hover",style:{"margin-bottom":"12px !important"},"body-style":{paddingTop:"18px !important",paddingBottom:e.unref(j)}},{default:e.withCtx(()=>[e.createVNode(Z,{model:e.unref(C),inline:!0,"label-width":i.dataSource.searchLabelWidth||68},{default:e.withCtx(()=>[e.createVNode(G,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),s=>(e.openBlock(),e.createBlock(R,{span:e.unref(L),key:s.search.prop},{default:e.withCtx(()=>[e.createVNode(N,{label:s.label,name:s.search.prop,style:{width:"100%"},"label-width":s.search.labelWidth},{default:e.withCtx(()=>[s.search.type==="daterange"?(e.openBlock(),e.createBlock(T,{key:0,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"daterange",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD","range-separator":d.$t("至"),"start-placeholder":d.$t("開始日期"),"end-placeholder":d.$t("結束日期"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="timerange"?(e.openBlock(),e.createBlock(T,{key:1,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"datetimerange",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm:ss","range-separator":d.$t("至"),"start-placeholder":d.$t("開始時間"),"end-placeholder":d.$t("結束時間"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="selectApi"?(e.openBlock(),e.createBlock(Y,{key:2,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectData"?(e.openBlock(),e.createBlock(Y,{key:3,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectDict"?(e.openBlock(),e.createBlock(Y,{key:4,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectCommonDict"?(e.openBlock(),e.createBlock(Y,{key:5,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="treeSelectApi"?(e.openBlock(),e.createBlock(J,{key:6,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,data:s.search.data,props:s.search.props,"value-key":s.search.valueKey,"default-expanded-keys":s.search.defaultExpandedKeys,placeholder:d.$t("請選擇"),style:{width:"100%"},"check-strictly":"",clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","data","props","value-key","default-expanded-keys","placeholder"])):s.search.type==="number"?(e.openBlock(),e.createBlock(k,{key:7,type:"number",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請輸入"),style:{width:"100%"},clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(e.openBlock(),e.createBlock(k,{key:8,type:"text",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,style:{width:"100%"},placeholder:d.$t("請輸入"),onKeyup:e.withKeys(y,["enter"]),clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))]),_:2},1032,["label","name","label-width"])]),_:2},1032,["span"]))),128)),e.createVNode(R,{span:e.unref(P)},{default:e.withCtx(()=>{var s;return[e.createVNode(A,{onClick:y,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("查詢")),1)]),_:1}),e.createVNode(A,{onClick:z,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("清空")),1)]),_:1}),e.unref(f)?e.withDirectives((e.openBlock(),e.createBlock(A,{key:0,type:e.unref(f).cssType,icon:e.unref(f).icon,plain:"",onClick:_[0]||(_[0]=u=>I(e.unref(f)))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(e.unref(f).text||"新增")),1)]),_:1},8,["type","icon"])),[[X,e.unref(f).permission||null]]):e.createCommentVNode("",!0),i.dataSource.showBatchDeleteButton?e.withDirectives((e.openBlock(),e.createBlock(A,{key:1,type:"danger",icon:"Delete",plain:"",disabled:d.selectedCount===0,onClick:_[1]||(_[1]=u=>r("actionEvent",{action:"batchDelete"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("批量刪除")),1)]),_:1},8,["disabled"])),[[X,((s=e.unref(w))==null?void 0:s.permission)||null]]):e.createCommentVNode("",!0),i.dataSource.exportUrl?(e.openBlock(),e.createBlock(A,{key:2,type:"primary",icon:"Download",plain:"",onClick:D},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.dataSource.exportButtonName||d.$t("導出")),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),u=>e.withDirectives((e.openBlock(),e.createBlock(A,{key:u.text,onClick:n=>I(u),type:u.cssType,icon:u.icon,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(u.text)),1)]),_:2},1032,["onClick","type","icon"])),[[X,u.permission||null]])),128))]}),_:1},8,["span"])]),_:1})]),_:1},8,["model","label-width"])]),_:1},8,["body-style"])):e.unref(E).length>0&&!e.unref(x)?(e.openBlock(),e.createElementBlock("div",dl,[e.createVNode(Z,{model:e.unref(C),inline:!0,"label-width":i.dataSource.searchLabelWidth||68},{default:e.withCtx(()=>[e.createVNode(G,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),s=>(e.openBlock(),e.createBlock(R,{span:e.unref(L),key:s.search.prop},{default:e.withCtx(()=>[e.createVNode(N,{label:s.label,name:s.search.prop,style:{width:"100%"},"label-width":s.search.labelWidth},{default:e.withCtx(()=>[s.search.type==="daterange"?(e.openBlock(),e.createBlock(T,{key:0,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"daterange",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD","range-separator":d.$t("至"),"start-placeholder":d.$t("開始日期"),"end-placeholder":d.$t("結束日期"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="timerange"?(e.openBlock(),e.createBlock(T,{key:1,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"datetimerange",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm:ss","range-separator":d.$t("至"),"start-placeholder":d.$t("開始時間"),"end-placeholder":d.$t("結束時間"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="selectApi"?(e.openBlock(),e.createBlock(Y,{key:2,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectData"?(e.openBlock(),e.createBlock(Y,{key:3,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectDict"?(e.openBlock(),e.createBlock(Y,{key:4,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectCommonDict"?(e.openBlock(),e.createBlock(Y,{key:5,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="treeSelectApi"?(e.openBlock(),e.createBlock(J,{key:6,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,data:s.search.data,props:s.search.props,"value-key":s.search.valueKey,"default-expanded-keys":s.search.defaultExpandedKeys,placeholder:d.$t("請選擇"),style:{width:"100%"},"check-strictly":"",clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","data","props","value-key","default-expanded-keys","placeholder"])):s.search.type==="number"?(e.openBlock(),e.createBlock(k,{key:7,type:"number",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請輸入"),style:{width:"100%"},clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(e.openBlock(),e.createBlock(k,{key:8,type:"text",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,style:{width:"100%"},placeholder:d.$t("請輸入"),onKeyup:e.withKeys(y,["enter"]),clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))]),_:2},1032,["label","name","label-width"])]),_:2},1032,["span"]))),128)),e.createVNode(R,{span:e.unref(P)},{default:e.withCtx(()=>{var s;return[e.createVNode(A,{onClick:y,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("查詢")),1)]),_:1}),e.createVNode(A,{onClick:z,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("清空")),1)]),_:1}),e.unref(f)?e.withDirectives((e.openBlock(),e.createBlock(A,{key:0,type:e.unref(f).cssType,icon:e.unref(f).icon,plain:"",onClick:_[2]||(_[2]=u=>I(e.unref(f)))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(e.unref(f).text||"新增")),1)]),_:1},8,["type","icon"])),[[X,e.unref(f).permission||null]]):e.createCommentVNode("",!0),i.dataSource.showBatchDeleteButton?e.withDirectives((e.openBlock(),e.createBlock(A,{key:1,type:"danger",icon:"Delete",plain:"",disabled:d.selectedCount===0,onClick:_[3]||(_[3]=u=>r("actionEvent",{action:"batchDelete"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("批量刪除")),1)]),_:1},8,["disabled"])),[[X,((s=e.unref(w))==null?void 0:s.permission)||null]]):e.createCommentVNode("",!0),i.dataSource.exportUrl?(e.openBlock(),e.createBlock(A,{key:2,type:"primary",icon:"Download",plain:"",onClick:D},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("導出")),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),u=>e.withDirectives((e.openBlock(),e.createBlock(A,{key:u.text,onClick:n=>I(u),type:u.cssType,icon:u.icon,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(u.text)),1)]),_:2},1032,["onClick","type","icon"])),[[X,u.permission||null]])),128))]}),_:1},8,["span"])]),_:1})]),_:1},8,["model","label-width"])])):e.unref(m).length>0?(e.openBlock(),e.createElementBlock("div",pl,[e.unref(f)?e.withDirectives((e.openBlock(),e.createBlock(A,{key:0,type:e.unref(f).cssType,icon:e.unref(f).icon,plain:"",onClick:_[4]||(_[4]=s=>I(e.unref(f)))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f).text||d.$t("新增")),1)]),_:1},8,["type","icon"])),[[X,e.unref(f).permission||null]]):e.createCommentVNode("",!0),i.dataSource.showBatchDeleteButton?e.withDirectives((e.openBlock(),e.createBlock(A,{key:1,type:"danger",icon:"Delete",plain:"",disabled:d.selectedCount===0,onClick:_[5]||(_[5]=s=>r("actionEvent",{action:"batchDelete"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("批量刪除")),1)]),_:1},8,["disabled"])),[[X,((le=e.unref(w))==null?void 0:le.permission)||null]]):e.createCommentVNode("",!0),i.dataSource.exportUrl?(e.openBlock(),e.createBlock(A,{key:2,type:"primary",icon:"Download",plain:"",onClick:D},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.dataSource.exportButtonName||d.$t("導出")),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),s=>e.withDirectives((e.openBlock(),e.createBlock(A,{key:s.text,onClick:u=>I(s),type:s.cssType,icon:s.icon,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(s.text)),1)]),_:2},1032,["onClick","type","icon"])),[[X,s.permission||null]])),128))])):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-fbfbd6fe"]]),We={查詢:"查询",清空:"清空",新增:"新增",批量刪除:"批量删除",刪除:"删除",刪除成功:"删除成功",編輯:"编辑",導出:"导出",請選擇:"请选择",請輸入:"请输入",至:"至",開始日期:"开始日期",結束日期:"结束日期",開始時間:"开始时间",結束時間:"结束时间",操作:"操作",未查詢到數據:"未查询到数据","數據加載中...":"数据加载中...",關閉:"关闭",存儲:"存储",請選擇日期:"请选择日期",請選擇日期時間:"请选择日期时间",需点击选择器中的确定按钮:"需点击选择器中的确定按钮","確認刪除此數據嗎?":"确认删除此数据吗?","確認刪除選中的 {count} 條數據嗎?":"确认删除选中的 {count} 条数据吗?",請先勾選要刪除的數據:"请先勾选要删除的数据",數據存儲成功:"数据存储成功",導出失敗:"导出失败"},Qe={查詢:"查詢",清空:"清空",新增:"新增",批量刪除:"批量刪除",刪除:"刪除",刪除成功:"刪除成功",編輯:"編輯",導出:"導出",請選擇:"請選擇",請輸入:"請輸入",至:"至",開始日期:"開始日期",結束日期:"結束日期",開始時間:"開始時間",結束時間:"結束時間",操作:"操作",未查詢到數據:"未查詢到數據","數據加載中...":"數據加載中...",關閉:"關閉",存儲:"存儲",請選擇日期:"請選擇日期",請選擇日期時間:"請選擇日期時間",需点击选择器中的确定按钮:"需點擊選擇器中的確定按鈕","確認刪除此數據嗎?":"確認刪除此數據嗎?","確認刪除選中的 {count} 條數據嗎?":"確認刪除選中的 {count} 條數據嗎?",請先勾選要刪除的數據:"請先勾選要刪除的數據",數據存儲成功:"數據存儲成功",導出失敗:"導出失敗"},Ge={查詢:"Search",清空:"Clear",新增:"Add",批量刪除:"Batch Delete",刪除:"Delete",刪除成功:"Deleted successfully",編輯:"Edit",導出:"Export",請選擇:"Select ",請輸入:"Enter ",至:"to",開始日期:"Start Date",結束日期:"End Date",開始時間:"Start Time",結束時間:"End Time",操作:"Action",未查詢到數據:"No data found","數據加載中...":"Loading...",關閉:"Close",存儲:"Save",請選擇日期:"Select date",請選擇日期時間:"Select datetime",需点击选择器中的确定按钮:"Click the confirm button in the picker","確認刪除此數據嗎?":"Are you sure to delete this record?","確認刪除選中的 {count} 條數據嗎?":"Are you sure to delete the selected {count} records?",請先勾選要刪除的數據:"Please select records to delete first",數據存儲成功:"Data saved successfully",導出失敗:"Export failed"};let Je=!1;const ul={zh_CN:We,zh_HK:Qe,en_US:Ge};function ml(){if(!Je)try{const t=e.getCurrentInstance();if(!t)return;const a=t.appContext.app.config.globalProperties.$i18n;if(a){const l=a.global||a;for(const[c,r]of Object.entries(ul))if(l&&typeof l.mergeLocaleMessage=="function"&&l.mergeLocaleMessage(c,r),l&&l.messages){const i=l.messages[c]||{};l.messages[c]={...r,...i}}Je=!0}}catch{}}const hl={key:1},Xe=e.defineComponent({__name:"index",props:{dataSource:{},showCard:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},showPadding:{type:Boolean,default:!0},maxHeight:{}},emits:["actionEvent","beforeQuery"],setup(t,{expose:o,emit:a}){const{proxy:l}=e.getCurrentInstance(),c=a,r=t,i=e.computed(()=>r.dataSource.maxHeight!=null?void 0:r.maxHeight),m=e.ref(!1),f=e.ref({}),w=e.ref({}),p=e.ref(),I=e.ref(),S=e.ref(0),L=e.computed(()=>{const k=(r.dataSource.columns||[]).map(N=>N.slot).filter(N=>!!N);return Array.from(new Set(k))}),x=k=>{S.value=Array.isArray(k)?k.length:0},P=(k=!1)=>{m.value=!1,f.value={},k===!0&&j()},j=()=>{var k;return(k=p.value)==null?void 0:k.refreshTable()},H=async()=>{var k;return await((k=p.value)==null?void 0:k.initData())},C=()=>{var k;return(k=I.value)==null?void 0:k.initData()},E=async(k,N)=>{let R=N;r.dataSource.beforeAction&&(R=await r.dataSource.beforeAction(k,N)),y(k,R)},y=(k,N)=>{if(typeof k.action=="function"){k.action(N);return}const A={update:()=>D(k,N),delete:()=>$(k,N),batchDelete:()=>z(),create:()=>V(k,N),view:()=>_(k,N),filter:()=>T(),back:()=>J()}[k.action];A?A():c("actionEvent",k,N)},D=async(k,N)=>{r.dataSource.beforeUpdate&&await r.dataSource.beforeUpdate(N)===!1||(f.value=N,w.value=k,m.value=!0)},$=async(k,N)=>{var R,A,G;try{if(r.dataSource.beforeDelete&&await r.dataSource.beforeDelete(N)===!1)return;const Z=N[r.dataSource.rowKey];if(!Z){l==null||l.$modal.msgError(l==null?void 0:l.$t("rowKey参数不正确"));return}const ee=k.confirm||k.confirmText||(l==null?void 0:l.$t("確認刪除此數據嗎?"));await(l==null?void 0:l.$modal.confirm(ee)),await((A=(R=r.dataSource).deleteApi)==null?void 0:A.call(R,Z)),l==null||l.$modal.msgSuccess(l==null?void 0:l.$t("刪除成功")),(G=p.value)==null||G.refreshTable()}catch(Z){Z!=="cancel"&&console.error("Delete failed:",Z)}},z=async()=>{var R,A,G,Z,ee;if(!r.dataSource.deleteApi){l==null||l.$modal.msgError(l==null?void 0:l.$t("deleteApi 方法未設置"));return}const k=((A=(R=p.value)==null?void 0:R.getSelection)==null?void 0:A.call(R))??[];if(!k.length){l==null||l.$modal.msgWarning(l==null?void 0:l.$t("請先勾選要刪除的數據"));return}await(l==null?void 0:l.$modal.confirm(l==null?void 0:l.$t("確認刪除選中的 {count} 條數據嗎?",{count:k.length})));const N=[];for(const X of k){if(r.dataSource.beforeDelete&&await r.dataSource.beforeDelete(X)===!1)continue;const le=X[r.dataSource.rowKey];le!=null&&N.push(le)}N.length&&(await((Z=(G=r.dataSource).deleteApi)==null?void 0:Z.call(G,N)),l==null||l.$modal.msgSuccess(l==null?void 0:l.$t("刪除成功")),(ee=p.value)==null||ee.refreshTable())},V=async(k,N)=>{r.dataSource.beforeCreate&&await r.dataSource.beforeCreate(N||{})===!1||(f.value=N||{},w.value=k,m.value=!0)},d=async(k={})=>{const N=k&&(Object.prototype.hasOwnProperty.call(k,"data")||Object.prototype.hasOwnProperty.call(k,"title")||Object.prototype.hasOwnProperty.call(k,"text")||Object.prototype.hasOwnProperty.call(k,"width")||Object.prototype.hasOwnProperty.call(k,"labelWidth")||Object.prototype.hasOwnProperty.call(k,"labelPosition")),R=N?k.data||{}:k||{},A={action:"create",...N?{title:k.title,text:k.text,width:k.width,labelWidth:k.labelWidth,labelPosition:k.labelPosition}:{}};await V(A,R)},_=(k,N)=>{let R=k.url;const A=k.pm;if(A&&N[A]){const G=R.includes("?")?"&":"?";R+=`${G}${A}=${N[A]}`}l==null||l.$router.push(R)},T=()=>{var N,R;const k=(N=I.value)==null?void 0:N.getQueryParams();(R=p.value)==null||R.refreshTable(k||{})},F=()=>{var k;return(k=I.value)==null?void 0:k.getQueryParams()},Y=()=>{var k;return(k=p.value)==null?void 0:k.getSelection()},J=()=>l==null?void 0:l.$router.back();return e.onMounted(()=>{ml(),Vt(r.dataSource.columns)}),o({refreshTable:j,initSearch:C,initTable:H,openCreate:d,getQueryParams:F,getSelection:Y}),(k,N)=>{const R=B.ElCard;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"p-3":k.showPadding})},[e.createVNode(fl,{dataSource:r.dataSource,selectedCount:e.unref(S),ref_key:"curdSearchRef",ref:I,onActionEvent:E},null,8,["dataSource","selectedCount"]),k.showCard?(e.openBlock(),e.createBlock(R,{key:0,"body-style":{paddingBottom:r.dataSource.paging===!1?"20px":"0px"},shadow:"hover"},{default:e.withCtx(()=>[e.createVNode(je,{ref_key:"curdTableRef",ref:p,onActionEvent:E,onSelectionChange:x,dataSource:r.dataSource,maxHeight:e.unref(i)},e.createSlots({_:2},[e.renderList(e.unref(L),A=>({name:A,fn:e.withCtx(G=>[e.renderSlot(k.$slots,A,e.normalizeProps(e.guardReactiveProps(G)))])}))]),1032,["dataSource","maxHeight"]),e.createVNode(Ke,{onClose:P,modelValue:e.unref(m),"onUpdate:modelValue":N[0]||(N[0]=A=>e.isRef(m)?m.value=A:null),dataSource:r.dataSource,action:e.unref(w),editData:e.unref(f)},null,8,["modelValue","dataSource","action","editData"])]),_:3},8,["body-style"])):(e.openBlock(),e.createElementBlock("div",hl,[e.createVNode(je,{ref_key:"curdTableRef",ref:p,onActionEvent:E,onSelectionChange:x,dataSource:r.dataSource,maxHeight:e.unref(i)},e.createSlots({_:2},[e.renderList(e.unref(L),A=>({name:A,fn:e.withCtx(G=>[e.renderSlot(k.$slots,A,e.normalizeProps(e.guardReactiveProps(G)))])}))]),1032,["dataSource","maxHeight"]),e.createVNode(Ke,{onClose:P,modelValue:e.unref(m),"onUpdate:modelValue":N[1]||(N[1]=A=>e.isRef(m)?m.value=A:null),dataSource:r.dataSource,action:e.unref(w),editData:e.unref(f)},null,8,["modelValue","dataSource","action","editData"])]))],2)}}}),Ze={401:"认证失败,无法访问系统资源",403:"当前操作没有权限",404:"访问资源不存在",default:"系统未知错误,请反馈给管理员"};function ve(t,o,a){const l=B.ElLoading.service({text:"正在下載數據,請稍後",background:"rgba(0, 0, 0, 0.7)"});return oe().post(t,o,{transformRequest:[c=>rl(c)],headers:{"Content-Type":"application/x-www-form-urlencoded"},responseType:"blob"}).then(async c=>{if(nl(c)){const i=new Blob([c]);dt.saveAs(i,a)}else{const i=await new Blob([c]).text(),m=JSON.parse(i),f=Ze[m.code]||m.msg||Ze.default;B.ElMessage.error(f)}l.close()}).catch(c=>{console.error(c),B.ElMessage.error("下载文件出现错误,请联系管理员!"),l.close()})}let et;const gl={msg(t){B.ElMessage.info(t)},msgError(t){B.ElMessage.error(t)},msgSuccess(t){B.ElMessage.success(t)},msgWarning(t){B.ElMessage.warning(t)},alert(t){B.ElMessageBox.alert(t,"系統提示")},alertError(t){B.ElMessageBox.alert(t,"系統提示",{type:"error"})},alertSuccess(t){B.ElMessageBox.alert(t,"系統提示",{type:"success"})},alertWarning(t){B.ElMessageBox.alert(t,"系統提示",{type:"warning"})},notify(t){B.ElNotification.info(t)},notifyError(t){B.ElNotification.error(t)},notifySuccess(t){B.ElNotification.success(t)},notifyWarning(t){B.ElNotification.warning(t)},confirm(t){return B.ElMessageBox.confirm(t,"系統提示",{confirmButtonText:"確認",cancelButtonText:"取消",type:"warning"})},prompt(t,o,a=""){return B.ElMessageBox.prompt(t,o||"系統提示",{confirmButtonText:"確認",cancelButtonText:"取消",type:"warning",inputType:a,inputPlaceholder:t})},loading(t){et=B.ElLoading.service({lock:!0,text:t,background:"rgba(0, 0, 0, 0.7)"})},closeLoading(){et.close()}};function tt(t){return oe()({url:"/system/dict/data/type/"+t,method:"get"})}function lt(t){return oe()({url:"/system/common/dict/data/type/"+t,method:"get"})}const re=Te.defineStore("dict",()=>{const t=e.ref(new Map);return{dict:t,getDict:r=>r&&t.value.get(r)||null,setDict:(r,i)=>{if(!r)return!1;try{return t.value.set(r,i),!0}catch(m){return console.error("Error in setDict:",m),!1}},removeDict:r=>{if(!r)return!1;try{return t.value.delete(r)}catch(i){return console.error("Error in removeDict:",i),!1}},cleanDict:()=>{t.value.clear()}}}),yl=(...t)=>{const o=e.ref({});return t.forEach(async a=>{o.value[a]=[];const l=re().getDict(a);l?o.value[a]=l:await tt(a).then(c=>{o.value[a]=c.data.map(r=>({label:r.dictLabel,value:r.dictValue,elTagType:r.listClass,elTagClass:r.cssClass})),re().setDict(a,o.value[a])})}),o.value},kl=async t=>{const o=re().getDict(t);if(o&&o.length>0)return o;{const l=(await tt(t)).data.map(c=>({label:c.dictLabel,value:c.dictValue,elTagType:c.listClass,elTagClass:c.cssClass,remark:c.remark}));return re().setDict(t,l),l}},bl=(...t)=>{const o=e.ref({});return t.forEach(async a=>{o.value[a]=[];const l=re().getDict(a);l&&l.length>0?o.value[a]=l:await lt(a).then(c=>{o.value[a]=c.data.map(r=>({label:r.dictLabel,value:r.dictValue,elTagType:r.listClass,elTagClass:r.cssClass,remark:r.remark})),re().setDict(a,o.value[a])})}),o.value},Bl=async t=>{const o=re().getDict(t);if(o&&o.length>0)return o;{const l=(await lt(t)).data.map(c=>({label:c.dictLabel,value:c.dictValue,elTagType:c.listClass,elTagClass:c.cssClass}));return re().setDict(t,l),l}},wl={beforeMount(t,{value:o,arg:a}){if(a==="callback")t.$copyCallback=o;else{t.$copyValue=o;const l=()=>{Vl(t.$copyValue),t.$copyCallback&&t.$copyCallback(t.$copyValue)};t.addEventListener("click",l),t.$destroyCopy=()=>t.removeEventListener("click",l)}}};function Vl(t,{target:o=document.body}={}){const a=document.createElement("textarea"),l=document.activeElement;a.value=t,a.setAttribute("readonly",""),a.style.contain="strict",a.style.position="absolute",a.style.left="-9999px",a.style.fontSize="12pt";const c=document.getSelection();let r;c&&(r=(c==null?void 0:c.rangeCount)>0&&c.getRangeAt(0)),o.append(a),a.select(),a.selectionStart=0,a.selectionEnd=t.length;let i=!1;try{i=document.execCommand("copy")}catch(m){console.error(m)}return a.remove(),r&&(c==null||c.removeAllRanges(),c==null||c.addRange(r)),l&&l.focus(),i}const at={zh_CN:We,zh_HK:Qe,en_US:Ge},Cl={Curd:Xe,DictTag:ge,DictText:he,SvgIcon:ce,OssImagePreview:be,OssFile:Be,Editor:Ee,TranslateInput:De,ImageUpload:_e,FileUpload:Se},ot=(t,o={})=>{o.baseUrl!=null&&Ie(o.baseUrl),o.request&&Ue(o.request),o.globalHeaders&&Ae(o.globalHeaders),(o.hasPermi||o.hasRoles)&&Ye(o);try{const l=t.config.globalProperties.$i18n;if(l){const c=l.global||l;for(const[r,i]of Object.entries(at))if(c&&typeof c.mergeLocaleMessage=="function"&&c.mergeLocaleMessage(r,i),c&&c.messages){const m=c.messages[r]||{};c.messages[r]={...i,...m}}}}catch{}for(const[l,c]of Object.entries(Cl))t.component(l,c);const a=t.config.globalProperties;a.$modal=gl,a.download=ve,a.useDict=yl,a.useOneDict=kl,a.useOneCommonDict=Bl,a.useCommonDict=bl,a.parseTime=el,a.addDateRange=tl,a.handleTree=ol,a.selectDictLabel=ll,a.selectDictLabels=al,t.directive("hasPermi",$t),t.directive("hasRoles",xt),t.directive("copyText",wl)},Sl={install:ot};M.Curd=Xe,M.DictTag=ge,M.DictText=he,M.Editor=Ee,M.FileUpload=Se,M.ImageUpload=_e,M.OssFile=Be,M.OssImagePreview=be,M.SvgIcon=ce,M.TranslateInput=De,M.default=Sl,M.download=ve,M.getBaseUrl=de,M.getGlobalHeaders=ie,M.getRequest=oe,M.hasPermission=pe,M.install=ot,M.messages=at,M.setBaseUrl=Ie,M.setGlobalHeaders=Ae,M.setPermissionChecker=Ye,M.setRequest=Ue,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(M,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("element-plus/es"),require("vue"),require("vue-types"),require("@element-plus/icons-vue"),require("axios"),require("image-conversion"),require("pinia"),require("@vueup/vue-quill/dist/vue-quill.snow.css"),require("@vueup/vue-quill"),require("vue-i18n"),require("dayjs"),require("file-saver")):typeof define=="function"&&define.amd?define(["exports","element-plus/es","vue","vue-types","@element-plus/icons-vue","axios","image-conversion","pinia","@vueup/vue-quill/dist/vue-quill.snow.css","@vueup/vue-quill","vue-i18n","dayjs","file-saver"],b):(M=typeof globalThis<"u"?globalThis:M||self,b(M.Vue3Curd={},M.ElementPlus,M.Vue,M.VueTypes,M.ElementPlusIconsVue,M.axios,M.imageConversion,M.Pinia,null,M.VueQuill,M.VueI18n,M.dayjs,M.FileSaver))})(this,(function(M,b,e,nt,ne,ct,st,Te,Al,$e,xe,it,dt){"use strict";const Q=nt.createTypes({func:void 0,bool:void 0,string:void 0,number:void 0,object:void 0,integer:void 0}),pt=["xlink:href","fill"],ft=e.defineComponent({__name:"index",props:{iconClass:Q.string.isRequired,className:Q.string.def(""),color:Q.string.def("")},setup(t){const o=t,a=e.computed(()=>`#icon-${o.iconClass}`),l=e.computed(()=>o.className?`svg-icon ${o.className}`:"svg-icon");return(c,r)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(e.unref(l)),"aria-hidden":"true"},[e.createElementVNode("use",{"xlink:href":e.unref(a),fill:t.color},null,8,pt)],2))}}),te=(t,o)=>{const a=t.__vccOpts||t;for(const[l,c]of o)a[l]=c;return a},se=te(ft,[["__scopeId","data-v-ed552a8d"]]),he=e.defineComponent({__name:"index",props:{options:{type:Array,default:null},value:{type:[Number,String,Array,void 0],default:""},separator:{type:String,default:"、"}},setup(t){const o=t,a=e.computed(()=>{const l=o.value;if(l===""||l===null||typeof l>"u")return"";const c=r=>{var m;const i=(m=o.options)==null?void 0:m.find(f=>f.value==r||f.label==r);return(i==null?void 0:i.label)??""};if(Array.isArray(l))return l.map(r=>c(r)).filter(Boolean).join(o.separator);if(typeof l=="string"){let r=[];if(l.indexOf(",")>-1?r=l.split(","):l.indexOf("、")>-1&&(r=l.split("、")),r.length>0)return r.map(i=>c(i)).filter(Boolean).join(o.separator)}return c(l)||l});return(l,c)=>(e.openBlock(),e.createElementBlock("span",null,e.toDisplayString(e.unref(a)),1))}}),ge=te(e.defineComponent({__name:"index",props:{options:{type:Array,default:null},value:{type:[Number,String,Array,void 0],default:""}},setup(t){const o=t,a=e.computed(()=>{const l=o.value;if(l===""||l===null||typeof l>"u")return"";if(Array.isArray(l)){const c=[];return o.options.map(r=>{(l.indexOf(r.value)>-1||l.indexOf(r.label)>-1)&&c.push(r)}),c}else if(typeof l=="string"){let c=[];if(l.indexOf(",")>-1?c=l.split(","):l.indexOf("、")>-1&&(c=l.split("、")),c.length>0){const r=[];return o.options.map(i=>{(c.indexOf(i.value)>-1||c.indexOf(i.label)>-1)&&r.push(i)}),r}}return o.options.find(c=>c.value==l||c.label==l)||l});return(l,c)=>{const r=b.ElTag;return Array.isArray(e.unref(a))?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(a),i=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[i.label?(e.openBlock(),e.createBlock(r,{"disable-transitions":!0,key:i.value,type:i.elTagType||"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:2},1032,["type"])):e.createCommentVNode("",!0)],64))),256)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(a).label?(e.openBlock(),e.createBlock(r,{"disable-transitions":!0,key:e.unref(a).value,type:e.unref(a).elTagType||"primary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a).label),1)]),_:1},8,["type"])):e.createCommentVNode("",!0)],64))}}}),[["__scopeId","data-v-9a5060d2"]]);let ie=null,Ne=()=>({}),ye="";const ut=()=>{const t=ct.create({baseURL:ye,timeout:5e4});return t.interceptors.response.use(o=>o.data,o=>Promise.reject(o)),t},oe=()=>(ie||(ie=ut()),ie),Ue=t=>{ie=t},de=()=>Ne(),Ae=t=>{Ne=t},pe=()=>ye,Ie=t=>{ye=t||""};function ke(t){return oe()({url:"/resource/oss/listByIds/"+t,method:"get"})}function Le(t){return oe()({url:"/resource/oss/"+t,method:"delete"})}const mt={class:"image-slot"},ht={key:1},be=te(e.defineComponent({__name:"index",props:{modelValue:[String,Object,Array,Number],width:{type:[Number,String],default:""},height:{type:[Number,String],default:""}},setup(t){const o=t,a=e.ref(""),l=e.computed(()=>a.value?a.value.split(",")[0]:void 0),c=e.computed(()=>{if(!a.value)return;const i=a.value.split(","),m=[];return i.forEach(f=>m.push(f)),m}),r=e.computed(()=>{const i=o.width;return typeof i=="string"?i:`${i}px`});return e.computed(()=>{const i=o.height;return typeof i=="string"?i:`${i}px`}),e.watch(()=>o.modelValue,async i=>{if(i){let m;Array.isArray(i)?m=i:m=(await ke(i)).data,a.value=m.map(f=>f.url).join(",")}else a.value=""},{immediate:!0,deep:!0}),(i,m)=>{const f=b.ElIcon,w=b.ElImage;return e.openBlock(),e.createElementBlock("div",null,[e.unref(l)?(e.openBlock(),e.createBlock(w,{key:0,src:`${e.unref(l)}`,fit:"scale-down",loading:"lazy",style:e.normalizeStyle(`width:${e.unref(r)};height:${e.unref(r)};`),"preview-src-list":e.unref(c),"preview-teleported":""},{error:e.withCtx(()=>[e.createElementVNode("div",mt,[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(e.unref(ne.PictureFilled))]),_:1})])]),_:1},8,["src","style","preview-src-list"])):(e.openBlock(),e.createElementBlock("div",ht,[e.createElementVNode("div",{class:"image-slot",style:e.normalizeStyle(`width:${e.unref(r)};height:${e.unref(r)};`)},[e.createVNode(f,null,{default:e.withCtx(()=>[e.createVNode(e.unref(ne.PictureFilled))]),_:1})],4)]))])}}}),[["__scopeId","data-v-dc163acb"]]),gt={class:"image-slot"},Be=te(e.defineComponent({__name:"index",props:{data:{type:Object,default:()=>({})},width:{type:[Number,String],default:60},height:{type:[Number,String],default:60}},setup(t){const o=t,a=e.computed(()=>typeof o.width=="string"?o.width:`${o.width}px`),l=e.computed(()=>typeof o.height=="string"?o.height:`${o.height}px`);return(c,r)=>{const i=b.ElIcon,m=b.ElImage,f=se;return e.openBlock(),e.createElementBlock("span",null,[[".jpg",".png",".jpeg"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(m,{key:0,src:t.data.url,fit:"cover","preview-src-list":[t.data.url],style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`),"preview-teleported":""},{error:e.withCtx(()=>[e.createElementVNode("div",gt,[e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(e.unref(ne.PictureFilled))]),_:1})])]),_:1},8,["src","preview-src-list","style"])):[".xls",".xlsx",".csv"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:1,"icon-class":"excel",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".doc",".docx"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:2,"icon-class":"word",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".pdf"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:3,"icon-class":"pdf",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".tet"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:4,"icon-class":"tet",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):[".zip"].indexOf(t.data.fileSuffix)>-1?(e.openBlock(),e.createBlock(f,{key:5,"icon-class":"zip",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"])):(e.openBlock(),e.createBlock(f,{key:6,"icon-class":"unknown",style:e.normalizeStyle(`width:${e.unref(a)};height:${e.unref(l)};`)},null,8,["style"]))])}}}),[["__scopeId","data-v-a3763021"]]),Pe={bool:[{label:"是",value:"1"},{label:"否",value:"0"},{label:"是",value:"True"},{label:"否",value:"False"}]},yt=[{prop:"createTime",width:"165px"},{prop:"createBy",width:"100px"},{prop:"orderNum",width:"80px"},{prop:"sort",width:"80px"},{prop:"code",width:"120px"},{prop:"updateTime",width:"165px"}],kt=[10,15,20,30,50,100],Fe={pageSize:15,pageNum:1,total:0,orderByColumn:"",isAsc:""},we={FULL:"total, sizes, prev, pager, next",SIMPLE:"total"},Oe=30,bt=28;function Ve(t){if(!t)return{};const o={};for(const a in t){const l=t[a];l!==""&&l!==null&&l!==void 0&&(!Array.isArray(l)||l.length>0)&&(o[a]=l)}return o}function Bt(t){if(t.width)return String(t.width);const o=yt.find(a=>a.prop===t.prop);return o?o.width:t.prop.includes("time")?"100px":"auto"}function wt(t,o){if(!o.prop)return"";let a;if(o.prop.includes(".")?a=o.prop.split(".").reduce((c,r)=>c==null?void 0:c[r],t):a=t[o.prop],a!=null){const l=o.prefix||"",c=o.suffix||"";return`${l}${a}${c}`}return""}function Vt(t){t.forEach(o=>{o.form||(o.form={order:100}),o.form.order==null&&(o.form.order=100),!o.form.type&&o.type&&(o.form.type=o.type),!o.form.prop&&o.prop&&(o.form.prop=o.prop),o.search&&!o.search.dictType&&o.dictType&&(o.search.dictType=o.dictType),!o.form.dictType&&o.dictType&&(o.form.dictType=o.dictType),!o.form.inactiveValue&&o.inactiveValue&&(o.form.inactiveValue=o.inactiveValue),!o.form.activeValue&&o.activeValue&&(o.form.activeValue=o.activeValue),o.form.type==="checkbox"&&(o.label=""),o.search&&(o.search.prop=o.search.prop??o.prop)})}function Ct(t){t.forEach(o=>{if(!o.form)return;const a=o.form.rules||[];o.form.required&&a.push({required:!0,message:`${o.label}必填`,trigger:"blur"}),o.form.rules=a.length>0?a:void 0})}function ze(t,o="order"){return[...t].sort((a,l)=>{const c=(m,f)=>{const w=f.split(".");let p=m;for(const I of w)p=p==null?void 0:p[I];return p??100},r=c(a,o),i=c(l,o);return r-i})}function St(t,o,a){return t.filter(l=>!(l.canEdit===!1||a&&l.canUpdate===!1||!a&&l.canCreate===!1))}function _t(t,o){if(!o.show)return!0;for(const a in o.show)if(o.show[a].includes(t[a]))return!0;return!1}function Dt(t,o){if(!o.disable&&!o.enable)return!1;for(const a in o.disable)if(o.disable[a].includes(t[a]))return!0;for(const a in o.enable)if(!o.enable[a].includes(t[a]))return!0;return!1}function Et(t,o,a,l){o&&o[0]&&o[1]&&(t[a]=`${o[0]},${o[1]}`,l==null||l.addDateRange(t,o,a))}function Tt(t){const{proxy:o}=e.getCurrentInstance(),a=e.ref([]),l=e.ref(!1),c=e.ref([]),r=e.ref({}),i=e.ref(),m=e.ref({...Fe,pageSize:t.initialPageSize??Fe.pageSize}),f=e.ref(kt),w=e.ref(we.FULL),p=async()=>{var E;if(!t.listApi){t.data?a.value=Array.isArray(t.data)?t.data:((E=t.data)==null?void 0:E.value)||[]:a.value=[];return}l.value=!0;try{const y=await I(null),D=await t.listApi(y);t.afterQuery&&await t.afterQuery(D);let $=D.rows||D.data;t.treeProps&&($=o==null?void 0:o.handleTree(D.data,t.rowKey)),a.value=$,m.value.total=D.total;const z=D.total/m.value.pageSize<=1;w.value=z?we.SIMPLE:we.FULL,o==null||o.$forceUpdate()}catch(y){console.error("Query failed:",y)}finally{l.value=!1}},I=async E=>{E&&(r.value=Ve(E));let y=t.queryParams||{};if(t.beforeQuery){const D=await t.beforeQuery({});y={...m.value,...y,...r.value,...D}}else y={...m.value,...y,...r.value};return y},S=E=>{E&&(r.value=Ve(E)),p()},L=E=>{m.value.pageNum=E,p()},N=E=>{m.value.pageSize=E,p()},P=E=>{E.order&&(m.value.orderByColumn=E.prop,m.value.isAsc=E.order),p()},j=E=>{c.value=E,t.selectionChange&&t.selectionChange(E)},H=()=>{const E=t.queryParams||{};E.orderByColumn&&(m.value.orderByColumn=E.orderByColumn,i.value={prop:E.orderByColumn,order:E.isAsc==="asc"?"ascending":"descending"}),E.isAsc&&(m.value.isAsc=E.isAsc)};return{listData:a,loading:l,multipleSelection:c,pageOptions:m,listSize:f,pagingLayout:w,defaultSort:i,executeQuery:p,getQueryParams:I,refreshTable:S,handlePageChange:L,handleSizeChange:N,handleSortChange:P,handleSelectionChange:j,initData:async()=>{H(),await p()}}}function Me(){const{proxy:t}=e.getCurrentInstance(),o=async r=>{for(const i of r)if(i.type==="dictTag"||i.type==="dictText"){const m=await(t==null?void 0:t.useOneDict(i.dictType));i.data=e.toRaw(m)}else if(i.type==="commonDictTag"||i.type==="commonDictText"){const m=await(t==null?void 0:t.useOneCommonDict(i.dictType));i.data=e.toRaw(m)}},a=async r=>{if(!r.search)return;switch(r.search.type){case"selectApi":r.search.api?await l(r):console.error(`${r.prop}中search对象未设置api参数`);break;case"treeSelectApi":r.search.api?await c(r):console.error(`${r.prop}中search对象未设置api参数`);break;case"selectCommonDict":r.search.data=await(t==null?void 0:t.useOneCommonDict(r.search.dictType));break;case"selectDict":r.search.data=await(t==null?void 0:t.useOneDict(r.search.dictType));break}},l=async r=>{var m;if(!((m=r.search)!=null&&m.api))return;const i={pageNum:1,pageSize:1e3,filedName:r.prop,...r.search.apiParams||{}};try{const f=await r.search.api(i);r.search.data=f.data||f.rows}catch(f){console.error(`Failed to load API data for ${r.prop}:`,f)}},c=async r=>{var i;if((i=r.search)!=null&&i.api)try{const m=await r.search.api({pageNum:1,pageSize:1e3});if(r.search.data=m.data||m.rows||m,r.search.data&&Array.isArray(r.search.data)){const w=(r.search.props||{value:"id",label:"label",children:"children"}).value||"id";r.search.defaultExpandedKeys=r.search.data.map(p=>p[w])}}catch(m){console.error(`Failed to load tree API data for ${r.prop}:`,m)}};return{initColumnDicts:o,initSearchDicts:a,initSelectApi:l}}let Ce=()=>!0,Re=()=>!0;const Ye=t=>{t.hasPermi&&(Ce=t.hasPermi),t.hasRoles&&(Re=t.hasRoles)},fe=t=>{if(t==null)return!0;const o=Array.isArray(t)?t:[t];return o.length===0?!0:Ce(o)},$t={mounted(t,o){var l;const{value:a}=o;a!=null&&Array.isArray(a)&&a.length>0&&(Ce(a)||(l=t.parentNode)==null||l.removeChild(t))}},xt={mounted(t,o){var l;const{value:a}=o;a!=null&&Array.isArray(a)&&a.length>0&&(Re(a)||(l=t.parentNode)==null||l.removeChild(t))}},Nt={key:2,class:"image-style"},Ut={key:3,class:"image-style"},At={key:8,class:"color-cell"},It={style:{margin:"20px 0px"}},je=te(e.defineComponent({__name:"curdTable",props:{dataSource:{},maxHeight:{}},emits:["actionEvent","selectionChange","rowClick"],setup(t,{expose:o,emit:a}){const{proxy:l}=e.getCurrentInstance(),c=a,r=t,i=e.computed(()=>r.dataSource.maxHeight??r.maxHeight),m=e.ref(),{listData:f,loading:w,multipleSelection:p,pageOptions:I,listSize:S,pagingLayout:L,defaultSort:N,refreshTable:P,handlePageChange:j,handleSizeChange:H,handleSortChange:C,handleSelectionChange:E,initData:y,getQueryParams:D}=Tt(r.dataSource),{initColumnDicts:$}=Me(),z=e.ref(Pe),V=B=>B==null?void 0:B[r.dataSource.rowKey],d=e.computed(()=>r.dataSource.actions?r.dataSource.actions.filter(B=>B.action!=="create"&&B.action!=="back"&&(!B.position||B.position==="table")&&fe(B.permission)):[]),_=B=>{var O;return!((O=r.dataSource.disabledCheckedRowKeys)!=null&&O.includes(V(B)))},T=e.computed(()=>{const B=r.dataSource.actionColumnWidth;if(B!=null&&B!=="")return typeof B=="number"?`${B}px`:B;let O=d.value.length*bt;return O<Oe&&(O=Oe),`${O+40}px`}),F=(B,O)=>_t(B,O),Y=(B,O)=>Dt(B,O),J=B=>Bt(B),k=B=>fe(B==null?void 0:B.permission),U=B=>{var q;const O=B.align||r.dataSource.align;return O||(((q=B.label)==null?void 0:q.indexOf("時間"))>-1||!1||B.type=="dictTag"||B.type=="image"||B.type=="switch"?"center":"left")},R=(B,O)=>{const q=l==null?void 0:l.useDict(B.dictType)[B.dictType];if(q!=null){const K=O[B.prop],W=q.filter(ae=>ae.value==K);return W.length==0?"":W[0].label}else console.error(B.dictType+" 字典不存在")},A=(B,O)=>{const q=z.value[B.dictType];if(q!=null){const K=O[B.prop],W=q.find(ae=>ae.value==K);return W==null?"":W.label}else console.error(B.dictType+" 字典不存在")},G=(B,O)=>{if(B.data!=null){const q=O[B.prop],K=B.data.find(W=>W.value==q);return K==null?"":K.label}else console.error("未配置data屬性")},Z=(B,O)=>{if(B.data!=null){const q=O[B.prop],K=B.data.find(W=>W.value==q);return K==null?"info":K.tagType}else console.error("未配置data屬性")},ee=(B,O)=>wt(B,O),X=B=>{const O=Array.isArray(B)?B:[];E(O),c("selectionChange",O)},le=(B,O,q)=>{var K,W;return(W=(K=r.dataSource).rowClick)==null?void 0:W.call(K,B,O,q)},s=(B,O)=>c("actionEvent",B,O),u=()=>p.value,n=async()=>{var O,q;if(!r.dataSource.showSelection||!((O=r.dataSource.checkedRowKeys)!=null&&O.length))return;await e.nextTick();const B=m.value;if(B!=null&&B.toggleRowSelection)for(const K of f.value){const W=V(K);if(W==null)continue;const ae=String(W);(q=r.dataSource.checkedRowKeys)!=null&&q.includes(ae)&&B.toggleRowSelection(K,!0)}},h=async()=>{var O,q;if(!r.dataSource.showSelection||!((O=r.dataSource.disabledCheckedRowKeys)!=null&&O.length))return;await e.nextTick();const B=m.value;if(B!=null&&B.toggleRowSelection)for(const K of f.value){const W=V(K);if(W==null)continue;const ae=String(W);(q=r.dataSource.disabledCheckedRowKeys)!=null&&q.includes(ae)&&B.toggleRowSelection(K,!0)}},rt=async()=>{await $(r.dataSource.columns),await y(),await h(),await n()};return e.onMounted(()=>rt()),o({refreshTable:P,getSelection:u,initData:rt,getQueryParams:D}),(B,O)=>{const q=b.ElTableColumn,K=b.ElIcon,W=b.ElImage,ae=b.ElCheckbox,_l=b.ElSwitch,ce=b.ElTag,Dl=ge,El=he,Tl=se,ue=b.ElButton,$l=b.ElTooltip,xl=b.ElTable,Nl=b.ElPagination,me=e.resolveDirective("hasPermi"),Ul=b.ElLoadingDirective;return e.openBlock(),e.createElementBlock("div",null,[e.withDirectives((e.openBlock(),e.createBlock(xl,{ref_key:"curdTableRef",ref:m,data:e.unref(f),"row-key":r.dataSource.rowKey,"element-loading-text":B.$t("數據加載中..."),stripe:"","tree-props":r.dataSource.treeProps,"default-sort":e.unref(N),onSelectionChange:X,onSortChange:e.unref(C),onRowClick:le,"default-expand-all":r.dataSource.treeDefaultExpandAll??!1,"max-height":e.unref(i),"highlight-current-row":""},{empty:e.withCtx(()=>[e.createElementVNode("div",It,e.toDisplayString(B.$t("未查詢到數據")),1)]),default:e.withCtx(()=>[r.dataSource.showSelection?(e.openBlock(),e.createBlock(q,{key:0,type:"selection",width:"60",selectable:_,align:"center"})):e.createCommentVNode("",!0),r.dataSource.showIndex?(e.openBlock(),e.createBlock(q,{key:1,type:"index",width:"70",align:"center",label:"序號"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.dataSource.columns,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.prop||g.key},[g.width!==0&&k(g)?(e.openBlock(),e.createBlock(q,{key:0,label:g.label,width:J(g),"min-width":g.minWidth,prop:g.prop,align:U(g),sortable:g.sort?"custom":!1,"show-overflow-tooltip":g.showOverflowTooltip||!0,fixed:g.fixed},{default:e.withCtx(({row:x})=>[g.slot?e.renderSlot(B.$slots,g.slot,{key:0,row:x,column:g,value:x[g.prop]},void 0,!0):g.type==="image"&&x[g.prop]?(e.openBlock(),e.createBlock(be,{key:1,modelValue:x[g.prop],"onUpdate:modelValue":v=>x[g.prop]=v,class:"image-preview",width:24,height:24},null,8,["modelValue","onUpdate:modelValue"])):g.type==="networkImage"?(e.openBlock(),e.createElementBlock("view",Nt,[x[g.prop]?(e.openBlock(),e.createBlock(W,{key:0,src:x[g.prop],fit:"cover",style:{height:"24px",cursor:"pointer"},"preview-src-list":[x[g.prop]],"preview-teleported":!0,"hide-on-click-modal":""},{error:e.withCtx(()=>[e.createVNode(K,{class:"image-fallback"},{default:e.withCtx(()=>[e.createVNode(e.unref(ne.Picture))]),_:1})]),_:2},1032,["src","preview-src-list"])):(e.openBlock(),e.createBlock(K,{key:1,class:"image-fallback"},{default:e.withCtx(()=>[e.createVNode(e.unref(ne.Picture))]),_:1}))])):g.type==="imageUrl"?(e.openBlock(),e.createElementBlock("view",Ut,[x[g.prop]?(e.openBlock(),e.createBlock(W,{key:0,src:x[g.prop],fit:"cover",style:{height:"24px",cursor:"pointer"},"preview-src-list":[x[g.prop]],"preview-teleported":!0,"hide-on-click-modal":""},{error:e.withCtx(()=>[e.createVNode(K,{class:"image-fallback"},{default:e.withCtx(()=>[e.createVNode(e.unref(ne.Picture))]),_:1})]),_:2},1032,["src","preview-src-list"])):(e.openBlock(),e.createBlock(K,{key:1,class:"image-fallback"},{default:e.withCtx(()=>[e.createVNode(e.unref(ne.Picture))]),_:1}))])):g.type==="date"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createTextVNode(e.toDisplayString(B.parseTime(x[g.prop],"{y}-{m}-{d}")),1)],64)):g.type==="timestamp"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[e.createTextVNode(e.toDisplayString(B.parseTime(x[g.prop])),1)],64)):g.type==="bool"?(e.openBlock(),e.createBlock(ae,{key:6,modelValue:x[g.prop],"onUpdate:modelValue":v=>x[g.prop]=v,onClick:O[0]||(O[0]=e.withModifiers(()=>{},["stop","prevent"]))},null,8,["modelValue","onUpdate:modelValue"])):g.type==="switch"?(e.openBlock(),e.createBlock(_l,{key:7,modelValue:x[g.prop],"onUpdate:modelValue":v=>x[g.prop]=v,"active-value":g.activeValue||"0","inactive-value":g.inactiveValue||"1",size:"small","before-change":()=>!1},null,8,["modelValue","onUpdate:modelValue","active-value","inactive-value"])):g.type==="color"?(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("div",{class:"color-cell-item",style:e.normalizeStyle({backgroundColor:x[g.prop]||"#ffffff"})},null,4)])):g.type==="fromDict"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:9},[e.createTextVNode(e.toDisplayString(R(g,x)),1)],64)):g.type==="fromDataTag"?(e.openBlock(),e.createBlock(ce,{key:10,type:Z(g,x),effect:g.tagEffect??"light",class:"el-column-tag"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(G(g,x)),1)]),_:2},1032,["type","effect"])):g.type==="localDict"?(e.openBlock(),e.createBlock(ce,{key:11,type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(A(g,x)),1)]),_:2},1032,["type","effect"])):g.type==="tag"?(e.openBlock(),e.createBlock(ce,{key:12,type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag",plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x[g.prop]),1)]),_:2},1032,["type","effect"])):g.type==="tagArrayObj"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:13},e.renderList(x[g.prop],v=>(e.openBlock(),e.createBlock(ce,{type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag",key:v[g.displayField],plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v[g.displayField]),1)]),_:2},1032,["type","effect"]))),128)):g.type==="tags"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:14},e.renderList(x[g.prop],v=>(e.openBlock(),e.createBlock(ce,{type:g.tagType||"info",effect:g.tagEffect||"light",class:"el-column-tag",key:v[g.tagLabel],plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v[g.tagLabel]),1)]),_:2},1032,["type","effect"]))),128)):g.type==="dictTag"||g.type==="commonDictTag"?(e.openBlock(),e.createBlock(Dl,{key:15,options:g.data||[],value:x[g.prop]},null,8,["options","value"])):g.type==="dictText"||g.type==="commonDictText"?(e.openBlock(),e.createBlock(El,{key:16,options:g.data||[],value:x[g.prop]},null,8,["options","value"])):g.type==="svg"?(e.openBlock(),e.createBlock(Tl,{key:17,"icon-class":x.icon},null,8,["icon-class"])):g.type==="ossFile"?(e.openBlock(),e.createBlock(Be,{key:18,data:x,width:32,height:32},null,8,["data"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:19},[e.createTextVNode(e.toDisplayString(ee(x,g)),1)],64))]),_:2},1032,["label","width","min-width","prop","align","sortable","show-overflow-tooltip","fixed"])):e.createCommentVNode("",!0)],64))),128)),e.unref(d).length>0?(e.openBlock(),e.createBlock(q,{key:2,align:"center",fixed:"right",label:B.$t("操作"),width:e.unref(T)},{default:e.withCtx(({row:g})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(d),x=>(e.openBlock(),e.createBlock($l,{content:x.text,placement:"top",key:x.action},{default:e.withCtx(()=>[F(g,x)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[x.action==="update"?e.withDirectives((e.openBlock(),e.createBlock(ue,{key:0,link:"",type:"primary",icon:"Edit",onClick:v=>s(x,g),disabled:Y(g,x)},null,8,["onClick","disabled"])),[[me,x.permission||null]]):x.action==="delete"?e.withDirectives((e.openBlock(),e.createBlock(ue,{key:1,link:"",type:"primary",icon:"Delete",onClick:v=>s(x,g),disabled:Y(g,x)},null,8,["onClick","disabled"])),[[me,x.permission||null]]):x.action==="view"||x.action==="viewDetail"?e.withDirectives((e.openBlock(),e.createBlock(ue,{key:2,link:"",type:"primary",icon:"View",onClick:v=>s(x,g),disabled:Y(g,x)},null,8,["onClick","disabled"])),[[me,x.permission||null]]):e.withDirectives((e.openBlock(),e.createBlock(ue,{key:3,link:"",type:"primary",icon:x.icon,onClick:v=>s(x,g),disabled:Y(g,x)},null,8,["icon","onClick","disabled"])),[[me,x.permission||null]])],64)):e.createCommentVNode("",!0)]),_:2},1032,["content"]))),128))]),_:1},8,["label","width"])):e.createCommentVNode("",!0)]),_:3},8,["data","row-key","element-loading-text","tree-props","default-sort","onSortChange","default-expand-all","max-height"])),[[Ul,e.unref(w)]]),r.dataSource.paging!==!1?(e.openBlock(),e.createBlock(Nl,{key:0,class:"paging",background:"",layout:e.unref(L),onSizeChange:e.unref(H),onCurrentChange:e.unref(j),"page-size":e.unref(I).pageSize,"current-page":e.unref(I).pageNum,"onUpdate:currentPage":O[1]||(O[1]=g=>e.unref(I).pageNum=g),total:e.unref(I).total,"page-sizes":e.unref(S)},null,8,["layout","onSizeChange","onCurrentChange","page-size","current-page","total","page-sizes"])):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-082d5d56"]]),Lt={class:"upload-file"},Pt={key:0,class:"el-upload__tip"},Ft={style:{color:"#f56c6c"}},Ot={style:{color:"#f56c6c"}},zt={class:"el-icon-document"},Mt={class:"ele-upload-list__item-content-action"},Rt=e.defineComponent({__name:"index",props:{modelValue:[String,Object,Array],limit:Q.number.def(5),fileSize:Q.number.def(5),fileType:Q.array.def(["doc","xls","ppt","txt","pdf"]),showTip:Q.bool.def(!0),showFileList:Q.bool.def(!0)},emits:["update:modelValue"],setup(t,{emit:o}){const a=t,{proxy:l}=e.getCurrentInstance(),c=o,r=e.ref(0),i=e.ref([]),m=pe(),f=e.ref(m+"/resource/oss/upload"),w=e.ref(de()),p=e.ref([]),I=e.computed(()=>a.showTip&&(a.fileType||a.fileSize)),S=e.ref();e.watch(()=>a.modelValue,async D=>{if(D){if(!a.showFileList)return;let $=1,z=[];Array.isArray(D)?z=D:z=(await ke(D)).data.map(d=>({name:d.originalName,url:d.url,ossId:d.ossId})),p.value=z.map(V=>(V={name:V.name,url:V.url,ossId:V.ossId},V.uid=V.uid||new Date().getTime()+$++,V))}else return p.value=[],[]},{deep:!0,immediate:!0});const L=D=>{if(a.fileType.length){const $=D.name.split("."),z=$[$.length-1];if(!(a.fileType.indexOf(z)>=0))return l==null||l.$modal.msgError(`文件格式不正確, 請上傳${a.fileType.join("/")}格式文件!`),!1}return a.fileSize&&!(D.size/1024/1024<a.fileSize)?(l==null||l.$modal.msgError(`上傳文件大小不超過 ${a.fileSize} MB!`),!1):(l==null||l.$modal.loading("正在上傳文件,請稍等..."),r.value++,!0)},N=()=>{l==null||l.$modal.msgError(`上傳文件數量不能超過 ${a.limit} 个!`)},P=()=>{l==null||l.$modal.msgError("上傳文件失敗")},j=(D,$)=>{var z;D.code===200?(i.value.push({name:D.data.fileName,url:D.data.url,ossId:D.data.ossId}),C()):(r.value--,l==null||l.$modal.closeLoading(),l==null||l.$modal.msgError(D.msg),(z=S.value)==null||z.handleRemove($),C())},H=D=>{const $=p.value[D].ossId;Le($),p.value.splice(D,1),c("update:modelValue",y(p.value))},C=()=>{r.value>0&&i.value.length===r.value&&(p.value=p.value.filter(D=>D.url!==void 0).concat(i.value),i.value=[],r.value=0,c("update:modelValue",y(p.value)),l==null||l.$modal.closeLoading())},E=D=>D.lastIndexOf("/")>-1?D.slice(D.lastIndexOf("/")+1):D,y=(D,$)=>{let z="";return $=$||",",D.forEach(V=>{V.ossId&&(z+=V.ossId+$)}),z!=""?z.substring(0,z.length-1):""};return(D,$)=>{const z=b.ElButton,V=b.ElUpload,d=b.ElLink;return e.openBlock(),e.createElementBlock("div",Lt,[e.createVNode(V,{multiple:"",action:e.unref(f),"before-upload":L,"file-list":e.unref(p),limit:t.limit,"on-error":P,"on-exceed":N,"on-success":j,"show-file-list":!1,headers:e.unref(w),class:"upload-file-uploader",ref_key:"fileUploadRef",ref:S},{default:e.withCtx(()=>[e.createVNode(z,{type:"primary"},{default:e.withCtx(()=>$[0]||($[0]=[e.createTextVNode("选取文件")])),_:1})]),_:1},8,["action","file-list","limit","headers"]),e.unref(I)?(e.openBlock(),e.createElementBlock("div",Pt,[$[3]||($[3]=e.createTextVNode(" 請上傳 ")),t.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[$[1]||($[1]=e.createTextVNode(" 大小不超過 ")),e.createElementVNode("b",Ft,e.toDisplayString(t.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),t.fileType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[$[2]||($[2]=e.createTextVNode(" 格式為 ")),e.createElementVNode("b",Ot,e.toDisplayString(t.fileType.join("/")),1)],64)):e.createCommentVNode("",!0),$[4]||($[4]=e.createTextVNode(" 的文件 "))])):e.createCommentVNode("",!0),t.showFileList?(e.openBlock(),e.createBlock(e.TransitionGroup,{key:1,class:"upload-file-list el-upload-list el-upload-list--text",name:"el-fade-in-linear",tag:"ul"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),(_,T)=>(e.openBlock(),e.createElementBlock("li",{key:_.uid,class:"el-upload-list__item ele-upload-list__item-content"},[e.createVNode(d,{href:`${_.url}`,underline:!1,target:"_blank"},{default:e.withCtx(()=>[e.createElementVNode("span",zt,e.toDisplayString(E(_.name)),1)]),_:2},1032,["href"]),e.createElementVNode("div",Mt,[e.createVNode(d,{underline:!1,onClick:F=>H(T),type:"danger"},{default:e.withCtx(()=>$[5]||($[5]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])])]))),128))]),_:1})):e.createCommentVNode("",!0)])}}}),Se=te(Rt,[["__scopeId","data-v-027e6121"]]),Yt={key:0,class:"el-upload__tip"},jt={style:{color:"#f56c6c"}},Ht={style:{color:"#f56c6c"}},qt={style:{color:"#f56c6c"}},Kt=["src"],Wt=e.defineComponent({__name:"index",props:{modelValue:{type:[String,Object,Array],default:()=>[]},limit:Q.number.def(5),fileSize:Q.number.def(5),fileType:Q.array.def(["png","jpg","jpeg"]),isShowTip:{type:Boolean,default:!0},imageSize:Q.string.def(""),compressSupport:{type:Boolean,default:!1},compressTargetSize:Q.number.def(300),height:Q.string.def("148px")},emits:["update:modelValue"],setup(t,{emit:o}){e.useCssVars(V=>({"9d14746a":a.height}));const a=t,{proxy:l}=e.getCurrentInstance(),c=o,r=e.ref(0),i=e.ref([]),m=e.ref(""),f=e.ref(!1),w=pe(),p=e.ref(w+"/resource/oss/upload"),I=e.ref(de()),S=e.ref([]),L=e.computed(()=>a.isShowTip&&(a.fileType||a.fileSize||a.imageSize)),N=e.ref(),P=e.computed(()=>a.fileType.map(V=>`.${V}`).join(","));e.watch(()=>a.modelValue,async V=>{if(V){let d=[];Array.isArray(V)?d=V:d=(await ke(V)).data,S.value=d.map(_=>{let T;return typeof _=="string"?T={name:_,url:_}:T={name:_.ossId,url:_.url,ossId:_.ossId},T})}else return S.value=[],[]},{deep:!0,immediate:!0});const j=V=>{let d=!1;if(a.fileType.length){let _="";V.name.lastIndexOf(".")>-1&&(_=V.name.slice(V.name.lastIndexOf(".")+1)),d=a.fileType.some(T=>!!(V.type.indexOf(T)>-1||_&&_.indexOf(T)>-1))}else d=V.type.indexOf("image")>-1;if(!d)return l==null||l.$modal.msgError(`文件格式不正確, 請上傳${a.fileType.join("/")}圖片格式文件!`),!1;if(V.name.includes(","))return l==null||l.$modal.msgError("文件名不正確,不能包含英文逗號!"),!1;if(a.fileSize&&!(V.size/1024/1024<a.fileSize))return l==null||l.$modal.msgError(`上傳圖片大小不能超過 ${a.fileSize} MB!`),!1;if(a.compressSupport&&V.size/1024>a.compressTargetSize)return l==null||l.$modal.loading("正在上傳圖片,請稍候..."),r.value++,st.compressAccurately(V,a.compressTargetSize);l==null||l.$modal.loading("正在上傳圖片,請稍候..."),r.value++},H=()=>{l==null||l.$modal.msgError(`上傳文件數量不能超過 ${a.limit} 個!`)},C=(V,d)=>{var _;V.code===200?(i.value.push({name:V.data.fileName,url:V.data.url,ossId:V.data.ossId}),y()):(r.value--,l==null||l.$modal.closeLoading(),l==null||l.$modal.msgError(V.msg),(_=N.value)==null||_.handleRemove(d),y())},E=V=>{const d=S.value.map(_=>_.name).indexOf(V.name);if(d>-1&&i.value.length===r.value){const _=S.value[d].ossId;return Le(_),S.value.splice(d,1),c("update:modelValue",z(S.value)),!1}return!0},y=()=>{r.value>0&&i.value.length===r.value&&(S.value=S.value.filter(V=>V.url!==void 0).concat(i.value),i.value=[],r.value=0,c("update:modelValue",z(S.value)),l==null||l.$modal.closeLoading())},D=()=>{l==null||l.$modal.msgError("上傳圖片失敗"),l==null||l.$modal.closeLoading()},$=V=>{m.value=V.url,f.value=!0},z=(V,d)=>{let _="";d=d||",";for(const T in V)V[T].ossId!==void 0&&V[T].url.indexOf("blob:")!==0&&(_+=V[T].ossId+d);return _!=""?_.substring(0,_.length-1):""};return(V,d)=>{const _=e.resolveComponent("plus"),T=b.ElIcon,F=b.ElUpload,Y=b.ElDialog;return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(F,{ref_key:"imageUploadRef",ref:N,multiple:"",action:e.unref(p),"list-type":"picture-card","on-success":C,"before-upload":j,limit:t.limit,accept:e.unref(P),"on-error":D,"on-exceed":H,"before-remove":E,"show-file-list":!0,headers:e.unref(I),"file-list":e.unref(S),"on-preview":$,class:e.normalizeClass({hide:e.unref(S).length>=t.limit})},{default:e.withCtx(()=>[e.createVNode(T,{class:"avatar-uploader-icon"},{default:e.withCtx(()=>[e.createVNode(_)]),_:1})]),_:1},8,["action","limit","accept","headers","file-list","class"]),e.unref(L)?(e.openBlock(),e.createElementBlock("div",Yt,[d[4]||(d[4]=e.createTextVNode(" 請上傳 ")),t.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d[1]||(d[1]=e.createTextVNode(" 大小不超過 ")),e.createElementVNode("b",jt,e.toDisplayString(t.fileSize)+"MB",1)],64)):e.createCommentVNode("",!0),t.fileType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.fileSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("、")],64)):e.createCommentVNode("",!0),d[2]||(d[2]=e.createTextVNode("格式為 ")),e.createElementVNode("b",Ht,e.toDisplayString(t.fileType.join("/")),1)],64)):e.createCommentVNode("",!0),t.imageSize?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[t.fileSize||t.fileType?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode("。")],64)):e.createCommentVNode("",!0),d[3]||(d[3]=e.createTextVNode("建議尺寸 ")),e.createElementVNode("b",qt,e.toDisplayString(t.imageSize),1)],64)):e.createCommentVNode("",!0),d[5]||(d[5]=e.createTextVNode(" 的文件 "))])):e.createCommentVNode("",!0),e.createVNode(Y,{modelValue:e.unref(f),"onUpdate:modelValue":d[0]||(d[0]=J=>e.isRef(f)?f.value=J:null),title:"預覽",width:"800px","append-to-body":""},{default:e.withCtx(()=>[e.createElementVNode("img",{src:e.unref(m),style:{display:"block","max-width":"100%",margin:"0 auto"}},null,8,Kt)]),_:1},8,["modelValue"])])}}}),_e=te(Wt,[["__scopeId","data-v-c17cf859"]]),Qt=t=>oe()({url:"/app/translation/getByName",method:"post",headers:{repeatSubmit:!1},data:{name:t}}),Gt=t=>oe()({url:"/app/translation/batchAdd",method:"post",data:t}),He=Te.defineStore("translation",()=>{const t=e.ref([]);return{translation:t,getTranslation:c=>{if(c==null&&c=="")return null;try{for(let r=0;r<t.value.length;r++)if(t.value[r].key==c)return t.value[r].value}catch{return null}return null},setTranslation:(c,r)=>{c!==null&&c!==""&&t.value.push({key:c,value:r})},clearTranslation:()=>{t.value=[]}}}),Jt=async t=>{const o=e.ref({}),a=He().getTranslation(t);if(a)o.value[t]=a;else{const{data:l}=await Qt(t);o.value[t]=l,He().setTranslation(t,l)}return o.value},Xt={style:{width:"100%"}},Zt={style:{"margin-bottom":"2px"}},De=e.defineComponent({__name:"index",props:["modelValue","placeholder","disabled","type","rows","showWordLimit","maxlength"],emits:["update:modelValue","focus"],setup(t,{expose:o,emit:a}){const l=a,c=t,r=e.ref([{name:"繁體",id:"zhHk",selected:!0,text:""},{name:"簡體",id:"zhCn",selected:!1,text:""},{name:"英文",id:"enUs",selected:!1,text:""}]),i=e.ref(!1),m=e.ref(!1),f=(N,P)=>{N.text=P,N.id=="zhHk"&&l("update:modelValue",P)},w=async N=>{N.id=="zhHk"&&await p()},p=async()=>{if(i.value)return;const N=r.value[0].text;if(N!=""){i.value=!0;const P=await Jt(N);if(i.value=!1,P[N]!=null){for(let j=0;j<r.value.length;j++)if(!r.value[j].text){const H=r.value[j];H.text=P[N][H.id]}}}},I=async N=>{r.value.map(P=>P.selected=!1),N.selected=!0},S=()=>{const N={name:r.value[0].text};return r.value.forEach(P=>N[P.id]=P.text),N},L=()=>l("focus");return e.watch(()=>c.modelValue,N=>{if(N){const P=r.value.filter(j=>j.selected)[0];P.text=N,m.value||p(),m.value=!0}},{immediate:!0,deep:!0}),o({getTranslate:S}),(N,P)=>{const j=b.ElButton,H=b.ElInput;return e.openBlock(),e.createElementBlock("div",Xt,[e.createElementVNode("div",Zt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),C=>(e.openBlock(),e.createBlock(j,{size:"small",key:C.id,type:C.selected?"primary":"default",onClick:E=>I(C),style:{"margin-right":"-8px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.name),1)]),_:2},1032,["type","onClick"]))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),C=>e.withDirectives((e.openBlock(),e.createBlock(H,{key:C.id,modelValue:C.text,"onUpdate:modelValue":E=>C.text=E,type:c.type,placeholder:c.placeholder+"("+C.name+")",disabled:c.disabled,rows:c.rows,"show-word-limit":c.showWordLimit,maxlength:c.maxlength,onInput:E=>f(C,E),onBlur:E=>w(C),onFocus:P[0]||(P[0]=E=>L())},null,8,["modelValue","onUpdate:modelValue","type","placeholder","disabled","rows","show-word-limit","maxlength","onInput","onBlur"])),[[e.vShow,C.selected]])),128))])}}}),vt={class:"editor"},Ee=e.defineComponent({__name:"index",props:{modelValue:Q.string,height:Q.number.def(400),minHeight:Q.number.def(400),readOnly:Q.bool.def(!1),fileSize:Q.number.def(5),type:Q.string.def("url")},emits:["update:modelValue"],setup(t){const o=t,{proxy:a}=e.getCurrentInstance(),l=e.reactive({headers:de(),url:pe()+"/resource/oss/upload"}),c=e.ref(),r=e.ref(),i=e.ref({theme:"snow",bounds:document.body,debug:"warn",modules:{toolbar:{container:[["bold","italic","underline","strike"],["blockquote","code-block"],[{list:"ordered"},{list:"bullet"}],[{indent:"-1"},{indent:"+1"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],["clean"],["link","image","video"]],handlers:{image:S=>{S?r.value.click():$e.Quill.format("image",!0)}}}},placeholder:"请输入内容",readOnly:o.readOnly}),m=e.computed(()=>{const S={};return o.minHeight&&(S.minHeight=`${o.minHeight}px`),o.height&&(S.height=`${o.height}px`),S}),f=e.ref("");e.watch(()=>o.modelValue,S=>{S!==f.value&&(f.value=S||"<p></p>")},{immediate:!0});const w=S=>{if(S.code===200){const L=e.toRaw(c.value).getQuill(),N=L.selection.savedRange.index;L.insertEmbed(N,"image",S.data.url),L.setSelection(N+1),a==null||a.$modal.closeLoading()}else a==null||a.$modal.msgError("图片插入失败"),a==null||a.$modal.closeLoading()},p=S=>["image/jpeg","image/jpg","image/png","image/svg"].includes(S.type)?o.fileSize&&!(S.size/1024/1024<o.fileSize)?(a==null||a.$modal.msgError(`上传文件大小不能超过 ${o.fileSize} MB!`),!1):(a==null||a.$modal.loading("正在上传文件,请稍候..."),!0):(a==null||a.$modal.msgError("图片格式错误!"),!1),I=S=>{a==null||a.$modal.msgError("上传文件失败")};return(S,L)=>{const N=b.ElUpload;return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",null,[t.type==="url"?(e.openBlock(),e.createBlock(N,{key:0,action:e.unref(l).url,"before-upload":p,"on-success":w,"on-error":I,class:"editor-img-uploader",name:"file","show-file-list":!1,headers:e.unref(l).headers},{default:e.withCtx(()=>[e.createElementVNode("i",{ref_key:"uploadRef",ref:r},null,512)]),_:1},8,["action","headers"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",vt,[e.createVNode(e.unref($e.QuillEditor),{ref_key:"quillEditorRef",ref:c,content:e.unref(f),"onUpdate:content":L[0]||(L[0]=P=>e.isRef(f)?f.value=P:null),"content-type":"html",options:e.unref(i),style:e.normalizeStyle(e.unref(m)),onTextChange:L[1]||(L[1]=P=>S.$emit("update:modelValue",e.unref(f)))},null,8,["content","options","style"])])],64)}}});function el(t,o){if(arguments.length===0||!t)return null;const a=o||"{y}-{m}-{d} {h}:{i}:{s}";let l;typeof t=="object"?l=t:(typeof t=="string"&&/^[0-9]+$/.test(t)?t=parseInt(t):typeof t=="string"&&(t=t.replace(new RegExp(/-/gm),"/").replace("T"," ").replace(new RegExp(/\.[\d]{3}/gm),"")),typeof t=="number"&&t.toString().length===10&&(t=t*1e3),l=new Date(t));const c={y:l.getFullYear(),m:l.getMonth()+1,d:l.getDate(),h:l.getHours(),i:l.getMinutes(),s:l.getSeconds(),a:l.getDay()};return a.replace(/{(y|m|d|h|i|s|a)+}/g,(r,i)=>{let m=c[i];return i==="a"?["日","一","二","三","四","五","六"][m]:(r.length>0&&m<10&&(m="0"+m),m||0)})}const tl=(t,o,a)=>{const l=t;return l.params=typeof l.params=="object"&&l.params!==null&&!Array.isArray(l.params)?l.params:{},o=Array.isArray(o)?o:[],o[0]&&o[0].length==10&&(o[0]=o[0]+" 00:00:00",o[1]=o[1]+" 23:59:59"),typeof a>"u"?(l.params.beginTime=o[0],l.params.endTime=o[1]):(a=a.charAt(0).toUpperCase()+a.slice(1),l.params["begin"+a]=o[0],l.params["end"+a]=o[1]),l},ll=(t,o)=>{if(o===void 0)return"";const a=[];return Object.keys(t).some(l=>{if(t[l].value==""+o)return a.push(t[l].label),!0}),a.length===0&&a.push(o),a.join("")},al=(t,o,a)=>{if(o===void 0||o.length===0)return"";Array.isArray(o)&&(o=o.join(","));const l=[],c=a===void 0?",":a,r=o.split(c);return Object.keys(o.split(c)).some(i=>{let m=!1;Object.keys(t).some(f=>{t[f].value==""+r[i]&&(l.push(t[f].label+c),m=!0)}),m||l.push(r[i]+c)}),l.join("").substring(0,l.join("").length-1)},ol=(t,o,a,l)=>{const c={id:o||"id",parentId:a||"parentId",childrenList:l||"children"},r={},i=[];for(const m of t){const f=m[c.id];r[f]=m,m[c.childrenList]||(m[c.childrenList]=[])}for(const m of t){const f=m[c.parentId],w=r[f];w?w[c.childrenList].push(m):i.push(m)}return i},rl=t=>{let o="";for(const a of Object.keys(t)){const l=t[a],c=encodeURIComponent(a)+"=";if(l!==null&&l!==""&&typeof l<"u")if(typeof l=="object"){for(const r of Object.keys(l))if(l[r]!==null&&l[r]!==""&&typeof l[r]<"u"){const i=a+"["+r+"]",m=encodeURIComponent(i)+"=";o+=m+encodeURIComponent(l[r])+"&"}}else o+=c+encodeURIComponent(l)+"&"}return o},nl=t=>t.type!=="application/json",qe=t=>{if(!t&&typeof t!="object")throw new Error("error arguments","deepClone");const o=t.constructor===Array?[]:{};return Object.keys(t).forEach(a=>{t[a]&&typeof t[a]=="object"?o[a]=qe(t[a]):o[a]=t[a]}),o};function cl(t,o){const{proxy:a}=e.getCurrentInstance(),l=e.ref({}),c=async f=>{const w=f.form;if(!w)return"";switch(w.type){case"checkboxGroup":case"checkboxDict":return[];case"treeSelectApi":if(w.api){const p=await w.api({pageNum:1,pageSize:1e3,...w.apiParams});if(w.data=p.rows||p.data,w.data&&Array.isArray(w.data)&&!Array.isArray(w.defaultExpandedKeys)&&w.autoExpandFirstLevel!==!1){const I=w.props||{value:"id"},S=w.valueKey||I.value||"id";w.defaultExpandedKeys=w.data.map(L=>L[S])}}return"";case"radioApi":case"selectApi":if(w.api){const p=await w.api({pageNum:1,pageSize:1e3,...w.apiParams});w.data=p.rows||p.data}return"";case"checkboxCommonDict":return w.data=await(a==null?void 0:a.useOneCommonDict(w.dictType)),[];case"radioCommonDict":case"selectCommonDict":return w.data=await(a==null?void 0:a.useOneCommonDict(w.dictType)),"";case"radioDict":case"selectDict":return w.data=await(a==null?void 0:a.useOneDict(w.dictType)),"";case"daterange":case"timerange":return[];default:return""}},r=async f=>{var S;let w={};const p=t.columns,I=f!==void 0?f:o;for(const L of p){const N=((S=L.form)==null?void 0:S.prop)||L.prop;w[N]=await c(L)}if(I&&typeof I=="object"){const L=qe(I);w={...w,...L}}t.initEditData&&t.initEditData(w),t.beforeInitEdit&&t.beforeInitEdit(w),i(w),l.value=w},i=f=>{t.columns.forEach(p=>{var L,N,P,j,H;const I=(L=p.form)==null?void 0:L.type,S=((N=p.form)==null?void 0:N.prop)||p.prop;switch(I){case"checkboxCommonDict":Array.isArray(f[S])&&(f[S]=f[S].map(y=>y[p.form.value]||y));break;case"selectDict":case"radioDict":case"switch":f[S]=f[S]||((P=p.form)==null?void 0:P.defaultValue);break;case"daterange":case"timerange":const C=(j=p.form)==null?void 0:j.rangeBeginProp,E=(H=p.form)==null?void 0:H.rangeEndProp;C&&E&&f[C]&&f[E]?f[S]=[f[C],f[E]]:typeof f[S]=="string"&&f[S].includes(",")?f[S]=f[S].split(","):(!f[S]||!Array.isArray(f[S]))&&(f[S]=f[S]||[]);break}})};return{formData:l,initFormData:r,prepareSaveData:async f=>{const w={...l.value,...f};if(t.columns.forEach(p=>{var L,N,P,j;const I=(L=p.form)==null?void 0:L.type,S=((N=p.form)==null?void 0:N.prop)||p.prop;if((I==="daterange"||I==="timerange")&&Array.isArray(w[S])){const H=w[S],C=(P=p.form)==null?void 0:P.rangeBeginProp,E=(j=p.form)==null?void 0:j.rangeEndProp;C&&E&&H.length>=2&&(w[C]=H[0],w[E]=H[1])}}),delete w.orderByColumn,delete w.isAsc,t.beforeSave){const p=await t.beforeSave(w);if(p===!1)return!1;p&&typeof p=="object"?Object.assign(f,p):Object.assign(f,w)}else Object.assign(f,w);return!0}}}const sl={key:20},il={class:"color-picker-tips"},Ke=te(e.defineComponent({__name:"curdEdit",props:{dataSource:{},editData:{},action:{},modelValue:{type:Boolean}},emits:["close","actionEvent"],setup(t,{emit:o}){const{t:a}=xe.useI18n(),{proxy:l}=e.getCurrentInstance(),c=t,r=e.ref(!1),i=e.ref(),m=o,f=e.ref(),w=e.ref(Pe),{formData:p,initFormData:I,prepareSaveData:S}=cl(c.dataSource,c.editData),L=e.computed(()=>{const D=!!c.editData[c.dataSource.rowKey],$=St(c.dataSource.columns,D,D);return ze($,"form.order")}),N=e.computed(()=>c.dataSource.formInline||!1),P=y=>{if(Array.isArray(y.defaultExpandedKeys))return y.defaultExpandedKeys;if(y.autoExpandFirstLevel===!1)return[];const D=y.data||[],$=y.props||{value:"id"},z=y.valueKey||$.value||"id";return Array.isArray(D)?D.map(V=>V[z]).filter(V=>V!==void 0):[]},j=()=>Ct(c.dataSource.columns),H=()=>{var y;(y=f.value)==null||y.validate(async D=>{var $,z,V,d,_;if(!D)return!1;try{const T={...c.dataSource.queryParams||{}};if(await S(T)===!1)return!1;c.editData[c.dataSource.rowKey]?await((z=($=c.dataSource).updateApi)==null?void 0:z.call($,T)):await((d=(V=c.dataSource).addApi)==null?void 0:d.call(V,T)),await C(),E(!0),l==null||l.$modal.msgSuccess(a("數據存儲成功")),(_=f.value)==null||_.resetFields()}catch(T){console.error("Save failed:",T)}return!1})},C=async()=>{const y=i.value;if(y!=null){const D=[];for(let $=0;$<y.length;$++){const z=y[$].getTranslate();D.push(z)}await Gt(D)}},E=(y=!1)=>{var D;(D=f.value)==null||D.resetFields(),m("close",y)};return e.watch(()=>c.modelValue,y=>{y&&(j(),I(c.editData)),r.value=y}),(y,D)=>{const $=b.ElInputNumber,z=b.ElOption,V=b.ElSelect,d=b.ElDatePicker,_=_e,T=Se,F=b.ElInput,Y=b.ElCheckbox,J=b.ElCheckboxGroup,k=b.ElSwitch,U=b.ElRadio,R=b.ElRadioGroup,A=b.ElTreeSelect,G=b.ElColorPicker,Z=b.ElFormItem,ee=b.ElCol,X=b.ElRow,le=b.ElForm,s=b.ElButton,u=b.ElDialog;return e.openBlock(),e.createBlock(u,{title:c.action.title||c.action.text,modelValue:e.unref(r),"onUpdate:modelValue":D[1]||(D[1]=n=>e.isRef(r)?r.value=n:null),onClose:E,"destroy-on-close":"","append-to-bod":"",width:c.action.width||(e.unref(N)?750:550),class:"curdEditDialog"},{footer:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(s,{onClick:D[0]||(D[0]=n=>E(!1))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.$t("關閉")),1)]),_:1}),e.createVNode(s,{type:"primary",onClick:H},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.$t("存儲")),1)]),_:1})])]),default:e.withCtx(()=>[e.createVNode(le,{model:e.unref(p),ref_key:"curdFormRef",ref:f,"label-width":c.action.labelWidth||c.dataSource.formLabelWidth||"auto","label-position":c.action.labelPosition||"right",class:"p-l-3 p-r-3"},{default:e.withCtx(()=>[e.createVNode(X,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(L),n=>(e.openBlock(),e.createBlock(ee,{span:n.form.inline===!1?24:e.unref(N)?12:24,key:n.prop,class:"el-p"},{default:e.withCtx(()=>[e.createVNode(Z,{prop:n.form.prop||n.prop,label:n.label,name:n.form.prop||n.prop,rules:n.form.rules,required:n.form.required},{default:e.withCtx(()=>[n.form.type==="number"?(e.openBlock(),e.createBlock($,{key:0,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,style:{width:"100%"},min:n.form.min,max:n.form.max,placeholder:y.$t("請輸入")},null,8,["modelValue","onUpdate:modelValue","min","max","placeholder"])):n.form.type==="select"?(e.openBlock(),e.createBlock(V,{key:1,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h[n.form.value]||h.value,label:h[n.form.label]||h.label,value:h[n.form.value]||h.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="selectDict"?(e.openBlock(),e.createBlock(V,{key:2,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h[n.form.value]||h.value,label:h[n.form.label]||h.label,value:h[n.form.value]||h.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="selectCommonDict"?(e.openBlock(),e.createBlock(V,{key:3,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h.value,label:h.label,value:h.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="selectApi"?(e.openBlock(),e.createBlock(V,{key:4,multiple:n.form.multiple,style:{width:"100%"},modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,placeholder:y.$t("請選擇"),filterable:n.form.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(z,{key:h[n.form.value],label:h[n.form.label],value:h[n.form.value]},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder","filterable"])):n.form.type==="date"?(e.openBlock(),e.createBlock(d,{key:5,format:"YYYY-MM-DD","value-format":"YYYY-MM-DD",modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"date",placeholder:y.$t("請選擇日期"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):n.form.type==="datetime"?(e.openBlock(),e.createBlock(d,{key:6,format:"YYYY-MM-DD HH:mm:ss","value-format":"YYYY-MM-DD HH:mm:ss",modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"datetime",placeholder:y.$t("請選擇日期時間"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):n.form.type==="daterange"?(e.openBlock(),e.createBlock(d,{key:7,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"daterange",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD","range-separator":y.$t("至"),"start-placeholder":y.$t("開始日期"),"end-placeholder":y.$t("結束日期"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):n.form.type==="timerange"?(e.openBlock(),e.createBlock(d,{key:8,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"datetimerange",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm:ss","range-separator":y.$t("至"),"start-placeholder":y.$t("開始時間"),"end-placeholder":y.$t("結束時間"),style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):n.form.type==="image"?(e.openBlock(),e.createBlock(_,{key:9,limit:n.form.limit||1,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},null,8,["limit","modelValue","onUpdate:modelValue"])):n.form.type==="file"?(e.openBlock(),e.createBlock(T,{key:10,limit:n.form.limit||1,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,fileType:n.form.fileType,fileSize:n.form.fileSize},null,8,["limit","modelValue","onUpdate:modelValue","fileType","fileSize"])):n.form.type==="password"?(e.openBlock(),e.createBlock(F,{key:11,"auto-complete":"new-password",modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,type:"password",placeholder:y.$t("請輸入")},null,8,["modelValue","onUpdate:modelValue","placeholder"])):n.form.type==="checkboxGroup"?(e.openBlock(),e.createBlock(J,{key:12,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.list,h=>(e.openBlock(),e.createBlock(Y,{key:h[n.form.value],label:h[n.form.label],value:h[n.form.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="checkboxCommonDict"?(e.openBlock(),e.createBlock(J,{key:13,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(Y,{label:h.value,key:h.value,value:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="switch"?(e.openBlock(),e.createBlock(k,{key:14,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,"active-value":n.form.activeValue||"0","inactive-value":n.form.inactiveValue||"1"},null,8,["modelValue","onUpdate:modelValue","active-value","inactive-value"])):n.form.type==="radioDict"?(e.openBlock(),e.createBlock(R,{key:15,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(U,{key:h.value,value:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="treeSelectApi"?(e.openBlock(),e.createBlock(A,{key:16,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,data:n.form.data,props:n.form.props,"value-key":n.form.valueKey,"default-expanded-keys":P(n.form),filterable:n.form.filterable??!0,placeholder:y.$t("請選擇"),"check-strictly":""},null,8,["modelValue","onUpdate:modelValue","data","props","value-key","default-expanded-keys","filterable","placeholder"])):n.form.type==="radioCommonDict"?(e.openBlock(),e.createBlock(R,{key:17,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.form.data,h=>(e.openBlock(),e.createBlock(U,{key:h.value,label:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="radioLocalDict"?(e.openBlock(),e.createBlock(R,{key:18,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w)[n.form.dictType],h=>(e.openBlock(),e.createBlock(U,{key:h.value,label:h.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.label),1)]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):n.form.type==="checkbox"?(e.openBlock(),e.createBlock(Y,{key:19,label:n.label,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},null,8,["label","modelValue","onUpdate:modelValue"])):n.form.type==="color"?(e.openBlock(),e.createElementBlock("div",sl,[e.createVNode(G,{modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h},null,8,["modelValue","onUpdate:modelValue"]),e.createElementVNode("span",il,e.toDisplayString(y.$t("需点击选择器中的确定按钮")),1)])):n.form.type==="inputNumber"?(e.openBlock(),e.createBlock($,{key:21,min:n.form.min||0,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,step:1},null,8,["min","modelValue","onUpdate:modelValue"])):n.form.type==="richtext"?(e.openBlock(),e.createBlock(Ee,{key:22,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,height:n.form.max||320,"min-height":n.form.min||220},null,8,["modelValue","onUpdate:modelValue","height","min-height"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:23},[n.form.translate===!0?(e.openBlock(),e.createBlock(De,{ref_for:!0,ref_key:"translateInputRef",ref:i,key:e.unref(p)[y.dataSource.rowKey],modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,disabled:n.form.disabled||!1,type:n.form.type,placeholder:y.$t("請輸入"),rows:n.form.rows||3,"show-word-limit":n.form.showWordLimit||!1,maxlength:n.form.limit||-1},null,8,["modelValue","onUpdate:modelValue","disabled","type","placeholder","rows","show-word-limit","maxlength"])):(e.openBlock(),e.createBlock(F,{key:1,modelValue:e.unref(p)[n.form.prop||n.prop],"onUpdate:modelValue":h=>e.unref(p)[n.form.prop||n.prop]=h,disabled:n.form.disabled||!1,type:n.form.type,placeholder:y.$t("請輸入"),rows:n.form.rows||3,"show-word-limit":n.form.showWordLimit||!1,maxlength:n.form.limit||-1},e.createSlots({_:2},[n.form.suffix?{name:"suffix",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.form.suffix),1)]),key:"0"}:void 0,n.form.prefix?{name:"prefix",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.form.prefix),1)]),key:"1"}:void 0]),1032,["modelValue","onUpdate:modelValue","disabled","type","placeholder","rows","show-word-limit","maxlength"]))],64))]),_:2},1032,["prop","label","name","rules","required"])]),_:2},1032,["span"]))),128))]),_:1})]),_:1},8,["model","label-width","label-position"])]),_:1},8,["title","modelValue","width"])}}}),[["__scopeId","data-v-03727126"]]),dl={key:1,class:"curd-search-card",style:{"margin-bottom":"0px !important"}},pl={key:2,class:"curd-search-card"},fl=te(e.defineComponent({__name:"curdSearch",props:{dataSource:{},selectedCount:{default:0}},emits:["actionEvent"],setup(t,{expose:o,emit:a}){const{t:l}=xe.useI18n(),{proxy:c}=e.getCurrentInstance(),r=a,i=t,m=e.computed(()=>{const d=i.dataSource.actions;return d==null?[]:d.filter(T=>T.position==="top"||T.action==="create"||T.action==="back").map(T=>{const F={...T};return F.action==="create"?(F.cssType="primary",F.icon="Plus"):F.action==="back"&&(F.icon="ArrowLeft"),F})}),f=e.computed(()=>m.value.find(d=>d.action==="create")??null),w=e.computed(()=>{var d;return((d=i.dataSource.actions)==null?void 0:d.find(_=>_.action==="delete"))??null}),p=e.computed(()=>m.value.filter(d=>d.action!=="create")),I=d=>{r("actionEvent",d)},S=e.computed(()=>i.dataSource.searchColumnsPerRow??4),L=e.computed(()=>Math.floor(24/S.value)),N=e.computed(()=>i.dataSource.showSearchCard??!0),P=e.computed(()=>{if(i.dataSource.searchActionColSpan!=null)return i.dataSource.searchActionColSpan;const d=E.value.length%S.value,T=24-(d===0?S.value:d)*L.value;return T<=0?24:T}),j=e.computed(()=>E.value.length%S.value===0?"15px !important":"0px !important"),{initSearchDicts:H}=Me(),C=e.ref({}),E=e.ref([]),y=()=>{r("actionEvent",{action:"filter"})},D=async()=>{try{let d=$();if(d={...i.dataSource.queryParams||{},...d},i.dataSource.beforeExport&&await i.dataSource.beforeExport(d)===!1)return;const _=it().format("YYYYMMDDHHmmss");let T=i.dataSource.exportFileName?`${i.dataSource.exportFileName}`:"export";T+=`_${_}.xlsx`,c==null||c.download(i.dataSource.exportUrl,d,T)}catch(d){console.error("Export failed:",d),c==null||c.$modal.msgError(l("導出失敗"))}},$=()=>{const d={...C.value};return E.value.forEach(_=>{var T,F;if(((T=_.search)==null?void 0:T.type)==="daterange"||((F=_.search)==null?void 0:F.type)==="timerange"){const Y=d[_.search.prop];Y&&Y[0]&&Y[1]&&Et(d,Y,_.search.prop,c),delete d[_.search.prop]}}),Ve(d)},z=async()=>{await V(),r("actionEvent",{action:"filter"},{})},V=async()=>{const d=i.dataSource.columns.filter(T=>T.search&&fe(T.search.permission??T.permission));E.value=ze(d.map((T,F)=>(T.search.order||(T.search.order=F+100),T)),"search.order"),await e.nextTick();const _={};for(let T=0;T<d.length;T++){const F=d[T];if(!F.search)continue;const Y=F.search.prop||"",J=F.search.type||"";J==="daterange"||J==="timerange"?_[Y]=F.search.default?F.search.default.split(","):[]:((J==="selectApi"||J==="treeSelectApi"||J==="selectDict")&&await H(F),_[Y]=F.search.default)}C.value=_};return e.onMounted(()=>V()),o({initData:V,getQueryParams:$}),(d,_)=>{var le;const T=b.ElDatePicker,F=b.ElOption,Y=b.ElSelect,J=b.ElTreeSelect,k=b.ElInput,U=b.ElFormItem,R=b.ElCol,A=b.ElButton,G=b.ElRow,Z=b.ElForm,ee=b.ElCard,X=e.resolveDirective("hasPermi");return e.unref(E).length>0&&e.unref(N)?(e.openBlock(),e.createBlock(ee,{key:0,class:"curd-search-card",shadow:"hover",style:{"margin-bottom":"12px !important"},"body-style":{paddingTop:"18px !important",paddingBottom:e.unref(j)}},{default:e.withCtx(()=>[e.createVNode(Z,{model:e.unref(C),inline:!0,"label-width":i.dataSource.searchLabelWidth||68},{default:e.withCtx(()=>[e.createVNode(G,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),s=>(e.openBlock(),e.createBlock(R,{span:e.unref(L),key:s.search.prop},{default:e.withCtx(()=>[e.createVNode(U,{label:s.label,name:s.search.prop,style:{width:"100%"},"label-width":s.search.labelWidth},{default:e.withCtx(()=>[s.search.type==="daterange"?(e.openBlock(),e.createBlock(T,{key:0,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"daterange",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD","range-separator":d.$t("至"),"start-placeholder":d.$t("開始日期"),"end-placeholder":d.$t("結束日期"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="timerange"?(e.openBlock(),e.createBlock(T,{key:1,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"datetimerange",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm:ss","range-separator":d.$t("至"),"start-placeholder":d.$t("開始時間"),"end-placeholder":d.$t("結束時間"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="selectApi"?(e.openBlock(),e.createBlock(Y,{key:2,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectData"?(e.openBlock(),e.createBlock(Y,{key:3,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectDict"?(e.openBlock(),e.createBlock(Y,{key:4,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectCommonDict"?(e.openBlock(),e.createBlock(Y,{key:5,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="treeSelectApi"?(e.openBlock(),e.createBlock(J,{key:6,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,data:s.search.data,props:s.search.props,"value-key":s.search.valueKey,"default-expanded-keys":s.search.defaultExpandedKeys,placeholder:d.$t("請選擇"),style:{width:"100%"},"check-strictly":"",clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","data","props","value-key","default-expanded-keys","placeholder"])):s.search.type==="number"?(e.openBlock(),e.createBlock(k,{key:7,type:"number",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請輸入"),style:{width:"100%"},clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(e.openBlock(),e.createBlock(k,{key:8,type:"text",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,style:{width:"100%"},placeholder:d.$t("請輸入"),onKeyup:e.withKeys(y,["enter"]),clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))]),_:2},1032,["label","name","label-width"])]),_:2},1032,["span"]))),128)),e.createVNode(R,{span:e.unref(P)},{default:e.withCtx(()=>{var s;return[e.createVNode(A,{onClick:y,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("查詢")),1)]),_:1}),e.createVNode(A,{onClick:z,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("清空")),1)]),_:1}),e.unref(f)?e.withDirectives((e.openBlock(),e.createBlock(A,{key:0,type:e.unref(f).cssType,icon:e.unref(f).icon,plain:"",onClick:_[0]||(_[0]=u=>I(e.unref(f)))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(e.unref(f).text||"新增")),1)]),_:1},8,["type","icon"])),[[X,e.unref(f).permission||null]]):e.createCommentVNode("",!0),i.dataSource.showBatchDeleteButton?e.withDirectives((e.openBlock(),e.createBlock(A,{key:1,type:"danger",icon:"Delete",plain:"",disabled:d.selectedCount===0,onClick:_[1]||(_[1]=u=>r("actionEvent",{action:"batchDelete"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("批量刪除")),1)]),_:1},8,["disabled"])),[[X,((s=e.unref(w))==null?void 0:s.permission)||null]]):e.createCommentVNode("",!0),i.dataSource.exportUrl?(e.openBlock(),e.createBlock(A,{key:2,type:"primary",icon:"Download",plain:"",onClick:D},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.dataSource.exportButtonName||d.$t("導出")),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),u=>e.withDirectives((e.openBlock(),e.createBlock(A,{key:u.text,onClick:n=>I(u),type:u.cssType,icon:u.icon,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(u.text)),1)]),_:2},1032,["onClick","type","icon"])),[[X,u.permission||null]])),128))]}),_:1},8,["span"])]),_:1})]),_:1},8,["model","label-width"])]),_:1},8,["body-style"])):e.unref(E).length>0&&!e.unref(N)?(e.openBlock(),e.createElementBlock("div",dl,[e.createVNode(Z,{model:e.unref(C),inline:!0,"label-width":i.dataSource.searchLabelWidth||68},{default:e.withCtx(()=>[e.createVNode(G,{gutter:20},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),s=>(e.openBlock(),e.createBlock(R,{span:e.unref(L),key:s.search.prop},{default:e.withCtx(()=>[e.createVNode(U,{label:s.label,name:s.search.prop,style:{width:"100%"},"label-width":s.search.labelWidth},{default:e.withCtx(()=>[s.search.type==="daterange"?(e.openBlock(),e.createBlock(T,{key:0,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"daterange",format:"YYYY-MM-DD","value-format":"YYYY-MM-DD","range-separator":d.$t("至"),"start-placeholder":d.$t("開始日期"),"end-placeholder":d.$t("結束日期"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="timerange"?(e.openBlock(),e.createBlock(T,{key:1,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,type:"datetimerange",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm:ss","range-separator":d.$t("至"),"start-placeholder":d.$t("開始時間"),"end-placeholder":d.$t("結束時間"),style:{width:"100%"},clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","range-separator","start-placeholder","end-placeholder"])):s.search.type==="selectApi"?(e.openBlock(),e.createBlock(Y,{key:2,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectData"?(e.openBlock(),e.createBlock(Y,{key:3,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data,u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value],label:u[s.search.label],value:u[s.search.value]},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectDict"?(e.openBlock(),e.createBlock(Y,{key:4,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="selectCommonDict"?(e.openBlock(),e.createBlock(Y,{key:5,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請選擇"),style:{width:"100%"},clearable:"",onChange:y,filterable:s.search.filterable??!0},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.search.data||[],u=>(e.openBlock(),e.createBlock(F,{key:u[s.search.value]||u.value,label:u[s.search.label]||u.label,value:u[s.search.value]||u.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","filterable"])):s.search.type==="treeSelectApi"?(e.openBlock(),e.createBlock(J,{key:6,modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,data:s.search.data,props:s.search.props,"value-key":s.search.valueKey,"default-expanded-keys":s.search.defaultExpandedKeys,placeholder:d.$t("請選擇"),style:{width:"100%"},"check-strictly":"",clearable:"",onChange:y},null,8,["modelValue","onUpdate:modelValue","data","props","value-key","default-expanded-keys","placeholder"])):s.search.type==="number"?(e.openBlock(),e.createBlock(k,{key:7,type:"number",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,placeholder:d.$t("請輸入"),style:{width:"100%"},clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(e.openBlock(),e.createBlock(k,{key:8,type:"text",modelValue:e.unref(C)[s.search.prop],"onUpdate:modelValue":u=>e.unref(C)[s.search.prop]=u,style:{width:"100%"},placeholder:d.$t("請輸入"),onKeyup:e.withKeys(y,["enter"]),clearable:""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))]),_:2},1032,["label","name","label-width"])]),_:2},1032,["span"]))),128)),e.createVNode(R,{span:e.unref(P)},{default:e.withCtx(()=>{var s;return[e.createVNode(A,{onClick:y,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("查詢")),1)]),_:1}),e.createVNode(A,{onClick:z,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("清空")),1)]),_:1}),e.unref(f)?e.withDirectives((e.openBlock(),e.createBlock(A,{key:0,type:e.unref(f).cssType,icon:e.unref(f).icon,plain:"",onClick:_[2]||(_[2]=u=>I(e.unref(f)))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(e.unref(f).text||"新增")),1)]),_:1},8,["type","icon"])),[[X,e.unref(f).permission||null]]):e.createCommentVNode("",!0),i.dataSource.showBatchDeleteButton?e.withDirectives((e.openBlock(),e.createBlock(A,{key:1,type:"danger",icon:"Delete",plain:"",disabled:d.selectedCount===0,onClick:_[3]||(_[3]=u=>r("actionEvent",{action:"batchDelete"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("批量刪除")),1)]),_:1},8,["disabled"])),[[X,((s=e.unref(w))==null?void 0:s.permission)||null]]):e.createCommentVNode("",!0),i.dataSource.exportUrl?(e.openBlock(),e.createBlock(A,{key:2,type:"primary",icon:"Download",plain:"",onClick:D},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("導出")),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),u=>e.withDirectives((e.openBlock(),e.createBlock(A,{key:u.text,onClick:n=>I(u),type:u.cssType,icon:u.icon,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(u.text)),1)]),_:2},1032,["onClick","type","icon"])),[[X,u.permission||null]])),128))]}),_:1},8,["span"])]),_:1})]),_:1},8,["model","label-width"])])):e.unref(m).length>0?(e.openBlock(),e.createElementBlock("div",pl,[e.unref(f)?e.withDirectives((e.openBlock(),e.createBlock(A,{key:0,type:e.unref(f).cssType,icon:e.unref(f).icon,plain:"",onClick:_[4]||(_[4]=s=>I(e.unref(f)))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(f).text||d.$t("新增")),1)]),_:1},8,["type","icon"])),[[X,e.unref(f).permission||null]]):e.createCommentVNode("",!0),i.dataSource.showBatchDeleteButton?e.withDirectives((e.openBlock(),e.createBlock(A,{key:1,type:"danger",icon:"Delete",plain:"",disabled:d.selectedCount===0,onClick:_[5]||(_[5]=s=>r("actionEvent",{action:"batchDelete"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t("批量刪除")),1)]),_:1},8,["disabled"])),[[X,((le=e.unref(w))==null?void 0:le.permission)||null]]):e.createCommentVNode("",!0),i.dataSource.exportUrl?(e.openBlock(),e.createBlock(A,{key:2,type:"primary",icon:"Download",plain:"",onClick:D},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.dataSource.exportButtonName||d.$t("導出")),1)]),_:1})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p),s=>e.withDirectives((e.openBlock(),e.createBlock(A,{key:s.text,onClick:u=>I(s),type:s.cssType,icon:s.icon,plain:""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.$t(s.text)),1)]),_:2},1032,["onClick","type","icon"])),[[X,s.permission||null]])),128))])):e.createCommentVNode("",!0)}}}),[["__scopeId","data-v-fbfbd6fe"]]),We={查詢:"查询",清空:"清空",新增:"新增",批量刪除:"批量删除",刪除:"删除",刪除成功:"删除成功",編輯:"编辑",導出:"导出",請選擇:"请选择",請輸入:"请输入",至:"至",開始日期:"开始日期",結束日期:"结束日期",開始時間:"开始时间",結束時間:"结束时间",操作:"操作",未查詢到數據:"未查询到数据","數據加載中...":"数据加载中...",關閉:"关闭",存儲:"存储",請選擇日期:"请选择日期",請選擇日期時間:"请选择日期时间",需点击选择器中的确定按钮:"需点击选择器中的确定按钮","確認刪除此數據嗎?":"确认删除此数据吗?","確認刪除選中的 {count} 條數據嗎?":"确认删除选中的 {count} 条数据吗?",請先勾選要刪除的數據:"请先勾选要删除的数据",數據存儲成功:"数据存储成功",導出失敗:"导出失败"},Qe={查詢:"查詢",清空:"清空",新增:"新增",批量刪除:"批量刪除",刪除:"刪除",刪除成功:"刪除成功",編輯:"編輯",導出:"導出",請選擇:"請選擇",請輸入:"請輸入",至:"至",開始日期:"開始日期",結束日期:"結束日期",開始時間:"開始時間",結束時間:"結束時間",操作:"操作",未查詢到數據:"未查詢到數據","數據加載中...":"數據加載中...",關閉:"關閉",存儲:"存儲",請選擇日期:"請選擇日期",請選擇日期時間:"請選擇日期時間",需点击选择器中的确定按钮:"需點擊選擇器中的確定按鈕","確認刪除此數據嗎?":"確認刪除此數據嗎?","確認刪除選中的 {count} 條數據嗎?":"確認刪除選中的 {count} 條數據嗎?",請先勾選要刪除的數據:"請先勾選要刪除的數據",數據存儲成功:"數據存儲成功",導出失敗:"導出失敗"},Ge={查詢:"Search",清空:"Clear",新增:"Add",批量刪除:"Batch Delete",刪除:"Delete",刪除成功:"Deleted successfully",編輯:"Edit",導出:"Export",請選擇:"Select ",請輸入:"Enter ",至:"to",開始日期:"Start Date",結束日期:"End Date",開始時間:"Start Time",結束時間:"End Time",操作:"Action",未查詢到數據:"No data found","數據加載中...":"Loading...",關閉:"Close",存儲:"Save",請選擇日期:"Select date",請選擇日期時間:"Select datetime",需点击选择器中的确定按钮:"Click the confirm button in the picker","確認刪除此數據嗎?":"Are you sure to delete this record?","確認刪除選中的 {count} 條數據嗎?":"Are you sure to delete the selected {count} records?",請先勾選要刪除的數據:"Please select records to delete first",數據存儲成功:"Data saved successfully",導出失敗:"Export failed"};let Je=!1;const ul={zh_CN:We,zh_HK:Qe,en_US:Ge};function ml(){if(!Je)try{const t=e.getCurrentInstance();if(!t)return;const a=t.appContext.app.config.globalProperties.$i18n;if(a){const l=a.global||a;for(const[c,r]of Object.entries(ul))if(l&&typeof l.mergeLocaleMessage=="function"&&l.mergeLocaleMessage(c,r),l&&l.messages){const i=l.messages[c]||{};l.messages[c]={...r,...i}}Je=!0}}catch{}}const hl={key:1},Xe=e.defineComponent({__name:"index",props:{dataSource:{},showCard:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},showPadding:{type:Boolean,default:!0},maxHeight:{}},emits:["actionEvent","beforeQuery"],setup(t,{expose:o,emit:a}){const{proxy:l}=e.getCurrentInstance(),c=a,r=t,i=e.computed(()=>r.dataSource.maxHeight!=null?void 0:r.maxHeight),m=e.ref(!1),f=e.ref({}),w=e.ref({}),p=e.ref(),I=e.ref(),S=e.ref(0),L=e.computed(()=>{const k=(r.dataSource.columns||[]).map(U=>U.slot).filter(U=>!!U);return Array.from(new Set(k))}),N=k=>{S.value=Array.isArray(k)?k.length:0},P=(k=!1)=>{m.value=!1,f.value={},k===!0&&j()},j=()=>{var k;return(k=p.value)==null?void 0:k.refreshTable()},H=async()=>{var k;return await((k=p.value)==null?void 0:k.initData())},C=()=>{var k;return(k=I.value)==null?void 0:k.initData()},E=async(k,U)=>{let R=U;r.dataSource.beforeAction&&(R=await r.dataSource.beforeAction(k,U)),y(k,R)},y=(k,U)=>{if(typeof k.action=="function"){k.action(U);return}const A={update:()=>D(k,U),delete:()=>$(k,U),batchDelete:()=>z(),create:()=>V(k,U),view:()=>_(k,U),filter:()=>T(),back:()=>J()}[k.action];A?A():c("actionEvent",k,U)},D=async(k,U)=>{r.dataSource.beforeUpdate&&await r.dataSource.beforeUpdate(U)===!1||(f.value=U,w.value=k,m.value=!0)},$=async(k,U)=>{var R,A,G;try{if(r.dataSource.beforeDelete&&await r.dataSource.beforeDelete(U)===!1)return;const Z=U[r.dataSource.rowKey];if(!Z){l==null||l.$modal.msgError(l==null?void 0:l.$t("rowKey参数不正确"));return}const ee=k.confirm||k.confirmText||(l==null?void 0:l.$t("確認刪除此數據嗎?"));await(l==null?void 0:l.$modal.confirm(ee)),await((A=(R=r.dataSource).deleteApi)==null?void 0:A.call(R,Z)),l==null||l.$modal.msgSuccess(l==null?void 0:l.$t("刪除成功")),(G=p.value)==null||G.refreshTable()}catch(Z){Z!=="cancel"&&console.error("Delete failed:",Z)}},z=async()=>{var R,A,G,Z,ee;if(!r.dataSource.deleteApi){l==null||l.$modal.msgError(l==null?void 0:l.$t("deleteApi 方法未設置"));return}const k=((A=(R=p.value)==null?void 0:R.getSelection)==null?void 0:A.call(R))??[];if(!k.length){l==null||l.$modal.msgWarning(l==null?void 0:l.$t("請先勾選要刪除的數據"));return}await(l==null?void 0:l.$modal.confirm(l==null?void 0:l.$t("確認刪除選中的 {count} 條數據嗎?",{count:k.length})));const U=[];for(const X of k){if(r.dataSource.beforeDelete&&await r.dataSource.beforeDelete(X)===!1)continue;const le=X[r.dataSource.rowKey];le!=null&&U.push(le)}U.length&&(await((Z=(G=r.dataSource).deleteApi)==null?void 0:Z.call(G,U)),l==null||l.$modal.msgSuccess(l==null?void 0:l.$t("刪除成功")),(ee=p.value)==null||ee.refreshTable())},V=async(k,U)=>{r.dataSource.beforeCreate&&await r.dataSource.beforeCreate(U||{})===!1||(f.value=U||{},w.value=k,m.value=!0)},d=async(k={})=>{const U=k&&(Object.prototype.hasOwnProperty.call(k,"data")||Object.prototype.hasOwnProperty.call(k,"title")||Object.prototype.hasOwnProperty.call(k,"text")||Object.prototype.hasOwnProperty.call(k,"width")||Object.prototype.hasOwnProperty.call(k,"labelWidth")||Object.prototype.hasOwnProperty.call(k,"labelPosition")),R=U?k.data||{}:k||{},A={action:"create",...U?{title:k.title,text:k.text,width:k.width,labelWidth:k.labelWidth,labelPosition:k.labelPosition}:{}};await V(A,R)},_=(k,U)=>{let R=k.url;const A=k.pm;if(A&&U[A]){const G=R.includes("?")?"&":"?";R+=`${G}${A}=${U[A]}`}l==null||l.$router.push(R)},T=()=>{var U,R;const k=(U=I.value)==null?void 0:U.getQueryParams();(R=p.value)==null||R.refreshTable(k||{})},F=()=>{var k;return(k=I.value)==null?void 0:k.getQueryParams()},Y=()=>{var k;return(k=p.value)==null?void 0:k.getSelection()},J=()=>l==null?void 0:l.$router.back();return e.onMounted(()=>{ml(),Vt(r.dataSource.columns)}),o({refreshTable:j,initSearch:C,initTable:H,openCreate:d,getQueryParams:F,getSelection:Y}),(k,U)=>{const R=b.ElCard;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass({"p-3":k.showPadding})},[e.createVNode(fl,{dataSource:r.dataSource,selectedCount:e.unref(S),ref_key:"curdSearchRef",ref:I,onActionEvent:E},null,8,["dataSource","selectedCount"]),k.showCard?(e.openBlock(),e.createBlock(R,{key:0,"body-style":{paddingBottom:r.dataSource.paging===!1?"20px":"0px"},shadow:"hover"},{default:e.withCtx(()=>[e.createVNode(je,{ref_key:"curdTableRef",ref:p,onActionEvent:E,onSelectionChange:N,dataSource:r.dataSource,maxHeight:e.unref(i)},e.createSlots({_:2},[e.renderList(e.unref(L),A=>({name:A,fn:e.withCtx(G=>[e.renderSlot(k.$slots,A,e.normalizeProps(e.guardReactiveProps(G)))])}))]),1032,["dataSource","maxHeight"]),e.createVNode(Ke,{onClose:P,modelValue:e.unref(m),"onUpdate:modelValue":U[0]||(U[0]=A=>e.isRef(m)?m.value=A:null),dataSource:r.dataSource,action:e.unref(w),editData:e.unref(f)},null,8,["modelValue","dataSource","action","editData"])]),_:3},8,["body-style"])):(e.openBlock(),e.createElementBlock("div",hl,[e.createVNode(je,{ref_key:"curdTableRef",ref:p,onActionEvent:E,onSelectionChange:N,dataSource:r.dataSource,maxHeight:e.unref(i)},e.createSlots({_:2},[e.renderList(e.unref(L),A=>({name:A,fn:e.withCtx(G=>[e.renderSlot(k.$slots,A,e.normalizeProps(e.guardReactiveProps(G)))])}))]),1032,["dataSource","maxHeight"]),e.createVNode(Ke,{onClose:P,modelValue:e.unref(m),"onUpdate:modelValue":U[1]||(U[1]=A=>e.isRef(m)?m.value=A:null),dataSource:r.dataSource,action:e.unref(w),editData:e.unref(f)},null,8,["modelValue","dataSource","action","editData"])]))],2)}}}),Ze={401:"认证失败,无法访问系统资源",403:"当前操作没有权限",404:"访问资源不存在",default:"系统未知错误,请反馈给管理员"};function ve(t,o,a){const l=b.ElLoading.service({text:"正在下載數據,請稍後",background:"rgba(0, 0, 0, 0.7)"});return oe().post(t,o,{transformRequest:[c=>rl(c)],headers:{"Content-Type":"application/x-www-form-urlencoded"},responseType:"blob"}).then(async c=>{if(nl(c)){const i=new Blob([c]);dt.saveAs(i,a)}else{const i=await new Blob([c]).text(),m=JSON.parse(i),f=Ze[m.code]||m.msg||Ze.default;b.ElMessage.error(f)}l.close()}).catch(c=>{console.error(c),b.ElMessage.error("下载文件出现错误,请联系管理员!"),l.close()})}let et;const gl={msg(t){b.ElMessage.info(t)},msgError(t){b.ElMessage.error(t)},msgSuccess(t){b.ElMessage.success(t)},msgWarning(t){b.ElMessage.warning(t)},alert(t){b.ElMessageBox.alert(t,"系統提示")},alertError(t){b.ElMessageBox.alert(t,"系統提示",{type:"error"})},alertSuccess(t){b.ElMessageBox.alert(t,"系統提示",{type:"success"})},alertWarning(t){b.ElMessageBox.alert(t,"系統提示",{type:"warning"})},notify(t){b.ElNotification.info(t)},notifyError(t){b.ElNotification.error(t)},notifySuccess(t){b.ElNotification.success(t)},notifyWarning(t){b.ElNotification.warning(t)},confirm(t){return b.ElMessageBox.confirm(t,"系統提示",{confirmButtonText:"確認",cancelButtonText:"取消",type:"warning"})},prompt(t,o,a=""){return b.ElMessageBox.prompt(t,o||"系統提示",{confirmButtonText:"確認",cancelButtonText:"取消",type:"warning",inputType:a,inputPlaceholder:t})},loading(t){et=b.ElLoading.service({lock:!0,text:t,background:"rgba(0, 0, 0, 0.7)"})},closeLoading(){et.close()}};function tt(t){return oe()({url:"/system/dict/data/type/"+t,method:"get"})}function lt(t){return oe()({url:"/system/common/dict/data/type/"+t,method:"get"})}const re=Te.defineStore("dict",()=>{const t=e.ref(new Map);return{dict:t,getDict:r=>r&&t.value.get(r)||null,setDict:(r,i)=>{if(!r)return!1;try{return t.value.set(r,i),!0}catch(m){return console.error("Error in setDict:",m),!1}},removeDict:r=>{if(!r)return!1;try{return t.value.delete(r)}catch(i){return console.error("Error in removeDict:",i),!1}},cleanDict:()=>{t.value.clear()}}}),yl=(...t)=>{const o=e.ref({});return t.forEach(async a=>{o.value[a]=[];const l=re().getDict(a);l?o.value[a]=l:await tt(a).then(c=>{o.value[a]=c.data.map(r=>({label:r.dictLabel,value:r.dictValue,elTagType:r.listClass,elTagClass:r.cssClass})),re().setDict(a,o.value[a])})}),o.value},kl=async t=>{const o=re().getDict(t);if(o&&o.length>0)return o;{const l=(await tt(t)).data.map(c=>({label:c.dictLabel,value:c.dictValue,elTagType:c.listClass,elTagClass:c.cssClass,remark:c.remark}));return re().setDict(t,l),l}},bl=(...t)=>{const o=e.ref({});return t.forEach(async a=>{o.value[a]=[];const l=re().getDict(a);l&&l.length>0?o.value[a]=l:await lt(a).then(c=>{o.value[a]=c.data.map(r=>({label:r.dictLabel,value:r.dictValue,elTagType:r.listClass,elTagClass:r.cssClass,remark:r.remark})),re().setDict(a,o.value[a])})}),o.value},Bl=async t=>{const o=re().getDict(t);if(o&&o.length>0)return o;{const l=(await lt(t)).data.map(c=>({label:c.dictLabel,value:c.dictValue,elTagType:c.listClass,elTagClass:c.cssClass}));return re().setDict(t,l),l}},wl={beforeMount(t,{value:o,arg:a}){if(a==="callback")t.$copyCallback=o;else{t.$copyValue=o;const l=()=>{Vl(t.$copyValue),t.$copyCallback&&t.$copyCallback(t.$copyValue)};t.addEventListener("click",l),t.$destroyCopy=()=>t.removeEventListener("click",l)}}};function Vl(t,{target:o=document.body}={}){const a=document.createElement("textarea"),l=document.activeElement;a.value=t,a.setAttribute("readonly",""),a.style.contain="strict",a.style.position="absolute",a.style.left="-9999px",a.style.fontSize="12pt";const c=document.getSelection();let r;c&&(r=(c==null?void 0:c.rangeCount)>0&&c.getRangeAt(0)),o.append(a),a.select(),a.selectionStart=0,a.selectionEnd=t.length;let i=!1;try{i=document.execCommand("copy")}catch(m){console.error(m)}return a.remove(),r&&(c==null||c.removeAllRanges(),c==null||c.addRange(r)),l&&l.focus(),i}const at={zh_CN:We,zh_HK:Qe,en_US:Ge},Cl={Curd:Xe,DictTag:ge,DictText:he,SvgIcon:se,OssImagePreview:be,OssFile:Be,Editor:Ee,TranslateInput:De,ImageUpload:_e,FileUpload:Se},ot=(t,o={})=>{o.baseUrl!=null&&Ie(o.baseUrl),o.request&&Ue(o.request),o.globalHeaders&&Ae(o.globalHeaders),(o.hasPermi||o.hasRoles)&&Ye(o);try{const l=t.config.globalProperties.$i18n;if(l){const c=l.global||l;for(const[r,i]of Object.entries(at))if(c&&typeof c.mergeLocaleMessage=="function"&&c.mergeLocaleMessage(r,i),c&&c.messages){const m=c.messages[r]||{};c.messages[r]={...i,...m}}}}catch{}for(const[l,c]of Object.entries(Cl))t.component(l,c);const a=t.config.globalProperties;a.$modal=gl,a.download=ve,a.useDict=yl,a.useOneDict=kl,a.useOneCommonDict=Bl,a.useCommonDict=bl,a.parseTime=el,a.addDateRange=tl,a.handleTree=ol,a.selectDictLabel=ll,a.selectDictLabels=al,t.directive("hasPermi",$t),t.directive("hasRoles",xt),t.directive("copyText",wl)},Sl={install:ot};M.Curd=Xe,M.DictTag=ge,M.DictText=he,M.Editor=Ee,M.FileUpload=Se,M.ImageUpload=_e,M.OssFile=Be,M.OssImagePreview=be,M.SvgIcon=se,M.TranslateInput=De,M.default=Sl,M.download=ve,M.getBaseUrl=pe,M.getGlobalHeaders=de,M.getRequest=oe,M.hasPermission=fe,M.install=ot,M.messages=at,M.setBaseUrl=Ie,M.setGlobalHeaders=Ae,M.setPermissionChecker=Ye,M.setRequest=Ue,Object.defineProperties(M,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
2
2
|
//# sourceMappingURL=vue3-curd.umd.js.map
|