mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
修改添加任务视图筛选条件交互
This commit is contained in:
parent
bb2e8cb287
commit
7acf1eace3
|
@ -23,6 +23,12 @@ const PROPERTIES = [
|
||||||
// { name: '标签', value: 'labels' },
|
// { name: '标签', value: 'labels' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const EOperation: any = {
|
||||||
|
Reg: '',
|
||||||
|
NotReg: '',
|
||||||
|
In: 'select',
|
||||||
|
Nin: 'select',
|
||||||
|
};
|
||||||
const OPERATIONS = [
|
const OPERATIONS = [
|
||||||
{ name: '包含', value: 'Reg' },
|
{ name: '包含', value: 'Reg' },
|
||||||
{ name: '不包含', value: 'NotReg' },
|
{ name: '不包含', value: 'NotReg' },
|
||||||
|
@ -131,7 +137,7 @@ const ViewCreateModal = ({
|
||||||
|
|
||||||
const statusElement = (property: keyof typeof STATUS_MAP) => {
|
const statusElement = (property: keyof typeof STATUS_MAP) => {
|
||||||
return (
|
return (
|
||||||
<Select mode="tags" allowClear placeholder="回车输入自定义选项">
|
<Select mode="tags" allowClear placeholder="输入后回车增加自定义选项">
|
||||||
{STATUS_MAP[property]?.map((x) => (
|
{STATUS_MAP[property]?.map((x) => (
|
||||||
<Select.Option key={x.name} value={x.value}>
|
<Select.Option key={x.name} value={x.value}>
|
||||||
{x.name}
|
{x.name}
|
||||||
|
@ -247,10 +253,22 @@ const ViewCreateModal = ({
|
||||||
<Form.Item
|
<Form.Item
|
||||||
noStyle
|
noStyle
|
||||||
shouldUpdate={(prevValues, nextValues) => {
|
shouldUpdate={(prevValues, nextValues) => {
|
||||||
return (
|
const preOperation =
|
||||||
get(prevValues, ['filters', name, 'operation']) !==
|
EOperation[
|
||||||
get(nextValues, ['filters', name, 'operation'])
|
get(prevValues, ['filters', name, 'operation'])
|
||||||
);
|
];
|
||||||
|
const nextOperation =
|
||||||
|
EOperation[
|
||||||
|
get(nextValues, ['filters', name, 'operation'])
|
||||||
|
];
|
||||||
|
const flag = preOperation !== nextOperation;
|
||||||
|
if (flag) {
|
||||||
|
form.setFieldValue(
|
||||||
|
['filters', name, 'value'],
|
||||||
|
nextOperation === 'select' ? [] : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{() => {
|
{() => {
|
||||||
|
@ -272,7 +290,7 @@ const ViewCreateModal = ({
|
||||||
{ required: true, message: '请输入内容' },
|
{ required: true, message: '请输入内容' },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{['In', 'Nin'].includes(operate) ? (
|
{EOperation[operate] === 'select' ? (
|
||||||
statusElement(property)
|
statusElement(property)
|
||||||
) : (
|
) : (
|
||||||
<Input placeholder="请输入内容" />
|
<Input placeholder="请输入内容" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user