doway-coms 1.1.85 → 1.1.87

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": "doway-coms",
3
- "version": "1.1.85",
3
+ "version": "1.1.87",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -124,6 +124,8 @@
124
124
  size="small"
125
125
  @change="cellValueChange(scope)"
126
126
  v-model="scope.row[scope.column.property]"
127
+ :formatter="value => numberFormatter(value, scope)"
128
+ :parser="value => numberParse(value, scope)"
127
129
  :min="scope.column.numberMin"
128
130
  :max="scope.column.numberMax"
129
131
  />
@@ -1714,18 +1716,15 @@ export default {
1714
1716
  },
1715
1717
  setColumnEdit(field, edit) {
1716
1718
  for (let i = 0; i < this.internalColumns.length; i++) {
1717
- if (this.internalColumns[i].children) {
1718
- let colInfo = XEUtils.find(
1719
- this.internalColumns[i].children,
1720
- (p) => p.field === field
1721
- );
1719
+ if (this.internalColumns[i].field == field) {
1720
+ let colInfo = this.internalColumns[i]
1722
1721
  if (colInfo) {
1723
- colInfo.editRender.enabled = edit;
1724
- colInfo.params.edit = edit;
1722
+ colInfo.editRender.enabled = edit
1723
+ colInfo.params.edit = edit
1725
1724
  }
1726
1725
  }
1727
1726
  }
1728
- this.$refs.baseGrid.refreshColumn();
1727
+ this.$refs.baseGrid.refreshColumn()
1729
1728
  },
1730
1729
  setEdit(currentState, currentStatus) {
1731
1730
  //设置添加按钮
@@ -2365,6 +2364,40 @@ export default {
2365
2364
  }, 10);
2366
2365
  }
2367
2366
  },
2367
+ numberFormatter(value, scope){
2368
+ return value
2369
+ },
2370
+ numberParse(value, scope){
2371
+ if (scope.column.params.le) {
2372
+ //小于等于
2373
+ if (value > scope.row[scope.column.params.le]) {
2374
+ return scope.row[scope.column.params.le]
2375
+ }
2376
+ }
2377
+ let returnValue = value
2378
+ let tempPrecision = XEUtils.toNumber(scope.column.params.precision)
2379
+ let reg = new RegExp(
2380
+ '^((-?)|(-?([1-9]{1}\\d*)|-?([0]{1})))(\\.(\\d){0,' + tempPrecision + '})?$'
2381
+ )
2382
+ if (!reg.test(value)) {
2383
+ //小数点验证不通过
2384
+ // console.debug('验证不通过')
2385
+ returnValue = XEUtils.floor(value, tempPrecision)
2386
+ }
2387
+ if (
2388
+ XEUtils.isInteger(scope.column.params.max) &&
2389
+ XEUtils.toNumber(returnValue) > scope.column.params.max
2390
+ ) {
2391
+ returnValue = scope.column.params.max
2392
+ }
2393
+ if (
2394
+ XEUtils.isInteger(scope.column.params.min) &&
2395
+ XEUtils.toNumber(returnValue) < scope.column.params.min
2396
+ ) {
2397
+ returnValue = scope.column.params.min
2398
+ }
2399
+ return returnValue
2400
+ }
2368
2401
  },
2369
2402
  };
2370
2403
  </script>
@@ -256,4 +256,222 @@ export function replaceParamString(
256
256
  } else {
257
257
  next()
258
258
  }
259
- }
259
+ }
260
+
261
+ /**
262
+ * 供应商未税单价计算金额
263
+ * @param {行数据信息} rowInfo
264
+ * @param {税率} taxRate
265
+ * @param {数量字段} qtyField
266
+ * @param {未税单价字段} unitPriceNotTaxField
267
+ * @param {含税单价字段} unitPriceField
268
+ * @param {未税金额字段} amountNotTaxField
269
+ * @param {含税金额字段} amountField
270
+ * @param {税额字段} taxField
271
+ */
272
+ export function supplyUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
273
+ //未税计算方式
274
+ //未税金额
275
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
276
+ XEUtils.multiply(
277
+ rowInfo[colInfo.qtyField],
278
+ rowInfo[colInfo.unitPriceNotTaxField]
279
+ ),
280
+ 2
281
+ )
282
+ //税额
283
+ rowInfo[colInfo.taxField] = XEUtils.round(
284
+ XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
285
+ 2
286
+ )
287
+ //含税金额 = 未税金额+税额
288
+ rowInfo[colInfo.amountField] = XEUtils.add(
289
+ rowInfo[colInfo.amountNotTaxField],
290
+ rowInfo[colInfo.taxField]
291
+ )
292
+ //返回来计算含税单价
293
+
294
+ rowInfo[colInfo.unitPriceField] = XEUtils.round(
295
+ XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
296
+ 2
297
+ )
298
+ console.debug(rowInfo[colInfo.unitPriceField])
299
+
300
+ if (colInfo.direction) {
301
+ rowInfo[colInfo.taxField] = XEUtils.multiply(
302
+ rowInfo[colInfo.taxField],
303
+ colInfo.direction
304
+ )
305
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
306
+ rowInfo[colInfo.amountNotTaxField],
307
+ colInfo.direction
308
+ )
309
+ rowInfo[colInfo.amountField] = XEUtils.multiply(
310
+ rowInfo[colInfo.amountField],
311
+ colInfo.direction
312
+ )
313
+ }
314
+ }
315
+
316
+ /**
317
+ * 供应商含税单价计算金额
318
+ * @param {行数据信息} rowInfo
319
+ * @param {税率} taxRate
320
+ * @param {数量字段} qtyField
321
+ * @param {未税单价字段} unitPriceNotTaxField
322
+ * @param {含税单价字段} unitPriceField
323
+ * @param {未税金额字段} amountNotTaxField
324
+ * @param {含税金额字段} amountField
325
+ * @param {税额字段} taxField
326
+ */
327
+ export function supplyUnitPriceAmount(rowInfo, taxRate, colInfo) {
328
+ //含税计算方式
329
+ rowInfo[colInfo.amountField] = XEUtils.round(
330
+ XEUtils.multiply(
331
+ rowInfo[colInfo.qtyField],
332
+ rowInfo[colInfo.unitPriceField]
333
+ ),
334
+ 2
335
+ )
336
+ //未税金额 = 含税金额除以1.13
337
+ let tempValue = XEUtils.add(1, taxRate)
338
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
339
+ XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
340
+ 2
341
+ )
342
+ //税额 = 含税金额-未税金额
343
+ rowInfo[colInfo.taxField] = XEUtils.subtract(
344
+ rowInfo[colInfo.amountField],
345
+ rowInfo[colInfo.amountNotTaxField]
346
+ )
347
+ //未税单价
348
+ rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
349
+ XEUtils.divide(
350
+ rowInfo[colInfo.amountNotTaxField],
351
+ rowInfo[colInfo.qtyField]
352
+ ),
353
+ 2
354
+ )
355
+
356
+ if (colInfo.direction) {
357
+ rowInfo[colInfo.taxField] = XEUtils.multiply(
358
+ rowInfo[colInfo.taxField],
359
+ colInfo.direction
360
+ )
361
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
362
+ rowInfo[colInfo.amountNotTaxField],
363
+ colInfo.direction
364
+ )
365
+ rowInfo[colInfo.amountField] = XEUtils.multiply(
366
+ rowInfo[colInfo.amountField],
367
+ colInfo.direction
368
+ )
369
+ }
370
+ }
371
+
372
+ /**
373
+ * 客户含税单价计算金额
374
+ * @param {行数据信息} rowInfo
375
+ * @param {税率} taxRate
376
+ * @param {数量字段} qtyField
377
+ * @param {未税单价字段} unitPriceNotTaxField
378
+ * @param {含税单价字段} unitPriceField
379
+ * @param {未税金额字段} amountNotTaxField
380
+ * @param {含税金额字段} amountField
381
+ * @param {税额字段} taxField
382
+ */
383
+ export function custUnitPriceAmount(rowInfo, taxRate, colInfo) {
384
+ //含税计算方式
385
+ rowInfo[colInfo.amountField] = XEUtils.round(
386
+ XEUtils.multiply(
387
+ rowInfo[colInfo.qtyField],
388
+ rowInfo[colInfo.unitPriceField]
389
+ ),
390
+ 2
391
+ )
392
+ //未税金额 = 含税金额除以1.13
393
+ let tempValue = XEUtils.add(1, taxRate)
394
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
395
+ XEUtils.divide(rowInfo[colInfo.amountField], tempValue),
396
+ 2
397
+ )
398
+ //税额 = 含税金额-未税金额
399
+ rowInfo[colInfo.taxField] = XEUtils.subtract(
400
+ rowInfo[colInfo.amountField],
401
+ rowInfo[colInfo.amountNotTaxField]
402
+ )
403
+ //未税单价
404
+ rowInfo[colInfo.unitPriceNotTaxField] = XEUtils.round(
405
+ XEUtils.divide(
406
+ rowInfo[colInfo.amountNotTaxField],
407
+ rowInfo[colInfo.qtyField]
408
+ ),
409
+ store.getters.custPriceNotTaxPrecision
410
+ )
411
+ if (colInfo.direction) {
412
+ rowInfo[colInfo.taxField] = XEUtils.multiply(
413
+ rowInfo[colInfo.taxField],
414
+ colInfo.direction
415
+ )
416
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
417
+ rowInfo[colInfo.amountNotTaxField],
418
+ colInfo.direction
419
+ )
420
+ rowInfo[colInfo.amountField] = XEUtils.multiply(
421
+ rowInfo[colInfo.amountField],
422
+ colInfo.direction
423
+ )
424
+ }
425
+ }
426
+ /**
427
+ * 客户未税单价计算金额
428
+ * @param {行数据信息} rowInfo
429
+ * @param {税率} taxRate
430
+ * @param {数量字段} qtyField
431
+ * @param {未税单价字段} unitPriceNotTaxField
432
+ * @param {含税单价字段} unitPriceField
433
+ * @param {未税金额字段} amountNotTaxField
434
+ * @param {含税金额字段} amountField
435
+ * @param {税额字段} taxField
436
+ */
437
+ export function custUnitPriceNotTaxAmount(rowInfo, taxRate, colInfo) {
438
+ //未税计算方式
439
+ //未税金额
440
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.round(
441
+ XEUtils.multiply(
442
+ rowInfo[colInfo.qtyField],
443
+ rowInfo[colInfo.unitPriceNotTaxField]
444
+ ),
445
+ 2
446
+ )
447
+ //税额
448
+ rowInfo[colInfo.taxField] = XEUtils.round(
449
+ XEUtils.multiply(rowInfo[colInfo.amountNotTaxField], taxRate),
450
+ 2
451
+ )
452
+ //含税金额 = 未税金额+税额
453
+ rowInfo[colInfo.amountField] = XEUtils.add(
454
+ rowInfo[colInfo.amountNotTaxField],
455
+ rowInfo[colInfo.taxField]
456
+ )
457
+ //返回来计算含税单价
458
+ rowInfo[colInfo.unitPriceField] = XEUtils.round(
459
+ XEUtils.divide(rowInfo[colInfo.amountField], rowInfo[colInfo.qtyField]),
460
+ store.getters.custPricePrecision
461
+ )
462
+
463
+ if (colInfo.direction) {
464
+ rowInfo[colInfo.taxField] = XEUtils.multiply(
465
+ rowInfo[colInfo.taxField],
466
+ colInfo.direction
467
+ )
468
+ rowInfo[colInfo.amountNotTaxField] = XEUtils.multiply(
469
+ rowInfo[colInfo.amountNotTaxField],
470
+ colInfo.direction
471
+ )
472
+ rowInfo[colInfo.amountField] = XEUtils.multiply(
473
+ rowInfo[colInfo.amountField],
474
+ colInfo.direction
475
+ )
476
+ }
477
+ }
@@ -15,6 +15,9 @@ export const sysRowState = {
15
15
  week: 'week',
16
16
  month: 'month'
17
17
  }
18
+ export const industryVersion = {
19
+ paper:'paper'//纸箱行业
20
+ }
18
21
  export const controlType = {
19
22
  text: 'text',
20
23
  number: 'number', // 数字输入