|
|
@@ -4,7 +4,7 @@ import 'handsontable/dist/handsontable.full.min.css';
|
|
|
//import 'handsontable/styles/ht-theme-main.min.css';
|
|
|
import { HandsonTable } from 'handsontable/base';
|
|
|
import { Table, ConfigProvider } from "antd";
|
|
|
-import {HotTable} from "@handsontable/react";
|
|
|
+import {HotTable} from "@handsontable/react-wrapper";
|
|
|
import { registerAllModules } from 'handsontable/registry';
|
|
|
import {RichTreeView } from "@mui/x-tree-view/RichTreeView";
|
|
|
import { Grid } from '@mui/material';
|
|
|
@@ -20,12 +20,15 @@ import { textRenderer, registerRenderer } from 'handsontable/renderers';
|
|
|
import Button from '@mui/material/Button';
|
|
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
|
import {extractFuzhu} from './utils';
|
|
|
-import {shanchu, undo, redo, quanbushanchu, danxiangdinge, updateDercj, changguidinge, handleBeizhu} from './editor';
|
|
|
+import {shanchu, undo, redo, quanbushanchu, danxiangdinge, updateDercj, changguidinge, handleBeizhu, huan} from './editor';
|
|
|
import { ConfigValueTooSmallError, HyperFormula } from 'hyperformula';
|
|
|
import Backdrop from '@mui/material/Backdrop';
|
|
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
|
import { DataGrid } from '@mui/x-data-grid';
|
|
|
-
|
|
|
+import { useHotEditor } from "@handsontable/react-wrapper";
|
|
|
+import Dialog from '@mui/material/Dialog';
|
|
|
+import DialogTitle from '@mui/material/DialogTitle';
|
|
|
+import DialogContent from '@mui/material/DialogContent';
|
|
|
registerAllModules();
|
|
|
|
|
|
|
|
|
@@ -46,13 +49,11 @@ function copy(input) {
|
|
|
|
|
|
|
|
|
|
|
|
-export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuFK, clickCallback, loadingCallback, dingeclick}) {
|
|
|
+export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuFK, clickCallback, loadingCallback, dingeclick, tihuanCallback, tihuanClick}) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const hyperformulaInstance = HyperFormula.buildEmpty({
|
|
|
// to use an external HyperFormula instance,
|
|
|
// initialize it with the `'internal-use-in-handsontable'` license key
|
|
|
@@ -87,6 +88,9 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
}
|
|
|
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+ const lastClickRef = React.useRef(null);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -109,7 +113,7 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
"综合人工工日" : null,
|
|
|
"备注" : null}]
|
|
|
);
|
|
|
- const [value, setValue] = React.useState("1");
|
|
|
+ const [valueTab, setValueTab] = React.useState("1");
|
|
|
const [rcjhl, setRcjhl] = React.useState([]);
|
|
|
const [rcjhl2, setRcjhl2] = React.useState([]);
|
|
|
const [fuzhu, setFuzhu] = React.useState([]);
|
|
|
@@ -214,6 +218,25 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
|
|
|
}, [dingeclick]//常规添加定额
|
|
|
);
|
|
|
+
|
|
|
+ React.useEffect(
|
|
|
+ () => {
|
|
|
+ //console.log(dingeclick);
|
|
|
+ if (selectedRowKeys.length > 0 ) {
|
|
|
+ const data = huan(JSON.parse(tihuanClick), selectedRowKeys[0]);
|
|
|
+
|
|
|
+ setDetail(data);
|
|
|
+ detailRef.current = data;
|
|
|
+
|
|
|
+ handleSelection(selectedRowKeys);
|
|
|
+
|
|
|
+
|
|
|
+ //setExpandedRowKeys([...expandedRowKeys, selectedRowKeys[0]]);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }, [tihuanClick]//替换定额人材机
|
|
|
+ );
|
|
|
React.useEffect(
|
|
|
() => {
|
|
|
//console.log("rgde changed");
|
|
|
@@ -312,7 +335,7 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
|
|
|
|
|
|
const handleChange = (event, newValue) => {
|
|
|
- setValue(newValue);
|
|
|
+ setValueTab(newValue);
|
|
|
};
|
|
|
|
|
|
const afterChange = (changes, source) => {
|
|
|
@@ -332,6 +355,20 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const afterOnCellMouseDown = (event, coord, TD) => {
|
|
|
+
|
|
|
+ if (lastClickRef.current == null) {
|
|
|
+ lastClickRef.current = Date.now();
|
|
|
+ } else {
|
|
|
+ let origin = lastClickRef.current;
|
|
|
+ lastClickRef.current = Date.now();
|
|
|
+ let delta = lastClickRef.current - origin;
|
|
|
+ if (delta < 300 && coord.col == 1 && coord.row > 0 && !isQdrcj.current){//300 ms -> 换
|
|
|
+ tihuanCallback(coord.row, coord.col);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const afterUpdateData = (x, initial, source)=>{
|
|
|
|
|
|
console.log(source);
|
|
|
@@ -532,6 +569,7 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
|
|
|
|
|
|
</Stack>
|
|
|
+ <Box sx={{minHeight: `calc(100vh - 340px)`}}>
|
|
|
<ConfigProvider
|
|
|
theme={{
|
|
|
components: {
|
|
|
@@ -570,7 +608,8 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
}
|
|
|
})}
|
|
|
scroll={{ x: 'max-content' , y : 'calc(100vh - 400px)'}}
|
|
|
- pagination={{ position: ['none', 'none'] }}
|
|
|
+ //pagination={{ position: ['none', 'none'] }}
|
|
|
+ pagination={false}
|
|
|
columns = {[
|
|
|
|
|
|
{ dataIndex: '操作', title : '操作', key : '操作' , width : 30 , fixed: 'left' },
|
|
|
@@ -603,10 +642,11 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
|
|
|
/>
|
|
|
</ConfigProvider>
|
|
|
+ </Box>
|
|
|
</Box>
|
|
|
<Box >
|
|
|
|
|
|
- <TabContext value={value}>
|
|
|
+ <TabContext value={valueTab}>
|
|
|
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
|
|
<TabList sx={{minHeight: '24px'}} onChange={handleChange} aria-label="lab API tabs example">
|
|
|
<Tab sx={{p: 0, minHeight: '24px'}} label="人材机含量" value="1" />
|
|
|
@@ -640,7 +680,7 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
return { readOnly: true, renderer: "customStylesRenderer" };
|
|
|
}
|
|
|
|
|
|
- return {renderer: "customStylesRenderer"};
|
|
|
+ return {renderer: "customStylesRenderer" };
|
|
|
}}
|
|
|
fixedRowsTop={1}
|
|
|
selectionMode="single"
|
|
|
@@ -648,6 +688,7 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
autoWrapCol={false}
|
|
|
ref = {hotRcjRef}
|
|
|
afterChange={afterChange}
|
|
|
+ afterOnCellMouseDown={afterOnCellMouseDown}
|
|
|
licenseKey="non-commercial-and-evaluation" // for non-commercial use only
|
|
|
>
|
|
|
|
|
|
@@ -673,8 +714,15 @@ export default function Qingdan({name, bh, bt, rgde, jxde, clde, beizhu, beizhuF
|
|
|
|
|
|
</TabPanel>
|
|
|
<TabPanel sx={{p: 1}} value="3">
|
|
|
- <DataGrid
|
|
|
+ <DataGrid disableColumnMenu
|
|
|
getRowHeight={(params) => "auto"}
|
|
|
+ localeText={{
|
|
|
+ noRowsLabel: '无数据',
|
|
|
+ paginationRowsPerPage: '每页行数',
|
|
|
+ footerRowSelected: (count) => `共选中了${count.toLocaleString()}行`,
|
|
|
+
|
|
|
+
|
|
|
+ }}
|
|
|
columns={
|
|
|
[
|
|
|
{ field: '序号', headerName: '序号', },
|