@baosight/erm 1.0.13 → 1.0.15
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.
- package/lib/index.d.ts +2 -4
- package/lib/index.esm.js +1 -1
- package/package.json +3 -3
- package/lib/index.css +0 -1
- package/lib/index.esm.css +0 -24
package/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
-
import './
|
|
3
|
-
|
|
4
|
-
import EFM from './use/eiService';
|
|
5
|
-
export { useFormStore, EFM };
|
|
2
|
+
import CPage from './cButton';
|
|
3
|
+
export { CPage };
|
|
6
4
|
declare const _default: {
|
|
7
5
|
install: (app: App<any>) => void;
|
|
8
6
|
};
|
package/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineComponent as t,ref as e,watch as a,provide as o,useAttrs as n,useSlots as s,computed as r,resolveComponent as i,openBlock as c,createElementBlock as l,normalizeClass as m,renderSlot as u,createBlock as d,mergeProps as h,createCommentVNode as p,createElementVNode as f,toDisplayString as E,pushScopeId as N,popScopeId as g,inject as P,withCtx as A,createTextVNode as v}from"vue";import{useRouter as I}from"vue-router";import{getCurrentEnvironment as C,getRememberMe as M,EIManager as _,setRememberMe as O,setToken as k,setRefreshToken as b,setCurrentUser as T,buildEIInfo as S,setCurrentEnvironment as L,removeToken as y,removeRefreshToken as D,removeCurrentUser as B,EI as R,getCurrentUser as w}from"@baosight/ei";import{Toast as F,Button as U,Empty as G,NavBar as $}from"vant";import{JSEncrypt as x}from"jsencrypt";import{defineStore as Y}from"pinia";const H=process.env.VUE_LOGIN_CONFIG,K=(process.env.VITE_APP_TITLE,process.env.VITE_APP_COMPANY_CODE),j=process.env.VITE_APP_APPLICATION_NAME;class q{static apps=[];static companies=[];static currentEnvironment=C()||{skinName:"",culture:"",companyCode:"",companyName:"",appName:""};static loginStatus="";static formState={authButtons:void 0,formInfo:void 0,formParamInfo:void 0,formData:void 0,buttonData:void 0,buttonLoaded:!1,hasAuthority:!1};static setLoginStatus(t){this.loginStatus=t,localStorage.setItem("login_status",t)}static getCurLoginStatus(){return this.loginStatus=M()?localStorage.getItem("login_status"):this.loginStatus,this.loginStatus}static changeLoginStatus(t){this.loginStatus=t,localStorage.setItem("login_status",t)}static LOGIN(t){const e=H.ENABLE_ENCRYPTED?"EX/encryptLogin":"EX/Login";if(t={...t,RememberMeTime:24*(t.RememberMeTime||1)},H.ENABLE_ENCRYPTED){const e=new x({});e.setPublicKey(H.PUBLIC_KEY);const a=e.encrypt(t.Password),o=e.encrypt(t.UserName);t.UserName=o,t.Password=a}return _.handlePost(e,t).then((e=>{let a,o,n=!0,s=!1;const r=e.headers,i=r.signature,c=r.refresh_token,l=e.data,{status:m,msg:u}=l;if(0===m||20003===m){const t=l.getBlock("UserInfo");t||F({message:"获取用户信息失败",duration:1e3});const e=t.data.length?t.data[0]:{};o={id:e.ID,userId:e.ENAME,userName:e.CNAME,deptId:e.DEPTID,deptEName:e.DEPT_ENAME,deptCName:e.DEPT_CNAME},n=!1,s=20003===m}return a={code:m,token:i,refreshToken:c,userInfo:o,msg:u,isError:n,pwdOut:s},t.RememberMe&&O(!0),i&&(this.setLoginStatus("LOGIN"),k(i)),c&&b(c),a})).catch((t=>Promise.reject(t)))}static GET_USER(t){return _.handlePost("EX/api/GetUserInfo",t).then((t=>{let e;const a=t.data,{status:o,msg:n}=a;if(0===o){const t=a.getBlock("UserInfo");t||F({message:"获取用户信息失败",duration:1e3});const o=t.data.length?t.data[0]:{};return e={id:o.ID,userId:o.ENAME,userName:o.CNAME,deptId:o.DEPTID,deptEName:o.DEPT_ENAME,deptCName:o.DEPT_CNAME},T(e),!0}return F({message:`${n}`,duration:1e3}),!1})).catch((t=>Promise.reject(t)))}static GET_MENUS(t){const e=S(t);return _.callEPService("epesloadinit_vue",e).then((t=>{let e=[];try{const{msg:a,status:o}=t;return 0===o?(e=t.blocks.MENUTREE.data,e):(F({message:`调用菜单服务失败,错误信息:${a}.`,duration:1e3}),e)}catch(t){return F({message:`调用菜单服务失败,错误信息:${t}.`,duration:1e3}),t}}))}static GET_COMPANIES(){return _.handleGet("EX/GetCompanies").then((t=>{const e=t.blocks.COMPANYINFO.data;return this.companies=e,e})).catch((t=>Promise.reject(t)))}static GET_APPS(){return _.handleGet("EX/GetApps").then((t=>{const e=t.blocks.APPINFO.data;return this.apps=e,e})).catch((t=>Promise.reject(t)))}static INITAPP_CONFIG(){let t={COMPANYCODE:"",COMPANYNAME:""},e="";Promise.all([this.GET_COMPANIES(),this.GET_APPS()]).then((([a,o])=>{if(a.length){const e=this.companies;let a=e.length>0?e[0]:{COMPANYID:"",COMPANYCODE:"",COMPANYNAME:""};if(K){const t=e.filter((t=>t.COMPANYCODE===K));a=t.length?t[0]:e[0]}t={...a}}if(o.length){const t=this.apps;let a=t.length>0?t[0].ENAME:"";if(j){const e=t.filter((t=>t.ENAME===j));a=e.length>0?e[0].ENAME:t.length>0?t[0].ENAME:""}e=a}if(e&&t){let a=C();a={...a,culture:"zh_Hans",companyCode:t.COMPANYCODE,companyName:t.COMPANYNAME,appName:e,skinName:"default"},O(!0),L(a,!0),this.currentEnvironment=a}})).catch((t=>{const{message:e,status:a}=t;e&&F({message:`获取账套或子系统失败,错误信息:${e}.`,duration:1e3})}))}static LOGOUT(){return new Promise(((t,e)=>{this.changeLoginStatus("LOGOUT"),y(),D(),B(),t(!0)}))}static exchangeSignature(t){return _.handlePost("/proxyEx/exchangeSignature_BW",t).then((t=>{const e=t.data,{flag:a,signature:o}=e;if(0!==a)return Promise.reject({message:"宝武交换token出错啦"});O(!0),k(o)})).catch((t=>Promise.reject(t)))}static CHECK_AUTH(t){return new Promise((async(e,a)=>{t.formname.toLowerCase();const o=new R.EIInfo;o.addBlock(new R.EiBlock,"Table1").pushData(t,!0),_.callEPService("epescheckdll",o).then((t=>{const{status:a,msg:o}=t;let n=!1;if(0!==a){const t=new Error(`${o}`);throw t.status=100401,t}{const a=t.blocks.AUTH_INFO,o=t.blocks.BUTTON_INFO,s=t.blocks.FORMPARA_INFO,r=t.blocks.FORMDLL_INFO.data,i=r.length?r[0]:void 0;if(i){const t={formName:i.NAME,formCaption:i.DESCRIPTION,formPartition:i.ABBREV,appName:i.APPNAME,formPath:i.DLLPATH,dllName:i.DLLNAME,formCallMode:i.FORM_CALL_MODE};let e=o.data.map((t=>({name:t.NAME,desc:t.DESCRIPTION,opType:t.OPTYPE})));e=[...new Map(e.map((t=>[t.name,t]))).values()];const[{DLLMARK:r}]=a.data;n=Number(r?.toString().trim())>=1;const c=s.data.length&&s.data[0];let l;if(c&&c.FORM_NAME&&""!==c.FORM_NAME.trim()){l={params:{},baseFormName:c.FORM_BASE_NAME};for(let t=1;t<=10;t++){const e=c[`PK${t}_NAME`];null!==e&&""!==e.trim()&&(l.params[c[`PK${t}_NAME`]+""]=c[`PK${t}`])}}this.formState.formInfo=t,this.formState.authButtons=e,this.formState.hasAuthority=n,this.formState.formParamInfo=l,this.formState.buttonLoaded=!0}e(this.formState)}})).catch((t=>{a(t)}))}))}static LOGIN_CHECK(t){const e=S(t);return _.handlePost("/MASTER/api/CallService/epeslogincheck",e).then((t=>{const e=t.data;console.log(e);const{status:a,sys:o}=e;return console.log(a),0===a?Promise.resolve(e):Promise.reject(o)})).catch((t=>Promise.reject(t)))}}var V=t({name:"CPage",components:{"van-button":U,"van-empty":G,"van-nav-bar":$},props:{title:{type:String,default:""},hideBack:{type:Boolean,default:!1},rightText:{type:String,default:""},hideHeader:{type:Boolean,default:!1},safeAreaInsetTop:{type:Boolean,default:!0},safeAreaInsetBottom:{type:Boolean,default:!0}},setup(t,{attrs:i,emit:c}){let l=e("");a((()=>l),(t=>{document.title=t}));let m=e("");const u=I();let d=e(!1),h=u.currentRoute.value.path,p=e(null);o("buttons",p);const f=q.formState;f.authButtons=[],async function(){let t=f.formInfo;console.log(t);let e=h.substring(h.lastIndexOf("/")+1);e=e.toUpperCase();const a=w();await q.CHECK_AUTH({formname:e,appname:C().appName,path:h,loginName:a.userId}).then((t=>{d.value=!1,l.value=f.formInfo.formCaption,p.value=f.authButtons})).catch((t=>{d.value=!0,l.value="404";const{message:e,status:a}=t;401===a||403===a?m.value="凭据过期,请重新认证登录信息":void 0!==e&&(m.value=`${e}`)}))}();const E=n(),N={};Object.entries(E).forEach((([t,e])=>{"class"!==t&&(N[t]=e)}));const g=e(!1),P=s();P&&P.default&&P.default().forEach((t=>{const e=t.type;e.name&&"x-navigation"===e.name&&(g.value=!0)}));const A=r((()=>({height:"calc(100vh - 46)px"})));return{title:l,clickLeft:()=>{u.back()},newAttr:N,onClickRight:()=>{c("click-right")},noAuthDesc:m,show404Panel:d,containerStyle:A}}});const z={key:1,style:{"text-align":"center","margin-top":"20%"}},X=(t=>(N("data-v-7700e381"),t=t(),g(),t))((()=>f("img",{src:"/src/assets/img/404.png",style:{width:"100%"}},null,-1)));V.render=function(t,e,a,o,n,s){const r=i("van-nav-bar");return c(),l("div",{class:m(t.show404Panel?"not-found":"c-page")},[u(t.$slots,"header",{},(()=>[t.hideHeader?p("v-if",!0):(c(),d(r,h({key:0,class:"xm-title",title:t.title,onClickLeft:t.clickLeft},t.newAttr,{"left-arrow":!t.hideBack,"right-text":t.rightText,onClickRight:t.onClickRight,"safe-area-inset-top":""}),null,16,["title","onClickLeft","left-arrow","right-text","onClickRight"]))])),t.show404Panel?p("v-if",!0):(c(),l("div",{key:0,class:m(["page-container",{"safe-area-bottom":t.safeAreaInsetBottom}])},[u(t.$slots,"default")],2)),t.show404Panel?(c(),l("div",z,[X,f("h3",null,E(t.noAuthDesc),1)])):p("v-if",!0)],2)},V.__scopeId="data-v-7700e381",V.__file="packages/CPage/CPage.vue";const W=t=>(t.install=e=>{const a=t.name||t.__name;e.component(a,t)},t),J=W(V);var Q=t({name:"CButton",components:{"van-button":U},props:{name:{required:!0,type:String},disabled:{type:Boolean,default:!1,required:!1},size:{type:String,default:"small",required:!1}},setup(t,{attrs:o,emit:n}){let s=P("buttons",[]);console.log(s.value);let r=e(!1);const i=e("");a(s,(e=>{const a=e?.find((e=>e.name.trim()===t.name.trim()));a&&(i.value=a.desc,r.value=!0)}));return{visible:r,clickHandle:()=>{n("c-click")},buttonDesc:i}}});Q.render=function(t,e,a,o,n,s){const r=i("van-button");return t.visible?(c(),d(r,{key:0,type:"primary",disabled:t.disabled,size:t.size,onClick:t.clickHandle},{default:A((()=>[v(E(t.buttonDesc),1)])),_:1},8,["disabled","size","onClick"])):p("v-if",!0)},Q.__file="packages/CButton/CButton.vue";const Z=W(Q);var tt=t({name:"CButtonAuth",props:{name:{required:!0,type:String}},setup(t){let o=P("buttons",[]);console.log(o.value);let n=e(!1);return a(o,(e=>{const a=e?.find((e=>e.name.trim()===t.name.trim()));a&&(console.log(a),n.value=!0)})),{visible:n}}});const et={key:0};tt.render=function(t,e,a,o,n,s){return t.visible?(c(),l("div",et,[u(t.$slots,"default")])):p("v-if",!0)},tt.__file="packages/CButtonAuth/CButtonAuth.vue";const at=W(tt),ot={authButtons:void 0,formInfo:void 0,formParamInfo:void 0,formData:void 0,buttonData:void 0,buttonLoaded:!1,hasAuthority:!1},nt=Y("form",{state:()=>ot,actions:{async checkAuth(t){return new Promise((async(e,a)=>{t.formname.toLowerCase();const o=new R.EIInfo;o.addBlock(new R.EiBlock,"Table1").pushData(t,!0),_.callEPService("epescheckdll",o).then((t=>{const{status:a,msg:o}=t;let n=!1;if(0!==a){const t=new Error(`${o}`);throw t.status=100401,t}{const a=t.blocks.AUTH_INFO,o=t.blocks.BUTTON_INFO,s=t.blocks.FORMPARA_INFO,r=t.blocks.FORMDLL_INFO.data,i=r.length?r[0]:void 0;if(i){const t={formName:i.NAME,formCaption:i.DESCRIPTION,formPartition:i.ABBREV,appName:i.APPNAME,formPath:i.DLLPATH,dllName:i.DLLNAME,formCallMode:i.FORM_CALL_MODE};let e=o.data.map((t=>({name:t.NAME,desc:t.DESCRIPTION,opType:t.OPTYPE})));e=[...new Map(e.map((t=>[t.name,t]))).values()];const[{DLLMARK:r}]=a.data;n=Number(r?.toString().trim())>=1;const c=s.data.length&&s.data[0];let l;if(c&&c.FORM_NAME&&""!==c.FORM_NAME.trim()){l={params:{},baseFormName:c.FORM_BASE_NAME};for(let t=1;t<=10;t++){const e=c[`PK${t}_NAME`];null!==e&&""!==e.trim()&&(l.params[c[`PK${t}_NAME`]+""]=c[`PK${t}`])}}this.$patch((a=>{a.formInfo=t,a.authButtons=e,a.hasPermission=n,a.formParamInfo=l,a.buttonLoaded=!0}))}e(n)}})).catch((t=>{a(t)}))}))},checkDll:async t=>new Promise(((e,a)=>{let o="";o=t.query?.formName?t.query?.formName:t.path.substring(t.path.lastIndexOf("/")+1);const n={formname:o&&o.toString().toUpperCase()||"",appname:C().appName},s=new R.EIInfo;s.addBlock(new R.EiBlock,"Table1").pushData(n,!0),_.callEPService("epescheckdll",s).then((t=>{const{status:o,msg:n}=t;0===o?e(t):a(`调用校验权限服务出现错误,${n}`)})).catch((t=>a(t)))}))}}),st=[J,Z,at];var rt={install:t=>{st.map((e=>t.component(e.name,e)))}};export{q as EFM,rt as default,nt as useFormStore};
|
|
1
|
+
import{openBlock as n,createElementBlock as t}from"vue";const e={render:function(e,a){return n(),t("div",null,"cButton")},__file:"packages/cButton/cButton.vue",install:n=>{n.component(e.name,e)}},a=[e];var o={install:n=>{a.map((t=>n.component(t.name,t)))}};export{e as CPage,o as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baosight/erm",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Baosight
|
|
3
|
+
"version": "1.0.15",
|
|
4
|
+
"description": "Baosight erm Framework",
|
|
5
5
|
"module": "lib/index.esm.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"keywords": [],
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build:lib": "vue-cli-service build --target lib --name index --dest lib packages/index.ts",
|
|
18
18
|
"build:esm-bundle": "rollup --config rollup.config.js",
|
|
19
19
|
"upload": "npm publish --access=public",
|
|
20
|
-
"deploy": "bash build/baosight.
|
|
20
|
+
"deploy": "bash build/baosight.erm.sh",
|
|
21
21
|
"clean": "rimraf package-lock.json && rimraf node_modules",
|
|
22
22
|
"link:lib": "yarn build && yalc publish -push",
|
|
23
23
|
"commit": "cz",
|
package/lib/index.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.c-page[data-v-438a968c]{display:flex;flex-direction:column;width:100vw;height:100vh;margin:0 auto}.page-container[data-v-438a968c]{flex-grow:1;overflow:hidden;overflow-y:auto}.not-found[data-v-438a968c]{position:absolute;top:0;bottom:0;background-color:#fff}.bottom-button[data-v-438a968c]{padding:0 48px}
|
package/lib/index.esm.css
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
.c-page[data-v-7700e381] {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
width: 100vw;
|
|
5
|
-
height: 100vh;
|
|
6
|
-
margin: 0 auto;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.page-container[data-v-7700e381] {
|
|
10
|
-
flex-grow: 1;
|
|
11
|
-
overflow: hidden;
|
|
12
|
-
overflow-y: auto;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.not-found[data-v-7700e381] {
|
|
16
|
-
position: absolute;
|
|
17
|
-
top: 0;
|
|
18
|
-
bottom: 0;
|
|
19
|
-
background-color: white;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.bottom-button[data-v-7700e381] {
|
|
23
|
-
padding: 0 48px;
|
|
24
|
-
}
|