doway-coms 2.10.71 → 2.10.72
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/.browserslistrc +2 -2
- package/README.md +28 -28
- package/dist/css/chunk-vendors.7f83d8f9.css +8 -0
- package/dist/css/index.7946d50b.css +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/js/chunk-vendors.28fda91d.js +340 -0
- package/dist/js/index.49bc6add.js +2 -0
- package/lib/doway-coms.common.js +120397 -0
- package/lib/doway-coms.css +1 -0
- package/lib/doway-coms.umd.js +120407 -0
- package/lib/doway-coms.umd.min.js +328 -0
- package/package.json +54 -54
- package/packages/AuditsList/index.js +7 -7
- package/packages/AuditsList/src/index.vue +315 -315
- package/packages/BaseButton/index.js +7 -7
- package/packages/BaseButton/src/index.vue +242 -242
- package/packages/BaseCheckbox/index.js +7 -7
- package/packages/BaseCheckbox/src/index.vue +134 -134
- package/packages/BaseDate/index.js +7 -7
- package/packages/BaseDate/src/index.vue +197 -197
- package/packages/BaseDateWeek/index.js +7 -7
- package/packages/BaseDateWeek/src/index.vue +163 -163
- package/packages/BaseDatetime/index.js +7 -7
- package/packages/BaseDatetime/src/index.vue +196 -196
- package/packages/BaseFileGroup/index.js +7 -7
- package/packages/BaseFileGroup/src/index.vue +724 -724
- package/packages/BaseForm/index.js +7 -7
- package/packages/BaseForm/src/index.vue +873 -873
- package/packages/BaseGantt/index.js +9 -9
- package/packages/BaseGantt/src/index.vue +617 -617
- package/packages/BaseGrid/index.js +9 -9
- package/packages/BaseGrid/src/exportCmp.vue +105 -105
- package/packages/BaseGrid/src/gridApi.js +32 -32
- package/packages/BaseGrid/src/index.vue +4048 -4032
- package/packages/BaseGridAdjust/index.js +9 -9
- package/packages/BaseGridAdjust/src/index.vue +482 -482
- package/packages/BaseInput/index.js +7 -7
- package/packages/BaseInput/src/index.vue +194 -194
- package/packages/BaseIntervalInput/index.js +7 -7
- package/packages/BaseIntervalInput/src/index.vue +310 -310
- package/packages/BaseKanbanEmpty/index.js +7 -7
- package/packages/BaseKanbanEmpty/src/index.vue +176 -176
- package/packages/BaseNumberInput/index.js +7 -7
- package/packages/BaseNumberInput/src/index.vue +290 -290
- package/packages/BasePagination/index.js +7 -7
- package/packages/BasePagination/src/index.vue +91 -91
- package/packages/BasePictureCard/index.js +7 -7
- package/packages/BasePictureCard/src/index.vue +671 -671
- package/packages/BasePrintPreview/index.js +7 -7
- package/packages/BasePrintPreview/src/index.vue +150 -150
- package/packages/BasePulldown/index.js +7 -7
- package/packages/BasePulldown/src/index.vue +1392 -1392
- package/packages/BaseSearch/index.js +7 -7
- package/packages/BaseSearch/src/index.vue +935 -935
- package/packages/BaseSelect/index.js +7 -7
- package/packages/BaseSelect/src/index.vue +155 -155
- package/packages/BaseSelectMulti/index.js +7 -7
- package/packages/BaseSelectMulti/src/index.vue +148 -148
- package/packages/BaseTextArea/index.js +7 -7
- package/packages/BaseTextArea/src/index.vue +178 -178
- package/packages/BaseTime/index.js +7 -7
- package/packages/BaseTime/src/index.vue +166 -166
- package/packages/BaseTool/index.js +7 -7
- package/packages/BaseTool/src/index.vue +353 -353
- package/packages/BaseToolStatus/index.js +7 -7
- package/packages/BaseToolStatus/src/ApprovalPersonsGroup.vue +41 -41
- package/packages/BaseToolStatus/src/index.vue +439 -439
- package/packages/BaseTreeSelect/index.js +8 -8
- package/packages/BaseTreeSelect/src/index.vue +437 -437
- package/packages/HistoryModal/index.js +8 -8
- package/packages/HistoryModal/src/index.vue +144 -144
- package/packages/LeaveAMessage/index.js +7 -7
- package/packages/LeaveAMessage/src/index.vue +601 -601
- package/packages/directive/clickoutside.js +44 -44
- package/packages/index.js +197 -197
- package/packages/styles/default.css +78 -78
- package/packages/styles/default.less +91 -91
- package/packages/utils/api.js +106 -106
- package/packages/utils/auth.js +38 -38
- package/packages/utils/common.js +703 -636
- package/packages/utils/dom.js +181 -181
- package/packages/utils/enum.js +86 -86
- package/packages/utils/filters.js +485 -485
- package/packages/utils/gridFormat.js +66 -66
- package/packages/utils/msg.js +84 -84
- package/packages/utils/patchFiles.js +44 -44
- package/packages/utils/request.js +181 -181
- package/packages/utils/store.js +372 -372
- package/vue.config.js +59 -59
package/packages/utils/common.js
CHANGED
|
@@ -1,636 +1,703 @@
|
|
|
1
|
-
import {notification } from 'ant-design-vue'
|
|
2
|
-
import store from './store'
|
|
3
|
-
import XEUtils from 'xe-utils'
|
|
4
|
-
import axios from 'axios'
|
|
5
|
-
/**
|
|
6
|
-
* 替换掩码参数字符串
|
|
7
|
-
* @param {参数字符串} paramString
|
|
8
|
-
* @param {当前页面数据集} formData
|
|
9
|
-
*/
|
|
10
|
-
export function replaceParamString(
|
|
11
|
-
paramString,
|
|
12
|
-
formData,
|
|
13
|
-
currentModuleSelectInfo
|
|
14
|
-
) {
|
|
15
|
-
// hh添加
|
|
16
|
-
let tempStr = paramString
|
|
17
|
-
while (true) {
|
|
18
|
-
if (tempStr.indexOf('@Fn(') < 0) {
|
|
19
|
-
break
|
|
20
|
-
}
|
|
21
|
-
let tempReplaceParam = tempStr.substr(tempStr.indexOf('@Fn('))
|
|
22
|
-
tempReplaceParam = tempReplaceParam.substr(
|
|
23
|
-
0,
|
|
24
|
-
tempReplaceParam.indexOf(')') + 1
|
|
25
|
-
) // 查找掩码参数
|
|
26
|
-
let tempDataFields = tempReplaceParam
|
|
27
|
-
.substr(0, tempReplaceParam.length - 1)
|
|
28
|
-
.substr(4)
|
|
29
|
-
.split('.')
|
|
30
|
-
let tempReplaceValue = null
|
|
31
|
-
if (tempDataFields[0] === '') {
|
|
32
|
-
// 取主表数据
|
|
33
|
-
tempReplaceValue = formData[tempDataFields[1]]
|
|
34
|
-
} else {
|
|
35
|
-
if (formData[tempDataFields[0]] instanceof Array) {
|
|
36
|
-
let tempSelectItemInfo = currentModuleSelectInfo.filter(filterItem => {
|
|
37
|
-
return filterItem.attrDataName === tempDataFields[0]
|
|
38
|
-
})
|
|
39
|
-
if (tempSelectItemInfo.length > 0) {
|
|
40
|
-
let tempKeyFieldValue =
|
|
41
|
-
tempSelectItemInfo[0].selectItem[tempSelectItemInfo[0].keyField]
|
|
42
|
-
let tempActualRow = formData[tempDataFields[0]].filter(filterItem => {
|
|
43
|
-
return (
|
|
44
|
-
filterItem[tempSelectItemInfo[0].keyField] === tempKeyFieldValue
|
|
45
|
-
)
|
|
46
|
-
})
|
|
47
|
-
if (tempActualRow.length > 0) {
|
|
48
|
-
tempReplaceValue = tempActualRow[0][tempDataFields[1]]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
tempReplaceValue = formData[tempDataFields[0]][tempDataFields[1]]
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//刘松嗣临时处理
|
|
56
|
-
if (tempReplaceValue == undefined) {
|
|
57
|
-
tempReplaceValue = '0'
|
|
58
|
-
}
|
|
59
|
-
tempStr = tempStr.substr(
|
|
60
|
-
tempStr.indexOf(tempReplaceParam) + tempReplaceParam.length
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
if (typeof tempReplaceValue === 'string') {
|
|
64
|
-
paramString = paramString.replace(
|
|
65
|
-
tempReplaceParam,
|
|
66
|
-
'"' + tempReplaceValue + '"'
|
|
67
|
-
)
|
|
68
|
-
tempStr = tempStr.replace(tempReplaceParam, '"' + tempReplaceValue + '"')
|
|
69
|
-
} else {
|
|
70
|
-
paramString = paramString.replace(tempReplaceParam, tempReplaceValue)
|
|
71
|
-
tempStr = tempStr.replace(tempReplaceParam, tempReplaceValue)
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return paramString
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 替换掩码参数字符串
|
|
79
|
-
* @param {参数字符串} paramString
|
|
80
|
-
* @param {当前页面数据集} formData
|
|
81
|
-
*/
|
|
82
|
-
export function replaceParam(paramString, formData) {
|
|
83
|
-
let tempStr = paramString
|
|
84
|
-
while (true) {
|
|
85
|
-
if (tempStr.indexOf('@Fn(') < 0) {
|
|
86
|
-
break
|
|
87
|
-
}
|
|
88
|
-
let tempReplaceParam = tempStr.substr(tempStr.indexOf('@Fn('))
|
|
89
|
-
tempReplaceParam = tempReplaceParam.substr(
|
|
90
|
-
0,
|
|
91
|
-
tempReplaceParam.indexOf(')') + 1
|
|
92
|
-
) // 查找掩码参数
|
|
93
|
-
let tempDataFields = tempReplaceParam
|
|
94
|
-
.substr(0, tempReplaceParam.length - 1)
|
|
95
|
-
.substr(4)
|
|
96
|
-
.split('.')
|
|
97
|
-
let tempReplaceValue = null
|
|
98
|
-
if (tempDataFields[0] === '') {
|
|
99
|
-
// 取主表数据
|
|
100
|
-
tempReplaceValue = formData[tempDataFields[1]]
|
|
101
|
-
} else {
|
|
102
|
-
tempReplaceValue = formData[tempDataFields[0]][tempDataFields[1]]
|
|
103
|
-
}
|
|
104
|
-
tempStr = tempStr.substr(
|
|
105
|
-
tempStr.indexOf(tempReplaceParam) + tempReplaceParam.length
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
// if (typeof tempReplaceValue === 'string') {
|
|
109
|
-
// paramString = paramString.replace(
|
|
110
|
-
// tempReplaceParam,
|
|
111
|
-
// '"' + tempReplaceValue + '"'
|
|
112
|
-
// )
|
|
113
|
-
// tempStr = tempStr.replace(tempReplaceParam, '"' + tempReplaceValue + '"')
|
|
114
|
-
// } else {
|
|
115
|
-
paramString = paramString.replace(tempReplaceParam, tempReplaceValue)
|
|
116
|
-
tempStr = tempStr.replace(tempReplaceParam, tempReplaceValue)
|
|
117
|
-
// }
|
|
118
|
-
}
|
|
119
|
-
return paramString
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function setFrameColState(formCols, formState, formStatus) {
|
|
123
|
-
for (let prop in formCols) {
|
|
124
|
-
if (formCols[prop].editStates instanceof Array) {
|
|
125
|
-
let exists = formCols[prop].editStates.filter(item => {
|
|
126
|
-
//editState:['add','edit']
|
|
127
|
-
return item === formState // view === add|edit formState :view|add|edit
|
|
128
|
-
}) //[]
|
|
129
|
-
if (exists.length > 0) {
|
|
130
|
-
formCols[prop].edit = true
|
|
131
|
-
} else {
|
|
132
|
-
formCols[prop].edit = false
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// 单据状态控制
|
|
136
|
-
if (
|
|
137
|
-
formStatus &&
|
|
138
|
-
formCols[prop].editStatuss instanceof Array &&
|
|
139
|
-
formCols[prop].editStatuss.length > 0 &&
|
|
140
|
-
formCols[prop].edit === true
|
|
141
|
-
) {
|
|
142
|
-
let formStatusExists = formCols[prop].editStatuss.filter(item => {
|
|
143
|
-
//editStatuss:[,'publish',]
|
|
144
|
-
return item === formStatus // formStatus:'draft'
|
|
145
|
-
})
|
|
146
|
-
if (formStatusExists.length > 0) {
|
|
147
|
-
formCols[prop].edit = true
|
|
148
|
-
} else {
|
|
149
|
-
formCols[prop].edit = false
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
// Vue.set(formCols, i, formCols[i])
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
toolBars[i].visible = toolBars[i].
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
)
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
)
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
rowInfo[colInfo.
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
),
|
|
369
|
-
|
|
370
|
-
)
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
rowInfo[colInfo.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
rowInfo[colInfo.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
434
|
-
colInfo.
|
|
435
|
-
)
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
rowInfo[colInfo.amountNotTaxField]
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
rowInfo[colInfo.
|
|
490
|
-
colInfo.
|
|
491
|
-
)
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
*
|
|
513
|
-
* @param {
|
|
514
|
-
* @param {
|
|
515
|
-
* @param {
|
|
516
|
-
* @param {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
rowInfo[colInfo.
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
1
|
+
import {notification } from 'ant-design-vue'
|
|
2
|
+
import store from './store'
|
|
3
|
+
import XEUtils from 'xe-utils'
|
|
4
|
+
import axios from 'axios'
|
|
5
|
+
/**
|
|
6
|
+
* 替换掩码参数字符串
|
|
7
|
+
* @param {参数字符串} paramString
|
|
8
|
+
* @param {当前页面数据集} formData
|
|
9
|
+
*/
|
|
10
|
+
export function replaceParamString(
|
|
11
|
+
paramString,
|
|
12
|
+
formData,
|
|
13
|
+
currentModuleSelectInfo
|
|
14
|
+
) {
|
|
15
|
+
// hh添加
|
|
16
|
+
let tempStr = paramString
|
|
17
|
+
while (true) {
|
|
18
|
+
if (tempStr.indexOf('@Fn(') < 0) {
|
|
19
|
+
break
|
|
20
|
+
}
|
|
21
|
+
let tempReplaceParam = tempStr.substr(tempStr.indexOf('@Fn('))
|
|
22
|
+
tempReplaceParam = tempReplaceParam.substr(
|
|
23
|
+
0,
|
|
24
|
+
tempReplaceParam.indexOf(')') + 1
|
|
25
|
+
) // 查找掩码参数
|
|
26
|
+
let tempDataFields = tempReplaceParam
|
|
27
|
+
.substr(0, tempReplaceParam.length - 1)
|
|
28
|
+
.substr(4)
|
|
29
|
+
.split('.')
|
|
30
|
+
let tempReplaceValue = null
|
|
31
|
+
if (tempDataFields[0] === '') {
|
|
32
|
+
// 取主表数据
|
|
33
|
+
tempReplaceValue = formData[tempDataFields[1]]
|
|
34
|
+
} else {
|
|
35
|
+
if (formData[tempDataFields[0]] instanceof Array) {
|
|
36
|
+
let tempSelectItemInfo = currentModuleSelectInfo.filter(filterItem => {
|
|
37
|
+
return filterItem.attrDataName === tempDataFields[0]
|
|
38
|
+
})
|
|
39
|
+
if (tempSelectItemInfo.length > 0) {
|
|
40
|
+
let tempKeyFieldValue =
|
|
41
|
+
tempSelectItemInfo[0].selectItem[tempSelectItemInfo[0].keyField]
|
|
42
|
+
let tempActualRow = formData[tempDataFields[0]].filter(filterItem => {
|
|
43
|
+
return (
|
|
44
|
+
filterItem[tempSelectItemInfo[0].keyField] === tempKeyFieldValue
|
|
45
|
+
)
|
|
46
|
+
})
|
|
47
|
+
if (tempActualRow.length > 0) {
|
|
48
|
+
tempReplaceValue = tempActualRow[0][tempDataFields[1]]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
tempReplaceValue = formData[tempDataFields[0]][tempDataFields[1]]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//刘松嗣临时处理
|
|
56
|
+
if (tempReplaceValue == undefined) {
|
|
57
|
+
tempReplaceValue = '0'
|
|
58
|
+
}
|
|
59
|
+
tempStr = tempStr.substr(
|
|
60
|
+
tempStr.indexOf(tempReplaceParam) + tempReplaceParam.length
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
if (typeof tempReplaceValue === 'string') {
|
|
64
|
+
paramString = paramString.replace(
|
|
65
|
+
tempReplaceParam,
|
|
66
|
+
'"' + tempReplaceValue + '"'
|
|
67
|
+
)
|
|
68
|
+
tempStr = tempStr.replace(tempReplaceParam, '"' + tempReplaceValue + '"')
|
|
69
|
+
} else {
|
|
70
|
+
paramString = paramString.replace(tempReplaceParam, tempReplaceValue)
|
|
71
|
+
tempStr = tempStr.replace(tempReplaceParam, tempReplaceValue)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return paramString
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 替换掩码参数字符串
|
|
79
|
+
* @param {参数字符串} paramString
|
|
80
|
+
* @param {当前页面数据集} formData
|
|
81
|
+
*/
|
|
82
|
+
export function replaceParam(paramString, formData) {
|
|
83
|
+
let tempStr = paramString
|
|
84
|
+
while (true) {
|
|
85
|
+
if (tempStr.indexOf('@Fn(') < 0) {
|
|
86
|
+
break
|
|
87
|
+
}
|
|
88
|
+
let tempReplaceParam = tempStr.substr(tempStr.indexOf('@Fn('))
|
|
89
|
+
tempReplaceParam = tempReplaceParam.substr(
|
|
90
|
+
0,
|
|
91
|
+
tempReplaceParam.indexOf(')') + 1
|
|
92
|
+
) // 查找掩码参数
|
|
93
|
+
let tempDataFields = tempReplaceParam
|
|
94
|
+
.substr(0, tempReplaceParam.length - 1)
|
|
95
|
+
.substr(4)
|
|
96
|
+
.split('.')
|
|
97
|
+
let tempReplaceValue = null
|
|
98
|
+
if (tempDataFields[0] === '') {
|
|
99
|
+
// 取主表数据
|
|
100
|
+
tempReplaceValue = formData[tempDataFields[1]]
|
|
101
|
+
} else {
|
|
102
|
+
tempReplaceValue = formData[tempDataFields[0]][tempDataFields[1]]
|
|
103
|
+
}
|
|
104
|
+
tempStr = tempStr.substr(
|
|
105
|
+
tempStr.indexOf(tempReplaceParam) + tempReplaceParam.length
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
// if (typeof tempReplaceValue === 'string') {
|
|
109
|
+
// paramString = paramString.replace(
|
|
110
|
+
// tempReplaceParam,
|
|
111
|
+
// '"' + tempReplaceValue + '"'
|
|
112
|
+
// )
|
|
113
|
+
// tempStr = tempStr.replace(tempReplaceParam, '"' + tempReplaceValue + '"')
|
|
114
|
+
// } else {
|
|
115
|
+
paramString = paramString.replace(tempReplaceParam, tempReplaceValue)
|
|
116
|
+
tempStr = tempStr.replace(tempReplaceParam, tempReplaceValue)
|
|
117
|
+
// }
|
|
118
|
+
}
|
|
119
|
+
return paramString
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function setFrameColState(formCols, formState, formStatus) {
|
|
123
|
+
for (let prop in formCols) {
|
|
124
|
+
if (formCols[prop].editStates instanceof Array) {
|
|
125
|
+
let exists = formCols[prop].editStates.filter(item => {
|
|
126
|
+
//editState:['add','edit']
|
|
127
|
+
return item === formState // view === add|edit formState :view|add|edit
|
|
128
|
+
}) //[]
|
|
129
|
+
if (exists.length > 0) {
|
|
130
|
+
formCols[prop].edit = true
|
|
131
|
+
} else {
|
|
132
|
+
formCols[prop].edit = false
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// 单据状态控制
|
|
136
|
+
if (
|
|
137
|
+
formStatus &&
|
|
138
|
+
formCols[prop].editStatuss instanceof Array &&
|
|
139
|
+
formCols[prop].editStatuss.length > 0 &&
|
|
140
|
+
formCols[prop].edit === true
|
|
141
|
+
) {
|
|
142
|
+
let formStatusExists = formCols[prop].editStatuss.filter(item => {
|
|
143
|
+
//editStatuss:[,'publish',]
|
|
144
|
+
return item === formStatus // formStatus:'draft'
|
|
145
|
+
})
|
|
146
|
+
if (formStatusExists.length > 0) {
|
|
147
|
+
formCols[prop].edit = true
|
|
148
|
+
} else {
|
|
149
|
+
formCols[prop].edit = false
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Vue.set(formCols, i, formCols[i])
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* 按钮条件权限
|
|
157
|
+
* @param {} formData
|
|
158
|
+
* @param {*} toolBars
|
|
159
|
+
*/
|
|
160
|
+
export function setFrameToolPerExp(formData, toolBars) {
|
|
161
|
+
for (let i = 0; i < toolBars.length; i++) {
|
|
162
|
+
if(!toolBars[i].perExp){
|
|
163
|
+
continue
|
|
164
|
+
}
|
|
165
|
+
//存在条件表达式
|
|
166
|
+
toolBars[i].visible = evaluateExpression(formData, toolBars[i].perExp)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* 评估表达式
|
|
171
|
+
* @param {Object} formData
|
|
172
|
+
* @param {Object} expression
|
|
173
|
+
* @returns {boolean}
|
|
174
|
+
*/
|
|
175
|
+
function evaluateExpression(formData, expression) {
|
|
176
|
+
if (!expression.expressions) {
|
|
177
|
+
return evaluateSimpleExpression(formData, expression)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const results = expression.expressions.map(exp => {
|
|
181
|
+
if (exp.expressions) {
|
|
182
|
+
// 处理嵌套表达式
|
|
183
|
+
const subResults = exp.expressions.map(subExp =>
|
|
184
|
+
evaluateSimpleExpression(formData, subExp)
|
|
185
|
+
)
|
|
186
|
+
return exp.operator === 'or'
|
|
187
|
+
? subResults.some(r => r)
|
|
188
|
+
: subResults.every(r => r)
|
|
189
|
+
}
|
|
190
|
+
return evaluateSimpleExpression(formData, exp)
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
return expression.operator === 'and'
|
|
194
|
+
? results.every(r => r)
|
|
195
|
+
: results.some(r => r)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 评估简单表达式
|
|
200
|
+
* @param {Object} formData
|
|
201
|
+
* @param {Object} expression
|
|
202
|
+
* @returns {boolean}
|
|
203
|
+
*/
|
|
204
|
+
function evaluateSimpleExpression(formData, expression) {
|
|
205
|
+
const { field, operator, value } = expression
|
|
206
|
+
const fieldValue = formData[field]
|
|
207
|
+
|
|
208
|
+
switch (operator) {
|
|
209
|
+
case 'IN':
|
|
210
|
+
return Array.isArray(value) && value.includes(fieldValue)
|
|
211
|
+
case 'CO':
|
|
212
|
+
return String(fieldValue).includes(String(value))
|
|
213
|
+
case 'EQ':
|
|
214
|
+
return fieldValue === value
|
|
215
|
+
case 'NE':
|
|
216
|
+
return fieldValue !== value
|
|
217
|
+
// 可以根据需要添加更多操作符
|
|
218
|
+
default:
|
|
219
|
+
return false
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
export function setFrameToolBtnState(toolBars, formState, formStatus) {
|
|
223
|
+
for (let i = 0; i < toolBars.length; i++) {
|
|
224
|
+
toolBars[i].visible = false
|
|
225
|
+
toolBars[i].isPrimary = false
|
|
226
|
+
if (
|
|
227
|
+
toolBars[i].visibleStates &&
|
|
228
|
+
toolBars[i].visibleStates.indexOf(formState) >= 0
|
|
229
|
+
) {
|
|
230
|
+
toolBars[i].visible = true
|
|
231
|
+
}
|
|
232
|
+
if (formStatus && toolBars[i].visibleStatuss && toolBars[i].visible) {
|
|
233
|
+
toolBars[i].visible = toolBars[i].visibleStatuss.indexOf(formStatus) >= 0
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// 查找优先级最大的并且显示的设置按钮强调色
|
|
237
|
+
let visibleBtns = toolBars.filter(filterItem => {
|
|
238
|
+
return filterItem.visible === true
|
|
239
|
+
})
|
|
240
|
+
//循环数组查找出小于自身的priority优先级 优先级高设置按钮强调色
|
|
241
|
+
for (let i = 0; i < visibleBtns.length; i++) {
|
|
242
|
+
let tempPriority = visibleBtns[i].priority
|
|
243
|
+
let tempBtns = visibleBtns.filter(filterItem => {
|
|
244
|
+
return filterItem.priority < tempPriority
|
|
245
|
+
})
|
|
246
|
+
//如果找到小于自身优先级的数量>0就说明还有更小的跳出本次不设置true继续查找
|
|
247
|
+
if (tempBtns.length > 0) {
|
|
248
|
+
continue
|
|
249
|
+
}
|
|
250
|
+
visibleBtns[i].isPrimary = true
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
export function showErrors(errs) {
|
|
254
|
+
let errors = ''
|
|
255
|
+
for (let i = 0; i < errs.length; i++) {
|
|
256
|
+
errors = errors + errs[i] + '\n'
|
|
257
|
+
}
|
|
258
|
+
notification.error({
|
|
259
|
+
style: {
|
|
260
|
+
whiteSpace: 'pre-wrap'
|
|
261
|
+
},
|
|
262
|
+
message: '错误',
|
|
263
|
+
description: errors,
|
|
264
|
+
placement: 'topRight',
|
|
265
|
+
top: '100px'
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
export function getUuid() {
|
|
269
|
+
let d = new Date().getTime()
|
|
270
|
+
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
|
|
271
|
+
c
|
|
272
|
+
) {
|
|
273
|
+
let r = (d + Math.random() * 16) % 16 | 0
|
|
274
|
+
d = Math.floor(d / 16)
|
|
275
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
|
|
276
|
+
})
|
|
277
|
+
return uuid
|
|
278
|
+
}
|
|
279
|
+
export async function getFormValidErrors(formView) {
|
|
280
|
+
let formErrors = []
|
|
281
|
+
const validFormError = await formView.validate().catch(errMap => errMap)
|
|
282
|
+
if (validFormError === false) {
|
|
283
|
+
for (let errorProp in formView.errors) {
|
|
284
|
+
for (let x = 0; x < formView.errors[errorProp].length; x++) {
|
|
285
|
+
formErrors.push(errorProp + ':' + formView.errors[errorProp][x])
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return formErrors
|
|
290
|
+
}
|
|
291
|
+
export function stringUrlQuery(obj) {
|
|
292
|
+
let strUrlQuery = ''
|
|
293
|
+
for (let prop in obj) {
|
|
294
|
+
strUrlQuery = strUrlQuery + prop + '=' + obj[prop] + '&'
|
|
295
|
+
}
|
|
296
|
+
if (strUrlQuery.length > 0) {
|
|
297
|
+
strUrlQuery = strUrlQuery.substring(0, strUrlQuery.length - 1)
|
|
298
|
+
}
|
|
299
|
+
return strUrlQuery
|
|
300
|
+
}
|
|
301
|
+
export function getRouteFullPath(route) {
|
|
302
|
+
let fullPath = route.path + '?' + stringUrlQuery(route.query)
|
|
303
|
+
return fullPath
|
|
304
|
+
}
|
|
305
|
+
export async function getGridValidErrors(gridView) {
|
|
306
|
+
const gridErrors = await gridView.fullValidate()
|
|
307
|
+
return gridErrors
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function routeBeforeEach(to, from, next){
|
|
311
|
+
if(to.params.aliveCacheKey){
|
|
312
|
+
to.meta['aliveCacheKey'] = to.params.aliveCacheKey
|
|
313
|
+
}
|
|
314
|
+
if(!to.meta.aliveCacheKey){
|
|
315
|
+
// alert('防呆,子应用没有路由缓存键:' + JSON.stringify(to))
|
|
316
|
+
notification.error({
|
|
317
|
+
style: {
|
|
318
|
+
whiteSpace: 'pre-wrap'
|
|
319
|
+
},
|
|
320
|
+
message: '路由错误',
|
|
321
|
+
description: '防呆,子应用没有路由缓存键:' + JSON.stringify(to),
|
|
322
|
+
placement: 'topRight',
|
|
323
|
+
top: '100px'
|
|
324
|
+
})
|
|
325
|
+
}
|
|
326
|
+
if (to.meta.moduleCode && !store.getters.moduleViewInfo[to.meta.moduleCode]) {
|
|
327
|
+
// axios.all([store.dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode }),
|
|
328
|
+
// store.dispatch('moduleLoadLangInfo', { moduleCode: to.meta.moduleCode,moduleLangCacheHash:to.meta.moduleLangCacheHash })])
|
|
329
|
+
// .then(axios.spread(function() {
|
|
330
|
+
// next()
|
|
331
|
+
// }))
|
|
332
|
+
store
|
|
333
|
+
.dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode,companyId: store.getters.company ? store.getters.company.id : '' })
|
|
334
|
+
.then(() => {
|
|
335
|
+
next()
|
|
336
|
+
})
|
|
337
|
+
.catch((err) => {
|
|
338
|
+
console.debug(err)
|
|
339
|
+
})
|
|
340
|
+
} else {
|
|
341
|
+
next()
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* 供应商未税单价计算金额
|
|
347
|
+
* @param {行数据信息} rowInfo
|
|
348
|
+
* @param {税率} taxRate
|
|
349
|
+
* @param {数量字段} qtyField
|
|
350
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
351
|
+
* @param {含税单价字段} unitPriceField
|
|
352
|
+
* @param {未税金额字段} amountNotTaxField
|
|
353
|
+
* @param {含税金额字段} amountField
|
|
354
|
+
* @param {税额字段} taxField
|
|
355
|
+
*/
|
|
356
|
+
export function supplyUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
|
|
357
|
+
//未税计算方式
|
|
358
|
+
//未税金额
|
|
359
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
360
|
+
XEUtils.multiply(
|
|
361
|
+
rowInfo[colInfo.qtyField],
|
|
362
|
+
rowInfo[colInfo.unitPriceNotTaxField]
|
|
363
|
+
),
|
|
364
|
+
2
|
|
365
|
+
)
|
|
366
|
+
//税额
|
|
367
|
+
rowInfo[colInfo.taxField] = XEUtils.round(
|
|
368
|
+
XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
|
|
369
|
+
2
|
|
370
|
+
)
|
|
371
|
+
//含税金额 = 未税金额+税额
|
|
372
|
+
rowInfo[colInfo.amountField] = XEUtils.add(
|
|
373
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
374
|
+
rowInfo[colInfo.taxField]
|
|
375
|
+
)
|
|
376
|
+
//返回来计算含税单价
|
|
377
|
+
|
|
378
|
+
rowInfo[colInfo.unitPriceField] = XEUtils.round(
|
|
379
|
+
XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
|
|
380
|
+
store.getters.supplyPricePrecision,
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
if (colInfo.direction) {
|
|
384
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
385
|
+
rowInfo[colInfo.taxField],
|
|
386
|
+
colInfo.direction
|
|
387
|
+
)
|
|
388
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
389
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
390
|
+
colInfo.direction
|
|
391
|
+
)
|
|
392
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
393
|
+
rowInfo[colInfo.amountField],
|
|
394
|
+
colInfo.direction
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* 供应商含税单价计算金额
|
|
401
|
+
* @param {行数据信息} rowInfo
|
|
402
|
+
* @param {税率} taxRate
|
|
403
|
+
* @param {数量字段} qtyField
|
|
404
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
405
|
+
* @param {含税单价字段} unitPriceField
|
|
406
|
+
* @param {未税金额字段} amountNotTaxField
|
|
407
|
+
* @param {含税金额字段} amountField
|
|
408
|
+
* @param {税额字段} taxField
|
|
409
|
+
*/
|
|
410
|
+
export function supplyUnitPriceAmount(rowInfo, taxRate, colInfo) {
|
|
411
|
+
//含税计算方式
|
|
412
|
+
rowInfo[colInfo.amountField] = XEUtils.round(
|
|
413
|
+
XEUtils.multiply(
|
|
414
|
+
rowInfo[colInfo.qtyField],
|
|
415
|
+
rowInfo[colInfo.unitPriceField]
|
|
416
|
+
),
|
|
417
|
+
2
|
|
418
|
+
)
|
|
419
|
+
//未税金额 = 含税金额除以1.13
|
|
420
|
+
let tempValue = XEUtils.add(1, taxRate)
|
|
421
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
422
|
+
XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
|
|
423
|
+
2
|
|
424
|
+
)
|
|
425
|
+
//税额 = 含税金额-未税金额
|
|
426
|
+
rowInfo[colInfo.taxField] = XEUtils.subtract(
|
|
427
|
+
rowInfo[colInfo.amountField],
|
|
428
|
+
rowInfo[colInfo.amountNotTaxField]
|
|
429
|
+
)
|
|
430
|
+
//未税单价
|
|
431
|
+
rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
|
|
432
|
+
XEUtils.divide(
|
|
433
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
434
|
+
rowInfo[colInfo.qtyField]
|
|
435
|
+
),
|
|
436
|
+
store.getters.supplyPriceNotTaxPrecision,
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
if (colInfo.direction) {
|
|
440
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
441
|
+
rowInfo[colInfo.taxField],
|
|
442
|
+
colInfo.direction
|
|
443
|
+
)
|
|
444
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
445
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
446
|
+
colInfo.direction
|
|
447
|
+
)
|
|
448
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
449
|
+
rowInfo[colInfo.amountField],
|
|
450
|
+
colInfo.direction
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* 客户含税单价计算金额
|
|
457
|
+
* @param {行数据信息} rowInfo
|
|
458
|
+
* @param {税率} taxRate
|
|
459
|
+
* @param {数量字段} qtyField
|
|
460
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
461
|
+
* @param {含税单价字段} unitPriceField
|
|
462
|
+
* @param {未税金额字段} amountNotTaxField
|
|
463
|
+
* @param {含税金额字段} amountField
|
|
464
|
+
* @param {税额字段} taxField
|
|
465
|
+
*/
|
|
466
|
+
export function custUnitPriceAmount(rowInfo, taxRate, colInfo) {
|
|
467
|
+
//含税计算方式
|
|
468
|
+
rowInfo[colInfo.amountField] = XEUtils.round(
|
|
469
|
+
XEUtils.multiply(
|
|
470
|
+
rowInfo[colInfo.qtyField],
|
|
471
|
+
rowInfo[colInfo.unitPriceField]
|
|
472
|
+
),
|
|
473
|
+
2
|
|
474
|
+
)
|
|
475
|
+
//未税金额 = 含税金额除以1.13
|
|
476
|
+
let tempValue = XEUtils.add(1, taxRate)
|
|
477
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
478
|
+
XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
|
|
479
|
+
2
|
|
480
|
+
)
|
|
481
|
+
//税额 = 含税金额-未税金额
|
|
482
|
+
rowInfo[colInfo.taxField] = XEUtils.subtract(
|
|
483
|
+
rowInfo[colInfo.amountField],
|
|
484
|
+
rowInfo[colInfo.amountNotTaxField]
|
|
485
|
+
)
|
|
486
|
+
//未税单价
|
|
487
|
+
rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
|
|
488
|
+
XEUtils.divide(
|
|
489
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
490
|
+
rowInfo[colInfo.qtyField]
|
|
491
|
+
),
|
|
492
|
+
store.getters.custPriceNotTaxPrecision,
|
|
493
|
+
)
|
|
494
|
+
if (colInfo.direction) {
|
|
495
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
496
|
+
rowInfo[colInfo.taxField],
|
|
497
|
+
colInfo.direction
|
|
498
|
+
)
|
|
499
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
500
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
501
|
+
colInfo.direction
|
|
502
|
+
)
|
|
503
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
504
|
+
rowInfo[colInfo.amountField],
|
|
505
|
+
colInfo.direction
|
|
506
|
+
)
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* 客户未税单价计算金额
|
|
511
|
+
* @param {行数据信息} rowInfo
|
|
512
|
+
* @param {税率} taxRate
|
|
513
|
+
* @param {数量字段} qtyField
|
|
514
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
515
|
+
* @param {含税单价字段} unitPriceField
|
|
516
|
+
* @param {未税金额字段} amountNotTaxField
|
|
517
|
+
* @param {含税金额字段} amountField
|
|
518
|
+
* @param {税额字段} taxField
|
|
519
|
+
*/
|
|
520
|
+
export function custUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
|
|
521
|
+
//未税计算方式
|
|
522
|
+
//未税金额
|
|
523
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
524
|
+
XEUtils.multiply(
|
|
525
|
+
rowInfo[colInfo.qtyField],
|
|
526
|
+
rowInfo[colInfo.unitPriceNotTaxField]
|
|
527
|
+
),
|
|
528
|
+
2
|
|
529
|
+
)
|
|
530
|
+
//税额
|
|
531
|
+
rowInfo[colInfo.taxField] = XEUtils.round(
|
|
532
|
+
XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
|
|
533
|
+
2
|
|
534
|
+
)
|
|
535
|
+
//含税金额 = 未税金额+税额
|
|
536
|
+
rowInfo[colInfo.amountField] = XEUtils.add(
|
|
537
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
538
|
+
rowInfo[colInfo.taxField]
|
|
539
|
+
)
|
|
540
|
+
//返回来计算含税单价
|
|
541
|
+
rowInfo[colInfo.unitPriceField] = XEUtils.round(
|
|
542
|
+
XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
|
|
543
|
+
store.getters.custPricePrecision,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
if (colInfo.direction) {
|
|
547
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
548
|
+
rowInfo[colInfo.taxField],
|
|
549
|
+
colInfo.direction
|
|
550
|
+
)
|
|
551
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
552
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
553
|
+
colInfo.direction
|
|
554
|
+
)
|
|
555
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
556
|
+
rowInfo[colInfo.amountField],
|
|
557
|
+
colInfo.direction
|
|
558
|
+
)
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* 设置行业属性字段信息
|
|
563
|
+
* @param {字段} fields
|
|
564
|
+
*/
|
|
565
|
+
export function setIndustryVersionFields(fields){
|
|
566
|
+
let length = fields.length
|
|
567
|
+
for(let i=length-1;i>=0;i--){
|
|
568
|
+
if(XEUtils.isArray(fields[i].versions)){
|
|
569
|
+
let tempValue = XEUtils.find(fields[i].versions,p=>store.getters.industryVersion.includes(p))
|
|
570
|
+
if(tempValue){
|
|
571
|
+
continue
|
|
572
|
+
}
|
|
573
|
+
XEUtils.remove(fields,i)
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* 计算数量保留位数及判断取整方向
|
|
580
|
+
* @param {行数据信息} rowInfo
|
|
581
|
+
* @param {数值} number
|
|
582
|
+
* @param {位数} digits
|
|
583
|
+
* @param {取整方向} round
|
|
584
|
+
*/
|
|
585
|
+
export function numberDigitsRound(rowInfo, colInfo) {
|
|
586
|
+
// 向上、向下、四舍五入
|
|
587
|
+
switch (rowInfo[colInfo.round]) {
|
|
588
|
+
case 'ceiling':
|
|
589
|
+
rowInfo[colInfo.number] = XEUtils.ceil(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
590
|
+
break;
|
|
591
|
+
case 'floor':
|
|
592
|
+
rowInfo[colInfo.number] = XEUtils.floor(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
593
|
+
break;
|
|
594
|
+
case 'round':
|
|
595
|
+
rowInfo[colInfo.number] = rowInfo[colInfo.number].toFixed(rowInfo[colInfo.digits])
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
// 导出用
|
|
600
|
+
export function getExportParams(columns) {
|
|
601
|
+
let tempParams = {
|
|
602
|
+
fields: [],
|
|
603
|
+
dicts: {}
|
|
604
|
+
}
|
|
605
|
+
for (let i = 0; i < columns.length; i++) {
|
|
606
|
+
if (columns[i].visible === false) {
|
|
607
|
+
continue
|
|
608
|
+
}
|
|
609
|
+
let tempFieldInfo = {
|
|
610
|
+
field: columns[i].field,
|
|
611
|
+
title: columns[i].title
|
|
612
|
+
}
|
|
613
|
+
tempParams.fields.push(tempFieldInfo)
|
|
614
|
+
if (columns[i].dataSource && columns[i].dataSource.length > 0) {
|
|
615
|
+
if (!tempParams.dicts[columns[i].field]) {
|
|
616
|
+
tempParams.dicts[columns[i].field] = {}
|
|
617
|
+
for (let j = 0; j < columns[i].dataSource.length; j++) {
|
|
618
|
+
tempParams.dicts[columns[i].field][columns[i].dataSource[j].value] =
|
|
619
|
+
columns[i].dataSource[j].caption
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return tempParams
|
|
625
|
+
}
|
|
626
|
+
export function setFormButtons(toolBtns,statusBtns,permissionBtns,tabs){
|
|
627
|
+
// 将获取的数据进行排序
|
|
628
|
+
let tempSortArr = permissionBtns.sort(function(a,b){
|
|
629
|
+
a.sort = a.sort?a.sort:1
|
|
630
|
+
b.sort = b.sort?b.sort:1
|
|
631
|
+
return a.sort-b.sort
|
|
632
|
+
})
|
|
633
|
+
XEUtils.arrayEach(tempSortArr,loopBtn=>{
|
|
634
|
+
let pushBtn = {
|
|
635
|
+
code: loopBtn.code,
|
|
636
|
+
caption: loopBtn.name,
|
|
637
|
+
visible: true
|
|
638
|
+
}
|
|
639
|
+
if(loopBtn.visibleState){
|
|
640
|
+
pushBtn['visibleStates'] = loopBtn.visibleState.split(',')
|
|
641
|
+
}
|
|
642
|
+
if(loopBtn.visibleStatus){
|
|
643
|
+
pushBtn['visibleStatuss'] = loopBtn.visibleStatus.split(',')
|
|
644
|
+
}
|
|
645
|
+
let extraInfo = loopBtn.extraInfo
|
|
646
|
+
? JSON.parse(loopBtn.extraInfo)
|
|
647
|
+
: {}
|
|
648
|
+
if (Object.keys(extraInfo).length) {
|
|
649
|
+
pushBtn = XEUtils.assign(extraInfo, pushBtn)
|
|
650
|
+
}
|
|
651
|
+
switch(loopBtn.buttonType){
|
|
652
|
+
case 'tool':
|
|
653
|
+
toolBtns.push(pushBtn)
|
|
654
|
+
break
|
|
655
|
+
case 'status':
|
|
656
|
+
statusBtns.push(pushBtn)
|
|
657
|
+
break
|
|
658
|
+
case 'tab':
|
|
659
|
+
tabs.push(pushBtn)
|
|
660
|
+
break
|
|
661
|
+
}
|
|
662
|
+
})
|
|
663
|
+
}
|
|
664
|
+
export function getGridPagerButton(datas,dataCode){
|
|
665
|
+
let returnButtons = []
|
|
666
|
+
let tempData = XEUtils.find(datas,p=>p.code===dataCode)
|
|
667
|
+
if(!tempData){
|
|
668
|
+
return returnButtons
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
XEUtils.arrayEach(tempData.fields,loopField=>{
|
|
672
|
+
if(loopField.controlType==='pager_button'){
|
|
673
|
+
returnButtons.push({
|
|
674
|
+
field:loopField.boundField,
|
|
675
|
+
title:loopField.name,
|
|
676
|
+
visible:true
|
|
677
|
+
})
|
|
678
|
+
}
|
|
679
|
+
})
|
|
680
|
+
return returnButtons
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* 获取最大排序步长
|
|
684
|
+
* @param {} datas
|
|
685
|
+
* @param {*} fieldCode
|
|
686
|
+
* @param {*} step
|
|
687
|
+
*/
|
|
688
|
+
export function getStepMaxValue(datas,fieldCode,step){
|
|
689
|
+
let tempSortStep = step
|
|
690
|
+
let tempMaxObj = XEUtils.max(
|
|
691
|
+
datas,
|
|
692
|
+
fieldCode
|
|
693
|
+
)
|
|
694
|
+
let tempDtlMaxSort = 0
|
|
695
|
+
if(tempMaxObj){
|
|
696
|
+
tempDtlMaxSort = tempMaxObj.sort
|
|
697
|
+
}
|
|
698
|
+
tempDtlMaxSort = XEUtils.divide(tempDtlMaxSort, tempSortStep)
|
|
699
|
+
tempDtlMaxSort = XEUtils.floor(tempDtlMaxSort, 0)
|
|
700
|
+
tempDtlMaxSort = XEUtils.add(tempDtlMaxSort, 1)
|
|
701
|
+
tempDtlMaxSort = XEUtils.multiply(tempDtlMaxSort, tempSortStep)
|
|
702
|
+
return tempDtlMaxSort
|
|
703
|
+
}
|