wui-components-v2 1.1.41 → 1.1.43

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 (58) hide show
  1. package/api/feishu.ts +20 -0
  2. package/api/menu.ts +1 -1
  3. package/api/page.ts +1 -1
  4. package/api/sys.ts +1 -1
  5. package/components/add-address-list/add-address-list.vue +187 -0
  6. package/components/add-address-page/add-address-page.vue +76 -0
  7. package/components/add-address-page/config.ts +297 -0
  8. package/components/audio-play/audio-play.vue +3 -3
  9. package/components/card-botom-buttons/card-botom-buttons.vue +4 -3
  10. package/components/custom-date-picker/custom-date-picker.vue +114 -0
  11. package/components/custom-select-picker/custom-select-picker.vue +103 -0
  12. package/components/fold-card/fold-card.vue +16 -9
  13. package/components/form-control/form-control.vue +224 -143
  14. package/components/global-loading/global-loading.vue +1 -1
  15. package/components/global-message/global-message.vue +14 -10
  16. package/components/global-toast/global-toast.vue +1 -1
  17. package/components/list-top-buttons/list-top-buttons.vue +2 -2
  18. package/components/mulselect-picker/mulselect-picker.vue +2 -2
  19. package/components/privacy-popup/privacy-popup.vue +1 -1
  20. package/components/product-card/product-card.vue +2 -2
  21. package/components/search/search.vue +11 -6
  22. package/components/tab-search/tab-search.vue +7 -7
  23. package/components/user-choose/user-choose.vue +132 -0
  24. package/components/wui-default/wui-default.vue +1 -2
  25. package/components/wui-edit-page/wui-edit-page.vue +76 -53
  26. package/components/wui-enume-select-control/wui-enume-select-control.vue +35 -33
  27. package/components/wui-list/wui-list.vue +12 -8
  28. package/components/wui-login1/wui-login.vue +1 -1
  29. package/components/wui-menus1/components/banner-carousel.vue +8 -8
  30. package/components/wui-menus1/components/quick-panel.vue +1 -1
  31. package/components/wui-menus1/components/search-bar.vue +1 -1
  32. package/components/wui-menus1/components/section-menus.vue +1 -1
  33. package/components/wui-menus1/wui-menus.vue +6 -3
  34. package/components/wui-notify-info/notify-handle.vue +1 -1
  35. package/components/wui-notify-info/wui-notify-info.vue +7 -7
  36. package/components/wui-search-history-babbar/wui-search-history-babbar.vue +10 -10
  37. package/components/wui-select-list/wui-select-list.vue +48 -39
  38. package/components/wui-tabbar/wui-tabbar.vue +2 -2
  39. package/components/wui-tree-page/wui-tree-page.vue +9 -10
  40. package/components/wui-user/wui-user.vue +5 -5
  41. package/composables/types/theme.ts +1 -1
  42. package/composables/useCompanyFieldFilter.ts +59 -0
  43. package/composables/useEnumes.ts +36 -35
  44. package/composables/useGlobalLoading.ts +2 -2
  45. package/composables/useGlobalMessage.ts +7 -8
  46. package/composables/useGlobalToast.ts +2 -2
  47. package/composables/useLocale.ts +5 -5
  48. package/composables/useMenus.ts +1 -0
  49. package/composables/useTabbar.ts +2 -3
  50. package/index.d.ts +1 -1
  51. package/index.ts +2 -2
  52. package/package.json +1 -1
  53. package/store/language.ts +8 -11
  54. package/store/manualThemeStore.ts +2 -0
  55. package/store/persist.ts +1 -1
  56. package/type.ts +1 -0
  57. package/utils/control-type-supportor.ts +4 -0
  58. package/utils/index.ts +22 -0
@@ -64,7 +64,7 @@ let startX = 0
64
64
  * 每 3 秒切换到下一张,循环播放
65
65
  */
66
66
  function startAutoplay() {
67
- if (autoplayTimer)
67
+ if (autoplayTimer)
68
68
  clearInterval(autoplayTimer)
69
69
  autoplayTimer = setInterval(() => {
70
70
  currentIndex.value = (currentIndex.value + 1) % banners.length
@@ -132,7 +132,7 @@ function onDragStart(clientX: number) {
132
132
  * @param clientX 鼠标/触摸的当前 X 坐标
133
133
  */
134
134
  function onDragMove(clientX: number) {
135
- if (!isDragging.value)
135
+ if (!isDragging.value)
136
136
  return
137
137
  dragOffset.value = clientX - startX
138
138
  }
@@ -146,14 +146,14 @@ function onDragMove(clientX: number) {
146
146
  * 拖动结束后恢复自动播放
147
147
  */
148
148
  function onDragEnd() {
149
- if (!isDragging.value)
149
+ if (!isDragging.value)
150
150
  return
151
151
  isDragging.value = false
152
152
 
153
153
  const threshold = 50
154
154
  if (dragOffset.value < -threshold) {
155
155
  nextSlide()
156
- }
156
+ }
157
157
  else if (dragOffset.value > threshold) {
158
158
  prevSlide()
159
159
  }
@@ -282,11 +282,11 @@ onUnmounted(() => {
282
282
  >
283
283
  <!-- 左侧文字区域 -->
284
284
  <view class="flex-1">
285
- <h3 class="text-lg text-white font-semibold">
286
- {{ banner.title }}
285
+ <h3 class="text-lg text-white font-semibold">
286
+ {{ banner.title }}
287
287
  </h3>
288
- <p class="mt-1 text-sm text-white/80">
289
- {{ banner.subtitle }}
288
+ <p class="mt-1 text-sm text-white/80">
289
+ {{ banner.subtitle }}
290
290
  </p>
291
291
  </view>
292
292
 
@@ -2,7 +2,7 @@
2
2
  import { computed, defineOptions } from 'vue'
3
3
  import { RainbowColorGenerator } from '../../../utils'
4
4
  import { useSectionMenus } from '../../../composables/useSectionMenus'
5
- import { useLanguageStore } from '../../../store/language'
5
+ import { useLanguageStore } from '../../../store/language'
6
6
 
7
7
  defineOptions({
8
8
  name: 'QuickPanel',
@@ -32,7 +32,7 @@ function goToSearch() {
32
32
  <div
33
33
  class="h-12 flex items-center rounded-xl bg-white px-4 transition-all duration-200"
34
34
  :class="isFocused ? 'ring-2 ring-indigo-500 shadow-lg' : 'shadow-md'"
35
- >
35
+ >
36
36
  <wd-icon name="search" class="h-5 w-5 flex-shrink-0 text-slate-400" size="22px" />
37
37
  <input
38
38
  v-model="searchQuery"
@@ -2,7 +2,7 @@
2
2
  import { computed, defineOptions } from 'vue'
3
3
  import { useMenus } from '../../../composables/useMenus'
4
4
  import { RainbowColorGenerator } from '../../../utils/index'
5
- import { useLanguageStore } from '../../../store/language'
5
+ import { useLanguageStore } from '../../../store/language'
6
6
 
7
7
  defineOptions({
8
8
  name: 'SectionMenus',
@@ -10,7 +10,7 @@ import sectionMenus from './components/section-menus.vue'
10
10
  import navbar from './components/navbar.vue'
11
11
  import quickPanel from './components/quick-panel.vue'
12
12
  import bannerCarousel from './components/banner-carousel.vue'
13
- import searchBar from './components/search-bar.vue'
13
+ import searchBar from './components/search-bar.vue'
14
14
 
15
15
  defineOptions({
16
16
  name: 'WuiMenus1',
@@ -90,7 +90,7 @@ const {
90
90
  <wd-grid-item
91
91
  v-for="(subItem, subIndex) in item.items" :key="subIndex" use-text-slot use-icon-slot
92
92
  class="menu-grid-item"
93
- @itemclick="gotoPage(subItem)"
93
+ @click="gotoPage(subItem)"
94
94
  >
95
95
  <template #icon>
96
96
  <view
@@ -106,7 +106,7 @@ const {
106
106
  </template>
107
107
  <template #text>
108
108
  <view class="menu-text-wrapper">
109
- <view class="menu-title .dark:text-white .light:color-#1f2937">
109
+ <view class="menu-title text-ellipsis .dark:text-white .light:color-#1f2937">
110
110
  {{ languageStore.t(subItem.title) }}
111
111
  </view>
112
112
  <!-- <view class="menu-badge" v-if="subIndex === 0">
@@ -536,4 +536,7 @@ const {
536
536
  }
537
537
  }
538
538
  }
539
+ .menu-grid-container :deep(.wd-grid-item__content){
540
+ align-items: normal;
541
+ }
539
542
  </style>
@@ -46,7 +46,7 @@ onUnload(() => {
46
46
  </wuiDetailsPage>
47
47
  <view />
48
48
  </view>
49
- </template>
49
+ </template>
50
50
 
51
51
  <style scoped>
52
52
 
@@ -6,7 +6,7 @@ import { useSectionMenus } from '../../composables/useSectionMenus'
6
6
  import { formatItemData } from '../../utils'
7
7
  import ControlTypeSupportor from '../../utils/control-type-supportor'
8
8
  import { useLanguageStore } from '../../store/language'
9
- import type { Config, Entities, Enums } from '../../type'
9
+ import type { Config, Entities, Enums } from '../../type'
10
10
 
11
11
  defineOptions({
12
12
  name: 'WuiNotifyInfo',
@@ -202,14 +202,14 @@ function gotoDetailPage(item: Data) {
202
202
  {{ languageStore.t('查看全部') }}
203
203
  </view>
204
204
  </view>
205
- <button
205
+ <button
206
206
  v-for="item in notification.data" :key="item.id"
207
207
  class="w-full flex cursor-pointer items-start gap-3 rounded-xl bg-white p-4 text-left shadow-[0_4px_16px_rgba(99,102,241,0.1)] transition-all duration-200 .dark:bg-black hover:shadow-md"
208
- :class="{ 'opacity-60': item.read }" @click="handleNotificationClick(item)"
208
+ :class="{ 'opacity-60': item.read }" @click="handleNotificationClick(item)"
209
209
  >
210
- <view
210
+ <view
211
211
  :class="getIconColor(item.type)"
212
- class="h-10 w-10 flex flex-shrink-0 items-center justify-center rounded-full"
212
+ class="h-10 w-10 flex flex-shrink-0 items-center justify-center rounded-full"
213
213
  >
214
214
  <wd-icon name="notification" size="40rpx" color="#fff" />
215
215
  </view>
@@ -227,9 +227,9 @@ function gotoDetailPage(item: Data) {
227
227
  {{ formatItemData(item.secondColumn, ControlTypeSupportor.getControlType(item.secondColumnConfig || {}))
228
228
  }}
229
229
  </text>
230
- <text>
230
+ <text>
231
231
  {{ formatItemData(item.secondColumnLabel,
232
- ControlTypeSupportor.getControlType(item.secondColumnLabelConfig || {})) }}
232
+ ControlTypeSupportor.getControlType(item.secondColumnLabelConfig || {})) }}
233
233
  </text>
234
234
  </p>
235
235
  </view>
@@ -5,7 +5,7 @@ import { useMenus } from '../../composables/useMenus'
5
5
  import type { MenuItem } from '../../composables/useMenus'
6
6
  import { useGlobalToast } from '../../composables/useGlobalToast'
7
7
  import { menu } from '../../api/menu'
8
- import SearchHistory from './components/SearchBar.vue'
8
+ import SearchHistory from './components/SearchBar.vue'
9
9
 
10
10
  defineOptions({
11
11
  name: 'WuiSearchHistoryBabbar',
@@ -23,12 +23,12 @@ function queryList() {
23
23
  setTimeout(() => {
24
24
  router.replaceAll('/pages/login/index')
25
25
  }, 1000)
26
- }
26
+ }
27
27
  else {
28
- menuList.value = res?.blocks
29
- }
28
+ menuList.value = res?.blocks
29
+ }
30
30
  }).catch((res: any) => {
31
- console.log(res)
31
+ console.log(res)
32
32
  })
33
33
  }
34
34
 
@@ -47,15 +47,15 @@ function extractDeepestNodes<T>(
47
47
  /**
48
48
  * 递归遍历树节点
49
49
  */
50
- function traverse(nodes: T[], depth: number = 0) {
50
+ function traverse(nodes: T[], depth: number = 0) {
51
51
  for (const node of nodes) {
52
52
  // 检查当前节点是否有子节点
53
53
  const children = (node as any)[childrenKey]
54
54
 
55
- if (children && Array.isArray(children) && children.length > 0) {
55
+ if (children && Array.isArray(children) && children.length > 0) {
56
56
  // 如果有子节点,继续深入
57
57
  traverse(children, depth + 1)
58
- }
58
+ }
59
59
  else {
60
60
  // 如果没有子节点,这是最深层的节点,添加到结果中
61
61
  result.push(node)
@@ -67,7 +67,7 @@ function extractDeepestNodes<T>(
67
67
  return result
68
68
  }
69
69
 
70
- const a = computed(() => {
70
+ const a = computed(() => {
71
71
  return extractDeepestNodes(filtermenu.value, 'items')
72
72
  })
73
73
 
@@ -75,7 +75,7 @@ const searchQuery = ref('')
75
75
  const searchHistory = ref<string[]>([])
76
76
  const inputRef = ref<HTMLInputElement | null>(null)
77
77
 
78
- const filteredMenus = computed<MenuItem[]>(() => {
78
+ const filteredMenus = computed<MenuItem[]>(() => {
79
79
  if (!searchQuery.value.trim()) {
80
80
  return a.value
81
81
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed, defineOptions, onMounted, onUnmounted, ref } from 'vue'
2
+ import { computed, onMounted, onUnmounted, ref } from 'vue'
3
3
  import { onLoad } from '@dcloudio/uni-app'
4
4
  import { useRouter } from 'uni-mini-router'
5
5
  import { enums, listData, pageConfig, pageKey } from '../../api/page'
@@ -37,6 +37,7 @@ const config = ref<Config>({
37
37
  transDefaultValue: '',
38
38
  required: false,
39
39
  extControlType: '',
40
+ hidden: false,
40
41
  },
41
42
  criterias: [],
42
43
  buttons: [],
@@ -50,6 +51,8 @@ const config = ref<Config>({
50
51
  readOnly: false,
51
52
  displayConfig: [],
52
53
  showType: 'table',
54
+ extShowConfig: {},
55
+ extDisplayConfig: {}, // 扩展显示配置
53
56
  })
54
57
  const sourceId = ref('')
55
58
  const datas = ref<Entities[]>([])
@@ -66,44 +69,43 @@ onLoad((option: any) => {
66
69
  selectEvent.value = option.selectEvent
67
70
  sendSelectEvent.value = option.sendSelectEvent
68
71
  extControlType.value = option.extControlType
69
- model.value = option.foldCardModel || 'simple'
72
+ model.value = option.foldCardModel || option.cardModel || 'simple'
70
73
  uni.setNavigationBarTitle({
71
74
  title: `选择${option.title}`,
72
75
  })
76
+ // 必须在 onLoad 内注册:setup 阶段 sendSelectEvent 仍为空字符串
77
+ if (sendSelectEvent.value) {
78
+ uni.$once(sendSelectEvent.value, (data: string | string[]) => {
79
+ if (!data)
80
+ return
81
+
82
+ if (Array.isArray(data)) {
83
+ const newdata: Record<string, string> = {}
84
+ data.forEach((item) => {
85
+ newdata[item.split('@R@')[0]] = item
86
+ })
87
+ selectData.value = newdata
88
+ }
89
+ else {
90
+ selectData.value[data.split('@R@')[0]] = data
91
+ }
92
+ })
93
+ }
73
94
  getPageConfig()
74
95
  })
75
96
  const selectData = ref<Record<string, string>>({})// 选择数据
76
97
  const selectDataforMat = computed(() => {
77
98
  const newdata: Record<string, string> = {}
78
- console.log('selectData.value', selectData.value)
79
- // 如果 selectData.value 是对象,则遍历它的值
80
99
  if (typeof selectData.value === 'object' && selectData.value !== null) {
81
100
  Object.values(selectData.value).forEach((item) => {
82
101
  newdata[item.split('@R@')[0]] = item.split('@R@')[0]
83
102
  })
84
103
  }
85
- console.log('selectDataforMat', newdata)
86
104
  return newdata
87
105
  })
88
106
  onMounted(() => {
89
107
  // selectData.value = { '447607223953539077': '447607223953539077@R@光机' }
90
108
  })
91
- uni.$once(sendSelectEvent.value, async (data: string | string[]) => {
92
- if (!data)
93
- return
94
-
95
- if (Array.isArray(data)) {
96
- const newdata: Record<string, string> = {}
97
- data.forEach((item) => {
98
- newdata[item.split('@R@')[0]] = item
99
- })
100
- selectData.value = newdata
101
- }
102
- else {
103
- selectData.value[data.split('@R@')[0]] = data
104
- }
105
- uni.$off(sendSelectEvent.value)
106
- })
107
109
 
108
110
  // 获取页面配置
109
111
  async function getPageConfig() {
@@ -188,27 +190,25 @@ function handleChange(item: Entities) {
188
190
  }
189
191
 
190
192
  // 判断是否为单选,清空选项
191
- if (extControlType.value === 'relselect') {
193
+ if (extControlType.value === 'relselect'||extControlType.value === 'relselect-extdis') {
192
194
  selectData.value = {}
193
195
  }
194
196
 
195
197
  selectData.value[item.code] = `${item.code}@R@${item.fieldMap[config.value.primaryColumn.sourceId]}`
196
198
  }
197
- // 发送选中数据
199
+ // 发送选中数据(与编辑页 / mulselect-picker 的 uni.$once(selectEvent) 约定一致)
198
200
  function send() {
199
- const data = Object.values(selectData.value)
200
- if (!data.length) {
201
+ const keys = Object.keys(selectData.value)
202
+ if (!keys.length) {
201
203
  globalToast.warning(`请选择${pageTitle.value}`)
202
204
  return
203
205
  }
204
206
 
205
- // 判断是否为单选,是:发送字符串,否:发送数组
206
- if (extControlType.value === 'relselect') {
207
- uni.$emit(selectEvent.value, data[0])
208
- }
209
- else {
210
- uni.$emit(selectEvent.value, data)
207
+ const payload = Object.values(selectData.value)
208
+ if (selectEvent.value) {
209
+ uni.$emit(selectEvent.value, payload)
211
210
  }
211
+
212
212
  router.back()
213
213
  }
214
214
  // 取消
@@ -221,20 +221,22 @@ function confirm() {
221
221
  send()
222
222
  }
223
223
  onUnmounted(() => {
224
- console.log('unmounted')
225
224
  uni.$off(selectEvent.value)
226
225
  })
227
226
 
228
227
  function submitSearch(data: any) {
229
228
  searchData.value = data
230
- // for (const key in data) {
231
- // if (Object.prototype.hasOwnProperty.call(data, key)) {
232
- // const element = data[key]
233
- // searchData.value = `${searchData.value}&c_${key}=${element}`
234
- // }
235
- // }
236
229
  Zpaging.value.reload()
237
230
  }
231
+ const showAddressInfo = computed(() => {
232
+ return extControlType.value=='relselect-extdis' || false
233
+ })
234
+ const formatAddress = (value:string) => {
235
+ return (value?.split(',') || [])[2] || ''
236
+ }
237
+ const checkboxType:any=computed(()=>{
238
+ return ['relselect','relselect-extdis'].includes(extControlType.value)?'':'square'
239
+ })
238
240
  </script>
239
241
 
240
242
  <template>
@@ -249,7 +251,14 @@ function submitSearch(data: any) {
249
251
 
250
252
  <foldCard v-for="(item, index) in datas" :key="item.code" :index="index" :data="item" :columns="config.columns" :primary-column="config.primaryColumn" :second-column="config.secondColumn" :model="model" :groups="config" :source-id="sourceId" @click="() => { handleChange(item) }">
251
253
  <template #select>
252
- <wd-checkbox :true-value="`${item.code}`" false-value="" :model-value="selectDataforMat[item.code]" />
254
+ <wd-checkbox :true-value="`${item.code}`" false-value="" :model-value="selectDataforMat[item.code]" :type="checkboxType" />
255
+ </template>
256
+
257
+ <template #addressInfo v-if="showAddressInfo" >
258
+ <div>{{ item.fieldMap[config.extDisplayConfig?.secondColumn?.sourceId] }}</div>
259
+ </template>
260
+ <template #detailAddress v-if="showAddressInfo" >
261
+ <div>{{ formatAddress(item.fieldMap[config.extDisplayConfig?.cardShowCols?.[0]?.sourceId]) }}</div>
253
262
  </template>
254
263
  <!-- <template #buttons>
255
264
  <CardBotomButtons :data="item" :groups="config" :source-id="sourceId" :item="config" :code="item.code" />
@@ -20,7 +20,7 @@ const router = useRouter()
20
20
 
21
21
  const route = useRoute()
22
22
 
23
- const { themeVars, theme } = useManualTheme()
23
+ const { themeVars, theme, currentThemeColor } = useManualTheme()
24
24
 
25
25
  const { activeTabbar, getTabbarItemValue, setTabbarItemActive, tabbarList } = useTabbar(props.tabbarItems)
26
26
 
@@ -56,6 +56,7 @@ export default {
56
56
  <slot />
57
57
  <wd-tabbar
58
58
  :model-value="activeTabbar.name" bordered safe-area-inset-bottom placeholder fixed custom-class="z-14!"
59
+ :active-color="currentThemeColor.primary"
59
60
  @change="handleTabbarChange"
60
61
  >
61
62
  <wd-tabbar-item
@@ -72,7 +73,6 @@ export default {
72
73
  <privacy-popup />
73
74
  <!-- #endif -->
74
75
  <wd-notify />
75
- <wd-message-box />
76
76
  <wd-toast />
77
77
  <global-loading />
78
78
  <global-toast />
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, defineOptions, onMounted, onUnmounted, ref } from 'vue'
3
3
  import { onLoad } from '@dcloudio/uni-app'
4
- import { useMessage } from 'wot-design-uni'
4
+ import { useDialog } from '@wot-ui/ui'
5
5
  import { useGlobalLoading } from '../../composables/useGlobalLoading'
6
6
  import { useGlobalToast } from '../../composables/useGlobalToast'
7
7
  import ListTopButtons from '../list-top-buttons/list-top-buttons.vue'
@@ -21,11 +21,11 @@ const pageTitle = ref('')
21
21
  const mainCode = ref('')
22
22
  const addEvent = generateHighResolutionID()// 全局事件名称
23
23
  const Zpaging = ref<any>(null)
24
- const message = useMessage()
24
+ const dialog = useDialog()
25
25
  const parentId = ref('')
26
26
  const parentNodeType = ref<nodeType>('root')
27
27
  const targetNodeType = ref<nodeType>('root')
28
- const { loading, close } = useGlobalLoading()
28
+ const { loading } = useGlobalLoading()
29
29
  const { success, error } = useGlobalToast()
30
30
 
31
31
  onLoad((option: any) => {
@@ -158,11 +158,11 @@ function handleRemove(targetNode: TreeNode) {
158
158
  sourceId = treeConfig.value.branchRatmplId || ''
159
159
  }
160
160
 
161
- message
161
+ dialog
162
162
  .confirm({
163
163
  msg: `确定要删除 "${targetNode.label}" 及其子节点吗?`,
164
164
  title: '提示',
165
- beforeConfirm: async ({ resolve }) => {
165
+ beforeConfirm: async () => {
166
166
  loading('删除中...')
167
167
  try {
168
168
  // const res = await editPageConfig(sourceId || '', targetNode.id)
@@ -171,18 +171,17 @@ function handleRemove(targetNode: TreeNode) {
171
171
  if (res1.status === 'success') {
172
172
  success('删除成功')
173
173
  removeNodeRecursively(filteredTreeData.value, targetNode.id)
174
+ return true
174
175
  }
175
176
  else {
176
177
  error('删除失败')
178
+ return false
177
179
  }
178
180
  }
179
181
  catch (error1) {
180
182
  error('删除失败')
181
183
  console.log(error1)
182
- }
183
- finally {
184
- resolve(true)
185
- close()
184
+ return false
186
185
  }
187
186
  },
188
187
  })
@@ -280,7 +279,7 @@ function handleSearch() {
280
279
  />
281
280
  </view>
282
281
  </view>
283
- <wd-message-box />
282
+ <wd-dialog />
284
283
  </z-paging>
285
284
  </template>
286
285
 
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { ref } from 'vue'
3
3
  import {
4
- useMessage,
5
- } from 'wot-design-uni'
4
+ useDialog,
5
+ } from '@wot-ui/ui'
6
6
  import { useUser } from '../../composables/useUser'
7
7
  import { generateGradientColor } from '../../utils'
8
8
  import { useManualTheme } from '../../composables/useManualTheme'
@@ -14,7 +14,7 @@ const {
14
14
  currentThemeColor,
15
15
  } = useManualTheme()
16
16
  const user = useUser().getUserInfo()
17
- const message = useMessage()
17
+ const dialog = useDialog()
18
18
  const userInfo = ref({
19
19
  name: user.name,
20
20
  nickName: user.nickName,
@@ -22,7 +22,7 @@ const userInfo = ref({
22
22
  })
23
23
  // 退出登录
24
24
  function quit() {
25
- message
25
+ dialog
26
26
  .confirm({
27
27
  // msg: '提示文案',
28
28
  title: '退出登录',
@@ -82,7 +82,7 @@ function setting() {
82
82
  <wd-cell title="系统设置" icon="setting" :is-link="true" :clickable="true" @click="setting" />
83
83
  <wd-cell title="退出登录" icon="logout" :is-link="true" :clickable="true" @click="quit" />
84
84
  </wd-cell-group>
85
- <wd-message-box />
85
+ <wd-dialog />
86
86
  </view>
87
87
  </template>
88
88
 
@@ -1,4 +1,4 @@
1
- import type { ConfigProviderThemeVars } from 'wot-design-uni'
1
+ import type { ConfigProviderThemeVars } from '@wot-ui/ui'
2
2
 
3
3
  /**
4
4
  * 主题色选项接口
@@ -0,0 +1,59 @@
1
+ import { computed, ref, watch } from 'vue'
2
+ import type { Ref } from 'vue'
3
+ import type { Groups } from '../type'
4
+
5
+ const COMPANY_FIELD_SOURCE_ID = '' // 公司字段 sourceId
6
+
7
+ export function useCompanyFieldFilter(
8
+ fieldGroup: () => Groups | undefined,
9
+ model: Ref<any>,
10
+ enabled: boolean = true,
11
+ companyFieldSourceId: string = COMPANY_FIELD_SOURCE_ID,
12
+ ) {
13
+ const deliveryCompanySourceId = ref<string>('')
14
+ const selectedCompany = ref<string>('')
15
+
16
+ if (enabled) {
17
+ watch(
18
+ () => fieldGroup()?.fields,
19
+ (newFields) => {
20
+ const companyField: any = newFields?.find((item: any) => item.sourceId === companyFieldSourceId) || {}
21
+ deliveryCompanySourceId.value = companyField.sourceId || ''
22
+ },
23
+ { deep: true, immediate: true },
24
+ )
25
+
26
+ watch(
27
+ () => model.value[deliveryCompanySourceId.value],
28
+ (newValue) => {
29
+ selectedCompany.value = newValue ? newValue.substring(0, 2) : ''
30
+ },
31
+ { immediate: true },
32
+ )
33
+ }
34
+
35
+ const filteredFields = computed(() => {
36
+ const allFields = fieldGroup()?.fields
37
+ if (!allFields)
38
+ return []
39
+ return allFields.filter((item: any) => {
40
+ // 如果没有选中公司,所有字段都显示
41
+ if (!selectedCompany.value) {
42
+ return true
43
+ }
44
+ // 检查 usableRuleCriterias 是否存在且有值
45
+ if (!item.usableRuleCriterias || item.usableRuleCriterias.length === 0) {
46
+ return true
47
+ }
48
+ // 获取 transDefaultValue 并检查是否包含选中的公司
49
+ const transDefaultValue = item.usableRuleCriterias[0]?.transDefaultValue
50
+ if (typeof transDefaultValue === 'string') {
51
+ const values = transDefaultValue.split(',').map(v => v.trim())
52
+ return values.includes(selectedCompany.value)
53
+ }
54
+ return true
55
+ })
56
+ })
57
+
58
+ return { filteredFields, selectedCompany }
59
+ }
@@ -1,42 +1,43 @@
1
- import { enums, listData, pageConfig, pageKey } from '../api/page'
2
1
  import { ref } from 'vue'
2
+ import { enums } from '../api/page'
3
3
  import ControlTypeSupportor from '../utils/control-type-supportor'
4
- import type { Enums } from '../type'
4
+ import type { Enums } from '../type'
5
+
5
6
  export function useEnums({ config }: { config: any }) {
6
- const enumColumn = ref<Enums>({})
7
- // 获取枚举
8
- async function getEnums() {
9
- try {
10
- const params: string[] = []
11
- const criterias = config.value?.criterias ?? []
12
- const columns = config.value.columns ?? []
13
- const writes = config.value.rowActions?.reduce((acc: any, cur: any) => {
14
- return [...acc, ...cur.writes]
15
- }, []) || []
16
- columns.forEach((item: any) => {
17
- if (ControlTypeSupportor.getControlType(item) === 'select' || ControlTypeSupportor.getControlType(item) === 'multiselect') {
18
- params.push(`mstrucIds=${item.mstrucId}`)
19
- }
20
- })
21
- criterias.forEach((item: any) => {
22
- if (ControlTypeSupportor.getControlType(item) === 'select' || ControlTypeSupportor.getControlType(item) === 'multiselect') {
23
- params.push(`mstrucIds=${item.mstrucId}`)
24
- }
25
- })
26
- writes.forEach((item: any) => {
27
- if (ControlTypeSupportor.getControlType(item) === 'select' || ControlTypeSupportor.getControlType(item) === 'multiselect') {
28
- params.push(`mstrucIds=${item.mstrucId}`)
29
- }
30
- })
31
- if (!params.length)
32
- return
33
- const res = await enums(params.join('&'))
34
- enumColumn.value = res.enumMap || {}
7
+ const enumColumn = ref<Enums>({})
8
+ // 获取枚举
9
+ async function getEnums() {
10
+ try {
11
+ const params: string[] = []
12
+ const criterias = config.value?.criterias ?? []
13
+ const columns = config.value.columns ?? []
14
+ const writes = config.value.rowActions?.reduce((acc: any, cur: any) => {
15
+ return [...acc, ...cur.writes]
16
+ }, []) || []
17
+ columns.forEach((item: any) => {
18
+ if (ControlTypeSupportor.getControlType(item) === 'select' || ControlTypeSupportor.getControlType(item) === 'multiselect') {
19
+ params.push(`mstrucIds=${item.mstrucId}`)
20
+ }
21
+ })
22
+ criterias.forEach((item: any) => {
23
+ if (ControlTypeSupportor.getControlType(item) === 'select' || ControlTypeSupportor.getControlType(item) === 'multiselect') {
24
+ params.push(`mstrucIds=${item.mstrucId}`)
35
25
  }
36
- catch (error) {
37
- console.log('error:', error)
26
+ })
27
+ writes.forEach((item: any) => {
28
+ if (ControlTypeSupportor.getControlType(item) === 'select' || ControlTypeSupportor.getControlType(item) === 'multiselect') {
29
+ params.push(`mstrucIds=${item.mstrucId}`)
38
30
  }
31
+ })
32
+ if (!params.length)
33
+ return
34
+ const res = await enums(params.join('&'))
35
+ enumColumn.value = res.enumMap || {}
36
+ }
37
+ catch (error) {
38
+ console.log('error:', error)
39
39
  }
40
+ }
40
41
 
41
- return { getEnums, enumColumn }
42
- }
42
+ return { getEnums, enumColumn }
43
+ }