Commit 32eb7245 authored by TZW's avatar TZW

12121733

parent 97b50a3a
...@@ -139,6 +139,12 @@ export default [ ...@@ -139,6 +139,12 @@ export default [
"path": "/system/rules", "path": "/system/rules",
"icon": "", "icon": "",
"component": "./system/rules" "component": "./system/rules"
},
{
"name": "推送配置",
"path": "/system/pushsetting",
"icon": "",
"component": "./system/pushsetting"
} }
] ]
} }
......
function getcolumns(setdrawer) {
return {
"columns": [
{
"title": "推送场景",
"dataIndex": "businessMsgSceneId",
"key": "businessMsgSceneId"
},
{
"title": "推送方式",
"dataIndex": "sendMethodType",
"key": "sendMethodType"
},
{
"title": "适用类型",
"dataIndex": "fitField",
"key": "fitField",
"valueType": "select",
"mode": "radio",
"options": [
{
"label": "全部",
"value": "1"
},
{
"label": "公司",
"value": "2"
},
{
"label": "部门",
"value": "3"
},
{
"label": "工厂",
"value": "4"
},
{
"label": "车间",
"value": "5"
},
{
"label": "工段",
"value": "6"
},
{
"label": "产线",
"value": "7"
}
]
},
{
"title": "适用选择",
"dataIndex": "fieldId",
"key": "fieldId"
},
{
"title": "推送标题",
"dataIndex": "sendTitle",
"key": "sendTitle"
},
{
"title": "推送内容",
"dataIndex": "sendContent",
"key": "sendContent"
}
],
"pathconfig": {
"enableadd": false,
"enableedit": false,
"enabledelete": false,
"enabledetail": false,
"add": "",
"edit": "",
"list": "/repair/umRepairOrder/queryRepairOrderList",
"delete": "",
"detail": ""
}
};
}
export default getcolumns;
\ No newline at end of file
import * as React from 'react';
import { useState, useMemo, useRef } from 'react';
import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton';
import getcolumns from './columns';
import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch';
function Pushsetting(props) {
const actionRef = useRef(),
formRef = useRef();
const [drawer, setdrawer] = useState({
open: false,
});
const pathconfig = useMemo(() => {
let pathconf = getcolumns(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',
}));
},
}}
>
编辑
</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 = getcolumns(setdrawer)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
pathconfig?.enabledetail && detail(text, row, _, action),
pathconfig?.enableedit && edit(text, row, _, action),
pathconfig?.enabledelete && remove(text, row, _, action),
],
});
}, []);
return (
<div style={{ position: 'relative' }}>
<AutoTable
pagetitle="推送配置"
columns={columns}
actionRef={actionRef}
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'}
pageextra={pathconfig?.enableadd ? 'add' : null}
resizeable={true}
addconfig={{
// access: 'sysDepartment_save',
btn: {
disabled: false,
onClick: () => {
setdrawer((s) => ({
...s,
open: true,
item: null,
title: '新增',
val: 'add',
}));
},
},
}}
/>
<DrawerPro
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 } });
} else if (drawer?.val == 'edit') {
run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
}
}}
/>
</div>
);
}
export default Pushsetting;
\ No newline at end of file
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