Commit 927d5d48 authored by taabe's avatar taabe

增加查询危险因素关联对象个数接口

parent d54c4d65
...@@ -217,7 +217,8 @@ export const FasSerUrl = { ...@@ -217,7 +217,8 @@ export const FasSerUrl = {
getTextPlanUrl: completePrefix(baseURI, 'api/visual/plan/text/{id}'),//获取文字预案信息 getTextPlanUrl: completePrefix(baseURI, 'api/visual/plan/text/{id}'),//获取文字预案信息
uploadTextPlan: completePrefix(baseURI, 'file/plan/{appId}/texts'), uploadTextPlan: completePrefix(baseURI, 'file/plan/{appId}/texts'),
getTreeNodeTypeUrl: completePrefix(baseURI, 'api/riskModel/riskSource/getChildTypeByPid?riskSourceId={riskSourceId}'),// 根据节点ID获取子节点可能的类型 getTreeNodeTypeUrl: completePrefix(baseURI, 'api/riskModel/riskSource/getChildTypeByPid?riskSourceId={riskSourceId}'),// 根据节点ID获取子节点可能的类型
getAllUserUrl: completePrefix(baseURI, 'api/common/user/list')//获取所有用户 getAllUserUrl: completePrefix(baseURI, 'api/common/user/list'),//获取所有用户
queryFmeaControlObjUrl: endConf.completePrifix(baseURI, 'api/riskModel/fmea/{ids}/controlObjCount')//根据fmea id查询关联对象个数
}; };
......
...@@ -155,6 +155,11 @@ export const getTreeNodeTypeAction = (riskSourceId) => { ...@@ -155,6 +155,11 @@ export const getTreeNodeTypeAction = (riskSourceId) => {
return commonGet(url); return commonGet(url);
}; };
export const queryFmeaControlObjAction = (ids) => {
let url = formatUrl(FasSerUrl.queryFmeaControlObjUrl, { ids });
return commonGet(url);
};
/** /**
* 获取预案树 * 获取预案树
*/ */
......
...@@ -167,6 +167,9 @@ class AssociatedPointTable extends Component { ...@@ -167,6 +167,9 @@ class AssociatedPointTable extends Component {
} }
AssociatedPointTable.propTypes = { AssociatedPointTable.propTypes = {
dataList: PropTypes.array,
fetchData: PropTypes.func,
totalCount: PropTypes.number
}; };
export default AssociatedPointTable; export default AssociatedPointTable;
...@@ -16,7 +16,8 @@ import { ...@@ -16,7 +16,8 @@ import {
deleteAssoPointAction, deleteAssoPointAction,
queryRiskSourceDetailAction, queryRiskSourceDetailAction,
updateRiskSourceRpniAction, updateRiskSourceRpniAction,
getTreeNodeTypeAction getTreeNodeTypeAction,
queryFmeaControlObjAction
} from '../../../../services/preControlService'; } from '../../../../services/preControlService';
import ToolBar from './common/ToolBar'; import ToolBar from './common/ToolBar';
import FmeaTable from './FmeaTable'; import FmeaTable from './FmeaTable';
...@@ -314,7 +315,11 @@ class RiskModel extends Component { ...@@ -314,7 +315,11 @@ class RiskModel extends Component {
deleteParamByActiveKey =(selectedRowKeys,selectedRows, activeKey, subActiveKey)=>{ deleteParamByActiveKey =(selectedRowKeys,selectedRows, activeKey, subActiveKey)=>{
if (activeKey === '1'){ if (activeKey === '1'){
let record = selectedRows[0]; let record = selectedRows[0];
this.fmeaDelete(selectedRowKeys, record.riskSourceId); let ids = [];
selectedRows.map(r => ids.push(r.id));
queryFmeaControlObjAction(ids).then(data => {
this.fmeaDelete(selectedRowKeys, selectedRows, record.riskSourceId, data.dataList);
});
} else if (activeKey === '2' && subActiveKey === '2-1'){ } else if (activeKey === '2' && subActiveKey === '2-1'){
this.deleteAssoPoint(selectedRows); this.deleteAssoPoint(selectedRows);
} else if (activeKey === '2' && subActiveKey === '2-2'){ } else if (activeKey === '2' && subActiveKey === '2-2'){
...@@ -533,10 +538,16 @@ class RiskModel extends Component { ...@@ -533,10 +538,16 @@ class RiskModel extends Component {
); );
}; };
fmeaDelete = (fmeaIds, riskSourceId) => { fmeaDelete = (fmeaIds, selectedRows, riskSourceId, associatedObjCount) => {
// let id = record.id;
let { node } = this.state; let { node } = this.state;
AmosAlert.confirm('提示', '确定要删除么?', { let doubleConfirm = false;
selectedRows.map(row => {
if (row.evaluationOid > 0) {
doubleConfirm = true;
}
});
let msg = (doubleConfirm || associatedObjCount > 0) ? '删除后会清空评价和关联对象相关数据,是否确认删除?' : '确定要删除么?';
AmosAlert.confirm('提示', msg, {
callback: flag => { callback: flag => {
if (flag) { if (flag) {
// 确定 // 确定
...@@ -774,7 +785,7 @@ class RiskModel extends Component { ...@@ -774,7 +785,7 @@ class RiskModel extends Component {
remove = (targetKey) => { remove = (targetKey) => {
const panes = this.state.panes.filter(pane => pane.key !== targetKey); const panes = this.state.panes.filter(pane => pane.key !== targetKey);
this.setState({ panes, activeKey: '1' }); this.setState({ panes, activeKey: '1', pointData: [], equipData: [], pointDataTotalNum: 0, equipDataTotalNum: 0 });
} }
add = () => { add = () => {
...@@ -782,7 +793,7 @@ class RiskModel extends Component { ...@@ -782,7 +793,7 @@ class RiskModel extends Component {
const activeKey = '2'; const activeKey = '2';
let pane = panes.filter(pane => pane.key === activeKey); let pane = panes.filter(pane => pane.key === activeKey);
pane.length === 0 && panes.push({ title: '关联对象', content: '关联对象', key: activeKey }); pane.length === 0 && panes.push({ title: '关联对象', content: '关联对象', key: activeKey });
this.setState({ panes, activeKey }); this.setState({ panes, activeKey, pointData: [], equipData: [], pointDataTotalNum: 0, equipDataTotalNum: 0 });
} }
getTabPaneContent = (key) => { getTabPaneContent = (key) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment