5 changed files with 341 additions and 105 deletions
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
<template> |
||||
<BasicModal |
||||
v-bind="$attrs" |
||||
width="720px" |
||||
:showOkBtn="false" |
||||
@register="registerModal" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
import { ref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './chatMessage.data'; |
||||
import { getPushChatMessage } from '/@/api/platform/common/controller/pushChatMessage'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const tag = ref<Nullable<string>>(''); |
||||
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||
const emit = defineEmits(['success', 'register']); |
||||
const [registerForm, { resetFields, setFieldsValue, validate, clearValidate, updateSchema }] = useForm({ |
||||
labelWidth: 100, |
||||
schemas: formSchema, |
||||
showActionButtonGroup: false, |
||||
baseColProps: { span: 24 } |
||||
}); |
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data: WindowInnerData = { _tag: '' }) => { |
||||
// 处理清除脏数据 |
||||
await resetFields(); |
||||
await clearValidate(); |
||||
// 处理设置数据 |
||||
tag.value = data._tag; |
||||
const refId = data.record?.id; |
||||
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||
props.title = '查看推送记录'; |
||||
await setFieldsValue(await getPushChatMessage(refId)); |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
</script> |
@ -0,0 +1,266 @@
@@ -0,0 +1,266 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
import { listPushRingtone } from '/@/api/platform/common/controller/pushRingtone'; |
||||
import { listPushType } from '/@/api/platform/common/controller/pushType'; |
||||
import { h } from 'vue'; |
||||
import { Tag } from 'ant-design-vue'; |
||||
|
||||
/** 表格列配置 */ |
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '通知标题', |
||||
dataIndex: 'title' |
||||
}, |
||||
{ |
||||
title: '通知内容', |
||||
dataIndex: 'text' |
||||
}, |
||||
{ |
||||
title: '播放声音', |
||||
dataIndex: 'playSound', |
||||
width: 80, |
||||
customRender: ({ record }) => { |
||||
const playSound = record?.playSound; |
||||
const enable = ~~playSound === 0; |
||||
const color = enable ? 'green' : 'red'; |
||||
const text = enable ? '是' : '否'; |
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '震动', |
||||
dataIndex: 'playVibrate', |
||||
width: 80, |
||||
customRender: ({ record }) => { |
||||
const playVibrate = record?.playVibrate; |
||||
const enable = ~~playVibrate === 0; |
||||
const color = enable ? 'green' : 'red'; |
||||
const text = enable ? '是' : '否'; |
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '闪光', |
||||
dataIndex: 'playLights', |
||||
width: 80, |
||||
customRender: ({ record }) => { |
||||
const playLights = record?.playLights; |
||||
const enable = ~~playLights === 0; |
||||
const color = enable ? 'green' : 'red'; |
||||
const text = enable ? '是' : '否'; |
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '文字转语音', |
||||
dataIndex: 'playToText', |
||||
width: 120, |
||||
customRender: ({ record }) => { |
||||
const playToText = record?.playToText; |
||||
const enable = ~~playToText === 1; |
||||
const color = enable ? 'green' : 'red'; |
||||
const text = enable ? '是': '否'; |
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '离线铃声', |
||||
dataIndex: 'sound' |
||||
}, |
||||
{ |
||||
title: '自定义通知传输数据', |
||||
dataIndex: 'custom' |
||||
}, |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'title', |
||||
label: '通知标题', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入通知标题', |
||||
}, |
||||
colProps: { span: 6 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'pushTypeId', |
||||
label: '推送类型', |
||||
component: 'ApiSelect', |
||||
componentProps: { |
||||
disabled: true, |
||||
api: listPushType, |
||||
params: { |
||||
size: 99 |
||||
}, |
||||
labelField: 'name', |
||||
valueField: 'id', |
||||
resultField: 'data' |
||||
}, |
||||
}, |
||||
{ |
||||
field: 'status', |
||||
label: '推送状态', |
||||
component: 'Select', |
||||
colProps: { |
||||
span: 12 |
||||
}, |
||||
componentProps: { |
||||
disabled: true, |
||||
options: [ |
||||
{ label: '待审核', value: '0' }, |
||||
{ label: '未读', value: '1' }, |
||||
{ label: '已读', value: '2' } |
||||
] |
||||
} |
||||
}, |
||||
{ |
||||
field: 'aliasType', |
||||
label: '别名类型', |
||||
component: 'Input', |
||||
colProps: { |
||||
span: 12 |
||||
}, |
||||
componentProps: { |
||||
disabled: true |
||||
} |
||||
}, |
||||
{ |
||||
field: 'alias', |
||||
label: '推送别名', |
||||
component: 'Input', |
||||
colProps: { |
||||
span: 12 |
||||
}, |
||||
componentProps: { |
||||
disabled: true |
||||
} |
||||
}, |
||||
{ |
||||
field: 'title', |
||||
label: '通知标题', |
||||
component: 'Input', |
||||
componentProps: { |
||||
disabled: true |
||||
} |
||||
}, |
||||
{ |
||||
field: 'text', |
||||
label: '通知内容', |
||||
component: 'Input', |
||||
componentProps: { |
||||
disabled: true |
||||
} |
||||
}, |
||||
{ |
||||
field: 'playSound', |
||||
label: '播放声音', |
||||
component: 'RadioGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
disabled: true, |
||||
options: [ |
||||
{ label: '是', value: '0' }, |
||||
{ label: '否', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'playVibrate', |
||||
label: '震动', |
||||
component: 'RadioGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
disabled: true, |
||||
options: [ |
||||
{ label: '是', value: '0' }, |
||||
{ label: '否', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'playLights', |
||||
label: '闪光', |
||||
component: 'RadioGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
disabled: true, |
||||
options: [ |
||||
{ label: '是', value: '0' }, |
||||
{ label: '否', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'playToText', |
||||
label: '文字转语音', |
||||
component: 'RadioGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
disabled: true, |
||||
options: [ |
||||
{ label: '否', value: '0' }, |
||||
{ label: '是', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'sound', |
||||
label: '离线铃声', |
||||
component: 'Input', |
||||
componentProps: { |
||||
disabled: true, |
||||
placeholder: '格式为R.raw.[sound]', |
||||
}, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'onlineRingtone', |
||||
label: '在线铃声', |
||||
component: 'ApiSelect', |
||||
componentProps: { |
||||
disabled: true, |
||||
api: listPushRingtone, |
||||
params: { |
||||
size: 99 |
||||
}, |
||||
labelField: 'name', |
||||
valueField: 'id', |
||||
resultField: 'data' |
||||
}, |
||||
}, |
||||
{ |
||||
field: 'custom', |
||||
label: '自定义通知传输数据', |
||||
component: 'InputTextArea', |
||||
componentProps: { |
||||
disabled: true, |
||||
rows: 6 |
||||
}, |
||||
}, |
||||
]; |
@ -1,84 +0,0 @@
@@ -1,84 +0,0 @@
|
||||
import { BasicColumn } from '/@/components/Table'; |
||||
import { FormSchema } from '/@/components/Table'; |
||||
|
||||
/** 表格列配置 */ |
||||
export const columns: BasicColumn[] = [ |
||||
{ |
||||
title: '发送方用户id', |
||||
dataIndex: 'fromUserId' |
||||
}, |
||||
{ |
||||
title: '消息类型', |
||||
dataIndex: 'type' |
||||
}, |
||||
{ |
||||
title: '别名类型', |
||||
dataIndex: 'aliasType' |
||||
}, |
||||
{ |
||||
title: '别名', |
||||
dataIndex: 'alias' |
||||
}, |
||||
{ |
||||
title: '消息显示类型', |
||||
dataIndex: 'displayType' |
||||
}, |
||||
{ |
||||
title: '通知标题', |
||||
dataIndex: 'title' |
||||
}, |
||||
{ |
||||
title: '通知文字描述', |
||||
dataIndex: 'text' |
||||
}, |
||||
{ |
||||
title: '别名类型', |
||||
dataIndex: 'aliasType' |
||||
}, |
||||
{ |
||||
title: '别名类型', |
||||
dataIndex: 'aliasType' |
||||
}, |
||||
{ |
||||
title: '是否播放声音', |
||||
dataIndex: 'playSound', |
||||
customRender: ({record}) => { |
||||
return ~~record?.playSound === 0 ? '是' : '否'; |
||||
} |
||||
}, |
||||
{ |
||||
title: '是否震动', |
||||
dataIndex: 'playVibrate', |
||||
customRender: ({record}) => { |
||||
return ~~record?.playVibrate === 0 ? '是' : '否'; |
||||
} |
||||
}, |
||||
{ |
||||
title: '是否闪光', |
||||
dataIndex: 'playLights', |
||||
customRender: ({record}) => { |
||||
return ~~record?.playLights === 0 ? '是' : '否'; |
||||
} |
||||
}, |
||||
{ |
||||
title: '自定义播放文件名称', |
||||
dataIndex: 'customPlayFileName' |
||||
}, |
||||
{ |
||||
title: '自定义活动点击跳转内容', |
||||
dataIndex: 'custom' |
||||
}, |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'title', |
||||
label: '通知标题', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入通知标题', |
||||
}, |
||||
colProps: { span: 6 } |
||||
} |
||||
]; |
Loading…
Reference in new issue