wui-components-v2 1.2.20 → 1.2.22

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.
@@ -2,6 +2,7 @@
2
2
  import { computed, defineEmits, defineOptions, defineProps, ref } from 'vue'
3
3
  import type { Enums, Fields, Split2TabCriterias } from '../../type'
4
4
  import formControl from '../form-control/form-control.vue'
5
+ import { useManualThemeStore } from '../../store/manualThemeStore'
5
6
 
6
7
  defineOptions({ name: 'Search' })
7
8
  const props = defineProps<{
@@ -12,6 +13,10 @@ const props = defineProps<{
12
13
  split2TabCriterias?: Split2TabCriterias[]
13
14
  }>()
14
15
  const emits = defineEmits(['submit'])
16
+ // 自行携带暗色主题,避免在非 tabBar 页面(无 wd-config-provider 祖先)时
17
+ // wot 组件保持亮色导致 search-type 等区域显示为白色
18
+ const themeStore = useManualThemeStore()
19
+ const theme = computed(() => themeStore.theme)
15
20
  const show = ref(false)
16
21
  const search = ref('')
17
22
  const formControlRef = ref()
@@ -19,8 +24,7 @@ const entity = ref({})
19
24
  const filterCriteria = computed(() => {
20
25
  const criteriaSourceIds = props.split2TabCriterias?.map(item => item.sourceId) || []
21
26
  const primarySourceId = props.primaryCriterion?.sourceId
22
- if (!primarySourceId)
23
- return props.criteria
27
+ if (!primarySourceId) return props.criteria
24
28
  return props.criteria.filter(item => ![primarySourceId, ...criteriaSourceIds].includes(item.sourceId))
25
29
  })
26
30
  function handleClose() {
@@ -28,8 +32,7 @@ function handleClose() {
28
32
  }
29
33
  function handleSubmit() {
30
34
  if (!formControlRef.value) {
31
- if (!props.primaryCriterion?.sourceId)
32
- return
35
+ if (!props.primaryCriterion?.sourceId) return
33
36
  const data = `c_${props.primaryCriterion.sourceId}=${search.value}`
34
37
  emits('submit', data)
35
38
  handleClose()
@@ -46,22 +49,22 @@ function handleSubmit() {
46
49
  data = `c_${props.primaryCriterion.sourceId}=${search.value}`
47
50
  }
48
51
 
49
- filterCriteria.value.forEach((item) => {
52
+ filterCriteria.value.forEach(item => {
50
53
  for (const key in fdata) {
51
54
  if (Object.prototype.hasOwnProperty.call(fdata, key)) {
52
55
  const element = fdata[key]
53
56
  if (item.sourceId === key) {
54
57
  if (item.extControlType === 'relselectvalue') {
55
- data = `${data}&c_${item.sourceId}=${element.map((item: string) => {
56
- return item.split('@R@')[1]
57
- }).join('@,@')}`
58
- }
59
- else if (item.extControlType === 'multiselect') {
58
+ data = `${data}&c_${item.sourceId}=${element
59
+ .map((item: string) => {
60
+ return item.split('@R@')[1]
61
+ })
62
+ .join('@,@')}`
63
+ } else if (item.extControlType === 'multiselect') {
60
64
  element.forEach((subitem: string) => {
61
65
  data = `${data}&c_${item.sourceId}=${subitem}`
62
66
  })
63
- }
64
- else {
67
+ } else {
65
68
  data = `${data}&c_${item.sourceId}=${element}`
66
69
  }
67
70
  }
@@ -78,29 +81,56 @@ function handleSubmit() {
78
81
  </script>
79
82
 
80
83
  <template>
81
- <view v-if="primaryCriterion?.controlType === 'text'" class="w-full">
82
- <wd-search v-model="search" cancel-txt="搜索" :placeholder="`请输入${primaryCriterion?.title || ''}搜索`" @clear="handleSubmit" @cancel="handleSubmit">
83
- <template v-if="filterCriteria.length" #prefix>
84
- <view class="search-type">
85
- <wd-icon name="filter" size="17px" class="text-gray-500" @click="show = true" />
84
+ <wd-config-provider :theme="theme">
85
+ <view v-if="primaryCriterion?.controlType === 'text'" class="w-full">
86
+ <wd-search
87
+ v-model="search"
88
+ cancel-txt="搜索"
89
+ :placeholder="`请输入${primaryCriterion?.title || ''}搜索`"
90
+ @clear="handleSubmit"
91
+ @cancel="handleSubmit"
92
+ >
93
+ <template v-if="filterCriteria.length" #prefix>
94
+ <view class="search-type">
95
+ <wd-icon
96
+ name="filter"
97
+ size="17px"
98
+ class="text-gray-500 dark:text-[var(--wot-dark-color3)]"
99
+ @click="show = true"
100
+ />
101
+ </view>
102
+ </template>
103
+ </wd-search>
104
+ </view>
105
+ <wd-popup v-model="show" position="bottom" custom-class="h-80vh" closable @close="handleClose">
106
+ <view class="relative box-border h-full p-1 bg-white dark:bg-[var(--wot-dark-background)]">
107
+ <view class="h-34px flex items-center justify-center text-black dark:text-[var(--wot-dark-color)]">筛i选</view>
108
+ <formControl
109
+ ref="formControlRef"
110
+ :field-group="{
111
+ fields: filterCriteria,
112
+ readOnly: false,
113
+ displayConfig: [],
114
+ id: '',
115
+ buttons: [],
116
+ title: '',
117
+ type: '',
118
+ pointSourceId: '',
119
+ mstrucId: '',
120
+ relationNames: [],
121
+ }"
122
+ :entity="entity"
123
+ :enum-column="enumColumn"
124
+ />
125
+ <view class="h-12" />
126
+ <view
127
+ class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2 bg-white dark:bg-[var(--wot-dark-background)]"
128
+ >
129
+ <wd-button block custom-class="flex-1" @click="handleSubmit">确定</wd-button>
86
130
  </view>
87
- </template>
88
- </wd-search>
89
- </view>
90
- <wd-popup v-model="show" position="bottom" custom-class="h-80vh" closable @close="handleClose">
91
- <view class="relative box-border h-full p-1 bg-white dark:bg-[var(--wot-dark-background)]">
92
- <view class="h-34px flex items-center justify-center">
93
- 筛选
94
- </view>
95
- <formControl ref="formControlRef" :field-group="{ fields: filterCriteria, readOnly: false, displayConfig: [], id: '', buttons: [], title: '', type: '', pointSourceId: '', mstrucId: '', relationNames: [] }" :entity="entity" :enum-column="enumColumn" />
96
- <view class="h-12" />
97
- <view class="fixed bottom-0 left-0 right-0 box-border w-100% flex p-2 bg-white dark:bg-[var(--wot-dark-background)]">
98
- <wd-button block custom-class="flex-1" @click="handleSubmit">
99
- 确定
100
- </wd-button>
101
131
  </view>
102
- </view>
103
- </wd-popup>
132
+ </wd-popup>
133
+ </wd-config-provider>
104
134
  </template>
105
135
 
106
136
  <style scoped>
@@ -123,6 +153,4 @@ function handleSubmit() {
123
153
  font-size: 20px;
124
154
  vertical-align: middle;
125
155
  }
126
-
127
-
128
156
  </style>
@@ -13,7 +13,7 @@ defineOptions({
13
13
  const sourceId = ref('')
14
14
  const id = ref('')
15
15
  const title = ref('')
16
- const pageConfig = ref<dtmplConfig> ({
16
+ const pageConfig = ref<dtmplConfig>({
17
17
  id: '',
18
18
  title: '',
19
19
  groups: [],
@@ -27,7 +27,7 @@ const data = ref<Entities>({
27
27
  })
28
28
  const groups = ref<Groups>({
29
29
  id: '',
30
- buttons: ['detail'],
30
+ buttons: [],
31
31
  fields: [],
32
32
  title: '',
33
33
  type: '',
@@ -36,7 +36,6 @@ const groups = ref<Groups>({
36
36
  relationNames: [],
37
37
  readOnly: false,
38
38
  displayConfig: [],
39
-
40
39
  })
41
40
  const loading = ref(false)
42
41
  // 折叠面板
@@ -73,7 +72,7 @@ function getQueryParams(url: string) {
73
72
  const result: { [key: string]: string } = {}
74
73
 
75
74
  // 遍历键值对
76
- pairs.forEach((pair) => {
75
+ pairs.forEach(pair => {
77
76
  const [key, value] = pair.split('=')
78
77
  // 解码URI组件并添加到结果对象
79
78
  result[decodeURIComponent(key)] = decodeURIComponent(value || '')
@@ -98,8 +97,7 @@ async function getPageConfig() {
98
97
  })
99
98
  getDetailData()
100
99
  }
101
- }
102
- catch (error) {
100
+ } catch (error) {
103
101
  console.log(error)
104
102
  loading.value = false
105
103
  }
@@ -111,8 +109,7 @@ async function getDetailData() {
111
109
  const res = await detailPageData(sourceId.value, id.value)
112
110
  data.value = res.entity
113
111
  loading.value = false
114
- }
115
- catch (error) {
112
+ } catch (error) {
116
113
  loading.value = false
117
114
  console.log(error)
118
115
  }
@@ -126,15 +123,36 @@ async function getDetailData() {
126
123
  </view>
127
124
  <view v-else>
128
125
  <wd-collapse v-model="collapses">
129
- <wd-collapse-item v-for="(group, index) in pageConfig.groups" :key="group.id" :title="group.title" :name="group.id">
126
+ <wd-collapse-item
127
+ v-for="(group, index) in pageConfig.groups"
128
+ :key="group.id"
129
+ :title="group.title"
130
+ :name="group.id"
131
+ >
130
132
  <view v-if="group.type === 'fieldGroup'" class="text-sm space-y-3">
131
133
  <LabelValue :index="index" :exhibit-data="group.fields" :data="data" />
132
134
  </view>
133
135
  <view v-if="group.type === 'relation'">
134
136
  <view v-for="(field, subindex) in data.arrayMap[group.id]" :key="field.code">
135
- <foldCard2 :index="subindex" :enum-column="{}" :groups="group" :source-id="sourceId" :columns="group.fields" model="complex" :data="field">
137
+ <foldCard2
138
+ :index="subindex"
139
+ :enum-column="{}"
140
+ :groups="group"
141
+ :source-id="sourceId"
142
+ :columns="group.fields"
143
+ model="complex"
144
+ :data="field"
145
+ >
136
146
  <template #buttons>
137
- <CardBotomButtons :primary-column="group.primaryColumn || { controlType: '', extControlType: '', sourceId: '', mstrucId: '' }" :source-id="group.id" :item="groups" :code="field.code" :data="data" />
147
+ <CardBotomButtons
148
+ :primary-column="
149
+ group.primaryColumn || { controlType: '', extControlType: '', sourceId: '', mstrucId: '' }
150
+ "
151
+ :source-id="group.id"
152
+ :item="groups"
153
+ :code="field.code"
154
+ :data="data"
155
+ />
138
156
  </template>
139
157
  </foldCard2>
140
158
  </view>
@@ -871,7 +871,7 @@ console.log(pageConfig, 'props111')
871
871
  <template #title>
872
872
  <view class="flex items-center justify-between">
873
873
  <view class="flex-1 flex items-center justify-between pr-2">
874
- <view>{{ group.title }}</view>
874
+ <view class="text-[#000]">{{ group.title }}</view>
875
875
  <view v-if="group.type === 'relation'">
876
876
  <view v-if="selectData[group.id]?.loading" class="flex justify-center p-3">
877
877
  <wd-loading />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",