houseRentingFees_info.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /**
  2. * 初始化房租补助详情对话框
  3. */
  4. var HouseRentingFeesInfoDlg = {
  5. houseRentingFeesInfoData : {},
  6. validateFields: {
  7. baseId: {validators: {notEmpty: {message: '申报对象不能为空'}}},
  8. email: {validators: {notEmpty: {message: '电子邮箱不能为空'}}},
  9. bankAddress: {validators: {notEmpty: {message: '开户银行网点不能为空'}}},
  10. bankAccount: {validators: {notEmpty: {message: '银行账号不能为空'}}},
  11. }
  12. };
  13. /**
  14. * 清除数据
  15. */
  16. HouseRentingFeesInfoDlg.clearData = function() {
  17. this.houseRentingFeesInfoData = {};
  18. }
  19. /**
  20. * 设置对话框中的数据
  21. *
  22. * @param key 数据的名称
  23. * @param val 数据的具体值
  24. */
  25. HouseRentingFeesInfoDlg.set = function(key, val) {
  26. this.houseRentingFeesInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
  27. return this;
  28. }
  29. /**
  30. * 设置对话框中的数据
  31. *
  32. * @param key 数据的名称
  33. * @param val 数据的具体值
  34. */
  35. HouseRentingFeesInfoDlg.get = function(key) {
  36. return $("#" + key).val();
  37. }
  38. /**
  39. * 关闭此对话框
  40. */
  41. HouseRentingFeesInfoDlg.close = function() {
  42. parent.layer.close(window.parent.HouseRentingFees.layerIndex);
  43. }
  44. /**
  45. * 收集数据
  46. */
  47. HouseRentingFeesInfoDlg.collectData = function() {
  48. this
  49. .set('id')
  50. .set('baseId')
  51. .set('phone')
  52. .set('email')
  53. .set('bankAddress')
  54. .set('bankAccount')
  55. .set('checkState');
  56. }
  57. /**
  58. * 验证数据
  59. */
  60. HouseRentingFeesInfoDlg.validate = function () {
  61. $('#houseRentingPurchaseFeesInfoForm').data("bootstrapValidator").resetForm();
  62. $('#houseRentingPurchaseFeesInfoForm').bootstrapValidator('validate');
  63. return $("#houseRentingPurchaseFeesInfoForm").data('bootstrapValidator').isValid();
  64. }
  65. HouseRentingFeesInfoDlg.nameChange = function(){
  66. var baseId = $("#baseId").val();
  67. if(Feng.isNotEmptyStr(baseId)){
  68. var ajax = new $ax(Feng.ctxPath + "/api/houseRenting/detail/"+baseId, function(data){
  69. var talentInfo = data;
  70. $("#sex").val(talentInfo.sex);
  71. $("#cardTypeName").val(talentInfo.cardTypeName);
  72. $("#idCard").val(talentInfo.idCard);
  73. $("#nativePlace").val(talentInfo.nativePlace);
  74. $("#talentArrangeName").val(talentInfo.talentArrangeName);
  75. $("#entryTime").val(talentInfo.entryTime);
  76. $("#post").val(talentInfo.post);
  77. $("#enterpriseAddress").val(talentInfo.enterpriseAddress);
  78. $("#phone").val(talentInfo.phone);
  79. $("#email").val(talentInfo.email);
  80. $("#marryStatusName").val(talentInfo.marryStatusName);
  81. $("#houseTypeName").val(talentInfo.houseTypeName);
  82. $("#rentAddress").val(talentInfo.rentAddress);
  83. $("#rentStartTime").val(talentInfo.rentStartTime);
  84. $("#rentEndTime").val(talentInfo.rentEndTime);
  85. $("#rentMoney").val(talentInfo.rentMoney);
  86. $("#spouseName").val(talentInfo.spouseName);
  87. $("#spouseSex").val(talentInfo.spouseSex);
  88. $("#spouseCardTypeName").val(talentInfo.spouseCardTypeName);
  89. $("#spouseIdCard").val(talentInfo.spouseIdCard);
  90. $("#spouseNativePlace").val(talentInfo.spouseNativePlace);
  91. $("#spouseTalentArrangeName").val(talentInfo.spouseTalentArrangeName);
  92. $("#spouseEntryTime").val(talentInfo.spouseEntryTime);
  93. $("#spousePost").val(talentInfo.spousePost);
  94. $("#spouseEnterpriseName").val(talentInfo.spouseEnterpriseName);
  95. $("#spouseEnterpriseAddress").val(talentInfo.spouseEnterpriseAddress);
  96. $("#spousePhone").val(talentInfo.spousePhone);
  97. $("#spouseEmail").val(talentInfo.spouseEmail);
  98. },function(data){
  99. Feng.error("查询失败!" + data.responseJSON.message + "!");
  100. });
  101. ajax.start();
  102. }
  103. }
  104. /**
  105. * 提交添加
  106. */
  107. HouseRentingFeesInfoDlg.addSubmit = function() {
  108. var id = $("#id").val();
  109. if(Feng.isNotEmptyStr(id)){
  110. HouseRentingFeesInfoDlg.editSubmit(1);
  111. return;
  112. }
  113. this.clearData();
  114. this.collectData();
  115. if(!HouseRentingFeesInfoDlg.validate()){
  116. return ;
  117. }
  118. //提交信息
  119. var ajax = new $ax(Feng.ctxPath + "/api/houseRentingFees/add", function(data){
  120. if(data.code == 200){
  121. Feng.success(data.msg);
  122. $("#id").val(data.obj.id);
  123. $("#fileLi").removeAttr("style");
  124. $("#checkState").val(data.obj.checkState);
  125. }else{
  126. Feng.info(data.msg);
  127. }
  128. },function(data){
  129. Feng.error("添加失败!" + data.responseJSON.message + "!");
  130. });
  131. ajax.set(this.houseRentingFeesInfoData);
  132. ajax.start();
  133. }
  134. /**
  135. * 提交修改
  136. */
  137. HouseRentingFeesInfoDlg.editSubmit = function(type) {
  138. this.clearData();
  139. this.collectData();
  140. if(!validateIsEdit())return;
  141. if(!HouseRentingFeesInfoDlg.validate()){
  142. return ;
  143. }
  144. //提交信息
  145. var ajax = new $ax(Feng.ctxPath + "/api/houseRentingFees/update", function(data){
  146. if(data.code == 200){
  147. if(type == 1){
  148. Feng.success(data.msg);
  149. }else{
  150. HouseRentingFeesInfoDlg.submitToCheck();
  151. }
  152. }else{
  153. Feng.info(data.msg);
  154. }
  155. },function(data){
  156. Feng.error("修改失败!" + data.responseJSON.message + "!");
  157. });
  158. ajax.set(this.houseRentingFeesInfoData);
  159. ajax.start();
  160. }
  161. /**
  162. * 提交审核
  163. */
  164. HouseRentingFeesInfoDlg.submitToCheck = function(){
  165. if(!validateIsEdit())return;
  166. var operation = function() {
  167. var ajax = new $ax(Feng.ctxPath + "/api/houseRentingFees/submitToCheck", function (data) {
  168. if(data.code==200){
  169. Feng.success(data.msg);
  170. window.parent.HouseRentingFees.table.refresh();
  171. HouseRentingFeesInfoDlg.close();
  172. }else{
  173. Feng.error(data.msg);
  174. }
  175. }, function (data) {
  176. Feng.error("提交审核失败!" + data.responseJSON.message + "!");
  177. });
  178. ajax.set("id", $("#id").val());
  179. ajax.start();
  180. }
  181. Feng.confirm("请确认基础信息已核对无误,相应附件已上传,一旦提交,无法修改", operation);
  182. }
  183. /**
  184. * 校验是否显示按钮
  185. * @param type 类型 1-上传按钮,2-修改删除按钮
  186. * @param row
  187. * @returns {string}
  188. */
  189. function validUploadButton(type,row,fileId){
  190. var checkState = $("#checkState").val();
  191. if(Feng.isEmptyStr(checkState)||checkState==1 || (checkState == 4 )){
  192. return type == 1?
  193. "<button type='button' onclick=\"checkFile(this,'"+row.id+"','"+null+"')\" style='margin-right: 10px' class=\"btn btn-xs btn-info\">" +
  194. "<i class=\"fa fa-upload\"></i>上传" +
  195. "</button>"
  196. :
  197. "<button type=\'button\' onclick=\"checkFile(this,'"+row.id+"','"+fileId+"')\" style=\'margin-right: 10px\' class=\"btn btn-xs btn-info\">" +
  198. "<i class=\"fa fa-paste\"></i>修改" +
  199. "</button>" +
  200. "<button type='button' onclick=\"deleteFile('"+fileId+"','"+CONFIG.project_rentingFees+"')\" class=\"btn btn-xs btn-danger\">" +
  201. "<i class=\"fa fa-times\"></i>删除" +
  202. "</button>";
  203. }else{
  204. return type == 1?"":"" ;
  205. }
  206. }
  207. function validateIsEdit(){
  208. var id = $("#id").val();
  209. var checkState = $("#checkState").val();
  210. if(Feng.isEmptyStr(id)){
  211. Feng.info("请先填写基础信息并上传附件");
  212. return false;
  213. }
  214. if(checkState != 1 && checkState != 4){
  215. Feng.info("正在审核中或已审核完成,无法操作");
  216. return false;
  217. }
  218. return true;
  219. }
  220. $(function() {
  221. Feng.initValidatorTip("houseRentingFeesInfoForm", HouseRentingFeesInfoDlg.validateFields);
  222. var id = $("#id").val();
  223. if(Feng.isNotEmptyStr(id)){
  224. $("select").each(function () {$(this).val($(this).attr("value")).trigger("change");});
  225. $("#fileLi").removeAttr("style");
  226. Feng.getCheckLog("logTable",{"type":CONFIG.project_rentingFees,"mainId":id,"typeFileId":"","active":1})
  227. }else{
  228. $("#fileLi").attr("style","pointer-events: none");
  229. }
  230. });