|
|
@@ -9,9 +9,7 @@ import zhCN from 'rsuite/locales/zh_CN';
|
|
|
import { Grid } from '@mui/material';
|
|
|
import Tooltip from '@mui/material/Tooltip';
|
|
|
import AddIcon from '@mui/icons-material/Add';
|
|
|
-import SaveIcon from '@mui/icons-material/Save';
|
|
|
-import CancelIcon from '@mui/icons-material/Close';
|
|
|
-import EditIcon from '@mui/icons-material/Edit';
|
|
|
+
|
|
|
import DeleteIcon from '@mui/icons-material/DeleteOutlined';
|
|
|
import Radio from '@mui/material/Radio';
|
|
|
import RadioGroup from '@mui/material/RadioGroup';
|
|
|
@@ -28,14 +26,9 @@ import Button from '@mui/material/Button';
|
|
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
|
import {extractFuzhu} from './utils';
|
|
|
import {shanchu, undo, redo, danxiangdinge, updateDercj, changguidinge, handleBeizhu, huan, updateShuliang, handleYuban, updateDeMingcheng, handleRcjbc} from './editor';
|
|
|
-import Backdrop from '@mui/material/Backdrop';
|
|
|
-import CircularProgress from '@mui/material/CircularProgress';
|
|
|
-import { DataGrid, GridRowModes, GridActionsCellItem, GridRowEditStopReasons, zhCN as zhCN_MUI, GridToolbarContainer } from '@mui/x-data-grid';
|
|
|
-import Dialog from '@mui/material/Dialog';
|
|
|
-import DialogTitle from '@mui/material/DialogTitle';
|
|
|
-import DialogContent from '@mui/material/DialogContent';
|
|
|
-import IconButton from '@mui/material/IconButton';
|
|
|
-import Typography from '@mui/material/Typography';
|
|
|
+
|
|
|
+import { DataGrid, GridActionsCellItem, zhCN as zhCN_MUI, GridToolbarContainer } from '@mui/x-data-grid';
|
|
|
+
|
|
|
|
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
|
|
@@ -76,7 +69,6 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
const [rcjhl, setRcjhl] = React.useState([]);
|
|
|
const [rcjhl2, setRcjhl2] = React.useState([]);
|
|
|
const [fuzhu, setFuzhu] = React.useState([]);//展示用的附注行
|
|
|
- const [yuban, setYuban] = React.useState([{'key': '0', '说明': '无'}, {'key': '1', '说明': '湿拌砂浆'}, {'key': '2', '说明': '散装干拌(混)砂浆'}, {'key': '3', '说明': '袋装干拌(混)砂浆'}]);
|
|
|
const [tuijian, setTuijian] = React.useState([]);
|
|
|
const [fuzhuEnable, setFuzhuEnable] = React.useState(false);
|
|
|
const [yubanEnable, setYubanEnable] = React.useState(false);
|
|
|
@@ -103,6 +95,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
const jxdeRef = React.useRef(null);
|
|
|
const cldeRef = React.useRef(null);
|
|
|
const isQdrcj = React.useRef(false);
|
|
|
+ ///备注
|
|
|
const onSelectChange = (newSelectedRowKeys) => {
|
|
|
const [newData, newHl] = handleBeizhu(beizhuFKRef.current, selectedRowKeysTable.current[0], newSelectedRowKeys, fuzhu);
|
|
|
if (newData) {
|
|
|
@@ -137,7 +130,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+ //预拌砂浆
|
|
|
const onSelectChange2 = (event) => {
|
|
|
|
|
|
setValueYuban(event.target.value);
|
|
|
@@ -227,7 +220,13 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
inline
|
|
|
disabled={disabled}
|
|
|
onChange={onChange}
|
|
|
- checked={checkedKeys.some(item => item === rowData[dataKey])}
|
|
|
+ checked={checkedKeys.some(item =>
|
|
|
+ {
|
|
|
+
|
|
|
+ let hit = item === rowData[dataKey];
|
|
|
+
|
|
|
+ return hit;
|
|
|
+ })}
|
|
|
></Checkbox>
|
|
|
</div>
|
|
|
</Cell>
|
|
|
@@ -272,13 +271,43 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
return Number(cell.getValue()).toFixed(2).toString();
|
|
|
};
|
|
|
|
|
|
+ var sparklineFormatter2 = function(cell, formatterParams, onRendered){
|
|
|
+ for (let i = 0; i < highlight.current.length; i++) {
|
|
|
+ let entry = highlight.current[i];
|
|
|
+ if (entry.row + 1 == cell._cell.row.position && entry.col + 1 == cell._cell.column.getPosition()) {
|
|
|
+ cell.getElement().style.fontWeight = 'bold';
|
|
|
+ cell.getElement().style.color = 'green';
|
|
|
+ cell.getElement().style.background = '#d7f1e1';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return cell.getValue();
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const resetUI = () => {
|
|
|
+ selectedRowKeysTable.current = [];
|
|
|
+ selectedRowKeysTableParent.current = null;
|
|
|
+ setRcjhl([]);
|
|
|
+ if (rcjTable.current) {
|
|
|
+ rcjTable.current.replaceData([]);
|
|
|
+ }
|
|
|
+ setFuzhu([]);
|
|
|
+ setRcjrows([]);
|
|
|
+ setShowToolbar(false);
|
|
|
+ setValueYuban("");
|
|
|
+ setYubanEnable(false);
|
|
|
+ isQdrcj.current = true;
|
|
|
+ highlight.current = [];
|
|
|
+ };
|
|
|
+
|
|
|
function handleSelect(row){
|
|
|
selectedRowKeysTable.current = [row._row['data']['key']];
|
|
|
if (row._row.data['序号'] != null && row._row.data['序号'].length >0) {
|
|
|
selectedRowKeysTableParent.current = row._row['data']['key'];
|
|
|
|
|
|
setFuzhu([]);
|
|
|
- setRcjrows([]);
|
|
|
+ setRcjrows([]);//补充人材机
|
|
|
setYubanEnable(false);
|
|
|
setValueYuban("");
|
|
|
setShowToolbar(false);
|
|
|
@@ -322,8 +351,6 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
});
|
|
|
}else{
|
|
|
setTuijian([]);
|
|
|
-
|
|
|
-
|
|
|
if (tuijianTable.current) tuijianTable.current.replaceData([]);
|
|
|
let row_parent = row._row;
|
|
|
while(row_parent.modules.dataTree.parent) {
|
|
|
@@ -934,7 +961,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
let keys = Object.keys(beizhu["BZBH"]);
|
|
|
for(let i = 0; i < keys.length; i++) {
|
|
|
let key = keys[i];
|
|
|
- result.push({'key': i+1, '序号': i+1, '编号': beizhu["BZBH"][key], '说明': beizhu["SM"][key]});//序号很重要
|
|
|
+ result.push({'id': i+1, 'key': i+1, '序号': i+1, '编号': beizhu["BZBH"][key], '说明': beizhu["SM"][key]});//序号很重要
|
|
|
}
|
|
|
setFuzhu(result);
|
|
|
let newSelect = extractFuzhu(debmRef.current);
|
|
|
@@ -1111,7 +1138,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
|
|
|
columns: [ //Define Table Columns
|
|
|
{title:"ID", field:"ID", width:80, headerSort:false, },
|
|
|
- {title:"人材机编码", field:"人材机编码", width:100, headerSort:false, }, //never hide this column
|
|
|
+ {title:"人材机编码", field:"人材机编码", width:100, headerSort:false, formatter: sparklineFormatter2}, //never hide this column
|
|
|
{title:"名称", field:"名称", width:120,headerSort:false, formatter:"textarea", editor: "input", editable: editCheckRcj },
|
|
|
{title:"规格型号", field:"规格型号", width:80, headerSort:false, editor: "input", editable: editCheckRcj },
|
|
|
{title:"单位", field:"单位", width:80, headerSort:false, formatter:"textarea"}, //hide this column first
|
|
|
@@ -1215,19 +1242,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
const [success, data] = danxiangdinge(selectedRowKeysTable.current[0]);
|
|
|
if(success) {
|
|
|
myTable.current.updateData(data.filter(x=>x['key'] == selectedRowKeysTableParent.current)).then(function(){
|
|
|
- selectedRowKeysTable.current = [];
|
|
|
- selectedRowKeysTableParent.current = null;
|
|
|
- setRcjhl([]);
|
|
|
- if (rcjTable.current) {
|
|
|
- rcjTable.current.replaceData([]);
|
|
|
- }
|
|
|
- setFuzhu([]);
|
|
|
- setRcjrows([]);
|
|
|
- setShowToolbar(false);
|
|
|
- setValueYuban("");
|
|
|
- setYubanEnable(false);
|
|
|
- isQdrcj.current = true;
|
|
|
- highlight.current = [];
|
|
|
+ resetUI();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -1240,20 +1255,8 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
let newData = shanchu(selectedRowKeysTable.current[0]);
|
|
|
myTable.current.updateData(newData.filter(x=>x['key'] == selectedRowKeysTableParent.current)).then(function(){
|
|
|
if (newData.filter(x=>x['key'] == selectedRowKeysTable.current[0]).length == 0) {
|
|
|
- selectedRowKeysTable.current = [];
|
|
|
- selectedRowKeysTableParent.current = [];
|
|
|
- setRcjhl([]);
|
|
|
- if (rcjTable.current) {
|
|
|
- rcjTable.current.replaceData([]);
|
|
|
- }
|
|
|
- setFuzhu([]);
|
|
|
- setRcjrows([]);
|
|
|
- setShowToolbar(false);
|
|
|
- setValueYuban("");
|
|
|
- setYubanEnable(false);
|
|
|
- isQdrcj.current = true;
|
|
|
- highlight.current = [];
|
|
|
- }
|
|
|
+ resetUI();
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -1268,19 +1271,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
let newData = undo();
|
|
|
myTable.current.updateData(newData).then(function(){
|
|
|
|
|
|
- selectedRowKeysTable.current = [];
|
|
|
- selectedRowKeysTableParent.current = null;
|
|
|
- setRcjhl([]);
|
|
|
- if (rcjTable.current) {
|
|
|
- rcjTable.current.replaceData([]);
|
|
|
- }
|
|
|
- setFuzhu([]);
|
|
|
- setRcjrows([]);
|
|
|
- setShowToolbar(false);
|
|
|
- setValueYuban("");
|
|
|
- setYubanEnable(false);
|
|
|
- isQdrcj.current = true;
|
|
|
- highlight.current = [];
|
|
|
+ resetUI();
|
|
|
|
|
|
|
|
|
});
|
|
|
@@ -1290,20 +1281,7 @@ export default function Qingdan3({name, bh, bt, rgde, jxde, clde, beizhu/*后台
|
|
|
<Button variant="outlined" size="small" onClick={() => {
|
|
|
let newData = redo();
|
|
|
myTable.current.updateData(newData).then(function(){
|
|
|
- selectedRowKeysTable.current = [];
|
|
|
- selectedRowKeysTableParent.current = null;
|
|
|
-
|
|
|
- setRcjhl([]);
|
|
|
- if (rcjTable.current) {
|
|
|
- rcjTable.current.replaceData([]);
|
|
|
- }
|
|
|
- setFuzhu([]);
|
|
|
- setRcjrows([]);
|
|
|
- setShowToolbar(false);
|
|
|
- setValueYuban("");
|
|
|
- setYubanEnable(false);
|
|
|
- isQdrcj.current = true;
|
|
|
- highlight.current = [];
|
|
|
+ resetUI();
|
|
|
});
|
|
|
|
|
|
|