| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- $(function () {
- $("#form-contract-edit").validate({
- onkeyup: false,
- focusCleanup: true,
- success: "valid",
- submitHandler: function (form) {
- if($(".type:checked").length==0){
- errorMessage("至少选择一个模块");
- return false;
- }
- $(form).ajaxSubmit({
- type: 'put',
- url: pagePath+"/build/contract/updateContractModal/" + $("#contract_id").val(),
- dataType: "json",
- success: function (data) {
- if (data.status) {
- succeedMessage(data.message);
- setTimeClose();
- } else {
- errorMessage(data.message);
- }
- }
- });
- return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
- },
- errorPlacement: function (error, element) {
- if (element.attr('name') == 'buildLives[0].use_area' || element.attr('name') == 'buildLives[0].pay' ||
- element.attr('name') == 'buildLives[0].build_number' || element.attr('name') == 'buildLives[0].floor'
- ) {
- error.addClass('label_error')
- }
- if (element.attr('name') == 'contractWaterList[0].name' || element.attr('name') == 'contractWaterList[0].start_water_meter_count') {
- error.addClass('label_error')
- }
- if (element.attr('name') == 'paid_tenancy' || element.attr('name') == 'paid_tenancy_month') {
- error.addClass('label_error')
- }
- if (element.attr('name') == 'contractElectrics[0].name' || element.attr('name') == 'contractElectrics[0].start_electric_meter_count') {
- error.addClass('label_error')
- }
- if (element.attr('name') == 'contractProperties[0].price' || element.attr('name') == 'contractProperties[0].number' ||
- element.attr('name') == 'contractProperties[0].payment_cycle'
- ) {
- error.addClass('label_error')
- }
- if (element.attr('name') == 'contractParkings[0].price' || element.attr('name') == 'contractParkings[0].number' ||
- element.attr('name') == 'contractParkings[0].payment_cycle'
- ) {
- error.addClass('label_error')
- }
- error.appendTo(element.parent());
- }
- });
- });
- function contract_dialog(title, url, w, h) {
- layer_show(title, pagePath+url, w, h);
- }
|