doum
3 天以前 66b84de58e3efae14c1e258ee716e02ad9557497
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<template>
  <TableLayout :permissions="['business:carevent:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="" prop="phone">
        <el-input v-model="searchForm.phone" placeholder="请输入手机号/邮箱地址" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <!--      <el-form-item label="" prop="type">
        <el-select v-model="searchForm.type" @keypress.enter.native="search" clearable placeholder="类型">
          <el-option label="短信" value="0"></el-option>
          <el-option label="邮箱" value="1"></el-option>
          <el-option label="微信公众号通知" value="2"></el-option>
        </el-select>
      </el-form-item>-->
      <el-form-item label="" prop="objType">
        <el-select v-model="searchForm.objType" @keypress.enter.native="search" clearable placeholder="业务类型">
          <el-option label="验证码" value="0"></el-option>
          <el-option label="访客申请" value="1"></el-option>
          <el-option label="访客报备" value="2"></el-option>
          <el-option label="隐患随手拍" value="3"></el-option>
          <el-option label="用车申请" value="4"></el-option>
          <el-option label="会议室信息" value="5"></el-option>
          <el-option label="物流车预约" value="6"></el-option>
          <el-option label="物流车作业" value="7"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="起始时间" prop="eventType">
        <!-- <el-date-picker @change="seleTime" v-model="time" type="datetimerange" format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
        </el-date-picker> -->
        <el-date-picker type="datetime" v-model="searchForm.startTime" value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择开始时间" @change="changeRadio" />
        <el-date-picker type="datetime" v-model="searchForm.endTime" value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="请选择结束时间" @change="changeRadio" />
      </el-form-item>
      <el-radio-group v-model="searchForm.radio" size="small" @input="changeRadio">
        <el-radio-button label="0">当天</el-radio-button>
        <el-radio-button label="1">近7天</el-radio-button>
        <el-radio-button label="2">近30天</el-radio-button>
      </el-radio-group>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <el-table :height="tableHeightNew" v-loading="isWorking.search" :data="tableData.list" stripe>
        <el-table-column prop="phone" label="手机号/邮箱" min-width="150px">
          <template slot-scope="{ row }">
            <span v-if="row.type == 0">{{ row.phone }}</span>
            <span v-if="row.type == 1">{{ row.email }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="title" label="标题" min-width="100px"></el-table-column>
        <el-table-column prop="content" label="内容" min-width="300px"></el-table-column>
        <el-table-column label="类型" min-width="100px">
          <template slot-scope="{ row }">
            <span v-if="row.type == 0">短信</span>
            <span v-if="row.type == 1">邮件</span>
            <span v-if="row.type == 2">微信公众号通知</span>
          </template>
        </el-table-column>
        <el-table-column label="状态" min-width="100px">
          <template slot-scope="{ row }">
            <span v-if="row.status == 0">未使用</span>
            <span v-if="row.status == 1">已使用</span>
            <span v-if="row.status == 2">等待发送</span>
          </template>
        </el-table-column>
        <el-table-column label="业务类型" min-width="100px">
          <template slot-scope="{ row }">
            <span v-if="row.objType == 0">验证码</span>
            <span v-if="row.objType == 1">访客</span>
            <span v-if="row.objType == 2">访客报备</span>
            <span v-if="row.objType == 3">隐患随手拍</span>
            <span v-if="row.objType == 4">用车申请</span>
            <span v-if="row.objType == 5">会议室信息</span>
            <span v-if="row.objType == 6">物流车预约</span>
            <span v-if="row.objType == 7">物流车作业</span>
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="发送时间" min-width="100px"></el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination">
      </pagination>
    </template>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import { timeForMat } from '@/utils/util'
export default {
  name: 'CarEvent',
  extends: BaseTable,
  components: { TableLayout, Pagination },
  data() {
    return {
      // 搜索
      searchForm: {
        phone: '',
        type: null,
        objType: null,
        startTime: '',
        endTime: '',
        radio: '0'
      },
      time: []
    }
  },
  created() {
    this.config({
      module: '短信邮箱发送记录',
      api: '/business/smsEmail',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.changeRadio('0')
    // this.search()
  },
  methods: {
    reset() {
      this.$refs.searchForm.resetFields()
      this.searchForm = {
        phone: '',
        type: null,
        objType: null,
        startTime: '',
        endTime: '',
        radio: '0'
      }
      this.searchForm = {}
      this.time = []
      this.search()
    },
    changeRadio(e) {
      if (e === '0') {
        this.searchForm.startTime = timeForMat(0)[0]
        this.searchForm.endTime = timeForMat(0)[1]
      } else if (e === '1') {
        this.searchForm.startTime = timeForMat(6)[0]
        this.searchForm.endTime = timeForMat(6)[1]
      } else if (e === '2') {
        this.searchForm.startTime = timeForMat(29)[0]
        this.searchForm.endTime = timeForMat(29)[1]
      } else {
        this.searchForm.radio = ''
      }
      if (this.searchForm.startTime && this.searchForm.endTime && new Date(this.searchForm.startTime).getTime() > new Date(this.searchForm.endTime).getTime()) {
        this.$message.error('开始时间不能大于结束时间')
        this.searchForm.startTime = ''
        return
      }
      this.search()
    },
    seleTime(e) {
      this.searchForm.startTime = e[0]
      this.searchForm.endTime = e[1]
      this.searchForm.radio = null
      this.search()
    }
  }
}
</script>