|
@@ -189,7 +189,7 @@ async def get_info_detail(
|
|
|
|
|
|
# 是否我的审批事项(待审批)
|
|
|
is_my_examine = 0
|
|
|
- examine_row = db.query(InfoPublishExamine).filter(InfoPublishExamine.del_flag == "0").filter(InfoPublishExamine.user_id == user_id).filter(InfoPublishExamine.examine_sub_type == 20).order_by(InfoPublishExamine.id.desc()).limit(1).first()
|
|
|
+ examine_row = db.query(InfoPublishExamine).filter(InfoPublishExamine.del_flag == "0").filter(InfoPublishExamine.user_id == user_id).filter(InfoPublishExamine.examine_sub_type == 20).order_by(InfoPublishExamine.id.desc()).first()
|
|
|
if examine_row is not None:
|
|
|
is_my_examine = 1
|
|
|
|
|
@@ -489,6 +489,98 @@ async def work_approval_list(
|
|
|
traceback.print_exc()
|
|
|
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
|
|
+@router.get('/work_approval/detail')
|
|
|
+async def get_info_detail(
|
|
|
+ request: Request,
|
|
|
+ id: str = Query(None, description='信息编号'),
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ user_id = Depends(valid_access_token)):
|
|
|
+
|
|
|
+ try:
|
|
|
+ # 构建查询
|
|
|
+ query = db.query(InfoPublishBase)
|
|
|
+ query = query.filter(InfoPublishBase.id == id)
|
|
|
+
|
|
|
+
|
|
|
+ # 执行查询
|
|
|
+ row = query.first()
|
|
|
+ if row is not None:
|
|
|
+
|
|
|
+ # 发布申请人
|
|
|
+ recorded_by = row.recorded_by
|
|
|
+
|
|
|
+ user_row = db.query(SysUser).filter(SysUser.user_id == recorded_by).first()
|
|
|
+ nick_name = ""
|
|
|
+ dept_name = ""
|
|
|
+
|
|
|
+ if user_row is not None:
|
|
|
+ nick_name = user_row.nick_name
|
|
|
+ dept_id = user_row.dept_id
|
|
|
+ dept_row = db.query(SysDept).filter(SysDept.dept_id == dept_id).first()
|
|
|
+ if dept_row is not None:
|
|
|
+ dept_name = dept_row.dept_name
|
|
|
+
|
|
|
+ # 是否我的审批事项(待审批)
|
|
|
+ is_my_examine = 0
|
|
|
+ examine_row = db.query(InfoPublishExamine).filter(InfoPublishExamine.del_flag == "0").filter(InfoPublishExamine.user_id == user_id).filter(InfoPublishExamine.examine_sub_type == 20).order_by(InfoPublishExamine.id.desc()).first()
|
|
|
+ if examine_row is not None:
|
|
|
+ is_my_examine = 1
|
|
|
+
|
|
|
+ data = {
|
|
|
+ "id": row.id,
|
|
|
+ "title": row.title,
|
|
|
+ "info_type": row.info_type,
|
|
|
+ "add_time": row.add_time.strftime("%Y-%m-%d %H:%M"),
|
|
|
+ "nick_name": nick_name,
|
|
|
+ "dept_name": dept_name,
|
|
|
+ "publish_group": row.publish_group,
|
|
|
+ "content": row.content,
|
|
|
+ "publish_time": get_datetime_str(row.publish_time),
|
|
|
+ "publish_channel": row.publish_channel,
|
|
|
+ "is_my_examine": is_my_examine
|
|
|
+ }
|
|
|
+
|
|
|
+ # 附件
|
|
|
+ rows = db.query(InfoPublishFile).filter(and_(InfoPublishFile.from_scenario=="infopublish_attach_file", InfoPublishFile.foreign_key == id, InfoPublishFile.del_flag == '0')).all()
|
|
|
+ data['files'] = [
|
|
|
+ {
|
|
|
+ "name": row.file_name,
|
|
|
+ "url": row.storage_file_name
|
|
|
+ }
|
|
|
+ for row in rows
|
|
|
+ ]
|
|
|
+
|
|
|
+ # 审批进度
|
|
|
+ data["examines"] = []
|
|
|
+ rows = db.query(InfoPublishExamine).filter(InfoPublishExamine.publish_id == id).filter(InfoPublishExamine.del_flag == '0').all()
|
|
|
+ for row in rows:
|
|
|
+ data["examines"].append({
|
|
|
+ "examine_type": EXAMINE_TYPE_DICT[row.examine_type],
|
|
|
+ "examine_sub_type": EXAMINE_SUB_TYPE_DICT[row.examine_sub_type],
|
|
|
+ "content": row.content,
|
|
|
+ "examine_time": get_datetime_str(row.examine_time),
|
|
|
+ "user_id": row.user_id,
|
|
|
+ "user_name": row.user_name,
|
|
|
+ "nick_name": row.nick_name
|
|
|
+ })
|
|
|
+
|
|
|
+ return {
|
|
|
+ "code": 200,
|
|
|
+ "msg": "查询成功",
|
|
|
+ "data": data
|
|
|
+ }
|
|
|
+ else:
|
|
|
+ return {
|
|
|
+ "code": 500,
|
|
|
+ "msg": "查询失败"
|
|
|
+ }
|
|
|
+
|
|
|
+ except Exception as e:
|
|
|
+ # 处理异常
|
|
|
+ traceback.print_exc()
|
|
|
+ raise HTTPException(status_code=500, detail=str(e))
|
|
|
+
|
|
|
+
|
|
|
# 审批确认
|
|
|
@router.post("/work_approval/confirm")
|
|
|
async def work_approval_confirm(
|