@netang/quasar 0.0.21 → 0.0.22
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/drawer/index.vue +54 -21
- package/components/empty/index.vue +23 -0
- package/components/power-page/index.vue +47 -0
- package/components/private/table-visible-columns-button/index.vue +105 -0
- package/components/table/index.vue +29 -92
- package/components/table-column-fixed/index.vue +20 -10
- package/components/table-pagination/index.vue +83 -3
- package/components/table-summary/index.vue +14 -2
- package/components/toolbar/index.vue +44 -304
- package/components/uploader/index.vue +6 -8
- package/components/uploader-query/index.vue +1 -3
- package/package.json +1 -1
- package/store/index.js +14 -0
- package/utils/$form.js +52 -0
- package/utils/{$role.js → $power.js} +313 -106
- package/utils/$table.js +65 -88
- package/utils/$tree.js +56 -32
- package/utils/http.js +5 -5
- package/utils/symbols.js +3 -0
- package/components/layout/index.vue +0 -126
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-drawer
|
|
3
|
-
v-model="
|
|
3
|
+
v-model="currentModelValue"
|
|
4
4
|
:side="side"
|
|
5
5
|
:breakpoint="breakpoint"
|
|
6
6
|
:width="currentWidth"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
|
-
import { ref, inject, nextTick } from 'vue'
|
|
23
|
+
import { ref, inject, nextTick, watch } from 'vue'
|
|
24
24
|
import { useQuasar } from 'quasar'
|
|
25
25
|
import { useRoute } from 'vue-router'
|
|
26
26
|
|
|
27
27
|
import { layoutKey, emptyRenderFn } from 'quasar/src/utils/private/symbols.js'
|
|
28
28
|
|
|
29
|
-
import {
|
|
29
|
+
import { NPowerKey } from '../../utils/symbols'
|
|
30
30
|
|
|
31
31
|
export default {
|
|
32
32
|
|
|
@@ -39,11 +39,15 @@ export default {
|
|
|
39
39
|
* 声明属性
|
|
40
40
|
*/
|
|
41
41
|
props: {
|
|
42
|
+
// 值
|
|
43
|
+
modelValue: Boolean,
|
|
44
|
+
// 位置
|
|
42
45
|
side: {
|
|
43
46
|
type: String,
|
|
44
47
|
default: 'left',
|
|
45
48
|
validator: v => [ 'left', 'right' ].includes(v)
|
|
46
49
|
},
|
|
50
|
+
// 宽度
|
|
47
51
|
width: {
|
|
48
52
|
type: Number,
|
|
49
53
|
default: 300
|
|
@@ -55,8 +59,6 @@ export default {
|
|
|
55
59
|
|
|
56
60
|
// 【自定义属性】
|
|
57
61
|
// --------------------------------------------------
|
|
58
|
-
// 是否显示
|
|
59
|
-
show: Boolean,
|
|
60
62
|
// 手机端宽度(px / %)
|
|
61
63
|
mobileWidth: {
|
|
62
64
|
type: [String, Number],
|
|
@@ -82,34 +84,49 @@ export default {
|
|
|
82
84
|
cache: [Boolean, String],
|
|
83
85
|
},
|
|
84
86
|
|
|
87
|
+
/**
|
|
88
|
+
* 声明事件
|
|
89
|
+
*/
|
|
90
|
+
emits: [
|
|
91
|
+
'update:modelValue',
|
|
92
|
+
],
|
|
93
|
+
|
|
85
94
|
/**
|
|
86
95
|
* 组合式
|
|
87
96
|
*/
|
|
88
|
-
setup(props) {
|
|
97
|
+
setup(props, { emit }) {
|
|
89
98
|
|
|
90
|
-
//
|
|
99
|
+
// ==========【数据】============================================================================================
|
|
91
100
|
|
|
92
101
|
// 获取 quasar 注入
|
|
93
|
-
const $
|
|
94
|
-
if ($
|
|
102
|
+
const $quasarLayout = inject(layoutKey, emptyRenderFn)
|
|
103
|
+
if ($quasarLayout === emptyRenderFn) {
|
|
95
104
|
console.error('NDrawer needs to be child of QLayout')
|
|
96
105
|
return emptyRenderFn
|
|
97
106
|
}
|
|
98
107
|
|
|
99
|
-
// 获取布局注入数据
|
|
100
|
-
const $nLayout = inject(NLayoutKey)
|
|
101
|
-
|
|
102
|
-
// ==========【数据】============================================================================================
|
|
103
|
-
|
|
104
108
|
// quasar 对象
|
|
105
109
|
const $q = useQuasar()
|
|
106
110
|
|
|
107
111
|
// 获取当前路由
|
|
108
112
|
const $route = useRoute()
|
|
109
113
|
|
|
114
|
+
// 获取权限注入数据
|
|
115
|
+
const $power = inject(NPowerKey)
|
|
116
|
+
|
|
110
117
|
// 是否显示
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
let currentModelValue
|
|
119
|
+
if ($power) {
|
|
120
|
+
currentModelValue = $power[`${props.side}Drawer`].modelValue
|
|
121
|
+
if ($q.screen.width < props.breakpoint) {
|
|
122
|
+
currentModelValue.value = false
|
|
123
|
+
emit('update:modelValue', false)
|
|
124
|
+
} else {
|
|
125
|
+
currentModelValue.value = props.modelValue
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
currentModelValue = ref(props.modelValue)
|
|
129
|
+
}
|
|
113
130
|
|
|
114
131
|
// 缓存名
|
|
115
132
|
let cacheName = ''
|
|
@@ -156,11 +173,27 @@ export default {
|
|
|
156
173
|
|
|
157
174
|
// 下次 DOM 更新
|
|
158
175
|
nextTick(function() {
|
|
159
|
-
if (
|
|
160
|
-
|
|
176
|
+
if (currentModelValue.value && $quasarLayout.totalWidth.value < props.breakpoint) {
|
|
177
|
+
currentModelValue.value = false
|
|
161
178
|
}
|
|
162
179
|
})
|
|
163
180
|
|
|
181
|
+
// ==========【监听数据】==========================================================================================
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 监听声明值
|
|
185
|
+
*/
|
|
186
|
+
watch(()=>props.modelValue, function (val) {
|
|
187
|
+
currentModelValue.value = val
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* 监听当前值
|
|
192
|
+
*/
|
|
193
|
+
watch(currentModelValue, function (val) {
|
|
194
|
+
emit('update:modelValue', val)
|
|
195
|
+
})
|
|
196
|
+
|
|
164
197
|
// ==========【方法】=============================================================================================
|
|
165
198
|
|
|
166
199
|
/**
|
|
@@ -190,7 +223,7 @@ export default {
|
|
|
190
223
|
|
|
191
224
|
// if (
|
|
192
225
|
// // 如果显示
|
|
193
|
-
//
|
|
226
|
+
// currentModelValue.value
|
|
194
227
|
// // 如果开启折叠
|
|
195
228
|
// && props.dragCollapse
|
|
196
229
|
// // 如果有最小宽度
|
|
@@ -200,7 +233,7 @@ export default {
|
|
|
200
233
|
//
|
|
201
234
|
// // 如果 拖拽宽度 < 折叠宽度
|
|
202
235
|
// if (dragWidth < collapseWidth) {
|
|
203
|
-
//
|
|
236
|
+
// currentModelValue.value = false
|
|
204
237
|
// }
|
|
205
238
|
// }
|
|
206
239
|
|
|
@@ -218,7 +251,7 @@ export default {
|
|
|
218
251
|
|
|
219
252
|
return {
|
|
220
253
|
// 是否显示
|
|
221
|
-
|
|
254
|
+
currentModelValue,
|
|
222
255
|
// 当前宽度
|
|
223
256
|
currentWidth,
|
|
224
257
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="q-pa-lg flex flex-center absolute-full">
|
|
3
|
+
{{emptyDescription || '发生未知错误'}}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 标识
|
|
12
|
+
*/
|
|
13
|
+
name: 'NEmpty',
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 声明属性
|
|
17
|
+
*/
|
|
18
|
+
props: {
|
|
19
|
+
// 空状态描述
|
|
20
|
+
emptyDescription: String,
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-page
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
>
|
|
5
|
+
<!-- 空数据 -->
|
|
6
|
+
<n-empty
|
|
7
|
+
:empty-description="emptyDescription"
|
|
8
|
+
v-if="pageStatus === false"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<!-- 插槽 -->
|
|
12
|
+
<slot v-else-if="pageStatus === true" />
|
|
13
|
+
|
|
14
|
+
<!-- 加载 -->
|
|
15
|
+
<q-inner-loading
|
|
16
|
+
:showing="pageLoading"
|
|
17
|
+
/>
|
|
18
|
+
</q-page>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { inject } from 'vue'
|
|
23
|
+
import { NPowerKey } from '../../utils/symbols'
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 标识
|
|
29
|
+
*/
|
|
30
|
+
name: 'NPowerPage',
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 组合式
|
|
34
|
+
*/
|
|
35
|
+
setup() {
|
|
36
|
+
// ==========【数据】============================================================================================
|
|
37
|
+
|
|
38
|
+
// 获取注入权限数据
|
|
39
|
+
const $power = inject(NPowerKey)
|
|
40
|
+
|
|
41
|
+
// ==========【返回】============================================================================================
|
|
42
|
+
return {
|
|
43
|
+
...$power,
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 表格筛选可见列按钮-->
|
|
3
|
+
<q-btn
|
|
4
|
+
icon="checklist"
|
|
5
|
+
dense
|
|
6
|
+
round
|
|
7
|
+
flat
|
|
8
|
+
v-if="tableColumns.length"
|
|
9
|
+
>
|
|
10
|
+
<q-menu
|
|
11
|
+
self="top middle"
|
|
12
|
+
:offset="[0, 8]"
|
|
13
|
+
>
|
|
14
|
+
<q-list style="min-width: 250px" dense bordered>
|
|
15
|
+
|
|
16
|
+
<!-- 表格宫格 -->
|
|
17
|
+
<template v-if="tableGrid !== null">
|
|
18
|
+
<q-item
|
|
19
|
+
clickable
|
|
20
|
+
@click="tableGrid = ! tableGrid"
|
|
21
|
+
>
|
|
22
|
+
<q-item-section>宫格模式</q-item-section>
|
|
23
|
+
<q-item-section side>
|
|
24
|
+
<q-icon
|
|
25
|
+
size="xs"
|
|
26
|
+
name="check"
|
|
27
|
+
v-show="tableGrid"
|
|
28
|
+
/>
|
|
29
|
+
</q-item-section>
|
|
30
|
+
</q-item>
|
|
31
|
+
<q-separator />
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<!-- 筛选表格列 -->
|
|
35
|
+
<q-item
|
|
36
|
+
v-for="item in tableColumns"
|
|
37
|
+
clickable
|
|
38
|
+
@click="onTableVisible(item)"
|
|
39
|
+
>
|
|
40
|
+
<q-item-section>{{item.label}}</q-item-section>
|
|
41
|
+
<q-item-section side>
|
|
42
|
+
<q-icon
|
|
43
|
+
size="xs"
|
|
44
|
+
name="check"
|
|
45
|
+
v-show="utils.indexOf(tableVisibleColumns, item.name) > -1"
|
|
46
|
+
/>
|
|
47
|
+
</q-item-section>
|
|
48
|
+
</q-item>
|
|
49
|
+
</q-list>
|
|
50
|
+
</q-menu>
|
|
51
|
+
</q-btn>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
import { inject } from 'vue'
|
|
56
|
+
|
|
57
|
+
import { NTableKey } from '../../../utils/symbols'
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 组合式
|
|
63
|
+
*/
|
|
64
|
+
setup() {
|
|
65
|
+
|
|
66
|
+
// ==========【方法】=============================================================================================
|
|
67
|
+
|
|
68
|
+
// 获取表格注入数据
|
|
69
|
+
const {
|
|
70
|
+
// 表格列数据(对象数组)
|
|
71
|
+
tableColumns,
|
|
72
|
+
// 表格可见列
|
|
73
|
+
tableVisibleColumns,
|
|
74
|
+
// 表格宫格
|
|
75
|
+
tableGrid,
|
|
76
|
+
} = inject(NTableKey)
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 表格可见列点击
|
|
80
|
+
*/
|
|
81
|
+
function onTableVisible(item) {
|
|
82
|
+
const index = utils.indexOf(tableVisibleColumns.value, item.name)
|
|
83
|
+
if (index > -1) {
|
|
84
|
+
tableVisibleColumns.value.splice(index, 1)
|
|
85
|
+
} else {
|
|
86
|
+
tableVisibleColumns.value.push(item.name)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ==========【返回】=============================================================================================
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
// 表格列数据(对象数组)
|
|
94
|
+
tableColumns,
|
|
95
|
+
// 表格可见列
|
|
96
|
+
tableVisibleColumns,
|
|
97
|
+
// 表格宫格
|
|
98
|
+
tableGrid,
|
|
99
|
+
|
|
100
|
+
// 表格可见列点击
|
|
101
|
+
onTableVisible,
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
@@ -1,37 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<q-layout
|
|
3
3
|
class="absolute-full"
|
|
4
4
|
:class="{
|
|
5
5
|
'n-table--grid': tableGrid,
|
|
6
6
|
}"
|
|
7
7
|
view="lHr LpR lff"
|
|
8
8
|
container
|
|
9
|
-
:page-status="pageStatus"
|
|
10
|
-
:empty-description="emptyDescription"
|
|
11
9
|
>
|
|
12
10
|
<!-- 头部 -->
|
|
13
|
-
<n-toolbar
|
|
14
|
-
|
|
15
|
-
:model-value="roleBtnLists"
|
|
16
|
-
v-model:table-grid="tableGrid"
|
|
17
|
-
v-model:table-visible-columns="tableVisibleColumns"
|
|
18
|
-
:query="tableQuery"
|
|
19
|
-
:table-columns="tableColumns"
|
|
20
|
-
:table-selected="tableSelected"
|
|
21
|
-
:table-refresh="tableRefresh"
|
|
22
|
-
v-bind="toolbarProps"
|
|
23
|
-
header
|
|
24
|
-
>
|
|
25
|
-
</n-toolbar>
|
|
11
|
+
<n-toolbar header />
|
|
12
|
+
|
|
26
13
|
<!-- 左侧分类 -->
|
|
27
14
|
<n-drawer
|
|
15
|
+
:model-value="true"
|
|
28
16
|
side="left"
|
|
29
17
|
:width="200"
|
|
30
18
|
:min-width="150"
|
|
31
19
|
bordered
|
|
32
|
-
show
|
|
33
20
|
drag
|
|
34
|
-
|
|
21
|
+
cache
|
|
35
22
|
v-if="treeNodes.length"
|
|
36
23
|
>
|
|
37
24
|
<q-scroll-area class="absolute-full">
|
|
@@ -121,7 +108,6 @@
|
|
|
121
108
|
<template v-slot:body-cell-settings="props">
|
|
122
109
|
<n-table-column-fixed
|
|
123
110
|
:props="props"
|
|
124
|
-
:role-btn-lists="tableFixedRoleBtnLists"
|
|
125
111
|
/>
|
|
126
112
|
</template>
|
|
127
113
|
|
|
@@ -129,8 +115,6 @@
|
|
|
129
115
|
<template v-slot:bottom-row="props" v-if="tableSummary">
|
|
130
116
|
<n-table-summary
|
|
131
117
|
:props="props"
|
|
132
|
-
:data="tableSummary"
|
|
133
|
-
:selection="tableSelection"
|
|
134
118
|
/>
|
|
135
119
|
</template>
|
|
136
120
|
|
|
@@ -138,7 +122,6 @@
|
|
|
138
122
|
<template v-slot:pagination="props">
|
|
139
123
|
<n-table-pagination
|
|
140
124
|
:props="props"
|
|
141
|
-
:table-refresh="tableRefresh"
|
|
142
125
|
/>
|
|
143
126
|
</template>
|
|
144
127
|
</q-table>
|
|
@@ -147,12 +130,12 @@
|
|
|
147
130
|
|
|
148
131
|
<!-- 右侧搜索 -->
|
|
149
132
|
<n-drawer
|
|
133
|
+
:model-value="true"
|
|
150
134
|
side="right"
|
|
151
135
|
:min-width="320"
|
|
152
136
|
bordered
|
|
153
137
|
drag
|
|
154
|
-
|
|
155
|
-
show
|
|
138
|
+
cache
|
|
156
139
|
v-if="! noSearch && tableSearchValue.length"
|
|
157
140
|
>
|
|
158
141
|
<!-- 搜索 -->
|
|
@@ -163,14 +146,13 @@
|
|
|
163
146
|
:on-reset="tableSearchReset"
|
|
164
147
|
/>
|
|
165
148
|
</n-drawer>
|
|
166
|
-
</
|
|
149
|
+
</q-layout>
|
|
167
150
|
</template>
|
|
168
151
|
|
|
169
152
|
<script>
|
|
170
|
-
import { ref,
|
|
171
|
-
import { useRoute } from 'vue-router'
|
|
153
|
+
import { ref, watch, computed, inject } from 'vue'
|
|
172
154
|
|
|
173
|
-
import {
|
|
155
|
+
import { NPowerKey, NTableKey } from '../../utils/symbols'
|
|
174
156
|
|
|
175
157
|
export default {
|
|
176
158
|
|
|
@@ -185,10 +167,6 @@ export default {
|
|
|
185
167
|
props: {
|
|
186
168
|
// 表格请求地址
|
|
187
169
|
url: String,
|
|
188
|
-
// 表格参数
|
|
189
|
-
tableParams: Object,
|
|
190
|
-
// 权限按钮列表
|
|
191
|
-
roleBtnLists: Array,
|
|
192
170
|
// 树节点唯一键值
|
|
193
171
|
treeNodeKey: {
|
|
194
172
|
type: String,
|
|
@@ -208,44 +186,21 @@ export default {
|
|
|
208
186
|
treeNodeClick: Function,
|
|
209
187
|
// 显示树筛选
|
|
210
188
|
treeFilter: Boolean,
|
|
211
|
-
// 页面状态
|
|
212
|
-
pageStatus: {
|
|
213
|
-
type: Boolean,
|
|
214
|
-
default: null,
|
|
215
|
-
},
|
|
216
|
-
// 空状态描述
|
|
217
|
-
emptyDescription: {
|
|
218
|
-
type: String,
|
|
219
|
-
default: '发生未知错误',
|
|
220
|
-
},
|
|
221
|
-
// 工具栏声明属性
|
|
222
|
-
toolbarProps: Object,
|
|
223
189
|
// 不显示搜索
|
|
224
190
|
noSearch: Boolean,
|
|
225
|
-
// 表格加载回调
|
|
226
|
-
load: Function,
|
|
227
191
|
},
|
|
228
192
|
|
|
229
|
-
/**
|
|
230
|
-
* 声明事件
|
|
231
|
-
*/
|
|
232
|
-
emits: [
|
|
233
|
-
// 表格加载回调
|
|
234
|
-
'load',
|
|
235
|
-
],
|
|
236
|
-
|
|
237
193
|
/**
|
|
238
194
|
* 组合式
|
|
239
195
|
*/
|
|
240
|
-
setup(props, {
|
|
196
|
+
setup(props, { slots }) {
|
|
241
197
|
|
|
242
|
-
//
|
|
198
|
+
// ==========【数据】============================================================================================
|
|
243
199
|
|
|
244
|
-
//
|
|
245
|
-
const $
|
|
246
|
-
const inFieldTable = !! $fieldTable
|
|
200
|
+
// 获取权限注入
|
|
201
|
+
const $power = inject(NPowerKey)
|
|
247
202
|
|
|
248
|
-
|
|
203
|
+
const $table = inject(NTableKey)
|
|
249
204
|
|
|
250
205
|
// 树节点
|
|
251
206
|
const treeRef = ref(null)
|
|
@@ -257,23 +212,18 @@ export default {
|
|
|
257
212
|
const treeSelected = ref('')
|
|
258
213
|
|
|
259
214
|
// 当前请求地址
|
|
260
|
-
const currentUrl = ref(props.url ? props.url : useRoute().fullPath)
|
|
261
|
-
|
|
262
|
-
// 表格参数
|
|
263
|
-
const tableParams = Object.assign({}, props.tableParams, {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
//
|
|
271
|
-
|
|
272
|
-
tableParams.search = false
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
// 创建表格
|
|
276
|
-
const $table = inFieldTable ? $fieldTable.$table : utils.$table.create(tableParams)
|
|
215
|
+
// const currentUrl = ref(props.url ? props.url : useRoute().fullPath)
|
|
216
|
+
|
|
217
|
+
// // 表格参数
|
|
218
|
+
// const tableParams = Object.assign({}, props.tableParams, {
|
|
219
|
+
// // 请求地址
|
|
220
|
+
// url: currentUrl.value,
|
|
221
|
+
// })
|
|
222
|
+
//
|
|
223
|
+
// // 如果不显示搜索
|
|
224
|
+
// if (props.noSearch) {
|
|
225
|
+
// tableParams.search = false
|
|
226
|
+
// }
|
|
277
227
|
|
|
278
228
|
// ==========【计算属性】==========================================================================================
|
|
279
229
|
|
|
@@ -320,21 +270,11 @@ export default {
|
|
|
320
270
|
})
|
|
321
271
|
}
|
|
322
272
|
|
|
323
|
-
// ==========【生命周期】=========================================================================================
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* 实例被挂载后调用
|
|
327
|
-
*/
|
|
328
|
-
onMounted( async function() {
|
|
329
|
-
|
|
330
|
-
// 表格加载回调
|
|
331
|
-
emit('load', { $table })
|
|
332
|
-
await utils.runAsync(props.load)({ $table })
|
|
333
|
-
})
|
|
334
|
-
|
|
335
273
|
// ==========【返回】=============================================================================================
|
|
336
274
|
|
|
337
275
|
return {
|
|
276
|
+
// 解构权限实例
|
|
277
|
+
...$power,
|
|
338
278
|
// 解构表格实例
|
|
339
279
|
...$table,
|
|
340
280
|
|
|
@@ -345,9 +285,6 @@ export default {
|
|
|
345
285
|
// 树选择数据
|
|
346
286
|
treeSelected,
|
|
347
287
|
|
|
348
|
-
// 当前请求地址
|
|
349
|
-
currentUrl,
|
|
350
|
-
|
|
351
288
|
// 插槽 body 单元格标识
|
|
352
289
|
slotNames,
|
|
353
290
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-td :props="props">
|
|
3
|
-
<div class="q-gutter-sm">
|
|
3
|
+
<div class="q-gutter-sm" v-if="tableFixedPowerBtns.length">
|
|
4
4
|
<q-btn
|
|
5
|
-
v-for="item in
|
|
5
|
+
v-for="item in tableFixedPowerBtns"
|
|
6
6
|
:key="`btn-item-${item.id}`"
|
|
7
7
|
class="n-button-icon"
|
|
8
8
|
:icon="item.icon"
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
21
|
import { inject } from 'vue'
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
import { NPowerKey, NTableKey } from '../../utils/symbols'
|
|
23
24
|
|
|
24
25
|
export default {
|
|
25
26
|
|
|
@@ -34,8 +35,6 @@ export default {
|
|
|
34
35
|
props: {
|
|
35
36
|
// 传值
|
|
36
37
|
props: Object,
|
|
37
|
-
// 权限按钮列表
|
|
38
|
-
roleBtnLists: Array,
|
|
39
38
|
},
|
|
40
39
|
|
|
41
40
|
/**
|
|
@@ -43,10 +42,19 @@ export default {
|
|
|
43
42
|
*/
|
|
44
43
|
setup(props) {
|
|
45
44
|
|
|
46
|
-
//
|
|
45
|
+
// ==========【数据】============================================================================================
|
|
46
|
+
|
|
47
|
+
// 获取权限注入
|
|
48
|
+
const {
|
|
49
|
+
// 权限按钮点击
|
|
50
|
+
powerBtnClick,
|
|
51
|
+
} = inject(NPowerKey)
|
|
47
52
|
|
|
48
|
-
//
|
|
49
|
-
const
|
|
53
|
+
// 获取表格注入
|
|
54
|
+
const {
|
|
55
|
+
// 固定在右边的权限按钮列表
|
|
56
|
+
tableFixedPowerBtns,
|
|
57
|
+
} = inject(NTableKey)
|
|
50
58
|
|
|
51
59
|
// ==========【方法】=============================================================================================
|
|
52
60
|
|
|
@@ -54,13 +62,15 @@ export default {
|
|
|
54
62
|
* 点击
|
|
55
63
|
*/
|
|
56
64
|
function onClick(item) {
|
|
57
|
-
|
|
65
|
+
powerBtnClick(item, [ props.props.row ])
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
// ==========【返回】=============================================================================================
|
|
61
69
|
|
|
62
70
|
return {
|
|
63
|
-
//
|
|
71
|
+
// 固定在右边的权限按钮列表
|
|
72
|
+
tableFixedPowerBtns,
|
|
73
|
+
// 权限按钮点击
|
|
64
74
|
onClick,
|
|
65
75
|
}
|
|
66
76
|
},
|