Commit fa3919f2 authored by TZW's avatar TZW

1

parent e2f87c34
...@@ -103,7 +103,7 @@ function Edgestore(props) { ...@@ -103,7 +103,7 @@ function Edgestore(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle=" 线边库存" pagetitle={<h3 className="page-title">线边库存</h3>}
columns={columns} columns={columns}
actionRef={actionRef} actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......
...@@ -122,7 +122,7 @@ function Instore(props) { ...@@ -122,7 +122,7 @@ function Instore(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="入库管理" pagetitle={<h3 className="page-title">入库管理</h3>}
columns={columns} columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef} actionRef={actionRef}
......
...@@ -128,7 +128,7 @@ function Outstore(props) { ...@@ -128,7 +128,7 @@ function Outstore(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="出库管理" pagetitle={<h3 className="page-title">出库管理</h3>}
columns={columns} columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef} actionRef={actionRef}
......
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro'; import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { useRequest } from 'ahooks'; import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
function Personalstore(props) { function Personalstore(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
open: false, open: false,
}); });
const pathconfig = useMemo(() => { const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {}; let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf; return pathconf;
}, []); }, []);
const { run, loading } = useRequest(doFetch, { const { run, loading } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, params) => { onSuccess: (res, params) => {
if (res?.code == '0000') { if (res?.code == '0000') {
actionRef?.current?.reload(); actionRef?.current?.reload();
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: false, open: false,
})); }));
} }
}, },
}); });
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
size: 'small', size: 'small',
type: 'link', type: 'link',
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: true, open: true,
item: row, item: row,
title: '详情', title: '详情',
val: 'detail', val: 'detail',
title: '详细信息', title: '详细信息',
})); }));
}, },
}} }}
> >
详情 详情
</PremButton> </PremButton>
); );
}; };
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const edit = (text, row, _, action) => { const columns = useMemo(() => {
return ( let defcolumn = getcolumns(setdrawer)?.columns;
<PremButton return defcolumn.concat({
btn={{ title: '操作',
size: 'small', valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enabledetail && detail(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle={<h3 className="page-title">个人库存</h3>}
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: true, open: true,
item: row, item: null,
title: '编辑', title: '新增',
val: 'edit', val: 'add',
})); }));
}, },
}} },
> }}
编辑 />
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const columns = useMemo(() => { <DrawerPro
let defcolumn = getcolumns(setdrawer)?.columns; fields={columns}
return defcolumn.concat({ params={{ id: drawer?.item?.id }}
title: '操作', formRef={formRef}
valueType: 'option', placement="right"
width: 150, detailpath={pathconfig?.detail || null}
render: (text, row, _, action) => [ detailData={drawer?.item}
pathconfig?.enabledetail && detail(text, row, _, action), defaultFormValue={drawer?.item}
pathconfig?.enableedit && edit(text, row, _, action), onClose={() => {
pathconfig?.enabledelete && remove(text, row, _, action), setdrawer((s) => ({
], ...s,
}); open: false,
}, []); }));
}}
return ( {...drawer}
<div style={{ position: 'relative' }}> onFinish={(vals) => {
<AutoTable if (drawer?.val == 'add') {
pagetitle="个人库存" run({ url: pathconfig?.add || '/add', params: { ...vals } });
columns={columns} } else if (drawer?.val == 'edit') {
actionRef={actionRef} run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} }
pageextra={pathconfig?.enableadd ? 'add' : null} }}
resizeable={true} />
addconfig={{ </div>
// access: 'sysDepartment_save', );
btn: { }
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
}));
},
},
}}
/>
<DrawerPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
onClose={() => {
setdrawer((s) => ({
...s,
open: false,
}));
}}
{...drawer}
onFinish={(vals) => {
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
</div>
);
}
export default Personalstore; export default Personalstore;
\ No newline at end of file
...@@ -103,7 +103,7 @@ function Record(props) { ...@@ -103,7 +103,7 @@ function Record(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="出入库记录" pagetitle={<h3 className="page-title">出入库记录</h3>}
columns={columns} columns={columns}
actionRef={actionRef} actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......
...@@ -154,7 +154,7 @@ function Requisition(props) { ...@@ -154,7 +154,7 @@ function Requisition(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="备件领用" pagetitle={<h3 className="page-title">备件领用</h3>}
columns={columns} columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef} actionRef={actionRef}
......
...@@ -116,7 +116,7 @@ function Setting(props) { ...@@ -116,7 +116,7 @@ function Setting(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle=" 备件设置" pagetitle={<h3 className="page-title">备件设置</h3>}
columns={columns} columns={columns}
actionRef={actionRef} actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......
...@@ -154,7 +154,7 @@ function Spareback(props) { ...@@ -154,7 +154,7 @@ function Spareback(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="备件回冲" pagetitle={<h3 className="page-title">备件回冲</h3>}
columns={columns} columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef} actionRef={actionRef}
......
...@@ -41,7 +41,7 @@ function Stock(props) { ...@@ -41,7 +41,7 @@ function Stock(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="备件库存" pagetitle={<h3 className="page-title">备件库存</h3>}
columns={columns} columns={columns}
actionRef={actionRef} actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......
...@@ -140,7 +140,7 @@ function Supplier(props) { ...@@ -140,7 +140,7 @@ function Supplier(props) {
return ( return (
<div style={{ position: 'relative' }}> <div style={{ position: 'relative' }}>
<AutoTable <AutoTable
pagetitle="备件供应商" pagetitle={<h3 className="page-title">备件供应商</h3>}
columns={columns} columns={columns}
actionRef={actionRef} actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
......
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