|
...
|
...
|
@@ -10,22 +10,22 @@ import 'package:one_key/net/http_url.dart'; |
|
|
|
/**
|
|
|
|
* 常用备注管理
|
|
|
|
*/
|
|
|
|
class RemarkManagerModel extends ChangeNotifier{
|
|
|
|
|
|
|
|
List<Remark> remarks=[];//所有备注
|
|
|
|
class RemarkManagerModel extends ChangeNotifier {
|
|
|
|
List<Remark> remarks = []; //所有备注
|
|
|
|
List<Remark> ofenRemarks = []; //常用备注
|
|
|
|
|
|
|
|
PageState pageState = PageState.Loading;
|
|
|
|
|
|
|
|
|
|
|
|
//获取备注
|
|
|
|
getRemarks(BuildContext context, Map<String, String> params,{bool showPageLoading=false}) async {
|
|
|
|
if(showPageLoading){
|
|
|
|
getRemarks(BuildContext context, Map<String, String> params,
|
|
|
|
{bool showPageLoading = false}) async {
|
|
|
|
if (showPageLoading) {
|
|
|
|
pageState = PageState.Loading;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
BaseResp<List> baseResp = await DioUtil()
|
|
|
|
.request<List>(context, Method.get, HttpUrl.get_custom_remark,
|
|
|
|
data: params, showLoading: showPageLoading?false:true)
|
|
|
|
data: params, showLoading: showPageLoading ? false : true)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
|
|
if (error is MyError) {
|
|
...
|
...
|
@@ -47,6 +47,12 @@ class RemarkManagerModel extends ChangeNotifier{ |
|
|
|
remarks = baseResp.data.map<Remark>((value) {
|
|
|
|
return Remark.fromJson(value);
|
|
|
|
}).toList();
|
|
|
|
ofenRemarks = [];
|
|
|
|
for (Remark item in remarks) {
|
|
|
|
if (item.oftenUse != '') {
|
|
|
|
ofenRemarks.add(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (remarks.isEmpty) {
|
|
|
|
pageState = PageState.Empty;
|
|
|
|
} else {
|
|
...
|
...
|
@@ -60,22 +66,21 @@ class RemarkManagerModel extends ChangeNotifier{ |
|
|
|
Future addRemark(BuildContext context, Map<String, String> params) async {
|
|
|
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
|
|
.request<dynamic>(context, Method.get, HttpUrl.add_custom_remark,
|
|
|
|
data: params, showLoading: false)
|
|
|
|
data: params, showLoading: false)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
|
|
});
|
|
|
|
return ;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//删除备注
|
|
|
|
delRemark(BuildContext context, Map<String, String> params) async {
|
|
|
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
|
|
.request<dynamic>(context, Method.get, HttpUrl.del_custom_remark,
|
|
|
|
data: params, showLoading: false)
|
|
|
|
data: params, showLoading: false)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
|
|
});
|
|
|
|
if (baseResp != null && baseResp.code == Constant.status_success) {
|
|
|
|
}
|
|
|
|
if (baseResp != null && baseResp.code == Constant.status_success) {}
|
|
|
|
}
|
|
|
|
} |
|
|
\ No newline at end of file |
|
|
|
} |
...
|
...
|
|