总体水平,重点关注列表固定第一列

This commit is contained in:
machuanyu 2024-03-05 17:36:17 +08:00
parent ea250d0c62
commit 39d0686b91
4 changed files with 258 additions and 186 deletions

View File

@ -49,6 +49,7 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
List<ComboData> classList = []; //
ComboData currentSubject = ComboData('', '');
ComboData currentClass = ComboData('', '');
// List<ComboData> questionClassList = []; //
ComboData questionCurrentClass = ComboData('', '');
bool isClass = false;
@ -82,12 +83,12 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
setState(() {
classList = List.from(res.data!);
questionCurrentClass =ComboData(0, '全部',isCheck: true);
classList.insert(0,questionCurrentClass);
questionCurrentClass = ComboData(0, '全部', isCheck: true);
classList.insert(0, questionCurrentClass);
// classList[1].isCheck = true;
currentClass = classList[1];
/* questionClassList = List.from(res.data!);
/* questionClassList = List.from(res.data!);
questionCurrentClass =ComboData(0, '全部',isCheck: true);
questionClassList.insert(0,questionCurrentClass);*/
@ -105,7 +106,7 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
await clientReport.getReportDetail(widget.examId,
widget.showGrade && isGrade ? -1 : currentClass.value);
// print('*************result=${result.message}');
if(result.code == 200){
if (result.code == 200) {
setState(() {
currentPage = 1;
questionCurrentPage = 1;
@ -117,12 +118,11 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
getQuestionTable();
getKnowPointTable();
getCard();
}else{
} else {
Navigator.pop(context);
EasyLoading.dismiss();
ToastUtils.showError(result.message.toString());
}
}
//
@ -132,21 +132,21 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
"%%%%%%%%%%%%%%%%%%%widget.examId=${widget.examId}&questionCurrentClass.value=${questionCurrentClass.value}&currentSubject.value=${currentSubject.value}");
ReportCardParams params = ReportCardParams(
examId: widget.examId,
classId: isGrade?questionCurrentClass.value:currentClass.value,
classId: isGrade ? questionCurrentClass.value : currentClass.value,
// classId: 494760774623317,
subject: currentSubject.value,
page: questionCurrentPage,
limit: pageSize);
BaseStructureResultReport<SmallQuestion> res =
await clientReport.getQuestion(params);
print('res.data!.total=${res.code== 200 ?res.data!.bodyExcelData.sheets[0].bodyData.length:''}');
if(res.code != 200 || res.data == null){
print(
'res.data!.total=${res.code == 200 ? res.data!.bodyExcelData.sheets[0].bodyData.length : ''}');
if (res.code != 200 || res.data == null) {
setState(() {
smallQuestionRes = null;
questionTotalPage = 0;
});
}else{
} else {
setState(() {
smallQuestionRes = res;
questionTotalPage = (res.data!.total / pageSize).ceil();
@ -156,19 +156,22 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
EasyLoading.dismiss();
}
//
void getKnowPointTable() async {
RestClientReport clientReport = await getClientReport();
BaseStructureResultReport<QuestionKnowPoint> res =
await clientReport.getKnowPoint(
//494760774623317
widget.examId,isGrade ? questionCurrentClass.value:currentClass.value,currentSubject.value
);
await clientReport.getKnowPoint(
//494760774623317
widget.examId,
isGrade ? questionCurrentClass.value : currentClass.value,
currentSubject.value);
setState(() {
knowPointRes = res;
});
EasyLoading.dismiss();
}
void getCard() async {
RestClientReport clientReport = await getClientReport();
@ -229,31 +232,31 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
);
}
void refreshData(item, type,index) {
void refreshData(item, type, index) {
setState(() {
if(type == 'classList'){
if (type == 'classList') {
currentClass = item;
currentPage = 1;
}else if(type == 'questionClassList'){
} else if (type == 'questionClassList') {
questionCurrentClass = item;
questionCurrentPage = 1;
}else if(type == 'subjectList'){
} else if (type == 'subjectList') {
currentSubject = item;
questionCurrentPage = 1;
}
});
if(type == 'classList'){
if (type == 'classList') {
getBaseInfo();
}
if(type == 'questionClassList' || type == 'subjectList' || !isGrade){
if (type == 'questionClassList' || type == 'subjectList' || !isGrade) {
getQuestionTable();
getKnowPointTable();
}
}
void showSubjectDialog(
BuildContext context, List<ComboData> list, String type,ComboData currentSelect) {
void showSubjectDialog(BuildContext context, List<ComboData> list,
String type, ComboData currentSelect) {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
@ -274,29 +277,28 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
element.isCheck = false;
});
// item!.isCheck = true;
if(item!.value == currentSelect.value){
if (item!.value == currentSelect.value) {
item!.isCheck = true;
}
});
EasyLoading.show(status: 'loading...');
refreshData(item, type,index);
refreshData(item, type, index);
Navigator.pop(context);
},
child: type == 'classList' && index ==0?Container():
Padding(
padding: EdgeInsets.symmetric(vertical: 10.r),
child: Center(
child: Text(
item!.text,
style: TextStyle(
fontSize: 14.r,
color:
item.value == currentSelect.value
// item.isCheck
? Color(0xFF5F81FD)
: Color(0xFF2E2E2E)),
))),
child: type == 'classList' && index == 0
? Container()
: Padding(
padding: EdgeInsets.symmetric(vertical: 10.r),
child: Center(
child: Text(
item!.text,
style: TextStyle(
fontSize: 14.r,
color: item.value == currentSelect.value
// item.isCheck
? Color(0xFF5F81FD)
: Color(0xFF2E2E2E)),
))),
);
},
itemCount: list.length,
@ -451,7 +453,8 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
),
InkWell(
onTap: () {
showSubjectDialog(context, classList, 'classList',currentClass);
showSubjectDialog(context, classList,
'classList', currentClass);
},
child: Container(
padding: EdgeInsets.symmetric(
@ -476,62 +479,116 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
),
),
LabTitle('基本信息', 'assets/images/basic_info.png'),
BasicTable(baseInfo,!widget.showGrade || !isGrade),
BasicTable(baseInfo, !widget.showGrade || !isGrade),
LabTitle('总体水平', 'assets/images/overall_level.png'),
OverallLevelTable(overallLevelRes!.data!.module1CJZL.sheets[0]),
overallLevelRes!.data!.module1CJZL != null && overallLevelRes!
.data!.module1CJZL.sheets[0].bodyData.length > 0
?
Container(
height: overallLevelRes!
.data!.module1CJZL.sheets[0].bodyData.length>5? 300.r : overallLevelRes!
.data!.module1CJZL.sheets[0].bodyData.length * 50.r + 40.r,
padding: EdgeInsets.symmetric(horizontal: 14.r),
child: CardList(
headList: overallLevelRes!
.data!.module1CJZL.sheets[0].headData,
bodyList: overallLevelRes!
.data!.module1CJZL.sheets[0].bodyData,
isScore: true,
fixedRows: 1,
fixedCols: 1,
),
):NoData(),
// OverallLevelTable(overallLevelRes!.data!.module1CJZL.sheets[0]),
LabTitle('重点关注学生', 'assets/images/reports_focus.png'),
overallLevelRes!
.data!.module2ZDGZ.topExcelData != null?
OverallLevelTable(overallLevelRes!
.data!.module2ZDGZ.topExcelData?.sheets[0]):NoData(),
overallLevelRes!.data!.module2ZDGZ.topExcelData != null
?
/*OverallLevelTable(overallLevelRes!
.data!.module2ZDGZ.topExcelData?.sheets[0])*/
Container(
height: 300.r,
padding: EdgeInsets.symmetric(horizontal: 14.r),
child: CardList(
headList: overallLevelRes!
.data!.module2ZDGZ.topExcelData!.sheets[0].headData,
bodyList: overallLevelRes!
.data!.module2ZDGZ.topExcelData!.sheets[0].bodyData,
isScore: true,
isHtml:true,
fixedRows: 1,
fixedCols: 1,
),
)
: NoData(),
SizedBox(
height: 20.r,
),
if(overallLevelRes!
.data!.module2ZDGZ.topExcelData != null)
OverallLevelTable(overallLevelRes!
.data!.module2ZDGZ.bottomExcelData?.sheets[0]),
if (overallLevelRes!.data!.module2ZDGZ.topExcelData !=
null)
/* OverallLevelTable(overallLevelRes!
.data!.module2ZDGZ.bottomExcelData?.sheets[0]),*/
Container(
height: 300.r,
padding: EdgeInsets.symmetric(horizontal: 14.r),
child: CardList(
headList: overallLevelRes!
.data!.module2ZDGZ.bottomExcelData!.sheets[0].headData,
bodyList: overallLevelRes!
.data!.module2ZDGZ.bottomExcelData!.sheets[0].bodyData,
isScore: true,
isHtml:true,
fixedRows: 1,
fixedCols: 1,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LabTitle('小题得分', 'assets/images/reports_score.png'),
Expanded(child: Text(''),),
if(isGrade)
Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 10.r),
margin: EdgeInsets.only(right: 14.r),
decoration: BoxDecoration(
color: Color(0xFF6787FD),
borderRadius:
BorderRadius.all(Radius.circular(15.r)),
),
child: InkWell(
onTap: () {
showSubjectDialog(context, classList, 'questionClassList',questionCurrentClass);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
questionCurrentClass.text,
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: FontWeight.w500),
),
Padding(
padding: EdgeInsets.only(left: 8.r),
child: Image.asset(
'assets/images/right_icon.png',
width: 6.r,
height: 10.r,
Expanded(
child: Text(''),
),
if (isGrade)
Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 10.r),
margin: EdgeInsets.only(right: 14.r),
decoration: BoxDecoration(
color: Color(0xFF6787FD),
borderRadius:
BorderRadius.all(Radius.circular(15.r)),
),
child: InkWell(
onTap: () {
showSubjectDialog(
context,
classList,
'questionClassList',
questionCurrentClass);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
questionCurrentClass.text,
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: FontWeight.w500),
),
)
],
Padding(
padding: EdgeInsets.only(left: 8.r),
child: Image.asset(
'assets/images/right_icon.png',
width: 6.r,
height: 10.r,
),
)
],
),
),
),
),
Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 10.r),
@ -543,7 +600,8 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
),
child: InkWell(
onTap: () {
showSubjectDialog(context, subjectList, 'subjectList',currentSubject);
showSubjectDialog(context, subjectList,
'subjectList', currentSubject);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -577,10 +635,11 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(smallQuestionRes !=null && smallQuestionRes!.data!.bodyExcelData
(smallQuestionRes != null &&
smallQuestionRes!.data!.bodyExcelData
.sheets[0].headData.length >
0 &&
smallQuestionRes!.data!.bodyExcelData
smallQuestionRes!.data!.bodyExcelData
.sheets[0].bodyData.length >
0)
? SizedBox(
@ -593,12 +652,13 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
9
? 300.r
: smallQuestionRes!
.data!
.bodyExcelData
.sheets[0]
.bodyData
.length *
50.r + 40.r,
.data!
.bodyExcelData
.sheets[0]
.bodyData
.length *
50.r +
40.r,
// width: MediaQuery.of(context).size.width,
child: CardList(
headList: smallQuestionRes!.data!
@ -611,88 +671,97 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
),
)
: NoData(),
if(smallQuestionRes !=null && smallQuestionRes!.data!.bodyExcelData
.sheets[0].bodyData.length >
0)
Padding(
padding: EdgeInsets.only(right: 14.r,top: 6.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
onTap: () {
setState(() {
if (questionCurrentPage > 1 && questionIsRefresh) {
questionIsRefresh = false;
questionCurrentPage = questionCurrentPage - 1;
getQuestionTable();
EasyLoading.show(status: 'loading...');
}
});
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 5.r),
decoration: BoxDecoration(
border: Border.all(
color: questionCurrentPage == 1
? Color(0xFFB3B9B9)
: Color(0xFF6787FD),
width: 1.r),
borderRadius: BorderRadius.all(
Radius.circular(2.r)),
),
child: Text(
'上一页',
style: TextStyle(
color: questionCurrentPage == 1
? Color(0xFFB3B9B9)
: Color(0xFF6787FD)),
),
)
),
SizedBox(
width: 15.r,
),
InkWell(
onTap: () {
setState(() {
if (questionCurrentPage < totalPage &&
questionIsRefresh) {
questionIsRefresh = false;
questionCurrentPage = questionCurrentPage + 1;
getQuestionTable();
EasyLoading.show(status: 'loading...');
}
});
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 5.r),
decoration: BoxDecoration(
border: Border.all(
color: questionTotalPage - questionCurrentPage > 0
? Color(0xFF6787FD)
: Color(0xFFB3B9B9),
width: 1.r),
borderRadius: BorderRadius.all(
Radius.circular(2.r)),
),
child: Text(
'下一页',
style: TextStyle(
color: questionTotalPage - questionCurrentPage > 0
? Color(0xFF6787FD)
: Color(0xFFB3B9B9)),
),
)
)
],
if (smallQuestionRes != null &&
smallQuestionRes!.data!.bodyExcelData
.sheets[0].bodyData.length >
0)
Padding(
padding:
EdgeInsets.only(right: 14.r, top: 6.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
InkWell(
onTap: () {
setState(() {
if (questionCurrentPage > 1 &&
questionIsRefresh) {
questionIsRefresh = false;
questionCurrentPage =
questionCurrentPage - 1;
getQuestionTable();
EasyLoading.show(
status: 'loading...');
}
});
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 5.r),
decoration: BoxDecoration(
border: Border.all(
color:
questionCurrentPage == 1
? Color(0xFFB3B9B9)
: Color(0xFF6787FD),
width: 1.r),
borderRadius: BorderRadius.all(
Radius.circular(2.r)),
),
child: Text(
'上一页',
style: TextStyle(
color:
questionCurrentPage == 1
? Color(0xFFB3B9B9)
: Color(0xFF6787FD)),
),
)),
SizedBox(
width: 15.r,
),
InkWell(
onTap: () {
setState(() {
if (questionCurrentPage <
totalPage &&
questionIsRefresh) {
questionIsRefresh = false;
questionCurrentPage =
questionCurrentPage + 1;
getQuestionTable();
EasyLoading.show(
status: 'loading...');
}
});
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 2.r, horizontal: 5.r),
decoration: BoxDecoration(
border: Border.all(
color: questionTotalPage -
questionCurrentPage >
0
? Color(0xFF6787FD)
: Color(0xFFB3B9B9),
width: 1.r),
borderRadius: BorderRadius.all(
Radius.circular(2.r)),
),
child: Text(
'下一页',
style: TextStyle(
color: questionTotalPage -
questionCurrentPage >
0
? Color(0xFF6787FD)
: Color(0xFFB3B9B9)),
),
))
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(
vertical: 10.r, horizontal: 10.r),
@ -704,13 +773,11 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
fontWeight: FontWeight.w500),
),
),
knowPointRes!.data!.knowPointList.length >
0
knowPointRes!.data!.knowPointList.length > 0
? SizedBox(
height: 300.r,
child: KnowPointTable(
knowPointRes!
.data!.knowPointList),
knowPointRes!.data!.knowPointList),
)
: NoData(),
/* knowPointRes!.data!.knowPointList.length >
@ -737,7 +804,7 @@ class _ReportDetailState extends ConsumerState<ReportDetail> with CommonMixin {
),
if (cardBodyList.length > 0)
Padding(
padding: EdgeInsets.only(right: 14.r,top: 6.r),
padding: EdgeInsets.only(right: 14.r, top: 6.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [

View File

@ -1,6 +1,7 @@
import 'package:data_table_2/data_table_2.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
class CardList extends StatefulWidget {
final List headList;
@ -9,6 +10,7 @@ class CardList extends StatefulWidget {
final bool? isScore;
final int? fixedRows;
final int? fixedCols;
final bool? isHtml;
const CardList({
Key? key,
@ -16,6 +18,7 @@ class CardList extends StatefulWidget {
required this.bodyList,
this.showCardDetail,
this.isScore = false,
this.isHtml = false,
this.fixedCols,
this.fixedRows,
}) : super(key: key);
@ -74,7 +77,9 @@ class _CardListState extends State<CardList> {
: Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.toString(),
child:
widget.isHtml == true?HtmlWidget(item.toString(),textStyle: TextStyle(fontSize: 12.sp,color: Color(0xFF262626)),):
Text(item.toString(),
style:
TextStyle(fontSize: 12.sp, color: Color(0xFF262626))),
),
@ -114,7 +119,7 @@ class _CardListState extends State<CardList> {
headingRowDecoration: BoxDecoration(color: Color(0xFFF0F3FF)),
fixedColumnsColor: Color(0xFFF0F3FF),
fixedCornerColor: Colors.grey[400],
minWidth: 70.r * widget.headList.length + 10.r,
minWidth: widget.headList.length > 5?70.r * widget.headList.length + 10.r:MediaQuery.of(context).size.width,
fixedTopRows: widget.fixedRows!,
fixedLeftColumns: widget.fixedCols!,
sortColumnIndex: _sortColumnIndex,
@ -128,7 +133,7 @@ class _CardListState extends State<CardList> {
style: TextStyle(fontSize: 12.sp, color: Color(0xFF505767))),
),
// size: ColumnSize.S,
fixedWidth: index == 0 && widget.isScore == false?50.r:70.r,
fixedWidth: index == 0 && widget.isScore == false?50.r:widget.headList.length > 5 ?70.r:(MediaQuery.of(context).size.width - 28.r)/widget.headList.length,
);
}),
rows: List<DataRow>.generate(widget.bodyList.length,

View File

@ -68,7 +68,7 @@ class _ReportCardDialogState extends ConsumerState<ReportCardDialog>
if(res.data!=null){
examOrigin = res.data!.examOriginPapers[0];
examOriginList = res.data!.examOriginPapers;
print('examOrigin!.width=${examOrigin!.width}');
// print('examOrigin!.width=${examOrigin!.width}');
}else{
examOriginList = [];
examOrigin = null;

View File

@ -213,7 +213,7 @@ class _TheReportState extends ConsumerState<TheReport>
@override
Widget build(BuildContext context) {
super.build(context); //super.build(null)
final userState = ref.watch(userProvider);
return AnnotatedRegion(
value: const SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xFF000000),
@ -274,7 +274,7 @@ class _TheReportState extends ConsumerState<TheReport>
height: 22.w,
),
Text(
'远轩高级中学',
userState.schoolName,
style: TextStyle(
fontSize: 14.sp,
color: Color.fromRGBO(62, 86, 173, 1)),