|
|
@@ -10,8 +10,10 @@ import { debounce } from '@mui/material/utils';
|
|
|
import throttle from 'lodash/throttle';
|
|
|
import {Tree as Tree_2} from 'rsuite';
|
|
|
import './Tree.css';
|
|
|
+import PropTypes from 'prop-types';
|
|
|
import Grid from '@mui/material/Grid';
|
|
|
import Tab from "@mui/material/Tab";
|
|
|
+import Tabs from '@mui/material/Tabs';
|
|
|
import TabContext from "@mui/lab/TabContext";
|
|
|
import TabList from "@mui/lab/TabList";
|
|
|
import TabPanel from "@mui/lab/TabPanel";
|
|
|
@@ -67,22 +69,56 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
|
|
|
|
|
|
|
|
|
+function TabPanel_(props) {
|
|
|
+ const { children, value, index, ...other } = props;
|
|
|
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ role="tabpanel"
|
|
|
+ hidden={value !== index}
|
|
|
+ id={`vertical-tabpanel-${index}`}
|
|
|
+ aria-labelledby={`vertical-tab-${index}`}
|
|
|
+ {...other}
|
|
|
+ >
|
|
|
+ {value === index && (
|
|
|
+ <Box>
|
|
|
+ {children}
|
|
|
+ </Box>
|
|
|
+
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+}
|
|
|
+TabPanel_.propTypes = {
|
|
|
+ children: PropTypes.node,
|
|
|
+ index: PropTypes.number.isRequired,
|
|
|
+ value: PropTypes.number.isRequired,
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+function a11yProps(index) {
|
|
|
+ return {
|
|
|
+ id: `vertical-tab-${index}`,
|
|
|
+ 'aria-controls': `vertical-tabpanel-${index}`,
|
|
|
+ };
|
|
|
+}
|
|
|
|
|
|
export default function App2() {
|
|
|
+ const [tihuanValue, setTihuanValue] = React.useState(0);
|
|
|
const [azfySelect, setAzfySelect] = React.useState([]);
|
|
|
const [azfyConfirm, setAzfyConfirm] = React.useState(null);
|
|
|
const [azfybh, setAzfybh] = React.useState();
|
|
|
const [updatetime, setUpdatetime] = React.useState(null);//tiaojia callback
|
|
|
const [outline, setOutline] = React.useState([]);
|
|
|
const [peibishu, setPeibishu] = React.useState([]);
|
|
|
+ const [jixieshu, setJixieshu] = React.useState([]);
|
|
|
+ const [cailiaoshu, setCailiaoshu] = React.useState([]);
|
|
|
const [outlineDes, setOutlineDes] = React.useState([]);
|
|
|
const [deXilie, setDeXilie] = React.useState([]);
|
|
|
const [pbXilie, setPbXilie] = React.useState([]);
|
|
|
+ const [jxXilie, setJxXilie] = React.useState([]);
|
|
|
+ const [clXilie, setClXilie] = React.useState([]);
|
|
|
const [nest, setNest] = React.useState(false);
|
|
|
const [qingdan, setQingdan] = React.useState(false);
|
|
|
const [cuoshi, setCuoshi] = React.useState(false);
|
|
|
@@ -144,7 +180,7 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
const columns2 =[
|
|
|
|
|
|
{field: '编号', headerName: '定额编号', sortable: false},
|
|
|
- {field: '名称', headerName: '名称', width: 200, sortable: false},
|
|
|
+ {field: '名称', headerName: '名称', width: 250, sortable: false},
|
|
|
{field: '单位', headerName: '单位', sortable: false},
|
|
|
{field: '单价', headerName: '单价', sortable: false}
|
|
|
];
|
|
|
@@ -195,6 +231,13 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
setJxde(null);
|
|
|
setClde(null);
|
|
|
};
|
|
|
+ const handleChangeTihuan = (event, newValue) => {
|
|
|
+ setTihuanValue(newValue);
|
|
|
+ setPbXilie([]);
|
|
|
+ setJxXilie([]);
|
|
|
+ setClXilie([]);
|
|
|
+
|
|
|
+ };
|
|
|
|
|
|
|
|
|
|
|
|
@@ -246,6 +289,7 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
|
|
|
const tihuanCallback = (row, col) => {
|
|
|
setPbXilie([]);
|
|
|
+ setJxXilie([]);
|
|
|
setDopen(true);
|
|
|
tihuanRowRef.current = row;
|
|
|
};
|
|
|
@@ -463,6 +507,61 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ const handleItemSelectionToggleJxs = (itemId, event) => {
|
|
|
+
|
|
|
+ console.log(itemId);
|
|
|
+ if (true) {
|
|
|
+ Service.generateJixieXilie(itemId['id'], zhuanye).then(x=>{
|
|
|
+ let y = JSON.parse(x);
|
|
|
+ console.log(y);
|
|
|
+
|
|
|
+ let result = [];
|
|
|
+ let keys = Object.keys(y["jxbh"])
|
|
|
+ for(let i = 0; i < keys.length; i++) {
|
|
|
+ let key = keys[i];
|
|
|
+ let entry = {
|
|
|
+ "id": y["ID"][key],
|
|
|
+ "编号": y["jxbh"][key],
|
|
|
+ "名称": y["jxmc"][key],
|
|
|
+ "单位": y["DW"][key],
|
|
|
+ "单价": y["tbdj"][key]
|
|
|
+ };
|
|
|
+ result.push(entry);
|
|
|
+ //setPbXilie(result);
|
|
|
+ }
|
|
|
+ setJxXilie(result);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleItemSelectionToggleCls = (itemId, event) => {
|
|
|
+
|
|
|
+ console.log(itemId);
|
|
|
+ if (true) {
|
|
|
+ Service.generateCailiaoXilie(itemId['id'], zhuanye).then(x=>{
|
|
|
+ let y = JSON.parse(x);
|
|
|
+ console.log(y);
|
|
|
+
|
|
|
+ let result = [];
|
|
|
+ let keys = Object.keys(y["CLBH"])
|
|
|
+ for(let i = 0; i < keys.length; i++) {
|
|
|
+ let key = keys[i];
|
|
|
+ let entry = {
|
|
|
+ "id": y["id"][key],
|
|
|
+ "编号": y["CLBH"][key],
|
|
|
+ "名称": y["CLMC"][key],
|
|
|
+ "单位": y["JLDW"][key],
|
|
|
+ "单价": y["YSJG"][key]
|
|
|
+ };
|
|
|
+ result.push(entry);
|
|
|
+ //setPbXilie(result);
|
|
|
+ }
|
|
|
+ setClXilie(result);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
const handleDingEEvent = (row) => {
|
|
|
|
|
|
@@ -862,6 +961,12 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
Service.generatePeibishu(zhuanye).then(x=>{
|
|
|
setPeibishu(x);
|
|
|
});
|
|
|
+ Service.generateJixieshu(zhuanye).then(x=>{
|
|
|
+ setJixieshu(x);
|
|
|
+ });
|
|
|
+ Service.generateCailiaoshu(zhuanye).then(x=>{
|
|
|
+ setCailiaoshu(x);
|
|
|
+ });
|
|
|
}, [zhuanye]
|
|
|
);
|
|
|
|
|
|
@@ -1176,7 +1281,8 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
aria-labelledby="customized-dialog-title"
|
|
|
open={dopen}
|
|
|
fullWidth={true}
|
|
|
- maxWidth="md"
|
|
|
+ maxWidth="lg"
|
|
|
+ maxHeight='lg'
|
|
|
>
|
|
|
<DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
|
|
|
替换
|
|
|
@@ -1194,19 +1300,35 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
<CloseIcon />
|
|
|
</IconButton>
|
|
|
<DialogContent dividers>
|
|
|
- <Stack direction="row" spacing={2}>
|
|
|
- <Box sx={{ maxHeight: "350px", minWidth: "300px", maxWidth: "300px"}}>
|
|
|
+ <Box
|
|
|
+ sx={{ flexGrow: 1, bgcolor: 'background.paper', display: 'flex' }}
|
|
|
+ >
|
|
|
+ <Tabs orientation="vertical"
|
|
|
+ variant="scrollable" value={tihuanValue}
|
|
|
+ onChange={handleChangeTihuan}
|
|
|
+ sx={{
|
|
|
+ borderRight: 1, borderColor: 'divider' ,
|
|
|
+ '& .MuiButtonBase-root': {
|
|
|
+ maxWidth: '100px', // Adjust font size for cells
|
|
|
+ },
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Tab label="配比" {...a11yProps(0)} />
|
|
|
+ <Tab label="机械" {...a11yProps(1)} />
|
|
|
+ <Tab label="材料" {...a11yProps(2)} />
|
|
|
+ </Tabs>
|
|
|
+ <TabPanel_ value={tihuanValue} index={0}>
|
|
|
+
|
|
|
+ <Stack direction="row" spacing={2}>
|
|
|
+ <Box sx={{ maxHeight: "350px", minWidth: "350px", maxWidth: "350px"}}>
|
|
|
<Tree_2
|
|
|
onSelect={handleItemSelectionTogglePbs}
|
|
|
defaultValue={null}
|
|
|
|
|
|
|
|
|
- data={peibishu}/>
|
|
|
- </Box>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div style={{ height: 350 }}>
|
|
|
+ data={peibishu}/>
|
|
|
+ </Box>
|
|
|
+ <div style={{ height: 350 }}>
|
|
|
|
|
|
<DataGrid disableColumnMenu
|
|
|
sx={{
|
|
|
@@ -1226,12 +1348,81 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
localeText={zhCN.components.MuiDataGrid.defaultProps.localeText}
|
|
|
/>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- </Stack>
|
|
|
-
|
|
|
-
|
|
|
+ </Stack>
|
|
|
+
|
|
|
+ </TabPanel_>
|
|
|
+ <TabPanel_ value={tihuanValue} index={1}>
|
|
|
+
|
|
|
+ <Stack direction="row" spacing={2}>
|
|
|
+ <Box sx={{ maxHeight: "350px", minWidth: "350px", maxWidth: "350px"}}>
|
|
|
+ <Tree_2
|
|
|
+ onSelect={handleItemSelectionToggleJxs}
|
|
|
+ defaultValue={null}
|
|
|
+
|
|
|
+
|
|
|
+ data={jixieshu}/>
|
|
|
+ </Box>
|
|
|
+ <div style={{ height: 350 }}>
|
|
|
+
|
|
|
+ <DataGrid disableColumnMenu
|
|
|
+ sx={{
|
|
|
+ '& .MuiDataGrid-cell': {
|
|
|
+ fontSize: '0.8rem', // Adjust font size for cells
|
|
|
+ }}}
|
|
|
+ getRowHeight={() => 'auto'}
|
|
|
+ rows={jxXilie}
|
|
|
+ onRowDoubleClick={handleEvent}
|
|
|
+ columns={columns2}
|
|
|
+ hideFooter={false}
|
|
|
+ disableColumnFilter
|
|
|
+ disableColumnSelector
|
|
|
+ disableDensitySelector
|
|
|
+ slots={{ toolbar: CustomToolbar}}
|
|
|
+
|
|
|
+ localeText={zhCN.components.MuiDataGrid.defaultProps.localeText}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </Stack>
|
|
|
+
|
|
|
+ </TabPanel_>
|
|
|
+ <TabPanel_ value={tihuanValue} index={2}>
|
|
|
+
|
|
|
+ <Stack direction="row" spacing={2}>
|
|
|
+ <Box sx={{ maxHeight: "350px", minWidth: "350px", maxWidth: "350px"}}>
|
|
|
+ <Tree_2
|
|
|
+ onSelect={handleItemSelectionToggleCls}
|
|
|
+ defaultValue={null}
|
|
|
+
|
|
|
+
|
|
|
+ data={cailiaoshu}/>
|
|
|
+ </Box>
|
|
|
+ <div style={{ height: 350 }}>
|
|
|
+
|
|
|
+ <DataGrid disableColumnMenu
|
|
|
+ sx={{
|
|
|
+ '& .MuiDataGrid-cell': {
|
|
|
+ fontSize: '0.8rem', // Adjust font size for cells
|
|
|
+ }}}
|
|
|
+ getRowHeight={() => 'auto'}
|
|
|
+ rows={clXilie}
|
|
|
+ onRowDoubleClick={handleEvent}
|
|
|
+ columns={columns2}
|
|
|
+ hideFooter={false}
|
|
|
+ disableColumnFilter
|
|
|
+ disableColumnSelector
|
|
|
+ disableDensitySelector
|
|
|
+ slots={{ toolbar: CustomToolbar}}
|
|
|
+
|
|
|
+ localeText={zhCN.components.MuiDataGrid.defaultProps.localeText}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </Stack>
|
|
|
+
|
|
|
+ </TabPanel_>
|
|
|
+
|
|
|
+ </Box>
|
|
|
</DialogContent>
|
|
|
</Dialog>
|
|
|
<Dialog
|