From 963c83e18f429b2d3879c7b7284f9e23f0387397 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 4 Nov 2024 15:33:46 +0800 Subject: [PATCH] =?UTF-8?q?style(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=A0=8F=E5=AE=BD=E5=BA=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fit2-zhao --- .../automation/scenario/ApiScenarioList.vue | 12 +- .../components/list/ApiCaseSimpleList.vue | 41 +++--- .../definition/components/list/ApiList.vue | 139 +++++++++--------- 3 files changed, 97 insertions(+), 95 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue b/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue index 01c4b15240..420ed5f597 100644 --- a/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue +++ b/api-test/frontend/src/business/automation/scenario/ApiScenarioList.vue @@ -14,7 +14,7 @@ :fields.sync="fields" :field-key="tableHeaderKey" :remember-order="true" - operator-width="200" + operator-width="210" :enable-order-drag="enableOrderDrag" row-key="id" :row-order-group-id="condition.projectId" @@ -84,11 +84,11 @@ sortable /> + prop="nodePath" + :field="item" + :fields-width="fieldsWidth" + :label="$t('api_test.automation.module')" + min-width="150px"> diff --git a/api-test/frontend/src/business/definition/components/list/ApiCaseSimpleList.vue b/api-test/frontend/src/business/definition/components/list/ApiCaseSimpleList.vue index 099d03e86d..51011b0545 100644 --- a/api-test/frontend/src/business/definition/components/list/ApiCaseSimpleList.vue +++ b/api-test/frontend/src/business/definition/components/list/ApiCaseSimpleList.vue @@ -33,7 +33,7 @@ :row-order-func="editApiTestCaseOrder" :enable-order-drag="enableOrderDrag" row-key="id" - operator-width="190px" + operator-width="220" @refresh="initTable" ref="caseTable" class="api-case-simple-list"> @@ -319,11 +319,11 @@ import { testCaseReduction, updateExecuteInfo, } from '@/api/api-test-case'; -import {getDefinitionById} from '@/api/definition'; -import {getApiReportDetail} from '@/api/definition-report'; -import {genPerformanceTestXml} from '@/api/home'; -import {getMaintainer} from '@/api/project'; -import {getProjectVersions, synCaseBatch, versionEnableByProjectId} from '@/api/xpack'; +import { getDefinitionById } from '@/api/definition'; +import { getApiReportDetail } from '@/api/definition-report'; +import { genPerformanceTestXml } from '@/api/home'; +import { getMaintainer } from '@/api/project'; +import { getProjectVersions, synCaseBatch, versionEnableByProjectId } from '@/api/xpack'; import MsTable from 'metersphere-frontend/src/components/table/MsTable'; import MsTableColumn from 'metersphere-frontend/src/components/table/MsTableColumn'; 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 ShowMoreBtn from '@/business/commons/ShowMoreBtn'; import MsBatchEdit from '../basis/BatchEdit'; -import {getUUID} from 'metersphere-frontend/src/utils'; +import { getUUID } from 'metersphere-frontend/src/utils'; import { API_METHOD_COLOUR, CASE_PRIORITY, @@ -345,19 +345,19 @@ import { SQL_METHOD, TCP_METHOD, } from '../../model/JsonData'; -import {getCurrentProjectID} from 'metersphere-frontend/src/utils/token'; -import {hasLicense} from 'metersphere-frontend/src/utils/permission'; -import {getBodyUploadFiles} from '@/business/definition/api-definition'; +import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token'; +import { hasLicense } from 'metersphere-frontend/src/utils/permission'; +import { getBodyUploadFiles } from '@/business/definition/api-definition'; import PriorityTableItem from '@/business/commons/PriorityTableItem'; import MsApiCaseTableExtendBtns from '../reference/ApiCaseTableExtendBtns'; import MsShowReference from '../reference/ShowReference'; import MsSetEnvironment from '@/business/definition/components/basis/SetEnvironment'; import TestPlan from '@/business/definition/components/jmeter/components/test-plan'; 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 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 { _filter, _sort, @@ -366,17 +366,17 @@ import { getLastTableSortField, handleRowDrop, } 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 ApiCaseBatchRun from '@/business/definition/components/list/ApiCaseBatchRun'; 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 MsSearch from 'metersphere-frontend/src/components/search/MsSearch'; import SyncSetting from '@/business/definition/util/SyncSetting'; -import {getEnvironmentByProjectId} from 'metersphere-frontend/src/api/environment'; -import {useApiStore, usePerformanceStore} from '@/store'; -import {REPORT_STATUS} from '@/business/commons/js/commons'; +import { getEnvironmentByProjectId } from 'metersphere-frontend/src/api/environment'; +import { useApiStore, usePerformanceStore } from '@/store'; +import { REPORT_STATUS } from '@/business/commons/js/commons'; import MsApiRunMode from '@/business/automation/scenario/common/ApiRunMode'; import ApiDeleteConfirm from '@/business/definition/components/list/ApiDeleteConfirm'; @@ -664,7 +664,12 @@ export default { }, storeCurrentApiCaseRefresh() { 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 = {}; }, diff --git a/api-test/frontend/src/business/definition/components/list/ApiList.vue b/api-test/frontend/src/business/definition/components/list/ApiList.vue index 4e791946cf..c91bba5452 100644 --- a/api-test/frontend/src/business/definition/components/list/ApiList.vue +++ b/api-test/frontend/src/business/definition/components/list/ApiList.vue @@ -19,7 +19,7 @@ :batch-operators="trashEnable ? trashButtons : buttons" :screen-height="screenHeight" :operators="tableOperatorButtons" - operator-width="200px" + operator-width="220" :remember-order="true" @refresh="initTable" :fields.sync="fields" @@ -47,7 +47,7 @@ :fields-width="fieldsWidth" v-if="this.trashEnable" :label="$t('commons.delete_user')" - min-width="120"/> + min-width="120" /> @@ -183,7 +183,7 @@ :field="item" :fields-width="fieldsWidth" min-width="100px" - :label="$t('api_test.definition.api_case_number')"/> + :label="$t('api_test.definition.api_case_number')" /> @@ -201,46 +201,44 @@ :field="item" min-width="120px" :fields-width="fieldsWidth" - :label="$t('api_test.definition.api_case_passing_rate')"/> + :label="$t('api_test.definition.api_case_passing_rate')" /> + :label="$t('commons.description')" /> + :total="total" /> - + + :value-arr="valueArr" /> - + - + - - + + - + - + @@ -261,8 +259,8 @@ import { removeToGcByIds, removeToGcByParams, } from '@/api/definition'; -import {getMaintainer, getProject} from '@/api/project'; -import {getProjectVersions, versionEnableByProjectId} from '@/api/xpack'; +import { getMaintainer, getProject } from '@/api/project'; +import { getProjectVersions, versionEnableByProjectId } from '@/api/xpack'; import MsTableHeader from 'metersphere-frontend/src/components/MsTableHeader'; import MsTableOperator from 'metersphere-frontend/src/components/MsTableOperator'; 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 MsBottomContainer from '../BottomContainer'; import MsBatchEdit from '../basis/BatchEdit'; -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 {getCurrentProjectID} from 'metersphere-frontend/src/utils/token'; -import {hasLicense} from 'metersphere-frontend/src/utils/permission'; -import {API_LIST} from 'metersphere-frontend/src/utils/constants'; +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 { getCurrentProjectID } from 'metersphere-frontend/src/utils/token'; +import { hasLicense } from 'metersphere-frontend/src/utils/permission'; +import { API_LIST } from 'metersphere-frontend/src/utils/constants'; import MsTableHeaderSelectPopover from 'metersphere-frontend/src/components/table/MsTableHeaderSelectPopover'; import ApiStatus from '@/business/definition/components/list/ApiStatus'; 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_TRASH, getProtocolFilter} from '@/business/definition/api-definition'; +import { API_DEFINITION_CONFIGS } from 'metersphere-frontend/src/components/search/search-components'; +import { API_DEFINITION_CONFIGS_TRASH, getProtocolFilter } from '@/business/definition/api-definition'; import MsTipButton from 'metersphere-frontend/src/components/MsTipButton'; import CaseBatchMove from '@/business/definition/components/basis/BatchMove'; -import {getProjectMember} from "@/api/user"; +import { getProjectMember } from '@/api/user'; import { buildBatchParam, deepClone, @@ -298,16 +296,16 @@ import { initCondition, } from 'metersphere-frontend/src/utils/tableUtils'; import HeaderLabelOperate from 'metersphere-frontend/src/components/head/HeaderLabelOperate'; -import {Body} from '@/business/definition/model/ApiTestModel'; -import {getGraphByCondition} from '@/api/graph'; +import { Body } from '@/business/definition/model/ApiTestModel'; +import { getGraphByCondition } from '@/api/graph'; import ListItemDeleteConfirm from 'metersphere-frontend/src/components/ListItemDeleteConfirm'; 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 TableExtendBtns from "@/business/definition/components/complete/table/TableExtendBtns"; -import MsShowReference from "@/business/definition/components/reference/ShowReference"; -import {getApiTemplate} from "@/api/api-template"; -import {getAdvSearchCustomField} from "metersphere-frontend/src/components/search/custom-component"; +import TableExtendBtns from '@/business/definition/components/complete/table/TableExtendBtns'; +import MsShowReference from '@/business/definition/components/reference/ShowReference'; +import { getApiTemplate } from '@/api/api-template'; +import { getAdvSearchCustomField } from 'metersphere-frontend/src/components/search/custom-component'; export default { name: 'ApiList', @@ -446,22 +444,22 @@ export default { dropdownItems: [ { name: this.$t('api_test.automation.view_ref'), - value: "ref", + value: 'ref', permissions: ['PROJECT_API_DEFINITION:READ'], exec: this.showCaseRef, }, { - name: this.$t('commons.view') + "CASE", - value: "case", + name: this.$t('commons.view') + 'CASE', + value: 'case', permissions: ['PROJECT_API_DEFINITION:READ'], exec: this.handleTestCase, - } + }, ], typeArr: [ - {id: 'status', name: this.$t('api_test.definition.api_status')}, - {id: 'method', name: this.$t('api_test.definition.api_type')}, - {id: 'userId', name: this.$t('api_test.definition.api_principal')}, - {id: 'tags', name: this.$t('commons.tag')}, + { id: 'status', name: this.$t('api_test.definition.api_status') }, + { id: 'method', name: this.$t('api_test.definition.api_type') }, + { id: 'userId', name: this.$t('api_test.definition.api_principal') }, + { id: 'tags', name: this.$t('commons.tag') }, ], 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: [ { text: this.$t('api_test.home_page.detail_card.unexecute'), value: '未执行', }, - {text: this.$t('test_track.review.pass'), value: '通过'}, - {text: this.$t('test_track.review.un_pass'), value: '未通过'}, + { text: this.$t('test_track.review.pass'), value: '通过' }, + { text: this.$t('test_track.review.un_pass'), value: '未通过' }, ], methodFilters: [], userFilters: [], @@ -564,7 +562,7 @@ export default { moduleOptionsNew() { let moduleOptions = []; this.moduleOptions.forEach((node) => { - buildNodePath(node, {path: ''}, moduleOptions); + buildNodePath(node, { path: '' }, moduleOptions); }); return moduleOptions; }, @@ -575,10 +573,10 @@ export default { } if (this.trashEnable) { this.tableOperatorButtons = this.tableTrashOperatorButtons; - this.condition.filters = {status: ['Trash']}; + this.condition.filters = { status: ['Trash'] }; } else { this.tableOperatorButtons = this.tableUsualOperatorButtons; - this.condition.filters = {status: ['Prepare', 'Underway', 'Completed']}; + this.condition.filters = { status: ['Prepare', 'Underway', 'Completed'] }; } this.condition.orders = getLastTableSortField(this.tableHeaderKey); // 切换tab之后版本查询 @@ -638,7 +636,7 @@ export default { trashEnable() { if (this.trashEnable) { this.tableOperatorButtons = this.tableTrashOperatorButtons; - this.condition.filters = {status: ['Trash']}; + this.condition.filters = { status: ['Trash'] }; this.condition.moduleIds = []; } else { this.tableOperatorButtons = this.tableUsualOperatorButtons; @@ -655,28 +653,27 @@ export default { async getTemplateField() { this.loading = true; // 防止第一次渲染版本字段展示顺序错乱 - let p1 = getProjectMember() - .then((response) => { - this.members = response.data; - }); + let p1 = getProjectMember().then((response) => { + this.members = response.data; + }); let p2 = getApiTemplate(this.projectId); Promise.all([p1, p2]).then((data) => { this.loading = false; let template = data[1]; this.getCustomFields(template.customFields, this.members); let comp = getAdvSearchCustomField(this.condition, template.customFields); - this.condition.components.push(...comp) + this.condition.components.push(...comp); }); }, getCustomFields(customFields, projectMembers = []) { - projectMembers.forEach(member => { + projectMembers.forEach((member) => { member['text'] = member.name; // 高级搜索使用 member['label'] = member.name; member['value'] = member.id; - member['showLabel'] = member.name + "(" + member.id + ")"; - }) - customFields.forEach(item => { + member['showLabel'] = member.name + '(' + member.id + ')'; + }); + customFields.forEach((item) => { if ((item.type === 'member' || item.type === 'multipleMember') && projectMembers && projectMembers.length > 0) { item.options = projectMembers; } @@ -685,7 +682,7 @@ export default { setAdvSearchParam() { let comp = this.condition.components.find((c) => c.key === 'moduleIds'); if (comp) { - comp.options.params = {protocol: this.currentProtocol}; + comp.options.params = { protocol: this.currentProtocol }; } let method = this.condition.components.find((c) => c.key === 'method'); if (method) { @@ -740,7 +737,7 @@ export default { this.selectDataCounts = 0; this.condition.moduleIds = this.selectNodeIds; 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; } else if (this.currentProtocol != null) { this.condition.protocol = this.currentProtocol; @@ -905,7 +902,7 @@ export default { getMaintainer().then((response) => { this.valueArr.userId = response.data; 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 .filter((u) => u.id === currentVersion) .map((u) => { - return {text: u.name, value: u.id}; + return { text: u.name, value: u.id }; }); } else { 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) { let tmp = JSON.parse(JSON.stringify(row)); - let rows = {ids: [tmp.id]}; + let rows = { ids: [tmp.id] }; rows.projectId = getCurrentProjectID(); rows.protocol = this.currentProtocol; definitionReduction(rows).then(() => {