|
@@ -1,5 +1,11 @@
|
|
|
+import 'dart:convert';
|
|
|
+
|
|
|
import 'package:fis_i18n/i18n.dart';
|
|
|
import 'package:fis_jsonrpc/rpc.dart';
|
|
|
+import 'package:fis_measure/interfaces/process/workspace/application.dart';
|
|
|
+import 'package:fis_measure/process/workspace/measure_data_controller.dart';
|
|
|
+import 'package:fis_measure/process/workspace/measure_handler.dart';
|
|
|
+import 'package:fis_measure/view/measure/measure_config/widgets/measurement_tool_selection.dart';
|
|
|
import 'package:fis_theme/theme.dart';
|
|
|
import 'package:fis_ui/index.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
@@ -34,11 +40,169 @@ class MeasureConfigurationPage extends StatelessWidget {
|
|
|
}
|
|
|
|
|
|
///测量配置对话框
|
|
|
-class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
+class _MeasureConfigurationDialog extends StatefulWidget implements FWidget {
|
|
|
const _MeasureConfigurationDialog({
|
|
|
Key? key,
|
|
|
}) : super(key: key);
|
|
|
|
|
|
+ @override
|
|
|
+ State<_MeasureConfigurationDialog> createState() =>
|
|
|
+ _MeasureConfigurationDialogState();
|
|
|
+}
|
|
|
+
|
|
|
+class _MeasureConfigurationDialogState
|
|
|
+ extends State<_MeasureConfigurationDialog> {
|
|
|
+ int measureToolsTab = 0;
|
|
|
+
|
|
|
+ /// 切换标签栏
|
|
|
+ void changeTab(int index) {
|
|
|
+ measureToolsTab = index;
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ late final application = Get.find<IApplication>();
|
|
|
+ late final measureHandler = Get.find<MeasureHandler>();
|
|
|
+
|
|
|
+ /// 数据
|
|
|
+ final measureData = Get.find<MeasureDataController>();
|
|
|
+
|
|
|
+ /// 选中的测量项
|
|
|
+ List<String> chooseMeasureList = [];
|
|
|
+ List<ItemMetaGroup> itemMetaListGroup = [];
|
|
|
+ String activeName = '';
|
|
|
+
|
|
|
+ /// 跟超声机端保持一致,配置 项目写死
|
|
|
+ List<ItemMetaGroup> getMeasureConfigurationGroupName() {
|
|
|
+ return [
|
|
|
+ ItemMetaGroup('Common', [], true),
|
|
|
+ ItemMetaGroup('ABD', [], true),
|
|
|
+ ItemMetaGroup('CARD', [], true),
|
|
|
+ ItemMetaGroup('GYN', [], true),
|
|
|
+ ItemMetaGroup('OB', [], true),
|
|
|
+ ItemMetaGroup('VAS', [], true),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 打开已选测量工具设置
|
|
|
+ ///
|
|
|
+ /// [name] 测量的名字 后期改版后应该是一个测量对象
|
|
|
+ void openHasSelectedSettingDialog(String name) {
|
|
|
+ // state.childItemMeta = state.allItemMeta.firstWhere(
|
|
|
+ // (element) => element.name == name,
|
|
|
+ // );
|
|
|
+ // router.dialog(() => HasSelectedSettingDialog(name: name));
|
|
|
+ }
|
|
|
+ Future<void> getName() async {
|
|
|
+ var measureModeSelection = MeasureModeSelection(
|
|
|
+ application.applicationName,
|
|
|
+ application.categoryName,
|
|
|
+ application.isThirdPart ? ['TPPTissue'] : ['Tissue'],
|
|
|
+ );
|
|
|
+ measureHandler.measureModeChanged = measureModeSelection;
|
|
|
+ measureData.getMeasureApplicationList = [];
|
|
|
+ var measureApplicationDTO =
|
|
|
+ await measureData.getMeasureApplication.call(measureModeSelection);
|
|
|
+ if (measureApplicationDTO != null) {
|
|
|
+ /// 模式版本
|
|
|
+ measureData.measureApplicationVersion =
|
|
|
+ measureApplicationDTO.version ?? '';
|
|
|
+
|
|
|
+ ///模式列表
|
|
|
+ var models = measureApplicationDTO.availableModes;
|
|
|
+ if (models != null && models.isNotEmpty) {
|
|
|
+ ///群组列表
|
|
|
+ var groups = models[0].availableGroups;
|
|
|
+ if (groups != null && groups.isNotEmpty) {
|
|
|
+ ///项目列表
|
|
|
+ var folders = groups[0].availableFolders;
|
|
|
+ if (folders != null && folders.isNotEmpty) {
|
|
|
+ measureData.getMeasureApplicationList =
|
|
|
+ folders[0].workingItemNames ?? [];
|
|
|
+ if (folders[0].availableItems != null) {
|
|
|
+ measureData.itemMetaList = folders[0].availableItems!.toList();
|
|
|
+ }
|
|
|
+ if (measureData.getMeasureApplicationList.isNotEmpty) {
|
|
|
+ changeItem(measureData.getMeasureApplicationList[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void changeItem(String? name) {
|
|
|
+ activeName = name ?? '';
|
|
|
+ application.switchItemByName(activeName);
|
|
|
+ if (mounted) {
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void submit() async {
|
|
|
+ var measureModeSubmitChanged = MeasureModeSubmit(
|
|
|
+ measureData.measureApplicationVersion,
|
|
|
+ application.applicationName,
|
|
|
+ application.categoryName,
|
|
|
+ UserDefinedMeasureModeDTO(
|
|
|
+ modeName: 'Tissue',
|
|
|
+ workingGroups: [
|
|
|
+ UserDefinedMeasureGroupDTO(
|
|
|
+ name: 'General',
|
|
|
+ folders: [
|
|
|
+ UserDefinedMeasureFolderDTO(
|
|
|
+ name: 'General',
|
|
|
+ workingItemNames: chooseMeasureList,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ measureHandler.measureModeSubmitChanged = measureModeSubmitChanged;
|
|
|
+ var saveUserDefinedMeasureApplication = await measureData
|
|
|
+ .saveUserDefinedMeasureApplicationAsync
|
|
|
+ .call(measureModeSubmitChanged);
|
|
|
+ getName();
|
|
|
+ setState(() {});
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ List<ItemMetaGroup> _itemMetaConfigurationList = [];
|
|
|
+ List<String> chooseMeasure = [];
|
|
|
+
|
|
|
+ Map<String, List<ItemMetaDTO>> _group = {};
|
|
|
+ getMeasureConfigurationGroupName().forEach(
|
|
|
+ ((element) {
|
|
|
+ List<ItemMetaDTO> itemMetaListGroupItem = [];
|
|
|
+ (measureData.itemMetaList).toList().forEach(
|
|
|
+ (e) {
|
|
|
+ if (e.categories!.contains(element.itemMetaGroupTitle)) {
|
|
|
+ itemMetaListGroupItem.add(e);
|
|
|
+ }
|
|
|
+ _group[element.itemMetaGroupTitle] = itemMetaListGroupItem;
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }),
|
|
|
+ );
|
|
|
+ _group.forEach(
|
|
|
+ (key, value) {
|
|
|
+ _itemMetaConfigurationList.add(
|
|
|
+ ItemMetaGroup(key, value, true),
|
|
|
+ );
|
|
|
+ },
|
|
|
+ );
|
|
|
+ itemMetaListGroup = _itemMetaConfigurationList;
|
|
|
+ chooseMeasure = measureData.getMeasureApplicationList;
|
|
|
+ chooseMeasureList = chooseMeasure.toSet().toList();
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
+ void dispose() {
|
|
|
+ super.dispose();
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
FWidget build(BuildContext context) {
|
|
|
return FSimpleDialog(
|
|
@@ -51,10 +215,12 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
),
|
|
|
isDefault: true,
|
|
|
onOk: () {
|
|
|
- // controller.saveUserDefinedMeasureApplicationAsync();
|
|
|
+ submit();
|
|
|
},
|
|
|
onCancel: () {
|
|
|
+ chooseMeasureList = measureData.getMeasureApplicationList;
|
|
|
Get.back();
|
|
|
+ setState(() {});
|
|
|
},
|
|
|
children: [
|
|
|
FContainer(
|
|
@@ -67,8 +233,6 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
}
|
|
|
|
|
|
FWidget _buildMeasureconfiguration() {
|
|
|
- // final controller = Get.put(MeasureConfigurationController());
|
|
|
-
|
|
|
return FContainer(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 15),
|
|
|
child: FRow(
|
|
@@ -94,7 +258,7 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
width: 160,
|
|
|
child: FInkWell(
|
|
|
onTap: () {
|
|
|
- // controller.changeTab(0);
|
|
|
+ changeTab(0);
|
|
|
},
|
|
|
child: FContainer(
|
|
|
padding: const EdgeInsets.symmetric(
|
|
@@ -103,13 +267,11 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
),
|
|
|
child: FText(
|
|
|
i18nBook.measure.measureToolSelect.t,
|
|
|
- style:
|
|
|
- // controller.state.measureToolsTab == 0
|
|
|
- true
|
|
|
- ? TextStyle(
|
|
|
- color: FTheme.ins.colorScheme.primary,
|
|
|
- )
|
|
|
- : const TextStyle(),
|
|
|
+ style: measureToolsTab == 0
|
|
|
+ ? TextStyle(
|
|
|
+ color: FTheme.ins.colorScheme.primary,
|
|
|
+ )
|
|
|
+ : const TextStyle(),
|
|
|
textAlign: TextAlign.end,
|
|
|
),
|
|
|
),
|
|
@@ -119,7 +281,7 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
width: 160,
|
|
|
child: FInkWell(
|
|
|
onTap: () {
|
|
|
- // controller.changeTab(1);
|
|
|
+ changeTab(1);
|
|
|
},
|
|
|
child: FContainer(
|
|
|
padding: const EdgeInsets.symmetric(
|
|
@@ -128,13 +290,11 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
),
|
|
|
child: FText(
|
|
|
i18nBook.measure.selectedMeasureTool.t,
|
|
|
- style:
|
|
|
- // controller.state.measureToolsTab == 1
|
|
|
- true
|
|
|
- ? TextStyle(
|
|
|
- color: FTheme.ins.colorScheme.primary,
|
|
|
- )
|
|
|
- : const TextStyle(),
|
|
|
+ style: measureToolsTab == 1
|
|
|
+ ? TextStyle(
|
|
|
+ color: FTheme.ins.colorScheme.primary,
|
|
|
+ )
|
|
|
+ : const TextStyle(),
|
|
|
textAlign: TextAlign.end,
|
|
|
),
|
|
|
),
|
|
@@ -143,199 +303,41 @@ class _MeasureConfigurationDialog extends StatelessWidget implements FWidget {
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- // FObx(
|
|
|
- // () =>
|
|
|
-
|
|
|
- // controller.state.measureToolsTab == 0
|
|
|
- true
|
|
|
+ measureToolsTab == 0
|
|
|
? FExpanded(
|
|
|
- child: _SelectModulePage(),
|
|
|
+ child: SelectModulePage(
|
|
|
+ itemMetaListGroup: itemMetaListGroup,
|
|
|
+ chooseMeasureList: chooseMeasureList,
|
|
|
+ ),
|
|
|
)
|
|
|
: FExpanded(
|
|
|
- child: _HasSelectedModulePage(),
|
|
|
+ child: _HasSelectedModulePage(
|
|
|
+ chooseMeasureList: chooseMeasureList,
|
|
|
+ ),
|
|
|
),
|
|
|
- // ),
|
|
|
],
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-class _SelectModulePage extends FStatefulWidget {
|
|
|
- @override
|
|
|
- FState<_SelectModulePage> createState() => _SelectModulePageState();
|
|
|
-}
|
|
|
-
|
|
|
-class _SelectModulePageState extends FState<_SelectModulePage> {
|
|
|
- // final controller = Get.put(MeasureConfigurationController());
|
|
|
-
|
|
|
- @override
|
|
|
- FWidget build(BuildContext context) {
|
|
|
- return FListView(
|
|
|
- shrinkWrap: true,
|
|
|
- children:
|
|
|
- // controller.state.itemMetaListGroup
|
|
|
- []
|
|
|
- .map(
|
|
|
- (e) => FColumn(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: _buildMeasureConfiguration(e),
|
|
|
- ),
|
|
|
- )
|
|
|
- .toList(),
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- List<FWidget> _buildMeasureConfiguration(ItemMetaGroup e) {
|
|
|
- return [
|
|
|
- FInkWell(
|
|
|
- onTap: () {
|
|
|
- e.isExpend = !e.isExpend!;
|
|
|
- setState(() {});
|
|
|
- },
|
|
|
- child: FContainer(
|
|
|
- padding: const EdgeInsets.all(15),
|
|
|
- child: _buildGroupTitleRow(
|
|
|
- e.itemMetaGroupTitle.toString(),
|
|
|
- e.isExpend!,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- e.isExpend! ? _buildGroupBody(e) : FContainer(),
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- FWidget _buildGroupTitleRow(
|
|
|
- String itemMetaGroupTitle,
|
|
|
- bool isExpend,
|
|
|
- ) {
|
|
|
- return FRow(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- FRow(
|
|
|
- children: [
|
|
|
- FText(
|
|
|
- itemMetaGroupTitle,
|
|
|
- ),
|
|
|
- // FText(
|
|
|
- // '(${controller.getValues(
|
|
|
- // itemMetaGroupTitle,
|
|
|
- // )})',
|
|
|
- // ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- isExpend
|
|
|
- ? const FIcon(
|
|
|
- Icons.keyboard_arrow_down_sharp,
|
|
|
- )
|
|
|
- : const FIcon(
|
|
|
- Icons.keyboard_arrow_right,
|
|
|
- ),
|
|
|
- ],
|
|
|
- );
|
|
|
- }
|
|
|
+class _HasSelectedModulePage extends StatelessWidget implements FWidget {
|
|
|
+ final List<String> chooseMeasureList;
|
|
|
|
|
|
- FWidget _buildGroupBody(ItemMetaGroup e) {
|
|
|
- return FContainer(
|
|
|
- padding: const EdgeInsets.only(left: 15),
|
|
|
- margin: const EdgeInsets.symmetric(vertical: 10),
|
|
|
- child: FWrap(
|
|
|
- spacing: 16.0, // 主轴(水平)方向间距
|
|
|
- runSpacing: 8.0, // 纵轴(垂直)方向间距
|
|
|
- direction: Axis.horizontal,
|
|
|
- crossAlignment: WrapCrossAlignment.center,
|
|
|
- alignment: WrapAlignment.start,
|
|
|
- children: List<FWidget>.generate(
|
|
|
- e.itemMeta.length,
|
|
|
- (index) {
|
|
|
- // return FObx(
|
|
|
- // () {
|
|
|
- return
|
|
|
+ /// 数据
|
|
|
+ final measureData = Get.find<MeasureDataController>();
|
|
|
+ _HasSelectedModulePage({
|
|
|
+ required this.chooseMeasureList,
|
|
|
+ });
|
|
|
|
|
|
- // controller.state.chooseMeasureList.contains(
|
|
|
- // e.itemMeta[index].name,
|
|
|
- // )
|
|
|
- true
|
|
|
- ? FElevatedButton(
|
|
|
- onPressed: () {
|
|
|
- // controller.removeChooseMeasure(
|
|
|
- // e.itemMeta[index].name!,
|
|
|
- // );
|
|
|
- },
|
|
|
- style: const ButtonStyle(),
|
|
|
- child: FContainer(
|
|
|
- width: 180,
|
|
|
- height: 60,
|
|
|
- child: FCenter(
|
|
|
- child: FColumn(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- FText(
|
|
|
- e.itemMeta[index].name!,
|
|
|
- style: const TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- ),
|
|
|
- ),
|
|
|
- const FText(
|
|
|
- // controller.getValues(
|
|
|
- // e.itemMeta[index].name!,
|
|
|
- // ),
|
|
|
- 'sss',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- )
|
|
|
- : FElevatedButton(
|
|
|
- onPressed: () {
|
|
|
- // controller.addChooseMeasure(
|
|
|
- // e.itemMeta[index].name!,
|
|
|
- // );
|
|
|
- },
|
|
|
- style: ButtonStyle(
|
|
|
- backgroundColor: MaterialStateProperty.all(
|
|
|
- Colors.white,
|
|
|
- ),
|
|
|
- ),
|
|
|
- child: FContainer(
|
|
|
- width: 180,
|
|
|
- height: 60,
|
|
|
- child: FCenter(
|
|
|
- child: FColumn(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: [
|
|
|
- FText(
|
|
|
- e.itemMeta[index].name!,
|
|
|
- style: const TextStyle(
|
|
|
- color: Colors.black,
|
|
|
- ),
|
|
|
- ),
|
|
|
- const FText(
|
|
|
- // controller.getValues(
|
|
|
- // e.itemMeta[index].name!,
|
|
|
- // ),
|
|
|
- 'sds',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.black,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
- },
|
|
|
- ),
|
|
|
- ),
|
|
|
- );
|
|
|
+ /// 根据语言包翻译
|
|
|
+ ///
|
|
|
+ /// [code] 翻译编码
|
|
|
+ String getValues(String code) {
|
|
|
+ final value = jsonDecode(measureData.measureLanguage)["Language"][code];
|
|
|
+ return value ?? code;
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
-class _HasSelectedModulePage extends StatelessWidget implements FWidget {
|
|
|
@override
|
|
|
FWidget build(BuildContext context) {
|
|
|
return FListView(
|
|
@@ -346,19 +348,14 @@ class _HasSelectedModulePage extends StatelessWidget implements FWidget {
|
|
|
children: [
|
|
|
FContainer(
|
|
|
padding: const EdgeInsets.only(left: 15, top: 15, bottom: 15),
|
|
|
- child:
|
|
|
- // FObx(
|
|
|
- // () {
|
|
|
- // return
|
|
|
- FWrap(
|
|
|
+ child: FWrap(
|
|
|
spacing: 16.0, // 主轴(水平)方向间距
|
|
|
runSpacing: 8.0, // 纵轴(垂直)方向间距
|
|
|
direction: Axis.horizontal,
|
|
|
crossAlignment: WrapCrossAlignment.center,
|
|
|
alignment: WrapAlignment.start,
|
|
|
children: List<FWidget>.generate(
|
|
|
- // controller.state.chooseMeasureList.length,
|
|
|
- 10,
|
|
|
+ chooseMeasureList.length,
|
|
|
(index) {
|
|
|
return FElevatedButton(
|
|
|
onPressed: () {
|
|
@@ -376,22 +373,18 @@ class _HasSelectedModulePage extends StatelessWidget implements FWidget {
|
|
|
height: 60,
|
|
|
child: FColumn(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- children: const [
|
|
|
+ children: [
|
|
|
FText(
|
|
|
- // controller.state.chooseMeasureList[index]
|
|
|
- // .toString(),
|
|
|
- '',
|
|
|
- style: TextStyle(
|
|
|
+ chooseMeasureList[index].toString(),
|
|
|
+ style: const TextStyle(
|
|
|
color: Colors.black,
|
|
|
),
|
|
|
),
|
|
|
FText(
|
|
|
- // controller.getValues(
|
|
|
- // controller.state.chooseMeasureList[index]
|
|
|
- // .toString(),
|
|
|
- '',
|
|
|
-
|
|
|
- style: TextStyle(
|
|
|
+ getValues(
|
|
|
+ chooseMeasureList[index].toString(),
|
|
|
+ ),
|
|
|
+ style: const TextStyle(
|
|
|
color: Colors.black,
|
|
|
),
|
|
|
),
|
|
@@ -401,8 +394,6 @@ class _HasSelectedModulePage extends StatelessWidget implements FWidget {
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
- // );
|
|
|
- // },
|
|
|
),
|
|
|
),
|
|
|
],
|