mirror of
https://github.com/whyour/qinglong.git
synced 2026-06-30 20:35:09 +08:00
修复定时任务视图排序
This commit is contained in:
@@ -2,7 +2,7 @@ import { sequelize } from '.';
|
||||
import { DataTypes, Model } from 'sequelize';
|
||||
|
||||
interface SortType {
|
||||
type: 'ASD' | 'DESC';
|
||||
type: 'ASC' | 'DESC';
|
||||
value: string;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ export class CrontabView {
|
||||
this.name = options.name;
|
||||
this.id = options.id;
|
||||
this.position = options.position;
|
||||
this.isDisabled = options.isDisabled;
|
||||
this.isDisabled = options.isDisabled || 0;
|
||||
this.filters = options.filters;
|
||||
this.sorts = options.sorts;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export default class CronService {
|
||||
}
|
||||
|
||||
private formatViewQuery(query: any, viewQuery: any) {
|
||||
if (viewQuery.filters) {
|
||||
if (viewQuery.filters && viewQuery.filters.length > 0) {
|
||||
for (const col of viewQuery.filters) {
|
||||
const { property, value, operation } = col;
|
||||
let operate = null;
|
||||
@@ -209,9 +209,9 @@ export default class CronService {
|
||||
}
|
||||
|
||||
private formatViewSort(order: string[][], viewQuery: any) {
|
||||
if (viewQuery.sorts) {
|
||||
for (const [col, sortType] of viewQuery.sorts) {
|
||||
order.unshift([col, sortType]);
|
||||
if (viewQuery.sorts && viewQuery.sorts.length > 0) {
|
||||
for (const { property, type } of viewQuery.sorts) {
|
||||
order.unshift([property, type]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user