@newview/base-vue 1.2.9 → 1.3.1

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/dist/base-vue.js CHANGED
@@ -96,6 +96,53 @@ class OtherCommon {
96
96
  constructor() {
97
97
  __publicField(this, "utilities", new Utilities());
98
98
  __publicField(this, "storageInfo", storageInfo);
99
+ /** 全部权限编码 */
100
+ __publicField(this, "allOpCodes", [
101
+ "LOG",
102
+ "ADD",
103
+ "EDIT",
104
+ "DELETE",
105
+ "VIEW",
106
+ "SAVE",
107
+ "SUBMIT",
108
+ "SAVEANDADD",
109
+ "SUPERDELT",
110
+ "PERMIT",
111
+ "REPORTPRINT",
112
+ "IMPORT",
113
+ "EXPORT",
114
+ "COPY",
115
+ "SEND",
116
+ "recall",
117
+ "revoke"
118
+ ]);
119
+ /**
120
+ * 按钮权限显隐控制
121
+ * @param code
122
+ * @returns
123
+ */
124
+ __publicField(this, "btnIsShowForOp", (code) => {
125
+ if (!window["EnablePermissionOperate"]) {
126
+ return true;
127
+ }
128
+ if (!code) {
129
+ return true;
130
+ }
131
+ let permissionCodes = window["PermissionOperateAllCodes"] ? window["PermissionOperateAllCodes"] : this.allOpCodes;
132
+ code = code.toUpperCase();
133
+ if (permissionCodes.findIndex((e) => e == code) < 0) {
134
+ return true;
135
+ }
136
+ if (window["PermissionOperateEmptyType"] && window["PermissionOperateEmptyType"] == 2 && this.getCurrentModuleOp().length == 0) {
137
+ return true;
138
+ }
139
+ let index = this.getCurrentModuleOp().findIndex((e) => e.toUpperCase() == code);
140
+ if (index > -1) {
141
+ return true;
142
+ } else {
143
+ return false;
144
+ }
145
+ });
99
146
  }
100
147
  /**
101
148
  * 获取进入BIM中心传递参数
@@ -108,6 +155,31 @@ class OtherCommon {
108
155
  projectId: (_b = this.storageInfo.getCurrentPlatform()) == null ? void 0 : _b.Id
109
156
  }), "d2140707ca3a469c8527e546fe961276");
110
157
  }
158
+ /**
159
+ * 获取当前模块操作权限
160
+ * @returns
161
+ */
162
+ getCurrentModuleOp() {
163
+ let operates = [];
164
+ let currentModule = localStorage.getItem("currentModule");
165
+ if (currentModule) {
166
+ try {
167
+ currentModule = JSON.parse(currentModule);
168
+ if (currentModule.Operates) {
169
+ operates = JSON.parse(currentModule.Operates);
170
+ } else if (currentModule.operates) {
171
+ operates = currentModule.operates.split(",");
172
+ } else {
173
+ operates = [];
174
+ }
175
+ } catch (error) {
176
+ operates = [];
177
+ }
178
+ } else {
179
+ operates = window["PermissionOperateAllCodes"] ? window["PermissionOperateAllCodes"] : this.allOpCodes;
180
+ }
181
+ return operates;
182
+ }
111
183
  }
112
184
  class BaseInstance {
113
185
  constructor() {