Commit 7834d23e authored by TZW's avatar TZW

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

parents 7ee86de6 826ab672
...@@ -34,6 +34,9 @@ const EditTable = (props) => { ...@@ -34,6 +34,9 @@ const EditTable = (props) => {
success: true, success: true,
total: dataSource?.length ?? 0, total: dataSource?.length ?? 0,
}; };
console.log('====================================');
console.log(extraparams);
console.log('====================================');
let newparams = { let newparams = {
...params, ...params,
...extraparams, //父组件传参 ...extraparams, //父组件传参
......
import { doFetch } from '@/utils/doFetch';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import AutoTable from '../../AutoTable'; import AutoTable from '../../AutoTable/mtable';
import EditTable from '../EditTable'; import EditTable from '../EditTable';
function Expandables({ value, onChange, item }) { function Expandables({ value = [], onChange, item }) {
console.log(value); const [allDatasource, setallDatasource] = useState({});
return ( return (
<div> <div>
<AutoTable <AutoTable
...@@ -11,142 +13,161 @@ function Expandables({ value, onChange, item }) { ...@@ -11,142 +13,161 @@ function Expandables({ value, onChange, item }) {
path={item?.path} path={item?.path}
extraparams={item?.extraparams} extraparams={item?.extraparams}
expandable={{ expandable={{
expandRowByClick: true,
onExpand: (expanded, record) => {
if (!expanded) return;
//找到value中当前展开的值
let curvalue = value
? value.filter((it) => it.lifePieceAccountId == record.id)?.[0]
: {};
//value中的list
let curvalist = curvalue?.lineStockUseList ?? [];
doFetch({ url: item.expandablePath, params: { lifePieceAccountId: record.id } }).then(
(res) => {
//展开接口返回的结果
let curDatasource = res?.data?.dataList ?? [];
//组合数据
let result = curDatasource?.map((it) => {
const itemval =
curvalist?.filter?.((item) => item.lineStockId == it.id)?.[0] ?? false;
if (itemval) {
it.operateNum = itemval.operateNum;
}
return it;
});
setallDatasource((s) => ({
...s,
[record.id]: result,
}));
},
);
},
expandedRowRender: (record) => { expandedRowRender: (record) => {
let curvalue = value
? value.filter((it) => it.lifePieceAccountId == record.id)?.[0]
: {};
return ( return (
<div> <EditTable
<EditTable resizeable={false}
resizeable={false} alwaysShowAlert={false}
alwaysShowAlert={false} tableAlertRender={false}
tableAlertRender={false} tableAlertOptionRender={false}
tableAlertOptionRender={false} columns={[
columns={[ {
{ title: '线边库',
title: '线边库', dataIndex: 'stockName',
dataIndex: 'stockName', search: false,
search: false, key: 'stockName',
key: 'stockName', editable: false,
editable: false, },
}, {
{ title: '供应商编号',
title: '供应商编号', dataIndex: 'supplierNo',
dataIndex: 'supplierNo', key: 'supplierNo',
key: 'supplierNo', search: false,
search: false, editable: false,
editable: false, },
{
title: '供应商名称',
dataIndex: 'supplierName',
search: false,
key: 'supplierName',
editable: false,
},
{
title: '库存数量',
dataIndex: 'actualStock',
search: false,
key: 'actualStock',
editable: false,
},
{
title: '下架数量',
dataIndex: 'operateNum',
search: false,
key: 'operateNum',
valueType: 'digit',
fieldProps: {
precision: 3,
}, },
{ },
title: '供应商名称', ]}
dataIndex: 'supplierName', dataSource={allDatasource[record.id]}
search: false, extraparams={allDatasource}
key: 'supplierName', rowSelection={{
editable: false, getCheckboxProps: (record) => ({
}, disabled: record.isAsh == '1',
{ }),
title: '库存数量', columnWidth: 44,
dataIndex: 'actualStock', preserveSelectedRowKeys: true,
search: false, selectedRowKeys: curvalue?.lineStockUseList
key: 'actualStock', ? curvalue.lineStockUseList?.map?.((it) => it?.lineStockId)
editable: false, : [],
}, onChange: (selectedKeys, selectedRows) => {
{ // debugger;
title: '下架数量', const curval = curvalue?.lineStockUseList ?? [];
dataIndex: 'operateNum', const rowkeylist = curval?.map?.((it) => it?.lineStockId);
search: false,
key: 'operateNum', const newValue = selectedRows?.map((its) => {
valueType: 'digit', if (rowkeylist?.includes(its?.id)) {
fieldProps: { return curval?.filter((it) => it?.lineStockId == its?.id)[0];
precision: 3,
},
},
]}
path={item?.expandablePath}
extraparams={{ lifePieceAccountId: record?.id }}
rowSelection={{
getCheckboxProps: (record) => ({
disabled: record.isAsh == '1',
}),
columnWidth: 44,
preserveSelectedRowKeys: true,
selectedRowKeys:
value && value.length > 0
? value?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
? value
?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
?.lineStockUseList?.map?.((it) => it?.lineStockId)
: []
: [],
onChange: (selectedKeys, selectedRows) => {
// debugger;
const curval =
value?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
?.lineStockUseList ?? [];
const rowkeylist =
curval && curval.length > 0 ? curval?.map((it) => it?.lineStockId) : [];
const newValue = selectedRows?.map((its) => {
if (rowkeylist?.includes(its?.id)) {
return curval?.filter((it) => it?.lineStockId == its?.id)[0];
} else {
return {
lineStockId: its.id,
operateNum: its.operateNum,
};
}
});
let nvalue = value ? [...value] : [];
if (value && value?.some((it) => it.lineStockId == record?.id)) {
nvalue = value?.map((it, i) => {
if (it.lineStockId == record.id) {
it.lineStockUseList = newValue;
}
return it;
});
} else { } else {
nvalue.push({ return {
id: record?.id, lineStockId: its.id,
lineStockUseList: newValue, operateNum: its.operateNum,
}); };
} }
onChange(nvalue); });
},
}} let nvalue = value ? [...value] : [];
editable={{ if (value && value?.some((it) => it.lifePieceAccountId == record?.id)) {
onValuesChange: (rower, recordList) => { nvalue = value?.map((it, i) => {
console.log(rower); if (it.lifePieceAccountId == record.id) {
const curval = it.lineStockUseList = newValue;
value?.filter?.((it) => it?.lifePieceAccountId == record.id)[0]
?.lineStockUseList ?? [];
const newValue = curval?.map((its) => {
if (its?.lineStockId == rower?.id) {
return {
lineStockId: rower.id,
operateNum: rower.operateNum,
};
} else {
return its;
} }
return it;
}); });
let nvalue = value ? [...value] : []; } else {
if (value && value?.some((it) => it.id == record?.id)) { nvalue.push({
nvalue = value?.map((it, i) => { lifePieceAccountId: record?.id,
if (it.id == record.id) { lineStockUseList: newValue,
it.lineStockUseList = newValue; });
} }
return it; onChange(nvalue);
}); },
}}
editable={{
onValuesChange: (rower, recordList) => {
const curval = curvalue?.lineStockUseList ?? [];
const newValue = curval?.map((its) => {
if (its?.lineStockId == rower?.id) {
return {
lineStockId: rower.id,
operateNum: rower.operateNum,
};
} else { } else {
nvalue.push({ return its;
id: record.id,
lineStockUseList: newValue,
});
} }
onChange(nvalue); });
}, let nvalue = value ? [...value] : [];
onExpandedRowsChange: (expandedRows) => { if (value && value?.some((it) => it.lifePieceAccountId == record?.id)) {
console.log(expandedRows); nvalue = value?.map((it, i) => {
}, if (it.lifePieceAccountId == record.id) {
}} it.lineStockUseList = newValue;
/> }
</div> return it;
});
} else {
nvalue.push({
id: record.id,
lineStockUseList: newValue,
});
}
onChange(nvalue);
},
}}
/>
); );
}, },
}} }}
......
...@@ -1488,7 +1488,6 @@ function FormList({ item, colProps, formRef }) { ...@@ -1488,7 +1488,6 @@ function FormList({ item, colProps, formRef }) {
} }
const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => { const Todo = ({ actionRef, value, item, params, rowKey, chooses, onChange }) => {
console.log(params);
return ( return (
<EditTable <EditTable
actionRef={actionRef} actionRef={actionRef}
......
...@@ -713,7 +713,7 @@ function Failure(props) { ...@@ -713,7 +713,7 @@ function Failure(props) {
const Finishrepair = () => { const Finishrepair = () => {
const EditTableItem = ({ record }) => { const EditTableItem = ({ record }) => {
const [value, setvalue] = useState([]); const [value, setvalue] = useState([]);
console.log(value);
return ( return (
<div> <div>
<EditTable <EditTable
...@@ -789,7 +789,6 @@ function Failure(props) { ...@@ -789,7 +789,6 @@ function Failure(props) {
const newValue = value.concat(rower); const newValue = value.concat(rower);
return [...newValue]; return [...newValue];
}); });
console.log(value);
}, },
}} }}
/> />
...@@ -1051,8 +1050,8 @@ function Failure(props) { ...@@ -1051,8 +1050,8 @@ function Failure(props) {
}, },
], ],
path: '/sparepart/lifePieceAccount/queryPageByEquipment', path: '/sparepart/lifePieceAccount/queryPageByEquipment',
expandablePath: '/sparepart/lineStock/queryReplaceStockAll',
extraparams: { equipmentId: drawer?.item?.equipmentId }, extraparams: { equipmentId: drawer?.item?.equipmentId },
expandablePath: '/sparepart/lineStock/queryReplaceStock',
}, },
]; ];
return ( return (
......
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