cnhis-design-vue 3.1.46-beta.32 → 3.1.46-beta.33
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/select-person/index.d.ts +20 -23
- package/es/components/select-person/src/SelectPerson.vue.d.ts +20 -23
- package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
- 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 n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,u=`${h}/bi-api/reprot/print/open/client/getRemote`,m=`${h}/printService/file`;let p=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],p)return p;p=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,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:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){if(!this.webview)return Promise.reject();const e=Date.now().toString();return Promise.race([new Promise(((i,n)=>{this.messageHandlerQueue.push({resolve:i,reject:n,id:e}),this.webview.postMessage(t)})),new Promise(((t,i)=>{setTimeout((()=>{const t=this.messageHandlerQueue.findIndex((t=>t.id===e));t>-1&&this.messageHandlerQueue.splice(t,1),i({type:"timeout"})}),5e3)}))])}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({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}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).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:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(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){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_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,cmdid:n,print:s,printdlgshow:r="
|
|
1
|
+
import t from"axios";import{isArray as e}from"lodash-es";import{IdentityVerificationDialog as i,PreviewDialog as n}from"./dialog.js";import{getFileUrl as s,useBrowserPrint as r,isIReport as a}from"./browserPrint.js";import{getCurrentInstance as o}from"vue";import{format as l}from"date-fns";const d=t.create({timeout:1e3,withCredentials:!1}),h=`${window.location.protocol}//${window.location.host}`,c=`${h}/fdp-api/print/assembly/printIReport`,u=`${h}/bi-api/reprot/print/open/client/getRemote`,m=`${h}/printService/file`;let p=null;class w{constructor(){var t;if(this.webview=null,this.dialog=new i,this.dialogPreview=new n,this.instance=null,this.downloadPath="",this.printOrigin="http://127.0.0.1:11111",this.isRemote=!1,this.CMonitor=null,this.messageHandlerQueue=[],p)return p;p=this;const e=window;if(this.CMonitor=e.$CMonitor,this.webview=null==(t=e.chrome)?void 0:t.webview,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:n,reject:s}=e;try{n(i.res||"")}catch(t){s(t)}}else"config"===(null==i?void 0:i.exec)&&(this.downloadPath=(null==(e=i.res)?void 0:e.downloadpath)||"")}async postMessage(t){if(!this.webview)return Promise.reject();const e=Date.now().toString();return Promise.race([new Promise(((i,n)=>{this.messageHandlerQueue.push({resolve:i,reject:n,id:e}),this.webview.postMessage(t)})),new Promise(((t,i)=>{setTimeout((()=>{const t=this.messageHandlerQueue.findIndex((t=>t.id===e));t>-1&&this.messageHandlerQueue.splice(t,1),i({type:"timeout"})}),5e3)}))])}destroy(){this.webview&&this.currentMessageHandler&&(this.webview.removeEventListener("message",this.currentMessageHandler),this.currentMessageHandler=void 0)}show(...t){return this.dialog.show(...t)}showPreview(...t){return this.dialogPreview.show(...t)}_testConnection(){return this.webview?Promise.resolve(!0):new Promise((t=>{d({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}}):t({url:this.printOrigin+"/services/print",method:"get",params:{inputData:JSON.stringify(e)}}).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:n(i)}):d({url:this.printOrigin+"/PrintLocal",method:"post",data:i,transformRequest:[n]}).then((({data:t})=>t));function n(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){if(!t){const t="打印命令返回空数据";return this._handleMonitorNotify(""),null==e||e({type:"printError",message:t,result:!1,errinfo:t}),!1}if("success"!==t.result){const i=t.message||t.Message;this._handleMonitorNotify(i);const n={type:"printError",message:i,result:t.result,errinfo:t.errinfo};return null==e||e(n),!1}return t}_handleResultTest(t,e){return!!t||(console.log("notInstalledApp"),null==e||e({type:"notInstalledApp",message:"请打开打印服务器插件"}),!1)}async _handleEventQueryPrintData(t,e,i,n){const s={templateId:t,formatId:e,params:i,cmdid:"7"},r=await this._queryServicesPrint(s);return this._handleQueryPrintDataResult(r,e,n)}_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,cmdid:n,print:s,printdlgshow:r="0",nobillnode:a="1",btnprint:o="1"}){const d={templateId:t,formatId:e,params:i,cmdid:n,nobillnode:a,printdlgshow:r,btnprint:o};if(s){try{s=JSON.parse(s)}catch(t){}d.print=s}else if(this.isRemote){const t=l(new Date,"yyyyMMddHHmmss");d.print={print:"1",type:"1",zip:"0",filename:`F:\\WorkSpace\\crmweb\\web\\${t}\\${t}`}}return await this._queryServicesPrint(d)}async _handleEventEditFormat({templateId:t,formatId:e="",params:i="",token:n}){const s={};let r={};try{r=Object.assign({},s,JSON.parse(i))}catch(t){r=s}const a={templateId:t,formatId:e,cmdid:"9",token:n,params:JSON.stringify(r)};return await this._queryServicesPrint(a)}async _queryProxyOrigin(){if(this.isRemote)return;const{data:t}=await d({method:"get",url:u})||{},{map:e={}}=t;e.isRemote&&(this.printOrigin=h+"/printService",this.isRemote=!0)}async _queryPrintFile(t,e=""){const{data:i}=await d({method:"post",url:c,responseType:"blob",params:{formatId:t.split("_")[1],params:e}})||{};return i}async _browserPrint(t,e){if(this.isRemote){const{filedir:i}=t,n=JSON.parse(i)[0].replace(/\\/g,"/").split("/"),a=n[n.length-2],o=n[n.length-1],l=await s(`${m}/${a}/${o}`),d=r(null,e,l);if("preview"===e)return d}}async preview({templateId:t,formatId:e,params:i="",btnprint:n},s,l){if(a(e)){const t=await this._queryPrintFile(e,i);if(!t)return null==l?void 0:l("获取文件失败!");const n=r(t,"preview");return this.instance||(this.instance=o()),this.showPreview(this.instance,n),void(null==s||s({file:t}))}await this._queryProxyOrigin();const d=await this._testConnection();if(!this._handleResultTest(d,l))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:this.isRemote?"7":"8",btnprint:n}),a=this._handleResult(r,l);if(!a)return!1;if(this.isRemote){const t=await this._browserPrint(a,"preview");this.instance||(this.instance=o()),this.showPreview(this.instance,t)}null==s||s(a)}catch(t){const e="预览失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==l||l(i),this._handleMonitorNotify(i)}}async printDirect({templateId:t,formatId:e,params:i="",print:n,printdlgshow:s,nobillnode:o,isDownloadFile:l=!0},d,h,c="printDirect"){if(a(e)){const t=await this._queryPrintFile(e,i);return t?(r(t,c),void(null==d||d({file:t}))):null==h?void 0:h("获取文件失败!")}await this._queryProxyOrigin();const u=await this._testConnection();if(!this._handleResultTest(u,h))return!1;try{const r=await this._handleEventDirect({templateId:t,formatId:e,params:i,cmdid:"7",print:n,printdlgshow:s,nobillnode:o}),a=this._handleResult(r,h);if(!a)return!1;l&&["downloadPDF"].includes(c)&&await this._browserPrint(a,c),null==d||d(a)}catch(t){const e="printDirect"===c?"打印失败":"下载失败",i="timeout"===(null==t?void 0:t.type)?{...t,message:e}:{message:e};null==h||h(i),this._handleMonitorNotify(i)}}_downloadPDF(t){return this.webview?this.postMessage({exec:"pdf",data:{file:t}}):d.get(this.printOrigin+"/download",{params:{inputData:t}}).then((({data:t})=>t))}downloadPDF(t,i,n){if(this.webview&&this.downloadPath&&(Reflect.has(t,"print")||Reflect.set(t,"print",{print:"1",type:"1"}),!t.print.filename)){let e=l(new Date,"yyyyMMddHHmmss");t.customFileName&&(e=`${e}${t.customFileName}`),t.print.filename=`${this.downloadPath}/${e}`.replace(/\\/g,"/")}this.printDirect(t,(async s=>{if(s||n(null),a(t.formatId))return i(s);const r=this,o=await async function(t){const i=[],n=JSON.parse(t);if(!e(n))return await r._downloadPDF("");if(1===n.length)return await r._downloadPDF(n[0]||"");for(let t=0,e=n.length;t<e;t++)i.push(await r._downloadPDF(n[t]||""));return i}(s.filedir);i(o,s)}),(t=>n(t)),"downloadPDF")}async print({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this.queryPrintData({templateId:t,formatId:e,params:i},void 0,s);if(!a)return!1;const o=this.printFileData({formatId:e,file:a.file,printerName:a.printerName},void 0,s);if(!o)return!1;n&&n(o)}async queryPrintData({templateId:t,formatId:e,params:i=""},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventQueryPrintData(t,e,i,s);return!!a&&(n&&n(a),a)}async printFileData({formatId:t,file:e,printerName:i="Default"},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._callPrintWithFile({formatId:t,printname:i,file:e}),o=this._handleResult(a,s);return!!o&&(n&&n(o),o)}async editPrintFormat({templateId:t,formatId:e,params:i,token:n},s,r){const a=await this._testConnection();if(!this._handleResultTest(a,r))return!1;const o=await this._handleEventEditFormat({templateId:t,formatId:e,params:i,token:n}),l=this._handleResult(o,r);if(!l)return!1;s&&s(l)}async addPrintFormat({templateId:t,params:e,token:i},n,s){const r=await this._testConnection();if(!this._handleResultTest(r,s))return!1;const a=await this._handleEventEditFormat({templateId:t,params:e,token:i}),o=this._handleResult(a,s);if(!o)return!1;n&&n(o)}}export{w as Print};
|
|
@@ -54,13 +54,8 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
54
54
|
default: boolean;
|
|
55
55
|
};
|
|
56
56
|
searchFilter: {
|
|
57
|
-
type:
|
|
58
|
-
default: () => {
|
|
59
|
-
isOpen: boolean;
|
|
60
|
-
multiple: boolean;
|
|
61
|
-
customTitles: string[];
|
|
62
|
-
itemHeight: number;
|
|
63
|
-
};
|
|
57
|
+
type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
|
|
58
|
+
default: () => {};
|
|
64
59
|
};
|
|
65
60
|
treeSetting: {
|
|
66
61
|
type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
|
|
@@ -77,6 +72,12 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
77
72
|
default: () => Promise<never[]>;
|
|
78
73
|
};
|
|
79
74
|
}, {
|
|
75
|
+
searchFilterBase: {
|
|
76
|
+
isOpen: boolean;
|
|
77
|
+
multiple: boolean;
|
|
78
|
+
customTitles: string[];
|
|
79
|
+
itemHeight: number;
|
|
80
|
+
};
|
|
80
81
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
81
82
|
defaultList: {
|
|
82
83
|
type: import("vue").PropType<((string | number) | {
|
|
@@ -132,13 +133,8 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
132
133
|
default: boolean;
|
|
133
134
|
};
|
|
134
135
|
searchFilter: {
|
|
135
|
-
type:
|
|
136
|
-
default: () => {
|
|
137
|
-
isOpen: boolean;
|
|
138
|
-
multiple: boolean;
|
|
139
|
-
customTitles: string[];
|
|
140
|
-
itemHeight: number;
|
|
141
|
-
};
|
|
136
|
+
type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
|
|
137
|
+
default: () => {};
|
|
142
138
|
};
|
|
143
139
|
treeSetting: {
|
|
144
140
|
type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
|
|
@@ -189,7 +185,13 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
189
185
|
allCheckedKeys: (string | number)[];
|
|
190
186
|
isRemote: import("vue").ComputedRef<boolean>;
|
|
191
187
|
checkStrategyResult: import("vue").ComputedRef<any>;
|
|
192
|
-
|
|
188
|
+
mergeSearchFilter: import("vue").ComputedRef<{
|
|
189
|
+
isOpen: boolean;
|
|
190
|
+
multiple: boolean;
|
|
191
|
+
customTitles: string[];
|
|
192
|
+
itemHeight: number;
|
|
193
|
+
}>;
|
|
194
|
+
isSearchFilter: import("vue").ComputedRef<boolean>;
|
|
193
195
|
caculateTagData: import("vue").ComputedRef<any[]>;
|
|
194
196
|
init: () => void;
|
|
195
197
|
getallCheckedKeysWithChild: (item: import("naive-ui").TreeOption) => void;
|
|
@@ -624,13 +626,8 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
624
626
|
default: boolean;
|
|
625
627
|
};
|
|
626
628
|
searchFilter: {
|
|
627
|
-
type:
|
|
628
|
-
default: () => {
|
|
629
|
-
isOpen: boolean;
|
|
630
|
-
multiple: boolean;
|
|
631
|
-
customTitles: string[];
|
|
632
|
-
itemHeight: number;
|
|
633
|
-
};
|
|
629
|
+
type: import("vue").PropType<import("../../../es/shared/types").AnyObject>;
|
|
630
|
+
default: () => {};
|
|
634
631
|
};
|
|
635
632
|
treeSetting: {
|
|
636
633
|
type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
|
|
@@ -673,7 +670,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
673
670
|
showClear: boolean;
|
|
674
671
|
multiple: boolean;
|
|
675
672
|
searchInner: boolean;
|
|
676
|
-
searchFilter:
|
|
673
|
+
searchFilter: import("../../../es/shared/types").AnyObject;
|
|
677
674
|
treeSetting: import("naive-ui/es/tree/src/interface").TreeOptionBase & {
|
|
678
675
|
[k: string]: unknown;
|
|
679
676
|
} & import("../../../es/shared/types").AnyObject;
|
|
@@ -59,13 +59,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
59
59
|
default: boolean;
|
|
60
60
|
};
|
|
61
61
|
searchFilter: {
|
|
62
|
-
type:
|
|
63
|
-
default: () => {
|
|
64
|
-
isOpen: boolean;
|
|
65
|
-
multiple: boolean;
|
|
66
|
-
customTitles: string[];
|
|
67
|
-
itemHeight: number;
|
|
68
|
-
};
|
|
62
|
+
type: PropType<AnyObject>;
|
|
63
|
+
default: () => {};
|
|
69
64
|
};
|
|
70
65
|
treeSetting: {
|
|
71
66
|
type: PropType<ITreeOption>;
|
|
@@ -80,6 +75,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
80
75
|
default: () => Promise<never[]>;
|
|
81
76
|
};
|
|
82
77
|
}, {
|
|
78
|
+
searchFilterBase: {
|
|
79
|
+
isOpen: boolean;
|
|
80
|
+
multiple: boolean;
|
|
81
|
+
customTitles: string[];
|
|
82
|
+
itemHeight: number;
|
|
83
|
+
};
|
|
83
84
|
props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
84
85
|
defaultList: {
|
|
85
86
|
type: PropType<(IKey | ITag)[]>;
|
|
@@ -122,13 +123,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
122
123
|
default: boolean;
|
|
123
124
|
};
|
|
124
125
|
searchFilter: {
|
|
125
|
-
type:
|
|
126
|
-
default: () => {
|
|
127
|
-
isOpen: boolean;
|
|
128
|
-
multiple: boolean;
|
|
129
|
-
customTitles: string[];
|
|
130
|
-
itemHeight: number;
|
|
131
|
-
};
|
|
126
|
+
type: PropType<AnyObject>;
|
|
127
|
+
default: () => {};
|
|
132
128
|
};
|
|
133
129
|
treeSetting: {
|
|
134
130
|
type: PropType<ITreeOption>;
|
|
@@ -177,7 +173,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
177
173
|
allCheckedKeys: IKey[];
|
|
178
174
|
isRemote: import("vue").ComputedRef<boolean>;
|
|
179
175
|
checkStrategyResult: import("vue").ComputedRef<any>;
|
|
180
|
-
|
|
176
|
+
mergeSearchFilter: import("vue").ComputedRef<{
|
|
177
|
+
isOpen: boolean;
|
|
178
|
+
multiple: boolean;
|
|
179
|
+
customTitles: string[];
|
|
180
|
+
itemHeight: number;
|
|
181
|
+
}>;
|
|
182
|
+
isSearchFilter: import("vue").ComputedRef<boolean>;
|
|
181
183
|
caculateTagData: import("vue").ComputedRef<any[]>;
|
|
182
184
|
init: () => void;
|
|
183
185
|
getallCheckedKeysWithChild: (item: TreeOption) => void;
|
|
@@ -587,13 +589,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
587
589
|
default: boolean;
|
|
588
590
|
};
|
|
589
591
|
searchFilter: {
|
|
590
|
-
type:
|
|
591
|
-
default: () => {
|
|
592
|
-
isOpen: boolean;
|
|
593
|
-
multiple: boolean;
|
|
594
|
-
customTitles: string[];
|
|
595
|
-
itemHeight: number;
|
|
596
|
-
};
|
|
592
|
+
type: PropType<AnyObject>;
|
|
593
|
+
default: () => {};
|
|
597
594
|
};
|
|
598
595
|
treeSetting: {
|
|
599
596
|
type: PropType<ITreeOption>;
|
|
@@ -621,7 +618,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
621
618
|
showClear: boolean;
|
|
622
619
|
multiple: boolean;
|
|
623
620
|
searchInner: boolean;
|
|
624
|
-
searchFilter:
|
|
621
|
+
searchFilter: AnyObject;
|
|
625
622
|
treeSetting: ITreeOption;
|
|
626
623
|
queryLoadChildData: (node: TreeOption) => Promise<AnyObject>;
|
|
627
624
|
queryTreeSearch: (keyWork: string) => Promise<Array<AnyObject>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as e,ref as l,computed as t,watch as n,openBlock as a,createBlock as u,unref as i,withCtx as r,createVNode as c,createCommentVNode as o,withKeys as s,createTextVNode as d,toDisplayString as h,withDirectives as v,vShow as p,createElementBlock as f,Fragment as y,mergeProps as k,createElementVNode as m,renderList as g}from"vue";import{NGrid as b,NGi as _,NSpace as C,NInputGroup as w,NInput as L,NIcon as S,NButton as x,NCheckbox as j,NTree as T,NTooltip as N}from"naive-ui";import{CloseCircleSharp as I}from"@vicons/ionicons5";import{searchFilterTree as O,getExpandedKeys as D}from"./utils/index.js";import{cloneDeep as F}from"lodash-es";import{SearchTypeConfig as $}from"./types/enums.js";import E from"./SearchMultiple.vue.js";import K from"./SearchOrgAndStaff.vue.js";const q={key:0},A={class:"c-select-person__scroll",style:{height:"342px"}};var B=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({
|
|
1
|
+
import{defineComponent as e,ref as l,computed as t,watch as n,openBlock as a,createBlock as u,unref as i,withCtx as r,createVNode as c,createCommentVNode as o,withKeys as s,createTextVNode as d,toDisplayString as h,withDirectives as v,vShow as p,createElementBlock as f,Fragment as y,mergeProps as k,createElementVNode as m,renderList as g}from"vue";import{NGrid as b,NGi as _,NSpace as C,NInputGroup as w,NInput as L,NIcon as S,NButton as x,NCheckbox as j,NTree as T,NTooltip as N}from"naive-ui";import{CloseCircleSharp as I}from"@vicons/ionicons5";import{searchFilterTree as O,getExpandedKeys as D}from"./utils/index.js";import{cloneDeep as F}from"lodash-es";import{SearchTypeConfig as $}from"./types/enums.js";import E from"./SearchMultiple.vue.js";import K from"./SearchOrgAndStaff.vue.js";const q={key:0},A={class:"c-select-person__scroll",style:{height:"342px"}};var B=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({})},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])}},emits:["check","checkWithLevel"],setup(e,{expose:B,emit:P}){const R=e,U={isOpen:!1,multiple:!1,customTitles:["联系人","部门"],itemHeight:250},H=l(""),W=l(!1),G=l([]),z=l([]),M=l([]),J=l([]),Q=l([]),V=l(!1),X=F(function e(l){return l.forEach((l=>{var t;if(null==(t=l.children)?void 0:t.length){const t=se(l.children,[]);l.innerItemsNum=t.length,l.innerLeafs=t,e(l.children)}})),de(l,"")}(R.data));let Y=[];const Z=t((()=>!!R.queryLoadChildData)),ee=t((()=>{var e,l;return null!=(l=null==(e=null==R?void 0:R.treeSetting)?void 0:e.checkStrategy)?l:"child"})),le=t((()=>{var e;return(null==(e=null==R?void 0:R.searchFilter)?void 0:e.isOpen)?{...F(U),...R.searchFilter}:F(U)})),te=t((()=>le.value.isOpen)),ne=t((()=>{let e=[];return G.value.forEach((l=>{for(let t=0;t<J.value.length;t++){const n=J.value[t];if(n.key==l){e.push(n);break}}})),e}));function ae(e){e.disabled||e.children||!e.key||Y.push(e.key)}function ue(e){e.disabled||e.tempTitle||!e.key||Y.push(e.key)}async function ie(e){if(R.queryLoadChildData){const l=await R.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function re(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function ce({option:e}){var l;if((null==(l=e.children)?void 0:l.length)||Z.value&&!(null==e?void 0:e.isLeaf)){const l=R.wordbook.user_count_obj&&e[R.wordbook.user_count_obj]||"",t=l?`(${l})`:"";return c("span",null,[`${e.title}${t}`])}return c(N,{trigger:"hover"},{default:()=>c("span",null,[e.title]),trigger:()=>c("span",null,[e.title])})}function oe(e){return e[R.wordbookChild.user_name_obj]||e[R.wordbook.parent_name_obj]||e.orgName||e.title||""}function se(e,l){return e.forEach((e=>{var t;(null==(t=e.children)?void 0:t.length)?se(e.children,l):!e.disabled&&l.push(e)})),l}function de(e,l){return e&&0!==e.length?e.map((e=>{var t;const n=oe(e),a=l?`${n}/${l}`:n;return{...e,tempTitle:l,children:(null==(t=e.children)?void 0:t.length)?de(null==e?void 0:e.children,a):[]}})):[]}async function he(){if(V.value=!!H.value.trim(),Z.value)M.value=await R.queryTreeSearch(H.value);else{const e=function(){const e={[$.SEARCH_ORG_STAFF]:te.value,[$.SEARCH_ORG]:R.searchInner},l=Object.keys(e).find((l=>e[l]));return null!=l?l:""}();M.value=O(e,X,H.value)}z.value=M.value.length&&H.value?D(M.value):[]}function ve(e,l){var t,n;switch(null!=(n=null==(t=null==R?void 0:R.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&(!n.children||n.isLeaf)&&(l&&!G.value.includes(n.key)&&G.value.push(n.key),!l)){const e=G.value.findIndex((e=>e===n.key));G.value.splice(e,1)}n.children&&ve(n.children,l)}}(e,l);break;case"parent":!function(e,l){G.value=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&!n.tempTitle&&(l&&!G.value.includes(n.key)&&G.value.push(n.key),!l)){const e=G.value.findIndex((e=>e===n.key));G.value.splice(e,1)}}}(e,l)}}function pe(e){ve(M.value,e)}function fe(e){var l;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=Q.value.map((e=>e.key));G.value.includes(n.key)&&!a.includes(n.key)&&J.value.push({key:n.key,name:n.title,parentName:n.tempTitle,innerItemsNum:n.innerItemsNum,innerLeafs:n.innerLeafs}),(null==(l=n.children)?void 0:l.length)&&fe(n.children)}}function ye(e){G.value=e}function ke(){G.value=[]}function me(e){G.value=e}function ge(){H.value="",setTimeout((()=>{he()}))}return function e(l,t){var n,a,u,i;for(let r=0,c=l.length;r<c;r++){const c=l[r];switch(c.title=oe(c),c.label=oe(c),c.parentNode=t,c.key||(c.key=c[R.wordbookChild.user_id_obj]||c[R.wordbook.parent_id_obj]||Date.now()),(null==(n=c.children)?void 0:n.length)?(e(c.children,c),re(c)):0===(null==(a=c.children)?void 0:a.length)&&Reflect.deleteProperty(c,"children"),null!=(i=null==(u=null==R?void 0:R.treeSetting)?void 0:u.checkStrategy)?i:"child"){case"child":ae(c);break;case"parent":ue(c)}}}(X,null),M.value=X,R.defaultList.length>0&&(Z.value?(R.defaultList.forEach((e=>G.value.push(e.key))),J.value=F(R.defaultList),Q.value=F(R.defaultList)):(R.defaultList.forEach((e=>G.value.push(e))),fe(X))),n((()=>G),(e=>{J.value=Q.value.filter((l=>e.value.includes(l.key))),e.value.length&&fe(Z.value?M.value:X),W.value=Y.every((e=>J.value.findIndex((l=>l.key===e))>-1));const l=J.value.filter((l=>e.value.includes(l.key)));P("check",e.value),P("checkWithLevel",l)}),{deep:!0}),n((()=>H.value),(e=>{e||ge()})),B({getCheckWithLevel:function(){const e=G.value,l=J.value.filter((l=>e.includes(l.key)));return null!=l?l:[]}}),(l,t)=>(a(),u(i(b),{cols:2,class:"c-select-person"},{default:r((()=>[c(i(_),null,{default:r((()=>[c(i(C),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:r((()=>[c(i(w),{style:{"margin-bottom":"12px"}},{default:r((()=>[o(" clearable "),c(i(L),{class:"search-input",value:H.value,"onUpdate:value":t[0]||(t[0]=e=>H.value=e),placeholder:e.searchPlaceholder,onKeyup:s(he,["enter"])},{suffix:r((()=>[H.value?(a(),u(i(S),{key:0,class:"search-clear",component:i(I),size:"16",onClick:ge},null,8,["component"])):o("v-if",!0)])),_:1},8,["value","placeholder","onKeyup"]),c(i(x),{type:"primary",onClick:he},{default:r((()=>[d(h(e.searchButtonText),1)])),_:1})])),_:1}),e.multiple&&!V.value?v((a(),u(i(j),{key:0,checked:W.value,"onUpdate:checked":[t[1]||(t[1]=e=>W.value=e),pe]},{default:r((()=>[d(" 全选 ")])),_:1},8,["checked"])),[[p,i(Y).length<1e3]]):o("v-if",!0),o(" 支持选人 "),e.searchInner&&e.multiple&&V.value&&"parent"===i(ee)?(a(),u(E,{key:1,treeData:M.value,checkedKeys:G.value,onNotifyCheck:me},null,8,["treeData","checkedKeys"])):i(te)&&e.multiple&&V.value&&"parent"===i(ee)?(a(),f(y,{key:2},[o(" 同时兼容选人和选部门 "),c(K,{treeData:M.value,checkedKeys:G.value,searchFilter:i(le),onNotifyCheck:me,onNotifyClear:ge},null,8,["treeData","checkedKeys","searchFilter"])],2112)):(a(),u(i(T),k({key:3,"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":G.value,"expanded-keys":z.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>z.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":G.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>G.value=e),data:M.value,"check-strategy":"child","render-label":ce},e.treeSetting,{"onUpdate:checkedKeys":ye,onLoad:ie}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"]))])),_:1})])),_:1}),c(i(_),null,{default:r((()=>[c(i(C),{vertical:"",style:{"padding-left":"12px"}},{default:r((()=>[c(i(C),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:r((()=>[e.showCount?(a(),f("span",q,"已选择:"+h(i(ne).length),1)):o("v-if",!0),e.showClear?(a(),f("span",{key:1,class:"c-select-person__clear-btn",onClick:ke},"清空")):o("v-if",!0)])),_:1}),m("div",A,[(a(!0),f(y,null,g(i(ne),(e=>(a(),f("span",{class:"c-select-person__tag-item",key:e.key},[d(h(e.name)+" "+h(e.parentName?`(${e.parentName})`:"")+" "+h(e.innerItemsNum?`(${e.innerItemsNum}人)`:"")+" ",1),c(i(S),{class:"tag-close",component:i(I),onClick:l=>function(e){G.value=G.value.filter((l=>l!==e.key))}(e)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.46-beta.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.46-beta.33",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.1.46-beta.33",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.1.46-beta.
|
|
3
|
+
"version": "3.1.46-beta.33",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"iOS 7",
|
|
62
62
|
"last 3 iOS versions"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "cadd8bf8d96a6876b9edc60e8a91610b7ad56666"
|
|
65
65
|
}
|