以关注页面为例:
html:
1
js:
1
后台falsk:
1 # 关注任务数据 2 @task_mgm.route('/taskDataFocus') 3 @sso_wrapper 4 def taskinfo_dataFocus_fun(): 5 try: 6 which = request.values.get('which') 7 advance = request.values.get('advance') 8 startTime = request.values.get('stime') # 起时 9 endTime = request.values.get('etime')10 time_str = setTime()11 if startTime is None or startTime is '' or startTime == 'undefined':12 startTime = time_str.split("|")[0]13 if endTime is None or endTime is '' or endTime == 'undefined':14 endTime = time_str.split("|")[1]15 16 # 应该根据用户名或ID 的到自己的任务 现在先暂时应任务ID17 if which == "undefined" and advance == "undefined":18 tasks = Task.query.filter(19 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.endTime >= startTime, Task.endTime <= endTime,20 )).order_by(Task.updateTime.desc()).all()21 elif which == "create_mine":22 tasks = Task.query.filter(23 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.createPeople == g.name24 )).order_by(Task.updateTime.desc()).all()25 elif which == "res_mine":26 tasks = Task.query.filter(27 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.resPeople == g.name28 )).order_by(Task.updateTime.desc()).all()29 elif which == "exe_mine":30 tasks = Task.query.filter(31 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.exePeople == g.name32 )).order_by(Task.updateTime.desc()).all()33 elif advance == "advance_0":34 tasks = Task.query.filter(35 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.advanceId == 036 )).order_by(Task.updateTime.desc()).all()37 elif advance == "advance_2":38 tasks = Task.query.filter(39 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.advanceId == 140 )).order_by(Task.updateTime.desc()).all()41 elif advance == "advance_4":42 tasks = Task.query.filter(43 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.advanceId == 244 )).order_by(Task.updateTime.desc()).all()45 elif advance == "advance_6":46 tasks = Task.query.filter(47 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.advanceId == 348 )).order_by(Task.updateTime.desc()).all()49 elif advance == "advance_8":50 tasks = Task.query.filter(51 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.advanceId == 452 )).order_by(Task.updateTime.desc()).all()53 elif advance == "advance_10":54 tasks = Task.query.filter(55 and_(Task.isDelete != 1, Task.ifFocus == 1, Task.advanceId == 556 )).order_by(Task.updateTime.desc()).all()57 58 data = sql3json(tasks, ["id", "endState", "taskName", "advanceId", "urgentId", "createPeople", "resPeople", "exePeople", "ifFocus", "updateTime"])59 return data60 except Exception as e:61 logging.error(e)