import 'package:get/get.dart'; import 'base.dart'; // String projCode = 'CJGKJEBYYB'; // String tid = "109"; // String projType = "hydraulic_tamping"; String projCode = 'TEST'; String tid = "1000"; String projType = "pile_cm"; BaseService service = BaseService(); class ProjController extends GetxController { ProjController(); // 道路边线 Future getSideLine() async { Map res = await service.getClient( '/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType'); return res['data']; } // 设备绑定 --- 获取设备 Future getDeviceBind() async { Map res = await service.getClient( '/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode'); return res['data']; } // 项目列表 getproject() async { Map res = await service.getClient( '/api/sys/project/list?org_code=a&proj_type=$projType&proj_code=$projCode'); return res['data']; } } class LoginController { // 验证码 getsmsCode(String phone) async { Map res = await service.postClient("/admin/base/open/smsCode", {"phone": phone}); return res; } // 手机号登录 phoneLogin(String phone, String smsCode) async { Map res = await service.postClient( "/admin/base/open/phone", {"phone": phone, "smsCode": smsCode}); return res; } // 获取用户信息 getPerson() async { Map res = await service.getClient("/admin/base/comm/person"); return res['data']; } // 验证码 getCaptcha() async { Map res = await service.getClient("/admin/base/open/captcha?height=40&width=150"); return res['data']; } getAccountLogin(String captchaId, String password, String username, String verifyCode) async { Map res = await service.postClient("/admin/base/open/login", { "captchaId": captchaId, "password": password, "username": username, "verifyCode": verifyCode }); return res; } } class PileCmController { //获取水泥搅拌桩点数据 getRcordData(int page, int size, String date, [String sort = "desc", String order = "pile_id"]) async { Map res = await service.getClient( "/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&tid=$tid&date=$date&sort=$sort&order=$order"); return res['data']; } getRcordList(String date, String? dateEnd) async { dateEnd ??= date; Map res = await service.getClient( "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd"); return res['data']; } //获取施工记录的日期 getworkDateData() async { Map res = await service.getClient( "/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid"); if (res['code'] == 1000) { return res['data'] ?? []; } else { return []; } } //施工详细记录 getProcessData(int pileId) async { Map res = await service.getClient( "/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid"); return res['data']; } } class GetServices { BaseService service = BaseService(); // String projCode = 'CJGKJEBYYB'; // int tid = 109; // String projType = "hydraulic_tamping"; String projCode = 'TEST'; int tid = 1000; String projType = "pile_cm"; // 道路边线 Future getSideLine() async { try { Map res = await service.getClient( '/api/comm/side_line/list?proj_code=$projCode&proj_type=$projType'); return res['data']; } catch (e) { return {}; } } // 设备绑定 --- 获取设备 Future getDeviceBind() async { Map res = await service.getClient( '/api/sys/device_bind/list?proj_type=$projType&proj_code=$projCode'); return res['data']; } // 项目列表 getproject() async { Map res = await service .getClient('/api/sys/project/list?org_code=a&proj_type=$projType'); return res['data']; } // 液压夯 getRcordData(int page, int size, String date, [String sort = "desc", String order = "tp_id"]) async { Map res = await service.getClient( "/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&tid=$tid&date=$date&sort=$sort&order=$order"); return res['data']; } //获取水泥搅拌桩点数据 // getRcordData(int page, int size, String date, // [String sort = "desc", String order = "pile_id"]) async { // Map res = await service.getClient( // "/api/$projType/record/page?page=$page&size=$size&org_code=a&proj_code=$projCode&tid=$tid&date=$date&sort=$sort&order=$order"); // return res['data']; // } // getRcordList(String date, String? dateEnd) async { // dateEnd ??= date; // Map res = await service.getClient( // "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd"); // return res['data']; // } getRcordList(String date, [String? dateEnd]) async { dateEnd ??= date; Map res = await service.getClient( "/api/$projType/record/list?org_code=a&proj_code=$projCode&tid=$tid&date=$date&dateEnd=$dateEnd"); if (res['code'] == 1000) { return res['data']; } else { return []; } } //获取施工记录的日期 getworkDateData() async { Map res = await service.getClient( "/api/$projType/record/work_date?org_code=a&proj_code=$projCode&tid=$tid"); if (res['code'] == 1000) { return res['data'] ?? []; } else { return []; } } //施工详细记录 getProcessData(int pileId) async { Map res = await service.getClient( "/api/$projType/process/list?pile_id=$pileId&proj_code=$projCode&tid=$tid"); return res['data']; } // 验证码 getsmsCode(String phone) async { Map res = await service.postClient("/admin/base/open/smsCode", {"phone": phone}); return res; } // 手机号登录 phoneLogin(String phone, String smsCode) async { Map res = await service.postClient( "/admin/base/open/phone", {"phone": phone, "smsCode": smsCode}); return res; } // 获取用户信息 getPerson() async { Map res = await service.getClient("/admin/base/comm/person"); return res['data']; } // 验证码 getCaptcha() async { Map res = await service.getClient("/admin/base/open/captcha?height=40&width=150"); return res['data']; } getAccountLogin(String captchaId, String password, String username, String verifyCode) async { Map res = await service.postClient("/admin/base/open/login", { "captchaId": captchaId, "password": password, "username": username, "verifyCode": verifyCode }); return res; } getRtuLast() async { Map res = await service.getClient( "/api/t2n/rtu/rtu_last?proj_type=$projType&proj_code=$projCode"); return res['data']; } getCoordTrans() async { Map res = await service.getClient( "/api/comm/coord_trans/list?proj_type=$projType&proj_code=$projCode"); return res['data']; } }