import React, { Component } from 'react'; import { inject, observer } from 'mobx-react'; import './kanban/style/index.less' import Kanban from './kanban'; import { toJS } from 'mobx'; import { Icon, message } from 'antd'; import { WeaInput, WeaAlertPage } from 'ecCom'; import QueueAnim from 'rc-queue-anim'; import { WeaLocaleProvider } from 'ecCom'; const getLabel = WeaLocaleProvider.getLabel; @observer class App extends Component { constructor(props) { super(props); this.state = { columns: props.columns || [], visible: false, groupName: "" } } index = 0; handleAdd = (value) => { const input = this.refs.groupNameInput.refs.inputNormal.refs.input.refs.input; if (value && this.state.visible) { if (this.checkGroupRepeat(value)) { this.props.boardStore.saveGroup(value); this.setState({ visible: !this.state.visible, groupName: "" }); } else { message.error(getLabel('387703', "阶段名称重复!")); } } if (!this.state.visible) { input.focus(); input.setSelectionRange(0, input.value.length); this.setState({ visible: !this.state.visible, groupName: "" }); } } checkGroupRepeat = (name) => { const { boardStore: { columns } } = this.props; let checked = true; const stages = toJS(columns); stages.map(item => { if (item.title == name) { checked = false; } }); return checked; } componentWillUnmount() { const { boardStore, columns } = this.props; boardStore.clearStatus(); } render() { const { boardStore } = this.props; const { userid, usericons, username, delGrop, isedit, columns, canEditBoard, canAddTask } = boardStore; if (!isedit && columns && columns.length == 0) { return (
{getLabel('387719', "对不起,该看板暂无数据 !")}
) } else { return (
{getLabel('387718', "新建阶段")}
{ this.setState({ groupName: value }) }} onBlur={value => { this.handleAdd(value); }} />
} onChange={boardStore.doMovePrjBoard} > {boardStore.columns && boardStore.columns.map((column) => { return ( delGrop(id)} userInfo={{ userid: userid, username: username, usericons: usericons }} isedit={isedit} canEditBoard={canEditBoard} canAddTask={canAddTask} groupid={column.id} // footer={ } saveTask={(params) => { this.props.boardStore.saveTask(params) }} saveGroupName={(name, id) => { this.props.boardStore.saveGroupName(name, id) }} checkRepeat={(name, id) => { this.props.boardStore.checkGroupRepeat(name, id) }} // extra={} > { this.getItems(column.items) } ) }) }
); } } getItems = (items) => { const { boardStore: { canAddTask, canEditBoard } } = this.props; let comItems = []; items && items.map((item) => { comItems.push( { this.props.boardStore.setLandMark(id, value) }} onTaskClick={(value) => { this.props.boardStore.showSlideModal(true, value) }} finish={item.finish} key={item.id} /> ) }) return comItems; } } export default App;