cnhis-design-vue 3.2.8-beta.0 → 3.2.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +0 -3
- package/es/components/field-set/src/FieldColor.vue.d.ts +3 -3
- package/es/components/field-set/src/FieldFilter.vue.d.ts +3 -3
- package/es/components/field-set/src/FieldSet.vue.d.ts +4 -4
- package/es/components/field-set/src/components/table-row.vue.d.ts +3 -3
- package/es/components/iho-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/iho-chat/src/components/PersonProfile.vue2.js +1 -1
- package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
- package/es/env.d.ts +25 -25
- package/es/shared/package.json.js +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const m=t.create({timeout:6e4,withCredentials:!1}),p=`${window.location.protocol}//${window.location.host}`,d=`${p}/fdp-api/print/assembly/printIReport`,u=`${p}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${p}/bi-api/reprot/print/open/client/previewIReport`,g=`${p}/bi-api/reprot/print/open/client/getRemote`,y=`${p}/printService/file`;let w=null;class P{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.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,w)return w;w=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="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("hiprint系统连接失败",e),t&&t(!1)}}async getPicAndUpload(t){try{const e=t=>"[object Object]"===Object.prototype.toString.call(t);if("success"===(null==t?void 0:t.result)&&"Y"==(null==t?void 0:t.uploadTemplateFlag)&&!(null==t?void 0:t.filebase64)&&this.queryServicesParams){const t=e(this.queryServicesParams.params)?this.queryServicesParams.params:JSON.parse(this.queryServicesParams.params);t.uploadTemplateFlag="Y",this.queryServicesParams.params=JSON.stringify(t),this.queryServicesParams.cmdid="7",this.queryServicesParams.print={print:1,type:6,zip:0},this.queryServicesParams.paramsArr=[{params:JSON.stringify(t)}];await this._queryBase64ServicesPrint(this.queryServicesParams)}}catch(t){console.log(t)}finally{this.queryServicesParams=null}}async postMessage(t,e=0){if(!this.webview)return Promise.reject();const i=l();return e&&e>0?this.messageCollectAndNotifyFail(i,t,e):this.messageCollect(i,t)}messageCollect(t,e){return new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)}))}messageCollectAndNotifyFail(t,e,i){return Promise.race([new Promise(((i,s)=>{this.messageHandlerQueue.push({resolve:i,reject:s,id:t}),this.webview.postMessage(e)})),new Promise(((e,s)=>{setTimeout((()=>{const e=this.messageHandlerQueue.findIndex((e=>e.id===t));e>-1&&this.messageHandlerQueue.splice(e,1),s({type:"timeout"})}),i)}))])}destroy(){}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testDomesticSystemConnection(){return new Promise((t=>{m({url:`${this.printDomesticOrigin}/test`,method:"get",withCredentials:!1,params:{}}).then((({data:e})=>{e.status?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{m({url:`${this.printOrigin}/test`,method:"get",withCredentials:!1,params:{inputdata:{result:"success"}}}).then((({data:e})=>{"success"===e.result?t(!0):t(!1)})).catch((e=>{t(!1)}))}))}resetPrinter(t){return this.webview?this.postMessage({exec:"resetprint",data:{formatID:t}}):m({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>t))}_queryServicesPrint(e){return this.webview?this.postMessage({exec:"print",data:{inputData:e}},null==e?void 0:e.messageTimeout):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).then((({data:t})=>t))}_queryBase64ServicesPrint(t){return this.webview?this.postMessage({exec:"print",data:{inputData:t}}):m({url:"/services/Printqueue",method:"get",params:{inputData:JSON.stringify(t)}}).then((({data:t})=>t))}_callPrintWithFile(t){const e={cmdid:"7",flag:"1"},i={inputData:JSON.stringify(Object.assign({},e,t))};return this.webview?this.postMessage({exec:"print",data:s(i)}):m({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[s]}).then((({data:t})=>t));function s(t){let e="";for(const i in t)e+=encodeURIComponent(i)+"="+encodeURIComponent(t[i])+"&";return e=e.slice(0,-1),e}}_handleMonitorNotify(t){var e,i;null==(i=null==(e=this.CMonitor)?void 0:e.notify)||i.call(e,{name:"custom_info",message:t,businessName:"打印sdk"})}_handleResult(t,e,i){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,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:"请打开打印服务器插件"}),!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({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:m="1",messageTimeout:p=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:m,copies:o,messageTimeout:p,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}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 m({method:"get",url:g})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=p+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await m({method:"post",url:d,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}paramsSerializer(t){return Object.keys(t).forEach((e=>{const i=t[e];t[e]=i,"biParams"==e&&(t[e]=encodeURIComponent(i))})),t}async _queryPrintForBase64(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:u,params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _queryPrintForPdf(t,e,i="",s){const r="object"==typeof i?i:JSON.parse(i),{data:n}=await m({method:"post",url:f,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({ireportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:l,signature:c,btnprint:h,messageTimeout:m=0},p,d){const u=a(i);if(i=this.getIReportFormatId(u,i),2==t){const t=await this._queryPrintForPdf(e,i,s,l);if(!t)return null==d?void 0:d("获取文件失败!");const r=n(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,r),null==p?void 0:p({file:t})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:m}),n=this._handleResult(t,d);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==p||p(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};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:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({ireportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m=1,isDownloadFile:p=!0,messageTimeout:d=0},u,f,g,y="printDirect"){const w=a(i);if(i=this.getIReportFormatId(w,i),2==t){if(!await this._testDomesticSystemConnection())return void f({type:"notOpenedApp",result:"error",message:"请开启hiPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},u,f):f({type:"connectAppFail",result:"error",message:"连接hiPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},u,f))}await this._queryProxyOrigin();const P=await this._testConnection();if(!this._handleResultTest(P,f))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:m,messageTimeout:d}),n=this._handleResult(t,f,g);if(!n)return!1;p&&["downloadPDF"].includes(y)&&await this._browserPrint(n,y),null==u||u(n)}catch(t){const e="printDirect"===y?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==f||f(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n){const a=await this._queryPrintForBase64(t,e,i,s);if(!a.success)return n({message:a.resultMsg});const{base64:o,formatId:l}=a.map;this.base64Fragment=o,this._successCallbackFn=r,this._errorCallbackFn=n,this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:l,pdf_stream:this.base64Fragment})}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):m.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}async downloadPDF(t,i,s){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){const e=c(new Date,"yyyy-MM-dd"),i=l(),s=c(new Date,"yyyyMMddHHmmss")+i;t.print.filename=`${this.downloadPath}/${e}/${s}/${s}`.replace(/\\/g,"/")}const r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),2==t.ireportExecuteMode){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);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{P as Print};
|
1
|
+
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as s}from"./dialog.js";import{getFileUrl as r,useBrowserPrint as n,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{uuidGenerator as l}from"../../../../shared/utils/index.js";import{format as c}from"date-fns";import{io as h}from"socket.io-client";const m=String(navigator.platform).toLowerCase().includes("linux"),p=t.create({timeout:6e4,withCredentials:!1}),d=`${window.location.protocol}//${window.location.host}`,u=`${d}/fdp-api/print/assembly/printIReport`,f=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,g=`${d}/bi-api/reprot/print/open/client/previewIReport`,w=`${d}/bi-api/reprot/print/open/client/getRemote`,y=`${d}/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.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="",this._errorCallbackFn&&this._errorCallbackFn(t)})))}catch(e){console.log("hiprint系统连接失败",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)}))}))}resetPrinter(t){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:!1,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:"请打开打印服务器插件"}),!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({type:"queryPrintDataFailure",message:e})}catch(t){console.log(t)}return!1}return{file:t.file,printerName:t.defprinter,pageCount:t.pagecount,formatId:e}}async _handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:r,print:n,signature:a,copies:o=1,printdlgshow:l="0",nobillnode:h="1",btnprint:m="1",messageTimeout:p=0}){const d={templateId:t,formatId:e,params:i,cmdid:r,nobillnode:h,printdlgshow:l,btnprint:m,copies:o,messageTimeout:p,...a?{signature:a}:{}};if(s&&(d.paramsArr=s),n){try{n=JSON.parse(n)}catch(t){}d.print=n}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:w})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=d+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await p({method:"post",url:u,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:f,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:g,responseType:"blob",params:{id:t,formatId:e,params:this.paramsSerializer(r),authorizationKey:s}})||{};return n}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,s=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=s[s.length-2],o=s[s.length-1],l=await r(`${y}/${a}/${o}`),c=n(null,e,l);if("preview"===e)return c}}_base64ToBlob(t,e){const i=window.atob(t);let s=i.length;const r=new Uint8Array(s);for(;s--;)r[s]=i.charCodeAt(s);return new Blob([r],{type:e})}async preview({ireportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:l,signature:c,btnprint:h,messageTimeout:p=0},d,u){const f=a(i);if(i=this.getIReportFormatId(f,i),f&&m||2==t){const t=await this._queryPrintForPdf(e,i,s,l);if(!t)return null==u?void 0:u("获取文件失败!");const r=n(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,r),null==d?void 0:d({file:t})}await this._queryProxyOrigin();const g=await this._testConnection();if(!this._handleResultTest(g,u))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:this.isRemote?"7":"8",signature:c,btnprint:h,messageTimeout:p}),n=this._handleResult(t,u);if(!n)return!1;if(this.isRemote){const t=await this._browserPrint(n,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}await this.getPicAndUpload(n),null==d||d(n)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==u||u(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:!1,errinfo:t})}}catch(t){const e={error:t,message:"打印失败"};null==i||i(e),this._handleMonitorNotify(e)}}async printDirect({ireportExecuteMode:t,templateId:e,formatId:i,params:s="",paramsArr:r,authorizationKey:n,print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p=1,isDownloadFile:d=!0,messageTimeout:u=0},f,g,w,y="printDirect"){const P=a(i);if(i=this.getIReportFormatId(P,i),P&&m||2==t){if(!await this._testDomesticSystemConnection())return void g({type:"notOpenedApp",result:"error",message:"请开启hiPrint客户端"});return void(this._initDomesticSystem((async t=>{t?await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},f,g):g({type:"connectAppFail",result:"error",message:"连接hiPrint客户端失败"})}))&&await this.printToHiPrint({templateId:e,formatId:i,params:s,authorizationKey:n},f,g))}await this._queryProxyOrigin();const v=await this._testConnection();if(!this._handleResultTest(v,g))return!1;try{const t=await this._handleEventDirect({templateId:e,formatId:i,params:s,paramsArr:r,cmdid:"7",print:o,signature:l,printdlgshow:c,nobillnode:h,copies:p,messageTimeout:u}),n=this._handleResult(t,g,w);if(!n)return!1;d&&["downloadPDF"].includes(y)&&await this._browserPrint(n,y),null==f||f(n)}catch(t){const e="printDirect"===y?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==g||g(i),this._handleMonitorNotify(i)}}async printToHiPrint({templateId:t,formatId:e,params:i,authorizationKey:s},r,n){const a=await this._queryPrintForBase64(t,e,i,s);if(!a.success)return n({message:a.resultMsg});const{base64:o,formatId:l}=a.map;this.base64Fragment=o,this._successCallbackFn=r,this._errorCallbackFn=n,this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:l,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 r=a(t.formatId);if(t.formatId=this.getIReportFormatId(r,t.formatId),r&&m||2==t.ireportExecuteMode){const e=await this._queryPrintForPdf(t.templateId||"",t.formatId,t.params||"",t.authorizationKey);return e?(n(e,"downloadPDF"),i({file:e})):null==s?void 0:s("获取文件失败!")}this.printDirect(t,(async t=>{t||s(null);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};
|
@@ -477,11 +477,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
477
477
|
}>;
|
478
478
|
developMode: boolean;
|
479
479
|
draggable: boolean;
|
480
|
-
|
480
|
+
fieldDescribeMode: "column" | "tooltip";
|
481
|
+
isFieldSet: boolean;
|
481
482
|
idx: number;
|
482
483
|
isHighlight: boolean;
|
483
|
-
|
484
|
-
fieldDescribeMode: "column" | "tooltip";
|
484
|
+
isHighlightRow: boolean;
|
485
485
|
}>;
|
486
486
|
EditDialog: import("vue").DefineComponent<{
|
487
487
|
visible: {
|
@@ -499,11 +499,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
499
499
|
}>;
|
500
500
|
developMode: boolean;
|
501
501
|
draggable: boolean;
|
502
|
-
|
502
|
+
fieldDescribeMode: "column" | "tooltip";
|
503
|
+
isFieldSet: boolean;
|
503
504
|
idx: number;
|
504
505
|
isHighlight: boolean;
|
505
|
-
|
506
|
-
fieldDescribeMode: "column" | "tooltip";
|
506
|
+
isHighlightRow: boolean;
|
507
507
|
}>;
|
508
508
|
setStyle: typeof setStyle;
|
509
509
|
}, 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<{
|
@@ -630,11 +630,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
630
630
|
}>;
|
631
631
|
developMode: boolean;
|
632
632
|
draggable: boolean;
|
633
|
-
|
633
|
+
fieldDescribeMode: "column" | "tooltip";
|
634
|
+
isFieldSet: boolean;
|
634
635
|
idx: number;
|
635
636
|
isHighlight: boolean;
|
636
|
-
|
637
|
-
fieldDescribeMode: "column" | "tooltip";
|
637
|
+
isHighlightRow: boolean;
|
638
638
|
}>;
|
639
639
|
isArray: {
|
640
640
|
(value?: any): value is any[];
|
@@ -746,10 +746,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
746
746
|
showSeq: boolean;
|
747
747
|
developMode: boolean;
|
748
748
|
footerFlag: boolean;
|
749
|
-
fieldDescribeMode: "column" | "tooltip";
|
750
749
|
customColumns: FieldSetColumnItem[];
|
751
750
|
showSearch: boolean;
|
752
751
|
showSortPriority: boolean;
|
753
752
|
showHeadFilter: boolean;
|
753
|
+
fieldDescribeMode: "column" | "tooltip";
|
754
754
|
}>;
|
755
755
|
export default _default;
|
@@ -328,10 +328,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
328
328
|
}>;
|
329
329
|
developMode: boolean;
|
330
330
|
draggable: boolean;
|
331
|
-
|
331
|
+
fieldDescribeMode: "column" | "tooltip";
|
332
|
+
isFieldSet: boolean;
|
332
333
|
idx: number;
|
333
334
|
isHighlight: boolean;
|
334
|
-
|
335
|
-
fieldDescribeMode: "column" | "tooltip";
|
335
|
+
isHighlightRow: boolean;
|
336
336
|
}>;
|
337
337
|
export default _default;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NSpace as x,NButtonGroup as I,NButton as S}from"naive-ui";import{format as w}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import{MESSAGE_TYPE as b}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as z,getAVTime as H}from"../utils/index.js";import{first as D,last as R}from"lodash-es";import N from"./PersonProfile.vue.js";import O from"./MessageTemplate.vue.js";import{emojis as P}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as B}from"../hooks/useScrollLoading.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const X={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe={class:"size"};var ie=e({__name:"ChatMain",setup(e){const ie=t(),{state:ae,setMsgList:re}=E(),{setCurrentSessionItem:ce,isGroupChat:le}=C(ae),me=t(),ue=t(!1),pe=t({left:0,top:0}),de=t(),fe={page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")},ve=n((()=>({"--c-tip-top":le.value?"1px":"-20px","--c-tip-gap":le.value?"10px":"0px"})));async function ge(){try{if(!fe.hasMore)return;fe.page++;const e=await L({sessionKey:ae.currentSessionItem.sessionKey,page:fe.page,lastSendTime:fe.lastSendTime});if(!Array.isArray(e)||0===e.length)return fe.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=D(e).id;fe.lastSendTime=R(e).sendTime,re(fe.page>1?[...e,...ae.msgList]:e),1===fe.page&&ae.currentSessionItem.unreadNum&&(await j({chatType:ae.currentSessionItem.chatType,messageIdSet:[t],receiver:ae.userInfo.id,sender:ae.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function ye(e,t){de.value=t,async function(e){var t,n,s,o,i,a;ue.value=!0,await h();const{clientX:r,clientY:c}=e,{width:l=0,height:m=0,left:u=0,top:p=0}=(null==(t=ie.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=me.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(a=null==(i=ie.value)?void 0:i.scrollTop)?a:0,v=5,g={};r<=u+l/2?g.left=r-u+v+"px":g.right=u+l-r-v+"px";c-p<d/2?g.top=f+v+"px":p+m-c<=d/2?g.bottom=Math.abs(f)+v+"px":g.top=f+c-p-d/2+"px";pe.value=g}(e)}function he(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==b.TEMPLATE||!!n}function Te(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===b.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function Me(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===b.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function _e(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ae.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function ke(e){ae.currentReferenceMsg=e,Object.assign(ae.currentReferenceMsg,{chatType:ae.currentSessionItem.chatType,receiver:ae.currentSessionItem.receiver,receiverAvatar:ae.currentSessionItem.avatar,receiverName:ae.currentSessionItem.name})}function xe(e,t){"reply"===e&&ke(t)}return B(ie,(()=>{ge()}),"top",(()=>{ue.value=!1})),s((()=>ae.id),(e=>{e&&(ae.currentReferenceMsg=null,Object.assign(fe,{page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")}),ge())}),{immediate:!0}),s((()=>ae.isAppendMsg),(e=>{e&&(re([...ae.msgList,ae.currentMsg]),ae.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ie.value)?void 0:e.scrollHeight)?t:0;null==(n=ie.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ae).id}]),ref_key:"chatMainRef",ref:ie,style:c(r(ve))},[l(r(T),{"show-toolbar-tooltip":""},{default:m((()=>[(o(!0),i(u,null,p(r(ae).msgList,((e,t)=>(o(),i(u,{key:e.id},[he(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ae).userInfo.id}])},[_e(e,t)?(o(),i("p",X,d(e.__sendTime),1)):f("v-if",!0),Te(e,"system")?(o(),v(O,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[l(N,{"user-id":e.sender,placement:e.sender==r(ae).userInfo.id?"left":"right"},{trigger:m((()=>[l(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(le)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(b).EMOJI,template:e.content.chatMessageType===r(b).TEMPLATE,"template--3":Me(e.content),"audio-video":r(A)(e.content),file:e.content.chatMessageType===r(b).FILE}]),onContextmenu:y((t=>ye(t,e.id)),["prevent"])},[e.content.chatMessageType===r(b).TEXT?(o(),i(u,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(z)(e.content.referenceContent.content)},null,8,ee)])):f("v-if",!0),g("pre",null,d(e.__content),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).BLEND?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,te)):f("v-if",!0),e.content.chatMessageType===r(b).EMOJI?(o(),i("img",{key:2,src:r(P).findEmoji(e.__content)},null,8,ne)):f("v-if",!0),Te(e,"template")?(o(),v(O,{key:3,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(b).IMAGE?(o(),v(r(_),{key:4,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(A)(e.content)?(o(),i(u,{key:5},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(b).AUDIO}),component:e.content.chatMessageType===r(b).AUDIO?r(U):r(F)},null,8,["class","component"]),g("span",se,d(r(H)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).FILE?(o(),v(r(x),{key:6,"wrap-item":!1},{default:m((()=>[l(r(k),{class:"icon-file",size:"40",component:r(G)},null,8,["component"]),l(r(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:m((()=>[g("span",null,d(e.__content),1),g("span",oe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(r(I),{class:"quick-menu"},{default:m((()=>[r(A)(e.content)?f("v-if",!0):(o(),i(u,{key:0},[f(' <n-button quaternary size="tiny">\
|
1
|
+
import{defineComponent as e,ref as t,computed as n,watch as s,openBlock as o,createElementBlock as i,normalizeClass as a,unref as r,normalizeStyle as c,createVNode as l,withCtx as m,Fragment as u,renderList as p,toDisplayString as d,createCommentVNode as f,createBlock as v,createElementVNode as g,withModifiers as y,nextTick as h}from"vue";import{NImageGroup as T,NAvatar as M,NImage as _,NIcon as k,NSpace as x,NButtonGroup as I,NButton as S}from"naive-ui";import{format as w}from"date-fns";import{getHistoryRecordApi as L,readMessageApi as j}from"../api/index.js";import{useState as E}from"../hooks/useState.js";import{useSession as C}from"../hooks/useSession.js";import{MESSAGE_TYPE as b}from"../constants/index.js";import"trtc-sdk-v5";import{isAudioOrVideoMessage as A,simplifyMessage as z,getAVTime as H}from"../utils/index.js";import{first as D,last as R}from"lodash-es";import N from"./PersonProfile.vue.js";import O from"./MessageTemplate.vue.js";import{emojis as P}from"../utils/emoji.js";import q from"./ContextMenu.js";import{useScrollLoading as B}from"../hooks/useScrollLoading.js";import{CallOutline as U,VideocamOutline as F,DocumentSharp as G,ChatbubbleEllipsesOutline as J,EllipsisHorizontal as K}from"@vicons/ionicons5";const X={key:0,class:"time"},Y={key:2,class:"message-box"},$={key:0,class:"content-box"},Q={class:"name-box"},V=["data-time"],W=["onContextmenu"],Z={key:0,class:"reference-content"},ee=["innerHTML"],te=["innerHTML"],ne=["src"],se={style:{"margin-left":"8px"}},oe={class:"size"};var ie=e({__name:"ChatMain",setup(e){const ie=t(),{state:ae,setMsgList:re}=E(),{setCurrentSessionItem:ce,isGroupChat:le}=C(ae),me=t(),ue=t(!1),pe=t({left:0,top:0}),de=t(),fe={page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")},ve=n((()=>({"--c-tip-top":le.value?"1px":"-20px","--c-tip-gap":le.value?"10px":"0px"})));async function ge(){try{if(!fe.hasMore)return;fe.page++;const e=await L({sessionKey:ae.currentSessionItem.sessionKey,page:fe.page,lastSendTime:fe.lastSendTime});if(!Array.isArray(e)||0===e.length)return fe.hasMore=!1,console.log("接口返回不是一个数组,或者没有更多消息了");const t=D(e).id;fe.lastSendTime=R(e).sendTime,re(fe.page>1?[...e,...ae.msgList]:e),1===fe.page&&ae.currentSessionItem.unreadNum&&(await j({chatType:ae.currentSessionItem.chatType,messageIdSet:[t],receiver:ae.userInfo.id,sender:ae.currentSessionItem.receiver}),ce({unreadNum:0}))}catch(e){console.log(e)}}async function ye(e,t){de.value=t,async function(e){var t,n,s,o,i,a;ue.value=!0,await h();const{clientX:r,clientY:c}=e,{width:l=0,height:m=0,left:u=0,top:p=0}=(null==(t=ie.value)?void 0:t.getBoundingClientRect())||{},d=null!=(o=null==(s=null==(n=me.value)?void 0:n.$el)?void 0:s.getBoundingClientRect().height)?o:220,f=null!=(a=null==(i=ie.value)?void 0:i.scrollTop)?a:0,v=5,g={};r<=u+l/2?g.left=r-u+v+"px":g.right=u+l-r-v+"px";c-p<d/2?g.top=f+v+"px":p+m-c<=d/2?g.bottom=Math.abs(f)+v+"px":g.top=f+c-p-d/2+"px";pe.value=g}(e)}function he(e){const{chatMessageType:t,messageTemplate:n}=e.content;return t!==b.TEMPLATE||!!n}function Te(e,t){var n,s;const{chatMessageType:o,messageTemplate:i}=e.content;if(o===b.TEMPLATE)return"system"===t?2==(null==(n=null==i?void 0:i.setting)?void 0:n.style.id):2!=(null==(s=null==i?void 0:i.setting)?void 0:s.style.id)}function Me(e){var t,n;const{chatMessageType:s,messageTemplate:o}=e;return s===b.TEMPLATE&&3==(null==(n=null==(t=null==o?void 0:o.setting)?void 0:t.style)?void 0:n.id)}function _e(e,t){var n;const s=new Date(e.sendTime).getTime(),o=null==(n=ae.msgList[t+1])?void 0:n.sendTime;if(o){return s-new Date(o).getTime()>3e5}return!0}function ke(e){ae.currentReferenceMsg=e,Object.assign(ae.currentReferenceMsg,{chatType:ae.currentSessionItem.chatType,receiver:ae.currentSessionItem.receiver,receiverAvatar:ae.currentSessionItem.avatar,receiverName:ae.currentSessionItem.name})}function xe(e,t){"reply"===e&&ke(t)}return B(ie,(()=>{ge()}),"top",(()=>{ue.value=!1})),s((()=>ae.id),(e=>{e&&(ae.currentReferenceMsg=null,Object.assign(fe,{page:0,hasMore:!0,lastSendTime:w(new Date,"yyyy-MM-dd HH:mm:ss")}),ge())}),{immediate:!0}),s((()=>ae.isAppendMsg),(e=>{e&&(re([...ae.msgList,ae.currentMsg]),ae.isAppendMsg=!1,async function(){var e,t,n;const s=null!=(t=null==(e=ie.value)?void 0:e.scrollHeight)?t:0;null==(n=ie.value)||n.scrollTo({top:s,behavior:"auto"})}())}),{immediate:!0}),(e,t)=>(o(),i("div",{class:a(["chat-main",{"home-bg":!r(ae).id}]),ref_key:"chatMainRef",ref:ie,style:c(r(ve))},[l(r(T),{"show-toolbar-tooltip":""},{default:m((()=>[(o(!0),i(u,null,p(r(ae).msgList,((e,t)=>(o(),i(u,{key:e.id},[he(e)?(o(),i("div",{key:0,class:a(["message-item",{"message-item--mine":e.sender==r(ae).userInfo.id}])},[_e(e,t)?(o(),i("p",X,d(e.__sendTime),1)):f("v-if",!0),Te(e,"system")?(o(),v(O,{key:1,data:e},null,8,["data"])):(o(),i("div",Y,[l(N,{"user-id":e.sender,placement:e.sender==r(ae).userInfo.id?"left":"right"},{trigger:m((()=>[l(r(M),{round:"",size:38,src:e.senderAvatar},null,8,["src"])])),_:2},1032,["user-id","placement"]),e.content?(o(),i("div",$,[g("div",Q,[g("span",{class:"name","data-time":e.__time},d(r(le)?e.senderName:""),9,V)]),g("div",{class:a(["content",{emoji:e.content.chatMessageType===r(b).EMOJI,template:e.content.chatMessageType===r(b).TEMPLATE,"template--3":Me(e.content),"audio-video":r(A)(e.content),file:e.content.chatMessageType===r(b).FILE}]),onContextmenu:y((t=>ye(t,e.id)),["prevent"])},[e.content.chatMessageType===r(b).TEXT?(o(),i(u,{key:0},[e.content.referenceContent?(o(),i("div",Z,[g("span",null,d(e.content.referenceContent.senderName)+":",1),g("pre",{innerHTML:r(z)(e.content.referenceContent.content)},null,8,ee)])):f("v-if",!0),g("pre",null,d(e.__content),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).BLEND?(o(),i("pre",{key:1,innerHTML:e.__content},null,8,te)):f("v-if",!0),e.content.chatMessageType===r(b).EMOJI?(o(),i("img",{key:2,src:r(P).findEmoji(e.__content)},null,8,ne)):f("v-if",!0),Te(e,"template")?(o(),v(O,{key:3,data:e},null,8,["data"])):f("v-if",!0),e.content.chatMessageType===r(b).IMAGE?(o(),v(r(_),{key:4,width:"240",src:e.__content},null,8,["src"])):f("v-if",!0),r(A)(e.content)?(o(),i(u,{key:5},[l(r(k),{class:a({"is-audio":e.content.chatMessageType===r(b).AUDIO}),component:e.content.chatMessageType===r(b).AUDIO?r(U):r(F)},null,8,["class","component"]),g("span",se,d(r(H)(e.__content)),1)],64)):f("v-if",!0),e.content.chatMessageType===r(b).FILE?(o(),v(r(x),{key:6,"wrap-item":!1},{default:m((()=>[l(r(k),{class:"icon-file",size:"40",component:r(G)},null,8,["component"]),l(r(x),{"wrap-item":!1,vertical:"",justify:"space-between",style:{"row-gap":"0"}},{default:m((()=>[g("span",null,d(e.__content),1),g("span",oe,d(e.__size),1)])),_:2},1024)])),_:2},1024)):f("v-if",!0),l(r(I),{class:"quick-menu"},{default:m((()=>[r(A)(e.content)?f("v-if",!0):(o(),i(u,{key:0},[f(' <n-button quaternary size="tiny">\n\t\t\t\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<i class="chat--iconfont chat--icon-face" />\n\t\t\t\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t\t\t\t</n-button> '),l(r(S),{quaternary:"",size:"tiny",onClick:()=>ke(e)},{icon:m((()=>[l(r(k),{size:"17",component:r(J)},null,8,["component"])])),_:2},1032,["onClick"])],64)),l(r(S),{quaternary:"",size:"tiny",onClick:t=>ye(t,e.id)},{icon:m((()=>[l(r(k),{size:"14",component:r(K)},null,8,["component"])])),_:2},1032,["onClick"])])),_:2},1024)],42,W)])):f("v-if",!0)]))],2)):f("v-if",!0)],64)))),128))])),_:1}),l(r(q),{ref_key:"contextmenuRef",ref:me,show:ue.value,"onUpdate:show":t[0]||(t[0]=e=>ue.value=e),position:pe.value,"msg-id":de.value,onSelect:xe},null,8,["show","position","msg-id"])],6))}});export{ie as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,ref as e,reactive as a,computed as l,openBlock as n,createBlock as o,unref as
|
1
|
+
import{defineComponent as t,ref as e,reactive as a,computed as l,openBlock as n,createBlock as o,unref as s,withCtx as r,renderSlot as i,createElementBlock as c,Fragment as u,withDirectives as p,createElementVNode as d,createVNode as m,createCommentVNode as v,toDisplayString as f,createTextVNode as g,renderList as k,vShow as y}from"vue";import{NPopover as h,NAvatar as b,NButton as w,NIcon as C}from"naive-ui";import{ChatbubbleEllipses as _,EyeOffOutline as I,EyeOutline as j,Close as z}from"@vicons/ionicons5";import{useState as x}from"../hooks/useState.js";import{useSession as N}from"../hooks/useSession.js";import"trtc-sdk-v5";import"date-fns";import"lodash-es";import"../utils/emoji.js";import{openSessionApi as S,getUserDetailApi as $}from"../api/index.js";const D={class:"person-profile-main"},P={class:"left"},T={class:"profile"},q={class:"profile__text"},B={class:"right"},E={class:"right__content"},O={class:"label"},U={class:"content"};var A=t({__name:"PersonProfile",props:{userId:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:A}){const F=t,{state:G}=x(),{openSession:H}=N(G),J=e(!1),K=e(!1),L=e(!1),M=a({}),Q=[{label:"机构",value:"",key:"orgName"},{label:"姓名",value:"",key:"name"},{label:"归属科室",value:"",key:"deptName"},{label:"业务科室",value:"",key:"businessDeptNames"},{label:"手机号",value:"",key:"phone"},{label:"岗位",value:"",key:"post"},{label:"工号",value:"",key:"jobId"},{label:"性别",value:"",key:"orgName"}],R=l((()=>(M.id&&Q.forEach((t=>{const{key:e}=t;t.value=M[e]})),Q)));async function V(){J.value=!1;const t=await S({chatType:G.currentSessionItem.chatType,receiver:F.userId,sender:G.userInfo.id});H(t),A("close")}async function W(t){if(!t)return;const e=await $({userId:F.userId});(null==e?void 0:e.id)?Object.assign(M,e):M.id=""}function X(t){const{key:e,value:a}=t;return"phone"!==e||L.value?a:(a||"").replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")}return(e,a)=>(n(),o(s(h),{raw:"",class:"person-profile-wrapper",show:J.value,"onUpdate:show":[a[3]||(a[3]=t=>J.value=t),W],trigger:t.disabled?"manual":"click","show-arrow":!1,shift:""},{trigger:r((()=>[i(e.$slots,"trigger")])),default:r((()=>[M.id?(n(),c(u,{key:0},[p(d("div",D,[d("div",P,[d("div",T,[m(s(b),{src:M.avatar,bordered:"",round:"",size:100,onClickCapture:a[0]||(a[0]=t=>K.value=!0)},null,8,["src"]),v(' <n-upload abstract accept="image/*" @change="onChange">\n\t\t\t\t\t\t\t<n-upload-trigger #="{ handleClick }" abstract>\n\t\t\t\t\t\t\t\t<n-button\n\t\t\t\t\t\t\t\t\tcircle\n\t\t\t\t\t\t\t\t\tsecondary\n\t\t\t\t\t\t\t\t\tclass="edit-avatar"\n\t\t\t\t\t\t\t\t\tv-show="userDetail.id === state.userInfo.id"\n\t\t\t\t\t\t\t\t\t@click="handleClick"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t\t\t\t<n-icon size="16" color="#666666" :component="Camera" />\n\t\t\t\t\t\t\t\t\t</template>\n\t\t\t\t\t\t\t\t</n-button>\n\t\t\t\t\t\t\t</n-upload-trigger>\n\t\t\t\t\t\t</n-upload> '),d("div",q,[d("h4",null,f(M.name),1),d("p",null,f(M.orgName),1)]),m(s(w),{strong:"",secondary:"",onClick:V},{default:r((()=>[m(s(C),{size:"13",color:"#666666",component:s(_),style:{"margin-right":"6px"}},null,8,["component"]),g(" 发消息 ")])),_:1})])]),d("div",B,[d("div",E,[(n(!0),c(u,null,k(s(R),((t,e)=>(n(),c("div",{class:"info-item",key:e},[d("span",O,f(t.label),1),d("div",U,[d("span",null,f(X(t)),1),"phone"===t.key&&X(t)?(n(),o(s(C),{key:0,size:"16",color:"#666666",component:L.value?s(I):s(j),style:{"margin-left":"10px"},onClick:a[1]||(a[1]=t=>L.value=!L.value)},null,8,["component"])):v("v-if",!0)])])))),128))])])],512),[[y,!K.value]]),p(d("div",{class:"large-avatar",onClick:a[2]||(a[2]=t=>K.value=!1)},[m(s(w),{circle:"",size:"small",secondary:""},{icon:r((()=>[m(s(C),{size:24,component:s(z),color:"#fff"},null,8,["component"])])),_:1}),m(s(b),{size:310,round:"",src:M.avatar},null,8,["src"])],512),[[y,K.value]])],64)):v("v-if",!0)])),_:3},8,["show","trigger"]))}});export{A as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,reactive as o,ref as t,watch as a,nextTick as n,openBlock as s,createElementBlock as i,normalizeClass as l,unref as r,createCommentVNode as m,Fragment as c,createBlock as u,mergeProps as d,createElementVNode as p,normalizeStyle as f,createVNode as v,withCtx as g,renderList as h,toDisplayString as k,createTextVNode as y,resolveDynamicComponent as w,renderSlot as S}from"vue";import b from"./hooks/use-noData.js";import{ScaleViewProps as C}from"./hooks/scaleview-props.js";import{getScaleViewState as D}from"./hooks/scaleview-state.js";import{ScaleViewComputed as E}from"./hooks/scaleview-computed.js";import{ScaleViewInit as j}from"./hooks/scaleview-init.js";import{ScaleViewSubmit as _}from"./hooks/scaleview-submit.js";import{ScaleViewMethods as x}from"./hooks/scaleview-methods.js";import{handleQueryParams as F,isCollection as P}from"./utils/judge-types.js";import{useEvent as q}from"./hooks/use-event.js";import"xe-utils";import"moment";import L from"../../../shared/utils/vexutilsExpand.js";import N from"./components/NoData.vue.js";import R from"./components/EvaluateCountdown.vue.js";import A from"./components/EvaluatePage.vue.js";import M from"./components/AnswerParse.vue.js";import O from"./components/ScaleScore.js";import T from"./components/DescribeContent.vue.js";import{NForm as V,NFormItem as I,NButton as B}from"naive-ui";const J=["innerHTML"],G={key:0,class:"required-text"},W={key:1,class:"evalute-label"},H=["onClick"],Q=p("i",{class:"scale-view-iconfont icon-scale-view-dengpao"},null,-1),$={key:1,class:"footer"};var z=e({__name:"ScaleView",props:C,emits:["onCloseSetting","submitNoRequest","onSubmit","startWriteScale"],setup(e,{expose:C,emit:z}){const K=e,{ScaleViewState:U}=D(),X=o(U),Y=t(null),Z=t(null),ee=t(null),{noDataState:oe,setNoData:te,resetNodata:ae}=b(),ne=F(),{showEvatip:se,isFormBoldOpen:ie,scaleStyle:le,handlePageClass:re,isShowItem:me,handleShowQuestionNumber:ce,hasScore:ue,isPreviewScale:de,showEvaluateEntry:pe,showEvaluateCoundownPage:fe,showScaleFooter:ve,isCancelBtn:ge,isSaveBtn:he,showEvaluateLabel:ke,showAnswerParse:ye,propsConfig:we,evaluatePageProps:Se,evaluateCountdownProps:be,isEvaluetaResSituation:Ce,disableEdit:De,desStart:Ee,desEnd:je,desContent:_e}=E(K,X,{query:ne,scaleViewDom:Y}),{initForm:xe}=j(K,X,z,{query:ne}),{submitMethod:Fe,onSubmitData:Pe,onSubmitForm:qe,handleScoreJson:Le}=_(K,X,z,{query:ne,formRef:ee,countdownDom:Z}),{nextLogicEvent:Ne,handleDynamicDataRelation:Re}=q(K,X),{scaleChange:Ae,labelChange:Me,vodFileList:Oe,writeGuage:Te,closeEvaluateCountdown:Ve,showEvaTipModal:Ie}=x(K,X,z,{nextLogicEvent:Ne,handleDynamicDataRelation:Re,isPreviewScale:de,submitMethod:Fe,isEvaluetaResSituation:Ce,handleScoreJson:Le,disableEdit:De});(()=>{let{id:e}=ne;e&&(X.shareId=e)})();const Be=e=>{try{ae(),xe(e)}catch(e){console.log(e,"--error"),X.spinning=!1,X.hasFrontAddress=!1,te(!0,null==e?void 0:e.resultMsg,null==e?void 0:e.result)}};a((()=>K.ids),((e,o)=>{o?e.guage_id&&e.guage_id!=o.guage_id&&Be(e):e.guage_id&&Be(e)}),{immediate:!0}),a((()=>K.guageData),(e=>{if(!e||!Object.keys(e||{}).length)return;X.form={},X.formArray=[];const o=JSON.parse(JSON.stringify(e));n((()=>{xe(o)}))}),{immediate:!0});const Je=L.debounce(Pe,300),Ge=()=>{z("onCloseSetting")};return C({getScaleData:()=>({...X}),onSubmitForm:qe,cancel:Ge}),(e,o)=>(s(),i("div",{class:l(["c-scale-view-block",{"c-scale-view-block-hasfooter":r(ve)}]),ref_key:"scaleViewDom",ref:Y},[m(' <template v-if="state.spinning">\
|
1
|
+
import{defineComponent as e,reactive as o,ref as t,watch as a,nextTick as n,openBlock as s,createElementBlock as i,normalizeClass as l,unref as r,createCommentVNode as m,Fragment as c,createBlock as u,mergeProps as d,createElementVNode as p,normalizeStyle as f,createVNode as v,withCtx as g,renderList as h,toDisplayString as k,createTextVNode as y,resolveDynamicComponent as w,renderSlot as S}from"vue";import b from"./hooks/use-noData.js";import{ScaleViewProps as C}from"./hooks/scaleview-props.js";import{getScaleViewState as D}from"./hooks/scaleview-state.js";import{ScaleViewComputed as E}from"./hooks/scaleview-computed.js";import{ScaleViewInit as j}from"./hooks/scaleview-init.js";import{ScaleViewSubmit as _}from"./hooks/scaleview-submit.js";import{ScaleViewMethods as x}from"./hooks/scaleview-methods.js";import{handleQueryParams as F,isCollection as P}from"./utils/judge-types.js";import{useEvent as q}from"./hooks/use-event.js";import"xe-utils";import"moment";import L from"../../../shared/utils/vexutilsExpand.js";import N from"./components/NoData.vue.js";import R from"./components/EvaluateCountdown.vue.js";import A from"./components/EvaluatePage.vue.js";import M from"./components/AnswerParse.vue.js";import O from"./components/ScaleScore.js";import T from"./components/DescribeContent.vue.js";import{NForm as V,NFormItem as I,NButton as B}from"naive-ui";const J=["innerHTML"],G={key:0,class:"required-text"},W={key:1,class:"evalute-label"},H=["onClick"],Q=p("i",{class:"scale-view-iconfont icon-scale-view-dengpao"},null,-1),$={key:1,class:"footer"};var z=e({__name:"ScaleView",props:C,emits:["onCloseSetting","submitNoRequest","onSubmit","startWriteScale"],setup(e,{expose:C,emit:z}){const K=e,{ScaleViewState:U}=D(),X=o(U),Y=t(null),Z=t(null),ee=t(null),{noDataState:oe,setNoData:te,resetNodata:ae}=b(),ne=F(),{showEvatip:se,isFormBoldOpen:ie,scaleStyle:le,handlePageClass:re,isShowItem:me,handleShowQuestionNumber:ce,hasScore:ue,isPreviewScale:de,showEvaluateEntry:pe,showEvaluateCoundownPage:fe,showScaleFooter:ve,isCancelBtn:ge,isSaveBtn:he,showEvaluateLabel:ke,showAnswerParse:ye,propsConfig:we,evaluatePageProps:Se,evaluateCountdownProps:be,isEvaluetaResSituation:Ce,disableEdit:De,desStart:Ee,desEnd:je,desContent:_e}=E(K,X,{query:ne,scaleViewDom:Y}),{initForm:xe}=j(K,X,z,{query:ne}),{submitMethod:Fe,onSubmitData:Pe,onSubmitForm:qe,handleScoreJson:Le}=_(K,X,z,{query:ne,formRef:ee,countdownDom:Z}),{nextLogicEvent:Ne,handleDynamicDataRelation:Re}=q(K,X),{scaleChange:Ae,labelChange:Me,vodFileList:Oe,writeGuage:Te,closeEvaluateCountdown:Ve,showEvaTipModal:Ie}=x(K,X,z,{nextLogicEvent:Ne,handleDynamicDataRelation:Re,isPreviewScale:de,submitMethod:Fe,isEvaluetaResSituation:Ce,handleScoreJson:Le,disableEdit:De});(()=>{let{id:e}=ne;e&&(X.shareId=e)})();const Be=e=>{try{ae(),xe(e)}catch(e){console.log(e,"--error"),X.spinning=!1,X.hasFrontAddress=!1,te(!0,null==e?void 0:e.resultMsg,null==e?void 0:e.result)}};a((()=>K.ids),((e,o)=>{o?e.guage_id&&e.guage_id!=o.guage_id&&Be(e):e.guage_id&&Be(e)}),{immediate:!0}),a((()=>K.guageData),(e=>{if(!e||!Object.keys(e||{}).length)return;X.form={},X.formArray=[];const o=JSON.parse(JSON.stringify(e));n((()=>{xe(o)}))}),{immediate:!0});const Je=L.debounce(Pe,300),Ge=()=>{z("onCloseSetting")};return C({getScaleData:()=>({...X}),onSubmitForm:qe,cancel:Ge}),(e,o)=>(s(),i("div",{class:l(["c-scale-view-block",{"c-scale-view-block-hasfooter":r(ve)}]),ref_key:"scaleViewDom",ref:Y},[m(' <template v-if="state.spinning">\n <n-spin :show="state.spinning" description="加载中"></n-spin>\n </template> '),X.spinning||X.hasFrontAddress?m("v-if",!0):(s(),i(c,{key:0},[r(oe).noData?(s(),u(N,{key:0,noDataImg:r(oe).noDataImg,noDataTip:r(oe).noDataTip},null,8,["noDataImg","noDataTip"])):(s(),i(c,{key:1},[r(pe)?(s(),u(A,d({key:0},r(Se),{onWriteGuage:r(Te)}),null,16,["onWriteGuage"])):(s(),i(c,{key:1},[r(fe)?(s(),u(R,d({key:0,ref_key:"countdownDom",ref:Z},r(be),{onCloseEvaluateCountdown:r(Ve)}),null,16,["onCloseEvaluateCountdown"])):m("v-if",!0),p("div",{class:l(["scale-container",{"scale-container-nopadding":r(re),"scale-container-hasfooter":r(ve)}]),style:f(r(le))},[r(ue)?(s(),u(r(O),{key:0,config:X.config,maxScore:X.maxScore},null,8,["config","maxScore"])):m("v-if",!0),r(Ee)?(s(),u(T,{key:1,content:r(_e)},null,8,["content"])):m("v-if",!0),v(r(V),{ref_key:"formRef",ref:ee,model:X.form,rules:X.rules,"require-mark-placement":"left",class:"main"},{default:g((()=>[(s(!0),i(c,null,h(X.formArray,((e,o)=>(s(),i(c,{key:(e.id||e.seq)+o},[r(me)(e)?(s(),u(r(I),{key:0,path:e.val_key,"show-label":!r(P)(e.type),class:"c-scle-form-item"},{label:g((()=>[p("span",{class:l({"scale-label-required":r(ie)(e)}),innerHTML:r(ce)(e)},null,10,J),r(ie)(e)?(s(),i("span",G,"(必填)")):m("v-if",!0),r(ke)(e)?(s(),i("span",W,k(r(ke)(e)),1)):m("v-if",!0),r(se)(e)?(s(),i("span",{key:2,class:"evalute-tip",onClick:o=>r(Ie)(e)},[Q,y(" 查看提示 ")],8,H)):m("v-if",!0)])),default:g((()=>[(s(),u(w(e.renderCom),d(r(we)(e,o),{key:(e.id||e.seq)+o,onScaleChange:r(Ae),onOnChange:o=>r(Me)(o,e),onVodFileList:r(Oe)}),null,16,["onScaleChange","onOnChange","onVodFileList"])),r(ye)(e)?(s(),u(M,{key:0,item:e},null,8,["item"])):m("v-if",!0)])),_:2},1032,["path","show-label"])):m("v-if",!0)],64)))),128))])),_:1},8,["model","rules"]),r(je)?(s(),u(T,{key:2,content:r(_e)},null,8,["content"])):m("v-if",!0)],6),r(ve)?(s(),i("div",$,[m(" 分享的链接 隐藏取消按钮 "),r(ge)?(s(),u(r(B),{key:0,onClick:Ge},{default:g((()=>[y("取消")])),_:1})):m("v-if",!0),r(he)?(s(),u(r(B),{key:1,onClick:r(Je),disabled:X.banSubmit,type:"primary"},{default:g((()=>[y(" 保存 ")])),_:1},8,["onClick","disabled"])):m("v-if",!0),S(e.$slots,"extendBtn")])):m("v-if",!0)],64))],64))],64))],2))}});export{z as default};
|
package/es/env.d.ts
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
/// <reference types="vite/client" />
|
2
|
-
|
3
|
-
interface ImportMetaEnv {
|
4
|
-
readonly VITE_APP_TYPE: string;
|
5
|
-
// 更多环境变量...
|
6
|
-
}
|
7
|
-
|
8
|
-
interface ImportMeta {
|
9
|
-
readonly env: ImportMetaEnv;
|
10
|
-
}
|
11
|
-
|
12
|
-
declare module '*.vue' {
|
13
|
-
// @ts-ignore
|
14
|
-
import type { App, defineComponent } from 'vue';
|
15
|
-
// // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
16
|
-
// // const component: DefineComponent<{}, {}, any>
|
17
|
-
const component: ReturnType<typeof defineComponent> & {
|
18
|
-
install(app: App): void;
|
19
|
-
};
|
20
|
-
// @ts-ignore
|
21
|
-
export default component;
|
22
|
-
}
|
23
|
-
|
24
|
-
declare module '*.js';
|
25
|
-
|
1
|
+
/// <reference types="vite/client" />
|
2
|
+
|
3
|
+
interface ImportMetaEnv {
|
4
|
+
readonly VITE_APP_TYPE: string;
|
5
|
+
// 更多环境变量...
|
6
|
+
}
|
7
|
+
|
8
|
+
interface ImportMeta {
|
9
|
+
readonly env: ImportMetaEnv;
|
10
|
+
}
|
11
|
+
|
12
|
+
declare module '*.vue' {
|
13
|
+
// @ts-ignore
|
14
|
+
import type { App, defineComponent } from 'vue';
|
15
|
+
// // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
|
16
|
+
// // const component: DefineComponent<{}, {}, any>
|
17
|
+
const component: ReturnType<typeof defineComponent> & {
|
18
|
+
install(app: App): void;
|
19
|
+
};
|
20
|
+
// @ts-ignore
|
21
|
+
export default component;
|
22
|
+
}
|
23
|
+
|
24
|
+
declare module '*.js';
|
25
|
+
|
@@ -1 +1 @@
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.2.8-beta.
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.2.8-beta.1",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.8-beta.1",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cnhis-design-vue",
|
3
|
-
"version": "3.2.8-beta.
|
3
|
+
"version": "3.2.8-beta.1",
|
4
4
|
"license": "ISC",
|
5
5
|
"module": "./es/components/index.js",
|
6
6
|
"main": "./es/components/index.js",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"iOS 7",
|
73
73
|
"last 3 iOS versions"
|
74
74
|
],
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "03ace254b35a06f1ae3c32b5659601a52f45e392"
|
76
76
|
}
|