widget.qw 1.0.83 → 1.0.84
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/.env.development +10 -10
- package/.env.production +8 -8
- package/README.md +75 -75
- package/build/style.css +471 -471
- package/build/widget.qw.es.js +141 -74
- package/build/widget.qw.umd.js +141 -74
- package/index.html +17 -17
- package/package.json +47 -47
- package/src/App.vue +26 -26
- package/src/api/index.js +165 -165
- package/src/components/AuditBar.vue +396 -396
- package/src/components/BillCard.vue +164 -164
- package/src/components/CascaderPicker.vue +132 -132
- package/src/components/CascaderPop.vue +373 -371
- package/src/components/CheckGroup.vue +113 -113
- package/src/components/DatetimeDropdown.vue +62 -0
- package/src/components/{DatetimePicker/index.vue → DatetimePicker.vue} +124 -124
- package/src/components/DayDropdown.vue +56 -56
- package/src/components/FilePicker.vue +169 -169
- package/src/components/Input.vue +80 -80
- package/src/components/MonthDropdown.vue +51 -51
- package/src/components/MultiPicker.vue +123 -123
- package/src/components/ObjsEditor.vue +334 -334
- package/src/components/SecretNotify.js +5 -5
- package/src/components/Sheet.vue +92 -92
- package/src/components/SingleApiPicker.vue +108 -108
- package/src/components/SinglePicker.vue +102 -102
- package/src/components/SingleUserSelector.vue +425 -425
- package/src/components/Switch.vue +64 -64
- package/src/components/TreePicker.vue +113 -113
- package/src/components/UserPicker.vue +106 -106
- package/src/components/UserProfile.vue +129 -129
- package/src/components/UsersPicker.vue +118 -118
- package/src/components/YearDropdown.vue +59 -59
- package/src/components/data_selector.vue +303 -303
- package/src/components/image_picker.vue +123 -123
- package/src/components/images_picker.vue +195 -195
- package/src/components/index.js +167 -162
- package/src/components/mult_list_selector.vue +155 -155
- package/src/components/subdepartment_selector.vue +481 -481
- package/src/components/user_selector.vue +639 -639
- package/src/components/widget/DataPop.vue +95 -95
- package/src/components/{DatetimePicker → widget}/DatetimePop.vue +342 -342
- package/src/components/widget/TreePop.vue +88 -88
- package/src/components/widget/UserPop.vue +347 -347
- package/src/main.js +117 -117
- package/src/router/index.ts +178 -173
- package/src/util/array_util.js +32 -32
- package/src/util/auth_util.js +72 -72
- package/src/util/bool_util.js +5 -5
- package/src/util/bus.js +1 -1
- package/src/util/cache_util.js +18 -18
- package/src/util/errer_code.js +6 -6
- package/src/util/eval_util.js +19 -19
- package/src/util/icon_util.js +36 -36
- package/src/util/image_util.js +27 -27
- package/src/util/index.js +57 -57
- package/src/util/num_util.js +70 -70
- package/src/util/obj_util.js +28 -28
- package/src/util/request.js +73 -73
- package/src/util/request_json.js +71 -71
- package/src/util/request_json_mute.js +65 -65
- package/src/util/request_upload.js +79 -79
- package/src/util/route_util.js +31 -31
- package/src/util/str_util.js +143 -143
- package/src/util/time_util.js +406 -406
- package/src/util/toast_util.js +24 -24
- package/src/util/tree_util.js +153 -153
- package/src/util/uuid_util.js +9 -9
- package/src/util/validate.js +182 -182
- package/src/util/vue_filter.js +223 -223
- package/src/views/auditbar/index.vue +78 -78
- package/src/views/billcard/index.vue +48 -48
- package/src/views/cascaderpicker/index.vue +0 -0
- package/src/views/cascaderpop/index.vue +90 -90
- package/src/views/checkgroup/index.vue +35 -35
- package/src/views/dataSelector/index.vue +48 -48
- package/src/views/datetimedropdown/index.vue +34 -0
- package/src/views/datetimepicker/index.vue +34 -34
- package/src/views/daydropdown/index.vue +31 -31
- package/src/views/filepicker/index.vue +32 -32
- package/src/views/home/index.vue +0 -0
- package/src/views/imagepicker/index.vue +31 -31
- package/src/views/imagespicker/index.vue +37 -37
- package/src/views/input/index.vue +35 -35
- package/src/views/monthdropdown/index.vue +31 -31
- package/src/views/multListSelector/index.vue +61 -61
- package/src/views/multipicker/index.vue +36 -36
- package/src/views/objseditor/index.vue +277 -277
- package/src/views/productSelector/index.vue +35 -35
- package/src/views/projectpicker/index.vue +41 -41
- package/src/views/secretnotify/index.vue +27 -27
- package/src/views/sheet/index.vue +45 -45
- package/src/views/singlepicker/index.vue +35 -35
- package/src/views/subdepartmentSelector/index.vue +40 -40
- package/src/views/switch/index.vue +34 -34
- package/src/views/treepicker/index.vue +41 -41
- package/src/views/userSelector/index.vue +54 -54
- package/src/views/userSelectorNew/index.vue +45 -45
- package/src/views/userpicker/index.vue +43 -43
- package/src/views/userprofile/index.vue +30 -30
- package/src/views/userspicker/index.vue +43 -43
- package/src/views/yeardropdown/index.vue +32 -32
- package/src/vm/index.js +1 -1
- package/vite.config.ts +122 -122
package/src/util/route_util.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import qs from 'qs'
|
|
2
|
-
import * as StrUtil from './str_util'
|
|
3
|
-
|
|
4
|
-
export const getQueryParams = ()=>{
|
|
5
|
-
let href = window.location.href
|
|
6
|
-
href = StrUtil.trimSuffixHashPath(href)
|
|
7
|
-
let paramsStr = href.split('?')[1]
|
|
8
|
-
|
|
9
|
-
paramsStr = decodeURIComponent(paramsStr)
|
|
10
|
-
if(!paramsStr)
|
|
11
|
-
return {}
|
|
12
|
-
|
|
13
|
-
const params = qs.parse(paramsStr)
|
|
14
|
-
if(!params)
|
|
15
|
-
return {}
|
|
16
|
-
for(const key in params){
|
|
17
|
-
try{
|
|
18
|
-
let jsonParam = params[key].replace(/'/g, '"')
|
|
19
|
-
params[key] = JSON.parse(jsonParam)
|
|
20
|
-
}catch(e){
|
|
21
|
-
console.log(e)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return params
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// 截取hash路由#之前的部分
|
|
29
|
-
export const getBaseUrl = ()=>{
|
|
30
|
-
let res = href.split('#')[0]
|
|
31
|
-
return res
|
|
1
|
+
import qs from 'qs'
|
|
2
|
+
import * as StrUtil from './str_util'
|
|
3
|
+
|
|
4
|
+
export const getQueryParams = ()=>{
|
|
5
|
+
let href = window.location.href
|
|
6
|
+
href = StrUtil.trimSuffixHashPath(href)
|
|
7
|
+
let paramsStr = href.split('?')[1]
|
|
8
|
+
|
|
9
|
+
paramsStr = decodeURIComponent(paramsStr)
|
|
10
|
+
if(!paramsStr)
|
|
11
|
+
return {}
|
|
12
|
+
|
|
13
|
+
const params = qs.parse(paramsStr)
|
|
14
|
+
if(!params)
|
|
15
|
+
return {}
|
|
16
|
+
for(const key in params){
|
|
17
|
+
try{
|
|
18
|
+
let jsonParam = params[key].replace(/'/g, '"')
|
|
19
|
+
params[key] = JSON.parse(jsonParam)
|
|
20
|
+
}catch(e){
|
|
21
|
+
console.log(e)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return params
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 截取hash路由#之前的部分
|
|
29
|
+
export const getBaseUrl = ()=>{
|
|
30
|
+
let res = href.split('#')[0]
|
|
31
|
+
return res
|
|
32
32
|
}
|
package/src/util/str_util.js
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 计算显示的字符串
|
|
3
|
-
* @param {string} str 要裁剪的字符串
|
|
4
|
-
* @param {number} maxWidth 最大宽度
|
|
5
|
-
* @param {number} fontSize 字体大小
|
|
6
|
-
*/
|
|
7
|
-
export function fittingString(str, maxWidth, fontSize) {
|
|
8
|
-
var fontWidth = fontSize * 1.3; //字号+边距
|
|
9
|
-
maxWidth = maxWidth * 2; // 需要根据自己项目调整
|
|
10
|
-
var width = calcStrLen(str) * fontWidth;
|
|
11
|
-
var ellipsis = '…';
|
|
12
|
-
if (width > maxWidth) {
|
|
13
|
-
var actualLen = Math.floor((maxWidth - 10) / fontWidth);
|
|
14
|
-
var result = str.substring(0, actualLen) + ellipsis;
|
|
15
|
-
return result
|
|
16
|
-
}
|
|
17
|
-
return str
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 计算字符串的长度
|
|
22
|
-
* @param {string} str 指定的字符串
|
|
23
|
-
*/
|
|
24
|
-
export function calcStrLen(str) {
|
|
25
|
-
var len = 0;
|
|
26
|
-
for (var i = 0; i < str.length; i++) {
|
|
27
|
-
if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
|
|
28
|
-
len++;
|
|
29
|
-
} else {
|
|
30
|
-
len += 2;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return len;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function uppercaseFirst(str){
|
|
37
|
-
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function date2Str(datetime){
|
|
41
|
-
let Y = datetime.getFullYear()
|
|
42
|
-
let M = (datetime.getMonth()+1 < 10 ? '0'+(datetime.getMonth()+1) : datetime.getMonth()+1)
|
|
43
|
-
let D = (datetime.getDate() < 10 ? '0'+(datetime.getDate()) : datetime.getDate())
|
|
44
|
-
let h = (datetime.getHours() < 10 ? '0'+(datetime.getHours()) : datetime.getHours())
|
|
45
|
-
let m = (datetime.getMinutes() < 10 ? '0'+(datetime.getMinutes()) : datetime.getMinutes())
|
|
46
|
-
let s = (datetime.getSeconds() < 10 ? '0'+(datetime.getSeconds()) : datetime.getSeconds())
|
|
47
|
-
return `${Y}-${M}-${D} ${h}:${m}:${s}`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function Number2Line(num){
|
|
51
|
-
let str = '';
|
|
52
|
-
for(var i=0; i<num; i++){
|
|
53
|
-
str += '|';
|
|
54
|
-
}
|
|
55
|
-
return str;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
//阿拉伯数字转汉字
|
|
59
|
-
var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
|
|
60
|
-
var chnUnitSection = ["","万","亿","万亿","亿亿"];
|
|
61
|
-
var chnUnitChar = ["","十","百","千"];
|
|
62
|
-
|
|
63
|
-
export function Number2Chinese(num){
|
|
64
|
-
|
|
65
|
-
var unitPos = 0;
|
|
66
|
-
var strIns = '', chnStr = '';
|
|
67
|
-
var needZero = false;
|
|
68
|
-
|
|
69
|
-
if(num === 0){
|
|
70
|
-
return chnNumChar[0];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
while(num > 0){
|
|
74
|
-
var section = num % 10000;
|
|
75
|
-
if(needZero){
|
|
76
|
-
chnStr = chnNumChar[0] + chnStr;
|
|
77
|
-
}
|
|
78
|
-
strIns = SectionToChinese(section);
|
|
79
|
-
strIns += (section !== 0) ? chnUnitSection[unitPos] : chnUnitSection[0];
|
|
80
|
-
chnStr = strIns + chnStr;
|
|
81
|
-
needZero = (section < 1000) && (section > 0);
|
|
82
|
-
num = Math.floor(num / 10000);
|
|
83
|
-
unitPos++;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return chnStr;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function SectionToChinese(section){
|
|
90
|
-
var strIns = '', chnStr = '';
|
|
91
|
-
var unitPos = 0;
|
|
92
|
-
var zero = true;
|
|
93
|
-
while(section > 0){
|
|
94
|
-
var v = section % 10;
|
|
95
|
-
if(v === 0){
|
|
96
|
-
if(!zero){
|
|
97
|
-
zero = true;
|
|
98
|
-
chnStr = chnNumChar[v] + chnStr;
|
|
99
|
-
}
|
|
100
|
-
}else{
|
|
101
|
-
zero = false;
|
|
102
|
-
strIns = chnNumChar[v];
|
|
103
|
-
strIns += chnUnitChar[unitPos];
|
|
104
|
-
chnStr = strIns + chnStr;
|
|
105
|
-
}
|
|
106
|
-
unitPos++;
|
|
107
|
-
section = Math.floor(section / 10);
|
|
108
|
-
}
|
|
109
|
-
return chnStr;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function upperFirstLetter(str) {
|
|
113
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function formatList(list){
|
|
117
|
-
let seperator=','
|
|
118
|
-
return list ? list.join(seperator) : ''
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
// 删除url查询参数中的hash路径后缀
|
|
123
|
-
export function trimSuffixHashPath(str){
|
|
124
|
-
if(typeof str != 'string'){
|
|
125
|
-
console.error(`${typeof str} 不是字符串`)
|
|
126
|
-
return str
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 若没有查询参数 不处理
|
|
130
|
-
let params = str.split('?')
|
|
131
|
-
if(params.length<2)
|
|
132
|
-
return str
|
|
133
|
-
|
|
134
|
-
// 剔除末尾的哈希路由
|
|
135
|
-
let path = params[0]
|
|
136
|
-
let paramStr = params[1]
|
|
137
|
-
let list = paramStr.split('#/')
|
|
138
|
-
if(list.length<2)
|
|
139
|
-
return str
|
|
140
|
-
else
|
|
141
|
-
paramStr = list[0]
|
|
142
|
-
|
|
143
|
-
return path + '?' + paramStr
|
|
1
|
+
/**
|
|
2
|
+
* 计算显示的字符串
|
|
3
|
+
* @param {string} str 要裁剪的字符串
|
|
4
|
+
* @param {number} maxWidth 最大宽度
|
|
5
|
+
* @param {number} fontSize 字体大小
|
|
6
|
+
*/
|
|
7
|
+
export function fittingString(str, maxWidth, fontSize) {
|
|
8
|
+
var fontWidth = fontSize * 1.3; //字号+边距
|
|
9
|
+
maxWidth = maxWidth * 2; // 需要根据自己项目调整
|
|
10
|
+
var width = calcStrLen(str) * fontWidth;
|
|
11
|
+
var ellipsis = '…';
|
|
12
|
+
if (width > maxWidth) {
|
|
13
|
+
var actualLen = Math.floor((maxWidth - 10) / fontWidth);
|
|
14
|
+
var result = str.substring(0, actualLen) + ellipsis;
|
|
15
|
+
return result
|
|
16
|
+
}
|
|
17
|
+
return str
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 计算字符串的长度
|
|
22
|
+
* @param {string} str 指定的字符串
|
|
23
|
+
*/
|
|
24
|
+
export function calcStrLen(str) {
|
|
25
|
+
var len = 0;
|
|
26
|
+
for (var i = 0; i < str.length; i++) {
|
|
27
|
+
if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
|
|
28
|
+
len++;
|
|
29
|
+
} else {
|
|
30
|
+
len += 2;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return len;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function uppercaseFirst(str){
|
|
37
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function date2Str(datetime){
|
|
41
|
+
let Y = datetime.getFullYear()
|
|
42
|
+
let M = (datetime.getMonth()+1 < 10 ? '0'+(datetime.getMonth()+1) : datetime.getMonth()+1)
|
|
43
|
+
let D = (datetime.getDate() < 10 ? '0'+(datetime.getDate()) : datetime.getDate())
|
|
44
|
+
let h = (datetime.getHours() < 10 ? '0'+(datetime.getHours()) : datetime.getHours())
|
|
45
|
+
let m = (datetime.getMinutes() < 10 ? '0'+(datetime.getMinutes()) : datetime.getMinutes())
|
|
46
|
+
let s = (datetime.getSeconds() < 10 ? '0'+(datetime.getSeconds()) : datetime.getSeconds())
|
|
47
|
+
return `${Y}-${M}-${D} ${h}:${m}:${s}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function Number2Line(num){
|
|
51
|
+
let str = '';
|
|
52
|
+
for(var i=0; i<num; i++){
|
|
53
|
+
str += '|';
|
|
54
|
+
}
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//阿拉伯数字转汉字
|
|
59
|
+
var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
|
|
60
|
+
var chnUnitSection = ["","万","亿","万亿","亿亿"];
|
|
61
|
+
var chnUnitChar = ["","十","百","千"];
|
|
62
|
+
|
|
63
|
+
export function Number2Chinese(num){
|
|
64
|
+
|
|
65
|
+
var unitPos = 0;
|
|
66
|
+
var strIns = '', chnStr = '';
|
|
67
|
+
var needZero = false;
|
|
68
|
+
|
|
69
|
+
if(num === 0){
|
|
70
|
+
return chnNumChar[0];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
while(num > 0){
|
|
74
|
+
var section = num % 10000;
|
|
75
|
+
if(needZero){
|
|
76
|
+
chnStr = chnNumChar[0] + chnStr;
|
|
77
|
+
}
|
|
78
|
+
strIns = SectionToChinese(section);
|
|
79
|
+
strIns += (section !== 0) ? chnUnitSection[unitPos] : chnUnitSection[0];
|
|
80
|
+
chnStr = strIns + chnStr;
|
|
81
|
+
needZero = (section < 1000) && (section > 0);
|
|
82
|
+
num = Math.floor(num / 10000);
|
|
83
|
+
unitPos++;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return chnStr;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function SectionToChinese(section){
|
|
90
|
+
var strIns = '', chnStr = '';
|
|
91
|
+
var unitPos = 0;
|
|
92
|
+
var zero = true;
|
|
93
|
+
while(section > 0){
|
|
94
|
+
var v = section % 10;
|
|
95
|
+
if(v === 0){
|
|
96
|
+
if(!zero){
|
|
97
|
+
zero = true;
|
|
98
|
+
chnStr = chnNumChar[v] + chnStr;
|
|
99
|
+
}
|
|
100
|
+
}else{
|
|
101
|
+
zero = false;
|
|
102
|
+
strIns = chnNumChar[v];
|
|
103
|
+
strIns += chnUnitChar[unitPos];
|
|
104
|
+
chnStr = strIns + chnStr;
|
|
105
|
+
}
|
|
106
|
+
unitPos++;
|
|
107
|
+
section = Math.floor(section / 10);
|
|
108
|
+
}
|
|
109
|
+
return chnStr;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function upperFirstLetter(str) {
|
|
113
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function formatList(list){
|
|
117
|
+
let seperator=','
|
|
118
|
+
return list ? list.join(seperator) : ''
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// 删除url查询参数中的hash路径后缀
|
|
123
|
+
export function trimSuffixHashPath(str){
|
|
124
|
+
if(typeof str != 'string'){
|
|
125
|
+
console.error(`${typeof str} 不是字符串`)
|
|
126
|
+
return str
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 若没有查询参数 不处理
|
|
130
|
+
let params = str.split('?')
|
|
131
|
+
if(params.length<2)
|
|
132
|
+
return str
|
|
133
|
+
|
|
134
|
+
// 剔除末尾的哈希路由
|
|
135
|
+
let path = params[0]
|
|
136
|
+
let paramStr = params[1]
|
|
137
|
+
let list = paramStr.split('#/')
|
|
138
|
+
if(list.length<2)
|
|
139
|
+
return str
|
|
140
|
+
else
|
|
141
|
+
paramStr = list[0]
|
|
142
|
+
|
|
143
|
+
return path + '?' + paramStr
|
|
144
144
|
}
|