2017-11-06 03:16:23 +00:00
|
|
|
<template>
|
|
|
|
<div class="elm-demo">
|
2018-07-12 12:03:50 +00:00
|
|
|
<el-form ref="elm-demo" :model="account" :rules="formRules" label-width="100px">
|
2017-11-06 03:16:23 +00:00
|
|
|
<el-row type="flex" justify="flex-start">
|
|
|
|
<el-col :xs="24" :sm="10">
|
|
|
|
<el-form-item label="Account Name" prop="name" required>
|
2018-08-31 20:34:12 +00:00
|
|
|
<el-input v-model="account.name" />
|
2017-11-06 03:16:23 +00:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row type="flex" justify="flex-start">
|
|
|
|
<el-col :xs="24" :sm="10">
|
|
|
|
<el-form-item label="Date" prop="date" required>
|
2018-08-31 20:34:12 +00:00
|
|
|
<el-date-picker v-model="account.date" style="width: 100%;" />
|
2017-11-06 03:16:23 +00:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :xs="24" :sm="{span: 3, offset: 2}">
|
|
|
|
<el-form-item label="Subscribe" prop="subscribe">
|
2018-08-31 20:34:12 +00:00
|
|
|
<el-switch v-model="account.subscribe" on-text="" off-text="" />
|
2017-11-06 03:16:23 +00:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row type="flex" justify="flex-start">
|
|
|
|
<el-col :xs="24" :sm="10">
|
|
|
|
<el-form-item label="Rate" prop="rate">
|
2018-08-31 20:34:12 +00:00
|
|
|
<el-rate v-model="account.rate" :colors="['#99A9BF', '#F7BA2A', '#FF9900']" />
|
2017-11-06 03:16:23 +00:00
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :xs="24" :sm="{span: 10, offset: 2}">
|
|
|
|
<el-form-item label="Priority" prop="priority">
|
|
|
|
<el-radio-group v-model="account.priority">
|
|
|
|
<el-radio label="m">Medium</el-radio>
|
|
|
|
<el-radio label="h">High</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-row type="flex" justify="center">
|
|
|
|
<el-button type="primary" @click="submit('elm-demo')">Create</el-button>
|
|
|
|
<el-button @click="reset('elm-demo')">Reset</el-button>
|
|
|
|
</el-row>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
account: {
|
|
|
|
name: '',
|
|
|
|
date: '',
|
|
|
|
subscribe: false,
|
|
|
|
priority: 'm',
|
|
|
|
rate: 5
|
|
|
|
},
|
|
|
|
formRules: {
|
|
|
|
name: [
|
|
|
|
{ required: true, message: 'Account is required', trigger: 'blur' },
|
|
|
|
{ min: 6, message: 'Account\'s length is at least 6', trigger: 'blur' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
submit(formName) {
|
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
this.$message.success('Create successfully !')
|
|
|
|
if (formName === 'popForm') {
|
|
|
|
this.popVisible = false
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
} else {
|
|
|
|
this.$message.warning('Create failed')
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
reset(formName) {
|
|
|
|
this.$refs[formName].resetFields()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.el-select {
|
|
|
|
display: block
|
|
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
.el-row {
|
|
|
|
flex-direction:column;
|
|
|
|
.el-button+.el-button {
|
|
|
|
margin-left: 0px;
|
|
|
|
margin-top: 15px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|