优良中差

This commit is contained in:
machuanyu 2024-06-28 13:55:34 +08:00
parent a3fd75efb5
commit 09dfbe9882
10 changed files with 768 additions and 116 deletions

View File

@ -78,8 +78,13 @@ class Questions extends Object {
@JsonKey(name: 'answerNgStudents')
List<Dtls>? answerNgStudents;
@JsonKey(name: 'overallTitles')
List<OverallTitles>? overallTitles;
Questions(this.id,this.templateId,this.questionNo,this.questionType,this.answer,this.score,this.questionPicture,this.subjectivePicture,this.knows,this.answerCount,
this.answerRate,this.okRate,this.priorityInfo,this.noAnswerStudents,this.answerOkStudents,this.answerNgStudents);
this.answerRate,this.okRate,this.priorityInfo,this.noAnswerStudents,this.answerOkStudents,this.answerNgStudents,
this.overallTitles);
factory Questions.fromJson(Map<String, dynamic> srcJson) => _$QuestionsFromJson(srcJson);
@ -117,7 +122,6 @@ class Knows extends Object {
}
@JsonSerializable()
class Students extends Object {
@ -166,6 +170,9 @@ class Students extends Object {
@JsonKey(name: 'allNotDone')
bool? allNotDone;
@JsonKey(name: 'isAllCorrect')
bool? isAllCorrect;
@JsonKey(name: 'queDtls')
List<Dtls>? queDtls;
@ -178,7 +185,7 @@ class Students extends Object {
@JsonKey(name: 'useTime')
int? useTime;
Students(this.studentId,this.studentName,this.state,this.priorityAnnotate,this.kgtStu,this.kgtOkCount,this.kgtAnswerCount,this.zgtStu,this.zgtAnswerCount,this.zgtOkCount,this.allOk,this.kgtErrorCount,this.zgtErrorCount,this.zgtUnrated,this.allNotDone,this.queDtls,this.okRate,this.noAnswerCount,this.useTime);
Students(this.studentId,this.studentName,this.state,this.priorityAnnotate,this.kgtStu,this.kgtOkCount,this.kgtAnswerCount,this.zgtStu,this.zgtAnswerCount,this.zgtOkCount,this.allOk,this.kgtErrorCount,this.zgtErrorCount,this.zgtUnrated,this.allNotDone,this.queDtls,this.okRate,this.noAnswerCount,this.useTime,this.isAllCorrect);
factory Students.fromJson(Map<String, dynamic> srcJson) => _$StudentsFromJson(srcJson);
@ -237,4 +244,19 @@ class Dtls extends Object {
}
@JsonSerializable()
class OverallTitles extends Object {
@JsonKey(name: 'title')
String title;
@JsonKey(name: 'count')
int count;
OverallTitles(this.title,this.count);
factory OverallTitles.fromJson(Map<String, dynamic> srcJson) => _$OverallTitlesFromJson(srcJson);
Map<String, dynamic> toJson() => _$OverallTitlesToJson(this);
}

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/homework_details.dart';
import 'package:making_school_asignment_app/page/home_page/children/quick_data_check/quick_data_check_state.dart';
import 'dart:math';
class Utils {
Utils._internal();
@ -81,49 +82,38 @@ class Utils {
dataCount.kgtAnswerCount = kgt.where((w) => w.state != 0).length;
dataCount.kgtOkCount = kgt.where((w) => w.state == 3).length;
dataCount.kgtDtlCount = kgt.length;
dataCount.kgtAnswerRate = Utils.calcRate(dataCount.kgtAnswerCount!, dataCount.kgtDtlCount!);
dataCount.kgtOkRate = Utils.calcRate(dataCount.kgtOkCount!, dataCount.kgtDtlCount!);
dataCount.kgtCount = data.questions.where((w) => w.questionType == 1).length;
dataCount.kgtAnswerRate =
Utils.calcRate(dataCount.kgtAnswerCount!, dataCount.kgtDtlCount!);
dataCount.kgtOkRate =
Utils.calcRate(dataCount.kgtOkCount!, dataCount.kgtDtlCount!);
dataCount.kgtCount =
data.questions.where((w) => w.questionType == 1).length;
List<Dtls> zgt = data.dtls.where((w) => w.questionType == 2).toList();
dataCount.zgtAnswerCount = zgt.where((w) => w.state != 0).length;
dataCount.zgtOkCount = zgt.where((w) => w.state == 3).length;
dataCount.zgtDtlCount = zgt.length;
dataCount.zgtAnswerRate = Utils.calcRate(dataCount.zgtAnswerCount!, dataCount.zgtDtlCount!);
dataCount.zgtOkRate = Utils.calcRate(dataCount.zgtOkCount!, dataCount.zgtDtlCount!);
dataCount.zgtCount = data.questions.where((w) => w.questionType == 2).length;
dataCount.zgtAnswerRate =
Utils.calcRate(dataCount.zgtAnswerCount!, dataCount.zgtDtlCount!);
dataCount.zgtOkRate =
Utils.calcRate(dataCount.zgtOkCount!, dataCount.zgtDtlCount!);
dataCount.zgtCount =
data.questions.where((w) => w.questionType == 2).length;
dataCount.studentCount = data.students.length;
dataCount.priorityStudents = data.students.where((w) => w.priorityAnnotate!).toList();
dataCount.priorityStudents =
data.students.where((w) => w.priorityAnnotate!).toList();
for (var que in data.questions) {
List<Dtls> ques = data.dtls.where((w) => w.templateId == que.templateId && w.questionNo == que.questionNo).toList();
que.answerCount = ques.where((w) => w.state != 0).length;
que.answerRate = Utils.calcRate(que.answerCount!, dataCount.studentCount!);
int okCount = ques.where((w) => w.state == 3).length;
que.okRate = Utils.calcRate(okCount, dataCount.studentCount!);
que.priorityInfo = ques.where((w) {
return dataCount.priorityStudents!.indexWhere((s) {
w.studentName = s.studentName;
return s.studentId == w.studentId;
}) >
-1 &&
w.state != 3;
}).toList();
que.answerNgStudents = ques.where((w) {
w.studentName = data.students.firstWhere((s) => s.studentId == w.studentId).studentName;
return w.state == 2;
}).toList();
que.noAnswerStudents = ques.where((w) {
return w.state == 0;
}).toList();
que.answerOkStudents = ques.where((w) {
return w.state == 3;
}).toList();
}
dataCount.studentSubmitCount = data.students.where((s) => s.state != 0).length;
//
dataCount.studentSubmitCount =
data.students.where((s) => s.state != 0).length;
dataCount.studentSubmitStudents =
data.students.where((s) => s.state != 0).toList();
//
dataCount.noAnswerCount =
data.students.length - dataCount.studentSubmitCount!;
dataCount.noAnswerStudents =
data.students.where((s) => s.state == 0).toList();
for (var stu in data.students) {
stu.kgtStu = kgt.where((w) => w.studentId == stu.studentId).toList();
@ -138,12 +128,17 @@ class Utils {
stu.zgtErrorCount = stu.zgtStu!.where((w) => w.state == 2).length;
stu.zgtUnrated = stu.zgtStu!.where((w) => w.state == 1).length;
stu.zgtAnswerCount = stu.zgtStu!.where((w) => w.state != 0).length;
stu.isAllCorrect =
stu.kgtOkCount! + stu.zgtOkCount! == kgt.length + zgt.length
? true
: false;
stu.allOk = data.dtls.where((w) {
if (stu.studentId == w.studentId) {
stu.useTime = w.useTime;
}
for (var que in data.questions) {
if (w.templateId == que.templateId && w.questionNo == que.questionNo) {
if (w.templateId == que.templateId &&
w.questionNo == que.questionNo) {
w.answer = que.answer;
w.questionPicture = que.questionPicture;
}
@ -151,16 +146,25 @@ class Utils {
return w.studentId == stu.studentId && w.state != 3;
}).length ??
0;
if ((stu.kgtStu!.length - stu.kgtAnswerCount!) + (stu.zgtStu!.length - stu.zgtAnswerCount!) == (stu.kgtStu!.length + stu.zgtStu!.length)) {
if ((stu.kgtStu!.length - stu.kgtAnswerCount!) +
(stu.zgtStu!.length - stu.zgtAnswerCount!) ==
(stu.kgtStu!.length + stu.zgtStu!.length)) {
stu.allNotDone = true;
} else {
stu.allNotDone = false;
}
stu.noAnswerCount = data.dtls.where((w) => w.state == 0 && stu.studentId == w.studentId).length;
stu.noAnswerCount = data.dtls
.where((w) => w.state == 0 && stu.studentId == w.studentId)
.length;
List<Questions> ques = data.questions;
stu.queDtls = data.dtls
.where((w) => w.studentId == stu.studentId && ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1)
.where((w) =>
w.studentId == stu.studentId &&
ques.indexWhere((q) =>
w.templateId == q.templateId &&
w.questionNo == q.questionNo) >
-1)
.toList();
int okCount = stu.queDtls!.where((w) => w.state == 3).length;
int ttlCount = stu.queDtls!.length;
@ -172,10 +176,107 @@ class Utils {
int num2 = b.state;
return num2.compareTo(num1);
});
//
dataCount.allCorrect =
data.students.where((w) => w.isAllCorrect == true).length;
dataCount.allCorrectStudents =
data.students.where((w) => w.isAllCorrect == true).toList();
//
dataCount.levelOneCount =
data.students.where((s) => s.okRate! >= 85).length;
dataCount.levelOneStudents =
data.students.where((s) => s.okRate! >= 85).toList();
//
dataCount.levelTwoCount =
data.students.where((s) => s.okRate! < 85 && s.okRate! >= 55).length;
dataCount.levelTwoStudents =
data.students.where((s) => s.okRate! < 85 && s.okRate! >= 55).toList();
//
dataCount.levelThreeCount =
data.students.where((s) => s.okRate! < 55 && s.okRate! >= 25).length;
dataCount.levelThreeStudents =
data.students.where((s) => s.okRate! < 55 && s.okRate! >= 25).toList();
//
dataCount.levelFourCount =
data.students.where((s) => s.okRate! < 25).length;
dataCount.levelFourStudents =
data.students.where((s) => s.okRate! < 25).toList();
for (var que in data.questions) {
List<Dtls> ques = data.dtls
.where((w) =>
w.templateId == que.templateId && w.questionNo == que.questionNo)
.toList();
que.answerCount = ques.where((w) => w.state != 0).length;
que.answerRate =
Utils.calcRate(que.answerCount!, dataCount.studentCount!);
int okCount = ques.where((w) => w.state == 3).length;
que.okRate = Utils.calcRate(okCount, dataCount.studentCount!);
que.priorityInfo = ques.where((w) {
return dataCount.priorityStudents!.indexWhere((s) {
w.studentName = s.studentName;
return s.studentId == w.studentId;
}) >
-1 &&
w.state != 3;
}).toList();
que.answerNgStudents = ques.where((w) {
w.studentName = data.students
.firstWhere((s) => s.studentId == w.studentId)
.studentName;
return w.state == 2;
}).toList();
que.noAnswerStudents = ques.where((w) {
return w.state == 0;
}).toList();
que.answerOkStudents = ques.where((w) {
return w.state == 3;
}).toList();
//
int middleTime = 0;
if (ques.length % 2 == 0) {
int index = (ques.length / 2).ceil();
middleTime = ((ques[index].useTime +
ques[index - 1].useTime) /
2)
.ceil();
} else {
int index = ((ques.length + 1) / 2).ceil() ;
middleTime = ques[index - 1 ].useTime;
}
var excellent = ques.where((w) => w.state == 3 && w.useTime <= middleTime).length;
var good = ques.where((w) => w.state == 3 && w.useTime > middleTime).length;
var middle = ques.where((w) => w.state != 3 && w.useTime <= middleTime).length;
var differ = ques.where((w) => w.state != 3 && w.useTime > middleTime).length;
que.overallTitles = [OverallTitles('优秀',excellent),OverallTitles('良好',good),
OverallTitles('',middle),OverallTitles('',differ)];
}
for (var know in data.knows) {
List<Questions> ques = data.questions.where((w) => w.knows.indexWhere((k) => k.knowledgeId == know.knowledgeId) > -1).toList();
List<Dtls> queDtls = data.dtls.where((w) => ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1).toList();
List<Questions> ques = data.questions
.where((w) =>
w.knows.indexWhere((k) => k.knowledgeId == know.knowledgeId) > -1)
.toList();
List<Dtls> queDtls = data.dtls
.where((w) =>
ques.indexWhere((q) =>
w.templateId == q.templateId &&
w.questionNo == q.questionNo) >
-1)
.toList();
know.okCount = queDtls.where((w) => w.state == 3).length;
know.ttlCount = queDtls.length;
know.okRate = Utils.calcRate(know.okCount!, know.ttlCount!);
@ -210,6 +311,7 @@ bool isPad([double mobilePhoneScale = 1.2]) {
return ScreenUtil().scaleWidth > mobilePhoneScale;
}
void toUpState(Function(void Function()) setState, VoidCallback fn, bool mounted) {
void toUpState(
Function(void Function()) setState, VoidCallback fn, bool mounted) {
if (mounted) setState(fn);
}
}

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/const_text.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
//
@ -70,11 +72,7 @@ class _OhterPageState extends State<OhterPage> {
children: [
InkWell(
onTap: () {
/* RouterManager.router.navigateTo(
context,
transition: TransitionType.fadeIn,
'${RouterManager.agreementPath}?type=${AGREEMENT_KEY.PRIVACY_GREEMENT.name}',
);*/
Get.toNamed(Routes.agreementPage, arguments: {"type": AGREEMENT_KEY.PRIVACY_GREEMENT.name});
},
child: Container(
padding: EdgeInsets.only(bottom: 4.h),

View File

@ -8,6 +8,7 @@ import 'package:making_school_asignment_app/page/home_page/children/job_report/w
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/knowledge_point.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/personnel_data_overview.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/top_count.dart';
import 'package:making_school_asignment_app/page/home_page/children/quick_data_check/widget/kgt_zgt_table.dart';
import 'job_report_logic.dart';
@ -75,8 +76,8 @@ class _JobReportPageState extends State<JobReportPage> {
),
),
//
/* TopCount(
data, classData == null ? '' : classData!.className, widget.id),*/
TopCount(
state.dataCount, state.classData == null ? '' : state.classData.value.className, state.homeworkId.value),
//
KgtZgtTable(
studentCount: state.dataCount.studentCount!,

View File

@ -0,0 +1,257 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
import 'package:making_school_asignment_app/common/job/homework_details.dart';
import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart';
import 'package:making_school_asignment_app/page/global_widget/show_student_list.dart';
import 'package:making_school_asignment_app/page/home_page/children/quick_data_check/quick_data_check_state.dart';
class TopCount extends StatelessWidget {
final CountData data;
final String className;
final String jobId;
const TopCount(this.data, this.className, this.jobId, {Key? key}) : super(key: key);
void showStudentListDialog({required BuildContext context, required String title, required List<Students> students}) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowStudentList(
title: title,
studentList: students,
homeworkId: jobId,
);
},
);
/*showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
// insetPadding: EdgeInsets.symmetric(vertical: 20.r,horizontal: 20.r),
contentPadding: EdgeInsets.all(20.r),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.r))),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.7,
height: MediaQuery.of(context).size.height * 0.7,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Text(
className + title,
style: TextStyle(fontSize: 15.sp, color: Color(0xFF3C3C3C), fontWeight: FontWeight.w500),
),
),
SizedBox(
height: 5.r,
),
SizedBox(
height: 15.r,
),
arr.length > 0
? Expanded(
child: ListView.builder(
shrinkWrap: true,
itemBuilder: (context, index) {
AnswerOkStudents item = arr[index];
return InkWell(
onTap: () {
*//*RouterManager.router.navigateTo(
context,
RouterManager.quickCheckPersonalPath + '?jobId=$jobId&studentId=${item.id}',
transition: getTransition(),
);*//*
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5.r, horizontal: 15.r),
color: index.isOdd ? Colors.white : Color(0xFFF0F0F0),
child: Text(
item.name,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)),
),
),
);
},
itemCount: arr.length,
),
)
: const MyEmptyWidget()
],
),
),
);
});*/
}
@override
Widget build(BuildContext context) {
double leftWidth = (MediaQuery.of(context).size.width - 40.r) * 0.7 / 3;
double rightWidth = (MediaQuery.of(context).size.width - 40.r) * 0.3 / 2;
return Container(
padding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r),
margin: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6.r)),
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
InkWell(
onTap: () {
showStudentListDialog(context: context, title: '未提交作业学生', students: data.noAnswerStudents!);
},
child: leftContainer(context, count: data.noAnswerCount!, name: '未提交', nameColor: Color(0xFFD92F2F), bgColor: Color(0xFFEEEEEE)),
),
InkWell(
onTap: () {
showStudentListDialog(context: context, title: '已提交作业学生', students: data.studentSubmitStudents!);
},
child: leftContainer(context, count: data.studentSubmitCount!, name: '已提交', nameColor: Color(0xFF4CC793), bgColor: Color(0xFFF5F5F5)),
),
InkWell(
onTap: () {
showStudentListDialog(context: context, title: '全对作业学生', students: data.allCorrectStudents!);
},
child: leftContainer(context, count: data.allCorrect!, name: '全对', nameColor: Color(0xFFFF9800), bgColor: Color(0xFFEEEEEE)),
),
Container(
height: 92.r,
width: rightWidth,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: InkWell(
onTap: () {
showStudentListDialog(context: context, title: '优等作业学生', students: data.levelOneStudents!);
},
child: rightContainer(
count: data.levelOneCount!,
bgColor: Color(0xFF56FFB8),
nameColor: Color(0xFF009254),
name: '',
),
)),
Expanded(
child: InkWell(
onTap: () {
showStudentListDialog(context: context, title: '中等作业学生', students: data.levelThreeStudents!);
},
child:
rightContainer(count: data.levelThreeCount!, bgColor: Color(0xFFD3FF93), nameColor: Color(0xFF3F6605), name: ''),
)),
],
),
),
Container(
height: 92.r,
width: rightWidth,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: InkWell(
onTap: () {
showStudentListDialog(context: context, title: '良等作业学生', students: data.levelTwoStudents!);
},
child:
rightContainer(count: data.levelTwoCount!, bgColor: Color(0xFFFFC38C), nameColor: Color(0xFFD36500), name: ''),
)),
Expanded(
child: InkWell(
onTap: () {
showStudentListDialog(context: context, title: '差等作业学生', students: data.levelFourStudents!);
},
child:
rightContainer(count: data.levelFourCount!, bgColor: Color(0xFFFF9D94), nameColor: Color(0xFFD12616), name: ''),
)),
],
),
)
],
),
],
),
);
}
}
@swidget
Widget leftContainer(context, {required int count, required String name, required Color nameColor, required Color bgColor}) {
double leftWidth = (MediaQuery.of(context).size.width - 40.r) * 0.7 / 3;
return Container(
width: leftWidth,
height: 92.r,
padding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 6.r),
color: bgColor,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: 5.r,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
count.toString(),
style: TextStyle(fontSize: 18.sp, color: Color(0xFF595959), fontWeight: FontWeight.w600),
),
Text(
'',
style: TextStyle(fontSize: 10.sp, color: Color(0xFF595959), fontWeight: FontWeight.w600),
),
],
),
SizedBox(
height: 20.r,
),
Text(
name,
style: TextStyle(fontSize: 12.sp, color: nameColor, fontWeight: FontWeight.w500),
)
],
),
);
}
@swidget
Widget rightContainer({required int count, required Color bgColor, required Color nameColor, required String name}) {
return Container(
color: bgColor,
child: Column(
children: [
SizedBox(
height: 5.r,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
count.toString(),
style: TextStyle(fontSize: 12.sp, color: nameColor, fontWeight: FontWeight.w600),
),
Text(
'',
style: TextStyle(fontSize: 8.sp, color: nameColor, fontWeight: FontWeight.w600),
),
],
),
SizedBox(
height: 5.r,
),
Text(
name,
style: TextStyle(fontSize: 12.sp, color: nameColor, fontWeight: FontWeight.w500),
)
],
),
);
}

View File

@ -33,7 +33,20 @@ class CountData extends Object {
int? zgtCount = 0;
int? studentCount = 0;
List<Students>? priorityStudents = [];
List<Students>? noAnswerStudents = [];
List<Students>? studentSubmitStudents = [];
List<Students>? allCorrectStudents = [];
List<Students>? levelOneStudents = [];
List<Students>? levelTwoStudents = [];
List<Students>? levelThreeStudents = [];
List<Students>? levelFourStudents = [];
int? studentSubmitCount = 0;
int? noAnswerCount = 0;
int? allCorrect = 0;
int? levelOneCount = 0;
int? levelTwoCount = 0;
int? levelThreeCount = 0;
int? levelFourCount = 0;
CountData({
this.kgtOkCount,
this.kgtDtlCount,
@ -50,5 +63,19 @@ class CountData extends Object {
this.zgtCount,
this.priorityStudents,
this.studentSubmitCount,
this.noAnswerCount,
this.allCorrect,
this.noAnswerStudents,
this.studentSubmitStudents,
this.allCorrectStudents,
this.levelOneCount,
this.levelOneStudents,
this.levelTwoCount,
this.levelTwoStudents,
this.levelThreeCount,
this.levelThreeStudents,
this.levelFourCount,
this.levelFourStudents,
});
}

View File

@ -116,11 +116,11 @@ class _KgtZgtTableState extends State<KgtZgtTable> {
SizedBox(
height: widget.zgReport.length > 10 ? 300.r : widget.zgReport.length * 40.r + (Utils.isPad() == true ? 40.r : 65.r),
child: ReportTable(
headList: const ['', '作答率', '作答人数', '正确率', '查看原题', '优先批阅概况'],
headList: const ['', '作答率', '作答人数', '正确率', '查看原题', '优先批阅概况','作答效率'],
bodyList: widget.zgReport,
fixedCols: 1,
fixedRows: 1,
isKG: true,
isZG: true,
jobId: widget.homeworkId,
studentCount: widget.studentCount,
),

View File

@ -1,5 +1,7 @@
import 'package:data_table_2/data_table_2.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_echart/flutter_echart.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/annotated_class.dart';
@ -15,7 +17,7 @@ class ReportTable extends StatefulWidget {
final List bodyList;
final int? fixedRows;
final int? fixedCols;
final bool? isKG;
final bool? isZG;
final String jobId;
final int studentCount;
@ -27,7 +29,7 @@ class ReportTable extends StatefulWidget {
required this.studentCount,
this.fixedCols = 0,
this.fixedRows = 0,
this.isKG = false,
this.isZG = false,
}) : super(key: key);
@override
@ -38,15 +40,128 @@ class _ReportTableState extends State<ReportTable> {
final ScrollController _controller = ScrollController();
int? _sortColumnIndex;
final bool _sortAscending = true;
List colorMap = const [
Color.fromRGBO(0, 179, 134, 1),
Color.fromRGBO(1, 193, 254, 1),
Color.fromRGBO(239, 135, 20, 1),
Color.fromRGBO(219, 0, 0, 1),
Color.fromRGBO(211, 211, 211, 1),
];
void showPeopleListDialog({required BuildContext context, required String title, required String questionNo, required List arr, List? dcList}) {
void showAnswerEfficiency(overallTitles) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
contentPadding: EdgeInsets.all(20.r),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.r))),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.5,
height: MediaQuery.of(context).size.height * 0.4,
child: Column(
children: [
Text(
'作答效率',
style: TextStyle(
fontSize: 15.sp,
color: const Color(0xFF3C3C3C),
fontWeight: FontWeight.w500),
),
Padding(
padding: EdgeInsets.symmetric(vertical:20.r,horizontal: 10.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
mapIcon(const Color(0xFF4CC793)),
SizedBox(width: 5.r,),
mapTxt(''),
const Spacer(),
mapIcon(const Color(0xFF01C1FE)),
SizedBox(width: 5.r,),
mapTxt(''),
const Spacer(),
mapIcon(const Color(0xFFEF8714)),
SizedBox(width: 5.r,),
mapTxt(''),
const Spacer(),
mapIcon(const Color(0xFFDB0000)),
SizedBox(width: 5.r,),
mapTxt(''),
],
),
),
Expanded(
child:
PieChart(
PieChartData(
borderData: FlBorderData(show: true),
sectionsSpace: 0,
centerSpaceRadius: 0,
sections: List.generate(overallTitles.length,(index) {
var e = overallTitles[index];
return PieChartSectionData(
color: colorMap[index],
value: e.count / widget.studentCount * 100,
radius: 110,
// title: e.title + (Utils.doubleToStringAsFixed(e.count / widget.studentCount * 100) + '%'),
title: e.title + e.count.toString(),
titleStyle: TextStyle(fontSize: 12.sp, color: Color(0xFFFFFFFF)),
);
}),
),
),
/*PieChatWidget(
dataList: List.generate(overallTitles.length, (index) {
var e = overallTitles[index];
return EChartPieBean(
title: e.title,
number: e.count,
color: colorMap[index]);
}),
//
isBackground: false,
//线
isLineText: true,
//
bgColor: Colors.white,
//
isFrontgText: false,
//
initSelect: 1,
//
openType: OpenType.ANI,
//
loopType: LoopType.DOWN_LOOP,
//
clickCallBack: (int value) {
print("当前点击显示 $value");
},
),*/
),
],
),
),
);
});
}
void showPeopleListDialog(
{required BuildContext context,
required String title,
required String questionNo,
required List arr,
List? dcList}) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
// insetPadding: EdgeInsets.symmetric(vertical: 20.r,horizontal: 20.r),
contentPadding: EdgeInsets.all(20.r),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.r))),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.r))),
content: SizedBox(
width: MediaQuery.of(context).size.width * 0.7,
height: MediaQuery.of(context).size.height * 0.7,
@ -56,7 +171,10 @@ class _ReportTableState extends State<ReportTable> {
Center(
child: Text(
title,
style: TextStyle(fontSize: 15.sp, color: const Color(0xFF3C3C3C), fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 15.sp,
color: const Color(0xFF3C3C3C),
fontWeight: FontWeight.w500),
),
),
SizedBox(
@ -65,16 +183,19 @@ class _ReportTableState extends State<ReportTable> {
Row(
children: [
Text(
widget.isKG == true ? '主观题' : '客观题',
style: TextStyle(fontSize: 14.sp, color: const Color(0xFF436CFF)),
widget.isZG == true ? '主观题' : '客观题',
style: TextStyle(
fontSize: 14.sp, color: const Color(0xFF436CFF)),
),
Text(
'',
style: TextStyle(fontSize: 14.sp, color: const Color(0xFF436CFF)),
style: TextStyle(
fontSize: 14.sp, color: const Color(0xFF436CFF)),
),
Text(
'$questionNo题',
style: TextStyle(fontSize: 14.sp, color: Color(0xFF436CFF)),
style: TextStyle(
fontSize: 14.sp, color: Color(0xFF436CFF)),
),
],
),
@ -89,21 +210,27 @@ class _ReportTableState extends State<ReportTable> {
child: Center(
child: Text(
'未作答人',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)),
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF6A6A6A)),
))),
Expanded(
flex: 1,
child: Center(
child: Text(
'答对人数',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)),
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF6A6A6A)),
))),
Expanded(
flex: 1,
child: Center(
child: Text(
'答错人',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)),
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF6A6A6A)),
))),
],
)
@ -111,7 +238,8 @@ class _ReportTableState extends State<ReportTable> {
padding: EdgeInsets.only(left: 15.r),
child: Text(
title,
style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)),
style: TextStyle(
fontSize: 12.sp, color: Color(0xFF6A6A6A)),
),
),
SizedBox(
@ -125,41 +253,60 @@ class _ReportTableState extends State<ReportTable> {
var item = arr[index];
return Container(
padding: EdgeInsets.symmetric(vertical: 5.r),
color: index.isOdd ? Colors.white : Color(0xFFF0F0F0),
color:
index.isOdd ? Colors.white : Color(0xFFF0F0F0),
child: Row(
children: [
Expanded(
flex: 1,
child: InkWell(
onTap: () {
goQuickCheckPersonalPath(item['noAnswerStudents'].studentId);
goQuickCheckPersonalPath(
item['noAnswerStudents']
.studentId);
},
child: Center(
child: Text(
item['noAnswerStudents']?.studentName ?? '--',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)),
item['noAnswerStudents']
?.studentName ??
'--',
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF323232)),
)))),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
goQuickCheckPersonalPath(item['answerOkStudents'].studentId);
goQuickCheckPersonalPath(
item['answerOkStudents']
.studentId);
},
child: Center(
child: Text(
item['answerOkStudents']?.studentName ?? '--',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)),
item['answerOkStudents']
?.studentName ??
'--',
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF323232)),
)))),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
goQuickCheckPersonalPath(item['answerNgStudents'].studentId);
goQuickCheckPersonalPath(
item['answerNgStudents']
.studentId);
},
child: Center(
child: Text(
item['answerNgStudents']?.studentName ?? '--',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)),
item['answerNgStudents']
?.studentName ??
'--',
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF323232)),
)))),
],
),
@ -180,11 +327,16 @@ class _ReportTableState extends State<ReportTable> {
goQuickCheckPersonalPath(item.studentId);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5.r, horizontal: 15.r),
color: index.isOdd ? Colors.white : Color(0xFFF0F0F0),
padding: EdgeInsets.symmetric(
vertical: 5.r, horizontal: 15.r),
color: index.isOdd
? Colors.white
: Color(0xFFF0F0F0),
child: Text(
item.studentName! ?? '--',
style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)),
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF323232)),
),
),
);
@ -202,47 +354,65 @@ class _ReportTableState extends State<ReportTable> {
void goQuickCheckPersonalPath(id) {
if (id != null) {
Get.toNamed(Routes.studentPersonalPage, arguments: {'studentId': id, 'homeworkId': widget.jobId});
Get.toNamed(Routes.studentPersonalPage,
arguments: {'studentId': id, 'homeworkId': widget.jobId});
}
}
void zdHandle(BuildContext context, String title, String questionNo, List noAnswerStudents, List answerNgStudents, List answerOkStudents) {
void zdHandle(BuildContext context, String title, String questionNo,
List noAnswerStudents, List answerNgStudents, List answerOkStudents) {
List list = [];
// Questions student = Questions('','',-1,-1,'',-1,'','',[],-1,-1,[] as double?);
if (noAnswerStudents.length > answerNgStudents.length && noAnswerStudents.length > answerOkStudents.length) {
if (noAnswerStudents.length > answerNgStudents.length &&
noAnswerStudents.length > answerOkStudents.length) {
for (int i = 0; i < noAnswerStudents.length; i++) {
var obj = {
'noAnswerStudents': noAnswerStudents[i],
'answerNgStudents': answerNgStudents.length > i ? answerNgStudents[i] : null,
'answerOkStudents': answerOkStudents.length > i ? answerOkStudents[i] : null
'answerNgStudents':
answerNgStudents.length > i ? answerNgStudents[i] : null,
'answerOkStudents':
answerOkStudents.length > i ? answerOkStudents[i] : null
};
list.add(obj);
}
} else if (answerNgStudents.length > noAnswerStudents.length && answerNgStudents.length > answerOkStudents.length) {
} else if (answerNgStudents.length > noAnswerStudents.length &&
answerNgStudents.length > answerOkStudents.length) {
for (int i = 0; i < answerNgStudents.length; i++) {
var obj = {
'noAnswerStudents': noAnswerStudents.length > i ? noAnswerStudents[i] : null,
'noAnswerStudents':
noAnswerStudents.length > i ? noAnswerStudents[i] : null,
'answerNgStudents': answerNgStudents[i],
'answerOkStudents': answerOkStudents.length > i ? answerOkStudents[i] : null
'answerOkStudents':
answerOkStudents.length > i ? answerOkStudents[i] : null
};
list.add(obj);
}
} else if (answerOkStudents.length > noAnswerStudents.length && answerOkStudents.length > answerNgStudents.length) {
} else if (answerOkStudents.length > noAnswerStudents.length &&
answerOkStudents.length > answerNgStudents.length) {
for (int i = 0; i < answerOkStudents.length; i++) {
var obj = {
'noAnswerStudents': noAnswerStudents.length > i ? noAnswerStudents[i] : null,
'answerNgStudents': answerNgStudents.length > i ? answerNgStudents[i] : null,
'noAnswerStudents':
noAnswerStudents.length > i ? noAnswerStudents[i] : null,
'answerNgStudents':
answerNgStudents.length > i ? answerNgStudents[i] : null,
'answerOkStudents': answerOkStudents[i]
};
list.add(obj);
}
}
showPeopleListDialog(context: context, title: title, questionNo: questionNo, arr: list, dcList: []);
showPeopleListDialog(
context: context,
title: title,
questionNo: questionNo,
arr: list,
dcList: []);
}
void dcHandle(BuildContext context, String title, String questionNo, List arr) {
showPeopleListDialog(context: context, title: title, questionNo: questionNo, arr: arr);
void dcHandle(
BuildContext context, String title, String questionNo, List arr) {
showPeopleListDialog(
context: context, title: title, questionNo: questionNo, arr: arr);
}
DataRow _getRow(int index, [Color? color]) {
@ -255,18 +425,28 @@ class _ReportTableState extends State<ReportTable> {
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text(item.questionNo.toString(), style: TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))),
child: Text(item.questionNo.toString(),
style:
TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))),
),
)),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text('${item.answerRate.toStringAsFixed(0)}%', style: TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))),
child: Text('${item.answerRate.toStringAsFixed(0)}%',
style:
TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))),
),
)),
DataCell(InkWell(
onTap: () {
zdHandle(context, '作答人数', item.questionNo.toString(), item.noAnswerStudents, item.answerNgStudents, item.answerOkStudents);
zdHandle(
context,
'作答人数',
item.questionNo.toString(),
item.noAnswerStudents,
item.answerNgStudents,
item.answerOkStudents);
},
child: Center(
child: Padding(
@ -274,7 +454,9 @@ class _ReportTableState extends State<ReportTable> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('${item.answerCount}/${widget.studentCount}', style: TextStyle(fontSize: 10.sp, color: const Color(0xFF4CC793))),
Text('${item.answerCount}/${widget.studentCount}',
style: TextStyle(
fontSize: 10.sp, color: const Color(0xFF4CC793))),
Image.asset(
'assets/images/green_right_icon.png',
width: 12.r,
@ -288,32 +470,43 @@ class _ReportTableState extends State<ReportTable> {
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: Text('${item.okRate.toStringAsFixed(0)}%', style: TextStyle(fontSize: 10.sp, color: Color(0xFF525252))),
child: Text('${item.okRate.toStringAsFixed(0)}%',
style: TextStyle(fontSize: 10.sp, color: Color(0xFF525252))),
),
)),
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: widget.isKG == true
child: widget.isZG == true
? InkWell(
onTap: () {
if (item.questionPicture == null) {
ToastUtils.showInfo('当前试题没有原题');
} else {
ImageDialog.showImgDialog(context, item.questionPicture);
ImageDialog.showImgDialog(
context, item.questionPicture);
}
},
child:
Text('原题', style: TextStyle(fontSize: 10.sp, color: widget.isKG == true ? const Color(0xFFFF8A00) : const Color(0xFF4CC793))),
child: Text('原题',
style: TextStyle(
fontSize: 10.sp,
color: widget.isZG == true
? const Color(0xFFFF8A00)
: const Color(0xFF4CC793))),
)
: Text(item.answer,
style: TextStyle(fontSize: 10.sp, color: widget.isKG == true ? const Color(0xFFFF8A00) : const Color(0xFF4CC793))),
style: TextStyle(
fontSize: 10.sp,
color: widget.isZG == true
? const Color(0xFFFF8A00)
: const Color(0xFF4CC793))),
),
)),
DataCell(InkWell(
onTap: () {
// List<String> parts = item.priorityGeneral.split('');
dcHandle(context, '优先批阅答错人', item.questionNo.toString(), item.priorityInfo);
dcHandle(context, '优先批阅答错人', item.questionNo.toString(),
item.priorityInfo);
},
child: Center(
child: Padding(
@ -321,7 +514,9 @@ class _ReportTableState extends State<ReportTable> {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('${item.priorityInfo.length}人答错', style: TextStyle(fontSize: 10.sp, color: const Color(0xFF6888FD))),
Text('${item.priorityInfo.length}人答错',
style: TextStyle(
fontSize: 10.sp, color: const Color(0xFF6888FD))),
Image.asset(
'assets/images/job_data_right_icon.png',
width: 10.r,
@ -332,6 +527,30 @@ class _ReportTableState extends State<ReportTable> {
),
),
)),
if (widget.isZG == true)
DataCell(Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 5.r),
child: widget.isZG == true
? InkWell(
onTap: () {
showAnswerEfficiency(item.overallTitles);
},
child: Text('查看',
style: TextStyle(
fontSize: 10.sp,
color: widget.isZG == true
? const Color(0xFFFF8A00)
: const Color(0xFF4CC793))),
)
: Text(item.answer,
style: TextStyle(
fontSize: 10.sp,
color: widget.isZG == true
? const Color(0xFFFF8A00)
: const Color(0xFF4CC793))),
),
)),
],
);
}
@ -347,10 +566,14 @@ class _ReportTableState extends State<ReportTable> {
dataRowHeight: 40.r,
bottomMargin: 0,
border: const TableBorder(
horizontalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid),
bottom: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid),
verticalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid)),
headingRowColor: MaterialStateProperty.resolveWith((states) => widget.fixedCols! > 0 ? Colors.white : Colors.transparent),
horizontalInside: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid),
bottom: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid),
verticalInside: BorderSide(
width: 1, color: Colors.white, style: BorderStyle.solid)),
headingRowColor: MaterialStateProperty.resolveWith((states) =>
widget.fixedCols! > 0 ? Colors.white : Colors.transparent),
headingRowDecoration: BoxDecoration(color: Color(0xFFE6E6E6)),
fixedColumnsColor: Color(0xFFE6E6E6),
fixedCornerColor: Colors.grey[400],
@ -368,7 +591,8 @@ class _ReportTableState extends State<ReportTable> {
var item = widget.headList[index];
return DataColumn2(
label: Center(
child: Text(item, style: TextStyle(fontSize: 10.sp, color: Color(0xFF505767))),
child: Text(item,
style: TextStyle(fontSize: 10.sp, color: Color(0xFF505767))),
),
// size: ColumnSize.S,
fixedWidth: index == 0
@ -376,10 +600,26 @@ class _ReportTableState extends State<ReportTable> {
: widget.headList.length > 6
? 80.r
: isPadFlag
? (MediaQuery.of(context).size.width - 8.r) / widget.headList.length
? (MediaQuery.of(context).size.width - 8.r) /
widget.headList.length
: 85.r,
);
}),
rows: List<DataRow>.generate(widget.bodyList.length, (index) => _getRow(index, Color(0xFFF5F5F5))));
rows: List<DataRow>.generate(widget.bodyList.length,
(index) => _getRow(index, Color(0xFFF5F5F5))));
}
}
Widget mapIcon(Color bgColor){
return Container(
width: 12.r,
height: 12.r,
decoration: BoxDecoration(
color: bgColor,
borderRadius: BorderRadius.all(Radius.circular(6.r)),
),
);
}
Widget mapTxt(String title){
return Text(title,style: TextStyle(fontSize: 12.sp,color: Color(0xFF525252),fontWeight: FontWeight.w400),);
}

View File

@ -381,7 +381,8 @@ Widget $reviewedItem({
if (!jobTaskItem.isFixed!)
Expanded(
flex: 1,
child: InkWell(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (!jobTaskItem.isFixed!) {
EasyLoading.show(status: 'loading...');
@ -399,7 +400,8 @@ Widget $reviewedItem({
),
Expanded(
flex: 1,
child: InkWell(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Get.toNamed(Routes.jobReportPage,
arguments: {'title': jobTaskItem.name, 'homeworkId': jobTaskItem.id, 'grade': jobTaskItem.grade});

View File

@ -85,6 +85,9 @@ dependencies:
event_bus: ^2.0.0
path_provider: ^2.1.3
uuid: ^3.0.7
flutter_echarts: ^2.4.0
# 饼图
flutter_echart: ^2.0.0
dev_dependencies:
flutter_test: