t20-common-lib 0.3.0 → 0.5.0
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 +1 -1
- package/src/index.js +4 -1
- package/src/utils/tableCellUtils.js +54 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** 全局指令 */
|
|
2
2
|
import fitlers from './filters/index'
|
|
3
3
|
import repairEl from './utils/repairElementUI'
|
|
4
|
+
import { getColumnWidth, getCellAlign } from './utils/tableCellUtils'
|
|
4
5
|
// 导入组件
|
|
5
6
|
import MainPage from '../packages/main-page/index.js'
|
|
6
7
|
import TablePage from '../packages/table-page/index.js'
|
|
@@ -42,5 +43,7 @@ export {
|
|
|
42
43
|
// 以下是具体的组件列表
|
|
43
44
|
MainPage,
|
|
44
45
|
TablePage,
|
|
45
|
-
repairEl
|
|
46
|
+
repairEl,
|
|
47
|
+
getColumnWidth,
|
|
48
|
+
getCellAlign
|
|
46
49
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const COLUMN_WIDTH = {
|
|
2
|
+
SEQ: 62, // 序号
|
|
3
|
+
UNIT_NAME: 240, // 单位名称
|
|
4
|
+
ACCOUNT_NO: 190, // 账号
|
|
5
|
+
ACCOUNT_NAME: 240, // 账户名称
|
|
6
|
+
BANK_NAME: 142, // 银行名称
|
|
7
|
+
BRANCH_BANK_NAME: 268, // 支行名称
|
|
8
|
+
CURRENCY_NAME: 114, // 币种名称
|
|
9
|
+
CURRENCY_NO: 114, // 币种编号
|
|
10
|
+
BILL_NO: 240, // 票据编号
|
|
11
|
+
PERSONAL_NAME: 100, // 个人名称
|
|
12
|
+
MONEY: 190, // 金额
|
|
13
|
+
DATE: 130, // 日期
|
|
14
|
+
DATE_TIME: 180, // 日期时间
|
|
15
|
+
DATE_RANGE: 220, // 日期范围
|
|
16
|
+
ADDRESS: 268, // 地址
|
|
17
|
+
RATE: 110, // 汇率
|
|
18
|
+
CONTRACT_NO: 230, // 合同编号
|
|
19
|
+
OPERATE: 180, // 操作
|
|
20
|
+
DEFAULT: 170 // 默认
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 获取对应字段的宽度
|
|
24
|
+
* @param {String} field 字段名
|
|
25
|
+
* @param {String} fieldType 字段类型
|
|
26
|
+
*/
|
|
27
|
+
export function getColumnWidth(field, fieldType = 'DEFAULT') {
|
|
28
|
+
// 返回对应字段的宽度,如果没有则返回默认宽度
|
|
29
|
+
return COLUMN_WIDTH[fieldType] || COLUMN_WIDTH.DEFAULT;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const COLUMN_ALIGN = {
|
|
34
|
+
SEQ: 'center', // 序号
|
|
35
|
+
UNIT_NAME: 'left', // 单位名称
|
|
36
|
+
BRANCH_BANK_NAME: 'left', // 支行名称
|
|
37
|
+
ACCOUNT_NAME: 'left', // 账户名称
|
|
38
|
+
BILL_NO: 'left', // 票据编号
|
|
39
|
+
MONEY: 'right', // 金额
|
|
40
|
+
ADDRESS: 'left', // 地址
|
|
41
|
+
RATE: 'right', // 汇率
|
|
42
|
+
REMARK: 'left', // 备注
|
|
43
|
+
DEFAULT: 'center' // 默认
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 获取对应字段对齐方式
|
|
48
|
+
* @param {String} field 字段名
|
|
49
|
+
* @param {String} fieldType 字段类型
|
|
50
|
+
*/
|
|
51
|
+
export function getCellAlign(field, fieldType = 'DEFAULT') {
|
|
52
|
+
// 返回对应字段的宽度,如果没有则返回默认宽度
|
|
53
|
+
return COLUMN_ALIGN[fieldType] || COLUMN_ALIGN.DEFAULT;
|
|
54
|
+
}
|