@bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
    '\n    货架列表\n    :return:\n    '
    template_name = 'rack/lists.html'
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('rack lists')
    form = RackSearchForm(request.form)
    form.warehouse_id.choices = get_warehouse_choices()
    search_condition = [(Rack.status_delete == STATUS_DEL_NO)]
    if (request.method == 'POST'):
        if (not form.validate_on_submit()):
            flash(_('Search Failure'), 'danger')
            if (hasattr(form, 'csrf_token') and getattr(form, 'csrf_token').errors):
                map((lambda x: flash(x, 'danger')), form.csrf_token.errors)
        else:
            if (form.warehouse_id.data != DEFAULT_SEARCH_CHOICES_INT_OPTION):
                search_condition.append((Rack.warehouse_id == form.warehouse_id.data))
            if form.name.data:
                search_condition.append((Rack.name == form.name.data))
        if (form.op.data == OPERATION_EXPORT):
            if (not permission_rack_section_export.can()):
                abort(403)
            column_names = Rack.__table__.columns.keys()
            query_sets = get_rack_rows(*search_condition)
            return excel.make_response_from_query_sets(query_sets=query_sets, column_names=column_names, file_type='csv', file_name=('%s.csv' % _('rack lists')))
        if (form.op.data == OPERATION_DELETE):
            if (not permission_rack_section_del.can()):
                abort(403)
            rack_ids = request.form.getlist('rack_id')
            permitted = True
            for rack_id in rack_ids:
                if count_inventory(**{'rack_id': rack_id, 'status_delete': STATUS_DEL_NO}):
                    ext_msg = _('Currently In Use')
                    flash(_('Del Failure, %(ext_msg)s', ext_msg=ext_msg), 'danger')
                    permitted = False
                    break
            if permitted:
                result_total = True
                for rack_id in rack_ids:
                    current_time = datetime.utcnow()
                    rack_data = {'status_delete': STATUS_DEL_OK, 'delete_time': current_time, 'update_time': current_time}
                    result = edit_rack(rack_id, rack_data)
                    result_total = (result_total and result)
                if result_total:
                    flash(_('Del Success'), 'success')
                else:
                    flash(_('Del Failure'), 'danger')
    pagination = get_rack_pagination(form.page.data, PER_PAGE_BACKEND, *search_condition)
    return render_template(template_name, form=form, pagination=pagination, **document_info)
货架列表
:return:
@bp_rack.route('/lists.html', methods=['GET', 'POST'])
@login_required
@permission_rack_section_search.require(http_exception=403)
def lists():
    '\n    货架列表\n    :return:\n    '
    template_name = 'rack/lists.html'
    document_info = DOCUMENT_INFO.copy()
    document_info['TITLE'] = _('rack lists')
    form = RackSearchForm(request.form)
    form.warehouse_id.choices = get_warehouse_choices()
    search_condition = [(Rack.status_delete == STATUS_DEL_NO)]
    if (request.method == 'POST'):
        if (not form.validate_on_submit()):
            flash(_('Search Failure'), 'danger')
            if (hasattr(form, 'csrf_token') and getattr(form, 'csrf_token').errors):
                map((lambda x: flash(x, 'danger')), form.csrf_token.errors)
        else:
            if (form.warehouse_id.data != DEFAULT_SEARCH_CHOICES_INT_OPTION):
                search_condition.append((Rack.warehouse_id == form.warehouse_id.data))
            if form.name.data:
                search_condition.append((Rack.name == form.name.data))
        if (form.op.data == OPERATION_EXPORT):
            if (not permission_rack_section_export.can()):
                abort(403)
            column_names = Rack.__table__.columns.keys()
            query_sets = get_rack_rows(*search_condition)
            return excel.make_response_from_query_sets(query_sets=query_sets, column_names=column_names, file_type='csv', file_name=('%s.csv' % _('rack lists')))
        if (form.op.data == OPERATION_DELETE):
            if (not permission_rack_section_del.can()):
                abort(403)
            rack_ids = request.form.getlist('rack_id')
            permitted = True
            for rack_id in rack_ids:
                if count_inventory(**{'rack_id': rack_id, 'status_delete': STATUS_DEL_NO}):
                    ext_msg = _('Currently In Use')
                    flash(_('Del Failure, %(ext_msg)s', ext_msg=ext_msg), 'danger')
                    permitted = False
                    break
            if permitted:
                result_total = True
                for rack_id in rack_ids:
                    current_time = datetime.utcnow()
                    rack_data = {'status_delete': STATUS_DEL_OK, 'delete_time': current_time, 'update_time': current_time}
                    result = edit_rack(rack_id, rack_data)
                    result_total = (result_total and result)
                if result_total:
                    flash(_('Del Success'), 'success')
                else:
                    flash(_('Del Failure'), 'danger')
    pagination = get_rack_pagination(form.page.data, PER_PAGE_BACKEND, *search_condition)
    return render_template(template_name, form=form, pagination=pagination, **document_info)