wui-components-v2 1.2.65 → 1.2.67
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/api/page.ts +4 -2
- package/components/fold-card/fold-card.vue +7 -3
- package/components/fold-card2/fold-card2.vue +7 -1
- package/components/label-value/label-value.vue +46 -3
- package/components/list-top-buttons/list-top-buttons.vue +12 -1
- package/components/search/search.vue +18 -1
- package/components/wui-list/wui-list.vue +39 -4
- package/components/wui-list copy/wui-list.vue +21 -1
- package/package.json +1 -1
- package/type.ts +22 -0
package/api/page.ts
CHANGED
|
@@ -23,9 +23,11 @@ export async function pageConfig(sourceId: string): Promise<PageConfig> {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// 获取列表页面数据key
|
|
26
|
-
export function pageKey(sourceId: string, mainCode: string = '', query: string = '') {
|
|
26
|
+
export function pageKey(sourceId: string, mainCode: string = '', query: string = '', menuId: string = '') {
|
|
27
|
+
// menuId 未传时回退为 sourceId,保持原有行为
|
|
28
|
+
const menu = menuId || sourceId
|
|
27
29
|
return req({
|
|
28
|
-
url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${
|
|
30
|
+
url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${menu}&${query}`,
|
|
29
31
|
})
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, defineEmits, defineOptions, defineProps, ref } from 'vue'
|
|
3
|
-
import type { Columns, Entities, Enums, FoldCardModel, Groups } from '../../type'
|
|
3
|
+
import type { Columns, Entities, Enums, FieldJump, FoldCardModel, Groups } from '../../type'
|
|
4
4
|
import { formatItemData } from '../../utils'
|
|
5
5
|
import LabelValue from '../label-value/label-value.vue'
|
|
6
6
|
import { useManualTheme } from '../../composables/useManualTheme'
|
|
@@ -37,6 +37,10 @@ const props = withDefaults(
|
|
|
37
37
|
* 自定义详情按钮回调,透传给 LabelValue。showDetailPopup 为 false 时优先使用
|
|
38
38
|
*/
|
|
39
39
|
detailButtonHandle?: (data: Entities) => void
|
|
40
|
+
/**
|
|
41
|
+
* 字段跳转配置(ltmplConfig.fieldJumps),透传给 LabelValue
|
|
42
|
+
*/
|
|
43
|
+
fieldJumps?: FieldJump[]
|
|
40
44
|
}>(),
|
|
41
45
|
{
|
|
42
46
|
showDetailPopup: true,
|
|
@@ -156,12 +160,12 @@ function toggleCollapse(contentId: string) {
|
|
|
156
160
|
<view class="mb-3">
|
|
157
161
|
<!-- 订单信息 -->
|
|
158
162
|
<view class="text-sm space-y-3">
|
|
159
|
-
<LabelValue :exhibit-data="exhibitData" :data="data" :index="index" :show-detail-popup="showDetailPopup" :detail-button-handle="detailButtonHandle" />
|
|
163
|
+
<LabelValue :exhibit-data="exhibitData" :data="data" :index="index" :show-detail-popup="showDetailPopup" :detail-button-handle="detailButtonHandle" :field-jumps="fieldJumps" />
|
|
160
164
|
|
|
161
165
|
<!-- 可折叠内容 -->
|
|
162
166
|
<view :id="`${data.code}`" ref="contentRef">
|
|
163
167
|
<view class="space-y-3">
|
|
164
|
-
<LabelValue :exhibit-data="collapseData" :data="data" :index="index" :show-detail-popup="showDetailPopup" :detail-button-handle="detailButtonHandle" />
|
|
168
|
+
<LabelValue :exhibit-data="collapseData" :data="data" :index="index" :show-detail-popup="showDetailPopup" :detail-button-handle="detailButtonHandle" :field-jumps="fieldJumps" />
|
|
165
169
|
</view>
|
|
166
170
|
</view>
|
|
167
171
|
</view>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, defineEmits, defineOptions, defineProps, ref } from 'vue'
|
|
3
|
-
import type { Columns, Entities, Enums, FoldCardModel, Groups } from '../../type'
|
|
3
|
+
import type { Columns, Entities, Enums, FieldJump, FoldCardModel, Groups } from '../../type'
|
|
4
4
|
import { formatItemData, getEnumColor } from '../../utils'
|
|
5
5
|
import LabelValue from '../label-value/label-value.vue'
|
|
6
6
|
import { useManualTheme } from '../../composables/useManualTheme'
|
|
@@ -47,6 +47,10 @@ const props = withDefaults(
|
|
|
47
47
|
* 自定义详情按钮回调,透传给 LabelValue。showDetailPopup 为 false 时优先使用
|
|
48
48
|
*/
|
|
49
49
|
detailButtonHandle?: (data: Entities) => void
|
|
50
|
+
/**
|
|
51
|
+
* 字段跳转配置(ltmplConfig.fieldJumps),透传给 LabelValue
|
|
52
|
+
*/
|
|
53
|
+
fieldJumps?: FieldJump[]
|
|
50
54
|
}>(),
|
|
51
55
|
{
|
|
52
56
|
// 标题旁标签默认不展示
|
|
@@ -198,6 +202,7 @@ function toggleCollapse(contentId: string) {
|
|
|
198
202
|
:index="index"
|
|
199
203
|
:show-detail-popup="showDetailPopup"
|
|
200
204
|
:detail-button-handle="detailButtonHandle"
|
|
205
|
+
:field-jumps="fieldJumps"
|
|
201
206
|
/>
|
|
202
207
|
|
|
203
208
|
<!-- 可折叠内容 -->
|
|
@@ -209,6 +214,7 @@ function toggleCollapse(contentId: string) {
|
|
|
209
214
|
:index="index"
|
|
210
215
|
:show-detail-popup="showDetailPopup"
|
|
211
216
|
:detail-button-handle="detailButtonHandle"
|
|
217
|
+
:field-jumps="fieldJumps"
|
|
212
218
|
/>
|
|
213
219
|
</view>
|
|
214
220
|
</view>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, defineOptions, defineProps, ref } from 'vue'
|
|
3
|
-
import type { Columns, Entities } from '../../type'
|
|
3
|
+
import type { Columns, Entities, FieldJump } from '../../type'
|
|
4
4
|
import { downloadFile, formatItemData } from '../../utils'
|
|
5
5
|
import ControlTypeSupportor from '../../utils/control-type-supportor'
|
|
6
6
|
import VideoPlay from '../video-play/video-play.vue'
|
|
@@ -27,6 +27,11 @@ const props = withDefaults(
|
|
|
27
27
|
* 自定义详情按钮回调,showDetailPopup 为 false 时优先使用
|
|
28
28
|
*/
|
|
29
29
|
detailButtonHandle?: (data: Entities) => void
|
|
30
|
+
/**
|
|
31
|
+
* 字段跳转配置(ltmplConfig.fieldJumps)。
|
|
32
|
+
* 当字段存在于 fieldJumps 中时,才渲染可点击的跳转文字。
|
|
33
|
+
*/
|
|
34
|
+
fieldJumps?: FieldJump[]
|
|
30
35
|
}>(),
|
|
31
36
|
{
|
|
32
37
|
showDetailPopup: true,
|
|
@@ -49,10 +54,27 @@ function isControlType(item: Columns): string {
|
|
|
49
54
|
)
|
|
50
55
|
}
|
|
51
56
|
|
|
57
|
+
/**
|
|
58
|
+
* 判断当前字段是否配置了字段跳转(fieldJumps)。
|
|
59
|
+
* 通过字段的 mstrucId 与 fieldJumps 中的 appendMstrucId 匹配。
|
|
60
|
+
*/
|
|
61
|
+
function hasFieldJump(item: Columns): boolean {
|
|
62
|
+
return !!getFieldJump(item)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 获取当前字段在 fieldJumps 中匹配的配置项。
|
|
67
|
+
* 通过字段的 mstrucId 与 fieldJumps 中的 appendMstrucId 匹配。
|
|
68
|
+
*/
|
|
69
|
+
function getFieldJump(item: Columns): FieldJump | undefined {
|
|
70
|
+
if (!props.fieldJumps?.length) return undefined
|
|
71
|
+
return props.fieldJumps.find(fieldJump => fieldJump.appendMstrucId === item.mstrucId)
|
|
72
|
+
}
|
|
73
|
+
|
|
52
74
|
/**
|
|
53
75
|
* 跳转详情页面(showDetailPopup 为 false 时触发)
|
|
54
|
-
*
|
|
55
|
-
*
|
|
76
|
+
* 当字段命中 fieldJumps 时,使用配置中的 mobilePath 直接跳转;
|
|
77
|
+
* 否则使用字段自身的 sourceId 和值的 code 跳转到默认详情页。
|
|
56
78
|
*/
|
|
57
79
|
function goDetail(item: Columns) {
|
|
58
80
|
if (props.detailButtonHandle) {
|
|
@@ -68,6 +90,24 @@ function goDetail(item: Columns) {
|
|
|
68
90
|
if (typeof rawValue === 'string' && rawValue.includes('@,@')) {
|
|
69
91
|
code = rawValue.split('@,@')[0]?.split('@R@')[0]
|
|
70
92
|
}
|
|
93
|
+
// 命中 fieldJumps 时,使用 mobilePath 跳转,并将 searchParams 中的
|
|
94
|
+
// title 作为参数名,参数值优先用 id 从当前行 fieldMap 取值,取不到则回退 defaultValue
|
|
95
|
+
const fieldJump = getFieldJump(item)
|
|
96
|
+
if (fieldJump?.mobilePath) {
|
|
97
|
+
const params = (fieldJump.searchParams || [])
|
|
98
|
+
.map(param => {
|
|
99
|
+
const fieldValue = props.data.fieldMap[param.id]
|
|
100
|
+
const value = fieldValue ?? param.defaultValue ?? ''
|
|
101
|
+
return `${encodeURIComponent(param.title ?? '')}=${encodeURIComponent(String(value))}`
|
|
102
|
+
})
|
|
103
|
+
.join('&')
|
|
104
|
+
const sep = params ? (fieldJump.mobilePath.includes('?') ? '&' : '?') : ''
|
|
105
|
+
// 对完整 URL 编码,避免 mobilePath 中的中文/全角字符在 H5 hash 路由下解析错乱
|
|
106
|
+
uni.navigateTo({
|
|
107
|
+
url: encodeURI(`${fieldJump.mobilePath}${sep}${params}`),
|
|
108
|
+
})
|
|
109
|
+
return
|
|
110
|
+
}
|
|
71
111
|
// 使用字段自身的 sourceId(参考 w-card.vue goto('link'))
|
|
72
112
|
uni.navigateTo({
|
|
73
113
|
url: `/pages/details-page/index?sourceId=${item.sourceId}&id=${code}&title=${item.title || ''}`,
|
|
@@ -180,6 +220,9 @@ function goDetail(item: Columns) {
|
|
|
180
220
|
{{ formatItemData(data.fieldMap[item.sourceId], isControlType(item)) }}
|
|
181
221
|
</view>
|
|
182
222
|
</view>
|
|
223
|
+
<view v-else-if="hasFieldJump(item)" class="text-[#1c64fd]" @click="goDetail(item)">
|
|
224
|
+
{{ formatItemData(data.fieldMap[item.sourceId], isControlType(item)) }}
|
|
225
|
+
</view>
|
|
183
226
|
<openValueMore v-else :text="formatItemData(data.fieldMap[item.sourceId], isControlType(item))" />
|
|
184
227
|
</view>
|
|
185
228
|
<VideoPlay ref="videoPlayRef" />
|
|
@@ -34,6 +34,11 @@ const props = withDefaults(
|
|
|
34
34
|
* 是否处于批量操作(勾选)模式。为 true 时「批量操作」按钮文本切换为「取消批量操作」。
|
|
35
35
|
*/
|
|
36
36
|
batchEditing?: boolean
|
|
37
|
+
/**
|
|
38
|
+
* 是否存在批量操作能力(config.buttons 含 batchDelete/batchEdit,或有 multible action)。
|
|
39
|
+
* 为 false 时不展示「批量操作」按钮。
|
|
40
|
+
*/
|
|
41
|
+
batchOpsVisible?: boolean
|
|
37
42
|
}>(),
|
|
38
43
|
{
|
|
39
44
|
showButtons: true,
|
|
@@ -279,7 +284,13 @@ console.log(props.buttons, '33333')
|
|
|
279
284
|
>
|
|
280
285
|
{{ props.config?.exportBtnTitle || '导出' }}
|
|
281
286
|
</wd-button>
|
|
282
|
-
<wd-button
|
|
287
|
+
<wd-button
|
|
288
|
+
v-if="props.batchOpsVisible !== false"
|
|
289
|
+
class="flex-1"
|
|
290
|
+
type="primary"
|
|
291
|
+
@click="emit('batchEdit')"
|
|
292
|
+
:icon="props.batchEditing ? 'close' : 'edit'"
|
|
293
|
+
>
|
|
283
294
|
{{ props.batchEditing ? '取消批量操作' : props.config?.editBtnTitle || '批量操作' }}
|
|
284
295
|
</wd-button>
|
|
285
296
|
</view>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, defineEmits, defineOptions, defineProps, ref } from 'vue'
|
|
2
|
+
import { computed, defineEmits, defineOptions, defineProps, ref, watch } from 'vue'
|
|
3
3
|
import type { Enums, Fields, Split2TabCriterias } from '../../type'
|
|
4
4
|
import formControl from '../form-control/form-control.vue'
|
|
5
5
|
import ControlTypeSupportor from '../../utils/control-type-supportor'
|
|
@@ -12,6 +12,11 @@ const props = defineProps<{
|
|
|
12
12
|
enumColumn?: Enums
|
|
13
13
|
mainCode?: string
|
|
14
14
|
split2TabCriterias?: Split2TabCriterias[]
|
|
15
|
+
/**
|
|
16
|
+
* URL 跳转携带的筛选默认值(key 为字段 sourceId)。
|
|
17
|
+
* 首次提供时填充到筛选表单作为默认值,不会覆盖用户后续修改。
|
|
18
|
+
*/
|
|
19
|
+
defaultEntity?: { [key: string]: any }
|
|
15
20
|
}>()
|
|
16
21
|
const emits = defineEmits(['submit'])
|
|
17
22
|
// 自行携带暗色主题,避免在非 tabBar 页面(无 wd-config-provider 祖先)时
|
|
@@ -27,6 +32,18 @@ const preferredFormControlRef = ref()
|
|
|
27
32
|
const preferredRefreshKey = ref(0)
|
|
28
33
|
// 共享实体:外置 preferred 字段与弹窗筛选字段通过它进行双向同步
|
|
29
34
|
const entity = ref<{ [key: string]: any }>({})
|
|
35
|
+
// URL 跳转携带的筛选默认值:首次提供非空值时填充到 entity(仅一次,不覆盖用户后续修改)
|
|
36
|
+
let defaultFilled = false
|
|
37
|
+
watch(
|
|
38
|
+
() => props.defaultEntity,
|
|
39
|
+
val => {
|
|
40
|
+
if (val && Object.keys(val).length && !defaultFilled) {
|
|
41
|
+
Object.assign(entity.value, normalizeForEntity(val))
|
|
42
|
+
defaultFilled = true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{ immediate: true }
|
|
46
|
+
)
|
|
30
47
|
// 判断字段实际渲染的控件类型是否为纯文本输入(优先 extControlType,回退 controlType)
|
|
31
48
|
const isTextCriterion = (item: Fields) => ControlTypeSupportor.getControlType(item) === 'text'
|
|
32
49
|
// 用于 wd-search 的搜索字段:primaryCriterion 存在时直接使用,否则取 criteria 中第一个文本类型的筛选项
|
|
@@ -168,6 +168,10 @@ const tabSearchData = ref('')
|
|
|
168
168
|
const pageType = ref('')
|
|
169
169
|
const mainCode = ref('')
|
|
170
170
|
const queryKey = ref('') // 用于导出接口的列表查询 key
|
|
171
|
+
/** URL 跳转携带的菜单 ID,用于 pageKey 请求的 menuId 参数 */
|
|
172
|
+
const menuId = ref('')
|
|
173
|
+
/** URL 跳转携带的筛选默认值(key 为字段 sourceId,去掉 c_ 前缀),作为筛选条件默认值 */
|
|
174
|
+
const urlDefaultCriteria = ref<{ [key: string]: any }>({})
|
|
171
175
|
const addEvent = generateHighResolutionID() // 全局事件名称
|
|
172
176
|
const toast = useGlobalToast()
|
|
173
177
|
const message = useGlobalMessage()
|
|
@@ -184,8 +188,21 @@ const allChecked = computed(() => {
|
|
|
184
188
|
const hasSelected = computed(() => selectedCodes.value.size > 0)
|
|
185
189
|
/** 是否处于勾选模式(常驻 batchSelect 或点「批量编辑」动态进入 selectMode) */
|
|
186
190
|
const inSelectMode = computed(() => props.batchSelect || selectMode.value)
|
|
187
|
-
/**
|
|
188
|
-
|
|
191
|
+
/**
|
|
192
|
+
* 是否存在批量操作能力:config.buttons 含 batchDelete 或 batchEdit,
|
|
193
|
+
* 或 batchActionButtons 有数据(multible === true 的 action)。
|
|
194
|
+
* 供顶部「批量操作」按钮与底部批量操作条共用。
|
|
195
|
+
*/
|
|
196
|
+
const hasBatchOperation = computed(
|
|
197
|
+
() =>
|
|
198
|
+
config.value.buttons.includes('batchDelete') ||
|
|
199
|
+
config.value.buttons.includes('batchEdit') ||
|
|
200
|
+
batchActionButtons.value.length > 0
|
|
201
|
+
)
|
|
202
|
+
/**
|
|
203
|
+
* 批量操作条是否显示:进入勾选模式且存在可执行操作时显示。
|
|
204
|
+
*/
|
|
205
|
+
const showBatchBar = computed(() => inSelectMode.value && hasBatchOperation.value)
|
|
189
206
|
/** 顶部「批量编辑」点击后动态进入的勾选模式开关 */
|
|
190
207
|
const selectMode = ref(false)
|
|
191
208
|
/**
|
|
@@ -203,7 +220,8 @@ const batchActionButtons = computed(() => {
|
|
|
203
220
|
}
|
|
204
221
|
const merged = [...(config.value.customButtons || []), ...(config.value.actions || [])]
|
|
205
222
|
const seen = new Set<string>()
|
|
206
|
-
|
|
223
|
+
// 仅收集标记为批量操作(multible === true)的 action,并按 id 去重
|
|
224
|
+
return merged.filter(item => item.multible === true && (seen.has(item.id) ? false : (seen.add(item.id), true)))
|
|
207
225
|
})
|
|
208
226
|
/** 已选 code 的逗号分隔字符串,供批量接口与弹窗透传 */
|
|
209
227
|
const selectedCodesStr = computed(() => Array.from(selectedCodes.value).join(','))
|
|
@@ -379,9 +397,18 @@ onLoad((option: any) => {
|
|
|
379
397
|
pageTitle.value = option.title
|
|
380
398
|
pageType.value = option.pageType
|
|
381
399
|
mainCode.value = option.mainCode || ''
|
|
400
|
+
menuId.value = option.menuId || ''
|
|
382
401
|
uni.setNavigationBarTitle({
|
|
383
402
|
title: option.title,
|
|
384
403
|
})
|
|
404
|
+
// 解析 URL 中 c_* 参数作为筛选字段默认值(c_{sourceId}={value})
|
|
405
|
+
const criteria: { [key: string]: any } = {}
|
|
406
|
+
Object.keys(option || {}).forEach(key => {
|
|
407
|
+
if (key.startsWith('c_')) {
|
|
408
|
+
criteria[key.slice(2)] = option[key]
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
urlDefaultCriteria.value = criteria
|
|
385
412
|
getPageConfig()
|
|
386
413
|
})
|
|
387
414
|
onMounted(async () => {
|
|
@@ -427,6 +454,11 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
427
454
|
if (props.query) {
|
|
428
455
|
qre = qre ? `${qre}&${props.query}` : props.query
|
|
429
456
|
}
|
|
457
|
+
// URL 跳转携带的筛选默认值:无其他查询条件时,作为初始查询条件并入
|
|
458
|
+
const urlKeys = Object.keys(urlDefaultCriteria.value)
|
|
459
|
+
if (!qre && urlKeys.length) {
|
|
460
|
+
qre = urlKeys.map(key => `c_${key}=${urlDefaultCriteria.value[key]}`).join('&')
|
|
461
|
+
}
|
|
430
462
|
if (config.value.defaultCriteriaValue) {
|
|
431
463
|
for (const key in config.value.defaultCriteriaValue) {
|
|
432
464
|
if (Object.prototype.hasOwnProperty.call(config.value.defaultCriteriaValue, key)) {
|
|
@@ -446,7 +478,7 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
446
478
|
|
|
447
479
|
try {
|
|
448
480
|
console.log('qre', qre)
|
|
449
|
-
const res = await pageKey(internalSourceId.value, mainCode.value, qre) // 获取key
|
|
481
|
+
const res = await pageKey(internalSourceId.value, mainCode.value, qre, menuId.value) // 获取key
|
|
450
482
|
const data = await listData(res.key, pageNo, pageSize) // 获取数据
|
|
451
483
|
// 缓存最新一次的 queryKey,给顶部「导出」接口使用
|
|
452
484
|
queryKey.value = res.key || res.data?.key || ''
|
|
@@ -502,6 +534,7 @@ function tabSearchClick(data: any) {
|
|
|
502
534
|
:criteria="config.criteria"
|
|
503
535
|
:primary-criterion="config.primaryCriterion"
|
|
504
536
|
:split2-tab-criterias="config.split2TabCriterias"
|
|
537
|
+
:default-entity="urlDefaultCriteria"
|
|
505
538
|
@submit="submitSearch"
|
|
506
539
|
/>
|
|
507
540
|
<view>
|
|
@@ -516,6 +549,7 @@ function tabSearchClick(data: any) {
|
|
|
516
549
|
:show-buttons="showTopButtons"
|
|
517
550
|
:query-key="queryKey"
|
|
518
551
|
:batch-editing="selectMode"
|
|
552
|
+
:batch-ops-visible="hasBatchOperation"
|
|
519
553
|
@batch-edit="toggleBatchEdit"
|
|
520
554
|
/>
|
|
521
555
|
</view>
|
|
@@ -586,6 +620,7 @@ function tabSearchClick(data: any) {
|
|
|
586
620
|
:show-label="showLabel"
|
|
587
621
|
:show-detail-popup="showDetailPopup"
|
|
588
622
|
:detail-button-handle="detailButtonHandle"
|
|
623
|
+
:field-jumps="config.fieldJumps"
|
|
589
624
|
model="complex"
|
|
590
625
|
:select-mode="inSelectMode"
|
|
591
626
|
@select="toggleSelect"
|
|
@@ -120,9 +120,13 @@ const tabSearchData = ref('')
|
|
|
120
120
|
const pageType = ref('')
|
|
121
121
|
const mainCode = ref('')
|
|
122
122
|
const queryKey = ref('') // 用于导出接口的列表查询 key
|
|
123
|
+
/** URL 跳转携带的菜单 ID,用于 pageKey 请求的 menuId 参数 */
|
|
124
|
+
const menuId = ref('')
|
|
123
125
|
const addEvent = generateHighResolutionID() // 全局事件名称
|
|
124
126
|
// 优先使用 props 传入的 sourceId,未传则走 onLoad 路由获取
|
|
125
127
|
const internalSourceId = ref(props.sourceId)
|
|
128
|
+
/** URL 跳转携带的筛选默认值(key 为字段 sourceId,去掉 c_ 前缀),作为筛选条件默认值 */
|
|
129
|
+
const urlDefaultCriteria = ref<{ [key: string]: any }>({})
|
|
126
130
|
onLoad((option: any) => {
|
|
127
131
|
// 如果 props 没传 sourceId,则从路由参数获取
|
|
128
132
|
if (!internalSourceId.value) {
|
|
@@ -131,9 +135,18 @@ onLoad((option: any) => {
|
|
|
131
135
|
pageTitle.value = option.title
|
|
132
136
|
pageType.value = option.pageType
|
|
133
137
|
mainCode.value = option.mainCode || ''
|
|
138
|
+
menuId.value = option.menuId || ''
|
|
134
139
|
uni.setNavigationBarTitle({
|
|
135
140
|
title: option.title,
|
|
136
141
|
})
|
|
142
|
+
// 解析 URL 中 c_* 参数作为筛选字段默认值(c_{sourceId}={value})
|
|
143
|
+
const criteria: { [key: string]: any } = {}
|
|
144
|
+
Object.keys(option || {}).forEach(key => {
|
|
145
|
+
if (key.startsWith('c_')) {
|
|
146
|
+
criteria[key.slice(2)] = option[key]
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
urlDefaultCriteria.value = criteria
|
|
137
150
|
getPageConfig()
|
|
138
151
|
})
|
|
139
152
|
onMounted(async () => {
|
|
@@ -179,6 +192,11 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
179
192
|
if (props.query) {
|
|
180
193
|
qre = qre ? `${qre}&${props.query}` : props.query
|
|
181
194
|
}
|
|
195
|
+
// URL 跳转携带的筛选默认值:无其他查询条件时,作为初始查询条件并入
|
|
196
|
+
const urlKeys = Object.keys(urlDefaultCriteria.value)
|
|
197
|
+
if (!qre && urlKeys.length) {
|
|
198
|
+
qre = urlKeys.map(key => `c_${key}=${urlDefaultCriteria.value[key]}`).join('&')
|
|
199
|
+
}
|
|
182
200
|
if (config.value.defaultCriteriaValue) {
|
|
183
201
|
for (const key in config.value.defaultCriteriaValue) {
|
|
184
202
|
if (Object.prototype.hasOwnProperty.call(config.value.defaultCriteriaValue, key)) {
|
|
@@ -198,7 +216,7 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
198
216
|
|
|
199
217
|
try {
|
|
200
218
|
console.log('qre', qre)
|
|
201
|
-
const res = await pageKey(internalSourceId.value, mainCode.value, qre) // 获取key
|
|
219
|
+
const res = await pageKey(internalSourceId.value, mainCode.value, qre, menuId.value) // 获取key
|
|
202
220
|
const data = await listData(res.key, pageNo, pageSize) // 获取数据
|
|
203
221
|
// 缓存最新一次的 queryKey,给顶部「导出」接口使用
|
|
204
222
|
queryKey.value = res.key || res.data?.key || ''
|
|
@@ -254,6 +272,7 @@ function tabSearchClick(data: any) {
|
|
|
254
272
|
:criteria="config.criteria"
|
|
255
273
|
:primary-criterion="config.primaryCriterion"
|
|
256
274
|
:split2-tab-criterias="config.split2TabCriterias"
|
|
275
|
+
:default-entity="urlDefaultCriteria"
|
|
257
276
|
@submit="submitSearch"
|
|
258
277
|
/>
|
|
259
278
|
<view>
|
|
@@ -332,6 +351,7 @@ function tabSearchClick(data: any) {
|
|
|
332
351
|
:show-label="showLabel"
|
|
333
352
|
:show-detail-popup="showDetailPopup"
|
|
334
353
|
:detail-button-handle="detailButtonHandle"
|
|
354
|
+
:field-jumps="config.fieldJumps"
|
|
335
355
|
model="complex"
|
|
336
356
|
>
|
|
337
357
|
<template #buttons>
|
package/package.json
CHANGED
package/type.ts
CHANGED
|
@@ -39,6 +39,26 @@ export interface rowActions {
|
|
|
39
39
|
writes: Fields[]
|
|
40
40
|
preposes: Fields[]
|
|
41
41
|
path?: string
|
|
42
|
+
/** 是否为批量操作按钮,仅当为 true 时才展示在批量操作条上 */
|
|
43
|
+
multible?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 字段跳转参数(fieldJumps.searchParams 中的一项)
|
|
47
|
+
export interface FieldJumpParam {
|
|
48
|
+
id: string
|
|
49
|
+
title?: string
|
|
50
|
+
defaultValue?: string | null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 字段跳转配置(fieldJumps 中的一项)
|
|
54
|
+
export interface FieldJump {
|
|
55
|
+
appendMstrucId?: string
|
|
56
|
+
id: string
|
|
57
|
+
title?: string
|
|
58
|
+
path?: string
|
|
59
|
+
mobilePath?: string
|
|
60
|
+
searchParams?: FieldJumpParam[]
|
|
61
|
+
[key: string]: any
|
|
42
62
|
}
|
|
43
63
|
|
|
44
64
|
// 列表页面配置
|
|
@@ -61,6 +81,8 @@ export interface Config extends Groups {
|
|
|
61
81
|
extShowConfig?: { [key: string]: any }
|
|
62
82
|
extDisplayConfig?: { [key: string]: any }
|
|
63
83
|
copyMode?: string
|
|
84
|
+
/** 字段跳转配置,用于判断某个字段是否支持点击跳转到其他详情页 */
|
|
85
|
+
fieldJumps?: FieldJump[]
|
|
64
86
|
}
|
|
65
87
|
|
|
66
88
|
// 列表数据
|