index.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744
  1. /*
  2. * @Author: code4eat awesomedema@gmail.com
  3. * @Date: 2022-07-12 11:14:21
  4. * @LastEditors: code4eat awesomedema@gmail.com
  5. * @LastEditTime: 2025-04-25 17:40:50
  6. * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/indicatorMana/index.tsx
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. */
  9. import { ActionType, ProColumns } from '@ant-design/pro-table';
  10. import React, { useEffect, useRef, useState } from 'react';
  11. import { Dropdown, Empty, Input, Popconfirm, Tabs, Modal, Form, message } from 'antd';
  12. import { ModalForm, ProFormInstance, ProFormText, ProFormTextArea } from '@ant-design/pro-form';
  13. import DrawerForm from './DrawerForm/drawer';
  14. import { createFromIconfontCN, DownOutlined } from '@ant-design/icons';
  15. import {
  16. addIndicatorManaList,
  17. applyOnlineReportMap,
  18. delIndicatorManaList,
  19. editIndicatorManaList,
  20. getIndicatorCateList,
  21. getIndicatorDetailReq,
  22. getIndicatorManaList,
  23. IndicatorManaItemType,
  24. saveIndicatorBindItems,
  25. } from '@/service/indicator';
  26. import './style.less';
  27. import { getIndicatorDictionary, IndicatorDictionaryDataType } from '@/service/dictionary';
  28. import { useHistory, useLocation, useModel, useParams } from 'umi';
  29. import { KCIMLeftList } from '../../components/KCIMLeftList';
  30. import KCTable from '@/components/kcTable';
  31. import { KCInput } from '@/components/KCInput';
  32. import generateTableData from '../dataFilling/fillingMana/generateTableData';
  33. import { DATAFILL_PERIODTYPE } from '../dataFilling/fillingMana';
  34. import FrameComponent from './frameContainer';
  35. const defaultYear = new Date().getFullYear();
  36. let table_columns: any[] = [];
  37. let total_tableDataSource: any[] = [];
  38. const IconFont = createFromIconfontCN({
  39. scriptUrl: '',
  40. });
  41. const IndicatorMana = () => {
  42. const [reloadTable, set_reloadTable] = useState(false);
  43. const [drawerVisible, set_drawerVisible] = useState(false);
  44. const [indicateType, set_indicateType] = useState<IndicatorDictionaryDataType[]>([]);
  45. const [currentEditRowData, set_currentEditRowData] = useState<any | undefined>(undefined);
  46. const [indicatorCateTreeData, set_indicatorCateTreeData] = useState<any[]>([]);
  47. const [defaultExpandedRowKeys, set_defaultExpandedRowKeys] = useState<string[]>([]);
  48. const [cateId, set_cateId] = useState<string>();
  49. const [tableColumns, set_tableColumns] = useState<ProColumns[]>([]);
  50. const [tableDataFilterParams, set_tableDataFilterParams] = useState<TableRequestParamsType>({
  51. current: 1,
  52. pageSize: 10,
  53. name: '',
  54. });
  55. const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');
  56. const [currentSelectedLeft, set_currentSelectedLeft] = useState<any>(undefined);
  57. const [actionType, set_actionType] = useState<'NORMAL' | 'DETAIL' | undefined>('NORMAL');
  58. const [drawerActype, set_drawerActype] = useState<'ADD' | 'EDIT' | 'DATAMANA' | undefined>(undefined);
  59. const [tableDataSource, set_tableDataSource] = useState<any[]>([]);
  60. const [currentYear, set_currentYear] = useState(defaultYear);
  61. const [currentEditRow, set_currentEditRow] = useState<any>(undefined);
  62. const detailTableRef = useRef<ActionType>();
  63. const [currentBigTab, set_currentBigTab] = useState('2');
  64. const indicatorTableRef = useRef<ActionType>();
  65. const history: any = useHistory();
  66. const [currentTab, set_currentTab] = useState('1');
  67. const { indicatorType: indicatorUrlType }: { id: string; indicatorType: string } = history.location.query;
  68. const [reportModalVisible, setReportModalVisible] = useState(false);
  69. const reportForm = useRef<ProFormInstance>();
  70. const columns: ProColumns<any>[] = [
  71. {
  72. title: '指标名称',
  73. dataIndex: 'name',
  74. hideInSearch: false,
  75. ellipsis: true,
  76. },
  77. // {
  78. // title: '指标编码',
  79. // dataIndex: 'code',
  80. // ellipsis: true,
  81. // render: (text, record) => {
  82. // if (record) {
  83. // const { indicatorBoolean, code } = record;
  84. // return indicatorBoolean ? code : ''
  85. // } else {
  86. // return ''
  87. // }
  88. // }
  89. // },
  90. {
  91. title: '指标类别',
  92. dataIndex: 'indicatorType',
  93. hideInSearch: true,
  94. ellipsis: true,
  95. hideInTable: true,
  96. valueType: 'select',
  97. request: async () => {
  98. const resp = await getIndicatorDictionary();
  99. if (resp) {
  100. const data = resp.filter((t) => t.code == 'IndicatorType');
  101. if (data.length > 0) {
  102. return data[0].children.map((t) => ({ label: t.name, value: t.code }));
  103. }
  104. }
  105. return [];
  106. },
  107. render: (text, record) => {
  108. if (record) {
  109. const { indicatorBoolean, indicatorTypeList } = record;
  110. return indicatorBoolean && indicatorTypeList ? indicatorTypeList.map((t: any) => t.name).join('/') : '';
  111. } else {
  112. return '';
  113. }
  114. },
  115. },
  116. {
  117. title: '外部指标',
  118. dataIndex: 'outsideIndexes',
  119. hideInSearch: true,
  120. ellipsis: true,
  121. hideInTable: true,
  122. valueType: 'cascader',
  123. fieldProps: {
  124. fieldNames: { label: 'name', value: 'code' },
  125. placeholder: '请选择',
  126. },
  127. request: async () => {
  128. const resp = await getIndicatorDictionary();
  129. if (resp) {
  130. const data = resp.filter((t) => t.code == 'IndicatorExternal');
  131. if (data.length > 0) {
  132. return data[0].children;
  133. }
  134. }
  135. return [];
  136. },
  137. render: (text, record) => {
  138. if (record) {
  139. const { indicatorBoolean, indicatorExternalList } = record;
  140. return indicatorBoolean ? (indicatorExternalList ? indicatorExternalList.map((t: any) => t.name).join('/') : '-') : '';
  141. } else {
  142. return '';
  143. }
  144. },
  145. },
  146. {
  147. title: '指标编码',
  148. dataIndex: 'code',
  149. width: 80,
  150. hideInSearch: true,
  151. ellipsis: true,
  152. },
  153. {
  154. title: '指标定义',
  155. dataIndex: 'targetDefinition',
  156. hideInSearch: true,
  157. ellipsis: true,
  158. },
  159. {
  160. title: '操作',
  161. width: 90,
  162. key: 'option',
  163. valueType: 'option',
  164. render: (text, record) => {
  165. const items = [
  166. {
  167. key: '1',
  168. label: (
  169. <a
  170. key="link"
  171. onClick={() => {
  172. set_currentEditRow(record);
  173. set_actionType('DETAIL');
  174. }}
  175. >
  176. 相关数据
  177. </a>
  178. ),
  179. },
  180. {
  181. key: '2',
  182. label: (
  183. <a key="linka" href={record.indicatorPath} target="_blank">
  184. 统计分析
  185. </a>
  186. ),
  187. },
  188. {
  189. key: '3',
  190. label: (
  191. <Popconfirm title="是否确定删除?" onConfirm={() => delHandle(record)} okText="确定" cancelText="取消" key="link2">
  192. <a>删除</a>
  193. </Popconfirm>
  194. ),
  195. },
  196. ];
  197. if (record && record.indicatorBoolean) {
  198. return [
  199. <a key="link3" onClick={() => actionHandle('EDIT', record)}>
  200. 管理
  201. </a>,
  202. <Dropdown menu={{ items }}>
  203. <a>
  204. <DownOutlined />
  205. </a>
  206. </Dropdown>,
  207. ];
  208. }
  209. return [];
  210. },
  211. },
  212. ];
  213. const IconFont = createFromIconfontCN({
  214. scriptUrl: '',
  215. });
  216. const getIndicatorDir = async () => {
  217. const resp = await getIndicatorDictionary();
  218. if (resp) {
  219. set_indicateType(resp);
  220. }
  221. };
  222. const getData = async (params: any) => {
  223. const { current = 1, pageSize = 10, name, indicatorType, outsideIndexes } = params;
  224. if (cateId) {
  225. const resp = await getIndicatorManaList({
  226. menuCode: cateId as string,
  227. menuType: indicatorUrlType,
  228. indicatorName: name,
  229. indicatorType: indicatorType,
  230. outsideIndexes: outsideIndexes && outsideIndexes.length > 0 ? outsideIndexes[outsideIndexes.length - 1] : '',
  231. current,
  232. pageSize
  233. });
  234. if (resp && resp[0]) {
  235. return {
  236. data: resp[0].children as unknown as [],
  237. success: true,
  238. total: resp[0].total || resp[0].children?.length || 0
  239. };
  240. } else {
  241. return {
  242. data: [],
  243. success: true,
  244. total: 0
  245. };
  246. }
  247. }
  248. return {
  249. data: [],
  250. success: false,
  251. total: 0
  252. };
  253. };
  254. const getIndicatorCateTree = async () => {
  255. if (indicatorUrlType) {
  256. const resp = await getIndicatorCateList({ menuType: indicatorUrlType });
  257. if (resp) {
  258. set_indicatorCateTreeData(resp);
  259. } else {
  260. set_indicatorCateTreeData([]);
  261. indicatorTableRef.current?.reload();
  262. }
  263. }
  264. };
  265. const actionHandle = async (key: 'EDIT' | 'DEL', record: IndicatorDictionaryDataType) => {
  266. set_currentEditRowData(record);
  267. if (key == 'EDIT') {
  268. set_drawerActype('EDIT');
  269. set_drawerVisible(true);
  270. }
  271. };
  272. const addHandle = () => {
  273. set_drawerActype('ADD');
  274. set_currentEditRowData(undefined);
  275. set_drawerVisible(true);
  276. };
  277. const delHandle = async (record: IndicatorDictionaryDataType) => {
  278. const resp = await delIndicatorManaList({ id: record.id });
  279. if (resp) {
  280. indicatorTableRef.current?.reload();
  281. }
  282. };
  283. const onVisibleChangeHandle = (bool: boolean) => {
  284. if (!bool) {
  285. set_drawerVisible(false);
  286. }
  287. if (bool) {
  288. set_drawerVisible(true);
  289. }
  290. };
  291. const drawerFormCommitHanndle = async (data: any) => {
  292. if (drawerActype == 'DATAMANA') {
  293. const resp = await saveIndicatorBindItems(data);
  294. if (resp) {
  295. set_drawerVisible(false);
  296. getIndicatorDetail();
  297. }
  298. }
  299. if (drawerActype != 'DATAMANA') {
  300. let formData: any;
  301. data.forEach((element: any) => {
  302. if (element.baseInfoformRef) {
  303. formData = { ...formData, ...element.baseInfoformRef };
  304. }
  305. if (element.manaInfoformRef) {
  306. formData = { ...formData, ...element.manaInfoformRef };
  307. }
  308. if (element.showSetInfoformRef) {
  309. formData = { ...formData, ...element.showSetInfoformRef };
  310. }
  311. if (element.adminInfoformRef) {
  312. formData = { ...formData, ...element.adminInfoformRef };
  313. }
  314. });
  315. if (drawerActype == 'ADD') {
  316. const resp = await addIndicatorManaList({
  317. ...formData,
  318. caseBreakdown: formData.caseBreakdown ? formData.caseBreakdown.join('/') : '',
  319. dataDownload: formData.dataDownload ? formData.dataDownload.join('/') : '',
  320. drillLevel: formData.drillLevel ? formData.drillLevel.join('/') : '',
  321. dataSum: formData.dataSum ? formData.dataSum.join('/') : '',
  322. chartType: formData.chartType ? formData.chartType.join('/') : '',
  323. indicatorMenuList: formData.indicatorMenuList ? formData.indicatorMenuList : [],
  324. indicatorTypeList: formData.indicatorTypeList ? formData.indicatorTypeList : [],
  325. indicatorExternalList: formData.indicatorExternalList ? formData.indicatorExternalList : [],
  326. divisionId: `${formData.divisionId}`,
  327. });
  328. if (resp) {
  329. set_drawerVisible(false);
  330. indicatorTableRef.current?.reload();
  331. }
  332. }
  333. if (drawerActype == 'EDIT') {
  334. const resp = await editIndicatorManaList({
  335. ...currentEditRowData,
  336. ...formData,
  337. caseBreakdown: formData.caseBreakdown ? formData.caseBreakdown.join('/') : '',
  338. dataDownload: formData.dataDownload ? formData.dataDownload.join('/') : '',
  339. drillLevel: formData.drillLevel ? formData.drillLevel.join('/') : '',
  340. dataSum: formData.dataSum ? formData.dataSum.join('/') : '',
  341. chartType: formData.chartType ? formData.chartType.join('/') : '',
  342. });
  343. if (resp) {
  344. set_drawerVisible(false);
  345. indicatorTableRef.current?.reload();
  346. }
  347. }
  348. }
  349. };
  350. const onSelectChangehandle = (currentSelected: any) => {
  351. set_currentSelectedLeft(currentSelected);
  352. currentSelected && set_cateId(currentSelected.code);
  353. };
  354. const tableDataSearchHandle = (paramName: string) => {
  355. set_tableDataFilterParams({
  356. ...tableDataFilterParams,
  357. current: 1,
  358. [`${paramName}`]: tableDataSearchKeywords
  359. });
  360. }
  361. const handleTableChange = (pagination: any) => {
  362. set_tableDataFilterParams({
  363. ...tableDataFilterParams,
  364. current: pagination.current,
  365. pageSize: pagination.pageSize
  366. });
  367. }
  368. const detailTableDataSearchHandle = (paramName: string) => {
  369. const result = total_tableDataSource.filter((a: any) => a[`${paramName}`].indexOf(tableDataSearchKeywords) != -1);
  370. set_tableDataSource(result);
  371. };
  372. const tabChangeHandle = (key: string) => {
  373. set_currentTab(key);
  374. };
  375. const getIndicatorDetail = async () => {
  376. if (currentEditRow) {
  377. set_tableColumns([]);
  378. set_tableDataSource([]);
  379. const resp = await getIndicatorDetailReq({ indicatorCode: currentEditRow.code, dataYear: `${currentYear}`, periodType: currentTab });
  380. if (resp) {
  381. const { itemTitles, itemDatas } = resp;
  382. const { columns, dataSource } = generateTableData(itemTitles, itemDatas);
  383. table_columns = columns;
  384. total_tableDataSource = dataSource;
  385. set_tableColumns(columns);
  386. set_tableDataSource(dataSource);
  387. }
  388. }
  389. };
  390. const dataManaBtnHandle = () => {
  391. set_drawerActype('DATAMANA');
  392. set_currentEditRowData({ ...currentEditRow });
  393. set_drawerVisible(true);
  394. };
  395. useEffect(() => {
  396. if (cateId) {
  397. indicatorTableRef.current?.reload();
  398. }
  399. }, [cateId]);
  400. useEffect(() => {
  401. if (!currentEditRow) {
  402. set_actionType('NORMAL');
  403. }
  404. }, [currentEditRow]);
  405. useEffect(() => {
  406. if (actionType == 'DETAIL' && currentBigTab === '2') {
  407. getIndicatorDetail();
  408. }
  409. }, [actionType, currentBigTab]);
  410. useEffect(() => {
  411. getIndicatorDetail();
  412. }, [currentTab, currentYear]);
  413. useEffect(() => {
  414. set_cateId(undefined);
  415. set_actionType(undefined);
  416. set_drawerActype(undefined);
  417. set_currentBigTab('1');
  418. set_currentEditRow(undefined);
  419. set_tableColumns([]);
  420. set_tableDataSource([]);
  421. set_currentEditRowData(undefined);
  422. getIndicatorCateTree();
  423. }, [location.search]);
  424. useEffect(() => {
  425. if (!drawerVisible) {
  426. set_drawerActype(undefined);
  427. set_currentEditRowData(undefined);
  428. }
  429. }, [drawerVisible]);
  430. useEffect(() => {
  431. getIndicatorDir();
  432. getIndicatorCateTree();
  433. }, []);
  434. // // 当弹窗可见性变化时,处理表单回显
  435. // useEffect(() => {
  436. // console.log('Modal visibility changed:', reportModalVisible); // 日志 1: 检查可见性变化
  437. // if (reportModalVisible && currentEditRow) {
  438. // console.log('Attempting to set form values. currentEditRow:', currentEditRow); // 日志 2: 检查 currentEditRow 内容
  439. // const valuesToSet = {
  440. // reportId: currentEditRow.onlineReportCode,
  441. // remark: currentEditRow.onlineRemark
  442. // };
  443. // console.log('Values to set:', valuesToSet); // 日志 3: 检查要设置的值
  444. // try {
  445. // reportForm?.current?.setFieldsValue(valuesToSet);
  446. // console.log('setFieldsValue called successfully.'); // 日志 4: 确认调用成功
  447. // } catch (e) {
  448. // console.error('Error calling setFieldsValue:', e); // 日志 5: 检查调用是否出错
  449. // }
  450. // } else if (reportModalVisible) {
  451. // console.log('Modal is visible, but currentEditRow is missing or empty:', currentEditRow); // 日志 6: 检查 currentEditRow 是否为空
  452. // }
  453. // // ModalForm 的 destroyOnClose 会处理关闭时的重置
  454. // }, [reportModalVisible, currentEditRow, reportForm]); // 依赖项
  455. // 打开报告管理弹窗
  456. const openReportModal = () => {
  457. setReportModalVisible(true);
  458. };
  459. // 处理报告表单提交
  460. const handleReportSubmit = async (values: any) => {
  461. try {
  462. const resp = await applyOnlineReportMap({
  463. code: currentEditRow.code,
  464. onlineReportCode: values.reportId,
  465. onlineRemark: values.remark
  466. });
  467. if (resp) {
  468. message.success('提交成功');
  469. set_currentEditRow((prevRow: any) => ({
  470. ...prevRow,
  471. onlineRemark:values.remark,
  472. onlineReportCode: values.reportId
  473. }));
  474. return true; // 提交成功后关闭弹窗
  475. }
  476. } catch (error) {
  477. console.error('表单验证或提交失败:', error);
  478. message.error('提交失败'); // 添加错误提示
  479. return false; // 提交失败,保持弹窗打开
  480. }
  481. // 如果 API 调用失败 (resp 为 false),显式返回 false
  482. message.error('提交失败');
  483. return false;
  484. };
  485. return (
  486. <div className="IndicatorMana">
  487. <DrawerForm actType={drawerActype} visible={drawerVisible} onVisibleChange={onVisibleChangeHandle} onFinish={(data) => drawerFormCommitHanndle(data)} record={currentEditRowData} />
  488. {/* 报告管理弹窗 */}
  489. <ModalForm
  490. title="报告管理"
  491. visible={reportModalVisible}
  492. onVisibleChange={setReportModalVisible}
  493. onFinish={handleReportSubmit}
  494. width={500}
  495. initialValues={currentEditRow&&{reportId: currentEditRow.onlineReportCode,
  496. remark: currentEditRow.onlineRemark}}
  497. formRef={reportForm}
  498. modalProps={{
  499. destroyOnClose: true,
  500. bodyStyle: {
  501. maxHeight: '72vh',
  502. overflowY: 'auto',
  503. overflowX: 'hidden'
  504. }
  505. }}
  506. >
  507. <ProFormText
  508. name="reportId"
  509. label="关联报告ID"
  510. placeholder="请输入"
  511. rules={[{ required: true, message: '请输入关联报告ID' }]}
  512. />
  513. <ProFormTextArea
  514. name="remark"
  515. label="备注说明"
  516. placeholder="请输入"
  517. fieldProps={{
  518. rows: 4,
  519. }}
  520. />
  521. </ModalForm>
  522. {actionType == 'DETAIL' && (
  523. <div className="FillingMana-detail">
  524. <div className="FillingMana-detail-header">
  525. <div className="FillingMana-detail-header-title">
  526. <div className="backBtn" onClick={() => set_currentEditRow(undefined)}>
  527. <IconFont style={{ fontSize: 15 }} type={'iconfanhui'} />
  528. </div>
  529. <span>{currentEditRow?.name}</span>
  530. </div>
  531. <div className="FillingMana-detail-header-title-sub">
  532. <span>指标编码:{currentEditRow?.code}</span>
  533. <span>指标定义:{currentEditRow?.targetDefinition}</span>
  534. </div>
  535. </div>
  536. <div className="bigTab" title={`${currentBigTab == '1'}`}>
  537. <div className={currentBigTab === '1' ? 'tab on' : 'tab'} onClick={() => set_currentBigTab('1')}>
  538. 线上数据
  539. </div>
  540. <div className={currentBigTab === '2' ? 'tab on' : 'tab'} onClick={() => set_currentBigTab('2')}>
  541. 填报数据
  542. </div>
  543. </div>
  544. {currentBigTab === '1' && (
  545. <div className="currentBigTab1content">
  546. {/* <img src={require('../../../../../public/images/empty_bigger.png')} alt="" />
  547. <div className="detail-noAuthRecord-title">暂无内容</div> */}
  548. <div className='currentBigTab1content_header'>
  549. <span>{currentEditRow?.onlineRemark}</span>
  550. <div className='btn' onClick={openReportModal}>
  551. <IconFont type='iconpeizhi' /> 报告管理
  552. </div>
  553. </div>
  554. {(currentEditRow&&currentEditRow.onlineReportCode)&&<FrameComponent link={`/platform/setting/embeddedDashboard/${currentEditRow.onlineReportCode}?noTopbar=true&noMenu=true`} />}
  555. </div>
  556. )}
  557. {currentBigTab === '2' && (
  558. <div className="FillingMana-detail-content">
  559. <div className="tabBar">
  560. <Tabs defaultActiveKey={currentTab} onChange={tabChangeHandle} items={DATAFILL_PERIODTYPE.map((a) => ({ label: a.label, key: `${a.value}` }))} />
  561. <div className="dataManaBtn" onClick={() => dataManaBtnHandle()}>
  562. <IconFont type={'iconpeizhi'} style={{ position: 'relative', top: 1, paddingRight: 4 }} />
  563. 数据管理
  564. </div>
  565. </div>
  566. <div className="toolBar">
  567. <div className="filter">
  568. <div className="filterItem">
  569. <span className="label" style={{ whiteSpace: 'nowrap' }}>
  570. {' '}
  571. 检索:
  572. </span>
  573. <Input
  574. placeholder={'填报科室'}
  575. allowClear
  576. autoComplete="off"
  577. suffix={<IconFont type="iconsousuo" style={{ color: '#99A6BF' }} onClick={() => detailTableDataSearchHandle('fillItemName')} />}
  578. onChange={(e) => {
  579. set_tableDataSearchKeywords(e.target.value);
  580. if (e.target.value.length == 0) {
  581. set_tableDataSource(total_tableDataSource);
  582. }
  583. }}
  584. onPressEnter={(e: any) => {
  585. const result = total_tableDataSource.filter((a: any) => a.fillItemName.indexOf(e.target.value) != -1);
  586. set_tableDataSource(result);
  587. }}
  588. />
  589. </div>
  590. </div>
  591. <div className="btnGroup">
  592. <div className="changeBtn">
  593. <div className="actBtn" onClick={() => set_currentYear(currentYear - 1)}>
  594. <IconFont type={'iconshuangzuo'} />
  595. </div>
  596. <span style={{ padding: '0 8px' }}>{currentYear}</span>
  597. <div className="actBtn" onClick={() => set_currentYear(currentYear + 1)}>
  598. <IconFont type={'iconshuangyou'} />
  599. </div>
  600. </div>
  601. </div>
  602. </div>
  603. <KCTable newVer actionRef={detailTableRef} columns={[...tableColumns]} scroll={{ y: 'calc(100vh - 232px)' }} rowKey="id" dataSource={tableDataSource} pagination={false} />
  604. </div>
  605. )}
  606. </div>
  607. )}
  608. {actionType != 'DETAIL' && (
  609. <div className="content">
  610. <div className="left">
  611. {/* <TreeDirectory data={indicatorCateTreeData} onSelectChange={(info) => onSelectChangehandle(info)} /> */}
  612. <KCIMLeftList
  613. searchKey={'name'}
  614. listType="tree"
  615. dataSource={indicatorCateTreeData}
  616. fieldNames={{ title: 'name', key: 'code' }}
  617. contentH={'100%'}
  618. onChange={(info) => onSelectChangehandle(info)}
  619. />
  620. </div>
  621. <div className="right">
  622. <div className="tableTitle">{currentSelectedLeft && currentSelectedLeft.name}</div>
  623. <div className="toolBar">
  624. <div className="filter">
  625. <div className="filterItem">
  626. <KCInput
  627. placeholder={'指标名称'}
  628. style={{ width: 240 }}
  629. search
  630. allowClear
  631. onChange={(e) => {
  632. set_tableDataSearchKeywords(e.target.value);
  633. if (e.target.value.length == 0) {
  634. set_tableDataFilterParams({
  635. ...tableDataFilterParams,
  636. current: 1,
  637. name: '',
  638. });
  639. }
  640. }}
  641. onSearch={() => tableDataSearchHandle('name')}
  642. />
  643. </div>
  644. </div>
  645. <div className="btnGroup">
  646. <span className="add" onClick={addHandle}>
  647. 新增
  648. </span>
  649. </div>
  650. </div>
  651. {cateId && (
  652. <KCTable
  653. newVer
  654. rowKey="menuId"
  655. columns={columns}
  656. params={tableDataFilterParams}
  657. actionRef={indicatorTableRef}
  658. scroll={{ y: `calc(100vh - 228px)` }}
  659. expandable={{
  660. expandedRowKeys: defaultExpandedRowKeys,
  661. onExpand: (expanded, record) => {
  662. // console.log({expanded, record});
  663. let _expandedKeys = [...defaultExpandedRowKeys];
  664. if (expanded) {
  665. _expandedKeys.push(record.menuId);
  666. } else {
  667. const index = _expandedKeys.findIndex((t) => t == `${record.menuId}`);
  668. if (index != -1) {
  669. _expandedKeys.splice(index, 1);
  670. }
  671. }
  672. set_defaultExpandedRowKeys([..._expandedKeys]);
  673. },
  674. }}
  675. reload={reloadTable}
  676. pagination={false}
  677. options={false}
  678. request={(params) => getData(params)}
  679. onChange={handleTableChange}
  680. />
  681. )}
  682. </div>
  683. </div>
  684. )}
  685. </div>
  686. );
  687. };
  688. export default IndicatorMana;