educationSchool.js 14 KB

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