App2.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263
  1. import * as React from 'react';
  2. import Box from "@mui/material/Box";
  3. import { styled, alpha } from '@mui/material/styles';
  4. import Paper from '@mui/material/Paper';
  5. import TextField from '@mui/material/TextField';
  6. import InputAdornment from '@mui/material/InputAdornment';
  7. import CancelIcon from '@mui/icons-material/Cancel';
  8. import Autocomplete from '@mui/material/Autocomplete';
  9. import { debounce } from '@mui/material/utils';
  10. import throttle from 'lodash/throttle';
  11. import {Tree as Tree_2} from 'rsuite';
  12. import './Tree.css';
  13. import Grid from '@mui/material/Grid';
  14. import Tab from "@mui/material/Tab";
  15. import TabContext from "@mui/lab/TabContext";
  16. import TabList from "@mui/lab/TabList";
  17. import TabPanel from "@mui/lab/TabPanel";
  18. import Qingdan3 from './Qingdan3';
  19. import Gfsj from './Gfsj';
  20. import Tbxx from './Tbxx';
  21. import Bjhz from './Bjhz';
  22. import Zjcs2 from './Zjcs2';
  23. import Djcs3 from './Djcs3';
  24. import Service from './Service';
  25. import Qufei from './Qufei';
  26. import Rcjhz from './Rcjhz';
  27. import Qtxm from './Qtxm';
  28. import Zlje from './Zlje';
  29. import Zygczgj from './Zygczgj';
  30. import Jrg from './Jrg';
  31. import Zcbfwf from './Zcbfwf';
  32. import Fbrgycl from './Fbrgycl';
  33. import {useLocation, useParams} from "react-router";
  34. import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
  35. import Typography from '@mui/material/Typography';
  36. import InputLabel from '@mui/material/InputLabel';
  37. import MenuItem from '@mui/material/MenuItem';
  38. import FormControl from '@mui/material/FormControl';
  39. import Select from '@mui/material/Select';
  40. import Accordion from '@mui/material/Accordion';
  41. import AccordionActions from '@mui/material/AccordionActions';
  42. import AccordionSummary from '@mui/material/AccordionSummary';
  43. import AccordionDetails from '@mui/material/AccordionDetails';
  44. import Stack from '@mui/material/Stack';
  45. import { DataGrid, zhCN , GridToolbarQuickFilter} from '@mui/x-data-grid';
  46. import Backdrop from '@mui/material/Backdrop';
  47. import CircularProgress from '@mui/material/CircularProgress';
  48. import Dialog from '@mui/material/Dialog';
  49. import DialogTitle from '@mui/material/DialogTitle';
  50. import DialogContent from '@mui/material/DialogContent';
  51. import DialogActions from '@mui/material/DialogActions';
  52. import IconButton from '@mui/material/IconButton';
  53. import CloseIcon from '@mui/icons-material/Close';
  54. import SearchIcon from '@mui/icons-material/Search';
  55. import Button from '@mui/material/Button';
  56. import Tooltip from '@mui/material/Tooltip';
  57. export default function App2() {
  58. const [outline, setOutline] = React.useState([]);
  59. const [peibishu, setPeibishu] = React.useState([]);
  60. const [outlineDes, setOutlineDes] = React.useState([]);
  61. const [deXilie, setDeXilie] = React.useState([]);
  62. const [pbXilie, setPbXilie] = React.useState([]);
  63. const [nest, setNest] = React.useState(false);
  64. const [qingdan, setQingdan] = React.useState(false);
  65. const [cuoshi, setCuoshi] = React.useState(false);
  66. const [tbxx, setTbxx] = React.useState(false);
  67. const [qufei, setQufei] = React.useState(false);
  68. const [rcjhz, setRcjhz] = React.useState(false);
  69. const [gfsj, setGfsj] = React.useState(false);
  70. const [bjhz, setBjhz] = React.useState(false);
  71. const [qtxm, setQtxm] = React.useState(false);
  72. const [zlje, setZlje] = React.useState(false);
  73. const [zygczgj, setZygczgj] = React.useState(false);
  74. const [jrg, setJrg] = React.useState(false);
  75. const [zcbfwf, setZcbfwf] = React.useState(false);
  76. const [fbrgycl, setFbrgycl] = React.useState(false);
  77. const [jrgData, setJrgData] = React.useState([]);
  78. const [fbrgyclData, setFbrgyclData] = React.useState([]);
  79. const [zcbfwfData, setZcbfwfData] = React.useState([]);
  80. const [zygczgjData, setZygczgjData] = React.useState([]);
  81. const [zljeData, setZljeData] = React.useState([]);
  82. const [gfsjData, setGfsjData] = React.useState([]);
  83. const [qtxmData, setQtxmData] = React.useState([]);
  84. const [bjhzData, setBjhzData] = React.useState([]);
  85. const [tbxxData, setTbxxData] = React.useState([]);
  86. const [qdbt, setQdbt] = React.useState([]);
  87. const [qdbh, setQdbh] = React.useState(null);
  88. const [value, setValue] = React.useState('1');
  89. const [dwgc, setDwgc] = React.useState(null);
  90. const [zhuanye, setZhuanye] = React.useState(10);
  91. const [zhuanye2, setZhuanye2] = 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 [beizhuFK, setBeizhuFK] = React.useState(null);
  101. const [clde, setClde] = React.useState(null);
  102. const [jxde, setJxde] = React.useState(null);
  103. const [open, setOpen] = React.useState(false);
  104. const [dopen, setDopen] = React.useState(false);
  105. const [dopen2, setDopen2] = React.useState(false);
  106. const [dingeclick, setDingeclick] = React.useState(null);
  107. const [tihuanClick, setTihuanClick] = React.useState(null);
  108. const tihuanRowRef = React.useRef(null);
  109. const relation = React.useRef({});
  110. const columns =[
  111. {field: '定额编号', headerName: '定额编号', sortable: false},
  112. {field: '名称', headerName: '名称', sortable: false},
  113. {field: '单位', headerName: '单位', sortable: false},
  114. {field: '单价', headerName: '单价', sortable: false}
  115. ];
  116. const columns2 =[
  117. {field: '编号', headerName: '定额编号', sortable: false},
  118. {field: '名称', headerName: '名称', width: 200, sortable: false},
  119. {field: '单位', headerName: '单位', sortable: false},
  120. {field: '单价', headerName: '单价', sortable: false}
  121. ];
  122. let location = useParams();
  123. const [acvalue, setAcvalue] = React.useState('');
  124. const [acinputvalue, setAcinputvalue] = React.useState('');
  125. const [options, setOptions] = React.useState([]);
  126. const [suanshiError, setSuanshiError] = React.useState(false);
  127. const [helperText, setHelperText] = React.useState('');
  128. const traverse = (shu) => {
  129. for(let i = 0; i < shu.length; i++) {
  130. let id = shu[i]["id"];
  131. let children = shu[i]["children"];
  132. for (let j = 0; j < children.length; j++) {
  133. let id2 = children[j]["id"];
  134. relation.current[id2]=id;
  135. }
  136. traverse(children);
  137. }
  138. };
  139. const setOutlineDes_ = (x) => {
  140. setOutlineDes(x);
  141. relation.current = {};
  142. traverse(x);
  143. };
  144. const handleChangeZhuanye = (event) => {
  145. //console.log(event.target.value);
  146. Service.generateDingeshu(event.target.value).then(x=>{
  147. setOutlineDes_(x);
  148. });
  149. setZhuanye(event.target.value);
  150. };
  151. const handleChangeZhuanye2 = (event) => {
  152. //console.log(event.target.value);
  153. setZhuanye2(event.target.value);
  154. };
  155. const handleChange = (event, newValue) => {
  156. setValue(newValue);
  157. setRgde(null);
  158. setJxde(null);
  159. setClde(null);
  160. };
  161. const findparent = (id) => {
  162. let result = [];
  163. while(id) {
  164. result.push(id);
  165. id = relation.current[id];
  166. }
  167. return result;
  168. };
  169. const loadingCallback = () => {
  170. setOpen(true);
  171. Service.save().then(x=>{
  172. setOpen(false);
  173. });
  174. };
  175. const suanshiCallback = () => {
  176. setDopen2(true);
  177. };
  178. const loadingCallback_djcs = () => {
  179. setOpen(true);
  180. Service.save_djcs().then(x=>{
  181. setOpen(false);
  182. });
  183. };
  184. const qufeiCallback = (id, data) => {
  185. setOpen(true);
  186. Service.applyFL(id, data).then(x=>{
  187. Service.clearCache();
  188. Service.setQufei(data);
  189. setOpen(false);
  190. });
  191. };
  192. const tihuanCallback = (row, col) => {
  193. setDopen(true);
  194. tihuanRowRef.current = row;
  195. };
  196. const tiaojiaCallback = (bh, bm, mingcheng, danwei, jiage) => {
  197. setOpen(true);
  198. Service.tiaojia(location['id'], bh, bm, mingcheng, danwei, jiage).then(x=>{
  199. setOpen(false);
  200. });
  201. };
  202. const zjcsCallback = (biao_id,bh, row) => {
  203. setOpen(true);
  204. Service.updateZjcs(biao_id, bh, row).then(x=>{
  205. setOpen(false);
  206. });
  207. };
  208. const handleClose = () => {
  209. setDopen(false);
  210. };
  211. const handleSuanshi = () => {
  212. //console.log(acinputvalue);
  213. if (/^[A-Z0-9\.\-\[\]\+\*\(\)盐常镇泰补扬南通苏新市附录]+$/.test(acinputvalue)) {
  214. //console.log();
  215. Service.generateSingleDingeXilie(zhuanye2, acinputvalue).then(x=>{
  216. let res = JSON.parse(x);
  217. let id = res['reverse'];
  218. if (id && id != "None") {
  219. setSuanshiError(false);
  220. setHelperText('');
  221. setDopen2(false);
  222. res["date"] = Date.now().toString();
  223. setDingeclick(JSON.stringify(res));
  224. } else {
  225. setSuanshiError(true);
  226. setHelperText('无效输入');
  227. console.log("error");
  228. }
  229. });
  230. } else {
  231. setSuanshiError(true);
  232. setHelperText('无效输入');
  233. console.log("error");
  234. }
  235. };
  236. const handleClose2 = () => {
  237. setDopen2(false);
  238. };
  239. const handleGenerateSingleDingeXilie = (x) => {
  240. let res = JSON.parse(x);
  241. console.log(res);
  242. setZhuanye(res["actual_zhuanye"]);
  243. let id = res['reverse'];
  244. if (id && id != "None") {
  245. setRgde(res["rgde"]);
  246. setJxde(res["jxde"]);
  247. setClde(res["clde"]);
  248. console.log(res["rgde"]);
  249. console.log(res["jxde"]);
  250. console.log(res["clde"]);
  251. setBeizhu(res["bz_selected"]);
  252. setBeizhuFK(res["bz_selected2"]);
  253. Service.generateDingeshu(res["actual_zhuanye"]).then(x=>{
  254. setOutlineDes_(x);
  255. setSelectedItems(id);
  256. setExpandedItems(findparent(id));
  257. Service.generateDingeXilie(res["actual_zhuanye"], id).then(x=>{
  258. let y = JSON.parse(x);
  259. //console.log(y);
  260. let result = [];
  261. let keys = Object.keys(y["DW"])
  262. for(let i = 0; i < keys.length; i++) {
  263. let key = keys[i];
  264. let entry = {
  265. "id": y["DEBH"][key],
  266. "定额编号": y["DEBH"][key],
  267. "名称": y["GCLMC"][key],
  268. "单位": y["DW"][key],
  269. "单价": y["GCLSJDJ"][key]
  270. };
  271. result.push(entry);
  272. }
  273. setDeXilie(result);
  274. });
  275. });
  276. } else {
  277. setRgde(null);
  278. setJxde(null);
  279. setClde(null);
  280. setBeizhu(res["bz_selected"]);
  281. }
  282. };
  283. const clickCallback = (qdbm, debh) => {
  284. console.log('####################################zylb#####################'.concat(zylb.toString()));
  285. //console.log(debh);
  286. setExpandedQd(false);
  287. setExpandedDe(true);//1 jianzhu 2 zhuangshi 3 anzhuang 4 shizheng 5 yuanlin 6 guidao 7 xiushantujian 8 xiushananzhuang 9 xiushanjiagu
  288. if (qdbm.startsWith("01")) {
  289. let suggestion = 10;
  290. if (zylb == "7") {
  291. suggestion = 50;
  292. }
  293. setZhuanye(suggestion);
  294. Service.generateSingleDingeXilie(suggestion, debh).then(x=>{
  295. handleGenerateSingleDingeXilie(x);
  296. });
  297. } else if (qdbm.startsWith("03")) {//安装
  298. let suggestion = 30;
  299. if (zylb == "8") {
  300. suggestion = 60;
  301. }
  302. setZhuanye(suggestion);
  303. Service.generateSingleDingeXilie(suggestion, debh).then(x=>{
  304. handleGenerateSingleDingeXilie(x);
  305. });
  306. } else if (qdbm.startsWith("04")) {////市政
  307. setZhuanye(20);
  308. Service.generateSingleDingeXilie(20, debh).then(x=>{
  309. handleGenerateSingleDingeXilie(x);
  310. });
  311. }
  312. else if (qdbm.startsWith("05")) {//园林
  313. setZhuanye(40);
  314. Service.generateSingleDingeXilie(40, debh).then(x=>{
  315. handleGenerateSingleDingeXilie(x);
  316. });
  317. } else {
  318. console.log('####################################zylb#####################'.concat(zylb.toString()));
  319. }
  320. };
  321. const handleEvent = (A) => {
  322. let state = {
  323. 'time': Date.now(),
  324. 'newBianhao': A.row['编号'],
  325. 'newName': A.row['名称'],
  326. 'newJia': A.row['单价'],
  327. 'old' : tihuanRowRef.current
  328. };
  329. setTihuanClick(JSON.stringify(state));
  330. setDopen(false);
  331. };
  332. const handleChangeAccord = (panel) => (event, newExpanded) => {
  333. if (panel == 'qingdan') {
  334. setExpandedQd(newExpanded);
  335. }
  336. else if (panel == 'peibi'){
  337. setExpandedPb(newExpanded);
  338. } else {
  339. setExpandedDe(newExpanded);
  340. }
  341. };
  342. const handleItemSelectionTogglePbs = (itemId, event) => {
  343. console.log(itemId);
  344. if (["0", "3", "4", "6", "7", "8", "9", "11", "12", "13", "15", "16", "18", "19", "20", "21"].includes(itemId['id'])) {
  345. Service.generatePeibiXilie(itemId['id']).then(x=>{
  346. let y = JSON.parse(x);
  347. console.log(y);
  348. let result = [];
  349. let keys = Object.keys(y["PBBH"])
  350. for(let i = 0; i < keys.length; i++) {
  351. let key = keys[i];
  352. let entry = {
  353. "id": y["id"][key],
  354. "编号": y["PBBH"][key],
  355. "名称": y["PBMC"][key],
  356. "单位": y["DW"][key],
  357. "单价": y["PBDJ"][key]
  358. };
  359. result.push(entry);
  360. //setPbXilie(result);
  361. }
  362. setPbXilie(result);
  363. });
  364. }
  365. }
  366. const handleDingEEvent = (row) => {
  367. Service.generateSingleDingeXilie(zhuanye, row.id).then(x=>{
  368. let res = JSON.parse(x);
  369. console.log(res);
  370. res["date"] = Date.now().toString();
  371. setDingeclick(JSON.stringify(res));
  372. });
  373. //
  374. };
  375. const handleItemSelectionToggleDes = (event, itemId, isSelected) => {
  376. if (isSelected) {
  377. //console.log(itemId);
  378. setSelectedItems(itemId);
  379. setExpandedItems(findparent(itemId));
  380. Service.generateDingeXilie(zhuanye, itemId).then(x=>{
  381. let y = JSON.parse(x);
  382. //console.log(y);
  383. let result = [];
  384. let keys = Object.keys(y["DW"])
  385. for(let i = 0; i < keys.length; i++) {
  386. let key = keys[i];
  387. let entry = {
  388. "id": y["DEBH"][key],
  389. "定额编号": y["DEBH"][key],
  390. "名称": y["GCLMC"][key],
  391. "单位": y["DW"][key],
  392. "单价": y["GCLSJDJ"][key]
  393. };
  394. result.push(entry);
  395. }
  396. setDeXilie(result);
  397. });
  398. }
  399. }
  400. const handleItemSelectionToggle = (event, itemId, isSelected) => {
  401. if (isSelected) {
  402. //console.log(itemId);
  403. let pos = itemId.indexOf("Zylb");
  404. let Zylb = itemId.substring(pos+4, pos+5);
  405. setZylb(Zylb);
  406. //console.log("Zylb=".concat(Zylb));
  407. if (itemId.includes("bao jia hui zong")) {
  408. let regex = /[0-9]*/;
  409. let id = itemId.match(regex)[0];
  410. Service.generateBaojiahuizong2(location["id"], id).then(x=>{
  411. setBjhzData(x);
  412. setNest(true);
  413. setQingdan(false);
  414. setCuoshi(false);
  415. setQufei(false);
  416. setRcjhz(false);
  417. setGfsj(false);
  418. setBjhz(true);
  419. setTbxx(false);
  420. setQtxm(false);
  421. setZlje(false);
  422. setZygczgj(false);
  423. setJrg(false);
  424. setZcbfwf(false);
  425. setFbrgycl(false);
  426. //setColumnHeaders(["序号", "名称", "金额", "暂估价", "类别"]);
  427. });
  428. }
  429. else if (itemId.includes("gui fei shui jin")) {
  430. let regex = /[0-9]*/;
  431. let id = itemId.match(regex)[0];
  432. Service.generateGuifeishuijin2(location["id"], id).then(x=>{
  433. setGfsjData(x);
  434. setNest(true);
  435. setQingdan(false);
  436. setCuoshi(false);
  437. setQufei(false);
  438. setRcjhz(false);
  439. setGfsj(true);
  440. setBjhz(false);
  441. setTbxx(false);
  442. setQtxm(false);
  443. setZlje(false);
  444. setZygczgj(false);
  445. setJrg(false);
  446. setZcbfwf(false);
  447. setFbrgycl(false);
  448. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础","费率", "金额", "类别"]);
  449. });
  450. }
  451. else if (itemId.includes("qing dan xiang mu")) {
  452. let regex = /[0-9]*/;
  453. let id = itemId.match(regex)[0];
  454. Service.generateQingdanxiangmu2(location["id"], id).then(x=>{
  455. setValue("1");
  456. setNest(false);
  457. setQingdan(true);
  458. setCuoshi(false);
  459. setQdbt(x);
  460. setQdbh(id);
  461. setQufei(false);
  462. setRcjhz(false);
  463. setGfsj(false);
  464. setBjhz(false);
  465. setTbxx(false);
  466. setQtxm(false);
  467. setZlje(false);
  468. setZygczgj(false);
  469. setJrg(false);
  470. setZcbfwf(false);
  471. setFbrgycl(false);
  472. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  473. });
  474. }
  475. else if (itemId.includes("cuo shi xiang mu")) {
  476. let regex = /[0-9]*/;
  477. let id = itemId.match(regex)[0];
  478. setValue("1");
  479. setNest(false);
  480. setQingdan(false);
  481. setCuoshi(true);
  482. setDwgc(id);
  483. setQufei(false);
  484. setRcjhz(false);
  485. setGfsj(false);
  486. setBjhz(false);
  487. setTbxx(false);
  488. setQtxm(false);
  489. setZlje(false);
  490. setZygczgj(false);
  491. setJrg(false);
  492. setZcbfwf(false);
  493. setFbrgycl(false);
  494. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  495. }
  496. else if (itemId.includes("qi ta xiang mu")) {
  497. let regex = /[0-9]*/;
  498. let id = itemId.match(regex)[0];
  499. setValue("1");
  500. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  501. Service.generateQitaxiangmu2(location["id"], id).then(x=>{
  502. //setNestDetail(x);
  503. setQtxmData(x);
  504. setNest(true);
  505. setQingdan(false);
  506. setCuoshi(false);
  507. setQufei(false);
  508. setRcjhz(false);
  509. setGfsj(false);
  510. setBjhz(false);
  511. setTbxx(false);
  512. setQtxm(true);
  513. setZlje(false);
  514. setZygczgj(false);
  515. setJrg(false);
  516. setZcbfwf(false);
  517. setFbrgycl(false);
  518. //setColumnHeaders(["序号", "名称", "金额", "项目类别", "备注"]);
  519. });
  520. } else if (itemId.includes("zhuan ye gong cheng zan gu jia")){
  521. let regex = /[0-9]*/;
  522. let id = itemId.match(regex)[0];
  523. setValue("1");
  524. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  525. Service.generateZygczgj(location["id"], id).then(x=>{
  526. setZygczgjData(x);
  527. setNest(false);
  528. setQingdan(false);
  529. setCuoshi(false);
  530. setQufei(false);
  531. setRcjhz(false);
  532. setGfsj(false);
  533. setBjhz(false);
  534. setTbxx(false);
  535. setQtxm(false);
  536. setZlje(false);
  537. setZygczgj(true);
  538. setJrg(false);
  539. setZcbfwf(false);
  540. setFbrgycl(false);
  541. //setColumnHeaders(["序号", "名称", "金额", "项目类别", "备注"]);
  542. });
  543. }
  544. else if (itemId.includes("zan lie jin e")) {
  545. let regex = /[0-9]*/;
  546. let id = itemId.match(regex)[0];
  547. setValue("1");
  548. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  549. Service.generateZanliejine2(location["id"], id).then(x=>{
  550. //setDetail(x);
  551. setZljeData(x);
  552. setNest(false);
  553. setQingdan(false);
  554. setCuoshi(false);
  555. setQufei(false);
  556. setRcjhz(false);
  557. setGfsj(false);
  558. setBjhz(false);
  559. setTbxx(false);
  560. setQtxm(false);
  561. setZlje(true);
  562. setZygczgj(false);
  563. setJrg(false);
  564. setZcbfwf(false);
  565. setFbrgycl(false);
  566. });
  567. }
  568. else if (itemId.includes("ji ri gong")) {
  569. let regex = /[0-9]*/;
  570. let id = itemId.match(regex)[0];
  571. setValue("1");
  572. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  573. Service.generateJirigong2(location["id"], id).then(x=>{
  574. setJrgData(x);
  575. setNest(false);
  576. setQingdan(false);
  577. setCuoshi(false);
  578. setQufei(false);
  579. setRcjhz(false);
  580. setGfsj(false);
  581. setBjhz(false);
  582. setTbxx(false);
  583. setQtxm(false);
  584. setZlje(false);
  585. setZygczgj(false);
  586. setJrg(true);
  587. setZcbfwf(false);
  588. setFbrgycl(false);
  589. });
  590. }
  591. else if (itemId.includes("zong cheng bao fu wu fei")) {
  592. let regex = /[0-9]*/;
  593. let id = itemId.match(regex)[0];
  594. setValue("1");
  595. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  596. Service.generateZongchengbaofuwufei2(location["id"], id).then(x=>{
  597. setZcbfwfData(x);
  598. setNest(false);
  599. setQingdan(false);
  600. setCuoshi(false);
  601. setQufei(false);
  602. setRcjhz(false);
  603. setGfsj(false);
  604. setBjhz(false);
  605. setTbxx(false);
  606. setQtxm(false);
  607. setZlje(false);
  608. setZygczgj(false);
  609. setJrg(false);
  610. setZcbfwf(true);
  611. setFbrgycl(false);
  612. });
  613. }
  614. else if (itemId.includes("fa bao ren gong ying cai liao")) {
  615. let regex = /[0-9]*/;
  616. let id = itemId.match(regex)[0];
  617. setValue("1");
  618. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  619. Service.generateFabaorengongyingcailiao2(location["id"], id).then(x=>{
  620. setFbrgyclData(x);
  621. setNest(false);
  622. setQingdan(false);
  623. setCuoshi(false);
  624. setQufei(false);
  625. setRcjhz(false);
  626. setGfsj(false);
  627. setBjhz(false);
  628. setTbxx(false);
  629. setQtxm(false);
  630. setZlje(false);
  631. setZygczgj(false);
  632. setJrg(false);
  633. setZcbfwf(false);
  634. setFbrgycl(true);
  635. });
  636. }
  637. else if (itemId.includes("ren cai ji hui zong")) {
  638. let regex = /[0-9]*/;
  639. let id = itemId.match(regex)[0];
  640. setValue("1");
  641. //setColumnHeaders(["序号", "名称", "取费基数", "计算基础", "金额", "类别"]);
  642. //Service.generateRencaijihuizong2(location["id"], id).then(x=>{
  643. //setDetail(x);
  644. setRcjhz(true);
  645. setNest(false);
  646. setQingdan(false);
  647. setCuoshi(false);
  648. setQufei(false);
  649. setGfsj(false);
  650. setBjhz(false);
  651. setTbxx(false);
  652. setQtxm(false);
  653. setZlje(false);
  654. setZygczgj(false);
  655. setJrg(false);
  656. setZcbfwf(false);
  657. setFbrgycl(false);
  658. setQdbh(id);
  659. //}
  660. //)
  661. ;
  662. }
  663. else if (itemId.includes("TouBiaoXx")) {
  664. Service.generateDetail2(location["id"]).then(x=>{
  665. setQingdan(false);
  666. setCuoshi(false);
  667. setTbxxData(x);
  668. setNest(false);
  669. setQufei(false);
  670. setRcjhz(false);
  671. setGfsj(false);
  672. setBjhz(false);
  673. setTbxx(true);
  674. setQtxm(false);
  675. setZlje(false);
  676. setZygczgj(false);
  677. setJrg(false);
  678. setZcbfwf(false);
  679. setFbrgycl(false);
  680. });
  681. }
  682. }
  683. };
  684. React.useEffect(
  685. () => {
  686. console.log(location);
  687. Service.generateQufei(location["id"]).then(x=>{
  688. Service.setQufei(x);
  689. });
  690. Service.generateOutline2(location["id"]).then(x=>{
  691. let y = x.map(z=>{
  692. z['key'] = z['id'];
  693. z['title'] = z['label'];
  694. z['value'] = z['id'];
  695. return z;
  696. });
  697. let y1 = y.map(
  698. z=> {
  699. if (z.hasOwnProperty('children')) {
  700. z['children'] = z['children'].map(a=>{
  701. a['key'] = a['id'];
  702. a['title'] = a['label'];
  703. a['value'] = a['id'];
  704. return a;
  705. });
  706. }
  707. return z;
  708. }
  709. );
  710. let y2 = y1.map(z=>{
  711. if (z.hasOwnProperty('children')) {
  712. let child = z['children'];
  713. for (let i = 0; i < child.length; i++) {
  714. let children = child[i];
  715. if (children.hasOwnProperty('children')) {
  716. children['children'] = children['children'].map(a=>{
  717. a['key'] = a['id'];
  718. a['title'] = a['label'];
  719. a['value'] = a['id'];
  720. return a;
  721. })
  722. }
  723. }
  724. }
  725. return z;
  726. });
  727. setOutline(y2);
  728. });
  729. Service.generateDetail2(location['id']).then(x=>{
  730. setTbxxData(x);
  731. setTbxx(true);
  732. });
  733. Service.generateDingeshu(10).then(x=>{
  734. setOutlineDes_(x);
  735. });
  736. }, [location]
  737. );
  738. React.useEffect(
  739. () => {
  740. Service.generatePeibishu(zhuanye).then(x=>{
  741. setPeibishu(x);
  742. });
  743. }, [zhuanye]
  744. );
  745. /** <MenuItem value={10}>土建</MenuItem>
  746. <MenuItem value={20}>市政</MenuItem>
  747. <MenuItem value={30}>安装</MenuItem>
  748. <MenuItem value={40}>园林</MenuItem>
  749. <MenuItem value={50}>修缮(土建)</MenuItem>
  750. <MenuItem value={60}>修缮(安装)</MenuItem> */
  751. const throttled = React.useRef(throttle((zhuanye2, newValue) => {
  752. if (zhuanye2 == 10) {
  753. Service.searchDe('土建', newValue).then(x=>{setOptions(x)});
  754. }
  755. if (zhuanye2 == 20) {
  756. Service.searchDe('市政', newValue).then(x=>{setOptions(x)});
  757. }
  758. if (zhuanye2 == 30) {
  759. Service.searchDe('安装', newValue).then(x=>{setOptions(x)});
  760. }
  761. if (zhuanye2 == 40) {
  762. Service.searchDe('园林', newValue).then(x=>{setOptions(x)});
  763. }
  764. if (zhuanye2 == 50) {
  765. Service.searchDe('修缮(土建)', newValue).then(x=>{setOptions(x)});
  766. }
  767. if (zhuanye2 == 60) {
  768. Service.searchDe('修缮(安装)', newValue).then(x=>{setOptions(x)});
  769. }
  770. }, 1000));
  771. React.useEffect(
  772. () => {
  773. throttled.current(zhuanye2, acinputvalue);
  774. }, [acinputvalue]
  775. );
  776. const onSelect = (selectedKeys, info) => {
  777. if (!selectedKeys.hasOwnProperty("children")) {
  778. console.log(selectedKeys);
  779. if (selectedKeys['id'].includes('Zylb')) {
  780. handleItemSelectionToggle(null, selectedKeys['id'], true);
  781. } else if (selectedKeys['id'].includes('TouBiaoXx')){
  782. console.log(selectedKeys);
  783. handleItemSelectionToggle(null, "Zylb1TouBiaoXx", true);
  784. }
  785. }
  786. };
  787. const onSelectDes = (selectedKeys, info) => {
  788. console.log(selectedKeys);
  789. handleItemSelectionToggleDes(null, selectedKeys['id'], true);
  790. };
  791. function CustomToolbar() {
  792. return (
  793. <Box
  794. sx={{
  795. p: 0.5,
  796. pb: 0,
  797. }}
  798. >
  799. <GridToolbarQuickFilter />
  800. </Box>
  801. );
  802. }
  803. return (
  804. <Box sx={{ flexGrow: 1 }}>
  805. <Grid container spacing={2}>
  806. <Grid item size={3}>
  807. <Box sx={{ width: '25vw'}}>
  808. <Accordion expanded={expandedQd} disableGutters
  809. onChange={handleChangeAccord('qingdan')}>
  810. <AccordionSummary
  811. expandIcon={<ExpandMoreIcon />}
  812. aria-controls="panel1-content"
  813. id="panel1-header"
  814. >
  815. <Typography component="span">清单</Typography>
  816. </AccordionSummary>
  817. <AccordionDetails>
  818. <Tree_2 height="90vh"
  819. onSelect={onSelect}
  820. data={outline}/>
  821. </AccordionDetails>
  822. </Accordion>
  823. <Accordion expanded={expandedDe} disableGutters
  824. onChange={handleChangeAccord('dinge')}>
  825. <AccordionSummary
  826. expandIcon={<ExpandMoreIcon />}
  827. aria-controls="panel1-content"
  828. id="panel1-header"
  829. >
  830. <Typography component="span">定额</Typography>
  831. </AccordionSummary>
  832. <AccordionDetails>
  833. <FormControl size="small">
  834. <InputLabel id="demo-multiple-name-label">专业</InputLabel>
  835. <Select
  836. labelId="demo-multiple-name-label"
  837. id="demo-multiple-name"
  838. value={zhuanye}
  839. onChange={handleChangeZhuanye}
  840. label="专业"
  841. >
  842. <MenuItem value={10}>土建</MenuItem>
  843. <MenuItem value={20}>市政</MenuItem>
  844. <MenuItem value={30}>安装</MenuItem>
  845. <MenuItem value={40}>园林</MenuItem>
  846. <MenuItem value={50}>修缮(土建)</MenuItem>
  847. <MenuItem value={60}>修缮(安装)</MenuItem>
  848. </Select>
  849. </FormControl>
  850. <Stack spacing={1}>
  851. <Tree_2 height="calc(100vh - 560px)"
  852. onSelect={onSelectDes}
  853. value={selectedItems}
  854. expandItemValues={expandedItems}
  855. data={outlineDes}/>
  856. <div style={{ height: 350 }}>
  857. <DataGrid
  858. sx={{
  859. '& .MuiDataGrid-cell': {
  860. fontSize: '0.8rem', // Adjust font size for cells
  861. },
  862. /* '& .MuiDataGrid-columnHeaders': {
  863. fontSize: '1rem', // Adjust font size for column headers
  864. },*/
  865. }}
  866. getRowHeight={() => 'auto'}
  867. rows={deXilie}
  868. columns={columns}
  869. hideFooter={true}
  870. disableColumnMenu
  871. onRowDoubleClick={handleDingEEvent}
  872. localeText={zhCN.components.MuiDataGrid.defaultProps.localeText}
  873. />
  874. </div>
  875. </Stack>
  876. </AccordionDetails>
  877. </Accordion>
  878. <Button variant="outlined" fullWidth onClick={()=> {
  879. setQufei(true);
  880. setQingdan(false);
  881. setCuoshi(false);
  882. setRcjhz(false);
  883. setGfsj(false);
  884. setBjhz(false);
  885. setTbxx(false);
  886. setQtxm(false);
  887. setZlje(false);
  888. setZygczgj(false);
  889. setJrg(false);
  890. setZcbfwf(false);
  891. setFbrgycl(false);
  892. }}>费率</Button>
  893. </Box>
  894. </Grid>
  895. <Grid item size={9}>
  896. {!nest && !qingdan && !cuoshi && !qufei && rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Box sx={{ width: '70vw'}}><Rcjhz
  897. id={location['id']}
  898. bh={qdbh}
  899. tiaojiaCallback={tiaojiaCallback}
  900. /></Box>}
  901. {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Zlje
  902. data={zljeData}
  903. />}
  904. {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && fbrgycl && <Fbrgycl
  905. data={fbrgyclData}
  906. />}
  907. {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && zcbfwf && !fbrgycl && <Zcbfwf
  908. data={zcbfwfData}
  909. />}
  910. {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && jrg && !zcbfwf && !fbrgycl && <Jrg
  911. data={jrgData}
  912. />}
  913. {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && zygczgj && !jrg && !zcbfwf && !fbrgycl && <Zygczgj
  914. data={zygczgjData}
  915. />}
  916. {!nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Tbxx
  917. data={tbxxData}
  918. />}
  919. {nest && !qingdan && !cuoshi && !qufei && !rcjhz && gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Gfsj
  920. data={gfsjData}
  921. />}
  922. {nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Qtxm
  923. data={qtxmData}
  924. />}
  925. {nest && !qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Bjhz
  926. data={bjhzData}
  927. />}
  928. {!qingdan && !cuoshi && qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Qufei id={location['id']} qufeiCallback={qufeiCallback}
  929. />}
  930. {!nest && qingdan && !cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Box sx={{ width: '70vw'}}><TabContext value={value}>
  931. <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
  932. <TabList scrollButtons='auto'
  933. variant="scrollable"
  934. sx={{minHeight: '24px'}}
  935. onChange={handleChange} aria-label="lab API tabs example">
  936. {qdbt.map((x, index)=> <Tab sx={{p: 0, minHeight: '24px'}} label={x} value={(index+1).toString()} />)}
  937. </TabList>
  938. </Box>
  939. {qdbt.map((x, index)=><TabPanel sx={{p: 1}} value={(index+1).toString()}>
  940. <Qingdan3
  941. name={location["id"]}
  942. bh={qdbh}
  943. bt={x}
  944. rgde={rgde}
  945. jxde={jxde}
  946. clde={clde}
  947. beizhu={beizhu}
  948. beizhuFK={beizhuFK}
  949. clickCallback={clickCallback}
  950. loadingCallback={loadingCallback}
  951. dingeclick={dingeclick}
  952. tihuanCallback={tihuanCallback}
  953. tihuanClick={tihuanClick}
  954. suanshiCallback={suanshiCallback}
  955. />
  956. </TabPanel>
  957. )}
  958. </TabContext></Box>}
  959. {!nest && !qingdan && cuoshi && !qufei && !rcjhz && !gfsj && !bjhz && !tbxx && !qtxm && !zlje && !zygczgj && !jrg && !zcbfwf && !fbrgycl && <Box sx={{ width: '70vw'}}><TabContext value={value}>
  960. <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
  961. <TabList scrollButtons='auto'
  962. variant="scrollable"
  963. sx={{minHeight: '24px'}}
  964. onChange={handleChange} aria-label="lab API tabs example">
  965. <Tab sx={{p: 0, minHeight: '24px'}} label="总价措施" value="1" />
  966. <Tab sx={{p: 0, minHeight: '24px'}} label="单价措施" value="2" />
  967. </TabList>
  968. </Box>
  969. <TabPanel sx={{p: 1}} value="1">
  970. <Zjcs2 name={location["id"]} bh={dwgc} zjcsCallback={zjcsCallback}/>
  971. </TabPanel>
  972. <TabPanel sx={{p: 1}} value="2">
  973. <Djcs3
  974. name={location["id"]}
  975. bh={dwgc}
  976. rgde={rgde}
  977. jxde={jxde}
  978. clde={clde}
  979. beizhu={beizhu}
  980. clickCallback={clickCallback}
  981. loadingCallback={loadingCallback_djcs}
  982. dingeclick={dingeclick}
  983. beizhuFK={beizhuFK}
  984. />
  985. </TabPanel>
  986. </TabContext>
  987. </Box>
  988. }
  989. </Grid>
  990. </Grid>
  991. <Backdrop
  992. sx={(theme) => ({ color: '#fff', zIndex: theme.zIndex.drawer + 1 })}
  993. open={open}
  994. >
  995. <CircularProgress color="inherit" />
  996. </Backdrop>
  997. <Dialog
  998. onClose={handleClose}
  999. aria-labelledby="customized-dialog-title"
  1000. open={dopen}
  1001. fullWidth={true}
  1002. maxWidth="md"
  1003. >
  1004. <DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
  1005. 替换
  1006. </DialogTitle>
  1007. <IconButton
  1008. aria-label="close"
  1009. onClick={handleClose}
  1010. sx={(theme) => ({
  1011. position: 'absolute',
  1012. right: 8,
  1013. top: 8,
  1014. color: theme.palette.grey[500],
  1015. })}
  1016. >
  1017. <CloseIcon />
  1018. </IconButton>
  1019. <DialogContent dividers>
  1020. <Stack direction="row" spacing={2}>
  1021. <Box sx={{ maxHeight: "350px", minWidth: "300px", maxWidth: "300px"}}>
  1022. <Tree_2
  1023. onSelect={handleItemSelectionTogglePbs}
  1024. defaultValue={null}
  1025. data={peibishu}/>
  1026. </Box>
  1027. <div style={{ height: 350 }}>
  1028. <DataGrid disableColumnMenu
  1029. sx={{
  1030. '& .MuiDataGrid-cell': {
  1031. fontSize: '0.8rem', // Adjust font size for cells
  1032. }}}
  1033. getRowHeight={() => 'auto'}
  1034. rows={pbXilie}
  1035. onRowDoubleClick={handleEvent}
  1036. columns={columns2}
  1037. hideFooter={false}
  1038. disableColumnFilter
  1039. disableColumnSelector
  1040. disableDensitySelector
  1041. slots={{ toolbar: CustomToolbar}}
  1042. localeText={zhCN.components.MuiDataGrid.defaultProps.localeText}
  1043. />
  1044. </div>
  1045. </Stack>
  1046. </DialogContent>
  1047. </Dialog>
  1048. <Dialog
  1049. onClose={handleClose2}
  1050. aria-labelledby="customized-dialog-title"
  1051. open={dopen2}
  1052. fullWidth={true}
  1053. maxWidth="md"
  1054. >
  1055. <DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
  1056. 定额(算式)
  1057. </DialogTitle>
  1058. <IconButton
  1059. aria-label="close"
  1060. onClick={handleClose2}
  1061. sx={(theme) => ({
  1062. position: 'absolute',
  1063. right: 8,
  1064. top: 8,
  1065. color: theme.palette.grey[500],
  1066. })}
  1067. >
  1068. <CloseIcon />
  1069. </IconButton>
  1070. <DialogContent dividers>
  1071. <Stack direction='row' spacing={2}>
  1072. <FormControl size="small">
  1073. <InputLabel id="demo-multiple-name-label">专业</InputLabel>
  1074. <Select
  1075. labelId="demo-multiple-name-label"
  1076. id="demo-multiple-name"
  1077. value={zhuanye2}
  1078. onChange={handleChangeZhuanye2}
  1079. label="专业"
  1080. >
  1081. <MenuItem value={10}>土建</MenuItem>
  1082. <MenuItem value={20}>市政</MenuItem>
  1083. <MenuItem value={30}>安装</MenuItem>
  1084. <MenuItem value={40}>园林</MenuItem>
  1085. <MenuItem value={50}>修缮(土建)</MenuItem>
  1086. <MenuItem value={60}>修缮(安装)</MenuItem>
  1087. </Select>
  1088. </FormControl>
  1089. <Autocomplete sx={{ width: 300 }} size="small" disableClearable
  1090. id="free-solo-demo"
  1091. freeSolo
  1092. filterOptions={(x) => x}
  1093. options={options}
  1094. value={acvalue}
  1095. inputValue={acinputvalue}
  1096. onChange={(event, newValue) => {
  1097. //setOptions(newValue ? [newValue, ...options] : options);
  1098. setAcvalue(newValue);
  1099. }}
  1100. getOptionDisabled={()=>true}
  1101. onInputChange={(event, newInputValue) => {
  1102. setAcinputvalue(newInputValue);
  1103. }}
  1104. renderInput={(params) => <TextField {...params} error={suanshiError} helperText={helperText}/>}
  1105. />
  1106. <Button variant="outlined" size="small" onClick={handleSuanshi}>确定</Button>
  1107. </Stack>
  1108. </DialogContent>
  1109. </Dialog>
  1110. </Box>
  1111. );
  1112. }