123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
- <%@ taglib prefix="s" uri="/struts-tags" %>
- <script>
- //人员类型
- var personTypeObj_add = null;
- var personType_array_add = null;
-
- //户型
- var roomTypeObj_add = null;
- var roomType_array_add = null;
-
- //从合同中添加
- function addFromLeaseContract(){
- $('#leaseContractSelectDialog').dialog(
- {
- buttons : [
- {
- text : '确定',
- iconCls : 'icon-ok',
- handler : function(){
- var leaseContractId = select_submit();
- $("#leaseContractId_add").val(leaseContractId);
- $.ajax({
- type: "post",//使用post方法访问后台
- dataType: "json",//返回json格式的数据
- url: "leaseContractAction_findById",//要访问的后台地址
- data:{"leaseContract.id":leaseContractId },
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- $("#securityPersonIdCard_add").val(msg.obj.securityPerson.idCard);
- $("#securityPersonName_add").val(msg.obj.securityPerson.name);
- $("#leaseContractId_add").val(msg.obj.id);
- $("#securityPersonId_add").val(msg.obj.securityPerson.id);
- $("#houseId_add").val(msg.obj.house.id);
-
- $("#rentMonthMoney_add").numberbox('setValue', msg.obj.moneyActual);
-
- $("#startDate_add").datebox('setValue', msg.obj.rentDate);
-
- $("#leaseContract_startDate_add").datebox('setValue', msg.obj.startDate);
- $("#leaseContract_endDate_add").datebox('setValue', msg.obj.endDate);
-
- $("#personType_add").val(msg.obj.securityPerson.personType);
- $("#securityNum_add").numberbox('setValue', msg.obj.securityPerson.securityNum);
- $("#houseAddress_add").val(msg.obj.houseAddress);
- $("#roomType_add").val(msg.obj.house.roomType);
-
- $("#contractNo_add").val(msg.obj.contractNo);
- $("#contractName_add").val(msg.obj.contractName);
-
- var houseArea = msg.obj.houseArea;
- if(houseArea == null){
- houseArea = 0;
- }
- $("#houseArea_add").numberbox('setValue', houseArea);
-
- var garageArea = msg.obj.garageArea;
- if(garageArea == null){
- garageArea = 0;
- }
- $("#garageArea_add").numberbox('setValue', garageArea);
- }
- }
- });
- $("#leaseContractSelectDialog").dialog("close");
- }
- },
- {
- text : '取消',
- iconCls : 'icon-cancel',
- handler : function(){
- $("#leaseContractSelectDialog").dialog("close");
- }
- }
- ],
- onLoad : function(){
- select_load();
- }
- }
- );
- }
- //空值转换
- var dealNull = function(value){
- if(value == ""){
- return 0;
- }
- else{
- return value;
- }
- }
-
- //月份加减函数
- function addMoth(d,m){
- var ds=d.split('-'),_d=ds[2]-0;
- var nextM=new Date( ds[0],ds[1]-1+m+1, 0 );
- var max=nextM.getDate();
- d=new Date( ds[0],ds[1]-1+m,_d>max? max:_d );
- return d.toLocaleDateString().match(/\d+/g).join('-')
- }
-
- //日期加减函数
- function addDate(dd,dadd){
- var a = new Date(dd)
- a = a.valueOf()
- a = a + dadd * 24 * 60 * 60 * 1000
- a = new Date(a)
- return a;
- }
-
- //日期格式化
- Date.prototype.Format = function (fmt) { //author: meizz
- var o = {
- "M+": this.getMonth() + 1, //月份
- "d+": this.getDate(), //日
- "h+": this.getHours(), //小时
- "m+": this.getMinutes(), //分
- "s+": this.getSeconds(), //秒
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
- }
-
- //计算金额和租金
- var countMoney = function(){
- var rentMonth_add = dealNull($("#rentMonth_add").numberbox('getValue'));
- var rentMonthMoney_add = dealNull($("#rentMonthMoney_add").numberbox('getValue'));
- var rentMoney1_add = rentMonth_add * rentMonthMoney_add;
- $("#rentMoney1_add").numberbox('setValue', rentMoney1_add );
- var startDate = $("#startDate_add").datebox('getValue');
- $("#endDate_add").datebox('setValue', addMoth(addDate(startDate,-1).Format("yyyy-MM-dd"),parseInt(rentMonth_add)) );//需要转换为int型,然后再做日期的月份加减
- }
- var add_load = function(){
-
- $('#rentMonth_add').numberbox({
- onChange: function () {
- countMoney();
- }
- });
-
-
- //人员类别
- $.ajax({
- type: "post",//使用post方法访问后台
- dataType: "json",//返回json格式的数据
- url: "aa10Action_listAa10All",//要访问的后台地址
- data:{"aa10.letter":"personType" ,"aa10.name":"保障人员类别" },
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- personTypeObj_add = msg.obj.rows;
- var select_arr = [];
- var data = personTypeObj_add;
- for(var nItem = 0; nItem < data.length; nItem++ ){
- select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
- }
- personType_array_add = select_arr.join("");
- $("#personType_add").append(personType_array_add);
- }
- }
- });
-
- //户型
- $.ajax({
- type: "post",//使用post方法访问后台
- dataType: "json",//返回json格式的数据
- url: "aa10Action_listAa10All",//要访问的后台地址
- data:{"aa10.letter":"roomType" ,"aa10.name":"户型" },
- complete :function(){$("#load").hide();},//AJAX请求完成时隐藏loading提示
- success: function(msg){//msg为返回的数据,在这里做数据绑定
- if(msg.success){
- roomTypeObj_add = msg.obj.rows;
- var select_arr = [];
- var data = roomTypeObj_add;
- for(var nItem = 0; nItem < data.length; nItem++ ){
- select_arr.push("<option value="+data[nItem].code+">"+data[nItem].value+"</option>");
- }
- roomType_array_add = select_arr.join("");
- $("#roomType_add").append(roomType_array_add);
- }
- }
- });
-
- }
- var add_submit = function(){
- $('#addRentForm').form('submit',{
- url : whzl.basePath+'/rentAction_addRent',
- success : function(result){
- var parseResult = $.parseJSON(result);
- if(parseResult.success){
- //parent.$.messager.progress('close');
- $('#rentDataGrid').datagrid('reload');
- }
- }
- }
- );
- }
-
- </script>
- <div class="easyui-tabs" id="tabs_add">
- <div title="基本信息" id="jbxx_detail">
- <table class="mytable" style="width: 100%;" >
- <tr>
- <th>
- <a href="javascript:addFromLeaseContract();" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true">从租赁合同中选择</a>
- </th>
- </tr>
- </table>
- <form id="addRentForm" method="post" enctype="multipart/form-data">
- <table class="mytable" style="width: 100%;">
- <tr>
- <th width="20%">交租人身份证号</th>
- <td width="30%" >
- <input class="easyui-validatebox" readonly="readonly" style="width:150px" required="true" type="text" id="securityPersonIdCard_add" />
- <input type="hidden" id="securityPersonId_add" name="rent.securityPerson.id" />
- <input type="hidden" id="houseId_add" name="rent.house.id" />
- <input type="hidden" id="leaseContractId_add" name="rent.leaseContract.id" />
- </td>
- <th width="20%">交租人姓名</th>
- <td width="30%" >
- <input class="easyui-validatebox" readonly="readonly" style="width:150px" required="true" type="text" id="securityPersonName_add" />
- </td>
- </tr>
-
- <tr>
- <th width="20%">交租月数</th>
- <td width="30%" >
- <input id="rentMonth_add" name="rent.rentMonth" class="easyui-numberbox" required="true"/>
- </td>
- <th width="20%">月应交租金(减免后)</th>
- <td width="30%" >
- <input id="rentMonthMoney_add" precision="2" name="rent.rentMonthMoney" class="easyui-numberbox" required="true"/>
- </td>
- </tr>
-
- <tr>
- <th width="20%">应交租总金额</th>
- <td width="30%" >
- <input id="rentMoney1_add" precision="2" readonly="readonly" class="easyui-numberbox" required="true"/>
- </td>
- <th width="20%">实际交租总金额</th>
- <td width="30%" >
- <input id="rentMoney_add" precision="2" name="rent.rentMoney" class="easyui-numberbox" required="true"/>
- </td>
- </tr>
-
- <tr>
- <th width="20%">本次租金交纳开始时间</th>
- <td width="30%" >
- <input id="startDate_add" name="rent.startDate" class="easyui-datebox" required="true"/>
- </td>
- <th width="20%">本次租金交纳结束时间</th>
- <td width="30%" >
- <input id="endDate_add" name="rent.endDate" class="easyui-datebox" required="true"/>
- </td>
- </tr>
-
- <tr>
- <th width="20%">合同租房开始时间</th>
- <td width="30%" >
- <input id="leaseContract_startDate_add" class="easyui-datebox" />
- </td>
- <th width="20%">合同租房结束时间</th>
- <td width="30%" >
- <input id="leaseContract_endDate_add" class="easyui-datebox" />
- </td>
- </tr>
-
- <tr>
- <th width="20%">房屋地址</th>
- <td width="30%" >
- <input class="easyui-validatebox" readonly="readonly" style="width:150px" required="true" type="text" id="houseAddress_add" >
- </td>
- <th width="20%">户型</th>
- <td width="30%" >
- <select id="roomType_add" readonly="readonly" class="easyui-validatebox" required="true">
- <option value="">请选择</option>
- </select>
- </td>
- </tr>
-
- <tr>
- <th width="20%">合同编号</th>
- <td width="30%" >
- <input class="easyui-validatebox" style="width:150px" required="true" type="text" id="contractNo_add" readonly="readonly" >
- </td>
- <th width="20%">合同名称</th>
- <td width="30%" >
- <input class="easyui-validatebox" style="width:150px" required="true" type="text" id="contractName_add" >
- </td>
- </tr>
-
- <tr>
- <th width="20%">家庭情况</th>
- <td width="30%" >
- <select id="personType_add" readonly="readonly" class="easyui-validatebox" required="true">
- <option value="">请选择</option>
- </select>
- </td>
- <th width="20%">保障人口数量</th>
- <td width="30%" >
- <input class="easyui-numberbox" readonly="readonly" style="width:150px" required="true" type="text" id="securityNum_add" >
- </td>
- </tr>
- <tr>
- <th width="20%">房屋面积</th>
- <td width="30%" >
- <input class="easyui-numberbox" precision="2" readonly="readonly" style="width:150px" required="true" type="text" id="houseArea_add" >
- </td>
- <th width="20%">车库面积</th>
- <td width="30%" >
- <input class="easyui-numberbox" precision="2" readonly="readonly" style="width:150px" type="text" id="garageArea_add" >
- </td>
- </tr>
- </table>
- </form>
- </div>
- <!--<div title="凭证上传" id="fyxx_detail">
- </div>-->
- </div>
|