import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:amos_flutter_ui/amos_flutter_ui.dart';
import 'package:jcs_airport/services/api.dart';
import 'package:jcs_airport/view/common/base_choose_department.dart';
import 'package:jcs_airport/view/common/tree_view.dart';

///@Description     选择jcs部门树
///@author          helinlin
///@create          2021-09-13 11:41
/*
class ChooseDepartmentJcsTree extends BaseTreeChoose {
   ChooseDepartmentJcsTree({Map chooseDepartment}) : super(chooseDepartment: chooseDepartment);

  @override
  BaseTreeChooseState getBaseBaseChooseDepartmentState() => _ChooseDepartmentJcsTreeState();
}

class _ChooseDepartmentJcsTreeState extends BaseTreeChooseState {
  @override
  Future<void> getData() async {
    Future.delayed(Duration.zero, () async {
      MsgBox.showProgressDialog(context, content: '加载中，请稍后...');
      var data = await API.getDepartmentTree();
      Get.back();
      setState(() {
        if (data != null) {
          departments.addAll(data);
        }
      });
    });
  }

  @override
  String getIdKey() => 'value';

  @override
  String getNameKey() => 'name';
}
*/

class ChooseDepartmentJcsTree extends StatefulWidget {
  final Map chooseDepartment;

  const ChooseDepartmentJcsTree({Key key, this.chooseDepartment}) : super(key: key);

  @override
  _ChooseDepartmentJcsTreeState createState() => _ChooseDepartmentJcsTreeState();
}

class _ChooseDepartmentJcsTreeState extends ChooseTreeState<ChooseDepartmentJcsTree> {
  @override
  Future getData() => API.getDepartmentTree();

  @override
  String getKey() => 'value';

  @override
  String getName() => 'name';
}
