diff --git a/web/src/components/table/comSearch/index.vue b/web/src/components/table/comSearch/index.vue index b50fe5af..f336ec84 100644 --- a/web/src/components/table/comSearch/index.vue +++ b/web/src/components/table/comSearch/index.vue @@ -14,11 +14,11 @@ class="datetime-picker" v-model="baTable.comSearch.form[item.prop!]" :default-value="baTable.comSearch.form[item.prop! + '-default'] ? baTable.comSearch.form[item.prop! + '-default']:[new Date(), new Date()]" - type="datetimerange" + :type="item.comSearchRender == 'date' ? 'daterange' : 'datetimerange'" range-separator="To" start-placeholder="Start date" end-placeholder="End date" - value-format="YYYY-MM-DD HH:mm:ss" + :value-format="item.comSearchRender == 'date' ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss'" /> @@ -48,10 +48,10 @@ @@ -153,7 +153,11 @@ const onComSearch = () => { // 时间范围组件返回的是时间数组 if (baTable.comSearch.form[key] && baTable.comSearch.form[key].length >= 2) { // 数组转字符串,以实现通过url参数传递预设搜索值 - val = baTable.comSearch.form[key][0] + ',' + baTable.comSearch.form[key][1] + if (fieldDataTemp.comSearchRender == 'date') { + val = baTable.comSearch.form[key][0] + ' 00:00:00' + ',' + baTable.comSearch.form[key][1] + ' 23:59:59' + } else { + val = baTable.comSearch.form[key][0] + ',' + baTable.comSearch.form[key][1] + } } } else if (fieldDataTemp.operator == 'RANGE' || fieldDataTemp.operator == 'NOT RANGE') { // 普通的范围筛选,baTable在初始化时已准备好start和end字段 diff --git a/web/src/utils/baTable.ts b/web/src/utils/baTable.ts index 66706a95..7c3a1226 100644 --- a/web/src/utils/baTable.ts +++ b/web/src/utils/baTable.ts @@ -560,6 +560,7 @@ export default class baTable { this.comSearch.fieldData.set(prop, { operator: field[key].operator, render: field[key].render, + comSearchRender: field[key].comSearchRender, }) } } diff --git a/web/types/table.d.ts b/web/types/table.d.ts index 7f48969f..c4f26d7b 100644 --- a/web/types/table.d.ts +++ b/web/types/table.d.ts @@ -111,7 +111,7 @@ declare global { // 通用搜索框的placeholder operatorPlaceholder?: string // 公共搜索渲染方式:上方的 render=tag|switch 时公共搜索也会渲染为下拉,数字会渲染为范围筛选,时间渲染为时间选择器等 - comSearchRender?: 'remoteSelect' | 'select' | 'customRender' + comSearchRender?: 'remoteSelect' | 'select' | 'date' | 'customRender' // 公共搜索自定义组件/函数渲染 comSearchCustomRender?: string | Component // 远程属性