doway-coms 2.2.21 → 2.2.23
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/package.json +53 -53
- package/packages/AuditsList/index.js +7 -7
- package/packages/AuditsList/src/index.vue +262 -262
- package/packages/BaseButton/index.js +7 -7
- package/packages/BaseButton/src/index.vue +241 -241
- 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/BaseForm/index.js +7 -7
- package/packages/BaseForm/src/index.vue +729 -728
- package/packages/BaseGantt/index.js +9 -9
- package/packages/BaseGantt/src/index.vue +608 -608
- package/packages/BaseGrid/index.js +9 -9
- package/packages/BaseGrid/src/SeqSetting.vue +278 -278
- package/packages/BaseGrid/src/index.vue +3580 -3580
- 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 +164 -164
- 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 +291 -293
- 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 +580 -580
- package/packages/BasePrintPreview/index.js +7 -7
- package/packages/BasePrintPreview/src/index.vue +129 -129
- package/packages/BasePulldown/index.js +7 -7
- package/packages/BasePulldown/src/index.vue +1265 -1265
- 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 +349 -349
- package/packages/BaseToolStatus/index.js +7 -7
- package/packages/BaseToolStatus/src/index.vue +388 -388
- package/packages/BaseTreeSelect/index.js +8 -8
- package/packages/BaseTreeSelect/src/index.vue +437 -437
- package/packages/LeaveAMessage/index.js +7 -7
- package/packages/LeaveAMessage/src/index.vue +597 -597
- package/packages/index.js +191 -191
- package/packages/styles/default.css +78 -78
- package/packages/styles/default.less +84 -84
- package/packages/utils/api.js +107 -107
- package/packages/utils/auth.js +38 -38
- package/packages/utils/common.js +610 -610
- package/packages/utils/dom.js +181 -181
- package/packages/utils/enum.js +86 -86
- package/packages/utils/filters.js +472 -472
- 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 +178 -178
- package/packages/utils/store.js +303 -305
- package/vue.config.js +59 -59
package/packages/utils/common.js
CHANGED
|
@@ -1,611 +1,611 @@
|
|
|
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
|
-
export function setFrameToolBtnState(toolBars, formState, formStatus) {
|
|
156
|
-
for (let i = 0; i < toolBars.length; i++) {
|
|
157
|
-
toolBars[i].visible = false
|
|
158
|
-
toolBars[i].isPrimary = false
|
|
159
|
-
if (
|
|
160
|
-
toolBars[i].visibleStates &&
|
|
161
|
-
toolBars[i].visibleStates.indexOf(formState) >= 0
|
|
162
|
-
) {
|
|
163
|
-
toolBars[i].visible = true
|
|
164
|
-
}
|
|
165
|
-
if (formStatus && toolBars[i].visibleStatuss && toolBars[i].visible) {
|
|
166
|
-
toolBars[i].visible = toolBars[i].visibleStatuss.indexOf(formStatus) >= 0
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
// 查找优先级最大的并且显示的设置按钮强调色
|
|
170
|
-
let visibleBtns = toolBars.filter(filterItem => {
|
|
171
|
-
return filterItem.visible === true
|
|
172
|
-
})
|
|
173
|
-
//循环数组查找出小于自身的priority优先级 优先级高设置按钮强调色
|
|
174
|
-
for (let i = 0; i < visibleBtns.length; i++) {
|
|
175
|
-
let tempPriority = visibleBtns[i].priority
|
|
176
|
-
let tempBtns = visibleBtns.filter(filterItem => {
|
|
177
|
-
return filterItem.priority < tempPriority
|
|
178
|
-
})
|
|
179
|
-
//如果找到小于自身优先级的数量>0就说明还有更小的跳出本次不设置true继续查找
|
|
180
|
-
if (tempBtns.length > 0) {
|
|
181
|
-
continue
|
|
182
|
-
}
|
|
183
|
-
visibleBtns[i].isPrimary = true
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
export function showErrors(errs) {
|
|
187
|
-
let errors = ''
|
|
188
|
-
for (let i = 0; i < errs.length; i++) {
|
|
189
|
-
errors = errors + errs[i] + '\n'
|
|
190
|
-
}
|
|
191
|
-
notification.error({
|
|
192
|
-
style: {
|
|
193
|
-
whiteSpace: 'pre-wrap'
|
|
194
|
-
},
|
|
195
|
-
message: '错误',
|
|
196
|
-
description: errors,
|
|
197
|
-
placement: 'topRight',
|
|
198
|
-
top: '100px'
|
|
199
|
-
})
|
|
200
|
-
}
|
|
201
|
-
export function getUuid() {
|
|
202
|
-
let d = new Date().getTime()
|
|
203
|
-
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
|
|
204
|
-
c
|
|
205
|
-
) {
|
|
206
|
-
let r = (d + Math.random() * 16) % 16 | 0
|
|
207
|
-
d = Math.floor(d / 16)
|
|
208
|
-
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
|
|
209
|
-
})
|
|
210
|
-
return uuid
|
|
211
|
-
}
|
|
212
|
-
export async function getFormValidErrors(formView) {
|
|
213
|
-
let formErrors = []
|
|
214
|
-
const validFormError = await formView.validate().catch(errMap => errMap)
|
|
215
|
-
if (validFormError === false) {
|
|
216
|
-
for (let errorProp in formView.errors) {
|
|
217
|
-
for (let x = 0; x < formView.errors[errorProp].length; x++) {
|
|
218
|
-
formErrors.push(errorProp + ':' + formView.errors[errorProp][x])
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return formErrors
|
|
223
|
-
}
|
|
224
|
-
export function stringUrlQuery(obj) {
|
|
225
|
-
let strUrlQuery = ''
|
|
226
|
-
for (let prop in obj) {
|
|
227
|
-
strUrlQuery = strUrlQuery + prop + '=' + obj[prop] + '&'
|
|
228
|
-
}
|
|
229
|
-
if (strUrlQuery.length > 0) {
|
|
230
|
-
strUrlQuery = strUrlQuery.substring(0, strUrlQuery.length - 1)
|
|
231
|
-
}
|
|
232
|
-
return strUrlQuery
|
|
233
|
-
}
|
|
234
|
-
export function getRouteFullPath(route) {
|
|
235
|
-
let fullPath = route.path + '?' + stringUrlQuery(route.query)
|
|
236
|
-
return fullPath
|
|
237
|
-
}
|
|
238
|
-
export async function getGridValidErrors(gridView) {
|
|
239
|
-
const gridErrors = await gridView.fullValidate()
|
|
240
|
-
return gridErrors
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export function routeBeforeEach(to, from, next){
|
|
244
|
-
if(to.params.aliveCacheKey){
|
|
245
|
-
to.meta['aliveCacheKey'] = to.params.aliveCacheKey
|
|
246
|
-
}
|
|
247
|
-
if(!to.meta.aliveCacheKey){
|
|
248
|
-
// alert('防呆,子应用没有路由缓存键:' + JSON.stringify(to))
|
|
249
|
-
notification.error({
|
|
250
|
-
style: {
|
|
251
|
-
whiteSpace: 'pre-wrap'
|
|
252
|
-
},
|
|
253
|
-
message: '路由错误',
|
|
254
|
-
description: '防呆,子应用没有路由缓存键:' + JSON.stringify(to),
|
|
255
|
-
placement: 'topRight',
|
|
256
|
-
top: '100px'
|
|
257
|
-
})
|
|
258
|
-
}
|
|
259
|
-
if (to.meta.moduleCode && !store.getters.moduleViewInfo[to.meta.moduleCode]) {
|
|
260
|
-
// axios.all([store.dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode }),
|
|
261
|
-
// store.dispatch('moduleLoadLangInfo', { moduleCode: to.meta.moduleCode,moduleLangCacheHash:to.meta.moduleLangCacheHash })])
|
|
262
|
-
// .then(axios.spread(function() {
|
|
263
|
-
// next()
|
|
264
|
-
// }))
|
|
265
|
-
store
|
|
266
|
-
.dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode })
|
|
267
|
-
.then(() => {
|
|
268
|
-
next()
|
|
269
|
-
})
|
|
270
|
-
.catch((err) => {
|
|
271
|
-
console.debug(err)
|
|
272
|
-
})
|
|
273
|
-
} else {
|
|
274
|
-
next()
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* 供应商未税单价计算金额
|
|
280
|
-
* @param {行数据信息} rowInfo
|
|
281
|
-
* @param {税率} taxRate
|
|
282
|
-
* @param {数量字段} qtyField
|
|
283
|
-
* @param {未税单价字段} unitPriceNotTaxField
|
|
284
|
-
* @param {含税单价字段} unitPriceField
|
|
285
|
-
* @param {未税金额字段} amountNotTaxField
|
|
286
|
-
* @param {含税金额字段} amountField
|
|
287
|
-
* @param {税额字段} taxField
|
|
288
|
-
*/
|
|
289
|
-
export function supplyUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
|
|
290
|
-
//未税计算方式
|
|
291
|
-
//未税金额
|
|
292
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
293
|
-
XEUtils.multiply(
|
|
294
|
-
rowInfo[colInfo.qtyField],
|
|
295
|
-
rowInfo[colInfo.unitPriceNotTaxField]
|
|
296
|
-
),
|
|
297
|
-
2
|
|
298
|
-
)
|
|
299
|
-
//税额
|
|
300
|
-
rowInfo[colInfo.taxField] = XEUtils.round(
|
|
301
|
-
XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
|
|
302
|
-
2
|
|
303
|
-
)
|
|
304
|
-
//含税金额 = 未税金额+税额
|
|
305
|
-
rowInfo[colInfo.amountField] = XEUtils.add(
|
|
306
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
307
|
-
rowInfo[colInfo.taxField]
|
|
308
|
-
)
|
|
309
|
-
//返回来计算含税单价
|
|
310
|
-
|
|
311
|
-
rowInfo[colInfo.unitPriceField] = XEUtils.round(
|
|
312
|
-
XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
|
|
313
|
-
store.getters.supplyPricePrecision,
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
if (colInfo.direction) {
|
|
317
|
-
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
318
|
-
rowInfo[colInfo.taxField],
|
|
319
|
-
colInfo.direction
|
|
320
|
-
)
|
|
321
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
322
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
323
|
-
colInfo.direction
|
|
324
|
-
)
|
|
325
|
-
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
326
|
-
rowInfo[colInfo.amountField],
|
|
327
|
-
colInfo.direction
|
|
328
|
-
)
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* 供应商含税单价计算金额
|
|
334
|
-
* @param {行数据信息} rowInfo
|
|
335
|
-
* @param {税率} taxRate
|
|
336
|
-
* @param {数量字段} qtyField
|
|
337
|
-
* @param {未税单价字段} unitPriceNotTaxField
|
|
338
|
-
* @param {含税单价字段} unitPriceField
|
|
339
|
-
* @param {未税金额字段} amountNotTaxField
|
|
340
|
-
* @param {含税金额字段} amountField
|
|
341
|
-
* @param {税额字段} taxField
|
|
342
|
-
*/
|
|
343
|
-
export function supplyUnitPriceAmount(rowInfo, taxRate, colInfo) {
|
|
344
|
-
//含税计算方式
|
|
345
|
-
rowInfo[colInfo.amountField] = XEUtils.round(
|
|
346
|
-
XEUtils.multiply(
|
|
347
|
-
rowInfo[colInfo.qtyField],
|
|
348
|
-
rowInfo[colInfo.unitPriceField]
|
|
349
|
-
),
|
|
350
|
-
2
|
|
351
|
-
)
|
|
352
|
-
//未税金额 = 含税金额除以1.13
|
|
353
|
-
let tempValue = XEUtils.add(1, taxRate)
|
|
354
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
355
|
-
XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
|
|
356
|
-
2
|
|
357
|
-
)
|
|
358
|
-
//税额 = 含税金额-未税金额
|
|
359
|
-
rowInfo[colInfo.taxField] = XEUtils.subtract(
|
|
360
|
-
rowInfo[colInfo.amountField],
|
|
361
|
-
rowInfo[colInfo.amountNotTaxField]
|
|
362
|
-
)
|
|
363
|
-
//未税单价
|
|
364
|
-
rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
|
|
365
|
-
XEUtils.divide(
|
|
366
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
367
|
-
rowInfo[colInfo.qtyField]
|
|
368
|
-
),
|
|
369
|
-
store.getters.supplyPriceNotTaxPrecision,
|
|
370
|
-
)
|
|
371
|
-
|
|
372
|
-
if (colInfo.direction) {
|
|
373
|
-
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
374
|
-
rowInfo[colInfo.taxField],
|
|
375
|
-
colInfo.direction
|
|
376
|
-
)
|
|
377
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
378
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
379
|
-
colInfo.direction
|
|
380
|
-
)
|
|
381
|
-
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
382
|
-
rowInfo[colInfo.amountField],
|
|
383
|
-
colInfo.direction
|
|
384
|
-
)
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* 客户含税单价计算金额
|
|
390
|
-
* @param {行数据信息} rowInfo
|
|
391
|
-
* @param {税率} taxRate
|
|
392
|
-
* @param {数量字段} qtyField
|
|
393
|
-
* @param {未税单价字段} unitPriceNotTaxField
|
|
394
|
-
* @param {含税单价字段} unitPriceField
|
|
395
|
-
* @param {未税金额字段} amountNotTaxField
|
|
396
|
-
* @param {含税金额字段} amountField
|
|
397
|
-
* @param {税额字段} taxField
|
|
398
|
-
*/
|
|
399
|
-
export function custUnitPriceAmount(rowInfo, taxRate, colInfo) {
|
|
400
|
-
//含税计算方式
|
|
401
|
-
rowInfo[colInfo.amountField] = XEUtils.round(
|
|
402
|
-
XEUtils.multiply(
|
|
403
|
-
rowInfo[colInfo.qtyField],
|
|
404
|
-
rowInfo[colInfo.unitPriceField]
|
|
405
|
-
),
|
|
406
|
-
2
|
|
407
|
-
)
|
|
408
|
-
//未税金额 = 含税金额除以1.13
|
|
409
|
-
let tempValue = XEUtils.add(1, taxRate)
|
|
410
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
411
|
-
XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
|
|
412
|
-
2
|
|
413
|
-
)
|
|
414
|
-
//税额 = 含税金额-未税金额
|
|
415
|
-
rowInfo[colInfo.taxField] = XEUtils.subtract(
|
|
416
|
-
rowInfo[colInfo.amountField],
|
|
417
|
-
rowInfo[colInfo.amountNotTaxField]
|
|
418
|
-
)
|
|
419
|
-
//未税单价
|
|
420
|
-
rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
|
|
421
|
-
XEUtils.divide(
|
|
422
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
423
|
-
rowInfo[colInfo.qtyField]
|
|
424
|
-
),
|
|
425
|
-
store.getters.custPriceNotTaxPrecision,
|
|
426
|
-
)
|
|
427
|
-
if (colInfo.direction) {
|
|
428
|
-
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
429
|
-
rowInfo[colInfo.taxField],
|
|
430
|
-
colInfo.direction
|
|
431
|
-
)
|
|
432
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
433
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
434
|
-
colInfo.direction
|
|
435
|
-
)
|
|
436
|
-
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
437
|
-
rowInfo[colInfo.amountField],
|
|
438
|
-
colInfo.direction
|
|
439
|
-
)
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* 客户未税单价计算金额
|
|
444
|
-
* @param {行数据信息} rowInfo
|
|
445
|
-
* @param {税率} taxRate
|
|
446
|
-
* @param {数量字段} qtyField
|
|
447
|
-
* @param {未税单价字段} unitPriceNotTaxField
|
|
448
|
-
* @param {含税单价字段} unitPriceField
|
|
449
|
-
* @param {未税金额字段} amountNotTaxField
|
|
450
|
-
* @param {含税金额字段} amountField
|
|
451
|
-
* @param {税额字段} taxField
|
|
452
|
-
*/
|
|
453
|
-
export function custUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
|
|
454
|
-
//未税计算方式
|
|
455
|
-
//未税金额
|
|
456
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
457
|
-
XEUtils.multiply(
|
|
458
|
-
rowInfo[colInfo.qtyField],
|
|
459
|
-
rowInfo[colInfo.unitPriceNotTaxField]
|
|
460
|
-
),
|
|
461
|
-
2
|
|
462
|
-
)
|
|
463
|
-
//税额
|
|
464
|
-
rowInfo[colInfo.taxField] = XEUtils.round(
|
|
465
|
-
XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
|
|
466
|
-
2
|
|
467
|
-
)
|
|
468
|
-
//含税金额 = 未税金额+税额
|
|
469
|
-
rowInfo[colInfo.amountField] = XEUtils.add(
|
|
470
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
471
|
-
rowInfo[colInfo.taxField]
|
|
472
|
-
)
|
|
473
|
-
//返回来计算含税单价
|
|
474
|
-
rowInfo[colInfo.unitPriceField] = XEUtils.round(
|
|
475
|
-
XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
|
|
476
|
-
store.getters.custPricePrecision,
|
|
477
|
-
)
|
|
478
|
-
|
|
479
|
-
if (colInfo.direction) {
|
|
480
|
-
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
481
|
-
rowInfo[colInfo.taxField],
|
|
482
|
-
colInfo.direction
|
|
483
|
-
)
|
|
484
|
-
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
485
|
-
rowInfo[colInfo.amountNotTaxField],
|
|
486
|
-
colInfo.direction
|
|
487
|
-
)
|
|
488
|
-
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
489
|
-
rowInfo[colInfo.amountField],
|
|
490
|
-
colInfo.direction
|
|
491
|
-
)
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* 设置行业属性字段信息
|
|
496
|
-
* @param {字段} fields
|
|
497
|
-
*/
|
|
498
|
-
export function setIndustryVersionFields(fields){
|
|
499
|
-
let length = fields.length
|
|
500
|
-
for(let i=length-1;i>=0;i--){
|
|
501
|
-
if(XEUtils.isArray(fields[i].versions)){
|
|
502
|
-
let tempValue = XEUtils.find(fields[i].versions,p=>store.getters.industryVersion.includes(p))
|
|
503
|
-
if(tempValue){
|
|
504
|
-
continue
|
|
505
|
-
}
|
|
506
|
-
XEUtils.remove(fields,i)
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* 计算数量保留位数及判断取整方向
|
|
513
|
-
* @param {行数据信息} rowInfo
|
|
514
|
-
* @param {数值} number
|
|
515
|
-
* @param {位数} digits
|
|
516
|
-
* @param {取整方向} round
|
|
517
|
-
*/
|
|
518
|
-
export function numberDigitsRound(rowInfo, colInfo) {
|
|
519
|
-
// 向上、向下、四舍五入
|
|
520
|
-
switch (rowInfo[colInfo.round]) {
|
|
521
|
-
case 'ceiling':
|
|
522
|
-
rowInfo[colInfo.number] = XEUtils.ceil(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
523
|
-
break;
|
|
524
|
-
case 'floor':
|
|
525
|
-
rowInfo[colInfo.number] = XEUtils.floor(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
526
|
-
break;
|
|
527
|
-
case 'round':
|
|
528
|
-
rowInfo[colInfo.number] = rowInfo[colInfo.number].toFixed(rowInfo[colInfo.digits])
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
// 导出用
|
|
533
|
-
export function getExportParams(columns) {
|
|
534
|
-
let tempParams = {
|
|
535
|
-
fields: [],
|
|
536
|
-
dicts: {}
|
|
537
|
-
}
|
|
538
|
-
for (let i = 0; i < columns.length; i++) {
|
|
539
|
-
if (columns[i].visible === false) {
|
|
540
|
-
continue
|
|
541
|
-
}
|
|
542
|
-
let tempFieldInfo = {
|
|
543
|
-
field: columns[i].field,
|
|
544
|
-
title: columns[i].title
|
|
545
|
-
}
|
|
546
|
-
tempParams.fields.push(tempFieldInfo)
|
|
547
|
-
if (columns[i].dataSource && columns[i].dataSource.length > 0) {
|
|
548
|
-
if (!tempParams.dicts[columns[i].field]) {
|
|
549
|
-
tempParams.dicts[columns[i].field] = {}
|
|
550
|
-
for (let j = 0; j < columns[i].dataSource.length; j++) {
|
|
551
|
-
tempParams.dicts[columns[i].field][columns[i].dataSource[j].value] =
|
|
552
|
-
columns[i].dataSource[j].caption
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
return tempParams
|
|
558
|
-
}
|
|
559
|
-
export function setFormButtons(toolBtns,statusBtns,permissionBtns){
|
|
560
|
-
// 将获取的数据进行排序
|
|
561
|
-
let tempSortArr = permissionBtns.sort(function(a,b){
|
|
562
|
-
a.sort = a.sort?a.sort:1
|
|
563
|
-
b.sort = b.sort?b.sort:1
|
|
564
|
-
return a.sort-b.sort
|
|
565
|
-
})
|
|
566
|
-
XEUtils.arrayEach(tempSortArr,loopBtn=>{
|
|
567
|
-
let pushBtn = {
|
|
568
|
-
code: loopBtn.code,
|
|
569
|
-
caption: loopBtn.name,
|
|
570
|
-
visible: true
|
|
571
|
-
}
|
|
572
|
-
if(loopBtn.visibleState){
|
|
573
|
-
pushBtn['visibleStates'] = loopBtn.visibleState.split(',')
|
|
574
|
-
}
|
|
575
|
-
if(loopBtn.visibleStatus){
|
|
576
|
-
pushBtn['visibleStatuss'] = loopBtn.visibleStatus.split(',')
|
|
577
|
-
}
|
|
578
|
-
let extraInfo = loopBtn.extraInfo
|
|
579
|
-
? JSON.parse(loopBtn.extraInfo)
|
|
580
|
-
: {}
|
|
581
|
-
if (Object.keys(extraInfo).length) {
|
|
582
|
-
pushBtn = XEUtils.assign(extraInfo, pushBtn)
|
|
583
|
-
}
|
|
584
|
-
switch(loopBtn.buttonType){
|
|
585
|
-
case 'tool':
|
|
586
|
-
toolBtns.push(pushBtn)
|
|
587
|
-
break
|
|
588
|
-
case 'status':
|
|
589
|
-
statusBtns.push(pushBtn)
|
|
590
|
-
break
|
|
591
|
-
}
|
|
592
|
-
})
|
|
593
|
-
}
|
|
594
|
-
export function getGridPagerButton(datas,dataCode){
|
|
595
|
-
let returnButtons = []
|
|
596
|
-
let tempData = XEUtils.find(datas,p=>p.code===dataCode)
|
|
597
|
-
if(!tempData){
|
|
598
|
-
return returnButtons
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
XEUtils.arrayEach(tempData.fields,loopField=>{
|
|
602
|
-
if(loopField.controlType==='pager_button'){
|
|
603
|
-
returnButtons.push({
|
|
604
|
-
field:loopField.boundField,
|
|
605
|
-
title:loopField.name,
|
|
606
|
-
visible:true
|
|
607
|
-
})
|
|
608
|
-
}
|
|
609
|
-
})
|
|
610
|
-
return returnButtons
|
|
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
|
+
export function setFrameToolBtnState(toolBars, formState, formStatus) {
|
|
156
|
+
for (let i = 0; i < toolBars.length; i++) {
|
|
157
|
+
toolBars[i].visible = false
|
|
158
|
+
toolBars[i].isPrimary = false
|
|
159
|
+
if (
|
|
160
|
+
toolBars[i].visibleStates &&
|
|
161
|
+
toolBars[i].visibleStates.indexOf(formState) >= 0
|
|
162
|
+
) {
|
|
163
|
+
toolBars[i].visible = true
|
|
164
|
+
}
|
|
165
|
+
if (formStatus && toolBars[i].visibleStatuss && toolBars[i].visible) {
|
|
166
|
+
toolBars[i].visible = toolBars[i].visibleStatuss.indexOf(formStatus) >= 0
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// 查找优先级最大的并且显示的设置按钮强调色
|
|
170
|
+
let visibleBtns = toolBars.filter(filterItem => {
|
|
171
|
+
return filterItem.visible === true
|
|
172
|
+
})
|
|
173
|
+
//循环数组查找出小于自身的priority优先级 优先级高设置按钮强调色
|
|
174
|
+
for (let i = 0; i < visibleBtns.length; i++) {
|
|
175
|
+
let tempPriority = visibleBtns[i].priority
|
|
176
|
+
let tempBtns = visibleBtns.filter(filterItem => {
|
|
177
|
+
return filterItem.priority < tempPriority
|
|
178
|
+
})
|
|
179
|
+
//如果找到小于自身优先级的数量>0就说明还有更小的跳出本次不设置true继续查找
|
|
180
|
+
if (tempBtns.length > 0) {
|
|
181
|
+
continue
|
|
182
|
+
}
|
|
183
|
+
visibleBtns[i].isPrimary = true
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
export function showErrors(errs) {
|
|
187
|
+
let errors = ''
|
|
188
|
+
for (let i = 0; i < errs.length; i++) {
|
|
189
|
+
errors = errors + errs[i] + '\n'
|
|
190
|
+
}
|
|
191
|
+
notification.error({
|
|
192
|
+
style: {
|
|
193
|
+
whiteSpace: 'pre-wrap'
|
|
194
|
+
},
|
|
195
|
+
message: '错误',
|
|
196
|
+
description: errors,
|
|
197
|
+
placement: 'topRight',
|
|
198
|
+
top: '100px'
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
export function getUuid() {
|
|
202
|
+
let d = new Date().getTime()
|
|
203
|
+
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
|
|
204
|
+
c
|
|
205
|
+
) {
|
|
206
|
+
let r = (d + Math.random() * 16) % 16 | 0
|
|
207
|
+
d = Math.floor(d / 16)
|
|
208
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
|
|
209
|
+
})
|
|
210
|
+
return uuid
|
|
211
|
+
}
|
|
212
|
+
export async function getFormValidErrors(formView) {
|
|
213
|
+
let formErrors = []
|
|
214
|
+
const validFormError = await formView.validate().catch(errMap => errMap)
|
|
215
|
+
if (validFormError === false) {
|
|
216
|
+
for (let errorProp in formView.errors) {
|
|
217
|
+
for (let x = 0; x < formView.errors[errorProp].length; x++) {
|
|
218
|
+
formErrors.push(errorProp + ':' + formView.errors[errorProp][x])
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return formErrors
|
|
223
|
+
}
|
|
224
|
+
export function stringUrlQuery(obj) {
|
|
225
|
+
let strUrlQuery = ''
|
|
226
|
+
for (let prop in obj) {
|
|
227
|
+
strUrlQuery = strUrlQuery + prop + '=' + obj[prop] + '&'
|
|
228
|
+
}
|
|
229
|
+
if (strUrlQuery.length > 0) {
|
|
230
|
+
strUrlQuery = strUrlQuery.substring(0, strUrlQuery.length - 1)
|
|
231
|
+
}
|
|
232
|
+
return strUrlQuery
|
|
233
|
+
}
|
|
234
|
+
export function getRouteFullPath(route) {
|
|
235
|
+
let fullPath = route.path + '?' + stringUrlQuery(route.query)
|
|
236
|
+
return fullPath
|
|
237
|
+
}
|
|
238
|
+
export async function getGridValidErrors(gridView) {
|
|
239
|
+
const gridErrors = await gridView.fullValidate()
|
|
240
|
+
return gridErrors
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function routeBeforeEach(to, from, next){
|
|
244
|
+
if(to.params.aliveCacheKey){
|
|
245
|
+
to.meta['aliveCacheKey'] = to.params.aliveCacheKey
|
|
246
|
+
}
|
|
247
|
+
if(!to.meta.aliveCacheKey){
|
|
248
|
+
// alert('防呆,子应用没有路由缓存键:' + JSON.stringify(to))
|
|
249
|
+
notification.error({
|
|
250
|
+
style: {
|
|
251
|
+
whiteSpace: 'pre-wrap'
|
|
252
|
+
},
|
|
253
|
+
message: '路由错误',
|
|
254
|
+
description: '防呆,子应用没有路由缓存键:' + JSON.stringify(to),
|
|
255
|
+
placement: 'topRight',
|
|
256
|
+
top: '100px'
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
if (to.meta.moduleCode && !store.getters.moduleViewInfo[to.meta.moduleCode]) {
|
|
260
|
+
// axios.all([store.dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode }),
|
|
261
|
+
// store.dispatch('moduleLoadLangInfo', { moduleCode: to.meta.moduleCode,moduleLangCacheHash:to.meta.moduleLangCacheHash })])
|
|
262
|
+
// .then(axios.spread(function() {
|
|
263
|
+
// next()
|
|
264
|
+
// }))
|
|
265
|
+
store
|
|
266
|
+
.dispatch('moduleLoadViewInfo', { moduleCode: to.meta.moduleCode })
|
|
267
|
+
.then(() => {
|
|
268
|
+
next()
|
|
269
|
+
})
|
|
270
|
+
.catch((err) => {
|
|
271
|
+
console.debug(err)
|
|
272
|
+
})
|
|
273
|
+
} else {
|
|
274
|
+
next()
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* 供应商未税单价计算金额
|
|
280
|
+
* @param {行数据信息} rowInfo
|
|
281
|
+
* @param {税率} taxRate
|
|
282
|
+
* @param {数量字段} qtyField
|
|
283
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
284
|
+
* @param {含税单价字段} unitPriceField
|
|
285
|
+
* @param {未税金额字段} amountNotTaxField
|
|
286
|
+
* @param {含税金额字段} amountField
|
|
287
|
+
* @param {税额字段} taxField
|
|
288
|
+
*/
|
|
289
|
+
export function supplyUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
|
|
290
|
+
//未税计算方式
|
|
291
|
+
//未税金额
|
|
292
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
293
|
+
XEUtils.multiply(
|
|
294
|
+
rowInfo[colInfo.qtyField],
|
|
295
|
+
rowInfo[colInfo.unitPriceNotTaxField]
|
|
296
|
+
),
|
|
297
|
+
2
|
|
298
|
+
)
|
|
299
|
+
//税额
|
|
300
|
+
rowInfo[colInfo.taxField] = XEUtils.round(
|
|
301
|
+
XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
|
|
302
|
+
2
|
|
303
|
+
)
|
|
304
|
+
//含税金额 = 未税金额+税额
|
|
305
|
+
rowInfo[colInfo.amountField] = XEUtils.add(
|
|
306
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
307
|
+
rowInfo[colInfo.taxField]
|
|
308
|
+
)
|
|
309
|
+
//返回来计算含税单价
|
|
310
|
+
|
|
311
|
+
rowInfo[colInfo.unitPriceField] = XEUtils.round(
|
|
312
|
+
XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
|
|
313
|
+
store.getters.supplyPricePrecision,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
if (colInfo.direction) {
|
|
317
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
318
|
+
rowInfo[colInfo.taxField],
|
|
319
|
+
colInfo.direction
|
|
320
|
+
)
|
|
321
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
322
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
323
|
+
colInfo.direction
|
|
324
|
+
)
|
|
325
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
326
|
+
rowInfo[colInfo.amountField],
|
|
327
|
+
colInfo.direction
|
|
328
|
+
)
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* 供应商含税单价计算金额
|
|
334
|
+
* @param {行数据信息} rowInfo
|
|
335
|
+
* @param {税率} taxRate
|
|
336
|
+
* @param {数量字段} qtyField
|
|
337
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
338
|
+
* @param {含税单价字段} unitPriceField
|
|
339
|
+
* @param {未税金额字段} amountNotTaxField
|
|
340
|
+
* @param {含税金额字段} amountField
|
|
341
|
+
* @param {税额字段} taxField
|
|
342
|
+
*/
|
|
343
|
+
export function supplyUnitPriceAmount(rowInfo, taxRate, colInfo) {
|
|
344
|
+
//含税计算方式
|
|
345
|
+
rowInfo[colInfo.amountField] = XEUtils.round(
|
|
346
|
+
XEUtils.multiply(
|
|
347
|
+
rowInfo[colInfo.qtyField],
|
|
348
|
+
rowInfo[colInfo.unitPriceField]
|
|
349
|
+
),
|
|
350
|
+
2
|
|
351
|
+
)
|
|
352
|
+
//未税金额 = 含税金额除以1.13
|
|
353
|
+
let tempValue = XEUtils.add(1, taxRate)
|
|
354
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
355
|
+
XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
|
|
356
|
+
2
|
|
357
|
+
)
|
|
358
|
+
//税额 = 含税金额-未税金额
|
|
359
|
+
rowInfo[colInfo.taxField] = XEUtils.subtract(
|
|
360
|
+
rowInfo[colInfo.amountField],
|
|
361
|
+
rowInfo[colInfo.amountNotTaxField]
|
|
362
|
+
)
|
|
363
|
+
//未税单价
|
|
364
|
+
rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
|
|
365
|
+
XEUtils.divide(
|
|
366
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
367
|
+
rowInfo[colInfo.qtyField]
|
|
368
|
+
),
|
|
369
|
+
store.getters.supplyPriceNotTaxPrecision,
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
if (colInfo.direction) {
|
|
373
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
374
|
+
rowInfo[colInfo.taxField],
|
|
375
|
+
colInfo.direction
|
|
376
|
+
)
|
|
377
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
378
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
379
|
+
colInfo.direction
|
|
380
|
+
)
|
|
381
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
382
|
+
rowInfo[colInfo.amountField],
|
|
383
|
+
colInfo.direction
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* 客户含税单价计算金额
|
|
390
|
+
* @param {行数据信息} rowInfo
|
|
391
|
+
* @param {税率} taxRate
|
|
392
|
+
* @param {数量字段} qtyField
|
|
393
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
394
|
+
* @param {含税单价字段} unitPriceField
|
|
395
|
+
* @param {未税金额字段} amountNotTaxField
|
|
396
|
+
* @param {含税金额字段} amountField
|
|
397
|
+
* @param {税额字段} taxField
|
|
398
|
+
*/
|
|
399
|
+
export function custUnitPriceAmount(rowInfo, taxRate, colInfo) {
|
|
400
|
+
//含税计算方式
|
|
401
|
+
rowInfo[colInfo.amountField] = XEUtils.round(
|
|
402
|
+
XEUtils.multiply(
|
|
403
|
+
rowInfo[colInfo.qtyField],
|
|
404
|
+
rowInfo[colInfo.unitPriceField]
|
|
405
|
+
),
|
|
406
|
+
2
|
|
407
|
+
)
|
|
408
|
+
//未税金额 = 含税金额除以1.13
|
|
409
|
+
let tempValue = XEUtils.add(1, taxRate)
|
|
410
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
411
|
+
XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
|
|
412
|
+
2
|
|
413
|
+
)
|
|
414
|
+
//税额 = 含税金额-未税金额
|
|
415
|
+
rowInfo[colInfo.taxField] = XEUtils.subtract(
|
|
416
|
+
rowInfo[colInfo.amountField],
|
|
417
|
+
rowInfo[colInfo.amountNotTaxField]
|
|
418
|
+
)
|
|
419
|
+
//未税单价
|
|
420
|
+
rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
|
|
421
|
+
XEUtils.divide(
|
|
422
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
423
|
+
rowInfo[colInfo.qtyField]
|
|
424
|
+
),
|
|
425
|
+
store.getters.custPriceNotTaxPrecision,
|
|
426
|
+
)
|
|
427
|
+
if (colInfo.direction) {
|
|
428
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
429
|
+
rowInfo[colInfo.taxField],
|
|
430
|
+
colInfo.direction
|
|
431
|
+
)
|
|
432
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
433
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
434
|
+
colInfo.direction
|
|
435
|
+
)
|
|
436
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
437
|
+
rowInfo[colInfo.amountField],
|
|
438
|
+
colInfo.direction
|
|
439
|
+
)
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* 客户未税单价计算金额
|
|
444
|
+
* @param {行数据信息} rowInfo
|
|
445
|
+
* @param {税率} taxRate
|
|
446
|
+
* @param {数量字段} qtyField
|
|
447
|
+
* @param {未税单价字段} unitPriceNotTaxField
|
|
448
|
+
* @param {含税单价字段} unitPriceField
|
|
449
|
+
* @param {未税金额字段} amountNotTaxField
|
|
450
|
+
* @param {含税金额字段} amountField
|
|
451
|
+
* @param {税额字段} taxField
|
|
452
|
+
*/
|
|
453
|
+
export function custUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
|
|
454
|
+
//未税计算方式
|
|
455
|
+
//未税金额
|
|
456
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
|
|
457
|
+
XEUtils.multiply(
|
|
458
|
+
rowInfo[colInfo.qtyField],
|
|
459
|
+
rowInfo[colInfo.unitPriceNotTaxField]
|
|
460
|
+
),
|
|
461
|
+
2
|
|
462
|
+
)
|
|
463
|
+
//税额
|
|
464
|
+
rowInfo[colInfo.taxField] = XEUtils.round(
|
|
465
|
+
XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
|
|
466
|
+
2
|
|
467
|
+
)
|
|
468
|
+
//含税金额 = 未税金额+税额
|
|
469
|
+
rowInfo[colInfo.amountField] = XEUtils.add(
|
|
470
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
471
|
+
rowInfo[colInfo.taxField]
|
|
472
|
+
)
|
|
473
|
+
//返回来计算含税单价
|
|
474
|
+
rowInfo[colInfo.unitPriceField] = XEUtils.round(
|
|
475
|
+
XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
|
|
476
|
+
store.getters.custPricePrecision,
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
if (colInfo.direction) {
|
|
480
|
+
rowInfo[colInfo.taxField] = XEUtils.multiply(
|
|
481
|
+
rowInfo[colInfo.taxField],
|
|
482
|
+
colInfo.direction
|
|
483
|
+
)
|
|
484
|
+
rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
|
|
485
|
+
rowInfo[colInfo.amountNotTaxField],
|
|
486
|
+
colInfo.direction
|
|
487
|
+
)
|
|
488
|
+
rowInfo[colInfo.amountField] = XEUtils.multiply(
|
|
489
|
+
rowInfo[colInfo.amountField],
|
|
490
|
+
colInfo.direction
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* 设置行业属性字段信息
|
|
496
|
+
* @param {字段} fields
|
|
497
|
+
*/
|
|
498
|
+
export function setIndustryVersionFields(fields){
|
|
499
|
+
let length = fields.length
|
|
500
|
+
for(let i=length-1;i>=0;i--){
|
|
501
|
+
if(XEUtils.isArray(fields[i].versions)){
|
|
502
|
+
let tempValue = XEUtils.find(fields[i].versions,p=>store.getters.industryVersion.includes(p))
|
|
503
|
+
if(tempValue){
|
|
504
|
+
continue
|
|
505
|
+
}
|
|
506
|
+
XEUtils.remove(fields,i)
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* 计算数量保留位数及判断取整方向
|
|
513
|
+
* @param {行数据信息} rowInfo
|
|
514
|
+
* @param {数值} number
|
|
515
|
+
* @param {位数} digits
|
|
516
|
+
* @param {取整方向} round
|
|
517
|
+
*/
|
|
518
|
+
export function numberDigitsRound(rowInfo, colInfo) {
|
|
519
|
+
// 向上、向下、四舍五入
|
|
520
|
+
switch (rowInfo[colInfo.round]) {
|
|
521
|
+
case 'ceiling':
|
|
522
|
+
rowInfo[colInfo.number] = XEUtils.ceil(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
523
|
+
break;
|
|
524
|
+
case 'floor':
|
|
525
|
+
rowInfo[colInfo.number] = XEUtils.floor(rowInfo[colInfo.number], rowInfo[colInfo.digits])
|
|
526
|
+
break;
|
|
527
|
+
case 'round':
|
|
528
|
+
rowInfo[colInfo.number] = rowInfo[colInfo.number].toFixed(rowInfo[colInfo.digits])
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
// 导出用
|
|
533
|
+
export function getExportParams(columns) {
|
|
534
|
+
let tempParams = {
|
|
535
|
+
fields: [],
|
|
536
|
+
dicts: {}
|
|
537
|
+
}
|
|
538
|
+
for (let i = 0; i < columns.length; i++) {
|
|
539
|
+
if (columns[i].visible === false) {
|
|
540
|
+
continue
|
|
541
|
+
}
|
|
542
|
+
let tempFieldInfo = {
|
|
543
|
+
field: columns[i].field,
|
|
544
|
+
title: columns[i].title
|
|
545
|
+
}
|
|
546
|
+
tempParams.fields.push(tempFieldInfo)
|
|
547
|
+
if (columns[i].dataSource && columns[i].dataSource.length > 0) {
|
|
548
|
+
if (!tempParams.dicts[columns[i].field]) {
|
|
549
|
+
tempParams.dicts[columns[i].field] = {}
|
|
550
|
+
for (let j = 0; j < columns[i].dataSource.length; j++) {
|
|
551
|
+
tempParams.dicts[columns[i].field][columns[i].dataSource[j].value] =
|
|
552
|
+
columns[i].dataSource[j].caption
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return tempParams
|
|
558
|
+
}
|
|
559
|
+
export function setFormButtons(toolBtns,statusBtns,permissionBtns){
|
|
560
|
+
// 将获取的数据进行排序
|
|
561
|
+
let tempSortArr = permissionBtns.sort(function(a,b){
|
|
562
|
+
a.sort = a.sort?a.sort:1
|
|
563
|
+
b.sort = b.sort?b.sort:1
|
|
564
|
+
return a.sort-b.sort
|
|
565
|
+
})
|
|
566
|
+
XEUtils.arrayEach(tempSortArr,loopBtn=>{
|
|
567
|
+
let pushBtn = {
|
|
568
|
+
code: loopBtn.code,
|
|
569
|
+
caption: loopBtn.name,
|
|
570
|
+
visible: true
|
|
571
|
+
}
|
|
572
|
+
if(loopBtn.visibleState){
|
|
573
|
+
pushBtn['visibleStates'] = loopBtn.visibleState.split(',')
|
|
574
|
+
}
|
|
575
|
+
if(loopBtn.visibleStatus){
|
|
576
|
+
pushBtn['visibleStatuss'] = loopBtn.visibleStatus.split(',')
|
|
577
|
+
}
|
|
578
|
+
let extraInfo = loopBtn.extraInfo
|
|
579
|
+
? JSON.parse(loopBtn.extraInfo)
|
|
580
|
+
: {}
|
|
581
|
+
if (Object.keys(extraInfo).length) {
|
|
582
|
+
pushBtn = XEUtils.assign(extraInfo, pushBtn)
|
|
583
|
+
}
|
|
584
|
+
switch(loopBtn.buttonType){
|
|
585
|
+
case 'tool':
|
|
586
|
+
toolBtns.push(pushBtn)
|
|
587
|
+
break
|
|
588
|
+
case 'status':
|
|
589
|
+
statusBtns.push(pushBtn)
|
|
590
|
+
break
|
|
591
|
+
}
|
|
592
|
+
})
|
|
593
|
+
}
|
|
594
|
+
export function getGridPagerButton(datas,dataCode){
|
|
595
|
+
let returnButtons = []
|
|
596
|
+
let tempData = XEUtils.find(datas,p=>p.code===dataCode)
|
|
597
|
+
if(!tempData){
|
|
598
|
+
return returnButtons
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
XEUtils.arrayEach(tempData.fields,loopField=>{
|
|
602
|
+
if(loopField.controlType==='pager_button'){
|
|
603
|
+
returnButtons.push({
|
|
604
|
+
field:loopField.boundField,
|
|
605
|
+
title:loopField.name,
|
|
606
|
+
visible:true
|
|
607
|
+
})
|
|
608
|
+
}
|
|
609
|
+
})
|
|
610
|
+
return returnButtons
|
|
611
611
|
}
|