n20-common-lib 2.4.5 → 2.4.7
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/README.md +1 -1
- package/nstc-g6/components/Calendar/index.js +5 -5
- package/nstc-g6/components/Calendar/src/basic/month-table.vue +12 -20
- package/nstc-g6/components/Calendar/src/basic/year-table.vue +18 -22
- package/nstc-g6/components/Calendar/src/main.vue +1 -5
- package/nstc-g6/components/DialogForm/index.js +5 -5
- package/nstc-g6/components/DialogForm/src/demo/index.vue +18 -27
- package/nstc-g6/components/DialogForm/src/main.vue +15 -21
- package/nstc-g6/components/Form/A_DEMO/component/originalForm.vue +35 -50
- package/nstc-g6/components/Form/A_DEMO/config/config_3.js +1115 -1110
- package/nstc-g6/components/Form/A_DEMO/index.vue +7 -29
- package/nstc-g6/components/Form/AutocompleteCustom/index.vue +3 -5
- package/nstc-g6/components/Form/BusinessSpecific/InputMultiple.vue +60 -62
- package/nstc-g6/components/Form/BusinessSpecific/InputWithUnit.vue +12 -35
- package/nstc-g6/components/Form/BusinessSpecific/SelectTreeDialog.vue +77 -77
- package/nstc-g6/components/Form/CascaderCustom/index.vue +4 -4
- package/nstc-g6/components/Form/CheckboxCustom/index.vue +5 -11
- package/nstc-g6/components/Form/Component.vue +56 -78
- package/nstc-g6/components/Form/ComponentSecond.vue +55 -77
- package/nstc-g6/components/Form/InputAndDialog/index.js +5 -5
- package/nstc-g6/components/Form/InputAndDialog/src/main.vue +130 -153
- package/nstc-g6/components/Form/InputCustom/demo/index.vue +4 -12
- package/nstc-g6/components/Form/InputCustom/index.vue +51 -54
- package/nstc-g6/components/Form/IntervalinputCustom/demo/index.vue +1 -3
- package/nstc-g6/components/Form/IntervalinputCustom/index.vue +19 -41
- package/nstc-g6/components/Form/Item.vue +15 -30
- package/nstc-g6/components/Form/ItemSecond.vue +7 -22
- package/nstc-g6/components/Form/List.vue +12 -28
- package/nstc-g6/components/Form/ListSecond.vue +11 -27
- package/nstc-g6/components/Form/RadioCustom/index.vue +5 -23
- package/nstc-g6/components/Form/SelectAccount/index.js +5 -5
- package/nstc-g6/components/Form/SelectAccount/src/demo/index.vue +34 -28
- package/nstc-g6/components/Form/SelectAccount/src/main.vue +112 -83
- package/nstc-g6/components/Form/SelectAndDialog/index.js +5 -5
- package/nstc-g6/components/Form/SelectAndDialog/src/main.vue +126 -149
- package/nstc-g6/components/Form/SelectCashFlow/index.js +5 -5
- package/nstc-g6/components/Form/SelectCashFlow/src/demo/index.vue +18 -19
- package/nstc-g6/components/Form/SelectCashFlow/src/main.vue +52 -41
- package/nstc-g6/components/Form/SelectCustom/demo/index.vue +14 -16
- package/nstc-g6/components/Form/SelectCustom/index.vue +129 -139
- package/nstc-g6/components/Form/SelectSubject/index.js +5 -5
- package/nstc-g6/components/Form/SelectSubject/src/demo/index.vue +42 -48
- package/nstc-g6/components/Form/SelectSubject/src/main.vue +83 -86
- package/nstc-g6/components/Form/SelectindialogCustom/demo/index.vue +34 -35
- package/nstc-g6/components/Form/SelectindialogCustom/index.vue +133 -148
- package/nstc-g6/components/Form/SelectindialogCustom/install.js +3 -3
- package/nstc-g6/components/Form/TableRadioCustom/demo/index.vue +1 -7
- package/nstc-g6/components/Form/TableRadioCustom/index.vue +17 -26
- package/nstc-g6/components/Form/TextCustom/index.vue +2 -2
- package/nstc-g6/components/Form/UploadCustom/demo/index.vue +1 -3
- package/nstc-g6/components/Form/UploadCustom/index.vue +143 -173
- package/nstc-g6/components/Form/configs.js +3 -14
- package/nstc-g6/components/Form/configsSecond.js +3 -16
- package/nstc-g6/components/Form/index.js +1 -1
- package/nstc-g6/components/Form/payeePersonSelect/index.js +5 -5
- package/nstc-g6/components/Form/payeePersonSelect/src/demo/index.vue +50 -44
- package/nstc-g6/components/Form/payeePersonSelect/src/main.vue +73 -82
- package/nstc-g6/components/FormGroup/index.js +5 -5
- package/nstc-g6/components/FormGroup/src/demo/config.js +18 -19
- package/nstc-g6/components/FormGroup/src/demo/index.vue +14 -22
- package/nstc-g6/components/FormGroup/src/main.vue +122 -141
- package/nstc-g6/components/FormGroup/src/validate.js +11 -13
- package/nstc-g6/components/InputTag/InputTag.vue +78 -111
- package/nstc-g6/components/NstcBackToTop/NstcBackToTop.vue +24 -24
- package/nstc-g6/components/NstcBranchLazyLoad/NstcBranchLazyLoad.vue +4 -13
- package/nstc-g6/components/NstcCharts/NstcCharts.vue +9 -18
- package/nstc-g6/components/NstcCharts/define.js +1 -6
- package/nstc-g6/components/NstcConfirm/NstcConfirm.vue +6 -21
- package/nstc-g6/components/NstcConfirm/index.js +21 -19
- package/nstc-g6/components/NstcDialog/NstcDialog.vue +34 -38
- package/nstc-g6/components/NstcDialogForm/NstcDialogForm.vue +17 -21
- package/nstc-g6/components/NstcDialogTable/NstcDialogTable.vue +4 -17
- package/nstc-g6/components/NstcDropdown/NstcDropdown.vue +2 -12
- package/nstc-g6/components/NstcDropdownTree/NstcDropdownTree.vue +3 -13
- package/nstc-g6/components/NstcElectronicFile/NstcElectronicFile.vue +18 -78
- package/nstc-g6/components/NstcExcelCustomImport/NstcExcelCustomImport.vue +121 -147
- package/nstc-g6/components/NstcExcelImport/NstcExcelImport.vue +9 -31
- package/nstc-g6/components/NstcExcelImportN/NstcExcelImportN.vue +10 -33
- package/nstc-g6/components/NstcExpandCollapse/NstcExpandCollapse.vue +12 -16
- package/nstc-g6/components/NstcFileUpload/NstcFileUpload.vue +19 -75
- package/nstc-g6/components/NstcForm/A_DEMO/component/originalForm.vue +35 -50
- package/nstc-g6/components/NstcForm/A_DEMO/config/config_3.js +1115 -1110
- package/nstc-g6/components/NstcForm/A_DEMO/index.vue +340 -354
- package/nstc-g6/components/NstcForm/AutocompleteCustom/index.vue +2 -2
- package/nstc-g6/components/NstcForm/BusinessSpecific/InputWithUnit.vue +11 -34
- package/nstc-g6/components/NstcForm/BusinessSpecific/SelectTreeDialog.vue +77 -77
- package/nstc-g6/components/NstcForm/CheckboxCustom/index.vue +5 -11
- package/nstc-g6/components/NstcForm/Component.vue +17 -62
- package/nstc-g6/components/NstcForm/ComponentSecond.vue +55 -77
- package/nstc-g6/components/NstcForm/InputAndDialog/NstcInputAndDialog.vue +6 -24
- package/nstc-g6/components/NstcForm/InputCustom/index.vue +2 -8
- package/nstc-g6/components/NstcForm/IntervalInputCustom/index.vue +4 -21
- package/nstc-g6/components/NstcForm/Item.vue +3 -15
- package/nstc-g6/components/NstcForm/ItemSecond.vue +7 -22
- package/nstc-g6/components/NstcForm/List.vue +12 -28
- package/nstc-g6/components/NstcForm/ListSecond.vue +11 -27
- package/nstc-g6/components/NstcForm/RadioCustom/index.vue +5 -23
- package/nstc-g6/components/NstcForm/SelectAccount/NstcSelectAccount.vue +4 -24
- package/nstc-g6/components/NstcForm/SelectAndDialog/NstcSelectAndDialog.vue +7 -30
- package/nstc-g6/components/NstcForm/SelectCashFlow/NstcSelectCashFlow.vue +50 -38
- package/nstc-g6/components/NstcForm/SelectCustom/index.vue +6 -16
- package/nstc-g6/components/NstcForm/SelectSubject/NstcSelectSubject.vue +72 -82
- package/nstc-g6/components/NstcForm/SelectindialogCustom/index.vue +6 -20
- package/nstc-g6/components/NstcForm/TableRadioCustom/index.vue +17 -26
- package/nstc-g6/components/NstcForm/TextCustom/index.vue +2 -2
- package/nstc-g6/components/NstcForm/UploadCustom/index.vue +13 -60
- package/nstc-g6/components/NstcForm/configs.js +3 -14
- package/nstc-g6/components/NstcForm/configsSecond.js +3 -16
- package/nstc-g6/components/NstcForm/index.js +1 -1
- package/nstc-g6/components/NstcForm/payeePersonSelect/NstcPayeePerson.vue +57 -73
- package/nstc-g6/components/NstcPagination/NstcPagination.vue +2 -12
- package/nstc-g6/components/NstcScreenFull/NstcScreenFull.vue +2 -3
- package/nstc-g6/components/NstcSelectTree/NstcSelectTree.vue +4 -15
- package/nstc-g6/components/NstcSelectTreeList/NstcSelectTreeList.vue +5 -20
- package/nstc-g6/components/NstcSticky/NstcSticky.vue +10 -4
- package/nstc-g6/components/NstcSvgIcon/NstcSvgIcon.vue +1 -7
- package/nstc-g6/components/NstcTab/NstcTab.vue +8 -20
- package/nstc-g6/components/NstcTabWithBadge/NstcTabWithBadge.vue +7 -7
- package/nstc-g6/components/NstcTable/ElTableColumnCustom/index.vue +88 -126
- package/nstc-g6/components/NstcTable/NstcTable.vue +4 -17
- package/nstc-g6/components/NstcTableSet/NstcTableSet.vue +27 -72
- package/nstc-g6/components/NstcThemePicker/NstcThemePicker.vue +13 -14
- package/nstc-g6/components/NstcUploadCustomExcel/NstcUploadCustomExcel.vue +3 -13
- package/nstc-g6/components/NstcUploadExcel/NstcUploadExcel.vue +21 -22
- package/nstc-g6/components/NstcWorkBench/NstcWorkBench.vue +4 -17
- package/nstc-g6/components/Search/NstcSearch.vue +12 -47
- package/nstc-g6/components/Search/src/demo/index copy.vue +28 -28
- package/nstc-g6/components/Search/src/demo/index.vue +36 -36
- package/nstc-g6/components/Search/src/main copy.vue +169 -204
- package/nstc-g6/components/approvelTwo/main.vue +2 -6
- package/nstc-g6/components/approvelTwo/progress.vue +7 -29
- package/nstc-g6/directives/VCopy/index.js +52 -54
- package/nstc-g6/directives/VNstcNumber/index.js +1 -1
- package/nstc-g6/directives/VNstcNumber/temp.js +357 -362
- package/nstc-g6/utils/mapper_aims.js +774 -775
- package/nstc-g6/utils/parseTime.js +38 -36
- package/nstc-g6/utils/validate/index.js +2 -2
- package/nstc-g6/utils/vendor/Export2Excel.js +110 -111
- package/nstc-g6/utils/vendor/Export2Zip.js +12 -7
- package/nstc-g6/utils/vue-bus.js +1 -1
- package/package.json +1 -1
- package/src/assets/iconFont/demo_index.html +1 -1
- package/src/assets/iconFont/iconfont.js +66 -1
- package/src/assets/iconFont2/demo_index.html +277 -286
- package/src/assets/iconFont2/iconfont.js +66 -1
- package/src/components/Button/button-group.vue +1 -1
- package/src/components/Layout/HeaderWrap/indexN.vue +1 -1
- package/src/components/Layout/indexN.vue +1 -2
- package/src/components/LoginTemporary/indexN.vue +12 -2
- package/src/components/TableOperateColumn/index.vue +1 -1
- package/src/plugins/Print/print-js/README.md +5 -5
- package/src/plugins/Print/print-js/package.json +2 -2
- package/src/plugins/Print/print-js/src/index.d.ts +36 -36
- package/src/plugins/Print/print-js/src/js/browser.js +3 -1
- package/src/plugins/Print/print-js/src/js/functions.js +16 -10
- package/src/plugins/Print/print-js/src/js/html.js +2 -2
- package/src/plugins/Print/print-js/src/js/image.js +1 -1
- package/src/plugins/Print/print-js/src/js/init.js +15 -7
- package/src/plugins/Print/print-js/src/js/json.js +14 -4
- package/src/plugins/Print/print-js/src/js/modal.js +16 -15
- package/src/plugins/Print/print-js/src/js/pdf.js +1 -1
- package/src/plugins/Print/print-js/src/js/print.js +6 -6
- package/src/plugins/Sign/NetSM3/InfosecNetSignCNGAgent.min.js +1825 -1592
- package/src/plugins/Sign/cfca/index.js +525 -520
- package/src/plugins/Sign/sign.js +128 -128
- package/style/index.css +1 -1
- package/style/index.css.map +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
// import Vue from 'vue'
|
|
3
2
|
const NULL_ARR = ['', null, undefined, NaN]
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
/**
|
|
8
5
|
* 金额格式化
|
|
9
6
|
* @param num 金额
|
|
@@ -15,7 +12,7 @@ function amountFormat(num, len = 2, magnitude) {
|
|
|
15
12
|
/**
|
|
16
13
|
* input框的输入初始状态
|
|
17
14
|
*/
|
|
18
|
-
if(num === '-') {
|
|
15
|
+
if (num === '-') {
|
|
19
16
|
return '-'
|
|
20
17
|
}
|
|
21
18
|
|
|
@@ -32,26 +29,28 @@ function amountFormat(num, len = 2, magnitude) {
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
const magnitudeObj = {
|
|
35
|
-
5: { label: '万元', value:
|
|
36
|
-
6: { label: '十万元', value:
|
|
37
|
-
7: { label: '百万元', value:
|
|
38
|
-
8: { label: '千万元', value:
|
|
39
|
-
9: { label: '亿元', value:
|
|
32
|
+
5: { label: '万元', value: 1e4 },
|
|
33
|
+
6: { label: '十万元', value: 1e5 },
|
|
34
|
+
7: { label: '百万元', value: 1e6 },
|
|
35
|
+
8: { label: '千万元', value: 1e7 },
|
|
36
|
+
9: { label: '亿元', value: 1e8 }
|
|
40
37
|
}
|
|
41
38
|
let temp = +num
|
|
42
39
|
|
|
43
40
|
if (magnitude) {
|
|
44
41
|
const t = magnitudeObj[magnitude]
|
|
45
42
|
|
|
46
|
-
temp =
|
|
43
|
+
temp = temp / t.value
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
temp = temp.toFixed(len)
|
|
50
47
|
|
|
51
48
|
// 三点一逗
|
|
52
49
|
function get_thousand_num(num) {
|
|
53
|
-
return num.toString().replace(/\d+/, function(n) {
|
|
54
|
-
|
|
50
|
+
return num.toString().replace(/\d+/, function (n) {
|
|
51
|
+
// 先提取整数部分
|
|
52
|
+
return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
|
|
53
|
+
// 对整数部分添加分隔符
|
|
55
54
|
return $1 + ','
|
|
56
55
|
})
|
|
57
56
|
})
|
|
@@ -65,16 +64,16 @@ function amountFormat(num, len = 2, magnitude) {
|
|
|
65
64
|
* uuid
|
|
66
65
|
*/
|
|
67
66
|
function generateUUID() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
var d = new Date().getTime()
|
|
68
|
+
if (window.performance && typeof window.performance.now === 'function') {
|
|
69
|
+
d += performance.now() // use high-precision timer if available
|
|
70
|
+
}
|
|
71
|
+
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
72
|
+
var r = (d + Math.random() * 16) % 16 | 0
|
|
73
|
+
d = Math.floor(d / 16)
|
|
74
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)
|
|
75
|
+
})
|
|
76
|
+
return uuid
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
let currentFocusUUID = ''
|
|
@@ -84,363 +83,359 @@ let currentFocusUUID = ''
|
|
|
84
83
|
* el, binding, vnode, oldVnode
|
|
85
84
|
*/
|
|
86
85
|
function updateInput(el, binding) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
inputEl.value = Number(word_)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (NULL_ARR.includes(curValue)) {
|
|
127
|
-
el.classList.remove('nstc-amount-num-temp')
|
|
128
|
-
inputEl.value = ''
|
|
129
|
-
} else {
|
|
130
|
-
// 当前的激活元素,进行输入时,不显示遮罩层
|
|
131
|
-
currentFocusUUID !== currentUUID && el.classList.add('nstc-amount-num-temp')
|
|
132
|
-
}
|
|
133
|
-
//
|
|
134
|
-
} else {
|
|
135
|
-
// 保证遮罩层的text的内容,和 input 的内容一致
|
|
136
|
-
// 金额模式下
|
|
137
|
-
binding.value[`isMoney`] && (screenEl.innerText = amountFormat(inputEl.value || ''))
|
|
138
|
-
|
|
86
|
+
// 判断 input 是否是激活状态
|
|
87
|
+
const inputEl = el.querySelectorAll('input')[0]
|
|
88
|
+
if (!inputEl) {
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
// const activeFlag = document.activeElement.tagName
|
|
92
|
+
const currentUUID = inputEl.getAttribute('money-id')
|
|
93
|
+
const disabledFlag = inputEl.getAttribute('disabled') === 'disabled'
|
|
94
|
+
const screenEl = el.children[el.children.length - 1]
|
|
95
|
+
|
|
96
|
+
// 延迟后的
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
// 只有金额才存在更新遮挡板 (activeFlag !== 'INPUT')
|
|
99
|
+
// console.log('当前激活的元素', document.activeElement)
|
|
100
|
+
if (binding.value[`isMoney`] && currentFocusUUID !== currentUUID) {
|
|
101
|
+
const curValue = inputEl.value
|
|
102
|
+
|
|
103
|
+
// 如果input框是disabled 状态, 遮挡层也因该是disabled状态
|
|
104
|
+
if (!disabledFlag) {
|
|
105
|
+
// el.classList.remove('nstc-amount-input-disabled')
|
|
106
|
+
el.classList.add('nstc-amount-num')
|
|
107
|
+
} else {
|
|
108
|
+
// el.classList.add('nstc-amount-input-disabled')
|
|
109
|
+
el.classList.add('nstc-amount-num')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 当input值更新时, 遮挡层也要更新
|
|
113
|
+
screenEl.innerText = amountFormat(curValue || '')
|
|
114
|
+
if (binding.value.precision) {
|
|
115
|
+
let word_ = Number(inputEl.value).toFixed(binding.value.precision)
|
|
116
|
+
let after_ = word_.slice(-Number(binding.value.precision))
|
|
117
|
+
if (amountFormat(inputEl.value || '', binding.value.precision).indexOf('.') !== -1) {
|
|
118
|
+
let index = amountFormat(inputEl.value || '', binding.value.precision).indexOf('.')
|
|
119
|
+
let before_ = amountFormat(inputEl.value || '', binding.value.precision).slice(0, index)
|
|
120
|
+
el.children[el.children.length - 1].innerText = `${before_}.${after_}`
|
|
139
121
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
122
|
+
inputEl.value = Number(word_)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (NULL_ARR.includes(curValue)) {
|
|
126
|
+
el.classList.remove('nstc-amount-num-temp')
|
|
127
|
+
inputEl.value = ''
|
|
128
|
+
} else {
|
|
129
|
+
// 当前的激活元素,进行输入时,不显示遮罩层
|
|
130
|
+
currentFocusUUID !== currentUUID && el.classList.add('nstc-amount-num-temp')
|
|
131
|
+
}
|
|
132
|
+
//
|
|
133
|
+
} else {
|
|
134
|
+
// 保证遮罩层的text的内容,和 input 的内容一致
|
|
135
|
+
// 金额模式下
|
|
136
|
+
binding.value[`isMoney`] && (screenEl.innerText = amountFormat(inputEl.value || ''))
|
|
137
|
+
}
|
|
138
|
+
//处理刷新页面赋值带有小数点后几位问题
|
|
139
|
+
// if (binding.value.precision) {
|
|
140
|
+
// let word_ = Number(inputEl.value).toFixed(binding.value.precision)
|
|
141
|
+
// el.children[el.children.length - 1].innerText = word_
|
|
142
|
+
// inputEl.value = Number(inputEl.value)
|
|
143
|
+
// }
|
|
144
|
+
}, 30)
|
|
147
145
|
}
|
|
148
146
|
|
|
149
147
|
export default {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
bind: function (el, binding) {
|
|
149
|
+
// 绑定uuid
|
|
150
|
+
const inputEl = el.querySelectorAll('input')[0]
|
|
151
|
+
// 将input的type 类型设置为 Number
|
|
152
|
+
// inputEl && (inputEl.setAttribute('type', 'number'))
|
|
153
|
+
inputEl && inputEl.setAttribute('money-id', generateUUID())
|
|
154
|
+
|
|
155
|
+
if (binding.value[`isMoney`]) {
|
|
156
|
+
inputEl && inputEl.setAttribute('style', 'text-align:right;')
|
|
157
|
+
} else {
|
|
158
|
+
inputEl && inputEl.setAttribute('style', 'text-align:left;')
|
|
159
|
+
}
|
|
156
160
|
|
|
161
|
+
inputEl &&
|
|
162
|
+
inputEl.addEventListener('input', function () {
|
|
163
|
+
const curValue = el.querySelectorAll('input')[0].value
|
|
164
|
+
const screenEl = el.children[el.children.length - 1]
|
|
157
165
|
if (binding.value[`isMoney`]) {
|
|
158
|
-
|
|
159
|
-
} else {
|
|
160
|
-
inputEl && inputEl.setAttribute('style', 'text-align:left;')
|
|
166
|
+
screenEl.innerText = amountFormat(curValue || '')
|
|
161
167
|
}
|
|
168
|
+
})
|
|
169
|
+
},
|
|
170
|
+
unbind: function (el) {
|
|
171
|
+
el.removeEventListener('input', el.handler)
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
inserted(el, vDir) {
|
|
175
|
+
// 禁止input滚动事件
|
|
176
|
+
const ele = el.tagName === 'INPUT' ? el : el.querySelector('input')
|
|
177
|
+
// el.type = 'number'
|
|
178
|
+
ele &&
|
|
179
|
+
ele.addEventListener('mousewheel', () => {
|
|
180
|
+
ele.blur()
|
|
181
|
+
})
|
|
162
182
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
screenEl.innerText = amountFormat(curValue || '')
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
})
|
|
172
|
-
},
|
|
173
|
-
unbind: function (el) {
|
|
174
|
-
el.removeEventListener('input', el.handler)
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
inserted(el, vDir) {
|
|
183
|
+
// 当为金额时,浮框显示三点一逗
|
|
184
|
+
if (vDir.value[`isMoney`]) {
|
|
185
|
+
el.querySelector('input').parentElement.style.userSelect = 'none'
|
|
186
|
+
const elDiv = document.createElement('div')
|
|
187
|
+
elDiv.className = 'input-after-amount-num'
|
|
178
188
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
// el.type = 'number'
|
|
182
|
-
ele && ele.addEventListener('mousewheel', () => {
|
|
183
|
-
ele.blur()
|
|
184
|
-
})
|
|
189
|
+
// 添加金额class
|
|
190
|
+
el.classList.add('nstc-amount-num')
|
|
185
191
|
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
elDiv.innerText = ''
|
|
193
|
+
el.append(elDiv)
|
|
188
194
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
// 添加金额class
|
|
194
|
-
el.classList.add('nstc-amount-num')
|
|
195
|
+
// 监听input聚焦事件
|
|
196
|
+
el.addEventListener('click', () => {
|
|
197
|
+
const inputEl = el.querySelectorAll('input')[0]
|
|
198
|
+
const disabledFlag = inputEl.getAttribute('disabled') === 'disabled'
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
|
|
200
|
+
if (!disabledFlag) {
|
|
201
|
+
el.classList.remove('nstc-amount-num-temp')
|
|
202
|
+
el.children[0].focus()
|
|
198
203
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
currentFocusUUID = el.querySelectorAll('input')[0].getAttribute('money-id')
|
|
205
|
+
//
|
|
206
|
+
}
|
|
207
|
+
//
|
|
208
|
+
// eslint-disable-next-line no-debugger
|
|
209
|
+
})
|
|
210
|
+
} else {
|
|
211
|
+
let inputEl = el.querySelectorAll('input')[0]
|
|
212
|
+
let curValue = inputEl.value
|
|
213
|
+
inputEl.value = curValue ? parseFloat(curValue).toFixed(vDir.value.precision || 0) : ''
|
|
214
|
+
}
|
|
203
215
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
216
|
+
// vDir.value 有指令的参数
|
|
217
|
+
if (JSON.stringify(vDir.value) === '{}') {
|
|
218
|
+
return null
|
|
219
|
+
}
|
|
207
220
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
let content
|
|
222
|
+
// 按键按下=>只允许输入 数字/小数点
|
|
223
|
+
el.addEventListener('keypress', (event) => {
|
|
224
|
+
let e = event || window.event
|
|
225
|
+
if (!Number(e.target.value) && e.target.value != 0) {
|
|
226
|
+
e.target.value = ''
|
|
227
|
+
return ''
|
|
228
|
+
}
|
|
229
|
+
if (!e.target.value) {
|
|
230
|
+
return null
|
|
231
|
+
}
|
|
232
|
+
let inputKey = String.fromCharCode(e.keyCode || e.charCode)
|
|
233
|
+
let re = /\d|\./
|
|
234
|
+
let reP = /\d|\.|-/
|
|
235
|
+
content = e.target.value
|
|
236
|
+
|
|
237
|
+
// 定义方法,阻止输入
|
|
238
|
+
function preventInput() {
|
|
239
|
+
if (e.preventDefault) {
|
|
240
|
+
e.preventDefault()
|
|
214
241
|
} else {
|
|
215
|
-
|
|
216
|
-
let curValue = inputEl.value
|
|
217
|
-
inputEl.value = curValue ? parseFloat(curValue).toFixed(vDir.value.precision || 0) : ""
|
|
242
|
+
e.returnValue = false
|
|
218
243
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// 判断最小值是不是负数
|
|
247
|
+
let arg_min = null
|
|
248
|
+
let preventFlag = null
|
|
249
|
+
if (vDir.value) {
|
|
250
|
+
arg_min = vDir.value.min
|
|
251
|
+
if (!NULL_ARR.includes(arg_min) && arg_min < 0) {
|
|
252
|
+
preventFlag = !reP.test(inputKey) && !e.ctrlKey
|
|
253
|
+
} else {
|
|
254
|
+
preventFlag = !re.test(inputKey) && !e.ctrlKey
|
|
223
255
|
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (preventFlag) {
|
|
259
|
+
preventInput()
|
|
260
|
+
} else if ((content.indexOf('.') > 0 && inputKey === '.') || (content.includes('-') && inputKey === '-')) {
|
|
261
|
+
// 已有小数点,再次输入小数点
|
|
262
|
+
preventInput()
|
|
263
|
+
}
|
|
264
|
+
})
|
|
265
|
+
// 按键弹起=>并限制最大最小, 最大长度
|
|
266
|
+
el.addEventListener('keyup', (event) => {
|
|
267
|
+
let e = event || window.event
|
|
268
|
+
if (!Number(e.target.value) && e.target.value != 0) {
|
|
269
|
+
e.target.value = ''
|
|
270
|
+
return ''
|
|
271
|
+
}
|
|
272
|
+
if (!e.target.value) {
|
|
273
|
+
return null
|
|
274
|
+
}
|
|
275
|
+
content = e.target.value
|
|
276
|
+
let inputKey = String.fromCharCode(e.keyCode || e.charCode)
|
|
277
|
+
// 判断是不是才输入的初始状态
|
|
278
|
+
vDir.value[`isMoney`] && (el.children[el.children.length - 1].innerText = amountFormat(content || ''))
|
|
279
|
+
|
|
280
|
+
if (!content) {
|
|
281
|
+
content = ''
|
|
282
|
+
}
|
|
283
|
+
let arg_max = ''
|
|
284
|
+
let arg_min = ''
|
|
285
|
+
let max = 9999999999999
|
|
286
|
+
if (vDir.value) {
|
|
287
|
+
arg_max = vDir.value.max
|
|
288
|
+
arg_min = vDir.value.min // 没用到
|
|
289
|
+
}
|
|
290
|
+
if (!arg_max || arg_max >= max) {
|
|
291
|
+
max = arg_max
|
|
292
|
+
}
|
|
293
|
+
if (arg_max && content > arg_max) {
|
|
294
|
+
e.target.value = arg_max
|
|
295
|
+
content = arg_max
|
|
296
|
+
}
|
|
297
|
+
let maxl = max.toString().length
|
|
298
|
+
|
|
299
|
+
// console.log('判断结果', Number(arg_min) < 0, inputKey === '½')
|
|
300
|
+
|
|
301
|
+
// 验证数字的最大长度
|
|
302
|
+
if (!NULL_ARR.includes(vDir.value[`isMoney`])) {
|
|
303
|
+
// 如果输入为负号, 不处理
|
|
304
|
+
// console.log('判断结果', Number(arg_min) < 0, currentInputValue)
|
|
305
|
+
if (Number(arg_min) < 0 && ['½', 'm', '\b', '-'].includes(inputKey)) {
|
|
306
|
+
return null
|
|
307
|
+
}
|
|
308
|
+
let numPart = e.target.value.split('.')
|
|
309
|
+
let intPart = numPart[0] || ''
|
|
310
|
+
let decimalPart = numPart[1] || ''
|
|
311
|
+
if (numPart.length === 1) {
|
|
312
|
+
try {
|
|
313
|
+
Number(arg_min) >= 0
|
|
314
|
+
? (e.target.value = Math.abs(intPart.toString().slice(0, maxl)))
|
|
315
|
+
: (e.target.value = intPart.toString().slice(0, maxl))
|
|
316
|
+
} catch {
|
|
317
|
+
e.target.value = intPart.toString().slice(0, maxl)
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
try {
|
|
321
|
+
Number(arg_min) >= 0
|
|
322
|
+
? (e.target.value = Math.abs(intPart.toString().slice(0, maxl) + '.' + decimalPart.slice(0, 2)))
|
|
323
|
+
: (e.target.value = intPart.toString().slice(0, maxl) + '.' + decimalPart.slice(0, 2))
|
|
324
|
+
} catch {
|
|
325
|
+
e.target.value = intPart.toString().slice(0, maxl) + '.' + decimalPart.slice(0, 2)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
//同步修改vue v-model绑定值
|
|
329
|
+
e.target.dispatchEvent(new Event('input'))
|
|
330
|
+
// e.target.value = e.target.value
|
|
331
|
+
} else if (!NULL_ARR.includes(vDir.value.maxLength)) {
|
|
332
|
+
// console.log('验证数字的最大长度', vDir.value.maxLength, e.target.value)
|
|
333
|
+
if (!isNaN(Number(vDir.value.maxLength))) {
|
|
334
|
+
if (vDir.value.maxLength > maxl) {
|
|
335
|
+
e.target.value = e.target.value.toString().slice(0, maxl)
|
|
336
|
+
} else {
|
|
337
|
+
e.target.value = e.target.value.toString().slice(0, vDir.value.maxLength)
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
updateInput(el, vDir)
|
|
343
|
+
// 失去焦点=>保留指定位小数
|
|
344
|
+
el.addEventListener('focusout', (event) => {
|
|
345
|
+
// 此处会在 el-input 的 @change 后执行
|
|
346
|
+
|
|
347
|
+
let e = event || window.event
|
|
348
|
+
let arg_precision = vDir.value.precision || 0 // 默认保留至整数
|
|
349
|
+
|
|
350
|
+
currentFocusUUID = ''
|
|
351
|
+
// 显示三点一抖的数字temp
|
|
352
|
+
if (!Number(e.target.value) && e.target.value != 0) {
|
|
353
|
+
e.target.value = ''
|
|
354
|
+
return ''
|
|
355
|
+
}
|
|
356
|
+
if (!e.target.value) {
|
|
357
|
+
return null
|
|
358
|
+
} else {
|
|
359
|
+
el.classList.add('nstc-amount-num-temp')
|
|
360
|
+
}
|
|
361
|
+
content = e.target.value
|
|
362
|
+
if (NULL_ARR.includes(content)) {
|
|
363
|
+
el.classList.add('nstc-amount-temp-transparent')
|
|
364
|
+
} else {
|
|
365
|
+
el.classList.remove('nstc-amount-temp-transparent')
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (!content) {
|
|
369
|
+
content = ''
|
|
370
|
+
}
|
|
371
|
+
let arg_min = ''
|
|
372
|
+
if (vDir.value) {
|
|
373
|
+
arg_min = vDir.value.min
|
|
374
|
+
}
|
|
375
|
+
if (!NULL_ARR.includes(arg_min) && content < arg_min) {
|
|
376
|
+
// 设置input的框的值
|
|
377
|
+
e.target.value = arg_min
|
|
378
|
+
content = arg_min
|
|
379
|
+
|
|
380
|
+
// 还原遮罩层
|
|
381
|
+
if (vDir.value[`isMoney`]) {
|
|
382
|
+
el.children[el.children.length - 1].innerText = amountFormat(content, arg_precision)
|
|
383
|
+
} else {
|
|
384
|
+
el.children[el.children.length - 1].innerText = content
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (vDir.value.precision) {
|
|
389
|
+
let word_ = !NULL_ARR.includes(content) && Number(content).toFixed(arg_precision)
|
|
390
|
+
let after_ = word_.slice(-Number(arg_precision))
|
|
391
|
+
if (amountFormat(word_ || '', arg_precision).indexOf('.') !== -1) {
|
|
392
|
+
let index = amountFormat(word_ || '', arg_precision).indexOf('.')
|
|
393
|
+
let before_ = amountFormat(word_ || '', arg_precision).slice(0, index)
|
|
394
|
+
el.children[el.children.length - 1].innerText = `${before_}.${after_}`
|
|
395
|
+
}
|
|
396
|
+
e.target.value = Number(word_)
|
|
397
|
+
// e.target.dispatchEvent(new Event('input'));
|
|
398
|
+
}
|
|
399
|
+
if (!vDir.value[`isMoney`]) {
|
|
400
|
+
e.target.value = Number(e.target.value).toFixed(vDir.value.precision)
|
|
401
|
+
}
|
|
402
|
+
// !NULL_ARR.includes(content) && (e.target.value = Number(content))
|
|
403
|
+
// e.target.dispatchEvent(new Event('input'));
|
|
404
|
+
// updateInput(el, vDir)
|
|
405
|
+
|
|
406
|
+
//更新遮罩层
|
|
407
|
+
// e.target.dispatchEvent(new Event('input'));
|
|
408
|
+
// updateInput(el, vDir)
|
|
409
|
+
// -- callback写法1
|
|
410
|
+
// vNode.data.model.callback = ()=>{
|
|
411
|
+
// e.target.value = content.toFixed(arg_precision)
|
|
412
|
+
// }
|
|
413
|
+
// vNode.data.model.callback();
|
|
414
|
+
// -- callback 写法2
|
|
415
|
+
// vNode.data.model.callback(
|
|
416
|
+
// e.target.value = content.toFixed(arg_precision)
|
|
417
|
+
// )
|
|
418
|
+
})
|
|
224
419
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
e.returnValue = false
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// 判断最小值是不是负数
|
|
251
|
-
let arg_min = null
|
|
252
|
-
let preventFlag = null
|
|
253
|
-
if (vDir.value) {
|
|
254
|
-
arg_min = vDir.value.min
|
|
255
|
-
if (!NULL_ARR.includes(arg_min) && arg_min < 0) {
|
|
256
|
-
preventFlag = !reP.test(inputKey) && !e.ctrlKey
|
|
257
|
-
} else {
|
|
258
|
-
preventFlag = !re.test(inputKey) && !e.ctrlKey
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (preventFlag) {
|
|
263
|
-
preventInput()
|
|
264
|
-
} else if ((content.indexOf('.') > 0 && inputKey === '.') || (content.includes('-') && inputKey === '-')) {
|
|
265
|
-
// 已有小数点,再次输入小数点
|
|
266
|
-
preventInput()
|
|
267
|
-
}
|
|
268
|
-
})
|
|
269
|
-
// 按键弹起=>并限制最大最小, 最大长度
|
|
270
|
-
el.addEventListener('keyup', event => {
|
|
271
|
-
let e = event || window.event
|
|
272
|
-
if (!Number(e.target.value) && e.target.value != 0) {
|
|
273
|
-
e.target.value = ''
|
|
274
|
-
return ''
|
|
275
|
-
}
|
|
276
|
-
if (!e.target.value) {
|
|
277
|
-
return null
|
|
278
|
-
}
|
|
279
|
-
content = e.target.value
|
|
280
|
-
let inputKey = String.fromCharCode(e.keyCode || e.charCode)
|
|
281
|
-
// 判断是不是才输入的初始状态
|
|
282
|
-
vDir.value[`isMoney`] && (el.children[el.children.length - 1].innerText = amountFormat(content || ''))
|
|
283
|
-
|
|
284
|
-
if (!content) {
|
|
285
|
-
content = ''
|
|
286
|
-
}
|
|
287
|
-
let arg_max = ''
|
|
288
|
-
let arg_min = ''
|
|
289
|
-
let max = 9999999999999
|
|
290
|
-
if (vDir.value) {
|
|
291
|
-
arg_max = vDir.value.max
|
|
292
|
-
arg_min = vDir.value.min // 没用到
|
|
293
|
-
}
|
|
294
|
-
if (!arg_max || arg_max >= max) {
|
|
295
|
-
max = arg_max
|
|
296
|
-
}
|
|
297
|
-
if (arg_max && content > arg_max) {
|
|
298
|
-
e.target.value = arg_max
|
|
299
|
-
content = arg_max
|
|
300
|
-
}
|
|
301
|
-
let maxl = max.toString().length
|
|
302
|
-
|
|
303
|
-
// console.log('判断结果', Number(arg_min) < 0, inputKey === '½')
|
|
304
|
-
|
|
305
|
-
// 验证数字的最大长度
|
|
306
|
-
if (!NULL_ARR.includes(vDir.value[`isMoney`])) {
|
|
307
|
-
|
|
308
|
-
// 如果输入为负号, 不处理
|
|
309
|
-
// console.log('判断结果', Number(arg_min) < 0, currentInputValue)
|
|
310
|
-
if (Number(arg_min) < 0 && ['½', 'm', '\b', '-'].includes(inputKey)) {
|
|
311
|
-
return null
|
|
312
|
-
}
|
|
313
|
-
let numPart = e.target.value.split('.')
|
|
314
|
-
let intPart = numPart[0] || ''
|
|
315
|
-
let decimalPart = numPart[1] || ''
|
|
316
|
-
if (numPart.length === 1) {
|
|
317
|
-
try {
|
|
318
|
-
Number(arg_min) >= 0 ? (e.target.value = Math.abs(intPart.toString().slice(0, maxl))) : (e.target.value = intPart.toString().slice(0, maxl))
|
|
319
|
-
} catch {
|
|
320
|
-
e.target.value = intPart.toString().slice(0, maxl)
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
} else {
|
|
324
|
-
try {
|
|
325
|
-
Number(arg_min) >= 0 ? (e.target.value = Math.abs(intPart.toString().slice(0, maxl) + '.' + decimalPart.slice(0, 2))) : (e.target.value = intPart.toString().slice(0, maxl) + '.' + decimalPart.slice(0, 2))
|
|
326
|
-
} catch {
|
|
327
|
-
e.target.value = intPart.toString().slice(0, maxl) + '.' + decimalPart.slice(0, 2)
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
}
|
|
331
|
-
//同步修改vue v-model绑定值
|
|
332
|
-
e.target.dispatchEvent(new Event('input'));
|
|
333
|
-
// e.target.value = e.target.value
|
|
334
|
-
|
|
335
|
-
} else if (!NULL_ARR.includes(vDir.value.maxLength)) {
|
|
336
|
-
// console.log('验证数字的最大长度', vDir.value.maxLength, e.target.value)
|
|
337
|
-
if (!isNaN(Number(vDir.value.maxLength))) {
|
|
338
|
-
if (vDir.value.maxLength > maxl) {
|
|
339
|
-
e.target.value = e.target.value.toString().slice(0, maxl)
|
|
340
|
-
} else {
|
|
341
|
-
e.target.value = e.target.value.toString().slice(0, vDir.value.maxLength)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
})
|
|
347
|
-
updateInput(el, vDir)
|
|
348
|
-
// 失去焦点=>保留指定位小数
|
|
349
|
-
el.addEventListener('focusout', event => { // 此处会在 el-input 的 @change 后执行
|
|
350
|
-
|
|
351
|
-
let e = event || window.event
|
|
352
|
-
let arg_precision = vDir.value.precision || 0 // 默认保留至整数
|
|
353
|
-
|
|
354
|
-
currentFocusUUID = ''
|
|
355
|
-
// 显示三点一抖的数字temp
|
|
356
|
-
if (!Number(e.target.value) && e.target.value != 0) {
|
|
357
|
-
e.target.value = ''
|
|
358
|
-
return ''
|
|
359
|
-
}
|
|
360
|
-
if (!e.target.value) {
|
|
361
|
-
return null
|
|
362
|
-
} else {
|
|
363
|
-
el.classList.add('nstc-amount-num-temp')
|
|
364
|
-
}
|
|
365
|
-
content = e.target.value
|
|
366
|
-
if (NULL_ARR.includes(content)) {
|
|
367
|
-
el.classList.add('nstc-amount-temp-transparent')
|
|
368
|
-
} else {
|
|
369
|
-
el.classList.remove('nstc-amount-temp-transparent')
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
if (!content) {
|
|
373
|
-
content = ''
|
|
374
|
-
}
|
|
375
|
-
let arg_min = ''
|
|
376
|
-
if (vDir.value) {
|
|
377
|
-
arg_min = vDir.value.min
|
|
378
|
-
}
|
|
379
|
-
if (!NULL_ARR.includes(arg_min) && content < arg_min) {
|
|
380
|
-
// 设置input的框的值
|
|
381
|
-
e.target.value = arg_min
|
|
382
|
-
content = arg_min
|
|
383
|
-
|
|
384
|
-
// 还原遮罩层
|
|
385
|
-
if (vDir.value[`isMoney`]) {
|
|
386
|
-
el.children[el.children.length - 1].innerText = amountFormat(content, arg_precision);
|
|
387
|
-
|
|
388
|
-
} else {
|
|
389
|
-
el.children[el.children.length - 1].innerText = content
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
if (vDir.value.precision) {
|
|
394
|
-
|
|
395
|
-
let word_ = !NULL_ARR.includes(content) && (Number(content).toFixed(arg_precision))
|
|
396
|
-
let after_ = word_.slice(-Number(arg_precision))
|
|
397
|
-
if (amountFormat(word_ || '', arg_precision).indexOf('.') !== -1) {
|
|
398
|
-
let index = amountFormat(word_ || '', arg_precision).indexOf('.')
|
|
399
|
-
let before_ = amountFormat(word_ || '', arg_precision).slice(0, index)
|
|
400
|
-
el.children[el.children.length - 1].innerText = `${before_}.${after_}`
|
|
401
|
-
}
|
|
402
|
-
e.target.value = Number(word_)
|
|
403
|
-
// e.target.dispatchEvent(new Event('input'));
|
|
404
|
-
}
|
|
405
|
-
if (!vDir.value[`isMoney`]) {
|
|
406
|
-
e.target.value = Number(e.target.value).toFixed(vDir.value.precision)
|
|
407
|
-
}
|
|
408
|
-
// !NULL_ARR.includes(content) && (e.target.value = Number(content))
|
|
409
|
-
// e.target.dispatchEvent(new Event('input'));
|
|
410
|
-
// updateInput(el, vDir)
|
|
411
|
-
|
|
412
|
-
//更新遮罩层
|
|
413
|
-
// e.target.dispatchEvent(new Event('input'));
|
|
414
|
-
// updateInput(el, vDir)
|
|
415
|
-
// -- callback写法1
|
|
416
|
-
// vNode.data.model.callback = ()=>{
|
|
417
|
-
// e.target.value = content.toFixed(arg_precision)
|
|
418
|
-
// }
|
|
419
|
-
// vNode.data.model.callback();
|
|
420
|
-
// -- callback 写法2
|
|
421
|
-
// vNode.data.model.callback(
|
|
422
|
-
// e.target.value = content.toFixed(arg_precision)
|
|
423
|
-
// )
|
|
424
|
-
})
|
|
425
|
-
|
|
426
|
-
// 当时去焦点时
|
|
427
|
-
el.addEventListener('blur', () => {
|
|
428
|
-
|
|
429
|
-
})
|
|
430
|
-
|
|
431
|
-
// 聚焦事件
|
|
432
|
-
el.addEventListener('focus', event => {
|
|
433
|
-
let e = event || window.event
|
|
434
|
-
if (!vDir.value[`isMoney`]) {
|
|
435
|
-
if (e.target.value !== '') {
|
|
436
|
-
e.target.value = Number(e.target.value)
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}, true)
|
|
440
|
-
},
|
|
441
|
-
componentUpdated(el, binding, vnode, oldVnode) {
|
|
442
|
-
updateInput(el, binding, vnode, oldVnode)
|
|
443
|
-
},
|
|
444
|
-
update() {
|
|
445
|
-
}
|
|
420
|
+
// 当时去焦点时
|
|
421
|
+
el.addEventListener('blur', () => {})
|
|
422
|
+
|
|
423
|
+
// 聚焦事件
|
|
424
|
+
el.addEventListener(
|
|
425
|
+
'focus',
|
|
426
|
+
(event) => {
|
|
427
|
+
let e = event || window.event
|
|
428
|
+
if (!vDir.value[`isMoney`]) {
|
|
429
|
+
if (e.target.value !== '') {
|
|
430
|
+
e.target.value = Number(e.target.value)
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
true
|
|
435
|
+
)
|
|
436
|
+
},
|
|
437
|
+
componentUpdated(el, binding, vnode, oldVnode) {
|
|
438
|
+
updateInput(el, binding, vnode, oldVnode)
|
|
439
|
+
},
|
|
440
|
+
update() {}
|
|
446
441
|
}
|