App.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. import * as React from 'react';
  2. import Box from "@mui/material/Box";
  3. import 'handsontable/dist/handsontable.full.min.css';
  4. //import 'handsontable/styles/ht-theme-main.min.css';
  5. import { HandsonTable } from 'handsontable/base';
  6. import {HotTable} from "@handsontable/react";
  7. import { registerAllModules } from 'handsontable/registry';
  8. import {RichTreeView } from "@mui/x-tree-view/RichTreeView";
  9. import { Grid } from '@mui/material';
  10. import Tab from "@mui/material/Tab";
  11. import TabContext from "@mui/lab/TabContext";
  12. import TabList from "@mui/lab/TabList";
  13. import TabPanel from "@mui/lab/TabPanel";
  14. //import { registerPlugin, NestedRows } from 'handsontable/plugins';
  15. //registerPlugin(NestedRows);
  16. import Qingdan from './Qingdan';
  17. import Zjcs from './Zjcs';
  18. import Djcs from './Djcs';
  19. import Service from './Service';
  20. import {useLocation} from "react-router";
  21. import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
  22. import Typography from '@mui/material/Typography';
  23. import InputLabel from '@mui/material/InputLabel';
  24. import MenuItem from '@mui/material/MenuItem';
  25. import FormControl from '@mui/material/FormControl';
  26. import Select from '@mui/material/Select';
  27. import Accordion from '@mui/material/Accordion';
  28. import AccordionActions from '@mui/material/AccordionActions';
  29. import AccordionSummary from '@mui/material/AccordionSummary';
  30. import AccordionDetails from '@mui/material/AccordionDetails';
  31. import Stack from '@mui/material/Stack';
  32. import { DataGrid } from '@mui/x-data-grid';
  33. registerAllModules();
  34. const MUI_X_PRODUCTS = [
  35. {
  36. id: 'grid',
  37. label: 'Data Grid',
  38. children: [
  39. { id: 'grid-community', label: '@mui/x-data-grid' },
  40. { id: 'grid-pro', label: '@mui/x-data-grid-pro' },
  41. { id: 'grid-premium', label: '@mui/x-data-grid-premium' },
  42. ],
  43. },
  44. {
  45. id: 'pickers',
  46. label: 'Date and Time Pickers',
  47. children: [
  48. { id: 'pickers-community', label: '@mui/x-date-pickers' },
  49. { id: 'pickers-pro', label: '@mui/x-date-pickers-pro' },
  50. ],
  51. },
  52. {
  53. id: 'charts',
  54. label: 'Charts',
  55. children: [
  56. { id: 'charts-community', label: '@mui/x-charts' },
  57. { id: 'charts-pro', label: '@mui/charts-pro' },
  58. ],
  59. },
  60. {
  61. id: 'tree-view',
  62. label: 'Tree View',
  63. children: [
  64. { id: 'tree-view-community', label: '@mui/x-tree-view' },
  65. { id: 'tree-view-pro', label: '@mui/x-tree-view-pro' },
  66. ],
  67. },
  68. ];
  69. const INFO = [
  70. ['', 'Tesla', 'Volvo', 'Toyota', 'Ford'],
  71. ['2019', 10, 11, 12, 13],
  72. ['2020', 20, 11, 14, 13],
  73. ['2021', 30, 15, 12, 13]
  74. ];
  75. export default function App() {
  76. const [outline, setOutline] = React.useState([]);
  77. const [peibishu, setPeibishu] = React.useState([]);
  78. const [outlineDes, setOutlineDes] = React.useState([]);
  79. const [columnHeaders, setColumnHeaders] = React.useState([]);
  80. const [detail, setDetail] = React.useState(INFO);
  81. const [deXilie, setDeXilie] = React.useState([]);
  82. const [pbXilie, setPbXilie] = React.useState([]);
  83. const [nestDetail, setNestDetail] = React.useState(INFO);
  84. const [nest, setNest] = React.useState(false);
  85. const [qingdan, setQingdan] = React.useState(false);
  86. const [cuoshi, setCuoshi] = React.useState(false);
  87. const [qdbt, setQdbt] = React.useState([]);
  88. const [qdbh, setQdbh] = React.useState(null);
  89. const [value, setValue] = React.useState('1');
  90. const [dwgc, setDwgc] = React.useState(null);
  91. const [zhuanye, setZhuanye] = React.useState(10);
  92. const [expandedQd, setExpandedQd] = React.useState(true);
  93. const [expandedPb, setExpandedPb] = React.useState(false);
  94. const [expandedDe, setExpandedDe] = React.useState(false);
  95. const [zylb, setZylb] = React.useState('');
  96. const [selectedItems, setSelectedItems] = React.useState(null);
  97. const [expandedItems, setExpandedItems] = React.useState([]);
  98. const [rgde, setRgde] = React.useState(null);
  99. const [beizhu, setBeizhu] = React.useState(null);
  100. const [clde, setClde] = React.useState(null);
  101. const [jxde, setJxde] = React.useState(null);
  102. const relation = React.useRef({});
  103. const columns =[
  104. {field: '定额编号', headerName: '定额编号'},
  105. {field: '名称', headerName: '名称'},
  106. {field: '单位', headerName: '单位'},
  107. {field: '单价', headerName: '单价'}
  108. ];
  109. const columns2 =[
  110. {field: '编号', headerName: '定额编号'},
  111. {field: '名称', headerName: '名称'},
  112. {field: '单位', headerName: '单位'},
  113. {field: '单价', headerName: '单价'}
  114. ];
  115. let location = useLocation();
  116. const traverse = (shu) => {
  117. for(let i = 0; i < shu.length; i++) {
  118. let id = shu[i]["id"];
  119. let children = shu[i]["children"];
  120. for (let j = 0; j < children.length; j++) {
  121. let id2 = children[j]["id"];
  122. relation.current[id2]=id;
  123. }
  124. traverse(children);
  125. }
  126. };
  127. const setOutlineDes_ = (x) => {
  128. setOutlineDes(x);
  129. relation.current = {};
  130. traverse(x);
  131. };
  132. const handleChangeZhuanye = (event) => {
  133. //console.log(event.target.value);
  134. Service.generateDingeshu(event.target.value).then(x=>{
  135. setOutlineDes_(x);
  136. });
  137. setZhuanye(event.target.value);
  138. };
  139. const handleChange = (event, newValue) => {
  140. setValue(newValue);
  141. };
  142. const findparent = (id) => {
  143. let result = [];
  144. while(id) {
  145. result.push(id);
  146. id = relation.current[id];
  147. }
  148. return result;
  149. };
  150. const clickCallback = (qdbm, debh) => {
  151. console.log('####################################zylb#####################'.concat(zylb.toString()));
  152. //console.log(debh);
  153. setExpandedQd(false);
  154. setExpandedDe(true);//1 jianzhu 2 zhuangshi 3 anzhuang 4 shizheng 5 yuanlin 6 guidao 7 xiushantujian 8 xiushananzhuang 9 xiushanjiagu
  155. if (qdbm.startsWith("01")) {
  156. let suggestion = 10;
  157. if (zylb == "7") {
  158. suggestion = 50;
  159. }
  160. setZhuanye(suggestion);
  161. Service.generateSingleDingeXilie(suggestion, debh).then(x=>{
  162. //console.log(x);
  163. let res = JSON.parse(x);
  164. console.log(res);
  165. setZhuanye(res["actual_zhuanye"]);
  166. let id = res['reverse'];
  167. if (id && id != "None") {
  168. setRgde(res["rgde"]);
  169. setJxde(res["jxde"]);
  170. setClde(res["clde"]);
  171. console.log(res["rgde"]);
  172. console.log(res["jxde"]);
  173. console.log(res["clde"]);
  174. setBeizhu(res["bz_selected"]);
  175. Service.generateDingeshu(res["actual_zhuanye"]).then(x=>{
  176. setOutlineDes_(x);
  177. setSelectedItems(id);
  178. setExpandedItems(findparent(id));
  179. Service.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
  180. let y = JSON.parse(x);
  181. //console.log(y);
  182. let result = [];
  183. let keys = Object.keys(y["DW"])
  184. for(let i = 0; i < keys.length; i++) {
  185. let key = keys[i];
  186. let entry = {
  187. "id": y["DEBH"][key],
  188. "定额编号": y["DEBH"][key],
  189. "名称": y["GCLMC"][key],
  190. "单位": y["DW"][key],
  191. "单价": y["GCLSJDJ"][key]
  192. };
  193. result.push(entry);
  194. }
  195. setDeXilie(result);
  196. });
  197. });
  198. } else {
  199. setRgde(null);
  200. setJxde(null);
  201. setClde(null);
  202. setBeizhu(res["bz_selected"]);
  203. }
  204. });
  205. } else if (qdbm.startsWith("03")) {//安装
  206. let suggestion = 30;
  207. if (zylb == "8") {
  208. suggestion = 60;
  209. }
  210. setZhuanye(suggestion);
  211. Service.generateSingleDingeXilie(suggestion, debh).then(x=>{
  212. //console.log(x);
  213. let res = JSON.parse(x);
  214. console.log(res);
  215. setZhuanye(res["actual_zhuanye"]);
  216. let id = res['reverse'];
  217. if (id && id != "None") {
  218. setRgde(res["rgde"]);
  219. setJxde(res["jxde"]);
  220. setClde(res["clde"]);
  221. console.log(res["rgde"]);
  222. console.log(res["jxde"]);
  223. console.log(res["clde"]);
  224. setBeizhu(res["bz_selected"]);
  225. Service.generateDingeshu(res["actual_zhuanye"]).then(x=>{
  226. setOutlineDes_(x);
  227. setSelectedItems(id);
  228. setExpandedItems(findparent(id));
  229. Service.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
  230. let y = JSON.parse(x);
  231. //console.log(y);
  232. let result = [];
  233. let keys = Object.keys(y["DW"])
  234. for(let i = 0; i < keys.length; i++) {
  235. let key = keys[i];
  236. let entry = {
  237. "id": y["DEBH"][key],
  238. "定额编号": y["DEBH"][key],
  239. "名称": y["GCLMC"][key],
  240. "单位": y["DW"][key],
  241. "单价": y["GCLSJDJ"][key]
  242. };
  243. result.push(entry);
  244. }
  245. setDeXilie(result);
  246. });
  247. });
  248. } else {
  249. setRgde(null);
  250. setJxde(null);
  251. setClde(null);
  252. setBeizhu(res["bz_selected"]);
  253. }
  254. });
  255. } else if (qdbm.startsWith("04")) {////市政
  256. setZhuanye(20);
  257. Service.generateSingleDingeXilie(20, debh).then(x=>{
  258. //console.log(x);
  259. let res = JSON.parse(x);
  260. console.log(res);
  261. setZhuanye(res["actual_zhuanye"]);
  262. let id = res['reverse'];
  263. if (id && id != "None") {
  264. setRgde(res["rgde"]);
  265. setJxde(res["jxde"]);
  266. setClde(res["clde"]);
  267. console.log(res["rgde"]);
  268. console.log(res["jxde"]);
  269. console.log(res["clde"]);
  270. setBeizhu(res["bz_selected"]);
  271. Service.generateDingeshu(res["actual_zhuanye"]).then(x=>{
  272. setOutlineDes_(x);
  273. setSelectedItems(id);
  274. setExpandedItems(findparent(id));
  275. Service.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
  276. let y = JSON.parse(x);
  277. //console.log(y);
  278. let result = [];
  279. let keys = Object.keys(y["DW"])
  280. for(let i = 0; i < keys.length; i++) {
  281. let key = keys[i];
  282. let entry = {
  283. "id": y["DEBH"][key],
  284. "定额编号": y["DEBH"][key],
  285. "名称": y["GCLMC"][key],
  286. "单位": y["DW"][key],
  287. "单价": y["GCLSJDJ"][key]
  288. };
  289. result.push(entry);
  290. }
  291. setDeXilie(result);
  292. });
  293. });
  294. } else {
  295. setRgde(null);
  296. setJxde(null);
  297. setClde(null);
  298. setBeizhu(res["bz_selected"]);
  299. }
  300. });
  301. }
  302. else if (qdbm.startsWith("05")) {//园林
  303. setZhuanye(40);
  304. Service.generateSingleDingeXilie(40, debh).then(x=>{
  305. //console.log(x);
  306. let res = JSON.parse(x);
  307. console.log(res);
  308. setZhuanye(res["actual_zhuanye"]);
  309. let id = res['reverse'];
  310. if (id && id != "None") {
  311. setRgde(res["rgde"]);
  312. setJxde(res["jxde"]);
  313. setClde(res["clde"]);
  314. console.log(res["rgde"]);
  315. console.log(res["jxde"]);
  316. console.log(res["clde"]);
  317. setBeizhu(res["bz_selected"]);
  318. Service.generateDingeshu(res["actual_zhuanye"]).then(x=>{
  319. setOutlineDes_(x);
  320. setSelectedItems(id);
  321. setExpandedItems(findparent(id));
  322. Service.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
  323. let y = JSON.parse(x);
  324. //console.log(y);
  325. let result = [];
  326. let keys = Object.keys(y["DW"])
  327. for(let i = 0; i < keys.length; i++) {
  328. let key = keys[i];
  329. let entry = {
  330. "id": y["DEBH"][key],
  331. "定额编号": y["DEBH"][key],
  332. "名称": y["GCLMC"][key],
  333. "单位": y["DW"][key],
  334. "单价": y["GCLSJDJ"][key]
  335. };
  336. result.push(entry);
  337. }
  338. setDeXilie(result);
  339. });
  340. });
  341. } else {
  342. setRgde(null);
  343. setJxde(null);
  344. setClde(null);
  345. setBeizhu(res["bz_selected"]);
  346. }
  347. });
  348. } else {
  349. console.log('####################################zylb#####################'.concat(zylb.toString()));
  350. }
  351. };
  352. const handleChangeAccord = (panel) => (event, newExpanded) => {
  353. if (panel == 'qingdan') {
  354. setExpandedQd(newExpanded);
  355. }
  356. else if (panel == 'peibi'){
  357. setExpandedPb(newExpanded);
  358. } else {
  359. setExpandedDe(newExpanded);
  360. }
  361. };
  362. const handleItemSelectionTogglePbs = (event, itemId, isSelected) => {
  363. if (isSelected) {
  364. console.log(itemId);
  365. if (["3", "4", "6", "7", "8", "9", "11", "12", "13", "15", "16", "18", "19", "20", "21"].includes(itemId)) {
  366. Service.generatePeibiXilie(itemId).then(x=>{
  367. let y = JSON.parse(x);
  368. console.log(y);
  369. let result = [];
  370. let keys = Object.keys(y["PBBH"])
  371. for(let i = 0; i < keys.length; i++) {
  372. let key = keys[i];
  373. let entry = {
  374. "id": y["id"][key],
  375. "编号": y["PBBH"][key],
  376. "名称": y["PBMC"][key],
  377. "单位": y["DW"][key],
  378. "单价": y["PBDJ"][key]
  379. };
  380. result.push(entry);
  381. setPbXilie(result);
  382. }
  383. });
  384. }
  385. }
  386. }
  387. const handleItemSelectionToggleDes = (event, itemId, isSelected) => {
  388. if (isSelected) {
  389. //console.log(itemId);
  390. setSelectedItems(itemId);
  391. setExpandedItems(findparent(itemId));
  392. Service.generateDingeXilie(zhuanye, itemId).then(x=>{
  393. let y = JSON.parse(x);
  394. //console.log(y);
  395. let result = [];
  396. let keys = Object.keys(y["DW"])
  397. for(let i = 0; i < keys.length; i++) {
  398. let key = keys[i];
  399. let entry = {
  400. "id": y["DEBH"][key],
  401. "定额编号": y["DEBH"][key],
  402. "名称": y["GCLMC"][key],
  403. "单位": y["DW"][key],
  404. "单价": y["GCLSJDJ"][key]
  405. };
  406. result.push(entry);
  407. }
  408. setDeXilie(result);
  409. });
  410. }
  411. }
  412. const handleItemSelectionToggle = (event, itemId, isSelected) => {
  413. if (isSelected) {
  414. //console.log(itemId);
  415. let pos = itemId.indexOf("Zylb");
  416. let Zylb = itemId.substring(pos+4, pos+5);
  417. setZylb(Zylb);
  418. //console.log("Zylb=".concat(Zylb));
  419. if (itemId.includes("bao jia hui zong")) {
  420. let regex = /[0-9]*/;
  421. let id = itemId.match(regex)[0];
  422. Service.generateBaojiahuizong(location.state.name, id).then(x=>{
  423. setNestDetail(x);
  424. setNest(true);
  425. setQingdan(false);
  426. setCuoshi(false);
  427. setColumnHeaders(["序号", "名称", "金额", "暂估价", "类别"]);
  428. });
  429. }
  430. else if (itemId.includes("gui fei shui jin")) {
  431. let regex = /[0-9]*/;
  432. let id = itemId.match(regex)[0];
  433. Service.generateGuifeishuijin(location.state.name, id).then(x=>{
  434. setNestDetail(x);
  435. setNest(true);
  436. setQingdan(false);
  437. setCuoshi(false);
  438. setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  439. });
  440. }
  441. else if (itemId.includes("qing dan xiang mu")) {
  442. let regex = /[0-9]*/;
  443. let id = itemId.match(regex)[0];
  444. Service.generateQingdanxiangmu(location.state.name, id).then(x=>{
  445. setValue("1");
  446. setNest(false);
  447. setQingdan(true);
  448. setCuoshi(false);
  449. setQdbt(x);
  450. setQdbh(id);
  451. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  452. });
  453. }
  454. else if (itemId.includes("cuo shi xiang mu")) {
  455. let regex = /[0-9]*/;
  456. let id = itemId.match(regex)[0];
  457. setValue("1");
  458. setNest(false);
  459. setQingdan(false);
  460. setCuoshi(true);
  461. setDwgc(id);
  462. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  463. }
  464. else if (itemId.includes("qi ta xiang mu")) {
  465. let regex = /[0-9]*/;
  466. let id = itemId.match(regex)[0];
  467. setValue("1");
  468. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  469. Service.generateQitaxiangmu(location.state.name, id).then(x=>{
  470. setNestDetail(x);
  471. setNest(true);
  472. setQingdan(false);
  473. setCuoshi(false);
  474. setColumnHeaders(["序号", "名称", "金额", "项目类别", "备注"]);
  475. });
  476. }
  477. else if (itemId.includes("zan lie jin e")) {
  478. let regex = /[0-9]*/;
  479. let id = itemId.match(regex)[0];
  480. setValue("1");
  481. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  482. Service.generateZanliejine(location.state.name, id).then(x=>{
  483. setDetail(x);
  484. setNest(false);
  485. setQingdan(false);
  486. setCuoshi(false);
  487. });
  488. }
  489. else if (itemId.includes("ji ri gong")) {
  490. let regex = /[0-9]*/;
  491. let id = itemId.match(regex)[0];
  492. setValue("1");
  493. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  494. Service.generateJirigong(location.state.name, id).then(x=>{
  495. setDetail(x);
  496. setNest(false);
  497. setQingdan(false);
  498. setCuoshi(false);
  499. });
  500. }
  501. else if (itemId.includes("zong cheng bao fu wu fei")) {
  502. let regex = /[0-9]*/;
  503. let id = itemId.match(regex)[0];
  504. setValue("1");
  505. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  506. Service.generateZongchengbaofuwufei(location.state.name, id).then(x=>{
  507. setDetail(x);
  508. setNest(false);
  509. setQingdan(false);
  510. setCuoshi(false);
  511. });
  512. }
  513. else if (itemId.includes("fa bao ren gong ying cai liao")) {
  514. let regex = /[0-9]*/;
  515. let id = itemId.match(regex)[0];
  516. setValue("1");
  517. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  518. Service.generateFabaorengongyingcailiao(location.state.name, id).then(x=>{
  519. setDetail(x);
  520. setNest(false);
  521. setQingdan(false);
  522. setCuoshi(false);
  523. });
  524. }
  525. else if (itemId.includes("ren cai ji hui zong")) {
  526. let regex = /[0-9]*/;
  527. let id = itemId.match(regex)[0];
  528. setValue("1");
  529. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  530. Service.generateRencaijihuizong(location.state.name, id).then(x=>{
  531. setDetail(x);
  532. setNest(false);
  533. setQingdan(false);
  534. setCuoshi(false);
  535. });
  536. }
  537. else if (itemId.includes("TouBiaoXx")) {
  538. Service.generateDetail(location.state.name).then(x=>{
  539. setQingdan(false);
  540. setCuoshi(false);
  541. setDetail(x);
  542. setNest(false);
  543. });
  544. }
  545. }
  546. };
  547. React.useEffect(
  548. () => {
  549. //console.log(location.state.name);
  550. Service.generateOutline(location.state.name).then(x=>{
  551. setOutline(x);
  552. });
  553. Service.generateDetail(location.state.name).then(x=>{
  554. setDetail(x);
  555. });
  556. Service.generateDingeshu(10).then(x=>{
  557. setOutlineDes_(x);
  558. });
  559. }, [location]
  560. );
  561. React.useEffect(
  562. () => {
  563. Service.generatePeibishu(zhuanye).then(x=>{
  564. setPeibishu(x);
  565. });
  566. }, [zhuanye]
  567. );
  568. return (
  569. <Box sx={{ flexGrow: 1 }}>
  570. <Grid container spacing={2}>
  571. <Grid size={3}>
  572. <Accordion expanded={expandedQd}
  573. onChange={handleChangeAccord('qingdan')}>
  574. <AccordionSummary
  575. expandIcon={<ExpandMoreIcon />}
  576. aria-controls="panel1-content"
  577. id="panel1-header"
  578. >
  579. <Typography component="span">清单</Typography>
  580. </AccordionSummary>
  581. <AccordionDetails>
  582. <RichTreeView sx={{overflow: "scroll", maxHeight: "98vh"}}
  583. onItemSelectionToggle={handleItemSelectionToggle}
  584. items={outline}/>
  585. </AccordionDetails>
  586. </Accordion>
  587. <Accordion expanded={expandedDe}
  588. onChange={handleChangeAccord('dinge')}>
  589. <AccordionSummary
  590. expandIcon={<ExpandMoreIcon />}
  591. aria-controls="panel1-content"
  592. id="panel1-header"
  593. >
  594. <Typography component="span">定额</Typography>
  595. </AccordionSummary>
  596. <AccordionDetails>
  597. <FormControl fullWidth>
  598. <InputLabel id="demo-multiple-name-label">专业</InputLabel>
  599. <Select
  600. labelId="demo-multiple-name-label"
  601. id="demo-multiple-name"
  602. value={zhuanye}
  603. onChange={handleChangeZhuanye}
  604. label="专业"
  605. >
  606. <MenuItem value={10}>土建</MenuItem>
  607. <MenuItem value={20}>市政</MenuItem>
  608. <MenuItem value={30}>安装</MenuItem>
  609. <MenuItem value={40}>园林</MenuItem>
  610. <MenuItem value={50}>修缮(土建)</MenuItem>
  611. <MenuItem value={60}>修缮(安装)</MenuItem>
  612. </Select>
  613. </FormControl>
  614. <Stack spacing={2}>
  615. <RichTreeView sx={{overflow: "scroll", maxHeight: "48vh"}}
  616. onItemSelectionToggle={handleItemSelectionToggleDes}
  617. selectedItems={selectedItems}
  618. expandedItems={expandedItems}
  619. items={outlineDes}/>
  620. <div style={{ height: 350 }}>
  621. <DataGrid
  622. getRowHeight={() => 'auto'}
  623. rows={deXilie}
  624. columns={columns}
  625. hideFooter={true}
  626. />
  627. </div>
  628. </Stack>
  629. </AccordionDetails>
  630. </Accordion>
  631. <Accordion expanded={expandedPb}
  632. onChange={handleChangeAccord('peibi')}>
  633. <AccordionSummary
  634. expandIcon={<ExpandMoreIcon />}
  635. aria-controls="panel1-content"
  636. id="panel1-header"
  637. >
  638. <Typography component="span">配合比</Typography>
  639. </AccordionSummary>
  640. <AccordionDetails>
  641. <Stack spacing={2}>
  642. <RichTreeView sx={{overflow: "scroll", maxHeight: "38vh"}}
  643. onItemSelectionToggle={handleItemSelectionTogglePbs}
  644. items={peibishu}/>
  645. <div style={{ height: 350 }}>
  646. <DataGrid
  647. getRowHeight={() => 'auto'}
  648. rows={pbXilie}
  649. columns={columns2}
  650. hideFooter={true}
  651. />
  652. </div>
  653. </Stack>
  654. </AccordionDetails>
  655. </Accordion>
  656. </Grid>
  657. <Grid size={9}>
  658. {!nest && !qingdan && !cuoshi && <HotTable nestedRows={false}
  659. data={detail
  660. }
  661. rowHeaders={true}
  662. colHeaders={true}
  663. fixedRowsTop={1}
  664. height="800"
  665. readOnly={true}
  666. autoWrapRow={false}
  667. autoWrapCol={false}
  668. licenseKey="non-commercial-and-evaluation" // for non-commercial use only
  669. />}
  670. {nest && !qingdan && !cuoshi && <HotTable nestedRows={true}
  671. data={nestDetail
  672. }
  673. readOnly={true}
  674. fixedRowsTop={1}
  675. rowHeaders={true}
  676. colHeaders={columnHeaders}
  677. height="auto"
  678. contextMenu={true}
  679. bindRowsWithHeaders={true}
  680. autoWrapRow={false}
  681. autoWrapCol={false}
  682. licenseKey="non-commercial-and-evaluation" // for non-commercial use only
  683. />}
  684. {!nest && qingdan && !cuoshi && <TabContext value={value}>
  685. <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
  686. <TabList scrollButtons='auto'
  687. variant="scrollable"
  688. onChange={handleChange} aria-label="lab API tabs example">
  689. {qdbt.map((x, index)=> <Tab label={x} value={(index+1).toString()} />)}
  690. </TabList>
  691. </Box>
  692. {qdbt.map((x, index)=><TabPanel value={(index+1).toString()}>
  693. <Qingdan
  694. name={location.state.name}
  695. bh={qdbh}
  696. bt={x}
  697. rgde={rgde}
  698. jxde={jxde}
  699. clde={clde}
  700. beizhu={beizhu}
  701. clickCallback={clickCallback}
  702. />
  703. </TabPanel>
  704. )}
  705. </TabContext>}
  706. {!nest && !qingdan && cuoshi && <TabContext value={value}>
  707. <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
  708. <TabList scrollButtons='auto'
  709. variant="scrollable"
  710. onChange={handleChange} aria-label="lab API tabs example">
  711. <Tab label="总价措施" value="1" />
  712. <Tab label="单价措施" value="2" />
  713. </TabList>
  714. </Box>
  715. <TabPanel value="1">
  716. <Zjcs name={location.state.name} bh={dwgc}/>
  717. </TabPanel>
  718. <TabPanel value="2">
  719. <Djcs
  720. name={location.state.name}
  721. bh={dwgc}
  722. rgde={rgde}
  723. jxde={jxde}
  724. clde={clde}
  725. beizhu={beizhu}
  726. clickCallback={clickCallback}
  727. />
  728. </TabPanel>
  729. </TabContext>}
  730. </Grid>
  731. </Grid>
  732. </Box>
  733. );
  734. }