New file |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.zy.asrs.service.CommandInfoLogService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class CommandInfoLogController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CommandInfoLogService commandInfoLogService; |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(commandInfoLogService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<CommandInfoLog> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(commandInfoLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(CommandInfoLog commandInfoLog) { |
| | | commandInfoLogService.insert(commandInfoLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(CommandInfoLog commandInfoLog){ |
| | | if (Cools.isEmpty(commandInfoLog) || null==commandInfoLog.getId()){ |
| | | return R.error(); |
| | | } |
| | | commandInfoLogService.updateById(commandInfoLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | commandInfoLogService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<CommandInfoLog> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("commandInfoLog")); |
| | | convert(map, wrapper); |
| | | List<CommandInfoLog> list = commandInfoLogService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<CommandInfoLog> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<CommandInfoLog> page = commandInfoLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (CommandInfoLog commandInfoLog : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", commandInfoLog.getId()); |
| | | map.put("value", commandInfoLog.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/commandInfoLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<CommandInfoLog> wrapper = new EntityWrapper<CommandInfoLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != commandInfoLogService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(CommandInfoLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("wcs_command_info_log") |
| | | public class CommandInfoLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 工作号 |
| | | */ |
| | | @ApiModelProperty(value= "工作号") |
| | | @TableField("wrk_no") |
| | | private Integer wrkNo; |
| | | |
| | | /** |
| | | * 起点位置 |
| | | */ |
| | | @ApiModelProperty(value= "起点位置") |
| | | @TableField("start_pos") |
| | | private String startPos; |
| | | |
| | | /** |
| | | * 终点位置 |
| | | */ |
| | | @ApiModelProperty(value= "终点位置") |
| | | @TableField("end_pos") |
| | | private String endPos; |
| | | |
| | | /** |
| | | * 指令状态 1: 创建 2: 执行 3: 完成 |
| | | */ |
| | | @ApiModelProperty(value= "指令状态 1: 创建 2: 执行 3: 完成 ") |
| | | @TableField("command_status") |
| | | private Integer commandStatus; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value= "创建时间") |
| | | @TableField("start_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date startTime; |
| | | |
| | | /** |
| | | * 指令类型 |
| | | */ |
| | | @ApiModelProperty(value= "指令类型") |
| | | @TableField("command_type") |
| | | private Integer commandType; |
| | | |
| | | /** |
| | | * 设备 |
| | | */ |
| | | @ApiModelProperty(value= "设备") |
| | | private String device; |
| | | |
| | | /** |
| | | * 设备执行信息 |
| | | */ |
| | | @ApiModelProperty(value= "设备执行信息") |
| | | @TableField("device_log") |
| | | private String deviceLog; |
| | | |
| | | /** |
| | | * 命令描述 |
| | | */ |
| | | @ApiModelProperty(value= "命令描述") |
| | | @TableField("command_desc") |
| | | private String commandDesc; |
| | | |
| | | /** |
| | | * 命令JSON |
| | | */ |
| | | @ApiModelProperty(value= "命令JSON") |
| | | private String command; |
| | | |
| | | /** |
| | | * 任务号 |
| | | */ |
| | | @ApiModelProperty(value= "任务号") |
| | | @TableField("task_no") |
| | | private String taskNo; |
| | | |
| | | /** |
| | | * 执行时间 |
| | | */ |
| | | @ApiModelProperty(value= "执行时间") |
| | | @TableField("execute_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date executeTime; |
| | | |
| | | /** |
| | | * 完成时间 |
| | | */ |
| | | @ApiModelProperty(value= "完成时间") |
| | | @TableField("complete_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date completeTime; |
| | | |
| | | public CommandInfoLog() {} |
| | | |
| | | public CommandInfoLog(Integer wrkNo,String startPos,String endPos,Integer commandStatus,Date startTime,Integer commandType,String device,String deviceLog,String commandDesc,String command,String taskNo,Date executeTime,Date completeTime) { |
| | | this.wrkNo = wrkNo; |
| | | this.startPos = startPos; |
| | | this.endPos = endPos; |
| | | this.commandStatus = commandStatus; |
| | | this.startTime = startTime; |
| | | this.commandType = commandType; |
| | | this.device = device; |
| | | this.deviceLog = deviceLog; |
| | | this.commandDesc = commandDesc; |
| | | this.command = command; |
| | | this.taskNo = taskNo; |
| | | this.executeTime = executeTime; |
| | | this.completeTime = completeTime; |
| | | } |
| | | |
| | | // CommandInfoLog commandInfoLog = new CommandInfoLog( |
| | | // null, // 工作号 |
| | | // null, // 起点位置 |
| | | // null, // 终点位置 |
| | | // null, // 指令状态 |
| | | // null, // 创建时间 |
| | | // null, // 指令类型 |
| | | // null, // 设备 |
| | | // null, // 设备执行信息 |
| | | // null, // 命令描述 |
| | | // null, // 命令JSON |
| | | // null, // 任务号 |
| | | // null, // 执行时间 |
| | | // null // 完成时间 |
| | | // ); |
| | | |
| | | public String getCommandStatus$(){ |
| | | if (null == this.commandStatus){ return null; } |
| | | switch (this.commandStatus){ |
| | | case 1: |
| | | return "创建"; |
| | | case 2: |
| | | return "执行"; |
| | | case 3: |
| | | return "完成"; |
| | | default: |
| | | return String.valueOf(this.commandStatus); |
| | | } |
| | | } |
| | | |
| | | public String getStartTime$(){ |
| | | if (Cools.isEmpty(this.startTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.startTime); |
| | | } |
| | | |
| | | public String getExecuteTime$(){ |
| | | if (Cools.isEmpty(this.executeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.executeTime); |
| | | } |
| | | |
| | | public String getCompleteTime$(){ |
| | | if (Cools.isEmpty(this.completeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.completeTime); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface CommandInfoLogMapper extends BaseMapper<CommandInfoLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface CommandInfoLogService extends IService<CommandInfoLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.mapper.CommandInfoLogMapper; |
| | | import com.zy.asrs.entity.CommandInfoLog; |
| | | import com.zy.asrs.service.CommandInfoLogService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("commandInfoLogService") |
| | | public class CommandInfoLogServiceImpl extends ServiceImpl<CommandInfoLogMapper, CommandInfoLog> implements CommandInfoLogService { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.mapper.CommandInfoLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.CommandInfoLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="wrk_no" property="wrkNo" /> |
| | | <result column="start_pos" property="startPos" /> |
| | | <result column="end_pos" property="endPos" /> |
| | | <result column="command_status" property="commandStatus" /> |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="command_type" property="commandType" /> |
| | | <result column="device" property="device" /> |
| | | <result column="device_log" property="deviceLog" /> |
| | | <result column="command_desc" property="commandDesc" /> |
| | | <result column="command" property="command" /> |
| | | <result column="task_no" property="taskNo" /> |
| | | <result column="execute_time" property="executeTime" /> |
| | | <result column="complete_time" property="completeTime" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | </el-dropdown> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="id" label="指令编号"> |
| | | <el-table-column property="id" label="#ID"> |
| | | </el-table-column> |
| | | <el-table-column property="wrkNo" label="工作号"> |
| | | </el-table-column> |
| | |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | handleCommand(command, row) { |
| | | switch (command) { |
| | | case "showTask": |
| | | //查看任务 |
| | | this.showTask(row) |
| | | break; |
| | | case "executeCommand": |
| | | //执行指令 |
| | | this.executeCommand(row) |
| | | break; |
| | | case "completeCommand": |
| | | //完成指令 |
| | | this.completeCommand(row) |
| | | break; |
| | | } |
| | | }, |
| | | showTask(row) { |
| | | //查看任务 |
| | | $layui.layer.open({ |
| | | type: 2, |
| | | title: '任务管理', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: '../taskWrk/taskWrk.html?taskNo=' + row.taskNo + "&wrkNo=" + row.wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | }, |
| | | tableRowClassName({row, rowIndex}) { |
| | | if (rowIndex === this.commandStep) { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | }, |
| | | executeCommand(row) { |
| | | //执行指令 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/executeCommand", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | id: row.id |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "执行成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | completeCommand(row) { |
| | | //完成指令 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/completeCommand", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | id: row.id |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "完成成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/wms/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/wms/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/wms/css/common.css" media="all"> |
| | | <meta charset="UTF-8"> |
| | | <title>指令管理</title> |
| | | <link rel="stylesheet" href="../../static/wcs/css/element.css"> |
| | | <script type="text/javascript" src="../../static/wcs/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wms/layui/layui.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/common.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/vue.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/element.js"></script> |
| | | <style> |
| | | .el-table .success-row { |
| | | background: #d5ffc0; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="指令编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="wrk_no" id="wrkNo" placeholder="任务号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;"> |
| | | <div style="width: 100%;"> |
| | | <el-card class="box-card"> |
| | | <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline"> |
| | | <el-form-item label=""> |
| | | <el-input v-model="tableSearchParam.task_no" placeholder="任务号"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData">查询</el-button> |
| | | <el-button type="primary" @click="resetParam">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table ref="singleTable" :data="tableData" style="width: 100%;" :row-class-name="tableRowClassName"> |
| | | <el-table-column property="id" label="#ID"> |
| | | </el-table-column> |
| | | <el-table-column property="wrkNo" label="工作号"> |
| | | </el-table-column> |
| | | <el-table-column property="taskNo" label="任务号"> |
| | | </el-table-column> |
| | | <el-table-column property="commandStatus$" label="指令状态"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="durationTime" label="持续时长"> |
| | | </el-table-column> |
| | | <el-table-column property="commandType" label="指令类型"> |
| | | </el-table-column> |
| | | <el-table-column property="device" label="设备"> |
| | | </el-table-column> |
| | | <el-table-column property="deviceLog" label="设备执行信息"> |
| | | </el-table-column> |
| | | <el-table-column property="commandDesc" label="命令描述"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="startTime$" label="开始时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="executeTime$" label="执行时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="completeTime$" label="完成时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="command" label="命令报文" width="250"> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> |
| | | <div style="margin-top: 10px;"> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
| | | :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" :total="pageTotal"> |
| | | </el-pagination> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | var $layui = layui.config({ |
| | | base: baseUrl + "/static/wms/layui/lay/modules/" |
| | | }).use(['layer', 'form'], function() {}) |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="commandManage" lay-filter="commandManage"></table> |
| | | </div> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button> |
| | | </div> |
| | | var app = new Vue({ |
| | | el: '#app', |
| | | data: { |
| | | tableData: [], |
| | | currentPage: 1, |
| | | pageSizes: [16, 30, 50, 100, 150, 200], |
| | | pageSize: 16, |
| | | pageTotal: 0, |
| | | tableSearchParam: { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | }, |
| | | commandStep: -1 |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | watch: { |
| | | |
| | | }, |
| | | methods: { |
| | | init() { |
| | | let taskNo = getQueryVariable('taskNo') |
| | | let wrkNo = getQueryVariable('wrkNo') |
| | | let commandStep = getQueryVariable('commandStep') |
| | | if (taskNo != false) { |
| | | this.tableSearchParam.task_no = taskNo |
| | | } |
| | | if (wrkNo != false) { |
| | | this.tableSearchParam.wrk_no = wrkNo |
| | | } |
| | | this.commandStep = parseInt(commandStep) |
| | | |
| | | this.getTableData() |
| | | }, |
| | | getTableData() { |
| | | let that = this; |
| | | let data = this.tableSearchParam |
| | | data.curr = this.currentPage |
| | | data.limit = this.pageSize |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/list/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: data, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.tableData = res.data.records |
| | | that.pageTotal = res.data.total |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.pageSize = val |
| | | this.getTableData() |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.currentPage = val |
| | | this.getTableData() |
| | | }, |
| | | resetParam() { |
| | | this.tableSearchParam = { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | handleCommand(command, row) { |
| | | switch (command) { |
| | | case "showTask": |
| | | //查看任务 |
| | | this.showTask(row) |
| | | break; |
| | | case "executeCommand": |
| | | //执行指令 |
| | | this.executeCommand(row) |
| | | break; |
| | | case "completeCommand": |
| | | //完成指令 |
| | | this.completeCommand(row) |
| | | break; |
| | | } |
| | | }, |
| | | showTask(row) { |
| | | //查看任务 |
| | | $layui.layer.open({ |
| | | type: 2, |
| | | title: '任务管理', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: '../taskWrk/taskWrk.html?taskNo=' + row.taskNo + "&wrkNo=" + row.wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | }, |
| | | tableRowClassName({row, rowIndex}) { |
| | | if (rowIndex === this.commandStep) { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | }, |
| | | executeCommand(row) { |
| | | //执行指令 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/executeCommand", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | id: row.id |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "执行成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | completeCommand(row) { |
| | | //完成指令 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/completeCommand", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | id: row.id |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "完成成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-xs btn-detlShow" lay-event="wrkMastShow">任务</a> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/wms/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wms/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/wms/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/wms/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/wms/js/commandManageLog/commandManageLog.js" charset="utf-8"></script> |
| | | |
| | | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> |
| | | |
| | | </body> |
| | | </html> |
| | | |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>指令管理</title> |
| | | <link rel="stylesheet" href="../../static/wcs/css/element.css"> |
| | | <script type="text/javascript" src="../../static/wcs/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wms/layui/layui.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/common.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/vue.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/element.js"></script> |
| | | <style> |
| | | .el-table .success-row { |
| | | background: #d5ffc0; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | | <body> |
| | | <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;"> |
| | | <div style="width: 100%;"> |
| | | <el-card class="box-card"> |
| | | <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline"> |
| | | <el-form-item label="任务号"> |
| | | <el-input v-model="tableSearchParam.task_no" placeholder="任务号" readonly></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="工作号"> |
| | | <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号" readonly></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="指令步序"> |
| | | <el-input-number v-model="commandStep" placeholder="指令步序" :min="0"></el-input-number> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table ref="singleTable" :data="tableData" style="width: 100%;" :row-class-name="tableRowClassName"> |
| | | <el-table-column property="index" label="指令编号"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.$index }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="wrkNo" label="工作号"> |
| | | </el-table-column> |
| | | <el-table-column property="taskNo" label="任务号"> |
| | | </el-table-column> |
| | | <el-table-column property="commandStatus$" label="指令状态"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="durationTime" label="持续时长"> |
| | | </el-table-column> |
| | | <el-table-column property="commandType" label="指令类型"> |
| | | </el-table-column> |
| | | <el-table-column property="device" label="设备"> |
| | | </el-table-column> |
| | | <el-table-column property="deviceLog" label="设备执行信息"> |
| | | </el-table-column> |
| | | <el-table-column property="commandDesc" label="命令描述"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="startTime$" label="开始时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="executeTime$" label="执行时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="completeTime$" label="完成时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="command" label="命令报文" width="250"> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <div style="margin-top: 10px;"> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
| | | :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" :total="pageTotal"> |
| | | </el-pagination> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | </div> |
| | | <script> |
| | | var $layui = layui.config({ |
| | | base: baseUrl + "/static/wms/layui/lay/modules/" |
| | | }).use(['layer', 'form'], function() {}) |
| | | |
| | | var app = new Vue({ |
| | | el: '#app', |
| | | data: { |
| | | tableData: [], |
| | | currentPage: 1, |
| | | pageSizes: [16, 30, 50, 100, 150, 200], |
| | | pageSize: 16, |
| | | pageTotal: 0, |
| | | tableSearchParam: { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | }, |
| | | commandStep: -1 |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | watch: { |
| | | |
| | | }, |
| | | methods: { |
| | | init() { |
| | | let taskNo = getQueryVariable('taskNo') |
| | | let wrkNo = getQueryVariable('wrkNo') |
| | | if (taskNo != false) { |
| | | this.tableSearchParam.task_no = taskNo |
| | | } |
| | | if (wrkNo != false) { |
| | | this.tableSearchParam.wrk_no = wrkNo |
| | | } |
| | | |
| | | this.getTableData() |
| | | }, |
| | | getTableData() { |
| | | let that = this; |
| | | let data = this.tableSearchParam |
| | | data.curr = this.currentPage |
| | | data.limit = this.pageSize |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/list/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: data, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.tableData = res.data.records |
| | | that.pageTotal = res.data.total |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/" + this.tableSearchParam.wrk_no + "/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: data, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.commandStep = parseInt(res.data.commandStep) |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.pageSize = val |
| | | this.getTableData() |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.currentPage = val |
| | | this.getTableData() |
| | | }, |
| | | resetParam() { |
| | | this.tableSearchParam = { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | handleCommand(command, row) { |
| | | switch (command) { |
| | | case "showTask": |
| | | //查看任务 |
| | | this.showTask(row) |
| | | break; |
| | | case "executeCommand": |
| | | //执行指令 |
| | | this.executeCommand(row) |
| | | break; |
| | | case "completeCommand": |
| | | //完成指令 |
| | | this.completeCommand(row) |
| | | break; |
| | | } |
| | | }, |
| | | showTask(row) { |
| | | //查看任务 |
| | | $layui.layer.open({ |
| | | type: 2, |
| | | title: '任务管理', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: '../taskWrk/taskWrk.html?taskNo=' + row.taskNo + "&wrkNo=" + row.wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | }, |
| | | tableRowClassName({row, rowIndex}) { |
| | | if (rowIndex === parseInt(this.commandStep)) { |
| | | return 'success-row'; |
| | | } |
| | | return ''; |
| | | }, |
| | | executeCommand(row) { |
| | | //执行指令 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/executeCommand", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | id: row.id |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "执行成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | completeCommand(row) { |
| | | //完成指令 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/completeCommand", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | id: row.id |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "完成成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | updateCommandStep() { |
| | | //更新步序 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/updateCommandStep", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | wrkNo: this.tableSearchParam.wrk_no, |
| | | commandStep: this.commandStep |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "更新成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | } |
| | | }) |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: 'commandManage.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo, |
| | | content: 'commandManageLog.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | }, |