Commit 77adc3e3 authored by TZW's avatar TZW

Merge branch 'master' of http://47.100.234.193:9527/wuhao/ems3.3

parents 22ee879c fdf2eab8
......@@ -200,6 +200,12 @@ export default [
"path": "/spare/setting",
"icon": "",
"component": "./spare/setting"
},
{
"name": "备件领用",
"path": "/spare/requisition",
"icon": "",
"component": "./spare/requisition"
}
]
}
......
......@@ -13,7 +13,7 @@ export default {
dev: {
[defaultSetting.proxypath]: {
// 要代理的地址
target: 'http://192.168.40.64:28001', //jf哥
target: 'http://192.168.40.64:28000', //jf哥
// target: 'http://192.168.40.203:8000', //dj哥
changeOrigin: true,
},
......
......@@ -403,13 +403,17 @@ const Mtable = (props) => {
}
: {}
}
pagination={{
showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}}
pagination={
pagination
? {
showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}
: false
}
search={{
filterType: 'light', //轻量模式
}}
......
......@@ -26,12 +26,19 @@ function DrawerPro(props) {
destroyOnClose={true}
{...props}
>
{props.val == 'only' && props.children}
{props.val == 'only' ? null : props.val == 'detail' ? (
{props.val == 'only' ? (
props.children
) : props.val == 'detail' ? (
<DetailPro {...detailprops} />
) : props.val == 'detailaddon' ? (
<div>
<DetailPro {...detailprops} />
{props?.children}
</div>
) : (
<InitForm {...newProps} />
)}
{pushSettingFlag ? (
<a
id="pushSettingBtn"
......
......@@ -102,13 +102,14 @@ function InitForm(props) {
//console.log(changedValues, allValues);
},
val,
style = {},
} = props;
let proformRef = useRef();
proformRef = formRef ?? proformRef;
return (
<ProForm
style={{ overflow: 'hidden' }}
style={{ overflow: 'hidden', ...style }}
formRef={proformRef}
onFinish={onFinish}
formKey={formKey ?? parseInt(Math.random() * 1000000)}
......
function getcolumns(setdrawer) {
return {
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
},
return {
"columns": [
{
"title": "维修单号",
"dataIndex": "repairOrderNo",
"key": "repairOrderNo"
"title": "线边库名称",
"dataIndex": "stockName",
"key": "stockName"
},
{
"title": "设备编号",
"dataIndex": "equipmentNo",
"key": "equipmentNo"
"title": "备件料号",
"dataIndex": "sparePartNo",
"key": "sparePartNo"
},
{
"title": "设备名称",
"dataIndex": "equipmentName",
"key": "equipmentName"
"title": "备件名称",
"dataIndex": "sparePartName",
"key": "sparePartName"
},
{
"title": "故障描述",
"dataIndex": "faultDescription",
"key": "faultDescription"
"title": "供应商编号",
"dataIndex": "supplierNo",
"key": "supplierNo"
},
{
"title": "报修人员",
"dataIndex": "repairUserName",
"key": "repairUserName"
"title": "供应商名称",
"dataIndex": "supplierName",
"key": "supplierName"
},
{
"title": "报修时间",
"dataIndex": "repairTime",
"key": "repairTimeList",
"valueType": "dateTimeRange"
"title": "持有数量",
"dataIndex": "actualStock",
"key": "actualStock",
"hideInSearch": true
},
{
"title": "报修单号",
"dataIndex": "repairNo",
"key": "repairNo"
"title": "可用数量",
"dataIndex": "usedStock",
"key": "usedStock",
"hideInSearch": true
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
"title": "库存单位",
"dataIndex": "unit",
"key": "unit",
"hideInSearch": true
}
]
],
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/sparepart/lineStock/queryList",
"delete": "",
"detail": ""
}
};
}
export default getcolumns;
\ No newline at end of file
}
export default getcolumns;
\ No newline at end of file
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
function Edgestore(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
function Edgestore(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const detail = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
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 columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer)?.columns;
return defcolumn;
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle=" 线边库存"
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
item: null,
title: '新增',
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(() => {
let defcolumn = getcolumns(setdrawer)?.columns;
return defcolumn.concat({
title: '操作',
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=" 线边库存"
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: () => {
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>
);
}
<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 Edgestore;
\ No newline at end of file
export default Edgestore;
import AutoTable from '@/components/AutoTable/mtable';
function ExtraTable({ dataSource }) {
return (
<div style={{ padding: '4px 4px 4px 36px' }}>
<AutoTable
dataSource={dataSource}
pagination={false}
resizeable={false}
columns={[
{ title: '供应商编号', dataIndex: 'supplierNo', key: 'supplierNo', width: 200 },
{ title: '供应商名称', dataIndex: 'supplierName', key: 'supplierName', width: 200 },
{
title: '库存数量',
dataIndex: 'actualStock',
key: 'actualStock',
hideInSearch: true,
width: 200,
},
{ title: '下架数量', dataIndex: 'operateNum', key: 'operateNum', hideInSearch: true },
]}
/>
</div>
);
}
function getcolumns(setdrawer) {
const columns = [
{
......@@ -7,12 +31,14 @@ function getcolumns(setdrawer) {
dataIndex: 'sparePartNo',
key: 'sparePartNo',
editable: false,
width: 235,
},
{
title: '备件名称',
dataIndex: 'sparePartName',
key: 'sparePartName',
editable: false,
width: 200,
},
{
title: '可用库存',
......@@ -20,6 +46,7 @@ function getcolumns(setdrawer) {
key: 'usedStock',
editable: false,
hideInSearch: true,
width: 200,
},
{
title: '出库数量',
......@@ -30,6 +57,7 @@ function getcolumns(setdrawer) {
fieldProps: {
precision: 3,
},
width: 200,
},
{
title: '库存单位',
......@@ -167,6 +195,7 @@ function getcolumns(setdrawer) {
path: '/sparepart/spareStock/queryByOperate',
hideInSearch: true,
hideInTable: true,
rowName: 'sparePartName',
render: (text, row) => {
return (
<AutoTable
......@@ -175,6 +204,12 @@ function getcolumns(setdrawer) {
hideInSearch: true,
}))}
dataSource={row?.taskSpareList}
resizeable={false}
expandable={{
expandedRowRender: (record) => (
<ExtraTable dataSource={record?.taskSpareSupplierList ?? []} />
),
}}
/>
);
},
......@@ -330,6 +365,7 @@ function getcolumns(setdrawer) {
path: '/sparepart/spareStock/queryByOperate',
hideInSearch: true,
hideInTable: true,
rowName: 'sparePartName',
render: (text, row) => {
return (
<AutoTable
......@@ -337,7 +373,13 @@ function getcolumns(setdrawer) {
...it,
hideInSearch: true,
}))}
resizeable={false}
dataSource={row?.taskSpareList}
expandable={{
expandedRowRender: (record) => (
<ExtraTable dataSource={record?.taskSpareSupplierList ?? []} />
),
}}
/>
);
},
......
This diff is collapsed.
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
import InitForm from '@/components/InitForm';
import { message, Divider } from 'antd';
function Requisition(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
}),
[activeTabKey, setactiveTabKey] = useState('1');
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
message.success('操作成功');
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
disabled: row.status == 2,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '审批',
val: 'detailaddon',
addon: (
<>
<InitForm
style={{ background: '#f0f0f0', padding: 12, borderTop: '#1890ff solid 1px' }}
fields={[
{
title: '审批结果',
dataIndex: 'approvalResult',
key: 'approvalResult',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'radio',
options: [
{ label: '通过', value: '1' },
{ label: '不通过', value: '2' },
],
},
{
title: '审批备注',
dataIndex: 'approvalRemark',
key: 'approvalRemark',
valueType: 'textarea',
colProps: { span: 24 },
},
]}
onFinish={(vals) => {
run({
url: '/sparepart/spareApplyTask/approval',
params: { ...vals, id: row?.id },
});
}}
/>
</>
),
}));
},
}}
>
审批
</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(() => {
let defcolumn = getcolumns(drawer?.type).filter((it) => it.key == activeTabKey)[0]?.columns;
let defpath =
getcolumns(drawer?.type).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
defpath?.enabledetail && detail(text, row, _, action),
defpath?.enableedit && edit(text, row, _, action),
defpath?.enabledelete && remove(text, row, _, action),
],
});
}, [activeTabKey, drawer?.type]);
const pathconfig = useMemo(() => {
let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
return defpath;
}, [activeTabKey]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="备件领用"
columns={columns}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
actionRef={actionRef}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: async () => {
let res = await doFetch({
url: '/base/pmBaseBusinessData/querySpareStockType',
params: {},
});
let type = res?.data?.data?.type;
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
type,
}));
},
},
}}
tabList={getcolumns()}
activeTabKey={activeTabKey}
onTabChange={(key) => {
setactiveTabKey(key);
}}
/>
<DrawerPro
fields={columns}
detailpath={pathconfig?.detail || null}
defaultFormValue={drawer?.item}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
onClose={() => {
setdrawer((s) => ({
...s,
open: false,
}));
}}
{...drawer}
onFinish={(vals) => {
const detailsList = vals?.detailsList?.map?.((it, i) => {
return {
spareStockId: it?.id,
operateNum: it?.operateNum,
};
});
if (drawer?.val == 'add') {
run({ url: pathconfig?.add || '/add', params: { ...vals, detailsList } });
} else if (drawer?.val == 'edit') {
run({
url: pathconfig?.edit || '/edit',
params: { ...vals, id: drawer?.item?.id, detailsList },
});
}
}}
>
{drawer?.addon}
</DrawerPro>
</div>
);
}
export default Requisition;
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