----短信发送记录完成

This commit is contained in:
2026-03-19 09:23:08 +08:00
parent 6cfb1c77c5
commit 7f9dc11e54
7 changed files with 223 additions and 13 deletions

View File

@ -0,0 +1,115 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
<template v-if="column.dataIndex === 'sendStatus'">
{{ record.sendStatus== "SUCCESS" ? "成功" : "失败" }}
</template>
</template>
</BasicTable>
</PageWrapper>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { BasicTable, useTable, ActionItem, TableAction, TableColumn } from '/@/components/Table'
import { getLngSmsRecordPage,resend } from '/@/api/system/LngSmsTemplate'
import { FormProps, FormSchema } from '/@/components/Form';
import { useRoute, useRouter } from 'vue-router'
const { currentRoute } = useRouter();
const SMS_CODE = currentRoute.value.query.code;
const tableRef = ref();
const searchFormSchema: FormSchema[] = [
{
field: 'phone',
label: '手机号码',
component: 'Input',
},
{
field: 'sendStatus',
label: '发送状态',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '2034176559801901058' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
}
];
const customSearchFormSchema =ref(searchFormSchema);
function getActions(record: Recordable):ActionItem[] {
if (record.sendStatus != "SUCCESS") {
return [
{
icon: 'ant-design:reload-outlined',
tooltip: '重新发送',
onClick: function(record: Recordable){
console.log(arguments);
resend(record.id).then(() => {
tableRef.value.reload();
});
}.bind(null, record)
}
];
}
return [];
}
const [registerTable, { reload }] = useTable({
title: '短信记录',
api: (params) => getLngSmsRecordPage({ ...params, code: SMS_CODE }),
columns: [
{ dataIndex: 'code', title: '模板编码', width: 120 },
{ dataIndex: 'phone', title: '手机号码', width: 100 },
{ dataIndex: 'content', title: '内容', width: 200 },
{ dataIndex: 'createDate', title: '发送时间', width: 90 },
{ dataIndex: 'sendStatus', title: '状态', width: 60 },
{ dataIndex: 'errorMessage', title: '错误信息', width: 120 },
],
rowKey: 'id',
pagination: { pageSize: 10 },
scroll: { x: 1200 },
useSearchForm: true,
formConfig: {
rowProps: {gutter: 16},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false,
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
striped: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
})
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>

View File

@ -20,7 +20,7 @@
</template>
</BasicTable>
<LngSmsTemplateModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper>
</template>
<script lang="ts" setup>
@ -63,9 +63,15 @@
const tableRef = ref();
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
const buttons = ref([
{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},
{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},
{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},
{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},
{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},
{"isUse":true,"name":"推送记录","code":"sendRecord","icon":"ant-design:share-alt-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','sendRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
@ -74,11 +80,15 @@
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,delete : handleDelete,}
console.log(buttonConfigs.value)
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,delete : handleDelete, sendRecord : handleSendRecord}
const { currentRoute } = useRouter();
const router = useRouter();
@ -169,6 +179,14 @@
modalVisible.value = true
logId.value = record.id
}
function handleSendRecord(record: Recordable) {
router.push({
path: '/system/LngSmsTemplate/LngSmsRecord',
query: {
code: record.code
}
});
}
function handleAdd() {
// if (schemaIdComputedRef.value) {