web-component-gallery 1.3.12 → 2.0.2
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/dist/923.umd.js +1 -0
- package/dist/index.umd.js +1 -12252
- package/dist/js.umd.js +1 -0
- package/dist/style.css +17 -0
- package/dist/style.umd.js +1 -0
- package/{method → extensions}/AMap.js +1 -5
- package/{plugins/method → extensions}/Dialog.js +2 -2
- package/{lib/lazy_use.js → extensions/index.js} +16 -2
- package/lib/{amap/components/AmapSearch/index.jsx → amap-comp/AmapSearch.jsx} +3 -5
- package/lib/amap-comp/index.js +18 -0
- package/{plugins/lib/amap/components/AmapSearch/index.less → lib/amap-comp/style/AmapSearch.less} +5 -3
- package/lib/amap-comp/style/index.js +1 -0
- package/lib/amap-comp/style/index.less +1 -0
- package/lib/{amap/AmapDraw.jsx → amap-draw/index.jsx} +2 -4
- package/lib/amap-draw/style/index.js +1 -0
- package/lib/{amap/AmapDraw.less → amap-draw/style/index.less} +6 -3
- package/lib/browse/index.jsx +0 -2
- package/lib/browse/style/index.js +1 -0
- package/lib/button/Button.js +1 -3
- package/lib/button/style/index.js +1 -0
- package/{plugins/lib/dateTime → lib/date-time}/index.vue +3 -13
- package/lib/date-time/style/index.js +1 -0
- package/lib/date-time/style/index.less +7 -0
- package/lib/{descriptions → descriptions-list}/index.jsx +1 -3
- package/lib/descriptions-list/style/index.js +1 -0
- package/{plugins/lib/tree → lib/directory}/Directory.js +4 -21
- package/lib/directory/index.js +8 -0
- package/lib/directory/style/index.js +1 -0
- package/lib/{tree/style/Directory.less → directory/style/index.less} +3 -4
- package/{plugins/lib/form/components → lib/form-comp}/ACascaderMultiple.vue +1 -106
- package/lib/form-comp/ARadio.vue +70 -0
- package/lib/{form/components → form-comp}/ARangePicker.vue +9 -20
- package/lib/{form/components → form-comp}/ASelectCustom.vue +1 -8
- package/lib/form-comp/ATagsInput.vue +88 -0
- package/lib/form-comp/ATimePicker.vue +127 -0
- package/lib/{form/components → form-comp}/AUpload.vue +2 -17
- package/lib/form-comp/index.js +37 -0
- package/lib/form-comp/style/ACascaderMultiple.less +117 -0
- package/lib/form-comp/style/ARadio.less +0 -0
- package/lib/form-comp/style/ARangePicker.less +11 -0
- package/lib/form-comp/style/ASelectCustom.less +4 -0
- package/lib/form-comp/style/ATagsInput.less +24 -0
- package/lib/form-comp/style/ATimePicker.less +8 -0
- package/lib/form-comp/style/AUpload.less +15 -0
- package/lib/form-comp/style/index.js +1 -0
- package/lib/form-comp/style/index.less +7 -0
- package/lib/index.js +60 -45
- package/lib/modal/index.jsx +4 -6
- package/lib/modal/style/index.js +1 -0
- package/lib/modal/{index.less → style/index.less} +6 -7
- package/{plugins/lib/form → lib/model}/Model.js +1 -3
- package/lib/model/index.js +7 -0
- package/lib/model/style/index.js +1 -0
- package/lib/{form/style/Model.less → model/style/index.less} +10 -10
- package/{plugins/lib/form → lib/model}/utils/render.js +1 -1
- package/lib/{form → model}/utils/resetFields.js +1 -1
- package/lib/no-data/directive.js +65 -0
- package/lib/no-data/index.js +21 -0
- package/lib/no-data/index.vue +35 -0
- package/lib/no-data/style/index.js +1 -0
- package/lib/no-data/style/index.less +15 -0
- package/lib/search/index.js +7 -0
- package/{plugins/lib/form/Search.vue → lib/search/index.vue} +3 -6
- package/lib/search/style/index.js +1 -0
- package/{plugins/lib/form/style/Search.less → lib/search/style/index.less} +7 -8
- package/lib/style/mixins.less +1 -1
- package/lib/{svgIcon → svg-icon}/index.vue +1 -17
- package/lib/svg-icon/style/index.js +1 -0
- package/lib/svg-icon/style/index.less +15 -0
- package/lib/table/index.vue +4 -8
- package/lib/table/style/index.js +1 -0
- package/lib/table/style/index.less +12 -13
- package/lib/tree/index.js +2 -11
- package/{plugins/lib/tree/Tree.vue → lib/tree/index.vue} +2 -5
- package/lib/tree/style/index.js +1 -0
- package/{plugins/lib/tree/style/Tree.less → lib/tree/style/index.less} +4 -4
- package/lib/weather/index.vue +1 -9
- package/lib/weather/style/index.js +1 -0
- package/lib/weather/style/index.less +7 -0
- package/package.json +16 -34
- package/utils/Axios.js +91 -82
- package/utils/Postcss.js +12 -8
- package/README.md +0 -24
- package/dist/amap.umd.js +0 -12252
- package/dist/avatar.umd.js +0 -5337
- package/dist/button.umd.js +0 -5845
- package/dist/dateTime.umd.js +0 -1287
- package/dist/form.umd.js +0 -9981
- package/dist/multiTab.umd.js +0 -5556
- package/dist/svgIcon.umd.js +0 -1167
- package/dist/table.umd.js +0 -6306
- package/dist/tree.umd.js +0 -5393
- package/dist/weather.umd.js +0 -1167
- package/lib/amap/components/AmapSearch/index.less +0 -16
- package/lib/amap/index.js +0 -13
- package/lib/avatar/index.js +0 -7
- package/lib/avatar/index.vue +0 -47
- package/lib/basic/404.vue +0 -24
- package/lib/dateTime/index.vue +0 -43
- package/lib/form/Model.js +0 -153
- package/lib/form/Search.vue +0 -159
- package/lib/form/components/ACascaderMultiple.vue +0 -766
- package/lib/form/components/ARadio.vue +0 -74
- package/lib/form/components/ATagsInput.vue +0 -93
- package/lib/form/components/ATimePicker.vue +0 -73
- package/lib/form/index.js +0 -55
- package/lib/form/style/Search.less +0 -34
- package/lib/form/utils/render.js +0 -85
- package/lib/iframe/events.js +0 -2
- package/lib/iframe/index.jsx +0 -234
- package/lib/iframe/index.less +0 -19
- package/lib/multiTab/APIEnums.js +0 -17
- package/lib/multiTab/MultiTab.jsx +0 -237
- package/lib/multiTab/RouteAPI.js +0 -71
- package/lib/multiTab/RouteContent.jsx +0 -90
- package/lib/multiTab/RouteKeepAlive.js +0 -183
- package/lib/multiTab/events.js +0 -2
- package/lib/multiTab/index.js +0 -15
- package/lib/multiTab/index.less +0 -73
- package/lib/style/index.less +0 -2
- package/lib/tree/Directory.js +0 -428
- package/lib/tree/Tree.vue +0 -181
- package/lib/tree/style/Tree.less +0 -52
- package/method/Dialog.js +0 -134
- package/method/index.js +0 -12
- package/plugins/lib/amap/AmapDraw.jsx +0 -349
- package/plugins/lib/amap/AmapDraw.less +0 -45
- package/plugins/lib/amap/components/AmapSearch/index.jsx +0 -73
- package/plugins/lib/amap/index.js +0 -13
- package/plugins/lib/avatar/index.js +0 -7
- package/plugins/lib/avatar/index.vue +0 -47
- package/plugins/lib/basic/404.vue +0 -24
- package/plugins/lib/browse/index.jsx +0 -76
- package/plugins/lib/browse/index.less +0 -4
- package/plugins/lib/button/Button.js +0 -89
- package/plugins/lib/button/index.js +0 -7
- package/plugins/lib/dateTime/index.js +0 -7
- package/plugins/lib/descriptions/index.jsx +0 -108
- package/plugins/lib/descriptions/index.less +0 -15
- package/plugins/lib/form/components/ARadio.vue +0 -74
- package/plugins/lib/form/components/ARangePicker.vue +0 -129
- package/plugins/lib/form/components/ASelectCustom.vue +0 -226
- package/plugins/lib/form/components/ATagsInput.vue +0 -93
- package/plugins/lib/form/components/ATimePicker.vue +0 -73
- package/plugins/lib/form/components/AUpload.vue +0 -183
- package/plugins/lib/form/components/RenderComp.vue +0 -69
- package/plugins/lib/form/index.js +0 -55
- package/plugins/lib/form/style/Model.less +0 -53
- package/plugins/lib/form/utils/resetFields.js +0 -16
- package/plugins/lib/iframe/events.js +0 -2
- package/plugins/lib/iframe/index.jsx +0 -234
- package/plugins/lib/iframe/index.less +0 -19
- package/plugins/lib/index.js +0 -72
- package/plugins/lib/lazy_use.js +0 -40
- package/plugins/lib/modal/index.jsx +0 -53
- package/plugins/lib/modal/index.less +0 -50
- package/plugins/lib/multiTab/APIEnums.js +0 -17
- package/plugins/lib/multiTab/MultiTab.jsx +0 -237
- package/plugins/lib/multiTab/RouteAPI.js +0 -71
- package/plugins/lib/multiTab/RouteContent.jsx +0 -90
- package/plugins/lib/multiTab/RouteKeepAlive.js +0 -183
- package/plugins/lib/multiTab/events.js +0 -2
- package/plugins/lib/multiTab/index.js +0 -15
- package/plugins/lib/multiTab/index.less +0 -73
- package/plugins/lib/style/index.less +0 -2
- package/plugins/lib/style/mixins.less +0 -79
- package/plugins/lib/svgIcon/index.js +0 -7
- package/plugins/lib/svgIcon/index.vue +0 -77
- package/plugins/lib/table/index.js +0 -7
- package/plugins/lib/table/index.vue +0 -217
- package/plugins/lib/table/style/index.less +0 -50
- package/plugins/lib/tree/index.js +0 -17
- package/plugins/lib/tree/style/Directory.less +0 -119
- package/plugins/lib/weather/index.js +0 -7
- package/plugins/lib/weather/index.vue +0 -58
- package/plugins/method/AMap.js +0 -368
- package/plugins/method/PageLoading.jsx +0 -106
- package/plugins/method/Theme.js +0 -88
- package/plugins/method/index.js +0 -12
- package/plugins/store/auth.js +0 -31
- package/plugins/store/cache.js +0 -56
- package/plugins/store/chat.js +0 -74
- package/plugins/store/project.js +0 -46
- package/plugins/utils/Axios.js +0 -105
- package/plugins/utils/Base64.js +0 -314
- package/plugins/utils/Filter.js +0 -249
- package/plugins/utils/PostMessage.js +0 -16
- package/plugins/utils/Postcss.js +0 -9
- package/plugins/utils/Rem.js +0 -24
- package/plugins/utils/Request.js +0 -38
- package/plugins/utils/Storage.js +0 -73
- package/plugins/utils/Tree.js +0 -169
- package/plugins/utils/Utils.js +0 -51
- package/plugins/utils/Validate.js +0 -33
- package/plugins/utils/Websocket.js +0 -186
- package/utils/PostMessage.js +0 -16
- package/utils/Request.js +0 -38
- /package/{method → extensions}/PageLoading.jsx +0 -0
- /package/{method → extensions}/Theme.js +0 -0
- /package/{plugins/font → font}/DS-DIGI-1.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIB-2.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGII-3.ttf +0 -0
- /package/{plugins/font → font}/DS-DIGIT-4.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Black.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Bold.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Medium.ttf +0 -0
- /package/{plugins/font → font}/Orbitron-Regular.ttf +0 -0
- /package/{plugins/font → font}/PANGMENZHENGDAOBIAOTITI-1.TTF +0 -0
- /package/{plugins/font → font}/PingFang SC.ttf +0 -0
- /package/{plugins/font → font}/YouSheBiaoTiHei.ttf +0 -0
- /package/{plugins/font → font}/font.css +0 -0
- /package/{plugins/font → font}//345/255/227/351/255/20235/345/217/267-/347/273/217/345/205/270/351/233/205/351/273/221.ttf" +0 -0
- /package/lib/browse/{index.less → style/index.less} +0 -0
- /package/{dist/css/index.css → lib/button/style/index.less} +0 -0
- /package/lib/{dateTime → date-time}/index.js +0 -0
- /package/lib/{descriptions → descriptions-list/style}/index.less +0 -0
- /package/lib/{form/components → form-comp}/RenderComp.vue +0 -0
- /package/lib/{svgIcon → svg-icon}/index.js +0 -0
package/plugins/utils/Filter.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {*} day 传入天数
|
|
5
|
-
* 距离现在n天前的日期
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export function getDay( day ) {
|
|
9
|
-
let today = new Date();
|
|
10
|
-
|
|
11
|
-
let targetday_milliseconds=today.getTime() + 1000*60*60*24*day;
|
|
12
|
-
|
|
13
|
-
today.setTime(targetday_milliseconds); //注意,这行是关键代码
|
|
14
|
-
|
|
15
|
-
let tYear = today.getFullYear();
|
|
16
|
-
|
|
17
|
-
let tMonth = today.getMonth();
|
|
18
|
-
|
|
19
|
-
let tDate = today.getDate();
|
|
20
|
-
|
|
21
|
-
tMonth = doHandleMonth(tMonth + 1);
|
|
22
|
-
|
|
23
|
-
tDate = doHandleMonth(tDate);
|
|
24
|
-
|
|
25
|
-
return tYear+"-"+tMonth+"-"+tDate;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function doHandleMonth(month){
|
|
30
|
-
|
|
31
|
-
let m = month;
|
|
32
|
-
|
|
33
|
-
if(month.toString().length == 1){
|
|
34
|
-
|
|
35
|
-
m = "0" + month;
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return m;
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
* @param {*} time 传入时间
|
|
47
|
-
* @param {*} cFormat 可不传。格式化结构 默认 年-月-日 时:分:秒
|
|
48
|
-
* {y}年 {m}月 {d}日 {h}时 {i}分 {s}秒 {a}星期
|
|
49
|
-
*/
|
|
50
|
-
export function formatDate(time, cFormat) {
|
|
51
|
-
if (arguments.length === 0 || !time) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
|
|
55
|
-
let date;
|
|
56
|
-
if (typeof time === "object") {
|
|
57
|
-
date = time;
|
|
58
|
-
} else {
|
|
59
|
-
let times = time;
|
|
60
|
-
times = new Date(time).getTime();
|
|
61
|
-
if ((typeof times === "string")) {
|
|
62
|
-
if ((/^[0-9]+$/.test(times))) {
|
|
63
|
-
times = parseInt(times);
|
|
64
|
-
} else {
|
|
65
|
-
times = times.replace(new RegExp(/-/g), "/");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if ((typeof times === "number") && (times.toString().length === 10)) {
|
|
69
|
-
times *= 1000;
|
|
70
|
-
}
|
|
71
|
-
date = new Date(times);
|
|
72
|
-
}
|
|
73
|
-
const formatObj = {
|
|
74
|
-
y: date.getFullYear(),
|
|
75
|
-
m: date.getMonth() + 1,
|
|
76
|
-
d: date.getDate(),
|
|
77
|
-
h: date.getHours(),
|
|
78
|
-
i: date.getMinutes(),
|
|
79
|
-
s: date.getSeconds(),
|
|
80
|
-
a: date.getDay(),
|
|
81
|
-
};
|
|
82
|
-
const timeStr = format.replace(/\{([ymdhisa])+\}/g, (result, key) => {
|
|
83
|
-
const value = formatObj[key];
|
|
84
|
-
// Note: getDay() returns 0 on Sunday
|
|
85
|
-
if (key === "a") {
|
|
86
|
-
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
|
87
|
-
}
|
|
88
|
-
if (!String.prototype.padStart) return padStart(2, value.toString());
|
|
89
|
-
return value.toString()
|
|
90
|
-
.padStart(2, "0"); // 返回替换的字符串,padStart用于头部补全
|
|
91
|
-
});
|
|
92
|
-
return timeStr;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* JS颜色十六进制转换为rgb或rgba,返回的格式为 rgba(255,255,255,0.5)字符串
|
|
97
|
-
* sHex为传入的十六进制的色值
|
|
98
|
-
* alpha为rgba的透明度
|
|
99
|
-
*/
|
|
100
|
-
export function colorRgba(sHex, alpha) {
|
|
101
|
-
// 十六进制颜色值的正则表达式
|
|
102
|
-
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
103
|
-
/* 16进制颜色转为RGB格式 */
|
|
104
|
-
let sColor = sHex.toLowerCase();
|
|
105
|
-
if (sColor && reg.test(sColor)) {
|
|
106
|
-
if (sColor.length === 4) {
|
|
107
|
-
var sColorNew = "#";
|
|
108
|
-
for (let i = 1; i < 4; i += 1) {
|
|
109
|
-
sColorNew += sColor.slice(i, i + 1)
|
|
110
|
-
.concat(sColor.slice(i, i + 1));
|
|
111
|
-
}
|
|
112
|
-
sColor = sColorNew;
|
|
113
|
-
}
|
|
114
|
-
// 处理六位的颜色值
|
|
115
|
-
const sColorChange = [];
|
|
116
|
-
for (let i = 1; i < 7; i += 2) {
|
|
117
|
-
sColorChange.push(parseInt(`0x${sColor.slice(i, i + 2)}`));
|
|
118
|
-
}
|
|
119
|
-
// return sColorChange.join(',')
|
|
120
|
-
return `rgba(${sColorChange.join(",")},${alpha})`;
|
|
121
|
-
}
|
|
122
|
-
return sColor;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* segment: 分段 7段
|
|
127
|
-
* tatalpercent: 百分比 100
|
|
128
|
-
* basevalue: 基础值 200
|
|
129
|
-
*/
|
|
130
|
-
export function produceDataSeriesEx(segment, tatal, basevalue) {
|
|
131
|
-
//需要产生segment个随机数,且segment个随机数之和等于tatal
|
|
132
|
-
let arrpercent = new Array(segment).fill(0);
|
|
133
|
-
for (let i = 0; i < tatal; i++) {
|
|
134
|
-
//parseInt接收string,所以需要转一趟
|
|
135
|
-
/**
|
|
136
|
-
* 换成生活中的场景,就是一百个苹果分给十个人,我们可以一个一个的取出,随机分给某个人,直到分完
|
|
137
|
-
* 在js里面,十个人即是一个长度为十的数组,每次数组随机一个位置加一,执行一百次
|
|
138
|
-
*/
|
|
139
|
-
var num = parseInt((Math.random() * segment).toString());
|
|
140
|
-
arrpercent[num]++;
|
|
141
|
-
}
|
|
142
|
-
//console.log(arr.length)
|
|
143
|
-
|
|
144
|
-
let arrvalue = new Array(segment).fill(0);
|
|
145
|
-
for (let i = 0; i < segment; i++) {
|
|
146
|
-
arrvalue[i] = parseInt(arrpercent[i] / 100 * basevalue);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return [arrpercent, arrvalue];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* 深拷贝
|
|
154
|
-
* obj为原始数据
|
|
155
|
-
* 适用场景:数组套对象、对象套数组、混合嵌套等
|
|
156
|
-
*/
|
|
157
|
-
export function deepClone(obj) {
|
|
158
|
-
if (obj === null || typeof obj !== 'object') {
|
|
159
|
-
return obj
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (obj instanceof Date) {
|
|
163
|
-
return new Date(obj.getTime())
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (obj instanceof Array) {
|
|
167
|
-
return obj.reduce((arr, item, i) => {
|
|
168
|
-
arr[i] = deepClone(item)
|
|
169
|
-
return arr
|
|
170
|
-
}, [])
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (obj instanceof Object) {
|
|
174
|
-
return Object.keys(obj).reduce((newObj, key) => {
|
|
175
|
-
newObj[key] = deepClone(obj[key])
|
|
176
|
-
return newObj
|
|
177
|
-
}, {})
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* 数据转换
|
|
183
|
-
* data为原始数据
|
|
184
|
-
* 适用场景:根据要求格式来转换当前属性值 (转化失败则初始化为默认格式
|
|
185
|
-
*/
|
|
186
|
-
export function transferData(data, format = 'String') {
|
|
187
|
-
|
|
188
|
-
const defaultData = {
|
|
189
|
-
Number: 0,
|
|
190
|
-
Boolean: false,
|
|
191
|
-
String: '',
|
|
192
|
-
Array: [],
|
|
193
|
-
Object: {}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (format === 'Array' || format === 'Object') {
|
|
197
|
-
|
|
198
|
-
let parsed
|
|
199
|
-
|
|
200
|
-
try {
|
|
201
|
-
parsed = JSON.parse(data)
|
|
202
|
-
} catch (error) { parsed = data }
|
|
203
|
-
|
|
204
|
-
if (parsed && ( parsed instanceof Array || parsed instanceof Object )) {
|
|
205
|
-
return parsed
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return defaultData[format]
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
return data ?? defaultData[format]
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* 查找字符串
|
|
218
|
-
* str为字符串
|
|
219
|
-
* charToFind为查找字符
|
|
220
|
-
* n为次数
|
|
221
|
-
* 适用场景:查找某个字符在字符串当中某一次的位置
|
|
222
|
-
*/
|
|
223
|
-
export function findNthOccurrence(str, charToFind, n) {
|
|
224
|
-
let count = 0;
|
|
225
|
-
let index = str.indexOf(charToFind);
|
|
226
|
-
|
|
227
|
-
while (count < n && index !== -1) {
|
|
228
|
-
index = str.indexOf(charToFind, index + 1);
|
|
229
|
-
count++;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return index === -1 ? -1 : index;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* object转化为formData
|
|
237
|
-
* @object 转化对象
|
|
238
|
-
*/
|
|
239
|
-
export function setFormData(object) {
|
|
240
|
-
|
|
241
|
-
const formData = new FormData()
|
|
242
|
-
|
|
243
|
-
for (const key in object) {
|
|
244
|
-
formData.append(key, object[key])
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return formData
|
|
248
|
-
|
|
249
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import notification from 'ant-design-vue/es/notification'
|
|
2
|
-
|
|
3
|
-
/* 抛出401错误码 用于处理不同项目下处理方式 */
|
|
4
|
-
export function errorMessage(status, { msg }, callBack = () => {}) {
|
|
5
|
-
/* 200为正常状态码 捕捉到直接返回 */
|
|
6
|
-
if(status === 200) return
|
|
7
|
-
if(status === 401) return callBack()
|
|
8
|
-
notification.error({
|
|
9
|
-
message: '请求失败!',
|
|
10
|
-
description: msg || '服务器请求失败'
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default {
|
|
15
|
-
errorMessage
|
|
16
|
-
}
|
package/plugins/utils/Postcss.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
module.exports.postcss = {
|
|
2
|
-
rootValue: 14, // 基准字体大小,通常是 16 或 37.5
|
|
3
|
-
propList: ['*'], // 需要转换的属性,* 表示全部属性都转换
|
|
4
|
-
unitPrecision: 5, // 允许 REM 单位增长到的十进制数
|
|
5
|
-
selectorBlackList: [], // 忽略转换的选择器
|
|
6
|
-
replace: true, // 替换包含 `px` 的规则,而不是添加替换后的副本
|
|
7
|
-
mediaQuery: false, // 不允许在媒体查询中转换 `px`
|
|
8
|
-
minPixelValue: 0 // 设置要替换的最小像素值
|
|
9
|
-
}
|
package/plugins/utils/Rem.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// /** 行内px转rem自定义指令 */
|
|
2
|
-
const handler = (el, binding) => {
|
|
3
|
-
/** 与postcss-pxtorem内rootValue配置一致 */
|
|
4
|
-
const rootValue = 14
|
|
5
|
-
|
|
6
|
-
const convert = (value) => {
|
|
7
|
-
if (typeof value === 'string' && value.includes('px')) {
|
|
8
|
-
return `${parseFloat(value) / rootValue}rem`
|
|
9
|
-
}
|
|
10
|
-
return value
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (binding.value) {
|
|
14
|
-
Object.entries(binding.value).forEach(([key, val]) => {
|
|
15
|
-
el.style[key] = convert(val)
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
inserted: handler,
|
|
22
|
-
update: handler,
|
|
23
|
-
componentUpdated: handler
|
|
24
|
-
}
|
package/plugins/utils/Request.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { createAxiosService } from './Axios.js'
|
|
2
|
-
|
|
3
|
-
const axiosPlugin = {
|
|
4
|
-
install(Vue, options) {
|
|
5
|
-
|
|
6
|
-
const service = createAxiosService({
|
|
7
|
-
baseURL: window.https.WEBSWG,
|
|
8
|
-
token: Vue.prototype.$store.getters.token,
|
|
9
|
-
...options
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
// 全局挂载
|
|
13
|
-
Vue.config.globalProperties.$http = service
|
|
14
|
-
|
|
15
|
-
// 提供独立的 API 方法
|
|
16
|
-
Vue.provide('axios', service)
|
|
17
|
-
|
|
18
|
-
// 添加自定义方法
|
|
19
|
-
service.uploadFile = (url, file, onProgress) => {
|
|
20
|
-
const formData = new FormData()
|
|
21
|
-
formData.append('file', file)
|
|
22
|
-
|
|
23
|
-
return service.post(url, formData, {
|
|
24
|
-
headers: { 'Content-Type': 'multipart/form-data' },
|
|
25
|
-
onUploadProgress: (progressEvent) => {
|
|
26
|
-
if (progressEvent.lengthComputable && onProgress) {
|
|
27
|
-
const percent = Math.round(
|
|
28
|
-
(progressEvent.loaded * 100) / progressEvent.total
|
|
29
|
-
)
|
|
30
|
-
onProgress(percent)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default axiosPlugin
|
package/plugins/utils/Storage.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import Cookies from 'js-cookie'
|
|
2
|
-
|
|
3
|
-
const local = {
|
|
4
|
-
|
|
5
|
-
set(key, value) {
|
|
6
|
-
localStorage.setItem(key, value)
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
setJson( key, value ){
|
|
10
|
-
localStorage.setItem(key, JSON.stringify( value ))
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
get( key ){
|
|
14
|
-
return localStorage.getItem(key)
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
getJson( key ){
|
|
18
|
-
|
|
19
|
-
const content = localStorage.getItem( key )
|
|
20
|
-
|
|
21
|
-
if( !content ) return null
|
|
22
|
-
|
|
23
|
-
return JSON.parse( content )
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
remove( key ){
|
|
27
|
-
localStorage.removeItem(key)
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
clear(){
|
|
31
|
-
localStorage.clear()
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const cookies = {
|
|
36
|
-
|
|
37
|
-
set(key, value) {
|
|
38
|
-
Cookies.set(key, value)
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
setJson( key, value ){
|
|
42
|
-
Cookies.set(key, JSON.stringify( value ))
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
get( key ){
|
|
46
|
-
return Cookies.get(key)
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
getJson( key ){
|
|
50
|
-
|
|
51
|
-
const content = Cookies.get( key )
|
|
52
|
-
|
|
53
|
-
if( !content ) return null
|
|
54
|
-
|
|
55
|
-
return JSON.parse( content )
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
remove( key ){
|
|
59
|
-
Cookies.remove(key)
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
clear(){
|
|
63
|
-
const cookies = Cookies.get()
|
|
64
|
-
for (const cookieName in cookies) {
|
|
65
|
-
if (cookies.hasOwnProperty(cookieName)) Cookies.remove(cookieName)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default {
|
|
71
|
-
local,
|
|
72
|
-
cookies
|
|
73
|
-
}
|
package/plugins/utils/Tree.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/** 默认TreeData字段 */
|
|
2
|
-
const defaultReplaceFields = {
|
|
3
|
-
key: 'id',
|
|
4
|
-
title: 'title',
|
|
5
|
-
children: 'children'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 提取树形结构中的键值集合
|
|
10
|
-
* @param {Array} nodes 树形数据
|
|
11
|
-
* @param {boolean} [parent=false] 是否只提取父节点
|
|
12
|
-
* @param {Object} [replaceFields={}] 字段映射配置
|
|
13
|
-
* @param {string} [replaceFields.children='children'] 子节点字段名
|
|
14
|
-
* @param {string} [replaceFields.key='id'] 键名字段名
|
|
15
|
-
* @returns {Array} 提取的键值数组
|
|
16
|
-
*/
|
|
17
|
-
export function getTreeKey(
|
|
18
|
-
nodes = [],
|
|
19
|
-
parent = false,
|
|
20
|
-
{ children = 'children', key = 'id' } = {}
|
|
21
|
-
) {
|
|
22
|
-
const keys = []
|
|
23
|
-
|
|
24
|
-
function traverse(node) {
|
|
25
|
-
const shouldCollect = !parent || node[children]?.length
|
|
26
|
-
if (shouldCollect) keys.push(node[key])
|
|
27
|
-
|
|
28
|
-
if (node[children]?.length) {
|
|
29
|
-
node[children].forEach(traverse)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
nodes.forEach(traverse)
|
|
34
|
-
return keys
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 根据树子节点ID过滤出最后一级child
|
|
40
|
-
* @param {array} dataSource 树形结构数据源
|
|
41
|
-
* @param {array} nodeIds 需要过滤的数据集
|
|
42
|
-
* @param {string} hasField 过滤包含属性(默认为children)
|
|
43
|
-
* @param {string} searchField 查找属性(默认为id)
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
export function findCheckNodes(dataSource, nodeIds, searchField = 'id', hasField = 'children') {
|
|
47
|
-
const nodeMap = new Map() // 用于去重的Map
|
|
48
|
-
|
|
49
|
-
function traverse(node) {
|
|
50
|
-
if (nodeIds.includes(node[searchField]) && !node.hasOwnProperty(hasField)) {
|
|
51
|
-
if (!nodeMap.has(node[searchField])) {
|
|
52
|
-
nodeMap.set(node[searchField], node)
|
|
53
|
-
}
|
|
54
|
-
return true
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
node[hasField]?.forEach(childNode => {
|
|
58
|
-
traverse(childNode)
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
return false
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
dataSource.forEach(rootNode => {
|
|
65
|
-
traverse(rootNode)
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return Array.from(nodeMap.values()) // 返回去重后的数组
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 拼接树节点指定字段为字符串
|
|
74
|
-
* @param {Array} nodes 树形数据
|
|
75
|
-
* @param {Array} fields 需要拼接的字段数组
|
|
76
|
-
* @param {string} replaceField 拼接后存储的字段名
|
|
77
|
-
* @param {string} childNode 子节点字段名
|
|
78
|
-
* @returns {Array} 处理后的树形数据
|
|
79
|
-
*/
|
|
80
|
-
export function joinTreeMessage(
|
|
81
|
-
nodes = [],
|
|
82
|
-
fields = [],
|
|
83
|
-
replaceField = 'message',
|
|
84
|
-
childNode = 'children'
|
|
85
|
-
) {
|
|
86
|
-
if (!Array.isArray(nodes) || !Array.isArray(fields)) return nodes
|
|
87
|
-
|
|
88
|
-
const processNode = (node) => {
|
|
89
|
-
node[replaceField] = fields
|
|
90
|
-
.filter(field => node[field])
|
|
91
|
-
.map(field => node[field])
|
|
92
|
-
.join(' ')
|
|
93
|
-
|
|
94
|
-
if (Array.isArray(node[childNode])) {
|
|
95
|
-
node[childNode].forEach(processNode)
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
nodes.forEach(processNode)
|
|
100
|
-
return nodes
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* 获取树节点对应数据
|
|
107
|
-
* @param {Array} tree 树形数据
|
|
108
|
-
* @param {string|number} key 目标节点Key
|
|
109
|
-
* @param {Object} [replaceFields={}] 字段映射配置
|
|
110
|
-
*/
|
|
111
|
-
export function filterTreeById(
|
|
112
|
-
tree,
|
|
113
|
-
key,
|
|
114
|
-
{ children = 'children', key: idKey = 'id' } = {}
|
|
115
|
-
) {
|
|
116
|
-
for (const node of tree) {
|
|
117
|
-
if (node[idKey] === key) return [node]
|
|
118
|
-
|
|
119
|
-
if (node[children]?.length) {
|
|
120
|
-
const result = filterTreeById(node[children], key, { children, key: idKey })
|
|
121
|
-
if (result.length) return result
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return []
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* 获取树节点所有父级路径
|
|
130
|
-
* @param {Array} tree 树形数据
|
|
131
|
-
* @param {string|number} nodeId 目标节点ID
|
|
132
|
-
* @param {Object} [replaceFields={}] 字段映射配置
|
|
133
|
-
* @param {boolean} [returnObjects=false] 是否返回完整对象
|
|
134
|
-
*/
|
|
135
|
-
export function getAllParents(tree, nodeId, { children = 'children', key = 'id' } = {}, returnObjects = false) {
|
|
136
|
-
if (!tree?.length) return []
|
|
137
|
-
|
|
138
|
-
// 创建节点映射表提升查找性能
|
|
139
|
-
const nodeMap = new Map()
|
|
140
|
-
const buildMap = (nodes, parentId) => {
|
|
141
|
-
nodes.forEach(node => {
|
|
142
|
-
// 使用WeakMap存储parentId避免污染原对象
|
|
143
|
-
const metaInfo = new WeakMap()
|
|
144
|
-
metaInfo.set(node, { parentId })
|
|
145
|
-
nodeMap.set(node[key], { node, metaInfo })
|
|
146
|
-
|
|
147
|
-
if (node[children]?.length) buildMap(node[children], node[key])
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
buildMap(tree)
|
|
151
|
-
|
|
152
|
-
// 回溯构建路径
|
|
153
|
-
const path = []
|
|
154
|
-
let current = nodeMap.get(nodeId)
|
|
155
|
-
while (current) {
|
|
156
|
-
if (returnObjects) {
|
|
157
|
-
// 直接返回原对象
|
|
158
|
-
path.unshift(current.node)
|
|
159
|
-
} else {
|
|
160
|
-
path.unshift(current.node[key])
|
|
161
|
-
}
|
|
162
|
-
current = current.metaInfo.get(current.node).parentId
|
|
163
|
-
? nodeMap.get(current.metaInfo.get(current.node).parentId)
|
|
164
|
-
: null
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// 对象集合则返回父级
|
|
168
|
-
return returnObjects ? path[0] : path
|
|
169
|
-
}
|
package/plugins/utils/Utils.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import message from 'ant-design-vue/es/message'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 下载文件
|
|
5
|
-
* response: 文档流
|
|
6
|
-
* name: 文件名称
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export function downLoadFn( response, name, type = "application/vnd.ms-excel" ) {
|
|
10
|
-
|
|
11
|
-
let reader = new FileReader()
|
|
12
|
-
|
|
13
|
-
reader.readAsText( response, "utf-8" )
|
|
14
|
-
|
|
15
|
-
reader.onload = function () {
|
|
16
|
-
try {
|
|
17
|
-
message.error( JSON.parse( reader.result ).msg )
|
|
18
|
-
} catch (err) {
|
|
19
|
-
message.success( "下载中..." )
|
|
20
|
-
let blob = new Blob( [ response ], { type } )
|
|
21
|
-
let url = window.URL.createObjectURL( blob )
|
|
22
|
-
const link = document.createElement( "a" )
|
|
23
|
-
link.href = url
|
|
24
|
-
link.download = name
|
|
25
|
-
link.click()
|
|
26
|
-
window.URL.revokeObjectURL( url )
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 获取图片宽高 (如超出限制高度,则根据高度比计算出对应的宽度比)
|
|
33
|
-
* url 图片地址
|
|
34
|
-
* astrictH 限制高度
|
|
35
|
-
*/
|
|
36
|
-
export function getPictureAttrs( url, astrictH ) {
|
|
37
|
-
let image = new Image()
|
|
38
|
-
image.src = url
|
|
39
|
-
function getPictureSize(image) {
|
|
40
|
-
/** 解决图片过大还处于加载中出现的第一次获取宽高为0的情况 */
|
|
41
|
-
if(image.width == 0) return setTimeout(() =>getPictureSize(image), 600)
|
|
42
|
-
return { width: image.width, height: image.height }
|
|
43
|
-
}
|
|
44
|
-
let style = getPictureSize(image)
|
|
45
|
-
if(style.height > astrictH) {
|
|
46
|
-
const scale = astrictH / style.height
|
|
47
|
-
style.width = style.width * scale
|
|
48
|
-
style.height = astrictH
|
|
49
|
-
}
|
|
50
|
-
return style
|
|
51
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export const verifyInteger = /^([1-9][0-9]*)$/; // 整数,不包含0开头
|
|
2
|
-
export const verifyFloat = /^[1-9]+(.[0-9]{2})?$/ // 保留两位小数的正数
|
|
3
|
-
export const verifyChinese = /^([\u4e00-\u9fa5]){1,10}$/; // 校验中文,长度1到10
|
|
4
|
-
export const verifyBlank = /^\s*$/; // 校验空格
|
|
5
|
-
export const verifyEnglishName = /^[a-zA-Z][a-zA-Z0-9_]*$/; // 检验英文字母开头,且限制输入 英文 + 数字
|
|
6
|
-
export const verifyChineseAndEng = /^[a-zA-Z0-9_\u4e00-\u9fa5]+$/; // 检验汉字、数字、字母、下划线,下划线位置不限
|
|
7
|
-
export const verifyPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()]).{8,}$/; // 检验密码(由数字、大小写字母、特殊符号组成的8位数密码)
|
|
8
|
-
export const phoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/; //手机号
|
|
9
|
-
export const telephone = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/; //固定电话与手机号
|
|
10
|
-
export const verifyEmail = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; //检验邮箱
|
|
11
|
-
export const verifyIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; //身份证号码 15位或18位
|
|
12
|
-
export const verifyCDN = /^\/\/at\.alicdn\.com\/t\/[cf]\/font_\d+_[a-z0-9]+\.js$/; //校验阿里云CDN链接格式
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 校验域名或IP地址
|
|
16
|
-
* @param {string} url 待校验字符串
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
19
|
-
export function verifyIPStr(url) {
|
|
20
|
-
const domainReg = /^https:\/\/[a-z0-9.-]+\.[a-z]{2,}(?:\/[^\s]*)?$/i;
|
|
21
|
-
const ipv4Reg = /^http:\/\/((25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3})(:\d{1,5})?(\/.*)?$/;
|
|
22
|
-
const ipv6Reg = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/;
|
|
23
|
-
|
|
24
|
-
if (domainReg.test(url) || ipv4Reg.test(url) || ipv6Reg.test(url)) return true
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** 截取字符串中的ip及端口 */
|
|
29
|
-
export function extractIPAndPort(str) {
|
|
30
|
-
const ipPortRegex = /(\b25[0-5]|\b2[0-4]\d|\b[01]?\d\d?)\.(\b25[0-5]|\b2[0-4]\d|\b[01]?\d\d?)\.(\b25[0-5]|\b2[0-4]\d|\b[01]?\d\d?)\.(\b25[0-5]|\b2[0-4]\d|\b[01]?\d\d?):(\b6553[0-5]|\b655[0-2]\d|\b65[0-4]\d\d|\b6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{1,3}|[1-9])\b/g;
|
|
31
|
-
const matches = str.match(ipPortRegex)
|
|
32
|
-
return matches && matches.length > 1 ? matches.map(match => match.trim()) : (matches?.[0] ?? [])
|
|
33
|
-
}
|