Skip to content

Commit

Permalink
获取栏目添加状态筛选,修复TablePro组件筛选项显示BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
yinMrsir committed Apr 25, 2023
1 parent b7574da commit 4d81561
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
6 changes: 6 additions & 0 deletions Nest-server/src/modules/column/column.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class ColumnService {
if (queryColumnDto.type) {
where.type = queryColumnDto.type;
}
if (queryColumnDto.status) {
where.status = queryColumnDto.status;
}
const [rows, total] = await this.columnsRepository.findAndCount({
where,
take: queryColumnDto.take,
Expand All @@ -38,6 +41,9 @@ export class ColumnService {
if (queryColumnDto.type) {
where.type = queryColumnDto.type;
}
if (queryColumnDto.status) {
where.status = queryColumnDto.status;
}
return this.columnsRepository.findBy(where);
}

Expand Down
3 changes: 3 additions & 0 deletions Nest-server/src/modules/column/dto/query-column.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ import { IsOptional } from 'class-validator';
export class QueryColumnDto extends PaginationDto {
@IsOptional()
type: string;

@IsOptional()
status: string;
}
2 changes: 1 addition & 1 deletion Nuxt-web/server/api/common/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import {useGet} from "~/composables/useHttp";
import {IResData} from "~/global";

export default defineEventHandler(async () => {
const { data } = await useGet<IResData<any>>('/column/all')
const { data } = await useGet<IResData<any>>('/column/all', { status: 0 })
return data
})
26 changes: 12 additions & 14 deletions Vue3-admin/src/components/TablePro/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
<el-form v-if="filterOptions.length > 0" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<template v-for="item in filterOptions">
<el-form-item :label="item.title" :prop="item.field">
<template v-for="item in filterOptions">
<template v-if="item.type === 'select' || item.type === 'radio'">
<el-select v-model="queryParams[item.field]" :placeholder="`请选择${item.title}`" clearable>
<el-option
v-for="item in item.options"
:key="+item.value"
:label="item.label"
:value="+item.value">
</el-option>
</el-select>
</template>
<template v-else>
<el-input v-model="queryParams[item.field]" :placeholder="`请输入${item.title}`" />
</template>
<template v-if="item.type === 'select' || item.type === 'radio'">
<el-select v-model="queryParams[item.field]" :placeholder="`请选择${item.title}`" clearable>
<el-option
v-for="item in item.options"
:key="+item.value"
:label="item.label"
:value="+item.value">
</el-option>
</el-select>
</template>
<template v-else>
<el-input v-model="queryParams[item.field]" :placeholder="`请输入${item.title}`" />
</template>
</el-form-item>
</template>
Expand Down
2 changes: 1 addition & 1 deletion Vue3-admin/src/views/column/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const columns = ref([
add: [{required: true, message: '请输入目录/路径'}]
},
{ title: '排序', field: 'order', type: 'number', add: true },
{ title: '状态', field: 'status', add: true, type: 'radio', options: sys_normal_disable },
{ title: '状态', field: 'status', add: true, type: 'radio', options: sys_normal_disable, search: true },
{ title: '备注', field: 'remark', add: true, formProps: { type: 'textarea' } },
{
actions: [
Expand Down

0 comments on commit 4d81561

Please sign in to comment.