35 changed files with 2402 additions and 0 deletions
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushApplication, PushApplicationParams, PushApplicationResult } from '/@/api/platform/common/entity/pushApplication'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushApplication/list', |
||||
add = '/common_proxy/common/pushApplication/save', |
||||
get = '/common_proxy/common/pushApplication', |
||||
edit = '/common_proxy/common/pushApplication/update', |
||||
del = '/common_proxy/common/pushApplication/remove', |
||||
} |
||||
|
||||
export const listPushApplication = (params?: Partial<PushApplicationParams>) => defHttp.get<PushApplicationResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||
|
||||
export const addPushApplication = (params: Partial<PushApplication>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushApplication = (params: Partial<PushApplication>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushApplication = (id: string) => defHttp.get<PushApplication>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushApplication = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushBlacklist, PushBlacklistParams, PushBlacklistResult } from '/@/api/platform/common/entity/pushBlacklist'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushCertification/list', |
||||
add = '/common_proxy/common/pushCertification/save', |
||||
get = '/common_proxy/common/pushCertification', |
||||
edit = '/common_proxy/common/pushCertification/update', |
||||
del = '/common_proxy/common/pushCertification/remove', |
||||
} |
||||
|
||||
export const listPushBlacklist = (params?: Partial<PushBlacklistParams>) => defHttp.get<PushBlacklistResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||
|
||||
export const addPushBlacklist = (params: Partial<PushBlacklist>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushBlacklist = (params: Partial<PushBlacklist>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushBlacklist = (id: string) => defHttp.get<PushBlacklist>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushBlacklist = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushCertification, PushCertificationParams, PushCertificationResult } from '/@/api/platform/common/entity/pushCertification'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushCertification/list', |
||||
add = '/common_proxy/common/pushCertification/save', |
||||
get = '/common_proxy/common/pushCertification', |
||||
edit = '/common_proxy/common/pushCertification/update', |
||||
del = '/common_proxy/common/pushCertification/remove', |
||||
} |
||||
|
||||
export const listPushCertification = (params?: Partial<PushCertificationParams>) => defHttp.get<PushCertificationResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||
|
||||
export const addPushCertification = (params: Partial<PushCertification>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushCertification = (params: Partial<PushCertification>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushCertification = (id: string) => defHttp.get<PushCertification>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushCertification = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushManage, PushManageParams } from '/@/api/platform/common/entity/pushManage'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushManage/list', |
||||
add = '/common_proxy/common/pushManage/save', |
||||
get = '/common_proxy/common/pushManage', |
||||
edit = '/common_proxy/common/pushManage/update', |
||||
del = '/common_proxy/common/pushManage/remove', |
||||
} |
||||
|
||||
export const listPushManage = (params?: Partial<PushManageParams>) => defHttp.get({ url: Api.list, params }); |
||||
|
||||
export const addPushManage = (params: Partial<PushManage>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushManage = (params: Partial<PushManage>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushManage = (id: string) => defHttp.get<PushManage>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushManage = (id: string) => defHttp.delete({ url: `${Api.del}/${id}` }); |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushTodoAuth, PushTodoAuthParams, PushTodoAuthResult } from '/@/api/platform/common/entity/pushTodoAuth'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushTodoAuth/list', |
||||
add = '/common_proxy/common/pushTodoAuth/save', |
||||
get = '/common_proxy/common/pushTodoAuth', |
||||
edit = '/common_proxy/common/pushTodoAuth/update', |
||||
del = '/common_proxy/common/pushTodoAuth/remove', |
||||
} |
||||
|
||||
export const listPushTodoAuth = (params?: Partial<PushTodoAuthParams>) => defHttp.get<PushTodoAuthResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||
|
||||
export const addPushTodoAuth = (params: Partial<PushTodoAuth>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushTodoAuth = (params: Partial<PushTodoAuth>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushTodoAuth = (id: string) => defHttp.get<PushTodoAuth>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushTodoAuth = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushType, PushTypeParams, PushTypeResult } from '/@/api/platform/common/entity/pushType'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushType/list', |
||||
add = '/common_proxy/common/pushType/save', |
||||
get = '/common_proxy/common/pushType', |
||||
edit = '/common_proxy/common/pushType/update', |
||||
del = '/common_proxy/common/pushType/remove', |
||||
} |
||||
|
||||
export const listPushType= (params?: Partial<PushTypeParams>) => defHttp.get<PushTypeResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||
|
||||
export const addPushType = (params: Partial<PushType>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushType = (params: Partial<PushType>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushType = (id: string) => defHttp.get<PushType>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushType = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
/** |
||||
* 提供api模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import type { PushWhitelist, PushWhitelistParams, PushWhitelistResult } from '/@/api/platform/common/entity/pushWhitelist'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
|
||||
enum Api { |
||||
list = '/common_proxy/common/pushWhitelist/list', |
||||
add = '/common_proxy/common/pushWhitelist/save', |
||||
get = '/common_proxy/common/pushWhitelist', |
||||
edit = '/common_proxy/common/pushWhitelist/update', |
||||
del = '/common_proxy/common/pushWhitelist/remove', |
||||
} |
||||
|
||||
export const listPushWhitelist = (params?: Partial<PushWhitelistParams>) => defHttp.get<PushWhitelistResult>({ url: Api.list, params }, { isReturnResultResponse: true }); |
||||
|
||||
export const addPushWhitelist = (params: Partial<PushWhitelist>) => defHttp.post({ url: Api.add, data: params }); |
||||
|
||||
export const editPushWhitelist = (params: Partial<PushWhitelist>) => defHttp.put({ url: Api.edit, data: params }); |
||||
|
||||
export const getPushWhitelist = (id: string) => defHttp.get<PushWhitelist>({ url: `${Api.get}/${id}` }); |
||||
|
||||
export const delPushWhitelist = (ids: string) => defHttp.delete({ url: `${Api.del}/${ids}` }); |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
|
||||
export type PushApplicationParams = Page & PushApplication; |
||||
|
||||
export interface PushApplication extends CommonEntity { |
||||
id: string; |
||||
name: string; |
||||
pushSize: number; |
||||
sendSize: number; |
||||
status: string; |
||||
url: string; |
||||
appKey: string; |
||||
messageSecret: string; |
||||
} |
||||
|
||||
export type PushApplicationResult = R<PushApplication[]>; |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
|
||||
export type PushBlacklistParams = Page & PushBlacklist; |
||||
|
||||
export interface PushBlacklist extends CommonEntity { |
||||
id: string; |
||||
pushId: string; |
||||
} |
||||
|
||||
export type PushBlacklistResult = R<PushBlacklist[]>; |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
|
||||
export type PushCertificationParams = Page & PushCertification; |
||||
|
||||
export interface PushCertification extends CommonEntity { |
||||
id: string; |
||||
name: string; |
||||
license: string; |
||||
phone: string; |
||||
idCard: string; |
||||
contact: string; |
||||
creditCode: string; |
||||
type: string; |
||||
fileId: string; |
||||
status: string; |
||||
corpName: string; |
||||
detailedAddress: string; |
||||
} |
||||
|
||||
export type PushCertificationResult = R<PushCertification[]>; |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
import {TreeEntity} from "/@/api/common/data/entity"; |
||||
|
||||
export type PushManageParams = Page & PushManage; |
||||
|
||||
export interface PushManage extends TreeEntity { |
||||
isVibration: string; |
||||
isSound: string; |
||||
appKey: number; |
||||
customSound: number; |
||||
} |
||||
|
||||
export type PushManageResult = R<PushManage[]>; |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
|
||||
export type PushTodoAuthParams = Page & PushTodoAuth; |
||||
|
||||
export interface PushTodoAuth extends CommonEntity { |
||||
id: string; |
||||
name: string; |
||||
certificationId: string; |
||||
status: string; |
||||
} |
||||
|
||||
export type PushTodoAuthResult = R<PushTodoAuth[]>; |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
|
||||
export type PushTypeParams = Page & PushType; |
||||
|
||||
export interface PushType extends CommonEntity { |
||||
id: string; |
||||
name: string; |
||||
level: string; |
||||
} |
||||
|
||||
export type PushTypeResult = R<PushType[]>; |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
import type { R } from '/#/axios'; |
||||
import type { CommonEntity, Page } from '/@/api/common/data/entity'; |
||||
|
||||
export type PushWhitelistParams = Page & PushWhitelist; |
||||
|
||||
export interface PushWhitelist extends CommonEntity { |
||||
id: string; |
||||
pushId: string; |
||||
} |
||||
|
||||
export type PushWhitelistResult = R<PushWhitelist[]>; |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './application.data'; |
||||
import { addPushApplication, editPushApplication, getPushApplication } from '/@/api/platform/common/controller/pushApplication'; |
||||
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 }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增应用'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑应用'; |
||||
await setFieldsValue(await getPushApplication(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushApplication(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushApplication(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,120 @@
@@ -0,0 +1,120 @@
|
||||
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: 'name' |
||||
}, |
||||
{ |
||||
title: '创建推送数量', |
||||
dataIndex: 'pushSize' |
||||
}, |
||||
{ |
||||
title: '消息发送数量', |
||||
dataIndex: 'sendSize' |
||||
}, |
||||
{ |
||||
title: '请求地址', |
||||
dataIndex: 'url' |
||||
}, |
||||
{ |
||||
title: '创建人', |
||||
dataIndex: 'createByName' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 200 |
||||
}, |
||||
{ |
||||
title: '状态', |
||||
dataIndex: 'status', |
||||
width: 120, |
||||
customRender: ({record}) => { |
||||
const status = record.status; |
||||
const enable = ~~status === 0; |
||||
const color = enable ? 'green' : 'red'; |
||||
const text = enable ? '启动' : '停止'; |
||||
return h(Tag, { color: color }, () => text); |
||||
} |
||||
}, |
||||
{ |
||||
title: '备注', |
||||
dataIndex: 'remarks', |
||||
width: 200, |
||||
customRender: ({record}) => { |
||||
return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据'); |
||||
} |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '应用名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入应用名称', |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '应用名称', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'url', |
||||
label: '请求地址', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'status', |
||||
label: '状态', |
||||
component: 'RadioGroup', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{ label: '启动', value: '0' }, |
||||
{ label: '停止', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
label: '备注', |
||||
field: 'remarks', |
||||
component: 'InputTextArea', |
||||
componentProps: { |
||||
rows: 6 |
||||
}, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button type="primary" |
||||
@click="handleAdd()" |
||||
>新增应用</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改应用</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.multiple" |
||||
@click="handleDel()" |
||||
>删除应用</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<!--弹出窗体区域--> |
||||
<ApplicationModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listPushApplication, delPushApplication } from '/@/api/platform/common/controller/pushApplication'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import ApplicationModal from './ApplicationModal.vue'; |
||||
import { columns, searchFormSchema } from './application.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '推送应用列表', |
||||
api: listPushApplication, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: getSelectRowKeys() }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || getSelectRowKeys(); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: `是否确认删除编号为${ids}的数据?`, |
||||
onOk: async () => { |
||||
await delPushApplication(ids); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './authManage.data'; |
||||
import { addPushCertification, editPushCertification, getPushCertification } from '/@/api/platform/common/controller/pushCertification'; |
||||
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 }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增推送认证'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑推送认证'; |
||||
await setFieldsValue(await getPushCertification(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushCertification(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushCertification(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,160 @@
@@ -0,0 +1,160 @@
|
||||
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: 'name' |
||||
}, |
||||
{ |
||||
title: '营业证书', |
||||
dataIndex: 'license' |
||||
}, |
||||
{ |
||||
title: '手机号', |
||||
dataIndex: 'phone' |
||||
}, |
||||
{ |
||||
title: '联系人', |
||||
dataIndex: 'contact' |
||||
}, |
||||
{ |
||||
title: '行用代码', |
||||
dataIndex: 'creditCode' |
||||
}, |
||||
{ |
||||
title: '类型', |
||||
dataIndex: 'type', |
||||
customRender: ({record}) => { |
||||
const type = record.type; |
||||
const enable = ~~type === 0; |
||||
return enable ? '企业' : '个人'; |
||||
} |
||||
}, |
||||
{ |
||||
title: '公司名称', |
||||
dataIndex: 'corpName' |
||||
}, |
||||
{ |
||||
title: '详细地址', |
||||
dataIndex: 'detailedAddress' |
||||
}, |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '姓名', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入姓名', |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '姓名', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'license', |
||||
label: '营业执照', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'phone', |
||||
label: '手机号', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'contact', |
||||
label: '联系人', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 1 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'idCard', |
||||
label: '身份证', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 1 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'creditCode', |
||||
label: '行用代码', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 1 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'type', |
||||
label: '认证类型', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 1 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'corpName', |
||||
label: '公司名称', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 1 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'detailedAddress', |
||||
label: '详细地址', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 1 |
||||
} |
||||
}, |
||||
{ |
||||
label: '备注', |
||||
field: 'remarks', |
||||
component: 'InputTextArea', |
||||
componentProps: { |
||||
rows: 6 |
||||
}, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button type="primary" |
||||
@click="handleAdd()" |
||||
>新增推送认证</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改推送认证</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.multiple" |
||||
@click="handleDel()" |
||||
>删除推送认证</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<!--弹出窗体区域--> |
||||
<AuthManageModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listPushCertification, delPushCertification } from '/@/api/platform/common/controller/pushCertification'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import AuthManageModal from './AuthManageModal.vue'; |
||||
import { columns, searchFormSchema } from './authManage.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '推送认证列表', |
||||
api: listPushCertification, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: getSelectRowKeys() }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || getSelectRowKeys(); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: `是否确认删除编号为${ids}的数据?`, |
||||
onOk: async () => { |
||||
await delPushCertification(ids); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './blacklist.data'; |
||||
import { addPushBlacklist, editPushBlacklist, getPushBlacklist } from '/@/api/platform/common/controller/pushBlacklist'; |
||||
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 }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增黑名单'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑黑名单'; |
||||
await setFieldsValue(await getPushBlacklist(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushBlacklist(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushBlacklist(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
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: '推送ID', |
||||
dataIndex: 'pushId' |
||||
}, |
||||
{ |
||||
title: '创建人', |
||||
dataIndex: 'createByName' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 200 |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'createByName', |
||||
label: '创建人', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入创建人', |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'pushId', |
||||
label: '推送ID', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button type="primary" |
||||
@click="handleAdd()" |
||||
>新增黑名单</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改黑名单</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.multiple" |
||||
@click="handleDel()" |
||||
>删除黑名单</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<!--弹出窗体区域--> |
||||
<BlacklistModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listPushBlacklist, delPushBlacklist } from '/@/api/platform/common/controller/pushBlacklist'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import BlacklistModal from './BlacklistModal.vue'; |
||||
import { columns, searchFormSchema } from './blacklist.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '黑名单列表', |
||||
api: listPushBlacklist, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: getSelectRowKeys() }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || getSelectRowKeys(); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: `是否确认删除编号为${ids}的数据?`, |
||||
onOk: async () => { |
||||
await delPushBlacklist(ids); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@ok="handleSubmit" |
||||
@register="registerModal" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './pushManage.data'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
import { listPushManage, addPushManage, editPushManage, getPushManage } from '/@/api/platform/common/controller/pushManage'; |
||||
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const tag = ref<Nullable<string>>(''); |
||||
/** https://v3.cn.vuejs.org/api/options-data.html#emits */ |
||||
const emit = defineEmits(['success', 'register']); |
||||
const [registerForm, { resetFields, setFieldsValue, updateSchema, validate, clearValidate }] = 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 topTree = { deptId: '0', name: '顶级推送', children: [] }; |
||||
topTree.children = listToTree(await listPushManage()); |
||||
await updateSchema({ |
||||
field: 'parentId', |
||||
componentProps: { |
||||
treeData: [topTree] |
||||
} |
||||
}); |
||||
const refId = data.record?.id; |
||||
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增推送'; |
||||
refId && await setFieldsValue({ parentId: refId }); |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑推送'; |
||||
await setFieldsValue(await getPushManage(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushManage(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushManage(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,106 @@
@@ -0,0 +1,106 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable"> |
||||
<template #toolbar> |
||||
<a-button type="primary" @click="handleAdd()">新增推送</a-button> |
||||
<a-button type="default" @click="expandAll">展开全部</a-button> |
||||
<a-button type="default" @click="collapseAll">折叠全部</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction |
||||
:actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '新增', |
||||
icon: 'ant-design:plus-circle-outlined', |
||||
onClick: handleAdd.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
popConfirm: { |
||||
title: '是否确认删除', |
||||
confirm: handleDel.bind(null, record) |
||||
} |
||||
} |
||||
]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<PushManageModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import PushManageModal from './PushManageModal.vue'; |
||||
import { columns, searchFormSchema } from './pushManage.data'; |
||||
import { delPushManage, listPushManage } from '/@/api/platform/common/controller/pushManage'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const { createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, expandAll, collapseAll, getDataSource }] = useTable({ |
||||
title: '推送列表', |
||||
api: listPushManage, |
||||
rowKey: 'deptId', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true, |
||||
fieldMapToTime: [['dateRange', ['beginTime', 'endTime'], 'YYYY-MM-DD']] |
||||
}, |
||||
isTreeTable: true, |
||||
pagination: false, |
||||
striped: false, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
showIndexColumn: false, |
||||
canResize: false, |
||||
actionColumn: { |
||||
width: 250, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
afterFetch: result => listToTree(result, { id: 'deptId' }), |
||||
}); |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd(record?: Recordable) { |
||||
openModal(true, { _tag: 'add', record }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record: Recordable) { |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record: Recordable) { |
||||
await delPushManage(record.deptId); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
reload(); |
||||
} |
||||
</script> |
@ -0,0 +1,114 @@
@@ -0,0 +1,114 @@
|
||||
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: 'name', |
||||
align: 'left' |
||||
}, |
||||
{ |
||||
title: '是否震动', |
||||
dataIndex: 'isVibration' |
||||
}, |
||||
{ |
||||
title: '是否声音', |
||||
dataIndex: 'isVibration' |
||||
}, |
||||
{ |
||||
title: '自定义声音', |
||||
dataIndex: 'isVibration' |
||||
}, |
||||
{ |
||||
title: '排序', |
||||
dataIndex: 'sort' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime' |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '推送名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入推送名称' |
||||
}, |
||||
colProps: {span: 8} |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'parentId', |
||||
label: '上级推送', |
||||
component: 'TreeSelect', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
replaceFields: { |
||||
title: 'name', |
||||
key: 'id', |
||||
value: 'id', |
||||
}, |
||||
getPopupContainer: () => document.body, |
||||
} |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '推送名称', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'isVibration', |
||||
label: '是否震动', |
||||
component: 'Select', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{ label: '是', value: '0' }, |
||||
{ label: '否', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { span: 12 } |
||||
}, |
||||
{ |
||||
field: 'isSound', |
||||
label: '是否声音', |
||||
component: 'Select', |
||||
defaultValue: '0', |
||||
componentProps: { |
||||
options: [ |
||||
{ label: '是', value: '0' }, |
||||
{ label: '否', value: '1' } |
||||
] |
||||
}, |
||||
colProps: { span: 12 } |
||||
}, |
||||
{ |
||||
field: 'customSound', |
||||
label: '自定义声音', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './pushType.data'; |
||||
import { addPushType, editPushType, getPushType } from '/@/api/platform/common/controller/pushType'; |
||||
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 }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增推送类型'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑推送类型'; |
||||
await setFieldsValue(await getPushType(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushType(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushType(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button type="primary" |
||||
@click="handleAdd()" |
||||
>新增推送类型</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改推送类型</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.multiple" |
||||
@click="handleDel()" |
||||
>删除推送类型</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<!--弹出窗体区域--> |
||||
<PushTypeModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listPushType, delPushType } from '/@/api/platform/common/controller/pushType'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import PushTypeModal from './PushTypeModal.vue'; |
||||
import { columns, searchFormSchema } from './pushType.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '推送类型列表', |
||||
api: listPushType, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: getSelectRowKeys() }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || getSelectRowKeys(); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: `是否确认删除编号为${ids}的数据?`, |
||||
onOk: async () => { |
||||
await delPushType(ids); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
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: 'name' |
||||
}, |
||||
{ |
||||
title: '紧急级别', |
||||
dataIndex: 'level' |
||||
}, |
||||
{ |
||||
title: '创建人', |
||||
dataIndex: 'createByName' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 200 |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '类型名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入类型名称', |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '类型名称', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'level', |
||||
label: '紧急级别', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 12 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './todoAuth.data'; |
||||
import { addPushTodoAuth, editPushTodoAuth, getPushTodoAuth } from '/@/api/platform/common/controller/pushTodoAuth'; |
||||
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 }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增认证代办'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑认证代办'; |
||||
await setFieldsValue(await getPushTodoAuth(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushTodoAuth(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushTodoAuth(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button type="primary" |
||||
@click="handleAdd()" |
||||
>新增认证代办</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改认证代办</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.multiple" |
||||
@click="handleDel()" |
||||
>删除认证代办</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<!--弹出窗体区域--> |
||||
<TodoAuthModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listPushTodoAuth, delPushTodoAuth } from '/@/api/platform/common/controller/pushTodoAuth'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import TodoAuthModal from './TodoAuthModal.vue'; |
||||
import { columns, searchFormSchema } from './todoAuth.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '代办列表', |
||||
api: listPushTodoAuth, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: getSelectRowKeys() }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || getSelectRowKeys(); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: `是否确认删除编号为${ids}的数据?`, |
||||
onOk: async () => { |
||||
await delPushTodoAuth(ids); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
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: 'name' |
||||
}, |
||||
{ |
||||
title: '认证ID', |
||||
dataIndex: 'certificationId' |
||||
}, |
||||
{ |
||||
title: '创建人', |
||||
dataIndex: 'createByName' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 200 |
||||
}, |
||||
{ |
||||
title: '状态', |
||||
dataIndex: 'status', |
||||
}, |
||||
{ |
||||
title: '备注', |
||||
dataIndex: 'remarks', |
||||
width: 200, |
||||
customRender: ({record}) => { |
||||
return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据'); |
||||
} |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'name', |
||||
label: '申请名称', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入申请名称', |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'name', |
||||
label: '申请名称', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
}, |
||||
{ |
||||
field: 'status', |
||||
label: '状态', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
}, |
||||
{ |
||||
label: '备注', |
||||
field: 'remarks', |
||||
component: 'InputTextArea', |
||||
componentProps: { |
||||
rows: 6 |
||||
}, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
<template> |
||||
<BasicModal v-bind="$attrs" |
||||
width="720px" |
||||
@register="registerModal" |
||||
@ok="handleSubmit" |
||||
> |
||||
<BasicForm @register="registerForm"/> |
||||
</BasicModal> |
||||
</template> |
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { ref, unref } from 'vue'; |
||||
import { BasicForm, useForm } from '/@/components/Form/index'; |
||||
import { formSchema } from './whitelist.data'; |
||||
import { addPushWhitelist, editPushWhitelist, getPushWhitelist } from '/@/api/platform/common/controller/pushWhitelist'; |
||||
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 }; |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
props.title = '新增白名单'; |
||||
break; |
||||
case 'edit': |
||||
props.title = '编辑白名单'; |
||||
await setFieldsValue(await getPushWhitelist(refId)); |
||||
break; |
||||
} |
||||
// 尾部:设置处理后的最终配置数据 |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理弹出框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 提取验证数据 |
||||
const formData = await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
// 采用tag标签区分操作 |
||||
switch (unref(tag)) { |
||||
case 'add': |
||||
await addPushWhitelist(formData); |
||||
break; |
||||
case 'edit': |
||||
await editPushWhitelist(formData); |
||||
break; |
||||
} |
||||
// 处理提交完成之后逻辑 |
||||
closeModal(); |
||||
emit('success'); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,135 @@
@@ -0,0 +1,135 @@
|
||||
<template> |
||||
<div> |
||||
<BasicTable @register="registerTable" |
||||
@selection-change="handleSelectionChange" |
||||
> |
||||
<template #toolbar> |
||||
<a-button type="primary" |
||||
@click="handleAdd()" |
||||
>新增白名单</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.single" |
||||
@click="handleEdit()" |
||||
>修改白名单</a-button> |
||||
<a-button type="primary" |
||||
:disabled="state.multiple" |
||||
@click="handleDel()" |
||||
>删除白名单</a-button> |
||||
</template> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="[ |
||||
{ |
||||
label: '编辑', |
||||
icon: 'fa6-regular:pen-to-square', |
||||
onClick: handleEdit.bind(null, record) |
||||
}, |
||||
{ |
||||
label: '删除', |
||||
icon: 'ant-design:delete-outlined', |
||||
color: 'error', |
||||
onClick: handleDel.bind(null, record) |
||||
}]" |
||||
/> |
||||
</template> |
||||
</BasicTable> |
||||
<!--弹出窗体区域--> |
||||
<WhitelistModal @register="registerModal" @success="handleRefreshTable"/> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用vben-动态表格表单封装组件编写,采用 setup 写法 |
||||
* Copyright © 2020-2022 <a href="http://www.entfrm.com/">entfrm</a> All rights reserved. |
||||
* author entfrm开发团队-王翔 |
||||
*/ |
||||
import { reactive, toRaw } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { listPushWhitelist, delPushWhitelist } from '/@/api/platform/common/controller/pushWhitelist'; |
||||
import { useModal } from '/@/components/Modal'; |
||||
import WhitelistModal from './WhitelistModal.vue'; |
||||
import { columns, searchFormSchema } from './whitelist.data'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
||||
/** 类型规范统一声明定义区域 */ |
||||
interface TableState { |
||||
single: boolean; |
||||
multiple: boolean; |
||||
} |
||||
|
||||
/** 通用变量统一声明区域 */ |
||||
const state = reactive<TableState>({ |
||||
// 非单个禁用 |
||||
single: true, |
||||
// 非多个禁用 |
||||
multiple: true |
||||
}); |
||||
const { createConfirm, createMessage } = useMessage(); |
||||
const [registerModal, { openModal }] = useModal(); |
||||
const [registerTable, { reload, clearSelectedRowKeys, getSelectRowKeys }] = useTable({ |
||||
title: '白名单列表', |
||||
api: listPushWhitelist, |
||||
rowKey: 'id', |
||||
columns, |
||||
formConfig: { |
||||
labelWidth: 120, |
||||
schemas: searchFormSchema, |
||||
autoSubmitOnEnter: true |
||||
}, |
||||
rowSelection: { type: 'checkbox' }, |
||||
useSearchForm: true, |
||||
showTableSetting: true, |
||||
bordered: true, |
||||
clickToRowSelect: false, |
||||
showIndexColumn: false, |
||||
actionColumn: { |
||||
width: 220, |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
slots: { customRender: 'action' }, |
||||
fixed: false |
||||
}, |
||||
handleSearchInfoFn: () => clearSelectedRowKeys() |
||||
}); |
||||
|
||||
/** 处理多选框选中数据 */ |
||||
function handleSelectionChange(selection?: Recordable) { |
||||
const rowSelection = toRaw(selection?.keys) || []; |
||||
state.single = rowSelection.length != 1; |
||||
state.multiple = !rowSelection.length; |
||||
} |
||||
|
||||
/** 新增按钮操作,行内新增与工具栏局域新增通用 */ |
||||
function handleAdd() { |
||||
openModal(true,{ _tag: 'add' }); |
||||
} |
||||
|
||||
/** 编辑按钮操作,行内编辑 */ |
||||
function handleEdit(record?: Recordable) { |
||||
record = record || { id: getSelectRowKeys() }; |
||||
openModal(true, { _tag: 'edit', record }); |
||||
} |
||||
|
||||
/** 删除按钮操作,行内删除 */ |
||||
async function handleDel(record?: Recordable) { |
||||
const ids = record?.id || getSelectRowKeys(); |
||||
createConfirm({ |
||||
iconType: 'warning', |
||||
title: '警告', |
||||
content: `是否确认删除编号为${ids}的数据?`, |
||||
onOk: async () => { |
||||
await delPushWhitelist(ids); |
||||
createMessage.success('删除成功!'); |
||||
handleRefreshTable(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** 处理表格刷新 */ |
||||
function handleRefreshTable() { |
||||
clearSelectedRowKeys(); |
||||
reload(); |
||||
} |
||||
|
||||
</script> |
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
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: '推送ID', |
||||
dataIndex: 'pushId' |
||||
}, |
||||
{ |
||||
title: '创建人', |
||||
dataIndex: 'createByName' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
dataIndex: 'createTime', |
||||
width: 200 |
||||
} |
||||
]; |
||||
|
||||
/** 搜索表单配置 */ |
||||
export const searchFormSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'createByName', |
||||
label: '创建人', |
||||
component: 'Input', |
||||
componentProps: { |
||||
placeholder: '请输入创建人', |
||||
}, |
||||
colProps: { span: 8 } |
||||
} |
||||
]; |
||||
|
||||
/** 表单配置 */ |
||||
export const formSchema: FormSchema[] = [ |
||||
{ |
||||
field: 'id', |
||||
label: 'ID', |
||||
component: 'Input', |
||||
show: false |
||||
}, |
||||
{ |
||||
field: 'pushId', |
||||
label: '推送ID', |
||||
component: 'Input', |
||||
required: true, |
||||
colProps: { |
||||
span: 24 |
||||
} |
||||
} |
||||
]; |
Loading…
Reference in new issue