@netang/quasar 0.0.39 → 0.0.41
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/field-date/index.vue +6 -2
- package/components/field-table/index.vue +76 -20
- package/components/field-tree/index.vue +4 -2
- package/components/input-format/index.vue +2 -2
- package/components/input-number/index.vue +2 -2
- package/components/search-item/index.vue +1 -1
- package/components/splitter/index.vue +199 -46
- package/components/table/index.vue +57 -19
- package/package.json +1 -1
- package/sass/quasar/field.scss +16 -10
- package/sass/quasar/table.scss +22 -0
- package/utils/$power.js +15 -7
- package/utils/arr.js +47 -0
- package/utils/price.js +13 -13
|
@@ -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>
|
|
@@ -151,8 +151,10 @@ export default {
|
|
|
151
151
|
* 声明属性
|
|
152
152
|
*/
|
|
153
153
|
props: {
|
|
154
|
-
// 值
|
|
155
|
-
modelValue:
|
|
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--float q-field--focused q-field--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="
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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.
|
|
652
|
+
// 或初始不加载已选数据
|
|
653
|
+
|| props.noFirstLoadSelected
|
|
635
654
|
// 或没有路由路径
|
|
636
655
|
|| ! routePath
|
|
637
656
|
) {
|
|
@@ -681,7 +700,7 @@ export default {
|
|
|
681
700
|
}
|
|
682
701
|
|
|
683
702
|
// 返回转为分隔符隔开的字符串
|
|
684
|
-
return utils.join(values, props.valueSeparator)
|
|
703
|
+
return utils.numberDeep(utils.join(values, props.valueSeparator))
|
|
685
704
|
}
|
|
686
705
|
|
|
687
706
|
/**
|
|
@@ -842,8 +861,32 @@ export default {
|
|
|
842
861
|
// 清空快捷表格已选数据
|
|
843
862
|
emitModelValue([])
|
|
844
863
|
|
|
845
|
-
//
|
|
846
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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
|
// 对话框隐藏后回调
|
|
@@ -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
|
|
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
|
-
|
|
47
|
+
// 显示前置插槽 v-model:before
|
|
48
|
+
// 注意: 如果非双向绑定, 如 :before 并不会影响内部值变化, 仅做初始值使用
|
|
49
|
+
before: {
|
|
41
50
|
type: Boolean,
|
|
42
51
|
default: true,
|
|
43
52
|
},
|
|
44
|
-
// 显示后置插槽
|
|
45
|
-
|
|
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,94 @@ 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
|
+
|
|
101
|
+
// 初始显示后置插槽
|
|
102
|
+
let rawAfter = props.after
|
|
103
|
+
|
|
104
|
+
// 如果开启缓存
|
|
105
|
+
if (props.cache) {
|
|
106
|
+
|
|
107
|
+
// 设置缓存名
|
|
108
|
+
cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}:`
|
|
109
|
+
|
|
110
|
+
// 从缓存获取初始值
|
|
111
|
+
let cache = utils.storage.get(cacheName + 'value')
|
|
112
|
+
if (cache !== null) {
|
|
113
|
+
rawValue = cache
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 如果在手机模式
|
|
117
|
+
if (props.hideBeforeInMobile && $q.platform.is.mobile) {
|
|
118
|
+
rawBefore = false
|
|
119
|
+
|
|
120
|
+
} else {
|
|
121
|
+
// 从缓存获取初始值
|
|
122
|
+
cache = utils.storage.get(cacheName + 'before')
|
|
123
|
+
if (cache !== null) {
|
|
124
|
+
rawBefore = cache
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 如果在手机模式
|
|
129
|
+
if (props.hideAfterInMobile && $q.platform.is.mobile) {
|
|
130
|
+
rawAfter = false
|
|
131
|
+
|
|
132
|
+
console.log(777, rawAfter)
|
|
133
|
+
|
|
134
|
+
} else {
|
|
135
|
+
// 从缓存获取初始值
|
|
136
|
+
cache = utils.storage.get(cacheName + 'after')
|
|
137
|
+
if (cache !== null) {
|
|
138
|
+
rawAfter = cache
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
console.log(222, rawAfter)
|
|
143
|
+
|
|
144
|
+
// 如果在手机模式
|
|
145
|
+
} else if ($q.platform.is.mobile) {
|
|
146
|
+
|
|
147
|
+
// 手机模式隐藏前置插槽
|
|
148
|
+
if (props.hideBeforeInMobile) {
|
|
149
|
+
rawBefore = false
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 手机模式隐藏后插槽
|
|
153
|
+
if (props.hideAfterInMobile) {
|
|
154
|
+
rawAfter = false
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 创建防抖睡眠方法
|
|
159
|
+
const sleep = utils.debounceSleep()
|
|
160
|
+
|
|
161
|
+
// 当前值
|
|
162
|
+
const currentValue = ref(rawValue)
|
|
163
|
+
|
|
164
|
+
// 当前是否显示前置插槽
|
|
165
|
+
const currentBefore = ref(rawBefore)
|
|
166
|
+
|
|
167
|
+
console.log(333, rawAfter)
|
|
168
|
+
|
|
169
|
+
// 当前是否显示后置插槽
|
|
170
|
+
const currentAfter = ref(rawAfter)
|
|
171
|
+
|
|
68
172
|
// ==========【计算属性】=========================================================================================
|
|
69
173
|
|
|
70
174
|
/**
|
|
@@ -75,14 +179,15 @@ export default {
|
|
|
75
179
|
const keys = []
|
|
76
180
|
|
|
77
181
|
if (utils.isValidObject(slots)) {
|
|
182
|
+
|
|
78
183
|
for (const key in slots) {
|
|
79
184
|
if (key === 'before') {
|
|
80
|
-
if (
|
|
185
|
+
if (currentBefore.value) {
|
|
81
186
|
keys.push(key)
|
|
82
187
|
}
|
|
83
188
|
|
|
84
189
|
} else if (key === 'after') {
|
|
85
|
-
if (
|
|
190
|
+
if (currentAfter.value) {
|
|
86
191
|
keys.push(key)
|
|
87
192
|
}
|
|
88
193
|
|
|
@@ -100,13 +205,13 @@ export default {
|
|
|
100
205
|
*/
|
|
101
206
|
const currentClass = computed(function () {
|
|
102
207
|
|
|
103
|
-
if (
|
|
104
|
-
if (!
|
|
208
|
+
if (currentBefore.value) {
|
|
209
|
+
if (! currentAfter.value) {
|
|
105
210
|
return 'n-splitter--hide-before'
|
|
106
211
|
}
|
|
107
212
|
|
|
108
|
-
} else if (
|
|
109
|
-
if (!
|
|
213
|
+
} else if (currentAfter.value) {
|
|
214
|
+
if (! currentBefore.value) {
|
|
110
215
|
return 'n-splitter--hide-after'
|
|
111
216
|
}
|
|
112
217
|
|
|
@@ -115,69 +220,108 @@ export default {
|
|
|
115
220
|
}
|
|
116
221
|
})
|
|
117
222
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
// 获取权限注入
|
|
121
|
-
const $power = inject(NPowerKey)
|
|
223
|
+
// ==========【方法】============================================================================================
|
|
122
224
|
|
|
123
|
-
|
|
124
|
-
|
|
225
|
+
/**
|
|
226
|
+
* 触发更新值
|
|
227
|
+
*/
|
|
228
|
+
async function emitValue(key, val) {
|
|
125
229
|
|
|
126
|
-
|
|
127
|
-
|
|
230
|
+
// 更新值
|
|
231
|
+
emit(`update:${key}`, val)
|
|
128
232
|
|
|
129
|
-
|
|
130
|
-
|
|
233
|
+
// 如果开启缓存
|
|
234
|
+
if (props.cache) {
|
|
131
235
|
|
|
132
|
-
|
|
133
|
-
|
|
236
|
+
// 延迟执行
|
|
237
|
+
await sleep(500, key)
|
|
134
238
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (cache) {
|
|
138
|
-
rawValue = cache
|
|
239
|
+
// 设置缓存(永久缓存)
|
|
240
|
+
utils.storage.set(cacheName + key, val, 0)
|
|
139
241
|
}
|
|
140
242
|
}
|
|
141
243
|
|
|
142
|
-
|
|
143
|
-
|
|
244
|
+
/**
|
|
245
|
+
* 切换显示前置插槽
|
|
246
|
+
*/
|
|
247
|
+
function toggleBefore() {
|
|
248
|
+
currentBefore.value = ! currentBefore.value
|
|
249
|
+
}
|
|
144
250
|
|
|
145
|
-
|
|
146
|
-
|
|
251
|
+
/**
|
|
252
|
+
* 切换显示后置插槽
|
|
253
|
+
*/
|
|
254
|
+
function toggleAfter() {
|
|
255
|
+
currentAfter.value = ! currentAfter.value
|
|
256
|
+
}
|
|
147
257
|
|
|
148
258
|
// ==========【监听数据】=========================================================================================
|
|
149
259
|
|
|
150
260
|
/**
|
|
151
261
|
* 监听声明值
|
|
152
262
|
*/
|
|
153
|
-
watch(()=>props.modelValue, function (val) {
|
|
263
|
+
watch(() => props.modelValue, function (val) {
|
|
264
|
+
|
|
154
265
|
// 如果值有变化
|
|
155
266
|
if (val !== currentValue.value) {
|
|
267
|
+
|
|
156
268
|
// 更新当前值
|
|
157
269
|
currentValue.value = val
|
|
158
270
|
}
|
|
159
271
|
})
|
|
160
272
|
|
|
161
273
|
/**
|
|
162
|
-
*
|
|
274
|
+
* 监听声明是否显示前置插槽
|
|
163
275
|
*/
|
|
164
|
-
watch(
|
|
276
|
+
watch(() => props.before, function (val) {
|
|
165
277
|
|
|
166
|
-
//
|
|
167
|
-
|
|
278
|
+
// 如果值有变化
|
|
279
|
+
if (val !== currentBefore.value) {
|
|
168
280
|
|
|
169
|
-
|
|
170
|
-
|
|
281
|
+
// 设置是否显示前置插槽
|
|
282
|
+
currentBefore.value = val
|
|
283
|
+
}
|
|
284
|
+
})
|
|
171
285
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
286
|
+
/**
|
|
287
|
+
* 监听声明是否显示后置插槽
|
|
288
|
+
*/
|
|
289
|
+
watch(() => props.after, function (val) {
|
|
290
|
+
|
|
291
|
+
// 如果值有变化
|
|
292
|
+
if (val !== currentAfter.value) {
|
|
293
|
+
|
|
294
|
+
// 设置是否显示后置插槽
|
|
295
|
+
currentAfter.value = val
|
|
178
296
|
}
|
|
179
297
|
})
|
|
180
298
|
|
|
299
|
+
/**
|
|
300
|
+
* 监听值
|
|
301
|
+
*/
|
|
302
|
+
watch(currentValue, async function (val) {
|
|
303
|
+
// 触发更新值
|
|
304
|
+
await emitValue('modelValue', val)
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* 监听是否显示前置插槽
|
|
309
|
+
*/
|
|
310
|
+
watch(currentBefore, async function (val) {
|
|
311
|
+
|
|
312
|
+
// 触发更新值
|
|
313
|
+
await emitValue('before', val)
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* 监听是否显示后置插槽
|
|
318
|
+
*/
|
|
319
|
+
watch(currentAfter, async function (val) {
|
|
320
|
+
|
|
321
|
+
// 触发更新值
|
|
322
|
+
await emitValue('after', val)
|
|
323
|
+
})
|
|
324
|
+
|
|
181
325
|
// ==========【返回】=============================================================================================
|
|
182
326
|
|
|
183
327
|
return {
|
|
@@ -185,8 +329,17 @@ export default {
|
|
|
185
329
|
slotNames,
|
|
186
330
|
// 当前值
|
|
187
331
|
currentValue,
|
|
332
|
+
// 当前是否显示前置插槽
|
|
333
|
+
currentBefore,
|
|
334
|
+
// 当前是否显示后置插槽
|
|
335
|
+
currentAfter,
|
|
188
336
|
// 当前样式
|
|
189
337
|
currentClass,
|
|
338
|
+
|
|
339
|
+
// 切换显示前置插槽
|
|
340
|
+
toggleBefore,
|
|
341
|
+
// 切换显示后置插槽
|
|
342
|
+
toggleAfter,
|
|
190
343
|
}
|
|
191
344
|
}
|
|
192
345
|
}
|
|
@@ -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 (
|
|
368
|
+
if (utils.isValidObject(res)) {
|
|
347
369
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
370
|
+
// 设置表格传参
|
|
371
|
+
$table.setQuery(res)
|
|
372
|
+
|
|
373
|
+
// 表格重新加载
|
|
374
|
+
$table.tableReload()
|
|
375
|
+
}
|
|
376
|
+
})
|
|
351
377
|
|
|
352
|
-
|
|
378
|
+
/**
|
|
379
|
+
* 监听树节点数据
|
|
380
|
+
*/
|
|
381
|
+
watch(() => props.treeNodes, function (val) {
|
|
353
382
|
|
|
354
|
-
|
|
355
|
-
|
|
383
|
+
// 如果已选择过第一个节点
|
|
384
|
+
if (isSelectedFirstNode) {
|
|
356
385
|
|
|
357
|
-
|
|
358
|
-
|
|
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
package/sass/quasar/field.scss
CHANGED
|
@@ -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
|
-
|
package/sass/quasar/table.scss
CHANGED
|
@@ -13,12 +13,34 @@ $dark-td-bg-color: $dark;
|
|
|
13
13
|
|
|
14
14
|
&.q-table {
|
|
15
15
|
&--dense {
|
|
16
|
+
// 复选框
|
|
17
|
+
.q-table {
|
|
18
|
+
th,
|
|
19
|
+
td {
|
|
20
|
+
&.q-table--col-auto-width:first-child {
|
|
21
|
+
padding: 0 12px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
16
26
|
thead tr,
|
|
17
27
|
tbody tr,
|
|
18
28
|
tbody td {
|
|
19
29
|
height: 40px;
|
|
20
30
|
}
|
|
21
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
|
+
}
|
|
22
44
|
}
|
|
23
45
|
|
|
24
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
|
-
|
|
956
|
-
|
|
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
|
+
}
|
package/utils/price.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 换算金额
|
|
3
|
-
*/
|
|
4
|
-
utils.price = function(value, params) {
|
|
5
|
-
return utils.decimal(value, Object.assign({
|
|
6
|
-
// 最小值
|
|
7
|
-
min: 0,
|
|
8
|
-
// 小数点位数
|
|
9
|
-
decimalLength: 2,
|
|
10
|
-
// 是否开启人民币分转元(如值 189 -> 1.89)
|
|
11
|
-
centToYuan: utils.config('priceCent') === true,
|
|
12
|
-
}, params))
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 换算金额
|
|
3
|
+
*/
|
|
4
|
+
utils.price = function(value, params) {
|
|
5
|
+
return utils.decimal(value, Object.assign({
|
|
6
|
+
// 最小值
|
|
7
|
+
min: 0,
|
|
8
|
+
// 小数点位数
|
|
9
|
+
decimalLength: 2,
|
|
10
|
+
// 是否开启人民币分转元(如值 189 -> 1.89)
|
|
11
|
+
centToYuan: utils.config('priceCent') === true,
|
|
12
|
+
}, params))
|
|
13
|
+
}
|