feature/2.10.1.2401.01-页面操作日志添加
This commit is contained in:
parent
9e81e8244a
commit
7cb1b157eb
|
|
@ -23,17 +23,16 @@ export const getTableDatas = (params) => {
|
|||
//获取日志列表
|
||||
export const getLogs = params => {
|
||||
const payload = {
|
||||
...params,
|
||||
module: "hrsa", dataset: "dataset",
|
||||
...params, module: "hrsa", dataset: "dataset", authParams: "{}",
|
||||
filterConditions: "[]", transMethod: "hrsa",
|
||||
authParams: "{}"
|
||||
showColums: "[{\"columName\":\"操作时间\",\"columIndex\":\"createdate\",\"width\":\"5%\"},{\"columName\":\"操作人\",\"columIndex\":\"operatorname\",\"width\":\"2%\"},{\"columName\":\"操作类型\",\"columIndex\":\"operatetypename\",\"width\":\"5%\"},{\"columName\":\"项目\",\"columIndex\":\"modulenamespan\",\"width\":\"3%\"},{\"columName\":\"对象\",\"columIndex\":\"targetname\",\"width\":\"4%\"},{\"columName\":\"修改详情\",\"columIndex\":\"operatedesc\",\"width\":\"2%\"},{\"columName\":\"客户端IP\",\"columIndex\":\"clientip\",\"width\":\"5%\"}]"
|
||||
};
|
||||
return postFetch("/api/bs/hrmsalary/elog/getLogs", payload);
|
||||
};
|
||||
//获取单条操作记录的更新明细
|
||||
export const getDetailChanges = params => {
|
||||
const payload = {
|
||||
...params, module: "hrsa", detailTransMethod: "elogDemoDetail",
|
||||
...params, module: "hrsa", detailTransMethod: "elogDemoDetail"
|
||||
};
|
||||
return postFetch("/api/bs/hrmsalary/elog/getDetailChanges", payload);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* name: 日志查看-详情
|
||||
* Description:
|
||||
* Date: 2024/1/25
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaDialog, WeaLocaleProvider, WeaTransfer } from "ecCom";
|
||||
import * as API from "../../../../apis";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
const WeaTransferList = WeaTransfer.list;
|
||||
|
||||
class Index extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
dataSource: [], loading: false
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getDetailChanges(nextProps);
|
||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({
|
||||
dataSource: [],
|
||||
loading: false
|
||||
});
|
||||
}
|
||||
|
||||
getDetailChanges = (props) => {
|
||||
const { mainid, logFunction } = props;
|
||||
const payload = { function: logFunction, mainid };
|
||||
this.setState({ loading: true });
|
||||
API.getDetailChanges(payload).then(({ status, data }) => {
|
||||
this.setState({ loading: false });
|
||||
if (status) {
|
||||
this.setState({
|
||||
dataSource: _.map(data, (o, i) => ({
|
||||
...o, index: i + 1,
|
||||
valueschanges: _.map(o.valueschanges, (g, gi) => ({ id: gi + 1, name: g }))
|
||||
}))
|
||||
});
|
||||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
};
|
||||
|
||||
render() {
|
||||
const { dataSource } = this.state;
|
||||
const scrollHeight = this.logDetailRef ? this.logDetailRef.state.height - 32 : 606.6;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} hasScroll className="logDialog" initLoadCss ref={dom => this.logDetailRef = dom}
|
||||
style={{
|
||||
width: 750,
|
||||
height: 606.6,
|
||||
minHeight: 200,
|
||||
minWidth: 380,
|
||||
maxHeight: "90%",
|
||||
maxWidth: "90%",
|
||||
overflow: "hidden",
|
||||
transform: "translate(0px, 0px)"
|
||||
}}
|
||||
>
|
||||
<div className="logDialogContent">
|
||||
{
|
||||
_.map(dataSource, item => (<WeaTransferList
|
||||
data={item.valueschanges}
|
||||
renderItem={(it) => (<div className="detailBox">
|
||||
<div className="order">{it.id}</div>
|
||||
<div className="content">{it.name}</div>
|
||||
</div>)}
|
||||
height={scrollHeight} checkedCb={() => ({})} checkedKeys={[]}
|
||||
/>))
|
||||
}
|
||||
</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Index;
|
||||
|
|
@ -8,6 +8,16 @@ const getLabel = WeaLocaleProvider.getLabel;
|
|||
export const logConditions = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
conditionType: "RANGEPICKER",
|
||||
domkey: ["date"],
|
||||
fieldcol: 18,
|
||||
label: "操作时间",
|
||||
lanId: 111,
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
viewAttr: 2
|
||||
},
|
||||
{
|
||||
conditionType: "INPUT",
|
||||
domkey: ["operator"],
|
||||
|
|
@ -44,7 +54,7 @@ export const logConditions = [
|
|||
}
|
||||
];
|
||||
|
||||
export const renderLogSearchsForm = (form, condition, onSearch = () => void (0)) => {
|
||||
export const renderLogSearchsForm = (form, condition, onSearch = () => void (0), onReset = () => void (0)) => {
|
||||
const { isFormInit } = form;
|
||||
const formParams = form.getFormParams();
|
||||
let group = [];
|
||||
|
|
@ -61,8 +71,8 @@ export const renderLogSearchsForm = (form, condition, onSearch = () => void (0))
|
|||
<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>
|
||||
<div style={{ position: "absolute", right: "-148px", top: "0" }}>
|
||||
<Button type="ghost" onClick={onReset} style={{ marginRight: 10 }}>{getLabel(2022, "重置")}</Button>
|
||||
<Button type="primary" onClick={onSearch}>{getLabel(388113, "搜索")}</Button>
|
||||
</div>
|
||||
}
|
||||
|
|
@ -71,7 +81,7 @@ export const renderLogSearchsForm = (form, condition, onSearch = () => void (0))
|
|||
});
|
||||
});
|
||||
group.push(
|
||||
<WeaSearchGroup col={4} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} center={false}
|
||||
<WeaSearchGroup col={3} needTigger={true} title={c.title} showGroup={c.defaultshow} items={items} center={false}
|
||||
/>);
|
||||
});
|
||||
return group;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
import React, { Component } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { WeaDialog, WeaLocaleProvider, WeaTable } from "ecCom";
|
||||
import DetailLogView from "./components/detailLogView";
|
||||
import { logConditions, renderLogSearchsForm } from "./config";
|
||||
import * as API from "../../apis/index";
|
||||
import "./index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
|
@ -19,7 +21,7 @@ class Index extends Component {
|
|||
super(props);
|
||||
this.state = {
|
||||
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 },
|
||||
loading: false, conditions: []
|
||||
loading: false, conditions: [], logDetailDialog: { visible: false, title: "", logFunction: "", mainid: "" }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +35,7 @@ class Index extends Component {
|
|||
}
|
||||
|
||||
componentWillReceiveProps(nextProps, nextContext) {
|
||||
// if (nextProps.visible !== this.props.visible && nextProps.visible) this.getAdjustHistoryList();
|
||||
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getLogs();
|
||||
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
||||
this.setState({
|
||||
dataSource: [], columns: [], pageInfo: { current: 0, pageSize: 10, total: 0 },
|
||||
|
|
@ -42,30 +44,38 @@ class Index extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
// 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 }));
|
||||
// };
|
||||
getLogs = (extra = {}) => {
|
||||
const { pageInfo, logDetailDialog } = this.state;
|
||||
const { baseFormStore: { form }, logFunction } = this.props;
|
||||
const payload = {
|
||||
...pageInfo, ...extra, searchMap: { ...form.getFormParams() },
|
||||
function: logFunction, showColums: ""
|
||||
};
|
||||
this.setState({ loading: true });
|
||||
API.getLogs(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 === "operatedesc") {
|
||||
return {
|
||||
...it, render: (__, record) => (<a href="javascript:void(0);" onClick={() => {
|
||||
const { operatedesc: title, uuid: mainid } = record;
|
||||
this.setState({ logDetailDialog: { visible: true, title, logFunction, mainid } });
|
||||
}}>{getLabel(33564, "查看")}</a>)
|
||||
};
|
||||
}
|
||||
return { ...it };
|
||||
})
|
||||
});
|
||||
}
|
||||
}).catch(() => this.setState({ loading: false }));
|
||||
};
|
||||
|
||||
render() {
|
||||
const { loading, dataSource, columns, pageInfo, conditions } = this.state;
|
||||
const { loading, dataSource, columns, pageInfo, conditions, logDetailDialog } = this.state;
|
||||
const { baseFormStore: { form } } = this.props;
|
||||
const pagination = {
|
||||
...pageInfo,
|
||||
|
|
@ -76,15 +86,15 @@ class Index extends Component {
|
|||
onShowSizeChange: (current, pageSize) => {
|
||||
this.setState({
|
||||
pageInfo: { ...pageInfo, current, pageSize }
|
||||
}, () => this.getAdjustHistoryList());
|
||||
}, () => this.getLogs());
|
||||
},
|
||||
onChange: current => {
|
||||
this.setState({
|
||||
pageInfo: { ...pageInfo, current }
|
||||
}, () => this.getAdjustHistoryList());
|
||||
}, () => this.getLogs());
|
||||
}
|
||||
};
|
||||
const scrollHeight = this.logRef ? this.logRef.state.height - 210 : 606.6;
|
||||
const scrollHeight = this.logRef ? this.logRef.state.height - 254 : 606.6;
|
||||
return (
|
||||
<WeaDialog
|
||||
{...this.props} title={getLabel(111, "操作日志")}
|
||||
|
|
@ -101,12 +111,16 @@ class Index extends Component {
|
|||
}}
|
||||
>
|
||||
<div className="logDialogContent">
|
||||
{renderLogSearchsForm(form, conditions, () => this.getAdjustHistoryList({ current: 1 }))}
|
||||
{renderLogSearchsForm(form, conditions, () => this.getLogs({ current: 1 }), () => {
|
||||
form.resetForm();
|
||||
this.getLogs({ current: 1 });
|
||||
})}
|
||||
<WeaTable
|
||||
columns={columns} dataSource={dataSource}
|
||||
loading={loading} className="logTable"
|
||||
columns={columns} dataSource={dataSource} loading={loading} className="logTable"
|
||||
pagination={pagination} scroll={{ y: `${scrollHeight}px` }}
|
||||
/>
|
||||
<DetailLogView {...logDetailDialog}
|
||||
onCancel={() => this.setState({ logDetailDialog: { ...logDetailDialog, visible: false } })}/>
|
||||
</div>
|
||||
</WeaDialog>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -26,5 +26,46 @@
|
|||
.logTable {
|
||||
background: #FFFFFF;
|
||||
}
|
||||
|
||||
.wea-transfer-list-wrapper {
|
||||
border: none;
|
||||
|
||||
.ant-tree-switcher {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.transfer-tree {
|
||||
background: #FFF;
|
||||
border: 1px solid #dadada;
|
||||
|
||||
.treeitem {
|
||||
margin: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.detailBox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.order {
|
||||
width: 35px;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-height: 40px;
|
||||
color: #000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,7 +403,8 @@ export default class SalaryItem extends React.Component {
|
|||
})}
|
||||
/>
|
||||
{/*操作日志*/}
|
||||
<LogDialog visible={logDialogVisible} onCancel={() => this.setState({ logDialogVisible: false })}/>
|
||||
<LogDialog visible={logDialogVisible} logFunction="salaryitem"
|
||||
onCancel={() => this.setState({ logDialogVisible: false })}/>
|
||||
{
|
||||
systemItemVisible &&
|
||||
<SystemSalaryItemModal
|
||||
|
|
|
|||
Loading…
Reference in New Issue