Commit 5432ea82 authored by TZW's avatar TZW

111

parent d80e190e
import * as React from 'react'; import * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef, useEffect } 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';
...@@ -32,7 +32,6 @@ function Outstore(props) { ...@@ -32,7 +32,6 @@ function Outstore(props) {
} }
}, },
}); });
const detail = (text, row, _, action) => { const detail = (text, row, _, action) => {
return ( return (
<PremButton <PremButton
...@@ -230,7 +229,7 @@ function Outstore(props) { ...@@ -230,7 +229,7 @@ function Outstore(props) {
}, },
]} ]}
pagetitle="备件信息" pagetitle="备件信息"
dataSource={drawer?.submitdata} dataSource={drawer?.submitdata || []}
expandable={{ expandable={{
expandedRowRender: (record) => { expandedRowRender: (record) => {
return ( return (
...@@ -275,22 +274,26 @@ function Outstore(props) { ...@@ -275,22 +274,26 @@ function Outstore(props) {
preserveSelectedRowKeys: true, preserveSelectedRowKeys: true,
selectedRowKeys: selectedRowKeys:
value && value.length > 0 value && value.length > 0
? value ? value?.filter?.((it) => it?.id == record.id)[0]
?.filter?.((it) => it?.id == record.id)[0] ? value
?.taskSpareSupplierList?.map?.((it) => it?.spareSupplierStockId) ?.filter?.((it) => it?.id == record.id)[0]
?.taskSpareSupplierList?.map?.((it) => it?.spareSupplierStockId)
: []
: [], : [],
onChange: (selectedKeys, selectedRows) => { onChange: (selectedKeys, selectedRows) => {
// debugger;
const curval = const curval =
value?.filter?.((it) => it?.id == record.id)[0] value?.filter?.((it) => it?.id == record.id)[0]
?.taskSpareSupplierList ?? []; ?.taskSpareSupplierList ?? [];
const rowkeylist = curval const rowkeylist =
? curval?.map((it) => it?.spareSupplierStockId) curval && curval.length > 0
: []; ? curval?.map((it) => it?.spareSupplierStockId)
: [];
const newValue = selectedRows?.map((its) => { const newValue = selectedRows?.map((its) => {
if (rowkeylist.includes(its?.id)) { if (rowkeylist?.includes(its?.id)) {
return curval.filter( return curval?.filter(
(it) => it?.spareSupplierStockId == its?.id, (it) => it?.spareSupplierStockId == its?.id,
)[0]; )[0];
} else { } else {
...@@ -310,11 +313,10 @@ function Outstore(props) { ...@@ -310,11 +313,10 @@ function Outstore(props) {
}); });
} else { } else {
nvalue.push({ nvalue.push({
id: record.id, id: record?.id,
taskSpareSupplierList: newValue, taskSpareSupplierList: newValue,
}); });
} }
setvalue(nvalue); setvalue(nvalue);
}, },
}} }}
......
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