talentAllowanceInfo.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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. if (data.code == 200) {
  81. var obj = data.obj.obj;
  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_project" class="control-label">可修改字段</label>\n' +
  93. ' <div id="field_field">\n' +
  94. ' <ul><li style="width: 100%"><input type="checkbox" id="typeChange" class="icheckbox" value="allowanceType"><span>津补贴类型</span></li></ul>\n' +
  95. ' <!--<ul><li style="width: 100%"><input type="checkbox" value="wage"><span>上一年度年薪(元)</span></li></ul>-->' +
  96. ' </div>\n' +
  97. ' <label for="field_project" class="control-label">可修改项目</label>\n' +
  98. ' <div id="field_project">\n' +
  99. ' </div>\n' +
  100. ' <label for="field_file" class="control-label">可修改附件</label>\n' +
  101. ' <div id="field_file">\n' +
  102. ' </div>\n' +
  103. ' <div class="form-group" style="text-align: center">\n' +
  104. ' <button type="button" class="btn btn-primary" onclick="TalentAllowanceInfoSupple.checkAll(\'field\')">全选</button>\n' +
  105. ' <button type="button" class="btn btn-success" onclick="TalentAllowanceInfoSupple.unCheckAll(\'field\')">反选</button>\n' +
  106. ' </div>\n' +
  107. ' </div>\n' +
  108. ' </form>',
  109. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  110. btnAlign: 'c',
  111. zIndex: layer.zIndex,
  112. success: function (layero, index) {
  113. var projectList = data.obj.projects;
  114. var fileList = data.obj.files;
  115. var concatList = data.obj.concats;
  116. var files = data.obj.info.files;
  117. var projects = data.obj.info.projects;
  118. var concats = data.obj.info.concats;
  119. var fields = data.obj.info.fields;
  120. //初始化附件、核查项目、合同
  121. if (projectList != null && projectList.length != 0) {
  122. var html = '<ul>';
  123. for (var key in projectList) {
  124. html = html + '<li style="width: 100%"><input type="checkbox" class="icheckbox" value="' + projectList[key].id + '"><span>' + projectList[key].projectName + '</span></li>';
  125. }
  126. html = html + "</ul>";
  127. $("#field_project").empty().append(html);
  128. }
  129. if (fileList != null && fileList.length != 0) {
  130. var html = '';
  131. for (var key in fileList) {
  132. 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>';
  133. }
  134. $("#field_file").empty().append(html);
  135. }
  136. if (concatList != null && concatList.length != 0) {
  137. var html = '';
  138. for (var key in concatList) {
  139. html = html + '<ul><li style="width: 100%"><input type="checkbox" class="icheckbox" value="' + concatList[key].id + '"><span>' + concatList[key].enterpriseName + '</span></li></ul>';
  140. }
  141. $("#field_concat").empty().append(html);
  142. }
  143. TalentAllowanceInfoSupple.initICheck();
  144. if (Feng.isNotEmptyStr(projects)) {
  145. $("#field_project input").each(function () {
  146. if (projects.indexOf($(this).val()) != -1) {
  147. $(this).iCheck("check");
  148. }
  149. });
  150. }
  151. if (files != null && files != '') {
  152. $("#field_file input").each(function () {
  153. if (files.indexOf($(this).val()) != -1) {
  154. $(this).iCheck("check");
  155. }
  156. });
  157. }
  158. if (concats != null && concats != '') {
  159. $("#field_concat input").each(function () {
  160. if (concats.indexOf($(this).val()) != -1) {
  161. $(this).iCheck("check");
  162. }
  163. });
  164. }
  165. if (Feng.isNotEmptyStr(fields)) {
  166. $("#field_field input").each(function () {
  167. if (fields.indexOf($(this).val()) != -1) {
  168. $(this).iCheck("check");
  169. }
  170. });
  171. }
  172. $("input[type=checkbox][value=allowanceType]").on("ifChanged", function (e) {
  173. var isChecked = $(this).is(":checked") ? "check" : "uncheck";
  174. $("#field_file input").each(function () {
  175. $(this).iCheck(isChecked);
  176. })
  177. $("#field_project input").each(function () {
  178. $(this).iCheck(isChecked);
  179. })
  180. })
  181. },
  182. yes: function (index, layero) {
  183. var projects = '', files = '', concats = '', fields = '';
  184. $("#field_project li input").each(function (index) {
  185. if ($(this).is(":checked")) {
  186. projects = projects + $(this).val() + ",";
  187. }
  188. });
  189. $("#field_file li input").each(function (index) {
  190. if ($(this).is(":checked")) {
  191. files = files + $(this).val() + ",";
  192. }
  193. });
  194. $("#field_concat li input").each(function (index) {
  195. if ($(this).is(":checked")) {
  196. concats = concats + $(this).val() + ",";
  197. }
  198. });
  199. $("#field_field li input").each(function (index) {
  200. if ($(this).is(":checked")) {
  201. fields = fields + $(this).val() + ",";
  202. }
  203. });
  204. fields = fields.substring(0, fields.length - 1);
  205. if (Feng.isEmptyStr(projects) && Feng.isEmptyStr(files) && Feng.isEmptyStr(concats) && Feng.isEmptyStr(fields)) {
  206. Feng.info("请选择可修改的字段、附件或合同!");
  207. return;
  208. }
  209. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/updateFieldsAndFiles", function (data) {
  210. if (data.code == 200) {
  211. layer.close(index);
  212. Feng.success(data.msg);
  213. } else {
  214. Feng.error(data.msg);
  215. }
  216. }, function (data) {
  217. Feng.error("修改失败!" + data.responseJSON.message + "!");
  218. });
  219. ajax.setData({
  220. "id": TalentAllowanceInfo.seItem.id,
  221. "projects": projects,
  222. "files": files,
  223. "concats": concats,
  224. "fields": fields
  225. })
  226. ajax.start();
  227. }
  228. });
  229. } else {
  230. Feng.error(data.msg);
  231. }
  232. }, function (data) {
  233. Feng.error("查询失败!" + data.responseJSON.message + "!");
  234. });
  235. ajax.start();
  236. }
  237. }
  238. /**
  239. * 导出基础信息
  240. */
  241. TalentAllowanceInfo.exportBasicInfo = function () {
  242. var process = $("#process").val();
  243. var queryData = TalentAllowanceInfo.formParams();
  244. queryData['process'] = process;
  245. var url = Feng.setUrlParam(Feng.ctxPath + "/enterprise/talentAllowance/exportBasicInfo", queryData);
  246. window.hiddenIframe.location.href = url;
  247. }
  248. /**
  249. * 回调
  250. */
  251. TalentAllowanceInfo.callBack = function (data) {
  252. if (data.code == 200) {
  253. $("#importModal").modal("hide");
  254. Feng.success(data.msg);
  255. } else {
  256. Feng.error(data.msg);
  257. }
  258. }
  259. /**
  260. * 查询表单提交参数对象
  261. * @returns {{}}
  262. */
  263. TalentAllowanceInfo.formParams = function () {
  264. var queryData = {};
  265. queryData['year'] = $("#year").val();
  266. queryData['enterpriseName'] = $("#enterpriseName").val();
  267. queryData['name'] = $("#name").val();
  268. queryData['idCard'] = $("#idCard").val();
  269. queryData['talentType'] = $("#talentType").val();
  270. queryData['talentArrange'] = $("#talentArrange").val();
  271. queryData['address'] = $("#address").val();
  272. queryData['identifyCondition'] = $("#identifyCondition").val();
  273. queryData['isSupple'] = $("#isSupple").val();
  274. queryData['checkState'] = $("#checkState").val();
  275. queryData['isPublicCheck'] = $("#isPublicCheck").val();
  276. queryData['publicState'] = $("#publicState").val();
  277. queryData['allowanceType'] = $("#allowanceType").val();
  278. queryData['recommendAllowanceType'] = $("#recommendAllowanceType").val();
  279. queryData['companyName'] = $("#companyName").val();
  280. queryData['introductionMode'] = $("#introductionMode").val();
  281. queryData['firstJJStartTime'] = $("#firstJJStartTime").val();
  282. queryData['firstJJEndTime'] = $("#firstJJEndTime").val();
  283. return queryData;
  284. }
  285. /**
  286. * 查询人才认定申报列表
  287. */
  288. TalentAllowanceInfo.search = function () {
  289. TalentAllowanceInfo.table.refresh({
  290. query: TalentAllowanceInfo.formParams()
  291. });
  292. };
  293. /**
  294. * 重置
  295. */
  296. TalentAllowanceInfo.reset = function () {
  297. $("#year").val("");
  298. $("#enterpriseName").val("");
  299. $("#name").val("");
  300. $("#idCard").val("");
  301. $("#talentType").val("");
  302. $("#talentArrange").val("");
  303. $("#address").val("");
  304. $("#identifyCondition").val("");
  305. $("#isSupple").val("");
  306. $("#checkState").val("");
  307. $("#isPublicCheck").val("");
  308. $("#publicState").val("");
  309. $("#recommendAllowanceType").val("");
  310. $("#companyName").val("");
  311. $("#introductionMode").val("");
  312. $("#firstJJStartTime").val("");
  313. $("#firstJJEndTime").val("");
  314. }
  315. /**
  316. * 获取人才认定
  317. */
  318. TalentAllowanceInfo.getIdentifyCondition = function () {
  319. var level = $("#talentArrange").val();
  320. if (level == null || level == '') {
  321. $("#identifyCondition").empty();
  322. $("#identifyCondition").trigger('chosen:updated');
  323. return;
  324. }
  325. Feng.addAjaxSelect({
  326. "id": "identifyCondition",
  327. "displayCode": "id",
  328. "displayName": "name",
  329. "type": "GET",
  330. "url": Feng.ctxPath + "/common/api/findIdentifyConditionByLevel?level=" + level
  331. });
  332. $("#identifyCondition").trigger('chosen:updated');
  333. }
  334. $(function () {
  335. var process = $("#process").val();
  336. var defaultColunms = TalentAllowanceInfoSupple.initColumn(process);
  337. var table = new BSTable(TalentAllowanceInfo.id, "/enterprise/talentAllowance/examineList", defaultColunms);
  338. table.setPaginationType("server");
  339. table.setOnDblClickRow(function () {
  340. TalentAllowanceInfo.openCheckTalentAllowanceInfo();
  341. });
  342. table.setSingleSelect(false);
  343. TalentAllowanceInfo.table = table.init();
  344. //批量加载字典表数据
  345. var arr = [{
  346. "name": "address",
  347. "code": "street"
  348. }, {
  349. "name": "talentArrange",
  350. "code": "talent_arrange"
  351. }, {
  352. "name": "nationality",
  353. "code": "nationality"
  354. }, {
  355. "name": "talentType",
  356. "code": "talent_type"
  357. }, {"name": "introductionMode", "code": "un_introduction_mode"}];
  358. Feng.findChildDictBatch(JSON.stringify(arr));
  359. $("#identifyCondition").on('chosen:ready', function (e, params) {
  360. $(".chosen-container-single .chosen-single").css("padding", "4px 0px 0px 4px");
  361. });
  362. $("#identifyCondition").chosen({
  363. search_contains: true,
  364. //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
  365. disable_search: false,
  366. width: "100%",
  367. enable_split_word_search: true
  368. });
  369. $('#checkAll').click(function () {
  370. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('checkAll').bootstrapTable('togglePagination');
  371. })
  372. $('#uncheckAll').click(function () {
  373. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination')
  374. })
  375. $(".time").each(function () {
  376. laydate.render({
  377. elem: "#" + $(this).attr("id")
  378. , type: "date"
  379. , trigger: 'click'
  380. });
  381. });
  382. });