feature/2.10.1.2401.01-页面操作日志添加

This commit is contained in:
黎永顺 2024-01-25 09:16:57 +08:00
parent a4da6674c5
commit 9e81e8244a
6 changed files with 269 additions and 106 deletions

View File

@ -1,4 +1,5 @@
import { WeaTools } from "ecCom";
import { postFetch } from "../util/request";
// form基础数据
export const getBaseForm = (params) => {
@ -19,3 +20,20 @@ export const getCondition = (params) => {
export const getTableDatas = (params) => {
return WeaTools.callApi("/api/demo03/weatableDemo", "GET", params);
};
//获取日志列表
export const getLogs = params => {
const payload = {
...params,
module: "hrsa", dataset: "dataset",
filterConditions: "[]", transMethod: "hrsa",
authParams: "{}"
};
return postFetch("/api/bs/hrmsalary/elog/getLogs", payload);
};
//获取单条操作记录的更新明细
export const getDetailChanges = params => {
const payload = {
...params, module: "hrsa", detailTransMethod: "elogDemoDetail",
};
return postFetch("/api/bs/hrmsalary/elog/getDetailChanges", payload);
};

View File

@ -0,0 +1,78 @@
import React from "react";
import { WeaFormItem, WeaLocaleProvider, WeaSearchGroup, WeaTools } from "ecCom";
import { WeaSwitch } from "comsMobx";
import { Button } from "antd";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
export const logConditions = [
{
items: [
{
conditionType: "INPUT",
domkey: ["operator"],
fieldcol: 18,
label: "操作人",
lanId: 17482,
labelcol: 6,
value: "",
viewAttr: 2
},
{
conditionType: "INPUT",
domkey: ["targetname"],
fieldcol: 18,
label: "对象",
lanId: 106,
labelcol: 6,
value: "",
viewAttr: 2
},
{
conditionType: "INPUT",
domkey: ["operatetypename"],
fieldcol: 18,
label: "操作类型",
lanId: 111,
labelcol: 6,
value: "",
viewAttr: 2
}
],
defaultshow: true,
title: ""
}
];
export const renderLogSearchsForm = (form, condition, onSearch = () => void (0)) => {
const { isFormInit } = form;
const formParams = form.getFormParams();
let group = [];
isFormInit && condition && condition.map(c => {
let items = [];
c.items.map(fields => {
items.push({
com: (
<WeaFormItem
label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
tipPosition="bottom"
>
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams}/>
{
getKey(fields) === "operatetypename" &&
<div style={{ position: "absolute", right: "-70px", top: "0" }}>
<Button type="ghost" onClick={onSearch}>{getLabel(2022, "重置")}</Button>
<Button type="primary" onClick={onSearch}>{getLabel(388113, "搜索")}</Button>
</div>
}
</WeaFormItem>),
colSpan: 1
});
});
group.push(
<WeaSearchGroup col={4} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} center={false}
/>);
});
return group;
};

View File

@ -1,99 +1,116 @@
import React from 'react'
import { Button, Modal } from 'antd';
import { WeaInput, WeaRangePicker, WeaTable} from 'ecCom'
import { logColumns, dataSource } from "../../common/columns"
/*
* Author: 黎永顺
* name: 薪酬日志查看
* Description:
* Date: 2024/1/24
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaLocaleProvider, WeaTable } from "ecCom";
import { logConditions, renderLogSearchsForm } from "./config";
import "./index.less";
export default class LogViewModal extends React.Component {
constructor(props) {
super(props)
this.state ={
value: ""
}
const getLabel = WeaLocaleProvider.getLabel;
@inject("baseFormStore")
@observer
class Index extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
loading: false, conditions: []
};
}
componentDidMount() {
const { baseFormStore: { form } } = this.props;
this.setState({
conditions: _.map(logConditions, it => ({
...it, items: _.map(it.items, o => ({ ...o, label: getLabel(o.lanId, o.label) }))
}))
}, () => form.initFormFields(this.state.conditions));
}
componentWillReceiveProps(nextProps, nextContext) {
// if (nextProps.visible !== this.props.visible && nextProps.visible) this.getAdjustHistoryList();
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
this.setState({
dataSource: [], columns: [], pageInfo: { current: 0, pageSize: 10, total: 0 },
loading: false
});
}
render() {
return (
<Modal title="操作日志" visible={this.props.visible}
onOk={() => alert("ok")} onCancel={this.props.onCancel}
className="logViewModal"
style={{ top: 150 }}
width={'80%'} height={'50%'}
>
<div className="searchBar">
<div className="searchBarItem searchDateRange">
<div className="searchBarLabel">操作时间</div>
<div>
<WeaRangePicker
value={["2019-02-03", "2019-03-08"]}
onChange={v => this.setState({ value: v })}
/>
</div>
</div>
<div className="searchBarItem">
<div className="searchBarLabel">操作人</div>
<div>
<WeaInput
id="test"
style={{ width: 200 }}
value={this.state.value}
onChange={value => {
console.log(value);
this.setState({ value });
}}
customBlur={v => {
console.log("custom blur", v);
}}
onFocus={v => console.log("focus", v)}
onBlur={v => console.log("blur", v)}
/>
</div>
</div>
}
<div className="searchBarItem">
<div className='searchBarLabel'>对象</div>
<div>
<WeaInput
id="test"
style={{ width: 200 }}
value={this.state.value}
onChange={value => {
console.log(value);
this.setState({ value });
}}
customBlur={v => {
console.log("custom blur", v);
}}
onFocus={v => console.log("focus", v)}
onBlur={v => console.log("blur", v)}
/>
</div>
</div>
// getAdjustHistoryList = (extra = {}) => {
// const { pageInfo } = this.state;
// const { archivesStore: { logForm } } = this.props;
// const payload = { ...pageInfo, ...logForm.getFormParams(), ...extra };
// this.setState({ loading: true });
// getAdjustHistoryList(payload).then(({ status, data }) => {
// this.setState({ loading: false });
// if (status) {
// const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
// this.setState({
// pageInfo: { ...pageInfo, current, pageSize, total },
// dataSource, columns: _.map(columns, it => {
// if (it.dataIndex === "operateTime") {
// return { ...it, render: (text) => (<span>{moment(text).format("YYYY-MM-DD")}</span>) };
// }
// return { ...it };
// })
// });
// }
// }).catch(() => this.setState({ loading: false }));
// };
<div className="searchBarItem">
<div className='searchBarLabel'>操作类型</div>
<div>
<WeaInput
id="test"
style={{ width: 200 }}
value={this.state.value}
onChange={value => {
console.log(value);
this.setState({ value });
}}
customBlur={v => {
console.log("custom blur", v);
}}
onFocus={v => console.log("focus", v)}
onBlur={v => console.log("blur", v)}
/>
</div>
</div>
<div className="searchBarItem">
<Button type="primary" className="searchBtn">搜索</Button>
</div>
</div>
<WeaTable columns={logColumns} dataSource={dataSource} />
</Modal>
)
}
}
render() {
const { loading, dataSource, columns, pageInfo, conditions } = this.state;
const { baseFormStore: { form } } = this.props;
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 }
}, () => this.getAdjustHistoryList());
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getAdjustHistoryList());
}
};
const scrollHeight = this.logRef ? this.logRef.state.height - 210 : 606.6;
return (
<WeaDialog
{...this.props} title={getLabel(111, "操作日志")}
ref={dom => this.logRef = dom} className="logDialog" initLoadCss
style={{
width: 1150,
height: 606.6,
minHeight: 200,
minWidth: 380,
maxHeight: "90%",
maxWidth: "90%",
overflow: "hidden",
transform: "translate(0px, 0px)"
}}
>
<div className="logDialogContent">
{renderLogSearchsForm(form, conditions, () => this.getAdjustHistoryList({ current: 1 }))}
<WeaTable
columns={columns} dataSource={dataSource}
loading={loading} className="logTable"
pagination={pagination} scroll={{ y: `${scrollHeight}px` }}
/>
</div>
</WeaDialog>
);
}
}
export default Index;

View File

@ -0,0 +1,30 @@
.logDialog {
.wea-dialog-body {
overflow-y: hidden;
}
.logDialogContent {
background: #F6F6F6;
padding: 16px;
width: 100%;
height: 100%;
.wea-search-group {
padding: 0;
margin-bottom: 10px;
background: #FFF;
.wea-form-cell {
padding: 0;
.wea-form-item {
padding: 10px;
}
}
}
.logTable {
background: #FFFFFF;
}
}
}

View File

@ -11,6 +11,7 @@ import CustomSalaryItemSlide from "./customSalaryItemSlide";
import CustomPaginationTable from "../../components/customPaginationTable";
import SyncToSalaryAccountSetDialog from "./syncToSalaryAccountSetDialog";
import "../socialSecurityBenefits/programme/index.less";
import LogDialog from "../../components/logViewModal";
const { getLabel } = WeaLocaleProvider;
@inject("salaryItemStore", "taxAgentStore", "salaryFileStore")
@ -27,7 +28,8 @@ export default class SalaryItem extends React.Component {
formalModalVisible: false,
searchParams: { current: 1, pageSize: 10, total: 0 },
selectedRowKeys: [],
syncSalarySetDialog: { visible: false, title: "", id: "" }
syncSalarySetDialog: { visible: false, title: "", id: "" },
logDialogVisible: false
};
columns.map(item => {
if (item.dataIndex == "refere") {
@ -191,6 +193,16 @@ export default class SalaryItem extends React.Component {
getTableDatas({ ...searchParams });
}
onDropMenuClick = (key) => {
switch (key) {
case "log":
this.setState({ logDialogVisible: true });
break;
default:
break;
}
};
render() {
const {
salaryItemStore,
@ -198,7 +210,7 @@ export default class SalaryItem extends React.Component {
taxAgentStore: { showOperateBtn, showSalaryItemBtn, taxAgentOption }
} = this.props;
const { userStatusList } = salaryFileStore;
const { selectedRowKeys } = this.state;
const { selectedRowKeys, logDialogVisible } = this.state;
const { loading, deleteItemRequest, getTableDatas } = salaryItemStore;
const {
tableDataSource,
@ -342,11 +354,14 @@ export default class SalaryItem extends React.Component {
};
return (
<div className="mySalaryBenefitsWrapper">
<WeaTop
title="薪资项目管理"
icon={<i className="icon-coms-fa"/>}
iconBgcolor="#F14A2D"
showDropIcon={false}
<WeaTop title="薪资项目管理" icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
showDropIcon onDropMenuClick={this.onDropMenuClick}
dropMenuDatas={[
{
key: "log", icon: <i className="iconfont icon-caozuorizhi32"/>,
content: getLabel(545781, "操作日志")
}
]}
>
<CustomTab searchOperationItem={renderRightOperation()}/>
<div className="tableWrapper">
@ -387,7 +402,8 @@ export default class SalaryItem extends React.Component {
}
})}
/>
{/*操作日志*/}
<LogDialog visible={logDialogVisible} onCancel={() => this.setState({ logDialogVisible: false })}/>
{
systemItemVisible &&
<SystemSalaryItemModal

View File

@ -9,7 +9,11 @@ const {LogStore} = WeaLogView;
const getLabel = WeaLocaleProvider.getLabel;
export class BaseFormStore {
@observable form = new WeaForm(); // nrew 一个form
@observable form = new WeaForm(); // 日志form
@observable logStore = new LogStore();
@observable condition = []; // 存储后台得到的form数据
@observable saveLoading = false; // 保存状态处理:保证保存的时候接口只走一次
@ -59,5 +63,5 @@ export class BaseFormStore {
@action
setLogVisible = bool => this.logVisible = bool
}
}