talentAllowanceInfo_select.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. /**
  2. * 初始化人才认定申报详情对话框
  3. */
  4. var TalentAllowanceInfoDlg = {
  5. talentAllowanceData: {},
  6. validateFields: {
  7. talentId: {validators: {notEmpty: {message: '申报对象不能为空'}}}
  8. }
  9. };
  10. //初始化附件类别表单
  11. TalentAllowanceInfoDlg.initFileTable = function () {
  12. TalentAllowanceInfoDlg.initContract();
  13. var queryData = {};
  14. queryData['project'] = CONFIG.project_jbt;
  15. queryData['type'] = $("#type").val();
  16. queryData['allowanceType'] = $("#allowanceType").val();
  17. $("#fileTable").bootstrapTable({
  18. url: Feng.ctxPath + "/common/api/findCommonFileType",
  19. method: 'POST',
  20. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  21. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  22. showRefresh: false, // 是否显示刷新按钮
  23. clickToSelect: true, // 是否启用点击选中行
  24. singleSelect: true, // 设置True 将禁止多选
  25. striped: true, // 是否显示行间隔色
  26. escape: true,
  27. pagination: false, // 设置为 true 会在表格底部显示分页条
  28. paginationHAlign: "left",
  29. paginationDetailHAlign: "right",
  30. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  31. showColumns: false,
  32. detailView: true, //是否显示父子表
  33. pageList: [10, 30, 50],
  34. queryParams: function (params) {
  35. return $.extend(queryData, params)
  36. },
  37. rowStyle: function (row, index) {
  38. return {classes: "info"};
  39. },
  40. columns: TalentAllowanceInfoDlg.initFileTypeColumn(),
  41. onPostBody: function () {
  42. $("td.uitd_showTip").bind("mouseover", function () {
  43. var htm = $(this).html();
  44. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  45. });
  46. },
  47. onLoadSuccess: function (data) {
  48. $("#fileTable").bootstrapTable('expandAllRows');
  49. },
  50. onExpandRow: function (index, row, $detail) {
  51. var ajax = new $ax(Feng.ctxPath + "/common/api/listTalentFile", function (data) {
  52. if (data == null || data.length == 0) {
  53. return;
  54. }
  55. var html = '<ul class="imgs"><li style="width: 80%;font-weight: bold;padding-top: 5px;">附件原名</li><li style="width: 10%;font-weight: bold;padding-top: 5px;">预览</li>';
  56. for (var key in data) {
  57. var sn = data[key].url.lastIndexOf(".");
  58. var suffix = data[key].url.substring(sn + 1, data[key].url.length);
  59. var imgStr = "";
  60. if (suffix == "pdf" || suffix == "PDF") {
  61. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + data[key].url + "','" + data[key].id + "','" + data[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  62. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  63. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + data[key].url + "','" + data[key].id + "','" + data[key].orignName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  64. } else {
  65. imgStr = '<img class=\"imgUrl\" src=\"' + data[key].url + '\" style=\"width:25px;height:25px;\">';
  66. }
  67. html = html + '<li style="display: none">' + data[key].id + '</li>\n' +
  68. '<li style="width: 80%;padding-top: 5px;">' + data[key].orignName + '</li>\n' +
  69. '<li style="width: 10%;">' + imgStr + '</li>\n';
  70. }
  71. html = html + '</ul>';
  72. $detail.html(html);
  73. $(".imgs").viewer({
  74. fullscreen: false
  75. });
  76. }, function (data) {
  77. Feng.error("查询失败!" + data.responseJSON.message + "!");
  78. });
  79. var queryData = {};
  80. queryData["mainId"] = $("#id").val();
  81. queryData["fileTypeId"] = row.id;
  82. ajax.set(queryData);
  83. ajax.start();
  84. }
  85. });
  86. TalentAllowanceInfoDlg.initCommonFileTable();
  87. }
  88. //初始化通用附件
  89. TalentAllowanceInfoDlg.initCommonFileTable = function () {
  90. var queryData = {};
  91. queryData.id = $("#id").val();
  92. $("#commonFileTable").bootstrapTable({
  93. url: Feng.ctxPath + "/common/api/listTalentAllowanceCommonFile",
  94. method: 'POST',
  95. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  96. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  97. showRefresh: false, // 是否显示刷新按钮
  98. clickToSelect: true, // 是否启用点击选中行
  99. singleSelect: true, // 设置True 将禁止多选
  100. striped: true, // 是否显示行间隔色
  101. pagination: false, // 设置为 true 会在表格底部显示分页条
  102. paginationHAlign: "left",
  103. paginationDetailHAlign: "right",
  104. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  105. showColumns: false,
  106. queryParams: function (params) {
  107. return $.extend(queryData, params)
  108. },
  109. rowStyle: function (row, index) {
  110. return {css: {"word-break": "break-word", "white-space": "inherit"}}
  111. },
  112. columns: [
  113. {title: '附件原名', field: 'originalName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: '70%', formatter: function (value, row, index) {
  114. return value;
  115. }},
  116. {title: '预览', field: 'url', visible: true, align: 'center', valign: 'middle', width: "20%",
  117. formatter: function (value, row, index) {
  118. var sn = value.lastIndexOf(".");
  119. var suffix = value.substring(sn + 1, value.length);
  120. var imgStr = "";
  121. if (suffix == "pdf" || suffix == "PDF") {
  122. imgStr = "<button type='button' onclick=\"Feng.showPdf('" + value + "','" + row.id + "','" + row.originalName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-pdf-o\" aria-hidden=\"true\"></i></button>";
  123. } else if (suffix == "xlsx" || suffix == "XLSX" || suffix == 'xls' || suffix == 'XLS') {
  124. imgStr = "<button type='button' onclick=\"Feng.showExcel('" + value + "','" + row.id + "','" + row.originalName + "')\" class=\"btn btn-xs btn-danger\"><i class=\"fa fa-file-excel-o\" aria-hidden=\"true\"></i></button>";
  125. } else {
  126. imgStr = '<img class=\"cImgUrl\" src=\"' + value + '\" style=\"width:25px;height:25px;\">';
  127. }
  128. return imgStr;
  129. }
  130. },
  131. {title: '操作', field: 'url', visible: true, align: 'center', valign: 'middle', width: '10%',
  132. formatter: function (value, row, index) {
  133. return "";
  134. }
  135. }
  136. ],
  137. onPostBody: function () {
  138. $("td.uitd_showTip").bind("mouseover", function () {
  139. var htm = $(this).html();
  140. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  141. });
  142. $(".cImgUrl").viewer({fullscreen: false});
  143. }
  144. });
  145. }
  146. /**
  147. * 初始化工作单位及核查项目情况表
  148. */
  149. TalentAllowanceInfoDlg.initContract = function () {
  150. $("#projectTable").bootstrapTable("destroy", {});
  151. $("#projectTable").bootstrapTable({
  152. url: Feng.ctxPath + "/enterprise/talentAllowance/findAllowanceContractDetail",
  153. method: 'POST',
  154. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  155. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  156. showRefresh: false, // 是否显示刷新按钮
  157. clickToSelect: true, // 是否启用点击选中行
  158. singleSelect: true, // 设置True 将禁止多选
  159. striped: true, // 是否显示行间隔色
  160. escape: true,
  161. pagination: false, // 设置为 true 会在表格底部显示分页条
  162. paginationHAlign: "left",
  163. paginationDetailHAlign: "right",
  164. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  165. showColumns: false,
  166. detailView: true, //父子表
  167. queryParams: function (params) {
  168. return $.extend({"mainId": $("#id").val()}, params)
  169. },
  170. columns: TalentAllowanceInfoDlg.initContractColumns(),
  171. onPostBody: function () {
  172. $("td.uitd_showTip").bind("mouseover", function () {
  173. var htm = $(this).html();
  174. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  175. });
  176. },
  177. onLoadSuccess: function (data) {
  178. $("#projectTable").bootstrapTable('expandAllRows');
  179. },
  180. onExpandRow: function (index, row, $detail) {
  181. var enterpriseId = row.enterpriseId;
  182. var cur_table = $detail.html('<table id="' + enterpriseId + '" class="mytable-hover"></table>').find('table');
  183. $(cur_table).bootstrapTable("destroy", {});
  184. $(cur_table).bootstrapTable({
  185. url: Feng.ctxPath + "/enterprise/talentAllowance/findAllowanceProject",
  186. method: 'POST',
  187. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  188. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  189. showRefresh: false, // 是否显示刷新按钮
  190. clickToSelect: true, // 是否启用点击选中行
  191. singleSelect: true, // 设置True 将禁止多选
  192. escape: true,
  193. pagination: false, // 设置为 true 会在表格底部显示分页条
  194. paginationHAlign: "left",
  195. paginationDetailHAlign: "right",
  196. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  197. showColumns: false,
  198. queryParams: function (params) {
  199. return $.extend({"mainId": $("#id").val(), "baseId": row.id}, params)
  200. },
  201. columns: TalentAllowanceInfoDlg.initProjectColumns(),
  202. });
  203. }
  204. });
  205. }
  206. //初始化工作单位表的列
  207. TalentAllowanceInfoDlg.initContractColumns = function () {
  208. var type = $("#type").val();
  209. if (type == 1) {
  210. return [
  211. {field: 'selectItem', checkbox: false, visible: false},
  212. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  213. {title: '合同起始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  214. {title: '合同截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  215. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  216. {title: '本年度工作截止时间', field: 'quitTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  217. {title: '人才标签', field: 'talentTypeName', visible: true, align: 'center', valign: 'middle', width: "100px", 'class': 'uitd_showTip'},
  218. {title: '首次来晋行政介绍信时间', field: 'letterTime', visible: true, align: 'center', valign: 'middle', width: "120px"},
  219. /*{title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "120px",
  220. formatter: function (value, row, index) {
  221. return "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-right: 10px' class='btn btn-xs btn-success'>" +
  222. "<i class=\"fa fa-book\"></i>日志" +
  223. "</button>";
  224. }
  225. }*/
  226. ];
  227. } else {
  228. return [
  229. {field: 'selectItem', checkbox: false, visible: false},
  230. {title: '企业名称', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  231. {title: '合同起始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle', width: "120px"},
  232. {title: '合同截止时间', field: 'endTime', visible: true, align: 'center', valign: 'middle', width: "120px", 'class': 'uitd_showTip'},
  233. {title: '入职时间', field: 'entryTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  234. {title: '本年度工作截止时间', field: 'quitTime', visible: true, align: 'center', valign: 'middle', width: "100px"},
  235. /*{title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "120px",
  236. formatter: function (value, row, index) {
  237. return "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-right: 10px' class='btn btn-xs btn-success'>" +
  238. "<i class=\"fa fa-book\"></i>日志" +
  239. "</button>"
  240. }
  241. }*/
  242. ];
  243. }
  244. }
  245. //初始化项目表的列
  246. TalentAllowanceInfoDlg.initProjectColumns = function () {
  247. return [
  248. {field: 'selectItem', checkbox: false, visible: false},
  249. {title: '核查项目名称', field: 'projectName', visible: true, align: 'center', valign: 'middle', width: "15%", 'class': 'uitd_showTip'},
  250. {title: '详情', field: 'months', visible: true, align: 'center', valign: 'middle', width: "45%", 'class': 'uitd_showTip',
  251. formatter: function (value, row, index) {
  252. var allowanceType = $("#allowanceType").val();
  253. var tmp = [];
  254. if (row.project == 4 && allowanceType == 2) {
  255. var dayArr = value ? value.split(",") : [];
  256. var totalDays = 0;
  257. for (var d = 0; d < dayArr.length; d++) {
  258. var kv = dayArr[d].split("=");
  259. if (kv[0] && kv[1]) {
  260. totalDays += parseInt(kv[1]);
  261. tmp.push(kv[0] + "月(" + kv[1] + "天)");
  262. }
  263. }
  264. tmp.push("共计" + totalDays + "天");
  265. } else {
  266. var monthArr = value ? value.split(",") : [];
  267. for (var d = 0; d < monthArr.length; d++) {
  268. if (monthArr[d]) {
  269. tmp.push(monthArr[d] + "月");
  270. }
  271. }
  272. }
  273. return tmp.join(",");
  274. }
  275. },
  276. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "25%", 'class': 'uitd_showTip'},
  277. {title: '操作', field: 'project', visible: true, align: 'center', valign: 'middle', width: "15%",
  278. formatter: function (value, row, index) {
  279. return "<button type='button' onclick='TalentAllowanceInfoDlg.showLog(\"" + row.id + "\")' style='margin-right: 10px' class='btn btn-xs btn-success'><i class=\"fa fa-book\"></i>日志</button>";
  280. }
  281. }
  282. ];
  283. }
  284. /**
  285. * 初始化附件类别表的列
  286. */
  287. TalentAllowanceInfoDlg.initFileTypeColumn = function () {
  288. return [
  289. {field: 'selectItem', checkbox: false, visible: false},
  290. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', width: "30%", 'class': 'uitd_showTip',
  291. formatter: function (value, row, index) {
  292. if (row.must == 1) {
  293. return '<i class="fa fa-paste"></i><span style="font-weight:bold;color:red;font-size:14px;font-family:宋体"> * </span> ' + value;
  294. }
  295. if (row.must == 2) {
  296. return '<i class="fa fa-paste"></i>' + value;
  297. }
  298. }
  299. },
  300. {title: '模板', field: 'templateUrl', visible: true, align: 'center', valign: 'middle', width: "8%",
  301. formatter: function (value, row, index) {
  302. if (value == null || value == '' || value == 'null') {
  303. return '无';
  304. }
  305. return "<button type='button' onclick=\"Feng.downloadFile('" + row.id + "',3)\" style='margin-right: 10px' class=\"btn btn-xs btn-primary\">" +
  306. "<i class=\"fa fa-download\"></i>下载" +
  307. "</button>";
  308. }
  309. },
  310. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle', width: "52%", 'class': 'uitd_showTip'},
  311. ]
  312. };
  313. TalentAllowanceInfoDlg.showLog = function (id) {
  314. layer.open({
  315. type: 1,
  316. title: "日志",
  317. fixed: false,
  318. content: '<table id="' + id + '"></table>',
  319. area: ['80%', '80%'],
  320. maxmin: true,
  321. success: function (layero, index) {
  322. $('#' + id).bootstrapTable({
  323. url: Feng.ctxPath + "/common/api/getJbtCheckLog",
  324. method: 'POST',
  325. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  326. search: false, // 是否显示表格搜索,此搜索是客户端搜索,不会进服务端
  327. showRefresh: false, // 是否显示刷新按钮
  328. clickToSelect: true, // 是否启用点击选中行
  329. singleSelect: true, // 设置True 将禁止多选
  330. striped: true, // 是否显示行间隔色
  331. pagination: false, // 设置为 true 会在表格底部显示分页条
  332. paginationHAlign: "left",
  333. paginationDetailHAlign: "right",
  334. sidePagination: "server", // 设置在哪里进行分页,可选值为 'client' 或者 'server'
  335. showColumns: false,
  336. queryParams: function (params) {
  337. return {"type": CONFIG.project_jbt, "mainId": $("#id").val(), "typeFileId": id, "active": 1}
  338. },
  339. columns:
  340. [
  341. {title: '步骤', field: 'stepName', visible: true, align: 'center', valign: 'middle', width: "10%",
  342. formatter: function (value, row, index) {
  343. return "" + value;
  344. }
  345. },
  346. {title: '操作人', field: 'createUser', visible: true, align: 'center', valign: 'middle', width: "15%"},
  347. {title: '操作时间', field: 'createTime', visible: true, align: 'center', valign: 'middle', width: "20%"},
  348. {title: '描述', field: 'description', visible: true, align: 'center', valign: 'middle', width: "45%",
  349. formatter: function (value, row, index) {
  350. return '<span data-toggle="tooltip" title="' + value + '">"' + value + '"</span>';
  351. }
  352. }
  353. ]
  354. ,
  355. onPostBody: function () {
  356. $('#' + id + "td.uitd_showTip").bind("mouseover", function () {
  357. var htm = $(this).html();
  358. $(this).webuiPopover({title: '详情', content: htm, trigger: 'hover'}).webuiPopover('show');
  359. });
  360. }
  361. });
  362. }
  363. });
  364. }
  365. //回调
  366. TalentAllowanceInfoDlg.callBack = function (data) {
  367. layer.close(data.obj);
  368. Feng.info(data.msg);
  369. if (data.code == 200) {
  370. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/updateSuppleState", function (data) {
  371. if (data.code == 200) {
  372. } else {
  373. }
  374. }, function (data) {
  375. Feng.error("修改失败!" + data.responseJSON.message + "!");
  376. });
  377. ajax.set("id", $("#id").val());
  378. ajax.start();
  379. $("#fileTable").bootstrapTable("refresh", {});
  380. }
  381. }
  382. TalentAllowanceInfoDlg.showAllLog = function () {
  383. var id = $("#id").val();
  384. if (Feng.isNotEmptyStr(id)) {
  385. Feng.getCheckLog("logTable", {"type": CONFIG.project_jbt, "mainId": id, "typeFileId": "", "active": 1})
  386. }
  387. }
  388. TalentAllowanceInfoDlg.calculator = function () {
  389. var id = $("#id").val();
  390. if (!id) {
  391. Feng.error("请先保存再进行计算");
  392. return;
  393. }
  394. var ajax = new $ax(Feng.ctxPath + "/enterprise/talentAllowance/calculator/id/" + id, function (data) {
  395. var message = data.recommendAllowanceMsg.join("<br>");
  396. if (data.recommendAllowanceType != 3) {
  397. message += "<br>试算补贴金额:<span style='color:red;font-weight:bold;'>" + data.recommendMoney + "</span>";
  398. }
  399. Feng.confirm(message, function () {});
  400. }, function (data) {
  401. Feng.error("查询失败!" + data.responseJSON.message + "!");
  402. });
  403. ajax.start();
  404. }
  405. $(function () {
  406. Feng.initValidatorTip("talentAllowanceForm", TalentAllowanceInfoDlg.validateFields);
  407. Feng.addAjaxSelect({
  408. "id": 'name',
  409. "displayCode": "id",
  410. "displayName": "name",
  411. "type": "GET",
  412. "url": Feng.ctxPath + "/enterprise/talent/findTalentByEnterpriseInLibrary?type=1&year=" + $("#year").val()
  413. });
  414. if ($("#type").val() == 2) {
  415. $("#bankNumberSpan,#talentTypeSpan,#introductionModeSpan,#firstInJJTimeSpan").attr("style", "display:none");
  416. }
  417. if ($("#allowanceType").val() == 1) {
  418. //$("#wageDiv").css("display", "block");
  419. }
  420. //批量加载时间控件
  421. $(".date").each(function () {
  422. laydate.render({elem: "#" + $(this).attr("id"), type: 'date', trigger: 'click'});
  423. });
  424. $("select").each(function () {
  425. $(this).val($(this).attr("value"));
  426. });
  427. TalentAllowanceInfoDlg.showAllLog();
  428. });