@netang/quasar 0.0.53 → 0.0.55
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/_docs/docs/.vuepress/client.js +39 -0
- package/_docs/docs/.vuepress/components/test.vue +23 -0
- package/_docs/docs/.vuepress/config.js +40 -0
- package/_docs/docs/.vuepress/configs/index.js +2 -0
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
- package/_docs/docs/.vuepress/public/css/index.css +3 -0
- package/_docs/docs/.vuepress/styles/index.scss +3 -0
- package/_docs/docs/components/field-table.md +63 -0
- package/_docs/docs/components/field-tree.md +1 -0
- package/{docs → _docs}/docs/index.md +0 -0
- package/{docs → _docs}/docs/utils/alert.md +0 -0
- package/{docs → _docs}/docs/utils/confirm.md +0 -0
- package/_docs/docs/utils/index.md +1 -0
- package/_docs/package.json +17 -0
- package/components/column-title/index.vue +2 -2
- package/components/data/index.vue +20 -23
- package/components/dialog/index.vue +26 -12
- package/components/dialog-table/index.vue +4 -2
- package/components/dragger/index.vue +3 -2
- package/components/drawer/index.vue +16 -9
- package/components/editor-code/index.vue +12 -5
- package/components/empty/index.vue +16 -1
- package/components/field-date/index.vue +48 -36
- package/components/field-table/index.vue +69 -43
- package/components/field-text/index.vue +6 -2
- package/components/field-tree/index.vue +40 -22
- package/components/input-number/index.vue +5 -4
- package/components/list-menu/index.vue +14 -2
- package/components/power-page/index.vue +10 -0
- package/components/private/components/index.js +7 -2
- package/components/private/components/move-to-tree/index.vue +7 -3
- package/components/private/edit-power-data/index.vue +92 -52
- package/components/private/table-visible-columns-button/index.vue +6 -2
- package/components/render/index.vue +21 -7
- package/components/search/index.vue +30 -2
- package/components/search-item/index.vue +24 -8
- package/components/select/index.vue +5 -2
- package/components/splitter/index.vue +13 -9
- package/components/table/index.vue +32 -5
- package/components/table-pagination/index.vue +0 -1
- package/components/table-splitter/index.vue +22 -3
- package/components/table-summary/index.vue +10 -3
- package/components/thumbnail/index.vue +16 -6
- package/components/toolbar/index.vue +0 -2
- package/components/uploader/index.vue +5 -2
- package/components/uploader-query/index.vue +48 -27
- package/components/value-format/index.vue +19 -12
- package/configs/area3.js +1 -0
- package/docs/404.html +33 -0
- package/docs/assets/404.html-60b35caa.js +1 -0
- package/docs/assets/404.html-d1e63d77.js +1 -0
- package/docs/assets/alert.html-568d4e94.js +1 -0
- package/docs/assets/alert.html-f5dbc3e9.js +1 -0
- package/docs/assets/app-8c3ae4de.js +6 -0
- package/docs/assets/back-to-top-8efcbe56.svg +1 -0
- package/docs/assets/confirm.html-7a1566f6.js +1 -0
- package/docs/assets/confirm.html-96f1b004.js +1 -0
- package/docs/assets/field-table.html-68d610b0.js +1 -0
- package/docs/assets/field-table.html-86cc3511.js +1 -0
- package/docs/assets/field-tree.html-45410c3c.js +1 -0
- package/docs/assets/field-tree.html-c98ac993.js +1 -0
- package/docs/assets/framework-204010b2.js +5 -0
- package/docs/assets/index.html-1695dd7c.js +1 -0
- package/docs/assets/index.html-65a4aa67.js +1 -0
- package/docs/assets/style-ac5a9aa6.css +1 -0
- package/docs/components/field-table.html +33 -0
- package/docs/components/field-tree.html +33 -0
- package/docs/index.html +33 -0
- package/docs/utils/alert.html +33 -0
- package/docs/utils/confirm.html +33 -0
- package/package.json +1 -1
- package/package2.json +30 -0
- package/store/index.js +3 -20
- package/utils/alert.js +3 -1
- package/utils/area.js +27 -14
- package/utils/arr.js +6 -2
- package/utils/auth.js +40 -35
- package/utils/bus.js +1 -1
- package/utils/config.js +42 -15
- package/utils/{confrim.js → confirm.js} +1 -1
- package/utils/copy.js +18 -0
- package/utils/dialog.js +7 -3
- package/utils/dict.js +5 -28
- package/utils/dictOptions.js +24 -0
- package/utils/form.js +6 -2
- package/utils/getData.js +21 -9
- package/utils/getFile.js +11 -5
- package/utils/getImage.js +23 -12
- package/utils/getTime.js +9 -4
- package/utils/index.js +61 -0
- package/utils/loading.js +3 -1
- package/utils/notify.js +1 -1
- package/utils/power.js +164 -118
- package/utils/previewImage.js +4 -2
- package/utils/price.js +12 -3
- package/utils/rule.js +5 -9
- package/utils/ruleValid.js +10 -0
- package/utils/search.js +81 -50
- package/utils/table.js +119 -87
- package/utils/timestamp.js +2 -2
- package/utils/toast.js +1 -1
- package/utils/tree.js +69 -46
- package/utils/uploader/qiniu.js +31 -15
- package/utils/uploader.js +87 -56
- package/utils/useAuth.js +12 -5
- package/utils/useRouter.js +16 -5
- package/utils/useUploader.js +0 -5
- package/docs/docs/.vuepress/config.js +0 -32
- package/docs/docs/components/field-table.md +0 -1
- package/docs/docs/components/field-tree.md +0 -1
- package/docs/package.json +0 -11
- package/utils/http.js +0 -251
package/store/index.js
CHANGED
|
@@ -19,28 +19,11 @@ export const statePower = ref({
|
|
|
19
19
|
menus: [],
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
// 角色数据
|
|
23
|
-
export const stateRole = ref({
|
|
24
|
-
// 角色权限版本
|
|
25
|
-
v: null,
|
|
26
|
-
// all id
|
|
27
|
-
all: {},
|
|
28
|
-
// 页面
|
|
29
|
-
urls: {},
|
|
30
|
-
// 按钮
|
|
31
|
-
btns: {},
|
|
32
|
-
// 菜单
|
|
33
|
-
menus: [],
|
|
34
|
-
})
|
|
35
|
-
|
|
36
22
|
// 时间差
|
|
37
23
|
export const stateTimeDiff = ref(0)
|
|
38
24
|
|
|
39
|
-
// loading
|
|
40
|
-
export const stateLoading = ref(false)
|
|
41
|
-
|
|
42
25
|
// 网络是否在线
|
|
43
|
-
export const stateOnLine = ref(navigator.onLine)
|
|
26
|
+
// export const stateOnLine = ref(navigator.onLine)
|
|
44
27
|
|
|
45
|
-
//
|
|
46
|
-
export const
|
|
28
|
+
// 用户信息状态
|
|
29
|
+
export const stateUserInfo = ref(initAuthStore())
|
package/utils/alert.js
CHANGED
package/utils/area.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
2
|
+
import $n_get from 'lodash/get'
|
|
3
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
4
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
5
|
+
import $n_toTree from '@netang/utils/toTree'
|
|
6
|
+
import $n_trimString from '@netang/utils/trimString'
|
|
7
|
+
import $n_replaceAll from '@netang/utils/replaceAll'
|
|
8
|
+
|
|
1
9
|
// 地址数据缓存
|
|
2
10
|
let _areaData = null
|
|
3
11
|
|
|
@@ -5,7 +13,7 @@ let _areaData = null
|
|
|
5
13
|
* 获取数据
|
|
6
14
|
*/
|
|
7
15
|
function getData(level = 3, params) {
|
|
8
|
-
return _getData(() => import('
|
|
16
|
+
return _getData(() => import('../configs/area3'), level, params)
|
|
9
17
|
}
|
|
10
18
|
function _getData(areaData, level, params) {
|
|
11
19
|
return new Promise(function(resolve) {
|
|
@@ -19,14 +27,14 @@ function _getData(areaData, level, params) {
|
|
|
19
27
|
}, params)
|
|
20
28
|
|
|
21
29
|
// 克隆树数据
|
|
22
|
-
const treeData = $
|
|
30
|
+
const treeData = $n_cloneDeep(_areaData)
|
|
23
31
|
const all = {}
|
|
24
32
|
const rows = []
|
|
25
33
|
|
|
26
34
|
// 是否有忽略省市区 id
|
|
27
|
-
const isIgnore = $
|
|
35
|
+
const isIgnore = $n_isValidArray(para.ignore)
|
|
28
36
|
function checkIgnore(id) {
|
|
29
|
-
return isIgnore && $
|
|
37
|
+
return isIgnore && $n_indexOf(para.ignore, id) > -1
|
|
30
38
|
}
|
|
31
39
|
|
|
32
40
|
// 省
|
|
@@ -45,7 +53,7 @@ function _getData(areaData, level, params) {
|
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
// 市
|
|
48
|
-
if (level > 1 && $
|
|
56
|
+
if (level > 1 && $n_isValidArray(item1[2])) {
|
|
49
57
|
|
|
50
58
|
for (let index2 = 0, len2 = item1[2].length; index2 < len2; index2++) {
|
|
51
59
|
const item2 = item1[2][index2]
|
|
@@ -64,7 +72,7 @@ function _getData(areaData, level, params) {
|
|
|
64
72
|
item1[2][index2] = all[item2[1]]
|
|
65
73
|
|
|
66
74
|
// 区
|
|
67
|
-
if (level > 2 && $
|
|
75
|
+
if (level > 2 && $n_isValidArray(item2[2])) {
|
|
68
76
|
for (let index3 = 0, len3 = item2[2].length; index3 < len3; index3++) {
|
|
69
77
|
const item3 = item2[2][index3]
|
|
70
78
|
|
|
@@ -90,7 +98,7 @@ function _getData(areaData, level, params) {
|
|
|
90
98
|
rows.push(all[key])
|
|
91
99
|
}
|
|
92
100
|
|
|
93
|
-
resolve($
|
|
101
|
+
resolve($n_toTree({
|
|
94
102
|
data: rows,
|
|
95
103
|
}))
|
|
96
104
|
}
|
|
@@ -112,7 +120,7 @@ function _getData(areaData, level, params) {
|
|
|
112
120
|
* 替换地址
|
|
113
121
|
*/
|
|
114
122
|
function replaceArea(val) {
|
|
115
|
-
val = $
|
|
123
|
+
val = $n_trimString(val)
|
|
116
124
|
return val.replace(/直辖市/g, '')
|
|
117
125
|
.replace(/市/g, '')
|
|
118
126
|
.replace(/区/g, '')
|
|
@@ -166,7 +174,7 @@ async function getInfo(params) {
|
|
|
166
174
|
const { attrs, nodes, tree } = areaData
|
|
167
175
|
|
|
168
176
|
// 先通过地区编码来查找
|
|
169
|
-
let data = $
|
|
177
|
+
let data = $n_get(nodes, code)
|
|
170
178
|
|
|
171
179
|
// 如果没有找到, 则通过文字来查找
|
|
172
180
|
if (! data) {
|
|
@@ -184,19 +192,19 @@ async function getInfo(params) {
|
|
|
184
192
|
children: children1,
|
|
185
193
|
} = item1
|
|
186
194
|
|
|
187
|
-
const _text1 = $
|
|
195
|
+
const _text1 = $n_replaceAll(text1, '省', '')
|
|
188
196
|
|
|
189
197
|
if (
|
|
190
198
|
isAreaText ?
|
|
191
199
|
(
|
|
192
200
|
provinceText === text1
|
|
193
|
-
|| $
|
|
201
|
+
|| $n_replaceAll(provinceText, '省', '') === _text1
|
|
194
202
|
)
|
|
195
203
|
: regionText.indexOf(_text1) > -1
|
|
196
204
|
) {
|
|
197
205
|
|
|
198
206
|
// 获取市 start --------------------------------------------------
|
|
199
|
-
if ($
|
|
207
|
+
if ($n_isValidArray(children1)) {
|
|
200
208
|
|
|
201
209
|
for (const item2 of children1) {
|
|
202
210
|
|
|
@@ -216,7 +224,7 @@ async function getInfo(params) {
|
|
|
216
224
|
: regionText.indexOf(_text2) > -1
|
|
217
225
|
) {
|
|
218
226
|
// 获取区 start --------------------------------------------------
|
|
219
|
-
if ($
|
|
227
|
+
if ($n_isValidArray(children2)) {
|
|
220
228
|
|
|
221
229
|
if (areaText || regionText) {
|
|
222
230
|
|
|
@@ -379,9 +387,14 @@ async function getInfo(params) {
|
|
|
379
387
|
return res
|
|
380
388
|
}
|
|
381
389
|
|
|
382
|
-
|
|
390
|
+
/**
|
|
391
|
+
* 地区
|
|
392
|
+
*/
|
|
393
|
+
const area = {
|
|
383
394
|
// 获取数据
|
|
384
395
|
getData,
|
|
385
396
|
// 获取详情
|
|
386
397
|
getInfo,
|
|
387
398
|
}
|
|
399
|
+
|
|
400
|
+
export default area
|
package/utils/arr.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* 操作数组
|
|
3
5
|
*/
|
|
4
|
-
|
|
6
|
+
const arr = {
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* 增加
|
|
8
10
|
*/
|
|
9
11
|
add(children, index, newItem) {
|
|
10
12
|
if (Array.isArray(children)) {
|
|
11
|
-
children.splice(index + 1, 0, $
|
|
13
|
+
children.splice(index + 1, 0, $n_isFunction(newItem) ? newItem() : newItem)
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
|
|
@@ -45,3 +47,5 @@ $n.arr = {
|
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
49
|
}
|
|
50
|
+
|
|
51
|
+
export default arr
|
package/utils/auth.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $n_router from '@netang/vue-utils/router'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
4
|
+
import $n_cookie from '@netang/utils/cookie'
|
|
5
|
+
|
|
6
|
+
import { stateUserInfo } from '../store'
|
|
7
|
+
import { checkUserInfo } from './useAuth'
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* 是否登录
|
|
8
11
|
*/
|
|
9
12
|
function isLogin() {
|
|
10
|
-
return
|
|
13
|
+
return stateUserInfo.value.isLogin
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -21,37 +24,37 @@ function updateLogin(res) {
|
|
|
21
24
|
i,
|
|
22
25
|
// 鉴权认证
|
|
23
26
|
t,
|
|
24
|
-
//
|
|
25
|
-
|
|
27
|
+
// 用户基础信息
|
|
28
|
+
user_info,
|
|
26
29
|
} = res
|
|
27
30
|
|
|
28
|
-
//
|
|
29
|
-
return
|
|
31
|
+
// 更新用户信息
|
|
32
|
+
return _updateUserInfo({
|
|
30
33
|
id: i,
|
|
31
34
|
token: t,
|
|
32
|
-
info: $
|
|
35
|
+
info: $n_isValidObject(user_info) ? user_info : {},
|
|
33
36
|
})
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
|
-
*
|
|
40
|
+
* 更新用户信息
|
|
38
41
|
*/
|
|
39
|
-
function
|
|
40
|
-
return
|
|
42
|
+
function updateUserInfo(res) {
|
|
43
|
+
return _updateUserInfo(Object.assign(
|
|
41
44
|
{},
|
|
42
|
-
|
|
45
|
+
stateUserInfo.value,
|
|
43
46
|
res,
|
|
44
47
|
))
|
|
45
48
|
}
|
|
46
|
-
function
|
|
49
|
+
function _updateUserInfo(res) {
|
|
47
50
|
|
|
48
|
-
//
|
|
49
|
-
if (!
|
|
51
|
+
// 验证用户信息
|
|
52
|
+
if (! checkUserInfo(res)) {
|
|
50
53
|
|
|
51
54
|
// 【调试模式】
|
|
52
55
|
// --------------------------------------------------
|
|
53
56
|
// #ifdef IS_DEBUG
|
|
54
|
-
console.error('【验证错误
|
|
57
|
+
console.error('【验证错误 _updateUserInfo】', res)
|
|
55
58
|
// #endif
|
|
56
59
|
// --------------------------------------------------
|
|
57
60
|
|
|
@@ -61,38 +64,38 @@ function _updateAdminUserInfo(res) {
|
|
|
61
64
|
// 设置已登录
|
|
62
65
|
res.isLogin = true
|
|
63
66
|
|
|
64
|
-
if (! $
|
|
67
|
+
if (! $n_isValidObject(res.info)) {
|
|
65
68
|
res.info = {}
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
// 保存缓存(永久缓存)
|
|
69
|
-
$
|
|
72
|
+
$n_cookie.set('_tk', res, 0)
|
|
70
73
|
|
|
71
|
-
//
|
|
72
|
-
|
|
74
|
+
// 设置用户信息状态
|
|
75
|
+
stateUserInfo.value = res
|
|
73
76
|
|
|
74
77
|
return true
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
/**
|
|
78
|
-
*
|
|
81
|
+
* 获取用户信息
|
|
79
82
|
*/
|
|
80
|
-
function
|
|
81
|
-
return
|
|
83
|
+
function getUserInfo() {
|
|
84
|
+
return stateUserInfo.value
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
/**
|
|
85
|
-
*
|
|
88
|
+
* 获取用户 id
|
|
86
89
|
*/
|
|
87
90
|
function getAdminUserId() {
|
|
88
|
-
return isLogin() ?
|
|
91
|
+
return isLogin() ? stateUserInfo.value.id : 0
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
/**
|
|
92
95
|
* 跳转登录页面
|
|
93
96
|
*/
|
|
94
97
|
function pushLogin(query) {
|
|
95
|
-
$
|
|
98
|
+
$n_router.push({
|
|
96
99
|
path: 'login',
|
|
97
100
|
query,
|
|
98
101
|
})
|
|
@@ -104,10 +107,10 @@ function pushLogin(query) {
|
|
|
104
107
|
function logout() {
|
|
105
108
|
|
|
106
109
|
// 删除管理员信息
|
|
107
|
-
$
|
|
110
|
+
$n_cookie.delete('_tk')
|
|
108
111
|
|
|
109
|
-
//
|
|
110
|
-
|
|
112
|
+
// 清空用户信息状态
|
|
113
|
+
stateUserInfo.value = {
|
|
111
114
|
id: 0,
|
|
112
115
|
isLogin: false,
|
|
113
116
|
info: {},
|
|
@@ -117,15 +120,15 @@ function logout() {
|
|
|
117
120
|
/**
|
|
118
121
|
* 鉴权业务
|
|
119
122
|
*/
|
|
120
|
-
|
|
123
|
+
const auth = {
|
|
121
124
|
// 是否登录
|
|
122
125
|
isLogin,
|
|
123
126
|
// 登录后更新数据
|
|
124
127
|
updateLogin,
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
//
|
|
128
|
-
|
|
128
|
+
// 更新用户信息
|
|
129
|
+
updateUserInfo,
|
|
130
|
+
// 获取用户信息
|
|
131
|
+
getUserInfo,
|
|
129
132
|
// 获取管理员 id
|
|
130
133
|
getAdminUserId,
|
|
131
134
|
// 跳转登录页面
|
|
@@ -133,3 +136,5 @@ $n.auth = {
|
|
|
133
136
|
// 退出登录
|
|
134
137
|
logout,
|
|
135
138
|
}
|
|
139
|
+
|
|
140
|
+
export default auth
|
package/utils/bus.js
CHANGED
package/utils/config.js
CHANGED
|
@@ -1,22 +1,49 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $n_get from 'lodash/get'
|
|
2
|
+
import $n_merge from 'lodash/merge'
|
|
2
3
|
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
// 配置
|
|
5
|
+
export const configs = {
|
|
6
|
+
// api 请求公共数据地址
|
|
7
|
+
apiDataUrl: '',
|
|
8
|
+
// api 文件请求地址
|
|
9
|
+
apiFileUrl: '',
|
|
10
|
+
// 用户配置
|
|
11
|
+
userConfig: {},
|
|
12
|
+
// 用户字典
|
|
13
|
+
userDict: {},
|
|
14
|
+
// 字典变量
|
|
15
|
+
dicts: {},
|
|
16
|
+
// 自定义路由
|
|
17
|
+
routers: {},
|
|
18
|
+
// 表格配置
|
|
19
|
+
tablesConfig: {},
|
|
20
|
+
// 对话框组件
|
|
21
|
+
dialogComponents: {},
|
|
22
|
+
// 是否开启人民币分转元
|
|
23
|
+
priceCentToYuan: false,
|
|
24
|
+
// 上传器
|
|
25
|
+
uploader: {
|
|
26
|
+
upload: {},
|
|
27
|
+
limit: {
|
|
28
|
+
image: {
|
|
29
|
+
maxSize: 10,
|
|
30
|
+
exts: [ 'jpg', 'png', 'gif' ]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}
|
|
9
35
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
/**
|
|
37
|
+
* 配置设置
|
|
38
|
+
* @param options
|
|
39
|
+
*/
|
|
40
|
+
export function settings(options) {
|
|
41
|
+
$n_merge(configs, options)
|
|
42
|
+
}
|
|
16
43
|
|
|
17
44
|
/**
|
|
18
45
|
* 获取配置
|
|
19
46
|
*/
|
|
20
|
-
|
|
21
|
-
return key ? $
|
|
47
|
+
export default function config(key = '', defaultValue = '') {
|
|
48
|
+
return key ? $n_get(configs.userConfig, key, defaultValue) : configs.userConfig
|
|
22
49
|
}
|
package/utils/copy.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import $n_copy from '@netang/utils/copy'
|
|
2
|
+
|
|
3
|
+
import $n_toast from './toast'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 复制
|
|
7
|
+
*/
|
|
8
|
+
export default function copy(text, message) {
|
|
9
|
+
if (message) {
|
|
10
|
+
// 轻提示
|
|
11
|
+
$n_toast({
|
|
12
|
+
type: 'positive',
|
|
13
|
+
message,
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
// 复制
|
|
17
|
+
$n_copy(text)
|
|
18
|
+
}
|
package/utils/dialog.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import $n_has from 'lodash/has'
|
|
2
|
+
|
|
1
3
|
import { inject } from 'vue'
|
|
2
4
|
import { Dialog } from 'quasar'
|
|
3
5
|
|
|
@@ -10,9 +12,9 @@ import { NDialogKey } from './symbols'
|
|
|
10
12
|
function create(params) {
|
|
11
13
|
if (
|
|
12
14
|
// 如果是路由组件
|
|
13
|
-
$
|
|
15
|
+
$n_has(params, 'route')
|
|
14
16
|
// 或自定义组件
|
|
15
|
-
|| $
|
|
17
|
+
|| $n_has(params, 'name')
|
|
16
18
|
) {
|
|
17
19
|
return Dialog.create({
|
|
18
20
|
// 组件
|
|
@@ -35,9 +37,11 @@ function onInject() {
|
|
|
35
37
|
/**
|
|
36
38
|
* 对话框业务
|
|
37
39
|
*/
|
|
38
|
-
|
|
40
|
+
const dialog = {
|
|
39
41
|
// 创建对话框
|
|
40
42
|
create,
|
|
41
43
|
// 获取对话框注入数据
|
|
42
44
|
inject: onInject,
|
|
43
45
|
}
|
|
46
|
+
|
|
47
|
+
export default dialog
|
package/utils/dict.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $n_has from 'lodash/has'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* 数据字典
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// 设置字典数据
|
|
8
|
-
$n.dictData = dictData
|
|
3
|
+
import { configs } from './config'
|
|
9
4
|
|
|
10
5
|
/**
|
|
11
6
|
* 获取字典值对应的文字
|
|
12
7
|
*/
|
|
13
|
-
|
|
8
|
+
export default function dict(key, value, defaultValue = '') {
|
|
14
9
|
if (
|
|
15
10
|
key
|
|
16
|
-
&& $
|
|
11
|
+
&& $n_has(configs.userDict, key)
|
|
17
12
|
) {
|
|
18
|
-
for (const item of
|
|
13
|
+
for (const item of configs.userDict[key]) {
|
|
19
14
|
if (item[1] === value) {
|
|
20
15
|
return item[0]
|
|
21
16
|
}
|
|
@@ -24,21 +19,3 @@ $n.dict = function(key, value, defaultValue = '') {
|
|
|
24
19
|
|
|
25
20
|
return defaultValue
|
|
26
21
|
}
|
|
27
|
-
|
|
28
|
-
$n.dictOptions = function(key, textKey = 'label', valueKey = 'value') {
|
|
29
|
-
|
|
30
|
-
const lists = []
|
|
31
|
-
|
|
32
|
-
const dictItem = $n.get(dictData, key, [])
|
|
33
|
-
|
|
34
|
-
for (const item of dictItem) {
|
|
35
|
-
|
|
36
|
-
const val = {}
|
|
37
|
-
val[textKey] = item[0]
|
|
38
|
-
val[valueKey] = item[1]
|
|
39
|
-
|
|
40
|
-
lists.push(val)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return lists
|
|
44
|
-
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import $n_get from 'lodash/get'
|
|
2
|
+
|
|
3
|
+
import { configs } from './config'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 数据字典选项
|
|
7
|
+
*/
|
|
8
|
+
export default function dictOptions(key, textKey = 'label', valueKey = 'value') {
|
|
9
|
+
|
|
10
|
+
const lists = []
|
|
11
|
+
|
|
12
|
+
const dictItem = $n_get(configs.userDict, key, [])
|
|
13
|
+
|
|
14
|
+
for (const item of dictItem) {
|
|
15
|
+
|
|
16
|
+
const val = {}
|
|
17
|
+
val[textKey] = item[0]
|
|
18
|
+
val[valueKey] = item[1]
|
|
19
|
+
|
|
20
|
+
lists.push(val)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return lists
|
|
24
|
+
}
|
package/utils/form.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ref, provide, inject } from 'vue'
|
|
2
2
|
|
|
3
|
+
import $n_has from 'lodash/has'
|
|
4
|
+
|
|
3
5
|
import { NPowerKey, NFormKey } from './symbols'
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -18,7 +20,7 @@ function create(params) {
|
|
|
18
20
|
}, params)
|
|
19
21
|
|
|
20
22
|
// 获取权限注入
|
|
21
|
-
const $power = $
|
|
23
|
+
const $power = $n_has(params, '$power') ? params.$power : inject(NPowerKey)
|
|
22
24
|
|
|
23
25
|
// ==========【返回】=================================================================================================
|
|
24
26
|
|
|
@@ -46,7 +48,9 @@ function create(params) {
|
|
|
46
48
|
/**
|
|
47
49
|
* 业务表单
|
|
48
50
|
*/
|
|
49
|
-
|
|
51
|
+
const form = {
|
|
50
52
|
// 创建表单
|
|
51
53
|
create,
|
|
52
54
|
}
|
|
55
|
+
|
|
56
|
+
export default form
|
package/utils/getData.js
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import { isRef } from 'vue'
|
|
2
2
|
|
|
3
|
+
import $n_isNil from 'lodash/isNil'
|
|
4
|
+
import $n_map from 'lodash/map'
|
|
5
|
+
|
|
6
|
+
import $n_http from '@netang/utils/http'
|
|
7
|
+
|
|
8
|
+
import { configs } from './config'
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
// 请求公共数据地址
|
|
12
|
+
apiDataUrl,
|
|
13
|
+
} = configs
|
|
14
|
+
|
|
3
15
|
/**
|
|
4
16
|
* 获取公共数据
|
|
5
17
|
*/
|
|
6
|
-
|
|
18
|
+
export default async function getData(url, pageStatus, emptyDescription, refValue) {
|
|
7
19
|
|
|
8
|
-
const warn = $
|
|
20
|
+
const warn = $n_isNil(pageStatus) || ! isRef(pageStatus)
|
|
9
21
|
|
|
10
22
|
// 如果是数组, 说明需要同时请求多个地址
|
|
11
23
|
// --------------------------------------------------
|
|
12
24
|
if (Array.isArray(url)) {
|
|
13
25
|
|
|
14
|
-
const result = await $
|
|
26
|
+
const result = await $n_http($n_map(url, function (item) {
|
|
15
27
|
return {
|
|
16
|
-
url:
|
|
28
|
+
url: apiDataUrl + item,
|
|
17
29
|
warn,
|
|
18
30
|
}
|
|
19
31
|
}))
|
|
@@ -25,7 +37,7 @@ $n.getData = async function(url, pageStatus, emptyDescription, refValue) {
|
|
|
25
37
|
if (! warn) {
|
|
26
38
|
pageStatus.value = false
|
|
27
39
|
}
|
|
28
|
-
if (! $
|
|
40
|
+
if (! $n_isNil(emptyDescription) && isRef(emptyDescription)) {
|
|
29
41
|
emptyDescription.value = data.msg
|
|
30
42
|
}
|
|
31
43
|
return false
|
|
@@ -38,22 +50,22 @@ $n.getData = async function(url, pageStatus, emptyDescription, refValue) {
|
|
|
38
50
|
|
|
39
51
|
// 单个请求
|
|
40
52
|
// --------------------------------------------------
|
|
41
|
-
const { status, data } = await $
|
|
42
|
-
url:
|
|
53
|
+
const { status, data } = await $n_http({
|
|
54
|
+
url: apiDataUrl + url,
|
|
43
55
|
warn,
|
|
44
56
|
})
|
|
45
57
|
if (! status) {
|
|
46
58
|
if (! warn) {
|
|
47
59
|
pageStatus.value = false
|
|
48
60
|
}
|
|
49
|
-
if (! $
|
|
61
|
+
if (! $n_isNil(emptyDescription) && isRef(emptyDescription)) {
|
|
50
62
|
emptyDescription.value = data.msg
|
|
51
63
|
}
|
|
52
64
|
return false
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
// 直接设置 value
|
|
56
|
-
if (! $
|
|
68
|
+
if (! $n_isNil(refValue) && isRef(refValue)) {
|
|
57
69
|
refValue.value = data
|
|
58
70
|
}
|
|
59
71
|
|