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

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

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

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

@ -10,14 +10,29 @@
<a-button type="primary" <a-button type="primary"
:disabled="state.single" :disabled="state.single"
@click="handleEdit()" @click="handleEdit()"
>修改第三方</a-button> >修改企业</a-button>
<a-button type="primary" <a-button type="primary"
:disabled="state.multiple" :disabled="state.multiple"
@click="handleDel()" @click="handleDel()"
>删除第三方</a-button> >删除企业</a-button>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="[ <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: '编辑', label: '编辑',
icon: 'fa6-regular:pen-to-square', icon: 'fa6-regular:pen-to-square',
@ -51,7 +66,12 @@
import ThirdPartyModal from './ThirdPartyModal.vue'; import ThirdPartyModal from './ThirdPartyModal.vue';
import { columns, searchFormSchema } from './thirdParty.data'; import { columns, searchFormSchema } from './thirdParty.data';
import { useMessage } from '/@/hooks/web/useMessage'; 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 { interface TableState {
single: boolean; single: boolean;
@ -84,7 +104,7 @@
clickToRowSelect: false, clickToRowSelect: false,
showIndexColumn: false, showIndexColumn: false,
actionColumn: { actionColumn: {
width: 220, width: 450,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
slots: { customRender: 'action' }, slots: { customRender: 'action' },
@ -114,6 +134,58 @@
openModal(true, { _tag: 'edit', record }); 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) { async function handleDel(record?: Recordable) {
const ids = record?.id || getSelectRowKeys(); const ids = record?.id || getSelectRowKeys();

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

@ -16,11 +16,6 @@
icon: 'fa6-regular:pen-to-square', icon: 'fa6-regular:pen-to-square',
onClick: handleEdit.bind(null, record) onClick: handleEdit.bind(null, record)
}, },
{
label: '推送申请',
icon: 'fa6-regular:pen-to-square',
onClick: handlePushAdd.bind(null, record)
},
{ {
label: '删除', label: '删除',
icon: 'ant-design:delete-outlined', icon: 'ant-design:delete-outlined',
@ -45,15 +40,10 @@
import { reactive, toRaw } from 'vue'; import { reactive, toRaw } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table'; import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { listPushThirdParty, delPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty'; import { listPushThirdParty, delPushThirdParty } from '/@/api/platform/common/controller/pushThirdParty';
import { addPushUserManage } from '/@/api/platform/common/controller/pushUserManage';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import ThirdPartyModal from './ThirdPartyModal.vue'; import ThirdPartyModal from './ThirdPartyModal.vue';
import { columns, searchFormSchema } from './thirdParty.data'; import { columns, searchFormSchema } from './thirdParty.data';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import {useUserStore} from '/@/store/modules/user';
const userStore = useUserStore();
const userInfoStore = userStore.getUserInfo;
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
interface TableState { interface TableState {
@ -117,24 +107,6 @@
openModal(true, { _tag: 'edit', record }); 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) { async function handleDel(record?: Recordable) {
const ids = record?.id || getSelectRowKeys(); const ids = record?.id || getSelectRowKeys();

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

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

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

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

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

@ -27,6 +27,16 @@
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="[ <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: '推送申请', label: '推送申请',
icon: 'fa6-regular:pen-to-square', icon: 'fa6-regular:pen-to-square',
@ -79,6 +89,7 @@
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import {addPushUserManage} from '/@/api/platform/common/controller/pushUserManage'; import {addPushUserManage} from '/@/api/platform/common/controller/pushUserManage';
import {useUserStore} from '/@/store/modules/user'; import {useUserStore} from '/@/store/modules/user';
import {addPushPassList} from '/@/api/platform/common/controller/pushPassList';
const userStore = useUserStore(); const userStore = useUserStore();
const userInfoStore = userStore.getUserInfo; const userInfoStore = userStore.getUserInfo;
@ -136,7 +147,7 @@
showIndexColumn: false, showIndexColumn: false,
searchInfo: state.searchInfo, searchInfo: state.searchInfo,
actionColumn: { actionColumn: {
width: 350, width: 550,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
slots: { customRender: 'action' }, slots: { customRender: 'action' },
@ -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) { function handleSelectionChange(selection?: Recordable) {
const rowSelection = toRaw(selection?.keys) || []; const rowSelection = toRaw(selection?.keys) || [];
@ -216,6 +261,8 @@
} }
return { return {
handleBlacklist,
handleWhitelist,
handlePushAdd, handlePushAdd,
state, state,
registerTable, registerTable,

Loading…
Cancel
Save