riku
2025-03-07 2592dc279ec82bf3649a4dbe644c6416263a10ef
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
  <BaseCard size="middle-s" direction="down">
    <template #content>
      <el-form :inline="true">
        <OptionMission v-model="mission"></OptionMission>
        <OptionType v-model="formSearch.deviceType"></OptionType>
        <OptionDevice
          :type="formSearch.deviceType"
          v-model="formSearch.deviceCode"
        ></OptionDevice>
        <OptionTime
          v-model="formSearch.timeArray"
          :start-date="dateRange[0]"
          :end-date="dateRange[1]"
        ></OptionTime>
        <el-button
          :loading="loading"
          type="primary"
          class="el-button-custom"
          @click="handleClick"
        >
          分析
        </el-button>
      </el-form>
    </template>
  </BaseCard>
</template>
 
<script>
// 搜索框
export default {
  props: {
    loading: Boolean,
    searchTime: Array
  },
  data() {
    return {
      mission: undefined,
      formSearch: {
        deviceType: '',
        deviceCode: '',
        timeArray: []
      },
      // 可选日期范围,根据走航任务决定
      dateRange: []
    };
  },
  emits: ['search'],
  watch: {
    searchTime(nV, oV) {
      if (nV != oV) {
        this.formSearch.timeArray = this.searchTime;
      }
    },
    mission(nV, oV) {
      if (nV != oV) {
        this.formSearch.timeArray = [
          new Date(nV.startTime),
          new Date(nV.endTime)
        ];
        this.dateRange = [new Date(nV.startTime), new Date(nV.endTime)];
        this.formSearch.deviceType = nV.deviceType;
        this.formSearch.deviceCode = nV.deviceCode;
 
        // 代表首次进入界面,此时自动执行首个任务的数据查询操作
        if (oV == undefined) {
          setTimeout(() => {
            this.handleClick();
          }, 500);
        }
      }
    }
  },
  methods: {
    handleClick() {
      this.$emit('search', { ...this.formSearch, mission: this.mission });
    }
  }
};
</script>
<style scoped lang="scss">
.map-date-selector {
  display: inline-block;
  position: relative;
  /* left: 0;
    right: 0;
    top: 0px; */
  /* padding: 0 4px; */
  /* color: ffffffbd; */
  /* background-color: antiquewhite; */
}
 
.p-events-auto {
}
 
.el-form-item {
  margin-bottom: 0px;
  margin-right: 8px !important;
}
</style>