2021-09-17 00:18:50 +08:00
|
|
|
<template>
|
|
|
|
<el-form
|
2021-12-15 16:36:49 +08:00
|
|
|
ref="ruleFormRef"
|
2021-09-17 00:18:50 +08:00
|
|
|
:model="ruleForm"
|
|
|
|
:rules="rules"
|
|
|
|
label-width="120px"
|
|
|
|
class="demo-ruleForm"
|
2021-12-15 16:36:49 +08:00
|
|
|
:size="formSize"
|
2021-09-17 00:18:50 +08:00
|
|
|
>
|
|
|
|
<el-form-item label="Activity name" prop="name">
|
|
|
|
<el-input v-model="ruleForm.name"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Activity zone" prop="region">
|
|
|
|
<el-select v-model="ruleForm.region" placeholder="Activity zone">
|
|
|
|
<el-option label="Zone one" value="shanghai"></el-option>
|
|
|
|
<el-option label="Zone two" value="beijing"></el-option>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Activity time" required>
|
|
|
|
<el-col :span="11">
|
|
|
|
<el-form-item prop="date1">
|
|
|
|
<el-date-picker
|
|
|
|
v-model="ruleForm.date1"
|
|
|
|
type="date"
|
|
|
|
placeholder="Pick a date"
|
|
|
|
style="width: 100%"
|
|
|
|
></el-date-picker>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
2021-12-15 17:32:09 +08:00
|
|
|
<el-col class="text-center" :span="2">
|
|
|
|
<span class="text-gray-500">-</span>
|
2021-12-15 16:36:49 +08:00
|
|
|
</el-col>
|
2021-09-17 00:18:50 +08:00
|
|
|
<el-col :span="11">
|
|
|
|
<el-form-item prop="date2">
|
|
|
|
<el-time-picker
|
|
|
|
v-model="ruleForm.date2"
|
|
|
|
placeholder="Pick a time"
|
|
|
|
style="width: 100%"
|
|
|
|
></el-time-picker>
|
|
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Instant delivery" prop="delivery">
|
|
|
|
<el-switch v-model="ruleForm.delivery"></el-switch>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Activity type" prop="type">
|
|
|
|
<el-checkbox-group v-model="ruleForm.type">
|
|
|
|
<el-checkbox label="Online activities" name="type"></el-checkbox>
|
|
|
|
<el-checkbox label="Promotion activities" name="type"></el-checkbox>
|
|
|
|
<el-checkbox label="Offline activities" name="type"></el-checkbox>
|
|
|
|
<el-checkbox label="Simple brand exposure" name="type"></el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Resources" prop="resource">
|
|
|
|
<el-radio-group v-model="ruleForm.resource">
|
|
|
|
<el-radio label="Sponsorship"></el-radio>
|
|
|
|
<el-radio label="Venue"></el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Activity form" prop="desc">
|
|
|
|
<el-input v-model="ruleForm.desc" type="textarea"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
2021-12-15 16:36:49 +08:00
|
|
|
<el-button type="primary" @click="submitForm(ruleFormRef)"
|
2021-09-17 00:18:50 +08:00
|
|
|
>Create</el-button
|
|
|
|
>
|
2021-12-15 16:36:49 +08:00
|
|
|
<el-button @click="resetForm(ruleFormRef)">Reset</el-button>
|
2021-09-17 00:18:50 +08:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</template>
|
|
|
|
|
2021-12-15 16:36:49 +08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { reactive, ref } from 'vue'
|
|
|
|
// More info see https://github.com/element-plus/element-plus/blob/dev/docs/examples/form/utils.ts
|
|
|
|
import { resetForm, submitForm } from './utils'
|
|
|
|
import type { ElForm } from 'element-plus'
|
|
|
|
|
|
|
|
const formSize = ref('')
|
|
|
|
|
|
|
|
const ruleFormRef = ref<InstanceType<typeof ElForm>>()
|
|
|
|
const ruleForm = reactive({
|
|
|
|
name: '',
|
|
|
|
region: '',
|
|
|
|
date1: '',
|
|
|
|
date2: '',
|
|
|
|
delivery: false,
|
|
|
|
type: [],
|
|
|
|
resource: '',
|
|
|
|
desc: '',
|
|
|
|
})
|
|
|
|
|
|
|
|
const rules = reactive({
|
|
|
|
name: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please input Activity name',
|
|
|
|
trigger: 'blur',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
min: 3,
|
|
|
|
max: 5,
|
|
|
|
message: 'Length should be 3 to 5',
|
|
|
|
trigger: 'blur',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
region: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please select Activity zone',
|
|
|
|
trigger: 'change',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
date1: [
|
|
|
|
{
|
|
|
|
type: 'date',
|
|
|
|
required: true,
|
|
|
|
message: 'Please pick a date',
|
|
|
|
trigger: 'change',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
date2: [
|
|
|
|
{
|
|
|
|
type: 'date',
|
|
|
|
required: true,
|
|
|
|
message: 'Please pick a time',
|
|
|
|
trigger: 'change',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
type: [
|
|
|
|
{
|
|
|
|
type: 'array',
|
|
|
|
required: true,
|
|
|
|
message: 'Please select at least one activity type',
|
|
|
|
trigger: 'change',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
resource: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please select activity resource',
|
|
|
|
trigger: 'change',
|
2021-09-17 00:18:50 +08:00
|
|
|
},
|
2021-12-15 16:36:49 +08:00
|
|
|
],
|
|
|
|
desc: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: 'Please input activity form',
|
|
|
|
trigger: 'blur',
|
2021-09-17 00:18:50 +08:00
|
|
|
},
|
2021-12-15 16:36:49 +08:00
|
|
|
],
|
|
|
|
})
|
2021-09-17 00:18:50 +08:00
|
|
|
</script>
|