将Excel中的数据批量导入数据库表

时间:2024-03-05 18:37:09

 

private boolean import_to_database(String excel_path) throws BiffException, IOException, HsException{
        File file = new File(excel_path);//根据文件名创建一个文件对象
        Workbook wb = Workbook.getWorkbook(file);//从文件流中取得Excel工作区对象
        Sheet sheet = wb.getSheet(0);//从工作区中取得页,取得这个对象的时候既可以用名称来获得,也可以用序号。
            for(int i=0; i < sheet.getRows() && sheet.getRows()>1; i++){
                if( i == 0) i++;
                Cell[] cells = sheet.getRow(i);
                boolean data_check = checkData(cells, i);
                if(data_check){
                    DxjgxxDao dxjgxxDao = new DxjgxxDao(request, response);
                    try {
                        Dxjgxx dxjgxx = dxjgxxDao.getDxjgxxFromCells(cells);
                        String sql = "select j.dxjgdm from jg_dxjg j where j.dxjgdm =\'"+ dxjgxx.getDxjgdm() +"\'";
                        List liIs = this.findSql(sql);
                        String sqlUpt = "";
                        if (liIs != null && liIs.size() > 0) {
                            sqlUpt = dxjgxxDao.GetUpdate(dxjgxx);
                        }else{
                            sqlUpt = dxjgxxDao.GetInsert(dxjgxx);
                        }
                        this.exeSql(sqlUpt);
                    } catch (Exception e) {
                        e.printStackTrace();
                        this.info("第" + i + "条数据插入失败!" + e);
                    }
                }
                cells = null;
            }
        }
        sheet = null;
        wb = null;
        file = null;
        return true;
    }

 

Dxjgxx.java

package com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.entity;

import java.io.Serializable;

public class Dxjgxx implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = -4132343551478205249L;
    
    private String dxjgdm;
    private String dxjglx;
    private String zjclfs;
    private String dxjgmc;
    private String dxjgqc;
    private String dxgljg;
    private String dxjgzt;
    private String gsdm;
    private String gspgdj;
    private String gsdz;
    private String frdbxm;
    private String lxrxm;
    private String lxrdh;
    private String zjgjzhmc;
    private String zjgjzh;
    private String zjgjzhkhh;
    private String fyzhmc;
    private String fyzh;
    private String fyzhkhh;
    private Double fyfcbl;
    private String ysqwcfs;
    private String apex1;
    private String apex2;
    private String apex3;
    
    public Dxjgxx() {
        super();
        // TODO Auto-generated constructor stub
    }

    public Dxjgxx(String dxjgdm, String dxjglx, String zjclfs, String dxjgmc,
            String dxjgqc, String dxgljg, String dxjgzt, String gsdm,
            String gspgdj, String gsdz, String frdbxm, String lxrxm,
            String lxrdh, String zjgjzhmc, String zjgjzh, String zjgjzhkhh,
            String fyzhmc, String fyzh, String fyzhkhh, Double fyfcbl,
            String ysqwcfs, String apex1, String apex2, String apex3) {
        super();
        this.dxjgdm = dxjgdm;
        this.dxjglx = dxjglx;
        this.zjclfs = zjclfs;
        this.dxjgmc = dxjgmc;
        this.dxjgqc = dxjgqc;
        this.dxgljg = dxgljg;
        this.dxjgzt = dxjgzt;
        this.gsdm = gsdm;
        this.gspgdj = gspgdj;
        this.gsdz = gsdz;
        this.frdbxm = frdbxm;
        this.lxrxm = lxrxm;
        this.lxrdh = lxrdh;
        this.zjgjzhmc = zjgjzhmc;
        this.zjgjzh = zjgjzh;
        this.zjgjzhkhh = zjgjzhkhh;
        this.fyzhmc = fyzhmc;
        this.fyzh = fyzh;
        this.fyzhkhh = fyzhkhh;
        this.fyfcbl = fyfcbl;
        this.ysqwcfs = ysqwcfs;
        this.apex1 = apex1;
        this.apex2 = apex2;
        this.apex3 = apex3;
    }

    public String getDxjgdm() {
        return dxjgdm;
    }

    public void setDxjgdm(String dxjgdm) {
        this.dxjgdm = dxjgdm;
    }

    public String getDxjglx() {
        return dxjglx;
    }

    public void setDxjglx(String dxjglx) {
        this.dxjglx = dxjglx;
    }

    public String getZjclfs() {
        return zjclfs;
    }

    public void setZjclfs(String zjclfs) {
        this.zjclfs = zjclfs;
    }

    public String getDxjgmc() {
        return dxjgmc;
    }

    public void setDxjgmc(String dxjgmc) {
        this.dxjgmc = dxjgmc;
    }

    public String getDxjgqc() {
        return dxjgqc;
    }

    public void setDxjgqc(String dxjgqc) {
        this.dxjgqc = dxjgqc;
    }

    public String getDxgljg() {
        return dxgljg;
    }

    public void setDxgljg(String dxgljg) {
        this.dxgljg = dxgljg;
    }

    public String getDxjgzt() {
        return dxjgzt;
    }

    public void setDxjgzt(String dxjgzt) {
        this.dxjgzt = dxjgzt;
    }

    public String getGsdm() {
        return gsdm;
    }

    public void setGsdm(String gsdm) {
        this.gsdm = gsdm;
    }

    public String getGspgdj() {
        return gspgdj;
    }

    public void setGspgdj(String gspgdj) {
        this.gspgdj = gspgdj;
    }

    public String getGsdz() {
        return gsdz;
    }

    public void setGsdz(String gsdz) {
        this.gsdz = gsdz;
    }

    public String getFrdbxm() {
        return frdbxm;
    }

    public void setFrdbxm(String frdbxm) {
        this.frdbxm = frdbxm;
    }

    public String getLxrxm() {
        return lxrxm;
    }

    public void setLxrxm(String lxrxm) {
        this.lxrxm = lxrxm;
    }

    public String getLxrdh() {
        return lxrdh;
    }

    public void setLxrdh(String lxrdh) {
        this.lxrdh = lxrdh;
    }

    public String getZjgjzhmc() {
        return zjgjzhmc;
    }

    public void setZjgjzhmc(String zjgjzhmc) {
        this.zjgjzhmc = zjgjzhmc;
    }

    public String getZjgjzh() {
        return zjgjzh;
    }

    public void setZjgjzh(String zjgjzh) {
        this.zjgjzh = zjgjzh;
    }

    public String getZjgjzhkhh() {
        return zjgjzhkhh;
    }

    public void setZjgjzhkhh(String zjgjzhkhh) {
        this.zjgjzhkhh = zjgjzhkhh;
    }

    public String getFyzhmc() {
        return fyzhmc;
    }

    public void setFyzhmc(String fyzhmc) {
        this.fyzhmc = fyzhmc;
    }

    public String getFyzh() {
        return fyzh;
    }

    public void setFyzh(String fyzh) {
        this.fyzh = fyzh;
    }

    public String getFyzhkhh() {
        return fyzhkhh;
    }

    public void setFyzhkhh(String fyzhkhh) {
        this.fyzhkhh = fyzhkhh;
    }

    public Double getFyfcbl() {
        return fyfcbl;
    }

    public void setFyfcbl(Double fyfcbl) {
        this.fyfcbl = fyfcbl;
    }

    public String getYsqwcfs() {
        return ysqwcfs;
    }

    public void setYsqwcfs(String ysqwcfs) {
        this.ysqwcfs = ysqwcfs;
    }

    public String getApex1() {
        return apex1;
    }

    public void setApex1(String apex1) {
        this.apex1 = apex1;
    }

    public String getApex2() {
        return apex2;
    }

    public void setApex2(String apex2) {
        this.apex2 = apex2;
    }

    public String getApex3() {
        return apex3;
    }

    public void setApex3(String apex3) {
        this.apex3 = apex3;
    }
    
}

DxjgxxDao.java

package com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.dao;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import jxl.Cell;

import com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.entity.Dxjgxx;
import com.hundsun.tamcx.util.HsException;

public class DxjgxxDao {
    
    HttpServletRequest request = null;
    HttpServletResponse response = null;
    
    public DxjgxxDao(HttpServletRequest request, HttpServletResponse response) throws HsException {
        super();
        this.request = request;
        this.response = response;
    }

    public String select(String dxjgdm, String dxjglx, String whereStr) throws HsException {
        /*begin edit by wsm 20131217 */
        String sql = "select j.*,k.apbz1 from jg_dxjg j " +
                " left join jg_dxjgkz k on j.dxjgdm=k.dxjgdm ";
                //" where 1=1 ";
        String sql_where = "";
        if (dxjgdm != null && !dxjgdm.equals("")){
            if(sql_where == null || (sql_where.trim()).equals("")){
                sql_where += " where j.dxjgdm = \'" + dxjgdm.trim() + "\'";
            }else{
                sql_where += " and j.dxjgdm = \'" + dxjgdm.trim() + "\'";
            }
        }
        if (dxjglx != null && !dxjglx.equals("")){
            if(sql_where == null || (sql_where.trim()).equals("")){
                sql_where += " where j.dxjglx = \'" + dxjglx.trim() + "\'";
            }else{
                sql_where += " and j.dxjglx = \'" + dxjglx.trim() + "\'";
            }
        }
        if (whereStr != null && !whereStr.equals("")){
            if(sql_where == null || (sql_where.trim()).equals("")){
                sql += " where " + whereStr;
            }else{
                sql += " and " + whereStr;
            }
        }
        sql +=     sql_where;
        sql +=" order by j.dxjgdm desc";
        return sql;
        /* end */
    }

    public Dxjgxx GetObjectFromRequest(HttpServletRequest request) {
        // TODO Auto-generated method stub
        Dxjgxx dxjgxx = new Dxjgxx();
        String dxjgdm = $("dxjgdm");
        dxjgxx.setDxjgdm(dxjgdm);
        String dxjglx = $("dxjglx");
        dxjgxx.setDxjglx(dxjglx);
        String zjclfs = $("zjclfs");
        dxjgxx.setZjclfs(zjclfs);
        String dxjgmc = $("dxjgmc");
        dxjgxx.setDxjgmc(dxjgmc);
        String dxjgqc = $("dxjgqc");
        dxjgxx.setDxjgqc(dxjgqc);
        String dxgljg = $("dxgljg");
        dxjgxx.setDxgljg(dxgljg);
        String dxjgzt = $("dxjgzt");
        dxjgxx.setDxjgzt(dxjgzt);
        String gsdm = $("gsdm");
        dxjgxx.setGsdm(gsdm);
        String gspgdj = $("gspgdj");
        dxjgxx.setGspgdj(gspgdj);
        String gsdz = $("gsdz");
        dxjgxx.setGsdz(gsdz);
        String frdbxm = $("frdbxm");
        dxjgxx.setFrdbxm(frdbxm);
        String lxrxm = $("lxrxm");
        dxjgxx.setLxrxm(lxrxm);
        String lxrdh = $("lxrdh");
        dxjgxx.setLxrdh(lxrdh);
        String zjgjzhmc = $("zjgjzhmc");
        dxjgxx.setZjgjzhmc(zjgjzhmc);
        String zjgjzh = $("zjgjzh");
        dxjgxx.setZjgjzh(zjgjzh);
        String zjgjzhkhh = $("zjgjzhkhh");
        dxjgxx.setZjgjzhkhh(zjgjzhkhh);
        String fyzhmc = $("fyzhmc");
        dxjgxx.setFyzhmc(fyzhmc);
        String fyzh = $("fyzh");
        dxjgxx.setFyzh(fyzh);
        String fyzhkhh = $("fyzhkhh");
        dxjgxx.setFyzhkhh(fyzhkhh);
        String fyfcbl = $("fyfcbl");
        if(fyfcbl==null||fyfcbl.equals("")){
            fyfcbl = "0.0";
        }
        dxjgxx.setFyfcbl(Double.parseDouble(fyfcbl)/100);
        String ysqwcfs = $("ysqwcfs");
        dxjgxx.setYsqwcfs(ysqwcfs);
        String apex1 = $("apex1");
        dxjgxx.setApex1(apex1);
        String apex2 = $("apex2");
        dxjgxx.setApex2(apex2);
        String apex3 = $("apex3");
        dxjgxx.setApex3(apex3);
        
        return dxjgxx;
    }
    
    public String $(String key) {
        try {
            return request.getParameter(key) == null ? "" : request.getParameter(key);
        } catch (Exception e) {
            return "";
        }
    }

    /**
     * 获得插入数据SQL
     * 
     * @param 对象
     * @param Dxjgxx
     * @return String
     * @throws HsException
     */
    public String GetInsert(Dxjgxx dxjgxx) throws HsException {
        // TODO Auto-generated method stub
        String sql = "INSERT INTO jg_dxjg(dxjgdm, dxjglx, zjclfs, dxjgmc, dxjgqc, dxgljg, dxjgzt, gsdm, gspgdj, gsdz, frdbxm, lxrxm, lxrdh, zjgjzhmc, zjgjzh, zjgjzhkhh, fyzhmc, fyzh, fyzhkhh, fyfcbl,ysqwcfs, apex1, apex2, apex3) VALUES (\'";  
        sql += dxjgxx.getDxjgdm() + "\', \'";
        sql += dxjgxx.getDxjglx() + "\', \'";
        sql += dxjgxx.getZjclfs() + "\', \'";
        sql += dxjgxx.getDxjgmc() + "\', \'";
        sql += dxjgxx.getDxjgqc() + "\', \'";
        sql += dxjgxx.getDxgljg() + "\', \'";
        sql += dxjgxx.getDxjgzt() + "\', \'";
        sql += dxjgxx.getGsdm() + "\', \'";
        sql += dxjgxx.getGspgdj() + "\', \'";
        sql += dxjgxx.getGsdz() + "\', \'";
        sql += dxjgxx.getFrdbxm() + "\', \'";
        sql += dxjgxx.getLxrxm() + "\', \'";
        sql += dxjgxx.getLxrdh() + "\', \'";
        sql += dxjgxx.getZjgjzhmc() + "\', \'";
        sql += dxjgxx.getZjgjzh() + "\', \'";
        sql += dxjgxx.getZjgjzhkhh() + "\', \'";
        sql += dxjgxx.getFyzhmc() + "\', \'";
        sql += dxjgxx.getFyzh() + "\', \'";
        sql += dxjgxx.getFyzhkhh() + "\', ";
        sql += dxjgxx.getFyfcbl() + ", \'";
        sql += dxjgxx.getYsqwcfs() + "\', \'";
        sql += dxjgxx.getApex1() + "\', \'";
        sql += dxjgxx.getApex2() + "\', \'";
        sql += dxjgxx.getApex3() + "\')";
        return sql;
    }
    

    public String GetUpdate(Dxjgxx dxjgxx) {
        String sql = "UPDATE jg_dxjg SET ";  
        sql += "dxjglx=\'"+ dxjgxx.getDxjglx() + "\',";
        sql += "zjclfs=\'" + dxjgxx.getZjclfs() + "\', ";
        sql += "dxjgmc=\'" + dxjgxx.getDxjgmc() + "\', ";
        sql += "dxjgqc=\'" + dxjgxx.getDxjgqc() + "\', ";
        sql += "dxgljg=\'" + dxjgxx.getDxgljg() + "\', ";
        sql += "dxjgzt=\'" + dxjgxx.getDxjgzt() + "\', ";
        sql += "gsdm=\'" + dxjgxx.getGsdm() + "\', ";
        sql += "gspgdj=\'" + dxjgxx.getGspgdj() + "\', ";
        sql += "gsdz=\'" + dxjgxx.getGsdz() + "\', ";
        sql += "frdbxm=\'" + dxjgxx.getFrdbxm() + "\', ";
        sql += "lxrxm=\'"+ dxjgxx.getLxrxm() + "\', ";
        sql += "lxrdh=\'" + dxjgxx.getLxrdh() + "\', ";
        sql += "zjgjzhmc=\'" + dxjgxx.getZjgjzhmc() + "\', ";
        sql += "zjgjzh=\'" + dxjgxx.getZjgjzh() + "\', ";
        sql += "zjgjzhkhh=\'" + dxjgxx.getZjgjzhkhh() + "\', ";
        sql += "fyzhmc=\'" + dxjgxx.getFyzhmc() + "\', ";
        sql += "fyzh=\'" + dxjgxx.getFyzh() + "\', ";
        sql += "fyzhkhh=\'" + dxjgxx.getFyzhkhh() + "\', ";
        sql += "fyfcbl=" + dxjgxx.getFyfcbl() + ", ";
        sql += "ysqwcfs=\'" + dxjgxx.getYsqwcfs() + "\' ";
        sql += " where dxjgdm= \'" +dxjgxx.getDxjgdm() +"\'";
        return sql;
    }
    
    public Dxjgxx getDxjgxxFromCells(Cell[] cells){
        Dxjgxx dxjgxx = new Dxjgxx();
        if(cells.length >= 1){
            dxjgxx.setDxjglx(cells[0].getContents().trim().split("-")[0]);
        }else{
            dxjgxx.setDxjglx("");
        }
        if(cells.length >= 2){
            dxjgxx.setDxjgdm(cells[1].getContents().trim());
        }else{
            dxjgxx.setDxjgdm("");
        }
        if(cells.length >= 3){
            dxjgxx.setDxjgmc(cells[2].getContents().trim());
        }else{
            dxjgxx.setDxjgmc("");
        }
        if(cells.length >= 4){
            dxjgxx.setDxjgqc(cells[3].getContents().trim());
        }else{
            dxjgxx.setDxjgqc("");
        }
        if(cells.length >= 5){
            dxjgxx.setDxgljg(cells[4].getContents().trim());
        }else{
            dxjgxx.setDxgljg("");
        }
        if(cells.length >= 6){
            dxjgxx.setZjclfs(cells[5].getContents().trim().split("-")[0]);
        }else{
            dxjgxx.setZjclfs("");
        }
        if(cells.length >= 7){
            dxjgxx.setGsdm(cells[6].getContents().trim());
        }else{
            dxjgxx.setGsdm("");
        }
        if(cells.length >= 8){
            dxjgxx.setGspgdj(cells[7].getContents().trim());
        }else{
            dxjgxx.setGspgdj("");
        }
        if(cells.length >= 9){
            dxjgxx.setGsdz(cells[8].getContents().trim());
        }else{
            dxjgxx.setGsdz("");
        }
        if(cells.length >= 10){
            dxjgxx.setFrdbxm(cells[9].getContents().trim());
        }else{
            dxjgxx.setFrdbxm("");
        }
        if(cells.length >= 11){
            dxjgxx.setDxjgzt(cells[10].getContents().trim().split("-")[0]);
        }else{
            dxjgxx.setDxjgzt("");
        }
        if(cells.length >= 12){
            dxjgxx.setYsqwcfs(cells[11].getContents().trim().split("-")[0]);
        }else{
            dxjgxx.setYsqwcfs("");
        }
        if(cells.length >= 13){
            dxjgxx.setLxrxm(cells[12].getContents().trim());
        }else{
            dxjgxx.setLxrxm("");
        }
        if(cells.length >= 14){
            dxjgxx.setLxrdh(cells[13].getContents().trim());
        }else{
            dxjgxx.setLxrdh("");
        }
        if(cells.length >= 15){
            dxjgxx.setZjgjzhmc(cells[14].getContents().trim());
        }else{
            dxjgxx.setZjgjzhmc("");
        }
        if(cells.length >= 16){
            dxjgxx.setZjgjzh(cells[15].getContents().trim());
        }else{
            dxjgxx.setZjgjzh("");
        }
        if(cells.length >= 17){
            dxjgxx.setZjgjzhkhh(cells[16].getContents().trim());
        }else{
            dxjgxx.setZjgjzhkhh("");
        }
        if(cells.length >= 18){
            dxjgxx.setFyzhmc(cells[17].getContents().trim());
        }else{
            dxjgxx.setFyzhmc("");
        }
        if(cells.length >= 19){
            dxjgxx.setFyzh(cells[18].getContents().trim());
        }else{
            dxjgxx.setFyzh("");
        }
        if(cells.length >= 20){
            dxjgxx.setFyzhkhh(cells[19].getContents().trim());
        }else{
            dxjgxx.setFyzhkhh("");
        }
        if(cells.length >= 21){
            dxjgxx.setFyfcbl(Double.parseDouble(cells[20].getContents().trim()));
        }else{
            dxjgxx.setFyfcbl(0.0);
        }
        
        dxjgxx.setApex1("");
        dxjgxx.setApex2("");
        dxjgxx.setApex3("");
        return dxjgxx;
    }

}

DxjgxxCtl.java

/*******************************************************************************
 文件名称: 
 系统名称: 
 模块名称:  项目管理
 软件版权:  
 系统版本: 2.1
 开发人员: 温盛明
 开发时间: 2013-08-29
 审核人员: 相关文档: 修改记录: 修改日期
 修改人员 修改说明
 ******************************************************************************/
package com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.ctl;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpSession;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import com.hundsun.tamcx.system.base.PageInfo;
import com.hundsun.tamcx.system.ctl.HibernateBaseCtl;
import com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.dao.DxjgxxDao;
import com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.dao.DxjgxxkzDao;
import com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.entity.Dxjgxx;
import com.hundsun.tamcx.tycfgl.ywcs.jgxxgl.entity.Dxjgxxkz;
import com.hundsun.tamcx.upload.UpDownload;
import com.hundsun.tamcx.util.HsException;
import com.hundsun.tamcx.util.BeansUtil.SqlBeanUtil;
import com.hundsun.tamcx.util.ajax.AjaxTools;

/*******************************************************************************
 * <p>组件执行抽象类</p>
 * <br>组件基础类,所有组件的基类,主要包括对基础数据的操作和处理,session的处理等等
 * @author
 * @date 2013-08-29
 ******************************************************************************/
public class DxjgxxCtl extends HibernateBaseCtl {
    public String[][] lpDict = {};
    public String[][] gbismDict = {{"dxjgzt","T_DXJGZT"},{"dxjglx","T_DXJGLX"}};
    public int succ_num = 0;
    public int fail_num = 0;
    public String imp_message = "";
    
    @Override
    public void doControl() throws HsException {
        try{
            if(subTranCode.equals("def")){
            }else if(subTranCode.equals("list")){
                list();
            }else if(subTranCode.equals("add")){
                add();
            }else if(subTranCode.equals("del")){
                delete();
            }else if(subTranCode.equals("upt")){
                update();
            }else if(subTranCode.equals("downTmplate")){
                downTmplate();
            }else if(subTranCode.equals("modkz")){
                modkz();
            }
        }catch(HsException e){
            $Error("【"+e.getErrCode()+"】"+e.getMessage());
        }catch(Exception e){
            $Error(e.getMessage());
        }
    }
    
    private void modkz() throws HsException {
        DxjgxxkzDao dxjgkzDao = new DxjgxxkzDao(request, response);
        Dxjgxxkz dxjgkz = dxjgkzDao.GetObjectFromRequest(request);
        String sqlUpt="";
        try {
            String sql = "select * from jg_dxjgkz where dxjgdm =\'"+dxjgkz.getDxjgdm()+"\'";
            List liIs = this.findSql(sql);
            if (liIs != null && liIs.size() > 0) {
                sqlUpt = dxjgkzDao.GetUpdate(dxjgkz);
            }else{
                sqlUpt = dxjgkzDao.GetInsert(dxjgkz);
            }
            this.exeSql(sqlUpt);
            this.dataLog("维护 代销机构扩展参数[" + dxjgkz.getDxjgdm() +"]", "");
        } catch (Exception e) {
            e.printStackTrace();
        }
        AjaxTools.exAjax("{success:true}", response);
    }

    private void downTmplate() throws HsException {
        String fileName = "";
        try {
            fileName = URLDecoder.decode("dxjgxx_template.xls","utf-8");
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        UpDownload upDown = new UpDownload();
        upDown.init(config, request, response);
        try {
            upDown.down2Client("/import_template/"+fileName);
            //AjaxTools.exAjax("{success:true}", response);
        } catch (Exception e) {
            e.printStackTrace();
            AjaxTools.exAjax("{success:false,msg:\"下载文件失败!\"}", response);
        }
    }

    private void update() throws HsException  {
        DxjgxxDao dxjgxxDao = new DxjgxxDao(request, response);
        Dxjgxx dxjgxx = dxjgxxDao.GetObjectFromRequest(request);
        
        HashMap ht = new HashMap();
        
        String strWhere = " dxjgdm = \'" + dxjgxx.getDxjgdm() +  "\'";
        String sqlUpt;
        try {
            sqlUpt = SqlBeanUtil.uptTdBeanPinSQL(dxjgxx, "jg_dxjg",
                    strWhere, ht);
            this.exeSql(sqlUpt);
            
            this.dataLog("更新 代销机构信息[" + dxjgxx.getDxjgdm() +"]", "");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        AjaxTools.exAjax("{success:true}", response);
    }

    public void list()throws HsException {
        String dxjgdm = $("dxjgdm_sel");
        String dxjglx = $("dxjglx_sel");// prjauthdept
        String whereStr = $("whereStr");
        DxjgxxDao dxjgxxDao = new DxjgxxDao(request, response);
        String sql = dxjgxxDao.select(dxjgdm, dxjglx, whereStr);
        String excel = $("excel_sel");
        String fromexcel = $("fromexcel_sel");
        String getProgress_sel = $("getProgress_sel");
        if(excel!=null&&!excel.equals("")&&excel.equals("true")){
            try {
                List dictList = new ArrayList();
                toExcel(sql,dictList);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return;
        }
        if(fromexcel!=null&&!fromexcel.equals("")&&fromexcel.equals("true")){
            try {
                fromExcel();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return;
        }
        if(getProgress_sel!=null&&!getProgress_sel.equals("")&&getProgress_sel.equals("true")){
            try {
                getProgress();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return;
        }
        if ($("loading") != null && $("loading").equals("true")) {
            PageInfo.ajaxJDBCToPage(response, request, sql, PageInfo.PAGE_NUM,
                    PageInfo.DEF_DICT, this.logid);
            return;
        }
        PageInfo.ajaxJDBCToPage(response, request, sql, PageInfo.PAGE_NUM,
                lpDict, gbismDict, this.logid);
    }
    
    private void add() throws HsException {
        DxjgxxDao dxjgxxDao = new DxjgxxDao(request, response);
        Dxjgxx dxjgxx = dxjgxxDao.GetObjectFromRequest(request);
        String sqlUpt;
        try {
            String sql = "select * from jg_dxjg where dxjgdm =\'"+dxjgxx.getDxjgdm()+"\'";
            List liIs = this.findSql(sql);
            if (liIs != null && liIs.size() > 0) {
                AjaxTools.exAjax("{\"success\":false,msg:\"  代销机构代码["
                        + dxjgxx.getDxjgdm()+ "],与数据库中数据重复,请重新填写!\"}", response);
                return;
            }        
            sqlUpt = dxjgxxDao.GetInsert(dxjgxx);
            this.exeSql(sqlUpt);
            this.dataLog("增加 代销机构信息[" + dxjgxx.getDxjgdm() +"]", "");
        } catch (Exception e) {
            e.printStackTrace();
        }
        AjaxTools.exAjax("{success:true}", response);
    }

    public void delete() throws HsException {
        String[] dxjgdm_del = request.getParameterValues("dxjgdm_del");
        
        if (dxjgdm_del.length > 0) {
            List<String> delList = new ArrayList<String>();
            for (int i = 0; i < dxjgdm_del.length; i++) {
                String dxjgdm = dxjgdm_del[i];
                delList.add("delete from jg_dxjg where dxjgdm =\'"+dxjgdm.trim()+"\'" );
                delList.add("delete from jg_dxjgkz where dxjgdm =\'"+dxjgdm.trim()+"\'" );
                this.dataLog("删除代销机构信息[" + dxjgdm + "]", "4");
            }
            this.exeSql(delList);
            AjaxTools.exAjax("{success:true}", response);
        }
    }
    
    public void toExcel(String sql,List dictList)throws Exception {
        List list = this.findSql(sql);
//        if(dictList!=null&&dictList.size()>0){
//            list = DictHelpDao.convertList(list, dictList,this.logid);
//        }
        String[][] header = {{"代销机构代码","dxjgdm"},{"代销机构名称","dxjgmc"},{"状态","dxjgzt"},{"代销机构类型","dxjglx"},{"代销管理机构","dxgljg"},{"组织机构代码","gsdm"},{"公司地址","gsdz"},
                {"法人代表姓名","frdbxm"},{"联系人姓名","lxrxm"},{"联系人电话","lxrdh"}};
        PageInfo.listToExcel(request, response, "代销机构信息", list, header,lpDict,gbismDict, this.logid);

    }
    
    @SuppressWarnings("unchecked")
    private void fromExcel() throws IOException, HsException {
           FileItemFactory factory = new DiskFileItemFactory(); 
           ServletFileUpload fileload = new ServletFileUpload(factory);      
           fileload.setSizeMax(4194304); 
           boolean is_excel = false;
           try { 
               List<FileItem> fileItems = (List<FileItem>) fileload.parseRequest(request); 
               Iterator<FileItem> iter = fileItems.iterator(); // 依次处理每个上传的文件
               while (iter.hasNext()) { 
                   FileItem item = (FileItem) iter.next();// 忽略其他不是文件域的所有表单信息 
                   if (!item.isFormField()) { 
                       String name = item.getName();//获取上传文件名,包括路径  
                       //String file_type = name.split("\\.")[1];
                       String file_type = name.substring(name.lastIndexOf(".")+1, name.length());;
                       String fileName = name.substring(name.lastIndexOf("\\")+1, name.length());
                       if(file_type.equals("xls")){
//                           if(file_type.equals("xls") || file_type.equals("xlsx")){
                           is_excel = true;
                       }else{
                           is_excel = false;
                          // AjaxTools.exAjax("{\"success\":false,msg:\"  导入文件不对,请确认!\"}", response);
                           AjaxTools.exAjax("{success:false}", response);
                           return;
                       }
                       if (name != null && is_excel) {
                           String path = request.getRealPath("/dxjgload");
                           File uploadedFile = new File(path);
                           if(!uploadedFile.exists()){
                                uploadedFile.mkdir();
                            }
                           path = path+"/"+fileName;
                           uploadedFile = new File(path);
                           item.write(uploadedFile);
                           boolean im = import_to_database(path);
                           
                           if(im){
                               //System.out.println("文件:" + name + "上传成功,大小是" + item.getSize()); 
                               AjaxTools.exAjax("{\"success\":true,msg:\" 成功["
                                       + succ_num + "]条,失败["+ fail_num +"]条:<br>"+ imp_message +"\"}", response);
                               succ_num = 0;
                               fail_num = 0;
                               imp_message = "";
                               return;
                           }else{
                              // AjaxTools.exAjax("{\"success\":false,msg:\"  导入失败!\"}", response);
                               AjaxTools.exAjax("{success:false}", response);
                               return;
                           }  
                       } 
                   } 
               }
           } catch (Exception e) {
               
           } 
    }
    
    private boolean import_to_database(String excel_path) throws BiffException, IOException, HsException{
        File file = new File(excel_path);//根据文件名创建一个文件对象
        Workbook wb = Workbook.getWorkbook(file);//从文件流中取得Excel工作区对象
        Sheet sheet = wb.getSheet(0);//从工作区中取得页,取得这个对象的时候既可以用名称来获得,也可以用序号。
        HttpSession session = request.getSession();
        session.setAttribute("dxjg_total_rows"+userInfo.getUserId(), sheet.getRows());
        if(sheet.getColumns() < 21){
            this.info("导入Excel列数不对");
            return false;
        }else{
            if(sheet.getRows()<=1){
                //imp_message = imp_message + "导入Excel格式不对或为空模板,请确认!";
                this.info("导入Excel格式不对或为空模板,请确认!" );
                //AjaxTools.exAjax("{\"success\":false,msg:\"  导入Excel格式不对或为空模板,请确认!\"}", response);
                AjaxTools.exAjax("{success:false}", response);
            }
            for(int i=0; i < sheet.getRows() && sheet.getRows()>1; i++){
                if( i == 0) i++;
                Cell[] cells = sheet.getRow(i);
                boolean data_check = checkData(cells, i);
                if(data_check){
                    DxjgxxDao dxjgxxDao = new DxjgxxDao(request, response);
                    try {
                        Dxjgxx dxjgxx = dxjgxxDao.getDxjgxxFromCells(cells);
                        String sql = "select j.dxjgdm from jg_dxjg j where j.dxjgdm =\'"+ dxjgxx.getDxjgdm() +"\'";
                        List liIs = this.findSql(sql);
                        String sqlUpt = "";
                        if (liIs != null && liIs.size() > 0) {
                            sqlUpt = dxjgxxDao.GetUpdate(dxjgxx);
                        }else{
                            sqlUpt = dxjgxxDao.GetInsert(dxjgxx);
                        }
                        this.exeSql(sqlUpt);
                        succ_num ++;
                    } catch (Exception e) {
                        fail_num ++;
                        e.printStackTrace();
                        imp_message = imp_message + "第" + i + "条数据插入失败!" + e;
                        this.info("第" + i + "条数据插入失败!" + e);
                    }
                }else{
                    fail_num ++;
                }
                session.setAttribute("dxjg_current_row"+userInfo.getUserId(), i);
                cells = null;
            }
        }
        sheet = null;
        wb = null;
        file = null;
        session.removeAttribute("dxjg_current_row"+userInfo.getUserId());
        session.removeAttribute("dxjg_total_rows"+userInfo.getUserId());
        return true;
    }
    
    private boolean checkData(Cell[] cells, int i) throws HsException{
        boolean data_check = true;
        if(cells.length >=2 && (cells[1].getContents().trim() == null || cells[1].getContents().trim().equals(""))){
            imp_message = imp_message + "第" + i + "条数据的代销机构代码不能为空!<br>";
            this.info("第" + i + "条数据的代销机构代码不能为空!");
            data_check = false;
        }else if(cells.length >=1 && (cells[0].getContents().trim() == null || cells[0].getContents().trim().equals(""))){
            imp_message = imp_message + "第" + i + "条数据的代销机构类型不能为空!<br>";
            this.info("第" + i + "条数据的代销机构类型不能为空!");
            data_check = false;
        }else if(cells.length >= 6 && (cells[5].getContents().trim() == null || cells[5].getContents().trim().equals(""))){
            imp_message = imp_message + "第" + i + "条数据的资金处理方式不能为空!<br>";
            this.info("第" + i + "条数据的资金处理方式不能为空!");
            data_check = false;
        }
        
        if(cells.length >= 1 && !(cells[0].getContents().trim() == null || cells[0].getContents().trim().equals("")) && data_check){
            String str = cells[0].getContents().trim().split("-")[0];
            try {
                Integer.parseInt(str);
            } catch (Exception e) {
                imp_message = imp_message + "第" + i + "条数据的代销机构类型格式不正确!<br>";
                this.info("第" + i + "条数据的代销机构类型格式不正确!"+ e);
                data_check = false;
            }
        }
        
        if(cells.length >= 6 && !(cells[5].getContents().trim() == null || cells[5].getContents().trim().equals(""))&& data_check){
            String str = cells[5].getContents().trim().split("-")[0];
            try {
                Integer.parseInt(str);
            } catch (Exception e) {
                imp_message = imp_message + "第" + i + "条数据的资金处理方式格式不正确!<br>";
                this.info("第" + i + "条数据的资金处理方式格式不正确!"+e);
                data_check = false;
            }
        }
        
        if(data_check && cells.length < 6){
            imp_message = imp_message + "第" + i + "条数据的必输字段不能为空!<br>";
            this.info("第" + i + "条数据的必输字段不能为空!");
            data_check = false;
        }

        return data_check;
    }
    
    private void getProgress() throws HsException {
        try {
            HttpSession session = request.getSession();
            AjaxTools.exAjax("{\"success\":true,msg:\""+ session.getAttribute("dxjg_total_rows"+userInfo.getUserId()) +"-" + session.getAttribute("dxjg_current_row"+userInfo.getUserId()) + "\"}", response);
        } catch (HsException e) {
            e.printStackTrace();
            AjaxTools.exAjax("{success:false}", response);
        }
    }
}

ywcs_dxjgxx.js

var total_rows = 0;
var current_row = 0;
var up_flag = true;

var storeDxjgxx = new Ext.data.GroupingStore({
    proxy : new Ext.data.HttpProxy({
        url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()
                + \'&subTranCode=list\'
    }),
    reader : new Ext.data.JsonReader({
        root : \'hstamcx\',
        totalProperty : "results",
        fields : [ "dxjgdm","dxjglx","zjclfs","dxjgmc","dxjgqc","dxgljg","dxjgzt","gsdm","gspgdj",
                     "gsdz","frdbxm","lxrxm","lxrdh","zjgjzhmc","zjgjzh","zjgjzhkhh","fyzhmc",
                   "fyzh","fyzhkhh","fyfcbl", "ysqwcfs","apex1","apex2","apex3","apbz1"]
    }),
    sortInfo : {
        field : \'dxjgdm\',
        direction : \'DESC\'
    },// 排序信息
    groupField : \'dxjgdm\'
});

storeDxjgxx.on(\'load\',function(){
        for (var i = 0; i < storeDxjgxx.getCount(); i++) {
            var record = storeDxjgxx.getAt(i);
            
            var fyfcbl=record.get(\'fyfcbl\');
            record.set(\'fyfcbl\',accMul(fyfcbl,100));

            //var zgsyje=record.get(\'zgsyje\');
            //var zgsyje2=rendererZhMoney(zgsyje);
            //record.set(\'zgsyje\',zgsyje2);
       }
    storeDxjgxx.commitChanges();   
});

// **************************************
var smDxjginfo = new Ext.grid.CheckboxSelectionModel();
// *******列模型

var colQd = new Ext.grid.ColumnModel([smDxjginfo, 
    {header : "代销机构代码",    dataIndex : "dxjgdm",    width : 124}, 
    {header : "代销机构名称",    dataIndex : "dxjgmc",    width : 140}, 
    {header : "状态",    dataIndex : "dxjgzt",    width : 60}, 
    {header : "代销机构类型",    dataIndex : "dxjglx",    width : 80}, 
    {header : "代销管理分行",    dataIndex : "dxgljg",    width : 124}, 
    {header : "组织机构代码",    dataIndex : "gsdm",    width : 124}, 
    {header : "公司地址",    dataIndex : "gsdz",    width : 140}, 
    {header : "法人代表姓名",    dataIndex : "frdbxm",    width : 100}, 
    {header : "联系人姓名",    dataIndex : "lxrxm",    width : 100}, 
    {header : "联系人电话",    dataIndex : "lxrdh",    width : 100}
]);
/*
var dxjglxBox = new Hs.app.ComboBox({
    mode : \'local\',
    hiddenName : \'dxjglx\',
    fieldLabel : \'代销机构类型\',
    editable : false,
    width : 130,
    url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_DXJGLX\'&dictFlag=true"
});
*/
var dxjglxStat = new Ext.data.Store({
    proxy : new Ext.data.HttpProxy({
        url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_DXJGLX\'&dictFlag=true"
    }),
     reader :new Ext.data.JsonReader({
        root : \'dict\',
        //totalProperty : "results",
        fields : ["key","value"]
    }),
    remoteSort : true
});
dxjglxStat.load();
var dxjglxBox = new Ext.form.ComboBox({
    mode : \'local\',
    hiddenName : \'dxjglx\',
    fieldLabel : \'代销机构类型\',
    listWidth : 300,
    valueField : \'key\',
    displayField : \'value\',
    width : 130,
    typeAhead : true,
    editable : true,
    triggerAction : \'all\',
    resizable : true,
    emptyText : \'请选择代销机构类型...\',
    enableKeyEvents: true, 
    selectOnFocus:true,    
    forceSelection : true,
    store : dxjglxStat,
    listeners : {
        select : function(combo, record, index) {
          changeDxjgdm(combo.value);
        }
    }
});


var dxjgdmStat = new Ext.data.Store({
    proxy : new Ext.data.HttpProxy({
        url : "dictId.dict?dateTime="
            + new Date().getTime()
            + "&subTranCode=dbo&tableName=jg_dxjg&key=dxjgdm&value=dxjgmc&dictFlag=true"
    }),
     reader :new Ext.data.JsonReader({
        root : \'dict\',
        //totalProperty : "results",
        fields : ["key","value"]
    }),
    remoteSort : true
});
dxjgdmStat.load();

var dxjgdmBox = new Ext.form.ComboBox({
    mode : \'local\',
    hiddenName : \'dxjgdm\',
    fieldLabel : \'代销机构代码\',
    listWidth : 300,
    valueField : \'key\',
    displayField : \'value\',
    width : 130,
    typeAhead : true,
    editable : true,
    triggerAction : \'all\',
    resizable : true,
    emptyText : \'请选择代销机构代码...\',
    enableKeyEvents: true, 
    selectOnFocus:true,    
    forceSelection : true,
    store : dxjgdmStat
});

function changeDxjgdm(dxjglx){
    var whereStr = "";
    if(dxjglx!=""){
        whereStr +=" dxjglx=\'"+dxjglx+"\' ";
    }
    dxjgdmStat.proxy = new Ext.data.HttpProxy({
        url : "dictId.dict?dateTime="
            + new Date().getTime()
            + "&subTranCode=dbo&tableName=jg_dxjg&key=dxjgdm&value=dxjgmc&dictFlag=true&whereStr="+whereStr
    });    
   dxjgdmStat.load();
   dxjgdmBox.setValue(\'\');
}

// GRID定义
var gridDxjgxx = new Ext.grid.GridPanel({
    id : \'dxjgxx_grid\',
    title : \'[代销机构信息]设置\',
    height : 800,
    stripeRows : true,
    bodyStyle : \'width:100%\',
    disableSelection : true,
    cm : colQd,
    viewConfig : {
        forceFit : false
    },
    store : storeDxjgxx,
    iconCls : \'details\',
    animCollapse : true,
    trackMouseOver : false,
    loadMask : {
        msg : \'正在加载[代销机构信息]信息,请稍侯……\'
    },
    selModel : smDxjginfo,
    tbar : [\'-\',new Ext.form.Label({
        text : \'代销机构类型:\'
    }),\'-\',dxjglxBox,\'-\',new Ext.form.Label({
        text : \'代销机构代码:\'
    }),dxjgdmBox, \'-\', {
        pressed : true,
        text : \'&nbsp;&nbsp;查&nbsp;&nbsp;&nbsp;&nbsp;询&nbsp;&nbsp;&nbsp;&nbsp;\',
        iconCls : \'yes\',
        handler : selinfo
    }],
    bbar : new Ext.PagingToolbar({
        pageSize : 20,
        store : storeDxjgxx,
        displayInfo : true,
        emptyMsg : \'没有记录\'
    }),
    listeners : {
         //將第二個bar渲染到tbar裏面,通过listeners事件   
        \'render\' : function() {  
           tbar2.render(this.tbar);     
        }
    }
});



//查询按钮放在tbar的第二行
var tbar2 = new Ext.Toolbar({   
        renderTo : Ext.grid.GridPanel.tbar,// 其中grid是上边创建的grid容器 
        items : [\'-\',{
        pressed : true,
        text : \'&nbsp;&nbsp;增&nbsp;&nbsp;&nbsp;&nbsp;加&nbsp;&nbsp;&nbsp;&nbsp;\',
        iconCls : \'add\',
        handler : addDxjg
    }, \'-\',{
        pressed : true,
        text : \'&nbsp;&nbsp;删&nbsp;&nbsp;&nbsp;&nbsp;除&nbsp;&nbsp;&nbsp;&nbsp;\',
        iconCls : \'remove\',
        handler : delDxjg
    },\'-\',{
        pressed : true,
        text : \'&nbsp;&nbsp;导&nbsp;&nbsp;&nbsp;&nbsp;出&nbsp;&nbsp;&nbsp;&nbsp;\',
        iconCls : \'excel\',
        handler : doExcel
    },\'-\',{
        pressed : true,
        text : \'&nbsp;&nbsp;导&nbsp;&nbsp;&nbsp;&nbsp;入&nbsp;&nbsp;&nbsp;&nbsp;\',
        iconCls : \'excel\',
        handler : fromExcel
    },\'-\',{
        pressed : true,
        text : \'&nbsp;&nbsp;下&nbsp;载&nbsp;导&nbsp;入&nbsp;模&nbsp;板&nbsp;&nbsp;\',
        iconCls : \'excel\',
        handler : downTmplate
    },\'-\',{
        pressed : true,
        text : \'&nbsp;&nbsp;扩&nbsp;展&nbsp;参&nbsp;数&nbsp;&nbsp;\',
        iconCls : \'add\',
        handler : kzcs
    }]   
}); 

function selinfo() {
    var dxjgdm_sel = Ext.get("dxjgdm").getValue();
    var dxjglx_sel = Ext.get("dxjglx").getValue();
    var params = {};
    params.dxjgdm_sel = dxjgdm_sel;
    params.dxjglx_sel = dxjglx_sel;
    //params.whereStr = "";
    storeDxjgxx.baseParams = params;
    storeDxjgxx.load({
        callback : function(r, options, success) {
            if (success == false) {
                Ext.Msg.alert("错误", storeDxjgxx.reader.jsonData.msg);
            }
        }
    });
}

function delDxjg() {
    if (Ext.getCmp("dxjgxx_grid").getSelectionModel().hasSelection()) {
        Ext.MessageBox.confirm(\'Message\', \'请问您真的要删除所选数据么?\', function(btn) {
            if (btn == \'yes\') {
                var ids_dxjgdm = new Array();
                var records = Ext.getCmp("dxjgxx_grid").getSelectionModel()
                        .getSelections();
                for (var i = 0, len = records.length; i < len; i++) {
                    ids_dxjgdm[i] = records[i].data["dxjgdm"];
                }
                Ext.Ajax.request({
                    url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()
                            + \'&subTranCode=del\',
                    params : {
                        dxjgdm_del : ids_dxjgdm
                    },
                    success : function(response, options) {
                        var response = Ext.util.JSON
                                .decode(response.responseText);
                        if (response.success) {
                            Ext.getCmp(\'dxjgxx_grid\').getStore().reload(); // 刷新Grid
                            Hs.util.Msg(\'信息\', "删除[代销机构信息]成功!");
                        } else if (!response.success) {
                            Hs.util.Msg(\'信息\', "删除[代销机构信息]信息失败,如有问题请联系系统管理员!"
                                    + response.msg);
                        }
                    }
                });
            }
        })
    } else {
        Hs.util.Msg(\'提示信息\', "请选择[代销机构信息]后再删除!");
    }
}

var dxjglxBox_add = new Hs.app.ComboBox({
    mode : \'local\',
    hiddenName : \'dxjglx\',
    fieldLabel : \'代销机构类型<span style="color:red">*</span>\',
    editable : false,
    allowBlank : false,
    width : 190,
    url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_DXJGLX\'&dictFlag=null"
});
var dxjgzt_add = new Hs.app.ComboBox({
    mode : \'local\',
    hiddenName : \'dxjgzt\',
    fieldLabel : \'状态\',
    editable : false,
    allowBlank : true,
    width : 190,
    url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_DXJGZT\'&dictFlag=null"
});

var zjclfs_add = new Hs.app.ComboBox({
    mode : \'local\',
    hiddenName : \'zjclfs\',
    fieldLabel : \'资金处理方式<span style="color:red">*</span>\',
    editable : false,
    allowBlank : false,
    width : 190,
    url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_YSQFS\'&dictFlag=null"
});

var ysqwcfs_add = new Hs.app.ComboBox({
    mode : \'local\',
    hiddenName : \'ysqwcfs\',
    fieldLabel : \'预授权完成方式<span style="color:red">*</span>\',
    editable : false,
    allowBlank : false,
    width : 190,
    url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_YSQWCFS\'&dictFlag=null"
});

var fieldSet_info = new Ext.form.FieldSet({
    title : \'维护[代销机构基本信息]\',
    autoHeight : false,
    width : 760,
    height : 195,
    layout : \'form\',
    labelAlign : \'right\',
    labelWidth : 110,
    items : [{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            items : [dxjglxBox_add]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'组织机构代码\',
                name : \'gsdm\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : true,
                blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'代销机构代码<span style="color:red">*</span>\',
                name : \'dxjgdm\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : false,
                blankText : \'不能为空,请填写\',
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'公司地址\',
                name : \'gsdz\',
                maxLength : 100,
                maxLengthText : \'长度超过了100个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'代销机构名称\',
                name : \'dxjgmc\',
                maxLength : 100,
                maxLengthText : \'长度超过了100个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'公司评估等级\',
                name : \'gspgdj\',
                maxLength : 10,
                maxLengthText : \'长度超过了10个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'代销机构全称\',
                name : \'dxjgqc\',
                maxLength : 250,
                maxLengthText : \'长度超过了250个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'法人代表姓名\',
                name : \'frdbxm\',
                maxLength : 40,
                maxLengthText : \'长度超过了40个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'代销管理分行\',
                name : \'dxgljg\',
                maxLength : 16,
                maxLengthText : \'长度超过了16个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'联系人姓名\',
                name : \'lxrxm\',
                maxLength : 40,
                maxLengthText : \'长度超过了40个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            items : [dxjgzt_add]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'联系人电话\',
                name : \'lxrdh\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                style : "ime-mode:disabled",
                width : 190
            }]
        }]
    }, new Ext.form.Hidden({
        id : \'key_num\',
        name : \'key_num\'
    }), new Ext.form.Hidden({
        id : \'apex1\',
        name : \'apex1\'
    }), new Ext.form.Hidden({
        id : \'apex2\',
        name : \'apex2\'
    }), new Ext.form.Hidden({
        id : \'apex3\',
        name : \'apex3\'
    })]
});

var fieldSet_acct = new Ext.form.FieldSet({
    title : \'维护[代销机构账户信息]\',
    autoHeight : false,
    width : 760,
    height : 165,
    layout : \'form\',
    labelAlign : \'right\',
    labelWidth : 110,
    items : [{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'资金归集户名\',
                name : \'zjgjzhmc\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'费用账户名称\',
                name : \'fyzhmc\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'资金归集账号\',
                id:"_zjgjzh",
                name : \'zjgjzh\',
                vtype : "number",//格式验证  
                vtypeText : "只能输入0-9之间的数字.",//错误提示信息
                maxLength : 32,
                maxLengthText : \'长度超过了32个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                style : "ime-mode:disabled",
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'费用账户\',
                id:"_fyzh",
                name : \'fyzh\',
                maxLength : 32,
                vtype : "number",//格式验证  
                vtypeText : "只能输入0-9之间的数字.",//错误提示信息,默认值我就不说了
                maxLengthText : \'长度超过了32个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                style : "ime-mode:disabled",
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'资金账号开户行\',
                name : \'zjgjzhkhh\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        },{
            columnWidth : 0.5,
            layout : "form",
            defaultType : \'textfield\',
            items : [{
                fieldLabel : \'费用账号开户行\',
                name : \'fyzhkhh\',
                maxLength : 20,
                maxLengthText : \'长度超过了20个字符\',
                allowBlank : true,
                //blankText : \'不能为空,请填写\',
                width : 190
            }]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            items : [zjclfs_add]
        },{
            columnWidth : 0.5,
            layout : "form",
            items : [new Ext.form.NumberField({
                fieldLabel : \'费用分成比例(%)\',
                name : \'fyfcbl\',
                allowBlank : true,
                allowDecimals : true,    //是否允许小数
                decimalPrecision : 4,    // 精确的位数
                allowNegative : false,    //是否允许负数
                maxValue: 100,
                style : "ime-mode:disabled",
                width :190
            })]
        }]
    },{
        layout : \'column\',
        items : [{
            columnWidth : 0.5,
            layout : "form",
            items : [ysqwcfs_add]
        }]
    }]
});
var fp = new Ext.FormPanel({
    id : \'ext_form\',
    waitMsg : \'正在提交,请稍后...\',
    frame : true,
    bodyStyle : \'padding:5px 5px 0\',
    width : 787,
    reader : new Ext.data.JsonReader({
        root : \'hstamcx\',
        totalProperty : "results",
        fields : [ "dxjgdm","dxjglx","zjclfs","dxjgmc","dxjgqc","dxgljg","dxjgzt","gsdm","gspgdj",
                     "gsdz","frdbxm","lxrxm","lxrdh","zjgjzhmc","zjgjzh","zjgjzhkhh","fyzhmc",
                   "fyzh","fyzhkhh","fyfcbl", "ysqwcfs","apex1","apex2","apex3","apbz1"]
    }),
    height : 402,
    items : [fieldSet_info,fieldSet_acct]
});

var winKey = new Ext.Window({
    id : "ext_win",
    title : \'[代销机构信息]\',
    //bodyStyle : \'overflow-x:scroll;overflow-y:scroll\',
    height : 470,
    width : 800,
    closeAction : \'hide\',
    iconCls : \'add\',
    modal : true,
    buttons : [{
        text : \'提交\',
        handler : function() {
            if (fp.form.isValid()) {
                fp.getForm().findField("dxjglx").setDisabled(false);
                fp.getForm().findField("dxjgdm").setDisabled(false);
                var url = "";
                if (fp.getForm().findField("key_num").getValue() == \'up\'){
                    url=\'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime() + \'&subTranCode=upt\';
                }else{
                    url=\'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime() + \'&subTranCode=add\';
                }
                fp.form.submit({
                    url : url,
                    waitTitle : "[代销机构信息]维护",
                    waitMsg : \'正在提交数据,请稍后... ...\',
                    success : function() {
                        Ext.getCmp(\'dxjgxx_grid\').getStore().reload(); // 刷新Grid
                        if (fp.getForm().findField("key_num").getValue() == "")
                            fp.form.reset();
                        if (fp.getForm().findField("key_num").getValue() == \'up\') {
                            winKey.hide();
                            fp.form.reset();
                        }
                        storeDxjgxx.modified = [];// 将修改过的记录置为空,如果不清空,则修改过的数据会一直保留
                        Ext.MessageBox.alert(\'提示信息\', \'维护[代销机构信息]成功!\');
                        winKey.hide();
                    },
                    failure : function(form, action) {
                        Ext.MessageBox.alert(\'提示信息\', \'维护[代销机构信息]失败,请联系系统管理员!\'
                                + action.result.msg);// +Ext.encode(action.result))//
                    }
                });
            } else {
                Hs.util.Msg(\'维护提示\', \'数据不完整!\');
            }
        }
    }, {
        text : \'取消\',
        handler : function() {
            winKey.hide();
            fp.form.reset();
        }
    }],
    items : [fp]
});
winKey.addListener("hide", function() {
    fp.form.reset();
});

function addDxjg() {
    winKey.show();
    fp.getForm().findField("dxjgdm").setDisabled(false);
    fp.getForm().findField("dxjglx").setDisabled(false);
    ysqwcfs_add.setValue(1);
    Ext.get("_zjgjzh").on(\'keyup\',function(e){
        document.getElementById("_zjgjzh").value = this.getValue().replace(/[^\d]/gi, "");
    });
    Ext.get("_fyzh").on(\'keyup\',function(e){
        document.getElementById("_fyzh").value = this.getValue().replace(/[^\d]/gi, "");
    });
}

gridDxjgxx.addListener(\'rowdblclick\', function(e) {
    if (Ext.getCmp("dxjgxx_grid").getSelectionModel().hasSelection()) {
        upType();
    }
}, gridDxjgxx);

// 修改业务信息
function upType() {
    var record = Ext.getCmp("dxjgxx_grid").getSelectionModel().getSelected();
    //var dxjgdm_sel = record.data[\'dxjgdm\'];
    //var form = fp.getForm().load({
    //    url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()
    //            + \'&subTranCode=list&loading=true&dxjgdm_sel=\' + dxjgdm_sel,
    //    waitMsg : \'Loading\'
    //});
    winKey.show();
    fp.getForm().loadRecord(record);
    fp.getForm().findField("key_num").setValue("up");
    fp.getForm().findField("dxjgdm").setDisabled(true);
    fp.getForm().findField("dxjglx").setDisabled(true);
    Ext.get("_zjgjzh").on(\'keyup\',function(e){
        document.getElementById("_zjgjzh").value = this.getValue().replace(/[^\d]/gi, "");
    });
    Ext.get("_fyzh").on(\'keyup\',function(e){
        document.getElementById("_fyzh").value = this.getValue().replace(/[^\d]/gi, "");
    });
}

function doExcel(){
    var dxjgdm_sel = Ext.get("dxjgdm").getValue();
    var dxjglx_sel = Ext.get("dxjglx").getValue();
    //var parentcode_sel = Ext.get("parentcode").getValue();
    window.location.href = \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()+ \'&subTranCode=list&dxjgdm_sel=\'+dxjgdm_sel+\'&excel_sel=true&dxjglx_sel=\'+dxjglx_sel//+\'&parentcode_sel=\'+parentcode_sel
}

function toUpdateProgress(){
       Ext.Ajax.request({
        url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()+ \'&subTranCode=list&getProgress_sel=true\',
        //params : {dxjgdm_del : ids_dxjgdm},
        success : function(response, options) {
            var response = Ext.util.JSON.decode(response.responseText);
            if (response.success) {
                total_rows = response.msg.split("-")[0];
                current_row = response.msg.split("-")[1];
                if(current_row > 0 && total_rows > 0 && current_row <= total_rows) {
                    var i = current_row / total_rows; 
                    Ext.MessageBox.updateProgress(i, Math.round(100 * i) + \'% 已经完成!\'); 
                } 
                if(up_flag) setTimeout(function(){toUpdateProgress()}, 1000)
                
                if(current_row > 0 && total_rows > 0 && current_row == total_rows) up_flag = false;
                   if(up_flag == false){
                       up_flag = true;
                       current_row = 0;
                       total_rows = 0;
                   }
            } else if (!response.success) {
                
            }
        }
    });
 }

function fromExcel(){
      var form = new Ext.form.FormPanel({
     baseCls : \'x-plain\',
     labelWidth : 150,
     fileUpload : true,
     defaultType : \'textfield\',
     items : [{
        xtype : \'textfield\',
        fieldLabel : \'请选择Excel(.xls)文件\',
        name : \'userfile\',
        id : \'userfile\',
        inputType : \'file\',
        blankText : \'File can\\'t not empty.\',
        anchor : \'100%\' // anchor width by percentage
       }]
    });

    var win = new Ext.Window({
         title : \'Excel导入\',
         width : 400,
         height : 150,
         minWidth : 300,
         minHeight : 100,
         layout : \'fit\',
         plain : true,
         bodyStyle : \'padding:5px;\',
         buttonAlign : \'center\',
         items : form,
         buttons : [{
                 text : \'导入\',
                 handler : function() {
                   if (form.form.isValid()) {
                        if(Ext.getCmp(\'userfile\').getValue() == \'\'){
                             Ext.Msg.alert(\'错误\',\'请选择你的文件\');
                             return;
                          }
                        Ext.MessageBox.show({
                               title : \'请等待\',
                               msg : \'Excel正在导入...\',
                               progressText : \'\',
                               width : 300,
                               progress : true,
                               closable : false,
                               animEl : \'loding\'
                          });
                        form.getForm().submit({
                             url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()+ \'&subTranCode=list&fromexcel_sel=true\',
                             method : \'POST\',
                             success : function(form, action) {
                                 Ext.getCmp(\'dxjgxx_grid\').getStore().reload(); // 刷新Grid
                                  Ext.MessageBox.alert(\'提示信息\', \'<div style=" max-height:300px;_height:expression(this.scrollHeight>300?\\'300px\\':\\'auto\\');overflow:auto;">\'+action.result.msg+\'</div>\');
                                  Ext.MessageBox.updateProgress(0, \'0% 已经完成!\');
                                  win.close();
                                  up_flag = false;
                             },
                             failure : function() {
                                  Ext.Msg.alert("系统提示", "文件导入失败!(上传文件类型不对或文件格式不对或为空模板)");
                                  //Ext.MessageBox.alert(\'提示信息\', \'文件导入失败!\' + action.result.msg);// +Ext.encode(action.result))//
                                  up_flag = false;
                             }
                        })
                        up_flag = true;
                        toUpdateProgress();
                       }else{
                           Ext.Msg.alert("系统提示","请选择文件后再导入!");
                       }
                  }
             }, {
                  text : \'关闭\',
                  handler : function() {
                       win.close();
                  }
             }]
        });
        win.show();
}

function downTmplate(){
    window.location.href = \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()+ \'&subTranCode=downTmplate\';
}

var dxjgdmStat_kzcs = new Ext.data.Store({
    proxy : new Ext.data.HttpProxy({
        url : "dictId.dict?dateTime="
            + new Date().getTime()
            + "&subTranCode=dbo&tableName=jg_dxjg&key=dxjgdm&value=dxjgmc&dictFlag=true"
    }),
     reader :new Ext.data.JsonReader({
        root : \'dict\',
        //totalProperty : "results",
        fields : ["key","value"]
    }),
    remoteSort : true
});
dxjgdmStat_kzcs.load();

var dxjgdmBox_kzcs = new Ext.form.ComboBox({
    fieldLabel : \'代销机构代码<span style="color:red">*</span>\',
    hiddenName : \'dxjgdm\',
    allowBlank : false,
    blankText : \'不能为空,请填写\',
    //listWidth : 340,
    store : dxjgdmStat_kzcs,
    valueField : \'key\',
    displayField : \'value\',
    typeAhead : true,
    editable : true,
    mode : \'local\',
    triggerAction : \'all\',
    resizable : true,
    emptyText : \'请选择代销机构代码...\',
    width :190,
    enableKeyEvents: true, 
    selectOnFocus:true,    
    forceSelection : true
});

var glfdthfbzBox_mod = new Hs.app.ComboBox({
    mode : \'local\',
    hiddenName : \'apbz1\',
    fieldLabel : \'管理费是否当天划付\',
    editable : false,
    allowBlank : true,
    width : 190,
    url : "dictId.dict?dateTime="
        + new Date().getTime()
        + "&subTranCode=dbo&tableName=gbism_dict&key=pval&value=prompt1&whereStr=pkey=\'T_SFBZ\'&dictFlag=null"
});

var fieldSet_kzcs = new Ext.form.FieldSet({
    title : \'维护[代销机构扩展参数]\',
    autoHeight : true,
    width : 350,
    //height : 270,
    //style:" max-height:270px;_height:expression(this.scrollHeight>270?\'270px\':\'auto\');overflow:auto;",
    layout : \'form\',
    labelAlign : \'right\',
    labelWidth : 120,
    items : [dxjgdmBox_kzcs,
            glfdthfbzBox_mod,
            new Ext.form.Hidden({
                id : \'apbz2\',
                name : \'apbz2\'
            }),new Ext.form.Hidden({
                id : \'apbz3\',
                name : \'apbz3\'
            }),new Ext.form.Hidden({
                id : \'apzf1\',
                name : \'apzf1\'
            }),new Ext.form.Hidden({
                id : \'apzf2\',
                name : \'apzf2\'
            }),new Ext.form.Hidden({
                id : \'apzf3\',
                name : \'apzf3\'
            }),new Ext.form.Hidden({
                id : \'apzs1\',
                name : \'apzs1\'
            }),new Ext.form.Hidden({
                id : \'apzs2\',
                name : \'apzs2\'
            }),new Ext.form.Hidden({
                id : \'apzs3\',
                name : \'apzs3\'
            }),new Ext.form.Hidden({
                id : \'apje1\',
                name : \'apje1\'
            }),new Ext.form.Hidden({
                id : \'apje2\',
                name : \'apje2\'
            }),new Ext.form.Hidden({
                id : \'apje3\',
                name : \'apje3\'
            }),new Ext.form.Hidden({
                id : \'apex1_kzcs\',
                name : \'apex1\'
            }), new Ext.form.Hidden({
                id : \'apex2_kzcs\',
                name : \'apex2\'
            }), new Ext.form.Hidden({
                id : \'apex3_kzcs\',
                name : \'apex3\'
            })]
});

var fp_kzcs = new Ext.FormPanel({
    id : \'ext_form_kzcs\',
    waitMsg : \'正在提交,请稍后...\',
    frame : true,
    bodyStyle : \'padding:5px 5px 0\',
    width : 380,
    reader : new Ext.data.JsonReader({
        root : \'hstamcx\',
        totalProperty : "results",
        fields : [ "dxjgdm","dxjglx","zjclfs","dxjgmc","dxjgqc","dxgljg","dxjgzt","gsdm","gspgdj",
                     "gsdz","frdbxm","lxrxm","lxrdh","zjgjzhmc","zjgjzh","zjgjzhkhh","fyzhmc",
                   "fyzh","fyzhkhh","fyfcbl", "ysqwcfs","apex1","apex2","apex3","apbz1"]
    }),
    height : 382,
    items : [fieldSet_kzcs]
});

var win_kzcs = new Ext.Window({
    id : "ext_win_kzcs",
    title : \'[代销机构扩展参数]\',
    //bodyStyle: \' max-height:370px;_height:expression(this.scrollHeight>370?"370px":"auto");overflow_y:auto;\',
    height : 200,
    //style:" max-height:370px;_height:expression(this.scrollHeight>370?\'370px\':\'auto\');overflow:auto;",
    width : 390,
    closeAction : \'hide\',
    iconCls : \'add\',
    modal : true,
    buttons : [{
        text : \'提交\',
        handler : function() {
            if (fp_kzcs.form.isValid()) {
                fp_kzcs.getForm().findField("dxjgdm").setDisabled(false);
                fp_kzcs.form.submit({
                    url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime() + \'&subTranCode=modkz\',
                    waitTitle : "[代销机构扩展参数]维护",
                    waitMsg : \'正在提交数据,请稍后... ...\',
                    success : function() {
                        Ext.getCmp(\'dxjgxx_grid\').getStore().reload(); // 刷新Grid
                        storeDxjgxx.modified = [];// 将修改过的记录置为空,如果不清空,则修改过的数据会一直保留
                        Ext.MessageBox.alert(\'提示信息\', \'维护[代销机构扩展参数]成功!\');
                        win_kzcs.hide();
                    },
                    failure : function(form, action) {
                        fp_kzcs.getForm().findField("dxjgdm").setDisabled(true);
                        Ext.MessageBox.alert(\'提示信息\', \'维护[代销机构扩展参数]失败,请联系系统管理员!\'
                                + action.result.msg);// +Ext.encode(action.result))//
                    }
                });
            }else {
                Hs.util.Msg(\'维护提示\', \'数据不完整!\');
            }
        }
    }, {
        text : \'取消\',
        handler : function() {
            win_kzcs.hide();
            fp_kzcs.form.reset();
        }
    }],
    items : [fp_kzcs]
});
win_kzcs.addListener("hide", function() {
    fp_kzcs.form.reset();
});

function kzcs(){
    if (Ext.getCmp("dxjgxx_grid").getSelectionModel().hasSelection()) {
                var record = Ext.getCmp("dxjgxx_grid").getSelectionModel().getSelections()[0];
                //var record = Ext.getCmp("dxjgxx_grid").getSelectionModel().getSelected();
                //var dxjgdm_sel = record.data[\'dxjgdm\'];
                //var form = fp.getForm().load({
                //    url : \'ywcs_dxjgxx.app?dateTime=\' + new Date().getTime()
                //            + \'&subTranCode=list&loading=true&dxjgdm_sel=\' + dxjgdm_sel,
                //    waitMsg : \'Loading\'
                //});
                win_kzcs.show();
                fp_kzcs.getForm().loadRecord(record);
                if(fp_kzcs.getForm().findField("apbz1").getValue() == ""){
                    fp_kzcs.getForm().findField("apbz1").setValue(0);
                }
                fp_kzcs.getForm().findField("dxjgdm").setDisabled(true);
    } else {
        Hs.util.Msg(\'提示信息\', "请选择[代销机构扩展信息]后再维护扩展参数!");
    }
}
 

ywcs_dxjgxx.jsp

<%@page contentType="text/html;charset=utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript"
            src="./app/js/extjs/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="./app/js/extjs/ext-all.js"></script>
    <script type="text/javascript" src="./app/js/extjs/ext-lang-zh_CN.js"></script>
    <script type="text/javascript" src="./app/js/extjs/RowExpander.js"></script>
    <script type="text/javascript" src="./app/js/extjs/Spotlight.js"></script>
    <script type="text/javascript" src="./app/js/extjs/ComboBoxTree.js"></script>
    <script type="text/javascript" src="./app/js/extjs/app/MultiSelect.js"></script>
    <script type="text/javascript" src="./app/js/extjs/app/hs_all.js"></script>
    <script type="text/javascript" src="./app/js/extjs/Algorithm.js"></script>
    <script type="text/javascript" src="./app/js/extjs/Vtypes.js"></script>
    <script type="text/javascript" src="./app/js/extjs/app/NuberFiledFormat.js"></script>
    <script type="text/javascript" src="./tycfgl/ywcs/jgxxgl/js/ywcs_dxjgxx.js"></script>

    <script type="text/javascript" src="./app/js/extjs/examples.js"></script>
    <script type=\'text/javascript\'
        src=\'systemx/extension/ext.ux/cxm-ext-util.js\'></script>
    <!--Ext UX CSS-->
    <link rel=\'stylesheet\' type=\'text/css\'
        href=\'systemx/extension/ext.ux/cxm-ext-ux.css\' />
    <link rel="stylesheet" type="text/css"
        href="./app/js/extjs/resources/css/ext-all.css" />
    <link rel="stylesheet" type="text/css" href="./app/css/edit.css" />
    <link rel="stylesheet" type="text/css"
        href="./app/css/file-upload.css" />
    <script language="javascript">
         Ext.onReady(function(){
          
             Ext.QuickTips.init(); 
          Ext.form.Field.prototype.msgTarget = \'side\';
            var port = new Ext.Viewport({
                layout : \'fit\',
                frame : true,
                items : [this.gridDxjgxx]
            });
           
        })
    </script>
  </head>
  
  <body>

  </body>
</html>