riku
2025-04-23 f1f26b166b71371e0a8dfaf9b9f575d2d79feefc
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
<template>
  <el-date-picker
    v-model="value1"
    type="datetime"
    placeholder="Select date and time"
  />
</template>
 
<script>
// 网格化方案记录选项
 
import gridSchemeApi from '@/api/grid/gridSchemeApi';
 
export default {
  props: {
    // 是否在首选项处添加“全部”选项
    // allOption: {
    //   type: Boolean,
    //   default: true,
    // },
    // 返回结果
    value: Object
  },
  data() {
    return {
      options: [],
      selectedOptions: {}
    };
  },
  watch: {
    selectedOptions: {
      handler(val) {
        this.$emit('update:value', val);
      },
      deep: true
    }
  },
  methods: {
    getOptions() {
      gridSchemeApi.getGridRecords().then((res) => {
        this.options = res;
        this.selectedOptions = res[0];
      });
    }
  },
  mounted() {
    this.getOptions();
  }
};
</script>