|
|
@@ -38,7 +38,9 @@ import com.xzjmyk.pm.activity.ui.erp.activity.crm.VisitReportAddActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.activity.crm.VisitReportPlanActivity;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.util.ListUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.view.EmptyLayout;
|
|
|
import com.xzjmyk.pm.activity.util.CalendarUtils;
|
|
|
import com.xzjmyk.pm.activity.util.DisplayUtil;
|
|
|
import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
@@ -87,6 +89,8 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
private ArrayList<OABean> meBeans = null;
|
|
|
private ArrayList<OABean> otherBeans = null;
|
|
|
private MyListViewAdapter adapter;
|
|
|
+ private EmptyLayout mEmptyLayout;
|
|
|
+
|
|
|
private Handler handler = new Handler() {
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
@@ -95,9 +99,10 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
switch (msg.what) {
|
|
|
case WHAT_LOAD:
|
|
|
JSONObject jsonObject = JSON.parseObject(message);
|
|
|
- if (jsonObject.isEmpty()) return;
|
|
|
+ if (jsonObject.isEmpty())
|
|
|
+ return;
|
|
|
loadSuccess(jsonObject);
|
|
|
- rootScrollView.smoothScrollTo(0, 20);
|
|
|
+ setTop();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -130,22 +135,14 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
}
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
ArrayList<OABean> chche = new ArrayList<>();
|
|
|
- int ok = 0;
|
|
|
for (OABean b : tag == 1 ? meBeans : otherBeans) {
|
|
|
String time = b.getStartdate() == null ? b.getEnddate() : b.getStartdate();
|
|
|
if (time == null) continue;
|
|
|
c.setTimeInMillis(TimeUtils.f_str_2_long(time));
|
|
|
- if (c.get(Calendar.DAY_OF_MONTH) == CalendarUtils.getCurrentDate()) {
|
|
|
+ if (c.get(Calendar.DAY_OF_MONTH) == CalendarUtils.getCurrentDate()) {//当前天的任务
|
|
|
chche.add(b);
|
|
|
- if (StringUtils.isEmpty(b.getStatus())) continue;
|
|
|
- if ("已完成".equals(b.getStatus()) || "已拜访".equals(b.getStatus())) {
|
|
|
- ok += 0;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
- all_task_num.setText("工作日历:" + chche.size());
|
|
|
- ok_task_num.setText("已完成:" + ok);
|
|
|
- uok_task_num.setText("未完成:" + (chche.size() - ok));
|
|
|
if (adapter == null) {
|
|
|
adapter = new MyListViewAdapter(chche);
|
|
|
listview.setAdapter(adapter);
|
|
|
@@ -153,7 +150,6 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
adapter.setBeans(chche);
|
|
|
}
|
|
|
setTaskDay(tag == 1 ? meBeans : otherBeans);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void setTaskDay(List<OABean> beans) {
|
|
|
@@ -162,8 +158,15 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
for (OABean b : beans) {
|
|
|
String time = b.getStartdate() == null ? b.getEnddate() : b.getStartdate();
|
|
|
if (time == null) continue;
|
|
|
- c.setTimeInMillis(TimeUtils.f_str_2_long(time));
|
|
|
- tasks.add(c.get(Calendar.DAY_OF_MONTH));
|
|
|
+ if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) {//非crm
|
|
|
+ c.setTimeInMillis(TimeUtils.f_str_2_long(time));
|
|
|
+ tasks.add(c.get(Calendar.DAY_OF_MONTH));
|
|
|
+ } else {//crm
|
|
|
+ if (b != null && b.getClient() != null) {
|
|
|
+ c.setTimeInMillis(TimeUtils.f_str_2_long(time));
|
|
|
+ tasks.add(c.get(Calendar.DAY_OF_MONTH));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
int[] t = new int[tasks.size()];
|
|
|
for (int i = 0; i < tasks.size(); i++) {
|
|
|
@@ -310,9 +313,14 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
|
|
|
private void initView() {
|
|
|
chaneTAG(true);
|
|
|
+ mEmptyLayout = new EmptyLayout(this, listview);
|
|
|
+ mEmptyLayout.setShowLoadingButton(false);
|
|
|
+ mEmptyLayout.setShowEmptyButton(false);
|
|
|
+ mEmptyLayout.setShowErrorButton(false);
|
|
|
initData();
|
|
|
setListener();
|
|
|
loadNetData();
|
|
|
+ listview.setFocusable(false);
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
|
@@ -321,7 +329,6 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
picker.setSelectMore(false);
|
|
|
adapter = new MyListViewAdapter();
|
|
|
listview.setAdapter(adapter);
|
|
|
- rootScrollView.smoothScrollTo(0, 20);
|
|
|
date_tv.setText(TimeUtils.long2str(System.currentTimeMillis(), "yyyy-MM-dd") + " " + TimeUtils.getWeek(System.currentTimeMillis()));
|
|
|
//CRM链入 隐藏菜单
|
|
|
if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) return;
|
|
|
@@ -475,16 +482,36 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
} catch (NullPointerException e) {
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
- all_task_num.setText("工作日历:" + (ok + noOk));
|
|
|
- ok_task_num.setText("已完成:" + ok);
|
|
|
- uok_task_num.setText("未完成:" + noOk);
|
|
|
adapter.setBeans(beans);
|
|
|
- rootScrollView.smoothScrollTo(0, 20);
|
|
|
+ setTop();
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void setTop() {
|
|
|
+// rootScrollView.smoothScrollTo(0, 20);
|
|
|
+// rootScrollView.scrollTo(0, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setPoithNum(List<OABean> beans) {
|
|
|
+ int ok = 0, noOk = 0;
|
|
|
+ if (!ListUtils.isEmpty(beans)) {
|
|
|
+ for (OABean b : beans) {
|
|
|
+ if (StringUtils.isEmpty(b.getStatus())) continue;
|
|
|
+ if ("已完成".equals(b.getStatus()) || "已拜访".equals(b.getStatus())) {
|
|
|
+ ok++;
|
|
|
+ } else {
|
|
|
+ noOk++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ all_task_num.setText("工作日历:" + (ok + noOk));
|
|
|
+ ok_task_num.setText("已完成:" + ok);
|
|
|
+ uok_task_num.setText("未完成:" + noOk);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 点击我和我的下属的工作日志中的标识变化
|
|
|
*
|
|
|
@@ -499,7 +526,6 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
ok_scale.setVisibility(View.GONE);
|
|
|
my_log_tag.setBackgroundResource(R.color.darkorange);
|
|
|
my_client_log_tag.setBackgroundDrawable(null);
|
|
|
- rootScrollView.smoothScrollTo(0, 20);
|
|
|
if (adapter != null && meBeans != null) {
|
|
|
adapter.setBeans(meBeans);
|
|
|
setTaskDay(meBeans);
|
|
|
@@ -514,7 +540,7 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
setTaskDay(otherBeans);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ setTop();
|
|
|
}
|
|
|
|
|
|
//列表适配器
|
|
|
@@ -525,21 +551,23 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
}
|
|
|
|
|
|
public MyListViewAdapter(List<OABean> beans) {
|
|
|
+ if (ListUtils.isEmpty(beans)) mEmptyLayout.showEmpty();
|
|
|
this.beans = getBeans(beans);
|
|
|
}
|
|
|
|
|
|
private List<OABean> getBeans(List<OABean> beans) {
|
|
|
List<OABean> chche = new ArrayList<>();
|
|
|
if (beans == null) return null;
|
|
|
- if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) {//crm
|
|
|
+ if (getIntent() == null || getIntent().getIntExtra("type", 0) != 1) {
|
|
|
chche = beans;
|
|
|
- } else {
|
|
|
+ } else {//crm
|
|
|
//只显示拜访
|
|
|
for (OABean e : beans)
|
|
|
if (e != null && e.getClient() != null) {
|
|
|
chche.add(e);
|
|
|
}
|
|
|
}
|
|
|
+ setPoithNum(chche);
|
|
|
return chche;
|
|
|
}
|
|
|
|
|
|
@@ -549,8 +577,8 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
|
|
|
public void setBeans(List<OABean> beans) {
|
|
|
this.beans = getBeans(beans);
|
|
|
+ if (ListUtils.isEmpty(beans)) mEmptyLayout.showEmpty();
|
|
|
notifyDataSetChanged();
|
|
|
- rootScrollView.smoothScrollTo(0, 20);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -604,9 +632,9 @@ public class OAActivity extends BaseActivity implements View.OnClickListener {
|
|
|
intent.putExtra("performer", CommonUtil.getSharedPreferences(ct, "erp_username"));//处理人编号
|
|
|
intent.putExtra("taskcode", chche.getTaskcode());//处理人编号
|
|
|
intent.putExtra("ra_taskid", chche.getRa_taskid());//取回复内容id
|
|
|
- intent.putExtra("taskid", chche.getTaskcode());//编号
|
|
|
+ intent.putExtra("taskid", chche.getRa_id() + "");//编号
|
|
|
intent.putExtra("endtime", chche.getEnddate());
|
|
|
- startActivity(intent);
|
|
|
+ startActivityForResult(intent, 0x20);
|
|
|
}
|
|
|
}
|
|
|
});
|