Exemplo n.º 1
0
def GetModuleTree(request, id):
    try:
        result = Module().get_proj_module_tree(id)
        return Response(result)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
Exemplo n.º 2
0
def ModuleList(request, Proj_id):
    try:
        if request.method == "GET":
            result = Module().get_module_list(Proj_id)
            return Response(result)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
Exemplo n.º 3
0
def ModuleSearch(request):
    try:
        if request.method == "POST":
            data = request.data
            result = Module().search_model(data)
            return Response(result)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
Exemplo n.º 4
0
def GetFieldsByProj(request, id):
    try:
        if request.method == "GET":
            result = Module().get_module_field_list_by_proj(id)
            if result:
                return Response(result, status=200)
            else:
                return Response(result, status=200)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
Exemplo n.º 5
0
def BatchDeleteModule(request):
    try:
        if request.method == "DELETE":
            data = request.data
            if data.get("dellist"):
                result = Module().batch_delete(data)
                if not result["error"]:
                    return Response(result, status=200)
                else:
                    return Response(result, status=200)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
Exemplo n.º 6
0
def ChangeModule(request, id):
    try:
        if request.method == "PUT":
            data = request.data
            if data:
                result = Module().change_module(data, id)
                if not result["error"]:
                    return Response(result, status=200)
                else:
                    return Response(result, status=200)
            else:
                error = {"error": "请不要传空数据"}
                return Response(error, status=status.HTTP_204_NO_CONTENT)
        elif request.method == "DELETE":
            result = Module().delete_module(id)
            if not result["error"]:
                return Response(result, status=200)
            else:
                return Response(result, status=status.HTTP_204_NO_CONTENT)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
Exemplo n.º 7
0
def ModuleAdd(request):
    try:
        if request.method == "POST":
            data = request.data
            if data:
                result = Module().add_module(data)
                if not result["error"]:
                    return Response(result, status=status.HTTP_201_CREATED)
                else:
                    return Response(result, status=200)
            else:
                error = {"error": "请不要传空数据"}
                return Response(error, status=status.HTTP_204_NO_CONTENT)
    except Exception as e:
        error = {}
        logging.warning(e)
        error["error"] = [str(e)]
        return Response(error, status=status.HTTP_500_INTERNAL_SERVER_ERROR)