Commit 76a807e5 authored by wuhao's avatar wuhao 🎯

asder

parent df6899c5
...@@ -140,6 +140,17 @@ export default [ ...@@ -140,6 +140,17 @@ export default [
name: "特殊配置", name: "特殊配置",
component: "./platform/Specialset", component: "./platform/Specialset",
}, },
{
path: "/platform/sendset",
name: "推送配置",
component: "./platform/Sendset",
},
{
path: "/platform/sendlist",
name: "推送记录",
component: "./platform/Sendlist",
},
{ {
path: "/platform/rule", path: "/platform/rule",
name: "编号规则", name: "编号规则",
......
...@@ -26,10 +26,10 @@ class Mtable extends PureComponent { ...@@ -26,10 +26,10 @@ class Mtable extends PureComponent {
componentWillReceiveProps(nextprops) { componentWillReceiveProps(nextprops) {
if ( if (
JSON.stringify(this.props.extraparams) != JSON.stringify(this.props.extraparams) !=
JSON.stringify(nextprops.extraparams) || JSON.stringify(nextprops.extraparams) ||
JSON.stringify(this.props.path) != JSON.stringify(nextprops.path) || JSON.stringify(this.props.path) != JSON.stringify(nextprops.path) ||
JSON.stringify(this.props.refreshDep) != JSON.stringify(this.props.refreshDep) !=
JSON.stringify(nextprops.refreshDep) JSON.stringify(nextprops.refreshDep)
) { ) {
if (nextprops.actionRef) { if (nextprops.actionRef) {
nextprops.actionRef?.current?.reload(); nextprops.actionRef?.current?.reload();
...@@ -54,8 +54,8 @@ class Mtable extends PureComponent { ...@@ -54,8 +54,8 @@ class Mtable extends PureComponent {
sceneMark: extraparams sceneMark: extraparams
? path + bodyParse(extraparams) ? path + bodyParse(extraparams)
: activeTabKey : activeTabKey
? path + activeTabKey ? path + activeTabKey
: path, : path,
}, },
}).then((res) => { }).then((res) => {
if (res.code == "0000") { if (res.code == "0000") {
...@@ -117,8 +117,8 @@ class Mtable extends PureComponent { ...@@ -117,8 +117,8 @@ class Mtable extends PureComponent {
let itemwidth = allcol[it.key]?.width let itemwidth = allcol[it.key]?.width
? allcol[it.key].width ? allcol[it.key].width
: it.width : it.width
? it.width ? it.width
: 160; : 160;
return { return {
...it, ...it,
width: itemwidth, width: itemwidth,
...@@ -130,14 +130,14 @@ class Mtable extends PureComponent { ...@@ -130,14 +130,14 @@ class Mtable extends PureComponent {
render: it.render render: it.render
? it.render ? it.render
: (text, row) => { : (text, row) => {
return ( return (
<Tooltip title={row[it.dataIndex]} placement="topLeft"> <Tooltip title={row[it.dataIndex]} placement="topLeft">
<span className="table-cell"> <span className="table-cell">
{row[it.dataIndex] ?? "-"} {row[it.dataIndex] ?? "-"}
</span> </span>
</Tooltip> </Tooltip>
); );
}, },
}; };
}); });
...@@ -152,149 +152,149 @@ class Mtable extends PureComponent { ...@@ -152,149 +152,149 @@ class Mtable extends PureComponent {
//缩放表格 //缩放表格
handleResize = handleResize =
(index) => (index) =>
(e, { size }) => { (e, { size }) => {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
this.setState(({ columns }) => { this.setState(({ columns }) => {
const nextColumns = [...columns]; const nextColumns = [...columns];
nextColumns[index] = { nextColumns[index] = {
...nextColumns[index], ...nextColumns[index],
width: size.width, width: size.width,
}; };
return { columns: nextColumns }; return { columns: nextColumns };
}); });
}; };
//更新表格缩放 //更新表格缩放
handleResizeStop = handleResizeStop =
(index) => (index) =>
(e, { size }) => { (e, { size }) => {
e.stopImmediatePropagation(); e.stopImmediatePropagation();
let { extraparams, activeTabKey, path } = this.props; let { extraparams, activeTabKey, path } = this.props;
let submitdata = this.state.valueColumns ?? {}, let submitdata = this.state.valueColumns ?? {},
curkey = Object.keys(submitdata)[index]; curkey = Object.keys(submitdata)[index];
submitdata[curkey].width = parseInt(size.width); submitdata[curkey].width = parseInt(size.width);
this.setState( this.setState(
{ {
valueColumns: submitdata, valueColumns: submitdata,
}, },
() => { () => {
doFetch({ doFetch({
url: "/ngic-base-business/paFieldScene/save", url: "/ngic-base-business/paFieldScene/save",
params: { params: {
sceneMark: extraparams sceneMark: extraparams
? path + bodyParse(extraparams) ? path + bodyParse(extraparams)
: activeTabKey : activeTabKey
? path + activeTabKey ? path + activeTabKey
: path, : path,
controList: Object.keys(submitdata).map((it, i) => { controList: Object.keys(submitdata).map((it, i) => {
return { return {
fieldKey: it, fieldKey: it,
fieldWidth: fieldWidth:
i == index ? parseInt(size.width) : submitdata[it].width, i == index ? parseInt(size.width) : submitdata[it].width,
fieldOrder: submitdata[it].order, fieldOrder: submitdata[it].order,
fieldFixed: submitdata[it].fixed, fieldFixed: submitdata[it].fixed,
fieldShow: submitdata[it].show, fieldShow: submitdata[it].show,
}; };
}), }),
}, },
}); });
} }
); );
}; };
render() { render() {
let { let {
pageSize, pageSize,
x, x,
y, y,
style, style,
dataSource, dataSource,
onSearchChange, onSearchChange,
defaultPageSize, defaultPageSize,
pagination, //分页 pagination, //分页
rowKey, //行key rowKey, //行key
actionRef, //操作ref actionRef, //操作ref
formRef, //查询表单ref formRef, //查询表单ref
path, //路径 path, //路径
activeTabKey, //当前tab activeTabKey, //当前tab
extraparams, //拓展查询参数 extraparams, //拓展查询参数
rowSelection, //行选择 rowSelection, //行选择
tableRender, //表格布局自定义 tableRender, //表格布局自定义
getDefaultSelected, //获取默认选中的数据 getDefaultSelected, //获取默认选中的数据
rowClassNameFn, //选中后行样式 rowClassNameFn, //选中后行样式
showQuickJumper, //false字符串 不显示 showQuickJumper, //false字符串 不显示
expandable, //是否可展开 expandable, //是否可展开
onRow, onRow,
} = this.props, } = this.props,
{ total, size } = this.state; { total, size } = this.state;
let tabledataProps = let tabledataProps =
dataSource && Array.isArray(dataSource) dataSource && Array.isArray(dataSource)
? { ? {
dataSource, dataSource,
pagination: { pagination: {
showTotal: (total, range) => <span>{total}</span>, showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: false, showQuickJumper: false,
showSizeChanger: true, showSizeChanger: true,
defaultPageSize: defaultPageSize ? defaultPageSize : 15, defaultPageSize: defaultPageSize ? defaultPageSize : 15,
pageSizeOptions: [10, 15, 30, 50, 100, 200], pageSizeOptions: [10, 15, 30, 50, 100, 200],
total: dataSource.length, total: dataSource.length,
}, },
search: { search: {
filterType: "light", //轻量模式 filterType: "light", //轻量模式
}, },
toolBarRender: false, toolBarRender: false,
} }
: { : {
request: async (params = {}) => { request: async (params = {}) => {
//表格数据获取 只需要传入url自动获得数据 //表格数据获取 只需要传入url自动获得数据
if (!path) { if (!path) {
return; return;
} }
//设置token //设置token
let token = localStorage.getItem("TOKENS") let token = localStorage.getItem("TOKENS")
? localStorage.getItem("TOKENS") ? localStorage.getItem("TOKENS")
: "9410b3f7de5d63f2be42d80ec8241d2d"; : "9410b3f7de5d63f2be42d80ec8241d2d";
let headers = { let headers = {
"Content-Type": "application/json", "Content-Type": "application/json",
token: token ? token : "", token: token ? token : "",
}, },
newextraparams = extraparams ?? {}; newextraparams = extraparams ?? {};
//处理传参 extraparams为除列筛选外的自定义传参 //处理传参 extraparams为除列筛选外的自定义传参
let newparams = { let newparams = {
...params, ...params,
...newextraparams, //父组件传参 ...newextraparams, //父组件传参
pageIndex: params.current, pageIndex: params.current,
pageSize: params.pageSize || pageSize, pageSize: params.pageSize || pageSize,
}; };
delete newparams.current; delete newparams.current;
if (pagination == "false") { if (pagination == "false") {
delete newparams.pageIndex; delete newparams.pageIndex;
delete newparams.pageSize; delete newparams.pageSize;
} }
let res = await request("/wms" + path, { let res = await request("/wms" + path, {
body: JSON.stringify(newparams ? newparams : {}), body: JSON.stringify(newparams ? newparams : {}),
headers, headers,
method: "POST", method: "POST",
}); });
return { return {
data: res.data, data: res.data,
total: res?.data?.total || res?.data?.dataList?.length, total: res?.data?.total || res?.data?.dataList?.length,
}; };
}, },
pagination: { pagination: {
showTotal: (total, range) => <span>{total}</span>, showTotal: (total, range) => <span>{total}</span>,
showQuickJumper: !showQuickJumper ? true : false, showQuickJumper: !showQuickJumper ? true : false,
showSizeChanger: true, showSizeChanger: true,
pageSizeOptions: [5, 10, 15, 30, 50, 100, 200], pageSizeOptions: [5, 10, 15, 30, 50, 100, 200],
defaultPageSize: pageSize || 15, defaultPageSize: pageSize || 15,
total, total,
}, },
search: { search: {
filterType: "light", //轻量模式 filterType: "light", //轻量模式
}, },
}; };
return ( return (
<ProTable <ProTable
size={size} size={size}
...@@ -329,8 +329,8 @@ class Mtable extends PureComponent { ...@@ -329,8 +329,8 @@ class Mtable extends PureComponent {
pagination == "false" pagination == "false"
? data.dataList ? data.dataList
: data.page : data.page
? data.page.list ? data.page.list
: []; //分页或不分页的接口返回数据 : []; //分页或不分页的接口返回数据
return defaultval; return defaultval;
}} }}
components={{ components={{
...@@ -364,8 +364,8 @@ class Mtable extends PureComponent { ...@@ -364,8 +364,8 @@ class Mtable extends PureComponent {
sceneMark: extraparams sceneMark: extraparams
? path + bodyParse(extraparams) ? path + bodyParse(extraparams)
: activeTabKey : activeTabKey
? path + activeTabKey ? path + activeTabKey
: path, : path,
controList: Object.keys(submitdata).map((it) => { controList: Object.keys(submitdata).map((it) => {
return { return {
fieldKey: it, fieldKey: it,
...@@ -382,7 +382,7 @@ class Mtable extends PureComponent { ...@@ -382,7 +382,7 @@ class Mtable extends PureComponent {
}, },
}} }}
scroll={{ scroll={{
x: 1024, x: x ?? 1024,
}} }}
{...tabledataProps} {...tabledataProps}
{...expandable} {...expandable}
......
import React, { useEffect, useRef, useState } from 'react';
import { Button, Drawer } from 'antd';
import { connect, useModel } from "umi";
import AutoTable from '@/components/AutoTable';
import getPrem from '@/utils/getPrem';//权限判断fn
import Details from "@/components/Details";
let SendList = (props) => {
const { global, dispatch } = props;
const actionRef = useRef(),
[details, cdetails] = useState({
totalTitle: "推送记录详情",
visible: false,
dataSource: {},
totalCard: []
});
let columns = [
{
"title": "推送时间",
"dataIndex": "sendTime",
"key": "sendTimeList",
"valueType": "dateRange"
},
{
"title": "接收用户",
"dataIndex": "userName",
"key": "userName"
},
{
"title": "推送方式",
"dataIndex": "sendMethodName",
"key": "sendMethodName",
search:false
},
{
"title": "推送内容",
"dataIndex": "msgContent",
"key": "msgContent"
},
{
"title": "状态",
"dataIndex": "sendResultName",
"key": "sendResult",
"valueType": "select",
options: [
{
"label": "成功",
"value": 1
},
{
"label": "失败",
"value": 2
}
]
},
{
title: '操作',
valueType: 'option',
width: 120,
render: (text, row, _, action) => extraAction(text, row, _, action)
},
]
function extraAction(text, record, _, action) {
return (
<div>
{
getPrem(true, null, "查看详情", () => {
cdetails(details => {
return {
...details,
visible: true,
dataSource: record,
totalCard: [
{ //每一个模块信息
cardTitle: '记录详情',
itemData: [
{
"title": "推送时间",
"key": "sendTime"
},
{
"title": "接收用户",
"key": "userName"
},
{
"title": "推送方式",
"key": "sendMethodName"
},
{
"title": "消息标题",
"key": "msgTitle",
col: { span: 24 }
},
{
"title": "消息内容",
"key": "msgContent",
col: { span: 24 }
}
]
}
]
}
})
})
}
</div>
);
}
// let extrarender = ([<Button type="primary" onClick={() => {
// }}>导出</Button>])
return (
<div>
<AutoTable
pagetitle={props.route.name} //页面标题
// pageextra={extrarender} //页面操作 新增or批量删除
columns={columns}
actionRef={actionRef}
path="/ngic-base-business/paMsgSendRecord/queryList"
></AutoTable>
<Drawer
title={details.totalTitle}
closable={true}
visible={details.visible}
onClose={() => { cdetails({ ...details, visible: false }) }}
destroyOnClose={true}
afterVisibleChange={(v) => {
cdetails({
...details,
shown: v
})
}}
width="100%"
className="drawerDetails"
>
{details.shown && <Details {...details}></Details>}
</Drawer>
</div>
)
}
export default SendList
\ No newline at end of file
import React, { memo, useEffect, useRef, useState, useReducer } from 'react';
import { Image, Divider, Menu, Dropdown, Button, Modal, Row, Col, Tooltip, Drawer, Form, Input, message, Typography } from 'antd';
import { connect, useRequest } from "umi";
import AutoTable from '@/components/AutoTable';
import getPrem from '@/utils/getPrem';//权限判断fn
import InitForm from '@/components/InitForm';
import { doFetch } from '@/utils/doFetch';
import { tableField } from "./fields";
import moment from "moment";
import { factory, allDepartment, allShop, allSection, roleList, currentUserList } from "@/services/system";
const { TextArea } = Input,
{ Paragraph } = Typography;
const initState = {
vs: false,
tableFields: {},
iftype: {},
tableData: [],
hidesTitle: true,
hidesContent: true,
formFields: {},
tableLoading: false,
variableVisible: false,
variableExtraparams: ""
},
sendToArr = [
{
"label": "指定人员",
"value": 1
},
{
"label": "可指定人员",
"value": 2
},
{
"label": "创建人",
"value": 3
},
{
"label": "(指定人员)上级领导",
"value": 4
},
{
"label": "(上个通知人员)上级领导",
"value": 5
},
{
"label": "选择角色",
"value": 6
},
{
"label": "选择人员",
"value": 7
}
],
unitArr = [
{
"label": "分钟",
"value": 1
},
{
"label": "小时",
"value": 2
},
{
"label": "天",
"value": 3
}
],
sendProcessArr = [
{
label: "一级通知",
value: 1
},
{
label: "二级通知",
value: 2
},
{
label: "三级通知",
value: 3
},
{
label: "四级通知",
value: 4
},
{
label: "五级通知",
value: 5
},
{
label: "六级通知",
value: 6
},
{
label: "七级通知",
value: 7
},
{
label: "八级通知",
value: 8
}
];
function reducer(state, action) {
if (action.type == "add") {
return {
...state,
vs: true,
tableFields: { ...action.tableFields },
iftype: {
val: "add",
title: "新增基础设置",
id: ""
}
}
} else if (action.type == "edit") {
return {
...state,
vs: true,
tableFields: { ...action.tableFields },
iftype: {
val: "edit",
title: "修改基础设置",
id: action.curitem.id
}
}
} else if (action.type == "changeHideTitle") {
return {
...state,
hidesTitle: action.hidesTitle
}
} else if (action.type == "changeHideContent") {
return {
...state,
hidesContent: action.hidesContent
}
} else if (action.type == "changeFormFields") {
return {
...state,
formFields: { ...action.formFields }
}
} else if (action.type == "start") {
return {
...state,
formFields: { ...action.formFields },
tableData: [...action.tableData]
}
} else if (action.type == "changeTableFields") {
return {
...state,
tableFields: { ...action.tableFields }
}
} else if (action.type == "changeTableData") {
return {
...state,
tableData: [...action.tableData],
vs: false,
tableLoading: false
}
} else if (action.type == "changeLoading") {
return {
...state,
tableLoading: true
}
} else if (action.type == "changeShown") {
return {
...state,
shown: action.shown
}
} else if (action.type == "openVariable") {
return {
...state,
variableVisible: true,
variableExtraparams: action.variableExtraparams
}
} else if (action.type == "close") {
return {
...state,
vs: false,
iftype: {},
tableFields: {},
variableVisible: false,
variableExtraparams: ""
}
}
};
const Variable = (props) => {
const { businessMsgSceneId, dispatch } = props;
return <div>
<AutoTable
columns={[
{
"title": "变量名",
"dataIndex": "variableName",
"key": "variableName",
"width":120
},
{
"title": "变量代码",
"dataIndex": "variableCode",
"key": "variableCode",
"search": false
},
{
"title": "复制",
"valueType": "option",
"search": false,
render: (_, row) => {
return <Paragraph copyable={{
text: row.variableCode, onCopy: () => {
dispatch({ type: "close" })
}
}}>复制</Paragraph>
}
}
]}
bordered={false}
path="/ngic-base-business/paBusinessMsgSceneVariable/queryPageBySceneId"
extraparams={{ businessMsgSceneId }}
x={"100%"}
></AutoTable>
</div>
}
const Formpage = (props) => {
const { rowMessage, reset, iftypeParent } = props;
let actionRef = useRef(), ChildRef = null;
function reload() {
actionRef?.current?.reload();
ChildRef?.onRefresh();
}
useEffect(() => {
if (iftypeParent.val == "add") {
for (let i in fields) {
fields[i].hides = false;
fields[i].value = null;
}
} else if (iftypeParent.val == "edit") {
let database = getdatabase(rowMessage["fitField"]);
for (let i in fields) {
fields[i].value = rowMessage[i];
if (i == "sendMethodType") {
showTitleorContent(rowMessage[i]);
form.setFieldsValue({ "sendTitle": rowMessage.sendTitle, "sendContent": rowMessage.sendContent })
}
if (i == "fieldId" && rowMessage["fitField"] == 1) {
fields[i].hides = true
} else if (i == "fieldId" && rowMessage["fitField"] != 1) {
fields[i].hides = false
fields[i].options = {
database,
params: {}
}
}
}
}
dispatch({ type: "start", formFields: { ...fields }, tableData: iftypeParent.val == "add" ? [] : rowMessage?.detailList });
}, [fields])
const { fields } = props,
[form] = Form.useForm(),
[forms] = Form.useForm(),
[tableFormRef] = Form.useForm(),
[state, dispatch] = useReducer(reducer, initState),
{ vs, tableFields, iftype, tableData, hidesTitle, hidesContent, formFields, tableLoading, variableVisible, shown, variableExtraparams } = state,
columns = [
{
"title": "推送流程",
"dataIndex": "sendProcessName",
"key": "sendProcessName",
"search": false
},
{
"title": "推送对象",
"dataIndex": "sendToName",
"key": "sendToName",
"search": false
},
{
"title": "选择对象",
"dataIndex": "targetNames",
"key": "targetNames",
"search": false
},
{
"title": "初始触发时长",
"dataIndex": "initialTime",
"key": "initialTime",
"search": false
},
{
"title": "初始触发时长单位",
"dataIndex": "initialUnitName",
"key": "initialUnitName",
"search": false
},
{
"title": "间隔时长",
"dataIndex": "intervalTime",
"key": "intervalTime",
"search": false
},
{
"title": "间隔时长单位",
"dataIndex": "intervalUnitName",
"key": "intervalUnitName",
"search": false
},
{
"title": "触发次数",
"dataIndex": "sendNum",
"key": "sendNum",
"search": false
},
{
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => extraAction(text, row, _, action)
}
],
{ run, loading } = useRequest(doFetch, {
manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => {
if (result.code == "0000") {
reset && reset();
}
}
});
let extrarender = ([
<Button size={"middle"} type="primary" onClick={() => {
for (let i in tableField) {
tableField[i].value = null;
if (i == "targetIdList") {
tableField[i].hides = true
tableField[i].value = []
}
if (i == "initialTime") {
tableField[i].value = 0
}
if (i == "intervalTime") {
tableField[i].value = 1
}
if (i == "sendNum") {
tableField[i].value = 1
}
}
dispatch({ type: "add", tableFields: tableField });
}}>新增</Button>
]);
function extraAction(text, record, _, action) {
return (
<div>
{
getPrem(true, null, "修改", () => {
for (let j in tableField) {
tableField[j].value = record[j];
if (j == "targetIdList") {
if (record.sendTo != 6 && record.sendTo != 7) {
tableField[j].hides = true
} else {
let database = getformdatabase(record.sendTo)
tableField[j].hides = false
tableField[j].options = {
database,
params: {}
}
}
}
dispatch({ type: "edit", tableFields: tableField, curitem: record });
}
})
}
<Divider type="vertical" />
{
getPrem(true, "red", "删除", null, {
title: "确认删除该基础配置?",
onConfirm: () => {
let newData = tableData.filter(it => it.id != record.id);
dispatch({ type: "changeTableData", tableData: newData });
}
})
}
</div>
);
}
let saveData = (values, fn) => {
dispatch({ type: "changeLoading" });
const { sendTo, targetIdList, sendProcess, initialUnit, initialTime, intervalTime, intervalUnit, sendNum } = values;
let targetNames = [];
let all = async () => {
if (sendTo == 6) {
let data = await roleList({});
return {
newArr: data?.data?.dataList || []
}
} else if (sendTo == 7) {
let data = await currentUserList({});
return {
newArr: data?.data?.dataList || []
}
} else {
return {
newArr: []
}
}
}
all().then(res => {
let dataArr = res.newArr;
targetNames = dataArr?.filter(it => targetIdList?.indexOf(it.value) > -1)?.map(it => it.label)?.join(",") || "";
let params = {
sendTo,
targetNames,
sendProcess,
sendProcessName: sendProcessArr.filter(it => it.value == sendProcess).length > 0 ? sendProcessArr.filter(it => it.value == sendProcess)[0].label : "",
initialUnit,
initialTime,
intervalTime,
intervalUnit,
sendNum,
targetIdList,
id: iftype.id ? iftype.id : moment().valueOf() + Math.floor(Math.random() * (9999 - 1000)) + 1000,
sendToName: sendToArr.filter(it => it.value == sendTo).length > 0 ? sendToArr.filter(it => it.value == sendTo)[0].label : "",
initialUnitName: unitArr.filter(it => it.value == initialUnit).length > 0 ? unitArr.filter(it => it.value == initialUnit)[0].label : "",
intervalUnitName: unitArr.filter(it => it.value == intervalUnit).length > 0 ? unitArr.filter(it => it.value == intervalUnit)[0].label : ""
},
newTable;
if (iftype.val == "edit") {
newTable = tableData.map(it => {
if (it.id == iftype.id) {
it = { ...params }
}
return it;
});
} else {
newTable = [...tableData];
newTable.unshift(params);
}
dispatch({ type: "changeTableData", tableData: newTable });
})
},
saveForm = () => {
let editId = rowMessage ? { id: rowMessage.id } : {},
all = async () => {
let values = await forms.validateFields(),
valuesc = await form.validateFields();
return {
values,
valuesc
}
};
all().then(res => {
if (!tableData.length) {
return message.warning("基础配置不可为空!")
}
let detailList = tableData.map(it => {
if (iftypeParent.val == "edit") {
return {
sendProcess: it.sendProcess,
sendTo: it.sendTo,
targetIdList: it.targetIdList,
initialTime: it.initialTime,
initialUnit: it.initialUnit,
intervalTime: it.intervalTime,
intervalUnit: it.intervalUnit,
sendNum: it.sendNum,
id: it.id && typeof (it.id) == "number" ? "" : it.id
}
} else {
return {
sendProcess: it.sendProcess,
sendTo: it.sendTo,
targetIdList: it.targetIdList,
initialTime: it.initialTime,
initialUnit: it.initialUnit,
intervalTime: it.intervalTime,
intervalUnit: it.intervalUnit,
sendNum: it.sendNum
}
}
}),
params = {
...res.values,
...res.valuesc,
detailList,
...editId
};
run({ url: "/qj/ngic-base-business/paBusinessMsgOption/save", params: { ...params } })
})
};
function showTitleorContent(val) {
if (val == 4) {
dispatch({ type: "changeHideTitle", hidesTitle: false })
} else {
dispatch({ type: "changeHideTitle", hidesTitle: false })
}
if (val == 2) {
dispatch({ type: "changeHideContent", hidesContent: false })
} else {
dispatch({ type: "changeHideContent", hidesContent: false })
}
};
function getdatabase(val) {
let database;
switch (val) {
case 2:
database = factory
break;
case 3:
database = allDepartment
break;
case 4:
database = allShop
break;
case 5:
database = allSection
break;
}
return database;
}
function getformdatabase(val) {
let database;
switch (val) {
case 6:
database = roleList
break;
case 7:
database = currentUserList
break;
}
return database;
}
return <div>
<InitForm
fields={formFields}
onChange={(changedValues, allValues) => {
for (let i in changedValues) {
if (i == "sendMethodType") {
showTitleorContent(changedValues[i])
}
if (i == "fitField") {
let database = getdatabase(changedValues[i]);
for (let j in formFields) {
if (j == "fieldId" && changedValues[i] == 1) {
formFields[j].hides = true;
} else if (j == "fieldId" && changedValues[i] != 1) {
formFields[j].hides = false
formFields[j].options = {
database,
params: {}
};
forms.setFieldsValue({ "fieldId": "" })
}
}
dispatch({ type: "changeFormFields", formFields: formFields })
}
}
}}
actions={(form, submitBtn) => {
return null;
}}
formRef={forms}
>
</InitForm>
<Form form={form}>
{
!hidesTitle && <Form.Item
name="sendTitle"
rules={[
{
required: true,
message: '请输入推送标题',
},
]}
>
<div>
<div><span style={{ color: "#ff4d4f" }}>*</span> 推送标题</div>
<TextArea rows={4} defaultValue={iftypeParent.val == "edit" ? rowMessage.sendTitle : ""} />
</div>
</Form.Item>
}
{
(!hidesTitle || !hidesContent) && <Button type="primary" style={{ marginBottom: 15 }} onClick={() => {
let params = forms.getFieldValue("businessMsgSceneId");
dispatch({ type: "openVariable", variableExtraparams: params });
}}>查看变量</Button>
}
{
!hidesContent && <Form.Item
name="sendContent"
rules={[
{
required: true,
message: '请输入推送内容',
},
]}
>
<div>
<div><span style={{ color: "#ff4d4f" }}>*</span> 推送内容</div>
<TextArea rows={4} defaultValue={iftypeParent.val == "edit" ? rowMessage.sendContent : ""} />
</div>
</Form.Item>
}
</Form>
{
!tableLoading && <AutoTable
pagetitle="基础设置"
pageextra={extrarender}
columns={columns}
actionRef={actionRef}
onRef={node => ChildRef = node}
dataSource={tableData}
></AutoTable>
}
<div style={{ display: "flex", marginTop: 15 }}>
<Button loading={loading} type="primary" size="large" style={{ flex: 1 }} onClick={saveForm}>提交</Button>
</div>
<Modal
maskClosable={false}
title={iftype.title}
visible={vs}
onCancel={() => dispatch({ type: "close" })}
style={{ top: 20 }}
footer={false}
width="1000px"
destroyOnClose={true}
>
<InitForm
fields={tableFields}
submitData={(values, fn) => {
saveData(values, fn)
}}
formRef={tableFormRef}
onChange={(changedValues, allValues) => {
for (let i in changedValues) {
if (i == "sendTo") {
for (let j in tableField) {
if (j == "targetIdList") {
tableFormRef.setFieldsValue({ "targetIdList": [] });
tableField[j].value = [];
if (changedValues[i] != 6 && changedValues[i] != 7) {
tableField[j].hides = true
} else {
let database = getformdatabase(changedValues[i]);
tableField[j].hides = false
tableField[j].options = {
database,
params: {}
}
}
}
}
dispatch({ type: "changeTableFields", tableFields: tableField })
}
}
}}
>
</InitForm>
</Modal>
<Drawer
title={"查看变量"}
closable={true}
visible={variableVisible}
onClose={() => dispatch({ type: "close" })}
destroyOnClose={true}
afterVisibleChange={(v) => {
dispatch({ type: "changeShown", shown: v });
}}
width="40%"
>
{shown && <Variable businessMsgSceneId={variableExtraparams} dispatch={dispatch} />}
</Drawer>
</div>
}
export default Formpage;
\ No newline at end of file
import { paBusinessMsgScene } from "@/services/platform";
import { doFetch } from "@/utils/doFetch";
import regValue from "@/utils/regValue";
let numReg = regValue("integer");
const addFields = {
"businessMsgSceneId": {
"value": null,
"type": "select",
"title": "推送类型",
"name": [
"businessMsgSceneId"
],
"required": true,
"options": {
"database": paBusinessMsgScene,
"params": {}
}
},
"sendMethodType": {
"value": null,
"type": "select",
"title": "推送方式",
"name": [
"sendMethodType"
],
"required": true,
"options": [
{
"label": "企业微信",
"value": 1
},{
"label": "邮件",
"value": 2
}
]
},
"fitField": {
"value": null,
"type": "select",
"title": "适用类型",
"name": [
"fitField"
],
"required": true,
"options": [
{
"label": "全部",
"value": 1
},
{
"label": "组织",
"value": 2
},
{
"label": "部门",
"value": 3
},
{
"label": "工厂",
"value": 4
},
{
"label": "车间",
"value":5
}
]
},
"fieldId": {
"value": null,
"type": "select",
"title": "类型名称",
"name": [
"fieldId"
],
"required": true,
"hides":false,
"options":[]
}
},
tableField={
"sendProcess": {
"value": null,
"type": "select",
"title": "推送流程",
"name": [
"sendProcess"
],
"required": true,
options:[
{
label:"一级通知",
value:1
},
{
label:"二级通知",
value:2
},
{
label:"三级通知",
value:3
},
{
label:"四级通知",
value:4
},
{
label:"五级通知",
value:5
},
{
label:"六级通知",
value:6
},
{
label:"七级通知",
value:7
},
{
label:"八级通知",
value:8
}
]
},
"sendTo": {
"value": null,
"type": "select",
"title": "推送对象",
"name": [
"sendTo"
],
"required": true,
"options": [
{
"label": "指定人员",
"value": 1
},
{
"label": "可指定人员",
"value": 2
},
{
"label": "创建人",
"value": 3
},
{
"label": "(指定人员)上级领导",
"value": 4
},
{
"label": "(上个通知人员)上级领导",
"value": 5
},
{
"label": "选择角色",
"value": 6
},
{
"label": "选择人员",
"value": 7
}
]
},
"targetIdList": {
"value": null,
"type": "select",
"title": "选择对象",
"name": [
"targetIdList"
],
"required": true,
"options": [],
hides:true,
multiple:true
},
"initialTime": {
"value": null,
"type": "inputnumber",
"title": "初始触发时长",
"name": [
"initialTime"
],
"required": true,
min:0,
...numReg
},
"initialUnit": {
"value": null,
"type": "select",
"title": "初始触发时长单位",
"name": [
"initialUnit"
],
"required": true,
"options": [
{
"label": "分钟",
"value": 1
},
{
"label": "小时",
"value": 2
},
{
"label": "天",
"value": 3
}
]
},
"intervalTime": {
"value": null,
"type": "inputnumber",
"title": "间隔时长",
"name": [
"intervalTime"
],
"required": true,
min:1,
...numReg
},
"intervalUnit": {
"value": null,
"type": "select",
"title": "间隔时长单位",
"name": [
"intervalUnit"
],
"required": true,
"options": [
{
"label": "分钟",
"value": 1
},
{
"label": "小时",
"value": 2
},
{
"label": "天",
"value": 3
}
]
},
"sendNum": {
"value": null,
"type": "inputnumber",
"title": "触发次数",
"name": [
"sendNum"
],
"required": true,
min:1,
...numReg
}
};
export {addFields, tableField}
\ No newline at end of file
import React, { memo, useEffect, useRef, useState, useReducer } from 'react';
import { Image, Divider, Menu, Dropdown, Button, Modal, Row, Col, Tooltip, Drawer } from 'antd';
import { connect, useRequest } from "umi";
import AutoTable from '@/components/AutoTable';
import getPrem from '@/utils/getPrem';//权限判断fn
import { doFetch } from '@/utils/doFetch';
import { paBusinessMsgScene, paBusinessMsgOption } from "@/services/platform";
import { addFields } from "./fields";
import Formpage from "./Formpage";
import Details from "@/components/Details";
const initState = {
vs: false,
fields: {},
iftype: {},
details: {
totalTitle: "",
visible: false,
dataSource: {},
totalCard: []
},
shown: false,
rowMessage: {}
}
function reducer(state, action) {
if (action.type == "add") {
return {
...state,
vs: true,
fields: action.fields,
iftype: {
val: "add",
title: "新增推送配置"
},
rowMessage: {}
}
} else if (action.type == "close") {
return {
...state,
vs: false,
iftype: {},
fields: {},
details: {
totalTitle: "",
visible: false,
dataSource: {},
totalCard: []
},
shown: false
}
} else if (action.type == "edit") {
return {
...state,
vs: true,
fields: action.fields,
iftype: {
val: "edit",
title: "修改推送配置",
id: action.rowMessage.id
},
rowMessage: action.rowMessage
}
} else if (action.type == "seeDetails") {
return {
...state,
details: {
totalTitle: "推送详情",
visible: true,
dataSource: { ...action.dataSource },
totalCard: [...action.totalCard]
}
}
} else if (action.type == "changeShown") {
return {
...state,
shown: action.shown
}
}
}
const Pushdeploy = (props) => {
let actionRef = useRef(), ChildRef = null;
function reload() {
actionRef?.current?.reload();
ChildRef?.onRefresh();
}
const [state, dispatch] = useReducer(reducer, initState),
{ vs, fields, iftype, details, shown, rowMessage } = state,
columns = [
{
"title": "推送类型",
"dataIndex": "msgSceneName",
"key": "businessMsgSceneId",
"valueType": "select",
render: (_, row) => {
return <div style={{ padding: '3px 0', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' }}>
<Tooltip title={row.msgSceneName}>
<a onClick={() => {
let commons = [
{
"title": "推送类型",
"key": "msgSceneName"
},
{
"title": "推送方式",
"key": "sendMethodName"
},
{
"title": "适用类型",
"key": "fitFieldName"
},
], table = {
"key": "detailList",
col: { span: 24 },
type: "table",
columns: [
{
"title": "推送流程",
"dataIndex": "sendProcessName",
"key": "sendProcessName",
"search": false
},
{
"title": "推送对象",
"dataIndex": "sendToName",
"key": "sendToName",
"search": false
},
{
"title": "选择对象",
"dataIndex": "targetNames",
"key": "targetNames",
"search": false
},
{
"title": "初始触发时长",
"dataIndex": "initialTime",
"key": "initialTime",
"search": false
},
{
"title": "初始触发时长单位",
"dataIndex": "initialUnitName",
"key": "initialUnitName",
"search": false
},
{
"title": "间隔时长",
"dataIndex": "intervalTime",
"key": "intervalTime",
"search": false
},
{
"title": "间隔时长单位",
"dataIndex": "intervalUnitName",
"key": "intervalUnitName",
"search": false
},
{
"title": "触发次数",
"dataIndex": "sendNum",
"key": "sendNum",
"search": false
}
]
},
totalCardsc,
contentMsg,
fieldMsg;
contentMsg = {
"title": "推送内容",
"key": "sendContent",
col: { span: 24 }
};
if (row.fitField == 1) {
fieldMsg = null;
} else {
fieldMsg = {
"title": "类型名称",
"key": "fieldName"
}
}
totalCardsc = [
{
cardTitle: '推送信息',
itemData: [
...commons,
fieldMsg && { ...fieldMsg },
contentMsg && { ...contentMsg },
]
},
{
cardTitle: '基础配置',
itemData: [
{ ...table }
]
}
];
totalCardsc.map(it => {
let newData = it.itemData.filter(item => item);
it.itemData = [...newData];
})
paBusinessMsgOption({ id: row.id }).then(res => {
if (res.code == "0000") {
let data = res?.data?.data || {};
dispatch({ type: "seeDetails", totalCard: [...totalCardsc], dataSource: { ...data } })
}
})
}}>{row.msgSceneName}</a>
</Tooltip>
</div>
},
options: {
database: paBusinessMsgScene,
params: {}
}
},
{
"title": "推送方式",
"dataIndex": "sendMethodName",
"key": "sendMethodName",
search: false
},
{
"title": "适用类型",
"dataIndex": "fitFieldName",
"key": "fitField",
"valueType": "select",
"options": [
{
"label": "全部",
"value": 1
},
{
"label": "组织",
"value": 2
},
{
"label": "部门",
"value": 3
},
{
"label": "工厂",
"value": 4
},
{
"label": "车间",
"value": 5
}
]
},
{
"title": "类型名称",
"dataIndex": "fieldName",
"key": "fieldName"
},
{
"title": "推送内容",
"dataIndex": "sendContent",
"key": "sendContent",
"search": false
},
{
title: '操作',
valueType: 'option',
width: 150,
render: (text, row, _, action) => extraAction(text, row, _, action)
}
],
{ run, loading } = useRequest(doFetch, {
manual: true,
formatResult: (res) => res,
onSuccess: (result, params) => {
if (result.code == "0000") {
reload();
dispatch({ type: "close" });
}
}
});
function extraAction(text, record, _, action) {
return (
<div>
{
getPrem("paBusinessMsgOption_save", action, "修改", () => {
paBusinessMsgOption({ id: record.id }).then(res => {
if (res.code == "0000") {
let data = res?.data?.data || {};
for (let i in addFields) {
addFields[i].value = data[i]
}
dispatch({ type: "edit", rowMessage: data, fields: addFields })
}
})
})
}
{getPrem("paBusinessMsgOption_save", "ifs") && <Divider type="vertical" />}
{
getPrem("paBusinessMsgOption_deleteById", action, "删除", null, {
title: "确认删除该推送配置?",
onConfirm: () => {
run({ url: "/qj/ngic-base-business/paBusinessMsgOption/deleteById", params: { id: record.id } })
}
})
}
</div>
);
};
function reset() {
reload();
dispatch({ type: "close" })
}
let extrarender = ([
<Button disabled={!getPrem("paBusinessMsgOption_save", "ifs")} size={"middle"} type="primary" onClick={() => {
for (let i in addFields) {
addFields[i].value = null;
}
dispatch({ type: "add", fields: addFields });
}}>新增</Button>
]);
return <div>
<AutoTable
pagetitle={props.route.name}
pageextra={extrarender}
columns={columns}
bordered={false}
actionRef={actionRef}
onRef={node => ChildRef = node}
path="/ngic-base-business/paBusinessMsgOption/queryList"
></AutoTable>
<Drawer
title={iftype.title}
closable={true}
visible={vs}
onClose={() => dispatch({ type: "close" })}
destroyOnClose={true}
afterVisibleChange={(v) => {
dispatch({ type: "changeShown", shown: v });
}}
width="100%"
>
{shown && <Formpage fields={fields} rowMessage={rowMessage} reset={reset} iftypeParent={iftype} />}
</Drawer>
<Drawer
title={details.totalTitle}
closable={true}
visible={details.visible}
onClose={() => dispatch({ type: "close" })}
destroyOnClose={true}
afterVisibleChange={(v) => {
dispatch({ type: "changeShown", shown: v });
}}
width="100%"
className="drawerDetails"
>
{shown && <Details {...details}></Details>}
</Drawer>
</div>
}
export default Pushdeploy;
\ No newline at end of file
...@@ -47,3 +47,18 @@ export async function bmTableFileSelect(params) { ...@@ -47,3 +47,18 @@ export async function bmTableFileSelect(params) {
data: params, data: params,
}); });
} }
//推送类型下拉
export async function paBusinessMsgScene(params) {
return request(`/wms/ngic-base-business/paBusinessMsgScene/queryAllForSelect`, {
method: 'POST',
data: params,
});
}
//推送配置
export async function paBusinessMsgOption(params) {
return request(`/wms/ngic-base-business/paBusinessMsgOption/queryById`, {
method: 'POST',
data: params,
});
}
\ No newline at end of file
...@@ -43,6 +43,13 @@ export async function storeselectionBox(params) { ...@@ -43,6 +43,13 @@ export async function storeselectionBox(params) {
data: params, data: params,
}); });
} }
//全部部门下拉
export async function allDepartment(params) {
return request(`/wms/ngic-auth/sysDepartment/query/selectbox/depart`, {
method: 'POST',
data: params,
});
}
//根据工厂id查询车间下拉 //根据工厂id查询车间下拉
export async function shopSelectByFactory(params) { export async function shopSelectByFactory(params) {
...@@ -168,3 +175,38 @@ export async function shiftSelectByShopId(params) { ...@@ -168,3 +175,38 @@ export async function shiftSelectByShopId(params) {
data: params, data: params,
}); });
} }
//角色下拉框
export async function roleList(params) {
return request(`/wms/ngic-auth/sysRole/queryAllSelectList`, {
method: 'POST',
data: params,
});
}
//集团下拉框
export async function factory(params) {
return request(`/wms/ngic-auth/sysDepartment/query/selectbox/factory`, {
method: 'POST',
data: params,
});
}
//下拉框---当前公司下
export async function currentUserList(params) {
return request(`/wms/ngic-auth/sysUser/query/selectbox/current/company`, {
method: 'POST',
data: params,
});
}
//当前公司所有工厂下拉
export async function allShop(params) {
return request(`/wms/ngic-auth/sysShop/query/selectbox/current/company`, {
method: 'POST',
data: params,
});
}
//当前公司所有车间下拉
export async function allSection(params) {
return request(`/wms/ngic-auth/sysSection/query/selectbox`, {
method: 'POST',
data: params,
});
}
\ 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