Merge remote-tracking branch 'origin/master'

This commit is contained in:
q4speed 2020-09-23 15:30:31 +08:00
commit 4c9b68ddd5
6 changed files with 172 additions and 194 deletions

@ -1 +1 @@
Subproject commit cf6b06526324326a563d933e07118fac014a63b4
Subproject commit 141ee64787b4a28ef108c5fa4dde90446de01887

View File

@ -12,11 +12,11 @@
<el-input :disabled="isReadOnly" v-model="form.cronValue" class="inp"
:placeholder="$t('schedule.please_input_cron_expression')"/>
<!-- <el-button type="primary" @click="showCronDialog">{{$t('schedule.generate_expression')}}</el-button>-->
<el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{$t('commons.save')}}</el-button>
<el-button :disabled="isReadOnly" type="primary" @click="saveCron">{{ $t('commons.save') }}</el-button>
</el-form-item>
<el-form-item>
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
{{$t('schedule.generate_expression')}}
{{ $t('schedule.generate_expression') }}
</el-link>
</el-form-item>
<crontab-result :ex="form.cronValue" ref="crontabResult"/>
@ -71,7 +71,9 @@
</template>
</el-table-column>
</el-table>
<el-button type="primary" @click="saveNotice">{{$t('commons.save')}}</el-button>
<div style="padding-top: 20px;">
<el-button type="primary" @click="saveNotice">{{ $t('commons.save') }}</el-button>
</div>
</template>
</el-tab-pane>
</el-tabs>
@ -82,177 +84,177 @@
<script>
import Crontab from "../cron/Crontab";
import CrontabResult from "../cron/CrontabResult";
import {cronValidate} from "@/common/js/cron";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
import Crontab from "../cron/Crontab";
import CrontabResult from "../cron/CrontabResult";
import {cronValidate} from "@/common/js/cron";
import {listenGoBack, removeGoBackListener} from "@/common/js/utils";
function defaultCustomValidate() {
return {pass: true};
}
function defaultCustomValidate() {
return {pass: true};
}
export default {
name: "MsScheduleEdit",
components: {CrontabResult, Crontab},
props: {
testId: String,
save: Function,
schedule: {},
customValidate: {
type: Function,
default: defaultCustomValidate
},
isReadOnly: {
type: Boolean,
default: false
},
export default {
name: "MsScheduleEdit",
components: {CrontabResult, Crontab},
props: {
testId: String,
save: Function,
schedule: {},
customValidate: {
type: Function,
default: defaultCustomValidate
},
isReadOnly: {
type: Boolean,
default: false
},
},
watch: {
'schedule.value'() {
this.form.cronValue = this.schedule.value;
watch: {
'schedule.value'() {
this.form.cronValue = this.schedule.value;
}
},
data() {
const validateCron = (rule, cronValue, callback) => {
let customValidate = this.customValidate(this.getIntervalTime());
if (!cronValue) {
callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
}
},
data() {
const validateCron = (rule, cronValue, callback) => {
let customValidate = this.customValidate(this.getIntervalTime());
if (!cronValue) {
callback(new Error(this.$t('commons.input_content')));
} else if (!cronValidate(cronValue)) {
callback(new Error(this.$t('schedule.cron_expression_format_error')));
}
// else if(!this.intervalShortValidate()) {
// callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
// }
else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
callback();
}
};
return {
operation: true,
dialogVisible: false,
showCron: false,
form: {
cronValue: ""
// else if(!this.intervalShortValidate()) {
// callback(new Error(this.$t('schedule.cron_expression_interval_short_error')));
// }
else if (!customValidate.pass) {
callback(new Error(customValidate.info));
} else {
callback();
}
};
return {
operation: true,
dialogVisible: false,
showCron: false,
form: {
cronValue: ""
},
tableData: [
{
event: "执行成功",
names: [],
email: "邮箱",
enable: false
},
tableData: [
{
event: "执行成功",
names: [],
email: "邮箱",
enable: false
},
{
event: "执行失败",
names: [],
email: "邮箱",
enable: false
}
],
options: [{}],
enable: true,
email: "",
activeName: 'first',
rules: {
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
{
event: "执行失败",
names: [],
email: "邮箱",
enable: false
}
}
},
methods: {
userList() {
this.result = this.$get('user/list', response => {
this.options = response.data
})
},
handleClick() {
if (this.activeName == "second") {
this.result = this.$get('notice/query/' + this.testId, response => {
if (response.data.length > 0) {
this.tableData = response.data
}
})
}
},
buildParam() {
let param = {};
param.notices = this.tableData
param.testId = this.testId
return param;
},
open() {
this.dialogVisible = true;
this.form.cronValue = this.schedule.value;
listenGoBack(this.close);
this.handleClick()
this.activeName = 'first'
},
crontabFill(value, resultList) {
//
this.form.cronValue = value;
this.$refs.crontabResult.resultList = resultList;
this.$refs['from'].validate();
},
showCronDialog() {
this.showCron = true;
},
saveCron() {
this.$refs['from'].validate((valid) => {
if (valid) {
this.intervalShortValidate();
this.save(this.form.cronValue);
this.dialogVisible = false;
} else {
return false;
}
});
},
saveNotice(){
let param = this.buildParam();
this.result = this.$post("notice/save", param, () => {
this.$success(this.$t('commons.save_success'));
})
},
close() {
this.dialogVisible = false;
this.form.cronValue = '';
this.$refs['from'].resetFields();
if (!this.schedule.value) {
this.$refs.crontabResult.resultList = [];
}
removeGoBackListener(this.close);
},
intervalShortValidate() {
if (this.getIntervalTime() < 3 * 60 * 1000) {
// return false;
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
}
return true;
},
resultListChange() {
this.$refs['from'].validate();
},
getIntervalTime() {
let resultList = this.$refs.crontabResult.resultList;
let time1 = new Date(resultList[0]);
let time2 = new Date(resultList[1]);
return time2 - time1;
],
options: [{}],
enable: true,
email: "",
activeName: 'first',
rules: {
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
}
}
},
methods: {
userList() {
this.result = this.$get('user/list', response => {
this.options = response.data
})
},
handleClick() {
if (this.activeName == "second") {
this.result = this.$get('notice/query/' + this.testId, response => {
if (response.data.length > 0) {
this.tableData = response.data
}
})
}
},
buildParam() {
let param = {};
param.notices = this.tableData
param.testId = this.testId
return param;
},
open() {
this.dialogVisible = true;
this.form.cronValue = this.schedule.value;
listenGoBack(this.close);
this.handleClick()
this.activeName = 'first'
},
crontabFill(value, resultList) {
//
this.form.cronValue = value;
this.$refs.crontabResult.resultList = resultList;
this.$refs['from'].validate();
},
showCronDialog() {
this.showCron = true;
},
saveCron() {
this.$refs['from'].validate((valid) => {
if (valid) {
this.intervalShortValidate();
this.save(this.form.cronValue);
this.dialogVisible = false;
} else {
return false;
}
});
},
saveNotice() {
let param = this.buildParam();
this.result = this.$post("notice/save", param, () => {
this.$success(this.$t('commons.save_success'));
})
},
close() {
this.dialogVisible = false;
this.form.cronValue = '';
this.$refs['from'].resetFields();
if (!this.schedule.value) {
this.$refs.crontabResult.resultList = [];
}
removeGoBackListener(this.close);
},
intervalShortValidate() {
if (this.getIntervalTime() < 3 * 60 * 1000) {
// return false;
this.$info(this.$t('schedule.cron_expression_interval_short_error'));
}
return true;
},
resultListChange() {
this.$refs['from'].validate();
},
getIntervalTime() {
let resultList = this.$refs.crontabResult.resultList;
let time1 = new Date(resultList[0]);
let time2 = new Date(resultList[1]);
return time2 - time1;
}
}
}
</script>
<style scoped>
.inp {
width: 50%;
margin-right: 20px;
}
.inp {
width: 50%;
margin-right: 20px;
}
.el-form-item {
margin-bottom: 10px;
}
.el-form-item {
margin-bottom: 10px;
}
</style>

View File

@ -113,6 +113,7 @@
import MsTableButton from '../../../../components/common/components/MsTableButton';
import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils";
import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants';
import axios from "axios";
export default {
name: "TestCaseImport",
@ -188,7 +189,14 @@
this.$fileDownload('/test/case/export/template');
},
downloadXmindTemplate() {
this.$fileDownload('/test/case/export/xmindTemplate');
axios.get('/test/case/export/xmindTemplate', {responseType: 'blob'})
.then(response => {
let fileName = window.decodeURI(response.headers['content-disposition'].split('=')[1]);
let link = document.createElement("a");
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.download = fileName;
link.click();
});
},
upload(file) {
this.isLoading = false;

View File

@ -226,23 +226,6 @@
this.reportExportVisible = false;
this.result.loading = false;
},
// handleExport(name) {
//
// let result = this.result;
// result.loading = true;
//
// let promises = [];
// let canvasList = new Array(this.previews.length);
//
// for (let item of this.$refs.templateComponent) {
// promises.push(item.getCanvas(canvasList));
// }
//
// Promise.all(promises).then(function (info) {
// exportPdf(name, canvasList);
// result.loading = false;
// });
// },
}
}
</script>
@ -287,8 +270,4 @@
margin-top: 20px;
}
.report-export .el-card {
margin-top: 20px;
}
</style>

View File

@ -29,17 +29,6 @@
<el-col :span="12" class="head-right">
<span class="head-right-tip" v-if="index + 1 === testCases.length">
{{ $t('test_track.plan_view.pre_case') }} : {{
testCases[index - 1] ? testCases[index - 1].name : ''
}}
</span>
<span class="head-right-tip" v-if="index + 1 !== testCases.length">
{{ $t('test_track.plan_view.next_case') }} : {{
testCases[index + 1] ? testCases[index + 1].name : ''
}}
</span>
<el-button plain size="mini" icon="el-icon-arrow-up"
:disabled="index + 1 <= 1"
@click="handlePre()"/>

View File

@ -136,7 +136,7 @@ export default {
.then(response => {
let fileName = window.decodeURI(response.headers['content-disposition'].split('=')[1]);
let link = document.createElement("a");
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.href = window.URL.createObjectURL(new Blob([response.data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"}));
link.download = fileName;
link.click();
});