housepurchase.js 12 KB

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