|
|
@@ -79,10 +79,10 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
private int mPageIndex = 1, mPageSize = 25;
|
|
|
private List<DataInquiryFlexBean> mDeviceQueryFlexBeans;
|
|
|
private DataInquiryFlexAdapter mDeviceQueryFlexAdapter;
|
|
|
- private List<DataInquiryFlexBean.RowBean.RowChildBean> mAllRowChildBeans;
|
|
|
+ private List<DataInquiryFlexBean.RowBean.RowChildBean> mRowChildBeans, mAllRowChildBeans;
|
|
|
private String mFuzzyField = "";
|
|
|
private int mOldPosition = -1;
|
|
|
- private String mCaller = "Device", mClass;
|
|
|
+ private String mCaller = "Device", mClass, mWhichPage;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -137,12 +137,17 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
if (intent != null) {
|
|
|
mCaller = intent.getStringExtra(Constants.FLAG.DEVICE_CALLER);
|
|
|
mClass = intent.getStringExtra(Constants.FLAG.DEVICE_CLASS);
|
|
|
+ mWhichPage = intent.getStringExtra(Constants.FLAG.DEVICE_WHICH_PAGE);
|
|
|
}
|
|
|
|
|
|
if (TextUtils.isEmpty(mCaller)) {
|
|
|
mCaller = "Device";
|
|
|
}
|
|
|
|
|
|
+ if (TextUtils.isEmpty(mWhichPage)) {
|
|
|
+ mWhichPage = Constants.FLAG.DEVICE_FROM_QUERY;
|
|
|
+ }
|
|
|
+
|
|
|
if (!TextUtils.isEmpty(mClass)) {
|
|
|
String dc_class = "dc_class";
|
|
|
// if (mCaller != null && mCaller.equals("DeviceChange!Maintain")) {
|
|
|
@@ -197,36 +202,37 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
@Override
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
int reallyPosition = (int) parent.getItemIdAtPosition(position);
|
|
|
- List<DataInquiryFlexBean.RowBean> rowBeans = mDeviceQueryFlexAdapter.getObjects().get(reallyPosition).getRowBeans();
|
|
|
- String keyValue = null, status = null;
|
|
|
- for (DataInquiryFlexBean.RowBean rowBean : rowBeans) {
|
|
|
- List<DataInquiryFlexBean.RowBean.RowChildBean> rowChildBeans = rowBean.getRowChildBeans();
|
|
|
- for (DataInquiryFlexBean.RowBean.RowChildBean rowChildBean : rowChildBeans) {
|
|
|
+ if (Constants.FLAG.DEVICE_FROM_COMMON.equals(mWhichPage)) {
|
|
|
+ String keyValue = null, status = null;
|
|
|
+ List<DataInquiryFlexBean.RowBean.RowChildBean> childBeans = mDeviceQueryFlexAdapter.getRowChildBeans().get(reallyPosition);
|
|
|
+ for (DataInquiryFlexBean.RowBean.RowChildBean rowChildBean : childBeans) {
|
|
|
if ("dc_id".equals(rowChildBean.getField())) {
|
|
|
keyValue = rowChildBean.getValue();
|
|
|
}
|
|
|
if ("dc_status".equals(rowChildBean.getField())) {
|
|
|
status = rowChildBean.getValue();
|
|
|
}
|
|
|
+ if (keyValue != null && status != null) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- if (keyValue != null && status != null) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- startActivity(new Intent(mContext, CommonDocDetailsActivity.class)
|
|
|
- .putExtra("caller", mCaller)
|
|
|
- .putExtra("keyValue", keyValue)
|
|
|
- .putExtra("device", true)
|
|
|
- .putExtra("status", status));
|
|
|
- /*if (CommonUtil.isRepeatClick()) {
|
|
|
- if (mOldPosition == reallyPosition) {
|
|
|
- mDeviceQueryFlexAdapter.getObjects().get(reallyPosition).setIsFlex(!mDeviceQueryFlexAdapter.getObjects().get(reallyPosition).isFlex());
|
|
|
- mDeviceQueryFlexAdapter.notifyDataSetChanged();
|
|
|
- } else {
|
|
|
- mOldPosition = reallyPosition;
|
|
|
+ startActivity(new Intent(mContext, CommonDocDetailsActivity.class)
|
|
|
+ .putExtra("caller", mCaller)
|
|
|
+ .putExtra("keyValue", keyValue)
|
|
|
+ .putExtra("device", true)
|
|
|
+ .putExtra("status", status));
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (CommonUtil.isRepeatClick()) {
|
|
|
+ if (mOldPosition == reallyPosition) {
|
|
|
+ mDeviceQueryFlexAdapter.getObjects().get(reallyPosition).setIsFlex(!mDeviceQueryFlexAdapter.getObjects().get(reallyPosition).isFlex());
|
|
|
+ mDeviceQueryFlexAdapter.notifyDataSetChanged();
|
|
|
+ } else {
|
|
|
+ mOldPosition = reallyPosition;
|
|
|
+ }
|
|
|
}
|
|
|
+ mOldPosition = reallyPosition;
|
|
|
}
|
|
|
- mOldPosition = reallyPosition;*/
|
|
|
}
|
|
|
});
|
|
|
mDataListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
|
|
|
@@ -547,15 +553,15 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
JSONObject columnsObject = columnsArray.getJSONObject(i);
|
|
|
if (columnsObject != null) {
|
|
|
int width = JSONUtil.getInt(columnsObject, "width");
|
|
|
- if (width > 0) {
|
|
|
- SchemeConditionBean columnsConditionBean = new SchemeConditionBean();
|
|
|
- columnsConditionBean.setCaption(JSONUtil.getText(columnsObject, "caption"));
|
|
|
- columnsConditionBean.setField(JSONUtil.getText(columnsObject, "dataIndex"));
|
|
|
- columnsConditionBean.setWidth(JSONUtil.getInt(columnsObject, "width"));
|
|
|
- columnsConditionBean.setType(JSONUtil.getText(columnsObject, "type"));
|
|
|
-
|
|
|
- columnsConditionBeans.add(columnsConditionBean);
|
|
|
- }
|
|
|
+// if (width > 0) {
|
|
|
+ SchemeConditionBean columnsConditionBean = new SchemeConditionBean();
|
|
|
+ columnsConditionBean.setCaption(JSONUtil.getText(columnsObject, "caption"));
|
|
|
+ columnsConditionBean.setField(JSONUtil.getText(columnsObject, "dataIndex"));
|
|
|
+ columnsConditionBean.setWidth(JSONUtil.getInt(columnsObject, "width"));
|
|
|
+ columnsConditionBean.setType(JSONUtil.getText(columnsObject, "type"));
|
|
|
+
|
|
|
+ columnsConditionBeans.add(columnsConditionBean);
|
|
|
+// }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -593,7 +599,9 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
/**
|
|
|
* 列表数据解析
|
|
|
*/
|
|
|
+ List<List<DataInquiryFlexBean.RowBean.RowChildBean>> rowChildBeans = new ArrayList<>();
|
|
|
for (int i = 0; i < listdataArray.size(); i++) {
|
|
|
+ mRowChildBeans = new ArrayList<>();
|
|
|
mAllRowChildBeans = new ArrayList<>();
|
|
|
JSONObject listdataObject = listdataArray.getJSONObject(i);
|
|
|
if (listdataObject != null) {
|
|
|
@@ -603,6 +611,7 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
List<DataInquiryFlexBean.RowBean> rowBeans = new ArrayList<>();
|
|
|
|
|
|
for (int j = 0; j < columnsConditionBeans.size(); j++) {
|
|
|
+ int width = columnsConditionBeans.get(j).getWidth();
|
|
|
String field = columnsConditionBeans.get(j).getField();
|
|
|
String type = columnsConditionBeans.get(j).getType();
|
|
|
String caption = columnsConditionBeans.get(j).getCaption();
|
|
|
@@ -614,21 +623,25 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
rowChildBean.setCaption(caption);
|
|
|
rowChildBean.setValue(value);
|
|
|
rowChildBean.setField(field);
|
|
|
- rowChildBean.setWidth(columnsConditionBeans.get(j).getWidth());
|
|
|
+ rowChildBean.setWidth(width);
|
|
|
|
|
|
mAllRowChildBeans.add(rowChildBean);
|
|
|
+ if (width > 0) {
|
|
|
+ mRowChildBeans.add(rowChildBean);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ rowChildBeans.add(mAllRowChildBeans);
|
|
|
|
|
|
- for (int k = 0; k < mAllRowChildBeans.size(); k++) {
|
|
|
+ for (int k = 0; k < mRowChildBeans.size(); k++) {
|
|
|
DataInquiryFlexBean.RowBean rowBean = new DataInquiryFlexBean.RowBean();
|
|
|
|
|
|
List<DataInquiryFlexBean.RowBean.RowChildBean> childBeans = new ArrayList<>();
|
|
|
|
|
|
- DataInquiryFlexBean.RowBean.RowChildBean rowChildBean1 = mAllRowChildBeans.get(k);
|
|
|
+ DataInquiryFlexBean.RowBean.RowChildBean rowChildBean1 = mRowChildBeans.get(k);
|
|
|
childBeans.add(rowChildBean1);
|
|
|
- if (rowChildBean1.getWidth() <= 100 && k < (mAllRowChildBeans.size() - 1)) {
|
|
|
- DataInquiryFlexBean.RowBean.RowChildBean rowChildBean2 = mAllRowChildBeans.get(k + 1);
|
|
|
+ if (rowChildBean1.getWidth() <= 100 && k < (mRowChildBeans.size() - 1)) {
|
|
|
+ DataInquiryFlexBean.RowBean.RowChildBean rowChildBean2 = mRowChildBeans.get(k + 1);
|
|
|
if (rowChildBean2.getWidth() <= 100) {
|
|
|
childBeans.add(rowChildBean2);
|
|
|
k++;
|
|
|
@@ -640,10 +653,10 @@ public class DeviceQueryActivity extends BaseMVPActivity<WorkPlatPresenter> impl
|
|
|
rowBeans.add(rowBean);
|
|
|
}
|
|
|
deviceQueryFlexBean.setRowBeans(rowBeans);
|
|
|
-
|
|
|
mDeviceQueryFlexBeans.add(deviceQueryFlexBean);
|
|
|
}
|
|
|
}
|
|
|
+ mDeviceQueryFlexAdapter.setRowChildBeans(rowChildBeans);
|
|
|
mDeviceQueryFlexAdapter.notifyDataSetChanged();
|
|
|
} catch (Exception e) {
|
|
|
mDeviceQueryFlexAdapter.notifyDataSetChanged();
|