智能算薪-其他三个tab下的功能开发
This commit is contained in:
parent
50c880d868
commit
cf06016fa2
|
|
@ -41,3 +41,15 @@ export const apiflowWarnConfigSave = (params) => {
|
||||||
export const apiflowWarnReceiverList = (params) => {
|
export const apiflowWarnReceiverList = (params) => {
|
||||||
return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/receiver/list", "GET", params);
|
return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/receiver/list", "GET", params);
|
||||||
};
|
};
|
||||||
|
//智能算薪-编辑保存流量不足提醒对象
|
||||||
|
export const apiflowWarnReceiverSave = (params) => {
|
||||||
|
return postFetch("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/receiver/save", params);
|
||||||
|
};
|
||||||
|
//智能算薪-编辑保存流量不足提醒对象
|
||||||
|
export const apiflowWarnReceiverGetForm = (params) => {
|
||||||
|
return postFetch("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/receiver/getForm", params);
|
||||||
|
};
|
||||||
|
//智能算薪-流量不足提醒对象-删除
|
||||||
|
export const apiflowWarnReceiverDelete = (params) => {
|
||||||
|
return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/receiver/delete", "GET", params);
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ export const remindObjConditions = [
|
||||||
colSpan: 1,
|
colSpan: 1,
|
||||||
conditionType: "BROWSER",
|
conditionType: "BROWSER",
|
||||||
rules: "required|string",
|
rules: "required|string",
|
||||||
domkey: ["adminUserIds"],
|
domkey: ["employeeId"],
|
||||||
fieldcol: 12,
|
fieldcol: 12,
|
||||||
label: "提醒对象",
|
label: "提醒对象",
|
||||||
lanId: 111,
|
lanId: 111,
|
||||||
|
|
|
||||||
|
|
@ -7,31 +7,81 @@
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
import { WeaDialog, WeaLocaleProvider } from "ecCom";
|
import { WeaDialog, WeaLocaleProvider } from "ecCom";
|
||||||
import { Button } from "antd";
|
import { Button, message } from "antd";
|
||||||
import { getSearchs } from "../../../util";
|
import { getSearchs } from "../../../util";
|
||||||
import { remindObjConditions } from "./constants";
|
import { remindObjConditions } from "./constants";
|
||||||
|
import { apiflowWarnReceiverGetForm, apiflowWarnReceiverSave } from "../../../apis/intelligentCalculateSalarySettings";
|
||||||
|
|
||||||
const getLabel = WeaLocaleProvider.getLabel;
|
const getLabel = WeaLocaleProvider.getLabel;
|
||||||
|
|
||||||
@inject("intelligentStore")
|
@inject("intelligentStore")
|
||||||
@observer
|
@observer
|
||||||
class EditBeRemindObjDialog extends Component {
|
class EditBeRemindObjDialog extends Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
loading: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps, nextContext) {
|
componentWillReceiveProps(nextProps, nextContext) {
|
||||||
const { intelligentStore: { remindObjform } } = nextProps;
|
const { intelligentStore: { remindObjform }, id } = nextProps;
|
||||||
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
||||||
remindObjform.initFormFields(remindObjConditions);
|
remindObjform.initFormFields(remindObjConditions);
|
||||||
|
id && this.apiflowWarnReceiverGetForm(nextProps);
|
||||||
}
|
}
|
||||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||||
remindObjform.resetForm();
|
remindObjform.resetForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apiflowWarnReceiverGetForm = (props) => {
|
||||||
|
const { intelligentStore: { remindObjform } } = this.props;
|
||||||
|
const { id } = props;
|
||||||
|
apiflowWarnReceiverGetForm({ id }).then(({ status, data }) => {
|
||||||
|
if (status) {
|
||||||
|
const { employee } = data;
|
||||||
|
remindObjform.updateFields({
|
||||||
|
"employeeId": {
|
||||||
|
value: employee[0].id,
|
||||||
|
valueSpan: employee[0].content,
|
||||||
|
valueObj: [{ id: employee[0].id, name: employee[0].content }]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
save = () => {
|
||||||
|
const { intelligentStore: { remindObjform }, warnConfigId, id } = this.props;
|
||||||
|
remindObjform.validateForm().then(f => {
|
||||||
|
const { employeeId } = remindObjform.getFormParams();
|
||||||
|
if (f.isValid) {
|
||||||
|
this.setState({ loading: true });
|
||||||
|
apiflowWarnReceiverSave({ employeeId, warnConfigId, id }).then(({ status, errormsg }) => {
|
||||||
|
this.setState({ loading: false });
|
||||||
|
if (status) {
|
||||||
|
message.success(getLabel(22619, "保存成功!"));
|
||||||
|
this.props.updateWarnList();
|
||||||
|
this.props.onCancel();
|
||||||
|
} else {
|
||||||
|
message.error(errormsg);
|
||||||
|
}
|
||||||
|
}).catch(() => this.setState({ loading: false }));
|
||||||
|
} else {
|
||||||
|
f.showErrors();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intelligentStore: { remindObjform } } = this.props;
|
const { intelligentStore: { remindObjform } } = this.props;
|
||||||
return (
|
return (
|
||||||
<WeaDialog
|
<WeaDialog
|
||||||
{...this.props} className="paymentDialog" initLoadCss
|
{...this.props} className="paymentDialog" initLoadCss
|
||||||
style={{ width: 550 }} buttons={[<Button type="primary">{getLabel(537558, "保存")}</Button>]}
|
style={{ width: 550 }}
|
||||||
|
buttons={[<Button type="primary" onClick={this.save}
|
||||||
|
loading={this.state.loading}>{getLabel(537558, "保存")}</Button>]}
|
||||||
>
|
>
|
||||||
<div className="paymentDialogContent">
|
<div className="paymentDialogContent">
|
||||||
{getSearchs(remindObjform, remindObjConditions, 1)}
|
{getSearchs(remindObjform, remindObjConditions, 1)}
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,13 @@ import {
|
||||||
WeaSearchGroup,
|
WeaSearchGroup,
|
||||||
WeaTable
|
WeaTable
|
||||||
} from "ecCom";
|
} from "ecCom";
|
||||||
import { Modal } from "antd";
|
import { message, Modal, Spin } from "antd";
|
||||||
import EditBeRemindObjDialog from "./editBeRemindObjDialog";
|
import EditBeRemindObjDialog from "./editBeRemindObjDialog";
|
||||||
import { apiflowWarnConfigGetForm, apiflowWarnReceiverList } from "../../../apis/intelligentCalculateSalarySettings";
|
import {
|
||||||
|
apiflowWarnConfigGetForm,
|
||||||
|
apiflowWarnReceiverDelete,
|
||||||
|
apiflowWarnReceiverList
|
||||||
|
} from "../../../apis/intelligentCalculateSalarySettings";
|
||||||
|
|
||||||
const getLabel = WeaLocaleProvider.getLabel;
|
const getLabel = WeaLocaleProvider.getLabel;
|
||||||
|
|
||||||
|
|
@ -31,8 +35,7 @@ class InsufficientTrafficAlert extends Component {
|
||||||
{ label: "邮件", type: "email", channel: "3", value: "1", config: {} },
|
{ label: "邮件", type: "email", channel: "3", value: "1", config: {} },
|
||||||
{ label: "短信", type: "message", channel: "4", value: "1", config: {} }
|
{ label: "短信", type: "message", channel: "4", value: "1", config: {} }
|
||||||
], columns: [], dataSource: [],
|
], columns: [], dataSource: [],
|
||||||
pageInfo: { current: 1, pageSize: 10, total: 0 },
|
loading: false, remindObjDialog: { visible: false, title: "", warnConfigId: "", id: "" }
|
||||||
loading: false, remindObjDialog: { visible: false, title: "" }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -56,15 +59,49 @@ class InsufficientTrafficAlert extends Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
apiflowWarnReceiverList = () => {
|
apiflowWarnReceiverList = () => {
|
||||||
const { pageInfo, remindEvent } = this.state;
|
const { remindEvent } = this.state;
|
||||||
const { id } = remindEvent;
|
const { id } = remindEvent;
|
||||||
const payload = {
|
const payload = {
|
||||||
warnConfigId: id || this.props.warnConfigId,
|
warnConfigId: id || this.props.warnConfigId
|
||||||
...pageInfo
|
|
||||||
};
|
};
|
||||||
apiflowWarnReceiverList(payload).then(({ status, data }) => {
|
apiflowWarnReceiverList(payload).then(({ status, data }) => {
|
||||||
if (status) {
|
if (status) {
|
||||||
console.log(data);
|
const { columns, list: dataSource } = data;
|
||||||
|
this.setState({
|
||||||
|
dataSource,
|
||||||
|
columns: _.map(columns, item => {
|
||||||
|
const { dataIndex } = item;
|
||||||
|
let width = "";
|
||||||
|
switch (dataIndex) {
|
||||||
|
case "employeeName":
|
||||||
|
case "mobile":
|
||||||
|
width = "30%";
|
||||||
|
break;
|
||||||
|
case "email":
|
||||||
|
width = "40%";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return { ...item, width };
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
apiflowWarnReceiverDelete = (id) => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: getLabel(131329, "信息确认"),
|
||||||
|
content: getLabel(111, "确定删除吗?删除后数据不可找回"),
|
||||||
|
onOk: () => {
|
||||||
|
apiflowWarnReceiverDelete({ id }).then(({ status, errormsg }) => {
|
||||||
|
if (status) {
|
||||||
|
message.success(getLabel(502230, "删除成功!"));
|
||||||
|
this.apiflowWarnReceiverList();
|
||||||
|
} else {
|
||||||
|
message.error(errormsg || getLabel(20462, "删除失败!"));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -97,26 +134,11 @@ class InsufficientTrafficAlert extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { enable, channelList, threshold, pageInfo, loading, columns, dataSource, remindObjDialog } = this.state;
|
const {
|
||||||
const pagination = {
|
remindEvent, enable, channelList, threshold,
|
||||||
...pageInfo,
|
loading, columns, dataSource, remindObjDialog
|
||||||
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
|
} = this.state;
|
||||||
showQuickJumper: true,
|
const { id } = remindEvent;
|
||||||
showSizeChanger: true,
|
|
||||||
pageSizeOptions: ["10", "20", "50", "100"],
|
|
||||||
onShowSizeChange: (current, pageSize) => {
|
|
||||||
this.setState({
|
|
||||||
pageInfo: { ...pageInfo, current, pageSize }
|
|
||||||
}, () => {
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onChange: current => {
|
|
||||||
this.setState({
|
|
||||||
pageInfo: { ...pageInfo, current }
|
|
||||||
}, () => {
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
return (
|
||||||
<WeaSearchGroup showGroup needTigger={false} className="insufficientAlertWrapper">
|
<WeaSearchGroup showGroup needTigger={false} className="insufficientAlertWrapper">
|
||||||
<WeaFormItem label={getLabel(501480, "提醒")} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
<WeaFormItem label={getLabel(501480, "提醒")} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
||||||
|
|
@ -157,25 +179,48 @@ class InsufficientTrafficAlert extends Component {
|
||||||
buttonType="add" type="primary"
|
buttonType="add" type="primary"
|
||||||
onClick={() => this.setState({
|
onClick={() => this.setState({
|
||||||
remindObjDialog: {
|
remindObjDialog: {
|
||||||
...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象")
|
...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象"),
|
||||||
|
warnConfigId: id || this.props.warnConfigId
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
{/* 添加提醒对象*/}
|
{/* 添加提醒对象*/}
|
||||||
<EditBeRemindObjDialog
|
<EditBeRemindObjDialog
|
||||||
{...remindObjDialog}
|
{...remindObjDialog}
|
||||||
|
updateWarnList={this.apiflowWarnReceiverList}
|
||||||
onCancel={() => this.setState({
|
onCancel={() => this.setState({
|
||||||
remindObjDialog: {
|
remindObjDialog: {
|
||||||
...remindObjDialog, visible: false, title: ""
|
...remindObjDialog, visible: false, title: "", warnConfigId: "", id: ""
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<WeaTable
|
{
|
||||||
columns={columns} dataSource={dataSource}
|
loading ? <div className="loading-layout">
|
||||||
pagination={pagination} loading={loading}
|
<Spin spinning={loading}/>
|
||||||
scroll={{ y: `calc(100vh - 226px)` }}
|
</div> : <WeaTable
|
||||||
/>
|
dataSource={dataSource} loading={loading}
|
||||||
|
columns={[
|
||||||
|
...columns,
|
||||||
|
{
|
||||||
|
title: getLabel(30585, "操作"), dataIndex: "operate", width: 120,
|
||||||
|
render: (__, record) => (<div className="space">
|
||||||
|
<a
|
||||||
|
href="javascript:void(0);" className="mr10"
|
||||||
|
onClick={() => this.setState({
|
||||||
|
remindObjDialog: {
|
||||||
|
...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象"),
|
||||||
|
warnConfigId: id || this.props.warnConfigId, id: record.id
|
||||||
|
}
|
||||||
|
})}>{getLabel(501169, "编辑")}</a>
|
||||||
|
<a href="javascript:void(0);"
|
||||||
|
onClick={() => this.apiflowWarnReceiverDelete(record.id)}>{getLabel(535052, "删除")}</a>
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
]} pagination={false}
|
||||||
|
scroll={{ y: `calc(100vh - 190px)` }}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</WeaSearchGroup>
|
</WeaSearchGroup>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,15 @@
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.space {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.mr10 {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.enable-settings {
|
.enable-settings {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue