mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 06:46:09 +08:00
修复定时任务视图排序
This commit is contained in:
parent
9a3181bc44
commit
e5d8adf955
|
@ -2,7 +2,7 @@ import { sequelize } from '.';
|
||||||
import { DataTypes, Model } from 'sequelize';
|
import { DataTypes, Model } from 'sequelize';
|
||||||
|
|
||||||
interface SortType {
|
interface SortType {
|
||||||
type: 'ASD' | 'DESC';
|
type: 'ASC' | 'DESC';
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ export class CrontabView {
|
||||||
this.name = options.name;
|
this.name = options.name;
|
||||||
this.id = options.id;
|
this.id = options.id;
|
||||||
this.position = options.position;
|
this.position = options.position;
|
||||||
this.isDisabled = options.isDisabled;
|
this.isDisabled = options.isDisabled || 0;
|
||||||
this.filters = options.filters;
|
this.filters = options.filters;
|
||||||
this.sorts = options.sorts;
|
this.sorts = options.sorts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ export default class CronService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatViewQuery(query: any, viewQuery: any) {
|
private formatViewQuery(query: any, viewQuery: any) {
|
||||||
if (viewQuery.filters) {
|
if (viewQuery.filters && viewQuery.filters.length > 0) {
|
||||||
for (const col of viewQuery.filters) {
|
for (const col of viewQuery.filters) {
|
||||||
const { property, value, operation } = col;
|
const { property, value, operation } = col;
|
||||||
let operate = null;
|
let operate = null;
|
||||||
|
@ -209,9 +209,9 @@ export default class CronService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatViewSort(order: string[][], viewQuery: any) {
|
private formatViewSort(order: string[][], viewQuery: any) {
|
||||||
if (viewQuery.sorts) {
|
if (viewQuery.sorts && viewQuery.sorts.length > 0) {
|
||||||
for (const [col, sortType] of viewQuery.sorts) {
|
for (const { property, type } of viewQuery.sorts) {
|
||||||
order.unshift([col, sortType]);
|
order.unshift([property, type]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,10 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
if (viewConf) {
|
if (viewConf) {
|
||||||
url += `&queryString=${JSON.stringify({ filters: viewConf.filters })}`;
|
url += `&queryString=${JSON.stringify({
|
||||||
|
filters: viewConf.filters,
|
||||||
|
sorts: viewConf.sorts,
|
||||||
|
})}`;
|
||||||
}
|
}
|
||||||
request
|
request
|
||||||
.get(url)
|
.get(url)
|
||||||
|
|
|
@ -76,10 +76,14 @@ const ViewCreateModal = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
form.setFieldsValue(view || {});
|
|
||||||
if (!view) {
|
if (!view) {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
}
|
}
|
||||||
|
form.setFieldsValue(
|
||||||
|
view || {
|
||||||
|
filters: [{ property: 'command', operation: 'Reg' }],
|
||||||
|
},
|
||||||
|
);
|
||||||
}, [view, visible]);
|
}, [view, visible]);
|
||||||
|
|
||||||
const operationElement = (
|
const operationElement = (
|
||||||
|
@ -164,7 +168,6 @@ const ViewCreateModal = ({
|
||||||
{fields.map(({ key, name, ...restField }, index) => (
|
{fields.map(({ key, name, ...restField }, index) => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={index === 0 ? '筛选条件' : ''}
|
label={index === 0 ? '筛选条件' : ''}
|
||||||
required={true}
|
|
||||||
key={key}
|
key={key}
|
||||||
style={{ marginBottom: 0 }}
|
style={{ marginBottom: 0 }}
|
||||||
>
|
>
|
||||||
|
@ -204,7 +207,6 @@ const ViewCreateModal = ({
|
||||||
))}
|
))}
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<a
|
<a
|
||||||
href="#"
|
|
||||||
onClick={() => add({ property: 'command', operation: 'Reg' })}
|
onClick={() => add({ property: 'command', operation: 'Reg' })}
|
||||||
>
|
>
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
|
@ -220,7 +222,6 @@ const ViewCreateModal = ({
|
||||||
{fields.map(({ key, name, ...restField }, index) => (
|
{fields.map(({ key, name, ...restField }, index) => (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label={index === 0 ? '排序方式' : ''}
|
label={index === 0 ? '排序方式' : ''}
|
||||||
required={true}
|
|
||||||
key={key}
|
key={key}
|
||||||
style={{ marginBottom: 0 }}
|
style={{ marginBottom: 0 }}
|
||||||
>
|
>
|
||||||
|
@ -246,10 +247,7 @@ const ViewCreateModal = ({
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
))}
|
))}
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<a
|
<a onClick={() => add({ property: 'command', type: 'ASC' })}>
|
||||||
href="#"
|
|
||||||
onClick={() => add({ property: 'command', operation: 'ASC' })}
|
|
||||||
>
|
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
新增排序方式
|
新增排序方式
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user