编号设置部分bug的修改
This commit is contained in:
parent
938e17aaad
commit
2b1093ca1d
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description:
|
||||
* Date: 2022-05-17 16:02:56
|
||||
* LastEditTime: 2022-06-08 16:35:49
|
||||
* LastEditTime: 2022-06-14 14:16:16
|
||||
*/
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { Button, Modal } from "antd";
|
||||
|
|
@ -20,24 +20,6 @@ import { i18n } from "../../../../public/i18n";
|
|||
import _ from "lodash";
|
||||
import "../index.less";
|
||||
|
||||
const options = [
|
||||
{
|
||||
key: "string",
|
||||
showname: "字符串",
|
||||
},
|
||||
{
|
||||
key: "year",
|
||||
showname: "当前年份",
|
||||
},
|
||||
{
|
||||
key: "month",
|
||||
showname: "当前月份",
|
||||
},
|
||||
{
|
||||
key: "day",
|
||||
showname: "当前日期",
|
||||
},
|
||||
];
|
||||
class NumberComposition extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
|
|
@ -88,20 +70,20 @@ class NumberComposition extends Component {
|
|||
dataSource: !_.isEmpty(tmpV)
|
||||
? tmpV
|
||||
: [
|
||||
{
|
||||
id: 1,
|
||||
value: "",
|
||||
strLogo: 1,
|
||||
numFieldName: "字符串1",
|
||||
numField: "string",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: 3,
|
||||
numFieldName: "流水号位数",
|
||||
numField: "number",
|
||||
},
|
||||
],
|
||||
{
|
||||
id: 1,
|
||||
value: "",
|
||||
strLogo: 1,
|
||||
numFieldName: "字符串1",
|
||||
numField: "string",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
value: 3,
|
||||
numFieldName: "流水号位数",
|
||||
numField: "number",
|
||||
},
|
||||
],
|
||||
},
|
||||
() => {
|
||||
onChange && onChange(this.state.dataSource);
|
||||
|
|
@ -141,8 +123,8 @@ class NumberComposition extends Component {
|
|||
const stringRow = _.filter(dataSource, (it) => it.numField === "string"); //字符串列表
|
||||
const maxStrLen = !_.isEmpty(stringRow)
|
||||
? _.sortBy(stringRow, function (o) {
|
||||
return -o.strLogo;
|
||||
})[0].strLogo
|
||||
return -o.strLogo;
|
||||
})[0].strLogo
|
||||
: 0; //字符串列表
|
||||
const maxIdLen = _.sortBy(dataSource, function (o) {
|
||||
return -o.id;
|
||||
|
|
@ -153,7 +135,17 @@ class NumberComposition extends Component {
|
|||
dataSource,
|
||||
(item) => item.numField === "string"
|
||||
);
|
||||
|
||||
if (numField === "subcompany" || numField === "department" || numField === "jobtitles") {
|
||||
if (_.findIndex(dataSource, it => it.numField === numField) !== -1) {
|
||||
Modal.warning({
|
||||
title: "信息确认",
|
||||
content: `已经添加过一个${numFieldName},请选择其他编号字段!`,
|
||||
onOk() { },
|
||||
okText: "确认",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (numField === "year" || numField === "month" || numField === "day") {
|
||||
const hasYearOrMonthOrDay = _.some(
|
||||
dataSource,
|
||||
|
|
@ -166,7 +158,7 @@ class NumberComposition extends Component {
|
|||
Modal.warning({
|
||||
title: "信息确认",
|
||||
content: `添加【${numFieldName}】时,请先添加【当前年份】!`,
|
||||
onOk() {},
|
||||
onOk() { },
|
||||
okText: "确认",
|
||||
});
|
||||
return;
|
||||
|
|
@ -175,7 +167,7 @@ class NumberComposition extends Component {
|
|||
Modal.warning({
|
||||
title: "信息确认",
|
||||
content: `添加【${numFieldName}】时,请先添加【当前年份】和【当前月份】!`,
|
||||
onOk() {},
|
||||
onOk() { },
|
||||
okText: "确认",
|
||||
});
|
||||
return;
|
||||
|
|
@ -297,7 +289,7 @@ class NumberComposition extends Component {
|
|||
title: "信息确认",
|
||||
content: `已经添加过一个${objectData.numFieldName},请选择其他编号字段!`,
|
||||
footer: [],
|
||||
onOk() {},
|
||||
onOk() { },
|
||||
okText: "确认",
|
||||
});
|
||||
};
|
||||
|
|
@ -331,6 +323,7 @@ class NumberComposition extends Component {
|
|||
|
||||
render() {
|
||||
const { visible, objectData, dataSource } = this.state;
|
||||
const { options } = this.props;
|
||||
const { numField, numFieldName } = objectData;
|
||||
const columns = [
|
||||
{
|
||||
|
|
@ -397,9 +390,8 @@ class NumberComposition extends Component {
|
|||
{i18n.button.save()}
|
||||
</Button>,
|
||||
<WeaMoreButton
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaMoreButton@e4f4n1`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaMoreButton@e4f4n1`}
|
||||
/>,
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 预留编号设置
|
||||
* Date: 2022-06-08 09:53:51
|
||||
* LastEditTime: 2022-06-09 16:07:51
|
||||
* LastEditTime: 2022-06-15 11:00:55
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { Row, Col, Spin, Modal, Button, Alert, message } from "antd";
|
||||
|
|
@ -59,24 +59,21 @@ class ReservedNumberSetting extends Component {
|
|||
c.items.map((field, index) => {
|
||||
colList.push(
|
||||
<Col
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_Col@4cc308@${index}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_Col@4cc308@${index}`}
|
||||
span={index % 2 == 0 ? 10 : 11}
|
||||
offset={1}>
|
||||
<div style={{ marginTop: 20 }}>
|
||||
<WeaFormItem
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaFormItem@u6ex85@${index}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaFormItem@u6ex85@${index}`}
|
||||
label={`${field.label}`}
|
||||
labelCol={{ span: `${field.labelcol}` }}
|
||||
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||
{
|
||||
<WeaSwitch
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaSwitch@p7d3td@${index}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaSwitch@p7d3td@${index}`}
|
||||
fieldConfig={field}
|
||||
form={form}
|
||||
/>
|
||||
|
|
@ -128,7 +125,7 @@ class ReservedNumberSetting extends Component {
|
|||
onDeleteReservedNumber &&
|
||||
onDeleteReservedNumber(selectedKeys.join(","));
|
||||
},
|
||||
onCancel: () => {},
|
||||
onCancel: () => { },
|
||||
});
|
||||
};
|
||||
handleAddReservedNumber = () => {
|
||||
|
|
@ -189,17 +186,15 @@ class ReservedNumberSetting extends Component {
|
|||
</div>
|
||||
)}
|
||||
<WeaFormItem
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaFormItem@merei2@${index}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaFormItem@merei2@${index}`}
|
||||
label={`${field.label}`}
|
||||
labelCol={{ span: `${field.labelcol}` }}
|
||||
tipPosition="bottom"
|
||||
wrapperCol={{ span: `${field.fieldcol}` }}>
|
||||
<WeaSwitch
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaSwitch@5r6c5a@${index}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaSwitch@5r6c5a@${index}`}
|
||||
fieldConfig={field}
|
||||
form={reservedForm}
|
||||
formParams={reservedForm.getFormParams()}
|
||||
|
|
@ -216,9 +211,8 @@ class ReservedNumberSetting extends Component {
|
|||
});
|
||||
reservedFormItem.push(
|
||||
<WeaSearchGroup
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaSearchGroup@qaih5l@${i}`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaSearchGroup@qaih5l@${i}`}
|
||||
needTigger={true}
|
||||
title={c.title}
|
||||
showGroup={c.defaultshow}
|
||||
|
|
@ -356,9 +350,8 @@ class ReservedNumberSetting extends Component {
|
|||
]}
|
||||
/>
|
||||
<WeaTable
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTable@b43d3f`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaTable@b43d3f`}
|
||||
comsWeaTableStore={tableStore}
|
||||
hasOrder={true}
|
||||
needScroll={true}
|
||||
|
|
@ -377,18 +370,16 @@ class ReservedNumberSetting extends Component {
|
|||
style={{ width: 640, height: 480 }}
|
||||
buttons={[
|
||||
<Button
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_Button@jd6baw`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_Button@jd6baw`}
|
||||
type="primary"
|
||||
loading={loading}
|
||||
onClick={this.handleSubmitReservedNumber}>
|
||||
{i18n.button.save()}
|
||||
</Button>,
|
||||
<WeaMoreButton
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
}_WeaMoreButton@e4f4n1`}
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaMoreButton@e4f4n1`}
|
||||
/>,
|
||||
]}>
|
||||
{this.getReservedForm()}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,51 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 起始编号设置
|
||||
* Date: 2022-06-07 15:27:43
|
||||
* LastEditTime: 2022-06-09 16:14:32
|
||||
* LastEditTime: 2022-06-15 10:47:55
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaTableEdit, WeaInputNumber } from "ecCom";
|
||||
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) => ({
|
||||
|
|
@ -21,22 +60,81 @@ class StartNumberSetting extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { startNumberInfo } = this.props;
|
||||
const { startDate, endDate } = this.state;
|
||||
const { startNumberInfo, companyInfo } = this.props;
|
||||
const { deptSerial = {}, dateSerial = {}, jobtitlesSerial = {} } = companyInfo;
|
||||
const newColumns = _.map(startNumberInfo.columns, (it) => ({
|
||||
...it,
|
||||
com: [{ type: "INPUTNUMBER", key: it.dataIndex, viewAttr: 3, min: 0 }],
|
||||
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 (
|
||||
<WeaTableEdit
|
||||
draggable={false}
|
||||
showAdd={false}
|
||||
showDelete={false}
|
||||
showCopy={false}
|
||||
getRowSelection={this.getRowSelection}
|
||||
columns={newColumns}
|
||||
datas={startNumberInfo.dataSource}
|
||||
onChange={this.handleChangeTable}
|
||||
/>
|
||||
<Fragment>
|
||||
{dateSerial.enable == '1' && (
|
||||
<div style={{ padding: "20px 30px" }}>
|
||||
<span style={{ width: 100, display: "inline-block" }}>{enumStr[dateSerial.key]}</span>
|
||||
<WeaDatePicker format={format} value={moment(startDate ? startDate : new Date()).format(formatVal)} onChange={val => this.handleDatePickerChange(val, 'startDate')} />
|
||||
<span> — </span>
|
||||
<WeaDatePicker format={format} value={moment(endDate ? endDate : new Date()).format(formatVal)} onChange={val => this.handleDatePickerChange(val, 'endDate')} />
|
||||
</div>
|
||||
)}
|
||||
{
|
||||
(deptSerial.enable == '1' && (deptSerial.key === "SUBCOMPANY" || deptSerial.key === "DEPARTMENT")) && (
|
||||
<div style={{ paddingLeft: 30, marginTop: 20, display: "flex", alignItems: "center" }}>
|
||||
<span style={{ display: "inline-block", width: 100 }}>分部名称</span>
|
||||
<WeaError name='dept' tipPosition='bottom' error={'分部名称必填!'}>
|
||||
<WeaBrowser
|
||||
{...browserProps}
|
||||
title={"分部名称"}
|
||||
type={194}
|
||||
onChange={ids => this.handleBrowserChange(ids, 'subCompanyId')}
|
||||
/>
|
||||
</WeaError>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
(deptSerial.enable == '1' && deptSerial.key === "DEPARTMENT") && (
|
||||
<div style={{ paddingLeft: 30, marginTop: 20, display: "flex", alignItems: "center" }}>
|
||||
<span style={{ display: "inline-block", width: 100 }}>部门名称</span>
|
||||
<WeaError name='dept' tipPosition='bottom' error={'部门名称必填!'}>
|
||||
<WeaBrowser
|
||||
{...browserProps}
|
||||
title={"部门名称"}
|
||||
type={57}
|
||||
onChange={ids => this.handleBrowserChange(ids, 'deptId')}
|
||||
/>
|
||||
</WeaError>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
(jobtitlesSerial.enable == '1' && jobtitlesSerial.key === "JOBTITLES") && (
|
||||
<div style={{ paddingLeft: 30, marginTop: 20, display: "flex", alignItems: "center" }}>
|
||||
<span style={{ display: "inline-block", width: 100 }}>岗位名称</span>
|
||||
<WeaError name='dept' tipPosition='bottom' error={'岗位名称必填!'}>
|
||||
<WeaBrowser
|
||||
{...browserProps}
|
||||
title={"岗位名称"}
|
||||
type={278}
|
||||
onChange={ids => this.handleBrowserChange(ids, 'jobtitlesId')}
|
||||
/>
|
||||
</WeaError>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
<WeaTableEdit
|
||||
draggable={false}
|
||||
showAdd={false}
|
||||
showDelete={false}
|
||||
showCopy={false}
|
||||
getRowSelection={this.getRowSelection}
|
||||
columns={newColumns}
|
||||
datas={startNumberInfo.dataSource}
|
||||
onChange={this.handleChangeTable}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 起始编号及预留编号设置
|
||||
* Date: 2022-05-17 15:51:41
|
||||
* LastEditTime: 2022-06-08 18:03:02
|
||||
* LastEditTime: 2022-06-14 18:29:38
|
||||
*/
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { Button, Modal } from "antd";
|
||||
|
|
@ -47,7 +47,7 @@ class StartReservedNumberSet extends Component {
|
|||
onOk: () => {
|
||||
onSaveStartNumber && onSaveStartNumber();
|
||||
},
|
||||
onCancel: () => {},
|
||||
onCancel: () => { },
|
||||
});
|
||||
};
|
||||
handleClose = () => {
|
||||
|
|
@ -68,6 +68,8 @@ class StartReservedNumberSet extends Component {
|
|||
const { dialogProps, reservedAddVisible } = this.state;
|
||||
const { type } = dialogProps;
|
||||
const {
|
||||
onSet,
|
||||
companyInfo,
|
||||
startNumberInfo,
|
||||
onDeleteReservedNumber,
|
||||
onAddReservedNumber,
|
||||
|
|
@ -104,30 +106,29 @@ class StartReservedNumberSet extends Component {
|
|||
buttons={
|
||||
type === "start"
|
||||
? [
|
||||
<Button
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
<Button
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_Button@jd6baw`}
|
||||
onClick={this.handleSave}
|
||||
type="primary">
|
||||
{i18n.button.save()}
|
||||
</Button>,
|
||||
<WeaMoreButton
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
onClick={this.handleSave}
|
||||
type="primary">
|
||||
{i18n.button.save()}
|
||||
</Button>,
|
||||
<WeaMoreButton
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaMoreButton@e4f4n1`}
|
||||
/>,
|
||||
]
|
||||
/>,
|
||||
]
|
||||
: [
|
||||
<WeaMoreButton
|
||||
ecId={`${
|
||||
(this && this.props && this.props.ecId) || ""
|
||||
<WeaMoreButton
|
||||
ecId={`${(this && this.props && this.props.ecId) || ""
|
||||
}_WeaMoreButton@e4f4n1`}
|
||||
/>,
|
||||
]
|
||||
/>,
|
||||
]
|
||||
}>
|
||||
{type === "start" ? (
|
||||
<StartNumberSetting
|
||||
onSet={onSet}
|
||||
companyInfo={companyInfo}
|
||||
startNumberInfo={startNumberInfo}
|
||||
onChange={this.handleChangeTable}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 分部编号设置
|
||||
* Date: 2022-05-17 14:30:57
|
||||
* LastEditTime: 2022-06-09 15:12:50
|
||||
* LastEditTime: 2022-06-14 18:26:07
|
||||
*/
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
|
@ -16,6 +16,7 @@ import {
|
|||
WeaHelpfulTip,
|
||||
} from "ecCom";
|
||||
import StartReservedNumberSet from "./components/startReservedNumberSet";
|
||||
import { serialFieldOptions } from "../constants";
|
||||
import NumberComposition from "./components/numberComposition";
|
||||
import { i18n } from "../../../public/i18n";
|
||||
import moment from "moment";
|
||||
|
|
@ -114,15 +115,18 @@ export default class BranchNumSetting extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
handleSetNumber = (type) => {
|
||||
handleSetNumber = (type, data = {}) => {
|
||||
this.handleSubmit().then((res) => {
|
||||
const { numberSet } = this.props;
|
||||
const { subCompanyInfo } = this.state;
|
||||
const { dateSerial } = subCompanyInfo;
|
||||
if (type === "start") {
|
||||
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||
const payload = {
|
||||
coderuleid: 1,
|
||||
type: "",
|
||||
dateStart: moment().format("YYYY"),
|
||||
dateEnd: moment().format("YYYY"),
|
||||
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
|
|
@ -194,7 +198,33 @@ export default class BranchNumSetting extends Component {
|
|||
*/
|
||||
handleAddReservedNumber = () => {
|
||||
const { numberSet } = this.props;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "SUBCOMPANY" });
|
||||
const { reservedForm } = numberSet;
|
||||
const { options } = this.state;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "SUBCOMPANY" }).then(() => {
|
||||
const type = _.get(_.last(options), ['key']);
|
||||
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||
const payload = {
|
||||
coderuleid: 1,
|
||||
type,
|
||||
dateStart: moment().format(format),
|
||||
dateEnd: moment().format(format),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
};
|
||||
numberSet
|
||||
.getStartNumForm(payload)
|
||||
.then(({ api_status, dataSource }) => {
|
||||
if (api_status && !_.isEmpty(dataSource)) {
|
||||
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||
reservedForm.updateFields({
|
||||
currentnumber: {
|
||||
value: currentnumber,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
/**
|
||||
* name: 保存预留设置
|
||||
|
|
@ -293,6 +323,7 @@ export default class BranchNumSetting extends Component {
|
|||
<NumberComposition
|
||||
onChange={this.handleChangeCode}
|
||||
dataSource={details}
|
||||
options={serialFieldOptions}
|
||||
/>
|
||||
</WeaSearchGroup>
|
||||
</div>
|
||||
|
|
@ -316,6 +347,7 @@ export default class BranchNumSetting extends Component {
|
|||
dateSerial: {
|
||||
...dateSerial,
|
||||
enable: isSingle,
|
||||
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -323,7 +355,7 @@ export default class BranchNumSetting extends Component {
|
|||
/>
|
||||
{dateSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={options}
|
||||
options={_.map(options, item => ({ ...item, showname: item.showname.substr(2, 1) }))}
|
||||
value={dateSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
|
|
@ -360,6 +392,7 @@ export default class BranchNumSetting extends Component {
|
|||
ref={(dom) => (this.numberSetRef = dom)}
|
||||
loading={loading}
|
||||
onSet={this.handleSetNumber}
|
||||
companyInfo={subCompanyInfo}
|
||||
startNumberInfo={startNumberInfo}
|
||||
onChange={this.handleChangeTable}
|
||||
onSaveStartNumber={this.handleSubmitStartNumber}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export const serialFieldOptions = [
|
||||
{ key: "string", showname: "字符串" },
|
||||
{ key: "year", showname: "当前年份" },
|
||||
{ key: "month", showname: "当前月份" },
|
||||
{ key: "day", showname: "当前日期" },
|
||||
];
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 部门编号设置
|
||||
* Date: 2022-06-06 09:37:39
|
||||
* LastEditTime: 2022-06-09 15:12:57
|
||||
* LastEditTime: 2022-06-15 09:52:04
|
||||
*/
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
|
@ -17,10 +17,13 @@ import {
|
|||
} from "ecCom";
|
||||
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
|
||||
import NumberComposition from "../branchNumSetting/components/numberComposition";
|
||||
import { serialFieldOptions } from "../constants";
|
||||
import { i18n } from "../../../public/i18n";
|
||||
import moment from "moment";
|
||||
import "../branchNumSetting/index.less";
|
||||
|
||||
const deptSerialFieldOptions = [{ key: 'subcompany', showname: "分部编号" }]
|
||||
|
||||
@inject("numberSet")
|
||||
@observer
|
||||
export default class DeptNumberSet extends Component {
|
||||
|
|
@ -37,6 +40,10 @@ export default class DeptNumberSet extends Component {
|
|||
subCompanyInfo: {
|
||||
details: [],
|
||||
serialenable: "0",
|
||||
deptSerial: {
|
||||
enable: "0",
|
||||
key: "",
|
||||
},
|
||||
dateSerial: {
|
||||
enable: "0",
|
||||
key: "",
|
||||
|
|
@ -53,10 +60,10 @@ export default class DeptNumberSet extends Component {
|
|||
const { numberSet } = this.props;
|
||||
numberSet
|
||||
.getCodeSetting({ serialtype: "DEPARTMENT" })
|
||||
.then(({ api_status, details, serialenable, dateSerial = {} }) => {
|
||||
.then(({ api_status, details, serialenable, dateSerial = {}, deptSerial = {} }) => {
|
||||
if (api_status && !_.isEmpty(details)) {
|
||||
this.setState({
|
||||
subCompanyInfo: { details, serialenable, dateSerial },
|
||||
subCompanyInfo: { details, serialenable, dateSerial, deptSerial },
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -66,7 +73,7 @@ export default class DeptNumberSet extends Component {
|
|||
let promise = new Promise((resolve, reject) => {
|
||||
const { numberSet } = this.props;
|
||||
const { dataSource, subCompanyInfo } = this.state;
|
||||
const { serialenable, dateSerial } = subCompanyInfo;
|
||||
const { serialenable, dateSerial, deptSerial } = subCompanyInfo;
|
||||
const details = _.map(dataSource, (it, showorder) => {
|
||||
const { numField, value: rulevalue } = it;
|
||||
return {
|
||||
|
|
@ -80,6 +87,7 @@ export default class DeptNumberSet extends Component {
|
|||
serialenable,
|
||||
details,
|
||||
dateSerial,
|
||||
deptSerial,
|
||||
serialtype: "DEPARTMENT",
|
||||
}),
|
||||
};
|
||||
|
|
@ -103,7 +111,10 @@ export default class DeptNumberSet extends Component {
|
|||
(it) =>
|
||||
it.numField === "year" ||
|
||||
it.numField === "month" ||
|
||||
it.numField === "day"
|
||||
it.numField === "day" ||
|
||||
it.numField === "subcompany" ||
|
||||
it.numField === "department" ||
|
||||
it.numField === "jobtitles"
|
||||
);
|
||||
this.setState({
|
||||
dataSource: _.cloneDeep(data),
|
||||
|
|
@ -114,28 +125,33 @@ export default class DeptNumberSet extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
handleSetNumber = (type) => {
|
||||
handleSetNumber = (type, data = {}) => {
|
||||
this.handleSubmit().then((res) => {
|
||||
const { numberSet } = this.props;
|
||||
const { subCompanyInfo } = this.state;
|
||||
const { dateSerial, deptSerial } = subCompanyInfo;
|
||||
if (type === "start") {
|
||||
const payload = {
|
||||
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||
let payload = {
|
||||
coderuleid: 2,
|
||||
type: "",
|
||||
dateStart: moment().format("YYYY"),
|
||||
dateEnd: moment().format("YYYY"),
|
||||
subCompanyId: "",
|
||||
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||
subCompanyId: data.subCompanyId ? data.subCompanyId : "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
};
|
||||
numberSet
|
||||
.getStartNumForm(payload)
|
||||
.then(({ api_status, columns, dataSource }) => {
|
||||
if (api_status) {
|
||||
this.setState({
|
||||
startNumberInfo: { columns, dataSource },
|
||||
});
|
||||
}
|
||||
});
|
||||
if (deptSerial.enable === '1' && !data.subCompanyId) return
|
||||
if (deptSerial.enable === '1' && data.subCompanyId) {
|
||||
payload = { ...payload, type: payload.type + ',' + deptSerial.key }
|
||||
}
|
||||
numberSet.getStartNumForm(payload).then(({ api_status, columns, dataSource }) => {
|
||||
if (api_status) {
|
||||
this.setState({
|
||||
startNumberInfo: { columns, dataSource },
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
numberSet.getAdvanceSearchCondition();
|
||||
numberSet.getSearchReservedCodeList({
|
||||
|
|
@ -194,7 +210,33 @@ export default class DeptNumberSet extends Component {
|
|||
*/
|
||||
handleAddReservedNumber = () => {
|
||||
const { numberSet } = this.props;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "DEPARTMENT" });
|
||||
const { reservedForm } = numberSet;
|
||||
const { options } = this.state;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "DEPARTMENT" }).then(() => {
|
||||
const type = _.get(_.last(options), ['key']);
|
||||
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||
const payload = {
|
||||
coderuleid: 2,
|
||||
type,
|
||||
dateStart: moment().format(format),
|
||||
dateEnd: moment().format(format),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
};
|
||||
numberSet
|
||||
.getStartNumForm(payload)
|
||||
.then(({ api_status, dataSource }) => {
|
||||
if (api_status && !_.isEmpty(dataSource)) {
|
||||
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||
reservedForm.updateFields({
|
||||
currentnumber: {
|
||||
value: currentnumber,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
/**
|
||||
* name: 保存预留设置
|
||||
|
|
@ -234,7 +276,7 @@ export default class DeptNumberSet extends Component {
|
|||
render() {
|
||||
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
|
||||
const { numberSet } = this.props;
|
||||
const { details, serialenable, dateSerial } = subCompanyInfo;
|
||||
const { details, serialenable, dateSerial = {}, deptSerial = {} } = subCompanyInfo;
|
||||
const btns = [
|
||||
<Button type="primary" onClick={this.handleSubmit} loading={loading}>
|
||||
保存
|
||||
|
|
@ -290,61 +332,118 @@ export default class DeptNumberSet extends Component {
|
|||
<NumberComposition
|
||||
onChange={this.handleChangeCode}
|
||||
dataSource={details}
|
||||
options={[...serialFieldOptions, ...deptSerialFieldOptions]}
|
||||
/>
|
||||
</WeaSearchGroup>
|
||||
</div>
|
||||
{!_.isEmpty(options) && (
|
||||
<div className="codeNumbering">
|
||||
<WeaSearchGroup title={"编号流水规则"} showGroup>
|
||||
<div className="switch-wrapper">
|
||||
<WeaFormItem
|
||||
label="日期单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-date-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
dateSerial: {
|
||||
...dateSerial,
|
||||
enable: isSingle,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
{dateSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={options}
|
||||
value={dateSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
onChange={(key) =>
|
||||
{
|
||||
!_.isEmpty(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key))) &&
|
||||
<div className="switch-wrapper" style={{ paddingBottom: !_.isEmpty(_.filter(options, item => !["YEAR", "MONTH", "DAY"].includes(item.key))) && 0 }}>
|
||||
<WeaFormItem
|
||||
label="日期单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-date-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
dateSerial: {
|
||||
...dateSerial,
|
||||
key,
|
||||
enable: isSingle,
|
||||
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
{dateSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={_.map(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(2, 1) }))}
|
||||
value={dateSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
onChange={(key) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
dateSerial: {
|
||||
...dateSerial,
|
||||
key,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!_.isEmpty(_.filter(options, item => !["YEAR", "MONTH", "DAY"].includes(item.key))) &&
|
||||
<div className="switch-wrapper">
|
||||
<WeaFormItem
|
||||
label="机构单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={deptSerial.enable ? deptSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
deptSerial: {
|
||||
...deptSerial,
|
||||
enable: isSingle,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
{deptSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={_.map(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(0, 2) }))}
|
||||
value={deptSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
onChange={(key) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
deptSerial: {
|
||||
...deptSerial,
|
||||
key,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后,可选择按分部进行单独流水"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
}
|
||||
</WeaSearchGroup>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -356,6 +455,7 @@ export default class DeptNumberSet extends Component {
|
|||
<StartReservedNumberSet
|
||||
ref={(dom) => (this.numberSetRef = dom)}
|
||||
onSet={this.handleSetNumber}
|
||||
companyInfo={subCompanyInfo}
|
||||
loading={loading}
|
||||
startNumberInfo={startNumberInfo}
|
||||
onChange={this.handleChangeTable}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 岗位编号设置
|
||||
* Date: 2022-06-06 09:37:39
|
||||
* LastEditTime: 2022-06-09 11:31:39
|
||||
* LastEditTime: 2022-06-15 10:27:13
|
||||
*/
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
|
@ -17,6 +17,7 @@ import {
|
|||
} from "ecCom";
|
||||
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
|
||||
import NumberComposition from "../branchNumSetting/components/numberComposition";
|
||||
import { serialFieldOptions } from "../constants";
|
||||
import { i18n } from "../../../public/i18n";
|
||||
import moment from "moment";
|
||||
import "../branchNumSetting/index.less";
|
||||
|
|
@ -114,15 +115,18 @@ export default class PostNumberSet extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
handleSetNumber = (type) => {
|
||||
handleSetNumber = (type, data = {}) => {
|
||||
this.handleSubmit().then(() => {
|
||||
const { numberSet } = this.props;
|
||||
const { subCompanyInfo } = this.state;
|
||||
const { dateSerial } = subCompanyInfo;
|
||||
if (type === "start") {
|
||||
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||
const payload = {
|
||||
coderuleid: 3,
|
||||
type: "",
|
||||
dateStart: moment().format("YYYY"),
|
||||
dateEnd: moment().format("YYYY"),
|
||||
coderuleid: 4,
|
||||
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
|
|
@ -159,7 +163,7 @@ export default class PostNumberSet extends Component {
|
|||
const { numberSet } = this.props;
|
||||
const payload = {
|
||||
datas: JSON.stringify({
|
||||
coderuleid: 3,
|
||||
coderuleid: 4,
|
||||
...this.state.startNumberInfo,
|
||||
}),
|
||||
};
|
||||
|
|
@ -193,7 +197,33 @@ export default class PostNumberSet extends Component {
|
|||
*/
|
||||
handleAddReservedNumber = () => {
|
||||
const { numberSet } = this.props;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "JOBTITLES" });
|
||||
const { reservedForm } = numberSet;
|
||||
const { options } = this.state;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "JOBTITLES" }).then(() => {
|
||||
const type = _.get(_.last(options), ['key']);
|
||||
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||
const payload = {
|
||||
coderuleid: 4,
|
||||
type,
|
||||
dateStart: moment().format(format),
|
||||
dateEnd: moment().format(format),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
};
|
||||
numberSet
|
||||
.getStartNumForm(payload)
|
||||
.then(({ api_status, dataSource }) => {
|
||||
if (api_status && !_.isEmpty(dataSource)) {
|
||||
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||
reservedForm.updateFields({
|
||||
currentnumber: {
|
||||
value: currentnumber,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
/**
|
||||
* name: 保存预留设置
|
||||
|
|
@ -289,6 +319,7 @@ export default class PostNumberSet extends Component {
|
|||
<NumberComposition
|
||||
onChange={this.handleChangeCode}
|
||||
dataSource={details}
|
||||
options={serialFieldOptions}
|
||||
/>
|
||||
</WeaSearchGroup>
|
||||
</div>
|
||||
|
|
@ -312,6 +343,7 @@ export default class PostNumberSet extends Component {
|
|||
dateSerial: {
|
||||
...dateSerial,
|
||||
enable: isSingle,
|
||||
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
@ -319,7 +351,7 @@ export default class PostNumberSet extends Component {
|
|||
/>
|
||||
{dateSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={options}
|
||||
options={_.map(options, item => ({ ...item, showname: item.showname.substr(2, 1) }))}
|
||||
value={dateSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
|
|
@ -355,6 +387,7 @@ export default class PostNumberSet extends Component {
|
|||
<StartReservedNumberSet
|
||||
ref={(dom) => (this.numberSetRef = dom)}
|
||||
onSet={this.handleSetNumber}
|
||||
companyInfo={subCompanyInfo}
|
||||
loading={loading}
|
||||
startNumberInfo={startNumberInfo}
|
||||
onChange={this.handleChangeTable}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 岗位编号设置
|
||||
* Date: 2022-06-06 09:37:39
|
||||
* LastEditTime: 2022-06-09 11:33:03
|
||||
* LastEditTime: 2022-06-15 10:36:30
|
||||
*/
|
||||
import React, { Component, Fragment } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
|
@ -17,9 +17,15 @@ import {
|
|||
} from "ecCom";
|
||||
import StartReservedNumberSet from "../branchNumSetting/components/startReservedNumberSet";
|
||||
import NumberComposition from "../branchNumSetting/components/numberComposition";
|
||||
import { serialFieldOptions } from "../constants";
|
||||
import { i18n } from "../../../public/i18n";
|
||||
import moment from "moment";
|
||||
import "../branchNumSetting/index.less";
|
||||
const resourceSerialFieldOptions = [
|
||||
{ key: 'subcompany', showname: "分部编号" },
|
||||
{ key: 'department', showname: "部门编号" },
|
||||
{ key: 'jobtitles', showname: "岗位编号" }
|
||||
]
|
||||
|
||||
@inject("numberSet")
|
||||
@observer
|
||||
|
|
@ -37,6 +43,14 @@ export default class ResourceNumberSet extends Component {
|
|||
subCompanyInfo: {
|
||||
details: [],
|
||||
serialenable: "0",
|
||||
deptSerial: {
|
||||
enable: "0",
|
||||
key: "",
|
||||
},
|
||||
jobtitlesSerial: {
|
||||
enable: "0",
|
||||
key: "",
|
||||
},
|
||||
dateSerial: {
|
||||
enable: "0",
|
||||
key: "",
|
||||
|
|
@ -53,10 +67,10 @@ export default class ResourceNumberSet extends Component {
|
|||
const { numberSet } = this.props;
|
||||
numberSet
|
||||
.getCodeSetting({ serialtype: "USER" })
|
||||
.then(({ api_status, details, serialenable, dateSerial = {} }) => {
|
||||
.then(({ api_status, details, serialenable, dateSerial = {}, jobtitlesSerial = {}, deptSerial = {} }) => {
|
||||
if (api_status && !_.isEmpty(details)) {
|
||||
this.setState({
|
||||
subCompanyInfo: { details, serialenable, dateSerial },
|
||||
subCompanyInfo: { details, serialenable, dateSerial, jobtitlesSerial, deptSerial },
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -66,7 +80,7 @@ export default class ResourceNumberSet extends Component {
|
|||
let promise = new Promise((resolve, reject) => {
|
||||
const { numberSet } = this.props;
|
||||
const { dataSource, subCompanyInfo } = this.state;
|
||||
const { serialenable, dateSerial } = subCompanyInfo;
|
||||
const { serialenable, dateSerial, jobtitlesSerial, deptSerial } = subCompanyInfo;
|
||||
const details = _.map(dataSource, (it, showorder) => {
|
||||
const { numField, value: rulevalue } = it;
|
||||
return {
|
||||
|
|
@ -80,6 +94,7 @@ export default class ResourceNumberSet extends Component {
|
|||
serialenable,
|
||||
details,
|
||||
dateSerial,
|
||||
jobtitlesSerial, deptSerial,
|
||||
serialtype: "USER",
|
||||
}),
|
||||
};
|
||||
|
|
@ -103,7 +118,10 @@ export default class ResourceNumberSet extends Component {
|
|||
(it) =>
|
||||
it.numField === "year" ||
|
||||
it.numField === "month" ||
|
||||
it.numField === "day"
|
||||
it.numField === "day" ||
|
||||
it.numField === "subcompany" ||
|
||||
it.numField === "department" ||
|
||||
it.numField === "jobtitles"
|
||||
);
|
||||
this.setState({
|
||||
dataSource: _.cloneDeep(data),
|
||||
|
|
@ -114,19 +132,31 @@ export default class ResourceNumberSet extends Component {
|
|||
});
|
||||
};
|
||||
|
||||
handleSetNumber = (type) => {
|
||||
handleSetNumber = (type, data = {}) => {
|
||||
this.handleSubmit().then(() => {
|
||||
const { numberSet } = this.props;
|
||||
const { subCompanyInfo } = this.state;
|
||||
const { dateSerial, deptSerial, jobtitlesSerial } = subCompanyInfo;
|
||||
if (type === "start") {
|
||||
const payload = {
|
||||
coderuleid: 4,
|
||||
type: "",
|
||||
dateStart: moment().format("YYYY"),
|
||||
dateEnd: moment().format("YYYY"),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
const formatVal = dateSerial.key === "YEAR" ? "YYYY" : dateSerial.key === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD";
|
||||
let payload = {
|
||||
coderuleid: 3,
|
||||
type: dateSerial.enable == '1' ? dateSerial.key : '',
|
||||
dateStart: data.startDate ? data.startDate : moment().format(formatVal),
|
||||
dateEnd: data.endDate ? data.endDate : moment().format(formatVal),
|
||||
subCompanyId: data.subCompanyId ? data.subCompanyId : "",
|
||||
deptId: data.deptId ? data.deptId : "",
|
||||
jobtitlesId: data.jobtitlesId ? data.jobtitlesId : "",
|
||||
};
|
||||
if (deptSerial.enable === '1' && deptSerial.key === 'SUBCOMPANY' && !data.subCompanyId) return
|
||||
if (deptSerial.enable === '1' && deptSerial.key === 'DEPARTMENT' && !data.deptId) return
|
||||
if (jobtitlesSerial.enable === '1' && !data.jobtitlesId) return
|
||||
if (deptSerial.enable === '1' && data.subCompanyId) {
|
||||
payload = { ...payload, type: payload.type + ',' + deptSerial.key }
|
||||
}
|
||||
if (jobtitlesSerial.enable === '1' && data.jobtitlesId) {
|
||||
payload = { ...payload, type: payload.type + ',' + jobtitlesSerial.key }
|
||||
}
|
||||
numberSet
|
||||
.getStartNumForm(payload)
|
||||
.then(({ api_status, columns, dataSource }) => {
|
||||
|
|
@ -195,7 +225,33 @@ export default class ResourceNumberSet extends Component {
|
|||
*/
|
||||
handleAddReservedNumber = () => {
|
||||
const { numberSet } = this.props;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "USER" });
|
||||
const { reservedForm } = numberSet;
|
||||
const { options } = this.state;
|
||||
numberSet.getReservedCodeFrom({ serialtype: "USER" }).then(() => {
|
||||
const type = _.get(_.last(options), ['key']);
|
||||
const format = type === "YEAR" ? "YYYY" : type === "MONTH" ? "YYYY-MM" : "YYYY-MM-DD"
|
||||
const payload = {
|
||||
coderuleid: 3,
|
||||
type,
|
||||
dateStart: moment().format(format),
|
||||
dateEnd: moment().format(format),
|
||||
subCompanyId: "",
|
||||
deptId: "",
|
||||
jobtitlesId: "",
|
||||
};
|
||||
numberSet
|
||||
.getStartNumForm(payload)
|
||||
.then(({ api_status, dataSource }) => {
|
||||
if (api_status && !_.isEmpty(dataSource)) {
|
||||
const currentnumber = _.get(_.last(dataSource), ['startnum']);
|
||||
reservedForm.updateFields({
|
||||
currentnumber: {
|
||||
value: currentnumber,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
/**
|
||||
* name: 保存预留设置
|
||||
|
|
@ -235,7 +291,7 @@ export default class ResourceNumberSet extends Component {
|
|||
render() {
|
||||
const { options, subCompanyInfo, loading, startNumberInfo } = this.state;
|
||||
const { numberSet } = this.props;
|
||||
const { details, serialenable, dateSerial } = subCompanyInfo;
|
||||
const { details, serialenable, dateSerial, jobtitlesSerial, deptSerial } = subCompanyInfo;
|
||||
const btns = [
|
||||
<Button type="primary" onClick={this.handleSubmit} loading={loading}>
|
||||
保存
|
||||
|
|
@ -291,61 +347,151 @@ export default class ResourceNumberSet extends Component {
|
|||
<NumberComposition
|
||||
onChange={this.handleChangeCode}
|
||||
dataSource={details}
|
||||
options={[...serialFieldOptions, ...resourceSerialFieldOptions]}
|
||||
/>
|
||||
</WeaSearchGroup>
|
||||
</div>
|
||||
{!_.isEmpty(options) && (
|
||||
<div className="codeNumbering">
|
||||
<WeaSearchGroup title={"编号流水规则"} showGroup>
|
||||
<div className="switch-wrapper">
|
||||
<WeaFormItem
|
||||
label="日期单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-date-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
dateSerial: {
|
||||
...dateSerial,
|
||||
enable: isSingle,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
{dateSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={options}
|
||||
value={dateSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
onChange={(key) =>
|
||||
{
|
||||
!_.isEmpty(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key))) &&
|
||||
<div className="switch-wrapper" style={{ paddingBottom: !_.isEmpty(_.filter(options, item => !["YEAR", "MONTH", "DAY"].includes(item.key))) && 0 }}>
|
||||
<WeaFormItem
|
||||
label="日期单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={dateSerial.enable ? dateSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-date-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
dateSerial: {
|
||||
...dateSerial,
|
||||
key,
|
||||
enable: isSingle,
|
||||
key: isSingle == '0' ? 'YEAR' : dateSerial.key
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
{dateSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={_.map(_.filter(options, item => ["YEAR", "MONTH", "DAY"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(2, 1) }))}
|
||||
value={dateSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
onChange={(key) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
dateSerial: {
|
||||
...dateSerial,
|
||||
key,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后可设置按年、按月或按天单独流水,如设置按年单独流水,那每年的1月1日开始流水号从001开始重新流水。"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!_.isEmpty(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key))) &&
|
||||
<div className="switch-wrapper" style={{ paddingBottom: !_.isEmpty(_.filter(options, item => !["JOBTITLES"].includes(item.key))) && 0 }}>
|
||||
<WeaFormItem
|
||||
label="机构单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={deptSerial.enable ? deptSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
deptSerial: {
|
||||
...deptSerial,
|
||||
enable: isSingle,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
{deptSerial.enable == "1" && (
|
||||
<WeaSelect
|
||||
options={_.map(_.filter(options, item => ["SUBCOMPANY", "DEPARTMENT"].includes(item.key)), it => ({ ...it, showname: it.showname.substr(0, 2) }))}
|
||||
value={deptSerial.key}
|
||||
detailtype={3}
|
||||
supportCancel
|
||||
onChange={(key) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
deptSerial: {
|
||||
...deptSerial,
|
||||
key,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后,可选择按分部进行单独流水"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
!_.isEmpty(_.filter(options, item => ["JOBTITLES"].includes(item.key))) &&
|
||||
<div className="switch-wrapper">
|
||||
<WeaFormItem
|
||||
label="岗位单独流水"
|
||||
labelCol={{ span: 8 }}
|
||||
wrapperCol={{ span: 16 }}>
|
||||
<div className="codeNumbering-operateWapper">
|
||||
<WeaCheckbox
|
||||
value={jobtitlesSerial.enable ? jobtitlesSerial.enable : "0"}
|
||||
display="switch"
|
||||
id="dept-set-switch"
|
||||
onChange={(isSingle) =>
|
||||
this.setState({
|
||||
subCompanyInfo: {
|
||||
...subCompanyInfo,
|
||||
jobtitlesSerial: {
|
||||
...jobtitlesSerial,
|
||||
enable: isSingle,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
<WeaHelpfulTip
|
||||
width={200}
|
||||
title="开启后,可选择按岗位进行单独流水"
|
||||
placement="topLeft"
|
||||
/>
|
||||
</div>
|
||||
</WeaFormItem>
|
||||
</div>
|
||||
}
|
||||
</WeaSearchGroup>
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -357,6 +503,7 @@ export default class ResourceNumberSet extends Component {
|
|||
<StartReservedNumberSet
|
||||
ref={(dom) => (this.numberSetRef = dom)}
|
||||
onSet={this.handleSetNumber}
|
||||
companyInfo={subCompanyInfo}
|
||||
loading={loading}
|
||||
startNumberInfo={startNumberInfo}
|
||||
onChange={this.handleChangeTable}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Author: 黎永顺
|
||||
* Description: 编号设置
|
||||
* Date: 2022-06-07 09:54:46
|
||||
* LastEditTime: 2022-06-09 15:05:37
|
||||
* LastEditTime: 2022-06-14 16:06:31
|
||||
*/
|
||||
import { observable, action } from "mobx";
|
||||
import { WeaForm } from "comsMobx";
|
||||
|
|
@ -46,7 +46,7 @@ export class NumberSetStore {
|
|||
|
||||
@action("新增预留编号表单查询")
|
||||
getReservedCodeFrom(payload) {
|
||||
API.getReservedCodeFrom(payload).then(({ api_status, conditioninfo }) => {
|
||||
return API.getReservedCodeFrom(payload).then(({ api_status, conditioninfo }) => {
|
||||
if (api_status && !_.isEmpty(conditioninfo)) {
|
||||
conditioninfo.map((c) =>
|
||||
c.items.map((item) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue