wui-components-v2 1.1.77 → 1.1.78
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.
|
@@ -28,6 +28,8 @@ const props = defineProps<{
|
|
|
28
28
|
addEvent?: string
|
|
29
29
|
primaryColumn: Columns
|
|
30
30
|
detailButtonHandle?: (data: Entities) => void
|
|
31
|
+
buttonDeleteAction?: { [key: string]: any }
|
|
32
|
+
buttonEditAction?: { [key: string]: any }
|
|
31
33
|
}>()
|
|
32
34
|
const toast = useGlobalToast()
|
|
33
35
|
const message = useGlobalMessage()
|
|
@@ -114,8 +116,8 @@ function detail() {
|
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
// 判断按钮是否满足条件显示
|
|
117
|
-
function isShowAction(item
|
|
118
|
-
if (item
|
|
119
|
+
function isShowAction(item?: { preposes?: Fields[] }) {
|
|
120
|
+
if (item?.preposes?.length) {
|
|
119
121
|
return item.preposes.every((prepose: Fields) => {
|
|
120
122
|
// 判断字段值是否满足要求
|
|
121
123
|
return comparator(prepose.comparator || 'equal', props.data.fieldMap[prepose.sourceId], prepose.defaultValue)
|
|
@@ -246,25 +248,26 @@ console.log(props, '3333333333333')
|
|
|
246
248
|
更多
|
|
247
249
|
</wd-button>
|
|
248
250
|
<view v-else class="flex gap-2 flex-wrap">
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
251
|
+
<template v-for="subitem in morebutns" :key="subitem.id">
|
|
252
|
+
<wd-button
|
|
253
|
+
v-if="isShowAction(subitem)"
|
|
254
|
+
plain
|
|
255
|
+
size="small"
|
|
256
|
+
@click="
|
|
257
|
+
() => {
|
|
258
|
+
select({ item: subitem })
|
|
259
|
+
}
|
|
260
|
+
"
|
|
261
|
+
>
|
|
262
|
+
{{ subitem.title }}
|
|
263
|
+
</wd-button>
|
|
264
|
+
</template>
|
|
262
265
|
</view>
|
|
263
266
|
</view>
|
|
264
267
|
|
|
265
|
-
<wd-button v-if="props.item.buttons.includes('dtmplEdit')" size="small" @click="edit()">编辑</wd-button>
|
|
268
|
+
<wd-button v-if="props.item.buttons.includes('dtmplEdit') && isShowAction(props.buttonEditAction)" size="small" @click="edit()">编辑</wd-button>
|
|
266
269
|
<wd-button v-if="props.item.buttons.includes('detail')" size="small" type="info" @click="detail()">详情</wd-button>
|
|
267
|
-
<wd-button v-if="props.item.buttons.includes('singleDelete')" size="small" type="danger" @click="del()">
|
|
270
|
+
<wd-button v-if="props.item.buttons.includes('singleDelete') && isShowAction(props.buttonDeleteAction)" size="small" type="danger" @click="del()">
|
|
268
271
|
删除
|
|
269
272
|
</wd-button>
|
|
270
273
|
<ActionPopup
|
|
@@ -57,6 +57,8 @@ const config = ref<Config>({
|
|
|
57
57
|
readOnly: false,
|
|
58
58
|
displayConfig: [],
|
|
59
59
|
showType: 'table',
|
|
60
|
+
buttonDeleteAction: {},
|
|
61
|
+
buttonEditAction: {},
|
|
60
62
|
})
|
|
61
63
|
const { getEnums, enumColumn } = useEnums({ config })
|
|
62
64
|
const sourceId = ref('')
|
|
@@ -66,7 +68,7 @@ const searchData = ref('')
|
|
|
66
68
|
const tabSearchData = ref('')
|
|
67
69
|
const pageType = ref('')
|
|
68
70
|
const mainCode = ref('')
|
|
69
|
-
const addEvent = generateHighResolutionID()// 全局事件名称
|
|
71
|
+
const addEvent = generateHighResolutionID() // 全局事件名称
|
|
70
72
|
onLoad((option: any) => {
|
|
71
73
|
console.log(option)
|
|
72
74
|
sourceId.value = option.sourceId
|
|
@@ -98,8 +100,7 @@ async function getPageConfig() {
|
|
|
98
100
|
console.log('config', config.value)
|
|
99
101
|
getEnums()
|
|
100
102
|
}
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
+
} catch (error) {
|
|
103
104
|
console.log(error)
|
|
104
105
|
}
|
|
105
106
|
}
|
|
@@ -130,14 +131,13 @@ async function queryList(pageNo: number, pageSize: number) {
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
try {
|
|
133
|
-
const res = await pageKey(sourceId.value, mainCode.value, qre)// 获取key
|
|
134
|
-
const data = await listData(res.key, pageNo, pageSize)// 获取数据
|
|
134
|
+
const res = await pageKey(sourceId.value, mainCode.value, qre) // 获取key
|
|
135
|
+
const data = await listData(res.key, pageNo, pageSize) // 获取数据
|
|
135
136
|
// const count = await getPageTotal(key.data?.key)// 获取总数
|
|
136
137
|
Zpaging.value.complete(data.entities)
|
|
137
138
|
|
|
138
139
|
// emits('loadData', data.data.entities)
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
140
|
+
} catch (error) {
|
|
141
141
|
if (Zpaging.value) {
|
|
142
142
|
Zpaging.value.complete(false)
|
|
143
143
|
}
|
|
@@ -160,8 +160,7 @@ function submitSearch(data: any) {
|
|
|
160
160
|
function tabSearchClick(data: any) {
|
|
161
161
|
if (searchData.value) {
|
|
162
162
|
tabSearchData.value = `${searchData.value}&${data}`
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
163
|
+
} else {
|
|
165
164
|
tabSearchData.value = data
|
|
166
165
|
}
|
|
167
166
|
|
|
@@ -171,20 +170,30 @@ function tabSearchClick(data: any) {
|
|
|
171
170
|
|
|
172
171
|
<template>
|
|
173
172
|
<z-paging
|
|
174
|
-
ref="Zpaging"
|
|
173
|
+
ref="Zpaging"
|
|
174
|
+
v-model="datas"
|
|
175
|
+
:default-page-size="5"
|
|
176
|
+
:show-loading-more-when-reload="true"
|
|
175
177
|
@query="queryList"
|
|
176
178
|
>
|
|
177
179
|
<template #top>
|
|
178
180
|
<slot name="top" />
|
|
179
181
|
<Search
|
|
180
|
-
:main-code="mainCode"
|
|
181
|
-
:
|
|
182
|
+
:main-code="mainCode"
|
|
183
|
+
:enum-column="enumColumn"
|
|
184
|
+
:criteria="config.criteria"
|
|
185
|
+
:primary-criterion="config.primaryCriterion"
|
|
186
|
+
:split2-tab-criterias="config.split2TabCriterias"
|
|
182
187
|
@submit="submitSearch"
|
|
183
188
|
/>
|
|
184
189
|
<view>
|
|
185
190
|
<ListTopButtons
|
|
186
|
-
:add-event="addEvent"
|
|
187
|
-
:
|
|
191
|
+
:add-event="addEvent"
|
|
192
|
+
:main-code="mainCode"
|
|
193
|
+
:buttons="config.buttons"
|
|
194
|
+
:source-id="sourceId"
|
|
195
|
+
:page-title="pageTitle"
|
|
196
|
+
:page-type="pageType"
|
|
188
197
|
:config="config"
|
|
189
198
|
/>
|
|
190
199
|
</view>
|
|
@@ -195,34 +204,76 @@ function tabSearchClick(data: any) {
|
|
|
195
204
|
</template>
|
|
196
205
|
<view v-if="config.showType === 'cardList'">
|
|
197
206
|
<productCard
|
|
198
|
-
v-for="(item, index) in datas"
|
|
199
|
-
:
|
|
200
|
-
:
|
|
201
|
-
|
|
207
|
+
v-for="(item, index) in datas"
|
|
208
|
+
:key="item.code"
|
|
209
|
+
:index="index"
|
|
210
|
+
:enum-column="enumColumn"
|
|
211
|
+
:collapse-num="5"
|
|
212
|
+
:source-id="sourceId"
|
|
213
|
+
:groups="config"
|
|
214
|
+
:data="item"
|
|
215
|
+
:columns="config.columns"
|
|
216
|
+
:primary-column="config.primaryColumn"
|
|
217
|
+
:second-column="config.secondColumn"
|
|
218
|
+
:label-column="config.labelColumn"
|
|
219
|
+
model="complex"
|
|
220
|
+
:card-show-cols="config.cardShowCols"
|
|
221
|
+
:main-picture="config.mainPicture"
|
|
202
222
|
>
|
|
203
223
|
<template #buttons>
|
|
204
224
|
<slot name="cardBotomButtons" :data="item" />
|
|
205
225
|
<CardBotomButtons
|
|
206
|
-
:primary-column="config.primaryColumn"
|
|
207
|
-
:
|
|
208
|
-
:
|
|
226
|
+
:primary-column="config.primaryColumn"
|
|
227
|
+
:add-event="addEvent"
|
|
228
|
+
:detail-button-handle="detailButtonHandle"
|
|
229
|
+
:zpaging="Zpaging"
|
|
230
|
+
:enum-column="enumColumn"
|
|
231
|
+
:actions="config.actions"
|
|
232
|
+
:row-actions="config.rowActions"
|
|
233
|
+
:ractions="config.ractions"
|
|
234
|
+
:source-id="sourceId"
|
|
235
|
+
:item="config"
|
|
236
|
+
:code="item.code"
|
|
237
|
+
:page-type="pageType"
|
|
238
|
+
:data="item"
|
|
209
239
|
/>
|
|
210
240
|
</template>
|
|
211
241
|
</productCard>
|
|
212
242
|
</view>
|
|
213
243
|
<view v-else>
|
|
214
244
|
<foldCard
|
|
215
|
-
v-for="(item, index) in datas"
|
|
216
|
-
:
|
|
217
|
-
:
|
|
245
|
+
v-for="(item, index) in datas"
|
|
246
|
+
:key="item.code"
|
|
247
|
+
:index="index"
|
|
248
|
+
:enum-column="enumColumn"
|
|
249
|
+
:collapse-num="5"
|
|
250
|
+
:source-id="sourceId"
|
|
251
|
+
:groups="config"
|
|
252
|
+
:data="item"
|
|
253
|
+
:columns="config.columns"
|
|
254
|
+
:primary-column="config.primaryColumn"
|
|
255
|
+
:second-column="config.secondColumn"
|
|
256
|
+
:label-column="config.labelColumn"
|
|
218
257
|
model="complex"
|
|
219
258
|
>
|
|
220
259
|
<template #buttons>
|
|
221
260
|
<slot name="cardBotomButtons" :data="item" />
|
|
222
261
|
<CardBotomButtons
|
|
223
|
-
:primary-column="config.primaryColumn"
|
|
224
|
-
:
|
|
225
|
-
:
|
|
262
|
+
:primary-column="config.primaryColumn"
|
|
263
|
+
:add-event="addEvent"
|
|
264
|
+
:detail-button-handle="detailButtonHandle"
|
|
265
|
+
:zpaging="Zpaging"
|
|
266
|
+
:enum-column="enumColumn"
|
|
267
|
+
:actions="config.actions"
|
|
268
|
+
:row-actions="config.rowActions"
|
|
269
|
+
:ractions="config.ractions"
|
|
270
|
+
:source-id="sourceId"
|
|
271
|
+
:item="config"
|
|
272
|
+
:code="item.code"
|
|
273
|
+
:page-type="pageType"
|
|
274
|
+
:data="item"
|
|
275
|
+
:button-delete-action="config.buttonDeleteAction"
|
|
276
|
+
:button-edit-action="config.buttonEditAction"
|
|
226
277
|
/>
|
|
227
278
|
</template>
|
|
228
279
|
</foldCard>
|