Blame view

ant-design-vue-jeecg/src/views/examples/form/advancedForm/TaskForm.vue 3.42 KB
肖超群 authored
1
2
3
4
5
6
<template>
  <a-form @submit="handleSubmit" :form="form" class="form">
    <a-row class="form-row" :gutter="16">
      <a-col :lg="6" :md="12" :sm="24">
        <a-form-item
          label="任务名">
肖超群 authored
7
8
          <a-input placeholder="请输入任务名称"
                   v-decorator="[ 'task.name', {rules: [{ required: true, message: '请输入任务名称', whitespace: true}]} ]"/>
肖超群 authored
9
10
11
12
13
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 7, offset: 1}" :lg="{span: 8}" :md="{span: 12}" :sm="24">
        <a-form-item
          label="任务描述">
肖超群 authored
14
15
          <a-input placeholder="请输入任务描述"
                   v-decorator="[ 'task.description', {rules: [{ required: true, message: '请输入任务描述', whitespace: true}]} ]"/>
肖超群 authored
16
17
18
19
20
21
22
23
24
25
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 9, offset: 1}" :lg="{span: 10}" :md="{span: 24}" :sm="24">
        <a-form-item
          label="执行人">
          <a-select
            placeholder="请选择执行人"
            v-decorator="[
              'task.executor',
              {rules: [{ required: true, message: '请选择执行人'}]}
肖超群 authored
26
            ]">
肖超群 authored
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
            <a-select-option value="黄丽丽">黄丽丽</a-select-option>
            <a-select-option value="李大刀">李大刀</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-row class="form-row" :gutter="16">
      <a-col :lg="6" :md="12" :sm="24">
        <a-form-item
          label="责任人">
          <a-select
            placeholder="请选择责任人"
            v-decorator="[
              'task.manager',
              {rules: [{ required: true, message: '请选择责任人'}]}
肖超群 authored
42
            ]">
肖超群 authored
43
44
45
46
47
48
49
50
51
52
53
54
55
            <a-select-option value="王伟">王伟</a-select-option>
            <a-select-option value="李红军">李红军</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 7, offset: 1}" :lg="{span: 8}" :md="{span: 12}" :sm="24">
        <a-form-item
          label="提醒时间">
          <a-time-picker
            style="width: 100%"
            v-decorator="[
              'task.time',
              {rules: [{ required: true, message: '请选择提醒时间'}]}
肖超群 authored
56
            ]"/>
肖超群 authored
57
58
59
60
61
62
63
        </a-form-item>
      </a-col>
      <a-col :xl="{span: 9, offset: 1}" :lg="{span: 10}" :md="{span: 24}" :sm="24">
        <a-form-item
          label="任务类型">
          <a-select
            placeholder="请选择任务类型"
肖超群 authored
64
            v-decorator="[ 'task.type', {rules: [{ required: true, message: '请选择任务类型'}]} ]">
肖超群 authored
65
66
67
68
69
70
71
            <a-select-option value="定时执行">定时执行</a-select-option>
            <a-select-option value="周期执行">周期执行</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-form-item v-if="showSubmit">
肖超群 authored
72
      <a-button htmlType="submit">Submit</a-button>
肖超群 authored
73
74
75
76
77
    </a-form-item>
  </a-form>
</template>

<script>
肖超群 authored
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
export default {
  name: "TaskForm",
  props: {
    showSubmit: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      form: this.$form.createForm(this)
    }
  },
  methods: {
    handleSubmit(e) {
      e.preventDefault()
      this.form.validateFields((err, values) => {
        if (!err) {
          this.$notification['error']({
            message: 'Received values of form:',
            description: values
          })
        }
      })
肖超群 authored
102
103
    }
  }
肖超群 authored
104
}
肖超群 authored
105
106
107
108
109
</script>

<style scoped>

</style>