n20-common-lib 2.5.3 → 2.5.4

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": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -116,4 +116,4 @@
116
116
  "last 2 versions",
117
117
  "not dead"
118
118
  ]
119
- }
119
+ }
@@ -50,8 +50,11 @@
50
50
  width:
51
51
  form[item.value] && form[item.value].length > 0
52
52
  ? context.measureText(
53
- item.options.find((r) => r.value === form[item.value] || r[item.props?.valueKey] === form[item.value])
54
- .label
53
+ item.options.find(
54
+ (r) =>
55
+ r.value === form[item.value] ||
56
+ (item.props && item.props.valueKey && r[item.props.valueKey] === form[item.value])
57
+ ).label
55
58
  ).width *
56
59
  1.4 +
57
60
  48 +
@@ -25,7 +25,7 @@
25
25
  >
26
26
  <slot name="prefix"></slot>
27
27
  </div>
28
- <template v-for="(item, i) in GroupData">
28
+ <template v-for="item in GroupData">
29
29
  <template v-if="item && item.slotName" :slot="item.slotName">
30
30
  <slot :name="item.slotName"></slot>
31
31
  </template>
@@ -1,6 +1,6 @@
1
1
  /* 审批记录 */
2
2
  <template>
3
- <div>
3
+ <div v-if="buttonMode">
4
4
  <expandableWrap :title="'审批记录' | $lc" :show-expand="false" :icon="false">
5
5
  <template slot="tips">
6
6
  <el-button plain size="mini" :disabled="false" @click="cardV = true">{{ '审批进度查看' | $lc }}</el-button>
@@ -30,12 +30,24 @@
30
30
  <approvalImg class="text-c p-a" :proc-inst-id="procInstIdC" style="height: 70vh; overflow: auto" />
31
31
  </el-dialog>
32
32
  </div>
33
+ <div v-else>
34
+ <expandableWrap title="审批记录">
35
+ <template slot="tips">
36
+ <el-button size="mini" plain @click="imgV = true">流程图查看</el-button>
37
+ </template>
38
+ <approvalCard :procInstId="procInstIdC" />
39
+ <el-dialog v-drag title="查看流程" :visible.sync="imgV" width="65%" class="p-a-0" append-to-body top="10vh">
40
+ <approvalImg class="text-c p-a" style="height: 70vh; overflow: auto" />
41
+ </el-dialog>
42
+ </expandableWrap>
43
+ </div>
33
44
  </template>
34
45
 
35
46
  <script>
36
47
  import expandableWrap from '../Expandable/main.vue'
37
48
  import approvalCard from '../ApprovalCard/index.vue'
38
49
  import approvalImg from './approvalImg.vue'
50
+
39
51
  export default {
40
52
  name: 'ApprovalRecord',
41
53
  components: {
@@ -47,6 +59,10 @@ export default {
47
59
  procInstId: {
48
60
  type: String,
49
61
  default: undefined
62
+ },
63
+ buttonMode: {
64
+ type: Boolean,
65
+ default: true
50
66
  }
51
67
  },
52
68
  data() {
@@ -51,6 +51,53 @@ let disabledDate_2 = (t) => {
51
51
  return t > now
52
52
  }
53
53
 
54
+ let shortcuts_1 = [
55
+ {
56
+ text: $lc('最近一月'),
57
+ onClick(picker) {
58
+ const start = new Date()
59
+ const end = new Date()
60
+ start.setMonth(start.getMonth() - 1)
61
+ start.setHours(0, 0, 0)
62
+ end.setHours(23, 59, 59)
63
+ picker.$emit('pick', [start, end])
64
+ }
65
+ },
66
+ {
67
+ text: $lc('最近三月'),
68
+ onClick(picker) {
69
+ const start = new Date()
70
+ const end = new Date()
71
+ start.setMonth(start.getMonth() - 3)
72
+ start.setHours(0, 0, 0)
73
+ end.setHours(23, 59, 59)
74
+ picker.$emit('pick', [start, end])
75
+ }
76
+ },
77
+ {
78
+ text: $lc('最近六月'),
79
+ onClick(picker) {
80
+ const start = new Date()
81
+ const end = new Date()
82
+ start.setMonth(start.getMonth() - 6)
83
+ start.setHours(0, 0, 0)
84
+ end.setHours(23, 59, 59)
85
+ picker.$emit('pick', [start, end])
86
+ }
87
+ },
88
+ {
89
+ text: $lc('最近一年'),
90
+ onClick(picker) {
91
+ const start = new Date()
92
+ const end = new Date()
93
+ start.setFullYear(start.getFullYear() - 1)
94
+ start.setHours(0, 0, 0)
95
+ end.setHours(23, 59, 59)
96
+ picker.$emit('pick', [start, end])
97
+ }
98
+ }
99
+ ]
100
+
54
101
  let shortcuts_2 = [
55
102
  {
56
103
  text: $lc('最近一月'),
@@ -149,6 +196,10 @@ export default {
149
196
  type: Boolean,
150
197
  default: true
151
198
  },
199
+ startStop: {
200
+ type: Boolean,
201
+ default: false
202
+ },
152
203
  clearable: {
153
204
  type: Boolean,
154
205
  default: true
@@ -160,7 +211,8 @@ export default {
160
211
  },
161
212
  data() {
162
213
  let shortcuts = undefined
163
- if (this.shortcuts && ['daterange', 'datetimerange'].includes(this.type)) shortcuts = shortcuts_2
214
+ if (this.shortcuts && ['daterange', 'datetimerange'].includes(this.type))
215
+ shortcuts = this.startStop ? shortcuts_2 : shortcuts_1
164
216
 
165
217
  this.pickerOptionsAs = Object.assign(
166
218
  {
@@ -171,7 +223,11 @@ export default {
171
223
  this.pickerOptions
172
224
  )
173
225
 
174
- this.listeners = Object.assign({}, this.$listeners, { input: () => {}, change: () => {}, blur: this.HandleBlur })
226
+ this.listeners = Object.assign({}, this.$listeners, {
227
+ input: () => {},
228
+ change: () => {},
229
+ blur: this.HandleBlur
230
+ })
175
231
  return {}
176
232
  },
177
233
  computed: {
@@ -131,10 +131,6 @@ export default {
131
131
  type: Function,
132
132
  default: undefined
133
133
  },
134
- beforeRemove: {
135
- type: Function,
136
- default: undefined
137
- },
138
134
  beforeUpload: {
139
135
  type: Function,
140
136
  default: undefined
@@ -192,24 +188,13 @@ export default {
192
188
  this.$emit('importError')
193
189
  },
194
190
  clearFile() {
195
- if (!this.beforeRemove) {
196
- if (this.onRemove) {
197
- this.onRemove(this.fileList[0], this.fileList)
198
- } else {
199
- this.fileNameC = ''
200
- this.fileUrlC = ''
201
- this.fileList.pop()
202
- console.log('删除上传')
203
- }
191
+ if (this.onRemove) {
192
+ this.onRemove(this.fileList[0], this.fileList)
204
193
  } else {
205
- const before = this.beforeRemove(this.fileList)
206
- if (before && before.then) {
207
- before.then(() => {
208
- this.onRemove(this.fileList[0], this.fileList)
209
- })
210
- } else if (before !== false) {
211
- this.onRemove(this.fileList[0], this.fileList)
212
- }
194
+ this.fileNameC = ''
195
+ this.fileUrlC = ''
196
+ this.fileList.pop()
197
+ console.log('删除上传')
213
198
  }
214
199
  },
215
200
  beforeUploadFn(file) {
@@ -348,19 +333,8 @@ export default {
348
333
  }
349
334
  },
350
335
  removeFn(file, fileList) {
351
- if (!this.beforeRemove) {
352
- if (this.onRemove) {
353
- this.onRemove(file, fileList)
354
- }
355
- } else {
356
- const before = this.beforeRemove(file, fileList)
357
- if (before && before.then) {
358
- before.then(() => {
359
- this.onRemove(file, fileList)
360
- })
361
- } else if (before !== false) {
362
- this.onRemove(file, fileList)
363
- }
336
+ if (this.onRemove) {
337
+ this.onRemove(file, fileList)
364
338
  }
365
339
  },
366
340
  submit() {