refactor(测试跟踪): 防止用例全量导出重复点击
--bug=1024140 --user=陈建星 【测试跟踪】功能用例导出-可多次点击导出按钮-发出多个请求 https://www.tapd.cn/55049933/s/1347551
This commit is contained in:
parent
775fdb7555
commit
dc41c79c99
|
@ -41,9 +41,10 @@ export default {
|
|||
Vue.directive('permission-disable', NoPermissionDisable.hasPermissions);
|
||||
Vue.directive('xpack', Permission.hasLicense);
|
||||
Vue.directive('preventLinkReClick', onceLinkClick);
|
||||
// 防止重复点击
|
||||
Vue.directive('preventReClick', onceClick);
|
||||
Vue.directive('modules', modules);
|
||||
//支持左右拖拽
|
||||
// 支持左右拖拽
|
||||
Vue.directive('left-to-right-drag', Drag.left2RightDrag);
|
||||
Vue.directive('right-to-left-drag', Drag.right2LeftDrag);
|
||||
Vue.directive('bottom-to-top-drag', Drag.bottom2TopDrag);
|
||||
|
|
|
@ -370,6 +370,9 @@ export default {
|
|||
this.openExportDialog(0, true)
|
||||
break;
|
||||
case "xmind":
|
||||
if (store.isTestCaseExporting) {
|
||||
return;
|
||||
}
|
||||
this.exportTestCase(e, {exportAll: true})
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,6 @@ import MsNewUiSearch from "metersphere-frontend/src/components/new-ui/MsSearch";
|
|||
import {mapState} from "pinia";
|
||||
import {useStore} from "@/store"
|
||||
import {getProject, versionEnableByProjectId} from "@/api/project";
|
||||
import {getVersionFilters} from "@/business/utils/sdk-utils";
|
||||
import {getProjectApplicationConfig} from "@/api/project-application";
|
||||
import MsUpdateTimeColumn from "metersphere-frontend/src/components/table/MsUpdateTimeColumn";
|
||||
import MsCreateTimeColumn from "metersphere-frontend/src/components/table/MsCreateTimeColumn";
|
||||
|
@ -314,6 +313,7 @@ import {
|
|||
} from "@/business/utils/sdk-utils";
|
||||
import {getTagToolTips, initTestCaseConditionComponents, openCaseEdit, parseColumnTag} from "@/business/case/test-case";
|
||||
|
||||
const store = useStore();
|
||||
|
||||
export default {
|
||||
name: "TestCaseList",
|
||||
|
@ -658,7 +658,7 @@ export default {
|
|||
item.columnKey = 'status';
|
||||
}
|
||||
});
|
||||
useStore().testCaseDefaultValue = testCaseDefaultValue;
|
||||
store.testCaseDefaultValue = testCaseDefaultValue;
|
||||
},
|
||||
getCreateUserName(userId) {
|
||||
let user = this.userFilter.filter(item => item.value === userId);
|
||||
|
@ -1040,6 +1040,8 @@ export default {
|
|||
fileNameSuffix = ".xlsx";
|
||||
}
|
||||
this.loading = true;
|
||||
store.isTestCaseExporting = true;
|
||||
|
||||
this.$request(config).then(response => {
|
||||
this.loading = false;
|
||||
const filename = "Metersphere_case_" + this.projectName + fileNameSuffix;
|
||||
|
@ -1055,6 +1057,7 @@ export default {
|
|||
navigator.msSaveBlob(blob, filename);
|
||||
this.$emit('closeExport');
|
||||
}
|
||||
store.isTestCaseExporting = false;
|
||||
});
|
||||
},
|
||||
batchEdit(form) {
|
||||
|
|
|
@ -15,7 +15,13 @@
|
|||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false" size="small">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="exportTestCase" size="small">{{ $t('commons.export') }}</el-button>
|
||||
<el-button v-prevent-re-click
|
||||
type="primary"
|
||||
@click="exportTestCase"
|
||||
:disabled="isTestCaseExporting"
|
||||
size="small">
|
||||
{{ $t('commons.export') }}
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
@ -26,7 +32,9 @@ import MsTableButton from 'metersphere-frontend/src/components/MsTableButton';
|
|||
import {listenGoBack, removeGoBackListener} from "metersphere-frontend/src/utils";
|
||||
import {getCurrentProjectID} from "metersphere-frontend/src/utils/token"
|
||||
import TestCaseExportFieldSelectTable from "@/business/case/components/export/TestCaseExportFieldSelectTable";
|
||||
|
||||
import {useStore} from "@/store";
|
||||
import {mapState} from "pinia";
|
||||
const store = useStore();
|
||||
export default {
|
||||
name: "TestCaseImport",
|
||||
components: {TestCaseExportFieldSelectTable, ElUploadList, MsTableButton},
|
||||
|
@ -42,6 +50,11 @@ export default {
|
|||
},
|
||||
activated() {
|
||||
},
|
||||
computed: {
|
||||
...mapState(useStore, {
|
||||
isTestCaseExporting: 'isTestCaseExporting',
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
handleError(err, file, fileList) {
|
||||
this.loading = false;
|
||||
|
|
|
@ -18,6 +18,8 @@ export default {
|
|||
testCaseDefaultValue: {},
|
||||
temWorkspaceId: null,
|
||||
appFixed: null,
|
||||
// 防止全量导出时重复点击
|
||||
isTestCaseExporting: false
|
||||
}),
|
||||
persist: false,
|
||||
getters: {
|
||||
|
|
Loading…
Reference in New Issue