Commit 1da0fc3b authored by TZW's avatar TZW

pushing

parent 4c587ab9
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import ModalPro from '@/components/ModalPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import procolumns from './procolumns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
function Project({ businessMsgOptionId }) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = procolumns(setdrawer)?.pathconfig ?? {};
return pathconf;
}, []);
const { run, loading } = useRequest(doFetch, {
manual: true,
onSuccess: (res, params) => {
if (res?.code == '0000') {
actionRef?.current?.reload();
setdrawer((s) => ({
...s,
open: false,
}));
}
},
});
const detail = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
type: 'link',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '编辑',
val: 'edit',
id: row?.id,
}));
},
}}
>
编辑
</PremButton>
);
};
const remove = (text, row, _, action) => {
return (
<PremButton
pop={{
title: '是否删除?',
okText: '确认',
cancelText: '取消',
onConfirm: () => {
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } });
},
}}
btn={{
size: 'small',
type: 'danger',
}}
>
删除
</PremButton>
);
};
const columns = useMemo(() => {
let defcolumn = procolumns(drawer?.id)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
});
}, [drawer?.id]);
return (
<div style={{ position: 'relative' }}>
<AutoTable
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={false}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
id: null,
}));
},
},
}}
extraparams={{ businessMsgOptionId }}
/>
<ModalPro
fields={columns}
params={{ id: drawer?.item?.id }}
formRef={formRef}
placement="right"
detailpath={pathconfig?.detail || null}
detailData={drawer?.item}
defaultFormValue={drawer?.item}
onClose={() => {
setdrawer((s) => ({
...s,
open: false,
}));
}}
{...drawer}
onFinish={(vals) => {
if (drawer?.val == 'add') {
run({
url: pathconfig?.add || '/add',
params: { ...vals, businessMsgOptionId },
});
} else if (drawer?.val == 'edit') {
run({
url: pathconfig?.edit || '/edit',
params: { ...vals, id: drawer?.item?.id, businessMsgOptionId },
});
}
}}
/>
</div>
);
}
export default Project;
......@@ -10,6 +10,24 @@ function getcolumns(setdrawer) {
path: '/base/paBusinessMsgScene/queryAllForSelect',
params: {},
},
render: (_, row) => {
return (
<a
onClick={() => {
setdrawer((s) => ({
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
}}
>
{row?.msgSceneName}
</a>
);
},
},
{
title: '推送方式',
......
......@@ -9,6 +9,7 @@ import { doFetch } from '@/utils/doFetch';
import { Drawer, Space, Table, message } from 'antd';
import InitForm from '@/components/InitForm';
import copy from 'copy-to-clipboard';
import Notice from './Notice';
function Pushsetting(props) {
const actionRef = useRef(),
......@@ -45,9 +46,10 @@ function Pushsetting(props) {
...s,
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
title: '通知',
val: 'only',
id: row?.id,
pushSettingFlag: false,
}));
},
}}
......@@ -227,7 +229,9 @@ function Pushsetting(props) {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
>
<Notice businessMsgOptionId={drawer?.id} />
</DrawerPro>
<Drawer
title="查看变量"
width={700}
......
function procolumns(id) {
return {
columns: [
{
title: '推送流程',
dataIndex: 'sendProcessName',
key: 'sendProcess',
hideInSearch: true,
valueType: 'select',
colProps: { span: 6 },
options: [
{ label: '一级通知', value: 1 },
{ label: '二级通知', value: 2 },
{ label: '三级通知', value: 3 },
{ label: '四级通知', value: 4 },
],
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '推送对象',
dataIndex: 'sendToName',
colProps: { span: 6 },
key: 'sendTo',
hideInSearch: true,
valueType: 'select',
options: [
{ label: '可指定人员', value: 2 },
{ label: '创建人', value: 3 },
{ label: '选择角色', value: 6 },
{ label: '选择人员', value: 7 },
],
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '选择对象',
colProps: { span: 6 },
dataIndex: 'targetNames',
hideInSearch: true,
key: 'targetIdList',
},
{
colProps: { span: 6 },
title: '触发次数',
dataIndex: 'judgeTypeName',
key: 'judgeType',
valueType: 'digit',
precision: 0,
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
hideInSearch: true,
},
{
title: '初始触发时长',
dataIndex: 'initialTime',
hideInSearch: true,
key: 'initialTime',
valueType: 'digit',
precision: 0,
colProps: { span: 6 },
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '初始触发时长单位',
colProps: { span: 6 },
dataIndex: 'initialUnit',
hideInSearch: true,
key: 'initialUnit',
valueType: 'select',
options: [
{ label: '分钟', value: 1 },
{ label: '小时', value: 2 },
{ label: '天', value: 3 },
],
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
{
title: '间隔时长',
dataIndex: 'intervalTime',
colProps: { span: 6 },
valueType: 'digit',
precision: 0,
key: 'intervalTime',
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
valueType: 'digit',
hideInSearch: true,
},
{
title: '间隔时长单位',
dataIndex: 'intervalUnit',
key: 'intervalUnit',
hideInSearch: true,
colProps: { span: 6 },
valueType: 'select',
options: [
{ label: '分钟', value: 1 },
{ label: '小时', value: 2 },
{ label: '天', value: 3 },
],
formItemProps: { rules: [{ required: true, message: '此项为必填项' }] },
},
],
pathconfig: {
enableadd: true,
enableedit: true,
enabledelete: true,
enabledetail: false,
add: '/base/paBusinessMsgOptionDetail/save',
edit: '/base/paBusinessMsgOptionDetail/save',
list: '/base/paBusinessMsgOptionDetail/queryList',
delete: '/maintain/umMaintainItem/deleteById',
detail: '',
},
};
}
export default procolumns;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment