1.优化补足了首页下拉刷新中对获取场站接口的加入,确保能够实时获取数据并渲染。
2.优化修改了tcp重连机制,具体操作:断开重连时候不再建立新链接 而是将旧链接重置,并重新发送数据。 3.大面积的给项目中的各个页面 手动接入了多语言的支持。同时也调整了相应带来的问题英文长度较大影响原有的样式的问题,已解决了对应的样式不和谐问题。保证了外观的统一性。 4.给项目中的主要操作加了几个核心的操作比如远程遥控和路径规划添加了双层的保护,设置里安全模式,即在此期间对服务器推送的重复登录操作后的自动退出登录做一个拦截 保证操作的安全性。
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../../../../../core/consts/workorder_consts.dart';
|
||||
import '../../domain/entities/workorder_entity.dart';
|
||||
|
||||
@@ -6,10 +7,7 @@ import '../../domain/entities/workorder_entity.dart';
|
||||
class WorkOrderCountCard extends StatelessWidget {
|
||||
final WorkOrderCountEntity count;
|
||||
|
||||
const WorkOrderCountCard({
|
||||
Key? key,
|
||||
required this.count,
|
||||
}) : super(key: key);
|
||||
const WorkOrderCountCard({Key? key, required this.count}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -27,19 +25,25 @@ class WorkOrderCountCard extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
_buildCountItem(
|
||||
label: '待处理',
|
||||
label: AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.pending'),
|
||||
value: count.pendingCount.toString(),
|
||||
valueColor: WorkOrderColors.primaryText,
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildCountItem(
|
||||
label: '执行中',
|
||||
label: AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.executing'),
|
||||
value: count.executingCount.toString(),
|
||||
valueColor: WorkOrderColors.primaryText,
|
||||
),
|
||||
_buildDivider(),
|
||||
_buildCountItem(
|
||||
label: '今日完成',
|
||||
label: AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.today_completed'),
|
||||
value: count.todayCompletedCount.toString(),
|
||||
valueColor: WorkOrderColors.primary,
|
||||
),
|
||||
@@ -78,10 +82,6 @@ class WorkOrderCountCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildDivider() {
|
||||
return Container(
|
||||
width: 1,
|
||||
height: 40,
|
||||
color: const Color(0xFFF0F0F0),
|
||||
);
|
||||
return Container(width: 1, height: 40, color: const Color(0xFFF0F0F0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../../../../../core/consts/workorder_consts.dart';
|
||||
import '../../domain/entities/workorder_entity.dart';
|
||||
|
||||
@@ -7,11 +8,8 @@ class WorkOrderItemCard extends StatelessWidget {
|
||||
final WorkOrderEntity workOrder;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const WorkOrderItemCard({
|
||||
Key? key,
|
||||
required this.workOrder,
|
||||
this.onTap,
|
||||
}) : super(key: key);
|
||||
const WorkOrderItemCard({Key? key, required this.workOrder, this.onTap})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -47,48 +45,79 @@ class WorkOrderItemCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildStatusTag(),
|
||||
_buildStatusTag(context),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
|
||||
// 详情信息
|
||||
_buildDetailRow('工单号', workOrder.orderNo),
|
||||
_buildDetailRow(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.order_no'),
|
||||
workOrder.orderNo,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
|
||||
|
||||
// 优先级
|
||||
_buildDetailRow(
|
||||
'优先级',
|
||||
_getPriorityText(workOrder.priority),
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.priority'),
|
||||
_getPriorityText(context, workOrder.priority),
|
||||
valueColor: _getPriorityColor(workOrder.priority),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
|
||||
|
||||
// 根据状态显示不同信息
|
||||
if (workOrder.status == WorkOrderStatus.pending) ...[
|
||||
_buildDetailRow(
|
||||
'创建时间',
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.create_time'),
|
||||
_formatDateTime(workOrder.createTime),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildDetailRow('地点', workOrder.location),
|
||||
_buildDetailRow(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.location'),
|
||||
workOrder.location,
|
||||
),
|
||||
] else if (workOrder.status == WorkOrderStatus.executing) ...[
|
||||
_buildDetailRow('执行人', workOrder.executor ?? '-'),
|
||||
_buildDetailRow(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.executor'),
|
||||
workOrder.executor ?? '-',
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildDetailRow('地点', workOrder.location),
|
||||
_buildDetailRow(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.location'),
|
||||
workOrder.location,
|
||||
),
|
||||
if (workOrder.progress != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
_buildProgressBar(),
|
||||
_buildProgressBar(context),
|
||||
],
|
||||
] else if (workOrder.status == WorkOrderStatus.completed) ...[
|
||||
_buildDetailRow(
|
||||
'完成时间',
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.complete_time'),
|
||||
workOrder.completeTime != null
|
||||
? _formatDateTime(workOrder.completeTime!)
|
||||
: '-',
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildDetailRow('地点', workOrder.location),
|
||||
_buildDetailRow(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.location'),
|
||||
workOrder.location,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
@@ -113,26 +142,30 @@ class WorkOrderItemCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusTag() {
|
||||
Widget _buildStatusTag(BuildContext context) {
|
||||
Color color;
|
||||
String text;
|
||||
|
||||
switch (workOrder.status) {
|
||||
case WorkOrderStatus.pending:
|
||||
color = AppConstants.pendingColor;
|
||||
text = '待处理';
|
||||
text = AppLocalizations.of(context).translate('work_order_v2.pending');
|
||||
break;
|
||||
case WorkOrderStatus.executing:
|
||||
color = AppConstants.executingColor;
|
||||
text = '执行中';
|
||||
text = AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.executing');
|
||||
break;
|
||||
case WorkOrderStatus.completed:
|
||||
color = AppConstants.completedColor;
|
||||
text = '已完成';
|
||||
text = AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.completed');
|
||||
break;
|
||||
default:
|
||||
color = AppConstants.auxiliaryTextColor;
|
||||
text = '未知';
|
||||
text = AppLocalizations.of(context).translate('common.unknown');
|
||||
}
|
||||
|
||||
return Row(
|
||||
@@ -144,13 +177,7 @@ class WorkOrderItemCard extends StatelessWidget {
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
child: Text(text, style: TextStyle(fontSize: 12, color: color)),
|
||||
),
|
||||
if (workOrder.status == WorkOrderStatus.executing &&
|
||||
workOrder.progress != null)
|
||||
@@ -169,39 +196,43 @@ class WorkOrderItemCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailRow(
|
||||
String label,
|
||||
String value, {
|
||||
Color? valueColor,
|
||||
}) {
|
||||
Widget _buildDetailRow(String label, String value, {Color? valueColor}) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
'$label:',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppConstants.auxiliaryTextColor,
|
||||
Flexible(
|
||||
child: Text(
|
||||
'$label:',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppConstants.auxiliaryTextColor,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: valueColor ?? AppConstants.secondaryTextColor,
|
||||
Flexible(
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: valueColor ?? AppConstants.secondaryTextColor,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildProgressBar() {
|
||||
Widget _buildProgressBar(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'进度:',
|
||||
'${AppLocalizations.of(context).translate('work_order_v2.progress')}:',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppConstants.auxiliaryTextColor,
|
||||
@@ -224,14 +255,14 @@ class WorkOrderItemCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
String _getPriorityText(WorkOrderPriority priority) {
|
||||
String _getPriorityText(BuildContext context, WorkOrderPriority priority) {
|
||||
switch (priority) {
|
||||
case WorkOrderPriority.high:
|
||||
return '高';
|
||||
return AppLocalizations.of(context).translate('work_order_v2.high');
|
||||
case WorkOrderPriority.medium:
|
||||
return '中';
|
||||
return AppLocalizations.of(context).translate('work_order_v2.medium');
|
||||
case WorkOrderPriority.low:
|
||||
return '低';
|
||||
return AppLocalizations.of(context).translate('work_order_v2.low');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../../../../../core/consts/workorder_consts.dart';
|
||||
|
||||
/// 工单标签栏组件
|
||||
@@ -15,10 +16,32 @@ class WorkOrderTabBar extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tabs = [
|
||||
{'label': '待处理', 'status': WorkOrderStatus.pending, 'badge': false},
|
||||
{'label': '执行中', 'status': WorkOrderStatus.executing, 'badge': true},
|
||||
{'label': '已完成', 'status': WorkOrderStatus.completed, 'badge': false},
|
||||
{'label': '全部', 'status': WorkOrderStatus.all, 'badge': true},
|
||||
{
|
||||
'label': AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.pending'),
|
||||
'status': WorkOrderStatus.pending,
|
||||
'badge': false,
|
||||
},
|
||||
{
|
||||
'label': AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.executing'),
|
||||
'status': WorkOrderStatus.executing,
|
||||
'badge': true,
|
||||
},
|
||||
{
|
||||
'label': AppLocalizations.of(
|
||||
context,
|
||||
).translate('work_order_v2.completed'),
|
||||
'status': WorkOrderStatus.completed,
|
||||
'badge': false,
|
||||
},
|
||||
{
|
||||
'label': AppLocalizations.of(context).translate('work_order_v2.all'),
|
||||
'status': WorkOrderStatus.all,
|
||||
'badge': true,
|
||||
},
|
||||
];
|
||||
|
||||
return Container(
|
||||
@@ -44,7 +67,9 @@ class WorkOrderTabBar extends StatelessWidget {
|
||||
tab['label'] as String,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
||||
fontWeight: isSelected
|
||||
? FontWeight.bold
|
||||
: FontWeight.normal,
|
||||
color: isSelected
|
||||
? AppConstants.primaryColor
|
||||
: AppConstants.secondaryTextColor,
|
||||
|
||||
Reference in New Issue
Block a user