index.tsx 85 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786
  1. /*
  2. * @Author: code4eat awesomedema@gmail.com
  3. * @Date: 2022-12-16 09:42:52
  4. * @LastEditors: code4eat awesomedema@gmail.com
  5. * @LastEditTime: 2023-03-31 12:41:30
  6. * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import BMSPagecontainer from '@/components/BMSPageContainer';
  10. import { useEffect, useRef, useState } from 'react';
  11. import './style.less';
  12. import { Tree, TreeProps, Tabs, Input, Modal, Transfer, Divider, Select, Popconfirm, message, Button, Skeleton, Popover } from 'antd';
  13. import { DataNode } from 'antd/es/tree';
  14. import expandedIcon from '../../../../static/treenode_open.png';
  15. import closeIcon from '../../../../static/treenode_collapse.png';
  16. import { BMSTable } from '@/components/BMSTable';
  17. import { ActionType, ModalForm, ProColumns, ProColumnType, ProForm, ProFormDependency, ProFormDigit, ProFormInstance, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-components';
  18. import { createFromIconfontCN } from '@ant-design/icons';
  19. import { addTableData, checkMonthlyReq, delTableDataRequest, downloadTemplateReq, editCheckProject, editManaIndexTableData, editTableData, editTableSalaryRequest, generateCheckProjectTableData, getCheckItemCalcStatus, getCheckProjectTableData, getCostData, getDepLists, getEmps, getHesuanUnits, getIncomeData, getManaIndexGroup, getManaIndexTableData, getNoCheckTableData, getPageCheckStatus, getProjects, getSalaryInfoTableData, importMonthlyperformanceRelaFiles } from './service';
  20. import { TransferDirection } from 'antd/es/transfer';
  21. import editIcon from '../../../../static/editIcon.png';
  22. import conformIcon from '../../../../static/confirmIcon.png';
  23. import { getComputeDate } from '@/pages/Home/service';
  24. import BMSModalForm from '@/components/BMSModalForm';
  25. import { DefaultOptionType } from 'antd/es/select';
  26. import { getTreeData, getTreeDataRespType } from '../monthlyInfoCheck/service';
  27. import DirectoryTree from 'antd/es/tree/DirectoryTree';
  28. import BMSUpload from '@/components/BMSUpload';
  29. import FormItem from 'antd/es/form/FormItem';
  30. import { getDeepestTreeData } from '@/utils/tooljs';
  31. const IconFont = createFromIconfontCN({
  32. scriptUrl: '//at.alicdn.com/t/c/font_1927152_4nm5kxbv4m3.js',
  33. });
  34. export type TableListItem = {
  35. key: number;
  36. name: string;
  37. };
  38. const MonthlyDataCheck: React.FC = () => {
  39. const [treeData, set_treeData] = useState<getTreeDataRespType[]>([]);
  40. const [ifShowTip, set_ifShowTip] = useState(false);
  41. const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
  42. const [searchValue, setSearchValue] = useState('');
  43. const [autoExpandParent, setAutoExpandParent] = useState(true);
  44. const [auditType, set_auditType] = useState('0');
  45. const [tableColumn, set_tableColumn] = useState<ProColumns & { [key: string]: any }[]>([]);
  46. const [currentSelectedTreeNode, set_currentSelectedTreeNode] = useState<any | undefined>();
  47. const [currentSelectedTabKey, set_currentSelectedTabKey] = useState<string>('1');
  48. const [currentComputeDate, set_currentComputeDate] = useState<string | undefined>(undefined);
  49. const [editTableCellId, set_editTableCellId] = useState<number | undefined>(undefined);
  50. const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
  51. const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>(undefined);
  52. const [editModalVisible, set_editModalVisible] = useState(false);
  53. const [loading, set_loading] = useState(false);
  54. const [currentEditRecord, set_currentEditRecord] = useState<undefined | any>(undefined);
  55. const [inputSalaryNum, set_inputSalaryNum] = useState(0); //固定工资金额
  56. const [checkItemvalNum, set_checkItemvalNum] = useState(0); //考核项目数值
  57. const [isTableEdit, set_isTableEdit] = useState(false);
  58. const [totalNum, set_totalNum] = useState(0); //收入和成本数据的总和数值
  59. const [tableH,set_tableH] = useState(0);
  60. const [manaIndexGroups, set_manaIndexGroups] = useState<{ id: number, groupCode: string, groupName: string, hospId: number }[]>([]); //管理指标分组
  61. const [currentSelectedManaGroup, set_currentSelectedManaGroup] = useState<{ id: number, groupCode: string, groupName: string, hospId: number }>();
  62. const formRef = useRef<ProFormInstance>();
  63. const tableRef = useRef<ActionType>();
  64. const tableColumnOne = [
  65. {
  66. title: '职类',
  67. dataIndex: 'unitTypeName',
  68. key: 'unitTypeName',
  69. },
  70. {
  71. title: '核算单元名称',
  72. dataIndex: 'unitName',
  73. key: 'unitName',
  74. },
  75. {
  76. title: '科室',
  77. dataIndex: 'deptName',
  78. key: 'deptName',
  79. },
  80. {
  81. title: '工号',
  82. dataIndex: 'empNo',
  83. key: 'empNo',
  84. },
  85. {
  86. title: '姓名',
  87. dataIndex: 'empName',
  88. key: 'empName',
  89. },
  90. {
  91. title: '工资类型',
  92. dataIndex: 'salaryType',
  93. key: 'salaryType',
  94. },
  95. ]
  96. const tableColumnTwo = [
  97. {
  98. title: '职类',
  99. dataIndex: 'unitTypeName',
  100. key: 'unitTypeName',
  101. },
  102. {
  103. title: '核算单元名称',
  104. dataIndex: 'unitName',
  105. key: 'unitName',
  106. },
  107. {
  108. title: '科室',
  109. dataIndex: 'deptName',
  110. key: 'deptName',
  111. },
  112. {
  113. title: '项目名称',
  114. dataIndex: 'assessmentName',
  115. key: 'assessmentName',
  116. },
  117. {
  118. title: '分配方式',
  119. dataIndex: 'distributionType',
  120. key: 'distributionType',
  121. render: (record: any) => {
  122. if (record == 1) return '占比'
  123. if (record == 2) return '绝对数'
  124. if (record == 3) return '自动计算'
  125. }
  126. },
  127. {
  128. title: '数值',
  129. dataIndex: 'value',
  130. key: 'value',
  131. },
  132. {
  133. title: '工号',
  134. dataIndex: 'targetValue',
  135. key: 'targetValue',
  136. },
  137. {
  138. title: '姓名',
  139. dataIndex: 'targetValueName',
  140. key: 'targetValueName',
  141. },
  142. {
  143. title: '说明',
  144. dataIndex: 'description',
  145. key: 'description',
  146. }
  147. ];
  148. const tableColumnThree = [
  149. {
  150. title: '项目名称',
  151. dataIndex: 'itemName',
  152. key: 'itemName',
  153. },
  154. {
  155. title: '类型',
  156. dataIndex: 'itemTypeName',
  157. key: 'itemTypeName',
  158. },
  159. {
  160. title: '点值',
  161. dataIndex: 'orderPointValue',
  162. key: 'orderPointValue',
  163. },
  164. ];
  165. const tableColumnFive = [
  166. {
  167. title: '年度',
  168. dataIndex: 'year',
  169. key: 'year',
  170. },
  171. {
  172. title: '月份',
  173. dataIndex: 'month',
  174. key: 'month',
  175. },
  176. {
  177. title: '项目名称',
  178. dataIndex: 'itemName',
  179. key: 'itemName',
  180. },
  181. {
  182. title: '项目类型',
  183. dataIndex: 'itemTypeName',
  184. key: 'itemTypeName',
  185. },
  186. {
  187. title: '金额',
  188. dataIndex: 'cost',
  189. key: 'cost',
  190. },
  191. // {
  192. // title: '操作人',
  193. // dataIndex: 'unitType',
  194. // key: 'unitType',
  195. // align: 'center'
  196. // },
  197. // {
  198. // title: '操作时间',
  199. // dataIndex: 'unitType',
  200. // key: 'unitType',
  201. // align: 'center'
  202. // },
  203. ]
  204. let inervalhander = undefined;
  205. const getCurrentComputeDate = async () => {
  206. const resp = await getComputeDate();
  207. set_currentComputeDate(resp);
  208. }
  209. const onSelectHandle: TreeProps['onSelect'] = (selectedKeys, info) => {
  210. const { node } = info;
  211. //set_tableDataFilterParams({...tableDataFilterParams,current:1})
  212. set_currentSelectedTreeNode(node);
  213. };
  214. const onExpand = (newExpandedKeys: React.Key[]) => {
  215. setExpandedKeys(newExpandedKeys);
  216. setAutoExpandParent(false);
  217. };
  218. //固定金额编辑金额
  219. const editHandle = async (record: any) => {
  220. const { id, deptCode, salaryType, unitCode, userId } = record;
  221. if (id == editTableCellId) {
  222. //保存
  223. // console.log({ inputSalaryNum,currentSelectedTreeNode });
  224. if (inputSalaryNum) {
  225. const resp = await editTableSalaryRequest({
  226. computeDate: currentComputeDate as string,
  227. unitCode,
  228. deptCode, salaryType,
  229. salary: inputSalaryNum,
  230. userId: `${userId}`,
  231. id
  232. });
  233. if (resp) {
  234. tableRef.current?.reload();
  235. }
  236. }
  237. set_editTableCellId(undefined);
  238. } else {
  239. //编辑
  240. set_editTableCellId(id);
  241. }
  242. }
  243. //考核项目编辑数值
  244. const editCheckItemValHandle = async (record: any) => {
  245. const { id, itemCode, itemName, itemType, orderPointValue, executePointValue, hospId, unitCode } = record;
  246. if (id == editTableCellId) {
  247. //保存
  248. if (checkItemvalNum) {
  249. const resp = await editCheckProject({
  250. computeDate: currentComputeDate as string,
  251. itemCode,
  252. itemName,
  253. itemType,
  254. orderPointValue,
  255. value: checkItemvalNum,
  256. executePointValue,
  257. hospId,
  258. unitCode,
  259. id
  260. });
  261. if (resp) {
  262. tableRef.current?.reload();
  263. }
  264. }
  265. set_editTableCellId(undefined);
  266. } else {
  267. //编辑
  268. set_editTableCellId(id);
  269. }
  270. }
  271. const checkProjectEditHandle = (record: any) => {
  272. // console.log({record});
  273. const { props: { record: _record } } = record;
  274. set_currentEditRecord(_record);
  275. set_editModalVisible(true);
  276. }
  277. const tableDataAddHandle = () => {
  278. set_editModalVisible(true);
  279. }
  280. //表格行编辑
  281. const tableEditActHandle = (record: any) => {
  282. //console.log({'edit':record});
  283. set_isTableEdit(true);
  284. set_currentEditRecord(record);
  285. set_editModalVisible(true);
  286. }
  287. //管理指标row编辑
  288. const EditManaIndexTableRow = ({ record }: { record: any }) => {
  289. const { value, columns, unitName, id, unitCode, totalScore, computeDate, groupId } = record;
  290. return (
  291. <ModalForm
  292. title={`编辑${unitName}实际值`}
  293. width={500}
  294. // layout='inline'
  295. trigger={
  296. <a key={'1'} style={{ textAlign: 'center', width: '100%' }}>编辑</a>
  297. }
  298. initialValues={record}
  299. onFinish={async (values) => {
  300. const editResult = value.map((a: any) => {
  301. return {
  302. ...a,
  303. value: values[`value${a.code}`]
  304. }
  305. })
  306. const data = {
  307. id,
  308. unitCode,
  309. unitName,
  310. totalScore,
  311. computeDate,
  312. groupId,
  313. value: editResult
  314. }
  315. const resp = await editManaIndexTableData(data);
  316. if (resp) {
  317. tableRef.current?.reload();
  318. }
  319. return true
  320. }}
  321. >
  322. {
  323. value.map((item: any, index: any) => {
  324. const findTitle = columns.filter((a: any) => a.key == item.code);
  325. return (
  326. findTitle.length > 0 ? <ProFormDigit key={index} label={`${findTitle[0].dataIndex}`} name={`value${item.code}`} min={1} max={10} /> : null
  327. )
  328. })
  329. }
  330. </ModalForm>
  331. )
  332. }
  333. const onTabChange = (activeKey: string) => {
  334. set_currentSelectedTabKey(activeKey);
  335. }
  336. //获取核算单元树结构
  337. const getCheckUnitTreeDataFunc = async (computeDate: string) => {
  338. const resp = await getTreeData(computeDate);
  339. if (resp) {
  340. set_treeData(resp);
  341. }
  342. }
  343. const getCalcStatus =async () => {
  344. const resp = await getCheckItemCalcStatus(currentComputeDate as string,'ASSESSMENT');
  345. if(resp){
  346. if(resp.calculating){
  347. //继续计算
  348. set_loading(true);
  349. return false
  350. }else{
  351. //计算已完成
  352. set_loading(false);
  353. return true
  354. }
  355. }else{
  356. tableRef.current?.reload();
  357. return true
  358. }
  359. }
  360. const getTableData = async (type: '1' | '2' | '3' | '4' | '5' | '6', params: any, sort: any, filter: any) => {
  361. if (currentComputeDate) {
  362. if (type == '1') {
  363. const resp = await getSalaryInfoTableData({
  364. computeDate: currentComputeDate,
  365. ...params
  366. });
  367. if (resp) {
  368. return {
  369. data: resp.list,
  370. total: resp.totalCount,
  371. pageSize: resp.pageSize,
  372. totalPage: resp.totalPage,
  373. success: true
  374. }
  375. }
  376. }
  377. if (type == '2') {
  378. const resp = await getNoCheckTableData({
  379. computeDate: currentComputeDate,
  380. ...params
  381. });
  382. if (resp) {
  383. return {
  384. data: resp.list,
  385. total: resp.totalCount,
  386. pageSize: resp.pageSize,
  387. totalPage: resp.totalPage,
  388. success: true
  389. }
  390. }
  391. }
  392. if (type == '3') {
  393. if(!loading){
  394. //计算完和未计算
  395. const resp = await getCheckProjectTableData({
  396. computeDate: currentComputeDate,
  397. unitCode: currentSelectedTreeNode.code,
  398. ...params
  399. });
  400. if (resp) {
  401. return {
  402. data: resp.list,
  403. success: true,
  404. total: resp.totalCount,
  405. pageSize: resp.pageSize,
  406. totalPage: resp.totalPage,
  407. }
  408. }
  409. }
  410. }
  411. if (type == '4') {
  412. if (currentSelectedManaGroup) {
  413. const resp = await getManaIndexTableData({ ...params, computeDate: currentComputeDate, groupId: currentSelectedManaGroup.id });
  414. if (resp) {
  415. const columns = resp.title.map((item: any) => (item.children ? {
  416. title: () => {
  417. return <div>{item.name} <span style={{ fontSize: 14, fontFamily: 'SourceHanSansCN-Medium, SourceHanSansCN', fontWeight: 500, color: item.arrow == 'up' ? '#00BF8F' : '#FF4060' }}>{item.arrow == 'up' ? '↑' : '↓'}</span></div>
  418. },
  419. key: item.code,
  420. dataIndex: item.name,
  421. children: item.children.map((a: any) => {
  422. return {
  423. title: a.name,
  424. dataIndex: `${a.code}${item.code}`,
  425. key: `${a.code}${item.code}`,
  426. width: 100,
  427. align: 'center',
  428. }
  429. })
  430. } : {
  431. title: item.name,
  432. dataIndex: item.code,
  433. key: item.code,
  434. width: 100,
  435. align: 'center',
  436. }));
  437. set_tableColumn([{
  438. title: '核算单元',
  439. dataIndex: 'unitName',
  440. key: 'unitName',
  441. width: 120,
  442. fixed: 'left',
  443. }, ...columns,
  444. {
  445. title: '总得分',
  446. dataIndex: 'totalScore',
  447. key: 'totalScore',
  448. width: 100,
  449. fixed: 'right',
  450. },
  451. ]);
  452. const data = resp.managerData.map((item: any) => {
  453. let rowData: { [key: string]: any } = {};
  454. for (let index = 0; index < item.value.length; index++) {
  455. for (const key in item.value[index]) {
  456. if (key != 'code') {
  457. rowData[`${key}${item.value[index].code}`] = item.value[index][`${key}`]
  458. }
  459. }
  460. }
  461. return { ...item, ...rowData, id: item.id, columns }
  462. });
  463. return {
  464. data: data,
  465. success: true,
  466. total: resp.totalCount,
  467. pageSize: resp.pageSize,
  468. totalPage: resp.totalPage,
  469. }
  470. }
  471. }
  472. }
  473. if (type == '5') {
  474. const resp = await getIncomeData({
  475. computeDate: currentComputeDate,
  476. ...params
  477. });
  478. if (resp) {
  479. set_totalNum(resp.sum);
  480. return {
  481. data: resp.pageList.list,
  482. success: true,
  483. total: resp.pageList.totalCount,
  484. pageSize: resp.pageList.pageSize,
  485. totalPage: resp.pageList.totalPage,
  486. }
  487. }
  488. }
  489. if (type == '6') {
  490. const resp = await getCostData({
  491. computeDate: currentComputeDate,
  492. ...params
  493. });
  494. if (resp) {
  495. set_totalNum(resp.sum);
  496. return {
  497. data: resp.pageList.list,
  498. success: true,
  499. total: resp.pageList.totalCount,
  500. pageSize: resp.pageList.pageSize,
  501. totalPage: resp.pageList.totalPage,
  502. }
  503. }
  504. }
  505. }
  506. return []
  507. }
  508. const tableDataSearchHandle = (paramName: string) => {
  509. set_tableDataFilterParams({
  510. ...tableDataFilterParams,
  511. [`${paramName}`]: tableDataSearchKeywords
  512. })
  513. }
  514. //表格删除确认
  515. const delActionHandle = async (record: any, index: number) => {
  516. const { id } = record;
  517. const resp = await delTableDataRequest({
  518. computeDate: currentComputeDate as string,
  519. id,
  520. index
  521. });
  522. if (resp) {
  523. tableRef.current?.reload();
  524. message.success('删除成功!')
  525. }
  526. };
  527. interface RecordType {
  528. key: string;
  529. title: string;
  530. description: string;
  531. }
  532. const mockData: RecordType[] = Array.from({ length: 20 }).map((_, i) => ({
  533. key: i.toString(),
  534. title: `content${i + 1}`,
  535. description: `description of content${i + 1}`,
  536. }));
  537. const initialTargetKeys = mockData.filter((item) => Number(item.key) > 10).map((item) => item.key);
  538. const TransferNode = () => {
  539. const [targetKeys, setTargetKeys] = useState(initialTargetKeys);
  540. const [selectedKeys, setSelectedKeys] = useState<string[]>([]);
  541. const onChange = (nextTargetKeys: string[], direction: TransferDirection, moveKeys: string[]) => {
  542. console.log('targetKeys:', nextTargetKeys);
  543. console.log('direction:', direction);
  544. console.log('moveKeys:', moveKeys);
  545. setTargetKeys(nextTargetKeys);
  546. };
  547. const onSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => {
  548. console.log('sourceSelectedKeys:', sourceSelectedKeys);
  549. console.log('targetSelectedKeys:', targetSelectedKeys);
  550. setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
  551. };
  552. return (
  553. <Transfer
  554. dataSource={mockData}
  555. titles={['未添加人员', '已添加人员']}
  556. targetKeys={targetKeys}
  557. selectedKeys={selectedKeys}
  558. onChange={onChange}
  559. listStyle={{
  560. width: '45%'
  561. }}
  562. onSelectChange={onSelectChange}
  563. render={(item) => item.title}
  564. />
  565. )
  566. }
  567. const dataList: any[] = [];
  568. const generateList = (data: getTreeDataRespType[]) => {
  569. for (let i = 0; i < data.length; i++) {
  570. const node = data[i];
  571. const { code, name } = node;
  572. dataList.push({ code: code, name: name });
  573. if (node.child) {
  574. generateList(node.child);
  575. }
  576. }
  577. };
  578. generateList(treeData as any);
  579. const getParentKey = (key: React.Key, tree: any[]): React.Key => {
  580. let parentKey: React.Key;
  581. for (let i = 0; i < tree.length; i++) {
  582. const node = tree[i];
  583. if (node.child) {
  584. if (node.child.some((item: { code: React.Key; }) => item.code === key)) {
  585. parentKey = node.code;
  586. } else if (getParentKey(key, node.child)) {
  587. parentKey = getParentKey(key, node.child);
  588. }
  589. }
  590. }
  591. return parentKey!;
  592. };
  593. //考核项目树结构搜索
  594. const onTreeSearchKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => {
  595. const { value } = e.target;
  596. const newExpandedKeys = dataList
  597. .map((item) => {
  598. if (item.name.indexOf(value) > -1) {
  599. return getParentKey(item.code, treeData);
  600. }
  601. return null;
  602. });
  603. const b = newExpandedKeys.filter((item, i, self) => item && self.indexOf(item) === i);
  604. setExpandedKeys(newExpandedKeys as React.Key[]);
  605. setSearchValue(value);
  606. setAutoExpandParent(true);
  607. }
  608. //获取数据
  609. const confirmGenerateHandle: any = async (index: number, others?: any) => {
  610. if (index == 3) {
  611. const resp = await generateCheckProjectTableData({
  612. computeDate: currentComputeDate as string,
  613. unitCode: others ? currentSelectedTreeNode.code : ''
  614. });
  615. set_loading(false);
  616. if (resp) {
  617. tableRef.current?.reload();
  618. }
  619. return Promise.resolve(true);
  620. }
  621. }
  622. const generateFunc = (index: number, others?: any) => {
  623. /**
  624. * index 获取的表格类型下标
  625. */
  626. if (index == 3&&!loading) {
  627. Modal.confirm({
  628. title: '注意',
  629. cancelText: '',
  630. closable: true,
  631. content: others ? '获取单个操作会覆盖上次获取的该核算单元的数据,确定要继续操作?' : '获取所有操作会覆盖所有已获取的数据,确定要继续操作?',
  632. onOk: () => { set_loading(true);confirmGenerateHandle(index,others) }
  633. })
  634. }
  635. }
  636. const onVisibleChangeHandle = (bool: boolean) => {
  637. set_editModalVisible(bool);
  638. if (!bool) {
  639. set_isTableEdit(false);
  640. }
  641. }
  642. const onManaIndexGroupClick = (manaIndexGroup: any) => {
  643. set_currentSelectedManaGroup(manaIndexGroup);
  644. }
  645. const tableFormCommit = async (formData: any, type: 'edit' | 'add') => {
  646. if (type == 'edit') {
  647. //编辑
  648. const body = {
  649. id: currentEditRecord.id,
  650. computeDate: currentComputeDate as string,
  651. unitCode: formData.unitCode,
  652. deptCode: formData.deptCode,
  653. nonAssessmentCode: typeof formData.assessmentCode == 'number' ? formData.assessmentCode : formData.assessmentCode.value,
  654. targetValue: `${formData.userId?formData.userId:''}`,
  655. value: `${formData.value}`,
  656. description: formData.description
  657. }
  658. const resp = await editTableData(body);
  659. if (resp) {
  660. tableRef.current?.reload();
  661. }
  662. set_isTableEdit(false);
  663. } else if (type == 'add') {
  664. //新增
  665. const body = {
  666. computeDate: currentComputeDate as string,
  667. unitCode: formData.unitCode,
  668. deptCode: formData.deptCode,
  669. nonAssessmentCode: formData.assessmentCode.value,
  670. targetValue: `${formData.userId?formData.userId:''}`,
  671. value: `${formData.value}`,
  672. description: formData.description
  673. }
  674. const resp = await addTableData(body);
  675. if (resp) {
  676. tableRef.current?.reload();
  677. }
  678. }
  679. // set_editModalVisible(false);
  680. set_currentEditRecord(undefined);
  681. return true;
  682. }
  683. //获取管理指标分组
  684. const getManaIndiGroupRequest = async () => {
  685. const resp = await getManaIndexGroup();
  686. if (resp) {
  687. set_manaIndexGroups(resp);
  688. if (resp.length > 0) {
  689. // const titleResp = await getManaIndexTableData({ computeDate: currentComputeDate as string, groupId: resp[0].groupCode });
  690. // if (titleResp) {
  691. // const columns = titleResp.title.map((item: any) => (item.children ? {
  692. // title: () => {
  693. // return <div>{item.name} <span style={{ fontSize: 14, fontFamily: 'SourceHanSansCN-Medium, SourceHanSansCN', fontWeight: 500, color: item.arrow == 'up' ? '#00BF8F' : '#FF4060' }}>↓</span></div>
  694. // },
  695. // key: item.code,
  696. // dataIndex: item.name,
  697. // children: item.children.map((a: any) => {
  698. // return {
  699. // title: a.name,
  700. // dataIndex: `${a.code}${item.code}`,
  701. // key: `${a.code}${item.code}`,
  702. // width: 100,
  703. // align: 'center',
  704. // }
  705. // })
  706. // } : {
  707. // title: item.name,
  708. // dataIndex: item.code,
  709. // key: item.code,
  710. // width: 100,
  711. // align: 'center',
  712. // }));
  713. // set_tableColumn([{
  714. // title: '核算单元',
  715. // dataIndex: 'unitName',
  716. // key: 'unitName',
  717. // align: 'center',
  718. // width: 120,
  719. // fixed: 'left',
  720. // }, ...columns,
  721. // {
  722. // title: '总得分',
  723. // dataIndex: 'totalScore',
  724. // key: 'totalScore',
  725. // align: 'center',
  726. // width: 100,
  727. // fixed:'right',
  728. // },
  729. // {
  730. // title: '操作',
  731. // key: 'option',
  732. // valueType: 'option',
  733. // width: 100,
  734. // align: 'center',
  735. // fixed: 'right',
  736. // render: (_: any, record: any) => [
  737. // <EditManaIndexTableRow record={record} key={'edit'} />
  738. // ],
  739. // }]);
  740. // }
  741. set_currentSelectedManaGroup(resp[0])
  742. }
  743. }
  744. }
  745. const importData = (index: number, name: string) => {
  746. return (
  747. <ModalForm
  748. width={360}
  749. title={`导入${name}数据`}
  750. trigger={
  751. <span key="3">导入</span>
  752. }
  753. submitter={{
  754. render: (props, defaultDoms) => {
  755. const needBtn = defaultDoms.filter((b) => {
  756. return b.key != 'rest'
  757. })
  758. return [
  759. // <Button
  760. // key="ok"
  761. // onClick={auditType == '0' ? () => downloadTemplate(index) : () => { }}
  762. // >
  763. // 下载模板
  764. // </Button>,
  765. ...needBtn,
  766. ];
  767. },
  768. }}
  769. onFinish={async (values) => {
  770. // console.log({values});
  771. const { importFile: { fileList } } = values;
  772. let formData = new FormData();
  773. formData.append('file', fileList[0].originFileObj);
  774. formData.append('computeDate', currentComputeDate as string);
  775. const resp = await importMonthlyperformanceRelaFiles(index, formData);
  776. if (resp) {
  777. tableRef.current?.reload();
  778. return true;
  779. }
  780. }}
  781. >
  782. <FormItem name={'importFile'}>
  783. <BMSUpload downloadTemplateFile={auditType == '0' ? () => downloadTemplate(index) : () => { }} />
  784. </FormItem>
  785. </ModalForm>
  786. )
  787. }
  788. const checkHandle = async (type: string) => {
  789. const resp = await checkMonthlyReq(
  790. currentComputeDate as string,
  791. type == '0' ? '1' : '0', //审核类型 1审核 0取消审核
  792. );
  793. if (resp) {
  794. if (type == '0') {
  795. message.success('审核提交成功!');
  796. set_auditType('1');
  797. }
  798. if (type == '1') {
  799. message.success('取消审核提交成功!');
  800. set_auditType('0');
  801. }
  802. }
  803. }
  804. const pageCheckStatusFunc = async (time: string) => {
  805. const resp = await getPageCheckStatus(time);
  806. if (resp) {
  807. set_auditType(`${resp}`); //0 未审核 1 已审核
  808. }
  809. }
  810. const downloadTemplate = async (index: number, id?: number) => {
  811. await downloadTemplateReq(index, id);
  812. }
  813. const handleResize = (e:any)=>{
  814. const wH = e.target.innerHeight;
  815. const tableHeight = wH - 320;
  816. set_tableH(tableHeight);
  817. }
  818. function doResize(){
  819. setTimeout(() => {
  820. const ev: any = new Event('resize');
  821. window.dispatchEvent(ev);
  822. },0)
  823. }
  824. useEffect(()=>{
  825. if(loading){
  826. inervalhander = setInterval(()=>{
  827. getCalcStatus();
  828. },60000)
  829. }
  830. },[loading])
  831. useEffect(() => {
  832. console.log({currentSelectedManaGroup});
  833. set_tableDataFilterParams({
  834. ...tableDataFilterParams,
  835. id: currentSelectedManaGroup?.id,
  836. });
  837. }, [currentSelectedManaGroup]);
  838. useEffect(() => {
  839. tableRef.current?.reloadAndRest && tableRef.current?.reloadAndRest();
  840. }, [currentSelectedTreeNode]);
  841. useEffect(() => {
  842. //清空表格筛选项
  843. set_tableDataFilterParams(undefined);
  844. set_currentSelectedTreeNode(undefined);
  845. if (currentSelectedTabKey == '1') {
  846. set_tableColumn(tableColumnOne as ProColumns[]);
  847. }
  848. if (currentSelectedTabKey == '2') {
  849. set_tableColumn(tableColumnTwo as ProColumns[]);
  850. }
  851. if (currentSelectedTabKey == '3') {
  852. if (currentComputeDate) {
  853. getCheckUnitTreeDataFunc(currentComputeDate as string);
  854. }
  855. set_tableColumn(tableColumnThree as ProColumns[]);
  856. }
  857. if (currentSelectedTabKey == '4') {
  858. getManaIndiGroupRequest(); //获取分组
  859. }
  860. if (currentSelectedTabKey == '5') {
  861. set_tableColumn(tableColumnFive as ProColumns[]);
  862. }
  863. if (currentSelectedTabKey == '6') {
  864. set_tableColumn(tableColumnFive as ProColumns[]);
  865. }
  866. }, [currentSelectedTabKey]);
  867. useEffect(() => {
  868. //初始化左侧树结构数据后
  869. if (treeData?.length > 0) {
  870. if (treeData[0].child && treeData[0].child.length > 0) {
  871. const [node, nodeParent] = getDeepestTreeData(treeData[0], 'child');
  872. set_currentSelectedTreeNode(node);
  873. setExpandedKeys([nodeParent.code]);
  874. }
  875. }
  876. }, [treeData]);
  877. useEffect(() => {
  878. if (currentComputeDate) {
  879. pageCheckStatusFunc(currentComputeDate); //获取页面查核状态
  880. getCalcStatus();
  881. }
  882. }, [currentComputeDate]);
  883. useEffect(() => {
  884. getCurrentComputeDate();
  885. set_tableColumn(tableColumnOne as ProColumns[]);
  886. window.addEventListener('resize',(e)=>handleResize(e)) //监听窗口大小改变
  887. doResize();
  888. return ()=>{
  889. window.removeEventListener('resize',(e)=>handleResize(e));
  890. }
  891. }, [])
  892. return (
  893. <div className='MonthlyDataCheck'>
  894. {
  895. true && (
  896. <BMSModalForm formRef={formRef} visible={editModalVisible} initialValues={isTableEdit ? { ...currentEditRecord } : {}} title={isTableEdit ? '编辑' : '新增'}
  897. size="middle" width={737} onVisibleChange={onVisibleChangeHandle}
  898. modalProps={{
  899. destroyOnClose: true
  900. }}
  901. onFinish={(val: any) => tableFormCommit(val, isTableEdit ? 'edit' : 'add')}
  902. >
  903. {
  904. currentSelectedTabKey == '1' && (
  905. <>
  906. <ProFormText width="md" name="itemName" label="项目名" disabled />
  907. <ProFormText width="md" name="itemTypeName" label="类型" disabled />
  908. <ProFormDigit width="md" label="点值" name="pointValue" min={0} />
  909. <ProFormText width="md" name="createUser" label="操作人" disabled />
  910. </>
  911. )
  912. }
  913. {
  914. currentSelectedTabKey == '2' && (
  915. <>
  916. <ProForm.Group >
  917. <ProFormSelect
  918. name="deptCode"
  919. label="科室名称"
  920. placeholder="请选择"
  921. colProps={{ span: 12 }}
  922. rules={[{ required: true }]}
  923. request={async () => {
  924. const resp = await getDepLists();
  925. if (resp) {
  926. return resp.map((a: any) => ({
  927. label: a.deptName, value: a.deptCode, d: a
  928. }))
  929. }
  930. return []
  931. }}
  932. fieldProps={{
  933. showSearch: true,
  934. onChange: (value) => {
  935. formRef.current?.setFieldValue('unitCode', '');
  936. }
  937. }}
  938. />
  939. <ProFormDependency name={['deptCode']}>
  940. {
  941. ({ deptCode }) => {
  942. // console.log({deptCode});
  943. return (
  944. <ProFormSelect
  945. disabled={deptCode ? false : true}
  946. name="unitCode"
  947. label="核算单元"
  948. colProps={{ span: 12 }}
  949. placeholder="请选择"
  950. rules={[{ required: true }]}
  951. params={deptCode}
  952. request={async () => {
  953. if (deptCode) {
  954. const resp = await getHesuanUnits(deptCode);
  955. if (resp) {
  956. return resp.map((a: any) => ({
  957. label: a.unitName, value: a.unitCode, d: a
  958. }))
  959. }
  960. }
  961. return []
  962. }}
  963. fieldProps={{
  964. showSearch: true,
  965. onChange: (value) => {
  966. formRef.current?.setFieldValue('targetValue', '');
  967. }
  968. }}
  969. />
  970. )
  971. }
  972. }
  973. </ProFormDependency>
  974. </ProForm.Group>
  975. <ProForm.Group>
  976. <ProFormSelect
  977. name="assessmentCode"
  978. label="项目名称"
  979. placeholder="请选择"
  980. colProps={{ span: 12 }}
  981. rules={[{ required: true }]}
  982. request={async () => {
  983. const resp = await getProjects();
  984. if (resp) {
  985. return resp.map((a: any) => ({
  986. label: a.name, value: a.code, d: a
  987. }))
  988. }
  989. return []
  990. }}
  991. fieldProps={{
  992. labelInValue: true,
  993. onChange: (value) => {
  994. const { d: { distributionTypeName } } = value;
  995. formRef.current?.setFieldValue('distributionTypeName', distributionTypeName);
  996. }
  997. }}
  998. />
  999. <ProFormDependency name={['assessmentCode']}>
  1000. {
  1001. ({ assessmentCode }) => {
  1002. return (
  1003. <ProFormText disabled name="distributionTypeName" label="分配方式" colProps={{ span: 12 }} />
  1004. )
  1005. }
  1006. }
  1007. </ProFormDependency>
  1008. </ProForm.Group>
  1009. <ProForm.Group>
  1010. <ProFormDigit label="数值" name="value" colProps={{ span: 12 }} min={-1000000000000000} />
  1011. <ProFormDependency name={['unitCode', 'distributionTypeName']}>
  1012. {
  1013. ({ unitCode, distributionTypeName }) => {
  1014. return (
  1015. <ProFormSelect
  1016. name="userId"
  1017. label="人员姓名"
  1018. colProps={{ span: 12 }}
  1019. placeholder="请选择"
  1020. rules={[{ required: distributionTypeName != '占比' ? true : false }]}
  1021. params={unitCode}
  1022. fieldProps={{
  1023. showSearch: true,
  1024. }}
  1025. request={async () => {
  1026. if (unitCode) {
  1027. const resp = await getEmps(unitCode);
  1028. if (resp) {
  1029. return resp.map((a: any) => ({
  1030. label: a.name, value: a.userId, d: a
  1031. }))
  1032. }
  1033. }
  1034. return []
  1035. }}
  1036. />
  1037. )
  1038. }
  1039. }
  1040. </ProFormDependency>
  1041. </ProForm.Group>
  1042. <ProForm.Group >
  1043. <ProFormTextArea
  1044. name="description"
  1045. label="说明"
  1046. colProps={{ span: 24 }}
  1047. placeholder="请输入"
  1048. />
  1049. </ProForm.Group>
  1050. </>
  1051. )
  1052. }
  1053. </BMSModalForm>
  1054. )
  1055. }
  1056. <>
  1057. {
  1058. (
  1059. <div className='rightContent'>
  1060. <BMSPagecontainer title={`核算年月:${currentComputeDate}`} ghost>
  1061. <div className='checkBtn' onClick={() => checkHandle(`${auditType}`)}>{auditType == '0' ? '审核' : '取消审核'}</div>
  1062. {/* <div className='midLine'>
  1063. <span>点击检查</span>
  1064. 是否有未对照的人员信息、未对照的科室信息及未设置的收费项目信息
  1065. </div> */}
  1066. <Tabs
  1067. defaultActiveKey="1"
  1068. onChange={onTabChange}
  1069. items={[
  1070. {
  1071. label: `固定工资`,
  1072. key: '1',
  1073. },
  1074. {
  1075. label: `非考核项目`,
  1076. key: '2',
  1077. },
  1078. {
  1079. label: `考核项目`,
  1080. key: '3',
  1081. },
  1082. {
  1083. label: `管理指标`,
  1084. key: '4',
  1085. },
  1086. {
  1087. label: `收入数据`,
  1088. key: '5',
  1089. },
  1090. {
  1091. label: `成本数据`,
  1092. key: '6',
  1093. },
  1094. ]}
  1095. />
  1096. {
  1097. currentSelectedTabKey == '1' && (
  1098. <div className='tabContent'>
  1099. <div className='tableToolbar'>
  1100. <div className='filter'>
  1101. <div className='search'>
  1102. <span>科室名称:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1103. set_tableDataSearchKeywords(e.target.value);
  1104. if (e.target.value.length == 0) {
  1105. set_tableDataFilterParams({
  1106. ...tableDataFilterParams,
  1107. deptName: ''
  1108. });
  1109. }
  1110. }} suffix={
  1111. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('deptName')} />
  1112. } />
  1113. </div>
  1114. </div>
  1115. <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} placement='topRight'>
  1116. <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
  1117. onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
  1118. onMouseLeave={() => set_ifShowTip(false)}
  1119. >
  1120. {/* <span key="1">调整</span> */}
  1121. {/* <span key="2" onClick={() => generateFunc()}>获取</span> */}
  1122. {importData(1, '固定工资')}
  1123. </div>
  1124. </Popover>
  1125. </div>
  1126. {currentComputeDate && <BMSTable actionRef={tableRef} params={tableDataFilterParams} rowKey='id'
  1127. columns={auditType == '0' ? [...tableColumn, {
  1128. title: '金额',
  1129. dataIndex: 'salary',
  1130. key: 'salary',
  1131. align: 'center',
  1132. width: '10%',
  1133. render: (text: any, record: any) => {
  1134. return (
  1135. <div style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center' }}>
  1136. <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
  1137. {
  1138. editTableCellId == record.id ? <Input size='small' defaultValue={record.salary} placeholder='请输入' onChange={(e) => { set_inputSalaryNum(Number(e.target.value)) }} style={{ width: '80px' }} /> : <span>{text}</span>
  1139. }
  1140. </div>
  1141. {auditType == '0' && <img onClick={() => editHandle(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={editTableCellId == record.id ? conformIcon : editIcon} alt="" />}
  1142. </div>
  1143. )
  1144. }
  1145. },
  1146. {
  1147. title: '操作',
  1148. key: 'option',
  1149. valueType: 'option',
  1150. render: (_: any, record) => [
  1151. <Popconfirm
  1152. key={'del'}
  1153. title="是否确认删除?"
  1154. onConfirm={() => delActionHandle(record, 1)}
  1155. // onCancel={()=>{}}
  1156. okText="是"
  1157. cancelText="否"
  1158. >
  1159. <a >删除</a>
  1160. </Popconfirm>
  1161. ],
  1162. },] : [
  1163. ...tableColumn, {
  1164. title: '金额',
  1165. dataIndex: 'salary',
  1166. key: 'salary',
  1167. width: '10%',
  1168. // shouldCellUpdate:(record:any, prevRecord:any) => true,
  1169. render: (text: any, record: any) => {
  1170. return (
  1171. <div style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center' }}>
  1172. <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
  1173. {
  1174. editTableCellId == record.id ? <Input size='small' defaultValue={record.salary} placeholder='请输入' onChange={(e) => { set_inputSalaryNum(Number(e.target.value)) }} style={{ width: '80px' }} /> : <span>{text}</span>
  1175. }
  1176. </div>
  1177. {auditType == '0' && <img onClick={() => editHandle(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={editTableCellId == record.id ? conformIcon : editIcon} alt="" />}
  1178. </div>
  1179. )
  1180. }
  1181. },
  1182. ]} request={(params, sort, filter) => getTableData('1', params, sort, filter)} />}
  1183. </div>
  1184. )
  1185. }
  1186. {
  1187. currentSelectedTabKey == '2' && (
  1188. <div className='tabContent'>
  1189. <div className='tableToolbar'>
  1190. <div className='filter'>
  1191. <div className='search'>
  1192. <span>科室名称:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1193. set_tableDataSearchKeywords(e.target.value);
  1194. if (e.target.value.length == 0) {
  1195. set_tableDataFilterParams({
  1196. ...tableDataFilterParams,
  1197. deptName: ''
  1198. });
  1199. }
  1200. }} suffix={
  1201. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('deptName')} />
  1202. } />
  1203. </div>
  1204. </div>
  1205. <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
  1206. <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
  1207. onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
  1208. onMouseLeave={() => set_ifShowTip(false)}
  1209. >
  1210. {/* <span key="1" onClick={() => generateFunc(2)} >获取</span>
  1211. <span key="2" >导入</span> */}
  1212. {importData(2, '非考核项目')}
  1213. <span key="3" onClick={auditType == '0' ? () => tableDataAddHandle() : () => { }}>添加</span>
  1214. </div>
  1215. </Popover>
  1216. </div>
  1217. {currentComputeDate && <BMSTable scroll={{ x: 120 * 10, y: 500 }} actionRef={tableRef} rowKey='id' params={tableDataFilterParams}
  1218. columns={auditType == '0' ? [...tableColumn, {
  1219. title: '操作',
  1220. fixed: 'right',
  1221. key: 'option',
  1222. width: 130,
  1223. valueType: 'option',
  1224. render: (_: any, record: any) => [
  1225. <a key={'edit'} onClick={() => tableEditActHandle(record)}>编辑</a>,
  1226. <Divider type='vertical' key='line' />,
  1227. <Popconfirm
  1228. key={'del'}
  1229. title="是否确认删除?"
  1230. onConfirm={() => delActionHandle(record, 2)}
  1231. // onCancel={()=>{}}
  1232. okText="是"
  1233. cancelText="否"
  1234. >
  1235. <a >删除</a>
  1236. </Popconfirm>
  1237. ],
  1238. }] : [...tableColumn]} request={(params, sort, filter) => getTableData('2', params, sort, filter)} />}
  1239. </div>
  1240. )
  1241. }
  1242. {
  1243. currentSelectedTabKey == '3' && (
  1244. <div className='tabContent'>
  1245. <div className='tabContentInner'>
  1246. <div className='leftTree'>
  1247. <div className='search'>
  1248. <Input className='searchInput' allowClear onChange={onTreeSearchKeyChange} placeholder="请输入名称" suffix={
  1249. <IconFont type="iconsousuo" />
  1250. } />
  1251. </div>
  1252. <div className='treeWrap'>
  1253. {
  1254. treeData && treeData.length > 0 && currentSelectedTreeNode && (
  1255. <DirectoryTree
  1256. fieldNames={{ title: 'name', key: 'code', children: 'child' }}
  1257. rootStyle={{ height: '100%', paddingBottom: 50, overflowY: 'scroll', overflowX: 'hidden' }}
  1258. onSelect={onSelectHandle}
  1259. onExpand={onExpand}
  1260. expandedKeys={expandedKeys}
  1261. autoExpandParent={autoExpandParent}
  1262. selectedKeys={[currentSelectedTreeNode.code]}
  1263. blockNode={true}
  1264. icon={() => null}
  1265. titleRender={
  1266. (nodeData: any) => {
  1267. const strTitle = nodeData.name as string;
  1268. const index = strTitle.indexOf(searchValue);
  1269. const beforeStr = strTitle.substring(0, index);
  1270. const afterStr = strTitle.slice(index + searchValue.length);
  1271. const title =
  1272. index > -1 ? (
  1273. <span>
  1274. {beforeStr}
  1275. <span className="site-tree-search-value" style={{ color: 'red', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
  1276. {afterStr}
  1277. </span>
  1278. ) : (
  1279. <span className='strTitle'>{strTitle}</span>
  1280. );
  1281. return <div style={{
  1282. display: 'flex', flexDirection: 'row',
  1283. width: '100%',
  1284. justifyContent: 'flex-start', alignItems: 'center', height: 32,
  1285. borderRadius: '4px',
  1286. overflow: 'hidden',
  1287. color: '#17181A',
  1288. textOverflow: 'ellipsis',
  1289. whiteSpace: 'nowrap'
  1290. }}>{title}</div>
  1291. }
  1292. }
  1293. defaultSelectedKeys={[treeData[0].child[0].code]}
  1294. treeData={treeData as unknown as DataNode[]}
  1295. // treeData={treeDataNew}
  1296. switcherIcon={(props: any) => {
  1297. const { expanded } = props;
  1298. return !expanded ? <img style={{ width: 20, height: 20, position: 'relative', top: 5 }} src={expandedIcon} /> : <img style={{ width: 20, height: 20, position: 'relative', top: 5 }} src={closeIcon} />
  1299. }}
  1300. />
  1301. )
  1302. }
  1303. </div>
  1304. </div>
  1305. <div className='rightTable'>
  1306. <div className='tableToolbar'>
  1307. <div className='filter'>
  1308. {/* <div className='search' style={{ marginRight: 24 }}>
  1309. <span>类型:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1310. set_tableDataSearchKeywords(e.target.value);
  1311. if (e.target.value.length == 0) {
  1312. set_tableDataFilterParams({
  1313. ...tableDataFilterParams,
  1314. itemType: ''
  1315. });
  1316. }
  1317. }} suffix={
  1318. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemType')} />
  1319. } />
  1320. </div> */}
  1321. <div className='search'>
  1322. <span>项目名称:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1323. set_tableDataSearchKeywords(e.target.value);
  1324. if (e.target.value.length == 0) {
  1325. set_tableDataFilterParams({
  1326. ...tableDataFilterParams,
  1327. itemName: ''
  1328. });
  1329. }
  1330. }} suffix={
  1331. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemName')} />
  1332. } />
  1333. </div>
  1334. </div>
  1335. <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} >
  1336. <div className={auditType == '1'||loading ? 'btnGroup disabled' : 'btnGroup'}
  1337. onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
  1338. onMouseLeave={() => set_ifShowTip(false)}
  1339. >
  1340. <span key="1" onClick={auditType == '0'? () => generateFunc(3, true) : () => { }}>获取单个</span>
  1341. <span key="2" onClick={auditType == '0'? () => generateFunc(3) : () => { }}>获取所有</span>
  1342. </div>
  1343. </Popover>
  1344. </div>
  1345. {currentComputeDate && <BMSTable actionRef={tableRef} loading={{ spinning: loading, tip: '正在计算数据...' }} rowKey='id' params={tableDataFilterParams} columns={auditType == '0' ? [...tableColumn, {
  1346. title: '数值',
  1347. dataIndex: 'value',
  1348. key: 'value',
  1349. render: (text: any, record: any) => {
  1350. return (
  1351. <div key={'editCheckitem'} style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center' }}>
  1352. <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
  1353. {
  1354. editTableCellId == record.id ? <Input size='small' defaultValue={record.value} placeholder='请输入' onChange={(e) => { set_checkItemvalNum(Number(e.target.value)) }} style={{ width: '80px' }} /> : <span>{text}</span>
  1355. }
  1356. </div>
  1357. <img onClick={() => editCheckItemValHandle(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={editTableCellId == record.id ? conformIcon : editIcon} alt="" />
  1358. </div>
  1359. )
  1360. }
  1361. },
  1362. {
  1363. title: '操作',
  1364. key: 'option',
  1365. valueType: 'option',
  1366. render: (_: any, record: any) => [
  1367. <Popconfirm
  1368. key={'del'}
  1369. title="是否确认删除?"
  1370. onConfirm={() => delActionHandle(record, 3)}
  1371. // onCancel={()=>{}}
  1372. okText="是"
  1373. cancelText="否"
  1374. >
  1375. <a >删除</a>
  1376. </Popconfirm>
  1377. ],
  1378. }] : [
  1379. ...tableColumn, {
  1380. title: '数值',
  1381. dataIndex: 'value',
  1382. key: 'value',
  1383. }
  1384. ]} request={(params, sort, filter) => getTableData('3', params, sort, filter)} />}
  1385. </div>
  1386. </div>
  1387. </div>
  1388. )
  1389. }
  1390. {
  1391. currentSelectedTabKey == '4' && (
  1392. <div className='tabContent'>
  1393. <div className='tableToolbar'>
  1394. <div className='filter'>
  1395. <div className='tabs'>
  1396. {
  1397. manaIndexGroups.map((item, index) => {
  1398. return (
  1399. <div key={index} className={currentSelectedManaGroup?.id == item.id ? 'tab on' : 'tab'} onClick={() => onManaIndexGroupClick(item)}>{item.groupName}</div>
  1400. )
  1401. })
  1402. }
  1403. </div>
  1404. <div className='search'>
  1405. {/* <span>核算单元名称:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1406. set_tableDataSearchKeywords(e.target.value);
  1407. if (e.target.value.length == 0) {
  1408. set_tableDataFilterParams({
  1409. ...tableDataFilterParams,
  1410. unitName: ''
  1411. });
  1412. }
  1413. }} suffix={
  1414. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle()} />
  1415. } /> */}
  1416. </div>
  1417. </div>
  1418. <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} placement='topRight'>
  1419. <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
  1420. onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
  1421. onMouseLeave={() => set_ifShowTip(false)}
  1422. >
  1423. {/* <span key="1">获取</span> */}
  1424. {importData(4, '管理指标')}
  1425. </div>
  1426. </Popover>
  1427. </div>
  1428. {currentComputeDate && tableColumn && <BMSTable className='BMS-ManaIndextable' rowClassName={() => 'BMS-ManaIndextable-row'} bordered actionRef={tableRef} scroll={{ x: (100 * (tableColumn.length - 2)) + 120 + 100,y:tableH}} rowKey='unitCode' columns={auditType == '0' ? [...tableColumn,
  1429. {
  1430. title: '操作',
  1431. key: 'option',
  1432. valueType: 'option',
  1433. width: 100,
  1434. fixed: 'right',
  1435. render: (_: any, record: any) => [
  1436. <EditManaIndexTableRow record={record} key={'edit'} />
  1437. ],
  1438. }] : [...tableColumn]} pagination={false} params={tableDataFilterParams} request={(params, sort, filter) => getTableData('4', params, sort, filter)} />}
  1439. </div>
  1440. )
  1441. }
  1442. {
  1443. currentSelectedTabKey == '5' && (
  1444. <div className='tabContent' >
  1445. <div className='tableToolbar'>
  1446. <div className='filter'>
  1447. <div className='search'>
  1448. <span>项目名称:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1449. set_tableDataSearchKeywords(e.target.value);
  1450. if (e.target.value.length == 0) {
  1451. set_tableDataFilterParams({
  1452. ...tableDataFilterParams,
  1453. itemName: ''
  1454. });
  1455. }
  1456. }} suffix={
  1457. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemName')} />
  1458. } />
  1459. </div>
  1460. </div>
  1461. <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} placement='topRight'>
  1462. <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
  1463. onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
  1464. onMouseLeave={() => set_ifShowTip(false)}
  1465. >
  1466. {/* <span key="1">获取</span> */}
  1467. {importData(5, '收入')}
  1468. </div>
  1469. </Popover>
  1470. </div>
  1471. {currentComputeDate && <BMSTable actionRef={tableRef} rowKey='id' params={tableDataFilterParams} columns={tableColumn} request={(params, sort, filter) => getTableData('5', params, sort, filter)} />}
  1472. <div className='totalCount'>合计:{totalNum}</div>
  1473. </div>
  1474. )
  1475. }
  1476. {
  1477. currentSelectedTabKey == '6' && (
  1478. <div className='tabContent'>
  1479. <div className='tableToolbar'>
  1480. <div className='filter'>
  1481. <div className='search'>
  1482. <span>项目名称:</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
  1483. set_tableDataSearchKeywords(e.target.value);
  1484. if (e.target.value.length == 0) {
  1485. set_tableDataFilterParams({
  1486. ...tableDataFilterParams,
  1487. itemName: ''
  1488. });
  1489. }
  1490. }} suffix={
  1491. <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemName')} />
  1492. } />
  1493. </div>
  1494. </div>
  1495. <Popover open={ifShowTip} content={'当前处于审核中,无法操作!'} placement='topRight'>
  1496. <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
  1497. onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
  1498. onMouseLeave={() => set_ifShowTip(false)}
  1499. >
  1500. {/* <span key="1">获取</span> */}
  1501. {importData(6, '成本')}
  1502. </div>
  1503. </Popover>
  1504. </div>
  1505. {currentComputeDate && <BMSTable actionRef={tableRef} rowKey='id' params={tableDataFilterParams} columns={tableColumn} request={(params, sort, filter) => getTableData('6', params, sort, filter)} />}
  1506. <div className='totalCount'>合计:{totalNum}</div>
  1507. </div>
  1508. )
  1509. }
  1510. </BMSPagecontainer>
  1511. </div>
  1512. )
  1513. }
  1514. </>
  1515. </div>
  1516. );
  1517. };
  1518. export default MonthlyDataCheck;