cnhis-design-vue 3.2.4-beta.30 → 3.2.4-beta.32
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/biunique-chat/index.d.ts +10 -0
- package/es/components/biunique-chat/src/Index.vue.d.ts +10 -0
- package/es/components/biunique-chat/src/Index.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/ChatFooter.vue.d.ts +4 -0
- package/es/components/biunique-chat/src/components/ChatFooter.vue2.js +1 -1
- package/es/components/biunique-chat/src/components/ChatMain.vue.d.ts +7 -1
- package/es/components/biunique-chat/src/components/ChatMain.vue2.js +1 -1
- package/es/components/biunique-chat/src/constants/index.d.ts +3 -1
- package/es/components/biunique-chat/src/constants/index.js +1 -1
- package/es/components/biunique-chat/src/hooks/useSession.js +1 -1
- package/es/components/biunique-chat/src/types/index.d.ts +1 -0
- package/es/components/biunique-chat/src/utils/index.d.ts +1 -1
- package/es/components/biunique-chat/src/utils/index.js +1 -1
- package/es/components/biunique-chat/style/index.css +1 -1
- package/es/components/button-print/index.d.ts +1 -1
- package/es/components/button-print/src/ButtonPrint.vue.d.ts +1 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue.d.ts +1 -1
- package/es/components/button-print/src/components/NewPrintComponent.vue2.js +1 -1
- package/es/components/button-print/src/utils/print.d.ts +1 -0
- package/es/components/button-print/src/utils/print.js +1 -1
- package/es/components/callback/src/components/render/popupMaps.d.ts +8 -0
- package/es/components/classification/src/components/table-modal/index.vue.d.ts +3 -0
- package/es/components/classification/src/index.vue.d.ts +3 -0
- package/es/components/fabric-chart/src/hooks/surgicalAnesthesia/useTop.js +1 -1
- package/es/components/field-set/src/FieldColor.vue.d.ts +26 -0
- package/es/components/field-set/src/FieldFilter.vue.d.ts +26 -0
- package/es/components/field-set/src/FieldSet.vue.d.ts +41 -0
- package/es/components/field-set/src/FieldSet.vue2.js +1 -1
- package/es/components/field-set/src/components/Row.vue.d.ts +26 -0
- package/es/components/field-set/src/components/Row.vue2.js +1 -1
- package/es/components/field-set/src/utils/index.js +1 -1
- package/es/components/iho-table/index.d.ts +8 -0
- package/es/components/iho-table/src/IhoTable.vue.d.ts +8 -0
- package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
- package/es/components/iho-table/src/constants/index.d.ts +2 -1
- package/es/components/iho-table/src/constants/index.js +1 -1
- package/es/components/iho-table/src/plugins/index.js +1 -1
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/index.js +1 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue.d.ts +26 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue.js +1 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/pagerScroll.vue2.js +1 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/types.d.ts +16 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/types.js +1 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/utils.d.ts +51 -0
- package/es/components/iho-table/src/plugins/pagerScrollPlugin/utils.js +1 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +2 -2
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
- package/es/components/iho-table/src/plugins/verticalTablePlugin/src/hooks/useRowClassName.js +1 -1
- package/es/components/iho-table/src/types/index.d.ts +4 -0
- package/es/components/iho-table/src/utils/index.d.ts +1 -0
- package/es/components/iho-table/src/utils/index.js +1 -1
- package/es/components/iho-table/style/index.css +1 -1
- package/es/components/index.css +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=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.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._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this,m&&this._isHiprint&&this._initDomesticSystem();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"].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{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(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{reconnectionAttempts:3,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",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),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(t){console.log("hiprint系统连接失败",t)}}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)}_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)}))}))}_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({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},p,d){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&m&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==d?void 0:d("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==p?void 0:p({file:s})}await this._queryProxyOrigin();const f=await this._testConnection();if(!this._handleResultTest(f,d))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),n=this._handleResult(r,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({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h=1,isDownloadFile:p=!0,messageTimeout:d=0},u,f,g,w="printDirect"){const y=a(e);if(e=this.getIReportFormatId(y,e),y&&m&&this._isHiprint){if(!this.isConnectHiPrint)return void f({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return f({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=u,this._errorCallbackFn=f,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const P=await this._testConnection();if(!this._handleResultTest(P,f))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h,messageTimeout:d}),a=this._handleResult(r,f,g);if(!a)return!1;p&&["downloadPDF"].includes(w)&&await this._browserPrint(a,w),null==u||u(a)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==f||f(i),this._handleMonitorNotify(i)}}_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&&this._isHiprint){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};
|
|
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`,g=`${d}/bi-api/reprot/print/open/client/printIReportForBase64`,f=`${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.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._isHiprint=!1,this.messageHandlerQueue=[],this.getIReportFormatId=(t,e)=>t?e.split("_")[1]:e,P)return P;P=this,m&&this._isHiprint&&this._initDomesticSystem();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"].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{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(){try{this.hiPrintSocket=h("http://127.0.0.1:17521",{reconnectionAttempts:3,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",(t=>{this.printerList=t,console.log("获取到打印机列表信息>>>>>",t)})),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(t){console.log("hiprint系统连接失败",t)}}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)}_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 new Promise((e=>{p({url:`${this.printOrigin}/services/printset`,method:"get",withCredentials:!1,params:{inputdata:t}}).then((({data:t})=>{"success"===t.result?e(!0):e(!1)})).catch((t=>{e(!1)}))}))}_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: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("/"),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({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,signature:l,btnprint:c,messageTimeout:h=0},p,d){const u=a(e);if(e=this.getIReportFormatId(u,e),u&&m&&this._isHiprint){const s=await this._queryPrintForPdf(t,e,i,r);if(!s)return null==d?void 0:d("获取文件失败!");const a=n(s,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,a),null==p?void 0:p({file:s})}await this._queryProxyOrigin();const g=await this._testConnection();if(!this._handleResultTest(g,d))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:this.isRemote?"7":"8",signature:l,btnprint:c,messageTimeout:h}),n=this._handleResult(r,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({templateId:t,formatId:e,params:i="",paramsArr:s,authorizationKey:r,print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h=1,isDownloadFile:p=!0,messageTimeout:d=0},u,g,f,w="printDirect"){const y=a(e);if(e=this.getIReportFormatId(y,e),y&&m&&this._isHiprint){if(!this.isConnectHiPrint)return void g({message:"请连接hiPrint客户端"});const s=await this._queryPrintForBase64(t,e,i,r);if(!s.success)return g({message:s.resultMsg});const{base64:n,formatId:a}=s.map;return this.base64Fragment=n,this._successCallbackFn=u,this._errorCallbackFn=g,void this.hiPrintSocket.emit("news",{printerList:this.printerList,type:"askPrinterTemplate",markTemplateId:a,pdf_stream:this.base64Fragment})}await this._queryProxyOrigin();const P=await this._testConnection();if(!this._handleResultTest(P,g))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,paramsArr:s,cmdid:"7",print:n,signature:o,printdlgshow:l,nobillnode:c,copies:h,messageTimeout:d}),a=this._handleResult(r,g,f);if(!a)return!1;p&&["downloadPDF"].includes(w)&&await this._browserPrint(a,w),null==u||u(a)}catch(t){const e="printDirect"===w?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==g||g(i),this._handleMonitorNotify(i)}}_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&&this._isHiprint){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};
|
|
@@ -4181,6 +4181,10 @@ export declare const CallbackMaps: Map<string, {
|
|
|
4181
4181
|
bodyWidth?: number | ((index: number) => number) | undefined;
|
|
4182
4182
|
bodyMinWidth?: number | ((index: number) => number) | undefined;
|
|
4183
4183
|
} | undefined;
|
|
4184
|
+
pagerScroll?: {
|
|
4185
|
+
enable?: boolean | undefined;
|
|
4186
|
+
capacity?: number | undefined;
|
|
4187
|
+
} | undefined;
|
|
4184
4188
|
onFormChange?: ((payload_0: import("../../../../../components/iho-table").IhoTableFormChangePayload) => void) | undefined;
|
|
4185
4189
|
onCopy?: ((params: import("vxe-table").VxeTableDefines.CopyEventParams) => void) | undefined;
|
|
4186
4190
|
onCut?: ((params: import("vxe-table").VxeTableDefines.CutEventParams) => void) | undefined;
|
|
@@ -7746,6 +7750,10 @@ export declare const CallbackMaps: Map<string, {
|
|
|
7746
7750
|
bodyWidth?: number | ((index: number) => number) | undefined;
|
|
7747
7751
|
bodyMinWidth?: number | ((index: number) => number) | undefined;
|
|
7748
7752
|
} | undefined;
|
|
7753
|
+
pagerScroll?: {
|
|
7754
|
+
enable?: boolean | undefined;
|
|
7755
|
+
capacity?: number | undefined;
|
|
7756
|
+
} | undefined;
|
|
7749
7757
|
onFormChange?: ((payload_0: import("../../../../../components/iho-table").IhoTableFormChangePayload) => void) | undefined;
|
|
7750
7758
|
onSettingClick?: (() => void) | undefined;
|
|
7751
7759
|
onFormClick?: ((payload_0: import("../../../../../components/iho-table").IhoTableFormChangePayload) => void) | undefined;
|
|
@@ -699,6 +699,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
699
699
|
handleInitConditions: () => Promise<void>;
|
|
700
700
|
validate: () => Promise<unknown>;
|
|
701
701
|
saveAdd: () => void;
|
|
702
|
+
/**
|
|
703
|
+
* 改变展示方式
|
|
704
|
+
*/
|
|
702
705
|
cancelSaveAdd: () => void;
|
|
703
706
|
checkActionList: () => boolean;
|
|
704
707
|
NSpin: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{
|
|
1
|
+
import{fabric as t}from"../../../../../shared/utils/fabricjs/index.js";import{defaultStyle as e,drawText as i,defaultRectStyle as n,drawTextGroup as o,drawLine as r,drawPoint as l}from"../useDraw.js";import{useGrid as s}from"../useGrid.js";import{useBirthProcessCumputedPoint as a}from"../useCumputedPoint.js";import"../useEvent.js";import{drawScaleNumber as c}from"../useScaleColumn.js";import"vue";import{getScaleNumberList as f}from"../../utils/index.js";import{isArray as u,cloneDeep as d}from"lodash-es";import"date-fns";import"../temperature/useShadow.js";import"@vueuse/shared";import"naive-ui";import"@vueuse/core";function m(m,h,p,g,v){const{computedX:x,getXValue:L}=a(h),{originX:X,endX:C,xCellWidth:w,originYXAxis:y,top:Y,canvasWidth:S,borderStyle:j,treeData:b,xAxis:G,topGridYNumber:k,topGridOriginY:E,topGridYCellHeight:I,topGridEndY:M,event:z}=h,A=new Set;function $(t,e,i){let n;const{content:o}=t.value||{};if(o){const{textStyle:r}=Y.dataStyle||{},{startLine:s,endLine:a}=e;n=l(o,{fontSize:12,...r,backgroundColor:"#fff",lockMovementX:!0,lockMovementY:!0});const c=V(n,e,i);n&&(n.set(c),n.origin={data:t},N(n),s&&(s.text=n),a&&(a.text=n))}return n}function V(t,e,i){const n=t.width+1,{startLine:o,centerLine:r,endLine:l}=e,s={top:i,originX:"center",originY:"center"};return r&&n<=r.width?s.left=r.x1+r.width/2:l&&n<=l.limitX.x2-l.left?(s.originX="left",s.left=l.left+1):o&&!l&&n<=o.limitX.x2-o.left?(s.originX="left",s.left=o.left+(o.isCustomIcon?5:1)):o&&n<=o.left-o.limitX.x1?(s.originX="right",s.left=o.left-(o.isCustomIcon?5:1)):r?(s.originY="top",s.left=r.x1+r.width/2,s.top=i+1,s.fontSize=10):o&&(s.originX="left",s.originY="top",s.fontSize=10,s.left=o.left,s.top=i+1),s}function D(e,{isCustomIcon:i,isContinue:n,isLeft:o}){const{x:s,y1:a,y2:c,halfY:f}=e;if(!s||s<X||s>C)return;const{lineStyle:u}=Y.dataStyle||{};let d;const m={left:s,top:f};d=i?l("circle",{fill:u.stroke,...m}):n?l(">",{fill:u.stroke,...m,fontSize:18}):r([s,a,s,f],u);const h=new t.Rect({width:w,height:I,fill:"transparent",left:s-w/2,top:a}),p=new t.Group([d,h],{originX:"center",originY:"center",hasControls:!1,hasBorders:!1,objectCaching:!1,hoverCursor:"pointer",lockMovementY:!0});return p.isLeft=o,p.isCustomIcon=i,N(p),p}function N(t){z.hovered&&(t.on("mouseover",(()=>{T(t,"hover")})),t.on("mouseout",(()=>{g.show=!1}))),t.lockMovementX&&t.lockMovementY||(t.on("moving",(()=>{!function(t){t.setCoords(),t.left<t.limitX.x1&&t.set("left",t.limitX.x1);t.left>t.limitX.x2&&t.set("left",t.limitX.x2)}(t),function(t){if(t.centerLine){const e=t.isLeft?{x1:t.left}:{x2:t.left};t.centerLine.setCoords().set(e)}if(t.text){const e=V(t.text,{startLine:t.isLeft?t:t.nearLine,centerLine:t.centerLine,endLine:t.isLeft?t.nearLine:t},t.top);t.text.setCoords().set(e)}}(t),z.hovered&&T(t)})),t.on("mouseup",(e=>{if(1===e.button){!function(t){t.isLeft?(t.prevLine&&(t.prevLine.limitX.x2=t.left),t.nearLine&&(t.nearLine.limitX.x1=t.left)):(t.nextLine&&(t.nextLine.limitX.x1=t.left),t.nearLine&&(t.nearLine.limitX.x2=t.left))}(t);const e={type:"tree",...t.origin};p("change",e)}})))}function T(t,e="moving"){var i,n,o;const{data:r}=t.origin;g.point={x:t.left,y:t.top};let[l="",s=""]=r.time||[];if("moving"===e){const e=L(t.left);t.isLeft?l=e:s=e,r.time=[l,s],t.text&&(t.text.origin.data.time=[l,s])}g.list=[`开始时间 ${l}`,`结束时间 ${s}`,`流速 ${(null==(i=r.value)?void 0:i.currentSpeed)||""}`,`浓度 ${(null==(n=r.value)?void 0:n.consistence)||""}`,`总量 ${(null==(o=r.value)?void 0:o.total)||""}`],g.sourceData=[{type:"tree",startTime:l,endTime:s,value:r.value}],g.isTarget=!0,g.show=!0}s(m,{...h,gridYNumber:k,originY:E,yCellHeight:I,endY:M}),function(){const{height:o,list:r,left:l,spaceValue:s,style:a,marginBottom:c}=G;if(!o)return;const f=[],u=y+(c?o-c:o/2),d=c?"bottom":"center";r.forEach(((t,e)=>{const n=l+e*w*s;f.push(i([n,u],{value:t.slice(11,16),originY:d,...a}))}));const h=f.length>0?new t.Group([...f],{...e,objectCaching:!1}):null;h&&m.value.add(h);const p=new t.Rect({width:S,height:o,left:0,top:y,...n,originX:"left",originY:"top",...j});m.value.add(p);const{show:g=!0}=Y}(),function(){var i;const n=(null==(i=null==Y?void 0:Y.tree)?void 0:i.textStyle)||{},l=[];!function t(e){e.forEach((e=>{var i;const{width:s,height:a,left:c,top:f,title:u=""}=e,m={value:u,...n};(null==(i=e.children)?void 0:i.length)?(m.value=u.split("").join("\n"),t(e.children)):(m.textAlign="left",function(t){if(!(null==t?void 0:t.data)||!Array.isArray(t.data))return;const{lineStyle:e}=Y.dataStyle||{},i=t.top,n=i+I,o=n-I/2,l={y1:i,y2:n,halfY:o};let s=null;const a=d(t);delete a.data,t.data.forEach(((t,i,n)=>{const{time:c,continue:f}=t,[u,d]=c,m=u&&x(u),h=d&&x(d),p=D({...l,x:m},{isCustomIcon:!h&&!f,isContinue:!1,isLeft:!0}),g=D({...l,x:h},{isCustomIcon:!1,isContinue:!!f});let v;if((p||m<X)&&(g||h>C)){v=r([p?m:X,o,g?h:C,o],e)}const L={startLine:p,centerLine:v,endLine:g};let w,y;!function(t,e,i){const{startLine:n,centerLine:o,endLine:r}=e,{startLine:l,endLine:s}=t||{};if(n){n.origin=i;const t={x1:X,x2:r?r.left:C};s?(t.x1=s.left,s.limitX.x2=n.left,n.prevLine=s,s.nextLine=n):l&&(t.x1=l.left,l.limitX.x2=n.left,n.prevLine=l,l.nextLine=n),n.limitX=t,o&&(n.centerLine=o)}if(r){r.origin=i;const t={x1:n?n.left:X,x2:C};r.limitX=t,o&&(r.centerLine=o)}n&&r&&(n.nearLine=r,r.nearLine=n)}(s,L,Object.assign({},a,{data:t,index:i})),s&&(w=$(n[i-1],s,o)),i===n.length-1&&(y=$(t,L,o)),s=L,v&&A.add(v),p&&A.add(p),g&&A.add(g),w&&A.add(w),y&&A.add(y)}))}(e)),l.push(o({width:s,height:a,...j},m,{left:c,top:f},!0))}))}(b);const s=l.length>0?new t.Group([...l],{...e,objectCaching:!1}):null;s&&m.value.add(s),A.size&&m.value.add(...A)}(),function(){const{show:i=!0,range:n,spaceValue:o=.5,spaceGridNumber:r=1,style:l,margin:s=5}=(null==Y?void 0:Y.scaleValue)||{};if(!i||!u(n))return;const a=f(n,o),d=[];if(a.forEach(((t,e)=>{if(0===e||e===a.length-1)return;const i=M-e*I*r;Math.abs(i-E)<1||d.push(c(String(t),{style:l,position:"right"},C+s,i))})),!d.length)return;const h=new t.Group(d,{objectCaching:!1,...e});m.value.add(h)}()}export{m as useTop};
|
|
@@ -222,6 +222,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
222
222
|
type: BooleanConstructor;
|
|
223
223
|
default: boolean;
|
|
224
224
|
};
|
|
225
|
+
draggable: {
|
|
226
|
+
type: BooleanConstructor;
|
|
227
|
+
default: boolean;
|
|
228
|
+
};
|
|
229
|
+
isFieldSet: {
|
|
230
|
+
type: BooleanConstructor;
|
|
231
|
+
default: boolean;
|
|
232
|
+
};
|
|
225
233
|
}, {
|
|
226
234
|
fixedWayOptions: {
|
|
227
235
|
label: string;
|
|
@@ -298,6 +306,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
298
306
|
type: BooleanConstructor;
|
|
299
307
|
default: boolean;
|
|
300
308
|
};
|
|
309
|
+
draggable: {
|
|
310
|
+
type: BooleanConstructor;
|
|
311
|
+
default: boolean;
|
|
312
|
+
};
|
|
313
|
+
isFieldSet: {
|
|
314
|
+
type: BooleanConstructor;
|
|
315
|
+
default: boolean;
|
|
316
|
+
};
|
|
301
317
|
}>> & {
|
|
302
318
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
303
319
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -395,6 +411,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
395
411
|
type: BooleanConstructor;
|
|
396
412
|
default: boolean;
|
|
397
413
|
};
|
|
414
|
+
draggable: {
|
|
415
|
+
type: BooleanConstructor;
|
|
416
|
+
default: boolean;
|
|
417
|
+
};
|
|
418
|
+
isFieldSet: {
|
|
419
|
+
type: BooleanConstructor;
|
|
420
|
+
default: boolean;
|
|
421
|
+
};
|
|
398
422
|
}>> & {
|
|
399
423
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
400
424
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -437,9 +461,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
437
461
|
requiredDisable: boolean;
|
|
438
462
|
hide: boolean;
|
|
439
463
|
}>;
|
|
464
|
+
draggable: boolean;
|
|
440
465
|
isHighlightRow: boolean;
|
|
441
466
|
idx: number;
|
|
442
467
|
isHighlight: boolean;
|
|
468
|
+
isFieldSet: boolean;
|
|
443
469
|
}>;
|
|
444
470
|
EditDialog: import("vue").DefineComponent<{
|
|
445
471
|
visible: {
|
|
@@ -243,6 +243,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
243
243
|
type: BooleanConstructor;
|
|
244
244
|
default: boolean;
|
|
245
245
|
};
|
|
246
|
+
draggable: {
|
|
247
|
+
type: BooleanConstructor;
|
|
248
|
+
default: boolean;
|
|
249
|
+
};
|
|
250
|
+
isFieldSet: {
|
|
251
|
+
type: BooleanConstructor;
|
|
252
|
+
default: boolean;
|
|
253
|
+
};
|
|
246
254
|
}, {
|
|
247
255
|
fixedWayOptions: {
|
|
248
256
|
label: string;
|
|
@@ -319,6 +327,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
319
327
|
type: BooleanConstructor;
|
|
320
328
|
default: boolean;
|
|
321
329
|
};
|
|
330
|
+
draggable: {
|
|
331
|
+
type: BooleanConstructor;
|
|
332
|
+
default: boolean;
|
|
333
|
+
};
|
|
334
|
+
isFieldSet: {
|
|
335
|
+
type: BooleanConstructor;
|
|
336
|
+
default: boolean;
|
|
337
|
+
};
|
|
322
338
|
}>> & {
|
|
323
339
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
324
340
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -416,6 +432,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
416
432
|
type: BooleanConstructor;
|
|
417
433
|
default: boolean;
|
|
418
434
|
};
|
|
435
|
+
draggable: {
|
|
436
|
+
type: BooleanConstructor;
|
|
437
|
+
default: boolean;
|
|
438
|
+
};
|
|
439
|
+
isFieldSet: {
|
|
440
|
+
type: BooleanConstructor;
|
|
441
|
+
default: boolean;
|
|
442
|
+
};
|
|
419
443
|
}>> & {
|
|
420
444
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
421
445
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -458,9 +482,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
458
482
|
requiredDisable: boolean;
|
|
459
483
|
hide: boolean;
|
|
460
484
|
}>;
|
|
485
|
+
draggable: boolean;
|
|
461
486
|
isHighlightRow: boolean;
|
|
462
487
|
idx: number;
|
|
463
488
|
isHighlight: boolean;
|
|
489
|
+
isFieldSet: boolean;
|
|
464
490
|
}>;
|
|
465
491
|
setStyle: typeof setStyle;
|
|
466
492
|
}, 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<{
|
|
@@ -66,6 +66,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
66
66
|
fieldShowMaxValue: {
|
|
67
67
|
type: NumberConstructor;
|
|
68
68
|
};
|
|
69
|
+
rowDraggable: {
|
|
70
|
+
type: BooleanConstructor;
|
|
71
|
+
default: boolean;
|
|
72
|
+
};
|
|
69
73
|
}, {
|
|
70
74
|
fieldsMapping: Record<string, string>;
|
|
71
75
|
attrs: {
|
|
@@ -134,6 +138,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
134
138
|
fieldShowMaxValue: {
|
|
135
139
|
type: NumberConstructor;
|
|
136
140
|
};
|
|
141
|
+
rowDraggable: {
|
|
142
|
+
type: BooleanConstructor;
|
|
143
|
+
default: boolean;
|
|
144
|
+
};
|
|
137
145
|
}>> & {
|
|
138
146
|
onReset?: ((...args: any[]) => any) | undefined;
|
|
139
147
|
onSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -176,6 +184,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
176
184
|
checked: boolean;
|
|
177
185
|
column: AnyObject;
|
|
178
186
|
}) => void;
|
|
187
|
+
draggable: boolean;
|
|
188
|
+
isFieldSet: boolean;
|
|
179
189
|
};
|
|
180
190
|
searchData: {
|
|
181
191
|
keyword: string;
|
|
@@ -340,6 +350,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
340
350
|
type: BooleanConstructor;
|
|
341
351
|
default: boolean;
|
|
342
352
|
};
|
|
353
|
+
draggable: {
|
|
354
|
+
type: BooleanConstructor;
|
|
355
|
+
default: boolean;
|
|
356
|
+
};
|
|
357
|
+
isFieldSet: {
|
|
358
|
+
type: BooleanConstructor;
|
|
359
|
+
default: boolean;
|
|
360
|
+
};
|
|
343
361
|
}, {
|
|
344
362
|
fixedWayOptions: {
|
|
345
363
|
label: string;
|
|
@@ -416,6 +434,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
416
434
|
type: BooleanConstructor;
|
|
417
435
|
default: boolean;
|
|
418
436
|
};
|
|
437
|
+
draggable: {
|
|
438
|
+
type: BooleanConstructor;
|
|
439
|
+
default: boolean;
|
|
440
|
+
};
|
|
441
|
+
isFieldSet: {
|
|
442
|
+
type: BooleanConstructor;
|
|
443
|
+
default: boolean;
|
|
444
|
+
};
|
|
419
445
|
}>> & {
|
|
420
446
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
421
447
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -513,6 +539,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
513
539
|
type: BooleanConstructor;
|
|
514
540
|
default: boolean;
|
|
515
541
|
};
|
|
542
|
+
draggable: {
|
|
543
|
+
type: BooleanConstructor;
|
|
544
|
+
default: boolean;
|
|
545
|
+
};
|
|
546
|
+
isFieldSet: {
|
|
547
|
+
type: BooleanConstructor;
|
|
548
|
+
default: boolean;
|
|
549
|
+
};
|
|
516
550
|
}>> & {
|
|
517
551
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
518
552
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -555,9 +589,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
555
589
|
requiredDisable: boolean;
|
|
556
590
|
hide: boolean;
|
|
557
591
|
}>;
|
|
592
|
+
draggable: boolean;
|
|
558
593
|
isHighlightRow: boolean;
|
|
559
594
|
idx: number;
|
|
560
595
|
isHighlight: boolean;
|
|
596
|
+
isFieldSet: boolean;
|
|
561
597
|
}>;
|
|
562
598
|
isArray: {
|
|
563
599
|
(value?: any): value is any[];
|
|
@@ -629,6 +665,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
629
665
|
fieldShowMaxValue: {
|
|
630
666
|
type: NumberConstructor;
|
|
631
667
|
};
|
|
668
|
+
rowDraggable: {
|
|
669
|
+
type: BooleanConstructor;
|
|
670
|
+
default: boolean;
|
|
671
|
+
};
|
|
632
672
|
}>> & {
|
|
633
673
|
onReset?: ((...args: any[]) => any) | undefined;
|
|
634
674
|
onSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -654,6 +694,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
654
694
|
hide: boolean;
|
|
655
695
|
}>[];
|
|
656
696
|
isEdit: boolean;
|
|
697
|
+
rowDraggable: boolean;
|
|
657
698
|
showSeq: boolean;
|
|
658
699
|
footerFlag: boolean;
|
|
659
700
|
customColumns: FieldSetColumnItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,useAttrs as l,ref as t,computed as i,reactive as o,watch as
|
|
1
|
+
import{defineComponent as e,useAttrs as l,ref as t,computed as i,reactive as o,watch as a,openBlock as d,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 k,normalizeClass as x,mergeProps as w,renderSlot as S}from"vue";import{NInput as A,NCheckbox as _,NTooltip as C,NIcon as F,NPopconfirm as W,NButton as E}from"naive-ui";import H from"../../../shared/components/VueDraggable/src/vuedraggable.js";import N from"./components/Row.vue.js";import{isArray as P,cloneDeep as q,isString as B,omit as R}from"lodash-es";import{isDisable as V,setStyle as j,isDraggableItem as D,isDraggable as I,getGroupTree as M}from"./utils/index.js";import{uuidGenerator as U}from"../../../shared/utils/index.js";import{HelpCircleSharp as O}from"@vicons/ionicons5";const T={class:"main-wrapper"},K={class:"main-wrapper__table-header"},G=h("span",null,"数值越小,优先级越高",-1),L=["tabindex"],$={key:1,class:"main-wrapper__table-footer"};var z=e({__name:"FieldSet",props:{fields:{type:Array,default:()=>[]},footerFlag:{type:Boolean,default:!0},type:{type:String,default:"old"},isEdit:{type:Boolean,default:!1},showColumnNames:{type:Array},groupSetting:{type:Object},customColumns:{type:Array,default:()=>[]},showSeq:{type:Boolean,default:!1},showSearch:{type:Boolean,default:!1},showSortPriority:{type:Boolean,default:!1},showHeadFilter:{type:Boolean,default:!1},fieldShowMaxValue:{type:Number},rowDraggable:{type:Boolean,default:!0}},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(),Z=t(""),ee=t(),le=t([]),te=t([{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"}]),ie=i((()=>le.value.flat())),oe=o({columns:te,data:ie,onUpdateChecked:function({checked:e,column:l}){const t=!e||he(l.field);l.checkedAll=!t},draggable:Q.rowDraggable,isFieldSet:!0}),ae={keyword:Z.value,idx:0,startIdx:0},de=()=>{J("save")},re=()=>{J("close")};function se(){le.value=ne(),fe(),J("reset")}function ne(){const e=q(Q.fields).map((e=>({...e,uuid:U()})));return Object.keys(X).forEach((l=>{e.forEach((e=>{"old"==Q.type&&Reflect.has(e,l)&&("isFixed"==l?e.fixedWay=1==e[l]?"LEFT":2==e[l]?"RIGHT":"NONE":["isShow","isSort"].includes(l)&&"boolean"!=typeof l?e[X[l]]=1==e[l]:e[X[l]]=e[l],Reflect.deleteProperty(e,l)),e.columnWidth=+e.columnWidth||null,Reflect.has(e,"alias")||(e.alias=""),Reflect.has(e,"bold")||(e.bold=!1),e.draggable=!!I(e)}))})),function(e){if(Q.groupSetting){return M(Q.groupSetting,e).reduce(((t,i)=>{const o=B(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 ue(){const e=ae.keyword!==Z.value;let l=Z.value?ie.value.findIndex(((l,t)=>{var i;if(null==(i=l.title)?void 0:i.includes(Z.value))return!!e||t>ae.idx})):0;-1!==l||e||(l=ae.startIdx),ee.value.scrollTop=Y.rowHeight*l,Object.assign(ae,{keyword:Z.value,idx:l},e?{startIdx:l}:{})}function ce(e){var l;return!!Z.value&&(null==(l=e.title)?void 0:l.includes(Z.value))}function fe(){var e,l;(null==(e=Q.showColumnNames)?void 0:e.length)&&(te.value=te.value.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)&&te.value.push(...Q.customColumns),Q.showSeq&&te.value.splice(1,0,{title:"排序",type:"text",field:"seq"}),te.value.forEach((e=>{if(e.isShow=function(e){return!(["editable","required"].includes(e.field)&&!Q.isEdit||"sortPriority"===e.field&&!Q.showSortPriority||"isShowHeaderFilter"===e.field&&!Q.showHeadFilter)}(e),"checkbox"===e.type){const l=le.value.flat().every((l=>!Reflect.has(l,e.field)));e.checkedAll=!he(e.field)&&!l}}))}function he(e){return le.value.flat().some((l=>!V(l,e)&&!l[e]&&"0001"!=l.id))}function pe(e){return!!D(e.relatedContext.element)}return a([()=>Q.fields,()=>{var e;return null==(e=Q.showColumnNames)?void 0:e.length}],(([e,l])=>{e.length>0&&(le.value=ne(),fe())}),{immediate:!0,deep:!0}),z({getTableFields:function(){let e=[];return e="old"==Q.type?ie.value.map(((e,l)=>({id:e.id,field:e.name,visible:e.show,sequence:l,sortable:e.sort,title:e.alias,fixed:e.fixedWay,minWidth:e.columnWidth,bold:e.bold,sortDirection:e.sortDirection,sortPriority:e.sortPriority,...Q.isEdit?{required:e.required,editable:e.editable}:{}}))):ie.value,e.map((e=>R(e,["uuid"])))}}),(l,t)=>(d(),r("div",T,[e.showSearch?(d(),s(n(A),{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(ue,["prevent"]),["enter"])},null,8,["value","onKeydown"])):f("v-if",!0),h("div",K,[(d(!0),r(p,null,m(te.value,((e,l)=>(d(),r(p,{key:l},[e.isShow?(d(),r("span",{key:0,class:"table-cell",style:y(n(j)(e,l))},["checkbox"!==e.type||e.isHeadCheckHide?(d(),r(p,{key:1},[b(g(e.title),1)],64)):(d(),s(n(_),{key:0,checked:e.checkedAll,"onUpdate:checked":[l=>e.checkedAll=l,l=>{return t=l,i=e.field,void ie.value.forEach((e=>{V(e,i)||(e[i]=t)}));var t,i}],disabled:e.disabledAll},{default:v((()=>[b(g(e.title),1)])),_:2},1032,["checked","onUpdate:checked","disabled"])),"sortPriority"===e.field?(d(),s(n(C),{key:2,trigger:"hover"},{trigger:v((()=>[k(n(F),{component:n(O),style:{top:"2px"}},null,8,["component"])])),default:v((()=>[G])),_:1})):f("v-if",!0)],4)):f("v-if",!0)],64)))),128))]),h("div",{class:"main-wrapper__table-body",ref_key:"tableBodyRef",ref:ee},[k(n(H),{modelValue:le.value,"onUpdate:modelValue":t[1]||(t[1]=e=>le.value=e),animation:"150","item-key":"id",filter:".disabled",draggable:".item",move:pe,disabled:!e.rowDraggable},{item:v((({element:e,index:l})=>[e.hide?f("v-if",!0):(d(),r("div",{key:0,class:x(["item",n(D)(e)?"":"disabled"]),tabindex:l},[n(P)(e)?(d(!0),r(p,{key:0},m(e,((e,t)=>(d(),s(N,w(oe,{key:t,element:e,idx:l+1,"is-highlight":ce(e)}),null,16,["element","idx","is-highlight"])))),128)):(d(),s(N,w({key:1},oe,{element:e,idx:l+1,"is-highlight":ce(e)}),null,16,["element","idx","is-highlight"]))],10,L))])),_:1},8,["modelValue","disabled"])],512),e.footerFlag?(d(),r("div",$,[f(" 底部按钮插槽 "),S(l.$slots,"footer",{},(()=>[k(n(W),{onPositiveClick:se},{trigger:v((()=>[k(n(E),{style:{"margin-right":"8px"}},{default:v((()=>[b("恢复默认设置")])),_:1})])),default:v((()=>[b(" 确认要恢复系统默认设置吗? ")])),_:1}),k(n(E),{style:{"margin-right":"8px"},onClick:re},{default:v((()=>[b("取消")])),_:1}),k(n(E),{type:"primary",onClick:de},{default:v((()=>[b("保存")])),_:1})]))])):f("v-if",!0)]))}});export{z as default};
|
|
@@ -64,6 +64,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
64
64
|
type: BooleanConstructor;
|
|
65
65
|
default: boolean;
|
|
66
66
|
};
|
|
67
|
+
draggable: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
isFieldSet: {
|
|
72
|
+
type: BooleanConstructor;
|
|
73
|
+
default: boolean;
|
|
74
|
+
};
|
|
67
75
|
}, {
|
|
68
76
|
fixedWayOptions: {
|
|
69
77
|
label: string;
|
|
@@ -140,6 +148,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
140
148
|
type: BooleanConstructor;
|
|
141
149
|
default: boolean;
|
|
142
150
|
};
|
|
151
|
+
draggable: {
|
|
152
|
+
type: BooleanConstructor;
|
|
153
|
+
default: boolean;
|
|
154
|
+
};
|
|
155
|
+
isFieldSet: {
|
|
156
|
+
type: BooleanConstructor;
|
|
157
|
+
default: boolean;
|
|
158
|
+
};
|
|
143
159
|
}>> & {
|
|
144
160
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
145
161
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -237,6 +253,14 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
237
253
|
type: BooleanConstructor;
|
|
238
254
|
default: boolean;
|
|
239
255
|
};
|
|
256
|
+
draggable: {
|
|
257
|
+
type: BooleanConstructor;
|
|
258
|
+
default: boolean;
|
|
259
|
+
};
|
|
260
|
+
isFieldSet: {
|
|
261
|
+
type: BooleanConstructor;
|
|
262
|
+
default: boolean;
|
|
263
|
+
};
|
|
240
264
|
}>> & {
|
|
241
265
|
onUpdateChecked?: ((...args: any[]) => any) | undefined;
|
|
242
266
|
onEdit?: ((...args: any[]) => any) | undefined;
|
|
@@ -279,8 +303,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
279
303
|
requiredDisable: boolean;
|
|
280
304
|
hide: boolean;
|
|
281
305
|
}>;
|
|
306
|
+
draggable: boolean;
|
|
282
307
|
isHighlightRow: boolean;
|
|
283
308
|
idx: number;
|
|
284
309
|
isHighlight: boolean;
|
|
310
|
+
isFieldSet: boolean;
|
|
285
311
|
}>;
|
|
286
312
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as a,unref as
|
|
1
|
+
import{defineComponent as e,openBlock as t,createElementBlock as l,Fragment as i,renderList as n,normalizeStyle as a,unref as o,createBlock as r,withCtx as u,createVNode as d,createCommentVNode as s,createElementVNode as c,toDisplayString as f,normalizeClass as p,withDirectives as m,vShow as v,resolveDynamicComponent as y,createTextVNode as g}from"vue";import{NTooltip as h,NIcon as b,NCheckbox as k,NSelect as x,NColorPicker as E,NInput as S,NInputNumber as T,NPopconfirm as w}from"naive-ui";import{setStyle as C,setColorInfo as N,isShowExplicitRequired as U,isDisable as D}from"../utils/index.js";import{ReorderTwoOutline as _,HelpCircleOutline as O,CreateOutline as j,TrashOutline as R}from"@vicons/ionicons5";import{isFunction as A,isArray as H,range as L}from"lodash-es";import{COLOR_MAP as M}from"../constants/index.js";import{WIDGET_TYPE as P,SELECT_MAP as F,WIDGET_MAP as V,SELECT_TYPE as I,SELECT_DEFAULT_MAP as B,DATE_MAP as q,DATETIME_MAP as W}from"../constants/filter.js";const G={class:"row"},z=["title"],J=c("span",null,"拖拽调整顺序",-1);var K=e({__name:"Row",props:{element:{type:Object,default:()=>({})},columns:{type:Array,default:()=>[]},idx:{type:Number,default:1},data:{type:Array,default:()=>[]},isHighlight:{type:Boolean},index:{type:Number,default:0},isHighlightRow:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},isFieldSet:{type:Boolean,default:!1}},emits:["updateChecked","edit"],setup(e,{emit:K}){const Q=e,X=[{label:"不固定",value:"NONE"},{label:"左固定",value:"LEFT"},{label:"右固定",value:"RIGHT"}],Y=[{label:"不排序",value:"NONE"},{label:"升序",value:"ASC"},{label:"降序",value:"DESC"}],Z=[{label:"字体",value:"font"},{label:"背景",value:"background"}],$=Object.entries(M).map((([e])=>e));function ee(){Q.data.splice(Q.index,1)}function te(){K("edit",Q.element)}function le(e){if("defaultValue"===e){const{optionType:e}=Q.element;return e===I.SELECT_MULTIPLE}return!1}function ie(e){if("0001"==Q.element.id&&"fixedWay"!=e)return!1;const{isConfiguredHeaderFilter:t}=Q.element;return"isShowHeaderFilter"===e?!!t:!(["explicitRequired","defaultValue"].includes(e)&&![P.DATE,P.DATETIME,P.SELECT].includes(Q.element.type))}function ne(e){return!["explicitRequired","defaultValue"].includes(e)||U(Q.element)}function ae(e){switch(e.field){case"fixedWay":return X;case"sortDirection":return Y;case"sortPriority":return function(){const e=L(1,Q.data.length+1).map((e=>({label:e.toString(),value:e}))),t=Q.data.filter((e=>!!e.sortPriority&&e.uuid!==Q.element.uuid)).map((e=>e.sortPriority));return e.filter((e=>!t.includes(e.value)))}();case"colorScope":return Z;case"defaultValue":{const{type:e,optionInfo:t}=Q.element;return e===P.SELECT?H(null==t?void 0:t.list)&&t.list.length>0?t.list.map((e=>({...e,label:e.name}))):Object.entries(B).map((([e,t])=>({value:e,label:t}))):e===P.DATE?Object.entries(q).map((([e,t])=>({value:e,label:t}))):e===P.DATETIME?Object.entries(W).map((([e,t])=>({value:e,label:t}))):[]}default:return[]}}function oe(e){var t;if(1==Q.element.defaultMark||"color"===e.type&&Q.isHighlightRow)return!0;if("checkbox"===e.type)return"show"===e.field&&e.fieldShowMaxValue?!Q.element[e.field]&&(null==(t=Q.data.filter((t=>t[e.field])))?void 0:t.length)===e.fieldShowMaxValue:D(Q.element,e.field);if("sortPriority"!==e.field)return!1;const{sortDirection:l}=Q.element;return!l||"NONE"===l}function re(e){return["title","result"].includes(e.field)&&Q.element.style||{}}return(U,D)=>(t(),l("div",G,[(t(!0),l(i,null,n(e.columns,((n,U)=>{return t(),l(i,{key:U},[n.isShow?(t(),l("span",{key:0,class:"table-cell",title:e.element[n.field],style:a(o(C)(n,U))},["text"===n.type?(t(),l(i,{key:0},[0===U?(t(),l(i,{key:0},[!e.isFieldSet||e.draggable&&e.isFieldSet?(t(),r(o(h),{key:0,trigger:"hover"},{trigger:u((()=>[d(o(b),{style:{"margin-right":"5px",top:"2px"},component:o(_)},null,8,["component"])])),default:u((()=>[J])),_:1})):s("v-if",!0),"title"===n.field&&e.element.feildDescribe?(t(),r(o(h),{key:1,trigger:"hover"},{trigger:u((()=>[d(o(b),{style:{"margin-right":"5px",top:"2px"},component:o(O)},null,8,["component"])])),default:u((()=>[c("span",null,f(e.element.feildDescribe),1)])),_:1})):s("v-if",!0)],64)):s("v-if",!0),c("span",{class:p([e.isHighlight&&"title"===n.field?"highlight":""]),style:a(re(n))},f((H=n.field,"seq"===H?Q.idx:"optionType"===H?Q.element[H]&&Q.element.type===P.SELECT?F[Q.element[H]]:"":"type"===H?V[Q.element[H]]:Q.element[H])),7)],64)):s("v-if",!0),"checkbox"===n.type&&ie(n.field)?m((t(),r(o(k),{key:1,disabled:oe(n),checked:e.element[n.field],"onUpdate:checked":[t=>e.element[n.field]=t,e=>function(e,t){K("updateChecked",{checked:e,column:t})}(e,n)]},null,8,["disabled","checked","onUpdate:checked"])),[[v,ne(n.field)]]):s("v-if",!0),"select"===n.type&&ie(n.field)?m((t(),r(o(x),{key:2,clearable:"",multiple:le(n.field),disabled:oe(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,e=>function(e,t){"sortDirection"===t.field&&"NONE"===e&&(Q.element.sortPriority=null),"colorScope"===t.field&&N(Q.element)}(e,n)],options:ae(n)},null,8,["multiple","disabled","value","onUpdate:value","options"])),[[v,ne(n.field)]]):s("v-if",!0),"color"===n.type?(t(),r(o(E),{key:3,class:"c-field-set__color-picker",clearable:"",disabled:oe(n),value:e.element[n.field],"onUpdate:value":[t=>e.element[n.field]=t,D[0]||(D[0]=t=>o(N)(e.element))],"show-preview":"",modes:["hex"],swatches:o($)},null,8,["disabled","value","onUpdate:value","swatches"])):s("v-if",!0),"input"===n.type?m((t(),r(o(S),{key:4,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t,clearable:""},null,8,["value","onUpdate:value"])),[[v,"0001"!=e.element.id]]):s("v-if",!0),"inputNumber"===n.type?(t(),r(o(T),{key:5,value:e.element[n.field],"onUpdate:value":t=>e.element[n.field]=t},null,8,["value","onUpdate:value"])):s("v-if",!0),"custom"===n.type&&o(A)(n.contentRender)?(t(),r(y((()=>n.contentRender(n,e.element))),{key:6})):s("v-if",!0),"custom"===n.type&&"opt"===n.field&&1!=e.element.defaultMark?(t(),l(i,{key:7},[d(o(h),{trigger:"hover"},{trigger:u((()=>[d(o(b),{component:o(j),onClick:te},null,8,["component"])])),default:u((()=>[g(" 编辑 ")])),_:1}),d(o(w),{onPositiveClick:ee},{trigger:u((()=>[d(o(h),{trigger:"hover"},{trigger:u((()=>[d(o(b),{component:o(R)},null,8,["component"])])),default:u((()=>[g(" 删除 ")])),_:1})])),default:u((()=>[g(" 是否确认删除? ")])),_:1})],64)):s("v-if",!0)],12,z)):s("v-if",!0)],64);var H})),128))]))}});export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isArray as e,isObject as t}from"lodash-es";import{IhoTableRowGroupSequence as o}from"../../../iho-table/src/constants/index.js";import{COLOR_MAP as n}from"../constants/index.js";import{WIDGET_TYPE as r}from"../constants/filter.js";function i(e,t){const o={flex:"1 1 90px"};switch(e.type){case"text":0===t&&["title","name"].includes(e.field)&&Object.assign(o,{flex:"
|
|
1
|
+
import{isArray as e,isObject as t}from"lodash-es";import{IhoTableRowGroupSequence as o}from"../../../iho-table/src/constants/index.js";import{COLOR_MAP as n}from"../constants/index.js";import{WIDGET_TYPE as r}from"../constants/filter.js";function i(e,t){const o={flex:"1 1 90px"};switch(e.type){case"text":0===t&&["title","name"].includes(e.field)&&Object.assign(o,{flex:"1 1 120px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}),"seq"===e.field&&(o.flex="1 1 40px");break;case"checkbox":o.flex="1 1 60px";break;case"select":o.flex="1 1 80px";break;case"input":o.flex="1 1 100px"}return o}function l(e,t){return["editable","required","show"].includes(t)&&(e[`${t}Disable`]||e[`${t}Disabled`])||["sort"].includes(t)&&(1==e.notParticipatingSort||e.sortDisabled)}function s(n,r,i=(e=>e.name)){const l=r.map((e=>i(e)));return o.some((o=>{const r=n[o];if(!e(r))return!0;r.forEach((o=>{if(!e(o.list)||!o.list.length)return;const n=[];let r=null;o.list.forEach(((e,i)=>{const s=function(e,o,n){return o.findIndex((o=>o!==n&&(t(o)?o.fieldName:o)===e))}(e,l,r);~s&&(n.push(l[s]),0===i?l.splice(s,1,r={fieldName:o.title,children:n}):l.splice(s,1))}))}))})),l}function c(e){return void 0===e.draggable||e.draggable}function a(t){return e(t)?!t.some((e=>!e.draggable)):t.draggable}function f(e){e.style="font"===e.colorScope?{color:e.color}:{background:e.color,color:"#fff"},e.result=n[e.color]}function u(e){const{isShowSearch:t,filterExplicit:o,type:n}=e;return t&&o&&[r.DATE,r.DATETIME,r.SELECT].includes(n)}export{s as getGroupTree,l as isDisable,c as isDraggable,a as isDraggableItem,u as isShowExplicitRequired,f as setColorInfo,i as setStyle};
|
|
@@ -3214,6 +3214,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
3214
3214
|
bodyWidth?: number | ((index: number) => number) | undefined;
|
|
3215
3215
|
bodyMinWidth?: number | ((index: number) => number) | undefined;
|
|
3216
3216
|
} | undefined;
|
|
3217
|
+
pagerScroll?: {
|
|
3218
|
+
enable?: boolean | undefined;
|
|
3219
|
+
capacity?: number | undefined;
|
|
3220
|
+
} | undefined;
|
|
3217
3221
|
onFormChange?: ((payload_0: import("../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
|
|
3218
3222
|
onCopy?: ((params: import("vxe-table").VxeTableDefines.CopyEventParams) => void) | undefined;
|
|
3219
3223
|
onCut?: ((params: import("vxe-table").VxeTableDefines.CutEventParams) => void) | undefined;
|
|
@@ -6779,6 +6783,10 @@ declare const IhoTable: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
6779
6783
|
bodyWidth?: number | ((index: number) => number) | undefined;
|
|
6780
6784
|
bodyMinWidth?: number | ((index: number) => number) | undefined;
|
|
6781
6785
|
} | undefined;
|
|
6786
|
+
pagerScroll?: {
|
|
6787
|
+
enable?: boolean | undefined;
|
|
6788
|
+
capacity?: number | undefined;
|
|
6789
|
+
} | undefined;
|
|
6782
6790
|
onFormChange?: ((payload_0: import("../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
|
|
6783
6791
|
onSettingClick?: (() => void) | undefined;
|
|
6784
6792
|
onFormClick?: ((payload_0: import("../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
|
|
@@ -3215,6 +3215,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3215
3215
|
bodyWidth?: number | ((index: number) => number) | undefined;
|
|
3216
3216
|
bodyMinWidth?: number | ((index: number) => number) | undefined;
|
|
3217
3217
|
} | undefined;
|
|
3218
|
+
pagerScroll?: {
|
|
3219
|
+
enable?: boolean | undefined;
|
|
3220
|
+
capacity?: number | undefined;
|
|
3221
|
+
} | undefined;
|
|
3218
3222
|
onFormChange?: ((payload_0: import("../../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
|
|
3219
3223
|
onCopy?: ((params: import("vxe-table").VxeTableDefines.CopyEventParams) => void) | undefined;
|
|
3220
3224
|
onCut?: ((params: import("vxe-table").VxeTableDefines.CutEventParams) => void) | undefined;
|
|
@@ -6780,6 +6784,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
6780
6784
|
bodyWidth?: number | ((index: number) => number) | undefined;
|
|
6781
6785
|
bodyMinWidth?: number | ((index: number) => number) | undefined;
|
|
6782
6786
|
} | undefined;
|
|
6787
|
+
pagerScroll?: {
|
|
6788
|
+
enable?: boolean | undefined;
|
|
6789
|
+
capacity?: number | undefined;
|
|
6790
|
+
} | undefined;
|
|
6783
6791
|
onFormChange?: ((payload_0: import("../../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
|
|
6784
6792
|
onSettingClick?: (() => void) | undefined;
|
|
6785
6793
|
onFormClick?: ((payload_0: import("../../../components/iho-table/src/types").IhoTableFormChangePayload) => void) | undefined;
|