talentAllowanceInfo.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. /**
  2. * 优秀人才津补贴管理初始化
  3. */
  4. var TalentAllowanceInfo = {
  5. id: "TalentAllowanceInfoTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 检查是否选中
  12. */
  13. TalentAllowanceInfo.check = function () {
  14. var selected = $('#' + this.id).bootstrapTable('getSelections');
  15. if (selected.length != 1) {
  16. Feng.info("请先选中表格中的某一记录!");
  17. return false;
  18. } else {
  19. TalentAllowanceInfo.seItem = selected[0];
  20. return true;
  21. }
  22. };
  23. /**
  24. * 点击添加优秀人才津补贴
  25. */
  26. TalentAllowanceInfo.openCheckTalentAllowanceInfo = function () {
  27. if (this.check()) {
  28. var index = null;
  29. var process = $("#process").val();
  30. index = layer.open({
  31. type: 2,
  32. title: '津补贴审核',
  33. fix: false, //不固定
  34. maxmin: true,
  35. content: Feng.ctxPath + '/enterprise/talentAllowance/toCheckPage/id/' + TalentAllowanceInfo.seItem.id,
  36. btn: ['<i class="fa fa-eye"></i>&nbsp;&nbsp;保存未提交', '<i class="fa fa-save layui-bg-green"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  37. btnAlign: 'c',
  38. btn1: function (index, layero) {
  39. var obj = layero.find("iframe")[0].contentWindow;
  40. obj.TalentAllowanceInfoDlg.showCheckModal();
  41. },
  42. btn2: function (index, layero) {
  43. var obj = layero.find("iframe")[0].contentWindow;
  44. obj.TalentAllowanceInfoDlg.submitCheck();
  45. return false;
  46. },
  47. end: function () {
  48. layer.closeAll('tips');
  49. TalentAllowanceInfo.table.refresh();
  50. }
  51. });
  52. layer.full(index);
  53. TalentAllowanceInfo.layerIndex = index;
  54. }
  55. };
  56. /**
  57. * 查看
  58. */
  59. TalentAllowanceInfo.select = function () {
  60. if (this.check()) {
  61. var process = $("#process").val();
  62. var url = Feng.ctxPath + '/enterprise/talentAllowance/toSelectPage/id/' + TalentAllowanceInfo.seItem.id;
  63. var index = layer.open({
  64. type: 2,
  65. title: '津补贴查看',
  66. fix: false, //不固定
  67. maxmin: true,
  68. shadeClose: false,
  69. content: url,
  70. btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  71. btnAlign: 'c',
  72. });
  73. layer.full(index);
  74. TalentAllowanceInfo.layerIndex = index;
  75. }
  76. }
  77. TalentAllowanceInfo.updateFieldsAndFiles = function () {
  78. if (this.check()) {
  79. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/findFieldsAndFiles?id=" + TalentAllowanceInfo.seItem.id, function (data) {
  80. var obj = data.obj.obj;
  81. if (data.code == 200) {
  82. layer.open({
  83. type: 1,
  84. id: "neewFieldFormModel",
  85. title: '修改',
  86. area: ['800px', '450px'], //宽高
  87. fix: false, //不固定
  88. shade: 0,
  89. maxmin: true,
  90. content: '<form id="checkForm">\n' +
  91. ' <div class="form-group" id="field" style="margin: 10px">\n' +
  92. ' <label for="field_concat" class="control-label">可修改合同时间</label>\n' +
  93. ' <div id="field_concat">\n' +
  94. ' </div>\n' +
  95. ' <label for="field_project" class="control-label">可修改字段</label>\n' +
  96. ' <div id="field_field">\n' +
  97. ' <ul><li style="width: 100%"><input type="checkbox" id="typeChange" class="icheckbox" value="allowanceType"><span>津补贴类型</span></li></ul>\n' +
  98. ' <!--<ul><li style="width: 100%"><input type="checkbox" value="wage"><span>上一年度年薪(元)</span></li></ul>-->' +
  99. ' </div>\n' +
  100. ' <label for="field_project" class="control-label">可修改项目</label>\n' +
  101. ' <div id="field_project">\n' +
  102. ' </div>\n' +
  103. ' <label for="field_file" class="control-label">可修改附件</label>\n' +
  104. ' <div id="field_file">\n' +
  105. ' </div>\n' +
  106. ' <div class="form-group" style="text-align: center">\n' +
  107. ' <button type="button" class="btn btn-primary" onclick="TalentAllowanceInfoSupple.checkAll(\'field\')">全选</button>\n' +
  108. ' <button type="button" class="btn btn-success" onclick="TalentAllowanceInfoSupple.unCheckAll(\'field\')">反选</button>\n' +
  109. ' </div>\n' +
  110. ' </div>\n' +
  111. ' </form>',
  112. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  113. btnAlign: 'c',
  114. zIndex: layer.zIndex,
  115. success: function (layero, index) {
  116. var projectList = data.obj.projects;
  117. var fileList = data.obj.files;
  118. var concatList = data.obj.concats;
  119. var files = data.obj.info.files;
  120. var projects = data.obj.info.projects;
  121. var concats = data.obj.info.concats;
  122. var fields = data.obj.info.fields;
  123. //初始化附件、核查项目、合同
  124. if (projectList != null && projectList.length != 0) {
  125. var html = '<ul>';
  126. for (var key in projectList) {
  127. html = html + '<li style="width: 100%"><input type="checkbox" class="icheckbox" value="' + projectList[key].id + '"><span>' + projectList[key].projectName + '</span></li>';
  128. }
  129. html = html + "</ul>";
  130. $("#field_project").empty().append(html);
  131. }
  132. if (fileList != null && fileList.length != 0) {
  133. var html = '';
  134. for (var key in fileList) {
  135. html = html + '<ul><li style="width: 100%"><input type="checkbox" class="icheckbox" data-type="' + fileList[key].isConditionFile + '" value="' + fileList[key].id + '"><span>' + fileList[key].name + '</span></li></ul>';
  136. }
  137. $("#field_file").empty().append(html);
  138. }
  139. if (concatList != null && concatList.length != 0) {
  140. var html = '';
  141. for (var key in concatList) {
  142. html = html + '<ul><li style="width: 100%"><input type="checkbox" class="icheckbox" value="' + concatList[key].id + '"><span>' + concatList[key].enterpriseName + '</span></li></ul>';
  143. }
  144. $("#field_concat").empty().append(html);
  145. }
  146. TalentAllowanceInfoSupple.initICheck();
  147. if (Feng.isNotEmptyStr(projects)) {
  148. $("#field_project input").each(function () {
  149. if (projects.indexOf($(this).val()) != -1) {
  150. $(this).iCheck("check");
  151. }
  152. });
  153. }
  154. if (files != null && files != '') {
  155. $("#field_file input").each(function () {
  156. if (files.indexOf($(this).val()) != -1) {
  157. $(this).iCheck("check");
  158. }
  159. });
  160. }
  161. if (concats != null && concats != '') {
  162. $("#field_concat input").each(function () {
  163. if (concats.indexOf($(this).val()) != -1) {
  164. $(this).iCheck("check");
  165. }
  166. });
  167. }
  168. if (Feng.isNotEmptyStr(fields)) {
  169. $("#field_field input").each(function () {
  170. if (fields.indexOf($(this).val()) != -1) {
  171. $(this).iCheck("check");
  172. }
  173. });
  174. }
  175. $("input[type=checkbox][value=allowanceType]").on("ifChanged", function (e) {
  176. var isChecked = $(this).is(":checked") ? "check" : "uncheck";
  177. $("#field_file input").each(function () {
  178. $(this).iCheck(isChecked);
  179. })
  180. $("#field_project input").each(function () {
  181. $(this).iCheck(isChecked);
  182. })
  183. })
  184. },
  185. yes: function (index, layero) {
  186. var projects = '', files = '', concats = '', fields = '';
  187. $("#field_project li input").each(function (index) {
  188. if ($(this).is(":checked")) {
  189. projects = projects + $(this).val() + ",";
  190. }
  191. });
  192. $("#field_file li input").each(function (index) {
  193. if ($(this).is(":checked")) {
  194. files = files + $(this).val() + ",";
  195. }
  196. });
  197. $("#field_concat li input").each(function (index) {
  198. if ($(this).is(":checked")) {
  199. concats = concats + $(this).val() + ",";
  200. }
  201. });
  202. $("#field_field li input").each(function (index) {
  203. if ($(this).is(":checked")) {
  204. fields = fields + $(this).val() + ",";
  205. }
  206. });
  207. fields = fields.substring(0, fields.length - 1);
  208. if (Feng.isEmptyStr(projects) && Feng.isEmptyStr(files) && Feng.isEmptyStr(concats) && Feng.isEmptyStr(fields)) {
  209. Feng.info("请选择可修改的字段、附件或合同!");
  210. return;
  211. }
  212. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/updateFieldsAndFiles", function (data) {
  213. if (data.code == 200) {
  214. layer.close(index);
  215. Feng.success(data.msg);
  216. } else {
  217. Feng.error(data.msg);
  218. }
  219. }, function (data) {
  220. Feng.error("修改失败!" + data.responseJSON.message + "!");
  221. });
  222. ajax.setData({
  223. "id": TalentAllowanceInfo.seItem.id,
  224. "projects": projects,
  225. "files": files,
  226. "concats": concats,
  227. "fields": fields
  228. })
  229. ajax.start();
  230. }
  231. });
  232. } else {
  233. Feng.error(data.msg);
  234. }
  235. }, function (data) {
  236. Feng.error("查询失败!" + data.responseJSON.message + "!");
  237. });
  238. ajax.start();
  239. }
  240. }
  241. /**
  242. * 导出基础信息
  243. */
  244. TalentAllowanceInfo.exportBasicInfo = function () {
  245. var process = $("#process").val();
  246. var queryData = TalentAllowanceInfo.formParams();
  247. queryData['process'] = process;
  248. var url = Feng.setUrlParam(Feng.ctxPath + "/enterprise/talentAllowance/exportBasicInfo", queryData);
  249. window.hiddenIframe.location.href = url;
  250. }
  251. /**
  252. * 回调
  253. */
  254. TalentAllowanceInfo.callBack = function (data) {
  255. if (data.code == 200) {
  256. $("#importModal").modal("hide");
  257. Feng.success(data.msg);
  258. } else {
  259. Feng.error(data.msg);
  260. }
  261. }
  262. /**
  263. * 查询表单提交参数对象
  264. * @returns {{}}
  265. */
  266. TalentAllowanceInfo.formParams = function () {
  267. var queryData = {};
  268. queryData['year'] = $("#year").val();
  269. queryData['enterpriseName'] = $("#enterpriseName").val();
  270. queryData['name'] = $("#name").val();
  271. queryData['idCard'] = $("#idCard").val();
  272. queryData['talentType'] = $("#talentType").val();
  273. queryData['talentArrange'] = $("#talentArrange").val();
  274. queryData['address'] = $("#address").val();
  275. queryData['identifyCondition'] = $("#identifyCondition").val();
  276. queryData['isSupple'] = $("#isSupple").val();
  277. queryData['checkState'] = $("#checkState").val();
  278. queryData['isPublicCheck'] = $("#isPublicCheck").val();
  279. queryData['publicState'] = $("#publicState").val();
  280. queryData['allowanceType'] = $("#allowanceType").val();
  281. queryData['recommendAllowanceType'] = $("#recommendAllowanceType").val();
  282. queryData['companyName'] = $("#companyName").val();
  283. queryData['introductionMode'] = $("#introductionMode").val();
  284. queryData['firstJJStartTime'] = $("#firstJJStartTime").val();
  285. queryData['firstJJEndTime'] = $("#firstJJEndTime").val();
  286. return queryData;
  287. }
  288. /**
  289. * 查询人才认定申报列表
  290. */
  291. TalentAllowanceInfo.search = function () {
  292. TalentAllowanceInfo.table.refresh({
  293. query: TalentAllowanceInfo.formParams()
  294. });
  295. };
  296. /**
  297. * 重置
  298. */
  299. TalentAllowanceInfo.reset = function () {
  300. $("#year").val("");
  301. $("#enterpriseName").val("");
  302. $("#name").val("");
  303. $("#idCard").val("");
  304. $("#talentType").val("");
  305. $("#talentArrange").val("");
  306. $("#address").val("");
  307. $("#identifyCondition").val("");
  308. $("#isSupple").val("");
  309. $("#checkState").val("");
  310. $("#isPublicCheck").val("");
  311. $("#publicState").val("");
  312. $("#recommendAllowanceType").val("");
  313. $("#companyName").val("");
  314. $("#introductionMode").val("");
  315. $("#firstJJStartTime").val("");
  316. $("#firstJJEndTime").val("");
  317. }
  318. /**
  319. * 获取人才认定
  320. */
  321. TalentAllowanceInfo.getIdentifyCondition = function () {
  322. var level = $("#talentArrange").val();
  323. if (level == null || level == '') {
  324. $("#identifyCondition").empty();
  325. $("#identifyCondition").trigger('chosen:updated');
  326. return;
  327. }
  328. Feng.addAjaxSelect({
  329. "id": "identifyCondition",
  330. "displayCode": "id",
  331. "displayName": "name",
  332. "type": "GET",
  333. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level=" + level
  334. });
  335. $("#identifyCondition").trigger('chosen:updated');
  336. }
  337. $(function () {
  338. var process = $("#process").val();
  339. var defaultColunms = TalentAllowanceInfoSupple.initColumn(process);
  340. var table = new BSTable(TalentAllowanceInfo.id, "/enterprise/talentAllowance/examineList", defaultColunms);
  341. table.setPaginationType("server");
  342. table.setOnDblClickRow(function () {
  343. TalentAllowanceInfo.openCheckTalentAllowanceInfo();
  344. });
  345. table.setSingleSelect(false);
  346. TalentAllowanceInfo.table = table.init();
  347. //批量加载字典表数据
  348. var arr = [{
  349. "name": "address",
  350. "code": "street"
  351. }, {
  352. "name": "talentArrange",
  353. "code": "talent_arrange"
  354. }, {
  355. "name": "nationality",
  356. "code": "nationality"
  357. }, {
  358. "name": "talentType",
  359. "code": "talent_type"
  360. }, {"name": "introductionMode", "code": "un_introduction_mode"}];
  361. Feng.findChildDictBatch(JSON.stringify(arr));
  362. $("#identifyCondition").on('chosen:ready', function (e, params) {
  363. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  364. });
  365. $("#identifyCondition").chosen({
  366. search_contains: true,
  367. //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  368. disable_search: false,
  369. width: "100%",
  370. enable_split_word_search: true
  371. });
  372. $('#checkAll').click(function () {
  373. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('checkAll').bootstrapTable('togglePagination');
  374. })
  375. $('#uncheckAll').click(function () {
  376. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination')
  377. })
  378. $(".time").each(function () {
  379. laydate.render({
  380. elem: "#" + $(this).attr("id")
  381. , type: "date"
  382. , trigger: 'click'
  383. });
  384. });
  385. });