doway-coms 1.1.58 → 1.1.60

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.58",
3
+ "version": "1.1.60",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -382,6 +382,7 @@
382
382
  //xe-utils提供了一套实用的基础函数、任意格式的日期转换函数,浏览器相关操作函数等,详细使用百度
383
383
  import XEUtils from 'xe-utils'
384
384
  //VXETable插件
385
+ import VXETable from 'vxe-table'
385
386
  //ant的空状态展示占位图
386
387
  import { Empty,Row,Col,Space,Input,Select,DatePicker,Checkbox,InputNumber,TimePicker,Button } from 'ant-design-vue'
387
388
  import BasePagination from '../../BasePagination/index'
@@ -0,0 +1,53 @@
1
+ import VXETable from 'vxe-table'
2
+ import XEUtils from 'xe-utils'
3
+ VXETable.formats.mixin({
4
+ // 格式化性别
5
+ formatSex({ cellValue }) {
6
+ return cellValue ? (cellValue === '1' ? '男' : '女') : ''
7
+ },
8
+ formatCheckbox({ cellValue }) {
9
+ return cellValue === true ? '是' : '否'
10
+ },
11
+ // 格式化下拉选项
12
+ formatSelect(scope) {
13
+ let dataSource = scope.column.params.dataSource
14
+ if (!dataSource) {
15
+ // console.error(scope.cellValue + ' 字典缺失')
16
+ return scope.cellValue
17
+ }
18
+ const item = dataSource.find(item => item.value === scope.cellValue)
19
+ return item ? item.caption : scope.cellValue
20
+ },
21
+ // 格式化日期,默认 yyyy-MM-dd HH:mm:ss
22
+ formatDateTime({ cellValue }, format) {
23
+ if (cellValue && cellValue.indexOf('.') > 0) {
24
+ cellValue = cellValue.substr(0, cellValue.indexOf('.'))
25
+ }
26
+ return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd HH:mm:ss')
27
+ },
28
+ formatDate({ cellValue }, format) {
29
+ return XEUtils.toDateString(cellValue, format || 'yyyy-MM-dd')
30
+ },
31
+ // 四舍五入金额,每隔3位逗号分隔,默认2位数
32
+ formatAmount({ cellValue }, digits = 2) {
33
+ return '¥' + XEUtils.commafy(XEUtils.toNumber(cellValue), { digits })
34
+ },
35
+ // 格式化银行卡,默认每4位空格隔开
36
+ formatBankcard({ cellValue }) {
37
+ return XEUtils.commafy(XEUtils.toValueString(cellValue), {
38
+ spaceNumber: 4,
39
+ separator: ' '
40
+ })
41
+ },
42
+ // 四舍五入,默认两位数
43
+ formatFixedNumber({ cellValue }, digits = 2) {
44
+ return XEUtils.toFixed(XEUtils.round(cellValue, digits), digits)
45
+ },
46
+ // 向下舍入,默认两位数
47
+ formatCutNumber({ cellValue }, digits = 2) {
48
+ return XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
49
+ },
50
+ formatPercent({ cellValue }) {
51
+ return cellValue + '%'
52
+ }
53
+ })