@witlink/usercenter 1.2.75 → 1.2.76

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.
@@ -307,12 +307,12 @@ const useUserStore = defineStore(`${TOKEN_PREFIX}user`, {
307
307
  });
308
308
  },
309
309
  setUserInfo(result) {
310
- var _a;
310
+ var _a, _b;
311
311
  const curButtonPermission = {};
312
- if (result.role && ((_a = result.role.permissions) == null ? void 0 : _a.length) > 0) {
312
+ if (result.role) {
313
313
  const role = result.role;
314
314
  const otherRoles = result.otherRoles;
315
- role.permissions.map((per) => {
315
+ (_a = role.permissions) == null ? void 0 : _a.forEach((per) => {
316
316
  var _a2;
317
317
  if (per.actionEntitySet != null && ((_a2 = per.actionEntitySet) == null ? void 0 : _a2.length) > 0) {
318
318
  const action = per.actionEntitySet.map((action2) => {
@@ -322,9 +322,9 @@ const useUserStore = defineStore(`${TOKEN_PREFIX}user`, {
322
322
  curButtonPermission[per.permissionId] = action;
323
323
  }
324
324
  });
325
- role.permissionList = role.permissions.map((permission2) => {
325
+ role.permissionList = ((_b = role.permissions) == null ? void 0 : _b.map((permission2) => {
326
326
  return permission2.permissionId;
327
- });
327
+ })) || [];
328
328
  const mainWarehouseManager = role.roleTypeId === "0";
329
329
  const othersWarehouseManager = otherRoles ? otherRoles.some((item) => item.roleTypeId === "0") : false;
330
330
  const isWarehouseManager = mainWarehouseManager || othersWarehouseManager;
@@ -346,8 +346,6 @@ const useUserStore = defineStore(`${TOKEN_PREFIX}user`, {
346
346
  this.isWarehouseManager = isWarehouseManager;
347
347
  this.avatar = "usercenter/" + result.avatar;
348
348
  this.passwordSecurityLevel = result.passwordSecurityLevel;
349
- } else {
350
- storage.remove(ACCESS_TOKEN);
351
349
  }
352
350
  },
353
351
  setIsLock(val) {
@@ -13047,11 +13045,14 @@ const usePasswordStrength = () => {
13047
13045
  };
13048
13046
  };
13049
13047
  const _hoisted_1$k = { class: "pwd-strength-tip" };
13048
+ const FORCE_RESET_PWD_SYNC_KEY$1 = "forceResetPwdSync";
13050
13049
  const _sfc_main$J = /* @__PURE__ */ defineComponent({
13051
13050
  __name: "ForceResetPwdModal",
13052
- setup(__props, { expose: __expose }) {
13051
+ emits: ["success"],
13052
+ setup(__props, { expose: __expose, emit: __emit }) {
13053
13053
  const { t: t2 } = useI18n();
13054
13054
  const { passwordStrengthTip, validate } = usePasswordStrength();
13055
+ const emit = __emit;
13055
13056
  const formRef = ref();
13056
13057
  const form = reactive({
13057
13058
  oldPwd: "",
@@ -13108,13 +13109,16 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
13108
13109
  resetCallback = callback || null;
13109
13110
  visible.value = true;
13110
13111
  };
13111
- const onReset = () => {
13112
+ const resetForm = () => {
13112
13113
  Object.assign(form, {
13113
13114
  oldPwd: "",
13114
13115
  newPwd: "",
13115
13116
  userPwd1: ""
13116
13117
  });
13117
13118
  };
13119
+ const onReset = () => {
13120
+ resetForm();
13121
+ };
13118
13122
  const onSubmit = () => {
13119
13123
  formRef.value && formRef.value.validate().then(async () => {
13120
13124
  loading.value = true;
@@ -13124,20 +13128,17 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
13124
13128
  };
13125
13129
  try {
13126
13130
  const res = await updatePassword(paramsData);
13127
- if (res.code === 0) {
13131
+ if (res.code == 0) {
13128
13132
  visible.value = false;
13129
- Object.assign(form, {
13130
- oldPwd: "",
13131
- newPwd: "",
13132
- userPwd1: ""
13133
- });
13133
+ resetForm();
13134
13134
  message.success({
13135
13135
  content: t2("uc_user.resetPwdSucc")
13136
13136
  });
13137
+ storage.set(FORCE_RESET_PWD_SYNC_KEY$1, Date.now());
13138
+ emit("success");
13137
13139
  if (resetCallback) {
13138
13140
  resetCallback();
13139
13141
  }
13140
- window.dispatchEvent(new CustomEvent("forceResetPwdSuccess"));
13141
13142
  }
13142
13143
  } finally {
13143
13144
  loading.value = false;
@@ -38818,7 +38819,6 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
38818
38819
  default: withCtx(() => [
38819
38820
  createVNode(_component_a_textarea, {
38820
38821
  placeholder: _ctx.$t("uc_organ.parentBranch"),
38821
- maxLength: 256,
38822
38822
  disabled: "",
38823
38823
  value: form.parentBranch,
38824
38824
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => form.parentBranch = $event),
@@ -38834,7 +38834,6 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
38834
38834
  default: withCtx(() => [
38835
38835
  createVNode(_component_a_textarea, {
38836
38836
  placeholder: _ctx.$t("uc_organ.superiorRegion"),
38837
- maxLength: 256,
38838
38837
  disabled: "",
38839
38838
  value: form.parentRegion,
38840
38839
  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => form.parentRegion = $event),
@@ -39126,7 +39125,6 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
39126
39125
  default: withCtx(() => [
39127
39126
  createVNode(_component_a_input, {
39128
39127
  placeholder: _ctx.$t("uc_organ.parentBranch"),
39129
- maxLength: 20,
39130
39128
  disabled: "",
39131
39129
  value: form.parentBranch,
39132
39130
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => form.parentBranch = $event)
@@ -39777,7 +39775,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
39777
39775
  addOrDeleRefresh(activeEditRow.value);
39778
39776
  } else {
39779
39777
  activeEditRow.value.hasChild = true;
39780
- activeEditRow.value.status = 0;
39778
+ activeEditRow.value.deletable = 0;
39781
39779
  tableRef.value.updateStatus(activeEditRow.value);
39782
39780
  }
39783
39781
  }
@@ -40117,7 +40115,10 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
40117
40115
  _: 2
40118
40116
  }, 1024)
40119
40117
  ], 512), [
40120
- [vShow, row.type == "1" && addShow.value]
40118
+ [
40119
+ vShow,
40120
+ row.type == "1" && row.hasChild == false && addShow.value
40121
+ ]
40121
40122
  ]),
40122
40123
  withDirectives(createElementVNode("div", null, [
40123
40124
  createVNode(_component_a_menu_item, { key: "2" }, {
@@ -41834,15 +41835,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
41834
41835
  name: [
41835
41836
  {
41836
41837
  required: true,
41837
- trigger: ["change", "blur"],
41838
- message: t2("uc_user.user_name_msg1"),
41839
- validator: (rule, value) => {
41840
- if (!value || /^\s+$/.test(value)) {
41841
- return Promise.reject(t2("uc_user.user_name_msg1"));
41842
- } else {
41843
- return Promise.resolve();
41844
- }
41845
- }
41838
+ message: t2("uc_user.user_name_msg1")
41846
41839
  }
41847
41840
  ],
41848
41841
  branchId: [
@@ -42062,7 +42055,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
42062
42055
  placeholder: _ctx.$t("uc_common.plsEnter"),
42063
42056
  value: form.value.code,
42064
42057
  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => form.value.code = $event),
42065
- maxlength: 64,
42058
+ maxlength: 50,
42066
42059
  autocomplete: "off"
42067
42060
  }, null, 8, ["placeholder", "value"])
42068
42061
  ]),
@@ -42080,14 +42073,14 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
42080
42073
  default: withCtx(() => [
42081
42074
  createVNode(_component_a_form_item, {
42082
42075
  label: _ctx.$t("uc_user.userName"),
42083
- name: "userName"
42076
+ name: "name"
42084
42077
  }, {
42085
42078
  default: withCtx(() => [
42086
42079
  createVNode(_component_a_input, {
42087
42080
  placeholder: _ctx.$t("uc_common.plsEnter"),
42088
42081
  value: form.value.name,
42089
42082
  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => form.value.name = $event),
42090
- maxlength: 64,
42083
+ maxlength: 100,
42091
42084
  autocomplete: "off"
42092
42085
  }, null, 8, ["placeholder", "value"])
42093
42086
  ]),
@@ -42234,7 +42227,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
42234
42227
  "onUpdate:value": _cache[7] || (_cache[7] = ($event) => form.value.email = $event),
42235
42228
  disabled: props.params.opType == "2",
42236
42229
  autocomplete: "off",
42237
- maxlength: 100
42230
+ maxlength: 32
42238
42231
  }, null, 8, ["placeholder", "value", "disabled"])
42239
42232
  ]),
42240
42233
  _: 1
@@ -42894,13 +42887,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
42894
42887
  }, {
42895
42888
  default: withCtx(() => [
42896
42889
  createVNode(_component_a_form_item, {
42897
- label: _ctx.$t("uc_user.userName"),
42898
- name: "name"
42890
+ label: _ctx.$t("uc_user.userCode"),
42891
+ name: "code"
42899
42892
  }, {
42900
42893
  default: withCtx(() => [
42901
42894
  createVNode(_component_a_input, {
42902
- value: queryParam.value.name,
42903
- "onUpdate:value": _cache[0] || (_cache[0] = ($event) => queryParam.value.name = $event),
42895
+ value: queryParam.value.code,
42896
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => queryParam.value.code = $event),
42904
42897
  placeholder: _ctx.$t("uc_common.plsEnter"),
42905
42898
  autocomplete: "off"
42906
42899
  }, null, 8, ["value", "placeholder"])
@@ -42908,13 +42901,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
42908
42901
  _: 1
42909
42902
  }, 8, ["label"]),
42910
42903
  createVNode(_component_a_form_item, {
42911
- label: _ctx.$t("uc_user.userCode"),
42912
- name: "code"
42904
+ label: _ctx.$t("uc_user.userName"),
42905
+ name: "name"
42913
42906
  }, {
42914
42907
  default: withCtx(() => [
42915
42908
  createVNode(_component_a_input, {
42916
- value: queryParam.value.code,
42917
- "onUpdate:value": _cache[1] || (_cache[1] = ($event) => queryParam.value.code = $event),
42909
+ value: queryParam.value.name,
42910
+ "onUpdate:value": _cache[1] || (_cache[1] = ($event) => queryParam.value.name = $event),
42918
42911
  placeholder: _ctx.$t("uc_common.plsEnter"),
42919
42912
  autocomplete: "off"
42920
42913
  }, null, 8, ["value", "placeholder"])
@@ -43169,7 +43162,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
43169
43162
  value: formState.userName,
43170
43163
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => formState.userName = $event),
43171
43164
  placeholder: _ctx.$t("uc_common.plsEnter"),
43172
- maxlength: 64,
43165
+ maxlength: 100,
43173
43166
  "show-count": "",
43174
43167
  autocomplete: "off"
43175
43168
  }, null, 8, ["value", "placeholder"])
@@ -43304,7 +43297,6 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
43304
43297
  value: formState.pwd,
43305
43298
  "onUpdate:value": _cache[0] || (_cache[0] = ($event) => formState.pwd = $event),
43306
43299
  placeholder: _ctx.$t("uc_common.plsEnter"),
43307
- maxlength: 20,
43308
43300
  autocomplete: "new-password"
43309
43301
  }, null, 8, ["value", "placeholder"])
43310
43302
  ]),
@@ -43517,7 +43509,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
43517
43509
  value: formState.email,
43518
43510
  "onUpdate:value": _cache[1] || (_cache[1] = ($event) => formState.email = $event),
43519
43511
  placeholder: _ctx.$t("uc_common.plsEnter"),
43520
- maxlength: 100
43512
+ maxlength: 32
43521
43513
  }, null, 8, ["value", "placeholder"])
43522
43514
  ]),
43523
43515
  _: 1
@@ -46177,7 +46169,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
46177
46169
  placeholder: _ctx.$t("uc_common.plsEnter"),
46178
46170
  value: form.userEmail,
46179
46171
  "onUpdate:value": _cache[11] || (_cache[11] = ($event) => form.userEmail = $event),
46180
- maxlength: 100
46172
+ maxlength: 32
46181
46173
  }, null, 8, ["disabled", "placeholder", "value"])
46182
46174
  ]),
46183
46175
  _: 1
@@ -48183,6 +48175,7 @@ const inhe = {
48183
48175
  Vue.component("uc-pick-label", PickLabel);
48184
48176
  }
48185
48177
  };
48178
+ const FORCE_RESET_PWD_SYNC_KEY = "forceResetPwdSync";
48186
48179
  let forceResetPwdModalInstance = null;
48187
48180
  function changeTheme(options) {
48188
48181
  changeTheme$1(options);
@@ -48194,6 +48187,20 @@ function openResetPassword(callback) {
48194
48187
  }
48195
48188
  const container = document.createElement("div");
48196
48189
  let compRef = null;
48190
+ function handleForceResetPwdStorage(event) {
48191
+ if (event.key === `${TOKEN_PREFIX}${FORCE_RESET_PWD_SYNC_KEY}` && event.newValue) {
48192
+ forceResetPwdModalInstance == null ? void 0 : forceResetPwdModalInstance.close();
48193
+ }
48194
+ }
48195
+ function closeModal() {
48196
+ if (!forceResetPwdModalInstance) {
48197
+ return;
48198
+ }
48199
+ app.unmount();
48200
+ container.remove();
48201
+ forceResetPwdModalInstance = null;
48202
+ window.removeEventListener("storage", handleForceResetPwdStorage);
48203
+ }
48197
48204
  const app = createApp({
48198
48205
  setup() {
48199
48206
  compRef = ref();
@@ -48208,7 +48215,12 @@ function openResetPassword(callback) {
48208
48215
  height: "100%"
48209
48216
  }
48210
48217
  },
48211
- [h(ForceResetPwdModal, { ref: compRef })]
48218
+ [
48219
+ h(ForceResetPwdModal, {
48220
+ ref: compRef,
48221
+ onSuccess: closeModal
48222
+ })
48223
+ ]
48212
48224
  );
48213
48225
  }
48214
48226
  });
@@ -48224,19 +48236,13 @@ function openResetPassword(callback) {
48224
48236
  });
48225
48237
  },
48226
48238
  destroy: () => {
48227
- app.unmount();
48228
- container.remove();
48229
- forceResetPwdModalInstance = null;
48239
+ closeModal();
48230
48240
  },
48231
48241
  close: () => {
48232
- app.unmount();
48233
- container.remove();
48234
- forceResetPwdModalInstance = null;
48242
+ closeModal();
48235
48243
  }
48236
48244
  };
48237
- window.addEventListener("forceResetPwdSuccess", () => {
48238
- forceResetPwdModalInstance == null ? void 0 : forceResetPwdModalInstance.close();
48239
- });
48245
+ window.addEventListener("storage", handleForceResetPwdStorage);
48240
48246
  forceResetPwdModalInstance.showModal(callback);
48241
48247
  }
48242
48248
  function setToken(token) {