1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { useEffect, useRef, useReducer } from "react";
import { Button, Popconfirm, Switch } from "antd";
import AutoTable from "@/components/AutoTable";
import getPrem from "@/utils/getPrem"; //权限判断fn
import { useRequest } from "umi";
import { doFetch } from "@/utils/doFetch";
const Specialset = (props) => {
let actionRef = useRef(),
ChildRef = null;
function reload() {
actionRef?.current?.reload();
ChildRef?.onRefresh();
}
const { run, loading } = useRequest(doFetch, {
manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => {
if (result.code == "0000") {
reload();
}
},
}),
columns = [
{
title: "类别",
dataIndex: "name",
key: "name",
},
{
title: "操作",
dataIndex: "option_dataindex",
key: "option_dataindex",
valueType: "option",
width: 120,
render: (text, row, _, action) => {
return (
<Popconfirm
title="是否开启或关闭?"
onConfirm={() => {
run({
url: "/ngic-base-business/bmSpecialSet/setUp",
params: { id: row.id, judge: row.judge == 1 ? 2 : 1 },
});
}}
onCancel={() => {}}
okText="确定"
cancelText="取消"
disabled={!getPrem("equipmentSupplier_updatestatus", "ifs")}
>
<Switch
checked={row.judge == 1 ? true : false}
checkedChildren="开启"
unCheckedChildren="关闭"
defaultChecked={false}
/>
</Popconfirm>
);
},
},
];
return (
<div>
<AutoTable
pagetitle={props.route.name} //页面标题
columns={columns}
path="/ngic-base-business/bmSpecialSet/queryList"
actionRef={actionRef}
onRef={(node) => (ChildRef = node)}
></AutoTable>
</div>
);
};
export default Specialset;