fix(工作台): 修复没有项目权限的用户进入工作台会报错的问题
--bug=1024743 --user=宋天阳 【工作台】github#22990,工作台-我的待办、我的关注、我的创建 https://www.tapd.cn/55049933/s/1355563
This commit is contained in:
parent
7309d2d40f
commit
ba1e00e517
|
@ -17,15 +17,16 @@
|
||||||
:fields.sync="fields"
|
:fields.sync="fields"
|
||||||
:field-key="tableHeaderKey"
|
:field-key="tableHeaderKey"
|
||||||
@refresh="initTableData"
|
@refresh="initTableData"
|
||||||
ref="table">
|
ref="table"
|
||||||
|
>
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="deleteTime"
|
prop="deleteTime"
|
||||||
sortable
|
sortable
|
||||||
v-if="this.trashEnable"
|
v-if="this.trashEnable"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('commons.delete_time')"
|
:label="$t('commons.delete_time')"
|
||||||
min-width="150px">
|
min-width="150px"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.deleteTime | datetimeFormat }}</span>
|
<span>{{ scope.row.deleteTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,7 +37,8 @@
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
v-if="this.trashEnable"
|
v-if="this.trashEnable"
|
||||||
:label="$t('commons.delete_user')"
|
:label="$t('commons.delete_user')"
|
||||||
min-width="120"/>
|
min-width="120"
|
||||||
|
/>
|
||||||
|
|
||||||
<span v-for="item in fields" :key="item.key">
|
<span v-for="item in fields" :key="item.key">
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
|
@ -46,7 +48,8 @@
|
||||||
prop="num"
|
prop="num"
|
||||||
sortable
|
sortable
|
||||||
:label="$t('commons.id')"
|
:label="$t('commons.id')"
|
||||||
min-width="80"/>
|
min-width="80"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
v-if="item.id === 'num' && customNum"
|
v-if="item.id === 'num' && customNum"
|
||||||
|
@ -54,7 +57,8 @@
|
||||||
prop="customNum"
|
prop="customNum"
|
||||||
sortable
|
sortable
|
||||||
:label="$t('commons.id')"
|
:label="$t('commons.id')"
|
||||||
min-width="80"/>
|
min-width="80"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="name"
|
prop="name"
|
||||||
|
@ -70,7 +74,8 @@
|
||||||
v-if="isShowAllColumn"
|
v-if="isShowAllColumn"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('test_track.case.module')"
|
:label="$t('test_track.case.module')"
|
||||||
min-width="150px">
|
min-width="150px"
|
||||||
|
>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
|
@ -79,7 +84,8 @@
|
||||||
v-if="!isShowAllColumn"
|
v-if="!isShowAllColumn"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('report.project_name')"
|
:label="$t('report.project_name')"
|
||||||
min-width="150px">
|
min-width="150px"
|
||||||
|
>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
|
@ -87,16 +93,26 @@
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
min-width="100px"
|
min-width="100px"
|
||||||
prop="versionId">
|
prop="versionId"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.versionName }}</span>
|
<span>{{ scope.row.versionName }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column :label="$t('test_track.case.case_desc')" prop="desc" :field="item" min-width="120px"
|
<ms-table-column
|
||||||
v-if="isShowAllColumn">
|
:label="$t('test_track.case.case_desc')"
|
||||||
|
prop="desc"
|
||||||
|
:field="item"
|
||||||
|
min-width="120px"
|
||||||
|
v-if="isShowAllColumn"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-link @click.stop="getCase(scope.row.id)" style="color:#783887;">{{ $t('commons.preview') }}</el-link>
|
<el-link
|
||||||
|
@click.stop="getCase(scope.row.id)"
|
||||||
|
style="color: #783887"
|
||||||
|
>{{ $t("commons.preview") }}</el-link
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
|
@ -107,7 +123,8 @@
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('commons.create_user')"
|
:label="$t('commons.create_user')"
|
||||||
:filters="userFilter">
|
:filters="userFilter"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
{{ getCreateUserName(scope.row.createUser) }}
|
{{ getCreateUserName(scope.row.createUser) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -115,23 +132,34 @@
|
||||||
|
|
||||||
<test-case-review-status-table-item
|
<test-case-review-status-table-item
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"/>
|
:fields-width="fieldsWidth"
|
||||||
|
/>
|
||||||
|
|
||||||
<test-plan-case-status-table-item
|
<test-plan-case-status-table-item
|
||||||
prop="lastExecuteResult"
|
prop="lastExecuteResult"
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"/>
|
:fields-width="fieldsWidth"
|
||||||
|
/>
|
||||||
|
|
||||||
<ms-table-column
|
<ms-table-column
|
||||||
prop="tags"
|
prop="tags"
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('commons.tag')"
|
:label="$t('commons.tag')"
|
||||||
min-width="80">
|
min-width="80"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
|
<ms-tag
|
||||||
:show-tooltip="scope.row.tags.length===1&&itemName.length*12<=80"
|
v-for="(itemName, index) in scope.row.tags"
|
||||||
:content="itemName" style="margin-left: 0px; margin-right: 2px"/>
|
:key="index"
|
||||||
|
type="success"
|
||||||
|
effect="plain"
|
||||||
|
:show-tooltip="
|
||||||
|
scope.row.tags.length === 1 && itemName.length * 12 <= 80
|
||||||
|
"
|
||||||
|
:content="itemName"
|
||||||
|
style="margin-left: 0px; margin-right: 2px"
|
||||||
|
/>
|
||||||
<span />
|
<span />
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
@ -143,75 +171,98 @@
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('commons.update_time')"
|
:label="$t('commons.update_time')"
|
||||||
min-width="150px">
|
min-width="150px"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
<span>{{ scope.row.updateTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column prop="createTime"
|
<ms-table-column
|
||||||
|
prop="createTime"
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="$t('commons.create_time')"
|
:label="$t('commons.create_time')"
|
||||||
sortable
|
sortable
|
||||||
min-width="150px">
|
min-width="150px"
|
||||||
|
>
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
<span>{{ scope.row.createTime | datetimeFormat }}</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
<ms-table-column v-for="field in testCaseTemplate.customFields" :key="field.id"
|
<ms-table-column
|
||||||
|
v-for="field in testCaseTemplate.customFields"
|
||||||
|
:key="field.id"
|
||||||
:filters="getCustomFieldFilter(field)"
|
:filters="getCustomFieldFilter(field)"
|
||||||
:field="item"
|
:field="item"
|
||||||
:fields-width="fieldsWidth"
|
:fields-width="fieldsWidth"
|
||||||
:label="field.system ? $t(systemFiledMap[field.name]) : field.name"
|
:label="field.system ? $t(systemFiledMap[field.name]) : field.name"
|
||||||
:min-width="120"
|
:min-width="120"
|
||||||
:prop="field.name">
|
:prop="field.name"
|
||||||
|
>
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<span v-if="field.name === '用例等级'">
|
<span v-if="field.name === '用例等级'">
|
||||||
<priority-table-item
|
<priority-table-item
|
||||||
:value="getCustomFieldValue(scope.row, field) ? getCustomFieldValue(scope.row, field) : scope.row.priority"/>
|
:value="
|
||||||
|
getCustomFieldValue(scope.row, field)
|
||||||
|
? getCustomFieldValue(scope.row, field)
|
||||||
|
: scope.row.priority
|
||||||
|
"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ getCustomFieldValue(scope.row, field) }}
|
{{ getCustomFieldValue(scope.row, field) }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</ms-table-column>
|
</ms-table-column>
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</ms-table>
|
</ms-table>
|
||||||
|
|
||||||
<ms-table-pagination :change="initTableData" :current-page.sync="page.currentPage" :page-size.sync="page.pageSize"
|
<ms-table-pagination
|
||||||
:total="page.total"/>
|
:change="initTableData"
|
||||||
|
:current-page.sync="page.currentPage"
|
||||||
|
:page-size.sync="page.pageSize"
|
||||||
|
:total="page.total"
|
||||||
|
/>
|
||||||
|
|
||||||
<test-case-preview ref="testCasePreview" :loading="rowCaseResult.loading" />
|
<test-case-preview ref="testCasePreview" :loading="rowCaseResult.loading" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
import { TEST_CASE_LIST } from "metersphere-frontend/src/utils/constants";
|
import { TEST_CASE_LIST } from "metersphere-frontend/src/utils/constants";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getCustomFieldFilter,
|
getCustomFieldFilter,
|
||||||
getCustomFieldValue, getCustomTableHeader,
|
getCustomFieldValue,
|
||||||
|
getCustomTableHeader,
|
||||||
getCustomTableWidth,
|
getCustomTableWidth,
|
||||||
getLastTableSortField,
|
getLastTableSortField,
|
||||||
getPageInfo, getTableHeaderWithCustomFields,
|
getPageInfo,
|
||||||
initCondition, parseCustomFilesForList,
|
getTableHeaderWithCustomFields,
|
||||||
|
initCondition,
|
||||||
|
parseCustomFilesForList,
|
||||||
} from "metersphere-frontend/src/utils/tableUtils";
|
} from "metersphere-frontend/src/utils/tableUtils";
|
||||||
import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate";
|
import HeaderLabelOperate from "metersphere-frontend/src/components/head/HeaderLabelOperate";
|
||||||
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
|
import {
|
||||||
|
getCurrentProjectID,
|
||||||
|
getCurrentUserId,
|
||||||
|
getCurrentWorkspaceId,
|
||||||
|
} from "metersphere-frontend/src/utils/token";
|
||||||
|
|
||||||
import { getProjectMember, getProjectMemberUserFilter } from "@/api/user";
|
import { getProjectMember, getProjectMemberUserFilter } from "@/api/user";
|
||||||
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
||||||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||||
import { SYSTEM_FIELD_NAME_MAP } from "metersphere-frontend/src/utils/table-constants";
|
import { SYSTEM_FIELD_NAME_MAP } from "metersphere-frontend/src/utils/table-constants";
|
||||||
import {editTestCaseOrder, getTestCaseListById, getTestCasePages, getTestCaseStep, testCaseList} from "@/api/test-case";
|
import {
|
||||||
import MsTablePagination from 'metersphere-frontend/src/components/pagination/TablePagination';
|
editTestCaseOrder,
|
||||||
|
getTestCaseListById,
|
||||||
|
getTestCasePages,
|
||||||
|
getTestCaseStep,
|
||||||
|
testCaseList,
|
||||||
|
} from "@/api/test-case";
|
||||||
|
import MsTablePagination from "metersphere-frontend/src/components/pagination/TablePagination";
|
||||||
import { TEST_CASE_CONFIGS } from "metersphere-frontend/src/components/search/search-components";
|
import { TEST_CASE_CONFIGS } from "metersphere-frontend/src/components/search/search-components";
|
||||||
import PriorityTableItem from "@/business/module/track/PriorityTableItem";
|
import PriorityTableItem from "@/business/module/track/PriorityTableItem";
|
||||||
import StatusTableItem from "@/business/module/track/StatusTableItem";
|
import StatusTableItem from "@/business/module/track/StatusTableItem";
|
||||||
|
@ -230,7 +281,7 @@ import {uuid} from "@/model/ApiTestModel";
|
||||||
import {
|
import {
|
||||||
getCustomFieldValueForTrack,
|
getCustomFieldValueForTrack,
|
||||||
getCustomTableHeaderByXpack,
|
getCustomTableHeaderByXpack,
|
||||||
getTableHeaderWithCustomFieldsByXpack
|
getTableHeaderWithCustomFieldsByXpack,
|
||||||
} from "@/business/component/js/table-head-util";
|
} from "@/business/component/js/table-head-util";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -245,7 +296,7 @@ export default {
|
||||||
MsTag,
|
MsTag,
|
||||||
TestCaseReviewStatusTableItem,
|
TestCaseReviewStatusTableItem,
|
||||||
TestPlanCaseStatusTableItem,
|
TestPlanCaseStatusTableItem,
|
||||||
TestCasePreview
|
TestCasePreview,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -259,20 +310,23 @@ export default {
|
||||||
creator: {
|
creator: {
|
||||||
operator: "current user",
|
operator: "current user",
|
||||||
value: "current user",
|
value: "current user",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
versionFilters: [],
|
versionFilters: [],
|
||||||
statusFilters: [
|
statusFilters: [
|
||||||
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
|
{ text: this.$t("test_track.case.status_prepare"), value: "Prepare" },
|
||||||
{text: this.$t('test_track.case.status_running'), value: 'Underway'},
|
{ text: this.$t("test_track.case.status_running"), value: "Underway" },
|
||||||
{text: this.$t('test_track.case.status_finished'), value: 'Completed'},
|
{
|
||||||
|
text: this.$t("test_track.case.status_finished"),
|
||||||
|
value: "Completed",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
priorityFilters: [
|
priorityFilters: [
|
||||||
{text: 'P0', value: 'P0'},
|
{ text: "P0", value: "P0" },
|
||||||
{text: 'P1', value: 'P1'},
|
{ text: "P1", value: "P1" },
|
||||||
{text: 'P2', value: 'P2'},
|
{ text: "P2", value: "P2" },
|
||||||
{text: 'P3', value: 'P3'}
|
{ text: "P3", value: "P3" },
|
||||||
],
|
],
|
||||||
typeArr: [],
|
typeArr: [],
|
||||||
valueArr: {},
|
valueArr: {},
|
||||||
|
@ -280,18 +334,18 @@ export default {
|
||||||
testCaseTemplate: {},
|
testCaseTemplate: {},
|
||||||
members: [],
|
members: [],
|
||||||
page: getPageInfo(),
|
page: getPageInfo(),
|
||||||
fields: getCustomTableHeader('TRACK_TEST_CASE'),
|
fields: getCustomTableHeader("TRACK_TEST_CASE"),
|
||||||
fieldsWidth: getCustomTableWidth('TRACK_TEST_CASE'),
|
fieldsWidth: getCustomTableWidth("TRACK_TEST_CASE"),
|
||||||
memberMap: new Map(),
|
memberMap: new Map(),
|
||||||
rowCase: {},
|
rowCase: {},
|
||||||
rowCaseResult: {},
|
rowCaseResult: {},
|
||||||
store: {},
|
store: {},
|
||||||
userFilter:[]
|
userFilter: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
treeNodes: {
|
treeNodes: {
|
||||||
type: Array
|
type: Array,
|
||||||
},
|
},
|
||||||
trashEnable: {
|
trashEnable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -317,8 +371,8 @@ export default {
|
||||||
screenHeight: {
|
screenHeight: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
default() {
|
default() {
|
||||||
return 'calc(100vh - 218px)';
|
return "calc(100vh - 218px)";
|
||||||
}
|
},
|
||||||
}, //屏幕高度
|
}, //屏幕高度
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -347,22 +401,23 @@ export default {
|
||||||
});
|
});
|
||||||
if (this.isFocus) {
|
if (this.isFocus) {
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
delete this.condition.filters['user_id']
|
delete this.condition.filters["user_id"];
|
||||||
}
|
}
|
||||||
if (this.condition.userId) {
|
if (this.condition.userId) {
|
||||||
delete this.condition.userId
|
delete this.condition.userId;
|
||||||
}
|
}
|
||||||
this.condition.combine = {followPeople: {operator: "current user", value: "current user",}}
|
this.condition.combine = {
|
||||||
|
followPeople: { operator: "current user", value: "current user" },
|
||||||
|
};
|
||||||
} else if (this.isCreation) {
|
} else if (this.isCreation) {
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
delete this.condition.filters['user_id']
|
delete this.condition.filters["user_id"];
|
||||||
}
|
}
|
||||||
this.condition.userId = getCurrentUserId();
|
this.condition.userId = getCurrentUserId();
|
||||||
|
|
||||||
}
|
}
|
||||||
this.getTemplateField();
|
this.getTemplateField();
|
||||||
this.store = useApiStore();
|
this.store = useApiStore();
|
||||||
this.$emit('setCondition', this.condition);
|
this.$emit("setCondition", this.condition);
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
this.condition.filters.status = ["Trash"];
|
this.condition.filters.status = ["Trash"];
|
||||||
|
@ -373,9 +428,10 @@ export default {
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
|
this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
|
||||||
} else {
|
} else {
|
||||||
this.condition.filters = {review_status: ["Prepare", "Pass", "UnPass"]};
|
this.condition.filters = {
|
||||||
|
review_status: ["Prepare", "Pass", "UnPass"],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.condition.versionId = this.currentVersion;
|
this.condition.versionId = this.currentVersion;
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
|
@ -400,7 +456,6 @@ export default {
|
||||||
}
|
}
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
this.condition.ids = null;
|
this.condition.ids = null;
|
||||||
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selectNodeIds() {
|
selectNodeIds() {
|
||||||
|
@ -409,23 +464,22 @@ export default {
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
this.condition.filters.status = [];
|
this.condition.filters.status = [];
|
||||||
} else {
|
} else {
|
||||||
this.condition.filters = {status: []}
|
this.condition.filters = { status: [] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initCondition(this.condition, false);
|
initCondition(this.condition, false);
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
condition() {
|
condition() {
|
||||||
this.$emit('setCondition', this.condition);
|
this.$emit("setCondition", this.condition);
|
||||||
},
|
},
|
||||||
trashEnable() {
|
trashEnable() {
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
|
|
||||||
//更改查询条件
|
//更改查询条件
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
this.condition.filters.status = ["Trash"];
|
this.condition.filters.status = ["Trash"];
|
||||||
} else {
|
} else {
|
||||||
this.condition.filters = {status: ["Trash"]}
|
this.condition.filters = { status: ["Trash"] };
|
||||||
}
|
}
|
||||||
this.condition.moduleIds = [];
|
this.condition.moduleIds = [];
|
||||||
initCondition(this.condition, false);
|
initCondition(this.condition, false);
|
||||||
|
@ -434,7 +488,7 @@ export default {
|
||||||
if (this.condition.filters) {
|
if (this.condition.filters) {
|
||||||
this.condition.filters.status = [];
|
this.condition.filters.status = [];
|
||||||
} else {
|
} else {
|
||||||
this.condition.filters = {status: []}
|
this.condition.filters = { status: [] };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -446,14 +500,14 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCreateUserName(userId) {
|
getCreateUserName(userId) {
|
||||||
let user = this.userFilter.filter(item => item.value === userId);
|
let user = this.userFilter.filter((item) => item.value === userId);
|
||||||
return user.length > 0 ? user[0].text : "";
|
return user.length > 0 ? user[0].text : "";
|
||||||
},
|
},
|
||||||
getTemplateField() {
|
getTemplateField() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
let p1 = getProjectMember((data) => {
|
let p1 = getProjectMember((data) => {
|
||||||
this.members = data;
|
this.members = data;
|
||||||
this.members.forEach(item => {
|
this.members.forEach((item) => {
|
||||||
this.memberMap.set(item.id, item.name);
|
this.memberMap.set(item.id, item.name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -461,30 +515,44 @@ export default {
|
||||||
Promise.all([p1, p2]).then((data) => {
|
Promise.all([p1, p2]).then((data) => {
|
||||||
let template = data[1];
|
let template = data[1];
|
||||||
this.testCaseTemplate = template;
|
this.testCaseTemplate = template;
|
||||||
this.fields = getTableHeaderWithCustomFields(this.tableHeaderKey, this.testCaseTemplate.customFields, this.members);
|
this.fields = getTableHeaderWithCustomFields(
|
||||||
|
this.tableHeaderKey,
|
||||||
|
this.testCaseTemplate.customFields,
|
||||||
|
this.members
|
||||||
|
);
|
||||||
// todo 处理高级搜索自定义字段部分
|
// todo 处理高级搜索自定义字段部分
|
||||||
this.condition.components = this.condition.components.filter(item => item.custom !== true);
|
this.condition.components = this.condition.components.filter(
|
||||||
let comp = getAdvSearchCustomField(this.condition, this.testCaseTemplate.customFields);
|
(item) => item.custom !== true
|
||||||
|
);
|
||||||
|
let comp = getAdvSearchCustomField(
|
||||||
|
this.condition,
|
||||||
|
this.testCaseTemplate.customFields
|
||||||
|
);
|
||||||
// 系统字段国际化处理
|
// 系统字段国际化处理
|
||||||
comp.filter(element => {
|
comp.filter((element) => {
|
||||||
if (element.label === '责任人') {
|
if (element.label === "责任人") {
|
||||||
element.label = this.$t('custom_field.case_maintainer')
|
element.label = this.$t("custom_field.case_maintainer");
|
||||||
}
|
}
|
||||||
if (element.label === '用例等级') {
|
if (element.label === "用例等级") {
|
||||||
element.label = this.$t('custom_field.case_priority')
|
element.label = this.$t("custom_field.case_priority");
|
||||||
}
|
}
|
||||||
if (element.label === '用例状态') {
|
if (element.label === "用例状态") {
|
||||||
element.label = this.$t('custom_field.case_status')
|
element.label = this.$t("custom_field.case_status");
|
||||||
// 回收站TAB页处理高级搜索用例状态字段
|
// 回收站TAB页处理高级搜索用例状态字段
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
element.options = [{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'}];
|
element.options = [
|
||||||
|
{
|
||||||
|
text: this.$t("test_track.plan.plan_status_trash"),
|
||||||
|
value: "Trash",
|
||||||
|
},
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
element.options.forEach(option => {
|
element.options.forEach((option) => {
|
||||||
option.text = this.$t(option.text);
|
option.text = this.$t(option.text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.condition.components.push(...comp);
|
this.condition.components.push(...comp);
|
||||||
this.setTestCaseDefaultValue(template);
|
this.setTestCaseDefaultValue(template);
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -497,7 +565,7 @@ export default {
|
||||||
},
|
},
|
||||||
setTestCaseDefaultValue(template) {
|
setTestCaseDefaultValue(template) {
|
||||||
let testCaseDefaultValue = {};
|
let testCaseDefaultValue = {};
|
||||||
template.customFields.forEach(item => {
|
template.customFields.forEach((item) => {
|
||||||
if (item.system) {
|
if (item.system) {
|
||||||
if (item.defaultValue) {
|
if (item.defaultValue) {
|
||||||
testCaseDefaultValue[item.name] = JSON.parse(item.defaultValue);
|
testCaseDefaultValue[item.name] = JSON.parse(item.defaultValue);
|
||||||
|
@ -505,12 +573,12 @@ export default {
|
||||||
testCaseDefaultValue[item.name] = "";
|
testCaseDefaultValue[item.name] = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item.name === '用例等级') {
|
if (item.name === "用例等级") {
|
||||||
item.columnKey = 'priority';
|
item.columnKey = "priority";
|
||||||
} else if (item.name === '责任人') {
|
} else if (item.name === "责任人") {
|
||||||
item.columnKey = 'maintainer';
|
item.columnKey = "maintainer";
|
||||||
} else if (item.name === '用例状态') {
|
} else if (item.name === "用例状态") {
|
||||||
item.columnKey = 'status';
|
item.columnKey = "status";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
useStore().testCaseDefaultValue = testCaseDefaultValue;
|
useStore().testCaseDefaultValue = testCaseDefaultValue;
|
||||||
|
@ -519,28 +587,28 @@ export default {
|
||||||
getCustomFieldValue(row, field) {
|
getCustomFieldValue(row, field) {
|
||||||
let value = getCustomFieldValueForTrack(row, field, this.members);
|
let value = getCustomFieldValueForTrack(row, field, this.members);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
if (field.name === '用例等级') {
|
if (field.name === "用例等级") {
|
||||||
return row.priority;
|
return row.priority;
|
||||||
}
|
}
|
||||||
if (field.name === '责任人') {
|
if (field.name === "责任人") {
|
||||||
return row.maintainerName;
|
return row.maintainerName;
|
||||||
}
|
}
|
||||||
if (field.name === '用例状态') {
|
if (field.name === "用例状态") {
|
||||||
return row.status;
|
return row.status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
getCustomFieldFilter(field) {
|
getCustomFieldFilter(field) {
|
||||||
if (field.name === '用例状态') {
|
if (field.name === "用例状态") {
|
||||||
let option = null;
|
let option = null;
|
||||||
if (!this.trashEnable) {
|
if (!this.trashEnable) {
|
||||||
option = [];
|
option = [];
|
||||||
field.options.forEach((item) => {
|
field.options.forEach((item) => {
|
||||||
option.push({
|
option.push({
|
||||||
text: this.$t(item.text),
|
text: this.$t(item.text),
|
||||||
value: item.value
|
value: item.value,
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return option;
|
return option;
|
||||||
|
@ -549,15 +617,15 @@ export default {
|
||||||
},
|
},
|
||||||
checkRedirectEditPage(redirectParam) {
|
checkRedirectEditPage(redirectParam) {
|
||||||
if (redirectParam != null) {
|
if (redirectParam != null) {
|
||||||
getTestCaseListById(id).then(response => {
|
getTestCaseListById(id).then((response) => {
|
||||||
let testCase = response.data;
|
let testCase = response.data;
|
||||||
testCase.label = "redirect";
|
testCase.label = "redirect";
|
||||||
this.$emit('testCaseEdit', testCase);
|
this.$emit("testCaseEdit", testCase);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getProjectName() {
|
getProjectName() {
|
||||||
getProject(this.projectId).then(response => {
|
getProject(this.projectId).then((response) => {
|
||||||
let project = response.data;
|
let project = response.data;
|
||||||
if (project) {
|
if (project) {
|
||||||
this.projectName = project.name;
|
this.projectName = project.name;
|
||||||
|
@ -567,7 +635,7 @@ export default {
|
||||||
getSelectDataRange() {
|
getSelectDataRange() {
|
||||||
let dataRange = this.$route.params.dataSelectRange;
|
let dataRange = this.$route.params.dataSelectRange;
|
||||||
let dataType = this.$route.params.dataType;
|
let dataType = this.$route.params.dataType;
|
||||||
this.selectDataRange = dataType === 'case' ? dataRange : 'all';
|
this.selectDataRange = dataType === "case" ? dataRange : "all";
|
||||||
},
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
this.condition.planId = "";
|
this.condition.planId = "";
|
||||||
|
@ -596,26 +664,26 @@ export default {
|
||||||
this.condition.caseCoverage = null;
|
this.condition.caseCoverage = null;
|
||||||
this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
|
this.condition.filters.review_status = ["Prepare", "Pass", "UnPass"];
|
||||||
switch (this.selectDataRange) {
|
switch (this.selectDataRange) {
|
||||||
case 'thisWeekCount':
|
case "thisWeekCount":
|
||||||
this.condition.selectThisWeedData = true;
|
this.condition.selectThisWeedData = true;
|
||||||
break;
|
break;
|
||||||
case 'thisWeekRelevanceCount':
|
case "thisWeekRelevanceCount":
|
||||||
this.condition.selectThisWeedRelevanceData = true;
|
this.condition.selectThisWeedRelevanceData = true;
|
||||||
break;
|
break;
|
||||||
case 'uncoverage':
|
case "uncoverage":
|
||||||
this.condition.caseCoverage = 'uncoverage';
|
this.condition.caseCoverage = "uncoverage";
|
||||||
break;
|
break;
|
||||||
case 'coverage':
|
case "coverage":
|
||||||
this.condition.caseCoverage = 'coverage';
|
this.condition.caseCoverage = "coverage";
|
||||||
break;
|
break;
|
||||||
case 'notReviewed':
|
case "notReviewed":
|
||||||
this.condition.filters.review_status = ['Prepare'];
|
this.condition.filters.review_status = ["Prepare"];
|
||||||
break;
|
break;
|
||||||
case 'reviewSuccess':
|
case "reviewSuccess":
|
||||||
this.condition.filters.review_status = ['Pass'];
|
this.condition.filters.review_status = ["Pass"];
|
||||||
break;
|
break;
|
||||||
case 'reviewFail':
|
case "reviewFail":
|
||||||
this.condition.filters.review_status = ['UnPass'];
|
this.condition.filters.review_status = ["UnPass"];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.trashEnable) {
|
if (this.trashEnable) {
|
||||||
|
@ -626,25 +694,30 @@ export default {
|
||||||
this.condition.filters.version_id = versionIds;
|
this.condition.filters.version_id = versionIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.projectId) {
|
if (this.projectId && this.projectId !== "no_such_project") {
|
||||||
this.condition.projectId = this.projectId;
|
this.condition.projectId = this.projectId;
|
||||||
this.$emit('setCondition', this.condition);
|
this.$emit("setCondition", this.condition);
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
testCaseList({pageNum: this.page.currentPage, pageSize: this.page.pageSize}, this.condition)
|
testCaseList(
|
||||||
.then(response => {
|
{ pageNum: this.page.currentPage, pageSize: this.page.pageSize },
|
||||||
|
this.condition
|
||||||
|
).then((response) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.page.total = data.itemCount;
|
this.page.total = data.itemCount;
|
||||||
this.page.data = data.listObject;
|
this.page.data = data.listObject;
|
||||||
parseCustomFilesForList(this.page.data);
|
parseCustomFilesForList(this.page.data);
|
||||||
parseTag(this.page.data);
|
parseTag(this.page.data);
|
||||||
this.page.data.forEach(item => {
|
this.page.data.forEach((item) => {
|
||||||
let nodePath = item.nodePath;
|
let nodePath = item.nodePath;
|
||||||
if (item.customFields) {
|
if (item.customFields) {
|
||||||
item.customFields = JSON.parse(item.customFields);
|
item.customFields = JSON.parse(item.customFields);
|
||||||
}
|
}
|
||||||
if (nodePath.startsWith("/未规划用例", "0")) {
|
if (nodePath.startsWith("/未规划用例", "0")) {
|
||||||
item.nodePath = nodePath.replaceAll("/未规划用例", "/" + this.$t('api_test.unplanned_case'));
|
item.nodePath = nodePath.replaceAll(
|
||||||
|
"/未规划用例",
|
||||||
|
"/" + this.$t("api_test.unplanned_case")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -655,37 +728,38 @@ export default {
|
||||||
},
|
},
|
||||||
handleEdit(testCase, column) {
|
handleEdit(testCase, column) {
|
||||||
let query = {
|
let query = {
|
||||||
projectId: testCase.projectId
|
projectId: testCase.projectId,
|
||||||
};
|
};
|
||||||
let path = '/track/case/edit/' + testCase.id;
|
let path = "/track/case/edit/" + testCase.id;
|
||||||
let TestCaseData = this.$router.resolve({
|
let TestCaseData = this.$router.resolve({
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
});
|
});
|
||||||
window.open(TestCaseData.href, '_blank');
|
window.open(TestCaseData.href, "_blank");
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.$refs.table.clear();
|
this.$refs.table.clear();
|
||||||
this.$emit('refresh');
|
this.$emit("refresh");
|
||||||
},
|
},
|
||||||
refreshAll() {
|
refreshAll() {
|
||||||
this.$refs.table.clear();
|
this.$refs.table.clear();
|
||||||
this.$emit('refreshAll');
|
this.$emit("refreshAll");
|
||||||
},
|
},
|
||||||
getCase(id) {
|
getCase(id) {
|
||||||
this.$refs.testCasePreview.open();
|
this.$refs.testCasePreview.open();
|
||||||
this.rowCaseResult.loading = true;
|
this.rowCaseResult.loading = true;
|
||||||
|
|
||||||
getTestCaseStep(id)
|
getTestCaseStep(id).then((response) => {
|
||||||
.then(response => {
|
|
||||||
this.rowCase = response.data;
|
this.rowCase = response.data;
|
||||||
this.rowCase.steps = JSON.parse(this.rowCase.steps);
|
this.rowCase.steps = JSON.parse(this.rowCase.steps);
|
||||||
if (!this.rowCase.steps || this.rowCase.length < 1) {
|
if (!this.rowCase.steps || this.rowCase.length < 1) {
|
||||||
this.rowCase.steps = [{
|
this.rowCase.steps = [
|
||||||
|
{
|
||||||
num: 1,
|
num: 1,
|
||||||
desc: '',
|
desc: "",
|
||||||
result: ''
|
result: "",
|
||||||
}];
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
if (!this.rowCase.stepModel) {
|
if (!this.rowCase.stepModel) {
|
||||||
this.rowCase.stepModel = "STEP";
|
this.rowCase.stepModel = "STEP";
|
||||||
|
@ -695,22 +769,20 @@ export default {
|
||||||
},
|
},
|
||||||
getVersionOptions() {
|
getVersionOptions() {
|
||||||
if (hasLicense()) {
|
if (hasLicense()) {
|
||||||
getProjectVersions(getCurrentProjectID()).then(response => {
|
getProjectVersions(getCurrentProjectID()).then((response) => {
|
||||||
this.versionFilters = response.data.map(u => {
|
this.versionFilters = response.data.map((u) => {
|
||||||
return { text: u.name, value: u.id };
|
return { text: u.name, value: u.id };
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.operate-button > div {
|
.operate-button > div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue