houseRenting.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. /**
  2. * 租房申请管理初始化
  3. */
  4. var HouseRenting = {
  5. id: "HouseRentingTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. HouseRenting.initColumn = function () {
  14. var process = $("#process").val();
  15. if(process == 4){
  16. return [
  17. {field: 'selectItem', radio: true},
  18. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  19. {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip',
  20. formatter : function (value,row,index) {
  21. if(row.sex==1){
  22. return value+'<span style="color:#6495ED">【男】</span>';
  23. }if(row.sex==2){
  24. return value+'<span style="color:#FF82AB">【女】</span>';
  25. }
  26. }
  27. },
  28. {title: '证件类型', field: 'cardTypeName', visible: true, align: 'center', valign: 'middle',width:"80px",'class': 'uitd_showTip'},
  29. {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  30. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  31. {title: '籍贯', field: 'nativePlace', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  32. {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  33. {title: '婚姻状态', field: 'marryStatusName', visible: true, align: 'center', valign: 'middle',width:"80px",'class': 'uitd_showTip'},
  34. {title: '配偶姓名', field: 'spouseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip',
  35. formatter : function (value,row,index) {
  36. if(row.spouseSex==1){
  37. return value+'<span style="color:#6495ED">【男】</span>';
  38. }if(row.spouseSex==2){
  39. return value+'<span style="color:#FF82AB">【女】</span>';
  40. }
  41. }
  42. },
  43. {title: '配偶证件类型', field: 'spouseCardTypeName', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  44. {title: '配偶证件号码', field: 'spouseIdCard', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  45. {title: '承租开始日期', field: 'rentStartTime', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  46. {title: '承租截止时间', field: 'rentEndTime', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  47. {title: '承租详细地址', field: 'rentAddress', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  48. {title: '承租金额', field: 'rentMoney', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  49. {title: '兑现状态', field: 'publicState', visible: true, align: 'center', valign: 'middle',width:"80px",'class': 'uitd_showTip',
  50. formatter : function (value,row,index){
  51. if(value==1)return "<span style='color: red'>待兑现</span>";
  52. if(value==2)return "<span style='color: green'>已兑现</span>";
  53. }
  54. },
  55. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"80px",
  56. formatter : function (value,row,index){
  57. return "<span class='label label-success' onclick=\"Feng.getCheckLogModel('"+value+"','"+CONFIG.project_renting+"',null)\" >" +
  58. "<i class=\"fa fa-book\"></i>日志" +
  59. "</span>";
  60. }
  61. }
  62. ];
  63. }else{
  64. return [
  65. {field: 'selectItem', radio: true},
  66. {title: '审核单位', field: 'companyName', visible: process==2, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  67. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  68. {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip',
  69. formatter : function (value,row,index) {
  70. if(row.sex==1){
  71. return value+'<span style="color:#6495ED">【男】</span>';
  72. }if(row.sex==2){
  73. return value+'<span style="color:#FF82AB">【女】</span>';
  74. }
  75. }
  76. },
  77. {title: '证件类型', field: 'cardTypeName', visible: true, align: 'center', valign: 'middle',width:"80px",'class': 'uitd_showTip'},
  78. {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  79. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  80. {title: '籍贯', field: 'nativePlace', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  81. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  82. {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  83. {title: '婚姻状态', field: 'marryStatusName', visible: true, align: 'center', valign: 'middle',width:"80px",'class': 'uitd_showTip'},
  84. {title: '配偶姓名', field: 'spouseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip',
  85. formatter : function (value,row,index) {
  86. if(row.spouseSex==1){
  87. return value+'<span style="color:#6495ED">【男】</span>';
  88. }if(row.spouseSex==2){
  89. return value+'<span style="color:#FF82AB">【女】</span>';
  90. }
  91. }
  92. },
  93. {title: '配偶证件类型', field: 'spouseCardTypeName', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  94. {title: '配偶证件号码', field: 'spouseIdCard', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  95. {title: '配偶人才层次', field: 'spouseTalentArrangeName', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip'},
  96. {title: '配偶籍贯', field: 'spouseNativePlace', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  97. {title: '配偶工作单位', field: 'spouseEnterpriseName', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  98. {title: '配偶联系电话', field: 'spousePhone', visible: true, align: 'center', valign: 'middle',width:"120px",'class': 'uitd_showTip'},
  99. {title: '拟申请租住人才社区', field: 'houseTypeName', visible: true, align: 'center', valign: 'middle',width:"130px",'class': 'uitd_showTip'},
  100. // {title: '养老保险缴纳月份', field: 'pensionDetail', visible: true, align: 'center', valign: 'middle'},
  101. // {title: '失业保险缴纳月份', field: 'unemploymentDetail', visible: true, align: 'center', valign: 'middle'},
  102. // {title: '医疗保险缴纳月份', field: 'medicaDetail', visible: true, align: 'center', valign: 'middle'},
  103. // {title: '个税缴纳月份', field: 'taxDetail', visible: true, align: 'center', valign: 'middle'},
  104. {title: '审核状态', field: process == 2?'state':'checkState', visible: true, align: 'center', valign: 'middle',width:"100px",'class': 'uitd_showTip',
  105. formatter : function (value,row,index){
  106. if(process == 1 ){
  107. switch (value) {
  108. case -1:
  109. return "<span class='label label-danger'>审核不通过</span>";
  110. break;
  111. case 1:
  112. return "<span class='label'>待提交</span>"
  113. break;
  114. case 5:
  115. return "<span class='label label-success'>待审核</span>";
  116. break;
  117. case 8:
  118. return "<span class='label label-success'>重新提交</span>";
  119. break;
  120. case 10:
  121. return "<span class='label label-danger'>已驳回</span>"
  122. break;
  123. case 15:
  124. return "<span class='label label-success'>上级驳回</span>"
  125. break;
  126. case 20:
  127. case 25:
  128. case 27:
  129. case 30:
  130. return "<span class='label label-primary'>已通过</span>"
  131. break;
  132. }
  133. }else if(process == 2){
  134. if(value == 1){
  135. return "<span class='label label-success'>待审核</span>"
  136. }if(value == 2){
  137. return "<span class='label label-danger'>已驳回</span>"
  138. }if(value == 3){
  139. return "<span class='label label-primary'>已通过</span>"
  140. }if(value == 4){
  141. return "<span class='label label-warning'>上级驳回</span>"
  142. }if(value == 9){
  143. return "<span class='label label-success'>重新提交</span>"
  144. }
  145. }else if(process == 3){
  146. switch (value) {
  147. case -1:
  148. return "<span class='label label-danger'>审核不通过</span>";
  149. break;
  150. case 1:
  151. case 8:
  152. case 5:
  153. case 10:
  154. case 15:
  155. case 20:
  156. return "<span class='label label-danger'>已驳回</span>"
  157. break;
  158. case 25:
  159. return "<span class='label label-success'>待审核</span>"
  160. break;
  161. case 27:
  162. return "<span class='label label-success'>重新提交</span>"
  163. break;
  164. case 30:
  165. return "<span class='label label-primary'>已通过</span>"
  166. break;
  167. }
  168. }
  169. }
  170. },
  171. // {title: '承租开始日期', field: 'rentStartTime', visible: true, align: 'center', valign: 'middle'},
  172. // {title: '承租截止时间', field: 'rentEndTime', visible: true, align: 'center', valign: 'middle'},
  173. // {title: '承租详细地址', field: 'rentAddress', visible: true, align: 'center', valign: 'middle'},
  174. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle',width:"80px",
  175. formatter : function (value,row,index){
  176. return "<span class='label label-success' onclick=\"Feng.getCheckLogModel('"+value+"','"+CONFIG.project_renting+"',null)\" >" +
  177. "<i class=\"fa fa-book\"></i>日志" +
  178. "</span>";
  179. }
  180. }
  181. ];
  182. }
  183. };
  184. /**
  185. * 检查是否选中
  186. */
  187. HouseRenting.check = function () {
  188. var selected = $('#' + this.id).bootstrapTable('getSelections');
  189. if(selected.length == 0){
  190. Feng.info("请先选中表格中的某一记录!");
  191. return false;
  192. }else{
  193. HouseRenting.seItem = selected[0];
  194. return true;
  195. }
  196. };
  197. /**
  198. * 点击审核培训补贴
  199. */
  200. HouseRenting.openCheckHouseRenting = function (process) {
  201. if (this.check()) {
  202. var companyId = Feng.isEmptyStr(HouseRenting.seItem.companyId)?null:HouseRenting.seItem.companyId;
  203. var index = layer.open({
  204. type: 2,
  205. title: '审核租房申请',
  206. area: ['800px', '420px'], //宽高
  207. fix: false, //不固定
  208. maxmin: true,
  209. content: Feng.ctxPath + '/houseRenting/houseRenting_check/' + HouseRenting.seItem.id+"/"+companyId+"/"+process,
  210. btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;保存未提交', '<i class="fa fa-check layui-bg-green"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  211. btnAlign: 'c',
  212. btn1: function (index, layero) {
  213. var obj = layero.find("iframe")[0].contentWindow;
  214. obj.HouseRentingInfoDlg.showCheckModal(process);
  215. }, btn2: function (index, layero) {
  216. var obj = layero.find("iframe")[0].contentWindow;
  217. obj.HouseRentingInfoDlg.submitToCheck(process);
  218. return false;
  219. },
  220. success: function (layero, index) {
  221. layer.tips('审核完成并确认无误后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  222. },
  223. end: function () {
  224. layer.closeAll('tips');
  225. }
  226. });
  227. HouseRenting.layerIndex = index;
  228. layer.full(index);
  229. }
  230. };
  231. HouseRenting.showRegistModel= function(){
  232. if (this.check()) {
  233. if(HouseRenting.seItem.publicState == 2){
  234. Feng.info("不能重复登记");return;
  235. }
  236. layer.open({
  237. type: 1,
  238. id:"checkModel",
  239. title: '入住登记',
  240. area: ['800px', '450px'], //宽高
  241. fix: false, //不固定
  242. shade:0,
  243. maxmin: true,
  244. content:HouseRenting.createCheckHtml(),
  245. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交' ,'<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  246. btnAlign: 'c',
  247. zIndex: layer.zIndex,
  248. success:function(layero, index){
  249. $(".date").removeAttr('lay-key');
  250. $(".date").each(function(){
  251. laydate.render({elem: this,type: 'date',trigger: 'click'});
  252. });
  253. },
  254. yes: function (index, layero) {
  255. var rentStartTime = $("#rentStartTime").val();
  256. var rentEndTime = $("#rentEndTime").val();
  257. var rentAddress = $("#rentAddress").val();
  258. var rentMoney = $("#rentMoney").val();
  259. if(Feng.isEmptyStr(rentStartTime)){
  260. Feng.info("请填写承租开始时间");
  261. return ;
  262. }
  263. if(Feng.isEmptyStr(rentEndTime)){
  264. Feng.info("请填写承租截至时间");
  265. return ;
  266. }
  267. if(Feng.isEmptyStr(rentAddress)){
  268. Feng.info("请填写承租详细地址");
  269. return ;
  270. }
  271. if(Feng.isEmptyStr(rentMoney)){
  272. Feng.info("请填写承租金额");
  273. return ;
  274. }
  275. var operation = function() {
  276. var ajax = new $ax(Feng.ctxPath + "/houseRenting/regist", function (data) {
  277. if (data.code == 200) {
  278. layer.close(index);
  279. HouseRenting.table.refresh();
  280. Feng.success(data.msg);
  281. } else {
  282. Feng.error(data.msg);
  283. }
  284. }, function (data) {
  285. Feng.error("入住登记失败!" + data.responseJSON.message + "!");
  286. });
  287. ajax.setData({
  288. "id": HouseRenting.seItem.id,
  289. "rentStartTime": rentStartTime,
  290. "rentEndTime": rentEndTime,
  291. "rentAddress": rentAddress,
  292. "rentMoney" : rentMoney
  293. })
  294. ajax.start();
  295. }
  296. Feng.confirm("一旦提交无法修改,确认要提交吗?", operation);
  297. }
  298. });
  299. }
  300. }
  301. HouseRenting.createCheckHtml = function(){
  302. return '<form id="checkForm">\n' +
  303. '<div class="form-group" style="margin: 10px;">\n' +
  304. '<label for="checkState" class="control-label">承租开始时间</label>\n' +
  305. '<input class="form-control date" type="text" id="rentStartTime" >\n' +
  306. '</div>\n' +
  307. '<div class="form-group" style="margin: 10px;">\n' +
  308. '<label for="checkMsg" class="control-label" >承租截至时间</label>\n' +
  309. '<input class="form-control date" type="text" id="rentEndTime" >\n' +
  310. '</div>\n' +
  311. '<div class="form-group" style="margin: 10px;">\n' +
  312. '<label for="checkMsg" class="control-label" >承租详细地址</label>\n' +
  313. '<input class="form-control" type="text" id="rentAddress" >\n' +
  314. '</div>\n' +
  315. '<div class="form-group" style="margin: 10px;">\n' +
  316. '<label for="checkMsg" class="control-label" >承租金额</label>\n' +
  317. '<input class="form-control" type="text" id="rentMoney" >\n' +
  318. '</div>\n' +
  319. '</form>';
  320. }
  321. HouseRenting.showExportModal = function(){
  322. $("#exportForm")[0].reset();
  323. $("#basicExportModal").modal("show");
  324. }
  325. /**
  326. * 导出基础信息
  327. */
  328. HouseRenting.export = function(){
  329. var names = '';
  330. var values = '';
  331. $("#field_info li input").each(function(index){
  332. if($(this).is(":checked")){
  333. values = values + $(this).val() + ",";
  334. names = names + $(this).next().text() + ",";
  335. }
  336. });
  337. var queryData = HouseRenting.formParams();
  338. queryData['names'] = names;
  339. queryData['values'] = values;
  340. queryData['process'] = $("#process").val();
  341. var url = Feng.setUrlParam(Feng.ctxPath + "/houseRenting/exportBasicInfo",queryData);
  342. $("#basicExportModal").modal('hide');
  343. window.location.href = url;
  344. }
  345. /**
  346. * 查询表单提交参数对象
  347. * @returns {{}}
  348. */
  349. HouseRenting.formParams = function() {
  350. var queryData = {};
  351. queryData['enterpriseName'] = $("#enterpriseName").val();
  352. queryData['name'] = $("#name").val();
  353. queryData['sex'] = $("#sex").val();
  354. queryData['cardType'] = $("#cardType").val();
  355. queryData['idCard'] = $("#idCard").val();
  356. queryData['talentArrange'] = $("#talentArrange").val();
  357. queryData['marryStatus'] = $("#marryStatus").val();
  358. queryData['spouseName'] = $("#spouseName").val();
  359. queryData['spouseSex'] = $("#spouseSex").val();
  360. queryData['spouseCardType'] = $("#spouseCardType").val();
  361. queryData['spouseIdcard'] = $("#spouseIdcard").val();
  362. queryData['spouseTalentArrange'] = $("#spouseTalentArrange").val();
  363. queryData['houseType'] = $("#houseType").val();
  364. queryData['checkState'] = $("#checkState").val();
  365. return queryData;
  366. }
  367. /**
  368. * 查询购房补贴列表
  369. */
  370. HouseRenting.search = function () {
  371. HouseRenting.table.refresh({query: HouseRenting.formParams()});
  372. };
  373. /**
  374. * 重置
  375. */
  376. HouseRenting.reset = function(){
  377. $("#enterpriseName").val("");
  378. $("#name").val("");
  379. $("#sex").val("");
  380. $("#cardType").val("");
  381. $("#idCard").val("");
  382. $("#talentArrange").val("");
  383. $("#marryStatus").val("");
  384. $("#spouseName").val("");
  385. $("#spouseSex").val("");
  386. $("#spouseCardType").val("");
  387. $("#spouseIdcard").val("");
  388. $("#spouseTalentArrange").val("");
  389. $("#houseType").val("");
  390. $("#checkState").val("");
  391. }
  392. $(function () {
  393. var defaultColunms = HouseRenting.initColumn();
  394. var table = new BSTable(HouseRenting.id, "/houseRenting/list/"+$("#process").val(), defaultColunms);
  395. table.setPaginationType("server");
  396. HouseRenting.table = table.init();
  397. //批量加载字典表数据
  398. var arr = [
  399. {"name":"marryStatus","code":"un_marryStatus"},
  400. {"name":"talentArrange","code":"un_talentLevel"},
  401. {"name":"cardType","code":"un_cardType"},
  402. {"name":"spouseCardType","code":"un_cardType"},
  403. {"name":"spouseTalentArrange","code":"un_talentLevel"},
  404. {"name":"houseType","code":"un_renting_houseType"},
  405. {"name":"childCardType","code":"un_cardType"}];
  406. Feng.findChildDictBatch(JSON.stringify(arr));
  407. });