You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <div>
  3. <crud-template class="as-weight" :ref="(el) => (crudRef = el)" :home-data="field" @btnSearch="btnSearch"
  4. @submit="submit" @refreshLeft="refreshLeft" :tableData="tableData" @CurrentChange="handleCurrentChange"
  5. @pageSizeChange="(val) => {
  6. field.paging.currentPage = 1
  7. field.paging.pageSize = val
  8. getList()
  9. }
  10. ">
  11. <template #search>
  12. <el-input maxlength="60" v-trim clearable v-model="searchForm.id" style="width: 200px"
  13. placeholder="请输入消息批量导入记录id" />
  14. <el-select clearable v-model="searchForm.messageClientId" placeholder="请选择客户端" style="width: 200px">
  15. <el-option v-for="item in MESSAGE_TYPE" :key="item.value" :label="item.label" :value="item.value" />
  16. </el-select>
  17. <el-date-picker unlink-panels v-model="timeValue" type="daterange" range-separator="到"
  18. start-placeholder="查询开始日期" end-placeholder="查询结束日期" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD"
  19. @change="dateChangeHandle" :default-time="[
  20. new Date(2000, 1, 1, 0, 0, 0),
  21. new Date(2000, 2, 1, 23, 59, 59),
  22. ]" />
  23. <el-select clearable v-model="searchForm.status" placeholder="请选择审核状态" style="width: 200px">
  24. <el-option v-for="item in AUDIT_STATUS" :key="item.value" :label="item.label" :value="item.value" />
  25. </el-select>
  26. </template>
  27. <template #CustomButton>
  28. <el-button type="primary" @click="handleSmsPush">短信信息推送</el-button>
  29. <el-button type="success" @click="handleWechatPush">公众号信息推送</el-button>
  30. <el-button type="warning" @click="handleAppletPush">小程序信息推送</el-button>
  31. </template>
  32. <template #operation="{ scope }">
  33. <el-button type="success" @click="handleData(scope, 'detail')" size="small">
  34. 详情
  35. </el-button>
  36. <el-button v-if="scope.row.status === '审核中'" type="primary" @click="handleData(scope, 'edit')" size="small">
  37. 编辑
  38. </el-button>
  39. <el-button type="primary" @click="handleData(scope, 'toExamine')" size="small"
  40. v-if="scope.row.status == '审核中'">
  41. 审批
  42. </el-button>
  43. <!-- <el-button type="primary" @click="handleData(scope, 'operation')" size="small">
  44. 操作日志
  45. </el-button> -->
  46. </template>
  47. </crud-template>
  48. <detailDialog
  49. :data-list="selectedData"
  50. :detail-info="[]"
  51. :column="2"
  52. v-model="isDetailShow"
  53. />
  54. <editDialog
  55. :data-list="selectedData"
  56. :MESSAGE_TYPE="MESSAGE_TYPE"
  57. :AUDIT_STATUS="AUDIT_STATUS"
  58. @success="getList"
  59. v-model="isEditShow"
  60. />
  61. <examineApproveDialog @handleSuccess="getList" :data-list="selectedData" v-model="isToExamine" />
  62. <operationDialog :data-list="selectedData" v-model="isOperation" :SHORT_AUDIT_STATE="SHORT_AUDIT_STATE" />
  63. <smsPushDialog v-model="isSmsPushShow" @handleSendSuccess="handleSendSuccess" v-if="updateShow" :dataList="selectedData"
  64. :addOrEditText="addOrEditText" />
  65. <wechatPushDialog v-model="isWechatPushShow" :title="wechatTitle" :dataList="selectedData" @handleSendSuccess="handleSendSuccess"
  66. v-if="updateShow" @handleClose="handleClose" />
  67. <appletPushDialog v-model="isAppletPushShow" :title="appletTitle" :dataList="selectedData" @handleSendSuccess="handleSendSuccess"
  68. v-if="updateShow" @handleClose="handleClose" :miniProgramStateOptions="miniProgramStateOptions"
  69. :langOptions="langOptions" />
  70. </div>
  71. </template>
  72. <!-- 导入信息审批 -->
  73. <script lang="ts" setup>
  74. // @ts-ignore crudFrom模板
  75. import CrudTemplate from '@/crud/index.vue'
  76. import { ref, onMounted, computed, nextTick } from 'vue'
  77. import { ElMessage, genFileId } from 'element-plus'
  78. import { defineAsyncComponent } from 'vue'
  79. const detailDialog = defineAsyncComponent(() => import('@/views/messagePush/pushManagement/components/detailDialog/index.vue'))
  80. const examineApproveDialog = defineAsyncComponent(() => import('./components/examineApproveDialog.vue'))
  81. const operationDialog = defineAsyncComponent(() => import('./components/operationDialog.vue'))
  82. const editDialog = defineAsyncComponent(() => import('./components/editDialog.vue'))
  83. const smsPushDialog = defineAsyncComponent(() => import('@/views/messagePush/pushManagement/shortMessage/components/addOrEditDialog.vue'))
  84. const wechatPushDialog = defineAsyncComponent(() => import('@/views/messagePush/pushManagement/wechatOfficialAccounts/components/addOrEditDialog.vue'))
  85. const appletPushDialog = defineAsyncComponent(() => import('@/views/messagePush/pushManagement/wechatApplet/components/addOrEditDialog.vue'))
  86. // 请求函数
  87. // @ts-ignore
  88. import BaseService from '@/utils/baseService'
  89. //crud配置
  90. import crudConfig from './crudConfig'
  91. // 拿到配置
  92. const { field, sendResultOption } = crudConfig()
  93. const timeValue = ref<any>([])
  94. function dateChangeHandle(val) {
  95. if (val) {
  96. searchForm.value.startTime = val[0]
  97. searchForm.value.endTime = val[1]
  98. } else {
  99. searchForm.value.startTime = ''
  100. searchForm.value.endTime = ''
  101. }
  102. }
  103. onMounted(() => {
  104. getList()
  105. })
  106. //整个crud虚拟dom
  107. const crudRef = ref()
  108. // 获取数据,查询条件
  109. const searchForm = ref({
  110. startTime: '', //开始时间
  111. endTime: '', //结束时间
  112. status: '',
  113. messageClientId: '',
  114. id: '',
  115. })
  116. const tableData = ref([])
  117. // 搜索按钮
  118. function btnSearch() {
  119. field.value.paging.currentPage = 1
  120. getList()
  121. }
  122. const selectedData = ref<any>({})
  123. const isDetailShow = ref(false)
  124. const isToExamine = ref(false)
  125. const isOperation = ref(false)
  126. const isEditShow = ref(false)
  127. const isSmsPushShow = ref(false)
  128. const isWechatPushShow = ref(false)
  129. const isAppletPushShow = ref(false)
  130. const addOrEditText = ref('推送')
  131. const wechatTitle = ref('微信公众号信息推送')
  132. const appletTitle = ref('微信小程序信息推送')
  133. const updateShow = ref(true)
  134. const handleData = (scope, key) => {
  135. console.log(scope)
  136. if (key == 'detail') {
  137. // 传递数据给detailDialog组件,传递applyId和id
  138. selectedData.value = {
  139. applyId: scope.row.id,
  140. id: scope.row.id
  141. }
  142. isDetailShow.value = true
  143. } else if (key == 'edit') {
  144. // 编辑 - 需要传递原始数据,而不是转换后的数据
  145. // 重新获取原始数据用于编辑
  146. crudRef.value.tableLoding = true
  147. BaseService.post('/msgw/importReview/view', {
  148. sendApplyId: scope.row.id
  149. }).then((res: any) => {
  150. crudRef.value.tableLoding = false
  151. if (res && res.code === 0) {
  152. selectedData.value = res.data.apply || scope.row
  153. isEditShow.value = true
  154. } else {
  155. ElMessage.error(res.message || '获取编辑数据失败')
  156. }
  157. }).catch((error) => {
  158. crudRef.value.tableLoding = false
  159. console.error('获取编辑数据失败:', error)
  160. ElMessage.error('获取编辑数据失败')
  161. })
  162. } else if (key == 'toExamine') {
  163. // 审核
  164. isToExamine.value = true
  165. selectedData.value = scope.row
  166. } else {
  167. isOperation.value = true
  168. selectedData.value = scope.row
  169. }
  170. }
  171. // 搜索重置
  172. function refreshLeft() {
  173. field.value.paging.currentPage = 1
  174. searchForm.value = {
  175. startTime: '', //开始时间
  176. endTime: '', //结束时间
  177. status: '',
  178. messageClientId: '',
  179. id: '',
  180. }
  181. tableData.value = []
  182. timeValue.value = []
  183. getList()
  184. }
  185. function submit(row) {
  186. BaseService.postN('/settlew/notice/externalsupplement', {
  187. id: row.id,
  188. diffRes: row.diffRes,
  189. totalAmount: row.totalAmount,
  190. recoverySituation: row.recoverySituation,
  191. }).then((res: any) => {
  192. if (res && res.code === 0) {
  193. crudRef.value.dialogFormVisible = false
  194. getList()
  195. } else {
  196. ElMessage.error(res.message)
  197. }
  198. })
  199. }
  200. // 处理请求参数
  201. const handleParams = () => {
  202. let data: any = {
  203. pageNo: field.value.paging.currentPage,
  204. pageSize: field.value.paging.pageSize,
  205. ...searchForm.value,
  206. }
  207. let params: any = {}
  208. for (let key in data) {
  209. if (data[key] || data[key] === 0) {
  210. params[key] = data[key]
  211. }
  212. }
  213. return params
  214. }
  215. // @ts-ignore
  216. import $storeinitData from '@/store/initData' //引入tab vuex
  217. const SHORT_AUDIT_STATE = computed(() => {
  218. return $storeinitData.state.dictData['SHORT_AUDIT_STATE'] || []
  219. })
  220. // 添加新的字典计算属性
  221. const AUDIT_STATUS = computed(() => {
  222. return $storeinitData.state.dictData['AUDIT_STATUS'] || []
  223. })
  224. const MESSAGE_TYPE = computed(() => {
  225. return $storeinitData.state.dictData['MESSAGE_TYPE'] || []
  226. })
  227. // 小程序相关选项数据
  228. const miniProgramStateOptions = [
  229. { lable: '正式版', value: 'formal' },
  230. { lable: '开发版', value: 'developer' },
  231. { lable: '体验版', value: 'trial' },
  232. ]
  233. const langOptions = [
  234. { lable: '简体中文', value: 'zh_CN' },
  235. { lable: '英文', value: 'en_US' },
  236. { lable: '繁体中文(中国香港)', value: 'zh_HK' },
  237. { lable: '繁体中文(中国台湾)', value: 'zh_TW' },
  238. ]
  239. // 字典转换工具函数
  240. const getDictLabel = (dictList: any[], value: any) => {
  241. const item = dictList.find(item => item.value == value)
  242. return item ? item.label : value
  243. }
  244. // 获取数据
  245. function getList() {
  246. const params = handleParams()
  247. crudRef.value.tableLoding = true //表格loading效果
  248. BaseService.post('/msgw/importReview/page', params).then(
  249. (res: any) => {
  250. crudRef.value.tableLoding = false
  251. if (res && res.code === 0) {
  252. let bizContent = res.data
  253. let data = bizContent.result || []
  254. // console.log(data)
  255. data.forEach((element) => {
  256. // 转换客户端名称 - 使用MESSAGE_TYPE字典
  257. element.messageType = getDictLabel(MESSAGE_TYPE.value, element.messageType)
  258. console.log(element.messageType,'type')
  259. // 转换审核状态 - 使用AUDIT_STATUS字典
  260. element.status = getDictLabel(AUDIT_STATUS.value, element.status)
  261. // // 转换发送结果 - 使用sendResultOption
  262. // element.taskStatus = getDictLabel(sendResultOption, element.sendResult)
  263. })
  264. tableData.value = data
  265. field.value.paging.total = bizContent.totalCount
  266. } else {
  267. ElMessage.error(res.message)
  268. }
  269. }
  270. )
  271. }
  272. // 处理当前页数
  273. function handleCurrentChange(val: number) {
  274. field.value.paging.currentPage = val
  275. getList()
  276. }
  277. // 详情-导入原文件文件下载
  278. const handleDownLoad = (data) => {
  279. console.log(data,'文件下载')
  280. const url = import.meta.env.VITE_APP_UPLOAD_URL + data.attachmentUrl
  281. const fileName = data.attachmentName || data.temUrl.split('/').pop() || ''
  282. BaseService.getDownload(url, fileName, true)
  283. }
  284. // 短信信息推送
  285. const handleSmsPush = () => {
  286. selectedData.value = {}
  287. addOrEditText.value = '推送'
  288. isSmsPushShow.value = true
  289. }
  290. // 公众号信息推送
  291. const handleWechatPush = () => {
  292. selectedData.value = {}
  293. wechatTitle.value = '微信公众号信息推送'
  294. isWechatPushShow.value = true
  295. }
  296. // 小程序信息推送
  297. const handleAppletPush = () => {
  298. selectedData.value = {}
  299. appletTitle.value = '微信小程序信息推送'
  300. isAppletPushShow.value = true
  301. }
  302. // 消息推送后刷新页面
  303. const handleSendSuccess = () => {
  304. getList()
  305. // 重置页面内容
  306. updateShow.value = false
  307. nextTick(() => {
  308. updateShow.value = true
  309. })
  310. }
  311. // 关闭对话框
  312. const handleClose = () => {
  313. selectedData.value = {}
  314. // 重置页面内容
  315. updateShow.value = false
  316. nextTick(() => {
  317. updateShow.value = true
  318. })
  319. }
  320. </script>