lodash#pullAllBy JavaScript Examples

The following examples show how to use lodash#pullAllBy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
deletePermissions() {
    const { permissionsSelectedRows = [], dataSource } = this.state;
    this.setState({
      dataSource: {
        ...dataSource,
        permissions: pullAllBy([...dataSource.permissions], permissionsSelectedRows, 'id'),
      },
    });
  }
Example #2
Source File: LovModal.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
@Bind()
  onSelectAll(selected, newSelectedRows, changeRows) {
    const { selectedRows = [] } = this.state;
    this.setState({
      selectedRows: selected
        ? selectedRows.concat(changeRows)
        : pullAllBy([...selectedRows], changeRows, 'lovId'),
    });
  }
Example #3
Source File: PermissionsModal.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
@Bind()
  onSelectAll(selected, newSelectedRows, changeRows) {
    const { selectedRows = [] } = this.state;
    this.setState({
      selectedRows: selected
        ? selectedRows.concat(changeRows)
        : pullAllBy([...selectedRows], changeRows, 'id'),
    });
  }
Example #4
Source File: index.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
deleteRow() {
    const { selectedRows, dataSource, pagination } = this.state;
    const { handleDelete = e => e, roleDatasource = {} } = this.props;
    const { current, pageSize } = pagination;
    const { getFieldsValue = e => e } = this.queryForm;
    const data = selectedRows.filter(o => isInteger(Number(o.key)));
    this.setState({
      dataSource: pullAllBy(
        [...dataSource],
        selectedRows.filter(o => !isInteger(Number(o.key)), 'key')
      ),
    });
    if (!isEmpty(data)) {
      handleDelete(
        data.map(n => ({
          memberId: n.id,
          roleId: roleDatasource.id,
        })),
        () => {
          notification.success();
          this.fetchDataSource({
            roleId: roleDatasource.id,
            page: current - 1,
            size: pageSize,
            ...getFieldsValue(),
          });
        }
      );
    }
  }
Example #5
Source File: LovModal.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
@Bind()
  onSelectAll(selected, newSelectedRows, changeRows) {
    const { selectedRows = [] } = this.state;
    this.setState({
      selectedRows: selected
        ? selectedRows.concat(changeRows)
        : pullAllBy([...selectedRows], changeRows, 'lovId'),
    });
  }
Example #6
Source File: PermissionsModal.js    From hzero-front with Apache License 2.0 6 votes vote down vote up
@Bind()
  onSelectAll(selected, newSelectedRows, changeRows) {
    const { selectedRows = [] } = this.state;
    this.setState({
      selectedRows: selected
        ? selectedRows.concat(changeRows)
        : pullAllBy([...selectedRows], changeRows, 'id'),
    });
  }
Example #7
Source File: PermissionsLov.js    From hzero-front with Apache License 2.0 5 votes vote down vote up
onSelectAll(selected, newSelectedRows, changeRows) {
    const { selectedRows = [] } = this.state;
    this.setState({
      selectedRows: selected
        ? selectedRows.concat(changeRows)
        : pullAllBy([...selectedRows], changeRows, 'id'),
    });
  }
Example #8
Source File: index.js    From hzero-front with Apache License 2.0 5 votes vote down vote up
onPermissionsSelectAll(selected, newSelectedRows, changeRows) {
    const { permissionsSelectedRows = [] } = this.state;
    this.setState({
      permissionsSelectedRows: selected
        ? permissionsSelectedRows.concat(changeRows)
        : pullAllBy([...permissionsSelectedRows], changeRows, 'id'),
    });
  }
Example #9
Source File: Company.js    From hzero-front with Apache License 2.0 5 votes vote down vote up
/**
   * 选中父级后同时选中子集
   * @param {*Object} record 当前操作的行
   * @param {*boolean} selected 选中标记
   * @param {*Array} selectedRows 已经选中行数据
   */
  @Bind()
  selectChilds(record = {}, selected, selectedRows) {
    const { loading } = this.props;
    const { updateLoading, originList } = this.state;
    if (updateLoading || loading) return;
    this.setState({
      updateLoading: true,
    });
    let grandsonList = [];
    const childType = this.findChildType(record.typeCode);
    const childLists = originList.filter(
      (list) => list.parentId === record.dataId && list.typeCode && list.typeCode === childType
    );
    childLists.map((childList) => {
      const grandsonType = this.findChildType(childList.typeCode);
      grandsonList = unionWith(
        grandsonList,
        originList.filter(
          (list) =>
            list.parentId === childList.dataId && list.typeCode && list.typeCode === grandsonType
        )
      );
      return grandsonList;
    });
    let rows;
    if (selected) {
      rows = unionWith(unionWith(selectedRows, childLists), grandsonList);
    } else {
      rows = pullAllBy(pullAllBy(selectedRows, childLists, 'dataId'), grandsonList, 'dataId');
    }
    this.setState(
      {
        checkedList: uniqBy(rows, 'id'),
      },
      () => {
        this.handleSaveCompany();
      }
    );
  }
Example #10
Source File: PermissionsLov.js    From hzero-front with Apache License 2.0 5 votes vote down vote up
onSelectAll(selected, newSelectedRows, changeRows) {
    const { selectedRows = [] } = this.state;
    this.setState({
      selectedRows: selected
        ? selectedRows.concat(changeRows)
        : pullAllBy([...selectedRows], changeRows, 'id'),
    });
  }
Example #11
Source File: index.js    From hzero-front with Apache License 2.0 5 votes vote down vote up
onPermissionsSelectAll(selected, newSelectedRows, changeRows) {
    const { permissionsSelectedRows = [] } = this.state;
    this.setState({
      permissionsSelectedRows: selected
        ? permissionsSelectedRows.concat(changeRows)
        : pullAllBy([...permissionsSelectedRows], changeRows, 'id'),
    });
  }