@hbisty/qj-common 5.1.1 → 5.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hbisty/qj-common",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "common files && template for qj-paas",
5
5
  "scripts": {
6
6
  "gulp": "gulp css"
@@ -204,6 +204,11 @@ export default {
204
204
  currentSubCategories() {
205
205
  return this.subCategoryMap[this.activeType] || []
206
206
  },
207
+ // 当前二级菜单下所有三级菜单code拼接值
208
+ activeSubCodes() {
209
+ const subNode = this.currentSubCategories.find(c => c.key === this.activeSub)
210
+ return subNode ? subNode.codes : ''
211
+ },
207
212
  filteredMessages() {
208
213
  return this.messages
209
214
  },
@@ -287,7 +292,10 @@ export default {
287
292
  }
288
293
  },
289
294
  mounted() {
290
- this.fetchTree()
295
+ const saasToken = localStorage.getItem('saasToken') || localStorage.getItem('saas-token');
296
+ if (saasToken) {
297
+ this.fetchTree()
298
+ }
291
299
  },
292
300
  methods: {
293
301
  // 1.查询顶部tab消息类型和左侧tab状态类型
@@ -295,22 +303,24 @@ export default {
295
303
  this.treeLoading = true
296
304
  try {
297
305
  const res = await queryMailMnsblistPageTree({ mnslistBustype: 'smail', stateExt: '0' })
298
- const list = (res && res.mnsTabTreeNodeList) || []
306
+ const list = Array.isArray(res) ? res : (res && res.mnsTabTreeNodeList) || []
299
307
  this.messageTypes = list.map(n => ({
300
308
  key: n.code,
301
309
  name: n.message,
302
310
  badge: n.badge || 0,
303
- children: (n.children || []).map(c => ({
304
- key: c.code,
311
+ children: (n.children || []).map((c, idx) => ({
312
+ key: c.code || ('sub_' + idx),
305
313
  name: c.message,
306
- badge: c.badge || 0
314
+ badge: c.badge || 0,
315
+ // 三级菜单所有code用逗号拼接,作为接口入参mnslistBustypeExt的值
316
+ codes: (c.children || []).filter(g => g.code).map(g => g.code).join(',')
307
317
  }))
308
318
  }))
309
319
  this.subCategoryMap = {}
310
320
  this.messageTypes.forEach(t => {
311
321
  this.subCategoryMap[t.key] = t.children
312
322
  })
313
- this.totalUnread = (res && res.badge) || 0
323
+ this.totalUnread = Array.isArray(res) ? 0 : (res && res.badge) || 0
314
324
  this.treeLoaded = true
315
325
  // 设置默认选中项
316
326
  if (this.messageTypes.length > 0) {
@@ -344,12 +354,13 @@ export default {
344
354
  const params = {
345
355
  page: this.currentPage,
346
356
  rows: this.pageSize,
357
+ channel: true, //区分渠道
347
358
  mnslistBustype: 'smail',
348
359
  mnslistBustnameExt: this.activeType, // 一级菜单code
349
360
  // fuzzy: false
350
361
  }
351
- if (this.activeSub) {
352
- params.mnslistBustypeExt = this.activeSub // 二级菜单code
362
+ if (this.activeSubCodes) {
363
+ params.mnslistBustypeExt = this.activeSubCodes // 三级菜单code拼接
353
364
  }
354
365
  if (this.appliedKeyword) {
355
366
  params.mnslistContentLike = this.appliedKeyword // 模糊搜索关键词
@@ -473,7 +484,7 @@ export default {
473
484
  return
474
485
  }
475
486
  const params = {
476
- mnslistBustypeExt: this.activeSub, // 二级菜单code
487
+ mnslistBustypeExt: this.activeSubCodes, // 三级菜单code拼接
477
488
  }
478
489
  const subNode = this.currentSubCategories.find(c => c.key === this.activeSub)
479
490
  const typeNode = this.messageTypes.find(t => t.key === this.activeType)