|
|
@ -1,27 +1,25 @@ |
|
|
|
<template> |
|
|
|
<Dialog v-model="modelVisible" :title="propData ? '修改' : '新增'" width="1400px"> |
|
|
|
{{ propData }} |
|
|
|
{{ editData }} |
|
|
|
<div class="AddNEditDialog"> |
|
|
|
<!-- <Form :value="propData" class="form" ref="basicInfoForm" :formList="formList" column="1" labelWidth="80px" /> --> |
|
|
|
<el-form ref="basicInfoForm" :model="editData" label-width="80px" :rules="groupBasicRules"> |
|
|
|
<el-form-item label="名称" prop="groupName"> |
|
|
|
<el-input v-model="editData.groupName"></el-input> |
|
|
|
<el-input v-model="editData.groupName" placeholder="任务组名称"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="描述" prop="remark"> |
|
|
|
<el-input v-model="editData.remark"></el-input> |
|
|
|
<el-input v-model="editData.remark" placeholder="任务组描述"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="状态" prop="status"> |
|
|
|
<el-switch v-model="editData.status" active-value="1" inactive-value="0"></el-switch> |
|
|
|
</el-form-item> |
|
|
|
<div style="display: flex; justify-content: flex-end;"> |
|
|
|
<Button style="background-color: rgba(0, 179, 204, 0.3)" |
|
|
|
@click.native="(modelVisible = false), (submitting = false)"> |
|
|
|
<el-button @click="(modelVisible = false), (submitting = false)"> |
|
|
|
取消 |
|
|
|
</Button> |
|
|
|
<Button @click.native="onSaveTaskGroup" :loading="submitting"> 提交 </Button> |
|
|
|
</el-button> |
|
|
|
<el-button type="primary" @click="onSaveTaskGroup('basicInfoForm')" :loading="submitting"> 提交 </el-button> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
{{ editData.id }} |
|
|
|
|
|
|
|
<template v-if="editData.id"> |
|
|
|
<!-- 如果是新增的、还没有保存的任务组,不能添加任务 --> |
|
|
@ -89,9 +87,10 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
let gNameValidator = (rule, value, callback)=>{ |
|
|
|
if (value.trim().length<=0){ |
|
|
|
return callback(new Error('请输入任务组名称')); |
|
|
|
} |
|
|
|
return callback(new Error('请输入任务组名称')); |
|
|
|
// if (value.trim().length<=0){ |
|
|
|
// return callback(new Error('请输入任务组名称')); |
|
|
|
// } |
|
|
|
}; |
|
|
|
return { |
|
|
|
editData:{}, |
|
|
@ -104,7 +103,8 @@ export default { |
|
|
|
selectedTaskGroup:{}, |
|
|
|
groupBasicRules:{ |
|
|
|
groupName: [ |
|
|
|
{ validator: gNameValidator, trigger: 'blur' } |
|
|
|
// { validator: gNameValidator, trigger: 'blur' } |
|
|
|
{ required: true, message: '请输入活动名称', trigger: 'blur' }, |
|
|
|
], |
|
|
|
} |
|
|
|
}; |
|
|
@ -175,7 +175,7 @@ export default { |
|
|
|
} else { |
|
|
|
this.mode = "add" |
|
|
|
this.editData = { |
|
|
|
groupName: "任务组AAA", |
|
|
|
groupName: "", |
|
|
|
status: "1", |
|
|
|
remark: "", |
|
|
|
detailedConfiguration: "" |
|
|
@ -224,9 +224,9 @@ export default { |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
onSaveTaskGroup() { |
|
|
|
this.$refs.basicInfoForm.validate().then((result) => { |
|
|
|
if (!result){ |
|
|
|
onSaveTaskGroup(formName) { |
|
|
|
this.$refs[formName].validate(valid => { |
|
|
|
if (!valid){ |
|
|
|
return ; |
|
|
|
} |
|
|
|
this.editData.groupName = this.editData.groupName.trim(); |
|
|
@ -235,9 +235,9 @@ export default { |
|
|
|
this.submitting = true; |
|
|
|
|
|
|
|
//测试数据开始 |
|
|
|
this.$set(this.editData, "id", 11); |
|
|
|
this.submitting = false; |
|
|
|
return |
|
|
|
// this.$set(this.editData, "id", 11); |
|
|
|
// this.submitting = false; |
|
|
|
// return |
|
|
|
//测试数据结束 |
|
|
|
|
|
|
|
request({ |
|
|
@ -251,6 +251,9 @@ export default { |
|
|
|
Message.success(`提交成功!`); |
|
|
|
this.$emit("onSuccess"); |
|
|
|
|
|
|
|
this.editData = result.data; |
|
|
|
// this.mode = "edit" |
|
|
|
|
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log( |
|
|
|