123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <template>
- <div>
- <crud-template class="as-weight" :ref="(el) => (crudRef = el)" :home-data="field" @refreshLeft="refreshLeft"
- :tableData="tableData" @btnSearch="btnSearch" @CurrentChange="handleCurrentChange"
- @pageSizeChange="pageSizeChange">
- <template #search>
- <el-input maxlength="60" v-trim clearable v-model="searchForm.id" style="width: 200px"
- placeholder="请输入消息记录id" />
- <el-input maxlength="60" v-trim clearable v-model="searchForm.title" style="width: 200px"
- placeholder="请输入消息标题" />
- <el-date-picker unlink-panels v-model="timeValue" type="datetimerange" range-separator="到"
- start-placeholder="查询开始日期" end-placeholder="查询结束日期" value-format="YYYY-MM-DD HH:mm:ss"
- format="YYYY-MM-DD HH:mm:ss" @change="dateChangeHandle" :default-time="defaultTime" />
- <el-select clearable v-model="searchForm.sendResult" placeholder="请选择发送状态" style="width: 200px">
- <el-option v-for="item in sendResultOption" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </template>
- <template #searchCustomButton>
- <el-button type="primary" icon="Upload" @click="isUploadShow = true">
- 导入
- </el-button>
- </template>
- <template #CustomButton>
- <el-button type="primary" @click="handleAdd">短信信息推送</el-button>
- </template>
- <template #operation="{ scope }">
- <el-button type="success" @click="handleData(scope, 'detail')" size="small">
- 详情
- </el-button>
- <el-button type="primary" @click="handleData(scope, 'edit')" size="small"
- v-if="scope.row.sendResult === 'WAIT'">
- 编辑
- </el-button>
- <el-button type="warning" @click="retransmission(scope)" size="small" v-if="handleShow(scope)">
- 重发消息
- </el-button>
- </template>
- </crud-template>
- <addOrEditDialog v-model="isShow" @handleSendSuccess="handleSendSuccess" v-if="updateShow" :dataList="selectedData"
- :addOrEditText="addOrEditText" />
- <detailDialog v-model="isDetailShow" :dataList="selectedData" :detailInfo="detailInfo" :column="2" />
- <uploadDialog v-model="isUploadShow" :messageType="searchForm.messageType" messageImportType="HLTSHORT" />
- </div>
- </template>
-
- <!-- 短信信息推送 -->
- <script lang="ts" setup>
- // @ts-ignore crudFrom模板
- import CrudTemplate from '@/crud/index.vue'
- import { ref, onMounted, onBeforeMount, nextTick } from 'vue'
- import addOrEditDialog from './components/addOrEditDialog.vue'
- import detailDialog from '@/views/messagePush/pushManagement/components/detailDialog/index.vue'
- import uploadDialog from '@/views/messagePush/pushManagement/components/uploadDialog/index.vue'
-
- import {
- sendResultOption,
- handleInit,
- } from '@/views/messagePush/pushManagement/components/common'
- import crudConfig from '@/views/messagePush/pushManagement/components/commonCrudConfig'
- // @ts-ignore
- import BaseService from '@/utils/baseService'
- import { ElMessage } from 'element-plus'
-
- // 拿到配置
- const { field } = crudConfig({
- searchOperation: {
- isTemplate: true,
- templateUrl:
- import.meta.env.VITE_APP_UPLOAD_URL +
- 'sett-minio/template/消息推送/短信消息批量发送模板.xlsx',
- templateFileName: '短信消息批量发送模板',
- },
- })
-
- // 获取数据,查询条件
- const searchForm = ref({
- startTime: '', //开始时间
- endTime: '', //结束时间
- tradingDate: '', id: '',
- title: '', //标题
- messageType: 'SHORT', //消息类型
- messageChannel: 'HLT_SHORT', //消息渠道
- sendResult: '', //发送结果
- })
-
- // 搜索重置
- function refreshLeft() {
- field.value.paging.currentPage = 1
- searchForm.value = {
- id: '',
- startTime: '', //开始时间
- endTime: '', //结束时间
- tradingDate: '',
- title: '', //标题
- messageType: 'SHORT', //消息类型
- messageChannel: 'HLT_SHORT', //消息渠道
- sendResult: '', //发送结果
- }
- getList()
- tableData.value = []
- }
-
- const {
- timeValue,
- isUploadShow,
- dateChangeHandle,
- defaultTime,
- crudRef,
- tableData,
- getList,
- btnSearch,
- handleCurrentChange,
- pageSizeChange,
- retransmission,
- handleShow,
- } = handleInit(searchForm, field)
-
- const isShow = ref(false)
- const isDetailShow = ref(false)
- const isEditShow = ref(false)
- const selectedData = ref<any>({})
- const addOrEditText = ref('推送')
- const handleAdd = () => {
- selectedData.value = {}
- nextTick(() => {
- addOrEditText.value = '推送'
- isShow.value = true
- })
- }
- const handleData = (scope, key) => {
- console.log(scope)
- if (key == 'detail') {
- isDetailShow.value = true
- } else {
- addOrEditText.value = '修改'
- isShow.value = true
- }
- selectedData.value = scope.row
- }
-
- const mobileListHide = (detailList, userShow) => {
- if (!userShow && !detailList.importMessage) {
- return false
- } else {
- return true
- }
- }
- const detailInfo = [
- {
- label: '消息内容',
- key: 'message',
- isDisImport: true,
- // isHide: isMessage, //可隐藏
- },
- {
- label: '导入文件下载',
- key: 'excelUrl',
- // isHide: importMessage, //可隐藏
- isImport: true, // 导入展示
- type: 'button',
- btnLabel: '文件下载',
- handleBtn(data) {
- // 下载文件
- const url = import.meta.env.VITE_APP_UPLOAD_URL + data.excelUrl
- const fileName = data.fileName || data.excelUrl.split('/').pop() || ''
- BaseService.getDownload(url, fileName, true)
- },
- },
- {
- label: '文件名',
- key: 'fileName',
- isImport: true, // 导入展示
- },
- {
- label: '手机号',
- key: 'mobileList',
- type: 'tag',
- isHide: mobileListHide, //可隐藏
- },
- ]
- // 消息推送后刷新页面
- const updateShow = ref(true)
- const handleSendSuccess = () => {
- getList()
- // 重置页面内容
- updateShow.value = false
- nextTick(() => {
- updateShow.value = true
- })
- }
- </script>
|