|
|
@@ -14,9 +14,36 @@
|
|
|
<span>{{ commitId }}</span>
|
|
|
<i class="el-icon-document-copy"></i>
|
|
|
</el-link>
|
|
|
-<!-- <div class="description-card-text commit-title">标题:-->
|
|
|
-<!-- <span>{{ commitInfo.title }}</span>-->
|
|
|
-<!-- </div>-->
|
|
|
+ <div class="description-card-text">类型:
|
|
|
+ <span v-if="!typeEditMode">
|
|
|
+ <span v-if="commitInfo.relatedType === 'bug_id'" class="type-line bug">缺陷</span>
|
|
|
+ <span v-else-if="commitInfo.relatedType === 'none'" class="type-line none">无类型</span>
|
|
|
+ <span v-else class="type-line requirement">需求</span>
|
|
|
+ <span v-if="commitInfo.relatedType !== 'none'" class="type-line">关联节点ID: {{commitInfo.relatedId}}</span>
|
|
|
+ <el-button type="primary" size="mini" class="type-line" @click="typeEditMode = true">修改关联</el-button>
|
|
|
+ </span>
|
|
|
+ <span v-if="typeEditMode">
|
|
|
+ <el-radio v-model="relatedTypeEdit" label="TREE_ID" size="large">需求</el-radio>
|
|
|
+ <el-radio v-model="relatedTypeEdit" label="BUG_ID" size="large">缺陷</el-radio>
|
|
|
+<!-- <el-input-->
|
|
|
+<!-- v-model="relatedIdEdit"-->
|
|
|
+<!-- class="w-50 m-2 type-line"-->
|
|
|
+<!-- style="width: 100px"-->
|
|
|
+<!-- size="small"-->
|
|
|
+<!-- placeholder="关联ID"-->
|
|
|
+<!-- />-->
|
|
|
+ <el-select v-model="relatedIdEdit" class="m-2 type-line" size="small" placeholder="Select">
|
|
|
+ <el-option
|
|
|
+ v-for="item in (relatedTypeEdit === 'TREE_ID'?treeList:bugList)"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.id + ' ' +(item.title === ''?'默认节点':item.title)"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-button type="info" size="mini" class="type-line" @click="typeEditMode = false">取消</el-button>
|
|
|
+ <el-button type="primary" size="mini" class="type-line" @click="saveRelated">保存</el-button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
<div class="description-card-text">信息:
|
|
|
<span>{{ commitInfo.message }}</span>
|
|
|
</div>
|
|
|
@@ -34,7 +61,6 @@
|
|
|
@click="onParentTagClick(parent)"
|
|
|
>{{ parent }}</el-tag></span>
|
|
|
</el-row>
|
|
|
-
|
|
|
</div>
|
|
|
</el-card>
|
|
|
<el-divider content-position="left">
|
|
|
@@ -102,13 +128,13 @@
|
|
|
|
|
|
<!-- {{commitInfo}}-->
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
-import { ProjectAPI } from '@/api';
|
|
|
+import { BugListAPI, ProjectAPI, RequirementAPI } from '@/api';
|
|
|
import * as Diff2Html from 'diff2html';
|
|
|
import 'diff2html/bundles/css/diff2html.min.css';
|
|
|
import { copy } from '@/utils/clipboard';
|
|
|
import { ref } from 'vue';
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
import { formatter } from '../../utils/time';
|
|
|
|
|
|
export default {
|
|
|
@@ -124,6 +150,11 @@ export default {
|
|
|
fileNameKeyword: '',
|
|
|
displayDiff: [],
|
|
|
currentFileRow: ref(),
|
|
|
+ typeEditMode: false,
|
|
|
+ relatedTypeEdit: 'TREE_ID',
|
|
|
+ relatedIdEdit: 1,
|
|
|
+ bugList: [],
|
|
|
+ treeList: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -136,6 +167,7 @@ export default {
|
|
|
},
|
|
|
async mounted() {
|
|
|
await this.loadCommitInfo();
|
|
|
+ await this.loadRelatedLists();
|
|
|
},
|
|
|
methods: {
|
|
|
copy,
|
|
|
@@ -167,6 +199,10 @@ export default {
|
|
|
}
|
|
|
this.displayDiff = this.originAllDiffs;
|
|
|
},
|
|
|
+ async loadRelatedLists() {
|
|
|
+ this.bugList = await BugListAPI.getBugListByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
+ this.treeList = await RequirementAPI.getTasksByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
+ },
|
|
|
drawDiffHtml() {
|
|
|
// this.diffString = this.diff[this.currentParentIndex][0].diff;
|
|
|
this.diffString = this.currentFileRow.diff;
|
|
|
@@ -202,6 +238,13 @@ export default {
|
|
|
.filter((diffFile) => diffFile.newPath.indexOf(this.fileNameKeyword) >= 0));
|
|
|
}
|
|
|
},
|
|
|
+ async saveRelated() {
|
|
|
+ const response = ProjectAPI.linkCommit(this.projectId, this.commitId, this.relatedTypeEdit, this.relatedIdEdit);
|
|
|
+ console.log(response);
|
|
|
+ ElMessage('success');
|
|
|
+ await this.loadCommitInfo();
|
|
|
+ this.typeEditMode = false;
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
@@ -235,4 +278,18 @@ export default {
|
|
|
.el-tag {
|
|
|
margin: 3px 10px;
|
|
|
}
|
|
|
+
|
|
|
+.bug {
|
|
|
+ background-color: chocolate;
|
|
|
+}
|
|
|
+.none{
|
|
|
+ background-color: #ccc;
|
|
|
+}
|
|
|
+.requirement {
|
|
|
+ background-color: #42b983;
|
|
|
+}
|
|
|
+.type-line{
|
|
|
+ margin: 0;
|
|
|
+ margin-right: 20px;
|
|
|
+}
|
|
|
</style>
|