wui-components-v2 1.0.52 → 1.0.54
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 +13 -0
- package/components/action-popup/action-popup.vue +68 -0
- package/components/card-botom-buttons/card-botom-buttons.vue +43 -1
- package/components/form-control/form-control.vue +1 -2
- package/components/list/list.vue +4 -4
- package/components/login/login.vue +4 -4
- package/package.json +1 -1
- package/type.ts +11 -0
package/api/page.ts
CHANGED
|
@@ -83,3 +83,16 @@ export function detailPageData(sourceId: string, code: string) {
|
|
|
83
83
|
url: `/v3/view-dtmpl/data?sourceId=${sourceId}&code=${code}`,
|
|
84
84
|
})
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
// action 按钮提交数据
|
|
88
|
+
export function actionDataSave(sourceId: string, codes: string = '', data: any) {
|
|
89
|
+
return req({
|
|
90
|
+
url: `/v3/action`,
|
|
91
|
+
method: 'POST',
|
|
92
|
+
data: {
|
|
93
|
+
sourceId,
|
|
94
|
+
codes,
|
|
95
|
+
...data,
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, defineEmits, defineOptions, defineProps, ref } from 'vue'
|
|
3
|
+
import type { Groups } from '../../type'
|
|
4
|
+
import formControl from '../form-control/form-control.vue'
|
|
5
|
+
import { actionDataSave } from '../../api/page'
|
|
6
|
+
import { useGlobalToast } from '../../composables/useGlobalToast'
|
|
7
|
+
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: 'ActionPopup',
|
|
10
|
+
})
|
|
11
|
+
const props = defineProps<
|
|
12
|
+
{
|
|
13
|
+
fieldGroup?: Groups
|
|
14
|
+
show: boolean
|
|
15
|
+
code: string
|
|
16
|
+
zpaging: any
|
|
17
|
+
}
|
|
18
|
+
>()
|
|
19
|
+
const emits = defineEmits(['update:show'])
|
|
20
|
+
const btnLoading = ref(false)
|
|
21
|
+
const toast = useGlobalToast()
|
|
22
|
+
const formControlRef = ref()
|
|
23
|
+
// 显示开关
|
|
24
|
+
const show = computed({
|
|
25
|
+
get() {
|
|
26
|
+
return props.show
|
|
27
|
+
},
|
|
28
|
+
set(value: boolean) {
|
|
29
|
+
emits('update:show', value)
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
// 提交数据
|
|
34
|
+
async function action() {
|
|
35
|
+
console.log('提交action')
|
|
36
|
+
btnLoading.value = true
|
|
37
|
+
if (!props.fieldGroup?.id) {
|
|
38
|
+
return toast.warning({ msg: '无sourceId' })
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const data = await formControlRef.value.submit()
|
|
42
|
+
await actionDataSave(props.fieldGroup?.id || '', props.code, data)
|
|
43
|
+
btnLoading.value = false
|
|
44
|
+
show.value = false
|
|
45
|
+
props.zpaging.reload()
|
|
46
|
+
toast.success({ msg: '操作成功!' })
|
|
47
|
+
}
|
|
48
|
+
catch (error: any) {
|
|
49
|
+
console.log(error, 'error')
|
|
50
|
+
btnLoading.value = false
|
|
51
|
+
toast.error(error)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<wd-popup v-model="show" position="bottom" closable :z-index="999999" @close="() => { show = false }">
|
|
58
|
+
<view class="h-90vh w-100vw">
|
|
59
|
+
<view class="h-44px" />
|
|
60
|
+
<formControl v-if="props.fieldGroup" ref="formControlRef" :field-group="props.fieldGroup" />
|
|
61
|
+
<view class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2 .dark:bg-gray-900 .light:bg-white">
|
|
62
|
+
<wd-button :loading="btnLoading" class="flex-1" @click="() => { action() }">
|
|
63
|
+
提交
|
|
64
|
+
</wd-button>
|
|
65
|
+
</view>
|
|
66
|
+
</view>
|
|
67
|
+
</wd-popup>
|
|
68
|
+
</template>
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { defineOptions, defineProps, ref } from 'vue'
|
|
3
3
|
import { useRouter } from 'uni-mini-router'
|
|
4
4
|
import { onLoad } from '@dcloudio/uni-app'
|
|
5
|
-
import type { ClassEditConfigs, Entities, Groups } from '../../type'
|
|
5
|
+
import type { ClassEditConfigs, Entities, Fields, Groups, rowActions } from '../../type'
|
|
6
|
+
import ActionPopup from '../action-popup/action-popup.vue'
|
|
6
7
|
|
|
7
8
|
defineOptions({
|
|
8
9
|
name: 'CardBotomButtons',
|
|
@@ -13,12 +14,20 @@ const props = defineProps<{
|
|
|
13
14
|
code: string
|
|
14
15
|
pageType?: string
|
|
15
16
|
data: Entities
|
|
17
|
+
rowActions?: rowActions[]
|
|
18
|
+
zpaging: any
|
|
16
19
|
}>()
|
|
17
20
|
const pageType = ref('')
|
|
18
21
|
onLoad((option: any) => {
|
|
19
22
|
pageType.value = option.type || ''
|
|
20
23
|
})
|
|
21
24
|
const router = useRouter()
|
|
25
|
+
|
|
26
|
+
// anction按钮
|
|
27
|
+
const anctions = computed(() => {
|
|
28
|
+
return props.rowActions?.filter(isShowAction) || []
|
|
29
|
+
})
|
|
30
|
+
|
|
22
31
|
// 跳转编辑页面
|
|
23
32
|
function edit() {
|
|
24
33
|
if (props.item.classEditConfigs && props.item.classEditConfigs.length > 0) {
|
|
@@ -31,19 +40,52 @@ function edit() {
|
|
|
31
40
|
router.push(`/pages/edit-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}&pageType=${props.pageType}`)
|
|
32
41
|
}
|
|
33
42
|
}
|
|
43
|
+
|
|
44
|
+
const actionItem = ref<Groups>()
|
|
45
|
+
const actionItemShow = ref(false)
|
|
46
|
+
// 跳转action页面
|
|
47
|
+
function action(subitem: rowActions) {
|
|
48
|
+
console.log(subitem)
|
|
49
|
+
actionItem.value = {
|
|
50
|
+
...props.item,
|
|
51
|
+
fields: subitem.writes,
|
|
52
|
+
id: subitem.id,
|
|
53
|
+
}
|
|
54
|
+
actionItemShow.value = true
|
|
55
|
+
// router.push(`/pages/edit-page/index?sourceId=${subitem.id}&id=${props.code}&title=${subitem.title}&pageType=`)
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
// 跳转详情页面
|
|
35
59
|
function detail() {
|
|
36
60
|
router.push(`/pages/details-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}`)
|
|
37
61
|
}
|
|
62
|
+
|
|
63
|
+
// 判断action 按钮是否显示
|
|
64
|
+
function isShowAction(item: rowActions) {
|
|
65
|
+
if (item.preposes.length > 0) {
|
|
66
|
+
return item.preposes.every((prepose: Fields) => {
|
|
67
|
+
// 判断字段值是否相等
|
|
68
|
+
return prepose.transDefaultValue.includes(props.data.fieldMap[prepose.sourceId])
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
return false
|
|
72
|
+
}
|
|
38
73
|
</script>
|
|
39
74
|
|
|
40
75
|
<template>
|
|
41
76
|
<view class="flex items-center gap-1">
|
|
77
|
+
<view v-if="props.rowActions" class="flex gap-1">
|
|
78
|
+
<wd-button v-for="subitem in anctions" :key="subitem.id" plain size="small" @click="action(subitem)">
|
|
79
|
+
{{ subitem.title }}
|
|
80
|
+
</wd-button>
|
|
81
|
+
</view>
|
|
82
|
+
|
|
42
83
|
<wd-button v-if="props.item.buttons.includes('dtmplEdit')" size="small" @click="edit()">
|
|
43
84
|
编辑
|
|
44
85
|
</wd-button>
|
|
45
86
|
<wd-button v-if="props.item.buttons.includes('detail')" size="small" type="info" @click="detail()">
|
|
46
87
|
详情
|
|
47
88
|
</wd-button>
|
|
89
|
+
<ActionPopup v-model:show="actionItemShow" :zpaging="props.zpaging" :field-group="actionItem" :code="props.code" />
|
|
48
90
|
</view>
|
|
49
91
|
</template>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, defineExpose, defineOptions, defineProps, onBeforeMount, ref, toRaw } from 'vue'
|
|
3
3
|
import type { FormRules } from 'wot-design-uni/components/wd-form/types'
|
|
4
4
|
import dayjs from 'dayjs/esm/index'
|
|
5
5
|
import type { Enums, Fields, Groups } from '../../type'
|
|
6
6
|
import mulselectPicker from '../mulselect-picker/mulselect-picker.vue'
|
|
7
|
-
import TreeSelectControl from '../tree-select/index.vue'
|
|
8
7
|
// import SelectColPicker from '../select-col-picker/select-col-picker.vue'
|
|
9
8
|
// import { enums } from '../../api/page'
|
|
10
9
|
defineOptions({
|
package/components/list/list.vue
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {
|
|
2
|
+
import { defineOptions, ref } from 'vue'
|
|
3
3
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
|
4
|
-
import { useRouter } from 'uni-mini-router'
|
|
5
|
-
import { useManualTheme } from '../../composables/useManualTheme'
|
|
6
4
|
import { enums, listData, pageConfig, pageKey } from '../../api/page'
|
|
7
5
|
import foldCard from '../fold-card/fold-card.vue'
|
|
8
6
|
import type { Config, Entities, Enums } from '../../type'
|
|
@@ -47,6 +45,8 @@ const config = ref<Config>({
|
|
|
47
45
|
pointSourceId: '',
|
|
48
46
|
mstrucId: '',
|
|
49
47
|
relationNames: [],
|
|
48
|
+
readOnly: false,
|
|
49
|
+
displayConfig: [],
|
|
50
50
|
})
|
|
51
51
|
const sourceId = ref('')
|
|
52
52
|
const datas = ref<Entities[]>([])
|
|
@@ -156,7 +156,7 @@ function submitSearch(data: any) {
|
|
|
156
156
|
<foldCard v-for="item in datas" :key="item.code" :enum-column="enumColumn" :collapse-num="5" :source-id="sourceId" :groups="config" :data="item" :columns="config.columns" :primary-column="config.primaryColumn" :second-column="config.secondColumn" :label-column="config.labelColumn" model="complex">
|
|
157
157
|
<template #buttons>
|
|
158
158
|
<slot name="cardBotomButtons" :data="item" />
|
|
159
|
-
<CardBotomButtons :source-id="sourceId" :item="config" :code="item.code" :page-type="pageType" :data="item" />
|
|
159
|
+
<CardBotomButtons :zpaging="Zpaging" :row-actions="config.rowActions" :source-id="sourceId" :item="config" :code="item.code" :page-type="pageType" :data="item" />
|
|
160
160
|
</template>
|
|
161
161
|
</foldCard>
|
|
162
162
|
<template #bottom>
|
|
@@ -11,7 +11,7 @@ defineProps<{
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<template>
|
|
14
|
-
<view class="h-[calc(100vh-44px)] flex flex-col bg-
|
|
14
|
+
<view class="h-[calc(100vh-44px)] flex flex-col bg-#4E7FFF .dark:bg-[--wot-dark-background9]">
|
|
15
15
|
<!-- <view class="flex flex-col items-center justify-center pa-3 pb-5">
|
|
16
16
|
<wd-img :width="100" :height="100" round :src="loginlog" />
|
|
17
17
|
<view class="text-center">
|
|
@@ -20,10 +20,10 @@ defineProps<{
|
|
|
20
20
|
</text>
|
|
21
21
|
</view>
|
|
22
22
|
</view> -->
|
|
23
|
-
<view class="flex items-center justify-center
|
|
24
|
-
<image class="h-
|
|
23
|
+
<view class="flex items-center justify-center">
|
|
24
|
+
<image class="h-250px w-250px" src="./footerImg.png" />
|
|
25
25
|
</view>
|
|
26
|
-
<view class="flex-1 border-rd-2 p-y-2">
|
|
26
|
+
<view class="flex-1 border-rd-t-2 p-y-2 .dark:bg-[--wot-dark-background2] .light:bg-white">
|
|
27
27
|
<LoginForm />
|
|
28
28
|
</view>
|
|
29
29
|
</view>
|
package/package.json
CHANGED
package/type.ts
CHANGED
|
@@ -5,6 +5,16 @@ export interface Columns {
|
|
|
5
5
|
sourceId: string
|
|
6
6
|
mstrucId: string
|
|
7
7
|
title?: string
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// 动作按钮配置
|
|
12
|
+
export interface rowActions {
|
|
13
|
+
id: string
|
|
14
|
+
beforeExeConfirm: string
|
|
15
|
+
title: string
|
|
16
|
+
writes: Fields[]
|
|
17
|
+
preposes: Fields[]
|
|
8
18
|
}
|
|
9
19
|
|
|
10
20
|
// 列表页面配置
|
|
@@ -15,6 +25,7 @@ export interface Config extends Groups {
|
|
|
15
25
|
secondColumn: Columns
|
|
16
26
|
criterias: Fields[]
|
|
17
27
|
labelColumn?: Columns
|
|
28
|
+
rowActions?: rowActions[]
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
// 列表数据
|