@netang/quasar 0.0.32 → 0.0.33
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/components/dialog/index.vue +1 -1
- package/components/empty/index.vue +2 -2
- package/components/field-table/index.vue +1 -0
- package/components/power-page/index.vue +1 -1
- package/components/{dialog → private}/components/index.js +0 -0
- package/components/{dialog → private}/components/move-to-tree/index.vue +0 -0
- package/components/render/index.vue +47 -17
- package/components/search/index.vue +0 -15
- package/components/search-item/index.vue +13 -21
- package/package.json +1 -1
- package/utils/$power.js +70 -26
- package/utils/$search.js +8 -1
- package/utils/$table.js +13 -1
|
@@ -54,7 +54,7 @@ import { useDialogPluginComponent, useQuasar } from 'quasar'
|
|
|
54
54
|
|
|
55
55
|
import routers from '@/router/routers'
|
|
56
56
|
|
|
57
|
-
import components from '
|
|
57
|
+
import components from '../private/components'
|
|
58
58
|
import { NDialogKey } from '../../utils/symbols'
|
|
59
59
|
|
|
60
60
|
export default {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="q-pa-lg flex flex-center absolute-full">
|
|
3
|
-
{{
|
|
3
|
+
{{description || '发生未知错误'}}
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
*/
|
|
18
18
|
props: {
|
|
19
19
|
// 空状态描述
|
|
20
|
-
|
|
20
|
+
description: String,
|
|
21
21
|
},
|
|
22
22
|
}
|
|
23
23
|
</script>
|
|
File without changes
|
|
File without changes
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<q-layout
|
|
3
|
+
class="absolute-full"
|
|
4
|
+
view="hHh lpr fFf"
|
|
5
|
+
container
|
|
6
|
+
>
|
|
7
|
+
<q-page-container>
|
|
8
|
+
<slot
|
|
9
|
+
:query="query"
|
|
10
|
+
v-bind="props"
|
|
11
|
+
v-if="$slots.default"
|
|
12
|
+
/>
|
|
13
|
+
<component
|
|
14
|
+
:is="comp"
|
|
15
|
+
:query="query"
|
|
16
|
+
v-bind="props"
|
|
17
|
+
v-else
|
|
18
|
+
/>
|
|
19
|
+
</q-page-container>
|
|
20
|
+
</q-layout>
|
|
13
21
|
</template>
|
|
14
22
|
|
|
15
23
|
<script>
|
|
16
24
|
import { computed, defineAsyncComponent, provide } from 'vue'
|
|
17
25
|
|
|
18
26
|
import routers from '@/router/routers'
|
|
19
|
-
import components from '
|
|
27
|
+
import components from '../private/components'
|
|
20
28
|
|
|
21
29
|
import { NRenderKey } from '../../utils/symbols'
|
|
22
30
|
|
|
@@ -83,17 +91,39 @@ export default {
|
|
|
83
91
|
|
|
84
92
|
// ==========【注入】============================================================================================
|
|
85
93
|
|
|
86
|
-
//
|
|
87
|
-
|
|
94
|
+
// 注入数据
|
|
95
|
+
const data = {
|
|
88
96
|
// 组件标识
|
|
89
97
|
name: props.name,
|
|
90
|
-
// 路由路径
|
|
91
|
-
path: utils.isValidString(props.path) ? utils.slash(props.path, 'start', true) : '',
|
|
92
98
|
// 参数
|
|
93
99
|
query: utils.isValidObject(props.query) ? props.query : {},
|
|
94
100
|
// 组件传参
|
|
95
101
|
props: props.props,
|
|
96
|
-
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 如果有路由路径
|
|
105
|
+
if (utils.isValidString(props.path)) {
|
|
106
|
+
|
|
107
|
+
// 获取页面路由
|
|
108
|
+
const $route = utils.router.resolve({
|
|
109
|
+
path: props.path,
|
|
110
|
+
query: data.query,
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
Object.assign(data, {
|
|
114
|
+
// 当前路由全路径
|
|
115
|
+
routeFullPath: $route.fullPath,
|
|
116
|
+
// 当前路由路径
|
|
117
|
+
routePath: $route.path,
|
|
118
|
+
// 当前路由参数
|
|
119
|
+
routeQuery: $route.query,
|
|
120
|
+
// 当前路由,
|
|
121
|
+
$route,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 向后代注入数据
|
|
126
|
+
provide(NRenderKey, data)
|
|
97
127
|
|
|
98
128
|
// ==========【返回】=============================================================================================
|
|
99
129
|
|
|
@@ -74,18 +74,6 @@
|
|
|
74
74
|
|
|
75
75
|
<!-- 输入框 -->
|
|
76
76
|
<template v-else-if="item.searchType === 'input'">
|
|
77
|
-
<!-- 输入框 数字 -->
|
|
78
|
-
<n-input-number
|
|
79
|
-
class="n-field-fieldset"
|
|
80
|
-
:label="label"
|
|
81
|
-
v-model="modelValue[itemIndex][index].value"
|
|
82
|
-
dense
|
|
83
|
-
outlined
|
|
84
|
-
clearable
|
|
85
|
-
v-bind="item.input"
|
|
86
|
-
v-if="item.type === 'number'"
|
|
87
|
-
/>
|
|
88
|
-
<!-- 输入框 文字 -->
|
|
89
77
|
<q-input
|
|
90
78
|
class="n-field-fieldset"
|
|
91
79
|
:label="label"
|
|
@@ -94,7 +82,6 @@
|
|
|
94
82
|
outlined
|
|
95
83
|
clearable
|
|
96
84
|
v-bind="item.input"
|
|
97
|
-
v-else
|
|
98
85
|
/>
|
|
99
86
|
</template>
|
|
100
87
|
|
|
@@ -176,8 +163,6 @@
|
|
|
176
163
|
</template>
|
|
177
164
|
|
|
178
165
|
<script>
|
|
179
|
-
import { computed } from 'vue'
|
|
180
|
-
|
|
181
166
|
export default {
|
|
182
167
|
|
|
183
168
|
/**
|
|
@@ -161,28 +161,20 @@ export default {
|
|
|
161
161
|
/**
|
|
162
162
|
* 监听声明值
|
|
163
163
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
modelValue[0].value = utils.isValidValue(modelValue[0].value) ? [modelValue[0].value] : []
|
|
176
|
-
emit('update:modelValue', modelValue)
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// 否则为单选, 并且如果值为数组
|
|
180
|
-
} else if (Array.isArray(modelValue[0].value)) {
|
|
181
|
-
modelValue[0].value = utils.isValidValue(modelValue[0].value[0]) ? modelValue[0].value[0] : ''
|
|
182
|
-
emit('update:modelValue', modelValue)
|
|
164
|
+
watch(()=>props.modelValue[0].type, function(val) {
|
|
165
|
+
// 如果类型不为 in / not in, 为单选
|
|
166
|
+
if (utils.indexOf([dicts.SEARCH_TYPE__IN, dicts.SEARCH_TYPE__NOT_IN], val) === -1) {
|
|
167
|
+
const arr = utils.split(props.modelValue[0].value, ',')
|
|
168
|
+
if (arr.length !== 1) {
|
|
169
|
+
// 克隆值
|
|
170
|
+
const _modelValue = _.cloneDeep(props.modelValue)
|
|
171
|
+
|
|
172
|
+
// 更新值
|
|
173
|
+
_modelValue[0].value = arr.length > 1 ? arr[0] : ''
|
|
174
|
+
emit('update:modelValue', _modelValue)
|
|
183
175
|
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
176
|
+
}
|
|
177
|
+
})
|
|
186
178
|
|
|
187
179
|
// ==========【返回】=============================================================================================
|
|
188
180
|
|
package/package.json
CHANGED
package/utils/$power.js
CHANGED
|
@@ -2,7 +2,7 @@ import { provide, inject, ref, computed } from 'vue'
|
|
|
2
2
|
import { useQuasar } from 'quasar'
|
|
3
3
|
|
|
4
4
|
import { statePower } from '../store'
|
|
5
|
-
import { NPowerKey, NFormKey, NTableKey } from './symbols'
|
|
5
|
+
import { NRenderKey, NPowerKey, NFormKey, NTableKey } from './symbols'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* 创建权限实例
|
|
@@ -23,6 +23,10 @@ function create(params) {
|
|
|
23
23
|
emptyDescription: '',
|
|
24
24
|
// 是否开启权限
|
|
25
25
|
power: true,
|
|
26
|
+
// 是否显示权限按钮
|
|
27
|
+
showPowerBtns: true,
|
|
28
|
+
// 是否显示工具栏权限按钮
|
|
29
|
+
showToolbarPowerBtns: true,
|
|
26
30
|
// 左边侧滑菜单图标
|
|
27
31
|
leftDrawerIcon: 'format_list_bulleted',
|
|
28
32
|
// 右边侧滑菜单图标
|
|
@@ -38,25 +42,51 @@ function create(params) {
|
|
|
38
42
|
requestAfter: null,
|
|
39
43
|
}, params)
|
|
40
44
|
|
|
41
|
-
//
|
|
42
|
-
const $
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
// 获取渲染注入
|
|
46
|
+
const $render = inject(NRenderKey)
|
|
47
|
+
|
|
48
|
+
// 如果有渲染注入
|
|
49
|
+
const hasRender = !! $render
|
|
50
|
+
if (hasRender) {
|
|
51
|
+
// 如果有权限传参, 则合并参数
|
|
52
|
+
const powerProps = _.get($render, 'props.powerProps')
|
|
53
|
+
if (utils.isValidObject(powerProps)) {
|
|
54
|
+
_.merge(o, powerProps)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 权限路由
|
|
59
|
+
let $route
|
|
60
|
+
|
|
61
|
+
// 如果没有路由
|
|
62
|
+
if (o.path === false) {
|
|
63
|
+
|
|
64
|
+
// 设为空路由
|
|
65
|
+
$route = {
|
|
45
66
|
fullPath: '',
|
|
46
67
|
path: '',
|
|
47
68
|
query: utils.isValidObject(o.query) ? o.query : {},
|
|
48
69
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
|
|
71
|
+
// 如果有自定义路径
|
|
72
|
+
} else if (utils.isValidString(o.path)) {
|
|
73
|
+
|
|
74
|
+
// 获取自定义路由
|
|
75
|
+
$route = utils.router.resolve({
|
|
76
|
+
path: o.path,
|
|
77
|
+
query: utils.isValidObject(o.query) ? o.query : {},
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// 如果在渲染组件内 && 该渲染组件有自定义路由
|
|
81
|
+
} else if (hasRender && _.has($render, '$route')) {
|
|
82
|
+
|
|
83
|
+
// 设为渲染组件的路由
|
|
84
|
+
$route = $render.$route
|
|
85
|
+
|
|
86
|
+
// 否则获取当前路由
|
|
87
|
+
} else {
|
|
88
|
+
$route = utils.router.getRoute()
|
|
89
|
+
}
|
|
60
90
|
|
|
61
91
|
// quasar 对象
|
|
62
92
|
const $q = useQuasar()
|
|
@@ -165,12 +195,16 @@ function create(params) {
|
|
|
165
195
|
// 当前页面权限
|
|
166
196
|
data.powerPage = res.page
|
|
167
197
|
// 当前页面权限按钮
|
|
168
|
-
data.powerBtns = ref(res.btns)
|
|
198
|
+
data.powerBtns = ref(o.showPowerBtns ? res.btns : [])
|
|
169
199
|
// 当前页面工具栏权限按钮
|
|
170
200
|
data.toolbarPowerBtns = computed(function() {
|
|
171
201
|
|
|
172
|
-
|
|
173
|
-
|
|
202
|
+
if (
|
|
203
|
+
// 如果显示工具栏权限按钮
|
|
204
|
+
o.showToolbarPowerBtns
|
|
205
|
+
// 有权限按钮数据
|
|
206
|
+
&& utils.isValidArray(data.powerBtns.value)
|
|
207
|
+
) {
|
|
174
208
|
|
|
175
209
|
const lists = _.filter(formatBtns(data.powerBtns.value), e => e.type > 2)
|
|
176
210
|
|
|
@@ -673,7 +707,7 @@ function getRequestQuery(o) {
|
|
|
673
707
|
}
|
|
674
708
|
}
|
|
675
709
|
|
|
676
|
-
return _.
|
|
710
|
+
return _.cloneDeep(utils.numberDeep(query))
|
|
677
711
|
}
|
|
678
712
|
|
|
679
713
|
/**
|
|
@@ -696,15 +730,25 @@ function formatQuery(query, isJoinArr) {
|
|
|
696
730
|
|
|
697
731
|
// 如果是数组
|
|
698
732
|
} else if (utils.isValidArray(value)) {
|
|
733
|
+
|
|
699
734
|
const arr = []
|
|
700
735
|
for (const val of value) {
|
|
701
|
-
// 如果是数字
|
|
702
|
-
if (utils.isNumeric(val)) {
|
|
703
|
-
arr.push(_.isNumber(val) ? val : Number(val))
|
|
704
736
|
|
|
705
|
-
//
|
|
706
|
-
|
|
707
|
-
|
|
737
|
+
// 如果为有效值
|
|
738
|
+
if (utils.isRequired(val)) {
|
|
739
|
+
|
|
740
|
+
// 如果是数字
|
|
741
|
+
if (utils.isNumeric(val)) {
|
|
742
|
+
arr.push(_.isNumber(val) ? val : Number(val))
|
|
743
|
+
|
|
744
|
+
// 如果是字符串
|
|
745
|
+
} else if (utils.isValidString(val)) {
|
|
746
|
+
arr.push(utils.trimString(val))
|
|
747
|
+
|
|
748
|
+
// 否则为数组或对象
|
|
749
|
+
} else {
|
|
750
|
+
arr.push(val)
|
|
751
|
+
}
|
|
708
752
|
}
|
|
709
753
|
}
|
|
710
754
|
if (arr.length) {
|
package/utils/$search.js
CHANGED
|
@@ -25,7 +25,14 @@ export function setItemValue(value, val) {
|
|
|
25
25
|
// 比较类型为 in
|
|
26
26
|
value[0].type = dicts.SEARCH_TYPE__IN
|
|
27
27
|
// 设置值为将数组转为逗号分隔的字符串
|
|
28
|
-
value[0].value =
|
|
28
|
+
value[0].value = utils.join(val, ',')
|
|
29
|
+
|
|
30
|
+
// 如果值是逗号隔开
|
|
31
|
+
} else if (utils.split(val, ',').length > 1) {
|
|
32
|
+
// 比较类型为 in
|
|
33
|
+
value[0].type = dicts.SEARCH_TYPE__IN
|
|
34
|
+
// 设置值为将数组转为逗号分隔的字符串
|
|
35
|
+
value[0].value = val
|
|
29
36
|
|
|
30
37
|
// 否则为单个值
|
|
31
38
|
} else {
|
package/utils/$table.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
setItemValue,
|
|
10
10
|
} from './$search'
|
|
11
11
|
|
|
12
|
-
import { NPowerKey, NTableKey } from './symbols'
|
|
12
|
+
import { NRenderKey, NPowerKey, NTableKey } from './symbols'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* 创建表格
|
|
@@ -90,6 +90,18 @@ function create(params) {
|
|
|
90
90
|
rowDblClick: null,
|
|
91
91
|
}, params)
|
|
92
92
|
|
|
93
|
+
// 获取渲染注入
|
|
94
|
+
const $render = inject(NRenderKey)
|
|
95
|
+
|
|
96
|
+
// 如果有渲染注入
|
|
97
|
+
if (!! $render) {
|
|
98
|
+
// 如果有表格传参, 则合并参数
|
|
99
|
+
const tableProps = _.get($render, 'props.tableProps')
|
|
100
|
+
if (utils.isValidObject(tableProps)) {
|
|
101
|
+
_.merge(o, tableProps)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
// 获取权限注入
|
|
94
106
|
const $power = _.has(params, '$power') ? params.$power : inject(NPowerKey)
|
|
95
107
|
const hasPowr = !! $power
|