@netang/quasar 0.0.40 → 0.0.42

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.
@@ -151,8 +151,10 @@ export default {
151
151
  * 声明属性
152
152
  */
153
153
  props: {
154
- // 值
155
- modelValue: [String, Number],
154
+ // 值 v-model
155
+ modelValue: {
156
+ required: true,
157
+ },
156
158
  // 结束值
157
159
  end: [String, Number],
158
160
  // 占位符
@@ -164,6 +166,8 @@ export default {
164
166
  },
165
167
  // 是否截止时间
166
168
  endDate: Boolean,
169
+ // 是否显示秒
170
+ showSecond: Boolean,
167
171
  // 显示在输入框中的格式
168
172
  format: String,
169
173
  // 绑定值的格式(默认:秒时间戳)
@@ -1,4 +1,16 @@
1
1
  <template>
2
+
3
+ <!-- 如果有默认插槽 -->
4
+ <template v-if="$slots.default">
5
+ <slot
6
+ :showValue="showValue"
7
+ :selected="selected"
8
+ :onRemove="onRemoveSelected"
9
+ :onShowDialog="onShowDialog"
10
+ :onClear="onFieldClear"
11
+ />
12
+ </template>
13
+
2
14
  <!--:class="fieldFocused ? 'q-field&#45;&#45;float q-field&#45;&#45;focused q-field&#45;&#45;highlighted' : ''"-->
3
15
  <q-field
4
16
  class="n-field-table"
@@ -10,6 +22,7 @@
10
22
  @blur="onFieldBlur"
11
23
  @clear="onFieldClear"
12
24
  v-bind="$attrs"
25
+ v-else
13
26
  >
14
27
  <template v-slot:control>
15
28
 
@@ -69,7 +82,7 @@
69
82
  <q-icon
70
83
  class="cursor-pointer"
71
84
  name="search"
72
- @click.prevent.stop="showDialog = true"
85
+ @click.prevent.stop="onShowDialog"
73
86
  />
74
87
  </template>
75
88
 
@@ -164,6 +177,11 @@ import { ref, computed, watch, onUpdated } from 'vue'
164
177
 
165
178
  export default {
166
179
 
180
+ /**
181
+ * 关闭组件 attribute 透传行为
182
+ */
183
+ inheritAttrs: false,
184
+
167
185
  /**
168
186
  * 标识
169
187
  */
@@ -175,7 +193,6 @@ export default {
175
193
  props: {
176
194
  // 值 v-model
177
195
  modelValue: {
178
- type: [ String, Number, Array ],
179
196
  required: true,
180
197
  },
181
198
  // 值字段(必填)
@@ -205,8 +222,10 @@ export default {
205
222
  query: Object,
206
223
  // 附加请求数据
207
224
  data: Object,
208
- // 不加载已选数据
209
- noLoadSelected: Boolean,
225
+ // 初始不加载已选数据
226
+ noFirstLoadSelected: Boolean,
227
+ // 更新值时不加载已选数据
228
+ noUpdateLoadSelected: Boolean,
210
229
  // 格式化显示标签
211
230
  formatLabel: Function,
212
231
  // 快捷表格显示的字段数组(空为:[值字段, 标签字段])
@@ -433,8 +452,8 @@ export default {
433
452
  // 需增加的值
434
453
  if (newSelected.length) {
435
454
 
436
- // 如果不加载已选数据
437
- if (props.noLoadSelected) {
455
+ // 如果更新值时不加载已选数据
456
+ if (props.noUpdateLoadSelected) {
438
457
  // 请求选择数据
439
458
  _selected.push(...newSelected.map(e => setSelectedItem(e)))
440
459
  } else {
@@ -505,8 +524,8 @@ export default {
505
524
  // 如果输入框有值
506
525
  && hasValue
507
526
  ) {
508
- // 显示弹出层
509
- popupRef.value.show()
527
+ // 显示弹出层节点
528
+ showPopupRef()
510
529
  }
511
530
 
512
531
  // 表格重新加载
@@ -523,8 +542,8 @@ export default {
523
542
  if (
524
543
  // 如果值类型不是数组对象
525
544
  props.valueType !== 'arrayObject'
526
- // 如果不加载已选数据
527
- && ! props.noLoadSelected
545
+ // 如果初始加载已选数据
546
+ && ! props.noFirstLoadSelected
528
547
  // 如果有请求路由路径
529
548
  && routePath
530
549
  ) {
@@ -630,8 +649,8 @@ export default {
630
649
  if (
631
650
  // 非初始化
632
651
  ! isFirst
633
- // 或非加载已选数据
634
- || props.noLoadSelected
652
+ // 或初始不加载已选数据
653
+ || props.noFirstLoadSelected
635
654
  // 或没有路由路径
636
655
  || ! routePath
637
656
  ) {
@@ -842,8 +861,32 @@ export default {
842
861
  // 清空快捷表格已选数据
843
862
  emitModelValue([])
844
863
 
845
- // 隐藏弹出层
846
- popupRef.value.hide()
864
+ // 隐藏弹出层节点
865
+ hidePopupRef()
866
+ }
867
+
868
+ /**
869
+ * 显示弹出层节点
870
+ */
871
+ function showPopupRef() {
872
+
873
+ // 如果有弹出层节点
874
+ if (popupRef.value) {
875
+ // 显示弹出层
876
+ popupRef.value.show()
877
+ }
878
+ }
879
+
880
+ /**
881
+ * 隐藏弹出层节点
882
+ */
883
+ function hidePopupRef() {
884
+
885
+ // 如果有弹出层节点
886
+ if (popupRef.value) {
887
+ // 隐藏弹出层
888
+ popupRef.value.hide()
889
+ }
847
890
  }
848
891
 
849
892
  /**
@@ -862,6 +905,14 @@ export default {
862
905
  .finally()
863
906
  }
864
907
 
908
+ /**
909
+ * 显示对话框
910
+ */
911
+ function onShowDialog() {
912
+ // 显示对话框
913
+ showDialog.value = true
914
+ }
915
+
865
916
  /**
866
917
  * 对话框显示前回调
867
918
  */
@@ -870,8 +921,8 @@ export default {
870
921
  // 设置当前已选数据
871
922
  $table.tableSelected.value = [...selected.value]
872
923
 
873
- // 隐藏弹出层
874
- popupRef.value.hide()
924
+ // 隐藏弹出层节点
925
+ hidePopupRef()
875
926
  }
876
927
 
877
928
  /**
@@ -948,8 +999,8 @@ export default {
948
999
  // 触发更新值
949
1000
  emitModelValue([ row ])
950
1001
 
951
- // 隐藏弹出层
952
- popupRef.value.hide()
1002
+ // 隐藏弹出层节点
1003
+ hidePopupRef()
953
1004
  }
954
1005
  }
955
1006
 
@@ -991,7 +1042,10 @@ export default {
991
1042
  * 在组件因为响应式状态变更而更新其 DOM 树之后调用
992
1043
  */
993
1044
  onUpdated(function () {
994
- if (_.has(popupRef.value, 'currentComponent.ref.updatePosition')) {
1045
+ if (
1046
+ popupRef.value
1047
+ && _.has(popupRef.value, 'currentComponent.ref.updatePosition')
1048
+ ) {
995
1049
  popupRef.value.currentComponent.ref.updatePosition()
996
1050
  }
997
1051
  })
@@ -1037,6 +1091,8 @@ export default {
1037
1091
  // 弹出层显示回调
1038
1092
  onPopupShow,
1039
1093
 
1094
+ // 显示对话框
1095
+ onShowDialog,
1040
1096
  // 对话框显示前回调
1041
1097
  onDialogBeforeShow,
1042
1098
  // 对话框隐藏后回调
@@ -131,8 +131,10 @@ export default {
131
131
  * 声明属性
132
132
  */
133
133
  props: {
134
- // 值
135
- modelValue: [Array, String, Number],
134
+ // 值 v-model
135
+ modelValue: {
136
+ required: true,
137
+ },
136
138
  // 树展开节点
137
139
  expanded: Array, // v-model:expanded
138
140
  // 节点数组
@@ -28,9 +28,9 @@ export default {
28
28
  * 声明属性
29
29
  */
30
30
  props: {
31
- // 值
31
+ // 值 v-model
32
32
  modelValue: {
33
- required: false,
33
+ required: true,
34
34
  },
35
35
  // 值是否为数组
36
36
  valueArray: Boolean,
@@ -84,9 +84,9 @@ export default {
84
84
  * 声明属性
85
85
  */
86
86
  props: {
87
- // 值
87
+ // 值 v-model
88
88
  modelValue: {
89
- required: false
89
+ required: true,
90
90
  },
91
91
  // 最小值
92
92
  min: {
@@ -39,7 +39,7 @@
39
39
  <!-- 比较2(类型为 > / >=) -->
40
40
  <div
41
41
  class="n-field-group row"
42
- v-if="data.compareOptions2.length"
42
+ v-if="data.compareOptions2.length && utils.indexOf([dicts.SEARCH_TYPE__GT, dicts.SEARCH_TYPE__GTE], modelValue[0].compare) > -1"
43
43
  >
44
44
  <!-- 比较类型2 -->
45
45
  <q-select
@@ -11,13 +11,21 @@
11
11
  v-for="slotName in slotNames"
12
12
  v-slot:[slotName]
13
13
  >
14
- <slot :name="slotName" />
14
+ <slot
15
+ :name="slotName"
16
+ :before="currentBefore"
17
+ :after="currentAfter"
18
+ :toggleBefore="toggleBefore"
19
+ :toggleAfter="toggleAfter"
20
+ />
15
21
  </template>
16
22
  </q-splitter>
17
23
  </template>
18
24
 
19
25
  <script>
20
26
  import { computed, ref, watch, inject } from 'vue'
27
+ import { useQuasar } from 'quasar'
28
+
21
29
  import { NPowerKey } from '../../utils/symbols'
22
30
 
23
31
  export default {
@@ -31,24 +39,30 @@ export default {
31
39
  * 声明属性
32
40
  */
33
41
  props: {
34
- // 值
42
+ // 值 v-model
35
43
  modelValue: {
36
44
  type: Number,
37
45
  required: true,
38
46
  },
39
- // 显示前置插槽
40
- showBefore: {
47
+ // 显示前置插槽 v-model:before
48
+ // 注意: 如果非双向绑定, 如 :before 并不会影响内部值变化, 仅做初始值使用
49
+ before: {
41
50
  type: Boolean,
42
51
  default: true,
43
52
  },
44
- // 显示后置插槽
45
- showAfter: {
53
+ // 显示后置插槽 v-model:after
54
+ // 注意: 如果非双向绑定, 如 :after 并不会影响内部值变化, 仅做初始值使用
55
+ after: {
46
56
  type: Boolean,
47
57
  default: true,
48
58
  },
59
+ // 手机模式隐藏前置插槽
60
+ hideBeforeInMobile: Boolean,
61
+ // 手机模式隐藏后插槽
62
+ hideAfterInMobile: Boolean,
49
63
  // 是否开启缓存
50
64
  cache: {
51
- type: [Boolean, String],
65
+ type: [ Boolean, String ],
52
66
  default: true,
53
67
  },
54
68
  },
@@ -58,6 +72,8 @@ export default {
58
72
  */
59
73
  emits: [
60
74
  'update:modelValue',
75
+ 'update:before',
76
+ 'update:after',
61
77
  ],
62
78
 
63
79
  /**
@@ -65,6 +81,103 @@ export default {
65
81
  */
66
82
  setup(props, { emit, slots }) {
67
83
 
84
+ // ==========【数据】============================================================================================
85
+
86
+ // quasar 对象
87
+ const $q = useQuasar()
88
+
89
+ // 获取权限注入
90
+ const $power = inject(NPowerKey)
91
+
92
+ // 缓存名
93
+ let cacheName = ''
94
+
95
+ // 初始值
96
+ let rawValue = props.modelValue
97
+
98
+ // 初始显示前置插槽
99
+ let rawBefore = props.before
100
+ let initEmitBefore = true
101
+
102
+ // 初始显示后置插槽
103
+ let rawAfter = props.after
104
+ let initEmitAfter = true
105
+
106
+ // 如果开启缓存
107
+ if (props.cache) {
108
+
109
+ // 设置缓存名
110
+ cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}:`
111
+
112
+ // 从缓存获取初始值
113
+ let cache = utils.storage.get(cacheName + 'modelValue')
114
+ if (cache !== null) {
115
+ rawValue = cache
116
+ }
117
+
118
+ // 如果手机模式隐藏前置插槽
119
+ if (props.hideBeforeInMobile && $q.platform.is.mobile) {
120
+ rawBefore = false
121
+ initEmitBefore = false
122
+
123
+ } else {
124
+ // 从缓存获取初始值
125
+ cache = utils.storage.get(cacheName + 'before')
126
+ if (cache !== null) {
127
+ rawBefore = cache
128
+ }
129
+ }
130
+
131
+ // 如果手机模式隐藏后置插槽
132
+ if (props.hideAfterInMobile && $q.platform.is.mobile) {
133
+ rawAfter = false
134
+ initEmitAfter = false
135
+
136
+ } else {
137
+ // 从缓存获取初始值
138
+ cache = utils.storage.get(cacheName + 'after')
139
+ if (cache !== null) {
140
+ rawAfter = cache
141
+ }
142
+ }
143
+
144
+ // 如果在手机模式
145
+ } else if ($q.platform.is.mobile) {
146
+
147
+ // 手机模式隐藏前置插槽
148
+ if (props.hideBeforeInMobile) {
149
+ rawBefore = false
150
+ initEmitBefore = false
151
+ }
152
+
153
+ // 手机模式隐藏后置插槽
154
+ if (props.hideAfterInMobile) {
155
+ rawAfter = false
156
+ initEmitAfter = false
157
+ }
158
+ }
159
+
160
+ // 创建防抖睡眠方法
161
+ const sleep = utils.debounceSleep()
162
+
163
+ // 当前值
164
+ const currentValue = ref(rawValue)
165
+ if (rawValue !== props.modelValue) {
166
+ emit('update:modelValue', rawValue)
167
+ }
168
+
169
+ // 当前是否显示前置插槽
170
+ const currentBefore = ref(rawBefore)
171
+ if (initEmitBefore) {
172
+ emit('update:before', rawBefore)
173
+ }
174
+
175
+ // 当前是否显示后置插槽
176
+ const currentAfter = ref(rawAfter)
177
+ if (initEmitAfter) {
178
+ emit('update:after', rawAfter)
179
+ }
180
+
68
181
  // ==========【计算属性】=========================================================================================
69
182
 
70
183
  /**
@@ -75,14 +188,15 @@ export default {
75
188
  const keys = []
76
189
 
77
190
  if (utils.isValidObject(slots)) {
191
+
78
192
  for (const key in slots) {
79
193
  if (key === 'before') {
80
- if (props.showBefore) {
194
+ if (currentBefore.value) {
81
195
  keys.push(key)
82
196
  }
83
197
 
84
198
  } else if (key === 'after') {
85
- if (props.showAfter) {
199
+ if (currentAfter.value) {
86
200
  keys.push(key)
87
201
  }
88
202
 
@@ -100,13 +214,13 @@ export default {
100
214
  */
101
215
  const currentClass = computed(function () {
102
216
 
103
- if (props.showBefore) {
104
- if (! props.showAfter) {
217
+ if (currentBefore.value) {
218
+ if (! currentAfter.value) {
105
219
  return 'n-splitter--hide-before'
106
220
  }
107
221
 
108
- } else if (props.showAfter) {
109
- if (! props.showBefore) {
222
+ } else if (currentAfter.value) {
223
+ if (! currentBefore.value) {
110
224
  return 'n-splitter--hide-after'
111
225
  }
112
226
 
@@ -115,69 +229,108 @@ export default {
115
229
  }
116
230
  })
117
231
 
118
- // ==========【数据】============================================================================================
119
-
120
- // 获取权限注入
121
- const $power = inject(NPowerKey)
232
+ // ==========【方法】============================================================================================
122
233
 
123
- // 缓存名
124
- let cacheName = ''
234
+ /**
235
+ * 触发更新值
236
+ */
237
+ async function emitValue(key, val) {
125
238
 
126
- // 初始值
127
- let rawValue = props.modelValue
239
+ // 更新值
240
+ emit(`update:${key}`, val)
128
241
 
129
- // 如果开启缓存
130
- if (props.cache) {
242
+ // 如果开启缓存
243
+ if (props.cache) {
131
244
 
132
- // 设置缓存名
133
- cacheName = `splitter:value:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}`
245
+ // 延迟执行
246
+ await sleep(500, key)
134
247
 
135
- // 从缓存获取初始值
136
- const cache = utils.storage.get(cacheName)
137
- if (cache) {
138
- rawValue = cache
248
+ // 设置缓存(永久缓存)
249
+ utils.storage.set(cacheName + key, val, 0)
139
250
  }
140
251
  }
141
252
 
142
- // 当前值
143
- const currentValue = ref(rawValue)
253
+ /**
254
+ * 切换显示前置插槽
255
+ */
256
+ function toggleBefore() {
257
+ currentBefore.value = ! currentBefore.value
258
+ }
144
259
 
145
- // 创建防抖睡眠方法
146
- const sleep = utils.debounceSleep()
260
+ /**
261
+ * 切换显示后置插槽
262
+ */
263
+ function toggleAfter() {
264
+ currentAfter.value = ! currentAfter.value
265
+ }
147
266
 
148
267
  // ==========【监听数据】=========================================================================================
149
268
 
150
269
  /**
151
270
  * 监听声明值
152
271
  */
153
- watch(()=>props.modelValue, function (val) {
272
+ watch(() => props.modelValue, function (val) {
273
+
154
274
  // 如果值有变化
155
275
  if (val !== currentValue.value) {
276
+
156
277
  // 更新当前值
157
278
  currentValue.value = val
158
279
  }
159
280
  })
160
281
 
161
282
  /**
162
- * 监听值
283
+ * 监听声明是否显示前置插槽
163
284
  */
164
- watch(currentValue, function (val) {
285
+ watch(() => props.before, function (val) {
165
286
 
166
- // 更新值
167
- emit('update:modelValue', val)
287
+ // 如果值有变化
288
+ if (val !== currentBefore.value) {
168
289
 
169
- // 如果开启缓存
170
- if (props.cache) {
290
+ // 设置是否显示前置插槽
291
+ currentBefore.value = val
292
+ }
293
+ })
171
294
 
172
- // 延迟执行
173
- sleep(500)
174
- .then(function () {
175
- // 设置缓存(永久缓存)
176
- utils.storage.set(cacheName, val, 0)
177
- })
295
+ /**
296
+ * 监听声明是否显示后置插槽
297
+ */
298
+ watch(() => props.after, function (val) {
299
+
300
+ // 如果值有变化
301
+ if (val !== currentAfter.value) {
302
+
303
+ // 设置是否显示后置插槽
304
+ currentAfter.value = val
178
305
  }
179
306
  })
180
307
 
308
+ /**
309
+ * 监听值
310
+ */
311
+ watch(currentValue, async function (val) {
312
+ // 触发更新值
313
+ await emitValue('modelValue', val)
314
+ })
315
+
316
+ /**
317
+ * 监听是否显示前置插槽
318
+ */
319
+ watch(currentBefore, async function (val) {
320
+
321
+ // 触发更新值
322
+ await emitValue('before', val)
323
+ })
324
+
325
+ /**
326
+ * 监听是否显示后置插槽
327
+ */
328
+ watch(currentAfter, async function (val) {
329
+
330
+ // 触发更新值
331
+ await emitValue('after', val)
332
+ })
333
+
181
334
  // ==========【返回】=============================================================================================
182
335
 
183
336
  return {
@@ -185,8 +338,17 @@ export default {
185
338
  slotNames,
186
339
  // 当前值
187
340
  currentValue,
341
+ // 当前是否显示前置插槽
342
+ currentBefore,
343
+ // 当前是否显示后置插槽
344
+ currentAfter,
188
345
  // 当前样式
189
346
  currentClass,
347
+
348
+ // 切换显示前置插槽
349
+ toggleBefore,
350
+ // 切换显示后置插槽
351
+ toggleAfter,
190
352
  }
191
353
  }
192
354
  }
@@ -215,6 +215,11 @@ export default {
215
215
  },
216
216
  // 树节点点击
217
217
  treeNodeClick: Function,
218
+ // 选中第一个树节点
219
+ treeSelectFirstNode: {
220
+ type: Boolean,
221
+ default: true,
222
+ },
218
223
  // 显示树筛选
219
224
  treeFilter: Boolean,
220
225
  // 树位置
@@ -287,7 +292,7 @@ export default {
287
292
  const treeFilterValue = ref('')
288
293
 
289
294
  // 树选择数据
290
- const treeSelected = ref('')
295
+ const treeSelected = ref(null)
291
296
 
292
297
  // ==========【计算属性】==========================================================================================
293
298
 
@@ -330,34 +335,67 @@ export default {
330
335
 
331
336
  // ==========【监听数据】=========================================================================================
332
337
 
333
- /**
334
- * 监听树选择数据
335
- */
338
+ // 如果有树节点点击方法
336
339
  if (_.isFunction(props.treeNodeClick)) {
340
+
341
+ /**
342
+ * 树节点 all
343
+ */
344
+ const treeNodesAll = computed(function () {
345
+ return utils.collection(props.treeNodes)
346
+ .keyBy(props.treeNodeKey)
347
+ .toObject()
348
+ })
349
+
350
+ // 是否已选择过第一个节点
351
+ let isSelectedFirstNode = false
352
+
353
+ /**
354
+ * 监听树选择数据
355
+ */
337
356
  watch(treeSelected, function(nodeKey) {
338
357
 
358
+ // 如果节点值不是有效值
359
+ if (! utils.isValidValue(nodeKey)) {
360
+
361
+ // 则无任何操作
362
+ return
363
+ }
364
+
339
365
  // 树节点点击
340
- const res = props.treeNodeClick({
341
- nodeKey,
342
- node: treeRef.value.getNodeByKey(nodeKey),
343
- $table
344
- })
366
+ const res = props.treeNodeClick(nodeKey, treeNodesAll.value[nodeKey])
345
367
 
346
- if (! _.isNil(res)) {
368
+ if (utils.isValidObject(res)) {
347
369
 
348
- if (res === false) {
349
- return
350
- }
370
+ // 设置表格传参
371
+ $table.setQuery(res)
372
+
373
+ // 表格重新加载
374
+ $table.tableReload()
375
+ }
376
+ })
351
377
 
352
- if (utils.isValidObject(res)) {
378
+ /**
379
+ * 监听树节点数据
380
+ */
381
+ watch(() => props.treeNodes, function (val) {
353
382
 
354
- // 设置表格传参
355
- $table.setQuery(res)
383
+ // 如果已选择过第一个节点
384
+ if (isSelectedFirstNode) {
356
385
 
357
- // 表格重新加载
358
- $table.tableReload()
359
- }
386
+ // 则无任何操作
387
+ return
360
388
  }
389
+
390
+ // 选中第一个节点的值
391
+ treeSelected.value = val[0][props.treeNodeKey]
392
+
393
+ // 已选择过第一个节点
394
+ isSelectedFirstNode = true
395
+
396
+ }, {
397
+ // 立即执行
398
+ immediate: true,
361
399
  })
362
400
  }
363
401
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -135,6 +135,22 @@
135
135
  */
136
136
  .n-field-fieldset {
137
137
  &.q-field {
138
+
139
+ // 紧凑模式
140
+ &--dense {
141
+ // 紧凑模式最小高度
142
+ //.q-field__control,
143
+ //.q-field__marginal {
144
+ // min-height: 44px;
145
+ //}
146
+
147
+ &.q-field--float {
148
+ .q-field__label {
149
+ transform: translateY(-80%) scale(0.85) !important;
150
+ }
151
+ }
152
+ }
153
+
138
154
  &--labeled {
139
155
  .q-field__prefix,
140
156
  .q-field__suffix,
@@ -164,15 +180,6 @@
164
180
  }
165
181
  }
166
182
 
167
- // 紧凑模式
168
- &--dense {
169
- &.q-field--float {
170
- .q-field__label {
171
- transform: translateY(-80%) scale(0.85) !important;
172
- }
173
- }
174
- }
175
-
176
183
  .q-field__native,
177
184
  .q-field__input {
178
185
  z-index: 2;
@@ -208,4 +215,3 @@
208
215
  }
209
216
  }
210
217
  }
211
-
@@ -29,6 +29,18 @@ $dark-td-bg-color: $dark;
29
29
  height: 40px;
30
30
  }
31
31
  }
32
+
33
+ &--horizontal-separator,
34
+ &--cell-separator {
35
+ tbody {
36
+ // 表格内容最后一排数据底部加上横线
37
+ &.q-virtual-scroll__content {
38
+ tr:last-child > td {
39
+ border-bottom-width: 1px;
40
+ }
41
+ }
42
+ }
43
+ }
32
44
  }
33
45
 
34
46
  // 宫格模式
package/utils/$power.js CHANGED
@@ -846,11 +846,6 @@ async function request(params) {
846
846
  // --------------------------------------------------
847
847
  if (o.data.type === dicts.POWER_DATA_TYPE__OPEN) {
848
848
 
849
- // 请求前执行
850
- if (await utils.runAsync(o.requestBefore)({ params: o, requestData: query }) === false) {
851
- return
852
- }
853
-
854
849
  query = formatQuery(query, true)
855
850
 
856
851
  // 如果有增加来源页面参数
@@ -859,6 +854,15 @@ async function request(params) {
859
854
  query.n_frompage = encodeURIComponent($currentRoute.fullPath)
860
855
  }
861
856
 
857
+ // 请求前执行
858
+ const resBefore = await utils.runAsync(o.requestBefore)({ params: o, requestData: query })
859
+ if (resBefore !== void 0) {
860
+ if (resBefore === false) {
861
+ return
862
+ }
863
+ query = resBefore
864
+ }
865
+
862
866
  utils.router.push({
863
867
  path: o.data.url,
864
868
  query,
@@ -952,8 +956,12 @@ async function request(params) {
952
956
  async function onRequest() {
953
957
 
954
958
  // 请求前执行
955
- if (await utils.runAsync(o.requestBefore)({ params: o, requestData }) === false) {
956
- return
959
+ const resBefore = await utils.runAsync(o.requestBefore)({ params: o, requestData })
960
+ if (resBefore !== void 0) {
961
+ if (resBefore === false) {
962
+ return
963
+ }
964
+ requestData = resBefore
957
965
  }
958
966
 
959
967
  // 请求
package/utils/arr.js ADDED
@@ -0,0 +1,47 @@
1
+ /*
2
+ * 操作数组
3
+ */
4
+ utils.arr = {
5
+
6
+ /**
7
+ * 增加
8
+ */
9
+ add(children, index, newItem) {
10
+ if (Array.isArray(children)) {
11
+ children.splice(index + 1, 0, _.isFunction(newItem) ? newItem() : newItem)
12
+ }
13
+ },
14
+
15
+ /**
16
+ * 删除
17
+ */
18
+ delete(children, index) {
19
+ if (Array.isArray(children)) {
20
+ children.splice(index, 1)
21
+ }
22
+ },
23
+
24
+ /**
25
+ * 上移
26
+ */
27
+ up(children, index) {
28
+ if (Array.isArray(children)) {
29
+ // 在上一项插入该项
30
+ children.splice(index - 1, 0, children[index])
31
+ // 删除后一项
32
+ children.splice(index + 1, 1)
33
+ }
34
+ },
35
+
36
+ /**
37
+ * 下移
38
+ */
39
+ down(children, index) {
40
+ if (Array.isArray(children)) {
41
+ // 在下一项插入该项
42
+ children.splice(index + 2, 0, children[index])
43
+ // 删除前一项
44
+ children.splice(index, 1)
45
+ }
46
+ },
47
+ }