07a3f34f
赵凤
审批配置-》预设条件
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import React, { useState } from "react";
import {
Popconfirm,
Select,
Modal,
Form,
message,
Button,
Card,
Table,
Space,
} from "antd";
import _ from "lodash";
import { systemListApi } from "@/pages/admin/Privilege/api";
import usePagination from "@/hooks/usePagination";
import { getAllRoleCodeApi } from "@/common/api";
import useInitial from "@/hooks/useInitail";
import { common } from "@/typing/common";
import CreateItem from "./components/CreateItem";
import DescriptionList from "@/components/DescriptionList";
import { PageHeaderWrapper } from "@ant-design/pro-layout";
import { approvalConditionList, deleteApprovalCondition } from "./api";
import { Condition_Type_Enum, Judge_Rule_Enum } from "./entity";
|
76acc80f
赵凤
保留返回上页记录
|
24
|
import { history } from "umi";
|
07a3f34f
赵凤
审批配置-》预设条件
|
25
26
27
28
29
30
31
32
33
34
35
36
|
const { Option } = Select;
const { Description } = DescriptionList;
const { Column } = Table;
const layout = {
labelCol: { span: 4 },
wrapperCol: { span: 20 },
};
interface Props extends common.ConnectProps {}
export default function PreSetting({ match }: Props) {
|
76acc80f
赵凤
保留返回上页记录
|
37
|
const { approvalNo, approvalConfigId } = match.params;
|
07a3f34f
赵凤
审批配置-》预设条件
|
38
39
40
41
42
43
44
45
46
47
48
|
//编辑,新增条件设置
const [item, setItem] = useState<PreSetting.Item>({
visible: false,
id: undefined,
});
const { data, loading, setLoading } = useInitial(
approvalConditionList,
[],
approvalConfigId
);
|
07a3f34f
赵凤
审批配置-》预设条件
|
49
50
51
52
53
54
55
56
57
58
59
60
61
|
const confirm = (id: number) => {
deleteApprovalCondition(id)
.then((res) => {
message.success("删除成功!");
setLoading(true);
})
.catch((err) => message.error(err.message));
};
return (
<PageHeaderWrapper title="预设条件">
<Card>
|
76acc80f
赵凤
保留返回上页记录
|
62
|
<DescriptionList size="large" title="审批配置" col={1}>
|
07a3f34f
赵凤
审批配置-》预设条件
|
63
64
65
|
<Description term="审批编号">{approvalNo || ""}</Description>
</DescriptionList>
<div style={{ height: 15 }} />
|
0fb75a0d
赵凤
删除多余代码
|
66
|
|
60c0e139
赵凤
审批
|
67
68
69
70
71
72
73
|
<div
style={{
marginBottom: 20,
display: "flex",
justifyContent: "flex-end",
}}
>
|
e2c1272a
赵凤
审批角色筛选
|
74
|
<Button type="primary" onClick={() => setItem({ visible: true })}>
|
07a3f34f
赵凤
审批配置-》预设条件
|
75
76
77
78
79
80
|
新增
</Button>
</div>
<Table
dataSource={data}
|
07a3f34f
赵凤
审批配置-》预设条件
|
81
|
rowKey={(record) => `id_${record.id}`}
|
07a3f34f
赵凤
审批配置-》预设条件
|
82
83
84
|
loading={loading}
scroll={{ x: 500, y: 350 }}
>
|
e2c1272a
赵凤
审批角色筛选
|
85
86
87
88
89
90
91
92
93
94
95
96
|
<Column
width="20%"
title="条件名称"
dataIndex="name"
align="center"
/>
<Column
width="20%"
title="参数名称"
dataIndex="paramName"
align="center"
/>
|
60c0e139
赵凤
审批
|
97
98
99
100
|
<Column
width="10%"
title="单位"
dataIndex="unit"
|
e2c1272a
赵凤
审批角色筛选
|
101
|
align="center"
|
60c0e139
赵凤
审批
|
102
103
|
render={(text) => <span>{text || "--"}</span>}
/>
|
07a3f34f
赵凤
审批配置-》预设条件
|
104
105
106
107
|
<Column
width="20%"
title="条件类型"
dataIndex="type"
|
e2c1272a
赵凤
审批角色筛选
|
108
|
align="center"
|
07a3f34f
赵凤
审批配置-》预设条件
|
109
110
111
112
113
114
115
|
render={(text) => (
<span>{text ? Condition_Type_Enum[text] : "--"}</span>
)}
/>
<Column
width="20%"
title="判断规则"
|
e2c1272a
赵凤
审批角色筛选
|
116
|
align="center"
|
07a3f34f
赵凤
审批配置-》预设条件
|
117
118
119
120
121
122
123
124
|
dataIndex="judgeRule"
render={(text) => (
<span>{text ? Judge_Rule_Enum[text] : "--"}</span>
)}
/>
<Column
width="10%"
title="操作"
|
e2c1272a
赵凤
审批角色筛选
|
125
|
align="center"
|
07a3f34f
赵凤
审批配置-》预设条件
|
126
127
128
|
render={(text, record: PreSetting.ConditionListItems) => (
<Space>
<Button
|
60c0e139
赵凤
审批
|
129
|
type="link"
|
07a3f34f
赵凤
审批配置-》预设条件
|
130
131
132
133
134
135
136
137
138
139
140
141
142
|
size="small"
onClick={() => {
setItem({
visible: true,
id: record.id,
currentItem: record,
});
}}
>
编辑
</Button>
<Popconfirm
title="确定删除?"
|
60c0e139
赵凤
审批
|
143
|
onConfirm={() => record.id && confirm(record.id)}
|
07a3f34f
赵凤
审批配置-》预设条件
|
144
145
146
|
okText="确定"
cancelText="取消"
>
|
e2c1272a
赵凤
审批角色筛选
|
147
|
<Button type="link" danger size="small">
|
07a3f34f
赵凤
审批配置-》预设条件
|
148
149
150
151
152
153
154
|
删除
</Button>
</Popconfirm>
</Space>
)}
/>
</Table>
|
76acc80f
赵凤
保留返回上页记录
|
155
156
157
158
159
160
161
162
163
164
165
166
|
<div style={{ display: "flex", justifyContent: "center" }}>
<Button
type="primary"
style={{ width: 200, height: 40 }}
loading={loading}
onClick={() => {
history.goBack();
}}
>
返回
</Button>
</div>
|
07a3f34f
赵凤
审批配置-》预设条件
|
167
168
|
</Card>
<CreateItem
|
07a3f34f
赵凤
审批配置-》预设条件
|
169
170
171
172
173
174
175
176
|
item={item}
setItem={setItem}
approvalConfigId={approvalConfigId}
setListLoading={setLoading}
/>
</PageHeaderWrapper>
);
}
|