@baosight/er4j 0.0.26 → 0.0.27

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.
@@ -35,7 +35,7 @@
35
35
  `),t=$t(a.replace(/<[^>]*>/g,""));return[t]}var Is={day:["d","dd"],month:["m","mm"],year:["y","yy"],hours:["h","hh"],minutes:["m","mm"],seconds:["s","ss"],"am-pm":["A/P","AM/PM"],"day-of-week":["ddd","dddd"],era:["e","ee"],quarter:["\\Qm",'m\\"th quarter"']};function Ds(e,a){var t=a||{},o=zn(e),s=[],f,u,h={name:""},C="",T=0,S,x,y={},O=[],D=t.dense?[]:{},I,M,G={value:""},te="",b=0,P=[],Ee=-1,fe=-1,H={s:{r:1e6,c:1e7},e:{r:0,c:0}},oe=0,R={},K=[],he={},z=0,Ie=0,Ne=[],xe=1,Le=1,ve=[],Ge={Names:[]},_e={},$e=["",""],Ke=[],X={},pe="",r=0,i=!1,n=!1,c=0;for(Ii.lastIndex=0,o=o.replace(/<!--([\s\S]*?)-->/mg,"").replace(/<!DOCTYPE[^\[]*\[[^\]]*\]>/gm,"");I=Ii.exec(o);)switch(I[3]=I[3].replace(/_.*$/,"")){case"table":case"工作表":I[1]==="/"?(H.e.c>=H.s.c&&H.e.r>=H.s.r?D["!ref"]=Ht(H):D["!ref"]="A1:A1",t.sheetRows>0&&t.sheetRows<=H.e.r&&(D["!fullref"]=D["!ref"],H.e.r=t.sheetRows-1,D["!ref"]=Ht(H)),K.length&&(D["!merges"]=K),Ne.length&&(D["!rows"]=Ne),S.name=S.名称||S.name,typeof JSON<"u"&&JSON.stringify(S),O.push(S.name),y[S.name]=D,n=!1):I[0].charAt(I[0].length-2)!=="/"&&(S=Ft(I[0],!1),Ee=fe=-1,H.s.r=H.s.c=1e7,H.e.r=H.e.c=0,D=t.dense?[]:{},K=[],Ne=[],n=!0);break;case"table-row-group":I[1]==="/"?--oe:++oe;break;case"table-row":case"行":if(I[1]==="/"){Ee+=xe,xe=1;break}if(x=Ft(I[0],!1),x.行号?Ee=x.行号-1:Ee==-1&&(Ee=0),xe=+x["number-rows-repeated"]||1,xe<10)for(c=0;c<xe;++c)oe>0&&(Ne[Ee+c]={level:oe});fe=-1;break;case"covered-table-cell":I[1]!=="/"&&++fe,t.sheetStubs&&(t.dense?(D[Ee]||(D[Ee]=[]),D[Ee][fe]={t:"z"}):D[It({r:Ee,c:fe})]={t:"z"}),te="",P=[];break;case"table-cell":case"数据":if(I[0].charAt(I[0].length-2)==="/")++fe,G=Ft(I[0],!1),Le=parseInt(G["number-columns-repeated"]||"1",10),M={t:"z",v:null},G.formula&&t.cellFormula!=!1&&(M.f=fs($t(G.formula))),(G.数据类型||G["value-type"])=="string"&&(M.t="s",M.v=$t(G["string-value"]||""),t.dense?(D[Ee]||(D[Ee]=[]),D[Ee][fe]=M):D[It({r:Ee,c:fe})]=M),fe+=Le-1;else if(I[1]!=="/"){++fe,te="",b=0,P=[],Le=1;var d=xe?Ee+xe-1:Ee;if(fe>H.e.c&&(H.e.c=fe),fe<H.s.c&&(H.s.c=fe),Ee<H.s.r&&(H.s.r=Ee),d>H.e.r&&(H.e.r=d),G=Ft(I[0],!1),Ke=[],X={},M={t:G.数据类型||G["value-type"],v:null},t.cellFormula)if(G.formula&&(G.formula=$t(G.formula)),G["number-matrix-columns-spanned"]&&G["number-matrix-rows-spanned"]&&(z=parseInt(G["number-matrix-rows-spanned"],10)||0,Ie=parseInt(G["number-matrix-columns-spanned"],10)||0,he={s:{r:Ee,c:fe},e:{r:Ee+z-1,c:fe+Ie-1}},M.F=Ht(he),ve.push([he,M.F])),G.formula)M.f=fs(G.formula);else for(c=0;c<ve.length;++c)Ee>=ve[c][0].s.r&&Ee<=ve[c][0].e.r&&fe>=ve[c][0].s.c&&fe<=ve[c][0].e.c&&(M.F=ve[c][1]);switch((G["number-columns-spanned"]||G["number-rows-spanned"])&&(z=parseInt(G["number-rows-spanned"],10)||0,Ie=parseInt(G["number-columns-spanned"],10)||0,he={s:{r:Ee,c:fe},e:{r:Ee+z-1,c:fe+Ie-1}},K.push(he)),G["number-columns-repeated"]&&(Le=parseInt(G["number-columns-repeated"],10)),M.t){case"boolean":M.t="b",M.v=ir(G["boolean-value"]);break;case"float":M.t="n",M.v=parseFloat(G.value);break;case"percentage":M.t="n",M.v=parseFloat(G.value);break;case"currency":M.t="n",M.v=parseFloat(G.value);break;case"date":M.t="d",M.v=Sr(G["date-value"]),t.cellDates||(M.t="n",M.v=Vr(M.v)),M.z="m/d/yy";break;case"time":M.t="n",M.v=Cc(G["time-value"])/86400,t.cellDates&&(M.t="d",M.v=ln(M.v)),M.z="HH:MM:SS";break;case"number":M.t="n",M.v=parseFloat(G.数据数值);break;default:if(M.t==="string"||M.t==="text"||!M.t)M.t="s",G["string-value"]!=null&&(te=$t(G["string-value"]),P=[]);else throw new Error("Unsupported value type "+M.t)}}else{if(i=!1,M.t==="s"&&(M.v=te||"",P.length&&(M.R=P),i=b==0),_e.Target&&(M.l=_e),Ke.length>0&&(M.c=Ke,Ke=[]),te&&t.cellText!==!1&&(M.w=te),i&&(M.t="z",delete M.v),(!i||t.sheetStubs)&&!(t.sheetRows&&t.sheetRows<=Ee))for(var p=0;p<xe;++p){if(Le=parseInt(G["number-columns-repeated"]||"1",10),t.dense)for(D[Ee+p]||(D[Ee+p]=[]),D[Ee+p][fe]=p==0?M:vr(M);--Le>0;)D[Ee+p][fe+Le]=vr(M);else for(D[It({r:Ee+p,c:fe})]=M;--Le>0;)D[It({r:Ee+p,c:fe+Le})]=vr(M);H.e.c<=fe&&(H.e.c=fe)}Le=parseInt(G["number-columns-repeated"]||"1",10),fe+=Le-1,Le=0,M={},te="",P=[]}_e={};break;case"document":case"document-content":case"电子表格文档":case"spreadsheet":case"主体":case"scripts":case"styles":case"font-face-decls":case"master-styles":if(I[1]==="/"){if((f=s.pop())[0]!==I[3])throw"Bad state: "+f}else I[0].charAt(I[0].length-2)!=="/"&&s.push([I[3],!0]);break;case"annotation":if(I[1]==="/"){if((f=s.pop())[0]!==I[3])throw"Bad state: "+f;X.t=te,P.length&&(X.R=P),X.a=pe,Ke.push(X)}else I[0].charAt(I[0].length-2)!=="/"&&s.push([I[3],!1]);pe="",r=0,te="",b=0,P=[];break;case"creator":I[1]==="/"?pe=o.slice(r,I.index):r=I.index+I[0].length;break;case"meta":case"元数据":case"settings":case"config-item-set":case"config-item-map-indexed":case"config-item-map-entry":case"config-item-map-named":case"shapes":case"frame":case"text-box":case"image":case"data-pilot-tables":case"list-style":case"form":case"dde-links":case"event-listeners":case"chart":if(I[1]==="/"){if((f=s.pop())[0]!==I[3])throw"Bad state: "+f}else I[0].charAt(I[0].length-2)!=="/"&&s.push([I[3],!1]);te="",b=0,P=[];break;case"scientific-number":break;case"currency-symbol":break;case"currency-style":break;case"number-style":case"percentage-style":case"date-style":case"time-style":if(I[1]==="/"){if(R[h.name]=C,(f=s.pop())[0]!==I[3])throw"Bad state: "+f}else I[0].charAt(I[0].length-2)!=="/"&&(C="",h=Ft(I[0],!1),s.push([I[3],!0]));break;case"script":break;case"libraries":break;case"automatic-styles":break;case"default-style":case"page-layout":break;case"style":break;case"map":break;case"font-face":break;case"paragraph-properties":break;case"table-properties":break;case"table-column-properties":break;case"table-row-properties":break;case"table-cell-properties":break;case"number":switch(s[s.length-1][0]){case"time-style":case"date-style":u=Ft(I[0],!1),C+=Is[I[3]][u.style==="long"?1:0];break}break;case"fraction":break;case"day":case"month":case"year":case"era":case"day-of-week":case"week-of-year":case"quarter":case"hours":case"minutes":case"seconds":case"am-pm":switch(s[s.length-1][0]){case"time-style":case"date-style":u=Ft(I[0],!1),C+=Is[I[3]][u.style==="long"?1:0];break}break;case"boolean-style":break;case"boolean":break;case"text-style":break;case"text":if(I[0].slice(-2)==="/>")break;if(I[1]==="/")switch(s[s.length-1][0]){case"number-style":case"date-style":case"time-style":C+=o.slice(T,I.index);break}else T=I.index+I[0].length;break;case"named-range":u=Ft(I[0],!1),$e=fo(u["cell-range-address"]);var m={Name:u.name,Ref:$e[0]+"!"+$e[1]};n&&(m.Sheet=O.length),Ge.Names.push(m);break;case"text-content":break;case"text-properties":break;case"embedded-text":break;case"body":case"电子表格":break;case"forms":break;case"table-column":break;case"table-header-rows":break;case"table-rows":break;case"table-column-group":break;case"table-header-columns":break;case"table-columns":break;case"null-date":break;case"graphic-properties":break;case"calculation-settings":break;case"named-expressions":break;case"label-range":break;case"label-ranges":break;case"named-expression":break;case"sort":break;case"sort-by":break;case"sort-groups":break;case"tab":break;case"line-break":break;case"span":break;case"p":case"文本串":if(["master-styles"].indexOf(s[s.length-1][0])>-1)break;if(I[1]==="/"&&(!G||!G["string-value"])){var _=o7(o.slice(b,I.index));te=(te.length>0?te+`
36
36
  `:"")+_[0]}else Ft(I[0],!1),b=I.index+I[0].length;break;case"s":break;case"database-range":if(I[1]==="/")break;try{$e=fo(Ft(I[0])["target-range-address"]),y[$e[0]]["!autofilter"]={ref:$e[1]}}catch{}break;case"date":break;case"object":break;case"title":case"标题":break;case"desc":break;case"binary-data":break;case"table-source":break;case"scenario":break;case"iteration":break;case"content-validations":break;case"content-validation":break;case"help-message":break;case"error-message":break;case"database-ranges":break;case"filter":break;case"filter-and":break;case"filter-or":break;case"filter-condition":break;case"list-level-style-bullet":break;case"list-level-style-number":break;case"list-level-properties":break;case"sender-firstname":case"sender-lastname":case"sender-initials":case"sender-title":case"sender-position":case"sender-email":case"sender-phone-private":case"sender-fax":case"sender-company":case"sender-phone-work":case"sender-street":case"sender-city":case"sender-postal-code":case"sender-country":case"sender-state-or-province":case"author-name":case"author-initials":case"chapter":case"file-name":case"template-name":case"sheet-name":break;case"event-listener":break;case"initial-creator":case"creation-date":case"print-date":case"generator":case"document-statistic":case"user-defined":case"editing-duration":case"editing-cycles":break;case"config-item":break;case"page-number":break;case"page-count":break;case"time":break;case"cell-range-source":break;case"detective":break;case"operation":break;case"highlighted-range":break;case"data-pilot-table":case"source-cell-range":case"source-service":case"data-pilot-field":case"data-pilot-level":case"data-pilot-subtotals":case"data-pilot-subtotal":case"data-pilot-members":case"data-pilot-member":case"data-pilot-display-info":case"data-pilot-sort-info":case"data-pilot-layout-info":case"data-pilot-field-reference":case"data-pilot-groups":case"data-pilot-group":case"data-pilot-group-member":break;case"rect":break;case"dde-connection-decls":case"dde-connection-decl":case"dde-link":case"dde-source":break;case"properties":break;case"property":break;case"a":if(I[1]!=="/"){if(_e=Ft(I[0],!1),!_e.href)break;_e.Target=$t(_e.href),delete _e.href,_e.Target.charAt(0)=="#"&&_e.Target.indexOf(".")>-1?($e=fo(_e.Target.slice(1)),_e.Target="#"+$e[0]+"!"+$e[1]):_e.Target.match(/^\.\.[\\\/]/)&&(_e.Target=_e.Target.slice(3))}break;case"table-protection":break;case"data-pilot-grand-total":break;case"office-document-common-attrs":break;default:switch(I[2]){case"dc:":case"calcext:":case"loext:":case"ooo:":case"chartooo:":case"draw:":case"style:":case"chart:":case"form:":case"uof:":case"表:":case"字:":break;default:if(t.WTF)throw new Error(I)}}var E={Sheets:y,SheetNames:O,Workbook:Ge};return t.bookSheets&&delete E.Sheets,E}function As(e,a){a=a||{},oa(e,"META-INF/manifest.xml")&&S6(mr(e,"META-INF/manifest.xml"),a);var t=Kr(e,"content.xml");if(!t)throw new Error("Missing content.xml in ODS / UOF file");var o=Ds(er(t),a);return oa(e,"meta.xml")&&(o.Props=C0(mr(e,"meta.xml"))),o}function ws(e,a){return Ds(e,a)}/*! sheetjs (C) 2013-present SheetJS -- http://sheetjs.com */function go(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Eo(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):er(Ya(e))}function Co(e){var a=e.reduce(function(s,f){return s+f.length},0),t=new Uint8Array(a),o=0;return e.forEach(function(s){t.set(s,o),o+=s.length}),t}function Ms(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>>24}function l7(e,a){for(var t=(e[a+15]&127)<<7|e[a+14]>>1,o=e[a+14]&1,s=a+13;s>=a;--s)o=o*256+e[s];return(e[a+15]&128?-o:o)*Math.pow(10,t-6176)}function Yi(e,a){var t=a?a[0]:0,o=e[t]&127;e:if(e[t++]>=128&&(o|=(e[t]&127)<<7,e[t++]<128||(o|=(e[t]&127)<<14,e[t++]<128)||(o|=(e[t]&127)<<21,e[t++]<128)||(o+=(e[t]&127)*Math.pow(2,28),++t,e[t++]<128)||(o+=(e[t]&127)*Math.pow(2,35),++t,e[t++]<128)||(o+=(e[t]&127)*Math.pow(2,42),++t,e[t++]<128)))break e;return a&&(a[0]=t),o}function Tr(e){var a=0,t=e[a]&127;e:if(e[a++]>=128){if(t|=(e[a]&127)<<7,e[a++]<128||(t|=(e[a]&127)<<14,e[a++]<128)||(t|=(e[a]&127)<<21,e[a++]<128))break e;t|=(e[a]&127)<<28}return t}function Lr(e){for(var a=[],t=[0];t[0]<e.length;){var o=t[0],s=Yi(e,t),f=s&7;s=Math.floor(s/8);var u=0,h;if(s==0)break;switch(f){case 0:{for(var C=t[0];e[t[0]++]>=128;);h=e.slice(C,t[0])}break;case 5:u=4,h=e.slice(t[0],t[0]+u),t[0]+=u;break;case 1:u=8,h=e.slice(t[0],t[0]+u),t[0]+=u;break;case 2:u=Yi(e,t),h=e.slice(t[0],t[0]+u),t[0]+=u;break;case 3:case 4:default:throw new Error("PB Type ".concat(f," for Field ").concat(s," at offset ").concat(o))}var T={data:h,type:f};a[s]==null?a[s]=[T]:a[s].push(T)}return a}function _o(e,a){return(e==null?void 0:e.map(function(t){return a(t.data)}))||[]}function s7(e){for(var a,t=[],o=[0];o[0]<e.length;){var s=Yi(e,o),f=Lr(e.slice(o[0],o[0]+s));o[0]+=s;var u={id:Tr(f[1][0].data),messages:[]};f[2].forEach(function(h){var C=Lr(h.data),T=Tr(C[3][0].data);u.messages.push({meta:C,data:e.slice(o[0],o[0]+T)}),o[0]+=T}),(a=f[3])!=null&&a[0]&&(u.merge=Tr(f[3][0].data)>>>0>0),t.push(u)}return t}function c7(e,a){if(e!=0)throw new Error("Unexpected Snappy chunk type ".concat(e));for(var t=[0],o=Yi(a,t),s=[];t[0]<a.length;){var f=a[t[0]]&3;if(f==0){var u=a[t[0]++]>>2;if(u<60)++u;else{var h=u-59;u=a[t[0]],h>1&&(u|=a[t[0]+1]<<8),h>2&&(u|=a[t[0]+2]<<16),h>3&&(u|=a[t[0]+3]<<24),u>>>=0,u++,t[0]+=h}s.push(a.slice(t[0],t[0]+u)),t[0]+=u;continue}else{var C=0,T=0;if(f==1?(T=(a[t[0]]>>2&7)+4,C=(a[t[0]++]&224)<<3,C|=a[t[0]++]):(T=(a[t[0]++]>>2)+1,f==2?(C=a[t[0]]|a[t[0]+1]<<8,t[0]+=2):(C=(a[t[0]]|a[t[0]+1]<<8|a[t[0]+2]<<16|a[t[0]+3]<<24)>>>0,t[0]+=4)),s=[Co(s)],C==0)throw new Error("Invalid offset 0");if(C>s[0].length)throw new Error("Invalid offset beyond length");if(T>=C)for(s.push(s[0].slice(-C)),T-=C;T>=s[s.length-1].length;)s.push(s[s.length-1]),T-=s[s.length-1].length;s.push(s[0].slice(-C,-C+T))}}var S=Co(s);if(S.length!=o)throw new Error("Unexpected length: ".concat(S.length," != ").concat(o));return S}function d7(e){for(var a=[],t=0;t<e.length;){var o=e[t++],s=e[t]|e[t+1]<<8|e[t+2]<<16;t+=3,a.push(c7(o,e.slice(t,t+s))),t+=s}if(t!==e.length)throw new Error("data is not a valid framed stream!");return Co(a)}function f7(e,a,t,o){var s=go(e),f=s.getUint32(4,!0),u=(o>1?12:8)+Ms(f&(o>1?3470:398))*4,h=-1,C=-1,T=NaN,S=new Date(2001,0,1);f&512&&(h=s.getUint32(u,!0),u+=4),u+=Ms(f&(o>1?12288:4096))*4,f&16&&(C=s.getUint32(u,!0),u+=4),f&32&&(T=s.getFloat64(u,!0),u+=8),f&64&&(S.setTime(S.getTime()+s.getFloat64(u,!0)*1e3),u+=8);var x;switch(e[2]){case 0:break;case 2:x={t:"n",v:T};break;case 3:x={t:"s",v:a[C]};break;case 5:x={t:"d",v:S};break;case 6:x={t:"b",v:T>0};break;case 7:x={t:"n",v:T/86400};break;case 8:x={t:"e",v:0};break;case 9:if(h>-1)x={t:"s",v:t[h]};else if(C>-1)x={t:"s",v:a[C]};else if(!isNaN(T))x={t:"n",v:T};else throw new Error("Unsupported cell type ".concat(e.slice(0,4)));break;default:throw new Error("Unsupported cell type ".concat(e.slice(0,4)))}return x}function u7(e,a,t){var o=go(e),s=o.getUint32(8,!0),f=12,u=-1,h=-1,C=NaN,T=NaN,S=new Date(2001,0,1);s&1&&(C=l7(e,f),f+=16),s&2&&(T=o.getFloat64(f,!0),f+=8),s&4&&(S.setTime(S.getTime()+o.getFloat64(f,!0)*1e3),f+=8),s&8&&(h=o.getUint32(f,!0),f+=4),s&16&&(u=o.getUint32(f,!0),f+=4);var x;switch(e[1]){case 0:break;case 2:x={t:"n",v:C};break;case 3:x={t:"s",v:a[h]};break;case 5:x={t:"d",v:S};break;case 6:x={t:"b",v:T>0};break;case 7:x={t:"n",v:T/86400};break;case 8:x={t:"e",v:0};break;case 9:if(u>-1)x={t:"s",v:t[u]};else throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(s&31," : ").concat(e.slice(0,4)));break;case 10:x={t:"n",v:C};break;default:throw new Error("Unsupported cell type ".concat(e[1]," : ").concat(s&31," : ").concat(e.slice(0,4)))}return x}function h7(e,a,t){switch(e[0]){case 0:case 1:case 2:case 3:return f7(e,a,t,e[0]);case 5:return u7(e,a,t);default:throw new Error("Unsupported payload version ".concat(e[0]))}}function Ua(e){var a=Lr(e);return Yi(a[1][0].data)}function ks(e,a){var t=Lr(a.data),o=Tr(t[1][0].data),s=t[3],f=[];return(s||[]).forEach(function(u){var h=Lr(u.data),C=Tr(h[1][0].data)>>>0;switch(o){case 1:f[C]=Eo(h[3][0].data);break;case 8:{var T=e[Ua(h[9][0].data)][0],S=Lr(T.data),x=e[Ua(S[1][0].data)][0],y=Tr(x.meta[1][0].data);if(y!=2001)throw new Error("2000 unexpected reference to ".concat(y));var O=Lr(x.data);f[C]=O[3].map(function(D){return Eo(D.data)}).join("")}break}}),f}function p7(e,a){var t,o,s,f,u,h,C,T,S,x,y,O,D,I,M=Lr(e),G=Tr(M[1][0].data)>>>0,te=Tr(M[2][0].data)>>>0,b=((o=(t=M[8])==null?void 0:t[0])==null?void 0:o.data)&&Tr(M[8][0].data)>0||!1,P,Ee;if((f=(s=M[7])==null?void 0:s[0])!=null&&f.data&&a!=0)P=(h=(u=M[7])==null?void 0:u[0])==null?void 0:h.data,Ee=(T=(C=M[6])==null?void 0:C[0])==null?void 0:T.data;else if((x=(S=M[4])==null?void 0:S[0])!=null&&x.data&&a!=1)P=(O=(y=M[4])==null?void 0:y[0])==null?void 0:O.data,Ee=(I=(D=M[3])==null?void 0:D[0])==null?void 0:I.data;else throw"NUMBERS Tile missing ".concat(a," cell storage");for(var fe=b?4:1,H=go(P),oe=[],R=0;R<P.length/2;++R){var K=H.getUint16(R*2,!0);K<65535&&oe.push([R,K])}if(oe.length!=te)throw"Expected ".concat(te," cells, found ").concat(oe.length);var he=[];for(R=0;R<oe.length-1;++R)he[oe[R][0]]=Ee.subarray(oe[R][1]*fe,oe[R+1][1]*fe);return oe.length>=1&&(he[oe[oe.length-1][0]]=Ee.subarray(oe[oe.length-1][1]*fe)),{R:G,cells:he}}function m7(e,a){var t,o=Lr(a.data),s=(t=o==null?void 0:o[7])!=null&&t[0]?Tr(o[7][0].data)>>>0>0?1:0:-1,f=_o(o[5],function(u){return p7(u,s)});return{nrows:Tr(o[4][0].data)>>>0,data:f.reduce(function(u,h){return u[h.R]||(u[h.R]=[]),h.cells.forEach(function(C,T){if(u[h.R][T])throw new Error("Duplicate cell r=".concat(h.R," c=").concat(T));u[h.R][T]=C}),u},[])}}function g7(e,a,t){var o,s=Lr(a.data),f={s:{r:0,c:0},e:{r:0,c:0}};if(f.e.r=(Tr(s[6][0].data)>>>0)-1,f.e.r<0)throw new Error("Invalid row varint ".concat(s[6][0].data));if(f.e.c=(Tr(s[7][0].data)>>>0)-1,f.e.c<0)throw new Error("Invalid col varint ".concat(s[7][0].data));t["!ref"]=Ht(f);var u=Lr(s[4][0].data),h=ks(e,e[Ua(u[4][0].data)][0]),C=(o=u[17])!=null&&o[0]?ks(e,e[Ua(u[17][0].data)][0]):[],T=Lr(u[3][0].data),S=0;T[1].forEach(function(x){var y=Lr(x.data),O=e[Ua(y[2][0].data)][0],D=Tr(O.meta[1][0].data);if(D!=6002)throw new Error("6001 unexpected reference to ".concat(D));var I=m7(e,O);I.data.forEach(function(M,G){M.forEach(function(te,b){var P=It({r:S+G,c:b}),Ee=h7(te,h,C);Ee&&(t[P]=Ee)})}),S+=I.nrows})}function E7(e,a){var t=Lr(a.data),o={"!ref":"A1"},s=e[Ua(t[2][0].data)],f=Tr(s[0].meta[1][0].data);if(f!=6001)throw new Error("6000 unexpected reference to ".concat(f));return g7(e,s[0],o),o}function C7(e,a){var t,o=Lr(a.data),s={name:(t=o[1])!=null&&t[0]?Eo(o[1][0].data):"",sheets:[]},f=_o(o[2],Ua);return f.forEach(function(u){e[u].forEach(function(h){var C=Tr(h.meta[1][0].data);C==6e3&&s.sheets.push(E7(e,h))})}),s}function _7(e,a){var t=Oo(),o=Lr(a.data),s=_o(o[1],Ua);if(s.forEach(function(f){e[f].forEach(function(u){var h=Tr(u.meta[1][0].data);if(h==2){var C=C7(e,u);C.sheets.forEach(function(T,S){Io(t,T,S==0?C.name:C.name+"_"+S,!0)})}})}),t.SheetNames.length==0)throw new Error("Empty NUMBERS file");return t}function To(e){var a,t,o,s,f={},u=[];if(e.FullPaths.forEach(function(C){if(C.match(/\.iwpv2/))throw new Error("Unsupported password protection")}),e.FileIndex.forEach(function(C){if(C.name.match(/\.iwa$/)){var T;try{T=d7(C.content)}catch(x){return console.log("?? "+C.content.length+" "+(x.message||x))}var S;try{S=s7(T)}catch(x){return console.log("## "+(x.message||x))}S.forEach(function(x){f[x.id]=x.messages,u.push(x.id)})}}),!u.length)throw new Error("File has no messages");var h=((s=(o=(t=(a=f==null?void 0:f[1])==null?void 0:a[0])==null?void 0:t.meta)==null?void 0:o[1])==null?void 0:s[0].data)&&Tr(f[1][0].meta[1][0].data)==1&&f[1][0];if(h||u.forEach(function(C){f[C].forEach(function(T){var S=Tr(T.meta[1][0].data)>>>0;if(S==1)if(!h)h=T;else throw new Error("Document has multiple roots")})}),!h)throw new Error("Cannot find Document root");return _7(f,h)}function T7(e){return function(t){for(var o=0;o!=e.length;++o){var s=e[o];t[s[0]]===void 0&&(t[s[0]]=s[1]),s[2]==="n"&&(t[s[0]]=Number(t[s[0]]))}}}function So(e){T7([["cellNF",!1],["cellHTML",!0],["cellFormula",!0],["cellStyles",!1],["cellText",!0],["cellDates",!1],["sheetStubs",!1],["sheetRows",0,"n"],["bookDeps",!1],["bookSheets",!1],["bookProps",!1],["bookFiles",!1],["bookVBA",!1],["password",""],["WTF",!1]])(e)}function S7(e){return hi.WS.indexOf(e)>-1?"sheet":e==hi.CS?"chart":e==hi.DS?"dialog":e==hi.MS?"macro":e&&e.length?e:"sheet"}function x7(e,a){if(!e)return 0;try{e=a.map(function(o){return o.id||(o.id=o.strRelID),[o.name,e["!id"][o.id].Target,S7(e["!id"][o.id].Type)]})}catch{return null}return!e||e.length===0?null:e}function y7(e,a,t,o,s,f,u,h,C,T,S,x){try{f[o]=ki(Kr(e,t,!0),a);var y=mr(e,a),O;switch(h){case"sheet":O=A8(y,a,s,C,f[o],T,S,x);break;case"chart":if(O=w8(y,a,s,C,f[o],T,S,x),!O||!O["!drawel"])break;var D=vi(O["!drawel"].Target,a),I=eo(D),M=I4(Kr(e,D,!0),ki(Kr(e,I,!0),D)),G=vi(M,D),te=eo(G);O=u8(Kr(e,G,!0),G,C,ki(Kr(e,te,!0),G),T,O);break;case"macro":O=M8(y,a,s,C,f[o],T,S,x);break;case"dialog":O=k8(y,a,s,C,f[o],T,S,x);break;default:throw new Error("Unrecognized sheet type "+h)}u[o]=O;var b=[];f&&f[o]&&xa(f[o]).forEach(function(P){var Ee="";if(f[o][P].Type==hi.CMNT){Ee=vi(f[o][P].Target,a);var fe=L8(mr(e,Ee,!0),Ee,C);if(!fe||!fe.length)return;K0(O,fe,!1)}f[o][P].Type==hi.TCMNT&&(Ee=vi(f[o][P].Target,a),b=b.concat(A4(mr(e,Ee,!0),C)))}),b&&b.length&&K0(O,b,!0,C.people||[])}catch(P){if(C.WTF)throw P}}function sa(e){return e.charAt(0)=="/"?e.slice(1):e}function v7(e,a){if(Fl(),a=a||{},So(a),oa(e,"META-INF/manifest.xml")||oa(e,"objectdata.xml"))return As(e,a);if(oa(e,"Index/Document.iwa")){if(typeof Uint8Array>"u")throw new Error("NUMBERS file parsing requires Uint8Array support");if(typeof To<"u"){if(e.FileIndex)return To(e);var t=Bt.utils.cfb_new();return bl(e).forEach(function(Ne){vc(t,Ne,yc(e,Ne))}),To(t)}throw new Error("Unsupported NUMBERS file")}if(!oa(e,"[Content_Types].xml"))throw oa(e,"index.xml.gz")?new Error("Unsupported NUMBERS 08 file"):oa(e,"index.xml")?new Error("Unsupported NUMBERS 09 file"):new Error("Unsupported ZIP file");var o=bl(e),s=_6(Kr(e,"[Content_Types].xml")),f=!1,u,h;if(s.workbooks.length===0&&(h="xl/workbook.xml",mr(e,h,!0)&&s.workbooks.push(h)),s.workbooks.length===0){if(h="xl/workbook.bin",!mr(e,h,!0))throw new Error("Could not find workbook");s.workbooks.push(h),f=!0}s.workbooks[0].slice(-3)=="bin"&&(f=!0);var C={},T={};if(!a.bookSheets&&!a.bookProps){if(zi=[],s.sst)try{zi=N8(mr(e,sa(s.sst)),s.sst,a)}catch(Ne){if(a.WTF)throw Ne}a.cellStyles&&s.themes.length&&(C=R8(Kr(e,s.themes[0].replace(/^\//,""),!0)||"",s.themes[0],a)),s.style&&(T=b8(mr(e,sa(s.style)),s.style,C,a))}s.links.map(function(Ne){try{var xe=ki(Kr(e,eo(sa(Ne))),Ne);return B8(mr(e,sa(Ne)),xe,Ne,a)}catch{}});var S=D8(mr(e,sa(s.workbooks[0])),s.workbooks[0],a),x={},y="";s.coreprops.length&&(y=mr(e,sa(s.coreprops[0]),!0),y&&(x=C0(y)),s.extprops.length!==0&&(y=mr(e,sa(s.extprops[0]),!0),y&&v6(y,x,a)));var O={};(!a.bookSheets||a.bookProps)&&s.custprops.length!==0&&(y=Kr(e,sa(s.custprops[0]),!0),y&&(O=O6(y,a)));var D={};if((a.bookSheets||a.bookProps)&&(S.Sheets?u=S.Sheets.map(function(xe){return xe.name}):x.Worksheets&&x.SheetNames.length>0&&(u=x.SheetNames),a.bookProps&&(D.Props=x,D.Custprops=O),a.bookSheets&&typeof u<"u"&&(D.SheetNames=u),a.bookSheets?D.SheetNames:a.bookProps))return D;u={};var I={};a.bookDeps&&s.calcchain&&(I=P8(mr(e,sa(s.calcchain)),s.calcchain));var M=0,G={},te,b;{var P=S.Sheets;x.Worksheets=P.length,x.SheetNames=[];for(var Ee=0;Ee!=P.length;++Ee)x.SheetNames[Ee]=P[Ee].name}var fe=f?"bin":"xml",H=s.workbooks[0].lastIndexOf("/"),oe=(s.workbooks[0].slice(0,H+1)+"_rels/"+s.workbooks[0].slice(H+1)+".rels").replace(/^\//,"");oa(e,oe)||(oe="xl/_rels/workbook."+fe+".rels");var R=ki(Kr(e,oe,!0),oe.replace(/_rels.*/,"s5s"));(s.metadata||[]).length>=1&&(a.xlmeta=H8(mr(e,sa(s.metadata[0])),s.metadata[0],a)),(s.people||[]).length>=1&&(a.people=w4(mr(e,sa(s.people[0])),a)),R&&(R=x7(R,S.Sheets));var K=mr(e,"xl/worksheets/sheet.xml",!0)?1:0;e:for(M=0;M!=x.Worksheets;++M){var he="sheet";if(R&&R[M]?(te="xl/"+R[M][1].replace(/[\/]?xl\//,""),oa(e,te)||(te=R[M][1]),oa(e,te)||(te=oe.replace(/_rels\/.*$/,"")+R[M][1]),he=R[M][2]):(te="xl/worksheets/sheet"+(M+1-K)+"."+fe,te=te.replace(/sheet0\./,"sheet.")),b=te.replace(/^(.*)(\/)([^\/]*)$/,"$1/_rels/$3.rels"),a&&a.sheets!=null)switch(typeof a.sheets){case"number":if(M!=a.sheets)continue e;break;case"string":if(x.SheetNames[M].toLowerCase()!=a.sheets.toLowerCase())continue e;break;default:if(Array.isArray&&Array.isArray(a.sheets)){for(var z=!1,Ie=0;Ie!=a.sheets.length;++Ie)typeof a.sheets[Ie]=="number"&&a.sheets[Ie]==M&&(z=1),typeof a.sheets[Ie]=="string"&&a.sheets[Ie].toLowerCase()==x.SheetNames[M].toLowerCase()&&(z=1);if(!z)continue e}}y7(e,te,b,x.SheetNames[M],M,G,u,he,a,S,C,T)}return D={Directory:s,Workbook:S,Props:x,Custprops:O,Deps:I,Sheets:u,SheetNames:x.SheetNames,Strings:zi,Styles:T,Themes:C,SSF:vr(Mt)},a&&a.bookFiles&&(e.files?(D.keys=o,D.files=e.files):(D.keys=[],D.files={},e.FullPaths.forEach(function(Ne,xe){Ne=Ne.replace(/^Root Entry[\/]/,""),D.keys.push(Ne),D.files[Ne]=e.FileIndex[xe]}))),a&&a.bookVBA&&(s.vba.length>0?D.vbaraw=mr(e,sa(s.vba[0]),!0):s.defaults&&s.defaults.bin===R4&&(D.vbaraw=mr(e,"xl/vbaProject.bin",!0))),D}function F7(e,a){var t=a||{},o="Workbook",s=Bt.find(e,o);try{if(o="/!DataSpaces/Version",s=Bt.find(e,o),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+o);if(gd(s.content),o="/!DataSpaces/DataSpaceMap",s=Bt.find(e,o),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+o);var f=Cd(s.content);if(f.length!==1||f[0].comps.length!==1||f[0].comps[0].t!==0||f[0].name!=="StrongEncryptionDataSpace"||f[0].comps[0].v!=="EncryptedPackage")throw new Error("ECMA-376 Encrypted file bad "+o);if(o="/!DataSpaces/DataSpaceInfo/StrongEncryptionDataSpace",s=Bt.find(e,o),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+o);var u=_d(s.content);if(u.length!=1||u[0]!="StrongEncryptionTransform")throw new Error("ECMA-376 Encrypted file bad "+o);if(o="/!DataSpaces/TransformInfo/StrongEncryptionTransform/!Primary",s=Bt.find(e,o),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+o);Sd(s.content)}catch{}if(o="/EncryptionInfo",s=Bt.find(e,o),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+o);var h=xd(s.content);if(o="/EncryptedPackage",s=Bt.find(e,o),!s||!s.content)throw new Error("ECMA-376 Encrypted file missing "+o);if(h[0]==4&&typeof decrypt_agile<"u")return decrypt_agile(h[1],s.content,t.password||"",t);if(h[0]==2&&typeof decrypt_std76<"u")return decrypt_std76(h[1],s.content,t.password||"",t);throw new Error("File is password-protected")}function xo(e,a){var t="";switch((a||{}).type||"base64"){case"buffer":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];case"base64":t=jr(e.slice(0,12));break;case"binary":t=e;break;case"array":return[e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]];default:throw new Error("Unrecognized type "+(a&&a.type||"undefined"))}return[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3),t.charCodeAt(4),t.charCodeAt(5),t.charCodeAt(6),t.charCodeAt(7)]}function O7(e,a){return Bt.find(e,"EncryptedPackage")?F7(e,a):xs(e,a)}function I7(e,a){var t,o=e,s=a||{};return s.type||(s.type=Nt&&Buffer.isBuffer(e)?"buffer":"base64"),t=Rl(o,s),v7(t,s)}function bs(e,a){var t=0;e:for(;t<e.length;)switch(e.charCodeAt(t)){case 10:case 13:case 32:++t;break;case 60:return po(e.slice(t),a);default:break e}return Li.to_workbook(e,a)}function D7(e,a){var t="",o=xo(e,a);switch(a.type){case"base64":t=jr(e);break;case"binary":t=e;break;case"buffer":t=e.toString("binary");break;case"array":t=ja(e);break;default:throw new Error("Unrecognized type "+a.type)}return o[0]==239&&o[1]==187&&o[2]==191&&(t=er(t)),a.type="binary",bs(t,a)}function A7(e,a){var t=e;return a.type=="base64"&&(t=jr(t)),t=Rn.utils.decode(1200,t.slice(2),"str"),a.type="binary",bs(t,a)}function w7(e){return e.match(/[^\x00-\x7F]/)?Fi(e):e}function yo(e,a,t,o){return o?(t.type="string",Li.to_workbook(e,t)):Li.to_workbook(a,t)}function vo(e,a){rl();var t=a||{};if(typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer)return vo(new Uint8Array(e),(t=vr(t),t.type="array",t));typeof Uint8Array<"u"&&e instanceof Uint8Array&&!t.type&&(t.type=typeof Deno<"u"?"buffer":"array");var o=e,s=[0,0,0,0],f=!1;if(t.cellStyles&&(t.cellNF=!0,t.sheetStubs=!0),gi={},t.dateNF&&(gi.dateNF=t.dateNF),t.type||(t.type=Nt&&Buffer.isBuffer(e)?"buffer":"base64"),t.type=="file"&&(t.type=Nt?"buffer":"binary",o=gc(e),typeof Uint8Array<"u"&&!Nt&&(t.type="array")),t.type=="string"&&(f=!0,t.type="binary",t.codepage=65001,o=w7(e)),t.type=="array"&&typeof Uint8Array<"u"&&e instanceof Uint8Array&&typeof ArrayBuffer<"u"){var u=new ArrayBuffer(3),h=new Uint8Array(u);if(h.foo="bar",!h.foo)return t=vr(t),t.type="array",vo(Nn(o),t)}switch((s=xo(o,t))[0]){case 208:if(s[1]===207&&s[2]===17&&s[3]===224&&s[4]===161&&s[5]===177&&s[6]===26&&s[7]===225)return O7(Bt.read(o,t),t);break;case 9:if(s[1]<=8)return xs(o,t);break;case 60:return po(o,t);case 73:if(s[1]===73&&s[2]===42&&s[3]===0)throw new Error("TIFF Image File is not a spreadsheet");if(s[1]===68)return ad(o,t);break;case 84:if(s[1]===65&&s[2]===66&&s[3]===76)return td.to_workbook(o,t);break;case 80:return s[1]===75&&s[2]<9&&s[3]<9?I7(o,t):yo(e,o,t,f);case 239:return s[3]===60?po(o,t):yo(e,o,t,f);case 255:if(s[1]===254)return A7(o,t);if(s[1]===0&&s[2]===2&&s[3]===0)return Pi.to_workbook(o,t);break;case 0:if(s[1]===0&&(s[2]>=2&&s[3]===0||s[2]===0&&(s[3]===8||s[3]===9)))return Pi.to_workbook(o,t);break;case 3:case 131:case 139:case 140:return G0.to_workbook(o,t);case 123:if(s[1]===92&&s[2]===114&&s[3]===116)return Rd.to_workbook(o,t);break;case 10:case 13:case 32:return D7(o,t);case 137:if(s[1]===80&&s[2]===78&&s[3]===71)throw new Error("PNG Image File is not a spreadsheet");break}return Z2.indexOf(s[0])>-1&&s[2]<=12&&s[3]<=31?G0.to_workbook(o,t):yo(e,o,t,f)}function M7(e,a,t,o,s,f,u,h){var C=Or(t),T=h.defval,S=h.raw||!Object.prototype.hasOwnProperty.call(h,"raw"),x=!0,y=s===1?[]:{};if(s!==1)if(Object.defineProperty)try{Object.defineProperty(y,"__rowNum__",{value:t,enumerable:!1})}catch{y.__rowNum__=t}else y.__rowNum__=t;if(!u||e[t])for(var O=a.s.c;O<=a.e.c;++O){var D=u?e[t][O]:e[o[O]+C];if(D===void 0||D.t===void 0){if(T===void 0)continue;f[O]!=null&&(y[f[O]]=T);continue}var I=D.v;switch(D.t){case"z":if(I==null)break;continue;case"e":I=I==0?null:void 0;break;case"s":case"d":case"b":case"n":break;default:throw new Error("unrecognized type "+D.t)}if(f[O]!=null){if(I==null)if(D.t=="e"&&I===null)y[f[O]]=null;else if(T!==void 0)y[f[O]]=T;else if(S&&I===null)y[f[O]]=null;else continue;else y[f[O]]=S&&(D.t!=="n"||D.t==="n"&&h.rawNumbers!==!1)?I:Ma(D,I,h);I!=null&&(x=!1)}}return{row:y,isempty:x}}function Fo(e,a){if(e==null||e["!ref"]==null)return[];var t={t:"n",v:0},o=0,s=1,f=[],u=0,h="",C={s:{r:0,c:0},e:{r:0,c:0}},T=a||{},S=T.range!=null?T.range:e["!ref"];switch(T.header===1?o=1:T.header==="A"?o=2:Array.isArray(T.header)?o=3:T.header==null&&(o=0),typeof S){case"string":C=fr(S);break;case"number":C=fr(e["!ref"]),C.s.r=S;break;default:C=S}o>0&&(s=0);var x=Or(C.s.r),y=[],O=[],D=0,I=0,M=Array.isArray(e),G=C.s.r,te=0,b={};M&&!e[G]&&(e[G]=[]);var P=T.skipHidden&&e["!cols"]||[],Ee=T.skipHidden&&e["!rows"]||[];for(te=C.s.c;te<=C.e.c;++te)if(!(P[te]||{}).hidden)switch(y[te]=_r(te),t=M?e[G][te]:e[y[te]+x],o){case 1:f[te]=te-C.s.c;break;case 2:f[te]=y[te];break;case 3:f[te]=T.header[te-C.s.c];break;default:if(t==null&&(t={w:"__EMPTY",t:"s"}),h=u=Ma(t,null,T),I=b[u]||0,!I)b[u]=1;else{do h=u+"_"+I++;while(b[h]);b[u]=I,b[h]=1}f[te]=h}for(G=C.s.r+s;G<=C.e.r;++G)if(!(Ee[G]||{}).hidden){var fe=M7(e,C,G,y,o,f,M,T);(fe.isempty===!1||(o===1?T.blankrows!==!1:T.blankrows))&&(O[D++]=fe.row)}return O.length=D,O}var Rs=/"/g;function k7(e,a,t,o,s,f,u,h){for(var C=!0,T=[],S="",x=Or(t),y=a.s.c;y<=a.e.c;++y)if(o[y]){var O=h.dense?(e[t]||[])[y]:e[o[y]+x];if(O==null)S="";else if(O.v!=null){C=!1,S=""+(h.rawNumbers&&O.t=="n"?O.v:Ma(O,null,h));for(var D=0,I=0;D!==S.length;++D)if((I=S.charCodeAt(D))===s||I===f||I===34||h.forceQuotes){S='"'+S.replace(Rs,'""')+'"';break}S=="ID"&&(S='"ID"')}else O.f!=null&&!O.F?(C=!1,S="="+O.f,S.indexOf(",")>=0&&(S='"'+S.replace(Rs,'""')+'"')):S="";T.push(S)}return h.blankrows===!1&&C?null:T.join(u)}function Ns(e,a){var t=[],o=a??{};if(e==null||e["!ref"]==null)return"";var s=fr(e["!ref"]),f=o.FS!==void 0?o.FS:",",u=f.charCodeAt(0),h=o.RS!==void 0?o.RS:`
37
37
  `,C=h.charCodeAt(0),T=new RegExp((f=="|"?"\\|":f)+"+$"),S="",x=[];o.dense=Array.isArray(e);for(var y=o.skipHidden&&e["!cols"]||[],O=o.skipHidden&&e["!rows"]||[],D=s.s.c;D<=s.e.c;++D)(y[D]||{}).hidden||(x[D]=_r(D));for(var I=0,M=s.s.r;M<=s.e.r;++M)(O[M]||{}).hidden||(S=k7(e,s,M,x,u,C,f,o),S!=null&&(o.strip&&(S=S.replace(T,"")),(S||o.blankrows!==!1)&&t.push((I++?h:"")+S)));return delete o.dense,t.join("")}function b7(e,a){a||(a={}),a.FS=" ",a.RS=`
38
- `;var t=Ns(e,a);return t}function R7(e){var a="",t,o="";if(e==null||e["!ref"]==null)return[];var s=fr(e["!ref"]),f="",u=[],h,C=[],T=Array.isArray(e);for(h=s.s.c;h<=s.e.c;++h)u[h]=_r(h);for(var S=s.s.r;S<=s.e.r;++S)for(f=Or(S),h=s.s.c;h<=s.e.c;++h)if(a=u[h]+f,t=T?(e[S]||[])[h]:e[a],o="",t!==void 0){if(t.F!=null){if(a=t.F,!t.f)continue;o=t.f,a.indexOf(":")==-1&&(a=a+":"+a)}if(t.f!=null)o=t.f;else{if(t.t=="z")continue;if(t.t=="n"&&t.v!=null)o=""+t.v;else if(t.t=="b")o=t.v?"TRUE":"FALSE";else if(t.w!==void 0)o="'"+t.w;else{if(t.v===void 0)continue;t.t=="s"?o="'"+t.v:o=""+t.v}}C[C.length]=a+"="+o}return C}function Ls(e,a,t){var o=t||{},s=+!o.skipHeader,f=e||{},u=0,h=0;if(f&&o.origin!=null)if(typeof o.origin=="number")u=o.origin;else{var C=typeof o.origin=="string"?Ur(o.origin):o.origin;u=C.r,h=C.c}var T,S={s:{c:0,r:0},e:{c:h,r:u+a.length-1+s}};if(f["!ref"]){var x=fr(f["!ref"]);S.e.c=Math.max(S.e.c,x.e.c),S.e.r=Math.max(S.e.r,x.e.r),u==-1&&(u=x.e.r+1,S.e.r=u+a.length-1+s)}else u==-1&&(u=0,S.e.r=a.length-1+s);var y=o.header||[],O=0;a.forEach(function(I,M){xa(I).forEach(function(G){(O=y.indexOf(G))==-1&&(y[O=y.length]=G);var te=I[G],b="z",P="",Ee=It({c:h+O,r:u+M+s});T=Xi(f,Ee),te&&typeof te=="object"&&!(te instanceof Date)?f[Ee]=te:(typeof te=="number"?b="n":typeof te=="boolean"?b="b":typeof te=="string"?b="s":te instanceof Date?(b="d",o.cellDates||(b="n",te=Vr(te)),P=o.dateNF||Mt[14]):te===null&&o.nullError&&(b="e",te=0),T?(T.t=b,T.v=te,delete T.w,delete T.R,P&&(T.z=P)):f[Ee]=T={t:b,v:te},P&&(T.z=P))})}),S.e.c=Math.max(S.e.c,h+y.length-1);var D=Or(u);if(s)for(O=0;O<y.length;++O)f[_r(O+h)+D]={t:"s",v:y[O]};return f["!ref"]=Ht(S),f}function N7(e,a){return Ls(null,e,a)}function Xi(e,a,t){if(typeof a=="string"){if(Array.isArray(e)){var o=Ur(a);return e[o.r]||(e[o.r]=[]),e[o.r][o.c]||(e[o.r][o.c]={t:"z"})}return e[a]||(e[a]={t:"z"})}return typeof a!="number"?Xi(e,It(a)):Xi(e,It({r:a,c:t||0}))}function L7(e,a){if(typeof a=="number"){if(a>=0&&e.SheetNames.length>a)return a;throw new Error("Cannot find sheet # "+a)}else if(typeof a=="string"){var t=e.SheetNames.indexOf(a);if(t>-1)return t;throw new Error("Cannot find sheet name |"+a+"|")}else throw new Error("Cannot find sheet |"+a+"|")}function Oo(){return{SheetNames:[],Sheets:{}}}function Io(e,a,t,o){var s=1;if(!t)for(;s<=65535&&e.SheetNames.indexOf(t="Sheet"+s)!=-1;++s,t=void 0);if(!t||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(o&&e.SheetNames.indexOf(t)>=0){var f=t.match(/(^.*?)(\d+)$/);s=f&&+f[2]||0;var u=f&&f[1]||t;for(++s;s<=65535&&e.SheetNames.indexOf(t=u+s)!=-1;++s);}if(T8(t),e.SheetNames.indexOf(t)>=0)throw new Error("Worksheet with name |"+t+"| already exists!");return e.SheetNames.push(t),e.Sheets[t]=a,t}function P7(e,a,t){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var o=L7(e,a);switch(e.Workbook.Sheets[o]||(e.Workbook.Sheets[o]={}),t){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+t)}e.Workbook.Sheets[o].Hidden=t}function B7(e,a){return e.z=a,e}function Ps(e,a,t){return a?(e.l={Target:a},t&&(e.l.Tooltip=t)):delete e.l,e}function H7(e,a,t){return Ps(e,"#"+a,t)}function V7(e,a,t){e.c||(e.c=[]),e.c.push({t:a,a:t||"SheetJS"})}function U7(e,a,t,o){for(var s=typeof a!="string"?a:fr(a),f=typeof a=="string"?a:Ht(a),u=s.s.r;u<=s.e.r;++u)for(var h=s.s.c;h<=s.e.c;++h){var C=Xi(e,u,h);C.t="n",C.F=f,delete C.v,u==s.s.r&&h==s.s.c&&(C.f=t,o&&(C.D=!0))}return e}var G7={encode_col:_r,encode_row:Or,encode_cell:It,encode_range:Ht,decode_col:Qn,decode_row:Xn,split_cell:Jc,decode_cell:Ur,decode_range:fi,format_cell:Ma,sheet_add_aoa:d0,sheet_add_json:Ls,sheet_add_dom:vs,aoa_to_sheet:ui,json_to_sheet:N7,table_to_sheet:Fs,table_to_book:i7,sheet_to_csv:Ns,sheet_to_txt:b7,sheet_to_json:Fo,sheet_to_html:a7,sheet_to_formulae:R7,sheet_to_row_object_array:Fo,sheet_get_cell:Xi,book_new:Oo,book_append_sheet:Io,book_set_sheet_visibility:P7,cell_set_number_format:B7,cell_set_hyperlink:Ps,cell_set_internal_link:H7,cell_add_comment:V7,sheet_set_array_formula:U7,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const z7=it.createFromIconfontCN({scriptUrl:Promise.resolve().then(()=>zs)});F.ER=void 0,(e=>{var oe,K,he,z,Ie,Ne,xe,Le,ve,Ge,_e,$e,_a,Bo;class a{constructor(){ta(this,oe);j(this,"_events",{});jt(this,oe,t.guid()),this._events={}}}oe=new WeakMap,e.Class=a;const R=class R{static guid(){const r="abcdef";let i=""+r[Math.floor(Math.random()*Math.floor(r.length))];for(let n=1;n<32;n++){const c=Math.random()*16|0;(n===8||n===12||n===16||n===20)&&(i+="-"),i+=(n===12?4:n===16?c&3|8:c).toString(16)}return i}static jQuery(r){let i;return r&&(i=Xs(r)),i}static camelCase(r){return r.toLowerCase().replace(/_([a-z])/g,(i,n)=>n.toUpperCase()).replace(/^([a-z])/,(i,n)=>n.toLowerCase())||""}static isValidRegex(r){try{return new RegExp(r),!0}catch{return!1}}static encryptData(r,i,n){const c=fa.enc.Utf8.parse(i),d=fa.enc.Utf8.parse(n);return fa.TripleDES.encrypt(r,c,{iv:d,mode:fa.mode.CBC,padding:fa.pad.Pkcs7}).toString()}static decryptData(r,i,n){const c=fa.enc.Utf8.parse(i),d=fa.enc.Utf8.parse(n);return fa.TripleDES.decrypt(r,c,{iv:d,mode:fa.mode.CBC,padding:fa.pad.Pkcs7}).toString(fa.enc.Utf8)}static getLangList(){return[{key:"zh_Hans",value:"简体中文"},{key:"zh_Hant",value:"繁體中文"},{key:"en",value:"English"},{key:"ar",value:"العربية"},{key:"id",value:"Bahasa Indonesia"}]}static async getErxGlobalConfig(r=!0){try{const i=this.getBaseUrl(),n=+new Date,c=r?`${i}config/erxConfig.json?ver=${n}`:`${i}config/erxConfig.json`,d=await fetch(c);if(d.ok){const p=d.headers.get("content-type");return!p||!p.includes("application/json")?(console.error("ER: Response is not JSON type"),null):await d.json()}}catch(i){console.error("ER: Failed to get or parse config:",i)}return null}static createErIconfont(r){const i=it.createFromIconfontCN({scriptUrl:Promise.resolve().then(()=>zs)});return l.h(i,{type:r})}static createErIconVNode(r,i){const n=`iconfont icon-${r} er-iconfont`,c={width:"16px",height:"16px",...i};return l.h("i",{class:n,style:c})}static createErSvgVNode(r,i){return i=i||{class:"icon",ariaHidden:!0},l.h("svg",i,l.h("use",{"xlink:href":`#icon-${r}`}))}static createRemoteImgVNode(r,i){return i=i||{class:"er-remote-img"},i.src=`${this.getBaseUrl()}svg/${r}`,l.h("img",i)}static createRemoteImgElement(r,i){const n=document.createElement("div");n.style.height="16px",n.style.width="16px";let c=this.createRemoteImgVNode(r,i);return c&&l.render(c,n),n}static createErIconElement(r,i){const n=document.createElement("div");let c;return typeof r=="string"?c=this.createErIconVNode(r,i):r&&(c=r),c&&l.render(c,n),n}static createErSvgElement(r,i){const n=document.createElement("div");n.style.height="16px",n.style.width="16px";let c;return typeof r=="string"?c=this.createErSvgVNode(r,i):r&&(c=r),c&&l.render(c,n),n}static createVNodeElement(r){const i=document.createElement("div");return r&&l.render(r,i),i}static getBaseUrl(){var i;return((i=window.APP_OPTIONS)==null?void 0:i.appContext)??process.env.VITE_APP_PUBLISH_PATH??"/"}static toString(r,i=!1,n="default"){if(r==null)return"";if(typeof r=="string"&&String(r).trim().length===0)return"";if(r instanceof Array&&r.length===0)return"";let c=i?String(r).trim():String(r);return c=n==="toLower"?c.toLowerCase():n==="toUpper"?c.toUpperCase():c,c}static toNumber(r){if(r==null)return 0;if(typeof r=="string"){const i=r.trim();if(i.length===0||i==="\uFEFF")return 0;if(i.endsWith("‰")){const n=i.slice(0,-1).replace(/,/g,""),c=parseFloat(n);return isNaN(c)?0:c/1e3}else if(i.endsWith("%")){const n=i.slice(0,-1).replace(/,/g,""),c=parseFloat(n);return isNaN(c)?0:c/100}else{const n=i.replace(/,/g,"").replace(/[^0-9.-]/g,"");return parseFloat(n)}}else return typeof r=="boolean"?r===!0?1:0:r instanceof Date?0:parseFloat(r)}static toBoolean(r){if(r==null)return!1;if(typeof r=="string"){const i=this.toString(r,!0).toLowerCase();return i.length>0&&i!=="false"&&i!=="0"}else return typeof r=="number"?this.toNumber(r)>0:typeof r=="boolean"?r:r instanceof Date}static toDateTime(r,i="Dayjs"){let n=null;if(r){if(typeof r=="string"){if(r.trim().length===0)return null;if(Ut(r).isValid()){if(i==="Date")return Ut(r).toDate();if(i==="Dayjs")return Ut(r)}const c=new Date,d=c.getFullYear().toString();let p=(c.getMonth()+1).toString(),m=c.getDate().toString(),_=c.getHours().toString(),E=c.getMinutes().toString(),v=c.getSeconds().toString();p=p.length===1?"0"+p:p,m=m.length===1?"0"+m:m,_=_.length===1?"0"+_:_,E=E.length===1?"0"+E:E,v=v.length===1?"0"+v:v,r=r.trim().replaceAll(" ","").replaceAll("/","").replaceAll("-","").replaceAll(":","").replaceAll("T","").replaceAll("yyyy",d).replaceAll("MM",p).replaceAll("dd",m).replaceAll("HH",_).replaceAll("mm",E).replaceAll("ss",v);let A=1,B=1,Q=1,N=0,W=0,J=0;r.length>=4&&(A=this.toNumber(r.substring(0,4))||1),r.length>=6&&(B=this.toNumber(r.substring(4,6))||1),r.length>=8&&(Q=this.toNumber(r.substring(6,8))||1),r.length>=10&&(N=this.toNumber(r.substring(8,10))),r.length>=12&&(W=this.toNumber(r.substring(10,12))),r.length>=14&&(J=this.toNumber(r.substring(12,14))),A!==1&&A!==1900&&(n=new Date(A,B-1,Q,N,W,J))}else if(r instanceof Date)n=r;else if(Ut.isDayjs(r)){if(i==="Dayjs")return r;n=r.toDate()}if(i==="Dayjs")return Ut(n)}return n}static getDateTimeFormatString(r,i){let n="";if(i=R.toString(i,!0)||"YYYY-MM-DD HH:mm:ss",i=i.replaceAll("y","Y").replaceAll("d","D"),r==null)return"";if(typeof r=="string"&&(r=this.getDateTimeByString(r)),r&&Ut.isDayjs(r))n=r.format(i);else if(r&&r instanceof Date)n=Ut(r).format(i);else return"";return n}static isNullOrEmpty(r){return r==null||typeof r=="string"&&String(r).trim().length===0||typeof r=="number"&&r===0?!0:r instanceof Array&&r.length===0}static getMaxNumber(r,i=0){let n=0;if(r>0){i>0&&r>=i?n=r-i:(n=r,i=0);const c="9".repeat(n),d="9".repeat(i);return parseFloat(`${c}.${d}`)}else return Number.MAX_VALUE}static excuteScript(r){const i=Function;try{const n=new Date;return new i(r)()}catch{console.error("ER: Script has a syntax error: "+r)}}static isUrl(r){return new RegExp("^(http|https)://[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*(:[0-9]+)?(/.*)?$").test(r)}static getQueryParams(r){var n;const i=(n=r==null?void 0:r.split("?"))==null?void 0:n[1];return i?JSON.parse('{"'+decodeURI(i).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'):{}}static $t(r,i){var c,d;let n=(d=(c=R1())==null?void 0:c.global)==null?void 0:d.t(r,i);return n===r?"":n}static saveAsJsonFile(r,i){const n=JSON.stringify(r),c=new Blob([n],{type:"application/json"}),d=URL.createObjectURL(c),p=document.createElement("a");p.href=d,p.download=(i||Ut().format("YYYY-MM-DD HH:mm:ss"))+".json",p.click(),URL.revokeObjectURL(d)}static readFiles(r,i){const n=document.createElement("input");n.type=(i==null?void 0:i.type)||"file",n.accept=(i==null?void 0:i.accept)||".json",n.multiple=i==null?void 0:i.multiple,n.onchange=c=>{r&&r instanceof Function&&r(c.target.files)},n.click()}static readExcelFile(r){const i=document.createElement("input");i.type="file",i.accept=".xlsx, .xls",i.multiple=!1,i.onchange=n=>{for(let c=0;c<n.target.files.length;c++){const d=new FileReader;d.onload=p=>{const m=vo(p.target.result,{type:"array"}),_=[];m.SheetNames.forEach(E=>{_.push({label:E,value:E})}),e.Core.openSelectOptionsModal({radioGroups:[{title:e.Core.$t("ERX.ErGrid.ImportOptionsImportSheet")||"导入Sheet",key:"importSheet",options:_}],inputOptions:[{title:e.Core.$t("ERX.ErGrid.ImportOptionsHeaderRowsCount")||"导入表头行数",key:"headerRowsCount",type:"inputNumber",style:{width:"50%"}}],title:e.Core.$t("ERX.ErGrid.ImportOptions")||"导入选项",default:{radioGroups:{importSheet:m.SheetNames[0]},inputOptions:{headerRowsCount:1}}},E=>{var B,Q,N,W;let v;(B=E.radios)!=null&&B.importSheet&&m.Sheets[(Q=E.radios)==null?void 0:Q.importSheet]?v=m.Sheets[(N=E.radios)==null?void 0:N.importSheet]:v=m.Sheets[m.SheetNames[0]];const A=((W=E.inputs)==null?void 0:W.headerRowsCount)||1;if(v){const J=G7.sheet_to_json(v,{range:A-1});r&&r(J)}else et.message.error("Read Excel File Error")})},d.readAsArrayBuffer(n.target.files[c])}},i.click()}static importExcelFile(r,i,n){var c,d;((d=(c=r==null?void 0:r.gridOptions)==null?void 0:c.context)==null?void 0:d.bindingSource)instanceof S&&this.readExcelFile(p=>{var m,_,E;if(p.length>0){const v=Object.keys(p[0]),A={},B=(m=r==null?void 0:r.gridOptions)==null?void 0:m.columnApi.getColumns(),Q=(E=(_=r==null?void 0:r.gridOptions)==null?void 0:_.context)==null?void 0:E.bindingSource;v.forEach(re=>{var Se,ue;if(re&&!re.startsWith("__EMPTY"))for(let me=0;me<B.length;me++){const Z=B[me].getColDef(),Te=(Se=Z.headerName)==null?void 0:Se.replace(/<\/?\s*br\s*\/?>/gi,"").replace(/\s+/g,"").trim(),ce=re.replace(/<br\s*\/?>/gi,"").replace(/\s+/g,"").trim();if((Te===ce||Z.field===ce)&&Z.field&&((ue=Q.options.schema)!=null&&ue[Z.field])){A[Z.field]={dataKey:re,colDef:Z};break}}});const N={},W=(re,Se)=>{var ue,me,Z;if(re==null)return"";if(N[Se.field]=N[Se.field]||{},N[re])return N[re];if((ue=Se.refData)!=null&&ue[re])return re;{if(R.toString(re).includes("|")){const ce=re.split("|");if((me=Se.refData)!=null&&me[ce[0]])return ce[0]}else if(R.toString(re).includes("-")){const ce=re.split("-");if((Z=Se.refData)!=null&&Z[ce[0]])return ce[0]}const Te=Object.keys(Se.refData).find(ce=>Se.refData[ce]===R.toString(re)||`${ce}|${Se.refData[ce]}`===R.toString(re)||`${ce}-${Se.refData[ce]}`===R.toString(re));return Te?(N[Se.field][re]=Te,Te):""}},J=[];p.forEach(re=>{if(re.__EMPTY!==(e.Core.$t("ERX.Aggregate")||"总计")&&re.__EMPTY!==(e.Core.$t("ERX.GroupAggregate")||"小计")){const Se={};Object.keys(A).forEach(ue=>{var me;re[A[ue].dataKey]&&(Se[A[ue].colDef.field]=re[A[ue].dataKey],A[ue].colDef.refData&&((me=A[ue].colDef.cellEditor)==null?void 0:me.name)==="DropdownEditor"&&(Se[A[ue].colDef.field]=W(Se[A[ue].colDef.field],A[ue].colDef)))}),i&&i instanceof Function?i(Se)&&J.push(Se):J.push(Se)}}),n&&n instanceof Function?n(J):Q.import(J)}})}static colorIsTransparentOrEmpty(r){if(r==null)return!0;if(r)if(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([01]?(\.\d+)?)\)/i.test(r)){const i=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([01]?(\.\d+)?)\)/i);return parseFloat(i[4])===0}else{if(/^#([0-9a-fA-F]{3}){1,2}([0-9a-fA-F]{2})?$/.test(r))return(r.length===9?r.slice(7,9):r.length===5?r.slice(4):null)==="00";if(r.toLowerCase()==="transparent"||r.toLowerCase()==="0, 0, 0, 0"||r.toLowerCase()==="rgba(0, 0, 0, 0)"||r.toLowerCase()==="255, 255, 255, 1"||r.toLowerCase()==="rgba(255, 255, 255, 1)")return!0}return!0}static toHexColor(r){if(r){const i=n=>{const c=n.toString(16);return c.length===1?"0"+c:c};if(this.toString(r).indexOf("#")===0)return r;if(r.includes(",")){r=r.replace(/rgba|\(|\)/gi,"");const n=r.split(",");if(n.length>=2){const c=this.toNumber(n[0]),d=this.toNumber(n[1]),p=this.toNumber(n[2]);return`#${i(c)}${i(d)}${i(p)}`}}else if(r.startsWith("-")){r=this.toNumber(r);const n=r>>16&255,c=r>>8&255,d=r&255,p=r>>24&255;return n===255&&c===255&&d===255&&p===0?"":`#${i(n)}${i(c)}${i(d)}`}}return""}static hexToRgba(r){if(r.indexOf("rgb")===0)return r;r=r.replace("#","");const i=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),c=parseInt(r.substring(4,6),16);return`rgba(${i},${n},${c},1)`}static getGridHeaderTemplate(r){return`<div class="ag-cell-label-container" style="background-color:${(r==null?void 0:r.backgroundColor)||""}" role="presentation">`+((r==null?void 0:r.simpleHeader)!==!0?'<span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>':"")+`<div ref="eLabel" class="ag-header-cell-label" role="presentation">
38
+ `;var t=Ns(e,a);return t}function R7(e){var a="",t,o="";if(e==null||e["!ref"]==null)return[];var s=fr(e["!ref"]),f="",u=[],h,C=[],T=Array.isArray(e);for(h=s.s.c;h<=s.e.c;++h)u[h]=_r(h);for(var S=s.s.r;S<=s.e.r;++S)for(f=Or(S),h=s.s.c;h<=s.e.c;++h)if(a=u[h]+f,t=T?(e[S]||[])[h]:e[a],o="",t!==void 0){if(t.F!=null){if(a=t.F,!t.f)continue;o=t.f,a.indexOf(":")==-1&&(a=a+":"+a)}if(t.f!=null)o=t.f;else{if(t.t=="z")continue;if(t.t=="n"&&t.v!=null)o=""+t.v;else if(t.t=="b")o=t.v?"TRUE":"FALSE";else if(t.w!==void 0)o="'"+t.w;else{if(t.v===void 0)continue;t.t=="s"?o="'"+t.v:o=""+t.v}}C[C.length]=a+"="+o}return C}function Ls(e,a,t){var o=t||{},s=+!o.skipHeader,f=e||{},u=0,h=0;if(f&&o.origin!=null)if(typeof o.origin=="number")u=o.origin;else{var C=typeof o.origin=="string"?Ur(o.origin):o.origin;u=C.r,h=C.c}var T,S={s:{c:0,r:0},e:{c:h,r:u+a.length-1+s}};if(f["!ref"]){var x=fr(f["!ref"]);S.e.c=Math.max(S.e.c,x.e.c),S.e.r=Math.max(S.e.r,x.e.r),u==-1&&(u=x.e.r+1,S.e.r=u+a.length-1+s)}else u==-1&&(u=0,S.e.r=a.length-1+s);var y=o.header||[],O=0;a.forEach(function(I,M){xa(I).forEach(function(G){(O=y.indexOf(G))==-1&&(y[O=y.length]=G);var te=I[G],b="z",P="",Ee=It({c:h+O,r:u+M+s});T=Xi(f,Ee),te&&typeof te=="object"&&!(te instanceof Date)?f[Ee]=te:(typeof te=="number"?b="n":typeof te=="boolean"?b="b":typeof te=="string"?b="s":te instanceof Date?(b="d",o.cellDates||(b="n",te=Vr(te)),P=o.dateNF||Mt[14]):te===null&&o.nullError&&(b="e",te=0),T?(T.t=b,T.v=te,delete T.w,delete T.R,P&&(T.z=P)):f[Ee]=T={t:b,v:te},P&&(T.z=P))})}),S.e.c=Math.max(S.e.c,h+y.length-1);var D=Or(u);if(s)for(O=0;O<y.length;++O)f[_r(O+h)+D]={t:"s",v:y[O]};return f["!ref"]=Ht(S),f}function N7(e,a){return Ls(null,e,a)}function Xi(e,a,t){if(typeof a=="string"){if(Array.isArray(e)){var o=Ur(a);return e[o.r]||(e[o.r]=[]),e[o.r][o.c]||(e[o.r][o.c]={t:"z"})}return e[a]||(e[a]={t:"z"})}return typeof a!="number"?Xi(e,It(a)):Xi(e,It({r:a,c:t||0}))}function L7(e,a){if(typeof a=="number"){if(a>=0&&e.SheetNames.length>a)return a;throw new Error("Cannot find sheet # "+a)}else if(typeof a=="string"){var t=e.SheetNames.indexOf(a);if(t>-1)return t;throw new Error("Cannot find sheet name |"+a+"|")}else throw new Error("Cannot find sheet |"+a+"|")}function Oo(){return{SheetNames:[],Sheets:{}}}function Io(e,a,t,o){var s=1;if(!t)for(;s<=65535&&e.SheetNames.indexOf(t="Sheet"+s)!=-1;++s,t=void 0);if(!t||e.SheetNames.length>=65535)throw new Error("Too many worksheets");if(o&&e.SheetNames.indexOf(t)>=0){var f=t.match(/(^.*?)(\d+)$/);s=f&&+f[2]||0;var u=f&&f[1]||t;for(++s;s<=65535&&e.SheetNames.indexOf(t=u+s)!=-1;++s);}if(T8(t),e.SheetNames.indexOf(t)>=0)throw new Error("Worksheet with name |"+t+"| already exists!");return e.SheetNames.push(t),e.Sheets[t]=a,t}function P7(e,a,t){e.Workbook||(e.Workbook={}),e.Workbook.Sheets||(e.Workbook.Sheets=[]);var o=L7(e,a);switch(e.Workbook.Sheets[o]||(e.Workbook.Sheets[o]={}),t){case 0:case 1:case 2:break;default:throw new Error("Bad sheet visibility setting "+t)}e.Workbook.Sheets[o].Hidden=t}function B7(e,a){return e.z=a,e}function Ps(e,a,t){return a?(e.l={Target:a},t&&(e.l.Tooltip=t)):delete e.l,e}function H7(e,a,t){return Ps(e,"#"+a,t)}function V7(e,a,t){e.c||(e.c=[]),e.c.push({t:a,a:t||"SheetJS"})}function U7(e,a,t,o){for(var s=typeof a!="string"?a:fr(a),f=typeof a=="string"?a:Ht(a),u=s.s.r;u<=s.e.r;++u)for(var h=s.s.c;h<=s.e.c;++h){var C=Xi(e,u,h);C.t="n",C.F=f,delete C.v,u==s.s.r&&h==s.s.c&&(C.f=t,o&&(C.D=!0))}return e}var G7={encode_col:_r,encode_row:Or,encode_cell:It,encode_range:Ht,decode_col:Qn,decode_row:Xn,split_cell:Jc,decode_cell:Ur,decode_range:fi,format_cell:Ma,sheet_add_aoa:d0,sheet_add_json:Ls,sheet_add_dom:vs,aoa_to_sheet:ui,json_to_sheet:N7,table_to_sheet:Fs,table_to_book:i7,sheet_to_csv:Ns,sheet_to_txt:b7,sheet_to_json:Fo,sheet_to_html:a7,sheet_to_formulae:R7,sheet_to_row_object_array:Fo,sheet_get_cell:Xi,book_new:Oo,book_append_sheet:Io,book_set_sheet_visibility:P7,cell_set_number_format:B7,cell_set_hyperlink:Ps,cell_set_internal_link:H7,cell_add_comment:V7,sheet_set_array_formula:U7,consts:{SHEET_VISIBLE:0,SHEET_HIDDEN:1,SHEET_VERY_HIDDEN:2}};const z7=it.createFromIconfontCN({scriptUrl:Promise.resolve().then(()=>zs)});F.ER=void 0,(e=>{var oe,K,he,z,Ie,Ne,xe,Le,ve,Ge,_e,$e,_a,Bo;class a{constructor(){ta(this,oe);j(this,"_events",{});jt(this,oe,t.guid()),this._events={}}}oe=new WeakMap,e.Class=a;const R=class R{static guid(){const r="abcdef";let i=""+r[Math.floor(Math.random()*Math.floor(r.length))];for(let n=1;n<32;n++){const c=Math.random()*16|0;(n===8||n===12||n===16||n===20)&&(i+="-"),i+=(n===12?4:n===16?c&3|8:c).toString(16)}return i}static jQuery(r){let i;return r&&(i=Xs(r)),i}static camelCase(r){return/^[a-z]+([A-Z][a-z]*)*$/.test(r)?r:r.toLowerCase().replace(/_([a-z])/g,(i,n)=>n.toUpperCase()).replace(/^([a-z])/,(i,n)=>n.toLowerCase())||""}static isValidRegex(r){try{return new RegExp(r),!0}catch{return!1}}static encryptData(r,i,n){const c=fa.enc.Utf8.parse(i),d=fa.enc.Utf8.parse(n);return fa.TripleDES.encrypt(r,c,{iv:d,mode:fa.mode.CBC,padding:fa.pad.Pkcs7}).toString()}static decryptData(r,i,n){const c=fa.enc.Utf8.parse(i),d=fa.enc.Utf8.parse(n);return fa.TripleDES.decrypt(r,c,{iv:d,mode:fa.mode.CBC,padding:fa.pad.Pkcs7}).toString(fa.enc.Utf8)}static getLangList(){return[{key:"zh_Hans",value:"简体中文"},{key:"zh_Hant",value:"繁體中文"},{key:"en",value:"English"},{key:"ar",value:"العربية"},{key:"id",value:"Bahasa Indonesia"}]}static async getErxGlobalConfig(r=!0){try{const i=this.getBaseUrl(),n=+new Date,c=r?`${i}config/erxConfig.json?ver=${n}`:`${i}config/erxConfig.json`,d=await fetch(c);if(d.ok){const p=d.headers.get("content-type");return!p||!p.includes("application/json")?(console.error("ER: Response is not JSON type"),null):await d.json()}}catch(i){console.error("ER: Failed to get or parse config:",i)}return null}static createErIconfont(r){const i=it.createFromIconfontCN({scriptUrl:Promise.resolve().then(()=>zs)});return l.h(i,{type:r})}static createErIconVNode(r,i){const n=`iconfont icon-${r} er-iconfont`,c={width:"16px",height:"16px",...i};return l.h("i",{class:n,style:c})}static createErSvgVNode(r,i){return i=i||{class:"icon",ariaHidden:!0},l.h("svg",i,l.h("use",{"xlink:href":`#icon-${r}`}))}static createRemoteImgVNode(r,i){return i=i||{class:"er-remote-img"},i.src=`${this.getBaseUrl()}svg/${r}`,l.h("img",i)}static createRemoteImgElement(r,i){const n=document.createElement("div");n.style.height="16px",n.style.width="16px";let c=this.createRemoteImgVNode(r,i);return c&&l.render(c,n),n}static createErIconElement(r,i){const n=document.createElement("div");let c;return typeof r=="string"?c=this.createErIconVNode(r,i):r&&(c=r),c&&l.render(c,n),n}static createErSvgElement(r,i){const n=document.createElement("div");n.style.height="16px",n.style.width="16px";let c;return typeof r=="string"?c=this.createErSvgVNode(r,i):r&&(c=r),c&&l.render(c,n),n}static createVNodeElement(r){const i=document.createElement("div");return r&&l.render(r,i),i}static getBaseUrl(){var i;return((i=window.APP_OPTIONS)==null?void 0:i.appContext)??process.env.VITE_APP_PUBLISH_PATH??"/"}static toString(r,i=!1,n="default"){if(r==null)return"";if(typeof r=="string"&&String(r).trim().length===0)return"";if(r instanceof Array&&r.length===0)return"";let c=i?String(r).trim():String(r);return c=n==="toLower"?c.toLowerCase():n==="toUpper"?c.toUpperCase():c,c}static toNumber(r){if(r==null)return 0;if(typeof r=="string"){const i=r.trim();if(i.length===0||i==="\uFEFF")return 0;if(i.endsWith("‰")){const n=i.slice(0,-1).replace(/,/g,""),c=parseFloat(n);return isNaN(c)?0:c/1e3}else if(i.endsWith("%")){const n=i.slice(0,-1).replace(/,/g,""),c=parseFloat(n);return isNaN(c)?0:c/100}else{const n=i.replace(/,/g,"").replace(/[^0-9.-]/g,"");return parseFloat(n)}}else return typeof r=="boolean"?r===!0?1:0:r instanceof Date?0:parseFloat(r)}static toBoolean(r){if(r==null)return!1;if(typeof r=="string"){const i=this.toString(r,!0).toLowerCase();return i.length>0&&i!=="false"&&i!=="0"}else return typeof r=="number"?this.toNumber(r)>0:typeof r=="boolean"?r:r instanceof Date}static toDateTime(r,i="Dayjs"){let n=null;if(r){if(typeof r=="string"){if(r.trim().length===0)return null;if(Ut(r).isValid()){if(i==="Date")return Ut(r).toDate();if(i==="Dayjs")return Ut(r)}const c=new Date,d=c.getFullYear().toString();let p=(c.getMonth()+1).toString(),m=c.getDate().toString(),_=c.getHours().toString(),E=c.getMinutes().toString(),v=c.getSeconds().toString();p=p.length===1?"0"+p:p,m=m.length===1?"0"+m:m,_=_.length===1?"0"+_:_,E=E.length===1?"0"+E:E,v=v.length===1?"0"+v:v,r=r.trim().replaceAll(" ","").replaceAll("/","").replaceAll("-","").replaceAll(":","").replaceAll("T","").replaceAll("yyyy",d).replaceAll("MM",p).replaceAll("dd",m).replaceAll("HH",_).replaceAll("mm",E).replaceAll("ss",v);let A=1,B=1,Q=1,N=0,W=0,J=0;r.length>=4&&(A=this.toNumber(r.substring(0,4))||1),r.length>=6&&(B=this.toNumber(r.substring(4,6))||1),r.length>=8&&(Q=this.toNumber(r.substring(6,8))||1),r.length>=10&&(N=this.toNumber(r.substring(8,10))),r.length>=12&&(W=this.toNumber(r.substring(10,12))),r.length>=14&&(J=this.toNumber(r.substring(12,14))),A!==1&&A!==1900&&(n=new Date(A,B-1,Q,N,W,J))}else if(r instanceof Date)n=r;else if(Ut.isDayjs(r)){if(i==="Dayjs")return r;n=r.toDate()}if(i==="Dayjs")return Ut(n)}return n}static getDateTimeFormatString(r,i){let n="";if(i=R.toString(i,!0)||"YYYY-MM-DD HH:mm:ss",i=i.replaceAll("y","Y").replaceAll("d","D"),r==null)return"";if(typeof r=="string"&&(r=this.getDateTimeByString(r)),r&&Ut.isDayjs(r))n=r.format(i);else if(r&&r instanceof Date)n=Ut(r).format(i);else return"";return n}static isNullOrEmpty(r){return r==null||typeof r=="string"&&String(r).trim().length===0||typeof r=="number"&&r===0?!0:r instanceof Array&&r.length===0}static getMaxNumber(r,i=0){let n=0;if(r>0){i>0&&r>=i?n=r-i:(n=r,i=0);const c="9".repeat(n),d="9".repeat(i);return parseFloat(`${c}.${d}`)}else return Number.MAX_VALUE}static excuteScript(r){const i=Function;try{const n=new Date;return new i(r)()}catch{console.error("ER: Script has a syntax error: "+r)}}static isUrl(r){return new RegExp("^(http|https)://[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*(:[0-9]+)?(/.*)?$").test(r)}static getQueryParams(r){var n;const i=(n=r==null?void 0:r.split("?"))==null?void 0:n[1];return i?JSON.parse('{"'+decodeURI(i).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'):{}}static $t(r,i){var c,d;let n=(d=(c=R1())==null?void 0:c.global)==null?void 0:d.t(r,i);return n===r?"":n}static saveAsJsonFile(r,i){const n=JSON.stringify(r),c=new Blob([n],{type:"application/json"}),d=URL.createObjectURL(c),p=document.createElement("a");p.href=d,p.download=(i||Ut().format("YYYY-MM-DD HH:mm:ss"))+".json",p.click(),URL.revokeObjectURL(d)}static readFiles(r,i){const n=document.createElement("input");n.type=(i==null?void 0:i.type)||"file",n.accept=(i==null?void 0:i.accept)||".json",n.multiple=i==null?void 0:i.multiple,n.onchange=c=>{r&&r instanceof Function&&r(c.target.files)},n.click()}static readExcelFile(r){const i=document.createElement("input");i.type="file",i.accept=".xlsx, .xls",i.multiple=!1,i.onchange=n=>{for(let c=0;c<n.target.files.length;c++){const d=new FileReader;d.onload=p=>{const m=vo(p.target.result,{type:"array"}),_=[];m.SheetNames.forEach(E=>{_.push({label:E,value:E})}),e.Core.openSelectOptionsModal({radioGroups:[{title:e.Core.$t("ERX.ErGrid.ImportOptionsImportSheet")||"导入Sheet",key:"importSheet",options:_}],inputOptions:[{title:e.Core.$t("ERX.ErGrid.ImportOptionsHeaderRowsCount")||"导入表头行数",key:"headerRowsCount",type:"inputNumber",style:{width:"50%"}}],title:e.Core.$t("ERX.ErGrid.ImportOptions")||"导入选项",default:{radioGroups:{importSheet:m.SheetNames[0]},inputOptions:{headerRowsCount:1}}},E=>{var B,Q,N,W;let v;(B=E.radios)!=null&&B.importSheet&&m.Sheets[(Q=E.radios)==null?void 0:Q.importSheet]?v=m.Sheets[(N=E.radios)==null?void 0:N.importSheet]:v=m.Sheets[m.SheetNames[0]];const A=((W=E.inputs)==null?void 0:W.headerRowsCount)||1;if(v){const J=G7.sheet_to_json(v,{range:A-1});r&&r(J)}else et.message.error("Read Excel File Error")})},d.readAsArrayBuffer(n.target.files[c])}},i.click()}static importExcelFile(r,i,n){var c,d;((d=(c=r==null?void 0:r.gridOptions)==null?void 0:c.context)==null?void 0:d.bindingSource)instanceof S&&this.readExcelFile(p=>{var m,_,E;if(p.length>0){const v=Object.keys(p[0]),A={},B=(m=r==null?void 0:r.gridOptions)==null?void 0:m.columnApi.getColumns(),Q=(E=(_=r==null?void 0:r.gridOptions)==null?void 0:_.context)==null?void 0:E.bindingSource;v.forEach(re=>{var Se,ue;if(re&&!re.startsWith("__EMPTY"))for(let me=0;me<B.length;me++){const Z=B[me].getColDef(),Te=(Se=Z.headerName)==null?void 0:Se.replace(/<\/?\s*br\s*\/?>/gi,"").replace(/\s+/g,"").trim(),ce=re.replace(/<br\s*\/?>/gi,"").replace(/\s+/g,"").trim();if((Te===ce||Z.field===ce)&&Z.field&&((ue=Q.options.schema)!=null&&ue[Z.field])){A[Z.field]={dataKey:re,colDef:Z};break}}});const N={},W=(re,Se)=>{var ue,me,Z;if(re==null)return"";if(N[Se.field]=N[Se.field]||{},N[re])return N[re];if((ue=Se.refData)!=null&&ue[re])return re;{if(R.toString(re).includes("|")){const ce=re.split("|");if((me=Se.refData)!=null&&me[ce[0]])return ce[0]}else if(R.toString(re).includes("-")){const ce=re.split("-");if((Z=Se.refData)!=null&&Z[ce[0]])return ce[0]}const Te=Object.keys(Se.refData).find(ce=>Se.refData[ce]===R.toString(re)||`${ce}|${Se.refData[ce]}`===R.toString(re)||`${ce}-${Se.refData[ce]}`===R.toString(re));return Te?(N[Se.field][re]=Te,Te):""}},J=[];p.forEach(re=>{if(re.__EMPTY!==(e.Core.$t("ERX.Aggregate")||"总计")&&re.__EMPTY!==(e.Core.$t("ERX.GroupAggregate")||"小计")){const Se={};Object.keys(A).forEach(ue=>{var me;re[A[ue].dataKey]&&(Se[A[ue].colDef.field]=re[A[ue].dataKey],A[ue].colDef.refData&&((me=A[ue].colDef.cellEditor)==null?void 0:me.name)==="DropdownEditor"&&(Se[A[ue].colDef.field]=W(Se[A[ue].colDef.field],A[ue].colDef)))}),i&&i instanceof Function?i(Se)&&J.push(Se):J.push(Se)}}),n&&n instanceof Function?n(J):Q.import(J)}})}static colorIsTransparentOrEmpty(r){if(r==null)return!0;if(r)if(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([01]?(\.\d+)?)\)/i.test(r)){const i=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+),\s*([01]?(\.\d+)?)\)/i);return parseFloat(i[4])===0}else{if(/^#([0-9a-fA-F]{3}){1,2}([0-9a-fA-F]{2})?$/.test(r))return(r.length===9?r.slice(7,9):r.length===5?r.slice(4):null)==="00";if(r.toLowerCase()==="transparent"||r.toLowerCase()==="0, 0, 0, 0"||r.toLowerCase()==="rgba(0, 0, 0, 0)"||r.toLowerCase()==="255, 255, 255, 1"||r.toLowerCase()==="rgba(255, 255, 255, 1)")return!0}return!0}static toHexColor(r){if(r){const i=n=>{const c=n.toString(16);return c.length===1?"0"+c:c};if(this.toString(r).indexOf("#")===0)return r;if(r.includes(",")){r=r.replace(/rgba|\(|\)/gi,"");const n=r.split(",");if(n.length>=2){const c=this.toNumber(n[0]),d=this.toNumber(n[1]),p=this.toNumber(n[2]);return`#${i(c)}${i(d)}${i(p)}`}}else if(r.startsWith("-")){r=this.toNumber(r);const n=r>>16&255,c=r>>8&255,d=r&255,p=r>>24&255;return n===255&&c===255&&d===255&&p===0?"":`#${i(n)}${i(c)}${i(d)}`}}return""}static hexToRgba(r){if(r.indexOf("rgb")===0)return r;r=r.replace("#","");const i=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),c=parseInt(r.substring(4,6),16);return`rgba(${i},${n},${c},1)`}static getGridHeaderTemplate(r){return`<div class="ag-cell-label-container" style="background-color:${(r==null?void 0:r.backgroundColor)||""}" role="presentation">`+((r==null?void 0:r.simpleHeader)!==!0?'<span ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true"></span>':"")+`<div ref="eLabel" class="ag-header-cell-label" role="presentation">
39
39
  <span style="color:${(r==null?void 0:r.color)||(r==null?void 0:r.fontColor)||"unset"}; font-size:${(r==null?void 0:r.fontSize)||"unset"}" class="ag-header-cell-text">${r==null?void 0:r.title}</span>`+((r==null?void 0:r.simpleHeader)!==!0?`<span ref="eFilter" class="ag-header-icon ag-header-label-icon ag-filter-icon" aria-hidden="true"></span>
40
40
  <span ref="eSortOrder" class="ag-header-icon ag-header-label-icon ag-sort-order" aria-hidden="true"></span>
41
41
  <span ref="eSortAsc" class="ag-header-icon ag-header-label-icon ag-sort-ascending-icon" aria-hidden="true"></span>
@@ -68,7 +68,7 @@
68
68
  `;return R.jQuery(`<div style="${m}">
69
69
  <div style="${E}">${n}</div>
70
70
  <div style="${_}"></div>
71
- </div>`)}static setLocalStorage(r,i){return(r==null?void 0:r.trim().length)>0&&localStorage.setItem(r.trim(),JSON.stringify(i)),localStorage}static debounce(r,i=100){let n;return(...c)=>{n&&clearTimeout(n),n=setTimeout(()=>{r(...c)},i)}}static getLocalStorage(r,i=!0){let n;return(r==null?void 0:r.trim().length)>0&&(n=R.toString(localStorage.getItem(r)),i&&localStorage.removeItem(r),n&&n.trim().length>0&&(n=JSON.parse(n))),n}static getCallFormParas(r,i=!0){return this.getLocalStorage(r,i)}static callForm(r,i,n=!0){}static copyText(r){const{toClipboard:i}=Qs();r instanceof Array?r.forEach(n=>{}):r=String(r||""),(r==null?void 0:r.trim().length)>0&&i(r)}static readClipboardText(){return(navigator==null?void 0:navigator.clipboard.readText())||Promise.resolve("")}static async callService(r,i,n,c){return new Promise((d,p)=>{const m=(c==null?void 0:c.messageError)??!1;let _=new ut.EiInfo;r.trim().length===0&&(_.SysInfo.Flag=-603,_.SysInfo.Msg="No service available",d(_));const E=r.split(/[\/.]/).filter(v=>v.trim().length>0);E.length<2&&(_.SysInfo.Flag=-603,_.SysInfo.Msg="Service name error",d(_)),n!=null&&n.show&&this.loading(!0,n),c!=null&&c.toCamelCase&&Object.keys(i.getBlocks()).forEach(v=>{const A=i.getBlock(v),B=A.getBlockMeta().getMetas(),Q=new ut.EiBlockMeta(A.getBlockId());Object.keys(B).forEach(N=>{const W=new ut.EiColumn(R.camelCase(N));W.descName=B[N].name,W.type=B[N].type,Q.addMeta(W)}),A.setBlockMeta(Q)}),ut.EiCommunicator.send(E[0],E[1],i,{onSuccess:v=>{this.loading(!1),_=v,_.getStatus()<0&&m&&this.messageError(_.getMsg(),m==="modal"),d(_)},onFail:v=>{this.loading(!1),m&&this.messageError(String(v),m==="modal"),console.error(v),_.SysInfo.Flag=-603,_.SysInfo.Msg=v==null?void 0:v.message,d(_)}})})}};j(R,"spinId","er-global-spin"),j(R,"spinCurrentContainer",null),j(R,"spinVnode",null),j(R,"spinCurrentTarget",null),j(R,"spinTimeoutId",null);let t=R;e.Core=t;class o{static get AppName(){return"ER4J"}static get Culture(){return"zh_Hans"}static get CompanyCode(){return"BS"}static get CompanyName(){return""}static get UserId(){return""}static get UserName(){return""}static get Partiton(){return""}static get FormName(){return""}static get GridCheckColumnFieldName(){return"54EA8C67-D921-4ddc-8ECE-114E2459816C"}static get IdFieldName(){return"ID"}static get TreeHierarchyFieldName(){return"ErTreeDataHierarchyField"}static get FormParas(){return{}}static get queryDevConfigService(){return"JAER01/queryDevConfig"}static get saveDevConfigService(){return"JAER01/saveDevConfig"}}e.SysInfo=o;class s extends ut.EiInfo{constructor(i){var n;super();j(this,"sys");this.sys={status:0,name:"",descName:"",msg:"",msgKey:"",traceId:((n=this.SysInfo)==null?void 0:n.UUID)||t.guid()},i&&(this.SysInfo=i.SysInfo,Object.keys(i.getBlocks()).forEach(c=>{this.addBlock(i.getBlock(c))}))}blocks(){return this.getBlocks()}getBlock(i){return typeof i=="number"?super.getBlockByIndex(i):super.getBlock(i)}contains(i){return!!super.getBlock(i)}}e.EIInfo=s;class f extends a{constructor(i){super();j(this,"translateOptions",{});i&&(this.translateOptions=i)}setOptions(i){i&&(this.translateOptions={...this.translateOptions,...i})}translate(i,n){return new Promise((c,d)=>{this.setOptions(n);const p=[];if(i&&typeof i=="string"&&i.trim().length>0)p.push({text:i});else if(i&&i instanceof Array&&i.length>0)for(let m=0;m<i.length;m++)p.push({text:i[m]});p.length>0?ii({baseURL:this.translateOptions.baseURL||"https://api.cognitive.microsofttranslator.com",url:this.translateOptions.url||"/translate",method:this.translateOptions.method||"post",headers:{"Ocp-Apim-Subscription-Key":this.translateOptions.ocpApimSubscriptionKey||"2fae25898d3648aa9c17589e4f7a7213","Ocp-Apim-Subscription-Region":this.translateOptions.ocpApimSubscriptionRegion||"northcentralus","Content-type":"application/json","X-ClientTraceId":t.guid()},params:{"api-version":this.translateOptions.version||"3.0",from:this.translateOptions.from,to:this.translateOptions.to},data:p,responseType:this.translateOptions.responseType||"json"}).then(m=>{var _,E;if(((_=m==null?void 0:m.data)==null?void 0:_.length)===p.length){for(let v=0;v<m.data.length;v++)((E=m.data[v].translations)==null?void 0:E.length)>0&&m.data[v].translations.forEach(A=>{A.to&&(p[v][A.to]=A.text)});c({flag:!0,message:"success",result:typeof i=="string"?p[0]:p})}else c({flag:!1,message:"wrong result",result:m.data})}).catch(m=>{d(m)}):c({flag:!1,message:"未传入翻译文本"})})}}e.TranslateHelper=f;class u extends a{constructor(i){var n,c;super();j(this,"_uploadOptions",{});j(this,"_uploadConfigInfo",{});j(this,"_initialized",!1);j(this,"_maxBlobSize",204800);j(this,"_maxFileSize",10485760);i&&(this._uploadOptions=i),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions.url&&((n=this._uploadOptions.url)==null?void 0:n.trim().length)>0&&this._uploadOptions.rootDirectory&&((c=this._uploadOptions.rootDirectory)==null?void 0:c.trim().length)>0&&(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0)}get Initialized(){return this._initialized}async getUploadConfigInfo(i){var n,c;return e.Core.buildEiInfo([{CODE_CLASS:"EPTF"}]),i&&(i==null?void 0:i.trim().length)>0&&(this._uploadOptions.url=(n=this._uploadConfigInfo[i.trim()])==null?void 0:n.url,this._uploadOptions.rootDirectory=(c=this._uploadConfigInfo[i.trim()])==null?void 0:c.rootDirectory),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions}async initialize(i){var n,c;i&&(this._uploadOptions=i),this._uploadOptions.url&&((n=this._uploadOptions.url)==null?void 0:n.trim().length)>0&&this._uploadOptions.rootDirectory&&((c=this._uploadOptions.rootDirectory)==null?void 0:c.trim().length)>0?(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0):(await this.getUploadConfigInfo(),this._initialized=!0)}async getUploadUrl(i){var n;return this._initialized||await this.initialize(),i&&(i==null?void 0:i.trim().length)>0&&(this._uploadOptions.url=(n=this._uploadConfigInfo[i.trim()])==null?void 0:n.url),this._uploadOptions.url||""}getFileList(i,n){return new Promise(async(c,d)=>{var m,_;this._initialized||await this.getUploadConfigInfo(n),n&&(n==null?void 0:n.trim().length)>0&&(this._uploadOptions.url=(m=this._uploadConfigInfo[n.trim()])==null?void 0:m.url,this._uploadOptions.rootDirectory=(_=this._uploadConfigInfo[n.trim()])==null?void 0:_.rootDirectory);const p={pathInfo:[{key:i,name:i}]};ii.post(this._uploadOptions.url+`?command=GetDirContents&arguments=${JSON.stringify(p)}&_=${new Date().valueOf()}&rootDirectory=${this._uploadOptions.rootDirectory}`).then(E=>{var v,A,B;(v=E.data)!=null&&v.success?c({flag:!0,message:"获取文件成功",result:E.data.result}):(console.error("no files,"+((A=E.data)==null?void 0:A.result)),c({flag:!0,message:(B=E.data)==null?void 0:B.result,result:[]}))}).catch(E=>{console.error("get files failed",E),c({flag:!1,message:"获取文件失败",result:[]})})})}downloadFile(i){return new Promise(async(n,c)=>{var _;const d=(_=i.key)==null?void 0:_.split("/"),p=[];d.forEach((E,v)=>{const A={key:d.slice(0,v+1).join("/"),name:E};A.key!==""&&A.name!==""&&p.push(A)});const m=new URLSearchParams;m.append("command","Download"),m.append("arguments",JSON.stringify({pathInfoList:[p]})),m.append("rootDirectory",this._uploadOptions.rootDirectory||""),ii.post(this._uploadOptions.url||"",m,{responseType:"blob",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(E=>{n({flag:!0,message:"下载文件成功",result:E})}).catch(E=>{console.error("download files failed",E),n({flag:!1,message:"下载文件失败",result:[]})})})}previewFile(i){return new Promise(async(n,c)=>{var p;const d=i.key;ii.get(((p=this._uploadOptions.url)==null?void 0:p.replaceAll("file-manager",""))+`FilePriview?rootDirectory=${this._uploadOptions.rootDirectory}&filePath=${d}`).then(m=>{n({flag:!0,message:"获取文件预览信息成功",result:m})}).catch(m=>{console.error("download files failed",m),n({flag:!1,message:"获取文件预览信息失败",result:[]})})})}uploadFile(i,n,c){return new Promise(async(d,p)=>{var E,v,A,B,Q,N;if(this._initialized||await this.getUploadConfigInfo(c),c&&(c==null?void 0:c.trim().length)>0&&(this._uploadOptions.url=(E=this._uploadConfigInfo[c.trim()])==null?void 0:E.url,this._uploadOptions.rootDirectory=(v=this._uploadConfigInfo[c.trim()])==null?void 0:v.rootDirectory,this._uploadOptions.maxBlobSize=(A=this._uploadConfigInfo[c.trim()])==null?void 0:A.maxBlobSize,this._uploadOptions.maxFileSize=(B=this._uploadConfigInfo[c.trim()])==null?void 0:B.maxFileSize),n.size>(this._uploadOptions.maxFileSize||this._maxFileSize)){e.Core.messageError("文件大小超过限制"),d({flag:!1,message:"文件大小超过限制"});return}const m=Math.ceil(n.size/(this._uploadOptions.maxBlobSize||this._maxBlobSize)),_=new Date().valueOf();for(let W=0;W<m;W++){const J=n.slice(W*(this._uploadOptions.maxBlobSize||this._maxBlobSize),(W+1)*(this._uploadOptions.maxBlobSize||2e5)),re={destinationPathInfo:[{key:i,name:i}],chunkMetadata:{UploadId:_,FileName:n.name,Index:W,TotalCount:m,FileSize:n.size}},Se=new FormData;Se.append("command","UploadChunk"),Se.append("arguments",JSON.stringify(re)),Se.append("chunk",J),Se.append("rootDirectory",this._uploadOptions.rootDirectory||"");const ue=await ii.post(this._uploadOptions.url||"",Se,{headers:{"Content-Type":"multipart/form-data"}});if(ue.status===200){if(!((Q=ue==null?void 0:ue.data)!=null&&Q.success)){e.Core.messageError("upload file failed "+((N=ue==null?void 0:ue.data)==null?void 0:N.result)),d({flag:!1,message:"上传文件失败"});break}}else{e.Core.messageError("upload file failed "+(ue==null?void 0:ue.statusText)),d({flag:!1,message:"上传文件失败"});break}}d({flag:!0,message:"上传文件成功"})})}removeFile(i,n,c){return new Promise(async(d,p)=>{var v,A;this._initialized||await this.getUploadConfigInfo(c),c&&(c==null?void 0:c.trim().length)>0&&(this._uploadOptions.url=(v=this._uploadConfigInfo[c.trim()])==null?void 0:v.url,this._uploadOptions.rootDirectory=(A=this._uploadConfigInfo[c.trim()])==null?void 0:A.rootDirectory);const m=n&&(n==null?void 0:n.trim().length)>0?`${i}/${n}`.split("/"):[i],_=[];m.forEach((B,Q)=>{const N={key:m.slice(0,Q+1).join("/"),name:B};N.key!==""&&N.name!==""&&_.push(N)});const E={pathInfo:_,isDirectory:(n==null?void 0:n.trim().length)===0};ii.post(this._uploadOptions.url+`?command=Remove&arguments=${encodeURIComponent(JSON.stringify(E))}&rootDirectory=${this._uploadOptions.rootDirectory}`,JSON.stringify({_:new Date().valueOf()}),{headers:{"Content-Type":"text/plain;charset=UTF-8"}}).then(B=>{var Q,N,W;(Q=B.data)!=null&&Q.success?d({flag:!0,message:"删除文件成功"}):(console.error("remove file failed,"+((N=B.data)==null?void 0:N.result)),d({flag:!1,message:"删除文件失败:"+((W=B.data)==null?void 0:W.result)}))}).catch(B=>{console.error("remove file failed",B),d({flag:!1,message:"删除文件失败"})})})}}e.UploadHelper=u;class h{constructor(r,i,n,c){j(this,"_partition");j(this,"_companyCode");j(this,"_serviceName",e.SysInfo.queryDevConfigService);j(this,"_paraFilter");j(this,"_initializeSuccessed",!1);j(this,"_sysParasValue",{});r?this._partition=r:this._partition=o.Partiton,n?this._companyCode=n:this._companyCode=o.CompanyCode,c&&c.trim().length>0&&(this._serviceName=c.trim()),this._paraFilter=i}get Partiton(){return this._partition}get CompanyCode(){return this._companyCode}get InitializeSuccessed(){return this._initializeSuccessed}get SysParasValue(){return this._sysParasValue}async Initialize(r,i,n,c){return new Promise((d,p)=>{r&&r.trim().length>0&&(this._partition=r),n&&n.trim().length>0&&(this._companyCode=n),i&&(this._paraFilter=i);let m="",_="";if(this._paraFilter&&this._paraFilter.ParaCodes){let A=[];if(this._paraFilter.ParaCodes instanceof Array?A=this._paraFilter.ParaCodes:typeof this._paraFilter.ParaCodes=="string"&&(A=this._paraFilter.ParaCodes.split(",")),A.length>1)for(let B=0;B<A.length;B++)A[B].trim().length>0&&(_.length===0?_=`'${A[B]}'`:_+=`,'${A[B]}'`);else A.length>0&&(m=A[0].trim())}const E=new ut.EiInfo,v=t.buildEiBlock([{COMPANY_CODE:this._companyCode,QUERY_TYPE:"system_paras",CTRL_TYPE:this._paraFilter?this._paraFilter.ParaMoudule:"",CTRL_CODE:m,CTRL_CODE_ARRAY:_}]);E.addBlock(v),c&&c.trim().length>0&&(this._serviceName=c.trim()),t.callService(this._serviceName,E).then(A=>{this._initializeSuccessed=A.SysInfo.Flag>=0,this._initializeSuccessed&&A.getBlockByIndex(0).getMappedRows().forEach(B=>{this._sysParasValue[B.CTRL_CODE]=B.CTRL_NUM}),d(this._initializeSuccessed)},()=>{d(!1)})})}getParaValue(r){return!t.isNullOrEmpty(r)&&this._initializeSuccessed?t.toString(this._sysParasValue[r]):""}}e.Be2SysParaInfo=h;class C{static setVariable(r,i,n){r.trim().length>0&&i.trim().length>0&&n!==void 0&&n!==null&&t.setLocalStorage(r+"_"+i,n)}static getVariable(r,i,n=!0){return t.getLocalStorage(r+"_"+i,n)}static clearVariable(r,i){r&&r.trim().length>0&&localStorage.removeItem(r+"_"+i)}static isNullOrEmpty(r,i){const n=t.getLocalStorage(r+"_"+i);return n==null}}e.SysGlobalVariables=C;class T extends a{constructor(i,n,c){super();j(this,"dirty",!1);j(this,"dirtyFields",{});j(this,"uid","");j(this,"isNew",!1);j(this,"_dataTable");j(this,"_schemaFields",{});j(this,"_backup",{});this._schemaFields=n||{},this._dataTable=c,this.accept(i,this._schemaFields)}get schemaFields(){return this._schemaFields}get dataTable(){return this._dataTable}static getFieldDefaultValue(i){return i==null?void 0:i.defaultValue}shouldSerialize(i){return!["ID","isNew","uid","dirty","dirtyFields","_backup","_dataTable","_events","_schemaFields","_preview_row_data","_children_data",o.TreeHierarchyFieldName].includes(i)}forEach(i){for(const n in this)this.shouldSerialize(n)&&i(this[n],n)}toJSON(i){var c,d;let n={};for(const p in this)if(this.shouldSerialize(p)&&(n[p]=this[p],this._schemaFields&&this._schemaFields[p]))switch(this._schemaFields[p].type){case"boolean":n[p]=this[p]?"1":"0";break;case"datetime":n[p]?(Ut.isDayjs(n[p])&&Ut(n[p]).isValid()?n[p]=n[p].format("YYYYMMDDHHmmss"):n[p]instanceof Date?Ut(n[p]).format("YYYYMMDDHHmmss"):typeof n[p]=="string"?n[p]=n[p].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):n[p]="",((c=n[p])==null?void 0:c.trim().length)===0||n[p].startsWith("1900")||n[p].startsWith("1901")||n[p].startsWith("0001")?n[p]="":this._schemaFields[p].maxLength>0?n[p]=n[p].padEnd(this._schemaFields[p].maxLength,"0").substring(0,this._schemaFields[p].maxLength):n[p]=n[p].padEnd(14,"0").substring(0,14)):n[p]="";break;case"time":n[p]?(Ut.isDayjs(n[p])&&Ut(n[p]).isValid()?n[p]=n[p].format("YYYYMMDDHHmmss"):n[p]instanceof Date?Ut(n[p]).format("YYYYMMDDHHmmss"):typeof n[p]=="string"?n[p]=n[p].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):n[p]="",((d=n[p])==null?void 0:d.trim().length)===0||n[p].startsWith("1900")||n[p].startsWith("1901")||n[p].startsWith("0001")?n[p]="":this._schemaFields[p].maxLength>0&&this._schemaFields[p].maxLength<=6?n[p]=n[p].padEnd(this._schemaFields[p].maxLength,"0").substring(8,8+this._schemaFields[p].maxLength):n[p]=n[p].padEnd(14,"0").substring(8,14)):n[p]="";break;case"string":n[p]&&n[p]instanceof Array&&(n[p]=n[p].join(","));break;case"number":n[p]=e.Core.toNumber(n[p]);break;default:n[p]=this[p];break}return i&&(n={...n,...i}),n}setBackup(){this._backup=this.toJSON();for(const i in this)this.shouldSerialize(i)&&(this._backup[i]=this[i]);return this}getBackup(){return this._backup}get(i){return Reflect.get(this,i)}set(i,n,c,d=!1){var p;if(this.shouldSerialize(i))if(this._schemaFields[i]){switch(this._schemaFields[i].type){case"datetime":n=t.toDateTime(n,"Dayjs");break;case"boolean":n=t.toBoolean(n);break;case"number":n=t.toNumber(n);break;default:n=n;break}const m={};if(m.oldValue=this[i],m.newValue=n,this.dirtyFields[i]=!0,this.dirty=!0,Reflect.set(this,i,n),this._dataTable&&c!=="setData"){const _=l.isProxy(this._dataTable)?l.toRaw(this._dataTable):this._dataTable;(p=_.BingdingInfo)==null||p.forEach(v=>{if(v.formHelper&&v.configId&&v.configId!==c)if(v.controlType==="Grid"){const A=v.formHelper.getGrid(v.configId);if(A){const B={};B[i]=n,v.formHelper.setGridRowData(A,this.uid,B)}}else v.controlType});const E=_.getEvent("dataChanged");E&&(m.field=i,m.binddingInfo=_.BingdingInfo,E(m))}}else d===!1&&(this[i]=n);return this}reset(){return this.accept(void 0,this._schemaFields),this}setSchema(i,n=!0){return this._schemaFields=i,n&&this.reset(),this}setData(i,n,c=!1){var d;return i&&(Object.keys(i).forEach(p=>{if(this.shouldSerialize(p))if(this._schemaFields[p]){switch(this._schemaFields[p].type){case"datetime":i[p]=t.toDateTime(i[p],"Dayjs");break;case"boolean":i[p]=t.toBoolean(i[p]);break;case"number":i[p]=t.toNumber(i[p]);break}this.dirtyFields[p]=!0,this.dirty=!0,Reflect.set(this,p,i[p])}else c===!1&&(this[p]=i[p])}),this._dataTable&&((d=(l.isProxy(this._dataTable)?l.toRaw(this._dataTable):this._dataTable).BingdingInfo)==null||d.forEach(m=>{if(m.formHelper&&m.configId&&m.configId!==n&&m.controlType==="Grid"){const _=m.formHelper.getGrid(m.configId);_&&m.formHelper.setGridRowData(_,this.uid,i)}}))),this}addField(...i){return i&&i.length>0&&i.forEach(n=>{this._schemaFields&&n.name&&this._schemaFields[n.name]===void 0&&(this._schemaFields[n.name]=n,this[n.name]=n.defaultValue)}),this}reomveField(...i){return i&&i.length>0&&i.forEach(n=>{this._schemaFields&&n.name&&this._schemaFields[n.name]&&delete this._schemaFields[n.name]}),this}accept(i,n){if(n)for(const c in n){const d=n[c];if(d&&d.name&&d.type){const p=(i==null?void 0:i[d.name])??(i==null?void 0:i[t.camelCase(d.name)])??d.defaultValue;switch(d.type){case"datetime":this[d.name]=t.toDateTime(p,"Dayjs");break;case"boolean":this[d.name]=p==="1"||p===!0;break;case"number":this[d.name]=t.toNumber(p);break;case"string":this[d.name]=t.toString(p,!0);break;default:this[d.name]=p;break}}}return this.uid=t.guid(),this.dirty=!1,this.dirtyFields={},this}}e.Model=T;class S extends a{constructor(i){super();ta(this,$e);ta(this,K,[]);ta(this,he,[]);ta(this,z,[]);ta(this,Ie,[]);ta(this,Ne);ta(this,xe);ta(this,Le,!0);ta(this,ve);ta(this,Ge,[]);ta(this,_e,{});j(this,"tableName","");this.tableName="Table0",i=i||{schema:{}},this.init(i)}get options(){return Je(this,Ne)}get BingdingInfo(){return Je(this,Ge)}get rowCount(){return Je(this,K).length}get Current(){return Je(this,xe)}get IsHierarchyTable(){var i,n,c,d;return t.toString((n=(i=Je(this,Ne))==null?void 0:i.hierarchy)==null?void 0:n.parentField,!0).length>0&&t.toString((d=(c=Je(this,Ne))==null?void 0:c.hierarchy)==null?void 0:d.primaryField,!0).length>0}init(i){i&&(jt(this,Ne,i),jt(this,K,[]),jt(this,he,[]),jt(this,z,[]),jt(this,Ie,[]),jt(this,xe,void 0))}setBindingInfo(i,n,c,d){i&&n&&n.trim().length>0&&!Je(this,Ge).some(p=>{var m;return((m=p.formHelper)==null?void 0:m.FormId)===i.FormId&&p.configId===n})?Je(this,Ge).push({formHelper:i,configId:n,dataTable:this,controlType:c}):Je(this,Ge).some(p=>p.grid.gridId===d.gridId)||(d.gridOptions.context=d.gridOptions.context||{},d.gridOptions.context.bindingSource=this,Je(this,Ge).push({grid:d,dataTable:this,controlType:c}))}removeBindingInfo(i,n,c){var d,p;for(let m=Je(this,Ge).length-1;m>=0;m--)Je(this,Ge)[m].configId===n&&((p=(d=Je(this,Ge)[m])==null?void 0:d.formHelper)==null?void 0:p.FormId)===(i==null?void 0:i.FormId)?Je(this,Ge).splice(m,1):c&&Je(this,Ge)[m].grid.gridId===c.gridId&&(c.gridOptions.context.bindingSource&&delete c.gridOptions.context.bindingSource,Je(this,Ge).splice(m,1))}setEvent(i,n){i&&(Je(this,_e)[i]=n)}getEvent(i){return Je(this,_e)[i]}setAllowCancelChanges(i){return jt(this,ve,i),this}addField(...i){if(i&&i.length>0&&(i.forEach(n=>{n.name&&Je(this,Ne).schema&&Je(this,Ne).schema[n.name]===void 0&&(Je(this,Ne).schema[n.name]=n)}),Je(this,K).length>0))for(let n=0;n<Je(this,K).length;n++)Je(this,K)[n].addField(...i);return this}removeField(...i){if(i&&i.length>0&&(i.forEach(n=>{n.name&&Je(this,Ne).schema&&Je(this,Ne).schema[n.name]===void 0&&delete Je(this,Ne).schema[n.name]}),Je(this,K).length>0))for(let n=0;n<Je(this,K).length;n++)Je(this,K)[n].reomveField(...i);return this}get(i){for(let n=0;n<Je(this,K).length;n++)if(Je(this,K)[n].uid===i)return Je(this,K)[n]}getRows(i,n=!1){const c=[],d=p=>{n instanceof Function?c.push(n(p)||p.toJSON()):c.push(n?p.toJSON():p)};switch(i){case"created":{Je(this,z).forEach(p=>{d(p)});break}case"updated":{Je(this,K).forEach(p=>{p.dirty&&!p.isNew&&d(p)});break}case"removed":{Je(this,Ie).forEach(p=>{d(p)});break}case"unchanged":{Je(this,K).forEach(p=>{!p.dirty&&!p.isNew&&d(p)});break}case"original":{Je(this,he).forEach(p=>{!p.dirty&&!p.isNew&&d(p)});break}case"all":{Je(this,K).forEach(p=>{d(p)});break}}return c}getRowsAsBlock(i,n){const c=new ut.EiBlock("Table0"),d=this.getRows(i,n??!0);if(d&&d.length>0){const p=[];if(Je(this,Ne).schema){const m=_=>{const E=new ut.EiColumn(_.name);return E.type=_.type==="number"?"N":"C",E.descName=_.caption,E};Object.keys(Je(this,Ne).schema).forEach(_=>{var v;const E=m((v=Je(this,Ne).schema)==null?void 0:v[_]);c.addColumn(E),p.push({name:E.name,type:E.type})})}d.forEach(m=>{const _=[];p.forEach(E=>{_.push(m[E.name])}),c.addRow(_)})}return c}at(i){return Je(this,K).at(i)}indexOf(i){if(i&&i.uid.length>0){for(let n=0;n<Je(this,K).length;n++)if(Je(this,K)[n].uid===i.uid)return n}return-1}setCurrent(i,n){var m;const c={},d=((m=Je(this,xe))==null?void 0:m.uid)||"",p=(i==null?void 0:i.uid)||"";c.bindingInfo=Je(this,Ge),c.oldCurrent=Je(this,xe),c.current=i,c.source=n,jt(this,xe,i),d!==p&&ra(this,$e,_a).call(this,"currentChanged",c)}insert(i,n,c){let d;return n&&(d=new T(n,Je(this,Ne).schema,this),c&&c.trim().length>0&&d[c]!==void 0&&(d[c]=t.guid()),d.isNew=!0,Je(this,K).splice(i,0,d),Je(this,z).push(d),ra(this,$e,_a).call(this,"dataInserted",{bindingInfo:Je(this,Ge),insertAt:i,current:d}),this.setCurrent(d)),d}add(i,n){const c=new T(i,Je(this,Ne).schema,this);return n&&n.trim().length>0&&c[n]!==void 0&&(c[n]=t.guid()),c.isNew=!0,Je(this,K).push(c),Je(this,z).push(c),ra(this,$e,_a).call(this,"dataAdded",{bindingInfo:Je(this,Ge),current:c}),this.setCurrent(c),c}import(i,n=-1,c=!0,d){const p=[];return(i==null?void 0:i.length)>0&&(i.forEach(m=>{m instanceof T&&(m=m.toJSON());const _=new T(m,Je(this,Ne).schema,this);d&&d.trim().length>0&&_[d]!==void 0&&(_[d]=t.guid()),_.isNew=c,p.push(_)}),n<0?Je(this,K).push(...p):Je(this,K).splice(n,0,...p),Je(this,z).push(...p),ra(this,$e,_a).call(this,"dataImported",{bindingInfo:Je(this,Ge),models:p,insertAt:n,current:p[i.length-1]}),this.setCurrent(p[i.length-1])),p}remove(i){if(!i)return;let n=[];i instanceof Array&&i.length>0?n=i:i&&(n=[i]);let c=!1;const d=[];if(n.length>0){let p=-1,m=-1;if(n.forEach(_=>{var E;if(p=Je(this,K).findIndex(v=>v.uid===_.uid),(m<0||p<m)&&(m=p),p!==-1){if(c||(c=Je(this,K)[p].uid===((E=Je(this,xe))==null?void 0:E.uid)),Je(this,K)[p].isNew){const v=Je(this,z).indexOf(Je(this,K)[p]);v>=0&&Je(this,z).splice(v,1)}else Je(this,Ie).push(Je(this,K)[p]);d.push(Je(this,K)[p]),Je(this,K).splice(p,1)}}),d.length>0&&ra(this,$e,_a).call(this,"dataRemoved",{bindingInfo:Je(this,Ge),models:d}),c){let _;Je(this,K).length>0&&(Je(this,K).length===m?_=Je(this,K)[m-1]:_=Je(this,K)[m]),this.setCurrent(_)}}}setRowState(i,n){let c=this.indexOf(i);if(c<0&&(Je(this,K).push(i),c=Je(this,K).length-1),c>=0){Je(this,K)[c].dirty=n==="updated",Je(this,K)[c].isNew=n==="added";const d=Je(this,z).findIndex(p=>p.uid===i.uid);n==="added"&&d<0?Je(this,z).push(i):d>=0&&Je(this,z).splice(d,1),ra(this,$e,_a).call(this,"rowStateChanged",{bindingInfo:Je(this,Ge),model:Je(this,K)[c],state:n})}}clear(){return jt(this,K,[]),jt(this,he,[]),jt(this,z,[]),jt(this,Ie,[]),jt(this,xe,void 0),ra(this,$e,_a).call(this,"dataCleared",{bindingInfo:Je(this,Ge)}),this}merge(i,n=!0,c=!1){var m,_,E,v,A;const d=[],p=Je(this,K).length>0;if(n&&(jt(this,K,[]),jt(this,he,[]),jt(this,z,[]),jt(this,Ie,[])),i!==void 0&&i.length>0&&((m=this.options)!=null&&m.schema)){const B=this.options.schema,Q=Object.keys(i[0]),N=Object.keys(B),W=N.filter(Z=>Q.includes(Z)||Q.includes(t.camelCase(Z))),J=N.filter(Z=>!Q.includes(Z)&&!Q.includes(t.camelCase(Z))),re=new Map,Se=t.toString((E=(_=Je(this,Ne))==null?void 0:_.hierarchy)==null?void 0:E.primaryField,!0),ue=t.toString((A=(v=Je(this,Ne))==null?void 0:v.hierarchy)==null?void 0:A.parentField,!0),me=Se.length>0&&ue.length>0&&B[Se]&&B[ue];for(let Z=0;Z<i.length;Z++){const Te=new T(void 0,void 0,this);Te.setSchema(B,!1),W.forEach(ce=>{switch(B[ce].type){case"datetime":Te[ce]=t.toDateTime(i[Z][ce]??i[Z][t.camelCase(ce)],"Dayjs");break;case"boolean":Te[ce]=t.toBoolean(i[Z][ce]??i[Z][t.camelCase(ce)]);break;case"number":Te[ce]=t.toNumber(i[Z][ce]??i[Z][t.camelCase(ce)]);break;case"string":Te[ce]=t.toString(i[Z][ce]??i[Z][t.camelCase(ce)],!0);break;default:Te[ce]=i[Z][ce]??i[Z][t.camelCase(ce)];break}}),J.forEach(ce=>{switch(B[ce].type){case"datetime":Te[ce]=null;break;case"boolean":Te[ce]=!1;break;case"number":Te[ce]=0;break;case"string":Te[ce]="";break;default:Te[ce]=null;break}}),Te.isNew=c,d.push(Te),Je(this,K).push(Te),me&&Te[Se]&&re.set(Te[Se],Te)}if(me){const Z=Te=>{const ce=[];for(;Te;)ce.unshift(Te[Se]),Te=re.get(Te[ue]);return ce};for(let Te=0;Te<Je(this,K).length;Te++)Je(this,K)[Te][o.TreeHierarchyFieldName]=Z(Je(this,K)[Te])}ra(this,$e,Bo).call(this),ra(this,$e,_a).call(this,"dataMerged",{bindingInfo:Je(this,Ge),models:d,current:Je(this,K)[0]}),this.setCurrent(Je(this,K)[0])}else jt(this,xe,void 0),p&&ra(this,$e,_a).call(this,"dataMerged",{bindingInfo:Je(this,Ge),models:d,current:void 0});return d}hasChanges(){if(Je(this,Ie).length)return!0;for(let i=0;i<Je(this,K).length;i++)if(Je(this,K)[i].isNew||Je(this,K)[i].dirty)return!0;return!1}acceptChanges(){return jt(this,z,[]),jt(this,Ie,[]),Je(this,K).forEach(i=>{i.isNew=!1,i.dirty=!1,i.dirtyFields={}}),ra(this,$e,Bo).call(this),this}cancelChanges(){return Je(this,Le)&&(jt(this,z,[]),jt(this,Ie,[]),jt(this,K,Wr.cloneDeep(Je(this,he))),ra(this,$e,_a).call(this,"dataMerged",{bindingInfo:Je(this,Ge),models:Je(this,K),current:void 0})),this}totalCount(){return Je(this,K).length}data(i){return i!==void 0&&i.length>0&&this.merge(i,!0,!1),Je(this,K)}originalCopy(){return Wr.cloneDeep(Je(this,he))}originalModel(i){for(let n=0;n<Je(this,he).length;n++)if(Je(this,he)[n].uid===i)return Wr.cloneDeep(Je(this,he)[n])}}K=new WeakMap,he=new WeakMap,z=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,xe=new WeakMap,Le=new WeakMap,ve=new WeakMap,Ge=new WeakMap,_e=new WeakMap,$e=new WeakSet,_a=function(i,n){var d;(d=Je(this,Ge))==null||d.forEach(p=>{var m,_,E,v,A,B,Q,N,W,J,re,Se,ue,me,Z,Te,ce,ze,Me,ge,le,Y,Fe,ke,Ve,at,pt,ht,Ct,_t;if(p.formHelper&&p.configId)if(p.controlType==="Grid"){const Qe=p.formHelper.getGrid(p.configId);if((m=Qe==null?void 0:Qe.gridOptions)!=null&&m.api)switch(i){case"dataMerged":{const U=Qe.gridOptions.api.getFilterModel(),gt=Qe.gridOptions.columnApi.getColumnState().filter(Ye=>Ye.sort!==null);Object.keys(U).length===0&&gt.length===0&&Qe.gridOptions.context.calculateRowSpan&&Qe.gridOptions.context.calculateRowSpan instanceof Function&&Qe.gridOptions.context.calculateRowSpan(!0),(E=(_=Qe.gridOptions)==null?void 0:_.api)==null||E.clearRangeSelection(),Qe.gridOptions.context.focusRowId="",Qe.gridOptions.context.focusColId="",Qe.gridOptions.context.dataMerged=!0,(A=(v=Qe.gridOptions)==null?void 0:v.api)==null||A.setRowData(Je(this,K));let rt=Je(this,K).length.toString().length*7+20;((Q=(B=Qe.gridOptions.context)==null?void 0:B.viewConfig)==null?void 0:Q.SHOW_SELECTION)==="1"&&(rt+=20),(N=Qe.gridOptions.context)!=null&&N.allowDragRow&&(rt+=21),((J=(W=Qe.gridOptions.context)==null?void 0:W.options)==null?void 0:J.masterDetail)===!0&&(rt+=22);const ct=(Se=(re=Qe.gridOptions.columnApi)==null?void 0:re.columnModel)==null?void 0:Se.gridColumns,Ze=ct==null?void 0:ct.find(Ye=>Ye.colId===o.GridCheckColumnFieldName);Ze&&Qe.gridOptions.columnApi.setColumnWidth(Ze,rt);break}case"dataCleared":{(me=(ue=Qe.gridOptions)==null?void 0:ue.api)==null||me.setRowData([]);break}case"dataRemoved":{if(Qe.gridOptions.api.applyTransaction({remove:n.models}),((Te=(Z=Qe.gridOptions.context)==null?void 0:Z.options)==null?void 0:Te.showRowNo)!==!1&&(Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]}),Qe.gridOptions.context.focusRowId)){const U=(ce=Qe==null?void 0:Qe.gridOptions)==null?void 0:ce.api.getRowNode(Qe.gridOptions.context.focusRowId);U&&(Qe.gridOptions.context.focusRowId=U.id,Qe.gridOptions.context.focusColId||(Qe.gridOptions.context.focusColId=e.SysInfo.GridCheckColumnFieldName),p.formHelper.setGridFocusedCell(Qe,U.rowIndex,Qe.gridOptions.context.focusColId))}break}case"dataAdded":{Qe.gridOptions.api.applyTransaction({add:[n.current]}),Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]});const U=(Me=(ze=Qe.gridOptions.context)==null?void 0:ze.viewConfig)==null?void 0:Me.AUTO_SELECT_MODE;(U==="1"||U==="3")&&((ge=p.formHelper)==null||ge.checkGridRow(p.configId,n.current));break}case"dataInserted":{n.insertAt>=0?Qe.gridOptions.api.applyTransaction({add:[n.current],addIndex:n.insertAt}):Qe.gridOptions.api.applyTransaction({add:[n.current]}),Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]});const U=(Y=(le=Qe.gridOptions.context)==null?void 0:le.viewConfig)==null?void 0:Y.AUTO_SELECT_MODE;(U==="1"||U==="3")&&p.formHelper.checkGridRow(p.configId,n.current);break}case"dataImported":{n.insertAt>=0?Qe.gridOptions.api.applyTransaction({add:n.models,addIndex:n.insertAt}):Qe.gridOptions.api.applyTransaction({add:n.models}),Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]});const U=(ke=(Fe=Qe.gridOptions.context)==null?void 0:Fe.viewConfig)==null?void 0:ke.AUTO_SELECT_MODE;(U==="1"||U==="3")&&p.formHelper.checkGridRow(p.configId,n.models);break}case"currentChanged":{if(Je(this,xe)&&n.source!==p.configId&&((at=(Ve=Qe.gridOptions.context)==null?void 0:Ve.options)==null?void 0:at.suppressDefaultFocusedCell)!==!0){const U=(ht=Qe==null?void 0:Qe.gridOptions)==null?void 0:ht.api.getRowNode((pt=Je(this,xe))==null?void 0:pt.uid);(_t=(Ct=Qe.gridOptions)==null?void 0:Ct.api)==null||_t.clearFocusedCell(),U&&(Qe.gridOptions.context.focusColId||(Qe.gridOptions.context.focusColId=e.SysInfo.GridCheckColumnFieldName),p.formHelper.setGridFocusedCell(Qe,U.rowIndex,Qe.gridOptions.context.focusColId))}break}}}else p.controlType==="Layout"&&i==="currentChanged"&&p.formHelper.refreshLayoutBindModel(p.configId)});const c=Je(this,_e)[i];c&&c instanceof Function&&c(n)},Bo=function(){Je(this,ve)||Je(this,ve)===void 0&&Je(this,K).length<=500?(jt(this,he,Wr.cloneDeep(Je(this,K))),jt(this,Le,!0)):(jt(this,he,[]),jt(this,Le,!1))},e.DataTable=S;class x{constructor(r){j(this,"dataSetName","");j(this,"dataTables");j(this,"relations");this.dataTables={},this.relations={},this.dataSetName=(r==null?void 0:r.trim())||""}get Name(){return this.dataSetName}setName(r){return this.dataSetName=(r==null?void 0:r.trim())||"",this}addDataTable(r,i){return i.tableName=r,this.dataTables[r]=i,this}removeDataTable(r){return this.contains(r)&&delete this.dataTables[r.trim()],this}renameDataTable(r,i){return this.contains(r)&&!this.contains(i)&&r.trim().toUpperCase()!==i.trim().toUpperCase()&&(this.addDataTable(i.trim().toUpperCase(),this.dataTables[r.trim().toUpperCase()]),delete this.dataTables[r.trim().toUpperCase()]),this}copyDataTable(r,i){let n,c;return r instanceof S?n=r:typeof r=="string"&&(n=this.dataTables[r]),n&&n.options&&(c=new S(n.options)),i&&i.trim().length>0&&!this.contains(i)&&(this.dataTables[i.trim()]=c),c}cloneDataTable(r,i){const n=this.copyDataTable(r,i);return n.data([]),n}getDataTable(r){return this.dataTables[r]}getTableName(r){let i;return Object.keys(this.dataTables).every(n=>this.dataTables[n]===r?(i=n,!1):!0),i}clear(...r){let i=Object.keys(this.dataTables);return r.length>0&&(i=r),i.forEach(n=>{this.dataTables[n]&&this.dataTables[n]instanceof S&&this.dataTables[n].clear()}),this}mergeData(r,i,n=!0,c=!1){return(r==null?void 0:r.trim().length)>0&&this.contains(r.trim())&&i&&this.dataTables[r].merge(i,n,c),this}mergeDataFromEIInfo(r,i="",n=!0){var c;if(i&&i.trim().length>0&&this.contains(i.trim())){const d=(c=r.getBlock(i.trim()))==null?void 0:c.getMappedRows();this.mergeData(i.trim(),d,n)}else Object.keys(this.dataTables).forEach(d=>{d.trim().length>0&&this.dataTables[d.trim()]&&r.getBlock(d.trim())&&this.mergeData(d.trim(),r.getBlock(d.trim()).getMappedRows(),n)});return this}getCurrentDataObject(r){let i;return(r==null?void 0:r.trim().length)>0&&this.contains(r.trim())&&(i=this.dataTables[r].Current),i}tablesCount(){return this.dataTables?Object.keys(this.dataTables).length:0}contains(r){return r&&r.trim().length>0?this.dataTables[r.trim()]!==void 0:!1}isEmpty(){return!(this.dataTables&&Object.keys(this.dataTables).length>0)}hasChanges(r){if(this.dataTables){if(r&&r.trim().length>0&&this.dataTables[r.trim()])return this.dataTables[r.trim()].hasChanges();{const n=Object.keys(this.dataTables);for(let c=0;c<n.length;c++)if(this.dataTables[n[c]].hasChanges())return!0}}return!1}hasRelation(r){return this.dataTables&&r&&r.trim().length>0&&this.relations[r.trim()]&&this.relations[r.trim()].length>0}acceptChanges(){return Object.keys(this.dataTables).forEach(i=>{this.dataTables[i]&&this.dataTables[i]instanceof S&&this.dataTables[i].acceptChanges()}),this}}e.DataSet=x;class y{constructor(r,i,n,c,d){j(this,"SysDefinedParas");j(this,"_app");j(this,"_currentFormRegitInfo",{});j(this,"_currentConfigCompanyCode");j(this,"_serverPartition","");j(this,"_customPartition","");j(this,"_moduleName","");j(this,"_formId","");j(this,"_formName","");j(this,"_formCaption","");j(this,"_formWidth",-1);j(this,"_formHeight",-1);j(this,"_maxmizeBox",!0);j(this,"_minimizeBox",!0);j(this,"_resizable",!0);j(this,"_initializeFlag",0);j(this,"_layoutIds");j(this,"_dataSetName","");j(this,"_tableNames","");j(this,"_serviceName","JAER01/getFormConfig");j(this,"_initialConfiParas",{});j(this,"_configInfo",{});j(this,"_systemInfo",{});j(this,"_customDefaultValues",{});j(this,"_dropDownRefreshKey",l.reactive({}));j(this,"_dropDownBindSource",{});j(this,"_dropDownCascader",{});j(this,"_gridOptions",{});j(this,"_gridReactiveOptions",l.reactive({}));j(this,"_gridToolbarOptions",l.reactive({}));j(this,"_hiddenFields",{});j(this,"_requiredFields",{});j(this,"_requiredFieldsByCondition",{});j(this,"_formDataSet",new x);j(this,"_formBindingRelation",{});j(this,"_formAuthButtons",{});j(this,"_groupCompanyCode","");j(this,"_groupCompanyName","");j(this,"_formConfigLicens","");j(this,"_formConfigLicensErrorMsg","WMyNCZMrw9FY9qti+0p7zA==");j(this,"_privateEncryptKey","QTS8kH81A2Do4qfezJ9cCEM4lZifC7Ym");j(this,"_developPermisson","0");j(this,"_tempSingleConfigInfo",{});j(this,"_gridInstanceInfo",{});j(this,"_gridColumnsInfo",{});j(this,"_gridColumnsConfigInfo",{});j(this,"_gridStyleInfo",{});j(this,"_allowMergeColumnFields",{});j(this,"_widgetInstanceInfo",{});j(this,"_layoutConditionStyleInfo",{});j(this,"_layoutConfigRelationInfo",{});j(this,"_sysParaInfo",{});j(this,"_gridCustomEvent",{});j(this,"_formOptions",{});j(this,"_layoutOpitons",l.reactive({}));j(this,"_layoutItemOpitons",l.reactive({}));j(this,"_layoutBindModelUid",l.reactive({}));j(this,"_layoutBindModel",{});j(this,"_controlConditionProps",{});j(this,"_erxGlobalConfig",{});j(this,"excuteGridColumnExpressions",(r,i)=>{const n={...r},c=Object.keys(n).sort((p,m)=>p.length>m.length?-1:p.length<m.length?1:0);let d=i;c.forEach(p=>{Ut.isDayjs(n[p])?n[p]=n[p].toDate():(n[p]===null||n[p]===void 0)&&(n[p]="");const m=new RegExp(`\\b${p}\\b`,"gi"),_=new RegExp(`[${p}]`.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");_.test(d)?d=d.replaceAll(_,`data.${p}`):m.test(d)&&(d=d.replaceAll(m,`data.${p}`))});try{return new Function("data",d)(n)}catch{console.error("ER: Script has a syntax error: "+d+"; data: "+JSON.stringify(n))}});this._formId=t.guid(),this._serverPartition=r||this._serverPartition,this._serviceName=n||this._serviceName,this._formName=i||this._formName,this._layoutIds=c,this._initialConfiParas=d,this._currentConfigCompanyCode={},this.SysDefinedParas={GroupCompanyCode:"BS",GroupCompanyName:"宝信软件",DefaultRmbCode:"CNY"}}get App(){return this._app}get CurrentFormRegitInfo(){return this._currentFormRegitInfo}get Locale(){return Ei()}get IsRtl(){return Ta()}get ModuleName(){return this._moduleName}get FormId(){return this._formId}get FormName(){return this._formName}get FormCaption(){return this._formCaption}get FormWidth(){return this._formWidth}get FormHeight(){return this._formHeight}get MaxmizeBox(){return this._maxmizeBox}get MinimizeBox(){return this._minimizeBox}get Resizable(){return this._resizable}get InitializeFlag(){return this._initializeFlag}get ConfigInfo(){return this._configInfo}get SystemInfo(){return this._systemInfo}get DropDownRefreshKey(){return this._dropDownRefreshKey}get DropDownBindSource(){return this._dropDownBindSource}get DropDownCascader(){return this._dropDownCascader}get FormOptions(){return this._formOptions}get GridOptions(){return this._gridOptions}get GridToolbarOptions(){return this._gridToolbarOptions}get RequiredFields(){return this._requiredFields}get RequiredFieldsByCondition(){return this._requiredFieldsByCondition}get AllowMergeColumnFields(){return this._allowMergeColumnFields}get FormDataSet(){return this._formDataSet}get FormBindingRelation(){return this._formBindingRelation}get FormAuthButtons(){return this._formAuthButtons}get DefaultConfigCompanyCode(){return"BS"}get DefaultConfigCompanyName(){return"宝信软件"}get ServerPartition(){return this._serverPartition}get CustomPartition(){return this._customPartition}get InitialConfiParas(){return this._initialConfiParas}get InitialService(){return this._serviceName}get CurrentConfigCompanyCode(){return this._currentConfigCompanyCode}get GroupCompanyCode(){return this._groupCompanyCode}get GroupCompanyName(){return this._groupCompanyName}get WidgetInstanceInfo(){return this._widgetInstanceInfo}get DevelopPermisson(){return this._developPermisson}get LayoutBindModelUid(){return this._layoutBindModelUid}async Initialize(r,i,n,c,d){var m,_,E,v;this._erxGlobalConfig=await e.Core.getErxGlobalConfig(),(_=(m=this._erxGlobalConfig)==null?void 0:m.License)!=null&&_[e.SysInfo.CompanyCode]&&(this._formConfigLicens=(v=(E=this._erxGlobalConfig)==null?void 0:E.License)==null?void 0:v[e.SysInfo.CompanyCode]);const p=t.decryptData(this._formConfigLicens,e.SysInfo.GridCheckColumnFieldName,t.decryptData(this._privateEncryptKey,e.SysInfo.GridCheckColumnFieldName,e.SysInfo.GridCheckColumnFieldName));return this._erxGlobalConfig&&(!this._formConfigLicens||p!==o.CompanyName)&&this.messageWarning(t.decryptData(this._formConfigLicensErrorMsg,e.SysInfo.GridCheckColumnFieldName,e.SysInfo.GridCheckColumnFieldName)),new Promise((A,B)=>{var W;this._serverPartition=(r==null?void 0:r.trim())||this._serverPartition,this._serviceName=(c==null?void 0:c.trim())||this._serviceName,this._formName=(i==null?void 0:i.trim())||this._formName,this._initialConfiParas=d||this._initialConfiParas||{},this._layoutIds=n||this._layoutIds;let Q="";this._layoutIds&&(typeof this._layoutIds=="string"?Q=this._layoutIds:this._layoutIds instanceof Array&&(Q=this._layoutIds.join(","))),this._dataSetName=((W=this._dataSetName)==null?void 0:W.trim())||"#";const N=new ut.EiInfo;if(N.addBlock(t.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:Q,DATASET_NAME:this._dataSetName,TABLE_NAMES:this._tableNames}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const J=new ut.EiBlock("InitializeFormParas");J.addColumn("PARA_NAME"),J.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(re=>{J.addRow([{PARA_NAME:re,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[re]:""}])}),N.addBlock(J)}e.Core.callService(this._serviceName,N).then(J=>{var re,Se,ue;J.getStatus()>=0?(Object.keys(J.getBlocks()).forEach(me=>{this._configInfo[me]=J.getBlock(me)}),((ue=(Se=(re=this._configInfo)==null?void 0:re.TSI00FORM)==null?void 0:Se.getMappedRows())==null?void 0:ue.length)>0?(this.InitializeWithData(),A({flag:this._initializeFlag,msg:"success"})):(this._initializeFlag=-1,A({flag:this._initializeFlag,msg:`The configuration information for the form [${this._formName}] was not found!`}))):(this._initializeFlag=-1,A({flag:this._initializeFlag,msg:J.getMsg()??"unknown error"}))},J=>{A({...J,flag:-1,msg:"unknown error"})})})}InitializeWithData(){var n,c,d,p,m,_;this._initializeFlag=1;let r=e.SysInfo.CompanyCode;r||(r=this.DefaultConfigCompanyCode);const i=this._configInfo.TSI00FORM.getMappedRows()[0];this._moduleName=i.MODULE_NAME,this.ModuleName.length<2?this._moduleName="GC":this._moduleName=this.ModuleName.substring(0,2),this._formName=i.FORM_NAME,this._formWidth=e.Core.toNumber(i.FORM_WIDTH)||800,this._formHeight=e.Core.toNumber(i.FORM_HEIGHT)||650,this._formCaption=i.FORM_FUNC_DESC,this._minimizeBox=i.MINIMIZE==="1",this._maxmizeBox=i.MAXIMIZE==="1",this._resizable=i.FORM_STYLE!=="3",this._formConfigLicens=i.LICENSE,this._groupCompanyCode=((n=i.GROUP_COMPANY_CODE)==null?void 0:n.trim())||this._groupCompanyCode,this._groupCompanyName=((c=i.GROUP_COMPANY_NAME)==null?void 0:c.trim())||this._groupCompanyName,this._configInfo.IPLAT4J_SYSTEM_INFO&&(this._systemInfo=this._configInfo.IPLAT4J_SYSTEM_INFO.getMappedRows()[0],this._developPermisson=this.getFormSysInfo("DEV_LICENSE")),((d=i.EXT_OPTIONS)==null?void 0:d.trim().length)>0&&(this._formOptions=JSON.parse(i.EXT_OPTIONS)),((_=(m=(p=this._configInfo)==null?void 0:p.TSI00GRIDVIEW)==null?void 0:m.getMappedRows())==null?void 0:_.length)>0?(this.createDataSet(),this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(E=>{this.setDropDownBindSourceAndRequiredFields(E)})):console.error("ER: No view configuration information found!")}setMenuFormInstance(r){var i,n,c,d,p,m;if(r){const _=(i=r==null?void 0:r.attrs)==null?void 0:i.__eiInfo;this._currentFormRegitInfo.formInfo=_==null?void 0:_.extAttr,this._currentFormRegitInfo.formQueryParams=e.Core.getQueryParams((n=_==null?void 0:_.extAttr)==null?void 0:n.efFormLoadPath),this._currentFormRegitInfo.formButtons={},(d=(c=r==null?void 0:r.attrs)==null?void 0:c.__buttonsEi)!=null&&d.blocks&&Object.keys((m=(p=r==null?void 0:r.attrs)==null?void 0:p.__buttonsEi)==null?void 0:m.blocks).forEach(E=>{var v,A;this._currentFormRegitInfo.formButtons[E]=(A=(v=r==null?void 0:r.attrs)==null?void 0:v.__buttonsEi)==null?void 0:A.getBlock(E).getMappedRows(),this._formAuthButtons[E]=this._currentFormRegitInfo.formButtons[E]})}}async loadConfig(r,i){return new Promise((n,c)=>{var p,m;let d="";if((p=this._formDataSet)!=null&&p.dataTables&&(d=Object.keys((m=this._formDataSet)==null?void 0:m.dataTables).toString()),i===void 0&&(i=this._initialConfiParas),r.trim().length>0){const _=r.split(",");let E="";for(let v=0;v<_.length;v++)this.containsConfig(_[v].trim())||(E=E.length===0?_[v].trim():E+","+_[v].trim());if(E.length>0){const v=new ut.EiInfo;if(v.addBlock(t.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:E,EXIST_TABLES:d,INI_FLAG:this._initializeFlag}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const A=new ut.EiBlock("InitializeFormParas");A.addColumn("PARA_NAME"),A.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(B=>{A.addRow([{PARA_NAME:B,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[B]:""}])}),v.addBlock(A)}e.Core.callService(this._serviceName,v).then(A=>{A.getStatus()>=0&&(Object.keys(A.getBlocks()).forEach(N=>{["IPLAT4J_SYSTEM_INFO","TESCOMPANYINFO","TSI00FORM","TSI00DATASOURCE","TSI00DATATABLE","TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].includes(N)||(this._configInfo[N]=A.getBlock(N))}),["TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].forEach(N=>{A.getBlock(N)&&this._configInfo[N]&&A.getBlock(N).getMappedRows().length>0&&this._configInfo[N].addRow(A.getBlock(N).getRows())}),E.split(",").forEach(N=>{var re;const W=this.getSingleViewConfigInfo(N),J=t.toString(W.TABLE_NAME).trim();if(W&&J.length>0&&!this._formDataSet.contains(J)){this._configInfo.TSI00DATATABLE.data.some(ue=>ue.TABLE_NAME===J)||A.getBlock("TSI00DATATABLE").getMappedRows().length>0&&this._configInfo.TSI00DATATABLE.addRow(A.getBlock("TSI00DATATABLE").getRows());const Se={};W.FUNCTION_TYPE==="T"&&((re=W.CURRENT_NODE_DESC)==null?void 0:re.trim().length)>0&&W.FATHER_NODE_DESC.trim().length>0&&(Se.hierarchy={primaryField:W.CURRENT_NODE_DESC.trim(),parentField:W.CURRENT_NODE_DESC}),this.createDataTable(J,Se)}this.setDropDownBindSourceAndRequiredFields(W)})),n({flag:A.getStatus()>=0?1:-1,msg:A.getMsg()??"unknown error"})},A=>{n({...A,flag:-1,msg:"unknown error"})})}else n({flag:1,msg:"Configuration ["+r.trim()+"] already exists"})}else n({flag:-1,msg:"No config id"})})}$t(r,i){var c,d;let n="";if((r==null?void 0:r.trim().length)>0){for(let p=0;p<((d=(c=this.ConfigInfo.TSI00FORMRESOURCE)==null?void 0:c.getMappedRows())==null?void 0:d.length);p++)if(this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[p].ITEM_CODE===r){n=this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[p].ITEM_VALUE_RES||this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[p].ITEM_VALUE;break}n=n??e.Core.$t(r,i)}return n}setFormCapiton(r){return this._formCaption=r,this}setFormOptions(r){return this._formOptions={...this._formOptions,...r},this}setDropDownBindSourceAndRequiredFields(r){const i={},n={},c=[],d=[],p=["F3","F6","F7","FD","FA","FB","FP","FC","FH","FL","FJ","FK","G1","G2","G4","GD","GP"];if(this._configInfo.TSI00GRIDCOLUMN&&this._configInfo.TSI00GRIDCOLUMN.getMappedRows().length>0){let m=[],_=e.SysInfo.CompanyCode;_||(_=this.DefaultConfigCompanyCode),r.MATCH_FLAG==="1"&&(m=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(E=>{const v=(r.FUNCTION_TYPE==="F"?"F":"G")+E.COLUMN_EDIT;return E.FUNCTION_ID===r.FUNCTION_ID&&E.COMPANY_CODE===_&&(p.includes(v)||E.ITEM_MUST_FLAG==="1")})),m.length===0&&(m=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(E=>{const v=(r.FUNCTION_TYPE==="F"?"F":"G")+E.COLUMN_EDIT;return E.FUNCTION_ID===r.FUNCTION_ID&&E.COMPANY_CODE===this.DefaultConfigCompanyCode&&(p.includes(v)||E.ITEM_MUST_FLAG==="1")})),m.length>0&&m.forEach(E=>{const v=(r.FUNCTION_TYPE==="F"?"F":"G")+E.COLUMN_EDIT;if(p.includes(v))if(E.ORIGIN_CODE!=="0"&&E.SVC_NAME.trim().length>0){if(i[E.ITEM_CODE]=this.setDropDownBindOptions(r.FUNCTION_TYPE,E),E.FATHER_FIELD.trim().length>0&&E.FORM_FILTER.trim().length>0&&E.FORM_FILTER.trim()!=="0"){E.LAYOUT_ID.trim().length===0&&(E.LAYOUT_ID=r.FUNCTION_ID),this._dropDownCascader[E.LAYOUT_ID.trim()+E.FATHER_FIELD.trim()]||(this._dropDownCascader[E.LAYOUT_ID.trim()+E.FATHER_FIELD.trim()]=[]);const A={};A.COLUMN_EDIT=E.COLUMN_EDIT,A.FUNCTION_ID=E.FUNCTION_ID,A.ITEM_CODE=E.ITEM_CODE,A.FORM_FILTER=E.FORM_FILTER,A.FUNCTION_TYPE=r.FUNCTION_TYPE,this._dropDownCascader[E.LAYOUT_ID.trim()+E.FATHER_FIELD.trim()].push(A)}n[E.ITEM_CODE]=t.guid()}else console.warn(`ER: The dropdown data source for [${r.FUNCTION_ID}.${E.ITEM_CODE}] is not configured!`);E.ITEM_MUST_FLAG==="1"&&(E.MUST_INPUT_CONDITION.trim().length>0?d.push({ITEM_CODE:E.ITEM_CODE,COL_CAPTION:E.COL_CAPTION,FIELD_NAME:E.FIELD_NAME,MUST_INPUT_CONDITION:E.MUST_INPUT_CONDITION,CONDITION_TABLE:E.CONDITION_TABLE}):c.push({ITEM_CODE:E.ITEM_CODE,COL_CAPTION:E.COL_CAPTION,FIELD_NAME:E.FIELD_NAME}))})}this._dropDownRefreshKey[r.FUNCTION_ID]=n,this._dropDownBindSource[r.FUNCTION_ID]=i,this._requiredFields[r.FUNCTION_ID]=c,this._requiredFieldsByCondition[r.FUNCTION_ID]=d}setCustomPartition(r){return this._customPartition=r,this._customPartition}setLayoutCaption(r,i){this.setLayoutOptions(r,"layoutCaption",i)}getLayoutCaption(r){return t.toString(this.getLayoutOptions(r,"layoutCaption"))}getLayoutBindModel(r){if(this._layoutBindModel[r]===void 0){const i=new T;i.uid="",this._layoutBindModel[r]=l.reactive(i)}return this._layoutBindModel[r]}refreshLayoutBindModel(r){const i=this.getBindingTable(r);let n=i==null?void 0:i.Current;n||(n=new T,n.uid=""),this._layoutBindModel[r]=l.reactive(n),this._layoutBindModelUid[r]=n.uid}setLayoutBindForm(r,i){this.setLayoutOptions(r,"bindForm",i)}getLayoutBindForm(r){return this.getLayoutOptions(r,"bindForm")}setLayoutOptions(r,i,n){return(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&(r=r.trim(),i=i.trim(),this._layoutOpitons[r]=this._layoutOpitons[r]||{},this._layoutOpitons[r][i]=n),this}getLayoutOptions(r,i){let n;return(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&(r=r.trim(),this._layoutOpitons[r]&&(n=this._layoutOpitons[r][i==null?void 0:i.trim()])),(n==null?void 0:n.value)!==void 0?n==null?void 0:n.value:n}setLayoutItemOption(r,i,n){return(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&n&&(this._layoutItemOpitons[r]=this._layoutItemOpitons[r]||{},this._layoutItemOpitons[r][i]=this._layoutItemOpitons[r][i]||{},Object.keys(n).forEach(c=>{l.isRef(this._layoutItemOpitons[r][i][c])?this._layoutItemOpitons[r][i][c].value=n[c]:this._layoutItemOpitons[r][i][c]=l.ref(n[c])})),this}getLayoutItemOption(r,i,n){let c;return this._layoutItemOpitons[r]&&this._layoutItemOpitons[r][i]&&(c=this._layoutItemOpitons[r][i][n]),(c==null?void 0:c.value)!==void 0?c==null?void 0:c.value:c}setLayoutItemValidateRules(r,i,n,c=!1){if((r==null?void 0:r.trim().length)>0&&typeof i=="string"&&(i==null?void 0:i.trim().length)>0){const d=this.getLayoutBindForm(r);if(d!=null&&d.rulesRef)if(d.rulesRef[i]=d.rulesRef[i]||[],c&&d.rulesRef[i])if((n==null?void 0:n.length)>0){const p=[];n.forEach((m,_)=>{n[_].itemCode=i;let E=!1;for(let v=0;v<d.rulesRef[i].length;v++)if(d.rulesRef[i][v].customType===m.customType){d.rulesRef[i][v]=m,E=!0;break}E||p.push(m)}),p.length>0&&d.rulesRef[i].push(...p)}else d.rulesRef[i]=[];else d.rulesRef[i].push(...n)}return this}setLayoutItemCaptionForeColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{d.trim().length>0&&this.setLayoutItemOption(r,d,{LabelForeColor:n})}),this}setLayoutItemCaptionBackColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{d.trim().length>0&&this.setLayoutItemOption(r,d,{LabelBackColor:n})}),this}setLayoutItemContentForeColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{if(d.trim().length>0){const p=this.getLayoutItemOption(r,d,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","erTreeSelect","erMultiTreeSelect","antInput","antInputNumber","antDateTimePicker","antDatePicker","antMonthPicker","antYearPicker"].includes(p)&&this.setControlCss(r,d,[{property:"color",value:n}]),this.setLayoutItemOption(r,d,{TextForeColor:n})}}),this}setLayoutItemContentBackColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{if(d.trim().length>0){const p=this.getLayoutItemOption(r,d,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","antInput","antInputNumber"].includes(p)&&this.setControlCss(r,d,[{property:"background",value:n}]),this.setLayoutItemOption(r,d,{TextBackColor:n})}}),this}setLayoutConditionStyleConfigInfo(r,i,n){return this._layoutConditionStyleInfo[r]=this._layoutConditionStyleInfo[r]||{},this._layoutConditionStyleInfo[r][i]=n,this}setLayoutConditionStyle(r,i){if((r==null?void 0:r.trim().length)>0){const n=this.getLayoutBindModel(r);if(n&&this._layoutConditionStyleInfo[r==null?void 0:r.trim()]){const c=p=>{var _,E,v,A,B,Q,N,W;const m=this._layoutConditionStyleInfo[r==null?void 0:r.trim()][p];m&&(e.Core.checkExpressionValid(n,e.Core.getSystemFormatString(m.condition))?(((_=m.labelForeColor)==null?void 0:_.trim().length)>0&&this.setLayoutItemCaptionForeColor(r,p,m.labelForeColor),((E=m.labelBackgroundColor)==null?void 0:E.trim().length)>0&&this.setLayoutItemCaptionBackColor(r,p,m.labelBackgroundColor),((v=m.textForeColor)==null?void 0:v.trim().length)>0&&this.setLayoutItemContentForeColor(r,p,m.textForeColor),((A=m.textBackgroundColor)==null?void 0:A.trim().length)>0&&this.setLayoutItemContentBackColor(r,p,m.textBackgroundColor)):(((B=m.labelForeColor)==null?void 0:B.trim().length)>0&&this.setLayoutItemCaptionForeColor(r,p,""),((Q=m.labelBackgroundColor)==null?void 0:Q.trim().length)>0&&this.setLayoutItemCaptionBackColor(r,p,""),((N=m.textForeColor)==null?void 0:N.trim().length)>0&&this.setLayoutItemContentForeColor(r,p,""),((W=m.textBackgroundColor)==null?void 0:W.trim().length)>0&&this.setLayoutItemContentBackColor(r,p,"")))};let d;i instanceof Array?d=i:i&&(i==null?void 0:i.trim().length)>0?d=i.split(","):d=Object.keys(this._layoutConditionStyleInfo[r]),(d==null?void 0:d.length)>0&&d.forEach(p=>{c(p)})}}return this}bindGridCustomEvent(r,i,n){return this._gridCustomEvent[r]=this._gridCustomEvent[r]||{},this._gridCustomEvent[r][i]=n,this}getGridCustomEvent(r,i){let n;return this._gridCustomEvent[r]&&this._gridCustomEvent[r][i]&&(n=this._gridCustomEvent[r][i]),n}getCompanyName(r){return""}cloneTableForLayoutOrGrid(r,i,n){var c,d,p,m,_,E;if(this.InitializeFlag>0&&r.trim().length>0&&i.trim().length>0&&n.trim().length>0&&!((c=this._formDataSet)!=null&&c.contains(i.trim())))if(n=n.trim(),r=r.trim(),i=i.trim(),(d=this._formDataSet)!=null&&d.contains(r)||(r=this.getBindingTableName(r)),r.length>0&&((p=this._formDataSet)!=null&&p.contains(r))){const v=(m=this._formDataSet)==null?void 0:m.getDataTable(r),A=(_=this._formDataSet)==null?void 0:_.cloneDataTable(v,i);(E=this._formDataSet)==null||E.addDataTable(i,A),this._configInfo.TSI00GRIDVIEW.getMappedRows().every(Q=>Q.FUNCTION_ID===n?(Q.TABLE_NAME=i,!1):!0),this._formBindingRelation[n]=i;const B=this.getGrid(n);B&&(v.removeBindingInfo(this,n),B.gridOptions.context.bindingSource=A,B.gridOptions.context.bindTableName=i,A.setBindingInfo(this,n,"Grid"))}else this.messageError(`ER: The origin table [${r}] does not exist!`);return this}containsConfig(r){const i=this.getConfigInfo(r);return!!(i&&i.TSI00GRIDCOLUMN&&i.TSI00GRIDCOLUMN.length>0)}isEmptyConfig(r){return!this.containsConfig(r)}getConfigInfo(r,i=!1){let n={},c=e.SysInfo.CompanyCode;if(c||(c=this.DefaultConfigCompanyCode),this._tempSingleConfigInfo[r])n=this._tempSingleConfigInfo[r];else{let d=[];if(this._configInfo.TSI00GRIDVIEW&&(d=this._configInfo.TSI00GRIDVIEW.getMappedRows().filter(p=>p.FUNCTION_ID===r),d.length>0)){n.TSI00GRIDVIEW=d;const p=n.TSI00GRIDVIEW.FUNCTION_TYPE,m=n.TSI00GRIDVIEW.MATCH_FLAG;this._configInfo.TSI00GRIDCOLUMN&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c&&(_.IS_VISIBLE==="1"||i===!1)),d.length>0&&(n.TSI00GRIDCOLUMN=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode&&(_.IS_VISIBLE==="1"||i===!1)),d.length>0&&(n.TSI00GRIDCOLUMN=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDCOLUMNURL&&p!=="F"&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c),d.length>0&&(n.TSI00GRIDCOLUMNURL=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode),d.length>0&&(n.TSI00GRIDCOLUMNURL=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDSTYLE&&p!=="F"&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c&&_.NTYPE.length>2&&_.NTYPE.substring(0,2).toUpperCase()==="W_"),d.length>0&&(n.TSI00GRIDSTYLE=d),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode&&_.NTYPE.length>2&&_.NTYPE.substring(0,2).toUpperCase()==="W_"),d.length>0&&(n.TSI00GRIDSTYLE=d),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDBAND&&p!=="F"&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c),d.length>0&&(n.TSI00GRIDBAND=d),this._currentConfigCompanyCode["TSI00GRIDBAND"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode),d.length>0&&(n.TSI00GRIDBAND=d),this._currentConfigCompanyCode["TSI00GRIDBAND"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDVIEWCUS&&p!=="F"&&(d=this._configInfo.TSI00GRIDVIEWCUS.getMappedRows().filter(_=>_.FUNCTION_ID===r),d.length>0&&(n.TSI00GRIDVIEWCUS=d)),this._tempSingleConfigInfo[r]=n}}return n}getSingleViewConfigInfo(r){let i={};return this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().length>0&&this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().every(n=>n.FUNCTION_ID===r?(i=n,!1):!0),i}getSingleItemConfigInfo(r,i,n){let c={};if(this._gridColumnsConfigInfo[r]===void 0&&(this._gridColumnsConfigInfo[r]={}),this._gridColumnsConfigInfo[r][i])c=this._gridColumnsConfigInfo[r][i];else{let d=[];(!n||n.trim().length===0)&&(n=e.SysInfo.CompanyCode),n||(n=this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+r]);const p=this.getConfigInfo(r);p.TSI00GRIDCOLUMN&&(d=p.TSI00GRIDCOLUMN,d.length>0&&(d.every((m,_)=>m.COMPANY_CODE===n&&m.FUNCTION_ID===r&&m.ITEM_CODE===i||m.COMPANY_CODE===this.DefaultConfigCompanyCode&&m.FUNCTION_ID===r&&m.ITEM_CODE===i?(c=m,!1):!0),Object.keys(c).length>0&&p.TSI00GRIDVIEW&&(d=p.TSI00GRIDVIEW,d.length>0&&(c.FUNCTION_TYPE=d[0].FUNCTION_TYPE))),this._gridColumnsConfigInfo[r][i]=c)}return c}getAllItemCodeArray(r){const i=[];r=this.getConfigIdbyLayoutName(r);const n=this.getConfigInfo(r);if(n.TSI00GRIDCOLUMN){const c=n.TSI00GRIDCOLUMN;c.length>0&&c.forEach(d=>{i.push(d.ITEM_CODE)})}return i}getAllConfigIdArray(){const r=[];if(this._configInfo.TSI00GRIDVIEW){const i=this._configInfo.TSI00GRIDVIEW.getMappedRows();i.length>0&&i.forEach(n=>{r.push(n.ITEM_CODE)})}return r}getItemDropDownDataSource(r,i){var d;let n=[];const c=this.getSingleItemConfigInfo(r,i);return((d=c==null?void 0:c.SVC_NAME)==null?void 0:d.trim().length)>0&&(this._configInfo[c.FUNCTION_ID+c.ITEM_CODE+o.CompanyCode]?n=this._configInfo[c.FUNCTION_ID+c.ITEM_CODE+o.CompanyCode].getMappedRows():this._configInfo[c.FUNCTION_ID+c.ITEM_CODE]?n=this._configInfo[c.FUNCTION_ID+c.ITEM_CODE].getMappedRows():this._configInfo[c.FUNCTION_ID+c.SVC_NAME]?n=this._configInfo[c.FUNCTION_ID+c.SVC_NAME].getMappedRows():this._configInfo["SI->"+c.SVC_NAME]?n=this._configInfo["SI->"+c.SVC_NAME].getMappedRows():this._configInfo["EP->"+c.SVC_NAME]?n=this._configInfo["EP->"+c.SVC_NAME].getMappedRows():this._configInfo["PM->"+c.SVC_NAME]?n=this._configInfo["PM->"+c.SVC_NAME].getMappedRows():this._configInfo[this._formName+c.SVC_NAME]?n=this._configInfo[this._formName+c.SVC_NAME].getMappedRows():this._configInfo[c.SVC_NAME]?n=this._configInfo[c.SVC_NAME].getMappedRows():this.messageError(`Can not find the data source config for [${r}.${i}]!`)),n}setDropDownBindOptions(r,i,n){var ue,me;const c=t.toString(i.DISPLAY_COLS).toUpperCase();let d=t.toString(i.DISPLAY_CAPTIONS).trim(),p=!1;const m=t.toString(i.VALUE_MEMBER).toUpperCase(),_=t.toString(i.DISPLAY_MEMBER).toUpperCase(),E=t.toNumber(i.VALUE_POSITION),v=t.toNumber(i.DISPLAY_POSITION),A=[],B=e.Core.$t("ERX.CodeColumn")||"代码",Q=e.Core.$t("ERX.DescriptionColumn")||"描述";d.startsWith("$t(")&&d.endsWith(")")&&(d=d.substring(3,d.length-1),p=!0);let N="CODE";m.trim().length>0&&(N=m.trim());let W="CODE_DESC_1_CONTENT";_.trim().length>0&&(W=_.trim()),A.push(N,W);const J={dataValueField:"",dataTextField:"",dataSource:[],filterFields:A,columns:[{field:N,title:B,width:150},{field:W,title:Q,width:150}],codeClass:i.SVC_NAME,layoutType:r,columnConfig:i};let re=[];n&&n instanceof Function&&(n=n());const Se=n||this.getItemDropDownDataSource(i.FUNCTION_ID,i.ITEM_CODE)||[];if(c.length>0&&d.length>0){const Z=c.split(","),Te=d.split(",");if(Z.length!==Te.length)this.messageError("[DisplayColumns] array length need same to [DisplayCaptions] array length!");else{const ce=[];for(let ze=0;ze<Z.length;ze++){const Me={field:Z[ze],title:Te[ze].trim(),width:150};Me.title.startsWith("$t(")&&Me.title.endsWith(")")?Me.title=this.$t(Me.title.substring(3,Me.title.length-1)):p&&(Me.title=this.$t(Me.title)),ce.push(Me),A.push(Me.field)}m.trim().length>0&&_.trim().length>0?(N=m.trim(),W=_.trim()):(E>=0&&E<Z.length?N=Z[E]:N=Z[0],v>=0&&E<Z.length?W=Z[v]:Z.length>1?W=Z[1]:W=Z[0]),J.columns=ce,J.dropDownWidth=ce.length*150,J.dataValueField=N,J.dataTextField=W}}else if(Se.length>0){const Z=Object.keys(Se[0]);(Se[0][N]===void 0||Se[0][W]===void 0)&&(Se[0][N]===void 0&&(N=Z[0]),Se[0][W]===void 0&&(Z.length>1?W=Z[1]:W=Z[0])),J.columns=i.VALUE_VISIBLE==="1"?[{field:N,title:B,width:150},{field:W,title:Q,width:150}]:[{field:W,title:Q,width:150}],i.VALUE_VISIBLE==="1"&&A.push(N)}else m.trim().length>0&&_.trim().length>0&&(N=m.trim(),W=_.trim(),J.columns=i.VALUE_VISIBLE==="1"?[{field:N,title:B,width:150},{field:W,title:Q,width:150}]:[{field:W,title:Q,width:150}],i.VALUE_VISIBLE==="1"&&A.push(N));return i.ADD_EMPTY_ITEM==="1"&&(J.optionLabel="—-—"),i.FORMAT_TYPE==="Custom"&&((ue=i.FORMAT_STRING)==null?void 0:ue.trim().length)>0?J.displayFormat=(me=i.FORMAT_STRING)==null?void 0:me.trim():i.DISPLAY_POSITION===i.VALUE_POSITION&&t.toNumber(i.VALUE_POSITION)>=0||i.DISPLAY_MEMBER===i.VALUE_MEMBER&&i.VALUE_MEMBER.trim().length>0?J.displayFormat="{0}":i.VALUE_VISIBLE==="1"?J.displayFormat="{0}|{1}":J.displayFormat="{1}",Se&&Se instanceof Array&&(re=Se.map(Z=>({...Z,value:Z[N],label:Z[W]}))),A.push(W),J.autoWidth=!0,J.dataSource=re,J.dataValueField=N,J.dataTextField=W,J}filterDropDownCascaderDataSource(r,i,n){const c=[];if(n instanceof Array&&n.length>0?c.push(...n):e.Core.toString(n).length>0&&c.push(e.Core.toString(n)),r&&r.length>0&&i.length>0&&c.length>0){const d=i.indexOf(" like ")>=0?"like":i.indexOf(" <> ")>=0?"<>":"=",p=i.split(d);if(p.length===2){const m=p[0].trim().toUpperCase(),_=p[1].trim().toUpperCase(),E=[];return r.forEach(v=>{const A=e.Core.toString(v[m]).trim();if(A.length>0){for(let B=0;B<c.length;B++)if(d==="like"){if(_.startsWith("'%")&&_.endsWith("%'")&&A.indexOf(c[B])>=0){E.push(v);break}else if(_.startsWith("'%")&&A.endsWith(c[B])){E.push(v);break}else if(A.startsWith(c[B])){E.push(v);break}}else if(d==="<>"&&A!==c[B]){E.push(v);break}else if(A===c[B]){E.push(v);break}}}),E}}return r}setDropDownCascaderDataSource(r,i,n){this._dropDownCascader[r+i]&&this._dropDownCascader[r+i].length>0&&this._dropDownCascader[r+i].forEach(d=>{if(d.FUNCTION_TYPE==="F"){const p=this._dropDownBindSource[d.FUNCTION_ID][d.ITEM_CODE].dataSource,m=d.FORM_FILTER.trim(),_=this.filterDropDownCascaderDataSource(p,m,n);d.dataSource=_,this.reloadDropDownDataSource(d.FUNCTION_ID,d.ITEM_CODE,d.dataSource)}})}getDropDownCascaderDataTable(r,i,n,c){let d;return r.trim().length>0&&i.trim().length>0&&n.trim().length>0&&c.trim().length>0&&this._dropDownCascader[n.trim()+c.trim()]&&this._dropDownCascader[n.trim()+c.trim()].length>0&&this._dropDownCascader[n.trim()+c.trim()].every(p=>p.FUNCTION_ID===r.trim()&&p.ITEM_CODE===i.trim()?(d=p.dataSource,!1):!0),d}getGridStyleConfig(r){return this._gridStyleInfo[r]}setDropDownAutoFillFieldForLayout(r,i,n){n&&n instanceof Array&&(n=n.join(","));const c=this.getSingleItemConfigInfo(r,i);if(c&&c.AUTOFILL_COLS&&c.AUTOFILL_COLS.trim().length>0){const p=c.AUTOFILL_COLS.trim().split(";"),m=this.getDropDownSelectedData(r,i,n);p.forEach(_=>{if(_.trim().length>0){const E=_.split("="),v=E[0].trim().toUpperCase();let A=E[0].trim().toUpperCase();if(E.length>1&&(A=E[1].trim().toUpperCase()),m&&m instanceof Array){let B="";m.forEach(Q=>{const N=e.Core.toString(Q[v]).trim();N.length>0&&(B=B.length===0?N:B+","+N)}),this.setControlValue(r,A,B)}else this.setControlValue(r,A,m[v])}})}}setDropDownAutoFillFieldsForGrid(r,i,n){var d,p,m,_,E,v,A,B,Q,N;const c=this.getGrid(r);if(c&&((d=n==null?void 0:n.data)!=null&&d.uid)){const W=(p=c.gridOptions.context)==null?void 0:p.configId,J=(_=(m=c.gridOptions.context)==null?void 0:m.viewConfig)==null?void 0:_.AUTO_SELECT_MODE,re=this.getGridColumn(r,i);if((v=(E=re==null?void 0:re.colDef)==null?void 0:E.context)!=null&&v.columnConfig){const Se=(B=(A=re==null?void 0:re.colDef)==null?void 0:A.context)==null?void 0:B.columnConfig;let ue=[],me={};if(Se&&Se.AUTOFILL_COLS&&Se.COLUMN_EDIT!=="3"){const Z=Se.AUTOFILL_COLS;Z.length>0&&(ue=Z.split(";"),n.data[i]&&(me=this.getDropDownSelectedData(W,i,n.data[i])),ue.forEach(Te=>{if(Te.trim().length>0){const ce=Te.trim().split("="),ze=ce[0].toUpperCase().trim();let Me=ce[0].toUpperCase().trim();if(ce.length>1&&(Me=ce[1].toUpperCase().trim()),me&&me instanceof Array){let ge="";me.forEach(le=>{const Y=e.Core.toString(le[ze]).trim();Y.length>0&&(ge=ge.length===0?Y:ge+","+Y)}),n.data.set(Me,ge)}else n.data.set(Me,me[ze]);c.gridOptions.api.refreshCells({rowNodes:[n],columns:[Me,e.SysInfo.GridCheckColumnFieldName]})}}))}if(n.isSelected()&&Se.MULTI_ROW_EDIT==="1"&&J!=="1"&&J!=="3"){const Z=this.getGridOptions(W,"multiRowEdit");if(Z!==!1&&Z!=="0")if(((N=(Q=c.gridOptions.context)==null?void 0:Q.options)==null?void 0:N.multiRowEditType)==="all"){const Te=this.getGridSelectRows(c);(Te==null?void 0:Te.length)>0&&Te.forEach(ce=>{n.data.uid!==ce.uid&&ue.forEach(ze=>{if(ze.trim().length>0){const Me=ze.trim().split("="),ge=Me[0].toUpperCase().trim();let le=Me[0].toUpperCase().trim();if(Me.length>1&&(le=Me[1].toUpperCase().trim()),ce){if(me&&me instanceof Array){let Y="";me.forEach(Fe=>{const ke=e.Core.toString(Fe[ge]).trim();ke.length>0&&(Y=Y.length===0?ke:Y+","+ke)}),ce.set(le,Y)}else ce.set(le,me[ge]);c.gridOptions.api.refreshCells({rowNodes:[n],columns:[le,e.SysInfo.GridCheckColumnFieldName]})}}})})}else{const Te=[];c.gridOptions.api.forEachNodeAfterFilter(ce=>{var ze;ce!=null&&ce.selected&&((ze=ce.data)!=null&&ze.uid)&&ce.data.uid!==n.data.uid&&Te.push(ce)}),(Te==null?void 0:Te.length)>0&&Te.forEach(ce=>{n.data.uid!==ce.data.uid&&ue.forEach(ze=>{if(ze.trim().length>0){const Me=ze.trim().split("="),ge=Me[0].toUpperCase().trim();let le=Me[0].toUpperCase().trim();if(Me.length>1&&(le=Me[1].toUpperCase().trim()),me&&me instanceof Array){let Y="";me.forEach(Fe=>{const ke=e.Core.toString(Fe[ge]).trim();ke.length>0&&(Y=Y.length===0?ke:Y+","+ke)}),ce.data.set(le,Y)}else ce.data.set(le,me[ge]);c.gridOptions.api.refreshCells({rowNodes:[n],columns:[le,e.SysInfo.GridCheckColumnFieldName]})}})})}}}}}addDropDownCode(r,i,n,c="push"){var d,p;if((r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&(n==null?void 0:n.length)>0&&this._dropDownBindSource[r.trim()]&&this._dropDownBindSource[r.trim()][i.trim()]){const m=this._dropDownBindSource[r.trim()][i.trim()];if(m.dataSource!==void 0&&m.dataSource instanceof Array){c==="unshift"?m.dataSource.unshift(...n):m.dataSource.push(...n);const _=this.getSingleItemConfigInfo(r,i);if(_.FUNCTION_TYPE==="F")this._dropDownRefreshKey[r][i]=t.guid(),this.setControlEmptyValue(r,i);else if(_.FUNCTION_TYPE==="G"||_.FUNCTION_TYPE==="P"){const E=this.getGridColumn(r,i);if(E.colDef){this.setGridColumnDropdown(r,E.colDef,m.dataSource,(d=E.colDef.context)==null?void 0:d.valueField,(p=E.colDef.context)==null?void 0:p.textField,m.displayFormat);const v=this.getGridApi(r);v==null||v.refreshCells({columns:[E.colId]})}}}}}async reloadDropDownDataSource(r,i,n){var c,d,p,m;if((r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0){const _=this.getSingleItemConfigInfo(r,i);if(_){let E=[];if(n&&n instanceof Function&&(n=n()),n instanceof ut.EiBlock)E=n.getMappedRows();else if(n instanceof Array)E=n;else if(_.ORIGIN_CODE==="2"&&_.SVC_NAME.trim().length>0){const A=await this.queryDataByDataSource(_.SVC_NAME.trim());e.Core.toNumber((c=A.SysInfo)==null?void 0:c.Flag)>=0&&(E=A.getBlockByIndex(0).getMappedRows())}const v=this.setDropDownBindOptions(_.FUNCTION_TYPE,_,E);if(this._dropDownBindSource[r.trim()]=this._dropDownBindSource[r.trim()]||{},this._dropDownBindSource[r.trim()][i.trim()]=v,_.FUNCTION_TYPE==="F"){const A=this.getControlValue(r,i);A&&!((d=v==null?void 0:v.dataSource)!=null&&d.some(B=>B[v.dataValueField]===A))&&this.setControlEmptyValue(r,i)}else if(_.FUNCTION_TYPE==="G"||_.FUNCTION_TYPE==="P"){const A=this.getGridColumn(r,i);if(A!=null&&A.colDef){this.setGridColumnDropdown(r,A.colDef,E,(p=A.colDef.context)==null?void 0:p.valueField,(m=A.colDef.context)==null?void 0:m.textField,v.displayFormat);const B=this.getGridApi(r);B==null||B.refreshCells({columns:[A.colId]})}}this._dropDownRefreshKey[r][i]=t.guid()}}}createDataSet(){var n,c,d,p;const r=[];let i="";this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(m=>{var _,E,v;if(((_=m.TABLE_NAME)==null?void 0:_.trim().length)>0&&((E=m.DATASET_NAME)==null?void 0:E.trim().length)>0){const A={};m.FUNCTION_TYPE==="T"&&((v=m.CURRENT_NODE_DESC)==null?void 0:v.trim().length)>0&&m.FATHER_NODE_DESC.trim().length>0&&(A.hierarchy={primaryField:m.CURRENT_NODE_DESC.trim(),parentField:m.FATHER_NODE_DESC}),this.createDataTable(m.TABLE_NAME.trim(),A)&&r.push({tableName:m.TABLE_NAME.trim()}),i=m.DATASET_NAME.trim()}}),((d=(c=(n=this._configInfo)==null?void 0:n.TSI00DATARELATION)==null?void 0:c.getMappedRows())==null?void 0:d.length)>0&&this._configInfo.TSI00DATARELATION.getMappedRows().forEach(m=>{r.findIndex(_=>_.tableName===m.RESERVE1)>=0&&r.findIndex(_=>_.tableName===m.RESERVE7)>=0&&(this._formDataSet.relations[m.RELATION_NAME]=this._formDataSet.relations[m.RELATION_NAME]||[],this._formDataSet.relations[m.RELATION_NAME].push({ParentTable:m.RESERVE1,ChildTable:m.RESERVE7,ParentColumn:m.RESERVE2,ChildColumn:m.RESERVE8}))}),(p=this._formDataSet)==null||p.setName(i)}createDataTable(r,i){var d,p,m,_,E,v,A;let n;const c={...i};if(r.trim().length>0&&!this._formDataSet.dataTables[r.trim()]){const B={};((p=(d=this._configInfo.TSI00DATATABLE)==null?void 0:d.getMappedRows())==null?void 0:p.length)>0&&this._configInfo.TSI00DATATABLE.getMappedRows().forEach(Q=>{if(Q.TABLE_NAME===r.trim()){const N={name:Q.COL_NAME,caption:Q.COL_CAPTION,maxLength:Q.MAX_LENGTH};switch(Q.DATA_TYPE){case"2":N.type="number",N.defaultValue=t.toNumber(Q.DEFAULT_VALUE);break;case"3":N.type="datetime",N.defaultValue=t.getDateTimeByString(Q.DEFAULT_VALUE,"Dayjs");break;case"4":N.type="boolean",N.defaultValue=t.toBoolean(Q.DEFAULT_VALUE);break;default:N.type="string",N.defaultValue=t.getSystemFormatString(Q.DEFAULT_VALUE).trim();break}B[Q.COL_NAME]=N}}),Object.keys(B).length>0&&(B[o.IdFieldName]={name:o.IdFieldName,type:"string"},c.schema=B,n=new S(c),this._formDataSet.addDataTable(r.trim(),n))}else n=(m=this._formDataSet)==null?void 0:m.dataTables[r.trim()],c.schema=(_=n==null?void 0:n.options)==null?void 0:_.schema,c.hierarchy=c.hierarchy||((E=n==null?void 0:n.options)==null?void 0:E.hierarchy);return(v=i==null?void 0:i.hierarchy)!=null&&v.primaryField&&((A=i==null?void 0:i.hierarchy)!=null&&A.parentField)&&(c.schema[i.hierarchy.primaryField]===void 0&&console.error(`ER: Hierarchy DataTable's PrimaryField [${i.hierarchy.primaryField}] not exists!`),c.schema[i.hierarchy.parentField]===void 0&&console.error(`ER: Hierarchy DataTable's ParentField [${i.hierarchy.parentField}] not exists!`)),n||console.error(`ER: DataTable [${r}] creation failed!`),n}getTableName(r){var i;return(i=this._formDataSet)==null?void 0:i.getTableName(r)}getBindingTableName(r){let i="";return r.trim().length>0&&this._formBindingRelation[r.trim()]&&(i=this._formBindingRelation[r.trim()]),i}setBindingTableName(r){var c;let i="";const n=this.getSingleViewConfigInfo(r.trim());return n&&n.TABLE_NAME&&n.TABLE_NAME.trim().length>0&&((c=this._formDataSet)!=null&&c.contains(n.TABLE_NAME.trim()))&&(i=n.TABLE_NAME.trim(),this._formBindingRelation[r]=i),i}getBindingTable(r){var c;let i;const n=this.getBindingTableName(r);return n&&n.trim().length>0&&(i=(c=this._formDataSet)==null?void 0:c.dataTables[n]),i}getBindingTableAsBlock(r){let i;const n=this.getBindingTable(r);return n&&n instanceof S&&(i=n.data(),i&&(i=this.convertDataType(i,n,"weakly"))),t.buildEiBlock(i||{},"Table0")}hasDataChange(...r){let i=!1;return r.length===0?r=Object.keys(this._formBindingRelation):r.length===1&&(r=r[0].split(",")),r.forEach(n=>{const c=this.getBindingTable(n);if(c&&c instanceof S)if(!i)i=c.hasChanges();else return i}),i}cancelGridChange(r){var n,c;const i=this.getGrid(r);if(i){const d=(c=(n=i.gridOptions)==null?void 0:n.context)==null?void 0:c.bindingSource;d&&d instanceof e.DataTable&&d.cancelChanges()}return this}mergeDataToLayoutOrGrid(r,i=!0,...n){var c,d,p,m;if(this.isNullOrEmpty(n)?n=Object.keys(this._formBindingRelation):n.length===1&&n[0]&&typeof n[0]=="string"&&(n=n[0].split(",")),n.length>0){if(n.length===1&&n[0].trim().length>0){const _=this.getBindingTableName(n[0]);(_==null?void 0:_.trim().length)>0&&(r instanceof ut.EiBlock?(c=this._formDataSet)==null||c.mergeData(_.trim(),r.getMappedRows(),i):r instanceof ut.EiInfo?r.getBlock(_.trim())?(d=this._formDataSet)==null||d.mergeData(_.trim(),r.getBlock(_.trim()).getMappedRows(),i):Object.keys(r).length>0&&((p=this._formDataSet)==null||p.mergeData(_.trim(),r.getBlockByIndex(0).getMappedRows(),i)):r instanceof Array&&r&&r.length>0&&((m=this._formDataSet)==null||m.mergeData(_.trim(),r,i)),this.autoBestFit(n[0]))}else if(r instanceof ut.EiInfo){const _={};n.forEach(E=>{var A;const v=this.getBindingTableName(E);(v==null?void 0:v.trim().length)>0&&r.getBlock(v.trim())&&(_[v]||((A=this._formDataSet)==null||A.mergeData(v.trim(),r.getBlock(v.trim()).getMappedRows(),i),_[v]=!0),this.autoBestFit(E))})}}return this}checkFormChanged(...r){return new Promise(i=>{this.hasDataChange(...r)?this.messageConfirm(e.Core.$t("ERX.ContinueToOperate")||"是否继续操作?").then(n=>{i(n)}).catch(()=>{i(!1)}):i(!0)})}addRowToGrid(r,i=!0,n="default",c=!1){var m,_,E,v,A,B;let d;const p=this.getGrid(r);if((m=p==null?void 0:p.gridOptions.context)!=null&&m.bindingSource){let Q={};n==="default"&&(n=this.getGridOptions(r,"insertAtTop")||"default"),n==="default"&&(n=((v=(E=(_=p==null?void 0:p.gridOptions)==null?void 0:_.context)==null?void 0:E.options)==null?void 0:v.insertAtTop)||"default");const N=this.getGridOptions(r,"autoGuidField");(i===!0||(i==null?void 0:i.setDefaultValue)===!0)&&(Q=this.getGridConfigDefaultValues(r)||{}),this._customDefaultValues[r]&&(Q={...Q,...this._customDefaultValues[r]}),i!=null&&i.data&&(Q={...Q,...i.data});const W=(A=p.gridOptions.context)==null?void 0:A.bindingSource;if(n===!0||n==="top")d=W.insert(0,Q,N);else if(n==="afterCurrent"||n==="beforeCurrent"){const J=this.getGridCurrentRow(r);if(J){let re=W.indexOf(J);re>=0&&re<W.rowCount&&n==="afterCurrent"?re=re+1:re>0&&n==="beforeCurrent"&&(re=re-1),d=W.insert(re,Q,N)}else d=W.add(Q,N)}else typeof n=="number"&&n>=0?d=W.insert(n,Q,N):d=W.add(Q,N);d[o.IdFieldName]=t.guid(),(B=p==null?void 0:p.gridOptions)!=null&&B.treeData&&(d[o.TreeHierarchyFieldName]=[d[o.IdFieldName]])}return d}addCopyRowToGrid(r,i="default",n=!1){var p,m,_;const c=this.getGrid(r);let d;if(c){i==="default"&&(i=this.getGridOptions(r,"insertAtTop")||"default"),i==="default"&&(i=((_=(m=(p=c==null?void 0:c.gridOptions)==null?void 0:p.context)==null?void 0:m.options)==null?void 0:_.insertAtTop)||"default"),(c==null?void 0:c.gridOptions.api).stopEditing();const v=this.getGridSelectRows(c);if(v.length===0){const A=this.getGridCurrentRow(c);A&&v.push(A)}if(v.length===0)d=[this.addRowToGrid(r,!0,i,n)];else{const A=this.getGridBindingTable(r);if(A){let B=-1;i==="top"||i===!0?B=0:i==="afterCurrent"||i==="default"?(B=A.indexOf(v[v.length-1]),B<A.rowCount&&(B=B+1)):i==="beforeCurrent"?(B=A.indexOf(v[0]),B>0&&(B=B-1)):typeof i=="number"&&i>=0&&(B=i),d=A.import(v,B,!0,this.getGridOptions(r,"autoGuidField"))}}}return d}importRowsToGrid(r,i,n=!1,c=!0){var m,_;let d;const p=this.getGrid(r);if((m=p==null?void 0:p.gridOptions.context)!=null&&m.bindingSource){p==null||p.gridOptions.api;const E=(_=p.gridOptions.context)==null?void 0:_.bindingSource;E&&(d=E.import(i,void 0,c))}return d}getGridAggregates(r){var n;let i;if(r){const c=this.getGrid(r);if(c){const d=c.gridOptions.api.getModel();i=(n=d==null?void 0:d.rootNode)==null?void 0:n.aggData}}return i}getModelFromGridOrLayout(r,i,n=!1,c){const d=this.getBindingTable(r);return this.getModelFromDataTable(d,i,n,c)}getModelFromGridOrLayoutAsBlock(r,i,n){const c=this.getModelFromGridOrLayout(r,i,!0,n);return this.buildEiBlock([c])}getModelFromDataTable(r,i,n=!1,c){let d;return typeof r=="string"&&r.trim().length>0&&(r=this.getBindingTable(r)),r&&r instanceof e.DataTable&&(i&&i.trim().length>0?d=r.get(i.trim()):(d=r.at(0),d=l.reactive(d))),d&&(n instanceof Function?d=n(d)||d.toJSON():d=n?d.toJSON():d,c&&Object.keys(c).forEach(p=>{d[p]=c[p]})),d}getGridDataCount(r){let i=0;const n=this.getGridConfigId(r);if(n){const c=this.getBindingTable(n);c&&c instanceof e.DataTable&&(i=c.totalCount())}return i}getModelFromDataTableById(r,i,n=!1){var d;let c;return typeof r=="string"&&r.trim().length>0&&this._formBindingRelation[r.trim()].trim().length>0&&(r=(d=this._formDataSet)==null?void 0:d.dataTables[this._formBindingRelation[r.trim()]]),r&&r instanceof S&&i&&i.trim().length>0&&(c=r.get(i.trim()),c&&(n instanceof Function?c=n(c)||c.toJSON():c=n?c.toJSON():c)),c}convertModelAsBlock(r,i){let n={};return r&&(n=r.toJSON(i)),this.buildEiBlock([n])}addModelToLayout(r,i,n){let c;if((r==null?void 0:r.trim().length)>0){const d=this.getBindingTable(r.trim());if(d){d instanceof S&&(c=d.add({}));const p=this.getRelationConfigIdsByTableName(d.tableName);i&&this.setModelDefalutValue(c,p),c=this.getLayoutBindModel(r)}else console.error("ER: Attempting to add model to a non-existent dataTable, configId: "+r)}return c}getDataFromDataTableAsBlock(r,i=0,n){let c;if(r){let p;typeof r=="string"?p=this.getBindingTable(r):p=r,p&&(c=r.at(i)),c=this.convertDataType([c],p,"weakly"),c={...c,...n}}return t.buildEiBlock(c||{},"Table0")}convertDataType(r,i,n){return t.convertDataType(r,i,n)}getModelFields(r){var i;return(i=r==null?void 0:r.options)==null?void 0:i.schema}getControlName(r,i,n){let c="antInput";switch(r){case"F1":case"G3":c="antInputGroup";break;case"FB":c="antRadioGroup";break;case"FJ":c="erRadioGroup";break;case"FK":c="erCheckboxGroup";break;case"F7":case"FA":case"FP":case"G1":case"GP":case"F6":case"FC":case"G2":c="erSelect";break;case"FD":c="erMultiSelect";break;case"F3":case"G4":case"GD":c="antMultiSelect";break;case"FL":c="erTreeSelect";break;case"FH":c="erMultiTreeSelect";break;case"F2":case"F9":case"FG":c="antInputNumber";break;case"F4":c="antCheckbox";break;case"FW":c="antSwitch";break;case"FM":c="scriptEditor";break;case"F5":t.toNumber(n==null?void 0:n.MAX_LENGTH)===2?c="antTimePicker":t.toNumber(n==null?void 0:n.MAX_LENGTH)===4?i.toLowerCase()==="hh:mm"?c="antTimePicker":c="antYearPicker":t.toNumber(n==null?void 0:n.MAX_LENGTH)===6?i.toLowerCase()==="hh:mm:ss"?c="antTimePicker":c="antMonthPicker":t.toNumber(n==null?void 0:n.MAX_LENGTH)===8?c="antDatePicker":c="antDateTimePicker";break;case"F8":case"G8":c="antTextarea";break;case"FE":case"G5":c="erMemoEditor";break;case"FN":c="antButton";break;case"FS":c="label";break;case"FT":c="antDivider";break;default:c="antInput";break}return c}resetValidator(r){let i=[];r&&(r instanceof Array?i=r:i=r.split(",")),i.length===0&&(i=this.getAllConfigIdArray());for(let n=0;n<i.length;n++){if(i[n].trim().length===0)continue;const c=this.getLayoutBindForm(i[n]);c==null||c.clearValidate()}}getLayoutLabelSpan(r,i){return t.jQuery("#"+this._formId+r+i+"_span")}getLayoutJqueryElement(r,i){let n;return n=t.jQuery("#"+this._formId+r+i),n===void 0&&(n=t.jQuery("#"+r)),n}autoBestFit(r){var n,c,d,p,m;const i=this.getGrid(r);if(i&&this.isGridOnScreen(i)){const _=(c=(n=i.gridOptions.columnApi)==null?void 0:n.columnModel)==null?void 0:c.gridColumns;(_==null?void 0:_.length)>0&&((m=(p=(d=r==null?void 0:r.gridOptions)==null?void 0:d.context)==null?void 0:p.viewConfig)==null?void 0:m.BESTFIT)==="1"&&_.forEach(E=>{E.visible&&!E.colDef.suppressSizeToFit&&i.gridOptions.columnApi.autoSizeColumn(E)})}return this}getGrid(r){var n,c;let i;return r&&typeof r=="string"&&this._gridInstanceInfo[r]!==void 0&&(r=this._gridInstanceInfo[r]),(n=r==null?void 0:r.gridOptions)!=null&&n.api&&((c=r==null?void 0:r.gridOptions)!=null&&c.columnApi)&&(i=r),i}getGridApi(r){var i,n;return(n=(i=this.getGrid(r))==null?void 0:i.gridOptions)==null?void 0:n.api}isGridOnScreen(r){const i=this.getGrid(r);return i?t.isGridOnScreen(i):!1}getGridColumnApi(r){var i,n;return(n=(i=this.getGrid(r))==null?void 0:i.gridOptions)==null?void 0:n.columnApi}getGridConfig(r){var i,n,c;return(c=(n=(i=this.getGrid(r))==null?void 0:i.gridOptions)==null?void 0:n.context)==null?void 0:c.viewConfig}getGridColumn(r,i){const n=this.getGrid(r);return t.getGridColumn(n,i)}getGridColumnDef(r,i){const n=this.getGrid(r);return t.getGridColumnDef(n,i)}showGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=i.split(","),c.length>0){const d=[];c.forEach(p=>{d.push({colId:p,hide:!1})}),n.gridOptions.columnApi.applyColumnState({state:d})}}return this}hideGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=i.split(","),c.length>0){const d=[];c.forEach(p=>{d.push({colId:p,hide:!0})}),n.gridOptions.columnApi.applyColumnState({state:d})}}return this}showGridCheckColumn(r){return this.showOrHideGridCheckColumn(r,"show")}hideGridCheckColumn(r){return this.showOrHideGridCheckColumn(r,"hide")}showOrHideGridCheckColumn(r,i="default"){var c,d,p,m;const n=this.getGrid(r);if((c=n==null?void 0:n.gridOptions)!=null&&c.api){const _=n.gridOptions.api,E=_.getColumnDef(o.GridCheckColumnFieldName);E&&(i==="hide"?(E.checkboxSelection=void 0,E.headerCheckboxSelection=void 0):(i==="show"||((d=n.gridOptions.context)==null?void 0:d.viewConfig.SHOW_SELECTION)==="1")&&(E.checkboxSelection=v=>!v.node.footer,this.getGridOptions((m=(p=n.gridOptions)==null?void 0:p.context)==null?void 0:m.configId,"RowSelection",!0)==="multiple"?E.headerCheckboxSelection=!0:E.headerCheckboxSelection=void 0),_.redrawRows(),_.refreshHeader())}return this}setGridSelectMode(r,i,n="none"){var d,p;const c=this.getGrid(r);return c&&(this.setGridOptions((p=(d=c.gridOptions)==null?void 0:d.context)==null?void 0:p.configId,"RowSelection",i,!0),this.setGridColumnOptions(c,m=>{var _;m.colId===o.GridCheckColumnFieldName&&(n==="show"||n==="hide"||i==="multiple")&&(n==="hide"?(m.checkboxSelection=void 0,m.headerCheckboxSelection=void 0):i==="multiple"?(m.checkboxSelection=E=>!E.node.footer,m.headerCheckboxSelection=n==="show"||((_=c.gridOptions.context)==null?void 0:_.viewConfig.SHOW_SELECTION)==="1"):i==="single"&&(m.headerCheckboxSelection=void 0))})),this}setGridRowDrag(r,i="default"){var c,d,p,m;const n=this.getGrid(r);if((c=n==null?void 0:n.gridOptions)!=null&&c.api){const E=n.gridOptions.api.getColumnDef(o.GridCheckColumnFieldName);E&&(i===!1?(E.rowDrag=void 0,(d=n==null?void 0:n.gridOptions)==null||d.columnApi.setColumnWidth(E.colId,55)):(i===!0||(p=n.gridOptions.context)!=null&&p.allowDragRow)&&(n.gridOptions.context.allowDragRow=!0,(m=n==null?void 0:n.gridOptions)==null||m.columnApi.setColumnWidth(E.colId,75),E.rowDrag=v=>{var A;return((A=v.context)==null?void 0:A.allowDragRow)&&!v.node.group&&!v.node.footer}),n.gridOptions.rowDragManaged=i),n.gridOptions.api.redrawRows()}return this}addGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=[i],c.length>0){const d=n.gridOptions.context.bindingSource,p=n.gridOptions.api.getColumnDefs()||[];c.forEach(m=>{var _;if(((_=m.field)==null?void 0:_.trim().length)>0){m.field=m.field.trim();const E={name:m.field,capiton:m.headerName,defaultValue:m.defaultValue,type:m.dataType||m.type||"string",maxLength:m.maxLength||-1};d.addField(E),m.colId=m.colId||m.field,n.gridOptions.api.getColumnDef(m.colId)||(m.headerComponentParams={template:`${this.getGridHeaderTemplate({color:m.headerTextColor,backColor:m.headerBackColor,fontSize:m.fontSize,title:m.headerName||m.title||m.caption})}`},m.headerClass=()=>{var A,B,Q,N,W;let v="er-grid-header-align-center";return((A=m.headerAlignment)==null?void 0:A.toLowerCase())==="near"||((B=m.headerAlignment)==null?void 0:B.toLowerCase())==="left"?v="er-grid-header-align-left":(((Q=m.headerAlignment)==null?void 0:Q.toLowerCase())==="far"||((N=m.headerAlignment)==null?void 0:N.toLowerCase())==="right")&&(v="er-grid-header-align-right"),m.required&&((W=m.requiredCondition)==null?void 0:W.trim().length)>0?v=v+" er-grid-header-maroon-star":m.required&&(v=v+" er-grid-header-red-star"),v},m.editable=m.editable===void 0?!0:m.editable,m.autoHeaderHeight=m.autoHeaderHeight===void 0?!0:m.autoHeaderHeight,m.enableRowGroup=m.enableRowGroup===void 0?!0:m.enableRowGroup,typeof m.editable!="function"&&(m.context=m.context||{},m.context.editable=m.editable,m.headerTooltip=m.headerName||m.title||m.caption,m.editable=v=>{var A,B;return((A=v.context)==null?void 0:A.editable)&&((B=v.colDef.context)==null?void 0:B.editable)&&!v.node.rowPinned}),m.filter=m.filter===void 0?"agSetColumnFilter":m.filter,m.filterParams={excelMode:"windows"},p.push(m))}}),n.gridOptions.api.setColumnDefs(p)}}return this}removeGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=i.split(","),c.length>0){let d=n.gridOptions.api.getColumnDefs()||[];d=d.filter(p=>!c.includes(p.colId)),n.gridOptions.api.setColumnDefs(d)}}return this}getGridColumnFields(r,i="string"){var d,p,m;const n=this.getGrid(r);let c=i==="Array"?[]:void 0;if((p=(d=n==null?void 0:n.gridOptions)==null?void 0:d.context)!=null&&p.configId){const _=this.getConfigInfo(n.gridOptions.context.configId);((m=_==null?void 0:_.TSI00GRIDCOLUMN)==null?void 0:m.length)>0&&_.TSI00GRIDCOLUMN.forEach(E=>{E.FIELD_NAME.trim().length>0&&E.UNBOUND_TYPE==="0"&&(i==="Array"?c.push(E.FIELD_NAME.trim()):c=c?c+","+E.FIELD_NAME.trim():E.FIELD_NAME.trim())})}return c}setGridEnable(r,i){var c,d,p;const n=this.getGrid(r);return(c=n==null?void 0:n.gridOptions)!=null&&c.context&&(n.gridOptions.api.stopEditing(),n.gridOptions.context.enable=i,(p=(d=n==null?void 0:n.gridOptions)==null?void 0:d.context)!=null&&p.configId&&(this.setGridOptions(n.gridOptions.context.configId,"enable",i,!0),document.querySelectorAll(".ag-full-width-row").forEach(_=>{_.style!==void 0&&(i?_.style.pointerEvents="all":_.style.pointerEvents="none")}))),this}setGridEditable(r,i){var c,d,p;const n=this.getGrid(r);return(c=n==null?void 0:n.gridOptions)!=null&&c.context&&(n.gridOptions.api.stopEditing(),n.gridOptions.context.editable=i,(p=(d=n==null?void 0:n.gridOptions)==null?void 0:d.context)!=null&&p.configId&&this.setGridOptions(n.gridOptions.context.configId,"editable",i,!0)),this}setGridIndicator(r,i,n){if(r&&i&&Object.keys(i).length>0){const c=this.getGrid(r);setTimeout(()=>{var d,p,m,_,E,v,A;if((d=c==null?void 0:c.gridOptions)!=null&&d.api&&((m=(p=c==null?void 0:c.gridOptions)==null?void 0:p.context)!=null&&m.bindingSource)){const B=(_=c==null?void 0:c.gridOptions)==null?void 0:_.api,N=((v=(E=c==null?void 0:c.gridOptions)==null?void 0:E.context)==null?void 0:v.bindingSource).data().find(W=>{for(const J in i)if(W[J]!==i[J])return!1;return!0});if(N!=null&&N.uid){B.clearFocusedCell();const W=(A=c==null?void 0:c.gridOptions)==null?void 0:A.api.getRowNode(N==null?void 0:N.uid);W&&this.setGridFocusedCell(r,W.rowIndex,e.SysInfo.GridCheckColumnFieldName,n)}}},250)}return this}refreshGridFooterData(r){var n,c,d;const i=this.getGrid(r);if((n=i==null?void 0:i.gridOptions)!=null&&n.api){const p=(c=i==null?void 0:i.gridOptions)==null?void 0:c.api;if(p.getPinnedBottomRowCount()>0){p.refreshClientSideRowModel("aggregate");const m=p.getModel();p.setPinnedBottomRowData([{...(d=m==null?void 0:m.rootNode)==null?void 0:d.aggData,pinndeRowType:"ErGridSummaryFooter"}])}}return this}setLayoutConfigRelationInfo(r,i){return this._layoutConfigRelationInfo[i]=r,this}getConfigIdbyLayoutName(r){return this._layoutConfigRelationInfo[r]&&this._layoutConfigRelationInfo[r].trim().length>0?this._layoutConfigRelationInfo[r].trim():r}getGridConfigId(r){let i="";return r&&(typeof r=="string"&&this._gridInstanceInfo[r]!==void 0?i=r:r.gridOptions&&r.gridOptions.api&&(i=r.gridOptions.gridId)),i}setWidgetInstanceInfo(r,i,n){return this.isNullOrEmpty(r)||(this._widgetInstanceInfo[r.trim()]===void 0&&(this._widgetInstanceInfo[r.trim()]={}),!this.isNullOrEmpty(i)&&n&&(this._widgetInstanceInfo[r.trim()][i.trim()]=n)),this}setControlVisible(r,i,n,c="none"){return!this.isNullOrEmpty(r)&&(n==null?void 0:n.trim().length)>0&&(r=this.getConfigIdbyLayoutName(r),n.split(",").forEach(p=>{p.trim().length>0&&(c==="empty"?this.setControlEmptyValue(r,p):c==="default"&&this.setControlDefalutValue(r,p),this.setLayoutItemOption(r,p.trim(),{visible:i}))})),this}setGridColumnTitle(r,i){if((i==null?void 0:i.length)>0){const n=this.getGrid(r);n&&(i.forEach(c=>{var p;const d=n.gridOptions.columnApi.getColumn(c.colId);if(d!=null&&d.colDef){const m=((p=d.colDef.context)==null?void 0:p.titleInfo)||{};d.colDef.headerComponentParams={template:`${this.getGridHeaderTemplate({...m,...c})}`}}}),n.gridOptions.api.refreshHeader())}return this}setGridColumnOptions(r,i){if(r&&i instanceof Function){const n=this.getGrid(r);if(n){const c=n.gridOptions.api.getColumnDefs();c.forEach(d=>{i(d)}),n.gridOptions.api.setColumnDefs(c)}}return this}setGridOptions(r,i,n,c=!1){return r=(r==null?void 0:r.trim())||"",i=(i==null?void 0:i.trim())||"",r.length>0&&i.length>0&&(c?(this._gridReactiveOptions[r]=this._gridReactiveOptions[r]||{},this._gridReactiveOptions[r][i]=n):(this._gridOptions[r]=this._gridOptions[r]||{},this._gridOptions[r][i]=n)),this}getGridOptions(r,i,n=!1){if(r=(r==null?void 0:r.trim())||"",i=(i==null?void 0:i.trim())||"",r.length>0&&i.length>0){if(n&&this._gridReactiveOptions[r])return this._gridReactiveOptions[r][i];if(!n&&this._gridOptions[r])return this._gridOptions[r][i]}}getLayoutExtentedOptions(r){var d,p;let i={};const n=this.getFormSysInfo("LayoutDefaultOptions");n.trim().length>0&&(i={...JSON.parse(n)});const c=this.getConfigInfo(r);if(((d=c==null?void 0:c.TSI00GRIDVIEW)==null?void 0:d.length)>0){const m=c.TSI00GRIDVIEW[0];if(((p=m.EXT_OPTIONS)==null?void 0:p.trim().length)>0){const _=JSON.parse(m.EXT_OPTIONS);i={...i,..._}}}return i}getGridExtentedOptions(r){var d,p;let i={};const n=this.getFormSysInfo("GridDefaultOptions");n.trim().length>0&&(i={...JSON.parse(n)});const c=this.getConfigInfo(r);if(((d=c==null?void 0:c.TSI00GRIDVIEW)==null?void 0:d.length)>0){const m=c.TSI00GRIDVIEW[0];if(((p=m.EXT_OPTIONS)==null?void 0:p.trim().length)>0){const _=JSON.parse(m.EXT_OPTIONS);i={...i,..._}}}return i}getDetailGridRenderOptions(r,i,n,c){const d=this.getGridConfigOptions(r,i,n,c);return{context:d==null?void 0:d.context,defaultColDef:d==null?void 0:d.defaultColDef,groupDisplayType:d==null?void 0:d.groupDisplayType,columnDefs:d==null?void 0:d.columnDefs,groupIncludeTotalFooter:d==null?void 0:d.groupIncludeTotalFooter,groupIncludeFooter:d==null?void 0:d.groupIncludeFooter,suppressRowClickSelection:d==null?void 0:d.suppressRowClickSelection,rowSelection:d==null?void 0:d.rowSelection,groupRowRendererParams:d==null?void 0:d.groupRowRendererParams,localeText:Ci(),enableRangeSelection:!0,stopEditingWhenCellsLoseFocus:!0,suppressRowTransform:!0,enableRtl:Ta(),statusBar:{statusPanels:[{statusPanel:"agAggregationComponent",align:"center"},{statusPanel:"agTotalAndFilteredRowCountComponent",align:"right"}]},getRowId:m=>m.data.uid,getRowStyle:m=>this.getRowStyle(m,{showDefaultFooter:!0}),getMainMenuItems:m=>this.getGridMenuItems(m),getContextMenuItems:m=>this.getGridContextMenuItems(m),onGridReady:m=>m.api.setPopupParent(document.querySelector("body")),onRowSelected:m=>this.processRowSelectedEvent(m)}}getGridEditable(r){var n,c;const i=this.getGrid(r);return((c=(n=i==null?void 0:i.gridOptions)==null?void 0:n.context)==null?void 0:c.editable)===!0}getControl(r,i,n){let c;if(this._widgetInstanceInfo[r.trim()]&&this._widgetInstanceInfo[r.trim()][i.trim()]&&(c=this._widgetInstanceInfo[r.trim()][i.trim()]),c==null)if(n&&n.trim().length>0)c=t.jQuery("#"+this._formId+r+i);else{const d=this.getSingleItemConfigInfo(r,i);if(d.FUNCTION_TYPE&&d.COLUMN_EDIT){const p=d.FUNCTION_TYPE+d.COLUMN_EDIT;n=this.getControlName(p,d.FORMAT_STRING),c=t.jQuery("#"+this._formId+r+i)}}return c}isControlEmptyValue(r,i,n){let c=!0;const d=this.getControlValue(r,i),p=Object.keys(d);for(let m=0;m<p.length;m++)if(d[p[m]]!==null&&String(d[p[m]]).trim().length>0){c=!1;break}return c}setControlConditionProps(r,i,n="ReadOnly",c,d){if(n=(n==null?void 0:n.trim())||"ReadOnly",(r==null?void 0:r.trim().length)>0){const p=r.trim()+"_"+n+"_"+(i==null?void 0:i.trim());let m=[];if(this._controlConditionProps[p])m=this._controlConditionProps[p];else if(this._configInfo.TSI00GRIDCONDITION&&this._configInfo.TSI00GRIDCONDITION.getMappedRows().length>0){const _=this.getSingleViewConfigInfo(r==null?void 0:r.trim());if(_)for(let E=0;E<this._configInfo.TSI00GRIDCONDITION.getMappedRows().length;E++){const v=this._configInfo.TSI00GRIDCONDITION.data[E];if(t.toString(v.FUNCTION_ID,!0)!==r||(i==null?void 0:i.trim().length)>0&&t.toString(v.OPERATE_NAME,!0)!==(i==null?void 0:i.trim())||_.MATCH_FLAG==="1"&&t.toString(v.COMPANY_CODE,!0)!==o.CompanyCode||t.toString(v.FIELD_NAME_ARRAY,!0).length===0)continue;const A=t.toString(v.FIELD_NAME_ARRAY,!0).split(",");v.FIELD_NAME_ARRAY=A,m.push(v)}}if(m.length>0){this._controlConditionProps[p]=m;const _=this.getAllControlValue(r);m.forEach(E=>{const v=E.FIELD_NAME_ARRAY;let A=c??E.PROP_VALUE??"default";v.forEach(B=>{if(B&&!(d!=null&&d.includes(B))){const Q=t.toString(E.REGULAR_EXPRESS,!0),N=Q.length===0||Q.replaceAll(" ","")==="1=1"||t.checkExpressionValid(_,t.getSystemFormatString(Q));A=A==!0||A==="1"||t.toString(A).toLowerCase()==="true",n==="ReadOnly"&&this.setControlReadOnly(r,N?A:"default",B)}})})}}return this}getControlValue(r,i){let n,c;if(r.trim().length>0&&i.trim().length>0){const d=i.split(",");d.length>1&&(c={});const p=this.getLayoutBindModel(r);if(p)for(let m=0;m<d.length;m++){const _=d[m].trim();if(n=null,_.length===0)continue;const E=this.getLayoutItemOption(r,_,"controlType"),v=this.getLayoutItemOption(r,_,"field");(v==null?void 0:v.trim().length)>0?n=p[v.trim()]:this._hiddenFields[r.trim()]?n=this._hiddenFields[r.trim()][_]||"":n=p[_],["antInput","antInputGroup","antTextarea","erSelect","erTreeSelect","erMemoEditor"].includes(E)?n=n||"":E==="antInputNumber"&&n==null&&(n=0),d.length>1?c[_]=n:c=n}}return c}getControlText(r,i){let n,c;if(r.trim().length>0&&i.trim().length>0){const d=i.split(",");d.length>1&&(c={});const p=this.getLayoutBindModel(r);if(p)for(let m=0;m<d.length;m++){const _=d[m].trim();if(n=null,_.length===0)continue;const E=this.getLayoutItemOption(r,_,"field"),v=this.getLayoutItemOption(r,_,"controlType"),A=this.getLayoutItemOption(r,_,"format");(E==null?void 0:E.trim().length)>0?n=p[E.trim()]:this._hiddenFields[r.trim()]?n=this._hiddenFields[r.trim()][_]||"":n=p[_],["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect"].includes(v)?n=this.getDropDownSelectedText(r,_,n):v==="antDateTimePicker"||v==="antDatePicker"||v==="antMonthPicker"||v==="antYearPicker"?n=t.toDateTime(n,"Dayjs").format(A||"YYYY-MM-DD"):v==="antInputNumber"&&(n=e.Core.formatNumberValue(n,A)),d.length>1?c[_]=n:c=n}}return c}setControlValue(r,i,n){if(t.isNullOrEmpty(r)||t.isNullOrEmpty(i))return this;if(n===void 0&&(n=null),(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0){const c=this.getLayoutBindModel(r==null?void 0:r.trim()),d=this.getLayoutItemOption(r,i,"controlType"),p=this.getLayoutItemOption(r,i,"field")||(i==null?void 0:i.trim());if(c&&p&&(["antMultiSelect","erMultiSelect"].includes(d)?n!==null?n instanceof Array?c==null||c.set(p,n,r):typeof n=="string"&&(c==null||c.set(p,n.split(","),r)):c==null||c.set(p,[],r):n!==null&&(d!=null&&d.startsWith("antCheckbox")||d!=null&&d.startsWith("antSwitch"))?c==null||c.set(p,t.toString(n)==="1"||t.toString(n).toLowerCase()==="true",r):n!==null&&(d!=null&&d.startsWith("antDate"))?c==null||c.set(p,t.toDateTime(n,"Dayjs"),r):c==null||c.set(p,n,r)),this._layoutConditionStyleInfo[r]){const m=this._layoutConditionStyleInfo[r];Object.keys(m).forEach(_=>{var E,v;(_===i||((v=(E=m[_])==null?void 0:E.condition)==null?void 0:v.indexOf(i))>-1)&&this.setLayoutConditionStyle(r,_)})}}return this}setControlValueEx(r,i,...n){const c=Object.keys(i);return(c==null?void 0:c.length)>0&&(n.length===1&&(n=n[0].split(",")),n.length>0?n.forEach(d=>{(i==null?void 0:i[d])!==void 0&&this.setControlValue(r,d,i[d])}):c.forEach(d=>{(i==null?void 0:i[d])!==void 0&&this.setControlValue(r,d,i[d])})),this}setControlCss(r,i,n){if((r==null?void 0:r.trim().length)>0&&(n==null?void 0:n.length)>0){let c;i instanceof Array?c=i:c=i.split(","),c&&c.length>0&&c.forEach(d=>{if(d.trim().length>0){const p=this.getLayoutItemOption(r,d,"controlType");let m=document.getElementsByName(this.FormId+r+d);if((m==null?void 0:m.length)>0){let _;switch(p){case"erSelect":case"erMultiSelect":case"antMultiSelect":case"erTreeSelect":case"erMultiTreeSelect":_=m[0].getElementsByClassName("ant-select-selector");break;case"antInput":case"antInputNumber":_=document.getElementById(this.FormId+r+d);break;case"antDateTimePicker":case"antDatePicker":case"antMonthPicker":case"antYearPicker":_=m[0].getElementsByClassName("ant-picker-input");break}n.forEach(E=>{(_==null?void 0:_.length)>0?E.value!==void 0&&e.Core.jQuery(_).css(E.property,E.value):E.value!==void 0&&e.Core.jQuery(m).css(E.property,E.value)})}else m=document.getElementById(this.FormId+r+d),m&&n.forEach(_=>{_.value!==void 0&&e.Core.jQuery(m).css(_.property,_.value)})}})}return this}setModelDefalutValue(r,i,n,c){let d;return i instanceof Array?d=i:d=i.split(","),n&&n.trim().length>0?d.forEach(p=>{if(p=this.getConfigIdbyLayoutName(p),r&&n&&r.schemaFields&&r.schemaFields[n]){const m=this.getSingleItemConfigInfo(p,n);let _=null;m.DEFAULT_VALUE&&m.DEFAULT_VALUE.trim().length>0?_=m.DEFAULT_VALUE:this._customDefaultValues[p]&&this._customDefaultValues[p][n]!==void 0?_=this._customDefaultValues[p][n]:c&&(_=c),_&&_.trim().length>0&&r.schemaFields[n].type&&(r.schemaFields[n].type==="datetime"?r.set(n,t.getDateTimeByString(_),p):r.schemaFields[n].type==="boolean"?r.set(n,_==="1"||_.toLowerCase()==="true",p):r.schemaFields[n].type==="number"?r.set(n,_,p):r.set(n,this.getDefaultStringValue(_),p),this.setControlValue(p,n,r[n]))}}):d.forEach(p=>{p=this.getConfigIdbyLayoutName(p);const m=this.getConfigInfo(p);m.TSI00GRIDCOLUMN&&m.TSI00GRIDCOLUMN.forEach(_=>{let E=null;if(n=_.ITEM_CODE,r&&n&&r.schemaFields&&r.schemaFields[n]){const v=this.getSingleItemConfigInfo(p,n);v.DEFAULT_VALUE&&v.DEFAULT_VALUE.trim().length>0?E=v.DEFAULT_VALUE:this._customDefaultValues[p]&&this._customDefaultValues[p][n]!==void 0?E=this._customDefaultValues[p][n]:c&&(E=c),E&&E.trim().length>0&&r.schemaFields[n].type&&(r.schemaFields[n].type==="datetime"?r.set(n,t.getDateTimeByString(E)):r.schemaFields[n].type==="boolean"?r.set(n,E==="1"||E.toLowerCase()==="true"):r.schemaFields[n].type==="number"?r.set(n,E):r.set(n,this.getDefaultStringValue(E)),this.setControlValue(p,n,r[n]))}})}),this}setModelValue(r,i,...n){return t.setModelValue(r,i,...n),this}setModelEmptyValue(r,...i){return i.length===1&&(i=i[0].split(",")),i.length>0?i.forEach(n=>{r&&r[n]!==void 0&&r.set(n,null)}):r.schemaFields&&Object.keys(r.schemaFields).forEach(n=>{r.set(n,null)}),this}setControlReadOnlyEx(r,i){return i&&Object.keys(i).forEach(n=>{this.setControlReadOnly(r,i[n],n)}),this}setControlReadOnly(r,i,...n){if(t.isNullOrEmpty(r))return this;n.length===1&&(n=n[0].split(",")),r=this.getConfigIdbyLayoutName(r);for(const c of n){const d=this.getSingleItemConfigInfo(r,c);let p=!0,m=!1;d.FUNCTION_TYPE&&d.COLUMN_EDIT&&(i!=="default"&&!i&&d.READ_ONLY==="1"&&(d.COLUMN_EDIT!=="1"||d.ALLOW_EDIT!=="1")||(i==="default"?(m=d.READ_ONLY==="1"||d.FUNCTION_TYPE!=="F"&&d.ALLOW_EDIT!=="1",p=d.ALLOW_EDIT==="1"):(m=i,p=!m),this.setLayoutItemOption(r,c,{readOnly:m}),d.COLUMN_EDIT==="1"&&this.setLayoutItemOption(r,c,{buttonEnable:p})))}return this}setAllControlReadOnly(r,i){let n;return r instanceof Array?n=r:n=r.split(","),n&&n.length>0&&n.forEach(c=>{if(c.trim().length>0){const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{this.setControlReadOnly(c.trim(),i,p.ITEM_CODE)})}}),this}setControlEnable(r,i,...n){if(t.isNullOrEmpty(r))return this;n.length===1&&(n=n[0].split(",")),r=this.getConfigIdbyLayoutName(r);for(const c of n){const d=this.getSingleItemConfigInfo(r,c);let p=!0;d.FUNCTION_TYPE&&d.COLUMN_EDIT&&(i==="default"?p=d.ALLOW_EDIT==="1":p=i,this.setLayoutItemOption(r,c,{allowEdit:p}),d.COLUMN_EDIT==="1"&&this.setLayoutItemOption(r,c,{buttonEnable:p}))}return this}setAllControlEnable(r,i){let n;return r instanceof Array?n=r:n=r.split(","),n&&n.length>0&&n.forEach(c=>{if(c.trim().length>0){const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{this.setControlEnable(c.trim(),i,p.ITEM_CODE)})}}),this}setControlEmptyValue(r,...i){if(i.length===1&&(i=i[0].split(",")),!i||i.length===0){const n=this.getConfigInfo(r);n.TSI00GRIDVIEW&&n.TSI00GRIDVIEW.length>0&&n.TSI00GRIDVIEW[0].FUNCTION_TYPE==="F"&&n.TSI00GRIDCOLUMN&&n.TSI00GRIDCOLUMN.forEach(c=>{this.setControlValue(r,c.ITEM_CODE,null)})}else i.forEach(n=>{this.setControlValue(r,n,null)});return this}setAllControlDefalutValue(r,i=!1){let n;return r instanceof Array?n=r:n=r.split(","),n.length>0&&n.forEach(c=>{if(c.trim().length>0){const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{var m;((m=p.DEFAULT_VALUE)==null?void 0:m.trim().length)>0?this.setControlDefalutValue(c.trim(),p.ITEM_CODE,i):i||this.setControlEmptyValue(c,p.ITEM_CODE)})}}),this}setControlDefalutValue(r,i,n=!1){var c,d;if(t.isNullOrEmpty(r)||t.isNullOrEmpty(i))return this;if(r=this.getConfigIdbyLayoutName(r),(r==null?void 0:r.trim().length)>0){const p=this.getLayoutBindModel(r),m=this.getSingleItemConfigInfo(r,i),_=((c=this.getLayoutItemOption(r.trim(),i,"field"))==null?void 0:c.value)||i.trim(),E=p==null?void 0:p.get(_==null?void 0:_.trim());if(E!=null&&n)return this;const v=t.toString(m.DEFAULT_VALUE,!0);if(p&&v.length>0){let A=this.getDefaultStringValue(v),B=null;const Q=this.getLayoutItemOption(r.trim(),i,"controlType");if(["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect","antRadioGroup","erRadioGroup","erCheckboxGroup"].includes(Q)&&["$FIRST_ROW$","$LAST_ROW$","$ALL_VALUES$"].includes(v)&&this._dropDownBindSource[r]&&this._dropDownBindSource[r][i]){const N=this._dropDownBindSource[r][i];((d=N.dataSource)==null?void 0:d.length)>0&&N.dataValueField&&(v==="$FIRST_ROW$"?A=N.dataSource[0][N.dataValueField]:v==="$LAST_ROW$"?A=N.dataSource[N.dataSource.length-1][N.dataValueField]:["antMultiSelect","erMultiSelect"].includes(Q)&&v==="$ALL_VALUES$"&&(A="",N.dataSource.forEach(W=>{A=A.length===0?W[N.dataValueField]:A+","+W[N.dataValueField]})))}["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(Q)?B=t.getDateTimeByString(A):Q==="antInputNumber"?B=t.toNumber(A):["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(Q)?B=A.split(","):Q==="antCheckbox"||Q==="antSwitch"?B=A==="1"||A.toLowerCase()==="true":B=A,this.setControlValue(r,i,B)}}return this}getFormButtonConfigInfo(r){let i={},n=[];return this._configInfo.TSI00FORMBUTTON&&this._configInfo.TSI00FORMBUTTON.getMappedRows().length>0&&(n=this._configInfo.TSI00FORMBUTTON.getMappedRows(),n.length>0&&n.every((c,d)=>c.BUTTON_NAME===r?(i=c,!1):!0)),i}getSystemGlobalOptions(){let r={};const i=this.getFormSysInfo("SystemGlobalOptions");return i.trim().length>0&&(r=JSON.parse(i)),r}getFormExtentedOptions(){var n,c;let r={};const i=this.getFormSysInfo("FormDefaultOptions");if(i.trim().length>0&&(r={...JSON.parse(i)}),((n=this._configInfo.TSI00FORM)==null?void 0:n.length)>0){const d=this._configInfo.TSI00FORM[0];if(((c=d.EXT_OPTIONS)==null?void 0:c.trim().length)>0){const p=JSON.parse(d.EXT_OPTIONS);r={...r,...p}}}return r}resetLayout(r){let i;return r instanceof Array?i=r:i=r.split(","),i.length>0&&i.forEach(n=>{if(n.trim().length>0){const c=this.getConfigInfo(n.trim());c.TSI00GRIDVIEW&&c.TSI00GRIDCOLUMN&&c.TSI00GRIDCOLUMN.forEach(d=>{d.DEFAULT_VALUE&&d.DEFAULT_VALUE.trim().length>0?this.setControlDefalutValue(n.trim(),d.ITEM_CODE):this.setControlValue(n.trim(),d.ITEM_CODE,null)})}}),this}getAllControlValue(r,i){const n={};return(r instanceof Array?r:r.split(",")).forEach(d=>{if((d==null?void 0:d.trim().length)>0){const p=this.getLayoutBindModel(d.trim());if(p){const m=this.getConfigInfo(d.trim());m.TSI00GRIDVIEW&&m.TSI00GRIDCOLUMN&&m.TSI00GRIDCOLUMN.forEach(_=>{const E=this.getLayoutItemOption(d,_.ITEM_CODE,"controlType"),v=this.getLayoutItemOption(d,_.ITEM_CODE,"field")||_.ITEM_CODE,A=t.toNumber(_.MAX_LENGTH);if(v){let B=p[v];if(E==="antCheckbox"||E==="antSwitch")B=B===!0?"1":"0";else if(E==="antInputNumber")B=B||0;else if(["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(E)&&B){const Q=t.toString(_.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss",N=t.getDateTimeFormatString(B,Q);N.substring(0,4)==="0001"||N.substring(0,4)==="1900"||N.substring(0,4)==="1901"?B="":(B=N,A>0&&A<B.length&&(B=B.substring(0,A)))}else["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(E)&&B&&B instanceof Array?B=B.join(","):B=B||"";n[v]=B}})}}}),i&&Object.keys(i).length>0&&Object.keys(i).forEach(d=>{n[d]=i[d]}),n}getAllControlValueAsBlock(r,i,n){const c=this.getAllControlValue(r,i);let d=r;r instanceof Array&&(d=r[0]);const p=this.getLayoutExtentedOptions(d);return p!=null&&p.blockName&&(n=p.blockName),(n==null?void 0:n.trim().length)===0&&d.includes("Filter")&&(n="inqu_status"),t.buildEiBlock([c],n||"Table0")}getAllControlValueAsFilter(r,i){let n=t.buildEiBlock(void 0,"Table0");const c=[];return(r instanceof Array?r:r.split(",")).forEach(p=>{const m=this.getConfigInfo(p);m.TSI00GRIDVIEW&&m.TSI00GRIDCOLUMN&&m.TSI00GRIDCOLUMN.forEach(_=>{if(_.OPERATOR.trim().length>0&&_.OPERATOR.trim()!=="None"&&_.PARA_GROUP.trim().length>0&&_.PARA_GROUP.trim()!=="None"){const E=this.getLayoutItemOption(p,_.ITEM_CODE,"controlType"),v={};i&&Object.keys(i).length>0?Object.keys(i).forEach(N=>{v[N]=i[N]}):v.QUERY_TYPE="",v.COMPANY_CODE=_.COMPANY_CODE,v.FORM_NAME=_.FORM_NAME,v.FUNCTION_ID=_.FUNCTION_ID,v.ITEM_CODE=t.toString(_.ITEM_CODE,!0,"toLower"),v.ORIGIN_CODE=_.ORIGIN_CODE,v.TABLE_NAME=_.TABLE_NAME,v.FIELD_NAME=t.toString(_.PARA_NAME,!0,"toLower"),v.OPERATOR=_.OPERATOR,v.PARA_GROUP=_.PARA_GROUP,v.SQL_CONTENT=_.SQL_CONTENT,v.OP_VALUE=null,v.DATA_TYPE="String";const A=t.toString(v.PARA_GROUP,!0),B=t.toString(v.OPERATOR,!0);let Q=this.getControlValue(p,_.ITEM_CODE)||"";if(B.length>0)switch(E){case"antRadioGroup":case"erRadioGroup":case"erSelect":case"erTreeSelect":{v.OP_VALUE=Q,v.ORIGIN_CODE==="4"&&_.SVC_NAME.trim().length>0&&v.OP_VALUE.trim().length>0&&v.OPERATOR==="SQL"&&(v.ORIGIN_CODE="SIU",v.SQL_CONTENT=this.getFormCodeSetFilter(_.SVC_NAME,v.OP_VALUE)),(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v);break}case"antInputNumber":{v.DATA_TYPE="Decimal",v.OP_VALUE=Q,v.OP_VALUE===null&&(v.OP_VALUE=0),(A==="2"||t.toNumber(v.OP_VALUE)!==0)&&c.push(v);break}case"antCheckbox":case"antSwitch":{v.OPERATOR="=",v.OP_VALUE=Q===!0?"1":Q===!1?"0":"",(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":case"erMultiTreeSelect":{v.OPERATOR="IN",Q&&Q instanceof Array&&Q.length>0?Q="'"+Q.join("','")+"'":Q="",v.OP_VALUE=Q,(A==="2"||Q.length>0)&&c.push(v);break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{if(Q){const N=t.toString(_.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss";v.OP_VALUE=t.getDateTimeFormatString(Q,N),v.OP_VALUE.length>=4&&(v.OP_VALUE.substring(0,4)==="0001"||v.OP_VALUE.substring(0,4)==="1900")&&(v.OP_VALUE=""),(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v)}break}default:{t.toString(Q,!0).length>0&&B==="IN"&&(Q="'"+Q.split(/\n|\t|,|,/).join("','")+"'"),v.OP_VALUE=Q,(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v);break}}}})}),c.length>0&&(n=t.buildEiBlock(c,"QUERY_FILTER")),n}expandLayoutGroup(r){let i=[];r&&(r instanceof Array?i=r:i=r.split(",")),i.length===0&&(i=this.getAllConfigIdArray());for(let n=0;n<i.length;n++)if(i[n].trim().length>0){const c=document.getElementById(this.FormId+i[n].trim()+"_content");c&&t.jQuery(c).show()}return this}collapseLayoutGroup(r){let i=[];r&&(r instanceof Array?i=r:i=r.split(",")),i.length===0&&(i=this.getAllConfigIdArray());for(let n=0;n<i.length;n++)if(i[n].trim().length>0){const c=document.getElementById(this.FormId+i[n].trim()+"_content");c&&t.jQuery(c).hide()}return this}async queryDataByButton(r,i,n,c){return new Promise((d,p)=>{let m=new ut.EiInfo;const _=this.getFormButtonConfigInfo(r);if(_&&_.SVC_NAME.trim().length>0){const E=new ut.EiInfo,v=_.SVC_NAME,A={};_.TYPE_DESC&&_.TYPE_DESC.trim().length>0&&(A[_.TYPE_DESC]=_.TYPE),c&&Object.keys(c).length>0&&Object.keys(c).forEach(W=>{A[W]=c[W]});const B=this.getAllControlValueAsBlock(i,A),Q=this.getAllControlValueAsFilter(i,A);let N=_.FILTER_STRING;n&&n.trim().length>0&&(N.trim().length>0?N=N+" and "+n:N=n),N.trim().length>0&&this.getQuerySqlFormat(N),E.addBlock(B),E.addBlock(Q),this.callService(v,E,{show:!0}).then(W=>{m=W,d(m)})}else m.SysInfo.Flag=-603,m.SysInfo.Msg="未调用后台服务",d(m)})}async queryDataByService(r,i){return new Promise((n,c)=>{let d=new ut.EiInfo;if(r.trim().length>0){const p=new ut.EiInfo;if(i&&i.filterConfigId&&i.filterConfigId.trim().length>0){let m=this.getAllControlValueAsBlock(i.filterConfigId,i.queryType);const _=this.getAllControlValueAsFilter(i.filterConfigId,i.queryType);if(m.getMappedRows().length>0){const E=m.getMappedRows()[0];m=t.buildEiBlock([E])}p.addBlock(m),p.addBlock(_)}if(i&&i.customFilter&&i.customFilter.trim().length>0){const m=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(i.customFilter),DATA_TYPE:"",OP_VALUE:"*"}];if(!p.getBlock("QUERY_FILTER")){const _=t.buildEiBlock(m,"QUERY_FILTER");p.addBlock(_)}}this.callService(r,p).then(m=>{var _,E,v,A;if(d=m,e.Core.toNumber((_=d.SysInfo)==null?void 0:_.Flag)>=0&&i&&i.dataTable){if(i.dataTable instanceof S)this.mergeDataToDataTable(d,i.dataTable,i.clearTable);else if(typeof i.dataTable=="string"&&i.dataTable.trim().length>0)if((E=this._formDataSet)!=null&&E.contains(i.dataTable.trim()))this.mergeDataToDataTable(d,(v=this._formDataSet)==null?void 0:v.getDataTable(i.dataTable.trim()),i.clearTable);else{const B=this.getBindingTableName(i.dataTable.trim());B.trim().length>0&&this.mergeDataToDataTable(d,(A=this._formDataSet)==null?void 0:A.getDataTable(B.trim()),i.clearTable)}}n(d)})}else d.SysInfo.Flag=-603,d.SysInfo.Msg="No service available",n(d)})}async queryDataByDataSource(r,i,n=""){return new Promise(async(c,d)=>{var E,v,A,B;let p=new ut.EiInfo,m=!1,_="";if(r.trim().length>0){let Q="";const N=this.getGridConfig(r);((E=N==null?void 0:N.SVC_NAME)==null?void 0:E.trim().length)>0&&(_=r,r=N.SVC_NAME.trim(),Q=N.FILTER_STRING.trim(),m=!0);const W=new ut.EiInfo;if(i&&i.filterConfigId&&i.filterConfigId.trim().length>0){let Se=this.getAllControlValueAsBlock(i.filterConfigId,i.queryType);const ue=this.getAllControlValueAsFilter(i.filterConfigId,i.queryType);if(Se.getMappedRows().length>0){const me=Se.getMappedRows()[0];Se=t.buildEiBlock([me])}W.addBlock(Se),W.addBlock(ue)}if(t.toString(i==null?void 0:i.customFilter,!0).length>0&&(Q.trim().length>0?Q=Q+" and "+t.toString(i==null?void 0:i.customFilter,!0):Q=t.toString(i==null?void 0:i.customFilter,!0)),Q.trim().length>0){const Se=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(Q),DATA_TYPE:"",OP_VALUE:"*"}];if(!W.getBlock("QUERY_FILTER")){const ue=t.buildEiBlock(Se,"QUERY_FILTER");W.addBlock(ue)}}const J=(B=(A=(v=this._configInfo)==null?void 0:v.TSI00DATASOURCE)==null?void 0:A.getMappedRows())==null?void 0:B.find(Se=>Se.FUNC_ID===r),re=Se=>{this.callService(Se,W,{show:i==null?void 0:i.showLoading},{messageError:!0}).then(ue=>{var me,Z,Te;p=ue,e.Core.toNumber((me=p.SysInfo)==null?void 0:me.Flag)>=0&&(i&&i.dataTable?i.dataTable instanceof S?this.mergeDataToDataTable(p,i.dataTable,i.clearTable):typeof i.dataTable=="string"&&i.dataTable.trim().length>0&&((Z=this._formDataSet)!=null&&Z.contains(i.dataTable.trim()))&&this.mergeDataToDataTable(p,(Te=this._formDataSet)==null?void 0:Te.getDataTable(i.dataTable.trim()),i.clearTable):m===!0&&this.mergeDataToGrid(p,_,i==null?void 0:i.clearTable)),c(p)})};if(J!=null&&J.FUNC_ID){if(J.ORIGIN_CODE==="SVC"&&J.SVC_NAME.trim().length>0)re(J.SVC_NAME.trim());else if(J.SQL_CONTENT.trim().length>0){const Se=t.buildEiBlock([{OPERATE_TYPE:"sql_query",FUNCTION_ID:J.FUNC_ID,SQL:this.getQuerySqlFormat(J.SQL_CONTENT),FILTER_STRING:"",GROUP_COL:J.GROUP_KEY_VALUE,SORT_COL:J.PRI_KEY_SQL}],"DATA_SOURCE");W.addBlock(Se),t.toString(n).trim().length===0&&J.SVC_NAME.trim().length>0&&(n=J.SVC_NAME.trim()),t.toString(n).trim().length===0&&(n="JAER01/query"),re(n)}}else{const Se=t.buildEiBlock([{FUNCTION_ID:r,COMPANY_CODE:e.SysInfo.CompanyCode}],"DATA_SOURCE");W.addBlock(Se),t.toString(n).trim().length===0&&(n="JAER01/query"),re(n)}}else p.SysInfo.Flag=-603,p.SysInfo.Msg="DataSoureId is null or empty!",c(p)})}async queryDataToGrid(r,i,n,c){const d=this.getAllControlValueAsBlock(i,void 0,c==null?void 0:c.filterBlockId),p=this.getGridStructureAsBlock(n,!1,c==null?void 0:c.gridBlockId);let m=new ut.EiInfo;m.addBlock(d),m.addBlock(p),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(m=c.processInInfo(m));const _=(c==null?void 0:c.loadingOptions)||{show:!0},E=(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0},v=await this.callService(r,m,_,E);c!=null&&c.mergeToGrid&&c.mergeToGrid instanceof Function?c.mergeToGrid(v):this.mergeDataToGrid(v.getBlock((c==null?void 0:c.gridBlockId)||"result"),n)}saveGridData(r,i,n,c){const d=[];return new Promise(async(p,m)=>{if((n==null?void 0:n.trim().length)>0)if(this.hasDataChange(n)){if(c=c||{},c.messageConfirm=c.messageConfirm??"是否确认保存",c.messageConfirm){const v=typeof c.messageConfirm=="string"?c.messageConfirm:"是否确认保存";if(!await this.messageConfirm(v)){p({results:[],success:!0,message:"保存取消"});return}}if(typeof r=="string"){let v=this.getGridChangedRowsAsEiInfo(n);v.addBlock(this.getAllControlValueAsBlock(i,void 0,c==null?void 0:c.filterBlockId)),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(v=c.processInInfo(v,"save")),d.push(this.callService(r,v,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}else if(Wr.isPlainObject(r)){const v=this.getAllControlValueAsBlock(i,void 0,c==null?void 0:c.filterBlockId);if(r.deleteService&&r.deleteService.trim().length>0){const A=this.getGridDeletedRowsAsBlock(n);if(A.getMappedRows().length>0){A.rename("result");let B=new ut.EiInfo;B.addBlock(v),B.addBlock(A),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(B=c.processInInfo(B,"delete")),d.push(this.callService(r.deleteService,B,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}}if(r.updateService&&r.updateService.trim().length>0){const A=this.getGridModifyRowsAsBlock(n);if(A.getMappedRows().length>0){A.rename("result");let B=new ut.EiInfo;B.addBlock(v),B.addBlock(A),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(B=c.processInInfo(B,"update")),d.push(this.callService(r.updateService,B,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}}if(r.insertService&&r.insertService.trim().length>0){const A=this.getGridCreatedRowsAsBlock(n);if(A.getMappedRows().length>0){A.rename("result");let B=new ut.EiInfo;B.addBlock(v),B.addBlock(A),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(B=c.processInInfo(B,"insert")),d.push(this.callService(r.insertService,B,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}}}const _=await Promise.allSettled(d);let E=!0;_.forEach(v=>{v.status==="fulfilled"&&v.value.getStatus()<0?(this.messageError(v.value.getMsg()),E=!1):v.status!=="fulfilled"&&(E=!1)}),E&&(c!=null&&c.queryService)&&this.queryDataToGrid(c.queryService,i,n,{...c,processInInfo:void 0}),p({results:_,success:E,message:E?"保存成功":"保存失败"})}else{p({results:[],success:!0,message:"没有数据变更,无需保存"}),this.messageInfo("没有数据变更,无需保存");return}else m(new Error("gridConfId is null or empty!"))})}getFormCodeSetFilter(r,i){let n="";if(this._configInfo[this._formName+r]){for(const c of this._configInfo[this._formName+r].getMappedRows())if(c.CODE===i){n=c.SQL_CONTENT;break}}return n}getQuerySqlFormat(r,i){return t.getSystemFormatString(r,i)}getFormSysInfo(r){return this._configInfo.IPLAT4J_SYSTEM_INFO&&this._configInfo.IPLAT4J_SYSTEM_INFO.getMappedRows().length>0&&r.trim().length>0?t.toString(this._configInfo.IPLAT4J_SYSTEM_INFO.getMappedRows()[0][r.trim().toUpperCase()]):""}getSysParaValue(r,i,n){return new Promise((c,d)=>{if(this._sysParaInfo&&this._sysParaInfo[r]!==void 0&&this._sysParaInfo[r][i]!==void 0)c(this._sysParaInfo[r][i].toString());else if(i&&i.trim().length>0){const p=new ut.EiInfo;let m="";const _=t.buildEiBlock([{QUERY_TYPE:"system_para",COMPANY_CODE:r,CTRL_CODE:i,EFFECT_ELEMENT_VALUE:n||""}]);p.addBlock(_),t.callService(e.SysInfo.queryDevConfigService,p).then(E=>{var v;E.getStatus()>=0&&E.getBlock("TSIFIAA51")&&E.getBlock("TSIFIAA51").getMappedRows().length>0?m=t.toString(E.getBlock("TSIFIAA51").getMappedRows()[0].CTRL_NUM):E.getStatus()>=0&&((v=E.getBlock("IPLAT4J_SYSTEM_INFO"))==null?void 0:v.getMappedRows().length)>0&&(m=t.toString(E.getBlock("IPLAT4J_SYSTEM_INFO").getMappedRows()[0][i.toUpperCase()])),this._sysParaInfo[r]===void 0&&(this._sysParaInfo[r]={}),this._sysParaInfo[r][i]=m,c(m)},()=>{this._sysParaInfo[r]===void 0&&(this._sysParaInfo[r]={}),this._sysParaInfo[r][i]="",c("")})}})}getDefaultStringValue(r){return r.trim().length>14&&r.trim().substring(0,13)==="$FormSysInfo."&&r.trim().substring(r.trim().length-1,r.trim().length)==="$"?r=this.getFormSysInfo(r.trim().substring(13,r.trim().length-1)):r=t.getSystemFormatString(r),r}setCustomDefaultValue(r,i){(r==null?void 0:r.trim().length)>0&&i&&(this._customDefaultValues[r.trim()]=i)}getLayoutConfigDefaultValues(r){const i={};let n;return r instanceof Array?n=r:n=r.split(","),n.length>0&&n.forEach(c=>{const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{if(p.DEFAULT_VALUE&&p.DEFAULT_VALUE.trim().length>0){const m=p.FUNCTION_TYPE+p.COLUMN_EDIT,_=p.DEFAULT_VALUE,E=this.getControlName(m,p.FORMAT_STRING);if(E&&E.trim().length>0&&_.trim().length>0)switch(E){case"antInputNumber":{i[p.ITEM_CODE]=parseFloat(_);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":{const v=this.getDefaultStringValue(_).split(",");i[p.ITEM_CODE]=v;break}case"antCheckbox":case"antSwitch":{i[p.ITEM_CODE]=t.toString(_)==="1"||t.toString(_)==="true";break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{i[p.ITEM_CODE]=t.getDateTimeByString(_);break}default:{i[p.ITEM_CODE]=this.getDefaultStringValue(_);break}}}})}),i}getGridConfigDefaultValues(r){const i={},n=this.getConfigInfo(r.trim()),c=this.getBindingTable(r.trim());return c&&n.TSI00GRIDVIEW&&n.TSI00GRIDCOLUMN&&n.TSI00GRIDCOLUMN.forEach(d=>{if(c.options.schema&&d.DEFAULT_VALUE&&d.DEFAULT_VALUE.trim().length>0){const p=c.options.schema[d.FIELD_NAME].type;p==="datetime"?i[d.FIELD_NAME]=t.getDateTimeByString(d.DEFAULT_VALUE):p==="boolean"?i[d.FIELD_NAME]=d.DEFAULT_VALUE==="1"||d.DEFAULT_VALUE.toLowerCase()==="true":p==="number"?i[d.FIELD_NAME]=t.toNumber(d.DEFAULT_VALUE):i[d.FIELD_NAME]=this.getDefaultStringValue(d.DEFAULT_VALUE)}}),i}async loadGrid(r,i,n,c,d){var p,m,_,E,v,A,B,Q,N;if(!this.containsConfig(r)&&(n==null?void 0:n.forceLoadConfig)!==!1&&await this.loadConfig(r),this.containsConfig(r)){if(this._gridInstanceInfo[r])return console.error(`Grid instance ${r} already exists!`),!1;const W=this.getSingleViewConfigInfo(r);this.setGridToolbarVisible(r,{refresh:W.SHOW_REFRESH==="1",addrow:W.SHOW_ADD==="1",copyrow:W.SHOW_ADDCOPY==="1",delete:W.SHOW_DELETE==="1",cancel:!1,save:!1,excel:W.SHOW_EXPORT==="1",import:W.ALLOW_IMPORT==="1"}),this._gridColumnsConfigInfo[r]={},this._gridColumnsInfo[r]={},this._allowMergeColumnFields[r]=[],this._gridStyleInfo[r]=this._gridStyleInfo[r]||[],this._gridOptions[r]=this._gridOptions[r]||{};const J=this.getConfigInfo(r);if((p=i==null?void 0:i.gridOptions)!=null&&p.api&&J.TSI00GRIDVIEW&&J.TSI00GRIDVIEW.length>0){const re=J.TSI00GRIDVIEW[0];((m=n==null?void 0:n.cloneTableName)==null?void 0:m.trim().length)>0&&this.cloneTableForLayoutOrGrid(((_=n==null?void 0:n.originTableName)==null?void 0:_.trim())||re.TABLE_NAME.trim(),n.cloneTableName.trim(),r),i.gridOptions.context={configId:r,configCaption:re.FUNCNAME_RES||re.FUNCNAME},n=n||{},((E=re.CUS_EXT_OPTIONS)==null?void 0:E.trim().length)>0&&(n={...JSON.parse(re.CUS_EXT_OPTIONS),...n}),((v=re.EXT_OPTIONS)==null?void 0:v.trim().length)>0&&(n={...JSON.parse(re.EXT_OPTIONS),...n});const Se=this.getFormSysInfo("GridDefaultOptions");Se.trim().length>0&&(n={...JSON.parse(Se),...n}),["rowDragManaged","groupIncludeFooter","groupIncludeTotalFooter","suppressRowTransform","suppressRowClickSelection","rowMultiSelectWithClick","singleClickEdit"].forEach(Z=>{n[Z]=i.gridOptions[Z]??n[Z]}),n.groupDisplayType=n.groupDisplayType||i.gridOptions.groupDisplayType||this.getFormSysInfo("GRIDGROUPDISPLAYTYPE")||"groupRows",n.rowHeight=n.rowHeight||i.gridOptions.rowHeight;const me=this.getGridConfigOptions(r,n,c,d);if(me.context={...i.gridOptions.context,...me.context},me&&Object.keys(me).forEach(Z=>{i.gridOptions[Z]=me[Z]!==void 0?me[Z]:i.gridOptions[Z]}),i.gridOptions.defaultColDef=i.gridOptions.defaultColDef||{},i.gridOptions.rowSelection=J.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",i.gridOptions.api.selectionService.rowSelection=J.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",i.gridOptions.api.selectionService.groupSelectsChildren=!0,i.gridOptions.api.setColumnDefs(me.columnDefs),i.gridOptions.api.setRowData([]),re.ALLOW_CELLMERGE==="1"&&((A=i.gridOptions.context.mergeColumns)==null?void 0:A.length)>0){let Z=[];i.gridOptions.context.calculateRowSpan=(Te=!0)=>{var Me,ge,le,Y,Fe,ke;Te?Z=i.gridOptions.context.bindingSource.data():i.gridOptions.api.forEachNodeAfterFilterAndSort(Ve=>{var at;(at=Ve.data)!=null&&at.uid&&Z.push(Ve.data)});const ce={},ze=((le=(ge=(Me=i.gridOptions.context)==null?void 0:Me.viewConfig)==null?void 0:ge.MERGE_COLUMN)==null?void 0:le.trim().length)>0?(ke=(Fe=(Y=i.gridOptions.context)==null?void 0:Y.viewConfig)==null?void 0:Fe.MERGE_COLUMN)==null?void 0:ke.trim().split(","):[];return i.gridOptions.context.mergeColumns.forEach(Ve=>{ce[Ve]={};const at={};let pt=0;const ht=[...ze,Ve];for(let Ct=0;Ct<Z.length;Ct++){let _t=!0;for(let Qe=0;Qe<ht.length;Qe++){const U=ht[Qe];if(Z[Ct][U]!==at[U]){_t=!1;break}}if(!_t){if(Object.keys(at).length>0)for(let Qe=pt;Qe<Ct;Qe++){const U=Z[Qe].uid;ce[Ve][U]=Qe===pt?Ct-pt:0}ht.forEach(Qe=>{at[Qe]=Z[Ct][Qe]}),pt=Ct}if(Ct===Z.length-1)for(let Qe=pt;Qe<=Ct;Qe++){const U=Z[Qe].uid;ce[Ve][U]=Qe===pt?Ct-pt+1:0}}}),i.gridOptions.context.rowSpanMap=ce,Z[0]}}if((re==null?void 0:re.SHOW_FOOTER)==="1"&&i.gridOptions.api.setPinnedBottomRowData([{pinndeRowType:"ErGridSummaryFooter"}]),l.nextTick(()=>{var Z;i.gridOptions.defaultColDef.floatingFilter===void 0&&i.gridOptions.api.setDefaultColDef({floatingFilter:(re==null?void 0:re.SHOW_FILTER_ROW)==="1"}),((Z=n==null?void 0:n.initialData)==null?void 0:Z.length)>0&&this.mergeDataToGrid(n.initialData,i)}),i.gridOptions.processCellForClipboard=Z=>{var Te,ce,ze,Me,ge;return(Te=Z.node)!=null&&Te.footer&&((ce=Z.node)!=null&&ce.group)&&((ze=Z.context)!=null&&ze.focusColId)&&Z.node.aggData&&Z.node.aggData[Z.context.focusColId]?Wr.isPlainObject(Z.node.aggData[Z.context.focusColId])?`☑️ ${t.formatNumberValue(Z.node.aggData[Z.context.focusColId].aggValueOfChecked,"")}
71
+ </div>`)}static setLocalStorage(r,i){return(r==null?void 0:r.trim().length)>0&&localStorage.setItem(r.trim(),JSON.stringify(i)),localStorage}static debounce(r,i=100){let n;return(...c)=>{n&&clearTimeout(n),n=setTimeout(()=>{r(...c)},i)}}static getLocalStorage(r,i=!0){let n;return(r==null?void 0:r.trim().length)>0&&(n=R.toString(localStorage.getItem(r)),i&&localStorage.removeItem(r),n&&n.trim().length>0&&(n=JSON.parse(n))),n}static getCallFormParas(r,i=!0){return this.getLocalStorage(r,i)}static callForm(r,i,n=!0){}static copyText(r){const{toClipboard:i}=Qs();r instanceof Array?r.forEach(n=>{}):r=String(r||""),(r==null?void 0:r.trim().length)>0&&i(r)}static readClipboardText(){return(navigator==null?void 0:navigator.clipboard.readText())||Promise.resolve("")}static async callService(r,i,n,c){return new Promise((d,p)=>{const m=(c==null?void 0:c.messageError)??!1;let _=new ut.EiInfo;r.trim().length===0&&(_.SysInfo.Flag=-603,_.SysInfo.Msg="No service available",d(_));const E=r.split(/[\/.]/).filter(v=>v.trim().length>0);E.length<2&&(_.SysInfo.Flag=-603,_.SysInfo.Msg="Service name error",d(_)),n!=null&&n.show&&this.loading(!0,n),c!=null&&c.toCamelCase&&Object.keys(i.getBlocks()).forEach(v=>{const A=i.getBlock(v),B=A.getBlockMeta().getMetas(),Q=new ut.EiBlockMeta(A.getBlockId());Object.keys(B).forEach(N=>{const W=new ut.EiColumn(R.camelCase(N));W.descName=B[N].name,W.type=B[N].type,Q.addMeta(W)}),A.setBlockMeta(Q)}),ut.EiCommunicator.send(E[0],E[1],i,{onSuccess:v=>{this.loading(!1),_=v,_.getStatus()<0&&m&&this.messageError(_.getMsg(),m==="modal"),d(_)},onFail:v=>{this.loading(!1),m&&this.messageError(String(v),m==="modal"),console.error(v),_.SysInfo.Flag=-603,_.SysInfo.Msg=v==null?void 0:v.message,d(_)}})})}};j(R,"spinId","er-global-spin"),j(R,"spinCurrentContainer",null),j(R,"spinVnode",null),j(R,"spinCurrentTarget",null),j(R,"spinTimeoutId",null);let t=R;e.Core=t;class o{static get AppName(){return"ER4J"}static get Culture(){return"zh_Hans"}static get CompanyCode(){return"BS"}static get CompanyName(){return""}static get UserId(){return""}static get UserName(){return""}static get Partiton(){return""}static get FormName(){return""}static get GridCheckColumnFieldName(){return"54EA8C67-D921-4ddc-8ECE-114E2459816C"}static get IdFieldName(){return"ID"}static get TreeHierarchyFieldName(){return"ErTreeDataHierarchyField"}static get FormParas(){return{}}static get queryDevConfigService(){return"JAER01/queryDevConfig"}static get saveDevConfigService(){return"JAER01/saveDevConfig"}}e.SysInfo=o;class s extends ut.EiInfo{constructor(i){var n;super();j(this,"sys");this.sys={status:0,name:"",descName:"",msg:"",msgKey:"",traceId:((n=this.SysInfo)==null?void 0:n.UUID)||t.guid()},i&&(this.SysInfo=i.SysInfo,Object.keys(i.getBlocks()).forEach(c=>{this.addBlock(i.getBlock(c))}))}blocks(){return this.getBlocks()}getBlock(i){return typeof i=="number"?super.getBlockByIndex(i):super.getBlock(i)}contains(i){return!!super.getBlock(i)}}e.EIInfo=s;class f extends a{constructor(i){super();j(this,"translateOptions",{});i&&(this.translateOptions=i)}setOptions(i){i&&(this.translateOptions={...this.translateOptions,...i})}translate(i,n){return new Promise((c,d)=>{this.setOptions(n);const p=[];if(i&&typeof i=="string"&&i.trim().length>0)p.push({text:i});else if(i&&i instanceof Array&&i.length>0)for(let m=0;m<i.length;m++)p.push({text:i[m]});p.length>0?ii({baseURL:this.translateOptions.baseURL||"https://api.cognitive.microsofttranslator.com",url:this.translateOptions.url||"/translate",method:this.translateOptions.method||"post",headers:{"Ocp-Apim-Subscription-Key":this.translateOptions.ocpApimSubscriptionKey||"2fae25898d3648aa9c17589e4f7a7213","Ocp-Apim-Subscription-Region":this.translateOptions.ocpApimSubscriptionRegion||"northcentralus","Content-type":"application/json","X-ClientTraceId":t.guid()},params:{"api-version":this.translateOptions.version||"3.0",from:this.translateOptions.from,to:this.translateOptions.to},data:p,responseType:this.translateOptions.responseType||"json"}).then(m=>{var _,E;if(((_=m==null?void 0:m.data)==null?void 0:_.length)===p.length){for(let v=0;v<m.data.length;v++)((E=m.data[v].translations)==null?void 0:E.length)>0&&m.data[v].translations.forEach(A=>{A.to&&(p[v][A.to]=A.text)});c({flag:!0,message:"success",result:typeof i=="string"?p[0]:p})}else c({flag:!1,message:"wrong result",result:m.data})}).catch(m=>{d(m)}):c({flag:!1,message:"未传入翻译文本"})})}}e.TranslateHelper=f;class u extends a{constructor(i){var n,c;super();j(this,"_uploadOptions",{});j(this,"_uploadConfigInfo",{});j(this,"_initialized",!1);j(this,"_maxBlobSize",204800);j(this,"_maxFileSize",10485760);i&&(this._uploadOptions=i),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions.url&&((n=this._uploadOptions.url)==null?void 0:n.trim().length)>0&&this._uploadOptions.rootDirectory&&((c=this._uploadOptions.rootDirectory)==null?void 0:c.trim().length)>0&&(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0)}get Initialized(){return this._initialized}async getUploadConfigInfo(i){var n,c;return e.Core.buildEiInfo([{CODE_CLASS:"EPTF"}]),i&&(i==null?void 0:i.trim().length)>0&&(this._uploadOptions.url=(n=this._uploadConfigInfo[i.trim()])==null?void 0:n.url,this._uploadOptions.rootDirectory=(c=this._uploadConfigInfo[i.trim()])==null?void 0:c.rootDirectory),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions}async initialize(i){var n,c;i&&(this._uploadOptions=i),this._uploadOptions.url&&((n=this._uploadOptions.url)==null?void 0:n.trim().length)>0&&this._uploadOptions.rootDirectory&&((c=this._uploadOptions.rootDirectory)==null?void 0:c.trim().length)>0?(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0):(await this.getUploadConfigInfo(),this._initialized=!0)}async getUploadUrl(i){var n;return this._initialized||await this.initialize(),i&&(i==null?void 0:i.trim().length)>0&&(this._uploadOptions.url=(n=this._uploadConfigInfo[i.trim()])==null?void 0:n.url),this._uploadOptions.url||""}getFileList(i,n){return new Promise(async(c,d)=>{var m,_;this._initialized||await this.getUploadConfigInfo(n),n&&(n==null?void 0:n.trim().length)>0&&(this._uploadOptions.url=(m=this._uploadConfigInfo[n.trim()])==null?void 0:m.url,this._uploadOptions.rootDirectory=(_=this._uploadConfigInfo[n.trim()])==null?void 0:_.rootDirectory);const p={pathInfo:[{key:i,name:i}]};ii.post(this._uploadOptions.url+`?command=GetDirContents&arguments=${JSON.stringify(p)}&_=${new Date().valueOf()}&rootDirectory=${this._uploadOptions.rootDirectory}`).then(E=>{var v,A,B;(v=E.data)!=null&&v.success?c({flag:!0,message:"获取文件成功",result:E.data.result}):(console.error("no files,"+((A=E.data)==null?void 0:A.result)),c({flag:!0,message:(B=E.data)==null?void 0:B.result,result:[]}))}).catch(E=>{console.error("get files failed",E),c({flag:!1,message:"获取文件失败",result:[]})})})}downloadFile(i){return new Promise(async(n,c)=>{var _;const d=(_=i.key)==null?void 0:_.split("/"),p=[];d.forEach((E,v)=>{const A={key:d.slice(0,v+1).join("/"),name:E};A.key!==""&&A.name!==""&&p.push(A)});const m=new URLSearchParams;m.append("command","Download"),m.append("arguments",JSON.stringify({pathInfoList:[p]})),m.append("rootDirectory",this._uploadOptions.rootDirectory||""),ii.post(this._uploadOptions.url||"",m,{responseType:"blob",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(E=>{n({flag:!0,message:"下载文件成功",result:E})}).catch(E=>{console.error("download files failed",E),n({flag:!1,message:"下载文件失败",result:[]})})})}previewFile(i){return new Promise(async(n,c)=>{var p;const d=i.key;ii.get(((p=this._uploadOptions.url)==null?void 0:p.replaceAll("file-manager",""))+`FilePriview?rootDirectory=${this._uploadOptions.rootDirectory}&filePath=${d}`).then(m=>{n({flag:!0,message:"获取文件预览信息成功",result:m})}).catch(m=>{console.error("download files failed",m),n({flag:!1,message:"获取文件预览信息失败",result:[]})})})}uploadFile(i,n,c){return new Promise(async(d,p)=>{var E,v,A,B,Q,N;if(this._initialized||await this.getUploadConfigInfo(c),c&&(c==null?void 0:c.trim().length)>0&&(this._uploadOptions.url=(E=this._uploadConfigInfo[c.trim()])==null?void 0:E.url,this._uploadOptions.rootDirectory=(v=this._uploadConfigInfo[c.trim()])==null?void 0:v.rootDirectory,this._uploadOptions.maxBlobSize=(A=this._uploadConfigInfo[c.trim()])==null?void 0:A.maxBlobSize,this._uploadOptions.maxFileSize=(B=this._uploadConfigInfo[c.trim()])==null?void 0:B.maxFileSize),n.size>(this._uploadOptions.maxFileSize||this._maxFileSize)){e.Core.messageError("文件大小超过限制"),d({flag:!1,message:"文件大小超过限制"});return}const m=Math.ceil(n.size/(this._uploadOptions.maxBlobSize||this._maxBlobSize)),_=new Date().valueOf();for(let W=0;W<m;W++){const J=n.slice(W*(this._uploadOptions.maxBlobSize||this._maxBlobSize),(W+1)*(this._uploadOptions.maxBlobSize||2e5)),re={destinationPathInfo:[{key:i,name:i}],chunkMetadata:{UploadId:_,FileName:n.name,Index:W,TotalCount:m,FileSize:n.size}},Se=new FormData;Se.append("command","UploadChunk"),Se.append("arguments",JSON.stringify(re)),Se.append("chunk",J),Se.append("rootDirectory",this._uploadOptions.rootDirectory||"");const ue=await ii.post(this._uploadOptions.url||"",Se,{headers:{"Content-Type":"multipart/form-data"}});if(ue.status===200){if(!((Q=ue==null?void 0:ue.data)!=null&&Q.success)){e.Core.messageError("upload file failed "+((N=ue==null?void 0:ue.data)==null?void 0:N.result)),d({flag:!1,message:"上传文件失败"});break}}else{e.Core.messageError("upload file failed "+(ue==null?void 0:ue.statusText)),d({flag:!1,message:"上传文件失败"});break}}d({flag:!0,message:"上传文件成功"})})}removeFile(i,n,c){return new Promise(async(d,p)=>{var v,A;this._initialized||await this.getUploadConfigInfo(c),c&&(c==null?void 0:c.trim().length)>0&&(this._uploadOptions.url=(v=this._uploadConfigInfo[c.trim()])==null?void 0:v.url,this._uploadOptions.rootDirectory=(A=this._uploadConfigInfo[c.trim()])==null?void 0:A.rootDirectory);const m=n&&(n==null?void 0:n.trim().length)>0?`${i}/${n}`.split("/"):[i],_=[];m.forEach((B,Q)=>{const N={key:m.slice(0,Q+1).join("/"),name:B};N.key!==""&&N.name!==""&&_.push(N)});const E={pathInfo:_,isDirectory:(n==null?void 0:n.trim().length)===0};ii.post(this._uploadOptions.url+`?command=Remove&arguments=${encodeURIComponent(JSON.stringify(E))}&rootDirectory=${this._uploadOptions.rootDirectory}`,JSON.stringify({_:new Date().valueOf()}),{headers:{"Content-Type":"text/plain;charset=UTF-8"}}).then(B=>{var Q,N,W;(Q=B.data)!=null&&Q.success?d({flag:!0,message:"删除文件成功"}):(console.error("remove file failed,"+((N=B.data)==null?void 0:N.result)),d({flag:!1,message:"删除文件失败:"+((W=B.data)==null?void 0:W.result)}))}).catch(B=>{console.error("remove file failed",B),d({flag:!1,message:"删除文件失败"})})})}}e.UploadHelper=u;class h{constructor(r,i,n,c){j(this,"_partition");j(this,"_companyCode");j(this,"_serviceName",e.SysInfo.queryDevConfigService);j(this,"_paraFilter");j(this,"_initializeSuccessed",!1);j(this,"_sysParasValue",{});r?this._partition=r:this._partition=o.Partiton,n?this._companyCode=n:this._companyCode=o.CompanyCode,c&&c.trim().length>0&&(this._serviceName=c.trim()),this._paraFilter=i}get Partiton(){return this._partition}get CompanyCode(){return this._companyCode}get InitializeSuccessed(){return this._initializeSuccessed}get SysParasValue(){return this._sysParasValue}async Initialize(r,i,n,c){return new Promise((d,p)=>{r&&r.trim().length>0&&(this._partition=r),n&&n.trim().length>0&&(this._companyCode=n),i&&(this._paraFilter=i);let m="",_="";if(this._paraFilter&&this._paraFilter.ParaCodes){let A=[];if(this._paraFilter.ParaCodes instanceof Array?A=this._paraFilter.ParaCodes:typeof this._paraFilter.ParaCodes=="string"&&(A=this._paraFilter.ParaCodes.split(",")),A.length>1)for(let B=0;B<A.length;B++)A[B].trim().length>0&&(_.length===0?_=`'${A[B]}'`:_+=`,'${A[B]}'`);else A.length>0&&(m=A[0].trim())}const E=new ut.EiInfo,v=t.buildEiBlock([{COMPANY_CODE:this._companyCode,QUERY_TYPE:"system_paras",CTRL_TYPE:this._paraFilter?this._paraFilter.ParaMoudule:"",CTRL_CODE:m,CTRL_CODE_ARRAY:_}]);E.addBlock(v),c&&c.trim().length>0&&(this._serviceName=c.trim()),t.callService(this._serviceName,E).then(A=>{this._initializeSuccessed=A.SysInfo.Flag>=0,this._initializeSuccessed&&A.getBlockByIndex(0).getMappedRows().forEach(B=>{this._sysParasValue[B.CTRL_CODE]=B.CTRL_NUM}),d(this._initializeSuccessed)},()=>{d(!1)})})}getParaValue(r){return!t.isNullOrEmpty(r)&&this._initializeSuccessed?t.toString(this._sysParasValue[r]):""}}e.Be2SysParaInfo=h;class C{static setVariable(r,i,n){r.trim().length>0&&i.trim().length>0&&n!==void 0&&n!==null&&t.setLocalStorage(r+"_"+i,n)}static getVariable(r,i,n=!0){return t.getLocalStorage(r+"_"+i,n)}static clearVariable(r,i){r&&r.trim().length>0&&localStorage.removeItem(r+"_"+i)}static isNullOrEmpty(r,i){const n=t.getLocalStorage(r+"_"+i);return n==null}}e.SysGlobalVariables=C;class T extends a{constructor(i,n,c){super();j(this,"dirty",!1);j(this,"dirtyFields",{});j(this,"uid","");j(this,"isNew",!1);j(this,"_dataTable");j(this,"_schemaFields",{});j(this,"_backup",{});this._schemaFields=n||{},this._dataTable=c,this.accept(i,this._schemaFields)}get schemaFields(){return this._schemaFields}get dataTable(){return this._dataTable}static getFieldDefaultValue(i){return i==null?void 0:i.defaultValue}shouldSerialize(i){return!["ID","isNew","uid","dirty","dirtyFields","_backup","_dataTable","_events","_schemaFields","_preview_row_data","_children_data",o.TreeHierarchyFieldName].includes(i)}forEach(i){for(const n in this)this.shouldSerialize(n)&&i(this[n],n)}toJSON(i){var c,d;let n={};for(const p in this)if(this.shouldSerialize(p)&&(n[p]=this[p],this._schemaFields&&this._schemaFields[p]))switch(this._schemaFields[p].type){case"boolean":n[p]=this[p]?"1":"0";break;case"datetime":n[p]?(Ut.isDayjs(n[p])&&Ut(n[p]).isValid()?n[p]=n[p].format("YYYYMMDDHHmmss"):n[p]instanceof Date?Ut(n[p]).format("YYYYMMDDHHmmss"):typeof n[p]=="string"?n[p]=n[p].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):n[p]="",((c=n[p])==null?void 0:c.trim().length)===0||n[p].startsWith("1900")||n[p].startsWith("1901")||n[p].startsWith("0001")?n[p]="":this._schemaFields[p].maxLength>0?n[p]=n[p].padEnd(this._schemaFields[p].maxLength,"0").substring(0,this._schemaFields[p].maxLength):n[p]=n[p].padEnd(14,"0").substring(0,14)):n[p]="";break;case"time":n[p]?(Ut.isDayjs(n[p])&&Ut(n[p]).isValid()?n[p]=n[p].format("YYYYMMDDHHmmss"):n[p]instanceof Date?Ut(n[p]).format("YYYYMMDDHHmmss"):typeof n[p]=="string"?n[p]=n[p].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):n[p]="",((d=n[p])==null?void 0:d.trim().length)===0||n[p].startsWith("1900")||n[p].startsWith("1901")||n[p].startsWith("0001")?n[p]="":this._schemaFields[p].maxLength>0&&this._schemaFields[p].maxLength<=6?n[p]=n[p].padEnd(this._schemaFields[p].maxLength,"0").substring(8,8+this._schemaFields[p].maxLength):n[p]=n[p].padEnd(14,"0").substring(8,14)):n[p]="";break;case"string":n[p]&&n[p]instanceof Array&&(n[p]=n[p].join(","));break;case"number":n[p]=e.Core.toNumber(n[p]);break;default:n[p]=this[p];break}return i&&(n={...n,...i}),n}setBackup(){this._backup=this.toJSON();for(const i in this)this.shouldSerialize(i)&&(this._backup[i]=this[i]);return this}getBackup(){return this._backup}get(i){return Reflect.get(this,i)}set(i,n,c,d=!1){var p;if(this.shouldSerialize(i))if(this._schemaFields[i]){switch(this._schemaFields[i].type){case"datetime":n=t.toDateTime(n,"Dayjs");break;case"boolean":n=t.toBoolean(n);break;case"number":n=t.toNumber(n);break;default:n=n;break}const m={};if(m.oldValue=this[i],m.newValue=n,this.dirtyFields[i]=!0,this.dirty=!0,Reflect.set(this,i,n),this._dataTable&&c!=="setData"){const _=l.isProxy(this._dataTable)?l.toRaw(this._dataTable):this._dataTable;(p=_.BingdingInfo)==null||p.forEach(v=>{if(v.formHelper&&v.configId&&v.configId!==c)if(v.controlType==="Grid"){const A=v.formHelper.getGrid(v.configId);if(A){const B={};B[i]=n,v.formHelper.setGridRowData(A,this.uid,B)}}else v.controlType});const E=_.getEvent("dataChanged");E&&(m.field=i,m.binddingInfo=_.BingdingInfo,E(m))}}else d===!1&&(this[i]=n);return this}reset(){return this.accept(void 0,this._schemaFields),this}setSchema(i,n=!0){return this._schemaFields=i,n&&this.reset(),this}setData(i,n,c=!1){var d;return i&&(Object.keys(i).forEach(p=>{if(this.shouldSerialize(p))if(this._schemaFields[p]){switch(this._schemaFields[p].type){case"datetime":i[p]=t.toDateTime(i[p],"Dayjs");break;case"boolean":i[p]=t.toBoolean(i[p]);break;case"number":i[p]=t.toNumber(i[p]);break}this.dirtyFields[p]=!0,this.dirty=!0,Reflect.set(this,p,i[p])}else c===!1&&(this[p]=i[p])}),this._dataTable&&((d=(l.isProxy(this._dataTable)?l.toRaw(this._dataTable):this._dataTable).BingdingInfo)==null||d.forEach(m=>{if(m.formHelper&&m.configId&&m.configId!==n&&m.controlType==="Grid"){const _=m.formHelper.getGrid(m.configId);_&&m.formHelper.setGridRowData(_,this.uid,i)}}))),this}addField(...i){return i&&i.length>0&&i.forEach(n=>{this._schemaFields&&n.name&&this._schemaFields[n.name]===void 0&&(this._schemaFields[n.name]=n,this[n.name]=n.defaultValue)}),this}reomveField(...i){return i&&i.length>0&&i.forEach(n=>{this._schemaFields&&n.name&&this._schemaFields[n.name]&&delete this._schemaFields[n.name]}),this}accept(i,n){if(n)for(const c in n){const d=n[c];if(d&&d.name&&d.type){const p=(i==null?void 0:i[d.name])??(i==null?void 0:i[t.camelCase(d.name)])??d.defaultValue;switch(d.type){case"datetime":this[d.name]=t.toDateTime(p,"Dayjs");break;case"boolean":this[d.name]=p==="1"||p===!0;break;case"number":this[d.name]=t.toNumber(p);break;case"string":this[d.name]=t.toString(p,!0);break;default:this[d.name]=p;break}}}return this.uid=t.guid(),this.dirty=!1,this.dirtyFields={},this}}e.Model=T;class S extends a{constructor(i){super();ta(this,$e);ta(this,K,[]);ta(this,he,[]);ta(this,z,[]);ta(this,Ie,[]);ta(this,Ne);ta(this,xe);ta(this,Le,!0);ta(this,ve);ta(this,Ge,[]);ta(this,_e,{});j(this,"tableName","");this.tableName="Table0",i=i||{schema:{}},this.init(i)}get options(){return Je(this,Ne)}get BingdingInfo(){return Je(this,Ge)}get rowCount(){return Je(this,K).length}get Current(){return Je(this,xe)}get IsHierarchyTable(){var i,n,c,d;return t.toString((n=(i=Je(this,Ne))==null?void 0:i.hierarchy)==null?void 0:n.parentField,!0).length>0&&t.toString((d=(c=Je(this,Ne))==null?void 0:c.hierarchy)==null?void 0:d.primaryField,!0).length>0}init(i){i&&(jt(this,Ne,i),jt(this,K,[]),jt(this,he,[]),jt(this,z,[]),jt(this,Ie,[]),jt(this,xe,void 0))}setBindingInfo(i,n,c,d){i&&n&&n.trim().length>0&&!Je(this,Ge).some(p=>{var m;return((m=p.formHelper)==null?void 0:m.FormId)===i.FormId&&p.configId===n})?Je(this,Ge).push({formHelper:i,configId:n,dataTable:this,controlType:c}):Je(this,Ge).some(p=>p.grid.gridId===d.gridId)||(d.gridOptions.context=d.gridOptions.context||{},d.gridOptions.context.bindingSource=this,Je(this,Ge).push({grid:d,dataTable:this,controlType:c}))}removeBindingInfo(i,n,c){var d,p;for(let m=Je(this,Ge).length-1;m>=0;m--)Je(this,Ge)[m].configId===n&&((p=(d=Je(this,Ge)[m])==null?void 0:d.formHelper)==null?void 0:p.FormId)===(i==null?void 0:i.FormId)?Je(this,Ge).splice(m,1):c&&Je(this,Ge)[m].grid.gridId===c.gridId&&(c.gridOptions.context.bindingSource&&delete c.gridOptions.context.bindingSource,Je(this,Ge).splice(m,1))}setEvent(i,n){i&&(Je(this,_e)[i]=n)}getEvent(i){return Je(this,_e)[i]}setAllowCancelChanges(i){return jt(this,ve,i),this}addField(...i){if(i&&i.length>0&&(i.forEach(n=>{n.name&&Je(this,Ne).schema&&Je(this,Ne).schema[n.name]===void 0&&(Je(this,Ne).schema[n.name]=n)}),Je(this,K).length>0))for(let n=0;n<Je(this,K).length;n++)Je(this,K)[n].addField(...i);return this}removeField(...i){if(i&&i.length>0&&(i.forEach(n=>{n.name&&Je(this,Ne).schema&&Je(this,Ne).schema[n.name]===void 0&&delete Je(this,Ne).schema[n.name]}),Je(this,K).length>0))for(let n=0;n<Je(this,K).length;n++)Je(this,K)[n].reomveField(...i);return this}get(i){for(let n=0;n<Je(this,K).length;n++)if(Je(this,K)[n].uid===i)return Je(this,K)[n]}getRows(i,n=!1){const c=[],d=p=>{n instanceof Function?c.push(n(p)||p.toJSON()):c.push(n?p.toJSON():p)};switch(i){case"created":{Je(this,z).forEach(p=>{d(p)});break}case"updated":{Je(this,K).forEach(p=>{p.dirty&&!p.isNew&&d(p)});break}case"removed":{Je(this,Ie).forEach(p=>{d(p)});break}case"unchanged":{Je(this,K).forEach(p=>{!p.dirty&&!p.isNew&&d(p)});break}case"original":{Je(this,he).forEach(p=>{!p.dirty&&!p.isNew&&d(p)});break}case"all":{Je(this,K).forEach(p=>{d(p)});break}}return c}getRowsAsBlock(i,n){const c=new ut.EiBlock("Table0"),d=this.getRows(i,n??!0);if(d&&d.length>0){const p=[];if(Je(this,Ne).schema){const m=_=>{const E=new ut.EiColumn(_.name);return E.type=_.type==="number"?"N":"C",E.descName=_.caption,E};Object.keys(Je(this,Ne).schema).forEach(_=>{var v;const E=m((v=Je(this,Ne).schema)==null?void 0:v[_]);c.addColumn(E),p.push({name:E.name,type:E.type})})}d.forEach(m=>{const _=[];p.forEach(E=>{_.push(m[E.name])}),c.addRow(_)})}return c}at(i){return Je(this,K).at(i)}indexOf(i){if(i&&i.uid.length>0){for(let n=0;n<Je(this,K).length;n++)if(Je(this,K)[n].uid===i.uid)return n}return-1}setCurrent(i,n){var m;const c={},d=((m=Je(this,xe))==null?void 0:m.uid)||"",p=(i==null?void 0:i.uid)||"";c.bindingInfo=Je(this,Ge),c.oldCurrent=Je(this,xe),c.current=i,c.source=n,jt(this,xe,i),d!==p&&ra(this,$e,_a).call(this,"currentChanged",c)}insert(i,n,c){let d;return n&&(d=new T(n,Je(this,Ne).schema,this),c&&c.trim().length>0&&d[c]!==void 0&&(d[c]=t.guid()),d.isNew=!0,Je(this,K).splice(i,0,d),Je(this,z).push(d),ra(this,$e,_a).call(this,"dataInserted",{bindingInfo:Je(this,Ge),insertAt:i,current:d}),this.setCurrent(d)),d}add(i,n){const c=new T(i,Je(this,Ne).schema,this);return n&&n.trim().length>0&&c[n]!==void 0&&(c[n]=t.guid()),c.isNew=!0,Je(this,K).push(c),Je(this,z).push(c),ra(this,$e,_a).call(this,"dataAdded",{bindingInfo:Je(this,Ge),current:c}),this.setCurrent(c),c}import(i,n=-1,c=!0,d){const p=[];return(i==null?void 0:i.length)>0&&(i.forEach(m=>{m instanceof T&&(m=m.toJSON());const _=new T(m,Je(this,Ne).schema,this);d&&d.trim().length>0&&_[d]!==void 0&&(_[d]=t.guid()),_.isNew=c,p.push(_)}),n<0?Je(this,K).push(...p):Je(this,K).splice(n,0,...p),Je(this,z).push(...p),ra(this,$e,_a).call(this,"dataImported",{bindingInfo:Je(this,Ge),models:p,insertAt:n,current:p[i.length-1]}),this.setCurrent(p[i.length-1])),p}remove(i){if(!i)return;let n=[];i instanceof Array&&i.length>0?n=i:i&&(n=[i]);let c=!1;const d=[];if(n.length>0){let p=-1,m=-1;if(n.forEach(_=>{var E;if(p=Je(this,K).findIndex(v=>v.uid===_.uid),(m<0||p<m)&&(m=p),p!==-1){if(c||(c=Je(this,K)[p].uid===((E=Je(this,xe))==null?void 0:E.uid)),Je(this,K)[p].isNew){const v=Je(this,z).indexOf(Je(this,K)[p]);v>=0&&Je(this,z).splice(v,1)}else Je(this,Ie).push(Je(this,K)[p]);d.push(Je(this,K)[p]),Je(this,K).splice(p,1)}}),d.length>0&&ra(this,$e,_a).call(this,"dataRemoved",{bindingInfo:Je(this,Ge),models:d}),c){let _;Je(this,K).length>0&&(Je(this,K).length===m?_=Je(this,K)[m-1]:_=Je(this,K)[m]),this.setCurrent(_)}}}setRowState(i,n){let c=this.indexOf(i);if(c<0&&(Je(this,K).push(i),c=Je(this,K).length-1),c>=0){Je(this,K)[c].dirty=n==="updated",Je(this,K)[c].isNew=n==="added";const d=Je(this,z).findIndex(p=>p.uid===i.uid);n==="added"&&d<0?Je(this,z).push(i):d>=0&&Je(this,z).splice(d,1),ra(this,$e,_a).call(this,"rowStateChanged",{bindingInfo:Je(this,Ge),model:Je(this,K)[c],state:n})}}clear(){return jt(this,K,[]),jt(this,he,[]),jt(this,z,[]),jt(this,Ie,[]),jt(this,xe,void 0),ra(this,$e,_a).call(this,"dataCleared",{bindingInfo:Je(this,Ge)}),this}merge(i,n=!0,c=!1){var m,_,E,v,A;const d=[],p=Je(this,K).length>0;if(n&&(jt(this,K,[]),jt(this,he,[]),jt(this,z,[]),jt(this,Ie,[])),i!==void 0&&i.length>0&&((m=this.options)!=null&&m.schema)){const B=this.options.schema,Q=Object.keys(i[0]),N=Object.keys(B),W=N.filter(Z=>Q.includes(Z)||Q.includes(t.camelCase(Z))),J=N.filter(Z=>!Q.includes(Z)&&!Q.includes(t.camelCase(Z))),re=new Map,Se=t.toString((E=(_=Je(this,Ne))==null?void 0:_.hierarchy)==null?void 0:E.primaryField,!0),ue=t.toString((A=(v=Je(this,Ne))==null?void 0:v.hierarchy)==null?void 0:A.parentField,!0),me=Se.length>0&&ue.length>0&&B[Se]&&B[ue];for(let Z=0;Z<i.length;Z++){const Te=new T(void 0,void 0,this);Te.setSchema(B,!1),W.forEach(ce=>{switch(B[ce].type){case"datetime":Te[ce]=t.toDateTime(i[Z][ce]??i[Z][t.camelCase(ce)],"Dayjs");break;case"boolean":Te[ce]=t.toBoolean(i[Z][ce]??i[Z][t.camelCase(ce)]);break;case"number":Te[ce]=t.toNumber(i[Z][ce]??i[Z][t.camelCase(ce)]);break;case"string":Te[ce]=t.toString(i[Z][ce]??i[Z][t.camelCase(ce)],!0);break;default:Te[ce]=i[Z][ce]??i[Z][t.camelCase(ce)];break}}),J.forEach(ce=>{switch(B[ce].type){case"datetime":Te[ce]=null;break;case"boolean":Te[ce]=!1;break;case"number":Te[ce]=0;break;case"string":Te[ce]="";break;default:Te[ce]=null;break}}),Te.isNew=c,d.push(Te),Je(this,K).push(Te),me&&Te[Se]&&re.set(Te[Se],Te)}if(me){const Z=Te=>{const ce=[];for(;Te;)ce.unshift(Te[Se]),Te=re.get(Te[ue]);return ce};for(let Te=0;Te<Je(this,K).length;Te++)Je(this,K)[Te][o.TreeHierarchyFieldName]=Z(Je(this,K)[Te])}ra(this,$e,Bo).call(this),ra(this,$e,_a).call(this,"dataMerged",{bindingInfo:Je(this,Ge),models:d,current:Je(this,K)[0]}),this.setCurrent(Je(this,K)[0])}else jt(this,xe,void 0),p&&ra(this,$e,_a).call(this,"dataMerged",{bindingInfo:Je(this,Ge),models:d,current:void 0});return d}hasChanges(){if(Je(this,Ie).length)return!0;for(let i=0;i<Je(this,K).length;i++)if(Je(this,K)[i].isNew||Je(this,K)[i].dirty)return!0;return!1}acceptChanges(){return jt(this,z,[]),jt(this,Ie,[]),Je(this,K).forEach(i=>{i.isNew=!1,i.dirty=!1,i.dirtyFields={}}),ra(this,$e,Bo).call(this),this}cancelChanges(){return Je(this,Le)&&(jt(this,z,[]),jt(this,Ie,[]),jt(this,K,Wr.cloneDeep(Je(this,he))),ra(this,$e,_a).call(this,"dataMerged",{bindingInfo:Je(this,Ge),models:Je(this,K),current:void 0})),this}totalCount(){return Je(this,K).length}data(i){return i!==void 0&&i.length>0&&this.merge(i,!0,!1),Je(this,K)}originalCopy(){return Wr.cloneDeep(Je(this,he))}originalModel(i){for(let n=0;n<Je(this,he).length;n++)if(Je(this,he)[n].uid===i)return Wr.cloneDeep(Je(this,he)[n])}}K=new WeakMap,he=new WeakMap,z=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,xe=new WeakMap,Le=new WeakMap,ve=new WeakMap,Ge=new WeakMap,_e=new WeakMap,$e=new WeakSet,_a=function(i,n){var d;(d=Je(this,Ge))==null||d.forEach(p=>{var m,_,E,v,A,B,Q,N,W,J,re,Se,ue,me,Z,Te,ce,ze,Me,ge,le,Y,Fe,ke,Ve,at,pt,ht,Ct,_t;if(p.formHelper&&p.configId)if(p.controlType==="Grid"){const Qe=p.formHelper.getGrid(p.configId);if((m=Qe==null?void 0:Qe.gridOptions)!=null&&m.api)switch(i){case"dataMerged":{const U=Qe.gridOptions.api.getFilterModel(),gt=Qe.gridOptions.columnApi.getColumnState().filter(Ye=>Ye.sort!==null);Object.keys(U).length===0&&gt.length===0&&Qe.gridOptions.context.calculateRowSpan&&Qe.gridOptions.context.calculateRowSpan instanceof Function&&Qe.gridOptions.context.calculateRowSpan(!0),(E=(_=Qe.gridOptions)==null?void 0:_.api)==null||E.clearRangeSelection(),Qe.gridOptions.context.focusRowId="",Qe.gridOptions.context.focusColId="",Qe.gridOptions.context.dataMerged=!0,(A=(v=Qe.gridOptions)==null?void 0:v.api)==null||A.setRowData(Je(this,K));let rt=Je(this,K).length.toString().length*7+20;((Q=(B=Qe.gridOptions.context)==null?void 0:B.viewConfig)==null?void 0:Q.SHOW_SELECTION)==="1"&&(rt+=20),(N=Qe.gridOptions.context)!=null&&N.allowDragRow&&(rt+=21),((J=(W=Qe.gridOptions.context)==null?void 0:W.options)==null?void 0:J.masterDetail)===!0&&(rt+=22);const ct=(Se=(re=Qe.gridOptions.columnApi)==null?void 0:re.columnModel)==null?void 0:Se.gridColumns,Ze=ct==null?void 0:ct.find(Ye=>Ye.colId===o.GridCheckColumnFieldName);Ze&&Qe.gridOptions.columnApi.setColumnWidth(Ze,rt);break}case"dataCleared":{(me=(ue=Qe.gridOptions)==null?void 0:ue.api)==null||me.setRowData([]);break}case"dataRemoved":{if(Qe.gridOptions.api.applyTransaction({remove:n.models}),((Te=(Z=Qe.gridOptions.context)==null?void 0:Z.options)==null?void 0:Te.showRowNo)!==!1&&(Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]}),Qe.gridOptions.context.focusRowId)){const U=(ce=Qe==null?void 0:Qe.gridOptions)==null?void 0:ce.api.getRowNode(Qe.gridOptions.context.focusRowId);U&&(Qe.gridOptions.context.focusRowId=U.id,Qe.gridOptions.context.focusColId||(Qe.gridOptions.context.focusColId=e.SysInfo.GridCheckColumnFieldName),p.formHelper.setGridFocusedCell(Qe,U.rowIndex,Qe.gridOptions.context.focusColId))}break}case"dataAdded":{Qe.gridOptions.api.applyTransaction({add:[n.current]}),Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]});const U=(Me=(ze=Qe.gridOptions.context)==null?void 0:ze.viewConfig)==null?void 0:Me.AUTO_SELECT_MODE;(U==="1"||U==="3")&&((ge=p.formHelper)==null||ge.checkGridRow(p.configId,n.current));break}case"dataInserted":{n.insertAt>=0?Qe.gridOptions.api.applyTransaction({add:[n.current],addIndex:n.insertAt}):Qe.gridOptions.api.applyTransaction({add:[n.current]}),Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]});const U=(Y=(le=Qe.gridOptions.context)==null?void 0:le.viewConfig)==null?void 0:Y.AUTO_SELECT_MODE;(U==="1"||U==="3")&&p.formHelper.checkGridRow(p.configId,n.current);break}case"dataImported":{n.insertAt>=0?Qe.gridOptions.api.applyTransaction({add:n.models,addIndex:n.insertAt}):Qe.gridOptions.api.applyTransaction({add:n.models}),Qe.gridOptions.api.refreshCells({columns:[o.GridCheckColumnFieldName]});const U=(ke=(Fe=Qe.gridOptions.context)==null?void 0:Fe.viewConfig)==null?void 0:ke.AUTO_SELECT_MODE;(U==="1"||U==="3")&&p.formHelper.checkGridRow(p.configId,n.models);break}case"currentChanged":{if(Je(this,xe)&&n.source!==p.configId&&((at=(Ve=Qe.gridOptions.context)==null?void 0:Ve.options)==null?void 0:at.suppressDefaultFocusedCell)!==!0){const U=(ht=Qe==null?void 0:Qe.gridOptions)==null?void 0:ht.api.getRowNode((pt=Je(this,xe))==null?void 0:pt.uid);(_t=(Ct=Qe.gridOptions)==null?void 0:Ct.api)==null||_t.clearFocusedCell(),U&&(Qe.gridOptions.context.focusColId||(Qe.gridOptions.context.focusColId=e.SysInfo.GridCheckColumnFieldName),p.formHelper.setGridFocusedCell(Qe,U.rowIndex,Qe.gridOptions.context.focusColId))}break}}}else p.controlType==="Layout"&&i==="currentChanged"&&p.formHelper.refreshLayoutBindModel(p.configId)});const c=Je(this,_e)[i];c&&c instanceof Function&&c(n)},Bo=function(){Je(this,ve)||Je(this,ve)===void 0&&Je(this,K).length<=500?(jt(this,he,Wr.cloneDeep(Je(this,K))),jt(this,Le,!0)):(jt(this,he,[]),jt(this,Le,!1))},e.DataTable=S;class x{constructor(r){j(this,"dataSetName","");j(this,"dataTables");j(this,"relations");this.dataTables={},this.relations={},this.dataSetName=(r==null?void 0:r.trim())||""}get Name(){return this.dataSetName}setName(r){return this.dataSetName=(r==null?void 0:r.trim())||"",this}addDataTable(r,i){return i.tableName=r,this.dataTables[r]=i,this}removeDataTable(r){return this.contains(r)&&delete this.dataTables[r.trim()],this}renameDataTable(r,i){return this.contains(r)&&!this.contains(i)&&r.trim().toUpperCase()!==i.trim().toUpperCase()&&(this.addDataTable(i.trim().toUpperCase(),this.dataTables[r.trim().toUpperCase()]),delete this.dataTables[r.trim().toUpperCase()]),this}copyDataTable(r,i){let n,c;return r instanceof S?n=r:typeof r=="string"&&(n=this.dataTables[r]),n&&n.options&&(c=new S(n.options)),i&&i.trim().length>0&&!this.contains(i)&&(this.dataTables[i.trim()]=c),c}cloneDataTable(r,i){const n=this.copyDataTable(r,i);return n.data([]),n}getDataTable(r){return this.dataTables[r]}getTableName(r){let i;return Object.keys(this.dataTables).every(n=>this.dataTables[n]===r?(i=n,!1):!0),i}clear(...r){let i=Object.keys(this.dataTables);return r.length>0&&(i=r),i.forEach(n=>{this.dataTables[n]&&this.dataTables[n]instanceof S&&this.dataTables[n].clear()}),this}mergeData(r,i,n=!0,c=!1){return(r==null?void 0:r.trim().length)>0&&this.contains(r.trim())&&i&&this.dataTables[r].merge(i,n,c),this}mergeDataFromEIInfo(r,i="",n=!0){var c;if(i&&i.trim().length>0&&this.contains(i.trim())){const d=(c=r.getBlock(i.trim()))==null?void 0:c.getMappedRows();this.mergeData(i.trim(),d,n)}else Object.keys(this.dataTables).forEach(d=>{d.trim().length>0&&this.dataTables[d.trim()]&&r.getBlock(d.trim())&&this.mergeData(d.trim(),r.getBlock(d.trim()).getMappedRows(),n)});return this}getCurrentDataObject(r){let i;return(r==null?void 0:r.trim().length)>0&&this.contains(r.trim())&&(i=this.dataTables[r].Current),i}tablesCount(){return this.dataTables?Object.keys(this.dataTables).length:0}contains(r){return r&&r.trim().length>0?this.dataTables[r.trim()]!==void 0:!1}isEmpty(){return!(this.dataTables&&Object.keys(this.dataTables).length>0)}hasChanges(r){if(this.dataTables){if(r&&r.trim().length>0&&this.dataTables[r.trim()])return this.dataTables[r.trim()].hasChanges();{const n=Object.keys(this.dataTables);for(let c=0;c<n.length;c++)if(this.dataTables[n[c]].hasChanges())return!0}}return!1}hasRelation(r){return this.dataTables&&r&&r.trim().length>0&&this.relations[r.trim()]&&this.relations[r.trim()].length>0}acceptChanges(){return Object.keys(this.dataTables).forEach(i=>{this.dataTables[i]&&this.dataTables[i]instanceof S&&this.dataTables[i].acceptChanges()}),this}}e.DataSet=x;class y{constructor(r,i,n,c,d){j(this,"SysDefinedParas");j(this,"_app");j(this,"_currentFormRegitInfo",{});j(this,"_currentConfigCompanyCode");j(this,"_serverPartition","");j(this,"_customPartition","");j(this,"_moduleName","");j(this,"_formId","");j(this,"_formName","");j(this,"_formCaption","");j(this,"_formWidth",-1);j(this,"_formHeight",-1);j(this,"_maxmizeBox",!0);j(this,"_minimizeBox",!0);j(this,"_resizable",!0);j(this,"_initializeFlag",0);j(this,"_layoutIds");j(this,"_dataSetName","");j(this,"_tableNames","");j(this,"_serviceName","JAER01/getFormConfig");j(this,"_initialConfiParas",{});j(this,"_configInfo",{});j(this,"_systemInfo",{});j(this,"_customDefaultValues",{});j(this,"_dropDownRefreshKey",l.reactive({}));j(this,"_dropDownBindSource",{});j(this,"_dropDownCascader",{});j(this,"_gridOptions",{});j(this,"_gridReactiveOptions",l.reactive({}));j(this,"_gridToolbarOptions",l.reactive({}));j(this,"_hiddenFields",{});j(this,"_requiredFields",{});j(this,"_requiredFieldsByCondition",{});j(this,"_formDataSet",new x);j(this,"_formBindingRelation",{});j(this,"_formAuthButtons",{});j(this,"_groupCompanyCode","");j(this,"_groupCompanyName","");j(this,"_formConfigLicens","");j(this,"_formConfigLicensErrorMsg","WMyNCZMrw9FY9qti+0p7zA==");j(this,"_privateEncryptKey","QTS8kH81A2Do4qfezJ9cCEM4lZifC7Ym");j(this,"_developPermisson","0");j(this,"_tempSingleConfigInfo",{});j(this,"_gridInstanceInfo",{});j(this,"_gridColumnsInfo",{});j(this,"_gridColumnsConfigInfo",{});j(this,"_gridStyleInfo",{});j(this,"_allowMergeColumnFields",{});j(this,"_widgetInstanceInfo",{});j(this,"_layoutConditionStyleInfo",{});j(this,"_layoutConfigRelationInfo",{});j(this,"_sysParaInfo",{});j(this,"_gridCustomEvent",{});j(this,"_formOptions",{});j(this,"_layoutOpitons",l.reactive({}));j(this,"_layoutItemOpitons",l.reactive({}));j(this,"_layoutBindModelUid",l.reactive({}));j(this,"_layoutBindModel",{});j(this,"_controlConditionProps",{});j(this,"_erxGlobalConfig",{});j(this,"excuteGridColumnExpressions",(r,i)=>{const n={...r},c=Object.keys(n).sort((p,m)=>p.length>m.length?-1:p.length<m.length?1:0);let d=i;c.forEach(p=>{Ut.isDayjs(n[p])?n[p]=n[p].toDate():(n[p]===null||n[p]===void 0)&&(n[p]="");const m=new RegExp(`\\b${p}\\b`,"gi"),_=new RegExp(`[${p}]`.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");_.test(d)?d=d.replaceAll(_,`data.${p}`):m.test(d)&&(d=d.replaceAll(m,`data.${p}`))});try{return new Function("data",d)(n)}catch{console.error("ER: Script has a syntax error: "+d+"; data: "+JSON.stringify(n))}});this._formId=t.guid(),this._serverPartition=r||this._serverPartition,this._serviceName=n||this._serviceName,this._formName=i||this._formName,this._layoutIds=c,this._initialConfiParas=d,this._currentConfigCompanyCode={},this.SysDefinedParas={GroupCompanyCode:"BS",GroupCompanyName:"宝信软件",DefaultRmbCode:"CNY"}}get App(){return this._app}get CurrentFormRegitInfo(){return this._currentFormRegitInfo}get Locale(){return Ei()}get IsRtl(){return Ta()}get ModuleName(){return this._moduleName}get FormId(){return this._formId}get FormName(){return this._formName}get FormCaption(){return this._formCaption}get FormWidth(){return this._formWidth}get FormHeight(){return this._formHeight}get MaxmizeBox(){return this._maxmizeBox}get MinimizeBox(){return this._minimizeBox}get Resizable(){return this._resizable}get InitializeFlag(){return this._initializeFlag}get ConfigInfo(){return this._configInfo}get SystemInfo(){return this._systemInfo}get DropDownRefreshKey(){return this._dropDownRefreshKey}get DropDownBindSource(){return this._dropDownBindSource}get DropDownCascader(){return this._dropDownCascader}get FormOptions(){return this._formOptions}get GridOptions(){return this._gridOptions}get GridToolbarOptions(){return this._gridToolbarOptions}get RequiredFields(){return this._requiredFields}get RequiredFieldsByCondition(){return this._requiredFieldsByCondition}get AllowMergeColumnFields(){return this._allowMergeColumnFields}get FormDataSet(){return this._formDataSet}get FormBindingRelation(){return this._formBindingRelation}get FormAuthButtons(){return this._formAuthButtons}get DefaultConfigCompanyCode(){return"BS"}get DefaultConfigCompanyName(){return"宝信软件"}get ServerPartition(){return this._serverPartition}get CustomPartition(){return this._customPartition}get InitialConfiParas(){return this._initialConfiParas}get InitialService(){return this._serviceName}get CurrentConfigCompanyCode(){return this._currentConfigCompanyCode}get GroupCompanyCode(){return this._groupCompanyCode}get GroupCompanyName(){return this._groupCompanyName}get WidgetInstanceInfo(){return this._widgetInstanceInfo}get DevelopPermisson(){return this._developPermisson}get LayoutBindModelUid(){return this._layoutBindModelUid}async Initialize(r,i,n,c,d){var m,_,E,v;this._erxGlobalConfig=await e.Core.getErxGlobalConfig(),(_=(m=this._erxGlobalConfig)==null?void 0:m.License)!=null&&_[e.SysInfo.CompanyCode]&&(this._formConfigLicens=(v=(E=this._erxGlobalConfig)==null?void 0:E.License)==null?void 0:v[e.SysInfo.CompanyCode]);const p=t.decryptData(this._formConfigLicens,e.SysInfo.GridCheckColumnFieldName,t.decryptData(this._privateEncryptKey,e.SysInfo.GridCheckColumnFieldName,e.SysInfo.GridCheckColumnFieldName));return this._erxGlobalConfig&&(!this._formConfigLicens||p!==o.CompanyName)&&this.messageWarning(t.decryptData(this._formConfigLicensErrorMsg,e.SysInfo.GridCheckColumnFieldName,e.SysInfo.GridCheckColumnFieldName)),new Promise((A,B)=>{var W;this._serverPartition=(r==null?void 0:r.trim())||this._serverPartition,this._serviceName=(c==null?void 0:c.trim())||this._serviceName,this._formName=(i==null?void 0:i.trim())||this._formName,this._initialConfiParas=d||this._initialConfiParas||{},this._layoutIds=n||this._layoutIds;let Q="";this._layoutIds&&(typeof this._layoutIds=="string"?Q=this._layoutIds:this._layoutIds instanceof Array&&(Q=this._layoutIds.join(","))),this._dataSetName=((W=this._dataSetName)==null?void 0:W.trim())||"#";const N=new ut.EiInfo;if(N.addBlock(t.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:Q,DATASET_NAME:this._dataSetName,TABLE_NAMES:this._tableNames}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const J=new ut.EiBlock("InitializeFormParas");J.addColumn("PARA_NAME"),J.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(re=>{J.addRow([{PARA_NAME:re,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[re]:""}])}),N.addBlock(J)}e.Core.callService(this._serviceName,N).then(J=>{var re,Se,ue;J.getStatus()>=0?(Object.keys(J.getBlocks()).forEach(me=>{this._configInfo[me]=J.getBlock(me)}),((ue=(Se=(re=this._configInfo)==null?void 0:re.TSI00FORM)==null?void 0:Se.getMappedRows())==null?void 0:ue.length)>0?(this.InitializeWithData(),A({flag:this._initializeFlag,msg:"success"})):(this._initializeFlag=-1,A({flag:this._initializeFlag,msg:`The configuration information for the form [${this._formName}] was not found!`}))):(this._initializeFlag=-1,A({flag:this._initializeFlag,msg:J.getMsg()??"unknown error"}))},J=>{A({...J,flag:-1,msg:"unknown error"})})})}InitializeWithData(){var n,c,d,p,m,_;this._initializeFlag=1;let r=e.SysInfo.CompanyCode;r||(r=this.DefaultConfigCompanyCode);const i=this._configInfo.TSI00FORM.getMappedRows()[0];this._moduleName=i.MODULE_NAME,this.ModuleName.length<2?this._moduleName="GC":this._moduleName=this.ModuleName.substring(0,2),this._formName=i.FORM_NAME,this._formWidth=e.Core.toNumber(i.FORM_WIDTH)||800,this._formHeight=e.Core.toNumber(i.FORM_HEIGHT)||650,this._formCaption=i.FORM_FUNC_DESC,this._minimizeBox=i.MINIMIZE==="1",this._maxmizeBox=i.MAXIMIZE==="1",this._resizable=i.FORM_STYLE!=="3",this._formConfigLicens=i.LICENSE,this._groupCompanyCode=((n=i.GROUP_COMPANY_CODE)==null?void 0:n.trim())||this._groupCompanyCode,this._groupCompanyName=((c=i.GROUP_COMPANY_NAME)==null?void 0:c.trim())||this._groupCompanyName,this._configInfo.IPLAT4J_SYSTEM_INFO&&(this._systemInfo=this._configInfo.IPLAT4J_SYSTEM_INFO.getMappedRows()[0],this._developPermisson=this.getFormSysInfo("DEV_LICENSE")),((d=i.EXT_OPTIONS)==null?void 0:d.trim().length)>0&&(this._formOptions=JSON.parse(i.EXT_OPTIONS)),((_=(m=(p=this._configInfo)==null?void 0:p.TSI00GRIDVIEW)==null?void 0:m.getMappedRows())==null?void 0:_.length)>0?(this.createDataSet(),this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(E=>{this.setDropDownBindSourceAndRequiredFields(E)})):console.error("ER: No view configuration information found!")}setMenuFormInstance(r){var i,n,c,d,p,m;if(r){const _=(i=r==null?void 0:r.attrs)==null?void 0:i.__eiInfo;this._currentFormRegitInfo.formInfo=_==null?void 0:_.extAttr,this._currentFormRegitInfo.formQueryParams=e.Core.getQueryParams((n=_==null?void 0:_.extAttr)==null?void 0:n.efFormLoadPath),this._currentFormRegitInfo.formButtons={},(d=(c=r==null?void 0:r.attrs)==null?void 0:c.__buttonsEi)!=null&&d.blocks&&Object.keys((m=(p=r==null?void 0:r.attrs)==null?void 0:p.__buttonsEi)==null?void 0:m.blocks).forEach(E=>{var v,A;this._currentFormRegitInfo.formButtons[E]=(A=(v=r==null?void 0:r.attrs)==null?void 0:v.__buttonsEi)==null?void 0:A.getBlock(E).getMappedRows(),this._formAuthButtons[E]=this._currentFormRegitInfo.formButtons[E]})}}async loadConfig(r,i){return new Promise((n,c)=>{var p,m;let d="";if((p=this._formDataSet)!=null&&p.dataTables&&(d=Object.keys((m=this._formDataSet)==null?void 0:m.dataTables).toString()),i===void 0&&(i=this._initialConfiParas),r.trim().length>0){const _=r.split(",");let E="";for(let v=0;v<_.length;v++)this.containsConfig(_[v].trim())||(E=E.length===0?_[v].trim():E+","+_[v].trim());if(E.length>0){const v=new ut.EiInfo;if(v.addBlock(t.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:E,EXIST_TABLES:d,INI_FLAG:this._initializeFlag}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const A=new ut.EiBlock("InitializeFormParas");A.addColumn("PARA_NAME"),A.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(B=>{A.addRow([{PARA_NAME:B,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[B]:""}])}),v.addBlock(A)}e.Core.callService(this._serviceName,v).then(A=>{A.getStatus()>=0&&(Object.keys(A.getBlocks()).forEach(N=>{["IPLAT4J_SYSTEM_INFO","TESCOMPANYINFO","TSI00FORM","TSI00DATASOURCE","TSI00DATATABLE","TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].includes(N)||(this._configInfo[N]=A.getBlock(N))}),["TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].forEach(N=>{A.getBlock(N)&&this._configInfo[N]&&A.getBlock(N).getMappedRows().length>0&&this._configInfo[N].addRow(A.getBlock(N).getRows())}),E.split(",").forEach(N=>{var re;const W=this.getSingleViewConfigInfo(N),J=t.toString(W.TABLE_NAME).trim();if(W&&J.length>0&&!this._formDataSet.contains(J)){this._configInfo.TSI00DATATABLE.data.some(ue=>ue.TABLE_NAME===J)||A.getBlock("TSI00DATATABLE").getMappedRows().length>0&&this._configInfo.TSI00DATATABLE.addRow(A.getBlock("TSI00DATATABLE").getRows());const Se={};W.FUNCTION_TYPE==="T"&&((re=W.CURRENT_NODE_DESC)==null?void 0:re.trim().length)>0&&W.FATHER_NODE_DESC.trim().length>0&&(Se.hierarchy={primaryField:W.CURRENT_NODE_DESC.trim(),parentField:W.CURRENT_NODE_DESC}),this.createDataTable(J,Se)}this.setDropDownBindSourceAndRequiredFields(W)})),n({flag:A.getStatus()>=0?1:-1,msg:A.getMsg()??"unknown error"})},A=>{n({...A,flag:-1,msg:"unknown error"})})}else n({flag:1,msg:"Configuration ["+r.trim()+"] already exists"})}else n({flag:-1,msg:"No config id"})})}$t(r,i){var c,d;let n="";if((r==null?void 0:r.trim().length)>0){for(let p=0;p<((d=(c=this.ConfigInfo.TSI00FORMRESOURCE)==null?void 0:c.getMappedRows())==null?void 0:d.length);p++)if(this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[p].ITEM_CODE===r){n=this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[p].ITEM_VALUE_RES||this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[p].ITEM_VALUE;break}n=n??e.Core.$t(r,i)}return n}setFormCapiton(r){return this._formCaption=r,this}setFormOptions(r){return this._formOptions={...this._formOptions,...r},this}setDropDownBindSourceAndRequiredFields(r){const i={},n={},c=[],d=[],p=["F3","F6","F7","FD","FA","FB","FP","FC","FH","FL","FJ","FK","G1","G2","G4","GD","GP"];if(this._configInfo.TSI00GRIDCOLUMN&&this._configInfo.TSI00GRIDCOLUMN.getMappedRows().length>0){let m=[],_=e.SysInfo.CompanyCode;_||(_=this.DefaultConfigCompanyCode),r.MATCH_FLAG==="1"&&(m=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(E=>{const v=(r.FUNCTION_TYPE==="F"?"F":"G")+E.COLUMN_EDIT;return E.FUNCTION_ID===r.FUNCTION_ID&&E.COMPANY_CODE===_&&(p.includes(v)||E.ITEM_MUST_FLAG==="1")})),m.length===0&&(m=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(E=>{const v=(r.FUNCTION_TYPE==="F"?"F":"G")+E.COLUMN_EDIT;return E.FUNCTION_ID===r.FUNCTION_ID&&E.COMPANY_CODE===this.DefaultConfigCompanyCode&&(p.includes(v)||E.ITEM_MUST_FLAG==="1")})),m.length>0&&m.forEach(E=>{const v=(r.FUNCTION_TYPE==="F"?"F":"G")+E.COLUMN_EDIT;if(p.includes(v))if(E.ORIGIN_CODE!=="0"&&E.SVC_NAME.trim().length>0){if(i[E.ITEM_CODE]=this.setDropDownBindOptions(r.FUNCTION_TYPE,E),E.FATHER_FIELD.trim().length>0&&E.FORM_FILTER.trim().length>0&&E.FORM_FILTER.trim()!=="0"){E.LAYOUT_ID.trim().length===0&&(E.LAYOUT_ID=r.FUNCTION_ID),this._dropDownCascader[E.LAYOUT_ID.trim()+E.FATHER_FIELD.trim()]||(this._dropDownCascader[E.LAYOUT_ID.trim()+E.FATHER_FIELD.trim()]=[]);const A={};A.COLUMN_EDIT=E.COLUMN_EDIT,A.FUNCTION_ID=E.FUNCTION_ID,A.ITEM_CODE=E.ITEM_CODE,A.FORM_FILTER=E.FORM_FILTER,A.FUNCTION_TYPE=r.FUNCTION_TYPE,this._dropDownCascader[E.LAYOUT_ID.trim()+E.FATHER_FIELD.trim()].push(A)}n[E.ITEM_CODE]=t.guid()}else console.warn(`ER: The dropdown data source for [${r.FUNCTION_ID}.${E.ITEM_CODE}] is not configured!`);E.ITEM_MUST_FLAG==="1"&&(E.MUST_INPUT_CONDITION.trim().length>0?d.push({ITEM_CODE:E.ITEM_CODE,COL_CAPTION:E.COL_CAPTION,FIELD_NAME:E.FIELD_NAME,MUST_INPUT_CONDITION:E.MUST_INPUT_CONDITION,CONDITION_TABLE:E.CONDITION_TABLE}):c.push({ITEM_CODE:E.ITEM_CODE,COL_CAPTION:E.COL_CAPTION,FIELD_NAME:E.FIELD_NAME}))})}this._dropDownRefreshKey[r.FUNCTION_ID]=n,this._dropDownBindSource[r.FUNCTION_ID]=i,this._requiredFields[r.FUNCTION_ID]=c,this._requiredFieldsByCondition[r.FUNCTION_ID]=d}setCustomPartition(r){return this._customPartition=r,this._customPartition}setLayoutCaption(r,i){this.setLayoutOptions(r,"layoutCaption",i)}getLayoutCaption(r){return t.toString(this.getLayoutOptions(r,"layoutCaption"))}getLayoutBindModel(r){if(this._layoutBindModel[r]===void 0){const i=new T;i.uid="",this._layoutBindModel[r]=l.reactive(i)}return this._layoutBindModel[r]}refreshLayoutBindModel(r){const i=this.getBindingTable(r);let n=i==null?void 0:i.Current;n||(n=new T,n.uid=""),this._layoutBindModel[r]=l.reactive(n),this._layoutBindModelUid[r]=n.uid}setLayoutBindForm(r,i){this.setLayoutOptions(r,"bindForm",i)}getLayoutBindForm(r){return this.getLayoutOptions(r,"bindForm")}setLayoutOptions(r,i,n){return(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&(r=r.trim(),i=i.trim(),this._layoutOpitons[r]=this._layoutOpitons[r]||{},this._layoutOpitons[r][i]=n),this}getLayoutOptions(r,i){let n;return(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&(r=r.trim(),this._layoutOpitons[r]&&(n=this._layoutOpitons[r][i==null?void 0:i.trim()])),(n==null?void 0:n.value)!==void 0?n==null?void 0:n.value:n}setLayoutItemOption(r,i,n){return(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&n&&(this._layoutItemOpitons[r]=this._layoutItemOpitons[r]||{},this._layoutItemOpitons[r][i]=this._layoutItemOpitons[r][i]||{},Object.keys(n).forEach(c=>{l.isRef(this._layoutItemOpitons[r][i][c])?this._layoutItemOpitons[r][i][c].value=n[c]:this._layoutItemOpitons[r][i][c]=l.ref(n[c])})),this}getLayoutItemOption(r,i,n){let c;return this._layoutItemOpitons[r]&&this._layoutItemOpitons[r][i]&&(c=this._layoutItemOpitons[r][i][n]),(c==null?void 0:c.value)!==void 0?c==null?void 0:c.value:c}setLayoutItemValidateRules(r,i,n,c=!1){if((r==null?void 0:r.trim().length)>0&&typeof i=="string"&&(i==null?void 0:i.trim().length)>0){const d=this.getLayoutBindForm(r);if(d!=null&&d.rulesRef)if(d.rulesRef[i]=d.rulesRef[i]||[],c&&d.rulesRef[i])if((n==null?void 0:n.length)>0){const p=[];n.forEach((m,_)=>{n[_].itemCode=i;let E=!1;for(let v=0;v<d.rulesRef[i].length;v++)if(d.rulesRef[i][v].customType===m.customType){d.rulesRef[i][v]=m,E=!0;break}E||p.push(m)}),p.length>0&&d.rulesRef[i].push(...p)}else d.rulesRef[i]=[];else d.rulesRef[i].push(...n)}return this}setLayoutItemCaptionForeColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{d.trim().length>0&&this.setLayoutItemOption(r,d,{LabelForeColor:n})}),this}setLayoutItemCaptionBackColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{d.trim().length>0&&this.setLayoutItemOption(r,d,{LabelBackColor:n})}),this}setLayoutItemContentForeColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{if(d.trim().length>0){const p=this.getLayoutItemOption(r,d,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","erTreeSelect","erMultiTreeSelect","antInput","antInputNumber","antDateTimePicker","antDatePicker","antMonthPicker","antYearPicker"].includes(p)&&this.setControlCss(r,d,[{property:"color",value:n}]),this.setLayoutItemOption(r,d,{TextForeColor:n})}}),this}setLayoutItemContentBackColor(r,i,n){let c;return i instanceof Array?c=i:c=i.split(","),(c==null?void 0:c.length)>0&&c.forEach(d=>{if(d.trim().length>0){const p=this.getLayoutItemOption(r,d,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","antInput","antInputNumber"].includes(p)&&this.setControlCss(r,d,[{property:"background",value:n}]),this.setLayoutItemOption(r,d,{TextBackColor:n})}}),this}setLayoutConditionStyleConfigInfo(r,i,n){return this._layoutConditionStyleInfo[r]=this._layoutConditionStyleInfo[r]||{},this._layoutConditionStyleInfo[r][i]=n,this}setLayoutConditionStyle(r,i){if((r==null?void 0:r.trim().length)>0){const n=this.getLayoutBindModel(r);if(n&&this._layoutConditionStyleInfo[r==null?void 0:r.trim()]){const c=p=>{var _,E,v,A,B,Q,N,W;const m=this._layoutConditionStyleInfo[r==null?void 0:r.trim()][p];m&&(e.Core.checkExpressionValid(n,e.Core.getSystemFormatString(m.condition))?(((_=m.labelForeColor)==null?void 0:_.trim().length)>0&&this.setLayoutItemCaptionForeColor(r,p,m.labelForeColor),((E=m.labelBackgroundColor)==null?void 0:E.trim().length)>0&&this.setLayoutItemCaptionBackColor(r,p,m.labelBackgroundColor),((v=m.textForeColor)==null?void 0:v.trim().length)>0&&this.setLayoutItemContentForeColor(r,p,m.textForeColor),((A=m.textBackgroundColor)==null?void 0:A.trim().length)>0&&this.setLayoutItemContentBackColor(r,p,m.textBackgroundColor)):(((B=m.labelForeColor)==null?void 0:B.trim().length)>0&&this.setLayoutItemCaptionForeColor(r,p,""),((Q=m.labelBackgroundColor)==null?void 0:Q.trim().length)>0&&this.setLayoutItemCaptionBackColor(r,p,""),((N=m.textForeColor)==null?void 0:N.trim().length)>0&&this.setLayoutItemContentForeColor(r,p,""),((W=m.textBackgroundColor)==null?void 0:W.trim().length)>0&&this.setLayoutItemContentBackColor(r,p,"")))};let d;i instanceof Array?d=i:i&&(i==null?void 0:i.trim().length)>0?d=i.split(","):d=Object.keys(this._layoutConditionStyleInfo[r]),(d==null?void 0:d.length)>0&&d.forEach(p=>{c(p)})}}return this}bindGridCustomEvent(r,i,n){return this._gridCustomEvent[r]=this._gridCustomEvent[r]||{},this._gridCustomEvent[r][i]=n,this}getGridCustomEvent(r,i){let n;return this._gridCustomEvent[r]&&this._gridCustomEvent[r][i]&&(n=this._gridCustomEvent[r][i]),n}getCompanyName(r){return""}cloneTableForLayoutOrGrid(r,i,n){var c,d,p,m,_,E;if(this.InitializeFlag>0&&r.trim().length>0&&i.trim().length>0&&n.trim().length>0&&!((c=this._formDataSet)!=null&&c.contains(i.trim())))if(n=n.trim(),r=r.trim(),i=i.trim(),(d=this._formDataSet)!=null&&d.contains(r)||(r=this.getBindingTableName(r)),r.length>0&&((p=this._formDataSet)!=null&&p.contains(r))){const v=(m=this._formDataSet)==null?void 0:m.getDataTable(r),A=(_=this._formDataSet)==null?void 0:_.cloneDataTable(v,i);(E=this._formDataSet)==null||E.addDataTable(i,A),this._configInfo.TSI00GRIDVIEW.getMappedRows().every(Q=>Q.FUNCTION_ID===n?(Q.TABLE_NAME=i,!1):!0),this._formBindingRelation[n]=i;const B=this.getGrid(n);B&&(v.removeBindingInfo(this,n),B.gridOptions.context.bindingSource=A,B.gridOptions.context.bindTableName=i,A.setBindingInfo(this,n,"Grid"))}else this.messageError(`ER: The origin table [${r}] does not exist!`);return this}containsConfig(r){const i=this.getConfigInfo(r);return!!(i&&i.TSI00GRIDCOLUMN&&i.TSI00GRIDCOLUMN.length>0)}isEmptyConfig(r){return!this.containsConfig(r)}getConfigInfo(r,i=!1){let n={},c=e.SysInfo.CompanyCode;if(c||(c=this.DefaultConfigCompanyCode),this._tempSingleConfigInfo[r])n=this._tempSingleConfigInfo[r];else{let d=[];if(this._configInfo.TSI00GRIDVIEW&&(d=this._configInfo.TSI00GRIDVIEW.getMappedRows().filter(p=>p.FUNCTION_ID===r),d.length>0)){n.TSI00GRIDVIEW=d;const p=n.TSI00GRIDVIEW.FUNCTION_TYPE,m=n.TSI00GRIDVIEW.MATCH_FLAG;this._configInfo.TSI00GRIDCOLUMN&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c&&(_.IS_VISIBLE==="1"||i===!1)),d.length>0&&(n.TSI00GRIDCOLUMN=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode&&(_.IS_VISIBLE==="1"||i===!1)),d.length>0&&(n.TSI00GRIDCOLUMN=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDCOLUMNURL&&p!=="F"&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c),d.length>0&&(n.TSI00GRIDCOLUMNURL=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode),d.length>0&&(n.TSI00GRIDCOLUMNURL=d),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDSTYLE&&p!=="F"&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c&&_.NTYPE.length>2&&_.NTYPE.substring(0,2).toUpperCase()==="W_"),d.length>0&&(n.TSI00GRIDSTYLE=d),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode&&_.NTYPE.length>2&&_.NTYPE.substring(0,2).toUpperCase()==="W_"),d.length>0&&(n.TSI00GRIDSTYLE=d),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDBAND&&p!=="F"&&(d=[],m==="1"&&(d=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===c),d.length>0&&(n.TSI00GRIDBAND=d),this._currentConfigCompanyCode["TSI00GRIDBAND"+r]=c),d.length===0&&(d=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(_=>_.FUNCTION_ID===r&&_.COMPANY_CODE===this.DefaultConfigCompanyCode),d.length>0&&(n.TSI00GRIDBAND=d),this._currentConfigCompanyCode["TSI00GRIDBAND"+r]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDVIEWCUS&&p!=="F"&&(d=this._configInfo.TSI00GRIDVIEWCUS.getMappedRows().filter(_=>_.FUNCTION_ID===r),d.length>0&&(n.TSI00GRIDVIEWCUS=d)),this._tempSingleConfigInfo[r]=n}}return n}getSingleViewConfigInfo(r){let i={};return this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().length>0&&this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().every(n=>n.FUNCTION_ID===r?(i=n,!1):!0),i}getSingleItemConfigInfo(r,i,n){let c={};if(this._gridColumnsConfigInfo[r]===void 0&&(this._gridColumnsConfigInfo[r]={}),this._gridColumnsConfigInfo[r][i])c=this._gridColumnsConfigInfo[r][i];else{let d=[];(!n||n.trim().length===0)&&(n=e.SysInfo.CompanyCode),n||(n=this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+r]);const p=this.getConfigInfo(r);p.TSI00GRIDCOLUMN&&(d=p.TSI00GRIDCOLUMN,d.length>0&&(d.every((m,_)=>m.COMPANY_CODE===n&&m.FUNCTION_ID===r&&m.ITEM_CODE===i||m.COMPANY_CODE===this.DefaultConfigCompanyCode&&m.FUNCTION_ID===r&&m.ITEM_CODE===i?(c=m,!1):!0),Object.keys(c).length>0&&p.TSI00GRIDVIEW&&(d=p.TSI00GRIDVIEW,d.length>0&&(c.FUNCTION_TYPE=d[0].FUNCTION_TYPE))),this._gridColumnsConfigInfo[r][i]=c)}return c}getAllItemCodeArray(r){const i=[];r=this.getConfigIdbyLayoutName(r);const n=this.getConfigInfo(r);if(n.TSI00GRIDCOLUMN){const c=n.TSI00GRIDCOLUMN;c.length>0&&c.forEach(d=>{i.push(d.ITEM_CODE)})}return i}getAllConfigIdArray(){const r=[];if(this._configInfo.TSI00GRIDVIEW){const i=this._configInfo.TSI00GRIDVIEW.getMappedRows();i.length>0&&i.forEach(n=>{r.push(n.ITEM_CODE)})}return r}getItemDropDownDataSource(r,i){var d;let n=[];const c=this.getSingleItemConfigInfo(r,i);return((d=c==null?void 0:c.SVC_NAME)==null?void 0:d.trim().length)>0&&(this._configInfo[c.FUNCTION_ID+c.ITEM_CODE+o.CompanyCode]?n=this._configInfo[c.FUNCTION_ID+c.ITEM_CODE+o.CompanyCode].getMappedRows():this._configInfo[c.FUNCTION_ID+c.ITEM_CODE]?n=this._configInfo[c.FUNCTION_ID+c.ITEM_CODE].getMappedRows():this._configInfo[c.FUNCTION_ID+c.SVC_NAME]?n=this._configInfo[c.FUNCTION_ID+c.SVC_NAME].getMappedRows():this._configInfo["SI->"+c.SVC_NAME]?n=this._configInfo["SI->"+c.SVC_NAME].getMappedRows():this._configInfo["EP->"+c.SVC_NAME]?n=this._configInfo["EP->"+c.SVC_NAME].getMappedRows():this._configInfo["PM->"+c.SVC_NAME]?n=this._configInfo["PM->"+c.SVC_NAME].getMappedRows():this._configInfo[this._formName+c.SVC_NAME]?n=this._configInfo[this._formName+c.SVC_NAME].getMappedRows():this._configInfo[c.SVC_NAME]?n=this._configInfo[c.SVC_NAME].getMappedRows():this.messageError(`Can not find the data source config for [${r}.${i}]!`)),n}setDropDownBindOptions(r,i,n){var ue,me;const c=t.toString(i.DISPLAY_COLS);let d=t.toString(i.DISPLAY_CAPTIONS).trim(),p=!1;const m=t.toString(i.VALUE_MEMBER),_=t.toString(i.DISPLAY_MEMBER),E=t.toNumber(i.VALUE_POSITION),v=t.toNumber(i.DISPLAY_POSITION),A=[],B=e.Core.$t("ERX.CodeColumn")||"代码",Q=e.Core.$t("ERX.DescriptionColumn")||"描述";d.startsWith("$t(")&&d.endsWith(")")&&(d=d.substring(3,d.length-1),p=!0);let N="CODE";m.trim().length>0&&(N=m.trim());let W="CODE_DESC_1_CONTENT";_.trim().length>0&&(W=_.trim()),A.push(N,W);const J={dataValueField:"",dataTextField:"",dataSource:[],filterFields:A,columns:[{field:N,title:B,width:150},{field:W,title:Q,width:150}],codeClass:i.SVC_NAME,layoutType:r,columnConfig:i};let re=[];n&&n instanceof Function&&(n=n());const Se=n||this.getItemDropDownDataSource(i.FUNCTION_ID,i.ITEM_CODE)||[];if(c.length>0&&d.length>0){const Z=c.split(","),Te=d.split(",");if(Z.length!==Te.length)this.messageError("[DisplayColumns] array length need same to [DisplayCaptions] array length!");else{const ce=[];for(let ze=0;ze<Z.length;ze++){const Me={field:Z[ze],title:Te[ze].trim(),width:150};Me.title.startsWith("$t(")&&Me.title.endsWith(")")?Me.title=this.$t(Me.title.substring(3,Me.title.length-1)):p&&(Me.title=this.$t(Me.title)),ce.push(Me),A.push(Me.field)}m.trim().length>0&&_.trim().length>0?(N=m.trim(),W=_.trim()):(E>=0&&E<Z.length?N=Z[E]:N=Z[0],v>=0&&E<Z.length?W=Z[v]:Z.length>1?W=Z[1]:W=Z[0]),J.columns=ce,J.dropDownWidth=ce.length*150,J.dataValueField=N,J.dataTextField=W}}else if(Se.length>0){const Z=Object.keys(Se[0]);(Se[0][N]===void 0||Se[0][W]===void 0)&&(Se[0][N]===void 0&&(N=Z[0]),Se[0][W]===void 0&&(Z.length>1?W=Z[1]:W=Z[0])),J.columns=i.VALUE_VISIBLE==="1"?[{field:N,title:B,width:150},{field:W,title:Q,width:150}]:[{field:W,title:Q,width:150}],i.VALUE_VISIBLE==="1"&&A.push(N)}else m.trim().length>0&&_.trim().length>0&&(N=m.trim(),W=_.trim(),J.columns=i.VALUE_VISIBLE==="1"?[{field:N,title:B,width:150},{field:W,title:Q,width:150}]:[{field:W,title:Q,width:150}],i.VALUE_VISIBLE==="1"&&A.push(N));return i.ADD_EMPTY_ITEM==="1"&&(J.optionLabel="—-—"),i.FORMAT_TYPE==="Custom"&&((ue=i.FORMAT_STRING)==null?void 0:ue.trim().length)>0?J.displayFormat=(me=i.FORMAT_STRING)==null?void 0:me.trim():i.DISPLAY_POSITION===i.VALUE_POSITION&&t.toNumber(i.VALUE_POSITION)>=0||i.DISPLAY_MEMBER===i.VALUE_MEMBER&&i.VALUE_MEMBER.trim().length>0?J.displayFormat="{0}":i.VALUE_VISIBLE==="1"?J.displayFormat="{0}|{1}":J.displayFormat="{1}",Se&&Se instanceof Array&&(re=Se.map(Z=>({...Z,value:Z[N],label:Z[W]}))),A.push(W),J.autoWidth=!0,J.dataSource=re,J.dataValueField=N,J.dataTextField=W,J}filterDropDownCascaderDataSource(r,i,n){const c=[];if(n instanceof Array&&n.length>0?c.push(...n):e.Core.toString(n).length>0&&c.push(e.Core.toString(n)),r&&r.length>0&&i.length>0&&c.length>0){const d=i.indexOf(" like ")>=0?"like":i.indexOf(" <> ")>=0?"<>":"=",p=i.split(d);if(p.length===2){const m=p[0].trim(),_=p[1].trim(),E=[];return r.forEach(v=>{const A=e.Core.toString(v[m]).trim();if(A.length>0){for(let B=0;B<c.length;B++)if(d==="like"){if(_.startsWith("'%")&&_.endsWith("%'")&&A.indexOf(c[B])>=0){E.push(v);break}else if(_.startsWith("'%")&&A.endsWith(c[B])){E.push(v);break}else if(A.startsWith(c[B])){E.push(v);break}}else if(d==="<>"&&A!==c[B]){E.push(v);break}else if(A===c[B]){E.push(v);break}}}),E}}return r}setDropDownCascaderDataSource(r,i,n){this._dropDownCascader[r+i]&&this._dropDownCascader[r+i].length>0&&this._dropDownCascader[r+i].forEach(d=>{if(d.FUNCTION_TYPE==="F"){const p=this._dropDownBindSource[d.FUNCTION_ID][d.ITEM_CODE].dataSource,m=d.FORM_FILTER.trim(),_=this.filterDropDownCascaderDataSource(p,m,n);d.dataSource=_,this.reloadDropDownDataSource(d.FUNCTION_ID,d.ITEM_CODE,d.dataSource)}})}getDropDownCascaderDataTable(r,i,n,c){let d;return r.trim().length>0&&i.trim().length>0&&n.trim().length>0&&c.trim().length>0&&this._dropDownCascader[n.trim()+c.trim()]&&this._dropDownCascader[n.trim()+c.trim()].length>0&&this._dropDownCascader[n.trim()+c.trim()].every(p=>p.FUNCTION_ID===r.trim()&&p.ITEM_CODE===i.trim()?(d=p.dataSource,!1):!0),d}getGridStyleConfig(r){return this._gridStyleInfo[r]}setDropDownAutoFillFieldForLayout(r,i,n){n&&n instanceof Array&&(n=n.join(","));const c=this.getSingleItemConfigInfo(r,i);if(c&&c.AUTOFILL_COLS&&c.AUTOFILL_COLS.trim().length>0){const p=c.AUTOFILL_COLS.trim().split(";"),m=this.getDropDownSelectedData(r,i,n);p.forEach(_=>{if(_.trim().length>0){const E=_.split("="),v=E[0].trim().toUpperCase();let A=E[0].trim().toUpperCase();if(E.length>1&&(A=E[1].trim().toUpperCase()),m&&m instanceof Array){let B="";m.forEach(Q=>{const N=e.Core.toString(Q[v]).trim();N.length>0&&(B=B.length===0?N:B+","+N)}),this.setControlValue(r,A,B)}else this.setControlValue(r,A,m[v])}})}}setDropDownAutoFillFieldsForGrid(r,i,n){var d,p,m,_,E,v,A,B,Q,N;const c=this.getGrid(r);if(c&&((d=n==null?void 0:n.data)!=null&&d.uid)){const W=(p=c.gridOptions.context)==null?void 0:p.configId,J=(_=(m=c.gridOptions.context)==null?void 0:m.viewConfig)==null?void 0:_.AUTO_SELECT_MODE,re=this.getGridColumn(r,i);if((v=(E=re==null?void 0:re.colDef)==null?void 0:E.context)!=null&&v.columnConfig){const Se=(B=(A=re==null?void 0:re.colDef)==null?void 0:A.context)==null?void 0:B.columnConfig;let ue=[],me={};if(Se&&Se.AUTOFILL_COLS&&Se.COLUMN_EDIT!=="3"){const Z=Se.AUTOFILL_COLS;Z.length>0&&(ue=Z.split(";"),n.data[i]&&(me=this.getDropDownSelectedData(W,i,n.data[i])),ue.forEach(Te=>{if(Te.trim().length>0){const ce=Te.trim().split("="),ze=ce[0].toUpperCase().trim();let Me=ce[0].toUpperCase().trim();if(ce.length>1&&(Me=ce[1].toUpperCase().trim()),me&&me instanceof Array){let ge="";me.forEach(le=>{const Y=e.Core.toString(le[ze]).trim();Y.length>0&&(ge=ge.length===0?Y:ge+","+Y)}),n.data.set(Me,ge)}else n.data.set(Me,me[ze]);c.gridOptions.api.refreshCells({rowNodes:[n],columns:[Me,e.SysInfo.GridCheckColumnFieldName]})}}))}if(n.isSelected()&&Se.MULTI_ROW_EDIT==="1"&&J!=="1"&&J!=="3"){const Z=this.getGridOptions(W,"multiRowEdit");if(Z!==!1&&Z!=="0")if(((N=(Q=c.gridOptions.context)==null?void 0:Q.options)==null?void 0:N.multiRowEditType)==="all"){const Te=this.getGridSelectRows(c);(Te==null?void 0:Te.length)>0&&Te.forEach(ce=>{n.data.uid!==ce.uid&&ue.forEach(ze=>{if(ze.trim().length>0){const Me=ze.trim().split("="),ge=Me[0].toUpperCase().trim();let le=Me[0].toUpperCase().trim();if(Me.length>1&&(le=Me[1].toUpperCase().trim()),ce){if(me&&me instanceof Array){let Y="";me.forEach(Fe=>{const ke=e.Core.toString(Fe[ge]).trim();ke.length>0&&(Y=Y.length===0?ke:Y+","+ke)}),ce.set(le,Y)}else ce.set(le,me[ge]);c.gridOptions.api.refreshCells({rowNodes:[n],columns:[le,e.SysInfo.GridCheckColumnFieldName]})}}})})}else{const Te=[];c.gridOptions.api.forEachNodeAfterFilter(ce=>{var ze;ce!=null&&ce.selected&&((ze=ce.data)!=null&&ze.uid)&&ce.data.uid!==n.data.uid&&Te.push(ce)}),(Te==null?void 0:Te.length)>0&&Te.forEach(ce=>{n.data.uid!==ce.data.uid&&ue.forEach(ze=>{if(ze.trim().length>0){const Me=ze.trim().split("="),ge=Me[0].toUpperCase().trim();let le=Me[0].toUpperCase().trim();if(Me.length>1&&(le=Me[1].toUpperCase().trim()),me&&me instanceof Array){let Y="";me.forEach(Fe=>{const ke=e.Core.toString(Fe[ge]).trim();ke.length>0&&(Y=Y.length===0?ke:Y+","+ke)}),ce.data.set(le,Y)}else ce.data.set(le,me[ge]);c.gridOptions.api.refreshCells({rowNodes:[n],columns:[le,e.SysInfo.GridCheckColumnFieldName]})}})})}}}}}addDropDownCode(r,i,n,c="push"){var d,p;if((r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0&&(n==null?void 0:n.length)>0&&this._dropDownBindSource[r.trim()]&&this._dropDownBindSource[r.trim()][i.trim()]){const m=this._dropDownBindSource[r.trim()][i.trim()];if(m.dataSource!==void 0&&m.dataSource instanceof Array){c==="unshift"?m.dataSource.unshift(...n):m.dataSource.push(...n);const _=this.getSingleItemConfigInfo(r,i);if(_.FUNCTION_TYPE==="F")this._dropDownRefreshKey[r][i]=t.guid(),this.setControlEmptyValue(r,i);else if(_.FUNCTION_TYPE==="G"||_.FUNCTION_TYPE==="P"){const E=this.getGridColumn(r,i);if(E.colDef){this.setGridColumnDropdown(r,E.colDef,m.dataSource,(d=E.colDef.context)==null?void 0:d.valueField,(p=E.colDef.context)==null?void 0:p.textField,m.displayFormat);const v=this.getGridApi(r);v==null||v.refreshCells({columns:[E.colId]})}}}}}async reloadDropDownDataSource(r,i,n){var c,d,p,m;if((r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0){const _=this.getSingleItemConfigInfo(r,i);if(_){let E=[];if(n&&n instanceof Function&&(n=n()),n instanceof ut.EiBlock)E=n.getMappedRows();else if(n instanceof Array)E=n;else if(_.ORIGIN_CODE==="2"&&_.SVC_NAME.trim().length>0){const A=await this.queryDataByDataSource(_.SVC_NAME.trim());e.Core.toNumber((c=A.SysInfo)==null?void 0:c.Flag)>=0&&(E=A.getBlockByIndex(0).getMappedRows())}const v=this.setDropDownBindOptions(_.FUNCTION_TYPE,_,E);if(this._dropDownBindSource[r.trim()]=this._dropDownBindSource[r.trim()]||{},this._dropDownBindSource[r.trim()][i.trim()]=v,_.FUNCTION_TYPE==="F"){const A=this.getControlValue(r,i);A&&!((d=v==null?void 0:v.dataSource)!=null&&d.some(B=>B[v.dataValueField]===A))&&this.setControlEmptyValue(r,i)}else if(_.FUNCTION_TYPE==="G"||_.FUNCTION_TYPE==="P"){const A=this.getGridColumn(r,i);if(A!=null&&A.colDef){this.setGridColumnDropdown(r,A.colDef,E,(p=A.colDef.context)==null?void 0:p.valueField,(m=A.colDef.context)==null?void 0:m.textField,v.displayFormat);const B=this.getGridApi(r);B==null||B.refreshCells({columns:[A.colId]})}}this._dropDownRefreshKey[r][i]=t.guid()}}}createDataSet(){var n,c,d,p;const r=[];let i="";this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(m=>{var _,E,v;if(((_=m.TABLE_NAME)==null?void 0:_.trim().length)>0&&((E=m.DATASET_NAME)==null?void 0:E.trim().length)>0){const A={};m.FUNCTION_TYPE==="T"&&((v=m.CURRENT_NODE_DESC)==null?void 0:v.trim().length)>0&&m.FATHER_NODE_DESC.trim().length>0&&(A.hierarchy={primaryField:m.CURRENT_NODE_DESC.trim(),parentField:m.FATHER_NODE_DESC}),this.createDataTable(m.TABLE_NAME.trim(),A)&&r.push({tableName:m.TABLE_NAME.trim()}),i=m.DATASET_NAME.trim()}}),((d=(c=(n=this._configInfo)==null?void 0:n.TSI00DATARELATION)==null?void 0:c.getMappedRows())==null?void 0:d.length)>0&&this._configInfo.TSI00DATARELATION.getMappedRows().forEach(m=>{r.findIndex(_=>_.tableName===m.RESERVE1)>=0&&r.findIndex(_=>_.tableName===m.RESERVE7)>=0&&(this._formDataSet.relations[m.RELATION_NAME]=this._formDataSet.relations[m.RELATION_NAME]||[],this._formDataSet.relations[m.RELATION_NAME].push({ParentTable:m.RESERVE1,ChildTable:m.RESERVE7,ParentColumn:m.RESERVE2,ChildColumn:m.RESERVE8}))}),(p=this._formDataSet)==null||p.setName(i)}createDataTable(r,i){var d,p,m,_,E,v,A;let n;const c={...i};if(r.trim().length>0&&!this._formDataSet.dataTables[r.trim()]){const B={};((p=(d=this._configInfo.TSI00DATATABLE)==null?void 0:d.getMappedRows())==null?void 0:p.length)>0&&this._configInfo.TSI00DATATABLE.getMappedRows().forEach(Q=>{if(Q.TABLE_NAME===r.trim()){const N={name:Q.COL_NAME,caption:Q.COL_CAPTION,maxLength:Q.MAX_LENGTH};switch(Q.DATA_TYPE){case"2":N.type="number",N.defaultValue=t.toNumber(Q.DEFAULT_VALUE);break;case"3":N.type="datetime",N.defaultValue=t.getDateTimeByString(Q.DEFAULT_VALUE,"Dayjs");break;case"4":N.type="boolean",N.defaultValue=t.toBoolean(Q.DEFAULT_VALUE);break;default:N.type="string",N.defaultValue=t.getSystemFormatString(Q.DEFAULT_VALUE).trim();break}B[Q.COL_NAME]=N}}),Object.keys(B).length>0&&(B[o.IdFieldName]={name:o.IdFieldName,type:"string"},c.schema=B,n=new S(c),this._formDataSet.addDataTable(r.trim(),n))}else n=(m=this._formDataSet)==null?void 0:m.dataTables[r.trim()],c.schema=(_=n==null?void 0:n.options)==null?void 0:_.schema,c.hierarchy=c.hierarchy||((E=n==null?void 0:n.options)==null?void 0:E.hierarchy);return(v=i==null?void 0:i.hierarchy)!=null&&v.primaryField&&((A=i==null?void 0:i.hierarchy)!=null&&A.parentField)&&(c.schema[i.hierarchy.primaryField]===void 0&&console.error(`ER: Hierarchy DataTable's PrimaryField [${i.hierarchy.primaryField}] not exists!`),c.schema[i.hierarchy.parentField]===void 0&&console.error(`ER: Hierarchy DataTable's ParentField [${i.hierarchy.parentField}] not exists!`)),n||console.error(`ER: DataTable [${r}] creation failed!`),n}getTableName(r){var i;return(i=this._formDataSet)==null?void 0:i.getTableName(r)}getBindingTableName(r){let i="";return r.trim().length>0&&this._formBindingRelation[r.trim()]&&(i=this._formBindingRelation[r.trim()]),i}setBindingTableName(r){var c;let i="";const n=this.getSingleViewConfigInfo(r.trim());return n&&n.TABLE_NAME&&n.TABLE_NAME.trim().length>0&&((c=this._formDataSet)!=null&&c.contains(n.TABLE_NAME.trim()))&&(i=n.TABLE_NAME.trim(),this._formBindingRelation[r]=i),i}getBindingTable(r){var c;let i;const n=this.getBindingTableName(r);return n&&n.trim().length>0&&(i=(c=this._formDataSet)==null?void 0:c.dataTables[n]),i}getBindingTableAsBlock(r){let i;const n=this.getBindingTable(r);return n&&n instanceof S&&(i=n.data(),i&&(i=this.convertDataType(i,n,"weakly"))),t.buildEiBlock(i||{},"Table0")}hasDataChange(...r){let i=!1;return r.length===0?r=Object.keys(this._formBindingRelation):r.length===1&&(r=r[0].split(",")),r.forEach(n=>{const c=this.getBindingTable(n);if(c&&c instanceof S)if(!i)i=c.hasChanges();else return i}),i}cancelGridChange(r){var n,c;const i=this.getGrid(r);if(i){const d=(c=(n=i.gridOptions)==null?void 0:n.context)==null?void 0:c.bindingSource;d&&d instanceof e.DataTable&&d.cancelChanges()}return this}mergeDataToLayoutOrGrid(r,i=!0,...n){var c,d,p,m;if(this.isNullOrEmpty(n)?n=Object.keys(this._formBindingRelation):n.length===1&&n[0]&&typeof n[0]=="string"&&(n=n[0].split(",")),n.length>0){if(n.length===1&&n[0].trim().length>0){const _=this.getBindingTableName(n[0]);(_==null?void 0:_.trim().length)>0&&(r instanceof ut.EiBlock?(c=this._formDataSet)==null||c.mergeData(_.trim(),r.getMappedRows(),i):r instanceof ut.EiInfo?r.getBlock(_.trim())?(d=this._formDataSet)==null||d.mergeData(_.trim(),r.getBlock(_.trim()).getMappedRows(),i):Object.keys(r).length>0&&((p=this._formDataSet)==null||p.mergeData(_.trim(),r.getBlockByIndex(0).getMappedRows(),i)):r instanceof Array&&r&&r.length>0&&((m=this._formDataSet)==null||m.mergeData(_.trim(),r,i)),this.autoBestFit(n[0]))}else if(r instanceof ut.EiInfo){const _={};n.forEach(E=>{var A;const v=this.getBindingTableName(E);(v==null?void 0:v.trim().length)>0&&r.getBlock(v.trim())&&(_[v]||((A=this._formDataSet)==null||A.mergeData(v.trim(),r.getBlock(v.trim()).getMappedRows(),i),_[v]=!0),this.autoBestFit(E))})}}return this}checkFormChanged(...r){return new Promise(i=>{this.hasDataChange(...r)?this.messageConfirm(e.Core.$t("ERX.ContinueToOperate")||"是否继续操作?").then(n=>{i(n)}).catch(()=>{i(!1)}):i(!0)})}addRowToGrid(r,i=!0,n="default",c=!1){var m,_,E,v,A,B;let d;const p=this.getGrid(r);if((m=p==null?void 0:p.gridOptions.context)!=null&&m.bindingSource){let Q={};n==="default"&&(n=this.getGridOptions(r,"insertAtTop")||"default"),n==="default"&&(n=((v=(E=(_=p==null?void 0:p.gridOptions)==null?void 0:_.context)==null?void 0:E.options)==null?void 0:v.insertAtTop)||"default");const N=this.getGridOptions(r,"autoGuidField");(i===!0||(i==null?void 0:i.setDefaultValue)===!0)&&(Q=this.getGridConfigDefaultValues(r)||{}),this._customDefaultValues[r]&&(Q={...Q,...this._customDefaultValues[r]}),i!=null&&i.data&&(Q={...Q,...i.data});const W=(A=p.gridOptions.context)==null?void 0:A.bindingSource;if(n===!0||n==="top")d=W.insert(0,Q,N);else if(n==="afterCurrent"||n==="beforeCurrent"){const J=this.getGridCurrentRow(r);if(J){let re=W.indexOf(J);re>=0&&re<W.rowCount&&n==="afterCurrent"?re=re+1:re>0&&n==="beforeCurrent"&&(re=re-1),d=W.insert(re,Q,N)}else d=W.add(Q,N)}else typeof n=="number"&&n>=0?d=W.insert(n,Q,N):d=W.add(Q,N);d[o.IdFieldName]=t.guid(),(B=p==null?void 0:p.gridOptions)!=null&&B.treeData&&(d[o.TreeHierarchyFieldName]=[d[o.IdFieldName]])}return d}addCopyRowToGrid(r,i="default",n=!1){var p,m,_;const c=this.getGrid(r);let d;if(c){i==="default"&&(i=this.getGridOptions(r,"insertAtTop")||"default"),i==="default"&&(i=((_=(m=(p=c==null?void 0:c.gridOptions)==null?void 0:p.context)==null?void 0:m.options)==null?void 0:_.insertAtTop)||"default"),(c==null?void 0:c.gridOptions.api).stopEditing();const v=this.getGridSelectRows(c);if(v.length===0){const A=this.getGridCurrentRow(c);A&&v.push(A)}if(v.length===0)d=[this.addRowToGrid(r,!0,i,n)];else{const A=this.getGridBindingTable(r);if(A){let B=-1;i==="top"||i===!0?B=0:i==="afterCurrent"||i==="default"?(B=A.indexOf(v[v.length-1]),B<A.rowCount&&(B=B+1)):i==="beforeCurrent"?(B=A.indexOf(v[0]),B>0&&(B=B-1)):typeof i=="number"&&i>=0&&(B=i),d=A.import(v,B,!0,this.getGridOptions(r,"autoGuidField"))}}}return d}importRowsToGrid(r,i,n=!1,c=!0){var m,_;let d;const p=this.getGrid(r);if((m=p==null?void 0:p.gridOptions.context)!=null&&m.bindingSource){p==null||p.gridOptions.api;const E=(_=p.gridOptions.context)==null?void 0:_.bindingSource;E&&(d=E.import(i,void 0,c))}return d}getGridAggregates(r){var n;let i;if(r){const c=this.getGrid(r);if(c){const d=c.gridOptions.api.getModel();i=(n=d==null?void 0:d.rootNode)==null?void 0:n.aggData}}return i}getModelFromGridOrLayout(r,i,n=!1,c){const d=this.getBindingTable(r);return this.getModelFromDataTable(d,i,n,c)}getModelFromGridOrLayoutAsBlock(r,i,n){const c=this.getModelFromGridOrLayout(r,i,!0,n);return this.buildEiBlock([c])}getModelFromDataTable(r,i,n=!1,c){let d;return typeof r=="string"&&r.trim().length>0&&(r=this.getBindingTable(r)),r&&r instanceof e.DataTable&&(i&&i.trim().length>0?d=r.get(i.trim()):(d=r.at(0),d=l.reactive(d))),d&&(n instanceof Function?d=n(d)||d.toJSON():d=n?d.toJSON():d,c&&Object.keys(c).forEach(p=>{d[p]=c[p]})),d}getGridDataCount(r){let i=0;const n=this.getGridConfigId(r);if(n){const c=this.getBindingTable(n);c&&c instanceof e.DataTable&&(i=c.totalCount())}return i}getModelFromDataTableById(r,i,n=!1){var d;let c;return typeof r=="string"&&r.trim().length>0&&this._formBindingRelation[r.trim()].trim().length>0&&(r=(d=this._formDataSet)==null?void 0:d.dataTables[this._formBindingRelation[r.trim()]]),r&&r instanceof S&&i&&i.trim().length>0&&(c=r.get(i.trim()),c&&(n instanceof Function?c=n(c)||c.toJSON():c=n?c.toJSON():c)),c}convertModelAsBlock(r,i){let n={};return r&&(n=r.toJSON(i)),this.buildEiBlock([n])}addModelToLayout(r,i,n){let c;if((r==null?void 0:r.trim().length)>0){const d=this.getBindingTable(r.trim());if(d){d instanceof S&&(c=d.add({}));const p=this.getRelationConfigIdsByTableName(d.tableName);i&&this.setModelDefalutValue(c,p),c=this.getLayoutBindModel(r)}else console.error("ER: Attempting to add model to a non-existent dataTable, configId: "+r)}return c}getDataFromDataTableAsBlock(r,i=0,n){let c;if(r){let p;typeof r=="string"?p=this.getBindingTable(r):p=r,p&&(c=r.at(i)),c=this.convertDataType([c],p,"weakly"),c={...c,...n}}return t.buildEiBlock(c||{},"Table0")}convertDataType(r,i,n){return t.convertDataType(r,i,n)}getModelFields(r){var i;return(i=r==null?void 0:r.options)==null?void 0:i.schema}getControlName(r,i,n){let c="antInput";switch(r){case"F1":case"G3":c="antInputGroup";break;case"FB":c="antRadioGroup";break;case"FJ":c="erRadioGroup";break;case"FK":c="erCheckboxGroup";break;case"F7":case"FA":case"FP":case"G1":case"GP":case"F6":case"FC":case"G2":c="erSelect";break;case"FD":c="erMultiSelect";break;case"F3":case"G4":case"GD":c="antMultiSelect";break;case"FL":c="erTreeSelect";break;case"FH":c="erMultiTreeSelect";break;case"F2":case"F9":case"FG":c="antInputNumber";break;case"F4":c="antCheckbox";break;case"FW":c="antSwitch";break;case"FM":c="scriptEditor";break;case"F5":t.toNumber(n==null?void 0:n.MAX_LENGTH)===2?c="antTimePicker":t.toNumber(n==null?void 0:n.MAX_LENGTH)===4?i.toLowerCase()==="hh:mm"?c="antTimePicker":c="antYearPicker":t.toNumber(n==null?void 0:n.MAX_LENGTH)===6?i.toLowerCase()==="hh:mm:ss"?c="antTimePicker":c="antMonthPicker":t.toNumber(n==null?void 0:n.MAX_LENGTH)===8?c="antDatePicker":c="antDateTimePicker";break;case"F8":case"G8":c="antTextarea";break;case"FE":case"G5":c="erMemoEditor";break;case"FN":c="antButton";break;case"FS":c="label";break;case"FT":c="antDivider";break;default:c="antInput";break}return c}resetValidator(r){let i=[];r&&(r instanceof Array?i=r:i=r.split(",")),i.length===0&&(i=this.getAllConfigIdArray());for(let n=0;n<i.length;n++){if(i[n].trim().length===0)continue;const c=this.getLayoutBindForm(i[n]);c==null||c.clearValidate()}}getLayoutLabelSpan(r,i){return t.jQuery("#"+this._formId+r+i+"_span")}getLayoutJqueryElement(r,i){let n;return n=t.jQuery("#"+this._formId+r+i),n===void 0&&(n=t.jQuery("#"+r)),n}autoBestFit(r){var n,c,d,p,m;const i=this.getGrid(r);if(i&&this.isGridOnScreen(i)){const _=(c=(n=i.gridOptions.columnApi)==null?void 0:n.columnModel)==null?void 0:c.gridColumns;(_==null?void 0:_.length)>0&&((m=(p=(d=r==null?void 0:r.gridOptions)==null?void 0:d.context)==null?void 0:p.viewConfig)==null?void 0:m.BESTFIT)==="1"&&_.forEach(E=>{E.visible&&!E.colDef.suppressSizeToFit&&i.gridOptions.columnApi.autoSizeColumn(E)})}return this}getGrid(r){var n,c;let i;return r&&typeof r=="string"&&this._gridInstanceInfo[r]!==void 0&&(r=this._gridInstanceInfo[r]),(n=r==null?void 0:r.gridOptions)!=null&&n.api&&((c=r==null?void 0:r.gridOptions)!=null&&c.columnApi)&&(i=r),i}getGridApi(r){var i,n;return(n=(i=this.getGrid(r))==null?void 0:i.gridOptions)==null?void 0:n.api}isGridOnScreen(r){const i=this.getGrid(r);return i?t.isGridOnScreen(i):!1}getGridColumnApi(r){var i,n;return(n=(i=this.getGrid(r))==null?void 0:i.gridOptions)==null?void 0:n.columnApi}getGridConfig(r){var i,n,c;return(c=(n=(i=this.getGrid(r))==null?void 0:i.gridOptions)==null?void 0:n.context)==null?void 0:c.viewConfig}getGridColumn(r,i){const n=this.getGrid(r);return t.getGridColumn(n,i)}getGridColumnDef(r,i){const n=this.getGrid(r);return t.getGridColumnDef(n,i)}showGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=i.split(","),c.length>0){const d=[];c.forEach(p=>{d.push({colId:p,hide:!1})}),n.gridOptions.columnApi.applyColumnState({state:d})}}return this}hideGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=i.split(","),c.length>0){const d=[];c.forEach(p=>{d.push({colId:p,hide:!0})}),n.gridOptions.columnApi.applyColumnState({state:d})}}return this}showGridCheckColumn(r){return this.showOrHideGridCheckColumn(r,"show")}hideGridCheckColumn(r){return this.showOrHideGridCheckColumn(r,"hide")}showOrHideGridCheckColumn(r,i="default"){var c,d,p,m;const n=this.getGrid(r);if((c=n==null?void 0:n.gridOptions)!=null&&c.api){const _=n.gridOptions.api,E=_.getColumnDef(o.GridCheckColumnFieldName);E&&(i==="hide"?(E.checkboxSelection=void 0,E.headerCheckboxSelection=void 0):(i==="show"||((d=n.gridOptions.context)==null?void 0:d.viewConfig.SHOW_SELECTION)==="1")&&(E.checkboxSelection=v=>!v.node.footer,this.getGridOptions((m=(p=n.gridOptions)==null?void 0:p.context)==null?void 0:m.configId,"RowSelection",!0)==="multiple"?E.headerCheckboxSelection=!0:E.headerCheckboxSelection=void 0),_.redrawRows(),_.refreshHeader())}return this}setGridSelectMode(r,i,n="none"){var d,p;const c=this.getGrid(r);return c&&(this.setGridOptions((p=(d=c.gridOptions)==null?void 0:d.context)==null?void 0:p.configId,"RowSelection",i,!0),this.setGridColumnOptions(c,m=>{var _;m.colId===o.GridCheckColumnFieldName&&(n==="show"||n==="hide"||i==="multiple")&&(n==="hide"?(m.checkboxSelection=void 0,m.headerCheckboxSelection=void 0):i==="multiple"?(m.checkboxSelection=E=>!E.node.footer,m.headerCheckboxSelection=n==="show"||((_=c.gridOptions.context)==null?void 0:_.viewConfig.SHOW_SELECTION)==="1"):i==="single"&&(m.headerCheckboxSelection=void 0))})),this}setGridRowDrag(r,i="default"){var c,d,p,m;const n=this.getGrid(r);if((c=n==null?void 0:n.gridOptions)!=null&&c.api){const E=n.gridOptions.api.getColumnDef(o.GridCheckColumnFieldName);E&&(i===!1?(E.rowDrag=void 0,(d=n==null?void 0:n.gridOptions)==null||d.columnApi.setColumnWidth(E.colId,55)):(i===!0||(p=n.gridOptions.context)!=null&&p.allowDragRow)&&(n.gridOptions.context.allowDragRow=!0,(m=n==null?void 0:n.gridOptions)==null||m.columnApi.setColumnWidth(E.colId,75),E.rowDrag=v=>{var A;return((A=v.context)==null?void 0:A.allowDragRow)&&!v.node.group&&!v.node.footer}),n.gridOptions.rowDragManaged=i),n.gridOptions.api.redrawRows()}return this}addGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=[i],c.length>0){const d=n.gridOptions.context.bindingSource,p=n.gridOptions.api.getColumnDefs()||[];c.forEach(m=>{var _;if(((_=m.field)==null?void 0:_.trim().length)>0){m.field=m.field.trim();const E={name:m.field,capiton:m.headerName,defaultValue:m.defaultValue,type:m.dataType||m.type||"string",maxLength:m.maxLength||-1};d.addField(E),m.colId=m.colId||m.field,n.gridOptions.api.getColumnDef(m.colId)||(m.headerComponentParams={template:`${this.getGridHeaderTemplate({color:m.headerTextColor,backColor:m.headerBackColor,fontSize:m.fontSize,title:m.headerName||m.title||m.caption})}`},m.headerClass=()=>{var A,B,Q,N,W;let v="er-grid-header-align-center";return((A=m.headerAlignment)==null?void 0:A.toLowerCase())==="near"||((B=m.headerAlignment)==null?void 0:B.toLowerCase())==="left"?v="er-grid-header-align-left":(((Q=m.headerAlignment)==null?void 0:Q.toLowerCase())==="far"||((N=m.headerAlignment)==null?void 0:N.toLowerCase())==="right")&&(v="er-grid-header-align-right"),m.required&&((W=m.requiredCondition)==null?void 0:W.trim().length)>0?v=v+" er-grid-header-maroon-star":m.required&&(v=v+" er-grid-header-red-star"),v},m.editable=m.editable===void 0?!0:m.editable,m.autoHeaderHeight=m.autoHeaderHeight===void 0?!0:m.autoHeaderHeight,m.enableRowGroup=m.enableRowGroup===void 0?!0:m.enableRowGroup,typeof m.editable!="function"&&(m.context=m.context||{},m.context.editable=m.editable,m.headerTooltip=m.headerName||m.title||m.caption,m.editable=v=>{var A,B;return((A=v.context)==null?void 0:A.editable)&&((B=v.colDef.context)==null?void 0:B.editable)&&!v.node.rowPinned}),m.filter=m.filter===void 0?"agSetColumnFilter":m.filter,m.filterParams={excelMode:"windows"},p.push(m))}}),n.gridOptions.api.setColumnDefs(p)}}return this}removeGridColumn(r,i){const n=this.getGrid(r);if(n){let c;if(i instanceof Array?c=i:c=i.split(","),c.length>0){let d=n.gridOptions.api.getColumnDefs()||[];d=d.filter(p=>!c.includes(p.colId)),n.gridOptions.api.setColumnDefs(d)}}return this}getGridColumnFields(r,i="string"){var d,p,m;const n=this.getGrid(r);let c=i==="Array"?[]:void 0;if((p=(d=n==null?void 0:n.gridOptions)==null?void 0:d.context)!=null&&p.configId){const _=this.getConfigInfo(n.gridOptions.context.configId);((m=_==null?void 0:_.TSI00GRIDCOLUMN)==null?void 0:m.length)>0&&_.TSI00GRIDCOLUMN.forEach(E=>{E.FIELD_NAME.trim().length>0&&E.UNBOUND_TYPE==="0"&&(i==="Array"?c.push(E.FIELD_NAME.trim()):c=c?c+","+E.FIELD_NAME.trim():E.FIELD_NAME.trim())})}return c}setGridEnable(r,i){var c,d,p;const n=this.getGrid(r);return(c=n==null?void 0:n.gridOptions)!=null&&c.context&&(n.gridOptions.api.stopEditing(),n.gridOptions.context.enable=i,(p=(d=n==null?void 0:n.gridOptions)==null?void 0:d.context)!=null&&p.configId&&(this.setGridOptions(n.gridOptions.context.configId,"enable",i,!0),document.querySelectorAll(".ag-full-width-row").forEach(_=>{_.style!==void 0&&(i?_.style.pointerEvents="all":_.style.pointerEvents="none")}))),this}setGridEditable(r,i){var c,d,p;const n=this.getGrid(r);return(c=n==null?void 0:n.gridOptions)!=null&&c.context&&(n.gridOptions.api.stopEditing(),n.gridOptions.context.editable=i,(p=(d=n==null?void 0:n.gridOptions)==null?void 0:d.context)!=null&&p.configId&&this.setGridOptions(n.gridOptions.context.configId,"editable",i,!0)),this}setGridIndicator(r,i,n){if(r&&i&&Object.keys(i).length>0){const c=this.getGrid(r);setTimeout(()=>{var d,p,m,_,E,v,A;if((d=c==null?void 0:c.gridOptions)!=null&&d.api&&((m=(p=c==null?void 0:c.gridOptions)==null?void 0:p.context)!=null&&m.bindingSource)){const B=(_=c==null?void 0:c.gridOptions)==null?void 0:_.api,N=((v=(E=c==null?void 0:c.gridOptions)==null?void 0:E.context)==null?void 0:v.bindingSource).data().find(W=>{for(const J in i)if(W[J]!==i[J])return!1;return!0});if(N!=null&&N.uid){B.clearFocusedCell();const W=(A=c==null?void 0:c.gridOptions)==null?void 0:A.api.getRowNode(N==null?void 0:N.uid);W&&this.setGridFocusedCell(r,W.rowIndex,e.SysInfo.GridCheckColumnFieldName,n)}}},250)}return this}refreshGridFooterData(r){var n,c,d;const i=this.getGrid(r);if((n=i==null?void 0:i.gridOptions)!=null&&n.api){const p=(c=i==null?void 0:i.gridOptions)==null?void 0:c.api;if(p.getPinnedBottomRowCount()>0){p.refreshClientSideRowModel("aggregate");const m=p.getModel();p.setPinnedBottomRowData([{...(d=m==null?void 0:m.rootNode)==null?void 0:d.aggData,pinndeRowType:"ErGridSummaryFooter"}])}}return this}setLayoutConfigRelationInfo(r,i){return this._layoutConfigRelationInfo[i]=r,this}getConfigIdbyLayoutName(r){return this._layoutConfigRelationInfo[r]&&this._layoutConfigRelationInfo[r].trim().length>0?this._layoutConfigRelationInfo[r].trim():r}getGridConfigId(r){let i="";return r&&(typeof r=="string"&&this._gridInstanceInfo[r]!==void 0?i=r:r.gridOptions&&r.gridOptions.api&&(i=r.gridOptions.gridId)),i}setWidgetInstanceInfo(r,i,n){return this.isNullOrEmpty(r)||(this._widgetInstanceInfo[r.trim()]===void 0&&(this._widgetInstanceInfo[r.trim()]={}),!this.isNullOrEmpty(i)&&n&&(this._widgetInstanceInfo[r.trim()][i.trim()]=n)),this}setControlVisible(r,i,n,c="none"){return!this.isNullOrEmpty(r)&&(n==null?void 0:n.trim().length)>0&&(r=this.getConfigIdbyLayoutName(r),n.split(",").forEach(p=>{p.trim().length>0&&(c==="empty"?this.setControlEmptyValue(r,p):c==="default"&&this.setControlDefalutValue(r,p),this.setLayoutItemOption(r,p.trim(),{visible:i}))})),this}setGridColumnTitle(r,i){if((i==null?void 0:i.length)>0){const n=this.getGrid(r);n&&(i.forEach(c=>{var p;const d=n.gridOptions.columnApi.getColumn(c.colId);if(d!=null&&d.colDef){const m=((p=d.colDef.context)==null?void 0:p.titleInfo)||{};d.colDef.headerComponentParams={template:`${this.getGridHeaderTemplate({...m,...c})}`}}}),n.gridOptions.api.refreshHeader())}return this}setGridColumnOptions(r,i){if(r&&i instanceof Function){const n=this.getGrid(r);if(n){const c=n.gridOptions.api.getColumnDefs();c.forEach(d=>{i(d)}),n.gridOptions.api.setColumnDefs(c)}}return this}setGridOptions(r,i,n,c=!1){return r=(r==null?void 0:r.trim())||"",i=(i==null?void 0:i.trim())||"",r.length>0&&i.length>0&&(c?(this._gridReactiveOptions[r]=this._gridReactiveOptions[r]||{},this._gridReactiveOptions[r][i]=n):(this._gridOptions[r]=this._gridOptions[r]||{},this._gridOptions[r][i]=n)),this}getGridOptions(r,i,n=!1){if(r=(r==null?void 0:r.trim())||"",i=(i==null?void 0:i.trim())||"",r.length>0&&i.length>0){if(n&&this._gridReactiveOptions[r])return this._gridReactiveOptions[r][i];if(!n&&this._gridOptions[r])return this._gridOptions[r][i]}}getLayoutExtentedOptions(r){var d,p;let i={};const n=this.getFormSysInfo("LayoutDefaultOptions");n.trim().length>0&&(i={...JSON.parse(n)});const c=this.getConfigInfo(r);if(((d=c==null?void 0:c.TSI00GRIDVIEW)==null?void 0:d.length)>0){const m=c.TSI00GRIDVIEW[0];if(((p=m.EXT_OPTIONS)==null?void 0:p.trim().length)>0){const _=JSON.parse(m.EXT_OPTIONS);i={...i,..._}}}return i}getGridExtentedOptions(r){var d,p;let i={};const n=this.getFormSysInfo("GridDefaultOptions");n.trim().length>0&&(i={...JSON.parse(n)});const c=this.getConfigInfo(r);if(((d=c==null?void 0:c.TSI00GRIDVIEW)==null?void 0:d.length)>0){const m=c.TSI00GRIDVIEW[0];if(((p=m.EXT_OPTIONS)==null?void 0:p.trim().length)>0){const _=JSON.parse(m.EXT_OPTIONS);i={...i,..._}}}return i}getDetailGridRenderOptions(r,i,n,c){const d=this.getGridConfigOptions(r,i,n,c);return{context:d==null?void 0:d.context,defaultColDef:d==null?void 0:d.defaultColDef,groupDisplayType:d==null?void 0:d.groupDisplayType,columnDefs:d==null?void 0:d.columnDefs,groupIncludeTotalFooter:d==null?void 0:d.groupIncludeTotalFooter,groupIncludeFooter:d==null?void 0:d.groupIncludeFooter,suppressRowClickSelection:d==null?void 0:d.suppressRowClickSelection,rowSelection:d==null?void 0:d.rowSelection,groupRowRendererParams:d==null?void 0:d.groupRowRendererParams,localeText:Ci(),enableRangeSelection:!0,stopEditingWhenCellsLoseFocus:!0,suppressRowTransform:!0,enableRtl:Ta(),statusBar:{statusPanels:[{statusPanel:"agAggregationComponent",align:"center"},{statusPanel:"agTotalAndFilteredRowCountComponent",align:"right"}]},getRowId:m=>m.data.uid,getRowStyle:m=>this.getRowStyle(m,{showDefaultFooter:!0}),getMainMenuItems:m=>this.getGridMenuItems(m),getContextMenuItems:m=>this.getGridContextMenuItems(m),onGridReady:m=>m.api.setPopupParent(document.querySelector("body")),onRowSelected:m=>this.processRowSelectedEvent(m)}}getGridEditable(r){var n,c;const i=this.getGrid(r);return((c=(n=i==null?void 0:i.gridOptions)==null?void 0:n.context)==null?void 0:c.editable)===!0}getControl(r,i,n){let c;if(this._widgetInstanceInfo[r.trim()]&&this._widgetInstanceInfo[r.trim()][i.trim()]&&(c=this._widgetInstanceInfo[r.trim()][i.trim()]),c==null)if(n&&n.trim().length>0)c=t.jQuery("#"+this._formId+r+i);else{const d=this.getSingleItemConfigInfo(r,i);if(d.FUNCTION_TYPE&&d.COLUMN_EDIT){const p=d.FUNCTION_TYPE+d.COLUMN_EDIT;n=this.getControlName(p,d.FORMAT_STRING),c=t.jQuery("#"+this._formId+r+i)}}return c}isControlEmptyValue(r,i,n){let c=!0;const d=this.getControlValue(r,i),p=Object.keys(d);for(let m=0;m<p.length;m++)if(d[p[m]]!==null&&String(d[p[m]]).trim().length>0){c=!1;break}return c}setControlConditionProps(r,i,n="ReadOnly",c,d){if(n=(n==null?void 0:n.trim())||"ReadOnly",(r==null?void 0:r.trim().length)>0){const p=r.trim()+"_"+n+"_"+(i==null?void 0:i.trim());let m=[];if(this._controlConditionProps[p])m=this._controlConditionProps[p];else if(this._configInfo.TSI00GRIDCONDITION&&this._configInfo.TSI00GRIDCONDITION.getMappedRows().length>0){const _=this.getSingleViewConfigInfo(r==null?void 0:r.trim());if(_)for(let E=0;E<this._configInfo.TSI00GRIDCONDITION.getMappedRows().length;E++){const v=this._configInfo.TSI00GRIDCONDITION.data[E];if(t.toString(v.FUNCTION_ID,!0)!==r||(i==null?void 0:i.trim().length)>0&&t.toString(v.OPERATE_NAME,!0)!==(i==null?void 0:i.trim())||_.MATCH_FLAG==="1"&&t.toString(v.COMPANY_CODE,!0)!==o.CompanyCode||t.toString(v.FIELD_NAME_ARRAY,!0).length===0)continue;const A=t.toString(v.FIELD_NAME_ARRAY,!0).split(",");v.FIELD_NAME_ARRAY=A,m.push(v)}}if(m.length>0){this._controlConditionProps[p]=m;const _=this.getAllControlValue(r);m.forEach(E=>{const v=E.FIELD_NAME_ARRAY;let A=c??E.PROP_VALUE??"default";v.forEach(B=>{if(B&&!(d!=null&&d.includes(B))){const Q=t.toString(E.REGULAR_EXPRESS,!0),N=Q.length===0||Q.replaceAll(" ","")==="1=1"||t.checkExpressionValid(_,t.getSystemFormatString(Q));A=A==!0||A==="1"||t.toString(A).toLowerCase()==="true",n==="ReadOnly"&&this.setControlReadOnly(r,N?A:"default",B)}})})}}return this}getControlValue(r,i){let n,c;if(r.trim().length>0&&i.trim().length>0){const d=i.split(",");d.length>1&&(c={});const p=this.getLayoutBindModel(r);if(p)for(let m=0;m<d.length;m++){const _=d[m].trim();if(n=null,_.length===0)continue;const E=this.getLayoutItemOption(r,_,"controlType"),v=this.getLayoutItemOption(r,_,"field");(v==null?void 0:v.trim().length)>0?n=p[v.trim()]:this._hiddenFields[r.trim()]?n=this._hiddenFields[r.trim()][_]||"":n=p[_],["antInput","antInputGroup","antTextarea","erSelect","erTreeSelect","erMemoEditor"].includes(E)?n=n||"":E==="antInputNumber"&&n==null&&(n=0),d.length>1?c[_]=n:c=n}}return c}getControlText(r,i){let n,c;if(r.trim().length>0&&i.trim().length>0){const d=i.split(",");d.length>1&&(c={});const p=this.getLayoutBindModel(r);if(p)for(let m=0;m<d.length;m++){const _=d[m].trim();if(n=null,_.length===0)continue;const E=this.getLayoutItemOption(r,_,"field"),v=this.getLayoutItemOption(r,_,"controlType"),A=this.getLayoutItemOption(r,_,"format");(E==null?void 0:E.trim().length)>0?n=p[E.trim()]:this._hiddenFields[r.trim()]?n=this._hiddenFields[r.trim()][_]||"":n=p[_],["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect"].includes(v)?n=this.getDropDownSelectedText(r,_,n):v==="antDateTimePicker"||v==="antDatePicker"||v==="antMonthPicker"||v==="antYearPicker"?n=t.toDateTime(n,"Dayjs").format(A||"YYYY-MM-DD"):v==="antInputNumber"&&(n=e.Core.formatNumberValue(n,A)),d.length>1?c[_]=n:c=n}}return c}setControlValue(r,i,n){if(t.isNullOrEmpty(r)||t.isNullOrEmpty(i))return this;if(n===void 0&&(n=null),(r==null?void 0:r.trim().length)>0&&(i==null?void 0:i.trim().length)>0){const c=this.getLayoutBindModel(r==null?void 0:r.trim()),d=this.getLayoutItemOption(r,i,"controlType"),p=this.getLayoutItemOption(r,i,"field")||(i==null?void 0:i.trim());if(c&&p&&(["antMultiSelect","erMultiSelect"].includes(d)?n!==null?n instanceof Array?c==null||c.set(p,n,r):typeof n=="string"&&(c==null||c.set(p,n.split(","),r)):c==null||c.set(p,[],r):n!==null&&(d!=null&&d.startsWith("antCheckbox")||d!=null&&d.startsWith("antSwitch"))?c==null||c.set(p,t.toString(n)==="1"||t.toString(n).toLowerCase()==="true",r):n!==null&&(d!=null&&d.startsWith("antDate"))?c==null||c.set(p,t.toDateTime(n,"Dayjs"),r):c==null||c.set(p,n,r)),this._layoutConditionStyleInfo[r]){const m=this._layoutConditionStyleInfo[r];Object.keys(m).forEach(_=>{var E,v;(_===i||((v=(E=m[_])==null?void 0:E.condition)==null?void 0:v.indexOf(i))>-1)&&this.setLayoutConditionStyle(r,_)})}}return this}setControlValueEx(r,i,...n){const c=Object.keys(i);return(c==null?void 0:c.length)>0&&(n.length===1&&(n=n[0].split(",")),n.length>0?n.forEach(d=>{(i==null?void 0:i[d])!==void 0&&this.setControlValue(r,d,i[d])}):c.forEach(d=>{(i==null?void 0:i[d])!==void 0&&this.setControlValue(r,d,i[d])})),this}setControlCss(r,i,n){if((r==null?void 0:r.trim().length)>0&&(n==null?void 0:n.length)>0){let c;i instanceof Array?c=i:c=i.split(","),c&&c.length>0&&c.forEach(d=>{if(d.trim().length>0){const p=this.getLayoutItemOption(r,d,"controlType");let m=document.getElementsByName(this.FormId+r+d);if((m==null?void 0:m.length)>0){let _;switch(p){case"erSelect":case"erMultiSelect":case"antMultiSelect":case"erTreeSelect":case"erMultiTreeSelect":_=m[0].getElementsByClassName("ant-select-selector");break;case"antInput":case"antInputNumber":_=document.getElementById(this.FormId+r+d);break;case"antDateTimePicker":case"antDatePicker":case"antMonthPicker":case"antYearPicker":_=m[0].getElementsByClassName("ant-picker-input");break}n.forEach(E=>{(_==null?void 0:_.length)>0?E.value!==void 0&&e.Core.jQuery(_).css(E.property,E.value):E.value!==void 0&&e.Core.jQuery(m).css(E.property,E.value)})}else m=document.getElementById(this.FormId+r+d),m&&n.forEach(_=>{_.value!==void 0&&e.Core.jQuery(m).css(_.property,_.value)})}})}return this}setModelDefalutValue(r,i,n,c){let d;return i instanceof Array?d=i:d=i.split(","),n&&n.trim().length>0?d.forEach(p=>{if(p=this.getConfigIdbyLayoutName(p),r&&n&&r.schemaFields&&r.schemaFields[n]){const m=this.getSingleItemConfigInfo(p,n);let _=null;m.DEFAULT_VALUE&&m.DEFAULT_VALUE.trim().length>0?_=m.DEFAULT_VALUE:this._customDefaultValues[p]&&this._customDefaultValues[p][n]!==void 0?_=this._customDefaultValues[p][n]:c&&(_=c),_&&_.trim().length>0&&r.schemaFields[n].type&&(r.schemaFields[n].type==="datetime"?r.set(n,t.getDateTimeByString(_),p):r.schemaFields[n].type==="boolean"?r.set(n,_==="1"||_.toLowerCase()==="true",p):r.schemaFields[n].type==="number"?r.set(n,_,p):r.set(n,this.getDefaultStringValue(_),p),this.setControlValue(p,n,r[n]))}}):d.forEach(p=>{p=this.getConfigIdbyLayoutName(p);const m=this.getConfigInfo(p);m.TSI00GRIDCOLUMN&&m.TSI00GRIDCOLUMN.forEach(_=>{let E=null;if(n=_.ITEM_CODE,r&&n&&r.schemaFields&&r.schemaFields[n]){const v=this.getSingleItemConfigInfo(p,n);v.DEFAULT_VALUE&&v.DEFAULT_VALUE.trim().length>0?E=v.DEFAULT_VALUE:this._customDefaultValues[p]&&this._customDefaultValues[p][n]!==void 0?E=this._customDefaultValues[p][n]:c&&(E=c),E&&E.trim().length>0&&r.schemaFields[n].type&&(r.schemaFields[n].type==="datetime"?r.set(n,t.getDateTimeByString(E)):r.schemaFields[n].type==="boolean"?r.set(n,E==="1"||E.toLowerCase()==="true"):r.schemaFields[n].type==="number"?r.set(n,E):r.set(n,this.getDefaultStringValue(E)),this.setControlValue(p,n,r[n]))}})}),this}setModelValue(r,i,...n){return t.setModelValue(r,i,...n),this}setModelEmptyValue(r,...i){return i.length===1&&(i=i[0].split(",")),i.length>0?i.forEach(n=>{r&&r[n]!==void 0&&r.set(n,null)}):r.schemaFields&&Object.keys(r.schemaFields).forEach(n=>{r.set(n,null)}),this}setControlReadOnlyEx(r,i){return i&&Object.keys(i).forEach(n=>{this.setControlReadOnly(r,i[n],n)}),this}setControlReadOnly(r,i,...n){if(t.isNullOrEmpty(r))return this;n.length===1&&(n=n[0].split(",")),r=this.getConfigIdbyLayoutName(r);for(const c of n){const d=this.getSingleItemConfigInfo(r,c);let p=!0,m=!1;d.FUNCTION_TYPE&&d.COLUMN_EDIT&&(i!=="default"&&!i&&d.READ_ONLY==="1"&&(d.COLUMN_EDIT!=="1"||d.ALLOW_EDIT!=="1")||(i==="default"?(m=d.READ_ONLY==="1"||d.FUNCTION_TYPE!=="F"&&d.ALLOW_EDIT!=="1",p=d.ALLOW_EDIT==="1"):(m=i,p=!m),this.setLayoutItemOption(r,c,{readOnly:m}),d.COLUMN_EDIT==="1"&&this.setLayoutItemOption(r,c,{buttonEnable:p})))}return this}setAllControlReadOnly(r,i){let n;return r instanceof Array?n=r:n=r.split(","),n&&n.length>0&&n.forEach(c=>{if(c.trim().length>0){const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{this.setControlReadOnly(c.trim(),i,p.ITEM_CODE)})}}),this}setControlEnable(r,i,...n){if(t.isNullOrEmpty(r))return this;n.length===1&&(n=n[0].split(",")),r=this.getConfigIdbyLayoutName(r);for(const c of n){const d=this.getSingleItemConfigInfo(r,c);let p=!0;d.FUNCTION_TYPE&&d.COLUMN_EDIT&&(i==="default"?p=d.ALLOW_EDIT==="1":p=i,this.setLayoutItemOption(r,c,{allowEdit:p}),d.COLUMN_EDIT==="1"&&this.setLayoutItemOption(r,c,{buttonEnable:p}))}return this}setAllControlEnable(r,i){let n;return r instanceof Array?n=r:n=r.split(","),n&&n.length>0&&n.forEach(c=>{if(c.trim().length>0){const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{this.setControlEnable(c.trim(),i,p.ITEM_CODE)})}}),this}setControlEmptyValue(r,...i){if(i.length===1&&(i=i[0].split(",")),!i||i.length===0){const n=this.getConfigInfo(r);n.TSI00GRIDVIEW&&n.TSI00GRIDVIEW.length>0&&n.TSI00GRIDVIEW[0].FUNCTION_TYPE==="F"&&n.TSI00GRIDCOLUMN&&n.TSI00GRIDCOLUMN.forEach(c=>{this.setControlValue(r,c.ITEM_CODE,null)})}else i.forEach(n=>{this.setControlValue(r,n,null)});return this}setAllControlDefalutValue(r,i=!1){let n;return r instanceof Array?n=r:n=r.split(","),n.length>0&&n.forEach(c=>{if(c.trim().length>0){const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{var m;((m=p.DEFAULT_VALUE)==null?void 0:m.trim().length)>0?this.setControlDefalutValue(c.trim(),p.ITEM_CODE,i):i||this.setControlEmptyValue(c,p.ITEM_CODE)})}}),this}setControlDefalutValue(r,i,n=!1){var c,d;if(t.isNullOrEmpty(r)||t.isNullOrEmpty(i))return this;if(r=this.getConfigIdbyLayoutName(r),(r==null?void 0:r.trim().length)>0){const p=this.getLayoutBindModel(r),m=this.getSingleItemConfigInfo(r,i),_=((c=this.getLayoutItemOption(r.trim(),i,"field"))==null?void 0:c.value)||i.trim(),E=p==null?void 0:p.get(_==null?void 0:_.trim());if(E!=null&&n)return this;const v=t.toString(m.DEFAULT_VALUE,!0);if(p&&v.length>0){let A=this.getDefaultStringValue(v),B=null;const Q=this.getLayoutItemOption(r.trim(),i,"controlType");if(["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect","antRadioGroup","erRadioGroup","erCheckboxGroup"].includes(Q)&&["$FIRST_ROW$","$LAST_ROW$","$ALL_VALUES$"].includes(v)&&this._dropDownBindSource[r]&&this._dropDownBindSource[r][i]){const N=this._dropDownBindSource[r][i];((d=N.dataSource)==null?void 0:d.length)>0&&N.dataValueField&&(v==="$FIRST_ROW$"?A=N.dataSource[0][N.dataValueField]:v==="$LAST_ROW$"?A=N.dataSource[N.dataSource.length-1][N.dataValueField]:["antMultiSelect","erMultiSelect"].includes(Q)&&v==="$ALL_VALUES$"&&(A="",N.dataSource.forEach(W=>{A=A.length===0?W[N.dataValueField]:A+","+W[N.dataValueField]})))}["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(Q)?B=t.getDateTimeByString(A):Q==="antInputNumber"?B=t.toNumber(A):["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(Q)?B=A.split(","):Q==="antCheckbox"||Q==="antSwitch"?B=A==="1"||A.toLowerCase()==="true":B=A,this.setControlValue(r,i,B)}}return this}getFormButtonConfigInfo(r){let i={},n=[];return this._configInfo.TSI00FORMBUTTON&&this._configInfo.TSI00FORMBUTTON.getMappedRows().length>0&&(n=this._configInfo.TSI00FORMBUTTON.getMappedRows(),n.length>0&&n.every((c,d)=>c.BUTTON_NAME===r?(i=c,!1):!0)),i}getSystemGlobalOptions(){let r={};const i=this.getFormSysInfo("SystemGlobalOptions");return i.trim().length>0&&(r=JSON.parse(i)),r}getFormExtentedOptions(){var n,c;let r={};const i=this.getFormSysInfo("FormDefaultOptions");if(i.trim().length>0&&(r={...JSON.parse(i)}),((n=this._configInfo.TSI00FORM)==null?void 0:n.length)>0){const d=this._configInfo.TSI00FORM[0];if(((c=d.EXT_OPTIONS)==null?void 0:c.trim().length)>0){const p=JSON.parse(d.EXT_OPTIONS);r={...r,...p}}}return r}resetLayout(r){let i;return r instanceof Array?i=r:i=r.split(","),i.length>0&&i.forEach(n=>{if(n.trim().length>0){const c=this.getConfigInfo(n.trim());c.TSI00GRIDVIEW&&c.TSI00GRIDCOLUMN&&c.TSI00GRIDCOLUMN.forEach(d=>{d.DEFAULT_VALUE&&d.DEFAULT_VALUE.trim().length>0?this.setControlDefalutValue(n.trim(),d.ITEM_CODE):this.setControlValue(n.trim(),d.ITEM_CODE,null)})}}),this}getAllControlValue(r,i){const n={};return(r instanceof Array?r:r.split(",")).forEach(d=>{if((d==null?void 0:d.trim().length)>0){const p=this.getLayoutBindModel(d.trim());if(p){const m=this.getConfigInfo(d.trim());m.TSI00GRIDVIEW&&m.TSI00GRIDCOLUMN&&m.TSI00GRIDCOLUMN.forEach(_=>{const E=this.getLayoutItemOption(d,_.ITEM_CODE,"controlType"),v=this.getLayoutItemOption(d,_.ITEM_CODE,"field")||_.ITEM_CODE,A=t.toNumber(_.MAX_LENGTH);if(v){let B=p[v];if(E==="antCheckbox"||E==="antSwitch")B=B===!0?"1":"0";else if(E==="antInputNumber")B=B||0;else if(["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(E)&&B){const Q=t.toString(_.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss",N=t.getDateTimeFormatString(B,Q);N.substring(0,4)==="0001"||N.substring(0,4)==="1900"||N.substring(0,4)==="1901"?B="":(B=N,A>0&&A<B.length&&(B=B.substring(0,A)))}else["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(E)&&B&&B instanceof Array?B=B.join(","):B=B||"";n[v]=B}})}}}),i&&Object.keys(i).length>0&&Object.keys(i).forEach(d=>{n[d]=i[d]}),n}getAllControlValueAsBlock(r,i,n){const c=this.getAllControlValue(r,i);let d=r;r instanceof Array&&(d=r[0]);const p=this.getLayoutExtentedOptions(d);return p!=null&&p.blockName&&(n=p.blockName),(n==null?void 0:n.trim().length)===0&&d.includes("Filter")&&(n="inqu_status"),t.buildEiBlock([c],n||"Table0")}getAllControlValueAsFilter(r,i){let n=t.buildEiBlock(void 0,"Table0");const c=[];return(r instanceof Array?r:r.split(",")).forEach(p=>{const m=this.getConfigInfo(p);m.TSI00GRIDVIEW&&m.TSI00GRIDCOLUMN&&m.TSI00GRIDCOLUMN.forEach(_=>{if(_.OPERATOR.trim().length>0&&_.OPERATOR.trim()!=="None"&&_.PARA_GROUP.trim().length>0&&_.PARA_GROUP.trim()!=="None"){const E=this.getLayoutItemOption(p,_.ITEM_CODE,"controlType"),v={};i&&Object.keys(i).length>0?Object.keys(i).forEach(N=>{v[N]=i[N]}):v.QUERY_TYPE="",v.COMPANY_CODE=_.COMPANY_CODE,v.FORM_NAME=_.FORM_NAME,v.FUNCTION_ID=_.FUNCTION_ID,v.ITEM_CODE=t.toString(_.ITEM_CODE,!0,"toLower"),v.ORIGIN_CODE=_.ORIGIN_CODE,v.TABLE_NAME=_.TABLE_NAME,v.FIELD_NAME=t.toString(_.PARA_NAME,!0,"toLower"),v.OPERATOR=_.OPERATOR,v.PARA_GROUP=_.PARA_GROUP,v.SQL_CONTENT=_.SQL_CONTENT,v.OP_VALUE=null,v.DATA_TYPE="String";const A=t.toString(v.PARA_GROUP,!0),B=t.toString(v.OPERATOR,!0);let Q=this.getControlValue(p,_.ITEM_CODE)||"";if(B.length>0)switch(E){case"antRadioGroup":case"erRadioGroup":case"erSelect":case"erTreeSelect":{v.OP_VALUE=Q,v.ORIGIN_CODE==="4"&&_.SVC_NAME.trim().length>0&&v.OP_VALUE.trim().length>0&&v.OPERATOR==="SQL"&&(v.ORIGIN_CODE="SIU",v.SQL_CONTENT=this.getFormCodeSetFilter(_.SVC_NAME,v.OP_VALUE)),(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v);break}case"antInputNumber":{v.DATA_TYPE="Decimal",v.OP_VALUE=Q,v.OP_VALUE===null&&(v.OP_VALUE=0),(A==="2"||t.toNumber(v.OP_VALUE)!==0)&&c.push(v);break}case"antCheckbox":case"antSwitch":{v.OPERATOR="=",v.OP_VALUE=Q===!0?"1":Q===!1?"0":"",(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":case"erMultiTreeSelect":{v.OPERATOR="IN",Q&&Q instanceof Array&&Q.length>0?Q="'"+Q.join("','")+"'":Q="",v.OP_VALUE=Q,(A==="2"||Q.length>0)&&c.push(v);break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{if(Q){const N=t.toString(_.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss";v.OP_VALUE=t.getDateTimeFormatString(Q,N),v.OP_VALUE.length>=4&&(v.OP_VALUE.substring(0,4)==="0001"||v.OP_VALUE.substring(0,4)==="1900")&&(v.OP_VALUE=""),(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v)}break}default:{t.toString(Q,!0).length>0&&B==="IN"&&(Q="'"+Q.split(/\n|\t|,|,/).join("','")+"'"),v.OP_VALUE=Q,(A==="2"||v.OP_VALUE.trim().length>0)&&c.push(v);break}}}})}),c.length>0&&(n=t.buildEiBlock(c,"QUERY_FILTER")),n}expandLayoutGroup(r){let i=[];r&&(r instanceof Array?i=r:i=r.split(",")),i.length===0&&(i=this.getAllConfigIdArray());for(let n=0;n<i.length;n++)if(i[n].trim().length>0){const c=document.getElementById(this.FormId+i[n].trim()+"_content");c&&t.jQuery(c).show()}return this}collapseLayoutGroup(r){let i=[];r&&(r instanceof Array?i=r:i=r.split(",")),i.length===0&&(i=this.getAllConfigIdArray());for(let n=0;n<i.length;n++)if(i[n].trim().length>0){const c=document.getElementById(this.FormId+i[n].trim()+"_content");c&&t.jQuery(c).hide()}return this}async queryDataByButton(r,i,n,c){return new Promise((d,p)=>{let m=new ut.EiInfo;const _=this.getFormButtonConfigInfo(r);if(_&&_.SVC_NAME.trim().length>0){const E=new ut.EiInfo,v=_.SVC_NAME,A={};_.TYPE_DESC&&_.TYPE_DESC.trim().length>0&&(A[_.TYPE_DESC]=_.TYPE),c&&Object.keys(c).length>0&&Object.keys(c).forEach(W=>{A[W]=c[W]});const B=this.getAllControlValueAsBlock(i,A),Q=this.getAllControlValueAsFilter(i,A);let N=_.FILTER_STRING;n&&n.trim().length>0&&(N.trim().length>0?N=N+" and "+n:N=n),N.trim().length>0&&this.getQuerySqlFormat(N),E.addBlock(B),E.addBlock(Q),this.callService(v,E,{show:!0}).then(W=>{m=W,d(m)})}else m.SysInfo.Flag=-603,m.SysInfo.Msg="未调用后台服务",d(m)})}async queryDataByService(r,i){return new Promise((n,c)=>{let d=new ut.EiInfo;if(r.trim().length>0){const p=new ut.EiInfo;if(i&&i.filterConfigId&&i.filterConfigId.trim().length>0){let m=this.getAllControlValueAsBlock(i.filterConfigId,i.queryType);const _=this.getAllControlValueAsFilter(i.filterConfigId,i.queryType);if(m.getMappedRows().length>0){const E=m.getMappedRows()[0];m=t.buildEiBlock([E])}p.addBlock(m),p.addBlock(_)}if(i&&i.customFilter&&i.customFilter.trim().length>0){const m=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(i.customFilter),DATA_TYPE:"",OP_VALUE:"*"}];if(!p.getBlock("QUERY_FILTER")){const _=t.buildEiBlock(m,"QUERY_FILTER");p.addBlock(_)}}this.callService(r,p).then(m=>{var _,E,v,A;if(d=m,e.Core.toNumber((_=d.SysInfo)==null?void 0:_.Flag)>=0&&i&&i.dataTable){if(i.dataTable instanceof S)this.mergeDataToDataTable(d,i.dataTable,i.clearTable);else if(typeof i.dataTable=="string"&&i.dataTable.trim().length>0)if((E=this._formDataSet)!=null&&E.contains(i.dataTable.trim()))this.mergeDataToDataTable(d,(v=this._formDataSet)==null?void 0:v.getDataTable(i.dataTable.trim()),i.clearTable);else{const B=this.getBindingTableName(i.dataTable.trim());B.trim().length>0&&this.mergeDataToDataTable(d,(A=this._formDataSet)==null?void 0:A.getDataTable(B.trim()),i.clearTable)}}n(d)})}else d.SysInfo.Flag=-603,d.SysInfo.Msg="No service available",n(d)})}async queryDataByDataSource(r,i,n=""){return new Promise(async(c,d)=>{var E,v,A,B;let p=new ut.EiInfo,m=!1,_="";if(r.trim().length>0){let Q="";const N=this.getGridConfig(r);((E=N==null?void 0:N.SVC_NAME)==null?void 0:E.trim().length)>0&&(_=r,r=N.SVC_NAME.trim(),Q=N.FILTER_STRING.trim(),m=!0);const W=new ut.EiInfo;if(i&&i.filterConfigId&&i.filterConfigId.trim().length>0){let Se=this.getAllControlValueAsBlock(i.filterConfigId,i.queryType);const ue=this.getAllControlValueAsFilter(i.filterConfigId,i.queryType);if(Se.getMappedRows().length>0){const me=Se.getMappedRows()[0];Se=t.buildEiBlock([me])}W.addBlock(Se),W.addBlock(ue)}if(t.toString(i==null?void 0:i.customFilter,!0).length>0&&(Q.trim().length>0?Q=Q+" and "+t.toString(i==null?void 0:i.customFilter,!0):Q=t.toString(i==null?void 0:i.customFilter,!0)),Q.trim().length>0){const Se=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(Q),DATA_TYPE:"",OP_VALUE:"*"}];if(!W.getBlock("QUERY_FILTER")){const ue=t.buildEiBlock(Se,"QUERY_FILTER");W.addBlock(ue)}}const J=(B=(A=(v=this._configInfo)==null?void 0:v.TSI00DATASOURCE)==null?void 0:A.getMappedRows())==null?void 0:B.find(Se=>Se.FUNC_ID===r),re=Se=>{this.callService(Se,W,{show:i==null?void 0:i.showLoading},{messageError:!0}).then(ue=>{var me,Z,Te;p=ue,e.Core.toNumber((me=p.SysInfo)==null?void 0:me.Flag)>=0&&(i&&i.dataTable?i.dataTable instanceof S?this.mergeDataToDataTable(p,i.dataTable,i.clearTable):typeof i.dataTable=="string"&&i.dataTable.trim().length>0&&((Z=this._formDataSet)!=null&&Z.contains(i.dataTable.trim()))&&this.mergeDataToDataTable(p,(Te=this._formDataSet)==null?void 0:Te.getDataTable(i.dataTable.trim()),i.clearTable):m===!0&&this.mergeDataToGrid(p,_,i==null?void 0:i.clearTable)),c(p)})};if(J!=null&&J.FUNC_ID){if(J.ORIGIN_CODE==="SVC"&&J.SVC_NAME.trim().length>0)re(J.SVC_NAME.trim());else if(J.SQL_CONTENT.trim().length>0){const Se=t.buildEiBlock([{OPERATE_TYPE:"sql_query",FUNCTION_ID:J.FUNC_ID,SQL:this.getQuerySqlFormat(J.SQL_CONTENT),FILTER_STRING:"",GROUP_COL:J.GROUP_KEY_VALUE,SORT_COL:J.PRI_KEY_SQL}],"DATA_SOURCE");W.addBlock(Se),t.toString(n).trim().length===0&&J.SVC_NAME.trim().length>0&&(n=J.SVC_NAME.trim()),t.toString(n).trim().length===0&&(n="JAER01/query"),re(n)}}else{const Se=t.buildEiBlock([{FUNCTION_ID:r,COMPANY_CODE:e.SysInfo.CompanyCode}],"DATA_SOURCE");W.addBlock(Se),t.toString(n).trim().length===0&&(n="JAER01/query"),re(n)}}else p.SysInfo.Flag=-603,p.SysInfo.Msg="DataSoureId is null or empty!",c(p)})}async queryDataToGrid(r,i,n,c){const d=this.getAllControlValueAsBlock(i,void 0,c==null?void 0:c.filterBlockId),p=this.getGridStructureAsBlock(n,!1,c==null?void 0:c.gridBlockId);let m=new ut.EiInfo;m.addBlock(d),m.addBlock(p),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(m=c.processInInfo(m));const _=(c==null?void 0:c.loadingOptions)||{show:!0},E=(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0},v=await this.callService(r,m,_,E);c!=null&&c.mergeToGrid&&c.mergeToGrid instanceof Function?c.mergeToGrid(v):this.mergeDataToGrid(v.getBlock((c==null?void 0:c.gridBlockId)||"result"),n)}saveGridData(r,i,n,c){const d=[];return new Promise(async(p,m)=>{if((n==null?void 0:n.trim().length)>0)if(this.hasDataChange(n)){if(c=c||{},c.messageConfirm=c.messageConfirm??"是否确认保存",c.messageConfirm){const v=typeof c.messageConfirm=="string"?c.messageConfirm:"是否确认保存";if(!await this.messageConfirm(v)){p({results:[],success:!0,message:"保存取消"});return}}if(typeof r=="string"){let v=this.getGridChangedRowsAsEiInfo(n);v.addBlock(this.getAllControlValueAsBlock(i,void 0,c==null?void 0:c.filterBlockId)),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(v=c.processInInfo(v,"save")),d.push(this.callService(r,v,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}else if(Wr.isPlainObject(r)){const v=this.getAllControlValueAsBlock(i,void 0,c==null?void 0:c.filterBlockId);if(r.deleteService&&r.deleteService.trim().length>0){const A=this.getGridDeletedRowsAsBlock(n);if(A.getMappedRows().length>0){A.rename("result");let B=new ut.EiInfo;B.addBlock(v),B.addBlock(A),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(B=c.processInInfo(B,"delete")),d.push(this.callService(r.deleteService,B,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}}if(r.updateService&&r.updateService.trim().length>0){const A=this.getGridModifyRowsAsBlock(n);if(A.getMappedRows().length>0){A.rename("result");let B=new ut.EiInfo;B.addBlock(v),B.addBlock(A),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(B=c.processInInfo(B,"update")),d.push(this.callService(r.updateService,B,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}}if(r.insertService&&r.insertService.trim().length>0){const A=this.getGridCreatedRowsAsBlock(n);if(A.getMappedRows().length>0){A.rename("result");let B=new ut.EiInfo;B.addBlock(v),B.addBlock(A),c!=null&&c.processInInfo&&c.processInInfo instanceof Function&&(B=c.processInInfo(B,"insert")),d.push(this.callService(r.insertService,B,(c==null?void 0:c.loadingOptions)||{show:!0},(c==null?void 0:c.callServiceOptions)||{toCamelCase:!0}))}}}const _=await Promise.allSettled(d);let E=!0;_.forEach(v=>{v.status==="fulfilled"&&v.value.getStatus()<0?(this.messageError(v.value.getMsg()),E=!1):v.status!=="fulfilled"&&(E=!1)}),E&&(c!=null&&c.queryService)&&this.queryDataToGrid(c.queryService,i,n,{...c,processInInfo:void 0}),p({results:_,success:E,message:E?"保存成功":"保存失败"})}else{p({results:[],success:!0,message:"没有数据变更,无需保存"}),this.messageInfo("没有数据变更,无需保存");return}else m(new Error("gridConfId is null or empty!"))})}getFormCodeSetFilter(r,i){let n="";if(this._configInfo[this._formName+r]){for(const c of this._configInfo[this._formName+r].getMappedRows())if(c.CODE===i){n=c.SQL_CONTENT;break}}return n}getQuerySqlFormat(r,i){return t.getSystemFormatString(r,i)}getFormSysInfo(r){return this._configInfo.IPLAT4J_SYSTEM_INFO&&this._configInfo.IPLAT4J_SYSTEM_INFO.getMappedRows().length>0&&r.trim().length>0?t.toString(this._configInfo.IPLAT4J_SYSTEM_INFO.getMappedRows()[0][r.trim().toUpperCase()]):""}getSysParaValue(r,i,n){return new Promise((c,d)=>{if(this._sysParaInfo&&this._sysParaInfo[r]!==void 0&&this._sysParaInfo[r][i]!==void 0)c(this._sysParaInfo[r][i].toString());else if(i&&i.trim().length>0){const p=new ut.EiInfo;let m="";const _=t.buildEiBlock([{QUERY_TYPE:"system_para",COMPANY_CODE:r,CTRL_CODE:i,EFFECT_ELEMENT_VALUE:n||""}]);p.addBlock(_),t.callService(e.SysInfo.queryDevConfigService,p).then(E=>{var v;E.getStatus()>=0&&E.getBlock("TSIFIAA51")&&E.getBlock("TSIFIAA51").getMappedRows().length>0?m=t.toString(E.getBlock("TSIFIAA51").getMappedRows()[0].CTRL_NUM):E.getStatus()>=0&&((v=E.getBlock("IPLAT4J_SYSTEM_INFO"))==null?void 0:v.getMappedRows().length)>0&&(m=t.toString(E.getBlock("IPLAT4J_SYSTEM_INFO").getMappedRows()[0][i.toUpperCase()])),this._sysParaInfo[r]===void 0&&(this._sysParaInfo[r]={}),this._sysParaInfo[r][i]=m,c(m)},()=>{this._sysParaInfo[r]===void 0&&(this._sysParaInfo[r]={}),this._sysParaInfo[r][i]="",c("")})}})}getDefaultStringValue(r){return r.trim().length>14&&r.trim().substring(0,13)==="$FormSysInfo."&&r.trim().substring(r.trim().length-1,r.trim().length)==="$"?r=this.getFormSysInfo(r.trim().substring(13,r.trim().length-1)):r=t.getSystemFormatString(r),r}setCustomDefaultValue(r,i){(r==null?void 0:r.trim().length)>0&&i&&(this._customDefaultValues[r.trim()]=i)}getLayoutConfigDefaultValues(r){const i={};let n;return r instanceof Array?n=r:n=r.split(","),n.length>0&&n.forEach(c=>{const d=this.getConfigInfo(c.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(p=>{if(p.DEFAULT_VALUE&&p.DEFAULT_VALUE.trim().length>0){const m=p.FUNCTION_TYPE+p.COLUMN_EDIT,_=p.DEFAULT_VALUE,E=this.getControlName(m,p.FORMAT_STRING);if(E&&E.trim().length>0&&_.trim().length>0)switch(E){case"antInputNumber":{i[p.ITEM_CODE]=parseFloat(_);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":{const v=this.getDefaultStringValue(_).split(",");i[p.ITEM_CODE]=v;break}case"antCheckbox":case"antSwitch":{i[p.ITEM_CODE]=t.toString(_)==="1"||t.toString(_)==="true";break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{i[p.ITEM_CODE]=t.getDateTimeByString(_);break}default:{i[p.ITEM_CODE]=this.getDefaultStringValue(_);break}}}})}),i}getGridConfigDefaultValues(r){const i={},n=this.getConfigInfo(r.trim()),c=this.getBindingTable(r.trim());return c&&n.TSI00GRIDVIEW&&n.TSI00GRIDCOLUMN&&n.TSI00GRIDCOLUMN.forEach(d=>{if(c.options.schema&&d.DEFAULT_VALUE&&d.DEFAULT_VALUE.trim().length>0){const p=c.options.schema[d.FIELD_NAME].type;p==="datetime"?i[d.FIELD_NAME]=t.getDateTimeByString(d.DEFAULT_VALUE):p==="boolean"?i[d.FIELD_NAME]=d.DEFAULT_VALUE==="1"||d.DEFAULT_VALUE.toLowerCase()==="true":p==="number"?i[d.FIELD_NAME]=t.toNumber(d.DEFAULT_VALUE):i[d.FIELD_NAME]=this.getDefaultStringValue(d.DEFAULT_VALUE)}}),i}async loadGrid(r,i,n,c,d){var p,m,_,E,v,A,B,Q,N;if(!this.containsConfig(r)&&(n==null?void 0:n.forceLoadConfig)!==!1&&await this.loadConfig(r),this.containsConfig(r)){if(this._gridInstanceInfo[r])return console.error(`Grid instance ${r} already exists!`),!1;const W=this.getSingleViewConfigInfo(r);this.setGridToolbarVisible(r,{refresh:W.SHOW_REFRESH==="1",addrow:W.SHOW_ADD==="1",copyrow:W.SHOW_ADDCOPY==="1",delete:W.SHOW_DELETE==="1",cancel:!1,save:!1,excel:W.SHOW_EXPORT==="1",import:W.ALLOW_IMPORT==="1"}),this._gridColumnsConfigInfo[r]={},this._gridColumnsInfo[r]={},this._allowMergeColumnFields[r]=[],this._gridStyleInfo[r]=this._gridStyleInfo[r]||[],this._gridOptions[r]=this._gridOptions[r]||{};const J=this.getConfigInfo(r);if((p=i==null?void 0:i.gridOptions)!=null&&p.api&&J.TSI00GRIDVIEW&&J.TSI00GRIDVIEW.length>0){const re=J.TSI00GRIDVIEW[0];((m=n==null?void 0:n.cloneTableName)==null?void 0:m.trim().length)>0&&this.cloneTableForLayoutOrGrid(((_=n==null?void 0:n.originTableName)==null?void 0:_.trim())||re.TABLE_NAME.trim(),n.cloneTableName.trim(),r),i.gridOptions.context={configId:r,configCaption:re.FUNCNAME_RES||re.FUNCNAME},n=n||{},((E=re.CUS_EXT_OPTIONS)==null?void 0:E.trim().length)>0&&(n={...JSON.parse(re.CUS_EXT_OPTIONS),...n}),((v=re.EXT_OPTIONS)==null?void 0:v.trim().length)>0&&(n={...JSON.parse(re.EXT_OPTIONS),...n});const Se=this.getFormSysInfo("GridDefaultOptions");Se.trim().length>0&&(n={...JSON.parse(Se),...n}),["rowDragManaged","groupIncludeFooter","groupIncludeTotalFooter","suppressRowTransform","suppressRowClickSelection","rowMultiSelectWithClick","singleClickEdit"].forEach(Z=>{n[Z]=i.gridOptions[Z]??n[Z]}),n.groupDisplayType=n.groupDisplayType||i.gridOptions.groupDisplayType||this.getFormSysInfo("GRIDGROUPDISPLAYTYPE")||"groupRows",n.rowHeight=n.rowHeight||i.gridOptions.rowHeight;const me=this.getGridConfigOptions(r,n,c,d);if(me.context={...i.gridOptions.context,...me.context},me&&Object.keys(me).forEach(Z=>{i.gridOptions[Z]=me[Z]!==void 0?me[Z]:i.gridOptions[Z]}),i.gridOptions.defaultColDef=i.gridOptions.defaultColDef||{},i.gridOptions.rowSelection=J.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",i.gridOptions.api.selectionService.rowSelection=J.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",i.gridOptions.api.selectionService.groupSelectsChildren=!0,i.gridOptions.api.setColumnDefs(me.columnDefs),i.gridOptions.api.setRowData([]),re.ALLOW_CELLMERGE==="1"&&((A=i.gridOptions.context.mergeColumns)==null?void 0:A.length)>0){let Z=[];i.gridOptions.context.calculateRowSpan=(Te=!0)=>{var Me,ge,le,Y,Fe,ke;Te?Z=i.gridOptions.context.bindingSource.data():i.gridOptions.api.forEachNodeAfterFilterAndSort(Ve=>{var at;(at=Ve.data)!=null&&at.uid&&Z.push(Ve.data)});const ce={},ze=((le=(ge=(Me=i.gridOptions.context)==null?void 0:Me.viewConfig)==null?void 0:ge.MERGE_COLUMN)==null?void 0:le.trim().length)>0?(ke=(Fe=(Y=i.gridOptions.context)==null?void 0:Y.viewConfig)==null?void 0:Fe.MERGE_COLUMN)==null?void 0:ke.trim().split(","):[];return i.gridOptions.context.mergeColumns.forEach(Ve=>{ce[Ve]={};const at={};let pt=0;const ht=[...ze,Ve];for(let Ct=0;Ct<Z.length;Ct++){let _t=!0;for(let Qe=0;Qe<ht.length;Qe++){const U=ht[Qe];if(Z[Ct][U]!==at[U]){_t=!1;break}}if(!_t){if(Object.keys(at).length>0)for(let Qe=pt;Qe<Ct;Qe++){const U=Z[Qe].uid;ce[Ve][U]=Qe===pt?Ct-pt:0}ht.forEach(Qe=>{at[Qe]=Z[Ct][Qe]}),pt=Ct}if(Ct===Z.length-1)for(let Qe=pt;Qe<=Ct;Qe++){const U=Z[Qe].uid;ce[Ve][U]=Qe===pt?Ct-pt+1:0}}}),i.gridOptions.context.rowSpanMap=ce,Z[0]}}if((re==null?void 0:re.SHOW_FOOTER)==="1"&&i.gridOptions.api.setPinnedBottomRowData([{pinndeRowType:"ErGridSummaryFooter"}]),l.nextTick(()=>{var Z;i.gridOptions.defaultColDef.floatingFilter===void 0&&i.gridOptions.api.setDefaultColDef({floatingFilter:(re==null?void 0:re.SHOW_FILTER_ROW)==="1"}),((Z=n==null?void 0:n.initialData)==null?void 0:Z.length)>0&&this.mergeDataToGrid(n.initialData,i)}),i.gridOptions.processCellForClipboard=Z=>{var Te,ce,ze,Me,ge;return(Te=Z.node)!=null&&Te.footer&&((ce=Z.node)!=null&&ce.group)&&((ze=Z.context)!=null&&ze.focusColId)&&Z.node.aggData&&Z.node.aggData[Z.context.focusColId]?Wr.isPlainObject(Z.node.aggData[Z.context.focusColId])?`☑️ ${t.formatNumberValue(Z.node.aggData[Z.context.focusColId].aggValueOfChecked,"")}
72
72
  ∑ ${t.formatNumberValue(Z.node.aggData[Z.context.focusColId].aggValue,"")}`:Z.node.aggData[Z.context.focusColId]:((Me=Z.context)==null?void 0:Me.copyValue)!==!1&&((ge=Z.column)!=null&&ge.colDef.valueFormatter)?Z.column.colDef.valueFormatter(Z):Z.value},n.SORT_FIELD_NAME=((B=n.SORT_FIELD_NAME)==null?void 0:B.trim())||re.SORT_FIELD_NAME,((Q=n.SORT_FIELD_NAME)==null?void 0:Q.trim().length)>0){const Z=n.SORT_FIELD_NAME.split(","),Te=[];Z.forEach((ze,Me)=>{const ge=ze.trim().split(" ");if(ge.length>0){const le={colId:ge[0].trim().toUpperCase(),sort:"asc",sortIndex:Me};ge.length>1&&ge[1].trim().toLowerCase()==="desc"&&(le.sort=ge[1].trim().toLowerCase()),Te.push(le)}}),i.gridOptions.columnApi.applyColumnState({state:Te});const ce=(N=i.gridOptions.api)==null?void 0:N.getStatusPanel("InformationPanel");ce&&ce.setInformation()}this.setGridMainMenuItems(i,n),this.setGridContextMenu(i,n),this.setGridRowStyle(i,n),this.setGridInitialEvent(i,n),this._gridInstanceInfo[r]=i}return!0}return!1}getGridConfigOptions(r,i,n,c){this._gridColumnsConfigInfo[r]={},this._gridColumnsInfo[r]={},this._allowMergeColumnFields[r]=[],this._gridStyleInfo[r]=this._gridStyleInfo[r]||[],this._gridOptions[r]=this._gridOptions[r]||{};const d={},p=this.getConfigInfo(r);if(p.TSI00GRIDVIEW&&p.TSI00GRIDVIEW.length>0){const m=p.TSI00GRIDVIEW[0],_=p.TSI00GRIDCOLUMN;d.statusBar={statusPanels:[{statusPanel:"ToolbarButton"}]},i=i||{},i.rowDragManaged=i.rowDragManaged??m.ALLOW_DRAG.toString()==="1",i.enableHeaderTooltip=i.enableHeaderTooltip??!0,i.enableCellTooltip=i.enableCellTooltip??!0;const E=m.MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single";t.toNumber(m.DISPLAY_WIDTH)>0&&this.setGridOptions(r,"miniHeight",t.toNumber(m.DISPLAY_WIDTH)+"px",!0),this.setGridOptions(r,"ShowQuickFilter",m.ALLOW_FIND_MODE,!0),this.setGridOptions(r,"RowSelection",E,!0),this.setGridOptions(r,"toolbarStyle",i.toolbarStyle,!0),d.treeData=m.FUNCTION_TYPE==="T",d.columnDefs=this.getGridColumnDefs(r,p,d,i),d.rowData=[],d.rowHeight=i.rowHeight?i.rowHeight:t.toNumber(m.ROWHIGH)>0?t.toNumber(m.ROWHIGH):void 0,d.groupIncludeFooter=i.groupIncludeFooter??(m.SHOW_FOOTER==="1"&&i.aggDataInGroupRow!==!0),d.groupIncludeTotalFooter=i.groupIncludeTotalFooter??m.SHOW_FOOTER==="1",d.getRowId=v=>v.data.uid,d.gridId=r,d.suppressRowTransform=i.suppressRowTransform??!0,d.suppressRowClickSelection=i.suppressRowClickSelection??m.AUTO_SELECT_MODE.toString()!=="4",d.rowMultiSelectWithClick=i.rowMultiSelectWithClick??!0,d.singleClickEdit=i.singleClickEdit??!0,d.rowBuffer=i.rowBuffer??10,d.debug=i.debug??!1,d.enableRangeHandle=!0,d.showOpenedGroup=!0,d.suppressPaginationPanel=!0,d.paginateChildRows=!0,d.stopEditingWhenCellsLoseFocus=!0,d.enableCellExpressions=!0,d.groupDisplayType=d.treeData?void 0:i.groupDisplayType||this.getFormSysInfo("GridGroupDisplayType")||"groupRows",d.context.rowSpanMap&&(d.suppressRowTransform=!0),d.groupDisplayType==="groupRows"&&(d.groupRowRendererParams={checkbox:E==="multiple"&&m.SHOW_SELECTION.toString()==="1",suppressCount:i.aggDataInGroupRow===!0,innerRenderer:v=>{var A,B,Q,N,W,J,re,Se,ue;if((B=(A=v.node)==null?void 0:A.rowGroupColumn)!=null&&B.colDef){const me=(N=(Q=v.node)==null?void 0:Q.rowGroupColumn)==null?void 0:N.colDef;let Z=v.node.key;if(me.cellDataType==="number"?Z=t.formatNumberValue(v.value,(J=(W=me.context)==null?void 0:W.columnConfig)==null?void 0:J.FORMAT_STRING):((re=me.cellEditor)==null?void 0:re.name)==="DatetimeEditor"?Z=t.getDateTimeFormatString(v.value,(ue=(Se=me.context)==null?void 0:Se.columnConfig)==null?void 0:ue.FORMAT_STRING):me.refData&&(Z=me.refData[v.value]||v.value),i.aggDataInGroupRow===!0){let ce=`
73
73
  <div style="display: inline-block">
74
74
  <span>${`${Z}(${v.node.allChildrenCount})`}</span>`;return v.node.aggData&&Object.keys(v.node.aggData).length>0&&Object.keys(v.node.aggData).forEach(ze=>{var Fe,ke,Ve,at;const Me=(Fe=v.columnApi.getColumn(ze))==null?void 0:Fe.colDef,ge=((ke=Me.headerName)==null?void 0:ke.replaceAll("<br>","").replaceAll("</br>","").replaceAll("<br/>",""))||ze,le=(at=(Ve=Me.context)==null?void 0:Ve.columnConfig)==null?void 0:at.FORMAT_STRING,Y=v.node.aggData[ze];ce+=`<span class="er-grid-group-row-col">${ge}:</span>`,Wr.isPlainObject(Y)?ce+=`<span class="er-grid-group-row-agg">${t.formatNumberValue(Y.aggValueOfChecked,le)+"/"+t.formatNumberValue(Y.aggValue,le)}</span>`:ce+=`<span class="er-grid-group-row-agg">${t.formatNumberValue(Y,le)}</span>`}),ce+="</div>",ce}else return Z}else return v.value}}),d.treeData?(d.getDataPath=v=>v[o.TreeHierarchyFieldName],d.animateRows=(i==null?void 0:i.animateRows)??!0):d.autoGroupColumnDef=(i==null?void 0:i.autoGroupColumnDef)||{tooltipField:d.context.groupColumnFieldId,filter:"agSetColumnFilter",filterParams:{excelMode:"windows"},pinned:"left",resizable:!0,sortable:!0},d.debounceVerticalScrollbar=(i==null?void 0:i.debounceVerticalScrollbar)??!0,d.enableAdvancedFilter=(i==null?void 0:i.enableAdvancedFilter)??!0,d.rowDragManaged=i.rowDragManaged,d.rowDragMultiRow=i.rowDragMultiRow,d.rowDragEntireRow=i.rowDragEntireRow??!1,d.enableRangeSelection=(i==null?void 0:i.enableRangeSelection)===!0||(i==null?void 0:i.enableRangeSelection)!==!1&&m.MULTI_SELECT_MODE.toString()==="3",d.enableBrowserTooltips=(i==null?void 0:i.enableBrowserTooltips)??!1,d.tooltipInteraction=(i==null?void 0:i.tooltipInteraction)??!0,d.allowContextMenuWithControlKey=(i==null?void 0:i.allowContextMenuWithControlKey)??!0,d.groupSelectsChildren=(i==null?void 0:i.groupSelectsChildren)??!0,d.context={...d.context,configId:r,viewConfig:m,columnsConfig:_,editable:m.ALLOW_EDIT==="1",showPreview:m.SHOW_PREVIEW==="1"&&m.PREVIEW_FIELD_NAME.trim().length>0,previewField:m.PREVIEW_FIELD_NAME,detailConfigId:i==null?void 0:i.detailConfigId,options:i,toolbarOptions:n,pageOptions:c},d.context.aggForChecked&&(d.getRowHeight=v=>v.node.rowPinned||v.node.group?35:void 0)}return d}setGridInitialEvent(r,i){var n,c;if((c=(n=r==null?void 0:r.gridOptions)==null?void 0:n.context)!=null&&c.configId){const d=r.gridOptions.context.configId,p=this.getConfigInfo(d);r.gridOptions.api.addEventListener("firstDataRendered",m=>{var A,B,Q,N,W;p.TSI00GRIDVIEW[0].AUTO_EXPAND_GROUP==="1"&&m.api.expandAll();const _=r.gridOptions.api.getFilterModel(),E=r.gridOptions.columnApi.getColumnState().filter(J=>J.sort!==null);if(Object.keys(_).length>0||E.length>0)if(r.gridOptions.context.calculateRowSpan&&r.gridOptions.context.calculateRowSpan instanceof Function){const J=r.gridOptions.context.calculateRowSpan(!1);r.gridOptions.api.redrawRows(),r.gridOptions.context.bindingSource.setCurrent(J)}else t.setGridFocusedCell(r,0);else{const J=r.gridOptions.context.bindingSource.data()[0];r.gridOptions.context.bindingSource.setCurrent(J)}if((B=(A=r==null?void 0:r.gridOptions)==null?void 0:A.context)!=null&&B.showPreview&&((N=(Q=r==null?void 0:r.gridOptions)==null?void 0:Q.context)!=null&&N.previewField)&&!i.detailConfigId){const J=r.gridOptions.context.previewField.split(","),re={};J.forEach(ue=>{var me;if(ue.trim().length>0){let Z="";const Te=(me=r.gridOptions.context.columnsConfig)==null?void 0:me.find(ce=>ce.FIELD_NAME===ue.trim());Te&&(Z=Te.COL_CAPTION.replaceAll("<br>","").replaceAll("</br>","").replaceAll("<br/>","")),re[ue.trim()]=Z}});const Se=Object.keys(re);Se.length>0&&(r.gridOptions.context.previewFieldMap=re,m.api.forEachNode(ue=>{const me=[];Se.forEach(Z=>{var Te;(Te=ue.data)!=null&&Te[Z]&&me.push({label:re[Z],value:ue.data[Z]})}),me.length>0&&(ue.data._preview_row_data=me,ue.setExpanded(!0))}))}const v=(W=m.api)==null?void 0:W.getStatusPanel("InformationPanel");v&&v.setInformation()}),r.gridOptions.api.addEventListener("selectionChanged",m=>{var _,E,v,A;if(r.gridOptions.context.aggForChecked&&((_=m.api)==null||_.refreshCells({force:!0}),this.refreshGridFooterData(r),((E=r.gridOptions.context.options)==null?void 0:E.aggDataInGroupRow)===!0&&m.columnApi.getRowGroupColumns().length>0)){const Q=[];(v=m.api)==null||v.forEachNode(N=>{N.group&&Q.push(N)}),(A=m.api)==null||A.redrawRows({rowNodes:Q})}}),r.gridOptions.api.addEventListener("rowSelected",m=>{m.source==="checkboxSelected"&&this.processRowSelectedEvent(m)}),r.gridOptions.api.addEventListener("cellEditingStarted",m=>{r.gridOptions.suppressContextMenu=!0}),r.gridOptions.api.addEventListener("cellEditingStopped",m=>{r.gridOptions.suppressContextMenu=!1}),r.gridOptions.api.addEventListener("sortChanged",m=>{var v,A;let _;r.gridOptions.context.calculateRowSpan&&r.gridOptions.context.calculateRowSpan instanceof Function&&(_=r.gridOptions.context.calculateRowSpan(!1)),(i==null?void 0:i.showRowNo)!==!1&&((v=m.api)==null||v.redrawRows()),_?r.gridOptions.context.bindingSource.setCurrent(_):t.setGridFocusedCell(r,0);const E=(A=m.api)==null?void 0:A.getStatusPanel("InformationPanel");E&&E.setInformation()}),r.gridOptions.api.addEventListener("filterChanged",m=>{var v,A,B,Q,N;let _;if(r.gridOptions.context.calculateRowSpan&&r.gridOptions.context.calculateRowSpan instanceof Function&&(_=r.gridOptions.context.calculateRowSpan(!1)),(i==null?void 0:i.showRowNo)!==!1&&((v=m.api)==null||v.redrawRows()),_?r.gridOptions.context.bindingSource.setCurrent(_):t.setGridFocusedCell(r,0),((A=m==null?void 0:m.context)==null?void 0:A.viewConfig.SHOW_FOOTER)==="1"){const W=m.api.getModel();(Q=m.api)==null||Q.setPinnedBottomRowData([{...(B=W==null?void 0:W.rootNode)==null?void 0:B.aggData,pinndeRowType:"ErGridSummaryFooter"}])}const E=(N=m.api)==null?void 0:N.getStatusPanel("InformationPanel");E&&E.setInformation()}),r.gridOptions.api.addEventListener("rowDragEnd",m=>{var _,E;r.gridOptions.context.calculateRowSpan&&r.gridOptions.context.calculateRowSpan instanceof Function?(r.gridOptions.context.calculateRowSpan(!1),(_=m.api)==null||_.redrawRows()):(i==null?void 0:i.showRowNo)!==!1&&((E=m.api)==null||E.refreshCells({columns:[o.GridCheckColumnFieldName]}))}),r.gridOptions.api.addEventListener("columnRowGroupChanged",m=>{var _;r.gridOptions.context.groupByFields=void 0,r.gridOptions.context.groupColumnFieldId=void 0,(i==null?void 0:i.showRowNo)!==!1&&((_=m.api)==null||_.redrawRows())}),r.gridOptions.api.addEventListener("rowGroupOpened",m=>{var _;m.api.redrawRows({rowNodes:[m.node]}),(i==null?void 0:i.showRowNo)!==!1&&((_=m.api)==null||_.refreshCells({columns:[o.GridCheckColumnFieldName]}))}),r.gridOptions.api.addEventListener("expandOrCollapseAll",m=>{var _;(i==null?void 0:i.showRowNo)!==!1&&((_=m.api)==null||_.refreshCells({columns:[o.GridCheckColumnFieldName]}))}),r.gridOptions.api.addEventListener("cellValueChanged",m=>{var _,E,v,A,B,Q;if(m.data&&m.colDef&&m.colDef.field){m.data.dirty=!0,m.data.dirtyFields[m.colDef.field]=!0,this.setDropDownAutoFillFieldsForGrid(r,m.colDef.colId,m.node),this.DropDownCascader[d+m.colDef.colId]&&this.DropDownCascader[d+m.colDef.colId].forEach(W=>{W.FUNCTION_TYPE&&W.FUNCTION_ID&&W.ITEM_CODE&&(W.FUNCTION_TYPE==="F"?this.setControlEmptyValue(W.FUNCTION_ID,W.ITEM_CODE):W.FUNCTION_ID===d&&(m.data[W.ITEM_CODE]=null))});let N=this.getGridOptions(d,"autoSelectMode");if(N===void 0){const W=this.getSingleViewConfigInfo(d);N=W.AUTO_SELECT_MODE,this.setGridOptions(d,"autoSelectMode",W.AUTO_SELECT_MODE)}if(N==="2"||N==="3")this.checkGridRow(d,m.data.uid);else if(((v=(E=(_=m.colDef)==null?void 0:_.context)==null?void 0:E.columnConfig)==null?void 0:v.MULTI_ROW_EDIT)==="1"&&((A=m.node)!=null&&A.selected)){const W=this.getGridOptions(d,"multiRowEdit");if(W!==!1&&W!=="0"){let J=!1;if((i==null?void 0:i.multiRowEditType)==="all"){const re=this.getGridSelectRows(r);(re==null?void 0:re.length)>0&&re.forEach(Se=>{m.data.uid!==Se.uid&&(Se.set(m.colDef.field,m.data[m.colDef.field]),J=!0)})}else{const re=[];r.gridOptions.api.forEachNodeAfterFilter(Se=>{var ue;Se!=null&&Se.selected&&((ue=Se.data)!=null&&ue.uid)&&Se.data.uid!==m.data.uid&&re.push(Se)}),re.forEach(Se=>{Se.data.set(m.colDef.field,m.data[m.colDef.field]),J=!0})}J&&m.api.refreshCells({columns:[m.colDef.colId,e.SysInfo.GridCheckColumnFieldName]})}}if(((B=m==null?void 0:m.context)==null?void 0:B.viewConfig.SHOW_FOOTER)==="1"){const W=m.api.getModel();m.api.setPinnedBottomRowData([{...(Q=W==null?void 0:W.rootNode)==null?void 0:Q.aggData,pinndeRowType:"ErGridSummaryFooter"}])}m.api.refreshCells({rowNodes:[m.node],columns:[e.SysInfo.GridCheckColumnFieldName,m.colDef.colId]})}})}}processRowSelectedEvent(r){var i,n;if(r.event){const c=((i=r.api)==null?void 0:i.getCellRanges())||[];if(c.length===1&&c[0].columns.length===1&&c[0].columns[0].colId===o.GridCheckColumnFieldName){const d=(n=r.api)==null?void 0:n.getModel();if(d){const p=[];for(let m=c[0].startRow.rowIndex;m<=c[0].endRow.rowIndex;m++){const _=d.getRow(m);_&&p.push(_)}r.api.setNodesSelected({nodes:p,newValue:r.node.isSelected()})}}}}getGridContextMenuItems(r,i){var c,d,p,m,_,E,v,A,B,Q,N,W,J,re,Se,ue,me;const n=[];if(r.api.getDisplayedRowCount()>0){n.push("copy","copyWithHeaders");const Z=this.getConfigInfo(r.context.configId),Te=[];if(Z.TSI00GRIDSTYLE&&Z.TSI00GRIDSTYLE.forEach(ce=>{(ce.NTYPE==="W_Fore"||ce.NTYPE==="W_Back")&&ce.REMARK.toUpperCase().trim().length>0&&Te.push({text:ce.REMARK,type:ce.NTYPE,fontName:ce.TEXT_COLOR,fontStyle:ce.FONTNAME,color:ce.FILL_COLOR})}),Te.length>0&&(n.push("separator"),n.push({name:this.$t("ERX.ErGrid.StyleDesc")||"样式说明",action:()=>{et.Modal.info({title:this.$t("ERX.ErGrid.StyleDesc")||"样式说明",type:"info",okText:this.$t("ERX.Close")||"关闭",content:()=>l.h("div",{style:{width:"100%"}},Te.map(ce=>l.h("span",{style:{[ce.type==="W_Fore"?"color":"backgroundColor"]:e.Core.toHexColor(ce.color),fontFamily:ce.fontName,fontStyle:ce.fontStyle==="Italic"?"italic":"normal",fontWeight:ce.fontStyle==="Bold"?"bold":"normal",display:"block",width:"100%",padding:"4px",marginBottom:"4px",boxSizing:"border-box",lineHeight:"1.2"}},ce.text)))})},icon:e.Core.createErSvgElement("style")})),(i==null?void 0:i.showDetailForm)!==!1&&r.node&&r.node.group!==!0&&r.node.rowPinned===void 0&&(n.push("separator"),n.push({name:this.$t("ERX.ErGrid.ShowDetailForm")||"查看明细",action:()=>{var ze,Me,ge,le,Y,Fe,ke,Ve,at,pt,ht,Ct,_t,Qe,U,gt;let ce=r.context.detailFormHelper;if(!ce){(Me=(ze=r.context)==null?void 0:ze.viewConfig)!=null&&Me.EDIT_COLS_COUNT;const rt=r.columnApi.columnModel.displayedColumns.length;let ct=Math.floor(rt/3)*30+120;ct<200?ct=200:ct>650&&(ct=650),ce=new I(this._serverPartition,this._formName,(ge=r.context)==null?void 0:ge.configId,this._serviceName),ce.setFormOptions({height:ct,title:`${r.context.configCaption||this.$t("ERX.ErGrid.ShowDetailForm")||"查看明细"}`}),ce.BordStyle="Sizable"}r.context.detailFormHelper=ce,(Y=(le=r.context)==null?void 0:le.options)!=null&&Y.detailItemValueChanged&&((ke=(Fe=r==null?void 0:r.context)==null?void 0:Fe.options)==null?void 0:ke.detailItemValueChanged)instanceof Function?ce.setEvent("itemValueChanged",(at=(Ve=r.context)==null?void 0:Ve.options)==null?void 0:at.detailItemValueChanged):ce.setEvent("ok",rt=>{var ct;(ct=rt.dataModel)!=null&&ct.dirty&&Object.keys(rt.dataModel.dirtyFields).forEach(Ze=>{r.node.setDataValue(Ze,rt.dataModel[Ze])})}),(ht=(pt=r.context)==null?void 0:pt.options)!=null&&ht.detailItemButtonClick&&((_t=(Ct=r.context)==null?void 0:Ct.options)==null?void 0:_t.detailItemButtonClick)instanceof Function&&ce.setEvent("itemButtonClick",(U=(Qe=r.context)==null?void 0:Qe.options)==null?void 0:U.detailItemButtonClick),ce.ReceiveData(r.node.data),ce.EditType=(gt=r.context)!=null&&gt.editable?"Modify":"Query",ce.show(null)},icon:e.Core.createErSvgElement("show-detail")})),((d=(c=r.node)==null?void 0:c.childrenAfterFilter)==null?void 0:d.length)>0&&r.node.group===!0&&r.node.footer!==!0&&n.push("separator","expandAll","contractAll"),i!=null&&i.allowImageUpload&&((_=(m=(p=r.column)==null?void 0:p.colDef)==null?void 0:m.cellRenderer)==null?void 0:_.name)==="ImagePreview"&&((v=(E=r.node)==null?void 0:E.data)!=null&&v.uid)&&!((B=(A=r.node)==null?void 0:A.data)!=null&&B.isNew)&&((N=(Q=r.column)==null?void 0:Q.colDef.context.columnConfig.EXT_OPTIONS)==null?void 0:N.trim().length)>0){const ce=JSON.parse((W=r.column)==null?void 0:W.colDef.context.columnConfig.EXT_OPTIONS);if(((J=ce==null?void 0:ce.imageUploadDir)==null?void 0:J.trim().length)>0&&((re=ce.imageUploadKeyField)==null?void 0:re.trim().length)>0){const ze=r.node.data[ce.imageUploadKeyField];if((ze==null?void 0:ze.trim().length)>0){let Me="";(Se=ce==null?void 0:ce.imageUploadDir)!=null&&Se.trim().startsWith("/")?Me=(ue=ce==null?void 0:ce.imageUploadDir)==null?void 0:ue.trim():Me=`/${(me=ce==null?void 0:ce.imageUploadDir)==null?void 0:me.trim()}`,Me=`${Me}/${ze==null?void 0:ze.trim()}`,n.push("separator"),n.push({name:this.$t("ERX.ErGrid.UploadImage")||"上传图片",action:()=>{const ge=new e.AttachmentHelper;ge.setOptions({relationId:Me,refreshKey:e.Core.guid(),readonly:!1,multiple:!0,maxCount:1,showFileDateTime:!0,showFileSize:!0,afterUpload(le){i!=null&&i.afterUpload&&i.afterUpload instanceof Function&&(r.file=le,i.afterUpload(r))},afterRemove(le){i!=null&&i.afterRemove&&i.afterRemove instanceof Function&&(r.file=le,i.afterRemove(r))}}),ge.showPopAttachment(null)}})}}}}if(r.api.isColumnFilterPresent()&&(n.push("separator"),n.push({name:this.$t("ERX.ErGrid.ClearAllColumnFilter")||"清除所有列过滤条件",action:()=>{r.api.setFilterModel(null)}})),i!=null&&i.customContextMenu&&i.customContextMenu instanceof Function){const Z=i.customContextMenu(r);Z&&Z.length>0&&(n.length>0&&n.push("separator"),n.push(...Z))}return n}setGridContextMenu(r,i){const n=this.getGrid(r);n&&(n.gridOptions.getContextMenuItems=c=>this.getGridContextMenuItems(c,i))}async showExtOptionsEdit(r,i,n,c,d,p,m=!1){var N,W,J;const _=new e.PopRichEditor({width:450,height:550,extension:"json"});let E="";if(c&&c.trim().length>0){const re=c.split(",");c=re[0],re.length>1&&(E=re[1])}const v={QUERY_TYPE:r,FORM_NAME:i||this._formName,FUNCTION_ID:n,ROW_GUID:c,COMPANY_CODE:p||this.DefaultConfigCompanyCode,ITEM_CODE:E},A=async()=>{const re=e.Core.buildEiInfo([v]);return await e.Core.callService(e.SysInfo.queryDevConfigService,re)};let B="";const Q=await A();Q.getStatus()>=0&&(B=e.Core.toString((J=(W=(N=Q.getBlockByIndex(0))==null?void 0:N.getMappedRows())==null?void 0:W[0])==null?void 0:J.EXT_OPTIONS,!0)),_.CancelButtonCaption=e.Core.$t("ERX.Close")||"关闭",_.CloseDialogWhenOkClick=m,_.setEvent("ok",async()=>{const re=_.Content,Se=e.Core.buildEiInfo([{...v,EXT_OPTIONS:re}],v.QUERY_TYPE.toUpperCase()),ue=await e.Core.callService(e.SysInfo.saveDevConfigService,Se);return ue.getStatus()<0?e.Core.messageError(ue.getMsg()):e.Core.messageSuccess(e.Core.$t("ERX.OperateSuccess")||"操作成功!"),ue.getStatus()>=0}),_.setOptions({title:v.QUERY_TYPE==="tsi00formext"?`Form Extend Options [${v.FORM_NAME}]`:v.QUERY_TYPE==="tsi00gridviewext"?`View Extend Options [${v.FORM_NAME}.${v.FUNCTION_ID}]`:`Item Extend Options [${v.FORM_NAME}.${v.FUNCTION_ID}.${E}]`}),_.show(null,B)}async showViewOptionsEdit(r,i,n,c=!1,d){var v,A,B,Q;let p={};const m=e.Core.buildEiInfo({QUERY_TYPE:"tsi00gridview",FORM_NAME:r,FUNCTION_ID:i}),_=await this.callService(e.SysInfo.queryDevConfigService,m);if(_.getStatus()<0){e.Core.messageError(_.getMsg());return}else if(((A=(v=_.getBlockByIndex(0))==null?void 0:v.getMappedRows())==null?void 0:A.length)===0){e.Core.messageError("Data not found!");return}else p=(Q=(B=_.getBlockByIndex(0))==null?void 0:B.getMappedRows())==null?void 0:Q[0];const E=new e.PopFreeHelper(n||this._serverPartition,p.FUNCTION_TYPE==="F"?"SI00LayoutEdit":p.FUNCTION_TYPE==="T"?"SI00TreeListEdit":"SI00GridViewEdit","LayoutGroupMain",this.InitialService);E.EditType="Modify",E.OkButtonService=e.SysInfo.saveDevConfigService,E.OkButtonCaption=e.Core.$t("ERX.Save")||"Save",E.CancelButtonCaption=e.Core.$t("ERX.Close")||"Close",E.CloseDialogWhenOkClick=c,E.ReceiveData(p),E.setEvent("open",N=>{d!=null&&d.open&&d.open instanceof Function&&d.open(N)}),d!=null&&d.colse&&d.colse instanceof Function&&E.setEvent("close",N=>{N.isModified&&d.colse(N)}),E.setEvent("itemButtonClick",async N=>{if(N.itemCode==="DATASET_NAME")if(N.type==="clear")E.FormHelper.setControlEmptyValue("LayoutGroupMain","DATASET_NAME,TABLE_NAME");else{const W=new e.PopTreeHelper("CURRENT_NODE_CODE","PARENT_NODE_CODE","CURRENT_NODE_DESC",{title:"DataSet Config List",nodeRenderer:Ti});W.BordStyle="Fixed";const J=async()=>{var Se;const re=await E.FormHelper.callService(e.SysInfo.queryDevConfigService,e.Core.buildEiInfo({OPERATE_TYPE:"tsi00datasettree"}));return re.getStatus()<0?(e.Core.messageError(re.getMsg()),[]):((Se=re.getBlockByIndex(0))==null?void 0:Se.getMappedRows())||[]};W.receiveData(J),W.BeforeOkButtonClick=re=>(re==null?void 0:re.NODE_TYPE)!=="DataTable"?!1:re,W.show(null,re=>{re!=null&&re.data&&(E.FormHelper.setControlValue("LayoutGroupMain","DATASET_NAME",re.data.DATASET_NAME),E.FormHelper.setControlValue("LayoutGroupMain","TABLE_NAME",re.data.DATATABLE_NAME))})}}),E.show(null)}async showFormOptionsEdit(r,i,n=!1,c){var v,A,B,Q,N,W;let d={},p=[],m=e.Core.buildEiInfo([{QUERY_TYPE:"TSI00MODULE",MODULE_TYPE:"15"}]),_=await this.callService(e.SysInfo.queryDevConfigService,m);if(_.getStatus()<0){e.Core.messageError(_.getMsg());return}else p=(A=(v=_.getBlockByIndex(0))==null?void 0:v.getMappedRows())==null?void 0:A.map(J=>({CODE:J.MODULE_ENAME,CODE_DESC_1_CONTENT:J.MODULE_CNAME}));const E=new e.PopFreeHelper(i||this._serverPartition,"SI00FormEdit","LayoutGroupMain",this.InitialService);if(E.EditType="Modify",E.OkButtonService=e.SysInfo.saveDevConfigService,E.OkButtonCaption=e.Core.$t("ERX.Save")||"Save",E.CancelButtonCaption=e.Core.$t("ERX.Close")||"Close",E.CloseDialogWhenOkClick=n,m=e.Core.buildEiInfo({QUERY_TYPE:"tsi00form",FORM_NAME:r}),_=await this.callService(e.SysInfo.queryDevConfigService,m),_.getStatus()<0){e.Core.messageError(_.getMsg());return}else if(((Q=(B=_.getBlockByIndex(0))==null?void 0:B.getMappedRows())==null?void 0:Q.length)===0){e.Core.messageError("Data not found!");return}else d=(W=(N=_.getBlockByIndex(0))==null?void 0:N.getMappedRows())==null?void 0:W[0];E.ReceiveData(d),E.setEvent("initial",()=>{E.FormHelper.reloadDropDownDataSource("LayoutGroupMain","MODULE_TYPE",p)}),E.setEvent("open",J=>{c!=null&&c.open&&c.open instanceof Function&&c.open(J)}),c!=null&&c.colse&&c.colse instanceof Function&&E.setEvent("close",J=>{c.colse(J)}),E.show(null)}getGridColumnDefs(r,i,n,c){var re,Se,ue,me,Z,Te,ce,ze,Me,ge;let d=[];this._gridColumnsConfigInfo[r]={},this._gridColumnsInfo[r]={},this._gridOptions[r]=this._gridOptions[r]||{};const p=i.TSI00GRIDVIEW[0],m=i.TSI00GRIDCOLUMN,_=i.TSI00GRIDVIEW[0].TABLE_NAME;this.setBindingTableName(r);const E=(re=this._formDataSet)==null?void 0:re.dataTables[_];E?(E.setBindingInfo(this,r,"Grid"),E.setAllowCancelChanges(c==null?void 0:c.allowCancelChanges)):console.error("ER: Could not find binding table of configuration ["+r+"]"),n.context={bindingSource:E,bindTableName:_,mergeColumns:[]};const v=[];this._gridOptions[r].styleConfigInfo={rowStyle:[],cellStyle:{}},i.TSI00GRIDSTYLE&&i.TSI00GRIDSTYLE.length>0&&i.TSI00GRIDSTYLE.forEach(le=>{(le.NTYPE==="W_Fore"||le.NTYPE==="W_Back")&&(le.COL_NAME.toUpperCase().trim().length===0?this._gridOptions[r].styleConfigInfo.rowStyle.push({type:le.NTYPE,fillColor:le.FILL_COLOR,fontFamily:le.TEXT_COLOR,fontStyle:le.FONTNAME,columnNames:le.COL_NAME.toUpperCase().trim(),condition:le.REGULAR_EXPRESS}):le.COL_NAME.toUpperCase().trim().split(",").forEach(Y=>{Y.trim().length>0&&(this._gridOptions[r].styleConfigInfo.cellStyle[Y]||(this._gridOptions[r].styleConfigInfo.cellStyle[Y]=[]),this._gridOptions[r].styleConfigInfo.cellStyle[Y].push({type:le.NTYPE,fillColor:le.FILL_COLOR,fontFamily:le.TEXT_COLOR,fontStyle:le.FONTNAME,columnNames:le.COL_NAME.toUpperCase().trim(),condition:le.REGULAR_EXPRESS}))}))});const A=this.getModelFields(E),B=[],Q={};let N,W;(((Se=c==null?void 0:c.viewType)==null?void 0:Se.toLowerCase())==="band"||((ue=c==null?void 0:c.viewType)==null?void 0:ue.toLowerCase())==="bandview"&&i.TSI00GRIDBAND&&i.TSI00GRIDBAND.length>0)&&this.createGridBandColumn(i.TSI00GRIDBAND,B,Q,void 0,c),B.length>0&&(d=B);let J={};for(let le=0;le<m.length;le++){const Y=m[le];if(Y.FUNCTION_TYPE=p.FUNCTION_TYPE,this._gridColumnsConfigInfo[r][Y.ITEM_CODE]=Y,B.length>0&&(Y.BAND_NAME.toString().trim().length===0||Q[Y.BAND_NAME.toString().trim()]===void 0))continue;let Fe;if(A&&A[Y.FIELD_NAME]&&A[Y.FIELD_NAME].type)Fe=A[Y.FIELD_NAME].type,Y.ITEM_MUST_FLAG==="1"&&(A[Y.FIELD_NAME].validation={required:!0});else if(Y.UNBOUND_TYPE!=="0")switch(Y.UNBOUND_TYPE){case"2":case"3":Fe="number";break;case"4":Fe="datetime";case"5":Fe="boolean";break;default:Fe="string";break}let ke=!1;Y.CUS_COL_FIX_TYPE?ke=Y.CUS_COL_FIX_TYPE==="L"?"left":Y.CUS_COL_FIX_TYPE==="R"?"right":!1:ke=Y.COL_FIX_TYPE==="L"?"left":Y.COL_FIX_TYPE==="R"?"right":!1,this.IsRtl&&(ke==="left"?ke="right":ke==="right"&&(ke="left"));const Ve=t.toHexColor(Y.HEAD_TEXTCOLOR),at=t.toHexColor(Y.HEAD_BACKCOLOR),pt=t.toNumber(Y.HEAD_FONTSIZE);let ht="";if(Y.ALLOW_EDIT==="1"&&Y.UNBOUND_TYPE==="0"&&i.TSI00GRIDSTYLE){const Ze=i.TSI00GRIDSTYLE.find(Ye=>{var st,mt;return Ye.NTYPE==="W_Hf4Edit"&&(((st=Ye.COL_NAME)==null?void 0:st.trim().length)===0||((mt=Ye.COL_NAME)==null?void 0:mt.includes(Y.FIELD_NAME)))});Ze&&(ht=t.toHexColor(Ze.FILL_COLOR))}J=c!=null&&c.columnOptions?c.columnOptions[Y.ITEM_CODE]:{};let Ct=Y.ALLOW_EDIT==="1";Fe==="boolean"&&(Ct=Y.ALLOW_EDIT==="1"&&Y.READ_ONLY!=="1"),c!=null&&c.columnOptions&&c.columnOptions[Y.ITEM_CODE]&&c.columnOptions[Y.ITEM_CODE].editable!==void 0&&(Ct=c.columnOptions[Y.ITEM_CODE].editable);const _t=p.ALLOW_CELLMERGE!=="1"&&Fe!=="boolean"&&((c==null?void 0:c.wrapText)===!0||e.Core.toString(c==null?void 0:c.wrapText).split(",").includes(Y.ITEM_CODE)),Qe={simpleHeader:c==null?void 0:c.simpleHeader,fontSize:pt>0?`${pt}px`:"unset",color:ht||Ve,backgroundColor:at,title:Y.COL_CAPTION},U=Y.CUS_GROUP_SORT_TYPE||Y.GROUP_SORT_TYPE;J={...J,pinned:ke,lockPosition:ke,colId:Y.ITEM_CODE,field:Y.FIELD_NAME,headerName:Y.COL_CAPTION,headerTooltip:c!=null&&c.enableHeaderTooltip?Y.COL_CAPTION.replaceAll("<br>","").replaceAll("</br>","").replaceAll("<br/>",""):void 0,headerComponentParams:{template:`${this.getGridHeaderTemplate(Qe)}`},headerClass:Ze=>{var st,mt,At,Rt,Qt,St,nr,Tt,tr,L,ae,q,ee,ne,se,be;let Ye="er-grid-header-align-center";return((At=(mt=(st=Ze.colDef)==null?void 0:st.context)==null?void 0:mt.columnConfig)==null?void 0:At.HEAD_HALIGNMENT)==="Near"?Ye="er-grid-header-align-left":((St=(Qt=(Rt=Ze.colDef)==null?void 0:Rt.context)==null?void 0:Qt.columnConfig)==null?void 0:St.HEAD_HALIGNMENT)==="Far"&&(Ye="er-grid-header-align-right"),((tr=(Tt=(nr=Ze.colDef)==null?void 0:nr.context)==null?void 0:Tt.columnConfig)==null?void 0:tr.ITEM_MUST_FLAG)==="1"&&((ee=(q=(ae=(L=Ze.colDef)==null?void 0:L.context)==null?void 0:ae.columnConfig)==null?void 0:q.MUST_INPUT_CONDITION)==null?void 0:ee.trim().length)>0?Ye=Ye+" er-grid-header-maroon-star":((be=(se=(ne=Ze.colDef)==null?void 0:ne.context)==null?void 0:se.columnConfig)==null?void 0:be.ITEM_MUST_FLAG)==="1"&&(Ye=Ye+" er-grid-header-red-star"),Ye},autoHeight:_t,suppressMovable:Y.ALLOW_MOVE==="0",sortable:Y.ALLOW_SORT==="1",resizable:Y.ALLOW_SIZE==="1",suppressSizeToFit:Y.BESTFIT!=="1",suppressColumnsToolPanel:(Y.ALLOW_SHOWHIDE==="0"||this.DevelopPermisson!=="1")&&Y.IS_VISIBLE!=="1",lockVisible:Y.ALLOW_SHOWHIDE==="0"||(c==null?void 0:c.groupDisplayType)==="multipleColumns"&&(U==="1"||U==="2"),width:t.toNumber(Y.CUS_COL_WIDTH)>0?t.toNumber(Y.CUS_COL_WIDTH):t.toNumber(Y.COL_WIDTH_WEB)>0?t.toNumber(Y.COL_WIDTH_WEB):t.toNumber(Y.COL_WIDTH)>0?t.toNumber(Y.COL_WIDTH):100,editable:Ze=>{var Ye,st,mt,At,Rt,Qt,St,nr,Tt,tr,L,ae,q,ee,ne;if(Ze.node.rowPinned||!((Ye=Ze.context)!=null&&Ye.editable))return!1;if(((st=Ze.column.context)==null?void 0:st.editable)!==void 0&&((mt=Ze.column.context)==null?void 0:mt.editable)instanceof Function)return(At=Ze.column.context)==null?void 0:At.editable(Ze);if(((Rt=Ze.column.context)==null?void 0:Rt.editable)!==void 0&&((Qt=Ze.column.context)==null?void 0:Qt.editable)!=="default")return(St=Ze.column.context)==null?void 0:St.editable;if(Ct!==!1){if(((nr=c==null?void 0:c.keyFields)==null?void 0:nr.trim().length)>0){if((Tt=c==null?void 0:c.keyFields)!=null&&Tt.includes(Ze.colDef.colId))return Ze.data.isNew}else if(((tr=p.KEY_FIELDS)==null?void 0:tr.trim().length)>0&&(L=p.KEY_FIELDS)!=null&&L.includes(Ze.colDef.colId))return Ze.data.isNew;return(q=(ae=Ze.colDef)==null?void 0:ae.context)==null?void 0:q.editable}else return(ne=(ee=Ze.colDef)==null?void 0:ee.context)==null?void 0:ne.editable},autoHeaderHeight:!0,enableRowGroup:!n.treeData,rowGroup:n.treeData?void 0:U==="1"||U==="2",sort:U==="2"?"desc":U==="1"?"asc":void 0,hide:Y.IS_VISIBLE!=="1"||Y.CUS_IS_VISIBLE!=="1"||(c==null?void 0:c.groupDisplayType)==="multipleColumns"&&(U==="1"||Y.GROUP_SORT_TYPE==="2"),context:{viewOptions:c,columnConfig:Y,editable:Ct,titleInfo:Qe}},(c==null?void 0:c.groupDisplayType)==="multipleColumns"&&(U==="1"||Y.GROUP_SORT_TYPE==="2")?J.hide=!0:Y.ALLOW_SHOWHIDE==="0"?J.hide=Y.IS_VISIBLE==="0":Y.ALLOW_SHOWHIDE==="1"&&(J.hide=Y.CUS_IS_VISIBLE==="0"||Y.CUS_IS_VISIBLE===""&&Y.IS_VISIBLE==="0"),J.filter="agMultiColumnFilter",J.filterParams={filters:[{filter:"agTextColumnFilter",filterParams:{buttons:(c==null?void 0:c.showApplyFilterButton)!==!1?["reset","apply"]:void 0,closeOnApply:c==null?void 0:c.closeOnApplyFilter,maxNumConditions:(c==null?void 0:c.maxNumConditions)||5}},{filter:"agSetColumnFilter",filterParams:{valueFormatter:c!=null&&c.showFilterCounts?Ze=>{const Ye=this.setGridColumnFilterCountsMap(Ze);return`${Ze.value||"("+this.$t("ERX.Null")+")"} (${Ye[Ze.value||"NullFilterValue"]||0})`}:void 0,showTooltips:!0,buttons:(c==null?void 0:c.showApplyFilterButton)!==!1?["reset","apply"]:void 0,closeOnApply:c==null?void 0:c.closeOnApplyFilter}}]},Y.AUTO_FILTER_CONDITION==="Default"||Y.AUTO_FILTER_CONDITION==="Contains"?J.filterParams.defaultOption="contains":Y.AUTO_FILTER_CONDITION==="Like"||Y.AUTO_FILTER_CONDITION==="StartsWith"?J.filterParams.defaultOption="startsWith":Y.AUTO_FILTER_CONDITION==="EndsWith"?J.filterParams.defaultOption="endsWith":J.filterParams.defaultOption="equals";const gt={};switch(Y.CELL_TEXTCOLOR.trim().length>0&&(gt.color=t.toHexColor(Y.CELL_TEXTCOLOR)),Y.CELL_BACKCOLOR.trim().length>0&&(gt.background=t.toHexColor(Y.CELL_BACKCOLOR)),t.toNumber(Y.CELL_FONTSIZE)>0&&(gt.fontSize=`${t.toNumber(Y.CELL_FONTSIZE)}px`),_t?gt.whiteSpace="pre-wrap":Y.SUMMARY_TYPE.includes("&")&&(gt.whiteSpace="pre"),Y.HALIGNMENT){case"Center":gt.textAlign="center",gt.justifyContent="center",Fe==="boolean"&&(gt.display="flex",gt.justifyContent="center");break;case"Far":gt.textAlign="right",gt.justifyContent="flex-end",Fe==="boolean"&&(gt.display="flex",gt.justifyContent="flex-end");break;case"Near":gt.textAlign="left",gt.justifyContent="flex-start",Fe==="boolean"&&(gt.display="flex",gt.justifyContent="flex-start");break;default:{Fe==="number"?(gt.textAlign="right",gt.justifyContent="flex-end"):Fe==="datetime"?(gt.textAlign="center",gt.justifyContent="center"):Fe==="boolean"&&(gt.display="flex",gt.justifyContent="center");break}}switch(Y.VALIGNMENT){case"Top":break;case"Bottom":break;default:{gt.display="flex",gt.alignItems="center";break}}N===void 0&&!J.hide&&(N=J),W===void 0&&!J.hide&&((this.IsRtl&&J.pinned)==="right"||!this.IsRtl&&J.pinned==="right")&&(W=J),J.context.dataType=Fe,J.context.cellStyles=gt;const rt=this._gridOptions[r].styleConfigInfo.cellStyle[Y.ITEM_CODE];if((Object.keys(gt).length>0||rt)&&(J.cellStyle=Ze=>{var st,mt,At,Rt;const Ye={...Ze.colDef.context.cellStyles};if(Ze.data&&!((st=Ze.node)!=null&&st.rowPinned)&&(rt==null?void 0:rt.length)>0)for(let Qt=0;Qt<rt.length;Qt++){const St=rt[Qt];if((((mt=St.condition)==null?void 0:mt.trim().length)===0||St.condition.trim().replaceAll(" ","")==="1=1"||t.checkExpressionValid(Ze.data,e.Core.getSystemFormatString(St.condition)))&&(St.type==="Foreground"||St.type==="W_Fore"?Ye.color=t.toHexColor(St.fillColor):(St.type==="Background"||St.type==="W_Back")&&(Ye.background=t.toHexColor(St.fillColor)),St.fontStyle&&St.fontStyle.trim().length>0))switch(St.fontStyle){case"Bold":Ye.fontWeight="bold";break;case"Italic":Ye.fontStyle="italic";break;case"Strikeout":Ye.textDecoration="line-through";break;case"Underline":Ye.textDecoration="underline";break}}return(At=Ze.node)!=null&&At.group&&(Ye.fontWeight="bold"),(Rt=Ze.node)!=null&&Rt.rowPinned&&(Ye.fontWeight="bold",delete Ye.color,delete Ye.background),Ye}),A&&A[Y.FIELD_NAME]){const Ze=Ye=>{let st="";return Ye==null||(typeof Ye=="string"?st=t.toString(Ye):typeof Ye=="number"?st=t.formatNumberValue(Ye,""):Wr.isPlainObject(Ye)&&(st=`☑️ ${t.formatNumberValue(Ye.aggValueOfChecked,"")}