|
@@ -28,25 +28,7 @@ class _CrowdSelectLabelState extends State<CrowdSelectLabelView> {
|
|
|
runSpacing: 12,
|
|
|
children: [
|
|
|
buildItem(LabelDTO(code: "0", labelName: "全选"), context),
|
|
|
- ...state.normalOptions
|
|
|
- .where((element) => [
|
|
|
- "RQFL_ET",
|
|
|
- "RQFL_YF",
|
|
|
- "RQFL_LNR",
|
|
|
- ].contains(element.code))
|
|
|
- .map((LabelDTO e) => buildItem(e, context))
|
|
|
- .toList(),
|
|
|
- ...state.diseaseOptions
|
|
|
- .where((element) => [
|
|
|
- "CJJB_GXY",
|
|
|
- "CJJB_TNB",
|
|
|
- "CJJB_YZJSBZA",
|
|
|
- "CJJB_FJH",
|
|
|
- ].contains(element.code))
|
|
|
- .map((LabelDTO e) => buildItem(e, context))
|
|
|
- .toList(),
|
|
|
- ...state.specialCareOptions
|
|
|
- .where((element) => [].contains(element.code))
|
|
|
+ ...state.allLabels
|
|
|
.map((LabelDTO e) => buildItem(e, context))
|
|
|
.toList(),
|
|
|
],
|
|
@@ -60,10 +42,14 @@ class _CrowdSelectLabelState extends State<CrowdSelectLabelView> {
|
|
|
label: dto.labelName ?? '',
|
|
|
isChecked: controller.state.isAllSelect
|
|
|
? controller.state.isAllSelect
|
|
|
- : controller.state.selectedCodes.contains(dto.code),
|
|
|
+ : controller.state.selectedFilterCodes.contains(dto.code),
|
|
|
+ isAllChecked: controller.state.isAllSelect,
|
|
|
onChanged: (value) {
|
|
|
- controller.onItemCheckChanged(dto.code!);
|
|
|
- if (controller.state.selectedCodes.length == 7) {
|
|
|
+ if (controller.state.isAllSelect && dto.code != "0") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ controller.onItemCheckFilterChanged(dto.code!);
|
|
|
+ if (controller.state.selectedFilterCodes.length == 7) {
|
|
|
controller.state.isAllSelect = true;
|
|
|
}
|
|
|
setState(() {});
|
|
@@ -81,6 +67,9 @@ class VCheckBoxButton extends StatefulWidget {
|
|
|
/// 是否默认选中
|
|
|
final bool? isChecked;
|
|
|
|
|
|
+ /// 是否默认选中
|
|
|
+ final bool? isAllChecked;
|
|
|
+
|
|
|
/// 选中状态变更
|
|
|
final ValueChanged<bool>? onChanged;
|
|
|
|
|
@@ -89,6 +78,7 @@ class VCheckBoxButton extends StatefulWidget {
|
|
|
required this.label,
|
|
|
this.isChecked,
|
|
|
this.onChanged,
|
|
|
+ this.isAllChecked,
|
|
|
});
|
|
|
@override
|
|
|
State<StatefulWidget> createState() => _VCheckBoxState();
|
|
@@ -96,12 +86,16 @@ class VCheckBoxButton extends StatefulWidget {
|
|
|
|
|
|
class _VCheckBoxState extends State<VCheckBoxButton> {
|
|
|
bool _isChecked = false;
|
|
|
+ bool _isAllChecked = false;
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
if (widget.isChecked != null) {
|
|
|
_isChecked = widget.isChecked!;
|
|
|
}
|
|
|
+ if (widget.isAllChecked != null) {
|
|
|
+ _isAllChecked = widget.isAllChecked!;
|
|
|
+ }
|
|
|
super.initState();
|
|
|
}
|
|
|
|
|
@@ -127,9 +121,15 @@ class _VCheckBoxState extends State<VCheckBoxButton> {
|
|
|
alignment: Alignment.center,
|
|
|
height: height,
|
|
|
decoration: BoxDecoration(
|
|
|
- color: _isChecked ? primaryColor : Colors.white,
|
|
|
+ color: (_isAllChecked && widget.label != "全选")
|
|
|
+ ? Colors.grey.shade400
|
|
|
+ : _isChecked
|
|
|
+ ? primaryColor
|
|
|
+ : Colors.white,
|
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
|
- border: _isChecked ? null : Border.all(color: primaryColor),
|
|
|
+ border: ((_isAllChecked && widget.label != "全选") || _isChecked)
|
|
|
+ ? null
|
|
|
+ : Border.all(color: primaryColor),
|
|
|
),
|
|
|
child: Row(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
@@ -138,7 +138,11 @@ class _VCheckBoxState extends State<VCheckBoxButton> {
|
|
|
Text(
|
|
|
widget.label,
|
|
|
style: TextStyle(
|
|
|
- color: _isChecked ? Colors.white : primaryColor,
|
|
|
+ color: (_isAllChecked && widget.label != "全选")
|
|
|
+ ? Colors.white
|
|
|
+ : _isChecked
|
|
|
+ ? Colors.white
|
|
|
+ : primaryColor,
|
|
|
fontSize: 16,
|
|
|
),
|
|
|
),
|
|
@@ -151,3 +155,132 @@ class _VCheckBoxState extends State<VCheckBoxButton> {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+class ContractStateSelectLabelView extends StatefulWidget {
|
|
|
+ final List<ContractStateEnum> ContractStateEnums;
|
|
|
+ final Function selectRaidoChange;
|
|
|
+ final ContractStateEnum? selectContractState;
|
|
|
+
|
|
|
+ const ContractStateSelectLabelView(
|
|
|
+ {super.key,
|
|
|
+ required this.ContractStateEnums,
|
|
|
+ required this.selectRaidoChange,
|
|
|
+ this.selectContractState});
|
|
|
+ @override
|
|
|
+ State<StatefulWidget> createState() => _ContractStateSelectLabelState();
|
|
|
+}
|
|
|
+
|
|
|
+class _ContractStateSelectLabelState
|
|
|
+ extends State<ContractStateSelectLabelView> {
|
|
|
+ late List<ContractStateEnum> ContractStateEnums;
|
|
|
+ String selectContractState = "0";
|
|
|
+
|
|
|
+ final Map<String, String> ContractStateMap = {
|
|
|
+ "Unsigned": "未签约",
|
|
|
+ "Cancelled": "已解约",
|
|
|
+ "Expired": "已过期",
|
|
|
+ "Signed": "已签约",
|
|
|
+ "Voided": "已作废",
|
|
|
+ "Refused": "已拒签",
|
|
|
+ };
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ ContractStateEnums = widget.ContractStateEnums;
|
|
|
+ if (widget.selectContractState != null) {
|
|
|
+ selectContractState = widget.selectContractState!.name;
|
|
|
+ } else {
|
|
|
+ selectContractState = "0";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return Wrap(
|
|
|
+ spacing: 16,
|
|
|
+ runSpacing: 12,
|
|
|
+ children: [
|
|
|
+ buildItem(LabelDTO(code: "0", labelName: "全选"), context),
|
|
|
+ ...ContractStateEnums.map((ContractStateEnum e) => buildItem(
|
|
|
+ LabelDTO(code: e.name, labelName: ContractStateMap[e.name]),
|
|
|
+ context)).toList(),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildItem(LabelDTO dto, BuildContext context) {
|
|
|
+ return InkWell(
|
|
|
+ child: VCheckBoxButton(
|
|
|
+ key: GlobalKey(),
|
|
|
+ label: dto.labelName ?? '',
|
|
|
+ isChecked: selectContractState == dto.code,
|
|
|
+ // isAllChecked: selectContractState == "0",
|
|
|
+ onChanged: (value) {
|
|
|
+ // if (selectContractState == "0" && dto.code != "0") {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ selectContractState = dto.code ?? '0';
|
|
|
+ widget.selectRaidoChange(dto.code);
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+class ScopeEnquiryResidents extends StatefulWidget {
|
|
|
+ final Function selectRaidoChange;
|
|
|
+ final int? selectIndex;
|
|
|
+
|
|
|
+ const ScopeEnquiryResidents({
|
|
|
+ super.key,
|
|
|
+ required this.selectRaidoChange,
|
|
|
+ this.selectIndex,
|
|
|
+ });
|
|
|
+ @override
|
|
|
+ State<StatefulWidget> createState() => _ScopeEnquiryResidentsState();
|
|
|
+}
|
|
|
+
|
|
|
+class _ScopeEnquiryResidentsState extends State<ScopeEnquiryResidents> {
|
|
|
+ int selectIndex = 0;
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ if (widget.selectIndex != null) {
|
|
|
+ selectIndex = widget.selectIndex!;
|
|
|
+ } else {
|
|
|
+ selectIndex = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ Widget build(BuildContext context) {
|
|
|
+ return Wrap(
|
|
|
+ spacing: 16,
|
|
|
+ runSpacing: 12,
|
|
|
+ children: [
|
|
|
+ buildItem(LabelDTO(code: "0", labelName: "仅当前医生建档"), context),
|
|
|
+ buildItem(LabelDTO(code: "1", labelName: "当前团队所有居民"), context),
|
|
|
+ ],
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget buildItem(LabelDTO dto, BuildContext context) {
|
|
|
+ return InkWell(
|
|
|
+ child: VCheckBoxButton(
|
|
|
+ key: GlobalKey(),
|
|
|
+ label: dto.labelName ?? '',
|
|
|
+ isChecked: selectIndex.toString() == dto.code,
|
|
|
+ // isAllChecked: selectContractState == "0",
|
|
|
+ onChanged: (value) {
|
|
|
+ // if (selectContractState == "0" && dto.code != "0") {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ selectIndex = int.parse(dto.code!);
|
|
|
+ widget.selectRaidoChange(selectIndex);
|
|
|
+ setState(() {});
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|