housepurchase.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. /**
  2. * 购房补贴管理初始化
  3. */
  4. var Housepurchase = {
  5. id: "housepurchaseTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. Housepurchase.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: '申报年度', field: 'year', visible: true, align: 'center', valign: 'middle', width: "80px"},
  17. {title: '申报类型', field: 'declareType', visible: true, align: 'center', valign: 'middle', width: "100px",
  18. formatter(value, row, index) {
  19. if (value == 1) {
  20. return "购房补贴";
  21. } else if (value == 2) {
  22. return "免租入住";
  23. }
  24. }
  25. },
  26. {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', width: "100px"},
  27. {title: '证件号码', field: 'idCard', visible: true, align: 'center', valign: 'middle', width: "130px"},
  28. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', width: "90px"},
  29. {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle', width: "100px"},
  30. {title: '婚姻状态', field: 'marryStatusName', visible: true, align: 'center', valign: 'middle', width: "80px"},
  31. {title: '配偶姓名', field: 'spouseName', visible: true, align: 'center', valign: 'middle', width: "100px"},
  32. {title: '配偶证件号码', field: 'spouseIdcard', visible: true, align: 'center', valign: 'middle', width: "150px"},
  33. {title: '房屋坐落地址', field: 'houseAddress', visible: true, align: 'center', valign: 'middle', width: "120px"},
  34. {title: '房屋建筑面积', field: 'houseArea', visible: true, align: 'center', valign: 'middle', width: "120px"},
  35. {title: '不动产权证编号', field: 'realEstateNo', visible: true, align: 'center', valign: 'middle', width: "120px"},
  36. {title: '房屋成交金额', field: 'houseMoney', visible: true, align: 'center', valign: 'middle', width: "120px"},
  37. {title: '兑现状态', field: "cashType", visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px",
  38. formatter: function (value, row, index) {
  39. if (Feng.isEmptyStr(value))
  40. return "<span style='color: black'>未判定</span>";
  41. if (row.publicState >= 3) {
  42. if (value == 1)
  43. return "<span style='color: green'>兑现</span>";
  44. if (value == 2)
  45. return "<span style='color: red'>不予兑现</span>";
  46. } else {
  47. return "<span style='color: black'>未判定</span>";
  48. }
  49. }
  50. },
  51. {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', width: "100px",
  52. formatter: function (value, row, index) {
  53. if (value == 1) {
  54. return "<span class='label'>待提交</span>"
  55. } else if (value == 10) {
  56. return "<span class='label label-danger'>已驳回</span>"
  57. } else {
  58. if (row.publicState >= 3) {
  59. if (value == -1) {
  60. return "<span class='label label-danger'>审核不通过</span>"
  61. } else if (value == 40) {
  62. return "<span class='label label-primary'>审核通过</span>"
  63. } else {
  64. return "<span class='label label-success'>审核中</span>"
  65. }
  66. } else {
  67. return "<span class='label label-success'>审核中</span>"
  68. }
  69. }
  70. }
  71. },
  72. {title: '是否兑现', field: "publicState", visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "80px",
  73. formatter: function (value, row, index) {
  74. if (value < 3) {
  75. return "<span class='label label-default'>未知</span>";
  76. }
  77. if (value == 3) {
  78. if (row.cashType == 1)
  79. return "<span class='label label-danger'>待兑现</span>";
  80. if (row.cashType == 2)
  81. return "<span class='label label-info'>无需兑现</span>";
  82. }
  83. if (value == 4)
  84. return "<span class='label label-primary'>已兑现</span>";
  85. }
  86. },
  87. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  88. formatter: function (value, row, index) {
  89. return "<span class='label label-success' onclick=\"Feng.getCheckLogModel('" + value + "','" + CONFIG.project_house + "',null)\" >" +
  90. "<i class=\"fa fa-book\"></i>日志" +
  91. "</span>";
  92. }
  93. }
  94. ];
  95. };
  96. /**
  97. * 检查是否选中
  98. */
  99. Housepurchase.check = function () {
  100. var selected = $('#' + this.id).bootstrapTable('getSelections');
  101. if (selected.length == 0) {
  102. Feng.info("请先选中表格中的某一记录!");
  103. return false;
  104. } else {
  105. Housepurchase.seItem = selected[0];
  106. return true;
  107. }
  108. };
  109. /**
  110. * 点击添加购房补贴
  111. */
  112. Housepurchase.openAddHousepurchase = function () {
  113. var ajax = new $ax("/common/batch/checkBatchValid", function (data) {
  114. if (data.code == 200) {
  115. var index = layer.open({
  116. type: 2,
  117. title: '添加购房补贴',
  118. area: ['800px', '420px'], //宽高
  119. fix: false, //不固定
  120. maxmin: true,
  121. content: Feng.ctxPath + '/enterprise/house/apply?year=' + data.batch,
  122. 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;取消'],
  123. btnAlign: 'c',
  124. btn1: function (index, layero) {
  125. var obj = layero.find("iframe")[0].contentWindow;
  126. obj.HousepurchaseInfoDlg.addSubmit();
  127. }, btn2: function (index, layero) {
  128. var obj = layero.find("iframe")[0].contentWindow;
  129. obj.HousepurchaseInfoDlg.editSubmit(2);
  130. return false;
  131. },
  132. success: function (layero, index) {
  133. layer.tips('添加基本信息并上传附件后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  134. },
  135. end: function () {
  136. layer.closeAll('tips');
  137. Housepurchase.table.refresh();
  138. }
  139. });
  140. Housepurchase.layerIndex = index;
  141. layer.full(index);
  142. } else {
  143. Feng.info(data.msg);
  144. }
  145. }, function (data) {
  146. Feng.error("校验失败!" + data.responseJSON.message + "!");
  147. });
  148. ajax.set("type", CONFIG.project_house);
  149. ajax.start();
  150. };
  151. /**
  152. * 打开查看购房补贴详情
  153. */
  154. Housepurchase.openHousepurchaseDetail = function () {
  155. if (this.check()) {
  156. var ajax = new $ax("/common/batch/checkBatchValid", function (data) {
  157. if (data.code == 200) {
  158. var index = layer.open({
  159. type: 2,
  160. title: '购房补贴详情',
  161. area: ['800px', '420px'], //宽高
  162. fix: false, //不固定
  163. maxmin: true,
  164. content: Feng.ctxPath + '/enterprise/house/apply/id/' + Housepurchase.seItem.id,
  165. 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;取消'],
  166. btnAlign: 'c',
  167. btn1: function (index, layero) {
  168. var obj = layero.find("iframe")[0].contentWindow;
  169. obj.HousepurchaseInfoDlg.addSubmit();
  170. }, btn2: function (index, layero) {
  171. var obj = layero.find("iframe")[0].contentWindow;
  172. obj.HousepurchaseInfoDlg.editSubmit(2);
  173. return false;
  174. },
  175. success: function (layero, index) {
  176. layer.tips('添加基本信息并上传附件后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  177. },
  178. end: function () {
  179. layer.closeAll('tips');
  180. Housepurchase.table.refresh();
  181. }
  182. });
  183. Housepurchase.layerIndex = index;
  184. layer.full(index);
  185. } else {
  186. Feng.info(data.msg);
  187. }
  188. }, function (data) {
  189. Feng.error("校验失败!" + data.responseJSON.message + "!");
  190. });
  191. ajax.set("type", CONFIG.project_house);
  192. ajax.set("year", Housepurchase.seItem.year);
  193. ajax.set("first_submit_time", TalentAllowanceInfo.seItem.firstSubmitTime);
  194. ajax.start();
  195. }
  196. };
  197. Housepurchase.openHousepurchaseSelect = function () {
  198. if (this.check()) {
  199. var index = layer.open({
  200. type: 2,
  201. title: '购房补贴详情',
  202. area: ['800px', '420px'], //宽高
  203. fix: false, //不固定
  204. maxmin: true,
  205. content: Feng.ctxPath + '/enterprise/house/detail/id/' + Housepurchase.seItem.id,
  206. btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  207. btnAlign: 'c',
  208. });
  209. Housepurchase.layerIndex = index;
  210. layer.full(index);
  211. }
  212. }
  213. /**
  214. * 删除购房补贴
  215. */
  216. Housepurchase.delete = function () {
  217. if (this.check()) {
  218. var operation = function () {
  219. var ajax = new $ax(Feng.ctxPath + "/enterprise/house/delete", function (data) {
  220. if (data.code == 200) {
  221. Feng.success(data.msg);
  222. Housepurchase.table.refresh();
  223. } else {
  224. Feng.info(data.msg);
  225. }
  226. }, function (data) {
  227. Feng.error("删除失败!" + data.responseJSON.message + "!");
  228. });
  229. ajax.set("housepurchaseId", Housepurchase.seItem.id);
  230. ajax.start();
  231. }
  232. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  233. }
  234. };
  235. /**
  236. * 查询表单提交参数对象
  237. * @returns {{}}
  238. */
  239. Housepurchase.formParams = function () {
  240. var queryData = {};
  241. queryData['year'] = $("#year").val();
  242. queryData['name'] = $("#name").val();
  243. queryData['idCard'] = $("#idCard").val();
  244. queryData['talentArrange'] = $("#talentArrange").val();
  245. queryData['spouseName'] = $("#spouseName").val();
  246. queryData['spouseIdcard'] = $("#spouseIdcard").val();
  247. queryData['childName'] = $("#childName").val();
  248. queryData['childIdCard'] = $("#childIdCard").val();
  249. queryData['marryStatus'] = $("#marryStatus").val();
  250. return queryData;
  251. }
  252. /**
  253. * 查询购房补贴列表
  254. */
  255. Housepurchase.search = function () {
  256. Housepurchase.table.refresh({query: Housepurchase.formParams()});
  257. };
  258. /**
  259. * 重置
  260. */
  261. Housepurchase.reset = function () {
  262. $("#year").val("");
  263. $("#name").val("");
  264. $("#idCard").val("");
  265. $("#talentArrange").val("");
  266. $("#spouseName").val("");
  267. $("#spouseIdcard").val("");
  268. $("#childName").val("");
  269. $("#childIdCard").val("");
  270. $("#marryStatus").val("");
  271. }
  272. $(function () {
  273. var defaultColunms = Housepurchase.initColumn();
  274. var table = new BSTable(Housepurchase.id, "/enterprise/house/list", defaultColunms);
  275. table.setPaginationType("server");
  276. Housepurchase.table = table.init();
  277. //批量加载字典表数据
  278. var arr = [
  279. {"name": "marryStatus", "code": "marry_status"},
  280. {"name": "talentArrange", "code": "talent_arrange"}];
  281. Feng.findChildDictBatch(JSON.stringify(arr));
  282. });