提交 cf2adcff authored 作者: lgd's avatar lgd

1.首页改版

2.//TODO ,质检接口数据无对应问题,内部交易订单审核,审核规则,领用申请列表/退件列表/参数,坩埚下单,mes其他页面,mes质量反馈,编辑任务担当无法修改.支数参数
上级 0e20943b
...@@ -5,10 +5,27 @@ import org.greenrobot.eventbus.EventBus; ...@@ -5,10 +5,27 @@ import org.greenrobot.eventbus.EventBus;
import flexible.xd.android_base.model.event.LoginEvent; import flexible.xd.android_base.model.event.LoginEvent;
import flexible.xd.android_base.network.rtfhttp.observer.ISubscriber; import flexible.xd.android_base.network.rtfhttp.observer.ISubscriber;
import io.reactivex.Observer; import io.reactivex.Observer;
import retrofit2.HttpException;
public abstract class WorkObserver<T> extends flexible.xd.android_base.network.rtfhttp.observer.BaseObserver<T> implements Observer<T>, ISubscriber<T> { public abstract class WorkObserver<T> extends flexible.xd.android_base.network.rtfhttp.observer.BaseObserver<T> implements Observer<T>, ISubscriber<T> {
@Override @Override
public void network401() { public void network401() {
EventBus.getDefault().post(new LoginEvent()); EventBus.getDefault().post(new LoginEvent());
} }
@Override
public void onError(Throwable e) {
if (e instanceof HttpException) {
HttpException httpException = (HttpException) e;
if (httpException.code() == 401) {//一般用于判断登录状态
network401();
} else if (httpException.code() == 403) {
onFail("没有权限处理");
} else {
onFail("服务器异常,请稍后再试");
}
} else {
onFail("获取失败,请检查网络状态");
}
}
} }
...@@ -171,4 +171,4 @@ public class MesChooseClientActivity extends WorkToolBarActivity { ...@@ -171,4 +171,4 @@ public class MesChooseClientActivity extends WorkToolBarActivity {
public void refresh(AddUserDataEvent event) { public void refresh(AddUserDataEvent event) {
finish(); finish();
} }
} }
\ No newline at end of file
package com.wd.workoffice.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.DepBean;
import com.wd.workoffice.bean.OrderBean;
import java.util.List;
/**
* Created by flexible on 2018/8/13.
*/
public class DepAdapter extends BaseQuickAdapter<DepBean, BaseViewHolder> {
public DepAdapter(int layoutResId, List data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, DepBean item) {
helper.setText(R.id.tv_name, item.getName());
helper.setText(R.id.tv_desc, item.getName().concat("基本信息"));
}
}
package com.wd.workoffice.ui.fg; package com.wd.workoffice.ui.fg;
import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.android.material.tabs.TabLayout;
import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.wd.workoffice.R; import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean; import com.wd.workoffice.app.BaseBean;
...@@ -28,7 +30,6 @@ import com.wd.workoffice.ui.activity.bat.order.sale.SaleProductOrderActivity; ...@@ -28,7 +30,6 @@ import com.wd.workoffice.ui.activity.bat.order.sale.SaleProductOrderActivity;
import com.wd.workoffice.ui.activity.bat.order.sale.SaleSaleOrderActivity; import com.wd.workoffice.ui.activity.bat.order.sale.SaleSaleOrderActivity;
import com.wd.workoffice.ui.activity.bat.order.sale.SaleSupplierOrderActivity; import com.wd.workoffice.ui.activity.bat.order.sale.SaleSupplierOrderActivity;
import com.wd.workoffice.ui.activity.bat.store.StoreCrucibleActivity; import com.wd.workoffice.ui.activity.bat.store.StoreCrucibleActivity;
import com.wd.workoffice.ui.activity.bat.store.StoreFinancialActivity;
import com.wd.workoffice.ui.activity.bat.store.StoreFinancialAddActivity; import com.wd.workoffice.ui.activity.bat.store.StoreFinancialAddActivity;
import com.wd.workoffice.ui.activity.bat.store.StoreOutsourcingActivity; import com.wd.workoffice.ui.activity.bat.store.StoreOutsourcingActivity;
import com.wd.workoffice.ui.activity.bat.store.StoreSaleActivity; import com.wd.workoffice.ui.activity.bat.store.StoreSaleActivity;
...@@ -42,6 +43,7 @@ import com.wd.workoffice.ui.activity.bat.work.WorkInStockActivity; ...@@ -42,6 +43,7 @@ import com.wd.workoffice.ui.activity.bat.work.WorkInStockActivity;
import com.wd.workoffice.ui.activity.bat.work.WorkProActivity; import com.wd.workoffice.ui.activity.bat.work.WorkProActivity;
import com.wd.workoffice.ui.activity.bat.work.WorkWarehouseActivity; import com.wd.workoffice.ui.activity.bat.work.WorkWarehouseActivity;
import com.wd.workoffice.ui.adapter.BatLayoutAdapter; import com.wd.workoffice.ui.adapter.BatLayoutAdapter;
import com.wd.workoffice.ui.adapter.VpDataAdapter;
import com.wd.workoffice.util.UserKeeper; import com.wd.workoffice.util.UserKeeper;
import com.wd.workoffice.util.WorkUtils; import com.wd.workoffice.util.WorkUtils;
...@@ -49,8 +51,11 @@ import java.util.ArrayList; ...@@ -49,8 +51,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; import butterknife.OnClick;
...@@ -99,6 +104,15 @@ public class MainFragment extends WorkBaseFg { ...@@ -99,6 +104,15 @@ public class MainFragment extends WorkBaseFg {
TextView tvMore; TextView tvMore;
@BindView(R.id.tv_notice) @BindView(R.id.tv_notice)
TextView tvNotice; TextView tvNotice;
@BindView(R.id.tl_tab)
TabLayout tlTab;
@BindView(R.id.vp_data)
ViewPager vpData;
private String tab[] = {
"销售", "外采购", "供应", "财税", "坩埚", "内部交易"};
private String status[] = {
"1", "2", "3", "4", "5", "6"};
private FragmentManager sfm;
@Override @Override
protected void initView() { protected void initView() {
...@@ -113,9 +127,29 @@ public class MainFragment extends WorkBaseFg { ...@@ -113,9 +127,29 @@ public class MainFragment extends WorkBaseFg {
initRvLayout(rvApproval, approvalList); initRvLayout(rvApproval, approvalList);
initRvLayout(rvWork, workList); initRvLayout(rvWork, workList);
initRvLayout(rvProduct, productList); initRvLayout(rvProduct, productList);
} tlTab.setupWithViewPager(vpData);
tlTab.setTabMode(TabLayout.MODE_FIXED);
sfm = getChildFragmentManager();
List<Fragment> data = new ArrayList<>();
for (int i = 0; i < tab.length; i++) {
MainListFragment saleFragment = new MainListFragment();
Bundle bundle = new Bundle();
bundle.putString("status", status[i]);
saleFragment.setArguments(bundle);
data.add(saleFragment);
}
VpDataAdapter vpFgAdapter = new VpDataAdapter(sfm, data);
vpData.setAdapter(vpFgAdapter);
for (int i = 0; i < tab.length; i++) {
tlTab.getTabAt(i).setText(tab[i]);
}
}
@Override
public void onStart() {
super.onStart();
}
// @Nullable // @Nullable
// @Override // @Override
// public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { // public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
...@@ -168,7 +202,6 @@ public class MainFragment extends WorkBaseFg { ...@@ -168,7 +202,6 @@ public class MainFragment extends WorkBaseFg {
} }
} }
}); });
} }
......
package com.wd.workoffice.ui.fg;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkBaseFg;
import com.wd.workoffice.bean.DepBean;
import com.wd.workoffice.bean.OrderBean;
import com.wd.workoffice.bean.event.CheckOrderEvent;
import com.wd.workoffice.bean.workEnum.PermissionType;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.activity.bat.order.CrucibleOrderDetailActivity;
import com.wd.workoffice.ui.adapter.DepAdapter;
import com.wd.workoffice.ui.adapter.SaleCruibleAdapter;
import com.wd.workoffice.util.WorkUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class MainListFragment extends WorkBaseFg {
@BindView(R.id.rv_data)
RecyclerView rvData;
private String status;
private DepAdapter dataAdapter;
private List<DepBean> dataList;
String permission;
@Override
protected void initView() {
ButterKnife.bind(this, getContentView());
rvData.setLayoutManager(new LinearLayoutManager(getActivity(), RecyclerView.VERTICAL, false));
}
@Override
protected void initData() {
switch (status) {
case "1":
permission = PermissionType.ES_SELL.getCode();
break;
case "2":
permission = PermissionType.PURCHASE_SELL.getCode();
break;
case "3":
permission = PermissionType.SUPPLY_SELL.getCode();
break;
case "4":
break;
case "5":
permission = PermissionType.CRUCIBLE_SELL.getCode();
break;
case "6":
permission = PermissionType.INSIDE_SELL.getCode();
break;
}
dataList = new ArrayList<>();
dataAdapter = new DepAdapter(R.layout.item_main_dep, dataList);
dataAdapter.bindToRecyclerView(rvData);
dataAdapter.setEmptyView(R.layout.view_empty_content, rvData);
dataAdapter.notifyDataSetChanged();
if (!TextUtils.equals("4", status)) {
getData();
} else {
DepBean depBean =new DepBean();
depBean.setName("申请财税");
dataList.add(depBean);
dataAdapter.notifyDataSetChanged();
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle arguments = getArguments();
if (arguments != null) {
status = arguments.getString("status");
}
}
private void getData() {
RtfUtils.getRtf().getDepByPermission(permission).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
List<DepBean> getList = JSON.parseArray(data.getData().toString(), DepBean.class);
dataList.clear();
dataList.addAll(getList);
dataAdapter.notifyDataSetChanged();
}
});
}
@Override
protected void initEvent() {
dataAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
}
});
}
@Override
protected int layoutId() {
return R.layout.fg_main_dep;
}
}
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/srl_refresh" android:id="@+id/srl_refresh"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -16,8 +17,9 @@ ...@@ -16,8 +17,9 @@
android:background="@color/white" /> android:background="@color/white" />
<androidx.core.widget.NestedScrollView <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout <LinearLayout
...@@ -81,7 +83,7 @@ ...@@ -81,7 +83,7 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8mm"> android:layout_marginVertical="8mm">
<View <View
android:layout_width="6mm" android:layout_width="6mm"
...@@ -94,15 +96,35 @@ ...@@ -94,15 +96,35 @@
android:id="@+id/tv_notice" android:id="@+id/tv_notice"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="36mm" android:layout_marginLeft="36mm" />
/>
</RelativeLayout> </RelativeLayout>
<View style="@style/ViewX" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tl_tab"
android:layout_width="match_parent"
android:layout_height="40mm"
android:background="@android:color/white"
app:tabBackground="@android:color/white"
app:tabGravity="fill"
app:tabIndicatorColor="#FFFBD249"
app:tabIndicatorFullWidth="false"
app:tabMode="fixed"
app:tabSelectedTextColor="#FFFBD249"
app:tabTextAppearance="@style/tabText"
app:tabTextColor="@color/flexible_text_sup" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/vp_data"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
> android:visibility="gone">
<TextView <TextView
android:id="@+id/tv_store" android:id="@+id/tv_store"
...@@ -188,6 +210,6 @@ ...@@ -188,6 +210,6 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </LinearLayout>
</LinearLayout> </LinearLayout>
</com.scwang.smartrefresh.layout.SmartRefreshLayout> </com.scwang.smartrefresh.layout.SmartRefreshLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_data"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20mm">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/main_dep" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16mm"
android:orientation="vertical">
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="销售一公司"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6mm"
android:text="出售各种保护渣出售各种保护渣出售各种保护渣出售各种保护渣出售各种保护渣出售…"
android:textColor="@color/flexible_text_sup"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<View
style="@style/dividerX"
android:paddingHorizontal="20mm" />
</LinearLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论