Commit 73c1812e authored by 小费同学阿's avatar 小费同学阿 💬 Committed by 杨秀秀

诉求分配 部门选择 修复

parent 4fea9f06
...@@ -45,8 +45,9 @@ class AppealDeptListAdapter(context: Context?,val selectedTypes: MutableList<Tex ...@@ -45,8 +45,9 @@ class AppealDeptListAdapter(context: Context?,val selectedTypes: MutableList<Tex
/*选择时的item 移除和添加*/ /*选择时的item 移除和添加*/
override fun itemClickCalBack(position: Int, data: TextListProvider?) { override fun itemClickCalBack(position: Int, data: TextListProvider?) {
if (data != null) { if (data != null) {
if (selectedTypes.contains(data)) { val indexOf = selectedTypes.map { item -> item.ProviderId() }.indexOf(data.ProviderId())
selectedTypes.remove(data) if (indexOf != -1) {
selectedTypes.removeAt(indexOf)
} else { } else {
selectedTypes.add(data) selectedTypes.add(data)
} }
......
...@@ -44,6 +44,7 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> { ...@@ -44,6 +44,7 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> {
public ObservableField<Integer> imgsVisibility = new ObservableField<>(View.VISIBLE); public ObservableField<Integer> imgsVisibility = new ObservableField<>(View.VISIBLE);
private List<TextListProvider> selectDept;
/*部门控件*/ /*部门控件*/
public LiveData<Integer> getDeptVisibility() { public LiveData<Integer> getDeptVisibility() {
...@@ -79,8 +80,6 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> { ...@@ -79,8 +80,6 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> {
public ObservableField<String> finalRejectionn = new ObservableField<>(""); public ObservableField<String> finalRejectionn = new ObservableField<>("");
/*上传图片*/ /*上传图片*/
public AddImgAdapter appealPicsAdapter; public AddImgAdapter appealPicsAdapter;
public List<TextListProvider> selectDept = new ArrayList<>();
//分配信息绑定 //分配信息绑定
public ObservableField<String> allocation = new ObservableField<>(""); public ObservableField<String> allocation = new ObservableField<>("");
...@@ -148,7 +147,7 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> { ...@@ -148,7 +147,7 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> {
} }
String displayLabel = displayLabelList.toString(); String displayLabel = displayLabelList.toString();
if (displayLabel.endsWith("、")) { if (displayLabel.endsWith("、")) {
displayLabel = displayLabel.substring(0, displayLabel.length() - 2); displayLabel = displayLabel.substring(0, displayLabel.length() - 1);
} }
/*label展示*/ /*label展示*/
label.set(displayLabel); label.set(displayLabel);
...@@ -159,20 +158,7 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> { ...@@ -159,20 +158,7 @@ public class AppealAllocationViewModel extends BaseViewModel<AppealRequest> {
idList.add(new DeptIdBean(Integer.parseInt(resultBean.getAllocations().get(i).getDeptId()))); idList.add(new DeptIdBean(Integer.parseInt(resultBean.getAllocations().get(i).getDeptId())));
} }
selectDept = resultBean.getAllocations().stream() selectDept = resultBean.getAllocations().stream()
.map(item -> new TextListProvider() { .map(item -> new DeptBean(new ArrayList<>(), Integer.parseInt(item.getDeptId()), false, item.getDeptName())).collect(Collectors.toList());
@androidx.annotation.NonNull
@Override
public String providerText() {
return item.getDeptName();
}
@androidx.annotation.NonNull
@Override
public String ProviderId() {
return item.getDeptId();
}
})
.collect(Collectors.toList());
} }
@Override @Override
......
...@@ -167,19 +167,7 @@ public class AppealEditViewModel extends BaseViewModel<AppealRequest> { ...@@ -167,19 +167,7 @@ public class AppealEditViewModel extends BaseViewModel<AppealRequest> {
idList.add(new DeptIdBean(Integer.parseInt(resultBean.getAllocations().get(i).getDeptId()))); idList.add(new DeptIdBean(Integer.parseInt(resultBean.getAllocations().get(i).getDeptId())));
} }
selectDept = resultBean.getAllocations().stream() selectDept = resultBean.getAllocations().stream()
.map(item -> new TextListProvider() { .map(item -> new DeptBean(new ArrayList<>(), Integer.parseInt(item.getDeptId()), false, item.getDeptName()))
@androidx.annotation.NonNull
@Override
public String providerText() {
return item.getDeptName();
}
@androidx.annotation.NonNull
@Override
public String ProviderId() {
return item.getDeptId();
}
})
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
......
...@@ -82,8 +82,7 @@ public class AppealViewModel extends BaseViewModel<AppealRequest> { ...@@ -82,8 +82,7 @@ public class AppealViewModel extends BaseViewModel<AppealRequest> {
public ObservableField<String> appealDescribe = new ObservableField<>(""); public ObservableField<String> appealDescribe = new ObservableField<>("");
/*上传图片*/ /*上传图片*/
public AddImgAdapter appealPicsAdapter; public AddImgAdapter appealPicsAdapter;
private List<TextListProvider> selectDept = new ArrayList<>();
public List<TextListProvider> selectDept=new ArrayList<>();
public AppealViewModel(@NonNull Application application) { public AppealViewModel(@NonNull Application application) {
super(application); super(application);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment