/* * Author: 黎永顺 * Description: 起始编号设置 * Date: 2022-06-07 15:27:43 * LastEditTime: 2022-06-15 10:47:55 */ import React, { Component, Fragment } from "react"; import { WeaTableEdit, WeaInputNumber, WeaDatePicker, WeaBrowser, WeaError } from "ecCom"; import moment from 'moment'; const enumStr = { YEAR: '年', MONTH: '月份', DAY: '日期' } const browserProps = { iconBgcolor: '#217346', icon: 'icon-coms-hrm', isSingle: false, inputStyle: { width: 200 }, viewAttr: 3 } class StartNumberSetting extends Component { constructor() { super(); this.state = { startDate: '', endDate: '', subCompanyId: '', jobtitlesId: "" } } handleDatePickerChange = (val, type) => { this.setState({ [type]: val }, () => { const { startDate, endDate, subCompanyId, jobtitlesId } = this.state; const { onSet } = this.props; onSet('start', { startDate, endDate, subCompanyId, jobtitlesId }) }) } handleBrowserChange = (val, type) => { this.setState({ [type]: val }, () => { const { onSet } = this.props; onSet('start', { ...this.state, [type]: val }) }) } handleChangeTable = (datas) => { const { onChange, startNumberInfo } = this.props; const newColumns = _.map(startNumberInfo.columns, (it) => ({ ...it, com: [{ type: "INPUTNUMBER", key: it.dataIndex, viewAttr: 3, min: 0 }], })); onChange && onChange(newColumns, datas); }; getRowSelection = (rowSelection) => { return null; }; render() { const { startDate, endDate } = this.state; const { startNumberInfo, companyInfo } = this.props; const { deptSerial = {}, dateSerial = {}, jobtitlesSerial = {} } = companyInfo; const newColumns = _.map(startNumberInfo.columns, (it) => ({ ...it, com: [{ type: it.dataIndex === 'startnum' ? "INPUTNUMBER" : "TEXT", key: it.dataIndex, viewAttr: 3, min: 0 }], })); const format = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "yyyy-MM-dd"; const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "yyyy-MM-DD"; return ( {dateSerial.enable == '1' && (
{enumStr[dateSerial.key]} this.handleDatePickerChange(val, 'startDate')} /> this.handleDatePickerChange(val, 'endDate')} />
)} { (deptSerial.enable == '1' && (deptSerial.key === "SUBCOMPANY" || deptSerial.key === "DEPARTMENT")) && (
分部名称 this.handleBrowserChange(ids, 'subCompanyId')} />
) } { (deptSerial.enable == '1' && deptSerial.key === "DEPARTMENT") && (
部门名称 this.handleBrowserChange(ids, 'deptId')} />
) } { (jobtitlesSerial.enable == '1' && jobtitlesSerial.key === "JOBTITLES") && (
岗位名称 this.handleBrowserChange(ids, 'jobtitlesId')} />
) }
); } } export default StartNumberSetting;