MrShi
2025-03-12 69a1b3bf45738f048361ee4ccb6bdc64fce35720
admin/src/views/business/smsEmail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,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>