wui-components-v2 1.2.39 → 1.2.40

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.
@@ -122,9 +122,19 @@ function initFormData() {
122
122
  ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === 'eetime' ||
123
123
  ControlTypeSupportor.getControlType(item, props.entity && props.entity[item.sourceId]) === 'date'
124
124
  ) {
125
+ const entityVal = props.entity && props.entity[item.sourceId]
126
+ // 解析默认值:支持 $$currentD(今天)、纯数字时间戳、日期字符串
127
+ const defaultVal = item.transDefaultValue || item.defaultValue || ''
128
+ const resolvedDefault = defaultVal
129
+ ? defaultVal === '$$currentD'
130
+ ? dayjs().format('YYYY-MM-DD')
131
+ : /^\d+$/.test(String(defaultVal))
132
+ ? dayjs(Number(defaultVal)).format('YYYY-MM-DD')
133
+ : defaultVal
134
+ : ''
125
135
  return (models[item.sourceId] =
126
- (props.entity && dayjs(props.entity[item.sourceId]).valueOf()) ||
127
- (item.transDefaultValue && dayjs(item.transDefaultValue).valueOf()) ||
136
+ (entityVal && dayjs(entityVal).valueOf()) ||
137
+ (resolvedDefault && dayjs(resolvedDefault).valueOf()) ||
128
138
  null)
129
139
  }
130
140
 
@@ -279,7 +279,6 @@ function submitSearch(data: any) {
279
279
  const val = fdata[item.sourceId]
280
280
  if (val === undefined || val === null || val === '') return
281
281
  if (Array.isArray(val) && val.length === 0) return
282
- if (item.transDefaultValue && String(val) === String(item.transDefaultValue)) return
283
282
  // 时间戳转日期字符串
284
283
  const formatted = typeof val === 'number' ? dayjs(val).format('YYYY-MM-DD') : val
285
284
  timeData = timeData ? `${timeData}&c_${item.sourceId}=${formatted}` : `c_${item.sourceId}=${formatted}`
@@ -307,7 +306,6 @@ function submitTimeFilter() {
307
306
  const val = fdata[item.sourceId]
308
307
  if (val === undefined || val === null || val === '') return
309
308
  if (Array.isArray(val) && val.length === 0) return
310
- if (item.transDefaultValue && String(val) === String(item.transDefaultValue)) return
311
309
  // 时间戳转日期字符串
312
310
  const formatted = typeof val === 'number' ? dayjs(val).format('YYYY-MM-DD') : val
313
311
  data = data ? `${data}&c_${item.sourceId}=${formatted}` : `c_${item.sourceId}=${formatted}`
@@ -24,14 +24,14 @@ const formControlRef = ref()
24
24
  const entity = ref({})
25
25
  // 判断字段实际渲染的控件类型是否为纯文本输入(优先 extControlType,回退 controlType)
26
26
  const isTextCriterion = (item: Fields) => ControlTypeSupportor.getControlType(item) === 'text'
27
- // 用于 wd-search 的搜索字段:优先使用 primaryCriterion,否则取 criteria 中第一个文本类型的筛选项
27
+ // 用于 wd-search 的搜索字段:primaryCriterion 存在时直接使用,否则取 criteria 中第一个文本类型的筛选项
28
28
  const searchCriterion = computed(() => {
29
- if (props.primaryCriterion && isTextCriterion(props.primaryCriterion)) {
29
+ if (props.primaryCriterion) {
30
30
  return props.primaryCriterion
31
31
  }
32
32
  return props.criteria.find(item => isTextCriterion(item)) || null
33
33
  })
34
- // 仅当 searchCriterion 为文本类型时显示搜索框
34
+ // 仅当 searchCriterion 存在时显示搜索框
35
35
  const showSearch = computed(() => searchCriterion.value !== null)
36
36
  const filterCriteria = computed(() => {
37
37
  const criteriaSourceIds = props.split2TabCriterias?.map(item => item.sourceId) || []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.39",
3
+ "version": "1.2.40",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",