Browse Source

🚀 消息推送模块

master
wangxiang 2 years ago
parent
commit
4531e7fd10
  1. 19
      src/views/common/push/pushBlacklist/index.vue
  2. 26
      src/views/common/push/pushBlacklist/passList.data.ts
  3. 78
      src/views/common/push/pushThirdParty/index.vue
  4. 28
      src/views/common/push/pushTodoThirdParty/index.vue
  5. 19
      src/views/common/push/pushWhitelist/index.vue
  6. 25
      src/views/common/push/pushWhitelist/passList.data.ts
  7. 49
      src/views/system/user/index.vue

19
src/views/common/push/pushBlacklist/index.vue

@ -4,27 +4,22 @@ @@ -4,27 +4,22 @@
@selection-change="handleSelectionChange"
>
<template #toolbar>
<a-button type="primary"
<!--<a-button type="primary"
@click="handleAdd()"
>新增黑名单</a-button>
<a-button type="primary"
:disabled="state.single"
@click="handleEdit()"
>修改黑名单</a-button>
>修改黑名单</a-button>-->
<a-button type="primary"
:disabled="state.multiple"
@click="handleDel()"
>除黑名单</a-button>
>除黑名单</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="[
{
label: '编辑',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record)
},
{
label: '删除',
label: '移除',
icon: 'ant-design:delete-outlined',
color: 'error',
onClick: handleDel.bind(null, record)
@ -93,7 +88,7 @@ @@ -93,7 +88,7 @@
fixed: false
},
searchInfo: {
type: "0"
type: '0'
},
handleSearchInfoFn: () => clearSelectedRowKeys()
});
@ -122,10 +117,10 @@ @@ -122,10 +117,10 @@
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认除编号为${ids}的数据?`,
content: `是否确认除编号为${ids}的数据?`,
onOk: async () => {
await delPushPassList(ids);
createMessage.success('除成功!');
createMessage.success('除成功!');
handleRefreshTable();
}
});

26
src/views/common/push/pushBlacklist/passList.data.ts

@ -4,12 +4,12 @@ import { FormSchema } from '/@/components/Table'; @@ -4,12 +4,12 @@ import { FormSchema } from '/@/components/Table';
/** 表格列配置 */
export const columns: BasicColumn[] = [
{
title: '推送名称',
dataIndex: 'name'
title: '发送方用户id',
dataIndex: 'fromPushId'
},
{
title: '推送ID',
dataIndex: 'pushManageId'
title: '对方用户id',
dataIndex: 'toPushId'
},
{
title: '创建人',
@ -25,11 +25,11 @@ export const columns: BasicColumn[] = [ @@ -25,11 +25,11 @@ export const columns: BasicColumn[] = [
/** 搜索表单配置 */
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '推送名称',
field: 'fromPushId',
label: '发送方用户id',
component: 'Input',
componentProps: {
placeholder: '请输入推送名称',
placeholder: '请输入发送方用户id',
},
colProps: { span: 6 }
}
@ -45,14 +45,14 @@ export const formSchema: FormSchema[] = [ @@ -45,14 +45,14 @@ export const formSchema: FormSchema[] = [
},
{
field: 'type',
label: '名单类型',
label: '名单类型',
component: 'Input',
defaultValue: "0",
defaultValue: '0',
show: false
},
{
field: 'name',
label: '推送名称',
field: 'fromPushId',
label: '发送方用户id',
component: 'Input',
required: true,
colProps: {
@ -60,8 +60,8 @@ export const formSchema: FormSchema[] = [ @@ -60,8 +60,8 @@ export const formSchema: FormSchema[] = [
}
},
{
field: 'pushManageId',
label: '推送ID',
field: 'toPushId',
label: '对方用户id',
component: 'Input',
required: true,
colProps: {

78
src/views/common/push/pushThirdParty/index.vue vendored

@ -10,14 +10,29 @@ @@ -10,14 +10,29 @@
<a-button type="primary"
:disabled="state.single"
@click="handleEdit()"
>修改第三方</a-button>
>修改企业</a-button>
<a-button type="primary"
:disabled="state.multiple"
@click="handleDel()"
>删除第三方</a-button>
>删除企业</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="[
{
label: '加入黑名单',
icon: 'fa6-regular:pen-to-square',
onClick: handleBlacklist.bind(null, record)
},
{
label: '加入白名单',
icon: 'fa6-regular:pen-to-square',
onClick: handleWhitelist.bind(null, record)
},
{
label: '推送申请',
icon: 'fa6-regular:pen-to-square',
onClick: handlePushAdd.bind(null, record)
},
{
label: '编辑',
icon: 'fa6-regular:pen-to-square',
@ -51,7 +66,12 @@ @@ -51,7 +66,12 @@
import ThirdPartyModal from './ThirdPartyModal.vue';
import { columns, searchFormSchema } from './thirdParty.data';
import { useMessage } from '/@/hooks/web/useMessage';
import { addPushPassList } from '/@/api/platform/common/controller/pushPassList';
import { addPushUserManage } from '/@/api/platform/common/controller/pushUserManage';
import {useUserStore} from '/@/store/modules/user';
const userStore = useUserStore();
const userInfoStore = userStore.getUserInfo;
/** 类型规范统一声明定义区域 */
interface TableState {
single: boolean;
@ -84,7 +104,7 @@ @@ -84,7 +104,7 @@
clickToRowSelect: false,
showIndexColumn: false,
actionColumn: {
width: 220,
width: 450,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
@ -114,6 +134,58 @@ @@ -114,6 +134,58 @@
openModal(true, { _tag: 'edit', record });
}
function handleWhitelist(record?: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否添加白名单编号为${record?.userId}的数据?`,
onOk: async () => {
await addPushPassList({
fromPushId: record?.userId,
toPushId: userInfoStore.id,
type: '1'
});
createMessage.success('添加成功!');
handleRefreshTable();
}
});
}
function handleBlacklist(record?: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否添加黑名单编号为${record?.userId}的数据?`,
onOk: async () => {
await addPushPassList({
fromPushId: record?.userId,
toPushId: userInfoStore.id,
type: '0'
});
createMessage.success('添加成功!');
handleRefreshTable();
}
});
}
function handlePushAdd(record?: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否添加推送申请编号为${record?.userId}的数据?`,
onOk: async () => {
await addPushUserManage({
fromUserId: record?.userId,
toUserId: userInfoStore.id,
userName: record?.entName,
type: '1'
});
createMessage.success('申请成功!');
handleRefreshTable();
}
});
}
/** 删除按钮操作,行内删除 */
async function handleDel(record?: Recordable) {
const ids = record?.id || getSelectRowKeys();

28
src/views/common/push/pushTodoThirdParty/index.vue vendored

@ -16,11 +16,6 @@ @@ -16,11 +16,6 @@
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record)
},
{
label: '推送申请',
icon: 'fa6-regular:pen-to-square',
onClick: handlePushAdd.bind(null, record)
},
{
label: '删除',
icon: 'ant-design:delete-outlined',
@ -45,15 +40,10 @@ @@ -45,15 +40,10 @@
import { reactive, toRaw } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { listPushThirdParty, delPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty';
import { addPushUserManage } from '/@/api/platform/common/controller/pushUserManage';
import { useModal } from '/@/components/Modal';
import ThirdPartyModal from './ThirdPartyModal.vue';
import { columns, searchFormSchema } from './thirdParty.data';
import { useMessage } from '/@/hooks/web/useMessage';
import {useUserStore} from '/@/store/modules/user';
const userStore = useUserStore();
const userInfoStore = userStore.getUserInfo;
/** 类型规范统一声明定义区域 */
interface TableState {
@ -117,24 +107,6 @@ @@ -117,24 +107,6 @@
openModal(true, { _tag: 'edit', record });
}
function handlePushAdd(record?: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否添加推送申请编号为${record?.userId}的数据?`,
onOk: async () => {
await addPushUserManage({
fromUserId: record?.userId,
toUserId: userInfoStore.id,
userName: record?.entName,
type: '1'
});
createMessage.success('申请成功!');
handleRefreshTable();
}
});
}
/** 删除按钮操作,行内删除 */
async function handleDel(record?: Recordable) {
const ids = record?.id || getSelectRowKeys();

19
src/views/common/push/pushWhitelist/index.vue

@ -4,27 +4,22 @@ @@ -4,27 +4,22 @@
@selection-change="handleSelectionChange"
>
<template #toolbar>
<a-button type="primary"
<!--<a-button type="primary"
@click="handleAdd()"
>新增白名单</a-button>
<a-button type="primary"
:disabled="state.single"
@click="handleEdit()"
>修改白名单</a-button>
>修改白名单</a-button>-->
<a-button type="primary"
:disabled="state.multiple"
@click="handleDel()"
>除白名单</a-button>
>除白名单</a-button>
</template>
<template #action="{ record }">
<TableAction :actions="[
{
label: '编辑',
icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record)
},
{
label: '删除',
label: '移除',
icon: 'ant-design:delete-outlined',
color: 'error',
onClick: handleDel.bind(null, record)
@ -91,7 +86,7 @@ @@ -91,7 +86,7 @@
fixed: false
},
searchInfo: {
type: "1"
type: '1'
},
handleSearchInfoFn: () => clearSelectedRowKeys()
});
@ -120,10 +115,10 @@ @@ -120,10 +115,10 @@
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否确认除编号为${ids}的数据?`,
content: `是否确认除编号为${ids}的数据?`,
onOk: async () => {
await delPushPassList(ids);
createMessage.success('除成功!');
createMessage.success('除成功!');
handleRefreshTable();
}
});

25
src/views/common/push/pushWhitelist/passList.data.ts

@ -4,12 +4,12 @@ import { FormSchema } from '/@/components/Table'; @@ -4,12 +4,12 @@ import { FormSchema } from '/@/components/Table';
/** 表格列配置 */
export const columns: BasicColumn[] = [
{
title: '推送名称',
dataIndex: 'name'
title: '发送方用户id',
dataIndex: 'fromPushId'
},
{
title: '推送ID',
dataIndex: 'pushManageId'
title: '对方用户id',
dataIndex: 'toPushId'
},
{
title: '创建人',
@ -25,11 +25,11 @@ export const columns: BasicColumn[] = [ @@ -25,11 +25,11 @@ export const columns: BasicColumn[] = [
/** 搜索表单配置 */
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '推送名称',
field: 'fromPushId',
label: '发送方用户id',
component: 'Input',
componentProps: {
placeholder: '请输入推送名称',
placeholder: '请输入发送方用户id',
},
colProps: { span: 6 }
}
@ -47,11 +47,12 @@ export const formSchema: FormSchema[] = [ @@ -47,11 +47,12 @@ export const formSchema: FormSchema[] = [
field: 'type',
label: '白名单类型',
component: 'Input',
defaultValue: '1'
defaultValue: '1',
show: false
},
{
field: 'name',
label: '推送名称',
field: 'fromPushId',
label: '发送方用户id',
component: 'Input',
required: true,
colProps: {
@ -59,8 +60,8 @@ export const formSchema: FormSchema[] = [ @@ -59,8 +60,8 @@ export const formSchema: FormSchema[] = [
}
},
{
field: 'pushManageId',
label: '推送ID',
field: 'toPushId',
label: '对方用户id',
component: 'Input',
required: true,
colProps: {

49
src/views/system/user/index.vue

@ -27,6 +27,16 @@ @@ -27,6 +27,16 @@
</template>
<template #action="{ record }">
<TableAction :actions="[
{
label: '加入黑名单',
icon: 'fa6-regular:pen-to-square',
onClick: handleBlacklist.bind(null, record)
},
{
label: '加入白名单',
icon: 'fa6-regular:pen-to-square',
onClick: handleWhitelist.bind(null, record)
},
{
label: '推送申请',
icon: 'fa6-regular:pen-to-square',
@ -79,6 +89,7 @@ @@ -79,6 +89,7 @@
import { useMessage } from '/@/hooks/web/useMessage';
import {addPushUserManage} from '/@/api/platform/common/controller/pushUserManage';
import {useUserStore} from '/@/store/modules/user';
import {addPushPassList} from '/@/api/platform/common/controller/pushPassList';
const userStore = useUserStore();
const userInfoStore = userStore.getUserInfo;
@ -136,7 +147,7 @@ @@ -136,7 +147,7 @@
showIndexColumn: false,
searchInfo: state.searchInfo,
actionColumn: {
width: 350,
width: 550,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
@ -163,6 +174,40 @@ @@ -163,6 +174,40 @@
});
}
function handleWhitelist(record?: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否添加白名单编号为${record?.userId}的数据?`,
onOk: async () => {
await addPushPassList({
fromPushId: record?.userId,
toPushId: userInfoStore.id,
type: '1'
});
createMessage.success('添加成功!');
handleRefreshTable();
}
});
}
function handleBlacklist(record?: Recordable) {
createConfirm({
iconType: 'warning',
title: '警告',
content: `是否添加黑名单编号为${record?.userId}的数据?`,
onOk: async () => {
await addPushPassList({
fromPushId: record?.userId,
toPushId: userInfoStore.id,
type: '0'
});
createMessage.success('添加成功!');
handleRefreshTable();
}
});
}
/** 处理多选框选中数据 */
function handleSelectionChange(selection?: Recordable) {
const rowSelection = toRaw(selection?.keys) || [];
@ -216,6 +261,8 @@ @@ -216,6 +261,8 @@
}
return {
handleBlacklist,
handleWhitelist,
handlePushAdd,
state,
registerTable,

Loading…
Cancel
Save