def templateTaskManagement_tableList(): filter_str = '' for key in request.form: if len(request.form[key]) > 0: if len(filter_str) > 0: filter_str += ' and ' filter_str += " " + key + "='" + request.form[key] + "'" with templateTaskManagement.open_resource("../static/table_schemas/templateTaskManagement.json") as json_file: table_schema = json.load(json_file) resp = commonFunction.load_alertMsg_session() # 读表内容 try: users_data = query_templateTask_join_redisServer(text(filter_str)) identity_list = Identities.get_identity_list(Identities()) opt_list ={} opt_list["identityName"] = identity_list select_dict = commonFunction.construct_select_dict(table_schema) table_res = {"succeed": True, "table_schema_list":table_schema, "table_data":users_data, "opt_list":opt_list, "select_dict":select_dict} resp.update(table_res) except Exception,e: resp = { "succeed":False, "alertType":"danger", "alertMsg":traceback.format_exc() }
def analysisTaskRes_tableList(): filter_str = '' target_table = '' offset = 0 limit = 10 for key in request.form: if key == 'task_id': target_table = request.form[key] elif key == 'offset': offset = request.form[key] elif key == 'limit': limit = request.form[key] if len(request.form[key]) > 0: if len(filter_str) > 0: filter_str += ' and ' filter_str += " " + key + "='" + request.form[key] + "'" with analysisTaskRes.open_resource( "../static/table_schemas/analysisTaskRes.json") as json_file: table_schema = json.load(json_file) resp = commonFunction.load_alertMsg_session() # 读表内容 try: ###确定可以展示的数据表 analysisTask_list = analysisRes.get_analysisRes_list(analysisRes('')) if len(target_table) == 0: ##没有指定目标表 target_data = [] else: ##去查那个指定表,用上filter target_data = query_analysisTaskRes(target_table, filter_str, offset, limit) pass opt_list = {} opt_list["task_id"] = analysisTask_list select_dict = commonFunction.construct_select_dict(table_schema) table_res = { "succeed": True, "table_schema_list": table_schema, "table_data": target_data, "opt_list": opt_list, "select_dict": select_dict, "now_page": 0 } resp.update(table_res) except Exception, e: resp = { "succeed": False, "alertType": "danger", "alertMsg": traceback.format_exc() }
def templateTaskContent_tableList(): filter_str = '' target_table = '' for key in request.form: if key == 'target_table': target_table = request.form[key] continue if len(request.form[key]) > 0: if len(filter_str) > 0: filter_str += ' and ' filter_str += " " + key + "='" + request.form[key] + "'" with templateTaskContent.open_resource( "../static/table_schemas/templateTaskContent.json") as json_file: table_schema = json.load(json_file) resp = commonFunction.load_alertMsg_session() # 读表内容 try: ###确定可以展示的数据表 templateTask_list = [{"id": 1, "name": "msgContents_test9"}] if len(target_table) == 0: ##没有指定目标表 target_data = [] else: ##去查那个指定表,用上filter target_data = query_templateTaskContent(target_table, filter_str) pass opt_list = {} opt_list["templateTask"] = templateTask_list select_dict = commonFunction.construct_select_dict(table_schema) table_res = { "succeed": True, "table_schema_list": table_schema, "table_data": target_data, "opt_list": opt_list, "select_dict": select_dict } resp.update(table_res) except Exception, e: resp = { "succeed": False, "alertType": "danger", "alertMsg": traceback.format_exc() }
def functionManagement_functionList(): filter_str = '' for key in request.form: if len(request.form[key]) > 0: if len(filter_str) > 0: filter_str += ' and ' filter_str += " " + key + "='" + request.form[key] + "'" with functionManagement.open_resource( "../static/table_schemas/functionManagement.json") as json_file: functions_schema = json.load(json_file) resp = commonFunction.load_alertMsg_session() # 读表内容 try: functions_data = query_section_join_function(text(filter_str)) function_list = Functions.get_function_list(Functions()) section_list = Sections.get_section_list(Sections()) opt_list = {} opt_list["functionName"] = function_list opt_list["sectionName"] = section_list select_dict = commonFunction.construct_select_dict(functions_schema) table_res = { "succeed": True, "table_schema_list": functions_schema, "table_data": functions_data, "opt_list": opt_list, "select_dict": select_dict } resp.update(table_res) except Exception, e: resp = { "succeed": False, "alertType": "danger", "alertMsg": traceback.format_exc() }