Browse Source

提交类型 编写功能
提交内容 编写客户模块功能,添加选择IP地址功能

Bitliker 7 years ago
parent
commit
b5cba1509b

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/me/MeFragment.java

@@ -307,7 +307,7 @@ public class MeFragment extends EasyFragment implements View.OnClickListener, On
         findViewById(R.id.editInfoIv).setOnLongClickListener(new View.OnLongClickListener() {
             @Override
             public boolean onLongClick(View view) {
-                startActivity(new Intent(ct, DataFormDetailActivity.class).putExtra("caller", "ProjectBusinessChance"));
+                startActivity(new Intent(ct, CustomerVisitActivity.class).putExtra("caller", "ProjectBusinessChance"));
                 return false;
             }
         });

+ 2 - 0
app_core/common/src/main/java/com/core/app/Constants.java

@@ -566,8 +566,10 @@ public class Constants {
 
     public interface Intents{
         String CALLER="mCaller";
+        String CONDITION="mCondition";
         String ID="mId";
         String TITLE="mTitlte";
         String HASHMAP="hashMap";
+        String FIELD_CONFIG="fieldConfig";
     }
 }

+ 3 - 2
app_modular/apputils/src/main/java/com/modular/apputils/activity/BillInputActivity.java

@@ -89,8 +89,9 @@ public class BillInputActivity extends OABaseActivity implements IBill {
             }
         }, 2000);
     }
+
     //TODO  重写方法实现自定义的初始化
-    public  void init() {
+    public void init() {
         mBillPresenter = newBillPresenter();
         mBillPresenter.start(getIntent());
     }
@@ -109,7 +110,7 @@ public class BillInputActivity extends OABaseActivity implements IBill {
         return super.onCreateOptionsMenu(menu);
     }
 
-    private void toDataFormList() {
+    public void toDataFormList() {
         startActivity(new Intent("com.modular.work.OA.erp.activity.form.FormListSelectActivity")
                 .putExtra("caller", mBillPresenter.getFormCaller())
                 .putExtra("statusKey", mBillPresenter.getStatusField())//传状态key

+ 1 - 1
app_modular/apputils/src/main/java/com/modular/apputils/presenter/BillPresenter.java

@@ -94,7 +94,7 @@ public class BillPresenter extends BaseNetPresenter {
             mCaller = intent.getStringExtra(Constants.Intents.CALLER);
             String mTitle = intent.getStringExtra(Constants.Intents.TITLE);
             mId = intent.getIntExtra(Constants.Intents.ID, 0);
-            Serializable mSerializable = intent.getSerializableExtra(Constants.Intents.ID);
+            Serializable mSerializable = intent.getSerializableExtra(Constants.Intents.HASHMAP);
             if (mSerializable != null && mSerializable instanceof HashMap) {
                 hashMap = (HashMap<String, String>) mSerializable;
             }

+ 1 - 0
app_modular/appworks/src/main/AndroidManifest.xml

@@ -527,6 +527,7 @@
         <activity android:name=".activity.businessManage.BusinessRankListActivity" />
         <activity android:name=".activity.businessManage.businessMineList.BusinessMineListActivity" />
         <activity android:name=".activity.businessManage.businessStage.BusinessStageActivity" />
+        <activity android:name=".crm3_0.activity.BillSearchActivity" />
     </application>
 
 </manifest>

+ 1 - 0
app_modular/appworks/src/main/java/com/uas/appworks/adapter/BillListAdapter.java

@@ -30,6 +30,7 @@ public class BillListAdapter extends RecyclerView.Adapter<BillListAdapter.ViewHo
     public void updateGroupModels(List<BillListGroupModel> groupModels) {
         this.groupModels = groupModels;
         changeFieldsList();
+        notifyDataSetChanged();
     }
 
     public List<BillListGroupModel> getGroupModels() {

+ 261 - 0
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/BillSearchActivity.java

@@ -0,0 +1,261 @@
+package com.uas.appworks.crm3_0.activity;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.Toolbar;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.view.View;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.common.LogUtil;
+import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
+import com.common.data.StringUtil;
+import com.core.app.Constants;
+import com.core.app.MyApplication;
+import com.core.base.OABaseActivity;
+import com.core.utils.CommonUtil;
+import com.core.utils.StatusBarUtil;
+import com.core.widget.listener.EditChangeListener;
+import com.me.network.app.http.Method;
+import com.modular.apputils.listener.OnSmartHttpListener;
+import com.modular.apputils.model.BillListGroupModel;
+import com.modular.apputils.network.Parameter;
+import com.modular.apputils.network.Tags;
+import com.modular.apputils.utils.UUHttpHelper;
+import com.modular.apputils.widget.MenuVoiceSearchView;
+import com.module.recyclerlibrary.ui.refresh.BaseRefreshLayout;
+import com.module.recyclerlibrary.ui.refresh.EmptyRecyclerView;
+import com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout;
+import com.uas.appworks.R;
+import com.uas.appworks.adapter.BillListAdapter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BillSearchActivity extends OABaseActivity {
+    private final int TAG_KEY_WORD = 0x12;
+    private final int LOAD_LIST_DATA = 0x11;
+    private final int PAGE_SIZE = 20;
+
+    private SimpleRefreshLayout mRefreshLayout;
+    private RecyclerView mRecyclerView;
+    private UUHttpHelper mUUHttpHelper;
+    private int mPageIndex = 1;
+    private String mCaller;
+    private String mMustCondition;
+    private ArrayList<String> fieldConfig;
+    private String lastKeyWord;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_bill_search);
+        initView();
+    }
+
+    @Override
+    public int getToolBarId() {
+        return R.id.mToolbar;
+    }
+
+    @Override
+    public boolean needNavigation() {
+        return false;
+    }
+
+    private void initView() {
+        Intent intent = getIntent();
+        if (intent != null) {
+            mCaller = intent.getStringExtra(Constants.Intents.CALLER);
+            mMustCondition = intent.getStringExtra(Constants.Intents.CONDITION);
+            fieldConfig = intent.getStringArrayListExtra(Constants.Intents.FIELD_CONFIG);
+            String mTitle = intent.getStringExtra(Constants.Intents.TITLE);
+            if (mTitle != null) {
+                setTitle(mTitle);
+            }
+        }
+        mUUHttpHelper = new UUHttpHelper(CommonUtil.getAppBaseUrl(MyApplication.getInstance()));
+        final MenuVoiceSearchView mVoiceSearchView = (MenuVoiceSearchView) findViewById(R.id.mVoiceSearchView);
+        Toolbar mToolbar = (Toolbar) findViewById(R.id.mToolbar);
+        StatusBarUtil.setPaddingSmart(this, mToolbar);
+        mRefreshLayout = (SimpleRefreshLayout) findViewById(R.id.mSimpleRefreshLayout);
+        EmptyRecyclerView mEmptyRecyclerView = (EmptyRecyclerView) findViewById(R.id.mEmptyRecyclerView);
+        findViewById(R.id.backImg).setOnClickListener(mOnClickListener);
+        mRecyclerView = mEmptyRecyclerView.getRecyclerView();
+        mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
+        mRefreshLayout.setOnRefreshListener(new BaseRefreshLayout.onRefreshListener() {
+            @Override
+            public void onRefresh() {
+                loadData(TextUtils.isEmpty(mVoiceSearchView.getText()) ? "" : mVoiceSearchView.getText().toString());
+            }
+
+            @Override
+            public void onLoadMore() {
+                mPageIndex++;
+                loadData(TextUtils.isEmpty(mVoiceSearchView.getText()) ? "" : mVoiceSearchView.getText().toString());
+            }
+        });
+        mVoiceSearchView.addTextChangedListener(new EditChangeListener() {
+            @Override
+            public void afterTextChanged(Editable editable) {
+                mPageIndex = 1;
+                loadData(TextUtils.isEmpty(editable) ? "" : editable.toString());
+            }
+        });
+        showLoading();
+        loadData(null);
+    }
+
+    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View view) {
+            if (view.getId() == R.id.backImg) {
+                onBackPressed();
+            }
+        }
+    };
+
+
+    private void loadData(String keyWord) {
+        if (keyWord == null) {
+            keyWord = "";
+        }
+        this.lastKeyWord = keyWord;
+        StringBuilder builder = new StringBuilder(mMustCondition);
+        if (!TextUtils.isEmpty(keyWord) && !ListUtils.isEmpty(fieldConfig)) {
+            builder.append(" and ( ");
+            for (String e : fieldConfig) {
+                builder.append("upper(" + e + ") like '%" + keyWord.toUpperCase() + "%' or ");
+            }
+            if (builder.length() > 3) {
+                builder.delete(builder.length() - 3, builder.length() - 1);
+            }
+            builder.append(" )");
+        }
+        LogUtil.i("gong", "builder=" + builder.toString());
+        mUUHttpHelper.requestCompanyHttp(new Parameter.Builder()
+                .record(LOAD_LIST_DATA)
+                .addParams("caller", mCaller)
+                .addParams("condition", builder.toString())
+                .mode(Method.GET)
+                .addTag(TAG_KEY_WORD, keyWord)
+                .addParams("page", mPageIndex)
+                .addParams("pageSize", PAGE_SIZE)
+                .url("mobile/common/list.action"), mOnSmartHttpListener);
+    }
+
+    private OnSmartHttpListener mOnSmartHttpListener = new OnSmartHttpListener() {
+        @Override
+        public void onSuccess(int what, String message, Tags tag) throws Exception {
+            JSONObject object = JSON.parseObject(message);
+            switch (what) {
+                case LOAD_LIST_DATA:
+                    if (tag.get(TAG_KEY_WORD) != null && tag.get(TAG_KEY_WORD) instanceof String) {
+                        String keyWord = (String) tag.get(TAG_KEY_WORD);
+                        if (keyWord.equals(lastKeyWord)) {
+                            handlerListData(object);
+                        }
+                    }
+                    break;
+            }
+            mRefreshLayout.stopRefresh();
+            dimssLoading();
+        }
+
+        @Override
+        public void onFailure(int what, String message, Tags tag) throws Exception {
+            LogUtil.i("gong", "onFailure=" + message);
+            dimssLoading();
+        }
+    };
+
+    private void handlerListData(JSONObject object) throws Exception {
+        JSONArray columns = JSONUtil.getJSONArray(object, "columns");
+        JSONArray listdata = JSONUtil.getJSONArray(object, "listdata");
+        String keyField = JSONUtil.getText(object, "keyField");
+        String pfField = JSONUtil.getText(object, "pfField");
+        List<BillListGroupModel> groupModels = null;
+        if (!ListUtils.isEmpty(columns) && !ListUtils.isEmpty(listdata)) {
+            groupModels = new ArrayList<>();
+            int index = -1;
+            for (int i = 0; i < listdata.size(); i++) {
+                List<BillListGroupModel.BillListField> billListFields = null;
+                BillListGroupModel groupModel = new BillListGroupModel();
+                JSONObject data = listdata.getJSONObject(i);
+                int id = JSONUtil.getInt(data, keyField);
+                String status = JSONUtil.getText(data, "cu_auditstatus");
+
+                for (int j = 0; j < columns.size(); j++) {
+                    JSONObject column = columns.getJSONObject(j);
+                    if (JSONUtil.getInt(column, "width") > 0) {
+                        if (billListFields == null) {
+                            billListFields = new ArrayList<>();
+                            index++;
+                        }
+                        String caption = JSONUtil.getText(column, "caption");
+                        String dataIndex = JSONUtil.getText(column, "dataIndex");
+                        String values = JSONUtil.getText(data, dataIndex);
+                        BillListGroupModel.BillListField billListField = new BillListGroupModel.BillListField();
+                        billListField.setId(id);
+                        billListField.setStatus(status);
+                        billListField.setCaption(caption);
+                        billListField.setField(dataIndex);
+                        billListField.setValue(values);
+                        billListField.setGroupIndex(index);
+                        groupModel.setGroupIndex(index);
+                        billListFields.add(billListField);
+                    }
+                }
+                if (!ListUtils.isEmpty(billListFields)) {
+                    groupModel.setBillFields(billListFields);
+                    groupModels.add(groupModel);
+                }
+            }
+        } else if (mPageIndex > 1) {
+            mPageIndex--;
+        }
+        setAdapter(groupModels);
+    }
+
+    private BillListAdapter mListAdapter;
+
+    private void setAdapter(List<BillListGroupModel> groupModels) {
+        if (mListAdapter == null) {
+            mListAdapter = new BillListAdapter(ct, groupModels, new BillListAdapter.OnAdapterListener() {
+                @Override
+                public void onClick(BillListGroupModel.BillListField field) {
+                    if (field.getStatus().equals("在录入")) {
+                        startActivity(new Intent(ct, CustomerBillInputActivity.class)
+                                .putExtra(Constants.Intents.CALLER, mCaller)
+                                .putExtra(Constants.Intents.TITLE, getToolBarTitle())
+                                .putExtra(Constants.Intents.ID, field.getId()));
+                    } else {
+                        startActivity(new Intent(ct, CustomerDetails3_0Activity.class)
+                                .putExtra(Constants.Intents.CALLER, mCaller)
+                                .putExtra(Constants.Intents.TITLE, getToolBarTitle())
+                                .putExtra(Constants.Intents.ID, field.getId()));
+                    }
+
+                }
+            });
+            mRecyclerView.setAdapter(mListAdapter);
+        } else {
+            List<BillListGroupModel> showModels = mListAdapter.getGroupModels();
+            if (mPageIndex <= 1) {
+                showModels = groupModels;
+            } else {
+                if (showModels == null) {
+                    showModels = new ArrayList<>();
+                }
+                showModels.addAll(groupModels);
+            }
+            mListAdapter.updateGroupModels(showModels);
+        }
+    }
+}

+ 3 - 11
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/CustomerBillInputActivity.java

@@ -24,17 +24,9 @@ public class CustomerBillInputActivity extends BillInputActivity {
         return new CustomerBillInputAdapter(ct, groupModels, mOnAdapterListener);
     }
 
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        if (item.getItemId() == R.id.saveAndSubmit) {
-            if (item.getTitle().equals("提交")) {
-                mBillPresenter.saveAndSubmit(mBillAdapter.getBillGroupModels());
-            }
-        } else if (item.getItemId() == R.id.list) {
-            startActivity(new Intent(ct, CustomerListActivity.class)
-                    .putExtra(Constants.Intents.TITLE, getToolBarTitle()));
-        }
-        return super.onOptionsItemSelected(item);
+    public void toDataFormList() {
+        startActivity(new Intent(ct, CustomerListActivity.class)
+                .putExtra(Constants.Intents.TITLE, getToolBarTitle()));
     }
 
     @Override

+ 16 - 19
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/CustomerVisitActivity.java

@@ -1,5 +1,6 @@
 package com.uas.appworks.crm3_0.activity;
 
+import android.os.Bundle;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.util.SparseArray;
@@ -12,16 +13,19 @@ import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.common.LogUtil;
 import com.common.config.BaseConfig;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
+import com.core.base.BaseActivity;
 import com.core.utils.CommonUtil;
 import com.me.network.app.http.Method;
 import com.modular.apputils.activity.BaseNetActivity;
 import com.modular.apputils.listener.OnSmartHttpListener;
 import com.modular.apputils.network.Parameter;
 import com.modular.apputils.network.Tags;
+import com.modular.apputils.utils.UUHttpHelper;
 import com.modular.apputils.widget.DivideRadioGroup;
 import com.modular.apputils.widget.compactcalender.CompactCalendarView;
 import com.module.recyclerlibrary.ui.refresh.EmptyRecyclerView;
@@ -38,7 +42,7 @@ import java.util.TimeZone;
 /**
  * CRM 3.0 客户拜访界面(拜访计划)
  */
-public class CustomerVisitActivity extends BaseNetActivity {
+public class CustomerVisitActivity extends BaseActivity {
     private final int LOAD_DATA = 0x11;
     private final int TAG_DATE = 0x13;//记录获取的值对象,比如(20181101 表示2018-11 我的数据 20181102 表示2018-11 我的下属数据)
 
@@ -50,26 +54,18 @@ public class CustomerVisitActivity extends BaseNetActivity {
     private RecyclerView mRecyclerView;
     private Date mCurrentDate;
     private SparseArray<List<VisitPlan>> datas;
-
-
-    @Override
-    protected int getLayoutId() {
-        return R.layout.activity_customer_visit;
-    }
+    private UUHttpHelper mUUHttpHelper;
 
     @Override
-    protected void init() throws Exception {
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_customer_visit);
+        mUUHttpHelper=new UUHttpHelper(CommonUtil.getAppBaseUrl(this));
         initView();
         initData();
-
     }
 
 
-    @Override
-    protected String getBaseUrl() {
-        return CommonUtil.getAppBaseUrl(this);
-    }
-
     private void initView() {
         mCurrentDate = new Date();
         myVisitRb = findViewById(R.id.myVisitRb);
@@ -90,18 +86,19 @@ public class CustomerVisitActivity extends BaseNetActivity {
                 }
             }
         });
+
         toDayTv.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                mCalendarView.setCurrentDate(new Date());
+                mCurrentDate=new Date();
+                mCalendarView.setCurrentDate(mCurrentDate);
             }
         });
         mCalendarView.setListener(new CompactCalendarView.CompactCalendarViewListener() {
             @Override
             public void onDayClick(Date dateClicked) {
-
+                mCurrentDate = dateClicked;
             }
-
             @Override
             public void onMonthScroll(Date firstDayOfNewMonth) {
                 mCurrentDate = firstDayOfNewMonth;
@@ -133,14 +130,14 @@ public class CustomerVisitActivity extends BaseNetActivity {
         }
         List<VisitPlan> visitPlanArrayList = datas.get(monthInt);
         if (visitPlanArrayList == null) {
-            requestCompanyHttp(new Parameter.Builder()
+            mUUHttpHelper.requestCompanyHttp(new Parameter.Builder()
                     .mode(Method.GET)
                     .addParams("dataTime", month)
                     .addParams("salesmanCode", BaseConfig.isDebug() ? "zhouy" : CommonUtil.getEmcode())
                     .addParams("flag", isOther ? 1 : 0)
                     .addTag(TAG_DATE, monthInt)
                     .record(LOAD_DATA)
-                    .url("/mobile/crm/getvisitplanmsg.action"), mOnSmartHttpListener);
+                    .url("mobile/crm/getvisitplanmsg.action"), mOnSmartHttpListener);
         } else {
             setAdapter(visitPlanArrayList);
         }

+ 38 - 4
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/fragment/CustomerListDetailsFragment.java

@@ -4,6 +4,10 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -26,6 +30,7 @@ import com.module.recyclerlibrary.ui.refresh.EmptyRecyclerView;
 import com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout;
 import com.uas.appworks.R;
 import com.uas.appworks.adapter.BillListAdapter;
+import com.uas.appworks.crm3_0.activity.BillSearchActivity;
 import com.uas.appworks.crm3_0.activity.CustomerBillInputActivity;
 import com.uas.appworks.crm3_0.activity.CustomerDetails3_0Activity;
 
@@ -48,7 +53,24 @@ public class CustomerListDetailsFragment extends ViewPagerLazyFragment {
     private UUHttpHelper mUUHttpHelper;
     private SimpleRefreshLayout mRefreshLayout;
 
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        inflater.inflate(R.menu.search, menu);
+        super.onCreateOptionsMenu(menu, inflater);
+    }
 
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (R.id.search == item.getItemId()) {
+            startActivity(new Intent(ct, BillSearchActivity.class)
+                    .putExtra(Constants.Intents.CALLER, mCaller)
+                    .putExtra(Constants.Intents.CONDITION, mCondition)
+                    .putStringArrayListExtra(Constants.Intents.FIELD_CONFIG, fieldConfig)
+                    .putExtra(Constants.Intents.TITLE, getActivity().getTitle())
+            );
+        }
+        return super.onOptionsItemSelected(item);
+    }
     public static CustomerListDetailsFragment newInstance(String mCaller, String mCondition) {
         Bundle args = new Bundle();
         CustomerListDetailsFragment fragment = new CustomerListDetailsFragment();
@@ -65,6 +87,7 @@ public class CustomerListDetailsFragment extends ViewPagerLazyFragment {
 
     @Override
     protected void LazyData() {
+        setHasOptionsMenu(true);
         mUUHttpHelper = new UUHttpHelper(CommonUtil.getAppBaseUrl(MyApplication.getInstance()));
         initView();
 
@@ -133,8 +156,13 @@ public class CustomerListDetailsFragment extends ViewPagerLazyFragment {
             dismissProgress();
         }
     };
-
+    private ArrayList<String> fieldConfig;
     private void handlerListData(JSONObject object) throws Exception {
+        if (fieldConfig==null){
+            fieldConfig=new ArrayList<>();
+        }else {
+            fieldConfig.clear();
+        }
         JSONArray columns = JSONUtil.getJSONArray(object, "columns");
         JSONArray listdata = JSONUtil.getJSONArray(object, "listdata");
         String keyField = JSONUtil.getText(object, "keyField");
@@ -160,6 +188,9 @@ public class CustomerListDetailsFragment extends ViewPagerLazyFragment {
                         String caption = JSONUtil.getText(column, "caption");
                         String dataIndex = JSONUtil.getText(column, "dataIndex");
                         String values = JSONUtil.getText(data, dataIndex);
+                        if (!TextUtils.isEmpty(dataIndex)){
+                            fieldConfig.add(dataIndex);
+                        }
                         BillListGroupModel.BillListField billListField = new BillListGroupModel.BillListField();
                         billListField.setId(id);
                         billListField.setStatus(status);
@@ -206,9 +237,12 @@ public class CustomerListDetailsFragment extends ViewPagerLazyFragment {
             mRecyclerView.setAdapter(mListAdapter);
         } else {
             List<BillListGroupModel> showModels = mListAdapter.getGroupModels();
-            if (ListUtils.isEmpty(showModels)) {
-                showModels = groupModels;
-            } else if (mPageIndex > 1) {
+            if (mPageIndex<=1){
+                showModels=groupModels;
+            }else{
+                if (showModels==null){
+                    showModels=new ArrayList<>();
+                }
                 showModels.addAll(groupModels);
             }
             mListAdapter.updateGroupModels(showModels);

+ 1 - 8
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/fragment/CustomerListFragment.java

@@ -65,20 +65,13 @@ public class CustomerListFragment extends EasyFragment {
 
     }
 
+
     private class ViewPageAdapter extends FragmentStatePagerAdapter {
 
         public ViewPageAdapter(FragmentManager fm) {
             super(fm);
         }
 
-        @Override
-        public void setPrimaryItem(ViewGroup container, int position, Object object) {
-            if (object != null && object instanceof CustomerListDetailsFragment) {
-                //获取当前的fragment
-//                mCurrentFragment = (CustomerListDetailsFragment) object;
-            }
-            super.setPrimaryItem(container, position, object);
-        }
 
         @Override
         public Fragment getItem(int position) {

+ 39 - 4
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/fragment/CustomerMapDetailsFragment.java

@@ -4,6 +4,10 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -27,6 +31,7 @@ import com.module.recyclerlibrary.ui.refresh.EmptyRecyclerView;
 import com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout;
 import com.uas.appworks.R;
 import com.uas.appworks.adapter.BillListAdapter;
+import com.uas.appworks.crm3_0.activity.BillSearchActivity;
 import com.uas.appworks.crm3_0.activity.CustomerDetails3_0Activity;
 
 import java.util.ArrayList;
@@ -55,6 +60,25 @@ public class CustomerMapDetailsFragment extends ViewPagerLazyFragment {
         return fragment;
     }
 
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        inflater.inflate(R.menu.search, menu);
+        super.onCreateOptionsMenu(menu, inflater);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (R.id.search == item.getItemId()) {
+            startActivity(new Intent(ct, BillSearchActivity.class)
+                    .putExtra(Constants.Intents.CALLER, mCaller)
+                    .putExtra(Constants.Intents.CONDITION, mCondition)
+                    .putStringArrayListExtra(Constants.Intents.FIELD_CONFIG, fieldConfig)
+                    .putExtra(Constants.Intents.TITLE, getActivity().getTitle())
+            );
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
     @Override
     protected int inflateLayoutId() {
         return R.layout.fragment_customer_map_3_0;
@@ -127,8 +151,13 @@ public class CustomerMapDetailsFragment extends ViewPagerLazyFragment {
             dismissProgress();
         }
     };
-
+    private ArrayList<String> fieldConfig;
     private void handlerListData(JSONObject object) throws Exception {
+        if (fieldConfig==null){
+            fieldConfig=new ArrayList<>();
+        }else {
+            fieldConfig.clear();
+        }
         JSONArray columns = JSONUtil.getJSONArray(object, "columns");
         JSONArray listdata = JSONUtil.getJSONArray(object, "listdata");
         String keyField = JSONUtil.getText(object, "keyField");
@@ -152,6 +181,9 @@ public class CustomerMapDetailsFragment extends ViewPagerLazyFragment {
                         String caption = JSONUtil.getText(column, "caption");
                         String dataIndex = JSONUtil.getText(column, "dataIndex");
                         String values = JSONUtil.getText(data, dataIndex);
+                        if (!TextUtils.isEmpty(dataIndex)){
+                            fieldConfig.add(dataIndex);
+                        }
                         BillListGroupModel.BillListField billListField = new BillListGroupModel.BillListField();
                         billListField.setId(id);
                         billListField.setCaption(caption);
@@ -189,9 +221,12 @@ public class CustomerMapDetailsFragment extends ViewPagerLazyFragment {
             mRecyclerView.setAdapter(mListAdapter);
         } else {
             List<BillListGroupModel> showModels = mListAdapter.getGroupModels();
-            if (ListUtils.isEmpty(showModels)) {
-                showModels = groupModels;
-            } else if (mPageIndex > 1) {
+            if (mPageIndex<=1){
+                showModels=groupModels;
+            }else{
+                if (showModels==null){
+                    showModels=new ArrayList<>();
+                }
                 showModels.addAll(groupModels);
             }
             mListAdapter.updateGroupModels(showModels);

+ 62 - 0
app_modular/appworks/src/main/res/layout/activity_bill_search.xml

@@ -0,0 +1,62 @@
+<?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">
+
+    <android.support.v7.widget.Toolbar
+        android:id="@+id/mToolbar"
+        android:layout_width="match_parent"
+        android:layout_height="60dp"
+        android:background="@drawable/common_toolbar_bg"
+        android:orientation="horizontal"
+        android:paddingBottom="10dp"
+        android:paddingTop="10dp">
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+
+            <ImageView
+                android:id="@+id/backImg"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:padding="4dp"
+                android:src="@drawable/ic_baseutil_back" />
+
+            <com.modular.apputils.widget.MenuVoiceSearchView
+                android:id="@+id/mVoiceSearchView"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_centerInParent="true"
+                android:layout_marginLeft="50dp"
+                android:layout_marginRight="50dp"
+                android:orientation="horizontal" />
+
+
+            <ImageView
+                android:id="@+id/addImg"
+                android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:layout_alignParentRight="true"
+                android:layout_marginRight="5dp"
+                android:gravity="center"
+                android:padding="@dimen/padding"
+                android:src="@drawable/more"
+                android:visibility="invisible" />
+        </RelativeLayout>
+
+
+    </android.support.v7.widget.Toolbar>
+
+    <com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout
+        android:id="@+id/mSimpleRefreshLayout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+
+        <com.module.recyclerlibrary.ui.refresh.EmptyRecyclerView
+            android:id="@+id/mEmptyRecyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+    </com.module.recyclerlibrary.ui.refresh.simlpe.SimpleRefreshLayout>
+</LinearLayout>