添加重置隐藏

This commit is contained in:
GGJ
2024-12-02 15:11:02 +08:00
parent 7d3eefc1ce
commit 4347f4b15b
2 changed files with 8 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
<el-option v-for="item in timeOptions" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in timeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
<el-date-picker v-model="timeValue" type="daterange" :disabled="disabledPicker" <el-date-picker v-model="timeValue" type="daterange" :disabled="disabledPicker" :disabled-date="isFutureDate"
style="width: 220px; margin-right: 10px" unlink-panels :clearable="false" range-separator="" style="width: 220px; margin-right: 10px" unlink-panels :clearable="false" range-separator=""
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD" :shortcuts="shortcuts" /> start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD" :shortcuts="shortcuts" />
<el-button :disabled="backDisabled" type="primary" :icon="DArrowLeft" @click="preClick"></el-button> <el-button :disabled="backDisabled" type="primary" :icon="DArrowLeft" @click="preClick"></el-button>
@@ -70,6 +70,9 @@ const shortcuts = [
} }
} }
] ]
const isFutureDate = (time) => {
return time && time > Date.now();
};
onMounted(() => { onMounted(() => {
timeChange(3) timeChange(3)
}) })

View File

@@ -19,7 +19,7 @@
</el-button> </el-button>
<el-button @click="onComSearch" v-if="showSearch" :loading="tableStore.table.loading" type="primary" <el-button @click="onComSearch" v-if="showSearch" :loading="tableStore.table.loading" type="primary"
:icon="Search">查询</el-button> :icon="Search">查询</el-button>
<el-button @click="onResetForm" v-if="showSearch" :loading="tableStore.table.loading" <el-button @click="onResetForm" v-if="showSearch && showReset" :loading="tableStore.table.loading"
:icon="RefreshLeft">重置</el-button> :icon="RefreshLeft">重置</el-button>
</template> </template>
<slot name="operation"></slot> <slot name="operation"></slot>
@@ -54,6 +54,7 @@ interface Props {
showSearch?: boolean showSearch?: boolean
nextFlag?: boolean //控制时间是否可以往后推 nextFlag?: boolean //控制时间是否可以往后推
theCurrentTime?: boolean //控制时间前3天展示上个月时间 theCurrentTime?: boolean //控制时间前3天展示上个月时间
showReset?: boolean //控制时间前3天展示上个月时间
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
@@ -61,7 +62,8 @@ const props = withDefaults(defineProps<Props>(), {
area: false, area: false,
showSearch: true, showSearch: true,
nextFlag: false, nextFlag: false,
theCurrentTime: false theCurrentTime: false,
showReset: true
}) })
// 动态计算table高度 // 动态计算table高度
const resizeObserver = new ResizeObserver(entries => { const resizeObserver = new ResizeObserver(entries => {