wui-components-v2 1.0.25 → 1.0.26

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 CHANGED
@@ -17,7 +17,7 @@ export function pageConfig(sourceId: string): Promise<PageConfig> {
17
17
  // 获取列表页面数据key
18
18
  export function pageKey(sourceId: string, mainCode: string = '', query: string = '') {
19
19
  return req({
20
- url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${sourceId}${query}`,
20
+ url: `/v3/ltmpl/query/key?sourceId=${sourceId}&mainCode=${mainCode}&menuId=${sourceId}&${query}`,
21
21
  })
22
22
  }
23
23
 
@@ -28,6 +28,12 @@ export function listData(queryKey: string, pageNo: number, pageSize: number): Pr
28
28
  })
29
29
  }
30
30
 
31
+ // 获取新增面配置
32
+ export function addPageConfig(sourceId: string) {
33
+ return req({
34
+ url: `/v3/add-dtmpl/config?sourceId=${sourceId}`,
35
+ })
36
+ }
31
37
  // 获取编辑页面配置
32
38
  export function editPageConfig(sourceId: string, mianCode: string) {
33
39
  return req({
@@ -49,3 +55,31 @@ export function editPageDataSave(sourceId: string, id: string = '', data: any, m
49
55
  },
50
56
  })
51
57
  }
58
+ // 获取枚举
59
+ export function enums(mstrucIds: string) {
60
+ return req({
61
+ url: `/v3/enum`,
62
+ method: 'POST',
63
+ data: mstrucIds,
64
+ })
65
+ }
66
+ // 获取勾选数据
67
+ export function selectDatas(sourceId: string, codes: string) {
68
+ return req({
69
+ url: `/v3/field-group/data/selected?sourceId=${sourceId}&${codes}`,
70
+ })
71
+ }
72
+
73
+ // 详情页面详细配置
74
+ export function detailPageConfig(sourceId: string) {
75
+ return req({
76
+ url: `/v3/view-dtmpl/config?sourceId=${sourceId}`,
77
+ })
78
+ }
79
+
80
+ // 详情页面数据
81
+ export function detailPageData(sourceId: string, code: string) {
82
+ return req({
83
+ url: `/v3/view-dtmpl/data?sourceId=${sourceId}&code=${code}`,
84
+ })
85
+ }
package/api/tree.ts ADDED
@@ -0,0 +1,20 @@
1
+ import req from './core/index'
2
+ // 树列表页面详细配置
3
+ export function treeConfigApi(sourceId: string) {
4
+ return req({
5
+ url: `/v3/ttmpl/config?sourceId=${sourceId}`,
6
+ })
7
+ }
8
+
9
+ // 树数据
10
+ export function treeDataApi(sourceId: string) {
11
+ return req({
12
+ url: `/v3/ttmpl/root-data?sourceId=${sourceId}`,
13
+ })
14
+ }
15
+ // 树节点数据
16
+ export function treeNodeDataApi(sourceId: string, mainCode?: string) {
17
+ return req({
18
+ url: `/v3/ltmpl/top-data?sourceId=${sourceId}&mainCode=${mainCode}`,
19
+ })
20
+ }
@@ -0,0 +1,49 @@
1
+ <script setup lang="ts">
2
+ import { defineOptions, defineProps } from 'vue'
3
+ import { useRouter } from 'uni-mini-router'
4
+ import { onLoad } from '@dcloudio/uni-app'
5
+ import type { ClassEditConfigs, Entities, Groups } from '../../type'
6
+
7
+ defineOptions({
8
+ name: 'CardBotomButtons',
9
+ })
10
+ const props = defineProps<{
11
+ item: Groups
12
+ sourceId: string
13
+ code: string
14
+ pageType?: string
15
+ data: Entities
16
+ }>()
17
+ const pageType = ref('')
18
+ onLoad((option: any) => {
19
+ pageType.value = option.type || ''
20
+ })
21
+ const router = useRouter()
22
+ // 跳转编辑页面
23
+ function edit() {
24
+ if (props.item.classEditConfigs && props.item.classEditConfigs.length > 0) {
25
+ const sourceData = props.item.classEditConfigs.find((item: ClassEditConfigs) => {
26
+ return item.preposes[0].transDefaultValue.includes(props.data.fieldMap[item.preposes[0].sourceId])
27
+ })
28
+ router.push(`/pages/edit-page/index?sourceId=${sourceData?.id || props.sourceId}&id=${props.code}&title=${props.item.title}&pageType=${props.pageType}`)
29
+ }
30
+ else {
31
+ router.push(`/pages/edit-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}&pageType=${props.pageType}`)
32
+ }
33
+ }
34
+ // 跳转详情页面
35
+ function detail() {
36
+ router.push(`/pages/details-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}`)
37
+ }
38
+ </script>
39
+
40
+ <template>
41
+ <view class="flex items-center gap-1">
42
+ <wd-button v-if="props.item.buttons.includes('dtmplEdit')" size="small" @click="edit()">
43
+ 编辑
44
+ </wd-button>
45
+ <wd-button v-if="props.item.buttons.includes('detail')" size="small" type="info" @click="detail()">
46
+ 详情
47
+ </wd-button>
48
+ </view>
49
+ </template>
@@ -0,0 +1,109 @@
1
+ <script setup lang="ts">
2
+ import { defineOptions, ref } from 'vue'
3
+ import { onLoad } from '@dcloudio/uni-app'
4
+ import { detailPageConfig, detailPageData } from '../../api/page'
5
+ import type { Entities, Enums, Groups, dtmplConfig } from '../../type'
6
+ import CardBotomButtons from '../card-botom-buttons/card-botom-buttons.vue'
7
+ import foldCard from '../fold-card/fold-card.vue'
8
+ import LabelValue from '../label-value/label-value.vue'
9
+
10
+ defineOptions({
11
+ name: 'DetailsPage',
12
+ })
13
+ const sourceId = ref('')
14
+ const id = ref('')
15
+ const title = ref('')
16
+ const pageConfig = ref<dtmplConfig> ({
17
+ id: '',
18
+ title: '',
19
+ groups: [],
20
+ entity: {} as any,
21
+ buttons: [],
22
+ })
23
+ const data = ref<Entities>({
24
+ code: '',
25
+ fieldMap: {},
26
+ arrayMap: {},
27
+ })
28
+ const groups = ref<Groups>({
29
+ id: '',
30
+ buttons: ['detail'],
31
+ fields: [],
32
+ title: '',
33
+ type: '',
34
+ pointSourceId: '',
35
+ mstrucId: '',
36
+ relationNames: [],
37
+ })
38
+ const loading = ref(false)
39
+ // 折叠面板
40
+ const collapses = ref()
41
+ onLoad((option: any) => {
42
+ sourceId.value = option.sourceId
43
+ id.value = option.id
44
+ title.value = option.title
45
+ uni.setNavigationBarTitle({
46
+ title: `${option.title}`,
47
+ })
48
+ getPageConfig()
49
+ })
50
+
51
+ // 获取页面配置
52
+ async function getPageConfig() {
53
+ try {
54
+ loading.value = true
55
+ const res = await detailPageConfig(sourceId.value)
56
+ // 初始化折叠面板
57
+ if (res.dtmplConfig) {
58
+ pageConfig.value = res.dtmplConfig
59
+ collapses.value = pageConfig.value.groups.map((item: Groups) => {
60
+ return item.id
61
+ })
62
+ getDetailData()
63
+ }
64
+ }
65
+ catch (error) {
66
+ console.log(error)
67
+ loading.value = false
68
+ }
69
+ }
70
+
71
+ // 获取详情数据
72
+ async function getDetailData() {
73
+ try {
74
+ const res = await detailPageData(sourceId.value, id.value)
75
+ data.value = res.entity
76
+ loading.value = false
77
+ }
78
+ catch (error) {
79
+ loading.value = false
80
+ console.log(error)
81
+ }
82
+ }
83
+ </script>
84
+
85
+ <template>
86
+ <view>
87
+ <view v-if="loading" class="flex justify-center p-3">
88
+ <wd-loading />
89
+ </view>
90
+ <view v-else>
91
+ <wd-collapse v-model="collapses">
92
+ <wd-collapse-item v-for="group in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
93
+ <view v-if="group.type === 'fieldGroup'">
94
+ <LabelValue :exhibit-data="group.fields" :data="data" />
95
+ </view>
96
+ <view v-if="group.type === 'relation'">
97
+ <view v-for="field in data.arrayMap[group.id]" :key="field.code">
98
+ <foldCard :groups="group" :source-id="sourceId" :columns="group.fields" model="complex" :data="field">
99
+ <template #buttons>
100
+ <CardBotomButtons :source-id="group.id" :item="groups" :code="field.code" :data="data" />
101
+ </template>
102
+ </foldCard>
103
+ </view>
104
+ </view>
105
+ </wd-collapse-item>
106
+ </wd-collapse>
107
+ </view>
108
+ </view>
109
+ </template>