@baosight/er4j 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,7 +31,7 @@
31
31
  `;return x.jQuery(`<div style="${d}">
32
32
  <div style="${p}">${a}</div>
33
33
  <div style="${u}"></div>
34
- </div>`)}static setLocalStorage(e,t){return(e==null?void 0:e.trim().length)>0&&localStorage.setItem(e.trim(),JSON.stringify(t)),localStorage}static debounce(e,t=100){let a;return(...l)=>{a&&clearTimeout(a),a=setTimeout(()=>{e(...l)},t)}}static getLocalStorage(e,t=!0){let a;return(e==null?void 0:e.trim().length)>0&&(a=x.toString(localStorage.getItem(e)),t&&localStorage.removeItem(e),a&&a.trim().length>0&&(a=JSON.parse(a))),a}static getCallFormParas(e,t=!0){return this.getLocalStorage(e,t)}static callForm(e,t,a=!0){}static copyText(e){const{toClipboard:t}=wa();e instanceof Array?e.forEach(a=>{}):e=String(e||""),(e==null?void 0:e.trim().length)>0&&t(e)}static readClipboardText(){return(navigator==null?void 0:navigator.clipboard.readText())||Promise.resolve("")}static async callService(e,t,a,l){return new Promise((r,c)=>{const d=(l==null?void 0:l.messageError)??!1;let u=new Ze.EiInfo;e.trim().length===0&&(u.SysInfo.Flag=-603,u.SysInfo.Msg="No service available",r(u));const p=e.split(/[\/.]/).filter(h=>h.trim().length>0);p.length<2&&(u.SysInfo.Flag=-603,u.SysInfo.Msg="Service name error",r(u)),a!=null&&a.show&&this.loading(!0,a),l!=null&&l.toCamelCase&&Object.keys(t.getBlocks()).forEach(h=>{const g=t.getBlock(h),I=g.getBlockMeta().getMetas(),b=new Ze.EiBlockMeta(g.getBlockId());Object.keys(I).forEach(S=>{const M=new Ze.EiColumn(x.camelCase(S));M.descName=I[S].name,M.type=I[S].type,b.addMeta(M)}),g.setBlockMeta(b)}),Ze.EiCommunicator.send(p[0],p[1],t,{onSuccess:h=>{this.loading(!1),u=h,u.getStatus()<0&&d&&this.messageError(u.getMsg(),d==="modal"),r(u)},onFail:h=>{this.loading(!1),d&&this.messageError(String(h),d==="modal"),console.error(h),u.SysInfo.Flag=-603,u.SysInfo.Msg=h==null?void 0:h.message,r(u)}})})}};y(x,"spinId","er-global-spin"),y(x,"spinCurrentContainer",null),y(x,"spinVnode",null),y(x,"spinCurrentTarget",null),y(x,"spinTimeoutId",null);let i=x;n.Core=i;class m{static get AppName(){return"ER4J"}static get Culture(){return"zh_cn"}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"}}n.SysInfo=m;class G extends Ze.EiInfo{constructor(t){var a;super();y(this,"sys");this.sys={status:0,name:"",descName:"",msg:"",msgKey:"",traceId:((a=this.SysInfo)==null?void 0:a.UUID)||i.guid()},t&&(this.SysInfo=t.SysInfo,Object.keys(t.getBlocks()).forEach(l=>{this.addBlock(t.getBlock(l))}))}blocks(){return this.getBlocks()}getBlock(t){return typeof t=="number"?super.getBlockByIndex(t):super.getBlock(t)}contains(t){return!!super.getBlock(t)}}n.EIInfo=G;class K extends _{constructor(t){super();y(this,"translateOptions",{});t&&(this.translateOptions=t)}setOptions(t){t&&(this.translateOptions={...this.translateOptions,...t})}translate(t,a){return new Promise((l,r)=>{this.setOptions(a);const c=[];if(t&&typeof t=="string"&&t.trim().length>0)c.push({text:t});else if(t&&t instanceof Array&&t.length>0)for(let d=0;d<t.length;d++)c.push({text:t[d]});c.length>0?bo({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":i.guid()},params:{"api-version":this.translateOptions.version||"3.0",from:this.translateOptions.from,to:this.translateOptions.to},data:c,responseType:this.translateOptions.responseType||"json"}).then(d=>{var u,p;if(((u=d==null?void 0:d.data)==null?void 0:u.length)===c.length){for(let h=0;h<d.data.length;h++)((p=d.data[h].translations)==null?void 0:p.length)>0&&d.data[h].translations.forEach(g=>{g.to&&(c[h][g.to]=g.text)});l({flag:!0,message:"success",result:typeof t=="string"?c[0]:c})}else l({flag:!1,message:"wrong result",result:d.data})}).catch(d=>{r(d)}):l({flag:!1,message:"未传入翻译文本"})})}}n.TranslateHelper=K;class L extends _{constructor(t){var a,l;super();y(this,"_uploadOptions",{});y(this,"_uploadConfigInfo",{});y(this,"_initialized",!1);y(this,"_maxBlobSize",204800);y(this,"_maxFileSize",10485760);t&&(this._uploadOptions=t),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions.url&&((a=this._uploadOptions.url)==null?void 0:a.trim().length)>0&&this._uploadOptions.rootDirectory&&((l=this._uploadOptions.rootDirectory)==null?void 0:l.trim().length)>0&&(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0)}get Initialized(){return this._initialized}async getUploadConfigInfo(t){var a,l;return n.Core.buildEiInfo([{CODE_CLASS:"EPTF"}]),t&&(t==null?void 0:t.trim().length)>0&&(this._uploadOptions.url=(a=this._uploadConfigInfo[t.trim()])==null?void 0:a.url,this._uploadOptions.rootDirectory=(l=this._uploadConfigInfo[t.trim()])==null?void 0:l.rootDirectory),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions}async initialize(t){var a,l;t&&(this._uploadOptions=t),this._uploadOptions.url&&((a=this._uploadOptions.url)==null?void 0:a.trim().length)>0&&this._uploadOptions.rootDirectory&&((l=this._uploadOptions.rootDirectory)==null?void 0:l.trim().length)>0?(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0):(await this.getUploadConfigInfo(),this._initialized=!0)}async getUploadUrl(t){var a;return this._initialized||await this.initialize(),t&&(t==null?void 0:t.trim().length)>0&&(this._uploadOptions.url=(a=this._uploadConfigInfo[t.trim()])==null?void 0:a.url),this._uploadOptions.url||""}getFileList(t,a){return new Promise(async(l,r)=>{var d,u;this._initialized||await this.getUploadConfigInfo(a),a&&(a==null?void 0:a.trim().length)>0&&(this._uploadOptions.url=(d=this._uploadConfigInfo[a.trim()])==null?void 0:d.url,this._uploadOptions.rootDirectory=(u=this._uploadConfigInfo[a.trim()])==null?void 0:u.rootDirectory);const c={pathInfo:[{key:t,name:t}]};bo.post(this._uploadOptions.url+`?command=GetDirContents&arguments=${JSON.stringify(c)}&_=${new Date().valueOf()}&rootDirectory=${this._uploadOptions.rootDirectory}`).then(p=>{var h,g,I;(h=p.data)!=null&&h.success?l({flag:!0,message:"获取文件成功",result:p.data.result}):(console.error("no files,"+((g=p.data)==null?void 0:g.result)),l({flag:!0,message:(I=p.data)==null?void 0:I.result,result:[]}))}).catch(p=>{console.error("get files failed",p),l({flag:!1,message:"获取文件失败",result:[]})})})}downloadFile(t){return new Promise(async(a,l)=>{var u;const r=(u=t.key)==null?void 0:u.split("/"),c=[];r.forEach((p,h)=>{const g={key:r.slice(0,h+1).join("/"),name:p};g.key!==""&&g.name!==""&&c.push(g)});const d=new URLSearchParams;d.append("command","Download"),d.append("arguments",JSON.stringify({pathInfoList:[c]})),d.append("rootDirectory",this._uploadOptions.rootDirectory||""),bo.post(this._uploadOptions.url||"",d,{responseType:"blob",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(p=>{a({flag:!0,message:"下载文件成功",result:p})}).catch(p=>{console.error("download files failed",p),a({flag:!1,message:"下载文件失败",result:[]})})})}previewFile(t){return new Promise(async(a,l)=>{var c;const r=t.key;bo.get(((c=this._uploadOptions.url)==null?void 0:c.replaceAll("file-manager",""))+`FilePriview?rootDirectory=${this._uploadOptions.rootDirectory}&filePath=${r}`).then(d=>{a({flag:!0,message:"获取文件预览信息成功",result:d})}).catch(d=>{console.error("download files failed",d),a({flag:!1,message:"获取文件预览信息失败",result:[]})})})}uploadFile(t,a,l){return new Promise(async(r,c)=>{var p,h,g,I,b,S;if(this._initialized||await this.getUploadConfigInfo(l),l&&(l==null?void 0:l.trim().length)>0&&(this._uploadOptions.url=(p=this._uploadConfigInfo[l.trim()])==null?void 0:p.url,this._uploadOptions.rootDirectory=(h=this._uploadConfigInfo[l.trim()])==null?void 0:h.rootDirectory,this._uploadOptions.maxBlobSize=(g=this._uploadConfigInfo[l.trim()])==null?void 0:g.maxBlobSize,this._uploadOptions.maxFileSize=(I=this._uploadConfigInfo[l.trim()])==null?void 0:I.maxFileSize),a.size>(this._uploadOptions.maxFileSize||this._maxFileSize)){n.Core.messageError("文件大小超过限制"),r({flag:!1,message:"文件大小超过限制"});return}const d=Math.ceil(a.size/(this._uploadOptions.maxBlobSize||this._maxBlobSize)),u=new Date().valueOf();for(let M=0;M<d;M++){const D=a.slice(M*(this._uploadOptions.maxBlobSize||this._maxBlobSize),(M+1)*(this._uploadOptions.maxBlobSize||2e5)),A={destinationPathInfo:[{key:t,name:t}],chunkMetadata:{UploadId:u,FileName:a.name,Index:M,TotalCount:d,FileSize:a.size}},V=new FormData;V.append("command","UploadChunk"),V.append("arguments",JSON.stringify(A)),V.append("chunk",D),V.append("rootDirectory",this._uploadOptions.rootDirectory||"");const P=await bo.post(this._uploadOptions.url||"",V,{headers:{"Content-Type":"multipart/form-data"}});if(P.status===200){if(!((b=P==null?void 0:P.data)!=null&&b.success)){n.Core.messageError("upload file failed "+((S=P==null?void 0:P.data)==null?void 0:S.result)),r({flag:!1,message:"上传文件失败"});break}}else{n.Core.messageError("upload file failed "+(P==null?void 0:P.statusText)),r({flag:!1,message:"上传文件失败"});break}}r({flag:!0,message:"上传文件成功"})})}removeFile(t,a,l){return new Promise(async(r,c)=>{var h,g;this._initialized||await this.getUploadConfigInfo(l),l&&(l==null?void 0:l.trim().length)>0&&(this._uploadOptions.url=(h=this._uploadConfigInfo[l.trim()])==null?void 0:h.url,this._uploadOptions.rootDirectory=(g=this._uploadConfigInfo[l.trim()])==null?void 0:g.rootDirectory);const d=a&&(a==null?void 0:a.trim().length)>0?`${t}/${a}`.split("/"):[t],u=[];d.forEach((I,b)=>{const S={key:d.slice(0,b+1).join("/"),name:I};S.key!==""&&S.name!==""&&u.push(S)});const p={pathInfo:u,isDirectory:(a==null?void 0:a.trim().length)===0};bo.post(this._uploadOptions.url+`?command=Remove&arguments=${encodeURIComponent(JSON.stringify(p))}&rootDirectory=${this._uploadOptions.rootDirectory}`,JSON.stringify({_:new Date().valueOf()}),{headers:{"Content-Type":"text/plain;charset=UTF-8"}}).then(I=>{var b,S,M;(b=I.data)!=null&&b.success?r({flag:!0,message:"删除文件成功"}):(console.error("remove file failed,"+((S=I.data)==null?void 0:S.result)),r({flag:!1,message:"删除文件失败:"+((M=I.data)==null?void 0:M.result)}))}).catch(I=>{console.error("remove file failed",I),r({flag:!1,message:"删除文件失败"})})})}}n.UploadHelper=L;class H{constructor(e,t,a,l){y(this,"_partition");y(this,"_companyCode");y(this,"_serviceName",n.SysInfo.queryDevConfigService);y(this,"_paraFilter");y(this,"_initializeSuccessed",!1);y(this,"_sysParasValue",{});e?this._partition=e:this._partition=m.Partiton,a?this._companyCode=a:this._companyCode=m.CompanyCode,l&&l.trim().length>0&&(this._serviceName=l.trim()),this._paraFilter=t}get Partiton(){return this._partition}get CompanyCode(){return this._companyCode}get InitializeSuccessed(){return this._initializeSuccessed}get SysParasValue(){return this._sysParasValue}async Initialize(e,t,a,l){return new Promise((r,c)=>{e&&e.trim().length>0&&(this._partition=e),a&&a.trim().length>0&&(this._companyCode=a),t&&(this._paraFilter=t);let d="",u="";if(this._paraFilter&&this._paraFilter.ParaCodes){let g=[];if(this._paraFilter.ParaCodes instanceof Array?g=this._paraFilter.ParaCodes:typeof this._paraFilter.ParaCodes=="string"&&(g=this._paraFilter.ParaCodes.split(",")),g.length>1)for(let I=0;I<g.length;I++)g[I].trim().length>0&&(u.length===0?u=`'${g[I]}'`:u+=`,'${g[I]}'`);else g.length>0&&(d=g[0].trim())}const p=new Ze.EiInfo,h=i.buildEiBlock([{COMPANY_CODE:this._companyCode,QUERY_TYPE:"system_paras",CTRL_TYPE:this._paraFilter?this._paraFilter.ParaMoudule:"",CTRL_CODE:d,CTRL_CODE_ARRAY:u}]);p.addBlock(h),l&&l.trim().length>0&&(this._serviceName=l.trim()),i.callService(this._serviceName,p).then(g=>{this._initializeSuccessed=g.SysInfo.Flag>=0,this._initializeSuccessed&&g.getBlockByIndex(0).getMappedRows().forEach(I=>{this._sysParasValue[I.CTRL_CODE]=I.CTRL_NUM}),r(this._initializeSuccessed)},()=>{r(!1)})})}getParaValue(e){return!i.isNullOrEmpty(e)&&this._initializeSuccessed?i.toString(this._sysParasValue[e]):""}}n.Be2SysParaInfo=H;class ${static setVariable(e,t,a){e.trim().length>0&&t.trim().length>0&&a!==void 0&&a!==null&&i.setLocalStorage(e+"_"+t,a)}static getVariable(e,t,a=!0){return i.getLocalStorage(e+"_"+t,a)}static clearVariable(e,t){e&&e.trim().length>0&&localStorage.removeItem(e+"_"+t)}static isNullOrEmpty(e,t){const a=i.getLocalStorage(e+"_"+t);return a==null}}n.SysGlobalVariables=$;class Q extends _{constructor(t,a,l){super();y(this,"dirty",!1);y(this,"dirtyFields",{});y(this,"uid","");y(this,"isNew",!1);y(this,"_dataTable");y(this,"_schemaFields",{});y(this,"_backup",{});this._schemaFields=a||{},this._dataTable=l,this.accept(t,this._schemaFields)}get schemaFields(){return this._schemaFields}get dataTable(){return this._dataTable}static getFieldDefaultValue(t){return t==null?void 0:t.defaultValue}shouldSerialize(t){return!["ID","isNew","uid","dirty","dirtyFields","_backup","_dataTable","_events","_schemaFields","_preview_row_data","_children_data",m.TreeHierarchyFieldName].includes(t)}forEach(t){for(const a in this)this.shouldSerialize(a)&&t(this[a],a)}toJSON(t){var l,r;let a={};for(const c in this)if(this.shouldSerialize(c)&&(a[c]=this[c],this._schemaFields&&this._schemaFields[c]))switch(this._schemaFields[c].type){case"boolean":a[c]=this[c]?"1":"0";break;case"datetime":a[c]?(vt.isDayjs(a[c])&&vt(a[c]).isValid()?a[c]=a[c].format("YYYYMMDDHHmmss"):a[c]instanceof Date?vt(a[c]).format("YYYYMMDDHHmmss"):typeof a[c]=="string"?a[c]=a[c].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):a[c]="",((l=a[c])==null?void 0:l.trim().length)===0||a[c].startsWith("1900")||a[c].startsWith("1901")||a[c].startsWith("0001")?a[c]="":this._schemaFields[c].maxLength>0?a[c]=a[c].padEnd(this._schemaFields[c].maxLength,"0").substring(0,this._schemaFields[c].maxLength):a[c]=a[c].padEnd(14,"0").substring(0,14)):a[c]="";break;case"time":a[c]?(vt.isDayjs(a[c])&&vt(a[c]).isValid()?a[c]=a[c].format("YYYYMMDDHHmmss"):a[c]instanceof Date?vt(a[c]).format("YYYYMMDDHHmmss"):typeof a[c]=="string"?a[c]=a[c].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):a[c]="",((r=a[c])==null?void 0:r.trim().length)===0||a[c].startsWith("1900")||a[c].startsWith("1901")||a[c].startsWith("0001")?a[c]="":this._schemaFields[c].maxLength>0&&this._schemaFields[c].maxLength<=6?a[c]=a[c].padEnd(this._schemaFields[c].maxLength,"0").substring(8,8+this._schemaFields[c].maxLength):a[c]=a[c].padEnd(14,"0").substring(8,14)):a[c]="";break;case"string":a[c]&&a[c]instanceof Array&&(a[c]=a[c].join(","));break;case"number":a[c]=n.Core.toNumber(a[c]);break;default:a[c]=this[c];break}return t&&(a={...a,...t}),a}setBackup(){this._backup=this.toJSON();for(const t in this)this.shouldSerialize(t)&&(this._backup[t]=this[t]);return this}getBackup(){return this._backup}get(t){return Reflect.get(this,t)}set(t,a,l,r=!1){var c;if(this.shouldSerialize(t))if(this._schemaFields[t]){switch(this._schemaFields[t].type){case"datetime":a=i.toDateTime(a,"Dayjs");break;case"boolean":a=i.toBoolean(a);break;case"number":a=i.toNumber(a);break;default:a=a;break}const d={};if(d.oldValue=this[t],d.newValue=a,this.dirtyFields[t]=!0,this.dirty=!0,Reflect.set(this,t,a),this._dataTable&&l!=="setData"){const u=o.isProxy(this._dataTable)?o.toRaw(this._dataTable):this._dataTable;(c=u.BingdingInfo)==null||c.forEach(h=>{if(h.formHelper&&h.configId&&h.configId!==l)if(h.controlType==="Grid"){const g=h.formHelper.getGrid(h.configId);if(g){const I={};I[t]=a,h.formHelper.setGridRowData(g,this.uid,I)}}else h.controlType});const p=u.getEvent("dataChanged");p&&(d.field=t,d.binddingInfo=u.BingdingInfo,p(d))}}else r===!1&&(this[t]=a);return this}reset(){return this.accept(void 0,this._schemaFields),this}setSchema(t,a=!0){return this._schemaFields=t,a&&this.reset(),this}setData(t,a,l=!1){var r;return t&&(Object.keys(t).forEach(c=>{if(this.shouldSerialize(c))if(this._schemaFields[c]){switch(this._schemaFields[c].type){case"datetime":t[c]=i.toDateTime(t[c],"Dayjs");break;case"boolean":t[c]=i.toBoolean(t[c]);break;case"number":t[c]=i.toNumber(t[c]);break}this.dirtyFields[c]=!0,this.dirty=!0,Reflect.set(this,c,t[c])}else l===!1&&(this[c]=t[c])}),this._dataTable&&((r=(o.isProxy(this._dataTable)?o.toRaw(this._dataTable):this._dataTable).BingdingInfo)==null||r.forEach(d=>{if(d.formHelper&&d.configId&&d.configId!==a&&d.controlType==="Grid"){const u=d.formHelper.getGrid(d.configId);u&&d.formHelper.setGridRowData(u,this.uid,t)}}))),this}addField(...t){return t&&t.length>0&&t.forEach(a=>{this._schemaFields&&a.name&&this._schemaFields[a.name]===void 0&&(this._schemaFields[a.name]=a,this[a.name]=a.defaultValue)}),this}reomveField(...t){return t&&t.length>0&&t.forEach(a=>{this._schemaFields&&a.name&&this._schemaFields[a.name]&&delete this._schemaFields[a.name]}),this}accept(t,a){if(a)for(const l in a){const r=a[l];if(r&&r.name&&r.type){const c=(t==null?void 0:t[r.name])??(t==null?void 0:t[i.camelCase(r.name)])??r.defaultValue;switch(r.type){case"datetime":this[r.name]=i.toDateTime(c,"Dayjs");break;case"boolean":this[r.name]=c==="1"||c===!0;break;case"number":this[r.name]=i.toNumber(c);break;case"string":this[r.name]=i.toString(c,!0);break;default:this[r.name]=c;break}}}return this.uid=i.guid(),this.dirty=!1,this.dirtyFields={},this}}n.Model=Q;class j extends _{constructor(t){super();po(this,pe);po(this,z,[]);po(this,le,[]);po(this,Se,[]);po(this,Ge,[]);po(this,xe);po(this,_e);po(this,Ae,!0);po(this,ke);po(this,Fe,[]);po(this,Ue,{});y(this,"tableName","");this.tableName="Table0",t=t||{schema:{}},this.init(t)}get options(){return Ee(this,xe)}get BingdingInfo(){return Ee(this,Fe)}get rowCount(){return Ee(this,z).length}get Current(){return Ee(this,_e)}get IsHierarchyTable(){var t,a,l,r;return i.toString((a=(t=Ee(this,xe))==null?void 0:t.hierarchy)==null?void 0:a.parentField,!0).length>0&&i.toString((r=(l=Ee(this,xe))==null?void 0:l.hierarchy)==null?void 0:r.primaryField,!0).length>0}init(t){t&&(Bt(this,xe,t),Bt(this,z,[]),Bt(this,le,[]),Bt(this,Se,[]),Bt(this,Ge,[]),Bt(this,_e,void 0))}setBindingInfo(t,a,l,r){t&&a&&a.trim().length>0&&!Ee(this,Fe).some(c=>{var d;return((d=c.formHelper)==null?void 0:d.FormId)===t.FormId&&c.configId===a})?Ee(this,Fe).push({formHelper:t,configId:a,dataTable:this,controlType:l}):Ee(this,Fe).some(c=>c.grid.gridId===r.gridId)||(r.gridOptions.context=r.gridOptions.context||{},r.gridOptions.context.bindingSource=this,Ee(this,Fe).push({grid:r,dataTable:this,controlType:l}))}removeBindingInfo(t,a,l){var r,c;for(let d=Ee(this,Fe).length-1;d>=0;d--)Ee(this,Fe)[d].configId===a&&((c=(r=Ee(this,Fe)[d])==null?void 0:r.formHelper)==null?void 0:c.FormId)===(t==null?void 0:t.FormId)?Ee(this,Fe).splice(d,1):l&&Ee(this,Fe)[d].grid.gridId===l.gridId&&(l.gridOptions.context.bindingSource&&delete l.gridOptions.context.bindingSource,Ee(this,Fe).splice(d,1))}setEvent(t,a){t&&(Ee(this,Ue)[t]=a)}getEvent(t){return Ee(this,Ue)[t]}setAllowCancelChanges(t){return Bt(this,ke,t),this}addField(...t){if(t&&t.length>0&&(t.forEach(a=>{a.name&&Ee(this,xe).schema&&Ee(this,xe).schema[a.name]===void 0&&(Ee(this,xe).schema[a.name]=a)}),Ee(this,z).length>0))for(let a=0;a<Ee(this,z).length;a++)Ee(this,z)[a].addField(...t);return this}removeField(...t){if(t&&t.length>0&&(t.forEach(a=>{a.name&&Ee(this,xe).schema&&Ee(this,xe).schema[a.name]===void 0&&delete Ee(this,xe).schema[a.name]}),Ee(this,z).length>0))for(let a=0;a<Ee(this,z).length;a++)Ee(this,z)[a].reomveField(...t);return this}get(t){for(let a=0;a<Ee(this,z).length;a++)if(Ee(this,z)[a].uid===t)return Ee(this,z)[a]}getRows(t,a=!1){const l=[],r=c=>{a instanceof Function?l.push(a(c)||c.toJSON()):l.push(a?c.toJSON():c)};switch(t){case"created":{Ee(this,Se).forEach(c=>{r(c)});break}case"updated":{Ee(this,z).forEach(c=>{c.dirty&&!c.isNew&&r(c)});break}case"removed":{Ee(this,Ge).forEach(c=>{r(c)});break}case"unchanged":{Ee(this,z).forEach(c=>{!c.dirty&&!c.isNew&&r(c)});break}case"original":{Ee(this,le).forEach(c=>{!c.dirty&&!c.isNew&&r(c)});break}case"all":{Ee(this,z).forEach(c=>{r(c)});break}}return l}getRowsAsBlock(t,a){const l=new Ze.EiBlock("Table0"),r=this.getRows(t,a??!0);if(r&&r.length>0){const c=[];if(Ee(this,xe).schema){const d=u=>{const p=new Ze.EiColumn(u.name);return p.type=u.type==="number"?"N":"C",p.descName=u.caption,p};Object.keys(Ee(this,xe).schema).forEach(u=>{var h;const p=d((h=Ee(this,xe).schema)==null?void 0:h[u]);l.addColumn(p),c.push({name:p.name,type:p.type})})}r.forEach(d=>{const u=[];c.forEach(p=>{u.push(d[p.name])}),l.addRow(u)})}return l}at(t){return Ee(this,z).at(t)}indexOf(t){if(t&&t.uid.length>0){for(let a=0;a<Ee(this,z).length;a++)if(Ee(this,z)[a].uid===t.uid)return a}return-1}setCurrent(t,a){var d;const l={},r=((d=Ee(this,_e))==null?void 0:d.uid)||"",c=(t==null?void 0:t.uid)||"";l.bindingInfo=Ee(this,Fe),l.oldCurrent=Ee(this,_e),l.current=t,l.source=a,Bt(this,_e,t),r!==c&&fo(this,pe,Co).call(this,"currentChanged",l)}insert(t,a,l){let r;return a&&(r=new Q(a,Ee(this,xe).schema,this),l&&l.trim().length>0&&r[l]!==void 0&&(r[l]=i.guid()),r.isNew=!0,Ee(this,z).splice(t,0,r),Ee(this,Se).push(r),fo(this,pe,Co).call(this,"dataInserted",{bindingInfo:Ee(this,Fe),insertAt:t,current:r}),this.setCurrent(r)),r}add(t,a){const l=new Q(t,Ee(this,xe).schema,this);return a&&a.trim().length>0&&l[a]!==void 0&&(l[a]=i.guid()),l.isNew=!0,Ee(this,z).push(l),Ee(this,Se).push(l),fo(this,pe,Co).call(this,"dataAdded",{bindingInfo:Ee(this,Fe),current:l}),this.setCurrent(l),l}import(t,a=-1,l=!0,r){const c=[];return(t==null?void 0:t.length)>0&&(t.forEach(d=>{d instanceof Q&&(d=d.toJSON());const u=new Q(d,Ee(this,xe).schema,this);r&&r.trim().length>0&&u[r]!==void 0&&(u[r]=i.guid()),u.isNew=l,c.push(u)}),a<0?Ee(this,z).push(...c):Ee(this,z).splice(a,0,...c),Ee(this,Se).push(...c),fo(this,pe,Co).call(this,"dataImported",{bindingInfo:Ee(this,Fe),models:c,insertAt:a,current:c[t.length-1]}),this.setCurrent(c[t.length-1])),c}remove(t){if(!t)return;let a=[];t instanceof Array&&t.length>0?a=t:t&&(a=[t]);let l=!1;const r=[];if(a.length>0){let c=-1,d=-1;if(a.forEach(u=>{var p;if(c=Ee(this,z).findIndex(h=>h.uid===u.uid),(d<0||c<d)&&(d=c),c!==-1){if(l||(l=Ee(this,z)[c].uid===((p=Ee(this,_e))==null?void 0:p.uid)),Ee(this,z)[c].isNew){const h=Ee(this,Se).indexOf(Ee(this,z)[c]);h>=0&&Ee(this,Se).splice(h,1)}else Ee(this,Ge).push(Ee(this,z)[c]);r.push(Ee(this,z)[c]),Ee(this,z).splice(c,1)}}),r.length>0&&fo(this,pe,Co).call(this,"dataRemoved",{bindingInfo:Ee(this,Fe),models:r}),l){let u;Ee(this,z).length>0&&(Ee(this,z).length===d?u=Ee(this,z)[d-1]:u=Ee(this,z)[d]),this.setCurrent(u)}}}setRowState(t,a){let l=this.indexOf(t);if(l<0&&(Ee(this,z).push(t),l=Ee(this,z).length-1),l>=0){Ee(this,z)[l].dirty=a==="updated",Ee(this,z)[l].isNew=a==="added";const r=Ee(this,Se).findIndex(c=>c.uid===t.uid);a==="added"&&r<0?Ee(this,Se).push(t):r>=0&&Ee(this,Se).splice(r,1),fo(this,pe,Co).call(this,"rowStateChanged",{bindingInfo:Ee(this,Fe),model:Ee(this,z)[l],state:a})}}clear(){return Bt(this,z,[]),Bt(this,le,[]),Bt(this,Se,[]),Bt(this,Ge,[]),Bt(this,_e,void 0),fo(this,pe,Co).call(this,"dataCleared",{bindingInfo:Ee(this,Fe)}),this}merge(t,a=!0,l=!1){var d,u,p,h,g;const r=[],c=Ee(this,z).length>0;if(a&&(Bt(this,z,[]),Bt(this,le,[]),Bt(this,Se,[]),Bt(this,Ge,[])),t!==void 0&&t.length>0&&((d=this.options)!=null&&d.schema)){const I=this.options.schema,b=Object.keys(t[0]),S=Object.keys(I),M=S.filter(N=>b.includes(N)||b.includes(i.camelCase(N))),D=S.filter(N=>!b.includes(N)&&!b.includes(i.camelCase(N))),A=new Map,V=i.toString((p=(u=Ee(this,xe))==null?void 0:u.hierarchy)==null?void 0:p.primaryField,!0),P=i.toString((g=(h=Ee(this,xe))==null?void 0:h.hierarchy)==null?void 0:g.parentField,!0),J=V.length>0&&P.length>0&&I[V]&&I[P];for(let N=0;N<t.length;N++){const te=new Q(void 0,void 0,this);te.setSchema(I,!1),M.forEach(R=>{switch(I[R].type){case"datetime":te[R]=i.toDateTime(t[N][R]??t[N][i.camelCase(R)],"Dayjs");break;case"boolean":te[R]=i.toBoolean(t[N][R]??t[N][i.camelCase(R)]);break;case"number":te[R]=i.toNumber(t[N][R]??t[N][i.camelCase(R)]);break;case"string":te[R]=i.toString(t[N][R]??t[N][i.camelCase(R)],!0);break;default:te[R]=t[N][R]??t[N][i.camelCase(R)];break}}),D.forEach(R=>{switch(I[R].type){case"datetime":te[R]=null;break;case"boolean":te[R]=!1;break;case"number":te[R]=0;break;case"string":te[R]="";break;default:te[R]=null;break}}),te.isNew=l,r.push(te),Ee(this,z).push(te),J&&te[V]&&A.set(te[V],te)}if(J){const N=te=>{const R=[];for(;te;)R.unshift(te[V]),te=A.get(te[P]);return R};for(let te=0;te<Ee(this,z).length;te++)Ee(this,z)[te][m.TreeHierarchyFieldName]=N(Ee(this,z)[te])}fo(this,pe,aa).call(this),fo(this,pe,Co).call(this,"dataMerged",{bindingInfo:Ee(this,Fe),models:r,current:Ee(this,z)[0]}),this.setCurrent(Ee(this,z)[0])}else Bt(this,_e,void 0),c&&fo(this,pe,Co).call(this,"dataMerged",{bindingInfo:Ee(this,Fe),models:r,current:void 0});return r}hasChanges(){if(Ee(this,Ge).length)return!0;for(let t=0;t<Ee(this,z).length;t++)if(Ee(this,z)[t].isNew||Ee(this,z)[t].dirty)return!0;return!1}acceptChanges(){return Bt(this,Se,[]),Bt(this,Ge,[]),Ee(this,z).forEach(t=>{t.isNew=!1,t.dirty=!1,t.dirtyFields={}}),fo(this,pe,aa).call(this),this}cancelChanges(){return Ee(this,Ae)&&(Bt(this,Se,[]),Bt(this,Ge,[]),Bt(this,z,mo.cloneDeep(Ee(this,le))),fo(this,pe,Co).call(this,"dataMerged",{bindingInfo:Ee(this,Fe),models:Ee(this,z),current:void 0})),this}totalCount(){return Ee(this,z).length}data(t){return t!==void 0&&t.length>0&&this.merge(t,!0,!1),Ee(this,z)}originalCopy(){return mo.cloneDeep(Ee(this,le))}originalModel(t){for(let a=0;a<Ee(this,le).length;a++)if(Ee(this,le)[a].uid===t)return mo.cloneDeep(Ee(this,le)[a])}}z=new WeakMap,le=new WeakMap,Se=new WeakMap,Ge=new WeakMap,xe=new WeakMap,_e=new WeakMap,Ae=new WeakMap,ke=new WeakMap,Fe=new WeakMap,Ue=new WeakMap,pe=new WeakSet,Co=function(t,a){var r;(r=Ee(this,Fe))==null||r.forEach(c=>{var d,u,p,h,g,I,b,S,M,D,A,V,P,J,N,te,R,me,fe,X,q,v,O,ge,se,ze,tt,at,qe,T;if(c.formHelper&&c.configId)if(c.controlType==="Grid"){const ye=c.formHelper.getGrid(c.configId);if((d=ye==null?void 0:ye.gridOptions)!=null&&d.api)switch(t){case"dataMerged":{const et=ye.gridOptions.api.getFilterModel(),rt=ye.gridOptions.columnApi.getColumnState().filter(He=>He.sort!==null);Object.keys(et).length===0&&rt.length===0&&ye.gridOptions.context.calculateRowSpan&&ye.gridOptions.context.calculateRowSpan instanceof Function&&ye.gridOptions.context.calculateRowSpan(!0),(p=(u=ye.gridOptions)==null?void 0:u.api)==null||p.clearRangeSelection(),ye.gridOptions.context.focusRowId="",ye.gridOptions.context.focusColId="",ye.gridOptions.context.dataMerged=!0,(g=(h=ye.gridOptions)==null?void 0:h.api)==null||g.setRowData(Ee(this,z));let Oe=Ee(this,z).length.toString().length*7+20;((b=(I=ye.gridOptions.context)==null?void 0:I.viewConfig)==null?void 0:b.SHOW_SELECTION)==="1"&&(Oe+=20),(S=ye.gridOptions.context)!=null&&S.allowDragRow&&(Oe+=21),((D=(M=ye.gridOptions.context)==null?void 0:M.options)==null?void 0:D.masterDetail)===!0&&(Oe+=22);const We=(V=(A=ye.gridOptions.columnApi)==null?void 0:A.columnModel)==null?void 0:V.gridColumns,Je=We==null?void 0:We.find(He=>He.colId===m.GridCheckColumnFieldName);Je&&ye.gridOptions.columnApi.setColumnWidth(Je,Oe);break}case"dataCleared":{(J=(P=ye.gridOptions)==null?void 0:P.api)==null||J.setRowData([]);break}case"dataRemoved":{if(ye.gridOptions.api.applyTransaction({remove:a.models}),((te=(N=ye.gridOptions.context)==null?void 0:N.options)==null?void 0:te.showRowNo)!==!1&&(ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]}),ye.gridOptions.context.focusRowId)){const et=(R=ye==null?void 0:ye.gridOptions)==null?void 0:R.api.getRowNode(ye.gridOptions.context.focusRowId);et&&(ye.gridOptions.context.focusRowId=et.id,ye.gridOptions.context.focusColId||(ye.gridOptions.context.focusColId=n.SysInfo.GridCheckColumnFieldName),c.formHelper.setGridFocusedCell(ye,et.rowIndex,ye.gridOptions.context.focusColId))}break}case"dataAdded":{ye.gridOptions.api.applyTransaction({add:[a.current]}),ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]});const et=(fe=(me=ye.gridOptions.context)==null?void 0:me.viewConfig)==null?void 0:fe.AUTO_SELECT_MODE;(et==="1"||et==="3")&&((X=c.formHelper)==null||X.checkGridRow(c.configId,a.current));break}case"dataInserted":{a.insertAt>=0?ye.gridOptions.api.applyTransaction({add:[a.current],addIndex:a.insertAt}):ye.gridOptions.api.applyTransaction({add:[a.current]}),ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]});const et=(v=(q=ye.gridOptions.context)==null?void 0:q.viewConfig)==null?void 0:v.AUTO_SELECT_MODE;(et==="1"||et==="3")&&c.formHelper.checkGridRow(c.configId,a.current);break}case"dataImported":{a.insertAt>=0?ye.gridOptions.api.applyTransaction({add:a.models,addIndex:a.insertAt}):ye.gridOptions.api.applyTransaction({add:a.models}),ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]});const et=(ge=(O=ye.gridOptions.context)==null?void 0:O.viewConfig)==null?void 0:ge.AUTO_SELECT_MODE;(et==="1"||et==="3")&&c.formHelper.checkGridRow(c.configId,a.models);break}case"currentChanged":{if(Ee(this,_e)&&a.source!==c.configId&&((ze=(se=ye.gridOptions.context)==null?void 0:se.options)==null?void 0:ze.suppressDefaultFocusedCell)!==!0){const et=(at=ye==null?void 0:ye.gridOptions)==null?void 0:at.api.getRowNode((tt=Ee(this,_e))==null?void 0:tt.uid);(T=(qe=ye.gridOptions)==null?void 0:qe.api)==null||T.clearFocusedCell(),et&&(ye.gridOptions.context.focusColId||(ye.gridOptions.context.focusColId=n.SysInfo.GridCheckColumnFieldName),c.formHelper.setGridFocusedCell(ye,et.rowIndex,ye.gridOptions.context.focusColId))}break}}}else c.controlType==="Layout"&&t==="currentChanged"&&c.formHelper.refreshLayoutBindModel(c.configId)});const l=Ee(this,Ue)[t];l&&l instanceof Function&&l(a)},aa=function(){Ee(this,ke)||Ee(this,ke)===void 0&&Ee(this,z).length<=500?(Bt(this,le,mo.cloneDeep(Ee(this,z))),Bt(this,Ae,!0)):(Bt(this,le,[]),Bt(this,Ae,!1))},n.DataTable=j;class U{constructor(e){y(this,"dataSetName","");y(this,"dataTables");y(this,"relations");this.dataTables={},this.relations={},this.dataSetName=(e==null?void 0:e.trim())||""}get Name(){return this.dataSetName}setName(e){return this.dataSetName=(e==null?void 0:e.trim())||"",this}addDataTable(e,t){return t.tableName=e,this.dataTables[e]=t,this}removeDataTable(e){return this.contains(e)&&delete this.dataTables[e.trim()],this}renameDataTable(e,t){return this.contains(e)&&!this.contains(t)&&e.trim().toUpperCase()!==t.trim().toUpperCase()&&(this.addDataTable(t.trim().toUpperCase(),this.dataTables[e.trim().toUpperCase()]),delete this.dataTables[e.trim().toUpperCase()]),this}copyDataTable(e,t){let a,l;return e instanceof j?a=e:typeof e=="string"&&(a=this.dataTables[e]),a&&a.options&&(l=new j(a.options)),t&&t.trim().length>0&&!this.contains(t)&&(this.dataTables[t.trim()]=l),l}cloneDataTable(e,t){const a=this.copyDataTable(e,t);return a.data([]),a}getDataTable(e){return this.dataTables[e]}getTableName(e){let t;return Object.keys(this.dataTables).every(a=>this.dataTables[a]===e?(t=a,!1):!0),t}clear(...e){let t=Object.keys(this.dataTables);return e.length>0&&(t=e),t.forEach(a=>{this.dataTables[a]&&this.dataTables[a]instanceof j&&this.dataTables[a].clear()}),this}mergeData(e,t,a=!0,l=!1){return(e==null?void 0:e.trim().length)>0&&this.contains(e.trim())&&t&&this.dataTables[e].merge(t,a,l),this}mergeDataFromEIInfo(e,t="",a=!0){var l;if(t&&t.trim().length>0&&this.contains(t.trim())){const r=(l=e.getBlock(t.trim()))==null?void 0:l.getMappedRows();this.mergeData(t.trim(),r,a)}else Object.keys(this.dataTables).forEach(r=>{r.trim().length>0&&this.dataTables[r.trim()]&&e.getBlock(r.trim())&&this.mergeData(r.trim(),e.getBlock(r.trim()).getMappedRows(),a)});return this}getCurrentDataObject(e){let t;return(e==null?void 0:e.trim().length)>0&&this.contains(e.trim())&&(t=this.dataTables[e].Current),t}tablesCount(){return this.dataTables?Object.keys(this.dataTables).length:0}contains(e){return e&&e.trim().length>0?this.dataTables[e.trim()]!==void 0:!1}isEmpty(){return!(this.dataTables&&Object.keys(this.dataTables).length>0)}hasChanges(e){if(this.dataTables){if(e&&e.trim().length>0&&this.dataTables[e.trim()])return this.dataTables[e.trim()].hasChanges();{const a=Object.keys(this.dataTables);for(let l=0;l<a.length;l++)if(this.dataTables[a[l]].hasChanges())return!0}}return!1}hasRelation(e){return this.dataTables&&e&&e.trim().length>0&&this.relations[e.trim()]&&this.relations[e.trim()].length>0}acceptChanges(){return Object.keys(this.dataTables).forEach(t=>{this.dataTables[t]&&this.dataTables[t]instanceof j&&this.dataTables[t].acceptChanges()}),this}}n.DataSet=U;class Y{constructor(e,t,a,l,r){y(this,"SysDefinedParas");y(this,"_app");y(this,"_currentFormRegitInfo",{});y(this,"_currentConfigCompanyCode");y(this,"_serverPartition","");y(this,"_customPartition","");y(this,"_moduleName","");y(this,"_formId","");y(this,"_formName","");y(this,"_formCaption","");y(this,"_formWidth",-1);y(this,"_formHeight",-1);y(this,"_maxmizeBox",!0);y(this,"_minimizeBox",!0);y(this,"_resizable",!0);y(this,"_initializeFlag",0);y(this,"_layoutIds");y(this,"_dataSetName","");y(this,"_tableNames","");y(this,"_serviceName","JAER01/getFormConfig");y(this,"_initialConfiParas",{});y(this,"_configInfo",{});y(this,"_systemInfo",{});y(this,"_customDefaultValues",{});y(this,"_dropDownRefreshKey",o.reactive({}));y(this,"_dropDownBindSource",{});y(this,"_dropDownCascader",{});y(this,"_gridOptions",{});y(this,"_gridReactiveOptions",o.reactive({}));y(this,"_gridToolbarOptions",o.reactive({}));y(this,"_hiddenFields",{});y(this,"_requiredFields",{});y(this,"_requiredFieldsByCondition",{});y(this,"_formDataSet",new U);y(this,"_formBindingRelation",{});y(this,"_formAuthButtons",{});y(this,"_groupCompanyCode","");y(this,"_groupCompanyName","");y(this,"_formConfigLicens","");y(this,"_formConfigLicensErrorMsg","WMyNCZMrw9FY9qti+0p7zA==");y(this,"_privateEncryptKey","QTS8kH81A2Do4qfezJ9cCEM4lZifC7Ym");y(this,"_developPermisson","0");y(this,"_tempSingleConfigInfo",{});y(this,"_gridInstanceInfo",{});y(this,"_gridColumnsInfo",{});y(this,"_gridColumnsConfigInfo",{});y(this,"_gridStyleInfo",{});y(this,"_allowMergeColumnFields",{});y(this,"_widgetInstanceInfo",{});y(this,"_layoutConditionStyleInfo",{});y(this,"_layoutConfigRelationInfo",{});y(this,"_sysParaInfo",{});y(this,"_gridCustomEvent",{});y(this,"_formOptions",{});y(this,"_layoutOpitons",o.reactive({}));y(this,"_layoutItemOpitons",o.reactive({}));y(this,"_layoutBindModelUid",o.reactive({}));y(this,"_layoutBindModel",{});y(this,"_controlConditionProps",{});y(this,"_erxGlobalConfig",{});y(this,"excuteGridColumnExpressions",(e,t)=>{const a={...e},l=Object.keys(a).sort((c,d)=>c.length>d.length?-1:c.length<d.length?1:0);let r=t;l.forEach(c=>{vt.isDayjs(a[c])?a[c]=a[c].toDate():(a[c]===null||a[c]===void 0)&&(a[c]="");const d=new RegExp(`\\b${c}\\b`,"gi"),u=new RegExp(`[${c}]`.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");u.test(r)?r=r.replaceAll(u,`data.${c}`):d.test(r)&&(r=r.replaceAll(d,`data.${c}`))});try{return new Function("data",r)(a)}catch{console.error("ER: Script has a syntax error: "+r+"; data: "+JSON.stringify(a))}});this._formId=i.guid(),this._serverPartition=e||this._serverPartition,this._serviceName=a||this._serviceName,this._formName=t||this._formName,this._layoutIds=l,this._initialConfiParas=r,this._currentConfigCompanyCode={},this.SysDefinedParas={GroupCompanyCode:"BS",GroupCompanyName:"宝信软件",DefaultRmbCode:"CNY"}}get App(){return this._app}get CurrentFormRegitInfo(){return this._currentFormRegitInfo}get Locale(){return wo()}get IsRtl(){return _o()}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(e,t,a,l,r){var d,u,p,h;this._erxGlobalConfig=await n.Core.getErxGlobalConfig(),(u=(d=this._erxGlobalConfig)==null?void 0:d.License)!=null&&u[n.SysInfo.CompanyCode]&&(this._formConfigLicens=(h=(p=this._erxGlobalConfig)==null?void 0:p.License)==null?void 0:h[n.SysInfo.CompanyCode]);const c=i.decryptData(this._formConfigLicens,n.SysInfo.GridCheckColumnFieldName,i.decryptData(this._privateEncryptKey,n.SysInfo.GridCheckColumnFieldName,n.SysInfo.GridCheckColumnFieldName));return this._erxGlobalConfig&&(!this._formConfigLicens||c!==m.CompanyName)&&this.messageWarning(i.decryptData(this._formConfigLicensErrorMsg,n.SysInfo.GridCheckColumnFieldName,n.SysInfo.GridCheckColumnFieldName)),new Promise((g,I)=>{var M;this._serverPartition=(e==null?void 0:e.trim())||this._serverPartition,this._serviceName=(l==null?void 0:l.trim())||this._serviceName,this._formName=(t==null?void 0:t.trim())||this._formName,this._initialConfiParas=r||this._initialConfiParas||{},this._layoutIds=a||this._layoutIds;let b="";this._layoutIds&&(typeof this._layoutIds=="string"?b=this._layoutIds:this._layoutIds instanceof Array&&(b=this._layoutIds.join(","))),this._dataSetName=((M=this._dataSetName)==null?void 0:M.trim())||"#";const S=new Ze.EiInfo;if(S.addBlock(i.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:b,DATASET_NAME:this._dataSetName,TABLE_NAMES:this._tableNames}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const D=new Ze.EiBlock("InitializeFormParas");D.addColumn("PARA_NAME"),D.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(A=>{D.addRow([{PARA_NAME:A,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[A]:""}])}),S.addBlock(D)}n.Core.callService(this._serviceName,S).then(D=>{var A,V,P;D.getStatus()>=0?(Object.keys(D.getBlocks()).forEach(J=>{this._configInfo[J]=D.getBlock(J)}),((P=(V=(A=this._configInfo)==null?void 0:A.TSI00FORM)==null?void 0:V.getMappedRows())==null?void 0:P.length)>0?(this.InitializeWithData(),g({flag:this._initializeFlag,msg:"success"})):(this._initializeFlag=-1,g({flag:this._initializeFlag,msg:`The configuration information for the form [${this._formName}] was not found!`}))):(this._initializeFlag=-1,g({flag:this._initializeFlag,msg:D.getMsg()??"unknown error"}))},D=>{g({...D,flag:-1,msg:"unknown error"})})})}InitializeWithData(){var a,l,r,c,d,u;this._initializeFlag=1;let e=n.SysInfo.CompanyCode;e||(e=this.DefaultConfigCompanyCode);const t=this._configInfo.TSI00FORM.getMappedRows()[0];this._moduleName=t.MODULE_NAME,this.ModuleName.length<2?this._moduleName="GC":this._moduleName=this.ModuleName.substring(0,2),this._formName=t.FORM_NAME,this._formWidth=n.Core.toNumber(t.FORM_WIDTH)||800,this._formHeight=n.Core.toNumber(t.FORM_HEIGHT)||650,this._formCaption=t.FORM_FUNC_DESC,this._minimizeBox=t.MINIMIZE==="1",this._maxmizeBox=t.MAXIMIZE==="1",this._resizable=t.FORM_STYLE!=="3",this._formConfigLicens=t.LICENSE,this._groupCompanyCode=((a=t.GROUP_COMPANY_CODE)==null?void 0:a.trim())||this._groupCompanyCode,this._groupCompanyName=((l=t.GROUP_COMPANY_NAME)==null?void 0:l.trim())||this._groupCompanyName,this._configInfo.BM2A_SYSTEM_INFO&&(this._systemInfo=this._configInfo.BM2A_SYSTEM_INFO.getMappedRows()[0],this._developPermisson=this.getFormSysInfo("DEV_LICENSE")),((r=t.EXT_OPTIONS)==null?void 0:r.trim().length)>0&&(this._formOptions=JSON.parse(t.EXT_OPTIONS)),((u=(d=(c=this._configInfo)==null?void 0:c.TSI00GRIDVIEW)==null?void 0:d.getMappedRows())==null?void 0:u.length)>0?(this.createDataSet(),this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(p=>{this.setDropDownBindSourceAndRequiredFields(p)})):console.error("ER: No view configuration information found!")}setMenuFormInstance(e){var t,a,l,r,c,d;if(e){const u=(t=e==null?void 0:e.attrs)==null?void 0:t.__eiInfo;this._currentFormRegitInfo.formInfo=u==null?void 0:u.extAttr,this._currentFormRegitInfo.formQueryParams=n.Core.getQueryParams((a=u==null?void 0:u.extAttr)==null?void 0:a.efFormLoadPath),this._currentFormRegitInfo.formButtons={},(r=(l=e==null?void 0:e.attrs)==null?void 0:l.__buttonsEi)!=null&&r.blocks&&Object.keys((d=(c=e==null?void 0:e.attrs)==null?void 0:c.__buttonsEi)==null?void 0:d.blocks).forEach(p=>{var h,g;this._currentFormRegitInfo.formButtons[p]=(g=(h=e==null?void 0:e.attrs)==null?void 0:h.__buttonsEi)==null?void 0:g.getBlock(p).getMappedRows()})}}async loadConfig(e,t){return new Promise((a,l)=>{var c,d;let r="";if((c=this._formDataSet)!=null&&c.dataTables&&(r=Object.keys((d=this._formDataSet)==null?void 0:d.dataTables).toString()),t===void 0&&(t=this._initialConfiParas),e.trim().length>0){const u=e.split(",");let p="";for(let h=0;h<u.length;h++)this.containsConfig(u[h].trim())||(p=p.length===0?u[h].trim():p+","+u[h].trim());if(p.length>0){const h=new Ze.EiInfo;if(h.addBlock(i.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:p,EXIST_TABLES:r,INI_FLAG:this._initializeFlag}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const g=new Ze.EiBlock("InitializeFormParas");g.addColumn("PARA_NAME"),g.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(I=>{g.addRow([{PARA_NAME:I,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[I]:""}])}),h.addBlock(g)}n.Core.callService(this._serviceName,h).then(g=>{g.getStatus()>=0&&(Object.keys(g.getBlocks()).forEach(S=>{["BM2A_SYSTEM_INFO","TESCOMPANYINFO","TSI00FORM","TSI00DATASOURCE","TSI00DATATABLE","TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].includes(S)||(this._configInfo[S]=g.getBlock(S))}),["TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].forEach(S=>{g.getBlock(S)&&this._configInfo[S]&&g.getBlock(S).getMappedRows().length>0&&this._configInfo[S].addRow(g.getBlock(S).getRows())}),p.split(",").forEach(S=>{var A;const M=this.getSingleViewConfigInfo(S),D=i.toString(M.TABLE_NAME).trim();if(M&&D.length>0&&!this._formDataSet.contains(D)){this._configInfo.TSI00DATATABLE.data.some(P=>P.TABLE_NAME===D)||g.getBlock("TSI00DATATABLE").getMappedRows().length>0&&this._configInfo.TSI00DATATABLE.addRow(g.getBlock("TSI00DATATABLE").getRows());const V={};M.FUNCTION_TYPE==="T"&&((A=M.CURRENT_NODE_DESC)==null?void 0:A.trim().length)>0&&M.FATHER_NODE_DESC.trim().length>0&&(V.hierarchy={primaryField:M.CURRENT_NODE_DESC.trim(),parentField:M.CURRENT_NODE_DESC}),this.createDataTable(D,V)}this.setDropDownBindSourceAndRequiredFields(M)})),a({flag:g.getStatus()>=0?1:-1,msg:g.getMsg()??"unknown error"})},g=>{a({...g,flag:-1,msg:"unknown error"})})}else a({flag:1,msg:"Configuration ["+e.trim()+"] already exists"})}else a({flag:-1,msg:"No config id"})})}$t(e,t){var l,r;let a="";if((e==null?void 0:e.trim().length)>0){for(let c=0;c<((r=(l=this.ConfigInfo.TSI00FORMRESOURCE)==null?void 0:l.getMappedRows())==null?void 0:r.length);c++)if(this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[c].ITEM_CODE===e){a=this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[c].ITEM_VALUE_RES||this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[c].ITEM_VALUE;break}a=a??n.Core.$t(e,t)}return a}setFormCapiton(e){return this._formCaption=e,this}setFormOptions(e){return this._formOptions={...this._formOptions,...e},this}setDropDownBindSourceAndRequiredFields(e){const t={},a={},l=[],r=[],c=["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 d=[],u=n.SysInfo.CompanyCode;u||(u=this.DefaultConfigCompanyCode),e.MATCH_FLAG==="1"&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(p=>{const h=(e.FUNCTION_TYPE==="F"?"F":"G")+p.COLUMN_EDIT;return p.FUNCTION_ID===e.FUNCTION_ID&&p.COMPANY_CODE===u&&(c.includes(h)||p.ITEM_MUST_FLAG==="1")})),d.length===0&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(p=>{const h=(e.FUNCTION_TYPE==="F"?"F":"G")+p.COLUMN_EDIT;return p.FUNCTION_ID===e.FUNCTION_ID&&p.COMPANY_CODE===this.DefaultConfigCompanyCode&&(c.includes(h)||p.ITEM_MUST_FLAG==="1")})),d.length>0&&d.forEach(p=>{const h=(e.FUNCTION_TYPE==="F"?"F":"G")+p.COLUMN_EDIT;if(c.includes(h))if(p.ORIGIN_CODE!=="0"&&p.SVC_NAME.trim().length>0){if(t[p.ITEM_CODE]=this.setDropDownBindOptions(e.FUNCTION_TYPE,p),p.FATHER_FIELD.trim().length>0&&p.FORM_FILTER.trim().length>0&&p.FORM_FILTER.trim()!=="0"){p.LAYOUT_ID.trim().length===0&&(p.LAYOUT_ID=e.FUNCTION_ID),this._dropDownCascader[p.LAYOUT_ID.trim()+p.FATHER_FIELD.trim()]||(this._dropDownCascader[p.LAYOUT_ID.trim()+p.FATHER_FIELD.trim()]=[]);const g={};g.COLUMN_EDIT=p.COLUMN_EDIT,g.FUNCTION_ID=p.FUNCTION_ID,g.ITEM_CODE=p.ITEM_CODE,g.FORM_FILTER=p.FORM_FILTER,g.FUNCTION_TYPE=e.FUNCTION_TYPE,this._dropDownCascader[p.LAYOUT_ID.trim()+p.FATHER_FIELD.trim()].push(g)}a[p.ITEM_CODE]=i.guid()}else console.warn(`ER: The dropdown data source for [${e.FUNCTION_ID}.${p.ITEM_CODE}] is not configured!`);p.ITEM_MUST_FLAG==="1"&&(p.MUST_INPUT_CONDITION.trim().length>0?r.push({ITEM_CODE:p.ITEM_CODE,COL_CAPTION:p.COL_CAPTION,FIELD_NAME:p.FIELD_NAME,MUST_INPUT_CONDITION:p.MUST_INPUT_CONDITION,CONDITION_TABLE:p.CONDITION_TABLE}):l.push({ITEM_CODE:p.ITEM_CODE,COL_CAPTION:p.COL_CAPTION,FIELD_NAME:p.FIELD_NAME}))})}this._dropDownRefreshKey[e.FUNCTION_ID]=a,this._dropDownBindSource[e.FUNCTION_ID]=t,this._requiredFields[e.FUNCTION_ID]=l,this._requiredFieldsByCondition[e.FUNCTION_ID]=r}setCustomPartition(e){return this._customPartition=e,this._customPartition}setLayoutCaption(e,t){this.setLayoutOptions(e,"layoutCaption",t)}getLayoutCaption(e){return i.toString(this.getLayoutOptions(e,"layoutCaption"))}getLayoutBindModel(e){if(this._layoutBindModel[e]===void 0){const t=new Q;t.uid="",this._layoutBindModel[e]=o.reactive(t)}return this._layoutBindModel[e]}refreshLayoutBindModel(e){const t=this.getBindingTable(e);let a=t==null?void 0:t.Current;a||(a=new Q,a.uid=""),this._layoutBindModel[e]=o.reactive(a),this._layoutBindModelUid[e]=a.uid}setLayoutBindForm(e,t){this.setLayoutOptions(e,"bindForm",t)}getLayoutBindForm(e){return this.getLayoutOptions(e,"bindForm")}setLayoutOptions(e,t,a){return(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&(e=e.trim(),t=t.trim(),this._layoutOpitons[e]=this._layoutOpitons[e]||{},this._layoutOpitons[e][t]=a),this}getLayoutOptions(e,t){let a;return(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&(e=e.trim(),this._layoutOpitons[e]&&(a=this._layoutOpitons[e][t==null?void 0:t.trim()])),(a==null?void 0:a.value)!==void 0?a==null?void 0:a.value:a}setLayoutItemOption(e,t,a){return(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&a&&(this._layoutItemOpitons[e]=this._layoutItemOpitons[e]||{},this._layoutItemOpitons[e][t]=this._layoutItemOpitons[e][t]||{},Object.keys(a).forEach(l=>{o.isRef(this._layoutItemOpitons[e][t][l])?this._layoutItemOpitons[e][t][l].value=a[l]:this._layoutItemOpitons[e][t][l]=o.ref(a[l])})),this}getLayoutItemOption(e,t,a){let l;return this._layoutItemOpitons[e]&&this._layoutItemOpitons[e][t]&&(l=this._layoutItemOpitons[e][t][a]),(l==null?void 0:l.value)!==void 0?l==null?void 0:l.value:l}setLayoutItemValidateRules(e,t,a,l=!1){if((e==null?void 0:e.trim().length)>0&&typeof t=="string"&&(t==null?void 0:t.trim().length)>0){const r=this.getLayoutBindForm(e);if(r!=null&&r.rulesRef)if(r.rulesRef[t]=r.rulesRef[t]||[],l&&r.rulesRef[t])if((a==null?void 0:a.length)>0){const c=[];a.forEach((d,u)=>{a[u].itemCode=t;let p=!1;for(let h=0;h<r.rulesRef[t].length;h++)if(r.rulesRef[t][h].customType===d.customType){r.rulesRef[t][h]=d,p=!0;break}p||c.push(d)}),c.length>0&&r.rulesRef[t].push(...c)}else r.rulesRef[t]=[];else r.rulesRef[t].push(...a)}return this}setLayoutItemCaptionForeColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{r.trim().length>0&&this.setLayoutItemOption(e,r,{LabelForeColor:a})}),this}setLayoutItemCaptionBackColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{r.trim().length>0&&this.setLayoutItemOption(e,r,{LabelBackColor:a})}),this}setLayoutItemContentForeColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{if(r.trim().length>0){const c=this.getLayoutItemOption(e,r,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","erTreeSelect","erMultiTreeSelect","antInput","antInputNumber","antDateTimePicker","antDatePicker","antMonthPicker","antYearPicker"].includes(c)&&this.setControlCss(e,r,[{property:"color",value:a}]),this.setLayoutItemOption(e,r,{TextForeColor:a})}}),this}setLayoutItemContentBackColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{if(r.trim().length>0){const c=this.getLayoutItemOption(e,r,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","antInput","antInputNumber"].includes(c)&&this.setControlCss(e,r,[{property:"background",value:a}]),this.setLayoutItemOption(e,r,{TextBackColor:a})}}),this}setLayoutConditionStyleConfigInfo(e,t,a){return this._layoutConditionStyleInfo[e]=this._layoutConditionStyleInfo[e]||{},this._layoutConditionStyleInfo[e][t]=a,this}setLayoutConditionStyle(e,t){if((e==null?void 0:e.trim().length)>0){const a=this.getLayoutBindModel(e);if(a&&this._layoutConditionStyleInfo[e==null?void 0:e.trim()]){const l=c=>{var u,p,h,g,I,b,S,M;const d=this._layoutConditionStyleInfo[e==null?void 0:e.trim()][c];d&&(n.Core.checkExpressionValid(a,n.Core.getSystemFormatString(d.condition))?(((u=d.labelForeColor)==null?void 0:u.trim().length)>0&&this.setLayoutItemCaptionForeColor(e,c,d.labelForeColor),((p=d.labelBackgroundColor)==null?void 0:p.trim().length)>0&&this.setLayoutItemCaptionBackColor(e,c,d.labelBackgroundColor),((h=d.textForeColor)==null?void 0:h.trim().length)>0&&this.setLayoutItemContentForeColor(e,c,d.textForeColor),((g=d.textBackgroundColor)==null?void 0:g.trim().length)>0&&this.setLayoutItemContentBackColor(e,c,d.textBackgroundColor)):(((I=d.labelForeColor)==null?void 0:I.trim().length)>0&&this.setLayoutItemCaptionForeColor(e,c,""),((b=d.labelBackgroundColor)==null?void 0:b.trim().length)>0&&this.setLayoutItemCaptionBackColor(e,c,""),((S=d.textForeColor)==null?void 0:S.trim().length)>0&&this.setLayoutItemContentForeColor(e,c,""),((M=d.textBackgroundColor)==null?void 0:M.trim().length)>0&&this.setLayoutItemContentBackColor(e,c,"")))};let r;t instanceof Array?r=t:t&&(t==null?void 0:t.trim().length)>0?r=t.split(","):r=Object.keys(this._layoutConditionStyleInfo[e]),(r==null?void 0:r.length)>0&&r.forEach(c=>{l(c)})}}return this}bindGridCustomEvent(e,t,a){return this._gridCustomEvent[e]=this._gridCustomEvent[e]||{},this._gridCustomEvent[e][t]=a,this}getGridCustomEvent(e,t){let a;return this._gridCustomEvent[e]&&this._gridCustomEvent[e][t]&&(a=this._gridCustomEvent[e][t]),a}getCompanyName(e){return""}cloneTableForLayoutOrGrid(e,t,a){var l,r,c,d,u,p;if(this.InitializeFlag>0&&e.trim().length>0&&t.trim().length>0&&a.trim().length>0&&!((l=this._formDataSet)!=null&&l.contains(t.trim())))if(a=a.trim(),e=e.trim(),t=t.trim(),(r=this._formDataSet)!=null&&r.contains(e)||(e=this.getBindingTableName(e)),e.length>0&&((c=this._formDataSet)!=null&&c.contains(e))){const h=(d=this._formDataSet)==null?void 0:d.getDataTable(e),g=(u=this._formDataSet)==null?void 0:u.cloneDataTable(h,t);(p=this._formDataSet)==null||p.addDataTable(t,g),this._configInfo.TSI00GRIDVIEW.getMappedRows().every(b=>b.FUNCTION_ID===a?(b.TABLE_NAME=t,!1):!0),this._formBindingRelation[a]=t;const I=this.getGrid(a);I&&(h.removeBindingInfo(this,a),I.gridOptions.context.bindingSource=g,I.gridOptions.context.bindTableName=t,g.setBindingInfo(this,a,"Grid"))}else this.messageError(`ER: The origin table [${e}] does not exist!`);return this}containsConfig(e){const t=this.getConfigInfo(e);return!!(t&&t.TSI00GRIDCOLUMN&&t.TSI00GRIDCOLUMN.length>0)}isEmptyConfig(e){return!this.containsConfig(e)}getConfigInfo(e,t=!1){let a={},l=n.SysInfo.CompanyCode;if(l||(l=this.DefaultConfigCompanyCode),this._tempSingleConfigInfo[e])a=this._tempSingleConfigInfo[e];else{let r=[];if(this._configInfo.TSI00GRIDVIEW&&(r=this._configInfo.TSI00GRIDVIEW.getMappedRows().filter(c=>c.FUNCTION_ID===e),r.length>0)){a.TSI00GRIDVIEW=r;const c=a.TSI00GRIDVIEW.FUNCTION_TYPE,d=a.TSI00GRIDVIEW.MATCH_FLAG;this._configInfo.TSI00GRIDCOLUMN&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l&&(u.IS_VISIBLE==="1"||t===!1)),r.length>0&&(a.TSI00GRIDCOLUMN=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode&&(u.IS_VISIBLE==="1"||t===!1)),r.length>0&&(a.TSI00GRIDCOLUMN=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDCOLUMNURL&&c!=="F"&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l),r.length>0&&(a.TSI00GRIDCOLUMNURL=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode),r.length>0&&(a.TSI00GRIDCOLUMNURL=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDSTYLE&&c!=="F"&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l&&u.NTYPE.length>2&&u.NTYPE.substring(0,2).toUpperCase()==="W_"),r.length>0&&(a.TSI00GRIDSTYLE=r),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode&&u.NTYPE.length>2&&u.NTYPE.substring(0,2).toUpperCase()==="W_"),r.length>0&&(a.TSI00GRIDSTYLE=r),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDBAND&&c!=="F"&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l),r.length>0&&(a.TSI00GRIDBAND=r),this._currentConfigCompanyCode["TSI00GRIDBAND"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode),r.length>0&&(a.TSI00GRIDBAND=r),this._currentConfigCompanyCode["TSI00GRIDBAND"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDVIEWCUS&&c!=="F"&&(r=this._configInfo.TSI00GRIDVIEWCUS.getMappedRows().filter(u=>u.FUNCTION_ID===e),r.length>0&&(a.TSI00GRIDVIEWCUS=r)),this._tempSingleConfigInfo[e]=a}}return a}getSingleViewConfigInfo(e){let t={};return this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().length>0&&this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().every(a=>a.FUNCTION_ID===e?(t=a,!1):!0),t}getSingleItemConfigInfo(e,t,a){let l={};if(this._gridColumnsConfigInfo[e]===void 0&&(this._gridColumnsConfigInfo[e]={}),this._gridColumnsConfigInfo[e][t])l=this._gridColumnsConfigInfo[e][t];else{let r=[];(!a||a.trim().length===0)&&(a=n.SysInfo.CompanyCode),a||(a=this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+e]);const c=this.getConfigInfo(e);c.TSI00GRIDCOLUMN&&(r=c.TSI00GRIDCOLUMN,r.length>0&&(r.every((d,u)=>d.COMPANY_CODE===a&&d.FUNCTION_ID===e&&d.ITEM_CODE===t||d.COMPANY_CODE===this.DefaultConfigCompanyCode&&d.FUNCTION_ID===e&&d.ITEM_CODE===t?(l=d,!1):!0),Object.keys(l).length>0&&c.TSI00GRIDVIEW&&(r=c.TSI00GRIDVIEW,r.length>0&&(l.FUNCTION_TYPE=r[0].FUNCTION_TYPE))),this._gridColumnsConfigInfo[e][t]=l)}return l}getAllItemCodeArray(e){const t=[];e=this.getConfigIdbyLayoutName(e);const a=this.getConfigInfo(e);if(a.TSI00GRIDCOLUMN){const l=a.TSI00GRIDCOLUMN;l.length>0&&l.forEach(r=>{t.push(r.ITEM_CODE)})}return t}getAllConfigIdArray(){const e=[];if(this._configInfo.TSI00GRIDVIEW){const t=this._configInfo.TSI00GRIDVIEW.getMappedRows();t.length>0&&t.forEach(a=>{e.push(a.ITEM_CODE)})}return e}getItemDropDownDataSource(e,t){var r;let a=[];const l=this.getSingleItemConfigInfo(e,t);return((r=l==null?void 0:l.SVC_NAME)==null?void 0:r.trim().length)>0&&(this._configInfo[l.FUNCTION_ID+l.ITEM_CODE+m.CompanyCode]?a=this._configInfo[l.FUNCTION_ID+l.ITEM_CODE+m.CompanyCode].getMappedRows():this._configInfo[l.FUNCTION_ID+l.ITEM_CODE]?a=this._configInfo[l.FUNCTION_ID+l.ITEM_CODE].getMappedRows():this._configInfo[l.FUNCTION_ID+l.SVC_NAME]?a=this._configInfo[l.FUNCTION_ID+l.SVC_NAME].getMappedRows():this._configInfo["SI->"+l.SVC_NAME]?a=this._configInfo["SI->"+l.SVC_NAME].getMappedRows():this._configInfo["EP->"+l.SVC_NAME]?a=this._configInfo["EP->"+l.SVC_NAME].getMappedRows():this._configInfo["PM->"+l.SVC_NAME]?a=this._configInfo["PM->"+l.SVC_NAME].getMappedRows():this._configInfo[this._formName+l.SVC_NAME]?a=this._configInfo[this._formName+l.SVC_NAME].getMappedRows():this._configInfo[l.SVC_NAME]?a=this._configInfo[l.SVC_NAME].getMappedRows():this.messageError(`Can not find the data source config for [${e}.${t}]!`)),a}setDropDownBindOptions(e,t,a){var P,J;const l=i.toString(t.DISPLAY_COLS).toUpperCase();let r=i.toString(t.DISPLAY_CAPTIONS).trim(),c=!1;const d=i.toString(t.VALUE_MEMBER).toUpperCase(),u=i.toString(t.DISPLAY_MEMBER).toUpperCase(),p=i.toNumber(t.VALUE_POSITION),h=i.toNumber(t.DISPLAY_POSITION),g=[],I=n.Core.$t("ERX.CodeColumn")||"代码",b=n.Core.$t("ERX.DescriptionColumn")||"描述";r.startsWith("$t(")&&r.endsWith(")")&&(r=r.substring(3,r.length-1),c=!0);let S="CODE";d.trim().length>0&&(S=d.trim());let M="CODE_DESC_1_CONTENT";u.trim().length>0&&(M=u.trim()),g.push(S,M);const D={dataValueField:"",dataTextField:"",dataSource:[],filterFields:g,columns:[{field:S,title:I,width:150},{field:M,title:b,width:150}],codeClass:t.SVC_NAME,layoutType:e,columnConfig:t};let A=[];a&&a instanceof Function&&(a=a());const V=a||this.getItemDropDownDataSource(t.FUNCTION_ID,t.ITEM_CODE)||[];if(l.length>0&&r.length>0){const N=l.split(","),te=r.split(",");if(N.length!==te.length)this.messageError("[DisplayColumns] array length need same to [DisplayCaptions] array length!");else{const R=[];for(let me=0;me<N.length;me++){const fe={field:N[me],title:te[me].trim(),width:150};fe.title.startsWith("$t(")&&fe.title.endsWith(")")?fe.title=this.$t(fe.title.substring(3,fe.title.length-1)):c&&(fe.title=this.$t(fe.title)),R.push(fe),g.push(fe.field)}d.trim().length>0&&u.trim().length>0?(S=d.trim(),M=u.trim()):(p>=0&&p<N.length?S=N[p]:S=N[0],h>=0&&p<N.length?M=N[h]:N.length>1?M=N[1]:M=N[0]),D.columns=R,D.dropDownWidth=R.length*150,D.dataValueField=S,D.dataTextField=M}}else if(V.length>0){const N=Object.keys(V[0]);(V[0][S]===void 0||V[0][M]===void 0)&&(V[0][S]===void 0&&(S=N[0]),V[0][M]===void 0&&(N.length>1?M=N[1]:M=N[0])),D.columns=t.VALUE_VISIBLE==="1"?[{field:S,title:I,width:150},{field:M,title:b,width:150}]:[{field:M,title:b,width:150}],t.VALUE_VISIBLE==="1"&&g.push(S)}else d.trim().length>0&&u.trim().length>0&&(S=d.trim(),M=u.trim(),D.columns=t.VALUE_VISIBLE==="1"?[{field:S,title:I,width:150},{field:M,title:b,width:150}]:[{field:M,title:b,width:150}],t.VALUE_VISIBLE==="1"&&g.push(S));return t.ADD_EMPTY_ITEM==="1"&&(D.optionLabel="—-—"),t.FORMAT_TYPE==="Custom"&&((P=t.FORMAT_STRING)==null?void 0:P.trim().length)>0?D.displayFormat=(J=t.FORMAT_STRING)==null?void 0:J.trim():t.DISPLAY_POSITION===t.VALUE_POSITION&&i.toNumber(t.VALUE_POSITION)>=0||t.DISPLAY_MEMBER===t.VALUE_MEMBER&&t.VALUE_MEMBER.trim().length>0?D.displayFormat="{0}":t.VALUE_VISIBLE==="1"?D.displayFormat="{0}|{1}":D.displayFormat="{1}",V&&V instanceof Array&&(A=V.map(N=>({...N,value:N[S],label:N[M]}))),g.push(M),D.autoWidth=!0,D.dataSource=A,D.dataValueField=S,D.dataTextField=M,D}filterDropDownCascaderDataSource(e,t,a){const l=[];if(a instanceof Array&&a.length>0?l.push(...a):n.Core.toString(a).length>0&&l.push(n.Core.toString(a)),e&&e.length>0&&t.length>0&&l.length>0){const r=t.indexOf(" like ")>=0?"like":t.indexOf(" <> ")>=0?"<>":"=",c=t.split(r);if(c.length===2){const d=c[0].trim().toUpperCase(),u=c[1].trim().toUpperCase(),p=[];return e.forEach(h=>{const g=n.Core.toString(h[d]).trim();if(g.length>0){for(let I=0;I<l.length;I++)if(r==="like"){if(u.startsWith("'%")&&u.endsWith("%'")&&g.indexOf(l[I])>=0){p.push(h);break}else if(u.startsWith("'%")&&g.endsWith(l[I])){p.push(h);break}else if(g.startsWith(l[I])){p.push(h);break}}else if(r==="<>"&&g!==l[I]){p.push(h);break}else if(g===l[I]){p.push(h);break}}}),p}}return e}setDropDownCascaderDataSource(e,t,a){this._dropDownCascader[e+t]&&this._dropDownCascader[e+t].length>0&&this._dropDownCascader[e+t].forEach(r=>{if(r.FUNCTION_TYPE==="F"){const c=this._dropDownBindSource[r.FUNCTION_ID][r.ITEM_CODE].dataSource,d=r.FORM_FILTER.trim(),u=this.filterDropDownCascaderDataSource(c,d,a);r.dataSource=u,this.reloadDropDownDataSource(r.FUNCTION_ID,r.ITEM_CODE,r.dataSource)}})}getDropDownCascaderDataTable(e,t,a,l){let r;return e.trim().length>0&&t.trim().length>0&&a.trim().length>0&&l.trim().length>0&&this._dropDownCascader[a.trim()+l.trim()]&&this._dropDownCascader[a.trim()+l.trim()].length>0&&this._dropDownCascader[a.trim()+l.trim()].every(c=>c.FUNCTION_ID===e.trim()&&c.ITEM_CODE===t.trim()?(r=c.dataSource,!1):!0),r}getGridStyleConfig(e){return this._gridStyleInfo[e]}setDropDownAutoFillFieldForLayout(e,t,a){a&&a instanceof Array&&(a=a.join(","));const l=this.getSingleItemConfigInfo(e,t);if(l&&l.AUTOFILL_COLS&&l.AUTOFILL_COLS.trim().length>0){const c=l.AUTOFILL_COLS.trim().split(";"),d=this.getDropDownSelectedData(e,t,a);c.forEach(u=>{if(u.trim().length>0){const p=u.split("="),h=p[0].trim().toUpperCase();let g=p[0].trim().toUpperCase();if(p.length>1&&(g=p[1].trim().toUpperCase()),d&&d instanceof Array){let I="";d.forEach(b=>{const S=n.Core.toString(b[h]).trim();S.length>0&&(I=I.length===0?S:I+","+S)}),this.setControlValue(e,g,I)}else this.setControlValue(e,g,d[h])}})}}setDropDownAutoFillFieldsForGrid(e,t,a){var r,c,d,u,p,h,g,I,b,S;const l=this.getGrid(e);if(l&&((r=a==null?void 0:a.data)!=null&&r.uid)){const M=(c=l.gridOptions.context)==null?void 0:c.configId,D=(u=(d=l.gridOptions.context)==null?void 0:d.viewConfig)==null?void 0:u.AUTO_SELECT_MODE,A=this.getGridColumn(e,t);if((h=(p=A==null?void 0:A.colDef)==null?void 0:p.context)!=null&&h.columnConfig){const V=(I=(g=A==null?void 0:A.colDef)==null?void 0:g.context)==null?void 0:I.columnConfig;let P=[],J={};if(V&&V.AUTOFILL_COLS&&V.COLUMN_EDIT!=="3"){const N=V.AUTOFILL_COLS;N.length>0&&(P=N.split(";"),a.data[t]&&(J=this.getDropDownSelectedData(M,t,a.data[t])),P.forEach(te=>{if(te.trim().length>0){const R=te.trim().split("="),me=R[0].toUpperCase().trim();let fe=R[0].toUpperCase().trim();if(R.length>1&&(fe=R[1].toUpperCase().trim()),J&&J instanceof Array){let X="";J.forEach(q=>{const v=n.Core.toString(q[me]).trim();v.length>0&&(X=X.length===0?v:X+","+v)}),a.data.set(fe,X)}else a.data.set(fe,J[me]);l.gridOptions.api.refreshCells({rowNodes:[a],columns:[fe,n.SysInfo.GridCheckColumnFieldName]})}}))}if(a.isSelected()&&V.MULTI_ROW_EDIT==="1"&&D!=="1"&&D!=="3"){const N=this.getGridOptions(M,"multiRowEdit");if(N!==!1&&N!=="0")if(((S=(b=l.gridOptions.context)==null?void 0:b.options)==null?void 0:S.multiRowEditType)==="all"){const te=this.getGridSelectRows(l);(te==null?void 0:te.length)>0&&te.forEach(R=>{a.data.uid!==R.uid&&P.forEach(me=>{if(me.trim().length>0){const fe=me.trim().split("="),X=fe[0].toUpperCase().trim();let q=fe[0].toUpperCase().trim();if(fe.length>1&&(q=fe[1].toUpperCase().trim()),R){if(J&&J instanceof Array){let v="";J.forEach(O=>{const ge=n.Core.toString(O[X]).trim();ge.length>0&&(v=v.length===0?ge:v+","+ge)}),R.set(q,v)}else R.set(q,J[X]);l.gridOptions.api.refreshCells({rowNodes:[a],columns:[q,n.SysInfo.GridCheckColumnFieldName]})}}})})}else{const te=[];l.gridOptions.api.forEachNodeAfterFilter(R=>{var me;R!=null&&R.selected&&((me=R.data)!=null&&me.uid)&&R.data.uid!==a.data.uid&&te.push(R)}),(te==null?void 0:te.length)>0&&te.forEach(R=>{a.data.uid!==R.data.uid&&P.forEach(me=>{if(me.trim().length>0){const fe=me.trim().split("="),X=fe[0].toUpperCase().trim();let q=fe[0].toUpperCase().trim();if(fe.length>1&&(q=fe[1].toUpperCase().trim()),J&&J instanceof Array){let v="";J.forEach(O=>{const ge=n.Core.toString(O[X]).trim();ge.length>0&&(v=v.length===0?ge:v+","+ge)}),R.data.set(q,v)}else R.data.set(q,J[X]);l.gridOptions.api.refreshCells({rowNodes:[a],columns:[q,n.SysInfo.GridCheckColumnFieldName]})}})})}}}}}addDropDownCode(e,t,a,l="push"){var r,c;if((e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&(a==null?void 0:a.length)>0&&this._dropDownBindSource[e.trim()]&&this._dropDownBindSource[e.trim()][t.trim()]){const d=this._dropDownBindSource[e.trim()][t.trim()];if(d.dataSource!==void 0&&d.dataSource instanceof Array){l==="unshift"?d.dataSource.unshift(...a):d.dataSource.push(...a);const u=this.getSingleItemConfigInfo(e,t);if(u.FUNCTION_TYPE==="F")this._dropDownRefreshKey[e][t]=i.guid(),this.setControlEmptyValue(e,t);else if(u.FUNCTION_TYPE==="G"||u.FUNCTION_TYPE==="P"){const p=this.getGridColumn(e,t);if(p.colDef){this.setGridColumnDropdown(e,p.colDef,d.dataSource,(r=p.colDef.context)==null?void 0:r.valueField,(c=p.colDef.context)==null?void 0:c.textField,d.displayFormat);const h=this.getGridApi(e);h==null||h.refreshCells({columns:[p.colId]})}}}}}async reloadDropDownDataSource(e,t,a){var l,r,c,d;if((e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0){const u=this.getSingleItemConfigInfo(e,t);if(u){let p=[];if(a&&a instanceof Function&&(a=a()),a instanceof Ze.EiBlock)p=a.getMappedRows();else if(a instanceof Array)p=a;else if(u.ORIGIN_CODE==="2"&&u.SVC_NAME.trim().length>0){const g=await this.queryDataByDataSource(u.SVC_NAME.trim());n.Core.toNumber((l=g.SysInfo)==null?void 0:l.Flag)>=0&&(p=g.getBlockByIndex(0).getMappedRows())}const h=this.setDropDownBindOptions(u.FUNCTION_TYPE,u,p);if(this._dropDownBindSource[e.trim()]=this._dropDownBindSource[e.trim()]||{},this._dropDownBindSource[e.trim()][t.trim()]=h,u.FUNCTION_TYPE==="F"){const g=this.getControlValue(e,t);g&&!((r=h==null?void 0:h.dataSource)!=null&&r.some(I=>I[h.dataValueField]===g))&&this.setControlEmptyValue(e,t)}else if(u.FUNCTION_TYPE==="G"||u.FUNCTION_TYPE==="P"){const g=this.getGridColumn(e,t);if(g!=null&&g.colDef){this.setGridColumnDropdown(e,g.colDef,p,(c=g.colDef.context)==null?void 0:c.valueField,(d=g.colDef.context)==null?void 0:d.textField,h.displayFormat);const I=this.getGridApi(e);I==null||I.refreshCells({columns:[g.colId]})}}this._dropDownRefreshKey[e][t]=i.guid()}}}createDataSet(){var a,l,r,c;const e=[];let t="";this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(d=>{var u,p,h;if(((u=d.TABLE_NAME)==null?void 0:u.trim().length)>0&&((p=d.DATASET_NAME)==null?void 0:p.trim().length)>0){const g={};d.FUNCTION_TYPE==="T"&&((h=d.CURRENT_NODE_DESC)==null?void 0:h.trim().length)>0&&d.FATHER_NODE_DESC.trim().length>0&&(g.hierarchy={primaryField:d.CURRENT_NODE_DESC.trim(),parentField:d.FATHER_NODE_DESC}),this.createDataTable(d.TABLE_NAME.trim(),g)&&e.push({tableName:d.TABLE_NAME.trim()}),t=d.DATASET_NAME.trim()}}),((r=(l=(a=this._configInfo)==null?void 0:a.TSI00DATARELATION)==null?void 0:l.getMappedRows())==null?void 0:r.length)>0&&this._configInfo.TSI00DATARELATION.getMappedRows().forEach(d=>{e.findIndex(u=>u.tableName===d.RESERVE1)>=0&&e.findIndex(u=>u.tableName===d.RESERVE7)>=0&&(this._formDataSet.relations[d.RELATION_NAME]=this._formDataSet.relations[d.RELATION_NAME]||[],this._formDataSet.relations[d.RELATION_NAME].push({ParentTable:d.RESERVE1,ChildTable:d.RESERVE7,ParentColumn:d.RESERVE2,ChildColumn:d.RESERVE8}))}),(c=this._formDataSet)==null||c.setName(t)}createDataTable(e,t){var r,c,d,u,p,h,g;let a;const l={...t};if(e.trim().length>0&&!this._formDataSet.dataTables[e.trim()]){const I={};((c=(r=this._configInfo.TSI00DATATABLE)==null?void 0:r.getMappedRows())==null?void 0:c.length)>0&&this._configInfo.TSI00DATATABLE.getMappedRows().forEach(b=>{if(b.TABLE_NAME===e.trim()){const S={name:b.COL_NAME,caption:b.COL_CAPTION,maxLength:b.MAX_LENGTH};switch(b.DATA_TYPE){case"2":S.type="number",S.defaultValue=i.toNumber(b.DEFAULT_VALUE);break;case"3":S.type="datetime",S.defaultValue=i.getDateTimeByString(b.DEFAULT_VALUE,"Dayjs");break;case"4":S.type="boolean",S.defaultValue=i.toBoolean(b.DEFAULT_VALUE);break;default:S.type="string",S.defaultValue=i.getSystemFormatString(b.DEFAULT_VALUE).trim();break}I[b.COL_NAME]=S}}),Object.keys(I).length>0&&(I[m.IdFieldName]={name:m.IdFieldName,type:"string"},l.schema=I,a=new j(l),this._formDataSet.addDataTable(e.trim(),a))}else a=(d=this._formDataSet)==null?void 0:d.dataTables[e.trim()],l.schema=(u=a==null?void 0:a.options)==null?void 0:u.schema,l.hierarchy=l.hierarchy||((p=a==null?void 0:a.options)==null?void 0:p.hierarchy);return(h=t==null?void 0:t.hierarchy)!=null&&h.primaryField&&((g=t==null?void 0:t.hierarchy)!=null&&g.parentField)&&(l.schema[t.hierarchy.primaryField]===void 0&&console.error(`ER: Hierarchy DataTable's PrimaryField [${t.hierarchy.primaryField}] not exists!`),l.schema[t.hierarchy.parentField]===void 0&&console.error(`ER: Hierarchy DataTable's ParentField [${t.hierarchy.parentField}] not exists!`)),a||console.error(`ER: DataTable [${e}] creation failed!`),a}getTableName(e){var t;return(t=this._formDataSet)==null?void 0:t.getTableName(e)}getBindingTableName(e){let t="";return e.trim().length>0&&this._formBindingRelation[e.trim()]&&(t=this._formBindingRelation[e.trim()]),t}setBindingTableName(e){var l;let t="";const a=this.getSingleViewConfigInfo(e.trim());return a&&a.TABLE_NAME&&a.TABLE_NAME.trim().length>0&&((l=this._formDataSet)!=null&&l.contains(a.TABLE_NAME.trim()))&&(t=a.TABLE_NAME.trim(),this._formBindingRelation[e]=t),t}getBindingTable(e){var l;let t;const a=this.getBindingTableName(e);return a&&a.trim().length>0&&(t=(l=this._formDataSet)==null?void 0:l.dataTables[a]),t}getBindingTableAsBlock(e){let t;const a=this.getBindingTable(e);return a&&a instanceof j&&(t=a.data(),t&&(t=this.convertDataType(t,a,"weakly"))),i.buildEiBlock(t||{},"Table0")}hasDataChange(...e){let t=!1;return e.length===0?e=Object.keys(this._formBindingRelation):e.length===1&&(e=e[0].split(",")),e.forEach(a=>{const l=this.getBindingTable(a);if(l&&l instanceof j)if(!t)t=l.hasChanges();else return t}),t}cancelGridChange(e){var a,l;const t=this.getGrid(e);if(t){const r=(l=(a=t.gridOptions)==null?void 0:a.context)==null?void 0:l.bindingSource;r&&r instanceof n.DataTable&&r.cancelChanges()}return this}mergeDataToLayoutOrGrid(e,t=!0,...a){var l,r,c,d;if(this.isNullOrEmpty(a)?a=Object.keys(this._formBindingRelation):a.length===1&&a[0]&&typeof a[0]=="string"&&(a=a[0].split(",")),a.length>0){if(a.length===1&&a[0].trim().length>0){const u=this.getBindingTableName(a[0]);(u==null?void 0:u.trim().length)>0&&(e instanceof Ze.EiBlock?(l=this._formDataSet)==null||l.mergeData(u.trim(),e.getMappedRows(),t):e instanceof Ze.EiInfo?e.getBlock(u.trim())?(r=this._formDataSet)==null||r.mergeData(u.trim(),e.getBlock(u.trim()).getMappedRows(),t):Object.keys(e).length>0&&((c=this._formDataSet)==null||c.mergeData(u.trim(),e.getBlockByIndex(0).getMappedRows(),t)):e instanceof Array&&e&&e.length>0&&((d=this._formDataSet)==null||d.mergeData(u.trim(),e,t)),this.autoBestFit(a[0]))}else if(e instanceof Ze.EiInfo){const u={};a.forEach(p=>{var g;const h=this.getBindingTableName(p);(h==null?void 0:h.trim().length)>0&&e.getBlock(h.trim())&&(u[h]||((g=this._formDataSet)==null||g.mergeData(h.trim(),e.getBlock(h.trim()).getMappedRows(),t),u[h]=!0),this.autoBestFit(p))})}}return this}checkFormChanged(...e){return new Promise(t=>{this.hasDataChange(...e)?this.messageConfirm(n.Core.$t("ERX.ContinueToOperate")||"是否继续操作?").then(a=>{t(a)}).catch(()=>{t(!1)}):t(!0)})}addRowToGrid(e,t=!0,a="default",l=!1){var d,u,p,h,g,I;let r;const c=this.getGrid(e);if((d=c==null?void 0:c.gridOptions.context)!=null&&d.bindingSource){let b={};a==="default"&&(a=this.getGridOptions(e,"insertAtTop")||"default"),a==="default"&&(a=((h=(p=(u=c==null?void 0:c.gridOptions)==null?void 0:u.context)==null?void 0:p.options)==null?void 0:h.insertAtTop)||"default");const S=this.getGridOptions(e,"autoGuidField");(t===!0||(t==null?void 0:t.setDefaultValue)===!0)&&(b=this.getGridConfigDefaultValues(e)||{}),this._customDefaultValues[e]&&(b={...b,...this._customDefaultValues[e]}),t!=null&&t.data&&(b={...b,...t.data});const M=(g=c.gridOptions.context)==null?void 0:g.bindingSource;if(a===!0||a==="top")r=M.insert(0,b,S);else if(a==="afterCurrent"||a==="beforeCurrent"){const D=this.getGridCurrentRow(e);if(D){let A=M.indexOf(D);A>=0&&A<M.rowCount&&a==="afterCurrent"?A=A+1:A>0&&a==="beforeCurrent"&&(A=A-1),r=M.insert(A,b,S)}else r=M.add(b,S)}else typeof a=="number"&&a>=0?r=M.insert(a,b,S):r=M.add(b,S);r[m.IdFieldName]=i.guid(),(I=c==null?void 0:c.gridOptions)!=null&&I.treeData&&(r[m.TreeHierarchyFieldName]=[r[m.IdFieldName]])}return r}addCopyRowToGrid(e,t="default",a=!1){var c,d,u;const l=this.getGrid(e);let r;if(l){t==="default"&&(t=this.getGridOptions(e,"insertAtTop")||"default"),t==="default"&&(t=((u=(d=(c=l==null?void 0:l.gridOptions)==null?void 0:c.context)==null?void 0:d.options)==null?void 0:u.insertAtTop)||"default"),(l==null?void 0:l.gridOptions.api).stopEditing();const h=this.getGridSelectRows(l);if(h.length===0){const g=this.getGridCurrentRow(l);g&&h.push(g)}if(h.length===0)r=[this.addRowToGrid(e,!0,t,a)];else{const g=this.getGridBindingTable(e);if(g){let I=-1;t==="top"||t===!0?I=0:t==="afterCurrent"||t==="default"?(I=g.indexOf(h[h.length-1]),I<g.rowCount&&(I=I+1)):t==="beforeCurrent"?(I=g.indexOf(h[0]),I>0&&(I=I-1)):typeof t=="number"&&t>=0&&(I=t),r=g.import(h,I,!0,this.getGridOptions(e,"autoGuidField"))}}}return r}importRowsToGrid(e,t,a=!1,l=!0){var d,u;let r;const c=this.getGrid(e);if((d=c==null?void 0:c.gridOptions.context)!=null&&d.bindingSource){c==null||c.gridOptions.api;const p=(u=c.gridOptions.context)==null?void 0:u.bindingSource;p&&(r=p.import(t,void 0,l))}return r}getGridAggregates(e){var a;let t;if(e){const l=this.getGrid(e);if(l){const r=l.gridOptions.api.getModel();t=(a=r==null?void 0:r.rootNode)==null?void 0:a.aggData}}return t}getModelFromGridOrLayout(e,t,a=!1,l){const r=this.getBindingTable(e);return this.getModelFromDataTable(r,t,a,l)}getModelFromGridOrLayoutAsBlock(e,t,a){const l=this.getModelFromGridOrLayout(e,t,!0,a);return this.buildEiBlock([l])}getModelFromDataTable(e,t,a=!1,l){let r;return typeof e=="string"&&e.trim().length>0&&(e=this.getBindingTable(e)),e&&e instanceof n.DataTable&&(t&&t.trim().length>0?r=e.get(t.trim()):(r=e.at(0),r=o.reactive(r))),r&&(a instanceof Function?r=a(r)||r.toJSON():r=a?r.toJSON():r,l&&Object.keys(l).forEach(c=>{r[c]=l[c]})),r}getGridDataCount(e){let t=0;const a=this.getGridConfigId(e);if(a){const l=this.getBindingTable(a);l&&l instanceof n.DataTable&&(t=l.totalCount())}return t}getModelFromDataTableById(e,t,a=!1){var r;let l;return typeof e=="string"&&e.trim().length>0&&this._formBindingRelation[e.trim()].trim().length>0&&(e=(r=this._formDataSet)==null?void 0:r.dataTables[this._formBindingRelation[e.trim()]]),e&&e instanceof j&&t&&t.trim().length>0&&(l=e.get(t.trim()),l&&(a instanceof Function?l=a(l)||l.toJSON():l=a?l.toJSON():l)),l}convertModelAsBlock(e,t){let a={};return e&&(a=e.toJSON(t)),this.buildEiBlock([a])}addModelToLayout(e,t,a){let l;if((e==null?void 0:e.trim().length)>0){const r=this.getBindingTable(e.trim());if(r){r instanceof j&&(l=r.add({}));const c=this.getRelationConfigIdsByTableName(r.tableName);t&&this.setModelDefalutValue(l,c),l=this.getLayoutBindModel(e)}else console.error("ER: Attempting to add model to a non-existent dataTable, configId: "+e)}return l}getDataFromDataTableAsEiBlock(e,t=0,a){let l;if(e){let c;typeof e=="string"?c=this.getBindingTable(e):c=e,c&&(l=e.at(t)),l=this.convertDataType([l],c,"weakly"),l={...l,...a}}return i.buildEiBlock(l||{},"Table0")}convertDataType(e,t,a){return i.convertDataType(e,t,a)}getModelFields(e){var t;return(t=e==null?void 0:e.options)==null?void 0:t.schema}getControlName(e,t,a){let l="antInput";switch(e){case"F1":case"G3":l="antInputGroup";break;case"FB":l="antRadioGroup";break;case"FJ":l="erRadioGroup";break;case"FK":l="erCheckboxGroup";break;case"F7":case"FA":case"FP":case"G1":case"GP":case"F6":case"FC":case"G2":l="erSelect";break;case"FD":l="erMultiSelect";break;case"F3":case"G4":case"GD":l="antMultiSelect";break;case"FL":l="erTreeSelect";break;case"FH":l="erMultiTreeSelect";break;case"F2":case"F9":case"FG":l="antInputNumber";break;case"F4":l="antCheckbox";break;case"FW":l="antSwitch";break;case"FM":l="scriptEditor";break;case"F5":i.toNumber(a==null?void 0:a.MAX_LENGTH)===2?l="antTimePicker":i.toNumber(a==null?void 0:a.MAX_LENGTH)===4?t.toLowerCase()==="hh:mm"?l="antTimePicker":l="antYearPicker":i.toNumber(a==null?void 0:a.MAX_LENGTH)===6?t.toLowerCase()==="hh:mm:ss"?l="antTimePicker":l="antMonthPicker":i.toNumber(a==null?void 0:a.MAX_LENGTH)===8?l="antDatePicker":l="antDateTimePicker";break;case"F8":case"G8":l="antTextarea";break;case"FE":case"G5":l="erMemoEditor";break;case"FN":l="antButton";break;case"FS":l="label";break;case"FT":l="antDivider";break;default:l="antInput";break}return l}resetValidator(e){let t=[];e&&(e instanceof Array?t=e:t=e.split(",")),t.length===0&&(t=this.getAllConfigIdArray());for(let a=0;a<t.length;a++){if(t[a].trim().length===0)continue;const l=this.getLayoutBindForm(t[a]);l==null||l.clearValidate()}}getLayoutLabelSpan(e,t){return i.jQuery("#"+this._formId+e+t+"_span")}getLayoutJqueryElement(e,t){let a;return a=i.jQuery("#"+this._formId+e+t),a===void 0&&(a=i.jQuery("#"+e)),a}autoBestFit(e){var a,l,r,c,d;const t=this.getGrid(e);if(t&&this.isGridOnScreen(t)){const u=(l=(a=t.gridOptions.columnApi)==null?void 0:a.columnModel)==null?void 0:l.gridColumns;(u==null?void 0:u.length)>0&&((d=(c=(r=e==null?void 0:e.gridOptions)==null?void 0:r.context)==null?void 0:c.viewConfig)==null?void 0:d.BESTFIT)==="1"&&u.forEach(p=>{p.visible&&!p.colDef.suppressSizeToFit&&t.gridOptions.columnApi.autoSizeColumn(p)})}return this}getGrid(e){var a,l;let t;return e&&typeof e=="string"&&this._gridInstanceInfo[e]!==void 0&&(e=this._gridInstanceInfo[e]),(a=e==null?void 0:e.gridOptions)!=null&&a.api&&((l=e==null?void 0:e.gridOptions)!=null&&l.columnApi)&&(t=e),t}getGridApi(e){var t,a;return(a=(t=this.getGrid(e))==null?void 0:t.gridOptions)==null?void 0:a.api}isGridOnScreen(e){const t=this.getGrid(e);return t?i.isGridOnScreen(t):!1}getGridColumnApi(e){var t,a;return(a=(t=this.getGrid(e))==null?void 0:t.gridOptions)==null?void 0:a.columnApi}getGridConfig(e){var t,a,l;return(l=(a=(t=this.getGrid(e))==null?void 0:t.gridOptions)==null?void 0:a.context)==null?void 0:l.viewConfig}getGridColumn(e,t){const a=this.getGrid(e);return i.getGridColumn(a,t)}getGridColumnDef(e,t){const a=this.getGrid(e);return i.getGridColumnDef(a,t)}showGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=t.split(","),l.length>0){const r=[];l.forEach(c=>{r.push({colId:c,hide:!1})}),a.gridOptions.columnApi.applyColumnState({state:r})}}return this}hideGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=t.split(","),l.length>0){const r=[];l.forEach(c=>{r.push({colId:c,hide:!0})}),a.gridOptions.columnApi.applyColumnState({state:r})}}return this}showGridCheckColumn(e){return this.showOrHideGridCheckColumn(e,"show")}hideGridCheckColumn(e){return this.showOrHideGridCheckColumn(e,"hide")}showOrHideGridCheckColumn(e,t="default"){var l,r,c,d;const a=this.getGrid(e);if((l=a==null?void 0:a.gridOptions)!=null&&l.api){const u=a.gridOptions.api,p=u.getColumnDef(m.GridCheckColumnFieldName);p&&(t==="hide"?(p.checkboxSelection=void 0,p.headerCheckboxSelection=void 0):(t==="show"||((r=a.gridOptions.context)==null?void 0:r.viewConfig.SHOW_SELECTION)==="1")&&(p.checkboxSelection=h=>!h.node.footer,this.getGridOptions((d=(c=a.gridOptions)==null?void 0:c.context)==null?void 0:d.configId,"RowSelection",!0)==="multiple"?p.headerCheckboxSelection=!0:p.headerCheckboxSelection=void 0),u.redrawRows(),u.refreshHeader())}return this}setGridSelectMode(e,t,a="none"){var r,c;const l=this.getGrid(e);return l&&(this.setGridOptions((c=(r=l.gridOptions)==null?void 0:r.context)==null?void 0:c.configId,"RowSelection",t,!0),this.setGridColumnOptions(l,d=>{var u;d.colId===m.GridCheckColumnFieldName&&(a==="show"||a==="hide"||t==="multiple")&&(a==="hide"?(d.checkboxSelection=void 0,d.headerCheckboxSelection=void 0):t==="multiple"?(d.checkboxSelection=p=>!p.node.footer,d.headerCheckboxSelection=a==="show"||((u=l.gridOptions.context)==null?void 0:u.viewConfig.SHOW_SELECTION)==="1"):t==="single"&&(d.headerCheckboxSelection=void 0))})),this}setGridRowDrag(e,t="default"){var l,r,c,d;const a=this.getGrid(e);if((l=a==null?void 0:a.gridOptions)!=null&&l.api){const p=a.gridOptions.api.getColumnDef(m.GridCheckColumnFieldName);p&&(t===!1?(p.rowDrag=void 0,(r=a==null?void 0:a.gridOptions)==null||r.columnApi.setColumnWidth(p.colId,55)):(t===!0||(c=a.gridOptions.context)!=null&&c.allowDragRow)&&(a.gridOptions.context.allowDragRow=!0,(d=a==null?void 0:a.gridOptions)==null||d.columnApi.setColumnWidth(p.colId,75),p.rowDrag=h=>{var g;return((g=h.context)==null?void 0:g.allowDragRow)&&!h.node.group&&!h.node.footer}),a.gridOptions.rowDragManaged=t),a.gridOptions.api.redrawRows()}return this}addGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=[t],l.length>0){const r=a.gridOptions.context.bindingSource,c=a.gridOptions.api.getColumnDefs()||[];l.forEach(d=>{var u;if(((u=d.field)==null?void 0:u.trim().length)>0){d.field=d.field.trim();const p={name:d.field,capiton:d.headerName,defaultValue:d.defaultValue,type:d.dataType||d.type||"string",maxLength:d.maxLength||-1};r.addField(p),d.colId=d.colId||d.field,a.gridOptions.api.getColumnDef(d.colId)||(d.headerComponentParams={template:`${this.getGridHeaderTemplate({color:d.headerTextColor,backColor:d.headerBackColor,fontSize:d.fontSize,title:d.headerName||d.title||d.caption})}`},d.headerClass=()=>{var g,I,b,S,M;let h="er-grid-header-align-center";return((g=d.headerAlignment)==null?void 0:g.toLowerCase())==="near"||((I=d.headerAlignment)==null?void 0:I.toLowerCase())==="left"?h="er-grid-header-align-left":(((b=d.headerAlignment)==null?void 0:b.toLowerCase())==="far"||((S=d.headerAlignment)==null?void 0:S.toLowerCase())==="right")&&(h="er-grid-header-align-right"),d.required&&((M=d.requiredCondition)==null?void 0:M.trim().length)>0?h=h+" er-grid-header-maroon-star":d.required&&(h=h+" er-grid-header-red-star"),h},d.editable=d.editable===void 0?!0:d.editable,d.autoHeaderHeight=d.autoHeaderHeight===void 0?!0:d.autoHeaderHeight,d.enableRowGroup=d.enableRowGroup===void 0?!0:d.enableRowGroup,typeof d.editable!="function"&&(d.context=d.context||{},d.context.editable=d.editable,d.headerTooltip=d.headerName||d.title||d.caption,d.editable=h=>{var g,I;return((g=h.context)==null?void 0:g.editable)&&((I=h.colDef.context)==null?void 0:I.editable)&&!h.node.rowPinned}),d.filter=d.filter===void 0?"agSetColumnFilter":d.filter,d.filterParams={excelMode:"windows"},c.push(d))}}),a.gridOptions.api.setColumnDefs(c)}}return this}removeGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=t.split(","),l.length>0){let r=a.gridOptions.api.getColumnDefs()||[];r=r.filter(c=>!l.includes(c.colId)),a.gridOptions.api.setColumnDefs(r)}}return this}getGridColumnFields(e,t="string"){var r,c,d;const a=this.getGrid(e);let l=t==="Array"?[]:void 0;if((c=(r=a==null?void 0:a.gridOptions)==null?void 0:r.context)!=null&&c.configId){const u=this.getConfigInfo(a.gridOptions.context.configId);((d=u==null?void 0:u.TSI00GRIDCOLUMN)==null?void 0:d.length)>0&&u.TSI00GRIDCOLUMN.forEach(p=>{p.FIELD_NAME.trim().length>0&&p.UNBOUND_TYPE==="0"&&(t==="Array"?l.push(p.FIELD_NAME.trim()):l=l?l+","+p.FIELD_NAME.trim():p.FIELD_NAME.trim())})}return l}setGridEnable(e,t){var l,r,c;const a=this.getGrid(e);return(l=a==null?void 0:a.gridOptions)!=null&&l.context&&(a.gridOptions.api.stopEditing(),a.gridOptions.context.enable=t,(c=(r=a==null?void 0:a.gridOptions)==null?void 0:r.context)!=null&&c.configId&&(this.setGridOptions(a.gridOptions.context.configId,"enable",t,!0),document.querySelectorAll(".ag-full-width-row").forEach(u=>{u.style!==void 0&&(t?u.style.pointerEvents="all":u.style.pointerEvents="none")}))),this}setGridEditable(e,t){var l,r,c;const a=this.getGrid(e);return(l=a==null?void 0:a.gridOptions)!=null&&l.context&&(a.gridOptions.api.stopEditing(),a.gridOptions.context.editable=t,(c=(r=a==null?void 0:a.gridOptions)==null?void 0:r.context)!=null&&c.configId&&this.setGridOptions(a.gridOptions.context.configId,"editable",t,!0)),this}setGridIndicator(e,t,a){if(e&&t&&Object.keys(t).length>0){const l=this.getGrid(e);setTimeout(()=>{var r,c,d,u,p,h,g;if((r=l==null?void 0:l.gridOptions)!=null&&r.api&&((d=(c=l==null?void 0:l.gridOptions)==null?void 0:c.context)!=null&&d.bindingSource)){const I=(u=l==null?void 0:l.gridOptions)==null?void 0:u.api,S=((h=(p=l==null?void 0:l.gridOptions)==null?void 0:p.context)==null?void 0:h.bindingSource).data().find(M=>{for(const D in t)if(M[D]!==t[D])return!1;return!0});if(S!=null&&S.uid){I.clearFocusedCell();const M=(g=l==null?void 0:l.gridOptions)==null?void 0:g.api.getRowNode(S==null?void 0:S.uid);M&&this.setGridFocusedCell(e,M.rowIndex,n.SysInfo.GridCheckColumnFieldName,a)}}},250)}return this}refreshGridFooterData(e){var a,l,r;const t=this.getGrid(e);if((a=t==null?void 0:t.gridOptions)!=null&&a.api){const c=(l=t==null?void 0:t.gridOptions)==null?void 0:l.api;if(c.getPinnedBottomRowCount()>0){c.refreshClientSideRowModel("aggregate");const d=c.getModel();c.setPinnedBottomRowData([{...(r=d==null?void 0:d.rootNode)==null?void 0:r.aggData,pinndeRowType:"ErGridSummaryFooter"}])}}return this}setLayoutConfigRelationInfo(e,t){return this._layoutConfigRelationInfo[t]=e,this}getConfigIdbyLayoutName(e){return this._layoutConfigRelationInfo[e]&&this._layoutConfigRelationInfo[e].trim().length>0?this._layoutConfigRelationInfo[e].trim():e}getGridConfigId(e){let t="";return e&&(typeof e=="string"&&this._gridInstanceInfo[e]!==void 0?t=e:e.gridOptions&&e.gridOptions.api&&(t=e.gridOptions.gridId)),t}setWidgetInstanceInfo(e,t,a){return this.isNullOrEmpty(e)||(this._widgetInstanceInfo[e.trim()]===void 0&&(this._widgetInstanceInfo[e.trim()]={}),!this.isNullOrEmpty(t)&&a&&(this._widgetInstanceInfo[e.trim()][t.trim()]=a)),this}setControlVisible(e,t,a,l="none"){return!this.isNullOrEmpty(e)&&(a==null?void 0:a.trim().length)>0&&(e=this.getConfigIdbyLayoutName(e),a.split(",").forEach(c=>{c.trim().length>0&&(l==="empty"?this.setControlEmptyValue(e,c):l==="default"&&this.setControlDefalutValue(e,c),this.setLayoutItemOption(e,c.trim(),{visible:t}))})),this}setGridColumnTitle(e,t){if((t==null?void 0:t.length)>0){const a=this.getGrid(e);a&&(t.forEach(l=>{var c;const r=a.gridOptions.columnApi.getColumn(l.colId);if(r!=null&&r.colDef){const d=((c=r.colDef.context)==null?void 0:c.titleInfo)||{};r.colDef.headerComponentParams={template:`${this.getGridHeaderTemplate({...d,...l})}`}}}),a.gridOptions.api.refreshHeader())}return this}setGridColumnOptions(e,t){if(e&&t instanceof Function){const a=this.getGrid(e);if(a){const l=a.gridOptions.api.getColumnDefs();l.forEach(r=>{t(r)}),a.gridOptions.api.setColumnDefs(l)}}return this}setGridOptions(e,t,a,l=!1){return e=(e==null?void 0:e.trim())||"",t=(t==null?void 0:t.trim())||"",e.length>0&&t.length>0&&(l?(this._gridReactiveOptions[e]=this._gridReactiveOptions[e]||{},this._gridReactiveOptions[e][t]=a):(this._gridOptions[e]=this._gridOptions[e]||{},this._gridOptions[e][t]=a)),this}getGridOptions(e,t,a=!1){if(e=(e==null?void 0:e.trim())||"",t=(t==null?void 0:t.trim())||"",e.length>0&&t.length>0){if(a&&this._gridReactiveOptions[e])return this._gridReactiveOptions[e][t];if(!a&&this._gridOptions[e])return this._gridOptions[e][t]}}getLayoutExtentedOptions(e){var r,c;let t={};const a=this.getFormSysInfo("LayoutDefaultOptions");a.trim().length>0&&(t={...JSON.parse(a)});const l=this.getConfigInfo(e);if(((r=l==null?void 0:l.TSI00GRIDVIEW)==null?void 0:r.length)>0){const d=l.TSI00GRIDVIEW[0];if(((c=d.EXT_OPTIONS)==null?void 0:c.trim().length)>0){const u=JSON.parse(d.EXT_OPTIONS);t={...t,...u}}}return t}getGridExtentedOptions(e){var r,c;let t={};const a=this.getFormSysInfo("GridDefaultOptions");a.trim().length>0&&(t={...JSON.parse(a)});const l=this.getConfigInfo(e);if(((r=l==null?void 0:l.TSI00GRIDVIEW)==null?void 0:r.length)>0){const d=l.TSI00GRIDVIEW[0];if(((c=d.EXT_OPTIONS)==null?void 0:c.trim().length)>0){const u=JSON.parse(d.EXT_OPTIONS);t={...t,...u}}}return t}getDetailGridRenderOptions(e,t,a,l){const r=this.getGridConfigOptions(e,t,a,l);return{context:r==null?void 0:r.context,defaultColDef:r==null?void 0:r.defaultColDef,groupDisplayType:r==null?void 0:r.groupDisplayType,columnDefs:r==null?void 0:r.columnDefs,groupIncludeTotalFooter:r==null?void 0:r.groupIncludeTotalFooter,groupIncludeFooter:r==null?void 0:r.groupIncludeFooter,suppressRowClickSelection:r==null?void 0:r.suppressRowClickSelection,rowSelection:r==null?void 0:r.rowSelection,groupRowRendererParams:r==null?void 0:r.groupRowRendererParams,localeText:Ro(),enableRangeSelection:!0,stopEditingWhenCellsLoseFocus:!0,suppressRowTransform:!0,enableRtl:_o(),statusBar:{statusPanels:[{statusPanel:"agAggregationComponent",align:"center"},{statusPanel:"agTotalAndFilteredRowCountComponent",align:"right"}]},getRowId:d=>d.data.uid,getRowStyle:d=>this.getRowStyle(d,{showDefaultFooter:!0}),getMainMenuItems:d=>this.getGridMenuItems(d),getContextMenuItems:d=>this.getGridContextMenuItems(d),onGridReady:d=>d.api.setPopupParent(document.querySelector("body")),onRowSelected:d=>this.processRowSelectedEvent(d)}}getGridEditable(e){var a,l;const t=this.getGrid(e);return((l=(a=t==null?void 0:t.gridOptions)==null?void 0:a.context)==null?void 0:l.editable)===!0}getControl(e,t,a){let l;if(this._widgetInstanceInfo[e.trim()]&&this._widgetInstanceInfo[e.trim()][t.trim()]&&(l=this._widgetInstanceInfo[e.trim()][t.trim()]),l==null)if(a&&a.trim().length>0)l=i.jQuery("#"+this._formId+e+t);else{const r=this.getSingleItemConfigInfo(e,t);if(r.FUNCTION_TYPE&&r.COLUMN_EDIT){const c=r.FUNCTION_TYPE+r.COLUMN_EDIT;a=this.getControlName(c,r.FORMAT_STRING),l=i.jQuery("#"+this._formId+e+t)}}return l}isControlEmptyValue(e,t,a){let l=!0;const r=this.getControlValue(e,t),c=Object.keys(r);for(let d=0;d<c.length;d++)if(r[c[d]]!==null&&String(r[c[d]]).trim().length>0){l=!1;break}return l}setControlConditionProps(e,t,a="ReadOnly",l,r){if(a=(a==null?void 0:a.trim())||"ReadOnly",(e==null?void 0:e.trim().length)>0){const c=e.trim()+"_"+a+"_"+(t==null?void 0:t.trim());let d=[];if(this._controlConditionProps[c])d=this._controlConditionProps[c];else if(this._configInfo.TSI00GRIDCONDITION&&this._configInfo.TSI00GRIDCONDITION.getMappedRows().length>0){const u=this.getSingleViewConfigInfo(e==null?void 0:e.trim());if(u)for(let p=0;p<this._configInfo.TSI00GRIDCONDITION.getMappedRows().length;p++){const h=this._configInfo.TSI00GRIDCONDITION.data[p];if(i.toString(h.FUNCTION_ID,!0)!==e||(t==null?void 0:t.trim().length)>0&&i.toString(h.OPERATE_NAME,!0)!==(t==null?void 0:t.trim())||u.MATCH_FLAG==="1"&&i.toString(h.COMPANY_CODE,!0)!==m.CompanyCode||i.toString(h.FIELD_NAME_ARRAY,!0).length===0)continue;const g=i.toString(h.FIELD_NAME_ARRAY,!0).split(",");h.FIELD_NAME_ARRAY=g,d.push(h)}}if(d.length>0){this._controlConditionProps[c]=d;const u=this.getAllControlValue(e);d.forEach(p=>{const h=p.FIELD_NAME_ARRAY;let g=l??p.PROP_VALUE??"default";h.forEach(I=>{if(I&&!(r!=null&&r.includes(I))){const b=i.toString(p.REGULAR_EXPRESS,!0),S=b.length===0||b.replaceAll(" ","")==="1=1"||i.checkExpressionValid(u,i.getSystemFormatString(b));g=g==!0||g==="1"||i.toString(g).toLowerCase()==="true",a==="ReadOnly"&&this.setControlReadOnly(e,S?g:"default",I)}})})}}return this}getControlValue(e,t){let a,l;if(e.trim().length>0&&t.trim().length>0){const r=t.split(",");r.length>1&&(l={});const c=this.getLayoutBindModel(e);if(c)for(let d=0;d<r.length;d++){const u=r[d].trim();if(a=null,u.length===0)continue;const p=this.getLayoutItemOption(e,u,"controlType"),h=this.getLayoutItemOption(e,u,"field");(h==null?void 0:h.trim().length)>0?a=c[h.trim()]:this._hiddenFields[e.trim()]?a=this._hiddenFields[e.trim()][u]||"":a=c[u],["antInput","antInputGroup","antTextarea","erSelect","erTreeSelect","erMemoEditor"].includes(p)?a=a||"":p==="antInputNumber"&&a==null&&(a=0),r.length>1?l[u]=a:l=a}}return l}getControlText(e,t){let a,l;if(e.trim().length>0&&t.trim().length>0){const r=t.split(",");r.length>1&&(l={});const c=this.getLayoutBindModel(e);if(c)for(let d=0;d<r.length;d++){const u=r[d].trim();if(a=null,u.length===0)continue;const p=this.getLayoutItemOption(e,u,"field"),h=this.getLayoutItemOption(e,u,"controlType"),g=this.getLayoutItemOption(e,u,"format");(p==null?void 0:p.trim().length)>0?a=c[p.trim()]:this._hiddenFields[e.trim()]?a=this._hiddenFields[e.trim()][u]||"":a=c[u],["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect"].includes(h)?a=this.getDropDownSelectedText(e,u,a):h==="antDateTimePicker"||h==="antDatePicker"||h==="antMonthPicker"||h==="antYearPicker"?a=i.toDateTime(a,"Dayjs").format(g||"YYYY-MM-DD"):h==="antInputNumber"&&(a=n.Core.formatNumberValue(a,g)),r.length>1?l[u]=a:l=a}}return l}setControlValue(e,t,a){if(i.isNullOrEmpty(e)||i.isNullOrEmpty(t))return this;if(a===void 0&&(a=null),(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0){const l=this.getLayoutBindModel(e==null?void 0:e.trim()),r=this.getLayoutItemOption(e,t,"controlType"),c=this.getLayoutItemOption(e,t,"field")||(t==null?void 0:t.trim());if(l&&c&&(["antMultiSelect","erMultiSelect"].includes(r)?a!==null?a instanceof Array?l==null||l.set(c,a,e):typeof a=="string"&&(l==null||l.set(c,a.split(","),e)):l==null||l.set(c,[],e):a!==null&&(r!=null&&r.startsWith("antCheckbox")||r!=null&&r.startsWith("antSwitch"))?l==null||l.set(c,i.toString(a)==="1"||i.toString(a).toLowerCase()==="true",e):a!==null&&(r!=null&&r.startsWith("antDate"))?l==null||l.set(c,i.toDateTime(a,"Dayjs"),e):l==null||l.set(c,a,e)),this._layoutConditionStyleInfo[e]){const d=this._layoutConditionStyleInfo[e];Object.keys(d).forEach(u=>{var p,h;(u===t||((h=(p=d[u])==null?void 0:p.condition)==null?void 0:h.indexOf(t))>-1)&&this.setLayoutConditionStyle(e,u)})}}return this}setControlValueEx(e,t,...a){const l=Object.keys(t);return(l==null?void 0:l.length)>0&&(a.length===1&&(a=a[0].split(",")),a.length>0?a.forEach(r=>{(t==null?void 0:t[r])!==void 0&&this.setControlValue(e,r,t[r])}):l.forEach(r=>{(t==null?void 0:t[r])!==void 0&&this.setControlValue(e,r,t[r])})),this}setControlCss(e,t,a){if((e==null?void 0:e.trim().length)>0&&(a==null?void 0:a.length)>0){let l;t instanceof Array?l=t:l=t.split(","),l&&l.length>0&&l.forEach(r=>{if(r.trim().length>0){const c=this.getLayoutItemOption(e,r,"controlType");let d=document.getElementsByName(this.FormId+e+r);if((d==null?void 0:d.length)>0){let u;switch(c){case"erSelect":case"erMultiSelect":case"antMultiSelect":case"erTreeSelect":case"erMultiTreeSelect":u=d[0].getElementsByClassName("ant-select-selector");break;case"antInput":case"antInputNumber":u=document.getElementById(this.FormId+e+r);break;case"antDateTimePicker":case"antDatePicker":case"antMonthPicker":case"antYearPicker":u=d[0].getElementsByClassName("ant-picker-input");break}a.forEach(p=>{(u==null?void 0:u.length)>0?p.value!==void 0&&n.Core.jQuery(u).css(p.property,p.value):p.value!==void 0&&n.Core.jQuery(d).css(p.property,p.value)})}else d=document.getElementById(this.FormId+e+r),d&&a.forEach(u=>{u.value!==void 0&&n.Core.jQuery(d).css(u.property,u.value)})}})}return this}setModelDefalutValue(e,t,a,l){let r;return t instanceof Array?r=t:r=t.split(","),a&&a.trim().length>0?r.forEach(c=>{if(c=this.getConfigIdbyLayoutName(c),e&&a&&e.schemaFields&&e.schemaFields[a]){const d=this.getSingleItemConfigInfo(c,a);let u=null;d.DEFAULT_VALUE&&d.DEFAULT_VALUE.trim().length>0?u=d.DEFAULT_VALUE:this._customDefaultValues[c]&&this._customDefaultValues[c][a]!==void 0?u=this._customDefaultValues[c][a]:l&&(u=l),u&&u.trim().length>0&&e.schemaFields[a].type&&(e.schemaFields[a].type==="datetime"?e.set(a,i.getDateTimeByString(u),c):e.schemaFields[a].type==="boolean"?e.set(a,u==="1"||u.toLowerCase()==="true",c):e.schemaFields[a].type==="number"?e.set(a,u,c):e.set(a,this.getDefaultStringValue(u),c),this.setControlValue(c,a,e[a]))}}):r.forEach(c=>{c=this.getConfigIdbyLayoutName(c);const d=this.getConfigInfo(c);d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(u=>{let p=null;if(a=u.ITEM_CODE,e&&a&&e.schemaFields&&e.schemaFields[a]){const h=this.getSingleItemConfigInfo(c,a);h.DEFAULT_VALUE&&h.DEFAULT_VALUE.trim().length>0?p=h.DEFAULT_VALUE:this._customDefaultValues[c]&&this._customDefaultValues[c][a]!==void 0?p=this._customDefaultValues[c][a]:l&&(p=l),p&&p.trim().length>0&&e.schemaFields[a].type&&(e.schemaFields[a].type==="datetime"?e.set(a,i.getDateTimeByString(p)):e.schemaFields[a].type==="boolean"?e.set(a,p==="1"||p.toLowerCase()==="true"):e.schemaFields[a].type==="number"?e.set(a,p):e.set(a,this.getDefaultStringValue(p)),this.setControlValue(c,a,e[a]))}})}),this}setModelValue(e,t,...a){return i.setModelValue(e,t,...a),this}setModelEmptyValue(e,...t){return t.length===1&&(t=t[0].split(",")),t.length>0?t.forEach(a=>{e&&e[a]!==void 0&&e.set(a,null)}):e.schemaFields&&Object.keys(e.schemaFields).forEach(a=>{e.set(a,null)}),this}setControlReadOnlyEx(e,t){return t&&Object.keys(t).forEach(a=>{this.setControlReadOnly(e,t[a],a)}),this}setControlReadOnly(e,t,...a){if(i.isNullOrEmpty(e))return this;a.length===1&&(a=a[0].split(",")),e=this.getConfigIdbyLayoutName(e);for(const l of a){const r=this.getSingleItemConfigInfo(e,l);let c=!0,d=!1;r.FUNCTION_TYPE&&r.COLUMN_EDIT&&(t!=="default"&&!t&&r.READ_ONLY==="1"&&(r.COLUMN_EDIT!=="1"||r.ALLOW_EDIT!=="1")||(t==="default"?(d=r.READ_ONLY==="1"||r.FUNCTION_TYPE!=="F"&&r.ALLOW_EDIT!=="1",c=r.ALLOW_EDIT==="1"):(d=t,c=!d),this.setLayoutItemOption(e,l,{readOnly:d}),r.COLUMN_EDIT==="1"&&this.setLayoutItemOption(e,l,{buttonEnable:c})))}return this}setAllControlReadOnly(e,t){let a;return e instanceof Array?a=e:a=e.split(","),a&&a.length>0&&a.forEach(l=>{if(l.trim().length>0){const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{this.setControlReadOnly(l.trim(),t,c.ITEM_CODE)})}}),this}setControlEnable(e,t,...a){if(i.isNullOrEmpty(e))return this;a.length===1&&(a=a[0].split(",")),e=this.getConfigIdbyLayoutName(e);for(const l of a){const r=this.getSingleItemConfigInfo(e,l);let c=!0;r.FUNCTION_TYPE&&r.COLUMN_EDIT&&(t==="default"?c=r.ALLOW_EDIT==="1":c=t,this.setLayoutItemOption(e,l,{allowEdit:c}),r.COLUMN_EDIT==="1"&&this.setLayoutItemOption(e,l,{buttonEnable:c}))}return this}setAllControlEnable(e,t){let a;return e instanceof Array?a=e:a=e.split(","),a&&a.length>0&&a.forEach(l=>{if(l.trim().length>0){const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{this.setControlEnable(l.trim(),t,c.ITEM_CODE)})}}),this}setControlEmptyValue(e,...t){if(t.length===1&&(t=t[0].split(",")),!t||t.length===0){const a=this.getConfigInfo(e);a.TSI00GRIDVIEW&&a.TSI00GRIDVIEW.length>0&&a.TSI00GRIDVIEW[0].FUNCTION_TYPE==="F"&&a.TSI00GRIDCOLUMN&&a.TSI00GRIDCOLUMN.forEach(l=>{this.setControlValue(e,l.ITEM_CODE,null)})}else t.forEach(a=>{this.setControlValue(e,a,null)});return this}setAllControlDefalutValue(e,t=!1){let a;return e instanceof Array?a=e:a=e.split(","),a.length>0&&a.forEach(l=>{if(l.trim().length>0){const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{var d;((d=c.DEFAULT_VALUE)==null?void 0:d.trim().length)>0?this.setControlDefalutValue(l.trim(),c.ITEM_CODE,t):t||this.setControlEmptyValue(l,c.ITEM_CODE)})}}),this}setControlDefalutValue(e,t,a=!1){var l,r;if(i.isNullOrEmpty(e)||i.isNullOrEmpty(t))return this;if(e=this.getConfigIdbyLayoutName(e),(e==null?void 0:e.trim().length)>0){const c=this.getLayoutBindModel(e),d=this.getSingleItemConfigInfo(e,t),u=((l=this.getLayoutItemOption(e.trim(),t,"field"))==null?void 0:l.value)||t.trim(),p=c==null?void 0:c.get(u==null?void 0:u.trim());if(p!=null&&a)return this;const h=i.toString(d.DEFAULT_VALUE,!0);if(c&&h.length>0){let g=this.getDefaultStringValue(h),I=null;const b=this.getLayoutItemOption(e.trim(),t,"controlType");if(["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect","antRadioGroup","erRadioGroup","erCheckboxGroup"].includes(b)&&["$FIRST_ROW$","$LAST_ROW$","$ALL_VALUES$"].includes(h)&&this._dropDownBindSource[e]&&this._dropDownBindSource[e][t]){const S=this._dropDownBindSource[e][t];((r=S.dataSource)==null?void 0:r.length)>0&&S.dataValueField&&(h==="$FIRST_ROW$"?g=S.dataSource[0][S.dataValueField]:h==="$LAST_ROW$"?g=S.dataSource[S.dataSource.length-1][S.dataValueField]:["antMultiSelect","erMultiSelect"].includes(b)&&h==="$ALL_VALUES$"&&(g="",S.dataSource.forEach(M=>{g=g.length===0?M[S.dataValueField]:g+","+M[S.dataValueField]})))}["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(b)?I=i.getDateTimeByString(g):b==="antInputNumber"?I=i.toNumber(g):["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(b)?I=g.split(","):b==="antCheckbox"||b==="antSwitch"?I=g==="1"||g.toLowerCase()==="true":I=g,this.setControlValue(e,t,I)}}return this}getFormButtonConfigInfo(e){let t={},a=[];return this._configInfo.TSI00FORMBUTTON&&this._configInfo.TSI00FORMBUTTON.getMappedRows().length>0&&(a=this._configInfo.TSI00FORMBUTTON.getMappedRows(),a.length>0&&a.every((l,r)=>l.BUTTON_NAME===e?(t=l,!1):!0)),t}getSystemGlobalOptions(){let e={};const t=this.getFormSysInfo("SystemGlobalOptions");return t.trim().length>0&&(e=JSON.parse(t)),e}getFormExtentedOptions(){var a,l;let e={};const t=this.getFormSysInfo("FormDefaultOptions");if(t.trim().length>0&&(e={...JSON.parse(t)}),((a=this._configInfo.TSI00FORM)==null?void 0:a.length)>0){const r=this._configInfo.TSI00FORM[0];if(((l=r.EXT_OPTIONS)==null?void 0:l.trim().length)>0){const c=JSON.parse(r.EXT_OPTIONS);e={...e,...c}}}return e}resetLayout(e){let t;return e instanceof Array?t=e:t=e.split(","),t.length>0&&t.forEach(a=>{if(a.trim().length>0){const l=this.getConfigInfo(a.trim());l.TSI00GRIDVIEW&&l.TSI00GRIDCOLUMN&&l.TSI00GRIDCOLUMN.forEach(r=>{r.DEFAULT_VALUE&&r.DEFAULT_VALUE.trim().length>0?this.setControlDefalutValue(a.trim(),r.ITEM_CODE):this.setControlValue(a.trim(),r.ITEM_CODE,null)})}}),this}getAllControlValue(e,t){const a={};return(e instanceof Array?e:e.split(",")).forEach(r=>{if((r==null?void 0:r.trim().length)>0){const c=this.getLayoutBindModel(r.trim());if(c){const d=this.getConfigInfo(r.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(u=>{const p=this.getLayoutItemOption(r,u.ITEM_CODE,"controlType"),h=this.getLayoutItemOption(r,u.ITEM_CODE,"field")||u.ITEM_CODE,g=i.toNumber(u.MAX_LENGTH);if(h){let I=c[h];if(p==="antCheckbox"||p==="antSwitch")I=I===!0?"1":"0";else if(p==="antInputNumber")I=I||0;else if(["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(p)&&I){const b=i.toString(u.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss",S=i.getDateTimeFormatString(I,b);S.substring(0,4)==="0001"||S.substring(0,4)==="1900"||S.substring(0,4)==="1901"?I="":(I=S,g>0&&g<I.length&&(I=I.substring(0,g)))}else["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(p)&&I&&I instanceof Array?I=I.join(","):I=I||"";a[h]=I}})}}}),t&&Object.keys(t).length>0&&Object.keys(t).forEach(r=>{a[r]=t[r]}),a}getAllControlValueAsEiBlock(e,t,a){const l=this.getAllControlValue(e,t);let r=e;e instanceof Array&&(r=e[0]);const c=this.getLayoutExtentedOptions(r);return c!=null&&c.blockName&&(a=c.blockName),(a==null?void 0:a.trim().length)===0&&r.includes("Filter")&&(a="inqu_status"),i.buildEiBlock([l],a||"Table0")}getAllControlValueAsFilter(e,t){let a=i.buildEiBlock(void 0,"Table0");const l=[];return(e instanceof Array?e:e.split(",")).forEach(c=>{const d=this.getConfigInfo(c);d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(u=>{if(u.OPERATOR.trim().length>0&&u.OPERATOR.trim()!=="None"&&u.PARA_GROUP.trim().length>0&&u.PARA_GROUP.trim()!=="None"){const p=this.getLayoutItemOption(c,u.ITEM_CODE,"controlType"),h={};t&&Object.keys(t).length>0?Object.keys(t).forEach(S=>{h[S]=t[S]}):h.QUERY_TYPE="",h.COMPANY_CODE=u.COMPANY_CODE,h.FORM_NAME=u.FORM_NAME,h.FUNCTION_ID=u.FUNCTION_ID,h.ITEM_CODE=i.toString(u.ITEM_CODE,!0,"toLower"),h.ORIGIN_CODE=u.ORIGIN_CODE,h.TABLE_NAME=u.TABLE_NAME,h.FIELD_NAME=i.toString(u.PARA_NAME,!0,"toLower"),h.OPERATOR=u.OPERATOR,h.PARA_GROUP=u.PARA_GROUP,h.SQL_CONTENT=u.SQL_CONTENT,h.OP_VALUE=null,h.DATA_TYPE="String";const g=i.toString(h.PARA_GROUP,!0),I=i.toString(h.OPERATOR,!0);let b=this.getControlValue(c,u.ITEM_CODE)||"";if(I.length>0)switch(p){case"antRadioGroup":case"erRadioGroup":case"erSelect":case"erTreeSelect":{h.OP_VALUE=b,h.ORIGIN_CODE==="4"&&u.SVC_NAME.trim().length>0&&h.OP_VALUE.trim().length>0&&h.OPERATOR==="SQL"&&(h.ORIGIN_CODE="SIU",h.SQL_CONTENT=this.getFormCodeSetFilter(u.SVC_NAME,h.OP_VALUE)),(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h);break}case"antInputNumber":{h.DATA_TYPE="Decimal",h.OP_VALUE=b,h.OP_VALUE===null&&(h.OP_VALUE=0),(g==="2"||i.toNumber(h.OP_VALUE)!==0)&&l.push(h);break}case"antCheckbox":case"antSwitch":{h.OPERATOR="=",h.OP_VALUE=b===!0?"1":b===!1?"0":"",(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":case"erMultiTreeSelect":{h.OPERATOR="IN",b&&b instanceof Array&&b.length>0?b="'"+b.join("','")+"'":b="",h.OP_VALUE=b,(g==="2"||b.length>0)&&l.push(h);break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{if(b){const S=i.toString(u.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss";h.OP_VALUE=i.getDateTimeFormatString(b,S),h.OP_VALUE.length>=4&&(h.OP_VALUE.substring(0,4)==="0001"||h.OP_VALUE.substring(0,4)==="1900")&&(h.OP_VALUE=""),(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h)}break}default:{i.toString(b,!0).length>0&&I==="IN"&&(b="'"+b.split(/\n|\t|,|,/).join("','")+"'"),h.OP_VALUE=b,(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h);break}}}})}),l.length>0&&(a=i.buildEiBlock(l,"QUERY_FILTER")),a}expandLayoutGroup(e){let t=[];e&&(e instanceof Array?t=e:t=e.split(",")),t.length===0&&(t=this.getAllConfigIdArray());for(let a=0;a<t.length;a++)if(t[a].trim().length>0){const l=document.getElementById(this.FormId+t[a].trim()+"_content");l&&i.jQuery(l).show()}return this}collapseLayoutGroup(e){let t=[];e&&(e instanceof Array?t=e:t=e.split(",")),t.length===0&&(t=this.getAllConfigIdArray());for(let a=0;a<t.length;a++)if(t[a].trim().length>0){const l=document.getElementById(this.FormId+t[a].trim()+"_content");l&&i.jQuery(l).hide()}return this}async queryDataByButton(e,t,a,l){return new Promise((r,c)=>{let d=new Ze.EiInfo;const u=this.getFormButtonConfigInfo(e);if(u&&u.SVC_NAME.trim().length>0){const p=new Ze.EiInfo,h=u.SVC_NAME,g={};u.TYPE_DESC&&u.TYPE_DESC.trim().length>0&&(g[u.TYPE_DESC]=u.TYPE),l&&Object.keys(l).length>0&&Object.keys(l).forEach(M=>{g[M]=l[M]});const I=this.getAllControlValueAsEiBlock(t,g),b=this.getAllControlValueAsFilter(t,g);let S=u.FILTER_STRING;a&&a.trim().length>0&&(S.trim().length>0?S=S+" and "+a:S=a),S.trim().length>0&&this.getQuerySqlFormat(S),p.addBlock(I),p.addBlock(b),this.callService(h,p,{show:!0}).then(M=>{d=M,r(d)})}else d.SysInfo.Flag=-603,d.SysInfo.Msg="未调用后台服务",r(d)})}async queryDataByService(e,t){return new Promise((a,l)=>{let r=new Ze.EiInfo;if(e.trim().length>0){const c=new Ze.EiInfo;if(t&&t.filterConfigId&&t.filterConfigId.trim().length>0){let d=this.getAllControlValueAsEiBlock(t.filterConfigId,t.queryType);const u=this.getAllControlValueAsFilter(t.filterConfigId,t.queryType);if(d.getMappedRows().length>0){const p=d.getMappedRows()[0];d=i.buildEiBlock([p])}c.addBlock(d),c.addBlock(u)}if(t&&t.customFilter&&t.customFilter.trim().length>0){const d=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(t.customFilter),DATA_TYPE:"",OP_VALUE:"*"}];if(!c.getBlock("QUERY_FILTER")){const u=i.buildEiBlock(d,"QUERY_FILTER");c.addBlock(u)}}this.callService(e,c).then(d=>{var u,p,h,g;if(r=d,n.Core.toNumber((u=r.SysInfo)==null?void 0:u.Flag)>=0&&t&&t.dataTable){if(t.dataTable instanceof j)this.mergeDataToDataTable(r,t.dataTable,t.clearTable);else if(typeof t.dataTable=="string"&&t.dataTable.trim().length>0)if((p=this._formDataSet)!=null&&p.contains(t.dataTable.trim()))this.mergeDataToDataTable(r,(h=this._formDataSet)==null?void 0:h.getDataTable(t.dataTable.trim()),t.clearTable);else{const I=this.getBindingTableName(t.dataTable.trim());I.trim().length>0&&this.mergeDataToDataTable(r,(g=this._formDataSet)==null?void 0:g.getDataTable(I.trim()),t.clearTable)}}a(r)})}else r.SysInfo.Flag=-603,r.SysInfo.Msg="No service available",a(r)})}async queryDataByDataSource(e,t,a=""){return new Promise(async(l,r)=>{var p,h,g,I;let c=new Ze.EiInfo,d=!1,u="";if(e.trim().length>0){let b="";const S=this.getGridConfig(e);((p=S==null?void 0:S.SVC_NAME)==null?void 0:p.trim().length)>0&&(u=e,e=S.SVC_NAME.trim(),b=S.FILTER_STRING.trim(),d=!0);const M=new Ze.EiInfo;if(t&&t.filterConfigId&&t.filterConfigId.trim().length>0){let V=this.getAllControlValueAsEiBlock(t.filterConfigId,t.queryType);const P=this.getAllControlValueAsFilter(t.filterConfigId,t.queryType);if(V.getMappedRows().length>0){const J=V.getMappedRows()[0];V=i.buildEiBlock([J])}M.addBlock(V),M.addBlock(P)}if(i.toString(t==null?void 0:t.customFilter,!0).length>0&&(b.trim().length>0?b=b+" and "+i.toString(t==null?void 0:t.customFilter,!0):b=i.toString(t==null?void 0:t.customFilter,!0)),b.trim().length>0){const V=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(b),DATA_TYPE:"",OP_VALUE:"*"}];if(!M.getBlock("QUERY_FILTER")){const P=i.buildEiBlock(V,"QUERY_FILTER");M.addBlock(P)}}const D=(I=(g=(h=this._configInfo)==null?void 0:h.TSI00DATASOURCE)==null?void 0:g.getMappedRows())==null?void 0:I.find(V=>V.FUNC_ID===e),A=V=>{this.callService(V,M,{show:t==null?void 0:t.showLoading},{messageError:!0}).then(P=>{var J,N,te;c=P,n.Core.toNumber((J=c.SysInfo)==null?void 0:J.Flag)>=0&&(t&&t.dataTable?t.dataTable instanceof j?this.mergeDataToDataTable(c,t.dataTable,t.clearTable):typeof t.dataTable=="string"&&t.dataTable.trim().length>0&&((N=this._formDataSet)!=null&&N.contains(t.dataTable.trim()))&&this.mergeDataToDataTable(c,(te=this._formDataSet)==null?void 0:te.getDataTable(t.dataTable.trim()),t.clearTable):d===!0&&this.mergeDataToGrid(c,u,t==null?void 0:t.clearTable)),l(c)})};if(D!=null&&D.FUNC_ID){if(D.ORIGIN_CODE==="SVC"&&D.SVC_NAME.trim().length>0)A(D.SVC_NAME.trim());else if(D.SQL_CONTENT.trim().length>0){const V=i.buildEiBlock([{OPERATE_TYPE:"sql_query",FUNCTION_ID:D.FUNC_ID,SQL:this.getQuerySqlFormat(D.SQL_CONTENT),FILTER_STRING:"",GROUP_COL:D.GROUP_KEY_VALUE,SORT_COL:D.PRI_KEY_SQL}],"DATA_SOURCE");M.addBlock(V),i.toString(a).trim().length===0&&D.SVC_NAME.trim().length>0&&(a=D.SVC_NAME.trim()),i.toString(a).trim().length===0&&(a="JAER01/query"),A(a)}}else{const V=i.buildEiBlock([{FUNCTION_ID:e,COMPANY_CODE:n.SysInfo.CompanyCode}],"DATA_SOURCE");M.addBlock(V),i.toString(a).trim().length===0&&(a="JAER01/query"),A(a)}}else c.SysInfo.Flag=-603,c.SysInfo.Msg="DataSoureId is null or empty!",l(c)})}async queryDataToGrid(e,t,a,l){const r=this.getAllControlValueAsEiBlock(t,void 0,l==null?void 0:l.filterBlockId),c=this.getGridStructureAsBlock(a,!1,l==null?void 0:l.gridBlockId);let d=new Ze.EiInfo;d.addBlock(r),d.addBlock(c),l!=null&&l.processInInfo&&l.processInInfo instanceof Function&&(d=l.processInInfo(d));const u=(l==null?void 0:l.loadingOptions)||{show:!0},p=(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0},h=await this.callService(e,d,u,p);l!=null&&l.mergeToGrid&&l.mergeToGrid instanceof Function?l.mergeToGrid(h):this.mergeDataToGrid(h.getBlock((l==null?void 0:l.gridBlockId)||"result"),a)}saveGridData(e,t,a,l){const r=[];return new Promise(async(c,d)=>{if((a==null?void 0:a.trim().length)>0)if(this.hasDataChange(a)){if(l=l||{},l.messageConfirm=l.messageConfirm??"是否确认保存",l.messageConfirm){const h=typeof l.messageConfirm=="string"?l.messageConfirm:"是否确认保存";if(!await this.messageConfirm(h)){c({results:[],success:!0,message:"保存取消"});return}}if(typeof e=="string"){const h=this.getGridChangedRowsAsEiInfo(a);h.addBlock(this.getAllControlValueAsEiBlock(t,void 0,l==null?void 0:l.filterBlockId)),r.push(this.callService(e,h,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}else if(mo.isPlainObject(e)){const h=this.getAllControlValueAsEiBlock(t,void 0,l==null?void 0:l.filterBlockId);if(e.deleteService&&e.deleteService.trim().length>0){const g=this.getGridDeletedRowsAsBlock(a);if(g.getMappedRows().length>0){g.rename("result");const I=new Ze.EiInfo;I.addBlock(h),I.addBlock(g),r.push(this.callService(e.deleteService,I,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}}if(e.updateService&&e.updateService.trim().length>0){const g=this.getGridModifyRowsAsBlock(a);if(g.getMappedRows().length>0){g.rename("result");const I=new Ze.EiInfo;I.addBlock(h),I.addBlock(g),r.push(this.callService(e.updateService,I,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}}if(e.insertService&&e.insertService.trim().length>0){const g=this.getGridCreatedRowsAsBlock(a);if(g.getMappedRows().length>0){g.rename("result");const I=new Ze.EiInfo;I.addBlock(h),I.addBlock(g),r.push(this.callService(e.insertService,I,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}}}const u=await Promise.allSettled(r);let p=!0;u.forEach(h=>{h.status==="fulfilled"&&h.value.getStatus()<0?(this.messageError(h.value.getMsg()),p=!1):h.status!=="fulfilled"&&(p=!1)}),p&&(l!=null&&l.queryService)&&this.queryDataToGrid(l.queryService,t,a,l),c({results:u,success:p,message:p?"保存成功":"保存失败"})}else{c({results:[],success:!0,message:"没有数据变更,无需保存"}),this.messageInfo("没有数据变更,无需保存");return}else d(new Error("gridConfId is null or empty!"))})}getFormCodeSetFilter(e,t){let a="";if(this._configInfo[this._formName+e]){for(const l of this._configInfo[this._formName+e].getMappedRows())if(l.CODE===t){a=l.SQL_CONTENT;break}}return a}getQuerySqlFormat(e,t){return i.getSystemFormatString(e,t)}getFormSysInfo(e){return this._configInfo.BM2A_SYSTEM_INFO&&this._configInfo.BM2A_SYSTEM_INFO.getMappedRows().length>0&&e.trim().length>0?i.toString(this._configInfo.BM2A_SYSTEM_INFO.getMappedRows()[0][e.trim().toUpperCase()]):""}getSysParaValue(e,t,a){return new Promise((l,r)=>{if(this._sysParaInfo&&this._sysParaInfo[e]!==void 0&&this._sysParaInfo[e][t]!==void 0)l(this._sysParaInfo[e][t].toString());else if(t&&t.trim().length>0){const c=new Ze.EiInfo;let d="";const u=i.buildEiBlock([{QUERY_TYPE:"system_para",COMPANY_CODE:e,CTRL_CODE:t,EFFECT_ELEMENT_VALUE:a||""}]);c.addBlock(u),i.callService(n.SysInfo.queryDevConfigService,c).then(p=>{var h;p.getStatus()>=0&&p.getBlock("TSIFIAA51")&&p.getBlock("TSIFIAA51").getMappedRows().length>0?d=i.toString(p.getBlock("TSIFIAA51").getMappedRows()[0].CTRL_NUM):p.getStatus()>=0&&((h=p.getBlock("BM2A_SYSTEM_INFO"))==null?void 0:h.getMappedRows().length)>0&&(d=i.toString(p.getBlock("BM2A_SYSTEM_INFO").getMappedRows()[0][t.toUpperCase()])),this._sysParaInfo[e]===void 0&&(this._sysParaInfo[e]={}),this._sysParaInfo[e][t]=d,l(d)},()=>{this._sysParaInfo[e]===void 0&&(this._sysParaInfo[e]={}),this._sysParaInfo[e][t]="",l("")})}})}getDefaultStringValue(e){return e.trim().length>14&&e.trim().substring(0,13)==="$FormSysInfo."&&e.trim().substring(e.trim().length-1,e.trim().length)==="$"?e=this.getFormSysInfo(e.trim().substring(13,e.trim().length-1)):e=i.getSystemFormatString(e),e}setCustomDefaultValue(e,t){(e==null?void 0:e.trim().length)>0&&t&&(this._customDefaultValues[e.trim()]=t)}getLayoutConfigDefaultValues(e){const t={};let a;return e instanceof Array?a=e:a=e.split(","),a.length>0&&a.forEach(l=>{const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{if(c.DEFAULT_VALUE&&c.DEFAULT_VALUE.trim().length>0){const d=c.FUNCTION_TYPE+c.COLUMN_EDIT,u=c.DEFAULT_VALUE,p=this.getControlName(d,c.FORMAT_STRING);if(p&&p.trim().length>0&&u.trim().length>0)switch(p){case"antInputNumber":{t[c.ITEM_CODE]=parseFloat(u);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":{const h=this.getDefaultStringValue(u).split(",");t[c.ITEM_CODE]=h;break}case"antCheckbox":case"antSwitch":{t[c.ITEM_CODE]=i.toString(u)==="1"||i.toString(u)==="true";break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{t[c.ITEM_CODE]=i.getDateTimeByString(u);break}default:{t[c.ITEM_CODE]=this.getDefaultStringValue(u);break}}}})}),t}getGridConfigDefaultValues(e){const t={},a=this.getConfigInfo(e.trim()),l=this.getBindingTable(e.trim());return l&&a.TSI00GRIDVIEW&&a.TSI00GRIDCOLUMN&&a.TSI00GRIDCOLUMN.forEach(r=>{if(l.options.schema&&r.DEFAULT_VALUE&&r.DEFAULT_VALUE.trim().length>0){const c=l.options.schema[r.FIELD_NAME].type;c==="datetime"?t[r.FIELD_NAME]=i.getDateTimeByString(r.DEFAULT_VALUE):c==="boolean"?t[r.FIELD_NAME]=r.DEFAULT_VALUE==="1"||r.DEFAULT_VALUE.toLowerCase()==="true":c==="number"?t[r.FIELD_NAME]=i.toNumber(r.DEFAULT_VALUE):t[r.FIELD_NAME]=this.getDefaultStringValue(r.DEFAULT_VALUE)}}),t}async loadGrid(e,t,a,l,r){var c,d,u,p,h,g,I,b,S;if(!this.containsConfig(e)&&(a==null?void 0:a.forceLoadConfig)!==!1&&await this.loadConfig(e),this.containsConfig(e)){if(this._gridInstanceInfo[e])return console.error(`Grid instance ${e} already exists!`),!1;const M=this.getSingleViewConfigInfo(e);this.setGridToolbarVisible(e,{refresh:M.SHOW_REFRESH==="1",addrow:M.SHOW_ADD==="1",copyrow:M.SHOW_ADDCOPY==="1",delete:M.SHOW_DELETE==="1",cancel:!1,save:!1,excel:M.SHOW_EXPORT==="1",import:M.ALLOW_IMPORT==="1"}),this._gridColumnsConfigInfo[e]={},this._gridColumnsInfo[e]={},this._allowMergeColumnFields[e]=[],this._gridStyleInfo[e]=this._gridStyleInfo[e]||[],this._gridOptions[e]=this._gridOptions[e]||{};const D=this.getConfigInfo(e);if((c=t==null?void 0:t.gridOptions)!=null&&c.api&&D.TSI00GRIDVIEW&&D.TSI00GRIDVIEW.length>0){const A=D.TSI00GRIDVIEW[0];((d=a==null?void 0:a.cloneTableName)==null?void 0:d.trim().length)>0&&this.cloneTableForLayoutOrGrid(((u=a==null?void 0:a.originTableName)==null?void 0:u.trim())||A.TABLE_NAME.trim(),a.cloneTableName.trim(),e),t.gridOptions.context={configId:e,configCaption:A.FUNCNAME_RES||A.FUNCNAME},a=a||{},((p=A.CUS_EXT_OPTIONS)==null?void 0:p.trim().length)>0&&(a={...JSON.parse(A.CUS_EXT_OPTIONS),...a}),((h=A.EXT_OPTIONS)==null?void 0:h.trim().length)>0&&(a={...JSON.parse(A.EXT_OPTIONS),...a});const V=this.getFormSysInfo("GridDefaultOptions");V.trim().length>0&&(a={...JSON.parse(V),...a}),["rowDragManaged","groupIncludeFooter","groupIncludeTotalFooter","suppressRowTransform","suppressRowClickSelection","rowMultiSelectWithClick","singleClickEdit"].forEach(N=>{a[N]=t.gridOptions[N]??a[N]}),a.groupDisplayType=a.groupDisplayType||t.gridOptions.groupDisplayType||this.getFormSysInfo("GRIDGROUPDISPLAYTYPE")||"groupRows",a.rowHeight=a.rowHeight||t.gridOptions.rowHeight;const J=this.getGridConfigOptions(e,a,l,r);if(J.context={...t.gridOptions.context,...J.context},J&&Object.keys(J).forEach(N=>{t.gridOptions[N]=J[N]!==void 0?J[N]:t.gridOptions[N]}),t.gridOptions.defaultColDef=t.gridOptions.defaultColDef||{},t.gridOptions.rowSelection=D.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",t.gridOptions.api.selectionService.rowSelection=D.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",t.gridOptions.api.selectionService.groupSelectsChildren=!0,t.gridOptions.api.setColumnDefs(J.columnDefs),t.gridOptions.api.setRowData([]),A.ALLOW_CELLMERGE==="1"&&((g=t.gridOptions.context.mergeColumns)==null?void 0:g.length)>0){let N=[];t.gridOptions.context.calculateRowSpan=(te=!0)=>{var fe,X,q,v,O,ge;te?N=t.gridOptions.context.bindingSource.data():t.gridOptions.api.forEachNodeAfterFilterAndSort(se=>{var ze;(ze=se.data)!=null&&ze.uid&&N.push(se.data)});const R={},me=((q=(X=(fe=t.gridOptions.context)==null?void 0:fe.viewConfig)==null?void 0:X.MERGE_COLUMN)==null?void 0:q.trim().length)>0?(ge=(O=(v=t.gridOptions.context)==null?void 0:v.viewConfig)==null?void 0:O.MERGE_COLUMN)==null?void 0:ge.trim().split(","):[];return t.gridOptions.context.mergeColumns.forEach(se=>{R[se]={};const ze={};let tt=0;const at=[...me,se];for(let qe=0;qe<N.length;qe++){let T=!0;for(let ye=0;ye<at.length;ye++){const et=at[ye];if(N[qe][et]!==ze[et]){T=!1;break}}if(!T){if(Object.keys(ze).length>0)for(let ye=tt;ye<qe;ye++){const et=N[ye].uid;R[se][et]=ye===tt?qe-tt:0}at.forEach(ye=>{ze[ye]=N[qe][ye]}),tt=qe}if(qe===N.length-1)for(let ye=tt;ye<=qe;ye++){const et=N[ye].uid;R[se][et]=ye===tt?qe-tt+1:0}}}),t.gridOptions.context.rowSpanMap=R,N[0]}}if((A==null?void 0:A.SHOW_FOOTER)==="1"&&t.gridOptions.api.setPinnedBottomRowData([{pinndeRowType:"ErGridSummaryFooter"}]),o.nextTick(()=>{var N;t.gridOptions.defaultColDef.floatingFilter===void 0&&t.gridOptions.api.setDefaultColDef({floatingFilter:(A==null?void 0:A.SHOW_FILTER_ROW)==="1"}),((N=a==null?void 0:a.initialData)==null?void 0:N.length)>0&&this.mergeDataToGrid(a.initialData,t)}),t.gridOptions.processCellForClipboard=N=>{var te;return(te=N.column)!=null&&te.colDef.valueFormatter?N.column.colDef.valueFormatter(N):N.value},a.SORT_FIELD_NAME=((I=a.SORT_FIELD_NAME)==null?void 0:I.trim())||A.SORT_FIELD_NAME,((b=a.SORT_FIELD_NAME)==null?void 0:b.trim().length)>0){const N=a.SORT_FIELD_NAME.split(","),te=[];N.forEach((me,fe)=>{const X=me.trim().split(" ");if(X.length>0){const q={colId:X[0].trim().toUpperCase(),sort:"asc",sortIndex:fe};X.length>1&&X[1].trim().toLowerCase()==="desc"&&(q.sort=X[1].trim().toLowerCase()),te.push(q)}}),t.gridOptions.columnApi.applyColumnState({state:te});const R=(S=t.gridOptions.api)==null?void 0:S.getStatusPanel("InformationPanel");R&&R.setInformation()}this.setGridMainMenuItems(t,a),this.setGridContextMenu(t,a),this.setGridRowStyle(t,a),this.setGridInitialEvent(t,a),this._gridInstanceInfo[e]=t}return!0}return!1}getGridConfigOptions(e,t,a,l){this._gridColumnsConfigInfo[e]={},this._gridColumnsInfo[e]={},this._allowMergeColumnFields[e]=[],this._gridStyleInfo[e]=this._gridStyleInfo[e]||[],this._gridOptions[e]=this._gridOptions[e]||{};const r={},c=this.getConfigInfo(e);if(c.TSI00GRIDVIEW&&c.TSI00GRIDVIEW.length>0){const d=c.TSI00GRIDVIEW[0],u=c.TSI00GRIDCOLUMN;r.statusBar={statusPanels:[{statusPanel:"ToolbarButton"}]},t=t||{},t.rowDragManaged=t.rowDragManaged??d.ALLOW_DRAG.toString()==="1",t.enableHeaderTooltip=t.enableHeaderTooltip??!0,t.enableCellTooltip=t.enableCellTooltip??!0;const p=d.MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single";i.toNumber(d.DISPLAY_WIDTH)>0&&this.setGridOptions(e,"miniHeight",i.toNumber(d.DISPLAY_WIDTH)+"px",!0),this.setGridOptions(e,"ShowQuickFilter",d.ALLOW_FIND_MODE,!0),this.setGridOptions(e,"RowSelection",p,!0),this.setGridOptions(e,"toolbarStyle",t.toolbarStyle,!0),r.treeData=d.FUNCTION_TYPE==="T",r.columnDefs=this.getGridColumnDefs(e,c,r,t),r.rowData=[],r.rowHeight=t.rowHeight?t.rowHeight:i.toNumber(d.ROWHIGH)>0?i.toNumber(d.ROWHIGH):void 0,r.groupIncludeFooter=t.groupIncludeFooter??(d.SHOW_FOOTER==="1"&&t.aggDataInGroupRow!==!0),r.groupIncludeTotalFooter=t.groupIncludeTotalFooter??d.SHOW_FOOTER==="1",r.getRowId=h=>h.data.uid,r.gridId=e,r.suppressRowTransform=t.suppressRowTransform??!0,r.suppressRowClickSelection=t.suppressRowClickSelection??d.AUTO_SELECT_MODE.toString()!=="4",r.rowMultiSelectWithClick=t.rowMultiSelectWithClick??!0,r.singleClickEdit=t.singleClickEdit??!0,r.rowBuffer=t.rowBuffer??10,r.debug=t.debug??!1,r.enableRangeHandle=!0,r.showOpenedGroup=!0,r.suppressPaginationPanel=!0,r.paginateChildRows=!0,r.stopEditingWhenCellsLoseFocus=!0,r.enableCellExpressions=!0,r.groupDisplayType=r.treeData?void 0:t.groupDisplayType||this.getFormSysInfo("GridGroupDisplayType")||"groupRows",r.context.rowSpanMap&&(r.suppressRowTransform=!0),r.groupDisplayType==="groupRows"&&(r.groupRowRendererParams={checkbox:p==="multiple"&&d.SHOW_SELECTION.toString()==="1",suppressCount:t.aggDataInGroupRow===!0,innerRenderer:h=>{var g,I,b,S,M,D,A,V,P;if((I=(g=h.node)==null?void 0:g.rowGroupColumn)!=null&&I.colDef){const J=(S=(b=h.node)==null?void 0:b.rowGroupColumn)==null?void 0:S.colDef;let N=h.node.key;if(J.cellDataType==="number"?N=i.formatNumberValue(h.value,(D=(M=J.context)==null?void 0:M.columnConfig)==null?void 0:D.FORMAT_STRING):((A=J.cellEditor)==null?void 0:A.name)==="DatetimeEditor"?N=i.getDateTimeFormatString(h.value,(P=(V=J.context)==null?void 0:V.columnConfig)==null?void 0:P.FORMAT_STRING):J.refData&&(N=J.refData[h.value]||h.value),t.aggDataInGroupRow===!0){let R=`
34
+ </div>`)}static setLocalStorage(e,t){return(e==null?void 0:e.trim().length)>0&&localStorage.setItem(e.trim(),JSON.stringify(t)),localStorage}static debounce(e,t=100){let a;return(...l)=>{a&&clearTimeout(a),a=setTimeout(()=>{e(...l)},t)}}static getLocalStorage(e,t=!0){let a;return(e==null?void 0:e.trim().length)>0&&(a=x.toString(localStorage.getItem(e)),t&&localStorage.removeItem(e),a&&a.trim().length>0&&(a=JSON.parse(a))),a}static getCallFormParas(e,t=!0){return this.getLocalStorage(e,t)}static callForm(e,t,a=!0){}static copyText(e){const{toClipboard:t}=wa();e instanceof Array?e.forEach(a=>{}):e=String(e||""),(e==null?void 0:e.trim().length)>0&&t(e)}static readClipboardText(){return(navigator==null?void 0:navigator.clipboard.readText())||Promise.resolve("")}static async callService(e,t,a,l){return new Promise((r,c)=>{const d=(l==null?void 0:l.messageError)??!1;let u=new Ze.EiInfo;e.trim().length===0&&(u.SysInfo.Flag=-603,u.SysInfo.Msg="No service available",r(u));const p=e.split(/[\/.]/).filter(h=>h.trim().length>0);p.length<2&&(u.SysInfo.Flag=-603,u.SysInfo.Msg="Service name error",r(u)),a!=null&&a.show&&this.loading(!0,a),l!=null&&l.toCamelCase&&Object.keys(t.getBlocks()).forEach(h=>{const g=t.getBlock(h),I=g.getBlockMeta().getMetas(),b=new Ze.EiBlockMeta(g.getBlockId());Object.keys(I).forEach(S=>{const M=new Ze.EiColumn(x.camelCase(S));M.descName=I[S].name,M.type=I[S].type,b.addMeta(M)}),g.setBlockMeta(b)}),Ze.EiCommunicator.send(p[0],p[1],t,{onSuccess:h=>{this.loading(!1),u=h,u.getStatus()<0&&d&&this.messageError(u.getMsg(),d==="modal"),r(u)},onFail:h=>{this.loading(!1),d&&this.messageError(String(h),d==="modal"),console.error(h),u.SysInfo.Flag=-603,u.SysInfo.Msg=h==null?void 0:h.message,r(u)}})})}};y(x,"spinId","er-global-spin"),y(x,"spinCurrentContainer",null),y(x,"spinVnode",null),y(x,"spinCurrentTarget",null),y(x,"spinTimeoutId",null);let i=x;n.Core=i;class m{static get AppName(){return"ER4J"}static get Culture(){return"zh_cn"}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"}}n.SysInfo=m;class G extends Ze.EiInfo{constructor(t){var a;super();y(this,"sys");this.sys={status:0,name:"",descName:"",msg:"",msgKey:"",traceId:((a=this.SysInfo)==null?void 0:a.UUID)||i.guid()},t&&(this.SysInfo=t.SysInfo,Object.keys(t.getBlocks()).forEach(l=>{this.addBlock(t.getBlock(l))}))}blocks(){return this.getBlocks()}getBlock(t){return typeof t=="number"?super.getBlockByIndex(t):super.getBlock(t)}contains(t){return!!super.getBlock(t)}}n.EIInfo=G;class K extends _{constructor(t){super();y(this,"translateOptions",{});t&&(this.translateOptions=t)}setOptions(t){t&&(this.translateOptions={...this.translateOptions,...t})}translate(t,a){return new Promise((l,r)=>{this.setOptions(a);const c=[];if(t&&typeof t=="string"&&t.trim().length>0)c.push({text:t});else if(t&&t instanceof Array&&t.length>0)for(let d=0;d<t.length;d++)c.push({text:t[d]});c.length>0?bo({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":i.guid()},params:{"api-version":this.translateOptions.version||"3.0",from:this.translateOptions.from,to:this.translateOptions.to},data:c,responseType:this.translateOptions.responseType||"json"}).then(d=>{var u,p;if(((u=d==null?void 0:d.data)==null?void 0:u.length)===c.length){for(let h=0;h<d.data.length;h++)((p=d.data[h].translations)==null?void 0:p.length)>0&&d.data[h].translations.forEach(g=>{g.to&&(c[h][g.to]=g.text)});l({flag:!0,message:"success",result:typeof t=="string"?c[0]:c})}else l({flag:!1,message:"wrong result",result:d.data})}).catch(d=>{r(d)}):l({flag:!1,message:"未传入翻译文本"})})}}n.TranslateHelper=K;class L extends _{constructor(t){var a,l;super();y(this,"_uploadOptions",{});y(this,"_uploadConfigInfo",{});y(this,"_initialized",!1);y(this,"_maxBlobSize",204800);y(this,"_maxFileSize",10485760);t&&(this._uploadOptions=t),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions.url&&((a=this._uploadOptions.url)==null?void 0:a.trim().length)>0&&this._uploadOptions.rootDirectory&&((l=this._uploadOptions.rootDirectory)==null?void 0:l.trim().length)>0&&(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0)}get Initialized(){return this._initialized}async getUploadConfigInfo(t){var a,l;return n.Core.buildEiInfo([{CODE_CLASS:"EPTF"}]),t&&(t==null?void 0:t.trim().length)>0&&(this._uploadOptions.url=(a=this._uploadConfigInfo[t.trim()])==null?void 0:a.url,this._uploadOptions.rootDirectory=(l=this._uploadConfigInfo[t.trim()])==null?void 0:l.rootDirectory),this._maxBlobSize=this._uploadOptions.maxBlobSize||this._maxBlobSize,this._maxFileSize=this._uploadOptions.maxFileSize||this._maxFileSize,this._uploadOptions}async initialize(t){var a,l;t&&(this._uploadOptions=t),this._uploadOptions.url&&((a=this._uploadOptions.url)==null?void 0:a.trim().length)>0&&this._uploadOptions.rootDirectory&&((l=this._uploadOptions.rootDirectory)==null?void 0:l.trim().length)>0?(this._uploadConfigInfo={url:this._uploadOptions.url,rootDirectory:this._uploadOptions.rootDirectory},this._initialized=!0):(await this.getUploadConfigInfo(),this._initialized=!0)}async getUploadUrl(t){var a;return this._initialized||await this.initialize(),t&&(t==null?void 0:t.trim().length)>0&&(this._uploadOptions.url=(a=this._uploadConfigInfo[t.trim()])==null?void 0:a.url),this._uploadOptions.url||""}getFileList(t,a){return new Promise(async(l,r)=>{var d,u;this._initialized||await this.getUploadConfigInfo(a),a&&(a==null?void 0:a.trim().length)>0&&(this._uploadOptions.url=(d=this._uploadConfigInfo[a.trim()])==null?void 0:d.url,this._uploadOptions.rootDirectory=(u=this._uploadConfigInfo[a.trim()])==null?void 0:u.rootDirectory);const c={pathInfo:[{key:t,name:t}]};bo.post(this._uploadOptions.url+`?command=GetDirContents&arguments=${JSON.stringify(c)}&_=${new Date().valueOf()}&rootDirectory=${this._uploadOptions.rootDirectory}`).then(p=>{var h,g,I;(h=p.data)!=null&&h.success?l({flag:!0,message:"获取文件成功",result:p.data.result}):(console.error("no files,"+((g=p.data)==null?void 0:g.result)),l({flag:!0,message:(I=p.data)==null?void 0:I.result,result:[]}))}).catch(p=>{console.error("get files failed",p),l({flag:!1,message:"获取文件失败",result:[]})})})}downloadFile(t){return new Promise(async(a,l)=>{var u;const r=(u=t.key)==null?void 0:u.split("/"),c=[];r.forEach((p,h)=>{const g={key:r.slice(0,h+1).join("/"),name:p};g.key!==""&&g.name!==""&&c.push(g)});const d=new URLSearchParams;d.append("command","Download"),d.append("arguments",JSON.stringify({pathInfoList:[c]})),d.append("rootDirectory",this._uploadOptions.rootDirectory||""),bo.post(this._uploadOptions.url||"",d,{responseType:"blob",headers:{"Content-Type":"application/x-www-form-urlencoded"}}).then(p=>{a({flag:!0,message:"下载文件成功",result:p})}).catch(p=>{console.error("download files failed",p),a({flag:!1,message:"下载文件失败",result:[]})})})}previewFile(t){return new Promise(async(a,l)=>{var c;const r=t.key;bo.get(((c=this._uploadOptions.url)==null?void 0:c.replaceAll("file-manager",""))+`FilePriview?rootDirectory=${this._uploadOptions.rootDirectory}&filePath=${r}`).then(d=>{a({flag:!0,message:"获取文件预览信息成功",result:d})}).catch(d=>{console.error("download files failed",d),a({flag:!1,message:"获取文件预览信息失败",result:[]})})})}uploadFile(t,a,l){return new Promise(async(r,c)=>{var p,h,g,I,b,S;if(this._initialized||await this.getUploadConfigInfo(l),l&&(l==null?void 0:l.trim().length)>0&&(this._uploadOptions.url=(p=this._uploadConfigInfo[l.trim()])==null?void 0:p.url,this._uploadOptions.rootDirectory=(h=this._uploadConfigInfo[l.trim()])==null?void 0:h.rootDirectory,this._uploadOptions.maxBlobSize=(g=this._uploadConfigInfo[l.trim()])==null?void 0:g.maxBlobSize,this._uploadOptions.maxFileSize=(I=this._uploadConfigInfo[l.trim()])==null?void 0:I.maxFileSize),a.size>(this._uploadOptions.maxFileSize||this._maxFileSize)){n.Core.messageError("文件大小超过限制"),r({flag:!1,message:"文件大小超过限制"});return}const d=Math.ceil(a.size/(this._uploadOptions.maxBlobSize||this._maxBlobSize)),u=new Date().valueOf();for(let M=0;M<d;M++){const D=a.slice(M*(this._uploadOptions.maxBlobSize||this._maxBlobSize),(M+1)*(this._uploadOptions.maxBlobSize||2e5)),A={destinationPathInfo:[{key:t,name:t}],chunkMetadata:{UploadId:u,FileName:a.name,Index:M,TotalCount:d,FileSize:a.size}},V=new FormData;V.append("command","UploadChunk"),V.append("arguments",JSON.stringify(A)),V.append("chunk",D),V.append("rootDirectory",this._uploadOptions.rootDirectory||"");const P=await bo.post(this._uploadOptions.url||"",V,{headers:{"Content-Type":"multipart/form-data"}});if(P.status===200){if(!((b=P==null?void 0:P.data)!=null&&b.success)){n.Core.messageError("upload file failed "+((S=P==null?void 0:P.data)==null?void 0:S.result)),r({flag:!1,message:"上传文件失败"});break}}else{n.Core.messageError("upload file failed "+(P==null?void 0:P.statusText)),r({flag:!1,message:"上传文件失败"});break}}r({flag:!0,message:"上传文件成功"})})}removeFile(t,a,l){return new Promise(async(r,c)=>{var h,g;this._initialized||await this.getUploadConfigInfo(l),l&&(l==null?void 0:l.trim().length)>0&&(this._uploadOptions.url=(h=this._uploadConfigInfo[l.trim()])==null?void 0:h.url,this._uploadOptions.rootDirectory=(g=this._uploadConfigInfo[l.trim()])==null?void 0:g.rootDirectory);const d=a&&(a==null?void 0:a.trim().length)>0?`${t}/${a}`.split("/"):[t],u=[];d.forEach((I,b)=>{const S={key:d.slice(0,b+1).join("/"),name:I};S.key!==""&&S.name!==""&&u.push(S)});const p={pathInfo:u,isDirectory:(a==null?void 0:a.trim().length)===0};bo.post(this._uploadOptions.url+`?command=Remove&arguments=${encodeURIComponent(JSON.stringify(p))}&rootDirectory=${this._uploadOptions.rootDirectory}`,JSON.stringify({_:new Date().valueOf()}),{headers:{"Content-Type":"text/plain;charset=UTF-8"}}).then(I=>{var b,S,M;(b=I.data)!=null&&b.success?r({flag:!0,message:"删除文件成功"}):(console.error("remove file failed,"+((S=I.data)==null?void 0:S.result)),r({flag:!1,message:"删除文件失败:"+((M=I.data)==null?void 0:M.result)}))}).catch(I=>{console.error("remove file failed",I),r({flag:!1,message:"删除文件失败"})})})}}n.UploadHelper=L;class H{constructor(e,t,a,l){y(this,"_partition");y(this,"_companyCode");y(this,"_serviceName",n.SysInfo.queryDevConfigService);y(this,"_paraFilter");y(this,"_initializeSuccessed",!1);y(this,"_sysParasValue",{});e?this._partition=e:this._partition=m.Partiton,a?this._companyCode=a:this._companyCode=m.CompanyCode,l&&l.trim().length>0&&(this._serviceName=l.trim()),this._paraFilter=t}get Partiton(){return this._partition}get CompanyCode(){return this._companyCode}get InitializeSuccessed(){return this._initializeSuccessed}get SysParasValue(){return this._sysParasValue}async Initialize(e,t,a,l){return new Promise((r,c)=>{e&&e.trim().length>0&&(this._partition=e),a&&a.trim().length>0&&(this._companyCode=a),t&&(this._paraFilter=t);let d="",u="";if(this._paraFilter&&this._paraFilter.ParaCodes){let g=[];if(this._paraFilter.ParaCodes instanceof Array?g=this._paraFilter.ParaCodes:typeof this._paraFilter.ParaCodes=="string"&&(g=this._paraFilter.ParaCodes.split(",")),g.length>1)for(let I=0;I<g.length;I++)g[I].trim().length>0&&(u.length===0?u=`'${g[I]}'`:u+=`,'${g[I]}'`);else g.length>0&&(d=g[0].trim())}const p=new Ze.EiInfo,h=i.buildEiBlock([{COMPANY_CODE:this._companyCode,QUERY_TYPE:"system_paras",CTRL_TYPE:this._paraFilter?this._paraFilter.ParaMoudule:"",CTRL_CODE:d,CTRL_CODE_ARRAY:u}]);p.addBlock(h),l&&l.trim().length>0&&(this._serviceName=l.trim()),i.callService(this._serviceName,p).then(g=>{this._initializeSuccessed=g.SysInfo.Flag>=0,this._initializeSuccessed&&g.getBlockByIndex(0).getMappedRows().forEach(I=>{this._sysParasValue[I.CTRL_CODE]=I.CTRL_NUM}),r(this._initializeSuccessed)},()=>{r(!1)})})}getParaValue(e){return!i.isNullOrEmpty(e)&&this._initializeSuccessed?i.toString(this._sysParasValue[e]):""}}n.Be2SysParaInfo=H;class ${static setVariable(e,t,a){e.trim().length>0&&t.trim().length>0&&a!==void 0&&a!==null&&i.setLocalStorage(e+"_"+t,a)}static getVariable(e,t,a=!0){return i.getLocalStorage(e+"_"+t,a)}static clearVariable(e,t){e&&e.trim().length>0&&localStorage.removeItem(e+"_"+t)}static isNullOrEmpty(e,t){const a=i.getLocalStorage(e+"_"+t);return a==null}}n.SysGlobalVariables=$;class Q extends _{constructor(t,a,l){super();y(this,"dirty",!1);y(this,"dirtyFields",{});y(this,"uid","");y(this,"isNew",!1);y(this,"_dataTable");y(this,"_schemaFields",{});y(this,"_backup",{});this._schemaFields=a||{},this._dataTable=l,this.accept(t,this._schemaFields)}get schemaFields(){return this._schemaFields}get dataTable(){return this._dataTable}static getFieldDefaultValue(t){return t==null?void 0:t.defaultValue}shouldSerialize(t){return!["ID","isNew","uid","dirty","dirtyFields","_backup","_dataTable","_events","_schemaFields","_preview_row_data","_children_data",m.TreeHierarchyFieldName].includes(t)}forEach(t){for(const a in this)this.shouldSerialize(a)&&t(this[a],a)}toJSON(t){var l,r;let a={};for(const c in this)if(this.shouldSerialize(c)&&(a[c]=this[c],this._schemaFields&&this._schemaFields[c]))switch(this._schemaFields[c].type){case"boolean":a[c]=this[c]?"1":"0";break;case"datetime":a[c]?(vt.isDayjs(a[c])&&vt(a[c]).isValid()?a[c]=a[c].format("YYYYMMDDHHmmss"):a[c]instanceof Date?vt(a[c]).format("YYYYMMDDHHmmss"):typeof a[c]=="string"?a[c]=a[c].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):a[c]="",((l=a[c])==null?void 0:l.trim().length)===0||a[c].startsWith("1900")||a[c].startsWith("1901")||a[c].startsWith("0001")?a[c]="":this._schemaFields[c].maxLength>0?a[c]=a[c].padEnd(this._schemaFields[c].maxLength,"0").substring(0,this._schemaFields[c].maxLength):a[c]=a[c].padEnd(14,"0").substring(0,14)):a[c]="";break;case"time":a[c]?(vt.isDayjs(a[c])&&vt(a[c]).isValid()?a[c]=a[c].format("YYYYMMDDHHmmss"):a[c]instanceof Date?vt(a[c]).format("YYYYMMDDHHmmss"):typeof a[c]=="string"?a[c]=a[c].replaceAll("-","").replaceAll("/","").replaceAll("T","").replaceAll(":",""):a[c]="",((r=a[c])==null?void 0:r.trim().length)===0||a[c].startsWith("1900")||a[c].startsWith("1901")||a[c].startsWith("0001")?a[c]="":this._schemaFields[c].maxLength>0&&this._schemaFields[c].maxLength<=6?a[c]=a[c].padEnd(this._schemaFields[c].maxLength,"0").substring(8,8+this._schemaFields[c].maxLength):a[c]=a[c].padEnd(14,"0").substring(8,14)):a[c]="";break;case"string":a[c]&&a[c]instanceof Array&&(a[c]=a[c].join(","));break;case"number":a[c]=n.Core.toNumber(a[c]);break;default:a[c]=this[c];break}return t&&(a={...a,...t}),a}setBackup(){this._backup=this.toJSON();for(const t in this)this.shouldSerialize(t)&&(this._backup[t]=this[t]);return this}getBackup(){return this._backup}get(t){return Reflect.get(this,t)}set(t,a,l,r=!1){var c;if(this.shouldSerialize(t))if(this._schemaFields[t]){switch(this._schemaFields[t].type){case"datetime":a=i.toDateTime(a,"Dayjs");break;case"boolean":a=i.toBoolean(a);break;case"number":a=i.toNumber(a);break;default:a=a;break}const d={};if(d.oldValue=this[t],d.newValue=a,this.dirtyFields[t]=!0,this.dirty=!0,Reflect.set(this,t,a),this._dataTable&&l!=="setData"){const u=o.isProxy(this._dataTable)?o.toRaw(this._dataTable):this._dataTable;(c=u.BingdingInfo)==null||c.forEach(h=>{if(h.formHelper&&h.configId&&h.configId!==l)if(h.controlType==="Grid"){const g=h.formHelper.getGrid(h.configId);if(g){const I={};I[t]=a,h.formHelper.setGridRowData(g,this.uid,I)}}else h.controlType});const p=u.getEvent("dataChanged");p&&(d.field=t,d.binddingInfo=u.BingdingInfo,p(d))}}else r===!1&&(this[t]=a);return this}reset(){return this.accept(void 0,this._schemaFields),this}setSchema(t,a=!0){return this._schemaFields=t,a&&this.reset(),this}setData(t,a,l=!1){var r;return t&&(Object.keys(t).forEach(c=>{if(this.shouldSerialize(c))if(this._schemaFields[c]){switch(this._schemaFields[c].type){case"datetime":t[c]=i.toDateTime(t[c],"Dayjs");break;case"boolean":t[c]=i.toBoolean(t[c]);break;case"number":t[c]=i.toNumber(t[c]);break}this.dirtyFields[c]=!0,this.dirty=!0,Reflect.set(this,c,t[c])}else l===!1&&(this[c]=t[c])}),this._dataTable&&((r=(o.isProxy(this._dataTable)?o.toRaw(this._dataTable):this._dataTable).BingdingInfo)==null||r.forEach(d=>{if(d.formHelper&&d.configId&&d.configId!==a&&d.controlType==="Grid"){const u=d.formHelper.getGrid(d.configId);u&&d.formHelper.setGridRowData(u,this.uid,t)}}))),this}addField(...t){return t&&t.length>0&&t.forEach(a=>{this._schemaFields&&a.name&&this._schemaFields[a.name]===void 0&&(this._schemaFields[a.name]=a,this[a.name]=a.defaultValue)}),this}reomveField(...t){return t&&t.length>0&&t.forEach(a=>{this._schemaFields&&a.name&&this._schemaFields[a.name]&&delete this._schemaFields[a.name]}),this}accept(t,a){if(a)for(const l in a){const r=a[l];if(r&&r.name&&r.type){const c=(t==null?void 0:t[r.name])??(t==null?void 0:t[i.camelCase(r.name)])??r.defaultValue;switch(r.type){case"datetime":this[r.name]=i.toDateTime(c,"Dayjs");break;case"boolean":this[r.name]=c==="1"||c===!0;break;case"number":this[r.name]=i.toNumber(c);break;case"string":this[r.name]=i.toString(c,!0);break;default:this[r.name]=c;break}}}return this.uid=i.guid(),this.dirty=!1,this.dirtyFields={},this}}n.Model=Q;class j extends _{constructor(t){super();po(this,pe);po(this,z,[]);po(this,le,[]);po(this,Se,[]);po(this,Ge,[]);po(this,xe);po(this,_e);po(this,Ae,!0);po(this,ke);po(this,Fe,[]);po(this,Ue,{});y(this,"tableName","");this.tableName="Table0",t=t||{schema:{}},this.init(t)}get options(){return Ee(this,xe)}get BingdingInfo(){return Ee(this,Fe)}get rowCount(){return Ee(this,z).length}get Current(){return Ee(this,_e)}get IsHierarchyTable(){var t,a,l,r;return i.toString((a=(t=Ee(this,xe))==null?void 0:t.hierarchy)==null?void 0:a.parentField,!0).length>0&&i.toString((r=(l=Ee(this,xe))==null?void 0:l.hierarchy)==null?void 0:r.primaryField,!0).length>0}init(t){t&&(Bt(this,xe,t),Bt(this,z,[]),Bt(this,le,[]),Bt(this,Se,[]),Bt(this,Ge,[]),Bt(this,_e,void 0))}setBindingInfo(t,a,l,r){t&&a&&a.trim().length>0&&!Ee(this,Fe).some(c=>{var d;return((d=c.formHelper)==null?void 0:d.FormId)===t.FormId&&c.configId===a})?Ee(this,Fe).push({formHelper:t,configId:a,dataTable:this,controlType:l}):Ee(this,Fe).some(c=>c.grid.gridId===r.gridId)||(r.gridOptions.context=r.gridOptions.context||{},r.gridOptions.context.bindingSource=this,Ee(this,Fe).push({grid:r,dataTable:this,controlType:l}))}removeBindingInfo(t,a,l){var r,c;for(let d=Ee(this,Fe).length-1;d>=0;d--)Ee(this,Fe)[d].configId===a&&((c=(r=Ee(this,Fe)[d])==null?void 0:r.formHelper)==null?void 0:c.FormId)===(t==null?void 0:t.FormId)?Ee(this,Fe).splice(d,1):l&&Ee(this,Fe)[d].grid.gridId===l.gridId&&(l.gridOptions.context.bindingSource&&delete l.gridOptions.context.bindingSource,Ee(this,Fe).splice(d,1))}setEvent(t,a){t&&(Ee(this,Ue)[t]=a)}getEvent(t){return Ee(this,Ue)[t]}setAllowCancelChanges(t){return Bt(this,ke,t),this}addField(...t){if(t&&t.length>0&&(t.forEach(a=>{a.name&&Ee(this,xe).schema&&Ee(this,xe).schema[a.name]===void 0&&(Ee(this,xe).schema[a.name]=a)}),Ee(this,z).length>0))for(let a=0;a<Ee(this,z).length;a++)Ee(this,z)[a].addField(...t);return this}removeField(...t){if(t&&t.length>0&&(t.forEach(a=>{a.name&&Ee(this,xe).schema&&Ee(this,xe).schema[a.name]===void 0&&delete Ee(this,xe).schema[a.name]}),Ee(this,z).length>0))for(let a=0;a<Ee(this,z).length;a++)Ee(this,z)[a].reomveField(...t);return this}get(t){for(let a=0;a<Ee(this,z).length;a++)if(Ee(this,z)[a].uid===t)return Ee(this,z)[a]}getRows(t,a=!1){const l=[],r=c=>{a instanceof Function?l.push(a(c)||c.toJSON()):l.push(a?c.toJSON():c)};switch(t){case"created":{Ee(this,Se).forEach(c=>{r(c)});break}case"updated":{Ee(this,z).forEach(c=>{c.dirty&&!c.isNew&&r(c)});break}case"removed":{Ee(this,Ge).forEach(c=>{r(c)});break}case"unchanged":{Ee(this,z).forEach(c=>{!c.dirty&&!c.isNew&&r(c)});break}case"original":{Ee(this,le).forEach(c=>{!c.dirty&&!c.isNew&&r(c)});break}case"all":{Ee(this,z).forEach(c=>{r(c)});break}}return l}getRowsAsBlock(t,a){const l=new Ze.EiBlock("Table0"),r=this.getRows(t,a??!0);if(r&&r.length>0){const c=[];if(Ee(this,xe).schema){const d=u=>{const p=new Ze.EiColumn(u.name);return p.type=u.type==="number"?"N":"C",p.descName=u.caption,p};Object.keys(Ee(this,xe).schema).forEach(u=>{var h;const p=d((h=Ee(this,xe).schema)==null?void 0:h[u]);l.addColumn(p),c.push({name:p.name,type:p.type})})}r.forEach(d=>{const u=[];c.forEach(p=>{u.push(d[p.name])}),l.addRow(u)})}return l}at(t){return Ee(this,z).at(t)}indexOf(t){if(t&&t.uid.length>0){for(let a=0;a<Ee(this,z).length;a++)if(Ee(this,z)[a].uid===t.uid)return a}return-1}setCurrent(t,a){var d;const l={},r=((d=Ee(this,_e))==null?void 0:d.uid)||"",c=(t==null?void 0:t.uid)||"";l.bindingInfo=Ee(this,Fe),l.oldCurrent=Ee(this,_e),l.current=t,l.source=a,Bt(this,_e,t),r!==c&&fo(this,pe,Co).call(this,"currentChanged",l)}insert(t,a,l){let r;return a&&(r=new Q(a,Ee(this,xe).schema,this),l&&l.trim().length>0&&r[l]!==void 0&&(r[l]=i.guid()),r.isNew=!0,Ee(this,z).splice(t,0,r),Ee(this,Se).push(r),fo(this,pe,Co).call(this,"dataInserted",{bindingInfo:Ee(this,Fe),insertAt:t,current:r}),this.setCurrent(r)),r}add(t,a){const l=new Q(t,Ee(this,xe).schema,this);return a&&a.trim().length>0&&l[a]!==void 0&&(l[a]=i.guid()),l.isNew=!0,Ee(this,z).push(l),Ee(this,Se).push(l),fo(this,pe,Co).call(this,"dataAdded",{bindingInfo:Ee(this,Fe),current:l}),this.setCurrent(l),l}import(t,a=-1,l=!0,r){const c=[];return(t==null?void 0:t.length)>0&&(t.forEach(d=>{d instanceof Q&&(d=d.toJSON());const u=new Q(d,Ee(this,xe).schema,this);r&&r.trim().length>0&&u[r]!==void 0&&(u[r]=i.guid()),u.isNew=l,c.push(u)}),a<0?Ee(this,z).push(...c):Ee(this,z).splice(a,0,...c),Ee(this,Se).push(...c),fo(this,pe,Co).call(this,"dataImported",{bindingInfo:Ee(this,Fe),models:c,insertAt:a,current:c[t.length-1]}),this.setCurrent(c[t.length-1])),c}remove(t){if(!t)return;let a=[];t instanceof Array&&t.length>0?a=t:t&&(a=[t]);let l=!1;const r=[];if(a.length>0){let c=-1,d=-1;if(a.forEach(u=>{var p;if(c=Ee(this,z).findIndex(h=>h.uid===u.uid),(d<0||c<d)&&(d=c),c!==-1){if(l||(l=Ee(this,z)[c].uid===((p=Ee(this,_e))==null?void 0:p.uid)),Ee(this,z)[c].isNew){const h=Ee(this,Se).indexOf(Ee(this,z)[c]);h>=0&&Ee(this,Se).splice(h,1)}else Ee(this,Ge).push(Ee(this,z)[c]);r.push(Ee(this,z)[c]),Ee(this,z).splice(c,1)}}),r.length>0&&fo(this,pe,Co).call(this,"dataRemoved",{bindingInfo:Ee(this,Fe),models:r}),l){let u;Ee(this,z).length>0&&(Ee(this,z).length===d?u=Ee(this,z)[d-1]:u=Ee(this,z)[d]),this.setCurrent(u)}}}setRowState(t,a){let l=this.indexOf(t);if(l<0&&(Ee(this,z).push(t),l=Ee(this,z).length-1),l>=0){Ee(this,z)[l].dirty=a==="updated",Ee(this,z)[l].isNew=a==="added";const r=Ee(this,Se).findIndex(c=>c.uid===t.uid);a==="added"&&r<0?Ee(this,Se).push(t):r>=0&&Ee(this,Se).splice(r,1),fo(this,pe,Co).call(this,"rowStateChanged",{bindingInfo:Ee(this,Fe),model:Ee(this,z)[l],state:a})}}clear(){return Bt(this,z,[]),Bt(this,le,[]),Bt(this,Se,[]),Bt(this,Ge,[]),Bt(this,_e,void 0),fo(this,pe,Co).call(this,"dataCleared",{bindingInfo:Ee(this,Fe)}),this}merge(t,a=!0,l=!1){var d,u,p,h,g;const r=[],c=Ee(this,z).length>0;if(a&&(Bt(this,z,[]),Bt(this,le,[]),Bt(this,Se,[]),Bt(this,Ge,[])),t!==void 0&&t.length>0&&((d=this.options)!=null&&d.schema)){const I=this.options.schema,b=Object.keys(t[0]),S=Object.keys(I),M=S.filter(N=>b.includes(N)||b.includes(i.camelCase(N))),D=S.filter(N=>!b.includes(N)&&!b.includes(i.camelCase(N))),A=new Map,V=i.toString((p=(u=Ee(this,xe))==null?void 0:u.hierarchy)==null?void 0:p.primaryField,!0),P=i.toString((g=(h=Ee(this,xe))==null?void 0:h.hierarchy)==null?void 0:g.parentField,!0),J=V.length>0&&P.length>0&&I[V]&&I[P];for(let N=0;N<t.length;N++){const te=new Q(void 0,void 0,this);te.setSchema(I,!1),M.forEach(R=>{switch(I[R].type){case"datetime":te[R]=i.toDateTime(t[N][R]??t[N][i.camelCase(R)],"Dayjs");break;case"boolean":te[R]=i.toBoolean(t[N][R]??t[N][i.camelCase(R)]);break;case"number":te[R]=i.toNumber(t[N][R]??t[N][i.camelCase(R)]);break;case"string":te[R]=i.toString(t[N][R]??t[N][i.camelCase(R)],!0);break;default:te[R]=t[N][R]??t[N][i.camelCase(R)];break}}),D.forEach(R=>{switch(I[R].type){case"datetime":te[R]=null;break;case"boolean":te[R]=!1;break;case"number":te[R]=0;break;case"string":te[R]="";break;default:te[R]=null;break}}),te.isNew=l,r.push(te),Ee(this,z).push(te),J&&te[V]&&A.set(te[V],te)}if(J){const N=te=>{const R=[];for(;te;)R.unshift(te[V]),te=A.get(te[P]);return R};for(let te=0;te<Ee(this,z).length;te++)Ee(this,z)[te][m.TreeHierarchyFieldName]=N(Ee(this,z)[te])}fo(this,pe,aa).call(this),fo(this,pe,Co).call(this,"dataMerged",{bindingInfo:Ee(this,Fe),models:r,current:Ee(this,z)[0]}),this.setCurrent(Ee(this,z)[0])}else Bt(this,_e,void 0),c&&fo(this,pe,Co).call(this,"dataMerged",{bindingInfo:Ee(this,Fe),models:r,current:void 0});return r}hasChanges(){if(Ee(this,Ge).length)return!0;for(let t=0;t<Ee(this,z).length;t++)if(Ee(this,z)[t].isNew||Ee(this,z)[t].dirty)return!0;return!1}acceptChanges(){return Bt(this,Se,[]),Bt(this,Ge,[]),Ee(this,z).forEach(t=>{t.isNew=!1,t.dirty=!1,t.dirtyFields={}}),fo(this,pe,aa).call(this),this}cancelChanges(){return Ee(this,Ae)&&(Bt(this,Se,[]),Bt(this,Ge,[]),Bt(this,z,mo.cloneDeep(Ee(this,le))),fo(this,pe,Co).call(this,"dataMerged",{bindingInfo:Ee(this,Fe),models:Ee(this,z),current:void 0})),this}totalCount(){return Ee(this,z).length}data(t){return t!==void 0&&t.length>0&&this.merge(t,!0,!1),Ee(this,z)}originalCopy(){return mo.cloneDeep(Ee(this,le))}originalModel(t){for(let a=0;a<Ee(this,le).length;a++)if(Ee(this,le)[a].uid===t)return mo.cloneDeep(Ee(this,le)[a])}}z=new WeakMap,le=new WeakMap,Se=new WeakMap,Ge=new WeakMap,xe=new WeakMap,_e=new WeakMap,Ae=new WeakMap,ke=new WeakMap,Fe=new WeakMap,Ue=new WeakMap,pe=new WeakSet,Co=function(t,a){var r;(r=Ee(this,Fe))==null||r.forEach(c=>{var d,u,p,h,g,I,b,S,M,D,A,V,P,J,N,te,R,me,fe,X,q,v,O,ge,se,ze,tt,at,qe,T;if(c.formHelper&&c.configId)if(c.controlType==="Grid"){const ye=c.formHelper.getGrid(c.configId);if((d=ye==null?void 0:ye.gridOptions)!=null&&d.api)switch(t){case"dataMerged":{const et=ye.gridOptions.api.getFilterModel(),rt=ye.gridOptions.columnApi.getColumnState().filter(He=>He.sort!==null);Object.keys(et).length===0&&rt.length===0&&ye.gridOptions.context.calculateRowSpan&&ye.gridOptions.context.calculateRowSpan instanceof Function&&ye.gridOptions.context.calculateRowSpan(!0),(p=(u=ye.gridOptions)==null?void 0:u.api)==null||p.clearRangeSelection(),ye.gridOptions.context.focusRowId="",ye.gridOptions.context.focusColId="",ye.gridOptions.context.dataMerged=!0,(g=(h=ye.gridOptions)==null?void 0:h.api)==null||g.setRowData(Ee(this,z));let Oe=Ee(this,z).length.toString().length*7+20;((b=(I=ye.gridOptions.context)==null?void 0:I.viewConfig)==null?void 0:b.SHOW_SELECTION)==="1"&&(Oe+=20),(S=ye.gridOptions.context)!=null&&S.allowDragRow&&(Oe+=21),((D=(M=ye.gridOptions.context)==null?void 0:M.options)==null?void 0:D.masterDetail)===!0&&(Oe+=22);const We=(V=(A=ye.gridOptions.columnApi)==null?void 0:A.columnModel)==null?void 0:V.gridColumns,Je=We==null?void 0:We.find(He=>He.colId===m.GridCheckColumnFieldName);Je&&ye.gridOptions.columnApi.setColumnWidth(Je,Oe);break}case"dataCleared":{(J=(P=ye.gridOptions)==null?void 0:P.api)==null||J.setRowData([]);break}case"dataRemoved":{if(ye.gridOptions.api.applyTransaction({remove:a.models}),((te=(N=ye.gridOptions.context)==null?void 0:N.options)==null?void 0:te.showRowNo)!==!1&&(ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]}),ye.gridOptions.context.focusRowId)){const et=(R=ye==null?void 0:ye.gridOptions)==null?void 0:R.api.getRowNode(ye.gridOptions.context.focusRowId);et&&(ye.gridOptions.context.focusRowId=et.id,ye.gridOptions.context.focusColId||(ye.gridOptions.context.focusColId=n.SysInfo.GridCheckColumnFieldName),c.formHelper.setGridFocusedCell(ye,et.rowIndex,ye.gridOptions.context.focusColId))}break}case"dataAdded":{ye.gridOptions.api.applyTransaction({add:[a.current]}),ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]});const et=(fe=(me=ye.gridOptions.context)==null?void 0:me.viewConfig)==null?void 0:fe.AUTO_SELECT_MODE;(et==="1"||et==="3")&&((X=c.formHelper)==null||X.checkGridRow(c.configId,a.current));break}case"dataInserted":{a.insertAt>=0?ye.gridOptions.api.applyTransaction({add:[a.current],addIndex:a.insertAt}):ye.gridOptions.api.applyTransaction({add:[a.current]}),ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]});const et=(v=(q=ye.gridOptions.context)==null?void 0:q.viewConfig)==null?void 0:v.AUTO_SELECT_MODE;(et==="1"||et==="3")&&c.formHelper.checkGridRow(c.configId,a.current);break}case"dataImported":{a.insertAt>=0?ye.gridOptions.api.applyTransaction({add:a.models,addIndex:a.insertAt}):ye.gridOptions.api.applyTransaction({add:a.models}),ye.gridOptions.api.refreshCells({columns:[m.GridCheckColumnFieldName]});const et=(ge=(O=ye.gridOptions.context)==null?void 0:O.viewConfig)==null?void 0:ge.AUTO_SELECT_MODE;(et==="1"||et==="3")&&c.formHelper.checkGridRow(c.configId,a.models);break}case"currentChanged":{if(Ee(this,_e)&&a.source!==c.configId&&((ze=(se=ye.gridOptions.context)==null?void 0:se.options)==null?void 0:ze.suppressDefaultFocusedCell)!==!0){const et=(at=ye==null?void 0:ye.gridOptions)==null?void 0:at.api.getRowNode((tt=Ee(this,_e))==null?void 0:tt.uid);(T=(qe=ye.gridOptions)==null?void 0:qe.api)==null||T.clearFocusedCell(),et&&(ye.gridOptions.context.focusColId||(ye.gridOptions.context.focusColId=n.SysInfo.GridCheckColumnFieldName),c.formHelper.setGridFocusedCell(ye,et.rowIndex,ye.gridOptions.context.focusColId))}break}}}else c.controlType==="Layout"&&t==="currentChanged"&&c.formHelper.refreshLayoutBindModel(c.configId)});const l=Ee(this,Ue)[t];l&&l instanceof Function&&l(a)},aa=function(){Ee(this,ke)||Ee(this,ke)===void 0&&Ee(this,z).length<=500?(Bt(this,le,mo.cloneDeep(Ee(this,z))),Bt(this,Ae,!0)):(Bt(this,le,[]),Bt(this,Ae,!1))},n.DataTable=j;class U{constructor(e){y(this,"dataSetName","");y(this,"dataTables");y(this,"relations");this.dataTables={},this.relations={},this.dataSetName=(e==null?void 0:e.trim())||""}get Name(){return this.dataSetName}setName(e){return this.dataSetName=(e==null?void 0:e.trim())||"",this}addDataTable(e,t){return t.tableName=e,this.dataTables[e]=t,this}removeDataTable(e){return this.contains(e)&&delete this.dataTables[e.trim()],this}renameDataTable(e,t){return this.contains(e)&&!this.contains(t)&&e.trim().toUpperCase()!==t.trim().toUpperCase()&&(this.addDataTable(t.trim().toUpperCase(),this.dataTables[e.trim().toUpperCase()]),delete this.dataTables[e.trim().toUpperCase()]),this}copyDataTable(e,t){let a,l;return e instanceof j?a=e:typeof e=="string"&&(a=this.dataTables[e]),a&&a.options&&(l=new j(a.options)),t&&t.trim().length>0&&!this.contains(t)&&(this.dataTables[t.trim()]=l),l}cloneDataTable(e,t){const a=this.copyDataTable(e,t);return a.data([]),a}getDataTable(e){return this.dataTables[e]}getTableName(e){let t;return Object.keys(this.dataTables).every(a=>this.dataTables[a]===e?(t=a,!1):!0),t}clear(...e){let t=Object.keys(this.dataTables);return e.length>0&&(t=e),t.forEach(a=>{this.dataTables[a]&&this.dataTables[a]instanceof j&&this.dataTables[a].clear()}),this}mergeData(e,t,a=!0,l=!1){return(e==null?void 0:e.trim().length)>0&&this.contains(e.trim())&&t&&this.dataTables[e].merge(t,a,l),this}mergeDataFromEIInfo(e,t="",a=!0){var l;if(t&&t.trim().length>0&&this.contains(t.trim())){const r=(l=e.getBlock(t.trim()))==null?void 0:l.getMappedRows();this.mergeData(t.trim(),r,a)}else Object.keys(this.dataTables).forEach(r=>{r.trim().length>0&&this.dataTables[r.trim()]&&e.getBlock(r.trim())&&this.mergeData(r.trim(),e.getBlock(r.trim()).getMappedRows(),a)});return this}getCurrentDataObject(e){let t;return(e==null?void 0:e.trim().length)>0&&this.contains(e.trim())&&(t=this.dataTables[e].Current),t}tablesCount(){return this.dataTables?Object.keys(this.dataTables).length:0}contains(e){return e&&e.trim().length>0?this.dataTables[e.trim()]!==void 0:!1}isEmpty(){return!(this.dataTables&&Object.keys(this.dataTables).length>0)}hasChanges(e){if(this.dataTables){if(e&&e.trim().length>0&&this.dataTables[e.trim()])return this.dataTables[e.trim()].hasChanges();{const a=Object.keys(this.dataTables);for(let l=0;l<a.length;l++)if(this.dataTables[a[l]].hasChanges())return!0}}return!1}hasRelation(e){return this.dataTables&&e&&e.trim().length>0&&this.relations[e.trim()]&&this.relations[e.trim()].length>0}acceptChanges(){return Object.keys(this.dataTables).forEach(t=>{this.dataTables[t]&&this.dataTables[t]instanceof j&&this.dataTables[t].acceptChanges()}),this}}n.DataSet=U;class Y{constructor(e,t,a,l,r){y(this,"SysDefinedParas");y(this,"_app");y(this,"_currentFormRegitInfo",{});y(this,"_currentConfigCompanyCode");y(this,"_serverPartition","");y(this,"_customPartition","");y(this,"_moduleName","");y(this,"_formId","");y(this,"_formName","");y(this,"_formCaption","");y(this,"_formWidth",-1);y(this,"_formHeight",-1);y(this,"_maxmizeBox",!0);y(this,"_minimizeBox",!0);y(this,"_resizable",!0);y(this,"_initializeFlag",0);y(this,"_layoutIds");y(this,"_dataSetName","");y(this,"_tableNames","");y(this,"_serviceName","JAER01/getFormConfig");y(this,"_initialConfiParas",{});y(this,"_configInfo",{});y(this,"_systemInfo",{});y(this,"_customDefaultValues",{});y(this,"_dropDownRefreshKey",o.reactive({}));y(this,"_dropDownBindSource",{});y(this,"_dropDownCascader",{});y(this,"_gridOptions",{});y(this,"_gridReactiveOptions",o.reactive({}));y(this,"_gridToolbarOptions",o.reactive({}));y(this,"_hiddenFields",{});y(this,"_requiredFields",{});y(this,"_requiredFieldsByCondition",{});y(this,"_formDataSet",new U);y(this,"_formBindingRelation",{});y(this,"_formAuthButtons",{});y(this,"_groupCompanyCode","");y(this,"_groupCompanyName","");y(this,"_formConfigLicens","");y(this,"_formConfigLicensErrorMsg","WMyNCZMrw9FY9qti+0p7zA==");y(this,"_privateEncryptKey","QTS8kH81A2Do4qfezJ9cCEM4lZifC7Ym");y(this,"_developPermisson","0");y(this,"_tempSingleConfigInfo",{});y(this,"_gridInstanceInfo",{});y(this,"_gridColumnsInfo",{});y(this,"_gridColumnsConfigInfo",{});y(this,"_gridStyleInfo",{});y(this,"_allowMergeColumnFields",{});y(this,"_widgetInstanceInfo",{});y(this,"_layoutConditionStyleInfo",{});y(this,"_layoutConfigRelationInfo",{});y(this,"_sysParaInfo",{});y(this,"_gridCustomEvent",{});y(this,"_formOptions",{});y(this,"_layoutOpitons",o.reactive({}));y(this,"_layoutItemOpitons",o.reactive({}));y(this,"_layoutBindModelUid",o.reactive({}));y(this,"_layoutBindModel",{});y(this,"_controlConditionProps",{});y(this,"_erxGlobalConfig",{});y(this,"excuteGridColumnExpressions",(e,t)=>{const a={...e},l=Object.keys(a).sort((c,d)=>c.length>d.length?-1:c.length<d.length?1:0);let r=t;l.forEach(c=>{vt.isDayjs(a[c])?a[c]=a[c].toDate():(a[c]===null||a[c]===void 0)&&(a[c]="");const d=new RegExp(`\\b${c}\\b`,"gi"),u=new RegExp(`[${c}]`.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");u.test(r)?r=r.replaceAll(u,`data.${c}`):d.test(r)&&(r=r.replaceAll(d,`data.${c}`))});try{return new Function("data",r)(a)}catch{console.error("ER: Script has a syntax error: "+r+"; data: "+JSON.stringify(a))}});this._formId=i.guid(),this._serverPartition=e||this._serverPartition,this._serviceName=a||this._serviceName,this._formName=t||this._formName,this._layoutIds=l,this._initialConfiParas=r,this._currentConfigCompanyCode={},this.SysDefinedParas={GroupCompanyCode:"BS",GroupCompanyName:"宝信软件",DefaultRmbCode:"CNY"}}get App(){return this._app}get CurrentFormRegitInfo(){return this._currentFormRegitInfo}get Locale(){return wo()}get IsRtl(){return _o()}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(e,t,a,l,r){var d,u,p,h;this._erxGlobalConfig=await n.Core.getErxGlobalConfig(),(u=(d=this._erxGlobalConfig)==null?void 0:d.License)!=null&&u[n.SysInfo.CompanyCode]&&(this._formConfigLicens=(h=(p=this._erxGlobalConfig)==null?void 0:p.License)==null?void 0:h[n.SysInfo.CompanyCode]);const c=i.decryptData(this._formConfigLicens,n.SysInfo.GridCheckColumnFieldName,i.decryptData(this._privateEncryptKey,n.SysInfo.GridCheckColumnFieldName,n.SysInfo.GridCheckColumnFieldName));return this._erxGlobalConfig&&(!this._formConfigLicens||c!==m.CompanyName)&&this.messageWarning(i.decryptData(this._formConfigLicensErrorMsg,n.SysInfo.GridCheckColumnFieldName,n.SysInfo.GridCheckColumnFieldName)),new Promise((g,I)=>{var M;this._serverPartition=(e==null?void 0:e.trim())||this._serverPartition,this._serviceName=(l==null?void 0:l.trim())||this._serviceName,this._formName=(t==null?void 0:t.trim())||this._formName,this._initialConfiParas=r||this._initialConfiParas||{},this._layoutIds=a||this._layoutIds;let b="";this._layoutIds&&(typeof this._layoutIds=="string"?b=this._layoutIds:this._layoutIds instanceof Array&&(b=this._layoutIds.join(","))),this._dataSetName=((M=this._dataSetName)==null?void 0:M.trim())||"#";const S=new Ze.EiInfo;if(S.addBlock(i.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:b,DATASET_NAME:this._dataSetName,TABLE_NAMES:this._tableNames}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const D=new Ze.EiBlock("InitializeFormParas");D.addColumn("PARA_NAME"),D.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(A=>{D.addRow([{PARA_NAME:A,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[A]:""}])}),S.addBlock(D)}n.Core.callService(this._serviceName,S).then(D=>{var A,V,P;D.getStatus()>=0?(Object.keys(D.getBlocks()).forEach(J=>{this._configInfo[J]=D.getBlock(J)}),((P=(V=(A=this._configInfo)==null?void 0:A.TSI00FORM)==null?void 0:V.getMappedRows())==null?void 0:P.length)>0?(this.InitializeWithData(),g({flag:this._initializeFlag,msg:"success"})):(this._initializeFlag=-1,g({flag:this._initializeFlag,msg:`The configuration information for the form [${this._formName}] was not found!`}))):(this._initializeFlag=-1,g({flag:this._initializeFlag,msg:D.getMsg()??"unknown error"}))},D=>{g({...D,flag:-1,msg:"unknown error"})})})}InitializeWithData(){var a,l,r,c,d,u;this._initializeFlag=1;let e=n.SysInfo.CompanyCode;e||(e=this.DefaultConfigCompanyCode);const t=this._configInfo.TSI00FORM.getMappedRows()[0];this._moduleName=t.MODULE_NAME,this.ModuleName.length<2?this._moduleName="GC":this._moduleName=this.ModuleName.substring(0,2),this._formName=t.FORM_NAME,this._formWidth=n.Core.toNumber(t.FORM_WIDTH)||800,this._formHeight=n.Core.toNumber(t.FORM_HEIGHT)||650,this._formCaption=t.FORM_FUNC_DESC,this._minimizeBox=t.MINIMIZE==="1",this._maxmizeBox=t.MAXIMIZE==="1",this._resizable=t.FORM_STYLE!=="3",this._formConfigLicens=t.LICENSE,this._groupCompanyCode=((a=t.GROUP_COMPANY_CODE)==null?void 0:a.trim())||this._groupCompanyCode,this._groupCompanyName=((l=t.GROUP_COMPANY_NAME)==null?void 0:l.trim())||this._groupCompanyName,this._configInfo.BM2A_SYSTEM_INFO&&(this._systemInfo=this._configInfo.BM2A_SYSTEM_INFO.getMappedRows()[0],this._developPermisson=this.getFormSysInfo("DEV_LICENSE")),((r=t.EXT_OPTIONS)==null?void 0:r.trim().length)>0&&(this._formOptions=JSON.parse(t.EXT_OPTIONS)),((u=(d=(c=this._configInfo)==null?void 0:c.TSI00GRIDVIEW)==null?void 0:d.getMappedRows())==null?void 0:u.length)>0?(this.createDataSet(),this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(p=>{this.setDropDownBindSourceAndRequiredFields(p)})):console.error("ER: No view configuration information found!")}setMenuFormInstance(e){var t,a,l,r,c,d;if(e){const u=(t=e==null?void 0:e.attrs)==null?void 0:t.__eiInfo;this._currentFormRegitInfo.formInfo=u==null?void 0:u.extAttr,this._currentFormRegitInfo.formQueryParams=n.Core.getQueryParams((a=u==null?void 0:u.extAttr)==null?void 0:a.efFormLoadPath),this._currentFormRegitInfo.formButtons={},(r=(l=e==null?void 0:e.attrs)==null?void 0:l.__buttonsEi)!=null&&r.blocks&&Object.keys((d=(c=e==null?void 0:e.attrs)==null?void 0:c.__buttonsEi)==null?void 0:d.blocks).forEach(p=>{var h,g;this._currentFormRegitInfo.formButtons[p]=(g=(h=e==null?void 0:e.attrs)==null?void 0:h.__buttonsEi)==null?void 0:g.getBlock(p).getMappedRows()})}}async loadConfig(e,t){return new Promise((a,l)=>{var c,d;let r="";if((c=this._formDataSet)!=null&&c.dataTables&&(r=Object.keys((d=this._formDataSet)==null?void 0:d.dataTables).toString()),t===void 0&&(t=this._initialConfiParas),e.trim().length>0){const u=e.split(",");let p="";for(let h=0;h<u.length;h++)this.containsConfig(u[h].trim())||(p=p.length===0?u[h].trim():p+","+u[h].trim());if(p.length>0){const h=new Ze.EiInfo;if(h.addBlock(i.buildEiBlock([{DEFAULT_COMPANY_CODE:this.DefaultConfigCompanyCode,FORM_NAME:this._formName,TYPE_CODE:"zh_Hans",FUNCTION_IDS:p,EXIST_TABLES:r,INI_FLAG:this._initializeFlag}],"Table0")),this._initialConfiParas&&Object.keys(this._initialConfiParas).length>0){const g=new Ze.EiBlock("InitializeFormParas");g.addColumn("PARA_NAME"),g.addColumn("PARA_VALUE"),Object.keys(this._initialConfiParas).forEach(I=>{g.addRow([{PARA_NAME:I,PARA_VALUE:this._initialConfiParas?this._initialConfiParas[I]:""}])}),h.addBlock(g)}n.Core.callService(this._serviceName,h).then(g=>{g.getStatus()>=0&&(Object.keys(g.getBlocks()).forEach(S=>{["BM2A_SYSTEM_INFO","TESCOMPANYINFO","TSI00FORM","TSI00DATASOURCE","TSI00DATATABLE","TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].includes(S)||(this._configInfo[S]=g.getBlock(S))}),["TSI00GRIDVIEW","TSI00GRIDCOLUMN","TSI00GRIDCOLUMNURL","TSI00GRIDSTYLE","TSI00GRIDBAND","TSI00GRIDCONDITION"].forEach(S=>{g.getBlock(S)&&this._configInfo[S]&&g.getBlock(S).getMappedRows().length>0&&this._configInfo[S].addRow(g.getBlock(S).getRows())}),p.split(",").forEach(S=>{var A;const M=this.getSingleViewConfigInfo(S),D=i.toString(M.TABLE_NAME).trim();if(M&&D.length>0&&!this._formDataSet.contains(D)){this._configInfo.TSI00DATATABLE.data.some(P=>P.TABLE_NAME===D)||g.getBlock("TSI00DATATABLE").getMappedRows().length>0&&this._configInfo.TSI00DATATABLE.addRow(g.getBlock("TSI00DATATABLE").getRows());const V={};M.FUNCTION_TYPE==="T"&&((A=M.CURRENT_NODE_DESC)==null?void 0:A.trim().length)>0&&M.FATHER_NODE_DESC.trim().length>0&&(V.hierarchy={primaryField:M.CURRENT_NODE_DESC.trim(),parentField:M.CURRENT_NODE_DESC}),this.createDataTable(D,V)}this.setDropDownBindSourceAndRequiredFields(M)})),a({flag:g.getStatus()>=0?1:-1,msg:g.getMsg()??"unknown error"})},g=>{a({...g,flag:-1,msg:"unknown error"})})}else a({flag:1,msg:"Configuration ["+e.trim()+"] already exists"})}else a({flag:-1,msg:"No config id"})})}$t(e,t){var l,r;let a="";if((e==null?void 0:e.trim().length)>0){for(let c=0;c<((r=(l=this.ConfigInfo.TSI00FORMRESOURCE)==null?void 0:l.getMappedRows())==null?void 0:r.length);c++)if(this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[c].ITEM_CODE===e){a=this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[c].ITEM_VALUE_RES||this.ConfigInfo.TSI00FORMRESOURCE.getMappedRows()[c].ITEM_VALUE;break}a=a??n.Core.$t(e,t)}return a}setFormCapiton(e){return this._formCaption=e,this}setFormOptions(e){return this._formOptions={...this._formOptions,...e},this}setDropDownBindSourceAndRequiredFields(e){const t={},a={},l=[],r=[],c=["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 d=[],u=n.SysInfo.CompanyCode;u||(u=this.DefaultConfigCompanyCode),e.MATCH_FLAG==="1"&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(p=>{const h=(e.FUNCTION_TYPE==="F"?"F":"G")+p.COLUMN_EDIT;return p.FUNCTION_ID===e.FUNCTION_ID&&p.COMPANY_CODE===u&&(c.includes(h)||p.ITEM_MUST_FLAG==="1")})),d.length===0&&(d=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(p=>{const h=(e.FUNCTION_TYPE==="F"?"F":"G")+p.COLUMN_EDIT;return p.FUNCTION_ID===e.FUNCTION_ID&&p.COMPANY_CODE===this.DefaultConfigCompanyCode&&(c.includes(h)||p.ITEM_MUST_FLAG==="1")})),d.length>0&&d.forEach(p=>{const h=(e.FUNCTION_TYPE==="F"?"F":"G")+p.COLUMN_EDIT;if(c.includes(h))if(p.ORIGIN_CODE!=="0"&&p.SVC_NAME.trim().length>0){if(t[p.ITEM_CODE]=this.setDropDownBindOptions(e.FUNCTION_TYPE,p),p.FATHER_FIELD.trim().length>0&&p.FORM_FILTER.trim().length>0&&p.FORM_FILTER.trim()!=="0"){p.LAYOUT_ID.trim().length===0&&(p.LAYOUT_ID=e.FUNCTION_ID),this._dropDownCascader[p.LAYOUT_ID.trim()+p.FATHER_FIELD.trim()]||(this._dropDownCascader[p.LAYOUT_ID.trim()+p.FATHER_FIELD.trim()]=[]);const g={};g.COLUMN_EDIT=p.COLUMN_EDIT,g.FUNCTION_ID=p.FUNCTION_ID,g.ITEM_CODE=p.ITEM_CODE,g.FORM_FILTER=p.FORM_FILTER,g.FUNCTION_TYPE=e.FUNCTION_TYPE,this._dropDownCascader[p.LAYOUT_ID.trim()+p.FATHER_FIELD.trim()].push(g)}a[p.ITEM_CODE]=i.guid()}else console.warn(`ER: The dropdown data source for [${e.FUNCTION_ID}.${p.ITEM_CODE}] is not configured!`);p.ITEM_MUST_FLAG==="1"&&(p.MUST_INPUT_CONDITION.trim().length>0?r.push({ITEM_CODE:p.ITEM_CODE,COL_CAPTION:p.COL_CAPTION,FIELD_NAME:p.FIELD_NAME,MUST_INPUT_CONDITION:p.MUST_INPUT_CONDITION,CONDITION_TABLE:p.CONDITION_TABLE}):l.push({ITEM_CODE:p.ITEM_CODE,COL_CAPTION:p.COL_CAPTION,FIELD_NAME:p.FIELD_NAME}))})}this._dropDownRefreshKey[e.FUNCTION_ID]=a,this._dropDownBindSource[e.FUNCTION_ID]=t,this._requiredFields[e.FUNCTION_ID]=l,this._requiredFieldsByCondition[e.FUNCTION_ID]=r}setCustomPartition(e){return this._customPartition=e,this._customPartition}setLayoutCaption(e,t){this.setLayoutOptions(e,"layoutCaption",t)}getLayoutCaption(e){return i.toString(this.getLayoutOptions(e,"layoutCaption"))}getLayoutBindModel(e){if(this._layoutBindModel[e]===void 0){const t=new Q;t.uid="",this._layoutBindModel[e]=o.reactive(t)}return this._layoutBindModel[e]}refreshLayoutBindModel(e){const t=this.getBindingTable(e);let a=t==null?void 0:t.Current;a||(a=new Q,a.uid=""),this._layoutBindModel[e]=o.reactive(a),this._layoutBindModelUid[e]=a.uid}setLayoutBindForm(e,t){this.setLayoutOptions(e,"bindForm",t)}getLayoutBindForm(e){return this.getLayoutOptions(e,"bindForm")}setLayoutOptions(e,t,a){return(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&(e=e.trim(),t=t.trim(),this._layoutOpitons[e]=this._layoutOpitons[e]||{},this._layoutOpitons[e][t]=a),this}getLayoutOptions(e,t){let a;return(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&(e=e.trim(),this._layoutOpitons[e]&&(a=this._layoutOpitons[e][t==null?void 0:t.trim()])),(a==null?void 0:a.value)!==void 0?a==null?void 0:a.value:a}setLayoutItemOption(e,t,a){return(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&a&&(this._layoutItemOpitons[e]=this._layoutItemOpitons[e]||{},this._layoutItemOpitons[e][t]=this._layoutItemOpitons[e][t]||{},Object.keys(a).forEach(l=>{o.isRef(this._layoutItemOpitons[e][t][l])?this._layoutItemOpitons[e][t][l].value=a[l]:this._layoutItemOpitons[e][t][l]=o.ref(a[l])})),this}getLayoutItemOption(e,t,a){let l;return this._layoutItemOpitons[e]&&this._layoutItemOpitons[e][t]&&(l=this._layoutItemOpitons[e][t][a]),(l==null?void 0:l.value)!==void 0?l==null?void 0:l.value:l}setLayoutItemValidateRules(e,t,a,l=!1){if((e==null?void 0:e.trim().length)>0&&typeof t=="string"&&(t==null?void 0:t.trim().length)>0){const r=this.getLayoutBindForm(e);if(r!=null&&r.rulesRef)if(r.rulesRef[t]=r.rulesRef[t]||[],l&&r.rulesRef[t])if((a==null?void 0:a.length)>0){const c=[];a.forEach((d,u)=>{a[u].itemCode=t;let p=!1;for(let h=0;h<r.rulesRef[t].length;h++)if(r.rulesRef[t][h].customType===d.customType){r.rulesRef[t][h]=d,p=!0;break}p||c.push(d)}),c.length>0&&r.rulesRef[t].push(...c)}else r.rulesRef[t]=[];else r.rulesRef[t].push(...a)}return this}setLayoutItemCaptionForeColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{r.trim().length>0&&this.setLayoutItemOption(e,r,{LabelForeColor:a})}),this}setLayoutItemCaptionBackColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{r.trim().length>0&&this.setLayoutItemOption(e,r,{LabelBackColor:a})}),this}setLayoutItemContentForeColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{if(r.trim().length>0){const c=this.getLayoutItemOption(e,r,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","erTreeSelect","erMultiTreeSelect","antInput","antInputNumber","antDateTimePicker","antDatePicker","antMonthPicker","antYearPicker"].includes(c)&&this.setControlCss(e,r,[{property:"color",value:a}]),this.setLayoutItemOption(e,r,{TextForeColor:a})}}),this}setLayoutItemContentBackColor(e,t,a){let l;return t instanceof Array?l=t:l=t.split(","),(l==null?void 0:l.length)>0&&l.forEach(r=>{if(r.trim().length>0){const c=this.getLayoutItemOption(e,r,"controlType");["erSelect","erMultiSelect","antSelect","antMultiSelect","antInput","antInputNumber"].includes(c)&&this.setControlCss(e,r,[{property:"background",value:a}]),this.setLayoutItemOption(e,r,{TextBackColor:a})}}),this}setLayoutConditionStyleConfigInfo(e,t,a){return this._layoutConditionStyleInfo[e]=this._layoutConditionStyleInfo[e]||{},this._layoutConditionStyleInfo[e][t]=a,this}setLayoutConditionStyle(e,t){if((e==null?void 0:e.trim().length)>0){const a=this.getLayoutBindModel(e);if(a&&this._layoutConditionStyleInfo[e==null?void 0:e.trim()]){const l=c=>{var u,p,h,g,I,b,S,M;const d=this._layoutConditionStyleInfo[e==null?void 0:e.trim()][c];d&&(n.Core.checkExpressionValid(a,n.Core.getSystemFormatString(d.condition))?(((u=d.labelForeColor)==null?void 0:u.trim().length)>0&&this.setLayoutItemCaptionForeColor(e,c,d.labelForeColor),((p=d.labelBackgroundColor)==null?void 0:p.trim().length)>0&&this.setLayoutItemCaptionBackColor(e,c,d.labelBackgroundColor),((h=d.textForeColor)==null?void 0:h.trim().length)>0&&this.setLayoutItemContentForeColor(e,c,d.textForeColor),((g=d.textBackgroundColor)==null?void 0:g.trim().length)>0&&this.setLayoutItemContentBackColor(e,c,d.textBackgroundColor)):(((I=d.labelForeColor)==null?void 0:I.trim().length)>0&&this.setLayoutItemCaptionForeColor(e,c,""),((b=d.labelBackgroundColor)==null?void 0:b.trim().length)>0&&this.setLayoutItemCaptionBackColor(e,c,""),((S=d.textForeColor)==null?void 0:S.trim().length)>0&&this.setLayoutItemContentForeColor(e,c,""),((M=d.textBackgroundColor)==null?void 0:M.trim().length)>0&&this.setLayoutItemContentBackColor(e,c,"")))};let r;t instanceof Array?r=t:t&&(t==null?void 0:t.trim().length)>0?r=t.split(","):r=Object.keys(this._layoutConditionStyleInfo[e]),(r==null?void 0:r.length)>0&&r.forEach(c=>{l(c)})}}return this}bindGridCustomEvent(e,t,a){return this._gridCustomEvent[e]=this._gridCustomEvent[e]||{},this._gridCustomEvent[e][t]=a,this}getGridCustomEvent(e,t){let a;return this._gridCustomEvent[e]&&this._gridCustomEvent[e][t]&&(a=this._gridCustomEvent[e][t]),a}getCompanyName(e){return""}cloneTableForLayoutOrGrid(e,t,a){var l,r,c,d,u,p;if(this.InitializeFlag>0&&e.trim().length>0&&t.trim().length>0&&a.trim().length>0&&!((l=this._formDataSet)!=null&&l.contains(t.trim())))if(a=a.trim(),e=e.trim(),t=t.trim(),(r=this._formDataSet)!=null&&r.contains(e)||(e=this.getBindingTableName(e)),e.length>0&&((c=this._formDataSet)!=null&&c.contains(e))){const h=(d=this._formDataSet)==null?void 0:d.getDataTable(e),g=(u=this._formDataSet)==null?void 0:u.cloneDataTable(h,t);(p=this._formDataSet)==null||p.addDataTable(t,g),this._configInfo.TSI00GRIDVIEW.getMappedRows().every(b=>b.FUNCTION_ID===a?(b.TABLE_NAME=t,!1):!0),this._formBindingRelation[a]=t;const I=this.getGrid(a);I&&(h.removeBindingInfo(this,a),I.gridOptions.context.bindingSource=g,I.gridOptions.context.bindTableName=t,g.setBindingInfo(this,a,"Grid"))}else this.messageError(`ER: The origin table [${e}] does not exist!`);return this}containsConfig(e){const t=this.getConfigInfo(e);return!!(t&&t.TSI00GRIDCOLUMN&&t.TSI00GRIDCOLUMN.length>0)}isEmptyConfig(e){return!this.containsConfig(e)}getConfigInfo(e,t=!1){let a={},l=n.SysInfo.CompanyCode;if(l||(l=this.DefaultConfigCompanyCode),this._tempSingleConfigInfo[e])a=this._tempSingleConfigInfo[e];else{let r=[];if(this._configInfo.TSI00GRIDVIEW&&(r=this._configInfo.TSI00GRIDVIEW.getMappedRows().filter(c=>c.FUNCTION_ID===e),r.length>0)){a.TSI00GRIDVIEW=r;const c=a.TSI00GRIDVIEW.FUNCTION_TYPE,d=a.TSI00GRIDVIEW.MATCH_FLAG;this._configInfo.TSI00GRIDCOLUMN&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l&&(u.IS_VISIBLE==="1"||t===!1)),r.length>0&&(a.TSI00GRIDCOLUMN=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDCOLUMN.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode&&(u.IS_VISIBLE==="1"||t===!1)),r.length>0&&(a.TSI00GRIDCOLUMN=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDCOLUMNURL&&c!=="F"&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l),r.length>0&&(a.TSI00GRIDCOLUMNURL=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDCOLUMNURL.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode),r.length>0&&(a.TSI00GRIDCOLUMNURL=r),this._currentConfigCompanyCode["TSI00GRIDCOLUMNURL"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDSTYLE&&c!=="F"&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l&&u.NTYPE.length>2&&u.NTYPE.substring(0,2).toUpperCase()==="W_"),r.length>0&&(a.TSI00GRIDSTYLE=r),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDSTYLE.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode&&u.NTYPE.length>2&&u.NTYPE.substring(0,2).toUpperCase()==="W_"),r.length>0&&(a.TSI00GRIDSTYLE=r),this._currentConfigCompanyCode["TSI00GRIDSTYLE"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDBAND&&c!=="F"&&(r=[],d==="1"&&(r=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===l),r.length>0&&(a.TSI00GRIDBAND=r),this._currentConfigCompanyCode["TSI00GRIDBAND"+e]=l),r.length===0&&(r=this._configInfo.TSI00GRIDBAND.getMappedRows().filter(u=>u.FUNCTION_ID===e&&u.COMPANY_CODE===this.DefaultConfigCompanyCode),r.length>0&&(a.TSI00GRIDBAND=r),this._currentConfigCompanyCode["TSI00GRIDBAND"+e]=this.DefaultConfigCompanyCode)),this._configInfo.TSI00GRIDVIEWCUS&&c!=="F"&&(r=this._configInfo.TSI00GRIDVIEWCUS.getMappedRows().filter(u=>u.FUNCTION_ID===e),r.length>0&&(a.TSI00GRIDVIEWCUS=r)),this._tempSingleConfigInfo[e]=a}}return a}getSingleViewConfigInfo(e){let t={};return this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().length>0&&this._configInfo.TSI00GRIDVIEW&&this._configInfo.TSI00GRIDVIEW.getMappedRows().every(a=>a.FUNCTION_ID===e?(t=a,!1):!0),t}getSingleItemConfigInfo(e,t,a){let l={};if(this._gridColumnsConfigInfo[e]===void 0&&(this._gridColumnsConfigInfo[e]={}),this._gridColumnsConfigInfo[e][t])l=this._gridColumnsConfigInfo[e][t];else{let r=[];(!a||a.trim().length===0)&&(a=n.SysInfo.CompanyCode),a||(a=this._currentConfigCompanyCode["TSI00GRIDCOLUMN"+e]);const c=this.getConfigInfo(e);c.TSI00GRIDCOLUMN&&(r=c.TSI00GRIDCOLUMN,r.length>0&&(r.every((d,u)=>d.COMPANY_CODE===a&&d.FUNCTION_ID===e&&d.ITEM_CODE===t||d.COMPANY_CODE===this.DefaultConfigCompanyCode&&d.FUNCTION_ID===e&&d.ITEM_CODE===t?(l=d,!1):!0),Object.keys(l).length>0&&c.TSI00GRIDVIEW&&(r=c.TSI00GRIDVIEW,r.length>0&&(l.FUNCTION_TYPE=r[0].FUNCTION_TYPE))),this._gridColumnsConfigInfo[e][t]=l)}return l}getAllItemCodeArray(e){const t=[];e=this.getConfigIdbyLayoutName(e);const a=this.getConfigInfo(e);if(a.TSI00GRIDCOLUMN){const l=a.TSI00GRIDCOLUMN;l.length>0&&l.forEach(r=>{t.push(r.ITEM_CODE)})}return t}getAllConfigIdArray(){const e=[];if(this._configInfo.TSI00GRIDVIEW){const t=this._configInfo.TSI00GRIDVIEW.getMappedRows();t.length>0&&t.forEach(a=>{e.push(a.ITEM_CODE)})}return e}getItemDropDownDataSource(e,t){var r;let a=[];const l=this.getSingleItemConfigInfo(e,t);return((r=l==null?void 0:l.SVC_NAME)==null?void 0:r.trim().length)>0&&(this._configInfo[l.FUNCTION_ID+l.ITEM_CODE+m.CompanyCode]?a=this._configInfo[l.FUNCTION_ID+l.ITEM_CODE+m.CompanyCode].getMappedRows():this._configInfo[l.FUNCTION_ID+l.ITEM_CODE]?a=this._configInfo[l.FUNCTION_ID+l.ITEM_CODE].getMappedRows():this._configInfo[l.FUNCTION_ID+l.SVC_NAME]?a=this._configInfo[l.FUNCTION_ID+l.SVC_NAME].getMappedRows():this._configInfo["SI->"+l.SVC_NAME]?a=this._configInfo["SI->"+l.SVC_NAME].getMappedRows():this._configInfo["EP->"+l.SVC_NAME]?a=this._configInfo["EP->"+l.SVC_NAME].getMappedRows():this._configInfo["PM->"+l.SVC_NAME]?a=this._configInfo["PM->"+l.SVC_NAME].getMappedRows():this._configInfo[this._formName+l.SVC_NAME]?a=this._configInfo[this._formName+l.SVC_NAME].getMappedRows():this._configInfo[l.SVC_NAME]?a=this._configInfo[l.SVC_NAME].getMappedRows():this.messageError(`Can not find the data source config for [${e}.${t}]!`)),a}setDropDownBindOptions(e,t,a){var P,J;const l=i.toString(t.DISPLAY_COLS).toUpperCase();let r=i.toString(t.DISPLAY_CAPTIONS).trim(),c=!1;const d=i.toString(t.VALUE_MEMBER).toUpperCase(),u=i.toString(t.DISPLAY_MEMBER).toUpperCase(),p=i.toNumber(t.VALUE_POSITION),h=i.toNumber(t.DISPLAY_POSITION),g=[],I=n.Core.$t("ERX.CodeColumn")||"代码",b=n.Core.$t("ERX.DescriptionColumn")||"描述";r.startsWith("$t(")&&r.endsWith(")")&&(r=r.substring(3,r.length-1),c=!0);let S="CODE";d.trim().length>0&&(S=d.trim());let M="CODE_DESC_1_CONTENT";u.trim().length>0&&(M=u.trim()),g.push(S,M);const D={dataValueField:"",dataTextField:"",dataSource:[],filterFields:g,columns:[{field:S,title:I,width:150},{field:M,title:b,width:150}],codeClass:t.SVC_NAME,layoutType:e,columnConfig:t};let A=[];a&&a instanceof Function&&(a=a());const V=a||this.getItemDropDownDataSource(t.FUNCTION_ID,t.ITEM_CODE)||[];if(l.length>0&&r.length>0){const N=l.split(","),te=r.split(",");if(N.length!==te.length)this.messageError("[DisplayColumns] array length need same to [DisplayCaptions] array length!");else{const R=[];for(let me=0;me<N.length;me++){const fe={field:N[me],title:te[me].trim(),width:150};fe.title.startsWith("$t(")&&fe.title.endsWith(")")?fe.title=this.$t(fe.title.substring(3,fe.title.length-1)):c&&(fe.title=this.$t(fe.title)),R.push(fe),g.push(fe.field)}d.trim().length>0&&u.trim().length>0?(S=d.trim(),M=u.trim()):(p>=0&&p<N.length?S=N[p]:S=N[0],h>=0&&p<N.length?M=N[h]:N.length>1?M=N[1]:M=N[0]),D.columns=R,D.dropDownWidth=R.length*150,D.dataValueField=S,D.dataTextField=M}}else if(V.length>0){const N=Object.keys(V[0]);(V[0][S]===void 0||V[0][M]===void 0)&&(V[0][S]===void 0&&(S=N[0]),V[0][M]===void 0&&(N.length>1?M=N[1]:M=N[0])),D.columns=t.VALUE_VISIBLE==="1"?[{field:S,title:I,width:150},{field:M,title:b,width:150}]:[{field:M,title:b,width:150}],t.VALUE_VISIBLE==="1"&&g.push(S)}else d.trim().length>0&&u.trim().length>0&&(S=d.trim(),M=u.trim(),D.columns=t.VALUE_VISIBLE==="1"?[{field:S,title:I,width:150},{field:M,title:b,width:150}]:[{field:M,title:b,width:150}],t.VALUE_VISIBLE==="1"&&g.push(S));return t.ADD_EMPTY_ITEM==="1"&&(D.optionLabel="—-—"),t.FORMAT_TYPE==="Custom"&&((P=t.FORMAT_STRING)==null?void 0:P.trim().length)>0?D.displayFormat=(J=t.FORMAT_STRING)==null?void 0:J.trim():t.DISPLAY_POSITION===t.VALUE_POSITION&&i.toNumber(t.VALUE_POSITION)>=0||t.DISPLAY_MEMBER===t.VALUE_MEMBER&&t.VALUE_MEMBER.trim().length>0?D.displayFormat="{0}":t.VALUE_VISIBLE==="1"?D.displayFormat="{0}|{1}":D.displayFormat="{1}",V&&V instanceof Array&&(A=V.map(N=>({...N,value:N[S],label:N[M]}))),g.push(M),D.autoWidth=!0,D.dataSource=A,D.dataValueField=S,D.dataTextField=M,D}filterDropDownCascaderDataSource(e,t,a){const l=[];if(a instanceof Array&&a.length>0?l.push(...a):n.Core.toString(a).length>0&&l.push(n.Core.toString(a)),e&&e.length>0&&t.length>0&&l.length>0){const r=t.indexOf(" like ")>=0?"like":t.indexOf(" <> ")>=0?"<>":"=",c=t.split(r);if(c.length===2){const d=c[0].trim().toUpperCase(),u=c[1].trim().toUpperCase(),p=[];return e.forEach(h=>{const g=n.Core.toString(h[d]).trim();if(g.length>0){for(let I=0;I<l.length;I++)if(r==="like"){if(u.startsWith("'%")&&u.endsWith("%'")&&g.indexOf(l[I])>=0){p.push(h);break}else if(u.startsWith("'%")&&g.endsWith(l[I])){p.push(h);break}else if(g.startsWith(l[I])){p.push(h);break}}else if(r==="<>"&&g!==l[I]){p.push(h);break}else if(g===l[I]){p.push(h);break}}}),p}}return e}setDropDownCascaderDataSource(e,t,a){this._dropDownCascader[e+t]&&this._dropDownCascader[e+t].length>0&&this._dropDownCascader[e+t].forEach(r=>{if(r.FUNCTION_TYPE==="F"){const c=this._dropDownBindSource[r.FUNCTION_ID][r.ITEM_CODE].dataSource,d=r.FORM_FILTER.trim(),u=this.filterDropDownCascaderDataSource(c,d,a);r.dataSource=u,this.reloadDropDownDataSource(r.FUNCTION_ID,r.ITEM_CODE,r.dataSource)}})}getDropDownCascaderDataTable(e,t,a,l){let r;return e.trim().length>0&&t.trim().length>0&&a.trim().length>0&&l.trim().length>0&&this._dropDownCascader[a.trim()+l.trim()]&&this._dropDownCascader[a.trim()+l.trim()].length>0&&this._dropDownCascader[a.trim()+l.trim()].every(c=>c.FUNCTION_ID===e.trim()&&c.ITEM_CODE===t.trim()?(r=c.dataSource,!1):!0),r}getGridStyleConfig(e){return this._gridStyleInfo[e]}setDropDownAutoFillFieldForLayout(e,t,a){a&&a instanceof Array&&(a=a.join(","));const l=this.getSingleItemConfigInfo(e,t);if(l&&l.AUTOFILL_COLS&&l.AUTOFILL_COLS.trim().length>0){const c=l.AUTOFILL_COLS.trim().split(";"),d=this.getDropDownSelectedData(e,t,a);c.forEach(u=>{if(u.trim().length>0){const p=u.split("="),h=p[0].trim().toUpperCase();let g=p[0].trim().toUpperCase();if(p.length>1&&(g=p[1].trim().toUpperCase()),d&&d instanceof Array){let I="";d.forEach(b=>{const S=n.Core.toString(b[h]).trim();S.length>0&&(I=I.length===0?S:I+","+S)}),this.setControlValue(e,g,I)}else this.setControlValue(e,g,d[h])}})}}setDropDownAutoFillFieldsForGrid(e,t,a){var r,c,d,u,p,h,g,I,b,S;const l=this.getGrid(e);if(l&&((r=a==null?void 0:a.data)!=null&&r.uid)){const M=(c=l.gridOptions.context)==null?void 0:c.configId,D=(u=(d=l.gridOptions.context)==null?void 0:d.viewConfig)==null?void 0:u.AUTO_SELECT_MODE,A=this.getGridColumn(e,t);if((h=(p=A==null?void 0:A.colDef)==null?void 0:p.context)!=null&&h.columnConfig){const V=(I=(g=A==null?void 0:A.colDef)==null?void 0:g.context)==null?void 0:I.columnConfig;let P=[],J={};if(V&&V.AUTOFILL_COLS&&V.COLUMN_EDIT!=="3"){const N=V.AUTOFILL_COLS;N.length>0&&(P=N.split(";"),a.data[t]&&(J=this.getDropDownSelectedData(M,t,a.data[t])),P.forEach(te=>{if(te.trim().length>0){const R=te.trim().split("="),me=R[0].toUpperCase().trim();let fe=R[0].toUpperCase().trim();if(R.length>1&&(fe=R[1].toUpperCase().trim()),J&&J instanceof Array){let X="";J.forEach(q=>{const v=n.Core.toString(q[me]).trim();v.length>0&&(X=X.length===0?v:X+","+v)}),a.data.set(fe,X)}else a.data.set(fe,J[me]);l.gridOptions.api.refreshCells({rowNodes:[a],columns:[fe,n.SysInfo.GridCheckColumnFieldName]})}}))}if(a.isSelected()&&V.MULTI_ROW_EDIT==="1"&&D!=="1"&&D!=="3"){const N=this.getGridOptions(M,"multiRowEdit");if(N!==!1&&N!=="0")if(((S=(b=l.gridOptions.context)==null?void 0:b.options)==null?void 0:S.multiRowEditType)==="all"){const te=this.getGridSelectRows(l);(te==null?void 0:te.length)>0&&te.forEach(R=>{a.data.uid!==R.uid&&P.forEach(me=>{if(me.trim().length>0){const fe=me.trim().split("="),X=fe[0].toUpperCase().trim();let q=fe[0].toUpperCase().trim();if(fe.length>1&&(q=fe[1].toUpperCase().trim()),R){if(J&&J instanceof Array){let v="";J.forEach(O=>{const ge=n.Core.toString(O[X]).trim();ge.length>0&&(v=v.length===0?ge:v+","+ge)}),R.set(q,v)}else R.set(q,J[X]);l.gridOptions.api.refreshCells({rowNodes:[a],columns:[q,n.SysInfo.GridCheckColumnFieldName]})}}})})}else{const te=[];l.gridOptions.api.forEachNodeAfterFilter(R=>{var me;R!=null&&R.selected&&((me=R.data)!=null&&me.uid)&&R.data.uid!==a.data.uid&&te.push(R)}),(te==null?void 0:te.length)>0&&te.forEach(R=>{a.data.uid!==R.data.uid&&P.forEach(me=>{if(me.trim().length>0){const fe=me.trim().split("="),X=fe[0].toUpperCase().trim();let q=fe[0].toUpperCase().trim();if(fe.length>1&&(q=fe[1].toUpperCase().trim()),J&&J instanceof Array){let v="";J.forEach(O=>{const ge=n.Core.toString(O[X]).trim();ge.length>0&&(v=v.length===0?ge:v+","+ge)}),R.data.set(q,v)}else R.data.set(q,J[X]);l.gridOptions.api.refreshCells({rowNodes:[a],columns:[q,n.SysInfo.GridCheckColumnFieldName]})}})})}}}}}addDropDownCode(e,t,a,l="push"){var r,c;if((e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0&&(a==null?void 0:a.length)>0&&this._dropDownBindSource[e.trim()]&&this._dropDownBindSource[e.trim()][t.trim()]){const d=this._dropDownBindSource[e.trim()][t.trim()];if(d.dataSource!==void 0&&d.dataSource instanceof Array){l==="unshift"?d.dataSource.unshift(...a):d.dataSource.push(...a);const u=this.getSingleItemConfigInfo(e,t);if(u.FUNCTION_TYPE==="F")this._dropDownRefreshKey[e][t]=i.guid(),this.setControlEmptyValue(e,t);else if(u.FUNCTION_TYPE==="G"||u.FUNCTION_TYPE==="P"){const p=this.getGridColumn(e,t);if(p.colDef){this.setGridColumnDropdown(e,p.colDef,d.dataSource,(r=p.colDef.context)==null?void 0:r.valueField,(c=p.colDef.context)==null?void 0:c.textField,d.displayFormat);const h=this.getGridApi(e);h==null||h.refreshCells({columns:[p.colId]})}}}}}async reloadDropDownDataSource(e,t,a){var l,r,c,d;if((e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0){const u=this.getSingleItemConfigInfo(e,t);if(u){let p=[];if(a&&a instanceof Function&&(a=a()),a instanceof Ze.EiBlock)p=a.getMappedRows();else if(a instanceof Array)p=a;else if(u.ORIGIN_CODE==="2"&&u.SVC_NAME.trim().length>0){const g=await this.queryDataByDataSource(u.SVC_NAME.trim());n.Core.toNumber((l=g.SysInfo)==null?void 0:l.Flag)>=0&&(p=g.getBlockByIndex(0).getMappedRows())}const h=this.setDropDownBindOptions(u.FUNCTION_TYPE,u,p);if(this._dropDownBindSource[e.trim()]=this._dropDownBindSource[e.trim()]||{},this._dropDownBindSource[e.trim()][t.trim()]=h,u.FUNCTION_TYPE==="F"){const g=this.getControlValue(e,t);g&&!((r=h==null?void 0:h.dataSource)!=null&&r.some(I=>I[h.dataValueField]===g))&&this.setControlEmptyValue(e,t)}else if(u.FUNCTION_TYPE==="G"||u.FUNCTION_TYPE==="P"){const g=this.getGridColumn(e,t);if(g!=null&&g.colDef){this.setGridColumnDropdown(e,g.colDef,p,(c=g.colDef.context)==null?void 0:c.valueField,(d=g.colDef.context)==null?void 0:d.textField,h.displayFormat);const I=this.getGridApi(e);I==null||I.refreshCells({columns:[g.colId]})}}this._dropDownRefreshKey[e][t]=i.guid()}}}createDataSet(){var a,l,r,c;const e=[];let t="";this._configInfo.TSI00GRIDVIEW.getMappedRows().forEach(d=>{var u,p,h;if(((u=d.TABLE_NAME)==null?void 0:u.trim().length)>0&&((p=d.DATASET_NAME)==null?void 0:p.trim().length)>0){const g={};d.FUNCTION_TYPE==="T"&&((h=d.CURRENT_NODE_DESC)==null?void 0:h.trim().length)>0&&d.FATHER_NODE_DESC.trim().length>0&&(g.hierarchy={primaryField:d.CURRENT_NODE_DESC.trim(),parentField:d.FATHER_NODE_DESC}),this.createDataTable(d.TABLE_NAME.trim(),g)&&e.push({tableName:d.TABLE_NAME.trim()}),t=d.DATASET_NAME.trim()}}),((r=(l=(a=this._configInfo)==null?void 0:a.TSI00DATARELATION)==null?void 0:l.getMappedRows())==null?void 0:r.length)>0&&this._configInfo.TSI00DATARELATION.getMappedRows().forEach(d=>{e.findIndex(u=>u.tableName===d.RESERVE1)>=0&&e.findIndex(u=>u.tableName===d.RESERVE7)>=0&&(this._formDataSet.relations[d.RELATION_NAME]=this._formDataSet.relations[d.RELATION_NAME]||[],this._formDataSet.relations[d.RELATION_NAME].push({ParentTable:d.RESERVE1,ChildTable:d.RESERVE7,ParentColumn:d.RESERVE2,ChildColumn:d.RESERVE8}))}),(c=this._formDataSet)==null||c.setName(t)}createDataTable(e,t){var r,c,d,u,p,h,g;let a;const l={...t};if(e.trim().length>0&&!this._formDataSet.dataTables[e.trim()]){const I={};((c=(r=this._configInfo.TSI00DATATABLE)==null?void 0:r.getMappedRows())==null?void 0:c.length)>0&&this._configInfo.TSI00DATATABLE.getMappedRows().forEach(b=>{if(b.TABLE_NAME===e.trim()){const S={name:b.COL_NAME,caption:b.COL_CAPTION,maxLength:b.MAX_LENGTH};switch(b.DATA_TYPE){case"2":S.type="number",S.defaultValue=i.toNumber(b.DEFAULT_VALUE);break;case"3":S.type="datetime",S.defaultValue=i.getDateTimeByString(b.DEFAULT_VALUE,"Dayjs");break;case"4":S.type="boolean",S.defaultValue=i.toBoolean(b.DEFAULT_VALUE);break;default:S.type="string",S.defaultValue=i.getSystemFormatString(b.DEFAULT_VALUE).trim();break}I[b.COL_NAME]=S}}),Object.keys(I).length>0&&(I[m.IdFieldName]={name:m.IdFieldName,type:"string"},l.schema=I,a=new j(l),this._formDataSet.addDataTable(e.trim(),a))}else a=(d=this._formDataSet)==null?void 0:d.dataTables[e.trim()],l.schema=(u=a==null?void 0:a.options)==null?void 0:u.schema,l.hierarchy=l.hierarchy||((p=a==null?void 0:a.options)==null?void 0:p.hierarchy);return(h=t==null?void 0:t.hierarchy)!=null&&h.primaryField&&((g=t==null?void 0:t.hierarchy)!=null&&g.parentField)&&(l.schema[t.hierarchy.primaryField]===void 0&&console.error(`ER: Hierarchy DataTable's PrimaryField [${t.hierarchy.primaryField}] not exists!`),l.schema[t.hierarchy.parentField]===void 0&&console.error(`ER: Hierarchy DataTable's ParentField [${t.hierarchy.parentField}] not exists!`)),a||console.error(`ER: DataTable [${e}] creation failed!`),a}getTableName(e){var t;return(t=this._formDataSet)==null?void 0:t.getTableName(e)}getBindingTableName(e){let t="";return e.trim().length>0&&this._formBindingRelation[e.trim()]&&(t=this._formBindingRelation[e.trim()]),t}setBindingTableName(e){var l;let t="";const a=this.getSingleViewConfigInfo(e.trim());return a&&a.TABLE_NAME&&a.TABLE_NAME.trim().length>0&&((l=this._formDataSet)!=null&&l.contains(a.TABLE_NAME.trim()))&&(t=a.TABLE_NAME.trim(),this._formBindingRelation[e]=t),t}getBindingTable(e){var l;let t;const a=this.getBindingTableName(e);return a&&a.trim().length>0&&(t=(l=this._formDataSet)==null?void 0:l.dataTables[a]),t}getBindingTableAsBlock(e){let t;const a=this.getBindingTable(e);return a&&a instanceof j&&(t=a.data(),t&&(t=this.convertDataType(t,a,"weakly"))),i.buildEiBlock(t||{},"Table0")}hasDataChange(...e){let t=!1;return e.length===0?e=Object.keys(this._formBindingRelation):e.length===1&&(e=e[0].split(",")),e.forEach(a=>{const l=this.getBindingTable(a);if(l&&l instanceof j)if(!t)t=l.hasChanges();else return t}),t}cancelGridChange(e){var a,l;const t=this.getGrid(e);if(t){const r=(l=(a=t.gridOptions)==null?void 0:a.context)==null?void 0:l.bindingSource;r&&r instanceof n.DataTable&&r.cancelChanges()}return this}mergeDataToLayoutOrGrid(e,t=!0,...a){var l,r,c,d;if(this.isNullOrEmpty(a)?a=Object.keys(this._formBindingRelation):a.length===1&&a[0]&&typeof a[0]=="string"&&(a=a[0].split(",")),a.length>0){if(a.length===1&&a[0].trim().length>0){const u=this.getBindingTableName(a[0]);(u==null?void 0:u.trim().length)>0&&(e instanceof Ze.EiBlock?(l=this._formDataSet)==null||l.mergeData(u.trim(),e.getMappedRows(),t):e instanceof Ze.EiInfo?e.getBlock(u.trim())?(r=this._formDataSet)==null||r.mergeData(u.trim(),e.getBlock(u.trim()).getMappedRows(),t):Object.keys(e).length>0&&((c=this._formDataSet)==null||c.mergeData(u.trim(),e.getBlockByIndex(0).getMappedRows(),t)):e instanceof Array&&e&&e.length>0&&((d=this._formDataSet)==null||d.mergeData(u.trim(),e,t)),this.autoBestFit(a[0]))}else if(e instanceof Ze.EiInfo){const u={};a.forEach(p=>{var g;const h=this.getBindingTableName(p);(h==null?void 0:h.trim().length)>0&&e.getBlock(h.trim())&&(u[h]||((g=this._formDataSet)==null||g.mergeData(h.trim(),e.getBlock(h.trim()).getMappedRows(),t),u[h]=!0),this.autoBestFit(p))})}}return this}checkFormChanged(...e){return new Promise(t=>{this.hasDataChange(...e)?this.messageConfirm(n.Core.$t("ERX.ContinueToOperate")||"是否继续操作?").then(a=>{t(a)}).catch(()=>{t(!1)}):t(!0)})}addRowToGrid(e,t=!0,a="default",l=!1){var d,u,p,h,g,I;let r;const c=this.getGrid(e);if((d=c==null?void 0:c.gridOptions.context)!=null&&d.bindingSource){let b={};a==="default"&&(a=this.getGridOptions(e,"insertAtTop")||"default"),a==="default"&&(a=((h=(p=(u=c==null?void 0:c.gridOptions)==null?void 0:u.context)==null?void 0:p.options)==null?void 0:h.insertAtTop)||"default");const S=this.getGridOptions(e,"autoGuidField");(t===!0||(t==null?void 0:t.setDefaultValue)===!0)&&(b=this.getGridConfigDefaultValues(e)||{}),this._customDefaultValues[e]&&(b={...b,...this._customDefaultValues[e]}),t!=null&&t.data&&(b={...b,...t.data});const M=(g=c.gridOptions.context)==null?void 0:g.bindingSource;if(a===!0||a==="top")r=M.insert(0,b,S);else if(a==="afterCurrent"||a==="beforeCurrent"){const D=this.getGridCurrentRow(e);if(D){let A=M.indexOf(D);A>=0&&A<M.rowCount&&a==="afterCurrent"?A=A+1:A>0&&a==="beforeCurrent"&&(A=A-1),r=M.insert(A,b,S)}else r=M.add(b,S)}else typeof a=="number"&&a>=0?r=M.insert(a,b,S):r=M.add(b,S);r[m.IdFieldName]=i.guid(),(I=c==null?void 0:c.gridOptions)!=null&&I.treeData&&(r[m.TreeHierarchyFieldName]=[r[m.IdFieldName]])}return r}addCopyRowToGrid(e,t="default",a=!1){var c,d,u;const l=this.getGrid(e);let r;if(l){t==="default"&&(t=this.getGridOptions(e,"insertAtTop")||"default"),t==="default"&&(t=((u=(d=(c=l==null?void 0:l.gridOptions)==null?void 0:c.context)==null?void 0:d.options)==null?void 0:u.insertAtTop)||"default"),(l==null?void 0:l.gridOptions.api).stopEditing();const h=this.getGridSelectRows(l);if(h.length===0){const g=this.getGridCurrentRow(l);g&&h.push(g)}if(h.length===0)r=[this.addRowToGrid(e,!0,t,a)];else{const g=this.getGridBindingTable(e);if(g){let I=-1;t==="top"||t===!0?I=0:t==="afterCurrent"||t==="default"?(I=g.indexOf(h[h.length-1]),I<g.rowCount&&(I=I+1)):t==="beforeCurrent"?(I=g.indexOf(h[0]),I>0&&(I=I-1)):typeof t=="number"&&t>=0&&(I=t),r=g.import(h,I,!0,this.getGridOptions(e,"autoGuidField"))}}}return r}importRowsToGrid(e,t,a=!1,l=!0){var d,u;let r;const c=this.getGrid(e);if((d=c==null?void 0:c.gridOptions.context)!=null&&d.bindingSource){c==null||c.gridOptions.api;const p=(u=c.gridOptions.context)==null?void 0:u.bindingSource;p&&(r=p.import(t,void 0,l))}return r}getGridAggregates(e){var a;let t;if(e){const l=this.getGrid(e);if(l){const r=l.gridOptions.api.getModel();t=(a=r==null?void 0:r.rootNode)==null?void 0:a.aggData}}return t}getModelFromGridOrLayout(e,t,a=!1,l){const r=this.getBindingTable(e);return this.getModelFromDataTable(r,t,a,l)}getModelFromGridOrLayoutAsBlock(e,t,a){const l=this.getModelFromGridOrLayout(e,t,!0,a);return this.buildEiBlock([l])}getModelFromDataTable(e,t,a=!1,l){let r;return typeof e=="string"&&e.trim().length>0&&(e=this.getBindingTable(e)),e&&e instanceof n.DataTable&&(t&&t.trim().length>0?r=e.get(t.trim()):(r=e.at(0),r=o.reactive(r))),r&&(a instanceof Function?r=a(r)||r.toJSON():r=a?r.toJSON():r,l&&Object.keys(l).forEach(c=>{r[c]=l[c]})),r}getGridDataCount(e){let t=0;const a=this.getGridConfigId(e);if(a){const l=this.getBindingTable(a);l&&l instanceof n.DataTable&&(t=l.totalCount())}return t}getModelFromDataTableById(e,t,a=!1){var r;let l;return typeof e=="string"&&e.trim().length>0&&this._formBindingRelation[e.trim()].trim().length>0&&(e=(r=this._formDataSet)==null?void 0:r.dataTables[this._formBindingRelation[e.trim()]]),e&&e instanceof j&&t&&t.trim().length>0&&(l=e.get(t.trim()),l&&(a instanceof Function?l=a(l)||l.toJSON():l=a?l.toJSON():l)),l}convertModelAsBlock(e,t){let a={};return e&&(a=e.toJSON(t)),this.buildEiBlock([a])}addModelToLayout(e,t,a){let l;if((e==null?void 0:e.trim().length)>0){const r=this.getBindingTable(e.trim());if(r){r instanceof j&&(l=r.add({}));const c=this.getRelationConfigIdsByTableName(r.tableName);t&&this.setModelDefalutValue(l,c),l=this.getLayoutBindModel(e)}else console.error("ER: Attempting to add model to a non-existent dataTable, configId: "+e)}return l}getDataFromDataTableAsEiBlock(e,t=0,a){let l;if(e){let c;typeof e=="string"?c=this.getBindingTable(e):c=e,c&&(l=e.at(t)),l=this.convertDataType([l],c,"weakly"),l={...l,...a}}return i.buildEiBlock(l||{},"Table0")}convertDataType(e,t,a){return i.convertDataType(e,t,a)}getModelFields(e){var t;return(t=e==null?void 0:e.options)==null?void 0:t.schema}getControlName(e,t,a){let l="antInput";switch(e){case"F1":case"G3":l="antInputGroup";break;case"FB":l="antRadioGroup";break;case"FJ":l="erRadioGroup";break;case"FK":l="erCheckboxGroup";break;case"F7":case"FA":case"FP":case"G1":case"GP":case"F6":case"FC":case"G2":l="erSelect";break;case"FD":l="erMultiSelect";break;case"F3":case"G4":case"GD":l="antMultiSelect";break;case"FL":l="erTreeSelect";break;case"FH":l="erMultiTreeSelect";break;case"F2":case"F9":case"FG":l="antInputNumber";break;case"F4":l="antCheckbox";break;case"FW":l="antSwitch";break;case"FM":l="scriptEditor";break;case"F5":i.toNumber(a==null?void 0:a.MAX_LENGTH)===2?l="antTimePicker":i.toNumber(a==null?void 0:a.MAX_LENGTH)===4?t.toLowerCase()==="hh:mm"?l="antTimePicker":l="antYearPicker":i.toNumber(a==null?void 0:a.MAX_LENGTH)===6?t.toLowerCase()==="hh:mm:ss"?l="antTimePicker":l="antMonthPicker":i.toNumber(a==null?void 0:a.MAX_LENGTH)===8?l="antDatePicker":l="antDateTimePicker";break;case"F8":case"G8":l="antTextarea";break;case"FE":case"G5":l="erMemoEditor";break;case"FN":l="antButton";break;case"FS":l="label";break;case"FT":l="antDivider";break;default:l="antInput";break}return l}resetValidator(e){let t=[];e&&(e instanceof Array?t=e:t=e.split(",")),t.length===0&&(t=this.getAllConfigIdArray());for(let a=0;a<t.length;a++){if(t[a].trim().length===0)continue;const l=this.getLayoutBindForm(t[a]);l==null||l.clearValidate()}}getLayoutLabelSpan(e,t){return i.jQuery("#"+this._formId+e+t+"_span")}getLayoutJqueryElement(e,t){let a;return a=i.jQuery("#"+this._formId+e+t),a===void 0&&(a=i.jQuery("#"+e)),a}autoBestFit(e){var a,l,r,c,d;const t=this.getGrid(e);if(t&&this.isGridOnScreen(t)){const u=(l=(a=t.gridOptions.columnApi)==null?void 0:a.columnModel)==null?void 0:l.gridColumns;(u==null?void 0:u.length)>0&&((d=(c=(r=e==null?void 0:e.gridOptions)==null?void 0:r.context)==null?void 0:c.viewConfig)==null?void 0:d.BESTFIT)==="1"&&u.forEach(p=>{p.visible&&!p.colDef.suppressSizeToFit&&t.gridOptions.columnApi.autoSizeColumn(p)})}return this}getGrid(e){var a,l;let t;return e&&typeof e=="string"&&this._gridInstanceInfo[e]!==void 0&&(e=this._gridInstanceInfo[e]),(a=e==null?void 0:e.gridOptions)!=null&&a.api&&((l=e==null?void 0:e.gridOptions)!=null&&l.columnApi)&&(t=e),t}getGridApi(e){var t,a;return(a=(t=this.getGrid(e))==null?void 0:t.gridOptions)==null?void 0:a.api}isGridOnScreen(e){const t=this.getGrid(e);return t?i.isGridOnScreen(t):!1}getGridColumnApi(e){var t,a;return(a=(t=this.getGrid(e))==null?void 0:t.gridOptions)==null?void 0:a.columnApi}getGridConfig(e){var t,a,l;return(l=(a=(t=this.getGrid(e))==null?void 0:t.gridOptions)==null?void 0:a.context)==null?void 0:l.viewConfig}getGridColumn(e,t){const a=this.getGrid(e);return i.getGridColumn(a,t)}getGridColumnDef(e,t){const a=this.getGrid(e);return i.getGridColumnDef(a,t)}showGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=t.split(","),l.length>0){const r=[];l.forEach(c=>{r.push({colId:c,hide:!1})}),a.gridOptions.columnApi.applyColumnState({state:r})}}return this}hideGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=t.split(","),l.length>0){const r=[];l.forEach(c=>{r.push({colId:c,hide:!0})}),a.gridOptions.columnApi.applyColumnState({state:r})}}return this}showGridCheckColumn(e){return this.showOrHideGridCheckColumn(e,"show")}hideGridCheckColumn(e){return this.showOrHideGridCheckColumn(e,"hide")}showOrHideGridCheckColumn(e,t="default"){var l,r,c,d;const a=this.getGrid(e);if((l=a==null?void 0:a.gridOptions)!=null&&l.api){const u=a.gridOptions.api,p=u.getColumnDef(m.GridCheckColumnFieldName);p&&(t==="hide"?(p.checkboxSelection=void 0,p.headerCheckboxSelection=void 0):(t==="show"||((r=a.gridOptions.context)==null?void 0:r.viewConfig.SHOW_SELECTION)==="1")&&(p.checkboxSelection=h=>!h.node.footer,this.getGridOptions((d=(c=a.gridOptions)==null?void 0:c.context)==null?void 0:d.configId,"RowSelection",!0)==="multiple"?p.headerCheckboxSelection=!0:p.headerCheckboxSelection=void 0),u.redrawRows(),u.refreshHeader())}return this}setGridSelectMode(e,t,a="none"){var r,c;const l=this.getGrid(e);return l&&(this.setGridOptions((c=(r=l.gridOptions)==null?void 0:r.context)==null?void 0:c.configId,"RowSelection",t,!0),this.setGridColumnOptions(l,d=>{var u;d.colId===m.GridCheckColumnFieldName&&(a==="show"||a==="hide"||t==="multiple")&&(a==="hide"?(d.checkboxSelection=void 0,d.headerCheckboxSelection=void 0):t==="multiple"?(d.checkboxSelection=p=>!p.node.footer,d.headerCheckboxSelection=a==="show"||((u=l.gridOptions.context)==null?void 0:u.viewConfig.SHOW_SELECTION)==="1"):t==="single"&&(d.headerCheckboxSelection=void 0))})),this}setGridRowDrag(e,t="default"){var l,r,c,d;const a=this.getGrid(e);if((l=a==null?void 0:a.gridOptions)!=null&&l.api){const p=a.gridOptions.api.getColumnDef(m.GridCheckColumnFieldName);p&&(t===!1?(p.rowDrag=void 0,(r=a==null?void 0:a.gridOptions)==null||r.columnApi.setColumnWidth(p.colId,55)):(t===!0||(c=a.gridOptions.context)!=null&&c.allowDragRow)&&(a.gridOptions.context.allowDragRow=!0,(d=a==null?void 0:a.gridOptions)==null||d.columnApi.setColumnWidth(p.colId,75),p.rowDrag=h=>{var g;return((g=h.context)==null?void 0:g.allowDragRow)&&!h.node.group&&!h.node.footer}),a.gridOptions.rowDragManaged=t),a.gridOptions.api.redrawRows()}return this}addGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=[t],l.length>0){const r=a.gridOptions.context.bindingSource,c=a.gridOptions.api.getColumnDefs()||[];l.forEach(d=>{var u;if(((u=d.field)==null?void 0:u.trim().length)>0){d.field=d.field.trim();const p={name:d.field,capiton:d.headerName,defaultValue:d.defaultValue,type:d.dataType||d.type||"string",maxLength:d.maxLength||-1};r.addField(p),d.colId=d.colId||d.field,a.gridOptions.api.getColumnDef(d.colId)||(d.headerComponentParams={template:`${this.getGridHeaderTemplate({color:d.headerTextColor,backColor:d.headerBackColor,fontSize:d.fontSize,title:d.headerName||d.title||d.caption})}`},d.headerClass=()=>{var g,I,b,S,M;let h="er-grid-header-align-center";return((g=d.headerAlignment)==null?void 0:g.toLowerCase())==="near"||((I=d.headerAlignment)==null?void 0:I.toLowerCase())==="left"?h="er-grid-header-align-left":(((b=d.headerAlignment)==null?void 0:b.toLowerCase())==="far"||((S=d.headerAlignment)==null?void 0:S.toLowerCase())==="right")&&(h="er-grid-header-align-right"),d.required&&((M=d.requiredCondition)==null?void 0:M.trim().length)>0?h=h+" er-grid-header-maroon-star":d.required&&(h=h+" er-grid-header-red-star"),h},d.editable=d.editable===void 0?!0:d.editable,d.autoHeaderHeight=d.autoHeaderHeight===void 0?!0:d.autoHeaderHeight,d.enableRowGroup=d.enableRowGroup===void 0?!0:d.enableRowGroup,typeof d.editable!="function"&&(d.context=d.context||{},d.context.editable=d.editable,d.headerTooltip=d.headerName||d.title||d.caption,d.editable=h=>{var g,I;return((g=h.context)==null?void 0:g.editable)&&((I=h.colDef.context)==null?void 0:I.editable)&&!h.node.rowPinned}),d.filter=d.filter===void 0?"agSetColumnFilter":d.filter,d.filterParams={excelMode:"windows"},c.push(d))}}),a.gridOptions.api.setColumnDefs(c)}}return this}removeGridColumn(e,t){const a=this.getGrid(e);if(a){let l;if(t instanceof Array?l=t:l=t.split(","),l.length>0){let r=a.gridOptions.api.getColumnDefs()||[];r=r.filter(c=>!l.includes(c.colId)),a.gridOptions.api.setColumnDefs(r)}}return this}getGridColumnFields(e,t="string"){var r,c,d;const a=this.getGrid(e);let l=t==="Array"?[]:void 0;if((c=(r=a==null?void 0:a.gridOptions)==null?void 0:r.context)!=null&&c.configId){const u=this.getConfigInfo(a.gridOptions.context.configId);((d=u==null?void 0:u.TSI00GRIDCOLUMN)==null?void 0:d.length)>0&&u.TSI00GRIDCOLUMN.forEach(p=>{p.FIELD_NAME.trim().length>0&&p.UNBOUND_TYPE==="0"&&(t==="Array"?l.push(p.FIELD_NAME.trim()):l=l?l+","+p.FIELD_NAME.trim():p.FIELD_NAME.trim())})}return l}setGridEnable(e,t){var l,r,c;const a=this.getGrid(e);return(l=a==null?void 0:a.gridOptions)!=null&&l.context&&(a.gridOptions.api.stopEditing(),a.gridOptions.context.enable=t,(c=(r=a==null?void 0:a.gridOptions)==null?void 0:r.context)!=null&&c.configId&&(this.setGridOptions(a.gridOptions.context.configId,"enable",t,!0),document.querySelectorAll(".ag-full-width-row").forEach(u=>{u.style!==void 0&&(t?u.style.pointerEvents="all":u.style.pointerEvents="none")}))),this}setGridEditable(e,t){var l,r,c;const a=this.getGrid(e);return(l=a==null?void 0:a.gridOptions)!=null&&l.context&&(a.gridOptions.api.stopEditing(),a.gridOptions.context.editable=t,(c=(r=a==null?void 0:a.gridOptions)==null?void 0:r.context)!=null&&c.configId&&this.setGridOptions(a.gridOptions.context.configId,"editable",t,!0)),this}setGridIndicator(e,t,a){if(e&&t&&Object.keys(t).length>0){const l=this.getGrid(e);setTimeout(()=>{var r,c,d,u,p,h,g;if((r=l==null?void 0:l.gridOptions)!=null&&r.api&&((d=(c=l==null?void 0:l.gridOptions)==null?void 0:c.context)!=null&&d.bindingSource)){const I=(u=l==null?void 0:l.gridOptions)==null?void 0:u.api,S=((h=(p=l==null?void 0:l.gridOptions)==null?void 0:p.context)==null?void 0:h.bindingSource).data().find(M=>{for(const D in t)if(M[D]!==t[D])return!1;return!0});if(S!=null&&S.uid){I.clearFocusedCell();const M=(g=l==null?void 0:l.gridOptions)==null?void 0:g.api.getRowNode(S==null?void 0:S.uid);M&&this.setGridFocusedCell(e,M.rowIndex,n.SysInfo.GridCheckColumnFieldName,a)}}},250)}return this}refreshGridFooterData(e){var a,l,r;const t=this.getGrid(e);if((a=t==null?void 0:t.gridOptions)!=null&&a.api){const c=(l=t==null?void 0:t.gridOptions)==null?void 0:l.api;if(c.getPinnedBottomRowCount()>0){c.refreshClientSideRowModel("aggregate");const d=c.getModel();c.setPinnedBottomRowData([{...(r=d==null?void 0:d.rootNode)==null?void 0:r.aggData,pinndeRowType:"ErGridSummaryFooter"}])}}return this}setLayoutConfigRelationInfo(e,t){return this._layoutConfigRelationInfo[t]=e,this}getConfigIdbyLayoutName(e){return this._layoutConfigRelationInfo[e]&&this._layoutConfigRelationInfo[e].trim().length>0?this._layoutConfigRelationInfo[e].trim():e}getGridConfigId(e){let t="";return e&&(typeof e=="string"&&this._gridInstanceInfo[e]!==void 0?t=e:e.gridOptions&&e.gridOptions.api&&(t=e.gridOptions.gridId)),t}setWidgetInstanceInfo(e,t,a){return this.isNullOrEmpty(e)||(this._widgetInstanceInfo[e.trim()]===void 0&&(this._widgetInstanceInfo[e.trim()]={}),!this.isNullOrEmpty(t)&&a&&(this._widgetInstanceInfo[e.trim()][t.trim()]=a)),this}setControlVisible(e,t,a,l="none"){return!this.isNullOrEmpty(e)&&(a==null?void 0:a.trim().length)>0&&(e=this.getConfigIdbyLayoutName(e),a.split(",").forEach(c=>{c.trim().length>0&&(l==="empty"?this.setControlEmptyValue(e,c):l==="default"&&this.setControlDefalutValue(e,c),this.setLayoutItemOption(e,c.trim(),{visible:t}))})),this}setGridColumnTitle(e,t){if((t==null?void 0:t.length)>0){const a=this.getGrid(e);a&&(t.forEach(l=>{var c;const r=a.gridOptions.columnApi.getColumn(l.colId);if(r!=null&&r.colDef){const d=((c=r.colDef.context)==null?void 0:c.titleInfo)||{};r.colDef.headerComponentParams={template:`${this.getGridHeaderTemplate({...d,...l})}`}}}),a.gridOptions.api.refreshHeader())}return this}setGridColumnOptions(e,t){if(e&&t instanceof Function){const a=this.getGrid(e);if(a){const l=a.gridOptions.api.getColumnDefs();l.forEach(r=>{t(r)}),a.gridOptions.api.setColumnDefs(l)}}return this}setGridOptions(e,t,a,l=!1){return e=(e==null?void 0:e.trim())||"",t=(t==null?void 0:t.trim())||"",e.length>0&&t.length>0&&(l?(this._gridReactiveOptions[e]=this._gridReactiveOptions[e]||{},this._gridReactiveOptions[e][t]=a):(this._gridOptions[e]=this._gridOptions[e]||{},this._gridOptions[e][t]=a)),this}getGridOptions(e,t,a=!1){if(e=(e==null?void 0:e.trim())||"",t=(t==null?void 0:t.trim())||"",e.length>0&&t.length>0){if(a&&this._gridReactiveOptions[e])return this._gridReactiveOptions[e][t];if(!a&&this._gridOptions[e])return this._gridOptions[e][t]}}getLayoutExtentedOptions(e){var r,c;let t={};const a=this.getFormSysInfo("LayoutDefaultOptions");a.trim().length>0&&(t={...JSON.parse(a)});const l=this.getConfigInfo(e);if(((r=l==null?void 0:l.TSI00GRIDVIEW)==null?void 0:r.length)>0){const d=l.TSI00GRIDVIEW[0];if(((c=d.EXT_OPTIONS)==null?void 0:c.trim().length)>0){const u=JSON.parse(d.EXT_OPTIONS);t={...t,...u}}}return t}getGridExtentedOptions(e){var r,c;let t={};const a=this.getFormSysInfo("GridDefaultOptions");a.trim().length>0&&(t={...JSON.parse(a)});const l=this.getConfigInfo(e);if(((r=l==null?void 0:l.TSI00GRIDVIEW)==null?void 0:r.length)>0){const d=l.TSI00GRIDVIEW[0];if(((c=d.EXT_OPTIONS)==null?void 0:c.trim().length)>0){const u=JSON.parse(d.EXT_OPTIONS);t={...t,...u}}}return t}getDetailGridRenderOptions(e,t,a,l){const r=this.getGridConfigOptions(e,t,a,l);return{context:r==null?void 0:r.context,defaultColDef:r==null?void 0:r.defaultColDef,groupDisplayType:r==null?void 0:r.groupDisplayType,columnDefs:r==null?void 0:r.columnDefs,groupIncludeTotalFooter:r==null?void 0:r.groupIncludeTotalFooter,groupIncludeFooter:r==null?void 0:r.groupIncludeFooter,suppressRowClickSelection:r==null?void 0:r.suppressRowClickSelection,rowSelection:r==null?void 0:r.rowSelection,groupRowRendererParams:r==null?void 0:r.groupRowRendererParams,localeText:Ro(),enableRangeSelection:!0,stopEditingWhenCellsLoseFocus:!0,suppressRowTransform:!0,enableRtl:_o(),statusBar:{statusPanels:[{statusPanel:"agAggregationComponent",align:"center"},{statusPanel:"agTotalAndFilteredRowCountComponent",align:"right"}]},getRowId:d=>d.data.uid,getRowStyle:d=>this.getRowStyle(d,{showDefaultFooter:!0}),getMainMenuItems:d=>this.getGridMenuItems(d),getContextMenuItems:d=>this.getGridContextMenuItems(d),onGridReady:d=>d.api.setPopupParent(document.querySelector("body")),onRowSelected:d=>this.processRowSelectedEvent(d)}}getGridEditable(e){var a,l;const t=this.getGrid(e);return((l=(a=t==null?void 0:t.gridOptions)==null?void 0:a.context)==null?void 0:l.editable)===!0}getControl(e,t,a){let l;if(this._widgetInstanceInfo[e.trim()]&&this._widgetInstanceInfo[e.trim()][t.trim()]&&(l=this._widgetInstanceInfo[e.trim()][t.trim()]),l==null)if(a&&a.trim().length>0)l=i.jQuery("#"+this._formId+e+t);else{const r=this.getSingleItemConfigInfo(e,t);if(r.FUNCTION_TYPE&&r.COLUMN_EDIT){const c=r.FUNCTION_TYPE+r.COLUMN_EDIT;a=this.getControlName(c,r.FORMAT_STRING),l=i.jQuery("#"+this._formId+e+t)}}return l}isControlEmptyValue(e,t,a){let l=!0;const r=this.getControlValue(e,t),c=Object.keys(r);for(let d=0;d<c.length;d++)if(r[c[d]]!==null&&String(r[c[d]]).trim().length>0){l=!1;break}return l}setControlConditionProps(e,t,a="ReadOnly",l,r){if(a=(a==null?void 0:a.trim())||"ReadOnly",(e==null?void 0:e.trim().length)>0){const c=e.trim()+"_"+a+"_"+(t==null?void 0:t.trim());let d=[];if(this._controlConditionProps[c])d=this._controlConditionProps[c];else if(this._configInfo.TSI00GRIDCONDITION&&this._configInfo.TSI00GRIDCONDITION.getMappedRows().length>0){const u=this.getSingleViewConfigInfo(e==null?void 0:e.trim());if(u)for(let p=0;p<this._configInfo.TSI00GRIDCONDITION.getMappedRows().length;p++){const h=this._configInfo.TSI00GRIDCONDITION.data[p];if(i.toString(h.FUNCTION_ID,!0)!==e||(t==null?void 0:t.trim().length)>0&&i.toString(h.OPERATE_NAME,!0)!==(t==null?void 0:t.trim())||u.MATCH_FLAG==="1"&&i.toString(h.COMPANY_CODE,!0)!==m.CompanyCode||i.toString(h.FIELD_NAME_ARRAY,!0).length===0)continue;const g=i.toString(h.FIELD_NAME_ARRAY,!0).split(",");h.FIELD_NAME_ARRAY=g,d.push(h)}}if(d.length>0){this._controlConditionProps[c]=d;const u=this.getAllControlValue(e);d.forEach(p=>{const h=p.FIELD_NAME_ARRAY;let g=l??p.PROP_VALUE??"default";h.forEach(I=>{if(I&&!(r!=null&&r.includes(I))){const b=i.toString(p.REGULAR_EXPRESS,!0),S=b.length===0||b.replaceAll(" ","")==="1=1"||i.checkExpressionValid(u,i.getSystemFormatString(b));g=g==!0||g==="1"||i.toString(g).toLowerCase()==="true",a==="ReadOnly"&&this.setControlReadOnly(e,S?g:"default",I)}})})}}return this}getControlValue(e,t){let a,l;if(e.trim().length>0&&t.trim().length>0){const r=t.split(",");r.length>1&&(l={});const c=this.getLayoutBindModel(e);if(c)for(let d=0;d<r.length;d++){const u=r[d].trim();if(a=null,u.length===0)continue;const p=this.getLayoutItemOption(e,u,"controlType"),h=this.getLayoutItemOption(e,u,"field");(h==null?void 0:h.trim().length)>0?a=c[h.trim()]:this._hiddenFields[e.trim()]?a=this._hiddenFields[e.trim()][u]||"":a=c[u],["antInput","antInputGroup","antTextarea","erSelect","erTreeSelect","erMemoEditor"].includes(p)?a=a||"":p==="antInputNumber"&&a==null&&(a=0),r.length>1?l[u]=a:l=a}}return l}getControlText(e,t){let a,l;if(e.trim().length>0&&t.trim().length>0){const r=t.split(",");r.length>1&&(l={});const c=this.getLayoutBindModel(e);if(c)for(let d=0;d<r.length;d++){const u=r[d].trim();if(a=null,u.length===0)continue;const p=this.getLayoutItemOption(e,u,"field"),h=this.getLayoutItemOption(e,u,"controlType"),g=this.getLayoutItemOption(e,u,"format");(p==null?void 0:p.trim().length)>0?a=c[p.trim()]:this._hiddenFields[e.trim()]?a=this._hiddenFields[e.trim()][u]||"":a=c[u],["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect"].includes(h)?a=this.getDropDownSelectedText(e,u,a):h==="antDateTimePicker"||h==="antDatePicker"||h==="antMonthPicker"||h==="antYearPicker"?a=i.toDateTime(a,"Dayjs").format(g||"YYYY-MM-DD"):h==="antInputNumber"&&(a=n.Core.formatNumberValue(a,g)),r.length>1?l[u]=a:l=a}}return l}setControlValue(e,t,a){if(i.isNullOrEmpty(e)||i.isNullOrEmpty(t))return this;if(a===void 0&&(a=null),(e==null?void 0:e.trim().length)>0&&(t==null?void 0:t.trim().length)>0){const l=this.getLayoutBindModel(e==null?void 0:e.trim()),r=this.getLayoutItemOption(e,t,"controlType"),c=this.getLayoutItemOption(e,t,"field")||(t==null?void 0:t.trim());if(l&&c&&(["antMultiSelect","erMultiSelect"].includes(r)?a!==null?a instanceof Array?l==null||l.set(c,a,e):typeof a=="string"&&(l==null||l.set(c,a.split(","),e)):l==null||l.set(c,[],e):a!==null&&(r!=null&&r.startsWith("antCheckbox")||r!=null&&r.startsWith("antSwitch"))?l==null||l.set(c,i.toString(a)==="1"||i.toString(a).toLowerCase()==="true",e):a!==null&&(r!=null&&r.startsWith("antDate"))?l==null||l.set(c,i.toDateTime(a,"Dayjs"),e):l==null||l.set(c,a,e)),this._layoutConditionStyleInfo[e]){const d=this._layoutConditionStyleInfo[e];Object.keys(d).forEach(u=>{var p,h;(u===t||((h=(p=d[u])==null?void 0:p.condition)==null?void 0:h.indexOf(t))>-1)&&this.setLayoutConditionStyle(e,u)})}}return this}setControlValueEx(e,t,...a){const l=Object.keys(t);return(l==null?void 0:l.length)>0&&(a.length===1&&(a=a[0].split(",")),a.length>0?a.forEach(r=>{(t==null?void 0:t[r])!==void 0&&this.setControlValue(e,r,t[r])}):l.forEach(r=>{(t==null?void 0:t[r])!==void 0&&this.setControlValue(e,r,t[r])})),this}setControlCss(e,t,a){if((e==null?void 0:e.trim().length)>0&&(a==null?void 0:a.length)>0){let l;t instanceof Array?l=t:l=t.split(","),l&&l.length>0&&l.forEach(r=>{if(r.trim().length>0){const c=this.getLayoutItemOption(e,r,"controlType");let d=document.getElementsByName(this.FormId+e+r);if((d==null?void 0:d.length)>0){let u;switch(c){case"erSelect":case"erMultiSelect":case"antMultiSelect":case"erTreeSelect":case"erMultiTreeSelect":u=d[0].getElementsByClassName("ant-select-selector");break;case"antInput":case"antInputNumber":u=document.getElementById(this.FormId+e+r);break;case"antDateTimePicker":case"antDatePicker":case"antMonthPicker":case"antYearPicker":u=d[0].getElementsByClassName("ant-picker-input");break}a.forEach(p=>{(u==null?void 0:u.length)>0?p.value!==void 0&&n.Core.jQuery(u).css(p.property,p.value):p.value!==void 0&&n.Core.jQuery(d).css(p.property,p.value)})}else d=document.getElementById(this.FormId+e+r),d&&a.forEach(u=>{u.value!==void 0&&n.Core.jQuery(d).css(u.property,u.value)})}})}return this}setModelDefalutValue(e,t,a,l){let r;return t instanceof Array?r=t:r=t.split(","),a&&a.trim().length>0?r.forEach(c=>{if(c=this.getConfigIdbyLayoutName(c),e&&a&&e.schemaFields&&e.schemaFields[a]){const d=this.getSingleItemConfigInfo(c,a);let u=null;d.DEFAULT_VALUE&&d.DEFAULT_VALUE.trim().length>0?u=d.DEFAULT_VALUE:this._customDefaultValues[c]&&this._customDefaultValues[c][a]!==void 0?u=this._customDefaultValues[c][a]:l&&(u=l),u&&u.trim().length>0&&e.schemaFields[a].type&&(e.schemaFields[a].type==="datetime"?e.set(a,i.getDateTimeByString(u),c):e.schemaFields[a].type==="boolean"?e.set(a,u==="1"||u.toLowerCase()==="true",c):e.schemaFields[a].type==="number"?e.set(a,u,c):e.set(a,this.getDefaultStringValue(u),c),this.setControlValue(c,a,e[a]))}}):r.forEach(c=>{c=this.getConfigIdbyLayoutName(c);const d=this.getConfigInfo(c);d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(u=>{let p=null;if(a=u.ITEM_CODE,e&&a&&e.schemaFields&&e.schemaFields[a]){const h=this.getSingleItemConfigInfo(c,a);h.DEFAULT_VALUE&&h.DEFAULT_VALUE.trim().length>0?p=h.DEFAULT_VALUE:this._customDefaultValues[c]&&this._customDefaultValues[c][a]!==void 0?p=this._customDefaultValues[c][a]:l&&(p=l),p&&p.trim().length>0&&e.schemaFields[a].type&&(e.schemaFields[a].type==="datetime"?e.set(a,i.getDateTimeByString(p)):e.schemaFields[a].type==="boolean"?e.set(a,p==="1"||p.toLowerCase()==="true"):e.schemaFields[a].type==="number"?e.set(a,p):e.set(a,this.getDefaultStringValue(p)),this.setControlValue(c,a,e[a]))}})}),this}setModelValue(e,t,...a){return i.setModelValue(e,t,...a),this}setModelEmptyValue(e,...t){return t.length===1&&(t=t[0].split(",")),t.length>0?t.forEach(a=>{e&&e[a]!==void 0&&e.set(a,null)}):e.schemaFields&&Object.keys(e.schemaFields).forEach(a=>{e.set(a,null)}),this}setControlReadOnlyEx(e,t){return t&&Object.keys(t).forEach(a=>{this.setControlReadOnly(e,t[a],a)}),this}setControlReadOnly(e,t,...a){if(i.isNullOrEmpty(e))return this;a.length===1&&(a=a[0].split(",")),e=this.getConfigIdbyLayoutName(e);for(const l of a){const r=this.getSingleItemConfigInfo(e,l);let c=!0,d=!1;r.FUNCTION_TYPE&&r.COLUMN_EDIT&&(t!=="default"&&!t&&r.READ_ONLY==="1"&&(r.COLUMN_EDIT!=="1"||r.ALLOW_EDIT!=="1")||(t==="default"?(d=r.READ_ONLY==="1"||r.FUNCTION_TYPE!=="F"&&r.ALLOW_EDIT!=="1",c=r.ALLOW_EDIT==="1"):(d=t,c=!d),this.setLayoutItemOption(e,l,{readOnly:d}),r.COLUMN_EDIT==="1"&&this.setLayoutItemOption(e,l,{buttonEnable:c})))}return this}setAllControlReadOnly(e,t){let a;return e instanceof Array?a=e:a=e.split(","),a&&a.length>0&&a.forEach(l=>{if(l.trim().length>0){const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{this.setControlReadOnly(l.trim(),t,c.ITEM_CODE)})}}),this}setControlEnable(e,t,...a){if(i.isNullOrEmpty(e))return this;a.length===1&&(a=a[0].split(",")),e=this.getConfigIdbyLayoutName(e);for(const l of a){const r=this.getSingleItemConfigInfo(e,l);let c=!0;r.FUNCTION_TYPE&&r.COLUMN_EDIT&&(t==="default"?c=r.ALLOW_EDIT==="1":c=t,this.setLayoutItemOption(e,l,{allowEdit:c}),r.COLUMN_EDIT==="1"&&this.setLayoutItemOption(e,l,{buttonEnable:c}))}return this}setAllControlEnable(e,t){let a;return e instanceof Array?a=e:a=e.split(","),a&&a.length>0&&a.forEach(l=>{if(l.trim().length>0){const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{this.setControlEnable(l.trim(),t,c.ITEM_CODE)})}}),this}setControlEmptyValue(e,...t){if(t.length===1&&(t=t[0].split(",")),!t||t.length===0){const a=this.getConfigInfo(e);a.TSI00GRIDVIEW&&a.TSI00GRIDVIEW.length>0&&a.TSI00GRIDVIEW[0].FUNCTION_TYPE==="F"&&a.TSI00GRIDCOLUMN&&a.TSI00GRIDCOLUMN.forEach(l=>{this.setControlValue(e,l.ITEM_CODE,null)})}else t.forEach(a=>{this.setControlValue(e,a,null)});return this}setAllControlDefalutValue(e,t=!1){let a;return e instanceof Array?a=e:a=e.split(","),a.length>0&&a.forEach(l=>{if(l.trim().length>0){const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{var d;((d=c.DEFAULT_VALUE)==null?void 0:d.trim().length)>0?this.setControlDefalutValue(l.trim(),c.ITEM_CODE,t):t||this.setControlEmptyValue(l,c.ITEM_CODE)})}}),this}setControlDefalutValue(e,t,a=!1){var l,r;if(i.isNullOrEmpty(e)||i.isNullOrEmpty(t))return this;if(e=this.getConfigIdbyLayoutName(e),(e==null?void 0:e.trim().length)>0){const c=this.getLayoutBindModel(e),d=this.getSingleItemConfigInfo(e,t),u=((l=this.getLayoutItemOption(e.trim(),t,"field"))==null?void 0:l.value)||t.trim(),p=c==null?void 0:c.get(u==null?void 0:u.trim());if(p!=null&&a)return this;const h=i.toString(d.DEFAULT_VALUE,!0);if(c&&h.length>0){let g=this.getDefaultStringValue(h),I=null;const b=this.getLayoutItemOption(e.trim(),t,"controlType");if(["antMultiSelect","erMultiSelect","erSelect","erTreeSelect","erMultiTreeSelect","antRadioGroup","erRadioGroup","erCheckboxGroup"].includes(b)&&["$FIRST_ROW$","$LAST_ROW$","$ALL_VALUES$"].includes(h)&&this._dropDownBindSource[e]&&this._dropDownBindSource[e][t]){const S=this._dropDownBindSource[e][t];((r=S.dataSource)==null?void 0:r.length)>0&&S.dataValueField&&(h==="$FIRST_ROW$"?g=S.dataSource[0][S.dataValueField]:h==="$LAST_ROW$"?g=S.dataSource[S.dataSource.length-1][S.dataValueField]:["antMultiSelect","erMultiSelect"].includes(b)&&h==="$ALL_VALUES$"&&(g="",S.dataSource.forEach(M=>{g=g.length===0?M[S.dataValueField]:g+","+M[S.dataValueField]})))}["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(b)?I=i.getDateTimeByString(g):b==="antInputNumber"?I=i.toNumber(g):["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(b)?I=g.split(","):b==="antCheckbox"||b==="antSwitch"?I=g==="1"||g.toLowerCase()==="true":I=g,this.setControlValue(e,t,I)}}return this}getFormButtonConfigInfo(e){let t={},a=[];return this._configInfo.TSI00FORMBUTTON&&this._configInfo.TSI00FORMBUTTON.getMappedRows().length>0&&(a=this._configInfo.TSI00FORMBUTTON.getMappedRows(),a.length>0&&a.every((l,r)=>l.BUTTON_NAME===e?(t=l,!1):!0)),t}getSystemGlobalOptions(){let e={};const t=this.getFormSysInfo("SystemGlobalOptions");return t.trim().length>0&&(e=JSON.parse(t)),e}getFormExtentedOptions(){var a,l;let e={};const t=this.getFormSysInfo("FormDefaultOptions");if(t.trim().length>0&&(e={...JSON.parse(t)}),((a=this._configInfo.TSI00FORM)==null?void 0:a.length)>0){const r=this._configInfo.TSI00FORM[0];if(((l=r.EXT_OPTIONS)==null?void 0:l.trim().length)>0){const c=JSON.parse(r.EXT_OPTIONS);e={...e,...c}}}return e}resetLayout(e){let t;return e instanceof Array?t=e:t=e.split(","),t.length>0&&t.forEach(a=>{if(a.trim().length>0){const l=this.getConfigInfo(a.trim());l.TSI00GRIDVIEW&&l.TSI00GRIDCOLUMN&&l.TSI00GRIDCOLUMN.forEach(r=>{r.DEFAULT_VALUE&&r.DEFAULT_VALUE.trim().length>0?this.setControlDefalutValue(a.trim(),r.ITEM_CODE):this.setControlValue(a.trim(),r.ITEM_CODE,null)})}}),this}getAllControlValue(e,t){const a={};return(e instanceof Array?e:e.split(",")).forEach(r=>{if((r==null?void 0:r.trim().length)>0){const c=this.getLayoutBindModel(r.trim());if(c){const d=this.getConfigInfo(r.trim());d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(u=>{const p=this.getLayoutItemOption(r,u.ITEM_CODE,"controlType"),h=this.getLayoutItemOption(r,u.ITEM_CODE,"field")||u.ITEM_CODE,g=i.toNumber(u.MAX_LENGTH);if(h){let I=c[h];if(p==="antCheckbox"||p==="antSwitch")I=I===!0?"1":"0";else if(p==="antInputNumber")I=I||0;else if(["antDatePicker","antDateTimePicker","antMonthPicker","antYearPicker"].includes(p)&&I){const b=i.toString(u.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss",S=i.getDateTimeFormatString(I,b);S.substring(0,4)==="0001"||S.substring(0,4)==="1900"||S.substring(0,4)==="1901"?I="":(I=S,g>0&&g<I.length&&(I=I.substring(0,g)))}else["antMultiSelect","erMultiSelect","erCheckboxGroup"].includes(p)&&I&&I instanceof Array?I=I.join(","):I=I||"";a[h]=I}})}}}),t&&Object.keys(t).length>0&&Object.keys(t).forEach(r=>{a[r]=t[r]}),a}getAllControlValueAsEiBlock(e,t,a){const l=this.getAllControlValue(e,t);let r=e;e instanceof Array&&(r=e[0]);const c=this.getLayoutExtentedOptions(r);return c!=null&&c.blockName&&(a=c.blockName),(a==null?void 0:a.trim().length)===0&&r.includes("Filter")&&(a="inqu_status"),i.buildEiBlock([l],a||"Table0")}getAllControlValueAsFilter(e,t){let a=i.buildEiBlock(void 0,"Table0");const l=[];return(e instanceof Array?e:e.split(",")).forEach(c=>{const d=this.getConfigInfo(c);d.TSI00GRIDVIEW&&d.TSI00GRIDCOLUMN&&d.TSI00GRIDCOLUMN.forEach(u=>{if(u.OPERATOR.trim().length>0&&u.OPERATOR.trim()!=="None"&&u.PARA_GROUP.trim().length>0&&u.PARA_GROUP.trim()!=="None"){const p=this.getLayoutItemOption(c,u.ITEM_CODE,"controlType"),h={};t&&Object.keys(t).length>0?Object.keys(t).forEach(S=>{h[S]=t[S]}):h.QUERY_TYPE="",h.COMPANY_CODE=u.COMPANY_CODE,h.FORM_NAME=u.FORM_NAME,h.FUNCTION_ID=u.FUNCTION_ID,h.ITEM_CODE=i.toString(u.ITEM_CODE,!0,"toLower"),h.ORIGIN_CODE=u.ORIGIN_CODE,h.TABLE_NAME=u.TABLE_NAME,h.FIELD_NAME=i.toString(u.PARA_NAME,!0,"toLower"),h.OPERATOR=u.OPERATOR,h.PARA_GROUP=u.PARA_GROUP,h.SQL_CONTENT=u.SQL_CONTENT,h.OP_VALUE=null,h.DATA_TYPE="String";const g=i.toString(h.PARA_GROUP,!0),I=i.toString(h.OPERATOR,!0);let b=this.getControlValue(c,u.ITEM_CODE)||"";if(I.length>0)switch(p){case"antRadioGroup":case"erRadioGroup":case"erSelect":case"erTreeSelect":{h.OP_VALUE=b,h.ORIGIN_CODE==="4"&&u.SVC_NAME.trim().length>0&&h.OP_VALUE.trim().length>0&&h.OPERATOR==="SQL"&&(h.ORIGIN_CODE="SIU",h.SQL_CONTENT=this.getFormCodeSetFilter(u.SVC_NAME,h.OP_VALUE)),(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h);break}case"antInputNumber":{h.DATA_TYPE="Decimal",h.OP_VALUE=b,h.OP_VALUE===null&&(h.OP_VALUE=0),(g==="2"||i.toNumber(h.OP_VALUE)!==0)&&l.push(h);break}case"antCheckbox":case"antSwitch":{h.OPERATOR="=",h.OP_VALUE=b===!0?"1":b===!1?"0":"",(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":case"erMultiTreeSelect":{h.OPERATOR="IN",b&&b instanceof Array&&b.length>0?b="'"+b.join("','")+"'":b="",h.OP_VALUE=b,(g==="2"||b.length>0)&&l.push(h);break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{if(b){const S=i.toString(u.DATE_TIME_FORMAT,!0)||"yyyyMMddHHmmss";h.OP_VALUE=i.getDateTimeFormatString(b,S),h.OP_VALUE.length>=4&&(h.OP_VALUE.substring(0,4)==="0001"||h.OP_VALUE.substring(0,4)==="1900")&&(h.OP_VALUE=""),(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h)}break}default:{i.toString(b,!0).length>0&&I==="IN"&&(b="'"+b.split(/\n|\t|,|,/).join("','")+"'"),h.OP_VALUE=b,(g==="2"||h.OP_VALUE.trim().length>0)&&l.push(h);break}}}})}),l.length>0&&(a=i.buildEiBlock(l,"QUERY_FILTER")),a}expandLayoutGroup(e){let t=[];e&&(e instanceof Array?t=e:t=e.split(",")),t.length===0&&(t=this.getAllConfigIdArray());for(let a=0;a<t.length;a++)if(t[a].trim().length>0){const l=document.getElementById(this.FormId+t[a].trim()+"_content");l&&i.jQuery(l).show()}return this}collapseLayoutGroup(e){let t=[];e&&(e instanceof Array?t=e:t=e.split(",")),t.length===0&&(t=this.getAllConfigIdArray());for(let a=0;a<t.length;a++)if(t[a].trim().length>0){const l=document.getElementById(this.FormId+t[a].trim()+"_content");l&&i.jQuery(l).hide()}return this}async queryDataByButton(e,t,a,l){return new Promise((r,c)=>{let d=new Ze.EiInfo;const u=this.getFormButtonConfigInfo(e);if(u&&u.SVC_NAME.trim().length>0){const p=new Ze.EiInfo,h=u.SVC_NAME,g={};u.TYPE_DESC&&u.TYPE_DESC.trim().length>0&&(g[u.TYPE_DESC]=u.TYPE),l&&Object.keys(l).length>0&&Object.keys(l).forEach(M=>{g[M]=l[M]});const I=this.getAllControlValueAsEiBlock(t,g),b=this.getAllControlValueAsFilter(t,g);let S=u.FILTER_STRING;a&&a.trim().length>0&&(S.trim().length>0?S=S+" and "+a:S=a),S.trim().length>0&&this.getQuerySqlFormat(S),p.addBlock(I),p.addBlock(b),this.callService(h,p,{show:!0}).then(M=>{d=M,r(d)})}else d.SysInfo.Flag=-603,d.SysInfo.Msg="未调用后台服务",r(d)})}async queryDataByService(e,t){return new Promise((a,l)=>{let r=new Ze.EiInfo;if(e.trim().length>0){const c=new Ze.EiInfo;if(t&&t.filterConfigId&&t.filterConfigId.trim().length>0){let d=this.getAllControlValueAsEiBlock(t.filterConfigId,t.queryType);const u=this.getAllControlValueAsFilter(t.filterConfigId,t.queryType);if(d.getMappedRows().length>0){const p=d.getMappedRows()[0];d=i.buildEiBlock([p])}c.addBlock(d),c.addBlock(u)}if(t&&t.customFilter&&t.customFilter.trim().length>0){const d=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(t.customFilter),DATA_TYPE:"",OP_VALUE:"*"}];if(!c.getBlock("QUERY_FILTER")){const u=i.buildEiBlock(d,"QUERY_FILTER");c.addBlock(u)}}this.callService(e,c).then(d=>{var u,p,h,g;if(r=d,n.Core.toNumber((u=r.SysInfo)==null?void 0:u.Flag)>=0&&t&&t.dataTable){if(t.dataTable instanceof j)this.mergeDataToDataTable(r,t.dataTable,t.clearTable);else if(typeof t.dataTable=="string"&&t.dataTable.trim().length>0)if((p=this._formDataSet)!=null&&p.contains(t.dataTable.trim()))this.mergeDataToDataTable(r,(h=this._formDataSet)==null?void 0:h.getDataTable(t.dataTable.trim()),t.clearTable);else{const I=this.getBindingTableName(t.dataTable.trim());I.trim().length>0&&this.mergeDataToDataTable(r,(g=this._formDataSet)==null?void 0:g.getDataTable(I.trim()),t.clearTable)}}a(r)})}else r.SysInfo.Flag=-603,r.SysInfo.Msg="No service available",a(r)})}async queryDataByDataSource(e,t,a=""){return new Promise(async(l,r)=>{var p,h,g,I;let c=new Ze.EiInfo,d=!1,u="";if(e.trim().length>0){let b="";const S=this.getGridConfig(e);((p=S==null?void 0:S.SVC_NAME)==null?void 0:p.trim().length)>0&&(u=e,e=S.SVC_NAME.trim(),b=S.FILTER_STRING.trim(),d=!0);const M=new Ze.EiInfo;if(t&&t.filterConfigId&&t.filterConfigId.trim().length>0){let V=this.getAllControlValueAsEiBlock(t.filterConfigId,t.queryType);const P=this.getAllControlValueAsFilter(t.filterConfigId,t.queryType);if(V.getMappedRows().length>0){const J=V.getMappedRows()[0];V=i.buildEiBlock([J])}M.addBlock(V),M.addBlock(P)}if(i.toString(t==null?void 0:t.customFilter,!0).length>0&&(b.trim().length>0?b=b+" and "+i.toString(t==null?void 0:t.customFilter,!0):b=i.toString(t==null?void 0:t.customFilter,!0)),b.trim().length>0){const V=[{ITEM_CODE:"SQL",FIELD_NAME:"*",ORIGIN_CODE:"*",TABLE_NAME:"",OPERATOR:"para",PARA_GROUP:"1",SQL_CONTENT:this.getQuerySqlFormat(b),DATA_TYPE:"",OP_VALUE:"*"}];if(!M.getBlock("QUERY_FILTER")){const P=i.buildEiBlock(V,"QUERY_FILTER");M.addBlock(P)}}const D=(I=(g=(h=this._configInfo)==null?void 0:h.TSI00DATASOURCE)==null?void 0:g.getMappedRows())==null?void 0:I.find(V=>V.FUNC_ID===e),A=V=>{this.callService(V,M,{show:t==null?void 0:t.showLoading},{messageError:!0}).then(P=>{var J,N,te;c=P,n.Core.toNumber((J=c.SysInfo)==null?void 0:J.Flag)>=0&&(t&&t.dataTable?t.dataTable instanceof j?this.mergeDataToDataTable(c,t.dataTable,t.clearTable):typeof t.dataTable=="string"&&t.dataTable.trim().length>0&&((N=this._formDataSet)!=null&&N.contains(t.dataTable.trim()))&&this.mergeDataToDataTable(c,(te=this._formDataSet)==null?void 0:te.getDataTable(t.dataTable.trim()),t.clearTable):d===!0&&this.mergeDataToGrid(c,u,t==null?void 0:t.clearTable)),l(c)})};if(D!=null&&D.FUNC_ID){if(D.ORIGIN_CODE==="SVC"&&D.SVC_NAME.trim().length>0)A(D.SVC_NAME.trim());else if(D.SQL_CONTENT.trim().length>0){const V=i.buildEiBlock([{OPERATE_TYPE:"sql_query",FUNCTION_ID:D.FUNC_ID,SQL:this.getQuerySqlFormat(D.SQL_CONTENT),FILTER_STRING:"",GROUP_COL:D.GROUP_KEY_VALUE,SORT_COL:D.PRI_KEY_SQL}],"DATA_SOURCE");M.addBlock(V),i.toString(a).trim().length===0&&D.SVC_NAME.trim().length>0&&(a=D.SVC_NAME.trim()),i.toString(a).trim().length===0&&(a="JAER01/query"),A(a)}}else{const V=i.buildEiBlock([{FUNCTION_ID:e,COMPANY_CODE:n.SysInfo.CompanyCode}],"DATA_SOURCE");M.addBlock(V),i.toString(a).trim().length===0&&(a="JAER01/query"),A(a)}}else c.SysInfo.Flag=-603,c.SysInfo.Msg="DataSoureId is null or empty!",l(c)})}async queryDataToGrid(e,t,a,l){const r=this.getAllControlValueAsEiBlock(t,void 0,l==null?void 0:l.filterBlockId),c=this.getGridStructureAsBlock(a,!1,l==null?void 0:l.gridBlockId);let d=new Ze.EiInfo;d.addBlock(r),d.addBlock(c),l!=null&&l.processInInfo&&l.processInInfo instanceof Function&&(d=l.processInInfo(d));const u=(l==null?void 0:l.loadingOptions)||{show:!0},p=(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0},h=await this.callService(e,d,u,p);l!=null&&l.mergeToGrid&&l.mergeToGrid instanceof Function?l.mergeToGrid(h):this.mergeDataToGrid(h.getBlock((l==null?void 0:l.gridBlockId)||"result"),a)}saveGridData(e,t,a,l){const r=[];return new Promise(async(c,d)=>{if((a==null?void 0:a.trim().length)>0)if(this.hasDataChange(a)){if(l=l||{},l.messageConfirm=l.messageConfirm??"是否确认保存",l.messageConfirm){const h=typeof l.messageConfirm=="string"?l.messageConfirm:"是否确认保存";if(!await this.messageConfirm(h)){c({results:[],success:!0,message:"保存取消"});return}}if(typeof e=="string"){let h=this.getGridChangedRowsAsEiInfo(a);h.addBlock(this.getAllControlValueAsEiBlock(t,void 0,l==null?void 0:l.filterBlockId)),l!=null&&l.processInInfo&&l.processInInfo instanceof Function&&(h=l.processInInfo(h)),r.push(this.callService(e,h,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}else if(mo.isPlainObject(e)){const h=this.getAllControlValueAsEiBlock(t,void 0,l==null?void 0:l.filterBlockId);if(e.deleteService&&e.deleteService.trim().length>0){const g=this.getGridDeletedRowsAsBlock(a);if(g.getMappedRows().length>0){g.rename("result");let I=new Ze.EiInfo;I.addBlock(h),I.addBlock(g),l!=null&&l.processInInfo&&l.processInInfo instanceof Function&&(I=l.processInInfo(I)),r.push(this.callService(e.deleteService,I,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}}if(e.updateService&&e.updateService.trim().length>0){const g=this.getGridModifyRowsAsBlock(a);if(g.getMappedRows().length>0){g.rename("result");let I=new Ze.EiInfo;I.addBlock(h),I.addBlock(g),l!=null&&l.processInInfo&&l.processInInfo instanceof Function&&(I=l.processInInfo(I)),r.push(this.callService(e.updateService,I,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}}if(e.insertService&&e.insertService.trim().length>0){const g=this.getGridCreatedRowsAsBlock(a);if(g.getMappedRows().length>0){g.rename("result");let I=new Ze.EiInfo;I.addBlock(h),I.addBlock(g),l!=null&&l.processInInfo&&l.processInInfo instanceof Function&&(I=l.processInInfo(I)),r.push(this.callService(e.insertService,I,(l==null?void 0:l.loadingOptions)||{show:!0},(l==null?void 0:l.callServiceOptions)||{toCamelCase:!0}))}}}const u=await Promise.allSettled(r);let p=!0;u.forEach(h=>{h.status==="fulfilled"&&h.value.getStatus()<0?(this.messageError(h.value.getMsg()),p=!1):h.status!=="fulfilled"&&(p=!1)}),p&&(l!=null&&l.queryService)&&this.queryDataToGrid(l.queryService,t,a,l),c({results:u,success:p,message:p?"保存成功":"保存失败"})}else{c({results:[],success:!0,message:"没有数据变更,无需保存"}),this.messageInfo("没有数据变更,无需保存");return}else d(new Error("gridConfId is null or empty!"))})}getFormCodeSetFilter(e,t){let a="";if(this._configInfo[this._formName+e]){for(const l of this._configInfo[this._formName+e].getMappedRows())if(l.CODE===t){a=l.SQL_CONTENT;break}}return a}getQuerySqlFormat(e,t){return i.getSystemFormatString(e,t)}getFormSysInfo(e){return this._configInfo.BM2A_SYSTEM_INFO&&this._configInfo.BM2A_SYSTEM_INFO.getMappedRows().length>0&&e.trim().length>0?i.toString(this._configInfo.BM2A_SYSTEM_INFO.getMappedRows()[0][e.trim().toUpperCase()]):""}getSysParaValue(e,t,a){return new Promise((l,r)=>{if(this._sysParaInfo&&this._sysParaInfo[e]!==void 0&&this._sysParaInfo[e][t]!==void 0)l(this._sysParaInfo[e][t].toString());else if(t&&t.trim().length>0){const c=new Ze.EiInfo;let d="";const u=i.buildEiBlock([{QUERY_TYPE:"system_para",COMPANY_CODE:e,CTRL_CODE:t,EFFECT_ELEMENT_VALUE:a||""}]);c.addBlock(u),i.callService(n.SysInfo.queryDevConfigService,c).then(p=>{var h;p.getStatus()>=0&&p.getBlock("TSIFIAA51")&&p.getBlock("TSIFIAA51").getMappedRows().length>0?d=i.toString(p.getBlock("TSIFIAA51").getMappedRows()[0].CTRL_NUM):p.getStatus()>=0&&((h=p.getBlock("BM2A_SYSTEM_INFO"))==null?void 0:h.getMappedRows().length)>0&&(d=i.toString(p.getBlock("BM2A_SYSTEM_INFO").getMappedRows()[0][t.toUpperCase()])),this._sysParaInfo[e]===void 0&&(this._sysParaInfo[e]={}),this._sysParaInfo[e][t]=d,l(d)},()=>{this._sysParaInfo[e]===void 0&&(this._sysParaInfo[e]={}),this._sysParaInfo[e][t]="",l("")})}})}getDefaultStringValue(e){return e.trim().length>14&&e.trim().substring(0,13)==="$FormSysInfo."&&e.trim().substring(e.trim().length-1,e.trim().length)==="$"?e=this.getFormSysInfo(e.trim().substring(13,e.trim().length-1)):e=i.getSystemFormatString(e),e}setCustomDefaultValue(e,t){(e==null?void 0:e.trim().length)>0&&t&&(this._customDefaultValues[e.trim()]=t)}getLayoutConfigDefaultValues(e){const t={};let a;return e instanceof Array?a=e:a=e.split(","),a.length>0&&a.forEach(l=>{const r=this.getConfigInfo(l.trim());r.TSI00GRIDVIEW&&r.TSI00GRIDCOLUMN&&r.TSI00GRIDCOLUMN.forEach(c=>{if(c.DEFAULT_VALUE&&c.DEFAULT_VALUE.trim().length>0){const d=c.FUNCTION_TYPE+c.COLUMN_EDIT,u=c.DEFAULT_VALUE,p=this.getControlName(d,c.FORMAT_STRING);if(p&&p.trim().length>0&&u.trim().length>0)switch(p){case"antInputNumber":{t[c.ITEM_CODE]=parseFloat(u);break}case"antMultiSelect":case"erMultiSelect":case"erCheckboxGroup":{const h=this.getDefaultStringValue(u).split(",");t[c.ITEM_CODE]=h;break}case"antCheckbox":case"antSwitch":{t[c.ITEM_CODE]=i.toString(u)==="1"||i.toString(u)==="true";break}case"antYearPicker":case"antMonthPicker":case"antDatePicker":case"antDateTimePicker":{t[c.ITEM_CODE]=i.getDateTimeByString(u);break}default:{t[c.ITEM_CODE]=this.getDefaultStringValue(u);break}}}})}),t}getGridConfigDefaultValues(e){const t={},a=this.getConfigInfo(e.trim()),l=this.getBindingTable(e.trim());return l&&a.TSI00GRIDVIEW&&a.TSI00GRIDCOLUMN&&a.TSI00GRIDCOLUMN.forEach(r=>{if(l.options.schema&&r.DEFAULT_VALUE&&r.DEFAULT_VALUE.trim().length>0){const c=l.options.schema[r.FIELD_NAME].type;c==="datetime"?t[r.FIELD_NAME]=i.getDateTimeByString(r.DEFAULT_VALUE):c==="boolean"?t[r.FIELD_NAME]=r.DEFAULT_VALUE==="1"||r.DEFAULT_VALUE.toLowerCase()==="true":c==="number"?t[r.FIELD_NAME]=i.toNumber(r.DEFAULT_VALUE):t[r.FIELD_NAME]=this.getDefaultStringValue(r.DEFAULT_VALUE)}}),t}async loadGrid(e,t,a,l,r){var c,d,u,p,h,g,I,b,S;if(!this.containsConfig(e)&&(a==null?void 0:a.forceLoadConfig)!==!1&&await this.loadConfig(e),this.containsConfig(e)){if(this._gridInstanceInfo[e])return console.error(`Grid instance ${e} already exists!`),!1;const M=this.getSingleViewConfigInfo(e);this.setGridToolbarVisible(e,{refresh:M.SHOW_REFRESH==="1",addrow:M.SHOW_ADD==="1",copyrow:M.SHOW_ADDCOPY==="1",delete:M.SHOW_DELETE==="1",cancel:!1,save:!1,excel:M.SHOW_EXPORT==="1",import:M.ALLOW_IMPORT==="1"}),this._gridColumnsConfigInfo[e]={},this._gridColumnsInfo[e]={},this._allowMergeColumnFields[e]=[],this._gridStyleInfo[e]=this._gridStyleInfo[e]||[],this._gridOptions[e]=this._gridOptions[e]||{};const D=this.getConfigInfo(e);if((c=t==null?void 0:t.gridOptions)!=null&&c.api&&D.TSI00GRIDVIEW&&D.TSI00GRIDVIEW.length>0){const A=D.TSI00GRIDVIEW[0];((d=a==null?void 0:a.cloneTableName)==null?void 0:d.trim().length)>0&&this.cloneTableForLayoutOrGrid(((u=a==null?void 0:a.originTableName)==null?void 0:u.trim())||A.TABLE_NAME.trim(),a.cloneTableName.trim(),e),t.gridOptions.context={configId:e,configCaption:A.FUNCNAME_RES||A.FUNCNAME},a=a||{},((p=A.CUS_EXT_OPTIONS)==null?void 0:p.trim().length)>0&&(a={...JSON.parse(A.CUS_EXT_OPTIONS),...a}),((h=A.EXT_OPTIONS)==null?void 0:h.trim().length)>0&&(a={...JSON.parse(A.EXT_OPTIONS),...a});const V=this.getFormSysInfo("GridDefaultOptions");V.trim().length>0&&(a={...JSON.parse(V),...a}),["rowDragManaged","groupIncludeFooter","groupIncludeTotalFooter","suppressRowTransform","suppressRowClickSelection","rowMultiSelectWithClick","singleClickEdit"].forEach(N=>{a[N]=t.gridOptions[N]??a[N]}),a.groupDisplayType=a.groupDisplayType||t.gridOptions.groupDisplayType||this.getFormSysInfo("GRIDGROUPDISPLAYTYPE")||"groupRows",a.rowHeight=a.rowHeight||t.gridOptions.rowHeight;const J=this.getGridConfigOptions(e,a,l,r);if(J.context={...t.gridOptions.context,...J.context},J&&Object.keys(J).forEach(N=>{t.gridOptions[N]=J[N]!==void 0?J[N]:t.gridOptions[N]}),t.gridOptions.defaultColDef=t.gridOptions.defaultColDef||{},t.gridOptions.rowSelection=D.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",t.gridOptions.api.selectionService.rowSelection=D.TSI00GRIDVIEW[0].MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single",t.gridOptions.api.selectionService.groupSelectsChildren=!0,t.gridOptions.api.setColumnDefs(J.columnDefs),t.gridOptions.api.setRowData([]),A.ALLOW_CELLMERGE==="1"&&((g=t.gridOptions.context.mergeColumns)==null?void 0:g.length)>0){let N=[];t.gridOptions.context.calculateRowSpan=(te=!0)=>{var fe,X,q,v,O,ge;te?N=t.gridOptions.context.bindingSource.data():t.gridOptions.api.forEachNodeAfterFilterAndSort(se=>{var ze;(ze=se.data)!=null&&ze.uid&&N.push(se.data)});const R={},me=((q=(X=(fe=t.gridOptions.context)==null?void 0:fe.viewConfig)==null?void 0:X.MERGE_COLUMN)==null?void 0:q.trim().length)>0?(ge=(O=(v=t.gridOptions.context)==null?void 0:v.viewConfig)==null?void 0:O.MERGE_COLUMN)==null?void 0:ge.trim().split(","):[];return t.gridOptions.context.mergeColumns.forEach(se=>{R[se]={};const ze={};let tt=0;const at=[...me,se];for(let qe=0;qe<N.length;qe++){let T=!0;for(let ye=0;ye<at.length;ye++){const et=at[ye];if(N[qe][et]!==ze[et]){T=!1;break}}if(!T){if(Object.keys(ze).length>0)for(let ye=tt;ye<qe;ye++){const et=N[ye].uid;R[se][et]=ye===tt?qe-tt:0}at.forEach(ye=>{ze[ye]=N[qe][ye]}),tt=qe}if(qe===N.length-1)for(let ye=tt;ye<=qe;ye++){const et=N[ye].uid;R[se][et]=ye===tt?qe-tt+1:0}}}),t.gridOptions.context.rowSpanMap=R,N[0]}}if((A==null?void 0:A.SHOW_FOOTER)==="1"&&t.gridOptions.api.setPinnedBottomRowData([{pinndeRowType:"ErGridSummaryFooter"}]),o.nextTick(()=>{var N;t.gridOptions.defaultColDef.floatingFilter===void 0&&t.gridOptions.api.setDefaultColDef({floatingFilter:(A==null?void 0:A.SHOW_FILTER_ROW)==="1"}),((N=a==null?void 0:a.initialData)==null?void 0:N.length)>0&&this.mergeDataToGrid(a.initialData,t)}),t.gridOptions.processCellForClipboard=N=>{var te;return(te=N.column)!=null&&te.colDef.valueFormatter?N.column.colDef.valueFormatter(N):N.value},a.SORT_FIELD_NAME=((I=a.SORT_FIELD_NAME)==null?void 0:I.trim())||A.SORT_FIELD_NAME,((b=a.SORT_FIELD_NAME)==null?void 0:b.trim().length)>0){const N=a.SORT_FIELD_NAME.split(","),te=[];N.forEach((me,fe)=>{const X=me.trim().split(" ");if(X.length>0){const q={colId:X[0].trim().toUpperCase(),sort:"asc",sortIndex:fe};X.length>1&&X[1].trim().toLowerCase()==="desc"&&(q.sort=X[1].trim().toLowerCase()),te.push(q)}}),t.gridOptions.columnApi.applyColumnState({state:te});const R=(S=t.gridOptions.api)==null?void 0:S.getStatusPanel("InformationPanel");R&&R.setInformation()}this.setGridMainMenuItems(t,a),this.setGridContextMenu(t,a),this.setGridRowStyle(t,a),this.setGridInitialEvent(t,a),this._gridInstanceInfo[e]=t}return!0}return!1}getGridConfigOptions(e,t,a,l){this._gridColumnsConfigInfo[e]={},this._gridColumnsInfo[e]={},this._allowMergeColumnFields[e]=[],this._gridStyleInfo[e]=this._gridStyleInfo[e]||[],this._gridOptions[e]=this._gridOptions[e]||{};const r={},c=this.getConfigInfo(e);if(c.TSI00GRIDVIEW&&c.TSI00GRIDVIEW.length>0){const d=c.TSI00GRIDVIEW[0],u=c.TSI00GRIDCOLUMN;r.statusBar={statusPanels:[{statusPanel:"ToolbarButton"}]},t=t||{},t.rowDragManaged=t.rowDragManaged??d.ALLOW_DRAG.toString()==="1",t.enableHeaderTooltip=t.enableHeaderTooltip??!0,t.enableCellTooltip=t.enableCellTooltip??!0;const p=d.MULTI_SELECT_MODE.toString()!=="1"?"multiple":"single";i.toNumber(d.DISPLAY_WIDTH)>0&&this.setGridOptions(e,"miniHeight",i.toNumber(d.DISPLAY_WIDTH)+"px",!0),this.setGridOptions(e,"ShowQuickFilter",d.ALLOW_FIND_MODE,!0),this.setGridOptions(e,"RowSelection",p,!0),this.setGridOptions(e,"toolbarStyle",t.toolbarStyle,!0),r.treeData=d.FUNCTION_TYPE==="T",r.columnDefs=this.getGridColumnDefs(e,c,r,t),r.rowData=[],r.rowHeight=t.rowHeight?t.rowHeight:i.toNumber(d.ROWHIGH)>0?i.toNumber(d.ROWHIGH):void 0,r.groupIncludeFooter=t.groupIncludeFooter??(d.SHOW_FOOTER==="1"&&t.aggDataInGroupRow!==!0),r.groupIncludeTotalFooter=t.groupIncludeTotalFooter??d.SHOW_FOOTER==="1",r.getRowId=h=>h.data.uid,r.gridId=e,r.suppressRowTransform=t.suppressRowTransform??!0,r.suppressRowClickSelection=t.suppressRowClickSelection??d.AUTO_SELECT_MODE.toString()!=="4",r.rowMultiSelectWithClick=t.rowMultiSelectWithClick??!0,r.singleClickEdit=t.singleClickEdit??!0,r.rowBuffer=t.rowBuffer??10,r.debug=t.debug??!1,r.enableRangeHandle=!0,r.showOpenedGroup=!0,r.suppressPaginationPanel=!0,r.paginateChildRows=!0,r.stopEditingWhenCellsLoseFocus=!0,r.enableCellExpressions=!0,r.groupDisplayType=r.treeData?void 0:t.groupDisplayType||this.getFormSysInfo("GridGroupDisplayType")||"groupRows",r.context.rowSpanMap&&(r.suppressRowTransform=!0),r.groupDisplayType==="groupRows"&&(r.groupRowRendererParams={checkbox:p==="multiple"&&d.SHOW_SELECTION.toString()==="1",suppressCount:t.aggDataInGroupRow===!0,innerRenderer:h=>{var g,I,b,S,M,D,A,V,P;if((I=(g=h.node)==null?void 0:g.rowGroupColumn)!=null&&I.colDef){const J=(S=(b=h.node)==null?void 0:b.rowGroupColumn)==null?void 0:S.colDef;let N=h.node.key;if(J.cellDataType==="number"?N=i.formatNumberValue(h.value,(D=(M=J.context)==null?void 0:M.columnConfig)==null?void 0:D.FORMAT_STRING):((A=J.cellEditor)==null?void 0:A.name)==="DatetimeEditor"?N=i.getDateTimeFormatString(h.value,(P=(V=J.context)==null?void 0:V.columnConfig)==null?void 0:P.FORMAT_STRING):J.refData&&(N=J.refData[h.value]||h.value),t.aggDataInGroupRow===!0){let R=`
35
35
  <div style="display: inline-block">
36
36
  <span>${`${N}(${h.node.allChildrenCount})`}</span>`;return h.node.aggData&&Object.keys(h.node.aggData).length>0&&Object.keys(h.node.aggData).forEach(me=>{var O,ge,se,ze;const fe=(O=h.columnApi.getColumn(me))==null?void 0:O.colDef,X=((ge=fe.headerName)==null?void 0:ge.replaceAll("<br>","").replaceAll("</br>","").replaceAll("<br/>",""))||me,q=(ze=(se=fe.context)==null?void 0:se.columnConfig)==null?void 0:ze.FORMAT_STRING,v=h.node.aggData[me];R+=`<span class="er-grid-group-row-col">${X}:</span>`,mo.isPlainObject(v)?R+=`<span class="er-grid-group-row-agg">${i.formatNumberValue(v.aggValueOfChecked,q)+"/"+i.formatNumberValue(v.aggValue,q)}</span>`:R+=`<span class="er-grid-group-row-agg">${i.formatNumberValue(v,q)}</span>`}),R+="</div>",R}else return N}else return h.value}}),r.treeData?(r.getDataPath=h=>h[m.TreeHierarchyFieldName],r.animateRows=(t==null?void 0:t.animateRows)??!0):r.autoGroupColumnDef=(t==null?void 0:t.autoGroupColumnDef)||{tooltipField:r.context.groupColumnFieldId,filter:"agSetColumnFilter",filterParams:{excelMode:"windows"},pinned:"left",resizable:!0,sortable:!0},r.debounceVerticalScrollbar=(t==null?void 0:t.debounceVerticalScrollbar)??!0,r.enableAdvancedFilter=(t==null?void 0:t.enableAdvancedFilter)??!0,r.rowDragManaged=t.rowDragManaged,r.rowDragMultiRow=t.rowDragMultiRow,r.rowDragEntireRow=t.rowDragEntireRow??!1,r.enableRangeSelection=(t==null?void 0:t.enableRangeSelection)===!0||(t==null?void 0:t.enableRangeSelection)!==!1&&d.MULTI_SELECT_MODE.toString()==="3",r.enableBrowserTooltips=(t==null?void 0:t.enableBrowserTooltips)??!1,r.tooltipInteraction=(t==null?void 0:t.tooltipInteraction)??!0,r.allowContextMenuWithControlKey=(t==null?void 0:t.allowContextMenuWithControlKey)??!0,r.groupSelectsChildren=(t==null?void 0:t.groupSelectsChildren)??!0,r.context={...r.context,configId:e,viewConfig:d,columnsConfig:u,editable:d.ALLOW_EDIT==="1",showPreview:d.SHOW_PREVIEW==="1"&&d.PREVIEW_FIELD_NAME.trim().length>0,previewField:d.PREVIEW_FIELD_NAME,detailConfigId:t==null?void 0:t.detailConfigId,options:t,toolbarOptions:a,pageOptions:l},r.context.aggForChecked&&(r.getRowHeight=h=>h.node.rowPinned||h.node.group?35:void 0)}return r}setGridInitialEvent(e,t){var a,l;if((l=(a=e==null?void 0:e.gridOptions)==null?void 0:a.context)!=null&&l.configId){const r=e.gridOptions.context.configId,c=this.getConfigInfo(r);e.gridOptions.api.addEventListener("firstDataRendered",d=>{var g,I,b,S,M;c.TSI00GRIDVIEW[0].AUTO_EXPAND_GROUP==="1"&&d.api.expandAll();const u=e.gridOptions.api.getFilterModel(),p=e.gridOptions.columnApi.getColumnState().filter(D=>D.sort!==null);if(Object.keys(u).length>0||p.length>0)if(e.gridOptions.context.calculateRowSpan&&e.gridOptions.context.calculateRowSpan instanceof Function){const D=e.gridOptions.context.calculateRowSpan(!1);e.gridOptions.api.redrawRows(),e.gridOptions.context.bindingSource.setCurrent(D)}else i.setGridFocusedCell(e,0);else{const D=e.gridOptions.context.bindingSource.data()[0];e.gridOptions.context.bindingSource.setCurrent(D)}if((I=(g=e==null?void 0:e.gridOptions)==null?void 0:g.context)!=null&&I.showPreview&&((S=(b=e==null?void 0:e.gridOptions)==null?void 0:b.context)!=null&&S.previewField)&&!t.detailConfigId){const D=e.gridOptions.context.previewField.split(","),A={};D.forEach(P=>{var J;if(P.trim().length>0){let N="";const te=(J=e.gridOptions.context.columnsConfig)==null?void 0:J.find(R=>R.FIELD_NAME===P.trim());te&&(N=te.COL_CAPTION.replaceAll("<br>","").replaceAll("</br>","").replaceAll("<br/>","")),A[P.trim()]=N}});const V=Object.keys(A);V.length>0&&(e.gridOptions.context.previewFieldMap=A,d.api.forEachNode(P=>{const J=[];V.forEach(N=>{var te;(te=P.data)!=null&&te[N]&&J.push({label:A[N],value:P.data[N]})}),J.length>0&&(P.data._preview_row_data=J,P.setExpanded(!0))}))}const h=(M=d.api)==null?void 0:M.getStatusPanel("InformationPanel");h&&h.setInformation()}),e.gridOptions.api.addEventListener("selectionChanged",d=>{var u,p,h,g;if(e.gridOptions.context.aggForChecked&&((u=d.api)==null||u.refreshCells({force:!0}),this.refreshGridFooterData(e),((p=e.gridOptions.context.options)==null?void 0:p.aggDataInGroupRow)===!0&&d.columnApi.getRowGroupColumns().length>0)){const b=[];(h=d.api)==null||h.forEachNode(S=>{S.group&&b.push(S)}),(g=d.api)==null||g.redrawRows({rowNodes:b})}}),e.gridOptions.api.addEventListener("rowSelected",d=>{d.source==="checkboxSelected"&&this.processRowSelectedEvent(d)}),e.gridOptions.api.addEventListener("cellEditingStarted",d=>{e.gridOptions.suppressContextMenu=!0}),e.gridOptions.api.addEventListener("cellEditingStopped",d=>{e.gridOptions.suppressContextMenu=!1}),e.gridOptions.api.addEventListener("sortChanged",d=>{var h,g;let u;e.gridOptions.context.calculateRowSpan&&e.gridOptions.context.calculateRowSpan instanceof Function&&(u=e.gridOptions.context.calculateRowSpan(!1)),(t==null?void 0:t.showRowNo)!==!1&&((h=d.api)==null||h.redrawRows()),u?e.gridOptions.context.bindingSource.setCurrent(u):i.setGridFocusedCell(e,0);const p=(g=d.api)==null?void 0:g.getStatusPanel("InformationPanel");p&&p.setInformation()}),e.gridOptions.api.addEventListener("filterChanged",d=>{var h,g,I,b,S;let u;if(e.gridOptions.context.calculateRowSpan&&e.gridOptions.context.calculateRowSpan instanceof Function&&(u=e.gridOptions.context.calculateRowSpan(!1)),(t==null?void 0:t.showRowNo)!==!1&&((h=d.api)==null||h.redrawRows()),u?e.gridOptions.context.bindingSource.setCurrent(u):i.setGridFocusedCell(e,0),((g=d==null?void 0:d.context)==null?void 0:g.viewConfig.SHOW_FOOTER)==="1"){const M=d.api.getModel();(b=d.api)==null||b.setPinnedBottomRowData([{...(I=M==null?void 0:M.rootNode)==null?void 0:I.aggData,pinndeRowType:"ErGridSummaryFooter"}])}const p=(S=d.api)==null?void 0:S.getStatusPanel("InformationPanel");p&&p.setInformation()}),e.gridOptions.api.addEventListener("rowDragEnd",d=>{var u,p;e.gridOptions.context.calculateRowSpan&&e.gridOptions.context.calculateRowSpan instanceof Function?(e.gridOptions.context.calculateRowSpan(!1),(u=d.api)==null||u.redrawRows()):(t==null?void 0:t.showRowNo)!==!1&&((p=d.api)==null||p.refreshCells({columns:[m.GridCheckColumnFieldName]}))}),e.gridOptions.api.addEventListener("columnRowGroupChanged",d=>{var u;e.gridOptions.context.groupByFields=void 0,e.gridOptions.context.groupColumnFieldId=void 0,(t==null?void 0:t.showRowNo)!==!1&&((u=d.api)==null||u.redrawRows())}),e.gridOptions.api.addEventListener("rowGroupOpened",d=>{var u;d.api.redrawRows({rowNodes:[d.node]}),(t==null?void 0:t.showRowNo)!==!1&&((u=d.api)==null||u.refreshCells({columns:[m.GridCheckColumnFieldName]}))}),e.gridOptions.api.addEventListener("expandOrCollapseAll",d=>{var u;(t==null?void 0:t.showRowNo)!==!1&&((u=d.api)==null||u.refreshCells({columns:[m.GridCheckColumnFieldName]}))}),e.gridOptions.api.addEventListener("cellValueChanged",d=>{var u,p,h,g,I,b;if(d.data&&d.colDef&&d.colDef.field){d.data.dirty=!0,d.data.dirtyFields[d.colDef.field]=!0,this.setDropDownAutoFillFieldsForGrid(e,d.colDef.colId,d.node),this.DropDownCascader[r+d.colDef.colId]&&this.DropDownCascader[r+d.colDef.colId].forEach(M=>{M.FUNCTION_TYPE&&M.FUNCTION_ID&&M.ITEM_CODE&&(M.FUNCTION_TYPE==="F"?this.setControlEmptyValue(M.FUNCTION_ID,M.ITEM_CODE):M.FUNCTION_ID===r&&(d.data[M.ITEM_CODE]=null))});let S=this.getGridOptions(r,"autoSelectMode");if(S===void 0){const M=this.getSingleViewConfigInfo(r);S=M.AUTO_SELECT_MODE,this.setGridOptions(r,"autoSelectMode",M.AUTO_SELECT_MODE)}if(S==="2"||S==="3")this.checkGridRow(r,d.data.uid);else if(((h=(p=(u=d.colDef)==null?void 0:u.context)==null?void 0:p.columnConfig)==null?void 0:h.MULTI_ROW_EDIT)==="1"&&((g=d.node)!=null&&g.selected)){const M=this.getGridOptions(r,"multiRowEdit");if(M!==!1&&M!=="0"){let D=!1;if((t==null?void 0:t.multiRowEditType)==="all"){const A=this.getGridSelectRows(e);(A==null?void 0:A.length)>0&&A.forEach(V=>{d.data.uid!==V.uid&&(V.set(d.colDef.field,d.data[d.colDef.field]),D=!0)})}else{const A=[];e.gridOptions.api.forEachNodeAfterFilter(V=>{var P;V!=null&&V.selected&&((P=V.data)!=null&&P.uid)&&V.data.uid!==d.data.uid&&A.push(V)}),A.forEach(V=>{V.data.set(d.colDef.field,d.data[d.colDef.field]),D=!0})}D&&d.api.refreshCells({columns:[d.colDef.colId,n.SysInfo.GridCheckColumnFieldName]})}}if(((I=d==null?void 0:d.context)==null?void 0:I.viewConfig.SHOW_FOOTER)==="1"){const M=d.api.getModel();d.api.setPinnedBottomRowData([{...(b=M==null?void 0:M.rootNode)==null?void 0:b.aggData,pinndeRowType:"ErGridSummaryFooter"}])}d.api.refreshCells({rowNodes:[d.node],columns:[n.SysInfo.GridCheckColumnFieldName,d.colDef.colId]})}})}}processRowSelectedEvent(e){var t,a;if(e.event){const l=((t=e.api)==null?void 0:t.getCellRanges())||[];if(l.length===1&&l[0].columns.length===1&&l[0].columns[0].colId===m.GridCheckColumnFieldName){const r=(a=e.api)==null?void 0:a.getModel();if(r){const c=[];for(let d=l[0].startRow.rowIndex;d<=l[0].endRow.rowIndex;d++){const u=r.getRow(d);u&&c.push(u)}e.api.setNodesSelected({nodes:c,newValue:e.node.isSelected()})}}}}getGridContextMenuItems(e,t){var l,r,c,d,u,p,h,g,I,b,S,M,D,A,V,P,J;const a=[];if(e.api.getDisplayedRowCount()>0){a.push("copy","copyWithHeaders");const N=this.getConfigInfo(e.context.configId),te=[];if(N.TSI00GRIDSTYLE&&N.TSI00GRIDSTYLE.forEach(R=>{(R.NTYPE==="W_Fore"||R.NTYPE==="W_Back")&&R.REMARK.toUpperCase().trim().length>0&&te.push({text:R.REMARK,type:R.NTYPE,fontName:R.TEXT_COLOR,fontStyle:R.FONTNAME,color:R.FILL_COLOR})}),te.length>0&&(a.push("separator"),a.push({name:this.$t("ERX.ErGrid.StyleDesc")||"样式说明",action:()=>{De.Modal.info({title:this.$t("ERX.ErGrid.StyleDesc")||"样式说明",type:"info",okText:this.$t("ERX.Close")||"关闭",content:()=>o.h("div",{style:{width:"100%"}},te.map(R=>o.h("span",{style:{[R.type==="W_Fore"?"color":"backgroundColor"]:n.Core.toHexColor(R.color),fontFamily:R.fontName,fontStyle:R.fontStyle==="Italic"?"italic":"normal",fontWeight:R.fontStyle==="Bold"?"bold":"normal",display:"block",width:"100%",padding:"4px",marginBottom:"4px",boxSizing:"border-box",lineHeight:"1.2"}},R.text)))})},icon:n.Core.createErSvgElement("style")})),(t==null?void 0:t.showDetailForm)!==!1&&e.node&&e.node.group!==!0&&e.node.rowPinned===void 0&&(a.push("separator"),a.push({name:this.$t("ERX.ErGrid.ShowDetailForm")||"查看明细",action:()=>{var me,fe,X,q,v,O,ge,se,ze,tt,at,qe,T,ye,et,rt;let R=e.context.detailFormHelper;if(!R){(fe=(me=e.context)==null?void 0:me.viewConfig)!=null&&fe.EDIT_COLS_COUNT;const Oe=e.columnApi.columnModel.displayedColumns.length;let We=Math.floor(Oe/3)*30+120;We<200?We=200:We>650&&(We=650),R=new ue(this._serverPartition,this._formName,(X=e.context)==null?void 0:X.configId,this._serviceName),R.setFormOptions({height:We,title:`${e.context.configCaption||this.$t("ERX.ErGrid.ShowDetailForm")||"查看明细"}`}),R.BordStyle="Sizable"}e.context.detailFormHelper=R,(v=(q=e.context)==null?void 0:q.options)!=null&&v.detailItemValueChanged&&((ge=(O=e==null?void 0:e.context)==null?void 0:O.options)==null?void 0:ge.detailItemValueChanged)instanceof Function?R.setEvent("itemValueChanged",(ze=(se=e.context)==null?void 0:se.options)==null?void 0:ze.detailItemValueChanged):R.setEvent("ok",Oe=>{var We;(We=Oe.dataModel)!=null&&We.dirty&&Object.keys(Oe.dataModel.dirtyFields).forEach(Je=>{e.node.setDataValue(Je,Oe.dataModel[Je])})}),(at=(tt=e.context)==null?void 0:tt.options)!=null&&at.detailItemButtonClick&&((T=(qe=e.context)==null?void 0:qe.options)==null?void 0:T.detailItemButtonClick)instanceof Function&&R.setEvent("itemButtonClick",(et=(ye=e.context)==null?void 0:ye.options)==null?void 0:et.detailItemButtonClick),R.ReceiveData(e.node.data),R.EditType=(rt=e.context)!=null&&rt.editable?"Modify":"Query",R.show(null)},icon:n.Core.createErSvgElement("show-detail")})),((r=(l=e.node)==null?void 0:l.childrenAfterFilter)==null?void 0:r.length)>0&&e.node.group===!0&&e.node.footer!==!0&&a.push("separator","expandAll","contractAll"),t!=null&&t.allowImageUpload&&((u=(d=(c=e.column)==null?void 0:c.colDef)==null?void 0:d.cellRenderer)==null?void 0:u.name)==="ImagePreview"&&((h=(p=e.node)==null?void 0:p.data)!=null&&h.uid)&&!((I=(g=e.node)==null?void 0:g.data)!=null&&I.isNew)&&((S=(b=e.column)==null?void 0:b.colDef.context.columnConfig.EXT_OPTIONS)==null?void 0:S.trim().length)>0){const R=JSON.parse((M=e.column)==null?void 0:M.colDef.context.columnConfig.EXT_OPTIONS);if(((D=R==null?void 0:R.imageUploadDir)==null?void 0:D.trim().length)>0&&((A=R.imageUploadKeyField)==null?void 0:A.trim().length)>0){const me=e.node.data[R.imageUploadKeyField];if((me==null?void 0:me.trim().length)>0){let fe="";(V=R==null?void 0:R.imageUploadDir)!=null&&V.trim().startsWith("/")?fe=(P=R==null?void 0:R.imageUploadDir)==null?void 0:P.trim():fe=`/${(J=R==null?void 0:R.imageUploadDir)==null?void 0:J.trim()}`,fe=`${fe}/${me==null?void 0:me.trim()}`,a.push("separator"),a.push({name:this.$t("ERX.ErGrid.UploadImage")||"上传图片",action:()=>{const X=new n.AttachmentHelper;X.setOptions({relationId:fe,refreshKey:n.Core.guid(),readonly:!1,multiple:!0,maxCount:1,showFileDateTime:!0,showFileSize:!0,afterUpload(q){t!=null&&t.afterUpload&&t.afterUpload instanceof Function&&(e.file=q,t.afterUpload(e))},afterRemove(q){t!=null&&t.afterRemove&&t.afterRemove instanceof Function&&(e.file=q,t.afterRemove(e))}}),X.showPopAttachment(null)}})}}}}if(e.api.isColumnFilterPresent()&&(a.push("separator"),a.push({name:this.$t("ERX.ErGrid.ClearAllColumnFilter")||"清除所有列过滤条件",action:()=>{e.api.setFilterModel(null)}})),t!=null&&t.customContextMenu&&t.customContextMenu instanceof Function){const N=t.customContextMenu(e);N&&N.length>0&&(a.length>0&&a.push("separator"),a.push(...N))}return a}setGridContextMenu(e,t){const a=this.getGrid(e);a&&(a.gridOptions.getContextMenuItems=l=>this.getGridContextMenuItems(l,t))}async showExtOptionsEdit(e,t,a,l,r,c,d=!1){var S,M,D;const u=new n.PopRichEditor({width:450,height:550,extension:"json"});let p="";if(l&&l.trim().length>0){const A=l.split(",");l=A[0],A.length>1&&(p=A[1])}const h={QUERY_TYPE:e,FORM_NAME:t||this._formName,FUNCTION_ID:a,ROW_GUID:l,COMPANY_CODE:c||this.DefaultConfigCompanyCode,ITEM_CODE:p},g=async()=>{const A=n.Core.buildEiInfo([h]);return await n.Core.callService(n.SysInfo.queryDevConfigService,A)};let I="";const b=await g();b.getStatus()>=0&&(I=n.Core.toString((D=(M=(S=b.getBlockByIndex(0))==null?void 0:S.getMappedRows())==null?void 0:M[0])==null?void 0:D.EXT_OPTIONS,!0)),u.CancelButtonCaption=n.Core.$t("ERX.Close")||"关闭",u.CloseDialogWhenOkClick=d,u.setEvent("ok",async()=>{const A=u.Content,V=n.Core.buildEiInfo([{...h,EXT_OPTIONS:A}],h.QUERY_TYPE.toUpperCase()),P=await n.Core.callService(n.SysInfo.saveDevConfigService,V);return P.getStatus()<0?n.Core.messageError(P.getMsg()):n.Core.messageSuccess(n.Core.$t("ERX.OperateSuccess")||"操作成功!"),P.getStatus()>=0}),u.setOptions({title:h.QUERY_TYPE==="tsi00formext"?`Form Extend Options [${h.FORM_NAME}]`:h.QUERY_TYPE==="tsi00gridviewext"?`View Extend Options [${h.FORM_NAME}.${h.FUNCTION_ID}]`:`Item Extend Options [${h.FORM_NAME}.${h.FUNCTION_ID}.${p}]`}),u.show(null,I)}async showViewOptionsEdit(e,t,a,l=!1,r){var h,g,I,b;let c={};const d=n.Core.buildEiInfo({QUERY_TYPE:"tsi00gridview",FORM_NAME:e,FUNCTION_ID:t}),u=await this.callService(n.SysInfo.queryDevConfigService,d);if(u.getStatus()<0){n.Core.messageError(u.getMsg());return}else if(((g=(h=u.getBlockByIndex(0))==null?void 0:h.getMappedRows())==null?void 0:g.length)===0){n.Core.messageError("Data not found!");return}else c=(b=(I=u.getBlockByIndex(0))==null?void 0:I.getMappedRows())==null?void 0:b[0];const p=new n.PopFreeHelper(a||this._serverPartition,c.FUNCTION_TYPE==="F"?"SI00LayoutEdit":c.FUNCTION_TYPE==="T"?"SI00TreeListEdit":"SI00GridViewEdit","LayoutGroupMain",this.InitialService);p.EditType="Modify",p.OkButtonService=n.SysInfo.saveDevConfigService,p.OkButtonCaption=n.Core.$t("ERX.Save")||"Save",p.CancelButtonCaption=n.Core.$t("ERX.Close")||"Close",p.CloseDialogWhenOkClick=l,p.ReceiveData(c),p.setEvent("open",S=>{r!=null&&r.open&&r.open instanceof Function&&r.open(S)}),r!=null&&r.colse&&r.colse instanceof Function&&p.setEvent("close",S=>{S.isModified&&r.colse(S)}),p.setEvent("itemButtonClick",async S=>{if(S.itemCode==="DATASET_NAME")if(S.type==="clear")p.FormHelper.setControlEmptyValue("LayoutGroupMain","DATASET_NAME,TABLE_NAME");else{const M=new n.PopTreeHelper("CURRENT_NODE_CODE","PARENT_NODE_CODE","CURRENT_NODE_DESC",{title:"DataSet Config List",nodeRenderer:vo});M.BordStyle="Fixed";const D=async()=>{var V;const A=await p.FormHelper.callService(n.SysInfo.queryDevConfigService,n.Core.buildEiInfo({OPERATE_TYPE:"tsi00datasettree"}));return A.getStatus()<0?(n.Core.messageError(A.getMsg()),[]):((V=A.getBlockByIndex(0))==null?void 0:V.getMappedRows())||[]};M.receiveData(D),M.BeforeOkButtonClick=A=>(A==null?void 0:A.NODE_TYPE)!=="DataTable"?!1:A,M.show(null,A=>{A!=null&&A.data&&(p.FormHelper.setControlValue("LayoutGroupMain","DATASET_NAME",A.data.DATASET_NAME),p.FormHelper.setControlValue("LayoutGroupMain","TABLE_NAME",A.data.DATATABLE_NAME))})}}),p.show(null)}async showFormOptionsEdit(e,t,a=!1,l){var h,g,I,b,S,M;let r={},c=[],d=n.Core.buildEiInfo([{QUERY_TYPE:"TSI00MODULE",MODULE_TYPE:"15"}]),u=await this.callService(n.SysInfo.queryDevConfigService,d);if(u.getStatus()<0){n.Core.messageError(u.getMsg());return}else c=(g=(h=u.getBlockByIndex(0))==null?void 0:h.getMappedRows())==null?void 0:g.map(D=>({CODE:D.MODULE_ENAME,CODE_DESC_1_CONTENT:D.MODULE_CNAME}));const p=new n.PopFreeHelper(t||this._serverPartition,"SI00FormEdit","LayoutGroupMain",this.InitialService);if(p.EditType="Modify",p.OkButtonService=n.SysInfo.saveDevConfigService,p.OkButtonCaption=n.Core.$t("ERX.Save")||"Save",p.CancelButtonCaption=n.Core.$t("ERX.Close")||"Close",p.CloseDialogWhenOkClick=a,d=n.Core.buildEiInfo({QUERY_TYPE:"tsi00form",FORM_NAME:e}),u=await this.callService(n.SysInfo.queryDevConfigService,d),u.getStatus()<0){n.Core.messageError(u.getMsg());return}else if(((b=(I=u.getBlockByIndex(0))==null?void 0:I.getMappedRows())==null?void 0:b.length)===0){n.Core.messageError("Data not found!");return}else r=(M=(S=u.getBlockByIndex(0))==null?void 0:S.getMappedRows())==null?void 0:M[0];p.ReceiveData(r),p.setEvent("initial",()=>{p.FormHelper.reloadDropDownDataSource("LayoutGroupMain","MODULE_TYPE",c)}),p.setEvent("open",D=>{l!=null&&l.open&&l.open instanceof Function&&l.open(D)}),l!=null&&l.colse&&l.colse instanceof Function&&p.setEvent("close",D=>{l.colse(D)}),p.show(null)}getGridColumnDefs(e,t,a,l){var A,V,P,J,N,te,R,me,fe,X,q;let r=[];this._gridColumnsConfigInfo[e]={},this._gridColumnsInfo[e]={},this._gridOptions[e]=this._gridOptions[e]||{};const c=t.TSI00GRIDVIEW[0],d=t.TSI00GRIDCOLUMN,u=t.TSI00GRIDVIEW[0].TABLE_NAME;this.setBindingTableName(e);const p=(A=this._formDataSet)==null?void 0:A.dataTables[u];p?(p.setBindingInfo(this,e,"Grid"),p.setAllowCancelChanges(l==null?void 0:l.allowCancelChanges)):console.error("ER: Could not find binding table of configuration ["+e+"]"),a.context={bindingSource:p,bindTableName:u,mergeColumns:[]};const h=[];this._gridOptions[e].styleConfigInfo={rowStyle:[],cellStyle:{}},t.TSI00GRIDSTYLE&&t.TSI00GRIDSTYLE.length>0&&t.TSI00GRIDSTYLE.forEach(v=>{(v.NTYPE==="W_Fore"||v.NTYPE==="W_Back")&&(v.COL_NAME.toUpperCase().trim().length===0?this._gridOptions[e].styleConfigInfo.rowStyle.push({type:v.NTYPE,fillColor:v.FILL_COLOR,fontFamily:v.TEXT_COLOR,fontStyle:v.FONTNAME,columnNames:v.COL_NAME.toUpperCase().trim(),condition:v.REGULAR_EXPRESS}):v.COL_NAME.toUpperCase().trim().split(",").forEach(O=>{O.trim().length>0&&(this._gridOptions[e].styleConfigInfo.cellStyle[O]||(this._gridOptions[e].styleConfigInfo.cellStyle[O]=[]),this._gridOptions[e].styleConfigInfo.cellStyle[O].push({type:v.NTYPE,fillColor:v.FILL_COLOR,fontFamily:v.TEXT_COLOR,fontStyle:v.FONTNAME,columnNames:v.COL_NAME.toUpperCase().trim(),condition:v.REGULAR_EXPRESS}))}))});const g=this.getModelFields(p),I=[],b={};let S,M;(((V=l==null?void 0:l.viewType)==null?void 0:V.toLowerCase())==="band"||((P=l==null?void 0:l.viewType)==null?void 0:P.toLowerCase())==="bandview"&&t.TSI00GRIDBAND&&t.TSI00GRIDBAND.length>0)&&this.createGridBandColumn(t.TSI00GRIDBAND,I,b,void 0,l),I.length>0&&(r=I);let D={};for(let v=0;v<d.length;v++){const O=d[v];if(O.FUNCTION_TYPE=c.FUNCTION_TYPE,this._gridColumnsConfigInfo[e][O.ITEM_CODE]=O,I.length>0&&(O.BAND_NAME.toString().trim().length===0||b[O.BAND_NAME.toString().trim()]===void 0))continue;let ge;if(g&&g[O.FIELD_NAME]&&g[O.FIELD_NAME].type)ge=g[O.FIELD_NAME].type,O.ITEM_MUST_FLAG==="1"&&(g[O.FIELD_NAME].validation={required:!0});else if(O.UNBOUND_TYPE!=="0")switch(O.UNBOUND_TYPE){case"2":case"3":ge="number";break;case"4":ge="datetime";case"5":ge="boolean";break;default:ge="string";break}let se=!1;O.CUS_COL_FIX_TYPE?se=O.CUS_COL_FIX_TYPE==="L"?"left":O.CUS_COL_FIX_TYPE==="R"?"right":!1:se=O.COL_FIX_TYPE==="L"?"left":O.COL_FIX_TYPE==="R"?"right":!1,this.IsRtl&&(se==="left"?se="right":se==="right"&&(se="left"));const ze=i.toHexColor(O.HEAD_TEXTCOLOR),tt=i.toHexColor(O.HEAD_BACKCOLOR),at=i.toNumber(O.HEAD_FONTSIZE);let qe="";if(O.ALLOW_EDIT==="1"&&O.UNBOUND_TYPE==="0"&&t.TSI00GRIDSTYLE){const He=t.TSI00GRIDSTYLE.find(de=>{var je,lt;return de.NTYPE==="W_Hf4Edit"&&(((je=de.COL_NAME)==null?void 0:je.trim().length)===0||((lt=de.COL_NAME)==null?void 0:lt.includes(O.FIELD_NAME)))});He&&(qe=i.toHexColor(He.FILL_COLOR))}D=l!=null&&l.columnOptions?l.columnOptions[O.ITEM_CODE]:{};let T=O.ALLOW_EDIT==="1";ge==="boolean"&&(T=O.ALLOW_EDIT==="1"&&O.READ_ONLY!=="1"),l!=null&&l.columnOptions&&l.columnOptions[O.ITEM_CODE]&&l.columnOptions[O.ITEM_CODE].editable!==void 0&&(T=l.columnOptions[O.ITEM_CODE].editable);const ye=c.ALLOW_CELLMERGE!=="1"&&ge!=="boolean"&&((l==null?void 0:l.wrapText)===!0||n.Core.toString(l==null?void 0:l.wrapText).split(",").includes(O.ITEM_CODE)),et={simpleHeader:l==null?void 0:l.simpleHeader,fontSize:at>0?`${at}px`:"unset",color:qe||ze,backgroundColor:tt,title:O.COL_CAPTION},rt=O.CUS_GROUP_SORT_TYPE||O.GROUP_SORT_TYPE;D={...D,pinned:se,lockPosition:se,colId:O.ITEM_CODE,field:O.FIELD_NAME,headerName:O.COL_CAPTION,headerTooltip:l!=null&&l.enableHeaderTooltip?O.COL_CAPTION.replaceAll("<br>","").replaceAll("</br>","").replaceAll("<br/>",""):void 0,headerComponentParams:{template:`${this.getGridHeaderTemplate(et)}`},headerClass:He=>{var je,lt,Tt,yt,gt,ht,nt,$t,xt,Vt,Dt,Pt,kt,wt,lo,co;let de="er-grid-header-align-center";return((Tt=(lt=(je=He.colDef)==null?void 0:je.context)==null?void 0:lt.columnConfig)==null?void 0:Tt.HEAD_HALIGNMENT)==="Near"?de="er-grid-header-align-left":((ht=(gt=(yt=He.colDef)==null?void 0:yt.context)==null?void 0:gt.columnConfig)==null?void 0:ht.HEAD_HALIGNMENT)==="Far"&&(de="er-grid-header-align-right"),((xt=($t=(nt=He.colDef)==null?void 0:nt.context)==null?void 0:$t.columnConfig)==null?void 0:xt.ITEM_MUST_FLAG)==="1"&&((kt=(Pt=(Dt=(Vt=He.colDef)==null?void 0:Vt.context)==null?void 0:Dt.columnConfig)==null?void 0:Pt.MUST_INPUT_CONDITION)==null?void 0:kt.trim().length)>0?de=de+" er-grid-header-maroon-star":((co=(lo=(wt=He.colDef)==null?void 0:wt.context)==null?void 0:lo.columnConfig)==null?void 0:co.ITEM_MUST_FLAG)==="1"&&(de=de+" er-grid-header-red-star"),de},autoHeight:ye,suppressMovable:O.ALLOW_MOVE==="0",sortable:O.ALLOW_SORT==="1",resizable:O.ALLOW_SIZE==="1",suppressSizeToFit:O.BESTFIT!=="1",suppressColumnsToolPanel:(O.ALLOW_SHOWHIDE==="0"||this.DevelopPermisson!=="1")&&O.IS_VISIBLE!=="1",lockVisible:O.ALLOW_SHOWHIDE==="0"||(l==null?void 0:l.groupDisplayType)==="multipleColumns"&&(rt==="1"||rt==="2"),width:i.toNumber(O.CUS_COL_WIDTH)>0?i.toNumber(O.CUS_COL_WIDTH):i.toNumber(O.COL_WIDTH_WEB)>0?i.toNumber(O.COL_WIDTH_WEB):i.toNumber(O.COL_WIDTH)>0?i.toNumber(O.COL_WIDTH):100,editable:He=>{var de,je,lt,Tt,yt,gt,ht,nt,$t,xt,Vt,Dt,Pt,kt,wt;if(He.node.rowPinned||!((de=He.context)!=null&&de.editable))return!1;if(((je=He.column.context)==null?void 0:je.editable)!==void 0&&((lt=He.column.context)==null?void 0:lt.editable)instanceof Function)return(Tt=He.column.context)==null?void 0:Tt.editable(He);if(((yt=He.column.context)==null?void 0:yt.editable)!==void 0&&((gt=He.column.context)==null?void 0:gt.editable)!=="default")return(ht=He.column.context)==null?void 0:ht.editable;if(T!==!1){if(((nt=l==null?void 0:l.keyFields)==null?void 0:nt.trim().length)>0){if(($t=l==null?void 0:l.keyFields)!=null&&$t.includes(He.colDef.colId))return He.data.isNew}else if(((xt=c.KEY_FIELDS)==null?void 0:xt.trim().length)>0&&(Vt=c.KEY_FIELDS)!=null&&Vt.includes(He.colDef.colId))return He.data.isNew;return(Pt=(Dt=He.colDef)==null?void 0:Dt.context)==null?void 0:Pt.editable}else return(wt=(kt=He.colDef)==null?void 0:kt.context)==null?void 0:wt.editable},autoHeaderHeight:!0,enableRowGroup:!a.treeData,rowGroup:a.treeData?void 0:rt==="1"||rt==="2",sort:rt==="2"?"desc":rt==="1"?"asc":void 0,hide:O.IS_VISIBLE!=="1"||O.CUS_IS_VISIBLE!=="1"||(l==null?void 0:l.groupDisplayType)==="multipleColumns"&&(rt==="1"||O.GROUP_SORT_TYPE==="2"),context:{viewOptions:l,columnConfig:O,editable:T,titleInfo:et}},D.filter="agMultiColumnFilter",D.filterParams={filters:[{filter:"agTextColumnFilter",filterParams:{buttons:(l==null?void 0:l.showApplyFilterButton)!==!1?["reset","apply"]:void 0,closeOnApply:l==null?void 0:l.closeOnApplyFilter}},{filter:"agSetColumnFilter",filterParams:{buttons:(l==null?void 0:l.showApplyFilterButton)!==!1?["reset","apply"]:void 0,closeOnApply:l==null?void 0:l.closeOnApplyFilter}}]},O.AUTO_FILTER_CONDITION==="Default"||O.AUTO_FILTER_CONDITION==="Contains"?D.filterParams.defaultOption="contains":O.AUTO_FILTER_CONDITION==="Like"||O.AUTO_FILTER_CONDITION==="StartsWith"?D.filterParams.defaultOption="startsWith":O.AUTO_FILTER_CONDITION==="EndsWith"?D.filterParams.defaultOption="endsWith":D.filterParams.defaultOption="equals";const Oe={};switch(O.CELL_TEXTCOLOR.trim().length>0&&(Oe.color=i.toHexColor(O.CELL_TEXTCOLOR)),O.CELL_BACKCOLOR.trim().length>0&&(Oe.background=i.toHexColor(O.CELL_BACKCOLOR)),i.toNumber(O.CELL_FONTSIZE)>0&&(Oe.fontSize=`${i.toNumber(O.CELL_FONTSIZE)}px`),ye?Oe.whiteSpace="pre-wrap":O.SUMMARY_TYPE.includes("&")&&(Oe.whiteSpace="pre"),O.HALIGNMENT){case"Center":Oe.textAlign="center",Oe.justifyContent="center",ge==="boolean"&&(Oe.display="flex",Oe.justifyContent="center");break;case"Far":Oe.textAlign="right",Oe.justifyContent="flex-end",ge==="boolean"&&(Oe.display="flex",Oe.justifyContent="flex-end");break;case"Near":Oe.textAlign="left",Oe.justifyContent="flex-start",ge==="boolean"&&(Oe.display="flex",Oe.justifyContent="flex-start");break;default:{ge==="number"?(Oe.textAlign="right",Oe.justifyContent="flex-end"):ge==="datetime"?(Oe.textAlign="center",Oe.justifyContent="center"):ge==="boolean"&&(Oe.display="flex",Oe.justifyContent="center");break}}switch(O.VALIGNMENT){case"Top":break;case"Bottom":break;default:{Oe.display="flex",Oe.alignItems="center";break}}S===void 0&&!D.hide&&(S=D),M===void 0&&!D.hide&&((this.IsRtl&&D.pinned)==="right"||!this.IsRtl&&D.pinned==="right")&&(M=D),D.context.dataType=ge,D.context.cellStyles=Oe;const We=this._gridOptions[e].styleConfigInfo.cellStyle[O.ITEM_CODE];if((Object.keys(Oe).length>0||We)&&(D.cellStyle=He=>{var je,lt,Tt,yt;const de={...He.colDef.context.cellStyles};if(He.data&&!((je=He.node)!=null&&je.rowPinned)&&(We==null?void 0:We.length)>0)for(let gt=0;gt<We.length;gt++){const ht=We[gt];if((((lt=ht.condition)==null?void 0:lt.trim().length)===0||ht.condition.trim().replaceAll(" ","")==="1=1"||i.checkExpressionValid(He.data,n.Core.getSystemFormatString(ht.condition)))&&(ht.type==="Foreground"||ht.type==="W_Fore"?de.color=i.toHexColor(ht.fillColor):(ht.type==="Background"||ht.type==="W_Back")&&(de.background=i.toHexColor(ht.fillColor)),ht.fontStyle&&ht.fontStyle.trim().length>0))switch(ht.fontStyle){case"Bold":de.fontWeight="bold";break;case"Italic":de.fontStyle="italic";break;case"Strikeout":de.textDecoration="line-through";break;case"Underline":de.textDecoration="underline";break}}return(Tt=He.node)!=null&&Tt.group&&(de.fontWeight="bold"),(yt=He.node)!=null&&yt.rowPinned&&(de.fontWeight="bold",delete de.color,delete de.background),de}),g&&g[O.FIELD_NAME]){const He=de=>{let je="";return de==null||(typeof de=="string"?je=i.toString(de):typeof de=="number"?je=i.formatNumberValue(de,""):mo.isPlainObject(de)&&(je=`☑️ ${i.formatNumberValue(de.aggValueOfChecked,"")}
37
37
  ∑ ${i.formatNumberValue(de.aggValue,"")}`)),je};if(D.valueFormatter=de=>{if(de.value)return He(de.value)},(O.CALL_FORM.trim().length>0||(l==null?void 0:l.allowHtmlTags)===!0||(J=l==null?void 0:l.allowHtmlTags)!=null&&J.includes(O.ITEM_CODE))&&(D.cellRenderer=de=>{var je;if(de.node.rowPinned)return He(de.node.data[de.colDef.colId]);if(de.value){let lt=He(de.value);return((l==null?void 0:l.allowHtmlTags)===!0||(je=l==null?void 0:l.allowHtmlTags)!=null&&je.includes(O.ITEM_CODE))&&(lt=lt.replaceAll("<br>",`