custom/万君筑天科技-合并业务线

This commit is contained in:
lys 2025-04-24 11:09:46 +08:00
parent 4eb957cb17
commit e7d241cdba
4 changed files with 107 additions and 29 deletions

View File

@ -78,3 +78,11 @@ export const viewAttendQuote = (params) => {
export const getSalaryCycleAndAttendCycle = (params) => { export const getSalaryCycleAndAttendCycle = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", "get", params); return WeaTools.callApi("/api/bs/hrmsalary/attendQuote/getSalaryCycleAndAttendCycle", "get", params);
}; };
// 获取考勤详情信息
export const getAttendQuoteData = (params) => {
return postFetch("/api/bs/hrmsalary/attendQuote/getData", params);
};
// 编辑考勤引用数据
export const editAttendQuoteData = (params) => {
return postFetch("/api/bs/hrmsalary/attendQuote/editData", params);
};

View File

@ -7,37 +7,100 @@
* @description: * @description:
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import { WeaLocaleProvider, WeaSlideModal } from "ecCom"; import { WeaLocaleProvider, WeaSlideModal, WeaTop } from "ecCom";
import { Button } from "antd"; import { editAttendQuoteData, getAttendQuoteData } from "../../../../apis/attendance";
import FormInfo from "../../../../components/FormInfo";
import { WeaForm } from "comsMobx";
import { Button, message } from "antd";
import "./index.less"; import "./index.less";
const { getLabel } = WeaLocaleProvider; const { getLabel } = WeaLocaleProvider;
const form = new WeaForm();
const baseInforFields = ["username", "departmentName", "mobile", "jobNum", "idNo"];
class AttendanceDataEditSlide extends Component { class AttendanceDataEditSlide extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {}; this.state = { conditions: [], loading: false };
} }
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) { if (nextProps.visible !== this.props.visible && nextProps.visible) {
document.querySelector(".attendanceRefWrapper").classList.add("zIndex0-attendance"); this.getAttendQuoteData(nextProps);
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) { } else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
document.querySelector(".attendanceRefWrapper").classList.remove("zIndex0-attendance"); form.resetForm();
} }
} }
getAttendQuoteData = (props) => {
const { record } = props || this.props, { id } = record;
getAttendQuoteData({ id }).then(({ status, data }) => {
if (status) {
const { columns, data: result } = data;
this.setState({
conditions: [{
defaultshow: true,
items: [
..._.map(baseInforFields, o => ({
conditionType: "INPUT",
domkey: [o],
fieldcol: 14,
label: _.find(columns, k => k.column === o).text,
labelcol: 8,
value: result[o] || "",
viewAttr: 1
})),
..._.map(_.filter(columns, o => !baseInforFields.includes(o.column)), k => ({
conditionType: "INPUT",
domkey: [k.column],
fieldcol: 14,
rules: "",
label: k.text,
labelcol: 8,
value: result[k.column] || "",
viewAttr: 2
}))
]
}]
}, () => form.initFormFields(this.state.conditions));
}
});
};
save = () => {
form.validateForm().then(f => {
if (f.isValid) {
const { record } = this.props, { id } = record;
const { username, departmentName, mobile, jobNum, idNo, ...formData } = form.getFormParams();
const payload = { id, attendQuoteData: { ...formData } };
this.setState({ loading: true });
editAttendQuoteData(payload).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success(getLabel(30700, "操作成功"));
this.props.onClose();
this.props.onSuccess();
} else {
message.error(errormsg);
}
}).catch(() => this.setState({ loading: false }));
} else {
f.showErrors();
}
});
};
render() { render() {
const { record } = this.props, { username } = record, { conditions, loading } = this.state;
const btns = [ const btns = [
<Button type="primary" onClick={this.handleExportAttendQuote}>{getLabel(111, "保存")}</Button> <Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "保存")}</Button>
]; ];
return ( return (<WeaSlideModal {...this.props} className="editAttendanceSlide" top={0} height={100} width={1000}
<WeaSlideModal {...this.props} className="attendanceSlideWrapper" top={0} height={100} width={800} measureX="px" measureT="%" measureY="%" direction="right"
measureX="px" measureT="%" measureY="%" direction="right" title={<WeaTop title={username} icon={<i className="icon-coms-fa"/>}
title="郑世珍" iconBgcolor="#F14A2D" buttons={btns}/>}
content={<div></div>} content={<FormInfo className="form-dialog-layout" center={false} itemRender={{}} form={form}
/> formFields={conditions} colCount={2}/>
); }/>);
} }
} }

View File

@ -18,7 +18,7 @@ class AttendanceDataViewSlide extends Component {
super(props); super(props);
this.state = { this.state = {
loading: { query: false }, keyword: "", dataSource: [], columns: [], loading: { query: false }, keyword: "", dataSource: [], columns: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }, visible: false pageInfo: { current: 1, pageSize: 10, total: 0 }, attendanceSlide: { visible: false, record: {} }
}; };
} }
@ -46,8 +46,9 @@ class AttendanceDataViewSlide extends Component {
..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : null })), ..._.map(columns, (o, i) => ({ ...o, width: 150, fixed: i === 0 ? "left" : null })),
{ {
title: getLabel(111, "操作"), dataIndex: "operate", width: 80, title: getLabel(111, "操作"), dataIndex: "operate", width: 80,
render: () => (<a href="JavaScript:void(0);" render: (__, record) => (<a href="JavaScript:void(0);" onClick={() => this.setState({
onClick={() => this.setState({ visible: true })}>{getLabel(111, "编辑")}</a>) attendanceSlide: { visible: true, record }
})}>{getLabel(111, "编辑")}</a>)
} }
] ]
}); });
@ -68,7 +69,7 @@ class AttendanceDataViewSlide extends Component {
render() { render() {
const { showOperateBtn, salaryYearMonth, ...extra } = this.props; const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
const { columns, dataSource, loading, pageInfo, keyword, visible } = this.state; const { columns, dataSource, loading, pageInfo, keyword, attendanceSlide } = this.state;
const pagination = { const pagination = {
...pageInfo, ...pageInfo,
showTotal: (total) => `${total}`, showTotal: (total) => `${total}`,
@ -110,7 +111,11 @@ class AttendanceDataViewSlide extends Component {
<WeaTable <WeaTable
columns={columns} dataSource={dataSource} bordered pagination={pagination} columns={columns} dataSource={dataSource} bordered pagination={pagination}
loading={loading.query} scroll={{ x: 1200, y: `calc(100vh - 240px)` }}/> loading={loading.query} scroll={{ x: 1200, y: `calc(100vh - 240px)` }}/>
<AttendanceDataEditSlide visible={visible} onClose={() => this.setState({ visible: false })}/> <AttendanceDataEditSlide {...attendanceSlide}
onSuccess={() => this.viewAttendQuote({}, this.props)}
onClose={() => this.setState({
attendanceSlide: { ...attendanceSlide, visible: false }
})}/>
</div> </div>
} }
/> />

View File

@ -3,19 +3,21 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.wea-form-item { .wea-new-top-req-content {
height: 46px; & > .wea-form-item {
line-height: 46px; height: 46px;
background: #FFF; line-height: 46px;
margin: 8px 16px 0 16px; background: #FFF;
margin: 8px 16px 0 16px;
.wea-form-item-label { .wea-form-item-label {
line-height: 46px !important; line-height: 46px !important;
padding-left: 8px !important; padding-left: 8px !important;
} }
.to { .to {
padding: 0 10px padding: 0 10px
}
} }
} }