edit-date-time-dialog.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <div>
  3. <el-dialog
  4. title="修改服务单日期"
  5. :visible.sync="isShow"
  6. :show-close="false"
  7. width="400px"
  8. :close-on-click-modal="false"
  9. >
  10. <el-form ref="dateForm" :model="dateForm" :rules="dateFormRules" label-position="left" label-width="80px">
  11. <el-form-item label="选择日期" prop="date">
  12. <el-date-picker
  13. v-model="dateForm.date"
  14. type="datetime"
  15. value-format="yyyy-MM-dd HH:mm:ss"
  16. default-time="00:00:00"
  17. style="width: 100%"
  18. placeholder="选择日期"
  19. >
  20. </el-date-picker>
  21. </el-form-item>
  22. </el-form>
  23. <div slot="footer" class="dialog-footer">
  24. <el-button @click="cancelDateForm">取 消</el-button>
  25. <el-button type="primary" @click="submitDateForm">确 定</el-button>
  26. </div>
  27. </el-dialog>
  28. </div>
  29. </template>
  30. <script>
  31. export default {
  32. name: 'EditDateTimeDialog',
  33. props: {
  34. isShow: {
  35. type: Boolean,
  36. default: false
  37. },
  38. dateForm: {
  39. type: Object,
  40. default: {
  41. date: ''
  42. }
  43. }
  44. },
  45. data() {
  46. return {
  47. dateFormRules: {
  48. date: [{ required: true, message: '请选择服务单日期', trigger: 'change' }]
  49. }
  50. }
  51. },
  52. methods: {
  53. cancelDateForm() {
  54. this.$emit('update:isShow', false)
  55. },
  56. submitDateForm() {
  57. this.$refs.dateForm.validate(valid => {
  58. if (valid) {
  59. this.$parent.submitDateForm()
  60. }
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style></style>