cnhis-design-vue 3.2.15-beta.16 → 3.2.15-beta.17
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.
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as t,useAttrs as e,inject as n,ref as a,reactive as i,computed as r,onMounted as o,watch as l,openBlock as s,createElementBlock as d,Fragment as u,createVNode as p,unref as m,withCtx as c,renderSlot as f,withModifiers as v,createTextVNode as g,toDisplayString as y,mergeProps as w}from"vue";import{isObject as b}from"@vue/shared";import{useMessage as I,NDropdown as h,NButton as P,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as x}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import L from"./IdentityVerification.vue.js";import{format as E}from"date-fns";import{savePrivateFormatApi as M,getPrivateFormatApi as j}from"../api.js";import{cloneDeep as C}from"lodash";var O,D,R,B,N,V,U=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:(null==(O=window.getLanguageByCode)?void 0:O.call(window,"10010.1.478"))||"打印",type:String},printText:{default:(null==(D=window.getLanguageByCode)?void 0:D.call(window,"10010.1.479"))||"直接打印",type:String},previewText:{default:(null==(R=window.getLanguageByCode)?void 0:R.call(window,"10010.1.480"))||"打印预览",type:String},pdfLoadText:{default:(null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.481"))||"下载pdf",type:String},formatEditText:{default:(null==(N=window.getLanguageByCode)?void 0:N.call(window,"10010.1.482"))||"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:(null==(V=window.getLanguageByCode)?void 0:V.call(window,"10010.1.483"))||"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number},resolution:{type:Number},printCustomProps:{type:Object,default:()=>({})},placement:{type:String},svrUpdateIp:{type:String}},setup(t,{expose:O}){var D;const R=t,B=e(),N=I();let V;const U=String(navigator.platform).toLowerCase().includes("linux"),z=n(x),A={},J=a(""),q=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,iReportExecuteMode:1});let K=a([{label:R.printText,key:"printText"},{label:R.previewText,key:"previewText"},{label:R.pdfLoadText,key:"downloadPdf"},{label:R.formatEditText,key:"formatEditText"},...(null==(D=R.externalOptionConfig)?void 0:D.options)||[]]);const _=a([]),G=r((()=>{if(!q.currentFormatId)return{};let t=q.currentFormatId;return q.formatList.find((e=>e.id===t))})),H=r((()=>{var t,e;return(null==(t=G.value)?void 0:t.name)||(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.485"))||"格式选择"})),Y=r((()=>{let t=q.formatList.find((t=>t.id===q.currentFormatId));return null==t?void 0:t.templateId})),$=async t=>{if(R.directPrint){if(q.spinning)return;return"button"===t?void await ft():pt()}return pt()},Q=t=>p("span",{class:{active:t.key===q.currentFormatId}},[t.label]),W=(t,e)=>{q.spinning=!1;let n={type:e,formatId:q.currentFormatId,templateId:Y.value};z("success",t,n)},X=t=>{q.spinning=!1,z("error",t),b(t)&&"notInstalledApp"===t.type&&N.error(t.message)},Z=t=>{q.spinning=!1,z("cancel",t)},tt=t=>{var e;const n={message:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.486"))||"前置条件执行错误",type:t,preExecution:!0};z("error",n)},et=(t=0)=>{var e;const n=(null==(e=R.printParams)?void 0:e.length)?R.printParams[t]:q.printParams[t];return JSON.stringify({...n||{},...R.token?{token:R.token}:{},...R.printCustomProps||{}})},nt=()=>{var t,e;let n={},a={};if(null==(t=q.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(q.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(q.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(q.printParams[0]).forEach((t=>{a[t]=[],q.printParams.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return n=Object.assign({},JSON.parse(et(0)),a),JSON.stringify(n)},at=((t,e,n=!0)=>{let a=null;return function(...i){a&&clearTimeout(a),n&&!a&&t.apply(null,i),a=setTimeout((()=>{a=null,!n&&t.apply(null,i)}),e)}})((()=>{let t=q.printParams.length;const e=async e=>{try{--t<=0&&W(e,"print")}catch(t){console.log("error",t)}};R.showLoading&&q.spinning||(q.spinning=!0,R.prevFn("print",{formatId:q.currentFormatId,templateId:Y.value}).then((()=>{const t={iReportExecuteMode:q.iReportExecuteMode,formatId:q.currentFormatId,templateId:Y.value,authorizationKey:J.value,printdlgshow:R.printdlgshow,signature:R.signature,copies:R.printCopies,svrUpdateIp:R.svrUpdateIp};if("MULTI"===R.strategy)for(let n=0;n<q.printParams.length;n++)n>0&&(t.printdlgshow="0"),V.printDirect({...t,params:et(n)},e,X,Z);else V.printDirect({...t,params:nt()},(t=>{W(t,"print")}),X,Z)})).catch((()=>{tt("print"),q.spinning=!1})).finally((()=>{q.visible=!1})))}),800,!0),it=async(t,e)=>{var n,a;switch(t){case"printText":at();break;case"previewText":(async()=>{R.showLoading&&q.spinning||(q.spinning=!0,R.prevFn("preview",{formatId:q.currentFormatId,templateId:Y.value}).then((()=>{const t="MULTI"===R.strategy?et():nt(),e={formatId:q.currentFormatId,iReportExecuteMode:q.iReportExecuteMode,templateId:Y.value,authorizationKey:J.value,params:t,btnprint:R.btnprint,signature:R.signature};V.preview(e,(t=>{W(t,"preview")}),X)})).catch((()=>{tt("preview"),q.spinning=!1})).finally((()=>{q.visible=!1})))})();break;case"formatEditText":R.showLoading&&q.spinning||(q.spinning=!0,R.prevFn("edit",{formatId:q.currentFormatId,templateId:Y.value}).then((()=>{q.identityVerification.visible=!0})).catch((()=>{tt("edit")})).finally((()=>{q.visible=!1,q.spinning=!1})));break;case"downloadPdf":(async()=>{R.showLoading&&q.spinning||(q.spinning=!0,R.prevFn("download",{formatId:q.currentFormatId,templateId:Y.value}).then((()=>{const t="MULTI"===R.strategy?et():nt(),e={formatId:q.currentFormatId,iReportExecuteMode:q.iReportExecuteMode,templateId:Y.value,authorizationKey:J.value,print:{print:"1",type:"1",resolution:null==R?void 0:R.resolution},params:t,signature:R.signature};V.downloadPDF(e,(t=>W(t,"preview")),X)})).catch((()=>{tt("download"),q.spinning=!1})).finally((()=>{q.visible=!1})))})();break;default:{q.visible=!1;const i=q.formatList.find((e=>e.id===t))||{};if(Object.keys(i).length>0){S(t)&&(U||2==q.iReportExecuteMode)?K.value=_.value.filter((t=>"formatEditText"!=t.key)):K.value=_.value,q.currentFormatId=t;const[e]=K.value;e.label=(null==i?void 0:i.name)||e.label,await M({formatForms:[{...i}],name:A.name||i.templateName,number:A.number||i.number,templateId:A.templateId||i.templateId,...A.id?{id:A.id}:{}},{token:R.token})}else null==(a=null==(n=R.externalOptionConfig)?void 0:n.onSelect)||a.call(n,t,e,{formatId:q.currentFormatId});break}}},rt=()=>{q.visible=!1,z("clickoutside")},ot=()=>(q.isInited=!1,q.spinning=!1,setTimeout((()=>{q.visible=!1}),0),!1),lt=(t,e,n)=>{const a={};return e.forEach((e=>{let i=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let a=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(a=E(e,n[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[n]]);t[e[n]]&&i&&(a[e[n]]=i)})),a},st=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(lt(n,e,"fieldName"))}})),a=Object.assign({},a,lt(n,e,"key")),a})),dt=async t=>{var e,n;if(q.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],q.iReportExecuteMode=(null==(e=null==t?void 0:t.obj)?void 0:e.length)>0&&t.obj[0].iReportExecuteMode||1,q.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!B.isDoc){const{data:e}=await j({templateId:t[0].templateId},{token:R.token});if("SUCCESS"===e.result){const{formatForms:a=[]}=e.map||{};Object.assign(A,e.map||{});const i=null==(n=null==a?void 0:a[0])?void 0:n.id;if(i&&t.map((t=>t.id)).includes(i))return i}}const a=t.find((t=>1==t[e]));return(null==a?void 0:a.id)||t[0].id})(q.formatList,"defaultFlag"),!q.currentFormatId)return K.value=[],N.error(R.noDefaultFormatMsg),ot();(()=>{var t;const e=q.formatList.map((t=>({label:t.name,key:t.id})));K.value.unshift({label:H.value,key:"format",children:e}),R.hideButtons.length>0&&(K.value=K.value.filter((t=>!R.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),a=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},i=Object.keys(a);i.includes("RY7.2.21.1.M2.G94181E")||(K.value=K.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(K.value=K.value.filter((t=>"formatEditText"!=t.key)))}_.value=C(K.value),S(q.currentFormatId)&&(K.value=_.value.filter((t=>"formatEditText"!=t.key)))})();let a=null==(n=await R.queryTemplateParams())?void 0:n.obj;if(!a||!Y.value)return N.error("获取打印模板失败,请联系管理员!"),ot();q.templateParams=a,q.printParams=st(q.templateParams,R.params)},ut=async()=>{var t;if(q.isInited)return!0;q.isInited=!0,q.spinning=!0,(()=>{if(V)return!1;V=new T})();const e=await R.queryPrintFormatByNumber();return await dt(e),(null==(t=e.obj)?void 0:t.length)>0&&(J.value=e.obj[0].authorizationKey||""),q.spinning=!1,!0},pt=async(t=!0)=>{var e,n;if(await R.clickPrevFn())if((null==(e=R.params)?void 0:e.length)||(null==(n=R.printParams)?void 0:n.length)){if(!q.visible){if(!await ut())return!1}t&&(q.visible=!q.visible)}else N.warning(R.noDataMsg)},mt=()=>{q.watchPrintParamsReformatFn&&q.watchPrintParamsReformatFn(),q.isInited?q.printParams=st(q.templateParams,R.params):q.watchPrintParamsReformatFn=()=>l((()=>q.isInited),(t=>{if(!t)return!1;mt()}))},ct=t=>{if(q.identityVerification.visible=!1,S(q.currentFormatId))return W(null,"edit");const e={formatId:q.currentFormatId,templateId:Y.value,params:et(),token:t};V.editPrintFormat(e,(t=>{W(t,"edit")}),X)};async function ft(){await pt(!1),at()}return o((()=>{q.isInited=!1})),l((()=>R.params),(t=>{if(!(null==t?void 0:t.length))return!1;mt()}),{deep:!0}),O({directPrint:ft}),(e,n)=>(s(),d(u,null,[p(m(h),{class:"c-dropdown",placement:t.placement,trigger:"click",show:q.visible,onClickoutside:rt,options:m(K),onSelect:it,"render-label":Q},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:pt,printSpinning:q.spinning,printbtnText:t.btnText,printVisible:q.visible},(()=>[p(m(P),{class:"dropdown-button",loading:t.showLoading&&q.spinning,onClick:n[1]||(n[1]=v((()=>$("button")),["stop"]))},{default:c((()=>[g(y(t.btnText)+" ",1),p(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=v((()=>$("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),p(L,w(m(B),{modelValue:q.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>q.identityVerification.visible=t),formatId:q.currentFormatId,templateId:m(Y),onSuccess:ct}),null,16,["modelValue","formatId","templateId"])],64))}});export{U as default};
|
1
|
+
import{defineComponent as t,useAttrs as e,inject as n,ref as a,reactive as i,computed as r,onMounted as o,watch as l,openBlock as s,createElementBlock as d,Fragment as u,createVNode as p,unref as m,withCtx as c,renderSlot as f,withModifiers as v,createTextVNode as g,toDisplayString as y,mergeProps as w}from"vue";import{isObject as b}from"@vue/shared";import{useMessage as I,NDropdown as h,NButton as P,NIcon as F}from"naive-ui";import{ChevronDown as k}from"@vicons/ionicons5";import{InjectionButtonPrintEmits as x}from"../constants/index.js";import{Print as T}from"../utils/print.js";import{isIReport as S}from"../utils/browserPrint.js";import L from"./IdentityVerification.vue.js";import{format as E}from"date-fns";import{savePrivateFormatApi as j,getPrivateFormatApi as M}from"../api.js";import{cloneDeep as C}from"lodash";var O,D,R,B,N,V,U=t({__name:"OldPrintComponent",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:(null==(O=window.getLanguageByCode)?void 0:O.call(window,"10010.1.478"))||"打印",type:String},printText:{default:(null==(D=window.getLanguageByCode)?void 0:D.call(window,"10010.1.479"))||"直接打印",type:String},previewText:{default:(null==(R=window.getLanguageByCode)?void 0:R.call(window,"10010.1.480"))||"打印预览",type:String},pdfLoadText:{default:(null==(B=window.getLanguageByCode)?void 0:B.call(window,"10010.1.481"))||"下载pdf",type:String},formatEditText:{default:(null==(N=window.getLanguageByCode)?void 0:N.call(window,"10010.1.482"))||"格式编辑",type:String},prevFn:{default:()=>Promise.resolve(),type:Function},queryPrintFormatByNumber:{default:()=>Promise.resolve({}),type:Function},queryTemplateParams:{default:()=>Promise.resolve({}),type:Function},strategy:{default:"MULTI",type:String},clickPrevFn:{default:()=>Promise.resolve(!0),type:Function},noDataMsg:{default:(null==(V=window.getLanguageByCode)?void 0:V.call(window,"10010.1.483"))||"请选中需要打印的数据",type:String},noDefaultFormatMsg:{default:"获取打印格式失败,请联系管理员!",type:String},token:{type:String},printdlgshow:{default:"0",type:String},btnprint:{type:String,default:"1"},directPrint:{type:Boolean,default:!1},externalOptionConfig:{type:Object,default:()=>({})},signature:{type:String},showLoading:{type:Boolean,default:!0},hideButtons:{type:Array,default:()=>[]},printCopies:{type:Number},resolution:{type:Number},printCustomProps:{type:Object,default:()=>({})},placement:{type:String},svrUpdateIp:{type:String}},setup(t,{expose:O}){var D;const R=t,B=e(),N=I();let V;String(navigator.platform).toLowerCase().includes("linux");const U=n(x),z={},A=a(""),J=i({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null,iReportExecuteMode:1});let q=a([{label:R.printText,key:"printText"},{label:R.previewText,key:"previewText"},{label:R.pdfLoadText,key:"downloadPdf"},{label:R.formatEditText,key:"formatEditText"},...(null==(D=R.externalOptionConfig)?void 0:D.options)||[]]);const K=a([]),_=r((()=>{if(!J.currentFormatId)return{};let t=J.currentFormatId;return J.formatList.find((e=>e.id===t))})),G=r((()=>{var t,e;return(null==(t=_.value)?void 0:t.name)||(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.485"))||"格式选择"})),H=r((()=>{let t=J.formatList.find((t=>t.id===J.currentFormatId));return null==t?void 0:t.templateId})),Y=async t=>{if(R.directPrint){if(J.spinning)return;return"button"===t?void await ct():ut()}return ut()},$=t=>p("span",{class:{active:t.key===J.currentFormatId}},[t.label]),Q=(t,e)=>{J.spinning=!1;let n={type:e,formatId:J.currentFormatId,templateId:H.value};U("success",t,n)},W=t=>{J.spinning=!1,U("error",t),b(t)&&"notInstalledApp"===t.type&&N.error(t.message)},X=t=>{J.spinning=!1,U("cancel",t)},Z=t=>{var e;const n={message:(null==(e=window.getLanguageByCode)?void 0:e.call(window,"10010.1.486"))||"前置条件执行错误",type:t,preExecution:!0};U("error",n)},tt=(t=0)=>{var e;const n=(null==(e=R.printParams)?void 0:e.length)?R.printParams[t]:J.printParams[t];return JSON.stringify({...n||{},...R.token?{token:R.token}:{},...R.printCustomProps||{}})},et=()=>{var t,e;let n={},a={};if(null==(t=J.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(J.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(J.printParams.map((e=>JSON.parse(e.datasetData[t]))));a={datasetData:{}},a.datasetData[t]=n}else Object.keys(J.printParams[0]).forEach((t=>{a[t]=[],J.printParams.forEach((e=>{a[t].includes(e[t])||a[t].push(e[t])})),a[t]=a[t].join(",")}));return n=Object.assign({},JSON.parse(tt(0)),a),JSON.stringify(n)},nt=((t,e,n=!0)=>{let a=null;return function(...i){a&&clearTimeout(a),n&&!a&&t.apply(null,i),a=setTimeout((()=>{a=null,!n&&t.apply(null,i)}),e)}})((()=>{let t=J.printParams.length;const e=async e=>{try{--t<=0&&Q(e,"print")}catch(t){console.log("error",t)}};R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("print",{formatId:J.currentFormatId,templateId:H.value}).then((()=>{const t={iReportExecuteMode:J.iReportExecuteMode,formatId:J.currentFormatId,templateId:H.value,authorizationKey:A.value,printdlgshow:R.printdlgshow,signature:R.signature,copies:R.printCopies,svrUpdateIp:R.svrUpdateIp};if("MULTI"===R.strategy)for(let n=0;n<J.printParams.length;n++)n>0&&(t.printdlgshow="0"),V.printDirect({...t,params:tt(n)},e,W,X);else V.printDirect({...t,params:et()},(t=>{Q(t,"print")}),W,X)})).catch((()=>{Z("print"),J.spinning=!1})).finally((()=>{J.visible=!1})))}),800,!0),at=async(t,e)=>{var n,a;switch(t){case"printText":nt();break;case"previewText":(async()=>{R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("preview",{formatId:J.currentFormatId,templateId:H.value}).then((()=>{const t="MULTI"===R.strategy?tt():et(),e={formatId:J.currentFormatId,iReportExecuteMode:J.iReportExecuteMode,templateId:H.value,authorizationKey:A.value,params:t,btnprint:R.btnprint,signature:R.signature};V.preview(e,(t=>{Q(t,"preview")}),W)})).catch((()=>{Z("preview"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;case"formatEditText":R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("edit",{formatId:J.currentFormatId,templateId:H.value}).then((()=>{J.identityVerification.visible=!0})).catch((()=>{Z("edit")})).finally((()=>{J.visible=!1,J.spinning=!1})));break;case"downloadPdf":(async()=>{R.showLoading&&J.spinning||(J.spinning=!0,R.prevFn("download",{formatId:J.currentFormatId,templateId:H.value}).then((()=>{const t="MULTI"===R.strategy?tt():et(),e={formatId:J.currentFormatId,iReportExecuteMode:J.iReportExecuteMode,templateId:H.value,authorizationKey:A.value,print:{print:"1",type:"1",resolution:null==R?void 0:R.resolution},params:t,signature:R.signature};V.downloadPDF(e,(t=>Q(t,"preview")),W)})).catch((()=>{Z("download"),J.spinning=!1})).finally((()=>{J.visible=!1})))})();break;default:{J.visible=!1;const i=J.formatList.find((e=>e.id===t))||{};if(Object.keys(i).length>0){S(t)?q.value=K.value.filter((t=>"formatEditText"!=t.key)):q.value=K.value,J.currentFormatId=t;const[e]=q.value;e.label=(null==i?void 0:i.name)||e.label,await j({formatForms:[{...i}],name:z.name||i.templateName,number:z.number||i.number,templateId:z.templateId||i.templateId,...z.id?{id:z.id}:{}},{token:R.token})}else null==(a=null==(n=R.externalOptionConfig)?void 0:n.onSelect)||a.call(n,t,e,{formatId:J.currentFormatId});break}}},it=()=>{J.visible=!1,U("clickoutside")},rt=()=>(J.isInited=!1,J.spinning=!1,setTimeout((()=>{J.visible=!1}),0),!1),ot=(t,e,n)=>{const a={};return e.forEach((e=>{let i=((t,e)=>{const n={DATE:"yyyy-MM-dd",DATETIME:"yyyy-MM-dd HH:mm:ss"};let a=e;return Object.keys(n).includes(t.type)&&e&&e instanceof Date&&(a=E(e,n[t.type])),(null==t?void 0:t.defaultValue)||a})(e,t[e[n]]);t[e[n]]&&i&&(a[e[n]]=i)})),a},lt=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let a={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;a.datasetData={[t.name]:JSON.stringify(ot(n,e,"fieldName"))}})),a=Object.assign({},a,ot(n,e,"key")),a})),st=async t=>{var e,n;if(J.formatList=t?(t=>{let e=[];return t&&t.forEach((t=>{if(!t.format)return!1;e.push(...t.format.map((e=>Object.assign({},e,{templateName:t.name}))))})),e})(t.obj):[],J.iReportExecuteMode=(null==(e=null==t?void 0:t.obj)?void 0:e.length)>0&&t.obj[0].iReportExecuteMode||1,J.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";if(!B.isDoc){const{data:e}=await M({templateId:t[0].templateId},{token:R.token});if("SUCCESS"===e.result){const{formatForms:a=[]}=e.map||{};Object.assign(z,e.map||{});const i=null==(n=null==a?void 0:a[0])?void 0:n.id;if(i&&t.map((t=>t.id)).includes(i))return i}}const a=t.find((t=>1==t[e]));return(null==a?void 0:a.id)||t[0].id})(J.formatList,"defaultFlag"),!J.currentFormatId)return q.value=[],N.error(R.noDefaultFormatMsg),rt();(()=>{var t;const e=J.formatList.map((t=>({label:t.name,key:t.id})));q.value.unshift({label:G.value,key:"format",children:e}),R.hideButtons.length>0&&(q.value=q.value.filter((t=>!R.hideButtons.includes(t.key))));const n=sessionStorage.getItem("portal");if(n){const e=JSON.parse(n),a=(null==(t=null==e?void 0:e.user)?void 0:t.currentRoleResourceObj)||{},i=Object.keys(a);i.includes("RY7.2.21.1.M2.G94181E")||(q.value=q.value.filter((t=>"downloadPdf"!=t.key))),i.includes("RY7.2.21.1.M2.G33633A")||(q.value=q.value.filter((t=>"formatEditText"!=t.key)))}K.value=C(q.value),S(J.currentFormatId)&&(q.value=K.value.filter((t=>"formatEditText"!=t.key)))})();let a=null==(n=await R.queryTemplateParams())?void 0:n.obj;if(!a||!H.value)return N.error("获取打印模板失败,请联系管理员!"),rt();J.templateParams=a,J.printParams=lt(J.templateParams,R.params)},dt=async()=>{var t;if(J.isInited)return!0;J.isInited=!0,J.spinning=!0,(()=>{if(V)return!1;V=new T})();const e=await R.queryPrintFormatByNumber();return await st(e),(null==(t=e.obj)?void 0:t.length)>0&&(A.value=e.obj[0].authorizationKey||""),J.spinning=!1,!0},ut=async(t=!0)=>{var e,n;if(await R.clickPrevFn())if((null==(e=R.params)?void 0:e.length)||(null==(n=R.printParams)?void 0:n.length)){if(!J.visible){if(!await dt())return!1}t&&(J.visible=!J.visible)}else N.warning(R.noDataMsg)},pt=()=>{J.watchPrintParamsReformatFn&&J.watchPrintParamsReformatFn(),J.isInited?J.printParams=lt(J.templateParams,R.params):J.watchPrintParamsReformatFn=()=>l((()=>J.isInited),(t=>{if(!t)return!1;pt()}))},mt=t=>{if(J.identityVerification.visible=!1,S(J.currentFormatId))return Q(null,"edit");const e={formatId:J.currentFormatId,templateId:H.value,params:tt(),token:t};V.editPrintFormat(e,(t=>{Q(t,"edit")}),W)};async function ct(){await ut(!1),nt()}return o((()=>{J.isInited=!1})),l((()=>R.params),(t=>{if(!(null==t?void 0:t.length))return!1;pt()}),{deep:!0}),O({directPrint:ct}),(e,n)=>(s(),d(u,null,[p(m(h),{class:"c-dropdown",placement:t.placement,trigger:"click",show:J.visible,onClickoutside:it,options:m(q),onSelect:at,"render-label":$},{default:c((()=>[f(e.$slots,"button",{handleClickPrintBtn:ut,printSpinning:J.spinning,printbtnText:t.btnText,printVisible:J.visible},(()=>[p(m(P),{class:"dropdown-button",loading:t.showLoading&&J.spinning,onClick:n[1]||(n[1]=v((()=>Y("button")),["stop"]))},{default:c((()=>[g(y(t.btnText)+" ",1),p(m(F),{component:m(k),size:"18",style:{"margin-left":"5px"},onClick:n[0]||(n[0]=v((()=>Y("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["placement","show","options"]),p(L,w(m(B),{modelValue:J.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>J.identityVerification.visible=t),formatId:J.currentFormatId,templateId:m(H),onSuccess:mt}),null,16,["modelValue","formatId","templateId"])],64))}});export{U as default};
|
@@ -113,6 +113,9 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
113
113
|
type: BooleanConstructor;
|
114
114
|
};
|
115
115
|
wordSplitFilter: {};
|
116
|
+
unMatchedOption: {
|
117
|
+
type: FunctionConstructor;
|
118
|
+
};
|
116
119
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "postRecommend" | "patternChange")[], "update:value" | "postRecommend" | "patternChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
117
120
|
value: {
|
118
121
|
type: PropType<ArrayAble<string | number> | null>;
|
@@ -223,6 +226,9 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
223
226
|
type: BooleanConstructor;
|
224
227
|
};
|
225
228
|
wordSplitFilter: {};
|
229
|
+
unMatchedOption: {
|
230
|
+
type: FunctionConstructor;
|
231
|
+
};
|
226
232
|
}>> & {
|
227
233
|
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
228
234
|
onPostRecommend?: ((...args: any[]) => any) | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
import{defineComponent as e,computed as
|
1
|
+
import{defineComponent as e,computed as t,watch as o,inject as l,useAttrs as a,ref as r,createVNode as s,mergeProps as n,toRaw as u}from"vue";import{arrayed as i}from"../../../../../shared/utils/index.js";import{NSelect as p}from"naive-ui";import"@vueuse/core";import"date-fns";import{cloneDeep as m,isArray as d,isFunction as c,isObject as v,omit as y,xor as f}from"lodash-es";import"@vue/shared";import{useSelectAllowModify as h}from"../../../../../shared/hooks/selectHooks/useSelectAllowModify.js";import"../../../../../shared/hooks/selectHooks/useSearchContent.js";import{useSelectRenders as j}from"../../../../../shared/hooks/selectHooks/useSelectRenders.js";import"../../../../../shared/hooks/useScrollLoading.js";import{connect as b,mapProps as S}from"@formily/vue";import{useCommonInjection as g,useSelectOptionProps as k}from"../../hooks/useCommonInjection.js";import{useComplexOptions as C,useComplexOptionsSpan as F}from"../../hooks/useComplexOptions.js";import{InjectionChangeContextCollector as B,InjectionFormUUID as O}from"../../constants/index.js";import"@formily/path";import"@formily/core";import"@vicons/ionicons5";import"./text.js";import"../../utils/business.js";import{assignUpdateValue as w,assignClearBindVisited as A,createVisitedSetter as H}from"../../utils/schema.js";import"../../../index.js";import"../../../../../shared/utils/tapable/SyncHook.js";import"../../../../../shared/utils/tapable/SyncBailHook.js";import"../../../../../shared/utils/tapable/SyncWaterfallHook.js";import"../../../../../shared/utils/tapable/SyncLoopHook.js";import"../../../../../shared/utils/tapable/AsyncParallelHook.js";import"../../../../../shared/utils/tapable/AsyncParallelBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesBailHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js";import"../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js";import"./index.js";import"@vueuse/shared";import{useFormField as K}from"../../hooks/useFormField.js";import"@formily/reactive";import{useUrlConfigOptions as R,useAutographOptions as x,useRecommendOptions as V}from"../../hooks/useFormRenderOptions.js";import"../../hooks/useFormValidator.js";const L=b(e({name:"FormSelect",props:{value:{type:[String,Array,Number]},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},options:{type:Array,default:()=>[]},onChange:{},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},showField:{type:String},allowCreate:Boolean,shouldSave:Boolean,allowModify:Boolean,showCustomValue:Boolean,cursorPlacement:{type:String,default:"end"},urlConfig:{type:Object},autograph:{type:String},wordbook:{type:Object},recommend:{type:Boolean,default:!1},commonList:{type:Array},recentList:{type:Array},getRecommendInfo:{type:Function},commonNum:{type:Number,default:10},recentNum:{type:Number,default:10},recommendCache:{type:Boolean,default:!1},useLoading:{type:Boolean,default:!0},multiple:{type:Boolean},deletable:{type:Boolean,default:!0},selectAll:{type:Boolean},searchByValue:{type:Boolean},wordSplitFilter:{},unMatchedOption:{type:Function}},emits:["update:value","postRecommend","patternChange"],setup(e,{slots:b,emit:S}){const w=t({get:()=>e.value,async set(e){S("update:value",e),J(e)}}),{labelKey:A,valueKey:L,showKey:P,fetchData:_,searchContent:M,fullOptions:N,filterOptions:I,remoteOptions:W,loading:q}=e.urlConfig?R(e,w):x(e,w);o(M,(e=>{S("patternChange",{pattern:e,options:ie.value})}));const{modifyEvent:E,modifyAbleRef:z,getOptionsWithCreated:T}=h(e,{searchContent:M,labelKey:A,valueKey:L,valueRef:w,fullOptions:N}),{renderComplexOption:U,hasComplexOption:D}=C(e,w),{getRecommend:G,postRecommend:J,sortedOptions:Q}=V(e,I,S,A,L),{field:X,fieldKey:Y}=K();l(B).setContext(Y.value,(e=>({currentOption:m(function(e){const t=T(N.value);return d(e)?function(e){const o=t.reduce(((e,t)=>(e[t[L.value]]=t,e)),{});return e.map((e=>o[e]))}(e):(o=e,t.find((e=>e[L.value]===o)));var o}(e)),labelField:A.value,valueField:L.value})));const Z=async e=>(M.value=e,Promise.allSettled([_(e),G(e)])),{injectValueValidate:$,injectValueWatchFromEmpty:ee,injectValueBindKey:te}=g();ee(w,(()=>e.lazyRequest&&Z())),$(w);const oe=te(w),{menuProps:le,nodeProps:ae}=k(),{renderTag:re,renderLabel:se,renderSelectAll:ne,titleRef:ue}=j(e,{labelKey:A,valueKey:L,valueRef:w,showKey:P,searchContent:M}),ie=t((()=>T(z.value?N.value:Q.value))),pe=a(),me=t((()=>{var t;return c(e.unMatchedOption)?o()?w.value:null==(t=e.unMatchedOption(w.value))?void 0:t[A.value]:e.allowCreate||e.showCustomValue||o()?w.value:null;function o(){const t=e.multiple&&d(w.value);return!!N.value.find((e=>t?w.value.includes(e[L.value]):e[L.value]===w.value))}})),de=r(!1);async function ce(e){e&&await Z(),de.value=e}async function ve(e,t){await E.updateValue(e,t),W.value&&t&&i(t).forEach((e=>{if(!v(e))return;const t=e;t.created&&t.shouldSave&&W.value.push(y(u(t),["created","shouldSave"]))}))}const ye=l(O),{getSpan:fe}=F(),he=H(X,E.focus);function je(t){if(!e.multiple)return;const o=t?ie.value.map((e=>e[L.value])):[];f(o,e.value).length&&(w.value=o)}function be(t){let o=b;return e.multiple&&e.selectAll&&(o={action:()=>ne(je),...b}),s(p,n({title:ue.value,key:oe.value,multiple:e.multiple,remote:!0,filterable:!0,loading:q.value,value:me.value,onUpdateValue:ve,"menu-props":le,"node-props":ae,labelField:A.value,valueField:L.value,options:ie.value,onSearch:Z,show:de.value,"onUpdate:show":ce,onFocus:he,onBlur:E.blur,renderLabel:se,renderTag:re},t,pe),o)}return()=>{var e,t;if(!D.value)return be();const o=null!=(t=null==(e=X.value.decoratorProps)?void 0:e.span)?t:6,l=fe(ye,X.value.address);return s("section",{class:"form-render__selectChildField",style:{"--column":l+o}},[be({class:"form-render__selectChildFieldItem",style:{"--form-item-column":o}}),N.value.map((e=>U({option:e,value:w.value,valueKey:L.value,labelKey:A.value,childFieldStrategy:"checked",renderLabel:!1,attrs:{class:"form-render__selectChildFieldItem",style:{"--form-item-column":l}}})))])}}}),S({dataSource:"options"},w,A));export{L as SELECT};
|
@@ -1 +1 @@
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.2.15-beta.
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.2.15-beta.17",s="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.2.15-beta.17",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,s as main,e as name,n as peerDependencies,i as version};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cnhis-design-vue",
|
3
|
-
"version": "3.2.15-beta.
|
3
|
+
"version": "3.2.15-beta.17",
|
4
4
|
"license": "ISC",
|
5
5
|
"module": "./es/components/index.js",
|
6
6
|
"main": "./es/components/index.js",
|
@@ -72,5 +72,5 @@
|
|
72
72
|
"iOS 7",
|
73
73
|
"last 3 iOS versions"
|
74
74
|
],
|
75
|
-
"gitHead": "
|
75
|
+
"gitHead": "2c637e9d3d37c3be3b6b6d7eed63aafe49c7e16a"
|
76
76
|
}
|