index.tsx 85 KB

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