diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index 57d86f4967..ab21442892 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -343,17 +343,7 @@ export default { handleBatchMove() { this.$refs.testCaseBatchMove.open(this.moduleTree, [], this.moduleOptions); }, - moveSave(param) { - param.projectId = getCurrentProjectID(); - param.selectAllDate = this.isSelectAllDate; - param.unSelectIds = this.unSelection; - param = Object.assign(param, this.condition); - param.moduleId=param.nodeId; - this.$post('/api/definition/batch/editByParams', param, () => { - this.$success(this.$t('commons.save_success')); - this.initTable(); - }); - }, + isApiListEnableChange(data) { this.$emit('isApiListEnableChange', data); }, @@ -594,6 +584,21 @@ export default { this.initTable(); }); }, + moveSave(param) { + let arr = Array.from(this.selectRows); + let ids = arr.map(row => row.id); + param.ids = ids; + param.projectId = getCurrentProjectID(); + param.selectAllDate = this.isSelectAllDate; + param.unSelectIds = this.unSelection; + param = Object.assign(param, this.condition); + param.moduleId=param.nodeId; + this.$post('/api/definition/batch/editByParams', param, () => { + this.$success(this.$t('commons.save_success')); + this.$refs.testCaseBatchMove.close(); + this.initTable(); + }); + }, handleTestCase(api) { this.selectApi = api; let request = {}; @@ -688,121 +693,17 @@ export default { _filter(filters, this.condition); this.initTable(); }, + labelHead(h,{column,index}){ + if(column.minWidth>column.realWidth){ + column.realWidth = column.minWidth; + column.width = column.minWidth; + } + return column.label; + }, open() { this.$refs.searchBar.open(); } }, -} - this.$post('/api/definition/batch/editByParams', param, () => { - this.$success(this.$t('commons.save_success')); - this.initTable(); - }); - }, - handleTestCase(api) { - this.selectApi = api; - let request = {}; - if (Object.prototype.toString.call(api.request).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') { - request = api.request; - } else { - request = JSON.parse(api.request); - } - if (!request.hashTree) { - request.hashTree = []; - } - this.selectApi.url = request.path; - this.$refs.caseList.open(this.selectApi); - }, - handleDelete(api) { - if (this.trashEnable) { - this.$get('/api/definition/delete/' + api.id, () => { - this.$success(this.$t('commons.delete_success')); - this.initTable(); - }); - return; - } - this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + api.name + " ?", '', { - confirmButtonText: this.$t('commons.confirm'), - callback: (action) => { - if (action === 'confirm') { - let ids = [api.id]; - this.$post('/api/definition/removeToGc/', ids, () => { - this.$success(this.$t('commons.delete_success')); - this.initTable(); - this.$refs.caseList.apiCaseClose(); - }); - } - } - }); - }, - getColor(enable, method) { - if (enable) { - return this.methodColorMap.get(method); - } - }, - showExecResult(row) { - this.$emit('showExecResult', row); - }, - selectRowsCount(selection) { - let selectedIDs = this.getIds(selection); - let allIDs = this.tableData.map(s => s.id); - this.unSelection = allIDs.filter(function (val) { - return selectedIDs.indexOf(val) === -1 - }); - if (this.isSelectAllDate) { - this.selectDataCounts = this.total - this.unSelection.length; - } else { - this.selectDataCounts = selection.size; - } - }, - isSelectDataAll(dataType) { - this.isSelectAllDate = dataType; - this.selectRowsCount(this.selectRows) - //如果已经全选,不需要再操作了 - if (this.selectRows.size != this.tableData.length) { - this.$refs.apiDefinitionTable.toggleAllSelection(true); - } - }, - //判断是否只显示本周的数据。 从首页跳转过来的请求会带有相关参数 - getSelectDataRange() { - let dataRange = this.$route.params.dataSelectRange; - let dataType = this.$route.params.dataType; - if (dataType === 'api') { - this.selectDataRange = dataRange; - } else { - this.selectDataRange = 'all'; - } - }, - changeSelectDataRangeAll() { - this.$emit("changeSelectDataRangeAll", "api"); - }, - getIds(rowSets) { - let rowArray = Array.from(rowSets) - let ids = rowArray.map(s => s.id); - return ids; - }, - sort(column) { - // 每次只对一个字段排序 - if (this.condition.orders) { - this.condition.orders = []; - } - _sort(column, this.condition); - this.initTable(); - }, - filter(filters) { - _filter(filters, this.condition); - this.initTable(); - }, - labelHead(h,{column,index}){ - if(column.minWidth>column.realWidth){ - column.realWidth = column.minWidth; - column.width = column.minWidth; - } - return column.label; - }, - open() { - this.$refs.searchBar.open(); - } - }, }