From 9df378bfd083dca53f892c167642c8cb4359d57d Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Tue, 28 Mar 2023 15:49:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E9=BB=91?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../push/pushApplication/application.data.ts | 96 ++------------ .../push/pushBlacklist/BlacklistModal.vue | 45 +++++++ .../push/pushBlacklist/PassListModal.vue | 87 ------------- .../push/pushBlacklist/blacklist.data.ts | 118 ++++++++++++++++++ src/views/common/push/pushBlacklist/index.vue | 45 +++---- .../push/pushBlacklist/passList.data.ts | 71 ----------- 6 files changed, 193 insertions(+), 269 deletions(-) create mode 100644 src/views/common/push/pushBlacklist/BlacklistModal.vue delete mode 100644 src/views/common/push/pushBlacklist/PassListModal.vue create mode 100644 src/views/common/push/pushBlacklist/blacklist.data.ts delete mode 100644 src/views/common/push/pushBlacklist/passList.data.ts diff --git a/src/views/common/push/pushApplication/application.data.ts b/src/views/common/push/pushApplication/application.data.ts index ddca0c3..7493511 100644 --- a/src/views/common/push/pushApplication/application.data.ts +++ b/src/views/common/push/pushApplication/application.data.ts @@ -2,12 +2,7 @@ import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { h } from 'vue'; import { Tag } from 'ant-design-vue'; -import { listPushFile } from '/@/api/platform/common/controller/pushFile'; -import { useUserStore } from '/@/store/modules/user'; -import { listPushCustomType } from '/@/api/platform/common/controller/pushCustomType'; - -const userStore = useUserStore(); -const userInfoStore = userStore.getUserInfo; +import { listPushType } from '/@/api/platform/common/controller/pushType'; /** 表格列配置 */ export const columns: BasicColumn[] = [ @@ -28,8 +23,8 @@ export const columns: BasicColumn[] = [ } }, { - title: '限制ip', - dataIndex: 'ip' + title: '忽略ip', + dataIndex: 'ignoreIp' }, { title: '创建人', @@ -81,8 +76,8 @@ export const formSchema: FormSchema[] = [ } }, { - field: 'ip', - label: '限制ip', + field: 'ignoreIp', + label: '忽略ip', component: 'Input', colProps: { span: 12 @@ -118,8 +113,8 @@ export const formSchema: FormSchema[] = [ export const sendFormSchema: FormSchema[] = [ { - field: 'fromUserId', - label: '发送方用户id', + field: 'userId', + label: '推送方用户id', component: 'Input', show: false }, @@ -151,37 +146,11 @@ export const sendFormSchema: FormSchema[] = [ } }, { - label: '自定义通知声音', - field: 'sound', - component: 'Input', - componentProps: { - placeholder: '格式为R.raw.[sound]', - }, - colProps: { - span: 24 - } - }, - { - field: 'customPlayFileName', - label: '播放文件名称', + field: 'pushTypeId', + label: '推送类型', component: 'ApiSelect', componentProps: { - api: listPushFile, - params: { - size: 99, - createById: userInfoStore.id - }, - labelField: 'original', - valueField: 'original', - resultField: 'data' - }, - }, - { - field: 'customTypeId', - label: '自定义推送类型ID', - component: 'ApiSelect', - componentProps: { - api: listPushCustomType, + api: listPushType, params: { size: 99 }, @@ -190,49 +159,4 @@ export const sendFormSchema: FormSchema[] = [ resultField: 'data' }, }, - { - field: 'playVibrate', - label: '收到通知是否震动', - component: 'RadioGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '是', value: '0' }, - { label: '否', value: '1' } - ] - }, - colProps: { - span: 12 - } - }, - { - field: 'playLights', - label: '收到通知是否闪灯', - component: 'RadioGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '是', value: '0' }, - { label: '否', value: '1' } - ] - }, - colProps: { - span: 12 - } - }, - { - field: 'playSound', - label: '收到通知是否发出声音', - component: 'RadioGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '是', value: '0' }, - { label: '否', value: '1' } - ] - }, - colProps: { - span: 12 - } - }, ]; diff --git a/src/views/common/push/pushBlacklist/BlacklistModal.vue b/src/views/common/push/pushBlacklist/BlacklistModal.vue new file mode 100644 index 0000000..56a3a65 --- /dev/null +++ b/src/views/common/push/pushBlacklist/BlacklistModal.vue @@ -0,0 +1,45 @@ + + diff --git a/src/views/common/push/pushBlacklist/PassListModal.vue b/src/views/common/push/pushBlacklist/PassListModal.vue deleted file mode 100644 index fb4262d..0000000 --- a/src/views/common/push/pushBlacklist/PassListModal.vue +++ /dev/null @@ -1,87 +0,0 @@ - - diff --git a/src/views/common/push/pushBlacklist/blacklist.data.ts b/src/views/common/push/pushBlacklist/blacklist.data.ts new file mode 100644 index 0000000..11d4eef --- /dev/null +++ b/src/views/common/push/pushBlacklist/blacklist.data.ts @@ -0,0 +1,118 @@ +import { BasicColumn } from '/@/components/Table'; +import { FormSchema } from '/@/components/Table'; +import { h } from 'vue'; +import { Tag } from 'ant-design-vue'; + +/** 表格列配置 */ +export const columns: BasicColumn[] = [ + { + title: '昵称', + dataIndex: 'nickName' + }, + { + title: '性别', + dataIndex: 'sex', + width: 80, + customRender: ({ record }) => { + const sex = record.sex; + const enable = ~~sex === 0; + const color = enable ? 'green' : 'red'; + const text = enable ? '男' : '女'; + return h(Tag, { color: color }, () => text); + } + }, + { + title: '手机号', + dataIndex: 'phone' + }, + { + title: '邮箱', + dataIndex: 'email' + }, + { + title: '所属部门', + dataIndex: 'deptName' + }, + { + title: '创建人', + dataIndex: 'createByName' + }, + { + title: '创建时间', + dataIndex: 'createTime', + width: 200 + }, +]; + +/** 搜索表单配置 */ +export const searchFormSchema: FormSchema[] = [ + { + field: 'nickName', + label: '昵称', + component: 'Input', + componentProps: { + placeholder: '请输入昵称', + }, + colProps: { span: 6 } + } +]; + +/** 表单配置 */ +export const formSchema: FormSchema[] = [ + { + field: 'id', + label: 'ID', + component: 'Input', + show: false + }, + { + field: 'nickName', + label: '昵称', + component: 'Input', + componentProps: { + disabled: true + } + }, + { + field: 'deptName', + label: '所属部门', + component: 'Input', + colProps: { + span: 12 + }, + componentProps: { + disabled: true + } + }, + { + field: 'sex', + label: '性别', + component: 'Select', + colProps: { + span: 12 + }, + componentProps: { + disabled: true, + options: [ + { label: '男', value: '0' }, + { label: '女', value: '1' } + ] + }, + }, + { + field: 'phone', + label: '手机号', + component: 'Input', + componentProps: { + disabled: true + } + }, + { + field: 'email', + label: '邮箱', + component: 'Input', + componentProps: { + disabled: true + } + }, +]; diff --git a/src/views/common/push/pushBlacklist/index.vue b/src/views/common/push/pushBlacklist/index.vue index 8c5e252..64cc59f 100644 --- a/src/views/common/push/pushBlacklist/index.vue +++ b/src/views/common/push/pushBlacklist/index.vue @@ -5,33 +5,32 @@ @selection-change="handleSelectionChange" > - - + @@ -44,10 +43,10 @@ */ import { reactive, toRaw } from 'vue'; import { BasicTable, useTable, TableAction } from '/@/components/Table'; - import { listPushPassList, delPushPassList } from '/@/api/platform/common/controller/pushPassList'; + import { listPushBlacklist, delPushBlacklist } from '/@/api/platform/common/controller/pushBlacklist'; import { useModal } from '/@/components/Modal'; - import PassListModal from './PassListModal.vue'; - import { columns, searchFormSchema } from './passList.data'; + import BlacklistModal from './BlacklistModal.vue'; + import { columns, searchFormSchema } from './blacklist.data'; import { useMessage } from '/@/hooks/web/useMessage'; import { useRoute } from 'vue-router'; @@ -69,12 +68,12 @@ const [registerModal, { openModal }] = useModal(); const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ title: '黑名单列表', - api: listPushPassList, + api: listPushBlacklist, rowKey: 'id', columns, formConfig: { compact: true, - labelWidth: 100, + labelWidth: 60, schemas: searchFormSchema, autoSubmitOnEnter: true, showAdvancedButton: true, @@ -90,12 +89,8 @@ width: 220, title: '操作', dataIndex: 'action', - slots: { customRender: 'action' }, fixed: false }, - searchInfo: { - type: '0' - }, handleSearchInfoFn: () => clearSelectedRowKeys() }); @@ -111,10 +106,10 @@ openModal(true,{ _tag: 'add' }); } - /** 编辑按钮操作,行内编辑 */ - function handleEdit(record?: Recordable) { + /** 查看按钮操作,行内查看 */ + function handleViewEdit(record?: Recordable) { record = record || { id: getSelectRowKeys() }; - openModal(true, { _tag: 'edit', record }); + openModal(true, { _tag: 'view', record }); } /** 删除按钮操作,行内删除 */ @@ -125,7 +120,7 @@ title: '警告', content: `是否确认移除编号为${ids}的数据?`, onOk: async () => { - await delPushPassList(ids); + await delPushBlacklist(ids); createMessage.success('移除成功!'); handleRefreshTable(); } diff --git a/src/views/common/push/pushBlacklist/passList.data.ts b/src/views/common/push/pushBlacklist/passList.data.ts deleted file mode 100644 index 21f0f0a..0000000 --- a/src/views/common/push/pushBlacklist/passList.data.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { BasicColumn } from '/@/components/Table'; -import { FormSchema } from '/@/components/Table'; - -/** 表格列配置 */ -export const columns: BasicColumn[] = [ - { - title: '发送方用户id', - dataIndex: 'fromPushId' - }, - { - title: '对方用户id', - dataIndex: 'toPushId' - }, - { - title: '创建人', - dataIndex: 'createByName' - }, - { - title: '创建时间', - dataIndex: 'createTime', - width: 200 - } -]; - -/** 搜索表单配置 */ -export const searchFormSchema: FormSchema[] = [ - { - field: 'fromPushId', - label: '发送方用户id', - component: 'Input', - componentProps: { - placeholder: '请输入发送方用户id', - }, - colProps: { span: 6 } - } -]; - -/** 表单配置 */ -export const formSchema: FormSchema[] = [ - { - field: 'id', - label: 'ID', - component: 'Input', - show: false - }, - { - field: 'type', - label: '白名单类型', - component: 'Input', - defaultValue: '0', - show: false - }, - { - field: 'fromPushId', - label: '发送方用户id', - component: 'Input', - required: true, - colProps: { - span: 24 - } - }, - { - field: 'toPushId', - label: '对方用户id', - component: 'Input', - required: true, - colProps: { - span: 24 - } - }, -];