import {defineComponent, onMounted, reactive, ref} from 'vue' import SaveForm from '@components/save-form' import {DataTableRowKey, NButton, NDataTable, NDatePicker, NFormItem, NInput, NSelect, NSpace, useDialog, useMessage} from 'naive-ui' import Pagination from '@components/pagination' import {getMapValueByKey, getSelectDataFromObj} from '@/utils/objectUtil' import {clientType, messageSenderFunctionModule, messageSendStatus} from '@/utils/constant' import {getTimes} from "@/utils/dateUtil"; import {sysMessagePage} from "@views/message/api"; import TheTooltip from "@components/TheTooltip"; export default defineComponent({ name: 'sms-record', props: { appKey: { type: String, required: true } }, setup(props) { const dialog = useDialog() const message = useMessage() const state = reactive({ loading: false, appId: null as any, pagination: { page: 1, rows: 10, pageTotal: 0 }, searchForm: { title: null, //消息名称 clientId: null, //客户端 group: null, // 功能模块 sendTime: null, // 发送时间 status: null, // 发送状态 receiver: null, // 接收人手机号 }, dataList: [] }) onMounted(async () => { getList() }) const saveForm = ref() const onSearch = () => { saveForm.value?.submit() } const onBtnReset = () => { saveForm.value?.reset() } const onSubmit = () => { state.pagination.page = 1 getList() } const checkedRowKeysRef = ref([]) const handleCheck = (rowKeys: DataTableRowKey[]) => { checkedRowKeysRef.value = rowKeys } const getList = async () => { try { state.loading = true const {data} = await sysMessagePage({ ...state.pagination, ...state.searchForm, appKey: props.appKey, sendMode: 'SMS', ...getTimes(state.searchForm.sendTime, ['sendTimeStart', 'sendTimeEnd']), }) state.pagination.pageTotal = Number(data.total) state.dataList = data.rows || [] } catch { } state.loading = false } const columns = (): any => { return [ { title: '标题', key: 'title' }, { title: '消息内容', key: 'content', render: (row: any) => { return ( ) } }, { title: '发送时间', key: 'sendTime' }, { title: '发送对象', key: 'clientId', render: (row: any) => { return (
{getMapValueByKey(row.clientId, new Map(Object.entries(clientType)))}
) } }, { title: '接收人姓名', key: 'username' }, { title: '接收人手机号', key: 'receiver' }, { title: '发送平台', key: 'senderName' }, { title: '发送状态', key: 'status', render: (row: any) => { return (
{getMapValueByKey(row.status, new Map(Object.entries(messageSendStatus)))}
) } }, { title: '读取状态', key: 'readStatus', render: (row: any) => { return (
{row.readStatus ? '已读' : '未读'}
) } }, { title: '功能模块', key: 'group', render: (row: any) => { return (
{getMapValueByKey(row.group, new Map(Object.entries(messageSenderFunctionModule)))}
) } }, { title: '触发条件', key: 'triggerCondition' }, { title: '错误信息', key: 'errorMsg', render: (row: any) => { return ( ) } }, ] } return () => { return (
(state.searchForm = val)} > 搜索 重置
row.id} scrollX={'1400'} >
) } } })