diff --git a/pc4mobx/hrmSalary/apis/attendance.js b/pc4mobx/hrmSalary/apis/attendance.js
index f528ce12..d4a2b304 100644
--- a/pc4mobx/hrmSalary/apis/attendance.js
+++ b/pc4mobx/hrmSalary/apis/attendance.js
@@ -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());
};
diff --git a/pc4mobx/hrmSalary/apis/welfareScheme.js b/pc4mobx/hrmSalary/apis/welfareScheme.js
index d0e0b11c..e7d1f3e7 100644
--- a/pc4mobx/hrmSalary/apis/welfareScheme.js
+++ b/pc4mobx/hrmSalary/apis/welfareScheme.js
@@ -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', {
diff --git a/pc4mobx/hrmSalary/components/importModal/headerSet.js b/pc4mobx/hrmSalary/components/importModal/headerSet.js
index e51047b1..41fe75a7 100644
--- a/pc4mobx/hrmSalary/components/importModal/headerSet.js
+++ b/pc4mobx/hrmSalary/components/importModal/headerSet.js
@@ -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 (
-
-
-
-
-
- )
- }
-}
\ No newline at end of file
+ render() {
+ return (
+
+
+ {/**/}
+ {/**/}
+
+ );
+ }
+}
diff --git a/pc4mobx/hrmSalary/components/importModal/index.js b/pc4mobx/hrmSalary/components/importModal/index.js
index 8e47ef9a..012c113f 100644
--- a/pc4mobx/hrmSalary/components/importModal/index.js
+++ b/pc4mobx/hrmSalary/components/importModal/index.js
@@ -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={
diff --git a/pc4mobx/hrmSalary/components/importModal/index.less b/pc4mobx/hrmSalary/components/importModal/index.less
index d472ab37..64c95083 100644
--- a/pc4mobx/hrmSalary/components/importModal/index.less
+++ b/pc4mobx/hrmSalary/components/importModal/index.less
@@ -1,7 +1,5 @@
.importModalWrapper {
- .wea-dialog-body {
- height: 80vh;
- overflow: hidden auto;
+ .ant-modal-body {
padding: 16px;
}
diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/index.js b/pc4mobx/hrmSalary/components/selectItemsModal/index.js
index 27cc02a7..b7d01a5d 100644
--- a/pc4mobx/hrmSalary/components/selectItemsModal/index.js
+++ b/pc4mobx/hrmSalary/components/selectItemsModal/index.js
@@ -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 = (
-
- );
+ const { searchValue } = this.state;
+ const {
+ title, onSearchItemSet, onShowOnlyChecked, children,
+ onMoreOpts, onSave, ...extra
+ } = this.props;
+ const btns = [];
+ const moreBtn = {
+ datas: [
+ {
+ key: "recovery",
+ content: "恢复默认设置",
+ icon: ,
+ onClick: key => onMoreOpts(key)
+ },
+ {
+ key: "setting",
+ content: "设为默认设置",
+ icon: ,
+ onClick: key => onMoreOpts(key)
+ }
+ ]
+ };
+ const titleComp =
+ {title}
+ this.setState({ searchValue })}
+ placeholder="请输入关键字" style={{ width: 200 }}
+ onSearch={onSearchItemSet}
+ />
+
;
+ const bottomLeft = ;
return (
- {
- this.props.onSave();
- }}>保存,
- 更多
- ]}
+
-
- {
- this.setState({ searchValue: value });
- }}
- onSearch={(value) => {
- this.props.onSearch(value);
- }}
- />
-
- {this.props.children}
-
- {
- this.handleShowChecked(value);
- }}/>
-
+ {children}
);
}
diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/index.less b/pc4mobx/hrmSalary/components/selectItemsModal/index.less
new file mode 100644
index 00000000..6486a98c
--- /dev/null
+++ b/pc4mobx/hrmSalary/components/selectItemsModal/index.less
@@ -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;
+ }
+ }
+}
diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js
index b29f38b8..1a0d44d0 100644
--- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js
+++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js
@@ -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
+ onSelectGroupAll(groupId, val)}/>
+ 已选择{number}个字段
+
;
+ };
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 (
-
-
-
{this.props.title}} onChange={(value) => {
- this.handleAllChecked(value);
- }} value={this.state.checkStatus}/>
-
this.setState({
- showContent: !this.state.showContent
- })}>已选中{this.props.items ? this.props.items.filter(item => item.checked).length : 0}个字段
-
- {
- this.state.showContent ? :
- }
-
-
-
+
{
- this.state.showContent &&
-
- {
- this.props.items && this.props.items.map(item => (
- {
- this.handleItemChange(value, item);
- }}/>
- ))
- }
-
-
+ _.map(setItemList, item => {
+ const { items } = item;
+ return
+
+ {
+ _.isEmpty(items) ?
+
暂无数据 :
+
+ {
+ _.map(items, child => {
+ const { name, checked, id } = child;
+ return -
+ onSelectItem(id, val)}
+ />
+
;
+ })
+ }
+
+ }
+
+ ;
+ })
}
-
-
+
);
}
}
+
+export default SelectItemsWrapper;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js
index 338aa6a3..dc082d76 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js
@@ -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
- }
- },
- {
- 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
+ }
];
-
-
-
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js
new file mode 100644
index 00000000..0bbc46f0
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js
@@ -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 = [
+
+ ];
+ return (
+
+ {getSearchs(form, conditions, 1)}
+
+ );
+ }
+}
+
+export default AttendanceCustomFieldsModal;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js
new file mode 100644
index 00000000..6f58700a
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js
@@ -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) => {moment(text).format("YYYY-MM")}
+ };
+ }
+ 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: 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 (
+
+ {
+ return (
+
+ );
+ }
+ }
+ ]}
+ dataSource={dataSource}
+ pagination={pagination}
+ loading={loading.query}
+ />
+ {/* 考勤引用导入 */}
+ this.handleHeaderSettings({ sourceType: "IMPORT" })}/>}
+ renderFormComponent={() =>
+ }
+ />
+ {/* 表头设置 */}
+
+ {/* 考勤数据引用 */}
+
+ {/* 考勤数据查看 */}
+ this.setState({
+ attendanceViewPayload: {
+ ...attendanceViewPayload,
+ visible: false,
+ attendQuoteId: ""
+ }
+ })}
+ />
+
+ );
+ }
+}
+
+export default AttendanceDataComp;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js
new file mode 100644
index 00000000..b692e31e
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js
@@ -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 ([
+
+ {showOperateBtn && }
+ this.setState({ keyword })}
+ onSearch={() => this.viewAttendQuote({ current: 1 }, this.props)}
+ />
+
+ ]);
+ };
+ 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 (
+
+ }
+ content={
+
+
+
+
+ ({
+ ...item,
+ render: (text) => {
+ return {text} ;
+ }
+ }))}
+ dataSource={dataSource}
+ pagination={pagination}
+ loading={loading.query}
+ xWidth={columns.length * 120}
+ />
+
+ }
+ />
+ );
+ }
+}
+
+export default AttendanceDataViewSlide;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js
new file mode 100644
index 00000000..2308b556
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js
@@ -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: 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 = [
+ ,
+
+ ];
+ return (
+
+ {getSearchs(refenceform, condition, 1)}
+ {/* 表头设置 */}
+
+
+ );
+ }
+}
+
+export default AttendanceRefrenceDataModal;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js
new file mode 100644
index 00000000..687c6482
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js
@@ -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 (
+ this.handleAttendanceFieldSwitch(record, value)}
+ />
+ );
+ default:
+ return ;
+ }
+ }
+ }));
+ };
+
+ 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 (
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default FieldMangComp;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/importFormOptions.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/importFormOptions.js
new file mode 100644
index 00000000..f16d18f3
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/importFormOptions.js
@@ -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 (
+
+
+
+ );
+};
+
+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 (
+
+ );
+ }
+}
+
+export default ImportFormOptions;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less
new file mode 100644
index 00000000..6e340057
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less
@@ -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;
+ }
+ }
+}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js
deleted file mode 100644
index 95bb437e..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js
+++ /dev/null
@@ -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 (
-
-
- {this.props.salaryYearMonth != "" &&
-
- 考勤周期: {this.props.salaryYearMonth}
-
}
-
-
-
-
-
- );
- }
-}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.less b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.less
deleted file mode 100644
index fd7858c8..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.less
+++ /dev/null
@@ -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;
- }
- }
-}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/headerSetModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/headerSetModal.js
deleted file mode 100644
index c8ee03f1..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/headerSetModal.js
+++ /dev/null
@@ -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 (
-
-
-
- )
- }
-}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js
index 3b4727bd..4e5d734f 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js
@@ -1,921 +1,116 @@
-import React from "react";
+/*
+ * Author: 黎永顺
+ * name: 考情引用
+ * Description:
+ * Date: 2023/2/23
+ */
+import React, { Component } from "react";
import { inject, observer } from "mobx-react";
-import { Button, Col, DatePicker, Dropdown, Menu, message, Modal, Row, Switch } from "antd";
-import { WeaDatePicker, WeaInputSearch, WeaNewScroll, WeaSelect, WeaSlideModal, WeaTop } from "ecCom";
+import { Button, DatePicker } from "antd";
+import { WeaFormItem, WeaNewScroll, WeaTab } from "ecCom";
+import AttendanceDataComp from "./components/attendanceDataComp";
+import FieldMangComp from "./components/fieldMangComp";
import moment from "moment";
-import { renderNoright } from "../../../util";
-import CustomTab from "../../../components/customTab";
-import { columns } from "./columns";
-import ImportModal from "../../../components/importModal";
-import HeaderSet from "../../../components/importModal/headerSet";
-import SelectItemModal from "../../../components/selectItemsModal";
-import RefereAttendFormModal from "./refereAttendFormModal";
-import SelectItemsWrapper from "../../../components/selectItemsModal/selectItemsWrapper";
-import SlideModalTitle from "../../../components/slideModalTitle";
-import EditSlideContent from "./editSlideContent";
-import TwoColContent from "../../../components/twoColContent";
-import TipLabel from "../../../components/TipLabel";
-import ItemMangeFormModal from "./itemMangeFormModal";
-import CustomPaginationTable from "../../../components/customPaginationTable";
-import "../otherDeduct/index.less";
+import "./index.less";
-const MonthPicker = DatePicker.MonthPicker;
+const { MonthPicker } = DatePicker;
-@inject("attendanceStore", "taxAgentStore")
+@inject("taxAgentStore")
@observer
-export default class Attendance extends React.Component {
+class Index extends Component {
constructor(props) {
super(props);
- columns.map(item => {
- if (item.key == "cz") {
- item.render = (text, record) => {
- return (
-
- );
- };
- }
- });
this.state = {
- value: "",
- selectedKey: "0",
- searchValue: "",
- modalParam: {
- salarySobId: "",
- salaryYearMonth: moment(new Date()).format("YYYY-MM") // 薪资所属月
- },
- modalVisiable: false,
- selectItemVisible: false,
- refereAttendFormVisible: false,
- tabSelectedKey: "0",
- itemMangeVisible: false,
- itemMangeValue: {},
fieldName: "",
- fieldSettingSearchValue: "",
- fieldCurrent: 1,
- inited: false
+ selectedKey: "DATA",
+ salaryMonth: []
};
- this.fieldSearch = {};
- this.listSearch = {
- salaryYearMonth: [moment(new Date()).startOf("year").format("YYYY-MM"), moment(new Date()).startOf("month").format("YYYY-MM")],
- current: 1
- };
- this.recordId = ""; // 考勤数据列表查看选择项
- this.salaryYearMonth = ""; // 考勤数据查看,当前数据的薪资所属月
- this.pageInfo = { current: 1, pageSize: 10 };
}
- componentWillMount() {
- const { attendanceStore: { doInit, getLedgerList } } = this.props;
- doInit(this.listSearch);
- getLedgerList().then(() => {
- this.setState({
- inited: true
- });
- });
- }
-
- onShowSlide() {
- const { attendanceStore: { setSlideVisiable } } = this.props;
- setSlideVisiable(true);
- }
-
- onItemEdit(record) {
- this.setState({
- itemMangeVisible: true
- });
-
- const {
- attendanceStore: { setCurrentItemOperate, setCurrentItem }
- } = this.props;
- setCurrentItemOperate("update");
- setCurrentItem(record);
- }
-
- // 字段列表分页
- handleFieldPageChange(value) {
- const { attendanceStore: { getAttendanceFieldList } } = this.props;
- this.fieldSearch.current = value;
- this.fieldSearch.pageSize = this.pageInfo.pageSize;
- getAttendanceFieldList(this.fieldSearch);
- }
-
- handleFieldShowSizeChange(pageInfo) {
- const { attendanceStore: { getAttendanceFieldList } } = this.props;
- this.fieldSearch.current = pageInfo;
- getAttendanceFieldList({ ...this.fieldSearch, ...pageInfo });
- }
-
- // 列表
- handleDataPageChange(value) {
- const { attendanceStore: { getAttendanceList } } = this.props;
- this.listSearch.current = value;
- getAttendanceList(this.listSearch);
- }
-
- handleDataShowSizeChange(pageInfo) {
- const { attendanceStore: { getAttendanceList } } = this.props;
- getAttendanceList({ ...this.listSearch, ...pageInfo });
- }
-
- // 下载导入模板链接点击
- handleTemplateLinkClick() {
- const { attendanceStore: { downloadTemplate } } = this.props;
- const { modalParam: { salarySobId, salaryYearMonth } } = this.state;
- if (!salaryYearMonth || salaryYearMonth == "") {
- message.warning("薪资所属月不能为空");
- return;
- }
-
- if (!salarySobId || salarySobId == "") {
- message.warning("薪资账套不能为空");
- return;
- }
- downloadTemplate(salaryYearMonth, salarySobId);
- }
-
- // 导入预览
- handlePreviewImport(params) {
- const { attendanceStore: { previewAttendQuote } } = this.props;
- previewAttendQuote(params);
- }
-
- // 考勤导入
- handleImport(params) {
- const { attendanceStore: { importAttendQuoteData } } = this.props;
- importAttendQuoteData(params);
- }
-
- // 导入完成
- handleFinish() {
- this.setState({ modalVisiable: false });
- const { attendanceStore: { getAttendanceList, step } } = this.props;
- if (step === 2) {
- getAttendanceList({ ...this.pageInfo });
- }
- }
-
- // 考情引用的列
- getColumns(columns) {
- const {
- attendanceStore: { deleteAttendance, doInit },
- taxAgentStore: { showOperateBtn }
- } = this.props;
- let result = [...columns];
- result.push({
- title: "操作",
- key: "operate",
- render: (text, record) => {
- return (
-
-
this.handleViewAttendance(record)}>查看
- {showOperateBtn &&
-
{
- Modal.confirm({
- title: "信息确认",
- content: "确认删除",
- onOk: () => {
- deleteAttendance([
- record.id
- ]).then(({ status, errormsg }) => {
- if (status) {
- message.success("删除成功");
- doInit(this.listSearch);
- } else {
- message.error(errormsg || "删除失败");
- }
- });
- },
- onCancel: () => {
- }
- });
- }}>
- 删除
-
- }>
-
-
-
- }
-
- );
- }
- });
- return result;
- }
-
- // 查看考勤详情
- handleViewAttendance(record) {
- const { attendanceStore: { setSlideVisiable } } = this.props;
- this.recordId = record.id;
- this.salaryYearMonth = record.attendCycle;
- setSlideVisiable(true);
- }
-
- // 引用同步Cancel事件
- handleRefereCancel() {
- this.setState({ refereAttendFormVisible: false });
- const { attendanceStore: { getAttendanceList } } = this.props;
- this.listSearch.current = 1;
- getAttendanceList(this.listSearch);
- }
-
- // 获取周期
- handleLoadCycle(month, sob) {
- if (!month || month == "") {
- return;
- }
- if (!sob || sob == "") {
- return;
- }
- const { attendanceStore: { getSalaryCycleAndAttendCycle } } = this.props;
- getSalaryCycleAndAttendCycle(month, sob);
- }
-
- // 初始导入参数
- handleInitImportModal() {
- const {
- attendanceStore: {
- setPreviewAttendQuoteColumns,
- setPreviewAttendQuoteDataSource,
- setImportResult
- }
- } = this.props;
- setPreviewAttendQuoteColumns([]);
- setPreviewAttendQuoteDataSource([]);
- setImportResult({});
- }
-
- // 引用详情列表搜索
- handleSearch(params) {
- const { attendanceStore: { viewAttendQuote } } = this.props;
- let request = { attendQuoteId: this.recordId, ...params };
- viewAttendQuote(request);
- }
-
- handleExportAttendQuote = () => {
- const url = `${window.location
- .origin}/api/bs/hrmsalary/attendQuote/export?attendQuoteId=${this
- .recordId}`;
- window.open(url, "_self");
- };
-
- handleChangeMonth = (type, val) => {
- const { attendanceStore: { getAttendanceList } } = this.props;
- this.listSearch.salaryYearMonth[type] = val && moment(val).format("YYYY-MM");
- !this.listSearch.salaryYearMonth[0] && (this.listSearch.salaryYearMonth[0] = moment(new Date()).startOf("year").format("YYYY-MM"));
- !this.listSearch.salaryYearMonth[1] && (this.listSearch.salaryYearMonth = this.listSearch.salaryYearMonth.filter(n => n));
- getAttendanceList(this.listSearch);
+ /*
+ * Author: 黎永顺
+ * Description: 考勤数据删选条件
+ * Params:
+ * Date: 2023/2/24
+ */
+ getAttendanceDataScreen = () => {
+ const { salaryMonth } = this.state;
+ const [value1 = "", value2 = ""] = salaryMonth;
+ return
+ {
+ return current && value2 && current.getTime() > new Date(value2).getTime();
+ }}
+ onChange={(val) => this.handleChangeSalaryMonth([val ? moment(val).format("YYYY-MM") : "", value2])}
+ />
+ 至
+ {
+ return current && value1 && current.getTime() < new Date(value1).getTime();
+ }}
+ onChange={(val) => this.handleChangeSalaryMonth([value1, val ? moment(val).format("YYYY-MM") : ""])}
+ />
+ ;
};
+ handleChangeSalaryMonth = (salaryMonth) => this.setState({ salaryMonth }, () => this.attendanceTableRef.getAttendanceList({ salaryYearMonth: _.compact(this.state.salaryMonth) }));
+ handleAddAttendFileds = () => this.fieldMangRef.handleTriggerAttendFileds();
+ handleImportAttendanceData= ()=>{
+ this.attendanceTableRef.handleImportAttendanceData({
+ visiable: true, params: {}, step: 0,
+ columns: [], slideDataSource: [], importResult: []
+ });
+ }
+ handleQuoteAttendanceData= ()=>{
+ this.attendanceTableRef.handleQuoteAttendanceData({
+ visible: true, title: "引用考勤数据"
+ });
+ }
render() {
- const { attendanceStore, taxAgentStore: { showOperateBtn } } = this.props;
- const { modalParam } = this.state;
- const { loading, hasRight, tableStore } = attendanceStore;
- const {
- step, setStep, setSlideVisiable, slideVisiable, doBatchDelete, searchFieldSettingList,
- fieldSettingAttendList, fieldSettingCustomList, setFieldSettingAttendList, setFieldSettingCustomList
- } = attendanceStore;
- const {
- getAttendanceFieldSettingList, saveAttendanceFieldSetting, fieldDataSource,
- fieldTableStore, fieldPageInfo, attendanceDataSource, attendanceColumns,
- attendancePageInfo, importLedgerList, previewAttendQuoteColumns, previewAttendQuoteDataSource,
- importResult, cycle
- } = attendanceStore;
-
- if (!hasRight && !loading) {
- // 无权限处理
- return renderNoright();
- }
-
- const rightMenu = [
- // 右键菜单
- // {
- // key: 'BTN_DEL',
- // icon: ,
- // content : '批量删除',
- // disable: selectedRowKeys.length === 0, // 没有选中禁用
- // onClick : batchDelete,
- // }
- ];
- const collectParams = {
- // 收藏功能配置
- favname: "考勤引用",
- favouritetype: 1,
- objid: 0,
- link: "wui/index.html#/ns_demo03/index",
- importantlevel: 1
- };
-
+ const { selectedKey, salaryMonth, fieldName } = this.state;
+ const { taxAgentStore: { showOperateBtn } } = this.props;
const topTab = [
- {
- title: "考勤数据",
- viewcondition: "0"
- },
- {
- title: "字段管理",
- viewcondition: "1"
- }
+ { title: "考勤数据", viewcondition: "DATA" },
+ { title: "字段管理", viewcondition: "FIELD" }
];
-
- const renderSearchOperationItem = () => {
- const { taxAgentStore: { showOperateBtn } } = this.props;
- return showOperateBtn
- ?
-
-
-
- : null;
- };
-
- const renderLeftOperation = () => {
- return (
-
- 薪资所属月:
- {
- return current && this.listSearch.salaryYearMonth[1] && current.getTime() > new Date(this.listSearch.salaryYearMonth[1]).getTime();
- }}
- format="YYYY-MM"
- onChange={(val) => this.handleChangeMonth("0", val)}
- />
- 至
- {
- return current && this.listSearch.salaryYearMonth[0] && current.getTime() < new Date(this.listSearch.salaryYearMonth[0]).getTime();
- }}
- format="YYYY-MM"
- onChange={(val) => this.handleChangeMonth("1", val)}
- />
-
- );
- };
-
- const renderHeaderSetCompoent = () => {
- return (
- {
- getAttendanceFieldSettingList({ sourceType: "IMPORT" });
- this.setState({
- selectItemVisible: true
- });
- }}
- />
- );
- };
-
- const renderFormComponent = () => {
- return (
-
-
-
- 薪资所属月:
-
- {
- this.setState({
- modalParam: { ...modalParam, salaryYearMonth: value }
- });
- this.handleLoadCycle(value, this.state.modalParam.salarySobId);
- }}
- />
-
-
-
- 薪资账套:
-
- {this.state.inited &&
- ({ key: it.id, showname: it.content }))] : [{
- key: "",
- showname: ""
- }]
- }
- onChange={value => {
- this.setState({
- modalParam: { ...modalParam, salarySobId: value }
- });
- this.handleLoadCycle(
- this.state.modalParam.salaryYearMonth,
- value
- );
- }}/>}
-
-
-
- 薪资周期:
-
- {cycle.salaryCycle}
-
-
-
- 考勤周期:
-
- {cycle.attendCycle}
-
-
- );
- };
-
- const renderCustomOperate = () => {
- return ([
-
- {showOperateBtn &&
-
- // 导出全部
- }
- {
- this.setState({ searchValue: v });
- }}
- onSearch={v => {
- this.handleSearch({ keyword: v });
- }}
- />
-
- ]);
- };
-
- const handleItemSearch = value => {
- const { attendanceStore: { getAttendanceFieldList } } = this.props;
- this.fieldSearch = { fieldName: value };
- getAttendanceFieldList(this.fieldSearch);
- };
-
- const handleNewClick = () => {
- const { attendanceStore: { setCurrentItemOperate } } = this.props;
- this.setState({ itemMangeVisible: true });
- setCurrentItemOperate("add");
- };
-
- const renderRightOperation = () => {
- return (
-
- {showOperateBtn &&
- }
- {
- this.setState({ fieldName: value });
- }}
- placeholder="请输入字段名称"
- onSearch={value => {
- this.setState({ fieldSettingSearchValue: value });
- handleItemSearch(value);
- }}
- />
-
- );
- };
-
- const menu = (
-
- );
-
- const handleTabChange = v => {
- const {
- attendanceStore: { getAttendanceFieldList, getAttendanceList }
- } = this.props;
- this.setState({
- tabSelectedKey: v
- });
-
- if (v == "1") {
- this.fieldSearch = { fieldName: this.state.fieldName };
- getAttendanceFieldList(this.fieldSearch);
- } else if (v == "0") {
- this.listSearch = {
- salaryYearMonth: []
- };
- getAttendanceList({});
- }
- };
-
- const handleSwitchItemChange = (record, value) => {
- const {
- attendanceStore: { updateAttendanceFieldStatus, getAttendanceFieldList }
- } = this.props;
- let request = {
- id: record.id,
- enableStatus: value
- };
- updateAttendanceFieldStatus(request).then(result => {
- this.fieldSearch = { fieldName: this.state.fieldName };
- getAttendanceFieldList(this.fieldSearch);
- });
- };
-
- // 字段Columns
- const getFieldColumns = columns => {
- let newColumns = columns.filter(item => item.hide == "false");
- newColumns = newColumns.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 "username":
- return (
- {
- this.onItemEdit(record);
- }}
- dangerouslySetInnerHTML={{ __html: valueSpan }}
- />
- );
- case "enableStatus":
- return (
- {
- handleSwitchItemChange(record, value);
- }}
- />
- );
- default:
- return ;
- }
- };
- return newColumn;
- });
- // 与e10保持一致,先去掉字段管理页面的操作列
- // newColumns.push({
- // title: "操作",
- // dataIndex: "operate",
- // render: (text, record) => {
- // return (
- // {this.onItemEdit(record)}}>查看明细
- // )
- // }
- // })
- return [
- // {
- // title: "序号",
- // dataIndex: "index",
- // width: 80,
- // render: (text, record, index) => {
- // const { current, pageSize } = this.pageInfo;
- // return (current - 1) * pageSize + index + 1;
- // }
- // },
- ...newColumns
- ];
- };
-
- // 保存回调
- const handleItemMangeSave = value => {
- const {
- attendanceStore: { saveAttendanceField, getAttendanceFieldList }
- } = this.props;
- value.fieldType = value.fieldType == "1" ? "NUMBER" : "TEXT";
- saveAttendanceField(value).then(() => {
- this.fieldSearch = { fieldName: this.state.fieldName };
- getAttendanceFieldList(this.fieldSearch);
- this.setState({ itemMangeVisible: false });
- });
- };
-
- const handleItemMangeUpdate = value => {
- const {
- attendanceStore: { updateAttendanceField, getAttendanceFieldList }
- } = this.props;
- value.fieldType = value.fieldType == "1" ? "NUMBER" : "TEXT";
- updateAttendanceField(value);
- this.fieldSearch = { fieldName: this.state.fieldName };
- getAttendanceFieldList(this.fieldSearch);
- this.setState({ itemMangeVisible: false });
- };
-
- const handleShowChecked = value => {
- const {
- attendanceStore: {
- fieldSettingAttendList,
- fieldSettingCustomList,
- setFieldSettingAttendList,
- setFieldSettingCustomList,
- searchFieldSettingList
- }
- } = this.props;
- if (value) {
- let attendList = [...fieldSettingAttendList];
- let customList = [...fieldSettingCustomList];
- setFieldSettingAttendList(
- attendList.filter(item => item.checked == value)
- );
- setFieldSettingCustomList(
- customList.filter(item => item.checked == value)
- );
- } else {
- searchFieldSettingList(this.state.fieldSettingSearchValue);
- }
- };
-
- const handleonRestoreDefault = (sourceType = "IMPORT") => {
- const {
- attendanceStore: { returnToAttendanceFieldSettingDefault }
- } = this.props;
- returnToAttendanceFieldSettingDefault(sourceType);
- };
-
- const handleSetDefault = (sourceType = "IMPORT") => {
- const {
- attendanceStore: { saveAttendanceFieldSettingAsDefault }
- } = this.props;
- saveAttendanceFieldSettingAsDefault(sourceType);
- };
-
- const handleRefereHeaderSet = () => {
- const { attendanceStore: { getAttendanceFieldSettingList } } = this.props;
- getAttendanceFieldSettingList({ sourceType: "QUOTE" });
- };
-
+ const buttons = selectedKey === "DATA" ? [
+ ,
+
+ ] : [];
return (
-
-
} // 左侧图标
- iconBgcolor="#F14A2D" // 左侧图标背景色
- showDropIcon={false} // 是否显示下拉按钮
- dropMenuDatas={rightMenu} // 下拉菜单(和页面的右键菜单相同)
- dropMenuProps={{ collectParams }}>
- {this.state.tabSelectedKey == 0
- ?
-
{
- this.pageInfo = { current: 1, pageSize: 10 };
- handleTabChange(v);
- }}
- />
- {
- }}
- />
-
-
- {
- this.pageInfo.current = value;
- this.handleDataPageChange(value);
- }}
- onShowSizeChange={(current, pageSize) => {
- this.pageInfo = { current, pageSize };
- this.handleDataShowSizeChange(this.pageInfo);
- }}
- />
-
-
-
- :
- {
- this.setState({
- tabSelectedKey: v
- }, () => {
- this.pageInfo = { current: 1, pageSize: 10 };
- });
- }}
- />
-
-
- {
- this.pageInfo.current = value;
- this.handleFieldPageChange(value);
- }}
- onShowSizeChange={(current, pageSize) => {
- this.pageInfo = { current, pageSize };
- this.handleFieldShowSizeChange(this.pageInfo);
- }}
- />
-
-
- }
- rightContent={
-
- }
- />
-
}
-
- {
- this.handleInitImportModal();
- }}
- params={this.state.modalParam}
- columns={previewAttendQuoteColumns}
- step={step}
- setStep={setStep}
- slideDataSource={previewAttendQuoteDataSource}
- importResult={importResult}
- onFinish={() => {
- this.handleFinish();
- }}
- previewImport={params => {
- this.handlePreviewImport(params);
- }}
- importFile={params => {
- this.handleImport(params);
- }}
- headerSetCompoent={renderHeaderSetCompoent()}
- templateLink={() => {
- this.handleTemplateLinkClick();
- }}
- renderFormComponent={() => renderFormComponent()}
- visiable={this.state.modalVisiable}
- onCancel={() => {
- this.handleFinish();
- }}
+
+
this.setState({ selectedKey: v })}
+ searchsBaseValue={fieldName} onSearchChange={fieldName => this.setState({ fieldName })}
+ onSearch={() => this.fieldMangRef.getAttendanceFieldList({ fieldName, current: 1 })}
/>
-
- {
- handleonRestoreDefault();
- }}
- onSetDefault={() => {
- handleSetDefault();
- }}
- onSave={() => {
- saveAttendanceFieldSetting();
- }}
- onShowChecked={value => {
- handleShowChecked(value);
- }}
- onSearch={value => {
- searchFieldSettingList(value);
- }}
- visible={this.state.selectItemVisible}
- onCancel={() => this.setState({ selectItemVisible: false })}>
-
- {
- setFieldSettingAttendList(value);
- }}
- items={fieldSettingAttendList}
- title="考勤模块"
- />
- {
- setFieldSettingCustomList(value);
- }}
- items={fieldSettingCustomList}
- title={"自定义"}
- />
-
-
-
- {this.state.refereAttendFormVisible &&
- {
- saveAttendanceFieldSetting("QUOTE");
- }}
- onRestoreDefault={() => {
- handleonRestoreDefault("QUOTE");
- }}
- onSetDefault={() => {
- handleSetDefault("QUOTE");
- }}
- onShowChecked={value => {
- handleShowChecked(value);
- }}
- onSearch={value => {
- searchFieldSettingList(value);
- }}
- onChange={value => {
- setFieldSettingAttendList(value);
- }}
- items={fieldSettingAttendList}
- onHeaderSet={() => {
- handleRefereHeaderSet();
- }}
- visible={this.state.refereAttendFormVisible}
- onCancel={() => {
- this.handleRefereCancel();
- }}
- />}
- {this.state.itemMangeVisible &&
- {
- handleItemMangeUpdate(value);
- }}
- onSave={value => handleItemMangeSave(value)}
- onCancel={() => {
- this.setState({ itemMangeVisible: false });
- }}
- />}
- {slideVisiable &&
-
+ {
+ selectedKey === "DATA" && this.getAttendanceDataScreen()
+ }
+
+
+ {
+ selectedKey === "DATA" ?
+ this.attendanceTableRef = dom}
+ showOperateBtn={showOperateBtn}
+ salaryYearMonth={salaryMonth}
+ /> :
+ this.fieldMangRef = dom}
+ showOperateBtn={showOperateBtn}
+ fieldName={fieldName}
+ />
}
- content={
-
- }
- onClose={() => setSlideVisiable(false)}
- showMask={true}
- closeMaskOnClick={() => setSlideVisiable(false)}
- />}
+
+
);
}
}
+
+export default Index;
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less
index 3bbe0224..6e4af33c 100644
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less
+++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.less
@@ -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;
}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js
deleted file mode 100644
index adf2d2ff..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js
+++ /dev/null
@@ -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 (
- {
- currentItemOperate == "add" ? this.props.onSave(this.state.request) :
- this.props.onUpdate(this.state.request);
- }
- }>保存
- ]}>
-
-
-
- 字段名称
-
-
- {
- this.handleChange({ fieldName: v });
- }}/>
-
-
-
-
- 类型
-
-
- this.handleChange({ fieldType: v })}
- />
-
-
-
-
- 是否启用
-
-
- {
- let enableStatus = 0;
- if (value) {
- enableStatus = 1;
- }
- this.handleChange({ enableStatus });
- }}/>
-
-
-
-
- 备注
-
-
- {
- this.handleChange({ description: v });
- }}/>
-
-
-
-
-
- );
- }
-}
diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js
deleted file mode 100644
index 8b9ccee7..00000000
--- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js
+++ /dev/null
@@ -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 (
- 同步,
-
- ]}
- visible={this.props.visible}
- onCancel={this.props.onCancel}>
-
- 薪资所属月:
-
-
- {
- if (value === "") this.refs.weaError.showError();
- this.handleRequestChange({ salaryYearMonth: value });
- }}
- />
-
-
-
-
- 薪资账套:
-
- {
- this.state.inited &&
-
- ({
- key: it.id,
- showname: it.content
- }))]
- }
- onChange={(value) => {
- if (value === "") this.refs.weaError1.showError();
- this.handleRequestChange({ salarySobId: value });
- }}/>
-
- }
-
-
-
- 备注
-
- {
- this.handleRequestChange({ description: 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 })}>
- {
- this.props.onChange(value);
- }}/>
-
-
- );
- }
-}
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js
new file mode 100644
index 00000000..79ade76e
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js
@@ -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 (
+ this.handleCustomBenefitsSwitch(record, value)}
+ />
+ );
+ default:
+ return ;
+ }
+ }
+ })), {
+ title: "操作",
+ width: 120,
+ dataIndex: "operate",
+ render: (_, record) => {
+ return (
+
+ );
+ }
+ }];
+ };
+ 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 (
+
+ );
+ }
+}
+
+export default CustomBenefitsTable;
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js
index 95339fb1..b5a775e4 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customNewModal.js
@@ -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);
});
}
}
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js
index 1df0a010..bee748ee 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js
@@ -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 (
- {
- this.onCustomEdit(record);
- }}>
- 编辑
-
- );
- case "is_use":
- return (
- {
- this.handleCategoryStatusChange(record, value);
- }}
- />
- );
- default:
- return ;
- }
- };
- 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 });
}}
/>}
@@ -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"
? this.customBenefitsTableRef = dom}
+ showOperateBtn={showOperateBtn}
+ welfareTypeEnum={customSelectkey}
+ onCustomEdit={this.onCustomEdit}
/>
+ //
}
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();
}}
/>}
diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js
index 61c86c7a..3f3d2912 100644
--- a/pc4mobx/hrmSalary/stores/attendanceStore.js
+++ b/pc4mobx/hrmSalary/stores/attendanceStore.js
@@ -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();
}
diff --git a/pc4mobx/hrmSalary/stores/programme.js b/pc4mobx/hrmSalary/stores/programme.js
index 2f4153a2..b6d994d0 100644
--- a/pc4mobx/hrmSalary/stores/programme.js
+++ b/pc4mobx/hrmSalary/stores/programme.js
@@ -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 || "编辑失败");