mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-02 07:27:01 +00:00
Merge branch 'master' of https://github.com/jumpserver/lina
This commit is contained in:
commit
d4e5db9df2
@ -35,7 +35,6 @@ export default {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<slot v-for="item in fields" :slot="`$id:${item.id}`" :name="`$id:${item.id}`" />
|
||||
|
||||
<el-form-item>
|
||||
<el-button v-for="button in moreButtons" :key="button.title" size="small" v-bind="button" @click="button.callback">{{ button.title }}</el-button>
|
||||
<el-button v-for="button in moreButtons" :key="button.title" size="small" v-bind="button" @click="handleClick(button)">{{ button.title }}</el-button>
|
||||
<el-button v-if="defaultButton" size="small" @click="resetForm('form')">{{ $tc('Reset') }}</el-button>
|
||||
<el-button v-if="defaultButton" size="small" type="primary" @click="submitForm('form')">{{ $tc('Submit') }}</el-button>
|
||||
</el-form-item>
|
||||
@ -66,6 +66,14 @@ export default {
|
||||
// 重置表单
|
||||
resetForm(formName) {
|
||||
this.$refs[formName].resetFields()
|
||||
},
|
||||
handleClick(button) {
|
||||
const callback = button.callback || function(values, form) {
|
||||
console.log('Click ', button.title, ': ', values)
|
||||
}
|
||||
const form = this.$refs['form']
|
||||
const values = form.getFormValue()
|
||||
callback(values, form)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
:initial="object"
|
||||
:update-success-next-route="successUrl"
|
||||
:clean-form-value="cleanFormValue"
|
||||
:object="object"
|
||||
:object.sync="object"
|
||||
:fields-meta="fieldsMeta"
|
||||
:get-method="getMethod"
|
||||
/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<GenericCreateUpdatePage v-bind="$data" />
|
||||
<GenericCreateUpdatePage v-bind="$data" @validate="console.log('hello')" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -55,8 +55,8 @@ export default {
|
||||
moreButtons: [
|
||||
{
|
||||
title: 'Test',
|
||||
callback: function() {
|
||||
vm.$log.debug('hello')
|
||||
callback: function(values) {
|
||||
vm.$log.debug('hello: ', values)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user