Authored by 袁晋鹏

山西机房管理功能迁移

@@ -143,7 +143,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'commonDetail','sessi @@ -143,7 +143,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'commonDetail','sessi
143 // 初始化下拉框 143 // 初始化下拉框
144 function loadSelect() { 144 function loadSelect() {
145 admin.req({ 145 admin.req({
146 - url: domainName + '/api-web/machineRoom/getMachineRoomInfo' 146 + url: domainName + '/api-room/machineRoom/getMachineRoomInfo'
147 }).done(function (response) { 147 }).done(function (response) {
148 var options = "<option value=''>=归属机房=</option>"; 148 var options = "<option value=''>=归属机房=</option>";
149 $.each(response.data, function (i, v) { 149 $.each(response.data, function (i, v) {
  1 +//工作汇报表单
  2 +layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'xmSelect', 'laydate', 'upload'], function (exports) {
  3 + var $ = layui.$;
  4 + var form = layui.form;
  5 + var layer = layui.layer;
  6 + var admin = layui.admin;
  7 + var table = layui.table;
  8 + var common = layui.common;
  9 + var session = layui.sessions;
  10 + var laydate = layui.laydate;
  11 + var upload = layui.upload;
  12 + var domainName = common.domainName;
  13 + var xmSelect = layui.xmSelect;
  14 +
  15 + //对外暴露的接口
  16 + exports('workReportAdd', function (data) {
  17 + var accessToken = session.getToken()['access_token']
  18 + var userSelect = {}
  19 + var currentDate = {}
  20 + var uploadInst = {}
  21 + var defaultUser = []
  22 + var attachmentIds = []
  23 + var id = data.id
  24 + var cols = []
  25 + var where = {}
  26 + var url = ''
  27 + var historywarningTable = {}
  28 +
  29 + var viewType = data && data.viewType ? data.viewType : '';
  30 +
  31 + init()
  32 + $('#workReport_type').val(data.repType)
  33 +
  34 + //渲染表单
  35 + form.render(null, 'add-workReport-form')
  36 +
  37 + form.on('select(workReport_type)', function (dom) {
  38 + initFromType(dom.value)
  39 + })
  40 +
  41 + //保存
  42 + form.on('submit(workReport-form-save-id)', function (res) {
  43 + var value = $('#attachmentInput').val()
  44 + if (value != '') {
  45 + $('#upload_btn').click()
  46 + } else {
  47 + saveForm()
  48 + }
  49 + })
  50 +
  51 + //表单验证
  52 + form.verify({
  53 + checkReportIsExist: function(value, item){ //value:表单的值、item:表单的DOM对象
  54 + var repType = $('#add-workReport-form').find("select[name='repType']").val()
  55 + var count = 0
  56 + var createTime = $('#add-workReport-form').find("input[name='createTime']").val()
  57 + var date = new Date()
  58 + var month = date.getMonth() > 9 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)
  59 + var currentDate = date.getFullYear() + '-' + month + '-' + date.getDate()
  60 + var createDate = createTime.split(' ')[0]
  61 + if (repType == 'day' && createDate == currentDate) {
  62 + if (new Date(createTime) < new Date(currentDate + ' ' + '16:30:00')) {
  63 + return "请于北京时间下午16:30分后添加当天日报!"
  64 + }
  65 + }
  66 + admin.req({
  67 + url: domainName + '/api-web/workreport/checkIsExist?repType=' + repType + '&createTime=' + createDate,
  68 + async: false,
  69 + success: function (res) {
  70 + if (res.success) {
  71 + count = res.count
  72 + }
  73 + }
  74 + })
  75 + if (count !=0 && id == undefined && repType == 'day') {
  76 + return "日报不能重复添加!"
  77 + }
  78 + }
  79 + });
  80 +
  81 + //保存
  82 + function saveForm() {
  83 + layer.load(2)
  84 + var data = form.val('add-workReport-form')
  85 + var params = {}
  86 +
  87 + params.user = data.select
  88 + params.attachmentIds = attachmentIds.toString()
  89 + delete data['file']
  90 + delete data['select']
  91 + params.workReport = JSON.stringify(data)
  92 + admin.req({
  93 + url: domainName + '/api-web/workreport/save?access_token=' + accessToken,
  94 + data: JSON.stringify(params),
  95 + type: 'post',
  96 + contentType: "application/json; charset=utf-8",
  97 + done: function (res) {
  98 + if (res.success) {
  99 + layer.msg(res.msg, {
  100 + offset: '15px',
  101 + icon: 1,
  102 + time: 1000,
  103 + }, function () {
  104 + layer.closeAll()
  105 + table.reload('workReportTable', {
  106 + where: {
  107 + access_token: accessToken,
  108 + repTitle: '',
  109 + isRead: '',
  110 + repType: '',
  111 + createTime: ''
  112 + },
  113 + });
  114 + })
  115 + } else {
  116 + layer.msg(res.msg, {
  117 + offset: '15px',
  118 + icon: 7,
  119 + time: 1000,
  120 + })
  121 + }
  122 + }
  123 + })
  124 + return false
  125 + }
  126 +
  127 + //页面初始化
  128 + function init() {
  129 + initFromType(data.repType)
  130 + initUserSelect()
  131 + initDatePlus()
  132 + initUploadPlus()
  133 + if (viewType == 'view') {
  134 + initViewMode();
  135 + }
  136 + }
  137 +
  138 + cols = [
  139 + {type: 'numbers',title:'序号'}
  140 + , {
  141 + field: 'alarmLevel', title: '级别', align: 'center', width: 120,
  142 + templet: function (d) {
  143 + if (d.alarmLevel == 3) {
  144 + return '<span class="layui-table-warn" style="width: 100%;">严重</span>';
  145 + } else if (d.alarmLevel == 2) {
  146 + return '<span class="layui-table-close" style="width: 100%;">重要</span>';
  147 + } else if (d.alarmLevel == 1) {
  148 + return '<span class="layui-table-normal" style="width: 100%;">一般告警</span>';
  149 + }
  150 + }
  151 + }
  152 + , {
  153 + field: 'resName', title: '资源名称', align: 'center', width: 230,
  154 + templet: '<div><span data-warn-zymc="{{d.id}}" data-resid="{{d.resId}}" data-restype="{{d.resType}}" data-ip="{{d.ip}}" data-resname="{{d.resName}}">{{d.resName}}</span></div>'
  155 + }
  156 + , {
  157 + field: 'kpiName', title: '指标名称', align: 'center', width: 150,
  158 + templet: function (d) {
  159 + var kpiName = d.kpiName == 'TYPE' ? 'ERRPT' : d.kpiName;
  160 + if (d.kpiIdent != 1 && d.isWarning != 1) {
  161 + return '<div>' + kpiName + '</div>';
  162 + }
  163 + return '<div><span data-ident="' + d.kpiIdent + '" data-trend="' + d.isTrend + '" data-warning="' + d.isWarning + '" data-warn-zbmc="' + d.id + '" class="layui-table-link" data-resid="' + d.resId + '" data-flag="' + d.flag + '" data-kpi="' + d.kpiId + '" data-name="' + kpiName + '" >' + kpiName + '</span></div>';
  164 + }
  165 + }
  166 + , {field: 'alarmContent', title: '告警内容', align: 'center', width: 500}
  167 + , {
  168 + field: 'alarmResource', title: '告警来源', align: 'center', minWidth: 100, templet: function (d) {
  169 + if (d.alarmResource == 1) {
  170 + return '<div>华为告警</div>';
  171 + } else {
  172 + return '<div>监控系统</div>';
  173 + }
  174 + }
  175 + }
  176 + , {field: 'updateTime', title: '告警时间', align: 'center', minWidth: 180}
  177 + , {field: 'alarmTime', title: '首次告警时间', align: 'center', minWidth: 180}
  178 + ]
  179 +
  180 + where = {
  181 + access_token: accessToken,
  182 + dateTime: $('#add-workReport-form').find("input[name='createTime']").val()
  183 + }
  184 +
  185 + url = domainName + '/api-web/home/alarm/getAlarm'
  186 +
  187 + getAlarmInfo(where,cols,url)
  188 +
  189 + //表单赋值
  190 + function fromAssignment() {
  191 + if (data && data.id) {
  192 + $('#add-workReport-form-atta').show()
  193 + //编辑表单时禁用日志类型修改和时间选择
  194 + $('#add-workReport-form').find("select[name='repType']").attr("disabled", "disabled")
  195 + $('#add-workReport-form').find("input[name='createTime']").attr("disabled", "disabled")
  196 + //编辑表单时取消显示默认值
  197 + currentDate.config.isInitValue = false
  198 + initDatePlus()
  199 + //切换相应的类型表单
  200 + initFromType(data.repType)
  201 + var time = ''
  202 + admin.req({
  203 + url: domainName + `/api-web/workreport/getById/${data.id}`,
  204 + async: false,
  205 + done: function (res) {
  206 + form.val('add-workReport-form', res.object)
  207 + time = res.object.createTime
  208 + var userArr = []
  209 + $.each(res.object.reportUserList, function (i, v) {
  210 + userArr.push(v.userName)
  211 + })
  212 + userSelect.setValue(userArr)
  213 + if (res.object.attachmentList.length != 0) {
  214 + $.each(res.object.attachmentList,function (i,v) {
  215 + writeTagsInfo(v.id,v.originalName)
  216 + })
  217 + }
  218 + }
  219 + })
  220 + cols.push({field: 'alarmStatus', title: '告警状态', align: 'center', minWidth: 100,
  221 + templet: function (d) {
  222 + var str = ''
  223 + if (d.alarmStatus == '0') {
  224 + str = '告警'
  225 + } else if (d.alarmStatus == '1') {
  226 + str = '关闭'
  227 + }
  228 + return `<div><span>${str}</span></div>`
  229 + }
  230 + }
  231 + , {field: 'clearType', title: '消除类型', align: 'center', minWidth: 100,
  232 + templet:function (d) {
  233 + var str = ''
  234 + if (d.clearType == '0'){
  235 + str = '自动消除'
  236 + } else if(d.clearType == '1') {
  237 + str = '手动消除'
  238 + }
  239 + return `<div><span>${str}</span></div>`
  240 + }}
  241 + , {field: 'clearUserId', title: '消除人', align: 'center', minWidth: 100,}
  242 + , {field: 'clearTime', title: '消除时间', align: 'center', minWidth: 180,}
  243 + , {field: 'clearReason', title: '消除原因', align: 'center', minWidth: 250})
  244 + where = {access_token: accessToken,reportId:data.id,time:time}
  245 + url = domainName + '/api-web/workreport/getAlarmListByReportId'
  246 + getAlarmInfo(where,cols,url)
  247 + }
  248 + }
  249 +
  250 + //获取当前用户的告警信息
  251 + function getAlarmInfo(where,cols,url) {
  252 + if (data && data.repType != 'day') {
  253 + return false
  254 + }
  255 + historywarningTable = table.render({
  256 + elem: '#table-report-alarm'
  257 + , url: url
  258 + , where: where
  259 + , parseData: function (res) {
  260 + if (data && !data.id) {
  261 + var str = `共有${res.map.totalCount}条告警,手动处理${res.map.manualCount}条,自动处理${res.map.autoCount}条,` +
  262 + `未处理${res.map.alarmCount}条`;
  263 + $('#add-workReport-form').find("input[name='alarmStatic']").val(str);
  264 + }
  265 + }
  266 + , height: 'auto'
  267 + , cellMinWidth: 80
  268 + , text: {
  269 + none: '无告警'
  270 + }
  271 + , page: {
  272 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  273 + , theme: '#1E9FFF'
  274 + }
  275 + ,limit: common.limit
  276 + ,limits: common.limits
  277 + , even: true
  278 + , cols: [cols]
  279 + ,done: function (res, curr, count) {
  280 +
  281 + }
  282 + })
  283 + }
  284 +
  285 + //初始化日期插件
  286 + function initDatePlus() {
  287 + currentDate = laydate.render({
  288 + elem: '#createTime', //指定元素
  289 + value: new Date(),
  290 + type: 'datetime',
  291 + isInitValue: true,
  292 + max:0,
  293 + change: function(value) {
  294 + if (data && data.repType != 'day') {
  295 + return false
  296 + }
  297 + historywarningTable.reload({
  298 + where: {
  299 + access_token: accessToken,
  300 + dateTime: value
  301 + },
  302 + })
  303 + }
  304 + });
  305 + }
  306 +
  307 + //初始化上传插件
  308 + function initUploadPlus() {
  309 + var param = {"access_token": accessToken}
  310 + var fileName = []
  311 + uploadInst = upload.render({
  312 + elem: '#attachment', //绑定元素
  313 + url: common.domainName + '/api-web/workreport/upload',
  314 + data: param,
  315 + multiple: true,
  316 + auto: false, //选择文件后不自动上传
  317 + bindAction: '#upload_btn',//指定按钮触发上传
  318 + accept: 'file',
  319 + exts: 'xls|doc|pdf|docx|xlsx|jpg|png',
  320 + choose: function (obj) {
  321 + //选择文件后回调
  322 + var files = this.files = obj.pushFile();
  323 + obj.preview(function (index, file, result) {
  324 + fileName.push(file.name)
  325 + $('#attachmentInput').val(fileName.toString())
  326 + })
  327 + },
  328 + done: function (res) {
  329 + //单次上传成功
  330 + attachmentIds.push(res.str)
  331 + },
  332 + allDone: function (obj) {
  333 + //全部上传成功后
  334 + saveForm()
  335 + },
  336 + error: function (index, upload) {
  337 + // 上传失败
  338 + layer.msg('文件上传时发生故障,请稍后再试!', {
  339 + icon: 7, time: 3000
  340 + });
  341 + }
  342 + });
  343 + }
  344 +
  345 + //初始化用户下拉列表框
  346 + function initUserSelect() {
  347 + $.ajax({
  348 + url: domainName + '/api-user/users/getAll?access_token=' + accessToken,
  349 + success: function (res) {
  350 + userSelect = xmSelect.render({
  351 + el: '.reportUser',
  352 + disabled: viewType == 'view' ? true : false,
  353 + template({ item, sels, name, value }){
  354 + return item.nickname + '(' + value + ')'
  355 + },
  356 + prop: {
  357 + name: 'nickname',
  358 + value: 'username'
  359 + },
  360 + filterable: true,
  361 + layVerify: 'required',
  362 + layVerType: 'msg',
  363 + data: res,
  364 + })
  365 + initGroupUserDefault()
  366 + //赋值
  367 + fromAssignment()
  368 + }
  369 + })
  370 + }
  371 +
  372 + //初始化组负责人对应的组员
  373 + function initGroupUserDefault() {
  374 + $.ajax({
  375 + url: domainName + '/api-web/workreport/getUserByAdmin?theirType=1&access_token=' + accessToken,
  376 + success: function (res) {
  377 + if (!res.str) {
  378 + return;
  379 + }
  380 + defaultUser = res.str.split(",");
  381 + //默认接收人
  382 + if (!data.id && defaultUser.length != 0) {
  383 + userSelect.setValue(defaultUser)
  384 + }
  385 + }
  386 + })
  387 + }
  388 +
  389 + //根据传入类型动态渲染表单
  390 + function initFromType(repType) {
  391 + switch (repType) {
  392 + case 'day':
  393 + $('.work_finish').text('今日完成工作')
  394 + $('.work_conclusion').text('未完成工作')
  395 + $('.work_help').text('需要协调工作')
  396 + $('.plan').hide()
  397 + $('.reportAlarm').show()
  398 + $('.report_alarmStatic').show()
  399 + getAlarmInfo(where,cols,url)
  400 + break
  401 + case 'week':
  402 + $('.work_finish').text('本周完成工作')
  403 + $('.work_conclusion').text('本周工作总结')
  404 + $('.plan').show()
  405 + $('.work_plan').text('下周工作计划')
  406 + $('.work_help').text('需要协调与帮助')
  407 + $('.reportAlarm').hide()
  408 + $('.report_alarmStatic').hide()
  409 + break
  410 + case 'month':
  411 + $('.work_finish').text('本月完成工作')
  412 + $('.work_conclusion').text('本月工作总结')
  413 + $('.plan').show()
  414 + $('.work_plan').text('下月工作计划')
  415 + $('.work_help').text('需要协调与帮助')
  416 + $('.reportAlarm').hide()
  417 + $('.report_alarmStatic').hide()
  418 + break
  419 + }
  420 + }
  421 +
  422 + // 初始化查看模式
  423 + function initViewMode() {
  424 + $('form[lay-filter="add-workReport-form"]').find('input, textarea').attr('readonly', true);
  425 + $('form[lay-filter="add-workReport-form"]').find('select').attr('disabled', true);
  426 + $.each(xmSelect.get(), function (i, v) {
  427 + v.update({disabled: true});
  428 + });
  429 + $('#attachmentInput').parent().parent().parent().addClass('hide');
  430 + $('#table-report-add-attachment').removeClass('hide');
  431 + $('#form-item-repTitle').removeClass('hide');
  432 + //渲染附件表格
  433 + var attachmentTable = table.render({
  434 + elem: '#table-report-add-attachment',
  435 + url: domainName + '/api-web/workreport/getAttaById',
  436 + where: {
  437 + access_token: accessToken,
  438 + id: data.id
  439 + },
  440 + height: 'full',
  441 + page: {
  442 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  443 + , theme: '#1E9FFF'//自定义分页主题颜色
  444 + },
  445 + end: function (e) {
  446 + form.render()
  447 + },
  448 + limit: common.limit,
  449 + limits: common.limits,
  450 + even: true,
  451 + cols: [[
  452 + {type: 'numbers', title: '序号'},
  453 + {
  454 + field: 'name', title: '文件名称', align: 'center', minWith: 200,
  455 + },
  456 + {
  457 + field: 'suffix', title: '文件后缀', align: 'center', minWith: 150,
  458 + },
  459 + {
  460 + field: 'size', title: '文件大小', align: 'center', minWith: 150,
  461 + templet: function (d) {
  462 + var str = (d.size / 1000).toFixed(2)
  463 + return `<div><span>${str}KB</span></div>`
  464 + }
  465 + },
  466 + {
  467 + title: '操作', align: "center", width: 120,
  468 + templet: '<div><span data-id="{{d.id}}" data-suffix="{{d.suffix}}" class="layui-table-link preview-attachment-btn">预览</span></div>'
  469 + }
  470 + ]],
  471 + done: function () {
  472 + $('.preview-attachment-btn').on('click', function () {
  473 + var id = $(this).data('id')
  474 + var suffix = $(this).data('suffix')
  475 + if (suffix == 'jpg' || suffix == 'png' || suffix == 'JPG' || suffix == 'PNG') { //图片类型
  476 + var srcUrl = domainName + `/api-web/openoffice/readImage/${id}?access_token=` + accessToken
  477 + layer.open({
  478 + type: 1,
  479 + content: `<div><img src="${srcUrl}" width="100%" height="100%" /></div>`,
  480 + title: '图片预览',
  481 + area: ['60%', '90%']
  482 + })
  483 + } else {
  484 + //附件为文档类型
  485 + common.openReport(id)
  486 + }
  487 + })
  488 + }
  489 + })
  490 + form.render();
  491 + }
  492 +
  493 + //写入标签内容
  494 + function writeTagsInfo(id,name) {
  495 + var tags = '<span id="tags_span_'+id+'" data-id="'+id+'"><em>'+name+'</em>' +
  496 + '<button type="button" value="'+id+'" class="tagsclose close">×</button></span>';
  497 + if($("#tags_span_"+id).length == 0){
  498 + //拼接标签
  499 + $("#selecte_content_id").append(tags);
  500 + //绑定标签的删除事件
  501 + bindTagesDelEvent();
  502 + }
  503 + }
  504 +
  505 + //删除标签事件
  506 + function bindTagesDelEvent() {
  507 + //删除已选主体的页签
  508 + $("button.tagsclose").on("click",function () {
  509 + var attachId = $(this).attr("value");
  510 + //确认提示框
  511 + layer.confirm('附件删除后将无法恢复,您确定要删除吗?', {
  512 + btn: ['确定', '取消'] //按钮
  513 + }, function () {
  514 + $.ajax({
  515 + url: domainName + `/api-web/workreport/deleteAttachment/${id}/${attachId}?access_token=` + accessToken,
  516 + type: "get",
  517 + }).done(function (res) {
  518 + layer.msg('删除成功', {
  519 + offset: '15px'
  520 + , icon: 1
  521 + , time: 1000
  522 + }, function () {
  523 + $("#tags_span_"+attachId).remove();
  524 + });
  525 + }).error(function (error) {
  526 + console.log(error);
  527 + });
  528 + });
  529 + });
  530 + }
  531 + })
  532 +})
  1 +//工作汇报
  2 +layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function (exports) {
  3 + var $ = layui.$;
  4 + var form = layui.form;
  5 + var layer = layui.layer;
  6 + var admin = layui.admin;
  7 + var table = layui.table;
  8 + var common = layui.common;
  9 + var session = layui.sessions
  10 + var domainName = common.domainName;
  11 +
  12 + //对外暴露的接口
  13 + exports("workReportIndex", function () {
  14 + var accessToken = session.getToken()['access_token']
  15 + var createTime = ''
  16 + var isRead = ''
  17 + var repType = ''
  18 +
  19 +
  20 + //回车搜索
  21 + $('#workReport_title').keydown(function (e) {
  22 + if (e.keyCode === 13) {
  23 + reloadWorkReportTable()
  24 + }
  25 + })
  26 +
  27 + //绑定是否阅读
  28 + form.on('radio(workReport_isRead)', function () {
  29 + isRead = $('input[name="isRead"]:checked').val()
  30 + reloadWorkReportTable()
  31 + })
  32 +
  33 + //绑定类型
  34 + form.on('radio(workReport_type)', function () {
  35 + repType = $('input[name="repType"]:checked').val()
  36 + reloadWorkReportTable()
  37 + })
  38 +
  39 + //时间周期切换事件
  40 + $("#createTimeBtn button").on("click", function () {
  41 + $("#createTimeBtn button").removeClass("active");
  42 + $(this).addClass("active");
  43 + createTime = ($(this).data("period"))
  44 + reloadWorkReportTable()
  45 + });
  46 +
  47 + //渲染表单元素
  48 + form.render(null, 'workReport-form')
  49 +
  50 + //新增日报
  51 + $('#workReport_create_day').on('click', function () {
  52 + openWorkReportForm('day')
  53 + })
  54 +
  55 + //新增周报
  56 + $('#workReport_create_week').on('click', function () {
  57 + openWorkReportForm('week')
  58 + })
  59 +
  60 + //新增月报
  61 + $('#workReport_create_month').on('click', function () {
  62 + openWorkReportForm('month')
  63 + })
  64 +
  65 + //渲染表格
  66 + var workReportTable = table.render({
  67 + elem: '#workReportTable',
  68 + url: domainName + '/api-web/workreport/page',
  69 + where: {
  70 + access_token: accessToken,
  71 + repTitle: $('#workReport_title').val(),
  72 + isRead: isRead,
  73 + repType: repType,
  74 + createTime: createTime,
  75 + dateLimit: '',
  76 + viewMode:false
  77 + },
  78 + height: 'full-300',
  79 + page: {
  80 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  81 + , theme: '#1E9FFF'//自定义分页主题颜色
  82 + },
  83 + end: function (e) {
  84 + form.render()
  85 + },
  86 + limit: common.limit,
  87 + limits: common.limits,
  88 + even: true,
  89 + cols: [[
  90 + {type: 'checkbox'},
  91 + {
  92 + field: 'repType', title: '汇报类型', align: 'center', width: 150,
  93 + templet: function (d) {
  94 + var typeName = ''
  95 + switch (d.repType) {
  96 + case 'day':
  97 + typeName = '日报'
  98 + break;
  99 + case 'week':
  100 + typeName = '周报'
  101 + break;
  102 + case 'month':
  103 + typeName = '月报'
  104 + break;
  105 + }
  106 + return `<div><span>${typeName}</span></div>`
  107 + }
  108 + },
  109 + {
  110 + field: 'repTitle', title: '标题', align: 'center', minWith: 300,
  111 + templet: '<div><span data-id="{{d.id}}" data-rep="{{d.repType}}" class="layui-table-link view-workReport-title">{{d.repTitle}}</span></div>'
  112 + },
  113 + {
  114 + field: 'attachmentList', title: '附件数量', align: 'center', width: 120,
  115 + templet: '<div><span data-id="{{d.id}}" class="layui-table-link view-workReport-attachment">{{d.attachmentList.length}}</span></div>'
  116 + },
  117 + {
  118 + field: 'reportUserList', title: '已读/接收人数', align: 'center', minWith: 150,
  119 + templet: function (d) {
  120 + var str = ''
  121 + var count = 0
  122 + $.each(d.reportUserList, function (i, v) {
  123 + if (v.isRead == 1) {
  124 + count++
  125 + }
  126 + })
  127 + str = count + '/' + d.reportUserList.length
  128 + return `<div><span data-id="${d.id}" class="layui-table-link view-workReport-reportUser">${str}</span></div>`
  129 + }
  130 + },
  131 + {
  132 + field: 'reportUserList', title: '已读人员', align: 'center', minWith: 400,
  133 + templet: function (d) {
  134 + var userName = []
  135 + var str = ''
  136 + $.each(d.reportUserList, function (i, v) {
  137 + if (v.isRead == 1) {
  138 + userName.push(v.nickName)
  139 + }
  140 + })
  141 + if(userName.length === 0){
  142 + userName = ['无']
  143 + }
  144 + str = userName.toString()
  145 + if (str.length == 0) str = '无'
  146 + return `<div><span>${str}</span></div>`
  147 + }
  148 + },
  149 + {
  150 + field: 'createUserNickName', title: '创建人', align: 'center', minWith: 150,
  151 + },
  152 + {
  153 + field: 'createTime', title: '上报时间', align: 'center', minWith: 150,
  154 + },
  155 + {
  156 + title: '操作', align: "center", width: 120,
  157 + templet: '<div><span data-id="{{d.id}}" class="layui-table-link delete-workReport-btn">删除</span></div>'
  158 + }
  159 + ]],
  160 + done: function () {
  161 + //点击标题编辑表单
  162 + $('.view-workReport-title').on('click', function () {
  163 + openWorkReportForm($(this).data('rep'), $(this).data('id'))
  164 + })
  165 +
  166 + //点击已读/未读获取接收人列表
  167 + $('.view-workReport-reportUser').on('click', function () {
  168 + openWorkReportList('reportUser', $(this).data('id'))
  169 +
  170 + })
  171 +
  172 + //获取附件列表
  173 + $('.view-workReport-attachment').on('click', function () {
  174 + openWorkReportList('attachment', $(this).data('id'))
  175 + })
  176 +
  177 + //删除事件
  178 + $('.delete-workReport-btn').on('click', function () {
  179 + deleteWorkRepord($(this).data("id"))
  180 + })
  181 + }
  182 + })
  183 +
  184 + //刷新表格
  185 + function reloadWorkReportTable() {
  186 + workReportTable.reload({
  187 + where: {
  188 + access_token: accessToken,
  189 + repTitle: $('#workReport_title').val(),
  190 + isRead: isRead,
  191 + repType: repType,
  192 + dateLimit: '',
  193 + createTime: createTime
  194 + },
  195 + })
  196 + }
  197 +
  198 + //删除数据
  199 + function deleteWorkRepord(id) {
  200 + //确认提示框
  201 + layer.confirm('数据删除后将无法恢复,您确定要删除吗?', {
  202 + btn: ['确定', '取消'] //按钮
  203 + }, function () {
  204 + admin.req({
  205 + url: domainName + '/api-web/workreport/delete',
  206 + type: 'delete',
  207 + data: {id: id}
  208 + }).done(function (res) {
  209 + layer.msg('删除成功', {
  210 + offset: '15px',
  211 + icon: 1,
  212 + time: 1000
  213 + }, function () {
  214 + reloadWorkReportTable()
  215 + })
  216 + }).error(function (error) {
  217 + console.log(error)
  218 + })
  219 + })
  220 + }
  221 +
  222 + //新增/编辑表单
  223 + function openWorkReportForm(repType, id) {
  224 + var title = id ? '编辑' : '新增'
  225 + common.openWin('workreport/add', title, {id: id, repType: repType}, ['保存', '取消'], function f() {
  226 + $("#workReport-form-save-id").trigger("click");
  227 + })
  228 + }
  229 +
  230 + //查看附件/接收人列表
  231 + function openWorkReportList(type, id) {
  232 + var title = ''
  233 + if (type == 'attachment') {
  234 + title = '附件'
  235 + } else {
  236 + title = '接收人'
  237 + }
  238 + common.openWin('workreport/list', title, {id: id, type: type}, ['确定', '取消'])
  239 + }
  240 +
  241 + //获取页面选中数据
  242 + function getCheckStatusData() {
  243 + return table.checkStatus('workReportTable').data
  244 + }
  245 +
  246 + return {reloadWorkReportTable, getCheckStatusData}
  247 + })
  248 +})
  1 +//工作汇报
  2 +layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions'], function (exports) {
  3 + var $ = layui.$;
  4 + var form = layui.form;
  5 + var layer = layui.layer;
  6 + var admin = layui.admin;
  7 + var table = layui.table;
  8 + var common = layui.common;
  9 + var session = layui.sessions
  10 + var domainName = common.domainName;
  11 +
  12 + //对外暴露的接口
  13 + exports("workReportList", function (d) {
  14 + var accessToken = session.getToken()['access_token']
  15 + if (d.type == 'attachment') {
  16 + $('#attachmentTable').show()
  17 + $('#reportUserTable').hide()
  18 + createAttachmentTable()
  19 + } else {
  20 + $('#attachmentTable').hide()
  21 + $('#reportUserTable').show()
  22 + createReportUserTable()
  23 + }
  24 +
  25 + //渲染收件人表格
  26 + function createReportUserTable() {
  27 + var reportUserTable = table.render({
  28 + elem: '#reportUserTable',
  29 + url: domainName + '/api-web/workreport/getUserById',
  30 + where: {
  31 + access_token: accessToken,
  32 + id: d.id
  33 + },
  34 + height: 'full',
  35 + page: {
  36 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  37 + , theme: '#1E9FFF'//自定义分页主题颜色
  38 + },
  39 + end: function (e) {
  40 + form.render()
  41 + },
  42 + limit: common.limit,
  43 + limits: common.limits,
  44 + even: true,
  45 + cols: [[
  46 + {type: 'numbers', title: '序号'},
  47 + {
  48 + field: 'nickName', title: '姓名', align: 'center', minWith: 200,
  49 + },
  50 + {
  51 + field: 'department', title: '所属部门', align: 'center', minWith: 150,
  52 + },
  53 + {
  54 + field: 'isRead', title: '阅读状态', align: 'center', minWith: 150,
  55 + templet: function (d) {
  56 + var str = ''
  57 + if (d.isRead == 0) {
  58 + str = '未读'
  59 + return `<div><span style="color: red">${str}</span></div>`
  60 + } else {
  61 + str = '已读'
  62 + return `<div><span>${str}</span></div>`
  63 + }
  64 + }
  65 + },
  66 + {
  67 + field: 'readingTime', title: '阅读时间', align: 'center', minWith: 150,
  68 + }
  69 + ]],
  70 + done: function () {
  71 +
  72 + }
  73 + })
  74 + }
  75 +
  76 + //渲染附件表格
  77 + function createAttachmentTable() {
  78 + var attachmentTable = table.render({
  79 + elem: '#attachmentTable',
  80 + url: domainName + '/api-web/workreport/getAttaById',
  81 + where: {
  82 + access_token: accessToken,
  83 + id: d.id
  84 + },
  85 + height: 'full',
  86 + page: {
  87 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
  88 + , theme: '#1E9FFF'//自定义分页主题颜色
  89 + },
  90 + end: function (e) {
  91 + form.render()
  92 + },
  93 + limit: common.limit,
  94 + limits: common.limits,
  95 + even: true,
  96 + cols: [[
  97 + {type: 'numbers', title: '序号'},
  98 + {
  99 + field: 'name', title: '文件名称', align: 'center', minWith: 200,
  100 + }, {
  101 + field: 'originalName', title: '原始名称', align: 'center', minWith: 200,
  102 + }, {
  103 + field: 'suffix', title: '文件后缀', align: 'center', minWith: 150,
  104 + },
  105 + {
  106 + field: 'size', title: '文件大小', align: 'center', minWith: 150,
  107 + templet: function (d) {
  108 + var str = (d.size / 1000).toFixed(2)
  109 + return `<div><span>${str}KB</span></div>`
  110 + }
  111 + },
  112 + {
  113 + title: '操作', align: "center", width: 120,
  114 + templet: '<div><span data-id="{{d.id}}" data-suffix="{{d.suffix}}" class="layui-table-link preview-attachment-btn">预览</span>' +
  115 + '<span data-id="{{d.id}}" data-suffix="{{d.suffix}}" class="layui-table-link attachment-download-btn" style="margin-left: 10px">下载</span></div>'
  116 + }
  117 + ]],
  118 + done: function () {
  119 + $('.preview-attachment-btn').on('click', function () {
  120 + var id = $(this).data('id')
  121 + var suffix = $(this).data('suffix')
  122 + if (suffix == 'jpg' || suffix == 'png' || suffix == 'JPG' || suffix == 'PNG') { //图片类型
  123 + var srcUrl = domainName + `/api-web/openoffice/readImage/${id}?access_token=` + accessToken
  124 + layer.open({
  125 + type: 1,
  126 + content: `<div><img src="${srcUrl}" width="100%" height="100%" /></div>`,
  127 + title: '图片预览',
  128 + area: ['60%', '90%']
  129 + })
  130 + } else {
  131 + //附件为文档类型
  132 + common.openReport(id)
  133 + }
  134 + })
  135 +
  136 + $('.attachment-download-btn').on('click',function () {
  137 + var id = $(this).data('id')
  138 + var suffix = $(this).data('suffix')
  139 + var url = domainName + `/api-web/openoffice/download/${id}?access_token=` + accessToken
  140 + window.open(url)
  141 + })
  142 + }
  143 + })
  144 + }
  145 +
  146 + })
  147 +})
  1 +/** 工作汇报查看 */
  2 +layui.define(['table', 'form', 'sessions', 'admin', 'common', 'echarts','laydate','element'], function (exports) {
  3 + var $ = layui.$;
  4 + var form = layui.form;
  5 + var table = layui.table;
  6 + var admin = layui.admin;
  7 + var common = layui.common;
  8 + var laydate = layui.laydate;
  9 + var element = layui.element;
  10 +
  11 + exports('workReportView', function () {
  12 + var sessions = layui.sessions;
  13 + var accessToken = sessions.getToken().access_token;
  14 + var domainName = common.domainName;
  15 + var companyChart = echarts.init(document.getElementById('chart-company-report'));
  16 + var noReadChart = echarts.init(document.getElementById('chart-noRead-report'));
  17 + var dateLimit = ""
  18 + var createTime = ""
  19 + var type = ''
  20 + var urlRepType = ''
  21 + var manufacturerId = ''
  22 + var reportDetailTable;
  23 + getUrlType()
  24 +
  25 + if (type != '1') {
  26 + createTime = 'thisWeek';
  27 + } else {
  28 + $.each($("button.date"),function (i,e) {
  29 + var $dom = $(e);
  30 + if($dom.hasClass("active")){
  31 + $dom.removeClass("active")
  32 + }
  33 + })
  34 + $.each($("button.isRead"),function (i,e) {
  35 + var $dom = $(e);
  36 + if($dom.data("type") == '0'){
  37 + $dom.addClass("active")
  38 + }
  39 + })
  40 + $.each($('input[name="repType"]'),function (i,e) {
  41 + var $dom = $(e);
  42 + if($dom.val() == urlRepType){
  43 + $dom.attr('checked','checked');
  44 + }
  45 + })
  46 + }
  47 +
  48 + //日期范围选择
  49 + laydate.render({
  50 + elem: '#dateLimit'
  51 + ,range: '~',
  52 + done: function (value) {
  53 + dateLimit = value
  54 + if (dateLimit == '') {
  55 + $('[data-period="thisWeek"]').click()
  56 + } else {
  57 + $.each($("button.date"),function (i,e) {
  58 + var $dom = $(e);
  59 + if($dom.hasClass("active")){
  60 + $dom.removeClass("active")
  61 + }
  62 + })
  63 + reloadAllChange()
  64 + }
  65 + }
  66 + });
  67 +
  68 + form.render();
  69 + // loadDailyChart();
  70 + // loadReportableChart();
  71 + loadCompanyReport();
  72 + loadReadReport();
  73 + loadWorkReportTable();
  74 + loadConditionSelect();
  75 + var url = domainName + '/api-web/workreport/chart/noRead';
  76 + loadNoReadChart(noReadChart,url,'未读');
  77 +
  78 + // tab页切换事件
  79 + element.on('tab(report-tab)', function (data) {
  80 + var name = '';
  81 + if (data.index == 0) {
  82 + url = domainName + '/api-web/workreport/chart/noRead'
  83 + name = '未读';
  84 + loadNoReadChart(noReadChart,url,name);
  85 + } else if (data.index == 1) {
  86 + url = domainName + '/api-web/workreport/chart/noReport?createTime=' + createTime + '&dateLimit=' + dateLimit;
  87 + name = '未报';
  88 + var noReportChat = echarts.init(document.getElementById('chart-noReport-report'));
  89 + loadNoReadChart(noReportChat,url,name);
  90 + } else if (data.index == 2) {
  91 + url = domainName + '/api-web/workreport/chart/noHandlingAlarmsChart'
  92 + name = '未处理';
  93 + var noAlarmChart = echarts.init(document.getElementById('chart-noAlarm-report'));
  94 + loadNoReadChart(noAlarmChart,url,name);
  95 + }
  96 + });
  97 +
  98 + //监听Esc事件
  99 + $(document).keyup(function(event){
  100 + if(event.keyCode === 27 || event.keyCode === 96){
  101 + layer.closeAll();
  102 + }
  103 + });
  104 +
  105 + $("button.isRead").unbind().on("click",function () {
  106 + var $dom = $(this);
  107 + $("button.isRead").removeClass("active")
  108 + $dom.addClass("active")
  109 + loadWorkReportTable();
  110 + });
  111 +
  112 + // 日期方式选择
  113 + $('#btns-workreport-time button').click(function () {
  114 + $.each($("button.date"),function (i,e) {
  115 + var $dom = $(e);
  116 + if($dom.hasClass("active")){
  117 + $dom.removeClass("active")
  118 + }
  119 + })
  120 + $("#dateLimit").val('')
  121 + dateLimit = ''
  122 + $("#btns-workreport-time button").removeClass("active");
  123 + $(this).addClass("active");
  124 + createTime = ($(this).data("period"))
  125 + reloadAllChange();
  126 + });
  127 +
  128 + // 回车搜索
  129 + $('[lay-filter="form-workreport-condition"] input').keydown(function (e) {
  130 + if (e.keyCode === 13) {
  131 + reloadAllChange();
  132 + }
  133 + });
  134 + // 单选框改变搜索
  135 + form.on('radio(workReport-currIsRead)', reloadAllChange);
  136 + form.on('radio(workReport-repType)', reloadAllChange);
  137 + // 下拉框改变搜索
  138 + form.on('select(slt-workreport-group)', reloadAllChange);
  139 + form.on('select(slt-workreport-user)', reloadAllChange);
  140 +
  141 + // 勾选标记为已读事件
  142 + $('#btn-workreport-set-read').click(function () {
  143 + var checks = table.checkStatus('table-workreport-view').data;
  144 + checks = $.grep(checks, item => item.currIsRead == '0');
  145 + checks = $.map(checks, item => item.id);
  146 + setRead(checks);
  147 + });
  148 + // 标记全部为已读事件
  149 + $('#btn-workreport-set-all-read').click(function () {
  150 + admin.req({
  151 + url: domainName + '/api-web/workreport/setRead/all'
  152 + }).done(function (response) {
  153 + if (response.success) {
  154 + layer.msg('执行操作成功!', {icon: 1, time: 3000});
  155 + loadReadReport();
  156 + loadWorkReportTable();
  157 + } else {
  158 + layer.msg('执行操作失败!', {icon: 2, time: 3000});
  159 + }
  160 + });
  161 + });
  162 +
  163 + // 加载工作汇报表格
  164 + function loadWorkReportTable() {
  165 + var conditions = form.val('form-workreport-condition');
  166 + $.each($("button.isRead"),function (i,e) {
  167 + var $dom = $(e);
  168 + if($dom.hasClass("active")){
  169 + conditions["currIsRead"] = $dom.data("type")
  170 + }
  171 + })
  172 + if(manufacturerId!=''){
  173 + conditions.manufacturerName = manufacturerId;
  174 + }
  175 + Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
  176 + table.render({
  177 + elem: '#table-workreport-view',
  178 + url: domainName + '/api-web/workreport/page',
  179 + where: conditions,
  180 + height: 'full-360',
  181 + page: {
  182 + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
  183 + theme: '#1E9FFF'
  184 + },
  185 + end: function (e) {
  186 + form.render()
  187 + },
  188 + limit: common.limit,
  189 + limits: common.limits,
  190 + even: true,
  191 + cols: [[{
  192 + type: 'checkbox'
  193 + }, {
  194 + type: 'numbers', title: '序号'
  195 + }, {
  196 + field: 'repType', title: '汇报类型', align: 'center',
  197 + templet: function (d) {
  198 + var typeName = ''
  199 + switch (d.repType) {
  200 + case 'day':
  201 + typeName = '日报'
  202 + break;
  203 + case 'week':
  204 + typeName = '周报'
  205 + break;
  206 + case 'month':
  207 + typeName = '月报'
  208 + break;
  209 + }
  210 + return typeName
  211 + }
  212 + }, {
  213 + field: 'repTitle', title: '标题', align: 'center', minWidth: 200,event: 'serRead',
  214 + templet: '<div><span data-id="{{d.id}}" data-rep="{{d.repType}}" class="layui-table-link view-workReport-title" >{{d.repTitle}}</span></div>'
  215 + }, {
  216 + field: 'attachmentList', title: '附件数量', align: 'center',
  217 + templet: '<div><span data-id="{{d.id}}" class="layui-table-link view-workReport-attachment">{{d.attachmentList.length}}</span></div>'
  218 + }, {
  219 + field: 'currIsRead', title: '状态', align: 'center',
  220 + templet: function (d) {
  221 + if (d.currIsRead == '1') {
  222 + return '<span class="green">已读</span>';
  223 + } else {
  224 + return '<span class="red">未读</span>';
  225 + }
  226 + }
  227 + }, {
  228 + field: 'reportUserList', title: '未读人员', align: 'center',minWidth:'200',
  229 + templet: function (d) {
  230 + var userName = [];
  231 + $.each(d.reportUserList, function (i, v) {
  232 + if (v.isRead == 0) {
  233 + userName.push(v.nickName)
  234 + }
  235 + });
  236 + if(userName.length === 0){
  237 + userName = ['无']
  238 + }
  239 + return userName.toString();
  240 + }
  241 + }, {
  242 + field: 'reportUserList', title: '已读人员', align: 'center',minWidth:'200',
  243 + templet: function (d) {
  244 + var userName = [];
  245 + $.each(d.reportUserList, function (i, v) {
  246 + if (v.isRead == 1) {
  247 + userName.push(v.nickName)
  248 + }
  249 + });
  250 + if(userName.length === 0){
  251 + userName = ['无']
  252 + }
  253 + return userName.toString();
  254 + }
  255 + }, {
  256 + field: 'createUserNickName', title: '上报人', align: 'center',
  257 + }, {
  258 + field: 'manufacturerName', title: '厂商', align: 'center',
  259 + }, {
  260 + field: 'createTime', title: '上报时间', align: 'center',
  261 + }]],
  262 + done: function () {
  263 + //获取附件列表
  264 + $('.view-workReport-attachment').on('click', function () {
  265 + common.openWin('workreport/list', '附件', {id: $(this).data('id'), type: 'attachment'}, ['确定', '取消']);
  266 + });
  267 + }
  268 + });
  269 + }
  270 +
  271 + //监听单元格事件
  272 + table.on('tool(table-workreport-view)', function(obj){
  273 + var data = obj.data;
  274 + if(obj.event === 'serRead'){
  275 +
  276 + var id = data['id'];
  277 + var repType = data['repType'];
  278 + admin.req({
  279 + url: domainName + '/api-web/workreport/setRead',
  280 + data: {workReportIds: [id]}
  281 + }).done(function (response) {
  282 + if (response.success) {
  283 + obj.update({
  284 + currIsRead: "1"
  285 + });
  286 + loadReadReport();
  287 + }
  288 + });
  289 + common.openWin('workreport/add', '查看', {id: id, repType: repType, viewType: 'view'}, ['关闭'], function f() {
  290 + return true;
  291 + }, null, null, {
  292 + success: function () {
  293 + form.render();
  294 + }
  295 + })
  296 + }
  297 + });
  298 +
  299 + // 加载查询条件下拉框
  300 + function loadConditionSelect() {
  301 + admin.req({
  302 + url: domainName + '/api-web/bWorkreportGroup/findManufacturerList'
  303 + }).done(function (response) {
  304 + var options = "<option value=''>=选择厂商=</option>";
  305 + $.each(response.data, function (i, v) {
  306 + options += "<option value='" + v.id + "'>" + v.manufacturerName + "</option>"
  307 + });
  308 + $('#slt-workreport-group').html(options);
  309 + if(manufacturerId!=''){
  310 + $('#slt-workreport-group').val(manufacturerId)
  311 + }
  312 + form.render();
  313 +
  314 + });
  315 + $.ajax({
  316 + url: domainName + '/api-user/users/getAll',
  317 + data: {
  318 + access_token: accessToken
  319 + },
  320 + success: function (response) {
  321 + var options = "<option value=''>=选择汇报人=</option>";
  322 + $.each(response, function (i, v) {
  323 + options += "<option value='" + v.username + "'>" + v.nickname + "</option>"
  324 + });
  325 + $('#slt-workreport-user').html(options);
  326 + form.render();
  327 + }
  328 + });
  329 + }
  330 +
  331 + // 加载最近日报汇报统计图表
  332 + function loadDailyChart() {
  333 + var conditions = form.val('form-workreport-condition');
  334 + Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
  335 + admin.req({
  336 + url: domainName + '/api-web/workreport/chart/daily',
  337 + data: conditions
  338 + }).done(function (response) {
  339 + var chartData = response.map;
  340 + var needReportList = chartData.needReportList;
  341 + var reportedList = chartData.reportedList;
  342 + var xAxisData = chartData.xAxisData;
  343 + var option = {
  344 + backgroundColor: 'rgba(255, 255, 255, 1)',
  345 + tooltip: {
  346 + trigger: 'axis',
  347 + extraCssText: 'background: #fff; border-radius: 0;box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);color: #333;',
  348 + axisPointer: {
  349 + type: 'shadow',
  350 + shadowStyle: {
  351 + color: '#ffffff',
  352 + shadowColor: 'rgba(225,225,225,1)',
  353 + shadowBlur: 5
  354 + }
  355 + }
  356 + },
  357 + grid: {
  358 + top: 10,
  359 + right: 5
  360 + },
  361 + xAxis: {
  362 + type: 'category',
  363 + axisLine: {
  364 + show: false
  365 + },
  366 + axisTick: {
  367 + show: false
  368 + },
  369 + axisLabel: {
  370 + margin: 20,
  371 + },
  372 + data: xAxisData
  373 + },
  374 + yAxis: {
  375 + axisLine: {
  376 + show: false
  377 + },
  378 + axisTick: {
  379 + show: false
  380 + }
  381 + },
  382 + series: [{
  383 + name: '应报',
  384 + data: needReportList,
  385 + type: 'bar',
  386 + barWidth: 20,
  387 + zlevel: 9,
  388 + itemStyle: {
  389 + borderWidth: 1,
  390 + zlevel: 99,
  391 + borderColor: '#a8d4ff', //同背景色一样
  392 + color: '#e3f2ff'
  393 +
  394 + },
  395 + emphasis: {
  396 + itemStyle: {
  397 + borderWidth: 1,
  398 + zlevel: 99,
  399 + borderColor: '#a8d4ff', //同背景色一样
  400 + color: '#e3f2ff'
  401 + }
  402 + }
  403 + }, {
  404 + name: '已报',
  405 + data: reportedList,
  406 + type: 'bar',
  407 + barWidth: 20,
  408 + barGap: '-100%',
  409 + zlevel: 9,
  410 + color: '#2094ff'
  411 + }]
  412 + };
  413 + var lastWeekChart = echarts.init(document.getElementById('chart-daily-report'));
  414 + lastWeekChart.setOption(option);
  415 + });
  416 + }
  417 +
  418 + // 日报/周报/月报 应报已报统计
  419 + function loadReportableChart() {
  420 + var conditions = form.val('form-workreport-condition');
  421 + Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
  422 + admin.req({
  423 + url: domainName + '/api-web/workreport/chart/reptype',
  424 + data: conditions
  425 + }).done(function (response) {
  426 + var chartData = response.map;
  427 + var needReportList = chartData.needReportList;
  428 + var reportedList = chartData.reportedList;
  429 + var xAxisData = ['日报', '周报', '月报'];
  430 + var option = {
  431 + backgroundColor: 'rgba(255, 255, 255, 1)',
  432 + tooltip: {
  433 + trigger: 'axis',
  434 + extraCssText: 'background: #fff; border-radius: 0;box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);color: #333;',
  435 + axisPointer: {
  436 + type: 'shadow',
  437 + shadowStyle: {
  438 + color: '#ffffff',
  439 + shadowColor: 'rgba(225,225,225,1)',
  440 + shadowBlur: 5
  441 + }
  442 + }
  443 + },
  444 + grid: {
  445 + top: 10,
  446 + right: 5
  447 + },
  448 + xAxis: {
  449 + type: 'category',
  450 + axisLine: {
  451 + show: false
  452 + },
  453 + axisTick: {
  454 + show: false
  455 + },
  456 + axisLabel: {
  457 + margin: 20,
  458 + },
  459 + data: xAxisData
  460 + },
  461 + yAxis: {
  462 + axisLine: {
  463 + show: false
  464 + },
  465 + axisTick: {
  466 + show: false
  467 + }
  468 + },
  469 + series: [{
  470 + name: '应报',
  471 + data: needReportList,
  472 + type: 'bar',
  473 + barWidth: 20,
  474 + zlevel: 9,
  475 + itemStyle: {
  476 + borderWidth: 1,
  477 + zlevel: 99,
  478 + borderColor: '#a8d4ff', //同背景色一样
  479 + color: '#e3f2ff'
  480 +
  481 + },
  482 + emphasis: {
  483 + itemStyle: {
  484 + borderWidth: 1,
  485 + zlevel: 99,
  486 + borderColor: '#a8d4ff', //同背景色一样
  487 + color: '#e3f2ff'
  488 + }
  489 + }
  490 + }, {
  491 + name: '已报',
  492 + data: reportedList,
  493 + type: 'bar',
  494 + barWidth: 20,
  495 + barGap: '-100%',
  496 + zlevel: 9,
  497 + color: '#2094ff'
  498 + }]
  499 + };
  500 + var lastFiveTimesChart = echarts.init(document.getElementById('chart-reportable-report'));
  501 + lastFiveTimesChart.setOption(option);
  502 + });
  503 + }
  504 +
  505 + // 各厂商应报已报情况
  506 + function loadCompanyReport() {
  507 + var conditions = form.val('form-workreport-condition');
  508 + Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: '',dateLimit:dateLimit});
  509 + admin.req({
  510 + url: domainName + '/api-web/workreport/chart/group',
  511 + data: conditions
  512 + }).done(function (response) {
  513 + var chartData = response.map;
  514 + var groupList = chartData.groupList;
  515 + var needReportList = chartData.needReportList;
  516 + var reportedList = chartData.reportedList;
  517 + var xData = [];
  518 + var groupData = [];
  519 + $.each(groupList, function (i, v) {
  520 + xData.push(v);
  521 +
  522 + groupData.push({
  523 + name: v,
  524 + value: 1
  525 + });
  526 + });
  527 + var series = [{
  528 + name: '应报',
  529 + data: needReportList,
  530 + barWidth: 20,
  531 + type: 'bar',
  532 + label: {
  533 + show: true,
  534 + position: 'top',
  535 + textStyle: {
  536 + color: '#555'
  537 + },
  538 + formatter:function (data) {
  539 + return reportedList[data.dataIndex] +'/'+ data.value
  540 + }
  541 + },
  542 + itemStyle: {
  543 + normal: {
  544 + color: (params) => {
  545 + var colors = ['#b6c2ff', '#96edc1', '#fcb75b'];
  546 + return colors[params.dataIndex % 3]
  547 + }/*,
  548 + label: {
  549 + show: true, //开启显示
  550 + position: 'top', //在上方显示
  551 + textStyle: { //数值样式
  552 + color: 'black',
  553 + fontSize: 16
  554 + }
  555 + }*/
  556 + }
  557 + },
  558 + xAxisIndex: 0,
  559 + yAxisIndex: 0
  560 + }, {
  561 + name: '已报',
  562 + data: reportedList,
  563 + barWidth: 20,
  564 + type: 'bar',
  565 + barGap: '-100%',
  566 + label: {
  567 + show: false,
  568 + position: 'top',
  569 + textStyle: {
  570 + color: '#555'
  571 + }
  572 + },
  573 + itemStyle: {
  574 + normal: {
  575 + color: (params) => {
  576 + var colors = ['#4150d8', '#28bf7e', '#ed7c2f'];
  577 + return colors[params.dataIndex % 3]
  578 + },
  579 + /*label: {
  580 + show: true, //开启显示
  581 + position: 'top', //在上方显示
  582 + textStyle: { //数值样式
  583 + color: 'black',
  584 + fontSize: 16
  585 + }
  586 + }*/
  587 + }
  588 + },
  589 + xAxisIndex: 0,
  590 + yAxisIndex: 0
  591 + }/*, {
  592 + data: groupData,
  593 + label: {
  594 + show: true,
  595 + position: 'inside',
  596 + formatter: '{b}',
  597 + textStyle: {
  598 + color: '#777'
  599 + }
  600 + },
  601 + type: 'bar',
  602 + barGap: 0,
  603 + barWidth: 100. / groupList.length + '%',
  604 + itemStyle: {
  605 + normal: {
  606 + color: '#fff'
  607 + }
  608 + },
  609 + xAxisIndex: 1,
  610 + yAxisIndex: 1
  611 + }*/];
  612 + /**
  613 + 双X轴标签对应,伪实现思路:
  614 + 底部的标签也是柱状图,对应包含的区域为上方X轴条数占总数的比例,设为宽度即可
  615 + */
  616 + var option = {
  617 + tooltip: {
  618 + trigger: 'axis',
  619 + axisPointer: {
  620 + type: 'shadow'
  621 + }
  622 + },
  623 + grid: [{
  624 + top: 20,
  625 + bottom: 70,
  626 + right: 5
  627 + }, {
  628 + height: 30,
  629 + bottom: 30,
  630 + right: 5
  631 + }],
  632 + xAxis: [{
  633 + type: 'category',
  634 + data: xData,
  635 + gridIndex: 0,
  636 + axisLabel: {
  637 + color: '#333',
  638 + show: true,
  639 + interval:0,
  640 + rotate:25
  641 + },
  642 + axisLine: {
  643 + lineStyle: {
  644 + color: '#e7e7e7'
  645 + }
  646 + },
  647 + axisTick: {
  648 + lineStyle: {
  649 + color: '#e7e7e7'
  650 + }
  651 + },
  652 + zlevel: 2
  653 + }, {
  654 + type: 'category',
  655 + gridIndex: 1,
  656 + axisLine: {
  657 + show: false
  658 + },
  659 + zlevel: 1
  660 + }],
  661 + yAxis: [{
  662 + type: 'value',
  663 + gridIndex: 0,
  664 + axisLabel: {
  665 + color: '#333'
  666 + },
  667 + splitLine: {
  668 + lineStyle: {
  669 + type: 'dashed'
  670 + }
  671 + },
  672 + axisLine: {
  673 + lineStyle: {
  674 + color: '#ccc'
  675 + }
  676 + },
  677 + axisTick: {
  678 + lineStyle: {
  679 + color: '#ccc'
  680 + }
  681 + }
  682 + }, {
  683 + type: 'value',
  684 + gridIndex: 1,
  685 + axisLabel: {
  686 + show: false
  687 + },
  688 + axisLine: {
  689 + show: false
  690 + },
  691 + splitLine: {
  692 + show: false
  693 + },
  694 + axisTick: {
  695 + show: false
  696 + }
  697 + }],
  698 + series: series
  699 + };
  700 + companyChart.setOption(option)
  701 + });
  702 + }
  703 +
  704 + //点击弹出详情
  705 + companyChart.on('click',function (params) {
  706 + reportDetails(params.name)
  707 + })
  708 +
  709 + //未读人员
  710 + function loadNoReadChart(echartObject,url,name) {
  711 + var xData = ""
  712 + var yData = ""
  713 + echartObject.showLoading({
  714 + text: 'loading',
  715 + color: '#cbc6c6',
  716 + textColor: '#cbc6c6',
  717 + maskColor: 'rgba(255, 255, 255, 0.2)',
  718 + zlevel: 0,
  719 + });
  720 + admin.req({
  721 + url: url
  722 + }).done(function (response) {
  723 + if (response && response.map) {
  724 + xData = response.map.userList;
  725 + yData = response.map.valueList;
  726 + var series = [{
  727 + name: name,
  728 + data: yData,
  729 + barWidth: 20,
  730 + type: 'bar',
  731 + label: {
  732 + show: true,
  733 + position: 'top',
  734 + textStyle: {
  735 + color: '#555'
  736 + },
  737 + },
  738 + itemStyle: {
  739 + normal: {
  740 + color: (params) => {
  741 + var colors = ['#b6c2ff', '#96edc1', '#fcb75b'];
  742 + return colors[params.dataIndex % 3]
  743 + }
  744 + }
  745 + },
  746 + }]
  747 +
  748 + var option = {
  749 + tooltip: {
  750 + trigger: 'axis',
  751 + axisPointer: {
  752 + type: 'shadow'
  753 + }
  754 + },
  755 + grid: [{
  756 + top: 20,
  757 + bottom: 35,
  758 + left: 30,
  759 + right: 5
  760 + }],
  761 + xAxis: [{
  762 + type: 'category',
  763 + data: xData,
  764 + axisLabel: {
  765 + color: '#333',
  766 + show: true,
  767 + interval:0,
  768 + rotate:19,
  769 + fontSize : 10 //更改坐标轴文字大小
  770 + },
  771 + axisLine: {
  772 + lineStyle: {
  773 + color: '#e7e7e7'
  774 + }
  775 + },
  776 + axisTick: {
  777 + lineStyle: {
  778 + color: '#e7e7e7'
  779 + }
  780 + },
  781 + zlevel: 1
  782 + }],
  783 + yAxis: [{
  784 + type: 'value',
  785 + gridIndex: 0,
  786 + axisLabel: {
  787 + color: '#333'
  788 + },
  789 + splitLine: {
  790 + lineStyle: {
  791 + type: 'dashed'
  792 + }
  793 + },
  794 + axisLine: {
  795 + lineStyle: {
  796 + color: '#ccc'
  797 + }
  798 + },
  799 + axisTick: {
  800 + lineStyle: {
  801 + color: '#ccc'
  802 + }
  803 + }
  804 + }],
  805 + series: series
  806 + }
  807 + echartObject.hideLoading();
  808 + echartObject.setOption(option)
  809 + }
  810 + })
  811 + }
  812 +
  813 + //弹窗显示汇报详情
  814 + function reportDetails(name) {
  815 + layer.open({
  816 + title: ['汇报详细', 'font-size:18px;'],
  817 + type: 1,
  818 + area: ['70%', '60%'],
  819 + content: '<div class="layui-card" style="margin-top: 30px;box-shadow:none"><div class="layui-card-body"><table id="reportDetails" lay-filter="reportDetails"></table></div></div>',
  820 + btn: ['关闭'],
  821 + success: function(index, layero) {
  822 + reportDetailsTable(name)
  823 + },
  824 + yes: function (index, layero) {
  825 + layer.close(index)
  826 + }
  827 + });
  828 + }
  829 + $("#notReportCountBtn").unbind().on("click",function () {
  830 + layer.open({
  831 + title: ['汇报详细', 'font-size:18px;'],
  832 + type: 1,
  833 + area: ['70%', '60%'],
  834 + content: '<div class="layui-card" style="margin-top: 30px;box-shadow:none"><div class="layui-card-body"><table id="reportDetails" lay-filter="reportDetails"></table></div></div>',
  835 + btn: ['关闭'],
  836 + success: function(index, layero) {
  837 + reportDetailsTable();
  838 + },
  839 + yes: function (index, layero) {
  840 + layer.close(index)
  841 + }
  842 + });
  843 + })
  844 + function reportDetailsTable(name) {
  845 + var conditions = form.val('form-workreport-condition');
  846 + if (name) conditions["name"] = name
  847 + conditions["access_token"] = accessToken
  848 + conditions["createTime"] = createTime
  849 + conditions["viewMode"] = 'true'
  850 + conditions["dateLimit"] = dateLimit
  851 + reportDetailTable = table.render({
  852 + elem: '#reportDetails',
  853 + url: domainName + '/api-web/workreport/group/reportDetails',
  854 + where: conditions,
  855 + end: function (e) {
  856 + form.render()
  857 + },
  858 + even: true,
  859 + cols: [[{
  860 + type: 'checkbox'
  861 + }, {
  862 + type: 'numbers', title: '序号'
  863 + }, {
  864 + field: 'createBy', title: '组负责人', align: 'center'
  865 + }, {
  866 + field: 'needReport', title: '应报数量', align: 'center'
  867 + }, {
  868 + field: 'readCount', title: '已报数量', align: 'center'
  869 + }, {
  870 + field: 'needReport', title: '未报数量', align: 'center',style:'color:red',templet:function (d) {
  871 + return d.needReport-d.readCount
  872 + }
  873 + }]],
  874 + })
  875 + }
  876 +
  877 + //未读统计报表导出
  878 + $('#notReportExportBtn').unbind().on('click',function () {
  879 + var conditions = form.val('form-workreport-condition');
  880 + var url = common.domainName + '/api-web/workreport/group/exportReportDetails?access_token=' + accessToken + '&createTime=' + createTime + '&viewMode=' + 'true' + '&dateLimit=' + dateLimit + '&repType=' + conditions.repType + '&createBy=' + conditions.createBy;
  881 + window.open(url)
  882 + })
  883 +
  884 + // 已读未读报表
  885 + function loadReadReport() {
  886 + var conditions = form.val('form-workreport-condition');
  887 + Object.assign(conditions, {access_token: accessToken, createTime: createTime, viewMode: 'true',dateLimit:dateLimit});
  888 + admin.req({
  889 + url: domainName + '/api-web/workreport/chart/read',
  890 + data: conditions
  891 + }).done(function (response) {
  892 + var chartData = response.map;
  893 + var readCount = chartData.readCount;
  894 + var unReadCount = chartData.unReadCount;
  895 + var readPercent = (readCount / (readCount + unReadCount) * 100).toFixed(0);
  896 + readPercent = isNaN(readPercent) ? '0%' : readPercent + '%';
  897 + let echartData = [{
  898 + name: "已读",
  899 + value: readCount
  900 + }, {
  901 + name: "未读",
  902 + value: unReadCount
  903 + }];
  904 +
  905 + var formatNumber = function (num) {
  906 + let reg = /(?=(\B)(\d{3})+$)/g;
  907 + return num.toString().replace(reg, ',');
  908 + };
  909 +
  910 + var option = {
  911 + color: ['#367bec', '#00cefc'],
  912 + title: [{
  913 + text: '{val|' + readPercent + '}',
  914 + top: 'center',
  915 + left: 'center',
  916 + textStyle: {
  917 + rich: {
  918 + name: {
  919 + fontSize: 14,
  920 + fontWeight: 'normal',
  921 + color: '#666666',
  922 + padding: [10, 0]
  923 + },
  924 + val: {
  925 + fontSize: 32,
  926 + fontWeight: 'bold',
  927 + color: '#333333',
  928 + }
  929 + }
  930 + }
  931 + }],
  932 + series: [{
  933 + type: 'pie',
  934 + radius: ['45%', '60%'],
  935 + center: ['50%', '50%'],
  936 + data: echartData,
  937 + hoverAnimation: false,
  938 + itemStyle: {
  939 + normal: {
  940 + borderWidth: 2
  941 + }
  942 + },
  943 + labelLine: {
  944 + normal: {
  945 + length: 20,
  946 + length2: 120,
  947 + lineStyle: {
  948 + color: '#e6e6e6'
  949 + }
  950 + }
  951 + },
  952 + label: {
  953 + normal: {
  954 + formatter: params => {
  955 + return (
  956 + '{icon|●}{name|' + params.name + '}{value|' +
  957 + formatNumber(params.value) + '}'
  958 + );
  959 + },
  960 + padding: [0, -100, 25, -100],
  961 + rich: {
  962 + icon: {
  963 + fontSize: 16
  964 + },
  965 + name: {
  966 + fontSize: 14,
  967 + padding: [0, 10, 0, 4],
  968 + color: '#666666'
  969 + },
  970 + value: {
  971 + fontSize: 18,
  972 + fontWeight: 'bold',
  973 + color: '#333333'
  974 + }
  975 + }
  976 + }
  977 + },
  978 + }]
  979 + };
  980 +
  981 + var readChart = echarts.init(document.getElementById('chart-read-report'));
  982 + readChart.setOption(option);
  983 + });
  984 + }
  985 +
  986 + function setRead(workReportIds) {
  987 + if (workReportIds.length == 0) {
  988 + layer.msg('请至少选择一项未读的数据。', {icon: 0, time: 3000});
  989 + return false;
  990 + }
  991 + admin.req({
  992 + url: domainName + '/api-web/workreport/setRead',
  993 + data: {workReportIds: workReportIds}
  994 + }).done(function (response) {
  995 + if (response.success) {
  996 + // layer.msg('执行操作成功!', {icon: 1, time: 3000});
  997 + loadReadReport();
  998 + } else {
  999 + // layer.msg('执行操作失败!', {icon: 2, time: 3000});
  1000 + }
  1001 + });
  1002 + }
  1003 +
  1004 + //获取url中的type值
  1005 + function getUrlType() {
  1006 + var href = window.location.href;
  1007 + href = href.substr(href.indexOf("#"),href.length);
  1008 + var url = href.split("/");
  1009 + if (url.length <= 1) {
  1010 + return "";
  1011 + }
  1012 + for (var i = 0; i < url.length; i++) {
  1013 + if (url[i].indexOf("type") > -1) {
  1014 + type = url[i].split("=")[1]
  1015 + }
  1016 + if (url[i].indexOf("repType") > -1) {
  1017 + urlRepType = url[i].split("=")[1]
  1018 + }
  1019 + if (url[i].indexOf("manufacturerId") > -1) {
  1020 + manufacturerId = url[i].split("=")[1]
  1021 + }
  1022 + }
  1023 + }
  1024 +
  1025 + // 图表,表格重新加载
  1026 + function reloadAllChange() {
  1027 + loadWorkReportTable();
  1028 + // loadDailyChart();
  1029 + loadCompanyReport();
  1030 + loadReadReport();
  1031 + var url = domainName + '/api-web/workreport/chart/noReport?createTime=' + createTime + '&dateLimit=' + dateLimit;
  1032 + var name = '未报';
  1033 + var noReportChat = echarts.init(document.getElementById('chart-noReport-report'));
  1034 + loadNoReadChart(noReportChat,url,name);
  1035 + // loadNoReadChart()
  1036 + // loadReportableChart();
  1037 + }
  1038 + });
  1039 +});
@@ -5550,6 +5550,17 @@ form.form-edit .layui-form-item .layui-input-inline { @@ -5550,6 +5550,17 @@ form.form-edit .layui-form-item .layui-input-inline {
5550 margin-right: 0; 5550 margin-right: 0;
5551 float: left; 5551 float: left;
5552 } 5552 }
  5553 +.layui-form-item .inline-onethird {
  5554 + display: flex;
  5555 + width: 33%;
  5556 + margin-right: 0;
  5557 + float: left;
  5558 +}
  5559 +
  5560 +.layui-form-item .inline-onethird .layui-input-inline {
  5561 + margin-right: 2px;
  5562 + flex: 1;
  5563 +}
5553 5564
5554 .layui-form-item .inline-half .layui-input-inline { 5565 .layui-form-item .inline-half .layui-input-inline {
5555 margin-right: 2px; 5566 margin-right: 2px;
  1 +<!--工作汇报表单-->
  2 +<article>
  3 + <div class="layui-card-body">
  4 + <fieldset class="layui-elem-field layui-field-title">
  5 + <legend>日志信息</legend>
  6 + </fieldset>
  7 + <form class="layui-form layui-form-pane" lay-filter="add-workReport-form"
  8 + id="add-workReport-form" onsubmit="return false;">
  9 + <input hidden name="id" id="id" lay-verify="checkReportIsExist">
  10 + <div class="layui-form-item">
  11 + <div class="layui-inline inline-half">
  12 + <label class="layui-form-label">汇报类型</label>
  13 + <div class="layui-input-inline">
  14 + <select name="repType" id="workReport_type" lay-filter="workReport_type">
  15 + <option value="day">日报</option>
  16 + <option value="week">周报</option>
  17 + <option value="month">月报</option>
  18 + </select>
  19 + </div>
  20 + </div>
  21 + <div class="layui-inline inline-half">
  22 + <label class="layui-form-label">日期</label>
  23 + <div class="layui-input-inline">
  24 + <input type="text" class="layui-input" name="createTime" id="createTime">
  25 + </div>
  26 + </div>
  27 + </div>
  28 + <div class="layui-form-item hide" id="form-item-repTitle">
  29 + <div class="layui-inline inline-half">
  30 + <label class="layui-form-label">标题</label>
  31 + <div class="layui-input-inline">
  32 + <input type="text" class="layui-input" name="repTitle">
  33 + </div>
  34 + </div>
  35 + <div class="layui-inline inline-half">
  36 + <label class="layui-form-label">汇报人</label>
  37 + <div class="layui-input-inline">
  38 + <input type="text" class="layui-input" name="createUserNickName" readonly="readonly">
  39 + </div>
  40 + </div>
  41 + </div>
  42 + <div class="layui-form-item report_alarmStatic">
  43 + <label class="layui-form-label">告警信息</label>
  44 + <div class="layui-input-block">
  45 + <input type="text" class="layui-input" name="alarmStatic" id="alarmStatic" readonly>
  46 + </div>
  47 + </div>
  48 + <div class="layui-form-item">
  49 + <label class="layui-form-label textarea-label work_finish" style="height: 400px"></label>
  50 + <div class="layui-input-block">
  51 + <textarea style="height: 400px" class="layui-textarea" name="workAccomplish"
  52 + lay-verify="required" cols="30" rows="20"></textarea>
  53 + </div>
  54 + </div>
  55 + <div class="layui-form-item">
  56 + <label class="layui-form-label textarea-label work_conclusion"></label>
  57 + <div class="layui-input-block">
  58 + <textarea class="layui-textarea" name="workSummary" lay-verify="required"></textarea>
  59 + </div>
  60 + </div>
  61 + <div class="layui-form-item plan">
  62 + <label class="layui-form-label textarea-label work_plan"></label>
  63 + <div class="layui-input-block">
  64 + <textarea class="layui-textarea" name="workPlan"></textarea>
  65 + </div>
  66 + </div>
  67 + <div class="layui-form-item">
  68 + <label class="layui-form-label textarea-label work_help"></label>
  69 + <div class="layui-input-block">
  70 + <textarea class="layui-textarea" name="workHelp" lay-verify="required"></textarea>
  71 + </div>
  72 + </div>
  73 + <div class="layui-form-item">
  74 + <div class="layui-inline" style="width: 90%">
  75 + <label class="layui-form-label">选择附件</label>
  76 + <div class="layui-input-block attachment">
  77 + <input type="text" class="layui-input" readonly id="attachmentInput">
  78 + </div>
  79 + </div>
  80 + <div class="layui-inline">
  81 + <button class="layui-btn layui-btn-normal" id="attachment">附件</button>
  82 + <button id="upload_btn" hidden>附件</button>
  83 + </div>
  84 + </div>
  85 + <div class="layui-form-item" style="display: none" id="add-workReport-form-atta">
  86 + <label class="layui-form-label">已存附件</label>
  87 + <div class="layui-input-inline"
  88 + style="width: 90% !important;max-height: 130px;overflow-y: auto;margin-left: 10px;">
  89 + <div class="tags" id="selecte_content_id"></div>
  90 + </div>
  91 + </div>
  92 + <div class="layui-form-item">
  93 + <label class="layui-form-label">接收人</label>
  94 + <div class="layui-input-block reportUser">
  95 + </div>
  96 + </div>
  97 + <div class="layui-form-item">
  98 + <label class="layui-form-label textarea-label">备注</label>
  99 + <div class="layui-input-block">
  100 + <textarea class="layui-textarea" name="remark"></textarea>
  101 + </div>
  102 + </div>
  103 + <button type="submit" lay-submit lay-filter="workReport-form-save-id" class="layui-btn hide"
  104 + id="workReport-form-save-id">保存
  105 + </button>
  106 + <table id="table-report-add-attachment" class="hide"></table>
  107 + </form>
  108 + </div>
  109 + <div class="layui-card-body reportAlarm">
  110 + <fieldset class="layui-elem-field layui-field-title">
  111 + <legend>告警信息</legend>
  112 + </fieldset>
  113 + <table id="table-report-alarm"></table>
  114 + </div>
  115 +</article>
  116 +<script>
  117 + layui.use('workReportAdd', function (fn) {
  118 + fn({{d}})
  119 + })
  120 +</script>
  121 +
  122 +<style>
  123 + #add-workReport-form .layui-form-label {
  124 + width: 120px;
  125 + /* padding: 8px 12px; */
  126 + text-align: left !important;
  127 + }
  128 + #add-workReport-form .layui-input-block{
  129 + margin-left: 120px !important;
  130 + }
  131 + .tags{
  132 + margin-top:5px;
  133 + }
  134 + .tags span {
  135 + height: 20px;
  136 + margin-right: 10px;
  137 + margin-bottom: 3px;
  138 + padding: 5px 10px 5px 10px;
  139 + float: left;
  140 + white-space: nowrap;
  141 + color:#fff;
  142 + background-color:#009688;
  143 + text-shadow: 1px 1px 1px rgba(0, 0, 0, .15);
  144 + }
  145 + .tags .close {
  146 + font-weight: bold;
  147 + line-height: 20px;
  148 + margin-left:10px;
  149 + cursor: pointer;
  150 + text-align: center;
  151 + color: #fff;
  152 + border: 0 none;
  153 + background: transparent none repeat scroll 0 0;
  154 + }
  155 +</style>
  1 +<title>工作汇报配置</title>
  2 +<article class="page-container">
  3 + <div class="page-panel">
  4 + <div class="main">
  5 + <div class="layui-card">
  6 + <div class="layui-card-header">
  7 + <div class="layui-status search_panel">
  8 + <form class="layui-form layui-card-header layuiadmin-card-header-auto"
  9 + lay-filter="workReportConfig-form" onsubmit="return false;">
  10 + <div class="layui-form-item">
  11 + <div class="layui-inline">
  12 + <div class="layui-input-inline">
  13 + <input type="text" id="adminName" class="layui-input" autocomplete="off"
  14 + placeholder="汇报人">
  15 + </div>
  16 + </div>
  17 + <div class="layui-inline">
  18 + <div class="layui-input-inline">
  19 + <input type="text" id="userName" class="layui-input" autocomplete="off"
  20 + placeholder="接收人">
  21 + </div>
  22 + </div>
  23 + <div class="layui-inline">
  24 + <div class="layui-input-inline">
  25 + <select name="groupName" id="groupName" lay-filter="groupName">
  26 + <option value="">=配置名称=</option>
  27 + </select>
  28 + </div>
  29 + </div>
  30 + <div class="layui-inline">
  31 + <div class="layui-input-inline">
  32 + <select name="theirType" id="theirType" lay-filter="theirType">
  33 + <option value="">全部</option>
  34 + <option value="1">日志类型</option>
  35 + <option value="2">文档类型</option>
  36 + </select>
  37 + </div>
  38 + </div>
  39 + </div>
  40 + </form>
  41 + </div>
  42 + </div>
  43 + <div class="layui-card-body">
  44 + <div class="layui-btn-container">
  45 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="workReport_config_add">
  46 + 新增
  47 + </button>
  48 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="workReport_config_delete">
  49 + 删除
  50 + </button>
  51 + </div>
  52 + <table id="workReportConfigTable" lay-filter="workReportConfigTable"></table>
  53 + </div>
  54 + </div>
  55 + </div>
  56 + </div>
  57 +</article>
  58 +
  59 +<script>
  60 + layui.use('reportConfigIndex', function (fn) {
  61 + fn();
  62 + });
  63 +</script>
  1 +<form class="layui-form layui-form-pane" lay-filter="add-config-form"
  2 + name="add-config-form" onsubmit="return false;">
  3 + <input hidden name="id" id="id">
  4 + <div class="layui-form-item">
  5 + <label class="layui-form-label">名称</label>
  6 + <div class="layui-input-block">
  7 + <input type="text" id="name" name="name" lay-verify="required|groupName" lay-reqtext="请输入名称"
  8 + class="layui-input" autocomplete="off" placeholder="请输入名称">
  9 + </div>
  10 + </div>
  11 + <div class="layui-form-item">
  12 + <label class="layui-form-label">所属厂商</label>
  13 + <div class="layui-input-block">
  14 + <select name="manufacturerId" class="layui-select"></select>
  15 + </div>
  16 + </div>
  17 + <div class="layui-form-item">
  18 + <label class="layui-form-label">所属类型</label>
  19 + <div class="layui-input-block">
  20 + <select name="theirType" id="config_theirType" lay-filter="config_theirType" lay-verify="required">
  21 + <option value="1">日志类型</option>
  22 + <option value="2">文档类型</option>
  23 + </select>
  24 + </div>
  25 + </div>
  26 + <div class="layui-form-item">
  27 + <label class="layui-form-label">汇报人</label>
  28 + <div class="layui-input-block admin">
  29 + </div>
  30 + </div>
  31 + <div class="layui-form-item">
  32 + <label class="layui-form-label" id="config_receive_user">接收人</label>
  33 + <div class="layui-input-block user">
  34 + </div>
  35 + </div>
  36 +<!-- <div class="layui-form-item">
  37 + <div class="layui-inline">
  38 + <label class="layui-form-label">汇报类型</label>
  39 + <div class="layui-input-inline">
  40 + <input type="radio" name="reportType" value="day" title="日报" lay-filter="config_repType">
  41 + <input type="radio" name="reportType" value="week" title="周报" lay-filter="config_repType">
  42 + <input type="radio" name="reportType" value="month" title="月报" lay-filter="config_repType">
  43 + </div>
  44 + </div>
  45 + </div>-->
  46 + <div class="layui-form-item">
  47 + <label class="layui-form-label textarea-label">描述</label>
  48 + <div class="layui-input-block">
  49 + <textarea class="layui-textarea" name="remark"></textarea>
  50 + </div>
  51 + </div>
  52 +
  53 + <button type="submit" lay-submit class="layui-btn hide" lay-filter="config-form-save-id" id="config-form-save-id">保存</button>
  54 +</form>
  55 +
  56 +<script>
  57 + layui.use('reportConfigAdd',function (fn) {
  58 + fn({{d}})
  59 + })
  60 +</script>
  1 +<article class="page-container">
  2 + <div class="page-panel">
  3 + <div class="main">
  4 + <div class="layui-card">
  5 + <div class="layui-card-header">
  6 +
  7 + </div>
  8 + <div class="layui-card-body">
  9 + <table id="reportUserTable" lay-filter="reportUserTable"></table>
  10 + </div>
  11 + </div>
  12 + </div>
  13 + </div>
  14 +</article>
  15 +
  16 +<script>
  17 + layui.use('reportConfigList', function (fn) {
  18 + fn({{d}})
  19 + });
  20 +</script>
  1 +<title>工作汇报</title>
  2 +<article class="page-container">
  3 + <div class="page-panel">
  4 + <div class="main">
  5 + <div class="layui-card">
  6 + <div class="layui-card-header">
  7 + <div class="layui-status search_panel">
  8 + <form class="layui-form layui-card-header layuiadmin-card-header-auto"
  9 + lay-filter="workReport-form" onsubmit="return false;">
  10 + <div class="layui-form-item">
  11 + <div class="layui-inline">
  12 + <div class="layui-input-inline" style="width: 300px">
  13 + <input type="text" name="repTitle" id="workReport_title"
  14 + placeholder="标题搜索,支持内容模糊匹配" autocomplete="off" class="layui-input">
  15 + </div>
  16 + </div>
  17 + <div class="layui-inline">
  18 + <div class="layui-input-inline auto-width">
  19 + <input type="radio" name="isRead" value="" title="全部" checked
  20 + lay-filter="workReport_isRead">
  21 + <input type="radio" name="isRead" value="0" title="无人阅读"
  22 + lay-filter="workReport_isRead">
  23 + <input type="radio" name="isRead" value="1" title="有人阅读"
  24 + lay-filter="workReport_isRead">
  25 + </div>
  26 + </div>
  27 + <div class="layui-inline">
  28 + <div class="layui-input-inline auto-width">
  29 + <input type="radio" name="repType" value="" title="全部" checked
  30 + lay-filter="workReport_type">
  31 + <input type="radio" name="repType" value="day" title="日报"
  32 + lay-filter="workReport_type">
  33 + <input type="radio" name="repType" value="week" title="周报"
  34 + lay-filter="workReport_type">
  35 + <input type="radio" name="repType" value="month" title="月报"
  36 + lay-filter="workReport_type">
  37 + </div>
  38 + </div>
  39 + <div class="layui-inline layui-btn-group time-group" id="createTimeBtn">
  40 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm active"
  41 + data-period="today">今天
  42 + </button>
  43 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
  44 + data-period="lastWeek">上周
  45 + </button>
  46 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
  47 + data-period="thisWeek">本周
  48 + </button>
  49 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
  50 + data-period="lastMonth">上月
  51 + </button>
  52 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
  53 + data-period="thisMonth">本月
  54 + </button>
  55 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
  56 + data-period="thisQuarter">本季度
  57 + </button>
  58 + <button type="button" class="layui-btn layui-btn-primary layui-btn-sm"
  59 + data-period="all">全部
  60 + </button>
  61 + </div>
  62 + </div>
  63 + </form>
  64 + </div>
  65 + </div>
  66 + <div class="layui-card-body">
  67 + <div class="layui-btn-container">
  68 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="workReport_create_day">
  69 + 新增日报
  70 + </button>
  71 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="workReport_create_week">
  72 + 新增周报
  73 + </button>
  74 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="workReport_create_month">
  75 + 新增月报
  76 + </button>
  77 + </div>
  78 + <table id="workReportTable" lay-filter="workReportTable"></table>
  79 + </div>
  80 + </div>
  81 + </div>
  82 + </div>
  83 +</article>
  84 +
  85 +<script>
  86 + layui.use('workReportIndex', function (fn) {
  87 + fn();
  88 + });
  89 +</script>
  90 +
  91 +<style>
  92 + .layui-btn-timeTag {
  93 + background-color: #999999;
  94 + border-radius: 5px;
  95 + }
  96 +</style>
  1 +<article class="page-container">
  2 + <div class="page-panel">
  3 + <div class="main">
  4 + <div class="layui-card">
  5 + <div class="layui-card-header">
  6 + </div>
  7 + <div class="layui-card-body">
  8 + <table id="attachmentTable" lay-filter="attachmentTable"></table>
  9 + <table id="reportUserTable" lay-filter="reportUserTable"></table>
  10 + </div>
  11 + </div>
  12 + </div>
  13 + </div>
  14 +</article>
  15 +
  16 +<script>
  17 + layui.use('workReportList', function (fn) {
  18 + fn({{d}})
  19 + });
  20 +</script>
  1 +<title>工作日志查看</title>
  2 +<article>
  3 + <div class="page-panel workview">
  4 + <div class="main">
  5 + <div class="layui-card">
  6 + <div class="layui-card-header">
  7 + <div class="layui-status">
  8 + <form class="layui-form layui-card-header" onsubmit="return false" lay-filter="form-workreport-condition">
  9 + <div class="layui-form-item">
  10 + <div class="layui-inline">
  11 + <div class="layui-input-inline layui-input-inline--long">
  12 + <input type="text" id="monitor_keyword" name="repTitle" placeholder="标题搜索,支持内容模糊匹配" autocomplete="off" class="layui-input">
  13 + </div>
  14 + </div>
  15 + <div class="layui-inline">
  16 + <div class="layui-input-inline">
  17 + <select name="manufacturerName" id="slt-workreport-group" lay-filter="slt-workreport-group" lay-search>
  18 + <option value="">=选择厂商=</option>
  19 + </select>
  20 + </div>
  21 + </div>
  22 + <div class="layui-inline">
  23 + <div class="layui-input-inline">
  24 + <select name="createBy" id="slt-workreport-user" lay-filter="slt-workreport-user" lay-search>
  25 + <option value="">=选择汇报人=</option>
  26 + </select>
  27 + </div>
  28 + </div>
  29 + <!-- <div class="layui-inline">
  30 + <div class="layui-input-inline">
  31 + <input type="radio" name="currIsRead" value="0" title="未读" lay-filter="workReport-currIsRead">
  32 + <input type="radio" name="currIsRead" value="1" title="已读" lay-filter="workReport-currIsRead">
  33 + </div>
  34 + </div>-->
  35 + <div class="layui-inline">
  36 + <div class="layui-input-inline" style="width: auto">
  37 + <input type="radio" name="repType" value="day" title="日报" checked="checked" lay-filter="workReport-repType">
  38 + <input type="radio" name="repType" value="week" title="周报" lay-filter="workReport-repType">
  39 + <input type="radio" name="repType" value="month" title="月报" lay-filter="workReport-repType">
  40 + </div>
  41 + </div>
  42 + <div class="layui-btn-group time-group" id="btns-workreport-time" style="padding: 0">
  43 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs active date" data-period="today">今天</button>
  44 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs date" data-period="lastWeek">上周</button>
  45 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs date" data-period="thisWeek">本周</button>
  46 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs date" data-period="lastMonth">上月</button>
  47 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs date" data-period="thisMonth">本月</button>
  48 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs date" data-period="thisQuarter">本季度</button>
  49 + <button type="button" class="layui-btn layui-btn-primary layui-btn-xs date" data-period="">全部</button>
  50 + </div>
  51 + <div class="layui-inline" style="margin-left: 10px">
  52 + <div class="layui-input-inline" style="width: auto">
  53 + <input type="text" name="dateLimit" id="dateLimit" autocomplete="off" class="layui-input" readonly placeholder="其他日期范围">
  54 + </div>
  55 + </div>
  56 + </div>
  57 + </form>
  58 + </div>
  59 + </div>
  60 + <div style="display: flex" class="layui-card-echart">
  61 + <!--<div style="flex-grow: 1">
  62 + <h5 class="lay-row-title">日报统计</h5>
  63 + <div class="pie-chart" id="chart-daily-report"></div>
  64 + </div>
  65 + <div style="flex-grow: 1">
  66 + <h5 class="lay-row-title">应报已报统计</h5>
  67 + <div class="pie-chart" id="chart-reportable-report"></div>
  68 + </div>-->
  69 + <div style="flex-grow: 3;width: 60%!important;">
  70 + <h5 class="lay-row-title">厂商统计
  71 + <button class="layui-btn layui-btn-primary layui-btn-sm" style="float:right;" id="notReportCountBtn">未报统计</button>
  72 + <button class="layui-btn layui-btn-primary layui-btn-sm" style="float:right; margin-right: 10px" id="notReportExportBtn">统计报表</button>
  73 + </h5>
  74 + <div class="pie-chart" id="chart-company-report" style="min-height: 240px"></div>
  75 + </div>
  76 + <div style="flex-grow: 1">
  77 + <h5 class="lay-row-title">已读未读占比</h5>
  78 + <div class="pie-chart" id="chart-read-report" style="min-height: 240px"></div>
  79 + </div>
  80 + <div style="flex-grow: 1">
  81 + <div class="layui-tab layui-tab-card" lay-filter="report-tab" style="height: 250px;">
  82 + <ul class="layui-tab-title">
  83 + <li class="layui-this">未读</li>
  84 + <li>未报</li>
  85 + <li>未处理告警</li>
  86 + </ul>
  87 + <div class="layui-tab-content tab-content">
  88 + <div class="layui-tab-item layui-show">
  89 + <div class="pie-chart-clone" id="chart-noRead-report" style="height: 200px"></div>
  90 + </div>
  91 + <div class="layui-tab-item">
  92 + <div class="pie-chart-clone" id="chart-noReport-report" style="height: 200px"></div>
  93 + </div>
  94 + <div class="layui-tab-item">
  95 + <div class="pie-chart-clone" id="chart-noAlarm-report" style="height: 200px"></div>
  96 + </div>
  97 + </div>
  98 + </div>
  99 +<!-- <h5 class="lay-row-title">未读信息</h5>-->
  100 +<!-- <div class="pie-chart" id="chart-noRead-report"></div>-->
  101 + </div>
  102 + </div>
  103 + <div class="layui-card-body" style="margin-top: 10px;">
  104 + <div class="warn-btns">
  105 + <!--<button class="layui-btn layui-btn-sm layui-btn-normal" id="btn-workreport-set-read">
  106 + <i class="layui-icon">&#xe605;</i>勾选标记为已读
  107 + </button>
  108 + <button class="layui-btn layui-btn-sm layui-btn-normal" id="btn-workreport-set-all-read">
  109 + <i class="layui-icon">&#xe605;</i>全部标记为已读
  110 + </button>-->
  111 + <button class="layui-btn layui-btn-sm layui-btn-normal isRead active" data-type="">
  112 + 全部
  113 + </button>
  114 + <button class="layui-btn layui-btn-sm layui-btn-normal isRead" data-type="1">
  115 + 已读
  116 + </button>
  117 + <button class="layui-btn layui-btn-sm layui-btn-normal isRead" data-type="0">
  118 + 未读
  119 + </button>
  120 + </div>
  121 + <table id="table-workreport-view" lay-filter="table-workreport-view"></table>
  122 + </div>
  123 + </div>
  124 + </div>
  125 + </div>
  126 +</article>
  127 +<script>
  128 + layui.use('workReportView', function (fn) {
  129 + fn();
  130 + });
  131 +</script>