cnhis-design-vue 3.2.5-beta.4 → 3.2.5-beta.6

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.
@@ -422,6 +422,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
422
422
  formatList: never[];
423
423
  templateParams: never[];
424
424
  printParams: never[];
425
+ originParams: {};
425
426
  currentFormatId: string;
426
427
  identityVerification: {
427
428
  visible: boolean;
@@ -475,7 +476,7 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
475
476
  toggleExpandLoading: (isLoading: boolean, formatId?: string | undefined) => void;
476
477
  getCurrentLoading: () => boolean;
477
478
  handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
478
- handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, needContinuePrint?: boolean | undefined) => Promise<void>;
479
+ handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean | undefined) => Promise<void>;
479
480
  handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
480
481
  handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
481
482
  handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
@@ -488,12 +489,14 @@ declare const ButtonPrint: SFCWithInstall<import("vue").DefineComponent<{
488
489
  formatFormatList: (list: any[]) => any;
489
490
  formatDefaultVal: (i: any, tableVal?: any) => any;
490
491
  formatSomeTypeParams: (templateParams: any[], params?: any[]) => any;
492
+ formatSomeOriginParams: (templateParams: any[], params?: any[]) => any;
491
493
  formatPrintParams: (paramObj: any, fieldList: any[], keyName: string) => any;
492
494
  formatItemParam: ({ customizeDataset, param }: {
493
495
  customizeDataset?: never[] | undefined;
494
496
  param?: never[] | undefined;
495
497
  }, paramObj?: any) => any;
496
498
  findTemplateAndInsertData: (mergeData: any, paramItem: any, templateParams: any) => any;
499
+ findTemplateAndInsertParams: (mergeData: any, paramItem: any, templateParams: any) => any;
497
500
  mergeTemplateList: (list: any[]) => any;
498
501
  initCRM: (formatListResult: any) => Promise<void>;
499
502
  init: () => Promise<boolean>;
@@ -428,6 +428,7 @@ declare const _default: import("vue").DefineComponent<{
428
428
  formatList: never[];
429
429
  templateParams: never[];
430
430
  printParams: never[];
431
+ originParams: {};
431
432
  currentFormatId: string;
432
433
  identityVerification: {
433
434
  visible: boolean;
@@ -481,7 +482,7 @@ declare const _default: import("vue").DefineComponent<{
481
482
  toggleExpandLoading: (isLoading: boolean, formatId?: string | undefined) => void;
482
483
  getCurrentLoading: () => boolean;
483
484
  handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
484
- handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, needContinuePrint?: boolean | undefined) => Promise<void>;
485
+ handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean | undefined) => Promise<void>;
485
486
  handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
486
487
  handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
487
488
  handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
@@ -494,12 +495,14 @@ declare const _default: import("vue").DefineComponent<{
494
495
  formatFormatList: (list: any[]) => any;
495
496
  formatDefaultVal: (i: any, tableVal?: any) => any;
496
497
  formatSomeTypeParams: (templateParams: any[], params?: any[]) => any;
498
+ formatSomeOriginParams: (templateParams: any[], params?: any[]) => any;
497
499
  formatPrintParams: (paramObj: any, fieldList: any[], keyName: string) => any;
498
500
  formatItemParam: ({ customizeDataset, param }: {
499
501
  customizeDataset?: never[] | undefined;
500
502
  param?: never[] | undefined;
501
503
  }, paramObj?: any) => any;
502
504
  findTemplateAndInsertData: (mergeData: any, paramItem: any, templateParams: any) => any;
505
+ findTemplateAndInsertParams: (mergeData: any, paramItem: any, templateParams: any) => any;
503
506
  mergeTemplateList: (list: any[]) => any;
504
507
  initCRM: (formatListResult: any) => Promise<void>;
505
508
  init: () => Promise<boolean>;
@@ -225,6 +225,7 @@ declare const _default: import("vue").DefineComponent<{
225
225
  formatList: never[];
226
226
  templateParams: never[];
227
227
  printParams: never[];
228
+ originParams: {};
228
229
  currentFormatId: string;
229
230
  identityVerification: {
230
231
  visible: boolean;
@@ -278,7 +279,7 @@ declare const _default: import("vue").DefineComponent<{
278
279
  toggleExpandLoading: (isLoading: boolean, formatId?: string) => void;
279
280
  getCurrentLoading: () => boolean;
280
281
  handleOneTypePrint: (templateCode: string, templateId: string, formatId: string, isOuterClick: boolean) => void;
281
- handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, needContinuePrint?: boolean) => Promise<void>;
282
+ handleClickPrint: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string, printToParam?: never[], needContinuePrint?: boolean) => Promise<void>;
282
283
  handleClickPreview: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
283
284
  handleClickPdf: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => Promise<void>;
284
285
  handleClickEdit: (curPrintParamList: any[] | undefined, templateCode: string, templateId: string, formatId: string) => void;
@@ -291,12 +292,14 @@ declare const _default: import("vue").DefineComponent<{
291
292
  formatFormatList: (list: any[]) => any;
292
293
  formatDefaultVal: (i: any, tableVal?: any) => any;
293
294
  formatSomeTypeParams: (templateParams: any[], params?: any[]) => any;
295
+ formatSomeOriginParams: (templateParams: any[], params?: any[]) => any;
294
296
  formatPrintParams: (paramObj: any, fieldList: any[], keyName: string) => any;
295
297
  formatItemParam: ({ customizeDataset, param }: {
296
298
  customizeDataset?: never[] | undefined;
297
299
  param?: never[] | undefined;
298
300
  }, paramObj?: any) => any;
299
301
  findTemplateAndInsertData: (mergeData: any, paramItem: any, templateParams: any) => any;
302
+ findTemplateAndInsertParams: (mergeData: any, paramItem: any, templateParams: any) => any;
300
303
  mergeTemplateList: (list: any[]) => any;
301
304
  initCRM: (formatListResult: any) => Promise<void>;
302
305
  init: () => Promise<boolean>;
@@ -1 +1 @@
1
- import{defineComponent as t,inject as e,ref as n,reactive as i,computed as r,onMounted as a,watch as l,openBlock as o,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as d,createVNode as p,unref as m,withCtx as y,renderList as v,createBlock as f,createTextVNode as g,toDisplayString as k,isRef as h,renderSlot as b,withModifiers as w,normalizeClass as P,mergeProps as O}from"vue";import{isObject as S}from"@vue/shared";import{useMessage as C,NButtonGroup as I,NDropdown as T,NButton as L,NIcon as F,NPopover as M,NCheckbox as j,NDivider as N}from"naive-ui";import{PrintOutline as x,SettingsOutline as E,ChevronDownSharp as _,ArrowForwardOutline as D}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as J}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as A}from"date-fns";import"../api.js";const K={class:"newprint-button-outer"},B=c("span",{class:"label bold"},"外显设置",-1),R={class:"newprint-button-poperOver"},H={class:"print-lite"},q={class:"label bold"},G={class:"print-li"},Y={class:"print-lite"},$={class:"newprint-button-poperOver"},Q=["onMouseenter","onClick"],W={class:"label bold"},X={class:"newprint-button-poperOver"},Z={class:"print-lite"},tt={class:"label bold"},et={class:"print-li"},nt={class:"print-lite"},it=["onClick"],rt={class:"newprint-button-poperOver"},at=["onMouseenter"],lt={class:"print-lite"},ot=["onClick"];var st=t({__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,default:1},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:""})}},setup(t,{expose:st}){const ut=t,ct=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],dt=C();let pt;const mt=e(z),yt=n(""),vt=i({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[]});let ft=n([]),gt=n([{label:ut.pdfLoadText,key:"downloadPdf"},{label:ut.previewText,key:"previewText"},{label:ut.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const kt=i({oneMouseType:"",oneClickType:"",twoMouseType:""}),ht=i({oneShow:!1,isOperation:!1,isOutSetting:!1}),bt=n([]),wt=n([]),Pt=r((()=>{if(!vt.currentFormatId)return{};let t=vt.currentFormatId;return vt.formatList.find((e=>e.id===t))}));r((()=>{var t;return(null==(t=Pt.value)?void 0:t.name)||"格式选择"}));const Ot=r((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.templateId})),St=r((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.number})),Ct=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowPrintAll})),It=r((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.customProps)||{}})),Lt=r((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.defaultFormatId)||""})),Ft=r((()=>{const t=ct.map((t=>t.key));return ft.value.filter((e=>!t.includes(e.key)))})),Mt=r({get:()=>Ft.value.every((t=>t.selected)),set(t){Ft.value.forEach((e=>{e.selected=t}))}}),jt=async()=>{var t,e;(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await ee(),ht.oneShow=!0},Nt=async t=>{if(ut.directPrint){if(vt.spinning)return;return"button"===t?void(Ct.value?await ie():Lt.value?async function(t){await ee(!1);const e=bt.value.find((e=>e.key==t));e&&Ht(e.templateCode,e.templateId,e.key,!1)}(Lt.value):jt()):jt()}return jt()},xt=(t,e)=>{kt[t]=e},Et=()=>{bt.value=ft.value.filter((t=>!t.selected)),wt.value=Ft.value.filter((t=>t.selected)),Dt("oneShow"),Dt("isOutSetting"),mt("saveOuterPrint",wt.value)},_t=t=>{ht[t]=!0},Dt=t=>{kt.oneClickType="",ht[t]=!1,"isOutSetting"==t&&(ht.isOutSetting=!1)},zt=(t,e)=>{Bt(!1);let n={type:e,formatId:vt.currentFormatId,templateId:Ot.value};mt("success",t,n)},Jt=t=>{Bt(!1),mt("error",t),S(t)&&"notInstalledApp"===t.type&&dt.error(t.message)},Ut=t=>{Bt(!1),mt("cancel",t)},Vt=t=>{mt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},At=()=>JSON.stringify({...ut.token?{token:ut.token}:{}}),Kt=(t=[],e)=>{var n,i;let r={},a={};if((null==(n=vt.templateParams[e].customizeDataset)?void 0:n.length)>0){const e=(null==(i=Object.keys(t[0].datasetData||{}))?void 0:i[0])||"",n=JSON.stringify(t.map((t=>JSON.parse(t.datasetData[e]))));a={datasetData:{}},a.datasetData[e]=n}else Object.keys(t[0]).forEach((e=>{a[e]=[],t.forEach((t=>{a[e].includes(t[e])||a[e].push(t[e])})),a[e]=a[e].join(",")}));return r=Object.assign({},JSON.parse(At()),Tt.value,a),JSON.stringify(r)},Bt=(t,e)=>{if(vt.isClickOuterPrint){if(t&&e){const n=wt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}wt.value.forEach((t=>{t.isLoading=!1}))}else vt.spinning=t},Rt=()=>vt.isClickOuterPrint?wt.value.some((t=>t.isLoading)):vt.spinning,Ht=(t,e,n,i)=>{const r=vt.printParams[t];r&&(vt.isClickOuterPrint=i,vt.currentFormatId=n,qt(r,t,e,n))},qt=async(t=[],e,n,i,r)=>{let a=t.length;const l=async t=>{try{--a<=0&&zt(t,"print")}catch(t){console.log("error",t)}};ut.showLoading&&Rt()&&!r||(Bt(!0,i),ut.prevFn("print").then((()=>{vt.curPrintParamList=t;const r={formatId:i,templateId:n,authorizationKey:yt.value,printdlgshow:ut.printdlgshow,signature:ut.signature,copies:ut.printCopies};if("MULTI"===ut.strategy)for(let e=0;e<t.length;e++){e>0&&(r.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[e]));pt.printDirect({...r,params:n},l,Jt,Ut)}else pt.printDirect({...r,params:Kt(t,e)},(n=>{n.params=Kt(t,e),zt(n,"print")}),Jt,Ut)})).catch((()=>{Vt("print"),Bt(!1)})).finally((()=>{vt.visible=!1})))},Gt=async(t,{templateCode:e,templateId:n,key:i},r)=>{const a=vt.printParams[e];if(a)switch(vt.isClickOuterPrint=r,vt.currentFormatId=i,t){case"previewText":(async(t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("preview").then((()=>{vt.curPrintParamList=t;const r=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?r:Kt(t,e),l={formatId:i,templateId:n,authorizationKey:yt.value,params:a,btnprint:ut.btnprint,signature:ut.signature};pt.preview(l,(t=>{zt(t,"preview")}),Jt)})).catch((()=>{Vt("preview"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,i);break;case"formatEditText":((t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("edit").then((()=>{vt.curPrintParamList=t,vt.currentFormatId=i,vt.identityVerification.visible=!0})).catch((()=>{Vt("edit")})).finally((()=>{Bt(!1)})))})(a,0,0,i);break;case"downloadPdf":(async(t=[],e,n,i)=>{ut.showLoading&&Rt()||(Bt(!0,i),ut.prevFn("download").then((()=>{vt.curPrintParamList=t;const r=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?r:Kt(t,e),l={formatId:i,templateId:n,authorizationKey:yt.value,print:{print:"1",type:"1"},params:a,signature:ut.signature};pt.downloadPDF(l,(t=>zt(t,"preview")),Jt)})).catch((()=>{Vt("download"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,i);break;case"resetPrinter":(async(t=[],e,n,i)=>{if(ut.showLoading&&Rt())return;Bt(!0,i);const r=await pt.resetPrinter(i);Bt(!1),"success"!=(null==r?void 0:r.result)?dt.warning("重置打印机失败"):dt.success(r.message||"重置打印机成功")})(a,0,0,i)}},Yt=()=>{},$t=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},Xt(n,e,t))})),n},Qt=(t,e,n)=>{const i={};return e.forEach((e=>{let r=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(i=A(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},Wt=({customizeDataset:t=[],param:e=[]},n={})=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData||(i.datasetData={}),i.datasetData[t.name]=JSON.stringify(Qt(n,e,"fieldName"))})),i=Object.assign({},i,Qt(n,e,"key")),i},Xt=(t,e,n)=>{if(e.templateNumbers){for(let i=0;i<e.templateNumbers.length;i++){const r=e.templateNumbers[i],a=n[r];if(!a)return dt.error("当前勾选的数据没有匹配的模板"),t;t[r]||(t[r]=[]),t[r].push(Wt(a,e))}return t}const i=Object.keys(n);for(let r=0;r<i.length;r++){const a=i[r],l=n[a];if(!l)return dt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Wt(l,e))}return t},Zt=async t=>{vt.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],(()=>{var t,e,n;const i=vt.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));ft.value.unshift(...i),It.value&&ft.value.push(...ct),(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(ft.value.forEach((t=>{var e;(null==(e=ut.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),wt.value=ft.value.filter((t=>t.selected))),bt.value=ft.value.filter((t=>!t.selected)),ut.hideButtons.length>0&&(gt.value=gt.value.filter((t=>!ut.hideButtons.includes(t.key))));const r=sessionStorage.getItem("portal");if(r){const t=JSON.parse(r),e=(null==(n=null==t?void 0:t.user)?void 0:n.currentRoleResourceObj)||{},i=Object.keys(e);i.includes("RY7.2.21.1.M2.G94181E")||(gt.value=gt.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(gt.value=gt.value.filter((t=>"formatEditText"!=t.key)))}})(),vt.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),vt.printParams=$t(vt.templateParams,ut.params)},te=async()=>{var t;if(vt.isInited)return!0;vt.isInited=!0,vt.spinning=!0,(()=>{if(pt)return!1;pt=new J})();const e=await ut.queryPrintFormatByNumber();return await Zt(e),(null==(t=e.obj)?void 0:t.length)>0&&(yt.value=e.obj[0].authorizationKey||""),vt.spinning=!1,!0},ee=async(t=!0)=>{if(await ut.clickPrevFn()){if(!vt.visible){if(!await te())return!1}t&&(vt.visible=!vt.visible)}},ne=t=>{if(vt.identityVerification.visible=!1,U(vt.currentFormatId))return zt(null,"edit");const e=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,vt.curPrintParamList[0])),n="MULTI"===ut.strategy?e:Kt(vt.curPrintParamList,St.value),i={formatId:vt.currentFormatId,templateId:Ot.value,params:n,token:t};pt.editPrintFormat(i,(t=>{zt(t,"edit")}),Jt)};async function ie(){await ee(!1),(()=>{const t=Object.keys(vt.printParams);vt.isClickOuterPrint=!1;for(let e=0;e<t.length;e++){const n=t[e],i=vt.printParams[n],r=vt.formatList.filter((t=>t.number==n));r&&r.length>0&&r.forEach((t=>{vt.currentFormatId=t.id,qt(i,t.number,t.templateId,t.id,!0)}))}})()}return a((()=>{vt.isInited=!1})),l((()=>ut.params),(t=>{Object.keys(vt.templateParams).length>0&&(vt.printParams=$t(vt.templateParams,ut.params))}),{deep:!0}),l((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await ee(!1)}),{deep:!0,immediate:!0}),st({directPrint:ie}),(e,n)=>(o(),s(u,null,[c("div",K,[d(" 外显按钮集合 "),p(m(I),null,{default:y((()=>[(o(!0),s(u,null,v(wt.value,(e=>{return o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Yt,options:(n=m(gt),i=e,vt.printParams[i.templateCode]?n:[]),onSelect:t=>Gt(t,e,!0)},{default:y((()=>[p(m(L),{disabled:!vt.printParams[e.templateCode],loading:t.showLoading&&e.isLoading,onClick:t=>Ht(e.templateCode,e.templateId,e.key,!0)},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(e.label),1)])),_:2},1032,["disabled","loading","onClick"])])),_:2},1032,["options","onSelect"]);var n,i})),128))])),_:1}),d(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outerPrintItems"\r\n :key="outer.key"\r\n\t\t\t\ttrigger="hover"\r\n\t\t\t\t:show-arrow="false"\r\n\t\t\t\t:show="downlistPopover.isOperation"\r\n\t\t\t\t@clickoutside="handleClickOutHide(\'isOperation\')"\r\n\t\t\t>\r\n\t\t\t\t<template #trigger>\r\n\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t@mouseenter="delayShowPopover(\'isOperation\')"\r\n\t\t\t\t\t\t@mouseleave="handleClickOutHide(\'isOperation\')"\r\n\t\t\t\t\t\t@click="console.log(33)"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t<n-icon :component="PrintOutline" size="18"></n-icon>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t<span class="label bold">{{ outer.label }}</span>\r\n\t\t\t\t\t</n-button>\r\n\t\t\t\t</template>\r\n\t\t\t\t<div class="newprint-button-poperOver">\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass="print-li"\r\n\t\t\t\t\t\tv-for="operation in operations"\r\n\t\t\t\t\t\t:key="operation.key"\r\n\t\t\t\t\t\t:class="downlistOperation.twoMouseType==operation.key ? \'active\' : \'\' "\r\n\t\t\t\t\t\t@mouseenter="handleTypeChange(\'twoMouseType\', operation.key)"\r\n\t\t\t\t\t\t@mouseleave="handleTypeChange(\'twoMouseType\', \'\')"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<div class="print-lite">\r\n\t\t\t\t\t\t\t<span class="label"> {{ operation.label }} </span>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</n-popover>\r\n\t\t</n-button-group> '),d(" 外显设置按钮 "),wt.value.length>0&&wt.value.length==m(Ft).length&&m(It)?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,show:ht.isOutSetting,onClickoutside:n[2]||(n[2]=t=>Dt("isOutSetting"))},{trigger:y((()=>[p(m(L),{onClick:n[0]||(n[0]=t=>_t("isOutSetting"))},{default:y((()=>[B,p(m(F),{style:{"margin-left":"8px"},component:m(E),size:"18"},null,8,["component"])])),_:1})])),default:y((()=>[c("div",R,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[p(m(N)),c("div",Y,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Mt),"onUpdate:checked":n[1]||(n[1]=t=>h(Mt)?Mt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[d(" 打印全部按钮 "),p(m(M),{trigger:"click","show-arrow":!1,show:ht.oneShow,onClickoutside:n[10]||(n[10]=t=>Dt("oneShow"))},{trigger:y((()=>[b(e.$slots,"button",{handleClickPrintBtn:ee,printSpinning:vt.spinning,printbtnText:t.btnText,printVisible:vt.visible},(()=>[p(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>Nt("icon")),["stop"]))},{default:y((()=>[p(m(L),{loading:t.showLoading&&vt.spinning,onClick:n[3]||(n[3]=w((()=>Nt("button")),["stop"]))},{icon:y((()=>[p(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),p(m(L),{class:"icon-select"},{icon:y((()=>[p(m(F),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[c("div",$,[(o(!0),s(u,null,v(bt.value,(t=>(o(),s("div",{class:P(["print-li",kt.oneMouseType==t.key||kt.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>((t,e,n)=>{if(!vt.printParams[n.templateCode])return[];xt(t,e)})("oneClickType",t.key,t)},["divider"==t.key?(o(),f(m(N),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[d(" 第二层外显设置 "),p(m(M),{trigger:"click","show-arrow":!1,placement:"right-start",show:ht.isOutSetting,onClickoutside:n[7]||(n[7]=t=>Dt("isOutSetting"))},{trigger:y((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>_t("isOutSetting"))},[c("span",W,k(t.label),1),p(m(F),{style:{background:"transparent"},component:m(E),size:"18"},null,8,["component"])])])),default:y((()=>[c("div",X,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),p(m(j),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[p(m(N)),c("div",nt,[p(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),p(m(j),{checked:m(Mt),"onUpdate:checked":n[6]||(n[6]=t=>h(Mt)?Mt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[d(" 第二层功能操作 "),c("div",{class:P(["print-lite",vt.printParams[t.templateCode]?"":"isDisabled"])},[c("span",{class:"label bold",onClick:e=>Ht(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,it),vt.printParams[t.templateCode]?(o(),f(m(M),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:ht[t.key],onClickoutside:e=>Dt(t.key)},{trigger:y((()=>[p(m(F),{component:m(D),size:"18",onClick:e=>_t(t.key)},null,8,["component","onClick"])])),default:y((()=>[c("div",rt,[(o(!0),s(u,null,v(m(gt),(e=>(o(),s("div",{class:P(["print-li",kt.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",lt,[c("span",{class:"label",onClick:n=>Gt(e.key,t,!1)},k(e.label),9,ot)])],42,at)))),128))])])),_:2},1032,["show","onClickoutside"])):d("v-if",!0)],2)],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),p(V,O(e.$attrs,{modelValue:vt.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>vt.identityVerification.visible=t),formatId:vt.currentFormatId,templateId:m(Ot),onSuccess:ne}),null,16,["modelValue","formatId","templateId"])],64))}});export{st as default};
1
+ import{defineComponent as t,inject as e,ref as n,reactive as r,computed as i,onMounted as a,watch as l,openBlock as o,createElementBlock as s,Fragment as u,createElementVNode as c,createCommentVNode as p,createVNode as d,unref as m,withCtx as y,renderList as v,createBlock as f,createTextVNode as g,toDisplayString as k,isRef as h,renderSlot as b,withModifiers as w,normalizeClass as P,mergeProps as O}from"vue";import{isObject as S}from"@vue/shared";import{useMessage as C,NButtonGroup as I,NDropdown as T,NButton as L,NIcon as F,NPopover as j,NCheckbox as M,NDivider as N}from"naive-ui";import{PrintOutline as x,SettingsOutline as E,ChevronDownSharp as _,ArrowForwardOutline as D}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as z}from"../constants/index.js";import{Print as J}from"../utils/print.js";import{isIReport as U}from"../utils/browserPrint.js";import V from"./IdentityVerification.vue.js";import{format as A}from"date-fns";import"../api.js";const K={class:"newprint-button-outer"},B=c("span",{class:"label bold"},"外显设置",-1),R={class:"newprint-button-poperOver"},H={class:"print-lite"},q={class:"label bold"},G={class:"print-li"},Y={class:"print-lite"},$={class:"newprint-button-poperOver"},Q=["onMouseenter","onClick"],W={class:"label bold"},X={class:"newprint-button-poperOver"},Z={class:"print-lite"},tt={class:"label bold"},et={class:"print-li"},nt={class:"print-lite"},rt=["onClick"],it={class:"newprint-button-poperOver"},at=["onMouseenter"],lt={class:"print-lite"},ot=["onClick"];var st=t({__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,default:1},newPrintSetting:{type:Object,default:()=>({isShowPrintAll:!0,isShowOutSetting:!0,customProps:{},outerPrintKeys:[],defaultFormatId:""})}},setup(t,{expose:st}){const ut=t,ct=[{label:"分割线",key:"divider"},{label:"外显设置",key:"outSetting"}],pt=C();let dt;const mt=e(z),yt=n(""),vt=r({spinning:!1,visible:!1,formatList:[],templateParams:[],printParams:[],originParams:{},currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,isClickOuterPrint:!1,curPrintParamList:[]});let ft=n([]),gt=n([{label:ut.pdfLoadText,key:"downloadPdf"},{label:ut.previewText,key:"previewText"},{label:ut.formatEditText,key:"formatEditText"},{label:"重置打印机",key:"resetPrinter"}]);const kt=r({oneMouseType:"",oneClickType:"",twoMouseType:""}),ht=r({oneShow:!1,isOperation:!1,isOutSetting:!1}),bt=n([]),wt=n([]),Pt=i((()=>{if(!vt.currentFormatId)return{};let t=vt.currentFormatId;return vt.formatList.find((e=>e.id===t))}));i((()=>{var t;return(null==(t=Pt.value)?void 0:t.name)||"格式选择"}));const Ot=i((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.templateId})),St=i((()=>{let t=vt.formatList.find((t=>t.id===vt.currentFormatId));return null==t?void 0:t.number})),Ct=i((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowPrintAll})),It=i((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.isShowOutSetting})),Tt=i((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.customProps)||{}})),Lt=i((()=>{var t;return(null==(t=ut.newPrintSetting)?void 0:t.defaultFormatId)||""})),Ft=i((()=>{const t=ct.map((t=>t.key));return ft.value.filter((e=>!t.includes(e.key)))})),jt=i({get:()=>Ft.value.every((t=>t.selected)),set(t){Ft.value.forEach((e=>{e.selected=t}))}}),Mt=async()=>{var t,e;(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)||await re(),ht.oneShow=!0},Nt=async t=>{if(ut.directPrint){if(vt.spinning)return;return"button"===t?void(Ct.value?await ae():Lt.value?async function(t){await re(!1);const e=bt.value.find((e=>e.key==t));e&&Ht(e.templateCode,e.templateId,e.key,!1)}(Lt.value):Mt()):Mt()}return Mt()},xt=(t,e)=>{kt[t]=e},Et=()=>{bt.value=ft.value.filter((t=>!t.selected)),wt.value=Ft.value.filter((t=>t.selected)),Dt("oneShow"),Dt("isOutSetting"),mt("saveOuterPrint",wt.value)},_t=t=>{ht[t]=!0},Dt=t=>{kt.oneClickType="",ht[t]=!1,"isOutSetting"==t&&(ht.isOutSetting=!1)},zt=(t,e)=>{Bt(!1);let n={type:e,formatId:vt.currentFormatId,templateId:Ot.value,templateCode:St.value};mt("success",t,n)},Jt=t=>{Bt(!1),mt("error",t),S(t)&&"notInstalledApp"===t.type&&pt.error(t.message)},Ut=t=>{Bt(!1),mt("cancel",t)},Vt=t=>{mt("error",{message:"前置条件执行错误",type:t,preExecution:!0})},At=()=>JSON.stringify({...ut.token?{token:ut.token}:{}}),Kt=(t=[],e)=>{var n,r;let i={},a={};if((null==(n=vt.templateParams[e].customizeDataset)?void 0:n.length)>0){const e=(null==(r=Object.keys(t[0].datasetData||{}))?void 0:r[0])||"",n=JSON.stringify(t.map((t=>JSON.parse(t.datasetData[e]))));a={datasetData:{}},a.datasetData[e]=n}else Object.keys(t[0]).forEach((e=>{a[e]=[],t.forEach((t=>{a[e].includes(t[e])||a[e].push(t[e])})),a[e]=a[e].join(",")}));return i=Object.assign({},JSON.parse(At()),Tt.value,a),JSON.stringify(i)},Bt=(t,e)=>{if(vt.isClickOuterPrint){if(t&&e){const n=wt.value.find((t=>t.key==e));return void(n&&(n.isLoading=t))}wt.value.forEach((t=>{t.isLoading=!1}))}else vt.spinning=t},Rt=()=>vt.isClickOuterPrint?wt.value.some((t=>t.isLoading)):vt.spinning,Ht=(t,e,n,r)=>{const i=vt.printParams[t];if(!i)return;vt.isClickOuterPrint=r,vt.currentFormatId=n;const a=vt.originParams[t]||[];qt(i,t,e,n,a)},qt=async(t=[],e,n,r,i=[],a)=>{let l=t.length;const o=async t=>{try{--l<=0&&zt(t,"print")}catch(t){console.log("error",t)}};ut.showLoading&&Rt()&&!a||(Bt(!0,r),ut.prevFn("print").then((()=>{vt.curPrintParamList=t;const a={formatId:r,templateId:n,authorizationKey:yt.value,printdlgshow:ut.printdlgshow,signature:ut.signature,copies:ut.printCopies};if("MULTI"===ut.strategy)for(let e=0;e<t.length;e++){e>0&&(a.printdlgshow="0");const n=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[e]));dt.printDirect({...a,params:n},o,Jt,Ut)}else dt.printDirect({...a,params:Kt(t,e)},(t=>{t.params=i,zt(t,"print")}),Jt,Ut)})).catch((()=>{Vt("print"),Bt(!1)})).finally((()=>{vt.visible=!1})))},Gt=async(t,{templateCode:e,templateId:n,key:r},i)=>{const a=vt.printParams[e];if(a)switch(vt.isClickOuterPrint=i,vt.currentFormatId=r,t){case"previewText":(async(t=[],e,n,r)=>{ut.showLoading&&Rt()||(Bt(!0,r),ut.prevFn("preview").then((()=>{vt.curPrintParamList=t;const i=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?i:Kt(t,e),l={formatId:r,templateId:n,authorizationKey:yt.value,params:a,btnprint:ut.btnprint,signature:ut.signature};dt.preview(l,(t=>{zt(t,"preview")}),Jt)})).catch((()=>{Vt("preview"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,r);break;case"formatEditText":((t=[],e,n,r)=>{ut.showLoading&&Rt()||(Bt(!0,r),ut.prevFn("edit").then((()=>{vt.curPrintParamList=t,vt.currentFormatId=r,vt.identityVerification.visible=!0})).catch((()=>{Vt("edit")})).finally((()=>{Bt(!1)})))})(a,0,0,r);break;case"downloadPdf":(async(t=[],e,n,r)=>{ut.showLoading&&Rt()||(Bt(!0,r),ut.prevFn("download").then((()=>{vt.curPrintParamList=t;const i=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,t[0])),a="MULTI"===ut.strategy?i:Kt(t,e),l={formatId:r,templateId:n,authorizationKey:yt.value,print:{print:"1",type:"1"},params:a,signature:ut.signature};dt.downloadPDF(l,(t=>zt(t,"preview")),Jt)})).catch((()=>{Vt("download"),Bt(!1)})).finally((()=>{vt.visible=!1})))})(a,e,n,r);break;case"resetPrinter":(async(t=[],e,n,r)=>{if(ut.showLoading&&Rt())return;Bt(!0,r);const i=await dt.resetPrinter(r);Bt(!1),"success"!=(null==i?void 0:i.result)?pt.warning("重置打印机失败"):pt.success(i.message||"重置打印机成功")})(a,0,0,r)}},Yt=()=>{},$t=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},Zt(n,e,t))})),n},Qt=(t,e=[])=>{let n={};return(e=e||[]).forEach((e=>{n=Object.assign({},te(n,e,t))})),n},Wt=(t,e,n)=>{const r={};return e.forEach((e=>{let i=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let r=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(r=A(e,n[t.type])),(null==t?void 0:t.defaultValue)||r})(e,t[e[n]]);t[e[n]]&&i&&(r[e[n]]=i)})),r},Xt=({customizeDataset:t=[],param:e=[]},n={})=>{let r={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;r.datasetData||(r.datasetData={}),r.datasetData[t.name]=JSON.stringify(Wt(n,e,"fieldName"))})),r=Object.assign({},r,Wt(n,e,"key")),r},Zt=(t,e,n)=>{if(e.templateNumbers){for(let r=0;r<e.templateNumbers.length;r++){const i=e.templateNumbers[r],a=n[i];if(!a)return pt.error("当前勾选的数据没有匹配的模板"),t;t[i]||(t[i]=[]),t[i].push(Xt(a,e))}return t}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i],l=n[a];if(!l)return pt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(Xt(l,e))}return t},te=(t,e,n)=>{if(e.templateNumbers){for(let r=0;r<e.templateNumbers.length;r++){const i=e.templateNumbers[r];if(!n[i])return pt.error("当前勾选的数据没有匹配的模板"),t;t[i]||(t[i]=[]),t[i].push(e)}return t}const r=Object.keys(n);for(let i=0;i<r.length;i++){const a=r[i];if(!n[a])return pt.error("当前勾选的数据没有匹配的模板"),t;t[a]||(t[a]=[]),t[a].push(e)}return t},ee=async t=>{vt.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],(()=>{var t,e,n;const r=vt.formatList.map((t=>({templateCode:t.number,templateId:t.templateId,label:t.name,key:t.id,selected:!1,isLoading:!1})));ft.value.unshift(...r),It.value&&ft.value.push(...ct),(null==(e=null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys)?void 0:e.length)>0&&(ft.value.forEach((t=>{var e;(null==(e=ut.newPrintSetting)?void 0:e.outerPrintKeys.includes(t.key))&&(t.selected=!0)})),wt.value=ft.value.filter((t=>t.selected))),bt.value=ft.value.filter((t=>!t.selected)),ut.hideButtons.length>0&&(gt.value=gt.value.filter((t=>!ut.hideButtons.includes(t.key))));const i=sessionStorage.getItem("portal");if(i){const t=JSON.parse(i),e=(null==(n=null==t?void 0:t.user)?void 0:n.currentRoleResourceObj)||{},r=Object.keys(e);r.includes("RY7.2.21.1.M2.G94181E")||(gt.value=gt.value.filter((t=>"downloadPdf"!=t.key))),r.includes("RY7.2.21.1.M2.G33633A")||(gt.value=gt.value.filter((t=>"formatEditText"!=t.key)))}})(),vt.templateParams=(t=>{let e={};return t&&t.forEach((t=>{if(!t.templateConfig)return!1;e[t.number]=t.templateConfig})),e})(t.obj),vt.printParams=$t(vt.templateParams,ut.params),vt.originParams=Qt(vt.templateParams,ut.params)},ne=async()=>{var t;if(vt.isInited)return!0;vt.isInited=!0,vt.spinning=!0,(()=>{if(dt)return!1;dt=new J})();const e=await ut.queryPrintFormatByNumber();return await ee(e),(null==(t=e.obj)?void 0:t.length)>0&&(yt.value=e.obj[0].authorizationKey||""),vt.spinning=!1,!0},re=async(t=!0)=>{if(await ut.clickPrevFn()){if(!vt.visible){if(!await ne())return!1}t&&(vt.visible=!vt.visible)}},ie=t=>{if(vt.identityVerification.visible=!1,U(vt.currentFormatId))return zt(null,"edit");const e=JSON.stringify(Object.assign({},JSON.parse(At()),Tt.value,vt.curPrintParamList[0])),n="MULTI"===ut.strategy?e:Kt(vt.curPrintParamList,St.value),r={formatId:vt.currentFormatId,templateId:Ot.value,params:n,token:t};dt.editPrintFormat(r,(t=>{zt(t,"edit")}),Jt)};async function ae(){await re(!1),(()=>{const t=Object.keys(vt.printParams);vt.isClickOuterPrint=!1;const e=vt.originParams;for(let n=0;n<t.length;n++){const r=t[n],i=vt.printParams[r],a=e[r]||[],l=vt.formatList.filter((t=>t.number==r));l&&l.length>0&&l.forEach((t=>{vt.currentFormatId=t.id,qt(i,t.number,t.templateId,t.id,a,!0)}))}})()}return a((()=>{vt.isInited=!1})),l((()=>ut.params),(t=>{Object.keys(vt.templateParams).length>0&&(vt.printParams=$t(vt.templateParams,ut.params),vt.originParams=Qt(vt.templateParams,ut.params))}),{deep:!0}),l((()=>{var t;return null==(t=ut.newPrintSetting)?void 0:t.outerPrintKeys}),(async t=>{(null==t?void 0:t.length)>0&&await re(!1)}),{deep:!0,immediate:!0}),st({directPrint:ae}),(e,n)=>(o(),s(u,null,[c("div",K,[p(" 外显按钮集合 "),d(m(I),null,{default:y((()=>[(o(!0),s(u,null,v(wt.value,(e=>{return o(),f(m(T),{key:e.key,class:"c-dropdown",placement:"bottom-start",trigger:"hover",onClickoutside:Yt,options:(n=m(gt),r=e,vt.printParams[r.templateCode]?n:[]),onSelect:t=>Gt(t,e,!0)},{default:y((()=>[d(m(L),{disabled:!vt.printParams[e.templateCode],loading:t.showLoading&&e.isLoading,onClick:t=>Ht(e.templateCode,e.templateId,e.key,!0)},{icon:y((()=>[d(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(e.label),1)])),_:2},1032,["disabled","loading","onClick"])])),_:2},1032,["options","onSelect"]);var n,r})),128))])),_:1}),p(' <n-button-group>\r\n\t\t\t<n-popover\r\n\t\t\t\tv-for="outer in outerPrintItems"\r\n :key="outer.key"\r\n\t\t\t\ttrigger="hover"\r\n\t\t\t\t:show-arrow="false"\r\n\t\t\t\t:show="downlistPopover.isOperation"\r\n\t\t\t\t@clickoutside="handleClickOutHide(\'isOperation\')"\r\n\t\t\t>\r\n\t\t\t\t<template #trigger>\r\n\t\t\t\t\t<n-button\r\n\t\t\t\t\t\t@mouseenter="delayShowPopover(\'isOperation\')"\r\n\t\t\t\t\t\t@mouseleave="handleClickOutHide(\'isOperation\')"\r\n\t\t\t\t\t\t@click="console.log(33)"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<template #icon>\r\n\t\t\t\t\t\t\t<n-icon :component="PrintOutline" size="18"></n-icon>\r\n\t\t\t\t\t\t</template>\r\n\t\t\t\t\t\t<span class="label bold">{{ outer.label }}</span>\r\n\t\t\t\t\t</n-button>\r\n\t\t\t\t</template>\r\n\t\t\t\t<div class="newprint-button-poperOver">\r\n\t\t\t\t\t<div\r\n\t\t\t\t\t\tclass="print-li"\r\n\t\t\t\t\t\tv-for="operation in operations"\r\n\t\t\t\t\t\t:key="operation.key"\r\n\t\t\t\t\t\t:class="downlistOperation.twoMouseType==operation.key ? \'active\' : \'\' "\r\n\t\t\t\t\t\t@mouseenter="handleTypeChange(\'twoMouseType\', operation.key)"\r\n\t\t\t\t\t\t@mouseleave="handleTypeChange(\'twoMouseType\', \'\')"\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t<div class="print-lite">\r\n\t\t\t\t\t\t\t<span class="label"> {{ operation.label }} </span>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</n-popover>\r\n\t\t</n-button-group> '),p(" 外显设置按钮 "),wt.value.length>0&&wt.value.length==m(Ft).length&&m(It)?(o(),f(m(j),{key:0,trigger:"click","show-arrow":!1,show:ht.isOutSetting,onClickoutside:n[2]||(n[2]=t=>Dt("isOutSetting"))},{trigger:y((()=>[d(m(L),{onClick:n[0]||(n[0]=t=>_t("isOutSetting"))},{default:y((()=>[B,d(m(F),{style:{"margin-left":"8px"},component:m(E),size:"18"},null,8,["component"])])),_:1})])),default:y((()=>[c("div",R,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",H,[c("span",q,k(t.label),1),d(m(M),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",G,[d(m(N)),c("div",Y,[d(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),d(m(M),{checked:m(jt),"onUpdate:checked":n[1]||(n[1]=t=>h(jt)?jt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:1},8,["show"])):(o(),s(u,{key:1},[p(" 打印全部按钮 "),d(m(j),{trigger:"click","show-arrow":!1,show:ht.oneShow,onClickoutside:n[10]||(n[10]=t=>Dt("oneShow"))},{trigger:y((()=>[b(e.$slots,"button",{handleClickPrintBtn:re,printSpinning:vt.spinning,printbtnText:t.btnText,printVisible:vt.visible},(()=>[d(m(I),{class:"newprint-button-component",onClick:n[4]||(n[4]=w((()=>Nt("icon")),["stop"]))},{default:y((()=>[d(m(L),{loading:t.showLoading&&vt.spinning,onClick:n[3]||(n[3]=w((()=>Nt("button")),["stop"]))},{icon:y((()=>[d(m(F),{component:m(x),size:"18"},null,8,["component"])])),default:y((()=>[g(" "+k(m(Ct)?"打印全部":t.btnText),1)])),_:1},8,["loading"]),d(m(L),{class:"icon-select"},{icon:y((()=>[d(m(F),{component:m(_),size:"18"},null,8,["component"])])),_:1})])),_:1})]))])),default:y((()=>[c("div",$,[(o(!0),s(u,null,v(bt.value,(t=>(o(),s("div",{class:P(["print-li",kt.oneMouseType==t.key||kt.oneClickType==t.key?"active":""]),key:t.key,onMouseenter:e=>xt("oneMouseType",t.key),onMouseleave:n[9]||(n[9]=t=>xt("oneMouseType","")),onClick:e=>((t,e,n)=>{if(!vt.printParams[n.templateCode])return[];xt(t,e)})("oneClickType",t.key,t)},["divider"==t.key?(o(),f(m(N),{key:0})):"outSetting"==t.key?(o(),s(u,{key:1},[p(" 第二层外显设置 "),d(m(j),{trigger:"click","show-arrow":!1,placement:"right-start",show:ht.isOutSetting,onClickoutside:n[7]||(n[7]=t=>Dt("isOutSetting"))},{trigger:y((()=>[c("div",{class:"print-lite",onClick:n[5]||(n[5]=t=>_t("isOutSetting"))},[c("span",W,k(t.label),1),d(m(F),{style:{background:"transparent"},component:m(E),size:"18"},null,8,["component"])])])),default:y((()=>[c("div",X,[(o(!0),s(u,null,v(m(Ft),(t=>(o(),s("div",{class:"print-li",key:t.key},[c("div",Z,[c("span",tt,k(t.label),1),d(m(M),{checked:t.selected,"onUpdate:checked":e=>t.selected=e},{default:y((()=>[g("外显")])),_:2},1032,["checked","onUpdate:checked"])])])))),128)),c("div",et,[d(m(N)),c("div",nt,[d(m(L),{type:"primary",size:"small",onClick:Et},{default:y((()=>[g("保存")])),_:1}),d(m(M),{checked:m(jt),"onUpdate:checked":n[6]||(n[6]=t=>h(jt)?jt.value=t:null)},{default:y((()=>[g("全选")])),_:1},8,["checked"])])])])])),_:2},1032,["show"])],2112)):(o(),s(u,{key:2},[p(" 第二层功能操作 "),c("div",{class:P(["print-lite",vt.printParams[t.templateCode]?"":"isDisabled"])},[c("span",{class:"label bold",onClick:e=>Ht(t.templateCode,t.templateId,t.key,!1)},k(t.label),9,rt),vt.printParams[t.templateCode]?(o(),f(m(j),{key:0,trigger:"click","show-arrow":!1,placement:"right-start",show:ht[t.key],onClickoutside:e=>Dt(t.key)},{trigger:y((()=>[d(m(F),{component:m(D),size:"18",onClick:e=>_t(t.key)},null,8,["component","onClick"])])),default:y((()=>[c("div",it,[(o(!0),s(u,null,v(m(gt),(e=>(o(),s("div",{class:P(["print-li",kt.twoMouseType==e.key?"active":""]),key:e.key,onMouseenter:t=>xt("twoMouseType",e.key),onMouseleave:n[8]||(n[8]=t=>xt("twoMouseType",""))},[c("div",lt,[c("span",{class:"label",onClick:n=>Gt(e.key,t,!1)},k(e.label),9,ot)])],42,at)))),128))])])),_:2},1032,["show","onClickoutside"])):p("v-if",!0)],2)],2112))],42,Q)))),128))])])),_:3},8,["show"])],2112))]),d(V,O(e.$attrs,{modelValue:vt.identityVerification.visible,"onUpdate:modelValue":n[11]||(n[11]=t=>vt.identityVerification.visible=t),formatId:vt.currentFormatId,templateId:m(Ot),onSuccess:ie}),null,16,["modelValue","formatId","templateId"])],64))}});export{st as default};
@@ -1 +1 @@
1
- import{defineComponent as t,computed as e,openBlock as s,createElementBlock as l,createCommentVNode as c,renderSlot as i,unref as n,Fragment as a,createElementVNode as o,toDisplayString as r}from"vue";import{descriptionConfig as p}from"./constants/index.js";const f={class:"default-page-getter-block"},g={key:0,class:"wrapper"},y=["src","alt"],d=["src","alt"],u={class:"page-description"},m={key:0,class:"title"},k={key:1,class:"content"};var v=t({__name:"index",props:{type:{type:String,default:"1"},config:{type:Object,default:()=>({title:"",content:""})}},setup(t){const v=t,b=e((()=>{let t=p[v.type];return v.config&&Object.keys(v.config).length>0&&Object.keys(v.config).forEach((e=>{const s=v.config[e];s&&(t[e]=s)})),t}));return(e,p)=>(s(),l("div",f,[c(" 默认插槽,自定义缺省页 "),i(e.$slots,"default",{},(()=>[t.type?(s(),l("div",g,[c(" 针对小空间和表格的情况 "),"16"==t.type?(s(),l("img",{key:0,class:"img-table",src:n(b).img,alt:n(b).title},null,8,y)):(s(),l(a,{key:1},[c(" 普通缺省情况 "),o("img",{class:"img-default",src:n(b).img,alt:n(b).title},null,8,d)],2112)),o("div",u,[n(b).title?(s(),l("span",m,r(n(b).title),1)):c("v-if",!0),n(b).content?(s(),l("span",k,r(n(b).content),1)):c("v-if",!0)])])):c("v-if",!0)]))]))}});export{v as default};
1
+ import{defineComponent as t,computed as e,openBlock as s,createElementBlock as l,createCommentVNode as c,renderSlot as i,unref as n,Fragment as a,createElementVNode as o,createTextVNode as r,toDisplayString as p}from"vue";import{descriptionConfig as g}from"./constants/index.js";const f={class:"default-page-getter-block"},d={key:0,class:"wrapper"},u=["src","alt"],m=["src","alt"],y={class:"page-description"},v={class:"title"},k={class:"content"};var b=t({__name:"index",props:{type:{type:String,default:"1"},config:{type:Object,default:()=>({title:"",content:""})}},setup(t){const b=t,j=e((()=>{let t=g[b.type];return b.config&&Object.keys(b.config).length>0&&Object.keys(b.config).forEach((e=>{const s=b.config[e];s&&(t[e]=s)})),t}));return(e,g)=>(s(),l("div",f,[c(" 默认插槽,自定义缺省页 "),i(e.$slots,"default",{},(()=>[t.type?(s(),l("div",d,[c(" 针对小空间和表格的情况 "),"16"==t.type?(s(),l("img",{key:0,class:"img-table",src:n(j).img,alt:n(j).title},null,8,u)):(s(),l(a,{key:1},[c(" 普通缺省情况 "),o("img",{class:"img-default",src:n(j).img,alt:n(j).title},null,8,m)],2112)),o("div",y,[o("div",v,[c(" 标题插槽 "),i(e.$slots,"title",{},(()=>[r(p(n(j).title),1)]))]),o("div",k,[c(" 内容描述插槽 "),i(e.$slots,"content",{},(()=>[r(p(n(j).content),1)]))])])])):c("v-if",!0)]))]))}});export{b as default};
@@ -475,9 +475,9 @@ declare const _default: import("vue").DefineComponent<{
475
475
  hide: boolean;
476
476
  }>;
477
477
  draggable: boolean;
478
- isHighlightRow: boolean;
479
478
  idx: number;
480
479
  isHighlight: boolean;
480
+ isHighlightRow: boolean;
481
481
  isFieldSet: boolean;
482
482
  fieldDescribeMode: "column" | "tooltip";
483
483
  }>;
@@ -524,7 +524,7 @@ declare const _default: import("vue").DefineComponent<{
524
524
  formRef: import("vue").Ref<any>;
525
525
  conditionRef: import("vue").Ref<any>;
526
526
  filterVisible: import("vue").Ref<boolean>;
527
- title: import("vue").ComputedRef<"修改" | "新增" | "过滤条件">;
527
+ title: import("vue").ComputedRef<"新增" | "修改" | "过滤条件">;
528
528
  model: {
529
529
  name: string;
530
530
  color: string;
@@ -496,9 +496,9 @@ declare const _default: import("vue").DefineComponent<{
496
496
  hide: boolean;
497
497
  }>;
498
498
  draggable: boolean;
499
- isHighlightRow: boolean;
500
499
  idx: number;
501
500
  isHighlight: boolean;
501
+ isHighlightRow: boolean;
502
502
  isFieldSet: boolean;
503
503
  fieldDescribeMode: "column" | "tooltip";
504
504
  }>;
@@ -613,9 +613,9 @@ declare const _default: import("vue").DefineComponent<{
613
613
  hide: boolean;
614
614
  }>;
615
615
  draggable: boolean;
616
- isHighlightRow: boolean;
617
616
  idx: number;
618
617
  isHighlight: boolean;
618
+ isHighlightRow: boolean;
619
619
  isFieldSet: boolean;
620
620
  fieldDescribeMode: "column" | "tooltip";
621
621
  }>;
@@ -317,9 +317,9 @@ declare const _default: import("vue").DefineComponent<{
317
317
  hide: boolean;
318
318
  }>;
319
319
  draggable: boolean;
320
- isHighlightRow: boolean;
321
320
  idx: number;
322
321
  isHighlight: boolean;
322
+ isHighlightRow: boolean;
323
323
  isFieldSet: boolean;
324
324
  fieldDescribeMode: "column" | "tooltip";
325
325
  }>;
@@ -44,7 +44,7 @@ declare const _default: import("vue").DefineComponent<{
44
44
  formRef: import("vue").Ref<any>;
45
45
  conditionRef: import("vue").Ref<any>;
46
46
  filterVisible: import("vue").Ref<boolean>;
47
- title: import("vue").ComputedRef<"修改" | "新增" | "过滤条件">;
47
+ title: import("vue").ComputedRef<"新增" | "修改" | "过滤条件">;
48
48
  model: {
49
49
  name: string;
50
50
  color: string;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as t,provide as o,computed as a,toRaw as l,watch as n,resolveComponent as r,openBlock as s,createElementBlock as i,mergeProps as u,unref as c,createBlock as d,resolveDynamicComponent as f,createVNode as m,withCtx as p,createTextVNode as v,createElementVNode as b,normalizeStyle as h,createSlots as g,renderList as x,createCommentVNode as y,renderSlot as k,normalizeProps as D,guardReactiveProps as C}from"vue";import{useTheme as j,createOpacityColor as w}from"../../../shared/hooks/useTheme.js";import{useDebounceFn as $}from"@vueuse/core";import"date-fns";import{isString as I,isEqualWith as q,isFunction as R,pick as _}from"lodash-es";import{useFormAsyncQueue as H,presetRequestHandler as T}from"../../../shared/hooks/useFormRequest/index.js";import{promiseTimeout as P}from"@vueuse/shared";import{hex2rgba as A,widthAppend as L,uuidGenerator as S}from"../../../shared/utils/index.js";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NSpin as F,NConfigProvider as O}from"naive-ui";import{useVersion as B}from"../../../shared/hooks/useVersion.js";import{VxeTableEventNameList as E,InjectionIhoTableXeInstance as W,InjectionIhoTableEmits as N,InjectionTableAsyncQueue as V,InjectionIhoTableAnnotation as z,InjectionIhoTableUUID as G,InjectionIhoTableInstance as J,InjectionIhoTableConfig as K,InjectionIhoTableFieldList as M,InjectionIhoTableHandler as Q,InjectionIhoTableGlobProps as U}from"./constants/index.js";import{createTableHooks as X,applyTableConfigHooks as Y,applyTableFieldHooks as Z,createTableEventHandlers as ee,createDomInsertComponent as te,createDataTransfer as oe}from"./hooks/tapHooks/index.js";import{provideIhoTableEventListener as ae}from"./hooks/tapHooks/useEventHooks.js";import{eventName2EventListener as le}from"./utils/index.js";const ne=["id"];var re=e({__name:"IhoTable",props:{tableConfig:{type:Object,default:()=>({})},fieldList:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},annotation:{type:Object},requestInstance:{type:Object},uniqueCacheData:{type:Boolean,default:!1},parallelism:{type:Number,default:3}},emits:["formChange","settingClick","formClick","keyboard","rowDrag",...E],setup(e,{expose:E,emit:re}){var se,ie;const ue=e,ce=t();o(W,ce);const de=t(!1),fe=a((()=>{var e,t,o;const a=j({"--c-border-color":"#d0d0d0","--c-head-bg-color":"#f2f2f2","--c-hover-color":"#e6e6e6","--c-stripe-color":"#f6f6f6"}).value;return a["--c-primary-color-opacity3"]=w(...A(a["--c-primary-color"]+""),.3),a["--c-scrollbar-width"]=L(null!=(o=null==(t=null==(e=ce.value)?void 0:e.reactData)?void 0:t.scrollbarWidth)?o:0),a})),me=a((()=>{var e,t;const o=null!=(t=null==(e=ue.tableConfig)?void 0:e.height)?t:"100%";return{height:"auto"===o?"100%":I(o)&&(o.includes("calc")||o.endsWith("%"))?o:L(o)}})),pe=ae(),ve=function(e,...t){re(e,...t);const o=c(ye)[le(e)];R(o)&&o(...t),pe.trigger(e,...t)};o(N,ve);const be=H(a((()=>ue.requestInstance)),a((()=>!!ue.uniqueCacheData))).create(ue.parallelism,{beforeRequest:(e,t)=>t,afterRequest:(e,t)=>T(t)});o(V,be);const he=X();o(z,a((()=>ue.annotation)));const ge=S();o(G,ge);const xe=t();o(J,xe);const ye=t({uuid:null!=(ie=null==(se=ue.tableConfig)?void 0:se.uuid)?ie:ge});o(K,ye);const ke=$(De,10);function De(){var e,t;ye.value=Y(he,{...ue.tableConfig,uuid:null!=(t=null==(e=ue.tableConfig)?void 0:e.uuid)?t:ge},{$table:xe,emits:ve,globProps:ue,loading:de})}const Ce=t([]);o(M,Ce);const je=$(we,10);function we(){const e=Z(he,ue.fieldList,ye.value,{$table:xe,emits:ve,loading:de,globProps:ue});q(e,l(Ce.value),((e,t)=>{if(R(e)&&R(t))return e.toString()===t.toString()}))||(Ce.value=e)}const $e=oe(he,ye,xe),Ie=t([]);async function qe(){var e,t;const o=await $e(ue.tableData),a=null==(e=xe.value)?void 0:e.getTableData().fullData;if(a){let e=0;if(!(a.some((t=>{var a;if(!(null==(a=xe.value)?void 0:a.isInsertByRow(t))){if(t!==o[e])return!0;e++}}))||e!==o.length))return}Ie.value=o,null==(t=xe.value)||t.recalculate(!0)}const Re={updateTableDataRef:$(qe,10),updateConfigRef:ke,updateFieldListRef:je};o(Q,Re),o(U,ue);const _e=ee({hooks:he,config:ye,$table:xe,context:Re,emits:ve,globProps:ue,loading:de}),He=a((()=>({...ye.value,..._e})));let Te=!1,Pe=!1,Ae=!1;const Le=$((()=>{Te&&De(),Pe&&we(),Ae&&qe(),Te=!1,Pe=!1,Ae=!1}),10);n((()=>ue.tableConfig),(()=>{Te=!0,Pe=!0,Ae=!0,Le()}),{deep:!0}),n((()=>ue.fieldList),(()=>{Pe=!0,Ae=!0,Le()}),{deep:!0}),n([()=>[...ue.tableData],()=>{var e;return null==(e=ue.tableData)?void 0:e.length}],(()=>{Ae=!0,Le()})),n([()=>ue.tableData,()=>{var e;return null==(e=ue.tableData)?void 0:e.length}],(async()=>{var e,t;(null==(e=ye.value.treeConfig)?void 0:e.expandAll)&&(await P(11),null==(t=xe.value)||t.setAllTreeExpand(!0))})),De(),we(),qe();const{header:Se,footer:Fe}=te(he);function Oe(e){return _(e,["row","rowIndex","$rowIndex","column","columnIndex","$columnIndex","_columnIndex","checked","disabled","indeterminate"])}return E({$table:xe,async loadData(e){var t;null==(t=xe.value)||t.loadData(await $e(e))},setSort:(e,t)=>({field:e,value:t}),setFilter:(e,t)=>({field:e,value:t}),reload(){var e,t;null==(e=xe.value)||e.loadColumn([]),null==(t=xe.value)||t.loadData([]),De(),we(),qe()},verticalTable:{update:()=>{}},...he.exposeHooks.expose.call({},ye,{$table:xe,emits:ve,globProps:ue,loading:de,...Re})}),he.setupHooks.setup.call(ye,Ce,{$table:xe,emits:ve,globProps:ue,loading:de}),(e,t)=>{const o=r("vxe-grid");return s(),i("section",u({class:"iho-table",id:c(ge),style:c(fe)},c(B)()),[(s(),d(f(c(Se)))),m(c(F),{show:de.value},{icon:p((()=>[])),description:p((()=>[v("数据加载中...")])),default:p((()=>[b("section",{style:h(c(me))},[m(c(O),{abstract:"",namespace:"vxe-table--ignore-clear"},{default:p((()=>[m(o,u({ref_key:"$table",ref:xe},c(He),{columns:Ce.value,data:Ie.value}),g({_:2},[x(e.$slots,((t,o)=>({name:o,fn:p((t=>[y(" 实际上所有的vxe-grid插槽都支持 "),k(e.$slots,o,D(C(Oe(t))))]))})))]),1040,["columns","data"])])),_:3})],4)])),_:3},8,["show"]),(s(),d(f(c(Fe))))],16,ne)}}});export{re as default};
1
+ import{defineComponent as e,ref as t,provide as o,computed as a,toRaw as l,watch as n,resolveComponent as r,openBlock as s,createElementBlock as i,mergeProps as u,unref as c,createBlock as d,resolveDynamicComponent as f,createVNode as m,normalizeStyle as p,withCtx as v,createTextVNode as b,createSlots as h,renderList as g,createCommentVNode as y,renderSlot as x,normalizeProps as k,guardReactiveProps as D}from"vue";import{useTheme as C,createOpacityColor as j}from"../../../shared/hooks/useTheme.js";import{useDebounceFn as w}from"@vueuse/core";import"date-fns";import{isString as $,isEqualWith as I,isFunction as q,pick as R}from"lodash-es";import{useFormAsyncQueue as _,presetRequestHandler as H}from"../../../shared/hooks/useFormRequest/index.js";import{promiseTimeout as T}from"@vueuse/shared";import{hex2rgba as P,widthAppend as A,uuidGenerator as L}from"../../../shared/utils/index.js";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import{NSpin as S,NConfigProvider as F}from"naive-ui";import{useVersion as O}from"../../../shared/hooks/useVersion.js";import{VxeTableEventNameList as B,InjectionIhoTableXeInstance as E,InjectionIhoTableEmits as W,InjectionTableAsyncQueue as N,InjectionIhoTableAnnotation as V,InjectionIhoTableUUID as z,InjectionIhoTableInstance as G,InjectionIhoTableConfig as J,InjectionIhoTableFieldList as K,InjectionIhoTableHandler as M,InjectionIhoTableGlobProps as Q}from"./constants/index.js";import{createTableHooks as U,applyTableConfigHooks as X,applyTableFieldHooks as Y,createTableEventHandlers as Z,createDomInsertComponent as ee,createDataTransfer as te}from"./hooks/tapHooks/index.js";import{provideIhoTableEventListener as oe}from"./hooks/tapHooks/useEventHooks.js";import{eventName2EventListener as ae}from"./utils/index.js";const le=["id"];var ne=e({__name:"IhoTable",props:{tableConfig:{type:Object,default:()=>({})},fieldList:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},annotation:{type:Object},requestInstance:{type:Object},uniqueCacheData:{type:Boolean,default:!1},parallelism:{type:Number,default:3}},emits:["formChange","settingClick","formClick","keyboard","rowDrag",...B],setup(e,{expose:B,emit:ne}){var re,se;const ie=e,ue=t();o(E,ue);const ce=t(!1),de=a((()=>{var e,t,o;const a=C({"--c-border-color":"#d0d0d0","--c-head-bg-color":"#f2f2f2","--c-hover-color":"#e6e6e6","--c-stripe-color":"#f6f6f6"}).value;return a["--c-primary-color-opacity3"]=j(...P(a["--c-primary-color"]+""),.3),a["--c-scrollbar-width"]=A(null!=(o=null==(t=null==(e=ue.value)?void 0:e.reactData)?void 0:t.scrollbarWidth)?o:0),a})),fe=a((()=>{var e,t;const o=null!=(t=null==(e=ie.tableConfig)?void 0:e.height)?t:"100%";return{height:"auto"===o?"100%":$(o)&&(o.includes("calc")||o.endsWith("%"))?o:A(o)}})),me=oe(),pe=function(e,...t){ne(e,...t);const o=c(ye)[ae(e)];q(o)&&o(...t),me.trigger(e,...t)};o(W,pe);const ve=_(a((()=>ie.requestInstance)),a((()=>!!ie.uniqueCacheData))).create(ie.parallelism,{beforeRequest:(e,t)=>t,afterRequest:(e,t)=>H(t)});o(N,ve);const be=U();o(V,a((()=>ie.annotation)));const he=L();o(z,he);const ge=t();o(G,ge);const ye=t({uuid:null!=(se=null==(re=ie.tableConfig)?void 0:re.uuid)?se:he});o(J,ye);const xe=w(ke,10);function ke(){var e,t;ye.value=X(be,{...ie.tableConfig,uuid:null!=(t=null==(e=ie.tableConfig)?void 0:e.uuid)?t:he},{$table:ge,emits:pe,globProps:ie,loading:ce})}const De=t([]);o(K,De);const Ce=w(je,10);function je(){const e=Y(be,ie.fieldList,ye.value,{$table:ge,emits:pe,loading:ce,globProps:ie});I(e,l(De.value),((e,t)=>{if(q(e)&&q(t))return e.toString()===t.toString()}))||(De.value=e)}const we=te(be,ye,ge),$e=t([]);async function Ie(){var e,t;const o=await we(ie.tableData),a=null==(e=ge.value)?void 0:e.getTableData().fullData;if(a){let e=0;if(!(a.some((t=>{var a;if(!(null==(a=ge.value)?void 0:a.isInsertByRow(t))){if(t!==o[e])return!0;e++}}))||e!==o.length))return}$e.value=o,null==(t=ge.value)||t.recalculate(!0)}const qe={updateTableDataRef:w(Ie,10),updateConfigRef:xe,updateFieldListRef:Ce};o(M,qe),o(Q,ie);const Re=Z({hooks:be,config:ye,$table:ge,context:qe,emits:pe,globProps:ie,loading:ce}),_e=a((()=>({...ye.value,...Re})));let He=!1,Te=!1,Pe=!1;const Ae=w((()=>{He&&ke(),Te&&je(),Pe&&Ie(),He=!1,Te=!1,Pe=!1}),10);n((()=>ie.tableConfig),(()=>{He=!0,Te=!0,Pe=!0,Ae()}),{deep:!0}),n((()=>ie.fieldList),(()=>{Te=!0,Pe=!0,Ae()}),{deep:!0}),n([()=>[...ie.tableData],()=>{var e;return null==(e=ie.tableData)?void 0:e.length}],(()=>{Pe=!0,Ae()})),n([()=>ie.tableData,()=>{var e;return null==(e=ie.tableData)?void 0:e.length}],(async()=>{var e,t;(null==(e=ye.value.treeConfig)?void 0:e.expandAll)&&(await T(11),null==(t=ge.value)||t.setAllTreeExpand(!0))})),ke(),je(),Ie();const{header:Le,footer:Se}=ee(be);function Fe(e){return R(e,["row","rowIndex","$rowIndex","column","columnIndex","$columnIndex","_columnIndex","checked","disabled","indeterminate"])}return B({$table:ge,async loadData(e){var t;null==(t=ge.value)||t.loadData(await we(e))},setSort:(e,t)=>({field:e,value:t}),setFilter:(e,t)=>({field:e,value:t}),reload(){var e,t;null==(e=ge.value)||e.loadColumn([]),null==(t=ge.value)||t.loadData([]),ke(),je(),Ie()},verticalTable:{update:()=>{}},...be.exposeHooks.expose.call({},ye,{$table:ge,emits:pe,globProps:ie,loading:ce,...qe})}),be.setupHooks.setup.call(ye,De,{$table:ge,emits:pe,globProps:ie,loading:ce}),(e,t)=>{const o=r("vxe-grid");return s(),i("section",u({class:"iho-table",id:c(he),style:c(de)},c(O)()),[(s(),d(f(c(Le)))),m(c(S),{show:ce.value,style:p(c(fe)),"content-style":c(fe)},{icon:v((()=>[])),description:v((()=>[b("数据加载中...")])),default:v((()=>[m(c(F),{abstract:"",namespace:"vxe-table--ignore-clear"},{default:v((()=>[m(o,u({ref_key:"$table",ref:ge},c(_e),{columns:De.value,data:$e.value}),h({_:2},[g(e.$slots,((t,o)=>({name:o,fn:v((t=>[y(" 实际上所有的vxe-grid插槽都支持 "),x(e.$slots,o,k(D(Fe(t))))]))})))]),1040,["columns","data"])])),_:3})])),_:3},8,["show","style","content-style"]),(s(),d(f(c(Se))))],16,le)}}});export{ne as default};
@@ -1 +1 @@
1
- import{onBeforeUnmount as e,createVNode as l,defineComponent as t,inject as i,computed as r,watch as u,onMounted as o}from"vue";import{traverse as d}from"../../../../shared/utils/index.js";import{promiseTimeout as n}from"@vueuse/shared";import{last as s,first as a}from"lodash-es";import"../../index.js";import{LOWEST_PRIORITY as f,InjectionIhoTableConfig as h,InjectionIhoTableXeInstance as c}from"../constants/index.js";import{mergeVxeStyle as v,useUUIDMap as g,mergeVxeClass as m}from"../utils/index.js";import{defineTablePlugin as x}from"../hooks/useTablePlugin.js";function p(){const p="stickyFixedPlugin";return x({name:p,apply(x){x.configHooks.config.tap(p,((e,{$table:l})=>{var t;if(null==(t=e.stickyFixedConfig)?void 0:t.enable){const t=e=>{if(!l.value)return{left:0,right:0};return{left:l.value.getColumns().slice(0,e).reduce(((e,l)=>e+l.renderWidth),0),right:l.value.getColumns().slice(e+1).reduce(((e,l)=>e+l.renderWidth),0)}};e.cellStyle=v((({columnIndex:e})=>({"--iho-table-fixed-left":t(e).left,"--iho-table-fixed-right":t(e).right})),e.cellStyle),e.headerCellStyle=v((({columnIndex:e})=>({"--iho-table-fixed-left":t(e).left,"--iho-table-fixed-right":t(e).right})),e.headerCellStyle)}return e}));const{getItemFromUUID:b,removeItemFromUUID:y}=g((()=>({left:[],noFixed:[],right:[],leftEle:null,leftBorderEle:null,rightEle:null,rightBorderEle:null})));function E(e,l){const{leftEle:t,rightEle:i}=e;t&&(l.scrollLeft>0?t.classList.add("scrolling--middle"):null==t||t.classList.remove("scrolling--middle")),i&&(Math.ceil(l.scrollLeft)<l.scrollWidth-l.clientWidth?i.classList.add("scrolling--middle"):null==i||i.classList.remove("scrolling--middle"))}x.fieldHooks.fieldList.tap({name:p,stage:f},((e,l)=>{var t;if(!(null==(t=l.stickyFixedConfig)?void 0:t.enable)||!l.uuid)return e;const i=b(l.uuid);return d(e,(e=>{e.fixed?(i[e.fixed].push(e),e.className=m(e.className,`iho-table--fixed-${e.fixed}`),e.headerClassName=m(e.headerClassName,`iho-table--fixed-${e.fixed}`)):i.noFixed.push(e),e.fixed=void 0})),[...i.left||[],...i.noFixed||[],...i.right||[]]})),x.setupHooks.setup.tap(p,(l=>{e((()=>{var e;(null==(e=l.value)?void 0:e.uuid)&&y(l.value.uuid)}))})),x.eventHooks.onScroll.tap(p,(({isX:e,$event:l},t)=>{var i;if(!e||!(null==(i=t.stickyFixedConfig)?void 0:i.enable)||!t.uuid)return;const r=l.target;if(!r)return;E(b(t.uuid),r)}));const k=t({setup(){const e=i(h),t=i(c),d=r((()=>{const l=b(e.value.uuid);return!(!l.left||!l.left.length)})),f=r((()=>{const l=b(e.value.uuid);return!(!l.right||!l.right.length)})),v=l=>{b(e.value.uuid).leftEle=l},g=l=>{b(e.value.uuid).leftBorderEle=l},m=l=>{b(e.value.uuid).rightEle=l},x=l=>{b(e.value.uuid).rightBorderEle=l};function p(){var l,i;if(!t.value||!e.value.uuid)return;const{refTableBody:r,refTableHeader:u}=t.value.getRefMaps();if(!r.value)return;const o=b(e.value.uuid);if(E(o,r.value.$el),!u.value)return;const{leftEle:d,rightBorderEle:n,rightEle:f,leftBorderEle:h}=o;if(d){const e=s(null==(l=u.value.$el)?void 0:l.querySelectorAll("th.iho-table--fixed-left"));e&&(d.style.width=e.offsetLeft+e.clientWidth+"px",h.style.width=d.style.width)}if(f){const e=a(null==(i=u.value.$el)?void 0:i.querySelectorAll("th.iho-table--fixed-right"));e&&(f.style.width=u.value.$el.clientWidth-e.offsetLeft-10+"px",n.style.width=f.style.width)}}return u([()=>b(e.value.uuid).left,()=>b(e.value.uuid).right],p),o((async()=>{await n(100),p()})),()=>[d.value?[l("div",{class:"iho-table__fixedLeftWrapper",ref:v},null),l("div",{class:"iho-table__fixedLeftTopBorder",ref:g},null)]:null,f.value?[l("div",{class:"iho-table__fixedRightWrapper",ref:m},null),l("div",{class:"iho-table__fixedRightTopBorder",ref:x},null)]:null]}}),L=t({setup(){const e=i(h);return()=>{var t,i;return(null==(i=null==(t=e.value)?void 0:t.stickyFixedConfig)?void 0:i.enable)?l(k,null,null):null}}});x.domInsertHooks.header.tap(p,(e=>(e.push(l(L,null,null)),e)))}})}export{p as stickyFixedPlugin};
1
+ import{onBeforeUnmount as e,createVNode as l,defineComponent as t,inject as i,computed as r,watch as u,onMounted as o}from"vue";import{traverse as d}from"../../../../shared/utils/index.js";import{promiseTimeout as n}from"@vueuse/shared";import{last as s,first as a}from"lodash-es";import"../../index.js";import{LOWEST_PRIORITY as f,InjectionIhoTableConfig as h,InjectionIhoTableXeInstance as c}from"../constants/index.js";import{mergeVxeStyle as v,useUUIDMap as g,mergeVxeClass as m}from"../utils/index.js";import{defineTablePlugin as x}from"../hooks/useTablePlugin.js";function p(){const p="stickyFixedPlugin";return x({name:p,apply(x){x.configHooks.config.tap(p,((e,{$table:l})=>{var t;if(null==(t=e.stickyFixedConfig)?void 0:t.enable){const t=e=>{if(!l.value)return{left:0,right:0};return{left:l.value.getColumns().slice(0,e).reduce(((e,l)=>e+l.renderWidth),0),right:l.value.getColumns().slice(e+1).reduce(((e,l)=>e+l.renderWidth),0)}};e.cellStyle=v((({columnIndex:e})=>({"--iho-table-fixed-left":t(e).left,"--iho-table-fixed-right":t(e).right})),e.cellStyle),e.headerCellStyle=v((({columnIndex:e})=>({"--iho-table-fixed-left":t(e).left,"--iho-table-fixed-right":t(e).right})),e.headerCellStyle)}return e}));const{getItemFromUUID:b,removeItemFromUUID:y}=g((()=>({left:[],noFixed:[],right:[],leftEle:null,leftBorderEle:null,rightEle:null,rightBorderEle:null})));function E(e,l){const{leftEle:t,rightEle:i}=e;t&&(l.scrollLeft>0?t.classList.add("scrolling--middle"):null==t||t.classList.remove("scrolling--middle")),i&&(Math.ceil(l.scrollLeft)<l.scrollWidth-l.clientWidth?i.classList.add("scrolling--middle"):null==i||i.classList.remove("scrolling--middle"))}x.fieldHooks.fieldList.tap({name:p,stage:f},((e,l)=>{var t;if(!(null==(t=l.stickyFixedConfig)?void 0:t.enable)||!l.uuid)return e;const i=b(l.uuid);return i.left=[],i.noFixed=[],i.right=[],d(e,(e=>{e.fixed?(i[e.fixed].push(e),e.className=m(e.className,`iho-table--fixed-${e.fixed}`),e.headerClassName=m(e.headerClassName,`iho-table--fixed-${e.fixed}`)):i.noFixed.push(e),e.fixed=void 0})),[...i.left||[],...i.noFixed||[],...i.right||[]]})),x.setupHooks.setup.tap(p,(l=>{e((()=>{var e;(null==(e=l.value)?void 0:e.uuid)&&y(l.value.uuid)}))})),x.eventHooks.onScroll.tap(p,(({isX:e,$event:l},t)=>{var i;if(!e||!(null==(i=t.stickyFixedConfig)?void 0:i.enable)||!t.uuid)return;const r=l.target;if(!r)return;E(b(t.uuid),r)}));const k=t({setup(){const e=i(h),t=i(c),d=r((()=>{const l=b(e.value.uuid);return!(!l.left||!l.left.length)})),f=r((()=>{const l=b(e.value.uuid);return!(!l.right||!l.right.length)})),v=l=>{b(e.value.uuid).leftEle=l},g=l=>{b(e.value.uuid).leftBorderEle=l},m=l=>{b(e.value.uuid).rightEle=l},x=l=>{b(e.value.uuid).rightBorderEle=l};function p(){var l,i;if(!t.value||!e.value.uuid)return;const{refTableBody:r,refTableHeader:u}=t.value.getRefMaps();if(!r.value)return;const o=b(e.value.uuid);if(E(o,r.value.$el),!u.value)return;const{leftEle:d,rightBorderEle:n,rightEle:f,leftBorderEle:h}=o;if(d){const e=s(null==(l=u.value.$el)?void 0:l.querySelectorAll("th.iho-table--fixed-left"));e&&(d.style.width=e.offsetLeft+e.clientWidth+"px",h.style.width=d.style.width)}if(f){const e=a(null==(i=u.value.$el)?void 0:i.querySelectorAll("th.iho-table--fixed-right"));e&&(f.style.width=u.value.$el.clientWidth-e.offsetLeft-10+"px",n.style.width=f.style.width)}}return u([()=>b(e.value.uuid).left,()=>b(e.value.uuid).right],p),o((async()=>{await n(100),p()})),()=>[d.value?[l("div",{class:"iho-table__fixedLeftWrapper",ref:v},null),l("div",{class:"iho-table__fixedLeftTopBorder",ref:g},null)]:null,f.value?[l("div",{class:"iho-table__fixedRightWrapper",ref:m},null),l("div",{class:"iho-table__fixedRightTopBorder",ref:x},null)]:null]}}),F=t({setup(){const e=i(h);return()=>{var t,i;return(null==(i=null==(t=e.value)?void 0:t.stickyFixedConfig)?void 0:i.enable)?l(k,null,null):null}}});x.domInsertHooks.header.tap(p,(e=>(e.push(l(F,null,null)),e)))}})}export{p as stickyFixedPlugin};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",i="3.2.5-beta.4",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.5-beta.4",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.5-beta.6",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.5-beta.6",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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.2.5-beta.4",
3
+ "version": "3.2.5-beta.6",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -71,5 +71,5 @@
71
71
  "iOS 7",
72
72
  "last 3 iOS versions"
73
73
  ],
74
- "gitHead": "3fde8cb166ce1935c40703633aa32175720d446e"
74
+ "gitHead": "8b01103dbf3fa6e9696419d4f6e5331bdfe2efdb"
75
75
  }