cc8647e6092c013dbd5234a744234ebd82903baf.svn-base 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div class="input-cron">
  3. <a-input :placeholder="placeholder" v-model="editCronValue" :disabled="disabled">
  4. <a slot="addonAfter" @click="showConfigDlg" class="config-btn" :disabled="disabled">
  5. <a-icon type="setting"></a-icon>
  6. 选择
  7. </a>
  8. </a-input>
  9. <j-modal :visible.sync="show" title="Cron表达式" width="800px">
  10. <easy-cron
  11. v-model="editCronValue"
  12. :exeStartTime="exeStartTime"
  13. :hideYear="hideYear"
  14. :remote="remote"
  15. :hideSecond="hideSecond"
  16. style="width: 100%"
  17. ></easy-cron>
  18. </j-modal>
  19. </div>
  20. </template>
  21. <script>
  22. import EasyCron from './EasyCron.vue'
  23. export default {
  24. name: 'input-cron',
  25. components: {EasyCron},
  26. model: {
  27. prop: 'cronValue',
  28. event: 'change'
  29. },
  30. props: {
  31. cronValue: {
  32. type: String,
  33. default: ''
  34. },
  35. width: {
  36. type: String,
  37. default: '800px'
  38. },
  39. placeholder: {
  40. type: String,
  41. default: '请输入cron表达式'
  42. },
  43. disabled: {
  44. type: Boolean,
  45. default: false
  46. },
  47. exeStartTime: {
  48. type: [Number, String, Object],
  49. default: 0
  50. },
  51. hideSecond: {
  52. type: Boolean,
  53. default: false
  54. },
  55. hideYear: {
  56. type: Boolean,
  57. default: false
  58. },
  59. remote: {
  60. type: Function,
  61. default: null
  62. }
  63. },
  64. data() {
  65. return {
  66. editCronValue: this.cronValue,
  67. show: false,
  68. }
  69. },
  70. watch: {
  71. cronValue(newVal, oldVal) {
  72. if (newVal === this.editCronValue) {
  73. return
  74. }
  75. this.editCronValue = newVal
  76. },
  77. editCronValue(newVal, oldVal) {
  78. this.$emit('change', newVal)
  79. }
  80. },
  81. methods: {
  82. showConfigDlg() {
  83. if (!this.disabled) {
  84. this.show = true
  85. }
  86. }
  87. }
  88. }
  89. </script>
  90. <style scoped>
  91. .config-btn {
  92. cursor: pointer;
  93. }
  94. </style>