From e1cc281cff88caf1af43d923863dfec883648a48 Mon Sep 17 00:00:00 2001
From: liyongshun <971387674@qq.com>
Date: Tue, 17 May 2022 18:32:09 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=86=E9=83=A8=E7=BC=96=E5=8F=B7?=
=?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=AE=8C=E6=88=90?=
=?UTF-8?q?50%?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/numberComposition.js | 212 ++++++++++++++++++
.../components/startReservedNumberSet.js | 31 +++
.../components/branchNumSetting/index.js | 94 ++++++++
.../components/branchNumSetting/index.less | 26 +++
pc4mobx/organization/index.js | 2 +
pc4mobx/organization/public/i18n.js | 1 +
6 files changed, 366 insertions(+)
create mode 100644 pc4mobx/organization/components/branchNumSetting/components/numberComposition.js
create mode 100644 pc4mobx/organization/components/branchNumSetting/components/startReservedNumberSet.js
create mode 100644 pc4mobx/organization/components/branchNumSetting/index.js
create mode 100644 pc4mobx/organization/components/branchNumSetting/index.less
diff --git a/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js b/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js
new file mode 100644
index 0000000..42f5943
--- /dev/null
+++ b/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js
@@ -0,0 +1,212 @@
+/*
+ * Author: 黎永顺
+ * Description:
+ * Date: 2022-05-17 16:02:56
+ * LastEditTime: 2022-05-17 18:30:57
+ */
+import React, { Component, Fragment } from "react";
+import { Button } from "antd";
+import {
+ WeaTableEdit,
+ WeaDialog,
+ WeaMoreButton,
+ WeaFormItem,
+ WeaSelect,
+} from "ecCom";
+import { i18n } from "../../../public/i18n";
+import _ from "lodash";
+
+const columns = [
+ {
+ title: "",
+ dataIndex: "numFieldName",
+ key: "numFieldName",
+ colSpan: 1,
+ com: [{ label: "", type: "TEXT" }],
+ width: "20%",
+ },
+ {
+ title: "",
+ dataIndex: "value",
+ useRecord: true,
+ key: "value",
+ com: [{ label: "", type: "INPUT", viewAttr: 2, key: "value" }],
+ colSpan: 1,
+ width: "70%",
+ },
+];
+const dataSource = [
+ // {
+ // com: {
+ // value: [{ key: "value", label: "", type: "TEXT" }],
+ // },
+ // value: "",
+ // numFieldName: "字符串",
+ // numField: "string",
+ // },
+ {
+ value: "",
+ numFieldName: "字符串",
+ numField: "string",
+ },
+ { value: "3", numFieldName: "流水号位数", numField: "number" },
+];
+
+const options = [
+ {
+ key: "string",
+ showname: "字符串",
+ },
+ {
+ key: "year",
+ showname: "当前年份",
+ },
+ {
+ key: "month",
+ showname: "当前月份",
+ },
+ {
+ key: "day",
+ showname: "当前日期",
+ },
+];
+class NumberComposition extends Component {
+ constructor() {
+ super();
+ this.state = {
+ visible: false,
+ numField: "string",
+ numFieldName: "字符串",
+ dataSource,
+ };
+ }
+
+ getRowSelection = (rowSelection) => {
+ const sel = { ...rowSelection };
+ sel.getCheckboxProps = (record) => {
+ return { disabled: record.numField === "number" };
+ };
+ return sel;
+ };
+
+ handleAddTable = () => {
+ this.setState({
+ visible: true,
+ });
+ };
+ handleSave = () => {
+ const { numField, numFieldName, dataSource } = this.state;
+
+ const objWrite = {
+ value: "",
+ numFieldName,
+ numField,
+ };
+ const objView = {
+ com: {
+ value: [{ key: numField, label: "", type: "TEXT" }],
+ },
+ [numField]: "",
+ numFieldName,
+ numField,
+ };
+ this.setState({
+ visible: false,
+ numField: "string",
+ numFieldName: "字符串",
+ dataSource:
+ numField === "year" || numField === "month" || numField === "day"
+ ? [...dataSource, objView]
+ : [...dataSource, objWrite],
+ });
+ };
+ handleDeleteTable = (keys, datas) => {
+ console.log("handleDeleteTable", keys, datas);
+ };
+
+ render() {
+ const { visible, numField, dataSource } = this.state;
+ const buttons = [
+ ,
+ ,
+ ];
+ const stringRow = _.map(
+ _.filter(dataSource, (it) => it.numField === "string"),
+ (item, index) => {
+ return {
+ ...item,
+ numFieldName: `${item.numFieldName}${index + 1}`,
+ };
+ }
+ );
+ const yearRow = _.filter(dataSource, (it) => it.numField === "year");
+ const monthRow = _.filter(dataSource, (it) => it.numField === "month");
+ const dayRow = _.filter(dataSource, (it) => it.numField === "day");
+ const disableRow = _.filter(dataSource, (it) => it.numField === "number");
+
+ return (
+
+
+ {/* 新增弹框 */}
+
+ this.setState({
+ visible: false,
+ })
+ }
+ icon="icon-coms-hrm"
+ iconBgcolor="#217346"
+ title={i18n.label.addNumberField()}
+ visible={visible}
+ hasScroll
+ maxHeight={150}
+ buttons={buttons}>
+
+ {
+ this.setState({ numField, numFieldName });
+ }}
+ />
+
+
+
+ );
+ }
+}
+
+export default NumberComposition;
diff --git a/pc4mobx/organization/components/branchNumSetting/components/startReservedNumberSet.js b/pc4mobx/organization/components/branchNumSetting/components/startReservedNumberSet.js
new file mode 100644
index 0000000..b5cd812
--- /dev/null
+++ b/pc4mobx/organization/components/branchNumSetting/components/startReservedNumberSet.js
@@ -0,0 +1,31 @@
+/*
+ * Author: 黎永顺
+ * Description: 起始编号及预留编号设置
+ * Date: 2022-05-17 15:51:41
+ * LastEditTime: 2022-05-17 16:01:33
+ */
+import React, { Component, Fragment } from "react";
+import { WeaFormItem } from "ecCom";
+
+class StartReservedNumberSet extends Component {
+ render() {
+ return (
+
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default StartReservedNumberSet;
diff --git a/pc4mobx/organization/components/branchNumSetting/index.js b/pc4mobx/organization/components/branchNumSetting/index.js
new file mode 100644
index 0000000..6f3aa56
--- /dev/null
+++ b/pc4mobx/organization/components/branchNumSetting/index.js
@@ -0,0 +1,94 @@
+/*
+ * Author: 黎永顺
+ * Description: 分部编号设置
+ * Date: 2022-05-17 14:30:57
+ * LastEditTime: 2022-05-17 17:18:36
+ */
+import React, { Component } from "react";
+import { Button } from "antd";
+import { WeaTop, WeaFormItem, WeaCheckbox, WeaSearchGroup } from "ecCom";
+import StartReservedNumberSet from "./components/startReservedNumberSet";
+import NumberComposition from "./components/numberComposition";
+import { i18n } from "../../public/i18n";
+import "./index.less";
+
+const btns = [];
+const dropMenuDatas = [
+ {
+ key: "save",
+ disabled: false,
+ icon: ,
+ content: "保存",
+ onClick: (key) => alert(`点击了搜索 key = ${key}`),
+ },
+];
+export default class BranchNumSetting extends Component {
+ constructor() {
+ super();
+ this.state = {
+ checkVal: "0",
+ };
+ }
+
+ componentDidMount() {}
+
+ /**
+ * name:提示文本
+ * return {*}
+ */
+ helpContent = () => {
+ return (
+
+
开启后,可根据设置的分部编号规则自动生成分部编号,涉及场景如下:
+
1.手动新建和手动编辑分部时可选择重新生成编号和选择预留分部编号;
+
2.组织结构导入-添加新分部且分部编号列为空时,会自动生成分部编号;
+
3.导入人员-添加时,新创建的分部可自动生成分部编号;
+
【注意】开启前请先确认分部编号字段已启用!
+
+ );
+ };
+
+ render() {
+ const { checkVal } = this.state;
+ return (
+
+
}
+ iconBgcolor="#217346"
+ buttons={btns}
+ showDropIcon={true}
+ dropMenuDatas={dropMenuDatas}
+ />
+
+
+
+ this.setState({ checkVal })}
+ />
+
+
+ {/* 内容区 */}
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+}
diff --git a/pc4mobx/organization/components/branchNumSetting/index.less b/pc4mobx/organization/components/branchNumSetting/index.less
new file mode 100644
index 0000000..d1ac961
--- /dev/null
+++ b/pc4mobx/organization/components/branchNumSetting/index.less
@@ -0,0 +1,26 @@
+.branch-wapper {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+
+ .branch-content {
+ flex: 1;
+
+ .switch-wrapper {
+ width: 100%;
+ padding: 20px 20% 40px 30%;
+ }
+
+ .numberComposition .ant-table-thead {
+ background: #f7fbfe;
+ }
+
+ .startReservedNumberSet {
+ .icon-coms-Flow-setting {
+ font-size: 16px;
+ cursor: pointer;
+ line-height: 30px;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index a89f3ba..64319ae 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -10,6 +10,7 @@ import Sequence from "./components/sequence/Sequence";
import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend"
+import BranchNumSetting from "./components/branchNumSetting"
import stores from "./stores";
import "./style/index";
@@ -41,6 +42,7 @@ const Routes = (
+
);
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index aae8001..692e234 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -128,6 +128,7 @@ export const i18n = {
newOfficeName: () => getLabel(386246, '新建职务信息'),
editOfficeName: () => getLabel(386247, '编辑职务信息'),
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
+ branchNumSetting: () => getLabel(386246, '分部编号设置'),
From 9303fe3f3c2f0d7b65445e7c72dd899a7bc85a29 Mon Sep 17 00:00:00 2001
From: liyongshun <971387674@qq.com>
Date: Wed, 18 May 2022 13:49:24 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E7=BC=96=E5=8F=B7=E7=BB=84=E6=88=90?=
=?UTF-8?q?=E4=BA=A4=E4=BA=92=E7=9A=84=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/numberComposition.js | 230 ++++++++++++++----
.../branchNumSetting/components/preview.js | 47 ++++
.../components/branchNumSetting/index.less | 43 ++++
3 files changed, 273 insertions(+), 47 deletions(-)
create mode 100644 pc4mobx/organization/components/branchNumSetting/components/preview.js
diff --git a/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js b/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js
index 42f5943..9a6479a 100644
--- a/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js
+++ b/pc4mobx/organization/components/branchNumSetting/components/numberComposition.js
@@ -2,48 +2,23 @@
* Author: 黎永顺
* Description:
* Date: 2022-05-17 16:02:56
- * LastEditTime: 2022-05-17 18:30:57
+ * LastEditTime: 2022-05-18 13:46:29
*/
import React, { Component, Fragment } from "react";
-import { Button } from "antd";
+import { Button, Modal } from "antd";
import {
WeaTableEdit,
WeaDialog,
WeaMoreButton,
WeaFormItem,
WeaSelect,
+ WeaInput,
} from "ecCom";
+import Preview from "./preview";
import { i18n } from "../../../public/i18n";
import _ from "lodash";
-const columns = [
- {
- title: "",
- dataIndex: "numFieldName",
- key: "numFieldName",
- colSpan: 1,
- com: [{ label: "", type: "TEXT" }],
- width: "20%",
- },
- {
- title: "",
- dataIndex: "value",
- useRecord: true,
- key: "value",
- com: [{ label: "", type: "INPUT", viewAttr: 2, key: "value" }],
- colSpan: 1,
- width: "70%",
- },
-];
const dataSource = [
- // {
- // com: {
- // value: [{ key: "value", label: "", type: "TEXT" }],
- // },
- // value: "",
- // numFieldName: "字符串",
- // numField: "string",
- // },
{
value: "",
numFieldName: "字符串",
@@ -81,22 +56,32 @@ class NumberComposition extends Component {
};
}
+ /**
+ * name:复选框禁用
+ * param undefined
+ * return {*}
+ */
getRowSelection = (rowSelection) => {
+ const { dataSource } = this.state;
+ const hasMonthNum = dataSource.some((item) => item.numField === "month");
+ const hasDayNum = dataSource.some((item) => item.numField === "day");
const sel = { ...rowSelection };
sel.getCheckboxProps = (record) => {
- return { disabled: record.numField === "number" };
+ return {
+ disabled:
+ record.numField === "number" ||
+ (hasMonthNum && record.numField === "year") ||
+ (hasDayNum && record.numField === "month"),
+ };
};
return sel;
};
-
- handleAddTable = () => {
- this.setState({
- visible: true,
- });
- };
+ /**
+ * name: 字段保存
+ * return {*}
+ */
handleSave = () => {
const { numField, numFieldName, dataSource } = this.state;
-
const objWrite = {
value: "",
numFieldName,
@@ -110,22 +95,159 @@ class NumberComposition extends Component {
numFieldName,
numField,
};
- this.setState({
- visible: false,
- numField: "string",
- numFieldName: "字符串",
- dataSource:
- numField === "year" || numField === "month" || numField === "day"
- ? [...dataSource, objView]
- : [...dataSource, objWrite],
+ if (numField === "year" || numField === "month" || numField === "day") {
+ const hasYearOrMonthOrDay = _.some(
+ dataSource,
+ (it) => it.numField === numField
+ );
+ const hasYearNum = dataSource.some((item) => item.numField === "year");
+ const hasMonthNum = dataSource.some((item) => item.numField === "month");
+ if (!hasYearOrMonthOrDay) {
+ if (numField === "month" && !hasYearNum) {
+ Modal.warning({
+ title: "信息确认",
+ content: `添加【${numFieldName}】时,请先添加【当前年份】!`,
+ onOk() {},
+ okText: "确认",
+ });
+ return;
+ }
+ if (numField === "day" && (!hasYearNum || !hasMonthNum)) {
+ Modal.warning({
+ title: "信息确认",
+ content: `添加【${numFieldName}】时,请先添加【当前年份】和【当前月份】!`,
+ onOk() {},
+ okText: "确认",
+ });
+ return;
+ }
+ this.setState({
+ visible: false,
+ numField: "string",
+ numFieldName: "字符串",
+ dataSource: [...dataSource, objView],
+ });
+ } else {
+ this.showConfirm();
+ }
+ } else {
+ this.setState({
+ visible: false,
+ numField: "string",
+ numFieldName: "字符串",
+ dataSource: [...dataSource, objWrite],
+ });
+ }
+ };
+ /**
+ * name:年月日字段重复提示
+ * return {*}
+ */
+ showConfirm = () => {
+ const { numFieldName } = this.state;
+ Modal.warning({
+ title: "信息确认",
+ content: `已经添加过一个${numFieldName},请选择其他编号字段!`,
+ footer: [],
+ onOk() {},
+ okText: "确认",
});
};
+ /**
+ * name: 编号字段删除
+ * return {*}
+ */
handleDeleteTable = (keys, datas) => {
- console.log("handleDeleteTable", keys, datas);
+ const { dataSource } = this.state;
+ const stringRow = _.filter(dataSource, (it) => it.numField === "string");
+ const yearRow = _.filter(dataSource, (it) => it.numField === "year");
+ const monthRow = _.filter(dataSource, (it) => it.numField === "month");
+ const dayRow = _.filter(dataSource, (it) => it.numField === "day");
+ const disableRow = _.filter(dataSource, (it) => it.numField === "number");
+ const tmpV = [
+ ...stringRow,
+ ...yearRow,
+ ...monthRow,
+ ...dayRow,
+ ...disableRow,
+ ];
+ this.setState({
+ dataSource: _.filter(tmpV, (it, idx) => !keys.includes(idx)),
+ });
+ };
+
+ handleChangeInput = (value, index) => {
+ const { dataSource } = this.state;
+ const stringRow = _.filter(dataSource, (it) => it.numField === "string");
+ const yearRow = _.filter(dataSource, (it) => it.numField === "year");
+ const monthRow = _.filter(dataSource, (it) => it.numField === "month");
+ const dayRow = _.filter(dataSource, (it) => it.numField === "day");
+ const disableRow = _.filter(dataSource, (it) => it.numField === "number");
+ const tmpV = _.map(
+ [...stringRow, ...yearRow, ...monthRow, ...dayRow, ...disableRow],
+ (it, idx) => ({ ...it, key: idx })
+ );
+ this.setState({
+ dataSource: _.map(tmpV, (it) => {
+ if (it.key === index) {
+ return {
+ ...it,
+ value,
+ };
+ }
+ return { ...it };
+ }),
+ });
};
render() {
const { visible, numField, dataSource } = this.state;
+ const columns = [
+ {
+ title: "",
+ dataIndex: "numFieldName",
+ key: "numFieldName",
+ colSpan: 1,
+ com: [{ label: "", type: "TEXT" }],
+ width: "20%",
+ },
+ {
+ title: "",
+ useRecord: true,
+ dataIndex: "custom",
+ key: "custom",
+ com: [
+ {
+ type: "custom",
+ key: "custom",
+ render: (text, record, index) => {
+ const { numField } = record;
+ if (
+ numField === "year" ||
+ numField === "month" ||
+ numField === "day"
+ ) {
+ return ;
+ }
+ return (
+
+ this.handleChangeInput(value, index, record)
+ }
+ />
+ );
+ },
+ },
+ ],
+ // dataIndex: "value",
+ // key: "value",
+ // com: [{ label: "", type: "INPUT", viewAttr: 2, key: "value" }],
+ colSpan: 1,
+ width: "70%",
+ },
+ ];
const buttons = [