view_schedule.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <div class="bg-white">
  2. <table class="layui-hide" id="scheduleApi" lay-filter="schedule"></table>
  3. </div>
  4. <script type="text/html" id="toolbarschedule">
  5. <div class="layui-btn-container">
  6. <span class="yellow">如需创建工作日志,请到项目任务的详情页创建</span>
  7. </div>
  8. </script>
  9. <script>
  10. function project_schedule(){
  11. if($('#projectTab').find('li').eq(2).data('load') =='true'){
  12. return false;
  13. }
  14. $('#projectTab').find('li').eq(2).data('load','true');
  15. let form = layui.form,tool = layui.tool,table = layui.tablePlus,work = layui.oaSchedule,oaPicker = layui.oaPicker;
  16. //项目工作记录
  17. layui.scheduleTable = table.render({
  18. elem: '#scheduleApi',
  19. title: '工作记录列表',
  20. toolbar: '#toolbarschedule',
  21. cellMinWidth: 80,
  22. url: "/oa/api/get_schedule", //数据接口
  23. where: { 'project_id': project_id },
  24. cols: [[ //表头
  25. { field: 'id', title: '序号', width: 60, align: 'center' }
  26. , {
  27. field: 'start_time', title: '工作时间范围', align: 'center', width: 180, templet: function (d) {
  28. var html = d.start_time + '至' + d.end_time;
  29. return html;
  30. }
  31. }
  32. , { field: 'labor_time', title: '工时', style: 'color: #91CC75;', align: 'center', width: 60 }
  33. , { field: 'labor_type_string', title: '工作类型', align: 'center', width: 90,templet:function(d){
  34. var html = '<span class="layui-color-'+d.labor_type+'">'+d.labor_type_string+'</span>';
  35. return html;
  36. }}
  37. , { field: 'work_cate', title: '工作类别', align: 'center', width: 100 }
  38. , { field: 'title', title: '工作内容' }
  39. , { field: 'name', title: '执行员工', align: 'center', width: 80 }
  40. , { field: 'department', title: '所在部门', align: 'center', width: 100 }
  41. , { field: 'create_time', title: '记录时间', align: 'center', width: 150 }
  42. , {title: '操作',fixed:'right', align: 'center', width: 100, templet: function (d) {
  43. if(d.admin_id == login_admin){
  44. return '<div class="layui-btn-group"><span class="layui-btn layui-btn-xs" lay-event="edit">修改</span><span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</span></div>';
  45. }
  46. else{
  47. return '<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</span>';
  48. }
  49. }
  50. }
  51. ]]
  52. });
  53. //监听行工具事件
  54. table.on('tool(schedule)', function (obj) {
  55. if (obj.event === 'edit') {
  56. work.add(0, obj.data);
  57. }
  58. if (obj.event === 'view') {
  59. work.view(obj.data);
  60. }
  61. return false;
  62. })
  63. }
  64. </script>