From 7cb1b157ebc0c7ba43c2909585be97670e55a097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 25 Jan 2024 11:52:10 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.10.1.2401.01-=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/index.js | 7 +- .../components/detailLogView/index.js | 81 +++++++++++++++++++ .../components/logViewModal/config.js | 18 ++++- .../components/logViewModal/index.js | 74 ++++++++++------- .../components/logViewModal/index.less | 41 ++++++++++ pc4mobx/hrmSalary/pages/salaryItem/index.js | 3 +- 6 files changed, 185 insertions(+), 39 deletions(-) create mode 100644 pc4mobx/hrmSalary/components/logViewModal/components/detailLogView/index.js diff --git a/pc4mobx/hrmSalary/apis/index.js b/pc4mobx/hrmSalary/apis/index.js index 6be981c4..af60888f 100644 --- a/pc4mobx/hrmSalary/apis/index.js +++ b/pc4mobx/hrmSalary/apis/index.js @@ -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); }; diff --git a/pc4mobx/hrmSalary/components/logViewModal/components/detailLogView/index.js b/pc4mobx/hrmSalary/components/logViewModal/components/detailLogView/index.js new file mode 100644 index 00000000..a5c1a5cc --- /dev/null +++ b/pc4mobx/hrmSalary/components/logViewModal/components/detailLogView/index.js @@ -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 ( + this.logDetailRef = dom} + style={{ + width: 750, + height: 606.6, + minHeight: 200, + minWidth: 380, + maxHeight: "90%", + maxWidth: "90%", + overflow: "hidden", + transform: "translate(0px, 0px)" + }} + > +
+ { + _.map(dataSource, item => ( (
+
{it.id}
+
{it.name}
+
)} + height={scrollHeight} checkedCb={() => ({})} checkedKeys={[]} + />)) + } +
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/components/logViewModal/config.js b/pc4mobx/hrmSalary/components/logViewModal/config.js index 872a90c0..f3b3189a 100644 --- a/pc4mobx/hrmSalary/components/logViewModal/config.js +++ b/pc4mobx/hrmSalary/components/logViewModal/config.js @@ -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)) { getKey(fields) === "operatetypename" && -
- +
+
} @@ -71,7 +81,7 @@ export const renderLogSearchsForm = (form, condition, onSearch = () => void (0)) }); }); group.push( - ); }); return group; diff --git a/pc4mobx/hrmSalary/components/logViewModal/index.js b/pc4mobx/hrmSalary/components/logViewModal/index.js index aeab775a..857ed362 100644 --- a/pc4mobx/hrmSalary/components/logViewModal/index.js +++ b/pc4mobx/hrmSalary/components/logViewModal/index.js @@ -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) => ({moment(text).format("YYYY-MM-DD")}) }; - // } - // 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) => ( { + const { operatedesc: title, uuid: mainid } = record; + this.setState({ logDetailDialog: { visible: true, title, logFunction, mainid } }); + }}>{getLabel(33564, "查看")}) + }; + } + 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 (
- {renderLogSearchsForm(form, conditions, () => this.getAdjustHistoryList({ current: 1 }))} + {renderLogSearchsForm(form, conditions, () => this.getLogs({ current: 1 }), () => { + form.resetForm(); + this.getLogs({ current: 1 }); + })} + this.setState({ logDetailDialog: { ...logDetailDialog, visible: false } })}/>
); diff --git a/pc4mobx/hrmSalary/components/logViewModal/index.less b/pc4mobx/hrmSalary/components/logViewModal/index.less index 6c10dc6f..0d9e4d57 100644 --- a/pc4mobx/hrmSalary/components/logViewModal/index.less +++ b/pc4mobx/hrmSalary/components/logViewModal/index.less @@ -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; + } + } } } diff --git a/pc4mobx/hrmSalary/pages/salaryItem/index.js b/pc4mobx/hrmSalary/pages/salaryItem/index.js index 67a0f05e..d808d539 100644 --- a/pc4mobx/hrmSalary/pages/salaryItem/index.js +++ b/pc4mobx/hrmSalary/pages/salaryItem/index.js @@ -403,7 +403,8 @@ export default class SalaryItem extends React.Component { })} /> {/*操作日志*/} - this.setState({ logDialogVisible: false })}/> + this.setState({ logDialogVisible: false })}/> { systemItemVisible &&