Commit 36c434a1 authored by TZW's avatar TZW

11

parent c69946df
...@@ -5,6 +5,7 @@ import DetailPro from '../DetailPro'; ...@@ -5,6 +5,7 @@ import DetailPro from '../DetailPro';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
function DrawerPro(props) { function DrawerPro(props) {
let pushSettingFlag = props.pushSettingFlag;
let newProps = { ...props }; let newProps = { ...props };
delete newProps.children; delete newProps.children;
const detailprops = { const detailprops = {
...@@ -30,6 +31,16 @@ function DrawerPro(props) { ...@@ -30,6 +31,16 @@ function DrawerPro(props) {
) : ( ) : (
<InitForm {...newProps} /> <InitForm {...newProps} />
)} )}
{pushSettingFlag ? (
<a
id="pushSettingBtn"
onClick={() => {
props.checkVariableOpen();
}}
>
查看变量
</a>
) : null}
</Drawer> </Drawer>
); );
} }
......
...@@ -485,4 +485,11 @@ ol { ...@@ -485,4 +485,11 @@ ol {
aside { aside {
z-index: 998; z-index: 998;
} }
}
#pushSettingBtn {
position: relative;
top: -162px;
left: 74px;
color: #1890ff;
} }
\ No newline at end of file
function getcolumns(setdrawer) { function getcolumns(setdrawer) {
return { return {
"columns": [ columns: [
{ {
"title": "推送场景", title: '推送场景',
"dataIndex": "businessMsgSceneId", dataIndex: 'msgSceneName',
"key": "businessMsgSceneId" key: 'businessMsgSceneId',
}, valueType: 'select',
{ options: {
"title": "推送方式", path: '/base/paBusinessMsgScene/queryAllForSelect',
"dataIndex": "sendMethodType", params: {},
"key": "sendMethodType" },
}, },
{ {
"title": "适用类型", title: '推送方式',
"dataIndex": "fitField", dataIndex: 'sendMethodName',
"key": "fitField", key: 'sendMethodType',
"valueType": "select", valueType: 'select',
"mode": "radio", options: [
"options": [ {
{ value: '4',
"label": "全部", label: '邮件',
"value": "1" },
],
},
{
title: '适用类型',
dataIndex: 'fitFieldName',
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: 'fieldName',
key: 'fieldId',
},
{
title: '推送内容',
dataIndex: 'sendContent',
key: 'sendContent',
valueType: 'textarea',
},
],
pathconfig: {
enableadd: true,
enableedit: true,
enabledelete: true,
enabledetail: true,
add: '',
edit: '',
list: '/base/paBusinessMsgOption/queryList',
delete: '/base/paBusinessMsgOption/deleteById',
detail: '',
}, },
{ };
"label": "公司", }
"value": "2" export default getcolumns;
},
{
"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 * as React from 'react';
import { useState, useMemo, useRef } from 'react'; import { useState, useMemo, useRef, useEffect } from 'react';
import DrawerPro from '@/components/DrawerPro'; import DrawerPro from '@/components/DrawerPro';
import AutoTable from '@/components/AutoTable'; import AutoTable from '@/components/AutoTable';
import PremButton from '@/components/PremButton'; import PremButton from '@/components/PremButton';
import getcolumns from './columns'; import getcolumns from './columns';
import { useRequest } from 'ahooks'; import { useRequest } from 'ahooks';
import { doFetch } from '@/utils/doFetch'; import { doFetch } from '@/utils/doFetch';
import { Drawer, Space, Table, message } from 'antd';
import InitForm from '@/components/InitForm';
import copy from 'copy-to-clipboard';
function Pushsetting(props) { function Pushsetting(props) {
const actionRef = useRef(), const actionRef = useRef(),
formRef = useRef(); formRef = useRef();
const [drawer, setdrawer] = useState({ const [drawer, setdrawer] = useState({
open: false, open: false,
}); });
const pathconfig = useMemo(() => { const [checkVariableDraw, setCheckVariableDraw] = useState(false);
let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
return pathconf; const pathconfig = useMemo(() => {
}, []); let pathconf = getcolumns(setdrawer)?.pathconfig ?? {};
const { run, loading } = useRequest(doFetch, { return pathconf;
manual: true, }, []);
onSuccess: (res, params) => { const { run, loading } = useRequest(doFetch, {
if (res?.code == '0000') { manual: true,
actionRef?.current?.reload(); onSuccess: (res, params) => {
setdrawer((s) => ({ if (res?.code == '0000') {
...s, actionRef?.current?.reload();
open: false, setdrawer((s) => ({
})); ...s,
} open: false,
}));
}
},
});
const news = (text, row, _, action) => {
return (
<PremButton
btn={{
size: 'small',
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 checkVariableOpen = () => {
setCheckVariableDraw(true);
};
const CheckVariable = () => {
const columns = [
{
title: '变量名称',
dataIndex: 'variableName',
key: 'variableName',
},
{
title: '变量编号',
dataIndex: 'variableCode',
key: 'variableCode',
},
{
title: '操作',
key: 'action',
render: (_, record) => (
<Space size="middle">
<a
onClick={() => {
console.log(record, _);
copy(record.variableCode);
message.success('已成功复制到剪切板!');
}}
>
复制
</a>
</Space>
),
}, },
];
return (
<AutoTable
columns={columns}
path="/base/paBusinessMsgSceneVariable/queryPageBySceneId"
pagination={false}
/>
);
};
const columns = useMemo(() => {
let defcolumn = getcolumns(setdrawer)?.columns;
return defcolumn.concat({
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => [
news(text, row, _, action),
edit(text, row, _, action),
remove(text, row, _, action),
],
}); });
}, []);
const detail = (text, row, _, action) => { const selectValueType = {
return ( 1: '全部',
<PremButton 2: '公司',
btn={{ 3: '部门',
size: 'small', 4: '工厂',
type: 'link', 5: '车间',
onClick: () => { 6: '工段',
setdrawer((s) => ({ 7: '产线',
...s, };
open: true,
item: row,
title: '详情',
val: 'detail',
title: '详细信息',
}));
},
}}
>
详情
</PremButton>
);
};
const edit = (text, row, _, action) => { return (
return ( <div style={{ position: 'relative' }}>
<PremButton <AutoTable
btn={{ pagetitle="推送配置"
size: 'small', 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: () => { onClick: () => {
setdrawer((s) => ({ setdrawer((s) => ({
...s, ...s,
pushSettingFlag: true,
open: true, open: true,
item: row, item: null,
title: '编辑', title: '新增',
val: 'edit', val: 'add',
})); }));
}, },
}} },
> }}
编辑 />
</PremButton>
);
};
const remove = (text, row, _, action) => { <DrawerPro
return ( fields={columns}
<PremButton params={{ id: drawer?.item?.id }}
pop={{ formRef={formRef}
title: '是否删除?', placement="right"
okText: '确认', detailpath={pathconfig?.detail || null}
cancelText: '取消', checkVariableOpen={checkVariableOpen}
onConfirm: () => { detailData={drawer?.item}
run({ url: pathconfig?.delete || '/delete', params: { id: row?.id } }); defaultFormValue={drawer?.item}
}, onValuesChange={async (a, b) => {
}} if (a?.fitField) {
btn={{ console.log(a, b);
size: 'small', const res = doFetch({ url: selectValueType[a?.fitField] });
type: 'danger', console.log(formRef);
}} }
> }}
删除 onClose={() => {
</PremButton> setdrawer((s) => ({
); ...s,
}; open: false,
}));
const columns = useMemo(() => { }}
let defcolumn = getcolumns(setdrawer)?.columns; {...drawer}
return defcolumn.concat({ onFinish={(vals) => {
title: '操作', if (drawer?.val == 'add') {
valueType: 'option', run({ url: pathconfig?.add || '/add', params: { ...vals } });
width: 150, } else if (drawer?.val == 'edit') {
render: (text, row, _, action) => [ run({ url: pathconfig?.edit || '/edit', params: { ...vals, id: drawer?.item?.id } });
pathconfig?.enabledetail && detail(text, row, _, action), }
pathconfig?.enableedit && edit(text, row, _, action), }}
pathconfig?.enabledelete && remove(text, row, _, action), />
], <Drawer
}); title="查看变量"
}, []); width={700}
placement="right"
return ( onClose={() => {
<div style={{ position: 'relative' }}> setCheckVariableDraw(false);
<AutoTable }}
pagetitle="推送配置" open={checkVariableDraw}
columns={columns} >
actionRef={actionRef} <CheckVariable />
path={pathconfig?.list || '/ngic-auth/sysUser/query/page'} </Drawer>
pageextra={pathconfig?.enableadd ? 'add' : null} </div>
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; 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