bf5b821504b53ea56c9255b2b2dafd49e90cc15e.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <a-form @submit="handleSubmit" :form="form" class="form">
  3. <a-row class="form-row" :gutter="16">
  4. <a-col :lg="6" :md="12" :sm="24">
  5. <a-form-item
  6. label="任务名">
  7. <a-input placeholder="请输入任务名称" v-decorator="[ 'task.name', {rules: [{ required: true, message: '请输入任务名称', whitespace: true}]} ]" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col :xl="{span: 7, offset: 1}" :lg="{span: 8}" :md="{span: 12}" :sm="24">
  11. <a-form-item
  12. label="任务描述">
  13. <a-input placeholder="请输入任务描述" v-decorator="[ 'task.description', {rules: [{ required: true, message: '请输入任务描述', whitespace: true}]} ]" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :xl="{span: 9, offset: 1}" :lg="{span: 10}" :md="{span: 24}" :sm="24">
  17. <a-form-item
  18. label="执行人">
  19. <a-select
  20. placeholder="请选择执行人"
  21. v-decorator="[
  22. 'task.executor',
  23. {rules: [{ required: true, message: '请选择执行人'}]}
  24. ]" >
  25. <a-select-option value="黄丽丽">黄丽丽</a-select-option>
  26. <a-select-option value="李大刀">李大刀</a-select-option>
  27. </a-select>
  28. </a-form-item>
  29. </a-col>
  30. </a-row>
  31. <a-row class="form-row" :gutter="16">
  32. <a-col :lg="6" :md="12" :sm="24">
  33. <a-form-item
  34. label="责任人">
  35. <a-select
  36. placeholder="请选择责任人"
  37. v-decorator="[
  38. 'task.manager',
  39. {rules: [{ required: true, message: '请选择责任人'}]}
  40. ]" >
  41. <a-select-option value="王伟">王伟</a-select-option>
  42. <a-select-option value="李红军">李红军</a-select-option>
  43. </a-select>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :xl="{span: 7, offset: 1}" :lg="{span: 8}" :md="{span: 12}" :sm="24">
  47. <a-form-item
  48. label="提醒时间">
  49. <a-time-picker
  50. style="width: 100%"
  51. v-decorator="[
  52. 'task.time',
  53. {rules: [{ required: true, message: '请选择提醒时间'}]}
  54. ]" />
  55. </a-form-item>
  56. </a-col>
  57. <a-col :xl="{span: 9, offset: 1}" :lg="{span: 10}" :md="{span: 24}" :sm="24">
  58. <a-form-item
  59. label="任务类型">
  60. <a-select
  61. placeholder="请选择任务类型"
  62. v-decorator="[ 'task.type', {rules: [{ required: true, message: '请选择任务类型'}]} ]" >
  63. <a-select-option value="定时执行">定时执行</a-select-option>
  64. <a-select-option value="周期执行">周期执行</a-select-option>
  65. </a-select>
  66. </a-form-item>
  67. </a-col>
  68. </a-row>
  69. <a-form-item v-if="showSubmit">
  70. <a-button htmlType="submit" >Submit</a-button>
  71. </a-form-item>
  72. </a-form>
  73. </template>
  74. <script>
  75. export default {
  76. name: "TaskForm",
  77. props: {
  78. showSubmit: {
  79. type: Boolean,
  80. default: false
  81. }
  82. },
  83. data () {
  84. return {
  85. form: this.$form.createForm(this)
  86. }
  87. },
  88. methods: {
  89. handleSubmit (e) {
  90. e.preventDefault()
  91. this.form.validateFields((err, values) => {
  92. if (!err) {
  93. this.$notification['error']({
  94. message: 'Received values of form:',
  95. description: values
  96. })
  97. }
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style scoped>
  104. </style>