提交 9f0f65f5 authored 作者: lgd's avatar lgd

1.添加部门,接口地址需修改

2.//TODO erp用户是否选择新部门为空,质检接口数据无对应问题,内部交易订单审核,审核规则,领用申请列表/退件列表/参数,坩埚下单,mes,刷新token
上级 b0561b7e
...@@ -735,6 +735,22 @@ ...@@ -735,6 +735,22 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Work.Base" android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.login.UserRegisterDepAddActivity"
android:configChanges="keyboardHidden|orientation"
android:label="添加部门"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.login.UserRegisterDepActivity"
android:configChanges="keyboardHidden|orientation"
android:label="选择部门"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity <activity
android:name=".ui.activity.bat.work.WorkChooseProductActivity" android:name=".ui.activity.bat.work.WorkChooseProductActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
......
package com.wd.workoffice.bean.event;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class AddDepEvent {
public AddDepEvent() {
}
}
...@@ -139,6 +139,13 @@ public interface ApiService { ...@@ -139,6 +139,13 @@ public interface ApiService {
*/ */
@GET("/open/sys/dept/list") @GET("/open/sys/dept/list")
Observable<BaseBean> depList(); Observable<BaseBean> depList();
/**
* 部门列表
*
* @return
*/
@POST("/sys/dept")
Observable<BaseBean> addDep(@Body RequestBody requestBody);
/** /**
* 根据权限 获取生产厂 * 根据权限 获取生产厂
......
package com.wd.workoffice.ui.activity.login;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.DepBean;
import com.wd.workoffice.bean.event.AddDepEvent;
import com.wd.workoffice.bean.event.CheckAddStockEvent;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.activity.bat.order.SendApplyAddActivity;
import com.wd.workoffice.ui.adapter.WorkChooseDepAdapter;
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.NonNull;
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 UserRegisterDepActivity extends WorkToolBarActivity {
@BindView(R.id.rv_data)
RecyclerView rvData;
@BindView(R.id.srl_refresh)
SmartRefreshLayout srlRefresh;
private List<DepBean> dataList;
private WorkChooseDepAdapter dataAdapter;
@Override
protected void initView() {
ButterKnife.bind(this);
rvData.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
}
@Override
protected void initData() {
dataList = new ArrayList<>();
dataAdapter = new WorkChooseDepAdapter(R.layout.item_store_client, dataList);
dataAdapter.bindToRecyclerView(rvData);
getData();
}
private void getData() {
RtfUtils.getRtf().depList().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);
srlRefresh.finishRefresh();
dataList.clear();
dataList.addAll(getList);
dataAdapter.notifyDataSetChanged();
}
});
}
@Override
protected void initEvent() {
srlRefresh.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
srlRefresh.finishRefresh();
}
});
dataAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
Intent intent = new Intent();
intent.putExtra("depName", dataList.get(position).getName());
intent.putExtra("depId", dataList.get(position).getId());
setResult(10001, intent);
finish();
}
});
}
@Override
protected int layoutId() {
return R.layout.activity_register_dep;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_add, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.add:
startActivity(UserRegisterDepAddActivity.class);
break;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onStart() {
super.onStart();
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
}
@Subscribe
public void refresh(AddDepEvent event) {
getData();
}
}
package com.wd.workoffice.ui.activity.login;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import android.widget.TextView;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.event.AddDepEvent;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.activity.bat.order.SendApplyAddActivity;
import com.wd.workoffice.util.DialogUtils;
import com.wd.workoffice.util.WorkUtils;
import org.greenrobot.eventbus.EventBus;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
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 UserRegisterDepAddActivity extends WorkToolBarActivity {
@BindView(R.id.tv_type)
TextView tvType;
@BindView(R.id.et_name)
EditText etName;
@BindView(R.id.et_code)
EditText etCode;
private String[] type = new String[]{"生产部门", "销售部门", "业务部门"};
private Map<String, Object> param;
private QMUIDialog.MenuDialogBuilder typeDialog;
private int chooseType;
@Override
protected void initView() {
ButterKnife.bind(this);
typeDialog = DialogUtils.listDialog(this);
typeDialog.addItems(type, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
chooseType = which+1;
tvType.setText(type[which]);
dialog.dismiss();
}
});
}
@Override
protected void initData() {
param = WorkUtils.simpleParam();
}
private void submit() {
if (chooseType == 0) {
toast("请选择类型");
return;
}
String name = etName.getText().toString();
String code = etCode.getText().toString();
if (TextUtils.isEmpty(name)) {
toast("请填写部门名称");
return;
}
if (TextUtils.isEmpty(code)) {
toast("请填写code");
return;
}
param.put("type", chooseType);
param.put("name", name);
param.put("code", code);
RtfUtils.getRtf().addDep(WorkUtils.convertMapToBody(param)).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;
}
EventBus.getDefault().post(new AddDepEvent());
toast("添加成功");
finish();
}
});
}
@Override
protected void initEvent() {
}
@Override
protected int layoutId() {
return R.layout.activity_register_dep_add;
}
@OnClick(R.id.tv_type)
public void onViewClicked() {
typeDialog.show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_finish, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.finish:
submit();
break;
}
return super.onOptionsItemSelected(item);
}
}
package com.wd.workoffice.ui.activity.login; package com.wd.workoffice.ui.activity.login;
import android.content.Intent;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
...@@ -14,12 +15,15 @@ import com.wd.workoffice.app.WorkToolBarActivity; ...@@ -14,12 +15,15 @@ import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.DepBean; import com.wd.workoffice.bean.DepBean;
import com.wd.workoffice.contract.UserRegisterThreeContract; import com.wd.workoffice.contract.UserRegisterThreeContract;
import com.wd.workoffice.presenter.UserRegisterThreePresenter; import com.wd.workoffice.presenter.UserRegisterThreePresenter;
import com.wd.workoffice.ui.activity.bat.store.StoreSaleClientActivity;
import com.wd.workoffice.util.UserKeeper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
...@@ -48,6 +52,7 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us ...@@ -48,6 +52,7 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us
private List<String> depNameList = new ArrayList<>(); private List<String> depNameList = new ArrayList<>();
private int chooseDep = -1; private int chooseDep = -1;
private AlertDialog.Builder builder; private AlertDialog.Builder builder;
private Integer depId;
@Override @Override
protected void initView() { protected void initView() {
...@@ -113,25 +118,26 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us ...@@ -113,25 +118,26 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us
public void onViewClicked(View view) { public void onViewClicked(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.ll_product: case R.id.ll_product:
if (builder == null) { // if (builder == null) {
toast("正在加载部门,请稍等"); // toast("正在加载部门,请稍等");
return; // return;
} // }
builder.show(); // builder.show();
startActivityForResult(UserRegisterDepActivity.class, 10001);
break; break;
case R.id.btn_submit: case R.id.btn_submit:
if (chooseDep == -1) { if (depId == null) {
toast("请选择部门"); toast("请选择部门");
return; return;
} }
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("userName",getIntent().getStringExtra("name") ); param.put("userName", getIntent().getStringExtra("name"));
param.put("password", getIntent().getStringExtra("pwd")); param.put("password", getIntent().getStringExtra("pwd"));
param.put("nickName",etName.getText().toString() ) ; param.put("nickName", etName.getText().toString());
param.put("email", etEmail.getText().toString()); param.put("email", etEmail.getText().toString());
param.put("phone", getIntent().getStringExtra("phone")); param.put("phone", getIntent().getStringExtra("phone"));
// param.put("erpId", ""); // param.put("erpId", "");
param.put("deptId", depList.get(chooseDep).getId()); param.put("deptId", depId);
param.put("verifyCode", getIntent().getStringExtra("code")); param.put("verifyCode", getIntent().getStringExtra("code"));
userRegisterThreePresenter.register(param); userRegisterThreePresenter.register(param);
break; break;
...@@ -164,4 +170,15 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us ...@@ -164,4 +170,15 @@ public class UserRegisterThreeActivity extends WorkToolBarActivity implements Us
} }
initDialog(); initDialog();
} }
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 10001 && resultCode == 10001) {
String depName = data.getStringExtra("depName");
depId = data.getIntExtra("id", 0);
tvProductContent.setText(depName);
}
}
} }
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="4mm" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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="@android:color/white"
android:orientation="vertical"
android:paddingHorizontal="20mm">
<TextView
android:id="@+id/tv_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="10mm"
android:layout_marginTop="20mm"
android:text="选择部门类别" />
<View style="@style/dividerX" />
<EditText
android:id="@+id/et_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:textSize="14sp"
android:paddingVertical="10mm"
android:hint="创建部门名称" />
<View style="@style/dividerX" />
<EditText
android:id="@+id/et_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:textSize="14sp"
android:paddingVertical="10mm"
android:hint="填写部门唯一code,不要与已有code重复" />
<View style="@style/dividerX" />
</LinearLayout>
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10mm" android:padding="10mm"
android:text="选择生产者" android:text="选择部门"
android:textSize="16sp" /> android:textSize="16sp" />
<TextView <TextView
......
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/finish"
android:title="完成"
app:showAsAction="always" />
</menu>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论