EricGEGE commited on
Commit
2bbe490
·
verified ·
1 Parent(s): 7555ae7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -36,8 +36,8 @@ def init_sheets():
36
  ['5', 'cevcaigou357', '采购'],
37
  ['6', 'investor888', '观察员'],
38
  ['7', 'cevcaigou888', '采购经理'],
39
- ['8', 'cevcaigou005', '采购']
40
-
41
  ]
42
  for user in new_users:
43
  users.append_row(user)
@@ -64,7 +64,9 @@ def get_next_approval_status(current_status):
64
  elif current_status == '待采购经理/总经理审批':
65
  return '待财务审批'
66
  elif current_status == '待财务审批':
67
- return '已批准'
 
 
68
  return current_status
69
  except Exception as e:
70
  return "操作有误: {}".format(e)
@@ -84,7 +86,8 @@ def approve_order(order_id, approver_role):
84
 
85
  if (current_status == '待单证审批' and approver_role != '单证') or \
86
  (current_status == '待采购经理/总经理审批' and approver_role not in ['采购经理', '总经理']) or \
87
- (current_status == '待财务审批' and approver_role != '财务'):
 
88
  return f'只有{current_status}角色可以批准当前订单'
89
 
90
  next_status = get_next_approval_status(current_status)
@@ -255,7 +258,7 @@ def display_orders(username):
255
  login(username)
256
  allowed_roles = [
257
  '采购', '单证', '财务',
258
- '总经理', '观察员', '采购经理'
259
  ]
260
 
261
  if session_state['role'] not in allowed_roles:
@@ -280,7 +283,7 @@ def approve_order_interface(username, order_id):
280
  try:
281
  login(username)
282
 
283
- allowed_roles = ['单证', '财务', '总经理', '采购经理']
284
 
285
  if session_state['role'] not in allowed_roles:
286
  return "您没有批准订单的权限"
@@ -399,5 +402,4 @@ with gr.Blocks() as app:
399
  approve_order_button.click(fn=approve_order_interface, inputs=[username_approve, order_id],
400
  outputs=approve_order_output)
401
 
402
- app.launch(auth=(log, password))
403
- # app.launch()
 
36
  ['5', 'cevcaigou357', '采购'],
37
  ['6', 'investor888', '观察员'],
38
  ['7', 'cevcaigou888', '采购经理'],
39
+ ['8', 'cevcaigou005', '采购'],
40
+ ['9', 'cevchuna001', '出纳'] # Added new user
41
  ]
42
  for user in new_users:
43
  users.append_row(user)
 
64
  elif current_status == '待采购经理/总经理审批':
65
  return '待财务审批'
66
  elif current_status == '待财务审批':
67
+ return '待出纳审批'
68
+ elif current_status == '待出纳审批':
69
+ return '已付款'
70
  return current_status
71
  except Exception as e:
72
  return "操作有误: {}".format(e)
 
86
 
87
  if (current_status == '待单证审批' and approver_role != '单证') or \
88
  (current_status == '待采购经理/总经理审批' and approver_role not in ['采购经理', '总经理']) or \
89
+ (current_status == '待财务审批' and approver_role != '财务') or \
90
+ (current_status == '待出纳审批' and approver_role != '出纳'):
91
  return f'只有{current_status}角色可以批准当前订单'
92
 
93
  next_status = get_next_approval_status(current_status)
 
258
  login(username)
259
  allowed_roles = [
260
  '采购', '单证', '财务',
261
+ '总经理', '观察员', '采购经理', '出纳' # Added '出纳' to allowed roles
262
  ]
263
 
264
  if session_state['role'] not in allowed_roles:
 
283
  try:
284
  login(username)
285
 
286
+ allowed_roles = ['单证', '财务', '总经理', '采购经理', '出纳'] # Added '出纳' to allowed roles
287
 
288
  if session_state['role'] not in allowed_roles:
289
  return "您没有批准订单的权限"
 
402
  approve_order_button.click(fn=approve_order_interface, inputs=[username_approve, order_id],
403
  outputs=approve_order_output)
404
 
405
+ app.launch(auth=(log, password))