fix: 测试计划的定时任务,下次执行时间不是实时的问题;系统设置-批量添加用户到工作空间添加角色功能优化
测试计划的定时任务,下次执行时间不是实时的问题;系统设置-批量添加用户到工作空间添加角色功能优化
This commit is contained in:
parent
524259dc5e
commit
70d15e2ee1
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog :close-on-click-modal="false" width="60%" class="schedule-edit" :visible.sync="dialogVisible" :append-to-body='true'
|
<el-dialog :close-on-click-modal="false" width="60%" class="schedule-edit" :visible.sync="dialogVisible"
|
||||||
|
:append-to-body='true'
|
||||||
@close="close">
|
@close="close">
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
@ -18,12 +19,10 @@
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<schedule-switch :schedule="schedule" @scheduleChange="scheduleChange"></schedule-switch>
|
<schedule-switch :schedule="schedule" :corn-value="form.cronValue" @resultListChange="getExecuteTimeTemplate" @scheduleChange="scheduleChange"></schedule-switch>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
|
<el-link :disabled="isReadOnly" type="primary" @click="showCronDialog">
|
||||||
|
@ -66,7 +65,13 @@ const noticeTemplate = requireComponent.keys().length > 0 ? requireComponent("./
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsScheduleMaintain",
|
name: "MsScheduleMaintain",
|
||||||
components: {CrontabResult, ScheduleSwitch,Crontab, MsScheduleNotification, "NoticeTemplate": noticeTemplate.default},
|
components: {
|
||||||
|
CrontabResult,
|
||||||
|
ScheduleSwitch,
|
||||||
|
Crontab,
|
||||||
|
MsScheduleNotification,
|
||||||
|
"NoticeTemplate": noticeTemplate.default
|
||||||
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
customValidate: {
|
customValidate: {
|
||||||
|
@ -111,7 +116,7 @@ export default {
|
||||||
form: {
|
form: {
|
||||||
cronValue: ""
|
cronValue: ""
|
||||||
},
|
},
|
||||||
paramRow:{},
|
paramRow: {},
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
rules: {
|
rules: {
|
||||||
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
|
cronValue: [{required: true, validator: validateCron, trigger: 'blur'}],
|
||||||
|
@ -122,19 +127,19 @@ export default {
|
||||||
currentUser: () => {
|
currentUser: () => {
|
||||||
return getCurrentUser();
|
return getCurrentUser();
|
||||||
},
|
},
|
||||||
scheduleChange(){
|
scheduleChange() {
|
||||||
let flag = this.schedule.enable;
|
let flag = this.schedule.enable;
|
||||||
let param = {};
|
let param = {};
|
||||||
param.taskID = this.schedule.id;
|
param.taskID = this.schedule.id;
|
||||||
param.enable = flag;
|
param.enable = flag;
|
||||||
let that = this;
|
let that = this;
|
||||||
if(flag == false) {
|
if (flag == false) {
|
||||||
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
|
this.$confirm(this.$t('api_test.home_page.running_task_list.confirm.close_title'), this.$t('commons.prompt'), {
|
||||||
confirmButtonText: this.$t('commons.confirm'),
|
confirmButtonText: this.$t('commons.confirm'),
|
||||||
cancelButtonText: this.$t('commons.cancel'),
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
beforeClose(action, instance, done) {
|
beforeClose(action, instance, done) {
|
||||||
if(action == 'cancel') { // 否则在 messageBox 点击取消后,switch 按钮仍然会被关闭
|
if (action == 'cancel') { // 否则在 messageBox 点击取消后,switch 按钮仍然会被关闭
|
||||||
that.schedule.enable = param.enable = true;
|
that.schedule.enable = param.enable = true;
|
||||||
}
|
}
|
||||||
done(); // done 是关闭 messageBox 的行为
|
done(); // done 是关闭 messageBox 的行为
|
||||||
|
@ -143,12 +148,11 @@ export default {
|
||||||
this.updateTask(param);
|
this.updateTask(param);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.updateTask(param);
|
this.updateTask(param);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateTask(param){
|
updateTask(param) {
|
||||||
this.result = this.$post('/api/schedule/updateEnableByPrimyKey', param, response => {
|
this.result = this.$post('/api/schedule/updateEnableByPrimyKey', param, response => {
|
||||||
let paramTestId = "";
|
let paramTestId = "";
|
||||||
if (this.paramRow.redirectFrom == 'testPlan') {
|
if (this.paramRow.redirectFrom == 'testPlan') {
|
||||||
|
@ -203,7 +207,7 @@ export default {
|
||||||
findSchedule() {
|
findSchedule() {
|
||||||
var scheduleResourceID = this.testId;
|
var scheduleResourceID = this.testId;
|
||||||
var taskType = this.scheduleTaskType;
|
var taskType = this.scheduleTaskType;
|
||||||
this.result = this.$get("/schedule/findOne/" + scheduleResourceID + "/" +taskType, response => {
|
this.result = this.$get("/schedule/findOne/" + scheduleResourceID + "/" + taskType, response => {
|
||||||
if (response.data != null) {
|
if (response.data != null) {
|
||||||
this.schedule = response.data;
|
this.schedule = response.data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -240,14 +244,14 @@ export default {
|
||||||
param = this.schedule;
|
param = this.schedule;
|
||||||
param.resourceId = this.testId;
|
param.resourceId = this.testId;
|
||||||
let url = '/api/automation/schedule/create';
|
let url = '/api/automation/schedule/create';
|
||||||
if(this.scheduleTaskType === "TEST_PLAN_TEST"){
|
if (this.scheduleTaskType === "TEST_PLAN_TEST") {
|
||||||
param.scheduleFrom = "testPlan";
|
param.scheduleFrom = "testPlan";
|
||||||
//测试计划页面跳转的创建
|
//测试计划页面跳转的创建
|
||||||
url = '/schedule/create';
|
url = '/schedule/create';
|
||||||
if (param.id) {
|
if (param.id) {
|
||||||
url = '/schedule/update';
|
url = '/schedule/update';
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
param.scheduleFrom = "scenario";
|
param.scheduleFrom = "scenario";
|
||||||
if (param.id) {
|
if (param.id) {
|
||||||
url = '/api/automation/schedule/update';
|
url = '/api/automation/schedule/update';
|
||||||
|
@ -297,7 +301,9 @@ export default {
|
||||||
let time2 = new Date(resultList[1]);
|
let time2 = new Date(resultList[1]);
|
||||||
return time2 - time1;
|
return time2 - time1;
|
||||||
},
|
},
|
||||||
|
getExecuteTimeTemplate(executeTileArr){
|
||||||
|
alert(executeTileArr);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isTesterPermission() {
|
isTesterPermission() {
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
<i class="el-icon-date" size="small"></i>
|
<i class="el-icon-date" size="small"></i>
|
||||||
<span class="character">SCHEDULER</span>
|
<span class="character">SCHEDULER</span>
|
||||||
</span>
|
</span>
|
||||||
<!-- <el-switch :disabled="!schedule.value || isReadOnly" v-model="schedule.enable" @change="scheduleChange"/>-->
|
|
||||||
<!-- <el-switch :disabled="!schedule.value || isReadOnly" v-model="schedule.enable" />-->
|
|
||||||
<el-switch :disabled="!schedule.value" v-model="schedule.enable" @change="scheduleChange"/>
|
<el-switch :disabled="!schedule.value" v-model="schedule.enable" @change="scheduleChange"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -14,7 +12,7 @@
|
||||||
{{ $t('schedule.next_execution_time') }}:
|
{{ $t('schedule.next_execution_time') }}:
|
||||||
<span :class="{'disable-character': !schedule.enable}"
|
<span :class="{'disable-character': !schedule.enable}"
|
||||||
v-if="!schedule.enable">{{ $t('schedule.not_set') }}</span>
|
v-if="!schedule.enable">{{ $t('schedule.not_set') }}</span>
|
||||||
<crontab-result v-if="schedule.enable" :enable-simple-mode="true" :ex="schedule.value" ref="crontabResult"/>
|
<crontab-result v-if="schedule.enable" :enable-simple-mode="true" :ex="cornValue" ref="crontabResult"/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,6 +31,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
testId: String,
|
testId: String,
|
||||||
schedule: Object,
|
schedule: Object,
|
||||||
|
cornValue:String,
|
||||||
isReadOnly: {
|
isReadOnly: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
|
|
@ -2,19 +2,24 @@
|
||||||
<el-dialog class="user-casecader" :title="title" :visible.sync="dialogVisible"
|
<el-dialog class="user-casecader" :title="title" :visible.sync="dialogVisible"
|
||||||
@close="close">
|
@close="close">
|
||||||
<div class="block" >
|
<div class="block" >
|
||||||
<!-- <el-row>-->
|
|
||||||
<!-- <span class="demonstration" v-html="lable"></span>-->
|
|
||||||
<!-- </el-row>-->
|
|
||||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
||||||
<el-form-item prop="workspace" label-width="0px">
|
<el-form-item prop="workspace" label-width="0px">
|
||||||
<el-cascader
|
<!-- <el-cascader-->
|
||||||
:options="options"
|
<!-- :options="options"-->
|
||||||
:props="props"
|
<!-- :props="props"-->
|
||||||
v-model="selectedIds"
|
<!-- v-model="selectedIds"-->
|
||||||
ref="cascaderSelector"
|
<!-- ref="cascaderSelector"-->
|
||||||
style="width:100%"
|
<!-- style="width:100%;"-->
|
||||||
:key="isResouceShow"
|
<!-- :key="isResouceShow"-->
|
||||||
clearable></el-cascader>
|
<!-- clearable></el-cascader>-->
|
||||||
|
|
||||||
|
<el-cascader-panel :options="options"
|
||||||
|
:props="props"
|
||||||
|
v-model="selectedIds"
|
||||||
|
ref="cascaderSelector"
|
||||||
|
style="width:100%;"
|
||||||
|
:key="isResouceShow"
|
||||||
|
clearable></el-cascader-panel>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,7 +42,7 @@ export default {
|
||||||
components: {ElUploadList, MsTableButton,MsDialogFooter},
|
components: {ElUploadList, MsTableButton,MsDialogFooter},
|
||||||
data() {
|
data() {
|
||||||
var validateSelect = (rule, value, callback) => {
|
var validateSelect = (rule, value, callback) => {
|
||||||
let checkNodes = this.$refs.cascaderSelector.checkedNodes;
|
let checkNodes = this.$refs.cascaderSelector.getCheckedNodes(true);
|
||||||
if(checkNodes.length==0){
|
if(checkNodes.length==0){
|
||||||
callback(new Error(this.$t('workspace.select')));
|
callback(new Error(this.$t('workspace.select')));
|
||||||
}
|
}
|
||||||
|
@ -95,7 +100,7 @@ export default {
|
||||||
confirm(){
|
confirm(){
|
||||||
this.$refs.ruleForm.validate((valid) => {
|
this.$refs.ruleForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let checkNodes = this.$refs.cascaderSelector.checkedNodes;
|
let checkNodes = this.$refs.cascaderSelector.getCheckedNodes(true);
|
||||||
let selectValueArr = [];
|
let selectValueArr = [];
|
||||||
for (let i = 0; i < checkNodes.length; i++) {
|
for (let i = 0; i < checkNodes.length; i++) {
|
||||||
selectValueArr.push(checkNodes[i].value);
|
selectValueArr.push(checkNodes[i].value);
|
||||||
|
@ -116,9 +121,19 @@ export default {
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.user-casecader >>> .el-dialog {
|
.user-casecader >>> .el-dialog {
|
||||||
width: 400px;
|
width: 600px;
|
||||||
}
|
}
|
||||||
/deep/ .el-form-item__content{
|
/deep/ .el-form-item__content{
|
||||||
margin-left: 0px;
|
margin-left: 0px;
|
||||||
}
|
}
|
||||||
|
/*.el-cascader-menu {*/
|
||||||
|
/* height: 300px;*/
|
||||||
|
/*}*/
|
||||||
|
/*.el-cascader >>> .el-input--suffix {*/
|
||||||
|
/* max-height: 200px;*/
|
||||||
|
/*}*/
|
||||||
|
/*.el-cascader >>> .el-cascader__tags {*/
|
||||||
|
/* max-height: 190px;*/
|
||||||
|
/* overflow: auto;*/
|
||||||
|
/*}*/
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue