2018-06-05逻辑与

2018-06-05  本文已影响0人  NOTEBOOK2

&&只有在用逻辑与的时候才发现自己是没有逻辑的

    let gridActions = [
      {
        name: 'View',
        hide: () => !viewPermission,
        onClick: (item) => {
          const { id } = item;
          let { store_id } = this.props.params;
          routeHelper.goProductionOrders(store_id, id);
        }
      },
      {
        name: 'Approve',
        hide: (item) => !(approvalPermission && item.state === 'created'),
        onClick: (item) => {
          const { id } = item;
          this.props.actions.approve(id)
        }
      },
      {
        name: 'Cancel',
        hide: (item) => !(cancelPermission && ['fulfilled', 'canceled'].indexOf(item.state) === -1),
        onClick: (item) => {
          if (!confirm('Do you really want to cancel this order?')) return false;
          const { id } = item;
          this.props.actions.cancel(id)
        }
      }
    ];  
上一篇下一篇

猜你喜欢

热点阅读