Commit b824a20f authored by TZW's avatar TZW

switch

parent 4b5ff344
...@@ -2,7 +2,7 @@ import { doFetch } from '@/utils/doFetch'; ...@@ -2,7 +2,7 @@ import { doFetch } from '@/utils/doFetch';
import { Switch } from 'antd'; import { Switch } from 'antd';
import fieldsDetail from '@/utils/fieldsDetail'; import fieldsDetail from '@/utils/fieldsDetail';
function getcolumns(ifs) { function getcolumns(ifs, actionRef) {
return [ return [
{ {
title: '供应商编号', title: '供应商编号',
...@@ -130,7 +130,7 @@ function getcolumns(ifs) { ...@@ -130,7 +130,7 @@ function getcolumns(ifs) {
<Switch <Switch
checkedChildren="启用" checkedChildren="启用"
unCheckedChildren="禁用" unCheckedChildren="禁用"
defaultChecked={row.status == 1} checked={row?.status == 1}
disabled={row?.statusChangeable == 1 ? false : true} disabled={row?.statusChangeable == 1 ? false : true}
onChange={(flag) => { onChange={(flag) => {
// //console.log(e); // //console.log(e);
...@@ -138,11 +138,15 @@ function getcolumns(ifs) { ...@@ -138,11 +138,15 @@ function getcolumns(ifs) {
doFetch({ doFetch({
url: '/asset/equipmentSupplier/update/status', url: '/asset/equipmentSupplier/update/status',
params: { id: row.id, status: '1' }, params: { id: row.id, status: '1' },
}).then(() => {
actionRef.current.reload();
}); });
} else { } else {
doFetch({ doFetch({
url: '/asset/equipmentSupplier/update/status', url: '/asset/equipmentSupplier/update/status',
params: { id: row.id, status: '2' }, params: { id: row.id, status: '2' },
}).then(() => {
actionRef.current.reload();
}); });
} }
}} }}
......
...@@ -293,7 +293,7 @@ function Supplier(props) { ...@@ -293,7 +293,7 @@ function Supplier(props) {
); );
}; };
const columns = useMemo(() => { const columns = useMemo(() => {
let defcolumn = getcolumns(false); let defcolumn = getcolumns(false,actionRef);
defcolumn[1].render = (text, row) => { defcolumn[1].render = (text, row) => {
return ( return (
<a <a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment