feat:2.5.0
1. 修复分片模式参数提交失败问题 2. 场景编辑时场景名称和组不允许编辑
This commit is contained in:
parent
f4b27b5e06
commit
265ab923f3
@ -30,8 +30,6 @@ function plugin (Vue) {
|
|||||||
return permissionList.find((val) => {
|
return permissionList.find((val) => {
|
||||||
return val.permissionId === permission
|
return val.permissionId === permission
|
||||||
}).actionList.findIndex((val) => {
|
}).actionList.findIndex((val) => {
|
||||||
console.log(val)
|
|
||||||
console.log(action)
|
|
||||||
return val === action
|
return val === action
|
||||||
}) > -1
|
}) > -1
|
||||||
}
|
}
|
||||||
|
@ -265,53 +265,45 @@
|
|||||||
</a-form>
|
</a-form>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<a-modal :visible="visible" title="分片参数" @ok="handleOk" @cancel="handlerCancel" width="500px">
|
<a-modal :visible="visible" title="分片参数" @ok="submitForm()" @cancel="handlerCancel" width="500px">
|
||||||
<a-form :form="dynamicForm" @submit="handleSubmit" :body-style="{padding: '0px 0px'}" v-bind="formItemLayout" >
|
<a-form-model ref="dynamicValidateForm" :model="dynamicValidateForm" style="margin-left: 15%" layout="vertical" >
|
||||||
<a-form-item
|
<a-form-model-item
|
||||||
v-for="(k, index) in dynamicForm.getFieldValue('keys')"
|
v-for="(domain, index) in dynamicValidateForm.domains"
|
||||||
:key="k"
|
:key="domain.key"
|
||||||
v-bind="formItemLayoutWithOutLabel"
|
:label="'分片' + (index)"
|
||||||
:label="'分片' + index "
|
:prop="'domains.' + index + '.value'"
|
||||||
:required="true"
|
:rules="{
|
||||||
|
required: true,
|
||||||
|
message: '分区参数不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<a-input
|
<a-input
|
||||||
v-decorator="[
|
v-model="domain.value"
|
||||||
`sharding[${k}]`,
|
placeholder="请输入分区的参数"
|
||||||
{
|
style="width: 80%; margin-right: 8px"
|
||||||
validateTrigger: ['change', 'blur'],
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
required: true,
|
|
||||||
whitespace: true,
|
|
||||||
message: '分片参数必填'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
placeholder="请输入参数"
|
|
||||||
style="width: 60%; margin-right: 8px"
|
|
||||||
/>
|
/>
|
||||||
<a-icon
|
<a-icon
|
||||||
v-if="dynamicForm.getFieldValue('keys').length > 1"
|
v-if="dynamicValidateForm.domains.length > 1"
|
||||||
class="dynamic-delete-button"
|
class="dynamic-delete-button"
|
||||||
type="minus-circle-o"
|
type="minus-circle-o"
|
||||||
:disabled="dynamicForm.getFieldValue('keys').length === 1"
|
:disabled="dynamicValidateForm.domains.length === 1"
|
||||||
@click="() => remove(k)"
|
@click="removeDomain(domain)"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-model-item>
|
||||||
<a-form-item v-bind="formItemLayoutWithOutLabel">
|
<a-form-model-item v-bind="formItemLayoutWithOutLabel">
|
||||||
<a-button type="dashed" style="width: 60%" @click="add">
|
<a-button type="dashed" style="width: 60%" @click="add">
|
||||||
<a-icon type="plus" /> 添加分片
|
<a-icon type="plus" /> 添加分片
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-form-item>
|
</a-form-model-item>
|
||||||
<a-form-item
|
<a-form-model-item
|
||||||
:wrapper-col="{
|
:wrapper-col="{
|
||||||
xs: { span: 24, offset: 0 },
|
xs: { span: 24, offset: 0 },
|
||||||
sm: { span: 16, offset: 8 },
|
sm: { span: 16, offset: 8 },
|
||||||
lg: { span: 7 }
|
lg: { span: 7 }
|
||||||
}">
|
}">
|
||||||
</a-form-item>
|
</a-form-model-item>
|
||||||
</a-form>
|
</a-form-model>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<cron-modal ref="cronModalRef" @getCron="getCron"/>
|
<cron-modal ref="cronModalRef" @getCron="getCron"/>
|
||||||
</div>
|
</div>
|
||||||
@ -323,21 +315,31 @@ import { getJobDetail, saveJob, updateJob } from '@/api/jobApi'
|
|||||||
import pick from 'lodash.pick'
|
import pick from 'lodash.pick'
|
||||||
import CronModal from '@/views/job/from/CronModal'
|
import CronModal from '@/views/job/from/CronModal'
|
||||||
|
|
||||||
|
import AFormModel from 'ant-design-vue/es/form-model/Form'
|
||||||
|
import AFormModelItem from 'ant-design-vue/es/form-model/FormItem'
|
||||||
|
|
||||||
const enums = require('@/utils/jobEnum')
|
const enums = require('@/utils/jobEnum')
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'JobFrom',
|
name: 'JobFrom',
|
||||||
components: { CronModal },
|
components: {
|
||||||
props: {},
|
CronModal,
|
||||||
comments: {
|
AFormModel,
|
||||||
CronModal
|
AFormModelItem
|
||||||
},
|
},
|
||||||
|
props: {},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
form: this.$form.createForm(this),
|
form: this.$form.createForm(this),
|
||||||
formItemLayout: {
|
formItemLayout: {
|
||||||
labelCol: { lg: { span: 7 }, sm: { span: 7 } },
|
labelCol: {
|
||||||
wrapperCol: { lg: { span: 10 }, sm: { span: 17 } }
|
xs: { span: 24 },
|
||||||
|
sm: { span: 4 }
|
||||||
|
},
|
||||||
|
wrapperCol: {
|
||||||
|
xs: { span: 24 },
|
||||||
|
sm: { span: 20 }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
formItemLayoutWithOutLabel: {
|
formItemLayoutWithOutLabel: {
|
||||||
wrapperCol: {
|
wrapperCol: {
|
||||||
@ -358,12 +360,15 @@ export default {
|
|||||||
count: 0,
|
count: 0,
|
||||||
triggerTypeValue: '2',
|
triggerTypeValue: '2',
|
||||||
taskTypeValue: '1',
|
taskTypeValue: '1',
|
||||||
argsStrValue: []
|
argsStrValue: [],
|
||||||
|
dynamicValidateForm: {
|
||||||
|
domains: []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
this.dynamicForm = this.$form.createForm(this, { name: 'dynamic_form_item' })
|
// this.dynamicForm = this.$form.createForm(this, { name: 'dynamic_form_item' })
|
||||||
this.dynamicForm.getFieldDecorator('keys', { initialValue: [], preserve: true })
|
// this.dynamicForm.getFieldDecorator('keys', { initialValue: [], preserve: true })
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
getAllGroupNameList().then((res) => {
|
getAllGroupNameList().then((res) => {
|
||||||
@ -401,59 +406,45 @@ export default {
|
|||||||
this.$refs.cronModalRef.isShow(triggerInterval)
|
this.$refs.cronModalRef.isShow(triggerInterval)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove (k) {
|
removeDomain (item) {
|
||||||
const { dynamicForm } = this
|
const index = this.dynamicValidateForm.domains.indexOf(item)
|
||||||
// can use data-binding to get
|
if (index !== -1) {
|
||||||
const keys = dynamicForm.getFieldValue('keys')
|
this.dynamicValidateForm.domains.splice(index, 1)
|
||||||
// We need at least one passenger
|
|
||||||
if (keys.length === 1) {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// can use data-binding to set
|
|
||||||
dynamicForm.setFieldsValue({
|
|
||||||
keys: keys.filter(key => key !== k)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
add () {
|
add () {
|
||||||
const { dynamicForm } = this
|
this.dynamicValidateForm.domains.push({
|
||||||
// can use data-binding to get
|
value: '',
|
||||||
const keys = dynamicForm.getFieldValue('keys')
|
key: Date.now()
|
||||||
console.log(keys)
|
|
||||||
const nextKeys = keys.concat(this.count++)
|
|
||||||
// can use data-binding to set
|
|
||||||
// important! notify form to detect changes
|
|
||||||
dynamicForm.setFieldsValue({
|
|
||||||
keys: nextKeys
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleBlur () {
|
handleBlur () {
|
||||||
const taskType = this.form.getFieldValue('taskType')
|
const taskType = this.form.getFieldValue('taskType')
|
||||||
if (taskType === '3') {
|
if (taskType === '3') {
|
||||||
this.visible = !this.visible
|
this.visible = !this.visible
|
||||||
const { form } = this
|
// const { form } = this
|
||||||
if (this.formType === 'create') {
|
// if (this.formType === 'create') {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
form.setFieldsValue({
|
// form.setFieldsValue({
|
||||||
argsStr: ''
|
// argsStr: ''
|
||||||
})
|
// })
|
||||||
|
//
|
||||||
console.log(this.argsStrValue)
|
// console.log(this.argsStrValue)
|
||||||
if (this.argsStrValue.length === 0) {
|
// if (this.argsStrValue.length === 0) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 将字符串分割成键值对数组
|
// // 将字符串分割成键值对数组
|
||||||
const keys = this.argsStrValue.map((item, index) => {
|
// const keys = this.argsStrValue.map((item, index) => {
|
||||||
this.count++
|
// this.count++
|
||||||
this.dynamicForm.getFieldDecorator(`sharding[${index}]`, { initialValue: item, preserve: true })
|
// this.dynamicForm.getFieldDecorator(`sharding[${index}]`, { initialValue: item, preserve: true })
|
||||||
return index
|
// return index
|
||||||
})
|
// })
|
||||||
|
//
|
||||||
this.dynamicForm.getFieldDecorator('keys', { initialValue: keys, preserve: true })
|
// console.log(keys)
|
||||||
|
// this.dynamicForm.getFieldDecorator('keys', { initialValue: keys, preserve: true })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getCron (cron) {
|
getCron (cron) {
|
||||||
@ -461,14 +452,31 @@ export default {
|
|||||||
triggerInterval: cron
|
triggerInterval: cron
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
submitForm () {
|
||||||
|
const { form } = this
|
||||||
|
this.$refs['dynamicValidateForm'].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
console.log(this.dynamicValidateForm.domains)
|
||||||
|
this.argsStrValue = this.dynamicValidateForm.domains.map((item, index) => item.value)
|
||||||
|
form.setFieldsValue({
|
||||||
|
argsStr: this.dynamicValidateForm.domains.map((item, index) => `分区:${index}=>${item.value}`).join('; ')
|
||||||
|
})
|
||||||
|
this.visible = !this.visible
|
||||||
|
} else {
|
||||||
|
console.log('error submit!!')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
handleOk (e) {
|
handleOk (e) {
|
||||||
const { form } = this
|
const { form } = this
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
this.dynamicForm.validateFields((err, values) => {
|
this.dynamicForm.validateFields((err, values) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
this.argsStrValue = values['sharding']
|
this.argsStrValue = values['sharding']
|
||||||
|
console.log(this.argsStrValue)
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
argsStr: this.argsStrValue.map((item, index) => `分区:${index}=>${item}`).join('; ')
|
argsStr: this.argsStrValue.filter(item => item).map((item, index) => `分区:${index}=>${item}`).join('; ')
|
||||||
})
|
})
|
||||||
this.visible = false
|
this.visible = false
|
||||||
}
|
}
|
||||||
@ -522,6 +530,13 @@ export default {
|
|||||||
if (this.taskTypeValue === '3') {
|
if (this.taskTypeValue === '3') {
|
||||||
this.argsStrValue = JSON.parse(formData.argsStr)
|
this.argsStrValue = JSON.parse(formData.argsStr)
|
||||||
formData.argsStr = this.argsStrValue.map((item, index) => `分区:${index}=>${item}`).join(';')
|
formData.argsStr = this.argsStrValue.map((item, index) => `分区:${index}=>${item}`).join(';')
|
||||||
|
|
||||||
|
this.argsStrValue.forEach((item, index) => {
|
||||||
|
this.dynamicValidateForm.domains.push({
|
||||||
|
value: item,
|
||||||
|
key: Date.now() + index
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
form.setFieldsValue(formData)
|
form.setFieldsValue(formData)
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<a-input
|
<a-input
|
||||||
placeholder="请输入场景名称"
|
placeholder="请输入场景名称"
|
||||||
:maxLength="64"
|
:maxLength="64"
|
||||||
|
:disabled="this.formType === 'edit'"
|
||||||
v-decorator="[
|
v-decorator="[
|
||||||
'sceneName',
|
'sceneName',
|
||||||
{rules: [{ required: true, message: '请输入场景名称', whitespace: true},{required: true, max: 64, message: '最多支持64个字符!'}]}
|
{rules: [{ required: true, message: '请输入场景名称', whitespace: true},{required: true, max: 64, message: '最多支持64个字符!'}]}
|
||||||
@ -27,6 +28,7 @@
|
|||||||
<a-col :lg="18" :md="18" :sm="24">
|
<a-col :lg="18" :md="18" :sm="24">
|
||||||
<a-form-item label="组">
|
<a-form-item label="组">
|
||||||
<a-select
|
<a-select
|
||||||
|
:disabled="this.formType === 'edit'"
|
||||||
placeholder="请选择组"
|
placeholder="请选择组"
|
||||||
v-decorator="['groupName', { rules: [{ required: true, message: '请选择组' }] }]"
|
v-decorator="['groupName', { rules: [{ required: true, message: '请选择组' }] }]"
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user