@netang/quasar 0.0.102 → 0.0.104
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/LICENSE +21 -21
- package/README.md +11 -11
- package/_docs/docs/.vuepress/client.js +8 -8
- package/_docs/docs/.vuepress/config.js +40 -40
- package/_docs/docs/.vuepress/configs/index.js +2 -2
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -1
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -16
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -1
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +75 -75
- package/_docs/docs/.vuepress/public/css/index.css +3 -3
- package/_docs/docs/.vuepress/styles/index.scss +3 -3
- package/_docs/docs/components/column-title.md +25 -25
- package/_docs/docs/components/data.md +66 -66
- package/_docs/docs/components/dialog.md +59 -59
- package/_docs/docs/components/dragger.md +26 -26
- package/_docs/docs/components/editor-code.md +16 -16
- package/_docs/docs/components/empty.md +13 -13
- package/_docs/docs/components/field-date.md +16 -16
- package/_docs/docs/components/field-text.md +57 -57
- package/_docs/docs/components/field-tree.md +14 -14
- package/_docs/docs/components/img.md +25 -25
- package/_docs/docs/components/input-number.md +21 -21
- package/_docs/docs/components/list-menu-item.md +21 -21
- package/_docs/docs/components/list-menu.md +21 -21
- package/_docs/docs/components/power-page.md +21 -21
- package/_docs/docs/components/price.md +21 -21
- package/_docs/docs/components/render.md +12 -12
- package/_docs/docs/components/search-item.md +10 -10
- package/_docs/docs/components/search.md +12 -12
- package/_docs/docs/components/select.md +11 -11
- package/_docs/docs/components/splitter.md +15 -15
- package/_docs/docs/components/table-column-fixed.md +20 -20
- package/_docs/docs/components/table-pagination.md +20 -20
- package/_docs/docs/components/table-splitter.md +20 -20
- package/_docs/docs/components/table-summary.md +20 -20
- package/_docs/docs/components/table.md +25 -25
- package/_docs/docs/components/thumbnail.md +18 -18
- package/_docs/docs/components/toolbar.md +9 -9
- package/_docs/docs/components/uploader-query.md +19 -19
- package/_docs/docs/components/uploader.md +16 -16
- package/_docs/docs/components/value-format.md +26 -26
- package/_docs/docs/index.md +1 -1
- package/_docs/docs/utils/alert.md +26 -26
- package/_docs/docs/utils/area.md +112 -112
- package/_docs/docs/utils/arr.md +80 -80
- package/_docs/docs/utils/auth.md +101 -101
- package/_docs/docs/utils/bus.md +18 -18
- package/_docs/docs/utils/confirm.md +31 -31
- package/_docs/docs/utils/copy.md +22 -22
- package/_docs/docs/utils/dialog.md +98 -98
- package/_docs/docs/utils/dict.md +50 -50
- package/_docs/docs/utils/dictOptions.md +27 -27
- package/_docs/docs/utils/form.md +33 -33
- package/_docs/docs/utils/getData.md +60 -60
- package/_docs/docs/utils/getFile.md +21 -21
- package/_docs/docs/utils/getImage.md +33 -33
- package/_docs/docs/utils/getTime.md +51 -51
- package/_docs/docs/utils/index.md +1 -1
- package/_docs/docs/utils/loading.md +18 -18
- package/_docs/docs/utils/notify.md +29 -29
- package/_docs/docs/utils/power.md +353 -353
- package/_docs/docs/utils/previewImage.md +11 -11
- package/_docs/docs/utils/price.md +45 -45
- package/_docs/docs/utils/rule.md +30 -30
- package/_docs/docs/utils/ruleValid.md +31 -31
- package/_docs/docs/utils/symbols.md +30 -30
- package/_docs/docs/utils/table.md +194 -194
- package/_docs/docs/utils/timestamp.md +27 -27
- package/_docs/docs/utils/toast.md +27 -27
- package/_docs/docs/utils/tree.md +174 -174
- package/_docs/docs/utils/uploader.md +29 -29
- package/_docs/package.json +11 -11
- package/components/column-title/index.vue +37 -37
- package/components/data/index.vue +20 -20
- package/components/dialog/index.vue +372 -372
- package/components/dragger/index.vue +203 -203
- package/components/drawer/index.vue +303 -303
- package/components/editor-code/index.vue +289 -289
- package/components/empty/index.vue +71 -71
- package/components/field-date/index.vue +850 -850
- package/components/field-date/methods.js +100 -100
- package/components/field-table/index.vue +1222 -1222
- package/components/field-text/index.vue +165 -165
- package/components/field-tree/index.vue +103 -81
- package/components/img/index.vue +202 -202
- package/components/input-number/index.vue +546 -546
- package/components/list-menu/index.vue +149 -149
- package/components/list-menu-item/index.vue +79 -79
- package/components/power-page/index.vue +92 -92
- package/components/price/index.vue +188 -188
- package/components/private/components/index.js +11 -11
- package/components/private/components/move-to-tree/index.vue +154 -154
- package/components/private/edit-power-data/index.vue +816 -816
- package/components/private/table-visible-columns-button/index.vue +109 -109
- package/components/render/index.vue +150 -150
- package/components/search/index.vue +4 -2
- package/components/search-item/index.vue +4 -2
- package/components/splitter/index.vue +415 -415
- package/components/table/index.vue +456 -456
- package/components/table-column-fixed/index.vue +112 -112
- package/components/table-pagination/index.vue +192 -192
- package/components/table-splitter/index.vue +360 -360
- package/components/table-summary/index.vue +110 -110
- package/components/thumbnail/index.vue +72 -72
- package/components/toolbar/container.vue +31 -31
- package/components/toolbar/index.vue +136 -136
- package/components/uploader/index.vue +158 -158
- package/components/uploader-query/index.vue +758 -758
- package/components/value-format/index.vue +274 -274
- package/configs/area3.js +1 -1
- package/docs/css/index.css +3 -3
- package/package.json +1 -1
- package/sass/common.scss +5 -0
- package/sass/index.scss +14 -14
- package/sass/line.scss +39 -39
- package/sass/quasar/btn.scss +46 -46
- package/sass/quasar/common.scss +3 -3
- package/sass/quasar/dialog.scss +7 -7
- package/sass/quasar/drawer.scss +6 -6
- package/sass/quasar/field.scss +243 -243
- package/sass/quasar/loading.scss +6 -6
- package/sass/quasar/menu.scss +8 -8
- package/sass/quasar/table.scss +150 -150
- package/sass/quasar/toolbar.scss +22 -22
- package/store/index.js +29 -29
- package/utils/$auth.js +127 -127
- package/utils/$form.js +56 -56
- package/utils/$power.js +1215 -1215
- package/utils/$rule.js +13 -13
- package/utils/$ruleValid.js +10 -10
- package/utils/$table.js +999 -999
- package/utils/$tree.js +713 -713
- package/utils/alert.js +12 -12
- package/utils/area.js +400 -400
- package/utils/arr.js +51 -51
- package/utils/bus.js +6 -6
- package/utils/config.js +52 -52
- package/utils/confirm.js +11 -11
- package/utils/copy.js +30 -30
- package/utils/dialog.js +36 -36
- package/utils/dict.js +21 -21
- package/utils/dictOptions.js +28 -28
- package/utils/getData.js +73 -73
- package/utils/getFile.js +40 -40
- package/utils/getImage.js +153 -153
- package/utils/getTime.js +106 -106
- package/utils/index.js +61 -61
- package/utils/loading.js +15 -15
- package/utils/notify.js +13 -13
- package/utils/previewImage.js +10 -10
- package/utils/price.js +18 -18
- package/utils/symbols.js +18 -18
- package/utils/timestamp.js +18 -18
- package/utils/toast.js +13 -13
- package/utils/uploader/aliyun.js +6 -6
- package/utils/uploader/local.js +8 -8
- package/utils/uploader/qiniu.js +321 -321
- package/utils/uploader.js +1059 -1059
- package/utils/useAuth.js +30 -30
- package/utils/useRouter.js +47 -47
- package/utils/useSearch.js +0 -6
- package/utils/useUploader.js +53 -53
package/utils/arr.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import $n_isFunction from 'lodash/isFunction'
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* 操作数组
|
|
5
|
-
*/
|
|
6
|
-
const arr = {
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 数组添加值
|
|
10
|
-
*/
|
|
11
|
-
add(children, index, newItem) {
|
|
12
|
-
if (Array.isArray(children)) {
|
|
13
|
-
children.splice(index + 1, 0, $n_isFunction(newItem) ? newItem() : newItem)
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 数组删除值
|
|
19
|
-
*/
|
|
20
|
-
delete(children, index) {
|
|
21
|
-
if (Array.isArray(children)) {
|
|
22
|
-
children.splice(index, 1)
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 数组值上移
|
|
28
|
-
*/
|
|
29
|
-
up(children, index) {
|
|
30
|
-
if (Array.isArray(children)) {
|
|
31
|
-
// 在上一项插入该项
|
|
32
|
-
children.splice(index - 1, 0, children[index])
|
|
33
|
-
// 删除后一项
|
|
34
|
-
children.splice(index + 1, 1)
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* 数组值下移
|
|
40
|
-
*/
|
|
41
|
-
down(children, index) {
|
|
42
|
-
if (Array.isArray(children)) {
|
|
43
|
-
// 在下一项插入该项
|
|
44
|
-
children.splice(index + 2, 0, children[index])
|
|
45
|
-
// 删除前一项
|
|
46
|
-
children.splice(index, 1)
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default arr
|
|
1
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* 操作数组
|
|
5
|
+
*/
|
|
6
|
+
const arr = {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 数组添加值
|
|
10
|
+
*/
|
|
11
|
+
add(children, index, newItem) {
|
|
12
|
+
if (Array.isArray(children)) {
|
|
13
|
+
children.splice(index + 1, 0, $n_isFunction(newItem) ? newItem() : newItem)
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 数组删除值
|
|
19
|
+
*/
|
|
20
|
+
delete(children, index) {
|
|
21
|
+
if (Array.isArray(children)) {
|
|
22
|
+
children.splice(index, 1)
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 数组值上移
|
|
28
|
+
*/
|
|
29
|
+
up(children, index) {
|
|
30
|
+
if (Array.isArray(children)) {
|
|
31
|
+
// 在上一项插入该项
|
|
32
|
+
children.splice(index - 1, 0, children[index])
|
|
33
|
+
// 删除后一项
|
|
34
|
+
children.splice(index + 1, 1)
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 数组值下移
|
|
40
|
+
*/
|
|
41
|
+
down(children, index) {
|
|
42
|
+
if (Array.isArray(children)) {
|
|
43
|
+
// 在下一项插入该项
|
|
44
|
+
children.splice(index + 2, 0, children[index])
|
|
45
|
+
// 删除前一项
|
|
46
|
+
children.splice(index, 1)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default arr
|
package/utils/bus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EventBus } from 'quasar'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 事件总线
|
|
5
|
-
*/
|
|
6
|
-
export default new EventBus()
|
|
1
|
+
import { EventBus } from 'quasar'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 事件总线
|
|
5
|
+
*/
|
|
6
|
+
export default new EventBus()
|
package/utils/config.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import $n_get from 'lodash/get'
|
|
2
|
-
import $n_merge from 'lodash/merge'
|
|
3
|
-
|
|
4
|
-
// 用户配置 参数
|
|
5
|
-
// userConfig: {
|
|
6
|
-
// // api 请求公共数据地址
|
|
7
|
-
// apiDataUrl: '',
|
|
8
|
-
// // api 文件请求地址
|
|
9
|
-
// apiFileUrl: '',
|
|
10
|
-
// // api 请求权限标识
|
|
11
|
-
// apiDataPowerName: '',
|
|
12
|
-
// // 是否开启人民币分转元
|
|
13
|
-
// priceCentToYuan: false,
|
|
14
|
-
// // 上传器
|
|
15
|
-
// uploader: {
|
|
16
|
-
// upload: {
|
|
17
|
-
// type: '',
|
|
18
|
-
// domain: '',
|
|
19
|
-
// },
|
|
20
|
-
// },
|
|
21
|
-
// },
|
|
22
|
-
|
|
23
|
-
// 配置
|
|
24
|
-
export const configs = {
|
|
25
|
-
// 用户配置
|
|
26
|
-
userConfig: {},
|
|
27
|
-
// 用户字典
|
|
28
|
-
userDict: {},
|
|
29
|
-
// 字典变量
|
|
30
|
-
dicts: {},
|
|
31
|
-
// 自定义路由
|
|
32
|
-
routers: {},
|
|
33
|
-
// 表格配置
|
|
34
|
-
tablesConfig: {},
|
|
35
|
-
// 对话框组件
|
|
36
|
-
dialogComponents: {},
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 配置设置
|
|
41
|
-
* @param options
|
|
42
|
-
*/
|
|
43
|
-
export function settings(options) {
|
|
44
|
-
$n_merge(configs, options)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 获取配置
|
|
49
|
-
*/
|
|
50
|
-
export default function config(key = '', defaultValue = '') {
|
|
51
|
-
return key ? $n_get(configs.userConfig, key, defaultValue) : configs.userConfig
|
|
52
|
-
}
|
|
1
|
+
import $n_get from 'lodash/get'
|
|
2
|
+
import $n_merge from 'lodash/merge'
|
|
3
|
+
|
|
4
|
+
// 用户配置 参数
|
|
5
|
+
// userConfig: {
|
|
6
|
+
// // api 请求公共数据地址
|
|
7
|
+
// apiDataUrl: '',
|
|
8
|
+
// // api 文件请求地址
|
|
9
|
+
// apiFileUrl: '',
|
|
10
|
+
// // api 请求权限标识
|
|
11
|
+
// apiDataPowerName: '',
|
|
12
|
+
// // 是否开启人民币分转元
|
|
13
|
+
// priceCentToYuan: false,
|
|
14
|
+
// // 上传器
|
|
15
|
+
// uploader: {
|
|
16
|
+
// upload: {
|
|
17
|
+
// type: '',
|
|
18
|
+
// domain: '',
|
|
19
|
+
// },
|
|
20
|
+
// },
|
|
21
|
+
// },
|
|
22
|
+
|
|
23
|
+
// 配置
|
|
24
|
+
export const configs = {
|
|
25
|
+
// 用户配置
|
|
26
|
+
userConfig: {},
|
|
27
|
+
// 用户字典
|
|
28
|
+
userDict: {},
|
|
29
|
+
// 字典变量
|
|
30
|
+
dicts: {},
|
|
31
|
+
// 自定义路由
|
|
32
|
+
routers: {},
|
|
33
|
+
// 表格配置
|
|
34
|
+
tablesConfig: {},
|
|
35
|
+
// 对话框组件
|
|
36
|
+
dialogComponents: {},
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 配置设置
|
|
41
|
+
* @param options
|
|
42
|
+
*/
|
|
43
|
+
export function settings(options) {
|
|
44
|
+
$n_merge(configs, options)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 获取配置
|
|
49
|
+
*/
|
|
50
|
+
export default function config(key = '', defaultValue = '') {
|
|
51
|
+
return key ? $n_get(configs.userConfig, key, defaultValue) : configs.userConfig
|
|
52
|
+
}
|
package/utils/confirm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Dialog } from 'quasar'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 确认框
|
|
5
|
-
*/
|
|
6
|
-
export default function confirm(options) {
|
|
7
|
-
return Dialog.create(Object.assign({
|
|
8
|
-
title: '提示',
|
|
9
|
-
cancel: true,
|
|
10
|
-
}, options))
|
|
11
|
-
}
|
|
1
|
+
import { Dialog } from 'quasar'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 确认框
|
|
5
|
+
*/
|
|
6
|
+
export default function confirm(options) {
|
|
7
|
+
return Dialog.create(Object.assign({
|
|
8
|
+
title: '提示',
|
|
9
|
+
cancel: true,
|
|
10
|
+
}, options))
|
|
11
|
+
}
|
package/utils/copy.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { copyToClipboard } from 'quasar'
|
|
2
|
-
|
|
3
|
-
import $n_toast from './toast'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 复制
|
|
7
|
-
*/
|
|
8
|
-
export default function copy(text, message = null) {
|
|
9
|
-
|
|
10
|
-
// 提示
|
|
11
|
-
if (message !== false) {
|
|
12
|
-
|
|
13
|
-
// 如果为 true, 则 message 设为 text
|
|
14
|
-
if (message === true) {
|
|
15
|
-
message = `复制【${text}】成功`
|
|
16
|
-
} else if (! message) {
|
|
17
|
-
message = '复制成功'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// 轻提示
|
|
21
|
-
$n_toast({
|
|
22
|
-
type: 'positive',
|
|
23
|
-
message,
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 复制
|
|
28
|
-
copyToClipboard(text)
|
|
29
|
-
.finally()
|
|
30
|
-
}
|
|
1
|
+
import { copyToClipboard } from 'quasar'
|
|
2
|
+
|
|
3
|
+
import $n_toast from './toast'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 复制
|
|
7
|
+
*/
|
|
8
|
+
export default function copy(text, message = null) {
|
|
9
|
+
|
|
10
|
+
// 提示
|
|
11
|
+
if (message !== false) {
|
|
12
|
+
|
|
13
|
+
// 如果为 true, 则 message 设为 text
|
|
14
|
+
if (message === true) {
|
|
15
|
+
message = `复制【${text}】成功`
|
|
16
|
+
} else if (! message) {
|
|
17
|
+
message = '复制成功'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 轻提示
|
|
21
|
+
$n_toast({
|
|
22
|
+
type: 'positive',
|
|
23
|
+
message,
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 复制
|
|
28
|
+
copyToClipboard(text)
|
|
29
|
+
.finally()
|
|
30
|
+
}
|
package/utils/dialog.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import $n_has from 'lodash/has'
|
|
2
|
-
|
|
3
|
-
import { Dialog } from 'quasar'
|
|
4
|
-
|
|
5
|
-
import DialogComponent from '../components/dialog'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 创建对话框
|
|
9
|
-
*/
|
|
10
|
-
function create(options) {
|
|
11
|
-
if (
|
|
12
|
-
// 如果是路由组件
|
|
13
|
-
$n_has(options, 'path')
|
|
14
|
-
// 或自定义组件
|
|
15
|
-
|| $n_has(options, 'name')
|
|
16
|
-
) {
|
|
17
|
-
return Dialog.create({
|
|
18
|
-
// 组件
|
|
19
|
-
component: DialogComponent,
|
|
20
|
-
// 组件声明
|
|
21
|
-
componentProps: options,
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return Dialog.create(options)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 对话框
|
|
30
|
-
*/
|
|
31
|
-
const dialog = {
|
|
32
|
-
// 创建对话框
|
|
33
|
-
create,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default dialog
|
|
1
|
+
import $n_has from 'lodash/has'
|
|
2
|
+
|
|
3
|
+
import { Dialog } from 'quasar'
|
|
4
|
+
|
|
5
|
+
import DialogComponent from '../components/dialog'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 创建对话框
|
|
9
|
+
*/
|
|
10
|
+
function create(options) {
|
|
11
|
+
if (
|
|
12
|
+
// 如果是路由组件
|
|
13
|
+
$n_has(options, 'path')
|
|
14
|
+
// 或自定义组件
|
|
15
|
+
|| $n_has(options, 'name')
|
|
16
|
+
) {
|
|
17
|
+
return Dialog.create({
|
|
18
|
+
// 组件
|
|
19
|
+
component: DialogComponent,
|
|
20
|
+
// 组件声明
|
|
21
|
+
componentProps: options,
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return Dialog.create(options)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 对话框
|
|
30
|
+
*/
|
|
31
|
+
const dialog = {
|
|
32
|
+
// 创建对话框
|
|
33
|
+
create,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default dialog
|
package/utils/dict.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import $n_has from 'lodash/has'
|
|
2
|
-
|
|
3
|
-
import { configs } from './config'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 获取字典值对应的文字
|
|
7
|
-
*/
|
|
8
|
-
export default function dict(key, value, defaultValue = '') {
|
|
9
|
-
if (
|
|
10
|
-
key
|
|
11
|
-
&& $n_has(configs.userDict, key)
|
|
12
|
-
) {
|
|
13
|
-
for (const item of configs.userDict[key]) {
|
|
14
|
-
if (item[1] === value) {
|
|
15
|
-
return item[0]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return defaultValue
|
|
21
|
-
}
|
|
1
|
+
import $n_has from 'lodash/has'
|
|
2
|
+
|
|
3
|
+
import { configs } from './config'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 获取字典值对应的文字
|
|
7
|
+
*/
|
|
8
|
+
export default function dict(key, value, defaultValue = '') {
|
|
9
|
+
if (
|
|
10
|
+
key
|
|
11
|
+
&& $n_has(configs.userDict, key)
|
|
12
|
+
) {
|
|
13
|
+
for (const item of configs.userDict[key]) {
|
|
14
|
+
if (item[1] === value) {
|
|
15
|
+
return item[0]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return defaultValue
|
|
21
|
+
}
|
package/utils/dictOptions.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import $n_get from 'lodash/get'
|
|
2
|
-
|
|
3
|
-
import { configs } from './config'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 数据字典选项数组
|
|
7
|
-
* @param {String} key 字典键值
|
|
8
|
-
* @param {String} labelKey 标签键值
|
|
9
|
-
* @param {String} valueKey 值键值
|
|
10
|
-
* @returns {Array}
|
|
11
|
-
*/
|
|
12
|
-
export default function dictOptions(key, labelKey = 'label', valueKey = 'value') {
|
|
13
|
-
|
|
14
|
-
const lists = []
|
|
15
|
-
|
|
16
|
-
const dictItem = $n_get(configs.userDict, key, [])
|
|
17
|
-
|
|
18
|
-
for (const item of dictItem) {
|
|
19
|
-
|
|
20
|
-
const val = {}
|
|
21
|
-
val[labelKey] = item[0]
|
|
22
|
-
val[valueKey] = item[1]
|
|
23
|
-
|
|
24
|
-
lists.push(val)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return lists
|
|
28
|
-
}
|
|
1
|
+
import $n_get from 'lodash/get'
|
|
2
|
+
|
|
3
|
+
import { configs } from './config'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 数据字典选项数组
|
|
7
|
+
* @param {String} key 字典键值
|
|
8
|
+
* @param {String} labelKey 标签键值
|
|
9
|
+
* @param {String} valueKey 值键值
|
|
10
|
+
* @returns {Array}
|
|
11
|
+
*/
|
|
12
|
+
export default function dictOptions(key, labelKey = 'label', valueKey = 'value') {
|
|
13
|
+
|
|
14
|
+
const lists = []
|
|
15
|
+
|
|
16
|
+
const dictItem = $n_get(configs.userDict, key, [])
|
|
17
|
+
|
|
18
|
+
for (const item of dictItem) {
|
|
19
|
+
|
|
20
|
+
const val = {}
|
|
21
|
+
val[labelKey] = item[0]
|
|
22
|
+
val[valueKey] = item[1]
|
|
23
|
+
|
|
24
|
+
lists.push(val)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return lists
|
|
28
|
+
}
|
package/utils/getData.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { isRef } from 'vue'
|
|
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 $n_config from './config'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 获取公共数据
|
|
12
|
-
* @param {String|Array} url 请求地址
|
|
13
|
-
* @param pageStatus 页面状态
|
|
14
|
-
* @param emptyDescription 空状态描述
|
|
15
|
-
* @param refValue 请求成功后设置值
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
export default async function getData(url, pageStatus = null, emptyDescription = null, refValue = null) {
|
|
19
|
-
|
|
20
|
-
const warn = $n_isNil(pageStatus) || ! isRef(pageStatus)
|
|
21
|
-
|
|
22
|
-
// 如果是数组, 说明需要同时请求多个地址
|
|
23
|
-
// --------------------------------------------------
|
|
24
|
-
if (Array.isArray(url)) {
|
|
25
|
-
|
|
26
|
-
const result = await $n_http($n_map(url, function (item) {
|
|
27
|
-
return {
|
|
28
|
-
url: $n_config('apiDataUrl') + item,
|
|
29
|
-
warn,
|
|
30
|
-
}
|
|
31
|
-
}))
|
|
32
|
-
|
|
33
|
-
const res = []
|
|
34
|
-
|
|
35
|
-
for (const { status, data } of result) {
|
|
36
|
-
if (! status) {
|
|
37
|
-
if (! warn) {
|
|
38
|
-
pageStatus.value = false
|
|
39
|
-
}
|
|
40
|
-
if (! $n_isNil(emptyDescription) && isRef(emptyDescription)) {
|
|
41
|
-
emptyDescription.value = data.msg
|
|
42
|
-
}
|
|
43
|
-
return false
|
|
44
|
-
}
|
|
45
|
-
res.push(data)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return res
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 单个请求
|
|
52
|
-
// --------------------------------------------------
|
|
53
|
-
const { status, data } = await $n_http({
|
|
54
|
-
url: $n_config('apiDataUrl') + url,
|
|
55
|
-
warn,
|
|
56
|
-
})
|
|
57
|
-
if (! status) {
|
|
58
|
-
if (! warn) {
|
|
59
|
-
pageStatus.value = false
|
|
60
|
-
}
|
|
61
|
-
if (! $n_isNil(emptyDescription) && isRef(emptyDescription)) {
|
|
62
|
-
emptyDescription.value = data.msg
|
|
63
|
-
}
|
|
64
|
-
return false
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 直接设置 value
|
|
68
|
-
if (! $n_isNil(refValue) && isRef(refValue)) {
|
|
69
|
-
refValue.value = data
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return data
|
|
73
|
-
}
|
|
1
|
+
import { isRef } from 'vue'
|
|
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 $n_config from './config'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 获取公共数据
|
|
12
|
+
* @param {String|Array} url 请求地址
|
|
13
|
+
* @param pageStatus 页面状态
|
|
14
|
+
* @param emptyDescription 空状态描述
|
|
15
|
+
* @param refValue 请求成功后设置值
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export default async function getData(url, pageStatus = null, emptyDescription = null, refValue = null) {
|
|
19
|
+
|
|
20
|
+
const warn = $n_isNil(pageStatus) || ! isRef(pageStatus)
|
|
21
|
+
|
|
22
|
+
// 如果是数组, 说明需要同时请求多个地址
|
|
23
|
+
// --------------------------------------------------
|
|
24
|
+
if (Array.isArray(url)) {
|
|
25
|
+
|
|
26
|
+
const result = await $n_http($n_map(url, function (item) {
|
|
27
|
+
return {
|
|
28
|
+
url: $n_config('apiDataUrl') + item,
|
|
29
|
+
warn,
|
|
30
|
+
}
|
|
31
|
+
}))
|
|
32
|
+
|
|
33
|
+
const res = []
|
|
34
|
+
|
|
35
|
+
for (const { status, data } of result) {
|
|
36
|
+
if (! status) {
|
|
37
|
+
if (! warn) {
|
|
38
|
+
pageStatus.value = false
|
|
39
|
+
}
|
|
40
|
+
if (! $n_isNil(emptyDescription) && isRef(emptyDescription)) {
|
|
41
|
+
emptyDescription.value = data.msg
|
|
42
|
+
}
|
|
43
|
+
return false
|
|
44
|
+
}
|
|
45
|
+
res.push(data)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return res
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 单个请求
|
|
52
|
+
// --------------------------------------------------
|
|
53
|
+
const { status, data } = await $n_http({
|
|
54
|
+
url: $n_config('apiDataUrl') + url,
|
|
55
|
+
warn,
|
|
56
|
+
})
|
|
57
|
+
if (! status) {
|
|
58
|
+
if (! warn) {
|
|
59
|
+
pageStatus.value = false
|
|
60
|
+
}
|
|
61
|
+
if (! $n_isNil(emptyDescription) && isRef(emptyDescription)) {
|
|
62
|
+
emptyDescription.value = data.msg
|
|
63
|
+
}
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 直接设置 value
|
|
68
|
+
if (! $n_isNil(refValue) && isRef(refValue)) {
|
|
69
|
+
refValue.value = data
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return data
|
|
73
|
+
}
|