n20-common-lib 2.6.2 → 2.6.3-beta
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 +5 -4
- package/src/assets/css/cl-file-upload-table.scss +2 -2
- package/src/assets/css/cl-layout-header.scss +34 -5
- package/src/assets/css/cl-message.scss +55 -1
- package/src/assets/css/filter.scss +1 -1
- package/src/components/AdvancedFilter/formItemRender.vue +8 -4
- package/src/components/AdvancedFilter/index.vue +34 -13
- package/src/components/AdvancedFilter/utils.js +8 -0
- package/src/components/Anchor/index.vue +5 -1
- package/src/components/ApprovalButtons/showAppOpi.vue +1 -0
- package/src/components/DateSelect/index.vue +29 -4
- package/src/components/DragList/index.vue +6 -2
- package/src/components/ElectronicArchive/index.vue +766 -0
- package/src/components/FileImport/index.vue +6 -0
- package/src/components/FileUploadTable/index.vue +1 -1
- package/src/components/Filters/index.vue +1 -1
- package/src/components/InputNumber/numberRange.vue +2 -0
- package/src/components/Layout/HeaderWrap/changePwd.vue +16 -9
- package/src/components/Layout/HeaderWrap/index.vue +10 -0
- package/src/components/Layout/HeaderWrap/indexN.vue +19 -4
- package/src/components/LoginTemporary/form.vue +8 -0
- package/src/components/SelectDatePickerPro/index.vue +13 -13
- package/src/components/ShowColumn/index.vue +3 -3
- package/src/components/TablePro/filterContent.vue +279 -0
- package/src/components/TablePro/filterContent_tree.vue +172 -0
- package/src/components/TablePro/index.js +30 -0
- package/src/components/TablePro/index.vue +3 -2
- package/src/components/Tree/index.vue +6 -1
- package/src/components/Upload/index.vue +5 -0
- package/src/components/Upload/uploadMsg.vue +7 -5
- package/src/components/operatingStatus/index.vue +5 -3
- package/src/directives/watermark/index.js +69 -0
- package/src/i18n.json +3 -0
- package/src/index.js +117 -109
- package/src/utils/amountInWords.js +17 -100
- package/src/utils/numberPor.js +24 -27
- package/style/index.css +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
package/src/index.js
CHANGED
|
@@ -1,132 +1,136 @@
|
|
|
1
|
-
import './utils/storagePro.js'
|
|
1
|
+
import './utils/storagePro.js' // 扩展Storage
|
|
2
2
|
/** 提供组件给外部使用的入口 */
|
|
3
|
-
import AnchorItem from './components/Anchor/AnchorItem.vue'
|
|
4
|
-
import Anchor from './components/Anchor/index.vue'
|
|
3
|
+
import AnchorItem from './components/Anchor/AnchorItem.vue'
|
|
4
|
+
import Anchor from './components/Anchor/index.vue'
|
|
5
5
|
|
|
6
|
-
import ApprovalButtons from './components/ApprovalButtons/index.vue'
|
|
7
|
-
import ApproveCard from './components/ApprovalCard/ApproveCard.vue'
|
|
8
|
-
import ApprovalCard from './components/ApprovalCard/index.vue'
|
|
9
|
-
import ApprovalImg from './components/ApprovalRecord/approvalImg.vue'
|
|
10
|
-
import FlowDialog from './components/ApprovalRecord/flowDialog.vue'
|
|
11
|
-
import ApprovalRecord from './components/ApprovalRecord/index.vue'
|
|
12
|
-
import ButtonGroup from './components/Button/button-group.vue'
|
|
13
|
-
import IconGroupButton from './components/Button/icon-group-button.vue'
|
|
14
|
-
import Button from './components/Button/index.vue'
|
|
15
|
-
import CascaderArea from './components/CascaderArea/index.vue'
|
|
16
|
-
import ChildRange from './components/ChildRange/index.vue'
|
|
17
|
-
import ContentLoading from './components/ContentLoading/index.vue'
|
|
18
|
-
import ContentNull from './components/ContentNull/index.vue'
|
|
19
|
-
import DatePicker from './components/DatePicker/index.vue'
|
|
20
|
-
import DatePickerPor from './components/DatePicker/por.vue'
|
|
21
|
-
import SelectDatePicker from './components/DateSelect/index.vue'
|
|
22
|
-
import Descriptions from './components/Descriptions/index.vue'
|
|
23
|
-
import Dialog from './components/Dialog/index.vue'
|
|
24
|
-
import DragList from './components/DragList/index.vue'
|
|
25
|
-
import Empty from './components/Empty/index.vue'
|
|
26
|
-
import EventBubble from './components/EventBubble/index.vue'
|
|
27
|
-
import Expandable from './components/Expandable/index.vue'
|
|
28
|
-
import ExpandablePane from './components/Expandable/main.vue'
|
|
29
|
-
import FileExportAsync from './components/FileExportAsync/index.vue'
|
|
30
|
-
import FileImport from './components/FileImport/index.vue'
|
|
31
|
-
import FileUploadTable from './components/FileUploadTable/index.vue'
|
|
32
|
-
import Filters from './components/Filters/index.vue'
|
|
33
|
-
import FlowStep from './components/FlowStep/index.vue'
|
|
34
|
-
import FooterBox from './components/FooterBox/index.vue'
|
|
35
|
-
import InputNumber from './components/InputNumber/index.vue'
|
|
36
|
-
import InputNumberRange from './components/InputNumber/numberRange.vue'
|
|
37
|
-
import InputSearch from './components/InputSearch/index.vue'
|
|
38
|
-
import NavMenu from './components/NavMenu/index.vue'
|
|
39
|
-
import PageHeader from './components/PageHeader/index.vue'
|
|
40
|
-
import Page from './components/PageLayout/page.vue'
|
|
41
|
-
import Pagination from './components/Pagination/index.vue'
|
|
42
|
-
import SecondaryTab from './components/SecondaryTab/index.vue'
|
|
43
|
-
import SelectLazy from './components/SelectLazy/index.vue'
|
|
44
|
-
import SelectTreeLazy from './components/SelectTree/SelectTreeLazy.vue'
|
|
45
|
-
import SelectTree from './components/SelectTree/index.vue'
|
|
46
|
-
import ShowColumn from './components/ShowColumn/index.vue'
|
|
47
|
-
import Sifting from './components/Sifting/index.vue'
|
|
48
|
-
import Statis from './components/Statis/index.vue'
|
|
49
|
-
import StatisItem from './components/Statis/statisItem.vue'
|
|
50
|
-
import StatisPopover from './components/Statis/statisPopover.vue'
|
|
51
|
-
import Step from './components/Step/index.vue'
|
|
52
|
-
import Suspend from './components/Suspend/index.vue'
|
|
53
|
-
import Table from './components/Table/index.vue'
|
|
54
|
-
import TableOperate from './components/TableOperateColumn/OperateBtns.vue'
|
|
55
|
-
import TableOperateColumn from './components/TableOperateColumn/index.vue'
|
|
56
|
-
import TablePro from './components/TablePro/index.vue'
|
|
57
|
-
import TableProOperateColumn from './components/TableProOperateColumn/index.vue'
|
|
58
|
-
import TableSetSize from './components/TableSetSize'
|
|
59
|
-
import Task from './components/Task/index.vue'
|
|
60
|
-
import TertiaryTab from './components/TertiaryTab/index.vue'
|
|
61
|
-
import TimePicker from './components/TimePicker/index.vue'
|
|
62
|
-
import Upload from './components/Upload/index.vue'
|
|
63
|
-
import WornPagination from './components/WornPagination/index.vue'
|
|
6
|
+
import ApprovalButtons from './components/ApprovalButtons/index.vue'
|
|
7
|
+
import ApproveCard from './components/ApprovalCard/ApproveCard.vue'
|
|
8
|
+
import ApprovalCard from './components/ApprovalCard/index.vue'
|
|
9
|
+
import ApprovalImg from './components/ApprovalRecord/approvalImg.vue'
|
|
10
|
+
import FlowDialog from './components/ApprovalRecord/flowDialog.vue'
|
|
11
|
+
import ApprovalRecord from './components/ApprovalRecord/index.vue'
|
|
12
|
+
import ButtonGroup from './components/Button/button-group.vue'
|
|
13
|
+
import IconGroupButton from './components/Button/icon-group-button.vue'
|
|
14
|
+
import Button from './components/Button/index.vue'
|
|
15
|
+
import CascaderArea from './components/CascaderArea/index.vue'
|
|
16
|
+
import ChildRange from './components/ChildRange/index.vue'
|
|
17
|
+
import ContentLoading from './components/ContentLoading/index.vue'
|
|
18
|
+
import ContentNull from './components/ContentNull/index.vue'
|
|
19
|
+
import DatePicker from './components/DatePicker/index.vue'
|
|
20
|
+
import DatePickerPor from './components/DatePicker/por.vue'
|
|
21
|
+
import SelectDatePicker from './components/DateSelect/index.vue'
|
|
22
|
+
import Descriptions from './components/Descriptions/index.vue'
|
|
23
|
+
import Dialog from './components/Dialog/index.vue'
|
|
24
|
+
import DragList from './components/DragList/index.vue'
|
|
25
|
+
import Empty from './components/Empty/index.vue'
|
|
26
|
+
import EventBubble from './components/EventBubble/index.vue'
|
|
27
|
+
import Expandable from './components/Expandable/index.vue'
|
|
28
|
+
import ExpandablePane from './components/Expandable/main.vue'
|
|
29
|
+
import FileExportAsync from './components/FileExportAsync/index.vue'
|
|
30
|
+
import FileImport from './components/FileImport/index.vue'
|
|
31
|
+
import FileUploadTable from './components/FileUploadTable/index.vue'
|
|
32
|
+
import Filters from './components/Filters/index.vue'
|
|
33
|
+
import FlowStep from './components/FlowStep/index.vue'
|
|
34
|
+
import FooterBox from './components/FooterBox/index.vue'
|
|
35
|
+
import InputNumber from './components/InputNumber/index.vue'
|
|
36
|
+
import InputNumberRange from './components/InputNumber/numberRange.vue'
|
|
37
|
+
import InputSearch from './components/InputSearch/index.vue'
|
|
38
|
+
import NavMenu from './components/NavMenu/index.vue'
|
|
39
|
+
import PageHeader from './components/PageHeader/index.vue'
|
|
40
|
+
import Page from './components/PageLayout/page.vue'
|
|
41
|
+
import Pagination from './components/Pagination/index.vue'
|
|
42
|
+
import SecondaryTab from './components/SecondaryTab/index.vue'
|
|
43
|
+
import SelectLazy from './components/SelectLazy/index.vue'
|
|
44
|
+
import SelectTreeLazy from './components/SelectTree/SelectTreeLazy.vue'
|
|
45
|
+
import SelectTree from './components/SelectTree/index.vue'
|
|
46
|
+
import ShowColumn from './components/ShowColumn/index.vue'
|
|
47
|
+
import Sifting from './components/Sifting/index.vue'
|
|
48
|
+
import Statis from './components/Statis/index.vue'
|
|
49
|
+
import StatisItem from './components/Statis/statisItem.vue'
|
|
50
|
+
import StatisPopover from './components/Statis/statisPopover.vue'
|
|
51
|
+
import Step from './components/Step/index.vue'
|
|
52
|
+
import Suspend from './components/Suspend/index.vue'
|
|
53
|
+
import Table from './components/Table/index.vue'
|
|
54
|
+
import TableOperate from './components/TableOperateColumn/OperateBtns.vue'
|
|
55
|
+
import TableOperateColumn from './components/TableOperateColumn/index.vue'
|
|
56
|
+
import TablePro from './components/TablePro/index.vue'
|
|
57
|
+
import TableProOperateColumn from './components/TableProOperateColumn/index.vue'
|
|
58
|
+
import TableSetSize from './components/TableSetSize'
|
|
59
|
+
import Task from './components/Task/index.vue'
|
|
60
|
+
import TertiaryTab from './components/TertiaryTab/index.vue'
|
|
61
|
+
import TimePicker from './components/TimePicker/index.vue'
|
|
62
|
+
import Upload from './components/Upload/index.vue'
|
|
63
|
+
import WornPagination from './components/WornPagination/index.vue'
|
|
64
64
|
|
|
65
|
-
import AdvancedFilter from './components/AdvancedFilter/index.vue'
|
|
66
|
-
import SelectTreePro from './components/SelectTree/pro.vue'
|
|
67
|
-
import Tree from './components/Tree/index.vue'
|
|
65
|
+
import AdvancedFilter from './components/AdvancedFilter/index.vue'
|
|
66
|
+
import SelectTreePro from './components/SelectTree/pro.vue'
|
|
67
|
+
import Tree from './components/Tree/index.vue'
|
|
68
|
+
import ElectronicArchive from './components/ElectronicArchive/index.vue'
|
|
68
69
|
|
|
69
70
|
// 新版日期选择框
|
|
70
|
-
import BusiDatePicker from './components/DateSelect/busiDate.vue'
|
|
71
|
-
import QuarterDatePicker from './components/DateSelect/quarterDatePicker.vue'
|
|
72
|
-
import SelectDatePickerPro from './components/SelectDatePickerPro/index.vue'
|
|
73
|
-
import TableTransfer from './components/TableTransfer/index.vue'
|
|
74
|
-
import UploadMsg from './components/Upload/uploadMsg.vue'
|
|
75
|
-
import WorkCard from './components/WorkCard/index.vue'
|
|
76
|
-
import operatingStatus from './components/operatingStatus/index.vue'
|
|
71
|
+
import BusiDatePicker from './components/DateSelect/busiDate.vue'
|
|
72
|
+
import QuarterDatePicker from './components/DateSelect/quarterDatePicker.vue'
|
|
73
|
+
import SelectDatePickerPro from './components/SelectDatePickerPro/index.vue'
|
|
74
|
+
import TableTransfer from './components/TableTransfer/index.vue'
|
|
75
|
+
import UploadMsg from './components/Upload/uploadMsg.vue'
|
|
76
|
+
import WorkCard from './components/WorkCard/index.vue'
|
|
77
|
+
import operatingStatus from './components/operatingStatus/index.vue'
|
|
77
78
|
|
|
78
79
|
// ECharts 不要打包进来
|
|
79
|
-
import Diff from './components/Diff/index.vue'
|
|
80
|
-
import Stamp from './components/Stamp/index.vue'
|
|
80
|
+
import Diff from './components/Diff/index.vue'
|
|
81
|
+
import Stamp from './components/Stamp/index.vue'
|
|
81
82
|
/* old */
|
|
82
|
-
import DialogO from './components/Dialog/indexO.vue'
|
|
83
|
-
import FiltersO from './components/Filters/indexO.vue'
|
|
84
|
-
import TableO from './components/Table/indexO.vue'
|
|
83
|
+
import DialogO from './components/Dialog/indexO.vue'
|
|
84
|
+
import FiltersO from './components/Filters/indexO.vue'
|
|
85
|
+
import TableO from './components/Table/indexO.vue'
|
|
85
86
|
/* 中建科 */
|
|
86
|
-
import ApproveCardZjk from './components/ApprovalCard/ApproveCard-zjk.vue'
|
|
87
|
-
import ApprovalCardZjk from './components/ApprovalCard/index-zjk.vue'
|
|
88
|
-
import ApprovalRecordZjk from './components/ApprovalRecord/index-zjk.vue'
|
|
87
|
+
import ApproveCardZjk from './components/ApprovalCard/ApproveCard-zjk.vue'
|
|
88
|
+
import ApprovalCardZjk from './components/ApprovalCard/index-zjk.vue'
|
|
89
|
+
import ApprovalRecordZjk from './components/ApprovalRecord/index-zjk.vue'
|
|
89
90
|
|
|
90
91
|
/** 第三方组件 */
|
|
91
92
|
|
|
92
93
|
/** 注入指令 */
|
|
93
|
-
import VClickOutside from './directives/VClickOutside/index.js'
|
|
94
|
-
import VDrag from './directives/VDrag/index.js'
|
|
95
|
-
import VErrorMessage from './directives/VErrorMessage/index.js'
|
|
96
|
-
import VHas from './directives/VHas/index.js'
|
|
97
|
-
import VMove from './directives/VMove/index.js'
|
|
98
|
-
import VRuleKey from './directives/VRuleKey/index.js'
|
|
99
|
-
import { HoverTooltip, TitleDirective } from './directives/VTitle/index.js'
|
|
100
|
-
import VTableLoading from './directives/loading/index.js'
|
|
94
|
+
import VClickOutside from './directives/VClickOutside/index.js'
|
|
95
|
+
import VDrag from './directives/VDrag/index.js'
|
|
96
|
+
import VErrorMessage from './directives/VErrorMessage/index.js'
|
|
97
|
+
import VHas from './directives/VHas/index.js'
|
|
98
|
+
import VMove from './directives/VMove/index.js'
|
|
99
|
+
import VRuleKey from './directives/VRuleKey/index.js'
|
|
100
|
+
import { HoverTooltip, TitleDirective } from './directives/VTitle/index.js'
|
|
101
|
+
import VTableLoading from './directives/loading/index.js'
|
|
102
|
+
import watermark from './directives/watermark/index.js'
|
|
101
103
|
|
|
102
104
|
/** 注入方法 */
|
|
103
|
-
import dayjs from 'dayjs'
|
|
104
|
-
import _numerify from 'numerify'
|
|
105
|
-
import getJsonc from './assets/getJsonc.js'
|
|
106
|
-
import
|
|
107
|
-
import
|
|
108
|
-
import
|
|
109
|
-
import
|
|
110
|
-
import
|
|
111
|
-
import
|
|
112
|
-
import
|
|
113
|
-
import
|
|
114
|
-
import
|
|
115
|
-
import
|
|
116
|
-
import
|
|
117
|
-
import
|
|
118
|
-
import
|
|
105
|
+
import dayjs from 'dayjs'
|
|
106
|
+
import _numerify from 'numerify'
|
|
107
|
+
import getJsonc from './assets/getJsonc.js'
|
|
108
|
+
import realUrl from './assets/realUrl.js'
|
|
109
|
+
import { has as isHas, hasG as isHasG } from './directives/VHas/index.js'
|
|
110
|
+
import asyncGetRelaNos from './utils/asyncGetRelaNos.js'
|
|
111
|
+
import auth from './utils/auth.js'
|
|
112
|
+
import axios from './utils/axios.js'
|
|
113
|
+
import downloadBlob from './utils/downloadBlob.js'
|
|
114
|
+
import forEachs from './utils/forEachs'
|
|
115
|
+
import { refreshTab, setTabs } from './utils/handleTab.js'
|
|
116
|
+
import imgLoad from './utils/imgLoad.js'
|
|
117
|
+
import importG from './utils/importGlobal.js' // 联合加载组件保存位置
|
|
118
|
+
import list2tree from './utils/list2tree'
|
|
119
|
+
import { msgPor, msgboxPor } from './utils/msgboxPor.js'
|
|
120
|
+
import N from './utils/numberPor.js' // 扩展Number
|
|
121
|
+
import { closeTab, linkGo, linkPush } from './utils/urlToGo'
|
|
122
|
+
|
|
119
123
|
function numerify(input, formatType, roundingFunction) {
|
|
120
124
|
return _numerify(input, formatType, roundingFunction)
|
|
121
125
|
}
|
|
122
126
|
|
|
123
|
-
import { convert } from './utils/amountInWords.js'
|
|
127
|
+
import { convert } from './utils/amountInWords.js'
|
|
124
128
|
|
|
125
129
|
/** 国际化 */
|
|
126
|
-
import i18n, { $l } from './utils/i18n'
|
|
130
|
+
import i18n, { $l } from './utils/i18n'
|
|
127
131
|
|
|
128
132
|
/** 修正ElementUI的问题 */
|
|
129
|
-
import repairEl from './utils/repairElementUI'
|
|
133
|
+
import repairEl from './utils/repairElementUI'
|
|
130
134
|
|
|
131
135
|
const components = [
|
|
132
136
|
ContentLoading,
|
|
@@ -200,6 +204,7 @@ const components = [
|
|
|
200
204
|
Tree,
|
|
201
205
|
SelectTreePro,
|
|
202
206
|
AdvancedFilter,
|
|
207
|
+
ElectronicArchive,
|
|
203
208
|
/* old */
|
|
204
209
|
TableO,
|
|
205
210
|
FiltersO,
|
|
@@ -211,7 +216,7 @@ const components = [
|
|
|
211
216
|
operatingStatus
|
|
212
217
|
]
|
|
213
218
|
|
|
214
|
-
const install = function
|
|
219
|
+
const install = function(Vue, opts = { prefix: 'Cl', i18nConfig: {} }) {
|
|
215
220
|
components.forEach((component) => {
|
|
216
221
|
let name = component.name
|
|
217
222
|
if (!name) return console.error('必须设置组件名称:', component)
|
|
@@ -229,6 +234,7 @@ const install = function (Vue, opts = { prefix: 'Cl', i18nConfig: {} }) {
|
|
|
229
234
|
Vue.use(VHas)
|
|
230
235
|
Vue.use(VTableLoading)
|
|
231
236
|
Vue.use(VErrorMessage)
|
|
237
|
+
Vue.use(watermark)
|
|
232
238
|
|
|
233
239
|
Vue.use(i18n, opts.i18nConfig)
|
|
234
240
|
Vue.prototype.$axios = axios
|
|
@@ -251,6 +257,7 @@ export default {
|
|
|
251
257
|
const linkClose = closeTab
|
|
252
258
|
export {
|
|
253
259
|
$l,
|
|
260
|
+
|
|
254
261
|
AdvancedFilter,
|
|
255
262
|
Anchor,
|
|
256
263
|
AnchorItem,
|
|
@@ -277,6 +284,7 @@ export {
|
|
|
277
284
|
Dialog,
|
|
278
285
|
Diff,
|
|
279
286
|
DragList,
|
|
287
|
+
ElectronicArchive,
|
|
280
288
|
Empty,
|
|
281
289
|
EventBubble,
|
|
282
290
|
Expandable,
|
|
@@ -349,10 +357,10 @@ export {
|
|
|
349
357
|
list2tree,
|
|
350
358
|
numerify,
|
|
351
359
|
operatingStatus,
|
|
360
|
+
realUrl,
|
|
352
361
|
refreshTab,
|
|
353
362
|
repairEl,
|
|
354
363
|
// 页签/路由
|
|
355
364
|
setTabs,
|
|
356
365
|
version
|
|
357
|
-
}
|
|
358
|
-
|
|
366
|
+
}
|
|
@@ -1,104 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* @param {number|string} amount 需转换的金额
|
|
4
|
-
*/
|
|
5
|
-
export function convert(money) {
|
|
6
|
-
//汉字的数字
|
|
7
|
-
var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖')
|
|
8
|
-
//基本单位
|
|
9
|
-
var cnIntRadice = new Array('', '拾', '佰', '仟')
|
|
10
|
-
//对应整数部分扩展单位
|
|
11
|
-
var cnIntUnits = new Array('', '万', '亿', '兆')
|
|
12
|
-
//对应小数部分单位
|
|
13
|
-
var cnDecUnits = new Array('角', '分', '毫', '厘')
|
|
14
|
-
//整数金额时后面跟的字符
|
|
15
|
-
var cnInteger = '整'
|
|
16
|
-
//整型完以后的单位
|
|
17
|
-
var cnIntLast = '元'
|
|
18
|
-
//最大处理的数字
|
|
19
|
-
var maxNum = 999999999999999.9999
|
|
20
|
-
//金额整数部分
|
|
21
|
-
var integerNum
|
|
22
|
-
//金额小数部分
|
|
23
|
-
var decimalNum
|
|
24
|
-
//输出的中文金额字符串
|
|
25
|
-
var chineseStr = ''
|
|
26
|
-
var minusStr = '负'
|
|
27
|
-
var minusFlag = false
|
|
28
|
-
//分离金额后用的数组,预定义
|
|
29
|
-
var parts
|
|
30
|
-
if (money == '') {
|
|
31
|
-
return ''
|
|
32
|
-
}
|
|
33
|
-
money = parseFloat(money)
|
|
34
|
-
if (money >= maxNum) {
|
|
35
|
-
//超出最大处理数字
|
|
36
|
-
return ''
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (money == 0) {
|
|
40
|
-
chineseStr = cnNums[0] + cnIntLast
|
|
41
|
-
return chineseStr
|
|
42
|
-
}
|
|
1
|
+
import Nzh from 'nzh'
|
|
43
2
|
|
|
44
|
-
|
|
45
|
-
money
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
3
|
+
export const convert = (
|
|
4
|
+
money,
|
|
5
|
+
options = {
|
|
6
|
+
ch: '零壹贰叁肆伍陆柒捌玖', // 数字字符
|
|
7
|
+
ch_u: '个拾佰仟万亿兆京', // 数位单位字符,万以下十进制,万以上万进制,个位不能省略
|
|
8
|
+
ch_f: '负', // 负字符
|
|
9
|
+
ch_d: '点', // 小数点字符
|
|
10
|
+
m_u: '元角分厘', // 金额单位
|
|
11
|
+
m_t: '', // 金额前缀
|
|
12
|
+
m_z: '整' // 金额无小数后缀
|
|
13
|
+
}
|
|
14
|
+
) => {
|
|
15
|
+
if (money === undefined || money === null) {
|
|
16
|
+
return money
|
|
53
17
|
} else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
decimalNum = parts[1].substr(0, 4)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
//获取整型部分转换
|
|
60
|
-
if (parseInt(integerNum, 10) > 0) {
|
|
61
|
-
var zeroCount = 0
|
|
62
|
-
var IntLen = integerNum.length
|
|
63
|
-
for (var i = 0; i < IntLen; i++) {
|
|
64
|
-
var n = integerNum.substr(i, 1)
|
|
65
|
-
var p = IntLen - i - 1
|
|
66
|
-
var q = p / 4
|
|
67
|
-
var m = p % 4
|
|
68
|
-
if (n == '0') {
|
|
69
|
-
zeroCount++
|
|
70
|
-
} else {
|
|
71
|
-
if (zeroCount > 0) {
|
|
72
|
-
chineseStr += cnNums[0]
|
|
73
|
-
}
|
|
74
|
-
//归零
|
|
75
|
-
zeroCount = 0
|
|
76
|
-
chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]
|
|
77
|
-
}
|
|
78
|
-
if (m == 0 && zeroCount < 4) {
|
|
79
|
-
chineseStr += cnIntUnits[q]
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
chineseStr += cnIntLast
|
|
83
|
-
}
|
|
84
|
-
//小数部分
|
|
85
|
-
if (decimalNum != '') {
|
|
86
|
-
var decLen = decimalNum.length
|
|
87
|
-
for (var i = 0; i < decLen; i++) {
|
|
88
|
-
var n = decimalNum.substr(i, 1)
|
|
89
|
-
if (n != '0') {
|
|
90
|
-
chineseStr += cnNums[Number(n)] + cnDecUnits[i]
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (chineseStr == '') {
|
|
95
|
-
chineseStr += cnNums[0] + cnIntLast + cnInteger
|
|
96
|
-
} else if (decimalNum == '') {
|
|
97
|
-
chineseStr += cnInteger
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (minusFlag) {
|
|
101
|
-
chineseStr = minusStr + chineseStr
|
|
18
|
+
var nzh = new Nzh(options)
|
|
19
|
+
return nzh.toMoney(money)
|
|
102
20
|
}
|
|
103
|
-
return chineseStr
|
|
104
21
|
}
|
package/src/utils/numberPor.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-extend-native */
|
|
2
|
+
import XEUtils from 'xe-utils'
|
|
2
3
|
let i = 1
|
|
3
4
|
|
|
4
5
|
// 去括号
|
|
@@ -106,32 +107,40 @@ function nFloor(n, f) {
|
|
|
106
107
|
return Number(subFixed(n, f))
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
// 加
|
|
111
|
+
export function add(m, n, decimal) {
|
|
112
|
+
const data = XEUtils.add(m, n)
|
|
110
113
|
if (decimal) {
|
|
111
|
-
return
|
|
114
|
+
return XEUtils.toFixed(data, decimal)
|
|
112
115
|
} else {
|
|
113
|
-
return
|
|
116
|
+
return data
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
|
-
|
|
119
|
+
// 减
|
|
120
|
+
export function sub(m, n, decimal) {
|
|
121
|
+
const data = XEUtils.subtract(m, n)
|
|
117
122
|
if (decimal) {
|
|
118
|
-
return
|
|
123
|
+
return XEUtils.toFixed(data, decimal)
|
|
119
124
|
} else {
|
|
120
|
-
return
|
|
125
|
+
return data
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
|
-
|
|
128
|
+
// 乘
|
|
129
|
+
export function mul(m, n, decimal) {
|
|
130
|
+
const data = XEUtils.multiply(m, n)
|
|
124
131
|
if (decimal) {
|
|
125
|
-
return
|
|
132
|
+
return XEUtils.toFixed(data, decimal)
|
|
126
133
|
} else {
|
|
127
|
-
return
|
|
134
|
+
return data
|
|
128
135
|
}
|
|
129
136
|
}
|
|
130
|
-
|
|
137
|
+
// 除
|
|
138
|
+
export function div(m, n, decimal) {
|
|
139
|
+
const data = XEUtils.divide(m, n)
|
|
131
140
|
if (decimal) {
|
|
132
|
-
return
|
|
141
|
+
return XEUtils.toFixed(data, decimal)
|
|
133
142
|
} else {
|
|
134
|
-
return
|
|
143
|
+
return data
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
146
|
|
|
@@ -182,23 +191,11 @@ export function evaluate(evalStr = '', decimal = 10, proceDecimal) {
|
|
|
182
191
|
* @return {string}
|
|
183
192
|
*/
|
|
184
193
|
export const subFixed = function (n, decimal = 6) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
let ns = toString(n)
|
|
188
|
-
if (isNaN(ns)) return ''
|
|
189
|
-
|
|
190
|
-
let [intC = '0', floatC = ''] = ns.split('.')
|
|
191
|
-
if (decimal > 0) {
|
|
192
|
-
let floatCn = ''
|
|
193
|
-
for (let i = 0; i < decimal; i++) {
|
|
194
|
-
let fIs = floatC[i] || '0'
|
|
195
|
-
floatCn = floatCn + fIs
|
|
196
|
-
}
|
|
197
|
-
res = intC + '.' + floatCn
|
|
194
|
+
if (n === undefined || n === null || n === '') {
|
|
195
|
+
return ''
|
|
198
196
|
} else {
|
|
199
|
-
|
|
197
|
+
return XEUtils.toFixed(n, decimal)
|
|
200
198
|
}
|
|
201
|
-
return res
|
|
202
199
|
}
|
|
203
200
|
/**
|
|
204
201
|
* 将数字或字符串格式的数字转换为千位分隔符格式的字符串
|