This commit is contained in:
何美荣 2026-05-13 11:33:31 +08:00
commit 5196bd88ee
16 changed files with 154 additions and 120 deletions

View File

@ -417,7 +417,6 @@ class TableBaseComponent extends ComponentBase {
实际加载表数据 实际加载表数据
*/ */
doLoadTableData = (loadParamJson, tableCode, onComplete, onLoadData) => { doLoadTableData = (loadParamJson, tableCode, onComplete, onLoadData) => {
console.log('调用查询实际过程', 6);
const payloadJson = this.getLoadTableDataParams(loadParamJson, tableCode); const payloadJson = this.getLoadTableDataParams(loadParamJson, tableCode);
if (!payloadJson) return; if (!payloadJson) return;
@ -426,7 +425,6 @@ class TableBaseComponent extends ComponentBase {
} }
const tableConfig = this.getTableConfig({ tableCode }); const tableConfig = this.getTableConfig({ tableCode });
const { api } = tableConfig ? tableConfig : {}; const { api } = tableConfig ? tableConfig : {};
console.log('调用查询实际过程', 7, api);
this.props.dispatch({ this.props.dispatch({
type: 'listPage/getTableData', type: 'listPage/getTableData',

View File

@ -511,8 +511,8 @@ class SE001EditPage extends React.Component {
ANSWER: value ANSWER: value
}); });
}}> }}>
<Option value={1}></Option> <Option value={1}>正确</Option>
<Option value={2}></Option> <Option value={2}>错误</Option>
</Select> </Select>
) )
} }

View File

@ -1,6 +1,6 @@
import { Button, Descriptions, Modal, Popconfirm, Row, Col, Form, Input, Select, Table, Icon } from 'antd'; import { Button, Descriptions, Modal, Popconfirm, Row, Col, Form, Input, Select, Table, Icon } from 'antd';
import React from 'react'; import React from 'react';
import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, initQueryFilter, GetFileModel, showFiles } from '../../../utils/common'; import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, initQueryFilter, GetFileModel, showFiles, getArryPropShow } from '../../../utils/common';
import ReactToPrint from 'react-to-print'; import ReactToPrint from 'react-to-print';
import { ExportToExcel } from '@woowalker/feui' import { ExportToExcel } from '@woowalker/feui'
import XLSX from 'xlsx'; import XLSX from 'xlsx';
@ -103,6 +103,7 @@ class SE061ShowPrint extends React.Component {
extendInclude(json, 'Nav_Department') extendInclude(json, 'Nav_Department')
extendInclude(json, 'Nav_User') extendInclude(json, 'Nav_User')
extendInclude(json, 'Nav_Content') extendInclude(json, 'Nav_Content')
extendInclude(json, 'Nav_Teachers.Nav_User')
extendInclude(json, 'Nav_Files.Nav_ImgFile') extendInclude(json, 'Nav_Files.Nav_ImgFile')
extendInclude(json, 'Nav_NewUserDetail.Nav_User') extendInclude(json, 'Nav_NewUserDetail.Nav_User')
extendInclude(json, 'Nav_NewUserDetail.Nav_Department') extendInclude(json, 'Nav_NewUserDetail.Nav_Department')
@ -140,7 +141,7 @@ class SE061ShowPrint extends React.Component {
<div ref={el => (this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}> <div ref={el => (this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}>
<h1 className={styles.showPrintHead}>三级安全教育记录</h1> <h1 className={styles.showPrintHead}>三级安全教育记录</h1>
{ {
data ? <div style={{ width: '95%' }}> data ? <div>
<Descriptions title='' size='middle' bordered> <Descriptions title='' size='middle' bordered>
<Descriptions.Item label="发起部门">{data.Nav_Department.NAME}</Descriptions.Item> <Descriptions.Item label="发起部门">{data.Nav_Department.NAME}</Descriptions.Item>
<Descriptions.Item label="发起人">{data.Nav_User.NAME}</Descriptions.Item> <Descriptions.Item label="发起人">{data.Nav_User.NAME}</Descriptions.Item>
@ -149,10 +150,10 @@ class SE061ShowPrint extends React.Component {
<Descriptions.Item label="截止时间">{data.END_TIME}</Descriptions.Item> <Descriptions.Item label="截止时间">{data.END_TIME}</Descriptions.Item>
<Descriptions.Item label="培训学时">{data.TRAINNING_TIME}</Descriptions.Item> <Descriptions.Item label="培训学时">{data.TRAINNING_TIME}</Descriptions.Item>
<Descriptions.Item label="培训地点">{data.TAINNING_ADDR}</Descriptions.Item> <Descriptions.Item label="培训地点">{data.TAINNING_ADDR}</Descriptions.Item>
<Descriptions.Item label="培训老师">{data.TEACHER}</Descriptions.Item> <Descriptions.Item label="培训老师">{getArryPropShow(data.Nav_Teachers, "Nav_User.NAME")}</Descriptions.Item>
<Descriptions.Item label="培训形式">{data ? this.returnModel(data.TRAIN_MODEL) : null}</Descriptions.Item> <Descriptions.Item label="培训形式">{enums.TrainType.enums[data.TRAINTYPE]}</Descriptions.Item>
<Descriptions.Item label="培训内容" span="3">{data.Nav_Content.NAME}</Descriptions.Item> <Descriptions.Item label="培训内容" span="3">{data.Nav_Content.NAME}</Descriptions.Item>
<Descriptions.Item label="附件">{showFiles(data.Nav_Files, config.picServerHost, this)}</Descriptions.Item> <Descriptions.Item label="附件" span="2">{showFiles(data.Nav_Files, config.picServerHost, this)}</Descriptions.Item>
<Descriptions.Item label="是否触发考试">{data.IS_CREATETEST ? "是" : "否"}</Descriptions.Item> <Descriptions.Item label="是否触发考试">{data.IS_CREATETEST ? "是" : "否"}</Descriptions.Item>
</Descriptions> </Descriptions>
</div> : null </div> : null
@ -169,26 +170,28 @@ class SE061ShowPrint extends React.Component {
<td>姓名</td> <td>姓名</td>
<td>身份证号</td> <td>身份证号</td>
<td>入职时间</td> <td>入职时间</td>
<td>分数</td>
<td>部门</td> <td>部门</td>
<td>岗位</td> <td>岗位</td>
<td>分数</td>
<td>考核结果</td> <td>考核结果</td>
<td style={{ display: this.state.isShow1 }}>查看试卷</td> <td style={{ display: this.state.isShow1 }}>查看试卷</td>
<td style={{ display: this.state.isShow2 }}>附件</td> <td style={{ display: this.state.isShow2 }}>附件</td>
</tr> </tr>
{data?.Nav_NewUserDetail?.map((item, i) => { {data?.Nav_NewUserDetail?.map((item, i) => {
return <tr> if (item.IS_DELETED == null || item.IS_DELETED == false) {
<td>{item.CODE} </td> return <tr>
<td>{item.Nav_User?.NAME} </td> <td>{item.CODE} </td>
<td>{item.ID_CARD_NUMBER} </td> <td>{item.Nav_User?.NAME} </td>
<td>{moment(item.IN_TIME).format('YYYY-MM-DD')} </td> <td>{item.ID_CARD_NUMBER} </td>
<td>{item.SCORE} </td> <td>{moment(item.IN_TIME).format('YYYY-MM-DD')} </td>
<td>{item.Nav_Department?.NAME} </td> <td>{item.Nav_Department?.NAME} </td>
<td>{item.Nav_Post?.NAME} </td> <td>{item.Nav_Post?.NAME} </td>
<td>{enums.SEExaminationResultsEnum.enums[item.EXAMINATION_RESULTS]} </td> <td>{item.SCORE} </td>
<td style={{ display: this.state.isShow1 }}><div onClick={() => this.showDetailModal(item.ID)}><Icon type="eye" style={{ color: "#005b9b", cursor: "pointer" }} /></div></td> <td>{enums.SEExaminationResultsEnum.enums[item.EXAMINATION_RESULTS]} </td>
<td style={{ display: this.state.isShow2 }}>{showFiles(item.Nav_Files, config.picServerHost, this)} </td> <td style={{ display: this.state.isShow1 }}><div onClick={() => this.showDetailModal(item.ID)}><Icon type="eye" style={{ color: "#005b9b", cursor: "pointer" }} /></div></td>
</tr> <td style={{ display: this.state.isShow2 }}>{showFiles(item.Nav_Files, config.picServerHost, this)} </td>
</tr>
}
})} })}
</tbody> </tbody>
</table> </table>

View File

@ -297,7 +297,6 @@ class AdvanceSearch extends Component {
*/ */
handleSearch = (self = true) => { handleSearch = (self = true) => {
if (this.setShareIns(self)) return if (this.setShareIns(self)) return
console.log('调用查询开始', 1)
const { onSearch } = this.props const { onSearch } = this.props
onSearch instanceof Function && onSearch() onSearch instanceof Function && onSearch()
} }

View File

@ -38,7 +38,12 @@ export default {
onBlur={(editorState) => { onBlur={(editorState) => {
const htmlContent = editorState.toHTML(); const htmlContent = editorState.toHTML();
if (params.record.TITLE != htmlContent) { if (params.record.TITLE != htmlContent) {
params.setFieldValue('TITLE', htmlContent); var plainText = htmlContent.replace(/<[^>]+>/g, '');
const temps = [];
temps.push({ field: 'TITLE', value: htmlContent })
temps.push({ field: 'TITLE_SHOW', value: plainText })
params.setFieldValueByBatch(temps);
// params.setFieldValue('TITLE', htmlContent);
} }
}} }}
placeholder={placeholder} placeholder={placeholder}

View File

@ -1,3 +1,4 @@
import { message } from "antd/lib/index";
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Form, Col } from 'antd' import { Form, Col } from 'antd'
import { extendInclude, extendRule, initFilter } from "../../utils/common"; import { extendInclude, extendRule, initFilter } from "../../utils/common";
@ -9,12 +10,29 @@ import 'braft-editor/dist/index.css';
*/ */
export default { export default {
onBeforeEdit: ({ isNew, login, stateData }) => { onBeforeEdit: ({ isNew, login, stateData, setFieldValue }) => {
if (isNew) { if (isNew) {
stateData.STATUS = 0 stateData.STATUS = 0
setFieldValue('V_ISSHOWCONTROL', true);
} }
}, },
onBeforeSaveHandleRecord(params) { onBeforeSaveHandleRecord(params) {
params.record.STATUS = params.customParams params.record.STATUS = params.customParams
},
onChange: ({ value, colInfo, getFieldValue, setFieldVisible, setFieldValue, setFieldEditable, stateData }) => {
if (colInfo.FIELD_NAME == 'V_ISAUTO') {
if (value == true) {
setFieldValue('V_ISSILENT', true);
setFieldEditable('V_ISSILENT', false);
} else {
setFieldEditable('V_ISSILENT', true);
}
} else if (colInfo.FIELD_NAME == 'V_ISSHOWCONTROL') {
if (value == false) {
if (stateData.V_ISAUTO == undefined || stateData.V_ISAUTO == false) {
message.warn("必须自动才能不显示控制器");
}
}
}
} }
}; };

View File

@ -161,4 +161,27 @@ export default {
} }
} }
}, },
//向下同步培训组织 单选
btnSyncRole: ({ stateData, saveRowRecord }) => {
var totalCount = stateData.Nav_ListPlanDetail.length
if (totalCount < 2) {
return
}
var ApproveRole = {}
for (var i = 1; i < totalCount; i++) {
//本行数据 如果为空 取上一行的 APPROVAL_ROLE_ID Nav_ApproveRole
if ((stateData.Nav_ListPlanDetail[i].APPROVAL_ROLE_ID == null || stateData.Nav_ListPlanDetail[i].APPROVAL_ROLE_ID == undefined) && stateData.Nav_ListPlanDetail[i - 1].APPROVAL_ROLE_ID) {
ApproveRole = {
ID: stateData.Nav_ListPlanDetail[i - 1].APPROVAL_ROLE_ID,
NAME: stateData.Nav_ListPlanDetail[i - 1].Nav_ApproveRole.NAME
}
if (ApproveRole.ID != null && ApproveRole.ID != undefined) {
let iRow = { ...stateData.Nav_ListPlanDetail[i] };
iRow.APPROVAL_ROLE_ID = ApproveRole.ID
iRow.Nav_ApproveRole = ApproveRole
saveRowRecord({ record: iRow, editCode: "T_SE_TRAIN_PLAN_DETAIL" })
}
}
}
},
} }

View File

@ -86,3 +86,9 @@ app.router(require('./router').default);
app.start('#root'); app.start('#root');
window.g_app = app; window.g_app = app;
const { localStorage } = window
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i)
key.indexOf('_requestKey') > -1 && localStorage.removeItem(key)
}

View File

@ -70,8 +70,8 @@ class ClassBuild extends React.Component {
} }
// 注意:数据结构是 { companyName: '邦泰', rate: '52%' } // 注意:数据结构是 { companyName: '邦泰', rate: '52%' }
const companyNames = companyList.map((item) => item.companyName); const companyNames = companyList?.map((item) => item.companyName);
const rates = companyList.map((item) => { const rates = companyList?.map((item) => {
// 处理 rate 可能是字符串带百分号的情况 // 处理 rate 可能是字符串带百分号的情况
const rateValue = typeof item.rate === 'string' ? parseFloat(item.rate.replace('%', '')) : item.rate; const rateValue = typeof item.rate === 'string' ? parseFloat(item.rate.replace('%', '')) : item.rate;
return isNaN(rateValue) ? 0 : rateValue; return isNaN(rateValue) ? 0 : rateValue;

View File

@ -102,7 +102,18 @@ class DangerJob extends React.Component {
companyName = selectedCompanyObj?.NAME || ''; companyName = selectedCompanyObj?.NAME || '';
} }
return ( return (
<div style={{ textAlign: 'center', padding: '50px', color: '#999' }}> <div
style={{
textAlign: 'center',
padding: '50px',
color: '#999',
fontSize: '26px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
flex: 1,
}}
>
{selectedCompany ? `${companyName}暂无危险作业数据` : '暂无危险作业数据'} {selectedCompany ? `${companyName}暂无危险作业数据` : '暂无危险作业数据'}
</div> </div>
); );

View File

@ -122,18 +122,17 @@ class HiddenSolve extends React.Component {
}, },
legend: { legend: {
data: ['重大隐患', '一般隐患'], data: ['重大隐患', '一般隐患'],
orient: 'vertical',
right: '3%', right: '3%',
top: '5%', top: '10%',
itemGap: 16, itemGap: 12,
itemWidth: 18, itemWidth: 16,
itemHeight: 12, itemHeight: 10,
textStyle: { color: '#000', fontSize: 14 }, textStyle: { color: '#000', fontSize: 12 },
}, },
grid: { grid: {
left: '8%', left: '8%',
right: '5%', right: '5%',
top: '18%', top: '28%',
bottom: '8%', bottom: '8%',
containLabel: true, containLabel: true,
}, },
@ -251,9 +250,9 @@ class HiddenSolve extends React.Component {
const companyNames = hiddenRectifyList.map((item) => item.companyName); const companyNames = hiddenRectifyList.map((item) => item.companyName);
const majorTotal = hiddenRectifyList.map((item) => item.majorCount); const majorTotal = hiddenRectifyList.map((item) => item.majorCount);
const majorRectified = hiddenRectifyList.map((item) => (item.majorCount || 0) - (item.majorCountNo || 0)); const majorRectified = hiddenRectifyList.map((item) => item.majorCountNo);
const generalTotal = hiddenRectifyList.map((item) => item.generalCount); const generalTotal = hiddenRectifyList.map((item) => item.generalCount);
const generalRectified = hiddenRectifyList.map((item) => (item.generalCount || 0) - (item.generalCountNo || 0)); const generalRectified = hiddenRectifyList.map((item) => item.generalCountNo);
const option = { const option = {
title: { title: {
@ -275,18 +274,17 @@ class HiddenSolve extends React.Component {
}, },
legend: { legend: {
data: ['重大隐患量', '重大隐患未整改量', '一般隐患量', '一般隐患未整改量'], data: ['重大隐患量', '重大隐患未整改量', '一般隐患量', '一般隐患未整改量'],
orient: 'vertical',
right: '3%', right: '3%',
top: '5%', top: '10%',
itemGap: 12, itemGap: 12,
itemWidth: 18, itemWidth: 16,
itemHeight: 12, itemHeight: 10,
textStyle: { color: '#000', fontSize: 12 }, textStyle: { color: '#000', fontSize: 12 },
}, },
grid: { grid: {
left: '8%', left: '8%',
right: '5%', right: '5%',
top: '18%', top: '28%',
bottom: '8%', bottom: '8%',
containLabel: true, containLabel: true,
}, },

View File

@ -7,7 +7,8 @@ import echarts from 'echarts';
import configc from '../../config'; import configc from '../../config';
import 'slick-carousel/slick/slick.css'; import 'slick-carousel/slick/slick.css';
import 'slick-carousel/slick/slick-theme.css'; import 'slick-carousel/slick/slick-theme.css';
import { extendRule } from '../../utils/common'; import { extendRule, showFileModal, showFiles, GetFileModel } from '../../utils/common';
import FormPage from '../../components/FormPage';
class HomeContent extends React.Component { class HomeContent extends React.Component {
constructor(props) { constructor(props) {
@ -22,6 +23,12 @@ class HomeContent extends React.Component {
this.chartResizeHandlers = {}; this.chartResizeHandlers = {};
this.isUnmounted = false; this.isUnmounted = false;
this.autoplayTimer = null; this.autoplayTimer = null;
this.state = {
fileForm: {
title: '',
visible: false,
},
};
} }
waitForElement = (elementId, maxRetries = 10) => { waitForElement = (elementId, maxRetries = 10) => {
@ -92,7 +99,7 @@ class HomeContent extends React.Component {
label: { label: {
show: true, show: true,
position: 'inside', position: 'inside',
formatter: '{a|{b}{c}}\n\n\n{e|({d}%)}', // 添加 \n 换行符 formatter: '{d}%', // 添加 \n 换行符
color: '#000', color: '#000',
textBorderWidth: 0, textBorderWidth: 0,
rich: { rich: {
@ -194,7 +201,7 @@ class HomeContent extends React.Component {
}, },
legend: { legend: {
data: legendData, data: legendData,
right: 0, right: '3%',
top: '10%', top: '10%',
itemGap: 12, itemGap: 12,
itemWidth: 16, itemWidth: 16,
@ -367,6 +374,7 @@ class HomeContent extends React.Component {
}, },
label: { show: true, position: 'top', textStyle: { color: '#000', fontSize: 12 }, formatter: '{c}' }, label: { show: true, position: 'top', textStyle: { color: '#000', fontSize: 12 }, formatter: '{c}' },
barWidth: '60%', barWidth: '60%',
barMaxWidth: 40,
}, },
], ],
}; };
@ -405,7 +413,7 @@ class HomeContent extends React.Component {
this.echartsInstances.backLogChart = echarts.init(backLogCharts); this.echartsInstances.backLogChart = echarts.init(backLogCharts);
this.echartsInstances.backLogChart.setOption({ this.echartsInstances.backLogChart.setOption({
title: { title: {
text: '当月工作培训统计数量', text: '当月培训统计数量',
x: 'center', x: 'center',
y: '25%', y: '25%',
textStyle: { fontSize: 16, color: '#999' }, textStyle: { fontSize: 16, color: '#999' },
@ -428,7 +436,7 @@ class HomeContent extends React.Component {
const option = { const option = {
title: { title: {
text: '当月工作培训统计数量', text: '当月培训统计数量',
x: 'center', x: 'center',
y: '5%', y: '5%',
textStyle: { fontSize: 16, color: '#000' }, textStyle: { fontSize: 16, color: '#000' },
@ -446,18 +454,17 @@ class HomeContent extends React.Component {
}, },
legend: { legend: {
data: ['培训人次', '培训场次'], data: ['培训人次', '培训场次'],
orient: 'vertical', right: '3%',
right: 0, top: '10%',
top: 'middle', itemGap: 12,
itemGap: 16, itemWidth: 16,
itemWidth: 18, itemHeight: 10,
itemHeight: 12, textStyle: { color: '#000', fontSize: 12 },
textStyle: { color: '#000', fontSize: 14 },
}, },
grid: { grid: {
left: '5%', left: '5%',
right: '5%', right: '5%',
top: '18%', top: '28%',
bottom: '5%', bottom: '5%',
containLabel: true, containLabel: true,
}, },
@ -704,7 +711,7 @@ class HomeContent extends React.Component {
if (!currentAnnouncement) return null; if (!currentAnnouncement) return null;
const { TITLE, ABSTRACT, START, END, CONTENT, Nav_Files = [] } = currentAnnouncement; const { TITLE, ABSTRACT, START, END, CONTENT, CREATE_USER_NAME, Nav_Files = [] } = currentAnnouncement;
return ( return (
<div> <div>
@ -729,7 +736,8 @@ class HomeContent extends React.Component {
{/* 日期 */} {/* 日期 */}
<div style={{ fontSize: '12px', color: '#999', marginBottom: '16px', textAlign: 'center' }}> <div style={{ fontSize: '12px', color: '#999', marginBottom: '16px', textAlign: 'center' }}>
{START} {END} {START ? START : '--'} {END ? END : '--'}
<span style={{ marginLeft: '20px' }}>{CREATE_USER_NAME ? CREATE_USER_NAME : ''}</span>
</div> </div>
{/* 分割线 */} {/* 分割线 */}
@ -753,46 +761,9 @@ class HomeContent extends React.Component {
<div style={{ fontWeight: 'bold', marginBottom: '12px', fontSize: '14px', color: '#333' }}> <div style={{ fontWeight: 'bold', marginBottom: '12px', fontSize: '14px', color: '#333' }}>
附件 ({Nav_Files.length}) 附件 ({Nav_Files.length})
</div> </div>
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}> {showFiles(Nav_Files, configc.picServerHost, this)}
{Nav_Files.map((file, index) => ( {GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)}
<div <FormPage {...this.state.tmpData} />
key={file.ID || index}
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
padding: '8px 12px',
backgroundColor: '#f5f5f5',
borderRadius: '4px',
}}
>
<span style={{ fontSize: '14px', color: '#333', flex: 1 }}>
<Icon type="paper-clip" style={{ marginRight: '8px', color: '#1890ff' }} />
{file.Nav_ImgFile?.FILE_NAME || '未知文件'}
</span>
<div>
<Button
type="link"
size="small"
onClick={() => this.handlePreview(file)}
style={{ padding: '0 8px' }}
>
<Icon type="eye" />
预览
</Button>
<Button
type="link"
size="small"
onClick={() => this.handleDownload(file)}
style={{ padding: '0 8px' }}
>
<Icon type="download" />
下载
</Button>
</div>
</div>
))}
</div>
</div> </div>
)} )}
</div> </div>
@ -862,7 +833,7 @@ class HomeContent extends React.Component {
<Col span={8} className={styles.hiddenStatsCol}> <Col span={8} className={styles.hiddenStatsCol}>
<div className={styles.hiddenTitle}>年度隐患数据</div> <div className={styles.hiddenTitle}>年度隐患数据</div>
<div className={styles.hiddenStatItem}> <div className={styles.hiddenStatItem}>
<div className={styles.hiddenStatName}>年度重大隐患数</div> <div className={styles.hiddenStatName}>年度重大隐患数</div>
<div className={styles.hiddenStatValue}>{hiddenSummary.majorQty}</div> <div className={styles.hiddenStatValue}>{hiddenSummary.majorQty}</div>
</div> </div>
<div className={styles.hiddenStatItem}> <div className={styles.hiddenStatItem}>

View File

@ -96,18 +96,17 @@ class RiskControl extends React.Component {
}, },
legend: { legend: {
data: ['重大风险', '较大风险', '一般风险', '低风险'], data: ['重大风险', '较大风险', '一般风险', '低风险'],
orient: 'vertical',
right: '3%', right: '3%',
top: '5%', top: '10%',
itemGap: 16, itemGap: 12,
itemWidth: 18, itemWidth: 16,
itemHeight: 12, itemHeight: 10,
textStyle: { color: '#000', fontSize: 14 }, textStyle: { color: '#000', fontSize: 12 },
}, },
grid: { grid: {
left: '8%', left: '8%',
right: '5%', right: '5%',
top: '18%', top: '28%',
bottom: '8%', bottom: '8%',
containLabel: true, containLabel: true,
}, },
@ -281,7 +280,7 @@ class RiskControl extends React.Component {
axisTick: { show: false }, axisTick: { show: false },
axisLabel: { axisLabel: {
textStyle: { color: '#000' }, textStyle: { color: '#000' },
// rotate: typeNames.length > 4 ? 15 : 0, rotate: typeNames.length > 4 ? 15 : 0,
interval: 0, interval: 0,
fontSize: 12, fontSize: 12,
}, },

View File

@ -98,7 +98,7 @@ class TrainingContent extends React.Component {
legend: { legend: {
data: ['培训人次', '培训场次'], data: ['培训人次', '培训场次'],
right: '3%', // 靠右 right: '3%', // 靠右
top: '5%', // 垂直居中 top: '10%', // 垂直居中
itemGap: 16, itemGap: 16,
itemWidth: 18, itemWidth: 18,
itemHeight: 12, itemHeight: 12,
@ -107,7 +107,7 @@ class TrainingContent extends React.Component {
grid: { grid: {
left: '5%', left: '5%',
right: '5%', // 为右侧垂直图例留出空间 right: '5%', // 为右侧垂直图例留出空间
top: '18%', top: '28%',
bottom: '8%', bottom: '8%',
containLabel: true, containLabel: true,
}, },
@ -267,7 +267,7 @@ class TrainingContent extends React.Component {
legend: { legend: {
data: ['培训人次', '培训场次'], data: ['培训人次', '培训场次'],
right: '3%', // 靠右 right: '3%', // 靠右
top: '5%', // 垂直居中 top: '10%', // 垂直居中
itemGap: 16, itemGap: 16,
itemWidth: 18, itemWidth: 18,
itemHeight: 12, itemHeight: 12,
@ -276,7 +276,7 @@ class TrainingContent extends React.Component {
grid: { grid: {
left: '5%', left: '5%',
right: '5%', // 为右侧垂直图例留出空间 right: '5%', // 为右侧垂直图例留出空间
top: '18%', top: '28%',
bottom: '8%', bottom: '8%',
containLabel: true, containLabel: true,
}, },
@ -416,7 +416,7 @@ class TrainingContent extends React.Component {
legend: { legend: {
data: ['培训人次', '培训场次'], data: ['培训人次', '培训场次'],
right: '3%', // 靠右 right: '3%', // 靠右
top: '5%', // 垂直居中 top: '10%', // 垂直居中
itemGap: 16, itemGap: 16,
itemWidth: 18, itemWidth: 18,
itemHeight: 12, itemHeight: 12,
@ -425,7 +425,7 @@ class TrainingContent extends React.Component {
grid: { grid: {
left: '5%', left: '5%',
right: '5%', // 为右侧垂直图例留出空间 right: '5%', // 为右侧垂直图例留出空间
top: '18%', top: '28%',
bottom: '8%', bottom: '8%',
containLabel: true, containLabel: true,
}, },
@ -512,6 +512,8 @@ class TrainingContent extends React.Component {
const headers = trainingSubIDCard[0] || []; const headers = trainingSubIDCard[0] || [];
// 数据行(从第二行开始) // 数据行(从第二行开始)
const dataRows = trainingSubIDCard.slice(1); const dataRows = trainingSubIDCard.slice(1);
// 生成稳定的 key当数据变化时强制重新创建表格
const tableKey = `${headers.join('-')}-${dataRows.length}`;
// 计算每列的最小宽度(根据表头文字长度) // 计算每列的最小宽度(根据表头文字长度)
const getColumnWidth = (header) => { const getColumnWidth = (header) => {
const chineseCharWidth = 14; // 中文字符宽度(px) const chineseCharWidth = 14; // 中文字符宽度(px)
@ -530,7 +532,7 @@ class TrainingContent extends React.Component {
key: `col${index}`, key: `col${index}`,
align: 'center', align: 'center',
width: getColumnWidth(header), width: getColumnWidth(header),
fixed: index === 0 ? 'left' : index === headers.length - 1 ? 'right' : undefined, fixed: index === 0 ? 'left' : undefined,
render: (text) => { render: (text) => {
if (header === '小计') { if (header === '小计') {
return <strong style={{ color: '#4285f4' }}>{text}</strong>; return <strong style={{ color: '#4285f4' }}>{text}</strong>;
@ -553,11 +555,12 @@ class TrainingContent extends React.Component {
}); });
// 横向滚动配置(当列数过多时) // 横向滚动配置(当列数过多时)
const scrollConfig = columns.length > 10 ? { x: columns.length * 100, y: 380 } : { y: 380 }; const scrollConfig = { x: columns.length * 100, y: 380 };
return ( return (
<div style={{ height: '100%', overflow: 'hidden', padding: '10px' }}> <div style={{ height: '100%', overflow: 'hidden', padding: '10px' }}>
<Table <Table
key={tableKey} // 添加 key 属性,数据变化时强制重新渲染
columns={columns} columns={columns}
dataSource={tableData} dataSource={tableData}
pagination={false} pagination={false}
@ -617,6 +620,9 @@ class TrainingContent extends React.Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
// 当 trainingSubData 或 trainingSubDataMonth 变化时重新渲染图表 // 当 trainingSubData 或 trainingSubDataMonth 变化时重新渲染图表
if (prevProps.trainingSubData !== this.props.trainingSubData) {
this.renderChart1();
}
if ( if (
prevProps.trainingSubDataMonth !== this.props.trainingSubDataMonth || prevProps.trainingSubDataMonth !== this.props.trainingSubDataMonth ||
prevProps.selectedMonth !== this.props.selectedMonth prevProps.selectedMonth !== this.props.selectedMonth

View File

@ -75,7 +75,7 @@ class FullScreen extends React.Component {
// 其他页面数据 // 其他页面数据
riskSubData: {}, riskSubData: {},
classSubData: {}, classSubData: [],
dangerSubData: {}, dangerSubData: {},
dangerCompanyData: [], dangerCompanyData: [],
selectedDangerCompany: '', selectedDangerCompany: '',
@ -170,7 +170,7 @@ class FullScreen extends React.Component {
this.props.dispatch({ this.props.dispatch({
type: 'app/getDataByPost', type: 'app/getDataByPost',
payload: json, payload: json,
url: 'PF/Annourcement/Get', url: 'PF/PFAnnourcement/Get',
onComplete: (ret) => { onComplete: (ret) => {
if (ret && !this.isUnmounted) { if (ret && !this.isUnmounted) {
this.setState({ this.setState({

View File

@ -22,11 +22,8 @@ export default {
return ret return ret
}, },
*getTableData ({ payload, url, onComplete }, { call, put }) { *getTableData ({ payload, url, onComplete }, { call, put }) {
console.log('执行前',appService.getTableData)
const ret = yield call(appService.getTableData, { payload, url }) const ret = yield call(appService.getTableData, { payload, url })
console.log('执行后')
if (typeof onComplete === 'function') { if (typeof onComplete === 'function') {
console.log('执行后',ret)
onComplete(ret) onComplete(ret)
} }
return ret return ret