index.js 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * 表格初始化
  3. */
  4. var DataCheck = {
  5. id: "dataCheckTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. DataCheck.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: 'ID', field: 'id', visible: true, align: 'center', valign: 'middle'},
  17. {title: '任务名称', field: 'task_name', visible: true, align: 'center', valign: 'middle'},
  18. {title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
  19. {title: '任务结果', field: 'task_status', visible: true, align: 'center', valign: 'middle',
  20. formatter: function (value, row, index) {
  21. if (value == 0) {
  22. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-danger btn-xs\">处理失败</button>";
  23. }
  24. if (value == 1) {
  25. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-primary btn-xs\">处理成功</button>";
  26. }
  27. if (value == -1) {
  28. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-warning btn-xs\">处理中</button>";
  29. }
  30. }
  31. },
  32. {title: '结果文件', field: 'task_result', visible: true, align: 'center', valign: 'middle',
  33. formatter: function (value, row, index){
  34. if(value != ''){
  35. return "<a href='/storage/" + value+"' style=\"line-height: 1.3\">下载导入结果</a>";
  36. }
  37. }
  38. },
  39. {title: '完成时间', field: 'updateTime', visible: true, align: 'center', valign: 'middle'},
  40. ];
  41. };
  42. //模板下载
  43. DataCheck.download_wuxian_template = function () {
  44. window.location.href = Feng.ctxPath + "/static/downloadFile/data_check_wuxian_template.xlsx";
  45. }
  46. DataCheck.download_yibao_template = function () {
  47. window.location.href = Feng.ctxPath + "/static/downloadFile/data_check_yibao_template.xlsx";
  48. }
  49. DataCheck.import_wuxian = function () {
  50. $("#wuxian-import-form")[0].reset();
  51. $("#wuxianImportModal").modal("show");
  52. }
  53. DataCheck.wuxianImportSubmit = function () {
  54. $("#wuxian-import-form")[0].submit();
  55. }
  56. //回调
  57. DataCheck.callBack = function (data) {
  58. Feng.info(data.msg);
  59. if (data.code == 200) {
  60. $("#wuxianImportModal").modal("hide");
  61. $("#talentImportModal").modal("hide");
  62. DataCheck.table.refresh();
  63. }
  64. }
  65. $(function () {
  66. var defaultColunms = DataCheck.initColumn();
  67. var table = new BSTable(DataCheck.id, "/admin/data_check/list", defaultColunms);
  68. table.setPaginationType("server");
  69. DataCheck.table = table.init();
  70. //下拉框数据动态加载
  71. Feng.addAjaxSelect({
  72. "id": "talentLevel",
  73. "displayCode": "code",
  74. "displayName": "name",
  75. "type": "GET",
  76. "url": "/admin/dict/findChildDictByCode?code=talent_arrange"
  77. });
  78. //批量加载时间控件
  79. $(".date").each(function () {
  80. laydate.render({
  81. elem: this
  82. , type: 'year'
  83. , trigger: 'click'
  84. });
  85. });
  86. });