wui-components-v2 1.1.69 → 1.1.71

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.
Files changed (117) hide show
  1. package/api/core/index.ts +74 -74
  2. package/api/feishu.ts +20 -20
  3. package/api/index.ts +4 -4
  4. package/api/login.ts +51 -51
  5. package/api/menu.ts +45 -45
  6. package/api/page.ts +114 -114
  7. package/api/sys.ts +12 -12
  8. package/api/tree.ts +28 -28
  9. package/components/action-popup/action-popup.vue +116 -116
  10. package/components/add-address-list/add-address-list.vue +187 -187
  11. package/components/add-address-page/add-address-page.vue +77 -77
  12. package/components/add-address-page/config.ts +297 -297
  13. package/components/audio-play/audio-play.vue +220 -220
  14. package/components/batch-upload-file/batch-upload-file.vue +75 -75
  15. package/components/card-botom-buttons/card-botom-buttons.vue +279 -279
  16. package/components/custom-date-picker/custom-date-picker.vue +106 -106
  17. package/components/custom-select-picker/custom-select-picker.vue +95 -95
  18. package/components/demo-block/demo-block.vue +63 -63
  19. package/components/demo-card/demo-card.vue +44 -44
  20. package/components/detail-popup/detail-popup.vue +99 -99
  21. package/components/evaluation-page/evaluation-page.vue +196 -196
  22. package/components/fold-card/fold-card.vue +171 -171
  23. package/components/form-control/form-control.vue +661 -661
  24. package/components/global-loading/GlobalLoading.md +366 -366
  25. package/components/global-loading/global-loading.vue +55 -55
  26. package/components/global-message/GlobalMessage.md +570 -570
  27. package/components/global-message/global-message.vue +68 -68
  28. package/components/global-toast/GlobalToast.md +261 -261
  29. package/components/global-toast/global-toast.vue +56 -56
  30. package/components/label-value/label-value.vue +144 -144
  31. package/components/label-value/open-value-more.vue +56 -56
  32. package/components/list-top-buttons/list-top-buttons.vue +19 -19
  33. package/components/loading/loading.vue +5 -5
  34. package/components/login-form/login-form.vue +126 -126
  35. package/components/login-form-box/login-form-box.vue +65 -65
  36. package/components/mulselect-picker/mulselect-picker.vue +86 -86
  37. package/components/phone-login-form/phone-login-form.vue +204 -204
  38. package/components/privacy-popup/privacy-popup.vue +191 -191
  39. package/components/product-card/product-card.vue +201 -201
  40. package/components/scan-input/scan-input.vue +406 -406
  41. package/components/search/search.vue +128 -128
  42. package/components/select-col-picker/select-col-picker.vue +168 -168
  43. package/components/tab-search/tab-search.vue +73 -73
  44. package/components/tree-select/components/TreeNode.vue +200 -200
  45. package/components/tree-select/components/index.vue +471 -471
  46. package/components/tree-select/components/tree-select.vue +56 -56
  47. package/components/tree-select/index.vue +93 -93
  48. package/components/user-choose/user-choose.vue +169 -151
  49. package/components/video-play/video-play.vue +56 -56
  50. package/components/wui-auto-update-component/wui-auto-update-component.vue +132 -132
  51. package/components/wui-default/wui-default.vue +49 -49
  52. package/components/wui-details-page/wui-details-page.vue +147 -147
  53. package/components/wui-edit-page/wui-edit-page-copy.vue +757 -757
  54. package/components/wui-edit-page/wui-edit-page.vue +793 -793
  55. package/components/wui-enume-select-control/wui-enume-select-control.vue +92 -92
  56. package/components/wui-list/wui-list.vue +235 -235
  57. package/components/wui-login/wui-login.vue +43 -43
  58. package/components/wui-login1/wui-login.vue +41 -41
  59. package/components/wui-menus/wui-menus-top.vue +137 -137
  60. package/components/wui-menus/wui-menus-top1.vue +8 -8
  61. package/components/wui-menus/wui-menus.vue +247 -247
  62. package/components/wui-menus1/components/banner-carousel.vue +320 -320
  63. package/components/wui-menus1/components/navbar.vue +43 -43
  64. package/components/wui-menus1/components/quick-panel.vue +55 -55
  65. package/components/wui-menus1/components/search-bar.vue +49 -49
  66. package/components/wui-menus1/components/section-menus.vue +208 -208
  67. package/components/wui-menus1/wui-menus-top.vue +718 -718
  68. package/components/wui-menus1/wui-menus-top1.vue +398 -398
  69. package/components/wui-menus1/wui-menus.vue +564 -564
  70. package/components/wui-notify-info/notify-handle.vue +53 -53
  71. package/components/wui-notify-info/wui-notify-info.vue +280 -280
  72. package/components/wui-scan-binding-sensor/wui-scan-binding-sensor.vue +75 -75
  73. package/components/wui-search-history-babbar/components/SearchBar.vue +70 -70
  74. package/components/wui-search-history-babbar/wui-search-history-babbar.vue +204 -204
  75. package/components/wui-select-list/wui-select-list.vue +310 -310
  76. package/components/wui-select-popup/wui-select-popup.vue +613 -612
  77. package/components/wui-system-settings/wui-system-settings.vue +144 -144
  78. package/components/wui-tabbar/wui-tabbar.vue +106 -106
  79. package/components/wui-tree-page/components/tree-item.vue +238 -238
  80. package/components/wui-tree-page/wui-tree-page.vue +297 -297
  81. package/components/wui-update-component/wui-update-component.vue +221 -221
  82. package/components/wui-user/wui-user.vue +202 -202
  83. package/composables/types/theme.ts +65 -65
  84. package/composables/types/user.ts +5 -5
  85. package/composables/useColorGenerator.ts +221 -221
  86. package/composables/useCompanyFieldFilter.ts +91 -91
  87. package/composables/useEnumes.ts +43 -43
  88. package/composables/useEventBus.ts +37 -37
  89. package/composables/useGlobalLoading.ts +47 -47
  90. package/composables/useGlobalMessage.ts +53 -53
  91. package/composables/useGlobalToast.ts +63 -63
  92. package/composables/useLocale.ts +54 -54
  93. package/composables/useManualTheme.ts +179 -179
  94. package/composables/useMenus.ts +193 -193
  95. package/composables/useSectionMenus.ts +120 -120
  96. package/composables/useTabbar.ts +50 -50
  97. package/composables/useTheme.ts +74 -74
  98. package/composables/useUser.ts +24 -24
  99. package/index.d.ts +90 -90
  100. package/index.ts +83 -83
  101. package/package.json +24 -24
  102. package/static/iconfont/iconfont.css +63 -63
  103. package/store/language.ts +151 -151
  104. package/store/manualThemeStore.ts +143 -143
  105. package/store/persist.ts +41 -41
  106. package/store/themeStore.ts +74 -74
  107. package/store/userStore.ts +22 -22
  108. package/styles/dark-mode.css +523 -523
  109. package/styles/dark-mode.min.css +1 -1
  110. package/styles/dark-mode.scss +498 -498
  111. package/type.ts +154 -154
  112. package/utils/control-tree.ts +353 -353
  113. package/utils/control-type-supportor.ts +148 -148
  114. package/utils/eventBus.ts +36 -36
  115. package/utils/idata-scan.ts +99 -99
  116. package/utils/index.ts +979 -979
  117. package/utils/rsaEncrypt.ts +10 -10
@@ -1,92 +1,92 @@
1
- <script lang="ts" setup>
2
- import { computed, defineEmits, defineProps, onMounted, ref } from 'vue'
3
- import { useEnums } from '../../composables/useEnumes'
4
- import type { Config } from '../../type'
5
- import { pageConfig } from '../../api/page'
6
-
7
- defineOptions({
8
- name: 'WuiEnumeSelectControl',
9
- })
10
-
11
- const props = defineProps<{
12
- sourceId: string
13
- id: string
14
- label?: string
15
- title?: string
16
- modelValue: string
17
- placeholder?: string
18
- disabled?: boolean
19
- required?: boolean
20
- rules?: any
21
- zIndex?: number
22
- type: 'checkbox' | 'radio'
23
- labelWidth?: string
24
- }>()
25
- const emits = defineEmits(['update:modelValue'])
26
-
27
- const config = ref<Config>()
28
- const { enumColumn, getEnums } = useEnums({ config })
29
- async function getPageConfig() {
30
- try {
31
- const res = await pageConfig(props.sourceId)
32
-
33
- if (res.ltmplConfig) {
34
- config.value = res.ltmplConfig
35
- getEnums()
36
- }
37
- } catch (error) {
38
- console.log(error)
39
- }
40
- }
41
-
42
- const comEnums = computed(() => {
43
- const mstrucId = config.value?.criterias?.find(item => item.sourceId === props.id)?.mstrucId
44
-
45
- if (mstrucId) {
46
- return enumColumn.value[mstrucId]?.map(item => {
47
- return {
48
- id: item.id,
49
- label: item.title,
50
- value: `${item.id}-R-${item.value}`,
51
- }
52
- })
53
- }
54
-
55
- return []
56
- })
57
-
58
- onMounted(() => {
59
- getPageConfig()
60
- })
61
-
62
- function confirm(event: any) {
63
- emits('update:modelValue', event.value)
64
- }
65
- </script>
66
-
67
- <script lang="ts">
68
- export default {
69
- options: {
70
- virtualHost: true,
71
- addGlobalClass: true,
72
- styleIsolation: 'shared',
73
- },
74
- }
75
- </script>
76
-
77
- <template>
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
- />
92
- </template>
1
+ <script lang="ts" setup>
2
+ import { computed, defineEmits, defineProps, onMounted, ref } from 'vue'
3
+ import { useEnums } from '../../composables/useEnumes'
4
+ import type { Config } from '../../type'
5
+ import { pageConfig } from '../../api/page'
6
+
7
+ defineOptions({
8
+ name: 'WuiEnumeSelectControl',
9
+ })
10
+
11
+ const props = defineProps<{
12
+ sourceId: string
13
+ id: string
14
+ label?: string
15
+ title?: string
16
+ modelValue: string
17
+ placeholder?: string
18
+ disabled?: boolean
19
+ required?: boolean
20
+ rules?: any
21
+ zIndex?: number
22
+ type: 'checkbox' | 'radio'
23
+ labelWidth?: string
24
+ }>()
25
+ const emits = defineEmits(['update:modelValue'])
26
+
27
+ const config = ref<Config>()
28
+ const { enumColumn, getEnums } = useEnums({ config })
29
+ async function getPageConfig() {
30
+ try {
31
+ const res = await pageConfig(props.sourceId)
32
+
33
+ if (res.ltmplConfig) {
34
+ config.value = res.ltmplConfig
35
+ getEnums()
36
+ }
37
+ } catch (error) {
38
+ console.log(error)
39
+ }
40
+ }
41
+
42
+ const comEnums = computed(() => {
43
+ const mstrucId = config.value?.criteria?.find(item => item.sourceId === props.id)?.mstrucId
44
+
45
+ if (mstrucId) {
46
+ return enumColumn.value[mstrucId]?.map(item => {
47
+ return {
48
+ id: item.id,
49
+ label: item.title,
50
+ value: `${item.id}-R-${item.value}`,
51
+ }
52
+ })
53
+ }
54
+
55
+ return []
56
+ })
57
+
58
+ onMounted(() => {
59
+ getPageConfig()
60
+ })
61
+
62
+ function confirm(event: any) {
63
+ emits('update:modelValue', event.value)
64
+ }
65
+ </script>
66
+
67
+ <script lang="ts">
68
+ export default {
69
+ options: {
70
+ virtualHost: true,
71
+ addGlobalClass: true,
72
+ styleIsolation: 'shared',
73
+ },
74
+ }
75
+ </script>
76
+
77
+ <template>
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
+ />
92
+ </template>
@@ -1,235 +1,235 @@
1
- <script lang="ts" setup>
2
- import { defineOptions, defineProps, onMounted, onUnmounted, ref } from 'vue'
3
- import { onLoad } from '@dcloudio/uni-app'
4
- import { listData, pageConfig, pageKey } from '../../api/page'
5
- import foldCard from '../fold-card/fold-card.vue'
6
- import type { Config, Entities } from '../../type'
7
- import Search from '../search/search.vue'
8
- import ListTopButtons from '../list-top-buttons/list-top-buttons.vue'
9
- import CardBotomButtons from '../card-botom-buttons/card-botom-buttons.vue'
10
- import { generateHighResolutionID } from '../../utils/index'
11
- import productCard from '../product-card/product-card.vue'
12
- import tabSearch from '../tab-search/tab-search.vue'
13
- import { useEnums } from '../../composables/useEnumes'
14
-
15
- defineOptions({
16
- name: 'WuiList',
17
- })
18
- defineProps<{
19
- detailButtonHandle?: (data: Entities) => void
20
- }>()
21
-
22
- const Zpaging = ref<any>(null)
23
- const config = ref<Config>({
24
- buttons: [],
25
- columns: [],
26
- primaryColumn: {
27
- sourceId: '',
28
- controlType: '',
29
- mstrucId: '',
30
- extControlType: '',
31
- },
32
- primaryCriteria: {
33
- hidden: false,
34
- disabled: false,
35
- defaultValue: '',
36
- transDefaultValue: '',
37
- required: false,
38
- controlType: '',
39
- sourceId: '',
40
- mstrucId: '',
41
- extControlType: '',
42
- },
43
- secondColumn: {
44
- sourceId: '',
45
- controlType: '',
46
- mstrucId: '',
47
- extControlType: '',
48
- },
49
- criterias: [],
50
- id: '',
51
- fields: [],
52
- title: '',
53
- type: '',
54
- pointSourceId: '',
55
- mstrucId: '',
56
- relationNames: [],
57
- readOnly: false,
58
- displayConfig: [],
59
- showType: 'table',
60
- })
61
- const { getEnums, enumColumn } = useEnums({ config })
62
- const sourceId = ref('')
63
- const datas = ref<Entities[]>([])
64
- const pageTitle = ref('')
65
- const searchData = ref('')
66
- const tabSearchData = ref('')
67
- const pageType = ref('')
68
- const mainCode = ref('')
69
- const addEvent = generateHighResolutionID()// 全局事件名称
70
- onLoad((option: any) => {
71
- console.log(option)
72
- sourceId.value = option.sourceId
73
- pageTitle.value = option.title
74
- pageType.value = option.pageType
75
- mainCode.value = option.mainCode || ''
76
- uni.setNavigationBarTitle({
77
- title: option.title,
78
- })
79
- getPageConfig()
80
- })
81
- onMounted(async () => {
82
- console.log('mounted')
83
- // 监听添加成功的事件
84
- uni.$on(addEvent, async () => {
85
- Zpaging.value.reload()
86
- })
87
- })
88
- // 在组件卸载时解绑全局事件
89
- onUnmounted(() => {
90
- console.log(`${pageTitle.value}页面卸载`)
91
- uni.$off(addEvent)
92
- })
93
- async function getPageConfig() {
94
- try {
95
- const res = await pageConfig(sourceId.value)
96
- if (res.ltmplConfig) {
97
- config.value = res.ltmplConfig
98
- console.log('config', config.value)
99
- getEnums()
100
- }
101
- }
102
- catch (error) {
103
- console.log(error)
104
- }
105
- }
106
-
107
- // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
108
- async function queryList(pageNo: number, pageSize: number) {
109
- // 此处请求仅为演示,请替换为自己项目中的请求
110
- // request.queryList({ pageNo,pageSize }).then(res => {
111
- // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
112
- // paging.value.complete(res.data.list);
113
- // }).catch(res => {
114
- // 如果请求失败写paging.value.complete(false);
115
- // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
116
- // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
117
- // paging.value.complete(false);
118
- // paging.value.reload() // 手动触发加载
119
- // })
120
- let qre = tabSearchData.value || searchData.value
121
- if (config.value.defaultCriteriaValue) {
122
- for (const key in config.value.defaultCriteriaValue) {
123
- if (Object.prototype.hasOwnProperty.call(config.value.defaultCriteriaValue, key)) {
124
- const element = config.value.defaultCriteriaValue[key]
125
- if (!qre.includes(key)) {
126
- qre = `${qre}&${key}=${element}`
127
- }
128
- }
129
- }
130
- }
131
-
132
- try {
133
- const res = await pageKey(sourceId.value, mainCode.value, qre)// 获取key
134
- const data = await listData(res.key, pageNo, pageSize)// 获取数据
135
- // const count = await getPageTotal(key.data?.key)// 获取总数
136
- Zpaging.value.complete(data.entities)
137
-
138
- // emits('loadData', data.data.entities)
139
- }
140
- catch (error) {
141
- if (Zpaging.value) {
142
- Zpaging.value.complete(false)
143
- }
144
- console.error(error)
145
- }
146
- }
147
-
148
- function submitSearch(data: any) {
149
- searchData.value = data
150
- // for (const key in data) {
151
- // if (Object.prototype.hasOwnProperty.call(data, key)) {
152
- // const element = data[key]
153
- // searchData.value = `${searchData.value}&c_${key}=${element}`
154
- // }
155
- // }
156
- Zpaging.value.reload()
157
- }
158
-
159
- // tabSearch点击事件
160
- function tabSearchClick(data: any) {
161
- if (searchData.value) {
162
- tabSearchData.value = `${searchData.value}&${data}`
163
- }
164
- else {
165
- tabSearchData.value = data
166
- }
167
-
168
- Zpaging.value.reload()
169
- }
170
- </script>
171
-
172
- <template>
173
- <z-paging
174
- ref="Zpaging" v-model="datas" :default-page-size="5" :show-loading-more-when-reload="true"
175
- @query="queryList"
176
- >
177
- <template #top>
178
- <slot name="top" />
179
- <Search
180
- :main-code="mainCode" :enum-column="enumColumn" :criterias="config.criterias"
181
- :primary-criteria="config.primaryCriteria" :split2-tab-criterias="config.split2TabCriterias"
182
- @submit="submitSearch"
183
- />
184
- <view>
185
- <ListTopButtons
186
- :add-event="addEvent" :main-code="mainCode" :buttons="config.buttons" :source-id="sourceId"
187
- :page-title="pageTitle" :page-type="pageType"
188
- :config="config"
189
- />
190
- </view>
191
- <!-- 自定义tab搜索 -->
192
- <view v-if="config.split2TabCriterias">
193
- <tabSearch :split2-tab-criterias="config.split2TabCriterias" :enums="enumColumn" @click="tabSearchClick" />
194
- </view>
195
- </template>
196
- <view v-if="config.showType === 'cardList'">
197
- <productCard
198
- v-for="(item, index) in datas" :key="item.code" :index="index" :enum-column="enumColumn"
199
- :collapse-num="5" :source-id="sourceId" :groups="config" :data="item" :columns="config.columns"
200
- :primary-column="config.primaryColumn" :second-column="config.secondColumn" :label-column="config.labelColumn"
201
- model="complex" :card-show-cols="config.cardShowCols" :main-picture="config.mainPicture"
202
- >
203
- <template #buttons>
204
- <slot name="cardBotomButtons" :data="item" />
205
- <CardBotomButtons
206
- :primary-column="config.primaryColumn" :add-event="addEvent" :detail-button-handle="detailButtonHandle" :zpaging="Zpaging"
207
- :enum-column="enumColumn" :actions="config.actions" :row-actions="config.rowActions" :ractions="config.ractions" :source-id="sourceId"
208
- :item="config" :code="item.code" :page-type="pageType" :data="item"
209
- />
210
- </template>
211
- </productCard>
212
- </view>
213
- <view v-else>
214
- <foldCard
215
- v-for="(item, index) in datas" :key="item.code" :index="index" :enum-column="enumColumn"
216
- :collapse-num="5" :source-id="sourceId" :groups="config" :data="item" :columns="config.columns"
217
- :primary-column="config.primaryColumn" :second-column="config.secondColumn" :label-column="config.labelColumn"
218
- model="complex"
219
- >
220
- <template #buttons>
221
- <slot name="cardBotomButtons" :data="item" />
222
- <CardBotomButtons
223
- :primary-column="config.primaryColumn" :add-event="addEvent" :detail-button-handle="detailButtonHandle" :zpaging="Zpaging"
224
- :enum-column="enumColumn" :actions="config.actions" :row-actions="config.rowActions" :ractions="config.ractions" :source-id="sourceId"
225
- :item="config" :code="item.code" :page-type="pageType" :data="item"
226
- />
227
- </template>
228
- </foldCard>
229
- </view>
230
-
231
- <template #bottom>
232
- <slot name="bottom" />
233
- </template>
234
- </z-paging>
235
- </template>
1
+ <script lang="ts" setup>
2
+ import { defineOptions, defineProps, onMounted, onUnmounted, ref } from 'vue'
3
+ import { onLoad } from '@dcloudio/uni-app'
4
+ import { listData, pageConfig, pageKey } from '../../api/page'
5
+ import foldCard from '../fold-card/fold-card.vue'
6
+ import type { Config, Entities } from '../../type'
7
+ import Search from '../search/search.vue'
8
+ import ListTopButtons from '../list-top-buttons/list-top-buttons.vue'
9
+ import CardBotomButtons from '../card-botom-buttons/card-botom-buttons.vue'
10
+ import { generateHighResolutionID } from '../../utils/index'
11
+ import productCard from '../product-card/product-card.vue'
12
+ import tabSearch from '../tab-search/tab-search.vue'
13
+ import { useEnums } from '../../composables/useEnumes'
14
+
15
+ defineOptions({
16
+ name: 'WuiList',
17
+ })
18
+ defineProps<{
19
+ detailButtonHandle?: (data: Entities) => void
20
+ }>()
21
+
22
+ const Zpaging = ref<any>(null)
23
+ const config = ref<Config>({
24
+ buttons: [],
25
+ columns: [],
26
+ primaryColumn: {
27
+ sourceId: '',
28
+ controlType: '',
29
+ mstrucId: '',
30
+ extControlType: '',
31
+ },
32
+ primaryCriterion: {
33
+ hidden: false,
34
+ disabled: false,
35
+ defaultValue: '',
36
+ transDefaultValue: '',
37
+ required: false,
38
+ controlType: '',
39
+ sourceId: '',
40
+ mstrucId: '',
41
+ extControlType: '',
42
+ },
43
+ secondColumn: {
44
+ sourceId: '',
45
+ controlType: '',
46
+ mstrucId: '',
47
+ extControlType: '',
48
+ },
49
+ criteria: [],
50
+ id: '',
51
+ fields: [],
52
+ title: '',
53
+ type: '',
54
+ pointSourceId: '',
55
+ mstrucId: '',
56
+ relationNames: [],
57
+ readOnly: false,
58
+ displayConfig: [],
59
+ showType: 'table',
60
+ })
61
+ const { getEnums, enumColumn } = useEnums({ config })
62
+ const sourceId = ref('')
63
+ const datas = ref<Entities[]>([])
64
+ const pageTitle = ref('')
65
+ const searchData = ref('')
66
+ const tabSearchData = ref('')
67
+ const pageType = ref('')
68
+ const mainCode = ref('')
69
+ const addEvent = generateHighResolutionID()// 全局事件名称
70
+ onLoad((option: any) => {
71
+ console.log(option)
72
+ sourceId.value = option.sourceId
73
+ pageTitle.value = option.title
74
+ pageType.value = option.pageType
75
+ mainCode.value = option.mainCode || ''
76
+ uni.setNavigationBarTitle({
77
+ title: option.title,
78
+ })
79
+ getPageConfig()
80
+ })
81
+ onMounted(async () => {
82
+ console.log('mounted')
83
+ // 监听添加成功的事件
84
+ uni.$on(addEvent, async () => {
85
+ Zpaging.value.reload()
86
+ })
87
+ })
88
+ // 在组件卸载时解绑全局事件
89
+ onUnmounted(() => {
90
+ console.log(`${pageTitle.value}页面卸载`)
91
+ uni.$off(addEvent)
92
+ })
93
+ async function getPageConfig() {
94
+ try {
95
+ const res = await pageConfig(sourceId.value)
96
+ if (res.ltmplConfig) {
97
+ config.value = res.ltmplConfig
98
+ console.log('config', config.value)
99
+ getEnums()
100
+ }
101
+ }
102
+ catch (error) {
103
+ console.log(error)
104
+ }
105
+ }
106
+
107
+ // @query所绑定的方法不要自己调用!!需要刷新列表数据时,只需要调用this.$refs.paging.reload()即可
108
+ async function queryList(pageNo: number, pageSize: number) {
109
+ // 此处请求仅为演示,请替换为自己项目中的请求
110
+ // request.queryList({ pageNo,pageSize }).then(res => {
111
+ // 将请求结果通过complete传给z-paging处理,同时也代表请求结束,这一行必须调用
112
+ // paging.value.complete(res.data.list);
113
+ // }).catch(res => {
114
+ // 如果请求失败写paging.value.complete(false);
115
+ // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
116
+ // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
117
+ // paging.value.complete(false);
118
+ // paging.value.reload() // 手动触发加载
119
+ // })
120
+ let qre = tabSearchData.value || searchData.value
121
+ if (config.value.defaultCriteriaValue) {
122
+ for (const key in config.value.defaultCriteriaValue) {
123
+ if (Object.prototype.hasOwnProperty.call(config.value.defaultCriteriaValue, key)) {
124
+ const element = config.value.defaultCriteriaValue[key]
125
+ if (!qre.includes(key)) {
126
+ qre = `${qre}&${key}=${element}`
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ try {
133
+ const res = await pageKey(sourceId.value, mainCode.value, qre)// 获取key
134
+ const data = await listData(res.key, pageNo, pageSize)// 获取数据
135
+ // const count = await getPageTotal(key.data?.key)// 获取总数
136
+ Zpaging.value.complete(data.entities)
137
+
138
+ // emits('loadData', data.data.entities)
139
+ }
140
+ catch (error) {
141
+ if (Zpaging.value) {
142
+ Zpaging.value.complete(false)
143
+ }
144
+ console.error(error)
145
+ }
146
+ }
147
+
148
+ function submitSearch(data: any) {
149
+ searchData.value = data
150
+ // for (const key in data) {
151
+ // if (Object.prototype.hasOwnProperty.call(data, key)) {
152
+ // const element = data[key]
153
+ // searchData.value = `${searchData.value}&c_${key}=${element}`
154
+ // }
155
+ // }
156
+ Zpaging.value.reload()
157
+ }
158
+
159
+ // tabSearch点击事件
160
+ function tabSearchClick(data: any) {
161
+ if (searchData.value) {
162
+ tabSearchData.value = `${searchData.value}&${data}`
163
+ }
164
+ else {
165
+ tabSearchData.value = data
166
+ }
167
+
168
+ Zpaging.value.reload()
169
+ }
170
+ </script>
171
+
172
+ <template>
173
+ <z-paging
174
+ ref="Zpaging" v-model="datas" :default-page-size="5" :show-loading-more-when-reload="true"
175
+ @query="queryList"
176
+ >
177
+ <template #top>
178
+ <slot name="top" />
179
+ <Search
180
+ :main-code="mainCode" :enum-column="enumColumn" :criteria="config.criteria"
181
+ :primary-criterion="config.primaryCriterion" :split2-tab-criterias="config.split2TabCriterias"
182
+ @submit="submitSearch"
183
+ />
184
+ <view>
185
+ <ListTopButtons
186
+ :add-event="addEvent" :main-code="mainCode" :buttons="config.buttons" :source-id="sourceId"
187
+ :page-title="pageTitle" :page-type="pageType"
188
+ :config="config"
189
+ />
190
+ </view>
191
+ <!-- 自定义tab搜索 -->
192
+ <view v-if="config.split2TabCriterias">
193
+ <tabSearch :split2-tab-criterias="config.split2TabCriterias" :enums="enumColumn" @click="tabSearchClick" />
194
+ </view>
195
+ </template>
196
+ <view v-if="config.showType === 'cardList'">
197
+ <productCard
198
+ v-for="(item, index) in datas" :key="item.code" :index="index" :enum-column="enumColumn"
199
+ :collapse-num="5" :source-id="sourceId" :groups="config" :data="item" :columns="config.columns"
200
+ :primary-column="config.primaryColumn" :second-column="config.secondColumn" :label-column="config.labelColumn"
201
+ model="complex" :card-show-cols="config.cardShowCols" :main-picture="config.mainPicture"
202
+ >
203
+ <template #buttons>
204
+ <slot name="cardBotomButtons" :data="item" />
205
+ <CardBotomButtons
206
+ :primary-column="config.primaryColumn" :add-event="addEvent" :detail-button-handle="detailButtonHandle" :zpaging="Zpaging"
207
+ :enum-column="enumColumn" :actions="config.actions" :row-actions="config.rowActions" :ractions="config.ractions" :source-id="sourceId"
208
+ :item="config" :code="item.code" :page-type="pageType" :data="item"
209
+ />
210
+ </template>
211
+ </productCard>
212
+ </view>
213
+ <view v-else>
214
+ <foldCard
215
+ v-for="(item, index) in datas" :key="item.code" :index="index" :enum-column="enumColumn"
216
+ :collapse-num="5" :source-id="sourceId" :groups="config" :data="item" :columns="config.columns"
217
+ :primary-column="config.primaryColumn" :second-column="config.secondColumn" :label-column="config.labelColumn"
218
+ model="complex"
219
+ >
220
+ <template #buttons>
221
+ <slot name="cardBotomButtons" :data="item" />
222
+ <CardBotomButtons
223
+ :primary-column="config.primaryColumn" :add-event="addEvent" :detail-button-handle="detailButtonHandle" :zpaging="Zpaging"
224
+ :enum-column="enumColumn" :actions="config.actions" :row-actions="config.rowActions" :ractions="config.ractions" :source-id="sourceId"
225
+ :item="config" :code="item.code" :page-type="pageType" :data="item"
226
+ />
227
+ </template>
228
+ </foldCard>
229
+ </view>
230
+
231
+ <template #bottom>
232
+ <slot name="bottom" />
233
+ </template>
234
+ </z-paging>
235
+ </template>