优化用例名称重复的限制,只限制在同项目下不能重复

增加生产事故数据迁移脚本
This commit is contained in:
seagull 2019-10-08 16:10:19 +08:00
parent 981d8d273b
commit b8feaefe86
7 changed files with 445 additions and 399 deletions

View File

@ -0,0 +1,27 @@
/*
* LuckyFrame SQL脚本从V2.7.2V3.1
* Version 3.1
* Author Seagull
* Date 2019-08-27
************ WARNING ************
V2.7.2V3.1
V2.7.2
*/
-- ----------------------------
-- 质量管理-生产事故登记数据迁移
-- ----------------------------
insert into qa_accident (accident_id,project_id,accident_status,accident_time,report_time,accident_description,accident_level,accident_analysis,accident_type,accident_consequence,corrective_action,resolution_time,resolutioner,preventive_action,preventiver,preventive_plan_date,preventive_over_date,duration_time,impact_time,accident_file_name,create_by)
select id,projectid,accstatus,eventtime,reporttime,accdescription,acclevel,causalanalysis,causaltype,consequenceanalysis,correctiveaction,resolutiontime,resolutioner,preventiveaction,preventiver,preventiveplandate,preventiveaccdate,trouble_duration,impact_time,filename,reporter from luckyframedb.qa_accident qa
where 1=1 and NOT EXISTS(select 1 from qa_accident where accident_id = qa.id);
/*修改NULL字符串为空*/
update qa_accident t set t.resolution_time='' where t.resolution_time='NULL';
update qa_accident t set t.resolutioner='' where t.resolutioner='NULL';
update qa_accident t set t.preventive_plan_date='' where t.preventive_plan_date='NULL';
update qa_accident t set t.preventive_over_date='' where t.preventive_over_date='NULL';
update qa_accident t set t.preventiver='' where t.preventiver='NULL';
update qa_accident t set t.report_time='' where t.report_time='NULL';
/*不是跟踪处理完成状态的记录把解决时间跟解决人员修改成NULL*/
update qa_accident t set t.resolution_time=null,t.resolutioner=null where t.accident_status!='跟踪处理完成'

View File

@ -1,132 +1,132 @@
package com.luckyframe.project.testmanagmt.projectCase.mapper;
import java.util.List;
import com.luckyframe.project.testmanagmt.projectCase.domain.ProjectCase;
/**
* 项目测试用例管理 数据层
*
* @author luckyframe
* @date 2019-02-26
*/
public interface ProjectCaseMapper
{
/**
* 查询项目测试用例管理信息
*
* @param caseId 项目测试用例管理ID
* @return 项目测试用例管理信息
*/
public ProjectCase selectProjectCaseById(Integer caseId);
/**
* 通过用例编号查询项目测试用例管理信息
*
* @param caseId 项目测试用例管理ID
* @return 项目测试用例管理信息
*/
public ProjectCase selectProjectCaseByCaseSign(String caseSign);
/**
* 查询项目测试用例管理列表
*
* @param projectCase 项目测试用例管理信息
* @return 项目测试用例管理集合
*/
public List<ProjectCase> selectProjectCaseList(ProjectCase projectCase);
/**
* 查询计划中的用例列表
* @param projectCase
* @return
* @author Seagull
* @date 2019年4月10日
*/
public List<ProjectCase> selectProjectCaseListForPlan(ProjectCase projectCase);
/**
* 新增项目测试用例管理
*
* @param projectCase 项目测试用例管理信息
* @return 结果
*/
public int insertProjectCase(ProjectCase projectCase);
/**
* 修改项目测试用例管理
*
* @param projectCase 项目测试用例管理信息
* @return 结果
*/
public int updateProjectCase(ProjectCase projectCase);
/**
* 删除项目测试用例管理
*
* @param caseId 项目测试用例管理ID
* @return 结果
*/
public int deleteProjectCaseById(Integer caseId);
/**
* 批量删除项目测试用例管理
*
* @param caseIds 需要删除的数据ID
* @return 结果
*/
public int deleteProjectCaseByIds(String[] caseIds);
/**
* 检查测试用例名称唯一性
* @param caseName
* @return
* @author Seagull
* @date 2019年2月28日
*/
public ProjectCase checkProjectCaseNameUnique(String caseName);
/**
* 查询测试用例项目序号
* @param projectId
* @return
* @author Seagull
* @date 2019年3月1日
*/
public int selectMaxCaseSerialNumberByProjectId(Integer projectId);
/**
* 查询项目下有没有测试用例
* @param projectId
* @return
* @author Seagull
* @date 2019年3月4日
*/
public int selectProjectCaseCountByProjectId(Integer projectId);
/**
* 查询用例模块下有没有测试用例
* @param projectId
* @return
* @author Seagull
* @date 2019年3月4日
*/
public int selectProjectCaseCountByModuleId(Integer moduleId);
/**
* 查询总用例数
* @return
* @author Seagull
* @date 2019年4月28日
*/
public int selectProjectCaseCount();
/**
* 查询指定天数内更新的用例
* @param projectCase
* @return
* @author Seagull
* @date 2019年4月28日
*/
public int selectProjectCaseCountForThirtyDays(String updateTime);
package com.luckyframe.project.testmanagmt.projectCase.mapper;
import java.util.List;
import com.luckyframe.project.testmanagmt.projectCase.domain.ProjectCase;
/**
* 项目测试用例管理 数据层
*
* @author luckyframe
* @date 2019-02-26
*/
public interface ProjectCaseMapper
{
/**
* 查询项目测试用例管理信息
*
* @param caseId 项目测试用例管理ID
* @return 项目测试用例管理信息
*/
public ProjectCase selectProjectCaseById(Integer caseId);
/**
* 通过用例编号查询项目测试用例管理信息
*
* @param caseId 项目测试用例管理ID
* @return 项目测试用例管理信息
*/
public ProjectCase selectProjectCaseByCaseSign(String caseSign);
/**
* 查询项目测试用例管理列表
*
* @param projectCase 项目测试用例管理信息
* @return 项目测试用例管理集合
*/
public List<ProjectCase> selectProjectCaseList(ProjectCase projectCase);
/**
* 查询计划中的用例列表
* @param projectCase
* @return
* @author Seagull
* @date 2019年4月10日
*/
public List<ProjectCase> selectProjectCaseListForPlan(ProjectCase projectCase);
/**
* 新增项目测试用例管理
*
* @param projectCase 项目测试用例管理信息
* @return 结果
*/
public int insertProjectCase(ProjectCase projectCase);
/**
* 修改项目测试用例管理
*
* @param projectCase 项目测试用例管理信息
* @return 结果
*/
public int updateProjectCase(ProjectCase projectCase);
/**
* 删除项目测试用例管理
*
* @param caseId 项目测试用例管理ID
* @return 结果
*/
public int deleteProjectCaseById(Integer caseId);
/**
* 批量删除项目测试用例管理
*
* @param caseIds 需要删除的数据ID
* @return 结果
*/
public int deleteProjectCaseByIds(String[] caseIds);
/**
* 检查测试用例名称唯一性
* @param projectCase
* @return
* @author Seagull
* @date 2019年10月8日
*/
public List<ProjectCase> checkProjectCaseNameUnique(ProjectCase projectCase);
/**
* 查询测试用例项目序号
* @param projectId
* @return
* @author Seagull
* @date 2019年3月1日
*/
public int selectMaxCaseSerialNumberByProjectId(Integer projectId);
/**
* 查询项目下有没有测试用例
* @param projectId
* @return
* @author Seagull
* @date 2019年3月4日
*/
public int selectProjectCaseCountByProjectId(Integer projectId);
/**
* 查询用例模块下有没有测试用例
* @param projectId
* @return
* @author Seagull
* @date 2019年3月4日
*/
public int selectProjectCaseCountByModuleId(Integer moduleId);
/**
* 查询总用例数
* @return
* @author Seagull
* @date 2019年4月28日
*/
public int selectProjectCaseCount();
/**
* 查询指定天数内更新的用例
* @param projectCase
* @return
* @author Seagull
* @date 2019年4月28日
*/
public int selectProjectCaseCountForThirtyDays(String updateTime);
}

View File

@ -212,8 +212,8 @@ public class ProjectCaseServiceImpl implements IProjectCaseService
public String checkProjectCaseNameUnique(ProjectCase projectCase)
{
Long caseId = StringUtils.isNull(projectCase.getCaseId()) ? -1L : projectCase.getCaseId();
ProjectCase info = projectCaseMapper.checkProjectCaseNameUnique(projectCase.getCaseName());
if (StringUtils.isNotNull(info) && info.getCaseId().longValue() != caseId.longValue())
List<ProjectCase> info = projectCaseMapper.checkProjectCaseNameUnique(projectCase);
if (info.size()>0 && (info.get(0).getCaseId().longValue() != caseId.longValue() || projectCase.getPriority()==99999999))
{
return ProjectCaseConstants.PROJECTCASE_NAME_NOT_UNIQUE;
}

View File

@ -112,9 +112,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select IFNULL(MAX(case_serial_number),0) from project_case where project_id=#{project_id}
</select>
<select id="checkProjectCaseNameUnique" parameterType="String" resultMap="ProjectCaseResult">
<select id="checkProjectCaseNameUnique" parameterType="ProjectCase" resultMap="ProjectCaseResult">
<include refid="selectProjectCaseVo"/>
where pc.case_name=#{case_name}
<where>
<if test="caseName != null and caseName != '' "> and pc.case_name = #{caseName}</if>
<if test="projectId != null and projectId != 0"> and pc.project_id = #{projectId}</if>
</where>
</select>
<insert id="insertProjectCase" parameterType="ProjectCase" useGeneratedKeys="true" keyProperty="caseId">

View File

@ -65,7 +65,7 @@
}
});
$("#form-projectCase-add").validate({
myEditValidate = $("#form-projectCase-add").validate({
rules:{
projectId:{
required:true,
@ -79,6 +79,9 @@
type: "post",
dataType: "json",
data: {
"projectId": function() {
return $("#projectId").val();
},
name: function () {
return $.common.trim($("#caseName").val());
}
@ -125,6 +128,8 @@
/*选择项目初始化模块树*/
function initializeModuleTree() {
$.validate.resetForm();
$.validate.form();
var projectId=$("#projectId").val();
$.ajax({
cache : true,

View File

@ -1,142 +1,150 @@
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-projectCase-edit" th:object="${projectCase}">
<input id="caseId" name="caseId" th:field="*{caseId}" type="hidden">
<input id="caseSerialNumber" name="caseSerialNumber" th:field="*{caseSerialNumber}" type="hidden">
<input id="caseSign" name="caseSign" th:field="*{caseSign}" type="hidden">
<input id="treeId" name="moduleId" type="hidden" th:value="${projectCaseModule.moduleId}"/>
<div class="form-group">
<label class="col-sm-3 control-label">项目名称:</label>
<div class="col-sm-8">
<select class="form-control" id="projectId" name="projectId" onchange="initializeModuleTree()">
<option th:each="project:${projects}" th:value="${project.projectId}"
th:text="${project.projectName}" th:selected="${project.flag}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例模块:</label>
<div class="col-sm-8">
<input class="form-control" type="text" onclick="selectModuleTree()" id="treeName" readonly="true" th:value="${projectCaseModule.moduleName}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例名称:</label>
<div class="col-sm-8">
<input id="caseName" name="caseName" th:field="*{caseName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例类型:</label>
<div class="col-sm-8">
<select class="form-control m-b" th:field="*{caseType}" id="caseType" name="caseType" th:with="type=${@dict.getType('testmanagmt_case_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">步骤失败:</label>
<div class="col-sm-8">
<label>当前用例后续步骤 &nbsp;&nbsp;</label>
<div class="radio-box" th:each="dict : ${@dict.getType('testmanagmt_case_stepfailcontinue')}">
<input type="radio" th:field="*{failcontinue}" th:id="${dict.dictCode}" name="failcontinue" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea id="remark" name="remark" th:field="*{remark}" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "testmanagmt/projectCase";
var modulePrefix = ctx + "testmanagmt/projectCaseModule"
$("#form-projectCase-edit").validate({
rules:{
caseName:{
required:true,
minlength: 1,
maxlength: 200,
remote: {
url: prefix + "/checkProjectCaseNameUnique",
type: "post",
dataType: "json",
data: {
"caseId": function() {
return $("#caseId").val();
},
name: function () {
return $.common.trim($("#caseName").val());
}
},
dataFilter: function (data, type) {
return $.validate.unique(data);
}
}
},
remark:{
maxlength:200
}
},
messages: {
"caseName": {
remote: "用例名称已经存在"
}
}
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/copy", $('#form-projectCase-edit').serialize());
}
}
/*模块管理-新增-选择父模块树*/
function selectModuleTree() {
var options = {
title: '模块选择',
width: "380",
url: modulePrefix + "/selectProjectCaseModuleTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
/*选择项目初始化模块树*/
function initializeModuleTree() {
var projectId=$("#projectId").val();
$.ajax({
cache : true,
type : "GET",
url : modulePrefix + "/getModuleByProjectId/" + projectId,
data : {},
async : false,
error : function(request) {
$.modal.alertError("系统错误");
},
success : function(data) {
$("#treeId").val(data.moduleId);
$("#treeName").val(data.moduleName);
}
});
}
</script>
</body>
</html>
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-projectCase-edit" th:object="${projectCase}">
<input id="caseId" name="caseId" th:field="*{caseId}" type="hidden">
<input id="caseSerialNumber" name="caseSerialNumber" th:field="*{caseSerialNumber}" type="hidden">
<input id="caseSign" name="caseSign" th:field="*{caseSign}" type="hidden">
<input id="treeId" name="moduleId" type="hidden" th:value="${projectCaseModule.moduleId}"/>
<div class="form-group">
<label class="col-sm-3 control-label">项目名称:</label>
<div class="col-sm-8">
<select class="form-control" id="projectId" name="projectId" onchange="initializeModuleTree()">
<option th:each="project:${projects}" th:value="${project.projectId}"
th:text="${project.projectName}" th:selected="${project.flag}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例模块:</label>
<div class="col-sm-8">
<input class="form-control" type="text" onclick="selectModuleTree()" id="treeName" readonly="true" th:value="${projectCaseModule.moduleName}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例名称:</label>
<div class="col-sm-8">
<input id="caseName" name="caseName" th:field="*{caseName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例类型:</label>
<div class="col-sm-8">
<select class="form-control m-b" th:field="*{caseType}" id="caseType" name="caseType" th:with="type=${@dict.getType('testmanagmt_case_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">步骤失败:</label>
<div class="col-sm-8">
<label>当前用例后续步骤 &nbsp;&nbsp;</label>
<div class="radio-box" th:each="dict : ${@dict.getType('testmanagmt_case_stepfailcontinue')}">
<input type="radio" th:field="*{failcontinue}" th:id="${dict.dictCode}" name="failcontinue" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea id="remark" name="remark" th:field="*{remark}" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "testmanagmt/projectCase";
var modulePrefix = ctx + "testmanagmt/projectCaseModule"
$("#form-projectCase-edit").validate({
rules:{
caseName:{
required:true,
minlength: 1,
maxlength: 200,
remote: {
url: prefix + "/checkProjectCaseNameUnique",
type: "post",
dataType: "json",
data: {
"caseId": function() {
return $("#caseId").val();
},
"projectId": function() {
return $("#projectId").val();
},
name: function () {
return $.common.trim($("#caseName").val());
},
priority: function () {
return 99999999;
}
},
dataFilter: function (data, type) {
return $.validate.unique(data);
}
}
},
remark:{
maxlength:200
}
},
messages: {
"caseName": {
remote: "用例名称已经存在"
}
}
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/copy", $('#form-projectCase-edit').serialize());
}
}
/*模块管理-新增-选择父模块树*/
function selectModuleTree() {
var options = {
title: '模块选择',
width: "380",
url: modulePrefix + "/selectProjectCaseModuleTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
/*选择项目初始化模块树*/
function initializeModuleTree() {
$.validate.resetForm();
$.validate.form();
var projectId=$("#projectId").val();
$.ajax({
cache : true,
type : "GET",
url : modulePrefix + "/getModuleByProjectId/" + projectId,
data : {},
async : false,
error : function(request) {
$.modal.alertError("系统错误");
},
success : function(data) {
$("#treeId").val(data.moduleId);
$("#treeName").val(data.moduleName);
}
});
}
</script>
</body>
</html>

View File

@ -1,121 +1,124 @@
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-projectCase-edit" th:object="${projectCase}">
<input id="caseId" name="caseId" th:field="*{caseId}" type="hidden">
<input id="caseSerialNumber" name="caseSerialNumber" th:field="*{caseSerialNumber}" type="hidden">
<input id="caseSign" name="caseSign" th:field="*{caseSign}" type="hidden">
<input id="projectId" name="projectId" th:field="*{projectId}" type="hidden">
<input id="treeId" name="moduleId" type="hidden" th:value="${projectCaseModule.moduleId}"/>
<div class="form-group">
<label class="col-sm-3 control-label">项目名称:</label>
<div class="col-sm-8">
<strong class="form-control" th:text="*{project.projectName}"></strong>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例模块:</label>
<div class="col-sm-8">
<input class="form-control" type="text" onclick="selectModuleTree()" id="treeName" readonly="true" th:value="${projectCaseModule.moduleName}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例名称:</label>
<div class="col-sm-8">
<input id="caseName" name="caseName" th:field="*{caseName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例类型:</label>
<div class="col-sm-8">
<select class="form-control m-b" th:field="*{caseType}" id="caseType" name="caseType" th:with="type=${@dict.getType('testmanagmt_case_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">步骤失败:</label>
<div class="col-sm-8">
<label>当前用例后续步骤 &nbsp;&nbsp;</label>
<div class="radio-box" th:each="dict : ${@dict.getType('testmanagmt_case_stepfailcontinue')}">
<input type="radio" th:field="*{failcontinue}" th:id="${dict.dictCode}" name="failcontinue" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea id="remark" name="remark" th:field="*{remark}" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "testmanagmt/projectCase";
var modulePrefix = ctx + "testmanagmt/projectCaseModule";
$("#form-projectCase-edit").validate({
rules:{
caseName:{
required:true,
minlength: 1,
maxlength: 200,
remote: {
url: prefix + "/checkProjectCaseNameUnique",
type: "post",
dataType: "json",
data: {
"caseId": function() {
return $("#caseId").val();
},
name: function () {
return $.common.trim($("#caseName").val());
}
},
dataFilter: function (data, type) {
return $.validate.unique(data);
}
}
},
remark:{
maxlength:200
}
},
messages: {
"caseName": {
remote: "用例名称已经存在"
}
}
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-projectCase-edit').serialize());
}
}
/*模块管理-新增-选择父模块树*/
function selectModuleTree() {
var options = {
title: '模块选择',
width: "380",
url: modulePrefix + "/selectProjectCaseModuleTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
</script>
</body>
</html>
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-projectCase-edit" th:object="${projectCase}">
<input id="caseId" name="caseId" th:field="*{caseId}" type="hidden">
<input id="caseSerialNumber" name="caseSerialNumber" th:field="*{caseSerialNumber}" type="hidden">
<input id="caseSign" name="caseSign" th:field="*{caseSign}" type="hidden">
<input id="projectId" name="projectId" th:field="*{projectId}" type="hidden">
<input id="treeId" name="moduleId" type="hidden" th:value="${projectCaseModule.moduleId}"/>
<div class="form-group">
<label class="col-sm-3 control-label">项目名称:</label>
<div class="col-sm-8">
<strong class="form-control" th:text="*{project.projectName}"></strong>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例模块:</label>
<div class="col-sm-8">
<input class="form-control" type="text" onclick="selectModuleTree()" id="treeName" readonly="true" th:value="${projectCaseModule.moduleName}"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例名称:</label>
<div class="col-sm-8">
<input id="caseName" name="caseName" th:field="*{caseName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用例类型:</label>
<div class="col-sm-8">
<select class="form-control m-b" th:field="*{caseType}" id="caseType" name="caseType" th:with="type=${@dict.getType('testmanagmt_case_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">步骤失败:</label>
<div class="col-sm-8">
<label>当前用例后续步骤 &nbsp;&nbsp;</label>
<div class="radio-box" th:each="dict : ${@dict.getType('testmanagmt_case_stepfailcontinue')}">
<input type="radio" th:field="*{failcontinue}" th:id="${dict.dictCode}" name="failcontinue" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea id="remark" name="remark" th:field="*{remark}" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
var prefix = ctx + "testmanagmt/projectCase";
var modulePrefix = ctx + "testmanagmt/projectCaseModule";
$("#form-projectCase-edit").validate({
rules:{
caseName:{
required:true,
minlength: 1,
maxlength: 200,
remote: {
url: prefix + "/checkProjectCaseNameUnique",
type: "post",
dataType: "json",
data: {
"caseId": function() {
return $("#caseId").val();
},
"projectId": function() {
return $("#projectId").val();
},
name: function () {
return $.common.trim($("#caseName").val());
}
},
dataFilter: function (data, type) {
return $.validate.unique(data);
}
}
},
remark:{
maxlength:200
}
},
messages: {
"caseName": {
remote: "用例名称已经存在"
}
}
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-projectCase-edit').serialize());
}
}
/*模块管理-新增-选择父模块树*/
function selectModuleTree() {
var options = {
title: '模块选择',
width: "380",
url: modulePrefix + "/selectProjectCaseModuleTree/" + $("#treeId").val(),
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
</script>
</body>
</html>