wui-components-v2 1.1.57 → 1.1.59
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/card-botom-buttons/card-botom-buttons.vue +1 -1
- package/components/detail-popup/detail-popup.vue +28 -0
- package/components/fold-card/fold-card.vue +15 -27
- package/components/form-control/form-control.vue +131 -263
- package/components/label-value/label-value.vue +36 -0
- package/components/wui-edit-page/wui-edit-page.vue +3 -0
- package/components/wui-enume-select-control/wui-enume-select-control.vue +16 -4
- package/components/wui-select-list/wui-select-list.vue +59 -43
- package/components/wui-select-popup/wui-select-popup.vue +602 -0
- package/package.json +1 -1
- package/utils/control-type-supportor.ts +0 -1
|
@@ -34,8 +34,7 @@ async function getPageConfig() {
|
|
|
34
34
|
config.value = res.ltmplConfig
|
|
35
35
|
getEnums()
|
|
36
36
|
}
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
37
|
+
} catch (error) {
|
|
39
38
|
console.log(error)
|
|
40
39
|
}
|
|
41
40
|
}
|
|
@@ -44,7 +43,7 @@ const comEnums = computed(() => {
|
|
|
44
43
|
const mstrucId = config.value?.criterias?.find(item => item.sourceId === props.id)?.mstrucId
|
|
45
44
|
|
|
46
45
|
if (mstrucId) {
|
|
47
|
-
return enumColumn.value[mstrucId]?.map(
|
|
46
|
+
return enumColumn.value[mstrucId]?.map(item => {
|
|
48
47
|
return {
|
|
49
48
|
id: item.id,
|
|
50
49
|
label: item.title,
|
|
@@ -76,5 +75,18 @@ export default {
|
|
|
76
75
|
</script>
|
|
77
76
|
|
|
78
77
|
<template>
|
|
79
|
-
<wd-select-picker
|
|
78
|
+
<wd-select-picker
|
|
79
|
+
:label-width="props.labelWidth"
|
|
80
|
+
:title="props.title"
|
|
81
|
+
:placeholder="props.placeholder"
|
|
82
|
+
:disabled="props.disabled"
|
|
83
|
+
:required="props.required"
|
|
84
|
+
:rules="props.rules"
|
|
85
|
+
:z-index="props.zIndex"
|
|
86
|
+
:type="$props.type"
|
|
87
|
+
:model-value="modelValue"
|
|
88
|
+
:label="props.label"
|
|
89
|
+
:columns="comEnums"
|
|
90
|
+
@confirm="confirm"
|
|
91
|
+
/>
|
|
80
92
|
</template>
|
|
@@ -59,7 +59,7 @@ const datas = ref<Entities[]>([])
|
|
|
59
59
|
const pageTitle = ref('')
|
|
60
60
|
const selectEvent = ref('')
|
|
61
61
|
const sendSelectEvent = ref('')
|
|
62
|
-
const extControlType = ref('relselect')// 选择模式,例如:单选:relselect、多选
|
|
62
|
+
const extControlType = ref('relselect') // 选择模式,例如:单选:relselect、多选
|
|
63
63
|
const model = ref<FoldCardModel>('simple')
|
|
64
64
|
const searchData = ref('')
|
|
65
65
|
const enumColumn = ref<Enums>({})
|
|
@@ -76,28 +76,26 @@ onLoad((option: any) => {
|
|
|
76
76
|
// 必须在 onLoad 内注册:setup 阶段 sendSelectEvent 仍为空字符串
|
|
77
77
|
if (sendSelectEvent.value) {
|
|
78
78
|
uni.$once(sendSelectEvent.value, (data: string | string[]) => {
|
|
79
|
-
if (!data)
|
|
80
|
-
return
|
|
79
|
+
if (!data) return
|
|
81
80
|
|
|
82
81
|
if (Array.isArray(data)) {
|
|
83
82
|
const newdata: Record<string, string> = {}
|
|
84
|
-
data.forEach(
|
|
83
|
+
data.forEach(item => {
|
|
85
84
|
newdata[item.split('@R@')[0]] = item
|
|
86
85
|
})
|
|
87
86
|
selectData.value = newdata
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
87
|
+
} else {
|
|
90
88
|
selectData.value[data.split('@R@')[0]] = data
|
|
91
89
|
}
|
|
92
90
|
})
|
|
93
91
|
}
|
|
94
92
|
getPageConfig()
|
|
95
93
|
})
|
|
96
|
-
const selectData = ref<Record<string, string>>({})// 选择数据
|
|
94
|
+
const selectData = ref<Record<string, string>>({}) // 选择数据
|
|
97
95
|
const selectDataforMat = computed(() => {
|
|
98
96
|
const newdata: Record<string, string> = {}
|
|
99
97
|
if (typeof selectData.value === 'object' && selectData.value !== null) {
|
|
100
|
-
Object.values(selectData.value).forEach(
|
|
98
|
+
Object.values(selectData.value).forEach(item => {
|
|
101
99
|
newdata[item.split('@R@')[0]] = item.split('@R@')[0]
|
|
102
100
|
})
|
|
103
101
|
}
|
|
@@ -115,8 +113,7 @@ async function getPageConfig() {
|
|
|
115
113
|
config.value = res.ltmplConfig
|
|
116
114
|
getEnums()
|
|
117
115
|
}
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
116
|
+
} catch (error) {
|
|
120
117
|
console.log(error)
|
|
121
118
|
}
|
|
122
119
|
}
|
|
@@ -131,17 +128,14 @@ async function getEnums() {
|
|
|
131
128
|
}
|
|
132
129
|
})
|
|
133
130
|
|
|
134
|
-
if (!params.length)
|
|
135
|
-
return
|
|
131
|
+
if (!params.length) return
|
|
136
132
|
const res = await enums(params.join('&'))
|
|
137
133
|
enumColumn.value = res.enumMap || {}
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
134
|
+
} catch (error) {
|
|
140
135
|
console.log('error:', error)
|
|
141
136
|
}
|
|
142
137
|
}
|
|
143
138
|
|
|
144
|
-
|
|
145
139
|
// @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
|
|
146
140
|
async function queryList(pageNo: number, pageSize: number) {
|
|
147
141
|
// 此处请求仅为演示,请替换为自己项目中的请求
|
|
@@ -156,16 +150,15 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
156
150
|
// paging.value.reload() // 手动触发加载
|
|
157
151
|
// })
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
153
|
+
const search = uni.getStorageSync('paramsData')?.changedData || {}
|
|
154
|
+
const newParams = {
|
|
155
|
+
thirdCriteria: search.relValueField3 || '',
|
|
156
|
+
secondCriteria: search.relValueField?.toString() || '',
|
|
157
|
+
}
|
|
165
158
|
const params = Object.entries(newParams)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
let qre = searchData.value
|
|
159
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
160
|
+
.join('&')
|
|
161
|
+
let qre = searchData.value ? `${searchData.value + '&' + params}` : params
|
|
169
162
|
if (config.value.defaultCriteriaValue) {
|
|
170
163
|
for (const key in config.value.defaultCriteriaValue) {
|
|
171
164
|
if (Object.prototype.hasOwnProperty.call(config.value.defaultCriteriaValue, key)) {
|
|
@@ -178,14 +171,13 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
178
171
|
}
|
|
179
172
|
|
|
180
173
|
try {
|
|
181
|
-
const res = await pageKey(sourceId.value, '', qre)// 获取key
|
|
182
|
-
const data = await listData(res.key, pageNo, pageSize)// 获取数据
|
|
174
|
+
const res = await pageKey(sourceId.value, '', qre) // 获取key
|
|
175
|
+
const data = await listData(res.key, pageNo, pageSize) // 获取数据
|
|
183
176
|
// const count = await getPageTotal(key.data?.key)// 获取总数
|
|
184
177
|
Zpaging.value.complete(data.entities)
|
|
185
178
|
|
|
186
179
|
// emits('loadData', data.data.entities)
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
180
|
+
} catch (error) {
|
|
189
181
|
Zpaging.value.complete(false)
|
|
190
182
|
console.error(error)
|
|
191
183
|
}
|
|
@@ -200,7 +192,7 @@ function handleChange(item: Entities) {
|
|
|
200
192
|
}
|
|
201
193
|
|
|
202
194
|
// 判断是否为单选,清空选项
|
|
203
|
-
if (extControlType.value === 'relselect'||extControlType.value === 'relselect-extdis') {
|
|
195
|
+
if (extControlType.value === 'relselect' || extControlType.value === 'relselect-extdis') {
|
|
204
196
|
selectData.value = {}
|
|
205
197
|
}
|
|
206
198
|
|
|
@@ -239,15 +231,15 @@ function submitSearch(data: any) {
|
|
|
239
231
|
Zpaging.value.reload()
|
|
240
232
|
}
|
|
241
233
|
const showAddressInfo = computed(() => {
|
|
242
|
-
return extControlType.value=='relselect-extdis' || false
|
|
234
|
+
return extControlType.value == 'relselect-extdis' || false
|
|
243
235
|
})
|
|
244
|
-
const formatAddress = (value:string) => {
|
|
236
|
+
const formatAddress = (value: string) => {
|
|
245
237
|
return (value?.split(',') || [])[2] || ''
|
|
246
238
|
}
|
|
247
|
-
|
|
248
|
-
return ['relselect','relselect-extdis'].includes(extControlType.value)?'':'square'
|
|
249
|
-
|
|
250
|
-
|
|
239
|
+
const checkboxType: any = computed(() => {
|
|
240
|
+
return ['relselect', 'relselect-extdis'].includes(extControlType.value) ? '' : 'square'
|
|
241
|
+
})
|
|
242
|
+
onUnmounted(() => {
|
|
251
243
|
uni.removeStorageSync('paramsData')
|
|
252
244
|
})
|
|
253
245
|
</script>
|
|
@@ -255,22 +247,48 @@ const formatAddress = (value:string) => {
|
|
|
255
247
|
<template>
|
|
256
248
|
<z-paging ref="Zpaging" v-model="datas" :show-loading-more-when-reload="true" @query="queryList">
|
|
257
249
|
<template #top>
|
|
258
|
-
<Search
|
|
250
|
+
<Search
|
|
251
|
+
:enum-column="enumColumn"
|
|
252
|
+
:criterias="config.criterias"
|
|
253
|
+
:primary-criteria="config.primaryCriteria"
|
|
254
|
+
@submit="submitSearch"
|
|
255
|
+
/>
|
|
259
256
|
<!-- <view>
|
|
260
257
|
<ListTopButtons :buttons="config.buttons" :source-id="sourceId" :page-title="pageTitle" />
|
|
261
258
|
</view> -->
|
|
262
259
|
<slot name="top" />
|
|
263
260
|
</template>
|
|
264
261
|
|
|
265
|
-
<foldCard
|
|
262
|
+
<foldCard
|
|
263
|
+
v-for="(item, index) in datas"
|
|
264
|
+
:key="item.code"
|
|
265
|
+
:index="index"
|
|
266
|
+
:data="item"
|
|
267
|
+
:columns="config.columns"
|
|
268
|
+
:primary-column="config.primaryColumn"
|
|
269
|
+
:second-column="config.secondColumn"
|
|
270
|
+
:model="model"
|
|
271
|
+
:groups="config"
|
|
272
|
+
:source-id="sourceId"
|
|
273
|
+
@click="
|
|
274
|
+
() => {
|
|
275
|
+
handleChange(item)
|
|
276
|
+
}
|
|
277
|
+
"
|
|
278
|
+
>
|
|
266
279
|
<template #select>
|
|
267
|
-
<wd-checkbox
|
|
280
|
+
<wd-checkbox
|
|
281
|
+
:true-value="`${item.code}`"
|
|
282
|
+
false-value=""
|
|
283
|
+
:model-value="selectDataforMat[item.code]"
|
|
284
|
+
:type="checkboxType"
|
|
285
|
+
/>
|
|
268
286
|
</template>
|
|
269
287
|
|
|
270
|
-
<template #addressInfo v-if="showAddressInfo"
|
|
288
|
+
<template #addressInfo v-if="showAddressInfo">
|
|
271
289
|
<div>{{ item.fieldMap[config.extDisplayConfig?.secondColumn?.sourceId] }}</div>
|
|
272
290
|
</template>
|
|
273
|
-
<template #detailAddress v-if="showAddressInfo"
|
|
291
|
+
<template #detailAddress v-if="showAddressInfo">
|
|
274
292
|
<div>{{ formatAddress(item.fieldMap[config.extDisplayConfig?.cardShowCols?.[0]?.sourceId]) }}</div>
|
|
275
293
|
</template>
|
|
276
294
|
<!-- <template #buttons>
|
|
@@ -284,9 +302,7 @@ const formatAddress = (value:string) => {
|
|
|
284
302
|
<!-- <wd-button class="flex-1" type="info" @click="cancel">
|
|
285
303
|
取消
|
|
286
304
|
</wd-button> -->
|
|
287
|
-
<wd-button custom-class="flex-1" @click="confirm">
|
|
288
|
-
确定
|
|
289
|
-
</wd-button>
|
|
305
|
+
<wd-button custom-class="flex-1" @click="confirm">确定</wd-button>
|
|
290
306
|
</view>
|
|
291
307
|
</slot>
|
|
292
308
|
</template>
|