Merge branch 'liys_dev' into dev

This commit is contained in:
liyongshun 2022-05-23 17:46:26 +08:00
commit a907ebf6dd
5 changed files with 413 additions and 104 deletions

View File

@ -2,7 +2,7 @@
* Author: 黎永顺 * Author: 黎永顺
* Description: * Description:
* Date: 2022-05-17 16:02:56 * Date: 2022-05-17 16:02:56
* LastEditTime: 2022-05-18 13:46:29 * LastEditTime: 2022-05-18 18:03:07
*/ */
import React, { Component, Fragment } from "react"; import React, { Component, Fragment } from "react";
import { Button, Modal } from "antd"; import { Button, Modal } from "antd";
@ -17,6 +17,7 @@ import {
import Preview from "./preview"; import Preview from "./preview";
import { i18n } from "../../../public/i18n"; import { i18n } from "../../../public/i18n";
import _ from "lodash"; import _ from "lodash";
import "../index.less";
const dataSource = [ const dataSource = [
{ {
@ -324,21 +325,21 @@ class NumberComposition extends Component {
hasScroll hasScroll
maxHeight={150} maxHeight={150}
buttons={buttons}> buttons={buttons}>
<WeaFormItem <div style={{ padding: "20px 20%" }}>
label="编号字段" <WeaFormItem
style={{ padding: "20px 20%" }} label="编号字段"
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}> wrapperCol={{ span: 16 }}>
<WeaSelect <WeaSelect
options={options} options={options}
value={numField} value={numField}
style={{ width: "100%" }} viewAttr={2}
viewAttr={2} onChange={(numField, numFieldName) => {
onChange={(numField, numFieldName) => { this.setState({ numField, numFieldName });
this.setState({ numField, numFieldName }); }}
}} />
/> </WeaFormItem>
</WeaFormItem> </div>
</WeaDialog> </WeaDialog>
</Fragment> </Fragment>
); );

View File

@ -1,101 +1,124 @@
/* const { inject, observer } = mobxReact;
* Author: 黎永顺 const ProductItem = ecodeSDK.imp(ProductItem);
* Description: 分部编号设置 const ProductDialog = ecodeSDK.imp(ProductDialog);
* Date: 2022-05-17 14:30:57 const { toJS } = mobx;
* LastEditTime: 2022-05-18 14:13:24 // const { product } = ecodeSDK.imp(productDataSource);
*/ const { WeaDialog } = ecCom;
import React, { Component, Fragment } from "react"; const { createRef } = 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 = [<Button type="primary">保存</Button>]; @inject("projectStore")
const dropMenuDatas = [ @observer
{ class ProductIndex extends React.Component {
key: "save",
disabled: false,
icon: <i className="icon-coms-Preservation" />,
content: "保存",
onClick: (key) => alert(`点击了搜索 key = ${key}`),
},
];
export default class BranchNumSetting extends Component {
constructor() { constructor() {
super(); super();
this.state = { this.state = {
checkVal: "0", dialogParams: {
visible: false,
productId: "",
},
dialogWidth: 1200,
dialogHeight: 100,
}; };
this.productRef = createRef();
}
componentDidMount() {
window.addEventListener("resize", this.resizeWidthHeight);
this.resizeWidthHeight();
this.init();
}
conponentWillUnmount() {
window.removeEventListener("resize", this.resizeWidthHeight);
} }
componentDidMount() {} resizeWidthHeight = () => {
requestAnimationFrame(() => {
if (!this.productRef.current) {
return;
}
const { offsetWidth, offsetHeight } = this.productRef.current;
this.setState({
dialogWidth: offsetWidth - 100,
// offsetHeight / 2
dialogHeight: 80,
});
});
};
/** init = () => {
* name:提示文本 const {
* return {*} projectStore: { init },
*/ } = this.props;
helpContent = () => { init();
return ( };
<div>
<p>开启后可根据设置的分部编号规则自动生成分部编号涉及场景如下</p> handlePickProduct = async (productId) => {
<p>1.手动新建和手动编辑分部时可选择重新生成编号和选择预留分部编号</p> const {
<p>2.组织结构导入-添加新分部且分部编号列为空时会自动生成分部编号</p> projectStore: { viewProject, init },
<p>3.导入人员-添加时新创建的分部可自动生成分部编号</p> } = this.props;
<p>注意开启前请先确认分部编号字段已启用</p> const { api_status } = await viewProject(productId);
</div> if (api_status) init();
); this.setState({
dialogParams: { ...this.state.dialogParams, visible: true, productId },
});
}; };
render() { render() {
const { checkVal } = this.state; const { dialogParams, dialogHeight, dialogWidth } = this.state;
const {
projectStore: { product },
} = this.props;
return ( return (
<div className="branch-wapper"> <div className="product-demo-wapper" ref={this.productRef}>
<WeaTop <div className="product-container">
title={i18n.label.branchNumSetting()} {_.map(toJS(product), (item, index) => {
icon={<i className="icon-coms-hrm" />} const { id, title, subTitle, products } = item;
iconBgcolor="#217346" return (
buttons={btns} <div className="product-box" key={id}>
showDropIcon={true} {/* <h2 className="product-title">{title}</h2>
dropMenuDatas={dropMenuDatas} <p className="product-subtitle">{subTitle}</p> */}
/> <ProductItem
<div className="branch-content"> products={products}
<div className="switch-wrapper"> onPickProduct={this.handlePickProduct}
<WeaFormItem />
label="分部编号自动生成"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}>
<WeaCheckbox
value={checkVal}
helpfulTip={this.helpContent}
helpfulTipProps={{ placement: "top" }}
display="switch"
id="num-set-switch"
onChange={(checkVal) => this.setState({ checkVal })}
/>
</WeaFormItem>
</div>
{/* 内容区 */}
{checkVal === "1" && (
<Fragment>
<div className="numberComposition">
<WeaSearchGroup title={"编号组成"} showGroup>
<NumberComposition />
</WeaSearchGroup>
</div> </div>
<div className="startReservedNumberSet"> );
<WeaSearchGroup })}
title={"起始编号及预留编号设置"} {/* <a
showGroup href="https://www.e-cology.com.cn/spa/document/index.jsp?id=7258131&router=1#/main/document/detail"
center> target="_blank"
<StartReservedNumberSet /> className="product-link">
</WeaSearchGroup> <span>
</div> 演示
</Fragment> <br />
)} 脚本
</span>
</a> */}
</div> </div>
{/* 弹框 */}
{dialogParams.visible && (
<WeaDialog
onCancel={() => {
this.resizeWidthHeight();
this.setState({
dialogParams: {
...this.state.dialogParams,
visible: false,
productId: "",
},
});
}}
visible={dialogParams.visible}
style={{ width: dialogWidth }}>
<div
className="product-dialog"
style={{ height: dialogHeight + "vh" }}>
<ProductDialog productId={dialogParams.productId} />
</div>
</WeaDialog>
)}
</div> </div>
); );
} }
} }
ecodeSDK.exp(ProductIndex);

View File

@ -0,0 +1,268 @@
/*
* Author: 黎永顺
* Description: 部门管理
* Date: 2022-05-20 08:54:59
* LastEditTime: 2022-05-20 09:34:30
*/
import React, { Component } from "react";
import { inject, observer } from "mobx-react";
import { i18n } from "../../public/i18n";
import { Row, Col, Spin, Modal, Button, message, Switch } from "antd";
import {
WeaTop,
WeaTab,
WeaFormItem,
WeaRightMenu,
WeaLeftRightLayout,
WeaTable,
} from "ecCom";
const data = [
{
key: 1,
name: "a",
age: 32,
address: "我是a",
children: [
{
key: 11,
name: "aa",
age: 33,
address: "我是aa",
},
{
key: 12,
name: "ab",
age: 33,
address: "我是ab",
children: [
{
key: 121,
name: "aba",
age: 33,
address: "我是aba",
},
],
},
{
key: 13,
name: "ac",
age: 33,
address: "我是ac",
children: [
{
key: 131,
name: "aca",
age: 33,
address: "我是aca",
children: [
{
key: 1311,
name: "acaa",
age: 33,
address: "我是acaa",
},
{
key: 1312,
name: "acab",
age: 33,
address: "我是acab",
},
],
},
],
},
],
},
{
key: 2,
name: "b",
age: 32,
address: "我是b",
},
];
@observer
class DepartmentManage extends Component {
constructor(props) {
super(props);
this.state = {};
}
/**
* name: 右击菜单列表
* return {*}
*/
getDropMenuDatas = () => {
let menus = [];
[].map((item, index) => {
let obj = {
key: item.menuFun,
icon: <i className={`${item.menuIcon}`} />,
content: item.menuName,
};
if (
item.menuFun == "collection" ||
item.menuFun == "help" ||
item.menuFun == "pageAddress"
) {
obj.disabled = true;
}
menus.push(obj);
});
return menus;
};
/**
* name: 右键菜单点击的回调
* param undefined
* return {*}
*/
handleMenuClick = (key) => {
// const { officeManageStore } = this.props;
// const { isPanelShow } = officeManageStore;
// isPanelShow && officeManageStore.setPanelStatus(false);
switch (key) {
case "new":
default:
break;
}
};
/**
* name: 顶部操作按钮
* return {*}
*/
getTopMenuBtns = () => {
let btns = [
<Button type="primary">新增</Button>,
<Button type="primary">复制</Button>,
<Button type="primary">批量删除</Button>,
];
// [].map((item, i) => {
// if (item.menuFun !== "batchDelete") {
// btns.push(<Button type="primary">新增</Button>);
// btns.push(<Button type="primary">复制</Button>);
// } else {
// btns.push(
// <Button type="primary" disabled={true}>
// 批量删除
// </Button>
// );
// }
// });
return btns;
};
/**
* name: 搜索面板底部按钮组
* return {*}
*/
getTabBtn = () => {
const btn = [
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@5b3aeb`}
type="primary">
{i18n.button.search()}
</Button>,
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@8acd45`}>
{i18n.button.reset()}
</Button>,
<Button
ecId={`${(this && this.props && this.props.ecId) || ""}_Button@06e592`}>
{i18n.button.cancel()}
</Button>,
];
return btn;
};
/**
* name: 表格内复选框设置
* return {*}
*/
rowSelection = () => {
return {
onChange(selectedRowKeys, selectedRows) {
console.log(
`selectedRowKeys: ${selectedRowKeys}`,
"selectedRows: ",
selectedRows
);
},
onSelect(record, selected, selectedRows) {
console.log(record, selected, selectedRows);
},
onSelectAll(selected, selectedRows, changeRows) {
console.log(selected, selectedRows, changeRows);
},
};
};
render() {
const columns = [
{
title: "姓名",
dataIndex: "name",
key: "name",
width: "40%",
},
{
title: "年龄",
dataIndex: "age",
key: "age",
width: "30%",
},
{
title: "住址",
dataIndex: "address",
key: "address",
width: "30%",
},
];
return (
<div className="depart-wapper">
<WeaRightMenu
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaRightMenu@a3ba4d`}
datas={this.getDropMenuDatas()}
onClick={(key) => this.handleMenuClick(key)}>
<WeaTop
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaTop@7547ff`}
title={i18n.label.departName()}
icon={<i className="icon-coms-hrm" />}
iconBgcolor="#217346"
loading={true}
buttons={this.getTopMenuBtns()}
showDropIcon={true}
dropMenuDatas={this.getDropMenuDatas()}
onDropMenuClick={(e) => this.handleMenuClick(e)}>
<WeaTab
ecId={`${
(this && this.props && this.props.ecId) || ""
}_WeaTab@daa881`}
searchType={["base", "advanced"]}
showSearchAd={false} //标准高级搜索显隐
searchsBaseValue={""} //普通 base input 搜索值外部受控
setShowSearchAd={(bool) => console.log(bool)}
hideSearchAd={() => console.log(false)} //隐藏高级搜索回调
searchsAd={<div></div>} //标准高级搜索条目组
advanceHeight={Math.ceil(2 / 2) * 52 + 20} //高级搜索面板的高度
hasMask={false}
buttonsAd={this.getTabBtn()}
onSearch={() => console.log()} //点搜索按钮时的回调
onSearchChange={(val) => console.log(val)} //在搜索框中输入的文字改变时的回调
/>
<WeaTable
columns={columns}
rowSelection={this.rowSelection}
dataSource={data}
/>
</WeaTop>
</WeaRightMenu>
</div>
);
}
}
export default DepartmentManage;

View File

@ -1,3 +1,9 @@
/*
* Author: 黎永顺
* Description:
* Date: 2022-05-23 17:44:32
* LastEditTime: 2022-05-23 17:46:13
*/
import React from "react"; import React from "react";
import Route from "react-router/lib/Route"; import Route from "react-router/lib/Route";
import { WeaLocaleProvider } from "ecCom"; import { WeaLocaleProvider } from "ecCom";
@ -9,10 +15,10 @@ import JobGrade from "./components/postionrank/JobGrade";
import Sequence from "./components/sequence/Sequence"; import Sequence from "./components/sequence/Sequence";
import Group from "./components/group/Group"; import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage"; import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend" import CompanyExtend from "./components/company/CompanyExtend";
import BranchNumSetting from "./components/branchNumSetting" import BranchNumSetting from "./components/branchNumSetting";
import Company from "./components/company/company"; import Company from "./components/company/company";
import DepartmentManage from "./components/deptment";
import stores from "./stores"; import stores from "./stores";
import "./style/index"; import "./style/index";
@ -43,9 +49,18 @@ const Routes = (
<Route key="sequence" path="sequence" component={Sequence} /> <Route key="sequence" path="sequence" component={Sequence} />
<Route key="group" path="group" component={Group} /> <Route key="group" path="group" component={Group} />
<Route key="officeManage" path="officeManage" component={OfficeManage} /> <Route key="officeManage" path="officeManage" component={OfficeManage} />
<Route key="companyExtend" path="companyExtend/:id" component={CompanyExtend} /> <Route key="companyExtend" path="companyExtend" component={CompanyExtend} />
<Route key="branchNumSetting" path="branchNumSetting" component={BranchNumSetting} /> <Route
key="branchNumSetting"
path="branchNumSetting"
component={BranchNumSetting}
/>
<Route key="company" path="company" component={Company} /> <Route key="company" path="company" component={Company} />
<Route
key="departmentManage"
path="departmentManage"
component={DepartmentManage}
/>
</Route> </Route>
); );

View File

@ -130,6 +130,8 @@ export const i18n = {
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'), newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
branchNumSetting: () => getLabel(386246, '分部编号设置'), branchNumSetting: () => getLabel(386246, '分部编号设置'),
companyName: () => getLabel(385937, '分部'), companyName: () => getLabel(385937, '分部'),
departName: () => getLabel(386246, '部门管理'),
authorizationGroup: () => getLabel(492, '权限组'), authorizationGroup: () => getLabel(492, '权限组'),