Browse Source

Merge branch 'developer' of https://gitlab.com/Arisono/SkWeiChat-Baidu into feature_raomeng

# Conflicts:
#	app_modular/apputils/src/main/java/com/modular/apputils/activity/BillInputActivity.java
RaoMeng 7 years ago
parent
commit
0873ecff74

+ 95 - 45
app_modular/apputils/src/main/java/com/modular/apputils/activity/BillInputActivity.java

@@ -13,6 +13,7 @@ import android.text.TextUtils;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.widget.LinearLayout;
+import android.widget.Toast;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
@@ -22,10 +23,14 @@ import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.file.FileUtils;
+import com.core.base.BaseActivity;
 import com.core.base.OABaseActivity;
 import com.core.model.SelectBean;
+import com.core.utils.CommonUtil;
+import com.core.utils.ToastUtil;
 import com.core.utils.time.wheel.DateTimePicker;
 import com.core.widget.view.Activity.SelectActivity;
+import com.core.widget.view.selectcalendar.bean.Data;
 import com.modular.apputils.R;
 import com.modular.apputils.adapter.BillAdapter;
 import com.modular.apputils.model.BillGroupModel;
@@ -34,44 +39,82 @@ import com.modular.apputils.presenter.imp.IBill;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 
 
 /**
  * 动态表单单据录入界面,后续会尽量关闭修改,添加拓展功能
  */
 public class BillInputActivity extends OABaseActivity implements IBill {
-    private final int REQUESTCODE_C = 0x11;
-    private final int REQUESTCODE_DB_FIND = 0x12;
-    private final int REQUESTCODE_ENCLOSURE = 0x13;
+    public final int REQUESTCODE_C = 0x11;
+    public final int REQUESTCODE_C_NET = 0x14;
+    public final int REQUESTCODE_DB_FIND = 0x12;
+    public final int REQUESTCODE_ENCLOSURE = 0x13;
 
-    private RecyclerView mRecyclerView;
-    private BillPresenter mBillPresenter;
-    private BillAdapter mBillAdapter;
-    private int selectPosition = -1;//当前选择调转界面的index,本来不想添加全局变量的,没有办法
+    public RecyclerView mRecyclerView;
+    public BillPresenter mBillPresenter;
+    public BillAdapter mBillAdapter;
+    public int selectPosition = -1;//当前选择调转界面的index,本来不想添加全局变量的,没有办法
 
+    //TODO 重写方法实现自定义的 BillPresenter,必须继承于BillPresenter
+    public BillPresenter newBillPresenter() {
+        return new BillPresenter(this, this);
+    }
+
+    //TODO 重写方法实现自定义的 BillAdapter,必须继承于BillAdapter
+    public BillAdapter newBillAdapter(List<BillGroupModel> groupModels) {
+        return new BillAdapter(ct, groupModels, mOnAdapterListener);
+    }
+
+    //TODO  重写方法实现自定义的 提交完成后处理
+    public void commitSuccess() {
+        ToastMessage("提交成功!");
+        new Handler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                if (mContext == null) return;
+                startActivity(new Intent("com.modular.form.erp.activity.CommonDocDetailsActivity")
+                        .putExtra("caller", mBillPresenter.getFormCaller())
+                        .putExtra("keyValue", mBillPresenter.getFormId())
+                        .putExtra("update", "1")
+                        .putExtra("title", getToolBarTitle())
+                        .putExtra("statusKey", mBillPresenter.getStatusField())
+                        .putExtra("status", "已提交"));
+                finish();
+                overridePendingTransition(R.anim.anim_activity_in, R.anim.anim_activity_out);
+            }
+        }, 2000);
+    }
+    //TODO  重写方法实现自定义的初始化
+    public  void init() {
+        mBillPresenter = newBillPresenter();
+        mBillPresenter.start(getIntent());
+    }
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_bill_input);
         initView();
-        mBillPresenter = new BillPresenter(this, this);
-        mBillPresenter.start(getIntent());
+        init();
     }
 
-
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         getMenuInflater().inflate(R.menu.menu_bill_input, menu);
         return super.onCreateOptionsMenu(menu);
     }
 
-    //更新菜单时候
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        MenuItem itemMenu = menu.findItem(R.id.saveAndSubmit);
-        return super.onPrepareOptionsMenu(menu);
+    private void toDataFormList() {
+        startActivity(new Intent("com.modular.work.OA.erp.activity.form.FormListSelectActivity")
+                .putExtra("caller", mBillPresenter.getFormCaller())
+                .putExtra("statusKey", mBillPresenter.getStatusField())//传状态key
+                .putExtra("title", getToolBarTitle()));
+
     }
 
     @Override
@@ -79,7 +122,7 @@ public class BillInputActivity extends OABaseActivity implements IBill {
         if (item.getItemId() == R.id.saveAndSubmit) {
             mBillPresenter.saveAndSubmit(mBillAdapter.getBillGroupModels());
         } else if (item.getItemId() == R.id.list) {
-            //TODO 查看列表
+            toDataFormList();
         }
         return super.onOptionsItemSelected(item);
     }
@@ -93,7 +136,7 @@ public class BillInputActivity extends OABaseActivity implements IBill {
     @Override
     public void setAdapter(List<BillGroupModel> groupModels) {
         if (mBillAdapter == null) {
-            mBillAdapter = new BillAdapter(ct, groupModels, mOnAdapterListener);
+            mBillAdapter = newBillAdapter(groupModels);
             mRecyclerView.setAdapter(mBillAdapter);
         } else {
             mBillAdapter.setBillGroupModels(groupModels);
@@ -101,27 +144,6 @@ public class BillInputActivity extends OABaseActivity implements IBill {
         }
     }
 
-    @Override
-    public void commitSuccess() {
-        ToastMessage("提交成功!");
-        new Handler().postDelayed(new Runnable() {
-            @Override
-            public void run() {
-                if (mContext == null) return;
-                startActivity(new Intent("com.modular.form.erp.activity.CommonDocDetailsActivity")
-                        .putExtra("caller", mBillPresenter.getFormCaller())
-                        .putExtra("keyValue", mBillPresenter.getFormId())
-                        .putExtra("update", "1")
-                        .putExtra("title", getToolBarTitle())
-                        .putExtra("statusKey", mBillPresenter.getStatusField())
-                        .putExtra("status", "已提交"));
-                finish();
-                overridePendingTransition(R.anim.anim_activity_in, R.anim.anim_activity_out);
-            }
-        }, 2000);
-
-
-    }
 
     @Override
     public void updateFileOk() {
@@ -129,7 +151,7 @@ public class BillInputActivity extends OABaseActivity implements IBill {
         mBillPresenter.saveAndSubmit(mBillAdapter.getBillGroupModels());
     }
 
-    private BillAdapter.OnAdapterListener mOnAdapterListener = new BillAdapter.OnAdapterListener() {
+    public BillAdapter.OnAdapterListener mOnAdapterListener = new BillAdapter.OnAdapterListener() {
         @Override
         public void toSelect(int position, BillGroupModel.BillModel model) {
             if (TextUtils.isEmpty(model.getType())) return;
@@ -139,9 +161,10 @@ public class BillInputActivity extends OABaseActivity implements IBill {
             } else {
                 //本地数据为空,获取网络数据
                 switch (model.getType()) {
-                    case "D"://日期选择
-                        showDateDialog(true, position);
+                    case "C"://单项选择
+                        getComboValue(position, model);
                         break;
+                    case "D"://日期选择
                     case "T"://时间选择
                         showDateDialog(true, position);
                         break;
@@ -171,6 +194,24 @@ public class BillInputActivity extends OABaseActivity implements IBill {
         }
     };
 
+    public void getComboValue(int position, BillGroupModel.BillModel model) {
+        HashMap param = new HashMap<>();
+        param.put("caller", mBillPresenter.getFormCaller());
+        param.put("field", model.getField());
+        Bundle bundle = new Bundle();
+        bundle.putSerializable("param", param);
+        Intent intent = new Intent(ct, SelectActivity.class);
+        intent.putExtra("type", 1);
+        intent.putExtra("reid", R.style.OAThemeMeet);
+        intent.putExtras(bundle);
+        intent.putExtra("key", "combdatas");
+        intent.putExtra("showKey", "DISPLAY");
+        intent.putExtra("action", "mobile/common/getComboValue.action");
+        intent.putExtra("title", model.getCaption());
+        intent.putExtra("id", position);//需要把zum
+        startActivityForResult(intent, REQUESTCODE_C_NET);
+    }
+
     /**
      * 选择日期
      */
@@ -201,7 +242,7 @@ public class BillInputActivity extends OABaseActivity implements IBill {
      *
      * @param model
      */
-    private void findBydbFind(BillGroupModel.BillModel model) {
+    public void findBydbFind(BillGroupModel.BillModel model) {
         String gridCaller = "";
         String fieldKey = model.getField();
         BillGroupModel mGroupModel = mBillAdapter.getBillGroupModel(model.getGroupIndex());
@@ -230,7 +271,7 @@ public class BillInputActivity extends OABaseActivity implements IBill {
      * @param position 索引
      * @param model    点击对象
      */
-    private void selectByLocal(int position, BillGroupModel.BillModel model) {
+    public void selectByLocal(int position, BillGroupModel.BillModel model) {
         ArrayList<SelectBean> beans = new ArrayList<>();
         SelectBean bean;
         for (BillGroupModel.LocalData localData : model.getLocalDatas()) {
@@ -253,10 +294,19 @@ public class BillInputActivity extends OABaseActivity implements IBill {
         super.onActivityResult(requestCode, resultCode, data);
         if (data == null) return;
         switch (requestCode) {
-            case REQUESTCODE_C:
+            case REQUESTCODE_C_NET:
                 SelectBean mSelectBeanC = data.getParcelableExtra("data");
+                int position = data.getIntExtra("id", -1);
+                if (mSelectBeanC != null && position >= 0) {
+                    String display = StringUtil.isEmpty(mSelectBeanC.getName()) ? "" : mSelectBeanC.getName();
+                    String value = StringUtil.isEmpty(mSelectBeanC.getName()) ? "" : mSelectBeanC.getName();
+                    mBillAdapter.updateBillModelValues(position, value, display);
+                }
+                break;
+            case REQUESTCODE_C:
+                mSelectBeanC = data.getParcelableExtra("data");
                 if (mSelectBeanC != null) {
-                    int position = mSelectBeanC.getIndex();
+                    position = mSelectBeanC.getIndex();
                     String display = StringUtil.isEmpty(mSelectBeanC.getShowName()) ? "" : mSelectBeanC.getShowName();
                     String value = StringUtil.isEmpty(mSelectBeanC.getJson()) ? "" : mSelectBeanC.getJson();
                     mBillAdapter.updateBillModelValues(position, value, display);

+ 25 - 15
app_modular/apputils/src/main/java/com/modular/apputils/adapter/BillAdapter.java

@@ -7,6 +7,7 @@ import android.support.annotation.NonNull;
 import android.support.v4.app.FragmentActivity;
 import android.support.v7.widget.RecyclerView;
 import android.text.Editable;
+import android.text.InputType;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -48,17 +49,16 @@ import java.util.Set;
  */
 public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder> {
 
-    private Context ct;
+    public Context ct;
     private List<BillGroupModel> mBillGroupModels;
     private List<BillGroupModel.BillModel> mShowBillModels;
-    private OnAdapterListener mOnAdapterListener;
+    public OnAdapterListener mOnAdapterListener;
 
     public BillAdapter(Context ct, List<BillGroupModel> mBillGroupModels, OnAdapterListener mOnAdapterListener) {
         this.ct = ct;
         this.mBillGroupModels = mBillGroupModels;
         this.mOnAdapterListener = mOnAdapterListener;
         changeBillModel();
-        LogUtil.i("gong", "mShowBillModels=" + JSON.toJSONString(mShowBillModels));
     }
 
     public void updateBillModelValues(int position, String values, String display) {
@@ -135,6 +135,10 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
     }
 
+    public List<BillGroupModel.BillModel> getShowBillModels() {
+        return mShowBillModels;
+    }
+
     @Override
     public int getItemViewType(int position) {
         if (mShowBillModels != null && mShowBillModels.size() > position) {
@@ -163,7 +167,7 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
             default:
                 viewHolder = new BaseViewHolder(parent, R.layout.item_bill_title) {
                     @Override
-                    void initView(View view) {
+                   public void initView(View view) {
 
                     }
                 };
@@ -187,13 +191,13 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         return mLayoutInflater;
     }
 
-    abstract class BaseViewHolder extends RecyclerView.ViewHolder {
+    public abstract class BaseViewHolder extends RecyclerView.ViewHolder {
 
         public BaseViewHolder(ViewGroup parent, @LayoutRes int layoutId) {
             this(getLayoutInflater().inflate(layoutId, parent, false));
         }
 
-        abstract void initView(View view);
+      public   abstract void initView(View view);
 
         public BaseViewHolder(View itemView) {
             super(itemView);
@@ -201,7 +205,7 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
     }
 
-    class AddViewHolder extends BaseViewHolder {
+    public class AddViewHolder extends BaseViewHolder {
         private TextView addTv;
 
         public AddViewHolder(ViewGroup parent, int layoutId) {
@@ -209,13 +213,13 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
 
         @Override
-        void initView(View view) {
+        public void initView(View view) {
             addTv = (TextView) view.findViewById(R.id.addTv);
         }
     }
 
     //选择和输入类型
-    class InputViewHolder extends BaseViewHolder {
+    public class InputViewHolder extends BaseViewHolder {
         private TextView captionTv;
         private TextView muchInputTv;
         private ImageView selectIv;
@@ -226,7 +230,7 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
 
         @Override
-        void initView(View itemView) {
+        public  void initView(View itemView) {
             captionTv = (TextView) itemView.findViewById(R.id.captionTv);
             muchInputTv = (TextView) itemView.findViewById(R.id.muchInputTv);
             selectIv = (ImageView) itemView.findViewById(R.id.selectIv);
@@ -245,7 +249,7 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
 
         @Override
-        void initView(View itemView) {
+        public void initView(View itemView) {
             captionTv = (TextView) itemView.findViewById(R.id.captionTv);
             muchInputTv = (TextView) itemView.findViewById(R.id.muchInputTv);
             ffGv = (MyGridView) itemView.findViewById(R.id.ffGv);
@@ -261,7 +265,7 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
 
         @Override
-        void initView(View view) {
+        public  void initView(View view) {
             tvTitle = (TextView) view.findViewById(R.id.tv_title);
             deleteTv = (TextView) view.findViewById(R.id.deleteTv);
         }
@@ -318,14 +322,19 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
         }
     }
 
-    private void bindInputView(InputViewHolder mInputViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
+    public void bindInputView(InputViewHolder mInputViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
         if (model != null) {
             if (mInputViewHolder.valuesEd.getTag() != null && mInputViewHolder.valuesEd.getTag() instanceof TextChangListener) {
                 mInputViewHolder.valuesEd.removeTextChangedListener((TextChangListener) mInputViewHolder.valuesEd.getTag());
             }
             mInputViewHolder.captionTv.setText(model.getCaption());
-            mInputViewHolder.muchInputTv.setVisibility(model.getAllowBlank().equals("F") ? View.VISIBLE: View.GONE );
+            mInputViewHolder.muchInputTv.setVisibility(model.getAllowBlank().equals("F") ? View.VISIBLE : View.GONE);
             mInputViewHolder.valuesEd.setText(model.getValue());
+            if (model.getType().equals("N")) {
+                mInputViewHolder.valuesEd.setInputType(InputType.TYPE_CLASS_NUMBER);
+            } else {
+                mInputViewHolder.valuesEd.setInputType(InputType.TYPE_CLASS_TEXT);
+            }
             if (model.getReadOnly().equals("T")) {
                 mInputViewHolder.valuesEd.setFocusable(false);
                 mInputViewHolder.valuesEd.setClickable(true);
@@ -350,12 +359,13 @@ public class BillAdapter extends RecyclerView.Adapter<BillAdapter.BaseViewHolder
                 mInputViewHolder.valuesEd.setTag(mTextChangListener);
                 mInputViewHolder.valuesEd.addTextChangedListener(mTextChangListener);
                 mInputViewHolder.valuesEd.setOnClickListener(null);
+
             }
 
         }
     }
 
-    private void bindTitleView(TitleViewHolder mTitleViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
+    public void bindTitleView(TitleViewHolder mTitleViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
         if (model != null) {
             if (model.getAllowBlank().equals("T")) {
                 mTitleViewHolder.deleteTv.setVisibility(View.VISIBLE);

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

@@ -60,7 +60,13 @@
             android:name=".OA.erp.activity.form.FormListSelectActivity"
             android:hardwareAccelerated="false"
             android:launchMode="singleTask"
-            android:windowSoftInputMode="adjustPan" />
+            android:windowSoftInputMode="adjustPan" >
+            <intent-filter>
+                <action android:name="com.modular.work.OA.erp.activity.form.FormListSelectActivity" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
         <activity
             android:name=".OA.erp.activity.WorkActivity"
             android:label="@string/activity_signing">

+ 22 - 491
app_modular/appworks/src/main/java/com/uas/appworks/adapter/CustomerBillInputAdapter.java

@@ -5,7 +5,6 @@ import android.support.annotation.LayoutRes;
 import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
 import android.text.Editable;
-import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -22,180 +21,53 @@ import com.core.widget.listener.EditChangeListener;
 import com.core.widget.view.MyGridView;
 import com.core.widget.view.SwitchView;
 import com.me.imageloader.ImageLoaderUtil;
+import com.modular.apputils.adapter.BillAdapter;
 import com.modular.apputils.model.BillGroupModel;
 import com.modular.apputils.utils.BillTypeChangeUtils;
 import com.modular.apputils.widget.VeriftyDialog;
 import com.uas.appworks.R;
 
-import java.util.ArrayList;
 import java.util.List;
 
-public class CustomerBillInputAdapter extends RecyclerView.Adapter<CustomerBillInputAdapter.BaseViewHolder> {
+public class CustomerBillInputAdapter extends BillAdapter {
+
 
-    private Context ct;
-    private List<BillGroupModel> mBillGroupModels;
-    private List<BillGroupModel.BillModel> mShowBillModels;
-    private CustomerBillInputAdapter.OnAdapterListener mOnAdapterListener;
     private boolean addContact = true;//保存后继续新增联系人
 
-    public CustomerBillInputAdapter(Context ct, List<BillGroupModel> mBillGroupModels, CustomerBillInputAdapter.OnAdapterListener mOnAdapterListener) {
-        this.ct = ct;
-        this.mBillGroupModels = mBillGroupModels;
-        this.mOnAdapterListener = mOnAdapterListener;
-        changeBillModel();
+    public CustomerBillInputAdapter(Context ct, List<BillGroupModel> mBillGroupModels, BillAdapter.OnAdapterListener mOnAdapterListener) {
+        super(ct, mBillGroupModels, mOnAdapterListener);
     }
 
     public boolean isAddContact() {
         return addContact;
     }
 
-    public void updateBillModelValues(int position, String values, String display) {
-        if (position >= 0 && position < ListUtils.getSize(mShowBillModels)) {
-            mShowBillModels.get(position).setValue(values);
-            mShowBillModels.get(position).setDisplay(display);
-            notifyItemChanged(position);
-        }
-    }
-
-    public void addBillModelData(int position, String values, String display) {
-        if (position >= 0 && position < ListUtils.getSize(mShowBillModels)) {
-            if (mShowBillModels.get(position).getLocalDatas() == null) {
-                mShowBillModels.get(position).setLocalDatas(new ArrayList<BillGroupModel.LocalData>());
-            }
-            BillGroupModel.LocalData data = new BillGroupModel.LocalData();
-            data.value = values;
-            data.display = display;
-            mShowBillModels.get(position).getLocalDatas().add(data);
-            notifyItemChanged(position);
-        }
-    }
-
-    public void setBillGroupModels(List<BillGroupModel> mBillGroupModels) {
-        this.mBillGroupModels = mBillGroupModels;
-        changeBillModel();
-    }
-
-    /**
-     * 当外界的因素引起mBillGroupModels变化时候,通过遍历将mBillGroupModels转成mShowBillModels进行显示
-     */
-    private void changeBillModel() {
-        if (mShowBillModels == null) {
-            mShowBillModels = new ArrayList<>();
-        } else {
-            mShowBillModels.clear();
-        }
-        for (int i = 0; i < mBillGroupModels.size(); i++) {
-            BillGroupModel e = mBillGroupModels.get(i);
-            if (e != null && e.getShowBillFields() != null && !e.getShowBillFields().isEmpty()) {
-                if (!TextUtils.isEmpty(e.getGroup())) {
-                    BillGroupModel.BillModel mTitleBillModel = new BillGroupModel.BillModel();
-                    mTitleBillModel.setGroupIndex(i);
-                    mTitleBillModel.setType(BillGroupModel.Constants.TYPE_TITLE);
-                    mTitleBillModel.setCaption(e.getGroup());
-                    mTitleBillModel.setAllowBlank(e.isDeleteAble() ? "T" : "F");
-                    mShowBillModels.add(mTitleBillModel);
-                }
-                mShowBillModels.addAll(e.getShowBillFields());
-                if (!e.isForm() && e.isLastInType()) {
-                    mShowBillModels.add(getAddModel(i));
-                }
-            }
-        }
-    }
-
-    private BillGroupModel.BillModel getAddModel(int index) {
-        BillGroupModel.BillModel mTitleBillModel = new BillGroupModel.BillModel();
-        mTitleBillModel.setGroupIndex(index);
-        mTitleBillModel.setType(BillGroupModel.Constants.TYPE_ADD);
-        mTitleBillModel.setCaption("添加单据");
-        return mTitleBillModel;
-    }
-
-    public List<BillGroupModel> getBillGroupModels() {
-        return mBillGroupModels;
-    }
-
-    public BillGroupModel getBillGroupModel(int position) {
-        if (position >= 0 && ListUtils.getSize(mBillGroupModels) > position) {
-            return mBillGroupModels.get(position);
-        } else {
-            return null;
-        }
-    }
 
     @Override
     public int getItemViewType(int position) {
-        if (mShowBillModels != null && mShowBillModels.size() > position) {
-            return BillTypeChangeUtils.getItemViewType(mShowBillModels.get(position).getType());
+        if (ListUtils.getSize(getShowBillModels()) > position) {
+            return BillTypeChangeUtils.getItemViewType(getShowBillModels().get(position).getType());
         } else {
             return 220;
         }
     }
 
-    @NonNull
-    @Override
-    public CustomerBillInputAdapter.BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
-        CustomerBillInputAdapter.BaseViewHolder viewHolder = null;
-        switch (viewType) {
-            case 0:
-                viewHolder = new CustomerBillInputAdapter.TitleViewHolder(parent, R.layout.item_bill_title);
-                break;
-            case 1:
-                viewHolder = new CustomerBillInputAdapter.InputViewHolder(parent, R.layout.item_bill_input_select);
-                break;
-            case 2:
-                viewHolder = new CustomerBillInputAdapter.EnclosureViewHolder(parent, R.layout.item_bill_enclosure);
-                break;//附件类型
-            case 110:
-                viewHolder = new CustomerBillInputAdapter.AddViewHolder(parent, R.layout.item_bill_add);
-                break;
-            case 220://个性化添加是否保存后继续添加联系人
-                viewHolder = new CustomerBillInputAdapter.AddcontentViewHolder(parent, R.layout.item_customer_bill_add_contact);
-
-                break;
-            default:
-                viewHolder = new CustomerBillInputAdapter.BaseViewHolder(parent, R.layout.item_bill_title) {
-                    @Override
-                    void initView(View view) {
-
-                    }
-                };
-        }
-        return viewHolder;
-    }
-
-
     @Override
     public int getItemCount() {
-        return mShowBillModels == null ? 1 : mShowBillModels.size() + 1;
+        return super.getItemCount()+1;
     }
 
-
-    private LayoutInflater mLayoutInflater;
-
-    public LayoutInflater getLayoutInflater() {
-        if (mLayoutInflater == null) {
-            mLayoutInflater = LayoutInflater.from(ct);
-        }
-        return mLayoutInflater;
-    }
-
-    abstract class BaseViewHolder extends RecyclerView.ViewHolder {
-
-        public BaseViewHolder(ViewGroup parent, @LayoutRes int layoutId) {
-            this(getLayoutInflater().inflate(layoutId, parent, false));
-        }
-
-        abstract void initView(View view);
-
-        public BaseViewHolder(View itemView) {
-            super(itemView);
-            initView(itemView);
+    @NonNull
+    @Override
+    public BillAdapter.BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+        if (viewType == 220) {
+            return new CustomerBillInputAdapter.AddcontentViewHolder(parent, R.layout.item_customer_bill_add_contact);
+        } else {
+            return super.onCreateViewHolder(parent, viewType);
         }
     }
 
-
-    class AddcontentViewHolder extends CustomerBillInputAdapter.BaseViewHolder {
+    class AddcontentViewHolder extends BillAdapter.BaseViewHolder {
         private SwitchView saveContactSv;
 
         public AddcontentViewHolder(ViewGroup parent, int layoutId) {
@@ -203,104 +75,22 @@ public class CustomerBillInputAdapter extends RecyclerView.Adapter<CustomerBillI
         }
 
         @Override
-        void initView(View view) {
+        public void initView(View view) {
             saveContactSv = (SwitchView) view.findViewById(R.id.saveContactSv);
         }
     }
 
-    class AddViewHolder extends CustomerBillInputAdapter.BaseViewHolder {
-        private TextView addTv;
-
-        public AddViewHolder(ViewGroup parent, int layoutId) {
-            super(parent, layoutId);
-        }
-
-        @Override
-        void initView(View view) {
-            addTv = (TextView) view.findViewById(R.id.addTv);
-        }
-    }
-
-    //选择和输入类型
-    class InputViewHolder extends CustomerBillInputAdapter.BaseViewHolder {
-        private TextView captionTv;
-        private TextView muchInputTv;
-        private ImageView selectIv;
-        private EditText valuesEd;
-
-        public InputViewHolder(ViewGroup parent, int layoutId) {
-            super(parent, layoutId);
-        }
-
-        @Override
-        void initView(View itemView) {
-            captionTv = (TextView) itemView.findViewById(R.id.captionTv);
-            muchInputTv = (TextView) itemView.findViewById(R.id.muchInputTv);
-            selectIv = (ImageView) itemView.findViewById(R.id.selectIv);
-            valuesEd = (EditText) itemView.findViewById(R.id.valuesEd);
-        }
-    }
-
-    //附件类型
-    class EnclosureViewHolder extends CustomerBillInputAdapter.BaseViewHolder {
-        private TextView captionTv;
-        private TextView muchInputTv;
-        private MyGridView ffGv;
-
-        public EnclosureViewHolder(ViewGroup parent, int layoutId) {
-            super(parent, layoutId);
-        }
-
-        @Override
-        void initView(View itemView) {
-            captionTv = (TextView) itemView.findViewById(R.id.captionTv);
-            muchInputTv = (TextView) itemView.findViewById(R.id.muchInputTv);
-            ffGv = (MyGridView) itemView.findViewById(R.id.ffGv);
-        }
-    }
-
-    class TitleViewHolder extends CustomerBillInputAdapter.BaseViewHolder {
-        private TextView tvTitle;
-        private TextView deleteTv;
-
-        public TitleViewHolder(ViewGroup parent, int layoutId) {
-            super(parent, layoutId);
-        }
-
-        @Override
-        void initView(View view) {
-            tvTitle = (TextView) view.findViewById(R.id.tv_title);
-            deleteTv = (TextView) view.findViewById(R.id.deleteTv);
-        }
-
-    }
-
 
     @Override
     public void onBindViewHolder(@NonNull CustomerBillInputAdapter.BaseViewHolder holder, int position) {
-        BillGroupModel.BillModel model = null;
-        if (mShowBillModels != null && mShowBillModels.size() > position) {
-            model = mShowBillModels.get(position);
-        }
-        try {
-            if (holder instanceof CustomerBillInputAdapter.InputViewHolder) {
-                bindInputView((CustomerBillInputAdapter.InputViewHolder) holder, model, position);
-            } else if (holder instanceof CustomerBillInputAdapter.TitleViewHolder) {
-                bindTitleView((CustomerBillInputAdapter.TitleViewHolder) holder, model, position);
-            } else if (holder instanceof CustomerBillInputAdapter.AddViewHolder) {
-                bindAddView((CustomerBillInputAdapter.AddViewHolder) holder, model, position);
-            } else if (holder instanceof CustomerBillInputAdapter.EnclosureViewHolder) {
-                bindEnclosureView((CustomerBillInputAdapter.EnclosureViewHolder) holder, model, position);
-            } else if (holder instanceof AddcontentViewHolder) {
-                bindAddContentView((AddcontentViewHolder) holder, model, position);
-            }
-        } catch (Exception e) {
-            LogUtil.i("gong", position + "  e=" + e.getMessage());
+        if (holder instanceof AddcontentViewHolder) {
+            bindAddContentView((AddcontentViewHolder) holder);
+        } else {
+            super.onBindViewHolder(holder, position);
         }
-
     }
 
-    private void bindAddContentView(AddcontentViewHolder holder, BillGroupModel.BillModel model, int position) {
+    public void bindAddContentView(AddcontentViewHolder holder) {
         holder.saveContactSv.setOnCheckedChangeListener(new SwitchView.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(View view, boolean isChecked) {
@@ -309,264 +99,5 @@ public class CustomerBillInputAdapter extends RecyclerView.Adapter<CustomerBillI
         });
     }
 
-    //绑定附件字段
-    private void bindEnclosureView(CustomerBillInputAdapter.EnclosureViewHolder holder, BillGroupModel.BillModel model, int position) {
-        if (model != null) {
-            holder.captionTv.setText(model.getCaption());
-            holder.muchInputTv.setVisibility(model.getAllowBlank().equals("T") ? View.GONE : View.VISIBLE);
-            CustomerBillInputAdapter.EnclosureAdapter mEnclosureAdapter = null;
-            if (holder.ffGv.getTag(R.id.tag_key) != null && holder.ffGv.getTag(R.id.tag_key) instanceof CustomerBillInputAdapter.EnclosureAdapter) {
-                mEnclosureAdapter = (CustomerBillInputAdapter.EnclosureAdapter) holder.ffGv.getTag(R.id.tag_key);
-                mEnclosureAdapter.setLocalDatas(model.getLocalDatas());
-                mEnclosureAdapter.setPosition(position);
-            } else {
-                mEnclosureAdapter = new CustomerBillInputAdapter.EnclosureAdapter(position, model.getLocalDatas());
-            }
-            holder.ffGv.setAdapter(mEnclosureAdapter);
-            holder.ffGv.setTag(model);
-            holder.ffGv.setTag(R.id.tag_key2, position);
-        }
-    }
-
-
-    private void bindAddView(CustomerBillInputAdapter.AddViewHolder mAddViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
-        if (model != null) {
-            mAddViewHolder.addTv.setTag(model.getGroupIndex());
-            mAddViewHolder.addTv.setOnClickListener(mOnClickListener);
-        }
-    }
 
-    private void bindInputView(CustomerBillInputAdapter.InputViewHolder mInputViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
-        if (model != null) {
-            if (mInputViewHolder.valuesEd.getTag() != null && mInputViewHolder.valuesEd.getTag() instanceof CustomerBillInputAdapter.TextChangListener) {
-                mInputViewHolder.valuesEd.removeTextChangedListener((CustomerBillInputAdapter.TextChangListener) mInputViewHolder.valuesEd.getTag());
-            }
-            mInputViewHolder.captionTv.setText(model.getCaption());
-            mInputViewHolder.muchInputTv.setVisibility(model.getAllowBlank().equals("F") ? View.VISIBLE : View.GONE);
-            mInputViewHolder.valuesEd.setText(model.getValue());
-            if (model.getReadOnly().equals("T")) {
-                mInputViewHolder.valuesEd.setFocusable(false);
-                mInputViewHolder.valuesEd.setClickable(true);
-                mInputViewHolder.valuesEd.setOnClickListener(null);
-            } else if (BillTypeChangeUtils.isSelect(model.getType())) {
-                //选择类型
-                mInputViewHolder.valuesEd.setHint("请选择");
-                mInputViewHolder.valuesEd.setFocusable(false);
-                mInputViewHolder.valuesEd.setClickable(true);
-                mInputViewHolder.selectIv.setVisibility(View.VISIBLE);
-                mInputViewHolder.valuesEd.setTag(R.id.tag, position);
-                mInputViewHolder.valuesEd.setTag(R.id.tag2, model);
-                mInputViewHolder.valuesEd.setOnClickListener(mOnClickListener);
-            } else {
-                //输入类型
-                mInputViewHolder.valuesEd.setHint("请输入");
-                mInputViewHolder.selectIv.setVisibility(View.GONE);
-                mInputViewHolder.valuesEd.setFocusable(true);
-                mInputViewHolder.valuesEd.setClickable(false);
-                mInputViewHolder.valuesEd.setFocusableInTouchMode(true);
-                CustomerBillInputAdapter.TextChangListener mTextChangListener = new CustomerBillInputAdapter.TextChangListener(mInputViewHolder.valuesEd, position);
-                mInputViewHolder.valuesEd.setTag(mTextChangListener);
-                mInputViewHolder.valuesEd.addTextChangedListener(mTextChangListener);
-                mInputViewHolder.valuesEd.setOnClickListener(null);
-            }
-
-        }
-    }
-
-    private void bindTitleView(CustomerBillInputAdapter.TitleViewHolder mTitleViewHolder, BillGroupModel.BillModel model, int position) throws Exception {
-        if (model != null) {
-            if (model.getAllowBlank().equals("T")) {
-                mTitleViewHolder.deleteTv.setVisibility(View.VISIBLE);
-                mTitleViewHolder.deleteTv.setTag(model.getGroupIndex());
-                mTitleViewHolder.deleteTv.setOnClickListener(mOnClickListener);
-            } else {
-                mTitleViewHolder.deleteTv.setVisibility(View.GONE);
-                mTitleViewHolder.deleteTv.setOnClickListener(null);
-            }
-            mTitleViewHolder.tvTitle.setText(model.getCaption());
-        }
-    }
-
-    private AdapterView.OnItemClickListener mOnItemClickListener = new AdapterView.OnItemClickListener() {
-        @Override
-        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
-            if (mOnAdapterListener != null && adapterView.getTag() != null && adapterView.getTag(R.id.tag_key2) != null) {
-                if (adapterView.getTag() instanceof BillGroupModel.BillModel && adapterView.getTag(R.id.tag_key2) instanceof Integer) {
-                    int itemIndex = (int) adapterView.getTag(R.id.tag_key2);
-                    BillGroupModel.BillModel model = (BillGroupModel.BillModel) adapterView.getTag();
-                    mOnAdapterListener.toEnclosureSelect(position);
-                }
-            }
-        }
-    };
-    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
-        @Override
-        public void onClick(View view) {
-            if (view.getId() == R.id.deleteTv) {
-                if (view.getTag() != null && view.getTag() instanceof Integer) {
-                    showDeleteGroup((Integer) view.getTag());
-                }
-            } else if (view.getId() == R.id.valuesEd) {
-                if (mOnAdapterListener != null) {
-                    if (view.getTag(R.id.tag2) != null && view.getTag(R.id.tag2) instanceof BillGroupModel.BillModel) {
-                        int position = view.getTag(R.id.tag) != null && view.getTag(R.id.tag) instanceof Integer ? ((int) view.getTag(R.id.tag)) : 0;
-                        mOnAdapterListener.toSelect(position, (BillGroupModel.BillModel) view.getTag(R.id.tag2));
-                    }
-                }
-
-            } else if (view.getId() == R.id.addTv) {
-                if (view.getTag() != null && view.getTag() instanceof Integer) {
-                    int groupIndex = (int) view.getTag();
-                    BillGroupModel mBillGroupModel = mBillGroupModels.get(groupIndex);
-                    mBillGroupModel.setLastInType(false);
-                    BillGroupModel newBillGroupModel = new BillGroupModel();
-                    newBillGroupModel.setForm(mBillGroupModel.isForm());
-                    newBillGroupModel.setGroup(mBillGroupModel.getGroup());
-                    newBillGroupModel.setDeleteAble(true);
-                    newBillGroupModel.setLastInType(true);
-                    for (BillGroupModel.BillModel e : mBillGroupModel.getShowBillFields()) {
-                        newBillGroupModel.addShow(new BillGroupModel.BillModel(e));
-                    }
-                    mBillGroupModels.add(groupIndex + 1, newBillGroupModel);
-                    setBillGroupModels(mBillGroupModels);
-                    notifyDataSetChanged();
-
-                }
-            } else if (R.id.btn_del == view.getId()) {
-                if (view.getTag(R.id.tag_key) != null && view.getTag(R.id.tag_key2) != null
-                        && view.getTag(R.id.tag_key) instanceof Integer && view.getTag(R.id.tag_key2) instanceof Integer) {
-                    int position = (int) view.getTag(R.id.tag_key2);//当前在主列表的item
-                    int index = (int) view.getTag(R.id.tag_key);//当前在子列表的item
-                    if (position >= 0 && position < ListUtils.getSize(mShowBillModels)
-                            && ListUtils.getSize(mShowBillModels.get(position).getLocalDatas()) > index) {
-                        mShowBillModels.get(position).getLocalDatas().remove(index);
-                        notifyItemChanged(position);
-                    }
-                }
-            } else if (R.id.content == view.getId()) {
-                if (view.getTag(R.id.tag_key2) != null && view.getTag(R.id.tag_key2) instanceof Integer) {
-                    int position = (int) view.getTag(R.id.tag_key2);//当前在主列表的item
-                    if (mOnAdapterListener != null && position >= 0 && position < ListUtils.getSize(mShowBillModels)) {
-                        mOnAdapterListener.toEnclosureSelect(position);
-                    }
-                }
-            }
-        }
-    };
-
-
-    private class TextChangListener extends EditChangeListener {
-        EditText ed;
-        private int position;
-
-        public TextChangListener(EditText ed, int position) {
-            this.ed = ed;
-            this.position = position;
-        }
-
-        @Override
-        public void afterTextChanged(Editable s) {
-            if (this.position >= 0 && mShowBillModels != null && mShowBillModels.size() > this.position && ed != null) {
-                String valueEt = ed.getText().toString();
-                mShowBillModels.get(this.position).setValue(valueEt == null ? "" : valueEt);
-            }
-        }
-    }
-
-
-    private void showDeleteGroup(final int groupIndex) {
-        new VeriftyDialog.Builder(ct)
-                .setTitle(ct.getString(R.string.app_name))
-                .setContent("是否确认删除该单据?")
-                .build(new VeriftyDialog.OnDialogClickListener() {
-                    @Override
-                    public void result(boolean clickSure) {
-                        if (clickSure) {
-                            if (mBillGroupModels != null && mBillGroupModels.size() > groupIndex && groupIndex >= 0) {
-                                boolean isLastItem = mBillGroupModels.get(groupIndex).isLastInType();
-                                if (isLastItem && groupIndex - 1 > 0 && !mBillGroupModels.get(groupIndex - 1).isForm()) {
-                                    mBillGroupModels.get(groupIndex - 1).setLastInType(true);
-                                }
-                                mBillGroupModels.remove(groupIndex);
-                                setBillGroupModels(mBillGroupModels);
-                                notifyDataSetChanged();
-                            }
-                        }
-                    }
-                });
-
-    }
-
-
-    public interface OnAdapterListener {
-        void toSelect(int position, BillGroupModel.BillModel model);
-
-        void toEnclosureSelect(int position);
-    }
-
-    private class EnclosureAdapter extends BaseAdapter {
-        private int position;
-        private List<BillGroupModel.LocalData> localDatas;
-
-        public EnclosureAdapter(int position, List<BillGroupModel.LocalData> localDatas) {
-            this.position = position;
-            this.localDatas = localDatas;
-        }
-
-        public void setPosition(int position) {
-            this.position = position;
-        }
-
-        public void setLocalDatas(List<BillGroupModel.LocalData> localDatas) {
-            this.localDatas = localDatas;
-        }
-
-        @Override
-        public int getCount() {
-            return ListUtils.getSize(localDatas) < 9 ? (ListUtils.getSize(localDatas) + 1) : ListUtils.getSize(localDatas);
-        }
-
-        @Override
-        public Object getItem(int i) {
-            return localDatas.get(i);
-        }
-
-        @Override
-        public long getItemId(int i) {
-            return i;
-        }
-
-        @Override
-        public View getView(int i, View view, ViewGroup viewGroup) {
-            view = getLayoutInflater().inflate(R.layout.item_bill_enclosure_item, null);
-            ImageView content = (ImageView) view.findViewById(R.id.content);
-            TextView tvName = (TextView) view.findViewById(R.id.tv_name);
-            Button btnDel = (Button) view.findViewById(R.id.btn_del);
-            if (ListUtils.getSize(localDatas) > i) {
-                BillGroupModel.LocalData data = localDatas.get(i);
-                btnDel.setVisibility(View.VISIBLE);
-                String name = data.value == null ? "" : data.value;
-                tvName.setText(name);
-                btnDel.setTag(R.id.tag_key2, position);
-                btnDel.setTag(R.id.tag_key, i);
-                btnDel.setOnClickListener(mOnClickListener);
-                if (isImage(name)) {
-                    ImageLoaderUtil.getInstance().loadImage(data.display, content);
-                }
-            } else {
-                tvName.setText("");
-                btnDel.setVisibility(View.GONE);
-                content.setImageResource(R.drawable.add_picture);
-                content.setTag(R.id.tag_key2, position);
-                content.setOnClickListener(mOnClickListener);
-            }
-            return view;
-        }
-    }
-
-    private boolean isImage(String name) {
-        return name.toUpperCase().endsWith("JPEG")
-                || name.toUpperCase().endsWith("JPG")
-                || name.toUpperCase().endsWith("PNG");
-    }
 }

+ 6 - 269
app_modular/appworks/src/main/java/com/uas/appworks/crm3_0/activity/CustomerBillInputActivity.java

@@ -1,79 +1,27 @@
 package com.uas.appworks.crm3_0.activity;
 
-import android.app.Activity;
 import android.content.Intent;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.v7.widget.DividerItemDecoration;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.text.TextUtils;
-import android.view.Menu;
+
 import android.view.MenuItem;
-import android.widget.LinearLayout;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.common.LogUtil;
-import com.common.data.CalendarUtil;
-import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
-import com.common.data.StringUtil;
-import com.common.file.FileUtils;
 import com.core.app.Constants;
-import com.core.base.OABaseActivity;
-import com.core.model.SelectBean;
-import com.core.utils.time.wheel.DateTimePicker;
-import com.core.widget.view.Activity.SelectActivity;
 import com.modular.apputils.activity.BillInputActivity;
-import com.modular.apputils.activity.SelectNetAcitivty;
+import com.modular.apputils.adapter.BillAdapter;
 import com.modular.apputils.model.BillGroupModel;
-import com.modular.apputils.presenter.BillPresenter;
-import com.modular.apputils.presenter.imp.IBill;
 import com.uas.appworks.R;
 import com.uas.appworks.adapter.CustomerBillInputAdapter;
 
-import java.io.File;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
 /**
  * 客户|预录入客户录入界面
  */
-public class CustomerBillInputActivity extends OABaseActivity implements IBill {
-    private final int REQUESTCODE_C = 0x11;
-    private final int REQUESTCODE_DB_FIND = 0x12;
-    private final int REQUESTCODE_ENCLOSURE = 0x13;
-
-    private RecyclerView mRecyclerView;
-    private BillPresenter mBillPresenter;
-    private CustomerBillInputAdapter mBillAdapter;
-    private int selectPosition = -1;//当前选择调转界面的index,本来不想添加全局变量的,没有办法
-
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_bill_input);
-        initView();
-        mBillPresenter = new BillPresenter(this, this);
-        mBillPresenter.start(getIntent());
-    }
-
-
+public class CustomerBillInputActivity extends BillInputActivity {
     @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.menu_bill_input, menu);
-        return super.onCreateOptionsMenu(menu);
-    }
-
-    //更新菜单时候
-    @Override
-    public boolean onPrepareOptionsMenu(Menu menu) {
-        MenuItem itemMenu = menu.findItem(R.id.saveAndSubmit);
-        return super.onPrepareOptionsMenu(menu);
+    public BillAdapter newBillAdapter(List<BillGroupModel> groupModels) {
+        return new CustomerBillInputAdapter(ct, groupModels, mOnAdapterListener);
     }
 
     @Override
@@ -89,27 +37,10 @@ public class CustomerBillInputActivity extends OABaseActivity implements IBill {
         return super.onOptionsItemSelected(item);
     }
 
-    private void initView() {
-        mRecyclerView = findViewById(R.id.mRecyclerView);
-        mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
-        mRecyclerView.addItemDecoration(new DividerItemDecoration(ct, LinearLayout.VERTICAL));
-    }
-
-    @Override
-    public void setAdapter(List<BillGroupModel> groupModels) {
-        if (mBillAdapter == null) {
-            mBillAdapter = new CustomerBillInputAdapter(ct, groupModels, mOnAdapterListener);
-            mRecyclerView.setAdapter(mBillAdapter);
-        } else {
-            mBillAdapter.setBillGroupModels(groupModels);
-            mBillAdapter.notifyDataSetChanged();
-        }
-    }
-
     @Override
     public void commitSuccess() {
         ToastMessage("提交成功!");
-        if (mBillAdapter.isAddContact()) {
+        if (((CustomerBillInputAdapter) mBillAdapter).isAddContact()) {
             HashMap<String, String> hashMap = new HashMap<>();
             List<BillGroupModel> mGroupModels = mBillAdapter.getBillGroupModels();
             for (BillGroupModel e : mGroupModels) {
@@ -132,199 +63,5 @@ public class CustomerBillInputActivity extends OABaseActivity implements IBill {
         finish();
     }
 
-    @Override
-    public void updateFileOk() {
-        dimssLoading();
-        mBillPresenter.saveAndSubmit(mBillAdapter.getBillGroupModels());
-    }
-
-    private CustomerBillInputAdapter.OnAdapterListener mOnAdapterListener = new CustomerBillInputAdapter.OnAdapterListener() {
-        @Override
-        public void toSelect(int position, BillGroupModel.BillModel model) {
-            if (TextUtils.isEmpty(model.getType())) return;
-            if (!ListUtils.isEmpty(model.getLocalDatas())) {
-                //本地数据不为空的情况下
-                selectByLocal(position, model);
-            } else {
-                //本地数据为空,获取网络数据
-                switch (model.getType()) {
-                    case "D"://日期选择
-                        showDateDialog(true, position);
-                        break;
-                    case "T"://时间选择
-                        showDateDialog(true, position);
-                        break;
-                    case "SF":
-                    case "DF":
-                        //DBFind 选择
-                        findBydbFind(model);
-                        break;
-                    case "MF":
-                        break;
-
-                }
-            }
-        }
 
-        @Override
-        public void toEnclosureSelect(int position) {
-            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
-            //intent.setType(“image/*”);//选择图片
-            //intent.setType(“audio/*”); //选择音频
-            //intent.setType(“video/*”); //选择视频 (mp4 3gp 是android支持的视频格式)
-            //intent.setType(“video/*;image/*”);//同时选择视频和图片
-            selectPosition = position;
-            intent.setType("*/*");//无类型限制
-            intent.addCategory(Intent.CATEGORY_OPENABLE);
-            startActivityForResult(intent, REQUESTCODE_ENCLOSURE);
-        }
-    };
-
-    /**
-     * 选择日期
-     */
-    public void showDateDialog(final boolean needTime, final int position) {
-        DateTimePicker picker = new DateTimePicker(this, needTime ? DateTimePicker.HOUR_OF_DAY : DateTimePicker.YEAR_MONTH_DAY);
-        picker.setRange(CalendarUtil.getYear() - 10, CalendarUtil.getYear() + 10);
-        if (needTime) {
-            picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay(), CalendarUtil.getHour(), CalendarUtil.getMinute());
-        } else {
-            picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
-        }
-        picker.setOnDateTimePickListener(new DateTimePicker.OnYearMonthDayTimePickListener() {
-            @Override
-            public void onDateTimePicked(String year, String month, String day, String hour, String minute) {
-                String date = year + "-" + month + "-" + day;
-                if (needTime) {
-                    date += " " + hour + ":" + minute + ":00";
-                }
-                mBillAdapter.updateBillModelValues(position, date, date);
-            }
-        });
-
-        picker.show();
-    }
-
-    /**
-     * dbfind 查找
-     *
-     * @param model
-     */
-    private void findBydbFind(BillGroupModel.BillModel model) {
-        String gridCaller = "";
-        String fieldKey = model.getField();
-        BillGroupModel mGroupModel = mBillAdapter.getBillGroupModel(model.getGroupIndex());
-        boolean isForm = mGroupModel == null || mGroupModel.isForm();
-        LogUtil.i("gong", "isForm=" + isForm);
-        if (!isForm && !StringUtil.isEmpty(model.getFindFunctionName())) {
-            String[] mFindFunctionNames = model.getFindFunctionName().split("\\|");
-            if (mFindFunctionNames != null && mFindFunctionNames.length > 1) {
-                gridCaller = mFindFunctionNames[0];
-//                fieldKey = mFindFunctionNames[1];
-            }
-        }
-        startActivityForResult(new Intent(ct, SelectNetAcitivty.class)
-                        .putExtra("fieldKey", fieldKey)
-                        .putExtra("caller", mBillPresenter.getFormCaller())
-                        .putExtra("gCaller", gridCaller)
-                        .putExtra("isDevice", false)
-                        .putExtra("isForm", isForm)
-                        .putExtra("groupId", model.getGroupIndex())
-                , REQUESTCODE_DB_FIND);
-    }
-
-    /**
-     * 选择本地数据选项
-     *
-     * @param position 索引
-     * @param model    点击对象
-     */
-    private void selectByLocal(int position, BillGroupModel.BillModel model) {
-        ArrayList<SelectBean> beans = new ArrayList<>();
-        SelectBean bean;
-        for (BillGroupModel.LocalData localData : model.getLocalDatas()) {
-            bean = new SelectBean();
-            bean.setJson(localData.value);
-            bean.setShowName(localData.display);
-            bean.setName(localData.display);
-            bean.setIndex(position);
-            beans.add(bean);
-        }
-        Intent intent = new Intent(ct, SelectActivity.class);
-        intent.putExtra("type", 2);
-        intent.putParcelableArrayListExtra("data", beans);
-        intent.putExtra("title", model.getCaption());
-        startActivityForResult(intent, REQUESTCODE_C);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        if (data == null) return;
-        switch (requestCode) {
-            case REQUESTCODE_C:
-                SelectBean mSelectBeanC = data.getParcelableExtra("data");
-                if (mSelectBeanC != null) {
-                    int position = mSelectBeanC.getIndex();
-                    String display = StringUtil.isEmpty(mSelectBeanC.getShowName()) ? "" : mSelectBeanC.getShowName();
-                    String value = StringUtil.isEmpty(mSelectBeanC.getJson()) ? "" : mSelectBeanC.getJson();
-                    mBillAdapter.updateBillModelValues(position, value, display);
-                }
-                break;
-            case REQUESTCODE_DB_FIND:
-                String json = data.getStringExtra("data");
-                int groupIndex = data.getIntExtra("groupId", 0);
-                LogUtil.i("gong", "groupIndex=" + groupIndex);
-                handlerSelectDbFind(JSON.parseObject(json), groupIndex);
-                break;
-            case 0x22:
-                SelectBean d = data.getParcelableExtra("data");
-                if (d == null) return;
-                String name = StringUtil.isEmpty(d.getName()) ? "" : d.getName();
-                String nodeId = StringUtil.isEmpty(d.getJson()) ? "" : d.getJson();
-                mBillPresenter.getEmnameByReturn(name, nodeId);
-                break;
-            case REQUESTCODE_ENCLOSURE:
-                if (resultCode == Activity.RESULT_OK) {
-                    String path;
-                    Uri uri = data.getData();
-                    if ("file".equalsIgnoreCase(uri.getScheme())) {//使用第三方应用打开
-                        path = uri.getPath();
-                    } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {//4.4以后
-                        path = FileUtils.getPath(this, uri);
-                    } else {//4.4以下下系统调用方法
-                        path = FileUtils.getRealPathFromURI(this, uri);
-                    }
-                    File file = new File(path);
-                    if (file != null && file.exists() && file.isFile()) {
-                        String value = file.getName();
-                        String display = path;
-                        mBillAdapter.addBillModelData(selectPosition, value, display);
-                        selectPosition = -1;
-                    }
-                }
-                break;
-        }
-    }
-
-    private void handlerSelectDbFind(JSONObject object, int groupId) {
-        BillGroupModel mBillGroupModel = mBillAdapter.getBillGroupModel(groupId);
-        if (mBillGroupModel != null) {
-            if (!ListUtils.isEmpty(mBillGroupModel.getShowBillFields())) {
-                for (BillGroupModel.BillModel e : mBillGroupModel.getShowBillFields()) {
-                    if (object.containsKey(e.getField())) {
-                        e.setValue(JSONUtil.getText(object, e.getField()));
-                    }
-                }
-            }
-            if (!ListUtils.isEmpty(mBillGroupModel.getHideBillFields())) {
-                for (BillGroupModel.BillModel e : mBillGroupModel.getHideBillFields()) {
-                    if (object.containsKey(e.getField())) {
-                        e.setValue(JSONUtil.getText(object, e.getField()));
-                    }
-                }
-            }
-        }
-        mBillAdapter.notifyDataSetChanged();
-    }
 }