Commit e3624a853a132ef78a2c4edd12309971bead6802
1 parent
5de8245d
调整代表异常干预
Showing
11 changed files
with
72 additions
and
44 deletions
src/pages/backlog/Intervention/api.ts
... | ... | @@ -2,6 +2,7 @@ import request from "@/utils/request"; |
2 | 2 | import { BACKLOG } from "@/utils/host"; |
3 | 3 | import { http } from "@/typing/http"; |
4 | 4 | import { PaginationParam } from "@/typing/common"; |
5 | +import { NumberTypeEnum, SymbolDescEnum } from "@/pages/backlog/entity"; | |
5 | 6 | |
6 | 7 | export interface ListVO { |
7 | 8 | id: number; |
... | ... | @@ -59,6 +60,10 @@ export interface InterveneVO { |
59 | 60 | name: string; |
60 | 61 | valueDesc: string; |
61 | 62 | valueUnit: string; |
63 | + /** 数据类型 */ | |
64 | + numberType: NumberTypeEnum; | |
65 | + /** 运算符类型 */ | |
66 | + symbolType: SymbolDescEnum; | |
62 | 67 | } |
63 | 68 | |
64 | 69 | export function queryInterveneSettingList(params: { interveneId?: number }): http.PromiseRespA<InterveneVO> { | ... | ... |
src/pages/backlog/Intervention/components/EditModal.tsx
... | ... | @@ -66,7 +66,7 @@ export default ({ visible, onCancel, item, onRefresh }: Props) => { |
66 | 66 | |
67 | 67 | return ( |
68 | 68 | <Modal |
69 | - visible={visible} | |
69 | + open={visible} | |
70 | 70 | onCancel={onCancel} |
71 | 71 | onOk={form.submit} |
72 | 72 | title={item?.id ? "编辑异常干预" : "新增异常干预"} |
... | ... | @@ -107,6 +107,8 @@ export default ({ visible, onCancel, item, onRefresh }: Props) => { |
107 | 107 | saveLoading={!currentIntervene || saveLoading} |
108 | 108 | valueDesc={currentIntervene?.valueDesc} |
109 | 109 | valueUnit={currentIntervene?.valueUnit} |
110 | + numberType={currentIntervene?.numberType} | |
111 | + symbolType={currentIntervene?.symbolType} | |
110 | 112 | /> |
111 | 113 | </Form.Item> |
112 | 114 | </Form> | ... | ... |
src/pages/backlog/Intervention/components/SettingList.tsx
... | ... | @@ -5,6 +5,7 @@ import { PlusOutlined } from "@ant-design/icons"; |
5 | 5 | import useInitial from "@/hooks/useInitail"; |
6 | 6 | import * as roleApi from "@/pages/admin/Privilege/api"; |
7 | 7 | import orderBy from "lodash/orderBy"; |
8 | +import { NumberTypeEnum, SymbolDescEnum } from "@/pages/backlog/entity"; | |
8 | 9 | |
9 | 10 | interface Props { |
10 | 11 | onChange?: (value?: Item[]) => any; |
... | ... | @@ -12,17 +13,17 @@ interface Props { |
12 | 13 | saveLoading?: boolean; |
13 | 14 | valueDesc?: string; |
14 | 15 | valueUnit?: string; |
16 | + numberType?: number; | |
17 | + symbolType?: number; | |
15 | 18 | disabled?: boolean; |
16 | 19 | } |
17 | 20 | |
18 | -function Index({ value = [], onChange, saveLoading, valueUnit, valueDesc, disabled }: Props) { | |
21 | +function Index({ value = [], onChange, saveLoading, valueUnit, valueDesc, numberType, symbolType, disabled }: Props) { | |
19 | 22 | const { data: roleList } = useInitial<roleApi.Item[], any>(roleApi.getAllRoleListApi, [], { roleTypes: 2 }, disabled); |
20 | 23 | const [form] = Form.useForm(); |
21 | 24 | const [visible, setVisible] = useState(false); |
22 | 25 | |
23 | - useEffect(() => { | |
24 | - | |
25 | - }, []); | |
26 | + useEffect(() => {}, []); | |
26 | 27 | |
27 | 28 | const onRemove = (index: number) => { |
28 | 29 | value.splice(index, 1); |
... | ... | @@ -74,7 +75,7 @@ function Index({ value = [], onChange, saveLoading, valueUnit, valueDesc, disabl |
74 | 75 | title="干预条件" |
75 | 76 | dataIndex="threshold" |
76 | 77 | align="center" |
77 | - render={(text) => `${valueDesc || ""}≥${text}${valueUnit || ""}`} | |
78 | + render={(text) => `${valueDesc || ""}${SymbolDescEnum[symbolType || SymbolDescEnum["≥"]]}${text}${valueUnit || ""}`} | |
78 | 79 | /> |
79 | 80 | <Table.Column title="干预角色" dataIndex="roleName" align="center" /> |
80 | 81 | {!disabled ? ( |
... | ... | @@ -94,13 +95,19 @@ function Index({ value = [], onChange, saveLoading, valueUnit, valueDesc, disabl |
94 | 95 | /> |
95 | 96 | ) : null} |
96 | 97 | </Table> |
97 | - <Modal visible={visible} onCancel={closeModal} onOk={form.submit} title="干预设置"> | |
98 | + <Modal open={visible} onCancel={closeModal} onOk={form.submit} title="干预设置"> | |
98 | 99 | <Form form={form} onFinish={handleSave} wrapperCol={{ span: 18 }} labelCol={{ span: 6 }}> |
99 | 100 | <Form.Item hidden name="index" label="index" rules={[{ required: false }]}> |
100 | 101 | <Input /> |
101 | 102 | </Form.Item> |
102 | 103 | <Form.Item name="threshold" label="干预条件" rules={[{ required: true, message: "干预条件不能为空" }]}> |
103 | - <InputNumber min={0} addonBefore={`${valueDesc || ""}≥`} addonAfter={valueUnit || ""} precision={0} /> | |
104 | + <InputNumber | |
105 | + min={0} | |
106 | + placeholder={NumberTypeEnum["小数"] == numberType ? "0.00" : "0"} | |
107 | + addonBefore={`${valueDesc || ""}${SymbolDescEnum[symbolType || SymbolDescEnum["≥"]]}`} | |
108 | + addonAfter={valueUnit || ""} | |
109 | + precision={NumberTypeEnum["小数"] == numberType ? 2 : 0} | |
110 | + /> | |
104 | 111 | </Form.Item> |
105 | 112 | <Form.Item name="role" label="干预角色" rules={[{ required: true, message: "干预角色不能为空" }]}> |
106 | 113 | <Select | ... | ... |
src/pages/backlog/Intervention/components/SettingModal.tsx
... | ... | @@ -36,21 +36,9 @@ export default ({ visible, onCancel, item }: Props) => { |
36 | 36 | const interveneVO = useMemo(() => interList.find((t) => t.code == item?.code), [interList]); |
37 | 37 | |
38 | 38 | return ( |
39 | - <Modal | |
40 | - visible={visible} | |
41 | - onCancel={onCancel} | |
42 | - cancelButtonProps={{ hidden: true }} | |
43 | - onOk={onCancel} | |
44 | - title="待办超时干预条件" | |
45 | - width="55%" | |
46 | - > | |
39 | + <Modal open={visible} onCancel={onCancel} cancelButtonProps={{ hidden: true }} onOk={onCancel} title="待办超时干预条件" width="55%"> | |
47 | 40 | <Skeleton active loading={loading || interLoading}> |
48 | - <SettingList | |
49 | - disabled | |
50 | - value={data || []} | |
51 | - valueDesc={interveneVO?.valueDesc} | |
52 | - valueUnit={interveneVO?.valueUnit} | |
53 | - /> | |
41 | + <SettingList disabled value={data || []} valueDesc={interveneVO?.valueDesc} valueUnit={interveneVO?.valueUnit} /> | |
54 | 42 | </Skeleton> |
55 | 43 | </Modal> |
56 | 44 | ); | ... | ... |
src/pages/backlog/InterventionSetting/api.ts
... | ... | @@ -2,6 +2,7 @@ import request from "@/utils/request"; |
2 | 2 | import { BACKLOG } from "@/utils/host"; |
3 | 3 | import { http } from "@/typing/http"; |
4 | 4 | import { PaginationParam } from "@/typing/common"; |
5 | +import { NumberTypeEnum, SymbolDescEnum } from "@/pages/backlog/entity"; | |
5 | 6 | |
6 | 7 | export interface Params extends PaginationParam { |
7 | 8 | sysId?: number; |
... | ... | @@ -31,6 +32,10 @@ export interface ListVO { |
31 | 32 | valueDesc: string; |
32 | 33 | /** 干预阀值单位 */ |
33 | 34 | valueUnit: string; |
35 | + /** 数据类型 */ | |
36 | + numberType: NumberTypeEnum; | |
37 | + /** 运算符类型 */ | |
38 | + symbolType: SymbolDescEnum; | |
34 | 39 | } |
35 | 40 | |
36 | 41 | export function querySettingList(params: Params): http.PromisePageResp<ListVO> { | ... | ... |
src/pages/backlog/InterventionSetting/components/CreateModal.tsx
1 | 1 | import React, { useEffect, useState } from "react"; |
2 | -import { Modal, Form, Select, message, Input } from "antd"; | |
2 | +import { Modal, Form, Select, message, Input, Radio } from "antd"; | |
3 | 3 | import { save, ListVO, queryBacklogList, BacklogItemVO } from "../api"; |
4 | 4 | import useInitial from "@/hooks/useInitail"; |
5 | 5 | import { systemListApi } from "@/pages/admin/Privilege/api"; |
6 | 6 | import usePagination from "@/hooks/usePagination"; |
7 | +import { NumberTypeEnum, SymbolDescEnum } from "@/pages/backlog/entity"; | |
7 | 8 | |
8 | 9 | interface Props { |
9 | 10 | visible: boolean; |
... | ... | @@ -24,6 +25,8 @@ export default ({ visible, onCancel, item, onRefresh }: Props) => { |
24 | 25 | name: item.name, |
25 | 26 | configId: { value: item.configId, label: item.itemName }, |
26 | 27 | applySysId: { value: item.applySysId, label: item.applySysName }, |
28 | + numberType: item.numberType, | |
29 | + symbolType: item.symbolType, | |
27 | 30 | valueDesc: item.valueDesc, |
28 | 31 | valueUnit: item.valueUnit, |
29 | 32 | }); |
... | ... | @@ -97,6 +100,24 @@ export default ({ visible, onCancel, item, onRefresh }: Props) => { |
97 | 100 | ))} |
98 | 101 | </Select> |
99 | 102 | </Form.Item> |
103 | + <Form.Item initialValue={1} name="numberType" label="数据类型" rules={[{ required: true, message: "数据类型不能为空" }]}> | |
104 | + <Radio.Group> | |
105 | + {[1, 2].map((t) => ( | |
106 | + <Radio key={`nt-${t}`} value={t}> | |
107 | + {NumberTypeEnum[t]} | |
108 | + </Radio> | |
109 | + ))} | |
110 | + </Radio.Group> | |
111 | + </Form.Item> | |
112 | + <Form.Item initialValue={1} name="symbolType" label="运算符类型" rules={[{ required: true, message: "运算符类型不能为空" }]}> | |
113 | + <Radio.Group> | |
114 | + {[1, 2].map((t) => ( | |
115 | + <Radio key={`st-${t}`} value={t}> | |
116 | + {SymbolDescEnum[t]} | |
117 | + </Radio> | |
118 | + ))} | |
119 | + </Radio.Group> | |
120 | + </Form.Item> | |
100 | 121 | <Form.Item name="valueDesc" label="干预阀值描述" rules={[{ required: true, message: "干预阀值描述不能为空" }]}> |
101 | 122 | <Input placeholder="请输入干预阀值描述" /> |
102 | 123 | </Form.Item> | ... | ... |
src/pages/backlog/InterventionSetting/index.tsx
... | ... | @@ -7,6 +7,7 @@ import debounce from "lodash/debounce"; |
7 | 7 | import usePagination from "@/hooks/usePagination"; |
8 | 8 | import { systemListApi } from "@/pages/admin/Privilege/api"; |
9 | 9 | import CreateModal from "./components/CreateModal"; |
10 | +import { NumberTypeEnum, SymbolDescEnum } from "@/pages/backlog/entity"; | |
10 | 11 | |
11 | 12 | const Column = Table.Column; |
12 | 13 | const Search = Input.Search; |
... | ... | @@ -63,12 +64,7 @@ export default () => { |
63 | 64 | style={{ maxWidth: 260, marginRight: 15 }} |
64 | 65 | /> |
65 | 66 | |
66 | - <Select | |
67 | - allowClear | |
68 | - placeholder="归属系统" | |
69 | - style={{ width: 260, marginRight: 5 }} | |
70 | - onChange={(e: any) => _onChangeSys(e)} | |
71 | - > | |
67 | + <Select allowClear placeholder="归属系统" style={{ width: 260, marginRight: 5 }} onChange={(e: any) => _onChangeSys(e)}> | |
72 | 68 | {syslist.map((item) => ( |
73 | 69 | <Select.Option value={item.id!} key={item.id}> |
74 | 70 | {item.sysName} |
... | ... | @@ -100,6 +96,13 @@ export default () => { |
100 | 96 | <Badge status={record.status == 0 ? "error" : "processing"} text={StatusEnum[record.status]} /> |
101 | 97 | )} |
102 | 98 | /> |
99 | + <Column title="数据类型" dataIndex="numberType" align="center" render={(text: number, record: ListVO) => NumberTypeEnum[text]} /> | |
100 | + <Column | |
101 | + title="运算符类型" | |
102 | + dataIndex="symbolType" | |
103 | + align="center" | |
104 | + render={(text: number, record: ListVO) => SymbolDescEnum[text]} | |
105 | + /> | |
103 | 106 | <Column title="干预阀值描述" dataIndex="valueDesc" align="center" /> |
104 | 107 | <Column title="干预阀值单位" dataIndex="valueUnit" align="center" /> |
105 | 108 | |
... | ... | @@ -117,11 +120,7 @@ export default () => { |
117 | 120 | > |
118 | 121 | 编辑 |
119 | 122 | </Button> |
120 | - <Popconfirm | |
121 | - placement="top" | |
122 | - title={`确认${row.status == 0 ? "启用" : "禁用"}?`} | |
123 | - onConfirm={() => switchDisable(row)} | |
124 | - > | |
123 | + <Popconfirm placement="top" title={`确认${row.status == 0 ? "启用" : "禁用"}?`} onConfirm={() => switchDisable(row)}> | |
125 | 124 | <Button danger={row.status == 1} type="link"> |
126 | 125 | {row.status == 0 ? "启用" : "禁用"} |
127 | 126 | </Button> | ... | ... |
src/pages/backlog/OverIntervention/components/EditModal.tsx
src/pages/backlog/OverIntervention/components/SettingList.tsx
... | ... | @@ -83,7 +83,7 @@ export default ({ value = [], onChange, saveLoading, disabled }: Props) => { |
83 | 83 | /> |
84 | 84 | ) : null} |
85 | 85 | </Table> |
86 | - <Modal visible={visible} onCancel={closeModal} onOk={form.submit} title="干预设置"> | |
86 | + <Modal open={visible} onCancel={closeModal} onOk={form.submit} title="干预设置"> | |
87 | 87 | <Form form={form} onFinish={handleSave} wrapperCol={{ span: 18 }} labelCol={{ span: 6 }}> |
88 | 88 | <Form.Item hidden name="index" label="index" rules={[{ required: false }]}> |
89 | 89 | <Input /> | ... | ... |
src/pages/backlog/OverIntervention/components/SettingModal.tsx
... | ... | @@ -23,14 +23,7 @@ export default ({ visible, onCancel, id }: Props) => { |
23 | 23 | }, [visible]); |
24 | 24 | |
25 | 25 | return ( |
26 | - <Modal | |
27 | - visible={visible} | |
28 | - onCancel={onCancel} | |
29 | - cancelButtonProps={{ hidden: true }} | |
30 | - onOk={onCancel} | |
31 | - title="待办超时干预条件" | |
32 | - width="55%" | |
33 | - > | |
26 | + <Modal open={visible} onCancel={onCancel} cancelButtonProps={{ hidden: true }} onOk={onCancel} title="待办超时干预条件" width="55%"> | |
34 | 27 | <Skeleton active loading={loading}> |
35 | 28 | <SettingList disabled value={data || []} /> |
36 | 29 | </Skeleton> | ... | ... |