import { WeaTools, WeaTab, WeaInput, WeaSelect } from 'ecCom'; import React, { Component } from 'react'; import loadjs from 'loadjs'; import { inject, observer } from 'mobx-react'; import "./style/board.less"; import Column from './Column'; import { Icon, message, Button, Select} from 'antd'; import { MouseWheelFun } from './util/compatible'; import { WeaLocaleProvider } from 'ecCom'; import { toJS } from 'mobx'; import { Condition } from "../list/listCondition" const ButtonGroup = Button.Group; const getLabel = WeaLocaleProvider.getLabel; const Option = Select.Option; @inject("projectBoardStore") @observer class BoardApp extends Component { constructor(props) { super(props); this.state = { } const { projectBoardStore } = props; window.onresize = () => { projectBoardStore.windowHeight = window.innerHeight; projectBoardStore.windowWidth = window.innerWidth; }; } componentDidMount() { const { projectBoardStore } = this.props; let jsFiles = []; if (!WeaTools.isBelowIE9()) { jsFiles.push('/proj/e9resource/boardjs/web-animations.min.js'); } jsFiles = [...jsFiles, '/proj/e9resource/boardjs/hammer.min.js', '/proj/e9resource/boardjs/muuri.js']; if (!loadjs.isDefined('boardjs')) { loadjs(jsFiles, 'boardjs', { success: () => { projectBoardStore.getKanbanView(); } }); } else { projectBoardStore.getKanbanView(); } MouseWheelFun('prj_board_container', 'prj_board'); } componentWillReceiveProps (nextProps) { const { projectBoardStore } = nextProps; let jsFiles = []; if (!WeaTools.isBelowIE9()) { jsFiles.push('/proj/e9resource/boardjs/web-animations.min.js'); } jsFiles = [...jsFiles, '/proj/e9resource/boardjs/hammer.min.js', '/proj/e9resource/boardjs/muuri.js']; if (!loadjs.isDefined('boardjs')) { loadjs(jsFiles, 'boardjs', { success: () => { projectBoardStore.getKanbanView(); } }); } else { projectBoardStore.getKanbanView(); } MouseWheelFun('prj_board_container', 'prj_board'); } render() { const { projectBoardStore } = this.props; const { userid, usericons, username, delGrop, changeSearchType, searchType, columns, timestamp, canAddTask, canEditBoard, boardform, setShowSearchAd, showSearchAd, searchTypeOptions, searchKanBanView } = projectBoardStore; return (
{ setShowSearchAd(bool) }} hideSearchAd={() => setShowSearchAd(false)} searchsAd={
} showSearchAd={showSearchAd} onChange={this.changeVision} buttonsAd={this.getAdButtons()} buttons={[ { changeSearchType(v); }} />]} />
{columns.map(element => { return { projectBoardStore.saveGroupName(name, id) }} checkRepeat={(name, id) => { projectBoardStore.checkGroupRepeat(name, id) }} saveTask={(params) => { projectBoardStore.saveTask(params) }} delGrop={(id) => delGrop(id)} canAddTask={canAddTask} userInfo={{ userid: userid, username: username, usericons: usericons }} /> })} {searchType=="stageid"&&
{getLabel('387718', "新建阶段")}
{ this.setState({ groupName: value }) }} onBlur={value => { this.handleAdd(value); }} />
} {/* {projectBoardStore.hasRight&&} */}
) } handleAdd = (value) => { const input = this.refs.groupNameInput.refs.inputNormal.refs.input.refs.input; if (value!=="" && this.state.visible) { if (this.checkGroupRepeat(value)) { this.props.projectBoardStore.saveGroup(value); this.setState({ visible: !this.state.visible, groupName: "" }); } else { message.error(getLabel('387703', "阶段名称重复!")); } }else if(value == "" && this.state.visible ){ this.setState({ visible: !this.state.visible, groupName: "" }); }else if (!this.state.visible) { input.focus(); input.setSelectionRange(0, input.value.length); this.setState({ visible: !this.state.visible, groupName: "" }); } } checkGroupRepeat = (name) => { const { projectBoardStore: { columns } } = this.props; let checked = true; const stages = toJS(columns); stages.map(item => { if (item.title == name) { checked = false; } }); return checked; } getAdButtons = () => { const { projectBoardStore } = this.props; const { searchKanBanView, setShowSearchAd, clearFormFields } = projectBoardStore; return [ (), (), () ]; } onEnterSearch=() =>{ const { projectBoardStore } = this.props; projectBoardStore.searchKanBanView(false); projectBoardStore.setShowSearchAd(false); } } export default BoardApp;