Merge pull request #12092 from dataease/pr@dev-v2@feat_outer-params-check

feat(数据大屏、仪表板): 板外部参数必传校验、支持默认值 #11501
This commit is contained in:
王嘉豪 2024-09-09 13:25:54 +08:00 committed by GitHub
commit 82f1794cd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 86 additions and 16 deletions

View File

@ -14,7 +14,7 @@ public class MybatisPlusGenerator {
* 第一 我嫌麻烦 * 第一 我嫌麻烦
* 第二 后面配置会放到nacos读起来更麻烦了 * 第二 后面配置会放到nacos读起来更麻烦了
*/ */
private static final String url = "jdbc:mysql://localhost:3306/dataease?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false"; private static final String url = "jdbc:mysql://localhost:3306/dataease4?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false";
private static final String username = "root"; private static final String username = "root";
private static final String password = "123456"; private static final String password = "123456";
@ -25,7 +25,7 @@ public class MybatisPlusGenerator {
/** /**
* 这是要生成代码的表名称 * 这是要生成代码的表名称
*/ */
private static final String TABLE_NAME = "visualization_outer_params_target_view_info"; private static final String TABLE_NAME = "visualization_outer_params_info";
/** /**
* 下面两个配置基本上不用动 * 下面两个配置基本上不用动

View File

@ -1,5 +1,6 @@
package io.dataease.visualization.dao.auto.entity; package io.dataease.visualization.dao.auto.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
@ -9,7 +10,7 @@ import java.io.Serializable;
* </p> * </p>
* *
* @author fit2cloud * @author fit2cloud
* @since 2024-03-08 * @since 2024-09-09
*/ */
@TableName("visualization_outer_params") @TableName("visualization_outer_params")
public class VisualizationOuterParams implements Serializable { public class VisualizationOuterParams implements Serializable {
@ -19,6 +20,7 @@ public class VisualizationOuterParams implements Serializable {
/** /**
* 主键 * 主键
*/ */
@TableId("params_id")
private String paramsId; private String paramsId;
/** /**

View File

@ -1,5 +1,6 @@
package io.dataease.visualization.dao.auto.entity; package io.dataease.visualization.dao.auto.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
@ -9,7 +10,7 @@ import java.io.Serializable;
* </p> * </p>
* *
* @author fit2cloud * @author fit2cloud
* @since 2024-03-08 * @since 2024-09-09
*/ */
@TableName("visualization_outer_params_info") @TableName("visualization_outer_params_info")
public class VisualizationOuterParamsInfo implements Serializable { public class VisualizationOuterParamsInfo implements Serializable {
@ -19,6 +20,7 @@ public class VisualizationOuterParamsInfo implements Serializable {
/** /**
* 主键 * 主键
*/ */
@TableId("params_info_id")
private String paramsInfoId; private String paramsInfoId;
/** /**
@ -46,6 +48,16 @@ public class VisualizationOuterParamsInfo implements Serializable {
*/ */
private String copyId; private String copyId;
/**
* 是否必填
*/
private Boolean required;
/**
* 默认值 JSON格式
*/
private String defaultValue;
public String getParamsInfoId() { public String getParamsInfoId() {
return paramsInfoId; return paramsInfoId;
} }
@ -94,6 +106,22 @@ public class VisualizationOuterParamsInfo implements Serializable {
this.copyId = copyId; this.copyId = copyId;
} }
public Boolean getRequired() {
return required;
}
public void setRequired(Boolean required) {
this.required = required;
}
public String getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
@Override @Override
public String toString() { public String toString() {
return "VisualizationOuterParamsInfo{" + return "VisualizationOuterParamsInfo{" +
@ -103,6 +131,8 @@ public class VisualizationOuterParamsInfo implements Serializable {
", checked = " + checked + ", checked = " + checked +
", copyFrom = " + copyFrom + ", copyFrom = " + copyFrom +
", copyId = " + copyId + ", copyId = " + copyId +
", required = " + required +
", defaultValue = " + defaultValue +
"}"; "}";
} }
} }

View File

@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
* </p> * </p>
* *
* @author fit2cloud * @author fit2cloud
* @since 2024-03-08 * @since 2024-09-09
*/ */
@Mapper @Mapper
public interface VisualizationOuterParamsInfoMapper extends BaseMapper<VisualizationOuterParamsInfo> { public interface VisualizationOuterParamsInfoMapper extends BaseMapper<VisualizationOuterParamsInfo> {

View File

@ -10,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
* </p> * </p>
* *
* @author fit2cloud * @author fit2cloud
* @since 2024-03-08 * @since 2024-09-09
*/ */
@Mapper @Mapper
public interface VisualizationOuterParamsMapper extends BaseMapper<VisualizationOuterParams> { public interface VisualizationOuterParamsMapper extends BaseMapper<VisualizationOuterParams> {

View File

@ -16,6 +16,8 @@
<result column="params_id" jdbcType="VARCHAR" property="paramsId" /> <result column="params_id" jdbcType="VARCHAR" property="paramsId" />
<result column="param_name" jdbcType="VARCHAR" property="paramName" /> <result column="param_name" jdbcType="VARCHAR" property="paramName" />
<result column="checked" jdbcType="BIT" property="checked" /> <result column="checked" jdbcType="BIT" property="checked" />
<result column="required" jdbcType="BIT" property="checked" />
<result column="default_value" jdbcType="VARCHAR" property="copyFrom" />
<result column="copy_from" jdbcType="VARCHAR" property="copyFrom" /> <result column="copy_from" jdbcType="VARCHAR" property="copyFrom" />
<result column="copy_id" jdbcType="VARCHAR" property="copyId" /> <result column="copy_id" jdbcType="VARCHAR" property="copyId" />
</resultMap> </resultMap>

View File

@ -4,14 +4,14 @@
:append-to-body="true" :append-to-body="true"
title="外部参数设置" title="外部参数设置"
v-model="state.outerParamsSetVisible" v-model="state.outerParamsSetVisible"
width="70vw" width="80vw"
top="10vh" top="10vh"
trigger="click" trigger="click"
> >
<el-row style="height: 550px"> <el-row style="height: 550px">
<el-row v-loading="state.loading"> <el-row v-loading="state.loading">
<el-row class="preview"> <el-row class="preview">
<el-col :span="8" class="preview-left"> <el-col :span="6" class="preview-left">
<el-row class="tree-head"> <el-row class="tree-head">
<span class="head-text">参数列表</span> <span class="head-text">参数列表</span>
<span class="head-filter"> <span class="head-filter">
@ -68,7 +68,7 @@
</el-tree> </el-tree>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="16" class="preview-show"> <el-col :span="14" class="preview-show">
<el-row v-if="state.curNodeId"> <el-row v-if="state.curNodeId">
<el-row class="new-params-title"> 选择参数关联组件 </el-row> <el-row class="new-params-title"> 选择参数关联组件 </el-row>
<el-row class="new-params-filter" v-if="state.outerParamsInfo?.filterInfo?.length"> <el-row class="new-params-filter" v-if="state.outerParamsInfo?.filterInfo?.length">
@ -246,6 +246,11 @@
<empty-background description="请配置参数" img-type="noneWhite" /> <empty-background description="请配置参数" img-type="noneWhite" />
</div> </div>
</el-col> </el-col>
<el-col :span="4" class="params-attach-setting">
<el-row v-if="state.curNodeId">
<el-row class="new-params-title"> 参数配置 </el-row>
</el-row>
</el-col>
</el-row> </el-row>
</el-row> </el-row>
<el-row class="root-class"> <el-row class="root-class">
@ -320,6 +325,8 @@ const state = reactive({
defaultOuterParamsInfo: { defaultOuterParamsInfo: {
paramName: '', paramName: '',
checked: true, checked: true,
required: false,
defaultValue: {},
targetViewInfoList: [] targetViewInfoList: []
}, },
defaultTargetViewInfo: { defaultTargetViewInfo: {
@ -972,4 +979,8 @@ defineExpose({
.expand-custom-outer { .expand-custom-outer {
margin-right: 4px; margin-right: 4px;
} }
.params-attach-setting {
border-left: 1px solid #e6e6e6;
}
</style> </style>

View File

@ -36,6 +36,18 @@ public class VisualizationOuterParamsInfoVO implements Serializable {
*/ */
private Boolean checked; private Boolean checked;
/**
* 是否必填
*/
private Boolean required;
/**
* 默认值 JSON格式
*/
private String defaultValue;
/** /**
* 复制来源 * 复制来源
*/ */

View File

@ -46,6 +46,17 @@ public class VisualizationOuterParamsVO implements Serializable {
*/ */
private String copyId; private String copyId;
/**
* 是否必填
*/
private Boolean required;
/**
* 默认值 JSON格式
*/
private String defaultValue;
public String getParamsId() { public String getParamsId() {
return paramsId; return paramsId;
} }
@ -97,12 +108,14 @@ public class VisualizationOuterParamsVO implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "VisualizationOuterParams{" + return "VisualizationOuterParams{" +
"paramsId = " + paramsId + "paramsId = " + paramsId +
", visualizationId = " + visualizationId + ", visualizationId = " + visualizationId +
", checked = " + checked + ", checked = " + checked +
", remark = " + remark + ", required = " + required +
", copyFrom = " + copyFrom + ", defaultValue = " + defaultValue +
", copyId = " + copyId + ", remark = " + remark +
"}"; ", copyFrom = " + copyFrom +
", copyId = " + copyId +
"}";
} }
} }