Merge branch 'master' of https://github.com/metersphere/server
This commit is contained in:
commit
895c43bbaf
|
@ -1 +1 @@
|
||||||
Subproject commit b86032cbbda9a9e6028308aa95a887cff2192f1c
|
Subproject commit ecb30d83c575c6ed14adb1a1ebea389730f410a9
|
|
@ -15,35 +15,35 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<el-button type="primary" plain :disabled="isReadOnly" @click="saveTest">
|
<el-button type="primary" plain :disabled="isReadOnly" @click="saveTest">
|
||||||
{{$t('commons.save')}}
|
{{ $t('commons.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-button type="primary" plain :disabled="isReadOnly"
|
<el-button type="primary" plain :disabled="isReadOnly"
|
||||||
@click="saveRunTest">
|
@click="saveRunTest">
|
||||||
{{$t('load_test.save_and_run')}}
|
{{ $t('load_test.save_and_run') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<!-- <el-button :disabled="isReadOnly" type="primary" plain v-if="isShowRun" @click="runTest">-->
|
<!-- <el-button :disabled="isReadOnly" type="primary" plain v-if="isShowRun" @click="runTest">-->
|
||||||
<!-- {{$t('api_test.run')}}-->
|
<!-- {{$t('api_test.run')}}-->
|
||||||
<!-- </el-button>-->
|
<!-- </el-button>-->
|
||||||
|
|
||||||
<el-button :disabled="isReadOnly" type="warning" plain @click="cancel">{{$t('commons.cancel')}}
|
<el-button :disabled="isReadOnly" type="warning" plain @click="cancel">{{ $t('commons.cancel') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-dropdown trigger="click" @command="handleCommand">
|
<el-dropdown trigger="click" @command="handleCommand">
|
||||||
<el-button class="el-dropdown-link more" icon="el-icon-more" plain/>
|
<el-button class="el-dropdown-link more" icon="el-icon-more" plain/>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item command="report">
|
<el-dropdown-item command="report">
|
||||||
{{$t('api_report.title')}}
|
{{ $t('api_report.title') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item command="performance" :disabled="create || isReadOnly">
|
<el-dropdown-item command="performance" :disabled="create || isReadOnly">
|
||||||
{{$t('api_test.create_performance_test')}}
|
{{ $t('api_test.create_performance_test') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item command="export" :disabled="isReadOnly || create">
|
<el-dropdown-item command="export" :disabled="isReadOnly || create">
|
||||||
{{$t('api_test.export_config')}}
|
{{ $t('api_test.export_config') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
<el-dropdown-item command="import" :disabled="isReadOnly">
|
<el-dropdown-item command="import" :disabled="isReadOnly">
|
||||||
{{$t('api_test.api_import.label')}}
|
{{ $t('api_test.api_import.label') }}
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
|
@ -52,10 +52,12 @@
|
||||||
|
|
||||||
<ms-api-report-dialog :test-id="id" ref="reportDialog"/>
|
<ms-api-report-dialog :test-id="id" ref="reportDialog"/>
|
||||||
|
|
||||||
<ms-schedule-config :schedule="test.schedule" :is-read-only="isReadOnly" :save="saveCronExpression" @scheduleChange="saveSchedule" :check-open="checkScheduleEdit"/>
|
<ms-schedule-config :schedule="test.schedule" :is-read-only="isReadOnly" :save="saveCronExpression"
|
||||||
|
@scheduleChange="saveSchedule" :check-open="checkScheduleEdit"/>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-header>
|
</el-header>
|
||||||
<ms-api-scenario-config :debug-report-id="debugReportId" @runDebug="runDebug" :is-read-only="isReadOnly" :scenarios="test.scenarioDefinition" :project-id="test.projectId" ref="config"/>
|
<ms-api-scenario-config :debug-report-id="debugReportId" @runDebug="runDebug" :is-read-only="isReadOnly"
|
||||||
|
:scenarios="test.scenarioDefinition" :project-id="test.projectId" ref="config"/>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,274 +65,279 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
|
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
|
||||||
import {Test} from "./model/ScenarioModel"
|
import {Test} from "./model/ScenarioModel"
|
||||||
import MsApiReportStatus from "../report/ApiReportStatus";
|
import MsApiReportStatus from "../report/ApiReportStatus";
|
||||||
import MsApiReportDialog from "./ApiReportDialog";
|
import MsApiReportDialog from "./ApiReportDialog";
|
||||||
import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils";
|
import {checkoutTestManagerOrTestUser, downloadFile} from "@/common/js/utils";
|
||||||
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
|
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
|
||||||
import ApiImport from "./components/import/ApiImport";
|
import ApiImport from "./components/import/ApiImport";
|
||||||
import {getUUID} from "../../../../common/js/utils";
|
import {getUUID} from "../../../../common/js/utils";
|
||||||
|
import {ApiEvent, LIST_CHANGE} from "@/business/components/common/head/ListEvent";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsApiTestConfig",
|
name: "MsApiTestConfig",
|
||||||
|
|
||||||
components: {ApiImport, MsScheduleConfig, MsApiReportDialog, MsApiReportStatus, MsApiScenarioConfig},
|
components: {ApiImport, MsScheduleConfig, MsApiReportDialog, MsApiReportStatus, MsApiScenarioConfig},
|
||||||
|
|
||||||
props: ["id"],
|
props: ["id"],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
reportVisible: false,
|
reportVisible: false,
|
||||||
create: false,
|
create: false,
|
||||||
result: {},
|
result: {},
|
||||||
projects: [],
|
projects: [],
|
||||||
change: false,
|
change: false,
|
||||||
test: new Test(),
|
test: new Test(),
|
||||||
isReadOnly: false,
|
isReadOnly: false,
|
||||||
debugReportId: ''
|
debugReportId: ''
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: {
|
|
||||||
'$route': 'init',
|
|
||||||
test: {
|
|
||||||
handler: function () {
|
|
||||||
this.change = true;
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
init() {
|
|
||||||
let projectId;
|
|
||||||
|
|
||||||
this.isReadOnly = !checkoutTestManagerOrTestUser();
|
|
||||||
|
|
||||||
if (this.id) {
|
|
||||||
this.create = false;
|
|
||||||
this.getTest(this.id);
|
|
||||||
} else {
|
|
||||||
this.create = true;
|
|
||||||
this.test = new Test();
|
|
||||||
if (this.$refs.config) {
|
|
||||||
this.$refs.config.reset();
|
|
||||||
}
|
|
||||||
// 仅创建时获取选择的项目
|
|
||||||
projectId = this.$store.state.common.projectId;
|
|
||||||
}
|
|
||||||
this.result = this.$get("/project/listAll", response => {
|
|
||||||
this.projects = response.data;
|
|
||||||
// 等待项目列表加载完
|
|
||||||
if (projectId) this.test.projectId = projectId;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getTest(id) {
|
|
||||||
this.result = this.$get("/api/get/" + id, response => {
|
|
||||||
if (response.data) {
|
|
||||||
let item = response.data;
|
|
||||||
|
|
||||||
this.test = new Test({
|
|
||||||
id: item.id,
|
|
||||||
projectId: item.projectId,
|
|
||||||
name: item.name,
|
|
||||||
status: item.status,
|
|
||||||
scenarioDefinition: JSON.parse(item.scenarioDefinition),
|
|
||||||
schedule: item.schedule ? item.schedule : {},
|
|
||||||
});
|
|
||||||
this.$refs.config.reset();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
save(callback) {
|
|
||||||
let validator = this.test.isValid();
|
|
||||||
if (!validator.isValid) {
|
|
||||||
this.$warning(this.$t(validator.info));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.change = false;
|
|
||||||
let bodyFiles = this.getBodyUploadFiles();
|
|
||||||
let url = this.create ? "/api/create" : "/api/update";
|
|
||||||
let jmx = this.test.toJMX();
|
|
||||||
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
|
|
||||||
let file = new File([blob], jmx.name);
|
|
||||||
this.result = this.$fileUpload(url, file, bodyFiles, this.test,response => {
|
|
||||||
if (callback) callback();
|
|
||||||
this.create = false;
|
|
||||||
this.resetBodyFile();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
saveTest() {
|
|
||||||
this.save(() => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
if (this.create) {
|
|
||||||
this.$router.push({
|
|
||||||
path: '/api/test/edit?id=' + this.test.id
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
runTest() {
|
|
||||||
this.result = this.$post("/api/run", {id: this.test.id, triggerMode: 'MANUAL'}, (response) => {
|
|
||||||
this.$success(this.$t('api_test.running'));
|
|
||||||
this.$router.push({
|
|
||||||
path: '/api/report/view/' + response.data
|
|
||||||
})
|
|
||||||
});
|
|
||||||
},
|
|
||||||
saveRunTest() {
|
|
||||||
this.change = false;
|
|
||||||
|
|
||||||
this.save(() => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.runTest();
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getBodyUploadFiles() {
|
|
||||||
let bodyUploadFiles = [];
|
|
||||||
this.test.bodyUploadIds = [];
|
|
||||||
this.test.scenarioDefinition.forEach(scenario => {
|
|
||||||
scenario.requests.forEach(request => {
|
|
||||||
if (request.body) {
|
|
||||||
request.body.kvs.forEach( param => {
|
|
||||||
if (param.files) {
|
|
||||||
param.files.forEach(item => {
|
|
||||||
if (item.file) {
|
|
||||||
let fileId = getUUID().substring(0, 8);
|
|
||||||
item.name = item.file.name;
|
|
||||||
item.id = fileId;
|
|
||||||
this.test.bodyUploadIds.push(fileId);
|
|
||||||
bodyUploadFiles.push(item.file);
|
|
||||||
// item.file = undefined;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return bodyUploadFiles;
|
|
||||||
},
|
|
||||||
resetBodyFile() {
|
|
||||||
//下次保存不再上传已传文件
|
|
||||||
this.test.scenarioDefinition.forEach(scenario => {
|
|
||||||
scenario.requests.forEach(request => {
|
|
||||||
if (request.body) {
|
|
||||||
request.body.kvs.forEach( param => {
|
|
||||||
if (param.files) {
|
|
||||||
param.files.forEach(item => {
|
|
||||||
if (item.file) {
|
|
||||||
item.file = undefined;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
this.$router.push('/api/test/list/all');
|
|
||||||
},
|
|
||||||
handleCommand(command) {
|
|
||||||
switch (command) {
|
|
||||||
case "report":
|
|
||||||
this.$refs.reportDialog.open();
|
|
||||||
break;
|
|
||||||
case "performance":
|
|
||||||
this.$store.commit('setTest', {
|
|
||||||
projectId: this.test.projectId,
|
|
||||||
name: this.test.name,
|
|
||||||
jmx: this.test.toJMX()
|
|
||||||
})
|
|
||||||
this.$router.push({
|
|
||||||
path: "/performance/test/create"
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case "export":
|
|
||||||
downloadFile(this.test.name + ".json", this.test.export());
|
|
||||||
break;
|
|
||||||
case "import":
|
|
||||||
this.$refs.apiImport.open();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
saveCronExpression(cronExpression) {
|
|
||||||
this.test.schedule.enable = true;
|
|
||||||
this.test.schedule.value = cronExpression;
|
|
||||||
this.saveSchedule();
|
|
||||||
},
|
|
||||||
saveSchedule() {
|
|
||||||
this.checkScheduleEdit();
|
|
||||||
let param = {};
|
|
||||||
param = this.test.schedule;
|
|
||||||
param.resourceId = this.test.id;
|
|
||||||
let url = '/api/schedule/create';
|
|
||||||
if (param.id) {
|
|
||||||
url = '/api/schedule/update';
|
|
||||||
}
|
|
||||||
this.$post(url, param, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.getTest(this.test.id);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
checkScheduleEdit() {
|
|
||||||
if (this.create) {
|
|
||||||
this.$message(this.$t('api_test.environment.please_save_test'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
runDebug(scenario) {
|
|
||||||
if (this.create) {
|
|
||||||
this.$warning(this.$t('api_test.environment.please_save_test'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let url = "/api/run/debug";
|
|
||||||
let runningTest = new Test();
|
|
||||||
Object.assign(runningTest, this.test);
|
|
||||||
runningTest.scenarioDefinition = [];
|
|
||||||
runningTest.scenarioDefinition.push(scenario);
|
|
||||||
let validator = runningTest.isValid();
|
|
||||||
if (!validator.isValid) {
|
|
||||||
this.$warning(this.$t(validator.info));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let jmx = runningTest.toJMX();
|
|
||||||
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
|
|
||||||
let file = new File([blob], jmx.name);
|
|
||||||
this.$fileUpload(url, file, null, this.test,response => {
|
|
||||||
this.debugReportId = response.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
created() {
|
|
||||||
this.init();
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
'$route': 'init',
|
||||||
|
test: {
|
||||||
|
handler: function () {
|
||||||
|
this.change = true;
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
let projectId;
|
||||||
|
|
||||||
|
this.isReadOnly = !checkoutTestManagerOrTestUser();
|
||||||
|
|
||||||
|
if (this.id) {
|
||||||
|
this.create = false;
|
||||||
|
this.getTest(this.id);
|
||||||
|
} else {
|
||||||
|
this.create = true;
|
||||||
|
this.test = new Test();
|
||||||
|
if (this.$refs.config) {
|
||||||
|
this.$refs.config.reset();
|
||||||
|
}
|
||||||
|
// 仅创建时获取选择的项目
|
||||||
|
projectId = this.$store.state.common.projectId;
|
||||||
|
}
|
||||||
|
this.result = this.$get("/project/listAll", response => {
|
||||||
|
this.projects = response.data;
|
||||||
|
// 等待项目列表加载完
|
||||||
|
if (projectId) this.test.projectId = projectId;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getTest(id) {
|
||||||
|
this.result = this.$get("/api/get/" + id, response => {
|
||||||
|
if (response.data) {
|
||||||
|
let item = response.data;
|
||||||
|
|
||||||
|
this.test = new Test({
|
||||||
|
id: item.id,
|
||||||
|
projectId: item.projectId,
|
||||||
|
name: item.name,
|
||||||
|
status: item.status,
|
||||||
|
scenarioDefinition: JSON.parse(item.scenarioDefinition),
|
||||||
|
schedule: item.schedule ? item.schedule : {},
|
||||||
|
});
|
||||||
|
this.$refs.config.reset();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
save(callback) {
|
||||||
|
let validator = this.test.isValid();
|
||||||
|
if (!validator.isValid) {
|
||||||
|
this.$warning(this.$t(validator.info));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.change = false;
|
||||||
|
let bodyFiles = this.getBodyUploadFiles();
|
||||||
|
let url = this.create ? "/api/create" : "/api/update";
|
||||||
|
let jmx = this.test.toJMX();
|
||||||
|
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
|
||||||
|
let file = new File([blob], jmx.name);
|
||||||
|
this.result = this.$fileUpload(url, file, bodyFiles, this.test, response => {
|
||||||
|
if (callback) callback();
|
||||||
|
this.create = false;
|
||||||
|
this.resetBodyFile();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
saveTest() {
|
||||||
|
this.save(() => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
if (this.create) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/api/test/edit?id=' + this.test.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 发送广播,刷新 head 上的最新列表
|
||||||
|
ApiEvent.$emit(LIST_CHANGE);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
runTest() {
|
||||||
|
this.result = this.$post("/api/run", {id: this.test.id, triggerMode: 'MANUAL'}, (response) => {
|
||||||
|
this.$success(this.$t('api_test.running'));
|
||||||
|
this.$router.push({
|
||||||
|
path: '/api/report/view/' + response.data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
saveRunTest() {
|
||||||
|
this.change = false;
|
||||||
|
|
||||||
|
this.save(() => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.runTest();
|
||||||
|
// 发送广播,刷新 head 上的最新列表
|
||||||
|
ApiEvent.$emit(LIST_CHANGE);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getBodyUploadFiles() {
|
||||||
|
let bodyUploadFiles = [];
|
||||||
|
this.test.bodyUploadIds = [];
|
||||||
|
this.test.scenarioDefinition.forEach(scenario => {
|
||||||
|
scenario.requests.forEach(request => {
|
||||||
|
if (request.body) {
|
||||||
|
request.body.kvs.forEach(param => {
|
||||||
|
if (param.files) {
|
||||||
|
param.files.forEach(item => {
|
||||||
|
if (item.file) {
|
||||||
|
let fileId = getUUID().substring(0, 8);
|
||||||
|
item.name = item.file.name;
|
||||||
|
item.id = fileId;
|
||||||
|
this.test.bodyUploadIds.push(fileId);
|
||||||
|
bodyUploadFiles.push(item.file);
|
||||||
|
// item.file = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return bodyUploadFiles;
|
||||||
|
},
|
||||||
|
resetBodyFile() {
|
||||||
|
//下次保存不再上传已传文件
|
||||||
|
this.test.scenarioDefinition.forEach(scenario => {
|
||||||
|
scenario.requests.forEach(request => {
|
||||||
|
if (request.body) {
|
||||||
|
request.body.kvs.forEach(param => {
|
||||||
|
if (param.files) {
|
||||||
|
param.files.forEach(item => {
|
||||||
|
if (item.file) {
|
||||||
|
item.file = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.$router.push('/api/test/list/all');
|
||||||
|
},
|
||||||
|
handleCommand(command) {
|
||||||
|
switch (command) {
|
||||||
|
case "report":
|
||||||
|
this.$refs.reportDialog.open();
|
||||||
|
break;
|
||||||
|
case "performance":
|
||||||
|
this.$store.commit('setTest', {
|
||||||
|
projectId: this.test.projectId,
|
||||||
|
name: this.test.name,
|
||||||
|
jmx: this.test.toJMX()
|
||||||
|
})
|
||||||
|
this.$router.push({
|
||||||
|
path: "/performance/test/create"
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case "export":
|
||||||
|
downloadFile(this.test.name + ".json", this.test.export());
|
||||||
|
break;
|
||||||
|
case "import":
|
||||||
|
this.$refs.apiImport.open();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveCronExpression(cronExpression) {
|
||||||
|
this.test.schedule.enable = true;
|
||||||
|
this.test.schedule.value = cronExpression;
|
||||||
|
this.saveSchedule();
|
||||||
|
},
|
||||||
|
saveSchedule() {
|
||||||
|
this.checkScheduleEdit();
|
||||||
|
let param = {};
|
||||||
|
param = this.test.schedule;
|
||||||
|
param.resourceId = this.test.id;
|
||||||
|
let url = '/api/schedule/create';
|
||||||
|
if (param.id) {
|
||||||
|
url = '/api/schedule/update';
|
||||||
|
}
|
||||||
|
this.$post(url, param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.getTest(this.test.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkScheduleEdit() {
|
||||||
|
if (this.create) {
|
||||||
|
this.$message(this.$t('api_test.environment.please_save_test'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
runDebug(scenario) {
|
||||||
|
if (this.create) {
|
||||||
|
this.$warning(this.$t('api_test.environment.please_save_test'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = "/api/run/debug";
|
||||||
|
let runningTest = new Test();
|
||||||
|
Object.assign(runningTest, this.test);
|
||||||
|
runningTest.scenarioDefinition = [];
|
||||||
|
runningTest.scenarioDefinition.push(scenario);
|
||||||
|
let validator = runningTest.isValid();
|
||||||
|
if (!validator.isValid) {
|
||||||
|
this.$warning(this.$t(validator.info));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let jmx = runningTest.toJMX();
|
||||||
|
let blob = new Blob([jmx.xml], {type: "application/octet-stream"});
|
||||||
|
let file = new File([blob], jmx.name);
|
||||||
|
this.$fileUpload(url, file, null, this.test, response => {
|
||||||
|
this.debugReportId = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.init();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.test-container {
|
.test-container {
|
||||||
height: calc(100vh - 150px);
|
height: calc(100vh - 150px);
|
||||||
min-height: 600px;
|
min-height: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.test-name {
|
.test-name {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
margin-left: -20px;
|
margin-left: -20px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.test-project {
|
.test-project {
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.test-container .more {
|
.test-container .more {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -60,6 +60,7 @@ import MsContainer from "../../common/components/MsContainer";
|
||||||
import MsMainContainer from "../../common/components/MsMainContainer";
|
import MsMainContainer from "../../common/components/MsMainContainer";
|
||||||
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
|
import {checkoutTestManagerOrTestUser} from "../../../../common/js/utils";
|
||||||
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
|
import MsScheduleConfig from "../../common/components/MsScheduleConfig";
|
||||||
|
import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EditPerformanceTestPlan",
|
name: "EditPerformanceTestPlan",
|
||||||
|
@ -172,6 +173,8 @@ export default {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.$refs.advancedConfig.cancelAllEdit();
|
this.$refs.advancedConfig.cancelAllEdit();
|
||||||
this.$router.push({path: '/performance/test/all'})
|
this.$router.push({path: '/performance/test/all'})
|
||||||
|
// 发送广播,刷新 head 上的最新列表
|
||||||
|
PerformanceEvent.$emit(LIST_CHANGE);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
saveAndRun() {
|
saveAndRun() {
|
||||||
|
@ -187,6 +190,8 @@ export default {
|
||||||
this.result = this.$post(this.runPath, {id: this.testPlan.id, triggerMode: 'MANUAL'}, (response) => {
|
this.result = this.$post(this.runPath, {id: this.testPlan.id, triggerMode: 'MANUAL'}, (response) => {
|
||||||
let reportId = response.data;
|
let reportId = response.data;
|
||||||
this.$router.push({path: '/performance/report/view/' + reportId})
|
this.$router.push({path: '/performance/report/view/' + reportId})
|
||||||
|
// 发送广播,刷新 head 上的最新列表
|
||||||
|
PerformanceEvent.$emit(LIST_CHANGE);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
<el-table-column prop="description" :label="$t('commons.description')"/>
|
<el-table-column prop="description" :label="$t('commons.description')"/>
|
||||||
<el-table-column :label="$t('commons.member')">
|
<el-table-column :label="$t('commons.member')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-button type="text" class="member-size" @click="cellClick(scope.row)">{{scope.row.memberSize}}
|
<el-link type="primary" class="member-size" @click="cellClick(scope.row)">
|
||||||
</el-button>
|
{{ scope.row.memberSize }}
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')">
|
<el-table-column :label="$t('commons.operating')">
|
||||||
|
@ -27,7 +28,8 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!-- dialog of organization member -->
|
<!-- dialog of organization member -->
|
||||||
<el-dialog :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc" class="dialog-css">
|
<el-dialog :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc"
|
||||||
|
class="dialog-css">
|
||||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
||||||
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
||||||
<!-- organization member table -->
|
<!-- organization member table -->
|
||||||
|
@ -43,7 +45,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')">
|
<el-table-column :label="$t('commons.operating')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)" @deleteClick="delMember(scope.row)"/>
|
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)"
|
||||||
|
@deleteClick="delMember(scope.row)"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -146,7 +149,8 @@
|
||||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||||
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
|
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.role')" prop="roleIds" :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
<el-form-item :label="$t('commons.role')" prop="roleIds"
|
||||||
|
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||||
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
|
<el-select v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
|
||||||
class="select-width">
|
class="select-width">
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -171,333 +175,331 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsCreateBox from "../CreateBox";
|
import MsCreateBox from "../CreateBox";
|
||||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||||
import MsRolesTag from "../../common/components/MsRolesTag";
|
import MsRolesTag from "../../common/components/MsRolesTag";
|
||||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {
|
import {
|
||||||
getCurrentOrganizationId,
|
getCurrentOrganizationId,
|
||||||
getCurrentUser, listenGoBack,
|
getCurrentUser,
|
||||||
refreshSessionAndCookies,
|
listenGoBack,
|
||||||
removeGoBackListener
|
refreshSessionAndCookies,
|
||||||
} from "../../../../common/js/utils";
|
removeGoBackListener
|
||||||
import {DEFAULT, ORGANIZATION} from "../../../../common/js/constants";
|
} from "@/common/js/utils";
|
||||||
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
import {DEFAULT, ORGANIZATION} from "@/common/js/constants";
|
||||||
|
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsOrganization",
|
name: "MsOrganization",
|
||||||
components: {
|
components: {
|
||||||
MsDeleteConfirm,
|
MsDeleteConfirm,
|
||||||
MsCreateBox,
|
MsCreateBox,
|
||||||
MsTablePagination,
|
MsTablePagination,
|
||||||
MsTableHeader,
|
MsTableHeader,
|
||||||
MsRolesTag,
|
MsRolesTag,
|
||||||
MsTableOperator,
|
MsTableOperator,
|
||||||
MsDialogFooter,
|
MsDialogFooter,
|
||||||
MsTableOperatorButton
|
MsTableOperatorButton
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
queryPath: '/organization/list',
|
queryPath: '/organization/list',
|
||||||
deletePath: '/organization/delete/',
|
deletePath: '/organization/delete/',
|
||||||
createPath: '/organization/add',
|
createPath: '/organization/add',
|
||||||
updatePath: '/organization/update',
|
updatePath: '/organization/update',
|
||||||
result: {},
|
result: {},
|
||||||
dialogOrgAddVisible: false,
|
dialogOrgAddVisible: false,
|
||||||
dialogOrgUpdateVisible: false,
|
dialogOrgUpdateVisible: false,
|
||||||
dialogOrgMemberVisible: false,
|
dialogOrgMemberVisible: false,
|
||||||
dialogOrgMemberAddVisible: false,
|
dialogOrgMemberAddVisible: false,
|
||||||
dialogOrgMemberUpdateVisible: false,
|
dialogOrgMemberUpdateVisible: false,
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
total: 0,
|
total: 0,
|
||||||
dialogCurrentPage: 1,
|
dialogCurrentPage: 1,
|
||||||
dialogPageSize: 5,
|
dialogPageSize: 5,
|
||||||
dialogTotal: 0,
|
dialogTotal: 0,
|
||||||
currentRow: {},
|
currentRow: {},
|
||||||
condition: {},
|
condition: {},
|
||||||
dialogCondition: {},
|
dialogCondition: {},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
memberLineData: [],
|
memberLineData: [],
|
||||||
form: {},
|
form: {},
|
||||||
memberForm: {},
|
memberForm: {},
|
||||||
rule: {
|
rule: {
|
||||||
name: [
|
name: [
|
||||||
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
|
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
|
||||||
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'},
|
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'},
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||||
message: this.$t('organization.special_characters_are_not_supported'),
|
message: this.$t('organization.special_characters_are_not_supported'),
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
description: [
|
description: [
|
||||||
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
|
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
orgMemberRule: {
|
orgMemberRule: {
|
||||||
userIds: [
|
userIds: [
|
||||||
{required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
|
{required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
|
||||||
],
|
],
|
||||||
roleIds: [
|
roleIds: [
|
||||||
{required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
|
{required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
activated() {
|
||||||
|
this.initTableData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
create() {
|
||||||
|
this.dialogOrgAddVisible = true;
|
||||||
|
listenGoBack(this.closeFunc);
|
||||||
},
|
},
|
||||||
activated() {
|
addMember() {
|
||||||
this.initTableData();
|
this.dialogOrgMemberAddVisible = true;
|
||||||
|
this.memberForm = {};
|
||||||
|
this.result = this.$get('/user/list/', response => {
|
||||||
|
this.$set(this.memberForm, "userList", response.data);
|
||||||
|
});
|
||||||
|
this.result = this.$get('/role/list/org', response => {
|
||||||
|
this.$set(this.memberForm, "roles", response.data);
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
edit(row) {
|
||||||
create() {
|
this.dialogOrgUpdateVisible = true;
|
||||||
this.dialogOrgAddVisible = true;
|
this.form = Object.assign({}, row);
|
||||||
listenGoBack(this.closeFunc);
|
listenGoBack(this.closeFunc);
|
||||||
},
|
},
|
||||||
addMember() {
|
editMember(row) {
|
||||||
this.dialogOrgMemberAddVisible = true;
|
this.dialogOrgMemberUpdateVisible = true;
|
||||||
this.memberForm = {};
|
this.memberForm = Object.assign({}, row);
|
||||||
this.result = this.$get('/user/list/', response => {
|
let roleIds = this.memberForm.roles.map(r => r.id);
|
||||||
this.$set(this.memberForm, "userList", response.data);
|
this.result = this.$get('/role/list/org', response => {
|
||||||
});
|
this.$set(this.memberForm, "allroles", response.data);
|
||||||
this.result = this.$get('/role/list/org', response => {
|
})
|
||||||
this.$set(this.memberForm, "roles", response.data);
|
// 编辑时填充角色信息
|
||||||
})
|
this.$set(this.memberForm, 'roleIds', roleIds);
|
||||||
},
|
listenGoBack(this.closeFunc);
|
||||||
edit(row) {
|
},
|
||||||
this.dialogOrgUpdateVisible = true;
|
cellClick(row) {
|
||||||
this.form = Object.assign({}, row);
|
// 保存当前点击的组织信息到currentRow
|
||||||
listenGoBack(this.closeFunc);
|
this.currentRow = row;
|
||||||
},
|
this.dialogOrgMemberVisible = true;
|
||||||
editMember(row) {
|
let param = {
|
||||||
this.dialogOrgMemberUpdateVisible = true;
|
name: '',
|
||||||
this.memberForm = Object.assign({}, row);
|
organizationId: row.id
|
||||||
let roleIds = this.memberForm.roles.map(r => r.id);
|
};
|
||||||
this.result = this.$get('/role/list/org', response => {
|
let path = "/user/special/org/member/list";
|
||||||
this.$set(this.memberForm, "allroles", response.data);
|
this.result = this.$post(path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize, param, res => {
|
||||||
})
|
let data = res.data;
|
||||||
// 编辑时填充角色信息
|
this.memberLineData = data.listObject;
|
||||||
this.$set(this.memberForm, 'roleIds', roleIds);
|
let url = "/userrole/list/org/" + row.id;
|
||||||
listenGoBack(this.closeFunc);
|
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||||
},
|
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||||
cellClick(row) {
|
let roles = response.data;
|
||||||
// 保存当前点击的组织信息到currentRow
|
this.$set(this.memberLineData[i], "roles", roles);
|
||||||
this.currentRow = row;
|
})
|
||||||
this.dialogOrgMemberVisible = true;
|
}
|
||||||
let param = {
|
this.dialogTotal = data.itemCount;
|
||||||
name: '',
|
});
|
||||||
organizationId: row.id
|
listenGoBack(this.closeFunc);
|
||||||
};
|
},
|
||||||
let path = "/user/special/org/member/list";
|
dialogSearch() {
|
||||||
this.result = this.$post(path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize, param, res => {
|
let row = this.currentRow;
|
||||||
let data = res.data;
|
this.dialogOrgMemberVisible = true;
|
||||||
this.memberLineData = data.listObject;
|
let param = this.dialogCondition;
|
||||||
let url = "/userrole/list/org/" + row.id;
|
this.$set(param, 'organizationId', row.id);
|
||||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
let path = "/user/special/org/member/list";
|
||||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
this.result = this.$post(path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize, param, res => {
|
||||||
let roles = response.data;
|
let data = res.data;
|
||||||
this.$set(this.memberLineData[i], "roles", roles);
|
this.memberLineData = data.listObject;
|
||||||
})
|
let url = "/userrole/list/org/" + row.id;
|
||||||
|
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||||
|
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||||
|
let roles = response.data;
|
||||||
|
this.$set(this.memberLineData[i], "roles", roles);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.dialogTotal = data.itemCount;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(organization) {
|
||||||
|
this.$refs.deleteConfirm.open(organization);
|
||||||
|
},
|
||||||
|
_handleDelete(organization) {
|
||||||
|
this.$confirm(this.$t('organization.delete_confirm'), '', {
|
||||||
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.result = this.$get(this.deletePath + organization.id, () => {
|
||||||
|
let lastOrganizationId = getCurrentOrganizationId();
|
||||||
|
let sourceId = organization.id;
|
||||||
|
if (lastOrganizationId === sourceId) {
|
||||||
|
refreshSessionAndCookies(DEFAULT, sourceId);
|
||||||
}
|
}
|
||||||
this.dialogTotal = data.itemCount;
|
this.$success(this.$t('commons.delete_success'));
|
||||||
|
this.initTableData();
|
||||||
});
|
});
|
||||||
listenGoBack(this.closeFunc);
|
}).catch(() => {
|
||||||
},
|
this.$message({
|
||||||
dialogSearch() {
|
type: 'info',
|
||||||
let row = this.currentRow;
|
message: this.$t('commons.delete_cancelled')
|
||||||
this.dialogOrgMemberVisible = true;
|
});
|
||||||
let param = this.dialogCondition;
|
});
|
||||||
this.$set(param, 'organizationId', row.id);
|
},
|
||||||
let path = "/user/special/org/member/list";
|
delMember(row) {
|
||||||
this.result = this.$post(path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize, param, res => {
|
this.$confirm(this.$t('member.remove_member'), '', {
|
||||||
let data = res.data;
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
this.memberLineData = data.listObject;
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
let url = "/userrole/list/org/" + row.id;
|
type: 'warning'
|
||||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
}).then(() => {
|
||||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + encodeURIComponent(row.id), () => {
|
||||||
let roles = response.data;
|
let sourceId = this.currentRow.id;
|
||||||
this.$set(this.memberLineData[i], "roles", roles);
|
let currentUser = getCurrentUser();
|
||||||
})
|
let userId = row.id;
|
||||||
|
if (currentUser.id === userId) {
|
||||||
|
refreshSessionAndCookies(ORGANIZATION, sourceId);
|
||||||
}
|
}
|
||||||
this.dialogTotal = data.itemCount;
|
this.$success(this.$t('commons.remove_success'))
|
||||||
|
this.cellClick(this.currentRow);
|
||||||
});
|
});
|
||||||
},
|
}).catch(() => {
|
||||||
handleDelete(organization) {
|
this.$info(this.$t('commons.remove_cancel'));
|
||||||
this.$refs.deleteConfirm.open(organization);
|
});
|
||||||
},
|
},
|
||||||
_handleDelete(organization) {
|
createOrganization(createOrganizationForm) {
|
||||||
this.$confirm(this.$t('organization.delete_confirm'), '', {
|
this.$refs[createOrganizationForm].validate(valid => {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
if (valid) {
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
this.result = this.$post(this.createPath, this.form, () => {
|
||||||
type: 'warning'
|
this.$success(this.$t('commons.save_success'));
|
||||||
}).then(() => {
|
this.initTableData();
|
||||||
this.result = this.$get(this.deletePath + organization.id, () => {
|
this.dialogOrgAddVisible = false;
|
||||||
let lastOrganizationId = getCurrentOrganizationId();
|
});
|
||||||
let sourceId = organization.id;
|
} else {
|
||||||
if (lastOrganizationId === sourceId) {
|
return false;
|
||||||
let sign = DEFAULT;
|
}
|
||||||
refreshSessionAndCookies(sign, sourceId);
|
})
|
||||||
}
|
},
|
||||||
this.$success(this.$t('commons.delete_success'));
|
updateOrganization(updateOrganizationForm) {
|
||||||
|
this.$refs[updateOrganizationForm].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.result = this.$post(this.updatePath, this.form, () => {
|
||||||
|
this.$success(this.$t('commons.modify_success'));
|
||||||
|
this.dialogOrgUpdateVisible = false;
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
} else {
|
||||||
this.$message({
|
return false;
|
||||||
type: 'info',
|
}
|
||||||
message: this.$t('commons.delete_cancelled')
|
})
|
||||||
});
|
},
|
||||||
});
|
initTableData() {
|
||||||
},
|
this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||||
delMember(row) {
|
let data = response.data;
|
||||||
this.$confirm(this.$t('member.remove_member'), '', {
|
this.tableData = data.listObject;
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
for (let i = 0; i < this.tableData.length; i++) {
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
let param = {
|
||||||
type: 'warning'
|
name: '',
|
||||||
}).then(() => {
|
organizationId: this.tableData[i].id
|
||||||
this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + encodeURIComponent(row.id), () => {
|
}
|
||||||
|
let path = "user/special/org/member/list/all";
|
||||||
|
this.$post(path, param, res => {
|
||||||
|
let member = res.data;
|
||||||
|
this.$set(this.tableData[i], "memberSize", member.length);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.total = data.itemCount;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
closeFunc() {
|
||||||
|
this.memberLineData = [];
|
||||||
|
this.initTableData();
|
||||||
|
this.form = {};
|
||||||
|
removeGoBackListener(this.closeFunc);
|
||||||
|
this.dialogOrgAddVisible = false;
|
||||||
|
this.dialogOrgUpdateVisible = false;
|
||||||
|
this.dialogOrgMemberVisible = false;
|
||||||
|
this.dialogOrgMemberAddVisible = false;
|
||||||
|
this.dialogOrgMemberUpdateVisible = false;
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.multipleSelection = val;
|
||||||
|
},
|
||||||
|
submitForm(formName) {
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let param = {
|
||||||
|
userIds: this.memberForm.userIds,
|
||||||
|
roleIds: this.memberForm.roleIds,
|
||||||
|
organizationId: this.currentRow.id
|
||||||
|
};
|
||||||
|
this.result = this.$post("user/special/org/member/add", param, () => {
|
||||||
|
let sign = "other";
|
||||||
let sourceId = this.currentRow.id;
|
let sourceId = this.currentRow.id;
|
||||||
let currentUser = getCurrentUser();
|
refreshSessionAndCookies(sign, sourceId);
|
||||||
let userId = row.id;
|
this.cellClick(this.currentRow);
|
||||||
if (currentUser.id === userId) {
|
this.dialogOrgMemberAddVisible = false;
|
||||||
let sign = ORGANIZATION;
|
})
|
||||||
refreshSessionAndCookies(sign, sourceId);
|
} else {
|
||||||
}
|
return false;
|
||||||
this.$success(this.$t('commons.remove_success'))
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateOrgMember(formName) {
|
||||||
|
let param = {
|
||||||
|
id: this.memberForm.id,
|
||||||
|
name: this.memberForm.name,
|
||||||
|
email: this.memberForm.email,
|
||||||
|
phone: this.memberForm.phone,
|
||||||
|
roleIds: this.memberForm.roleIds,
|
||||||
|
organizationId: this.currentRow.id
|
||||||
|
}
|
||||||
|
this.$refs[formName].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.result = this.$post("/organization/member/update", param, () => {
|
||||||
|
this.$success(this.$t('commons.modify_success'));
|
||||||
|
this.dialogOrgMemberUpdateVisible = false;
|
||||||
this.cellClick(this.currentRow);
|
this.cellClick(this.currentRow);
|
||||||
});
|
});
|
||||||
}).catch(() => {
|
|
||||||
this.$info(this.$t('commons.remove_cancel'));
|
|
||||||
});
|
|
||||||
},
|
|
||||||
createOrganization(createOrganizationForm) {
|
|
||||||
this.$refs[createOrganizationForm].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
this.result = this.$post(this.createPath, this.form, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.initTableData();
|
|
||||||
this.dialogOrgAddVisible = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
updateOrganization(updateOrganizationForm) {
|
|
||||||
this.$refs[updateOrganizationForm].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
this.result = this.$post(this.updatePath, this.form, () => {
|
|
||||||
this.$success(this.$t('commons.modify_success'));
|
|
||||||
this.dialogOrgUpdateVisible = false;
|
|
||||||
this.initTableData();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
initTableData() {
|
|
||||||
this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
|
||||||
let data = response.data;
|
|
||||||
this.tableData = data.listObject;
|
|
||||||
for (let i = 0; i < this.tableData.length; i++) {
|
|
||||||
let param = {
|
|
||||||
name: '',
|
|
||||||
organizationId: this.tableData[i].id
|
|
||||||
}
|
|
||||||
let path = "user/special/org/member/list/all";
|
|
||||||
this.$post(path, param, res => {
|
|
||||||
let member = res.data;
|
|
||||||
this.$set(this.tableData[i], "memberSize", member.length);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.total = data.itemCount;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
closeFunc() {
|
|
||||||
this.memberLineData = [];
|
|
||||||
this.initTableData();
|
|
||||||
this.form = {};
|
|
||||||
removeGoBackListener(this.closeFunc);
|
|
||||||
this.dialogOrgAddVisible = false;
|
|
||||||
this.dialogOrgUpdateVisible = false;
|
|
||||||
this.dialogOrgMemberVisible = false;
|
|
||||||
this.dialogOrgMemberAddVisible = false;
|
|
||||||
this.dialogOrgMemberUpdateVisible = false;
|
|
||||||
},
|
|
||||||
handleSelectionChange(val) {
|
|
||||||
this.multipleSelection = val;
|
|
||||||
},
|
|
||||||
submitForm(formName) {
|
|
||||||
this.$refs[formName].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let param = {
|
|
||||||
userIds: this.memberForm.userIds,
|
|
||||||
roleIds: this.memberForm.roleIds,
|
|
||||||
organizationId: this.currentRow.id
|
|
||||||
};
|
|
||||||
this.result = this.$post("user/special/org/member/add", param, () => {
|
|
||||||
let sign = "other";
|
|
||||||
let sourceId = this.currentRow.id;
|
|
||||||
refreshSessionAndCookies(sign, sourceId);
|
|
||||||
this.cellClick(this.currentRow);
|
|
||||||
this.dialogOrgMemberAddVisible = false;
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
updateOrgMember(formName) {
|
|
||||||
let param = {
|
|
||||||
id: this.memberForm.id,
|
|
||||||
name: this.memberForm.name,
|
|
||||||
email: this.memberForm.email,
|
|
||||||
phone: this.memberForm.phone,
|
|
||||||
roleIds: this.memberForm.roleIds,
|
|
||||||
organizationId: this.currentRow.id
|
|
||||||
}
|
}
|
||||||
this.$refs[formName].validate((valid) => {
|
});
|
||||||
if (valid) {
|
},
|
||||||
this.result = this.$post("/organization/member/update", param, () => {
|
|
||||||
this.$success(this.$t('commons.modify_success'));
|
|
||||||
this.dialogOrgMemberUpdateVisible = false;
|
|
||||||
this.cellClick(this.currentRow);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.member-size {
|
.member-size {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
cursor: pointer;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.org-member-id {
|
.org-member-id {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.org-member-email {
|
.org-member-email {
|
||||||
float: right;
|
float: right;
|
||||||
color: #8492a6;
|
color: #8492a6;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.select-width {
|
.select-width {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-css >>> .el-dialog__header {
|
.dialog-css >>> .el-dialog__header {
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
<el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/>
|
<el-table-column prop="organizationName" :label="$t('workspace.organization_name')"/>
|
||||||
<el-table-column :label="$t('commons.member')">
|
<el-table-column :label="$t('commons.member')">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-button type="text" class="member-size" @click="cellClick(scope.row)">
|
<el-link type="primary" class="member-size" @click="cellClick(scope.row)">
|
||||||
{{scope.row.memberSize}}
|
{{scope.row.memberSize}}
|
||||||
</el-button>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')">
|
<el-table-column :label="$t('commons.operating')">
|
||||||
|
@ -200,12 +200,11 @@
|
||||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||||
import {
|
import {
|
||||||
getCurrentOrganizationId,
|
|
||||||
getCurrentUser,
|
getCurrentUser,
|
||||||
getCurrentWorkspaceId, listenGoBack,
|
getCurrentWorkspaceId, listenGoBack,
|
||||||
refreshSessionAndCookies, removeGoBackListener
|
refreshSessionAndCookies, removeGoBackListener
|
||||||
} from "../../../../common/js/utils";
|
} from "@/common/js/utils";
|
||||||
import {DEFAULT, WORKSPACE} from "../../../../common/js/constants";
|
import {DEFAULT, WORKSPACE} from "@/common/js/constants";
|
||||||
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -537,7 +536,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-css >>> .el-dialog__header {
|
.dialog-css >>> .el-dialog__header {
|
||||||
padding: 0px;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-dialog @close="close"
|
<el-dialog @close="close"
|
||||||
:title="operationType == 'edit' ? ( readOnly ? $t('test_track.case.view_case') : $t('test_track.case.edit_case')) : $t('test_track.case.create')"
|
:title="operationType == 'edit' ? ( readOnly ? $t('test_track.case.view_case') : $t('test_track.case.edit_case')) : $t('test_track.case.create')"
|
||||||
:visible.sync="dialogFormVisible" width="65%">
|
:visible.sync="dialogFormVisible" width="65%">
|
||||||
|
|
||||||
<el-form :model="form" :rules="rules" ref="caseFrom" v-loading="result.loading">
|
<el-form :model="form" :rules="rules" ref="caseFrom" v-loading="result.loading">
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
<el-row v-if="form.method && form.method == 'auto'">
|
<el-row v-if="form.method && form.method == 'auto'">
|
||||||
<el-col :span="9" :offset="1">
|
<el-col :span="9" :offset="1">
|
||||||
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
|
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
|
||||||
<el-select filterable :disabled="readOnly" v-model="form.testId"
|
<el-select filterable :disabled="readOnly" v-model="form.testId"
|
||||||
:placeholder="$t('test_track.case.input_type')">
|
:placeholder="$t('test_track.case.input_type')">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in testOptions"
|
v-for="item in testOptions"
|
||||||
|
@ -105,12 +105,12 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="9" :offset="1" v-if="form.testId=='other'">
|
<el-col :span="9" :offset="1" v-if="form.testId=='other'">
|
||||||
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
|
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
|
||||||
<el-input v-model="form.otherTestName" :placeholder="$t('test_track.case.input_test_case')" ></el-input>
|
<el-input v-model="form.otherTestName" :placeholder="$t('test_track.case.input_test_case')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row style="margin-top: 15px;">
|
<el-row style="margin-top: 15px;">
|
||||||
<el-col :offset="2">{{$t('test_track.case.prerequisite')}}:</el-col>
|
<el-col :offset="2">{{ $t('test_track.case.prerequisite') }}:</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row type="flex" justify="center" style="margin-top: 10px;">
|
<el-row type="flex" justify="center" style="margin-top: 10px;">
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row v-if="form.method && form.method != 'auto'" style="margin-bottom: 10px">
|
<el-row v-if="form.method && form.method != 'auto'" style="margin-bottom: 10px">
|
||||||
<el-col :offset="2">{{$t('test_track.case.steps')}}:</el-col>
|
<el-col :offset="2">{{ $t('test_track.case.steps') }}:</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row v-if="form.method && form.method != 'auto'" type="flex" justify="center">
|
<el-row v-if="form.method && form.method != 'auto'" type="flex" justify="center">
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row style="margin-top: 15px;margin-bottom: 10px">
|
<el-row style="margin-top: 15px;margin-bottom: 10px">
|
||||||
<el-col :offset="2">{{$t('commons.remark')}}:</el-col>
|
<el-col :offset="2">{{ $t('commons.remark') }}:</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row type="flex" justify="center">
|
<el-row type="flex" justify="center">
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
|
@ -222,302 +222,305 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {WORKSPACE_ID, TokenKey} from '../../../../../common/js/constants';
|
import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants';
|
||||||
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||||
import {listenGoBack, removeGoBackListener, removeListenGoBack} from "../../../../../common/js/utils";
|
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
||||||
|
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestCaseEdit",
|
name: "TestCaseEdit",
|
||||||
components: {MsDialogFooter},
|
components: {MsDialogFooter},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
result: {},
|
result: {},
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
form: {
|
form: {
|
||||||
name: '',
|
name: '',
|
||||||
module: '',
|
module: '',
|
||||||
maintainer: '',
|
maintainer: '',
|
||||||
priority: '',
|
priority: '',
|
||||||
type: '',
|
type: '',
|
||||||
method: '',
|
method: '',
|
||||||
prerequisite: '',
|
prerequisite: '',
|
||||||
testId: '',
|
testId: '',
|
||||||
otherTestName:'',
|
otherTestName: '',
|
||||||
steps: [{
|
steps: [{
|
||||||
|
num: 1,
|
||||||
|
desc: '',
|
||||||
|
result: ''
|
||||||
|
}],
|
||||||
|
remark: '',
|
||||||
|
},
|
||||||
|
moduleOptions: [],
|
||||||
|
maintainerOptions: [],
|
||||||
|
methodOptions: [],
|
||||||
|
testOptions: [],
|
||||||
|
workspaceId: '',
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
|
||||||
|
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
module: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
|
||||||
|
maintainer: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
||||||
|
priority: [{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
|
||||||
|
type: [{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}],
|
||||||
|
testId: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
||||||
|
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
||||||
|
prerequisite: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}],
|
||||||
|
remark: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}]
|
||||||
|
},
|
||||||
|
formLabelWidth: "120px",
|
||||||
|
operationType: '',
|
||||||
|
isCreateContinue: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
treeNodes: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
readOnly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
selectNode: {
|
||||||
|
type: Object
|
||||||
|
},
|
||||||
|
currentProject: {
|
||||||
|
type: Object
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.getSelectOptions();
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
treeNodes() {
|
||||||
|
this.getModuleOptions();
|
||||||
|
},
|
||||||
|
currentProject() {
|
||||||
|
this.getTestOptions();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(testCase) {
|
||||||
|
this.resetForm();
|
||||||
|
|
||||||
|
if (window.history && window.history.pushState) {
|
||||||
|
history.pushState(null, null, document.URL);
|
||||||
|
window.addEventListener('popstate', this.close);
|
||||||
|
}
|
||||||
|
listenGoBack(this.close);
|
||||||
|
this.operationType = 'add';
|
||||||
|
if (testCase) {
|
||||||
|
//修改
|
||||||
|
this.operationType = 'edit';
|
||||||
|
//复制
|
||||||
|
if (testCase.name === '') {
|
||||||
|
this.operationType = 'add';
|
||||||
|
}
|
||||||
|
let tmp = {};
|
||||||
|
Object.assign(tmp, testCase);
|
||||||
|
tmp.steps = JSON.parse(testCase.steps);
|
||||||
|
Object.assign(this.form, tmp);
|
||||||
|
this.form.module = testCase.nodeId;
|
||||||
|
} else {
|
||||||
|
if (this.selectNode.data) {
|
||||||
|
this.form.module = this.selectNode.data.id;
|
||||||
|
} else {
|
||||||
|
if (this.moduleOptions.length > 0) {
|
||||||
|
this.form.module = this.moduleOptions[0].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let user = JSON.parse(localStorage.getItem(TokenKey));
|
||||||
|
this.form.priority = 'P3';
|
||||||
|
this.form.type = 'functional';
|
||||||
|
this.form.method = 'manual';
|
||||||
|
this.form.maintainer = user.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getSelectOptions();
|
||||||
|
this.dialogFormVisible = true;
|
||||||
|
},
|
||||||
|
handleAddStep(index, data) {
|
||||||
|
let step = {};
|
||||||
|
step.num = data.num + 1;
|
||||||
|
step.desc = null;
|
||||||
|
step.result = null;
|
||||||
|
this.form.steps.forEach(step => {
|
||||||
|
if (step.num > data.num) {
|
||||||
|
step.num++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.form.steps.splice(index + 1, 0, step);
|
||||||
|
},
|
||||||
|
handleDeleteStep(index, data) {
|
||||||
|
this.form.steps.splice(index, 1);
|
||||||
|
this.form.steps.forEach(step => {
|
||||||
|
if (step.num > data.num) {
|
||||||
|
step.num--;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
//移除监听,防止监听其他页面
|
||||||
|
removeGoBackListener(this.close);
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
},
|
||||||
|
saveCase() {
|
||||||
|
this.$refs['caseFrom'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let param = this.buildParam();
|
||||||
|
if (this.validate(param)) {
|
||||||
|
this.result = this.$post('/test/case/' + this.operationType, param, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
if (this.operationType == 'add' && this.isCreateContinue) {
|
||||||
|
this.form.name = '';
|
||||||
|
this.form.prerequisite = '';
|
||||||
|
this.form.steps = [{
|
||||||
|
num: 1,
|
||||||
|
desc: '',
|
||||||
|
result: ''
|
||||||
|
}];
|
||||||
|
this.form.remark = '';
|
||||||
|
this.$emit("refresh");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
this.$emit("refresh");
|
||||||
|
// 发送广播,刷新 head 上的最新列表
|
||||||
|
TrackEvent.$emit(LIST_CHANGE);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buildParam() {
|
||||||
|
let param = {};
|
||||||
|
Object.assign(param, this.form);
|
||||||
|
param.steps = JSON.stringify(this.form.steps);
|
||||||
|
param.nodeId = this.form.module;
|
||||||
|
this.moduleOptions.forEach(item => {
|
||||||
|
if (this.form.module === item.id) {
|
||||||
|
param.nodePath = item.path;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (this.currentProject) {
|
||||||
|
param.projectId = this.currentProject.id;
|
||||||
|
}
|
||||||
|
param.name = param.name.trim();
|
||||||
|
if (param.method != 'auto') {
|
||||||
|
param.testId = null;
|
||||||
|
}
|
||||||
|
return param;
|
||||||
|
},
|
||||||
|
validate(param) {
|
||||||
|
for (let i = 0; i < param.steps.length; i++) {
|
||||||
|
if ((param.steps[i].desc && param.steps[i].desc.length > 300) ||
|
||||||
|
(param.steps[i].result && param.steps[i].result.length > 300)) {
|
||||||
|
this.$warning(this.$t('test_track.case.step_desc') + ","
|
||||||
|
+ this.$t('test_track.case.expected_results') + this.$t('test_track.length_less_than') + '300');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (param.name == '') {
|
||||||
|
this.$warning(this.$t('test_track.case.input_name'));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
typeChange() {
|
||||||
|
this.form.testId = '';
|
||||||
|
this.getMethodOptions();
|
||||||
|
this.getTestOptions()
|
||||||
|
},
|
||||||
|
getModuleOptions() {
|
||||||
|
let moduleOptions = [];
|
||||||
|
this.treeNodes.forEach(node => {
|
||||||
|
this.buildNodePath(node, {path: ''}, moduleOptions);
|
||||||
|
});
|
||||||
|
this.moduleOptions = moduleOptions;
|
||||||
|
},
|
||||||
|
getMaintainerOptions() {
|
||||||
|
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||||
|
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||||
|
this.maintainerOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getTestOptions() {
|
||||||
|
this.testOptions = [];
|
||||||
|
if (this.currentProject && this.form.type != '' && this.form.type != 'functional') {
|
||||||
|
this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
|
||||||
|
this.testOptions = response.data;
|
||||||
|
this.testOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getMethodOptions() {
|
||||||
|
if (!this.form.type || this.form.type != 'functional') {
|
||||||
|
this.methodOptions = [
|
||||||
|
{value: 'auto', label: this.$t('test_track.case.auto')},
|
||||||
|
{value: 'manual', label: this.$t('test_track.case.manual')}
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
this.form.method = 'manual';
|
||||||
|
this.methodOptions = [{value: 'manual', label: this.$t('test_track.case.manual')}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getSelectOptions() {
|
||||||
|
this.getModuleOptions();
|
||||||
|
this.getMaintainerOptions();
|
||||||
|
this.getTestOptions();
|
||||||
|
this.getMethodOptions();
|
||||||
|
},
|
||||||
|
buildNodePath(node, option, moduleOptions) {
|
||||||
|
//递归构建节点路径
|
||||||
|
option.id = node.id;
|
||||||
|
option.path = option.path + '/' + node.name;
|
||||||
|
moduleOptions.push(option);
|
||||||
|
if (node.children) {
|
||||||
|
for (let i = 0; i < node.children.length; i++) {
|
||||||
|
this.buildNodePath(node.children[i], {path: option.path}, moduleOptions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
//防止点击修改后,点击新建触发校验
|
||||||
|
if (this.$refs['caseFrom']) {
|
||||||
|
this.$refs['caseFrom'].validate((valid) => {
|
||||||
|
this.$refs['caseFrom'].resetFields();
|
||||||
|
this.form.name = '';
|
||||||
|
this.form.module = '';
|
||||||
|
this.form.type = '';
|
||||||
|
this.form.method = '';
|
||||||
|
this.form.maintainer = '';
|
||||||
|
this.form.priority = '';
|
||||||
|
this.form.prerequisite = '';
|
||||||
|
this.form.remark = '';
|
||||||
|
this.form.testId = '';
|
||||||
|
this.form.testName = '';
|
||||||
|
this.form.steps = [{
|
||||||
num: 1,
|
num: 1,
|
||||||
desc: '',
|
desc: '',
|
||||||
result: ''
|
result: ''
|
||||||
}],
|
}];
|
||||||
remark: '',
|
return true;
|
||||||
},
|
|
||||||
moduleOptions: [],
|
|
||||||
maintainerOptions: [],
|
|
||||||
methodOptions: [],
|
|
||||||
testOptions: [],
|
|
||||||
workspaceId: '',
|
|
||||||
rules: {
|
|
||||||
name: [
|
|
||||||
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
|
|
||||||
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
|
|
||||||
],
|
|
||||||
module: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}],
|
|
||||||
maintainer: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}],
|
|
||||||
priority: [{required: true, message: this.$t('test_track.case.input_priority'), trigger: 'change'}],
|
|
||||||
type: [{required: true, message: this.$t('test_track.case.input_type'), trigger: 'change'}],
|
|
||||||
testId: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}],
|
|
||||||
method: [{required: true, message: this.$t('test_track.case.input_method'), trigger: 'change'}],
|
|
||||||
prerequisite: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}],
|
|
||||||
remark: [{max: 300, message: this.$t('test_track.length_less_than') + '300', trigger: 'blur'}]
|
|
||||||
},
|
|
||||||
formLabelWidth: "120px",
|
|
||||||
operationType: '',
|
|
||||||
isCreateContinue: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
treeNodes: {
|
|
||||||
type: Array
|
|
||||||
},
|
|
||||||
readOnly: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
},
|
|
||||||
selectNode: {
|
|
||||||
type: Object
|
|
||||||
},
|
|
||||||
currentProject: {
|
|
||||||
type: Object
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.getSelectOptions();
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
treeNodes() {
|
|
||||||
this.getModuleOptions();
|
|
||||||
},
|
|
||||||
currentProject() {
|
|
||||||
this.getTestOptions();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
open(testCase) {
|
|
||||||
this.resetForm();
|
|
||||||
|
|
||||||
if (window.history && window.history.pushState) {
|
|
||||||
history.pushState(null, null, document.URL);
|
|
||||||
window.addEventListener('popstate', this.close);
|
|
||||||
}
|
|
||||||
listenGoBack(this.close);
|
|
||||||
this.operationType = 'add';
|
|
||||||
if (testCase) {
|
|
||||||
//修改
|
|
||||||
this.operationType = 'edit';
|
|
||||||
//复制
|
|
||||||
if (testCase.name === '') {
|
|
||||||
this.operationType = 'add';
|
|
||||||
}
|
|
||||||
let tmp = {};
|
|
||||||
Object.assign(tmp, testCase);
|
|
||||||
tmp.steps = JSON.parse(testCase.steps);
|
|
||||||
Object.assign(this.form, tmp);
|
|
||||||
this.form.module = testCase.nodeId;
|
|
||||||
} else {
|
|
||||||
if (this.selectNode.data) {
|
|
||||||
this.form.module = this.selectNode.data.id;
|
|
||||||
} else {
|
|
||||||
if (this.moduleOptions.length > 0) {
|
|
||||||
this.form.module = this.moduleOptions[0].id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let user = JSON.parse(localStorage.getItem(TokenKey));
|
|
||||||
this.form.priority = 'P3';
|
|
||||||
this.form.type = 'functional';
|
|
||||||
this.form.method = 'manual';
|
|
||||||
this.form.maintainer = user.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.getSelectOptions();
|
|
||||||
this.dialogFormVisible = true;
|
|
||||||
},
|
|
||||||
handleAddStep(index, data) {
|
|
||||||
let step = {};
|
|
||||||
step.num = data.num + 1;
|
|
||||||
step.desc = null;
|
|
||||||
step.result = null;
|
|
||||||
this.form.steps.forEach(step => {
|
|
||||||
if (step.num > data.num) {
|
|
||||||
step.num++;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.form.steps.splice(index + 1, 0, step);
|
|
||||||
},
|
|
||||||
handleDeleteStep(index, data) {
|
|
||||||
this.form.steps.splice(index, 1);
|
|
||||||
this.form.steps.forEach(step => {
|
|
||||||
if (step.num > data.num) {
|
|
||||||
step.num--;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
//移除监听,防止监听其他页面
|
|
||||||
removeGoBackListener(this.close);
|
|
||||||
this.dialogFormVisible = false;
|
|
||||||
},
|
|
||||||
saveCase() {
|
|
||||||
this.$refs['caseFrom'].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
let param = this.buildParam();
|
|
||||||
if (this.validate(param)) {
|
|
||||||
this.result = this.$post('/test/case/' + this.operationType, param, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
if (this.operationType == 'add' && this.isCreateContinue) {
|
|
||||||
this.form.name = '';
|
|
||||||
this.form.prerequisite = '';
|
|
||||||
this.form.steps = [{
|
|
||||||
num: 1,
|
|
||||||
desc: '',
|
|
||||||
result: ''
|
|
||||||
}];
|
|
||||||
this.form.remark = '';
|
|
||||||
this.$emit("refresh");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.dialogFormVisible = false;
|
|
||||||
this.$emit("refresh");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buildParam() {
|
|
||||||
let param = {};
|
|
||||||
Object.assign(param, this.form);
|
|
||||||
param.steps = JSON.stringify(this.form.steps);
|
|
||||||
param.nodeId = this.form.module;
|
|
||||||
this.moduleOptions.forEach(item => {
|
|
||||||
if (this.form.module === item.id) {
|
|
||||||
param.nodePath = item.path;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (this.currentProject) {
|
|
||||||
param.projectId = this.currentProject.id;
|
|
||||||
}
|
|
||||||
param.name = param.name.trim();
|
|
||||||
if (param.method != 'auto') {
|
|
||||||
param.testId = null;
|
|
||||||
}
|
|
||||||
return param;
|
|
||||||
},
|
|
||||||
validate(param) {
|
|
||||||
for (let i = 0; i < param.steps.length; i++) {
|
|
||||||
if ((param.steps[i].desc && param.steps[i].desc.length > 300) ||
|
|
||||||
(param.steps[i].result && param.steps[i].result.length > 300)) {
|
|
||||||
this.$warning(this.$t('test_track.case.step_desc') + ","
|
|
||||||
+ this.$t('test_track.case.expected_results') + this.$t('test_track.length_less_than') + '300');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (param.name == '') {
|
|
||||||
this.$warning(this.$t('test_track.case.input_name'));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
typeChange() {
|
|
||||||
this.form.testId = '';
|
|
||||||
this.getMethodOptions();
|
|
||||||
this.getTestOptions()
|
|
||||||
},
|
|
||||||
getModuleOptions() {
|
|
||||||
let moduleOptions = [];
|
|
||||||
this.treeNodes.forEach(node => {
|
|
||||||
this.buildNodePath(node, {path: ''}, moduleOptions);
|
|
||||||
});
|
|
||||||
this.moduleOptions = moduleOptions;
|
|
||||||
},
|
|
||||||
getMaintainerOptions() {
|
|
||||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
|
||||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
|
||||||
this.maintainerOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getTestOptions() {
|
|
||||||
this.testOptions = [];
|
|
||||||
if (this.currentProject && this.form.type != '' && this.form.type != 'functional') {
|
|
||||||
this.result = this.$get('/' + this.form.type + '/list/' + this.currentProject.id, response => {
|
|
||||||
this.testOptions = response.data;
|
|
||||||
this.testOptions.unshift({id:'other',name:this.$t('test_track.case.other')})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getMethodOptions() {
|
|
||||||
if (!this.form.type || this.form.type != 'functional') {
|
|
||||||
this.methodOptions = [
|
|
||||||
{value: 'auto', label: this.$t('test_track.case.auto')},
|
|
||||||
{value: 'manual', label: this.$t('test_track.case.manual')}
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
this.form.method = 'manual';
|
|
||||||
this.methodOptions = [{value: 'manual', label: this.$t('test_track.case.manual')}]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getSelectOptions() {
|
|
||||||
this.getModuleOptions();
|
|
||||||
this.getMaintainerOptions();
|
|
||||||
this.getTestOptions();
|
|
||||||
this.getMethodOptions();
|
|
||||||
},
|
|
||||||
buildNodePath(node, option, moduleOptions) {
|
|
||||||
//递归构建节点路径
|
|
||||||
option.id = node.id;
|
|
||||||
option.path = option.path + '/' + node.name;
|
|
||||||
moduleOptions.push(option);
|
|
||||||
if (node.children) {
|
|
||||||
for (let i = 0; i < node.children.length; i++) {
|
|
||||||
this.buildNodePath(node.children[i], {path: option.path}, moduleOptions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
resetForm() {
|
|
||||||
//防止点击修改后,点击新建触发校验
|
|
||||||
if (this.$refs['caseFrom']) {
|
|
||||||
this.$refs['caseFrom'].validate((valid) => {
|
|
||||||
this.$refs['caseFrom'].resetFields();
|
|
||||||
this.form.name = '';
|
|
||||||
this.form.module = '';
|
|
||||||
this.form.type = '';
|
|
||||||
this.form.method = '';
|
|
||||||
this.form.maintainer = '';
|
|
||||||
this.form.priority = '';
|
|
||||||
this.form.prerequisite = '';
|
|
||||||
this.form.remark = '';
|
|
||||||
this.form.testId = '';
|
|
||||||
this.form.testName='';
|
|
||||||
this.form.steps = [{
|
|
||||||
num: 1,
|
|
||||||
desc: '',
|
|
||||||
result: ''
|
|
||||||
}];
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.el-switch {
|
.el-switch {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.case-name {
|
.case-name {
|
||||||
width: 194px;
|
width: 194px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -92,12 +92,12 @@
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<el-button
|
<el-button
|
||||||
@click="dialogFormVisible = false">
|
@click="dialogFormVisible = false">
|
||||||
{{$t('test_track.cancel')}}
|
{{ $t('test_track.cancel') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@click="savePlan">
|
@click="savePlan">
|
||||||
{{$t('test_track.confirm')}}
|
{{ $t('test_track.confirm') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -110,116 +110,119 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {WORKSPACE_ID} from '../../../../../common/js/constants';
|
import {WORKSPACE_ID} from '../../../../../common/js/constants';
|
||||||
import TestPlanStatusButton from "../common/TestPlanStatusButton";
|
import TestPlanStatusButton from "../common/TestPlanStatusButton";
|
||||||
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
|
||||||
|
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanEdit",
|
name: "TestPlanEdit",
|
||||||
components: {TestPlanStatusButton},
|
components: {TestPlanStatusButton},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
form: {
|
form: {
|
||||||
name: '',
|
name: '',
|
||||||
projectId: '',
|
projectId: '',
|
||||||
principal: '',
|
principal: '',
|
||||||
stage: '',
|
stage: '',
|
||||||
description: ''
|
description: ''
|
||||||
},
|
|
||||||
rules:{
|
|
||||||
name :[
|
|
||||||
{required: true, message: this.$t('test_track.plan.input_plan_name'), trigger: 'blur'},
|
|
||||||
{ max: 30, message: this.$t('test_track.length_less_than') + '30', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
projectId :[{required: true, message: this.$t('test_track.plan.input_plan_project'), trigger: 'change'}],
|
|
||||||
principal :[{required: true, message: this.$t('test_track.plan.input_plan_principal'), trigger: 'change'}],
|
|
||||||
stage :[{required: true, message: this.$t('test_track.plan.input_plan_stage'), trigger: 'change'}],
|
|
||||||
description :[{ max: 200, message: this.$t('test_track.length_less_than') + '200', trigger: 'blur'}]
|
|
||||||
},
|
|
||||||
formLabelWidth: "120px",
|
|
||||||
operationType: '',
|
|
||||||
projects: [],
|
|
||||||
principalOptions: []
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
methods: {
|
rules: {
|
||||||
openTestPlanEditDialog(testPlan) {
|
name: [
|
||||||
this.resetForm();
|
{required: true, message: this.$t('test_track.plan.input_plan_name'), trigger: 'blur'},
|
||||||
this.getProjects();
|
{max: 30, message: this.$t('test_track.length_less_than') + '30', trigger: 'blur'}
|
||||||
this.setPrincipalOptions();
|
],
|
||||||
this.operationType = 'add';
|
projectId: [{required: true, message: this.$t('test_track.plan.input_plan_project'), trigger: 'change'}],
|
||||||
if(testPlan){
|
principal: [{required: true, message: this.$t('test_track.plan.input_plan_principal'), trigger: 'change'}],
|
||||||
//修改
|
stage: [{required: true, message: this.$t('test_track.plan.input_plan_stage'), trigger: 'change'}],
|
||||||
this.operationType = 'edit';
|
description: [{max: 200, message: this.$t('test_track.length_less_than') + '200', trigger: 'blur'}]
|
||||||
let tmp = {};
|
},
|
||||||
Object.assign(tmp, testPlan);
|
formLabelWidth: "120px",
|
||||||
Object.assign(this.form, tmp);
|
operationType: '',
|
||||||
|
projects: [],
|
||||||
|
principalOptions: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openTestPlanEditDialog(testPlan) {
|
||||||
|
this.resetForm();
|
||||||
|
this.getProjects();
|
||||||
|
this.setPrincipalOptions();
|
||||||
|
this.operationType = 'add';
|
||||||
|
if (testPlan) {
|
||||||
|
//修改
|
||||||
|
this.operationType = 'edit';
|
||||||
|
let tmp = {};
|
||||||
|
Object.assign(tmp, testPlan);
|
||||||
|
Object.assign(this.form, tmp);
|
||||||
|
}
|
||||||
|
listenGoBack(this.close);
|
||||||
|
this.dialogFormVisible = true;
|
||||||
|
},
|
||||||
|
savePlan() {
|
||||||
|
this.$refs['planFrom'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
let param = {};
|
||||||
|
Object.assign(param, this.form);
|
||||||
|
param.name = param.name.trim();
|
||||||
|
if (param.name == '') {
|
||||||
|
this.$warning(this.$t('test_track.plan.input_plan_name'));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
listenGoBack(this.close);
|
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||||
this.dialogFormVisible = true;
|
this.$post('/test/plan/' + this.operationType, param, () => {
|
||||||
},
|
this.$success(this.$t('commons.save_success'));
|
||||||
savePlan(){
|
this.dialogFormVisible = false;
|
||||||
this.$refs['planFrom'].validate((valid) => {
|
this.$emit("refresh");
|
||||||
if (valid) {
|
// 发送广播,刷新 head 上的最新列表
|
||||||
let param = {};
|
TrackEvent.$emit(LIST_CHANGE);
|
||||||
Object.assign(param, this.form);
|
|
||||||
param.name = param.name.trim();
|
|
||||||
if (param.name == '') {
|
|
||||||
this.$warning(this.$t('test_track.plan.input_plan_name'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
|
|
||||||
this.$post('/test/plan/' + this.operationType, param, () => {
|
|
||||||
this.$success(this.$t('commons.save_success'));
|
|
||||||
this.dialogFormVisible = false;
|
|
||||||
this.$emit("refresh");
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
} else {
|
||||||
getProjects() {
|
return false;
|
||||||
this.$get("/project/listAll", (response) => {
|
|
||||||
if (response.success) {
|
|
||||||
this.projects = response.data;
|
|
||||||
} else {
|
|
||||||
this.$warning()(response.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
setPrincipalOptions() {
|
|
||||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
|
||||||
this.$post('/user/ws/member/tester/list', {workspaceId:workspaceId}, response => {
|
|
||||||
this.principalOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
statusChange(status) {
|
|
||||||
this.form.status = status;
|
|
||||||
this.$forceUpdate();
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
removeGoBackListener(this.close);
|
|
||||||
this.dialogFormVisible = false;
|
|
||||||
},
|
|
||||||
resetForm() {
|
|
||||||
//防止点击修改后,点击新建触发校验
|
|
||||||
if (this.$refs['planFrom']) {
|
|
||||||
this.$refs['planFrom'].validate((valid) => {
|
|
||||||
this.$refs['planFrom'].resetFields();
|
|
||||||
this.form.name = '';
|
|
||||||
this.form.projectId = '';
|
|
||||||
this.form.principal = '';
|
|
||||||
this.form.stage = '';
|
|
||||||
this.form.description = '';
|
|
||||||
this.form.status = null;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getProjects() {
|
||||||
|
this.$get("/project/listAll", (response) => {
|
||||||
|
if (response.success) {
|
||||||
|
this.projects = response.data;
|
||||||
|
} else {
|
||||||
|
this.$warning()(response.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setPrincipalOptions() {
|
||||||
|
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||||
|
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||||
|
this.principalOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
statusChange(status) {
|
||||||
|
this.form.status = status;
|
||||||
|
this.$forceUpdate();
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
removeGoBackListener(this.close);
|
||||||
|
this.dialogFormVisible = false;
|
||||||
|
},
|
||||||
|
resetForm() {
|
||||||
|
//防止点击修改后,点击新建触发校验
|
||||||
|
if (this.$refs['planFrom']) {
|
||||||
|
this.$refs['planFrom'].validate((valid) => {
|
||||||
|
this.$refs['planFrom'].resetFields();
|
||||||
|
this.form.name = '';
|
||||||
|
this.form.projectId = '';
|
||||||
|
this.form.principal = '';
|
||||||
|
this.form.stage = '';
|
||||||
|
this.form.description = '';
|
||||||
|
this.form.status = null;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -414,6 +414,7 @@
|
||||||
},
|
},
|
||||||
openTestCaseEdit(testCase) {
|
openTestCaseEdit(testCase) {
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
|
this.issuesSwitch = false;
|
||||||
this.activeTab = 'detail';
|
this.activeTab = 'detail';
|
||||||
listenGoBack(this.handleClose);
|
listenGoBack(this.handleClose);
|
||||||
this.initData(testCase);
|
this.initData(testCase);
|
||||||
|
@ -471,18 +472,18 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
issuesChange() {
|
issuesChange() {
|
||||||
// if (this.testCase.issues.hasIssues) {
|
if (this.issuesSwitch) {
|
||||||
// let desc = this.addPLabel('[' + this.$t('test_track.plan_view.operate_step') + ']');
|
let desc = this.addPLabel('[' + this.$t('test_track.plan_view.operate_step') + ']');
|
||||||
// let result = this.addPLabel('[' + this.$t('test_track.case.expected_results') + ']');
|
let result = this.addPLabel('[' + this.$t('test_track.case.expected_results') + ']');
|
||||||
// let executeResult = this.addPLabel('[' + this.$t('test_track.plan_view.actual_result') + ']');
|
let executeResult = this.addPLabel('[' + this.$t('test_track.plan_view.actual_result') + ']');
|
||||||
// this.testCase.steps.forEach(step => {
|
this.testCase.steps.forEach(step => {
|
||||||
// let stepPrefix = this.$t('test_track.plan_view.step') + step.num + ':';
|
let stepPrefix = this.$t('test_track.plan_view.step') + step.num + ':';
|
||||||
// desc += this.addPLabel(stepPrefix + (step.desc == undefined ? '' : step.desc));
|
desc += this.addPLabel(stepPrefix + (step.desc == undefined ? '' : step.desc));
|
||||||
// result += this.addPLabel(stepPrefix + (step.result == undefined ? '' : step.result));
|
result += this.addPLabel(stepPrefix + (step.result == undefined ? '' : step.result));
|
||||||
// executeResult += this.addPLabel(stepPrefix + (step.executeResult == undefined ? '' : step.executeResult));
|
executeResult += this.addPLabel(stepPrefix + (step.executeResult == undefined ? '' : step.executeResult));
|
||||||
// });
|
});
|
||||||
// this.testCase.issues.content = desc + this.addPLabel('') + result + this.addPLabel('') + executeResult + this.addPLabel('');
|
this.testCase.issues.content = desc + this.addPLabel('') + result + this.addPLabel('') + executeResult + this.addPLabel('');
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
addPLabel(str) {
|
addPLabel(str) {
|
||||||
return "<p>" + str + "</p>";
|
return "<p>" + str + "</p>";
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7e4d80cc2b870a8cac6dbb9fe6711ab6041faf6d
|
Subproject commit 390943d21e7d0196e0d7d5faa66f0131cb631614
|
Loading…
Reference in New Issue