timeDialog.js 1.85 KB
Newer Older
刘弈臻's avatar
刘弈臻 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
'use strict';

var timeDialog = {
  data: function data() {
    return {
      form: {
        jobId: '',
        beanName: '',
        methodName: '',
        params: '',
        cronExpression: '',
        remark: ''
      },
      props: [{
        prop: 'beanName',
        label: 'bean名称',
        inputType: 'input'
      }, {
        prop: 'methodName',
        label: '方法名称',
        inputType: 'input'
      }, {
        prop: 'params',
        label: '参数',
        inputType: 'input'
      }, {
        prop: 'cronExpression',
        label: 'cron表达式',
        inputType: 'input'
      }, {
        prop: 'remark',
        label: '备注',
        inputType: 'input'
      }],
      rules: {
        beanName: [{ required: true, message: '不能为空', trigger: 'blur' }],
        methodName: [{ required: true, message: '不能为空', trigger: 'blur' }],
        cronExpression: [{ required: true, message: '不能为空', trigger: 'blur' }]
      }
    };
  },
  methods: {
    // Dialog 打开的回调
    openDialogHandle: function openDialogHandle() {
      if (this.title === CONFIG.EDIT) {
        this.validate('timeForm');
      }
      if (this.title === CONFIG.EDIT || this.title === CONFIG.ADD) {
        this.clearValidate('timeForm');
      }
    },
    // Dialog 关闭的回调
    closeDialogHandle: function closeDialogHandle() {
      if (this.title === CONFIG.EDIT || this.title === CONFIG.ADD) {
        this.clearForm('timeForm');
      }
    },

    // 确定
    confirmHandle: function confirmHandle() {
      this.$refs.timeForm.submitHandle();
      this.close('timeDialog');
    },
    submitHandle: function submitHandle(data) {
      this.close('timeDialog');
    },
    cancelHandle: function cancelHandle() {
      this.close('timeDialog');
    }
  }
};