Commit c03fdab0 authored by wuhao's avatar wuhao 🎯

asder

parent f548e09d
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
dev: { dev: {
[defaultSetting.proxypath]: { [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哥 // target: 'http://192.168.40.203:8000', //dj哥
changeOrigin: true, changeOrigin: true,
}, },
......
...@@ -12,6 +12,8 @@ function isString(obj) { ...@@ -12,6 +12,8 @@ function isString(obj) {
} }
export default (props) => { export default (props) => {
let { childposition } = props;
childposition = childposition ?? 'left';
const actionbtn = { const actionbtn = {
add: <PremButton {...props?.addconfig}>新增</PremButton>, add: <PremButton {...props?.addconfig}>新增</PremButton>,
export: ( export: (
...@@ -58,14 +60,20 @@ export default (props) => { ...@@ -58,14 +60,20 @@ export default (props) => {
children: ( children: (
<> <>
<div style={{ display: 'flex', width: '100%' }}> <div style={{ display: 'flex', width: '100%' }}>
{(props.childposition == 'left' || !props.childposition) && props.children} {(childposition == 'left' || !childposition) && props.children}
<div style={{ flex: 1, overflow: 'hidden', paddingLeft: `${props.childposition == 'left' ? '15px' : '0'}` }}> <div
{props.childposition == 'top' && props.children} style={{
flex: 1,
overflow: 'hidden',
paddingLeft: `${childposition == 'left' && props.children ? '15px' : '0'}`,
}}
>
{childposition == 'top' && props.children}
<Mtable {...props} activeTabKey={null} /> <Mtable {...props} activeTabKey={null} />
</div> </div>
{(props.childposition == 'right' || !props.childposition) && props.children} {(childposition == 'right' || !childposition) && props.children}
</div> </div>
{props.childposition == 'bottom' && props.children} {childposition == 'bottom' && props.children}
</> </>
), ),
}; };
...@@ -77,14 +85,14 @@ export default (props) => { ...@@ -77,14 +85,14 @@ export default (props) => {
{props.withCard === false ? ( {props.withCard === false ? (
<> <>
<div style={{ display: 'flex', width: '100%' }}> <div style={{ display: 'flex', width: '100%' }}>
{(props.childposition == 'left' || !props.childposition) && props.children} {(childposition == 'left' || !childposition) && props.children}
<div style={{ flex: 1, width: '100%' }}> <div style={{ flex: 1, width: '100%' }}>
{props.childposition == 'top' && props.children} {childposition == 'top' && props.children}
<Mtable {...props} /> <Mtable {...props} />
</div> </div>
{(props.childposition == 'right' || !props.childposition) && props.children} {(childposition == 'right' || !childposition) && props.children}
</div> </div>
{props.childposition == 'bottom' && props.children} {childposition == 'bottom' && props.children}
</> </>
) : !props.nocardtab ? ( ) : !props.nocardtab ? (
<Card <Card
...@@ -97,24 +105,30 @@ export default (props) => { ...@@ -97,24 +105,30 @@ export default (props) => {
onTabChange={props.onTabChange} onTabChange={props.onTabChange}
> >
<div style={{ display: 'flex', width: '100%' }}> <div style={{ display: 'flex', width: '100%' }}>
{(props.childposition == 'left' || !props.childposition) && props.children} {(childposition == 'left' || !childposition) && props.children}
<div style={{ flex: 1, overflow: 'hidden', paddingLeft: `${props.childposition == 'left' ? '15px' : '0'}` }}> <div
{props.childposition == 'top' && props.children} style={{
flex: 1,
overflow: 'hidden',
paddingLeft: `${childposition == 'left' && props.children ? '15px' : '0'}`,
}}
>
{childposition == 'top' && props.children}
<Mtable {...props} /> <Mtable {...props} />
</div> </div>
{(props.childposition == 'right' || !props.childposition) && props.children} {(childposition == 'right' || !childposition) && props.children}
</div> </div>
{props.childposition == 'bottom' && props.children} {childposition == 'bottom' && props.children}
</Card> </Card>
) : ( ) : (
<div className="tabsTable"> <div className="tabsTable">
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '16px 20px 0' }}> <div style={{ display: 'flex', justifyContent: 'space-between', padding: '16px 20px 0' }}>
<div style={{ fontSize: 16, fontWeight: 500 }}>{props.pagetitle}</div> <div style={{ fontSize: 16, fontWeight: 500 }}>{props.pagetitle}</div>
<div className="center">{renderextra()}</div> <div className="center">{renderextra()}</div>
</div> </div>
<Tabs items={items} onChange={props.onTabChange} activeTabKey={props.activeTabKey} /> <Tabs items={items} onChange={props.onTabChange} activeTabKey={props.activeTabKey} />
</div> </div>
)} )}
</div> </div>
); );
}; };
...@@ -40,6 +40,7 @@ const Mtable = (props) => { ...@@ -40,6 +40,7 @@ const Mtable = (props) => {
refreshDep, //依赖刷新 (已废弃) refreshDep, //依赖刷新 (已废弃)
getDefaultSelected, //存在默认选中向上返回选中值 getDefaultSelected, //存在默认选中向上返回选中值
resizeable = true, resizeable = true,
dataSource,
} = props; } = props;
const actionRefs = actionRef ?? useRef(), const actionRefs = actionRef ?? useRef(),
...@@ -345,10 +346,14 @@ const Mtable = (props) => { ...@@ -345,10 +346,14 @@ const Mtable = (props) => {
}, },
} }
: {}; : {};
const datas = dataSource ? { dataSource, toolBarRender: false } : { request };
return ( return (
<ProTable <ProTable
{...props} {...props}
{...components} {...components}
{...datas}
size={size} size={size}
onSubmit={(params) => { onSubmit={(params) => {
////console.log(params, 'onSubmit'); ////console.log(params, 'onSubmit');
...@@ -379,7 +384,6 @@ const Mtable = (props) => { ...@@ -379,7 +384,6 @@ const Mtable = (props) => {
formRef={formRefs} formRef={formRefs}
rowKey={rowKey ?? 'id'} //表格每行数据的key rowKey={rowKey ?? 'id'} //表格每行数据的key
dateFormatter="string" dateFormatter="string"
request={request}
scroll={ scroll={
x x
? { ? {
...@@ -387,17 +391,13 @@ const Mtable = (props) => { ...@@ -387,17 +391,13 @@ const Mtable = (props) => {
} }
: {} : {}
} }
pagination={ pagination={{
ifspagination showTotal: (total, range) => <span>{total}</span>,
? false showQuickJumper: true,
: { showSizeChanger: true,
showTotal: (total, range) => <span>{total}</span>, pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
showQuickJumper: true, defaultPageSize: pageSize || 15,
showSizeChanger: true, }}
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15,
}
}
search={{ search={{
filterType: 'light', //轻量模式 filterType: 'light', //轻量模式
}} }}
......
...@@ -44,6 +44,13 @@ function DetailPro(props) { ...@@ -44,6 +44,13 @@ function DetailPro(props) {
} ?? {}, } ?? {},
}; };
} }
setcuritem({
...(res?.data?.data ?? {}),
});
return {
success: res?.code == '0000',
data: { ...(res?.data?.data ?? {}) },
};
}, },
}; };
} }
......
...@@ -19,6 +19,7 @@ const EditTable = (props) => { ...@@ -19,6 +19,7 @@ const EditTable = (props) => {
x, //横向滚动 x, //横向滚动
refreshDep, //依赖刷新 (已废弃) refreshDep, //依赖刷新 (已废弃)
getDefaultSelected, //存在默认选中向上返回选中值 getDefaultSelected, //存在默认选中向上返回选中值
dataSource,
} = props; } = props;
const actionRefs = actionRef ?? useRef(), const actionRefs = actionRef ?? useRef(),
...@@ -28,7 +29,12 @@ const EditTable = (props) => { ...@@ -28,7 +29,12 @@ const EditTable = (props) => {
//调用接口 //调用接口
const request = async (params, sort, filter) => { const request = async (params, sort, filter) => {
if (!path) return; if (!path)
return {
data: dataSource ?? [],
success: true,
total: dataSource?.length ?? 0,
};
let newparams = { let newparams = {
...params, ...params,
...extraparams, //父组件传参 ...extraparams, //父组件传参
......
...@@ -1510,7 +1510,7 @@ function TableSelect({ item, value, onChange, params = {} }) { ...@@ -1510,7 +1510,7 @@ function TableSelect({ item, value, onChange, params = {} }) {
} }
/> />
); );
console.log(value);
const Todo = ( const Todo = (
<EditTable <EditTable
actionRef={actionRef} actionRef={actionRef}
......
...@@ -126,20 +126,36 @@ function InitForm(props) { ...@@ -126,20 +126,36 @@ function InitForm(props) {
res?.data?.data[extendField]?.forEach?.((it) => { res?.data?.data[extendField]?.forEach?.((it) => {
obj[it?.fieldId] = it?.fieldRealValue; obj[it?.fieldId] = it?.fieldRealValue;
}); });
console.log('dddddd', {
console.log({
...obj, ...obj,
...defaultFormValue, ...defaultFormValue,
...(res?.data?.data ?? {}), ...(res?.data?.data ?? {}),
}); });
return { return {
...obj, ...obj,
...defaultFormValue, ...defaultFormValue,
...(res?.data?.data ?? {}), ...(res?.data?.data ?? {}),
...relationSupplierList,
}; };
} }
//反填参数 格式化
const relationSupplierList = res?.data?.data?.relationSupplierList
? {
relationSupplierList: res?.data?.data?.relationSupplierList?.map?.((it, i) => {
return {
...it,
id: it?.supplierId,
};
}),
}
: {};
return { return {
...(res?.data?.data ?? {}),
...defaultFormValue, ...defaultFormValue,
...(res?.data?.data ?? {}),
...relationSupplierList,
}; };
} else { } else {
console.log({ console.log({
......
...@@ -41,7 +41,17 @@ const getParentKey = (key, tree) => { ...@@ -41,7 +41,17 @@ const getParentKey = (key, tree) => {
/> */ /> */
} }
function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, maxWidth, style }) { function TreeRender({
url,
deleteurl,
saveurl,
onselected,
params,
noaction,
maxWidth,
style,
submitKey,
}) {
const [search, setsearch] = useState(''); const [search, setsearch] = useState('');
const [savetitle, setsavetitle] = useState(null); const [savetitle, setsavetitle] = useState(null);
const [modal, setModal] = useState({ const [modal, setModal] = useState({
...@@ -80,8 +90,8 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -80,8 +90,8 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
let res = data?.data?.dataList ?? []; let res = data?.data?.dataList ?? [];
return [ return [
{ {
title: '设备树', title: '全部类型',
key: '00000000', key: '',
children: res, children: res,
}, },
]; ];
...@@ -275,20 +285,6 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -275,20 +285,6 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
); );
} }
// if (item.children) {
// return (
// <TreeNode key={item.key} title={actiontitle}>
// {loop(item.children)}
// </TreeNode>
// );
// }
// return <TreeNode key={item.key} title={title} />;
// return (
// <TreeNode key={item.key} title={noaction ? title : actiontitle}>
// {item.children && loop(item.children)}
// </TreeNode>
// );
if (item.children) { if (item.children) {
return { return {
title: noaction ? title : actiontitle, title: noaction ? title : actiontitle,
...@@ -341,7 +337,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -341,7 +337,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
doFetch({ doFetch({
url: saveurl, url: saveurl,
params: { params: {
materieTypeName: savetitle, [submitKey]: savetitle,
id: modal.key, id: modal.key,
}, },
}).then((res) => { }).then((res) => {
...@@ -366,7 +362,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max ...@@ -366,7 +362,7 @@ function TreeRender({ url, deleteurl, saveurl, onselected, params, noaction, max
doFetch({ doFetch({
url: saveurl, url: saveurl,
params: { params: {
materieTypeName: savetitle, [submitKey]: savetitle,
parentId: modal.key, parentId: modal.key,
}, },
}).then((res) => { }).then((res) => {
......
...@@ -58,14 +58,13 @@ ol { ...@@ -58,14 +58,13 @@ ol {
width: 100%; width: 100%;
overflow-x: auto; overflow-x: auto;
&-thead>tr, &-thead > tr,
&-tbody>tr { &-tbody > tr {
> th,
>th, > td {
>td {
white-space: pre; white-space: pre;
>span { > span {
display: block; display: block;
} }
} }
...@@ -314,7 +313,7 @@ ol { ...@@ -314,7 +313,7 @@ ol {
} }
.lightblue { .lightblue {
>td:first-child { > td:first-child {
position: relative; position: relative;
&::before { &::before {
...@@ -336,14 +335,14 @@ ol { ...@@ -336,14 +335,14 @@ ol {
width: 100%; width: 100%;
padding-left: 0 !important; padding-left: 0 !important;
>span:first-child { > span:first-child {
flex: 1; flex: 1;
>span:first-child { > span:first-child {
display: none !important; display: none !important;
} }
>.ant-spin-nested-loading { > .ant-spin-nested-loading {
width: 100%; width: 100%;
} }
} }
...@@ -387,9 +386,12 @@ ol { ...@@ -387,9 +386,12 @@ ol {
.container, .container,
.diycard { .diycard {
width: 100%;
height: 100%; height: 100%;
} }
.ant-pro-table {
width: 100%;
}
.ant-drawer-wrapper-body { .ant-drawer-wrapper-body {
.diycard { .diycard {
height: unset; height: unset;
...@@ -397,7 +399,7 @@ ol { ...@@ -397,7 +399,7 @@ ol {
} }
.runtime-keep-alive-layout { .runtime-keep-alive-layout {
>div { > div {
height: 100% !important; height: 100% !important;
} }
} }
...@@ -445,7 +447,7 @@ ol { ...@@ -445,7 +447,7 @@ ol {
min-height: 100% !important; min-height: 100% !important;
overflow: hidden !important; overflow: hidden !important;
>div { > div {
height: 100%; height: 100%;
min-height: calc(100vh - 96px); min-height: calc(100vh - 96px);
} }
...@@ -457,12 +459,12 @@ ol { ...@@ -457,12 +459,12 @@ ol {
// 横向滚动条 // 横向滚动条
.scrollHoriz { .scrollHoriz {
>div { > div {
display: flex !important; display: flex !important;
flex-wrap: nowrap !important; flex-wrap: nowrap !important;
align-items: center !important; align-items: center !important;
>div { > div {
flex-shrink: 0 !important; flex-shrink: 0 !important;
} }
} }
......
This diff is collapsed.
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 Instore(props) { function Instore(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
open: false, open: false,
}),
[activeTabKey, setactiveTabKey] = useState('1');
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 edit = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否入库?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: '/sparepart/inWarehouseTask/inWarehouse', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
}}
>
入库
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否关单?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: '/sparepart/inWarehouseTask/shut', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
关单
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.columns;
let defpath = getcolumns(setdrawer).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),
],
}); });
const pathconfig = useMemo(() => { }, [activeTabKey]);
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) => { const pathconfig = useMemo(() => {
return ( let defpath = getcolumns(setdrawer).filter((it) => it.key == activeTabKey)[0]?.pathconfig ?? {};
<PremButton return defpath;
btn={{ }, [activeTabKey]);
size: 'small',
type: 'link', const { data } = useRequest(async () => {
onClick: () => { let res = await doFetch({ url: '/sparepart/sparePart/queryAllSelect', params: {} });
setdrawer((s) => ({ return res?.data?.dataList;
...s, });
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => { console.log(data);
return (
<PremButton return (
btn={{ <div style={{ position: 'relative' }}>
size: 'small', <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: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
open: true, open: true,
item: row, item: null,
title: '编辑', title: '新增',
val: 'edit', val: 'add',
})); }));
}, },
}} },
> }}
编辑 tabList={getcolumns()}
</PremButton> activeTabKey={activeTabKey}
); onTabChange={(key) => {
}; setactiveTabKey(key);
}}
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 <DrawerPro
fields={columns} fields={columns}
params={{ id: drawer?.item?.id }} detailpath={pathconfig?.detail || null}
formRef={formRef} defaultFormValue={drawer?.item}
placement="right" params={{ id: drawer?.item?.id }}
detailpath={pathconfig?.detail || null} formRef={formRef}
detailData={drawer?.item} placement="right"
defaultFormValue={drawer?.item} onClose={() => {
onClose={() => { setdrawer((s) => ({
setdrawer((s) => ({ ...s,
...s, open: false,
open: false, }));
})); }}
}} {...drawer}
{...drawer} onFinish={(vals) => {
onFinish={(vals) => { if (drawer?.val == 'add') {
if (drawer?.val == 'add') { run({ url: pathconfig?.add || '/add', params: { ...vals } });
run({ url: pathconfig?.add || '/add', params: { ...vals } }); } else if (drawer?.val == 'edit') {
} else if (drawer?.val == 'edit') { run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } }); }
} }}
}} onValuesChange={(curval, allval) => {
/> if (Object.keys(curval)[0] == 'detailsList') {
</div> formRef.current.setFieldsValue({
); detailsList: allval.detailsList?.map((it) => {
} if (it.sparePartId) {
it.unit = data?.filter?.((item) => {
return item.value == it.sparePartId;
})?.[0]?.unit;
}
return it;
}),
});
}
}}
/>
</div>
);
}
export default Instore; export default Instore;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return { return {
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
},
"columns": [ "columns": [
{ {
"title": "维修单号", "title": "操作时间",
"dataIndex": "repairOrderNo", "dataIndex": "operateTime",
"key": "repairOrderNo" "key": "operateTimeList",
"valueType": "dateRange"
},
{
"title": "操作人",
"dataIndex": "operateUserName",
"key": "operateUserId",
"valueType": "select",
"options": {
"path": "/auth/sysUser/selection",
"params": {}
},
"hideInSearch": false,
"hideInTable": false
},
{
"title": "备件料号",
"dataIndex": "sparePartNo",
"key": "sparePartNo",
"hideInSearch": false,
"hideInTable": false
},
{
"title": "备件名",
"dataIndex": "sparePartName",
"key": "sparePartName"
},
{
"title": "供应商编号",
"dataIndex": "supplierNo",
"key": "supplierNo"
}, },
{ {
"title": "设备编号", "title": "供应商名称",
"dataIndex": "equipmentNo", "dataIndex": "supplierName",
"key": "equipmentNo" "key": "supplierName"
}, },
{ {
"title": "设备名称", "title": "库存单位",
"dataIndex": "equipmentName", "dataIndex": "unit",
"key": "equipmentName" "key": "unit"
}, },
{ {
"title": "故障描述", "title": "入库仓库",
"dataIndex": "faultDescription", "dataIndex": "inWarehouseName",
"key": "faultDescription" "key": "inWarehouseName"
}, },
{ {
"title": "报修人员", "title": "出库仓库",
"dataIndex": "repairUserName", "dataIndex": "outWarehouseName",
"key": "repairUserName" "key": "outWarehouseName"
}, },
{ {
"title": "报修时间", "title": "出入库类型",
"dataIndex": "repairTime", "dataIndex": "operateTypeName",
"key": "repairTimeList", "key": "operateTypeName"
"valueType": "dateTimeRange"
}, },
{ {
"title": "报修单号", "title": "操作后的备件库存",
"dataIndex": "repairNo", "dataIndex": "actualStock",
"key": "repairNo" "key": "actualStock"
}, },
{ {
"title": "工单状态", "title": "操作数量",
"dataIndex": "statusName", "dataIndex": "operateNum",
"key": "statusName" "key": "operateNum"
},
{
"title": "相关单号",
"dataIndex": "relationNo",
"key": "relationNo"
} }
] ],
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/sparepart/spareStockAccess/queryList",
"delete": "",
"detail": ""
}
}; };
}
} export default getcolumns;
export default getcolumns;
\ No newline at end of file \ No newline at end of file
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 Record(props) { function Record(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) => { const edit = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
btn={{ btn={{
size: 'small', 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={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) => { <DrawerPro
return ( fields={columns}
<PremButton params={{ id: drawer?.item?.id }}
pop={{ formRef={formRef}
title: '是否删除?', placement="right"
okText: '确认', detailpath={pathconfig?.detail || null}
cancelText: '取消', detailData={drawer?.item}
onConfirm: () => { defaultFormValue={drawer?.item}
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } }); onClose={() => {
}, setdrawer((s) => ({
}} ...s,
btn={{ open: false,
size: 'small', }));
type: 'danger', }}
}} {...drawer}
> onFinish={(vals) => {
删除 if (drawer?.val == 'add') {
</PremButton> run({ url: pathconfig?.add || '/add', params: { ...vals } });
); } else if (drawer?.val == 'edit') {
}; run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
const columns = useMemo(() => { }}
let defcolumn = getcolumns(setdrawer)?.columns; />
return defcolumn.concat({ </div>
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>
);
}
export default Record; export default Record;
\ No newline at end of file
import AutoTable from '@/components/AutoTable/mtable';
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
const columns = [
{
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
editable: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
editable: false,
},
{
title: '保质期(天)',
dataIndex: 'qualityGuarantee',
valueType: 'digit',
precision: 2,
fieldProps: {
precision: 2,
},
hideInSearch: true,
},
{
title: '价值',
dataIndex: 'value',
valueType: 'money',
hideInSearch: true,
},
];
return { return {
columns: [ columns: [
{ {
...@@ -44,18 +77,21 @@ function getcolumns(setdrawer) { ...@@ -44,18 +77,21 @@ function getcolumns(setdrawer) {
path: '/sparepart/sparePartType/queryTreeList', path: '/sparepart/sparePartType/queryTreeList',
params: {}, params: {},
}, },
hideInSearch: true,
}, },
{ {
title: '库存上限', title: '库存上限',
dataIndex: 'stockUpper', dataIndex: 'stockUpper',
key: 'stockUpper', key: 'stockUpper',
valueType: 'digit', valueType: 'digit',
hideInSearch: true,
}, },
{ {
title: '库存下限', title: '库存下限',
dataIndex: 'stockLower', dataIndex: 'stockLower',
key: 'stockLower', key: 'stockLower',
valueType: 'digit', valueType: 'digit',
hideInSearch: true,
}, },
{ {
title: '库存单位', title: '库存单位',
...@@ -69,6 +105,7 @@ function getcolumns(setdrawer) { ...@@ -69,6 +105,7 @@ function getcolumns(setdrawer) {
}, },
], ],
}, },
hideInSearch: true,
}, },
{ {
title: '是否寿命件', title: '是否寿命件',
...@@ -85,6 +122,8 @@ function getcolumns(setdrawer) { ...@@ -85,6 +122,8 @@ function getcolumns(setdrawer) {
value: 2, value: 2,
}, },
], ],
hideInSearch: true,
hideInTable: true,
}, },
{ {
title: '供应商信息', title: '供应商信息',
...@@ -93,43 +132,30 @@ function getcolumns(setdrawer) { ...@@ -93,43 +132,30 @@ function getcolumns(setdrawer) {
valueType: 'split', valueType: 'split',
}, },
{ {
title: '选择供应商', title: '供应商',
dataIndex: 'relationSupplierList', dataIndex: 'relationSupplierList',
key: 'relationSupplierList', key: 'relationSupplierList',
valueType: 'formSelectList', valueType: 'formSelectList',
colProps: { colProps: {
span: 24, span: 24,
}, },
columns: [ columns,
{ span: 12,
title: '供应商编号',
dataIndex: 'supplierNo',
key: 'supplierNo',
editable: false,
},
{
title: '供应商名称',
dataIndex: 'supplierName',
key: 'supplierName',
editable: false,
},
{
title: '保质期(天)',
dataIndex: 'qualityGuarantee',
valueType: 'digit',
precision: 2,
fieldProps: {
precision: 2,
},
},
{
title: '价值',
dataIndex: 'value',
valueType: 'money',
},
],
path: '/sparepart/sparePartSupplier/queryList', path: '/sparepart/sparePartSupplier/queryList',
params: { status: 1 }, params: { status: 1 },
hideInSearch: true,
hideInTable: true,
render: (text, row) => {
return (
<AutoTable
columns={columns?.map((it) => ({
...it,
hideInSearch: true,
}))}
dataSource={row?.relationSupplierList}
/>
);
},
}, },
], ],
pathconfig: { pathconfig: {
......
...@@ -7,6 +7,7 @@ import getcolumns from './columns'; ...@@ -7,6 +7,7 @@ import getcolumns from './columns';
import { useRequest } from 'ahooks'; import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import { message } from 'antd'; import { message } from 'antd';
import TreeRender from '@/components/TreeRender';
function Setting(props) { function Setting(props) {
const actionRef = useRef(), const actionRef = useRef(),
...@@ -18,6 +19,7 @@ function Setting(props) { ...@@ -18,6 +19,7 @@ function Setting(props) {
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {}; let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf; return pathconf;
}, []); }, []);
const [sparePartTypeId, setsparePartTypeId] = useState();
const { run, loading } = useRequest(doFetch, { const { run, loading } = useRequest(doFetch, {
manual: true, manual: true,
onSuccess: (res, params) => { onSuccess: (res, params) => {
...@@ -135,7 +137,18 @@ function Setting(props) { ...@@ -135,7 +137,18 @@ function Setting(props) {
}, },
}, },
}} }}
/> extraparams={{ sparePartTypeId }}
>
<TreeRender
url="/sparepart/sparePartType/queryTreeList"
deleteurl="/sparepart/sparePartType/deleteById"
saveurl="/sparepart/sparePartType/save"
submitKey="sparePartTypeName"
onselected={(vals) => {
setsparePartTypeId(vals[0] ?? '');
}}
/>
</AutoTable>
<DrawerPro <DrawerPro
fields={columns} fields={columns}
...@@ -143,8 +156,7 @@ function Setting(props) { ...@@ -143,8 +156,7 @@ function Setting(props) {
formRef={formRef} formRef={formRef}
placement="right" placement="right"
detailpath={pathconfig?.detail || null} detailpath={pathconfig?.detail || null}
detailData={drawer?.item} defaultFormValue={{ sparePartTypeId }}
defaultFormValue={drawer?.item}
onClose={() => { onClose={() => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
......
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return { return {
"pathconfig": { columns: [
"enableadd": false, {
"enableedit": false, title: '备件料号',
"enabledelete": false, dataIndex: 'sparePartNo',
"enabledetail": false, key: 'sparePartNo',
"add": "", },
"edit": "", {
"list": "/repair/umRepairOrder/queryRepairOrderList", title: '备件名称',
"delete": "", dataIndex: 'sparePartName',
"detail": "" key: 'sparePartName',
}, },
"columns": [ {
{ title: '备件类型',
"title": "维修单号", dataIndex: 'sparePartTypeName',
"dataIndex": "repairOrderNo", key: 'sparePartTypeName',
"key": "repairOrderNo" },
}, {
{ title: '库存单位',
"title": "设备编号", dataIndex: 'unit',
"dataIndex": "equipmentNo", key: 'unit',
"key": "equipmentNo" hideInSearch: true,
}, },
{ {
"title": "设备名称", title: '库存数量',
"dataIndex": "equipmentName", dataIndex: 'actualStock',
"key": "equipmentName" key: 'actualStock',
}, hideInSearch: true,
{ },
"title": "故障描述", {
"dataIndex": "faultDescription", title: '可用库存',
"key": "faultDescription" dataIndex: 'usedStock',
}, key: 'usedStock',
{ hideInSearch: true,
"title": "报修人员", },
"dataIndex": "repairUserName", ],
"key": "repairUserName" pathconfig: {
}, enableadd: false,
{ enableedit: false,
"title": "报修时间", enabledelete: false,
"dataIndex": "repairTime", enabledetail: false,
"key": "repairTimeList", add: '',
"valueType": "dateTimeRange" edit: '',
}, list: '/sparepart/spareStock/queryList',
{ delete: '',
"title": "报修单号", detail: '',
"dataIndex": "repairNo", },
"key": "repairNo" };
},
{
"title": "工单状态",
"dataIndex": "statusName",
"key": "statusName"
}
]
};
} }
export default getcolumns; export default getcolumns;
\ No newline at end of file
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';
import AutoTables from '@/components/AutoTable/mtable';
function Stock(props) {
const actionRef = useRef(), function ExtraTable({ spareStockId }) {
formRef = useRef(); return (
const [drawer, setdrawer] = useState({ <div style={{ padding: '4px 4px 4px 36px', backgroundColor: '#cccccc' }}>
open: false, <AutoTables
}); path={'/sparepart/spareSupplierStock/queryBySpareStockId'}
const pathconfig = useMemo(() => { extraparams={{ spareStockId: spareStockId }}
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {}; pagination={false}
return pathconf; resizeable={false}
}, []); columns={[
const { run, loading } = useRequest(doFetch, { { title: '供应商编号', dataIndex: 'supplierNo', key: 'supplierNo' },
manual: true, { title: '供应商名称', dataIndex: 'supplierName', key: 'supplierName' },
onSuccess: (res, params) => { { title: '库存数量', dataIndex: 'actualStock', key: 'actualStock', hideInSearch: true },
if (res?.code == '0000') { ]}
actionRef?.current?.reload(); />
setdrawer((s) => ({ </div>
...s, );
open: false, }
}));
} function Stock(props) {
}, const actionRef = useRef();
}); const pathconfig = useMemo(() => {
let pathconf = getcolumns()?.pathconfig ?? {};
const detail = (text, row, _, action) => { return pathconf;
return ( }, []);
<PremButton
btn={{ const columns = useMemo(() => {
size: 'small', let defcolumn = getcolumns()?.columns;
type: 'link', return defcolumn;
onClick: () => { }, []);
setdrawer((s) => ({
...s, return (
open: true, <div style={{ position: 'relative' }}>
item: row, <AutoTable
title: '详情', pagetitle="备件库存"
val: 'detail', columns={columns}
title: '详细信息', actionRef={actionRef}
})); path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
}, resizeable={false}
}} expandable={{
> expandedRowRender: (record) => <ExtraTable spareStockId={record?.id} />,
详情 }}
</PremButton> />
); </div>
}; );
}
const edit = (text, row, _, action) => {
return ( export default Stock;
<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.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>
);
}
export default Stock;
\ No newline at end of file
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