You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
6.9 KiB

var D=Object.defineProperty;var p=(w,t,r)=>t in w?D(w,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):w[t]=r;var a=(w,t,r)=>(p(w,typeof t!="symbol"?t+"":t,r),r);var l=(w,t,r)=>new Promise((e,n)=>{var u=c=>{try{E(r.next(c))}catch(m){n(m)}},s=c=>{try{E(r.throw(c))}catch(m){n(m)}},E=c=>c.done?e(c.value):Promise.resolve(c.value).then(u,s);E((r=r.apply(w,t)).next())});import{W as N,Y as d,$ as y}from"./index-f4658ae7.js";import{GPNReturnObj as i,GPNReturnType as o}from"./PageBaseGroupNew-ee20c033.js";import{D as f}from"./DataType-33901a1c.js";import{FieldType as B}from"./EnumLab-3cbd0812.js";import"./Group-ab70f402.js";import"./Page-34b19d96.js";import"./EnumLab-d43291c1.js";import"./ParamUtils-cdc24dd6.js";import"./SystemConfig-b93c25b3.js";import"./bignumber-cf158d26.js";import"./ParamsUtils-3cbc5822.js";class x{constructor(t){a(this,"NodeIconOpen","/cion");a(this,"NodeIconClose","/cion");a(this,"IsLazy",!1);a(this,"TreeEns");a(this,"DtlEns");a(this,"DtlEnsGroupBy","");a(this,"PageTitle","\u5206\u7EC4\u5B9E\u4F53");a(this,"ClassID");a(this,"RootNo","");a(this,"RefKey","FK_Dept");a(this,"BtnsOfToolbar","");a(this,"BtnsOfTableTop","\u6279\u91CF\u5220\u9664");a(this,"BtnsOfItemOptions","\u7F16\u8F91,\u5220\u9664");a(this,"Welcome","\u6B22\u8FCE\u4F7F\u7528\u9A70\u9A8B\u8F6F\u4EF6.");a(this,"Columns",[]);a(this,"IsEnMove",!1);a(this,"IsTreeEnMove",!1);a(this,"IsPartTimeJob",!1);this.ClassID=t}RequestVal(t){return N(t)}Init(t="0"){return l(this,null,function*(){this.RootNo=t})}GoToPage(t){let r=t.replace(/.vue/g,"");if(r.startsWith("/@/")){window.location.replace(r);return}if(r.startsWith("/WF/")){r="/#"+t,window.location.replace(r);return}throw new Error("\u975E\u6CD5url")}ItemMoveDtl(t){return l(this,null,function*(){var s;if(((s=this.DtlEns)==null?void 0:s.GetNewEntity)==null)return;const e=new y("BP.WF.HttpHandler.WF_CommTS"),n="Port_Emp",u="No";e.AddPara("PTable",n),e.AddPara("PK",u),e.AddPara("PKs",t),yield e.DoMethodReturnString("TreeEns_UpdatIdx")})}Node_Delete(t,r){return l(this,null,function*(){var e;try{if(this.TreeEns==null)return;const n=(e=this.TreeEns)==null?void 0:e.GetNewEntity;return(yield this.GetDataByTreeNodeID(t)).length>0?new i(o.Error,"\u5F53\u524D\u8282\u70B9\u5B58\u5728\u6570\u636E\uFF0C\u4E0D\u80FD\u5220\u9664\uFF01"):r!=null&&r.children&&(r==null?void 0:r.children.length)>0?new i(o.Error,"\u5F53\u524D\u8282\u70B9\u5B58\u5728\u5B50\u8282\u70B9\uFF0C\u4E0D\u80FD\u5220\u9664\uFF01"):(n.setPKVal(t),yield n.Retrieve(),yield n==null?void 0:n.Delete(),new i(o.Message,"\u5220\u9664\u6210\u529F"))}catch(n){alert(n);return}})}Node_Edit(t){return l(this,null,function*(){var n;if(this.TreeEns==null)return;const e=`/@/WF/Comm/En.vue?EnName=${(n=this.TreeEns)==null?void 0:n.GetNewEntity.classID}&PKVal=${t}`;return new i(o.OpenUrlByDrawer,e)})}Dtl_New(t){var n;if(this.DtlEns==null)return;const e=`/@/WF/Comm/En.vue?EnName=${(n=this.DtlEns)==null?void 0:n.GetNewEntity.classID}&${this.RefKey}=${t}`;return new i(o.OpenUrlByDrawer,e)}Items_Delete(t="",r=""){return l(this,null,function*(){var u;if(!t)return d.warning("\u8BF7\u9009\u62E9\u8981\u5220\u9664\u7684\u6570\u636E."),new i(o.DoNothing);if(!window.confirm("\u60A8\u786E\u5B9A\u8981\u5220\u9664["+t+"]\u5417\uFF1F"))return new i(o.DoNothing,null);const e=(u=this.DtlEns)==null?void 0:u.GetNewEntity;if(!e)return new i(o.Message,"\u6CA1\u6709\u83B7\u5F97\u5230EN"+this.DtlEns);const n=t.split(",");for(const s of n){e==null||e.setPKVal(s);try{yield e.RetrieveFromDBSources(),yield e.Delete(),d.info("\u6210\u529F\u5220\u9664"+s)}catch(E){d.error("\u5220\u9664\u5931\u8D25:"+E)}}return new i(o.Update,null)})}Item_Edit(t){return l(this,null,function*(){var n;if(this.TreeEns==null)return;const e=`/@/WF/Comm/En.vue?EnName=${(n=this.DtlEns)==null?void 0:n.GetNewEntity.classID}&PKVal=${t}`;return new i(o.OpenUrlByDrawer,e)})}Node_CreateSameLevelNode(t,r){return l(this,null,function*(){var e;try{if(this.TreeEns==null)return;if(r.ParentNo=="0"&&r.No=="100")return d.info("\u5F53\u524D\u8282\u70B9\u4E3A\u6839\u8282\u70B9\uFF0C\u4E0D\u80FD\u521B\u5EFA\u540C\u7EA7\u76EE\u5F55\uFF01");const n=window.prompt("\u8BF7\u8F93\u5165\u540C\u7EA7\u8282\u70B9\u540D\u79F0","");if(!n)return;const u=(e=this.TreeEns)==null?void 0:e.GetNewEntity;return u.setPKVal(t),u.No=t,yield u.Retrieve(),u.No="",u.Name=n,u.Idx=u.Idx+1,yield u.Insert(),new i(o.DoNothing,u)}catch(n){return new i(o.Message,n.toString())}})}Node_CreateChildNode(t){return l(this,null,function*(){var r;try{if(this.TreeEns==null)return;const e=window.prompt("\u8BF7\u8F93\u5165\u5B50\u7EA7\u8282\u70B9\u540D\u79F0","");if(!e)return;const n=(r=this.TreeEns)==null?void 0:r.GetNewEntity;return n.setPKVal(t),yield n.Retrieve(),n.No="",n.Name=e,n.ParentNo=t,yield n.Insert(),new i(o.DoNothing,n)}catch(e){alert(e);return}})}Node_ChangeNodeName(t,r){return l(this,null,function*(){var e;try{if(this.TreeEns==null)return;const n=window.prompt("\u8BF7\u8F93\u5165\u5B50\u7EA7\u8282\u70B9\u540D\u79F0",r);if(!n)return;const u=(e=this.TreeEns)==null?void 0:e.GetNewEntity;return u.setPKVal(t),yield u.Retrieve(),u.Name=n,yield u.Update(),new i(o.DoNothing,u)}catch(n){alert(n);return}})}ItemMoveTree(t,r){return l(this,null,function*(){var u;const e=(u=this.TreeEns)==null?void 0:u.GetNewEntity;if(!e)return new i(o.Message,"\u6CA1\u6709\u627E\u5230\u8282\u70B9");const n=t.split(",");for(let s=0;s<n.length;s++){const E=n[s];e==null||e.setPKVal(E),yield e==null?void 0:e.RetrieveFromDBSources(),e.ParentNo=r,e.Idx=s,yield e==null?void 0:e.Update()}return new i(o.Message,"\u79FB\u52A8\u6210\u529F")})}ItemMoveTree_old(t,r,e=!1,n=""){return l(this,null,function*(){var h,F;const u=(h=this.TreeEns)==null?void 0:h.GetNewEntity;if(!u)return;if(u.No=t,yield u.Retrieve(),e==!0){u.ParentNo=r,yield u.Update();return}const s=(F=this.TreeEns)==null?void 0:F.GetNewEntity;if(!s)return;s.No=r,yield s.Retrieve(),u.Idx=s.Idx-1,u.ParentNo=s.ParentNo,yield u.Update();const E=new y("BP.WF.HttpHandler.WF_CommTS"),c=u._enMap.PhysicsTable,m=u.PK;return E.AddPara("PTable",c),E.AddPara("PK",m),E.AddPara("PKs",n),yield E.DoMethodReturnString("TreeEns_UpdatIdx"),null})}RemoveDtlItems(t){if(t)return null}GetDataByTreeNodeID(t,r){return l(this,null,function*(){const e=this.DtlEns;if(!e||r)return[];const n=this.GetDtls(t);if(n!=null)return n;e.GetNewEntity.EnMap.attrs.find(s=>s.Key==="Idx")?yield e.Retrieve(this.RefKey,t,"Idx"):yield e.Retrieve(this.RefKey,t)})}GetDtls(t){return Promise.resolve(null)}GetChildren(t){return l(this,null,function*(){var r;return yield(r=this.TreeEns)==null?void 0:r.Retrieve("ParentNo",t),this.TreeEns})}SearchKeyWord(t){return l(this,null,function*(){if(!this.DtlEns)return[];if(yield this.DtlEns.Init(),t.trim()==="")return d.warning("\u8BF7\u8F93\u5165\u5173\u952E\u5B57"),[];const n=this.DtlEns.GetNewEntity._enMap.attrs.filter(u=>u.MyFieldType===B.Normal&&u.MyDataType===f.AppString&&u.Key!=="OrgNo"&&!u.IsDateField).map(u=>u.Key);return yield this.DtlEns.RetrieveLikeKey(t,n.join(",")),this.DtlEns})}}export{x as PageBaseTreeEns};