style(接口测试): 操作栏宽度调整

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2024-11-04 15:33:46 +08:00 committed by Craftsman
parent a0f6f1fe10
commit 963c83e18f
3 changed files with 97 additions and 95 deletions

View File

@ -14,7 +14,7 @@
:fields.sync="fields" :fields.sync="fields"
:field-key="tableHeaderKey" :field-key="tableHeaderKey"
:remember-order="true" :remember-order="true"
operator-width="200" operator-width="210"
:enable-order-drag="enableOrderDrag" :enable-order-drag="enableOrderDrag"
row-key="id" row-key="id"
:row-order-group-id="condition.projectId" :row-order-group-id="condition.projectId"
@ -84,11 +84,11 @@
sortable /> sortable />
<ms-table-column <ms-table-column
prop="nodePath" prop="nodePath"
:field="item" :field="item"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
:label="$t('api_test.automation.module')" :label="$t('api_test.automation.module')"
min-width="150px"> min-width="150px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.modulePath }}</span> <span>{{ scope.row.modulePath }}</span>
</template> </template>

View File

@ -33,7 +33,7 @@
:row-order-func="editApiTestCaseOrder" :row-order-func="editApiTestCaseOrder"
:enable-order-drag="enableOrderDrag" :enable-order-drag="enableOrderDrag"
row-key="id" row-key="id"
operator-width="190px" operator-width="220"
@refresh="initTable" @refresh="initTable"
ref="caseTable" ref="caseTable"
class="api-case-simple-list"> class="api-case-simple-list">
@ -319,11 +319,11 @@ import {
testCaseReduction, testCaseReduction,
updateExecuteInfo, updateExecuteInfo,
} from '@/api/api-test-case'; } from '@/api/api-test-case';
import {getDefinitionById} from '@/api/definition'; import { getDefinitionById } from '@/api/definition';
import {getApiReportDetail} from '@/api/definition-report'; import { getApiReportDetail } from '@/api/definition-report';
import {genPerformanceTestXml} from '@/api/home'; import { genPerformanceTestXml } from '@/api/home';
import {getMaintainer} from '@/api/project'; import { getMaintainer } from '@/api/project';
import {getProjectVersions, synCaseBatch, versionEnableByProjectId} from '@/api/xpack'; import { getProjectVersions, synCaseBatch, versionEnableByProjectId } from '@/api/xpack';
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 MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator'; import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator';
@ -336,7 +336,7 @@ import MsContainer from 'metersphere-frontend/src/components/MsContainer';
import MsBottomContainer from '../BottomContainer'; import MsBottomContainer from '../BottomContainer';
import ShowMoreBtn from '@/business/commons/ShowMoreBtn'; import ShowMoreBtn from '@/business/commons/ShowMoreBtn';
import MsBatchEdit from '../basis/BatchEdit'; import MsBatchEdit from '../basis/BatchEdit';
import {getUUID} from 'metersphere-frontend/src/utils'; import { getUUID } from 'metersphere-frontend/src/utils';
import { import {
API_METHOD_COLOUR, API_METHOD_COLOUR,
CASE_PRIORITY, CASE_PRIORITY,
@ -345,19 +345,19 @@ import {
SQL_METHOD, SQL_METHOD,
TCP_METHOD, TCP_METHOD,
} from '../../model/JsonData'; } from '../../model/JsonData';
import {getCurrentProjectID} from 'metersphere-frontend/src/utils/token'; import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token';
import {hasLicense} from 'metersphere-frontend/src/utils/permission'; import { hasLicense } from 'metersphere-frontend/src/utils/permission';
import {getBodyUploadFiles} from '@/business/definition/api-definition'; import { getBodyUploadFiles } from '@/business/definition/api-definition';
import PriorityTableItem from '@/business/commons/PriorityTableItem'; import PriorityTableItem from '@/business/commons/PriorityTableItem';
import MsApiCaseTableExtendBtns from '../reference/ApiCaseTableExtendBtns'; import MsApiCaseTableExtendBtns from '../reference/ApiCaseTableExtendBtns';
import MsShowReference from '../reference/ShowReference'; import MsShowReference from '../reference/ShowReference';
import MsSetEnvironment from '@/business/definition/components/basis/SetEnvironment'; import MsSetEnvironment from '@/business/definition/components/basis/SetEnvironment';
import TestPlan from '@/business/definition/components/jmeter/components/test-plan'; import TestPlan from '@/business/definition/components/jmeter/components/test-plan';
import ThreadGroup from '@/business/definition/components/jmeter/components/thread-group'; import ThreadGroup from '@/business/definition/components/jmeter/components/thread-group';
import {parseEnvironment} from '@/business/environment/model/EnvironmentModel'; import { parseEnvironment } from '@/business/environment/model/EnvironmentModel';
import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover'; import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover';
import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar'; import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar';
import {API_CASE_CONFIGS, API_CASE_CONFIGS_TRASH} from 'metersphere-frontend/src/components/search/search-components'; import { API_CASE_CONFIGS, API_CASE_CONFIGS_TRASH } from 'metersphere-frontend/src/components/search/search-components';
import { import {
_filter, _filter,
_sort, _sort,
@ -366,17 +366,17 @@ import {
getLastTableSortField, getLastTableSortField,
handleRowDrop, handleRowDrop,
} from 'metersphere-frontend/src/utils/tableUtils'; } from 'metersphere-frontend/src/utils/tableUtils';
import {API_CASE_LIST} from 'metersphere-frontend/src/utils/constants'; import { API_CASE_LIST } from 'metersphere-frontend/src/utils/constants';
import HeaderLabelOperate from 'metersphere-frontend/src/components/head/HeaderLabelOperate'; import HeaderLabelOperate from 'metersphere-frontend/src/components/head/HeaderLabelOperate';
import ApiCaseBatchRun from '@/business/definition/components/list/ApiCaseBatchRun'; import ApiCaseBatchRun from '@/business/definition/components/list/ApiCaseBatchRun';
import MsRequestResultTail from '@/business/definition/components/response/RequestResultTail'; import MsRequestResultTail from '@/business/definition/components/response/RequestResultTail';
import {TYPE_TO_C} from '@/business/automation/scenario/Setting'; import { TYPE_TO_C } from '@/business/automation/scenario/Setting';
import i18n from 'metersphere-frontend/src/i18n'; import i18n from 'metersphere-frontend/src/i18n';
import MsSearch from 'metersphere-frontend/src/components/search/MsSearch'; import MsSearch from 'metersphere-frontend/src/components/search/MsSearch';
import SyncSetting from '@/business/definition/util/SyncSetting'; import SyncSetting from '@/business/definition/util/SyncSetting';
import {getEnvironmentByProjectId} from 'metersphere-frontend/src/api/environment'; import { getEnvironmentByProjectId } from 'metersphere-frontend/src/api/environment';
import {useApiStore, usePerformanceStore} from '@/store'; import { useApiStore, usePerformanceStore } from '@/store';
import {REPORT_STATUS} from '@/business/commons/js/commons'; import { REPORT_STATUS } from '@/business/commons/js/commons';
import MsApiRunMode from '@/business/automation/scenario/common/ApiRunMode'; import MsApiRunMode from '@/business/automation/scenario/common/ApiRunMode';
import ApiDeleteConfirm from '@/business/definition/components/list/ApiDeleteConfirm'; import ApiDeleteConfirm from '@/business/definition/components/list/ApiDeleteConfirm';
@ -664,7 +664,12 @@ export default {
}, },
storeCurrentApiCaseRefresh() { storeCurrentApiCaseRefresh() {
if (store.currentApiCase && store.currentApiCase.refresh) { if (store.currentApiCase && store.currentApiCase.refresh) {
this.setStatus(store.currentApiCase.id, store.currentApiCase.status, store.currentApiCase.passRate, store.currentApiCase.reportId); this.setStatus(
store.currentApiCase.id,
store.currentApiCase.status,
store.currentApiCase.passRate,
store.currentApiCase.reportId
);
} }
store.currentApiCase = {}; store.currentApiCase = {};
}, },

View File

@ -19,7 +19,7 @@
:batch-operators="trashEnable ? trashButtons : buttons" :batch-operators="trashEnable ? trashButtons : buttons"
:screen-height="screenHeight" :screen-height="screenHeight"
:operators="tableOperatorButtons" :operators="tableOperatorButtons"
operator-width="200px" operator-width="220"
:remember-order="true" :remember-order="true"
@refresh="initTable" @refresh="initTable"
:fields.sync="fields" :fields.sync="fields"
@ -47,7 +47,7 @@
: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 prop="num" label="ID" :field="item" min-width="100px" :fields-width="fieldsWidth" sortable> <ms-table-column prop="num" label="ID" :field="item" min-width="100px" :fields-width="fieldsWidth" sortable>
<template slot-scope="scope" v-if="!trashEnable"> <template slot-scope="scope" v-if="!trashEnable">
@ -65,7 +65,7 @@
sortable="custom" sortable="custom"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
min-width="120" min-width="120"
:field="item"/> :field="item" />
<ms-table-column <ms-table-column
prop="status" prop="status"
@ -77,7 +77,7 @@
:label="$t('api_test.definition.api_status')"> :label="$t('api_test.definition.api_status')">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<api-status :value="scope.row.status"/> <api-status :value="scope.row.status" />
</span> </span>
</template> </template>
</ms-table-column> </ms-table-column>
@ -110,13 +110,13 @@
:field="item" :field="item"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
min-width="100px" min-width="100px"
:label="$t('api_test.definition.request.responsible')"/> :label="$t('api_test.definition.request.responsible')" />
<ms-table-column <ms-table-column
prop="path" prop="path"
:field="item" :field="item"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
min-width="100px" min-width="100px"
:label="$t('api_test.definition.api_path')"/> :label="$t('api_test.definition.api_path')" />
<ms-table-column <ms-table-column
prop="tags" prop="tags"
@ -136,10 +136,10 @@
effect="plain" effect="plain"
:show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100" :show-tooltip="scope.row.tags.length === 1 && itemName.length * 12 <= 100"
:content="itemName" :content="itemName"
style="margin-left: 0px; margin-right: 2px"/> style="margin-left: 0px; margin-right: 2px" />
</div> </div>
</el-tooltip> </el-tooltip>
<span/> <span />
</template> </template>
</ms-table-column> </ms-table-column>
@ -183,7 +183,7 @@
:field="item" :field="item"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
min-width="100px" min-width="100px"
:label="$t('api_test.definition.api_case_number')"/> :label="$t('api_test.definition.api_case_number')" />
<ms-table-column <ms-table-column
:field="item" :field="item"
@ -192,7 +192,7 @@
min-width="100px" min-width="100px"
:label="$t('api_test.definition.api_case_result')"> :label="$t('api_test.definition.api_case_result')">
<template v-slot:default="{ row }"> <template v-slot:default="{ row }">
<ms-api-report-status :status="row.caseStatus" style="text-align: left;"/> <ms-api-report-status :status="row.caseStatus" style="text-align: left" />
</template> </template>
</ms-table-column> </ms-table-column>
@ -201,46 +201,44 @@
:field="item" :field="item"
min-width="120px" min-width="120px"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
:label="$t('api_test.definition.api_case_passing_rate')"/> :label="$t('api_test.definition.api_case_passing_rate')" />
<ms-table-column <ms-table-column
prop="description" prop="description"
:field="item" :field="item"
min-width="120px" min-width="120px"
:fields-width="fieldsWidth" :fields-width="fieldsWidth"
:label="$t('commons.description')"/> :label="$t('commons.description')" />
</span> </span>
<template v-if="!trashEnable" v-slot:opt-behind="scope"> <template v-if="!trashEnable" v-slot:opt-behind="scope">
<table-extend-btns <table-extend-btns :dropdown-items="dropdownItems" :row="scope.row" />
:dropdown-items="dropdownItems"
:row="scope.row"/>
</template> </template>
</ms-table> </ms-table>
<ms-table-pagination <ms-table-pagination
:change="initTable" :change="initTable"
:current-page.sync="currentPage" :current-page.sync="currentPage"
:page-size.sync="pageSize" :page-size.sync="pageSize"
:total="total"/> :total="total" />
</span> </span>
<ms-api-case-list @refresh="initTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList"/> <ms-api-case-list @refresh="initTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList" />
<!--批量编辑--> <!--批量编辑-->
<ms-batch-edit <ms-batch-edit
ref="batchEdit" ref="batchEdit"
@batchEdit="batchEdit" @batchEdit="batchEdit"
:data-count="$refs.table ? $refs.table.selectDataCounts : 0" :data-count="$refs.table ? $refs.table.selectDataCounts : 0"
:typeArr="typeArr" :typeArr="typeArr"
:value-arr="valueArr"/> :value-arr="valueArr" />
<!--从指定版本复制数据--> <!--从指定版本复制数据-->
<version-selector @handleSave="handleCopyDataFromVersion" ref="versionSelector"/> <version-selector @handleSave="handleCopyDataFromVersion" ref="versionSelector" />
<!--高级搜索--> <!--高级搜索-->
<ms-table-adv-search-bar :condition.sync="condition" :showLink="false" ref="searchBar" @search="search"/> <ms-table-adv-search-bar :condition.sync="condition" :showLink="false" ref="searchBar" @search="search" />
<!--查看引用--> <!--查看引用-->
<ms-show-reference ref="viewRef" :show-plan="false" :is-has-ref="false" api-type="API"/> <ms-show-reference ref="viewRef" :show-plan="false" :is-has-ref="false" api-type="API" />
<case-batch-move @refresh="initTable" @moveSave="moveSave" ref="testCaseBatchMove"/> <case-batch-move @refresh="initTable" @moveSave="moveSave" ref="testCaseBatchMove" />
<relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph"/> <relationship-graph-drawer :graph-data="graphData" ref="relationshipGraph" />
<!-- 删除接口提示 --> <!-- 删除接口提示 -->
<list-item-delete-confirm ref="apiDeleteConfirm" @handleDelete="_handleDelete"/> <list-item-delete-confirm ref="apiDeleteConfirm" @handleDelete="_handleDelete" />
</span> </span>
</template> </template>
@ -261,8 +259,8 @@ import {
removeToGcByIds, removeToGcByIds,
removeToGcByParams, removeToGcByParams,
} from '@/api/definition'; } from '@/api/definition';
import {getMaintainer, getProject} from '@/api/project'; import { getMaintainer, getProject } from '@/api/project';
import {getProjectVersions, versionEnableByProjectId} from '@/api/xpack'; import { getProjectVersions, versionEnableByProjectId } from '@/api/xpack';
import MsTableHeader from 'metersphere-frontend/src/components/MsTableHeader'; import MsTableHeader from 'metersphere-frontend/src/components/MsTableHeader';
import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator'; import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator';
import MsTableOperatorButton from 'metersphere-frontend/src/components/MsTableOperatorButton'; import MsTableOperatorButton from 'metersphere-frontend/src/components/MsTableOperatorButton';
@ -275,19 +273,19 @@ import MsContainer from 'metersphere-frontend/src/components/MsContainer';
import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn'; import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn';
import MsBottomContainer from '../BottomContainer'; import MsBottomContainer from '../BottomContainer';
import MsBatchEdit from '../basis/BatchEdit'; import MsBatchEdit from '../basis/BatchEdit';
import {API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD} from '../../model/JsonData'; import { API_METHOD_COLOUR, API_STATUS, DUBBO_METHOD, REQ_METHOD, SQL_METHOD, TCP_METHOD } from '../../model/JsonData';
import {downloadFile, operationConfirm} from 'metersphere-frontend/src/utils'; import { downloadFile, operationConfirm } from 'metersphere-frontend/src/utils';
import {getCurrentProjectID} from 'metersphere-frontend/src/utils/token'; import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token';
import {hasLicense} from 'metersphere-frontend/src/utils/permission'; import { hasLicense } from 'metersphere-frontend/src/utils/permission';
import {API_LIST} from 'metersphere-frontend/src/utils/constants'; import { API_LIST } from 'metersphere-frontend/src/utils/constants';
import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover'; import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover';
import ApiStatus from '@/business/definition/components/list/ApiStatus'; import ApiStatus from '@/business/definition/components/list/ApiStatus';
import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar'; import MsTableAdvSearchBar from 'metersphere-frontend/src/components/search/MsTableAdvSearchBar';
import {API_DEFINITION_CONFIGS} from 'metersphere-frontend/src/components/search/search-components'; import { API_DEFINITION_CONFIGS } from 'metersphere-frontend/src/components/search/search-components';
import {API_DEFINITION_CONFIGS_TRASH, getProtocolFilter} from '@/business/definition/api-definition'; import { API_DEFINITION_CONFIGS_TRASH, getProtocolFilter } from '@/business/definition/api-definition';
import MsTipButton from 'metersphere-frontend/src/components/MsTipButton'; import MsTipButton from 'metersphere-frontend/src/components/MsTipButton';
import CaseBatchMove from '@/business/definition/components/basis/BatchMove'; import CaseBatchMove from '@/business/definition/components/basis/BatchMove';
import {getProjectMember} from "@/api/user"; import { getProjectMember } from '@/api/user';
import { import {
buildBatchParam, buildBatchParam,
deepClone, deepClone,
@ -298,16 +296,16 @@ import {
initCondition, initCondition,
} 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 {Body} from '@/business/definition/model/ApiTestModel'; import { Body } from '@/business/definition/model/ApiTestModel';
import {getGraphByCondition} from '@/api/graph'; import { getGraphByCondition } from '@/api/graph';
import ListItemDeleteConfirm from 'metersphere-frontend/src/components/ListItemDeleteConfirm'; import ListItemDeleteConfirm from 'metersphere-frontend/src/components/ListItemDeleteConfirm';
import MsSearch from 'metersphere-frontend/src/components/search/MsSearch'; import MsSearch from 'metersphere-frontend/src/components/search/MsSearch';
import {buildNodePath} from 'metersphere-frontend/src/model/NodeTree'; import { buildNodePath } from 'metersphere-frontend/src/model/NodeTree';
import VersionSelector from '@/business/definition/components/version/VersionSelector'; import VersionSelector from '@/business/definition/components/version/VersionSelector';
import TableExtendBtns from "@/business/definition/components/complete/table/TableExtendBtns"; import TableExtendBtns from '@/business/definition/components/complete/table/TableExtendBtns';
import MsShowReference from "@/business/definition/components/reference/ShowReference"; import MsShowReference from '@/business/definition/components/reference/ShowReference';
import {getApiTemplate} from "@/api/api-template"; import { getApiTemplate } from '@/api/api-template';
import {getAdvSearchCustomField} from "metersphere-frontend/src/components/search/custom-component"; import { getAdvSearchCustomField } from 'metersphere-frontend/src/components/search/custom-component';
export default { export default {
name: 'ApiList', name: 'ApiList',
@ -446,22 +444,22 @@ export default {
dropdownItems: [ dropdownItems: [
{ {
name: this.$t('api_test.automation.view_ref'), name: this.$t('api_test.automation.view_ref'),
value: "ref", value: 'ref',
permissions: ['PROJECT_API_DEFINITION:READ'], permissions: ['PROJECT_API_DEFINITION:READ'],
exec: this.showCaseRef, exec: this.showCaseRef,
}, },
{ {
name: this.$t('commons.view') + "CASE", name: this.$t('commons.view') + 'CASE',
value: "case", value: 'case',
permissions: ['PROJECT_API_DEFINITION:READ'], permissions: ['PROJECT_API_DEFINITION:READ'],
exec: this.handleTestCase, exec: this.handleTestCase,
} },
], ],
typeArr: [ typeArr: [
{id: 'status', name: this.$t('api_test.definition.api_status')}, { id: 'status', name: this.$t('api_test.definition.api_status') },
{id: 'method', name: this.$t('api_test.definition.api_type')}, { id: 'method', name: this.$t('api_test.definition.api_type') },
{id: 'userId', name: this.$t('api_test.definition.api_principal')}, { id: 'userId', name: this.$t('api_test.definition.api_principal') },
{id: 'tags', name: this.$t('commons.tag')}, { id: 'tags', name: this.$t('commons.tag') },
], ],
statusFilters: [ statusFilters: [
{ {
@ -478,15 +476,15 @@ export default {
}, },
], ],
statusFiltersTrash: [{text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash'}], statusFiltersTrash: [{ text: this.$t('test_track.plan.plan_status_trash'), value: 'Trash' }],
caseStatusFilters: [ caseStatusFilters: [
{ {
text: this.$t('api_test.home_page.detail_card.unexecute'), text: this.$t('api_test.home_page.detail_card.unexecute'),
value: '未执行', value: '未执行',
}, },
{text: this.$t('test_track.review.pass'), value: '通过'}, { text: this.$t('test_track.review.pass'), value: '通过' },
{text: this.$t('test_track.review.un_pass'), value: '未通过'}, { text: this.$t('test_track.review.un_pass'), value: '未通过' },
], ],
methodFilters: [], methodFilters: [],
userFilters: [], userFilters: [],
@ -564,7 +562,7 @@ export default {
moduleOptionsNew() { moduleOptionsNew() {
let moduleOptions = []; let moduleOptions = [];
this.moduleOptions.forEach((node) => { this.moduleOptions.forEach((node) => {
buildNodePath(node, {path: ''}, moduleOptions); buildNodePath(node, { path: '' }, moduleOptions);
}); });
return moduleOptions; return moduleOptions;
}, },
@ -575,10 +573,10 @@ export default {
} }
if (this.trashEnable) { if (this.trashEnable) {
this.tableOperatorButtons = this.tableTrashOperatorButtons; this.tableOperatorButtons = this.tableTrashOperatorButtons;
this.condition.filters = {status: ['Trash']}; this.condition.filters = { status: ['Trash'] };
} else { } else {
this.tableOperatorButtons = this.tableUsualOperatorButtons; this.tableOperatorButtons = this.tableUsualOperatorButtons;
this.condition.filters = {status: ['Prepare', 'Underway', 'Completed']}; this.condition.filters = { status: ['Prepare', 'Underway', 'Completed'] };
} }
this.condition.orders = getLastTableSortField(this.tableHeaderKey); this.condition.orders = getLastTableSortField(this.tableHeaderKey);
// tab // tab
@ -638,7 +636,7 @@ export default {
trashEnable() { trashEnable() {
if (this.trashEnable) { if (this.trashEnable) {
this.tableOperatorButtons = this.tableTrashOperatorButtons; this.tableOperatorButtons = this.tableTrashOperatorButtons;
this.condition.filters = {status: ['Trash']}; this.condition.filters = { status: ['Trash'] };
this.condition.moduleIds = []; this.condition.moduleIds = [];
} else { } else {
this.tableOperatorButtons = this.tableUsualOperatorButtons; this.tableOperatorButtons = this.tableUsualOperatorButtons;
@ -655,28 +653,27 @@ export default {
async getTemplateField() { async getTemplateField() {
this.loading = true; this.loading = true;
// //
let p1 = getProjectMember() let p1 = getProjectMember().then((response) => {
.then((response) => { this.members = response.data;
this.members = response.data; });
});
let p2 = getApiTemplate(this.projectId); let p2 = getApiTemplate(this.projectId);
Promise.all([p1, p2]).then((data) => { Promise.all([p1, p2]).then((data) => {
this.loading = false; this.loading = false;
let template = data[1]; let template = data[1];
this.getCustomFields(template.customFields, this.members); this.getCustomFields(template.customFields, this.members);
let comp = getAdvSearchCustomField(this.condition, template.customFields); let comp = getAdvSearchCustomField(this.condition, template.customFields);
this.condition.components.push(...comp) this.condition.components.push(...comp);
}); });
}, },
getCustomFields(customFields, projectMembers = []) { getCustomFields(customFields, projectMembers = []) {
projectMembers.forEach(member => { projectMembers.forEach((member) => {
member['text'] = member.name; member['text'] = member.name;
// 使 // 使
member['label'] = member.name; member['label'] = member.name;
member['value'] = member.id; member['value'] = member.id;
member['showLabel'] = member.name + "(" + member.id + ")"; member['showLabel'] = member.name + '(' + member.id + ')';
}) });
customFields.forEach(item => { customFields.forEach((item) => {
if ((item.type === 'member' || item.type === 'multipleMember') && projectMembers && projectMembers.length > 0) { if ((item.type === 'member' || item.type === 'multipleMember') && projectMembers && projectMembers.length > 0) {
item.options = projectMembers; item.options = projectMembers;
} }
@ -685,7 +682,7 @@ export default {
setAdvSearchParam() { setAdvSearchParam() {
let comp = this.condition.components.find((c) => c.key === 'moduleIds'); let comp = this.condition.components.find((c) => c.key === 'moduleIds');
if (comp) { if (comp) {
comp.options.params = {protocol: this.currentProtocol}; comp.options.params = { protocol: this.currentProtocol };
} }
let method = this.condition.components.find((c) => c.key === 'method'); let method = this.condition.components.find((c) => c.key === 'method');
if (method) { if (method) {
@ -740,7 +737,7 @@ export default {
this.selectDataCounts = 0; this.selectDataCounts = 0;
this.condition.moduleIds = this.selectNodeIds; this.condition.moduleIds = this.selectNodeIds;
this.condition.projectId = this.projectId; this.condition.projectId = this.projectId;
if (currentProtocol && ["HTTP", "DUBBO", "SQL", "TCP"].includes(currentProtocol)) { if (currentProtocol && ['HTTP', 'DUBBO', 'SQL', 'TCP'].includes(currentProtocol)) {
this.condition.protocol = currentProtocol; this.condition.protocol = currentProtocol;
} else if (this.currentProtocol != null) { } else if (this.currentProtocol != null) {
this.condition.protocol = this.currentProtocol; this.condition.protocol = this.currentProtocol;
@ -905,7 +902,7 @@ export default {
getMaintainer().then((response) => { getMaintainer().then((response) => {
this.valueArr.userId = response.data; this.valueArr.userId = response.data;
this.userFilters = response.data.map((u) => { this.userFilters = response.data.map((u) => {
return {text: u.name, value: u.id}; return { text: u.name, value: u.id };
}); });
}); });
}, },
@ -916,11 +913,11 @@ export default {
this.versionFilters = response.data this.versionFilters = response.data
.filter((u) => u.id === currentVersion) .filter((u) => u.id === currentVersion)
.map((u) => { .map((u) => {
return {text: u.name, value: u.id}; return { text: u.name, value: u.id };
}); });
} else { } else {
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 };
}); });
} }
}); });
@ -1000,7 +997,7 @@ export default {
}, },
reductionApi(row) { reductionApi(row) {
let tmp = JSON.parse(JSON.stringify(row)); let tmp = JSON.parse(JSON.stringify(row));
let rows = {ids: [tmp.id]}; let rows = { ids: [tmp.id] };
rows.projectId = getCurrentProjectID(); rows.projectId = getCurrentProjectID();
rows.protocol = this.currentProtocol; rows.protocol = this.currentProtocol;
definitionReduction(rows).then(() => { definitionReduction(rows).then(() => {