cnhis-design-vue 3.2.9-beta.27 → 3.2.9-beta.30

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.
Files changed (29) hide show
  1. package/es/components/button-print/src/utils/print.d.ts +5 -4
  2. package/es/components/button-print/src/utils/print.js +1 -1
  3. package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
  4. package/es/components/field-set/index.d.ts +1 -1
  5. package/es/components/field-set/src/FieldColor.vue.d.ts +6 -4
  6. package/es/components/field-set/src/FieldFilter.vue.d.ts +6 -4
  7. package/es/components/field-set/src/FieldSet.vue.d.ts +7 -6
  8. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  9. package/es/components/field-set/src/Index.vue.d.ts +1 -1
  10. package/es/components/field-set/src/Index.vue2.js +1 -1
  11. package/es/components/field-set/src/components/table-row.vue.d.ts +4 -4
  12. package/es/components/field-set/src/types/index.d.ts +1 -0
  13. package/es/components/field-set/style/index.css +1 -1
  14. package/es/components/iho-chat/index.d.ts +17 -4
  15. package/es/components/iho-chat/src/Index.vue.d.ts +17 -4
  16. package/es/components/iho-chat/src/Index.vue2.js +1 -1
  17. package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
  18. package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
  19. package/es/components/iho-chat/src/components/SiderList.vue.d.ts +1 -3
  20. package/es/components/iho-chat/src/components/SiderList.vue2.js +1 -1
  21. package/es/components/iho-chat/src/hooks/useState.d.ts +1 -0
  22. package/es/components/iho-chat/src/hooks/useState.js +1 -1
  23. package/es/components/iho-chat/src/types/index.d.ts +2 -1
  24. package/es/components/iho-chat/src/types/index.js +1 -1
  25. package/es/components/index.css +1 -1
  26. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  27. package/es/env.d.ts +25 -25
  28. package/es/shared/package.json.js +1 -1
  29. package/package.json +2 -2
@@ -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, iReportExecuteMode: number): Promise<any>;
39
+ resetPrinter(originFormatId: 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>;
@@ -62,18 +62,19 @@ export declare class Print {
62
62
  paramsSerializer(params: AnyObject): AnyObject;
63
63
  getIReportFormatId: (isIReport: boolean, formatId: string) => string;
64
64
  _queryPrintForBase64(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
65
+ _queryPrintForBase16(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
65
66
  _queryPrintForPdf(templateId: string, formatId: string, params: string | undefined, authorizationKey: String): Promise<any>;
66
67
  _browserPrint(result: AnyObject, mode: string): Promise<string | void>;
67
68
  _base64ToBlob(fileBase64: string, fileType: string): Blob;
68
- preview({ iReportExecuteMode, templateId, formatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
69
+ preview({ iReportExecuteMode, templateId, formatId: originFormatId, params, paramsArr, authorizationKey, signature, btnprint, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<any>;
69
70
  printSync(data: AnyObject[], successCallbackFn: AnyFn, errorCallbackFn: AnyFn): Promise<void>;
70
- printDirect({ iReportExecuteMode, templateId, formatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, svrUpdateIp, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
71
+ printDirect({ iReportExecuteMode, templateId, formatId: originFormatId, params, paramsArr, authorizationKey, print, signature, printdlgshow, nobillnode, copies, svrUpdateIp, isDownloadFile, messageTimeout }: AnyObject, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn, mode?: string): Promise<false | undefined>;
71
72
  printToHiPrint({ templateId, formatId, params, authorizationKey }: any, successCallbackFn: AnyFn, errorCallbackFn: AnyFn, cancelCallbackFn?: AnyFn): Promise<any>;
72
73
  private _downloadPDF;
73
74
  /**
74
75
  * 下载pdf
75
76
  */
76
- downloadPDF(params: AnyObject, onResolve: AnyFn, onReject: AnyFn): Promise<any>;
77
+ downloadPDF(paramsObj: AnyObject, onResolve: AnyFn, onReject: AnyFn): Promise<any>;
77
78
  print({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<false | undefined>;
78
79
  queryPrintData({ templateId, formatId, params, messageTimeout }: AnyObject, successCallbackFn?: AnyFn, errorCallbackFn?: AnyFn): Promise<false | {
79
80
  file: 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{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"),p=t.create({timeout:6e4,withCredentials:!1}),m=`${window.location.protocol}//${window.location.host}`,d=`${m}/fdp-api/print/assembly/printIReport`,g=`${m}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${m}/bi-api/reprot/print/open/client/previewIReport`,y=`${m}/bi-api/reprot/print/open/client/getRemote`,w=`${m}/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=>{p({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=>{p({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()?p({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}}):p({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}}):p({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)}):p({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,svrUpdateIp:i,params:s,paramsArr:r,cmdid:n,print:a,signature:o,copies:l,printdlgshow:h="0",nobillnode:u="1",btnprint:p="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:s,cmdid:n,nobillnode:u,printdlgshow:h,btnprint:p,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(r&&(d.paramsArr=r),a){try{a=JSON.parse(a)}catch(t){}d.print=a}else if(this.isRemote){const t=c(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}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 p({method:"get",url:y})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=m+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await p({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 p({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 p({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:p=0},m,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==m?void 0:m({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:p}),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==m||m(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:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},f,y,w,P="printDirect"){const v=r(i);if(i=this.getIReportFormatId(v,i),v&&(u||2==t)){if(!await this._testDomesticSystemConnection())return void y({type:"notOpenedApp",result:"error",message:"请开启ihoPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:a},f,y,w):y({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:a},f,y,w))}await this._queryProxyOrigin();const _=await this._testConnection();if(!this._handleResultTest(_,y))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:p,svrUpdateIp:m,messageTimeout:g}),r=this._handleResult(t,y,w);if(!r)return!1;d&&["downloadPDF"].includes(P)&&await this._browserPrint(r,P),null==f||f(r)}catch(t){const e="printDirect"===P?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e,result:"error"}:{message:e,result:"error"};null==y||y(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}}):p.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};
1
+ import t from"axios";import{cloneDeep as e,isArray as i}from"lodash-es";import{IdentityVerificationDialog as r,PreviewDialog as s}from"./dialog.js";import{isIReport as a,getFileUrl as n,useBrowserPrint as o}from"./browserPrint.js";import{getCurrentInstance as l}from"vue";import{uuidGenerator as c}from"../../../../shared/utils/index.js";import{format as h}from"date-fns";import{io as p}from"socket.io-client";const u=String(navigator.platform).toLowerCase().includes("linux"),m=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,g=`${d}/fdp-api/print/assembly/printIReport`,y=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${d}/bi-api/reprot/print/open/client/printIReportForHex`,w=`${d}/bi-api/reprot/print/open/client/previewIReport`,v=`${d}/bi-api/reprot/print/open/client/getRemote`,P=`${d}/printService/file`;let _=null;class b{constructor(){var t,e,i;if(this.webview=null,this.dialog=new r,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,_)return _;_=this;const a=window;this.CMonitor=a.$CMonitor;try{this.webview=a.top?null==(t=a.top.chrome)?void 0:t.webview:null==(e=a.chrome)?void 0:e.webview}catch(t){console.log(t),this.webview=null==(i=a.chrome)?void 0:i.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:r,reject:s}=e;try{if("resetprint"===(null==i?void 0:i.cmd))return void r({result:(null==i?void 0:i.res)?"success":"fail"});r(i.res||"")}catch(t){s(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=p(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=c();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,r)=>{this.messageHandlerQueue.push({resolve:i,reject:r,id:t}),this.webview.postMessage(e)})),new Promise(((e,r)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),r({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=a(t),r=this.getIReportFormatId(i,t);if(i&&(u||2==e)){return await this._testDomesticSystemConnection()?m({url:`${this.printDomesticOrigin}/resetPrint`,method:"get",withCredentials:!1,params:{formatId:r}}).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:r}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:r}}).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:r(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[r]}).then((({data:t})=>t));function r(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 r=t.message||t.Message;this._handleMonitorNotify(r);const s={type:"printError",message:r,result:t.result,errinfo:t.errinfo};return"cancel"==t.result?(i&&i({type:"printCancel",message:r,result:t.result,errinfo:t.errinfo}),!1):(null==e||e(s),!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,r,s){const a={templateId:t,formatId:e,params:i,cmdid:"7",messageTimeout:r},n=await this._queryServicesPrint(a);return this._handleQueryPrintDataResult(n,e,s)}_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,svrUpdateIp:i,params:r,paramsArr:s,cmdid:a,print:n,signature:o,copies:l,printdlgshow:c="0",nobillnode:p="1",btnprint:u="1",messageTimeout:m=0}){const d={templateId:t,formatId:e,svrUpdateIp:i,params:r,cmdid:a,nobillnode:p,printdlgshow:c,btnprint:u,copies:l,messageTimeout:m,...o?{signature:o}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}else if(this.isRemote){const t=h(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return this.queryServicesParams=d,await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:r,messageTimeout:s=0}){const a={};let n={};try{n=Object.assign({},a,JSON.parse(i))}catch(t){n=a}const o={templateId:t,formatId:e,cmdid:"9",token:r,params:JSON.stringify(n),messageTimeout:s};return await this._queryServicesPrint(o)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await m({method:"get",url:v})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:g,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="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:y,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForBase16(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:f,params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _queryPrintForPdf(t,e,i="",r){const s="object"==typeof i?i:JSON.parse(i),{data:a}=await m({method:"post",url:w,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(s),authorizationKey:r}})||{};return a}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,r=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),s=r[r.length-2],a=r[r.length-1],l=await n(`${P}/${s}/${a}`),c=o(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let r=i.length;const s=new Uint8Array(r);for(;r--;)s[r]=i.charCodeAt(r);return new Blob([s],{type:e})}async preview({iReportExecuteMode:t,templateId:e,formatId:i,params:r="",paramsArr:s,authorizationKey:n,signature:c,btnprint:h,messageTimeout:p=0},m,d){const g=a(i),y=this.getIReportFormatId(g,i);if(g&&(u||2==t)){const t=await this._queryPrintForPdf(e,y,r,n);if(!t)return null==d?void 0:d({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"});const i=o(t,"preview");return this.instance||(this.instance=l()),this.showPreview(this.instance,i),null==m?void 0:m({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:y,params:r,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),i=this._handleResult(t,d);if(!i)return!1;if(this.isRemote){const t=await this._browserPrint(i,"preview");this.instance||(this.instance=l()),this.showPreview(this.instance,t)}await this.getPicAndUpload(i),null==m||m(i)}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 r=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=c(),s=await this.messageCollect(t,{exec:"printA",data:r});if(s&&Array.isArray(s)){s.some((t=>"success"===t.res.result))?null==e||e(s):(null==i||i(s),this._handleMonitorNotify(s))}else{const t="打印命令返回无效数据";this._handleMonitorNotify(s||""),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:r="",paramsArr:s,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,isDownloadFile:d=!0,messageTimeout:g=0},y,f,w,v="printDirect"){const P=a(i),_=this.getIReportFormatId(P,i);if(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:_,params:r,authorizationKey:n},y,f,w):f({type:"connectAppFail",result:"error",message:"连接ihoPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:_,params:r,authorizationKey:n},y,f,w))}await this._queryProxyOrigin();const b=await this._testConnection();if(!this._handleResultTest(b,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:_,params:r,paramsArr:s,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,svrUpdateIp:m,messageTimeout:g}),i=this._handleResult(t,f,w);if(!i)return!1;d&&["downloadPDF"].includes(v)&&await this._browserPrint(i,v),null==y||y(i)}catch(t){const e="printDirect"===v?"打印失败":"下载失败",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:r},s,a,n){const o=await this._queryPrintForBase64(t,e,i,r);if(!o.success)return a({message:o.resultMsg,result:"error"});const{base64:l,formatId:c}=o.map;this.base64Fragment=l,this._successCallbackFn=s,this._errorCallbackFn=a,n&&(this._cancelCallbackFn=n),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,r,s){var n;const o=e(t);if(this.webview&&this.downloadPath&&(Reflect.has(o,"print")||Reflect.set(o,"print",{print:"1",type:"1"}),!o.print.filename)){const t=h(new Date,"yyyy-MM-dd"),e=c(),i=h(new Date,"yyyyMMddHHmmss")+e;o.print.filename=`${this.downloadPath}/${t}/${i}/${i}`.replace(/\\/g,"/")}const l=a(o.formatId);if(o.formatId=this.getIReportFormatId(l,o.formatId),l&&(u||2==o.iReportExecuteMode)){const t=await this._queryPrintForBase16(o.templateId||"",o.formatId,o.params||"",o.authorizationKey);return(null==t?void 0:t.success)?r({filebase64:null==(n=null==t?void 0:t.map)?void 0:n.hex,isIreport:!0}):null==s?void 0:s({type:"queryPrintDataFailure",result:"error",message:"获取文件失败!"})}this.printDirect(o,(async t=>{t||s({result:"error",message:""});const e=this,a=await async function(t){const r=[],s=JSON.parse(t);if(!i(s))return await e._downloadPDF("");if(1===s.length)return await e._downloadPDF(s[0]||"");for(let t=0,i=s.length;t<i;t++)r.push(await e._downloadPDF(s[t]||""));return r}(t.filedir);r(a,t)}),(t=>s(t)),(t=>{console.log(t)}),"downloadPDF")}async print({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this.queryPrintData({templateId:t,formatId:e,params:i,messageTimeout:r},void 0,a);if(!o)return!1;const l=this.printFileData({formatId:e,file:o.file,printerName:o.printerName},void 0,a);if(!l)return!1;s&&s(l)}async queryPrintData({templateId:t,formatId:e,params:i="",messageTimeout:r=0},s,a){const n=await this._testConnection();if(!this._handleResultTest(n,a))return!1;const o=await this._handleEventQueryPrintData(t,e,i,r,a);return!!o&&(s&&s(o),o)}async printFileData({formatId:t,file:e,printerName:i="Default"},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(n,s);return!!o&&(r&&r(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s=0},a,n){const o=await this._testConnection();if(!this._handleResultTest(o,n))return!1;const l=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:r,messageTimeout:s}),c=this._handleResult(l,n);if(!c)return!1;a&&a(c)}async addPrintFormat({templateId:t,params:e,token:i},r,s){const a=await this._testConnection();if(!this._handleResultTest(a,s))return!1;const n=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(n,s);if(!o)return!1;r&&r(o)}}export{b as Print};
@@ -175,6 +175,9 @@ declare const _default: import("vue").DefineComponent<{
175
175
  modelValue: unknown[];
176
176
  componentData: Record<string, any>;
177
177
  } & {
178
+ /**
179
+ * 改变弹窗大小
180
+ */
178
181
  itemKey?: string | Function | undefined;
179
182
  }>, {
180
183
  move: Function;
@@ -69,7 +69,7 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
69
69
  style: import("vue").ComputedRef<{
70
70
  '--row-height': string;
71
71
  '--primary-color': string;
72
- '--main-height': string;
72
+ '--main-height': any;
73
73
  }>;
74
74
  tabList: import("vue").ComputedRef<{
75
75
  name: import("./src/types").FieldSetTab;
@@ -47,6 +47,7 @@ declare const _default: import("vue").DefineComponent<{
47
47
  isHeadCheckHide?: boolean | undefined;
48
48
  isShow?: boolean | undefined;
49
49
  contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
50
+ hide?: boolean | undefined;
50
51
  }[]>;
51
52
  rowProps: {
52
53
  columns: {
@@ -59,6 +60,7 @@ declare const _default: import("vue").DefineComponent<{
59
60
  isHeadCheckHide?: boolean | undefined;
60
61
  isShow?: boolean | undefined;
61
62
  contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
63
+ hide?: boolean | undefined;
62
64
  }[];
63
65
  data: AnyObject[];
64
66
  onEdit: (row: AnyObject) => void;
@@ -525,12 +527,12 @@ declare const _default: import("vue").DefineComponent<{
525
527
  }>;
526
528
  developMode: boolean;
527
529
  draggable: boolean;
528
- fieldDescribeMode: "column" | "tooltip";
529
- isFieldSet: boolean;
530
- hideExpressionOption: AnyObject[];
530
+ isHighlightRow: boolean;
531
531
  idx: number;
532
532
  isHighlight: boolean;
533
- isHighlightRow: boolean;
533
+ isFieldSet: boolean;
534
+ fieldDescribeMode: "column" | "tooltip";
535
+ hideExpressionOption: AnyObject[];
534
536
  }>;
535
537
  EditDialog: import("vue").DefineComponent<{
536
538
  visible: {
@@ -38,6 +38,7 @@ declare const _default: import("vue").DefineComponent<{
38
38
  isHeadCheckHide?: boolean | undefined;
39
39
  isShow?: boolean | undefined;
40
40
  contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
41
+ hide?: boolean | undefined;
41
42
  }[]>;
42
43
  data: import("vue").Ref<{
43
44
  [x: string]: any;
@@ -63,6 +64,7 @@ declare const _default: import("vue").DefineComponent<{
63
64
  isHeadCheckHide?: boolean | undefined;
64
65
  isShow?: boolean | undefined;
65
66
  contentRender?: ((column: AnyObject, row: AnyObject) => import("vue").VNodeChild) | undefined;
67
+ hide?: boolean | undefined;
66
68
  }[];
67
69
  data: {
68
70
  [x: string]: any;
@@ -547,12 +549,12 @@ declare const _default: import("vue").DefineComponent<{
547
549
  }>;
548
550
  developMode: boolean;
549
551
  draggable: boolean;
550
- fieldDescribeMode: "column" | "tooltip";
551
- isFieldSet: boolean;
552
- hideExpressionOption: AnyObject[];
552
+ isHighlightRow: boolean;
553
553
  idx: number;
554
554
  isHighlight: boolean;
555
- isHighlightRow: boolean;
555
+ isFieldSet: boolean;
556
+ fieldDescribeMode: "column" | "tooltip";
557
+ hideExpressionOption: AnyObject[];
556
558
  }>;
557
559
  setStyle: typeof setStyle;
558
560
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "save" | "reset")[], "close" | "save" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -196,7 +196,6 @@ declare const _default: import("vue").DefineComponent<{
196
196
  tableRef: import("vue").Ref<any>;
197
197
  newFields: import("vue").Ref<AnyObject[]>;
198
198
  defaultColumns: FieldSetColumnItem[];
199
- otherColumns: FieldSetColumnItem[];
200
199
  columns: import("vue").Ref<{
201
200
  [x: string]: any;
202
201
  title: string;
@@ -207,6 +206,7 @@ declare const _default: import("vue").DefineComponent<{
207
206
  isHeadCheckHide?: boolean | undefined;
208
207
  isShow?: boolean | undefined;
209
208
  contentRender?: ((column: AnyObject, row: AnyObject) => VNodeChild) | undefined;
209
+ hide?: boolean | undefined;
210
210
  }[]>;
211
211
  itemWidth: import("vue").ComputedRef<string>;
212
212
  fieldList: import("vue").ComputedRef<AnyObject[]>;
@@ -222,6 +222,7 @@ declare const _default: import("vue").DefineComponent<{
222
222
  isHeadCheckHide?: boolean | undefined;
223
223
  isShow?: boolean | undefined;
224
224
  contentRender?: ((column: AnyObject, row: AnyObject) => VNodeChild) | undefined;
225
+ hide?: boolean | undefined;
225
226
  }[];
226
227
  data: AnyObject[];
227
228
  onUpdateChecked: ({ checked, column }: {
@@ -716,12 +717,12 @@ declare const _default: import("vue").DefineComponent<{
716
717
  }>;
717
718
  developMode: boolean;
718
719
  draggable: boolean;
719
- fieldDescribeMode: "column" | "tooltip";
720
- isFieldSet: boolean;
721
- hideExpressionOption: AnyObject[];
720
+ isHighlightRow: boolean;
722
721
  idx: number;
723
722
  isHighlight: boolean;
724
- isHighlightRow: boolean;
723
+ isFieldSet: boolean;
724
+ fieldDescribeMode: "column" | "tooltip";
725
+ hideExpressionOption: AnyObject[];
725
726
  }>;
726
727
  isArray: {
727
728
  (value?: any): value is any[];
@@ -851,9 +852,9 @@ declare const _default: import("vue").DefineComponent<{
851
852
  showSeq: boolean;
852
853
  developMode: boolean;
853
854
  footerFlag: boolean;
855
+ fieldDescribeMode: "column" | "tooltip";
854
856
  customColumns: FieldSetColumnItem[];
855
857
  showSortPriority: boolean;
856
858
  showHeadFilter: boolean;
857
- fieldDescribeMode: "column" | "tooltip";
858
859
  }>;
859
860
  export default _default;
@@ -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 s,unref as n,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 _,NTooltip as A,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 R,omit as N}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(),te=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"}],oe=[{title:"搜索",type:"checkbox",isHeadCheckHide:!0,field:"isSearch"},{title:"求和",type:"checkbox",isHeadCheckHide:!0,field:"isSum"},{title:"平均值",type:"checkbox",isHeadCheckHide:!0,field:"isAvg"}],de=l([]),ae=t((()=>{var e;return(null==(e=le.value)?void 0:e.scrollWidth)?le.value.scrollWidth+"px":"auto"})),re=t((()=>te.value.flat())),se=t((()=>re.value.some((e=>e.feildDescribe)))),ne=i({columns:de,data:re,onUpdateChecked:function({checked:e,column:l}){const t=!e||be(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}),ue={keyword:Z.value,idx:0,startIdx:0},ce=()=>{J("save")},fe=()=>{J("close")};function he(){te.value=pe(),ve(),Y.value=Date.now(),J("reset")}function pe(){const e=P(Q.fields).map((e=>({...e,uuid:I()})));return Object.keys(X).forEach((l=>{e.forEach((e=>{var t;"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==(t=e.relation)?void 0:t.fieldList)&&e.relation.fieldList.forEach((e=>{1==e.isSearch&&(e.checked=!0)}))}))})),function(e){if(Q.groupSetting){return q(Q.groupSetting,e).reduce(((t,i)=>{const o=R(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 me(){const e=ue.keyword!==Z.value;let l=Z.value?re.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(Z.value))return!!e||t>ue.idx})):0;-1!==l||e||(l=ue.startIdx),ee.value.scrollTop=52*l,Object.assign(ue,{keyword:Z.value,idx:l},e?{startIdx:l}:{})}function ye(e){var l;return!!Z.value&&(null==(l=e.title)?void 0:l.includes(Z.value))}function ve(){var e,l;de.value=P(ie),(null==(e=Q.showColumnNames)?void 0:e.length)&&(de.value=ie.concat(oe).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)&&de.value.push(...Q.customColumns),"column"===Q.fieldDescribeMode&&se.value&&de.value.push({title:"字段描述",type:"text",field:"feildDescribe"}),Q.showSeq&&de.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),de.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=te.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!be(e.field)&&!l}}))}function be(e){return te.value.flat().some((l=>!j(l,e)&&!l[e]&&"0001"!=l.id))}function ge(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&&(te.value=pe(),ve())}),{immediate:!0,deep:!0}),z({getTableFields:function(){let e=[];return e="old"==Q.type?re.value.map(((e,l)=>N({...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"]))):re.value,e.map((e=>N(e,["uuid"])))}}),(l,t)=>(a(),r("div",U,[e.showSearch?(a(),s(n(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(me,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",{class:"main-wrapper__table",ref_key:"tableRef",ref:le},[h("div",T,[(a(!0),r(p,null,m(de.value,((l,t)=>(a(),r(p,{key:t},[l.isShow?(a(),r("span",{key:0,class:"table-cell",style:y(n(B)(l,t,e.columnWidthProps))},[h("span",null,["checkbox"!==l.type||l.isHeadCheckHide?(a(),r(p,{key:1},[b(g(l.title),1)],64)):(a(),s(n(_),{key:0,checked:l.checkedAll,"onUpdate:checked":[e=>l.checkedAll=e,e=>{return t=e,i=l.field,void re.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(),s(n(A),{key:2,trigger:"hover"},{trigger:v((()=>[x(n(W),{component:n(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(),s(n(D),{modelValue:te.value,"onUpdate:modelValue":t[1]||(t[1]=e=>te.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:ge,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",n(V)(e)?"":"disabled"]),tabindex:l,style:y({width:n(ae)})},[n(M)(e)?(a(!0),r(p,{key:0},m(e,((e,t)=>(a(),s(F,w(ne,{key:t,element:e,idx:l+1,"is-highlight":ye(e)}),null,16,["element","idx","is-highlight"])))),128)):(a(),s(F,w({key:1},ne,{element:e,idx:l+1,"is-highlight":ye(e)}),null,16,["element","idx","is-highlight"]))],14,G))])),_:1},8,["modelValue","disabled"]))],512)],512),e.footerFlag?(a(),r("div",$,[f(" 底部按钮插槽 "),S(l.$slots,"footer",{},(()=>[x(n(E),{onPositiveClick:he},{trigger:v((()=>[x(n(H),{style:{"margin-right":"8px"}},{default:v((()=>[b("恢复默认设置")])),_:1})])),default:v((()=>[b(" 确认要恢复系统默认设置吗? ")])),_:1}),x(n(H),{style:{"margin-right":"8px"},onClick:fe},{default:v((()=>[b("取消")])),_:1}),x(n(H),{type:"primary",onClick:ce},{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 s,unref as n,withKeys as u,withModifiers as c,createCommentVNode as h,createElementVNode as f,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 _,NTooltip as A,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 R,omit as N}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=f("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=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:"checkbox",isHeadCheckHide:!0,field:"isSearch",hide:!0},{title:"求和",type:"checkbox",isHeadCheckHide:!0,field:"isSum",hide:!0},{title:"平均值",type:"checkbox",isHeadCheckHide:!0,field:"isAvg",hide:!0},{title:"脱敏配置",type:"select",field:"hideExpression",hide:!0}],oe=l([]),de=i((()=>{var e;return(null==(e=le.value)?void 0:e.scrollWidth)?le.value.scrollWidth+"px":"auto"})),ae=i((()=>ie.value.flat())),re=i((()=>ae.value.some((e=>e.feildDescribe)))),se=t({columns:oe,data:ae,onUpdateChecked:function({checked:e,column:l}){const i=!e||ve(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},ue=()=>{J("save")},ce=()=>{J("close")};function he(){ie.value=fe(),ye(),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=R(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 pe(){const e=ne.keyword!==Z.value;let l=Z.value?ae.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 me(e){var l;return!!Z.value&&(null==(l=e.title)?void 0:l.includes(Z.value))}function ye(){var e,l;oe.value=P(te),(null==(e=Q.showColumnNames)?void 0:e.length)&&(oe.value=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&&re.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))return!(["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)||e.hide);return!0}(e),"checkbox"===e.type){const l=ie.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!ve(e.field)&&!l}}))}function ve(e){return ie.value.flat().some((l=>!j(l,e)&&!l[e]&&"0001"!=l.id))}function be(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&&(ie.value=fe(),ye())}),{immediate:!0,deep:!0}),z({getTableFields:function(){let e=[];return e="old"==Q.type?ae.value.map(((e,l)=>N({...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"]))):ae.value,e.map((e=>N(e,["uuid"])))}}),(l,i)=>(a(),r("div",U,[e.showSearch?(a(),s(n(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(pe,["prevent"]),["enter"])},null,8,["value","onKeydown"])):h("v-if",!0),f("div",{class:"main-wrapper__table",ref_key:"tableRef",ref:le},[f("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(n(B)(l,i,e.columnWidthProps))},[f("span",null,["checkbox"!==l.type||l.isHeadCheckHide?(a(),r(p,{key:1},[b(g(l.title),1)],64)):(a(),s(n(_),{key:0,checked:l.checkedAll,"onUpdate:checked":[e=>l.checkedAll=e,e=>{return i=e,t=l.field,void ae.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(),s(n(A),{key:2,trigger:"hover"},{trigger:v((()=>[x(n(W),{component:n(K),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[L])),_:1})):h("v-if",!0)])],4)):h("v-if",!0)],64)))),128))]),f("div",{class:"main-wrapper__table-body",ref_key:"tableBodyRef",ref:ee},[(a(),s(n(D),{modelValue:ie.value,"onUpdate:modelValue":i[1]||(i[1]=e=>ie.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:be,disabled:!e.rowDraggable,key:Y.value},{item:v((({element:e,index:l})=>[e.hide?h("v-if",!0):(a(),r("div",{key:0,class:k(["item",n(V)(e)?"":"disabled"]),tabindex:l,style:y({width:n(de)})},[n(M)(e)?(a(!0),r(p,{key:0},m(e,((e,i)=>(a(),s(F,w(se,{key:i,element:e,idx:l+1,"is-highlight":me(e)}),null,16,["element","idx","is-highlight"])))),128)):(a(),s(F,w({key:1},se,{element:e,idx:l+1,"is-highlight":me(e)}),null,16,["element","idx","is-highlight"]))],14,G))])),_:1},8,["modelValue","disabled"]))],512)],512),e.footerFlag?(a(),r("div",$,[h(" 底部按钮插槽 "),S(l.$slots,"footer",{},(()=>[x(n(E),{onPositiveClick:he},{trigger:v((()=>[x(n(H),{style:{"margin-right":"8px"}},{default:v((()=>[b("恢复默认设置")])),_:1})])),default:v((()=>[b(" 确认要恢复系统默认设置吗? ")])),_:1}),x(n(H),{style:{"margin-right":"8px"},onClick:ce},{default:v((()=>[b("取消")])),_:1}),x(n(H),{type:"primary",onClick:ue},{default:v((()=>[b("保存")])),_:1})]))])):h("v-if",!0)]))}});export{z as default};
@@ -67,7 +67,7 @@ declare const _default: import("vue").DefineComponent<{
67
67
  style: import("vue").ComputedRef<{
68
68
  '--row-height': string;
69
69
  '--primary-color': string;
70
- '--main-height': string;
70
+ '--main-height': any;
71
71
  }>;
72
72
  tabList: import("vue").ComputedRef<{
73
73
  name: FieldSetTab;
@@ -1 +1 @@
1
- import{defineComponent as e,useAttrs as l,provide as t,reactive as i,ref as a,computed as r,openBlock as o,createElementBlock as s,normalizeStyle as d,unref as n,createBlock as f,withCtx as u,Fragment as m,renderList as h,resolveDynamicComponent as v,mergeProps as b,createSlots as p,renderSlot as y,h as c}from"vue";import{useThemeVars as g,NTabs as F,NTabPane as w}from"naive-ui";import C from"./FieldSet.vue.js";import L from"./FieldColor.vue.js";import S from"./TableStyle.vue.js";import T from"./FieldFilter.vue.js";import{InjectionFieldList as x,InjectionQueryWordbookData as $}from"./constants/index.js";import{useElementSize as _}from"@vueuse/core";var j=e({__name:"Index",props:{showTabNames:{type:Array,default:()=>["field"]},fieldColorList:{type:Array,default:()=>[]},highlightRowColorList:{type:Array,default:()=>[]},fieldList:{type:Object},queryWordbookData:{type:Function},fieldFilterList:{type:Array,default:()=>[]}},emits:["save"],setup(e,{expose:j,emit:k}){const R=e,A=l();t(x,R.fieldList),t($,R.queryWordbookData);const q=i({}),D=a(),N=a(g().value.primaryColor),{height:W}=_(D),H=r((()=>{var e;const l="showSearch"in A&&!1!==A.showSearch||"show-search"in A&&!1!==A["show-search"]?"52px":"auto",t=null==(e=A.style)?void 0:e.height,i=I.value.length>1&&"100%"===t&&(null==W?void 0:W.value)?`calc(${W.value}px - 54px)`:t&&"auto"!==t?`calc(${t} - 54px)`:"auto";return{"--row-height":l,"--primary-color":N.value,"--main-height":i}})),I=r((()=>[{name:"field",tab:"字段设置",render:()=>c(C)},{name:"fieldColor",tab:"字段颜色",render:()=>c(L,{isFieldColor:!0,defaultList:R.fieldColorList})},{name:"highlightRow",tab:"高亮行",render:()=>c(L,{isFieldColor:!1,defaultList:R.highlightRowColorList})},{name:"tableStyle",tab:"表格样式",render:()=>c(S)},{name:"fieldFilter",tab:"高级筛选",render:()=>c(T,{defaultList:R.fieldFilterList})}].filter((e=>R.showTabNames.includes(e.name)))));function O(){var e,l,t,i,a;k("save",{tableFields:null==(e=q.field)?void 0:e.getTableFields(),tableFieldColors:null==(l=q.fieldColor)?void 0:l.getTableFields(),tableHighlightRows:null==(t=q.highlightRow)?void 0:t.getTableFields(),tableStyle:null==(i=q.tableStyle)?void 0:i.getTableFields(),tableFilters:null==(a=q.fieldFilter)?void 0:a.getTableFields()})}function z(e,l){q[l]=e}return j({getTableFields:function(e){var l;return null==(l=q[e||"field"])?void 0:l.getTableFields()}}),(e,l)=>(o(),s("div",{class:"c-field-set",style:d(n(H)),ref_key:"fieldSetRef",ref:D},[n(I).length>1?(o(),f(n(F),{key:0,type:"line",naimated:""},{default:u((()=>[(o(!0),s(m,null,h(n(I),(l=>(o(),f(n(w),{key:l.name,name:l.name,tab:l.tab,"display-directive":"show"},{default:u((()=>[(o(),f(v(l.render()),b(e.$attrs,{ref_for:!0,ref:e=>z(e,l.name),onSave:O}),p({_:2},[h(e.$slots,((l,t)=>({name:t,fn:u((()=>[y(e.$slots,t)]))})))]),1040))])),_:2},1032,["name","tab"])))),128))])),_:3})):(o(),f(v(n(I)[0].render()),b({key:1},e.$attrs,{ref:e=>z(e,n(I)[0].name),onSave:O}),p({_:2},[h(e.$slots,((l,t)=>({name:t,fn:u((()=>[y(e.$slots,t)]))})))]),1040))],4))}});export{j as default};
1
+ import{defineComponent as e,useAttrs as l,provide as t,reactive as i,ref as r,computed as a,openBlock as o,createElementBlock as s,normalizeStyle as d,unref as n,createBlock as f,withCtx as u,Fragment as m,renderList as h,resolveDynamicComponent as v,mergeProps as b,createSlots as p,renderSlot as y,h as g}from"vue";import{useThemeVars as c,NTabs as F,NTabPane as w}from"naive-ui";import C from"./FieldSet.vue.js";import L from"./FieldColor.vue.js";import S from"./TableStyle.vue.js";import T from"./FieldFilter.vue.js";import{InjectionFieldList as _,InjectionQueryWordbookData as x}from"./constants/index.js";import{useElementSize as $}from"@vueuse/core";var j=e({__name:"Index",props:{showTabNames:{type:Array,default:()=>["field"]},fieldColorList:{type:Array,default:()=>[]},highlightRowColorList:{type:Array,default:()=>[]},fieldList:{type:Object},queryWordbookData:{type:Function},fieldFilterList:{type:Array,default:()=>[]}},emits:["save"],setup(e,{expose:j,emit:k}){const R=e,A=l();t(_,R.fieldList),t(x,R.queryWordbookData);const q=i({}),D=r(),N=r(c().value.primaryColor),{height:W}=$(D),H=a((()=>{var e;const l="showSearch"in A&&!1!==A.showSearch||"show-search"in A&&!1!==A["show-search"]?"52px":"auto";let t=(null==(e=A.style)?void 0:e.height)||"100%";if(I.value.length>1){t=`calc(${"100%"===t&&(null==W?void 0:W.value)?W.value+"px":t} - 54px)`}return{"--row-height":l,"--primary-color":N.value,"--main-height":t}})),I=a((()=>[{name:"field",tab:"字段设置",render:()=>g(C)},{name:"fieldColor",tab:"字段颜色",render:()=>g(L,{isFieldColor:!0,defaultList:R.fieldColorList})},{name:"highlightRow",tab:"高亮行",render:()=>g(L,{isFieldColor:!1,defaultList:R.highlightRowColorList})},{name:"tableStyle",tab:"表格样式",render:()=>g(S)},{name:"fieldFilter",tab:"高级筛选",render:()=>g(T,{defaultList:R.fieldFilterList})}].filter((e=>R.showTabNames.includes(e.name)))));function O(){var e,l,t,i,r;k("save",{tableFields:null==(e=q.field)?void 0:e.getTableFields(),tableFieldColors:null==(l=q.fieldColor)?void 0:l.getTableFields(),tableHighlightRows:null==(t=q.highlightRow)?void 0:t.getTableFields(),tableStyle:null==(i=q.tableStyle)?void 0:i.getTableFields(),tableFilters:null==(r=q.fieldFilter)?void 0:r.getTableFields()})}function z(e,l){q[l]=e}return j({getTableFields:function(e){var l;return null==(l=q[e||"field"])?void 0:l.getTableFields()}}),(e,l)=>(o(),s("div",{class:"c-field-set",style:d(n(H)),ref_key:"fieldSetRef",ref:D},[n(I).length>1?(o(),f(n(F),{key:0,type:"line",naimated:""},{default:u((()=>[(o(!0),s(m,null,h(n(I),(l=>(o(),f(n(w),{key:l.name,name:l.name,tab:l.tab,"display-directive":"show"},{default:u((()=>[(o(),f(v(l.render()),b(e.$attrs,{ref_for:!0,ref:e=>z(e,l.name),onSave:O}),p({_:2},[h(e.$slots,((l,t)=>({name:t,fn:u((()=>[y(e.$slots,t)]))})))]),1040))])),_:2},1032,["name","tab"])))),128))])),_:3})):(o(),f(v(n(I)[0].render()),b({key:1},e.$attrs,{ref:e=>z(e,n(I)[0].name),onSave:O}),p({_:2},[h(e.$slots,((l,t)=>({name:t,fn:u((()=>[y(e.$slots,t)]))})))]),1040))],4))}});export{j as default};
@@ -380,11 +380,11 @@ declare const _default: import("vue").DefineComponent<{
380
380
  }>;
381
381
  developMode: boolean;
382
382
  draggable: boolean;
383
- fieldDescribeMode: "column" | "tooltip";
384
- isFieldSet: boolean;
385
- hideExpressionOption: AnyObject[];
383
+ isHighlightRow: boolean;
386
384
  idx: number;
387
385
  isHighlight: boolean;
388
- isHighlightRow: boolean;
386
+ isFieldSet: boolean;
387
+ fieldDescribeMode: "column" | "tooltip";
388
+ hideExpressionOption: AnyObject[];
389
389
  }>;
390
390
  export default _default;
@@ -28,6 +28,7 @@ export type FieldSetColumnItem = {
28
28
  isHeadCheckHide?: boolean;
29
29
  isShow?: boolean;
30
30
  contentRender?: (column: AnyObject, row: AnyObject) => VNodeChild;
31
+ hide?: boolean;
31
32
  [key: string]: any;
32
33
  };
33
34
  export type FieldSetTab = 'field' | 'fieldColor' | 'highlightRow' | 'tableStyle' | 'fieldFilter';
@@ -1 +1 @@
1
- .c-field-set{height:100%;width:100%}.c-field-set__color-picker .n-color-picker-trigger__value{display:none}.c-field-set .main-wrapper{box-sizing:border-box;display:flex;flex-flow:column nowrap;height:var(--main-height)!important;width:100%}.c-field-set .main-wrapper__search-wrapper.n-input{margin-bottom:12px;width:50%}.c-field-set .main-wrapper .item{background:#fff}.c-field-set .main-wrapper .item:active{background:#f2f2f2;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .main-wrapper .item:focus{background-color:#f2f2f2}.c-field-set .main-wrapper .item.disabled{cursor:not-allowed}.c-field-set .main-wrapper .item .row{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:var(--row-height);padding:8px 0}.c-field-set .main-wrapper .table-cell{word-wrap:break-word;box-sizing:border-box;color:inherit;display:inline-block;padding:0 5px}.c-field-set .main-wrapper .table-cell .highlight{background-color:var(--primary-color);color:#fff}.c-field-set .main-wrapper .table-cell .c-field-set__color-picker{display:block}.c-field-set .main-wrapper__table{box-sizing:border-box;flex:1;overflow:auto;width:100%}.c-field-set .main-wrapper__table-header{align-items:center;background:#f2f2f4;border:1px solid #f2f2f2;display:flex;height:52px;position:sticky;top:0;z-index:1}.c-field-set .main-wrapper__table-header .n-checkbox.n-checkbox--disabled .n-checkbox__label{color:var(--n-text-color)}.c-field-set .main-wrapper__table-header .table-cell{align-items:center;background:#f2f2f4;display:flex;height:100%}.c-field-set .main-wrapper__table-body{height:calc(100% - 52px)}.c-field-set .main-wrapper__table-footer{border-top:1px solid #d5d5d5;padding:12px 0}.c-field-set .main-wrapper .set-item{padding:10px 0}.c-field-set .main-wrapper .set-item.table-item{border-top:1px solid #e8e8e8;width:50%}.c-field-set .main-wrapper .set-item.table-item h4{font-size:16px;font-weight:400;margin-bottom:12px}.c-field-set .main-wrapper .set-item.table-item .table-style{background:#e5e5e5;border:2px solid #cfcfcf;border-radius:4px;cursor:pointer;margin-bottom:10px;padding:20px 0 0}.c-field-set .main-wrapper .set-item.table-item .table-style .table-bg{background:#fff;border-radius:5px;margin:0 20px 20px;padding:10px}.c-field-set .main-wrapper .set-item.table-item .table-style .table-bg img{width:100%}.c-field-set .main-wrapper .set-item.table-item .table-style__desc{align-items:center;background:#fff;display:flex;padding:10px}.c-field-set .main-wrapper .set-item.table-item .table-style__desc .n-icon{color:var(--c-primary-color);font-size:20px}.c-field-set .main-wrapper .set-item.table-item .table-style__desc .circle{border:1px solid #d5d5d5;border-radius:50%;display:inline-block;height:18px;width:18px}.c-field-set .main-wrapper .set-item.table-item .table-style__desc span{margin-left:5px}.c-field-set .main-wrapper .set-item.table-item .table-style.active{background:#e2ebfa;border:2px solid var(--c-primary-color)}.c-field-set__color-block{display:inline-block;margin-left:20px;position:relative}.c-field-set__color-block:before{background-color:var(--color);border-radius:2px;content:"";height:14px;left:-20px;position:absolute;top:3px;width:14px}.c-field-set__space{width:100%}.c-field-set__space>div:first-child{width:80%}.c-field-set__space .filter-btn{color:var(--c-primary-color);cursor:pointer}.c-field-set__condition .opt-btn{cursor:pointer;display:inline-flex}.c-field-set__condition .condition-wrapper__item{align-items:center;display:flex;margin-top:10px}.c-field-set__condition .condition-wrapper__item .item-index{margin-right:10px}.c-field-set__condition .condition-wrapper__item>.n-date-picker,.c-field-set__condition .condition-wrapper__item>.n-input,.c-field-set__condition .condition-wrapper__item>.n-input-number,.c-field-set__condition .condition-wrapper__item>.n-select{margin-right:10px;width:20%}.c-field-set__condition .sql-expression-wrapper{margin-top:10px}
1
+ .c-field-set{height:100%;width:100%}.c-field-set__color-picker .n-color-picker-trigger__value{display:none}.c-field-set .main-wrapper{box-sizing:border-box;display:flex;flex-flow:column nowrap;height:var(--main-height)!important;width:100%}.c-field-set .main-wrapper__search-wrapper.n-input{margin-bottom:12px;width:50%}.c-field-set .main-wrapper .item{background:#fff}.c-field-set .main-wrapper .item:active{background:#f2f2f2;box-shadow:0 0 10px 0 #d5d5d5}.c-field-set .main-wrapper .item:focus{background-color:#f2f2f2}.c-field-set .main-wrapper .item.disabled{cursor:not-allowed}.c-field-set .main-wrapper .item .row{align-items:center;border-bottom:1px solid #e8e8e8;display:flex;height:var(--row-height);padding:8px 0}.c-field-set .main-wrapper .table-cell{word-wrap:break-word;box-sizing:border-box;color:inherit;display:inline-block;padding:0 5px}.c-field-set .main-wrapper .table-cell .highlight{background-color:var(--primary-color);color:#fff}.c-field-set .main-wrapper .table-cell .c-field-set__color-picker{display:block}.c-field-set .main-wrapper__table{box-sizing:border-box;display:flex;flex:1;flex-flow:column nowrap;min-height:0;overflow:auto;width:100%}.c-field-set .main-wrapper__table-header{align-items:center;background:#f2f2f4;border:1px solid #f2f2f2;display:flex;height:52px;position:sticky;top:0;z-index:1}.c-field-set .main-wrapper__table-header .n-checkbox.n-checkbox--disabled .n-checkbox__label{color:var(--n-text-color)}.c-field-set .main-wrapper__table-header .table-cell{align-items:center;background:#f2f2f4;display:flex;height:100%}.c-field-set .main-wrapper__table-body{flex:1}.c-field-set .main-wrapper__table-footer{border-top:1px solid #d5d5d5;padding:12px 0}.c-field-set .main-wrapper .set-item{padding:10px 0}.c-field-set .main-wrapper .set-item.table-item{border-top:1px solid #e8e8e8;width:50%}.c-field-set .main-wrapper .set-item.table-item h4{font-size:16px;font-weight:400;margin-bottom:12px}.c-field-set .main-wrapper .set-item.table-item .table-style{background:#e5e5e5;border:2px solid #cfcfcf;border-radius:4px;cursor:pointer;margin-bottom:10px;padding:20px 0 0}.c-field-set .main-wrapper .set-item.table-item .table-style .table-bg{background:#fff;border-radius:5px;margin:0 20px 20px;padding:10px}.c-field-set .main-wrapper .set-item.table-item .table-style .table-bg img{width:100%}.c-field-set .main-wrapper .set-item.table-item .table-style__desc{align-items:center;background:#fff;display:flex;padding:10px}.c-field-set .main-wrapper .set-item.table-item .table-style__desc .n-icon{color:var(--c-primary-color);font-size:20px}.c-field-set .main-wrapper .set-item.table-item .table-style__desc .circle{border:1px solid #d5d5d5;border-radius:50%;display:inline-block;height:18px;width:18px}.c-field-set .main-wrapper .set-item.table-item .table-style__desc span{margin-left:5px}.c-field-set .main-wrapper .set-item.table-item .table-style.active{background:#e2ebfa;border:2px solid var(--c-primary-color)}.c-field-set__color-block{display:inline-block;margin-left:20px;position:relative}.c-field-set__color-block:before{background-color:var(--color);border-radius:2px;content:"";height:14px;left:-20px;position:absolute;top:3px;width:14px}.c-field-set__space{width:100%}.c-field-set__space>div:first-child{width:80%}.c-field-set__space .filter-btn{color:var(--c-primary-color);cursor:pointer}.c-field-set__condition .opt-btn{cursor:pointer;display:inline-flex}.c-field-set__condition .condition-wrapper__item{align-items:center;display:flex;margin-top:10px}.c-field-set__condition .condition-wrapper__item .item-index{margin-right:10px}.c-field-set__condition .condition-wrapper__item>.n-date-picker,.c-field-set__condition .condition-wrapper__item>.n-input,.c-field-set__condition .condition-wrapper__item>.n-input-number,.c-field-set__condition .condition-wrapper__item>.n-select{margin-right:10px;width:20%}.c-field-set__condition .sql-expression-wrapper{margin-top:10px}
@@ -23,6 +23,10 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
23
23
  defaultSessionKey: {
24
24
  type: StringConstructor;
25
25
  };
26
+ show: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
26
30
  }, {
27
31
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
28
32
  token: {
@@ -48,6 +52,10 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
48
52
  defaultSessionKey: {
49
53
  type: StringConstructor;
50
54
  };
55
+ show: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
51
59
  }>> & {
52
60
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
53
61
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
@@ -75,13 +83,15 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
75
83
  currentGroupUser: import("../../shared/types").AnyObject[];
76
84
  showMultipleVideo: boolean;
77
85
  };
78
- reConnention: number;
86
+ unreadTotal: import("vue").ComputedRef<number>;
79
87
  openSession: (item: import("../../shared/types").AnyObject) => Promise<void>;
80
88
  closeSession: () => import("../../shared/types").AnyObject | null;
81
89
  getCurrentSession: () => import("../../shared/types").AnyObject | null;
82
90
  setSessionList: (list: import("../../shared/types").AnyObject[]) => void;
83
91
  setUpdateSessionItem: (item: import("../../shared/types").AnyObject) => void;
84
92
  setCurrentSessionItem: (item: import("../../shared/types").AnyObject) => void;
93
+ updateSessionList: (sessionItem: import("../../shared/types").AnyObject) => void;
94
+ reConnention: number;
85
95
  groupSessionList: import("../../shared/types").AnyObject[];
86
96
  init: () => Promise<void>;
87
97
  initWebSocket: () => void;
@@ -114,12 +124,10 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
114
124
  }[]>;
115
125
  currentFilterKey: import("vue").Ref<string>;
116
126
  state: import("./src/types").IState;
117
- emit: (event: string, ...args: any[]) => void;
127
+ unreadTotal: import("vue").ComputedRef<number>;
118
128
  openSession: (item: import("../../shared/types").AnyObject) => Promise<void>;
119
- updateSessionList: (sessionItem: import("../../shared/types").AnyObject) => void;
120
129
  currentWidth: import("vue").ComputedRef<number>;
121
130
  sessionList: import("vue").ComputedRef<import("../../shared/types").AnyObject[]>;
122
- unreadTotal: import("vue").ComputedRef<number>;
123
131
  changeWidth: ({ distance }: import("../../shared/types").AnyObject) => void;
124
132
  handleFilter: (key: string) => void;
125
133
  showSession: (item: import("../../shared/types").AnyObject, currentKey?: string) => boolean | undefined;
@@ -1863,10 +1871,15 @@ declare const IhoChat: SFCWithInstall<import("vue").DefineComponent<{
1863
1871
  defaultSessionKey: {
1864
1872
  type: StringConstructor;
1865
1873
  };
1874
+ show: {
1875
+ type: BooleanConstructor;
1876
+ default: boolean;
1877
+ };
1866
1878
  }>> & {
1867
1879
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
1868
1880
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
1869
1881
  }, {
1882
+ show: boolean;
1870
1883
  baseURL: string;
1871
1884
  chatBox: boolean;
1872
1885
  }>>;
@@ -28,6 +28,10 @@ declare const _default: import("vue").DefineComponent<{
28
28
  defaultSessionKey: {
29
29
  type: StringConstructor;
30
30
  };
31
+ show: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
31
35
  }, {
32
36
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
33
37
  token: {
@@ -53,6 +57,10 @@ declare const _default: import("vue").DefineComponent<{
53
57
  defaultSessionKey: {
54
58
  type: StringConstructor;
55
59
  };
60
+ show: {
61
+ type: BooleanConstructor;
62
+ default: boolean;
63
+ };
56
64
  }>> & {
57
65
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
58
66
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
@@ -80,13 +88,15 @@ declare const _default: import("vue").DefineComponent<{
80
88
  currentGroupUser: AnyObject[];
81
89
  showMultipleVideo: boolean;
82
90
  };
83
- reConnention: number;
91
+ unreadTotal: import("vue").ComputedRef<number>;
84
92
  openSession: (item: AnyObject) => Promise<void>;
85
93
  closeSession: () => AnyObject | null;
86
94
  getCurrentSession: () => AnyObject | null;
87
95
  setSessionList: (list: AnyObject[]) => void;
88
96
  setUpdateSessionItem: (item: AnyObject) => void;
89
97
  setCurrentSessionItem: (item: AnyObject) => void;
98
+ updateSessionList: (sessionItem: AnyObject) => void;
99
+ reConnention: number;
90
100
  groupSessionList: AnyObject[];
91
101
  init: () => Promise<void>;
92
102
  initWebSocket: () => void;
@@ -119,12 +129,10 @@ declare const _default: import("vue").DefineComponent<{
119
129
  }[]>;
120
130
  currentFilterKey: import("vue").Ref<string>;
121
131
  state: IState;
122
- emit: (event: string, ...args: any[]) => void;
132
+ unreadTotal: import("vue").ComputedRef<number>;
123
133
  openSession: (item: AnyObject) => Promise<void>;
124
- updateSessionList: (sessionItem: AnyObject) => void;
125
134
  currentWidth: import("vue").ComputedRef<number>;
126
135
  sessionList: import("vue").ComputedRef<AnyObject[]>;
127
- unreadTotal: import("vue").ComputedRef<number>;
128
136
  changeWidth: ({ distance }: AnyObject) => void;
129
137
  handleFilter: (key: string) => void;
130
138
  showSession: (item: AnyObject, currentKey?: string) => boolean | undefined;
@@ -1868,10 +1876,15 @@ declare const _default: import("vue").DefineComponent<{
1868
1876
  defaultSessionKey: {
1869
1877
  type: StringConstructor;
1870
1878
  };
1879
+ show: {
1880
+ type: BooleanConstructor;
1881
+ default: boolean;
1882
+ };
1871
1883
  }>> & {
1872
1884
  "onTemplate-click"?: ((...args: any[]) => any) | undefined;
1873
1885
  "onUnread-message-update"?: ((...args: any[]) => any) | undefined;
1874
1886
  }, {
1887
+ show: boolean;
1875
1888
  baseURL: string;
1876
1889
  chatBox: boolean;
1877
1890
  }>;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as s,reactive as t,provide as o,onBeforeUnmount as n,openBlock as r,createElementBlock as i,normalizeStyle as a,unref as c,createVNode as d,withCtx as u,createBlock as l,Fragment as p,createElementVNode as m,renderSlot as h,createCommentVNode as f}from"vue";import{NConfigProvider as y,NSpin as g,NLayout as S,NLayoutContent as v}from"naive-ui";import b from"./components/SiderList.vue.js";import M from"./components/ChatHeader.vue.js";import I from"./components/ChatMain.vue.js";import k from"./components/ChatFooter.vue.js";import T from"./components/ChatSearch.vue.js";import V from"./components/ChatAdd.vue.js";import j from"./components/Video.vue.js";import L from"./components/MultipleVideo.vue.js";import{ChatSock as A}from"./utils/chatSock.js";import{instanceAxios as N,readMessageApi as w}from"./api/index.js";import{useTheme as U}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{remove as _,isNumber as C}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{CHAT_TYPE as E,SUBSCRIBE_MESSAGE_TYPE as O,AV_STATUS as x}from"./constants/index.js";import{InjectionIChatState as R,InjectionIChatStompClient as G,InjectionIChatEmits as K}from"./types/index.js";import{isAudioOrVideoMessage as B}from"./utils/index.js";import{useSession as P}from"./hooks/useSession.js";import"trtc-sdk-v5";const J={key:0,class:"iho-chat__header"},$={class:"toolbar"};var q=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"},chatBox:{type:Boolean,default:!1},defaultSessionKey:{type:String}},emits:["template-click","unread-message-update"],setup(e,{expose:q,emit:F}){const H=e;N.defaults.baseURL=H.baseURL,N.defaults.headers.Authorization="bearer "+H.token;const z=U(),D=s(!1),W=s(),Y=t({orgId:H.orgId,currentSessionItem:{},id:"",userInfo:{id:H.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,currentReEditMsg:null,showVideo:!1,currentAVMsg:{},currentGroupUser:[],showMultipleVideo:!1});o(R,Y),o(G,W),o(K,F);const{openSession:Q,closeSession:X,getCurrentSession:Z,setSessionList:ee,setUpdateSessionItem:se,setCurrentSessionItem:te}=P(Y),oe=[];function ne(){const e={headers:{AccessToken:H.token,UserId:H.userId},heartbeatFn(){try{W.value.send("test")}catch(e){W.value.disconnect(),ne()}},connectCb(){console.log("连接成功"),W.value.subscribe("/user/topic/single",(({body:e})=>ie({body:e,chatType:E.SINGLE}))),W.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:t,currentUser:o,sessionVos:n}=s;if(Object.assign(Y.userInfo,o,t),!(null==n?void 0:n.length))return;ee(n),oe.splice(0,oe.length),oe.push(...n.filter((e=>e.chatType===E.GROUP))),oe.forEach((e=>{W.value.subscribe(`/topic/group/${e.receiver}`,(({body:e})=>ie({body:e,chatType:E.GROUP})))})),function(){const e=Y.sessionList.find((e=>e.sessionKey===H.defaultSessionKey));e&&Q(e)}()}catch(e){console.log(e)}}))},errorCb(e,s){}};W.value=new A("/fdp-chat/websocket",e)}async function re(e,s){if(Y.currentMsg=e,e.sessionKey===Y.currentSessionItem.sessionKey)return Y.isAppendMsg=!0,e.sender!==Y.userInfo.id&&await w({chatType:s,messageIdSet:[e.id],receiver:Y.userInfo.id,sender:e.sender}),void te({lastMessageSendTime:e.sendTime,lastMessage:e.content,sortTime:e.sendTime,unreadNum:0,lastSenderName:e.senderName});const t={lastMessageSendTime:e.sendTime,sortTime:e.sendTime,lastMessage:e.content,sessionKey:e.sessionKey,lastSenderName:e.senderName,sender:e.sender};se(t)}async function ie({body:e,chatType:s}){try{const t=JSON.parse(e),{messageVo:o,sessionVo:n,chatAvStatusVo:r}=t;switch(t.event){case O.MESSAGE:B(o.content)?!Y.showVideo&&!Y.showMultipleVideo||o.content.avStatus!==x.IN_CALL?(Y.currentMsg=o,Object.assign(Y.currentAVMsg,{strRoomId:o.sessionKey,chatMessageType:o.content.chatMessageType,callMode:o.sender===Y.userInfo.id?"call":"invite",currentMsg:o}),Y.showVideo||Y.showMultipleVideo?re(o,s):Y.showVideo=!0):(W.value.send("/app/chat/send",{},JSON.stringify({chatType:E.SINGLE,receiver:o.sender,content:{chatMessageType:o.content.chatMessageType,avStatus:x.CALL_BUSY}})),console.log("用户忙!")):re(o,s);break;case O.RECALL_MESSAGE:break;case O.AV_STATUS:Object.assign(Y.currentAVMsg,r,{callMode:r.sender===Y.userInfo.id?"call":"invite",checkedIds:[]}),Y.showVideo||Y.showMultipleVideo?console.log("用户忙!"):Y.showMultipleVideo=!0;break;case O.NEW_SESSION:if(s===E.GROUP)return;se(n);break;case O.JOIN:if(s===E.GROUP)return;se(n),W.value.subscribe(`/topic/group/${n.receiver}`,(({body:e})=>ie({body:e,chatType:E.GROUP})));break;case O.LEAVE:X(),_(Y.sessionList,(e=>e.sessionKey===n.sessionKey))}}catch(e){console.log(e)}}return async function(){ne()}(),n((()=>{var e;null==(e=W.value)||e.disconnect()})),q({getUnreadData:function(){return Y.sessionList.filter((e=>C(e.unreadNum)&&e.unreadNum>0))},openSession:Q,closeSession:X,getCurrentSession:Z}),(s,t)=>(r(),i("div",{class:"iho-chat",style:a(c(z))},[d(c(y),{abstract:"",namespace:"iho-chat__popover"},{default:u((()=>[D.value?(r(),l(c(g),{key:0,stroke:"#5585f5"})):(r(),i(p,{key:1},[e.chatBox?f("v-if",!0):(r(),i("div",J,[d(T),d(V,{title:"发起群聊",mode:"create","default-value":[Y.userInfo]},null,8,["default-value"]),m("div",$,[h(s.$slots,"toolbar")])])),d(c(S),{class:"iho-chat__body","has-sider":""},{default:u((()=>[e.chatBox?f("v-if",!0):(r(),l(b,{key:0})),d(c(v),{class:"chat-content"},{default:u((()=>[d(M),d(I),d(k)])),_:1}),h(s.$slots,"external")])),_:3}),Y.showVideo?(r(),l(j,{key:1})):f("v-if",!0),Y.showMultipleVideo?(r(),l(L,{key:2})):f("v-if",!0)],64))])),_:3})],4))}});export{q as default};
1
+ import{defineComponent as e,ref as s,reactive as t,computed as o,provide as n,onBeforeUnmount as i,watch as r,openBlock as a,createElementBlock as c,normalizeStyle as u,unref as d,createVNode as l,withCtx as p,createBlock as m,Fragment as h,createElementVNode as f,renderSlot as S,createCommentVNode as y}from"vue";import{NConfigProvider as g,NSpin as v,NLayout as b,NLayoutContent as M}from"naive-ui";import I from"./components/SiderList.vue.js";import k from"./components/ChatHeader.vue.js";import L from"./components/ChatMain.vue.js";import T from"./components/ChatFooter.vue.js";import V from"./components/ChatSearch.vue.js";import j from"./components/ChatAdd.vue.js";import w from"./components/Video.vue.js";import N from"./components/MultipleVideo.vue.js";import{ChatSock as U}from"./utils/chatSock.js";import{instanceAxios as A,readMessageApi as C}from"./api/index.js";import{useTheme as _}from"../../../shared/hooks/useTheme.js";import"@vueuse/core";import"date-fns";import{remove as E,isNumber as O}from"lodash-es";import"@vue/shared";import"../../../shared/utils/index.js";import{promiseTimeout as x}from"@vueuse/shared";import"../../../shared/hooks/selectHooks/useSearchContent.js";import"@vicons/ionicons5";import"../../../shared/hooks/useScrollLoading.js";import{CHAT_TYPE as R,SUBSCRIBE_MESSAGE_TYPE as G,AV_STATUS as K}from"./constants/index.js";import{InjectionIChatState as B,InjectionIChatStompClient as P,InjectionIChatEmits as J,InjectionIChatUnreadTotal as $}from"./types/index.js";import{isAudioOrVideoMessage as q,listSort as F}from"./utils/index.js";import{useSession as H}from"./hooks/useSession.js";import"trtc-sdk-v5";const z={key:0,class:"iho-chat__header"},D={class:"toolbar"};var W=e({__name:"Index",props:{token:{type:String,required:!0},orgId:{type:[String,Number],required:!0},userId:{type:String,required:!0},baseURL:{type:String,default:"/fdp-chat"},chatBox:{type:Boolean,default:!1},defaultSessionKey:{type:String},show:{type:Boolean,default:!0}},emits:["template-click","unread-message-update"],setup(e,{expose:W,emit:Y}){const Q=e;A.defaults.baseURL=Q.baseURL,A.defaults.headers.Authorization="bearer "+Q.token;const X=_(),Z=s(!1),ee=s(),se=t({orgId:Q.orgId,currentSessionItem:{},id:"",userInfo:{id:Q.userId},msgList:[],currentMsg:{},isAppendMsg:!1,sessionList:[],isChangeSession:!1,updateSessionItem:{},isUpdateSession:!1,currentReferenceMsg:null,currentReEditMsg:null,showVideo:!1,currentAVMsg:{},currentGroupUser:[],showMultipleVideo:!1}),te=o((()=>se.sessionList.reduce(((e,s)=>e+ +s.unreadNum),0)));n(B,se),n(P,ee),n(J,Y),n($,te);const{openSession:oe,closeSession:ne,getCurrentSession:ie,setSessionList:re,setUpdateSessionItem:ae,setCurrentSessionItem:ce,updateSessionList:ue}=H(se),de=[];function le(){const e={headers:{AccessToken:Q.token,UserId:Q.userId},heartbeatFn(){try{ee.value.send("test")}catch(e){ee.value.disconnect(),le()}},connectCb(){console.log("连接成功"),ee.value.subscribe("/user/topic/single",(({body:e})=>me({body:e,chatType:R.SINGLE}))),ee.value.subscribe("/app/sessionList",(({body:e})=>{try{const s=JSON.parse(e),{authentication:t,currentUser:o,sessionVos:n}=s;if(Object.assign(se.userInfo,o,t),!(null==n?void 0:n.length))return;re(n),de.splice(0,de.length),de.push(...n.filter((e=>e.chatType===R.GROUP))),de.forEach((e=>{ee.value.subscribe(`/topic/group/${e.receiver}`,(({body:e})=>me({body:e,chatType:R.GROUP})))})),function(){const e=se.sessionList.find((e=>e.sessionKey===Q.defaultSessionKey));e&&oe(e)}()}catch(e){console.log(e)}}))},errorCb(e,s){}};ee.value=new U("/fdp-chat/websocket",e)}async function pe(e,s){if(se.currentMsg=e,e.sessionKey===se.currentSessionItem.sessionKey)return se.isAppendMsg=!0,e.sender!==se.userInfo.id&&await C({chatType:s,messageIdSet:[e.id],receiver:se.userInfo.id,sender:e.sender}),void ce({lastMessageSendTime:e.sendTime,lastMessage:e.content,sortTime:e.sendTime,unreadNum:0,lastSenderName:e.senderName});const t={lastMessageSendTime:e.sendTime,sortTime:e.sendTime,lastMessage:e.content,sessionKey:e.sessionKey,lastSenderName:e.senderName,sender:e.sender};ae(t)}async function me({body:e,chatType:s}){try{const t=JSON.parse(e),{messageVo:o,sessionVo:n,chatAvStatusVo:i}=t;switch(t.event){case G.MESSAGE:q(o.content)?!se.showVideo&&!se.showMultipleVideo||o.content.avStatus!==K.IN_CALL?(se.currentMsg=o,Object.assign(se.currentAVMsg,{strRoomId:o.sessionKey,chatMessageType:o.content.chatMessageType,callMode:o.sender===se.userInfo.id?"call":"invite",currentMsg:o}),se.showVideo||se.showMultipleVideo?pe(o,s):se.showVideo=!0):(ee.value.send("/app/chat/send",{},JSON.stringify({chatType:R.SINGLE,receiver:o.sender,content:{chatMessageType:o.content.chatMessageType,avStatus:K.CALL_BUSY}})),console.log("用户忙!")):pe(o,s);break;case G.RECALL_MESSAGE:break;case G.AV_STATUS:Object.assign(se.currentAVMsg,i,{callMode:i.sender===se.userInfo.id?"call":"invite",checkedIds:[]}),se.showVideo||se.showMultipleVideo?console.log("用户忙!"):se.showMultipleVideo=!0;break;case G.NEW_SESSION:if(s===R.GROUP)return;ae(n);break;case G.JOIN:if(s===R.GROUP)return;ae(n),ee.value.subscribe(`/topic/group/${n.receiver}`,(({body:e})=>me({body:e,chatType:R.GROUP})));break;case G.LEAVE:ne(),E(se.sessionList,(e=>e.sessionKey===n.sessionKey))}}catch(e){console.log(e)}}return async function(){le()}(),i((()=>{var e;null==(e=ee.value)||e.disconnect()})),r((()=>te.value),(e=>{!async function s(t=0){const o=F(se.sessionList),n=o.every((e=>!!e.name));if(!(t>2))if(n){const s=o.filter((e=>{var s;return+(null!=(s=e.unreadNum)?s:0)>0}));Y("unread-message-update",e,s)}else await x(100),s(++t)}()})),r([()=>se.isChangeSession,()=>se.isUpdateSession],(([e,s])=>{e&&(ue(se.currentSessionItem),se.isChangeSession=!1),s&&(ue(se.updateSessionItem),se.isUpdateSession=!1)}),{immediate:!0}),W({getUnreadData:function(){return se.sessionList.filter((e=>O(e.unreadNum)&&e.unreadNum>0))},openSession:oe,closeSession:ne,getCurrentSession:ie}),(s,t)=>e.show?(a(),c("div",{key:0,class:"iho-chat",style:u(d(X))},[l(d(g),{abstract:"",namespace:"iho-chat__popover"},{default:p((()=>[Z.value?(a(),m(d(v),{key:0,stroke:"#5585f5"})):(a(),c(h,{key:1},[e.chatBox?y("v-if",!0):(a(),c("div",z,[l(V),l(j,{title:"发起群聊",mode:"create","default-value":[se.userInfo]},null,8,["default-value"]),f("div",D,[S(s.$slots,"toolbar")])])),l(d(b),{class:"iho-chat__body","has-sider":""},{default:p((()=>[e.chatBox?y("v-if",!0):(a(),m(I,{key:0})),l(d(M),{class:"chat-content"},{default:p((()=>[l(k),l(L),l(T)])),_:1}),S(s.$slots,"external")])),_:3}),se.showVideo?(a(),m(w,{key:1})):y("v-if",!0),se.showMultipleVideo?(a(),m(N,{key:2})):y("v-if",!0)],64))])),_:3})],4)):y("v-if",!0)}});export{W as default};