fix: 修复创建版本时时间范围选择的问题

--bug=1018712 --user=刘瑞斌 【项目设置】版本管理-创建版本的结束时间可以大于开始时间 https://www.tapd.cn/55049933/s/1274400
This commit is contained in:
CaptainB 2022-10-24 15:38:31 +08:00 committed by 刘瑞斌
parent a15ee248cb
commit 2a5bbf2cd1
4 changed files with 32 additions and 12 deletions

View File

@ -117,13 +117,16 @@
<el-date-picker style="width: 100%" v-model="form.publishTime" type="datetime"
value-format="timestamp"></el-date-picker>
</el-form-item>
<el-form-item :label="$t('project.version.start_time')" prop="startTime">
<el-date-picker style="width: 100%" v-model="form.startTime" type="datetime"
value-format="timestamp"></el-date-picker>
</el-form-item>
<el-form-item :label="$t('project.version.end_time')" prop="endTime">
<el-date-picker style="width: 100%" v-model="form.endTime" type="datetime"
value-format="timestamp"></el-date-picker>
<el-form-item :label="$t('project_version.version_time')" prop="startTime">
<el-date-picker
v-model="form.versionTime"
style="width: 100%"
type="datetimerange"
range-separator="-"
value-format="timestamp"
:start-placeholder="$t('project.version.start_time')"
:end-placeholder="$t('project.version.end_time')">
</el-date-picker>
</el-form-item>
</el-form>
<template v-slot:footer>
@ -165,9 +168,12 @@ import MsTableButton from "metersphere-frontend/src/components/MsTableButton";
import MsTableSearchBar from "metersphere-frontend/src/components/MsTableSearchBar";
import {
changeLatest,
changeProjectVersionEnable, changeStatus,
checkForDelete, deleteProjectVersion,
getProjectMembers, getProjectVersion,
changeProjectVersionEnable,
changeStatus,
checkForDelete,
deleteProjectVersion,
getProjectMembers,
getProjectVersion,
isProjectVersionEnable,
listProjectVersions,
saveProjectVersion
@ -272,6 +278,9 @@ export default {
.then(response => {
this.form = response.data;
this.form.setLatestAble = !response.data.latest;
if (this.form.startTime && this.form.endTime) {
this.form.versionTime = [this.form.startTime, this.form.endTime];
}
this.createVisible = true;
});
},
@ -300,7 +309,6 @@ export default {
});
},
save(create) {
this.createLoading = true;
this.$refs['form'].validate(valid => {
if (valid) {
this.form.projectId = this.projectId;
@ -312,6 +320,10 @@ export default {
});
}
}
if (this.form.versionTime) {
this.form.startTime = this.form.versionTime[0];
this.form.endTime = this.form.versionTime[1];
}
this.createLoading = saveProjectVersion(this.form)
.then(resp => {
this.$success(this.$t('commons.save_success'));

View File

@ -30,8 +30,10 @@ const message = {
},
pj_batch_delete: {
error_library: "Confirm batch delete error library"
},
project_version: {
version_time: 'Version cycle',
}
}
export default {

View File

@ -30,6 +30,9 @@ const message = {
},
pj_batch_delete: {
error_library: "确定批量删除误报库"
},
project_version: {
version_time: '版本周期',
}
}

View File

@ -30,6 +30,9 @@ const message = {
},
pj_batch_delete: {
error_library: "確定刪除誤報庫"
},
project_version: {
version_time: '版本週期',
}
}