educationSchool.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. /**
  2. * 子女就学管理初始化
  3. */
  4. var EducationSchool = {
  5. id: "EducationSchoolTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. EducationSchool.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: '申报年度', field: 'year', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  17. {title: '申报项目', field: 'projectName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  18. {title: '父母姓名', field: 'pName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  19. {title: '父母性别', field: 'pSex', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip',
  20. formatter: function (value, row, index) {
  21. if (value == 1) {
  22. return '男';
  23. }
  24. if (value == 2) {
  25. return '女';
  26. }
  27. }
  28. },
  29. {title: '父母证件号码', field: 'pIdcard', visible: true, align: 'center', valign: 'middle', width: "150px", 'class': 'uitd_showTip'},
  30. {title: '工作单位', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  31. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  32. {title: '认定条件', field: 'identifyCondition', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  33. {title: '人才证书有效期', field: 'certificateNo', visible: true, align: 'center', valign: 'middle', width: "140px", 'class': 'uitd_showTip',
  34. formatter: function (value, row, index) {
  35. return row.certificateStartTime + "至" + row.qzgccrcActiveTime;
  36. }
  37. },
  38. {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle', width: "80px", 'class': 'uitd_showTip'},
  39. {title: '子女姓名', field: 'cName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  40. {title: '子女性别', field: 'cSex', visible: true, align: 'center', valign: 'middle', width: "80px",
  41. formatter: function (value, row, index) {
  42. if (value == 1) {
  43. return '男';
  44. }
  45. if (value == 2) {
  46. return '女';
  47. }
  48. }
  49. },
  50. {title: '与申报人关系', field: 'cRelationName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  51. {title: '现就读学校', field: 'nowSchool', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  52. {title: '现就读年级', field: 'nowGradeName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  53. {title: '拟申请学校', field: 'applySchoolName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  54. {title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', width: "100px",
  55. formatter: function (value, row, index) {
  56. if (value == -2) {
  57. return '<span class="label label-default">待提交</span>';
  58. }
  59. if (value == -1) {
  60. return '<span class="label label-danger">审核不通过</span>';
  61. }
  62. if (value == 1) {
  63. return '<span class="label label-success">待审核</span>';
  64. }
  65. if (value == 2) {
  66. return '<span class="label label-danger">审核驳回</span>';
  67. }
  68. if (value == 3) {
  69. return '<span class="label label-primary">审核通过</span>';
  70. }
  71. if (value == 9) {
  72. return '<span class="label label-warning">重新提交</span>';
  73. }
  74. }
  75. },
  76. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  77. formatter: function (value, row, index) {
  78. return "<span class='label label-success' onclick=\"EducationSchool.showLog('" + value + "')\" >" +
  79. "<i class=\"fa fa-book\"></i>日志" +
  80. "</span>";
  81. }
  82. }
  83. ];
  84. };
  85. /**
  86. * 检查是否选中
  87. */
  88. EducationSchool.check = function () {
  89. var selected = $('#' + this.id).bootstrapTable('getSelections');
  90. if (selected.length == 0) {
  91. Feng.info("请先选中表格中的某一记录!");
  92. return false;
  93. } else {
  94. EducationSchool.seItem = selected[0];
  95. return true;
  96. }
  97. };
  98. /**
  99. * 点击添加子女就学
  100. */
  101. EducationSchool.openAddEducationSchool = function () {
  102. var ajax = new $ax(Feng.ctxPath + "/person/education/validateIsAdd", function (data) {
  103. if (data.code == 200) {
  104. var index = layer.open({
  105. type: 2,
  106. title: '子女就学申报',
  107. area: 'auto', //宽高
  108. fix: false, //不固定
  109. maxmin: true,
  110. content: Feng.ctxPath + '/person/education/apply?year=' + data.obj,
  111. 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;取消'],
  112. btnAlign: 'c',
  113. btn1: function (index, layero) {
  114. var obj = layero.find("iframe")[0].contentWindow;
  115. obj.EducationSchoolInfoDlg.addSubmit();
  116. }, btn2: function (index, layero) {
  117. var obj = layero.find("iframe")[0].contentWindow;
  118. obj.EducationSchoolInfoDlg.submitToCheck();
  119. return false;
  120. },
  121. success: function (layero, index) {
  122. layer.tips('添加基本信息并上传附件后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  123. },
  124. end: function () {
  125. layer.closeAll('tips');
  126. }
  127. });
  128. EducationSchool.layerIndex = index;
  129. layer.full(index);
  130. } else {
  131. Feng.info(data.msg);
  132. }
  133. }, function (data) {
  134. Feng.error("校验失败!" + data.responseJSON.message + "!");
  135. });
  136. // ajax.set("type",CONFIG.batch_school);
  137. ajax.start();
  138. };
  139. /**
  140. * 打开查看子女就学详情
  141. */
  142. EducationSchool.openEducationSchoolDetail = function () {
  143. if (this.check()) {
  144. var ajax = new $ax(Feng.ctxPath + "/common/batch/checkBatchValid", function (data) {
  145. if (data.code == 200) {
  146. var index = layer.open({
  147. type: 2,
  148. title: '子女就学申报',
  149. area: 'auto', //宽高
  150. fix: false, //不固定
  151. maxmin: true,
  152. content: Feng.ctxPath + '/person/education/apply/id/' + EducationSchool.seItem.id,
  153. 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;取消'],
  154. btnAlign: 'c',
  155. btn1: function (index, layero) {
  156. var obj = layero.find("iframe")[0].contentWindow;
  157. obj.EducationSchoolInfoDlg.addSubmit();
  158. }, btn2: function (index, layero) {
  159. var obj = layero.find("iframe")[0].contentWindow;
  160. obj.EducationSchoolInfoDlg.submitToCheck();
  161. return false;
  162. },
  163. success: function (layero, index) {
  164. layer.tips('添加基本信息并上传附件后点击', '.layui-layer-btn1', {tips: [1, "#78BA32"], time: 0, closeBtn: 2});
  165. },
  166. end: function () {
  167. layer.closeAll('tips');
  168. }
  169. });
  170. EducationSchool.layerIndex = index;
  171. layer.full(index);
  172. } else {
  173. Feng.info(data.msg);
  174. }
  175. }, function (data) {
  176. Feng.error("校验失败!" + data.responseJSON.message + "!");
  177. });
  178. ajax.set("type", CONFIG.project_school);
  179. ajax.set("year", EducationSchool.seItem.year)
  180. ajax.set("first_submit_time", EducationSchool.seItem.firstSubmitTime)
  181. ajax.start();
  182. }
  183. };
  184. EducationSchool.openEducationSchoolSelect = function () {
  185. if (this.check()) {
  186. var index = layer.open({
  187. type: 2,
  188. title: '子女择校申报详情',
  189. area: ['800px', '420px'], //宽高
  190. fix: false, //不固定
  191. maxmin: true,
  192. content: Feng.ctxPath + '/person/education/detail/id/' + EducationSchool.seItem.id,
  193. btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  194. btnAlign: 'c',
  195. });
  196. layer.full(index);
  197. EducationSchool.layerIndex = index;
  198. }
  199. }
  200. /**
  201. * 删除子女就学
  202. */
  203. EducationSchool.delete = function () {
  204. if (this.check()) {
  205. if (EducationSchool.seItem.checkState != -2) {
  206. Feng.error("仅能删除未提交的数据");
  207. return;
  208. }
  209. var operation = function () {
  210. var ajax = new $ax(Feng.ctxPath + "/person/education/delete", function (data) {
  211. if (data.code == 200) {
  212. Feng.success(data.msg);
  213. EducationSchool.table.refresh();
  214. } else {
  215. Feng.info(data.msg);
  216. }
  217. }, function (data) {
  218. Feng.error("删除失败!" + data.responseJSON.message + "!");
  219. });
  220. ajax.set("educationSchoolId", EducationSchool.seItem.id);
  221. ajax.start();
  222. }
  223. Feng.confirm("删除后无法恢复,确认删除吗?", operation);
  224. }
  225. };
  226. /**
  227. *
  228. */
  229. EducationSchool.print = function () {
  230. if (this.check()) {
  231. if (EducationSchool.seItem.checkState != 3) {
  232. Feng.error("暂未审核通过,无法打印");
  233. return;
  234. }
  235. window.open("/webroot/decision/view/report?viewlet=educationSchool.cpt&&id=" + EducationSchool.seItem.id);
  236. }
  237. }
  238. /**
  239. * 收集数据
  240. */
  241. EducationSchool.formParams = function () {
  242. var queryData = {};
  243. queryData['year'] = $("#year").val();
  244. queryData['enterpriseName'] = $("#enterpriseName").val();
  245. queryData['pName'] = $("#pName").val();
  246. queryData['pSex'] = $("#pSex").val();
  247. queryData['pIdcard'] = $("#pIdcard").val();
  248. queryData['talentArrange'] = $("#talentArrange").val();
  249. queryData['certificateNo'] = $("#certificateNo").val();
  250. queryData['address'] = $("#address").val();
  251. queryData['phone'] = $("#phone").val();
  252. queryData['cName'] = $("#cName").val();
  253. queryData['cSex'] = $("#cSex").val();
  254. queryData['cIdcard'] = $("#cIdcard").val();
  255. queryData['cRelation'] = $("#cRelation").val();
  256. queryData['nowSchool'] = $("#nowSchool").val();
  257. queryData['nowGrade'] = $("#nowGrade").val();
  258. queryData['applySchool'] = $("#applySchool").val();
  259. queryData['companyStreet'] = $("#companyStreet").val();
  260. queryData['houseStreet'] = $("#houseStreet").val();
  261. queryData['checkState'] = $("#checkState").val();
  262. queryData['project'] = $("#project").val();
  263. return queryData;
  264. }
  265. /**
  266. * 重置
  267. */
  268. EducationSchool.reset = function () {
  269. $("#year").val("");
  270. $("#enterpriseName").val("");
  271. $("#pName").val("");
  272. $("#pSex").val("");
  273. $("#pIdcard").val("");
  274. $("#talentArrange").val("");
  275. $("#certificateNo").val("");
  276. $("#address").val("");
  277. $("#phone").val("");
  278. $("#cName").val("");
  279. $("#cSex").val("");
  280. $("#cIdcard").val("");
  281. $("#cRelation").val("");
  282. $("#nowSchool").val("");
  283. $("#nowGrade").val("");
  284. $("#applySchool").val("").trigger("chosen:updated");
  285. $("#companyStreet").val("");
  286. $("#houseStreet").val("");
  287. $("#checkState").val("");
  288. $("#project").val("");
  289. }
  290. /**
  291. * 查询子女就学列表
  292. */
  293. EducationSchool.search = function () {
  294. EducationSchool.table.refresh({query: EducationSchool.formParams()});
  295. };
  296. /**
  297. * 显示审核日志
  298. */
  299. EducationSchool.showLog = function (id) {
  300. layer.open({
  301. type: 1,
  302. title: "日志",
  303. fixed: false,
  304. content: '<table id="' + id + '"></table>',
  305. area: ['80%', '80%'],
  306. maxmin: true,
  307. success: function (layero, index) {
  308. Feng.getCheckLog(id, {"type": CONFIG.project_school, "mainId": id, "typeFileId": "", "active": 1})
  309. }
  310. });
  311. }
  312. $(function () {
  313. var defaultColunms = EducationSchool.initColumn();
  314. var table = new BSTable(EducationSchool.id, "/person/education/list", defaultColunms);
  315. table.setPaginationType("server");
  316. table.setOnDblClickRow(function () {
  317. EducationSchool.openEducationSchoolDetail();
  318. });
  319. EducationSchool.table = table.init();
  320. //批量加载字典表数据
  321. var arr = [
  322. {"name": "companyStreet", "code": "street"},
  323. {"name": "houseStreet", "code": "street"},
  324. {"name": "talentArrange", "code": "talent_arrange"},
  325. {"name": "cRelation", "code": "education_relation"},
  326. {"name": "nowGrade", "code": "education_grade"},
  327. {"name": "applySchool", "code": "education_school_pool"}];
  328. Feng.findChildDictBatch(JSON.stringify(arr));
  329. $("#applySchool").on('chosen:ready', function (e, params) {
  330. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  331. });
  332. $("#applySchool").chosen({
  333. search_contains: true,    //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  334. disable_search: false,
  335. width: "100%",
  336. enable_split_word_search: true
  337. });
  338. });