Authored by ww

chore: 宁夏需求;停机计划增加申请单;资源详情页增加日志插入接口;

@@ -3376,6 +3376,14 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele @@ -3376,6 +3376,14 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele
3376 "provider": res.provider, 3376 "provider": res.provider,
3377 "model": res.model 3377 "model": res.model
3378 }; 3378 };
  3379 + // 增加详情页接口-记录操作日志
  3380 + admin.req({
  3381 + url: common.domainName + `/api-web/inspectionReportRecord/add?resId=${resId}`,
  3382 + success:(res) =>{
  3383 +
  3384 + }
  3385 + });
  3386 +
3379 $.ajax({ 3387 $.ajax({
3380 url: common.domainName + "/api-web/favorites/checkResIsExist", 3388 url: common.domainName + "/api-web/favorites/checkResIsExist",
3381 async: false, 3389 async: false,
1 /** 采集协议基本信息 */ 1 /** 采集协议基本信息 */
2 -layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'view', 'laytpl', 'bustype', 'userlist', 'admin'], function (exports) { 2 +layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'view', 'setStep', 'laytpl', 'bustype', 'userlist', 'admin'], function (exports) {
3 var $ = layui.$; 3 var $ = layui.$;
4 var form = layui.form; 4 var form = layui.form;
5 var common = layui.common; 5 var common = layui.common;
@@ -8,6 +8,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie @@ -8,6 +8,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie
8 var view = layui.view; 8 var view = layui.view;
9 var laytpl = layui.laytpl; 9 var laytpl = layui.laytpl;
10 var admin = layui.admin; 10 var admin = layui.admin;
  11 + var setStep = layui.setStep;
11 //对外暴露的接口 12 //对外暴露的接口
12 exports('shutdownplanAdd', function (data) { 13 exports('shutdownplanAdd', function (data) {
13 var cutoverId = data.cutoverId; 14 var cutoverId = data.cutoverId;
@@ -29,8 +30,16 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie @@ -29,8 +30,16 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie
29 var userSelect; 30 var userSelect;
30 var acceptUserName = ''; 31 var acceptUserName = '';
31 32
32 - setTimeout(function () { 33 + new setStep({
  34 + content: '.stepCont-shutdownplan',
  35 + steps: ['1', '2'],
  36 + descriptionHeader: ['基本信息', '升级申请审批信息'],
  37 + showBtn: false,
  38 + pageCount: '.pageCont',
  39 + curStep: 1,//当前显示第几页
  40 + })
33 41
  42 + setTimeout(function () {
34 43
35 laydate.render({ 44 laydate.render({
36 elem: '#shutdownplanEditStartTime' 45 elem: '#shutdownplanEditStartTime'
@@ -41,6 +50,27 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie @@ -41,6 +50,27 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie
41 elem: '#shutdownplanEditEndTime' 50 elem: '#shutdownplanEditEndTime'
42 , type: 'datetime' 51 , type: 'datetime'
43 }); 52 });
  53 +
  54 + laydate.render({
  55 + elem: 'input[name="appDate"]'
  56 + , type: 'datetime'
  57 + });
  58 +
  59 +
  60 + admin.req({
  61 + url: domainName + '/inspection-report/file/document/list?id=63a5c772d6fb6c7dba6bd3d4d337315c&name=&types=&docIds=&checkAuth=true',
  62 + data: {},
  63 + success: function (res) {
  64 + if (res && res.success) {
  65 + let opt = '';
  66 + res.data.forEach(item => {
  67 + opt += `<option value="${item.id}">${item.fileName}</option>`
  68 + })
  69 + $('select[name="appDept"]').append(opt);
  70 + }
  71 + }
  72 + });
  73 +
44 admin.req({ 74 admin.req({
45 url: domainName + '/api-web/home/business/findAllBusType', 75 url: domainName + '/api-web/home/business/findAllBusType',
46 data: {'type': 'per'}, 76 data: {'type': 'per'},
@@ -223,8 +253,47 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie @@ -223,8 +253,47 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'vie
223 } 253 }
224 }, 0); 254 }, 0);
225 255
  256 + form.on('submit(verifyShutdownplanBtn)', function (data) {
  257 + $('#verifyShutdownplanBtn').attr('verify-result',true);
  258 +
  259 + document.querySelectorAll('#page2 input').forEach((e,i) => {
  260 + $(e).attr("lay-verify","required");
  261 + })
  262 +
  263 + // 获取业务名称
  264 + let arr = busIdSelect.getValue()
  265 +
  266 + // 系统名称:填写停机业务(会存在多个业务系统名称)
  267 + $('input[name="appName"]').val(arr.map(item => item.name).join(','));
  268 +
  269 +
  270 + // 申请日期:填写停机计划当天日期
  271 + let now = new Date();
  272 + let year = now.getFullYear(); // 获取年份
  273 + let month = now.getMonth() + 1; // 获取月份(注意,月份是从0开始计数的,所以需要加1)
  274 + let date = now.getDate(); // 获取日期
  275 + let hours = now.getHours(); // 获取小时
  276 + let minutes = now.getMinutes(); // 获取分钟
  277 + let seconds = now.getSeconds(); // 获取秒钟
  278 + $('input[name="appDate"]').val(`${year}-${month}-${date} ${hours}:${minutes}:${seconds}`);
  279 +
  280 + // 升级时间:计划升级开始止结束时间
  281 + $('input[name="upgradeStartTime"]').val($('#shutdownplanEditStartTime').val());
  282 + $('input[name="upgradeEndTime"]').val($('#shutdownplanEditEndTime').val());
  283 +
  284 + // 申请内容:填停机计划名称
  285 + $('input[name="appContent"]').val(data.field.cutoverName);
  286 +
  287 + });
  288 +
226 form.on('submit(saveshutdownplanBtn)', function (data) { 289 form.on('submit(saveshutdownplanBtn)', function (data) {
227 var bean = data.field; 290 var bean = data.field;
  291 +
  292 + delete bean['upgradeStartTime']
  293 + delete bean['upgradeEndTime']
  294 + delete bean['appName']
  295 + delete bean['upgradeEndTime']
  296 +
228 bean.acceptUserName = acceptUserName; 297 bean.acceptUserName = acceptUserName;
229 var loading = layer.load(2); 298 var loading = layer.load(2);
230 $.ajax({ 299 $.ajax({
@@ -261,13 +261,14 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', @@ -261,13 +261,14 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
261 return html 261 return html
262 } 262 }
263 }, { 263 }, {
264 - title: '操作', fixed: 'right', align: 'center', minWidth: 100, templet: function (d) { 264 + title: '操作', fixed: 'right', align: 'center', minWidth: 150, templet: function (d) {
265 var html = '<div><button shutdownplan-data-delete="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="删除"><i class="layui-icon layui-icon-delete"></i></button>'; 265 var html = '<div><button shutdownplan-data-delete="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="删除"><i class="layui-icon layui-icon-delete"></i></button>';
266 if (d.stopStatus == '2') { 266 if (d.stopStatus == '2') {
267 html += '<button shutdownplan-data-stop="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="暂停"><i class="layui-icon layui-icon-pause"></i></button>' 267 html += '<button shutdownplan-data-stop="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="暂停"><i class="layui-icon layui-icon-pause"></i></button>'
268 } else if (d.stopStatus == '3') { 268 } else if (d.stopStatus == '3') {
269 html += '<button shutdownplan-data-start="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="恢复"><i class="layui-icon layui-icon-play"></i></button>' 269 html += '<button shutdownplan-data-start="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="恢复"><i class="layui-icon layui-icon-play"></i></button>'
270 } 270 }
  271 + html += '<button shutdownplan-data-down="' + d.cutoverId + '" class="layui-btn layui-btn-normal layui-btn-xs" lay-tips="下载"><i class="layui-icon layui-icon-download-circle"></i></button>'
271 html += '</div>'; 272 html += '</div>';
272 return html 273 return html
273 } 274 }
@@ -294,6 +295,11 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', @@ -294,6 +295,11 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
294 $('[shutdownplan-data-delete]').on('click', function () { 295 $('[shutdownplan-data-delete]').on('click', function () {
295 deleteByIds($(this).attr("shutdownplan-data-delete")); 296 deleteByIds($(this).attr("shutdownplan-data-delete"));
296 }); 297 });
  298 + // 下载
  299 + $('[shutdownplan-data-down]').on('click', function () {
  300 + let id = $(this).attr("shutdownplan-data-down")
  301 + window.open(common.domainName + `/api-web/manage/cutover/docDownload?cutoverId=${id}&access_token=${accessToken}`);
  302 + });
297 $('[shutdownplan-data-res]').unbind('click').on('click', function () { 303 $('[shutdownplan-data-res]').unbind('click').on('click', function () {
298 var $that = $(this); 304 var $that = $(this);
299 var id = $that.attr("shutdownplan-data-res"); 305 var id = $that.attr("shutdownplan-data-res");
@@ -521,13 +527,13 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', @@ -521,13 +527,13 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
521 layer.open({ 527 layer.open({
522 id: 'shutdownplanEditHtml', 528 id: 'shutdownplanEditHtml',
523 content: laytpl(res.body).render(JSON.stringify(params)), 529 content: laytpl(res.body).render(JSON.stringify(params)),
524 - btn: ['保存', '取消'], 530 + //btn: ['保存', '取消'],
  531 + btn: ['下一步','上一步', '保存', '取消'],
525 title: `<a class="layui-icon layui-icon-edit win_title_icon"></a>停机计划`+titleName, 532 title: `<a class="layui-icon layui-icon-edit win_title_icon"></a>停机计划`+titleName,
526 type: '1', 533 type: '1',
527 resize: false, 534 resize: false,
528 - area: ['80%', '90%'], 535 + area: ['80%', '95%'],
529 success: function (indexm, layero) { 536 success: function (indexm, layero) {
530 - //start 停机模式从数据字典中获取 2022-05-24  
531 admin.req({ 537 admin.req({
532 url: common.domainName + '/api-web/manage/ddic/findSucDdics/shutdown_plan_mode' 538 url: common.domainName + '/api-web/manage/ddic/findSucDdics/shutdown_plan_mode'
533 , method: 'POST' 539 , method: 'POST'
@@ -545,10 +551,40 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', @@ -545,10 +551,40 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
545 }).error(function (error) { 551 }).error(function (error) {
546 console.error(error); 552 console.error(error);
547 }); 553 });
548 - //end lsq 2022-05-24 554 +
  555 + $('.layui-layer-btn1').hide();
  556 + $('.layui-layer-btn2').hide();
549 }, 557 },
550 yes: function (index, layero) { 558 yes: function (index, layero) {
  559 + // 下一步
  560 + $("#verifyShutdownplanBtn").trigger("click");
  561 + let result = $('#verifyShutdownplanBtn').attr('verify-result');
  562 + if(result && result === 'true'){
  563 + $(".ystep-container-steps").find("li:nth-child(2)").trigger("click")
  564 + $('.layui-layer-btn0').hide();
  565 + $('.layui-layer-btn1').show();
  566 + $('.layui-layer-btn2').show();
  567 + }
  568 + return false;
  569 +
  570 + },
  571 + btn2: function (index, layero) {
  572 + // 上一步
  573 + $(".ystep-container-steps").find("li:nth-child(1)").trigger("click")
  574 + $('.layui-layer-btn0').show();
  575 + $('.layui-layer-btn1').hide();
  576 + $('.layui-layer-btn2').hide();
  577 +
  578 + document.querySelectorAll('#page2 input').forEach((e,i) => {
  579 + $(e).attr("lay-verify","");
  580 + })
  581 + $('#verifyShutdownplanBtn').attr('verify-result',false);
  582 + return false;
  583 + },
  584 + btn3: function (index, layero) {
  585 + // 保存
551 $("#saveshutdownplanBtn").trigger("click"); 586 $("#saveshutdownplanBtn").trigger("click");
  587 + return false;
552 } 588 }
553 }) 589 })
554 }) 590 })
1 <article> 1 <article>
2 <div class="layui-card-body shutdownplan-base-area layui-form-pane" style="padding-top:0px;"> 2 <div class="layui-card-body shutdownplan-base-area layui-form-pane" style="padding-top:0px;">
3 - <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"> 3 + <form class="layui-form layui-form-pane" id="shutdownplanAddForm" lay-filter="shutdownplan-add-form"
  4 + onsubmit="return false" style="max-width: 90%;margin-left: 5%">
  5 +
  6 + <div class="stepCont stepCont-shutdownplan">
  7 + <!-- 菜单导航显示-->
  8 + <div class="inspection-add-title">
  9 + <div class='ystep-container ystep-lg ystep-blue'></div>
  10 + </div>
  11 + <!-- 分页容器-->
  12 + <div class="pageCont">
  13 + <!--step1-->
  14 + <div class="stepPage" id="page1">
  15 + <fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;">
4 <legend>基本信息</legend> 16 <legend>基本信息</legend>
5 </fieldset> 17 </fieldset>
6 - <form class="layui-form layui-form-pane" id="shutdownplanAddForm" lay-filter="shutdownplan-add-form"  
7 - onsubmit="return false" style="max-width: 90%;margin-top: 5px;margin-left: 5%"> 18 +
8 <input name="cutoverId" type="hidden"> 19 <input name="cutoverId" type="hidden">
9 <div class="layui-form-item"> 20 <div class="layui-form-item">
10 <label class="layui-form-label" style="min-width: 120px!important;">计划名称<span 21 <label class="layui-form-label" style="min-width: 120px!important;">计划名称<span
11 style="color: red">*</span></label> 22 style="color: red">*</span></label>
12 <div class="layui-inline"> 23 <div class="layui-inline">
13 <div class="layui-input-inline layui-input-inline--long"> 24 <div class="layui-input-inline layui-input-inline--long">
14 - <input autocomplete="off" class="layui-input" lay-verify="required" name="cutoverName" 25 + <input autocomplete="off" class="layui-input" lay-verify="required"
  26 + name="cutoverName"
15 placeholder="停机计划" type="text"> 27 placeholder="停机计划" type="text">
16 </div> 28 </div>
17 </div> 29 </div>
@@ -23,21 +35,24 @@ @@ -23,21 +35,24 @@
23 style="color: red">*</span></label> 35 style="color: red">*</span></label>
24 <div class="layui-inline"> 36 <div class="layui-inline">
25 <div class="layui-input-inline layui-input-inline--long"> 37 <div class="layui-input-inline layui-input-inline--long">
26 - <input class="layui-input" id="shutdownplanEditStartTime" lay-verify="required" name="startTime" 38 + <input class="layui-input" id="shutdownplanEditStartTime" lay-verify="required"
  39 + name="startTime"
27 placeholder="开始时间" readonly="readonly" type="text"> 40 placeholder="开始时间" readonly="readonly" type="text">
28 </div> 41 </div>
29 </div> 42 </div>
30 <div class="layui-inline layui-inline--sm">-</div> 43 <div class="layui-inline layui-inline--sm">-</div>
31 <div class="layui-inline"> 44 <div class="layui-inline">
32 <div class="layui-input-inline layui-input-inline--long"> 45 <div class="layui-input-inline layui-input-inline--long">
33 - <input class="layui-input" id="shutdownplanEditEndTime" lay-verify="required" name="endTime" 46 + <input class="layui-input" id="shutdownplanEditEndTime" lay-verify="required"
  47 + name="endTime"
34 placeholder="结束时间" readonly="readonly" type="text"> 48 placeholder="结束时间" readonly="readonly" type="text">
35 </div> 49 </div>
36 </div> 50 </div>
37 </div> 51 </div>
38 </div> 52 </div>
39 <div class="layui-form-item"> 53 <div class="layui-form-item">
40 - <label class="layui-form-label" style="min-width: 120px!important;max-width: 120px!important;">停机模式<span 54 + <label class="layui-form-label"
  55 + style="min-width: 120px!important;max-width: 120px!important;">停机模式<span
41 style="color: red">*</span></label> 56 style="color: red">*</span></label>
42 <div class="layui-input-block" id="shutdownDdic"> 57 <div class="layui-input-block" id="shutdownDdic">
43 </div> 58 </div>
@@ -56,7 +71,8 @@ @@ -56,7 +71,8 @@
56 style="min-width: 120px!important;max-width: 120px!important;">停机资源<span 71 style="min-width: 120px!important;max-width: 120px!important;">停机资源<span
57 style="color: red">*</span></label> 72 style="color: red">*</span></label>
58 <div class="layui-input-inline"> 73 <div class="layui-input-inline">
59 - <div class="xm-select-demo" id="shutdown_plan_add_res" lay-tips="停机资源必须是停机业务下的资源"></div> 74 + <div class="xm-select-demo" id="shutdown_plan_add_res"
  75 + lay-tips="停机资源必须是停机业务下的资源"></div>
60 </div> 76 </div>
61 </div> 77 </div>
62 </div> 78 </div>
@@ -89,12 +105,106 @@ @@ -89,12 +105,106 @@
89 <div class="layui-form-item" style="display: flex;"> 105 <div class="layui-form-item" style="display: flex;">
90 <label class="layui-form-label textarea-label" 106 <label class="layui-form-label textarea-label"
91 style="min-width: 120px!important;max-width: 120px!important;">描述:</label> 107 style="min-width: 120px!important;max-width: 120px!important;">描述:</label>
92 - <div class="layui-input-block" style="width: calc(100% - 120px)!important;margin-left: 0px!important;"> 108 + <div class="layui-input-block"
  109 + style="width: calc(100% - 120px)!important;margin-left: 0px!important;">
93 <textarea class="layui-textarea" name="cutoverDesc"></textarea> 110 <textarea class="layui-textarea" name="cutoverDesc"></textarea>
94 </div> 111 </div>
95 </div> 112 </div>
96 - <button id="saveshutdownplanBtn" lay-filter="saveshutdownplanBtn" lay-submit style="display: none"  
97 - type="submit">提交 113 + </div>
  114 +
  115 + <!--step2-->
  116 + <div class="stepPage" id="page2">
  117 +
  118 + <fieldset class="layui-elem-field layui-field-title" style="margin-top: 0px;">
  119 + <legend>升级申请审批信息</legend>
  120 + </fieldset>
  121 +
  122 + <div class="layui-form-item" style="display: flex">
  123 + <label class="layui-form-label" style="min-width: 120px!important;">申请单位<span
  124 + style="color: red">*</span></label>
  125 + <div class="layui-inline" style="min-width: calc(100% - 120px)!important;">
  126 + <select name="appDept">
  127 + </select>
  128 + </div>
  129 + </div>
  130 +
  131 + <div class="layui-form-item" style="display: flex">
  132 + <label class="layui-form-label" style="min-width: 120px!important;">
  133 + 申请人<span style="color: red">*</span>
  134 + </label>
  135 + <div class="layui-inline" style="min-width: calc(100% - 120px)!important;">
  136 + <input autocomplete="off" class="layui-input" name="appUser" placeholder="申请人" type="text">
  137 + </div>
  138 + </div>
  139 +
  140 + <div class="layui-form-item" style="display: flex">
  141 + <label class="layui-form-label" style="min-width: 120px!important;">
  142 + 联系电话<span style="color: red">*</span>
  143 + </label>
  144 + <div class="layui-inline" style="min-width: calc(100% - 120px)!important;">
  145 + <input autocomplete="off" class="layui-input" name="appPhone" placeholder="联系电话" type="text">
  146 + </div>
  147 + </div>
  148 +
  149 + <div class="layui-form-item" style="display: flex;">
  150 + <label class="layui-form-label" style="min-width: 120px!important;">版本号<span
  151 + style="color: red">*</span></label>
  152 + <div class="layui-inline" style="width: calc(100% - 120px)!important;margin-left: 0px!important;">
  153 + <input autocomplete="off" class="layui-input" name="appVersion" placeholder="版本号" type="text">
  154 + </div>
  155 + </div>
  156 +
  157 + <div class="layui-form-item" style="display: flex;">
  158 + <label class="layui-form-label" style="min-width: 120px!important;">系统名称</label>
  159 + <div class="layui-inline" style="min-width: calc(100% - 120px)!important;">
  160 + <input autocomplete="off" class="layui-input" name="appName" readonly="readonly" placeholder="系统名称" type="text">
  161 + </div>
  162 + </div>
  163 +
  164 + <div class="layui-form-item" style="display: flex;">
  165 + <label class="layui-form-label" style="min-width: 120px!important;">申请日期:</label>
  166 + <div class="layui-inline" style="min-width: calc(100% - 120px)!important;">
  167 + <input autocomplete="off" class="layui-input" name="appDate" readonly="readonly" placeholder="申请日期" type="text">
  168 + </div>
  169 + </div>
  170 +
  171 +
  172 + <div class="layui-form-item">
  173 + <div class="layui-inline">
  174 + <label class="layui-form-label"
  175 + style="min-width: 120px!important;max-width: 120px!important;">升级日期:</label>
  176 + <div class="layui-inline">
  177 + <div class="layui-input-inline layui-input-inline--long">
  178 + <input class="layui-input" id="upgradeStartTime" name="upgradeStartTime"
  179 + placeholder="开始时间" readonly="readonly" type="text">
  180 + </div>
  181 + </div>
  182 + <div class="layui-inline layui-inline--sm">-</div>
  183 + <div class="layui-inline">
  184 + <div class="layui-input-inline layui-input-inline--long">
  185 + <input class="layui-input" id="upgradeEndTime" name="upgradeEndTime"
  186 + placeholder="结束时间" readonly="readonly" type="text">
  187 + </div>
  188 + </div>
  189 + </div>
  190 + </div>
  191 +
  192 + <div class="layui-form-item" style="display: flex;">
  193 + <label class="layui-form-label" style="min-width: 120px!important;">申请内容:</label>
  194 + <div class="layui-inline" style="min-width: calc(100% - 120px)!important;">
  195 + <input autocomplete="off" class="layui-input" name="appContent" readonly="readonly" placeholder="申请内容" type="text">
  196 + </div>
  197 + </div>
  198 + </div>
  199 + </div>
  200 + </div>
  201 +
  202 + <button id="saveshutdownplanBtn" lay-filter="saveshutdownplanBtn" lay-submit style="display: none" type="submit">
  203 + 提交
  204 + </button>
  205 +
  206 + <button id="verifyShutdownplanBtn" lay-filter="verifyShutdownplanBtn" lay-submit style="display: none" type="submit">
  207 + 验证
98 </button> 208 </button>
99 </form> 209 </form>
100 </div> 210 </div>
  1 +<title>运维单位巡检配置</title>
  2 +<iframe class="layadmin-iframe" src="/vue3/index.html#/inspectionConfig" style="height: 99.5%!important;"/>
  3 +
  4 +
@@ -264,3 +264,56 @@ custom-class="config-dialog" @@ -264,3 +264,56 @@ custom-class="config-dialog"
264 width: 10px; 264 width: 10px;
265 . el-scrollbar__bar . is-horizontal > div 265 . el-scrollbar__bar . is-horizontal > div
266 } 266 }
  267 +
  268 +
  269 +/*最外层样式*/
  270 +.container {
  271 +
  272 +}
  273 +
  274 +.container .cm-card,.container-fluid .cm-card {
  275 + overflow-y: auto;
  276 + border-radius: 3px;
  277 +}
  278 +
  279 +.container .cm-card .search,.container-fluid .cm-card .search {
  280 + padding: 6px 10px;
  281 + display: flex;
  282 +}
  283 +
  284 +.container .cm-page-top-nav,.container-fluid.cm-page-top-nav{
  285 + display: flex;
  286 + justify-content: space-between;
  287 + margin-bottom: 5px;
  288 + margin-top: 5px;
  289 + border-radius: 2px;
  290 + padding-top: 10px;
  291 + height: 45px;
  292 + padding-left: 5px;
  293 +}
  294 +
  295 +.container .cm-card .cm-page-body,.container-fluid .cm-card .cm-page-body {
  296 + height: calc(100% - 5px);
  297 +}
  298 +
  299 +.container .cm-page-top-nav > div:nth-child(2),.container-fluid.cm-page-top-nav > div:nth-child(2){
  300 + margin-right:76px!important;
  301 +}
  302 +
  303 +.container .cm-page-table-nav,.container-fluid.cm-page-table-nav{
  304 + padding-top: 10px;
  305 + padding-bottom: 10px;
  306 + text-align: left;
  307 + padding-left: 10px;
  308 +}
  309 +
  310 +.container .search-form .el-form-item,.container-fluid .search-form .el-form-item{
  311 + margin: 0px;
  312 + padding: 0px;
  313 + margin-right: 5px;
  314 +}
  315 +
  316 +/*搜索框*/
  317 +.keyword-input{
  318 + width: 240px!important;
  319 +}
  1 +<div :style="{'height':height+'px','max-height':height+'px'}" :class="isFluid ? 'container-fluid' : 'container'">
  2 + <div :style="{'min-height':height+'px','max-height':height+'px','height':'100%'}" class="cm-card">
  3 + <div class="cm-page-top-nav" v-if="showNav">
  4 + <div>
  5 + <slot name="search"></slot>
  6 + </div>
  7 + <div>
  8 + <slot name="btns"></slot>
  9 + </div>
  10 + </div>
  11 + <div v-if="showBodySplit && showNav === false" style="border-top: solid 5px var(--page-el-bg-color)!important;"></div>
  12 + <div class="cm-page-body">
  13 + <slot></slot>
  14 + </div>
  15 + </div>
  16 +</div>
  17 +
  1 +export default {
  2 + name: 'pageIndex',
  3 + template: '',
  4 + components: {},
  5 + props: {
  6 + // 是否全屏
  7 + isFluid: {
  8 + type: Boolean,
  9 + default: false
  10 + },
  11 + showNav:{
  12 + type: Boolean,
  13 + default: false
  14 + },
  15 + showBodySplit:{
  16 + type: Boolean,
  17 + default: false
  18 + }
  19 + },
  20 + setup(props, {attrs, slots, emit}) {
  21 + const {proxy} = Vue.getCurrentInstance();
  22 + let height = Vue.ref(window.innerHeight - 10);
  23 +
  24 + return {
  25 + height
  26 + }
  27 + }
  28 +
  29 +}
@@ -54,6 +54,8 @@ Promise.all([ @@ -54,6 +54,8 @@ Promise.all([
54 .component('cm-user-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputusertree/index'))) 54 .component('cm-user-type-tree-input', Vue.defineAsyncComponent(() => myImport('components/common/inputusertree/index')))
55 //菜单下拉树 55 //菜单下拉树
56 .component('cm-tree-select-menu', Vue.defineAsyncComponent(() => myImport('components/common/treeSelectMenu/index'))) 56 .component('cm-tree-select-menu', Vue.defineAsyncComponent(() => myImport('components/common/treeSelectMenu/index')))
  57 + // cm-page
  58 + .component('cm-page', Vue.defineAsyncComponent(() => myImport('components/common/page/index')))
57 //机构用户下拉树 59 //机构用户下拉树
58 .component('cm-tree-select-org-user', Vue.defineAsyncComponent(() => myImport('components/common/treeSelectOrgUser/index'))); 60 .component('cm-tree-select-org-user', Vue.defineAsyncComponent(() => myImport('components/common/treeSelectOrgUser/index')));
59 61
@@ -296,6 +296,12 @@ const routes = [{ @@ -296,6 +296,12 @@ const routes = [{
296 path: '/vue3/x6/index', 296 path: '/vue3/x6/index',
297 name: 'operationLogUserList', 297 name: 'operationLogUserList',
298 component: () => myImport('views/x6/index') 298 component: () => myImport('views/x6/index')
  299 + },
  300 + // 运维单位系统巡检记录报表功能
  301 + {
  302 + path: '/inspectionConfig',
  303 + name: 'inspectionConfig',
  304 + component: () => myImport('views/inspectionConfig/index')
299 } 305 }
300 ]; 306 ];
301 307
  1 +<cm-page :showNav="true">
  2 + <template #search>
  3 + <el-form class="search-form" ref="form" :model="queryParams" label-width="80px" :inline="true">
  4 + <el-form-item>
  5 + <el-select v-model="queryParams.type" placeholder="请选巡检类型">
  6 + <el-option v-for="(item,index) in typeArr" :label="item.label" :value="item.value"></el-option>
  7 + </el-select>
  8 + </el-form-item>
  9 + </el-form>
  10 + </template>
  11 + <template #btns>
  12 + <el-button type="primary" size="mini" @click="getList">搜索</el-button>
  13 + </template>
  14 +
  15 + <template #default>
  16 + <div class="cm-page-table-nav">
  17 + <el-button type="primary" size="small" @click="addModel">新增</el-button>
  18 + <el-button size="small" @click="deleteByIds" :disabled="multiple">批量删除</el-button>
  19 + </div>
  20 + <cm-table-page :columns="tableData.columns" :dataList="tableData.dataList"
  21 + :height="height - 163"
  22 + :loading="false"
  23 + :pageSize="queryParams.pageSize"
  24 + :showBorder="false"
  25 + :showIndex="false"
  26 + :showPage="true"
  27 + :showSelection="true"
  28 + :showTools="true"
  29 + :total="count"
  30 + :toolsWith="100"
  31 + @selectionChange="selectionChange"
  32 + @loaddata="refreshList">
  33 + <template #default="{row,prop,column}">
  34 + <div v-if="prop=='type'">
  35 + {{ getTypeLabel(row) }}
  36 + </div>
  37 + </template>
  38 + <template #tools="{scope}">
  39 + <div class="list-handle">
  40 + <span class="btn-link" @click="editModel(scope.row)">编辑</span>
  41 + <span class="btn-link" @click="deleteByIds(scope.row)">删除</span>
  42 + </div>
  43 + </template>
  44 + </cm-table-page>
  45 +
  46 + <cm-dialog :showDialogVisible="showDialog" :showFooter="true" :title="title" okText="保存" @hidedialog="closeDialog" @okfunc="saveConfig"
  47 + width="80%">
  48 + <template v-slot>
  49 + <el-form ref="formRef" :model="formParams" label-width="100px" style="display: flex" v-if="formParams.id === -1">
  50 + <el-form-item label="时间范围" prop="timeRange" :rules="[{required: true,message: '请选择日期',trigger: 'blur'}]">
  51 + <el-date-picker
  52 + v-model="formParams.timeRange"
  53 + type="datetimerange"
  54 + format="YYYY-MM-DD"
  55 + value-format="YYYY-MM-DD"
  56 + range-separator="至"
  57 + start-placeholder="开始时间"
  58 + end-placeholder="结束时间"/>
  59 + </el-form-item>
  60 +
  61 + <el-form-item label="巡检类型" prop="type" :rules="[{required: true,message: '请选择巡检类型',trigger: 'change',}]">
  62 + <el-select v-model="formParams.type" placeholder="请选择巡检类型" style="width: 100%" @change="typeChange">
  63 + <el-option v-for="(item,index) in typeArr" :label="item.label" :value="item.value"></el-option>
  64 + </el-select>
  65 + </el-form-item>
  66 + <el-button style="margin-left: 10px" type="primary" size="mini" @click="addConfig">添加</el-button>
  67 + </el-form>
  68 +
  69 + <div style="border-radius: 10px;padding: 5px;">
  70 + <div style="text-align: left;padding-left: 10px">
  71 + 配置列表
  72 + </div>
  73 + <el-form ref="configFormRef" label-width="100px" >
  74 + <div v-if="configArr.length == 0">
  75 + 暂无配置!
  76 + </div>
  77 + <div v-else v-for="(item,index) in configArr" style="border: 1px solid rgb(244, 235, 235);padding: 10px 5px;margin: 2px;border-radius: 5px;box-shadow: 1px 1px 5px -1px;">
  78 + <div style="display: flex;flex-direction: row;width: 100%;height: 40px;">
  79 + <el-form-item style="width: 25%;padding: 0px 10px" label="年份" prop="year" >
  80 + <el-input type="number" v-model="item.year" placeholder="年份"></el-input>
  81 + </el-form-item>
  82 + <el-form-item style="width: 25%;padding: 0px 10px" label="月份" prop="month" >
  83 + <el-input type="number" v-model="item.month" placeholder="月份"></el-input>
  84 + </el-form-item>
  85 + <el-form-item style="width: 25%;padding: 0px 10px" label="类型" prop="item.type" >
  86 + <el-select v-model="item.type" placeholder="请选巡检类型" @change="typeChange(item)">
  87 + <el-option v-for="(item,index) in typeArr" :label="item.label" :value="item.value"></el-option>
  88 + </el-select>
  89 + </el-form-item>
  90 + <el-form-item style="width: 25%;padding: 0px 10px" label="巡检次数" prop="item.number">
  91 + <el-input v-model="item.number" placeholder="巡检次数"></el-input>
  92 + </el-form-item>
  93 + </div>
  94 + <div style="display: flex;flex-direction: row;width: 100%;height: 40px;">
  95 + <el-form-item style="width: calc((100% - 100px)/2);padding: 0px 10px" label="日期" prop="item.days">
  96 + <el-input v-model="item.days" placeholder="日期"></el-input>
  97 + </el-form-item>
  98 + <el-form-item style="width: calc((100% - 100px)/2);padding: 0px 10px" label="巡检周期" prop="item.times" >
  99 + <el-input v-model="item.times" placeholder="巡检周期"></el-input>
  100 + </el-form-item>
  101 + <el-button v-if="formParams.id === -1" style="margin-left: 10px;width: 100px" type="danger" size="mini" @click="deleteConfig(item,index)">删除</el-button>
  102 + </div>
  103 + </div>
  104 + </el-form>
  105 + </div>
  106 + </template>
  107 + </cm-dialog>
  108 + </template>
  109 +</cm-page>
  1 +import global from "../../../src/script/global.js";
  2 +
  3 +export default {
  4 + name: "algorithm",
  5 + template: "",
  6 + props: {},
  7 + setup() {
  8 + let height = Vue.ref(window.innerHeight);
  9 + const {proxy} = Vue.getCurrentInstance();
  10 +
  11 + let queryParams = Vue.ref({
  12 + type: '',
  13 + pageNum: 1,
  14 + pageSize: 20,
  15 + });
  16 + let count = Vue.ref(0);
  17 + let multiple = Vue.ref(true);
  18 + let ids = [];
  19 +
  20 + let typeArr = [
  21 + {label: '征期', value: 0, number: 4, times: '7:00-9:30,9:30-13:00,13:00-15:30,15:30-18:00'},
  22 + {label: '非征期', value: 1, number: 2, times: '7:00-13:00,13:00-18:00'},
  23 + {label: '节假日', value: 2, number: 1, times: '7:00-18:00'},
  24 + ];
  25 +
  26 + let tableData = Vue.ref({
  27 + dataList: [],
  28 + columns: [
  29 + {
  30 + prop: 'year',
  31 + label: '年份',
  32 + align: 'center',
  33 + }, {
  34 + prop: 'month',
  35 + label: '月份',
  36 + align: 'center',
  37 + }, {
  38 + prop: 'days',
  39 + label: '日期',
  40 + align: 'center',
  41 + width:300
  42 + }, {
  43 + prop: 'times',
  44 + label: '巡检时间',
  45 + align: 'center',
  46 + width:300
  47 + }, {
  48 + prop: 'type',
  49 + label: '巡检类型',
  50 + align: 'center'
  51 + }, {
  52 + prop: 'number',
  53 + label: '巡检次数',
  54 + align: 'center',
  55 + }, {
  56 + prop: 'createBy',
  57 + label: '创建人',
  58 + align: 'center',
  59 + }, {
  60 + prop: 'createTime',
  61 + label: '创建时间',
  62 + align: 'center',
  63 + width:180
  64 + }
  65 + ]
  66 + })
  67 + let showDialog = Vue.ref(false);
  68 + let title = Vue.ref('新增');
  69 + let formParams = Vue.ref({
  70 + timeRange: '',
  71 + type: '',
  72 + number: 0,
  73 + times: ''
  74 + });
  75 + /**
  76 + * year: '',
  77 + * month: '',
  78 + * days: '',
  79 + * times: '',
  80 + * type: '',
  81 + * number: ''
  82 + */
  83 + let configArr = Vue.ref([])
  84 + let formRef = Vue.ref();
  85 + let configFormRef = Vue.ref();
  86 +
  87 + /**
  88 + * 加载列表
  89 + */
  90 + const getList = () => {
  91 + proxy.$http.get( '/api-web/inspectionExcelConfig/list', queryParams.value,res => {
  92 + if(res && res.success){
  93 + count.value = res.count;
  94 + tableData.value.dataList = res.data;
  95 + }
  96 + })
  97 + }
  98 +
  99 + /**
  100 + * 多选
  101 + * @param params
  102 + */
  103 + const selectionChange = (params) => {
  104 + multiple.value = !params.length;
  105 + ids = params.map(item => item.id);
  106 + }
  107 +
  108 + /**
  109 + * 刷新表格数据
  110 + * @param page
  111 + * @param limit
  112 + */
  113 + const refreshList = ({page, limit}) => {
  114 + queryParams.value.pageNum = page;
  115 + queryParams.value.pageSize = limit;
  116 + }
  117 +
  118 +
  119 + /**
  120 + * 新增弹框
  121 + */
  122 + const addModel = () => {
  123 + showDialog.value = true;
  124 + formParams.value = {
  125 + timeRange: '',
  126 + type: '',
  127 + number: 0,
  128 + times: '',
  129 + id:-1
  130 + };
  131 + configArr.value = [];
  132 + }
  133 +
  134 + /**
  135 + * 关闭弹框
  136 + */
  137 + const closeDialog = () => {
  138 + showDialog.value = false;
  139 + }
  140 +
  141 + /**
  142 + * 保存
  143 + */
  144 + const saveConfig = () => {
  145 + let arr = configArr.value;
  146 + if(arr.length > 0){
  147 + let url = '/api-web/inspectionExcelConfig/update';
  148 + if(formParams.value.id === -1){
  149 + url = '/api-web/inspectionExcelConfig/add';
  150 + }
  151 + proxy.$http.post(url,arr,res => {
  152 + if(res && res.success){
  153 + global.showMsg("操作成功!", "success");
  154 + closeDialog();
  155 + getList();
  156 + }
  157 + });
  158 + }
  159 + }
  160 +
  161 + /**
  162 + * 查看详情
  163 + * @param row
  164 + */
  165 + const editModel = (row) => {
  166 + title.value = '编辑'
  167 + showDialog.value = true;
  168 + formParams.value.id = row.id;
  169 + proxy.$http.get('/api-web/inspectionExcelConfig/info', {id:row.id},res => {
  170 + configArr.value = [res.object]
  171 + });
  172 + }
  173 +
  174 + /**
  175 + * 批量删除
  176 + * @param row
  177 + */
  178 + const deleteByIds = (row) => {
  179 + let id = ids;
  180 + if(multiple.value){
  181 + id = [row.id];
  182 + }
  183 +
  184 + if (!id) {
  185 + global.showMsg("请选择要删除的数据!", "warning");
  186 + return;
  187 + }
  188 +
  189 + global.confirm("确认删除吗?", function () {
  190 + proxy.$http.get('/api-web/inspectionExcelConfig/delete?idList=' + id.join(','), {},(res) => {
  191 + if (res.success) {
  192 + global.showMsg("删除成功", "success");
  193 + closeDialog()
  194 + getList();
  195 + } else {
  196 + global.showMsg("删除失败", "error");
  197 + }
  198 + })
  199 + })
  200 + }
  201 +
  202 +
  203 + const typeChange = (val) => {
  204 + if(typeof val === 'object'){
  205 + let typeInfo = typeArr.find(e => e.value == val.type);
  206 + val.number = typeInfo.number
  207 + val.times = typeInfo.times
  208 + return;
  209 + }
  210 + let typeInfo = typeArr.find(e => e.value == val);
  211 + formParams.value.number = typeInfo.number
  212 + formParams.value.times = typeInfo.times
  213 + }
  214 +
  215 + const addConfig = () => {
  216 + formRef.value.validate((valid) => {
  217 + let data = formParams.value;
  218 + let arr = data.timeRange;
  219 + let startDate = new Date(arr[0]);
  220 + let endDate = new Date(arr[1]);
  221 +
  222 + var currentDate = new Date(startDate);
  223 + while (currentDate <= endDate) {
  224 + let year = dayjs(new Date(currentDate)).format('YYYY');
  225 + let month = dayjs(new Date(currentDate)).format('MM');
  226 + let day = dayjs(new Date(currentDate)).format('DD');
  227 +
  228 + let isAdd = configArr.value.find((e, i) => e.days.indexOf(day) !== -1);
  229 + if (isAdd) {
  230 + proxy.$global.showMsg("当前时间范围内存在多种巡检类型!", "warning");
  231 + return;
  232 + }
  233 +
  234 + let current = configArr.value.find((e, i) => e.year === year && e.month === month && data.type === e.type);
  235 + if (current) {
  236 + if (current.days.indexOf(day) === -1) {
  237 + current.days = current.days + "," + day;
  238 + }
  239 + } else {
  240 + configArr.value.push({
  241 + year: year,
  242 + month: month,
  243 + days: day,
  244 + times: data.times,
  245 + type: data.type,
  246 + number: data.number
  247 + })
  248 + }
  249 + currentDate.setDate(currentDate.getDate() + 1);
  250 + }
  251 + formRef.value.resetFields();
  252 + formParams.value = {
  253 + id:-1
  254 + }
  255 + })
  256 + }
  257 +
  258 + const deleteConfig = (item, index) => {
  259 + configArr.value.splice(index, 1);
  260 + }
  261 +
  262 + const getTypeLabel = (row) => {
  263 + let typeInfo = typeArr.find(e => e.value == row.type);
  264 + if(typeInfo){
  265 + return typeInfo.label;
  266 + }
  267 + return '';
  268 + }
  269 +
  270 +
  271 + Vue.onMounted(() => {
  272 + getList();
  273 + })
  274 +
  275 + return {
  276 + height,
  277 + // 搜索条件
  278 + typeArr, queryParams,
  279 + // 表格
  280 + tableData, count, refreshList, selectionChange, multiple, getList, editModel,
  281 +
  282 + deleteByIds,
  283 + title, addModel, showDialog, closeDialog, saveConfig,
  284 +
  285 + formRef, formParams, configArr, typeChange, addConfig, deleteConfig,
  286 +
  287 + configFormRef,
  288 + getTypeLabel
  289 + }
  290 + }
  291 +}