feature/2.15.2.2409.01合并业务线测试

This commit is contained in:
lys 2024-11-04 16:33:32 +08:00
parent 2699266c4c
commit 2e94324bb7
3 changed files with 47 additions and 16 deletions

View File

@ -30,7 +30,9 @@ class PersonalScope extends Component {
this.state = { this.state = {
searchValue: "", selectedKey: "listInclude", rowKeys: [], loading: false, searchValue: "", selectedKey: "listInclude", rowKeys: [], loading: false,
extEmpsWitch: "1", //非系统人员开关, 1 开启, 0关闭 extEmpsWitch: "1", //非系统人员开关, 1 开启, 0关闭
personalAddModal: { visible: false, externalVisible: false, title: getLabel(111, "关联人员"), includeType: "" }, personalAddModal: {
visible: false, externalVisible: false, title: getLabel(111, "关联人员"), includeType: "", record: {}
},
importParams: { importParams: {
visible: false, title: getLabel(111, "数据导入"), nextloading: false, importResult: {}, imageId: "", visible: false, title: getLabel(111, "数据导入"), nextloading: false, importResult: {}, imageId: "",
link: `/api/bs/hrmsalary/taxAgent/range/downloadTemplate?taxAgentId=${props.taxAgentId}`, link: `/api/bs/hrmsalary/taxAgent/range/downloadTemplate?taxAgentId=${props.taxAgentId}`,
@ -89,11 +91,11 @@ class PersonalScope extends Component {
* Params: * Params:
* Date: 2022/11/30 * Date: 2022/11/30
*/ */
handleAddPersonal = () => { handleAddPersonal = (record = {}) => {
const { personalAddModal, selectedKey } = this.state; const { personalAddModal, selectedKey } = this.state;
this.setState({ this.setState({
personalAddModal: { personalAddModal: {
...personalAddModal, ...personalAddModal, record,
visible: selectedKey !== "listExt", visible: selectedKey !== "listExt",
externalVisible: selectedKey === "listExt", externalVisible: selectedKey === "listExt",
includeType: selectedKey === "listInclude" ? 1 : 0 includeType: selectedKey === "listInclude" ? 1 : 0
@ -166,7 +168,7 @@ class PersonalScope extends Component {
disabled={_.isEmpty(rowKeys)} disabled={_.isEmpty(rowKeys)}
onClick={this.taxAgentRangeDelete} onClick={this.taxAgentRangeDelete}
/>, />,
<WeaButtonIcon buttonType="add" type="primary" onClick={this.handleAddPersonal}/>, <WeaButtonIcon buttonType="add" type="primary" onClick={() => this.handleAddPersonal()}/>,
<WeaInputSearch <WeaInputSearch
style={{ width: 220 }} style={{ width: 220 }}
value={searchValue} value={searchValue}
@ -197,6 +199,7 @@ class PersonalScope extends Component {
tabActive={selectedKey} tabActive={selectedKey}
searchValue={searchValue} searchValue={searchValue}
onChangeSelectKey={rowKeys => this.setState({ rowKeys })} onChangeSelectKey={rowKeys => this.setState({ rowKeys })}
onEditScope={this.handleAddPersonal}
/> />
{/*非系统人员添加*/} {/*非系统人员添加*/}
<ExternalPersonModal <ExternalPersonModal
@ -210,7 +213,7 @@ class PersonalScope extends Component {
onSuccess={() => this.personalScopeTableRef.getPersonalScopeList()} onSuccess={() => this.personalScopeTableRef.getPersonalScopeList()}
onCancel={(callback) => onCancel={(callback) =>
this.setState({ this.setState({
personalAddModal: { ...personalAddModal, visible: false, includeType: "" } personalAddModal: { ...personalAddModal, visible: false, includeType: "", record: {} }
}, () => callback && callback()) }, () => callback && callback())
} }
/> />

View File

@ -9,7 +9,7 @@ import { inject, observer } from "mobx-react";
import { WeaSwitch } from "comsMobx"; import { WeaSwitch } from "comsMobx";
import { WeaCheckbox, WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom"; import { WeaCheckbox, WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { Button, message } from "antd"; import { Button, message } from "antd";
import { getTaxAgentRangeForm, taxAgentRangeSave } from "../../../apis/taxAgent"; import { getTaxAgentRangeForm, taxAgentRangeEdit, taxAgentRangeSave } from "../../../apis/taxAgent";
import { personScopeConditions, scopeSelectLinkageDatas } from "./constants"; import { personScopeConditions, scopeSelectLinkageDatas } from "./constants";
const getKey = WeaTools.getKey; const getKey = WeaTools.getKey;
@ -26,11 +26,12 @@ class PersonalScopeModal extends Component {
} }
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTaxAgentRangeForm(); if (nextProps.visible !== this.props.visible && nextProps.visible) this.getTaxAgentRangeForm(nextProps);
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.taxAgentStore.initPersonScopeForm(); if (nextProps.visible !== this.props.visible && !nextProps.visible) this.props.taxAgentStore.initPersonScopeForm();
} }
getTaxAgentRangeForm = () => { getTaxAgentRangeForm = (props) => {
const { record } = props;
getTaxAgentRangeForm().then(({ status, data }) => { getTaxAgentRangeForm().then(({ status, data }) => {
if (status) { if (status) {
const { employeeStatus, targetTypeList } = data; const { employeeStatus, targetTypeList } = data;
@ -39,16 +40,39 @@ class PersonalScopeModal extends Component {
...item, items: _.map(item.items, o => { ...item, items: _.map(item.items, o => {
if (getKey(o) === "employeeStatus") { if (getKey(o) === "employeeStatus") {
return { return {
...o, label: getLabel(o.lanId, o.label), ...o, label: getLabel(o.lanId, o.label), value: !_.isEmpty(record) ? record.status : "",
options: _.map(employeeStatus, it => ({ key: it.id, showname: it.name })) options: _.map(employeeStatus, it => ({ key: it.id, showname: it.name }))
}; };
} }
return { return {
...o, label: getLabel(o.lanId, o.label), ...o, label: getLabel(o.lanId, o.label), viewAttr: !_.isEmpty(record) ? 1 : 3,
options: _.map(targetTypeList, it => ({ options: _.map(targetTypeList, it => ({
key: it.id, showname: it.name, selected: it.id === "EMPLOYEE" key: it.id, showname: it.name,
selected: !_.isEmpty(record) ? it.id === record.targetType : it.id === "EMPLOYEE"
})), })),
selectLinkageDatas: { ...scopeSelectLinkageDatas } selectLinkageDatas: {
..._.reduce(_.keys(scopeSelectLinkageDatas), (pre, cur) => {
if (cur !== "SQL") {
return {
...pre,
[cur]: {
...scopeSelectLinkageDatas[cur],
browserConditionParam: {
...scopeSelectLinkageDatas[cur].browserConditionParam,
isSingle: true,
replaceDatas: !_.isEmpty(record) ? [{
id: String(record.targetId),
name: record.targetName
}] : []
}
}
};
}
return {
...pre, [cur]: { ...scopeSelectLinkageDatas[cur], value: !_.isEmpty(record) ? record.target : "" }
};
}, {})
}
}; };
}) })
})) }))
@ -57,20 +81,21 @@ class PersonalScopeModal extends Component {
}); });
}; };
taxAgentRangeSave = () => { taxAgentRangeSave = () => {
const { taxAgentStore: { personScopeForm } } = this.props; const { taxAgentStore: { personScopeForm }, record = {} } = this.props;
personScopeForm.validateForm().then(f => { personScopeForm.validateForm().then(f => {
if (f.isValid) { if (f.isValid) {
const { employeeStatus, targetType, target } = personScopeForm.getFormParams(); const { employeeStatus, targetType, target } = personScopeForm.getFormParams();
const { includeType, taxAgentId } = this.props; const { includeType, taxAgentId } = this.props;
const payload = { const payload = {
includeType, taxAgentId, employeeStatus: employeeStatus.split(","), includeType, taxAgentId, employeeStatus: employeeStatus.split(","), id: record.id,
targetParams: _.map(target.split(","), it => ({ targetParams: _.map(target.split(","), it => ({
targetType, targetId: targetType === "SQL" ? "0" : it, targetType, targetId: targetType === "SQL" ? "0" : it,
target: targetType === "SQL" ? target : "" target: targetType === "SQL" ? target : ""
})) }))
}; };
this.setState({ loading: true }); this.setState({ loading: true });
taxAgentRangeSave(payload).then(({ status, errormsg }) => { const API = !_.isEmpty(record) ? taxAgentRangeEdit : taxAgentRangeSave;
API(payload).then(({ status, errormsg }) => {
this.setState({ loading: false }); this.setState({ loading: false });
if (status) { if (status) {
message.success(getLabel(111, "操作成功!")); message.success(getLabel(111, "操作成功!"));

View File

@ -64,7 +64,10 @@ class PersonalScopeTable extends Component {
columns: _.map(columns, item => { columns: _.map(columns, item => {
return { return {
...item, ...item,
render: (text) => { render: (text, record) => {
if (item.dataIndex === "targetName") {
return <a href="javascript:void(0);" onClick={() => this.props.onEditScope(record)}>{text}</a>;
}
return <span className="tdEllipsis" title={text}>{text}</span>; return <span className="tdEllipsis" title={text}>{text}</span>;
} }
}; };