weaver_trunk_cli/pc4mobx/prj/components/dialog/modifyLogDialog.js

77 lines
2.7 KiB
JavaScript

import {Form, Input, Button, } from 'antd';
import {WeaDialog, WeaSearchGroup, WeaInput,WeaAuth ,WeaTab,WeaTools,WeaNewScroll,WeaRightMenu,WeaLocaleProvider} from 'ecCom';
import {inject, observer} from "mobx-react";
import {toJS} from 'mobx';
import _mapValues from 'lodash/mapValues'
import {WeaTableNew} from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
const getLabel = WeaLocaleProvider.getLabel;
@observer
class ModifyLogDialog extends React.Component {
constructor(props) {
super(props);
this.state={
visible:false
}
}
shouldComponentUpdate(nextProps,nextState){
return true
}
render() {
const {title,tableStore} = this.props;
const {visible} = this.state;
return (
<div>
<WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@bquco7`}
title={title || getLabel(83,"日志")}
visible={visible}
buttons={this.getButtons()}
icon="icon-coms-project"
iconBgcolor="#217346"
onCancel={()=>{this.setVisible(false)}}
style={{width:'700px', height:'400px'}}
>
<WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@717vg5`} height={"100%"}>
<WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@hpw1sn`}
comsWeaTableStore={tableStore}
hasOrder={true}
needScroll={false}
getColumns={c=>this.reRenderColumns(c)}
/>
</WeaNewScroll>
</WeaDialog>
</div>)
}
getButtons(){
let btnArr = [];
btnArr.push(<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@gqc6mc@close`} type="primary" onClick={()=>this.setVisible(false)}>{getLabel(309,"关闭")}</Button>)
return btnArr;
}
setVisible=(bool)=>{
this.setState({visible:bool});
}
reRenderColumns(columns){
const {store} = this.props;
columns.forEach(c=>{
if(c.dataIndex=='id'){
c.render = function(text, record){
if(record.logtype=='m'){
return <a href="javascript:void(0)" onClick={() => {store.getPrjFieldLogList({prjid:store.prjid,logid:record.id});store.setFieldLogVisible(true)}}>{getLabel(506390,'点击查看详情')}</a>;
}else{
return '';
}
}
}
})
return columns;
}
}
export default ModifyLogDialog;