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

View File

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

View File

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

View File

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