2026.7.2 重点作业新需求,安全管理协议可修改
parent
94e77e2b04
commit
f71fb34bb1
|
|
@ -387,6 +387,9 @@ enum UploadFileType {
|
|||
/// 重点工程安全管理协议 - 类型: '168', 路径: 'key_project_safety_management_agreement'
|
||||
keyProjectSafetyManagementAgreement('168', 'key_project_safety_management_agreement'),
|
||||
|
||||
/// 存重点工程安全管理协议图片 - 类型: '168', 路径: 'key_homework_safety_management_agreement'
|
||||
keyHomeworkSafetyManagementAgreement('168', 'key_homework_safety_management_agreement'),
|
||||
|
||||
/// 重点工程发起情况图片 - 类型: '169', 路径: 'key_project_initiation_image'
|
||||
keyProjectInitiationImage('169', 'key_project_initiation_image'),
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ import 'package:path_provider/path_provider.dart';
|
|||
import 'package:qhd_prevention/constants/app_enums.dart';
|
||||
import 'package:qhd_prevention/customWidget/BaiDuMap/map_preview_widget.dart';
|
||||
import 'package:qhd_prevention/customWidget/BaiDuMap/map_webview_page.dart';
|
||||
import 'package:qhd_prevention/customWidget/DocumentPicker.dart';
|
||||
import 'package:qhd_prevention/customWidget/ItemWidgetFactory.dart';
|
||||
import 'package:qhd_prevention/customWidget/center_multi_picker.dart';
|
||||
import 'package:qhd_prevention/customWidget/custom_alert_dialog.dart';
|
||||
|
||||
import 'package:qhd_prevention/customWidget/custom_button.dart';
|
||||
import 'package:qhd_prevention/customWidget/dotted_border_box.dart';
|
||||
|
|
@ -157,7 +159,45 @@ class _KeyTasksConfirmDetailPageState extends State<KeyTasksConfirmDetailPage> {
|
|||
_buildInfoItem('监理单位工程负责人电话', pd['supervisionUnitUserPhone'] ?? ''),
|
||||
|
||||
Divider(height: 1),
|
||||
_buildInfoItem('安全管理协议',''),
|
||||
// _buildInfoItem('安全管理协议',''),
|
||||
ItemListWidget.OneRowButtonTitleText(
|
||||
horizontalnum: 10,
|
||||
label: '安全管理协议',
|
||||
buttonText: '新增',
|
||||
text: '',
|
||||
onTap: () async {
|
||||
final List<SelectedFile> picked = await DocumentPicker.showPickerModal(
|
||||
context,
|
||||
maxAssets: 1,
|
||||
maxSizeInBytes: 20 * 1024 * 1024,
|
||||
allowedExtensions: ['pdf', 'doc', 'docx','png', 'jpg', 'jpeg'],
|
||||
//, 'png', 'jpg', 'jpeg'
|
||||
allowMultipleFiles: false,
|
||||
showPhotoSelect: false,
|
||||
);
|
||||
|
||||
if (picked.isNotEmpty && picked.first.path != null) {
|
||||
LoadingDialogHelper.show();
|
||||
List<String> imagePaths=[];
|
||||
imagePaths.add(picked.first.path!);
|
||||
final raw = await FileApi.uploadFiles(imagePaths, UploadFileType.keyHomeworkSafetyManagementAgreement, pd['keyProjectId'],
|
||||
);
|
||||
if (raw['success']) {
|
||||
LoadingDialogHelper.hide();
|
||||
setState(() {
|
||||
fileList.add(raw['data']['fileList'][0]);
|
||||
// choosefile = picked.first;
|
||||
// specialHandlingReview['disposalFile'] = raw['data']['filePath'];
|
||||
ToastUtil.showNormal(context, "上传成功",);
|
||||
});
|
||||
} else {
|
||||
ToastUtil.showNormal(context, "上传失败");
|
||||
LoadingDialogHelper.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
// 文件列表
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
|
|
@ -167,8 +207,10 @@ class _KeyTasksConfirmDetailPageState extends State<KeyTasksConfirmDetailPage> {
|
|||
final file = fileList[index];
|
||||
final fileName = _subText(file, index);
|
||||
final fileUrl = file['filePath'] ?? '';
|
||||
|
||||
return ItemListWidget.OneRowButtonTitleText(
|
||||
return Row(
|
||||
children: [
|
||||
Expanded( // 👈 关键:让 OneRowButtonTitleText 占满剩余空间
|
||||
child: ItemListWidget.OneRowButtonTitleText(
|
||||
horizontalnum: 10,
|
||||
label: fileName,
|
||||
buttonText: '查看',
|
||||
|
|
@ -178,10 +220,48 @@ class _KeyTasksConfirmDetailPageState extends State<KeyTasksConfirmDetailPage> {
|
|||
ToastUtil.showNormal(context, '文件不存在');
|
||||
return;
|
||||
}
|
||||
// 打开文件预览
|
||||
_downloadAndLoad(ApiService.baseImgPath + fileUrl);
|
||||
// pushPage(ReadFilePage(fileUrl: ApiService.baseImgPath + fileUrl), context);
|
||||
},
|
||||
),
|
||||
),
|
||||
CustomButton(
|
||||
text: '删除',
|
||||
height: 30,
|
||||
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 10),
|
||||
textStyle: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
onPressed: () async {
|
||||
if (fileUrl.isEmpty) {
|
||||
ToastUtil.showNormal(context, '文件不存在');
|
||||
return;
|
||||
}
|
||||
final confirmed = await CustomAlertDialog.showConfirm(
|
||||
context,
|
||||
title: '提示',
|
||||
content: '确定删除此文件吗?',
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
);
|
||||
if (!confirmed) return;
|
||||
// 删除逻辑
|
||||
List<String> ids=[];
|
||||
ids.add(fileList[index]['id']??'');
|
||||
final fileData = await FileApi.deleteImages(ids);
|
||||
if (fileData['success']) {
|
||||
setState(() {
|
||||
fileList.removeAt(index);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
),
|
||||
SizedBox(width: 10,),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
@ -718,9 +798,12 @@ class _KeyTasksConfirmDetailPageState extends State<KeyTasksConfirmDetailPage> {
|
|||
|
||||
|
||||
String _subText(final item,index) {
|
||||
if (item == null) {
|
||||
return '协议${index + 1}';
|
||||
}
|
||||
final fileName = item['fileName'] ?? '协议${index + 1}';
|
||||
if (fileName.length > 23) {
|
||||
return '${fileName.substring(0, 23)}...';
|
||||
if (fileName.length > 21) {
|
||||
return '${fileName.substring(0, 21)}...';
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue