|
|
@@ -29,6 +29,7 @@ import com.lidroid.xutils.ViewUtils;
|
|
|
import com.lidroid.xutils.view.annotation.ViewInject;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
import com.xzjmyk.pm.activity.ui.base.BaseActivity;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.model.Employee;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.model.Employees;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
|
|
|
@@ -48,6 +49,7 @@ import java.util.regex.Pattern;
|
|
|
|
|
|
/**
|
|
|
* Created by FANGlh on 2016/10/24.
|
|
|
+ * @注释:商机分配同事选择
|
|
|
*/
|
|
|
|
|
|
public class DbfindList2Activity extends BaseActivity{
|
|
|
@@ -120,6 +122,8 @@ public class DbfindList2Activity extends BaseActivity{
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ private String selectName;
|
|
|
+ private String selectId;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
@@ -171,34 +175,44 @@ public class DbfindList2Activity extends BaseActivity{
|
|
|
init();
|
|
|
}
|
|
|
});
|
|
|
- listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
- @Override
|
|
|
- public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
- Employees select = adapter.getUsers().get(i - 1 < 0 ? 0 : (i - 1));
|
|
|
- //判断进入单选分流
|
|
|
- if (isSingle) {//单选
|
|
|
- // 获取适配器中全部列表
|
|
|
- list = adapter.getUsers();
|
|
|
- // 将pot(记录上个选择的索引)保存为当选选择的索引
|
|
|
- int pot = i - 1 < 0 ? 0 : (i - 1);
|
|
|
- //判断有没有点击选择过
|
|
|
- if(pot==i){
|
|
|
- //设置上一次选择的isClcick为false
|
|
|
- list.get(pot).setClick(true);
|
|
|
- }else{
|
|
|
- if (adapter.getUsers() == null) return;
|
|
|
- Employees entity = select;
|
|
|
- Intent intent = new Intent();
|
|
|
- intent.putExtra("data", entity);
|
|
|
- //setResult(0x11, intent);
|
|
|
- //设置当前选择的isClcick为true
|
|
|
- select.setClick(!select.isClick());
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
- }
|
|
|
- }
|
|
|
- adapter.notifyDataSetChanged();
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
+ Employees select = adapter.getUsers().get(i - 1 < 0 ? 0 : (i - 1));
|
|
|
+ if (isSingle) { // 已默认单选
|
|
|
+ setClickSingle(i);
|
|
|
+ DistributionSelectAdapter.ViewHolder viewHolder = (DistributionSelectAdapter.ViewHolder) view.getTag();
|
|
|
+ selectName = viewHolder.name_tv.getText().toString();
|
|
|
+ selectId = viewHolder.id_tv.getText().toString();
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (adapter.getUsers() == null) return;
|
|
|
+ select.setClick(!select.isClick());
|
|
|
+ adapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ int pot=-1;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单选方法封装
|
|
|
+ * @param item
|
|
|
+ */
|
|
|
+ private void setClickSingle(int item){
|
|
|
+ int i =item -1<0 ? 0 :(item-1);
|
|
|
+ if(adapter == null || adapter.getUsers() == null) return;
|
|
|
+
|
|
|
+ List<Employees> lists = adapter.getUsers();
|
|
|
+ if(pot !=-1&&lists.size()>pot) //被选择过
|
|
|
+ {
|
|
|
+ lists.get(pot).setClick(false);
|
|
|
+ }
|
|
|
+ lists.get(i).setClick(true);
|
|
|
+ adapter.setUsers(lists);
|
|
|
+ pot = i;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//正则
|
|
|
@@ -322,7 +336,7 @@ public class DbfindList2Activity extends BaseActivity{
|
|
|
}
|
|
|
|
|
|
private void selectOK() {
|
|
|
- /* boolean isme = getIntent().getBooleanExtra("isme", false);
|
|
|
+
|
|
|
//选择人员成功操作
|
|
|
ArrayList<Employees> list = new ArrayList<>();
|
|
|
|
|
|
@@ -330,14 +344,11 @@ public class DbfindList2Activity extends BaseActivity{
|
|
|
finish();
|
|
|
return;
|
|
|
}
|
|
|
- DistributionSelectAdapter.ViewHolder viewHolder = (DistributionSelectAdapter.ViewHolder) view.getTag();
|
|
|
Intent intent = new Intent();
|
|
|
- intent.putExtra("en_name", viewHolder.name_tv.getText().toString());
|
|
|
- intent.putExtra("en_code", viewHolder.id_tv.getText().toString());
|
|
|
+ intent.putExtra("en_name", selectName);
|
|
|
+ intent.putExtra("en_code", selectId);
|
|
|
DbfindList2Activity.this.setResult(2, intent);
|
|
|
DbfindList2Activity.this.finish();
|
|
|
- finish();*/
|
|
|
-
|
|
|
- Toast.makeText(getApplication(), "确定按钮监听到了", Toast.LENGTH_SHORT).show();
|
|
|
+ finish();
|
|
|
}
|
|
|
}
|