cnhis-design-vue 3.2.9-beta.16 → 3.2.9-beta.19

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.
@@ -1 +1 @@
1
- import{defineComponent as e,inject as t,ref as n,reactive as r,computed as i,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as I}from"vue";import{isObject as O}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as F,NCheckbox as x,NDivider as E}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as J}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as R}from"../constants/index.js";import{Print as z}from"../utils/print.js";import{isIReport as A}from"../utils/browserPrint.js";import U from"./IdentityVerification.vue.js";import{format as V}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{encapBrowserLog as B}from"../../../../shared/utils/index.js";import{useShortcuts as K}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const q={class:"newprint-button-outer"},G={key:0,class:"newprint-button-outer__shortcut"},Y=d("span",{class:"label bold"},"外显设置",-1),H={class:"newprint-button-poperOver"},$={class:"print-lite"},Q={class:"label bold"},W={class:"print-li"},X={class:"print-lite"},Z={key:0,class:"newprint-button-outer__shortcut"},ee={class:"newprint-button-poperOver"},te=["onMouseenter","onClick"],ne={class:"label bold"},re={class:"newprint-button-poperOver"},ie={class:"print-lite"},ae={class:"label bold"},le={class:"print-li"},oe={class:"print-lite"},se=["onClick"],ue={key:0,class:"newprint-button-outer__shortcut"},ce={class:"newprint-button-poperOver"},de=["onMouseenter"],pe={class:"print-lite"},me=["onClick"];var ve=e({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})}},setup(e,{expose:ve}){const fe=e,ye=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],ge=C();let he;const ke=t(R),be=n(""),Pe=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),we=n({});let Se=n([]),Ie=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Oe=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),Ce=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),Le=n([]),Te=n([]),je=i((()=>{if(!Pe.currentFormatId)return{};let e=Pe.currentFormatId;return Pe.formatList.find((t=>t.id===e))}));i((()=>{var e;return(null==(e=je.value)?void 0:e.name)||"格式选择"}));const Me=i((()=>{let e=Pe.formatList.find((e=>e.id===Pe.currentFormatId));return null==e?void 0:e.templateId})),Fe=i((()=>{let e=Pe.formatList.find((e=>e.id===Pe.currentFormatId));return null==e?void 0:e.number})),xe=i((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Ee=i((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),Ne=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),_e=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),De=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Je=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Re=i((()=>{var e,t;const n=Object.keys(Je.value);if(n.length>0){if(_e.value&&n.includes(_e.value))return(null==(e=Je.value[_e.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Je.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=i((()=>{const e=ye.map((e=>e.key));return Se.value.filter((t=>!e.includes(t.key)))})),Ae=i({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ue=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await vt(),Ce.oneShow=!0},Ve=async e=>{if(fe.directPrint){if(Pe.spinning)return;return"button"===e?void(xe.value?await gt():_e.value?async function(e){await vt(!1);const t=Le.value.find((t=>t.key==e));t&&tt(t.templateCode,t.templateId,t.key,!1)}(_e.value):Ue()):Ue()}return Ue()},Be=(e,t)=>{Oe[e]=t},Ke=()=>{Le.value=Se.value.filter((e=>!e.selected)),Te.value=ze.value.filter((e=>e.selected)),Ge("oneShow"),Ge("isOutSetting"),ke("saveOuterPrint",Te.value)},qe=e=>{Ce[e]=!0},Ge=e=>{Oe.oneClickType="",Ce[e]=!1,"isOutSetting"==e&&(Ce.isOutSetting=!1)},Ye=(e,t)=>{Ze(!1);let n={type:t,formatId:Pe.currentFormatId,templateId:(null==e?void 0:e.templateId)||Me.value,templateCode:(null==e?void 0:e.templateCode)||Fe.value};B({type:"进入成功的回调",res:e,info:n}),ke("success",e,n)},He=e=>{Ze(!1),B({type:"进入失败的回调",res:e}),ke("error",e),O(e)&&"notInstalledApp"===e.type&&ge.error(e.message)},$e=e=>{Ze(!1),ke("cancel",e)},Qe=e=>{ke("error",{message:"前置条件执行错误",type:e,preExecution:!0})},We=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),Xe=(e=[],t)=>{var n,r;let i={},a={};if((null==(n=Pe.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(r=Object.keys(e[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return i=Object.assign({},JSON.parse(We()),Ne.value,a),JSON.stringify(i)},Ze=(e,t)=>{if(Pe.isClickOuterPrint){if(e&&t){const n=Te.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}Te.value.forEach((e=>{e.isLoading=!1}))}else Pe.spinning=e},et=()=>Pe.isClickOuterPrint?Te.value.some((e=>e.isLoading)):Pe.spinning,tt=(e,t,n,r)=>{const i=Pe.printParams[e];if(!i)return;Pe.isClickOuterPrint=r,Pe.currentFormatId=n;const a=Pe.originParams[e]||[];nt(i,e,t,n,a)},nt=async(e=[],t,n,r,i=[],a)=>{B({type:"点击打印的入参",templateCode:t,templateId:n,formatId:r,printToParam:i});let l=e.length;const o=async e=>{try{--l<=0&&Ye(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&et()&&!a||(Ze(!0,r),fe.prevFn("print",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const a={formatId:r,iReportExecuteMode:Pe.iReportExecuteMode,templateId:n,authorizationKey:be.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies};if(B({type:"准备开始打印",queryParams:a,printToParam:i}),"MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[t]));he.printDirect({...a,params:n},o,He,$e)}else he.printDirect({...a,params:Xe(e,t)},(e=>{e.params=i,e.templateCode=t,e.templateId=n,Ye(e,"print")}),He,$e)})).catch((()=>{Qe("print"),Ze(!1)})).finally((()=>{Pe.visible=!1})))},rt=async(e,{templateCode:t,templateId:n,key:r},i)=>{const a=Pe.printParams[t];if(a)switch(Pe.isClickOuterPrint=i,Pe.currentFormatId=r,e){case"previewText":(async(e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("preview",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[0])),a="MULTI"===fe.strategy?i:Xe(e,t),l={formatId:r,templateId:n,iReportExecuteMode:Pe.iReportExecuteMode,authorizationKey:be.value,params:a,btnprint:fe.btnprint,signature:fe.signature};he.preview(l,(e=>{Ye(e,"preview")}),He)})).catch((()=>{Qe("preview"),Ze(!1)})).finally((()=>{Pe.visible=!1})))})(a,t,n,r);break;case"formatEditText":((e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("edit",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e,Pe.currentFormatId=r,Pe.identityVerification.visible=!0})).catch((()=>{Qe("edit")})).finally((()=>{Ze(!1)})))})(a,0,n,r);break;case"downloadPdf":(async(e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("download",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[0])),a="MULTI"===fe.strategy?i:Xe(e,t),l={formatId:r,templateId:n,iReportExecuteMode:Pe.iReportExecuteMode,authorizationKey:be.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};he.downloadPDF(l,(e=>Ye(e,"preview")),He)})).catch((()=>{Qe("download"),Ze(!1)})).finally((()=>{Pe.visible=!1})))})(a,t,n,r);break;case"resetPrinter":(async(e=[],t,n,r)=>{if(!fe.showLoading||!et()){Ze(!0,r);try{const e=await he.resetPrinter(r);if(Ze(!1),"success"==(null==e?void 0:e.result))return void ge.success(e.message||"重置打印机成功");ge.warning("重置打印机失败")}catch(e){Ze(!1),ge.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,r)}},it=()=>{},at=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ut(n,t,e))})),n},lt=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ct(n,t,e))})),n},ot=(e,t,n)=>{const r={};return t.forEach((t=>{let i=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(r=V(t,n[e.type])),(null==e?void 0:e.defaultValue)||r})(t,e[t[n]]);e[t[n]]&&i&&(r[t[n]]=i)})),r},st=({customizeDataset:e=[],param:t=[]},n={})=>{let r={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[e.name]=JSON.stringify(ot(n,t,"fieldName"))})),r=Object.assign({},r,ot(n,t,"key")),r},ut=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r],a=n[i];if(!a)return ge.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(st(a,t))}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return ge.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(st(l,t))}return e},ct=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r];if(!n[i])return ge.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(t)}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return ge.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(t)}return e},dt=async e=>{var t;Pe.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],Pe.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const r=Object.keys(Je.value),i=Pe.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(r.includes(e.id)){const n=Je.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Se.value.unshift(...i),Ee.value&&Se.value.push(...ye),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Se.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),Te.value=Se.value.filter((e=>e.selected))),Le.value=Se.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Ie.value=Ie.value.filter((e=>!fe.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(t);r.includes("RY7.2.21.1.M2.G94181E")||(Ie.value=Ie.value.filter((e=>"downloadPdf"!=e.key))),r.includes("RY7.2.21.1.M2.G33633A")||(Ie.value=Ie.value.filter((e=>"formatEditText"!=e.key))),r.includes("RY7.2.21.1.M2.G99314S")||(Ie.value=Ie.value.filter((e=>"resetPrinter"!=e.key)))}})(),Pe.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),Pe.printParams=at(Pe.templateParams,fe.params),Pe.originParams=lt(Pe.templateParams,fe.params),mt()},pt=async()=>{var e;if(Pe.isInited)return!0;Pe.isInited=!0,Pe.spinning=!0,(()=>{if(he)return!1;he=new z})();const t=await fe.queryPrintFormatByNumber();return await dt(t),(null==(e=t.obj)?void 0:e.length)>0&&(be.value=t.obj[0].authorizationKey||""),Pe.spinning=!1,!0},mt=async()=>{const e=Object.keys(Je.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],r=Je.value[n],{stop:i,signature:a}=K().register({label:r.code,shortcutSignature:r.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ve("button");const e=ze.value.map((e=>e.key)),t=Pe.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=Pe.printParams[null==e?void 0:e.templateCode],r=t[null==e?void 0:e.templateCode]||[];nt(n,e.templateCode,e.templateId,e.key,r)}}}});we.value[n]=i}},vt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!Pe.visible){if(!await pt())return!1}e&&(Pe.visible=!Pe.visible)}},ft=e=>{if(Pe.identityVerification.visible=!1,A(Pe.currentFormatId))return Ye({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,Pe.curPrintParamList[0])),n="MULTI"===fe.strategy?t:Xe(Pe.curPrintParamList,Fe.value),r={formatId:Pe.currentFormatId,templateId:Me.value,params:n,token:e};he.editPrintFormat(r,(e=>{Ye(e,"edit")}),He)},yt=(e,t)=>{const n=Te.value[t+1];return t<Te.value.length-1&&!Pe.printParams[e.templateCode]&&Pe.printParams[n.templateCode]};async function gt(){await vt(!1),(()=>{const e=Object.keys(Pe.printParams);Pe.isClickOuterPrint=!1;const t=Pe.originParams;if(1==De.value)for(let n=0;n<e.length;n++){const r=e[n],i=Pe.printParams[r],a=t[r]||[],l=Pe.formatList.filter((e=>e.number==r));l&&l.length>0&&l.forEach((e=>{Pe.currentFormatId=e.id,nt(i,e.number,e.templateId,e.id,a,!0)}))}2==De.value&&Te.value.forEach((e=>{const n=Pe.printParams[e.templateCode],r=t[e.templateCode]||[];Pe.currentFormatId=e.key,nt(n,e.templateCode,e.templateId,e.key,r,!0)}))})()}return a((()=>{Pe.isInited=!1,vt()})),l((()=>{const e=Object.keys(we.value);e.length>0&&e.forEach((e=>{we.value[e]&&we.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(Pe.templateParams).length>0&&(Pe.printParams=at(Pe.templateParams,fe.params),Pe.originParams=lt(Pe.templateParams,fe.params))}),{deep:!0}),o((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await vt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:gt}),(t,n)=>(s(),u(c,null,[d("div",q,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(Te.value,((t,n)=>{return s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:it,options:(r=v(Ie),i=t,Pe.printParams[i.templateCode]?r:[]),onSelect:e=>rt(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!Pe.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>tt(t.templateCode,t.templateId,t.key,!0),class:h(n==Te.value.length-1?"outerLastButton":yt(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",G,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"]);var r,i})),128))])),_:1}),p(" 外显设置按钮 "),Te.value.length>0&&Te.value.length==v(ze).length&&v(Ee)&&2!=v(De)?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,show:Ce.isOutSetting,onClickoutside:n[2]||(n[2]=e=>Ge("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(Te.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>qe("isOutSetting"))},{default:f((()=>[Y,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",H,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",$,[d("span",Q,b(e.label),1),m(v(x),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",W,[m(v(E)),d("div",X,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(x),{key:0,checked:v(Ae),"onUpdate:checked":n[1]||(n[1]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(F),{trigger:"click","show-arrow":!1,show:Ce.oneShow,onClickoutside:n[10]||(n[10]=e=>Ge("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:vt,printSpinning:Pe.spinning,printbtnText:e.btnText,printVisible:Pe.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ve("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&Pe.spinning,onClick:n[3]||(n[3]=S((()=>Ve("button")),["stop"])),class:h(Te.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(xe)?"打印全部":e.btnText)+" ",1),v(Re)?(s(),u("span",Z,b(v(Re)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",ee,[(s(!0),u(c,null,y(Le.value,(e=>(s(),u("div",{class:h(["print-li",Oe.oneMouseType==e.key||Oe.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Be("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Be("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!Pe.printParams[n.templateCode])return[];Be(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(E),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(F),{trigger:"click","show-arrow":!1,placement:"right-start",show:Ce.isOutSetting,onClickoutside:n[7]||(n[7]=e=>Ge("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>qe("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:Te.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",re,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",ie,[d("span",ae,b(e.label),1),m(v(x),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",le,[m(v(E)),d("div",oe,[m(v(j),{type:"primary",size:"small",onClick:Ke},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(x),{key:0,checked:v(Ae),"onUpdate:checked":n[6]||(n[6]=e=>P(Ae)?Ae.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",Pe.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>tt(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",ue,b(e.shortcutLabel),1)):p("v-if",!0)],8,se),Pe.printParams[e.templateCode]?(s(),g(v(F),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Ce[e.key],onClickoutside:t=>Ge(e.key)},{trigger:f((()=>[m(v(M),{component:v(J),size:"18",onClick:t=>qe(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(v(Ie),(t=>(s(),u("div",{class:h(["print-li",Oe.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Be("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Be("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>rt(t.key,e,!1)},b(t.label),9,me)])],42,de)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,te)))),128))])])),_:3},8,["show"])],2112))]),m(U,I(t.$attrs,{modelValue:Pe.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>Pe.identityVerification.visible=e),formatId:Pe.currentFormatId,templateId:v(Me),onSuccess:ft}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
1
+ import{defineComponent as e,inject as t,ref as n,reactive as r,computed as i,onMounted as a,onBeforeUnmount as l,watch as o,openBlock as s,createElementBlock as u,Fragment as c,createElementVNode as d,createCommentVNode as p,createVNode as m,unref as v,withCtx as f,renderList as y,createBlock as g,normalizeClass as h,createTextVNode as k,toDisplayString as b,isRef as P,renderSlot as w,withModifiers as S,mergeProps as I}from"vue";import{isObject as O}from"@vue/shared";import{useMessage as C,NButtonGroup as L,NDropdown as T,NButton as j,NIcon as M,NPopover as x,NCheckbox as E,NDivider as F}from"naive-ui";import{PrintOutline as N,SettingsOutline as _,ChevronDownSharp as D,ArrowForwardOutline as R}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as J}from"../constants/index.js";import{Print as z}from"../utils/print.js";import{isIReport as K}from"../utils/browserPrint.js";import A from"./IdentityVerification.vue.js";import{format as U}from"date-fns";import"../api.js";import"../../../shortcut-provider/index.js";import{encapBrowserLog as V}from"../../../../shared/utils/index.js";import{useShortcuts as B}from"../../../shortcut-provider/src/hooks/useShortcuts.js";const q={class:"newprint-button-outer"},G={key:0,class:"newprint-button-outer__shortcut"},Y=d("span",{class:"label bold"},"外显设置",-1),H={class:"newprint-button-poperOver"},$={class:"print-lite"},Q={class:"label bold"},W={class:"print-li"},X={class:"print-lite"},Z={key:0,class:"newprint-button-outer__shortcut"},ee={class:"newprint-button-poperOver"},te=["onMouseenter","onClick"],ne={class:"label bold"},re={class:"newprint-button-poperOver"},ie={class:"print-lite"},ae={class:"label bold"},le={class:"print-li"},oe={class:"print-lite"},se=["onClick"],ue={key:0,class:"newprint-button-outer__shortcut"},ce={class:"newprint-button-poperOver"},de=["onMouseenter"],pe={class:"print-lite"},me=["onClick"];var ve=e({__name:"NewPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:"请选中需要打印的数据",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number},resolution:{type:Number},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,printAllType:1,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:"",shortcut:{}})}},setup(e,{expose:ve}){const fe=e,ye=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],ge=C();let he;const ke=t(J),be=n(""),Pe=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[],iReportExecuteMode:1}),we=n({});let Se=n([]),Ie=n([{label:fe.previewText,key:"previewText"},{label:fe.pdfLoadText,key:"downloadPdf"},{label:fe.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const Oe=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),Ce=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),Le=n([]),Te=n([]),je=i((()=>{if(!Pe.currentFormatId)return{};let e=Pe.currentFormatId;return Pe.formatList.find((t=>t.id===e))}));i((()=>{var e;return(null==(e=je.value)?void 0:e.name)||"格式选择"}));const Me=i((()=>{let e=Pe.formatList.find((e=>e.id===Pe.currentFormatId));return null==e?void 0:e.templateId})),xe=i((()=>{let e=Pe.formatList.find((e=>e.id===Pe.currentFormatId));return null==e?void 0:e.number})),Ee=i((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowPrintAll})),Fe=i((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.isShowOutSetting})),Ne=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.customProps)||{}})),_e=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.defaultFormatId)||""})),De=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.printAllType)||1})),Re=i((()=>{var e;return(null==(e=fe.newPrintSetting)?void 0:e.shortcut)||{}})),Je=i((()=>{var e,t;const n=Object.keys(Re.value);if(n.length>0){if(_e.value&&n.includes(_e.value))return(null==(e=Re.value[_e.value])?void 0:e.shortcutLabel)||"";if(n.includes("all"))return(null==(t=Re.value.all)?void 0:t.shortcutLabel)||""}return""})),ze=i((()=>{const e=ye.map((e=>e.key));return Se.value.filter((t=>!e.includes(t.key)))})),Ke=i({get:()=>ze.value.every((e=>e.selected)),set(e){ze.value.forEach((t=>{t.selected=e}))}}),Ae=async()=>{var e,t;(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)||await vt(),Ce.oneShow=!0},Ue=async e=>{if(fe.directPrint){if(Pe.spinning)return;return"button"===e?void(Ee.value?await gt():_e.value?async function(e){await vt(!1);const t=Le.value.find((t=>t.key==e));t&&tt(t.templateCode,t.templateId,t.key,!1)}(_e.value):Ae()):Ae()}return Ae()},Ve=(e,t)=>{Oe[e]=t},Be=()=>{Le.value=Se.value.filter((e=>!e.selected)),Te.value=ze.value.filter((e=>e.selected)),Ge("oneShow"),Ge("isOutSetting"),ke("saveOuterPrint",Te.value)},qe=e=>{Ce[e]=!0},Ge=e=>{Oe.oneClickType="",Ce[e]=!1,"isOutSetting"==e&&(Ce.isOutSetting=!1)},Ye=(e,t)=>{Ze(!1);let n={type:t,formatId:Pe.currentFormatId,templateId:(null==e?void 0:e.templateId)||Me.value,templateCode:(null==e?void 0:e.templateCode)||xe.value};V({type:"进入成功的回调",res:e,info:n},"PRINT-SDK"),ke("success",e,n)},He=e=>{Ze(!1),V({type:"进入失败的回调",res:e},"PRINT-SDK"),ke("error",e),O(e)&&"notInstalledApp"===e.type&&ge.error(e.message)},$e=e=>{Ze(!1),ke("cancel",e)},Qe=e=>{ke("error",{message:"前置条件执行错误",type:e,preExecution:!0})},We=()=>JSON.stringify({...fe.token?{token:fe.token}:{}}),Xe=(e=[],t)=>{var n,r;let i={},a={};if((null==(n=Pe.templateParams[t].customizeDataset)?void 0:n.length)>0){const t=(null==(r=Object.keys(e[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(e.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(e[0]).forEach((t=>{a[t]=[],e.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return i=Object.assign({},JSON.parse(We()),Ne.value,a),JSON.stringify(i)},Ze=(e,t)=>{if(Pe.isClickOuterPrint){if(e&&t){const n=Te.value.find((e=>e.key==t));return void(n&&(n.isLoading=e))}Te.value.forEach((e=>{e.isLoading=!1}))}else Pe.spinning=e},et=()=>Pe.isClickOuterPrint?Te.value.some((e=>e.isLoading)):Pe.spinning,tt=(e,t,n,r)=>{const i=Pe.printParams[e];if(!i)return;Pe.isClickOuterPrint=r,Pe.currentFormatId=n;const a=Pe.originParams[e]||[];nt(i,e,t,n,a)},nt=async(e=[],t,n,r,i=[],a)=>{V({type:"点击打印的入参",templateCode:t,templateId:n,formatId:r,printToParam:i},"PRINT-SDK");let l=e.length;const o=async e=>{try{--l<=0&&Ye(e,"print")}catch(e){console.log("error",e)}};fe.showLoading&&et()&&!a||(Ze(!0,r),fe.prevFn("print",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const a={formatId:r,iReportExecuteMode:Pe.iReportExecuteMode,templateId:n,authorizationKey:be.value,printdlgshow:fe.printdlgshow,signature:fe.signature,copies:fe.printCopies};if(V({type:"准备开始打印",queryParams:a,printToParam:i},"PRINT-SDK"),"MULTI"===fe.strategy)for(let t=0;t<e.length;t++){t>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[t]));he.printDirect({...a,params:n},o,He,$e)}else he.printDirect({...a,params:Xe(e,t)},(e=>{e.params=i,e.templateCode=t,e.templateId=n,Ye(e,"print")}),He,$e)})).catch((()=>{Qe("print"),Ze(!1)})).finally((()=>{Pe.visible=!1})))},rt=async(e,{templateCode:t,templateId:n,key:r},i)=>{const a=Pe.printParams[t];if(a)switch(Pe.isClickOuterPrint=i,Pe.currentFormatId=r,e){case"previewText":(async(e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("preview",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[0])),a="MULTI"===fe.strategy?i:Xe(e,t),l={formatId:r,templateId:n,iReportExecuteMode:Pe.iReportExecuteMode,authorizationKey:be.value,params:a,btnprint:fe.btnprint,signature:fe.signature};he.preview(l,(e=>{Ye(e,"preview")}),He)})).catch((()=>{Qe("preview"),Ze(!1)})).finally((()=>{Pe.visible=!1})))})(a,t,n,r);break;case"formatEditText":((e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("edit",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e,Pe.currentFormatId=r,Pe.identityVerification.visible=!0})).catch((()=>{Qe("edit")})).finally((()=>{Ze(!1)})))})(a,0,n,r);break;case"downloadPdf":(async(e=[],t,n,r)=>{fe.showLoading&&et()||(Ze(!0,r),fe.prevFn("download",{formatId:r,templateId:n}).then((()=>{Pe.curPrintParamList=e;const i=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,e[0])),a="MULTI"===fe.strategy?i:Xe(e,t),l={formatId:r,templateId:n,iReportExecuteMode:Pe.iReportExecuteMode,authorizationKey:be.value,print:{print:"1",type:"1",resolution:null==fe?void 0:fe.resolution},params:a,signature:fe.signature};he.downloadPDF(l,(e=>Ye(e,"preview")),He)})).catch((()=>{Qe("download"),Ze(!1)})).finally((()=>{Pe.visible=!1})))})(a,t,n,r);break;case"resetPrinter":(async(e=[],t,n,r)=>{if(!fe.showLoading||!et()){Ze(!0,r);try{const e=await he.resetPrinter(r,Pe.iReportExecuteMode);if(Ze(!1),"success"==(null==e?void 0:e.result))return void ge.success(e.message||"重置打印机成功");ge.warning("重置打印机失败")}catch(e){Ze(!1),ge.warning((null==e?void 0:e.message)||"重置打印机失败")}}})(a,0,0,r)}},it=()=>{},at=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ut(n,t,e))})),n},lt=(e,t=[])=>{let n={};return(t=t||[]).forEach((t=>{n=Object.assign({},ct(n,t,e))})),n},ot=(e,t,n)=>{const r={};return t.forEach((t=>{let i=((e,t)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=t;return Object.keys(n).includes(e.type)&&t&&t instanceof Date&&(r=U(t,n[e.type])),(null==e?void 0:e.defaultValue)||r})(t,e[t[n]]);e[t[n]]&&i&&(r[t[n]]=i)})),r},st=({customizeDataset:e=[],param:t=[]},n={})=>{let r={};return e.forEach((e=>{const t=e.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[e.name]=JSON.stringify(ot(n,t,"fieldName"))})),r=Object.assign({},r,ot(n,t,"key")),r},ut=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r],a=n[i];if(!a)return ge.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(st(a,t))}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return ge.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(st(l,t))}return e},ct=(e,t,n)=>{if(t.templateNumbers){for(let r=0;r<t.templateNumbers.length;r++){const i=t.templateNumbers[r];if(!n[i])return ge.error("当前勾选的数据没有匹配的模板"),e;e[i]||(e[i]=[]),e[i].push(t)}return e}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return ge.error("当前勾选的数据没有匹配的模板"),e;e[a]||(e[a]=[]),e[a].push(t)}return e},dt=async e=>{var t;Pe.formatList=e?(e=>{let t=[];return e&&e.forEach((e=>{if(!e.format)return!1;t.push(...e.format.map((t=>Object.assign({},t,{templateName:e.name}))))})),t})(e.obj):[],Pe.iReportExecuteMode=(null==(t=null==e?void 0:e.obj)?void 0:t.length)>0&&e.obj[0].iReportExecuteMode||1,(()=>{var e,t,n;const r=Object.keys(Re.value),i=Pe.formatList.map((e=>{const t={templateCode:e.number,templateId:e.templateId,label:e.name,key:e.id,selected:!1,isLoading:!1};if(r.includes(e.id)){const n=Re.value[e.id];n&&(t.shortcutLabel=n.shortcutLabel)}return t}));Se.value.unshift(...i),Fe.value&&Se.value.push(...ye),(null==(t=null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys)?void 0:t.length)>0&&(Se.value.forEach((e=>{var t;(null==(t=fe.newPrintSetting)?void 0:t.outerPrintKeys.includes(e.key))&&(e.selected=!0)})),Te.value=Se.value.filter((e=>e.selected))),Le.value=Se.value.filter((e=>!e.selected)),fe.hideButtons.length>0&&(Ie.value=Ie.value.filter((e=>!fe.hideButtons.includes(e.key))));const a=sessionStorage.getItem("portal");if(a){const e=JSON.parse(a),t=(null==(n=null==e?void 0:e.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(t);r.includes("RY7.2.21.1.M2.G94181E")||(Ie.value=Ie.value.filter((e=>"downloadPdf"!=e.key))),r.includes("RY7.2.21.1.M2.G33633A")||(Ie.value=Ie.value.filter((e=>"formatEditText"!=e.key))),r.includes("RY7.2.21.1.M2.G99314S")||(Ie.value=Ie.value.filter((e=>"resetPrinter"!=e.key)))}})(),Pe.templateParams=(e=>{let t={};return e&&e.forEach((e=>{if(!e.templateConfig)return!1;t[e.number]=e.templateConfig})),t})(e.obj),Pe.printParams=at(Pe.templateParams,fe.params),Pe.originParams=lt(Pe.templateParams,fe.params),mt()},pt=async()=>{var e;if(Pe.isInited)return!0;Pe.isInited=!0,Pe.spinning=!0,(()=>{if(he)return!1;he=new z})();const t=await fe.queryPrintFormatByNumber();return await dt(t),(null==(e=t.obj)?void 0:e.length)>0&&(be.value=t.obj[0].authorizationKey||""),Pe.spinning=!1,!0},mt=async()=>{const e=Object.keys(Re.value);if(e.length>0)for(let t=0;t<e.length;t++){const n=e[t],r=Re.value[n],{stop:i,signature:a}=B().register({label:r.code,shortcutSignature:r.shortcutKey,operation:["state","reset"],callback(){"all"==n&&Ue("button");const e=ze.value.map((e=>e.key)),t=Pe.originParams;if(e.includes(n)){const e=ze.value.find((e=>e.key==n));if(e){const n=Pe.printParams[null==e?void 0:e.templateCode],r=t[null==e?void 0:e.templateCode]||[];nt(n,e.templateCode,e.templateId,e.key,r)}}}});we.value[n]=i}},vt=async(e=!0)=>{if(await fe.clickPrevFn()){if(!Pe.visible){if(!await pt())return!1}e&&(Pe.visible=!Pe.visible)}},ft=e=>{if(Pe.identityVerification.visible=!1,K(Pe.currentFormatId))return Ye({result:"success",message:""},"edit");const t=JSON.stringify(Object.assign({},JSON.parse(We()),Ne.value,Pe.curPrintParamList[0])),n="MULTI"===fe.strategy?t:Xe(Pe.curPrintParamList,xe.value),r={formatId:Pe.currentFormatId,templateId:Me.value,params:n,token:e};he.editPrintFormat(r,(e=>{Ye(e,"edit")}),He)},yt=(e,t)=>{const n=Te.value[t+1];return t<Te.value.length-1&&!Pe.printParams[e.templateCode]&&Pe.printParams[n.templateCode]};async function gt(){await vt(!1),(()=>{const e=Object.keys(Pe.printParams);Pe.isClickOuterPrint=!1;const t=Pe.originParams;if(1==De.value)for(let n=0;n<e.length;n++){const r=e[n],i=Pe.printParams[r],a=t[r]||[],l=Pe.formatList.filter((e=>e.number==r));l&&l.length>0&&l.forEach((e=>{Pe.currentFormatId=e.id,nt(i,e.number,e.templateId,e.id,a,!0)}))}2==De.value&&Te.value.forEach((e=>{const n=Pe.printParams[e.templateCode],r=t[e.templateCode]||[];Pe.currentFormatId=e.key,nt(n,e.templateCode,e.templateId,e.key,r,!0)}))})()}return a((()=>{Pe.isInited=!1,vt()})),l((()=>{const e=Object.keys(we.value);e.length>0&&e.forEach((e=>{we.value[e]&&we.value[e]()}))})),o((()=>fe.params),(e=>{Object.keys(Pe.templateParams).length>0&&(Pe.printParams=at(Pe.templateParams,fe.params),Pe.originParams=lt(Pe.templateParams,fe.params))}),{deep:!0}),o((()=>{var e;return null==(e=fe.newPrintSetting)?void 0:e.outerPrintKeys}),(async e=>{(null==e?void 0:e.length)>0&&await vt(!1)}),{deep:!0,immediate:!0}),ve({directPrint:gt}),(t,n)=>(s(),u(c,null,[d("div",q,[p(" 外显按钮集合 "),m(v(L),{class:"outButtonGroup"},{default:f((()=>[(s(!0),u(c,null,y(Te.value,((t,n)=>{return s(),g(v(T),{key:t.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:it,options:(r=v(Ie),i=t,Pe.printParams[i.templateCode]?r:[]),onSelect:e=>rt(e,t,!0)},{default:f((()=>[m(v(j),{disabled:!Pe.printParams[t.templateCode],loading:e.showLoading&&t.isLoading,onClick:e=>tt(t.templateCode,t.templateId,t.key,!0),class:h(n==Te.value.length-1?"outerLastButton":yt(t,n)?"isPrintDisabled":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(t.label)+" ",1),t.shortcutLabel?(s(),u("span",G,b(t.shortcutLabel),1)):p("v-if",!0)])),_:2},1032,["disabled","loading","onClick","class"])])),_:2},1032,["options","onSelect"]);var r,i})),128))])),_:1}),p(" 外显设置按钮 "),Te.value.length>0&&Te.value.length==v(ze).length&&v(Fe)&&2!=v(De)?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,show:Ce.isOutSetting,onClickoutside:n[2]||(n[2]=e=>Ge("isOutSetting"))},{trigger:f((()=>[m(v(j),{class:h(Te.value.length>0?"printAllLeftCls":""),onClick:n[0]||(n[0]=e=>qe("isOutSetting"))},{default:f((()=>[Y,m(v(M),{style:{"margin-left":"8px"},component:v(_),size:"18"},null,8,["component"])])),_:1},8,["class"])])),default:f((()=>[d("div",H,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",$,[d("span",Q,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",W,[m(v(F)),d("div",X,[m(v(j),{type:"primary",size:"small",onClick:Be},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ke),"onUpdate:checked":n[1]||(n[1]=e=>P(Ke)?Ke.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:1},8,["show"])):(s(),u(c,{key:1},[p(" 打印全部按钮 "),m(v(x),{trigger:"click","show-arrow":!1,show:Ce.oneShow,onClickoutside:n[10]||(n[10]=e=>Ge("oneShow"))},{trigger:f((()=>[w(t.$slots,"button",{handleClickPrintBtn:vt,printSpinning:Pe.spinning,printbtnText:e.btnText,printVisible:Pe.visible},(()=>[m(v(L),{class:"newprint-button-component",onClick:n[4]||(n[4]=S((()=>Ue("icon")),["stop"]))},{default:f((()=>[m(v(j),{loading:e.showLoading&&Pe.spinning,onClick:n[3]||(n[3]=S((()=>Ue("button")),["stop"])),class:h(Te.value.length>0?"printAllLeftCls":"")},{icon:f((()=>[m(v(M),{component:v(N),size:"18"},null,8,["component"])])),default:f((()=>[k(" "+b(v(Ee)?"打印全部":e.btnText)+" ",1),v(Je)?(s(),u("span",Z,b(v(Je)),1)):p("v-if",!0)])),_:1},8,["loading","class"]),m(v(j),{class:"icon-select"},{icon:f((()=>[m(v(M),{component:v(D),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:f((()=>[d("div",ee,[(s(!0),u(c,null,y(Le.value,(e=>(s(),u("div",{class:h(["print-li",Oe.oneMouseType==e.key||Oe.oneClickType==e.key?"active":""]),key:e.key,onMouseenter:t=>Ve("oneMouseType",e.key),onMouseleave:n[9]||(n[9]=e=>Ve("oneMouseType","")),onClick:t=>((e,t,n)=>{if(!Pe.printParams[n.templateCode])return[];Ve(e,t)})("oneClickType",e.key,e)},["divider"==e.key?(s(),g(v(F),{key:0})):"outSetting"==e.key?(s(),u(c,{key:1},[p(" 第二层外显设置 "),m(v(x),{trigger:"click","show-arrow":!1,placement:"right-start",show:Ce.isOutSetting,onClickoutside:n[7]||(n[7]=e=>Ge("isOutSetting"))},{trigger:f((()=>[d("div",{class:"print-lite",onClick:n[5]||(n[5]=e=>qe("isOutSetting"))},[d("span",ne,b(e.label),1),m(v(M),{color:Te.value.length>0?"#2563F4":"",component:v(_),size:"18"},null,8,["color","component"])])])),default:f((()=>[d("div",re,[(s(!0),u(c,null,y(v(ze),(e=>(s(),u("div",{class:"print-li",key:e.key},[d("div",ie,[d("span",ae,b(e.label),1),m(v(E),{checked:e.selected,"onUpdate:checked":t=>e.selected=t},{default:f((()=>[k("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),d("div",le,[m(v(F)),d("div",oe,[m(v(j),{type:"primary",size:"small",onClick:Be},{default:f((()=>[k("保存")])),_:1}),v(ze)&&v(ze).length>1?(s(),g(v(E),{key:0,checked:v(Ke),"onUpdate:checked":n[6]||(n[6]=e=>P(Ke)?Ke.value=e:null)},{default:f((()=>[k("全选")])),_:1},8,["checked"])):p("v-if",!0)])])])])),_:2},1032,["show"])],2112)):(s(),u(c,{key:2},[p(" 第二层功能操作 "),d("div",{class:h(["print-lite",Pe.printParams[e.templateCode]?"":"isDisabled"])},[d("span",{class:"label bold",onClick:t=>tt(e.templateCode,e.templateId,e.key,!1)},[k(b(e.label)+" ",1),e.shortcutLabel?(s(),u("span",ue,b(e.shortcutLabel),1)):p("v-if",!0)],8,se),Pe.printParams[e.templateCode]?(s(),g(v(x),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:Ce[e.key],onClickoutside:t=>Ge(e.key)},{trigger:f((()=>[m(v(M),{component:v(R),size:"18",onClick:t=>qe(e.key)},null,8,["component","onClick"])])),default:f((()=>[d("div",ce,[(s(!0),u(c,null,y(v(Ie),(t=>(s(),u("div",{class:h(["print-li",Oe.twoMouseType==t.key?"active":""]),key:t.key,onMouseenter:e=>Ve("twoMouseType",t.key),onMouseleave:n[8]||(n[8]=e=>Ve("twoMouseType",""))},[d("div",pe,[d("span",{class:"label",onClick:n=>rt(t.key,e,!1)},b(t.label),9,me)])],42,de)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,te)))),128))])])),_:3},8,["show"])],2112))]),m(A,I(t.$attrs,{modelValue:Pe.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=e=>Pe.identityVerification.visible=e),formatId:Pe.currentFormatId,templateId:v(Me),onSuccess:ft}),null,16,["modelValue","formatId","templateId"])],64))}});export{ve as default};
@@ -36,7 +36,7 @@ export declare class Print {
36
36
  showPreview(...args: Parameters<PreviewDialog['show']>): Promise<string>;
37
37
  _testDomesticSystemConnection(): Promise<unknown>;
38
38
  _testConnection(): Promise<unknown>;
39
- resetPrinter(formatId: string): Promise<any>;
39
+ resetPrinter(formatId: string, iReportExecuteMode: number): Promise<any>;
40
40
  _queryServicesPrint(params: AnyObject): Promise<any>;
41
41
  _queryBase64ServicesPrint(params: AnyObject): Promise<any>;
42
42
  _callPrintWithFile(queryParams: AnyObject): Promise<any>;
@@ -1 +1 @@
1
- import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,d=`${p}/fdp-api/print/assembly/printIReport`,g=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${p}/bi-api/reprot/print/open/client/previewIReport`,y=`${p}/bi-api/reprot/print/open/client/getRemote`,w=`${p}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this;const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=h(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}resetPrinter(t){return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o,printdlgshow:l="0",nobillnode:h="1",btnprint:u="1",messageTimeout:m=0}){const p={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:u,copies:o,messageTimeout:m,...a?{signature:a}:{}};if(s&&(p.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}p.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");p.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=p,await this._queryServicesPrint(p)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:y})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:d,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:g,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${w}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:l,signature:c,btnprint:h,messageTimeout:m=0},p,d){const g=a(i);if(i=this.getIReportFormatId(g,i),g&&(u||2==t)){const t=await this._queryPrintForPdf(e,i,s,l);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const r=n(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,r),null==p?void 0:p({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:m}),n=this._handleResult(t,d);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==p||p(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,isDownloadFile:p=!0,messageTimeout:d=0},g,f,y,w="printDirect"){const P=a(i);if(i=this.getIReportFormatId(P,i),P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},g,f,y):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},g,f,y))}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,messageTimeout:d}),n=this._handleResult(t,f,y);if(!n)return!1;p&&["downloadPDF"].includes(w)&&await this._browserPrint(n,w),null==g||g(n)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n,a){const o=await this._queryPrintForBase64(t,e,i,s);if(!o.success)return n({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=r,this._errorCallbackFn=n,a&&(this._cancelCallbackFn=a),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&(u||2==t.iReportExecuteMode)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e,result:"success",message:""})):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(t,(async t=>{t||s({result:"error",message:""});const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
1
+ import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{isIReport as r,getFileUrl as n,useBrowserPrint as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,d=`${p}/fdp-api/print/assembly/printIReport`,g=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${p}/bi-api/reprot/print/open/client/previewIReport`,y=`${p}/bi-api/reprot/print/open/client/getRemote`,w=`${p}/printService/file`;let P=null;class v{constructor(){var t,e,r;if(this.webview=null,this.dialog=new i,this.dialogPreview=new s,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.printDomesticOrigin="http://127.0.0.1:17521",this.isRemote=!1,this.CMonitor=null,this.queryServicesParams=null,this.isConnectHiPrint=!1,this.clientInfo=null,this.printerList=[],this.hiPrintSocket=null,this.base64Fragment="",this._successCallbackFn=null,this._errorCallbackFn=null,this._cancelCallbackFn=null,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this;const n=window;this.CMonitor=n.$CMonitor;try{this.webview=n.top?null==(t=n.top.chrome)?void 0:t.webview:null==(e=n.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(r=n.chrome)?void 0:r.webview}if(this.webview){this.currentMessageHandler=this.messageHandler.bind(this),this.webview.addEventListener("message",this.currentMessageHandler);try{this.webview.postMessage({exec:"config",data:""})}catch(t){const e="当前浏览器版本不支持获取配置接口";this._handleMonitorNotify(e),console.log("非封装浏览器或者"+e)}}}messageHandler(t){var e;if(console.log("打印事件message",t),!t)return this._handleMonitorNotify("接收到空的浏览器事件,"+t),console.log("当前回执",t,"接收到空的浏览器事件");let i;try{i=JSON.parse(t.data||"{}")}catch(e){console.log("解析e.data失败,"+e),this._handleMonitorNotify("解析e.data失败,"+t)}if(["print","pdf","resetprint"].includes(null==i?void 0:i.cmd)){console.log("打印命令执行了",i);const e=this.messageHandlerQueue.shift();if(!e)return console.log("当前回执",t,"没有可用的handler");const{resolve:s,reject:r}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void s({result:(null==i?void 0:i.res)?"success":"fail"});s(i.res||"")}catch(t){r(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}_initDomesticSystem(t){try{if(this.hiPrintSocket)return this.isConnectHiPrint;this.hiPrintSocket=h(this.printDomesticOrigin,{reconnection:!1,transports:["websocket"],auth:{token:"no-use-vue-plugin-hiprint"}}),this.hiPrintSocket&&(this.hiPrintSocket.on("connect",(()=>{this.isConnectHiPrint=!0})),this.hiPrintSocket.on("disconnect",(()=>{this.isConnectHiPrint=!1,this.hiPrintSocket=null})),this.hiPrintSocket.on("clientInfo",(t=>{console.log("获取到客户端信息>>>>>",t),t.clientUrl&&(this.clientInfo=t)})),this.hiPrintSocket.on("printerList",(e=>{console.log("获取到打印机列表信息>>>>>",e),this.printerList=e,t&&t(!0)})),this.hiPrintSocket.on("success",(t=>{console.log("打印成功>>>>>",t),this.base64Fragment="",this._successCallbackFn&&this._successCallbackFn(t)})),this.hiPrintSocket.on("replayPrinterTemplate",(t=>{console.log("获取到数据的回复>>>>>",t),t&&this.hiPrintSocket.emit("news",t)})),this.hiPrintSocket.on("error",(t=>{console.log("打印失败>>>>>",t),this.base64Fragment="","cancel"==(null==t?void 0:t.result)?this._cancelCallbackFn&&this._cancelCallbackFn(t):this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("ihoPrint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}async resetPrinter(t,e){const i=r(t);if(t=this.getIReportFormatId(i,t),i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:t}}).then((({data:t})=>t.status?{type:"resetSuccess",result:"success",message:null==t?void 0:t.message}:{type:"resetError",result:"error",message:null==t?void 0:t.message})).catch((t=>({type:"resetError",result:"error",message:"重置打印机错误"}))):{type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"}}return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:"error",errinfo:t}),!1}if("success"!==t.result){const s=t.message||t.Message;this._handleMonitorNotify(s);const r={type:"printError",message:s,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:s,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(r),!1)}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件",result:"error"}),!1)}async _handleEventQueryPrintData(t,e,i,s,r){const n={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:s},a=await this._queryServicesPrint(n);return this._handleQueryPrintDataResult(a,e,r)}_handleQueryPrintDataResult(t,e,i){if(!(null==t?void 0:t.file)){try{const e=t.message||t.Message;console.log(e),null==i||i({result:"error",type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o,printdlgshow:l="0",nobillnode:h="1",btnprint:u="1",messageTimeout:m=0}){const p={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:u,copies:o,messageTimeout:m,...a?{signature:a}:{}};if(s&&(p.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}p.print=n}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");p.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=p,await this._queryServicesPrint(p)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:s,messageTimeout:r=0}){const n={};let a={};try{a=Object.assign({},n,JSON.parse(i))}catch(t){a=n}const o={templateId:t,formatId:e,cmdid:"9",token:s,params:JSON.stringify(a),messageTimeout:r};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:y})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:d,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:g,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),r=s[s.length-2],o=s[s.length-1],l=await n(`${w}/${r}/${o}`),c=a(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:n,authorizationKey:l,signature:c,btnprint:h,messageTimeout:m=0},p,d){const g=r(i);if(i=this.getIReportFormatId(g,i),g&&(u||2==t)){const t=await this._queryPrintForPdf(e,i,s,l);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const r=a(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,r),null==p?void 0:p({result:"success",message:"",file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:n,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:m}),r=this._handleResult(t,d);if(!r)return!1;if(this.isRemote){const t=await this._browserPrint(r,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(r),null==p||p(r)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==d||d(i),this._handleMonitorNotify(i)}}async printSync(t,e,i){const s=t.map((t=>{const e={params:"",printdlgshow:"0",nobillnode:"1",btnprint:"1",...t,cmdid:"7",...t.signature?{signature:t.signature}:{}};if(e.print)try{e.print=JSON.parse(e.print)}catch(t){}return{inputData:e}}));try{const t=l(),r=await this.messageCollect(t,{exec:"printA",data:s});if(r&&Array.isArray(r)){r.some((t=>"success"===t.res.result))?null==e||e(r):(null==i||i(r),this._handleMonitorNotify(r))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(r||""),null==i||i({type:"printError",message:t,result:"error",errinfo:t})}}catch(t){const e={error:t,result:"error",message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({iReportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:n,authorizationKey:a,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,isDownloadFile:p=!0,messageTimeout:d=0},g,f,y,w="printDirect"){const P=r(i);if(i=this.getIReportFormatId(P,i),P&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:a},g,f,y):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:a},g,f,y))}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:n,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,messageTimeout:d}),r=this._handleResult(t,f,y);if(!r)return!1;p&&["downloadPDF"].includes(w)&&await this._browserPrint(r,w),null==g||g(r)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n,a){const o=await this._queryPrintForBase64(t,e,i,s);if(!o.success)return n({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=r,this._errorCallbackFn=n,a&&(this._cancelCallbackFn=a),this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:c,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const n=r(t.formatId);if(t.formatId=this.getIReportFormatId(n,t.formatId),n&&(u||2==t.iReportExecuteMode)){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(a(e,"downloadPDF"),i({file:e,result:"success",message:""})):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(t,(async t=>{t||s({result:"error",message:""});const r=this,n=await async function(t){const i=[],s=JSON.parse(t);if(!e(s))return await r._downloadPDF("");if(1===s.length)return await r._downloadPDF(s[0]||"");for(let t=0,e=s.length;t<e;t++)i.push(await r._downloadPDF(s[t]||""));return i}(t.filedir);i(n,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:s},void 0,n);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,n);if(!l)return!1;r&&r(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:s=0},r,n){const a=await this._testConnection();if(!this._handleResultTest(a,n))return!1;const o=await this._handleEventQueryPrintData(t,e,i,s,n);return!!o&&(r&&r(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,r);return!!o&&(s&&s(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r=0},n,a){const o=await this._testConnection();if(!this._handleResultTest(o,a))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:s,messageTimeout:r}),c=this._handleResult(l,a);if(!c)return!1;n&&n(c)}async addPrintFormat({templateId:t,params:e,token:i},s,r){const n=await this._testConnection();if(!this._handleResultTest(n,r))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,r);if(!o)return!1;s&&s(o)}}export{v as Print};
@@ -356,6 +356,7 @@ declare const _default: import("vue").DefineComponent<{
356
356
  isMultiple: (field: string) => boolean;
357
357
  isRender: (field: string) => boolean;
358
358
  isShow: (field: string) => any;
359
+ showRelation: (field: string) => boolean;
359
360
  getSortPriorityOptions: () => {
360
361
  label: string;
361
362
  value: number;
@@ -378,12 +379,15 @@ declare const _default: import("vue").DefineComponent<{
378
379
  NIcon: any;
379
380
  NColorPicker: any;
380
381
  NPopconfirm: any;
382
+ NPopover: any;
383
+ NSpace: any;
381
384
  setStyle: typeof setStyle;
382
385
  setColorInfo: typeof setColorInfo;
383
386
  ReorderTwoOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
384
387
  TrashOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
385
388
  CreateOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
386
389
  HelpCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
390
+ CaretDownOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
387
391
  isFunction: (value: any) => value is (...args: any[]) => any;
388
392
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("edit" | "updateChecked")[], "edit" | "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
389
393
  element: {
@@ -521,9 +525,9 @@ declare const _default: import("vue").DefineComponent<{
521
525
  }>;
522
526
  developMode: boolean;
523
527
  draggable: boolean;
524
- isHighlightRow: boolean;
525
528
  idx: number;
526
529
  isHighlight: boolean;
530
+ isHighlightRow: boolean;
527
531
  isFieldSet: boolean;
528
532
  fieldDescribeMode: "column" | "tooltip";
529
533
  hideExpressionOption: AnyObject[];
@@ -378,6 +378,7 @@ declare const _default: import("vue").DefineComponent<{
378
378
  isMultiple: (field: string) => boolean;
379
379
  isRender: (field: string) => boolean;
380
380
  isShow: (field: string) => any;
381
+ showRelation: (field: string) => boolean;
381
382
  getSortPriorityOptions: () => {
382
383
  label: string;
383
384
  value: number;
@@ -400,12 +401,15 @@ declare const _default: import("vue").DefineComponent<{
400
401
  NIcon: any;
401
402
  NColorPicker: any;
402
403
  NPopconfirm: any;
404
+ NPopover: any;
405
+ NSpace: any;
403
406
  setStyle: typeof setStyle;
404
407
  setColorInfo: typeof import("./utils").setColorInfo;
405
408
  ReorderTwoOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
406
409
  TrashOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
407
410
  CreateOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
408
411
  HelpCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
412
+ CaretDownOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
409
413
  isFunction: (value: any) => value is (...args: any[]) => any;
410
414
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("edit" | "updateChecked")[], "edit" | "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
411
415
  element: {
@@ -543,9 +547,9 @@ declare const _default: import("vue").DefineComponent<{
543
547
  }>;
544
548
  developMode: boolean;
545
549
  draggable: boolean;
546
- isHighlightRow: boolean;
547
550
  idx: number;
548
551
  isHighlight: boolean;
552
+ isHighlightRow: boolean;
549
553
  isFieldSet: boolean;
550
554
  fieldDescribeMode: "column" | "tooltip";
551
555
  hideExpressionOption: AnyObject[];
@@ -545,6 +545,7 @@ declare const _default: import("vue").DefineComponent<{
545
545
  isMultiple: (field: string) => boolean;
546
546
  isRender: (field: string) => boolean;
547
547
  isShow: (field: string) => any;
548
+ showRelation: (field: string) => boolean;
548
549
  getSortPriorityOptions: () => {
549
550
  label: string;
550
551
  value: number;
@@ -567,12 +568,15 @@ declare const _default: import("vue").DefineComponent<{
567
568
  NIcon: any;
568
569
  NColorPicker: any;
569
570
  NPopconfirm: any;
571
+ NPopover: any;
572
+ NSpace: any;
570
573
  setStyle: typeof setStyle;
571
574
  setColorInfo: typeof import("./utils").setColorInfo;
572
575
  ReorderTwoOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
573
576
  TrashOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
574
577
  CreateOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
575
578
  HelpCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
579
+ CaretDownOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
576
580
  isFunction: (value: any) => value is (...args: any[]) => any;
577
581
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("edit" | "updateChecked")[], "edit" | "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
578
582
  element: {
@@ -710,9 +714,9 @@ declare const _default: import("vue").DefineComponent<{
710
714
  }>;
711
715
  developMode: boolean;
712
716
  draggable: boolean;
713
- isHighlightRow: boolean;
714
717
  idx: number;
715
718
  isHighlight: boolean;
719
+ isHighlightRow: boolean;
716
720
  isFieldSet: boolean;
717
721
  fieldDescribeMode: "column" | "tooltip";
718
722
  hideExpressionOption: AnyObject[];
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,reactive as i,toRef as o,watch as d,openBlock as a,createElementBlock as r,createBlock as n,unref as s,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,normalizeStyle as y,withCtx as v,createTextVNode as b,toDisplayString as g,createVNode as x,normalizeClass as k,mergeProps as w,renderSlot as S}from"vue";import{NInput as C,NCheckbox as A,NTooltip as _,NIcon as W,NPopconfirm as E,NButton as H}from"naive-ui";import D from"../../../shared/components/VueDraggable/src/vuedraggable.js";import F from"./components/table-row.vue.js";import{isArray as M,cloneDeep as P,isString as N,omit as R}from"lodash-es";import{isDisable as j,setStyle as B,isDraggableItem as V,isDraggable as O,getGroupTree as q}from"./utils/index.js";import{uuidGenerator as I}from"../../../shared/utils/index.js";import{HelpCircleSharp as K}from"@vicons/ionicons5";const U={class:"main-wrapper"},T={class:"main-wrapper__table-header"},G=h("span",null,"数值越小,优先级越高",-1),L=["tabindex"],$={key:1,class:"main-wrapper__table-footer"};var z=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1},showHeadFilter:{type:Boolean,default:!1},fieldShowMaxValue:{type:Number},rowDraggable:{type:Boolean,default:!0},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionConfig:{type:Object},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["save","close","reset"],setup(e,{expose:z,emit:J}){const Q=e,X={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},Y=l(Date.now()),Z=l(""),ee=l(),le=l([]),te=[{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!!Q.fieldShowMaxValue,field:"show",fieldShowMaxValue:Q.fieldShowMaxValue},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"},{title:"表头筛选",type:"checkbox",isHeadCheckHide:!0,field:"isShowHeaderFilter"},{title:"脱敏配置",type:"select",field:"hideExpression"}],ie=[{title:"搜索",type:"checkbox",isHeadCheckHide:!0,field:"isSearch"},{title:"求和",type:"checkbox",isHeadCheckHide:!0,field:"isSum"},{title:"平均值",type:"checkbox",isHeadCheckHide:!0,field:"isAvg"}],oe=l([]),de=t((()=>le.value.flat())),ae=t((()=>de.value.some((e=>e.feildDescribe)))),re=i({columns:oe,data:de,onUpdateChecked:function({checked:e,column:l}){const t=!e||ye(l.field);l.checkedAll=!t},draggable:Q.rowDraggable,isFieldSet:!0,fieldDescribeMode:Q.fieldDescribeMode,developMode:Q.developMode,columnWidthProps:Q.columnWidthProps,hideExpressionOption:o(Q.hideExpressionConfig||{option:[]},"option"),primaryKey:o(Q,"primaryKey"),titleRender:Q.titleRender}),ne={keyword:Z.value,idx:0,startIdx:0},se=()=>{J("save")},ue=()=>{J("close")};function ce(){le.value=fe(),me(),Y.value=Date.now(),J("reset")}function fe(){const e=P(Q.fields).map((e=>({...e,uuid:I()})));return Object.keys(X).forEach((l=>{e.forEach((e=>{"old"==Q.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[X[l]]=1==e[l]:e[X[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1),e.draggable=!!O(e)}))})),function(e){if(Q.groupSetting){return q(Q.groupSetting,e).reduce(((t,i)=>{const o=N(i)?e.find((e=>e.name===i)):l(i.children);return o&&t.push(o),t}),[])}return e;function l(t){const i=[];return t.forEach((t=>{if(t.children)i.push(...l(t.children));else{const l=e.find((e=>e.name===t));l&&i.push(l)}})),i}}(e)}function he(){const e=ne.keyword!==Z.value;let l=Z.value?de.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(Z.value))return!!e||t>ne.idx})):0;-1!==l||e||(l=ne.startIdx),ee.value.scrollTop=52*l,Object.assign(ne,{keyword:Z.value,idx:l},e?{startIdx:l}:{})}function pe(e){var l;return!!Z.value&&(null==(l=e.title)?void 0:l.includes(Z.value))}function me(){var e,l;oe.value=P(te),(null==(e=Q.showColumnNames)?void 0:e.length)&&(oe.value=te.concat(ie).filter((e=>{var l,t;return"title"===e.field||(null==(t=null==(l=Q.showColumnNames)?void 0:l.includes)?void 0:t.call(l,e.field))}))),(null==(l=Q.customColumns)?void 0:l.length)&&oe.value.push(...Q.customColumns),"column"===Q.fieldDescribeMode&&ae.value&&oe.value.push({title:"字段描述",type:"text",field:"feildDescribe"}),Q.showSeq&&oe.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),oe.value.forEach((e=>{if(e.isShow=function(e){var l,t;if(!(null==(l=Q.showColumnNames)?void 0:l.length)&&(["editable","required"].includes(e.field)&&!Q.isEdit||"sortPriority"===e.field&&!Q.showSortPriority||"isShowHeaderFilter"===e.field&&!Q.showHeadFilter||"hideExpression"===e.field&&!(null==(t=Q.hideExpressionConfig)?void 0:t.show)))return!1;return!0}(e),"checkbox"===e.type){const l=le.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ye(e.field)&&!l}}))}function ye(e){return le.value.flat().some((l=>!j(l,e)&&!l[e]&&"0001"!=l.id))}function ve(e){return!!V(e.relatedContext.element)}return d([()=>Q.fields,()=>{var e;return null==(e=Q.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(le.value=fe(),me())}),{immediate:!0,deep:!0}),z({getTableFields:function(){let e=[];return e="old"==Q.type?de.value.map(((e,l)=>R({...e,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth},["name","show","sort","alias","fixedWay","columnWidth"]))):de.value,e.map((e=>R(e,["uuid"])))}}),(l,t)=>(a(),r("div",U,[e.showSearch?(a(),n(s(C),{key:0,class:"main-wrapper__search-wrapper",value:Z.value,"onUpdate:value":t[0]||(t[0]=e=>Z.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(he,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(a(!0),r(p,null,m(oe.value,((l,t)=>(a(),r(p,{key:t},[l.isShow?(a(),r("span",{key:0,class:"table-cell",style:y(s(B)(l,t,e.columnWidthProps))},["checkbox"!==l.type||l.isHeadCheckHide?(a(),r(p,{key:1},[b(g(l.title),1)],64)):(a(),n(s(A),{key:0,checked:l.checkedAll,"onUpdate:checked":[e=>l.checkedAll=e,e=>{return t=e,i=l.field,void de.value.forEach((e=>{j(e,i)||(e[i]=t)}));var t,i}],disabled:l.disabledAll},{default:v((()=>[b(g(l.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===l.field?(a(),n(s(_),{key:2,trigger:"hover"},{trigger:v((()=>[x(s(W),{component:s(K),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[G])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"main-wrapper__table-body",ref_key:"tableBodyRef",ref:ee},[(a(),n(s(D),{modelValue:le.value,"onUpdate:modelValue":t[1]||(t[1]=e=>le.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:ve,disabled:!e.rowDraggable,key:Y.value},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(a(),r("div",{key:0,class:k(["item",s(V)(e)?"":"disabled"]),tabindex:l},[s(M)(e)?(a(!0),r(p,{key:0},m(e,((e,t)=>(a(),n(F,w(re,{key:t,element:e,idx:l+1,"is-highlight":pe(e)}),null,16,["element","idx","is-highlight"])))),128)):(a(),n(F,w({key:1},re,{element:e,idx:l+1,"is-highlight":pe(e)}),null,16,["element","idx","is-highlight"]))],10,L))])),_:1},8,["modelValue","disabled"]))],512),e.footerFlag?(a(),r("div",$,[f(" 底部按钮插槽 "),S(l.$slots,"footer",{},(()=>[x(s(E),{onPositiveClick:ce},{trigger:v((()=>[x(s(H),{style:{"margin-right":"8px"}},{default:v((()=>[b("恢复默认设置")])),_:1})])),default:v((()=>[b(" 确认要恢复系统默认设置吗? ")])),_:1}),x(s(H),{style:{"margin-right":"8px"},onClick:ue},{default:v((()=>[b("取消")])),_:1}),x(s(H),{type:"primary",onClick:se},{default:v((()=>[b("保存")])),_:1})]))])):f("v-if",!0)]))}});export{z as default};
1
+ import{defineComponent as e,ref as l,computed as i,reactive as t,toRef as o,watch as d,openBlock as a,createElementBlock as r,createBlock as n,unref as s,withKeys as u,withModifiers as c,createCommentVNode as f,createElementVNode as h,Fragment as p,renderList as m,normalizeStyle as y,withCtx as v,createTextVNode as b,toDisplayString as g,createVNode as x,normalizeClass as k,mergeProps as w,renderSlot as S}from"vue";import{NInput as C,NCheckbox as A,NTooltip as _,NIcon as W,NPopconfirm as E,NButton as H}from"naive-ui";import D from"../../../shared/components/VueDraggable/src/vuedraggable.js";import F from"./components/table-row.vue.js";import{isArray as M,cloneDeep as P,isString as N,omit as R}from"lodash-es";import{isDisable as j,setStyle as B,isDraggableItem as V,isDraggable as O,getGroupTree as q}from"./utils/index.js";import{uuidGenerator as I}from"../../../shared/utils/index.js";import{HelpCircleSharp as K}from"@vicons/ionicons5";const U={class:"main-wrapper"},T={class:"main-wrapper__table-header"},L=h("span",null,"数值越小,优先级越高",-1),G=["tabindex"],$={key:1,class:"main-wrapper__table-footer"};var z=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1},showHeadFilter:{type:Boolean,default:!1},fieldShowMaxValue:{type:Number},rowDraggable:{type:Boolean,default:!0},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionConfig:{type:Object},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["save","close","reset"],setup(e,{expose:z,emit:J}){const Q=e,X={sid:"id",columnName:"name",isShow:"show",isSort:"sort",isFixed:"fixedWay",colWidth:"columnWidth"},Y=l(Date.now()),Z=l(""),ee=l(),le=l([]),ie=[{title:"所有字段",type:"text",field:"title"},{title:"显示",type:"checkbox",checkedAll:!1,disabledAll:!!Q.fieldShowMaxValue,field:"show",fieldShowMaxValue:Q.fieldShowMaxValue},{title:"编辑",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"editable"},{title:"必填",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"required"},{title:"排序",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"sort"},{title:"加粗",type:"checkbox",checkedAll:!1,disabledAll:!1,field:"bold"},{title:"默认排序",type:"select",field:"sortDirection"},{title:"排序优先级",type:"select",field:"sortPriority"},{title:"固定",type:"select",field:"fixedWay"},{title:"自定义标题",type:"input",field:"alias"},{title:"列宽",type:"inputNumber",field:"columnWidth"},{title:"表头筛选",type:"checkbox",isHeadCheckHide:!0,field:"isShowHeaderFilter"},{title:"脱敏配置",type:"select",field:"hideExpression"}],te=[{title:"搜索",type:"checkbox",isHeadCheckHide:!0,field:"isSearch"},{title:"求和",type:"checkbox",isHeadCheckHide:!0,field:"isSum"},{title:"平均值",type:"checkbox",isHeadCheckHide:!0,field:"isAvg"}],oe=l([]),de=i((()=>le.value.flat())),ae=i((()=>de.value.some((e=>e.feildDescribe)))),re=t({columns:oe,data:de,onUpdateChecked:function({checked:e,column:l}){const i=!e||ye(l.field);l.checkedAll=!i},draggable:Q.rowDraggable,isFieldSet:!0,fieldDescribeMode:Q.fieldDescribeMode,developMode:Q.developMode,columnWidthProps:Q.columnWidthProps,hideExpressionOption:o(Q.hideExpressionConfig||{option:[]},"option"),primaryKey:o(Q,"primaryKey"),titleRender:Q.titleRender}),ne={keyword:Z.value,idx:0,startIdx:0},se=()=>{J("save")},ue=()=>{J("close")};function ce(){le.value=fe(),me(),Y.value=Date.now(),J("reset")}function fe(){const e=P(Q.fields).map((e=>({...e,uuid:I()})));return Object.keys(X).forEach((l=>{e.forEach((e=>{var i;"old"==Q.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[X[l]]=1==e[l]:e[X[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1),e.draggable=!!O(e),M(null==(i=e.relation)?void 0:i.fieldList)&&e.relation.fieldList.forEach((e=>{1==e.isSearch&&(e.checked=!0)}))}))})),function(e){if(Q.groupSetting){return q(Q.groupSetting,e).reduce(((i,t)=>{const o=N(t)?e.find((e=>e.name===t)):l(t.children);return o&&i.push(o),i}),[])}return e;function l(i){const t=[];return i.forEach((i=>{if(i.children)t.push(...l(i.children));else{const l=e.find((e=>e.name===i));l&&t.push(l)}})),t}}(e)}function he(){const e=ne.keyword!==Z.value;let l=Z.value?de.value.findIndex(((l,i)=>{var t;if(null==(t=l.title)?void 0:t.includes(Z.value))return!!e||i>ne.idx})):0;-1!==l||e||(l=ne.startIdx),ee.value.scrollTop=52*l,Object.assign(ne,{keyword:Z.value,idx:l},e?{startIdx:l}:{})}function pe(e){var l;return!!Z.value&&(null==(l=e.title)?void 0:l.includes(Z.value))}function me(){var e,l;oe.value=P(ie),(null==(e=Q.showColumnNames)?void 0:e.length)&&(oe.value=ie.concat(te).filter((e=>{var l,i;return"title"===e.field||(null==(i=null==(l=Q.showColumnNames)?void 0:l.includes)?void 0:i.call(l,e.field))}))),(null==(l=Q.customColumns)?void 0:l.length)&&oe.value.push(...Q.customColumns),"column"===Q.fieldDescribeMode&&ae.value&&oe.value.push({title:"字段描述",type:"text",field:"feildDescribe"}),Q.showSeq&&oe.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),oe.value.forEach((e=>{if(e.isShow=function(e){var l,i;if(!(null==(l=Q.showColumnNames)?void 0:l.length)&&(["editable","required"].includes(e.field)&&!Q.isEdit||"sortPriority"===e.field&&!Q.showSortPriority||"isShowHeaderFilter"===e.field&&!Q.showHeadFilter||"hideExpression"===e.field&&!(null==(i=Q.hideExpressionConfig)?void 0:i.show)))return!1;return!0}(e),"checkbox"===e.type){const l=le.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ye(e.field)&&!l}}))}function ye(e){return le.value.flat().some((l=>!j(l,e)&&!l[e]&&"0001"!=l.id))}function ve(e){return!!V(e.relatedContext.element)}return d([()=>Q.fields,()=>{var e;return null==(e=Q.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(le.value=fe(),me())}),{immediate:!0,deep:!0}),z({getTableFields:function(){let e=[];return e="old"==Q.type?de.value.map(((e,l)=>R({...e,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth},["name","show","sort","alias","fixedWay","columnWidth"]))):de.value,e.map((e=>R(e,["uuid"])))}}),(l,i)=>(a(),r("div",U,[e.showSearch?(a(),n(s(C),{key:0,class:"main-wrapper__search-wrapper",value:Z.value,"onUpdate:value":i[0]||(i[0]=e=>Z.value=e),valueModifiers:{trim:!0},placeholder:"请输入字段标题",onKeydown:u(c(he,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",T,[(a(!0),r(p,null,m(oe.value,((l,i)=>(a(),r(p,{key:i},[l.isShow?(a(),r("span",{key:0,class:"table-cell",style:y(s(B)(l,i,e.columnWidthProps))},["checkbox"!==l.type||l.isHeadCheckHide?(a(),r(p,{key:1},[b(g(l.title),1)],64)):(a(),n(s(A),{key:0,checked:l.checkedAll,"onUpdate:checked":[e=>l.checkedAll=e,e=>{return i=e,t=l.field,void de.value.forEach((e=>{j(e,t)||(e[t]=i)}));var i,t}],disabled:l.disabledAll},{default:v((()=>[b(g(l.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===l.field?(a(),n(s(_),{key:2,trigger:"hover"},{trigger:v((()=>[x(s(W),{component:s(K),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[L])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"main-wrapper__table-body",ref_key:"tableBodyRef",ref:ee},[(a(),n(s(D),{modelValue:le.value,"onUpdate:modelValue":i[1]||(i[1]=e=>le.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:ve,disabled:!e.rowDraggable,key:Y.value},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(a(),r("div",{key:0,class:k(["item",s(V)(e)?"":"disabled"]),tabindex:l},[s(M)(e)?(a(!0),r(p,{key:0},m(e,((e,i)=>(a(),n(F,w(re,{key:i,element:e,idx:l+1,"is-highlight":pe(e)}),null,16,["element","idx","is-highlight"])))),128)):(a(),n(F,w({key:1},re,{element:e,idx:l+1,"is-highlight":pe(e)}),null,16,["element","idx","is-highlight"]))],10,G))])),_:1},8,["modelValue","disabled"]))],512),e.footerFlag?(a(),r("div",$,[f(" 底部按钮插槽 "),S(l.$slots,"footer",{},(()=>[x(s(E),{onPositiveClick:ce},{trigger:v((()=>[x(s(H),{style:{"margin-right":"8px"}},{default:v((()=>[b("恢复默认设置")])),_:1})])),default:v((()=>[b(" 确认要恢复系统默认设置吗? ")])),_:1}),x(s(H),{style:{"margin-right":"8px"},onClick:ue},{default:v((()=>[b("取消")])),_:1}),x(s(H),{type:"primary",onClick:se},{default:v((()=>[b("保存")])),_:1})]))])):f("v-if",!0)]))}});export{z as default};
@@ -211,6 +211,7 @@ declare const _default: import("vue").DefineComponent<{
211
211
  isMultiple: (field: string) => boolean;
212
212
  isRender: (field: string) => boolean;
213
213
  isShow: (field: string) => any;
214
+ showRelation: (field: string) => boolean;
214
215
  getSortPriorityOptions: () => {
215
216
  label: string;
216
217
  value: number;
@@ -233,12 +234,15 @@ declare const _default: import("vue").DefineComponent<{
233
234
  NIcon: any;
234
235
  NColorPicker: any;
235
236
  NPopconfirm: any;
237
+ NPopover: any;
238
+ NSpace: any;
236
239
  setStyle: typeof setStyle;
237
240
  setColorInfo: typeof setColorInfo;
238
241
  ReorderTwoOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
239
242
  TrashOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
240
243
  CreateOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
241
244
  HelpCircleOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
245
+ CaretDownOutline: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
242
246
  isFunction: (value: any) => value is (...args: any[]) => any;
243
247
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("edit" | "updateChecked")[], "edit" | "updateChecked", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
244
248
  element: {
@@ -376,9 +380,9 @@ declare const _default: import("vue").DefineComponent<{
376
380
  }>;
377
381
  developMode: boolean;
378
382
  draggable: boolean;
379
- isHighlightRow: boolean;
380
383
  idx: number;
381
384
  isHighlight: boolean;
385
+ isHighlightRow: boolean;
382
386
  isFieldSet: boolean;
383
387
  fieldDescribeMode: "column" | "tooltip";
384
388
  hideExpressionOption: AnyObject[];
@@ -1 +1 @@
1
- import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as r,unref as a,createBlock as o,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,resolveDynamicComponent as p,normalizeClass as m,withDirectives as v,vShow as y,mergeProps as h,createTextVNode as g}from"vue";import{NTooltip as b,NIcon as k,NCheckbox as E,NSelect as x,NColorPicker as S,NInput as D,NInputNumber as T,NPopconfirm as O}from"naive-ui";import{setStyle as R,setColorInfo as w,isShowExplicitRequired as M,isDisable as N}from"../utils/index.js";import{ReorderTwoOutline as P,HelpCircleOutline as U,CreateOutline as j,TrashOutline as A}from"@vicons/ionicons5";import{isFunction as C,isArray as F,range as _}from"lodash-es";import{COLOR_MAP as I}from"../constants/index.js";import{WIDGET_TYPE as H,SELECT_MAP as L,WIDGET_MAP as B,SELECT_TYPE as V,SELECT_DEFAULT_MAP as W,DATE_MAP as q,DATETIME_MAP as K}from"../constants/filter.js";const $={class:"row"},G=["title"],z=c("span",null,"拖拽调整顺序",-1),J={key:0};var Q=e({__name:"table-row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionOption:{type:Array,default:()=>[]},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["updateChecked","edit"],setup(e,{emit:Q}){const X=e,Y=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],Z=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],ee=[{label:"字体",value:"font"},{label:"背景",value:"background"}],te=Object.entries(I).map((([e])=>e));function le(){X.data.splice(X.index,1)}function ie(){Q("edit",X.element)}function ne(){var e;return X.element.feildDescribe||(null==(e=X.element.settingObj)?void 0:e.fieldDescDev)}function re(e){return"seq"===e?X.idx:"optionType"===e?X.element[e]&&X.element.type===H.SELECT?L[X.element[e]]:"":"type"===e?B[X.element[e]]:X.element[e]}function ae(e){if("defaultValue"===e){const{optionType:e}=X.element;return e===V.SELECT_MULTIPLE}return!1}function oe(e){if("0001"==X.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=X.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![H.DATE,H.DATETIME,H.SELECT].includes(X.element.type))}function de(e){return["explicitRequired","defaultValue"].includes(e)?M(X.element):!["isSum","isAvg"].includes(e)||"NUMBER"===X.element.fieldType}function ue(e){if("hideExpression"===e)return"PASSWORD"===X.element.attrType?"密码无需设置":X.element.name===X.primaryKey||X.element.columnName===X.primaryKey?"主键不可设置":X.element[`${e}Disable`]||X.element[`${e}Disabled`]?"不支持脱敏设置":void 0}function se(e){const t={valueField:"value",labelField:"label"};return"hideExpression"===e&&(t.valueField="ruleId",t.labelField="name"),t}function ce(e){var t;switch(e.field){case"fixedWay":return Y;case"sortDirection":return Z;case"sortPriority":return function(){const e=_(1,X.data.length+1).map((e=>({label:e.toString(),value:e}))),t=X.data.filter((e=>!!e.sortPriority&&e.uuid!==X.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return ee;case"hideExpression":return null==(t=X.hideExpressionOption)?void 0:t.map((e=>({...e,ruleId:`ruleId#${e.code}`})));case"defaultValue":{const{type:e,optionInfo:t}=X.element;return e===H.SELECT?F(null==t?void 0:t.list)&&t.list.length>0?t.list.map((e=>({...e,label:e.name}))):Object.entries(W).map((([e,t])=>({value:e,label:t}))):e===H.DATE?Object.entries(q).map((([e,t])=>({value:e,label:t}))):e===H.DATETIME?Object.entries(K).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function fe(e){var t;if(1==X.element.defaultMark||"color"===e.type&&X.isHighlightRow)return!0;if("checkbox"===e.type){if("show"===e.field&&e.fieldShowMaxValue)return!X.element[e.field]&&(null==(t=X.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue;if(["isSearch","isSum","isAvg"].includes(e.field)){if(Reflect.has(X.element,"isMerge"))return 1==X.element.isMerge;if("isSearch"===e.field&&Reflect.has(X.element,"notParticipatingSearch"))return 1==X.element.notParticipatingSearch}return N(X.element,e.field)}if("sortPriority"===e.field){const{sortDirection:e}=X.element;return!e||"NONE"===e}return N(X.element,e.field)}function pe(e){return["title","result"].includes(e.field)&&X.element.style||{}}return(M,N)=>(t(),l("div",$,[(t(!0),l(i,null,n(e.columns,((n,M)=>{return t(),l(i,{key:M},[n.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[n.field],style:r(a(R)(n,M,e.columnWidthProps))},["text"===n.type?(t(),l(i,{key:0},[0===M?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),o(a(b),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(P)},null,8,["component"])])),default:d((()=>[z])),_:1})):s("v-if",!0),(F=n.field,"title"===F&&("tooltip"===X.fieldDescribeMode&&X.element.feildDescribe||X.developMode&&(null==(_=X.element.settingObj)?void 0:_.fieldDescDev))?(t(),o(a(b),{key:1,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(U)},null,8,["component"])])),default:d((()=>[c("span",null,f(ne()),1)])),_:1})):s("v-if",!0)),a(C)(e.titleRender)?(t(),o(p((()=>e.titleRender(e.element))),{key:2})):s("v-if",!0)],64)):s("v-if",!0),0===M&&a(C)(e.titleRender)?s("v-if",!0):(t(),l("span",{key:1,class:m([e.isHighlight&&"title"===n.field?"highlight":""]),style:r(pe(n))},f(re(n.field)),7))],64)):s("v-if",!0),"checkbox"===n.type&&oe(n.field)?v((t(),o(a(E),{key:1,disabled:fe(n),checked:e.element[n.field],"onUpdate:checked":[t=>e.element[n.field]=t,e=>function(e,t){Q("updateChecked",{checked:e,column:t})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[y,de(n.field)]]):s("v-if",!0),"select"===n.type&&oe(n.field)?(t(),l(i,{key:2},[ue(n.field)?(t(),l("span",J,f(ue(n.field)),1)):v((t(),o(a(x),h({key:1},se(n.field),{clearable:"",multiple:ae(n.field),disabled:fe(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,e=>function(e,t){"sortDirection"!==t.field||"NONE"!==e&&e||(X.element.sortPriority=null),"colorScope"===t.field&&w(X.element)}(e,n)],options:ce(n)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[y,de(n.field)]])],64)):s("v-if",!0),"color"===n.type?(t(),o(a(S),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:fe(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,N[0]||(N[0]=t=>a(w)(e.element))],"show-preview":"",modes:["hex"],swatches:a(te)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===n.type?v((t(),o(a(D),{key:4,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[y,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(t(),o(a(T),{key:5,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===n.type&&a(C)(n.contentRender)?(t(),o(p((()=>n.contentRender(n,e.element))),{key:6})):s("v-if",!0),"custom"===n.type&&"opt"===n.field&&1!=e.element.defaultMark?(t(),l(i,{key:7},[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(j),onClick:ie},null,8,["component"])])),default:d((()=>[g(" 编辑 ")])),_:1}),u(a(O),{onPositiveClick:le},{trigger:d((()=>[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(A)},null,8,["component"])])),default:d((()=>[g(" 删除 ")])),_:1})])),default:d((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,G)):s("v-if",!0)],64);var F,_})),128))]))}});export{Q as default};
1
+ import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as r,unref as a,createBlock as o,withCtx as d,createVNode as u,createCommentVNode as s,createElementVNode as c,toDisplayString as f,resolveDynamicComponent as p,normalizeClass as m,withDirectives as v,vShow as y,mergeProps as h,createTextVNode as g}from"vue";import{NTooltip as b,NIcon as k,NCheckbox as x,NPopover as E,NSpace as S,NSelect as D,NColorPicker as w,NInput as T,NInputNumber as O,NPopconfirm as R}from"naive-ui";import{setStyle as M,setColorInfo as N,isShowExplicitRequired as U,isDisable as P}from"../utils/index.js";import{ReorderTwoOutline as _,HelpCircleOutline as j,CaretDownOutline as A,CreateOutline as C,TrashOutline as F}from"@vicons/ionicons5";import{isFunction as L,isArray as I,range as H}from"lodash-es";import{COLOR_MAP as B}from"../constants/index.js";import{WIDGET_TYPE as V,SELECT_MAP as W,WIDGET_MAP as q,SELECT_TYPE as K,SELECT_DEFAULT_MAP as $,DATE_MAP as z,DATETIME_MAP as G}from"../constants/filter.js";const J={class:"row"},Q=["title"],X=c("span",null,"拖拽调整顺序",-1),Y={key:0};var Z=e({__name:"table-row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1},fieldDescribeMode:{type:String,default:"tooltip"},developMode:{type:Boolean},columnWidthProps:{type:Object},hideExpressionOption:{type:Array,default:()=>[]},primaryKey:{type:String,default:"id"},titleRender:{type:Function}},emits:["updateChecked","edit"],setup(e,{emit:Z}){const ee=e,te=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],le=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],ie=[{label:"字体",value:"font"},{label:"背景",value:"background"}],ne=Object.entries(B).map((([e])=>e));function re(){ee.data.splice(ee.index,1)}function ae(){Z("edit",ee.element)}function oe(){var e;return ee.element.feildDescribe||(null==(e=ee.element.settingObj)?void 0:e.fieldDescDev)}function de(e){return"seq"===e?ee.idx:"optionType"===e?ee.element[e]&&ee.element.type===V.SELECT?W[ee.element[e]]:"":"type"===e?q[ee.element[e]]:ee.element[e]}function ue(e){if("defaultValue"===e){const{optionType:e}=ee.element;return e===K.SELECT_MULTIPLE}return!1}function se(e){if("0001"==ee.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=ee.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![V.DATE,V.DATETIME,V.SELECT].includes(ee.element.type))}function ce(e){return["explicitRequired","defaultValue"].includes(e)?U(ee.element):!["isSum","isAvg"].includes(e)||"NUMBER"===ee.element.fieldType}function fe(e){const{relation:t}=ee.element;return"isSearch"===e&&I(null==t?void 0:t.fieldList)&&t.fieldList.length>0}function pe(e){if("hideExpression"===e)return"PASSWORD"===ee.element.attrType?"密码无需设置":ee.element.name===ee.primaryKey||ee.element.columnName===ee.primaryKey?"主键不可设置":ee.element.disableDesensitization||ee.element[`${e}Disabled`]?"不支持脱敏设置":void 0}function me(e){const t={valueField:"value",labelField:"label"};return"hideExpression"===e&&(t.valueField="ruleId",t.labelField="name"),t}function ve(e){var t;switch(e.field){case"fixedWay":return te;case"sortDirection":return le;case"sortPriority":return function(){const e=H(1,ee.data.length+1).map((e=>({label:e.toString(),value:e}))),t=ee.data.filter((e=>!!e.sortPriority&&e.uuid!==ee.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return ie;case"hideExpression":return null==(t=ee.hideExpressionOption)?void 0:t.map((e=>({...e,ruleId:`ruleId#${e.code}`})));case"defaultValue":{const{type:e,optionInfo:t}=ee.element;return e===V.SELECT?I(null==t?void 0:t.list)&&t.list.length>0?t.list.map((e=>({...e,label:e.name}))):Object.entries($).map((([e,t])=>({value:e,label:t}))):e===V.DATE?Object.entries(z).map((([e,t])=>({value:e,label:t}))):e===V.DATETIME?Object.entries(G).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function ye(e){var t;if(1==ee.element.defaultMark||"color"===e.type&&ee.isHighlightRow)return!0;if("checkbox"===e.type){if("show"===e.field&&e.fieldShowMaxValue)return!ee.element[e.field]&&(null==(t=ee.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue;if(["isSearch","isSum","isAvg"].includes(e.field)){if(Reflect.has(ee.element,"isMerge"))return 1==ee.element.isMerge;if("isSearch"===e.field&&Reflect.has(ee.element,"notParticipatingSearch"))return 1==ee.element.notParticipatingSearch}return P(ee.element,e.field)}if("sortPriority"===e.field){const{sortDirection:e}=ee.element;return!e||"NONE"===e}return P(ee.element,e.field)}function he(e){return["title","result"].includes(e.field)&&ee.element.style||{}}return(U,P)=>(t(),l("div",J,[(t(!0),l(i,null,n(e.columns,((U,I)=>{return t(),l(i,{key:I},[U.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[U.field],style:r(a(M)(U,I,e.columnWidthProps))},["text"===U.type?(t(),l(i,{key:0},[0===I?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),o(a(b),{key:0,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(_)},null,8,["component"])])),default:d((()=>[X])),_:1})):s("v-if",!0),(H=U.field,"title"===H&&("tooltip"===ee.fieldDescribeMode&&ee.element.feildDescribe||ee.developMode&&(null==(B=ee.element.settingObj)?void 0:B.fieldDescDev))?(t(),o(a(b),{key:1,trigger:"hover"},{trigger:d((()=>[u(a(k),{style:{"margin-right":"5px",top:"2px"},component:a(j)},null,8,["component"])])),default:d((()=>[c("span",null,f(oe()),1)])),_:1})):s("v-if",!0)),a(L)(e.titleRender)?(t(),o(p((()=>e.titleRender(e.element))),{key:2})):s("v-if",!0)],64)):s("v-if",!0),0===I&&a(L)(e.titleRender)?s("v-if",!0):(t(),l("span",{key:1,class:m([e.isHighlight&&"title"===U.field?"highlight":""]),style:r(he(U))},f(de(U.field)),7))],64)):s("v-if",!0),"checkbox"===U.type&&se(U.field)?(t(),l(i,{key:1},[v(u(a(x),{disabled:ye(U),checked:e.element[U.field],"onUpdate:checked":[t=>e.element[U.field]=t,e=>function(e,t){Z("updateChecked",{checked:e,column:t})}(e,U)]},null,8,["disabled","checked","onUpdate:checked"]),[[y,ce(U.field)]]),fe(U.field)?(t(),o(a(E),{key:0,placement:"right-start","show-arrow":!1},{trigger:d((()=>[u(a(k),{style:{"margin-left":"5px",top:"2px"},component:a(A)},null,8,["component"])])),default:d((()=>[c("div",null,[c("span",null,f(e.element.relation.tableName),1),u(a(S),{"wrap-item":!1,vertical:""},{default:d((()=>[(t(!0),l(i,null,n(e.element.relation.fieldList,(e=>v((t(),o(a(x),{key:e.id,checked:e.checked,"onUpdate:checked":t=>e.checked=t,label:e.title},null,8,["checked","onUpdate:checked","label"])),[[y,"0001"!==e.sid]]))),128))])),_:1})])])),_:1})):s("v-if",!0)],64)):s("v-if",!0),"select"===U.type&&se(U.field)?(t(),l(i,{key:2},[pe(U.field)?(t(),l("span",Y,f(pe(U.field)),1)):v((t(),o(a(D),h({key:1},me(U.field),{clearable:"",multiple:ue(U.field),disabled:ye(U),value:e.element[U.field],"onUpdate:value":[t=>e.element[U.field]=t,e=>function(e,t){"sortDirection"!==t.field||"NONE"!==e&&e||(ee.element.sortPriority=null),"colorScope"===t.field&&N(ee.element)}(e,U)],options:ve(U)}),null,16,["multiple","disabled","value","onUpdate:value","options"])),[[y,ce(U.field)]])],64)):s("v-if",!0),"color"===U.type?(t(),o(a(w),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:ye(U),value:e.element[U.field],"onUpdate:value":[t=>e.element[U.field]=t,P[0]||(P[0]=t=>a(N)(e.element))],"show-preview":"",modes:["hex"],swatches:a(ne)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===U.type?v((t(),o(a(T),{key:4,value:e.element[U.field],"onUpdate:value":t=>e.element[U.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[y,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===U.type?(t(),o(a(O),{key:5,value:e.element[U.field],"onUpdate:value":t=>e.element[U.field]=t},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===U.type&&a(L)(U.contentRender)?(t(),o(p((()=>U.contentRender(U,e.element))),{key:6})):s("v-if",!0),"custom"===U.type&&"opt"===U.field&&1!=e.element.defaultMark?(t(),l(i,{key:7},[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(C),onClick:ae},null,8,["component"])])),default:d((()=>[g(" 编辑 ")])),_:1}),u(a(R),{onPositiveClick:re},{trigger:d((()=>[u(a(b),{trigger:"hover"},{trigger:d((()=>[u(a(k),{component:a(F)},null,8,["component"])])),default:d((()=>[g(" 删除 ")])),_:1})])),default:d((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,Q)):s("v-if",!0)],64);var H,B})),128))]))}});export{Z as default};
@@ -1 +1 @@
1
- import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,castArray as n,pick as i}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as l}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{traverseSchema as a,fieldKeyEscape as p,createLinebarId as c}from"../utils/schema.js";import{useFormValidator as d}from"./useFormValidator.js";import{transformDateFormat as m}from"../utils/business.js";function u(e,o){Object.assign(e["x-component-props"],{...i(o,["wordbook","autograph"])})}function f(e,o){Object.assign(e["x-component-props"],{...i(o,["urlConfig","wordbook"])})}function x(e){return"1"===e||!0===e}function _(n,_){const{createValidatorSchema:b}=d(),g=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=b(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},v=e=>{var o,t,n,l,s,a,p,c,d,m,_,h,b,v;const y=g(e);e.urlConfig?f(y,e):e.autograph&&u(y,e);const w=!!e.__multiple,C=x(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=x(null!=(l=null==(n=e.componentProps)?void 0:n.selectAll)?l:e.selectAll),A=x(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=x(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(m=null==(d=e.componentProps)?void 0:d.showField)?m:e.show_key,k=null!=(h=null==(_=e.componentProps)?void 0:_.options)?h:e.option,N=null!=(v=r(e.multi_select_value))?v:null==(b=e.componentProps)?void 0:b.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...i(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},y=e=>{var o,t;const n=g(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?f(n,e):e.autograph&&u(n,e),n},w=e=>{const t=g(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},C=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:c(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),O=new Map([["LINEBAR",C],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=g(e);return Object.assign(o["x-component-props"],{...i(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=g(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=g(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:r(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",v],["REMOTE_SEARCH",v],["DATE",e=>{const o=g(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=g(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=g(e);return Object.assign(o["x-component-props"],{...i(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=g(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=g(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",y],["CHECKBOX",y],["SWITCH",e=>{const o=g(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=g(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=g(e);Array.isArray(e.properties)&&l("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?N(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],i(e,["wrapperStyle","display"])),o}]]),A=e=>{if(e.suffixConfig||e.prefixConfig)return E(e);return(O.get(e.html_type)||w)(e)},E=o=>{if(!o.suffixConfig&&!o.prefixConfig)return A(o);const t=g(o),n=o.suffixConfig?e(o.suffixConfig):[],i=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show}))),{...o,hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...n.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show})))],r=i.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(t,{type:"void",name:p(i),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...t["x-decorator-props"],showFeedback:!1,suffixFields:i.map((e=>e.val_key))},properties:N(i)}),t},{FieldNormalizeWaterfallHook:j,FieldListNormalizeWaterfallHook:k}=s();function N(o,i={column:9999}){let r=null;const l=k.call(t(o),i).reduce(((e,o,l)=>{var a;const p=null==(a=(o=j.call(o,i)).validate)?void 0:a.obj_type;return p&&n&&n.collect(p,t(o)),"LINEBAR"===o.html_type?(e[c(o)]=s(C(o),l),r=e[c(o)].properties={}):r?r[c(o)]=s(A(o),l):(r=null,e[c(o)]=s(A(o),l)),e}),{});return i.linebarAutoHidden&&Object.values(l).forEach((e=>{"LINEBAR"===e["x-component"]&&h(e)})),a({properties:l,"x-root":!0},((e,o)=>{"INPUT_GROUP"===e["x-component"]&&h(e,!!o&&!o["x-root"])})),l;function s(e,o){return e["x-index"]=o,e["x-decorator-props"]={_index:o,...e["x-decorator-props"]},e}function c(o){if(o.suffixConfig||o.prefixConfig){const t=[...e(o.prefixConfig),o,...e(o.suffixConfig)].filter(Boolean);return p(t)}return o.val_key}}return{schemaAdaptor:N}}function h(e,o=!1){e["x-reactions"]?e["x-reactions"]=n(e["x-reactions"]):e["x-reactions"]=[];const t=Object.keys(e.properties||{}).map((t=>`${o?"*.":""}${e.name}.${t}#selfDisplay`));e["x-reactions"].push({dependencies:t,fulfill:{state:{visible:"{{hasVisible($deps)}}"}}})}export{_ as useFieldListAdaptor};
1
+ import{arrayed as e,deepOmit as o}from"../../../../shared/utils/index.js";import{cloneDeep as t,castArray as n,pick as i}from"lodash-es";import"../../index.js";import{parseNumberFromMaybeString as r,formRenderLog as l}from"../utils/index.js";import{useFieldNormalize as s}from"./useFieldNormalize.js";import{traverseSchema as a,fieldKeyEscape as p,createLinebarId as c}from"../utils/schema.js";import{useFormValidator as d}from"./useFormValidator.js";import{transformDateFormat as m}from"../utils/business.js";function u(e,o){Object.assign(e["x-component-props"],{...i(o,["wordbook","autograph"])})}function f(e,o){Object.assign(e["x-component-props"],{...i(o,["urlConfig","wordbook"])})}function x(e){return"1"===e||!0===e}function _(n,_){const{createValidatorSchema:b}=d(),g=e=>{var o;const t={name:e.val_key,type:null!=(o=e.fieldType)?o:"string",title:e.alias||e.name,"x-component":e.html_type,default:e.default_val,"x-component-props":{placeholder:e.placeholder,clearable:"0"===e.is_empty,...e.componentProps||{}},"x-content":e.slots,"x-display":"0"===e.is_show?"hidden":"visible","x-pattern":"0"===e.is_edit?"disabled":"editable","x-compile-omitted":["title","x-component-props","x-decorator-props"]};e.reactions&&(t["x-reactions"]=e.reactions),e.noDecorator||Object.assign(t,{"x-decorator":"FORM_ITEM","x-decorator-props":{fieldItem:e,beforeSetValue:null==_?void 0:_.beforeSetValue,span:2*(e.elem_width||3),showLabel:"1"!==e.hide_title,remark:e.remark,propertyKey:e.val_key,annotation:e.annotation,...e.decoratorProps||{}}});const n=b(e);return n&&(t["x-validator"]=n),"0"===e.is_null&&(t.required=!0),t},v=e=>{var o,t,n,l,s,a,p,c,d,m,_,h,b,v;const y=g(e);e.urlConfig?f(y,e):e.autograph&&u(y,e);const w=!!e.__multiple,C=x(null!=(t=null==(o=e.componentProps)?void 0:o.allowModify)?t:e.allowModify),O=x(null!=(l=null==(n=e.componentProps)?void 0:n.selectAll)?l:e.selectAll),A=x(null!=(a=null==(s=e.componentProps)?void 0:s.shouldSave)?a:e.save_free_entry),E=x(null!=(c=null==(p=e.componentProps)?void 0:p.allowCreate)?c:e.free_entry),j=null!=(m=null==(d=e.componentProps)?void 0:d.showField)?m:e.show_key,k=null!=(h=null==(_=e.componentProps)?void 0:_.options)?h:e.option,N=null!=(v=r(e.multi_select_value))?v:null==(b=e.componentProps)?void 0:b.maxTagCount;return Object.assign(y["x-component-props"],{multiple:w,options:k,allowModify:C,allowCreate:E||C,shouldSave:A,showField:j,maxTagCount:N,selectAll:O,...i(e,["lazyRequest","requestCache"])}),w&&(y.type="array"),y},y=e=>{var o,t;const n=g(e),i=null!=(t=null==(o=e.componentProps)?void 0:o.selectAll)?t:e.selectAll;return Object.assign(n["x-component-props"],{options:e.option,childFieldStrategy:e.childFieldStrategy,childWidthMode:e.childWidthMode,vertical:e.__vertical,selectAll:"1"===i||!0===i}),e.urlConfig?f(n,e):e.autograph&&u(n,e),n},w=e=>{const t=g(e);return Object.assign(t["x-component-props"],{fieldItem:o(e,["reactions"])}),t},C=e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINEBAR","x-display":"visible","x-component-props":{linebarTextDirection:e.linebarTextDirection,linebarDirection:e.linebarDirection,linebarWidth:e.linebarWidth,disabled:"1"===e.is_not_fold,id:c(e.val_key),show:"0"!==e.is_show,remark:e.remark},"x-content":e.slots}),O=new Map([["LINEBAR",C],["LINE_BREAKS",e=>({name:e.val_key,type:"void",title:e.alias||e.name,"x-component":"LINE_BREAKS","x-component-props":{border:e.lineBreaksBorder},"x-display":"0"===e.is_show?"hidden":"visible"})],["INPUT",e=>{const o=g(e);return Object.assign(o["x-component-props"],{...i(e,["prefix","suffix"])}),o}],["TEXTAREA",e=>{const o=g(e);return Object.assign(o["x-component-props"],{rows:e.initialize_high||3}),o}],["INPUT_NUMBER",e=>{const o=g(e),{decimal_length:t,validate:n,allowSlash:i}=e;return!0!==i&&"1"!==i||(o["x-component"]="INPUT_NUMBER_SLASH",o.type="string"),Object.assign(o["x-component-props"],{precision:r(null!=t?t:null==n?void 0:n.decimal_length),whiteList:e.whiteList,prefix:e.prefix,suffix:e.suffix}),o}],["SELECT",v],["REMOTE_SEARCH",v],["DATE",e=>{const o=g(e);return Object.assign(o["x-component-props"],{valueFormat:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["TIME",e=>{const o=g(e);return Object.assign(o["x-component-props"],{format:e.date_format,type:m(e.date_format),validate:e.validate}),o}],["LEVEL_SEARCH_CASCADER",e=>{const o=g(e);return Object.assign(o["x-component-props"],{...i(e,["wordbook","lazyRequest","autograph"])}),"1"===e.is_allow_check_mid&&e.allow_check_mid_level&&(o["x-component-props"].checkAbleLevel=+e.allow_check_mid_level),o}],["SEARCH_CASCADER",e=>{var o;const t=g(e);return Object.assign(t["x-component-props"],{urlConfig:e.urlConfig,depth:null==(o=e.wordbook)?void 0:o.level_num,options:e.option}),t}],["COMBINATION",e=>{const o=g(e);return o.type="array","table"===e.displayMode?o["x-component"]="TABLE_COMBINATION":!1!==e.jsonCombination&&(o["x-component"]="JSON_COMBINATION"),Object.assign(o["x-decorator-props"],{showLabel:!1,showFeedback:!1}),Object.assign(o["x-component-props"],{title:e.alias||e.name,maxGroupNum:e.maxGroupNum,minGroupNum:e.minGroupNum,showLabel:"1"!==e.hide_title,properties:e.children||[],combinationItemDeletable:e.combinationItemDeletable}),o}],["RADIO",y],["CHECKBOX",y],["SWITCH",e=>{const o=g(e);return Object.assign(o["x-component-props"],{openDescription:e.open,closeDescription:e.close,showMode:e.show_mode}),o}],["SLIDER",e=>{const o=g(e);return Object.assign(o["x-component-props"],{step:r(e.step_length),max:r(e.max_length),min:r(e.min_length),option:e.option}),o}],["COMPLEX",e=>{const o=g(e);Array.isArray(e.properties)&&l("COMPLEX控件的properties属性已经废弃, 请使用children作为替代, 在之后的版本中properties属性将不再支持");const t=Array.isArray(e.properties||e.children)?N(e.properties||e.children):{};return o.type=e.fieldType||"void",o.properties=t,Object.assign(o["x-decorator-props"],{showFeedback:!1}),Object.assign(o["x-component-props"],i(e,["wrapperStyle","display"])),o}]]),A=e=>{if(e.suffixConfig||e.prefixConfig)return E(e);return(O.get(e.html_type)||w)(e)},E=o=>{if(!o.suffixConfig&&!o.prefixConfig)return A(o);const t=g(o),n=o.suffixConfig?e(o.suffixConfig):[],i=[...(o.prefixConfig?e(o.prefixConfig):[]).map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show}))),{...o,hide_title:"1",suffixConfig:void 0,prefixConfig:void 0},...n.map((e=>({elem_width:o.elem_width,...e,hide_title:"1",is_show:o.is_show})))],r=i.reduce(((e,o)=>e+2*(o.elem_width||3)),0);return Object.assign(t,{type:"void",name:p(i),title:o.alias||o.name,"x-component":"INPUT_GROUP","x-component-props":{span:r},"x-decorator-props":{...t["x-decorator-props"],showFeedback:!1,suffixFields:i.map((e=>e.val_key))},properties:N(i)}),t},{FieldNormalizeWaterfallHook:j,FieldListNormalizeWaterfallHook:k}=s();function N(o,i={column:9999}){let r=null;const l=k.call(t(o),i).reduce(((e,o,l)=>{var a;const p=null==(a=(o=j.call(o,i)).validate)?void 0:a.obj_type;return p&&n&&n.collect(p,t(o)),"LINEBAR"===o.html_type?(e[c(o)]=s(C(o),l),r=e[c(o)].properties={}):r?r[c(o)]=s(A(o),l):(r=null,e[c(o)]=s(A(o),l)),e}),{});return i.linebarAutoHidden&&Object.values(l).forEach((e=>{"LINEBAR"===e["x-component"]&&h(e)})),a({properties:l,"x-root":!0},((e,o)=>{"INPUT_GROUP"===e["x-component"]&&h(e,!!o&&!o["x-root"])})),l;function s(e,o){return e["x-index"]=o,e["x-decorator-props"]={_index:o,...e["x-decorator-props"]},e}function c(o){if(o.suffixConfig||o.prefixConfig){const t=[...e(o.prefixConfig),o,...e(o.suffixConfig)].filter(Boolean);return p(t)}return o.val_key}}return{schemaAdaptor:N}}function h(e,o=!1){e["x-reactions"]?e["x-reactions"]=n(e["x-reactions"]):e["x-reactions"]=[];const t=Object.keys(e.properties||{}).map((t=>`${o?"*.":"."}${e.name}.${t}#selfDisplay`));e["x-reactions"].push({dependencies:t,fulfill:{state:{visible:"{{hasVisible($deps)}}"}}})}export{_ as useFieldListAdaptor};
@@ -343,6 +343,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
343
343
  };
344
344
  defaultValue: {
345
345
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
346
+ default: () => never[];
346
347
  };
347
348
  }, {
348
349
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -363,6 +364,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
363
364
  };
364
365
  defaultValue: {
365
366
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
367
+ default: () => never[];
366
368
  };
367
369
  }>> & {
368
370
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -425,10 +427,12 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
425
427
  };
426
428
  defaultValue: {
427
429
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
430
+ default: () => never[];
428
431
  };
429
432
  }>> & {
430
433
  onComfirm?: ((...args: any[]) => any) | undefined;
431
434
  }, {
435
+ defaultValue: import("../../shared/types").AnyObject[];
432
436
  mode: string;
433
437
  title: string;
434
438
  disabledIds: string[];
@@ -659,6 +663,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
659
663
  };
660
664
  defaultValue: {
661
665
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
666
+ default: () => never[];
662
667
  };
663
668
  }, {
664
669
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -679,6 +684,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
679
684
  };
680
685
  defaultValue: {
681
686
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
687
+ default: () => never[];
682
688
  };
683
689
  }>> & {
684
690
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -741,10 +747,12 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
741
747
  };
742
748
  defaultValue: {
743
749
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
750
+ default: () => never[];
744
751
  };
745
752
  }>> & {
746
753
  onComfirm?: ((...args: any[]) => any) | undefined;
747
754
  }, {
755
+ defaultValue: import("../../shared/types").AnyObject[];
748
756
  mode: string;
749
757
  title: string;
750
758
  disabledIds: string[];
@@ -1033,6 +1041,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1033
1041
  };
1034
1042
  defaultValue: {
1035
1043
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1044
+ default: () => never[];
1036
1045
  };
1037
1046
  }, {
1038
1047
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1053,6 +1062,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1053
1062
  };
1054
1063
  defaultValue: {
1055
1064
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1065
+ default: () => never[];
1056
1066
  };
1057
1067
  }>> & {
1058
1068
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -1115,10 +1125,12 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1115
1125
  };
1116
1126
  defaultValue: {
1117
1127
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1128
+ default: () => never[];
1118
1129
  };
1119
1130
  }>> & {
1120
1131
  onComfirm?: ((...args: any[]) => any) | undefined;
1121
1132
  }, {
1133
+ defaultValue: import("../../shared/types").AnyObject[];
1122
1134
  mode: string;
1123
1135
  title: string;
1124
1136
  disabledIds: string[];
@@ -1225,6 +1237,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1225
1237
  };
1226
1238
  defaultValue: {
1227
1239
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1240
+ default: () => never[];
1228
1241
  };
1229
1242
  }, {
1230
1243
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1245,6 +1258,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1245
1258
  };
1246
1259
  defaultValue: {
1247
1260
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1261
+ default: () => never[];
1248
1262
  };
1249
1263
  }>> & {
1250
1264
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -1307,10 +1321,12 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1307
1321
  };
1308
1322
  defaultValue: {
1309
1323
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1324
+ default: () => never[];
1310
1325
  };
1311
1326
  }>> & {
1312
1327
  onComfirm?: ((...args: any[]) => any) | undefined;
1313
1328
  }, {
1329
+ defaultValue: import("../../shared/types").AnyObject[];
1314
1330
  mode: string;
1315
1331
  title: string;
1316
1332
  disabledIds: string[];
@@ -1448,6 +1464,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1448
1464
  };
1449
1465
  defaultValue: {
1450
1466
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1467
+ default: () => never[];
1451
1468
  };
1452
1469
  }, {
1453
1470
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1468,6 +1485,7 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1468
1485
  };
1469
1486
  defaultValue: {
1470
1487
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1488
+ default: () => never[];
1471
1489
  };
1472
1490
  }>> & {
1473
1491
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -1530,10 +1548,12 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1530
1548
  };
1531
1549
  defaultValue: {
1532
1550
  type: import("vue").PropType<import("../../shared/types").AnyObject[]>;
1551
+ default: () => never[];
1533
1552
  };
1534
1553
  }>> & {
1535
1554
  onComfirm?: ((...args: any[]) => any) | undefined;
1536
1555
  }, {
1556
+ defaultValue: import("../../shared/types").AnyObject[];
1537
1557
  mode: string;
1538
1558
  title: string;
1539
1559
  disabledIds: string[];
@@ -348,6 +348,7 @@ declare const _default: import("vue").DefineComponent<{
348
348
  };
349
349
  defaultValue: {
350
350
  type: PropType<AnyObject[]>;
351
+ default: () => never[];
351
352
  };
352
353
  }, {
353
354
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -368,6 +369,7 @@ declare const _default: import("vue").DefineComponent<{
368
369
  };
369
370
  defaultValue: {
370
371
  type: PropType<AnyObject[]>;
372
+ default: () => never[];
371
373
  };
372
374
  }>> & {
373
375
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -430,10 +432,12 @@ declare const _default: import("vue").DefineComponent<{
430
432
  };
431
433
  defaultValue: {
432
434
  type: PropType<AnyObject[]>;
435
+ default: () => never[];
433
436
  };
434
437
  }>> & {
435
438
  onComfirm?: ((...args: any[]) => any) | undefined;
436
439
  }, {
440
+ defaultValue: AnyObject[];
437
441
  mode: string;
438
442
  title: string;
439
443
  disabledIds: string[];
@@ -664,6 +668,7 @@ declare const _default: import("vue").DefineComponent<{
664
668
  };
665
669
  defaultValue: {
666
670
  type: PropType<AnyObject[]>;
671
+ default: () => never[];
667
672
  };
668
673
  }, {
669
674
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -684,6 +689,7 @@ declare const _default: import("vue").DefineComponent<{
684
689
  };
685
690
  defaultValue: {
686
691
  type: PropType<AnyObject[]>;
692
+ default: () => never[];
687
693
  };
688
694
  }>> & {
689
695
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -746,10 +752,12 @@ declare const _default: import("vue").DefineComponent<{
746
752
  };
747
753
  defaultValue: {
748
754
  type: PropType<AnyObject[]>;
755
+ default: () => never[];
749
756
  };
750
757
  }>> & {
751
758
  onComfirm?: ((...args: any[]) => any) | undefined;
752
759
  }, {
760
+ defaultValue: AnyObject[];
753
761
  mode: string;
754
762
  title: string;
755
763
  disabledIds: string[];
@@ -1038,6 +1046,7 @@ declare const _default: import("vue").DefineComponent<{
1038
1046
  };
1039
1047
  defaultValue: {
1040
1048
  type: PropType<AnyObject[]>;
1049
+ default: () => never[];
1041
1050
  };
1042
1051
  }, {
1043
1052
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1058,6 +1067,7 @@ declare const _default: import("vue").DefineComponent<{
1058
1067
  };
1059
1068
  defaultValue: {
1060
1069
  type: PropType<AnyObject[]>;
1070
+ default: () => never[];
1061
1071
  };
1062
1072
  }>> & {
1063
1073
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -1120,10 +1130,12 @@ declare const _default: import("vue").DefineComponent<{
1120
1130
  };
1121
1131
  defaultValue: {
1122
1132
  type: PropType<AnyObject[]>;
1133
+ default: () => never[];
1123
1134
  };
1124
1135
  }>> & {
1125
1136
  onComfirm?: ((...args: any[]) => any) | undefined;
1126
1137
  }, {
1138
+ defaultValue: AnyObject[];
1127
1139
  mode: string;
1128
1140
  title: string;
1129
1141
  disabledIds: string[];
@@ -1230,6 +1242,7 @@ declare const _default: import("vue").DefineComponent<{
1230
1242
  };
1231
1243
  defaultValue: {
1232
1244
  type: PropType<AnyObject[]>;
1245
+ default: () => never[];
1233
1246
  };
1234
1247
  }, {
1235
1248
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1250,6 +1263,7 @@ declare const _default: import("vue").DefineComponent<{
1250
1263
  };
1251
1264
  defaultValue: {
1252
1265
  type: PropType<AnyObject[]>;
1266
+ default: () => never[];
1253
1267
  };
1254
1268
  }>> & {
1255
1269
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -1312,10 +1326,12 @@ declare const _default: import("vue").DefineComponent<{
1312
1326
  };
1313
1327
  defaultValue: {
1314
1328
  type: PropType<AnyObject[]>;
1329
+ default: () => never[];
1315
1330
  };
1316
1331
  }>> & {
1317
1332
  onComfirm?: ((...args: any[]) => any) | undefined;
1318
1333
  }, {
1334
+ defaultValue: AnyObject[];
1319
1335
  mode: string;
1320
1336
  title: string;
1321
1337
  disabledIds: string[];
@@ -1453,6 +1469,7 @@ declare const _default: import("vue").DefineComponent<{
1453
1469
  };
1454
1470
  defaultValue: {
1455
1471
  type: PropType<AnyObject[]>;
1472
+ default: () => never[];
1456
1473
  };
1457
1474
  }, {
1458
1475
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -1473,6 +1490,7 @@ declare const _default: import("vue").DefineComponent<{
1473
1490
  };
1474
1491
  defaultValue: {
1475
1492
  type: PropType<AnyObject[]>;
1493
+ default: () => never[];
1476
1494
  };
1477
1495
  }>> & {
1478
1496
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -1535,10 +1553,12 @@ declare const _default: import("vue").DefineComponent<{
1535
1553
  };
1536
1554
  defaultValue: {
1537
1555
  type: PropType<AnyObject[]>;
1556
+ default: () => never[];
1538
1557
  };
1539
1558
  }>> & {
1540
1559
  onComfirm?: ((...args: any[]) => any) | undefined;
1541
1560
  }, {
1561
+ defaultValue: AnyObject[];
1542
1562
  mode: string;
1543
1563
  title: string;
1544
1564
  disabledIds: string[];
@@ -18,6 +18,7 @@ declare const _default: import("vue").DefineComponent<{
18
18
  };
19
19
  defaultValue: {
20
20
  type: PropType<AnyObject[]>;
21
+ default: () => never[];
21
22
  };
22
23
  }, {
23
24
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -38,6 +39,7 @@ declare const _default: import("vue").DefineComponent<{
38
39
  };
39
40
  defaultValue: {
40
41
  type: PropType<AnyObject[]>;
42
+ default: () => never[];
41
43
  };
42
44
  }>> & {
43
45
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -100,10 +102,12 @@ declare const _default: import("vue").DefineComponent<{
100
102
  };
101
103
  defaultValue: {
102
104
  type: PropType<AnyObject[]>;
105
+ default: () => never[];
103
106
  };
104
107
  }>> & {
105
108
  onComfirm?: ((...args: any[]) => any) | undefined;
106
109
  }, {
110
+ defaultValue: AnyObject[];
107
111
  mode: string;
108
112
  title: string;
109
113
  disabledIds: string[];
@@ -1 +1 @@
1
- import{defineComponent as e,ref as a,computed as l,watch as t,openBlock as i,createElementBlock as o,Fragment as r,createVNode as s,unref as u,withCtx as n,createElementVNode as d,createCommentVNode as v,isRef as c,renderList as p,createBlock as m,toDisplayString as f,createTextVNode as h,renderSlot as b}from"vue";import{NModal as g,NInput as I,NIcon as k,NCheckbox as y,NCheckboxGroup as w,NSpace as _,NAvatar as S,NTag as x,NTooltip as j,NButton as U}from"naive-ui";import{SearchOutline as C,AddOutline as L}from"@vicons/ionicons5";import{useState as A}from"../hooks/useState.js";import{useSession as R}from"../hooks/useSession.js";import{CHAT_TYPE as V}from"../constants/index.js";import"trtc-sdk-v5";import{listSort as E}from"../utils/index.js";import{groupLeaveApi as G,groupJoinApi as N,groupCreateApi as $}from"../api/index.js";import{cloneDeep as M,union as T,unionBy as z,remove as D,isArray as P,uniqBy as q,trim as B}from"lodash-es";import{useSearchUserList as F}from"../hooks/useSearchUserList.js";const H={class:"iho-chat-dialog__content iho-chat-add-wrapper"},J={key:0,class:"input-box"},K=d("span",null,"群名称:",-1),O={class:"transfer-box"},Q={class:"transfer-box__left"},W={class:"user-list-box"},X={key:1,class:"no-data"},Y={class:"transfer-box__right"},Z={class:"checked-tag-box"};var ee=e({__name:"ChatAdd",props:{title:{type:String,default:"添加新成员"},mode:{type:String,default:"select"},options:{type:Array},disabledIds:{type:Array,default:()=>[]},defaultValue:{type:Array}},emits:["comfirm"],setup(e,{emit:ee}){const ae=e,{state:le}=A(),{setCurrentSessionItem:te}=R(le),ie=a(),oe=a(""),re=a(!1),se=a([]),ue=a([]),ne=a(""),de=a([]),{userList:ve,handleInput:ce}=F({wrapperRef:ie,keywordRef:oe,before:()=>{ve.value=M(ue.value),Ie()},after:()=>{ve.value.forEach((e=>{var a;e.disabled=null==(a=pe.value)?void 0:a.includes(e.id)})),Ie()}}),pe=l((()=>T(ae.disabledIds,[le.userInfo.id]))),me=l((()=>{var e,a;return(null==(e=le.sessionList)?void 0:e.length)?null==(a=E(le.sessionList).filter((e=>e.chatType===V.SINGLE)))?void 0:a.map((e=>({id:e.receiver,name:e.name,avatar:e.avatar}))):[]})),fe=l((()=>se.value.length?se.value.map((e=>e.id)):[])),he=l((()=>"create"===ae.mode?fe.value.length<3:fe.value.length<1)),be=l({get:()=>de.value.length===ve.value.filter((e=>!e.disabled)).length,set(e){const a=ve.value.filter((e=>!e.disabled));de.value=e?a.map((e=>e.id)):[],e?se.value=z(se.value,a,"id"):D(se.value,(e=>a.map((e=>e.id)).includes(e.id)))}});async function ge(){switch(ae.mode){case"create":await $({creator:le.userInfo.id,memberIdSet:fe.value,name:B(ne.value),orgId:le.orgId});break;case"join":if(await N({groupId:le.currentSessionItem.receiver,operator:le.userInfo.id,memberIdSet:fe.value}),!le.currentSessionItem.defaultName){const e=se.value.map((e=>e.name)).join(",");te({name:`${le.currentSessionItem.name},${e}`})}le.currentGroupUser.push(...ve.value.filter((e=>fe.value.includes(e.id))));break;case"remove":if(await G({dissolution:!1,groupId:le.currentSessionItem.receiver,operator:le.userInfo.id,memberIdSet:fe.value}),!le.currentSessionItem.defaultName){const e=se.value.map((e=>e.name)).join(","),a=new RegExp(e,"g");te({name:le.currentSessionItem.name.replace(a,"")})}D(le.currentGroupUser,(e=>fe.value.includes(e.id)));break;default:ee("comfirm",fe.value)}re.value=!1}function Ie(){var e,a;de.value=null!=(a=null==(e=ve.value.filter((e=>fe.value.includes(e.id))))?void 0:e.map((e=>e.id)))?a:[]}function ke(e,a){if("check"===a.actionType){const e=ve.value.find((e=>e.id===a.value));se.value.push(e)}else D(se.value,(e=>e.id===a.value))}return t((()=>re.value),(e=>{if(!e)return;oe.value="",ne.value="";const a=P(ae.options)&&ae.options.length?ae.options:me.value;ue.value=q(a,"id").map((e=>{var a;return{...e,disabled:null==(a=pe.value)?void 0:a.includes(e.id)}})),ve.value=M(ue.value),P(ae.defaultValue)&&ae.defaultValue.length?(se.value=M(ae.defaultValue),Ie()):(se.value=[],de.value=[])})),(a,l)=>(i(),o(r,null,[s(u(g),{preset:"dialog",title:e.title,"show-icon":!1,"auto-focus":!1,"trap-focus":!1,class:"iho-chat-dialog",show:re.value,"onUpdate:show":l[4]||(l[4]=e=>re.value=e),"negative-text":"取消","positive-text":"确定","display-directive":"show","positive-button-props":{disabled:u(he)},onPositiveClick:ge},{default:n((()=>[d("div",H,["create"===e.mode?(i(),o("div",J,[K,s(u(I),{clearable:"",placeholder:"取个群名称方便后续搜索",value:ne.value,"onUpdate:value":l[0]||(l[0]=e=>ne.value=e),valueModifiers:{trim:!0}},null,8,["value"])])):v("v-if",!0),d("div",O,[d("div",Q,[s(u(I),{placeholder:"搜索",clearable:"",value:oe.value,"onUpdate:value":[l[1]||(l[1]=e=>oe.value=e),u(ce)],valueModifiers:{trim:!0}},{prefix:n((()=>[s(u(k),{component:u(C)},null,8,["component"])])),_:1},8,["value","onUpdate:value"]),d("div",W,[u(ve).length>0?(i(),o(r,{key:0},[s(u(y),{label:"全选",checked:u(be),"onUpdate:checked":l[2]||(l[2]=e=>c(be)?be.value=e:null)},null,8,["checked"]),s(u(w),{ref_key:"listRef",ref:ie,value:de.value,"onUpdate:value":[l[3]||(l[3]=e=>de.value=e),ke]},{default:n((()=>[(i(!0),o(r,null,p(u(ve),(e=>(i(),m(u(y),{key:e.id,value:e.id,disabled:e.disabled},{default:n((()=>[s(u(_),{align:"center","wrap-item":!1},{default:n((()=>[s(u(S),{src:e.avatar,round:"",size:32},null,8,["src"]),d("span",null,f(e.name),1)])),_:2},1024)])),_:2},1032,["value","disabled"])))),128))])),_:1},8,["value"])],64)):(i(),o("div",X,"找不到相关结果"))])]),d("div",Y,[d("span",null,"已选择 "+f(u(fe).length)+" 人",1),d("div",Z,[(i(!0),o(r,null,p(se.value,(e=>(i(),m(u(x),{key:e.id,bordered:!1,closable:e.id!==u(le).userInfo.id,disabled:u(pe).includes(e.id),onClose:()=>{return a=e.id,D(se.value,(e=>e.id===a)),void D(de.value,(e=>e===a));var a}},{avatar:n((()=>[s(u(S),{round:"",src:e.avatar},null,8,["src"])])),default:n((()=>[h(" "+f(e.name),1)])),_:2},1032,["closable","disabled","onClose"])))),128))])])])])])),_:1},8,["title","show","positive-button-props"]),d("span",{class:"btn-wrapper",onClick:l[5]||(l[5]=e=>re.value=!0)},[b(a.$slots,"trigger",{},(()=>[s(u(j),{"show-arrow":!1,placement:"bottom"},{trigger:n((()=>[s(u(U),{color:"#ffffff4D",class:"add-btn"},{icon:n((()=>[s(u(k),{component:u(L),color:"#fff"},null,8,["component"])])),_:1})])),default:n((()=>[h(" "+f(e.title),1)])),_:1})]))])],64))}});export{ee as default};
1
+ import{defineComponent as e,ref as a,computed as l,watch as t,openBlock as i,createElementBlock as u,Fragment as o,createVNode as r,unref as s,withCtx as n,createElementVNode as d,createCommentVNode as v,isRef as c,renderList as p,createBlock as m,toDisplayString as f,createTextVNode as h,renderSlot as b}from"vue";import{NModal as g,NInput as I,NIcon as k,NCheckbox as y,NCheckboxGroup as w,NSpace as _,NAvatar as S,NTag as x,NTooltip as j,NButton as U}from"naive-ui";import{SearchOutline as C,AddOutline as L}from"@vicons/ionicons5";import{useState as V}from"../hooks/useState.js";import{useSession as A}from"../hooks/useSession.js";import{CHAT_TYPE as R}from"../constants/index.js";import"trtc-sdk-v5";import{listSort as E}from"../utils/index.js";import{groupLeaveApi as G,groupJoinApi as N,groupCreateApi as $}from"../api/index.js";import{cloneDeep as M,union as T,intersection as z,unionBy as D,remove as P,isArray as q,uniqBy as B,trim as F}from"lodash-es";import{useSearchUserList as H}from"../hooks/useSearchUserList.js";const J={class:"iho-chat-dialog__content iho-chat-add-wrapper"},K={key:0,class:"input-box"},O=d("span",null,"群名称:",-1),Q={class:"transfer-box"},W={class:"transfer-box__left"},X={class:"user-list-box"},Y={key:1,class:"no-data"},Z={class:"transfer-box__right"},ee={class:"checked-tag-box"};var ae=e({__name:"ChatAdd",props:{title:{type:String,default:"添加新成员"},mode:{type:String,default:"select"},options:{type:Array},disabledIds:{type:Array,default:()=>[]},defaultValue:{type:Array,default:()=>[]}},emits:["comfirm"],setup(e,{emit:ae}){const le=e,{state:te}=V(),{setCurrentSessionItem:ie}=A(te),ue=a(),oe=a(""),re=a(!1),se=a([]),ne=a([]),de=a(""),ve=a([]),{userList:ce,handleInput:pe}=H({wrapperRef:ue,keywordRef:oe,before:()=>{ce.value=M(ne.value),ke()},after:()=>{ce.value.forEach((e=>{var a;e.disabled=null==(a=me.value)?void 0:a.includes(e.id)})),ke()}}),me=l((()=>T(le.disabledIds,[te.userInfo.id]))),fe=l((()=>{var e,a;return(null==(e=te.sessionList)?void 0:e.length)?null==(a=E(te.sessionList).filter((e=>e.chatType===R.SINGLE)))?void 0:a.map((e=>({id:e.receiver,name:e.name,avatar:e.avatar}))):[]})),he=l((()=>se.value.length?se.value.map((e=>e.id)):[])),be=l((()=>"create"===le.mode?he.value.length<3:he.value.length<1)),ge=l({get:()=>ve.value.filter((e=>!me.value.includes(e))).length===ce.value.filter((e=>!e.disabled)).length,set(e){const a=le.defaultValue.map((e=>e.id)),l=z(a,me.value,ce.value.map((e=>e.id))),t=ce.value.filter((e=>!e.disabled));ve.value=l.concat(e?t.map((e=>e.id)):[]),e?se.value=D(se.value,t,"id"):P(se.value,(e=>t.map((e=>e.id)).includes(e.id)))}});async function Ie(){switch(le.mode){case"create":await $({creator:te.userInfo.id,memberIdSet:he.value,name:F(de.value),orgId:te.orgId});break;case"join":if(await N({groupId:te.currentSessionItem.receiver,operator:te.userInfo.id,memberIdSet:he.value}),!te.currentSessionItem.defaultName){const e=se.value.map((e=>e.name)).join(",");ie({name:`${te.currentSessionItem.name},${e}`})}te.currentGroupUser.push(...ce.value.filter((e=>he.value.includes(e.id))));break;case"remove":if(await G({dissolution:!1,groupId:te.currentSessionItem.receiver,operator:te.userInfo.id,memberIdSet:he.value}),!te.currentSessionItem.defaultName){const e=se.value.map((e=>e.name)).join(","),a=new RegExp(e,"g");ie({name:te.currentSessionItem.name.replace(a,"")})}P(te.currentGroupUser,(e=>he.value.includes(e.id)));break;default:ae("comfirm",he.value)}re.value=!1}function ke(){var e,a;ve.value=null!=(a=null==(e=ce.value.filter((e=>he.value.includes(e.id))))?void 0:e.map((e=>e.id)))?a:[]}function ye(e,a){if("check"===a.actionType){const e=ce.value.find((e=>e.id===a.value));se.value.push(e)}else P(se.value,(e=>e.id===a.value))}return t((()=>re.value),(e=>{if(!e)return;oe.value="",de.value="";const a=q(le.options)&&le.options.length?le.options:fe.value;ne.value=B(a,"id").map((e=>{var a;return{...e,disabled:null==(a=me.value)?void 0:a.includes(e.id)}})),ce.value=M(ne.value),q(le.defaultValue)&&le.defaultValue.length?(se.value=M(le.defaultValue),ke()):(se.value=[],ve.value=[])})),(a,l)=>(i(),u(o,null,[r(s(g),{preset:"dialog",title:e.title,"show-icon":!1,"auto-focus":!1,"trap-focus":!1,class:"iho-chat-dialog",show:re.value,"onUpdate:show":l[4]||(l[4]=e=>re.value=e),"negative-text":"取消","positive-text":"确定","display-directive":"show","positive-button-props":{disabled:s(be)},onPositiveClick:Ie},{default:n((()=>[d("div",J,["create"===e.mode?(i(),u("div",K,[O,r(s(I),{clearable:"",placeholder:"取个群名称方便后续搜索",value:de.value,"onUpdate:value":l[0]||(l[0]=e=>de.value=e),valueModifiers:{trim:!0}},null,8,["value"])])):v("v-if",!0),d("div",Q,[d("div",W,[r(s(I),{placeholder:"搜索",clearable:"",value:oe.value,"onUpdate:value":[l[1]||(l[1]=e=>oe.value=e),s(pe)],valueModifiers:{trim:!0}},{prefix:n((()=>[r(s(k),{component:s(C)},null,8,["component"])])),_:1},8,["value","onUpdate:value"]),d("div",X,[s(ce).length>0?(i(),u(o,{key:0},[r(s(y),{label:"全选",checked:s(ge),"onUpdate:checked":l[2]||(l[2]=e=>c(ge)?ge.value=e:null)},null,8,["checked"]),r(s(w),{ref_key:"listRef",ref:ue,value:ve.value,"onUpdate:value":[l[3]||(l[3]=e=>ve.value=e),ye]},{default:n((()=>[(i(!0),u(o,null,p(s(ce),(e=>(i(),m(s(y),{key:e.id,value:e.id,disabled:e.disabled},{default:n((()=>[r(s(_),{align:"center","wrap-item":!1},{default:n((()=>[r(s(S),{src:e.avatar,round:"",size:32},null,8,["src"]),d("span",null,f(e.name),1)])),_:2},1024)])),_:2},1032,["value","disabled"])))),128))])),_:1},8,["value"])],64)):(i(),u("div",Y,"找不到相关结果"))])]),d("div",Z,[d("span",null,"已选择 "+f(s(he).length)+" 人",1),d("div",ee,[(i(!0),u(o,null,p(se.value,(e=>(i(),m(s(x),{key:e.id,bordered:!1,closable:e.id!==s(te).userInfo.id,disabled:s(me).includes(e.id),onClose:()=>{return a=e.id,P(se.value,(e=>e.id===a)),void P(ve.value,(e=>e===a));var a}},{avatar:n((()=>[r(s(S),{round:"",src:e.avatar},null,8,["src"])])),default:n((()=>[h(" "+f(e.name),1)])),_:2},1032,["closable","disabled","onClose"])))),128))])])])])])),_:1},8,["title","show","positive-button-props"]),d("span",{class:"btn-wrapper",onClick:l[5]||(l[5]=e=>re.value=!0)},[b(a.$slots,"trigger",{},(()=>[r(s(j),{"show-arrow":!1,placement:"bottom"},{trigger:n((()=>[r(s(U),{color:"#ffffff4D",class:"add-btn"},{icon:n((()=>[r(s(k),{component:s(L),color:"#fff"},null,8,["component"])])),_:1})])),default:n((()=>[h(" "+f(e.title),1)])),_:1})]))])],64))}});export{ae as default};
@@ -54,6 +54,7 @@ declare const _default: import("vue").DefineComponent<{}, {
54
54
  };
55
55
  defaultValue: {
56
56
  type: import("vue").PropType<AnyObject[]>;
57
+ default: () => never[];
57
58
  };
58
59
  }, {
59
60
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -74,6 +75,7 @@ declare const _default: import("vue").DefineComponent<{}, {
74
75
  };
75
76
  defaultValue: {
76
77
  type: import("vue").PropType<AnyObject[]>;
78
+ default: () => never[];
77
79
  };
78
80
  }>> & {
79
81
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -136,10 +138,12 @@ declare const _default: import("vue").DefineComponent<{}, {
136
138
  };
137
139
  defaultValue: {
138
140
  type: import("vue").PropType<AnyObject[]>;
141
+ default: () => never[];
139
142
  };
140
143
  }>> & {
141
144
  onComfirm?: ((...args: any[]) => any) | undefined;
142
145
  }, {
146
+ defaultValue: AnyObject[];
143
147
  mode: string;
144
148
  title: string;
145
149
  disabledIds: string[];
@@ -209,6 +209,7 @@ declare const _default: import("vue").DefineComponent<{}, {
209
209
  };
210
210
  defaultValue: {
211
211
  type: import("vue").PropType<AnyObject[]>;
212
+ default: () => never[];
212
213
  };
213
214
  }, {
214
215
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -229,6 +230,7 @@ declare const _default: import("vue").DefineComponent<{}, {
229
230
  };
230
231
  defaultValue: {
231
232
  type: import("vue").PropType<AnyObject[]>;
233
+ default: () => never[];
232
234
  };
233
235
  }>> & {
234
236
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -291,10 +293,12 @@ declare const _default: import("vue").DefineComponent<{}, {
291
293
  };
292
294
  defaultValue: {
293
295
  type: import("vue").PropType<AnyObject[]>;
296
+ default: () => never[];
294
297
  };
295
298
  }>> & {
296
299
  onComfirm?: ((...args: any[]) => any) | undefined;
297
300
  }, {
301
+ defaultValue: AnyObject[];
298
302
  mode: string;
299
303
  title: string;
300
304
  disabledIds: string[];
@@ -525,6 +529,7 @@ declare const _default: import("vue").DefineComponent<{}, {
525
529
  };
526
530
  defaultValue: {
527
531
  type: import("vue").PropType<AnyObject[]>;
532
+ default: () => never[];
528
533
  };
529
534
  }, {
530
535
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -545,6 +550,7 @@ declare const _default: import("vue").DefineComponent<{}, {
545
550
  };
546
551
  defaultValue: {
547
552
  type: import("vue").PropType<AnyObject[]>;
553
+ default: () => never[];
548
554
  };
549
555
  }>> & {
550
556
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -607,10 +613,12 @@ declare const _default: import("vue").DefineComponent<{}, {
607
613
  };
608
614
  defaultValue: {
609
615
  type: import("vue").PropType<AnyObject[]>;
616
+ default: () => never[];
610
617
  };
611
618
  }>> & {
612
619
  onComfirm?: ((...args: any[]) => any) | undefined;
613
620
  }, {
621
+ defaultValue: AnyObject[];
614
622
  mode: string;
615
623
  title: string;
616
624
  disabledIds: string[];
@@ -122,6 +122,7 @@ declare const _default: import("vue").DefineComponent<{}, {
122
122
  };
123
123
  defaultValue: {
124
124
  type: import("vue").PropType<AnyObject[]>;
125
+ default: () => never[];
125
126
  };
126
127
  }, {
127
128
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -142,6 +143,7 @@ declare const _default: import("vue").DefineComponent<{}, {
142
143
  };
143
144
  defaultValue: {
144
145
  type: import("vue").PropType<AnyObject[]>;
146
+ default: () => never[];
145
147
  };
146
148
  }>> & {
147
149
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -204,10 +206,12 @@ declare const _default: import("vue").DefineComponent<{}, {
204
206
  };
205
207
  defaultValue: {
206
208
  type: import("vue").PropType<AnyObject[]>;
209
+ default: () => never[];
207
210
  };
208
211
  }>> & {
209
212
  onComfirm?: ((...args: any[]) => any) | undefined;
210
213
  }, {
214
+ defaultValue: AnyObject[];
211
215
  mode: string;
212
216
  title: string;
213
217
  disabledIds: string[];
@@ -70,6 +70,7 @@ declare const _default: import("vue").DefineComponent<{}, {
70
70
  };
71
71
  defaultValue: {
72
72
  type: import("vue").PropType<AnyObject[]>;
73
+ default: () => never[];
73
74
  };
74
75
  }, {
75
76
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
@@ -90,6 +91,7 @@ declare const _default: import("vue").DefineComponent<{}, {
90
91
  };
91
92
  defaultValue: {
92
93
  type: import("vue").PropType<AnyObject[]>;
94
+ default: () => never[];
93
95
  };
94
96
  }>> & {
95
97
  onComfirm?: ((...args: any[]) => any) | undefined;
@@ -152,10 +154,12 @@ declare const _default: import("vue").DefineComponent<{}, {
152
154
  };
153
155
  defaultValue: {
154
156
  type: import("vue").PropType<AnyObject[]>;
157
+ default: () => never[];
155
158
  };
156
159
  }>> & {
157
160
  onComfirm?: ((...args: any[]) => any) | undefined;
158
161
  }, {
162
+ defaultValue: AnyObject[];
159
163
  mode: string;
160
164
  title: string;
161
165
  disabledIds: string[];
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.2.9-beta.16",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.9-beta.16",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
1
+ var e="@cnhis-design-vue/shared",i="3.2.9-beta.19",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.9-beta.19",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
@@ -24,4 +24,4 @@ export declare function isHTMLElement(target: unknown): target is HTMLElement;
24
24
  export declare function getArrDepth<T extends {
25
25
  children?: T[];
26
26
  }>(fieldList: T[]): number;
27
- export declare function encapBrowserLog(data: any): void;
27
+ export declare function encapBrowserLog(data: any, businessName: string): void;
@@ -1 +1 @@
1
- import{getCurrentInstance as n,defineComponent as t,provide as e,createVNode as r}from"vue";import{isObject as o}from"@vue/shared";import{useMemoize as i}from"@vueuse/core";import{isString as u,isNumber as c,isArray as s,isFunction as f}from"lodash-es";import a from"../package.json.js";export{getBindEventSettingTrigger,getDateOperationalFormHandler,getOperationalFormHandler,isConditionsMatchSqlExpression,isMatchLowCodeCondition,isMatchLowCodeConditionsWithSqlExpression,isMatchNewLowCodeConditionsWithSqlExpression}from"./business.js";function l(n,t,e="children",r){let o=!1;function i(){o=!0}!function n(t,e,r="children",u,c=0){r=h(r),t=h(t);for(let s=0;s<t.length;s++){if(e(t[s],i,u,c),o)return;for(let i=0;i<r.length;i++){const u=t[s][r[i]];if(Array.isArray(u)&&n(u,e,r,t[s],c+1),o)return}}}(n,t,e,r,0)}function d(n,t,e=t.name,r){if(!e)throw new Error(`[CUI]: invalid component name for ${t}`);const{components:i={}}=n._context;i[e]||(!Reflect.get(n,"__cnhis_version")&&o(a)&&Reflect.set(n,"__cnhis_version",a.version),r?r():n.component(e,t))}function p(n){if(!u(n))return;const t=n.match(/[Hms:]+/);return t?t[0]:void 0}function h(n){return Array.isArray(n)?n:[n]}function m(){return`key${"xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){const t=16*Math.random()|0;return("x"==n?t:3&t|8).toString(16)}))}`}const x={a:7.7,b:8.6,c:7.7,d:8.6,e:7.7,f:5,g:8.6,h:8.2,i:3.3,j:3.3,k:7.6,l:3.5,m:12.1,n:8.2,o:8.2,p:8.6,q:8.6,r:5.4,s:7.1,t:5,u:8.2,v:7.6,w:10.9,x:7.3,y:7.6,z:7.6,A:9.43,B:9.33,C:9.93,D:10,E:8.27,F:8.1,G:10.4,H:10.4,I:3.7,J:7.5,K:9.2,L:7.9,M:12.4,N:10.4,O:10.8,P:8.9,Q:10.8,R:9.1,S:8.8,T:8.9,U:10.4,V:9.4,W:13.5,X:9.4,Y:9.1,Z:9.1,".":4.03,",":4.03,"(":5.17,")":5.17,"-":7.51,"+":7.51,"/":4.11,"\\":4.11,"%":12.68,"‰":17.75,";":13.95,"、":13.95,",":13.95,"。":13.95},v=/\d/,g=/[\u4e00-\u9fa5():,。]/;function w(n){return x[n]?x[n]:v.test(n)?8.9:g.test(n)?13.95:void 0}const y=i((function(n){if(!n)return 0;let t="";return[...n].reduce(((n,e)=>{const r=t;return t=e," "===e?" "===r?n:n+4:n+(w(e)||6)}),0)})),E=Object.seal(Object.create(null));function O(n,t){return function n(t,e){return o(t)?s(t)?t.map((t=>n(t,e))):Object.entries(t).reduce(((t,[r,i])=>(e.includes(r)||(o(i)&&!f(i)?t[r]=n(i,e):t[r]=i),t)),{}):t}(n,t)}function b(n){return Object.values(n).reduce(((n,t)=>Object.assign(n,t)),{})}function j(n,t){if(!n)return n;if(t(n))return n;let e=n.parentElement;for(;e&&!t(e);)e=e.parentElement;return e}function C(n,t="px"){if(c(n))return`${n}${t}`;if(!n)return"";if(u(n))return n.endsWith(t)?n:`${n}${t}`;throw new Error(`invalid width value ${n}, it need to be a string or number!`)}function M(n,t){return n.some((n=>t.includes(n)))}const $=i((n=>{try{return JSON.parse(n)}catch(n){return{}}}),{getKey:n=>n});function S(n,t){if(!o(n))return n;const e={...n};for(let n=0;n<t.length;n++)Reflect.deleteProperty(e,t[n]);return e}function _(t){if(!n())throw new Error(t||"can't use this hook out of setup environment")}function I(n,t=1){const[e,r,o,i,u]=n.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i)||[];if(!e)return[255,255,255,t];const s=u&&parseInt(u,16)/255;return[parseInt(r,16),parseInt(o,16),parseInt(i,16),+(c(s)?s.toFixed(2):t)]}function A(n){return t({setup(t,{slots:o}){let i=(null==n?void 0:n.parent)&&Reflect.get(n.parent,"provides");const u=[];for(;i;)Object.entries(i).forEach((([n,t])=>{u.includes(n)||(u.push(n),e(n,t))})),i=Object.getPrototypeOf(i);return()=>{var n;return r("div",null,[null==(n=o.default)?void 0:n.call(o)])}}})}const H=i((function(n,t){return!(!u(t)||!u(n))&&t.split(",").some((t=>t.trim().includes(n)))}),{getKey:(...n)=>n.reduce(((n,t)=>String(n)+"_"+String(t)),"")});function L(n){try{return n instanceof HTMLElement}catch(t){return o(n)&&1===n.nodeType&&o(n.style)&&o(n.ownerDocument)}}function R(n){let t=0;return function n(e,r=0){e.forEach((e=>{e.children?n(e.children,r+1):t=Math.max(t,r)}))}(n),t}function k(n){var t;(null==(t=null==window?void 0:window.$CMonitor)?void 0:t.notify)&&window.$CMonitor.notify(n)}export{E as DMZ,h as arrayed,_ as checkInSetupEnv,A as createProviderWrapper,O as deepOmit,k as encapBrowserLog,j as findAncestor,p as generateTimeFormat,R as getArrDepth,w as getCharWidth,y as getStringWidth,I as hex2rgba,L as isHTMLElement,$ as jsonParse,H as keywordMatcher,d as safeComponentRegister,b as separateMetaModule,S as shallowOmit,M as targetStringIncludes,l as traverse,m as uuidGenerator,C as widthAppend};
1
+ import{getCurrentInstance as n,defineComponent as t,provide as e,createVNode as r}from"vue";import{isObject as o}from"@vue/shared";import{useMemoize as i}from"@vueuse/core";import{isString as u,isNumber as c,isArray as s,isFunction as f}from"lodash-es";import a from"../package.json.js";export{getBindEventSettingTrigger,getDateOperationalFormHandler,getOperationalFormHandler,isConditionsMatchSqlExpression,isMatchLowCodeCondition,isMatchLowCodeConditionsWithSqlExpression,isMatchNewLowCodeConditionsWithSqlExpression}from"./business.js";function l(n,t,e="children",r){let o=!1;function i(){o=!0}!function n(t,e,r="children",u,c=0){r=m(r),t=m(t);for(let s=0;s<t.length;s++){if(e(t[s],i,u,c),o)return;for(let i=0;i<r.length;i++){const u=t[s][r[i]];if(Array.isArray(u)&&n(u,e,r,t[s],c+1),o)return}}}(n,t,e,r,0)}function d(n,t,e=t.name,r){if(!e)throw new Error(`[CUI]: invalid component name for ${t}`);const{components:i={}}=n._context;i[e]||(!Reflect.get(n,"__cnhis_version")&&o(a)&&Reflect.set(n,"__cnhis_version",a.version),r?r():n.component(e,t))}function p(n){if(!u(n))return;const t=n.match(/[Hms:]+/);return t?t[0]:void 0}function m(n){return Array.isArray(n)?n:[n]}function h(){return`key${"xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){const t=16*Math.random()|0;return("x"==n?t:3&t|8).toString(16)}))}`}const x={a:7.7,b:8.6,c:7.7,d:8.6,e:7.7,f:5,g:8.6,h:8.2,i:3.3,j:3.3,k:7.6,l:3.5,m:12.1,n:8.2,o:8.2,p:8.6,q:8.6,r:5.4,s:7.1,t:5,u:8.2,v:7.6,w:10.9,x:7.3,y:7.6,z:7.6,A:9.43,B:9.33,C:9.93,D:10,E:8.27,F:8.1,G:10.4,H:10.4,I:3.7,J:7.5,K:9.2,L:7.9,M:12.4,N:10.4,O:10.8,P:8.9,Q:10.8,R:9.1,S:8.8,T:8.9,U:10.4,V:9.4,W:13.5,X:9.4,Y:9.1,Z:9.1,".":4.03,",":4.03,"(":5.17,")":5.17,"-":7.51,"+":7.51,"/":4.11,"\\":4.11,"%":12.68,"‰":17.75,";":13.95,"、":13.95,",":13.95,"。":13.95},g=/\d/,v=/[\u4e00-\u9fa5():,。]/;function w(n){return x[n]?x[n]:g.test(n)?8.9:v.test(n)?13.95:void 0}const y=i((function(n){if(!n)return 0;let t="";return[...n].reduce(((n,e)=>{const r=t;return t=e," "===e?" "===r?n:n+4:n+(w(e)||6)}),0)})),E=Object.seal(Object.create(null));function O(n,t){return function n(t,e){return o(t)?s(t)?t.map((t=>n(t,e))):Object.entries(t).reduce(((t,[r,i])=>(e.includes(r)||(o(i)&&!f(i)?t[r]=n(i,e):t[r]=i),t)),{}):t}(n,t)}function b(n){return Object.values(n).reduce(((n,t)=>Object.assign(n,t)),{})}function j(n,t){if(!n)return n;if(t(n))return n;let e=n.parentElement;for(;e&&!t(e);)e=e.parentElement;return e}function C(n,t="px"){if(c(n))return`${n}${t}`;if(!n)return"";if(u(n))return n.endsWith(t)?n:`${n}${t}`;throw new Error(`invalid width value ${n}, it need to be a string or number!`)}function S(n,t){return n.some((n=>t.includes(n)))}const M=i((n=>{try{return JSON.parse(n)}catch(n){return{}}}),{getKey:n=>n});function $(n,t){if(!o(n))return n;const e={...n};for(let n=0;n<t.length;n++)Reflect.deleteProperty(e,t[n]);return e}function _(t){if(!n())throw new Error(t||"can't use this hook out of setup environment")}function I(n,t=1){const[e,r,o,i,u]=n.match(/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i)||[];if(!e)return[255,255,255,t];const s=u&&parseInt(u,16)/255;return[parseInt(r,16),parseInt(o,16),parseInt(i,16),+(c(s)?s.toFixed(2):t)]}function A(n){return t({setup(t,{slots:o}){let i=(null==n?void 0:n.parent)&&Reflect.get(n.parent,"provides");const u=[];for(;i;)Object.entries(i).forEach((([n,t])=>{u.includes(n)||(u.push(n),e(n,t))})),i=Object.getPrototypeOf(i);return()=>{var n;return r("div",null,[null==(n=o.default)?void 0:n.call(o)])}}})}const H=i((function(n,t){return!(!u(t)||!u(n))&&t.split(",").some((t=>t.trim().includes(n)))}),{getKey:(...n)=>n.reduce(((n,t)=>String(n)+"_"+String(t)),"")});function L(n){try{return n instanceof HTMLElement}catch(t){return o(n)&&1===n.nodeType&&o(n.style)&&o(n.ownerDocument)}}function N(n){let t=0;return function n(e,r=0){e.forEach((e=>{e.children?n(e.children,r+1):t=Math.max(t,r)}))}(n),t}function R(n,t){var e;(null==(e=null==window?void 0:window.$CMonitor)?void 0:e.notify)&&window.$CMonitor.notify({message:JSON.stringify(n),businessName:t||"SDK"})}export{E as DMZ,m as arrayed,_ as checkInSetupEnv,A as createProviderWrapper,O as deepOmit,R as encapBrowserLog,j as findAncestor,p as generateTimeFormat,N as getArrDepth,w as getCharWidth,y as getStringWidth,I as hex2rgba,L as isHTMLElement,M as jsonParse,H as keywordMatcher,d as safeComponentRegister,b as separateMetaModule,$ as shallowOmit,S as targetStringIncludes,l as traverse,h as uuidGenerator,C as widthAppend};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.2.9-beta.16",
3
+ "version": "3.2.9-beta.19",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -72,5 +72,5 @@
72
72
  "iOS 7",
73
73
  "last 3 iOS versions"
74
74
  ],
75
- "gitHead": "eaaf1fdc28fc197b7e32589be66e76808ebe2656"
75
+ "gitHead": "0ca08de96e0c5037d401d5b9518ec9c5313e5f32"
76
76
  }