Compare commits

..

No commits in common. "2d9003bca3648fb4f461759c5b2e9aa446160c5c" and "7b7fb5f67ad0a049c15aad0197f6e2aa1b965d37" have entirely different histories.

3 changed files with 14 additions and 93 deletions

View File

@ -4,7 +4,7 @@ export const columns = [
{ {
type: 'selection', type: 'selection',
width: 50, width: 50,
fixed: 'left', fixed:"left"
}, },
{ {
title: 'ID', title: 'ID',
@ -15,24 +15,20 @@ export const columns = [
{ {
title: '消息标题', title: '消息标题',
key: 'title', key: 'title',
width: 250,
}, },
{ {
title: '消息状态', title: '消息状态',
key: 'status', key: 'status',
width: 100,
customRender({ record }) { customRender({ record }) {
return h('span', record.status === 1 ? '已读' : '未读'); return h('span', record.status === 1 ? '已读' : '未读')
}, },
}, },
{ {
title: '创建人', title: '创建人',
key: 'createUser', key: 'createUser',
width: 100,
}, },
{ {
title: '创建时间', title: '创建时间',
key: 'createTime', key: 'createTime',
width: 180,
}, },
]; ];

View File

@ -28,10 +28,6 @@
import { onMounted, reactive } from 'vue'; import { onMounted, reactive } from 'vue';
const emit = defineEmits(['success', 'update:visible']); const emit = defineEmits(['success', 'update:visible']);
/**
* 定义表单参数
*/
const formData = reactive({ const formData = reactive({
id: '', id: '',
title: '', title: '',
@ -41,9 +37,6 @@
content: '', content: '',
}); });
/**
* 定义接收的参数
*/
const props = defineProps({ const props = defineProps({
visible: { visible: {
type: Boolean, type: Boolean,
@ -56,26 +49,16 @@
default: 0, default: 0,
}, },
}); });
/**
* 定义模态
*/
const [modalRegister, { openModal }] = useModal({ const [modalRegister, { openModal }] = useModal({
title: '日志详情', title: '日志详情',
subBtuText: '确定', subBtuText: '确定',
width: 600, width: 600,
}); });
/**
* 关闭弹窗
*/
const dialogClose = () => { const dialogClose = () => {
emit('update:visible', false); emit('update:visible', false);
}; };
/**
* 设置表单参数
*/
const setFormData = async () => { const setFormData = async () => {
const data = await getMessageDetail(props.messageId); const data = await getMessageDetail(props.messageId);
for (const key in formData) { for (const key in formData) {
@ -85,11 +68,6 @@
} }
} }
}; };
/**
* 获取类型文本描述
* @param type 类型
*/
const getTyepText = (type) => { const getTyepText = (type) => {
let typeText = ''; let typeText = '';
switch (type) { switch (type) {
@ -108,18 +86,12 @@
return typeText; return typeText;
}; };
/**
* 钩子函数
*/
onMounted(() => { onMounted(() => {
if (props.messageId) { if (props.messageId) {
setFormData(); setFormData();
} }
}); });
//
/**
* 定义函数
*/
defineExpose({ defineExpose({
openModal, openModal,
}); });

View File

@ -43,7 +43,8 @@
v-model:visible="editVisible" v-model:visible="editVisible"
ref="createModalRef" ref="createModalRef"
@success="reloadTable('noRefresh')" @success="reloadTable('noRefresh')"
/> >
</editDialog>
</PageWrapper> </PageWrapper>
</template> </template>
@ -61,29 +62,10 @@
import editDialog from './edit.vue'; import editDialog from './edit.vue';
import { useMessage, useDialog } from 'naive-ui'; import { useMessage, useDialog } from 'naive-ui';
import { renderIcon } from '@/utils'; import { renderIcon } from '@/utils';
/**
* 定义参数
*/
const messageId = ref(0); const messageId = ref(0);
const message = useMessage(); const message = useMessage();
const dialog = useDialog(); const dialog = useDialog();
const activeName = ref(1); const activeName = ref(1);
const editVisible = ref(false);
const createModalRef = ref();
const selectionData = ref([]);
const tableRef = ref();
/**
* 定义查询参数
*/
const formParams = reactive({
type: 1,
});
/**
* 定义数据源
*/
const messageTypeList = ref([ const messageTypeList = ref([
{ {
name: '系统通知', name: '系统通知',
@ -98,11 +80,14 @@
value: 3, value: 3,
}, },
]); ]);
const editVisible = ref(false);
const createModalRef = ref();
const selectionData = ref([]);
const tableRef = ref();
const formParams = reactive({
type: 1,
});
/**
* 加载数据列表
* @param res 参数
*/
const loadDataTable = async (res: any) => { const loadDataTable = async (res: any) => {
selectionData.value = []; selectionData.value = [];
const result = await getMessageProfile({ ...formParams, ...res }); const result = await getMessageProfile({ ...formParams, ...res });
@ -110,10 +95,6 @@
item.number = result.number; item.number = result.number;
return result; return result;
}; };
/**
* 定义操作栏
*/
const actionColumn = reactive({ const actionColumn = reactive({
width: 300, width: 300,
title: '操作', title: '操作',
@ -134,7 +115,7 @@
label: '详情', label: '详情',
icon: renderIcon(EyeOutlined), icon: renderIcon(EyeOutlined),
type: 'info', type: 'info',
onClick: handleDetail.bind(null, record), onClick: handleInfo.bind(null, record),
}, },
{ {
label: '删除', label: '删除',
@ -146,40 +127,22 @@
}); });
}, },
}); });
/**
* 刷新数据列表
* @param noRefresh 参数
*/
function reloadTable(noRefresh = '') { function reloadTable(noRefresh = '') {
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 }); tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
} }
/**
* 执行点击事件
* @param e 参数
*/
const handleClick = (e) => { const handleClick = (e) => {
activeName.value = e; activeName.value = e;
formParams.type = e; formParams.type = e;
reloadTable(); reloadTable();
}; };
/** const handleInfo = async (record) => {
* 执行查看详情
* @param record 参数
*/
const handleDetail = async (record) => {
messageId.value = record.id; messageId.value = record.id;
editVisible.value = true; editVisible.value = true;
await nextTick(); await nextTick();
createModalRef.value.openModal(); createModalRef.value.openModal();
}; };
/**
* 执行删除
* @param record 参数
*/
async function handleDelete(record) { async function handleDelete(record) {
dialog.warning({ dialog.warning({
title: '提示', title: '提示',
@ -193,11 +156,6 @@
}, },
}); });
} }
/**
* 执行设置已读
* @param id 参数
*/
async function handleSetRead(id) { async function handleSetRead(id) {
dialog.warning({ dialog.warning({
title: '提示', title: '提示',
@ -211,11 +169,6 @@
}, },
}); });
} }
/**
* 数据行选中事件
* @param value 参数
*/
function onSelectionChange(value) { function onSelectionChange(value) {
selectionData.value = value; selectionData.value = value;
} }