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
<template>
  <el-card shadow="never">
    <template #header>
      <div><el-text tag="b" size="large">产品生成选项</el-text></div>
    </template>
    <SearchBar
      v-show="active"
      ref="refSearchBar"
      :btn-show="false"
      :init="false"
      @on-submit="search"
    >
    </SearchBar>
    <template #footer>
      <el-row v-show="active" justify="end">
        <el-button
          type="primary"
          size="default"
          :loading="loading"
          @click="submit"
          >生成</el-button
        >
      </el-row>
    </template>
  </el-card>
</template>
<script setup>
import { ref, computed } from 'vue';
import dayjs from 'dayjs';
 
const props = defineProps({
  loading: {
    type: Boolean,
    default: false
  },
  active:{
    type: Boolean,
    default: true
  }
});
const emit = defineEmits(['submit']);
 
const refSearchBar = ref(null);
 
const submit = () => {
  refSearchBar.value.onSubmit();
};
 
const search = (options) => {
  const opt = {
    topTaskId: options.topTask.tguid,
    topTaskName: options.topTask.name,
    provinceCode: options.topTask.provincecode,
    provinceName: options.topTask.provincename,
    cityCode: options.topTask.citycode,
    cityName: options.topTask.cityname,
    districtCode: options.topTask.districtcode,
    districtName: options.topTask.districtname,
    townCode: options.topTask.towncode,
    townName: options.topTask.townname,
    startTime: dayjs(options.topTask.starttime).format('YYYY-MM-DD HH:mm:ss'),
    endTime: dayjs(options.topTask.endtime)
      .add(1, 'day')
      .add(-1, 'second')
      .format('YYYY-MM-DD HH:mm:ss'),
    sceneTypeId: options.sceneTypeId,
    sceneTypeName: options.sceneTypeName,
    needCache: true
  };
  emit('submit', opt);
};
</script>