n20-common-lib 1.3.53 → 1.3.56

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.
@@ -18,12 +18,7 @@
18
18
  </svg>
19
19
  <div ref="activiti-svg-wrap" class="activiti-svg-wrap"></div>
20
20
  <div class="flex-box activiti-svg-zoom">
21
- <el-button
22
- type="text"
23
- icon="el-icon-zoom-out"
24
- style="font-size: 18px"
25
- @click="scaleMinus"
26
- />
21
+ <el-button type="text" icon="el-icon-zoom-out" style="font-size: 18px" @click="scaleMinus" />
27
22
  <el-slider
28
23
  v-model="zoomValue"
29
24
  class="m-l m-r"
@@ -33,51 +28,39 @@
33
28
  :format-tooltip="$options.filters.zoomFormat"
34
29
  style="width: 200px"
35
30
  />
36
- <el-button
37
- type="text"
38
- icon="el-icon-zoom-in"
39
- style="font-size: 18px"
40
- @click="scaleAdd"
41
- />
42
- <span
43
- class="m-l-s m-r-s"
44
- style="display: inline-block; width: 38px; line-height: 38px"
45
- >{{ zoomValue | zoomFormat }}</span
46
- >
47
- <el-button
48
- type="text"
49
- icon="el-icon-full-screen"
50
- style="font-size: 16px"
51
- @click="scaleReset"
52
- />
31
+ <el-button type="text" icon="el-icon-zoom-in" style="font-size: 18px" @click="scaleAdd" />
32
+ <span class="m-l-s m-r-s" style="display: inline-block; width: 38px; line-height: 38px">{{
33
+ zoomValue | zoomFormat
34
+ }}</span>
35
+ <el-button type="text" icon="el-icon-full-screen" style="font-size: 16px" @click="scaleReset" />
53
36
  </div>
54
37
 
55
38
  <div ref="msgEl" class="activiti-msg">
56
- <div>
57
- <span class="color-primary">待审批: </span>{{ daishengpi.toString() }}
58
- </div>
59
- <div>
60
- <span class="color-success">已审批: </span>{{ yishengpi.toString() }}
61
- </div>
39
+ <div>{{ assignee }}</div>
62
40
  </div>
63
41
  </div>
64
42
  </template>
65
43
 
66
44
  <script>
67
- import importG from '../../utils/importGlobal.js'
68
- import { tipShow, tipHide } from '../../directives/VTitle/index.js'
45
+ import importG from '../../../utils/importGlobal.js'
46
+ import { tipShow, tipHide } from '../../../directives/VTitle/index.js'
69
47
  export default {
70
48
  filters: {
71
49
  zoomFormat(val) {
72
50
  return parseInt(val * 10) + '0%'
73
51
  }
74
52
  },
53
+ props: {
54
+ dataPro: {
55
+ type: Object,
56
+ default: undefined
57
+ }
58
+ },
75
59
  data() {
76
60
  this.svgW = undefined
77
61
  this.svgC = undefined
78
62
  return {
79
- daishengpi: [],
80
- yishengpi: [],
63
+ assignee: '',
81
64
  min: 0.4,
82
65
  max: 2,
83
66
  step: 0.1,
@@ -92,19 +75,31 @@ export default {
92
75
  async mounted() {
93
76
  this.svgW = this.$refs['activiti-svg-wrap']
94
77
 
95
- let { flowString, seqRecords, taskDefIdMap } = await this.$axios.get(
96
- '/server-assets/approvalImgDate.json'
97
- )
98
- this.setSvgAttrs(flowString)
99
- seqRecords.forEach((obj) => {
100
- this.setTaskRecord(obj)
101
- })
102
- taskDefIdMap.forEach((obj) => {
103
- this.addEvent(obj)
104
- })
105
- let { default: panzoom } = await importG('panzoom', () =>
106
- import(/*webpackChunkName: "panzoom"*/ 'panzoom')
107
- )
78
+ let { flowString, seqRecords, taskDefIdMap, currentActivityId, currentAssigneeName } = this.dataPro
79
+ let flowSvg = flowString
80
+ if (flowString.includes('bpmn2:definitions')) {
81
+ let { default: bpmn2svg } = await importG('bpmn2svg', () =>
82
+ import(/*webpackChunkName: "bpmn2svg"*/ './bpmn2svg/bpmn2svg.umd.js')
83
+ )
84
+ flowSvg = await bpmn2svg(flowString)
85
+ }
86
+ this.setSvgAttrs(flowSvg)
87
+ try {
88
+ seqRecords.forEach((obj) => {
89
+ this.setTaskRecord(obj)
90
+ })
91
+ for (let k in taskDefIdMap) {
92
+ this.addEvent(k, taskDefIdMap[k])
93
+ }
94
+ if (currentActivityId) {
95
+ this.addEvent(currentActivityId, currentAssigneeName, 'pending')
96
+ this.svgW.querySelector(`[data-element-id="${currentActivityId}"]`).classList.add('activiti-node-at')
97
+ }
98
+ } catch (error) {
99
+ console.log('setTaskErr:', error)
100
+ }
101
+
102
+ let { default: panzoom } = await importG('panzoom', () => import(/*webpackChunkName: "panzoom"*/ 'panzoom'))
108
103
 
109
104
  this.svgPanzoom = panzoom(this.svgC, {
110
105
  maxZoom: this.max,
@@ -130,12 +125,7 @@ export default {
130
125
  let width = this.svgC.getAttribute('width')
131
126
  let height = this.svgC.getAttribute('height')
132
127
  let viewBox = this.svgC.getAttribute('viewBox').split(' ')
133
- viewBox = [
134
- Number(viewBox[0]) - 10,
135
- Number(viewBox[1]) - 10,
136
- Number(viewBox[2]) + 10,
137
- Number(viewBox[3]) + 10
138
- ]
128
+ viewBox = [Number(viewBox[0]) - 10, Number(viewBox[1]) - 10, Number(viewBox[2]) + 10, Number(viewBox[3]) + 10]
139
129
  viewBox = viewBox.join(' ')
140
130
 
141
131
  this.svgC.setAttribute('width', Number(width) + 10)
@@ -143,42 +133,28 @@ export default {
143
133
  this.svgC.setAttribute('viewBox', viewBox)
144
134
  },
145
135
  setTaskRecord(obj) {
146
- let {
147
- resouceTaskDefId: from,
148
- targetTaskDefId: to,
149
- flowLine: line,
150
- type: type,
151
- suggestion: msg
152
- } = obj
136
+ let { resouceTaskDefId: from, targetTaskDefId: to, seqDefid: line, type: type } = obj
153
137
  if (type === '0') {
154
- this.svgW
155
- .querySelector(`[data-element-id="${from}"]`)
156
- .classList.add('activiti-node-achieve')
157
- this.svgW
158
- .querySelector(`[data-element-id="${to}"]`)
159
- .classList.add('activiti-node-achieve')
160
- this.svgW
161
- .querySelector(`[data-element-id="${line}"]`)
162
- .classList.add('activiti-line-achieve')
138
+ this.svgW.querySelector(`[data-element-id="${from}"]`).classList.add('activiti-node-achieve')
139
+ this.svgW.querySelector(`[data-element-id="${to}"]`).classList.add('activiti-node-achieve')
140
+ this.svgW.querySelector(`[data-element-id="${line}"]`).classList.add('activiti-line-achieve')
163
141
  } else {
164
- this.svgW
165
- .querySelector(`[data-element-id="${from}"]`)
166
- .classList.add('activiti-node-reject')
167
- this.svgW
168
- .querySelector(`[data-element-id="${to}"]`)
169
- .classList.add('activiti-node-reject')
170
- this.setRejectLink(from, to, msg)
142
+ this.svgW.querySelector(`[data-element-id="${from}"]`).classList.add('activiti-node-reject')
143
+ if (type === '1') {
144
+ this.svgW.querySelector(`[data-element-id="${to}"]`).classList.add('activiti-node-reject')
145
+ this.setRejectLink(from, to, '驳回至发起人')
146
+ } else if (type === '2') {
147
+ this.setRejectLink(from, to, '驳回至上一步')
148
+ }
171
149
  }
172
150
  },
173
151
  setRejectLink(from, to, msg) {
174
152
  const fromO = this.getElRect(from)
175
153
  const toO = this.getElRect(to)
176
154
  let oTop = Math.min(fromO.top, toO.top) - 12
177
- let d = `M${fromO.left + fromO.with / 2},${fromO.top} L${
178
- fromO.left + fromO.with / 2
179
- },${oTop} L${toO.left + toO.with / 2},${oTop} L${
155
+ let d = `M${fromO.left + fromO.with / 2},${fromO.top} L${fromO.left + fromO.with / 2},${oTop} L${
180
156
  toO.left + toO.with / 2
181
- },${toO.top}`
157
+ },${oTop} L${toO.left + toO.with / 2},${toO.top}`
182
158
 
183
159
  let path = document.createElementNS('http://www.w3.org/2000/svg', 'path')
184
160
  path.setAttribute('class', 'activiti-line-reject')
@@ -186,24 +162,15 @@ export default {
186
162
  this.svgC.appendChild(path)
187
163
 
188
164
  if (msg) {
189
- let text = document.createElementNS(
190
- 'http://www.w3.org/2000/svg',
191
- 'text'
192
- )
165
+ let text = document.createElementNS('http://www.w3.org/2000/svg', 'text')
193
166
  text.setAttribute('class', 'activiti-text-reject')
194
- text.setAttribute(
195
- 'x',
196
- (fromO.left + fromO.with / 2 + toO.left + toO.with / 2) / 2
197
- )
167
+ text.setAttribute('x', (fromO.left + fromO.with / 2 + toO.left + toO.with / 2) / 2)
198
168
  text.setAttribute('y', oTop + 6)
199
169
  text.textContent = msg
200
170
  this.svgC.appendChild(text)
201
171
 
202
172
  let textO = text.getBBox()
203
- let rect = document.createElementNS(
204
- 'http://www.w3.org/2000/svg',
205
- 'rect'
206
- )
173
+ let rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect')
207
174
  rect.setAttribute('class', 'activiti-text-bg-reject')
208
175
  rect.setAttribute('x', textO.x)
209
176
  rect.setAttribute('y', textO.y)
@@ -234,12 +201,15 @@ export default {
234
201
  }
235
202
  return rect
236
203
  },
237
- addEvent(obj) {
238
- let { taskDefId, daishengpi, yishengpi } = obj
239
- let task = this.svgW.querySelector(`[data-element-id="${taskDefId}"]`)
204
+ addEvent(id, list = [], type) {
205
+ let task = this.svgW.querySelector(`[data-element-id="${id}"]`)
240
206
  task.addEventListener('mouseenter', () => {
241
- this.daishengpi = daishengpi
242
- this.yishengpi = yishengpi
207
+ if (type === 'pending') {
208
+ this.assignee = list
209
+ } else {
210
+ this.assignee = '已审批人:' + list.map((c) => c.assignee).join(',')
211
+ }
212
+ console.log(list, 5456)
243
213
  this.$nextTick(() => {
244
214
  tipShow(task, this.$refs['msgEl'])
245
215
  })
@@ -397,19 +367,23 @@ setRejectLink(from, to) {
397
367
  }
398
368
  .activiti-node-achieve circle,
399
369
  .activiti-node-achieve rect,
370
+ .activiti-node-achieve polygon,
400
371
  .activiti-line-achieve path {
401
- stroke: var(--color-primary) !important;
372
+ stroke: var(--color-success) !important;
402
373
  }
403
374
  .activiti-node-reject circle,
404
375
  .activiti-node-reject rect {
405
376
  stroke: var(--color-danger) !important;
406
377
  }
378
+ .activiti-node-at rect {
379
+ stroke: var(--color-primary-hover) !important;
380
+ }
407
381
  .activiti-line-reject {
408
382
  fill: none;
409
383
  stroke-width: 1px;
410
384
  stroke: var(--color-danger) !important;
411
385
  stroke-linejoin: round;
412
- marker-end: url('#sequenceflow-end-white-black-3aw0mc6w8vg7jarca1qf355gu');
386
+ /* marker-end: url('#sequenceflow-end-white-black-3aw0mc6w8vg7jarca1qf355gu'); */
413
387
  }
414
388
  .activiti-text-reject {
415
389
  fill: var(--color-danger) !important;
@@ -5,6 +5,9 @@
5
5
  :clearable="item | clearableF"
6
6
  style="width: 100%"
7
7
  v-bind="item.props"
8
+ :placeholder="
9
+ item.props && item.props.placeholder ? item.props.placeholder : '请输入'
10
+ "
8
11
  v-on="item.on"
9
12
  />
10
13
  <el-input
@@ -19,13 +19,9 @@
19
19
  已选
20
20
  <span class="color-main">{{ dragList.length }}</span>
21
21
  </span>
22
- <el-link
23
- :underline="false"
24
- type="primary"
25
- class="m-l-auto"
26
- @click="setAll"
27
- >{{ setState ? '全部清空' : '全部选中' }}</el-link
28
- >
22
+ <el-link :underline="false" type="primary" class="m-l-auto" @click="setAll">{{
23
+ setState ? '全部清空' : '全部选中'
24
+ }}</el-link>
29
25
  </div>
30
26
  <div class="flex-item p-r" style="height: 50%; overflow: auto">
31
27
  <el-checkbox-group :value="dragList.map((d) => d[labelKey])">
@@ -44,16 +40,10 @@
44
40
  <div class="right-c flex-column p-t-m">
45
41
  <div class="m-b">
46
42
  当前选定项
47
- <el-link type="primary" style="visibility: hidden"
48
- >当前选定项</el-link
49
- >
43
+ <el-link type="primary" style="visibility: hidden">当前选定项</el-link>
50
44
  </div>
51
45
  <div class="flex-1 overflow-y">
52
- <drag-list
53
- :list="dragList"
54
- :label-key="labelKey"
55
- :in-show-column="true"
56
- />
46
+ <drag-list :list="dragList" :label-key="labelKey" :in-show-column="true" />
57
47
  </div>
58
48
  </div>
59
49
  </div>
@@ -144,9 +134,7 @@ export default {
144
134
  }
145
135
  },
146
136
  setState() {
147
- return (
148
- this.columnsAs.length && this.columnsAs.length === this.dragList.length
149
- )
137
+ return this.columnsAs.length && this.columnsAs.length === this.dragList.length
150
138
  },
151
139
  columnsAs() {
152
140
  return this.columns.filter((col) => !col.static)
@@ -165,32 +153,20 @@ export default {
165
153
  },
166
154
  checkChange(val, column) {
167
155
  if (val === false) {
168
- let index = this.dragList.findIndex(
169
- (d) => d[this.labelKey] === column[this.labelKey]
170
- )
156
+ let index = this.dragList.findIndex((d) => d[this.labelKey] === column[this.labelKey])
171
157
  index !== -1 && this.dragList.splice(index, 1)
172
158
  } else {
173
159
  this.dragList.push(column)
174
160
  }
175
161
  },
176
162
  reset() {
177
- if (this.isFilter) {
178
- let dragList = this.columns.filter((col) => col.isDefault)
179
- this.dragList = dragList.length ? dragList : this.checkColumns
180
- return
181
- }
182
- this.dragList = this.checkColumns.filter((col) => !col.static)
163
+ let dragList = this.columns.filter((col) => col.isDefault)
164
+ this.dragList = dragList.length ? dragList : this.checkColumns.filter((col) => !col.static)
183
165
  },
184
166
  setChange() {
185
167
  if (this.dragList.length < 1) {
186
168
  this.$message.error(
187
- `至少设置${
188
- this.isExport
189
- ? '一列导出数据'
190
- : this.isFilter
191
- ? '一个筛选条件'
192
- : '一列显示列'
193
- }!`
169
+ `至少设置${this.isExport ? '一列导出数据' : this.isFilter ? '一个筛选条件' : '一列显示列'}!`
194
170
  )
195
171
  return
196
172
  }
@@ -236,9 +212,7 @@ export default {
236
212
  let columns = []
237
213
  _data.forEach((d) => {
238
214
  if (typeof d === 'string') {
239
- let column = this.columns.find(
240
- (c) => c[this.labelKey] === d
241
- )
215
+ let column = this.columns.find((c) => c[this.labelKey] === d)
242
216
  column && columns.push(column)
243
217
  } else if (typeof d === 'object') {
244
218
  columns.push(d)
@@ -247,7 +221,7 @@ export default {
247
221
  return resolve(columns)
248
222
  }
249
223
  }
250
- return resolve(undefined)
224
+ return resolve(null)
251
225
  })
252
226
  .catch((err) => {
253
227
  reject(err)
@@ -8,7 +8,7 @@
8
8
  v-on="$listeners"
9
9
  >
10
10
  <template v-for="(item, i) in columns">
11
- <slot v-if="item.slotName" :name="item.slotName"></slot>
11
+ <slot v-if="item.slotName" :name="item.slotName" :column="item"></slot>
12
12
  <el-table-column
13
13
  v-else-if="item.render"
14
14
  :key="'cl-table-' + i"