Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

index.vue 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <div>
  3. <crud-template class="as-weight" :ref="(el) => (crudRef = el)" :home-data="field" @refreshLeft="refreshLeft"
  4. :tableData="tableData" @btnSearch="btnSearch" @CurrentChange="handleCurrentChange"
  5. @pageSizeChange="pageSizeChange">
  6. <template #search>
  7. <el-input maxlength="60" v-trim clearable v-model="searchForm.id" style="width: 200px"
  8. placeholder="请输入消息记录id" />
  9. <el-input maxlength="60" v-trim clearable v-model="searchForm.title" style="width: 200px"
  10. placeholder="请输入消息标题" />
  11. <el-date-picker unlink-panels v-model="timeValue" type="datetimerange" range-separator="到"
  12. start-placeholder="查询开始日期" end-placeholder="查询结束日期" value-format="YYYY-MM-DD HH:mm:ss"
  13. format="YYYY-MM-DD HH:mm:ss" @change="dateChangeHandle" :default-time="defaultTime" />
  14. <el-select clearable v-model="searchForm.sendResult" placeholder="请选择发送状态" style="width: 200px">
  15. <el-option v-for="item in sendResultOption" :key="item.value" :label="item.label" :value="item.value" />
  16. </el-select>
  17. </template>
  18. <template #searchCustomButton>
  19. <el-button type="primary" icon="Upload" @click="isUploadShow = true">
  20. 导入
  21. </el-button>
  22. </template>
  23. <template #CustomButton>
  24. <el-button type="primary" @click="handleAdd">短信信息推送</el-button>
  25. </template>
  26. <template #operation="{ scope }">
  27. <el-button type="success" @click="handleData(scope, 'detail')" size="small">
  28. 详情
  29. </el-button>
  30. <el-button type="primary" @click="handleData(scope, 'edit')" size="small"
  31. v-if="scope.row.sendResult === 'WAIT'">
  32. 编辑
  33. </el-button>
  34. <el-button type="warning" @click="retransmission(scope)" size="small" v-if="handleShow(scope)">
  35. 重发消息
  36. </el-button>
  37. </template>
  38. </crud-template>
  39. <addOrEditDialog v-model="isShow" @handleSendSuccess="handleSendSuccess" v-if="updateShow" :dataList="selectedData"
  40. :addOrEditText="addOrEditText" />
  41. <detailDialog v-model="isDetailShow" :dataList="selectedData" :detailInfo="detailInfo" :column="2" />
  42. <uploadDialog v-model="isUploadShow" :messageType="searchForm.messageType" messageImportType="HLTSHORT" />
  43. </div>
  44. </template>
  45. <!-- 短信信息推送 -->
  46. <script lang="ts" setup>
  47. // @ts-ignore crudFrom模板
  48. import CrudTemplate from '@/crud/index.vue'
  49. import { ref, onMounted, onBeforeMount, nextTick } from 'vue'
  50. import addOrEditDialog from './components/addOrEditDialog.vue'
  51. import detailDialog from '@/views/messagePush/pushManagement/components/detailDialog/index.vue'
  52. import uploadDialog from '@/views/messagePush/pushManagement/components/uploadDialog/index.vue'
  53. import {
  54. sendResultOption,
  55. handleInit,
  56. } from '@/views/messagePush/pushManagement/components/common'
  57. import crudConfig from '@/views/messagePush/pushManagement/components/commonCrudConfig'
  58. // @ts-ignore
  59. import BaseService from '@/utils/baseService'
  60. import { ElMessage } from 'element-plus'
  61. // 拿到配置
  62. const { field } = crudConfig({
  63. searchOperation: {
  64. isTemplate: true,
  65. templateUrl:
  66. import.meta.env.VITE_APP_UPLOAD_URL +
  67. 'sett-minio/template/消息推送/短信消息批量发送模板.xlsx',
  68. templateFileName: '短信消息批量发送模板',
  69. },
  70. })
  71. // 获取数据,查询条件
  72. const searchForm = ref({
  73. startTime: '', //开始时间
  74. endTime: '', //结束时间
  75. tradingDate: '', id: '',
  76. title: '', //标题
  77. messageType: 'SHORT', //消息类型
  78. messageChannel: 'HLT_SHORT', //消息渠道
  79. sendResult: '', //发送结果
  80. })
  81. // 搜索重置
  82. function refreshLeft() {
  83. field.value.paging.currentPage = 1
  84. searchForm.value = {
  85. id: '',
  86. startTime: '', //开始时间
  87. endTime: '', //结束时间
  88. tradingDate: '',
  89. title: '', //标题
  90. messageType: 'SHORT', //消息类型
  91. messageChannel: 'HLT_SHORT', //消息渠道
  92. sendResult: '', //发送结果
  93. }
  94. getList()
  95. tableData.value = []
  96. }
  97. const {
  98. timeValue,
  99. isUploadShow,
  100. dateChangeHandle,
  101. defaultTime,
  102. crudRef,
  103. tableData,
  104. getList,
  105. btnSearch,
  106. handleCurrentChange,
  107. pageSizeChange,
  108. retransmission,
  109. handleShow,
  110. } = handleInit(searchForm, field)
  111. const isShow = ref(false)
  112. const isDetailShow = ref(false)
  113. const isEditShow = ref(false)
  114. const selectedData = ref<any>({})
  115. const addOrEditText = ref('推送')
  116. const handleAdd = () => {
  117. selectedData.value = {}
  118. nextTick(() => {
  119. addOrEditText.value = '推送'
  120. isShow.value = true
  121. })
  122. }
  123. const handleData = (scope, key) => {
  124. console.log(scope)
  125. if (key == 'detail') {
  126. isDetailShow.value = true
  127. } else {
  128. addOrEditText.value = '修改'
  129. isShow.value = true
  130. }
  131. selectedData.value = scope.row
  132. }
  133. const mobileListHide = (detailList, userShow) => {
  134. if (!userShow && !detailList.importMessage) {
  135. return false
  136. } else {
  137. return true
  138. }
  139. }
  140. const detailInfo = [
  141. {
  142. label: '消息内容',
  143. key: 'message',
  144. isDisImport: true,
  145. // isHide: isMessage, //可隐藏
  146. },
  147. {
  148. label: '导入文件下载',
  149. key: 'excelUrl',
  150. // isHide: importMessage, //可隐藏
  151. isImport: true, // 导入展示
  152. type: 'button',
  153. btnLabel: '文件下载',
  154. handleBtn(data) {
  155. // 下载文件
  156. const url = import.meta.env.VITE_APP_UPLOAD_URL + data.excelUrl
  157. const fileName = data.fileName || data.excelUrl.split('/').pop() || ''
  158. BaseService.getDownload(url, fileName, true)
  159. },
  160. },
  161. {
  162. label: '文件名',
  163. key: 'fileName',
  164. isImport: true, // 导入展示
  165. },
  166. {
  167. label: '手机号',
  168. key: 'mobileList',
  169. type: 'tag',
  170. isHide: mobileListHide, //可隐藏
  171. },
  172. ]
  173. // 消息推送后刷新页面
  174. const updateShow = ref(true)
  175. const handleSendSuccess = () => {
  176. getList()
  177. // 重置页面内容
  178. updateShow.value = false
  179. nextTick(() => {
  180. updateShow.value = true
  181. })
  182. }
  183. </script>