|
|
@@ -110,8 +110,8 @@ export default {
|
|
|
deleteSourceBranch: false,
|
|
|
},
|
|
|
formRules: {
|
|
|
- title: [{required: true, message: '请输入代码评审任务标题', trigger: 'blur',}],
|
|
|
- reviewerId: [{required: true, message: '请选择一位评审人', trigger: 'blur'}],
|
|
|
+ title: [{ required: true, message: '请输入代码评审任务标题', trigger: 'blur' }],
|
|
|
+ reviewerId: [{ required: true, message: '请选择一位评审人', trigger: 'blur' }],
|
|
|
},
|
|
|
submitLoading: false,
|
|
|
diffMsg: [],
|
|
|
@@ -126,7 +126,7 @@ export default {
|
|
|
},
|
|
|
currentUser() {
|
|
|
return this.$store.state.user;
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
show() {
|
|
|
@@ -138,16 +138,9 @@ export default {
|
|
|
getCreateTime(branchName) {
|
|
|
return this.branches[this.branchOptions.indexOf(branchName)].commit.createdAt.split('T')[0];
|
|
|
},
|
|
|
- getBranchBash(branchName) {
|
|
|
- return this.branches[this.branchOptions.indexOf(branchName)].commit.id;
|
|
|
- },
|
|
|
- getProjectNameFromUrl(url) {
|
|
|
- let addList = url.split('/');
|
|
|
- return addList[addList.length - 2] + '/' + addList[addList.length - 1];
|
|
|
- },
|
|
|
async compareBranch() {
|
|
|
- if(this.sourceBranch === '')this.$message.error('源分支不能为空!');
|
|
|
- else if (this.sourceBranch === this.targetBranch)this.$message.error('源分支与目标分支相同,请重新选择!')
|
|
|
+ if (this.sourceBranch === '') this.$message.error('源分支不能为空!');
|
|
|
+ else if (this.sourceBranch === this.targetBranch) this.$message.error('源分支与目标分支相同,请重新选择!');
|
|
|
else {
|
|
|
this.codeReviewCreateForm.sourceBranch = this.sourceBranch;
|
|
|
this.codeReviewCreateForm.targetBranch = this.targetBranch;
|
|
|
@@ -174,14 +167,14 @@ export default {
|
|
|
},
|
|
|
submitForm() {
|
|
|
this.$refs.createForm.validate((valid) => {
|
|
|
- if(valid) {
|
|
|
+ if (valid) {
|
|
|
this.submitLoading = true;
|
|
|
CodeReviewAPI.createCodeReview(this.codeReviewCreateForm).then(
|
|
|
(res) => {
|
|
|
this.showDrawer = false;
|
|
|
this.$parent.refreshCodeReviewList();
|
|
|
- this.handleDrawerClose(() => {});
|
|
|
- }
|
|
|
+ this.handleDrawerClose(() => ({}));
|
|
|
+ },
|
|
|
);
|
|
|
this.submitLoading = false;
|
|
|
}
|
|
|
@@ -200,16 +193,17 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
},
|
|
|
- async mounted(){
|
|
|
- //更新项目名称,项目Id,创建者Id
|
|
|
- this.projectOptions[0] = this.sourceProject = this.targetProject = this.currentProjectInfo.name;
|
|
|
- this.codeReviewCreateForm.projectId = this.currentProjectInfo.id;
|
|
|
- this.codeReviewCreateForm.creatorId = this.currentUser.id;
|
|
|
- //获取项目的分支信息
|
|
|
- this.branches = await CodeReviewAPI.getProjectBranches(this.currentProjectInfo.id);
|
|
|
- for(let item in this.branches) {
|
|
|
- this.branchOptions.push(this.branches[item].name);
|
|
|
- }
|
|
|
+ async mounted() {
|
|
|
+ this.projectOptions[0] = this.currentProjectInfo.name;
|
|
|
+ this.sourceProject = this.currentProjectInfo.name;
|
|
|
+ this.targetProject = this.currentProjectInfo.name;
|
|
|
+ this.codeReviewCreateForm.projectId = this.currentProjectInfo.id;
|
|
|
+ this.codeReviewCreateForm.creatorId = this.currentUser.id;
|
|
|
+ this.branches = await CodeReviewAPI.getProjectBranches(this.currentProjectInfo.id);
|
|
|
+ const that = this;
|
|
|
+ this.branches.forEach((item) => {
|
|
|
+ that.branchOptions.push(item.name);
|
|
|
+ });
|
|
|
},
|
|
|
};
|
|
|
</script>
|