From af9c9678c47b954320b0533121be19c0bcbe1a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=99=E7=A0=81=E7=94=9F=E8=8A=B1?= <18523774412@qq.com> Date: Thu, 25 Aug 2022 12:38:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(baTable):=E8=A1=A8=E6=A0=BC=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E6=90=9C=E7=B4=A2=E6=94=AF=E6=8C=81=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=92=8C=E6=97=A5=E6=9C=9F=E8=8C=83=E5=9B=B4=E7=AD=9B=E9=80=89?= =?UTF-8?q?(=E7=BA=AF=E6=97=A5=E6=9C=9F=E6=97=A0=E6=97=B6=E9=97=B4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/table/comSearch/index.vue | 16 ++++++++++------ web/src/utils/baTable.ts | 1 + web/types/table.d.ts | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) 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 // 远程属性