Commit c1248219 by yuwei

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	datax-modules/data-market-service-parent/data-market-service-mapping/src/main/java/cn/datax/service/data/market/mapping/config/RabbitMqListenerConfig.java
parents eae9c125 f2f67696
...@@ -25,5 +25,5 @@ public class RabbitMqConstant { ...@@ -25,5 +25,5 @@ public class RabbitMqConstant {
/** /**
* TOPIC类型的路由键:工作流 {}占位符替换 * TOPIC类型的路由键:工作流 {}占位符替换
*/ */
public static final String TOPIC_WORKFLOW_KEY = "topic.workflow.key.{}"; public static final String TOPIC_WORKFLOW_KEY = "topic.workflow.key.";
} }
...@@ -12,6 +12,16 @@ spring: ...@@ -12,6 +12,16 @@ spring:
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接 max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接 min-idle: 5 # 连接池中的最小空闲连接
rabbitmq:
host: localhost
port: 5672
username: admin
password: 1234@abcd
listener:
simple:
acknowledge-mode: manual
concurrency: 1
max-concurrency: 10
datasource: datasource:
dynamic: dynamic:
primary: mysql primary: mysql
......
...@@ -12,6 +12,15 @@ spring: ...@@ -12,6 +12,15 @@ spring:
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
max-idle: 10 # 连接池中的最大空闲连接 max-idle: 10 # 连接池中的最大空闲连接
min-idle: 5 # 连接池中的最小空闲连接 min-idle: 5 # 连接池中的最小空闲连接
rabbitmq:
host: localhost
port: 5672
username: admin
password: 1234@abcd
publisher-confirm-type: correlated
publisher-returns: true
template:
mandatory: true
datasource: datasource:
dynamic: dynamic:
primary: mysql primary: mysql
......
...@@ -30,7 +30,6 @@ public class RabbitMqListenerConfig { ...@@ -30,7 +30,6 @@ public class RabbitMqListenerConfig {
@Autowired @Autowired
private MappingHandlerMapping mappingHandlerMapping; private MappingHandlerMapping mappingHandlerMapping;
/** /**
* api发布与撤销 * api发布与撤销
* @param map type 1:发布 2:撤销 * @param map type 1:发布 2:撤销
...@@ -65,7 +64,7 @@ public class RabbitMqListenerConfig { ...@@ -65,7 +64,7 @@ public class RabbitMqListenerConfig {
channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
}else { }else {
//记录日志 //记录日志
log.error("消息消费失败处理:{}",e.getMessage()); log.error("消息消费失败处理:{}", e.getMessage());
//第一个参数为消息的index,第二个参数是是否批量处理,第三个参数为是否让被拒绝的消息重新入队列 //第一个参数为消息的index,第二个参数是是否批量处理,第三个参数为是否让被拒绝的消息重新入队列
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false); channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} }
......
package cn.datax.service.data.market.mapping.service;
public interface QueueHandlerService {
void handlerRelease(String id);
void handlerCancel(String id);
}
package cn.datax.service.data.market.mapping.service.impl;
import cn.datax.service.data.market.api.entity.DataApiEntity;
import cn.datax.service.data.market.api.feign.DataApiServiceFeign;
import cn.datax.service.data.market.mapping.handler.MappingHandlerMapping;
import cn.datax.service.data.market.mapping.service.QueueHandlerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class QueueHandlerServiceImpl implements QueueHandlerService {
@Autowired
private DataApiServiceFeign dataApiServiceFeign;
@Autowired
private MappingHandlerMapping mappingHandlerMapping;
@Override
public void handlerRelease(String id) {
DataApiEntity dataApiEntity = dataApiServiceFeign.getDataApiById(id);
if (dataApiEntity != null) {
mappingHandlerMapping.registerMapping(dataApiEntity);
}
}
@Override
public void handlerCancel(String id) {
DataApiEntity dataApiEntity = dataApiServiceFeign.getDataApiById(id);
if (dataApiEntity != null) {
mappingHandlerMapping.unregisterMapping(dataApiEntity);
}
}
}
...@@ -363,7 +363,7 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit ...@@ -363,7 +363,7 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit
@Override @Override
public void releaseDataApi(String id) { public void releaseDataApi(String id) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>(2);
map.put("id", id); map.put("id", id);
map.put("type", "1"); map.put("type", "1");
String obj = (String) Optional.ofNullable(rabbitTemplate.convertSendAndReceive(RabbitMqConstant.FANOUT_API_QUEUE, "", map)).orElse(""); String obj = (String) Optional.ofNullable(rabbitTemplate.convertSendAndReceive(RabbitMqConstant.FANOUT_API_QUEUE, "", map)).orElse("");
...@@ -377,7 +377,7 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit ...@@ -377,7 +377,7 @@ public class DataApiServiceImpl extends BaseServiceImpl<DataApiDao, DataApiEntit
@Override @Override
public void cancelDataApi(String id) { public void cancelDataApi(String id) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>(2);
map.put("id", id); map.put("id", id);
map.put("type", "2"); map.put("type", "2");
String obj = (String) Optional.ofNullable(rabbitTemplate.convertSendAndReceive(RabbitMqConstant.FANOUT_API_QUEUE, "", map)).orElse(""); String obj = (String) Optional.ofNullable(rabbitTemplate.convertSendAndReceive(RabbitMqConstant.FANOUT_API_QUEUE, "", map)).orElse("");
......
...@@ -2,6 +2,9 @@ package cn.datax.service.data.masterdata.config; ...@@ -2,6 +2,9 @@ package cn.datax.service.data.masterdata.config;
import cn.datax.common.rabbitmq.config.RabbitMqConstant; import cn.datax.common.rabbitmq.config.RabbitMqConstant;
import cn.datax.common.utils.ThrowableUtil; import cn.datax.common.utils.ThrowableUtil;
import cn.datax.service.data.masterdata.api.entity.ModelEntity;
import cn.datax.service.data.masterdata.dao.ModelDao;
import cn.datax.service.workflow.api.enums.VariablesEnum;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
...@@ -9,29 +12,41 @@ import org.springframework.amqp.rabbit.annotation.Exchange; ...@@ -9,29 +12,41 @@ import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue; import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding; import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Map;
@Slf4j @Slf4j
@Configuration @Configuration
public class RabbitMqListenerConfig { public class RabbitMqListenerConfig {
@Autowired
private ModelDao modelDao;
/** /**
* 消费工作流 业务编码 6011 * 消费工作流 业务编码 5011
* @param id * @param map
* @param channel * @param channel
* @param message * @param message
* @return * @return
* @throws Exception * @throws Exception
*/ */
@RabbitListener(bindings = @QueueBinding(exchange = @Exchange(name = RabbitMqConstant.TOPIC_EXCHANGE_WORKFLOW, type = "topic", durable = "true", autoDelete = "false"), @RabbitListener(bindings = @QueueBinding(exchange = @Exchange(name = RabbitMqConstant.TOPIC_EXCHANGE_WORKFLOW, type = "topic", durable = "true", autoDelete = "false"),
key = {""}, key = { RabbitMqConstant.TOPIC_WORKFLOW_KEY + "5011" },
value = @Queue(value = RabbitMqConstant.TOPIC_WORKFLOW_QUEUE, durable = "true", exclusive = "false", autoDelete = "false"))) value = @Queue(value = RabbitMqConstant.TOPIC_WORKFLOW_QUEUE, durable = "true", exclusive = "false", autoDelete = "false")))
public String fanoutQueueRelease(String id, Channel channel, Message message) throws Exception { public void fanoutQueueRelease(Map map, Channel channel, Message message) throws Exception {
try { try {
log.info("fanoutQueueRelease接收到了:{}", id); log.info("接收到了消息:{}", map);
String businessKey = (String) map.get(VariablesEnum.businessKey.toString());
String businessCode = (String) map.get(VariablesEnum.businessCode.toString());
String flowStatus = (String) map.get("flowStatus");
ModelEntity model = new ModelEntity();
model.setId(businessKey);
model.setFlowStatus(flowStatus);
modelDao.updateById(model);
// 手动确认 // 手动确认
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
return id;
}catch (Exception e){ }catch (Exception e){
log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e)); log.error("全局异常信息ex={}, StackTrace={}", e.getMessage(), ThrowableUtil.getStackTrace(e));
if (message.getMessageProperties().getRedelivered()){ if (message.getMessageProperties().getRedelivered()){
...@@ -40,11 +55,10 @@ public class RabbitMqListenerConfig { ...@@ -40,11 +55,10 @@ public class RabbitMqListenerConfig {
channel.basicReject(message.getMessageProperties().getDeliveryTag(), false); channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
}else { }else {
//记录日志 //记录日志
log.error("消息消费失败处理:{}",e.getMessage()); log.error("消息消费失败处理:{}", e.getMessage());
//第一个参数为消息的index,第二个参数是是否批量处理,第三个参数为是否让被拒绝的消息重新入队列 //第一个参数为消息的index,第二个参数是是否批量处理,第三个参数为是否让被拒绝的消息重新入队列
channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false); channel.basicNack(message.getMessageProperties().getDeliveryTag(), false, false);
} }
} }
return null;
} }
} }
...@@ -67,6 +67,7 @@ public class ModelController extends BaseController { ...@@ -67,6 +67,7 @@ public class ModelController extends BaseController {
public R getModelList() { public R getModelList() {
QueryWrapper<ModelEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ModelEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", DataConstant.EnableState.ENABLE.getKey()); queryWrapper.eq("status", DataConstant.EnableState.ENABLE.getKey());
queryWrapper.eq("flow_status", DataConstant.AuditState.AGREE.getKey());
List<ModelEntity> list = modelService.list(queryWrapper); List<ModelEntity> list = modelService.list(queryWrapper);
List<ModelVo> collect = list.stream().map(modelMapstruct::toVO).collect(Collectors.toList()); List<ModelVo> collect = list.stream().map(modelMapstruct::toVO).collect(Collectors.toList());
return R.ok().setData(collect); return R.ok().setData(collect);
......
...@@ -31,7 +31,6 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -31,7 +31,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -70,14 +69,14 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp ...@@ -70,14 +69,14 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp
private static String BIND_GB_CODE = "gb_code"; private static String BIND_GB_CODE = "gb_code";
private static String BIND_GB_NAME = "gb_name"; private static String BIND_GB_NAME = "gb_name";
private static String DEFAULT_BUSINESS_CODE = "6011"; private static String DEFAULT_BUSINESS_CODE = "5011";
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ModelEntity saveModel(ModelDto modelDto) { public ModelEntity saveModel(ModelDto modelDto) {
ModelEntity model = modelMapstruct.toEntity(modelDto); ModelEntity model = modelMapstruct.toEntity(modelDto);
model.setIsSync(DataConstant.TrueOrFalse.FALSE.getKey()); model.setIsSync(DataConstant.TrueOrFalse.FALSE.getKey());
model.setModelPhysicalTable("dynamic_" + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN)); model.setModelPhysicalTable("dynamic_" + DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN));
modelDao.insert(model); modelDao.insert(model);
String modelId = model.getId(); String modelId = model.getId();
List<ModelColumnEntity> modelColumns = model.getModelColumns(); List<ModelColumnEntity> modelColumns = model.getModelColumns();
......
package cn.datax.service.data.metadata.api.entity; package cn.datax.service.data.metadata.api.entity;
import cn.datax.common.base.DataScopeBaseEntity; import cn.datax.common.base.DataScopeBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -55,12 +56,16 @@ public class MetadataChangeRecordEntity extends DataScopeBaseEntity { ...@@ -55,12 +56,16 @@ public class MetadataChangeRecordEntity extends DataScopeBaseEntity {
/** /**
* 数据源 * 数据源
*/ */
@TableField(exist = false)
private String sourceId; private String sourceId;
@TableField(exist = false)
private String sourceName; private String sourceName;
/** /**
* 数据库表 * 数据库表
*/ */
@TableField(exist = false)
private String tableId; private String tableId;
@TableField(exist = false)
private String tableName; private String tableName;
} }
...@@ -36,9 +36,9 @@ public class MetadataSourceEntity extends DataScopeBaseEntity { ...@@ -36,9 +36,9 @@ public class MetadataSourceEntity extends DataScopeBaseEntity {
private String sourceName; private String sourceName;
/** /**
* 元数据同步1是0否 * 元数据同步(0否,1是)
*/ */
private Integer sourceSync; private String isSync;
/** /**
* 数据源连接信息 * 数据源连接信息
......
...@@ -28,5 +28,5 @@ public class MetadataSourceVo implements Serializable { ...@@ -28,5 +28,5 @@ public class MetadataSourceVo implements Serializable {
private String dbType; private String dbType;
private String sourceName; private String sourceName;
private DbSchema dbSchema; private DbSchema dbSchema;
private Integer sourceSync; private String isSync;
} }
...@@ -85,7 +85,7 @@ public class AsyncTask { ...@@ -85,7 +85,7 @@ public class AsyncTask {
}); });
} }
} }
dataSource.setSourceSync(Integer.valueOf(DataConstant.TrueOrFalse.TRUE.getKey())); dataSource.setIsSync(DataConstant.TrueOrFalse.TRUE.getKey());
metadataSourceDao.updateById(dataSource); metadataSourceDao.updateById(dataSource);
log.info("异步任务执行完成!耗时{}秒", (System.currentTimeMillis() - start / 1000)); log.info("异步任务执行完成!耗时{}秒", (System.currentTimeMillis() - start / 1000));
} }
......
...@@ -84,7 +84,7 @@ public class MetadataSourceServiceImpl extends BaseServiceImpl<MetadataSourceDao ...@@ -84,7 +84,7 @@ public class MetadataSourceServiceImpl extends BaseServiceImpl<MetadataSourceDao
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void saveMetadataSource(MetadataSourceDto metadataSourceDto) { public void saveMetadataSource(MetadataSourceDto metadataSourceDto) {
MetadataSourceEntity dataSource = metadataSourceMapper.toEntity(metadataSourceDto); MetadataSourceEntity dataSource = metadataSourceMapper.toEntity(metadataSourceDto);
dataSource.setSourceSync(Integer.valueOf(DataConstant.TrueOrFalse.FALSE.getKey())); dataSource.setIsSync(DataConstant.TrueOrFalse.FALSE.getKey());
metadataSourceDao.insert(dataSource); metadataSourceDao.insert(dataSource);
} }
...@@ -158,7 +158,7 @@ public class MetadataSourceServiceImpl extends BaseServiceImpl<MetadataSourceDao ...@@ -158,7 +158,7 @@ public class MetadataSourceServiceImpl extends BaseServiceImpl<MetadataSourceDao
@Override @Override
public void syncMetadata(String id) { public void syncMetadata(String id) {
MetadataSourceEntity metadataSourceEntity = super.getById(id); MetadataSourceEntity metadataSourceEntity = super.getById(id);
if (Integer.valueOf(DataConstant.TrueOrFalse.TRUE.getKey()).equals(metadataSourceEntity.getSourceSync())) { if (DataConstant.TrueOrFalse.TRUE.getKey().equals(metadataSourceEntity.getIsSync())) {
throw new DataException("元数据已同步"); throw new DataException("元数据已同步");
} }
// 异步执行同步任务 // 异步执行同步任务
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<result column="remark" property="remark" /> <result column="remark" property="remark" />
<result column="db_type" property="dbType" /> <result column="db_type" property="dbType" />
<result column="source_name" property="sourceName" /> <result column="source_name" property="sourceName" />
<result column="source_sync" property="sourceSync" /> <result column="is_sync" property="isSync" />
</resultMap> </resultMap>
<resultMap id="ExtendResultMap" type="cn.datax.service.data.metadata.api.entity.MetadataSourceEntity" extends="BaseResultMap"> <resultMap id="ExtendResultMap" type="cn.datax.service.data.metadata.api.entity.MetadataSourceEntity" extends="BaseResultMap">
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
update_by, update_by,
update_time, update_time,
remark, remark,
db_type, source_name, source_sync db_type, source_name, is_sync
</sql> </sql>
<sql id="Extend_Column_List"> <sql id="Extend_Column_List">
......
package cn.datax.service.data.quality.api.dto;
import cn.datax.common.validate.ValidationGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
* 核查规则信息表 实体DTO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@ApiModel(value = "核查规则信息表Model")
@Data
public class CheckRuleDto implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键ID")
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
private String id;
@ApiModelProperty(value = "规则名称")
private String ruleName;
@ApiModelProperty(value = "规则类型")
private String ruleTypeId;
@ApiModelProperty(value = "规则级别(3高、2中、1低)")
private String ruleLevel;
@ApiModelProperty(value = "数据源主键")
private String ruleSourceId;
@ApiModelProperty(value = "数据源")
private String ruleSource;
@ApiModelProperty(value = "数据表主键")
private String ruleTableId;
@ApiModelProperty(value = "数据表")
private String ruleTable;
@ApiModelProperty(value = "数据表名称")
private String ruleTableComment;
@ApiModelProperty(value = "核查字段主键")
private String ruleColumnId;
@ApiModelProperty(value = "核查字段")
private String ruleColumn;
@ApiModelProperty(value = "核查字段名称")
private String ruleColumnComment;
@ApiModelProperty(value = "核查脚本")
private String ruleSql;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.datax.service.data.quality.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* <p>
* 核查报告信息表
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@Accessors(chain = true)
@TableName(value = "quality_check_report", autoResultMap = true)
public class CheckReportEntity implements Serializable {
private static final long serialVersionUID=1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 核查规则主键
*/
private String checkRuleId;
/**
* 核查时间
*/
private LocalDateTime checkDate;
/**
* 核查结果
*/
private String checkResult;
/**
* 核查数量
*/
private Integer checkTotalCount;
/**
* 报错数量
*/
private Integer checkErrorCount;
/**
* 核查批次号
*/
private String checkBatch;
/**
* 规则名称
*/
@TableField(exist = false)
private String ruleName;
/**
* 规则类型
*/
@TableField(exist = false)
private String ruleType;
/**
* 数据源
*/
@TableField(exist = false)
private String ruleSource;
/**
* 数据表
*/
@TableField(exist = false)
private String ruleTable;
/**
* 核查字段
*/
@TableField(exist = false)
private String ruleColumn;
}
package cn.datax.service.data.quality.api.entity;
import cn.datax.common.base.DataScopeBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 核查规则信息表
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "quality_check_rule", autoResultMap = true)
public class CheckRuleEntity extends DataScopeBaseEntity {
private static final long serialVersionUID=1L;
/**
* 规则名称
*/
private String ruleName;
/**
* 规则类型主键
*/
private String ruleTypeId;
/**
* 规则类型
*/
@TableField(exist = false)
private String ruleType;
/**
* 规则级别(3高、2中、1低)
*/
private String ruleLevel;
/**
* 数据源主键
*/
private String ruleSourceId;
/**
* 数据源
*/
private String ruleSource;
/**
* 数据表主键
*/
private String ruleTableId;
/**
* 数据表
*/
private String ruleTable;
/**
* 数据表名称
*/
private String ruleTableComment;
/**
* 核查字段主键
*/
private String ruleColumnId;
/**
* 核查字段
*/
private String ruleColumn;
/**
* 核查字段名称
*/
private String ruleColumnComment;
/**
* 核查脚本
*/
private String ruleSql;
/**
* 最近核查批次号(关联确定唯一核查报告)
*/
private String lastCheckBatch;
}
package cn.datax.service.data.quality.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 规则类型信息表
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@Accessors(chain = true)
@TableName("quality_rule_type")
public class RuleTypeEntity implements Serializable {
private static final long serialVersionUID=1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 类型名称
*/
private String name;
}
package cn.datax.service.data.quality.api.entity;
import lombok.Data;
@Data
public class RuleTypeReportEntity extends RuleTypeEntity {
private static final long serialVersionUID=1L;
/**
* 报错数量
*/
private Integer checkErrorCount;
}
package cn.datax.service.data.quality.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 数据质量监控任务信息表
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@TableName("quality_schedule_job")
public class ScheduleJobEntity implements Serializable {
private static final long serialVersionUID=1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 任务名称
*/
private String jobName;
/**
* bean名称
*/
private String beanName;
/**
* 方法名称
*/
private String methodName;
/**
* 方法参数
*/
private String methodParams;
/**
* cron表达式
*/
private String cronExpression;
/**
* 状态(1运行 0暂停)
*/
private String status;
}
package cn.datax.service.data.quality.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 核查报告信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CheckReportQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
private String ruleTypeId;
private String ruleName;
private String ruleSource;
private String ruleTable;
private String ruleColumn;
}
package cn.datax.service.data.quality.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 核查规则信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CheckRuleQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
private String ruleTypeId;
private String ruleName;
private String ruleSource;
private String ruleTable;
private String ruleColumn;
}
package cn.datax.service.data.quality.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 规则类型信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class RuleTypeQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
private String name;
}
package cn.datax.service.data.quality.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 数据质量监控任务信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ScheduleJobQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
}
package cn.datax.service.data.quality.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 核查报告信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
public class CheckReportVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String checkRuleId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime checkDate;
private String checkResult;
private Integer checkTotalCount;
private Integer checkErrorCount;
private String ruleName;
private String ruleType;
private String ruleSource;
private String ruleTable;
private String ruleColumn;
}
package cn.datax.service.data.quality.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 核查规则信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
public class CheckRuleVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String ruleName;
private String ruleTypeId;
private String ruleType;
private String ruleLevel;
private String ruleSourceId;
private String ruleSource;
private String ruleTableId;
private String ruleTable;
private String ruleTableComment;
private String ruleColumnId;
private String ruleColumn;
private String ruleColumnComment;
private String ruleSql;
}
package cn.datax.service.data.quality.api.vo;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 规则类型信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
public class RuleTypeVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String name;
}
package cn.datax.service.data.quality.api.vo;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 数据质量监控任务信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Data
public class ScheduleJobVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String status;
private String jobName;
private String beanName;
private String methodName;
private String methodParams;
private String cronExpression;
}
package cn.datax.service.data.quality.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@Configuration
public class SchedulingConfig {
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
// 定时任务执行线程池核心线程数
taskScheduler.setPoolSize(5);
taskScheduler.setRemoveOnCancelPolicy(true);
taskScheduler.setThreadNamePrefix("TaskSchedulerThreadPool-");
taskScheduler.initialize();
return taskScheduler;
}
}
package cn.datax.service.data.quality.config; package cn.datax.service.data.quality.config;
import cn.datax.common.core.DataConstant;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.service.ScheduleJobService;
import cn.datax.service.data.quality.schedule.CronTaskRegistrar;
import cn.datax.service.data.quality.schedule.SchedulingRunnable;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
...@@ -9,7 +18,9 @@ import org.springframework.stereotype.Component; ...@@ -9,7 +18,9 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List;
@Slf4j
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
public class StartedUpRunner implements ApplicationRunner { public class StartedUpRunner implements ApplicationRunner {
...@@ -17,6 +28,12 @@ public class StartedUpRunner implements ApplicationRunner { ...@@ -17,6 +28,12 @@ public class StartedUpRunner implements ApplicationRunner {
private final ConfigurableApplicationContext context; private final ConfigurableApplicationContext context;
private final Environment environment; private final Environment environment;
@Autowired
private CronTaskRegistrar cronTaskRegistrar;
@Autowired
private ScheduleJobService scheduleJobService;
@Override @Override
public void run(ApplicationArguments args) { public void run(ApplicationArguments args) {
if (context.isActive()) { if (context.isActive()) {
...@@ -26,6 +43,15 @@ public class StartedUpRunner implements ApplicationRunner { ...@@ -26,6 +43,15 @@ public class StartedUpRunner implements ApplicationRunner {
"端口号:" + environment.getProperty("server.port") + "\n" + "端口号:" + environment.getProperty("server.port") + "\n" +
"-----------------------------------------"; "-----------------------------------------";
System.out.println(banner); System.out.println(banner);
List<ScheduleJobEntity> list = scheduleJobService.list(Wrappers.<ScheduleJobEntity>lambdaQuery().eq(ScheduleJobEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
if (CollUtil.isNotEmpty(list)) {
list.stream().forEach(job -> {
SchedulingRunnable task = new SchedulingRunnable(job.getBeanName(), job.getMethodName(), job.getMethodParams());
cronTaskRegistrar.addCronTask(task, job.getCronExpression());
});
}
log.info("定时任务已加载完毕...");
} }
} }
} }
package cn.datax.service.data.quality.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.service.data.quality.api.entity.CheckReportEntity;
import cn.datax.service.data.quality.api.vo.CheckReportVo;
import cn.datax.service.data.quality.api.query.CheckReportQuery;
import cn.datax.service.data.quality.mapstruct.CheckReportMapper;
import cn.datax.service.data.quality.service.CheckReportService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 核查报告信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Api(tags = {"核查报告信息表"})
@RestController
@RequestMapping("/checkReports")
public class CheckReportController extends BaseController {
@Autowired
private CheckReportService checkReportService;
@Autowired
private CheckReportMapper checkReportMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getCheckReportById(@PathVariable String id) {
CheckReportEntity checkReportEntity = checkReportService.getCheckReportById(id);
return R.ok().setData(checkReportMapper.toVO(checkReportEntity));
}
/**
* 分页查询信息
*
* @param checkReportQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkReportQuery", value = "查询实体checkReportQuery", required = true, dataTypeClass = CheckReportQuery.class)
})
@GetMapping("/page")
public R getCheckReportPage(CheckReportQuery checkReportQuery) {
QueryWrapper<CheckReportEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(checkReportQuery.getRuleTypeId()), "r.rule_type_id", checkReportQuery.getRuleTypeId());
queryWrapper.like(StrUtil.isNotBlank(checkReportQuery.getRuleName()), "r.rule_name", checkReportQuery.getRuleName());
queryWrapper.like(StrUtil.isNotBlank(checkReportQuery.getRuleSource()), "r.rule_source", checkReportQuery.getRuleSource());
queryWrapper.like(StrUtil.isNotBlank(checkReportQuery.getRuleTable()), "r.rule_table", checkReportQuery.getRuleTable());
queryWrapper.like(StrUtil.isNotBlank(checkReportQuery.getRuleColumn()), "r.rule_column", checkReportQuery.getRuleColumn());
// 确定唯一核查报告
queryWrapper.eq("c.check_batch", "r.last_check_batch");
IPage<CheckReportEntity> page = checkReportService.page(new Page<>(checkReportQuery.getPageNum(), checkReportQuery.getPageSize()), queryWrapper);
List<CheckReportVo> collect = page.getRecords().stream().map(checkReportMapper::toVO).collect(Collectors.toList());
JsonPage<CheckReportVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
}
package cn.datax.service.data.quality.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.common.validate.ValidationGroups;
import cn.datax.service.data.quality.api.dto.CheckRuleDto;
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
import cn.datax.service.data.quality.api.vo.CheckRuleVo;
import cn.datax.service.data.quality.api.query.CheckRuleQuery;
import cn.datax.service.data.quality.mapstruct.CheckRuleMapper;
import cn.datax.service.data.quality.service.CheckRuleService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 核查规则信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Api(tags = {"核查规则信息表"})
@RestController
@RequestMapping("/checkRules")
public class CheckRuleController extends BaseController {
@Autowired
private CheckRuleService checkRuleService;
@Autowired
private CheckRuleMapper checkRuleMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getCheckRuleById(@PathVariable String id) {
CheckRuleEntity checkRuleEntity = checkRuleService.getCheckRuleById(id);
return R.ok().setData(checkRuleMapper.toVO(checkRuleEntity));
}
/**
* 分页查询信息
*
* @param checkRuleQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkRuleQuery", value = "查询实体checkRuleQuery", required = true, dataTypeClass = CheckRuleQuery.class)
})
@GetMapping("/page")
public R getCheckRulePage(CheckRuleQuery checkRuleQuery) {
QueryWrapper<CheckRuleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(checkRuleQuery.getRuleTypeId()), "r.rule_type_id", checkRuleQuery.getRuleTypeId());
queryWrapper.like(StrUtil.isNotBlank(checkRuleQuery.getRuleName()), "r.rule_name", checkRuleQuery.getRuleName());
queryWrapper.like(StrUtil.isNotBlank(checkRuleQuery.getRuleSource()), "r.rule_source", checkRuleQuery.getRuleSource());
queryWrapper.like(StrUtil.isNotBlank(checkRuleQuery.getRuleTable()), "r.rule_table", checkRuleQuery.getRuleTable());
queryWrapper.like(StrUtil.isNotBlank(checkRuleQuery.getRuleColumn()), "r.rule_column", checkRuleQuery.getRuleColumn());
IPage<CheckRuleEntity> page = checkRuleService.page(new Page<>(checkRuleQuery.getPageNum(), checkRuleQuery.getPageSize()), queryWrapper);
List<CheckRuleVo> collect = page.getRecords().stream().map(checkRuleMapper::toVO).collect(Collectors.toList());
JsonPage<CheckRuleVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
/**
* 添加
* @param checkRule
* @return
*/
@ApiOperation(value = "添加信息", notes = "根据checkRule对象添加信息")
@ApiImplicitParam(name = "checkRule", value = "详细实体checkRule", required = true, dataType = "CheckRuleDto")
@PostMapping()
public R saveCheckRule(@RequestBody @Validated({ValidationGroups.Insert.class}) CheckRuleDto checkRule) {
CheckRuleEntity checkRuleEntity = checkRuleService.saveCheckRule(checkRule);
return R.ok().setData(checkRuleMapper.toVO(checkRuleEntity));
}
/**
* 修改
* @param checkRule
* @return
*/
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "checkRule", value = "详细实体checkRule", required = true, dataType = "CheckRuleDto")
})
@PutMapping("/{id}")
public R updateCheckRule(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) CheckRuleDto checkRule) {
CheckRuleEntity checkRuleEntity = checkRuleService.updateCheckRule(checkRule);
return R.ok().setData(checkRuleMapper.toVO(checkRuleEntity));
}
/**
* 删除
* @param id
* @return
*/
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/{id}")
public R deleteCheckRuleById(@PathVariable String id) {
checkRuleService.deleteCheckRuleById(id);
return R.ok();
}
/**
* 批量删除
* @param ids
* @return
*/
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
@DeleteMapping("/batch/{ids}")
public R deleteCheckRuleBatch(@PathVariable List<String> ids) {
checkRuleService.deleteCheckRuleBatch(ids);
return R.ok();
}
}
package cn.datax.service.data.quality.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.service.data.quality.api.entity.RuleTypeEntity;
import cn.datax.service.data.quality.api.entity.RuleTypeReportEntity;
import cn.datax.service.data.quality.api.vo.RuleTypeVo;
import cn.datax.service.data.quality.api.query.RuleTypeQuery;
import cn.datax.service.data.quality.mapstruct.RuleTypeMapper;
import cn.datax.service.data.quality.service.RuleTypeService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 规则类型信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Api(tags = {"规则类型信息表"})
@RestController
@RequestMapping("/ruleTypes")
public class RuleTypeController extends BaseController {
@Autowired
private RuleTypeService ruleTypeService;
@Autowired
private RuleTypeMapper ruleTypeMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getRuleTypeById(@PathVariable String id) {
RuleTypeEntity ruleTypeEntity = ruleTypeService.getRuleTypeById(id);
return R.ok().setData(ruleTypeMapper.toVO(ruleTypeEntity));
}
@ApiOperation(value = "获取列表", notes = "")
@GetMapping("/list")
public R getRuleTypeList() {
List<RuleTypeEntity> list = ruleTypeService.list(Wrappers.emptyWrapper());
return R.ok().setData(list);
}
@ApiOperation(value = "获取列表", notes = "")
@GetMapping("/report/list")
public R getRuleTypeListForReport() {
List<RuleTypeReportEntity> list = ruleTypeService.getRuleTypeListForReport();
return R.ok().setData(list);
}
/**
* 分页查询信息
*
* @param ruleTypeQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "ruleTypeQuery", value = "查询实体ruleTypeQuery", required = true, dataTypeClass = RuleTypeQuery.class)
})
@GetMapping("/page")
public R getRuleTypePage(RuleTypeQuery ruleTypeQuery) {
QueryWrapper<RuleTypeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.like(StrUtil.isNotBlank(ruleTypeQuery.getName()), "name", ruleTypeQuery.getName());
IPage<RuleTypeEntity> page = ruleTypeService.page(new Page<>(ruleTypeQuery.getPageNum(), ruleTypeQuery.getPageSize()), queryWrapper);
List<RuleTypeVo> collect = page.getRecords().stream().map(ruleTypeMapper::toVO).collect(Collectors.toList());
JsonPage<RuleTypeVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
}
package cn.datax.service.data.quality.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.api.vo.ScheduleJobVo;
import cn.datax.service.data.quality.api.query.ScheduleJobQuery;
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
import cn.datax.service.data.quality.service.ScheduleJobService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 数据质量监控任务信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Api(tags = {"数据质量监控任务信息表"})
@RestController
@RequestMapping("/scheduleJobs")
public class ScheduleJobController extends BaseController {
@Autowired
private ScheduleJobService scheduleJobService;
@Autowired
private ScheduleJobMapper scheduleJobMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getScheduleJobById(@PathVariable String id) {
ScheduleJobEntity scheduleJobEntity = scheduleJobService.getScheduleJobById(id);
return R.ok().setData(scheduleJobMapper.toVO(scheduleJobEntity));
}
/**
* 分页查询信息
*
* @param scheduleJobQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "scheduleJobQuery", value = "查询实体scheduleJobQuery", required = true, dataTypeClass = ScheduleJobQuery.class)
})
@GetMapping("/page")
public R getScheduleJobPage(ScheduleJobQuery scheduleJobQuery) {
QueryWrapper<ScheduleJobEntity> queryWrapper = new QueryWrapper<>();
IPage<ScheduleJobEntity> page = scheduleJobService.page(new Page<>(scheduleJobQuery.getPageNum(), scheduleJobQuery.getPageSize()), queryWrapper);
List<ScheduleJobVo> collect = page.getRecords().stream().map(scheduleJobMapper::toVO).collect(Collectors.toList());
JsonPage<ScheduleJobVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
/**
* 暂停任务
* @param id
* @return
*/
@ApiOperation(value = "暂停任务", notes = "根据url的id来暂停指定任务")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@PostMapping("/pause/{id}")
public R pauseScheduleJobById(@PathVariable("id") String id) {
scheduleJobService.pauseScheduleJobById(id);
return R.ok();
}
/**
* 恢复任务
* @param id
* @return
*/
@ApiOperation(value = "恢复任务", notes = "根据url的id来恢复指定任务")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@PostMapping("/resume/{id}")
public R resumeScheduleJobById(@PathVariable("id") String id) {
scheduleJobService.resumeScheduleJobById(id);
return R.ok();
}
}
package cn.datax.service.data.quality.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.quality.api.entity.CheckReportEntity;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 核查报告信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper
public interface CheckReportDao extends BaseDao<CheckReportEntity> {
@Override
<E extends IPage<CheckReportEntity>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<CheckReportEntity> queryWrapper);
}
package cn.datax.service.data.quality.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 核查规则信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper
public interface CheckRuleDao extends BaseDao<CheckRuleEntity> {
@Override
<E extends IPage<CheckRuleEntity>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<CheckRuleEntity> queryWrapper);
}
package cn.datax.service.data.quality.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.quality.api.entity.RuleTypeEntity;
import cn.datax.service.data.quality.api.entity.RuleTypeReportEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 规则类型信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper
public interface RuleTypeDao extends BaseDao<RuleTypeEntity> {
List<RuleTypeReportEntity> selectListForReport();
}
package cn.datax.service.data.quality.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 数据质量监控任务信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Mapper
public interface ScheduleJobDao extends BaseDao<ScheduleJobEntity> {
}
package cn.datax.service.data.quality.mapstruct;
import cn.datax.service.data.quality.api.entity.CheckReportEntity;
import cn.datax.service.data.quality.api.vo.CheckReportVo;
import org.mapstruct.Mapper;
import java.util.List;
/**
* <p>
* 核查报告信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper(componentModel = "spring")
public interface CheckReportMapper {
/**
* 将源对象转换为VO对象
* @param e
* @return D
*/
CheckReportVo toVO(CheckReportEntity e);
/**
* 将源对象集合转换为VO对象集合
* @param es
* @return List<D>
*/
List<CheckReportVo> toVO(List<CheckReportEntity> es);
}
package cn.datax.service.data.quality.mapstruct;
import cn.datax.common.mapstruct.EntityMapper;
import cn.datax.service.data.quality.api.dto.CheckRuleDto;
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
import cn.datax.service.data.quality.api.vo.CheckRuleVo;
import org.mapstruct.Mapper;
/**
* <p>
* 核查规则信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper(componentModel = "spring")
public interface CheckRuleMapper extends EntityMapper<CheckRuleDto, CheckRuleEntity, CheckRuleVo> {
}
package cn.datax.service.data.quality.mapstruct;
import cn.datax.service.data.quality.api.entity.RuleTypeEntity;
import cn.datax.service.data.quality.api.vo.RuleTypeVo;
import org.mapstruct.Mapper;
import java.util.List;
/**
* <p>
* 规则类型信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper(componentModel = "spring")
public interface RuleTypeMapper {
/**
* 将源对象转换为VO对象
* @param e
* @return D
*/
RuleTypeVo toVO(RuleTypeEntity e);
/**
* 将源对象集合转换为VO对象集合
* @param es
* @return List<D>
*/
List<RuleTypeVo> toVO(List<RuleTypeEntity> es);
}
package cn.datax.service.data.quality.mapstruct;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.api.vo.ScheduleJobVo;
import org.mapstruct.Mapper;
import java.util.List;
/**
* <p>
* 数据质量监控任务信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Mapper(componentModel = "spring")
public interface ScheduleJobMapper {
/**
* 将源对象转换为VO对象
* @param e
* @return D
*/
ScheduleJobVo toVO(ScheduleJobEntity e);
/**
* 将源对象集合转换为VO对象集合
* @param es
* @return List<D>
*/
List<ScheduleJobVo> toVO(List<ScheduleJobEntity> es);
}
package cn.datax.service.data.quality.schedule;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.config.CronTask;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
public class CronTaskRegistrar implements DisposableBean {
private final Map<Runnable, ScheduledTask> scheduledTasks = new ConcurrentHashMap<>(8);
@Autowired
private TaskScheduler taskScheduler;
public TaskScheduler getScheduler() {
return this.taskScheduler;
}
public void addCronTask(Runnable task, String cronExpression) {
addCronTask(new CronTask(task, cronExpression));
}
public void addCronTask(CronTask cronTask) {
if (cronTask != null) {
Runnable task = cronTask.getRunnable();
if (this.scheduledTasks.containsKey(task)) {
removeCronTask(task);
}
this.scheduledTasks.put(task, scheduleCronTask(cronTask));
}
}
public void removeCronTask(Runnable task) {
ScheduledTask scheduledTask = this.scheduledTasks.remove(task);
if (scheduledTask != null) {
scheduledTask.cancel();
}
}
public ScheduledTask scheduleCronTask(CronTask cronTask) {
ScheduledTask scheduledTask = new ScheduledTask();
scheduledTask.future = this.taskScheduler.schedule(cronTask.getRunnable(), cronTask.getTrigger());
return scheduledTask;
}
@Override
public void destroy() {
for (ScheduledTask task : this.scheduledTasks.values()) {
task.cancel();
}
this.scheduledTasks.clear();
}
}
package cn.datax.service.data.quality.schedule;
import java.util.concurrent.ScheduledFuture;
public final class ScheduledTask {
volatile ScheduledFuture<?> future;
/**
* 取消定时任务
*/
public void cancel() {
ScheduledFuture<?> future = this.future;
if (future != null) {
future.cancel(true);
}
}
}
package cn.datax.service.data.quality.schedule;
import cn.datax.common.utils.SpringContextHolder;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Slf4j
public class SchedulingRunnable implements Runnable {
private String beanName;
private String methodName;
private String params;
public SchedulingRunnable(String beanName, String methodName) {
this(beanName, methodName, null);
}
public SchedulingRunnable(String beanName, String methodName, String params) {
this.beanName = beanName;
this.methodName = methodName;
this.params = params;
}
@Override
public void run() {
log.info("定时任务开始执行 - bean:{},方法:{},参数:{}", beanName, methodName, params);
long startTime = System.currentTimeMillis();
Map map = new HashMap();
String batch;
try {
Object target = SpringContextHolder.getBean(beanName);
Method method = target.getClass().getDeclaredMethod(methodName, Map.class);
if (StrUtil.isNotEmpty(params)) {
map = new ObjectMapper().readValue(params, Map.class);
}
batch = DateUtil.format(LocalDateTime.now(), DatePattern.PURE_DATETIME_PATTERN);
map.put("batch", batch);
ReflectionUtils.makeAccessible(method);
method.invoke(target, map);
} catch (Exception ex) {
log.error(String.format("定时任务执行异常 - bean:%s,方法:%s,参数:%s ", beanName, methodName, params), ex);
}
long times = System.currentTimeMillis() - startTime;
log.info("定时任务执行结束 - bean:{},方法:{},参数:{},耗时:{} 毫秒", beanName, methodName, params, times);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SchedulingRunnable that = (SchedulingRunnable) o;
if (params == null) {
return beanName.equals(that.beanName) &&
methodName.equals(that.methodName) &&
that.params == null;
}
return beanName.equals(that.beanName) &&
methodName.equals(that.methodName) &&
params.equals(that.params);
}
@Override
public int hashCode() {
if (params == null) {
return Objects.hash(beanName, methodName);
}
return Objects.hash(beanName, methodName, params);
}
}
package cn.datax.service.data.quality.schedule.task;
import cn.datax.common.core.DataConstant;
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
import cn.datax.service.data.quality.service.CheckRuleService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Slf4j
@Component("qualityTask")
public class QualityTask {
@Autowired
private CheckRuleService checkRuleService;
public void task(Map map) {
System.out.println("执行批次:" + map);
// 获取可执行的核查规则
List<CheckRuleEntity> list = checkRuleService.list(Wrappers.<CheckRuleEntity>lambdaQuery().eq(CheckRuleEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
int poolSize = list.size();
// 定义固定长度的线程池
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(poolSize, poolSize, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(16),
new BasicThreadFactory.Builder().namingPattern("executor-schedule-pool-%d").daemon(true).build());
// 定义计数器
final CountDownLatch latch = new CountDownLatch(poolSize);
list.stream().forEach(s -> {
threadPoolExecutor.execute(() -> {
log.info(s.getRuleName() + ":" + LocalDateTime.now());
latch.countDown();
});
});
// 主线程阻塞,等待所有子线程执行完成
try {
latch.await();
} catch (InterruptedException e) {}
// 关闭线程池
threadPoolExecutor.shutdown();
}
}
package cn.datax.service.data.quality.service;
import cn.datax.service.data.quality.api.entity.CheckReportEntity;
import cn.datax.common.base.BaseService;
/**
* <p>
* 核查报告信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
public interface CheckReportService extends BaseService<CheckReportEntity> {
CheckReportEntity getCheckReportById(String id);
}
package cn.datax.service.data.quality.service;
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
import cn.datax.service.data.quality.api.dto.CheckRuleDto;
import cn.datax.common.base.BaseService;
import java.util.List;
/**
* <p>
* 核查规则信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
public interface CheckRuleService extends BaseService<CheckRuleEntity> {
CheckRuleEntity saveCheckRule(CheckRuleDto checkRule);
CheckRuleEntity updateCheckRule(CheckRuleDto checkRule);
CheckRuleEntity getCheckRuleById(String id);
void deleteCheckRuleById(String id);
void deleteCheckRuleBatch(List<String> ids);
}
package cn.datax.service.data.quality.service;
import cn.datax.service.data.quality.api.entity.RuleTypeEntity;
import cn.datax.common.base.BaseService;
import cn.datax.service.data.quality.api.entity.RuleTypeReportEntity;
import java.util.List;
/**
* <p>
* 规则类型信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
public interface RuleTypeService extends BaseService<RuleTypeEntity> {
RuleTypeEntity getRuleTypeById(String id);
List<RuleTypeReportEntity> getRuleTypeListForReport();
}
package cn.datax.service.data.quality.service;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.common.base.BaseService;
/**
* <p>
* 数据质量监控任务信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
public interface ScheduleJobService extends BaseService<ScheduleJobEntity> {
ScheduleJobEntity getScheduleJobById(String id);
void pauseScheduleJobById(String id);
void resumeScheduleJobById(String id);
}
package cn.datax.service.data.quality.service.impl;
import cn.datax.service.data.quality.api.entity.CheckReportEntity;
import cn.datax.service.data.quality.service.CheckReportService;
import cn.datax.service.data.quality.mapstruct.CheckReportMapper;
import cn.datax.service.data.quality.dao.CheckReportDao;
import cn.datax.common.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 核查报告信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class CheckReportServiceImpl extends BaseServiceImpl<CheckReportDao, CheckReportEntity> implements CheckReportService {
@Autowired
private CheckReportDao checkReportDao;
@Autowired
private CheckReportMapper checkReportMapper;
@Override
public CheckReportEntity getCheckReportById(String id) {
CheckReportEntity checkReportEntity = super.getById(id);
return checkReportEntity;
}
}
package cn.datax.service.data.quality.service.impl;
import cn.datax.service.data.quality.api.entity.CheckRuleEntity;
import cn.datax.service.data.quality.api.dto.CheckRuleDto;
import cn.datax.service.data.quality.service.CheckRuleService;
import cn.datax.service.data.quality.mapstruct.CheckRuleMapper;
import cn.datax.service.data.quality.dao.CheckRuleDao;
import cn.datax.common.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 核查规则信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class CheckRuleServiceImpl extends BaseServiceImpl<CheckRuleDao, CheckRuleEntity> implements CheckRuleService {
@Autowired
private CheckRuleDao checkRuleDao;
@Autowired
private CheckRuleMapper checkRuleMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public CheckRuleEntity saveCheckRule(CheckRuleDto checkRuleDto) {
CheckRuleEntity checkRule = checkRuleMapper.toEntity(checkRuleDto);
checkRuleDao.insert(checkRule);
return checkRule;
}
@Override
@Transactional(rollbackFor = Exception.class)
public CheckRuleEntity updateCheckRule(CheckRuleDto checkRuleDto) {
CheckRuleEntity checkRule = checkRuleMapper.toEntity(checkRuleDto);
checkRuleDao.updateById(checkRule);
return checkRule;
}
@Override
public CheckRuleEntity getCheckRuleById(String id) {
CheckRuleEntity checkRuleEntity = super.getById(id);
return checkRuleEntity;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteCheckRuleById(String id) {
checkRuleDao.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteCheckRuleBatch(List<String> ids) {
checkRuleDao.deleteBatchIds(ids);
}
}
package cn.datax.service.data.quality.service.impl;
import cn.datax.service.data.quality.api.entity.RuleTypeEntity;
import cn.datax.service.data.quality.api.entity.RuleTypeReportEntity;
import cn.datax.service.data.quality.service.RuleTypeService;
import cn.datax.service.data.quality.mapstruct.RuleTypeMapper;
import cn.datax.service.data.quality.dao.RuleTypeDao;
import cn.datax.common.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 规则类型信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class RuleTypeServiceImpl extends BaseServiceImpl<RuleTypeDao, RuleTypeEntity> implements RuleTypeService {
@Autowired
private RuleTypeDao ruleTypeDao;
@Autowired
private RuleTypeMapper ruleTypeMapper;
@Override
public RuleTypeEntity getRuleTypeById(String id) {
RuleTypeEntity ruleTypeEntity = super.getById(id);
return ruleTypeEntity;
}
@Override
public List<RuleTypeReportEntity> getRuleTypeListForReport() {
List<RuleTypeReportEntity> list = ruleTypeDao.selectListForReport();
return list;
}
}
package cn.datax.service.data.quality.service.impl;
import cn.datax.common.core.DataConstant;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.schedule.CronTaskRegistrar;
import cn.datax.service.data.quality.schedule.SchedulingRunnable;
import cn.datax.service.data.quality.service.ScheduleJobService;
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
import cn.datax.service.data.quality.dao.ScheduleJobDao;
import cn.datax.common.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 数据质量监控任务信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
@Autowired
private ScheduleJobDao scheduleJobDao;
@Autowired
private ScheduleJobMapper scheduleJobMapper;
@Autowired
private CronTaskRegistrar cronTaskRegistrar;
@Override
public ScheduleJobEntity getScheduleJobById(String id) {
ScheduleJobEntity scheduleJobEntity = super.getById(id);
return scheduleJobEntity;
}
@Override
public void pauseScheduleJobById(String id) {
ScheduleJobEntity scheduleJobEntity = super.getById(id);
SchedulingRunnable task = new SchedulingRunnable(scheduleJobEntity.getBeanName(), scheduleJobEntity.getMethodName(), scheduleJobEntity.getMethodParams());
cronTaskRegistrar.removeCronTask(task);
scheduleJobEntity.setStatus(DataConstant.TrueOrFalse.FALSE.getKey());
scheduleJobDao.updateById(scheduleJobEntity);
}
@Override
public void resumeScheduleJobById(String id) {
ScheduleJobEntity scheduleJobEntity = super.getById(id);
SchedulingRunnable task = new SchedulingRunnable(scheduleJobEntity.getBeanName(), scheduleJobEntity.getMethodName(), scheduleJobEntity.getMethodParams());
cronTaskRegistrar.addCronTask(task, scheduleJobEntity.getCronExpression());
scheduleJobEntity.setStatus(DataConstant.TrueOrFalse.TRUE.getKey());
scheduleJobDao.updateById(scheduleJobEntity);
}
}
<?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="cn.datax.service.data.quality.dao.CheckReportDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.quality.api.entity.CheckReportEntity">
<result column="id" property="id" />
<result column="check_rule_id" property="checkRuleId" />
<result column="check_date" property="checkDate" />
<result column="check_result" property="checkResult" />
<result column="check_total_count" property="checkTotalCount" />
<result column="check_error_count" property="checkErrorCount" />
<result column="check_batch" property="checkBatch" />
</resultMap>
<resultMap id="ExtendResultMap" type="cn.datax.service.data.quality.api.entity.CheckReportEntity" extends="BaseResultMap">
<result column="rule_name" property="ruleName" />
<result column="rule_type" property="ruleType" />
<result column="rule_source" property="ruleSource" />
<result column="rule_table" property="ruleTable" />
<result column="rule_column" property="ruleColumn" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
check_rule_id, check_date, check_result, check_total_count, check_error_count, check_batch
</sql>
<sql id="Report_Column_List">
${alias}.id,
${alias}.check_rule_id, ${alias}.check_date, ${alias}.check_result, ${alias}.check_total_count, ${alias}.check_error_count, ${alias}.check_batch
</sql>
<select id="selectPage" resultMap="ExtendResultMap">
SELECT r.rule_name, t.name as rule_type, r.rule_source, r.rule_table, r.rule_column,
<include refid="Report_Column_List"><property name="alias" value="c"/></include>
FROM quality_check_report c
LEFT JOIN quality_check_rule r ON r.id = c.check_rule_id
LEFT JOIN quality_rule_type t ON t.id = r.rule_type_id
${ew.customSqlSegment}
</select>
</mapper>
<?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="cn.datax.service.data.quality.dao.CheckRuleDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.quality.api.entity.CheckRuleEntity">
<result column="id" property="id" />
<result column="status" property="status" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="create_dept" property="createDept" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="remark" property="remark" />
<result column="rule_name" property="ruleName" />
<result column="rule_type_id" property="ruleTypeId" />
<result column="rule_type" property="ruleType" />
<result column="rule_level" property="ruleLevel" />
<result column="rule_source_id" property="ruleSourceId" />
<result column="rule_source" property="ruleSource" />
<result column="rule_table_id" property="ruleTableId" />
<result column="rule_table" property="ruleTable" />
<result column="rule_table_comment" property="ruleTableComment" />
<result column="rule_column_id" property="ruleColumnId" />
<result column="rule_column" property="ruleColumn" />
<result column="rule_column_comment" property="ruleColumnComment" />
<result column="rule_sql" property="ruleSql" />
<result column="last_check_batch" property="lastCheckBatch" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
status,
create_by,
create_time,
create_dept,
update_by,
update_time,
remark,
rule_name, rule_type_id, rule_level, rule_source_id, rule_source, rule_table_id, rule_table, rule_table_comment
rule_column_id, rule_column, rule_column_comment, rule_sql, last_check_batch
</sql>
<sql id="Rule_Column_List">
${alias}.id,
${alias}.status,
${alias}.create_by,
${alias}.create_time,
${alias}.create_dept,
${alias}.update_by,
${alias}.update_time,
${alias}.remark,
${alias}.rule_name, ${alias}.rule_type_id, ${alias}.rule_level, ${alias}.rule_source_id, ${alias}.rule_source,
${alias}.rule_table_id, ${alias}.rule_table, ${alias}.rule_table_comment, ${alias}.rule_column_id, ${alias}.rule_column, ${alias}.rule_column_comment, ${alias}.rule_sql, ${alias}.last_check_batch
</sql>
<select id="selectPage" resultMap="BaseResultMap">
SELECT t.name as rule_type,
<include refid="Rule_Column_List"><property name="alias" value="r"/></include>
FROM quality_check_rule r
LEFT JOIN quality_rule_type t ON t.id = r.rule_type_id
${ew.customSqlSegment}
</select>
</mapper>
<?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="cn.datax.service.data.quality.dao.RuleTypeDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.quality.api.entity.RuleTypeEntity">
<result column="id" property="id" />
<result column="name" property="name" />
</resultMap>
<resultMap id="ExtendResultMap" type="cn.datax.service.data.quality.api.entity.RuleTypeReportEntity" extends="BaseResultMap">
<result column="check_error_count" property="checkErrorCount" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
name
</sql>
<select id="selectListForReport" resultMap="ExtendResultMap">
SELECT t.id, t.name,
(SELECT COALESCE(SUM(c.check_error_count), 0) FROM quality_check_rule r
LEFT JOIN quality_check_report c ON c.check_rule_id = r.id AND c.check_batch = r.last_check_batch
WHERE r.rule_type_id = t.id AND r.status = 1) AS check_error_count
FROM quality_rule_type t
</select>
</mapper>
<?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="cn.datax.service.data.quality.dao.ScheduleJobDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.quality.api.entity.ScheduleJobEntity">
<result column="id" property="id" />
<result column="status" property="status" />
<result column="job_name" property="jobName" />
<result column="bean_name" property="beanName" />
<result column="method_name" property="methodName" />
<result column="method_params" property="methodParams" />
<result column="cron_expression" property="cronExpression" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
status,
job_name, bean_name, method_name, method_params, cron_expression
</sql>
</mapper>
package cn.datax.service.data.standard.api.dto;
import cn.datax.common.validate.ValidationGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
* 字典对照信息表 实体DTO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@ApiModel(value = "字典对照信息表Model")
@Data
public class ContrastDictDto implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键ID")
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
private String id;
@ApiModelProperty(value = "字典对照主键")
private String contrastId;
@ApiModelProperty(value = "字典编码")
private String colCode;
@ApiModelProperty(value = "字典名称")
private String colName;
@ApiModelProperty(value = "状态")
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String status;
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.datax.service.data.standard.api.dto;
import cn.datax.common.validate.ValidationGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* <p>
* 对照表信息表 实体DTO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@ApiModel(value = "对照表信息表Model")
@Data
public class ContrastDto implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键ID")
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
private String id;
@ApiModelProperty(value = "数据源主键")
private String sourceId;
@ApiModelProperty(value = "数据源")
private String sourceName;
@ApiModelProperty(value = "数据表主键")
private String tableId;
@ApiModelProperty(value = "数据表")
private String tableName;
@ApiModelProperty(value = "数据表名称")
private String tableComment;
@ApiModelProperty(value = "对照字段主键")
private String columnId;
@ApiModelProperty(value = "对照字段")
private String columnName;
@ApiModelProperty(value = "对照字段名称")
private String columnComment;
@ApiModelProperty(value = "标准类别主键")
private String gbTypeId;
@ApiModelProperty(value = "绑定标准字段")
private String bindGbColumn;
}
package cn.datax.service.data.standard.api.entity;
import cn.datax.common.base.DataScopeBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 字典对照信息表
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "standard_contrast_dict", autoResultMap = true)
public class ContrastDictEntity extends DataScopeBaseEntity {
private static final long serialVersionUID=1L;
/**
* 字典对照主键
*/
private String contrastId;
/**
* 数据源
*/
@TableField(exist = false)
private String sourceName;
/**
* 数据表
*/
@TableField(exist = false)
private String tableName;
/**
* 对照字段
*/
@TableField(exist = false)
private String columnName;
/**
* 标准类别编码
*/
@TableField(exist = false)
private String gbTypeCode;
/**
* 标准类别名称
*/
@TableField(exist = false)
private String gbTypeName;
/**
* 字典编码
*/
private String colCode;
/**
* 字典名称
*/
private String colName;
/**
* 对照的标准字典
*/
private String contrastGbId;
/**
* 对照的标准编码
*/
@TableField(exist = false)
private String contrastGbCode;
/**
* 对照的标准名称
*/
@TableField(exist = false)
private String contrastGbName;
}
package cn.datax.service.data.standard.api.entity;
import cn.datax.common.base.DataScopeBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 对照表信息表
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "standard_contrast", autoResultMap = true)
public class ContrastEntity extends DataScopeBaseEntity {
private static final long serialVersionUID=1L;
/**
* 数据源主键
*/
private String sourceId;
/**
* 数据源
*/
private String sourceName;
/**
* 数据表主键
*/
private String tableId;
/**
* 数据表
*/
private String tableName;
/**
* 数据表名称
*/
private String tableComment;
/**
* 对照字段主键
*/
private String columnId;
/**
* 对照字段
*/
private String columnName;
/**
* 对照字段名称
*/
private String columnComment;
/**
* 标准类别主键
*/
private String gbTypeId;
/**
* 标准类别编码
*/
@TableField(exist = false)
private String gbTypeCode;
/**
* 标准类别名称
*/
@TableField(exist = false)
private String gbTypeName;
/**
* 绑定标准字段
*/
private String bindGbColumn;
}
package cn.datax.service.data.standard.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 字典对照信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ContrastDictQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
private String contrastId;
private String colCode;
private String colName;
}
package cn.datax.service.data.standard.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 对照表信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ContrastQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
}
package cn.datax.service.data.standard.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 字典对照信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
public class ContrastDictVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String contrastId;
private String colCode;
private String colName;
private String contrastGbId;
private String contrastGbCode;
private String contrastGbName;
private String sourceName;
private String tableName;
private String columnName;
private String gbTypeCode;
private String gbTypeName;
}
package cn.datax.service.data.standard.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class ContrastTreeVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String label;
private String name;
/**
* 数据
*/
private Object data;
private List<ContrastTreeVo> children;
}
package cn.datax.service.data.standard.api.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 对照表信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Data
public class ContrastVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
private String remark;
private String sourceId;
private String sourceName;
private String tableId;
private String tableName;
private String tableComment;
private String columnId;
private String columnName;
private String columnComment;
private String gbTypeId;
private String gbTypeCode;
private String gbTypeName;
private String bindGbColumn;
}
...@@ -23,6 +23,7 @@ public class DictVo implements Serializable { ...@@ -23,6 +23,7 @@ public class DictVo implements Serializable {
private String status; private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime; private LocalDateTime createTime;
private String remark;
private String typeId; private String typeId;
private String gbTypeCode; private String gbTypeCode;
private String gbTypeName; private String gbTypeName;
......
...@@ -23,7 +23,7 @@ public class TypeVo implements Serializable { ...@@ -23,7 +23,7 @@ public class TypeVo implements Serializable {
private String status; private String status;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime; private LocalDateTime createTime;
private String createDept; private String remark;
private String gbTypeCode; private String gbTypeCode;
private String gbTypeName; private String gbTypeName;
} }
package cn.datax.service.data.standard.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.common.validate.ValidationGroups;
import cn.datax.service.data.standard.api.dto.ContrastDto;
import cn.datax.service.data.standard.api.entity.ContrastEntity;
import cn.datax.service.data.standard.api.vo.ContrastTreeVo;
import cn.datax.service.data.standard.api.vo.ContrastVo;
import cn.datax.service.data.standard.api.query.ContrastQuery;
import cn.datax.service.data.standard.mapstruct.ContrastMapper;
import cn.datax.service.data.standard.service.ContrastService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 对照表信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Api(tags = {"对照表信息表"})
@RestController
@RequestMapping("/contrasts")
public class ContrastController extends BaseController {
@Autowired
private ContrastService contrastService;
@Autowired
private ContrastMapper contrastMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getContrastById(@PathVariable String id) {
ContrastEntity contrastEntity = contrastService.getContrastById(id);
return R.ok().setData(contrastMapper.toVO(contrastEntity));
}
/**
* 分页查询信息
*
* @param contrastQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "contrastQuery", value = "查询实体contrastQuery", required = true, dataTypeClass = ContrastQuery.class)
})
@GetMapping("/page")
public R getContrastPage(ContrastQuery contrastQuery) {
QueryWrapper<ContrastEntity> queryWrapper = new QueryWrapper<>();
IPage<ContrastEntity> page = contrastService.page(new Page<>(contrastQuery.getPageNum(), contrastQuery.getPageSize()), queryWrapper);
List<ContrastVo> collect = page.getRecords().stream().map(contrastMapper::toVO).collect(Collectors.toList());
JsonPage<ContrastVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
/**
* 添加
* @param contrast
* @return
*/
@ApiOperation(value = "添加信息", notes = "根据contrast对象添加信息")
@ApiImplicitParam(name = "contrast", value = "详细实体contrast", required = true, dataType = "ContrastDto")
@PostMapping()
public R saveContrast(@RequestBody @Validated({ValidationGroups.Insert.class}) ContrastDto contrast) {
ContrastEntity contrastEntity = contrastService.saveContrast(contrast);
return R.ok().setData(contrastMapper.toVO(contrastEntity));
}
/**
* 修改
* @param contrast
* @return
*/
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "contrast", value = "详细实体contrast", required = true, dataType = "ContrastDto")
})
@PutMapping("/{id}")
public R updateContrast(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ContrastDto contrast) {
ContrastEntity contrastEntity = contrastService.updateContrast(contrast);
return R.ok().setData(contrastMapper.toVO(contrastEntity));
}
/**
* 删除
* @param id
* @return
*/
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/{id}")
public R deleteContrastById(@PathVariable String id) {
contrastService.deleteContrastById(id);
return R.ok();
}
/**
* 批量删除
* @param ids
* @return
*/
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
@DeleteMapping("/batch/{ids}")
public R deleteContrastBatch(@PathVariable List<String> ids) {
contrastService.deleteContrastBatch(ids);
return R.ok();
}
@GetMapping("/tree")
public R getContrastTree() {
List<ContrastTreeVo> list = contrastService.getContrastTree();
return R.ok().setData(list);
}
}
package cn.datax.service.data.standard.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.common.validate.ValidationGroups;
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
import cn.datax.service.data.standard.api.vo.ContrastDictVo;
import cn.datax.service.data.standard.api.query.ContrastDictQuery;
import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
import cn.datax.service.data.standard.service.ContrastDictService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 字典对照信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Api(tags = {"字典对照信息表"})
@RestController
@RequestMapping("/contrastDicts")
public class ContrastDictController extends BaseController {
@Autowired
private ContrastDictService contrastDictService;
@Autowired
private ContrastDictMapper contrastDictMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getContrastDictById(@PathVariable String id) {
ContrastDictEntity contrastDictEntity = contrastDictService.getContrastDictById(id);
return R.ok().setData(contrastDictMapper.toVO(contrastDictEntity));
}
/**
* 分页查询信息
*
* @param contrastDictQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "contrastDictQuery", value = "查询实体contrastDictQuery", required = true, dataTypeClass = ContrastDictQuery.class)
})
@GetMapping("/page")
public R getContrastDictPage(ContrastDictQuery contrastDictQuery) {
QueryWrapper<ContrastDictEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(contrastDictQuery.getContrastId()), "d.contrast_id", contrastDictQuery.getContrastId());
queryWrapper.like(StrUtil.isNotBlank(contrastDictQuery.getColCode()), "d.col_code", contrastDictQuery.getColCode());
queryWrapper.like(StrUtil.isNotBlank(contrastDictQuery.getColName()), "d.col_name", contrastDictQuery.getColName());
IPage<ContrastDictEntity> page = contrastDictService.page(new Page<>(contrastDictQuery.getPageNum(), contrastDictQuery.getPageSize()), queryWrapper);
List<ContrastDictVo> collect = page.getRecords().stream().map(contrastDictMapper::toVO).collect(Collectors.toList());
JsonPage<ContrastDictVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
/**
* 添加
* @param contrastDict
* @return
*/
@ApiOperation(value = "添加信息", notes = "根据contrastDict对象添加信息")
@ApiImplicitParam(name = "contrastDict", value = "详细实体contrastDict", required = true, dataType = "ContrastDictDto")
@PostMapping()
public R saveContrastDict(@RequestBody @Validated({ValidationGroups.Insert.class}) ContrastDictDto contrastDict) {
ContrastDictEntity contrastDictEntity = contrastDictService.saveContrastDict(contrastDict);
return R.ok().setData(contrastDictMapper.toVO(contrastDictEntity));
}
/**
* 修改
* @param contrastDict
* @return
*/
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "contrastDict", value = "详细实体contrastDict", required = true, dataType = "ContrastDictDto")
})
@PutMapping("/{id}")
public R updateContrastDict(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ContrastDictDto contrastDict) {
ContrastDictEntity contrastDictEntity = contrastDictService.updateContrastDict(contrastDict);
return R.ok().setData(contrastDictMapper.toVO(contrastDictEntity));
}
/**
* 删除
* @param id
* @return
*/
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/{id}")
public R deleteContrastDictById(@PathVariable String id) {
contrastDictService.deleteContrastDictById(id);
return R.ok();
}
/**
* 批量删除
* @param ids
* @return
*/
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
@DeleteMapping("/batch/{ids}")
public R deleteContrastDictBatch(@PathVariable List<String> ids) {
contrastDictService.deleteContrastDictBatch(ids);
return R.ok();
}
}
package cn.datax.service.data.standard.controller;
import cn.datax.common.base.BaseController;
import cn.datax.common.core.R;
import cn.datax.service.data.standard.service.DictMappingService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Api(tags = {"字典对照映射"})
@RestController
@RequestMapping("/mappings")
public class DictMappingController extends BaseController {
@Autowired
private DictMappingService dictMappingService;
@GetMapping("/{id}")
public R getDictMapping(@PathVariable String id) {
Map<String, Object> map = dictMappingService.getDictMapping(id);
return R.ok().setData(map);
}
@PostMapping("/auto/{id}")
public R dictAutoMapping(@PathVariable String id) {
dictMappingService.dictAutoMapping(id);
return R.ok();
}
@PostMapping("/manual/{id}")
public R dictManualMapping(@PathVariable String id) {
dictMappingService.dictManualMapping(id);
return R.ok();
}
}
package cn.datax.service.data.standard.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.standard.api.entity.ContrastEntity;
import org.apache.ibatis.annotations.Mapper;
import java.io.Serializable;
/**
* <p>
* 对照表信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper
public interface ContrastDao extends BaseDao<ContrastEntity> {
@Override
ContrastEntity selectById(Serializable id);
}
package cn.datax.service.data.standard.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* 字典对照信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper
public interface ContrastDictDao extends BaseDao<ContrastDictEntity> {
@Override
List<ContrastDictEntity> selectList(@Param(Constants.WRAPPER) Wrapper<ContrastDictEntity> queryWrapper);
@Override
<E extends IPage<ContrastDictEntity>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<ContrastDictEntity> queryWrapper);
}
package cn.datax.service.data.standard.mapstruct;
import cn.datax.common.mapstruct.EntityMapper;
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
import cn.datax.service.data.standard.api.vo.ContrastDictVo;
import org.mapstruct.Mapper;
/**
* <p>
* 字典对照信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper(componentModel = "spring")
public interface ContrastDictMapper extends EntityMapper<ContrastDictDto, ContrastDictEntity, ContrastDictVo> {
}
package cn.datax.service.data.standard.mapstruct;
import cn.datax.common.mapstruct.EntityMapper;
import cn.datax.service.data.standard.api.dto.ContrastDto;
import cn.datax.service.data.standard.api.entity.ContrastEntity;
import cn.datax.service.data.standard.api.vo.ContrastVo;
import org.mapstruct.Mapper;
/**
* <p>
* 对照表信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Mapper(componentModel = "spring")
public interface ContrastMapper extends EntityMapper<ContrastDto, ContrastEntity, ContrastVo> {
}
package cn.datax.service.data.standard.service;
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
import cn.datax.common.base.BaseService;
import java.util.List;
/**
* <p>
* 字典对照信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
public interface ContrastDictService extends BaseService<ContrastDictEntity> {
ContrastDictEntity saveContrastDict(ContrastDictDto contrastDict);
ContrastDictEntity updateContrastDict(ContrastDictDto contrastDict);
ContrastDictEntity getContrastDictById(String id);
void deleteContrastDictById(String id);
void deleteContrastDictBatch(List<String> ids);
}
package cn.datax.service.data.standard.service;
import cn.datax.service.data.standard.api.entity.ContrastEntity;
import cn.datax.service.data.standard.api.dto.ContrastDto;
import cn.datax.common.base.BaseService;
import cn.datax.service.data.standard.api.vo.ContrastTreeVo;
import java.util.List;
/**
* <p>
* 对照表信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
public interface ContrastService extends BaseService<ContrastEntity> {
ContrastEntity saveContrast(ContrastDto contrast);
ContrastEntity updateContrast(ContrastDto contrast);
ContrastEntity getContrastById(String id);
void deleteContrastById(String id);
void deleteContrastBatch(List<String> ids);
List<ContrastTreeVo> getContrastTree();
}
package cn.datax.service.data.standard.service;
import java.util.Map;
public interface DictMappingService {
Map<String, Object> getDictMapping(String id);
void dictAutoMapping(String id);
void dictManualMapping(String id);
}
package cn.datax.service.data.standard.service.impl;
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
import cn.datax.service.data.standard.service.ContrastDictService;
import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
import cn.datax.service.data.standard.dao.ContrastDictDao;
import cn.datax.common.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 字典对照信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ContrastDictServiceImpl extends BaseServiceImpl<ContrastDictDao, ContrastDictEntity> implements ContrastDictService {
@Autowired
private ContrastDictDao contrastDictDao;
@Autowired
private ContrastDictMapper contrastDictMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public ContrastDictEntity saveContrastDict(ContrastDictDto contrastDictDto) {
ContrastDictEntity contrastDict = contrastDictMapper.toEntity(contrastDictDto);
contrastDictDao.insert(contrastDict);
return contrastDict;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ContrastDictEntity updateContrastDict(ContrastDictDto contrastDictDto) {
ContrastDictEntity contrastDict = contrastDictMapper.toEntity(contrastDictDto);
contrastDictDao.updateById(contrastDict);
return contrastDict;
}
@Override
public ContrastDictEntity getContrastDictById(String id) {
ContrastDictEntity contrastDictEntity = super.getById(id);
return contrastDictEntity;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteContrastDictById(String id) {
contrastDictDao.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteContrastDictBatch(List<String> ids) {
contrastDictDao.deleteBatchIds(ids);
}
}
package cn.datax.service.data.standard.service.impl;
import cn.datax.service.data.standard.api.entity.ContrastEntity;
import cn.datax.service.data.standard.api.dto.ContrastDto;
import cn.datax.service.data.standard.api.vo.ContrastTreeVo;
import cn.datax.service.data.standard.service.ContrastService;
import cn.datax.service.data.standard.mapstruct.ContrastMapper;
import cn.datax.service.data.standard.dao.ContrastDao;
import cn.datax.common.base.BaseServiceImpl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
* 对照表信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-27
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ContrastServiceImpl extends BaseServiceImpl<ContrastDao, ContrastEntity> implements ContrastService {
@Autowired
private ContrastDao contrastDao;
@Autowired
private ContrastMapper contrastMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public ContrastEntity saveContrast(ContrastDto contrastDto) {
ContrastEntity contrast = contrastMapper.toEntity(contrastDto);
contrastDao.insert(contrast);
return contrast;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ContrastEntity updateContrast(ContrastDto contrastDto) {
ContrastEntity contrast = contrastMapper.toEntity(contrastDto);
contrastDao.updateById(contrast);
return contrast;
}
@Override
public ContrastEntity getContrastById(String id) {
ContrastEntity contrastEntity = super.getById(id);
return contrastEntity;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteContrastById(String id) {
contrastDao.deleteById(id);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteContrastBatch(List<String> ids) {
contrastDao.deleteBatchIds(ids);
}
@Override
public List<ContrastTreeVo> getContrastTree() {
List<ContrastTreeVo> list = new ArrayList<>();
List<ContrastEntity> contrastEntityList = contrastDao.selectList(Wrappers.emptyWrapper());
Map<String, List<ContrastEntity>> sourceMap = contrastEntityList.stream().collect(Collectors.groupingBy(ContrastEntity::getSourceId));
Iterator<Map.Entry<String, List<ContrastEntity>>> sourceIterator = sourceMap.entrySet().iterator();
while (sourceIterator.hasNext()) {
Map.Entry<String, List<ContrastEntity>> sourceEntry = sourceIterator.next();
String sourceId = sourceEntry.getKey();
List<ContrastEntity> sourceList = sourceEntry.getValue();
String sourceName = sourceList.get(0).getSourceName();
ContrastTreeVo sourceTree = new ContrastTreeVo();
sourceTree.setId(sourceId);
sourceTree.setLabel(sourceName);
Map<String, List<ContrastEntity>> tableMap = sourceList.stream().collect(Collectors.groupingBy(ContrastEntity::getTableId));
Iterator<Map.Entry<String, List<ContrastEntity>>> tableIterator = tableMap.entrySet().iterator();
List<ContrastTreeVo> tableTreeList = new ArrayList<>();
while (tableIterator.hasNext()) {
Map.Entry<String, List<ContrastEntity>> tableEntry = tableIterator.next();
String tableId = tableEntry.getKey();
List<ContrastEntity> tableList = tableEntry.getValue();
String tableName = tableList.get(0).getTableName();
String tableComment = tableList.get(0).getTableComment();
ContrastTreeVo tableTree = new ContrastTreeVo();
tableTree.setId(tableId);
tableTree.setLabel(tableName);
tableTree.setName(tableComment);
List<ContrastTreeVo> columnTreeList = tableList.stream().map(s -> {
ContrastTreeVo columnTree = new ContrastTreeVo();
columnTree.setId(s.getId());
columnTree.setLabel(s.getColumnName());
columnTree.setName(s.getColumnComment());
columnTree.setData(s);
return columnTree;
}).collect(Collectors.toList());
tableTree.setChildren(columnTreeList);
tableTreeList.add(tableTree);
}
sourceTree.setChildren(tableTreeList);
list.add(sourceTree);
}
return list;
}
}
package cn.datax.service.data.standard.service.impl;
import cn.datax.common.core.DataConstant;
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
import cn.datax.service.data.standard.api.entity.ContrastEntity;
import cn.datax.service.data.standard.api.entity.DictEntity;
import cn.datax.service.data.standard.api.vo.ContrastDictVo;
import cn.datax.service.data.standard.api.vo.DictVo;
import cn.datax.service.data.standard.dao.ContrastDao;
import cn.datax.service.data.standard.dao.ContrastDictDao;
import cn.datax.service.data.standard.dao.DictDao;
import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
import cn.datax.service.data.standard.mapstruct.DictMapper;
import cn.datax.service.data.standard.service.DictMappingService;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
public class DictMappingServiceImpl implements DictMappingService {
@Autowired
private ContrastDao contrastDao;
@Autowired
private ContrastDictDao contrastDictDao;
@Autowired
private ContrastDictMapper contrastDictMapper;
@Autowired
private DictDao dictDao;
@Autowired
private DictMapper dictMapper;
private static String BIND_GB_CODE = "gb_code";
private static String BIND_GB_NAME = "gb_name";
@Override
public Map<String, Object> getDictMapping(String id) {
ContrastEntity contrastEntity = contrastDao.selectById(id);
String contrastId = contrastEntity.getId();
String gbTypeId = contrastEntity.getGbTypeId();
QueryWrapper<ContrastDictEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("d.contrast_id", contrastId);
List<ContrastDictEntity> contrastDictEntityList = contrastDictDao.selectList(queryWrapper);
List<ContrastDictVo> contrastDictList = contrastDictEntityList.stream().map(contrastDictMapper::toVO).collect(Collectors.toList());
List<DictEntity> dictEntityList = dictDao.selectList(Wrappers.<DictEntity>lambdaQuery().eq(DictEntity::getTypeId, gbTypeId).eq(DictEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
List<DictVo> dictList = dictEntityList.stream().map(dictMapper::toVO).collect(Collectors.toList());
Map<String, Object> map = new HashMap<>(4);
String tableName = StrUtil.isBlank(contrastEntity.getTableComment()) ? contrastEntity.getTableName() : contrastEntity.getTableName() + "(" + contrastEntity.getTableComment() + ")";
String columnName = StrUtil.isBlank(contrastEntity.getColumnComment()) ? contrastEntity.getTableName() : contrastEntity.getColumnName() + "(" + contrastEntity.getColumnComment() + ")";
long contrastTotal = contrastDictList.stream().count();
long unContrastTotal = contrastDictList.stream().filter(s -> DataConstant.TrueOrFalse.FALSE.getKey().equals(s.getStatus())).count();
map.put("title", "数据源: " + contrastEntity.getSourceName() + " 数据表: " + tableName + " 对照字段: " + columnName + " 标准类别编码: " + contrastEntity.getGbTypeCode() + " 标准类别名称: " + contrastEntity.getGbTypeName());
map.put("description", "总数: " + contrastTotal + " 未对照: " + unContrastTotal + " 已对照: " + (contrastTotal - unContrastTotal));
map.put("left", contrastDictList);
map.put("right", dictList);
return map;
}
@Override
public void dictAutoMapping(String id) {
ContrastEntity contrastEntity = contrastDao.selectById(id);
String contrastId = contrastEntity.getId();
String gbTypeId = contrastEntity.getGbTypeId();
String bindGbColumn = contrastEntity.getBindGbColumn();
// 查询未对照数据
QueryWrapper<ContrastDictEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("d.contrast_id", contrastId);
queryWrapper.eq("d.status", DataConstant.TrueOrFalse.FALSE.getKey());
List<ContrastDictEntity> contrastDictEntityList = contrastDictDao.selectList(queryWrapper);
// 查询标准字典数据
List<DictEntity> dictEntityList = dictDao.selectList(Wrappers.<DictEntity>lambdaQuery().eq(DictEntity::getTypeId, gbTypeId).eq(DictEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
contrastDictEntityList.stream().forEach(c -> {
dictEntityList.stream().filter(d -> {
if (BIND_GB_CODE.equals(bindGbColumn)) {
return Objects.equals(c.getColCode(), d.getGbCode());
} else {
return Objects.equals(c.getColName(), d.getGbName());
}
}).forEach(s -> {
// 更新对照结果
String contrastGbId = s.getId();
c.setStatus(DataConstant.TrueOrFalse.TRUE.getKey());
c.setContrastGbId(contrastGbId);
contrastDictDao.updateById(c);
});
});
}
@Override
public void dictManualMapping(String id) {
}
}
<?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="cn.datax.service.data.standard.dao.ContrastDictDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.standard.api.entity.ContrastDictEntity">
<result column="id" property="id" />
<result column="status" property="status" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="create_dept" property="createDept" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="remark" property="remark" />
<result column="contrast_id" property="contrastId" />
<result column="col_code" property="colCode" />
<result column="col_name" property="colName" />
<result column="contrast_gb_id" property="contrastGbId" />
</resultMap>
<resultMap id="ExtendResultMap" type="cn.datax.service.data.standard.api.entity.ContrastDictEntity" extends="BaseResultMap">
<result column="source_name" property="sourceName" />
<result column="table_name" property="tableName" />
<result column="column_name" property="columnName" />
<result column="gb_type_code" property="gbTypeCode" />
<result column="gb_type_name" property="gbTypeName" />
<result column="contrast_gb_code" property="contrastGbCode" />
<result column="contrast_gb_name" property="contrastGbName" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
status,
create_by,
create_time,
create_dept,
update_by,
update_time,
remark,
contrast_id, col_code, col_name, contrast_gb_id
</sql>
<sql id="Dict_Column_List">
${alias}.id,
${alias}.status,
${alias}.create_by,
${alias}.create_time,
${alias}.create_dept,
${alias}.update_by,
${alias}.update_time,
${alias}.remark,
${alias}.contrast_id, ${alias}.col_code, ${alias}.col_name, ${alias}.contrast_gb_id
</sql>
<select id="selectList" resultMap="ExtendResultMap">
SELECT c.source_name, c.table_name, c.column_name, t.gb_type_code, t.gb_type_name,
sd.gb_code AS contrast_gb_code, sd.gb_name AS contrast_gb_name,
<include refid="Dict_Column_List"><property name="alias" value="d"/></include>
FROM standard_contrast_dict d
LEFT JOIN standard_contrast c ON c.id = d.contrast_id
LEFT JOIN standard_type t ON t.id = c.gb_type_id
LEFT JOIN standard_dict sd ON sd.id = d.contrast_gb_id
${ew.customSqlSegment}
</select>
<select id="selectPage" resultMap="ExtendResultMap">
SELECT c.source_name, c.table_name, c.column_name, t.gb_type_code, t.gb_type_name,
sd.gb_code AS contrast_gb_code, sd.gb_name AS contrast_gb_name,
<include refid="Dict_Column_List"><property name="alias" value="d"/></include>
FROM standard_contrast_dict d
LEFT JOIN standard_contrast c ON c.id = d.contrast_id
LEFT JOIN standard_type t ON t.id = c.gb_type_id
LEFT JOIN standard_dict sd ON sd.id = d.contrast_gb_id
${ew.customSqlSegment}
</select>
</mapper>
<?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="cn.datax.service.data.standard.dao.ContrastDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.standard.api.entity.ContrastEntity">
<result column="id" property="id" />
<result column="status" property="status" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="create_dept" property="createDept" />
<result column="update_by" property="updateBy" />
<result column="update_time" property="updateTime" />
<result column="remark" property="remark" />
<result column="source_id" property="sourceId" />
<result column="source_name" property="sourceName" />
<result column="table_id" property="tableId" />
<result column="table_name" property="tableName" />
<result column="table_comment" property="tableComment" />
<result column="column_id" property="columnId" />
<result column="column_name" property="columnName" />
<result column="column_comment" property="columnComment" />
<result column="gb_type_id" property="gbTypeId" />
<result column="bind_gb_column" property="bindGbColumn" />
</resultMap>
<resultMap id="ExtendResultMap" type="cn.datax.service.data.standard.api.entity.ContrastEntity" extends="BaseResultMap">
<result column="gb_type_code" property="gbTypeCode" />
<result column="gb_type_name" property="gbTypeName" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
status,
create_by,
create_time,
create_dept,
update_by,
update_time,
remark,
source_id, source_name, table_id, table_name, table_comment, column_id, column_name, column_comment, gb_type_id, bind_gb_column
</sql>
<sql id="Contrast_Column_List">
${alias}.id,
${alias}.status,
${alias}.create_by,
${alias}.create_time,
${alias}.create_dept,
${alias}.update_by,
${alias}.update_time,
${alias}.remark,
${alias}.source_id, ${alias}.source_name, ${alias}.table_id, ${alias}.table_name, ${alias}.table_comment, ${alias}.column_id,
${alias}.column_name, ${alias}.column_comment, ${alias}.gb_type_id, ${alias}.bind_gb_column
</sql>
<select id="selectById" resultMap="ExtendResultMap">
SELECT t.gb_type_code, t.gb_type_name,
<include refid="Contrast_Column_List"><property name="alias" value="c"/></include>
FROM standard_contrast c
LEFT JOIN standard_type t ON t.id = c.gb_type_id
WHERE 1 = 1 AND c.id = #{id}
</select>
</mapper>
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
<result column="type_id" property="typeId" /> <result column="type_id" property="typeId" />
<result column="gb_code" property="gbCode" /> <result column="gb_code" property="gbCode" />
<result column="gb_name" property="gbName" /> <result column="gb_name" property="gbName" />
</resultMap>
<resultMap id="ExtendResultMap" type="cn.datax.service.data.standard.api.entity.DictEntity" extends="BaseResultMap">
<result column="gb_type_code" property="gbTypeCode" /> <result column="gb_type_code" property="gbTypeCode" />
<result column="gb_type_name" property="gbTypeName" /> <result column="gb_type_name" property="gbTypeName" />
</resultMap> </resultMap>
...@@ -42,7 +45,7 @@ ...@@ -42,7 +45,7 @@
${alias}.remark, ${alias}.type_id, ${alias}.gb_code, ${alias}.gb_name ${alias}.remark, ${alias}.type_id, ${alias}.gb_code, ${alias}.gb_name
</sql> </sql>
<select id="selectById" resultMap="BaseResultMap"> <select id="selectById" resultMap="ExtendResultMap">
SELECT t.gb_type_code, t.gb_type_name, SELECT t.gb_type_code, t.gb_type_name,
<include refid="Dict_Column_List"><property name="alias" value="d"/></include> <include refid="Dict_Column_List"><property name="alias" value="d"/></include>
FROM standard_dict d FROM standard_dict d
...@@ -50,7 +53,7 @@ ...@@ -50,7 +53,7 @@
WHERE 1 = 1 AND d.id = #{id} WHERE 1 = 1 AND d.id = #{id}
</select> </select>
<select id="selectPage" resultMap="BaseResultMap"> <select id="selectPage" resultMap="ExtendResultMap">
SELECT t.gb_type_code, t.gb_type_name, SELECT t.gb_type_code, t.gb_type_name,
<include refid="Dict_Column_List"><property name="alias" value="d"/></include> <include refid="Dict_Column_List"><property name="alias" value="d"/></include>
FROM standard_dict d FROM standard_dict d
......
...@@ -21,7 +21,7 @@ public class ScheduleJob extends QuartzJobBean { ...@@ -21,7 +21,7 @@ public class ScheduleJob extends QuartzJobBean {
@Autowired @Autowired
private QrtzJobLogService qrtzJobLogService; private QrtzJobLogService qrtzJobLogService;
private static ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 30, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50)); private static ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 20, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(16));
@Override @Override
protected void executeInternal(JobExecutionContext context) { protected void executeInternal(JobExecutionContext context) {
......
package cn.datax.service.workflow.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class RabbitConfig {
@Bean
public RabbitTemplate rabbitTemplate(CachingConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
// 消息是否成功发送到Exchange
rabbitTemplate.setConfirmCallback((correlationData, ack, cause) -> {
if (ack) {
log.info("消息成功发送到Exchange");
} else {
log.info("消息发送到Exchange失败, {}, cause: {}", correlationData, cause);
}
});
// 触发setReturnCallback回调必须设置mandatory=true, 否则Exchange没有找到Queue就会丢弃掉消息, 而不会触发回调
rabbitTemplate.setMandatory(true);
// 消息是否从Exchange路由到Queue, 注意: 这是一个失败回调, 只有消息从Exchange路由到Queue失败才会回调这个方法
rabbitTemplate.setReturnCallback((message, replyCode, replyText, exchange, routingKey) -> {
log.info("消息从Exchange路由到Queue失败: exchange: {}, route: {}, replyCode: {}, replyText: {}, message: {}", exchange, routingKey, replyCode, replyText, message);
});
return rabbitTemplate;
}
}
package cn.datax.service.workflow.flowable; package cn.datax.service.workflow.flowable;
import cn.datax.common.core.DataConstant; import cn.datax.common.core.DataConstant;
import cn.datax.common.rabbitmq.config.RabbitMqConstant;
import cn.datax.common.utils.SpringContextHolder;
import cn.datax.service.workflow.api.enums.VariablesEnum; import cn.datax.service.workflow.api.enums.VariablesEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution; import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener; import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
...@@ -22,10 +26,17 @@ public class EndTaskListener implements ExecutionListener { ...@@ -22,10 +26,17 @@ public class EndTaskListener implements ExecutionListener {
String businessKey = (String) variables.get(VariablesEnum.businessKey.toString()); String businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
String businessCode = (String) variables.get(VariablesEnum.businessCode.toString()); String businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
log.info("业务结束:{},{}", businessKey, businessCode); log.info("业务结束:{},{}", businessKey, businessCode);
Map<String, Object> map = new HashMap<>(4);
map.put(VariablesEnum.businessKey.toString(), businessKey);
map.put(VariablesEnum.businessCode.toString(), businessCode);
if (delegateExecution.getCurrentActivityId().equals(VariablesEnum.approveEnd.toString())) { if (delegateExecution.getCurrentActivityId().equals(VariablesEnum.approveEnd.toString())) {
log.info("业务结束状态:{}", DataConstant.AuditState.AGREE.getKey()); log.info("业务结束状态:{}", DataConstant.AuditState.AGREE.getKey());
map.put("flowStatus", DataConstant.AuditState.AGREE.getKey());
} else if (delegateExecution.getCurrentActivityId().equals(VariablesEnum.rejectEnd.toString())) { } else if (delegateExecution.getCurrentActivityId().equals(VariablesEnum.rejectEnd.toString())) {
log.info("业务结束状态:{}", DataConstant.AuditState.REJECT.getKey()); log.info("业务结束状态:{}", DataConstant.AuditState.REJECT.getKey());
map.put("flowStatus", DataConstant.AuditState.REJECT.getKey());
} }
RabbitTemplate rabbitTemplate = SpringContextHolder.getBean(RabbitTemplate.class);
rabbitTemplate.convertAndSend(RabbitMqConstant.TOPIC_EXCHANGE_WORKFLOW, RabbitMqConstant.TOPIC_WORKFLOW_KEY + businessCode, map);
} }
} }
package cn.datax.service.workflow.flowable; package cn.datax.service.workflow.flowable;
import cn.datax.common.core.DataConstant;
import cn.datax.common.rabbitmq.config.RabbitMqConstant;
import cn.datax.common.utils.SpringContextHolder; import cn.datax.common.utils.SpringContextHolder;
import cn.datax.service.workflow.api.enums.VariablesEnum; import cn.datax.service.workflow.api.enums.VariablesEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.TaskService; import org.flowable.engine.TaskService;
import org.flowable.task.service.delegate.DelegateTask; import org.flowable.task.service.delegate.DelegateTask;
import org.flowable.task.service.delegate.TaskListener; import org.flowable.task.service.delegate.TaskListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
...@@ -28,6 +32,13 @@ public class InitialAuditCompleteTaskListener implements TaskListener { ...@@ -28,6 +32,13 @@ public class InitialAuditCompleteTaskListener implements TaskListener {
String businessKey = (String) variables.get(VariablesEnum.businessKey.toString()); String businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
String businessCode = (String) variables.get(VariablesEnum.businessCode.toString()); String businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
log.info("业务退回:{},{}", businessKey, businessCode); log.info("业务退回:{},{}", businessKey, businessCode);
log.info("业务退回状态:{}", DataConstant.AuditState.BACK.getKey());
RabbitTemplate rabbitTemplate = SpringContextHolder.getBean(RabbitTemplate.class);
Map<String, Object> map = new HashMap<>(4);
map.put(VariablesEnum.businessKey.toString(), businessKey);
map.put(VariablesEnum.businessCode.toString(), businessCode);
map.put("flowStatus", DataConstant.AuditState.BACK.getKey());
rabbitTemplate.convertAndSend(RabbitMqConstant.TOPIC_EXCHANGE_WORKFLOW, RabbitMqConstant.TOPIC_WORKFLOW_KEY + businessCode, map);
} }
log.info("退出初审节点用户任务完成监听器"); log.info("退出初审节点用户任务完成监听器");
} }
......
package cn.datax.service.workflow.flowable; package cn.datax.service.workflow.flowable;
import cn.datax.common.core.DataConstant; import cn.datax.common.core.DataConstant;
import cn.datax.common.rabbitmq.config.RabbitMqConstant;
import cn.datax.common.utils.SpringContextHolder;
import cn.datax.service.workflow.api.enums.VariablesEnum; import cn.datax.service.workflow.api.enums.VariablesEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.flowable.task.service.delegate.DelegateTask; import org.flowable.task.service.delegate.DelegateTask;
import org.flowable.task.service.delegate.TaskListener; import org.flowable.task.service.delegate.TaskListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
...@@ -25,5 +29,11 @@ public class SubmitCompleteTaskListener implements TaskListener { ...@@ -25,5 +29,11 @@ public class SubmitCompleteTaskListener implements TaskListener {
log.info("业务审核中:{},{}", businessKey, businessCode); log.info("业务审核中:{},{}", businessKey, businessCode);
log.info("业务审核中状态:{}", DataConstant.AuditState.AUDIT.getKey()); log.info("业务审核中状态:{}", DataConstant.AuditState.AUDIT.getKey());
log.info("退出提交节点用户任务完成监听器"); log.info("退出提交节点用户任务完成监听器");
RabbitTemplate rabbitTemplate = SpringContextHolder.getBean(RabbitTemplate.class);
Map<String, Object> map = new HashMap<>(4);
map.put(VariablesEnum.businessKey.toString(), businessKey);
map.put(VariablesEnum.businessCode.toString(), businessCode);
map.put("flowStatus", DataConstant.AuditState.AUDIT.getKey());
rabbitTemplate.convertAndSend(RabbitMqConstant.TOPIC_EXCHANGE_WORKFLOW, RabbitMqConstant.TOPIC_WORKFLOW_KEY + businessCode, map);
} }
} }
package cn.datax.service.workflow.service.impl; package cn.datax.service.workflow.service.impl;
import cn.datax.common.core.DataConstant;
import cn.datax.common.rabbitmq.config.RabbitMqConstant;
import cn.datax.common.utils.SecurityUtil; import cn.datax.common.utils.SecurityUtil;
import cn.datax.service.workflow.api.dto.ProcessInstanceCreateRequest; import cn.datax.service.workflow.api.dto.ProcessInstanceCreateRequest;
import cn.datax.service.workflow.api.enums.VariablesEnum; import cn.datax.service.workflow.api.enums.VariablesEnum;
...@@ -27,12 +29,14 @@ import org.flowable.engine.runtime.ProcessInstanceQuery; ...@@ -27,12 +29,14 @@ import org.flowable.engine.runtime.ProcessInstanceQuery;
import org.flowable.engine.task.Comment; import org.flowable.engine.task.Comment;
import org.flowable.image.impl.DefaultProcessDiagramGenerator; import org.flowable.image.impl.DefaultProcessDiagramGenerator;
import org.flowable.task.api.Task; import org.flowable.task.api.Task;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -52,6 +56,9 @@ public class FlowInstanceServiceImpl implements FlowInstanceService { ...@@ -52,6 +56,9 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
@Autowired @Autowired
private TaskService taskService; private TaskService taskService;
@Autowired
private RabbitTemplate rabbitTemplate;
private static final String IMAGE_TYPE = "png"; private static final String IMAGE_TYPE = "png";
private static final String FONT_NAME = "宋体"; private static final String FONT_NAME = "宋体";
...@@ -103,13 +110,19 @@ public class FlowInstanceServiceImpl implements FlowInstanceService { ...@@ -103,13 +110,19 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
@Override @Override
public void deleteProcessInstance(String processInstanceId) { public void deleteProcessInstance(String processInstanceId) {
// 发送消息队列 // 发送消息队列
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().includeProcessVariables().processInstanceId(processInstanceId).singleResult();
Map<String, Object> variables = processInstance.getProcessVariables(); Map<String, Object> variables = processInstance.getProcessVariables();
String businessKey = (String) variables.get(VariablesEnum.businessKey.toString()); String businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
String businessCode = (String) variables.get(VariablesEnum.businessCode.toString()); String businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
log.info("业务撤销:{},{}", businessKey, businessCode); log.info("业务撤销:{},{}", businessKey, businessCode);
log.info("成功删除流程实例ID:{}", processInstanceId); log.info("成功删除流程实例ID:{}", processInstanceId);
log.info("业务撤销状态:{}", DataConstant.AuditState.CANCEL.getKey());
runtimeService.deleteProcessInstance(processInstanceId, "用户撤销"); runtimeService.deleteProcessInstance(processInstanceId, "用户撤销");
Map<String, Object> map = new HashMap<>(4);
map.put(VariablesEnum.businessKey.toString(), businessKey);
map.put(VariablesEnum.businessCode.toString(), businessCode);
map.put("flowStatus", DataConstant.AuditState.CANCEL.getKey());
rabbitTemplate.convertAndSend(RabbitMqConstant.TOPIC_EXCHANGE_WORKFLOW, RabbitMqConstant.TOPIC_WORKFLOW_KEY + businessCode, map);
} }
@Override @Override
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"echarts": "^4.8.0", "echarts": "^4.8.0",
"element-ui": "2.13.2", "element-ui": "2.13.2",
"good-storage": "^1.1.1", "good-storage": "^1.1.1",
"jsplumb": "^2.14.6",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"path-to-regexp": "2.4.0", "path-to-regexp": "2.4.0",
......
import request from '@/utils/request'
export function pageCheckJob(data) {
return request({
url: '/data/quality/scheduleJobs/page',
method: 'get',
params: data
})
}
export function pauseCheckJob(id) {
return request({
url: '/data/quality/scheduleJobs/pause/' + id,
method: 'post'
})
}
export function resumeCheckJob(id) {
return request({
url: '/data/quality/scheduleJobs/resume/' + id,
method: 'post'
})
}
import request from '@/utils/request'
export function listRuleType(data) {
return request({
url: '/data/quality/ruleTypes/report/list',
method: 'get',
params: data
})
}
export function pageCheckReport(data) {
return request({
url: '/data/quality/checkReports/page',
method: 'get',
params: data
})
}
import request from '@/utils/request'
export function listRuleType(data) {
return request({
url: '/data/quality/ruleTypes/list',
method: 'get',
params: data
})
}
export function pageCheckRule(data) {
return request({
url: '/data/quality/checkRules/page',
method: 'get',
params: data
})
}
export function getCheckRule(id) {
return request({
url: '/data/quality/checkRules/' + id,
method: 'get'
})
}
export function delCheckRule(id) {
return request({
url: '/data/quality/checkRules/' + id,
method: 'delete'
})
}
export function delCheckRules(ids) {
return request({
url: '/data/quality/checkRules/batch/' + ids,
method: 'delete'
})
}
export function addCheckRule(data) {
return request({
url: '/data/quality/checkRules',
method: 'post',
data: data
})
}
export function updateCheckRule(data) {
return request({
url: '/data/quality/checkRules/' + data.id,
method: 'put',
data: data
})
}
import request from '@/utils/request'
export function getContrastTree(data) {
return request({
url: '/data/standard/contrasts/tree',
method: 'get',
params: data
})
}
export function addContrast(data) {
return request({
url: '/data/standard/contrasts',
method: 'post',
data: data
})
}
export function updateContrast(data) {
return request({
url: '/data/standard/contrasts/' + data.id,
method: 'put',
data: data
})
}
export function delContrast(id) {
return request({
url: '/data/standard/contrasts/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
export function pageContrastDict(data) {
return request({
url: '/data/standard/contrastDicts/page',
method: 'get',
params: data
})
}
export function getContrastDict(id) {
return request({
url: '/data/standard/contrastDicts/' + id,
method: 'get'
})
}
export function delContrastDict(id) {
return request({
url: '/data/standard/contrastDicts/' + id,
method: 'delete'
})
}
export function delContrastDicts(ids) {
return request({
url: '/data/standard/contrastDicts/batch/' + ids,
method: 'delete'
})
}
export function addContrastDict(data) {
return request({
url: '/data/standard/contrastDicts',
method: 'post',
data: data
})
}
export function updateContrastDict(data) {
return request({
url: '/data/standard/contrastDicts/' + data.id,
method: 'put',
data: data
})
}
import request from '@/utils/request'
export function getDictMapping(id) {
return request({
url: '/data/standard/mappings/' + id,
method: 'get'
})
}
export function dictAutoMapping(id) {
return request({
url: '/data/standard/mappings/auto/' + id,
method: 'post'
})
}
export default {
inserted(el, binding, vnode) {
const { value } = binding
// 工作流状态(1待提交,2已退回,3审核中,4通过,5不通过,6已撤销)
if (value) {
if (value === '1' || value === '6') {
el.disabled = false
} else {
el.disabled = true
el.classList.add('is-disabled')
}
} else {
throw new Error('请设置流程权限标签值')
}
}
}
export default {
inserted(el, binding, vnode) {
const { value } = binding
// 工作流状态(1待提交,2已退回,3审核中,4通过,5不通过,6已撤销)
if (value) {
if (value === '1' || value === '2' || value === '6') {
el.disabled = false
} else {
el.disabled = true
el.classList.add('is-disabled')
}
} else {
throw new Error('请设置流程权限标签值')
}
}
}
import flowEdit from './flowEdit'
import flowDel from './flowDel'
const install = function(Vue) {
Vue.directive('flowEdit', flowEdit)
Vue.directive('flowDel', flowDel)
}
if (window.Vue) {
window['flowEdit'] = flowEdit
window['flowDel'] = flowDel
Vue.use(install) // eslint-disable-line
}
export default install
<template> <template>
<div class="top-nav"> <div class="top-nav">
<div class="log">管理系统</div> <div class="log">智数通</div>
<el-menu <el-menu
:active-text-color="variables.menuActiveText" :active-text-color="variables.menuActiveText"
:default-active="activeMenu" :default-active="activeMenu"
......
...@@ -16,6 +16,7 @@ import '@/icons' ...@@ -16,6 +16,7 @@ import '@/icons'
import '@/permission' import '@/permission'
import perms from '@/directive/permission' import perms from '@/directive/permission'
import flowPerms from '@/directive/flow'
import { getDicts } from '@/api/system/dict' import { getDicts } from '@/api/system/dict'
import { getConfigKey } from '@/api/system/config' import { getConfigKey } from '@/api/system/config'
...@@ -27,6 +28,7 @@ Vue.prototype.selectDictLabel = selectDictLabel ...@@ -27,6 +28,7 @@ Vue.prototype.selectDictLabel = selectDictLabel
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(perms) Vue.use(perms)
Vue.use(flowPerms)
Vue.config.productionTip = false Vue.config.productionTip = false
......
...@@ -19,20 +19,6 @@ ...@@ -19,20 +19,6 @@
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<el-col :span="12"> <el-col :span="12">
<el-button-group> <el-button-group>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -82,7 +68,6 @@ ...@@ -82,7 +68,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -138,7 +123,7 @@ ...@@ -138,7 +123,7 @@
</template> </template>
<script> <script>
import { pageApiLog, delApiLog, delApiLogs } from '@/api/market/apilog' import { pageApiLog, delApiLog } from '@/api/market/apilog'
export default { export default {
name: 'ApiLogList', name: 'ApiLogList',
...@@ -153,12 +138,6 @@ export default { ...@@ -153,12 +138,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'apiName', label: '接口名称', show: true }, { prop: 'apiName', label: '接口名称', show: true },
...@@ -247,15 +226,9 @@ export default { ...@@ -247,15 +226,9 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showDetail = true this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
...@@ -276,16 +249,6 @@ export default { ...@@ -276,16 +249,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -25,27 +25,6 @@ ...@@ -25,27 +25,6 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -95,7 +74,6 @@ ...@@ -95,7 +74,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -157,7 +135,7 @@ ...@@ -157,7 +135,7 @@
</template> </template>
<script> <script>
import { pageApiMask, delApiMask, delApiMasks } from '@/api/market/apimask' import { pageApiMask, delApiMask } from '@/api/market/apimask'
export default { export default {
name: 'ApiMaskList', name: 'ApiMaskList',
...@@ -174,12 +152,6 @@ export default { ...@@ -174,12 +152,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'maskName', label: '脱敏名称', show: true }, { prop: 'maskName', label: '脱敏名称', show: true },
...@@ -265,12 +237,6 @@ export default { ...@@ -265,12 +237,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -282,7 +248,7 @@ export default { ...@@ -282,7 +248,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -291,7 +257,7 @@ export default { ...@@ -291,7 +257,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -314,16 +280,6 @@ export default { ...@@ -314,16 +280,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -25,27 +25,6 @@ ...@@ -25,27 +25,6 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -95,7 +74,6 @@ ...@@ -95,7 +74,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -177,7 +155,7 @@ ...@@ -177,7 +155,7 @@
</template> </template>
<script> <script>
import { pageDataApi, delDataApi, delDataApis, copyDataApi, releaseDataApi, cancelDataApi } from '@/api/market/dataapi' import { pageDataApi, delDataApi, copyDataApi, releaseDataApi, cancelDataApi } from '@/api/market/dataapi'
export default { export default {
name: 'DataApiList', name: 'DataApiList',
...@@ -195,12 +173,6 @@ export default { ...@@ -195,12 +173,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'apiName', label: 'API名称', show: true }, { prop: 'apiName', label: 'API名称', show: true },
...@@ -290,12 +262,6 @@ export default { ...@@ -290,12 +262,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -308,7 +274,7 @@ export default { ...@@ -308,7 +274,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -318,7 +284,7 @@ export default { ...@@ -318,7 +284,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -369,16 +335,6 @@ export default { ...@@ -369,16 +335,6 @@ export default {
} }
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -25,27 +25,6 @@ ...@@ -25,27 +25,6 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -95,7 +74,6 @@ ...@@ -95,7 +74,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -157,7 +135,7 @@ ...@@ -157,7 +135,7 @@
</template> </template>
<script> <script>
import { pageDataService, delDataService, delDataServices } from '@/api/market/dataservice' import { pageDataService, delDataService } from '@/api/market/dataservice'
export default { export default {
name: 'DataServiceList', name: 'DataServiceList',
...@@ -174,12 +152,6 @@ export default { ...@@ -174,12 +152,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'serviceNo', label: '服务编号', show: true }, { prop: 'serviceNo', label: '服务编号', show: true },
...@@ -273,12 +245,6 @@ export default { ...@@ -273,12 +245,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -290,7 +256,7 @@ export default { ...@@ -290,7 +256,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -299,7 +265,7 @@ export default { ...@@ -299,7 +265,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -322,16 +288,6 @@ export default { ...@@ -322,16 +288,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -19,20 +19,6 @@ ...@@ -19,20 +19,6 @@
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<el-col :span="12"> <el-col :span="12">
<el-button-group> <el-button-group>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -82,7 +68,6 @@ ...@@ -82,7 +68,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -138,7 +123,7 @@ ...@@ -138,7 +123,7 @@
</template> </template>
<script> <script>
import { pageDataServiceLog, delDataServiceLog, delDataServiceLogs } from '@/api/market/dataservicelog' import { pageDataServiceLog, delDataServiceLog } from '@/api/market/dataservicelog'
export default { export default {
name: 'ServiceLogList', name: 'ServiceLogList',
...@@ -153,12 +138,6 @@ export default { ...@@ -153,12 +138,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'serviceName', label: '服务名称', show: true }, { prop: 'serviceName', label: '服务名称', show: true },
...@@ -246,15 +225,9 @@ export default { ...@@ -246,15 +225,9 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showDetail = true this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
...@@ -275,16 +248,6 @@ export default { ...@@ -275,16 +248,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
<template> <template>
<div class="app-container"> <div class="app-container">
DataAnalyse DataApply
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'DataAnalyse' name: 'DataApply'
} }
</script> </script>
......
...@@ -213,27 +213,6 @@ ...@@ -213,27 +213,6 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
</el-row> </el-row>
...@@ -245,7 +224,6 @@ ...@@ -245,7 +224,6 @@
tooltip-effect="dark" tooltip-effect="dark"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -325,12 +303,6 @@ export default { ...@@ -325,12 +303,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总数据条数 // 总数据条数
total: 0, total: 0,
// 查询参数 // 查询参数
...@@ -391,12 +363,6 @@ export default { ...@@ -391,12 +363,6 @@ export default {
} }
this.handleQuery() this.handleQuery()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -410,7 +376,7 @@ export default { ...@@ -410,7 +376,7 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.modelId = this.modelId this.showOptions.data.modelId = this.modelId
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -420,7 +386,7 @@ export default { ...@@ -420,7 +386,7 @@ export default {
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.modelId = this.modelId this.showOptions.data.modelId = this.modelId
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -443,16 +409,6 @@ export default { ...@@ -443,16 +409,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
<el-form-item :prop="'modelColumns.' + scope.$index + '.bindDictColumn'"> <el-form-item :prop="'modelColumns.' + scope.$index + '.bindDictColumn'">
<el-select :disabled="scope.row.isSystem === '1' || scope.row.isBindDict === '0'" v-model="scope.row.bindDictColumn" clearable placeholder="请选择"> <el-select :disabled="scope.row.isSystem === '1' || scope.row.isBindDict === '0'" v-model="scope.row.bindDictColumn" clearable placeholder="请选择">
<el-option <el-option
v-for="item in dictColumnOptions" v-for="item in gbColumnOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
...@@ -308,7 +308,7 @@ export default { ...@@ -308,7 +308,7 @@ export default {
// 数据标准类别数据字典 // 数据标准类别数据字典
dictTypeOptions: [], dictTypeOptions: [],
// 标准字典字段数据字典 // 标准字典字段数据字典
dictColumnOptions: [ gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' }, { value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' } { value: 'gb_name', label: '标准名称' }
], ],
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-s-data" round @click="submit">提交</el-button> <el-button v-if="form.flowStatus === '1' || form.flowStatus === '6'" size="mini" icon="el-icon-s-data" round @click="submit">提交</el-button>
<el-button size="mini" icon="el-icon-s-data" round @click="createTable">建模</el-button> <el-button v-if="form.flowStatus === '4'" :disabled="form.isSync === '1'" size="mini" icon="el-icon-s-data" round @click="createTable">建模</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
<el-form-item> <el-form-item>
<el-select v-model="scope.row.bindDictColumn" clearable placeholder="请选择"> <el-select v-model="scope.row.bindDictColumn" clearable placeholder="请选择">
<el-option <el-option
v-for="item in dictColumnOptions" v-for="item in gbColumnOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
...@@ -263,7 +263,7 @@ export default { ...@@ -263,7 +263,7 @@ export default {
queryTypeOptions: [], queryTypeOptions: [],
htmlTypeOptions: [], htmlTypeOptions: [],
dictTypeOptions: [], dictTypeOptions: [],
dictColumnOptions: [ gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' }, { value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' } { value: 'gb_name', label: '标准名称' }
] ]
...@@ -308,7 +308,6 @@ export default { ...@@ -308,7 +308,6 @@ export default {
getDataModel: function(id) { getDataModel: function(id) {
getDataModel(id).then(response => { getDataModel(id).then(response => {
if (response.success) { if (response.success) {
console.log(response.data)
this.form = response.data this.form = response.data
} }
}) })
......
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
<el-form-item :prop="'modelColumns.' + scope.$index + '.bindDictColumn'"> <el-form-item :prop="'modelColumns.' + scope.$index + '.bindDictColumn'">
<el-select :disabled="scope.row.isSystem === '1' || scope.row.isBindDict === '0'" v-model="scope.row.bindDictColumn" clearable placeholder="请选择"> <el-select :disabled="scope.row.isSystem === '1' || scope.row.isBindDict === '0'" v-model="scope.row.bindDictColumn" clearable placeholder="请选择">
<el-option <el-option
v-for="item in dictColumnOptions" v-for="item in gbColumnOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value">
...@@ -296,7 +296,7 @@ export default { ...@@ -296,7 +296,7 @@ export default {
queryTypeOptions: [], queryTypeOptions: [],
htmlTypeOptions: [], htmlTypeOptions: [],
dictTypeOptions: [], dictTypeOptions: [],
dictColumnOptions: [ gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' }, { value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' } { value: 'gb_name', label: '标准名称' }
] ]
......
...@@ -25,27 +25,6 @@ ...@@ -25,27 +25,6 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -95,7 +74,6 @@ ...@@ -95,7 +74,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -125,6 +103,7 @@ ...@@ -125,6 +103,7 @@
type="text" type="text"
icon="el-icon-edit-outline" icon="el-icon-edit-outline"
@click="handleEdit(scope.row)" @click="handleEdit(scope.row)"
v-flow-edit="scope.row.flowStatus"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
...@@ -137,6 +116,7 @@ ...@@ -137,6 +116,7 @@
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-flow-del="scope.row.flowStatus"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button> <el-button slot="reference">操作</el-button>
</el-popover> </el-popover>
...@@ -157,7 +137,7 @@ ...@@ -157,7 +137,7 @@
</template> </template>
<script> <script>
import { pageDataModel, delDataModel, delDataModels } from '@/api/masterdata/datamodel' import { pageDataModel, delDataModel } from '@/api/masterdata/datamodel'
export default { export default {
name: 'DataModelList', name: 'DataModelList',
...@@ -174,22 +154,22 @@ export default { ...@@ -174,22 +154,22 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'modelName', label: '模型名称', show: true }, { prop: 'modelName', label: '模型名称', show: true },
{ prop: 'modelLogicTable', label: '模型逻辑表', show: true }, { prop: 'modelLogicTable', label: '模型逻辑表', show: true },
{ {
prop: 'status', prop: 'status',
label: '状态', label: '业务状态',
show: true, show: true,
formatter: this.statusFormatter formatter: this.statusFormatter
}, },
{
prop: 'flowStatus',
label: '流程状态',
show: true,
formatter: this.flowStatusFormatter
},
{ prop: 'createTime', label: '创建时间', show: true } { prop: 'createTime', label: '创建时间', show: true }
], ],
// 默认选择中表格头 // 默认选择中表格头
...@@ -206,7 +186,9 @@ export default { ...@@ -206,7 +186,9 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
modelName: '' modelName: ''
} },
// 流程状态数据字典
flowStatusOptions: []
} }
}, },
created() { created() {
...@@ -215,6 +197,11 @@ export default { ...@@ -215,6 +197,11 @@ export default {
this.statusOptions = response.data this.statusOptions = response.data
} }
}) })
this.getDicts('sys_flow_status').then(response => {
if (response.success) {
this.flowStatusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted() { mounted() {
...@@ -266,12 +253,6 @@ export default { ...@@ -266,12 +253,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -283,7 +264,7 @@ export default { ...@@ -283,7 +264,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -292,7 +273,7 @@ export default { ...@@ -292,7 +273,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -315,16 +296,6 @@ export default { ...@@ -315,16 +296,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
...@@ -343,6 +314,22 @@ export default { ...@@ -343,6 +314,22 @@ export default {
} else { } else {
return <el-tag type='warning'>{dictLabel}</el-tag> return <el-tag type='warning'>{dictLabel}</el-tag>
} }
},
flowStatusFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.flowStatusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='primary'>{dictLabel}</el-tag>
} else if (cellValue === '2') {
return <el-tag type='info'>{dictLabel}</el-tag>
} else if (cellValue === '3') {
return <el-tag>{dictLabel}</el-tag>
} else if (cellValue === '4') {
return <el-tag type='success'>{dictLabel}</el-tag>
} else if (cellValue === '5') {
return <el-tag type='warning'>{dictLabel}</el-tag>
} else if (cellValue === '6') {
return <el-tag type='danger'>{dictLabel}</el-tag>
}
} }
} }
} }
......
...@@ -19,27 +19,6 @@ ...@@ -19,27 +19,6 @@
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<el-col :span="12"> <el-col :span="12">
<el-button-group> <el-button-group>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -89,7 +68,6 @@ ...@@ -89,7 +68,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -151,7 +129,7 @@ ...@@ -151,7 +129,7 @@
</template> </template>
<script> <script>
import { pageChangeRecord, delChangeRecord, delChangeRecords } from '@/api/metadata/changerecord' import { pageChangeRecord, delChangeRecord } from '@/api/metadata/changerecord'
export default { export default {
name: 'ChangeRecordList', name: 'ChangeRecordList',
...@@ -168,12 +146,6 @@ export default { ...@@ -168,12 +146,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'sourceName', label: '数据源', show: true }, { prop: 'sourceName', label: '数据源', show: true },
...@@ -275,15 +247,9 @@ export default { ...@@ -275,15 +247,9 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -292,7 +258,7 @@ export default { ...@@ -292,7 +258,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -315,16 +281,6 @@ export default { ...@@ -315,16 +281,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
<template>
<div class="app-container">
DataAuthorize
</div>
</template>
<script>
export default {
name: 'DataAuthorize'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
<el-card class="box-card" shadow="always">
<el-row>
<el-col :span="24">
<el-form ref="queryForm" :model="queryParams" :inline="true" class="demo-form-inline">
<el-form-item label="数据表名">
<el-input
v-model="queryParams.tableName"
placeholder="请输入数据表名"
clearable
size="small"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleQuery">查询</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-table
:data="tableDataList"
stripe
border
:max-height="200"
style="width: 100%; margin: 15px 0;"
>
<el-table-column prop="subjectArea" label="数据主题域" align="center" show-overflow-tooltip />
<el-table-column prop="mappingName" label="映射名称" align="center" show-overflow-tooltip />
<el-table-column prop="sourceTable" label="源表" align="center" show-overflow-tooltip />
<el-table-column prop="targetTable" label="目标表" align="center" show-overflow-tooltip />
</el-table>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div id="chart" style="width: 100%; height: 300px;" />
</el-col>
</el-row>
</el-card>
</div>
</template>
<script>
import echarts from 'echarts'
export default {
name: 'DataBlood',
data: function() {
return {
queryParams: {
tableName: ''
},
chart: null,
tableDataList: []
}
},
created() {
},
mounted() {
this.chart = echarts.init(document.getElementById('chart'))
},
beforeDestroy() {
if (!this.chart) {
return false
}
this.chart.dispose()
this.chart = null
},
methods: {
handleQuery() {
this.tableDataList = [
{ subjectArea: 'DataCenter', mappingName: 'm_ts_test_table_inc', sourceTable: 'src_test_table', targetTable: 'ts_test_table' },
{ subjectArea: 'DataCenter', mappingName: 'm_ts_test_table_inc', sourceTable: 'ts_test_table', targetTable: 'th_test_table' },
{ subjectArea: 'DataCenter', mappingName: 'm_ts_test_table_inc', sourceTable: 'ts_test_table', targetTable: 'ti_test_table' },
{ subjectArea: 'DataCenter', mappingName: 'm_ods_test_table_inc', sourceTable: 'ti_test_table', targetTable: 't_test_table' }
]
let data = { nodes: [], links: [] }
const nodes = []
const links = []
const colors = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4']
this.tableDataList.forEach(item => {
nodes.push({
name: item.sourceTable,
itemStyle: {
normal: {
color: colors[Math.floor(Math.random() * colors.length)]
}
}
})
nodes.push({
name: item.targetTable,
itemStyle: {
normal: {
color: colors[Math.floor(Math.random() * colors.length)]
}
}
})
links.push({
source: item.sourceTable,
target: item.targetTable,
value: item.mappingName.length,
mapping: item.mappingName
})
})
// nodes数组去重
const res = new Map()
const nodes_uniq = nodes.filter((node) => !res.has(node.name) && res.set(node.name, 1))
data = {
nodes: nodes_uniq,
links: links
}
this.chart.clear()
this.chart.setOption({
title: {
text: '血缘流向'
},
tooltip: {
trigger: 'item',
triggerOn: 'mousemove',
formatter: function(x) {
return x.data.mapping
}
},
animation: false,
series: [
{
type: 'sankey',
focusNodeAdjacency: 'allEdges',
nodeAlign: 'left',
data: data.nodes,
links: data.links,
lineStyle: {
color: 'source',
curveness: 0.5
}
}
]
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
</style>
...@@ -42,13 +42,6 @@ ...@@ -42,13 +42,6 @@
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<el-col :span="12"> <el-col :span="12">
<el-button-group> <el-button-group>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -101,7 +94,6 @@ ...@@ -101,7 +94,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -168,12 +160,6 @@ export default { ...@@ -168,12 +160,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'columnName', label: '字段名称', show: true }, { prop: 'columnName', label: '字段名称', show: true },
...@@ -273,15 +259,9 @@ export default { ...@@ -273,15 +259,9 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showDetail = true this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions) this.$emit('showCard', this.showOptions)
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-coin" type="primary" round @click="handleSync">元数据同步</el-button> <el-button :disabled="form.sourceSync === 1" size="mini" icon="el-icon-coin" type="primary" round @click="handleSync">元数据同步</el-button>
<el-button size="mini" icon="el-icon-coin" type="primary" round @click="handleWord">数据库文档</el-button> <el-button :disabled="form.sourceSync === 0" size="mini" icon="el-icon-coin" type="primary" round @click="handleWord">数据库文档</el-button>
<el-button v-if="active == 2" size="mini" icon="el-icon-coin" type="primary" round @click="handleCheckConnection">连通性检测</el-button> <el-button size="mini" icon="el-icon-coin" type="primary" round @click="handleCheckConnection">连通性检测</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
......
...@@ -26,27 +26,6 @@ ...@@ -26,27 +26,6 @@
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button <el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
<el-button
type="warning" type="warning"
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
...@@ -101,7 +80,6 @@ ...@@ -101,7 +80,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -163,7 +141,7 @@ ...@@ -163,7 +141,7 @@
</template> </template>
<script> <script>
import { pageDataSource, delDataSource, delDataSources, refreshMetadata } from '@/api/metadata/datasource' import { pageDataSource, delDataSource, refreshMetadata } from '@/api/metadata/datasource'
export default { export default {
name: 'DataSourceList', name: 'DataSourceList',
...@@ -180,12 +158,6 @@ export default { ...@@ -180,12 +158,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'sourceName', label: '数据源名称', show: true }, { prop: 'sourceName', label: '数据源名称', show: true },
...@@ -271,12 +243,6 @@ export default { ...@@ -271,12 +243,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -288,7 +254,7 @@ export default { ...@@ -288,7 +254,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -297,7 +263,7 @@ export default { ...@@ -297,7 +263,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -330,16 +296,6 @@ export default { ...@@ -330,16 +296,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
<template>
<div class="app-container">
AnalysisReport
</div>
</template>
<script>
export default {
name: 'AnalysisReport'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<el-card class="box-card" shadow="always">
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popover
placement="left"
trigger="click"
>
<el-button
:disabled="scope.row.status === '0'"
size="mini"
type="text"
icon="el-icon-delete"
@click="handlePause(scope.row)"
>暂停任务</el-button>
<el-button
:disabled="scope.row.status === '1'"
size="mini"
type="text"
icon="el-icon-delete"
@click="resumePause(scope.row)"
>恢复任务</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</template>
<script>
import { pageCheckJob, pauseCheckJob, resumeCheckJob } from '@/api/quality/checkjob'
export default {
name: 'CheckJobList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true
},
// 遮罩层
loading: true,
// 表格头
tableColumns: [
{ prop: 'jobName', label: '任务名称', show: true },
{ prop: 'beanName', label: 'bean名称', show: true },
{ prop: 'methodName', label: '方法名称', show: true },
{ prop: 'methodParams', label: '方法参数', show: true },
{ prop: 'cronExpression', label: 'cron表达式', show: true },
{
prop: 'status',
label: '状态',
show: true,
formatter: this.statusFormatter
}
],
// 状态数据字典
statusOptions: [],
// 数据集表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20
}
}
},
created() {
this.getDicts('sys_job_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList()
},
methods: {
/** 查询数据集列表 */
getList() {
this.loading = true
pageCheckJob(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
handlePause(row) {
this.$confirm('是否暂停该任务', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
pauseCheckJob(row.id).then(response => {
if (response.success) {
this.$message.success('任务暂停成功')
this.getList()
}
})
}).catch(() => {
})
},
resumePause(row) {
this.$confirm('是否恢复该任务', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
resumeCheckJob(row.id).then(response => {
if (response.success) {
this.$message.success('任务恢复成功')
this.getList()
}
})
}).catch(() => {
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictLabel}</el-tag>
} else {
return <el-tag type='warning'>{dictLabel}</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<check-job-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import CheckJobList from './CheckJobList'
export default {
name: 'CheckJob',
components: { CheckJobList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<el-row :gutter="20">
<el-col :span="6">
<el-card class="box-card tree-wrapper" shadow="always">
<div class="body-wrapper">
<el-tree
ref="ruleType"
:data="ruleTypeOptions"
node-key="id"
empty-text="加载中,请稍后"
:props="defaultProps"
default-expand-all
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
>
<template slot-scope="{ node, data }">
<span class="custom-tree-node">
<span v-if="node.level === 1"><i class="iconfont icon-zuzhi tree-folder" />{{ node.label }}</span>
<span v-else>{{ node.label }} (错误数:<span style="color: #ef5b5b">{{ data.checkErrorCount }}</span>)</span>
</span>
</template>
</el-tree>
</div>
</el-card>
</el-col>
<el-col :span="18">
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="规则名称" prop="ruleName">
<el-input
v-model="queryParams.ruleName"
placeholder="请输入规则名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</el-col>
</el-row>
</template>
<script>
import { listRuleType, pageCheckReport } from '@/api/quality/checkreport'
export default {
name: 'CheckReportList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true
},
// 遮罩层
loading: true,
// 表格头
tableColumns: [
{ prop: 'ruleName', label: '规则名称', show: true },
{ prop: 'ruleType', label: '规则类型', show: true },
{ prop: 'ruleSource', label: '数据源', show: true },
{ prop: 'ruleTable', label: '数据表', show: true },
{ prop: 'ruleColumn', label: '核查字段', show: true },
{ prop: 'checkTotalCount', label: '核查数量', show: true },
{ prop: 'checkErrorCount', label: '报错数量', show: true },
{ prop: 'checkDate', label: '核查时间', show: true }
],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
ruleTypeId: '',
ruleName: ''
},
// 左侧树
ruleTypeOptions: [],
defaultProps: {
children: 'children',
label: 'name'
}
}
},
created() {
this.getTree()
this.getList()
},
methods: {
getTree() {
listRuleType().then(response => {
if (response.success) {
const { data } = response
const tree = {}
tree.name = '核查规则类型'
tree.children = data
this.ruleTypeOptions = []
this.ruleTypeOptions.push(tree)
}
})
},
/** 节点单击事件 */
handleNodeClick(data) {
if (data.id) {
this.queryParams.ruleTypeId = data.id
this.getList()
}
},
/** 查询数据源列表 */
getList() {
this.loading = true
pageCheckReport(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
ruleTypeId: '',
ruleName: ''
}
this.handleQuery()
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
.tree-wrapper {
overflow-y: auto;
.body-wrapper {
margin: -10px;
::v-deep .custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
.tree-folder {
margin-right: 5px;
color: #f6cf07;
}
}
}
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<check-report-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import CheckReportList from './CheckReportList'
export default {
name: 'CheckReport',
components: { CheckReportList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled" @click="submitForm">{{ loadingOptions.loadingText }}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="规则名称" prop="ruleName">
<el-input v-model="form.ruleName" placeholder="请输入规则名称" />
</el-form-item>
<el-form-item label="规则级别" prop="ruleLevel">
<el-radio-group v-model="form.ruleLevel">
<el-radio
v-for="dict in ruleLevelOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="数据源" prop="ruleSourceId">
<el-select v-model="form.ruleSourceId" placeholder="请选择数据源" @change="sourceSelectChanged">
<el-option
v-for="source in sourceOptions"
:key="source.id"
:label="source.sourceName"
:value="source.id"
/>
</el-select>
</el-form-item>
<el-form-item label="数据表" prop="ruleTableId">
<el-select v-model="form.ruleTableId" placeholder="请选择数据表" @change="tableSelectChanged">
<el-option
v-for="table in tableOptions"
:key="table.id"
:label="table.tableName"
:value="table.id">
<span style="float: left">{{ table.tableName + '(' + table.tableComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核查字段" prop="ruleColumnId">
<el-select v-model="form.ruleColumnId" placeholder="请选择核查字段" @change="columnSelectChanged">
<el-option
v-for="column in columnOptions"
:key="column.id"
:label="column.columnName"
:value="column.id">
<span style="float: left">{{ column.columnName + '(' + column.columnComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核查脚本" prop="ruleSql">
<el-input v-model="form.ruleSql" type="textarea" placeholder="请输入核查脚本" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { addCheckRule } from '@/api/quality/checkrule'
import { listDataSource } from '@/api/metadata/datasource'
import { listDataTable } from '@/api/metadata/datatable'
import { listDataColumn } from '@/api/metadata/datacolumn'
export default {
name: 'CheckRuleAdd',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '核查规则新增',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数
form: {
ruleName: undefined,
ruleLevel: '1',
ruleSourceId: undefined,
ruleSource: undefined,
ruleTableId: undefined,
ruleTable: undefined,
ruleColumnId: undefined,
ruleColumn: undefined,
ruleSql: undefined,
status: '1'
},
// 表单校验
rules: {
ruleName: [
{ required: true, message: '规则名称不能为空', trigger: 'blur' }
],
ruleSourceId: [
{ required: true, message: '数据源不能为空', trigger: 'change' }
],
ruleTableId: [
{ required: true, message: '数据表不能为空', trigger: 'change' }
],
ruleColumnId: [
{ required: true, message: '核查字段不能为空', trigger: 'change' }
]
},
// 状态数据字典
statusOptions: [],
// 规则级别数据字典
ruleLevelOptions: [],
sourceOptions: [],
tableOptions: [],
columnOptions: []
}
},
created() {
console.log('data:' + this.data)
this.form.ruleTypeId = this.data.ruleTypeId
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getDicts('data_check_rule_level').then(response => {
if (response.success) {
this.ruleLevelOptions = response.data
}
})
this.getDataSourceList()
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
getDataSourceList() {
listDataSource().then(response => {
if (response.success) {
this.sourceOptions = response.data
}
})
},
sourceSelectChanged(val) {
listDataTable({ sourceId: val }).then(response => {
if (response.success) {
this.tableOptions = response.data
this.columnOptions = []
const source = this.sourceOptions.find(function(item) {
return item.id === val
})
this.form.ruleSource = source.sourceName
this.form.ruleTableId = ''
this.form.ruleTable = ''
this.form.ruleColumnId = ''
this.form.ruleColumn = ''
}
})
},
tableSelectChanged(val) {
listDataColumn({ sourceId: this.form.ruleSourceId, tableId: val }).then(response => {
if (response.success) {
this.columnOptions = response.data
const table = this.tableOptions.find(function(item) {
return item.id === val
})
this.form.ruleTable = table.tableName
this.form.ruleTableComment = table.tableComment
this.form.ruleColumnId = ''
this.form.ruleColumn = ''
this.form.ruleColumnComment = ''
}
})
},
columnSelectChanged(val) {
const column = this.columnOptions.find(function(item) {
return item.id === val
})
this.form.ruleColumn = column.columnName
this.form.ruleColumnComment = column.columnComment
this.$forceUpdate()
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addCheckRule(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
setTimeout(() => {
// 2秒后跳转列表页
this.$emit('showCard', this.showOptions)
}, 2000)
} else {
this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
}
}).catch(() => {
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" label-width="80px" disabled>
<el-form-item label="规则名称">
<el-input v-model="form.ruleName" />
</el-form-item>
<el-form-item label="规则级别">
<el-radio-group v-model="form.ruleLevel">
<el-radio
v-for="dict in ruleLevelOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="数据源">
<el-select v-model="form.ruleSourceId">
<el-option
v-for="source in sourceOptions"
:key="source.id"
:label="source.sourceName"
:value="source.id"
/>
</el-select>
</el-form-item>
<el-form-item label="数据表">
<el-select v-model="form.ruleTableId">
<el-option
v-for="table in tableOptions"
:key="table.id"
:label="table.tableName"
:value="table.id">
<span style="float: left">{{ table.tableName + '(' + table.tableComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核查字段">
<el-select v-model="form.ruleColumnId">
<el-option
v-for="column in columnOptions"
:key="column.id"
:label="column.columnName"
:value="column.id">
<span style="float: left">{{ column.columnName + '(' + column.columnComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核查脚本" prop="ruleSql">
<el-input v-model="form.ruleSql" type="textarea" />
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { getCheckRule } from '@/api/quality/checkrule'
import { listDataSource } from '@/api/metadata/datasource'
import { listDataTable } from '@/api/metadata/datatable'
import { listDataColumn } from '@/api/metadata/datacolumn'
export default {
name: 'CheckRuleDetail',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '核查规则详情',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 表单参数
form: {},
// 状态数据字典
statusOptions: [],
// 规则级别数据字典
ruleLevelOptions: [],
sourceOptions: [],
tableOptions: [],
columnOptions: []
}
},
created() {
console.log('id:' + this.data.id)
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getDicts('data_check_rule_level').then(response => {
if (response.success) {
this.ruleLevelOptions = response.data
}
})
this.getDataSourceList()
},
mounted() {
this.getCheckRule(this.data.id)
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
async getCheckRule(id) {
this.form = await getCheckRule(id).then(response => {
if (response.success) {
return response.data
}
})
this.tableOptions = await listDataTable({ sourceId: this.form.ruleSourceId }).then(response => {
if (response.success) {
return response.data
}
}) || []
this.columnOptions = await listDataColumn({ sourceId: this.form.ruleSourceId, tableId: this.form.ruleTableId }).then(response => {
if (response.success) {
return response.data
}
}) || []
},
getDataSourceList() {
listDataSource().then(response => {
if (response.success) {
this.sourceOptions = response.data
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled" @click="submitForm">{{ loadingOptions.loadingText }}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="规则名称" prop="ruleName">
<el-input v-model="form.ruleName" placeholder="请输入规则名称" />
</el-form-item>
<el-form-item label="规则级别" prop="ruleLevel">
<el-radio-group v-model="form.ruleLevel">
<el-radio
v-for="dict in ruleLevelOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="数据源" prop="ruleSourceId">
<el-select v-model="form.ruleSourceId" placeholder="请选择数据源" @change="sourceSelectChanged">
<el-option
v-for="source in sourceOptions"
:key="source.id"
:label="source.sourceName"
:value="source.id"
/>
</el-select>
</el-form-item>
<el-form-item label="数据表" prop="ruleTableId">
<el-select v-model="form.ruleTableId" placeholder="请选择数据表" @change="tableSelectChanged">
<el-option
v-for="table in tableOptions"
:key="table.id"
:label="table.tableName"
:value="table.id">
<span style="float: left">{{ table.tableName + '(' + table.tableComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核查字段" prop="ruleColumnId">
<el-select v-model="form.ruleColumnId" placeholder="请选择核查字段" @change="columnSelectChanged">
<el-option
v-for="column in columnOptions"
:key="column.id"
:label="column.columnName"
:value="column.id">
<span style="float: left">{{ column.columnName + '(' + column.columnComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="核查脚本" prop="ruleSql">
<el-input v-model="form.ruleSql" type="textarea" placeholder="请输入核查脚本" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { getCheckRule, updateCheckRule } from '@/api/quality/checkrule'
import { listDataSource } from '@/api/metadata/datasource'
import { listDataTable } from '@/api/metadata/datatable'
import { listDataColumn } from '@/api/metadata/datacolumn'
export default {
name: 'CheckRuleEdit',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '核查规则编辑',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数
form: {},
// 表单校验
rules: {
ruleName: [
{ required: true, message: '规则名称不能为空', trigger: 'blur' }
],
ruleSourceId: [
{ required: true, message: '数据源不能为空', trigger: 'change' }
],
ruleTableId: [
{ required: true, message: '数据表不能为空', trigger: 'change' }
],
ruleColumnId: [
{ required: true, message: '核查字段不能为空', trigger: 'change' }
]
},
// 状态数据字典
statusOptions: [],
// 规则级别数据字典
ruleLevelOptions: [],
sourceOptions: [],
tableOptions: [],
columnOptions: []
}
},
created() {
console.log('id:' + this.data.id)
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getDicts('data_check_rule_level').then(response => {
if (response.success) {
this.ruleLevelOptions = response.data
}
})
this.getDataSourceList()
},
mounted() {
this.getCheckRule(this.data.id)
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
async getCheckRule(id) {
this.form = await getCheckRule(id).then(response => {
if (response.success) {
return response.data
}
})
this.tableOptions = await listDataTable({ sourceId: this.form.ruleSourceId }).then(response => {
if (response.success) {
return response.data
}
})
this.columnOptions = await listDataColumn({ sourceId: this.form.ruleSourceId, tableId: this.form.ruleTableId }).then(response => {
if (response.success) {
return response.data
}
})
},
getDataSourceList() {
listDataSource().then(response => {
if (response.success) {
this.sourceOptions = response.data
}
})
},
sourceSelectChanged(val) {
listDataTable({ sourceId: val }).then(response => {
if (response.success) {
this.tableOptions = response.data
this.columnOptions = []
const source = this.sourceOptions.find(function(item) {
return item.id === val
})
this.form.ruleSource = source.sourceName
this.form.ruleTableId = ''
this.form.ruleTable = ''
this.form.ruleColumnId = ''
this.form.ruleColumn = ''
}
})
},
tableSelectChanged(val) {
listDataColumn({ sourceId: this.form.ruleSourceId, tableId: val }).then(response => {
if (response.success) {
this.columnOptions = response.data
const table = this.tableOptions.find(function(item) {
return item.id === val
})
this.form.ruleTable = table.tableName
this.form.ruleTableComment = table.tableComment
this.form.ruleColumnId = ''
this.form.ruleColumn = ''
this.form.ruleColumnComment = ''
}
})
},
columnSelectChanged(val) {
const column = this.columnOptions.find(function(item) {
return item.id === val
})
this.form.ruleColumn = column.columnName
this.form.ruleColumnComment = column.columnComment
this.$forceUpdate()
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateCheckRule(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
setTimeout(() => {
// 2秒后跳转列表页
this.$emit('showCard', this.showOptions)
}, 2000)
} else {
this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
}
}).catch(() => {
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-row :gutter="20">
<el-col :span="6">
<el-card class="box-card tree-wrapper" shadow="always">
<div class="body-wrapper">
<el-tree
ref="ruleType"
:data="ruleTypeOptions"
node-key="id"
empty-text="加载中,请稍后"
:props="defaultProps"
default-expand-all
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
>
<template slot-scope="{ node, data }">
<span class="custom-tree-node">
<span><i v-if="node.level === 1" class="iconfont icon-zuzhi tree-folder" />{{ node.label }}</span>
</span>
</template>
</el-tree>
</div>
</el-card>
</el-col>
<el-col :span="18">
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="规则名称" prop="ruleName">
<el-input
v-model="queryParams.ruleName"
placeholder="请输入规则名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row type="flex" justify="space-between">
<el-col :span="12">
<el-button-group>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-button-group>
</el-col>
<el-col :span="12">
<div class="right-toolbar">
<el-tooltip content="密度" effect="dark" placement="top">
<el-dropdown trigger="click" @command="handleCommand">
<el-button circle size="mini">
<svg-icon class-name="size-icon" icon-class="colum-height" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="medium">正常</el-dropdown-item>
<el-dropdown-item command="small">中等</el-dropdown-item>
<el-dropdown-item command="mini">紧凑</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-tooltip>
<el-tooltip content="刷新" effect="dark" placement="top">
<el-button circle size="mini" @click="handleRefresh">
<svg-icon class-name="size-icon" icon-class="shuaxin" />
</el-button>
</el-tooltip>
<el-tooltip content="列设置" effect="dark" placement="top">
<el-popover placement="bottom" width="100" trigger="click">
<el-checkbox-group v-model="checkedTableColumns" @change="handleCheckedColsChange">
<el-checkbox
v-for="(item, index) in tableColumns"
:key="index"
:label="item.prop"
>{{ item.label }}</el-checkbox>
</el-checkbox-group>
<span slot="reference">
<el-button circle size="mini">
<svg-icon class-name="size-icon" icon-class="shezhi" />
</el-button>
</span>
</el-popover>
</el-tooltip>
</div>
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:size="tableSize"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popover
placement="left"
trigger="click"
>
<el-button
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="handleEdit(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</el-col>
</el-row>
</template>
<script>
import { listRuleType, pageCheckRule, delCheckRule } from '@/api/quality/checkrule'
export default {
name: 'CheckRuleList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 遮罩层
loading: true,
// 表格头
tableColumns: [
{ prop: 'ruleName', label: '规则名称', show: true },
{ prop: 'ruleType', label: '规则类型', show: true },
{ prop: 'ruleSource', label: '数据源', show: true },
{ prop: 'ruleTable', label: '数据表', show: true, formatter: this.ruleTableFormatter },
{ prop: 'ruleColumn', label: '核查字段', show: true, formatter: this.ruleColumnFormatter },
{ prop: 'ruleLevel', label: '规则级别', show: true, formatter: this.ruleLevelFormatter },
{
prop: 'status',
label: '状态',
show: true,
formatter: this.statusFormatter
},
{ prop: 'createTime', label: '创建时间', show: true }
],
// 默认选择中表格头
checkedTableColumns: [],
tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
ruleTypeId: '',
ruleName: ''
},
// 左侧树
ruleTypeOptions: [],
defaultProps: {
children: 'children',
label: 'name'
},
// 规则级别数据字典
ruleLevelOptions: []
}
},
created() {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getDicts('data_check_rule_level').then(response => {
if (response.success) {
this.ruleLevelOptions = response.data
}
})
this.getTree()
this.getList()
},
mounted() {
this.initCols()
},
methods: {
getTree() {
listRuleType().then(response => {
if (response.success) {
const { data } = response
const tree = {}
tree.name = '核查规则类型'
tree.children = data
this.ruleTypeOptions = []
this.ruleTypeOptions.push(tree)
}
})
},
/** 节点单击事件 */
handleNodeClick(data) {
if (data.id) {
this.queryParams.ruleTypeId = data.id
this.getList()
}
},
/** 查询数据源列表 */
getList() {
this.loading = true
pageCheckRule(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
initCols() {
this.checkedTableColumns = this.tableColumns.map(col => col.prop)
},
handleCheckedColsChange(val) {
this.tableColumns.forEach(col => {
if (!this.checkedTableColumns.includes(col.prop)) {
col.show = false
} else {
col.show = true
}
})
},
handleCommand(command) {
this.tableSize = command
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
ruleTypeId: '',
ruleName: ''
}
this.handleQuery()
},
/** 刷新列表 */
handleRefresh() {
this.getList()
},
/** 新增按钮操作 */
handleAdd() {
this.showOptions.data = {}
if (!this.queryParams.ruleTypeId) {
this.$message.warning('请先选择核查规则类型')
return
}
this.showOptions.data.ruleTypeId = this.queryParams.ruleTypeId
this.showOptions.showList = false
this.showOptions.showAdd = true
this.showOptions.showEdit = false
this.showOptions.showDetail = false
this.$emit('showCard', this.showOptions)
},
/** 修改按钮操作 */
handleEdit(row) {
this.showOptions.data.id = row.id
this.showOptions.showList = false
this.showOptions.showAdd = false
this.showOptions.showEdit = true
this.showOptions.showDetail = false
this.$emit('showCard', this.showOptions)
},
/** 详情按钮操作 */
handleDetail(row) {
this.showOptions.data.id = row.id
this.showOptions.showList = false
this.showOptions.showAdd = false
this.showOptions.showEdit = false
this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions)
},
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delCheckRule(row.id).then(response => {
if (response.success) {
this.$message.success('删除成功')
this.getList()
}
})
}).catch(() => {
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictLabel}</el-tag>
} else {
return <el-tag type='warning'>{dictLabel}</el-tag>
}
},
ruleTableFormatter(row, column, cellValue, index) {
return row.ruleTableComment ? row.ruleTable + '(' + row.ruleTableComment + ')' : row.ruleTable
},
ruleColumnFormatter(row, column, cellValue, index) {
return row.ruleColumnComment ? row.ruleColumn + '(' + row.ruleColumnComment + ')' : row.ruleColumn
},
ruleLevelFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.ruleLevelOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictLabel}</el-tag>
} else if (cellValue === '2') {
return <el-tag type='warning'>{dictLabel}</el-tag>
} else if (cellValue === '3') {
return <el-tag type='danger'>{dictLabel}</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
.tree-wrapper {
overflow-y: auto;
.body-wrapper {
margin: -10px;
::v-deep .custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
.tree-folder {
margin-right: 5px;
color: #f6cf07;
}
}
}
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<check-rule-list v-if="options.showList" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-top">
<check-rule-add v-if="options.showAdd" :data="options.data" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-top">
<check-rule-edit v-if="options.showEdit" :data="options.data" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-bottom">
<check-rule-detail v-if="options.showDetail" :data="options.data" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import CheckRuleList from './CheckRuleList'
import CheckRuleAdd from './CheckRuleAdd'
import CheckRuleEdit from './CheckRuleEdit'
import CheckRuleDetail from './CheckRuleDetail'
export default {
name: 'CheckRule',
components: { CheckRuleList, CheckRuleAdd, CheckRuleEdit, CheckRuleDetail },
data() {
return {
options: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
Quality
</div>
</template>
<script>
export default {
name: 'Quality'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
ContrastRelease
</div>
</template>
<script>
export default {
name: 'ContrastRelease'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
ContrastResult
</div>
</template>
<script>
export default {
name: 'ContrastResult'
}
</script>
<style lang="scss" scoped>
</style>
...@@ -65,27 +65,6 @@ ...@@ -65,27 +65,6 @@
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button <el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
<el-button
type="warning" type="warning"
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
...@@ -140,7 +119,6 @@ ...@@ -140,7 +119,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -237,12 +215,6 @@ export default { ...@@ -237,12 +215,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'gbTypeCode', label: '标准类别编码', show: true }, { prop: 'gbTypeCode', label: '标准类别编码', show: true },
...@@ -444,12 +416,6 @@ export default { ...@@ -444,12 +416,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -466,7 +432,7 @@ export default { ...@@ -466,7 +432,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -475,7 +441,7 @@ export default { ...@@ -475,7 +441,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -508,16 +474,6 @@ export default { ...@@ -508,16 +474,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled" @click="submitForm">{{ loadingOptions.loadingText }}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典编码" prop="colCode">
<el-input v-model="form.colCode" placeholder="请输入字典编码" />
</el-form-item>
<el-form-item label="字典名称" prop="colName">
<el-input v-model="form.colName" placeholder="请输入字典名称" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status" disabled>
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { addContrastDict } from '@/api/standard/contrastdict'
export default {
name: 'DictContrastAdd',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '对照字典新增',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数
form: {
contrastId: undefined,
colCode: undefined,
colName: undefined,
status: '0'
},
// 表单校验
rules: {
colCode: [
{ required: true, message: '字典编码不能为空', trigger: 'blur' }
],
colName: [
{ required: true, message: '字典名称不能为空', trigger: 'blur' }
]
},
// 状态数据字典
statusOptions: []
}
},
created() {
console.log('data:' + this.data)
this.form.contrastId = this.data.contrastId
this.getDicts('data_contrast_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
addContrastDict(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
setTimeout(() => {
// 2秒后跳转列表页
this.$emit('showCard', this.showOptions)
}, 2000)
} else {
this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
}
}).catch(() => {
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" label-width="80px" disabled>
<el-form-item label="字典编码">
<el-input v-model="form.colCode" />
</el-form-item>
<el-form-item label="字典名称">
<el-input v-model="form.colName" />
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { getContrastDict } from '@/api/standard/contrastdict'
export default {
name: 'DictContrastDetail',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '对照字典详情',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 表单参数
form: {},
// 状态数据字典
statusOptions: []
}
},
created() {
console.log('id:' + this.data.id)
this.getDicts('data_contrast_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
},
mounted() {
this.getContrastDict(this.data.id)
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
getContrastDict: function(id) {
getContrastDict(id).then(response => {
if (response.success) {
this.form = response.data
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-card class="box-card" shadow="always">
<div slot="header" class="clearfix">
<span>{{ title }}</span>
<el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-plus" round :loading="loadingOptions.loading" :disabled="loadingOptions.isDisabled" @click="submitForm">{{ loadingOptions.loadingText }}</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group>
</div>
<div class="body-wrapper">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典编码" prop="colCode">
<el-input v-model="form.colCode" placeholder="请输入字典编码" />
</el-form-item>
<el-form-item label="字典名称" prop="colName">
<el-input v-model="form.colName" placeholder="请输入字典名称" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status" disabled>
<el-radio
v-for="dict in statusOptions"
:key="dict.id"
:label="dict.itemText"
>{{ dict.itemValue }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
</div>
</el-card>
</template>
<script>
import { getContrastDict, updateContrastDict } from '@/api/standard/contrastdict'
export default {
name: 'DictContrastEdit',
props: {
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
title: '对照字典编辑',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 保存按钮
loadingOptions: {
loading: false,
loadingText: '保存',
isDisabled: false
},
// 表单参数
form: {},
// 表单校验
rules: {
colCode: [
{ required: true, message: '字典编码不能为空', trigger: 'blur' }
],
colName: [
{ required: true, message: '字典名称不能为空', trigger: 'blur' }
]
},
// 状态数据字典
statusOptions: []
}
},
created() {
console.log('id:' + this.data.id)
this.getDicts('data_contrast_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
},
mounted() {
this.getContrastDict(this.data.id)
},
methods: {
showCard() {
this.$emit('showCard', this.showOptions)
},
/** 获取详情 */
getContrastDict: function(id) {
getContrastDict(id).then(response => {
if (response.success) {
this.form = response.data
}
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs['form'].validate(valid => {
if (valid) {
this.loadingOptions.loading = true
this.loadingOptions.loadingText = '保存中...'
this.loadingOptions.isDisabled = true
updateContrastDict(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
setTimeout(() => {
// 2秒后跳转列表页
this.$emit('showCard', this.showOptions)
}, 2000)
} else {
this.$message.error('保存失败')
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
}
}).catch(() => {
this.loadingOptions.loading = false
this.loadingOptions.loadingText = '保存'
this.loadingOptions.isDisabled = false
})
}
})
}
}
}
</script>
<style lang="scss" scoped>
.el-card ::v-deep .el-card__body {
height: calc(100vh - 230px);
overflow-y: auto;
}
</style>
<template>
<el-row :gutter="20">
<el-col :span="6">
<el-card class="box-card tree-wrapper" shadow="always">
<div class="body-wrapper">
<el-tree
ref="tree"
:data="treeOptions"
node-key="id"
empty-text="加载中,请稍后"
:props="defaultProps"
default-expand-all
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
>
<template slot-scope="{ node, data }">
<span class="custom-tree-node" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)">
<span><i v-if="node.level === 1" class="iconfont icon-zuzhi tree-folder" />{{ data.name ? node.label + '(' + data.name + ')' : node.label }}</span>
<span class="tree-bts">
<i v-show="node.level === 1 && data.show" class="el-icon-circle-plus-outline bt-add" @click="() => handleAddContrast()" />
<i v-show="node.level === 4 && data.show" class="el-icon-edit-outline bt-edit" @click="() => handleEditContrast(data)" />
<i v-show="node.level === 4 && data.show" class="el-icon-delete bt-delete" @click="() => handleDelContrast(data)" />
</span>
</span>
</template>
</el-tree>
</div>
</el-card>
</el-col>
<el-col :span="18">
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="字典编码" prop="colCode">
<el-input
v-model="queryParams.colCode"
placeholder="请输入字典编码"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="字典名称" prop="colName">
<el-input
v-model="queryParams.colName"
placeholder="请输入字典名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row type="flex" justify="space-between">
<el-col :span="12">
<el-button-group>
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-button-group>
</el-col>
<el-col :span="12">
<div class="right-toolbar">
<el-tooltip content="密度" effect="dark" placement="top">
<el-dropdown trigger="click" @command="handleCommand">
<el-button circle size="mini">
<svg-icon class-name="size-icon" icon-class="colum-height" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="medium">正常</el-dropdown-item>
<el-dropdown-item command="small">中等</el-dropdown-item>
<el-dropdown-item command="mini">紧凑</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-tooltip>
<el-tooltip content="刷新" effect="dark" placement="top">
<el-button circle size="mini" @click="handleRefresh">
<svg-icon class-name="size-icon" icon-class="shuaxin" />
</el-button>
</el-tooltip>
<el-tooltip content="列设置" effect="dark" placement="top">
<el-popover placement="bottom" width="100" trigger="click">
<el-checkbox-group v-model="checkedTableColumns" @change="handleCheckedColsChange">
<el-checkbox
v-for="(item, index) in tableColumns"
:key="index"
:label="item.prop"
>{{ item.label }}</el-checkbox>
</el-checkbox-group>
<span slot="reference">
<el-button circle size="mini">
<svg-icon class-name="size-icon" icon-class="shezhi" />
</el-button>
</span>
</el-popover>
</el-tooltip>
</div>
</el-col>
</el-row>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:size="tableSize"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popover
placement="left"
trigger="click"
>
<el-button
size="mini"
type="text"
icon="el-icon-edit-outline"
@click="handleEdit(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleDetail(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</el-col>
<!-- 对照表对话框 -->
<form-contrast v-if="dialogFormContrastVisible" :visible.sync="dialogFormContrastVisible" :data="currentContrast" @handleFormContrastFinished="getTree"></form-contrast>
</el-row>
</template>
<script>
import { getContrastTree, delContrast } from '@/api/standard/contrast'
import { pageContrastDict, delContrastDict } from '@/api/standard/contrastdict'
import FormContrast from './components/FormContrast'
export default {
name: 'DictContrastList',
components: { FormContrast },
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
},
// 遮罩层
loading: true,
// 表格头
tableColumns: [
{ prop: 'sourceName', label: '数据源', show: true },
{ prop: 'tableName', label: '数据表', show: true },
{ prop: 'columnName', label: '对照字段', show: true },
{ prop: 'gbTypeCode', label: '标准类别编码', show: true },
{ prop: 'gbTypeName', label: '标准类别名称', show: true },
{ prop: 'colCode', label: '字典编码', show: true },
{ prop: 'colName', label: '字典名称', show: true },
{
prop: 'status',
label: '状态',
show: true,
formatter: this.statusFormatter
},
{ prop: 'createTime', label: '创建时间', show: true }
],
// 默认选择中表格头
checkedTableColumns: [],
tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
contrastId: '',
colCode: '',
colName: ''
},
// 左侧树
treeOptions: [],
defaultProps: {
children: 'children',
label: 'label'
},
// 对照表
dialogFormContrastVisible: false,
currentContrast: {}
}
},
created() {
this.getDicts('data_contrast_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getTree()
this.getList()
},
mounted() {
this.initCols()
},
methods: {
getTree() {
getContrastTree().then(response => {
if (response.success) {
const { data } = response
const tree = {}
tree.label = '对照表'
tree.children = data
this.treeOptions = []
this.treeOptions.push(tree)
}
})
},
/** 节点单击事件 */
handleNodeClick(data, node) {
this.queryParams.contrastId = ''
if (node.level === 4) {
this.queryParams.contrastId = data.id
this.getList()
}
},
/** 树节点鼠标移入移出 */
mouseenter(data) {
this.$set(data, 'show', true)
},
mouseleave(data) {
this.$set(data, 'show', false)
},
handleAddContrast() {
this.dialogFormContrastVisible = true
this.currentContrast = {}
},
handleEditContrast(data) {
this.dialogFormContrastVisible = true
this.currentContrast = Object.assign({}, data.data)
},
handleDelContrast(data) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delContrast(data.id).then(response => {
if (response.success) {
this.$message.success('删除成功')
this.getTree()
}
})
}).catch(() => {
})
},
/** 查询数据源列表 */
getList() {
this.loading = true
pageContrastDict(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
initCols() {
this.checkedTableColumns = this.tableColumns.map(col => col.prop)
},
handleCheckedColsChange(val) {
this.tableColumns.forEach(col => {
if (!this.checkedTableColumns.includes(col.prop)) {
col.show = false
} else {
col.show = true
}
})
},
handleCommand(command) {
this.tableSize = command
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
contrastId: '',
colCode: '',
colName: ''
}
this.handleQuery()
},
/** 刷新列表 */
handleRefresh() {
this.getList()
},
/** 新增按钮操作 */
handleAdd() {
this.showOptions.data = {}
if (!this.queryParams.contrastId) {
this.$message.warning('请先选择对照表字段')
return
}
this.showOptions.data.contrastId = this.queryParams.contrastId
this.showOptions.showList = false
this.showOptions.showAdd = true
this.showOptions.showEdit = false
this.showOptions.showDetail = false
this.$emit('showCard', this.showOptions)
},
/** 修改按钮操作 */
handleEdit(row) {
this.showOptions.data.id = row.id
this.showOptions.showList = false
this.showOptions.showAdd = false
this.showOptions.showEdit = true
this.showOptions.showDetail = false
this.$emit('showCard', this.showOptions)
},
/** 详情按钮操作 */
handleDetail(row) {
this.showOptions.data.id = row.id
this.showOptions.showList = false
this.showOptions.showAdd = false
this.showOptions.showEdit = false
this.showOptions.showDetail = true
this.$emit('showCard', this.showOptions)
},
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delContrastDict(row.id).then(response => {
if (response.success) {
this.$message.success('删除成功')
this.getList()
}
})
}).catch(() => {
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (cellValue === '1') {
return <el-tag type='success'>{dictLabel}</el-tag>
} else {
return <el-tag type='warning'>{dictLabel}</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
.tree-wrapper {
overflow-y: auto;
.body-wrapper {
margin: -10px;
::v-deep .custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
.tree-folder {
margin-right: 5px;
color: #f6cf07;
}
.tree-bts {
.bt-add {
color: #409eff;
}
.bt-edit {
color: #67c23a;
}
.bt-delete {
color: #f56c6c;
}
i {
margin-right: 10px;
padding: 0px;
}
}
}
}
}
</style>
<template>
<el-dialog title="对照表" width="50%" :visible.sync="dialogVisible">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="数据源" prop="sourceId">
<el-select v-model="form.sourceId" placeholder="请选择数据源" @change="sourceSelectChanged">
<el-option
v-for="source in sourceOptions"
:key="source.id"
:label="source.sourceName"
:value="source.id"
/>
</el-select>
</el-form-item>
<el-form-item label="数据表" prop="tableId">
<el-select v-model="form.tableId" placeholder="请选择数据表" @change="tableSelectChanged">
<el-option
v-for="table in tableOptions"
:key="table.id"
:label="table.tableName"
:value="table.id">
<span style="float: left">{{ table.tableName + '(' + table.tableComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="对照字段" prop="columnId">
<el-select v-model="form.columnId" placeholder="请选择对照字段" @change="columnSelectChanged">
<el-option
v-for="column in columnOptions"
:key="column.id"
:label="column.columnName"
:value="column.id">
<span style="float: left">{{ column.columnName + '(' + column.columnComment + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="标准类别" prop="gbTypeId">
<el-select v-model="form.gbTypeId" placeholder="请选择标准类别">
<el-option
v-for="type in gbTypeOptions"
:key="type.id"
:label="type.gbTypeName"
:value="type.id">
<span style="float: left">{{ type.gbTypeName + '(' + type.gbTypeCode + ')' }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="绑定标准字段" prop="bindGbColumn">
<el-select v-model="form.bindGbColumn" placeholder="请选择标准字典字段">
<el-option
v-for="item in gbColumnOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</span>
</el-dialog>
</template>
<script>
import { addContrast, updateContrast } from '@/api/standard/contrast'
import { listDataSource } from '@/api/metadata/datasource'
import { listDataTable } from '@/api/metadata/datatable'
import { listDataColumn } from '@/api/metadata/datacolumn'
import { listDataDictType } from '@/api/standard/datadict'
export default {
name: 'FormContrast',
props: {
visible: {
type: Boolean,
default: function() {
return false
}
},
data: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
form: {
sourceId: undefined,
sourceName: undefined,
tableId: undefined,
tableName: undefined,
columnId: undefined,
columnName: undefined,
gbTypeId: undefined,
bindGbColumn: undefined
},
rules: {
sourceId: [
{ required: true, message: '数据源不能为空', trigger: 'change' }
],
tableId: [
{ required: true, message: '数据表不能为空', trigger: 'change' }
],
columnId: [
{ required: true, message: '对照字段不能为空', trigger: 'change' }
],
gbTypeId: [
{ required: true, message: '标准类别不能为空', trigger: 'change' }
],
bindGbColumn: [
{ required: true, message: '绑定标准字段不能为空', trigger: 'change' }
]
},
sourceOptions: [],
tableOptions: [],
columnOptions: [],
gbTypeOptions: [],
// 标准字典字段数据字典
gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' }
]
}
},
computed: {
dialogVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:visible', val)
}
}
},
created() {
console.log(this.data)
this.form = Object.assign({}, this.data)
this.getDataSourceList()
this.getDictTypeList()
},
methods: {
getDictTypeList() {
listDataDictType().then(response => {
if (response.success) {
this.gbTypeOptions = response.data
}
})
},
getDataSourceList() {
listDataSource().then(response => {
if (response.success) {
this.sourceOptions = response.data
}
})
},
sourceSelectChanged(val) {
listDataTable({ sourceId: val }).then(response => {
if (response.success) {
this.tableOptions = response.data
this.columnOptions = []
const source = this.sourceOptions.find(function(item) {
return item.id === val
})
this.form.sourceName = source.sourceName
this.form.tableId = ''
this.form.tableName = ''
this.form.columnId = ''
this.form.columnName = ''
}
})
},
tableSelectChanged(val) {
listDataColumn({ sourceId: this.form.sourceId, tableId: val }).then(response => {
if (response.success) {
this.columnOptions = response.data
const table = this.tableOptions.find(function(item) {
return item.id === val
})
this.form.tableName = table.tableName
this.form.tableComment = table.tableComment
this.form.columnId = ''
this.form.columnName = ''
this.form.columnComment = ''
}
})
},
columnSelectChanged(val) {
const column = this.columnOptions.find(function(item) {
return item.id === val
})
this.form.columnName = column.columnName
this.form.columnComment = column.columnComment
this.$forceUpdate()
},
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id) {
updateContrast(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
this.dialogVisible = false
this.$emit('handleFormContrastFinished')
}
}).catch(error => {
this.$message.error(error.msg || '保存失败')
})
} else {
addContrast(this.form).then(response => {
if (response.success) {
this.$message.success('保存成功')
this.dialogVisible = false
this.$emit('handleFormContrastFinished')
}
}).catch(error => {
this.$message.error(error.msg || '保存失败')
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<dict-contrast-list v-if="options.showList" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-top">
<dict-contrast-add v-if="options.showAdd" :data="options.data" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-top">
<dict-contrast-edit v-if="options.showEdit" :data="options.data" @showCard="showCard" />
</transition>
<transition name="el-zoom-in-bottom">
<dict-contrast-detail v-if="options.showDetail" :data="options.data" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import DictContrastList from './DictContrastList'
import DictContrastAdd from './DictContrastAdd'
import DictContrastEdit from './DictContrastEdit'
import DictContrastDetail from './DictContrastDetail'
export default {
name: 'DictContrast',
components: { DictContrastList, DictContrastAdd, DictContrastEdit, DictContrastDetail },
data() {
return {
options: {
data: {},
showList: true,
showAdd: false,
showEdit: false,
showDetail: false
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="6">
<el-card class="box-card tree-wrapper" shadow="always">
<div class="body-wrapper">
<el-tree
ref="tree"
:data="treeOptions"
node-key="id"
empty-text="加载中,请稍后"
:props="defaultProps"
default-expand-all
highlight-current
:expand-on-click-node="false"
@node-click="handleNodeClick"
>
<template slot-scope="{ node, data }">
<span class="custom-tree-node">
<span><i v-if="node.level === 1" class="iconfont icon-zuzhi tree-folder" />{{ data.name ? node.label + '(' + data.name + ')' : node.label }}</span>
</span>
</template>
</el-tree>
</div>
</el-card>
</el-col>
<el-col :span="18">
<el-card class="box-card" shadow="always">
<el-row>
<el-col :span="24">
<el-button type="primary" size="mini" @click="handleAuto">自动对照</el-button>
<el-button type="primary" size="mini" @click="handleManual">手动对照</el-button>
<el-button type="primary" size="mini">取消对照</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-alert
type="success"
:closable="false"
style="margin: 15px 0;"
>
<span slot="title">
{{ title }}
</span>
</el-alert>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-alert
type="warning"
:closable="false"
>
<span slot="title">
{{ description }}
</span>
</el-alert>
</el-col>
</el-row>
<el-row id="jsplumbContainer" :gutter="20">
<el-col :span="9">
<table id="leftTable">
<thead>
<tr>
<th>字典编码</th>
<th>字典名称</th>
<th>映射编码</th>
<th>映射名称</th>
</tr>
</thead>
<tbody>
<tr v-for="(data, index) in leftTableDataList" :key="index" :id="'item_left_' + data.id">
<td>{{ data.colCode }}</td>
<td>{{ data.colName }}</td>
<td>{{ data.contrastGbCode }}</td>
<td>{{ data.contrastGbName }}</td>
</tr>
</tbody>
</table>
</el-col>
<el-col :span="9" :offset="6">
<table id="rightTable">
<thead>
<tr>
<th>标准编码</th>
<th>标准名称</th>
</tr>
</thead>
<tbody>
<tr v-for="(data, index) in rightTableDataList" :key="index" :id="'item_right_' + data.id">
<td>{{ data.gbCode }}</td>
<td>{{ data.gbName }}</td>
</tr>
</tbody>
</table>
</el-col>
</el-row>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { getContrastTree } from '@/api/standard/contrast'
import { getDictMapping, dictAutoMapping } from '@/api/standard/dictmapping'
import { jsPlumb } from 'jsplumb'
export default {
name: 'DictMapping',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 遮罩层
loading: false,
// 左侧对照数据
leftTableDataList: [],
// 右侧标准字典数据
rightTableDataList: [],
// 左侧树
treeOptions: [],
defaultProps: {
children: 'children',
label: 'label'
},
contrastId: undefined,
title: '',
description: '',
jsPlumb: null
}
},
created() {
this.getTree()
},
mounted() {
this.jsPlumb = jsPlumb.getInstance({
// 锚点位置;对任何没有声明描点的Endpoint设置锚点,用于source及target节点
Anchor: ['Right', 'Left'],
// 连线的source和target Anchor
Anchors: ['Right', 'Left'],
// 鼠标不能拖动删除线
ConnectionsDetachable: true,
// 删除线的时候节点不删除
DeleteEndpointsOnDetach: false,
// 连线的样式,有四种默认类型:Bezier(贝塞尔曲线),Straight(直线),Flowchart(流程图),State machine(状态机)
Connector: 'Bezier',
// 父级元素id;假如页面元素所在上层不同,最外层父级一定要设置
Container: 'jsplumbContainer'
})
this.$nextTick(() => {
this.initJsPlumb()
})
},
methods: {
initJsPlumb() {
const _this = this
this.jsPlumb.ready(function() {
// 双击连接线(删除)
_this.jsPlumb.bind('dblclick', function(conn, originalEvent) {
console.log('dblclick', conn)
})
// 连线
_this.jsPlumb.bind('connection', function(evt) {
console.log('connection', evt)
})
// 删除连线
_this.jsPlumb.bind('connectionDetached', function(evt) {
console.log('connectionDetached', evt)
})
// beforeDrop
_this.jsPlumb.bind('beforeDrop', function(evt) {
console.log('beforeDrop', evt)
})
})
},
getTree() {
getContrastTree().then(response => {
if (response.success) {
const { data } = response
const tree = {}
tree.label = '对照表'
tree.children = data
this.treeOptions = []
this.treeOptions.push(tree)
}
})
},
/** 节点单击事件 */
handleNodeClick(data, node) {
if (node.level === 4) {
this.contrastId = data.id
this.getDictMapping()
}
},
getDictMapping() {
this.loading = true
getDictMapping(this.contrastId).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.leftTableDataList = data.left
this.rightTableDataList = data.right
this.title = data.title
this.description = data.description
this.$nextTick(() => {
this.initEndpoint()
})
}
})
},
initEndpoint() {
const _this = this
// 过滤掉已映射数据
this.leftTableDataList.filter(item => item.status === '0').forEach(function(item, index, arr) {
_this.jsPlumb.addEndpoint('item_left_' + item.id, {
anchors: ['Right'],
uuid: item.id
},{
isSource: true,
isTarget: true,
connector: ['Straight']
})
})
this.rightTableDataList.forEach(function(item, index, arr) {
_this.jsPlumb.addEndpoint('item_right_' + item.id, {
anchors: ['Left'],
uuid: item.id
},{
isSource: true,
isTarget: true,
connector: ['Straight']
})
})
// const connection = this.jsPlumb.connect({ uuids: ['fromId', 'toId'] })
// // 初始化label
// connection.getOverlay('label-1').setLabel('映射连线')
},
handleAuto() {
dictAutoMapping(this.contrastId).then(response => {
if (response.success) {
this.$message.success('对照成功')
this.getDictMapping()
}
})
},
handleManual() {
console.log(this.contrastId)
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
.tree-wrapper {
overflow-y: auto;
.body-wrapper {
margin: -10px;
::v-deep .custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
.tree-folder {
margin-right: 5px;
color: #f6cf07;
}
}
}
}
#leftTable, #rightTable {
width: 100%;
margin: 15px 0;
border-collapse: collapse;
tr th {
color: #909399;
font-weight: bold;
}
tr th, tr td {
font-size: 14px;
border: 1px solid #EBEEF5;
padding: 5px 10px;
}
}
</style>
...@@ -25,27 +25,6 @@ ...@@ -25,27 +25,6 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
</el-button-group> </el-button-group>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -95,7 +74,6 @@ ...@@ -95,7 +74,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -157,7 +135,7 @@ ...@@ -157,7 +135,7 @@
</template> </template>
<script> <script>
import { pageDataSet, delDataSet, delDataSets } from '@/api/visual/dataset' import { pageDataSet, delDataSet } from '@/api/visual/dataset'
export default { export default {
name: 'DataSetList', name: 'DataSetList',
...@@ -174,12 +152,6 @@ export default { ...@@ -174,12 +152,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'setName', label: '数据集名称', show: true }, { prop: 'setName', label: '数据集名称', show: true },
...@@ -265,12 +237,6 @@ export default { ...@@ -265,12 +237,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -282,7 +248,7 @@ export default { ...@@ -282,7 +248,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -291,7 +257,7 @@ export default { ...@@ -291,7 +257,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -314,16 +280,6 @@ export default { ...@@ -314,16 +280,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<el-option <el-option
v-for="item in menuOptions" v-for="item in menuOptions"
:key="item.menuCode" :key="item.menuCode"
:label="item.menuName" :label="item.menuCode"
:value="item.menuCode"> :value="item.menuCode">
<span style="float: left">{{ '业务名称:' + item.menuName + '-业务编码:' + item.menuCode }}</span> <span style="float: left">{{ '业务名称:' + item.menuName + '-业务编码:' + item.menuCode }}</span>
</el-option> </el-option>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<el-option <el-option
v-for="item in menuOptions" v-for="item in menuOptions"
:key="item.menuCode" :key="item.menuCode"
:label="item.menuName" :label="item.menuCode"
:value="item.menuCode"> :value="item.menuCode">
<span style="float: left">{{ '业务名称:' + item.menuName + '-业务编码:' + item.menuCode }}</span> <span style="float: left">{{ '业务名称:' + item.menuName + '-业务编码:' + item.menuCode }}</span>
</el-option> </el-option>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<el-option <el-option
v-for="item in menuOptions" v-for="item in menuOptions"
:key="item.menuCode" :key="item.menuCode"
:label="item.menuName" :label="item.menuCode"
:value="item.menuCode"> :value="item.menuCode">
<span style="float: left">{{ '业务名称:' + item.menuName + '-业务编码:' + item.menuCode }}</span> <span style="float: left">{{ '业务名称:' + item.menuName + '-业务编码:' + item.menuCode }}</span>
</el-option> </el-option>
......
...@@ -26,27 +26,6 @@ ...@@ -26,27 +26,6 @@
@click="handleAdd" @click="handleAdd"
>新增</el-button> >新增</el-button>
<el-button <el-button
type="success"
icon="el-icon-edit-outline"
size="mini"
:disabled="single"
@click="handleEdit"
>修改</el-button>
<el-button
type="info"
icon="el-icon-view"
size="mini"
:disabled="single"
@click="handleDetail"
>详情</el-button>
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleBatchDelete"
>删除</el-button>
<el-button
type="warning" type="warning"
icon="el-icon-refresh" icon="el-icon-refresh"
size="mini" size="mini"
...@@ -101,7 +80,6 @@ ...@@ -101,7 +80,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -180,12 +158,6 @@ export default { ...@@ -180,12 +158,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'businessCode', label: '业务编码', show: true }, { prop: 'businessCode', label: '业务编码', show: true },
...@@ -273,12 +245,6 @@ export default { ...@@ -273,12 +245,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.showOptions.data = {} this.showOptions.data = {}
...@@ -290,7 +256,7 @@ export default { ...@@ -290,7 +256,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEdit(row) { handleEdit(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = true this.showOptions.showEdit = true
...@@ -299,7 +265,7 @@ export default { ...@@ -299,7 +265,7 @@ export default {
}, },
/** 详情按钮操作 */ /** 详情按钮操作 */
handleDetail(row) { handleDetail(row) {
this.showOptions.data.id = row.id || this.ids[0] this.showOptions.data.id = row.id
this.showOptions.showList = false this.showOptions.showList = false
this.showOptions.showAdd = false this.showOptions.showAdd = false
this.showOptions.showEdit = false this.showOptions.showEdit = false
...@@ -322,16 +288,6 @@ export default { ...@@ -322,16 +288,6 @@ export default {
}).catch(() => { }).catch(() => {
}) })
}, },
/** 批量删除按钮操作 */
handleBatchDelete() {
if (!this.ids.length) {
this.$message({
message: '请先选择需要操作的数据',
type: 'warning'
})
}
this.$message.warning('不支持批量删除')
},
/** 刷新缓存 */ /** 刷新缓存 */
handleCacheRefresh() { handleCacheRefresh() {
refreshBusiness().then(response => { refreshBusiness().then(response => {
......
...@@ -40,15 +40,6 @@ ...@@ -40,15 +40,6 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="流程定义KEY" prop="key">
<el-input
v-model="queryParams.key"
placeholder="请输入流程定义KEY"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
...@@ -113,7 +104,6 @@ ...@@ -113,7 +104,6 @@
:size="tableSize" :size="tableSize"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -210,12 +200,6 @@ export default { ...@@ -210,12 +200,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'id', label: '流程定义ID', show: true }, { prop: 'id', label: '流程定义ID', show: true },
...@@ -240,7 +224,6 @@ export default { ...@@ -240,7 +224,6 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
name: '', name: '',
key: '',
categoryId: '' categoryId: ''
}, },
// 左侧树 // 左侧树
...@@ -361,7 +344,6 @@ export default { ...@@ -361,7 +344,6 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
name: '', name: '',
key: '',
categoryId: '' categoryId: ''
} }
this.handleQuery() this.handleQuery()
...@@ -370,12 +352,6 @@ export default { ...@@ -370,12 +352,6 @@ export default {
handleRefresh() { handleRefresh() {
this.getList() this.getList()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleResource(row) { handleResource(row) {
this.currentProcessDefinitionId = row.id this.currentProcessDefinitionId = row.id
this.dialogFlowResourceVisible = true this.dialogFlowResourceVisible = true
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
tooltip-effect="dark" tooltip-effect="dark"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -91,12 +90,6 @@ export default { ...@@ -91,12 +90,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'processDefinitionId', label: '流程定义ID', show: true }, { prop: 'processDefinitionId', label: '流程定义ID', show: true },
...@@ -151,12 +144,6 @@ export default { ...@@ -151,12 +144,6 @@ export default {
} }
this.handleQuery() this.handleQuery()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleTrack(row) { handleTrack(row) {
this.currentProcessInstanceId = row.id this.currentProcessInstanceId = row.id
this.dialogFlowImageVisible = true this.dialogFlowImageVisible = true
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
tooltip-effect="dark" tooltip-effect="dark"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -92,12 +91,6 @@ export default { ...@@ -92,12 +91,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'processDefinitionId', label: '流程定义ID', show: true }, { prop: 'processDefinitionId', label: '流程定义ID', show: true },
...@@ -152,12 +145,6 @@ export default { ...@@ -152,12 +145,6 @@ export default {
} }
this.handleQuery() this.handleQuery()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleTrack(row) { handleTrack(row) {
this.currentProcessInstanceId = row.id this.currentProcessInstanceId = row.id
this.dialogFlowImageVisible = true this.dialogFlowImageVisible = true
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
tooltip-effect="dark" tooltip-effect="dark"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -112,12 +111,6 @@ export default { ...@@ -112,12 +111,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'processDefinitionId', label: '流程定义ID', show: true }, { prop: 'processDefinitionId', label: '流程定义ID', show: true },
...@@ -176,12 +169,6 @@ export default { ...@@ -176,12 +169,6 @@ export default {
} }
this.handleQuery() this.handleQuery()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleTrack(row) { handleTrack(row) {
this.currentProcessInstanceId = row.id this.currentProcessInstanceId = row.id
this.dialogFlowImageVisible = true this.dialogFlowImageVisible = true
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
tooltip-effect="dark" tooltip-effect="dark"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -80,12 +79,6 @@ export default { ...@@ -80,12 +79,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'name', label: '节点名称', show: true }, { prop: 'name', label: '节点名称', show: true },
...@@ -138,12 +131,6 @@ export default { ...@@ -138,12 +131,6 @@ export default {
} }
this.handleQuery() this.handleQuery()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleSizeChange(val) { handleSizeChange(val) {
console.log(`每页 ${val} 条`) console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
tooltip-effect="dark" tooltip-effect="dark"
:height="tableHeight" :height="tableHeight"
style="width: 100%;margin: 15px 0;" style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" width="55" align="center">
...@@ -131,12 +130,6 @@ export default { ...@@ -131,12 +130,6 @@ export default {
}, },
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头 // 表格头
tableColumns: [ tableColumns: [
{ prop: 'name', label: '节点名称', show: true }, { prop: 'name', label: '节点名称', show: true },
...@@ -194,12 +187,6 @@ export default { ...@@ -194,12 +187,6 @@ export default {
} }
this.handleQuery() this.handleQuery()
}, },
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleClaim(row) { handleClaim(row) {
this.$confirm('签收任务?', '提示', { this.$confirm('签收任务?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment