add: 添加自动清理任务和指令,优化操作日志
This commit is contained in:
@@ -1011,10 +1011,10 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver
|
||||
= (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver();
|
||||
standardCoveyorControlWithScannerDeviceDriver.setDeviceStatus(form);
|
||||
} else if (device.getDeviceDriver() instanceof DeviceStageMonitor) {
|
||||
}/* else if (device.getDeviceDriver() instanceof DeviceStageMonitor) {
|
||||
DeviceStageMonitor deviceStageMonitor = (DeviceStageMonitor) device.getDeviceDriver();
|
||||
deviceStageMonitor.setDeviceStatus(form);
|
||||
}else if (device.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
|
||||
}*/else if (device.getDeviceDriver() instanceof StandardStackerDeviceDriver) {
|
||||
StandardStackerDeviceDriver standardStackerDeviceDriver = (StandardStackerDeviceDriver) device.getDeviceDriver();
|
||||
standardStackerDeviceDriver.setDeviceStatus(form);
|
||||
}
|
||||
|
||||
@@ -63,14 +63,14 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
public int move = 0;
|
||||
public int action = 0;
|
||||
public int error = 0;
|
||||
public String task = null;
|
||||
public String task = "";
|
||||
|
||||
public int last_heartbeat = 0;
|
||||
public int last_mode = 0;
|
||||
public int last_move = 0;
|
||||
public int last_action = 0;
|
||||
public int last_error = 0;
|
||||
public String last_task = null;
|
||||
public String last_task = "";
|
||||
|
||||
Boolean isonline = true;
|
||||
|
||||
@@ -160,7 +160,6 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
jo.put("action", action == 1 ? "允许取放": "不允许取放");
|
||||
jo.put("isOnline", true);
|
||||
jo.put("error", this.getError());
|
||||
jo.put("isError", this.getIserror());
|
||||
jo.put("task", this.getTask());
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -1031,9 +1031,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
move = "有货";
|
||||
}
|
||||
|
||||
String requireSucess = "0";
|
||||
String requireSucess = "复位";
|
||||
if (this.requireSucess) {
|
||||
requireSucess = "1";
|
||||
requireSucess = "未复位";
|
||||
}
|
||||
jo.put("requireSucess", requireSucess);
|
||||
if (this.getAction() == 1) {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.nl.common.logging.annotation;
|
||||
|
||||
import org.nl.acs.enums.InterfaceLogType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -28,4 +30,34 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Log {
|
||||
String value() default "";
|
||||
|
||||
|
||||
/**
|
||||
* 是否打印到日志文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isPrintToLogFile() default false;
|
||||
|
||||
|
||||
/**
|
||||
* 是否插入操作日志表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isAddLogTable() default true;
|
||||
|
||||
/**
|
||||
* 是否接口日志
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isInterfaceLog() default false;
|
||||
|
||||
/**
|
||||
* 接口日志类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
InterfaceLogType interfaceLogType() default InterfaceLogType.DEFAULT;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,14 @@
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*//*
|
||||
*/
|
||||
|
||||
package org.nl.common.logging.aspect;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
@@ -31,6 +33,10 @@ import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.common.utils.StringUtils;
|
||||
import org.nl.common.utils.ThrowableUtil;
|
||||
import org.nl.common.logging.domain.Log;
|
||||
import org.nl.config.IdUtil;
|
||||
import org.nl.system.service.logging.ISysLogService;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -41,79 +47,67 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
*/
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-24
|
||||
*//*
|
||||
|
||||
@Component
|
||||
@Aspect
|
||||
@Slf4j
|
||||
public class LogAspect {
|
||||
|
||||
private final LogService logService;
|
||||
@Autowired
|
||||
private ISysLogService logService;
|
||||
|
||||
ThreadLocal<Long> currentTime = new ThreadLocal<>();
|
||||
|
||||
public LogAspect(LogService logService) {
|
||||
public LogAspect(ISysLogService logService) {
|
||||
this.logService = logService;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 配置切入点
|
||||
*//*
|
||||
|
||||
|
||||
@Pointcut("@annotation(org.nl.common.logging.annotation.Log)")
|
||||
public void logPointcut() {
|
||||
// 该方法无方法体,主要为了让同类中其他方法使用此切入点
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 配置环绕通知,使用在方法logPointcut()上注册的切入点
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
*//*
|
||||
|
||||
@Around("logPointcut()")
|
||||
public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
// HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
|
||||
|
||||
String trackId = UUID.randomUUID().toString();
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
// 方法路径
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
String params=getParameter(method, joinPoint.getArgs());
|
||||
String params = getParameter(method, joinPoint.getArgs());
|
||||
|
||||
log.info("请求uri:{}", request.getRequestURI());
|
||||
log.info("请求方法:{}",methodName);
|
||||
log.info("请求方法参数:{}",params);
|
||||
org.nl.common.logging.annotation.Log logInfo = method.getAnnotation(org.nl.common.logging.annotation.Log.class);
|
||||
|
||||
//是否输出到日志文件
|
||||
if (logInfo.isPrintToLogFile()) {
|
||||
log.info("track_id:{},请求方法:{},请求方法参数:{}", trackId, methodName, params);
|
||||
}
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
String requestIp = StringUtils.getIp(request);
|
||||
Object result;
|
||||
currentTime.set(System.currentTimeMillis());
|
||||
result = joinPoint.proceed();
|
||||
Log log = new Log("INFO",System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request),joinPoint, log);
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
result = joinPoint.proceed();
|
||||
//是否把日志存到日志表
|
||||
if (logInfo.isAddLogTable()) {
|
||||
SysLog log = new SysLog("INFO", System.currentTimeMillis() - startTime);
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("track_id:{},error:{}", trackId, ex.getMessage());
|
||||
SysLog log = new SysLog("ERROR", System.currentTimeMillis() - startTime);
|
||||
log.setException_detail(ThrowableUtil.getStackTrace(ex).getBytes());
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint) joinPoint, log);
|
||||
throw ex;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 根据方法和传入的参数获取请求参数
|
||||
*//*
|
||||
|
||||
|
||||
private String getParameter(Method method, Object[] args) {
|
||||
List<Object> argList = new ArrayList<>();
|
||||
@@ -142,19 +136,13 @@ public class LogAspect {
|
||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* 配置异常通知
|
||||
*
|
||||
* @param joinPoint join point for advice
|
||||
* @param e exception
|
||||
*//*
|
||||
|
||||
|
||||
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
|
||||
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
|
||||
Log log = new Log("ERROR",System.currentTimeMillis() - currentTime.get());
|
||||
SysLog log = new SysLog("ERROR",System.currentTimeMillis() - currentTime.get());
|
||||
currentTime.remove();
|
||||
log.setExceptionDetail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||
log.setException_detail(ThrowableUtil.getStackTrace(e).getBytes());
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log);
|
||||
}
|
||||
@@ -167,4 +155,3 @@ public class LogAspect {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -2,8 +2,10 @@ package org.nl.system.service.logging;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,6 +34,18 @@ public interface ISysLogService extends IService<SysLog> {
|
||||
*/
|
||||
Object findByErrDetail(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 保存日志数据
|
||||
* @param username 用户
|
||||
* @param browser 浏览器
|
||||
* @param ip 请求IP
|
||||
* @param joinPoint /
|
||||
* @param log 日志实体
|
||||
*/
|
||||
@Async
|
||||
void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog log);
|
||||
|
||||
/**
|
||||
* 删除所有异常日志
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -18,6 +19,7 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_log")
|
||||
@NoArgsConstructor
|
||||
public class SysLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -51,5 +53,8 @@ public class SysLog implements Serializable {
|
||||
|
||||
private String create_time;
|
||||
|
||||
|
||||
public SysLog(String logType, Long time) {
|
||||
this.log_type = logType;
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,36 @@
|
||||
package org.nl.system.service.logging.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.common.utils.StringUtils;
|
||||
import org.nl.common.utils.ValidationUtil;
|
||||
import org.nl.system.service.logging.ISysLogService;
|
||||
import org.nl.system.service.logging.dao.SysLog;
|
||||
import org.nl.system.service.logging.dao.mapper.SysLogMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -62,6 +78,62 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||
return Dict.create().set("exception", new String(ObjectUtil.isNotNull(details) ? details : "".getBytes()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(String username, String browser, String ip, ProceedingJoinPoint joinPoint, SysLog logDto) {
|
||||
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
Log aopLog = method.getAnnotation(Log.class);
|
||||
|
||||
// 方法路径
|
||||
String methodName = joinPoint.getTarget().getClass().getName() + "." + signature.getName() + "()";
|
||||
|
||||
// 描述
|
||||
if (logDto != null) {
|
||||
logDto.setDescription(aopLog.value());
|
||||
}
|
||||
assert logDto != null;
|
||||
logDto.setRequest_ip(ip);
|
||||
logDto.setLog_id(RandomUtil.randomString(5));
|
||||
logDto.setAddress(StringUtils.getCityInfo(logDto.getRequest_ip()));
|
||||
logDto.setMethod(methodName);
|
||||
logDto.setUsername(username);
|
||||
logDto.setParams(getParameter(method, joinPoint.getArgs()));
|
||||
logDto.setBrowser(browser);
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
String dateString = DateUtil.date(currentTimeMillis).toString();
|
||||
logDto.setCreate_time(dateString);
|
||||
logMapper.insert(logDto);
|
||||
}
|
||||
|
||||
private String getParameter(Method method, Object[] args) {
|
||||
List<Object> argList = new ArrayList<>();
|
||||
Parameter[] parameters = method.getParameters();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
//将RequestBody注解修饰的参数作为请求参数
|
||||
RequestBody requestBody = parameters[i].getAnnotation(RequestBody.class);
|
||||
if (requestBody != null) {
|
||||
argList.add(args[i]);
|
||||
}
|
||||
//将RequestParam注解修饰的参数作为请求参数
|
||||
RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class);
|
||||
if (requestParam != null) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String key = parameters[i].getName();
|
||||
if (!StrUtil.isEmpty(requestParam.value())) {
|
||||
key = requestParam.value();
|
||||
}
|
||||
map.put(key, args[i]);
|
||||
argList.add(map);
|
||||
}
|
||||
}
|
||||
if (argList.size() == 0) {
|
||||
return "";
|
||||
}
|
||||
return argList.size() == 1 ? JSONUtil.toJsonStr(argList.get(0)) : JSONUtil.toJsonStr(argList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delAllByError() {
|
||||
logMapper.delete(new LambdaQueryWrapper<SysLog>().eq(SysLog::getLog_type, "ERROR"));
|
||||
|
||||
@@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.history.domain.AcsDeviceErrorLog;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -19,11 +23,25 @@ public class DeleteDeviceErrorLog {
|
||||
@Autowired
|
||||
private DeviceErrorLogServiceImpl errorLogServer;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
|
||||
public void run(){
|
||||
log.info("开始删除设备报警记录");
|
||||
errorLogServer.remove(Wrappers.lambdaQuery(AcsDeviceErrorLog.class)
|
||||
.lt(AcsDeviceErrorLog::getError_time, LocalDateTime.now().minusDays(15)));
|
||||
log.info("已将设备报警记录中超过十五天的删除成功");
|
||||
|
||||
taskService.remove(Wrappers.lambdaQuery(Task.class)
|
||||
.lt(Task::getCreate_time, LocalDateTime.now().minusDays(30)));
|
||||
log.info("已将任务记录中超过三十天的删除成功");
|
||||
|
||||
instructionService.remove(Wrappers.lambdaQuery(InstructionMybatis.class)
|
||||
.lt(InstructionMybatis::getCreate_time, LocalDateTime.now().minusDays(30)));
|
||||
log.info("已将指令记录中超过三十天的删除成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -140,8 +141,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
public List<String> getPermissionList(JSONObject userDto) {
|
||||
List<String> permission = new LinkedList<>();
|
||||
// 查看是否为管理员
|
||||
permission.add("admin");
|
||||
permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("userId")));
|
||||
// 是管理员
|
||||
if (userDto.getBooleanValue("is_admin")) {
|
||||
permission.add("admin");
|
||||
}
|
||||
permission.addAll(sysMenuMapper.getPermissionByUserId(userDto.getString("user_id")));
|
||||
return permission;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="left"
|
||||
v-permission="['admin','task:add']"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
type="primary"
|
||||
|
||||
@@ -7,32 +7,33 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div class="grid-content bg-purple-light">
|
||||
<h2 style="font-size: 50px; color: #f4f4f5;margin-left: 100px;padding-top: 10px;">
|
||||
{{ $t('task.screen.task_screen') }}</h2></div>
|
||||
<h2 style="font-size: 50px; color: #f4f4f5;margin-left: 100px;padding-top: 10px;">
|
||||
{{ $t('task.screen.task_screen') }}</h2></div>
|
||||
<div class="grid-content bg-purple-light">
|
||||
<el-form
|
||||
:inline="true"
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item class="custom-label" :label="$t('task.screen.device')" style="margin-left: 100px;">
|
||||
<el-select
|
||||
v-model="device"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
:placeholder="$t('common.please')"
|
||||
id="item-size"
|
||||
@change="changeDevice">
|
||||
<el-option
|
||||
v-for="item in ledList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form
|
||||
:inline="true"
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item class="custom-label" :label="$t('task.screen.device')" style="margin-left: 100px;">
|
||||
<el-select
|
||||
id="item-size"
|
||||
v-model="device"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
:placeholder="$t('auto.common.please')"
|
||||
@change="changeDevice"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in ledList"
|
||||
:key="item.device_code"
|
||||
:label="item.device_name"
|
||||
:value="item.device_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
@@ -48,54 +49,61 @@
|
||||
</div>
|
||||
<el-form
|
||||
v-if="device!=''"
|
||||
style="margin-top: 50px;padding-top: 10px" ref="form" :model="form" :rules="rules"
|
||||
size="small" label-width="200px">
|
||||
ref="form"
|
||||
style="margin-top: 50px;padding-top: 10px"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
size="small"
|
||||
label-width="200px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="12" style="padding-left: 100px">
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" prop="task_code" :label="$t('task.screen.task_code')">
|
||||
<el-input v-model="form.task_code" class="cpp"/>
|
||||
<el-input v-model="form.task_code" class="cpp" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.inst_code')" prop="inst_code">
|
||||
<el-input class="cpp" v-model="form.inst_code"/>
|
||||
<el-input v-model="form.inst_code" class="cpp" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.start')" prop="start_device_code">
|
||||
<el-input class="cpp" v-model="form.start_device_code"/>
|
||||
<el-input v-model="form.start_device_code" class="cpp" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.end')" prop="next_device_code">
|
||||
<el-input class="cpp" v-model="form.next_device_code"/>
|
||||
<el-input v-model="form.next_device_code" class="cpp" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.material')" prop="material_type">
|
||||
<el-input class="cpp" v-model="form.material_type"/>
|
||||
<span style="color: #f4f4f5;margin-left: 10px;"/>
|
||||
<el-input v-model="form.material_type" class="cpp" />
|
||||
<span style="color: #f4f4f5;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" style="padding-left: 100px">
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.material_num')" prop="quantity">
|
||||
<el-input class="cpp" v-model="form.quantity"/>
|
||||
<span style="color: #f4f4f5;margin-left: 10px;"/>
|
||||
<el-input v-model="form.quantity" class="cpp" />
|
||||
<span style="color: #f4f4f5;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.vehicle_code')" prop="vehicle_code">
|
||||
<el-input class="cpp" v-model="form.vehicle_code"/>
|
||||
<span style="color: #f4f4f5;margin-left: 10px;"/>
|
||||
<el-input v-model="form.vehicle_code" class="cpp" />
|
||||
<span style="color: #f4f4f5;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.bar')" prop="instruction_status">
|
||||
<el-input class="cpp" v-model="form.instruction_status"/>
|
||||
<span style="color: #f4f4f5;margin-left: 10px;"/>
|
||||
<el-input v-model="form.instruction_status" class="cpp" />
|
||||
<span style="color: #f4f4f5;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.create_time')" prop="entry_time">
|
||||
<el-input class="cpp" v-model="form.entry_time"/>
|
||||
<span style="color: #f4f4f5;margin-left: 10px;"/>
|
||||
<el-input v-model="form.entry_time" class="cpp" />
|
||||
<span style="color: #f4f4f5;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item class="custom-label" style="padding-bottom: 50px" :label="$t('task.screen.IP')" prop="ip">
|
||||
<el-input class="cpp" v-model="form.ip"/>
|
||||
<span style="color: #f4f4f5;margin-left: 10px;"/>
|
||||
<el-input v-model="form.ip" class="cpp" />
|
||||
<span style="color: #f4f4f5;margin-left: 10px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div v-if="device!=''"
|
||||
style="font-size: 30px; color: #f4f4f5; text-align: center; background-color: transparent;padding-top: 50px;">
|
||||
<i class="el-icon-lock"></i>
|
||||
<div
|
||||
v-if="device!=''"
|
||||
style="font-size: 30px; color: #f4f4f5; text-align: center; background-color: transparent;padding-top: 50px;"
|
||||
>
|
||||
<i class="el-icon-lock" />
|
||||
http://127.0.0.1:8014/bigScreen/screen
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item :label="$t('department.table_title.Department_name')">
|
||||
<el-form-item :label="$t('department.table_title.Department_name')">
|
||||
<el-input
|
||||
v-model="query.name"
|
||||
clearable
|
||||
@@ -21,7 +21,7 @@
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('department.table_value.State')">
|
||||
<el-form-item :label="$t('department.table_value.State')">
|
||||
<el-select
|
||||
v-model="query.is_used"
|
||||
clearable
|
||||
@@ -43,7 +43,7 @@
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:visible.sync="crud.status.cu"
|
||||
:title="crud.status.title"
|
||||
width="650px"
|
||||
>
|
||||
@@ -69,8 +69,8 @@
|
||||
<el-form-item :label="$t('department.other.Top_departments')" :min-width="flexWidth('code',crud.data,$t('department.other.Department_code'))">
|
||||
<el-radio-group v-model="form.isTop" style="width: 140px">
|
||||
<el-row>
|
||||
<el-radio label="1">{{ $t('common.true') }}</el-radio>
|
||||
<el-radio label="0">{{ $t('common.false') }}</el-radio>
|
||||
<el-radio label="1">{{ $t('auto.common.true') }}</el-radio>
|
||||
<el-radio label="0">{{ $t('auto.common.false') }}</el-radio>
|
||||
</el-row>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
@@ -279,7 +279,7 @@ export default {
|
||||
},
|
||||
// 改变状态
|
||||
changeEnabled(data, val) {
|
||||
const satus = this.enabledTypeOptions.find(item => { return item.key == data.is_used })
|
||||
const satus = this.enabledTypeOptions.find(item => { return item.key === data.is_used })
|
||||
debugger
|
||||
this.$confirm('此操作将 "' + satus.display_name + '" ' + data.name + '部门, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
||||
@@ -76,20 +76,20 @@
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.type.toString() !== '2' && form.type.toString() !== '1'" :label="$t('menu.dialog.menu_chain')" prop="iframe">
|
||||
<el-radio-group v-model="form.iframe" size="mini">
|
||||
<el-radio-button label="true">{{ $t('common.true') }}</el-radio-button>
|
||||
<el-radio-button label="false">{{ $t('common.false') }}</el-radio-button>
|
||||
<el-radio-button label="true">{{ $t('auto.common.true') }}</el-radio-button>
|
||||
<el-radio-button label="false">{{ $t('auto.common.false') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.type.toString() === '2'" :label="$t('menu.dialog.menu_cache')" prop="cache">
|
||||
<el-radio-group v-model="form.cache" size="mini">
|
||||
<el-radio-button label="true">{{ $t('common.true') }}</el-radio-button>
|
||||
<el-radio-button label="false">{{ $t('common.false') }}</el-radio-button>
|
||||
<el-radio-button label="true">{{ $t('auto.common.true') }}</el-radio-button>
|
||||
<el-radio-button label="false">{{ $t('auto.common.false') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.type.toString() !== '2' && form.type.toString() !== '1' " :label="$t('menu.dialog.menu_visible')" prop="hidden">
|
||||
<el-radio-group v-model="form.hidden" size="mini">
|
||||
<el-radio-button label="false">{{ $t('common.true') }}</el-radio-button>
|
||||
<el-radio-button label="true">{{ $t('common.false') }}</el-radio-button>
|
||||
<el-radio-button label="false">{{ $t('auto.common.true') }}</el-radio-button>
|
||||
<el-radio-button label="true">{{ $t('auto.common.false') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.type.toString() !== '2'" :label="$t('menu.dialog.default_title')" prop="title">
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item :label="$t('user.table_title.Department_name')">
|
||||
<el-form-item :label="$t('user.table_title.Department_name')">
|
||||
<el-input
|
||||
v-model="deptName"
|
||||
clearable
|
||||
@@ -41,7 +41,7 @@
|
||||
label-position="right"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item :label="$t('user.table_title.enter_department_name')">
|
||||
<el-form-item :label="$t('user.table_title.enter_department_name')">
|
||||
<el-input
|
||||
v-model="query.blurry"
|
||||
clearable
|
||||
@@ -52,7 +52,7 @@
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('user.table_title.State')">
|
||||
<el-form-item :label="$t('user.table_title.State')">
|
||||
<el-select
|
||||
v-model="query.is_used"
|
||||
clearable
|
||||
@@ -80,7 +80,7 @@
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:visible.sync="crud.status.cu"
|
||||
:title="crud.status.title"
|
||||
width="800px"
|
||||
>
|
||||
@@ -135,7 +135,7 @@
|
||||
multiple
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
:placeholder="$t('common.please')"
|
||||
:placeholder="$t('auto.common.please')"
|
||||
@remove-tag="deleteTag"
|
||||
@change="changeRole"
|
||||
>
|
||||
@@ -150,8 +150,8 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">{{ $t('common.Cancel') }}</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">{{ $t('common.Confirm') }}</el-button>
|
||||
<el-button type="text" @click="crud.cancelCU">{{ $t('auto.common.Cancel') }}</el-button>
|
||||
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">{{ $t('auto.common.Confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
@@ -349,7 +349,6 @@ import { getAll, getLevel } from '@/views/system/role/role'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import { mapGetters } from 'vuex'
|
||||
@@ -373,7 +372,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'User',
|
||||
components: { RelevanceDeptDialog, RelevanceUserDialog, Treeselect, crudOperation, rrOperation, udOperation, pagination },
|
||||
components: { RelevanceDeptDialog, RelevanceUserDialog, Treeselect, crudOperation, rrOperation, pagination },
|
||||
cruds() {
|
||||
return CRUD({ title: i18n.t('user.table_value.User'), idField: 'user_id', url: 'api/users', crudMethod: { ...crudUser }})
|
||||
},
|
||||
@@ -682,7 +681,7 @@ export default {
|
||||
this.$nextTick(function() {
|
||||
for (let j = 0; j < row.roles.length; j++) {
|
||||
for (let i = 0; i < this.rolesDatas.length; i++) {
|
||||
if (this.rolesDatas[i].roleId == row.roles[j].roleId) {
|
||||
if (this.rolesDatas[i].roleId === row.roles[j].roleId) {
|
||||
this.$refs.roleTable.toggleRowSelection(this.rolesDatas[i], true)
|
||||
break
|
||||
}
|
||||
@@ -718,7 +717,7 @@ export default {
|
||||
this.$nextTick(function() {
|
||||
for (var index = 0; index < res.length; index++) {
|
||||
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
|
||||
if (this.dataDialog.dataScopeType[i].value == res[index].permissionScopeType) {
|
||||
if (this.dataDialog.dataScopeType[i].value === res[index].permissionScopeType) {
|
||||
this.dataDialog.dataScopeType[i].permission_id = res[index].permission_id
|
||||
if (res[index].users) this.dataDialog.dataScopeType[i].users = res[index].users
|
||||
if (res[index].depts) this.dataDialog.dataScopeType[i].depts = res[index].depts
|
||||
@@ -738,7 +737,7 @@ export default {
|
||||
},
|
||||
openRelevance(row, index) {
|
||||
for (var i = 0; i < this.permissions.length; i++) {
|
||||
if (this.permissions[i].permission_id != undefined && this.permissions[i].permission_id && this.permissions[i].permission_id != row.permission_id) {
|
||||
if (this.permissions[i].permission_id !== undefined && this.permissions[i].permission_id && this.permissions[i].permission_id !== row.permission_id) {
|
||||
this.$delete(this.dataDialog.dataScopeType[index], this.permissions[i].permission_id.toString())
|
||||
}
|
||||
}
|
||||
@@ -746,15 +745,15 @@ export default {
|
||||
this.rowData = {}
|
||||
this.deptIds = []
|
||||
this.userIds = []
|
||||
if (row.permission_id == '1605129738328870912') { // 选择用户
|
||||
if (row.permission_id === '1605129738328870912') { // 选择用户
|
||||
this.userIds = this.dataDialog.dataScopeType[index].users
|
||||
this.rowData = row
|
||||
this.relevanceUser = true
|
||||
} else if (row.permission_id == '1605129882164137984') { // 选择部门
|
||||
} else if (row.permission_id === '1605129882164137984') { // 选择部门
|
||||
this.deptIds = this.dataDialog.dataScopeType[index].depts
|
||||
this.rowData = row
|
||||
this.relevanceDept = true
|
||||
} else if (row.permission_id == '1605128919449735168') { // 自身
|
||||
} else if (row.permission_id === '1605128919449735168') { // 自身
|
||||
const param = {
|
||||
userId: this.dataDialog.userId
|
||||
}
|
||||
@@ -767,8 +766,8 @@ export default {
|
||||
},
|
||||
selectUsers(row) { // row对话框传来的数据
|
||||
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
|
||||
if (this.dataDialog.dataScopeType[i].dict_id == this.rowData.dict_id) {
|
||||
if (this.dataDialog.dataScopeType[i].depts != undefined && this.dataDialog.dataScopeType[i].depts.length > 0) this.dataDialog.dataScopeType[i].depts = []
|
||||
if (this.dataDialog.dataScopeType[i].dict_id === this.rowData.dict_id) {
|
||||
if (this.dataDialog.dataScopeType[i].depts !== undefined && this.dataDialog.dataScopeType[i].depts.length > 0) this.dataDialog.dataScopeType[i].depts = []
|
||||
this.dataDialog.dataScopeType[i].users = row
|
||||
break
|
||||
}
|
||||
@@ -777,8 +776,8 @@ export default {
|
||||
},
|
||||
selectDepts(row) {
|
||||
for (var i = 0; i < this.dataDialog.dataScopeType.length; i++) {
|
||||
if (this.dataDialog.dataScopeType[i].dict_id == this.rowData.dictId) {
|
||||
if (this.dataDialog.dataScopeType[i].users != undefined && this.dataDialog.dataScopeType[i].users.length > 0) this.dataDialog.dataScopeType[i].users = []
|
||||
if (this.dataDialog.dataScopeType[i].dict_id === this.rowData.dictId) {
|
||||
if (this.dataDialog.dataScopeType[i].users !== undefined && this.dataDialog.dataScopeType[i].users.length > 0) this.dataDialog.dataScopeType[i].users = []
|
||||
this.dataDialog.dataScopeType[i].depts = row
|
||||
break
|
||||
}
|
||||
@@ -875,7 +874,7 @@ export default {
|
||||
checkNode.parent.indeterminate = false
|
||||
}
|
||||
// 如果取消所有第二节点的勾选状态,则第一层父节点也取消勾选
|
||||
if (checkNode.level == 2 && checkNode.parent.childNodes.every(ele => !ele.checked)) {
|
||||
if (checkNode.level === 2 && checkNode.parent.childNodes.every(ele => !ele.checked)) {
|
||||
checkNode.parent.checked = false
|
||||
checkNode.parent.indeterminate = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user