使用SSM+easyui做个简单的增删改查

先把后台的代码展示出来,有注释的,业务就是销售合同列表的增删改查

财务销售合同实体类


/**
 * 财务销售合同实体类
 * @author Liany
 */
public class SalesContract implements Serializable{
	private static final long serialVersionUID = 1L;
	//主键
	private String id;
	//客户ID 外键
	private String customerId;
	//客户单位名称
	private String unitName;
	//合同金额
	private BigDecimal money;
	//已收合同金额
	private BigDecimal acceptMoney;
	//备注
	private String remark;
	//创建人
	private String createName;
	//创建时间
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date createDate;
	//修改人
	private String modifyName;
	//修改时间
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date modifyDate;
	//删除标识
	private String deleteFlag;
	//备用字段1
	private String rev1;
	//备用字段2
	private String rev2;
	//备用字段3
	private String rev3;
	//合同名称
	private String contractName;
	//合同编号
	private String contractNo;
	//签订时间
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private Date signDate;
	//省内省外标识 0 省内 1 省外
	private String provinceOrOutside;
	//城市
	private String area;
	//负责人
	private String responsiblePerson;
	//客户类别
	private String customerCategory;
	//结存(剩余应收合同金额)
	private String unAcceptMoney;
	//已开票金额
	private String invoicedAmount;
	//已收金额总和
	private BigDecimal sumAcceptMoney;
	//客户姓名
	private String customerName;
	//记录回款记录的条数
	private String detallCount;
	//记录合同附件的条数
	private String certificateCount;
	//记录开票记录的条数
	private String salesInvoicingCount;
	//省略getter和setter
}

财务销售合同数据访问接口层

/**
 * 财务销售合同数据访问接口层
 * @author Liany
 * @since 2020/04/13
 */
public interface SalesContractDao{
	
	/**
	* 添加一条财务销售合同记录
	* @param elemType 财务销售合同对象
	* @return int 执行成功的数量
	* @throws DataAccessException
	*/
	void addFinancialSalesContract(SalesContract financialSalesContract);

	/**
	* 查询所有财务销售合同记录
	* @return 财务销售合同对象集
	* @throws DataAccessException
	*/
	public List<SalesContract> queryFinancialSalesContractList(PageBounds bounds, Map<String, Object> parameter);
	
	/**
	 * 修改销售合同列表
	 * @param financialSalesContract
	 */
	void editFinancialSalesContract(SalesContract financialSalesContract);
	
	/**
	 * 根据id删除销售合同
	 * @param id
	 */
	void delFinancialSalesContractById(String id);
	
	/**
	 * 根据id查询销售合同
	 * @param id
	 * @return
	 */
	SalesContract selFinancialSalesContractById(String id);
}

财务销售合同mapper文件

在resource/mapper/finance/SalesContractMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yhzn.dao.finance.SalesContractDao">
	<resultMap id="BaseResultMap" type="com.yhzn.model.finance.SalesContract">
		<id column="ID" property="id" jdbcType="VARCHAR" />
		<result column="CUSTOMER_ID" property="customerId" jdbcType="VARCHAR" />
		<result column="UNIT_NAME" property="unitName" jdbcType="VARCHAR" />
		<result column="ACCEPT_MONEY" property="acceptMoney" jdbcType="VARCHAR" />
		<result column="REMARK" property="remark" jdbcType="VARCHAR" />
		<result column="CREATE_NAME" property="createName" jdbcType="VARCHAR" />
		<result column="CREATE_DATE" property="createDate" jdbcType="DATE" />
		<result column="MODIFY_NAME" property="modifyName" jdbcType="VARCHAR" />
		<result column="MODIFY_DATE" property="modifyDate" jdbcType="DATE" />
		<result column="DELETE_FLAG" property="deleteFlag" jdbcType="DECIMAL" />
		<result column="REV1" property="rev1" jdbcType="VARCHAR" />
		<result column="REV2" property="rev2" jdbcType="VARCHAR" />
		<result column="REV3" property="rev3" jdbcType="VARCHAR" />
		<result column="CONTRACT_NAME" property="contractName" jdbcType="VARCHAR" />
		<result column="CONTRACT_NO" property="contractNo" jdbcType="VARCHAR" />
		<result column="SIGN_DATE" property="signDate" jdbcType="DATE" />
		<result column="PROVINCE_OR_OUTSIDE" property="provinceOrOutside" jdbcType="VARCHAR" />
		<result column="INVOICED_AMOUNT" property="invoicedAmount" jdbcType="VARCHAR" />
		<result column="MONEY" property="money" jdbcType="VARCHAR" />
		<result column="RESPONSIBLE_PERSON" property="responsiblePerson" jdbcType="VARCHAR"/>
		
	</resultMap>
	<sql id="Base_Column_List">
		ID, CUSTOMER_ID, UNIT_NAME, ACCEPT_MONEY, REMARK, CREATE_NAME,
		CREATE_DATE,
		MODIFY_NAME, MODIFY_DATE, DELETE_FLAG, REV1, REV2, REV3, CONTRACT_NAME,
		CONTRACT_NO,
		SIGN_DATE,PROVINCE_OR_OUTSIDE,INVOICED_AMOUNT,MONEY,RESPONSIBLE_PERSON<!-- ,CUSTOMER_CATEGORY -->
	</sql>

	<select id="queryFinancialSalesContractList" parameterType="map"
		resultType="com.yhzn.model.finance.SalesContract">
		SELECT
			nvl((select SUM(fd.ACCEPT_MONEY) from FINANCIAL_SALES_DETALL fd where fd.ACCEPT_ID = fs.ID),'0') as sumAcceptMoney,
			fs.money - nvl((select SUM(fe.ACCEPT_MONEY) from FINANCIAL_SALES_DETALL fe where fe.ACCEPT_ID = fs.ID),'0') as unAcceptMoney,
			nvl((select SUM(fi.INVOICED_AMOUNT) from FINANCLAL_SALES_INVOICING fi where fi.CONTRACT_ID = fs.ID),'0') as invoicedAmount,
			(select co.UNIT_NAME from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as unitName,
			(select co.AREA from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as area,
			(select co.NAME from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as customerName,	
			(select co.TYPE from CUSTOMER_INFO co where co.ID = fs.CUSTOMER_ID) as customerCategory,
			(SELECT count( id ) FROM FINANCIAL_SALES_DETALL where ACCEPT_ID=fs.ID) as detallCount,
			(SELECT count( id ) FROM CERTIFICATE where CONTRACT_ID=fs.ID) as certificateCount,
			(SELECT count( id ) FROM FINANCLAL_SALES_INVOICING where CONTRACT_ID=fs.ID) as salesInvoicingCount,
			fs.ID,
			fs.CUSTOMER_ID,
			fs.ACCEPT_MONEY,
			fs.REMARK,
			fs.CREATE_NAME,
			fs.CREATE_DATE,
			fs.MODIFY_NAME,
			fs.MODIFY_DATE,
			fs.DELETE_FLAG,
			fs.REV1,
			fs.REV2,
			fs.REV3,
			fs.CONTRACT_NAME,
			fs.CONTRACT_NO,
			fs.SIGN_DATE,
			fs.PROVINCE_OR_OUTSIDE,
			fs.INVOICED_AMOUNT,
			fs.MONEY,
			fs.RESPONSIBLE_PERSON
		FROM
			FINANCIAL_SALES_CONTRACT fs
		where 1=1
			<if test="customerId!=null and customerId!=''">
			    and fs.CUSTOMER_ID like '%${customerId}%'
			</if>
			<if test="city!=null and city!=''">
				and fs.CITY like '%${city}%'
			</if>
			<if test="contractName!=null and contractName!=''">
				and fs.CONTRACT_NAME like '%${contractName}%'
			</if>
			<if test="responsiblePerson!=null and responsiblePerson!=''">
				and fs.RESPONSIBLE_PERSON like '%${responsiblePerson}%'
			</if>
			<if test="customerCategory!=null and customerCategory!=''">
				and EXISTS(SELECT co.TYPE FROM CUSTOMER_INFO co WHERE co.ID = fs.CUSTOMER_ID and co.TYPE = #{customerCategory,jdbcType=VARCHAR})
			</if>
			
			 <if test="beginDate != null and beginDate != ''">
         		and fs.SIGN_DATE<![CDATA[>=]]>to_date(#{beginDate},'yyyy-mm-dd')
	     	 </if>
	     	 <if test="endDate != null and endDate != ''">
	         	and fs.SIGN_DATE <![CDATA[<]]>to_date(#{endDate},'yyyy-mm-dd')
	     	 </if>
	     	 <if test='jcMoney=="0"'>
				and fs.money - nvl((select SUM(fe.ACCEPT_MONEY) from FINANCIAL_SALES_DETALL fe where fe.ACCEPT_ID = fs.ID),'0') &gt; 0
			</if>
		order by fs.CREATE_DATE desc
	</select>

	<select id="selFinancialSalesContractById" resultMap="BaseResultMap" parameterType="java.lang.String">
		select
		<include refid="Base_Column_List" />
		from FINANCIAL_SALES_CONTRACT
		where ID = #{id,jdbcType=VARCHAR}
	</select>
	
	<delete id="delFinancialSalesContractById" parameterType="java.lang.String">
		delete from FINANCIAL_SALES_CONTRACT
		where ID = #{id,jdbcType=VARCHAR}
	</delete>
	<insert id="addFinancialSalesContract" parameterType="com.yhzn.model.finance.SalesContract">
		insert into FINANCIAL_SALES_CONTRACT
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				ID,
			</if>
			<if test="customerId != null">
				CUSTOMER_ID,
			</if>
			<if test="unitName != null">
				UNIT_NAME,
			</if>
			<if test="acceptMoney != null">
				ACCEPT_MONEY,
			</if>
			<if test="remark != null">
				REMARK,
			</if>
			<if test="createName != null">
				CREATE_NAME,
			</if>
			<if test="createDate != null">
				CREATE_DATE,
			</if>
			<if test="modifyName != null">
				MODIFY_NAME,
			</if>
			<if test="modifyDate != null">
				MODIFY_DATE,
			</if>
			<if test="deleteFlag != null">
				DELETE_FLAG,
			</if>
			<if test="rev1 != null">
				REV1,
			</if>
			<if test="rev2 != null">
				REV2,
			</if>
			<if test="rev3 != null">
				REV3,
			</if>
			<if test="contractName != null">
				CONTRACT_NAME,
			</if>
			<if test="contractNo != null">
				CONTRACT_NO,
			</if>
			<if test="signDate != null">
				SIGN_DATE,
			</if>
			<if test="provinceOrOutside != null">
				PROVINCE_OR_OUTSIDE,
			</if>
			<if test="invoicedAmount != null">
				INVOICED_AMOUNT,
			</if>
			<if test="money != null">
				MONEY,
			</if>
			<if test="responsiblePerson != null">
				RESPONSIBLE_PERSON,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=VARCHAR},
			</if>
			<if test="customerId != null">
				#{customerId,jdbcType=VARCHAR},
			</if>
			<if test="unitName != null">
				#{unitName,jdbcType=VARCHAR},
			</if>
			<if test="acceptMoney != null">
				#{acceptMoney,jdbcType=VARCHAR},
			</if>
			<if test="remark != null">
				#{remark,jdbcType=VARCHAR},
			</if>
			<if test="createName != null">
				#{createName,jdbcType=VARCHAR},
			</if>
			<if test="createDate != null">
				#{createDate,jdbcType=DATE},
			</if>
			<if test="modifyName != null">
				#{modifyName,jdbcType=VARCHAR},
			</if>
			<if test="modifyDate != null">
				#{modifyDate,jdbcType=DATE},
			</if>
			<if test="deleteFlag != null">
				#{deleteFlag,jdbcType=DECIMAL},
			</if>
			<if test="rev1 != null">
				#{rev1,jdbcType=VARCHAR},
			</if>
			<if test="rev2 != null">
				#{rev2,jdbcType=VARCHAR},
			</if>
			<if test="rev3 != null">
				#{rev3,jdbcType=VARCHAR},
			</if>
			<if test="contractName != null">
				#{contractName,jdbcType=VARCHAR},
			</if>
			<if test="contractNo != null">
				#{contractNo,jdbcType=VARCHAR},
			</if>
			<if test="signDate != null">
				#{signDate,jdbcType=DATE},
			</if>
			<if test="provinceOrOutside != null">
				#{provinceOrOutside,jdbcType=VARCHAR},
			</if>
			<if test="invoicedAmount != null">
				#{invoicedAmount,jdbcType=VARCHAR},
			</if>
			<if test="money != null">
				#{money,jdbcType=VARCHAR},
			</if>
			<if test="responsiblePerson != null">
				#{responsiblePerson,jdbcType=VARCHAR},
			</if>
		</trim>
	</insert>
	<update id="editFinancialSalesContract" parameterType="com.yhzn.model.finance.SalesContract">
		update FINANCIAL_SALES_CONTRACT
		<set>
			<if test="customerId != null">
				CUSTOMER_ID = #{customerId,jdbcType=VARCHAR},
			</if>
			<if test="unitName != null">
				UNIT_NAME = #{unitName,jdbcType=VARCHAR},
			</if>
			<if test="acceptMoney != null">
				ACCEPT_MONEY = #{acceptMoney,jdbcType=VARCHAR},
			</if>
			<if test="remark != null">
				REMARK = #{remark,jdbcType=VARCHAR},
			</if>
			<if test="createName != null">
				CREATE_NAME = #{createName,jdbcType=VARCHAR},
			</if>
			<if test="createDate != null">
				CREATE_DATE = #{createDate,jdbcType=DATE},
			</if>
			<if test="modifyName != null">
				MODIFY_NAME = #{modifyName,jdbcType=VARCHAR},
			</if>
			<if test="modifyDate != null">
				MODIFY_DATE = #{modifyDate,jdbcType=DATE},
			</if>
			<if test="deleteFlag != null">
				DELETE_FLAG = #{deleteFlag,jdbcType=DECIMAL},
			</if>
			<if test="rev1 != null">
				REV1 = #{rev1,jdbcType=VARCHAR},
			</if>
			<if test="rev2 != null">
				REV2 = #{rev2,jdbcType=VARCHAR},
			</if>
			<if test="rev3 != null">
				REV3 = #{rev3,jdbcType=VARCHAR},
			</if>
			<if test="contractName != null">
				CONTRACT_NAME = #{contractName,jdbcType=VARCHAR},
			</if>
			<if test="contractNo != null">
				CONTRACT_NO = #{contractNo,jdbcType=VARCHAR},
			</if>
			<if test="signDate != null">
				SIGN_DATE = #{signDate,jdbcType=DATE},
			</if>
			<if test="provinceOrOutside != null">
				PROVINCE_OR_OUTSIDE = #{provinceOrOutside,jdbcType=VARCHAR},
			</if>
			<if test="invoicedAmount != null">
				INVOICEDAMOUNT = #{invoicedAmount,jdbcType=VARCHAR},
			</if>
			<if test="money != null">
				MONEY = #{money,jdbcType=VARCHAR},
			</if>
			<if test="responsiblePerson != null">
				RESPONSIBLE_PERSON = #{responsiblePerson,jdbcType=VARCHAR},
			</if>
		</set>
		where ID = #{id,jdbcType=VARCHAR}
	</update>
</mapper>

销售合同服务Service接口层


/**
 * 销售合同服务接口层
 * @author Liany
 *
 */
public interface SalesContractService{
	/**
	* 添加一条销售合同记录
	* @param aFinancePurchaseContract 添加的财务采购合同对象
	*/
	Map<String,Object> addFinancialSalesContract(SalesContract FinancialSalesContract,User user);
	
	/**
	 * 分页查询销售合同信息列表
	 * @param bounds
	 * @param parameter
	 * @return
	 */
	List<SalesContract> queryFinancialSalesContractList(PageBounds bounds, Map<String, Object> parameter);
	
	/**
	 * 修改销售合同信息
	 * @param financePurchaseContract
	 * @param user
	 */
	Map<String,Object> updateFinancialSalesContract(SalesContract financialSalesContract,User user);
	
	/**
	 * 根据id查询销售合同详情
	 * @param id
	 * @return
	 */
	SalesContract selFinancialSalesContractById(String id);
	
	/**
	 * 根据id删除销售合同
	 * @param id
	 * @param user
	 */
	void delFinancialSalesContractById(String id,User user);
	
	/*
	 * 根据销售合同id计算出剩余应收金额
	 * @param id
	 * @return
	 *//*
	String selUnAcceptMoney(String acceptId,User user);*/
}

销售合同服务Service接口层实现类


/**
 * 销售合同service实现类
 * @author Liany
 *
 */
@Service
public class SalesContractServiceImpl implements SalesContractService{
	
	@Autowired
	private SalesContractDao financialSalesContractDao; 
	
	/**
	 * 添加销售合同的service实现类的方法
	 */
	@Override
	public Map<String, Object> addFinancialSalesContract(SalesContract financialSalesContract, User user) {
		//	设置用户id
		financialSalesContract.setId(UUID.randomUUID().toString().replace("-", ""));
		financialSalesContract.setCreateName(user.getUserName());
		financialSalesContract.setCreateDate(new Date());
//		financialSalesContract.setSignDate(new Date());
		financialSalesContract.setDeleteFlag(CoreConst.NO_DEL);//删除标识
		Map<String, Object> map = new HashMap<String, Object>();
		try {
			financialSalesContractDao.addFinancialSalesContract(financialSalesContract);
			map.put("status", "200");
			map.put("msg", "保存成功");
		} catch (Exception e) {
			map.put("status", "400");
			map.put("msg", "保存失败");
		}
		return map;
	}
	
	/**
	 * 查询用户列表的service实现类的方法
	 */
	@Override
	public List<SalesContract> queryFinancialSalesContractList(PageBounds bounds,Map<String, Object> parameter) {
		return financialSalesContractDao.queryFinancialSalesContractList(bounds, parameter);
	}
	
	/**
	 * 修改用户的service实现类的方法
	 */
	@Override
	public Map<String, Object> updateFinancialSalesContract(SalesContract financialSalesContract, User user) {
		financialSalesContract.setModifyName(user.getModifyName());
		financialSalesContract.setModifyDate(user.getModifyDate());
//		financialSalesContract.setSignDate(new Date());
		financialSalesContract.setDeleteFlag(CoreConst.NO_DEL);
		Map<String,Object> map = new HashMap<String,Object>();
		try {
			financialSalesContractDao.editFinancialSalesContract(financialSalesContract);
			map.put("status", "200");
			map.put("msg", "修改成功");
		} catch (Exception e) {
			map.put("status", "400");
			map.put("msg", "修改失败");
		}
		return map;
	}
	
	/**
	 * 根据用户的id查询用户的service实现类的方法
	 */
	@Override
	public SalesContract selFinancialSalesContractById(String id) {
		SalesContract financialSalesContract = financialSalesContractDao.selFinancialSalesContractById(id);
		return financialSalesContract;
	}
	
	/**
	 * 根据id删除用户的service实现类的方法
	 */
	@Override
	public void delFinancialSalesContractById(String id, User user) {
		financialSalesContractDao.delFinancialSalesContractById(id);
	}
	
	/**
	 * 根据销售合同id计算出剩余应收金额
	 */
	/*@Override
	public String selUnAcceptMoney(String acceptId, User user) {
		String unAcceptMoney = financialSalesContractDao.selUnAcceptMoney(acceptId);
		return unAcceptMoney;
	}*/
	
	

}

销售合同服务Controller实现类


/**
 * 销售合同控制层
 * @author liany
 */
@Controller
@RequestMapping("/financialSalesContract")
public class SalesContractController {
	//  销售合同服务接口
		@Autowired
		private SalesContractService salesContractService;
		
		//日志管理接口
		@Autowired
		private SysLogService sysLogService;

		//字典管理接口
		@Autowired
		private SysDictService sysDictService;
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		
		/**
		 * 加载销售合同管理页面
		 * 
		 * @return
		 */
		@RequestMapping(value = "/salesContract", method = RequestMethod.GET)
		public String finance() {
			return "/financemanage/accounts/salesContract";
		}
		/**
		 * 新增销售合同信息
		 * @param person
		 * @param request
		 * @return
		 * @throws IOException 
		 */
		@RequestMapping(value="/addFinancialSalesContract",method= RequestMethod.POST)
		@ResponseBody
		public Map<String,Object> addFinancialSalesContract(SalesContract salesContract,HttpServletRequest request) throws IOException{
		  //获取登录人信息
		  User user= (User) request.getSession().getAttribute("user");
	      //日志类型,操作人,操作内容,操作人IP,操作方法
		  //FinancialSalesContractService.insertSysLog("新增",user.getTrueName(),"新增人员信息: "+FinancialSalesContractService.getName(),user.getLoginIp(),"/person/addPerson");
		  Map<String,Object> map = new HashMap<String,Object>();  
		  salesContractService.addFinancialSalesContract(salesContract, user);
	      //新增人员信息
	      return map;  
		}
		
		/**
		 * 查询销售合同列表
		 * @param request
		 * @return
		 */
		@RequestMapping(value="/queryFinancialSalesContractList", method = RequestMethod.POST)
		@ResponseBody
		public PageUtil queryFinancialSalesContractList(HttpServletRequest request){
			//获取登录人信息 
			User user= (User) request.getSession().getAttribute("user");
	        //日志类型,操作人,操作内容,操作人IP,操作方法
			sysLogService.insertSysLog("查询",user.getTrueName(),"查询人员信息列表 ",user.getLoginIp(),"/financialSalesContract/queryFinancialSalesContractList");

			
			int page = Integer.parseInt(request.getParameter("page"));
			int rows = Integer.parseInt(request.getParameter("rows"));
			
			String city = request.getParameter("city");//城市    模糊查询的时候需要用到
			String contractName = request.getParameter("contractName");//合同名称
			String responsiblePerson = request.getParameter("responsiblePerson");//创建人
			String customerId = request.getParameter("customerId");//客户单位名称
			String customerCategory = request.getParameter("customerCategory");//客户单位名称
			String jcMoney = request.getParameter("jcMoney");//结存
			String beginDate = request.getParameter("beginDate");//签订开始时间
			String endDate = request.getParameter("endDate");//签订结束时间
			
			
			Map<String,Object> parameter = new HashMap<String,Object>();
				parameter.put("city", city);
				parameter.put("contractName",contractName);
				parameter.put("responsiblePerson",responsiblePerson);
				parameter.put("customerCategory",customerCategory);
				parameter.put("jcMoney",jcMoney);
				parameter.put("beginDate",beginDate);
				parameter.put("endDate",endDate);
				parameter.put("customerId",customerId);
				

			PageBounds bounds = new PageBounds(page , rows );
			List<SalesContract> list = salesContractService.queryFinancialSalesContractList(bounds, parameter);
			// 获得结果集条总数
			int total = ((PageList<SalesContract>) list).getPaginator().getTotalCount();
			// 页面列表展示
			PageUtil result = new PageUtil();
			result.setRows(list);
			result.setTotal(total);
			return result;
		}
		
		/**
		 * 修改销售合同信息
		 * @param person
		 * @param request
		 * @return
		 */
		@RequestMapping(value="/editFinancialSalesContract",method= RequestMethod.POST)
		@ResponseBody
		public Map<String,Object> editFinancialSalesContract(SalesContract financialSalesContract,HttpServletRequest request){
			
		   Map<String,Object> map = new HashMap<String,Object>();  
		   //获取登录人信息
		   User user= (User)request.getSession().getAttribute("user");
	       //日志类型,操作人,操作内容,操作人IP,操作方法
		   sysLogService.insertSysLog("修改",user.getTrueName(),"修改人员信息: "+financialSalesContract.getModifyName(),user.getLoginIp(),"/financialSalesContract/editFinancialSalesContract");
		   //changePerson(person,request);
		   salesContractService.updateFinancialSalesContract(financialSalesContract, user);
	       map.put("success", 1);  
	       return map;  
		}
		
		/**
		 * 根据id查询销售合同信息
		 * @param id
		 * @return
		 */
		@RequestMapping(value="selFinancialSalesContractById")
		@ResponseBody
		public SalesContract selFinancialSalesContractById(String id){
			return salesContractService.selFinancialSalesContractById(id);
		}
		
		/**
		 * 根据id删除销售合同信息
		 * @param id
		 * @param request
		 * @param financialSalesContract
		 * @return
		 */
		@RequestMapping(value="delFinancialSalesContractById")
		@ResponseBody
		public Map<String,Object> delFinancialSalesContractById(String id,HttpServletRequest request,SalesContract financialSalesContract){
			
			   Map<String,Object> map = new HashMap<String,Object>();  
			   //获取登录人信息
			   User user= (User)request.getSession().getAttribute("user");
//		       //日志类型,操作人,操作内容,操作人IP,操作方法
			   sysLogService.insertSysLog("修改",user.getTrueName(),"修改人员信息: "+financialSalesContract.getModifyName(),user.getLoginIp(),"/FinancialSalesContract/editFinancialSalesContract");
//			   //changePerson(person,request);
			   salesContractService.delFinancialSalesContractById(id, user);
		       map.put("success", 1);  
		       return map;  
		}
}

销售合同列表的jsp页面代码:有点长...

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<%
	String acceptId = request.getParameter("acceptId");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<title>销售合同列表页面</title>
<link rel="stylesheet" type="text/css"
	href="${ctx }/resource/plugins/easyui-me/columns.css">
<link rel="stylesheet" type="text/css"
	href="${ctx }/resource/plugins/easyui-me/style.css">
<link rel="stylesheet" type="text/css"
	href="${ctx }/resource/plugins/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="${ctx }/resource/css/pur_supplier.css">
<script type="text/javascript"
	src="${ctx }/resource/plugins/easyui/jquery.min.js"></script>
<script type="text/javascript"
	src="${ctx }/resource/plugins/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="${ctx }/resource/plugins/easyui-me/common.js"></script>
<script type="text/javascript"
	src="${ctx }/resource/plugins/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript"
	src="${ctx }/resource/js/dateFormatter.js"></script>
</head>
<body>
	<!--panel:面板  -->
	<div class="panel">
		<!-- easyui-dialog:easyui对话框  	display:规定元素应该生成的框的类型。 display:none 此元素不会被显示。  easyui-combobox:easyui下拉框  easyui-textbox:easyui时间框 -->
		<!-- datagarid的formatter属性
		formatter:function(value,row,index){}
		formatter 属于列参数,表示对于当前列的数据进行格式化操作,它是一个函数,有三个参数,分别是value,row,index
		value:表示当前单元格中的值
		row:表示当前行
		index:表示当前行的下标
		可以使用return返回想要的数据显示在单元格中 -->
		<div id="dlg" class="easyui-dialog" style="display:none;width:600px; height: 440px;top:10px; padding: 5px 10px;" closed="true" buttons="#dlg-buttons">
			<%-- 新增弹出框 begin --%>
			<form id="customerForm" method="post">
				<table border="0" width="100%" cellpadding="0">
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">客户单位名称:</td>
						<td width="70%" align="left"><input name="customerId" id="addUnitName" class="easyui-combobox" style="width: 86%;" required="true" /></td>
					</tr>
					<!-- <tr height="35px;">
						<td width="30%" height="35px;" align="right">城市:</td>
						<td width="70%" align="left"><input name="city" id="addCity" class="easyui-combobox" style="width: 86%;" required="true" /></td>
					</tr> -->
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">负责人:</td>
						<td width="70%" align="left"><input name="responsiblePerson" id="addResponsiblePerson" class="easyui-combobox" style="width: 86%;" required="true" /></td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">合同金额:</td>
						<td width="70%" align="left"><input type="text" name="money" id="addMoney" required="true" class="easyui-numberbox" size="50px" style="width: 84%;"/>元</td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">合同名称:</td>
						<td width="70%" align="left"><input name="contractName" class="easyui-textbox" size="50px" style="width: 86%;" /></td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">合同编号:</td>
						<td width="70%" align="left"><input name="contractNo" class="easyui-textbox" size="35px" style="width: 86%;" /></td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">签订时间:</td>
						<td width="70%" align="left"><input name="signDate" id="signDate"  class="easyui-datebox" size="35px" style="width: 86%;" /></td>
					</tr>

					</tr>
					<tr height="80px;">
						<td width="30%" height="35px;" align="right">备注:</td>
						<td width="70%" align="left"><input class="easyui-textbox" data-options="multiline:true" size="35px" style="height:150px;width:200px;" name="remark"></td>
					</tr>
				</table>
			</form>
		</div>
		<%-- 新增弹出框 end --%>

		<%-- 修改弹出框 begin --%>
		<div id="editDlg" class="easyui-dialog" style="display:none;width:600px; height: 440px;top:10px; padding: 5px 10px;" closed="true" buttons="#dlg-buttons">
			<form id="editCustomerForm" method="post">
				<table border="0" width="100%" cellpadding="0">
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">客户单位名称:</td>
						<td width="70%" align="left"><input name="customerId" id="editUnitName" class="easyui-combobox" size="35px" required="true" style="width: 86%;" /></td>
					</tr>                                        
					<!-- <tr height="35px;">
						<td width="30%" height="35px;" align="right">城市:</td>
						<td width="70%" align="left"><input name="city" id="editCity" class="easyui-combobox" style="width: 86%;" required="true" /></td>
					</tr> -->
					
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">负责人:</td>
						<td width="70%" align="left"><input name="responsiblePerson" id="editResponsiblePerson" class="easyui-combobox" style="width: 86%;" required="true" /></td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">合同金额:</td>
						<td width="70%" align="left"><input type="text" name="money" id="money" class="easyui-numberbox" size="50px" style="width: 84%;"/>元</td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">合同名称:</td>
						<td width="70%" align="left"><input name="contractName" id="editContractName" class="easyui-textbox" size="35px" style="width: 86%;" /></td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">合同编号:</td>
						<td width="70%" align="left"><input name="contractNo" id="contractNo" class="easyui-textbox" size="35px" style="width: 86%;" /></td>
					</tr>
					<tr height="35px;">
						<td width="30%" height="35px;" align="right">签订时间:</td>
						<td width="70%" align="left"><input name="signDate" id="editSignDate" class="easyui-datebox" size="35px" style="width: 86%;" /></td>
					</tr>
					</tr>
					<tr height="80px;">
						<td width="30%" height="35px;" align="right">备注:</td>
						<td width="70%" align="left"><input class="easyui-textbox" data-options="multiline:true" size="35px" style="height:150px;width:200px;" name="remark" id="remark"></td>
					</tr>
				</table>
			</form>
		</div>
		<%-- 修改弹出框end --%>


		<div class="panel">
			<!-- 返回面板(panel)头部对象  -->
			<div class="panel-header" data-options="region:'north' " border="0" cellspacing="8" cellpadding="0" style="height: 60px;padding: 10px;overflow: hidden;width:98.5%">
				<form action="" name="QueryForm" id="QueryForm">
					客户单位名称:<input name="customerId" id="searchCustomerId" class="easyui-combobox"/>
					城市:<input type="text" name="city" id="searchCity" class="easyui-combobox"/>
					合同名称:<input type="text" name=""contractName"" id="contractNameId" class="easyui-textbox"/>
					负责人:<input type="text" name="responsiblePerson" id="searchResponsiblePerson" class="easyui-combobox"/>
					<br>
					<br>
					
					客户类别:<input type="text" name="customerCategory" id="searchCustomerCategory" class="easyui-combobox"/>
					结存条件<select id="jcMoney" name="jcMoney" class="easyui-combobox" style="width:150px;"> 
								<option value="0">结存大于0</option>  
								<option value="1" selected>所有</option> 
							</select>
						<!--   	<a class="actions search easyui-linkbutton"  iconCls="icon-search">搜索</a>
							<a class="actions print easyui-linkbutton"  iconCls="icon-print">导出</a> -->
					签订时间:<input class="easyui-datebox" name="beginDate" id="f_beginDate" />至 <input class="easyui-datebox" name="endDate" id="f_endDate" />
					<td style="text-align: left;" colspan="6">
				     <button class="easyui-linkbutton" type="button" iconCls="icon-search" style="height: 24px;margin-left: 3px;" onclick="queryFun()">查询</button>
				        <button class="easyui-linkbutton" type="button" iconCls="icon-redo" style="height: 24px;margin-left:3px;" onclick="empty()">重置</button>
				    </td>
				</form>

			</div>
			<hr>
			<!-- 表格需要用js进行渲染 -->
			<table id="dg">
			</table>
			<div id="ReceGridToolbar" style="display: none;">
				<shiro:hasPermission name="pay:add">
					<a class="actions add easyui-linkbutton " iconCls="icon-add"
						plain="true">新建</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="pay:edit">
					<a class="actions edit easyui-linkbutton " iconCls="icon-edit"
						plain="true">编辑</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="pay:delete">
					<a class="actions delete easyui-linkbutton " iconCls="icon-remove"
						plain="true">删除</a>
				</shiro:hasPermission>
			</div>
		</div>
		<script>
				//查询条件  
				function queryFun() {
					var queryParameter = $('#dg').datagrid("options").queryParams;
					/* 根据合同名称查询 */
					queryParameter.contractName = $("#contractNameId").val();
					/* 根据城市查询 */
					queryParameter.city = $("#searchCity").combobox("getText");
					/* 根据负责人查询 */
					queryParameter.responsiblePerson = $("#searchResponsiblePerson").combobox("getText");
					/* 根据客户单位名称查询 */
					queryParameter.customerId = $("#searchCustomerId").combobox("getValue");
					/* 根据客户类别查询 */
					queryParameter.customerCategory = $("#searchCustomerCategory").combobox("getText");
					/* 根据结存条件查询 */
					queryParameter.jcMoney = $("#jcMoney").combobox("getValue");
					/* 根据签订时间查询 */
					queryParameter.beginDate = $("#f_beginDate").datebox("getValue");
					/* 根据签订时间查询 */
					queryParameter.endDate = $("#f_endDate").datebox("getValue");
					
					$("#dg").datagrid("reload");
				}
				
			 	//重置
				 function empty() {
				     $('#QueryForm').form('clear');
				 }
				
			$(document).ready(function() {
				$('#dg').datagrid({
					title : '销售合同列表',
					nowrap : false, /* 设置为 true,则把数据显示在一行里。设置为 true 可提高加载性能。 */
					locale : "zh_CN",
					iconCls : 'icon-save', /* 添加按钮 */
					striped : true, /* 设置为 true,则把行条纹化。(即奇偶行使用不同背景色) */
					collapsible : true,/*可折叠的内容块*/
					scrollbarSize : 0, /* 滚动条宽度(当滚动条是垂直的时候)或者滚动条的高度(当滚动条是水平的时候) */
					height : $(window).height() - 150,
					url : '${ctx}/financialSalesContract/queryFinancialSalesContractList',/*查询的销售合同列表的方法*/
					rownumbers : true, /* 设置为 true,则显示带有行号的列 */
					pagination : true, //表示在datagrid设置分页     
					singleSelect : true,/*easyUI的datagrid设置了singleSelect=true(即单选),取消复选框的选中状态*/
					columns : [ [
						{
							field : 'unitName',
							title : '客户单位名称',
							width : '12%',
							align : 'center'
						},{
							field : 'customerName',
							title : '客户姓名',
							width : '4%',
							align : 'center'
						}, {
							field : 'area',
							title : '城市',	
							width : '5%',
							align : 'center'
						}, {
							field : 'money',
							title : '合同金额',
							width : '5%',
							align : 'center'
						}, {
							field : 'sumAcceptMoney',
							title : '已收合同金额',
							width : '5%',
							align : 'center',
							/* formatter : function(value, row, index) {
							 	var num = row.sumAcceptMoney==undefined || row.sumAcceptMoney == "" || row.sumAcceptMoney == ''?0:row.sumAcceptMoney;
								if(num <=0){
									return 0;
								}else{
									return num;
								}
							} */
						},{
							field : 'unAcceptMoney',
							title : '结存',
							width : '5%',
							align : 'center',
						},{
							field : 'invoicedAmount',
							title : '已开票金额',
							width : '5%',
							align : 'center',
						},{
							field : 'contractName',
							title : '合同名称',
							width : '10%',
							align : 'center'
						}, {
							field : 'contractNo',
							title : '合同编号',
							align : 'center',
							width : '8%'
						},{
							field : 'responsiblePerson',
							title : '负责人',
							align : 'center',
							width : '5%'
						},{
							field : 'customerCategory',
							title : '客户类别',
							align : 'center',
							width : '4%'
						},{
							field : 'signDate',
							title : '签订时间',
							width : '6%',
							align : 'center', 
							/* datagarid的formatter属性 
							formatter 属于列参数,表示对于当前列的数据进行格式化操作,它是一个函数,有三个参数,分别是value,row,index
							value:表示当前单元格中的值
							row:表示当前行
							index:表示当前行的下标
							可以使用return返回想要的数据显示在单元格中
							*/
							formatter : function(value, row, index) {
								var str = "";
								if ("" != row.signDate && null != row.signDate) {
									return new Date(row.signDate).format("yyyy-MM-dd");
								}
								return str;
							}
						},
						{
							field : 'remark',
							title : '备注',
							width : '11%',
							align : 'center'
						}, {
							field : 'caozuo',
							title : '操作',
							width : '15%',
							align : 'center',
							formatter : function(value, row, index) {
								 var str="";
								var acceptId = row.id;
								var contractId = row.id;
								if(row.id=="unAcceptMoneyy"){
									str='';
								}else{
									 str += "<a style='color:blue' href='javascript:void(0)' title='回款记录' onclick='linkForm(&apos;" + acceptId + "&apos;)'>回款记录<span>(&apos;" + row.detallCount + "&apos;)</span>&nbsp;&nbsp;</a>"; 
									 str += "<a style='color:blue' href='javascript:void(0)' title='合同附件' onclick='certificateForm(&apos;" + contractId + "&apos;)'>合同附件<span>(&apos;" + row.certificateCount + "&apos;)</span>&nbsp;&nbsp;</a>";
									 str += "<a style='color:blue' href='javascript:void(0)' title='开票记录' onclick='salesInvoicingForm(&apos;" + contractId + "&apos;)'>开票记录<span>(&apos;" + row.salesInvoicingCount + "&apos;)</span></a>";
								}
								return str; 
							}
						} ] ],
					toolbar : '#ReceGridToolbar',
				})
				var PaygridPanel = $('#dg').datagrid("getPanel");
				PaygridPanel.on("click", "a.edit", function() {
					var rows = $('#dg').datagrid('getSelections'); /* 获取数据表格的行 */
					if (rows.length <= 0) {
						$.messager.alert('提示', '请选择要修改的行', 'error');
					} else if (rows.length > 1) {
						$.messager.alert('提示', '只能选择一条数据进行修改', 'error');
					} else if (rows.length == 1) {
						var id = rows[0].id;
						editCustomerForm(id);
					}
				}).on("click", "a.add", function() {
					$("#customerForm").form('clear'); /* 清空form表单 */
					customerForm(); /* 添加方法 */
				}).on("click", "a.delete", function() {
					var rows = $('#dg').datagrid('getSelections');
					if (rows.length <= 0) {
						$.messager.alert('提示', '请选择要刪除的行', 'error');
					} else if (rows.length > 1) {
						$.messager.alert('提示', '只能选择一条数据进行修改', 'error');
					} else if (rows.length == 1) {
						$.messager.confirm("提示", "您确定要删除此数据?", function(r) {
							if (r) {
								var id = rows[0].id;
								delCustomerForm(id);
								/*数据表格重载*/
								$("#dg").datagrid("reload");
							}
						});
					}
				}).on("click", "a.chakan", function() {
					var row = $('#dg').datagrid('getSelected');
					var purNo = row.purNo;
					qingdan(purNo);
				});
		
				// 搜索按钮事件
			/* 	var contractName = $("#contractName");
				var city = $("#searchCity");
				var responsiblePerson = $("#searchResponsiblePerson");
				var beginDate = $("#f_beginDate");
				var endDate = $("#f_endDate");
				var customerId = $("#serarchCustomerId");
				console.log(responsiblePerson.combobox("getText"));
				console.log(city.combobox("getText"));
				$("#Search").on('click', function() {
					$('#dg').datagrid("load", {
						city : "%" + city.combobox("getText") + "%",
						contractName : "%" + contractName.val() + "%",
						customerId : "%" + customerId.combobox("getText") + "%",
						responsiblePerson : "%" + responsiblePerson.combobox("getText") + "%",
						beginDate :  beginDate.datebox("getValue"),
						endDate : endDate.datebox("getValue")
					});
				}); */
				
				
				
				
				// 重置事件
				/* var form = $("#customerForm");
				$("#Reset").on('click', function() {
					form.form('clear');
					// 清除查询参数
					$('#dg').datagrid("load", {});
				}); */
			});
			
			$('#dg').datagrid({
					onLoadSuccess: function(data) {
						var rows = $('#dg').datagrid('getRows') //获取当前的数据行
						var ptotal = 0 //计算开票金额的总和
						var invo = 0 //计算已收合同金额的总和
						var sumMoney = 0;//计算合同金额总和
						var un =0 //计算结存总和
						/* sumAcceptMoney */
						for(var i = 0; i < rows.length; i++) {
							ptotal += parseFloat(rows[i]['invoicedAmount']);
							invo += parseFloat(rows[i]['sumAcceptMoney']);
							sumMoney += parseFloat(rows[i]['money']);
							un += parseFloat(rows[i]['unAcceptMoney']);
						}
						if(isNaN(ptotal)){
							ptotal='0'
						}
						if(isNaN(invo)){
							invo='0'
						}
						if(isNaN(sumMoney)){
							sumMoney='0'
						}
						if(isNaN(un)){
							un='0'
						}
						//新增一行显示统计信息
						$('#dg').datagrid('appendRow', {
							id:'unAcceptMoneyy',
							area: '<b>合计:</b>',
							invoicedAmount:ptotal,
							sumAcceptMoney:invo,
							money:sumMoney,
							unAcceptMoney:un
						});
					},
					rowStyler: function(index, row) {
						if(row.area == '<b>合计:</b>') {
							return 'background-color:#EAEAEA;color:blue';
						}
					}
					
				});
			
			 function linkForm(acceptId) {
			 var content = "<iframe src='${ctx}/salesDetails/salesDetailsPage?acceptId=" + acceptId + "' width='100%' height='98%' frameborder='0' scrolling='0'></iframe>";
					// 创建窗口
					 var dialog = $("<div/>").dialog(
							{
								content : content,
								title :'回款记录详情',
								height : '90%',
								width : '99%',
								modal : true,
								onClose : function() {
									// 窗口关闭的同时销毁此窗口
									$(this).dialog("destroy");
								},
								buttons: [{
									iconCls: 'icon-back',
									text: '返回',
									handler: function() {
										//关闭窗口
										dialog.dialog("close");
										//刷新数据表格
										$("#dg").datagrid("reload");
									}
								}]
							}); 
				}
				
				function certificateForm(contractId) {
				var content = "<iframe src='${ctx}/certificate/certificatePage?contractId=" + contractId + "' width='100%' height='98%' frameborder='0' scrolling='0'></iframe>";
					// 创建窗口
					 var dialog = $("<div/>").dialog(
							{	
								content : content,
								title :'合同附件',
								height : '90%',
								width : '100%',
								modal : true,
								onClose : function() {
									// 窗口关闭的同时销毁此窗口
									$(this).dialog("destroy");
								},
								buttons: [{
									iconCls: 'icon-back',
									text: '返回',
									handler: function() {
										//关闭窗口
										dialog.dialog("close");
										//刷新数据表格
										$("#dg").datagrid("reload");
									}
								}]
							}); 
				}
				function salesInvoicingForm(contractId) {
				var content = "<iframe src='${ctx}/salesInvoicing/salesInvoicingPage?contractId=" + contractId + "' width='100%' height='98%' frameborder='0' scrolling='0'></iframe>";
					// 创建窗口
					 var dialog = $("<div/>").dialog(
							{	
								content : content,
								title :'开票记录详情',
								height : '90%',
								width : '100%',
								modal : true,
								onClose : function() {
									// 窗口关闭的同时销毁此窗口
									$(this).dialog("destroy");
								},
								buttons: [{
									iconCls: 'icon-back',
									text: '返回',
									handler: function() {
										//关闭窗口
										dialog.dialog("close");
										//刷新数据表格
										$("#dg").datagrid("reload");
									}
								}]
							}); 
				}
		 	
			function qingdan(purNo) {
				// 创建窗口
				var dialog = $("<div/>").dialog(
					{
						href : '../purchase/purSupplier/' + purNo,
						title : "详情",
						height : '90%',
						width : '80%',
						modal : true,
						onClose : function() {
							// 窗口关闭的同时销毁此窗口
							$(this).dialog("destroy");
						},
						buttons : [ {
							iconCls : 'icon-back',
							text : '返回',
							handler : function() {
								//关闭窗口
								dialog.dialog("close");
							}
						} ]
					});
			}
			//获取客户公司名称下拉框值
			$.ajax({
				type : "get",
				url : "${ctx}/customer/customerCompanyCombobox",
				async : false,
				success : function(data) {
					$("#addUnitName").combobox({ //往下拉框塞值
						data : data,
						valueField : "id", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			//获取客户公司名称修改下拉框数据
			 $.ajax({
				type : "get",
				url : "${ctx}/customer/customerCompanyCombobox",
				async : false,
				success : function(data) {
					$("#editUnitName").combobox({ //往下拉框塞值
						data : data,
						valueField : "id", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			}) 
		
			//获取城市下拉框值
			$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=CSDM",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#addCity").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			//修改城市下拉框值
			$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=CSDM",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data);
					$("#editCity").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			//获取条件查询的城市下拉框
			$.ajax({
				type:"get",
				url:"${ctx}/sysDict/getDictList?parentKey=CSDM",
				async : false,
				success : function(data) {
					var jo = JSON.parse(data); 
					$("#searchCity").combobox({ //往下拉框塞值
						data : jo,
						valueField : "id", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			//获取条件查询的客户单位名称
			$.ajax({
				type : "get",
				url : "${ctx}/customer/customerCompanyCombobox",
				async : false,
				success : function(data) {
					$("#searchCustomerId").combobox({ //往下拉框塞值
						data : data,
						valueField : "id", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			//获取负责人下拉框
				$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=FZR",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#addResponsiblePerson").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			
			//获取负责人的修改下拉框
				$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=FZR",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#editResponsiblePerson").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			//获取条件查询的负责人下拉框
			$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=FZR",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#searchResponsiblePerson").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			//获取客户类别下拉框
				$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=HYLBDM",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#addCustomerCategory").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			//获取修改的客户类别下拉框
				$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=HYLBDM",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#editCustomerCategory").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			//获取条件查询的客户类别下拉框
				$.ajax({
				type : "get",
				url : "${ctx}/sysDict/getDictList?parentKey=HYLBDM",
				async : false,
				success : function(data) {
					var jso = JSON.parse(data); 
					$("#searchCustomerCategory").combobox({ //往下拉框塞值
						data : jso,
						valueField : "text", //value值
						textFild : "text" //文本值
					});
				},
				error : function(data) {}
			})
			
			/* 新增弹出框 */
			function customerForm() {
				/* 给jsp的签订时间设置当前时间 */
			 	$('#signDate').datebox('setValue',myformatter(new Date));
				var win = $('#dlg').dialog({ //创建弹出框
					width : '500',
					height : '600',
					modal : true, //遮罩层
					title : '添加销售合同',
					shadow : true, //阴影
					buttons : [ { //
						text : '提交',
						iconCls : 'icon-ok',
						handler : function() {
									if ($("#customerForm").form('validate')) { /* 进行表单验证 */
										var formData = document.getElementById("customerForm"); /* 通过id获取到用户表单 */
										var data = new FormData(formData); /* 创建一个新的表单数据 */
										$.ajax({
											type : "post",
											url : "${ctx}/financialSalesContract/addFinancialSalesContract",
											data : data,
											async : false, /* 是否同步 */
											contentType : false,
											processData : false,
											success : function(data) {
												$("#dlg").dialog('close'); /* 关闭对话框 */
												$("#dg").datagrid("reload"); /* 重载表格 */
												$.messager.show({
													title : '消息提示',
													msg : '保存成功',
													timeout : 2000,
													showType : 'slide'
												});
											}
										});
									}
						}
					}, {
						text : '关闭',
						iconCls : 'icon-no',
						handler : function() {
							$("#dlg").dialog('close');
						}
					}]
				});
				win.dialog('open'); //打开添加对话框
				win.window('center'); //使Dialog居中显示 
			}
		
			/* 修改弹出框 */
			function editCustomerForm(id) {
				/* 修改之前先要根据id查询出销售合同信息,然后再把这些数据显示出来 */
				$.ajax({
					type : "post",
					url : "${ctx}/financialSalesContract/selFinancialSalesContractById?id=" + id,
					async : false,
					contentType : false,
					processData : false,
					success : function(data) {
						$("#money").textbox('setValue', data.money);
						$("#editUnitName").combobox('setValue', data.customerId);
						$("#editCity").combobox('setValue', data.city);
						$("#acceptMoney").textbox("setValue", data.acceptMoney);
						$("#editContractName").textbox("setValue", data.contractName);
						$("#contractNo").textbox("setValue", data.contractNo);
						$("#editResponsiblePerson").combobox('setValue', data.responsiblePerson);
						$("#editCustomerCategory").combobox('setValue', data.customerCategory);
						var time = myformatter(data.signDate);
						$("#editSignDate").datebox("setValue", time);
						$("#remark").textbox("setValue", data.remark);
					},
					error : function(data) {}
				})
				var win = $('#editDlg').dialog({ //创建弹出框
					width : '500',
					height : '600',
					modal : true, //遮罩层
					title : '修改销售合同',
					shadow : true, //阴影
					buttons : [ { //按钮
						text : '提交',
						iconCls : 'icon-ok',
						handler : function() {
							$.messager.confirm('提示', '您确定要修改吗', function(t) {
								if (t) {
									if ($("#editCustomerForm").form('validate')) {
										var formData = document.getElementById("editCustomerForm");
										var data = new FormData(formData);
										/* 修改的时候需要把id set进去 */
										data.set("id", id);
										data.get("id");
										$.ajax({
											type : "post",
											url : "${ctx}/financialSalesContract/editFinancialSalesContract",
											data : data,
											async : false,
											contentType : false,
											processData : false,
											success : function(data) {
												$("#editDlg").dialog('close');
												$("#dg").datagrid("reload");
												$.messager.show({
													title : '消息提示',
													msg : '修改成功',
													timeout : 2000,
													showType : 'slide'
												});
											}
										});
									}
								}
							});
						}
					}, {
						text : '关闭',
						iconCls : 'icon-no',
						handler : function() {
							$("#editDlg").dialog('close');
						}
					}
					]
				});
				win.dialog('open'); //打开添加对话框
				win.window('center'); //使Dialog居中显示 
			}
			//时间格式化
			function myformatter(date) {
				var date = new Date(date);
				var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
				var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1);
				var hor = date.getHours();
				var min = date.getMinutes();
				var sec = date.getSeconds();
				return date.getFullYear() + '-' + month + '-' + day
			}
		
			function delCustomerForm(id) {
				$.ajax({
					type : "get",
					url : "${ctx}/financialSalesContract/delFinancialSalesContractById?id=" + id,
					async : false,
					contentType : false,
					processData : false,
					success : function(data) {
						$.messager.show({
							title : '消息提示',
							msg : '刪除成功',
							timeout : 2000,
							showType : 'slide'
						});
					},
					error : function(data) {}
				})
			}
		</script>
</body>
</html>

销售合同添加操作页面

销售合同修改操作页面

销售合同查询列表

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页