cnhis-design-vue 3.1.54-beta.17 → 3.1.54-beta.19
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,reactive as e,computed as n,onMounted as i,watch as r,openBlock as a,createElementBlock as s,Fragment as o,createVNode as l,unref as p,withCtx as d,renderSlot as m,withModifiers as u,createTextVNode as c,toDisplayString as f,mergeProps as g}from"vue";import{isObject as v}from"@vue/shared";import{useMessage as y,NDropdown as b,NButton as I,NIcon as w}from"naive-ui";import{ChevronDown as P}from"@vicons/ionicons5";import{Print as h}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import k from"./components/IdentityVerification.vue.js";import{format as T}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as S}from"./api.js";var L=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",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:"请选中需要打印的数据",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:!
|
|
1
|
+
import{defineComponent as t,reactive as e,computed as n,onMounted as i,watch as r,openBlock as a,createElementBlock as s,Fragment as o,createVNode as l,unref as p,withCtx as d,renderSlot as m,withModifiers as u,createTextVNode as c,toDisplayString as f,mergeProps as g}from"vue";import{isObject as v}from"@vue/shared";import{useMessage as y,NDropdown as b,NButton as I,NIcon as w}from"naive-ui";import{ChevronDown as P}from"@vicons/ionicons5";import{Print as h}from"./utils/print.js";import{isIReport as F}from"./utils/browserPrint.js";import k from"./components/IdentityVerification.vue.js";import{format as T}from"date-fns";import{savePrivateFormatApi as x,getPrivateFormatApi as S}from"./api.js";var L=t({__name:"ButtonPrint",props:{printParams:{type:Array},params:{default:()=>[],type:Array},btnText:{default:"打印",type:String},printText:{default:"直接打印",type:String},previewText:{default:"打印预览",type:String},pdfLoadText:{default:"下载pdf",type:String},formatEditText:{default:"格式编辑",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:"请选中需要打印的数据",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}},emits:["success","error","clickoutside"],setup(t,{expose:L,emit:D}){var O;const j=t,E=y();let M;const N={},V=e({spinning:!1,visible:!1,formatList:[],templateParams:{},printParams:[],currentFormatId:"",identityVerification:{visible:!1},isInited:!1,watchPrintParamsReformatFn:null,spinTimer:null}),C=e([{label:j.printText,key:"printText"},{label:j.previewText,key:"previewText"},{label:j.pdfLoadText,key:"downloadPdf"},{label:j.formatEditText,key:"formatEditText"},...(null==(O=j.externalOptionConfig)?void 0:O.options)||[]]),Y=n((()=>{if(!V.currentFormatId)return{};let t=V.currentFormatId;return V.formatList.find((e=>e.id===t))})),B=n((()=>{var t;return(null==(t=Y.value)?void 0:t.name)||"格式选择"})),J=n((()=>{let t=V.formatList.find((t=>t.id===V.currentFormatId));return null==t?void 0:t.templateId})),U=async t=>{if(j.directPrint){if(V.spinning)return;return"button"===t?void await rt():et()}return et()},A=t=>l("span",{class:{active:t.key===V.currentFormatId}},[t.label]),q=(t,e)=>{V.spinning=!1;let n={type:e,formatId:V.currentFormatId,templateId:J.value};D("success",t,n)},R=t=>{V.spinning=!1,D("error",t),v(t)&&"notInstalledApp"===t.type&&E.error(t.message)},_=t=>{D("error",{message:"前置条件执行错误",type:t,preExecution:!0})},z=(t=0)=>{var e;const n=(null==(e=j.printParams)?void 0:e.length)?j.printParams[t]:V.printParams[t];return JSON.stringify({...n||{},...j.token?{token:j.token}:{}})},H=()=>{var t,e;let n={},i={};if(null==(t=V.templateParams.customizeDataset)?void 0:t.length){const t=(null==(e=Object.keys(V.printParams[0].datasetData||{}))?void 0:e[0])||"",n=JSON.stringify(V.printParams.map((e=>JSON.parse(e.datasetData[t]))));i={datasetData:{}},i.datasetData[t]=n}else Object.keys(V.printParams[0]).forEach((t=>{i[t]=[],V.printParams.forEach((e=>{i[t].push(e[t])})),i[t]=i[t].join(",")}));return n=Object.assign({},JSON.parse(z(0)),i),JSON.stringify(n)},$=()=>{let t=V.printParams.length;const e=async e=>{try{--t<=0&&q(e,"print")}catch(t){console.log("error",t)}};j.showLoading&&V.spinning||(V.spinning=!0,j.prevFn("print").then((()=>{const t={formatId:V.currentFormatId,templateId:J.value,printdlgshow:j.printdlgshow,signature:j.signature};if("MULTI"===j.strategy)for(let n=0;n<V.printParams.length;n++)n>0&&(t.printdlgshow="0"),M.printDirect({...t,params:z(n)},e,R);else M.printDirect({...t,params:H()},(t=>{q(t,"print")}),R)})).catch((()=>{_("print"),V.spinning=!1})).finally((()=>{V.visible=!1})))},G=async(t,e)=>{var n,i;switch(t){case"printText":$();break;case"previewText":(async()=>{j.showLoading&&V.spinning||(V.spinning=!0,j.prevFn("preview").then((()=>{const t="MULTI"===j.strategy?z():H(),e={formatId:V.currentFormatId,templateId:J.value,params:t,btnprint:j.btnprint,signature:j.signature};M.preview(e,(t=>{q(t,"preview")}),R)})).catch((()=>{_("preview"),V.spinning=!1})).finally((()=>{V.visible=!1})))})();break;case"formatEditText":j.showLoading&&V.spinning||(V.spinning=!0,j.prevFn("edit").then((()=>{V.identityVerification.visible=!0})).catch((()=>{_("edit")})).finally((()=>{V.visible=!1,V.spinning=!1})));break;case"downloadPdf":(async()=>{j.showLoading&&V.spinning||(V.spinning=!0,j.prevFn("download").then((()=>{const t="MULTI"===j.strategy?z():H(),e={formatId:V.currentFormatId,templateId:J.value,print:{print:"1",type:"1"},params:t,signature:j.signature};M.downloadPDF(e,(t=>q(t,"preview")),R)})).catch((()=>{_("download"),V.spinning=!1})).finally((()=>{V.visible=!1})))})();break;default:{V.visible=!1;const r=V.formatList.find((e=>e.id===t))||{};if(Object.keys(r).length>0){V.currentFormatId=t;const[e]=C;e.label=(null==r?void 0:r.name)||e.label,await x({formatForms:[{...r}],name:N.name||r.templateName,number:N.number||r.number,templateId:N.templateId||r.templateId,...N.id?{id:N.id}:{}},{token:j.token})}else null==(i=null==(n=j.externalOptionConfig)?void 0:n.onSelect)||i.call(n,t,e);break}}},K=()=>{V.visible=!1,D("clickoutside")},Q=()=>(V.isInited=!1,V.spinning=!1,setTimeout((()=>{V.visible=!1}),0),!1),W=(t,e,n)=>{const i={};return e.forEach((e=>{let r=((t,e)=>{const n={DATE:"YYYY-MM-DD",DATETIME:"YYYY-MM-DD HH:mm:ss"};let i=e;return Object.keys(n).includes(t.type)&&e&&(i=T(e,n[t.type])),(null==t?void 0:t.defaultValue)||i})(e,t[e[n]]);t[e[n]]&&r&&(i[e[n]]=r)})),i},X=({customizeDataset:t=[],param:e=[]},n=[])=>n.map((n=>{let i={};return t.forEach((t=>{const e=t.dataSetting[0].selectFieldList;i.datasetData={[t.name]:JSON.stringify(W(n,e,"fieldName"))}})),i=Object.assign({},i,W(n,e,"key")),i})),Z=async t=>{var e;if(V.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):[],V.currentFormatId=await(async(t,e)=>{var n;if(!(null==t?void 0:t.length))return"";const{data:i}=await S({templateId:t[0].templateId},{token:j.token});if("SUCCESS"===i.result){const{formatForms:e=[]}=i.map||{};Object.assign(N,i.map||{});const r=null==(n=null==e?void 0:e[0])?void 0:n.id;if(r&&t.map((t=>t.id)).includes(r))return r}const r=t.find((t=>1==t[e]));return(null==r?void 0:r.id)||t[0].id})(V.formatList,"defaultFlag"),!V.currentFormatId)return E.error("获取打印格式失败,请联系管理员!"),Q();(()=>{const t=V.formatList.map((t=>({label:t.name,key:t.id})));C.unshift({label:B.value,key:"format",children:t})})();let n=null==(e=await j.queryTemplateParams())?void 0:e.obj;if(!n||!J.value)return E.error("获取打印模板失败,请联系管理员!"),Q();V.templateParams=n,V.printParams=X(V.templateParams,j.params)},tt=async()=>{if(V.isInited)return!0;V.isInited=!0,V.spinning=!0,(()=>{if(M)return!1;M=new h})();const t=await j.queryPrintFormatByNumber();return await Z(t),V.spinning=!1,!0},et=async(t=!0)=>{var e;if(await j.clickPrevFn())if(null==(e=j.params)?void 0:e.length){if(!V.visible){if(!await tt())return!1}t&&(V.visible=!V.visible)}else E.warning(j.noDataMsg)},nt=()=>{V.watchPrintParamsReformatFn&&V.watchPrintParamsReformatFn(),V.isInited?V.printParams=X(V.templateParams,j.params):V.watchPrintParamsReformatFn=()=>r((()=>V.isInited),(t=>{if(!t)return!1;nt()}))},it=t=>{if(V.identityVerification.visible=!1,F(V.currentFormatId))return q(null,"edit");const e={formatId:V.currentFormatId,templateId:J.value,params:z(),token:t};M.editPrintFormat(e,(t=>{q(t,"edit")}),R)};async function rt(){await et(!1),$()}return i((()=>{V.isInited=!1})),r((()=>j.params),(t=>{if(!(null==t?void 0:t.length))return!1;nt()}),{deep:!0}),L({directPrint:rt}),(e,n)=>(a(),s(o,null,[l(p(b),{class:"c-dropdown",placement:"bottom-start",trigger:"click",show:V.visible,onClickoutside:K,options:C,onSelect:G,"render-label":A},{default:d((()=>[m(e.$slots,"button",{handleClickPrintBtn:et,printSpinning:V.spinning,printbtnText:t.btnText,printVisible:V.visible},(()=>[l(p(I),{class:"dropdown-button",loading:t.showLoading&&V.spinning,onClick:n[1]||(n[1]=u((()=>U("button")),["stop"]))},{default:d((()=>[c(f(t.btnText)+" ",1),l(p(w),{component:p(P),style:{"margin-left":"5px"},onClick:n[0]||(n[0]=u((()=>U("icon")),["stop"]))},null,8,["component"])])),_:1},8,["loading"])]))])),_:3},8,["show","options"]),l(k,g(e.$attrs,{modelValue:V.identityVerification.visible,"onUpdate:modelValue":n[2]||(n[2]=t=>V.identityVerification.visible=t),formatId:V.currentFormatId,templateId:p(J),onSuccess:it}),null,16,["modelValue","formatId","templateId"])],64))}});export{L as default};
|
package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createVNode as n}from"vue";import"../../../../../../shared/utils/index.js";import{isObject as o,isArray as
|
|
1
|
+
import{createVNode as n}from"vue";import"../../../../../../shared/utils/index.js";import{isObject as o,isArray as e}from"lodash-es";import"../../../../index.js";import{WIDGET_TYPE as t}from"../../../constants/index.js";import{parseMergeField as r,isRichContent as i,parseRichContent as l,getTitle as s}from"../../../utils/index.js";import{isMatchLowCodeCondition as c}from"../../../../../../shared/utils/business.js";import{defineTablePlugin as d}from"../../../hooks/useTablePlugin.js";function u(){return d({name:"defaultRendererPlugin",vxe(d){d.renderer.add(t.DEFAULT,{renderCell(t,{row:d,column:u}){const a=r(d,u),f=i(a)?function(o,e){const t=l(o);return[n("span",{title:s(e,t.change_text),style:{color:t.background||t.icon}},[r(t.icon),t.change_text])];function r(o){return o?o.match(/#[\da-f]{6}|[\da-f]{3}/i)?n("i",{class:"icon-dot",style:{"--table-icon-color":o,"--table-icon-shadow":o}},null):n("i",{class:t.icon},null):null}}(a,u):[a];return function(o,t,r,i){if(!e(o)||!o.length)return n("span",{title:String(s(r,i))},[i]);const l=o.find((n=>n.condition&&n.condition.find((n=>{const o=t[n.field_key||r.field];return c(o,n)}))));return n("span",l?{title:s(r,i),style:{color:l.color},class:l.icon}:{title:s(r,i)},[i])}(function(n){var e,t,r;const i=null==(e=n.editRender)?void 0:e.props;if(!o(i))return;return null!=(r=i.colorAndIcon)?r:null==(t=i.settingObj)?void 0:t.colorAndIcon}(u),d,u,f)}}),d.renderer.add(t.STATUS,d.renderer.get(t.DEFAULT))}})}export{u as defaultRendererPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e="@cnhis-design-vue/shared",i="3.1.54-beta.
|
|
1
|
+
var e="@cnhis-design-vue/shared",i="3.1.54-beta.19",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.54-beta.19",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.54-beta.
|
|
3
|
+
"version": "3.1.54-beta.19",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"iOS 7",
|
|
64
64
|
"last 3 iOS versions"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "162beeb8a1e4e3767876b82dabec65418be483d4"
|
|
67
67
|
}
|