@netang/quasar 0.0.49 → 0.0.51
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/data/index.vue +23 -23
- package/components/editor-code/index.vue +282 -0
- package/components/empty/index.vue +22 -3
- package/components/private/edit-power-data/index.vue +337 -289
- package/components/table-splitter/index.vue +1 -1
- package/package.json +1 -1
- package/sass/quasar/field.scss +5 -0
- package/sass/quasar/table.scss +6 -0
- package/utils/$power.js +8 -8
- package/utils/$table.js +17 -2
- package/utils/$tree.js +37 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot :data="data" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
/**
|
|
8
|
-
* 标识
|
|
9
|
-
*/
|
|
10
|
-
name: 'NData',
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 传参
|
|
14
|
-
*/
|
|
15
|
-
props: {
|
|
16
|
-
// 数据
|
|
17
|
-
data: {},
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<slot :data="data" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
/**
|
|
8
|
+
* 标识
|
|
9
|
+
*/
|
|
10
|
+
name: 'NData',
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 传参
|
|
14
|
+
*/
|
|
15
|
+
props: {
|
|
16
|
+
// 数据
|
|
17
|
+
data: {},
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- :style="currentStyle" -->
|
|
3
|
+
<div
|
|
4
|
+
ref="targetRef"
|
|
5
|
+
:style="currentStyle"
|
|
6
|
+
></div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { ref, watch, computed, onMounted } from 'vue'
|
|
11
|
+
|
|
12
|
+
import script from '@netang/utils/script'
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 标识
|
|
18
|
+
*/
|
|
19
|
+
name: 'NEditorCode',
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 声明属性
|
|
23
|
+
*/
|
|
24
|
+
props: {
|
|
25
|
+
// 值 v-model
|
|
26
|
+
modelValue: {
|
|
27
|
+
type: [ String, Number ],
|
|
28
|
+
default: '',
|
|
29
|
+
},
|
|
30
|
+
// 宽度
|
|
31
|
+
width: {
|
|
32
|
+
type: [ String, Number ],
|
|
33
|
+
default: '100%',
|
|
34
|
+
},
|
|
35
|
+
// 高度
|
|
36
|
+
height: [ String, Number ],
|
|
37
|
+
// 脚本语言
|
|
38
|
+
language: String,
|
|
39
|
+
// 是否只读
|
|
40
|
+
readonly: Boolean,
|
|
41
|
+
// 代码视图
|
|
42
|
+
minimap: Boolean,
|
|
43
|
+
// tab 长度
|
|
44
|
+
tabSize: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 4,
|
|
47
|
+
},
|
|
48
|
+
// 主题
|
|
49
|
+
theme: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'vs',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 声明事件
|
|
57
|
+
*/
|
|
58
|
+
emits: [
|
|
59
|
+
'update:modelValue',
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 组合式
|
|
64
|
+
*/
|
|
65
|
+
setup(props, { emit }) {
|
|
66
|
+
|
|
67
|
+
// ==========【计算属性】=========================================================================================
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 当前样式
|
|
71
|
+
*/
|
|
72
|
+
const currentStyle = computed(function () {
|
|
73
|
+
return {
|
|
74
|
+
width: $n.isNumeric(props.width) ? $n.px(props.width) : props.width,
|
|
75
|
+
height: $n.isNumeric(props.height) ? $n.px(props.height) : props.height,
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// ==========【数据】=============================================================================================
|
|
80
|
+
|
|
81
|
+
// 根节点
|
|
82
|
+
const targetRef = ref(null)
|
|
83
|
+
|
|
84
|
+
// 编辑器实例
|
|
85
|
+
let $editor = null
|
|
86
|
+
|
|
87
|
+
// 停止值观察
|
|
88
|
+
let stopValueWatcher = false
|
|
89
|
+
|
|
90
|
+
// 创建防抖睡眠方法
|
|
91
|
+
const sleep = $n.debounceSleep()
|
|
92
|
+
|
|
93
|
+
// ==========【监听数据】=========================================================================================
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 监听声明值
|
|
97
|
+
*/
|
|
98
|
+
watch(() => props.modelValue, function (val) {
|
|
99
|
+
|
|
100
|
+
// 如果停止值观察
|
|
101
|
+
if (stopValueWatcher) {
|
|
102
|
+
|
|
103
|
+
// 则无任何操作
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 取消停止值观察
|
|
108
|
+
stopValueWatcher = false
|
|
109
|
+
|
|
110
|
+
// 设置值
|
|
111
|
+
setValue(val)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// ==========【方法】============================================================================================
|
|
115
|
+
|
|
116
|
+
function load() {
|
|
117
|
+
|
|
118
|
+
// 如果已加载
|
|
119
|
+
if (window.monaco) {
|
|
120
|
+
// 创建编辑器
|
|
121
|
+
create()
|
|
122
|
+
return
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 版本
|
|
126
|
+
const version = '0.34.1'
|
|
127
|
+
|
|
128
|
+
// 加载 script
|
|
129
|
+
script([
|
|
130
|
+
[
|
|
131
|
+
`https://cdn.staticfile.org/monaco-editor/${version}/min/vs/loader.js`,
|
|
132
|
+
`https://fastly.jsdelivr.net/npm/monaco-editor@${version}/min/vs/loader.js`,
|
|
133
|
+
`https://unpkg.com/monaco-editor@${version}/min/vs/loader.js`,
|
|
134
|
+
]
|
|
135
|
+
])
|
|
136
|
+
.then(function ([ url ]) {
|
|
137
|
+
|
|
138
|
+
// 按需加载
|
|
139
|
+
const _require = window.require
|
|
140
|
+
|
|
141
|
+
// 配置
|
|
142
|
+
_require.config({
|
|
143
|
+
// 路径
|
|
144
|
+
paths: {
|
|
145
|
+
vs: url.replace('/loader.js', ''),
|
|
146
|
+
},
|
|
147
|
+
// 语言
|
|
148
|
+
'vs/nls' : {
|
|
149
|
+
availableLanguages: {
|
|
150
|
+
'*': 'zh-cn',
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
// 加载
|
|
156
|
+
_require(['vs/editor/editor.main'], function () {
|
|
157
|
+
// 创建编辑器
|
|
158
|
+
create()
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 创建编辑器
|
|
165
|
+
*/
|
|
166
|
+
function create() {
|
|
167
|
+
|
|
168
|
+
// 创建编辑器
|
|
169
|
+
$editor = monaco.editor.create(targetRef.value, {
|
|
170
|
+
// 主题
|
|
171
|
+
theme: props.theme,
|
|
172
|
+
// 脚本语言
|
|
173
|
+
language: props.language,
|
|
174
|
+
// 自动布局
|
|
175
|
+
automaticLayout: true,
|
|
176
|
+
// 自动换行
|
|
177
|
+
wordWrap: 'on',
|
|
178
|
+
// tab 长度
|
|
179
|
+
tabSize: props.tabSize,
|
|
180
|
+
// 代码略缩图
|
|
181
|
+
minimap: {
|
|
182
|
+
enabled: props.minimap,
|
|
183
|
+
},
|
|
184
|
+
// 右键
|
|
185
|
+
contextmenu: true,
|
|
186
|
+
// 是否只读
|
|
187
|
+
readOnly: props.readonly,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// 监听失去焦点事件
|
|
191
|
+
$editor.onDidBlurEditorText(function () {
|
|
192
|
+
|
|
193
|
+
// 获取编辑器内容
|
|
194
|
+
const value = getValue()
|
|
195
|
+
if (value === void 0) {
|
|
196
|
+
return
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 停止值观察
|
|
200
|
+
stopValueWatcher = true
|
|
201
|
+
|
|
202
|
+
// 触发更新值
|
|
203
|
+
emit('update:modelValue', value)
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
// 等编辑器全部加载完成后, 设置内容值
|
|
207
|
+
sleep(300)
|
|
208
|
+
.then(function () {
|
|
209
|
+
// 设置值
|
|
210
|
+
setValue(props.modelValue)
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 设置值
|
|
216
|
+
*/
|
|
217
|
+
function setValue(value) {
|
|
218
|
+
if ($editor) {
|
|
219
|
+
|
|
220
|
+
// 编辑器设置内容
|
|
221
|
+
$editor.setValue(value)
|
|
222
|
+
|
|
223
|
+
// 代码格式化
|
|
224
|
+
$editor.getAction('editor.action.formatDocument').run()
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 获取值
|
|
230
|
+
*/
|
|
231
|
+
function getValue() {
|
|
232
|
+
|
|
233
|
+
if ($editor) {
|
|
234
|
+
|
|
235
|
+
// 获取编辑器的值
|
|
236
|
+
let value = $editor.getValue()
|
|
237
|
+
|
|
238
|
+
// 如果语言为 json
|
|
239
|
+
if (
|
|
240
|
+
props.language === 'json'
|
|
241
|
+
&& $n.isValidValue(value)
|
|
242
|
+
) {
|
|
243
|
+
try {
|
|
244
|
+
value = JSON.stringify(JSON.parse(value))
|
|
245
|
+
|
|
246
|
+
} catch (e) {
|
|
247
|
+
// 轻提示
|
|
248
|
+
$n.toast({
|
|
249
|
+
message: 'JSON 语法错误'
|
|
250
|
+
})
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return value
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return ''
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ==========【生命周期】=========================================================================================
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 实例被挂载后调用
|
|
265
|
+
*/
|
|
266
|
+
onMounted(function() {
|
|
267
|
+
|
|
268
|
+
// 加载
|
|
269
|
+
load()
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
// ==========【返回】=========================================================================================
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
// 根节点
|
|
276
|
+
targetRef,
|
|
277
|
+
// 当前样式
|
|
278
|
+
currentStyle,
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
</script>
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="q-pa-lg
|
|
3
|
-
|
|
2
|
+
<div class="q-pa-lg column flex-center absolute-full q-gutter-sm">
|
|
3
|
+
|
|
4
|
+
<!-- 图标 -->
|
|
5
|
+
<q-icon
|
|
6
|
+
:name="icon"
|
|
7
|
+
color="grey-5"
|
|
8
|
+
:size="$n.px(iconSize)"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<!-- 描述文字 -->
|
|
12
|
+
<div class="text-subtitle1 text-grey-7" v-if="description">{{description}}</div>
|
|
4
13
|
</div>
|
|
5
14
|
</template>
|
|
6
15
|
|
|
@@ -16,7 +25,17 @@ export default {
|
|
|
16
25
|
* 声明属性
|
|
17
26
|
*/
|
|
18
27
|
props: {
|
|
19
|
-
//
|
|
28
|
+
// 图标
|
|
29
|
+
icon: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: 'info',
|
|
32
|
+
},
|
|
33
|
+
// 图标大小
|
|
34
|
+
iconSize: {
|
|
35
|
+
type: [ String, Number ],
|
|
36
|
+
default: 70,
|
|
37
|
+
},
|
|
38
|
+
// 描述文字
|
|
20
39
|
description: String,
|
|
21
40
|
},
|
|
22
41
|
}
|
|
@@ -10,38 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
<template v-if="dataType">
|
|
12
12
|
|
|
13
|
-
<!--
|
|
14
|
-
<template v-if="dataType === dicts.
|
|
13
|
+
<!-- 列表有效 -->
|
|
14
|
+
<template v-if="dataType === dicts.POWER_DATA_TYPE__LIST">
|
|
15
15
|
|
|
16
|
-
<!--
|
|
17
|
-
<div class="col-xs-12 col-sm-6 col-md-3" v-if="routeType === 0">
|
|
18
|
-
|
|
19
|
-
<!-- 树 -->
|
|
20
|
-
<n-field-tree
|
|
21
|
-
class="n-field-fieldset"
|
|
22
|
-
label="跳转页面"
|
|
23
|
-
outlined
|
|
24
|
-
clearable
|
|
25
|
-
stack-label
|
|
26
|
-
dense
|
|
27
|
-
|
|
28
|
-
v-model="formData.toPage"
|
|
29
|
-
:nodes="treeNodes"
|
|
30
|
-
:expanded="treeExpanded"
|
|
31
|
-
strict
|
|
32
|
-
accordion
|
|
33
|
-
/>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<!-- 是否记录来源页面 -->
|
|
16
|
+
<!-- 列表选择类型 -->
|
|
37
17
|
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
38
18
|
<q-select
|
|
39
19
|
class="n-field-fieldset"
|
|
40
|
-
label="
|
|
41
|
-
v-model="formData.
|
|
20
|
+
label="选择类型"
|
|
21
|
+
v-model="formData.selection"
|
|
42
22
|
:options="[
|
|
43
|
-
{ label: '
|
|
44
|
-
{ label: '
|
|
23
|
+
{ label: '无', value: 'none' },
|
|
24
|
+
{ label: '单选', value: 'single' },
|
|
25
|
+
{ label: '多选', value: 'multiple' },
|
|
45
26
|
]"
|
|
46
27
|
map-options
|
|
47
28
|
emit-value
|
|
@@ -54,172 +35,254 @@
|
|
|
54
35
|
|
|
55
36
|
</template>
|
|
56
37
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
<template v-else>
|
|
39
|
+
|
|
40
|
+
<!-- 新窗口有效 -->
|
|
41
|
+
<template v-if="dataType === dicts.POWER_DATA_TYPE__OPEN">
|
|
42
|
+
|
|
43
|
+
<!-- 设置跳转页面(没有路由类型) -->
|
|
44
|
+
<div class="col-xs-12 col-sm-6 col-md-3" v-if="routeType === 0">
|
|
45
|
+
|
|
46
|
+
<!-- 树 -->
|
|
47
|
+
<n-field-tree
|
|
48
|
+
class="n-field-fieldset"
|
|
49
|
+
label="跳转页面"
|
|
50
|
+
outlined
|
|
51
|
+
clearable
|
|
52
|
+
stack-label
|
|
53
|
+
dense
|
|
54
|
+
|
|
55
|
+
v-model="formData.toPage"
|
|
56
|
+
:nodes="treeNodes"
|
|
57
|
+
:expanded="treeExpanded"
|
|
58
|
+
strict
|
|
59
|
+
accordion
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<!-- 是否记录来源页面 -->
|
|
64
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
65
|
+
<q-select
|
|
66
|
+
class="n-field-fieldset"
|
|
67
|
+
label="是否增加来源页面参数"
|
|
68
|
+
v-model="formData.addFromPageQuery"
|
|
69
|
+
:options="[
|
|
70
|
+
{ label: '否', value: false },
|
|
71
|
+
{ label: '是', value: true },
|
|
72
|
+
]"
|
|
73
|
+
map-options
|
|
74
|
+
emit-value
|
|
75
|
+
outlined
|
|
76
|
+
stack-label
|
|
77
|
+
dense
|
|
78
|
+
options-dense
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<!-- 非表单显示 -->
|
|
85
|
+
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
86
|
+
|
|
87
|
+
<!-- 显示类型 -->
|
|
88
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
89
|
+
<q-select
|
|
90
|
+
class="n-field-fieldset"
|
|
91
|
+
label="显示类型"
|
|
92
|
+
v-model="formData.show"
|
|
93
|
+
:options="[
|
|
94
|
+
{ label: '始终显示', value: '' },
|
|
95
|
+
{ label: '单选显示', value: 'single' },
|
|
96
|
+
{ label: '多选显示', value: 'multiple' },
|
|
97
|
+
]"
|
|
98
|
+
map-options
|
|
99
|
+
emit-value
|
|
100
|
+
outlined
|
|
101
|
+
stack-label
|
|
102
|
+
dense
|
|
103
|
+
options-dense
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<!-- 是否固定列 -->
|
|
108
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
109
|
+
<q-select
|
|
110
|
+
class="n-field-fieldset"
|
|
111
|
+
label="是否固定列"
|
|
112
|
+
v-model="formData.fixed"
|
|
113
|
+
:options="[
|
|
114
|
+
{ label: '否', value: false },
|
|
115
|
+
{ label: '是', value: true },
|
|
116
|
+
]"
|
|
117
|
+
map-options
|
|
118
|
+
emit-value
|
|
119
|
+
outlined
|
|
120
|
+
stack-label
|
|
121
|
+
dense
|
|
122
|
+
options-dense
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<!-- 是否双击 -->
|
|
127
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
128
|
+
<q-select
|
|
129
|
+
class="n-field-fieldset"
|
|
130
|
+
label="是否双击"
|
|
131
|
+
v-model="formData.dbclick"
|
|
132
|
+
:options="[
|
|
133
|
+
{ label: '否', value: false },
|
|
134
|
+
{ label: '是', value: true },
|
|
135
|
+
]"
|
|
136
|
+
map-options
|
|
137
|
+
emit-value
|
|
138
|
+
outlined
|
|
139
|
+
stack-label
|
|
140
|
+
dense
|
|
141
|
+
options-dense
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
</template>
|
|
145
|
+
|
|
146
|
+
<!-- 如果为非新窗口 -->
|
|
147
|
+
<template v-if="dataType !== dicts.POWER_DATA_TYPE__OPEN">
|
|
148
|
+
|
|
149
|
+
<!-- 是否确认 -->
|
|
150
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
151
|
+
<q-select
|
|
152
|
+
class="n-field-fieldset"
|
|
153
|
+
label="提交前确认"
|
|
154
|
+
v-model="formData.confirm"
|
|
155
|
+
:options="[
|
|
156
|
+
{ label: '否', value: 0 },
|
|
157
|
+
{ label: '提交前确认', value: 1 },
|
|
158
|
+
{ label: '提交前确认登录密码', value: 2 },
|
|
70
159
|
]"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
/>
|
|
184
|
-
</div>
|
|
185
|
-
|
|
186
|
-
<!-- 请求成功参数 -->
|
|
187
|
-
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$n.indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
|
|
188
|
-
|
|
189
|
-
<!-- <!– 树 –>-->
|
|
190
|
-
<!-- <n-field-tree-->
|
|
191
|
-
<!-- class="n-field-fieldset"-->
|
|
192
|
-
<!-- label="跳转页面"-->
|
|
193
|
-
<!-- outlined-->
|
|
194
|
-
<!-- clearable-->
|
|
195
|
-
<!-- stack-label-->
|
|
196
|
-
<!-- dense-->
|
|
197
|
-
|
|
198
|
-
<!-- v-model="formData.requestSuccess.params"-->
|
|
199
|
-
<!-- :nodes="treeNodes"-->
|
|
200
|
-
<!-- :expanded="treeExpanded"-->
|
|
201
|
-
<!-- strict-->
|
|
202
|
-
<!-- accordion-->
|
|
203
|
-
<!-- />-->
|
|
204
|
-
<!--</div>-->
|
|
205
|
-
|
|
206
|
-
</template>
|
|
207
|
-
|
|
208
|
-
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
160
|
+
map-options
|
|
161
|
+
emit-value
|
|
162
|
+
outlined
|
|
163
|
+
stack-label
|
|
164
|
+
dense
|
|
165
|
+
options-dense
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<!-- 确认提示内容 -->
|
|
170
|
+
<div class="col-xs-12 col-sm-6 col-md-3" v-if="formData.confirm > 0">
|
|
171
|
+
<q-input
|
|
172
|
+
class="n-field-fieldset"
|
|
173
|
+
label="确认提示内容"
|
|
174
|
+
v-model="formData.confirmContent"
|
|
175
|
+
:placeholder="formData.confirm === 1 ? '确认要执行该操作吗?' : '重要操作,请输入登录密码并确认后操作'"
|
|
176
|
+
outlined
|
|
177
|
+
clearable
|
|
178
|
+
stack-label
|
|
179
|
+
dense
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<!-- 请求成功执行 -->
|
|
184
|
+
<div class="col-xs-12 col-sm-6 col-md-3">
|
|
185
|
+
<q-select
|
|
186
|
+
class="n-field-fieldset"
|
|
187
|
+
label="请求成功执行"
|
|
188
|
+
v-model="formData.requestSuccess.type"
|
|
189
|
+
:options="dataType === dicts.POWER_DATA_TYPE__FORM ?
|
|
190
|
+
[
|
|
191
|
+
{ label: '无', value: '' },
|
|
192
|
+
{ label: '关闭窗口', value: 'close' },
|
|
193
|
+
{ label: '关闭窗口并跳转来源页面', value: 'closePush' },
|
|
194
|
+
{ label: '关闭窗口、跳转并刷新来源页面', value: 'closePushRefresh' },
|
|
195
|
+
{ label: '重置表单', value: 'resetForm' },
|
|
196
|
+
] :
|
|
197
|
+
[
|
|
198
|
+
{ label: '无', value: '' },
|
|
199
|
+
{ label: '关闭窗口', value: 'close' },
|
|
200
|
+
{ label: '关闭窗口并跳转来源页面', value: 'closePush' },
|
|
201
|
+
{ label: '关闭窗口、跳转并刷新来源页面', value: 'closePushRefresh' },
|
|
202
|
+
{ label: '刷新列表', value: 'refreshList' },
|
|
203
|
+
]
|
|
204
|
+
"
|
|
205
|
+
map-options
|
|
206
|
+
emit-value
|
|
207
|
+
outlined
|
|
208
|
+
stack-label
|
|
209
|
+
dense
|
|
210
|
+
options-dense
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<!-- 请求成功参数 -->
|
|
215
|
+
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$n.indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
|
|
216
|
+
|
|
217
|
+
<!-- <!– 树 –>-->
|
|
218
|
+
<!-- <n-field-tree-->
|
|
219
|
+
<!-- class="n-field-fieldset"-->
|
|
220
|
+
<!-- label="跳转页面"-->
|
|
221
|
+
<!-- outlined-->
|
|
222
|
+
<!-- clearable-->
|
|
223
|
+
<!-- stack-label-->
|
|
224
|
+
<!-- dense-->
|
|
225
|
+
|
|
226
|
+
<!-- v-model="formData.requestSuccess.params"-->
|
|
227
|
+
<!-- :nodes="treeNodes"-->
|
|
228
|
+
<!-- :expanded="treeExpanded"-->
|
|
229
|
+
<!-- strict-->
|
|
230
|
+
<!-- accordion-->
|
|
231
|
+
<!-- />-->
|
|
232
|
+
<!--</div>-->
|
|
233
|
+
|
|
234
|
+
</template>
|
|
235
|
+
|
|
236
|
+
<!-- 如果为非表单 -->
|
|
237
|
+
<template v-if="dataType !== dicts.POWER_DATA_TYPE__FORM">
|
|
238
|
+
|
|
239
|
+
<!-- 栏目标题 -->
|
|
240
|
+
<n-column-title label="请求列表参数" tooltip='示例:id / sku_id AS sku' />
|
|
241
|
+
|
|
242
|
+
<!-- 表格请求参数 -->
|
|
243
|
+
<div class="col-xs-12">
|
|
244
|
+
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
245
|
+
<q-item
|
|
246
|
+
v-for="(item, itemIndex) in formData.requestQuery.list"
|
|
247
|
+
>
|
|
248
|
+
<q-item-section>
|
|
249
|
+
<q-input
|
|
250
|
+
class="n-field-fieldset"
|
|
251
|
+
v-model="formData.requestQuery.list[itemIndex]"
|
|
252
|
+
placeholder="请输入参数"
|
|
253
|
+
outlined
|
|
254
|
+
clearable
|
|
255
|
+
stack-label
|
|
256
|
+
dense
|
|
257
|
+
/>
|
|
258
|
+
</q-item-section>
|
|
259
|
+
|
|
260
|
+
<q-item-section side>
|
|
261
|
+
<div class="text-grey-8 q-gutter-xs">
|
|
262
|
+
<q-btn icon="add" size="12px" flat dense round @click="$n.arr.add(formData.requestQuery.list, itemIndex, '')" />
|
|
263
|
+
<q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
264
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
265
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.list, itemIndex)" :disable="formData.requestQuery.list.length <= itemIndex + 1" />
|
|
266
|
+
</div>
|
|
267
|
+
</q-item-section>
|
|
268
|
+
</q-item>
|
|
269
|
+
</q-list>
|
|
270
|
+
</div>
|
|
271
|
+
</template>
|
|
209
272
|
|
|
210
273
|
<!-- 栏目标题 -->
|
|
211
|
-
<n-column-title label="
|
|
274
|
+
<n-column-title label="请求传参参数" tooltip='示例:id / sku_id AS sku / { "type": 1, "name": "age" }' />
|
|
212
275
|
|
|
213
276
|
<!-- 表格请求参数 -->
|
|
214
277
|
<div class="col-xs-12">
|
|
215
278
|
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
216
279
|
<q-item
|
|
217
|
-
v-for="(item, itemIndex) in formData.requestQuery.
|
|
280
|
+
v-for="(item, itemIndex) in formData.requestQuery.query"
|
|
218
281
|
>
|
|
219
282
|
<q-item-section>
|
|
220
283
|
<q-input
|
|
221
284
|
class="n-field-fieldset"
|
|
222
|
-
v-model="formData.requestQuery.
|
|
285
|
+
v-model="formData.requestQuery.query[itemIndex]"
|
|
223
286
|
placeholder="请输入参数"
|
|
224
287
|
outlined
|
|
225
288
|
clearable
|
|
@@ -230,10 +293,10 @@
|
|
|
230
293
|
|
|
231
294
|
<q-item-section side>
|
|
232
295
|
<div class="text-grey-8 q-gutter-xs">
|
|
233
|
-
<q-btn icon="add" size="12px" flat dense round @click="$n.arr.add(formData.requestQuery.
|
|
234
|
-
<q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.
|
|
235
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.
|
|
236
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.
|
|
296
|
+
<q-btn icon="add" size="12px" flat dense round @click="$n.arr.add(formData.requestQuery.query, itemIndex, '')" />
|
|
297
|
+
<q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
298
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
299
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.query, itemIndex)" :disable="formData.requestQuery.query.length <= itemIndex + 1" />
|
|
237
300
|
</div>
|
|
238
301
|
</q-item-section>
|
|
239
302
|
</q-item>
|
|
@@ -241,39 +304,6 @@
|
|
|
241
304
|
</div>
|
|
242
305
|
</template>
|
|
243
306
|
|
|
244
|
-
<!-- 栏目标题 -->
|
|
245
|
-
<n-column-title label="请求传参参数" tooltip='示例:id / sku_id AS sku / { "type": 1, "name": "age" }' />
|
|
246
|
-
|
|
247
|
-
<!-- 表格请求参数 -->
|
|
248
|
-
<div class="col-xs-12">
|
|
249
|
-
<q-list class="rounded-borders" style="max-width:800px" bordered>
|
|
250
|
-
<q-item
|
|
251
|
-
v-for="(item, itemIndex) in formData.requestQuery.query"
|
|
252
|
-
>
|
|
253
|
-
<q-item-section>
|
|
254
|
-
<q-input
|
|
255
|
-
class="n-field-fieldset"
|
|
256
|
-
v-model="formData.requestQuery.query[itemIndex]"
|
|
257
|
-
placeholder="请输入参数"
|
|
258
|
-
outlined
|
|
259
|
-
clearable
|
|
260
|
-
stack-label
|
|
261
|
-
dense
|
|
262
|
-
/>
|
|
263
|
-
</q-item-section>
|
|
264
|
-
|
|
265
|
-
<q-item-section side>
|
|
266
|
-
<div class="text-grey-8 q-gutter-xs">
|
|
267
|
-
<q-btn icon="add" size="12px" flat dense round @click="$n.arr.add(formData.requestQuery.query, itemIndex, '')" />
|
|
268
|
-
<q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
269
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
270
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.query, itemIndex)" :disable="formData.requestQuery.query.length <= itemIndex + 1" />
|
|
271
|
-
</div>
|
|
272
|
-
</q-item-section>
|
|
273
|
-
</q-item>
|
|
274
|
-
</q-list>
|
|
275
|
-
</div>
|
|
276
|
-
|
|
277
307
|
<!-- 栏目标题 -->
|
|
278
308
|
<n-column-title label="自定义参数" tooltip='示例:123 / id / [1, 2, 3] / { "type": 1, "name": "age" }' />
|
|
279
309
|
|
|
@@ -344,7 +374,7 @@ export default {
|
|
|
344
374
|
|
|
345
375
|
// 如果数据类型为新窗口
|
|
346
376
|
if (val === dicts.POWER_DATA_TYPE__FORM) {
|
|
347
|
-
if (formData.value.requestSuccess.type === '
|
|
377
|
+
if (formData.value.requestSuccess.type === 'refreshList') {
|
|
348
378
|
formData.value.requestSuccess.type = ''
|
|
349
379
|
formData.value.requestSuccess.params = ''
|
|
350
380
|
}
|
|
@@ -376,7 +406,9 @@ export default {
|
|
|
376
406
|
|
|
377
407
|
// 原始数据默认值
|
|
378
408
|
const rawObj = {
|
|
379
|
-
//
|
|
409
|
+
// 列表选择类型, 可选值 none single(默认) multiple
|
|
410
|
+
selection: '',
|
|
411
|
+
// 显示类型, 可选 single / multiple / 空(默认显示)
|
|
380
412
|
show: '',
|
|
381
413
|
// 是否增加来源页面参数
|
|
382
414
|
addFromPageQuery: false,
|
|
@@ -392,14 +424,14 @@ export default {
|
|
|
392
424
|
confirmPassword: false,
|
|
393
425
|
// 请求参数
|
|
394
426
|
requestQuery: {
|
|
395
|
-
//
|
|
396
|
-
|
|
427
|
+
// 列表: 字符串组成的数组, 如: [ "id", "sku_id AS sku" ]
|
|
428
|
+
list: [],
|
|
397
429
|
// 参数: 字符串 / 对象(自定义参数) 组成的数组, 如: [ "id", "sku_id AS sku", { "type": 1, "name": "age" } ]
|
|
398
430
|
query: null,
|
|
399
431
|
},
|
|
400
432
|
// 请求成功执行
|
|
401
433
|
requestSuccess: {
|
|
402
|
-
// 类型, 可选 close / closePush / closePushRefresh / resetForm /
|
|
434
|
+
// 类型, 可选 close / closePush / closePushRefresh / resetForm / refreshList / 空(不执行)
|
|
403
435
|
type: '',
|
|
404
436
|
// 参数
|
|
405
437
|
params: '',
|
|
@@ -438,6 +470,11 @@ export default {
|
|
|
438
470
|
// 合并原始数据
|
|
439
471
|
obj = Object.assign(rawObj, obj)
|
|
440
472
|
|
|
473
|
+
// 列表选择类型默认值为 single
|
|
474
|
+
if (! $n.isValidString(obj.selection)) {
|
|
475
|
+
obj.selection = 'single'
|
|
476
|
+
}
|
|
477
|
+
|
|
441
478
|
// 【格式化是否确认参数】
|
|
442
479
|
// ------------------------------------------------------------
|
|
443
480
|
// 是否确认, 可选 0:无 / 1:提交前确认 / 2:提交前确认登录密码
|
|
@@ -458,12 +495,12 @@ export default {
|
|
|
458
495
|
obj.confirm = confirm
|
|
459
496
|
delete obj.confirmPassword
|
|
460
497
|
|
|
461
|
-
// 【格式化请求参数中的
|
|
498
|
+
// 【格式化请求参数中的 list】
|
|
462
499
|
// ------------------------------------------------------------
|
|
463
|
-
if ($n.isValidString(obj.requestQuery.
|
|
464
|
-
obj.requestQuery.
|
|
465
|
-
} else if (! $n.isValidArray(obj.requestQuery.
|
|
466
|
-
obj.requestQuery.
|
|
500
|
+
if ($n.isValidString(obj.requestQuery.list)) {
|
|
501
|
+
obj.requestQuery.list = [obj.requestQuery.list]
|
|
502
|
+
} else if (! $n.isValidArray(obj.requestQuery.list)) {
|
|
503
|
+
obj.requestQuery.list = ['']
|
|
467
504
|
}
|
|
468
505
|
|
|
469
506
|
// 【格式化请求参数中的 query】
|
|
@@ -551,7 +588,7 @@ export default {
|
|
|
551
588
|
if ($n.isRequired(value)) {
|
|
552
589
|
|
|
553
590
|
// 如果为表格
|
|
554
|
-
if (field === '
|
|
591
|
+
if (field === 'list') {
|
|
555
592
|
|
|
556
593
|
if (Array.isArray(value) || $n.isPlainObject(value)) {
|
|
557
594
|
|
|
@@ -602,88 +639,99 @@ export default {
|
|
|
602
639
|
return value
|
|
603
640
|
}
|
|
604
641
|
|
|
605
|
-
//
|
|
642
|
+
// 如果列表显示
|
|
606
643
|
// --------------------------------------------------
|
|
607
|
-
if (props.dataType
|
|
644
|
+
if (props.dataType === dicts.POWER_DATA_TYPE__LIST) {
|
|
608
645
|
|
|
609
|
-
//
|
|
610
|
-
if (data.
|
|
611
|
-
obj.
|
|
646
|
+
// 列表选择类型
|
|
647
|
+
if ($n.indexOf(['none', 'multiple'], data.selection) > -1) {
|
|
648
|
+
obj.selection = data.selection
|
|
612
649
|
}
|
|
613
650
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
651
|
+
} else {
|
|
652
|
+
// 如果非表单显示
|
|
653
|
+
// --------------------------------------------------
|
|
654
|
+
if (props.dataType !== dicts.POWER_DATA_TYPE__FORM) {
|
|
655
|
+
|
|
656
|
+
// 显示类型
|
|
657
|
+
if (data.show) {
|
|
658
|
+
obj.show = data.show
|
|
659
|
+
}
|
|
618
660
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
661
|
+
// 是否固定列
|
|
662
|
+
if (data.fixed) {
|
|
663
|
+
obj.fixed = data.fixed
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// 是否双击
|
|
667
|
+
if (data.dbclick) {
|
|
668
|
+
obj.dbclick = data.dbclick
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// 请求表格参数
|
|
672
|
+
if (setRequestQuery('list') === false) {
|
|
673
|
+
return false
|
|
674
|
+
}
|
|
622
675
|
}
|
|
623
676
|
|
|
624
|
-
//
|
|
625
|
-
if (setRequestQuery('
|
|
677
|
+
// 请求传参参数
|
|
678
|
+
if (setRequestQuery('query') === false) {
|
|
626
679
|
return false
|
|
627
680
|
}
|
|
628
|
-
}
|
|
629
681
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
return false
|
|
633
|
-
}
|
|
682
|
+
// 如果数据类型为新窗口
|
|
683
|
+
if (props.dataType === dicts.POWER_DATA_TYPE__OPEN) {
|
|
634
684
|
|
|
635
|
-
|
|
636
|
-
|
|
685
|
+
// 如果是非路由
|
|
686
|
+
if (props.routeType === 0) {
|
|
637
687
|
|
|
638
|
-
|
|
639
|
-
|
|
688
|
+
// 如果没有选择跳转页面
|
|
689
|
+
if (! data.toPage) {
|
|
690
|
+
// 轻提示
|
|
691
|
+
$n.toast({
|
|
692
|
+
message: '请选择跳转页面',
|
|
693
|
+
})
|
|
694
|
+
return false
|
|
695
|
+
}
|
|
640
696
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
// 轻提示
|
|
644
|
-
$n.toast({
|
|
645
|
-
message: '请选择跳转页面',
|
|
646
|
-
})
|
|
647
|
-
return false
|
|
697
|
+
// 设置跳转页面 id
|
|
698
|
+
obj.toPage = data.toPage
|
|
648
699
|
}
|
|
649
700
|
|
|
650
|
-
//
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
// 如果增加来源页面参数
|
|
655
|
-
if (data.addFromPageQuery) {
|
|
656
|
-
obj.addFromPageQuery = true
|
|
657
|
-
}
|
|
701
|
+
// 如果增加来源页面参数
|
|
702
|
+
if (data.addFromPageQuery) {
|
|
703
|
+
obj.addFromPageQuery = true
|
|
704
|
+
}
|
|
658
705
|
|
|
659
|
-
|
|
660
|
-
|
|
706
|
+
// 否则为其他
|
|
707
|
+
} else {
|
|
661
708
|
|
|
662
|
-
|
|
663
|
-
|
|
709
|
+
// 是否确认
|
|
710
|
+
if (data.confirm) {
|
|
664
711
|
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
712
|
+
// 如果是(1:提交前确认)
|
|
713
|
+
if (data.confirm === 1) {
|
|
714
|
+
obj.confirm = $n.isValidString(data.confirmContent) ? data.confirmContent : true
|
|
668
715
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
716
|
+
// 否则是(2:提交前确认登录密码)
|
|
717
|
+
} else {
|
|
718
|
+
obj.confirmPassword = $n.isValidString(data.confirmContent) ? data.confirmContent : true
|
|
719
|
+
}
|
|
672
720
|
}
|
|
673
|
-
}
|
|
674
721
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
722
|
+
// 请求成功执行
|
|
723
|
+
if (data.requestSuccess.type) {
|
|
724
|
+
obj.requestSuccess = {
|
|
725
|
+
type: data.requestSuccess.type
|
|
726
|
+
}
|
|
727
|
+
// if ($n.indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
|
|
728
|
+
// if (data.requestSuccess.params) {
|
|
729
|
+
// obj.requestSuccess.params = data.requestSuccess.params
|
|
730
|
+
// } else {
|
|
731
|
+
// obj.requestSuccess.type = 'close'
|
|
732
|
+
// }
|
|
733
|
+
// }
|
|
679
734
|
}
|
|
680
|
-
// if ($n.indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
|
|
681
|
-
// if (data.requestSuccess.params) {
|
|
682
|
-
// obj.requestSuccess.params = data.requestSuccess.params
|
|
683
|
-
// } else {
|
|
684
|
-
// obj.requestSuccess.type = 'close'
|
|
685
|
-
// }
|
|
686
|
-
// }
|
|
687
735
|
}
|
|
688
736
|
}
|
|
689
737
|
|
|
@@ -308,7 +308,7 @@ export default {
|
|
|
308
308
|
if (showAfter && $table.tableSelected.value.length > 1) {
|
|
309
309
|
|
|
310
310
|
// 如果有多条已选数据, 则只取第一条数据
|
|
311
|
-
$table.tableSelected.value = [ $table.tableSelected.value[
|
|
311
|
+
$table.tableSelected.value = [ $table.tableSelected.value[$table.tableSelected.value.length - 1] ]
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
}
|
package/package.json
CHANGED
package/sass/quasar/field.scss
CHANGED
package/sass/quasar/table.scss
CHANGED
package/utils/$power.js
CHANGED
|
@@ -220,7 +220,7 @@ function create(params) {
|
|
|
220
220
|
const isSingle = item.show === 'single'
|
|
221
221
|
|
|
222
222
|
// 如果是单条 || 多条显示
|
|
223
|
-
if (isSingle || item.show === '
|
|
223
|
+
if (isSingle || item.show === 'multiple') {
|
|
224
224
|
|
|
225
225
|
// 初始为不显示
|
|
226
226
|
item.show = false
|
|
@@ -674,14 +674,14 @@ function getRequestQuery(o) {
|
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
|
|
677
|
-
//
|
|
677
|
+
// 获取列表数据
|
|
678
678
|
if (
|
|
679
679
|
// 如果按钮参数有显示类型
|
|
680
680
|
$n.has(o.data, 'show')
|
|
681
681
|
// 按钮参数的显示类型必须是单选或多选
|
|
682
|
-
&& $n.indexOf(['single', '
|
|
683
|
-
//
|
|
684
|
-
&& $n.has(o.data, 'requestQuery.
|
|
682
|
+
&& $n.indexOf(['single', 'multiple'], o.data.show) > -1
|
|
683
|
+
// 如果有请求传参的列表设置
|
|
684
|
+
&& $n.has(o.data, 'requestQuery.list')
|
|
685
685
|
// 如果有表格数据
|
|
686
686
|
&& $n.isValidArray(o.tableSelected)
|
|
687
687
|
) {
|
|
@@ -706,7 +706,7 @@ function getRequestQuery(o) {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
const resTable = parseQuery(newQuery, o.data.requestQuery.
|
|
709
|
+
const resTable = parseQuery(newQuery, o.data.requestQuery.list)
|
|
710
710
|
if ($n.isValidObject(resTable)) {
|
|
711
711
|
Object.assign(query, resTable)
|
|
712
712
|
}
|
|
@@ -1050,8 +1050,8 @@ async function request(params) {
|
|
|
1050
1050
|
$n.run(o.$form?.resetForm)()
|
|
1051
1051
|
break
|
|
1052
1052
|
|
|
1053
|
-
//
|
|
1054
|
-
case '
|
|
1053
|
+
// 刷新列表
|
|
1054
|
+
case 'refreshList':
|
|
1055
1055
|
$n.run(o.$table?.tableRefresh)()
|
|
1056
1056
|
break
|
|
1057
1057
|
}
|
package/utils/$table.js
CHANGED
|
@@ -35,8 +35,8 @@ function create(params) {
|
|
|
35
35
|
data: {},
|
|
36
36
|
// 表格行唯一键值
|
|
37
37
|
rowKey: 'id',
|
|
38
|
-
// 选择类型, 可选值 single multiple
|
|
39
|
-
selection: '
|
|
38
|
+
// 选择类型, 可选值 none single(默认) multiple
|
|
39
|
+
// selection: '',
|
|
40
40
|
// 分隔栏, 可选值 horizontal vertical cell none
|
|
41
41
|
separator: 'cell',
|
|
42
42
|
// 已选数据
|
|
@@ -108,6 +108,18 @@ function create(params) {
|
|
|
108
108
|
const $power = $n.has(params, '$power') ? params.$power : inject(NPowerKey)
|
|
109
109
|
const hasPowr = !! $power
|
|
110
110
|
|
|
111
|
+
// 获取选择类型(默认 single)
|
|
112
|
+
if (! $n.has(o, 'selection') || ! $n.isValidString(o.selection)) {
|
|
113
|
+
if (hasPowr) {
|
|
114
|
+
o.selection = $n.get($power, 'powerPage.data.selection')
|
|
115
|
+
if (! $n.isValidString(o.selection)) {
|
|
116
|
+
o.selection = 'single'
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
o.selection = 'single'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
111
123
|
// 获取权限路由
|
|
112
124
|
const $route = $n.isValidString(o.path) ?
|
|
113
125
|
// 如果为自定义路由
|
|
@@ -651,6 +663,9 @@ function create(params) {
|
|
|
651
663
|
*/
|
|
652
664
|
async function tableRequest(props) {
|
|
653
665
|
|
|
666
|
+
// 加载
|
|
667
|
+
tableLoading.value = true
|
|
668
|
+
|
|
654
669
|
// 解构数据
|
|
655
670
|
const {
|
|
656
671
|
// filter,
|
package/utils/$tree.js
CHANGED
|
@@ -616,6 +616,39 @@ function create(params) {
|
|
|
616
616
|
$n.storage.set('tree_expanded_' + $route.fullPath, expanded, 0)
|
|
617
617
|
}
|
|
618
618
|
|
|
619
|
+
/**
|
|
620
|
+
* 展开全部
|
|
621
|
+
*/
|
|
622
|
+
function expandAll() {
|
|
623
|
+
|
|
624
|
+
// 展开节点 ids
|
|
625
|
+
const ids = []
|
|
626
|
+
|
|
627
|
+
function getChildren(data) {
|
|
628
|
+
for (const { id, children } of data) {
|
|
629
|
+
ids.push(id)
|
|
630
|
+
if ($n.isValidArray(children)) {
|
|
631
|
+
getChildren(children)
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if ($n.isValidArray(nodes.value)) {
|
|
637
|
+
getChildren(nodes.value)
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// 设置展开节点数组
|
|
641
|
+
expanded.value = ids
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* 收起全部
|
|
646
|
+
*/
|
|
647
|
+
function collapseAll() {
|
|
648
|
+
// 设置展开节点数组
|
|
649
|
+
expanded.value = [0]
|
|
650
|
+
}
|
|
651
|
+
|
|
619
652
|
return {
|
|
620
653
|
// 当前地址
|
|
621
654
|
fullPath: $route.fullPath,
|
|
@@ -633,6 +666,10 @@ function create(params) {
|
|
|
633
666
|
getExpandedCache,
|
|
634
667
|
// 设置展开节点缓存
|
|
635
668
|
setExpandedCache,
|
|
669
|
+
// 展开全部
|
|
670
|
+
expandAll,
|
|
671
|
+
// 收起全部
|
|
672
|
+
collapseAll,
|
|
636
673
|
}
|
|
637
674
|
}
|
|
638
675
|
|