diff --git a/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js b/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js index 0c2daeab..cd51bce3 100644 --- a/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js +++ b/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js @@ -41,3 +41,15 @@ export const apiflowWarnConfigSave = (params) => { export const apiflowWarnReceiverList = (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); +}; diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js index 8ec20f66..fb7c89c6 100644 --- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js +++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js @@ -81,7 +81,7 @@ export const remindObjConditions = [ colSpan: 1, conditionType: "BROWSER", rules: "required|string", - domkey: ["adminUserIds"], + domkey: ["employeeId"], fieldcol: 12, label: "提醒对象", lanId: 111, diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js index 79a41221..7342b369 100644 --- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js +++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js @@ -7,31 +7,81 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; -import { Button } from "antd"; +import { Button, message } from "antd"; import { getSearchs } from "../../../util"; import { remindObjConditions } from "./constants"; +import { apiflowWarnReceiverGetForm, apiflowWarnReceiverSave } from "../../../apis/intelligentCalculateSalarySettings"; const getLabel = WeaLocaleProvider.getLabel; @inject("intelligentStore") @observer class EditBeRemindObjDialog extends Component { + constructor(props) { + super(props); + this.state = { + loading: false + }; + } + componentWillReceiveProps(nextProps, nextContext) { - const { intelligentStore: { remindObjform } } = nextProps; + const { intelligentStore: { remindObjform }, id } = nextProps; if (nextProps.visible !== this.props.visible && nextProps.visible) { remindObjform.initFormFields(remindObjConditions); + id && this.apiflowWarnReceiverGetForm(nextProps); } if (nextProps.visible !== this.props.visible && !nextProps.visible) { 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() { const { intelligentStore: { remindObjform } } = this.props; return ( {getLabel(537558, "保存")}]} + style={{ width: 550 }} + buttons={[]} >
{getSearchs(remindObjform, remindObjConditions, 1)} diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js index 05589caf..c725a669 100644 --- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js +++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js @@ -14,9 +14,13 @@ import { WeaSearchGroup, WeaTable } from "ecCom"; -import { Modal } from "antd"; +import { message, Modal, Spin } from "antd"; import EditBeRemindObjDialog from "./editBeRemindObjDialog"; -import { apiflowWarnConfigGetForm, apiflowWarnReceiverList } from "../../../apis/intelligentCalculateSalarySettings"; +import { + apiflowWarnConfigGetForm, + apiflowWarnReceiverDelete, + apiflowWarnReceiverList +} from "../../../apis/intelligentCalculateSalarySettings"; const getLabel = WeaLocaleProvider.getLabel; @@ -31,8 +35,7 @@ class InsufficientTrafficAlert extends Component { { label: "邮件", type: "email", channel: "3", value: "1", config: {} }, { label: "短信", type: "message", channel: "4", value: "1", config: {} } ], columns: [], dataSource: [], - pageInfo: { current: 1, pageSize: 10, total: 0 }, - loading: false, remindObjDialog: { visible: false, title: "" } + loading: false, remindObjDialog: { visible: false, title: "", warnConfigId: "", id: "" } }; } @@ -56,15 +59,49 @@ class InsufficientTrafficAlert extends Component { }); }; apiflowWarnReceiverList = () => { - const { pageInfo, remindEvent } = this.state; + const { remindEvent } = this.state; const { id } = remindEvent; const payload = { - warnConfigId: id || this.props.warnConfigId, - ...pageInfo + warnConfigId: id || this.props.warnConfigId }; apiflowWarnReceiverList(payload).then(({ status, data }) => { 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() { - const { enable, channelList, threshold, pageInfo, loading, columns, dataSource, remindObjDialog } = this.state; - const pagination = { - ...pageInfo, - showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, - showQuickJumper: true, - showSizeChanger: true, - pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange: (current, pageSize) => { - this.setState({ - pageInfo: { ...pageInfo, current, pageSize } - }, () => { - }); - }, - onChange: current => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => { - }); - } - }; + const { + remindEvent, enable, channelList, threshold, + loading, columns, dataSource, remindObjDialog + } = this.state; + const { id } = remindEvent; return ( @@ -157,25 +179,48 @@ class InsufficientTrafficAlert extends Component { buttonType="add" type="primary" onClick={() => this.setState({ remindObjDialog: { - ...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象") + ...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象"), + warnConfigId: id || this.props.warnConfigId } })} /> {/* 添加提醒对象*/} this.setState({ remindObjDialog: { - ...remindObjDialog, visible: false, title: "" + ...remindObjDialog, visible: false, title: "", warnConfigId: "", id: "" } })} />
- + { + loading ?
+ +
: (
+ this.setState({ + remindObjDialog: { + ...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象"), + warnConfigId: id || this.props.warnConfigId, id: record.id + } + })}>{getLabel(501169, "编辑")} + this.apiflowWarnReceiverDelete(record.id)}>{getLabel(535052, "删除")} +
) + } + ]} pagination={false} + scroll={{ y: `calc(100vh - 190px)` }} + /> + } } diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less index e8cc4773..971e3b4e 100644 --- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less +++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less @@ -9,6 +9,15 @@ justify-content: flex-end; font-size: 12px; } + + .space { + display: flex; + align-items: center; + + .mr10 { + margin-right: 10px; + } + } } .enable-settings {