|
...
|
...
|
@@ -76,110 +76,50 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { |
|
|
|
emptyImg: "table_manage_empty",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
)
|
|
|
|
: ReorderableListView(
|
|
|
|
children: <Widget>[
|
|
|
|
for (Area item in tableManagerModel.areas)
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7))),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
//修改区域弹框
|
|
|
|
await DialogUtil
|
|
|
|
.openTableManageCreateAreaDialog(
|
|
|
|
context,
|
|
|
|
title: '修改区域',
|
|
|
|
content: item.name,
|
|
|
|
onTap: (value) async {
|
|
|
|
print(value);
|
|
|
|
//添加区域
|
|
|
|
bool success = await tableManagerModel
|
|
|
|
.setTableRegionById(
|
|
|
|
context, value, item.rid);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('修改成功!');
|
|
|
|
tableManagerModel.currentArea = value;
|
|
|
|
|
|
|
|
// TableManagerModel tableManagerModel1 =
|
|
|
|
// Provider.of<TableManagerModel>(
|
|
|
|
// context,
|
|
|
|
// listen: false);
|
|
|
|
// tableManagerModel1.getTableList(
|
|
|
|
// context,
|
|
|
|
// needLoading: false,
|
|
|
|
// );
|
|
|
|
|
|
|
|
await tableManagerModel
|
|
|
|
.refreshTable(context);
|
|
|
|
EventBus().emit("refresh_table_area");
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context,
|
|
|
|
// needLoading: false);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
|
|
|
|
// setState(() {
|
|
|
|
// updateMenu();
|
|
|
|
// });
|
|
|
|
// _scrollToIndex(widget
|
|
|
|
// .tableManagerModel
|
|
|
|
// .areas
|
|
|
|
// .length);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text(item.name,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_000000,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(32))))),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
title: "",
|
|
|
|
content: "是否确定删除该区域",
|
|
|
|
lTitle: "取消",
|
|
|
|
rTitle: "确认删除",
|
|
|
|
isBold: true,
|
|
|
|
isBoldContent: true,
|
|
|
|
rColor: MyColours.color_E34D59,
|
|
|
|
lCallback: () {
|
|
|
|
print("取消");
|
|
|
|
}, rCallback: () async {
|
|
|
|
: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
vertical: ScreenUtil().setWidth(54)),
|
|
|
|
child: ReorderableListView(
|
|
|
|
children: <Widget>[
|
|
|
|
for (Area item in tableManagerModel.areas)
|
|
|
|
Container(
|
|
|
|
key: ValueKey(item),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(16),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7))),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: InkWell(
|
|
|
|
highlightColor: MyColours.color_ffffff,
|
|
|
|
onTap: () async {
|
|
|
|
//修改区域弹框
|
|
|
|
await DialogUtil
|
|
|
|
.openTableManageCreateAreaDialog(context,
|
|
|
|
title: '修改区域', content: item.name,
|
|
|
|
onTap: (value) async {
|
|
|
|
print(value);
|
|
|
|
//添加区域
|
|
|
|
bool success = await tableManagerModel
|
|
|
|
.delTableRegion(context, item.rid);
|
|
|
|
.setTableRegionById(
|
|
|
|
context, value, item.rid);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('删除成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
|
|
// tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
// Timer(
|
|
|
|
// Duration(milliseconds: 500),
|
|
|
|
// () => _areaController.jumpTo(
|
|
|
|
// _areaController.position.maxScrollExtent));
|
|
|
|
Utils.showToast('修改成功!');
|
|
|
|
tableManagerModel.currentArea = value;
|
|
|
|
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
// TableManagerModel tableManagerModel =
|
|
|
|
// Provider.of<TableManagerModel>(context,
|
|
|
|
// TableManagerModel tableManagerModel1 =
|
|
|
|
// Provider.of<TableManagerModel>(
|
|
|
|
// context,
|
|
|
|
// listen: false);
|
|
|
|
// tableManagerModel.getTableList(
|
|
|
|
// tableManagerModel1.getTableList(
|
|
|
|
// context,
|
|
|
|
// needLoading: false,
|
|
|
|
// );
|
|
...
|
...
|
@@ -187,27 +127,104 @@ class _MyAreaManagePageState extends State<MyAreaManagePage> { |
|
|
|
await tableManagerModel
|
|
|
|
.refreshTable(context);
|
|
|
|
EventBus().emit("refresh_table_area");
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context,
|
|
|
|
// needLoading: false);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
|
|
|
|
// setState(() {
|
|
|
|
// updateMenu();
|
|
|
|
// });
|
|
|
|
// _scrollToIndex(widget
|
|
|
|
// .tableManagerModel
|
|
|
|
// .areas
|
|
|
|
// .length);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text('删除',
|
|
|
|
child: Text(item.name,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
fontSize: ScreenUtil().setSp(32))))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
onReorder: (int oldIndex, int newIndex) {
|
|
|
|
if (oldIndex < newIndex) {
|
|
|
|
newIndex -= 1;
|
|
|
|
}
|
|
|
|
var child = tableManagerModel.areas.removeAt(oldIndex);
|
|
|
|
tableManagerModel.areas.insert(newIndex, child);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
color: MyColours.color_000000,
|
|
|
|
fontSize: ScreenUtil().setSp(32))),
|
|
|
|
)),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
title: "",
|
|
|
|
content: "是否确定删除该区域",
|
|
|
|
lTitle: "取消",
|
|
|
|
rTitle: "确认删除",
|
|
|
|
isBold: true,
|
|
|
|
isBoldContent: true,
|
|
|
|
rColor: MyColours.color_E34D59,
|
|
|
|
lCallback: () {
|
|
|
|
print("取消");
|
|
|
|
}, rCallback: () async {
|
|
|
|
bool success = await tableManagerModel
|
|
|
|
.delTableRegion(context, item.rid);
|
|
|
|
print(success);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('删除成功!');
|
|
|
|
// TableOuter tableOuter = TableOuter();
|
|
|
|
// tableOuter.name = value;
|
|
|
|
// tableOuter.list = [];
|
|
|
|
// tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// tableManagerModel.initData();
|
|
|
|
// Timer(
|
|
|
|
// Duration(milliseconds: 500),
|
|
|
|
// () => _areaController.jumpTo(
|
|
|
|
// _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// await tableManagerModel
|
|
|
|
// .getTableList(context);
|
|
|
|
// await tableManagerModel
|
|
|
|
// .initData();
|
|
|
|
// TableManagerModel tableManagerModel =
|
|
|
|
// Provider.of<TableManagerModel>(context,
|
|
|
|
// listen: false);
|
|
|
|
// tableManagerModel.getTableList(
|
|
|
|
// context,
|
|
|
|
// needLoading: false,
|
|
|
|
// );
|
|
|
|
|
|
|
|
await tableManagerModel
|
|
|
|
.refreshTable(context);
|
|
|
|
EventBus().emit("refresh_table_area");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Text('删除',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
fontSize: ScreenUtil().setSp(32))))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
onReorder: (int oldIndex, int newIndex) async {
|
|
|
|
if (oldIndex < newIndex) {
|
|
|
|
newIndex -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
var childold = tableManagerModel.areas[oldIndex];
|
|
|
|
Map<String, String> params = {
|
|
|
|
'sid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
'regionid': childold.rid,
|
|
|
|
'order_o': tableManagerModel.areas[newIndex].orderId,
|
|
|
|
'sort': oldIndex < newIndex ? '2' : '1'
|
|
|
|
};
|
|
|
|
var child = tableManagerModel.areas.removeAt(oldIndex);
|
|
|
|
tableManagerModel.areas.insert(newIndex, child);
|
|
|
|
setState(() {});
|
|
|
|
await tableManagerModel.sortByRegion(context, params);
|
|
|
|
//刷新前一页数据
|
|
|
|
bus.emit('refresh_table_area');
|
|
|
|
},
|
|
|
|
));
|
|
|
|
|
|
|
|
// ListView.builder(
|
|
|
|
// padding: EdgeInsets.symmetric(
|
...
|
...
|
|