Merge branch 'feature/v2-数据采集-考勤引用页面重构' into develop

This commit is contained in:
黎永顺 2023-03-10 11:43:44 +08:00
commit c46582560e
28 changed files with 1869 additions and 2275 deletions

View File

@ -273,14 +273,14 @@ export const importAttendQuoteData = (params) => {
};
// 查看考勤详情
export const viewAttendQuote = (ids) => {
export const viewAttendQuote = (params) => {
return fetch("/api/bs/hrmsalary/attendQuote/view", {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(ids),
body: JSON.stringify(params),
}).then((res) => res.json());
};

View File

@ -62,7 +62,15 @@ export const getCustomCategoryForm = params => {
return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryForm', 'get', params);
};
export const getCustomCategoryList = params => {
return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryList', 'get', params);
// return WeaTools.callApi('/api/bs/hrmsalary/sicategory/customCategoryList', 'get', params);
return fetch('/api/bs/hrmsalary/sicategory/customCategoryList', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json())
};
export const createSICategory = params => {
return fetch('/api/bs/hrmsalary/sicategory/createSICategory', {

View File

@ -1,20 +1,20 @@
import React from "react"
import { Button } from "antd"
import { WeaCheckbox, WeaHelpfulTip } from "ecCom";
import React from "react";
import { Button } from "antd";
export default class HeaderSet extends React.Component {
render() {
return (
<div style={{display: "inline-block"}}>
<Button type="default" style={{marginLeft: "10px", marginRight: "10px"}} onClick={this.props.onSetClick}>表头设置</Button>
<WeaCheckbox style={{marginRight: "10px"}}/>
<WeaHelpfulTip
className="headSetTips"
width={200}
title="提示:勾选此项,则导出模板的考勤模块字段自动填充考勤模块的数据,导入时默认为覆盖导入"
placement="topLeft"
/>
</div>
)
}
}
render() {
return (
<div style={{ display: "inline-block" }}>
<Button type="default" style={{ marginLeft: "10px", marginRight: "10px" }} onClick={this.props.onSetClick}
loading={this.props.loading}>表头设置</Button>
{/*<WeaCheckbox style={{marginRight: "10px"}}/>*/}
{/*<WeaHelpfulTip*/}
{/* className="headSetTips"*/}
{/* width={200}*/}
{/* title="提示:勾选此项,则导出模板的考勤模块字段自动填充考勤模块的数据,导入时默认为覆盖导入"*/}
{/* placement="topLeft"*/}
{/*/>*/}
</div>
);
}
}

View File

@ -107,7 +107,8 @@ export default class ImportModal extends React.Component {
localStorage.removeItem("fileList");
this.props.onCancel();
}}
style={{ width: 850 }}
style={{ width: 850, height: 600 }}
hasScroll
className="importModalWrapper"
initLoadCss
buttons={

View File

@ -1,7 +1,5 @@
.importModalWrapper {
.wea-dialog-body {
height: 80vh;
overflow: hidden auto;
.ant-modal-body {
padding: 16px;
}

View File

@ -5,24 +5,11 @@
* LastEditTime: 2022-06-29 10:06:13
*/
import React from "react";
import { WeaCheckbox, WeaInputSearch, WeaDialog } from "ecCom";
import { Button, Dropdown, Menu, Modal } from "antd";
import "../../pages/dataAcquisition/attendance/index.less"
import { WeaCheckbox, WeaDialog, WeaInputSearch } from "ecCom";
import { Button } from "antd";
import "./index.less";
export const items = [
{
key: "1",
title: "测试",
checked: false
},
{
key: "2",
title: "测试2",
checked: true
}
];
export default class SelectItemModal extends React.Component {
constructor(props) {
super(props);
@ -31,62 +18,52 @@ export default class SelectItemModal extends React.Component {
};
}
handleShowChecked(value) {
value = value == 1 ? true : false;
this.props.onShowChecked(value);
}
handleMenuClick(e) {
if (e.key == "1") { //恢复默认设置
this.props.onRestoreDefault();
} else if (e.key == "2") {
this.props.onSetDefault();
} else if (e.key == "3") {
}
componentWillReceiveProps(nextProps, nextContext) {
if (
nextProps.visible !== this.props.visible &&
!nextProps.visible
) this.setState({ searchValue: "" });
}
render() {
const menu = (
<Menu onClick={(e) => this.handleMenuClick(e)}>
<Menu.Item key="1">恢复默认设置</Menu.Item>
<Menu.Item key="2">设置默认设置</Menu.Item>
{/* <Menu.Item key="3">操作日志</Menu.Item> */}
</Menu>
);
const { searchValue } = this.state;
const {
title, onSearchItemSet, onShowOnlyChecked, children,
onMoreOpts, onSave, ...extra
} = this.props;
const btns = [<Button type="primary" onClick={onSave}>保存</Button>];
const moreBtn = {
datas: [
{
key: "recovery",
content: "恢复默认设置",
icon: <i className="icon-coms-Flow-setting"/>,
onClick: key => onMoreOpts(key)
},
{
key: "setting",
content: "设为默认设置",
icon: <i className="icon-coms-Flow-setting"/>,
onClick: key => onMoreOpts(key)
}
]
};
const titleComp = <div className="setHeaderWrapper">
<span>{title}</span>
<WeaInputSearch value={searchValue} onChange={searchValue => this.setState({ searchValue })}
placeholder="请输入关键字" style={{ width: 200 }}
onSearch={onSearchItemSet}
/>
</div>;
const bottomLeft = <WeaCheckbox content="只显示已选中字段" onChange={onShowOnlyChecked}/>;
return (
<WeaDialog
visible={this.props.visible}
style={{width:800}}
onCancel={this.props.onCancel}
initLoadCss
className="fieldSetWrapper"
title="导入字段设置"
buttons={[
<Button type="primary" style={{ marginRight: "10px" }} onClick={() => {
this.props.onSave();
}}>保存</Button>,
<Dropdown.Button overlay={menu}>更多</Dropdown.Button>
]}
<WeaDialog {...extra} hasScroll title={titleComp}
style={{ width: 592, height: 248 }}
buttons={btns} moreBtn={moreBtn}
initLoadCss className="setWrapper"
bottomLeft={bottomLeft}
>
<div className="searchWrapper">
<WeaInputSearch
placeholder={"请输入关键字"}
value={this.state.searchValue}
onChange={(value) => {
this.setState({ searchValue: value });
}}
onSearch={(value) => {
this.props.onSearch(value);
}}
/>
</div>
{this.props.children}
<div className="allInWrapper">
<WeaCheckbox content="只显示已选中字段" onChange={(value) => {
this.handleShowChecked(value);
}}/>
</div>
{children}
</WeaDialog>
);
}

View File

@ -0,0 +1,67 @@
.setWrapper {
.setHeaderWrapper, .setGroupWrapper {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
}
.wea-title .ant-checkbox-wrapper > span:last-child, .setGroupWrapper > .checkedtitle {
color: #111;
font-weight: 600;
font-size: 12px;
padding-right: 8px;
}
.itemContUl {
display: flex;
align-items: center;
flex-wrap: wrap;
li {
width: 124px;
overflow: hidden;
padding: 4px 0;
.wea-checkbox {
width: 100%;
}
.ant-checkbox-wrapper {
display: flex;
align-items: center;
width: 100%;
span:last-child {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
.itemsWrapper {
height: 160px;
overflow: scroll;
border: 1px solid #e5e5e5;
border-radius: 4px;
padding: 16px;
width: 100%;
.empty {
line-height: 160px;
text-align: center;
font-size: 14px;
display: inline-block;
width: 100%;
}
}
.wea-more-button {
ul > li:last-child {
display: none !important;
}
}
}

View File

@ -1,78 +1,121 @@
import React from "react";
import { WeaCheckbox } from "ecCom";
import { Col, Icon, Row } from "antd";
/*
* Author: 黎永顺
* name: 设置项目
* Description:
* Date: 2023/3/6
*/
import React, { Component } from "react";
import { WeaCheckbox, WeaSearchGroup } from "ecCom";
export default class SelectItemsWrapper extends React.Component {
class SelectItemsWrapper extends Component {
constructor(props) {
super(props);
this.state = {
showContent: true,
checkStatus: false
searchVal: "",
selectItem: [],
groupItem: [],
showOnlyChecked: false
};
}
handleAllChecked(value) {
value = value == 1 ? true : false;
let items = [...this.props.items];
items.map(item => {
item.checked = value;
});
componentDidMount() {
const { dataSource } = this.props
this.setState({
checkStatus: value
selectItem: _.map(_.filter(_.reduce(dataSource, (pre, cur) => {
return [...pre, ...cur.items];
}, []), item => !!item.checked), it => it.id)
});
this.props.onChange(items);
}
handleItemChange(value, record) {
value = value == 1 ? true : false;
let items = [...this.props.items];
items.map(item => {
if (item.id == record.id) {
item.checked = value;
handleSearchItemSet = (searchVal) => this.setState({ searchVal });
handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) });
handleSelectGroupAll = (groupId, checked) => {
const { selectItem, groupItem } = this.state;
const { dataSource } = this.props;
_.map(dataSource, item => {
if (item.groupId === groupId) {
if (!!Number(checked)) {
this.setState({
groupItem: [...groupItem, ..._.map(item.items, child => child.id)]
}, () => this.setState({ selectItem: [...selectItem, ...this.state.groupItem] }));
} else {
this.setState({
groupItem: _.differenceWith(groupItem, _.map(item.items, child => child.id), _.isEqual)
}, () => this.setState({ selectItem: this.state.groupItem }));
}
}
});
this.props.onChange(items);
}
};
handleSelectItem = (id, checked) => {
const { selectItem } = this.state;
this.setState({
selectItem: !!Number(checked) ? [...selectItem, id] : _.xorWith(selectItem, [id], _.isEqual)
});
};
renderTitle = (item) => {
const { onSelectGroupAll } = this.props;
const { groupName, groupId, items } = item;
const number = _.filter(items, it => !!it.checked).length;
const value = _.every(items, it => !!it.checked) ? "1" : "0";
return <div className="setGroupWrapper">
<WeaCheckbox content={groupName} value={value} onChange={(val) => onSelectGroupAll(groupId, val)}/>
<span className="checkedtitle">已选择{number}个字段</span>
</div>;
};
render() {
const { searchVal, selectItem, showOnlyChecked } = this.state;
const { onSelectItem, dataSource } = this.props;
let setItemList = _.map(dataSource, item => {
return {
...item,
items: _.filter(item.items || [], child => child.name.indexOf(searchVal) !== -1)
};
});
setItemList = _.map(setItemList, item => {
return {
...item,
items: _.map(item.items, child => {
return { ...child, checked: selectItem.includes(child.id) };
})
};
});
if (showOnlyChecked) {
setItemList = _.map(setItemList, item => {
return { ...item, items: _.filter(item.items, it => !!it.checked) };
});
}
return (
<div>
<div style={{ margin: "10px 0", cursor: "pointer" }}>
<div style={{ display: "inline-block" }}><WeaCheckbox
content={<span style={{ fontWeight: "600" }}>{this.props.title}</span>} onChange={(value) => {
this.handleAllChecked(value);
}} value={this.state.checkStatus}/></div>
<div style={{ float: "right", fontWeight: "600" }} onClick={() => this.setState({
showContent: !this.state.showContent
})}>已选中{this.props.items ? this.props.items.filter(item => item.checked).length : 0}个字段
<span style={{ marginLeft: "10px", fontWeight: "400" }}>
{
this.state.showContent ? <Icon type="down"/> : <Icon type="left"/>
}
</span>
</div>
</div>
<React.Fragment>
{
this.state.showContent && <div style={{
height: "160px",
border: "1px solid #eee",
padding: "10px",
overflowY: "scroll",
borderRadius: "5px"
}}>
<Row>
{
this.props.items && this.props.items.map(item => (
<Col span={6}><WeaCheckbox content={item.name} value={item.checked} onChange={(value) => {
this.handleItemChange(value, item);
}}/></Col>
))
}
</Row>
</div>
_.map(setItemList, item => {
const { items } = item;
return <WeaSearchGroup title={this.renderTitle(item)} showGroup>
<div className="itemsWrapper">
{
_.isEmpty(items) ?
<span className="empty">暂无数据</span> :
<ul className="itemContUl">
{
_.map(items, child => {
const { name, checked, id } = child;
return <li title={name}>
<WeaCheckbox
content={name} value={checked ? "1" : "0"}
onChange={(val) => onSelectItem(id, val)}
/>
</li>;
})
}
</ul>
}
</div>
</WeaSearchGroup>;
})
}
</div>
</React.Fragment>
);
}
}
export default SelectItemsWrapper;

View File

@ -1,191 +1,213 @@
import { Switch } from 'antd'
export const columns = [
{
title: "姓名",
dataIndex: 'username',
key: 'username',
},
{
title: "个税扣缴义务人",
dataIndex: 'ywr',
key: 'ywr',
},
{
title: "部门",
dataIndex: 'bm',
key: 'title',
},
{
title: "手机号",
dataIndex: 'sjh',
key: 'sjh',
},
{
title: "工号",
dataIndex: 'gh',
key: 'gh',
},
{
title: "证件号码",
dataIndex: 'sfzh',
key: 'sfzh',
},
{
title: "入职日期",
dataIndex: 'rzrq',
key: 'rzrq',
},
{
title: "累计子女教育",
dataIndex: 'ljznjy',
key: 'ljznjy',
},
{
title: "累计继续教育",
dataIndex: 'ljjxjy',
key: 'ljjxjy',
},
{
title: "累计住房贷款利息",
dataIndex: 'ljzfdklx',
key: 'ljfdklx',
},
{
title: "累计住房租金",
dataIndex: 'ljzfzj',
key: 'ljzfzj',
},
{
title: "累计赡养老人",
dataIndex: 'ljsylr',
key: 'ljsylr',
},
{
title: "操作",
dataIndex: 'cz',
key: 'cz',
render: (text, record) => {
}
}
]
export const tab2Columns = [
{
title: "字段名称",
dataIndex: 'username',
key: 'username'
},
{
title: "来源",
dataIndex: 'username',
key: 'username'
},
{
title: "类型",
dataIndex: 'username',
key: 'username'
},
{
title: "是否启用",
render: (text) => {
return <Switch defaultChecked={false}/>
}
},
{
title: "备注",
dataIndex: 'username',
key: 'username'
}
]
export const slideColumns = [
{
title: "姓名",
dataIndex: 'username',
key: 'username'
},
{
title: "部门",
dataIndex: 'username',
key: 'username'
},
{
title: "手机号",
dataIndex: 'username',
key: 'username'
},
{
title: "工号",
dataIndex: 'username',
key: 'username'
},
{
title: "在职计薪天数",
dataIndex: 'username',
key: 'username'
},
{
title: "非在职计薪天数",
dataIndex: 'username',
key: 'username'
},
{
title: "应出勤天数(不含节假日)",
dataIndex: 'username',
key: 'username'
},
{
title: "实际出勤天数",
dataIndex: 'username',
key: 'username'
},
{
title: "工作日加班",
dataIndex: 'username',
key: 'username'
},
{
title: "双休日日加班",
dataIndex: 'username',
key: 'username'
},
{
title: "事假时长",
dataIndex: 'username',
key: 'username'
},
{
title: "病假时长",
dataIndex: 'username',
key: 'username'
}
]
export const slideDataSource = [{
username: "测试"
}]
export const dataSource = [
{
username: "测试",
ywr: "测试",
bm: "测试",
sjh: "测试",
gh: "测试",
sfzh: "测试",
rzrq: "测试",
ljznjy: "测试",
ljjxjy: "测试",
ljzfdklx: "测试",
ljzfzj: "测试",
ljsylr: "测试"
{
title: "姓名",
dataIndex: "username",
key: "username"
},
{
title: "个税扣缴义务人",
dataIndex: "ywr",
key: "ywr"
},
{
title: "部门",
dataIndex: "bm",
key: "title"
},
{
title: "手机号",
dataIndex: "sjh",
key: "sjh"
},
{
title: "工号",
dataIndex: "gh",
key: "gh"
},
{
title: "证件号码",
dataIndex: "sfzh",
key: "sfzh"
},
{
title: "入职日期",
dataIndex: "rzrq",
key: "rzrq"
},
{
title: "累计子女教育",
dataIndex: "ljznjy",
key: "ljznjy"
},
{
title: "累计继续教育",
dataIndex: "ljjxjy",
key: "ljjxjy"
},
{
title: "累计住房贷款利息",
dataIndex: "ljzfdklx",
key: "ljfdklx"
},
{
title: "累计住房租金",
dataIndex: "ljzfzj",
key: "ljzfzj"
},
{
title: "累计赡养老人",
dataIndex: "ljsylr",
key: "ljsylr"
},
{
title: "操作",
dataIndex: "cz",
key: "cz",
render: (text, record) => {
}
}
];
export const fieldsColumns = [
{
title: "id",
dataIndex: "id",
key: "id",
display: true
},
{
title: "字段名称",
dataIndex: "fieldName",
key: "fieldName",
display: true
},
{
title: "来源",
dataIndex: "sourceType",
key: "sourceType",
display: true
},
{
title: "类型",
dataIndex: "fieldType",
key: "fieldType",
display: true
},
{
title: "是否启用",
dataIndex: "enableStatus",
key: "enableStatus",
display: true
},
{
title: "备注",
dataIndex: "description",
key: "description",
display: true
}
];
export const conditions = [
{
items: [
{
colSpan: 1,
conditionType: "INPUT",
domkey: ["fieldName"],
fieldcol: 14,
rules: "required|string",
label: "字段名称",
labelcol: 6,
value: "",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "SELECT",
domkey: ["fieldType"],
fieldcol: 14,
isQuickSearch: false,
label: "类型",
labelcol: 6,
valueList:[],
options: [
{
key: "NUMBER",
selected: true,
showname: "数值"
},
{
key: "TEXT",
selected: false,
showname: "文本"
}
],
rules: "required|string",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "SWITCH",
domkey: ["enableStatus"],
fieldcol: 14,
label: "是否启用",
labelcol: 6,
viewAttr: 3,
rules: "required"
},
{
colSpan: 1,
conditionType: "INPUT",
domkey: ["description"],
fieldcol: 14,
label: "备注",
labelcol: 6,
value: "",
viewAttr: 2
}
],
defaultshow: true
}
];
export const reFrenceConditions = [
{
items: [
{
colSpan: 1,
conditionType: "MONTHPICKER",
domkey: ["salaryYearMonth"],
fieldcol: 18,
rules: "required|string",
label: "薪资所属月",
labelcol: 6,
value: "",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "SELECT",
domkey: ["salarySobId"],
fieldcol: 18,
isQuickSearch: false,
label: "薪资账套",
labelcol: 6,
valueList:[],
options: [],
rules: "required|string",
viewAttr: 3
},
{
colSpan: 1,
conditionType: "INPUT",
domkey: ["description"],
fieldcol: 18,
label: "备注",
labelcol: 6,
value: "",
viewAttr: 2
}
],
defaultshow: true
}
];

View File

@ -0,0 +1,76 @@
/*
* Author: 黎永顺
* name: 新建考勤自定义字段
* Description:
* Date: 2023/3/1
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog } from "ecCom";
import { Button, message } from "antd";
import { conditions } from "../columns";
import { getSearchs } from "../../../../util";
import { saveAttendanceField } from "../../../../apis/attendance";
import "./index.less";
@inject("attendanceStore")
@observer
class AttendanceCustomFieldsModal extends Component {
componentDidMount() {
const { attendanceStore: { form } } = this.props;
form.initFormFields(conditions);
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.handleResetForm();
}
/*
* Author: 黎永顺
* Description: 保存考勤字段
* Params:
* Date: 2023/3/1
*/
handleSubmitFields = () => {
const { attendanceStore: { form }, onRefresh, onCancel } = this.props;
form.validateForm().then(f => {
if (f.isValid) {
const payload = form.getFormParams();
saveAttendanceField(payload).then(({ status, errormsg }) => {
if (status) {
message.success("新增成功");
onCancel();
onRefresh();
} else {
message.error(errormsg || "新增失败");
}
});
} else {
f.showErrors();
}
});
};
handleResetForm = () => {
const { attendanceStore: { form } } = this.props;
form.updateFields({ fieldName: "", fieldType: "NUMBER", enableStatus: "0", description: "" });
};
render() {
const { attendanceStore: { form } } = this.props;
const buttons = [
<Button type="primary" onClick={this.handleSubmitFields}>保存</Button>
];
return (
<WeaDialog
{...this.props} style={{ width: 440, height: 202 }}
buttons={buttons} hasScroll initLoadCss
className="modalWrapper"
>
{getSearchs(form, conditions, 1)}
</WeaDialog>
);
}
}
export default AttendanceCustomFieldsModal;

View File

@ -0,0 +1,419 @@
/*
* Author: 黎永顺
* name: 考勤数据
* Description:
* Date: 2023/2/24
*/
import React, { Component } from "react";
import { WeaTable } from "ecCom";
import { message, Modal } from "antd";
import {
deleteAttendance,
getAttendanceFieldSettingList,
getAttendanceList,
getLedgerList,
getSalaryCycleAndAttendCycle,
importAttendQuoteData,
previewAttendQuote,
returnToAttendanceFieldSettingDefault,
saveAttendanceFieldSetting,
saveAttendanceFieldSettingAsDefault
} from "../../../../apis/attendance";
import ImportModal from "../../../../components/importModal";
import HeaderSet from "../../../../components/importModal/headerSet";
import ImportFormOptions from "./importFormOptions";
import SelectItemModal from "../../../../components/selectItemsModal";
import moment from "moment";
import SelectItemsWrapper from "../../../../components/selectItemsModal/selectItemsWrapper";
import AttendanceRefrenceDataModal from "./attendanceRefrenceDataModal";
import AttendanceDataViewSlide from "./attendanceDataViewSlide";
class AttendanceDataComp extends Component {
constructor(props) {
super(props);
this.state = {
loading: {
query: false,
headset: false
},
dataSource: [],
columns: [],
pageInfo: {
current: 1,
pageSize: 10,
total: 0
},
importData: {
visiable: false, params: {}, step: 0,
columns: [], slideDataSource: [], importResult: []
},
importFormPayload: {
salaryYearMonth: moment().format("YYYY-MM"), salarySobList: [],
salarySobId: "", salaryCycle: "", attendCycle: ""
},
fieldSetPayload: { visible: false, title: "", children: null },
attendanceReferencePayload: { visible: false, title: "" },
attendanceViewPayload: { visible: false, attendQuoteId: "", salaryYearMonth: "" }
};
}
componentDidMount() {
this.getAttendanceList();
}
getAttendanceList = (extraPayload) => {
const { loading, pageInfo } = this.state;
const module = { ...pageInfo, ...extraPayload };
this.setState({ loading: { ...loading, query: true } });
getAttendanceList(module).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource,
columns: _.map(columns, item => {
if (item.dataIndex === "salaryYearMonth") {
return {
...item,
render: (text) => <span>{moment(text).format("YYYY-MM")}</span>
};
}
return { ...item };
})
});
}
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
};
getLedgerList = () => {
const { importFormPayload } = this.state;
getLedgerList().then(({ status, data }) => {
if (status) {
this.setState({
importFormPayload: {
...importFormPayload,
salarySobList: _.map(data, it => ({ key: it.id, showname: it.content }))
}
});
}
});
};
handleChangeImportPayload = (key, value) => {
const { importFormPayload, importData } = this.state;
const { params } = importData;
this.setState({
importFormPayload: {
...importFormPayload,
[key]: value
},
importData: { ...importData, params: { ...params, [key]: value } }
}, () => {
if (this.state.importFormPayload.salaryYearMonth && this.state.importFormPayload.salarySobId) {
const payload = {
salaryYearMonthStr: this.state.importFormPayload.salaryYearMonth,
salarySobId: this.state.importFormPayload.salarySobId
};
getSalaryCycleAndAttendCycle(payload).then(({ status, data }) => {
if (status) {
this.setState({
importFormPayload: {
...this.state.importFormPayload,
...data
}
});
}
});
}
});
};
handleDeleteAttendanceData = ({ id }) => {
Modal.confirm({
title: "信息确认",
content: "确认要删除吗?",
onOk: () => {
deleteAttendance([id]).then(({ status, errormsg }) => {
if (status) {
message.success("删除成功");
this.getAttendanceList();
} else {
message.error(errormsg || "删除失败");
}
});
}
});
};
handleViewAttendanceData = ({ id, salaryCycle }) => {
const { attendanceViewPayload } = this.state;
this.setState({
attendanceViewPayload: {
...attendanceViewPayload,
visible: true, attendQuoteId: id,
salaryYearMonth: salaryCycle
}
});
};
handleImportAttendanceData = (importData) => {
const { importFormPayload } = this.state;
const { salaryYearMonth, salarySobId } = importFormPayload;
this.getLedgerList();
this.setState({ importData: { ...importData, params: { salaryYearMonth, salarySobId } } });
};
setStep = step => this.setState({ importData: { ...this.state.importData, step } });
handleFinish = () => {
const { importData } = this.state;
const { step } = importData;
this.setState({
importData: {
...importData, visiable: false, params: {}, step: 0,
columns: [], slideDataSource: [], importResult: []
}
});
step === 2 && this.getAttendanceList();
};
handlePreviewImport = (params) => {
const { importData } = this.state;
previewAttendQuote(params).then(({ status, data }) => {
if (status) {
const { headers, list } = data;
this.setState({
importData: {
...importData,
columns: _.map(headers, (it, dataIndex) => ({ title: it, dataIndex })),
slideDataSource: _.map(list, item => {
return _.reduce(item, (pre, cur, key) => (_.assign(pre, { [key]: cur })), {});
})
}
});
}
});
};
handleImport = (params) => {
const { importData } = this.state;
const { step } = importData;
importAttendQuoteData(params).then(({ status, data }) => {
if (status) {
this.setState({
importData: {
...importData,
step: step + 1,
importResult: data
}
});
}
});
};
handleTemplateLinkClick = () => {
const { importFormPayload } = this.state;
const { salarySobId, salaryYearMonth } = importFormPayload;
if (!salarySobId || !salaryYearMonth) {
message.warning("请完善导入选项,再下载");
return;
}
window.open(`/api/bs/hrmsalary/attendQuote/downloadTemplate?salaryYearMonth=${salaryYearMonth}&salarySobId=${salarySobId}`);
};
/*
* Author: 黎永顺
* Description: 表头设置
* Params:
* Date: 2023/3/6
*/
handleHeaderSettings = (params) => {
const { fieldSetPayload, loading } = this.state;
this.setState({ loading: { ...loading, headset: true } });
getAttendanceFieldSettingList(params).then(({ status, data }) => {
this.setState({ loading: { ...loading, headset: false } });
if (status) {
this.setState({
fieldSetPayload: {
...fieldSetPayload,
visible: true, title: "导入字段设置",
children: <SelectItemsWrapper
ref={dom => this.setItemRef = dom}
dataSource={data}
onSelectGroupAll={this.handleSelectGroupAll}
onSelectItem={this.handleSelectItem}
/>
}
});
}
}).catch(() => this.setState({ loading: { ...loading, headset: false } }));
};
handleCloseSettings = () => {
const { fieldSetPayload } = this.state;
this.setState({
fieldSetPayload: {
...fieldSetPayload,
visible: false, title: "", children: null
}
});
};
handleSearchItemSet = (val) => this.setItemRef.handleSearchItemSet(val);
handleShowOnlyChecked = (checked) => this.setItemRef.handleShowOnlyChecked(checked);
handleSelectGroupAll = (groupId, checked) => this.setItemRef.handleSelectGroupAll(groupId, checked);
handleSelectItem = (id, checked) => this.setItemRef.handleSelectItem(id, checked);
handleMoreOpts = (key) => {
switch (key) {
case "recovery":
returnToAttendanceFieldSettingDefault({ sourceType: "IMPORT" }).then(({ status, errormsg }) => {
if (status) {
message.success("操作成功");
this.handleHeaderSettings({ sourceType: "IMPORT" });
} else {
message.error(errormsg || "操作失败");
}
});
break;
case "setting":
const { state, props } = this.setItemRef;
let currentSettingFields = [];
const { selectItem } = state, { dataSource } = props;
_.forEach(dataSource, item => {
currentSettingFields = _.map([...currentSettingFields, ...item.items], child => {
return {
id: child.id,
checked: selectItem.includes(child.id)
};
});
});
const payload = { currentSettingFields, sourceType: "IMPORT" };
saveAttendanceFieldSettingAsDefault(payload).then(({ status, errormsg }) => {
if (status) {
message.success("操作成功");
} else {
message.error(errormsg || "操作失败");
}
});
break;
default:
break;
}
};
handleSave = () => {
const { state, props } = this.setItemRef;
let currentSettingFields = [];
const { selectItem } = state, { dataSource } = props;
_.forEach(dataSource, item => {
currentSettingFields = _.map([...currentSettingFields, ...item.items], child => {
return {
id: child.id,
checked: selectItem.includes(child.id)
};
});
});
const payload = { currentSettingFields, sourceType: "IMPORT" };
saveAttendanceFieldSetting(payload).then(({ status, errormsg }) => {
if (status) {
message.success("保存成功");
this.handleCloseSettings();
} else {
message.error(errormsg || "保存失败");
}
});
};
/*
* Author: 黎永顺
* Description: 考勤数据引用
* Params:
* Date: 2023/3/7
*/
handleQuoteAttendanceData = (payload) => {
const { attendanceReferencePayload } = this.state;
this.setState({ attendanceReferencePayload: { ...attendanceReferencePayload, ...payload } });
};
handleCloseQuoteModal = (isRefresh) => {
const { attendanceReferencePayload } = this.state;
this.setState({ attendanceReferencePayload: { ...attendanceReferencePayload, visible: false } }, () => {
isRefresh && this.getAttendanceList();
});
};
render() {
const {
dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload,
attendanceReferencePayload, attendanceViewPayload
} = this.state;
const { showOperateBtn, salaryYearMonth } = this.props;
const pagination = {
...pageInfo,
showTotal: total => `${total}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.getAttendanceList({ salaryYearMonth: _.compact(salaryYearMonth) }));
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getAttendanceList({ salaryYearMonth: _.compact(salaryYearMonth) }));
}
};
return (
<React.Fragment>
<WeaTable
columns={[
...columns,
{
title: "操作",
width: 120,
dataIndex: "operate",
render: (_, record) => {
return (
<div className="linkWapper">
<a href="javascript: void(0);" onClick={() => this.handleViewAttendanceData(record)}>查看</a>
{showOperateBtn &&
<a href="javascript: void(0);" onClick={() => this.handleDeleteAttendanceData(record)}>删除</a>
}
</div>
);
}
}
]}
dataSource={dataSource}
pagination={pagination}
loading={loading.query}
/>
{/* 考勤引用导入 */}
<ImportModal {...importData} setStep={this.setStep} onFinish={this.handleFinish}
previewImport={this.handlePreviewImport} importFile={this.handleImport}
templateLink={this.handleTemplateLinkClick} onCancel={this.handleFinish}
headerSetCompoent={<HeaderSet
loading={loading.headset}
onSetClick={() => this.handleHeaderSettings({ sourceType: "IMPORT" })}/>}
renderFormComponent={() => <ImportFormOptions
{...importFormPayload}
onChangeImportForm={this.handleChangeImportPayload}/>
}
/>
{/* 表头设置 */}
<SelectItemModal {...fieldSetPayload}
onCancel={this.handleCloseSettings}
onSearchItemSet={this.handleSearchItemSet}
onShowOnlyChecked={this.handleShowOnlyChecked}
onMoreOpts={this.handleMoreOpts} onSave={this.handleSave}
/>
{/* 考勤数据引用 */}
<AttendanceRefrenceDataModal
{...attendanceReferencePayload}
onCancel={this.handleCloseQuoteModal}
/>
{/* 考勤数据查看 */}
<AttendanceDataViewSlide
{...attendanceViewPayload}
showOperateBtn={showOperateBtn}
onClose={() => this.setState({
attendanceViewPayload: {
...attendanceViewPayload,
visible: false,
attendQuoteId: ""
}
})}
/>
</React.Fragment>
);
}
}
export default AttendanceDataComp;

View File

@ -0,0 +1,143 @@
/*
* Author: 黎永顺
* name: 考勤引用数据查看
* Description:
* Date: 2023/3/7
*/
import React, { Component } from "react";
import { WeaFormItem, WeaInput, WeaInputSearch, WeaSlideModal } from "ecCom";
import { Button } from "antd";
import SlideModalTitle from "../../../../components/slideModalTitle";
import { viewAttendQuote } from "../../../../apis/attendance";
import UnifiedTable from "../../../../components/UnifiedTable";
import "./index.less";
class AttendanceDataViewSlide extends Component {
constructor(props) {
super(props);
this.state = {
loading: {
query: false
},
keyword: "",
dataSource: [],
columns: [],
pageInfo: {
current: 1, pageSize: 10, total: 0
}
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.viewAttendQuote({}, nextProps);
}
viewAttendQuote = (extraPayload = {}, props) => {
const { loading, pageInfo, keyword } = this.state;
const { attendQuoteId } = props;
this.setState({ loading: { ...loading, query: true } });
viewAttendQuote({ ...pageInfo, attendQuoteId, keyword, ...extraPayload }).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data.pageInfo;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource,
columns
});
}
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
};
renderCustomOperate = () => {
const { keyword } = this.state;
const { showOperateBtn } = this.props;
return ([
<div style={{ display: "inline-block" }}>
{showOperateBtn && <Button type="primary" onClick={this.handleExportAttendQuote}>导出全部</Button>}
<WeaInputSearch
value={keyword}
style={{ marginLeft: 10 }}
placeholder="请输入姓名/部门/工号/手机号"
onChange={keyword => this.setState({ keyword })}
onSearch={() => this.viewAttendQuote({ current: 1 }, this.props)}
/>
</div>
]);
};
handleExportAttendQuote = () => {
if (!this.handleDebounce) {
this.handleDebounce = _.debounce(() => {
const { attendQuoteId } = this.props;
const url = `${window.location.origin}/api/bs/hrmsalary/attendQuote/export?attendQuoteId=${attendQuoteId}`;
window.open(url, "_self");
this.handleDebounce = null;
}, 500);
}
this.handleDebounce();
};
render() {
const { showOperateBtn, salaryYearMonth, ...extra } = this.props;
const { columns, dataSource, loading, pageInfo } = this.state;
const pagination = {
...pageInfo,
showTotal: (total) => `${total}`,
pageSizeOptions: ["10", "20", "50", "100"],
showSizeChanger: true,
showQuickJumper: true,
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.viewAttendQuote({}, this.props));
},
onChange: (current) => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.viewAttendQuote({}, this.props));
}
};
return (
<WeaSlideModal
{...extra}
className="attendanceSlideWrapper"
top={0}
measureT="%"
width={800}
measureX="px"
height={100}
measureY="%"
direction="right"
title={
<SlideModalTitle
subtitle="考勤数据"
editable={false}
showOperateBtn={showOperateBtn}
customOperate={this.renderCustomOperate()}
/>
}
content={
<div>
<WeaFormItem label="考勤周期" labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} underline>
<WeaInput value={salaryYearMonth} viewAttr={1}/>
</WeaFormItem>
<UnifiedTable
rowKey="id"
columns={_.map(columns, item => ({
...item,
render: (text) => {
return <span className="ellipsis" title={text}> {text} </span>;
}
}))}
dataSource={dataSource}
pagination={pagination}
loading={loading.query}
xWidth={columns.length * 120}
/>
</div>
}
/>
);
}
}
export default AttendanceDataViewSlide;

View File

@ -0,0 +1,230 @@
/*
* Author: 黎永顺
* name: 考勤数据引用
* Description:
* Date: 2023/3/1
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { WeaDialog } from "ecCom";
import { Button, message } from "antd";
import { reFrenceConditions } from "../columns";
import { getSearchs } from "../../../../util";
import {
checkOperation,
getAttendanceFieldSettingList,
getLedgerList, returnToAttendanceFieldSettingDefault, saveAttendanceFieldSetting, saveAttendanceFieldSettingAsDefault,
syncAttendanceRefer
} from "../../../../apis/attendance";
import SelectItemModal from "../../../../components/selectItemsModal";
import SelectItemsWrapper from "../../../../components/selectItemsModal/selectItemsWrapper";
import "./index.less";
@inject("attendanceStore")
@observer
class AttendanceRefrenceDataModal extends Component {
constructor(props) {
super(props);
this.state = {
loading: false,
headerSetLoading: false,
condition: [],
headerSetPayload: { visible: false, title: "", children: null }
};
}
componentDidMount() {
this.getLedgerList();
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.handleResetForm();
}
getLedgerList = () => {
const { attendanceStore: { refenceform } } = this.props;
getLedgerList().then(({ status, data }) => {
if (status) {
this.setState({
condition: _.map(reFrenceConditions, (item) => {
const { items } = item;
return {
...item,
items: _.map(items, child => {
const { domkey } = child;
if (domkey[0] === "salarySobId") {
return { ...child, options: _.map(data, it => ({ key: it.id, showname: it.content })) };
}
return { ...child };
})
};
})
}, () => refenceform.initFormFields(this.state.condition));
}
});
};
/*
* Author: 黎永顺
* Description: 同步考勤数据
* Params:
* Date: 2023/3/1
*/
handleSubmitFields = () => {
const { attendanceStore: { refenceform }, onCancel } = this.props;
refenceform.validateForm().then(f => {
if (f.isValid) {
const payload = refenceform.getFormParams();
const checkPayload = { salaryYearMonthStr: payload.salaryYearMonth, salarySobId: payload.salarySobId };
this.setState({ loading: true });
checkOperation(checkPayload).then(({ status, errormsg: errormessage }) => {
if (status) {
syncAttendanceRefer(payload).then(({ status, errormsg }) => {
this.setState({ loading: false });
if (status) {
message.success("同步成功");
onCancel(true);
} else {
message.error(errormsg || "同步失败");
}
}).catch(() => this.setState({ loading: false }));
} else {
this.setState({ loading: false });
message.error(errormessage);
}
}).catch(() => this.setState({ loading: false }));
} else {
f.showErrors();
}
});
};
handleResetForm = () => {
const { attendanceStore: { refenceform } } = this.props;
refenceform.resetForm();
};
/*
* Author: 黎永顺
* Description: 表头设置
* Params:
* Date: 2023/3/8
*/
handleHeaderSetting = () => {
const { headerSetPayload } = this.state;
this.setState({ headerSetLoading: true });
getAttendanceFieldSettingList({ sourceType: "QUOTE" }).then(({ status, data }) => {
this.setState({ headerSetLoading: false });
if (status) {
this.setState({
headerSetPayload: {
...headerSetPayload,
visible: true, title: "引用考勤字段设置",
children: <SelectItemsWrapper
ref={dom => this.setItemRef = dom}
dataSource={data}
onSelectGroupAll={this.handleSelectGroupAll}
onSelectItem={this.handleSelectItem}
/>
}
});
}
}).catch(() => this.setState({ headerSetLoading: false }));
};
handleCloseSettings = () => {
const { headerSetPayload } = this.state;
this.setState({
headerSetPayload: {
...headerSetPayload,
visible: false, title: "", children: null
}
});
};
handleSearchItemSet = (val) => this.setItemRef.handleSearchItemSet(val);
handleShowOnlyChecked = (checked) => this.setItemRef.handleShowOnlyChecked(checked);
handleSelectGroupAll = (groupId, checked) => this.setItemRef.handleSelectGroupAll(groupId, checked);
handleSelectItem = (id, checked) => this.setItemRef.handleSelectItem(id, checked);
handleMoreOpts = (key) => {
switch (key) {
case "recovery":
returnToAttendanceFieldSettingDefault({ sourceType: "QUOTE" }).then(({ status, errormsg }) => {
if (status) {
message.success("操作成功");
this.handleHeaderSetting({ sourceType: "QUOTE" });
} else {
message.error(errormsg || "操作失败");
}
});
break;
case "setting":
const { state, props } = this.setItemRef;
let currentSettingFields = [];
const { selectItem } = state, { dataSource } = props;
_.forEach(dataSource, item => {
currentSettingFields = _.map([...currentSettingFields, ...item.items], child => {
return {
id: child.id,
checked: selectItem.includes(child.id)
};
});
});
const payload = { currentSettingFields, sourceType: "QUOTE" };
saveAttendanceFieldSettingAsDefault(payload).then(({ status, errormsg }) => {
if (status) {
message.success("操作成功");
} else {
message.error(errormsg || "操作失败");
}
});
break;
default:
break;
}
};
handleSave = () => {
const { state, props } = this.setItemRef;
let currentSettingFields = [];
const { selectItem } = state, { dataSource } = props;
_.forEach(dataSource, item => {
currentSettingFields = _.map([...currentSettingFields, ...item.items], child => {
return {
id: child.id,
checked: selectItem.includes(child.id)
};
});
});
const payload = { currentSettingFields, sourceType: "QUOTE" };
saveAttendanceFieldSetting(payload).then(({ status, errormsg }) => {
if (status) {
message.success("保存成功");
this.handleCloseSettings();
} else {
message.error(errormsg || "保存失败");
}
});
};
render() {
const { condition, loading, headerSetLoading, headerSetPayload } = this.state;
const { attendanceStore: { refenceform } } = this.props;
const buttons = [
<Button type="primary" onClick={this.handleSubmitFields} loading={loading}>同步</Button>,
<Button type="ghost" onClick={this.handleHeaderSetting} loading={headerSetLoading}>表头设置</Button>
];
return (
<WeaDialog
{...this.props} style={{ width: 440, height: 156 }}
buttons={buttons} hasScroll initLoadCss
className="modalWrapper"
>
{getSearchs(refenceform, condition, 1)}
{/* 表头设置 */}
<SelectItemModal {...headerSetPayload}
onCancel={this.handleCloseSettings}
onSearchItemSet={this.handleSearchItemSet}
onShowOnlyChecked={this.handleShowOnlyChecked}
onMoreOpts={this.handleMoreOpts} onSave={this.handleSave}
/>
</WeaDialog>
);
}
}
export default AttendanceRefrenceDataModal;

View File

@ -0,0 +1,139 @@
/*
* Author: 黎永顺
* name:字段管理
* Description:
* Date: 2023/2/24
*/
import React, { Component } from "react";
import { WeaCheckbox, WeaTable } from "ecCom";
import { Col, message, Row } from "antd";
import AttendanceCustomFieldsModal from "./attendanceCustomFieldsModal";
import { getAttendanceFieldList, updateAttendanceFieldStatus } from "../../../../apis/attendance";
import TipLabel from "../../../../components/TipLabel";
import { fieldsColumns } from "../columns";
class FieldMangComp extends Component {
constructor(props) {
super(props);
this.state = {
loading: {
query: false
},
dataSource: [{}],
columns: fieldsColumns,
pageInfo: {
current: 1,
pageSize: 10,
total: 0
},
addPayload: {
visible: false,
title: "新建考勤自定义字段"
}
};
}
componentDidMount() {
this.getAttendanceFieldList();
}
getAttendanceFieldList = (extraPayload = {}) => {
const { loading, pageInfo } = this.state;
const module = { ...pageInfo, ...extraPayload };
this.setState({ loading: { ...loading, query: true } });
getAttendanceFieldList(module).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { pageInfo: pageInfoData } = data;
const { list: dataSource, columns, pageNum: current, pageSize, total } = pageInfoData;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource, columns
});
}
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
};
handleTriggerAttendFileds = () => {
const { addPayload } = this.state;
this.setState({ addPayload: { ...addPayload, visible: !addPayload.visible } });
};
handleAttendanceFieldSwitch = ({ id }, enableStatus) => {
const payload = { id, enableStatus: enableStatus === "1" };
updateAttendanceFieldStatus(payload).then(({ status, errormsg }) => {
if (status) {
message.success("操作成功");
this.getAttendanceFieldList();
} else {
message.error(errormsg || "操作失败");
}
});
};
getColumns = () => {
const { columns } = this.state;
const { showOperateBtn } = this.props;
return _.map(_.filter(columns, item => !!item.display), child => ({
...child,
render: (text, record) => {
switch (child.dataIndex) {
case "enableStatus":
return (
<WeaCheckbox
value={text} display="switch" disabled={!showOperateBtn}
onChange={value => this.handleAttendanceFieldSwitch(record, value)}
/>
);
default:
return <div dangerouslySetInnerHTML={{ __html: text }}/>;
}
}
}));
};
render() {
const { dataSource, pageInfo, loading, addPayload } = this.state;
const { fieldName } = this.props;
const pagination = {
...pageInfo,
showTotal: total => `${total}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.getAttendanceFieldList({ fieldName }));
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getAttendanceFieldList({ fieldName }));
}
};
return (
<Row gutter={20}>
<Col xs={24} sm={24} md={16} lg={18}>
<WeaTable
columns={this.getColumns()}
dataSource={dataSource}
pagination={pagination}
loading={loading.query}
/>
<AttendanceCustomFieldsModal
{...addPayload} onCancel={this.handleTriggerAttendFileds}
onRefresh={this.getAttendanceFieldList}
/>
</Col>
<Col xs={24} sm={24} md={8} lg={6}>
<TipLabel
tipList={[
"1、考勤字段包含自定义字段和考勤模块的统计字段所有字段不可重名",
"2、停用自定义字段将影响其参与计算的账套核算"
]}
/>
</Col>
</Row>
);
}
}
export default FieldMangComp;

View File

@ -0,0 +1,57 @@
/*
* Author: 黎永顺
* name: 考情数据导入的表单选项
* Description:
* Date: 2023/3/3
*/
import React, { Component } from "react";
import { WeaFormItem, WeaInput, WeaSearchGroup } from "ecCom";
import { DataCollectionDatePicker, DataCollectionSelect } from "../../cumDeduct";
import "./index.less";
const Input = (label, value, labelCol = 8, wrapperCol = 16) => {
return (
<WeaFormItem label={label} labelCol={{ span: labelCol }} wrapperCol={{ span: wrapperCol }}>
<WeaInput viewAttr={1} value={value}/>
</WeaFormItem>
);
};
class ImportFormOptions extends Component {
screenChange = ({ key, value }) => {
const { onChangeImportForm } = this.props;
onChangeImportForm(key, value);
};
render() {
const { salarySobList = [], salaryYearMonth, salarySobId, salaryCycle, attendCycle } = this.props;
const items = [
{
com: DataCollectionDatePicker({
label: "薪资所属月",
value: salaryYearMonth,
onChange: this.screenChange,
key: "salaryYearMonth",
screen: false
})
},
{
com: DataCollectionSelect({
label: "薪资账套",
value: salarySobId || "",
onChange: this.screenChange,
options: [{ key: "", showname: "" }, ...salarySobList],
key: "salarySobId"
})
},
{ com: Input("薪资周期", salaryCycle) },
{ com: Input("考勤周期", attendCycle, 10, 14) }
];
return (
<WeaSearchGroup className="attendanceFormWrapper" showGroup needTigger={false} items={items}
col={2}/>
);
}
}
export default ImportFormOptions;

View File

@ -0,0 +1,53 @@
.modalWrapper {
.wea-select, .ant-select-selection, .ant-select {
width: 100%;
}
.wea-date-picker {
width: 100%;
}
.wea-select {
display: inline-block;
position: relative;
}
.ant-select-selection {
height: 30px;
border-radius: 0;
}
}
.attendanceFormWrapper {
padding: 0;
}
.attendanceSlideWrapper {
.wea-slide-modal-title {
height: initial;
line-height: initial;
text-align: left;
}
.rodal-close {
z-index: 99;
top: 10px !important;
}
}
@media (min-width: 1260px) {
.attendanceSlideWrapper {
.reqTopWrapper .wea-new-top-req-title > div:first-child > div {
max-width: 100% !important;
}
}
}
@media screen and (min-width: 1060px) and (max-width: 1260px) {
.attendanceSlideWrapper {
.reqTopWrapper .wea-new-top-req-title > div:first-child > div {
max-width: calc(100% - 96px) !important;
}
}
}

View File

@ -1,115 +0,0 @@
import React from "react";
import { Row, Col, Table, DatePicker } from "antd";
import { inject, observer } from "mobx-react";
import {
WeaInput,
WeaTextarea,
WeaSearchGroup,
WeaSelect,
WeaCheckbox,
WeaTable
} from "ecCom";
import { slideColumns, slideDataSource, columns } from "./columns";
import "./editSlideContent.less";
// import { WeaTableNew } from "comsMobx"
// const WeaTable = WeaTableNew.WeaTable;
import moment from "moment";
const { MonthPicker } = DatePicker;
let emptyItem = {
incomeLowerLimit: "0.00",
incomeUpperLimit: "0.00",
dutyFreeValue: "0.00",
dutyFreeRate: "0.00",
taxableIncomeLl: "0.00",
taxableIncomeUl: "0.00",
taxRate: "0.00",
taxDeduction: "0.00"
};
@inject("attendanceStore")
@observer
export default class EditSlideContent extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
// 初始化渲染页面
const { attendanceStore: { viewAttendQuote } } = this.props;
viewAttendQuote({ attendQuoteId: this.props.id });
}
getColumns(columns) {
let result = [...columns];
return result.filter(item => item.hide == "false");
}
getScrollWidth() {
const { attendanceStore } = this.props;
const { attendQuoteDetailTableStore } = attendanceStore;
return (
this.getColumns(
attendQuoteDetailTableStore.columns
? attendQuoteDetailTableStore.columns
: []
).length * 150
);
}
render() {
const {
attendanceStore,
attendanceStore: { viewAttendQuote }
} = this.props;
const {
attendQuoteDetailPageInfo,
attendQuoteDetailTableStore
} = attendanceStore;
const pagination = {
total: attendQuoteDetailPageInfo.total,
showTotal: total => `${total}`,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
viewAttendQuote({ attendQuoteId: this.props.id, current, pageSize });
},
onChange: current => {
viewAttendQuote({
attendQuoteId: this.props.id,
current,
pageSize: attendQuoteDetailPageInfo.pageSize
});
}
};
return (
<div className="attendSlide">
<div className="titleWrapper">
{this.props.salaryYearMonth != "" &&
<div className="slideLeftTitle">
考勤周期 {this.props.salaryYearMonth}
</div>}
</div>
<div>
<WeaTable
columns={this.getColumns(
attendQuoteDetailTableStore.columns
? attendQuoteDetailTableStore.columns
: []
)}
dataSource={
attendQuoteDetailPageInfo.list
? attendQuoteDetailPageInfo.list
: []
}
pagination={pagination}
scroll={{ x: this.getScrollWidth() }}
/>
</div>
</div>
);
}
}

View File

@ -1,26 +0,0 @@
.attendSlide {
.titleWrapper {
height: 47px;
line-height: 47px;
overflow: hidden;
padding-left: 10px;
padding-right: 10px;
.slideLeftTitle {
float: left;
}
.rightTitle {
float: right;
}
}
.weaRangePickerWrapper {
display: inline-block;
.monthPickerWrapper {
width: 100px;
display: inline-block;
}
.betweenLable {
margin-left: 10px;
margin-right: 10px;
}
}
}

View File

@ -1,14 +0,0 @@
import React from 'react'
import { Modal } from 'antd'
import SelectItemModal, { items } from '../../../components/selectItemsModal/selectItemsWrapper';
export default class HeaderSetModal extends React.Component {
render() {
return (
<Modal width={800} visible={this.props.visible} onCancel={this.props.onCancel}>
<SelectItemsWrapper items={items} title={"考勤模块"}/>
</Modal>
)
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +1,66 @@
.attendenceImportWrapper{
.wea-dialog-body{
.attendanceRefWrapper {
height: 100%;
display: flex;
flex-direction: column;
.wea-form-item {
padding: 8px 16px;
.to {
padding: 0 10px
}
}
.tableWrapper {
flex: 1;
overflow: hidden;
}
.linkWapper {
& > a:first-child {
padding-right: 10px;
}
}
}
.attendenceImportWrapper {
.wea-dialog-body {
padding: 16px 120px;
.wea-select, .ant-select, .ant-select-selection{
.wea-select, .ant-select, .ant-select-selection {
width: 100%;
}
.ant-select-selection{
.ant-select-selection {
border-radius: 0;
height: 30px;
}
}
}
//导入字段设置
.fieldSetWrapper{
.wea-dialog-body{
.fieldSetWrapper {
.wea-dialog-body {
padding: 16px 20px;
}
.ant-modal-footer button{
margin-right: 0!important;
.ant-modal-footer button {
margin-right: 0 !important;
}
.ant-btn-group{
margin-left: 10px!important;
.ant-btn-group {
margin-left: 10px !important;
}
.searchWrapper{
.searchWrapper {
display: flex;
justify-content: flex-end;
align-items: center;
margin-bottom: 10px;
}
.allInWrapper{
.allInWrapper {
display: flex;
justify-content: flex-start;
margin-top: 10px;
@ -35,15 +68,17 @@
}
//新建考勤自定义字段弹框
.itemManageModalWrapper{
.wea-select,.ant-select-selection,.ant-select{
.itemManageModalWrapper {
.wea-select, .ant-select-selection, .ant-select {
width: 100%;
}
.wea-select{
.wea-select {
display: inline-block;
position: relative;
}
.ant-select-selection{
.ant-select-selection {
height: 30px;
border-radius: 0;
}

View File

@ -1,124 +0,0 @@
import React from "react";
import { Button, Col, Row, Switch } from "antd";
import { inject, observer } from "mobx-react";
import { WeaDialog, WeaInput, WeaSelect } from "ecCom";
import "./index.less";
@inject("attendanceStore")
@observer
export default class ItemMangeFormModal extends React.Component {
componentWillMount() {
const { attendanceStore: { currentItem, currentItemOperate } } = this.props;
if (currentItemOperate == "add") {
this.state = {
request: {
fieldName: "",
fieldType: "1",
enableStatus: 0,
description: ""
}
};
} else {
this.state = {
request: currentItem
};
}
}
handleChange(params) {
const { request } = this.state;
let result = { ...request, ...params };
this.setState({ request: result });
}
convertFieldType = (fileTypeStr) => {
if (fileTypeStr == "数值") {
return "1";
} else if (fileTypeStr == "文本") {
return "2";
} else if (fileTypeStr == "1" || fileTypeStr == "2") {
return fileTypeStr;
}
return "";
};
render() {
const options = [
{
key: "1",
selected: true,
showname: "数值"
},
{
key: "2",
selected: false,
showname: "文本"
}
];
const { request } = this.state;
const { fieldName, fieldType, enableStatus, description } = request;
let fileTypeKey = this.convertFieldType(fieldType);
const { attendanceStore: { currentItemOperate } } = this.props;
return (
<WeaDialog style={{ width: 600 }} visible={this.props.visible} onCancel={this.props.onCancel}
title="新建考勤自定义字段"
initLoadCss
className="itemManageModalWrapper"
buttons={[
<Button type="primary" onClick={() => {
currentItemOperate == "add" ? this.props.onSave(this.state.request) :
this.props.onUpdate(this.state.request);
}
}>保存</Button>
]}>
<div style={{ padding: "16px 120px" }}>
<Row gutter={[10, 10]} style={{ marginBottom: "10px" }}>
<Col span={8}>
字段名称
</Col>
<Col span={16}>
<WeaInput viewAttr={3} style={{ width: "200px" }} value={fieldName} onChange={(v) => {
this.handleChange({ fieldName: v });
}}/>
</Col>
</Row>
<Row gutter={[10, 10]} style={{ marginBottom: "10px" }}>
<Col span={8}>
类型
</Col>
<Col span={16}>
<WeaSelect style={{ width: "200px" }} options={options} value={fileTypeKey}
onChange={(v) => this.handleChange({ fieldType: v })}
/>
</Col>
</Row>
<Row gutter={[10, 10]} style={{ marginBottom: "10px" }}>
<Col span={8}>
是否启用
</Col>
<Col span={16}>
<Switch checked={enableStatus == 1} onChange={(value) => {
let enableStatus = 0;
if (value) {
enableStatus = 1;
}
this.handleChange({ enableStatus });
}}/>
</Col>
</Row>
<Row gutter={[10, 10]} style={{ marginBottom: "10px" }}>
<Col span={8}>
备注
</Col>
<Col span={16}>
<WeaInput style={{ width: "200px" }} value={description} onChange={(v) => {
this.handleChange({ description: v });
}}/>
</Col>
</Row>
</div>
</WeaDialog>
);
}
}

View File

@ -1,198 +0,0 @@
import React from "react";
import { Button, Col, message, Row, Select } from "antd";
import moment from "moment";
import { WeaDatePicker, WeaDialog, WeaError, WeaInput, WeaSelect } from "ecCom";
import SelectItemModal from "../../../components/selectItemsModal";
import SelectItemsWrapper from "../../../components/selectItemsModal/selectItemsWrapper";
import { inject, observer } from "mobx-react";
import { notNull } from "../../../util/validate";
const { Option } = Select;
@inject("attendanceStore")
@observer
export default class RefereAttendFormModal extends React.Component {
constructor(props) {
super(props);
this.state = {
headerSetVisible: false,
inited: false,
request: {
salarySobId: "",
salaryYearMonth: moment(new Date()).format("YYYY-MM"),
employeeIds: [],
description: ""
}
};
}
handleHeaderSet() {
this.setState({ headerSetVisible: true });
this.props.onHeaderSet();
}
componentWillMount() {
const { attendanceStore: { getLedgerList } } = this.props;
getLedgerList().then(() => {
this.setState({
inited: true
});
});
}
// 请求参数改变事件
handleRequestChange(params) {
const { request } = this.state;
let result = { ...request, ...params };
this.setState({ request: result });
}
// 同步点击回调
handleSync = () => {
if (!this.handleAsync) {
this.handleAsync = _.debounce(() => {
const { attendanceStore: { syncAttendanceRefer, checkOperation } } = this.props;
if (!this.validate()) {
return;
}
const { salarySobId, salaryYearMonth: salaryYearMonthStr } = this.state.request;
const payload = {
salaryYearMonthStr,
salarySobId
};
checkOperation(payload).then(({ status, data, errorMsg }) => {
if (status && data) {
syncAttendanceRefer(this.state.request).then(() => {
this.props.onCancel();
});
} else {
message.warning("已经核算过不可操作");
}
});
this.handleAsync = null;
}, 500);
}
this.handleAsync();
};
// 校验数据
validate() {
const { request } = this.state;
if (!notNull(request.salarySobId) && !notNull(request.salaryYearMonth)) {
this.refs.weaError.showError();
this.refs.weaError1.showError();
return false;
}
if (!notNull(request.salarySobId)) {
this.refs.weaError1.showError();
return false;
}
if (!notNull(request.salaryYearMonth)) {
this.refs.weaError.showError();
return false;
}
return true;
}
render() {
const { attendanceStore: { importLedgerList } } = this.props;
return (
<WeaDialog
initLoadCss
className="attendenceImportWrapper"
style={{ width: 600 }}
title="引用考勤数据"
buttons={[
<Button type="primary" onClick={this.handleSync}>同步</Button>,
<Button type="default" onClick={() => {
this.handleHeaderSet();
}}>表头设置</Button>
]}
visible={this.props.visible}
onCancel={this.props.onCancel}>
<Row style={{ marginBottom: "10px" }}>
<Col span={8}>薪资所属月</Col>
<Col span={16}>
<WeaError
style={{ width: "100%" }}
tipPosition="bottom"
ref="weaError"
error="请选择薪资所属月">
<WeaDatePicker
viewAttr={3}
format="YYYY-MM"
style={{ width: "100%" }}
value={this.state.request.salaryYearMonth}
onChange={(value) => {
if (value === "") this.refs.weaError.showError();
this.handleRequestChange({ salaryYearMonth: value });
}}
/>
</WeaError>
</Col>
</Row>
<Row style={{ marginBottom: "10px" }}>
<Col span={8}>薪资账套</Col>
<Col span={16}>
{
this.state.inited &&
<WeaError
style={{ width: "100%" }}
tipPosition="bottom"
ref="weaError1"
error="请选择薪资账套">
<WeaSelect
viewAttr={3}
value={this.state.request.salarySobId}
style={{ width: "100%" }}
options={
_.isEmpty(importLedgerList) ? [{ key: "", showname: "" }] :
[{ key: "", showname: "" }, ..._.map(importLedgerList, it => ({
key: it.id,
showname: it.content
}))]
}
onChange={(value) => {
if (value === "") this.refs.weaError1.showError();
this.handleRequestChange({ salarySobId: value });
}}/>
</WeaError>
}
</Col>
</Row>
<Row style={{ marginBottom: "10px" }}>
<Col span={8}>备注</Col>
<Col span={16}>
<WeaInput style={{ width: "100%" }} value={this.state.request.description} onChange={(value) => {
this.handleRequestChange({ description: value });
}}/>
</Col>
</Row>
<SelectItemModal
onShowChecked={(value) => {
this.props.onShowChecked(value);
}}
onRestoreDefault={() => {
this.props.onRestoreDefault();
}}
onSetDefault={() => {
this.props.onSetDefault();
}}
onSearch={(value) => {
this.props.onSearch(value);
}}
onSave={(value) => {
this.props.onSave(value);
}}
visible={this.state.headerSetVisible} onCancel={() => this.setState({ headerSetVisible: false })}>
<SelectItemsWrapper items={this.props.items} title={"考勤模块"} onChange={(value) => {
this.props.onChange(value);
}}/>
</SelectItemModal>
</WeaDialog>
);
}
}

View File

@ -0,0 +1,131 @@
/*
* Author: 黎永顺
* name: 社保福利方案-自定义福利表格
* Description:
* Date: 2023/3/2
*/
import React, { Component } from "react";
import { WeaCheckbox, WeaTable } from "ecCom";
import { message, Modal } from "antd";
import { getCustomCategoryList, updateCustomCategoryStatus } from "../../../apis/welfareScheme";
class CustomBenefitsTable extends Component {
constructor(props) {
super(props);
this.state = {
loading: {
query: false
},
dataSource: [],
columns: [],
pageInfo: {
current: 1,
pageSize: 10,
total: 0
}
};
}
componentDidMount() {
this.getCustomCategoryList();
}
getCustomCategoryList = (extraPayload) => {
const { loading, pageInfo } = this.state;
const { welfareTypeEnum } = this.props;
const module = { welfareTypeEnum, ...pageInfo, ...extraPayload };
this.setState({ loading: { ...loading, query: true } });
getCustomCategoryList(module).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } });
if (status) {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource,
columns
});
}
}).catch(() => this.setState({ loading: { ...loading, query: false } }));
};
getColumns = () => {
const { columns } = this.state;
const { showOperateBtn, onCustomEdit } = this.props;
return [..._.map(_.filter(columns, item => !!item.display), child => ({
...child,
render: (text, record) => {
switch (child.dataIndex) {
case "isUse":
return (
<WeaCheckbox
value={text} display="switch" disabled={!showOperateBtn}
onChange={value => this.handleCustomBenefitsSwitch(record, value)}
/>
);
default:
return <div dangerouslySetInnerHTML={{ __html: text }}/>;
}
}
})), {
title: "操作",
width: 120,
dataIndex: "operate",
render: (_, record) => {
return (
<div className="linkWapper">
{showOperateBtn &&
<a href="javascript: void(0);" onClick={() => onCustomEdit(record)}>编辑</a>
}
</div>
);
}
}];
};
handleCustomBenefitsSwitch = ({ id }, isUse) => {
Modal.confirm({
title: "信息确认",
content: `确认要${isUse ? "启用" : "停用"}`,
onOk: () => {
const payload = { id, isUse };
updateCustomCategoryStatus(payload).then(({ status, errormsg }) => {
if (status) {
message.success("操作成功");
this.getCustomCategoryList();
} else {
message.error(errormsg || "操作失败");
}
});
}
});
};
render() {
const { dataSource, pageInfo, loading } = this.state;
const pagination = {
...pageInfo,
showTotal: total => `${total}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.getCustomCategoryList());
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getCustomCategoryList());
}
};
return (
<WeaTable
columns={this.getColumns()}
dataSource={dataSource}
pagination={pagination}
loading={loading.query}
/>
);
}
}
export default CustomBenefitsTable;

View File

@ -16,11 +16,11 @@ export default class CustomNewModal extends React.Component {
const { programmeStore: { createSICategory, customRequest, updateCustomCategory } } = this.props;
if (!this.props.edit) { // 新增
createSICategory(customRequest).then(() => {
this.props.onCancel();
this.props.onCancel(true);
});
} else {
updateCustomCategory(customRequest).then(() => {
this.props.onCancel();
this.props.onCancel(true);
});
}
}

View File

@ -15,6 +15,7 @@ import CustomPaginationTable from "../../../components/customPaginationTable";
import TwoColContent from "../../../components/twoColContent";
import CopySchemaModal from "./copySchemaModal";
import "./index.less";
import CustomBenefitsTable from "./customBenefitsTable";
const WeaMobxTable = WeaTableNew.WeaTable;
@ -151,47 +152,6 @@ export default class Programme extends React.Component {
});
}
getCustomColumns = columns => {
const { taxAgentStore: { showOperateBtn } } = this.props;
let newColumns = [];
newColumns = columns.map(column => {
let newColumn = column;
newColumn.render = (text, record, index) => {
//前端元素转义
let valueSpan =
record[newColumn.dataIndex + "span"] !== undefined
? record[newColumn.dataIndex + "span"]
: record[newColumn.dataIndex];
switch (newColumn.dataIndex) {
case "operate":
return (
<a
href="javascript:void(0);"
onClick={() => {
this.onCustomEdit(record);
}}>
编辑
</a>
);
case "is_use":
return (
<Switch
disabled={!showOperateBtn}
checked={text == 1}
onChange={value => {
this.handleCategoryStatusChange(record, value);
}}
/>
);
default:
return <div dangerouslySetInnerHTML={{ __html: valueSpan }}/>;
}
};
return newColumn;
});
return newColumns;
};
onEdit(record) {
let id = record.id;
const { programmeStore } = this.props;
@ -226,14 +186,6 @@ export default class Programme extends React.Component {
});
};
onCustomOperatesClick(record, index, operate, flag) {
switch (operate.text.toString()) {
case "编辑": // 编辑
this.onCustomEdit(record);
break;
}
}
onCustomEdit = (record) => {
const {
programmeStore: { getCustomForm, setCustomNewVisible, setCustomRequest },
@ -249,11 +201,11 @@ export default class Programme extends React.Component {
customEdit: true
});
setCustomRequest({
insuranceName: record["insurance_name"],
insuranceName: record["insuranceName"],
id: record.id,
isUse: record.is_use,
paymentScope: record["payment_scope"].split(",").map(item => paymentScopeEnum[item]).join(","),
welfareType: welfareTypeEnum[record.welfare_type]
isUse: record.isUse,
paymentScope: record["paymentScope"].split(",").map(item => paymentScopeEnum[item]).join(","),
welfareType: welfareTypeEnum[record.welfareType]
});
};
@ -266,12 +218,10 @@ export default class Programme extends React.Component {
render() {
const { programmeStore, taxAgentStore: { showOperateBtn } } = this.props;
const { loading, hasRight, form, tableStore, getTableDatas } = programmeStore;
const { loading, hasRight, form, getTableDatas } = programmeStore;
const {
selectedKey,
setSelectedKey,
getCustomCategoryList,
customTableStore,
customSelectkey,
setCustomSelectkey,
requestParams,
@ -446,7 +396,7 @@ export default class Programme extends React.Component {
style={{ width: "150px" }}
onChange={v => {
setCustomSelectkey(v);
getCustomCategoryList(v);
this.customBenefitsTableRef.getCustomCategoryList({ curren: 1, welfareTypeEnum: v });
}}
/>}
</div>
@ -456,7 +406,6 @@ export default class Programme extends React.Component {
handleSlideClose();
if (v == "custom") {
// 自定义福利
getCustomCategoryList();
} else {
getTableDatas(v);
}
@ -467,13 +416,19 @@ export default class Programme extends React.Component {
{selectedKey == "custom"
? <TwoColContent
leftContent={
<WeaMobxTable // table内部做了loading加载处理页面就不需要再加了
comsWeaTableStore={tableStore} // table store
hasOrder={true} // 是否启用排序
needScroll={true} // 是否启用table内部列表滚动将自适应到父级高度
getColumns={this.getCustomColumns}
onOperatesClick={this.onCustomOperatesClick.bind(this)}
<CustomBenefitsTable
ref={dom => this.customBenefitsTableRef = dom}
showOperateBtn={showOperateBtn}
welfareTypeEnum={customSelectkey}
onCustomEdit={this.onCustomEdit}
/>
// <WeaMobxTable // table内部做了loading加载处理页面就不需要再加了
// comsWeaTableStore={tableStore} // table store
// hasOrder={true} // 是否启用排序
// needScroll={true} // 是否启用table内部列表滚动将自适应到父级高度
// getColumns={this.getCustomColumns}
// onOperatesClick={this.onCustomOperatesClick.bind(this)}
// />
}
rightContent={renderCustomRightContent()}
/>
@ -562,8 +517,9 @@ export default class Programme extends React.Component {
condition={formCondition}
form={form}
edit={this.state.customEdit}
onCancel={() => {
onCancel={(isRefresh) => {
setCustomNewVisible(false);
isRefresh && this.customBenefitsTableRef.getCustomCategoryList();
}}
/>}
</div>

View File

@ -1,484 +1,8 @@
import { action, observable, toJS } from "mobx";
import { message } from "antd";
import { WeaForm, WeaTableNew } from "comsMobx";
import { observable } from "mobx";
import { WeaForm } from "comsMobx";
import * as API from "../apis/attendance"; // 引入API接口文件
const { TableStore } = WeaTableNew;
export class AttendanceStore {
@observable tableStore = new TableStore(); // new table
@observable attendTableStore = new TableStore();
@observable form = new WeaForm(); // nrew 一个form
@observable condition = []; // 存储后台得到的form数据
@observable hasRight = true; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
@observable showSearchAd = false; // 高级搜索面板显示
@observable loading = true; // 数据加载状态
@observable step = 0;
@observable modalVisiable = false;
@observable slideVisiable = false;
@observable currentItem = {};
@observable currentItemOperate = "add";
@observable fieldSettingAttendList = []; // 表头考勤列表
@observable fieldSettingCustomList = []; // 表头自定义列表
requestFeildAttendList = []; // 请求数据
requestFeildCustomList = []; // 请求数据
// 考勤字段
@observable fieldDataSource = []; // 字段列表
@observable fieldTableStore = new TableStore(); // new Table
@observable fieldPageInfo = {};
// 考勤数据列表
@observable attendanceDataSource = [];
@observable attendancePageInfo = {};
@observable attendanceColumns = [];
// 导入
@observable importLedgerList = []; // 表单-账套列表
@observable previewAttendQuoteList = []; // 导入-预览列表
@observable previewAttendQuoteColumns = []; // 导入预览-列表对应列
@observable previewAttendQuoteDataSource = []; // 导入预览-列表
@observable importResult = {};
// 考勤数据详情
@observable attendQuoteDetailPageInfo = {}; // 详情列表分页数据
@observable attendQuoteDetailTableStore = new TableStore(); // 详情列表表头数据
@observable cycle = {};
// ** 设置导入参数 start **
@action
setPreviewAttendQuoteColumns = previewAttendQuoteColumns => {
this.previewAttendQuoteColumns = previewAttendQuoteColumns;
};
@action
setPreviewAttendQuoteDataSource = previewAttendQuoteDataSource => {
this.previewAttendQuoteDataSource = previewAttendQuoteDataSource;
};
@action
setImportResult = importResult => {
this.importResult = importResult;
};
// ** 设置导入参数 end **
@action
searchFieldSettingList = value => {
if (value != "") {
let requestFeildAttendList = [...this.requestFeildAttendList];
this.fieldSettingAttendList = requestFeildAttendList.filter(
item => item.name.indexOf(value) > -1
);
let requestFeildCustomList = [...this.requestFeildCustomList];
this.fieldSettingCustomList = requestFeildCustomList.filter(
item => item.name.indexOf(value) > -1
);
} else {
this.fieldSettingAttendList = [...this.requestFeildAttendList];
this.fieldSettingCustomList = [...this.requestFeildCustomList];
}
};
@action
setFieldSettingAttendList = fieldSettingAttendList => {
this.fieldSettingAttendList = fieldSettingAttendList;
let requestFeildAttendList = [...this.requestFeildAttendList];
requestFeildAttendList.map(item => {
this.fieldSettingAttendList.map(inner => {
if (inner.id == item.id && inner.checked != item.checked) {
item.checked = inner.checked;
}
});
});
this.requestFeildAttendList = requestFeildAttendList;
};
@action
setFieldSettingCustomList = fieldSettingCustomList => {
this.fieldSettingCustomList = fieldSettingCustomList;
let requestFeildCustomList = [...this.requestFeildCustomList];
requestFeildCustomList.map(item => {
this.fieldSettingCustomList.map(inner => {
if (inner.id == item.id && inner.checked != item.checked) {
item.checked = inner.checked;
}
});
});
};
@action setCurrentItem = currentItem => (this.currentItem = currentItem);
@action
setCurrentItemOperate = currentItemOperate =>
(this.currentItemOperate = currentItemOperate);
@action
setSlideVisiable = slideVisiable => (this.slideVisiable = slideVisiable);
@action setStep = step => (this.step = step);
@action
setModalVisiable = modalVisiable => (this.modalVisiable = modalVisiable);
// 初始化操作
@action
doInit = (params = {}) => {
// this.getCondition();
// this.getTableDatas();
this.getAttendanceList(params);
// this.getAttendanceFieldSettingList({sourceType:'IMPORT'})
};
// 获得高级搜索表单数据
@action
getCondition = () => {
API.getCondition().then(
action(res => {
if (res.api_status) {
// 接口请求成功/失败处理
this.condition = res.condition;
this.form.initFormFields(res.condition); // 渲染高级搜索form表单
} else {
message.error(res.errormsg || "接口调用失败!");
}
})
);
};
// 渲染table数据
@action
getTableDatas = params => {
this.loading = true;
const formParams = this.form.getFormParams() || {};
params = params || formParams;
API.getTableDatas(params).then(
action(res => {
if (res.api_status) {
// 接口请求成功/失败处理
this.tableStore.getDatas(res.datas); // table 请求数据
this.hasRight = res.hasRight;
} else {
message.error(res.errormsg || "接口调用失败!");
}
this.loading = false;
})
);
};
@action setShowSearchAd = bool => (this.showSearchAd = bool);
// 高级搜索 - 搜索
@action
doSearch = () => {
this.getTableDatas();
this.showSearchAd = false;
};
// 字段列表
@action
getAttendanceFieldList = params => {
this.loading = true;
API.getAttendanceFieldList(params).then(res => {
if (res.status) {
// 接口请求成功/失败处理
this.fieldTableStore.getDatas(res.data.dataKey.datas); // table 请求数据
this.fieldDataSource = res.data.pageInfo.list;
this.fieldPageInfo = res.data.pageInfo;
} else {
message.error(res.errormsg || "接口调用失败!");
}
this.loading = false;
});
};
@action
saveAttendanceField = params => {
return new Promise((resolve, reject) => {
API.saveAttendanceField(params).then(res => {
if (res.status) {
message.success("保存成功");
resolve();
} else {
message.error(res.errormsg || "保存失败");
reject();
}
});
});
};
@action
deleteAttendanceField = params => {
API.deleteAttendanceField(params).then(res => {
if (res.status) {
message.success("删除成功");
} else {
message.error(res.errormsg || "删除失败");
}
});
};
// 批量删除
@action
doBatchDelete = () => {
let ids = toJS(this.tableStore.selectedRowKeys);
if (ids.length == 0) {
message.warning("未选择任何条目");
return;
}
API.deleteAttendanceField(this.tableStore.selectedRowKeys).then(res => {
if (res.status) {
message.success("删除成功");
} else {
message.error(res.errormsg || "删除失败");
}
});
};
// 更新
@action
updateAttendanceField = params => {
API.updateAttendanceField(params).then(res => {
if (res.status) {
message.success("修改成功");
} else {
message.error(res.errormsg || "修改失败");
}
});
};
// 更新状态
@action
updateAttendanceFieldStatus = params => {
return API.updateAttendanceFieldStatus(params).then(res => {
if (res.status) {
message.success("修改成功");
return new Promise((resolve, reject) => {
resolve(true);
});
} else {
message.error(res.errormsg || "修改失败");
return new Promise((resolve, reject) => {
resolve(false);
});
}
});
};
// 考勤数据列表
@action
getAttendanceList = params => {
this.loading = true;
API.getAttendanceList(params).then(res => {
if (res.status) {
// 接口请求成功/失败处理
// this.attendTableStore.getDatas(res.data.datas); // table 请求数据
this.attendanceDataSource = res.data.list;
this.attendancePageInfo = res.data;
this.attendanceColumns = res.data.columns;
} else {
message.error(res.errormsg || "接口调用失败!");
}
this.loading = false;
});
};
// 删除考勤列表数据
@action
deleteAttendance = params => {
return API.deleteAttendance(params);
};
//数据采集-考勤引用-考勤引用字段设置-列表
@action
getAttendanceFieldSettingList = params => {
this.loading = true;
API.getAttendanceFieldSettingList(params).then(res => {
if (res.status) {
this.requestFeildAttendList = res.data[0] ? res.data[0].items : [];
this.fieldSettingAttendList = this.requestFeildAttendList;
this.requestFeildCustomList = res.data[1] ? res.data[1].items : [];
this.fieldSettingCustomList = this.requestFeildCustomList;
} else {
message.error(res.errormsg || "接口调用失败!");
}
this.loading = false;
});
};
//数据采集-考勤引用-考勤引用字段设置-保存
@action
saveAttendanceFieldSetting = (sourceType = "IMPORT") => {
let attendList = this.requestFeildAttendList.map(item => ({
id: item.id,
checked: item.checked
}));
let customList = this.requestFeildCustomList.map(item => ({
id: item.id,
checked: item.checked
}));
let request = {
sourceType: sourceType,
currentSettingFields: [...attendList, ...customList]
};
API.saveAttendanceFieldSetting(request).then(res => {
if (res.status) {
message.success("保存成功");
} else {
message.error(res.errormsg || "保存失败");
}
});
};
//数据采集-考勤引用-考勤引用字段设置-恢复默认设置
@action
returnToAttendanceFieldSettingDefault = (sourceType = "IMPORT") => {
API.returnToAttendanceFieldSettingDefault({
sourceType: sourceType
}).then(res => {
if (res.status) {
this.requestFeildAttendList = res.data[0] ? res.data[0].items : [];
this.fieldSettingAttendList = this.requestFeildAttendList;
this.requestFeildCustomList = res.data[1] ? res.data[1].items : [];
this.fieldSettingCustomList = this.requestFeildCustomList;
} else {
message.error(res.errormsg || "获取数据失败");
}
});
};
//数据采集-考勤引用-考勤引用字段设置-设为默认设置
@action
saveAttendanceFieldSettingAsDefault = (sourceType = "IMPORT") => {
let attendList = this.requestFeildAttendList.map(item => ({
id: item.id,
checked: item.checked
}));
let customList = this.requestFeildCustomList.map(item => ({
id: item.id,
checked: item.checked
}));
let request = {
sourceType: sourceType,
currentSettingFields: [...attendList, ...customList]
};
API.saveAttendanceFieldSettingAsDefault(request).then(res => {
if (res.status) {
message.success("设置成功");
} else {
message.error(res.errormsg || "设置失败");
}
});
};
// 导入表单-账套列表
@action
getLedgerList = () => {
return new Promise((resolve, reject) => {
API.getLedgerList({}).then(res => {
if (res.status) {
this.importLedgerList = res.data;
resolve(this.importLedgerList);
} else {
message.error(res.errormsg || "获取失败");
reject();
}
});
});
};
// 下载导入模板
@action
downloadTemplate = (salaryYearMonth, salarySobId) => {
API.downloadTemplate(salaryYearMonth, salarySobId);
};
// 导入预览
@action
previewAttendQuote = params => {
API.previewAttendQuote(params).then(res => {
if (res.status) {
this.previewAttendQuoteList = res.data;
this.previewAttendQuoteColumns = res.data.headers.map((item, index) => {
let column = {};
column.title = item;
column.dataIndex = "" + index;
column.key = index + "";
return column;
});
this.previewAttendQuoteDataSource = res.data.list.map(item => {
let data = {};
item.map((i, index) => {
data[index + ""] = i;
});
return data;
});
} else {
message.error(res.errormsg || "获取失败");
}
});
};
// 考勤导入
@action
importAttendQuoteData = params => {
API.importAttendQuoteData(params).then(res => {
if (res.status) {
this.importResult = res.data;
} else {
message.error(res.errormsg || "导入失败");
}
});
};
// 考勤数据详情
@action
viewAttendQuote = (params = {}) => {
API.viewAttendQuote(params).then(res => {
if (res.status) {
this.attendQuoteDetailPageInfo = res.data.pageInfo;
this.attendQuoteDetailTableStore.getDatas(res.data.dataKey.datas);
} else {
message.error(res.errormsg || "获取失败");
}
});
};
// 考勤引用同步
@action
syncAttendanceRefer = params => {
return new Promise((resolve, reject) => {
API.syncAttendanceRefer(params).then(res => {
if (res.status) {
message.success("同步成功");
resolve();
} else {
message.error(res.errormsg || "同步失败");
reject();
}
});
});
};
// 考勤引用同步
@action
checkOperation = params => {
return API.checkOperation(params);
};
// 根据所属月和账套获取周期
@action
getSalaryCycleAndAttendCycle = (salaryYearMonthStr, salarySobId) => {
API.getSalaryCycleAndAttendCycle({
salaryYearMonthStr,
salarySobId
}).then(res => {
if (res.status) {
this.cycle = res.data;
} else {
message.error(res.errormsg || "获取失败");
}
});
};
@observable form = new WeaForm();
@observable refenceform = new WeaForm();
}

View File

@ -120,7 +120,6 @@ export class ProgrammeStore {
params.welfareTypeEnum = selectKey;
API.getCustomCategoryList(params).then(action(res => {
if (res.status) { // 接口请求成功/失败处理
this.tableStore.getDatas(res.data.datas, 1); // table 请求数据
} else {
message.error(res.errormsg || "接口调用失败!");
}
@ -294,7 +293,6 @@ export class ProgrammeStore {
if (res.status) {
message.success("新增成功");
resolve();
this.getCustomCategoryList();
} else {
reject();
message.error(res.errormsg || "新增失败");
@ -331,7 +329,6 @@ export class ProgrammeStore {
if (res.status) {
message.success("编辑成功");
resolve();
this.getCustomCategoryList();
} else {
reject();
message.error(res.errormsg || "编辑失败");