n20-common-lib 1.3.86 → 1.3.88

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": "n20-common-lib",
3
- "version": "1.3.86",
3
+ "version": "1.3.88",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  <el-select v-model="addTaskType" :placeholder="'请选择审批方式' | $lc" style="width: 10em">
30
30
  <!-- <el-option :label="'普通节点' | $lc" value="1" /> -->
31
31
  <el-option :label="'会签并行' | $lc" value="2" />
32
- <el-option :label="'会签串行' | $lc" value="3" />
32
+ <el-option :label="'普通串行' | $lc" value="3" />
33
33
  </el-select>
34
34
  <el-input
35
35
  class="flex-item"
@@ -13,18 +13,13 @@
13
13
  <span class="worker-icon n20-icon-user"></span>
14
14
  <span>{{ item.assignee }}</span>
15
15
  </div>
16
- <div class="n20-approval m-r-s">
16
+ <div class="n20-approval m-r-s" style="width: auto; min-width: 100px">
17
17
  <template v-if="item.result == status.submit">{{ '提交' | $lc }}</template>
18
18
  <template v-else-if="item.result == status.end">{{ '结束' | $lc }}</template>
19
- <template v-else-if="item.result == status.approval">
20
- {{ '审批意见:' | $lc }}<span class="color-primary">{{ '批准' | $lc }}</span>
19
+ <template v-else>
20
+ <span>{{ '审批意见:' | $lc }}</span>
21
+ <span :class="item | typeF(status, 'color-')">{{ $lc(item.resultName || '驳回') }}</span>
21
22
  </template>
22
- <template v-else-if="item.result == status.reject">
23
- {{ '审批意见:' | $lc }}<span class="n20-approval-reject">{{ '驳回' | $lc }}</span></template
24
- >
25
- <template v-else-if="item.result == status.invalid">
26
- {{ '审批意见:' | $lc }}<span class="n20-approval-reject">{{ '作废' | $lc }}</span></template
27
- >
28
23
  </div>
29
24
  </div>
30
25
  <div v-if="item.suggestion" class="n20-description-c m-t">
@@ -43,15 +38,19 @@ import axios from '../../utils/axios'
43
38
  export default {
44
39
  name: 'ApprovalCard',
45
40
  filters: {
46
- typeF(item, status) {
41
+ typeF(item, status, prefix = '') {
47
42
  let result = item.result
48
43
  switch (result) {
49
44
  case status.submit:
50
- return 'primary'
45
+ return prefix + 'primary'
51
46
  case status.approval:
52
- return 'primary'
47
+ return prefix + 'primary'
53
48
  case status.reject:
54
- return 'danger'
49
+ return prefix + 'danger'
50
+ case status.invalid:
51
+ return prefix + 'danger'
52
+ case status.end:
53
+ return prefix + 'primary'
55
54
  default:
56
55
  return undefined
57
56
  }
@@ -107,9 +106,17 @@ export default {
107
106
  suggestion: item.suggestion,
108
107
  ccUserName: item.ccUserName // 抄送人
109
108
  }
109
+ let resultName = item.optResult || ''
110
+ resultName = resultName.split('-')
111
+ resultName = resultName[resultName.length - 1]
112
+ _item.resultName = resultName === '推进' ? '批准' : resultName
110
113
 
111
114
  if (item.taskName === $lc('开始')) {
112
115
  _item.result = 1
116
+ } else if (_item.resultName === $lc('加签推进')) {
117
+ _item.result = 2
118
+ } else if (_item.resultName === $lc('作废')) {
119
+ _item.result = 4
113
120
  } else if (item.taskName === $lc('结束')) {
114
121
  _item.result = 5
115
122
  } else if ('approvalState' in item) {
@@ -65,6 +65,9 @@
65
65
  v-if="i > 0"
66
66
  :key="i + '-flow'"
67
67
  class="djs-element djs-connection activiti-line-achieve"
68
+ :class="{
69
+ 'activiti-line-reject': item.examineType === 'reject'
70
+ }"
68
71
  :data-element-id="item.addTaskDefId + '-flow'"
69
72
  :transform="`matrix(1 0 0 1 ${i * 160 - 60} 1)`"
70
73
  >
@@ -80,7 +83,8 @@
80
83
  :key="i"
81
84
  class="djs-element djs-shape activiti-node-achieve"
82
85
  :class="{
83
- 'activiti-node-at': dataPro.currentActivityIdList.includes(item.addTaskDefId)
86
+ 'activiti-node-at': dataPro.currentActivityIdList.includes(item.addTaskDefId),
87
+ 'activiti-node-reject': item.examineType === 'reject'
84
88
  }"
85
89
  :data-element-id="item.addTaskDefId"
86
90
  :transform="`matrix(1 0 0 1 ${1 + i * 160} 1)`"
@@ -250,10 +254,10 @@ export default {
250
254
  let width = this.svgC.getAttribute('width')
251
255
  let height = this.svgC.getAttribute('height')
252
256
  let viewBox = this.svgC.getAttribute('viewBox').split(' ')
253
- viewBox = [Number(viewBox[0]) - 10, Number(viewBox[1]) - 10, Number(viewBox[2]) + 10, Number(viewBox[3]) + 10]
257
+ viewBox = [Number(viewBox[0]), Number(viewBox[1]) - 10, Number(viewBox[2]) + 20, Number(viewBox[3])]
254
258
  viewBox = viewBox.join(' ')
255
259
 
256
- this.svgC.setAttribute('width', Number(width) + 10)
260
+ this.svgC.setAttribute('width', Number(width) + 20)
257
261
  this.svgC.setAttribute('height', Number(height) + 10)
258
262
  this.svgC.setAttribute('viewBox', viewBox)
259
263
 
@@ -280,9 +284,21 @@ export default {
280
284
  const fromO = this.getElRect(from)
281
285
  const toO = this.getElRect(to)
282
286
  let oTop = Math.min(fromO.top, toO.top) - 12
283
- let d = `M${fromO.left + fromO.with / 2},${fromO.top} L${fromO.left + fromO.with / 2},${oTop} L${
284
- toO.left + toO.with / 2
285
- },${oTop} L${toO.left + toO.with / 2},${toO.top}`
287
+ let fromLC = fromO.left + fromO.with / 2
288
+ let toLC = toO.left + toO.with / 2
289
+
290
+ let oRight = Math.max(fromO.left + fromO.with, toO.left + toO.with) + 12
291
+ let fromTC = fromO.top + fromO.height / 2
292
+ let toTC = toO.top + toO.height / 2
293
+
294
+ let d
295
+ if (fromLC !== toLC) {
296
+ d = `M${fromLC},${fromO.top} L${fromLC},${oTop} L${toLC},${oTop} L${toLC},${toO.top}`
297
+ } else {
298
+ d = `M${fromO.left + fromO.with},${fromTC} L${oRight},${fromTC} L${oRight},${toTC} L${
299
+ toO.left + toO.with
300
+ },${toTC}`
301
+ }
286
302
 
287
303
  let path = document.createElementNS('http://www.w3.org/2000/svg', 'path')
288
304
  path.setAttribute('class', 'activiti-line-reject')
@@ -293,8 +309,14 @@ export default {
293
309
  if (msg) {
294
310
  let text = document.createElementNS('http://www.w3.org/2000/svg', 'text')
295
311
  text.setAttribute('class', 'activiti-text-reject')
296
- text.setAttribute('x', (fromO.left + fromO.with / 2 + toO.left + toO.with / 2) / 2)
297
- text.setAttribute('y', oTop + 6)
312
+ if (fromLC !== toLC) {
313
+ text.setAttribute('x', (fromLC + toLC) / 2)
314
+ text.setAttribute('y', oTop + 6)
315
+ } else {
316
+ text.setAttribute('y', (fromTC + toTC) / 2)
317
+ text.setAttribute('x', oRight + 8)
318
+ text.setAttribute('writing-mode', 'tb')
319
+ }
298
320
  text.textContent = msg
299
321
  this.svgC.appendChild(text)
300
322
 
@@ -361,7 +383,7 @@ export default {
361
383
  circleG.setAttribute('data-element-top', centreD[1] - 10)
362
384
 
363
385
  circleG.setAttribute('data-element-id', list?.[0]?.addTaskDefId || '')
364
- let cEl = `<circle r="10" cx="${centreD[0]}" cy="${
386
+ let cEl = `<circle class="add-and" r="10" cx="${centreD[0]}" cy="${
365
387
  centreD[1]
366
388
  }" stroke-width="1" stroke="#666" fill="#fff"></circle>
367
389
  <line class="add-and" x1="${centreD[0] - 7}" y1="${centreD[1]}" x2="${centreD[0] + 7}" y2="${
@@ -375,7 +397,11 @@ export default {
375
397
  this.svgC.appendChild(circleG)
376
398
 
377
399
  circleG.addEventListener('click', (el) => {
400
+ if (el.currentTarget.getAttribute('class').includes('activiti-node-reject')) {
401
+ list.forEach((c) => (c.examineType = 'reject'))
402
+ }
378
403
  this.addTaskList = list
404
+ this.addTaskV = false
379
405
  this.$nextTick(() => {
380
406
  this.$refs['addTask-pop'].doDestroy()
381
407
  this.$refs['addTask-pop'].referenceElm = circleG
@@ -392,14 +418,14 @@ export default {
392
418
 
393
419
  this.$nextTick(() => {
394
420
  this.$refs['title-pop'].doDestroy()
395
- this.$refs['title-pop'].referenceElm = ev.target
421
+ this.$refs['title-pop'].referenceElm = ev.currentTarget
396
422
  this.msgV = true
397
423
  })
398
424
  } else if (this.dataPro.taskDefIdMap[id] /*已审批*/) {
399
425
  this.assigneeEnd = this.dataPro.taskDefIdMap[id]
400
426
  this.$nextTick(() => {
401
427
  this.$refs['title-pop'].doDestroy()
402
- this.$refs['title-pop'].referenceElm = ev.target
428
+ this.$refs['title-pop'].referenceElm = ev.currentTarget
403
429
  this.msgV = true
404
430
  })
405
431
  }
@@ -600,7 +626,8 @@ setRejectLink(from, to) {
600
626
  .activiti-node-at use {
601
627
  fill: #fe943c !important;
602
628
  }
603
- .activiti-line-reject {
629
+ .activiti-line-reject,
630
+ .activiti-line-reject path {
604
631
  fill: none;
605
632
  stroke-width: 1px;
606
633
  stroke: #ea5454 !important;
@@ -151,6 +151,10 @@ export default {
151
151
  beforeLogout: {
152
152
  type: Function,
153
153
  default: undefined
154
+ },
155
+ afterLogout: {
156
+ type: Function,
157
+ default: undefined
154
158
  }
155
159
  },
156
160
  inject: {
@@ -327,7 +331,12 @@ export default {
327
331
  },
328
332
  logoutA() {
329
333
  axios.delete('/bems/prod_1.0/uas/api/authorization/logout').then(() => {
330
- auth.removeToken()
334
+ if (this.afterLogout) {
335
+ let After = this.afterLogout(auth.removeToken)
336
+ After.then && After.then(auth.removeToken)
337
+ } else {
338
+ auth.removeToken()
339
+ }
331
340
  })
332
341
  },
333
342
  // 检查是否代理中
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <div class="layout-wrap">
3
- <headerWrap class="header-wrap" :before-logout="beforeLogout" @custom-event="(par) => $emit('custom-event', par)" />
3
+ <headerWrap
4
+ class="header-wrap"
5
+ :before-logout="beforeLogout"
6
+ :after-logout="afterLogout"
7
+ @custom-event="(par) => $emit('custom-event', par)"
8
+ />
4
9
  <asideNav :menus="menusC" :active-nav="activeNavC" :collapse.sync="collapse" @menu-click="menuClick" />
5
10
  <tabsNav
6
11
  class="tabs-nav-wrap"
@@ -57,6 +62,10 @@ export default {
57
62
  beforeLogout: {
58
63
  type: Function,
59
64
  default: undefined
65
+ },
66
+ afterLogout: {
67
+ type: Function,
68
+ default: undefined
60
69
  }
61
70
  },
62
71
  data() {
@@ -184,13 +184,13 @@ export default {
184
184
  this.visible = false
185
185
  },
186
186
  saveColumns(list) {
187
- let labels = list.map((c) => c[this.labelKey] || c)
187
+ let columns = saveTransform(list, this.labelKey, this.isFilter)
188
188
  axios.post(
189
189
  '/bems/prod_1.0/user/pageHabit',
190
190
  {
191
191
  userNo: this.userNo,
192
192
  pageId: this.pageId,
193
- showStructure: JSON.stringify(labels)
193
+ showStructure: JSON.stringify(columns)
194
194
  },
195
195
  { loading: false }
196
196
  )
@@ -201,6 +201,64 @@ export default {
201
201
  }
202
202
  }
203
203
 
204
+ function saveTransform(list, labelKey, isFilter) {
205
+ let listN = []
206
+ if (!isFilter) {
207
+ list.forEach((c) => {
208
+ if (c.prop) {
209
+ listN.push({ _colKey: 'prop', _colVal: c.prop })
210
+ } else if (c.slotName) {
211
+ listN.push({ _colKey: 'slotName', _colVal: c.slotName })
212
+ } else if (c.type && ['selection', 'index', 'expand'].includes(c.type)) {
213
+ listN.push({ _colKey: 'type', _colVal: c.type })
214
+ } else {
215
+ let sFn = false
216
+ for (let k in c) {
217
+ if (typeof c[k] === 'function') sFn = true
218
+ }
219
+ if (!sFn && c[labelKey]) {
220
+ listN.push({ _colKey: labelKey, _colVal: c[labelKey] })
221
+ } else {
222
+ listN.push(c)
223
+ }
224
+ }
225
+ })
226
+ } else {
227
+ list.forEach((c) => {
228
+ if (c.value) {
229
+ listN.push({ _colKey: 'value', _colVal: c.value })
230
+ } else if (c.startValue) {
231
+ listN.push({ _colKey: 'startValue', _colVal: c.startValue })
232
+ } else if (c.startDate) {
233
+ listN.push({ _colKey: 'startDate', _colVal: c.startDate })
234
+ } else if (c.slotName) {
235
+ listN.push({ _colKey: 'slotName', _colVal: c.slotName })
236
+ } else {
237
+ listN.push(c)
238
+ }
239
+ })
240
+ }
241
+ return listN
242
+ }
243
+
244
+ function getTransform(list, columnsT, labelKey = 'label') {
245
+ let columns = []
246
+ list.forEach((d) => {
247
+ if (typeof d === 'string') {
248
+ let column = columnsT.find((c) => c[labelKey] === d)
249
+ column && columns.push(column)
250
+ } else if (typeof d === 'object') {
251
+ if (d._colKey) {
252
+ let column = columnsT.find((c) => c[d._colKey] === d._colVal)
253
+ column && columns.push(column)
254
+ } else {
255
+ columns.push(d)
256
+ }
257
+ }
258
+ })
259
+ return columns
260
+ }
261
+
204
262
  // 这段代码在筛选组件中复用
205
263
  export function getColumns(pageId, userNo, columnsT, labelKey = 'label') {
206
264
  return new Promise((resolve, reject) => {
@@ -217,15 +275,7 @@ export function getColumns(pageId, userNo, columnsT, labelKey = 'label') {
217
275
  if (data) {
218
276
  let _data = JSON.parse(data)
219
277
  if (_data && _data.length > 0) {
220
- let columns = []
221
- _data.forEach((d) => {
222
- if (typeof d === 'string') {
223
- let column = columnsT.find((c) => c[labelKey] === d)
224
- column && columns.push(column)
225
- } else if (typeof d === 'object') {
226
- columns.push(d)
227
- }
228
- })
278
+ let columns = getTransform(_data, columnsT, labelKey)
229
279
  return resolve(columns)
230
280
  }
231
281
  }
package/src/index.js CHANGED
@@ -80,7 +80,6 @@ import VHas from './directives/VHas/index.js'
80
80
  /** 注入方法 */
81
81
  import dayjs from 'dayjs'
82
82
  import numerify from 'numerify'
83
- import { tipShow, tipHide } from './directives/VTitle'
84
83
  import axios from './utils/axios.js'
85
84
  import auth from './utils/auth.js'
86
85
  import { msgPor, msgboxPor } from './utils/msgboxPor.js'
@@ -217,8 +216,6 @@ export {
217
216
  dayjs,
218
217
  numerify,
219
218
  $l,
220
- tipShow,
221
- tipHide,
222
219
  // 组件
223
220
  ContentLoading,
224
221
  ContentNull,