From 667aa8808da860442831e91aad5db835653e5bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 23 Feb 2023 17:25:45 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/attendance/index.js | 924 +----------------- .../dataAcquisition/attendance/indexcopy.js | 921 +++++++++++++++++ 2 files changed, 932 insertions(+), 913 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 3b4727bd..89b59ff0 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -1,921 +1,19 @@ -import React 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 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"; - -const MonthPicker = DatePicker.MonthPicker; - -@inject("attendanceStore", "taxAgentStore") -@observer -export default class Attendance extends React.Component { - constructor(props) { - super(props); - columns.map(item => { - if (item.key == "cz") { - item.render = (text, record) => { - return ( -
- this.onShowSlide()}> - 查看 - - this.onDelete()} - style={{ marginLeft: "10px" }}> - 删除 - -
- ); - }; - } - }); - 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 - }; - 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: 黎永顺 + * name: 考情引用 + * Description: + * Date: 2023/2/23 + */ +import React, { Component } from "react"; +class Index extends Component { 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 topTab = [ - { - title: "考勤数据", - viewcondition: "0" - }, - { - title: "字段管理", - viewcondition: "1" - } - ]; - - 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" }); - }; - 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(); - }} - /> +
- { - 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 && - - } - content={ - - } - onClose={() => setSlideVisiable(false)} - showMask={true} - closeMaskOnClick={() => setSlideVisiable(false)} - />}
); } } + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js new file mode 100644 index 00000000..3b4727bd --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js @@ -0,0 +1,921 @@ +import React 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 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"; + +const MonthPicker = DatePicker.MonthPicker; + +@inject("attendanceStore", "taxAgentStore") +@observer +export default class Attendance extends React.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 + }; + 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); + }; + + 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 topTab = [ + { + title: "考勤数据", + viewcondition: "0" + }, + { + title: "字段管理", + viewcondition: "1" + } + ]; + + 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" }); + }; + + 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(); + }} + /> + + { + 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 && + + } + content={ + + } + onClose={() => setSlideVisiable(false)} + showMask={true} + closeMaskOnClick={() => setSlideVisiable(false)} + />} +
+ ); + } +} From df7c8b943f4a34d0d5ccf4d6aab0b0c70a362293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 24 Feb 2023 11:05:52 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/attendanceDataComp.js | 94 +++++++++++++++++++ .../attendance/components/fieldMangComp.js | 93 ++++++++++++++++++ .../pages/dataAcquisition/attendance/index.js | 90 +++++++++++++++++- .../dataAcquisition/attendance/index.less | 67 +++++++++---- 4 files changed, 325 insertions(+), 19 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js 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..89b28cdf --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -0,0 +1,94 @@ +/* + * Author: 黎永顺 + * name: 考勤数据 + * Description: + * Date: 2023/2/24 + */ +import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import { getAttendanceList } from "../../../../apis/attendance"; + +class AttendanceDataComp extends Component { + constructor(props) { + super(props); + this.state = { + loading: { + query: false + }, + dataSource: [], + columns: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } + }; + } + + 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 + }); + } + }).catch(() => this.setState({ loading: { ...loading, query: false } })); + }; + + render() { + const { dataSource, columns, pageInfo, loading } = this.state; + const { showOperateBtn, salaryYearMonth } = this.props; + const pagination = { + ...pageInfo, + showTotal: total => `共 ${total} 条`, + showQuickJumper: 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 ( +
+ 查看 + {showOperateBtn && 删除} +
+ ); + } + } + ]} + dataSource={dataSource} + pagination={pagination} + loading={loading.query} + /> + ); + } +} + +export default AttendanceDataComp; 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..aee44170 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -0,0 +1,93 @@ +/* + * Author: 黎永顺 + * name:字段管理 + * Description: + * Date: 2023/2/24 + */ +import React, { Component } from "react"; +import { Col, Row } from "antd"; +import { WeaTable } from "ecCom"; +import { getAttendanceFieldList } from "../../../../apis/attendance"; +import TipLabel from "../../../../components/TipLabel"; + +class FieldMangComp extends Component { + constructor(props) { + super(props); + this.state = { + loading: { + query: false + }, + dataSource: [], + columns: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } + }; + } + + 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 { columns, list: dataSource, pageNum: current, pageSize, total } = data; + this.setState({ + pageInfo: { ...pageInfo, current, pageSize, total }, + dataSource, + columns + }); + } + }).catch(() => this.setState({ loading: { ...loading, query: false } })); + }; + + render() { + const { dataSource, columns, pageInfo, loading } = this.state; + const { fieldName } = this.props; + const pagination = { + ...pageInfo, + showTotal: total => `共 ${total} 条`, + showQuickJumper: 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/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 89b59ff0..4961b36b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -5,12 +5,96 @@ * Date: 2023/2/23 */ import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +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 "./index.less"; +const { MonthPicker } = DatePicker; + +@inject("attendanceStore", "taxAgentStore") +@observer class Index extends Component { - render() { - return ( -
+ constructor(props) { + super(props); + this.state = { + fieldName: "", + selectedKey: "DATA", + salaryMonth: [] + }; + } + /* + * 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) })); + + render() { + const { selectedKey, salaryMonth, fieldName } = this.state; + const { taxAgentStore: { showOperateBtn } } = this.props; + const topTab = [ + { title: "考勤数据", viewcondition: "DATA" }, + { title: "字段管理", viewcondition: "FIELD" } + ]; + const buttons = selectedKey === "DATA" ? [ + , + + ] : []; + return ( +
+ this.setState({ selectedKey: v })} + searchsBaseValue={fieldName} onSearchChange={fieldName => this.setState({ fieldName })} + onSearch={() => this.fieldMangRef.getAttendanceFieldList({ fieldName })} + /> + { + selectedKey === "DATA" && this.getAttendanceDataScreen() + } +
+ + { + selectedKey === "DATA" ? + this.attendanceTableRef = dom} + showOperateBtn={showOperateBtn} + salaryYearMonth={salaryMonth} + /> : + this.fieldMangRef = dom} + fieldName={fieldName} + /> + } + +
); } 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; } From c60ed4da78b31aa994dab4449c56e78def7afca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 1 Mar 2023 10:11:11 +0800 Subject: [PATCH 03/18] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/components/fieldMangComp.js | 38 ++++++++++++++++--- .../pages/dataAcquisition/attendance/index.js | 4 +- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js index aee44170..d71b2ca2 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -5,8 +5,9 @@ * Date: 2023/2/24 */ import React, { Component } from "react"; +import { toJS } from "mobx"; +import { WeaCheckbox, WeaTable } from "ecCom"; import { Col, Row } from "antd"; -import { WeaTable } from "ecCom"; import { getAttendanceFieldList } from "../../../../apis/attendance"; import TipLabel from "../../../../components/TipLabel"; @@ -32,24 +33,49 @@ class FieldMangComp extends Component { } getAttendanceFieldList = (extraPayload) => { + const { fieldTableStore } = this.props; 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 { columns, list: dataSource, pageNum: current, pageSize, total } = data; + const { dataKey, pageInfo } = data; + const { datas } = dataKey; + const { list: dataSource, pageNum: current, pageSize, total } = pageInfo; + fieldTableStore.getDatas(datas); this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, - dataSource, - columns + dataSource }); } }).catch(() => this.setState({ loading: { ...loading, query: false } })); }; + getColumns = () => { + const { showOperateBtn } = this.props; + console.log(this.props.fieldTableStore, toJS(this.props.fieldTableStore.columns)); + return _.map(_.filter([], item => !!item.hide), child => ({ + ...child, + render: (text, record) => { + switch (child.dataIndex) { + case "enableStatus": + return ( + { + console.log(record, value); + }} + /> + ); + default: + return
; + } + } + })); + }; render() { - const { dataSource, columns, pageInfo, loading } = this.state; + const { dataSource, pageInfo, loading } = this.state; const { fieldName } = this.props; const pagination = { ...pageInfo, @@ -71,7 +97,7 @@ class FieldMangComp extends Component { : this.fieldMangRef = dom} + fieldTableStore={fieldTableStore} + showOperateBtn={showOperateBtn} fieldName={fieldName} /> } From 36e0e40bddf008d8c16784d9c932544c6d42b6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 1 Mar 2023 11:15:28 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../attendance/components/fieldMangComp.js | 9 ++++----- .../hrmSalary/pages/dataAcquisition/attendance/index.js | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js index d71b2ca2..dccabcf8 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -32,7 +32,7 @@ class FieldMangComp extends Component { this.getAttendanceFieldList(); } - getAttendanceFieldList = (extraPayload) => { + getAttendanceFieldList = (extraPayload = {}) => { const { fieldTableStore } = this.props; const { loading, pageInfo } = this.state; const module = { ...pageInfo, ...extraPayload }; @@ -40,9 +40,9 @@ class FieldMangComp extends Component { getAttendanceFieldList(module).then(({ status, data }) => { this.setState({ loading: { ...loading, query: false } }); if (status) { - const { dataKey, pageInfo } = data; + const { dataKey, pageInfo: pageInfoData } = data; const { datas } = dataKey; - const { list: dataSource, pageNum: current, pageSize, total } = pageInfo; + const { list: dataSource, pageNum: current, pageSize, total } = pageInfoData; fieldTableStore.getDatas(datas); this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, @@ -53,8 +53,7 @@ class FieldMangComp extends Component { }; getColumns = () => { const { showOperateBtn } = this.props; - console.log(this.props.fieldTableStore, toJS(this.props.fieldTableStore.columns)); - return _.map(_.filter([], item => !!item.hide), child => ({ + return _.map(_.filter(toJS(this.props.fieldTableStore.columns), item => !!item.hide), child => ({ ...child, render: (text, record) => { switch (child.dataIndex) { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 34ad7276..03df6384 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -66,7 +66,7 @@ class Index extends Component { const buttons = selectedKey === "DATA" ? [ , - ] : []; + ] : []; return (
this.setState({ selectedKey: v })} searchsBaseValue={fieldName} onSearchChange={fieldName => this.setState({ fieldName })} - onSearch={() => this.fieldMangRef.getAttendanceFieldList({ fieldName })} + onSearch={() => this.fieldMangRef.getAttendanceFieldList({ fieldName, current: 1 })} /> { selectedKey === "DATA" && this.getAttendanceDataScreen() From c9560ae679f033f145831b10a1d9e04f50cb74c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 1 Mar 2023 15:23:56 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataAcquisition/attendance/columns.js | 313 +++++------- .../components/attendanceCustomFieldsModal.js | 40 ++ .../attendance/components/fieldMangComp.js | 13 +- .../attendance/components/index.less | 15 + .../attendance/editSlideContent.js | 16 +- .../pages/dataAcquisition/attendance/index.js | 3 +- pc4mobx/hrmSalary/stores/attendanceStore.js | 481 +----------------- 7 files changed, 202 insertions(+), 679 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js index 338aa6a3..e4aa75cc 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js @@ -1,191 +1,134 @@ -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) => { - - } + { + 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: "测试" - } +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, + options: [ + { + key: "1", + selected: true, + showname: "数值" + }, + { + key: "2", + selected: false, + showname: "文本" + } + ], + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SWITCH", + domkey: ["enableStatus"], + fieldcol: 14, + isQuickSearch: false, + label: "是否启用", + labelcol: 6, + viewAttr: 3, + rules: "required" + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["description"], + fieldcol: 14, + 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..699d3f27 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js @@ -0,0 +1,40 @@ +/* + * Author: 黎永顺 + * name: 新建考勤自定义字段 + * Description: + * Date: 2023/3/1 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaDialog } from "ecCom"; +import { Button } from "antd"; +import { conditions } from "../columns"; +import { getSearchs } from "../../../../util"; +import "./index.less"; + +@inject("attendanceStore") +@observer +class AttendanceCustomFieldsModal extends Component { + componentDidMount() { + const { attendanceStore: { form } } = this.props; + form.initFormFields(conditions); + } + + 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/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js index dccabcf8..79c86f09 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -8,6 +8,7 @@ import React, { Component } from "react"; import { toJS } from "mobx"; import { WeaCheckbox, WeaTable } from "ecCom"; import { Col, Row } from "antd"; +import AttendanceCustomFieldsModal from "./attendanceCustomFieldsModal"; import { getAttendanceFieldList } from "../../../../apis/attendance"; import TipLabel from "../../../../components/TipLabel"; @@ -24,6 +25,10 @@ class FieldMangComp extends Component { current: 1, pageSize: 10, total: 0 + }, + addPayload: { + visible: false, + title: "新建考勤自定义字段" } }; } @@ -51,6 +56,10 @@ class FieldMangComp extends Component { } }).catch(() => this.setState({ loading: { ...loading, query: false } })); }; + handleTriggerAttendFileds = () => { + const { addPayload } = this.state; + this.setState({ addPayload: { ...addPayload, visible: !addPayload.visible } }); + }; getColumns = () => { const { showOperateBtn } = this.props; return _.map(_.filter(toJS(this.props.fieldTableStore.columns), item => !!item.hide), child => ({ @@ -74,12 +83,13 @@ class FieldMangComp extends Component { }; render() { - const { dataSource, pageInfo, loading } = this.state; + 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({ @@ -101,6 +111,7 @@ class FieldMangComp extends Component { pagination={pagination} loading={loading.query} /> + ; }; handleChangeSalaryMonth = (salaryMonth) => this.setState({ salaryMonth }, () => this.attendanceTableRef.getAttendanceList({ salaryYearMonth: _.compact(this.state.salaryMonth) })); + handleAddAttendFileds = () => this.fieldMangRef.handleTriggerAttendFileds(); render() { const { selectedKey, salaryMonth, fieldName } = this.state; @@ -66,7 +67,7 @@ class Index extends Component { const buttons = selectedKey === "DATA" ? [ , - ] : []; + ] : []; return (
{ - 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 fieldTableStore = new TableStore(); } From fe71ce161b9237335cc966bff87008acdc14da0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 1 Mar 2023 16:28:34 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataAcquisition/attendance/columns.js | 4 +- .../components/attendanceCustomFieldsModal.js | 42 +++++++++++++++++-- .../attendance/components/fieldMangComp.js | 5 ++- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js index e4aa75cc..08e83263 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js @@ -93,12 +93,12 @@ export const conditions = [ labelcol: 6, options: [ { - key: "1", + key: "NUMBER", selected: true, showname: "数值" }, { - key: "2", + key: "TEXT", selected: false, showname: "文本" } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js index 699d3f27..0e6d7ab3 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js @@ -7,9 +7,10 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaDialog } from "ecCom"; -import { Button } from "antd"; +import { Button, message } from "antd"; import { conditions } from "../columns"; import { getSearchs } from "../../../../util"; +import { saveAttendanceField } from "../../../../apis/attendance"; import "./index.less"; @inject("attendanceStore") @@ -20,14 +21,49 @@ class AttendanceCustomFieldsModal extends Component { form.initFormFields(conditions); } + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.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.resetForm(); + }; + render() { const { attendanceStore: { form } } = this.props; const buttons = [ - + ]; return ( diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js index 79c86f09..487a0775 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -111,7 +111,10 @@ class FieldMangComp extends Component { pagination={pagination} loading={loading.query} /> - + Date: Wed, 1 Mar 2023 18:07:49 +0800 Subject: [PATCH 07/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js | 2 +- .../attendance/components/attendanceCustomFieldsModal.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js index 08e83263..2adb437b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js @@ -91,6 +91,7 @@ export const conditions = [ isQuickSearch: false, label: "类型", labelcol: 6, + valueList:[], options: [ { key: "NUMBER", @@ -110,7 +111,6 @@ export const conditions = [ conditionType: "SWITCH", domkey: ["enableStatus"], fieldcol: 14, - isQuickSearch: false, label: "是否启用", labelcol: 6, viewAttr: 3, diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js index 0e6d7ab3..0bbc46f0 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceCustomFieldsModal.js @@ -22,7 +22,7 @@ class AttendanceCustomFieldsModal extends Component { } componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.visible !== this.props.visible) this.handleResetForm(); + if (nextProps.visible !== this.props.visible && nextProps.visible) this.handleResetForm(); } @@ -53,7 +53,7 @@ class AttendanceCustomFieldsModal extends Component { }; handleResetForm = () => { const { attendanceStore: { form } } = this.props; - form.resetForm(); + form.updateFields({ fieldName: "", fieldType: "NUMBER", enableStatus: "0", description: "" }); }; render() { From c902c32140bba03d4106d4306c098c3c048be19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 2 Mar 2023 14:07:36 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/attendanceDataComp.js | 37 +++++++++++++++++-- .../attendance/components/fieldMangComp.js | 32 +++++++++------- .../pages/dataAcquisition/attendance/index.js | 5 +-- pc4mobx/hrmSalary/stores/attendanceStore.js | 4 +- 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index 89b28cdf..9f3d4a43 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -6,7 +6,9 @@ */ import React, { Component } from "react"; import { WeaTable } from "ecCom"; -import { getAttendanceList } from "../../../../apis/attendance"; +import { message, Modal } from "antd"; +import { deleteAttendance, getAttendanceList } from "../../../../apis/attendance"; +import moment from "moment"; class AttendanceDataComp extends Component { constructor(props) { @@ -40,11 +42,35 @@ class AttendanceDataComp extends Component { this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, - columns + 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 } })); }; + handleDeleteAttendanceData = ({ id }) => { + Modal.confirm({ + title: "信息确认", + content: "确认要删除吗?", + onOk: () => { + deleteAttendance([id]).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.getAttendanceList(); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; render() { const { dataSource, columns, pageInfo, loading } = this.state; @@ -53,6 +79,7 @@ class AttendanceDataComp extends Component { ...pageInfo, showTotal: total => `共 ${total} 条`, showQuickJumper: true, + showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], onShowSizeChange: (current, pageSize) => { this.setState({ @@ -73,11 +100,13 @@ class AttendanceDataComp extends Component { title: "操作", width: 120, dataIndex: "operate", - render: (text, record) => { + render: (_, record) => { return (
查看 - {showOperateBtn && 删除} + {showOperateBtn && + this.handleDeleteAttendanceData(record)}>删除 + }
); } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js index 487a0775..9a1cb904 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -5,11 +5,10 @@ * Date: 2023/2/24 */ import React, { Component } from "react"; -import { toJS } from "mobx"; import { WeaCheckbox, WeaTable } from "ecCom"; -import { Col, Row } from "antd"; +import { Col, message, Row } from "antd"; import AttendanceCustomFieldsModal from "./attendanceCustomFieldsModal"; -import { getAttendanceFieldList } from "../../../../apis/attendance"; +import { getAttendanceFieldList, updateAttendanceFieldStatus } from "../../../../apis/attendance"; import TipLabel from "../../../../components/TipLabel"; class FieldMangComp extends Component { @@ -38,20 +37,17 @@ class FieldMangComp extends Component { } getAttendanceFieldList = (extraPayload = {}) => { - const { fieldTableStore } = this.props; 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 { dataKey, pageInfo: pageInfoData } = data; - const { datas } = dataKey; - const { list: dataSource, pageNum: current, pageSize, total } = pageInfoData; - fieldTableStore.getDatas(datas); + const { pageInfo: pageInfoData } = data; + const { list: dataSource, columns, pageNum: current, pageSize, total } = pageInfoData; this.setState({ pageInfo: { ...pageInfo, current, pageSize, total }, - dataSource + dataSource, columns }); } }).catch(() => this.setState({ loading: { ...loading, query: false } })); @@ -60,9 +56,21 @@ class FieldMangComp extends Component { 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(toJS(this.props.fieldTableStore.columns), item => !!item.hide), child => ({ + return _.map(_.filter(columns, item => !!item.display), child => ({ ...child, render: (text, record) => { switch (child.dataIndex) { @@ -70,9 +78,7 @@ class FieldMangComp extends Component { return ( { - console.log(record, value); - }} + onChange={value => this.handleAttendanceFieldSwitch(record, value)} /> ); default: diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 0fcc4dd1..8db3cff8 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -15,7 +15,7 @@ import "./index.less"; const { MonthPicker } = DatePicker; -@inject("attendanceStore", "taxAgentStore") +@inject("taxAgentStore") @observer class Index extends Component { constructor(props) { @@ -59,7 +59,7 @@ class Index extends Component { render() { const { selectedKey, salaryMonth, fieldName } = this.state; - const { taxAgentStore: { showOperateBtn }, attendanceStore: { fieldTableStore } } = this.props; + const { taxAgentStore: { showOperateBtn } } = this.props; const topTab = [ { title: "考勤数据", viewcondition: "DATA" }, { title: "字段管理", viewcondition: "FIELD" } @@ -91,7 +91,6 @@ class Index extends Component { /> : this.fieldMangRef = dom} - fieldTableStore={fieldTableStore} showOperateBtn={showOperateBtn} fieldName={fieldName} /> diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index 9bd12745..8bc06c0e 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -1,9 +1,7 @@ import { observable } from "mobx"; -import { WeaForm, WeaTableNew } from "comsMobx"; +import { WeaForm } from "comsMobx"; -const { TableStore } = WeaTableNew; export class AttendanceStore { @observable form = new WeaForm(); - @observable fieldTableStore = new TableStore(); } From 10721ecba0f21edfba7e42f311bb3ef2c70dc5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 2 Mar 2023 18:44:36 +0800 Subject: [PATCH 09/18] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=96=B9=E6=A1=88-=E8=87=AA=E5=AE=9A=E4=B9=89=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E9=A1=B5=E9=9D=A2=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/welfareScheme.js | 10 +- .../programme/customBenefitsTable.js | 131 ++++++++++++++++++ .../programme/customNewModal.js | 4 +- .../socialSecurityBenefits/programme/index.js | 82 +++-------- pc4mobx/hrmSalary/stores/programme.js | 3 - 5 files changed, 161 insertions(+), 69 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/customBenefitsTable.js 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/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 ( +
+ {showOperateBtn && + onCustomEdit(record)}>编辑 + } +
+ ); + } + }]; + }; + 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..07629fd4 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,9 +201,9 @@ export default class Programme extends React.Component { customEdit: true }); setCustomRequest({ - insuranceName: record["insurance_name"], + insuranceName: record["insuranceName"], id: record.id, - isUse: record.is_use, + isUse: record.isUse, paymentScope: record["payment_scope"].split(",").map(item => paymentScopeEnum[item]).join(","), welfareType: welfareTypeEnum[record.welfare_type] }); @@ -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/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 || "编辑失败"); From 7907fd5a838bf89feadee668f5b4cae9480600d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 3 Mar 2023 16:29:52 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/components/importModal/index.js | 3 +- .../components/importModal/index.less | 4 +- .../dataAcquisition/attendance/columns.js | 39 ++++- .../components/attendanceDataComp.js | 147 +++++++++++++++--- .../attendance/components/fieldMangComp.js | 5 +- .../components/importFormOptions.js | 57 +++++++ .../attendance/components/index.less | 4 + .../pages/dataAcquisition/attendance/index.js | 8 +- .../socialSecurityBenefits/programme/index.js | 4 +- 9 files changed, 237 insertions(+), 34 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/importFormOptions.js 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/pages/dataAcquisition/attendance/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js index 2adb437b..41094e98 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js @@ -68,7 +68,44 @@ export const columns = [ } } ]; - +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: [ diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index 9f3d4a43..c143b92a 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -7,7 +7,15 @@ import React, { Component } from "react"; import { WeaTable } from "ecCom"; import { message, Modal } from "antd"; -import { deleteAttendance, getAttendanceList } from "../../../../apis/attendance"; +import { + deleteAttendance, + getAttendanceList, + getLedgerList, + getSalaryCycleAndAttendCycle +} from "../../../../apis/attendance"; +import ImportModal from "../../../../components/importModal"; +import HeaderSet from "../../../../components/importModal/headerSet"; +import ImportFormOptions from "./importFormOptions"; import moment from "moment"; class AttendanceDataComp extends Component { @@ -23,6 +31,14 @@ class AttendanceDataComp extends Component { 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: "" } }; } @@ -55,6 +71,45 @@ class AttendanceDataComp extends Component { } }).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 } = this.state; + this.setState({ + importFormPayload: { + ...importFormPayload, + [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: "信息确认", @@ -71,9 +126,33 @@ class AttendanceDataComp extends Component { } }); }; + handleImportAttendanceData = (importData) => { + this.getLedgerList(); + this.setState({ importData }); + }; + setStep = step => this.setState({ importData: { ...this.state.importData, step } }); + handleFinish = () => { + console.log("finish"); + }; + handlePreviewImport = (params) => { + console.log("handlePreviewImport", params); + }; + handleImport = (params) => { + console.log("handleImport", params); + }; + handleTemplateLinkClick = () => { + const { importFormPayload } = this.state; + const { salarySobId, salaryYearMonth } = importFormPayload; + if (!salarySobId || !salaryYearMonth) { + message.warning("请完善导入选项,再下载"); + return; + } + // const { attendanceStore: { downloadTemplate } } = this.props; + // downloadTemplate(salaryYearMonth, salarySobId); + }; render() { - const { dataSource, columns, pageInfo, loading } = this.state; + const { dataSource, columns, pageInfo, loading, importData, importFormPayload } = this.state; const { showOperateBtn, salaryYearMonth } = this.props; const pagination = { ...pageInfo, @@ -93,29 +172,49 @@ class AttendanceDataComp extends Component { } }; return ( - { - return ( - - ); + + { + return ( + + ); + } } - } - ]} - dataSource={dataSource} - pagination={pagination} - loading={loading.query} - /> + ]} + dataSource={dataSource} + pagination={pagination} + loading={loading.query} + /> + {/* 考勤引用导入 */} + { + // getAttendanceFieldSettingList({ sourceType: "IMPORT" }); + // this.setState({ + // selectItemVisible: true + // }); + }} + />} + renderFormComponent={ + () => + } + /> + ); } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js index 9a1cb904..687c6482 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/fieldMangComp.js @@ -10,6 +10,7 @@ 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) { @@ -18,8 +19,8 @@ class FieldMangComp extends Component { loading: { query: false }, - dataSource: [], - columns: [], + dataSource: [{}], + columns: fieldsColumns, pageInfo: { current: 1, pageSize: 10, 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 index cdc25296..d5773f1b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less @@ -13,3 +13,7 @@ border-radius: 0; } } + +.attendanceFormWrapper { + padding: 0; +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 8db3cff8..60d168b9 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -56,6 +56,12 @@ class Index extends Component { }; 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: [] + }); + } render() { const { selectedKey, salaryMonth, fieldName } = this.state; @@ -66,7 +72,7 @@ class Index extends Component { ]; const buttons = selectedKey === "DATA" ? [ , - + ] : []; return (
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js index 07629fd4..bee748ee 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js @@ -204,8 +204,8 @@ export default class Programme extends React.Component { insuranceName: record["insuranceName"], id: record.id, isUse: record.isUse, - paymentScope: record["payment_scope"].split(",").map(item => paymentScopeEnum[item]).join(","), - welfareType: welfareTypeEnum[record.welfare_type] + paymentScope: record["paymentScope"].split(",").map(item => paymentScopeEnum[item]).join(","), + welfareType: welfareTypeEnum[record.welfareType] }); }; From 64375f681da340529a9d608ee20063b461781d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 3 Mar 2023 17:33:11 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/importModal/headerSet.js | 16 +++++++-------- .../components/attendanceDataComp.js | 20 ++++++++++++------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/pc4mobx/hrmSalary/components/importModal/headerSet.js b/pc4mobx/hrmSalary/components/importModal/headerSet.js index e51047b1..94717e9f 100644 --- a/pc4mobx/hrmSalary/components/importModal/headerSet.js +++ b/pc4mobx/hrmSalary/components/importModal/headerSet.js @@ -7,14 +7,14 @@ export default class HeaderSet extends React.Component { return (
- - + {/**/} + {/**/}
) } -} \ No newline at end of file +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index c143b92a..1ee0714f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -11,7 +11,8 @@ import { deleteAttendance, getAttendanceList, getLedgerList, - getSalaryCycleAndAttendCycle + getSalaryCycleAndAttendCycle, + previewAttendQuote } from "../../../../apis/attendance"; import ImportModal from "../../../../components/importModal"; import HeaderSet from "../../../../components/importModal/headerSet"; @@ -85,12 +86,14 @@ class AttendanceDataComp extends Component { }); }; handleChangeImportPayload = (key, value) => { - const { importFormPayload } = this.state; + 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 = { @@ -127,15 +130,19 @@ class AttendanceDataComp extends Component { }); }; handleImportAttendanceData = (importData) => { + const { importFormPayload } = this.state; + const { salaryYearMonth, salarySobId } = importFormPayload; this.getLedgerList(); - this.setState({ importData }); + this.setState({ importData: { ...importData, params: { salaryYearMonth, salarySobId } } }); }; setStep = step => this.setState({ importData: { ...this.state.importData, step } }); handleFinish = () => { console.log("finish"); }; handlePreviewImport = (params) => { - console.log("handlePreviewImport", params); + previewAttendQuote(params).then(({status, data})=>{ + console.log("handlePreviewImport", data); + }) }; handleImport = (params) => { console.log("handleImport", params); @@ -147,8 +154,7 @@ class AttendanceDataComp extends Component { message.warning("请完善导入选项,再下载"); return; } - // const { attendanceStore: { downloadTemplate } } = this.props; - // downloadTemplate(salaryYearMonth, salarySobId); + window.open(`/api/bs/hrmsalary/attendQuote/downloadTemplate?salaryYearMonth=${salaryYearMonth}&salarySobId=${salarySobId}`); }; render() { From 33e96c4437436a12acec4d98d366b9af5a4f2bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 6 Mar 2023 15:06:56 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/importModal/headerSet.js | 34 ++-- .../components/selectItemsModal/index.js | 108 +++++-------- .../components/selectItemsModal/index.less | 67 ++++++++ .../components/selectItemsModal/index11.js | 93 +++++++++++ .../selectItemsModal/selectItemsWrapper.js | 116 ++++++-------- .../selectItemsWrappercopy.js | 78 +++++++++ .../components/attendanceDataComp.js | 150 +++++++++++++++--- 7 files changed, 474 insertions(+), 172 deletions(-) create mode 100644 pc4mobx/hrmSalary/components/selectItemsModal/index.less create mode 100644 pc4mobx/hrmSalary/components/selectItemsModal/index11.js create mode 100644 pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js diff --git a/pc4mobx/hrmSalary/components/importModal/headerSet.js b/pc4mobx/hrmSalary/components/importModal/headerSet.js index 94717e9f..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 ( -
- - {/**/} - {/**/} -
- ) - } + render() { + return ( +
+ + {/**/} + {/**/} +
+ ); + } } diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/index.js b/pc4mobx/hrmSalary/components/selectItemsModal/index.js index 27cc02a7..6bb7919d 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,49 @@ 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 = ( - this.handleMenuClick(e)}> - 恢复默认设置 - 设置默认设置 - {/* 操作日志 */} - - ); + const { searchValue } = this.state; + const { title, onSearchItemSet, onShowOnlyChecked, comp: children, ...extra } = this.props; + const btns = []; + const moreBtn = { + datas: [ + { + key: "recovery", + content: "恢复默认设置", + icon: , + onClick: key => alert(`点击事物处理函数接受的实参为 ${key}`) + }, + { + key: "setting", + content: "设为默认设置", + icon: , + onClick: key => alert(`点击事物处理函数接受的实参为 ${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/index11.js b/pc4mobx/hrmSalary/components/selectItemsModal/index11.js new file mode 100644 index 00000000..27cc02a7 --- /dev/null +++ b/pc4mobx/hrmSalary/components/selectItemsModal/index11.js @@ -0,0 +1,93 @@ +/* + * Author: 黎永顺 + * Description: + * Date: 2022-05-19 15:18:09 + * 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" + + +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); + this.state = { + searchValue: "" + }; + } + + 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") { + + } + } + + render() { + const menu = ( + this.handleMenuClick(e)}> + 恢复默认设置 + 设置默认设置 + {/* 操作日志 */} + + ); + return ( + { + this.props.onSave(); + }}>保存, + 更多 + ]} + > +
+ { + this.setState({ searchValue: value }); + }} + onSearch={(value) => { + this.props.onSearch(value); + }} + /> +
+ {this.props.children} +
+ { + this.handleShowChecked(value); + }}/> +
+
+ ); + } +} diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js index b29f38b8..e4d99a5e 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js @@ -1,78 +1,56 @@ -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 { - constructor(props) { - super(props); - this.state = { - showContent: true, - checkStatus: false - }; - } - - handleAllChecked(value) { - value = value == 1 ? true : false; - let items = [...this.props.items]; - items.map(item => { - item.checked = value; - }); - this.setState({ - checkStatus: value - }); - 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; - } - }); - this.props.onChange(items); - } +class SelectItemsWrapper extends Component { + renderTitle = (item) => { + const { groupName } = item; + return
+ + 已选择0个字段 +
; + }; render() { + const { dataSource } = this.props; 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(dataSource, item => { + const { items } = item; + return +
+ { + _.isEmpty(items) ? + 暂无数据 : +
    + { + _.map(items, child => { + const { name, checked } = child; + return
  • + { + console.log(value); + }} + /> +
  • ; + }) + } +
+ } +
+
; + }) } - -
+ ); } } + +export default SelectItemsWrapper; diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js new file mode 100644 index 00000000..b29f38b8 --- /dev/null +++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js @@ -0,0 +1,78 @@ +import React from "react"; +import { WeaCheckbox } from "ecCom"; +import { Col, Icon, Row } from "antd"; + +export default class SelectItemsWrapper extends React.Component { + constructor(props) { + super(props); + this.state = { + showContent: true, + checkStatus: false + }; + } + + handleAllChecked(value) { + value = value == 1 ? true : false; + let items = [...this.props.items]; + items.map(item => { + item.checked = value; + }); + this.setState({ + checkStatus: value + }); + 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; + } + }); + this.props.onChange(items); + } + + render() { + 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); + }}/> + )) + } + +
+ } + +
+ ); + } +} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index 1ee0714f..2eb99f7e 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -9,25 +9,31 @@ import { WeaTable } from "ecCom"; import { message, Modal } from "antd"; import { deleteAttendance, + getAttendanceFieldSettingList, getAttendanceList, getLedgerList, getSalaryCycleAndAttendCycle, + importAttendQuoteData, previewAttendQuote } 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"; class AttendanceDataComp extends Component { constructor(props) { super(props); this.state = { loading: { - query: false + query: false, + headset: false }, dataSource: [], columns: [], + fieldSetList: [], pageInfo: { current: 1, pageSize: 10, @@ -40,7 +46,8 @@ class AttendanceDataComp extends Component { importFormPayload: { salaryYearMonth: moment().format("YYYY-MM"), salarySobList: [], salarySobId: "", salaryCycle: "", attendCycle: "" - } + }, + fieldSetPayload: { visible: false, title: "", data: [] } }; } @@ -137,15 +144,47 @@ class AttendanceDataComp extends Component { }; setStep = step => this.setState({ importData: { ...this.state.importData, step } }); handleFinish = () => { - console.log("finish"); + 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) => { - previewAttendQuote(params).then(({status, data})=>{ - console.log("handlePreviewImport", data); - }) + 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) => { - console.log("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; @@ -156,9 +195,81 @@ class AttendanceDataComp extends Component { } 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({ + fieldSetList: data, + fieldSetPayload: { + ...fieldSetPayload, + visible: true, title: "导入字段设置", data + } + }); + } + }).catch(() => this.setState({ loading: { ...loading, headset: false } })); + }; + handleCloseSettings = () => { + const { fieldSetPayload } = this.state; + this.setState({ + fieldSetPayload: { + ...fieldSetPayload, + visible: false, title: "", data: [] + } + }); + }; + handleSearchItemSet = (val) => { + const { fieldSetPayload, fieldSetList } = this.state; + this.setState({ + fieldSetPayload: { + ...fieldSetPayload, + data: _.map(_.cloneDeep(fieldSetList), item => { + return { + ...item, + items: _.filter(item.items || [], child => { + return child.name.indexOf(val) !== -1; + }) + }; + }) + } + }); + }; + handleShowOnlyChecked = (checked) => { + const { fieldSetPayload, fieldSetList } = this.state; + if (!!NUmber(checked)) { + this.setState({ + fieldSetPayload: { + ...fieldSetPayload, + data: _.map(_.cloneDeep(fieldSetList), item => { + return { + ...item, + items: _.map(item.items || [], child => !!child.checked) + }; + }) + } + }); + } else { + this.setState({ + fieldSetPayload: { + ...fieldSetPayload, + data: _.cloneDeep(fieldSetList) + } + }); + } + }; render() { - const { dataSource, columns, pageInfo, loading, importData, importFormPayload } = this.state; + const { + dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload + } = this.state; const { showOperateBtn, salaryYearMonth } = this.props; const pagination = { ...pageInfo, @@ -207,19 +318,20 @@ class AttendanceDataComp extends Component { previewImport={this.handlePreviewImport} importFile={this.handleImport} templateLink={this.handleTemplateLinkClick} onCancel={this.handleFinish} headerSetCompoent={ { - // getAttendanceFieldSettingList({ sourceType: "IMPORT" }); - // this.setState({ - // selectItemVisible: true - // }); - }} - />} - renderFormComponent={ - () => + loading={loading.headset} + onSetClick={() => this.handleHeaderSettings({ sourceType: "IMPORT" })}/>} + renderFormComponent={() => } /> + {/* 表头设置 */} + } + onCancel={this.handleCloseSettings} + onSearchItemSet={this.handleSearchItemSet} + onShowOnlyChecked={this.handleShowOnlyChecked} + /> ); } From 34dd145e00ab88fa58f55d758a4b4b45729c43b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 6 Mar 2023 15:08:50 +0800 Subject: [PATCH 13/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataAcquisition/attendance/components/attendanceDataComp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index 2eb99f7e..e70e6acd 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -244,7 +244,7 @@ class AttendanceDataComp extends Component { }; handleShowOnlyChecked = (checked) => { const { fieldSetPayload, fieldSetList } = this.state; - if (!!NUmber(checked)) { + if (!!Number(checked)) { this.setState({ fieldSetPayload: { ...fieldSetPayload, From 1fc70a9978fa5989c9fa6a674378ccf1d943f3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 6 Mar 2023 17:13:08 +0800 Subject: [PATCH 14/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectItemsModal/selectItemsWrapper.js | 13 ++-- .../components/attendanceDataComp.js | 78 ++++++++++++++++++- 2 files changed, 82 insertions(+), 9 deletions(-) diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js index e4d99a5e..7a3ed519 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js @@ -9,15 +9,16 @@ import { WeaCheckbox, WeaSearchGroup } from "ecCom"; class SelectItemsWrapper extends Component { renderTitle = (item) => { - const { groupName } = item; + const { onSelectGroupAll } = this.props; + const { groupName, groupId } = item; return
- + onSelectGroupAll(groupId, val)}/> 已选择0个字段
; }; render() { - const { dataSource } = this.props; + const { dataSource, onSelectItem } = this.props; return ( { @@ -31,13 +32,11 @@ class SelectItemsWrapper extends Component {
    { _.map(items, child => { - const { name, checked } = child; + const { name, checked, id } = child; return
  • { - console.log(value); - }} + onChange={(val) => onSelectItem(id, val)} />
  • ; }) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index e70e6acd..0a7b6c4d 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -229,6 +229,14 @@ class AttendanceDataComp extends Component { handleSearchItemSet = (val) => { const { fieldSetPayload, fieldSetList } = this.state; this.setState({ + fieldSetList: _.map(_.cloneDeep(fieldSetList), item => { + return { + ...item, + items: _.filter(item.items || [], child => { + return child.name.indexOf(val) !== -1; + }) + }; + }), fieldSetPayload: { ...fieldSetPayload, data: _.map(_.cloneDeep(fieldSetList), item => { @@ -251,7 +259,7 @@ class AttendanceDataComp extends Component { data: _.map(_.cloneDeep(fieldSetList), item => { return { ...item, - items: _.map(item.items || [], child => !!child.checked) + items: _.filter(item.items || [], child => !!child.checked) }; }) } @@ -265,6 +273,66 @@ class AttendanceDataComp extends Component { }); } }; + handleSelectGroupAll = (groupId, checked) => { + const { fieldSetPayload, fieldSetList } = this.state; + this.setState({ + fieldSetList: _.map(_.cloneDeep(fieldSetList), item => { + if (groupId === item.groupId) { + return { + ...item, + items: _.map(item.items || [], child => { + return { ...child, checked: !!Number(checked) }; + }) + }; + } + return { ...item }; + }), + fieldSetPayload: { + ...fieldSetPayload, + data: _.map(_.cloneDeep(fieldSetList), item => { + if (groupId === item.groupId) { + return { + ...item, + items: _.map(item.items || [], child => { + return { ...child, checked: !!Number(checked) }; + }) + }; + } + return { ...item }; + }) + } + }); + }; + handleSelectItem = (id, checked) => { + const { fieldSetPayload, fieldSetList } = this.state; + this.setState({ + fieldSetList: _.map(_.cloneDeep(fieldSetList), item => { + return { + ...item, + items: _.map(item.items || [], child => { + if (id === child.id) { + return { ...child, checked: !!Number(checked) }; + } + return { ...child }; + }) + }; + }), + fieldSetPayload: { + ...fieldSetPayload, + data: _.map(_.cloneDeep(fieldSetList), item => { + return { + ...item, + items: _.map(item.items || [], child => { + if (id === child.id) { + return { ...child, checked: !!Number(checked) }; + } + return { ...child }; + }) + }; + }) + } + }); + }; render() { const { @@ -327,7 +395,13 @@ class AttendanceDataComp extends Component { /> {/* 表头设置 */} } + comp={ + + } onCancel={this.handleCloseSettings} onSearchItemSet={this.handleSearchItemSet} onShowOnlyChecked={this.handleShowOnlyChecked} From 6d5258daa5da2e5a1f9a864cc28811dfb732af9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 7 Mar 2023 14:47:47 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/attendance.js | 4 +- .../components/selectItemsModal/index.js | 2 +- .../selectItemsModal/selectItemsWrapper.js | 81 +++++++- .../dataAcquisition/attendance/columns.js | 42 +++++ .../components/attendanceDataComp.js | 178 ++++++------------ .../components/attendanceDataViewSlide.js | 143 ++++++++++++++ .../components/attendanceRefrenceDataModal.js | 114 +++++++++++ .../attendance/components/index.less | 34 ++++ .../pages/dataAcquisition/attendance/index.js | 7 +- pc4mobx/hrmSalary/stores/attendanceStore.js | 1 + 10 files changed, 482 insertions(+), 124 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataViewSlide.js create mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js 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/components/selectItemsModal/index.js b/pc4mobx/hrmSalary/components/selectItemsModal/index.js index 6bb7919d..7b8ca17a 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/index.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/index.js @@ -27,7 +27,7 @@ export default class SelectItemModal extends React.Component { render() { const { searchValue } = this.state; - const { title, onSearchItemSet, onShowOnlyChecked, comp: children, ...extra } = this.props; + const { title, onSearchItemSet, onShowOnlyChecked, children, ...extra } = this.props; const btns = []; const moreBtn = { datas: [ diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js index 7a3ed519..25c7e550 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js @@ -8,6 +8,81 @@ import React, { Component } from "react"; import { WeaCheckbox, WeaSearchGroup } from "ecCom"; class SelectItemsWrapper extends Component { + constructor(props) { + super(props); + this.state = { + list: [], + filterList: [] + }; + } + + componentDidMount() { + this.setState({ + list: this.props.dataSource + }); + } + + handleSearchItemSet = (val) => { + const { dataSource } = this.props; + this.setState({ + filterList: _.map(dataSource, item => { + return { + ...item, + items: _.filter(item.items || [], child => child.name.indexOf(val) !== -1) + }; + }) + }); + }; + handleShowOnlyChecked = (checked) => { + const { dataSource } = this.props; + const { list } = this.state; + if (!!Number(checked)) { + this.setState({ + list: _.map(list, item => { + return { + ...item, + items: _.filter(item.items || [], child => !!child.checked) + }; + }) + }); + } else { + this.setState({ list: dataSource }); + } + }; + handleSelectGroupAll = (groupId, checked) => { + const { list, filterList } = this.state; + const key = !_.isEmpty(filterList) ? "filterList" : "list"; + this.setState({ + [key]: _.map(!_.isEmpty(filterList) ? filterList : list, item => { + if (groupId === item.groupId) { + return { + ...item, + items: _.map(item.items || [], child => { + return { ...child, checked: !!Number(checked) }; + }) + }; + } + return { ...item }; + }) + }); + }; + handleSelectItem = (id, checked) => { + const { list, filterList } = this.state; + const key = !_.isEmpty(filterList) ? "filterList" : "list"; + this.setState({ + [key]: _.map(!_.isEmpty(filterList) ? filterList : list, item => { + return { + ...item, + items: _.map(item.items || [], child => { + if (id === child.id) { + return { ...child, checked: !!Number(checked) }; + } + return { ...child }; + }) + }; + }) + }); + }; renderTitle = (item) => { const { onSelectGroupAll } = this.props; const { groupName, groupId } = item; @@ -18,11 +93,13 @@ class SelectItemsWrapper extends Component { }; render() { - const { dataSource, onSelectItem } = this.props; + const { list, filterList } = this.state; + const { onSelectItem } = this.props; + console.log("filterList", filterList); return ( { - _.map(dataSource, item => { + _.map(!_.isEmpty(filterList) ? filterList : list, item => { const { items } = item; return
    diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js index 41094e98..dc082d76 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/columns.js @@ -141,6 +141,7 @@ export const conditions = [ showname: "文本" } ], + rules: "required|string", viewAttr: 3 }, { @@ -167,5 +168,46 @@ export const conditions = [ 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/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index 0a7b6c4d..8e2dbd78 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -22,6 +22,8 @@ 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) { @@ -33,7 +35,6 @@ class AttendanceDataComp extends Component { }, dataSource: [], columns: [], - fieldSetList: [], pageInfo: { current: 1, pageSize: 10, @@ -47,7 +48,9 @@ class AttendanceDataComp extends Component { salaryYearMonth: moment().format("YYYY-MM"), salarySobList: [], salarySobId: "", salaryCycle: "", attendCycle: "" }, - fieldSetPayload: { visible: false, title: "", data: [] } + fieldSetPayload: { visible: false, title: "", children: null }, + attendanceReferencePayload: { visible: false, title: "" }, + attendanceViewPayload: { visible: false, attendQuoteId: "", salaryYearMonth: "" } }; } @@ -136,6 +139,16 @@ class AttendanceDataComp extends Component { } }); }; + 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; @@ -208,10 +221,15 @@ class AttendanceDataComp extends Component { this.setState({ loading: { ...loading, headset: false } }); if (status) { this.setState({ - fieldSetList: data, fieldSetPayload: { ...fieldSetPayload, - visible: true, title: "导入字段设置", data + visible: true, title: "导入字段设置", + children: this.setItemRef = dom} + dataSource={data} + onSelectGroupAll={this.handleSelectGroupAll} + onSelectItem={this.handleSelectItem} + /> } }); } @@ -222,121 +240,35 @@ class AttendanceDataComp extends Component { this.setState({ fieldSetPayload: { ...fieldSetPayload, - visible: false, title: "", data: [] + visible: false, title: "", children: null } }); }; - handleSearchItemSet = (val) => { - const { fieldSetPayload, fieldSetList } = this.state; - this.setState({ - fieldSetList: _.map(_.cloneDeep(fieldSetList), item => { - return { - ...item, - items: _.filter(item.items || [], child => { - return child.name.indexOf(val) !== -1; - }) - }; - }), - fieldSetPayload: { - ...fieldSetPayload, - data: _.map(_.cloneDeep(fieldSetList), item => { - return { - ...item, - items: _.filter(item.items || [], child => { - return child.name.indexOf(val) !== -1; - }) - }; - }) - } - }); + 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); + /* + * Author: 黎永顺 + * Description: 考勤数据引用 + * Params: + * Date: 2023/3/7 + */ + handleQuoteAttendanceData = (payload) => { + const { attendanceReferencePayload } = this.state; + this.setState({ attendanceReferencePayload: { ...attendanceReferencePayload, ...payload } }); }; - handleShowOnlyChecked = (checked) => { - const { fieldSetPayload, fieldSetList } = this.state; - if (!!Number(checked)) { - this.setState({ - fieldSetPayload: { - ...fieldSetPayload, - data: _.map(_.cloneDeep(fieldSetList), item => { - return { - ...item, - items: _.filter(item.items || [], child => !!child.checked) - }; - }) - } - }); - } else { - this.setState({ - fieldSetPayload: { - ...fieldSetPayload, - data: _.cloneDeep(fieldSetList) - } - }); - } - }; - handleSelectGroupAll = (groupId, checked) => { - const { fieldSetPayload, fieldSetList } = this.state; - this.setState({ - fieldSetList: _.map(_.cloneDeep(fieldSetList), item => { - if (groupId === item.groupId) { - return { - ...item, - items: _.map(item.items || [], child => { - return { ...child, checked: !!Number(checked) }; - }) - }; - } - return { ...item }; - }), - fieldSetPayload: { - ...fieldSetPayload, - data: _.map(_.cloneDeep(fieldSetList), item => { - if (groupId === item.groupId) { - return { - ...item, - items: _.map(item.items || [], child => { - return { ...child, checked: !!Number(checked) }; - }) - }; - } - return { ...item }; - }) - } - }); - }; - handleSelectItem = (id, checked) => { - const { fieldSetPayload, fieldSetList } = this.state; - this.setState({ - fieldSetList: _.map(_.cloneDeep(fieldSetList), item => { - return { - ...item, - items: _.map(item.items || [], child => { - if (id === child.id) { - return { ...child, checked: !!Number(checked) }; - } - return { ...child }; - }) - }; - }), - fieldSetPayload: { - ...fieldSetPayload, - data: _.map(_.cloneDeep(fieldSetList), item => { - return { - ...item, - items: _.map(item.items || [], child => { - if (id === child.id) { - return { ...child, checked: !!Number(checked) }; - } - return { ...child }; - }) - }; - }) - } + handleCloseQuoteModal = (isRefresh) => { + const { attendanceReferencePayload } = this.state; + this.setState({ attendanceReferencePayload: { ...attendanceReferencePayload, visible: false } }, () => { + isRefresh && this.getAttendanceList(); }); }; render() { const { - dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload + dataSource, columns, pageInfo, loading, importData, importFormPayload, fieldSetPayload, + attendanceReferencePayload, attendanceViewPayload } = this.state; const { showOperateBtn, salaryYearMonth } = this.props; const pagination = { @@ -368,7 +300,7 @@ class AttendanceDataComp extends Component { render: (_, record) => { return (
    - 查看 + this.handleViewAttendanceData(record)}>查看 {showOperateBtn && this.handleDeleteAttendanceData(record)}>删除 } @@ -395,17 +327,27 @@ class AttendanceDataComp extends Component { /> {/* 表头设置 */} - } onCancel={this.handleCloseSettings} onSearchItemSet={this.handleSearchItemSet} onShowOnlyChecked={this.handleShowOnlyChecked} /> + {/* 考勤数据引用 */} + + {/* 考勤数据查看 */} + this.setState({ + attendanceViewPayload: { + ...attendanceViewPayload, + visible: false, + attendQuoteId: "" + } + })} + /> ); } 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..3b96d14b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js @@ -0,0 +1,114 @@ +/* + * 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, getLedgerList, syncAttendanceRefer } from "../../../../apis/attendance"; +import "./index.less"; + +@inject("attendanceStore") +@observer +class AttendanceRefrenceDataModal extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + condition: [] + }; + } + + 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(); + }; + + render() { + const { condition, loading } = 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/index.less b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less index d5773f1b..6e340057 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/index.less @@ -3,6 +3,10 @@ width: 100%; } + .wea-date-picker { + width: 100%; + } + .wea-select { display: inline-block; position: relative; @@ -17,3 +21,33 @@ .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/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 60d168b9..4e5d734f 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -62,6 +62,11 @@ class Index extends Component { columns: [], slideDataSource: [], importResult: [] }); } + handleQuoteAttendanceData= ()=>{ + this.attendanceTableRef.handleQuoteAttendanceData({ + visible: true, title: "引用考勤数据" + }); + } render() { const { selectedKey, salaryMonth, fieldName } = this.state; @@ -71,7 +76,7 @@ class Index extends Component { { title: "字段管理", viewcondition: "FIELD" } ]; const buttons = selectedKey === "DATA" ? [ - , + , ] : []; return ( diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index 8bc06c0e..3f3d2912 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -4,4 +4,5 @@ import { WeaForm } from "comsMobx"; export class AttendanceStore { @observable form = new WeaForm(); + @observable refenceform = new WeaForm(); } From 72959ca0157e760ae85df5bd9936b4e1ff229fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 8 Mar 2023 13:54:27 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectItemsModal/selectItemsWrapper.js | 114 ++++++++---------- 1 file changed, 47 insertions(+), 67 deletions(-) diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js index 25c7e550..9984ac9f 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js @@ -11,95 +11,75 @@ class SelectItemsWrapper extends Component { constructor(props) { super(props); this.state = { - list: [], - filterList: [] + searchVal: "", + selectItem: [], + groupItem: [], + showOnlyChecked: false }; } - componentDidMount() { - this.setState({ - list: this.props.dataSource - }); - } - - handleSearchItemSet = (val) => { - const { dataSource } = this.props; - this.setState({ - filterList: _.map(dataSource, item => { - return { - ...item, - items: _.filter(item.items || [], child => child.name.indexOf(val) !== -1) - }; - }) - }); - }; - handleShowOnlyChecked = (checked) => { - const { dataSource } = this.props; - const { list } = this.state; - if (!!Number(checked)) { - this.setState({ - list: _.map(list, item => { - return { - ...item, - items: _.filter(item.items || [], child => !!child.checked) - }; - }) - }); - } else { - this.setState({ list: dataSource }); - } - }; + handleSearchItemSet = (searchVal) => this.setState({ searchVal }); + handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) }); handleSelectGroupAll = (groupId, checked) => { - const { list, filterList } = this.state; - const key = !_.isEmpty(filterList) ? "filterList" : "list"; - this.setState({ - [key]: _.map(!_.isEmpty(filterList) ? filterList : list, item => { - if (groupId === item.groupId) { - return { - ...item, - items: _.map(item.items || [], child => { - return { ...child, checked: !!Number(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 })); } - return { ...item }; - }) + } }); }; handleSelectItem = (id, checked) => { - const { list, filterList } = this.state; - const key = !_.isEmpty(filterList) ? "filterList" : "list"; + const { selectItem } = this.state; this.setState({ - [key]: _.map(!_.isEmpty(filterList) ? filterList : list, item => { - return { - ...item, - items: _.map(item.items || [], child => { - if (id === child.id) { - return { ...child, checked: !!Number(checked) }; - } - return { ...child }; - }) - }; - }) + selectItem: !!Number(checked) ? [...selectItem, id] : _.xorWith(selectItem, [id], _.isEqual) }); }; renderTitle = (item) => { const { onSelectGroupAll } = this.props; - const { groupName, groupId } = item; + const { groupName, groupId, items } = item; + const number = _.filter(items, it => !!it.checked).length; return
    onSelectGroupAll(groupId, val)}/> - 已选择0个字段 + 已选择{number}个字段
    ; }; render() { - const { list, filterList } = this.state; - const { onSelectItem } = this.props; - console.log("filterList", filterList); + 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) }; + }); + } + console.log(setItemList); return ( { - _.map(!_.isEmpty(filterList) ? filterList : list, item => { + _.map(setItemList, item => { const { items } = item; return
    From 75008876604d10d2adb19a31a1693a4f1aafb7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 8 Mar 2023 15:03:08 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/selectItemsModal/index.js | 11 ++-- .../selectItemsModal/selectItemsWrapper.js | 13 +++- .../components/attendanceDataComp.js | 65 ++++++++++++++++++- 3 files changed, 82 insertions(+), 7 deletions(-) diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/index.js b/pc4mobx/hrmSalary/components/selectItemsModal/index.js index 7b8ca17a..b7d01a5d 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/index.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/index.js @@ -27,21 +27,24 @@ export default class SelectItemModal extends React.Component { render() { const { searchValue } = this.state; - const { title, onSearchItemSet, onShowOnlyChecked, children, ...extra } = this.props; - const btns = []; + const { + title, onSearchItemSet, onShowOnlyChecked, children, + onMoreOpts, onSave, ...extra + } = this.props; + const btns = []; const moreBtn = { datas: [ { key: "recovery", content: "恢复默认设置", icon: , - onClick: key => alert(`点击事物处理函数接受的实参为 ${key}`) + onClick: key => onMoreOpts(key) }, { key: "setting", content: "设为默认设置", icon: , - onClick: key => alert(`点击事物处理函数接受的实参为 ${key}`) + onClick: key => onMoreOpts(key) } ] }; diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js index 9984ac9f..1a0d44d0 100644 --- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js +++ b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrapper.js @@ -18,6 +18,15 @@ class SelectItemsWrapper extends Component { }; } + componentDidMount() { + const { dataSource } = this.props + this.setState({ + selectItem: _.map(_.filter(_.reduce(dataSource, (pre, cur) => { + return [...pre, ...cur.items]; + }, []), item => !!item.checked), it => it.id) + }); + } + handleSearchItemSet = (searchVal) => this.setState({ searchVal }); handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) }); handleSelectGroupAll = (groupId, checked) => { @@ -47,8 +56,9 @@ class SelectItemsWrapper extends Component { 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)}/> + onSelectGroupAll(groupId, val)}/> 已选择{number}个字段
    ; }; @@ -75,7 +85,6 @@ class SelectItemsWrapper extends Component { return { ...item, items: _.filter(item.items, it => !!it.checked) }; }); } - console.log(setItemList); return ( { diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js index 8e2dbd78..6f58700a 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceDataComp.js @@ -14,7 +14,10 @@ import { getLedgerList, getSalaryCycleAndAttendCycle, importAttendQuoteData, - previewAttendQuote + previewAttendQuote, + returnToAttendanceFieldSettingDefault, + saveAttendanceFieldSetting, + saveAttendanceFieldSettingAsDefault } from "../../../../apis/attendance"; import ImportModal from "../../../../components/importModal"; import HeaderSet from "../../../../components/importModal/headerSet"; @@ -248,6 +251,65 @@ class AttendanceDataComp extends Component { 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: 考勤数据引用 @@ -330,6 +392,7 @@ class AttendanceDataComp extends Component { onCancel={this.handleCloseSettings} onSearchItemSet={this.handleSearchItemSet} onShowOnlyChecked={this.handleShowOnlyChecked} + onMoreOpts={this.handleMoreOpts} onSave={this.handleSave} /> {/* 考勤数据引用 */} Date: Wed, 8 Mar 2023 18:35:27 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86-?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E5=BC=95=E7=94=A8=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/selectItemsModal/index11.js | 93 -- .../selectItemsWrappercopy.js | 78 -- .../components/attendanceRefrenceDataModal.js | 124 ++- .../attendance/editSlideContent.js | 103 -- .../attendance/editSlideContent.less | 26 - .../attendance/headerSetModal.js | 14 - .../dataAcquisition/attendance/indexcopy.js | 921 ------------------ .../attendance/itemMangeFormModal.js | 124 --- .../attendance/refereAttendFormModal.js | 198 ---- 9 files changed, 120 insertions(+), 1561 deletions(-) delete mode 100644 pc4mobx/hrmSalary/components/selectItemsModal/index11.js delete mode 100644 pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.less delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/headerSetModal.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/itemMangeFormModal.js delete mode 100644 pc4mobx/hrmSalary/pages/dataAcquisition/attendance/refereAttendFormModal.js diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/index11.js b/pc4mobx/hrmSalary/components/selectItemsModal/index11.js deleted file mode 100644 index 27cc02a7..00000000 --- a/pc4mobx/hrmSalary/components/selectItemsModal/index11.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Author: 黎永顺 - * Description: - * Date: 2022-05-19 15:18:09 - * 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" - - -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); - this.state = { - searchValue: "" - }; - } - - 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") { - - } - } - - render() { - const menu = ( - this.handleMenuClick(e)}> - 恢复默认设置 - 设置默认设置 - {/* 操作日志 */} - - ); - return ( - { - this.props.onSave(); - }}>保存, - 更多 - ]} - > -
    - { - this.setState({ searchValue: value }); - }} - onSearch={(value) => { - this.props.onSearch(value); - }} - /> -
    - {this.props.children} -
    - { - this.handleShowChecked(value); - }}/> -
    -
    - ); - } -} diff --git a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js b/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js deleted file mode 100644 index b29f38b8..00000000 --- a/pc4mobx/hrmSalary/components/selectItemsModal/selectItemsWrappercopy.js +++ /dev/null @@ -1,78 +0,0 @@ -import React from "react"; -import { WeaCheckbox } from "ecCom"; -import { Col, Icon, Row } from "antd"; - -export default class SelectItemsWrapper extends React.Component { - constructor(props) { - super(props); - this.state = { - showContent: true, - checkStatus: false - }; - } - - handleAllChecked(value) { - value = value == 1 ? true : false; - let items = [...this.props.items]; - items.map(item => { - item.checked = value; - }); - this.setState({ - checkStatus: value - }); - 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; - } - }); - this.props.onChange(items); - } - - render() { - 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); - }}/> - )) - } - -
    - } - -
    - ); - } -} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js index 3b96d14b..2308b556 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/components/attendanceRefrenceDataModal.js @@ -10,7 +10,14 @@ import { WeaDialog } from "ecCom"; import { Button, message } from "antd"; import { reFrenceConditions } from "../columns"; import { getSearchs } from "../../../../util"; -import { checkOperation, getLedgerList, syncAttendanceRefer } from "../../../../apis/attendance"; +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") @@ -20,7 +27,9 @@ class AttendanceRefrenceDataModal extends Component { super(props); this.state = { loading: false, - condition: [] + headerSetLoading: false, + condition: [], + headerSetPayload: { visible: false, title: "", children: null } }; } @@ -92,12 +101,112 @@ class AttendanceRefrenceDataModal extends Component { 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 } = this.state; + const { condition, loading, headerSetLoading, headerSetPayload } = this.state; const { attendanceStore: { refenceform } } = this.props; const buttons = [ - + , + ]; return ( {getSearchs(refenceform, condition, 1)} + {/* 表头设置 */} + ); } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js deleted file mode 100644 index 76d7df05..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/editSlideContent.js +++ /dev/null @@ -1,103 +0,0 @@ -import React from "react"; -import { DatePicker } from "antd"; -import { inject, observer } from "mobx-react"; -import { WeaTable } from "ecCom"; -import "./editSlideContent.less"; - -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/indexcopy.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js deleted file mode 100644 index 3b4727bd..00000000 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/indexcopy.js +++ /dev/null @@ -1,921 +0,0 @@ -import React 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 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"; - -const MonthPicker = DatePicker.MonthPicker; - -@inject("attendanceStore", "taxAgentStore") -@observer -export default class Attendance extends React.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 - }; - 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); - }; - - 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 topTab = [ - { - title: "考勤数据", - viewcondition: "0" - }, - { - title: "字段管理", - viewcondition: "1" - } - ]; - - 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" }); - }; - - 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(); - }} - /> - - { - 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 && - - } - content={ - - } - onClose={() => setSlideVisiable(false)} - showMask={true} - closeMaskOnClick={() => setSlideVisiable(false)} - />} -
    - ); - } -} 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); - }}/> - - - ); - } -}