新增并注册项目信息修改

This commit is contained in:
2026-01-27 14:07:41 +08:00
parent 283f7849f8
commit 98944ecbdc
4 changed files with 67 additions and 19 deletions
+49 -6
View File
@@ -9,6 +9,7 @@ F6 后台执行模块
- 车辆信息管理
- 项目信息批量启停
- 材料信息批量修改
- 项目信息批量修改
依赖:
- requests: HTTP 请求
@@ -438,11 +439,11 @@ class F6PluginModule:
return {'msg': '正在执行', 'msg_details': '正在执行,请稍后看结果'}
@staticmethod
def disable_material(data: Dict[str, Any]) -> Dict[str, str]:
def modify_material(data: Dict[str, Any]) -> Dict[str, str]:
"""
材料批量启停
材料批量修改
从简道云获取材料批量启停请求,读取 Excel 文件,并在后台线程中批量启停材料。
从简道云获取材料批量修改请求,读取 Excel 文件,并在后台线程中批量修改材料。
立即返回"正在执行"的提示,实际创建在后台线程中执行。
Args:
@@ -452,12 +453,12 @@ class F6PluginModule:
Dict[str, str]: 包含执行状态的字典,{'msg': '正在执行', 'msg_details': '正在执行,请稍后看结果'}
"""
entry_data = api_instance.entry_data_get(data=data, replace=True)
print('执行 材料批量停用/启用')
print('执行 材料信息批量修改')
username = entry_data['data']['账号']
password = entry_data['data']['密码']
company_name = entry_data['data']['公司名称']
save_path = entry_data['data']['文件保存地址']
option = entry_data['data']['项目材料批量操作']
option = entry_data['data']['材料信息批量修改']
login_response = F6Module.login_in(username, password, company_name)
if login_response is None:
@@ -479,10 +480,52 @@ class F6PluginModule:
return {'msg': '正在执行', 'msg_details': '正在执行,请稍后看结果'}
@staticmethod
def modify_project(data: Dict[str, Any]) -> Dict[str, str]:
"""
项目批量修改
从简道云获取项目批量修改请求,读取 Excel 文件,并在后台线程中批量修改项目。
立即返回"正在执行"的提示,实际创建在后台线程中执行。
Args:
data: 包含表单ID(api_key)、表单ID(entry_id)、数据ID(data_id)的字典
Returns:
Dict[str, str]: 包含执行状态的字典,{'msg': '正在执行', 'msg_details': '正在执行,请稍后看结果'}
"""
entry_data = api_instance.entry_data_get(data=data, replace=True)
print('执行 项目信息批量修改')
username = entry_data['data']['账号']
password = entry_data['data']['密码']
company_name = entry_data['data']['公司名称']
save_path = entry_data['data']['文件保存地址']
option = entry_data['data']['项目信息批量修改']
login_response = F6Module.login_in(username, password, company_name)
if login_response is None:
return {'msg': '登录失败'}
try:
df = pd.read_excel(save_path, sheet_name=0, dtype='string')
except Exception as e:
return {'msg': f'读取Excel文件失败: {str(e)},文件路径:{save_path}'}
cookies = requests.utils.dict_from_cookiejar(login_response.cookies)
try:
thread = threading.Thread(target=batch_modify_projects,
args=(data, cookies, df, save_path, option))
thread.start()
except Exception as e:
print(f'创建线程失败: {str(e)}')
return {'msg': '正在执行', 'msg_details': '正在执行,请稍后看结果'}
@staticmethod
def bi_task(data: Dict[str, Any]) -> Dict[str, str]:
"""
BI任务
BI任务(示例)
从简道云获取BI任务请求,读取 Excel 文件(如果需要),并在后台线程中执行BI任务。
立即返回"正在执行"的提示,实际执行在后台线程中完成。