widget.qw 1.0.80 → 1.0.82
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 +9 -9
- package/.env.production +8 -8
- package/README.md +75 -75
- package/build/style.css +471 -471
- package/build/widget.qw.es.js +56 -56
- package/build/widget.qw.umd.js +56 -56
- 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 +371 -371
- package/src/components/CheckGroup.vue +113 -113
- package/src/components/DatetimePicker/DatetimePop.vue +342 -342
- package/src/components/DatetimePicker/index.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 +162 -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/widget/TreePop.vue +88 -88
- package/src/components/widget/UserPop.vue +347 -347
- package/src/env.d.ts +8 -8
- package/src/main.js +117 -117
- package/src/router/index.ts +173 -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/cascaderpop/index.vue +90 -90
- package/src/views/checkgroup/index.vue +35 -35
- package/src/views/dataSelector/index.vue +48 -48
- 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/imagepicker/index.vue +31 -31
- package/src/views/imagespicker/index.vue +37 -31
- 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/tsconfig.json +19 -19
- package/tsconfig.node.json +8 -8
- package/vite.config.ts +122 -122
package/src/util/toast_util.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { showSuccessToast, showFailToast, showLoadingToast, closeToast,setToastDefaultOptions } from 'vant';
|
|
2
|
-
|
|
3
|
-
setToastDefaultOptions({ duration: 5000 })
|
|
4
|
-
|
|
5
|
-
export function warnToast(msg) {
|
|
6
|
-
showFailToast(msg)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function successToast(msg) {
|
|
10
|
-
showSuccessToast(msg)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function showLoading() {
|
|
14
|
-
showLoadingToast({
|
|
15
|
-
message: '加载中...',
|
|
16
|
-
// 禁止背景点击
|
|
17
|
-
forbidClick: true,
|
|
18
|
-
// 一直转圈
|
|
19
|
-
duration:0
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function hideLoading(){
|
|
24
|
-
closeToast()
|
|
1
|
+
import { showSuccessToast, showFailToast, showLoadingToast, closeToast,setToastDefaultOptions } from 'vant';
|
|
2
|
+
|
|
3
|
+
setToastDefaultOptions({ duration: 5000 })
|
|
4
|
+
|
|
5
|
+
export function warnToast(msg) {
|
|
6
|
+
showFailToast(msg)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function successToast(msg) {
|
|
10
|
+
showSuccessToast(msg)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function showLoading() {
|
|
14
|
+
showLoadingToast({
|
|
15
|
+
message: '加载中...',
|
|
16
|
+
// 禁止背景点击
|
|
17
|
+
forbidClick: true,
|
|
18
|
+
// 一直转圈
|
|
19
|
+
duration:0
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function hideLoading(){
|
|
24
|
+
closeToast()
|
|
25
25
|
}
|
package/src/util/tree_util.js
CHANGED
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
// 递归查找叶子节点及父节点
|
|
2
|
-
// 返回存入res数组
|
|
3
|
-
export const findNodes = (id, nodes, res) => {
|
|
4
|
-
if (!nodes || !id) {
|
|
5
|
-
return false
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
-
let node = nodes[i]
|
|
10
|
-
res.push(node)
|
|
11
|
-
|
|
12
|
-
if (node.id == id) {
|
|
13
|
-
return true
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (node.children) {
|
|
17
|
-
let result = findNodes(id, node.children, res)
|
|
18
|
-
if (result) {
|
|
19
|
-
return true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
res.pop()
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 查找节点
|
|
28
|
-
export const findNode = (id, nodes) => {
|
|
29
|
-
if (!nodes || !id) {
|
|
30
|
-
return null
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let res = []
|
|
35
|
-
findNodes(id, nodes, res)
|
|
36
|
-
|
|
37
|
-
if (res.length < 1) {
|
|
38
|
-
return null
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return res[res.length - 1]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 查找节点路径列表
|
|
45
|
-
// 返回:[父,子,孙]
|
|
46
|
-
export const findPaths =(targetId, nodes, path = [])=> {
|
|
47
|
-
if (!nodes || nodes.length < 1 || !targetId)
|
|
48
|
-
return []
|
|
49
|
-
|
|
50
|
-
for (const node of nodes) {
|
|
51
|
-
if (node.id === targetId) {
|
|
52
|
-
return [...path, node];
|
|
53
|
-
}
|
|
54
|
-
if (node.children?.length) {
|
|
55
|
-
const founds = findPaths(targetId, node.children, [...path, node]);
|
|
56
|
-
if (founds && founds.length > 0) return founds;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return []
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//查找父节点
|
|
64
|
-
export const findParent = (id, nodes) => {
|
|
65
|
-
if (!nodes || !id) {
|
|
66
|
-
return null
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
let paths = findPaths(id, nodes)
|
|
70
|
-
|
|
71
|
-
if (!paths || paths.length < 2) {
|
|
72
|
-
return null
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return paths[paths.length-2]
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// id列表转为节点对象列表
|
|
79
|
-
export const ids2nodes=(ids,totalNodes)=>{
|
|
80
|
-
if(!totalNodes || totalNodes.length<1 || !ids || ids.length<1)
|
|
81
|
-
return []
|
|
82
|
-
|
|
83
|
-
let res = []
|
|
84
|
-
for(var i=0;i<ids.length;i++){
|
|
85
|
-
let node = findNode(ids[i], totalNodes)
|
|
86
|
-
res.push(node)
|
|
87
|
-
}
|
|
88
|
-
return res
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// 将找到的父子节点数组拼装为树
|
|
92
|
-
export const concatNodes = (nodes) => {
|
|
93
|
-
let res = null
|
|
94
|
-
|
|
95
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
96
|
-
let node = nodes[nodes.length - i - 1]
|
|
97
|
-
|
|
98
|
-
res = {
|
|
99
|
-
text: node.text,
|
|
100
|
-
id: node.id,
|
|
101
|
-
children: res ? [res] : null
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return res
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 递归格式化树结构数据为picker组件数据
|
|
109
|
-
export const data2columns = (nodes) => {
|
|
110
|
-
if (!nodes) {
|
|
111
|
-
return []
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return nodes.map(e => {
|
|
115
|
-
return {
|
|
116
|
-
text: e.text,
|
|
117
|
-
id: e.id,
|
|
118
|
-
children: e.children ? data2columns(e.children) : null
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// 树中是否存在值
|
|
124
|
-
export const isFindNode = (id, nodes)=>{
|
|
125
|
-
let res = []
|
|
126
|
-
findNodes(id, nodes, res)
|
|
127
|
-
return res.length > 0
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// 判断child_id是否等于或属于parent_id
|
|
131
|
-
// nodes:树数据
|
|
132
|
-
export const isChildNode = (child_id, parent_id, nodes)=>{
|
|
133
|
-
if(child_id == parent_id){
|
|
134
|
-
return true
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
let ns = []
|
|
138
|
-
findNodes(child_id, nodes, ns)
|
|
139
|
-
|
|
140
|
-
let one = ns.filter(e=>{
|
|
141
|
-
return e.id == parent_id
|
|
142
|
-
})
|
|
143
|
-
return one.length > 0
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// 判断child_ids是否属于parent_ids中的任意一个
|
|
147
|
-
// nodes:树数据
|
|
148
|
-
export const isExistChildNode = (child_id, parent_ids, nodes)=>{
|
|
149
|
-
let list = parent_ids.filter(e=>{
|
|
150
|
-
return isChildNode(child_id, e, nodes)
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
return list.length > 0
|
|
1
|
+
// 递归查找叶子节点及父节点
|
|
2
|
+
// 返回存入res数组
|
|
3
|
+
export const findNodes = (id, nodes, res) => {
|
|
4
|
+
if (!nodes || !id) {
|
|
5
|
+
return false
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
9
|
+
let node = nodes[i]
|
|
10
|
+
res.push(node)
|
|
11
|
+
|
|
12
|
+
if (node.id == id) {
|
|
13
|
+
return true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (node.children) {
|
|
17
|
+
let result = findNodes(id, node.children, res)
|
|
18
|
+
if (result) {
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
res.pop()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 查找节点
|
|
28
|
+
export const findNode = (id, nodes) => {
|
|
29
|
+
if (!nodes || !id) {
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
let res = []
|
|
35
|
+
findNodes(id, nodes, res)
|
|
36
|
+
|
|
37
|
+
if (res.length < 1) {
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return res[res.length - 1]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 查找节点路径列表
|
|
45
|
+
// 返回:[父,子,孙]
|
|
46
|
+
export const findPaths =(targetId, nodes, path = [])=> {
|
|
47
|
+
if (!nodes || nodes.length < 1 || !targetId)
|
|
48
|
+
return []
|
|
49
|
+
|
|
50
|
+
for (const node of nodes) {
|
|
51
|
+
if (node.id === targetId) {
|
|
52
|
+
return [...path, node];
|
|
53
|
+
}
|
|
54
|
+
if (node.children?.length) {
|
|
55
|
+
const founds = findPaths(targetId, node.children, [...path, node]);
|
|
56
|
+
if (founds && founds.length > 0) return founds;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return []
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//查找父节点
|
|
64
|
+
export const findParent = (id, nodes) => {
|
|
65
|
+
if (!nodes || !id) {
|
|
66
|
+
return null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let paths = findPaths(id, nodes)
|
|
70
|
+
|
|
71
|
+
if (!paths || paths.length < 2) {
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return paths[paths.length-2]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// id列表转为节点对象列表
|
|
79
|
+
export const ids2nodes=(ids,totalNodes)=>{
|
|
80
|
+
if(!totalNodes || totalNodes.length<1 || !ids || ids.length<1)
|
|
81
|
+
return []
|
|
82
|
+
|
|
83
|
+
let res = []
|
|
84
|
+
for(var i=0;i<ids.length;i++){
|
|
85
|
+
let node = findNode(ids[i], totalNodes)
|
|
86
|
+
res.push(node)
|
|
87
|
+
}
|
|
88
|
+
return res
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// 将找到的父子节点数组拼装为树
|
|
92
|
+
export const concatNodes = (nodes) => {
|
|
93
|
+
let res = null
|
|
94
|
+
|
|
95
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
96
|
+
let node = nodes[nodes.length - i - 1]
|
|
97
|
+
|
|
98
|
+
res = {
|
|
99
|
+
text: node.text,
|
|
100
|
+
id: node.id,
|
|
101
|
+
children: res ? [res] : null
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return res
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// 递归格式化树结构数据为picker组件数据
|
|
109
|
+
export const data2columns = (nodes) => {
|
|
110
|
+
if (!nodes) {
|
|
111
|
+
return []
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return nodes.map(e => {
|
|
115
|
+
return {
|
|
116
|
+
text: e.text,
|
|
117
|
+
id: e.id,
|
|
118
|
+
children: e.children ? data2columns(e.children) : null
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// 树中是否存在值
|
|
124
|
+
export const isFindNode = (id, nodes)=>{
|
|
125
|
+
let res = []
|
|
126
|
+
findNodes(id, nodes, res)
|
|
127
|
+
return res.length > 0
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 判断child_id是否等于或属于parent_id
|
|
131
|
+
// nodes:树数据
|
|
132
|
+
export const isChildNode = (child_id, parent_id, nodes)=>{
|
|
133
|
+
if(child_id == parent_id){
|
|
134
|
+
return true
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
let ns = []
|
|
138
|
+
findNodes(child_id, nodes, ns)
|
|
139
|
+
|
|
140
|
+
let one = ns.filter(e=>{
|
|
141
|
+
return e.id == parent_id
|
|
142
|
+
})
|
|
143
|
+
return one.length > 0
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 判断child_ids是否属于parent_ids中的任意一个
|
|
147
|
+
// nodes:树数据
|
|
148
|
+
export const isExistChildNode = (child_id, parent_ids, nodes)=>{
|
|
149
|
+
let list = parent_ids.filter(e=>{
|
|
150
|
+
return isChildNode(child_id, e, nodes)
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
return list.length > 0
|
|
154
154
|
}
|
package/src/util/uuid_util.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function uuid8() {
|
|
2
|
-
// 获取当前时间戳的后 8 位十六进制
|
|
3
|
-
let hex = Date.now().toString(16).slice(-8);
|
|
4
|
-
// 如果不足 8 位则补全
|
|
5
|
-
if (hex.length < 8) {
|
|
6
|
-
hex = '0'.repeat(8 - hex.length) + hex;
|
|
7
|
-
}
|
|
8
|
-
return hex;
|
|
9
|
-
}
|
|
1
|
+
export function uuid8() {
|
|
2
|
+
// 获取当前时间戳的后 8 位十六进制
|
|
3
|
+
let hex = Date.now().toString(16).slice(-8);
|
|
4
|
+
// 如果不足 8 位则补全
|
|
5
|
+
if (hex.length < 8) {
|
|
6
|
+
hex = '0'.repeat(8 - hex.length) + hex;
|
|
7
|
+
}
|
|
8
|
+
return hex;
|
|
9
|
+
}
|