Blame view

ant-design-vue-jeecg/src/components/jeecg/JCron.vue 1.42 KB
肖超群 authored
1
2
3
4
5
6
7
8
9
10
<template>
  <div class="components-input-demo-presuffix">
    <a-input @click="openModal" placeholder="cron表达式" v-model="cron" @change="(e)=>handleOK(e.target.value)">
      <a-icon slot="prefix" type="schedule" title="cron控件"/>
      <a-icon v-if="cron" slot="suffix" type="close-circle" @click="handleEmpty" title="清空"/>
    </a-input>
    <JCronModal ref="innerVueCron" :data="cron" @ok="handleOK"></JCronModal>
  </div>
</template>
<script>
肖超群 authored
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
import JCronModal from "./modal/JCronModal";

export default {
  name: 'JCron',
  components: {
    JCronModal
  },
  props: {
    value: {
      required: false,
      type: String,
    }
  },
  data() {
    return {
      cron: this.value,
    }
  },
  watch: {
    value(val) {
      this.cron = val
    }
  },
  methods: {
    openModal() {
      this.$refs.innerVueCron.show();
肖超群 authored
37
    },
肖超群 authored
38
39
40
41
    handleOK(val) {
      this.cron = val;
      this.$emit("change", this.cron);
      //this.$emit("change", Object.assign({},  this.cron));
肖超群 authored
42
    },
肖超群 authored
43
44
    handleEmpty() {
      this.handleOK('')
肖超群 authored
45
    }
肖超群 authored
46
47
48
49
  },
  model: {
    prop: 'value',
    event: 'change'
肖超群 authored
50
  }
肖超群 authored
51
}
肖超群 authored
52
53
</script>
<style scoped>
肖超群 authored
54
55
56
57
58
59
60
61
62
63
64
65
66
67
.components-input-demo-presuffix .anticon-close-circle {
  cursor: pointer;
  color: #ccc;
  transition: color 0.3s;
  font-size: 12px;
}

.components-input-demo-presuffix .anticon-close-circle:hover {
  color: #f5222d;
}

.components-input-demo-presuffix .anticon-close-circle:active {
  color: #666;
}
肖超群 authored
68
</style>