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(); }