diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index a97b83f..fdeb18e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -227,8 +227,8 @@ }) //获取设备类别 - deviceViewModel.obtainDeviceType() - deviceViewModel.deviceTypeModel.observe(viewLifecycleOwner, { + deviceViewModel.obtainDeviceTypeData() + deviceViewModel.deviceTypeDataModel.observe(viewLifecycleOwner, { if (it.code == 200) { val xAxisLabel: MutableList = ArrayList() val barEntries: MutableList = ArrayList() diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index a97b83f..fdeb18e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -227,8 +227,8 @@ }) //获取设备类别 - deviceViewModel.obtainDeviceType() - deviceViewModel.deviceTypeModel.observe(viewLifecycleOwner, { + deviceViewModel.obtainDeviceTypeData() + deviceViewModel.deviceTypeDataModel.observe(viewLifecycleOwner, { if (it.code == 200) { val xAxisLabel: MutableList = ArrayList() val barEntries: MutableList = ArrayList() diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java new file mode 100644 index 0000000..6ac8b11 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java @@ -0,0 +1,64 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class DeviceTypeDataModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataDTO { + private String deviceType; + private String deviceCount; + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(String deviceCount) { + this.deviceCount = deviceCount; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index a97b83f..fdeb18e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -227,8 +227,8 @@ }) //获取设备类别 - deviceViewModel.obtainDeviceType() - deviceViewModel.deviceTypeModel.observe(viewLifecycleOwner, { + deviceViewModel.obtainDeviceTypeData() + deviceViewModel.deviceTypeDataModel.observe(viewLifecycleOwner, { if (it.code == 200) { val xAxisLabel: MutableList = ArrayList() val barEntries: MutableList = ArrayList() diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java new file mode 100644 index 0000000..6ac8b11 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java @@ -0,0 +1,64 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class DeviceTypeDataModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataDTO { + private String deviceType; + private String deviceCount; + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(String deviceCount) { + this.deviceCount = deviceCount; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java index e146a8f..3818728 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java @@ -5,7 +5,7 @@ public class DeviceTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,9 +41,10 @@ this.success = success; } - public static class DataDTO { + public static class DataBean { private String deviceType; - private String deviceCount; + private String name; + private String value; public String getDeviceType() { return deviceType; @@ -53,12 +54,20 @@ this.deviceType = deviceType; } - public String getDeviceCount() { - return deviceCount; + public String getName() { + return name; } - public void setDeviceCount(String deviceCount) { - this.deviceCount = deviceCount; + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index a97b83f..fdeb18e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -227,8 +227,8 @@ }) //获取设备类别 - deviceViewModel.obtainDeviceType() - deviceViewModel.deviceTypeModel.observe(viewLifecycleOwner, { + deviceViewModel.obtainDeviceTypeData() + deviceViewModel.deviceTypeDataModel.observe(viewLifecycleOwner, { if (it.code == 200) { val xAxisLabel: MutableList = ArrayList() val barEntries: MutableList = ArrayList() diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java new file mode 100644 index 0000000..6ac8b11 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java @@ -0,0 +1,64 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class DeviceTypeDataModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataDTO { + private String deviceType; + private String deviceCount; + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(String deviceCount) { + this.deviceCount = deviceCount; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java index e146a8f..3818728 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java @@ -5,7 +5,7 @@ public class DeviceTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,9 +41,10 @@ this.success = success; } - public static class DataDTO { + public static class DataBean { private String deviceType; - private String deviceCount; + private String name; + private String value; public String getDeviceType() { return deviceType; @@ -53,12 +54,20 @@ this.deviceType = deviceType; } - public String getDeviceCount() { - return deviceCount; + public String getName() { + return name; } - public void setDeviceCount(String deviceCount) { - this.deviceCount = deviceCount; + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt index 0413d42..73f6e9e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt @@ -189,10 +189,10 @@ suspend fun obtainWellTypeAndCount(@Header("token") token: String): String /** - * 获取设备类别 + * 获取设备类别数量 */ @GET("/statics/deviceStaticsByType") - suspend fun obtainDeviceType(@Header("token") token: String): String + suspend fun obtainDeviceTypeData(@Header("token") token: String): String /** * 按天获取报警 @@ -363,7 +363,7 @@ * 获取设备列表-分页 * * @param keywords 关键字 - * @param wellType 窨井类型 + * @param deviceType 窨井类型 * @param deptid 部门ID * @param limit 每页数据条数 * @param offset 页码 @@ -373,6 +373,7 @@ @Header("token") token: String, @Query("keywords") keywords: String?, @Query("deviceType") deviceType: String?, + @Query("deptid") deptid: String?, @Query("isOnline") isOnline: String?, @Query("limit") limit: Int, @Query("offset") offset: Int, @@ -381,6 +382,12 @@ ): String /** + * 获取设备类别 + */ + @GET("/device/type") + suspend fun obtainDeviceType(@Header("token") token: String): String + + /** * 获取工单详情 * * @param id 工单id diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index a97b83f..fdeb18e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -227,8 +227,8 @@ }) //获取设备类别 - deviceViewModel.obtainDeviceType() - deviceViewModel.deviceTypeModel.observe(viewLifecycleOwner, { + deviceViewModel.obtainDeviceTypeData() + deviceViewModel.deviceTypeDataModel.observe(viewLifecycleOwner, { if (it.code == 200) { val xAxisLabel: MutableList = ArrayList() val barEntries: MutableList = ArrayList() diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java new file mode 100644 index 0000000..6ac8b11 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java @@ -0,0 +1,64 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class DeviceTypeDataModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataDTO { + private String deviceType; + private String deviceCount; + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(String deviceCount) { + this.deviceCount = deviceCount; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java index e146a8f..3818728 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java @@ -5,7 +5,7 @@ public class DeviceTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,9 +41,10 @@ this.success = success; } - public static class DataDTO { + public static class DataBean { private String deviceType; - private String deviceCount; + private String name; + private String value; public String getDeviceType() { return deviceType; @@ -53,12 +54,20 @@ this.deviceType = deviceType; } - public String getDeviceCount() { - return deviceCount; + public String getName() { + return name; } - public void setDeviceCount(String deviceCount) { - this.deviceCount = deviceCount; + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt index 0413d42..73f6e9e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt @@ -189,10 +189,10 @@ suspend fun obtainWellTypeAndCount(@Header("token") token: String): String /** - * 获取设备类别 + * 获取设备类别数量 */ @GET("/statics/deviceStaticsByType") - suspend fun obtainDeviceType(@Header("token") token: String): String + suspend fun obtainDeviceTypeData(@Header("token") token: String): String /** * 按天获取报警 @@ -363,7 +363,7 @@ * 获取设备列表-分页 * * @param keywords 关键字 - * @param wellType 窨井类型 + * @param deviceType 窨井类型 * @param deptid 部门ID * @param limit 每页数据条数 * @param offset 页码 @@ -373,6 +373,7 @@ @Header("token") token: String, @Query("keywords") keywords: String?, @Query("deviceType") deviceType: String?, + @Query("deptid") deptid: String?, @Query("isOnline") isOnline: String?, @Query("limit") limit: Int, @Query("offset") offset: Int, @@ -381,6 +382,12 @@ ): String /** + * 获取设备类别 + */ + @GET("/device/type") + suspend fun obtainDeviceType(@Header("token") token: String): String + + /** * 获取工单详情 * * @param id 工单id diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt index fe17f7b..30a70c5 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt @@ -199,10 +199,10 @@ } /** - * 获取设备类别 + * 获取设备类别数量 */ - suspend fun obtainDeviceType(): String { - return api.obtainDeviceType(AuthenticationHelper.token!!) + suspend fun obtainDeviceTypeData(): String { + return api.obtainDeviceTypeData(AuthenticationHelper.token!!) } /** @@ -350,12 +350,13 @@ * 获取设备列表-分页 */ suspend fun obtainDevicePageList( - keywords: String?, deviceType: String?, isOnline: String?, offset: Int + keywords: String?, deviceType: String?, deptid: String?, isOnline: String?, offset: Int ): String { return api.obtainDevicePageList( AuthenticationHelper.token!!, keywords, deviceType, + deptid, isOnline, Constant.PAGE_LIMIT, offset, @@ -364,6 +365,13 @@ ) } + /** + * 获取设备类别 + */ + suspend fun obtainDeviceType(): String { + return api.obtainDeviceType(AuthenticationHelper.token!!) + } + // /** // * 获取工单详情 // */ diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt index a97b83f..fdeb18e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/fragment/HomePageFragment.kt @@ -227,8 +227,8 @@ }) //获取设备类别 - deviceViewModel.obtainDeviceType() - deviceViewModel.deviceTypeModel.observe(viewLifecycleOwner, { + deviceViewModel.obtainDeviceTypeData() + deviceViewModel.deviceTypeDataModel.observe(viewLifecycleOwner, { if (it.code == 200) { val xAxisLabel: MutableList = ArrayList() val barEntries: MutableList = ArrayList() diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java new file mode 100644 index 0000000..6ac8b11 --- /dev/null +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeDataModel.java @@ -0,0 +1,64 @@ +package com.casic.app.smartwell.sanxi.model; + +import java.util.List; + +public class DeviceTypeDataModel { + + private int code; + private List data; + private String message; + private boolean success; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isSuccess() { + return success; + } + + public void setSuccess(boolean success) { + this.success = success; + } + + public static class DataDTO { + private String deviceType; + private String deviceCount; + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(String deviceCount) { + this.deviceCount = deviceCount; + } + } +} diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java index e146a8f..3818728 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/model/DeviceTypeModel.java @@ -5,7 +5,7 @@ public class DeviceTypeModel { private int code; - private List data; + private List data; private String message; private boolean success; @@ -17,11 +17,11 @@ this.code = code; } - public List getData() { + public List getData() { return data; } - public void setData(List data) { + public void setData(List data) { this.data = data; } @@ -41,9 +41,10 @@ this.success = success; } - public static class DataDTO { + public static class DataBean { private String deviceType; - private String deviceCount; + private String name; + private String value; public String getDeviceType() { return deviceType; @@ -53,12 +54,20 @@ this.deviceType = deviceType; } - public String getDeviceCount() { - return deviceCount; + public String getName() { + return name; } - public void setDeviceCount(String deviceCount) { - this.deviceCount = deviceCount; + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } } } diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt index 0413d42..73f6e9e 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitService.kt @@ -189,10 +189,10 @@ suspend fun obtainWellTypeAndCount(@Header("token") token: String): String /** - * 获取设备类别 + * 获取设备类别数量 */ @GET("/statics/deviceStaticsByType") - suspend fun obtainDeviceType(@Header("token") token: String): String + suspend fun obtainDeviceTypeData(@Header("token") token: String): String /** * 按天获取报警 @@ -363,7 +363,7 @@ * 获取设备列表-分页 * * @param keywords 关键字 - * @param wellType 窨井类型 + * @param deviceType 窨井类型 * @param deptid 部门ID * @param limit 每页数据条数 * @param offset 页码 @@ -373,6 +373,7 @@ @Header("token") token: String, @Query("keywords") keywords: String?, @Query("deviceType") deviceType: String?, + @Query("deptid") deptid: String?, @Query("isOnline") isOnline: String?, @Query("limit") limit: Int, @Query("offset") offset: Int, @@ -381,6 +382,12 @@ ): String /** + * 获取设备类别 + */ + @GET("/device/type") + suspend fun obtainDeviceType(@Header("token") token: String): String + + /** * 获取工单详情 * * @param id 工单id diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt index fe17f7b..30a70c5 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/utils/retrofit/RetrofitServiceManager.kt @@ -199,10 +199,10 @@ } /** - * 获取设备类别 + * 获取设备类别数量 */ - suspend fun obtainDeviceType(): String { - return api.obtainDeviceType(AuthenticationHelper.token!!) + suspend fun obtainDeviceTypeData(): String { + return api.obtainDeviceTypeData(AuthenticationHelper.token!!) } /** @@ -350,12 +350,13 @@ * 获取设备列表-分页 */ suspend fun obtainDevicePageList( - keywords: String?, deviceType: String?, isOnline: String?, offset: Int + keywords: String?, deviceType: String?, deptid: String?, isOnline: String?, offset: Int ): String { return api.obtainDevicePageList( AuthenticationHelper.token!!, keywords, deviceType, + deptid, isOnline, Constant.PAGE_LIMIT, offset, @@ -364,6 +365,13 @@ ) } + /** + * 获取设备类别 + */ + suspend fun obtainDeviceType(): String { + return api.obtainDeviceType(AuthenticationHelper.token!!) + } + // /** // * 获取工单详情 // */ diff --git a/app/src/main/java/com/casic/app/smartwell/sanxi/view/DeviceManageActivity.kt b/app/src/main/java/com/casic/app/smartwell/sanxi/view/DeviceManageActivity.kt index 33da83c..40d95ba 100644 --- a/app/src/main/java/com/casic/app/smartwell/sanxi/view/DeviceManageActivity.kt +++ b/app/src/main/java/com/casic/app/smartwell/sanxi/view/DeviceManageActivity.kt @@ -15,9 +15,11 @@ import com.casic.app.smartwell.sanxi.extensions.show import com.casic.app.smartwell.sanxi.extensions.showEmptyPage import com.casic.app.smartwell.sanxi.model.DeviceListPageModel +import com.casic.app.smartwell.sanxi.model.OwnerShipModel import com.casic.app.smartwell.sanxi.utils.WeakReferenceHandler import com.casic.app.smartwell.sanxi.vm.AuthenticateViewModel import com.casic.app.smartwell.sanxi.vm.DeviceViewModel +import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet import kotlinx.android.synthetic.main.activity_device_manage.* import kotlinx.android.synthetic.main.include_empty_view.* import kotlinx.android.synthetic.main.include_select_title.* @@ -36,6 +38,7 @@ private var isLoadMore = false private var keywords = "" private var deviceType = "" + private var deptId = "" override fun initLayoutView(): Int = R.layout.activity_device_manage @@ -98,6 +101,44 @@ weakReferenceHandler.sendEmptyMessage(2022061601) } }) + + deviceViewModel.deviceTypeModel.observe(this, { + if (it.code == 200) { + val sheetBuilder = QMUIBottomSheet.BottomListSheetBuilder(this) + sheetBuilder.setTitle("井类型") + it.data.forEach { type -> + sheetBuilder.addItem(type.name) + } + sheetBuilder.setGravityCenter(true) + .setOnSheetItemClickListener { dialog, _, position, tag -> + deviceTypeView.text = tag + this.deviceType = it.data[position].value.toString() + + dialog.dismiss() + }.build().show() + } + }) + + authenticateViewModel.resultModel.observe(this, { + if (it.code == 200) { + val ownerShipModel: MutableList = ArrayList() + it.data?.list?.forEach { listBean -> + ownerShipModel.add(listBean) + } + val sheetBuilder = QMUIBottomSheet.BottomListSheetBuilder(this) + sheetBuilder.setTitle("权属单位") + ownerShipModel.forEach { model -> + sheetBuilder.addItem(model.name) + } + sheetBuilder.setGravityCenter(true) + .setOnSheetItemClickListener { dialog, _, position, tag -> + ownerShipView.text = tag + this.deptId = ownerShipModel[position].id.toString() + + dialog.dismiss() + }.build().show() + } + }) } override fun onDrawerSlide(drawerView: View, slideOffset: Float) { @@ -111,30 +152,30 @@ val searchButton = drawerView.findViewById