diff --git a/pc4mobx/organization/apis/company.js b/pc4mobx/organization/apis/company.js
index e69de29..5fa5238 100644
--- a/pc4mobx/organization/apis/company.js
+++ b/pc4mobx/organization/apis/company.js
@@ -0,0 +1,77 @@
+
+import {
+ WeaTools
+} from 'ecCom'
+
+export const getSearchList = (params) => {
+ //return WeaTools.callApi('/api/bs/hrmorganization/comp/listComp', 'POST', params);
+ return fetch('/api/bs/hrmorganization/comp/listComp', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+
+// export const deleteTableData = (params) => {
+// return fetch('/api/bs/hrmorganization/level/deleteByIds', {
+// method: 'POST',
+// mode: 'cors',
+// headers: {
+// 'Content-Type': 'application/json'
+// },
+// body: JSON.stringify(params)
+// })
+// }
+
+export const getAdvanceSearchCondition = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/comp/getSearchCondition', 'GET', params);
+}
+
+// export const add = (params) => {
+// return fetch('/api/bs/hrmorganization/level/saveLevel', {
+// method: 'POST',
+// mode: 'cors',
+// headers: {
+// 'Content-Type': 'application/json'
+// },
+// body: JSON.stringify(params)
+// })
+// }
+
+// export const edit = (params) => {
+// return fetch('/api/bs/hrmorganization/level/updateLevel', {
+// method: 'POST',
+// mode: 'cors',
+// headers: {
+// 'Content-Type': 'application/json'
+// },
+// body: JSON.stringify(params)
+// })
+// }
+
+export const updateForbiddenTag = (params) => {
+ return fetch('/api/bs/hrmorganization/comp/updateForbiddenTagById', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+// export const getLevelForm = (params) => {
+// return WeaTools.callApi('/api/bs/hrmorganization/level/getLevelForm', 'GET', params);
+// }
+
+// export const getTabInfo = (params) => {
+// return WeaTools.callApi('/api/bs/hrmorganization/level/getTabInfo', 'GET', params);
+// }
+
+export const getHasRight = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/comp/getHasRight', 'GET', params);
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/apis/group.js b/pc4mobx/organization/apis/group.js
index ffabd63..bb8651c 100644
--- a/pc4mobx/organization/apis/group.js
+++ b/pc4mobx/organization/apis/group.js
@@ -21,7 +21,7 @@ export const getTabInfo = (params) => {
export const getGroupForm = (params) => {
- return WeaTools.callApi('/api/bs/hrmorganization/group/getCompanyFormField', 'GET', params);
+ return WeaTools.callApi('/api/bs/hrmorganization/group/getGroupFormField', 'GET', params);
}
export const getHasRight = (params) => {
diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js
index 5e8fabc..6a631ef 100644
--- a/pc4mobx/organization/components/company/company.js
+++ b/pc4mobx/organization/components/company/company.js
@@ -1,9 +1,383 @@
-import React, { Component } from 'react'
+import React from 'react'
+import * as mobx from 'mobx'
+import {
+ inject,
+ observer,
+} from 'mobx-react'
+import {
+ WeaTop,
+ WeaTab,
+ WeaFormItem,
+ WeaRightMenu,
+ WeaTable
+} from 'ecCom'
+import {
+ Row,
+ Col,
+ Spin,
+ Modal,
+ Button,
+ message,
+ Switch
+} from 'antd'
+import {
+ WeaSwitch,
+ WeaTableNew
+} from 'comsMobx'
+import {
+ i18n
+} from '../../public/i18n';
-export default class Company extends Component {
- render() {
- return (
-
C
- )
- }
-}
+import '../../style/common.less';
+
+import NewAndEditDialog from '../NewAndEditDialog';
+
+
+
+const toJS = mobx.toJS;
+const confirm = Modal.confirm;
+//const WeaTable = WeaTableNew.WeaTable
+
+
+@inject('company')
+@observer
+export default class Company extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillMount() {
+ }
+
+ componentDidMount() {
+ this.init();
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ company
+ } = this.props;
+
+ if (this.props.location.key !== nextProps.location.key) {
+ this.init();
+ }
+ }
+
+ init() {
+ const {
+ company
+ } = this.props;
+ company.getTableInfo();
+ company.getHasRight();
+ }
+
+ getTopMenuBtns() {
+ const {
+ company
+ } = this.props;
+ const {
+ topMenu,
+ selectedRowKeys
+ } = company;
+
+ let btns = [];
+ topMenu.map((item, i) => {
+ if (item.menuFun !== 'batchDelete') {
+ btns.push();
+ } else {
+ btns.push();
+ }
+
+ });
+
+ return btns;
+ }
+
+ handleClick(item) {
+ const {
+ company
+ } = this.props;
+ const {
+ isPanelShow
+ } = company;
+
+ isPanelShow && company.setPanelStatus(false);
+ this[item.menuFun] && this[item.menuFun]();
+ }
+
+ new() {
+ const {
+ company
+ } = this.props;
+
+ // company.setNeDialogTitle(i18n.label.newcompany());
+ // company.setIsNew(true);
+ // company.setVisible(true);
+ // company.getForm();
+ }
+
+ batchDelete() {
+ const {
+ company
+ } = this.props;
+ const {
+ tableStore
+ } = company;
+
+ let keys = toJS(tableStore.selectedRowKeys).toString();
+ company.setIds(keys);
+ this.showConfirm('batchDel');
+ }
+ showConfirm(v) {
+ let _this = this;
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: (v == 'del') ? i18n.confirm.delete() : i18n.confirm.batchDeleteConfirm(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ _this.onOk();
+ },
+ onCancel() {
+ return false;
+ },
+ });
+ }
+ onOk() {
+ const {
+ company
+ } = this.props;
+ company.delete();
+ }
+
+
+ getDropMenuDatas() {
+ const {
+ company
+ } = this.props;
+ const {
+ rightMenu
+ } = company;
+
+ let menus = [];
+ toJS(rightMenu).map((item, index) => {
+ let obj = {
+ key: item.menuFun,
+ icon: ,
+ content: item.menuName,
+ }
+ if (item.menuFun == 'collection' || item.menuFun == 'help' || item.menuFun == 'pageAddress') {
+ obj.disabled = true;
+ }
+ menus.push(obj);
+ })
+ return menus;
+ }
+
+ handleMenuClick(key) {
+ const {
+ company
+ } = this.props;
+ const {
+ isPanelShow
+ } = company;
+
+ isPanelShow && company.setPanelStatus(false);
+ this[key] && this[key]();
+ }
+
+
+
+ onSearchChange(val) {
+ const {
+ company
+ } = this.props;
+ const {
+ form
+ } = company;
+
+ company.setCompanyName(val);
+ !this.isEmptyObject(form.getFormParams()) && company.updateFields(val);
+ }
+
+ reRenderColumns(columns) {
+ let _this = this;
+ columns.forEach((c, index) => {
+ if (c.dataIndex == 'forbiddenTag') {
+ c.render = function (text, record) {
+ return _this.updateForbiddenTag(checked, record.id)} />
+ }
+ };
+ if (c.dataIndex == 'compName') {
+ c.render = function (text, record) {
+ return {text}
+ }
+ }
+ })
+ return columns;
+ }
+
+ updateForbiddenTag(checked, id) {
+ const {
+ company
+ } = this.props;
+ company.updateForbiddenTag(checked, id);
+ }
+
+ doDel(id) {
+ const {
+ company
+ } = this.props;
+ company.setIds(id);
+ this.showConfirm('del');
+ }
+
+
+ handleSave() {
+ // const {
+ // company
+ // } = this.props;
+ // const {
+ // isNew
+ // } = company;
+
+ // isNew && company.save();
+ // !isNew && company.edit();
+ }
+
+ getTabBtn() {
+ const {
+ company
+ } = this.props;
+ const {
+ form
+ } = company;
+
+ const btn = [
+ (),
+ (),
+ (),
+ ];
+
+ return btn;
+ }
+
+ getPanelComponents() {
+ const {
+ company
+ } = this.props;
+ const {
+ searchCondition,
+ form,
+ searchConditionLoading
+ } = company;
+
+ let arr = [];
+ let formParams = form.getFormParams();
+ const {
+ isFormInit
+ } = form;
+
+ isFormInit && searchCondition.map(c => {
+ c.items.map((field, index) => {
+ arr.push(
+
+
+ {}
+
+
+ )
+ })
+ })
+
+ if (searchConditionLoading) {
+ return (
+
+
+
+ )
+ } else {
+ return {
+ if (e.keyCode == 13 && e.target.tagName === "INPUT") {
+ company.getTableInfo();
+ company.setPanelStatus(false)
+ }
+ }}>{arr}
+ }
+
+ }
+
+ //非空判断
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+
+
+ render() {
+
+ const {
+ company
+ } = this.props;
+ const {
+ isPanelShow, companyName, conditionNum, visible, condition, form, tableStore, dataSource, columns
+ } = company;
+
+
+ const rowSelection = {
+ onChange(selectedRowKeys, selectedRows) {
+ company.setSelectedRowKeys(selectedRowKeys);
+
+ },
+ };
+
+
+ return (
+
+
this.handleMenuClick(key)}
+ >
+ }
+ iconBgcolor='#217346'
+ loading={true}
+ buttons={this.getTopMenuBtns()}
+ showDropIcon={true}
+ dropMenuDatas={this.getDropMenuDatas()}
+ onDropMenuClick={(e) => this.handleMenuClick(e)}
+ >
+ company.setPanelStatus(bool)}
+ hideSearchAd={() => company.setPanelStatus(false)}
+ searchsAd={isPanelShow ? this.getPanelComponents() : }
+ advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
+ hasMask={false}
+ buttonsAd={this.getTabBtn()}
+ onSearch={() => company.getTableInfo()}
+ onSearchChange={val => this.onSearchChange(val)}
+ />
+ record.id}
+ dataSource={dataSource} childrenColumnName="children"
+ columns={this.reRenderColumns(columns)}
+ rowSelection={rowSelection}
+ indentSize={15}
+ defaultExpandedRowKeys={[1,2]}
+ />
+
+
+
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index 64319ae..e123cd1 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -10,7 +10,11 @@ import Sequence from "./components/sequence/Sequence";
import Group from "./components/group/Group";
import OfficeManage from "./components/office/officeManage";
import CompanyExtend from "./components/company/CompanyExtend"
+<<<<<<< HEAD
import BranchNumSetting from "./components/branchNumSetting"
+=======
+import Company from "./components/company/company";
+>>>>>>> feature/cl
import stores from "./stores";
import "./style/index";
@@ -42,7 +46,11 @@ const Routes = (
+<<<<<<< HEAD
+=======
+
+>>>>>>> feature/cl
);
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 8b8dcc0..d4230b6 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -129,7 +129,7 @@ export const i18n = {
editOfficeName: () => getLabel(386247, '编辑职务信息'),
newOfficeClassifyName: () => getLabel(386246, '新建职务分类信息'),
branchNumSetting: () => getLabel(386246, '分部编号设置'),
-
+ companyName: () => getLabel(385936, '分部'),
authorizationGroup: () => getLabel(492, '权限组'),
diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js
index 4a179b0..67f8739 100644
--- a/pc4mobx/organization/stores/company.js
+++ b/pc4mobx/organization/stores/company.js
@@ -1,43 +1,231 @@
-import { observable, action, toJS } from "mobx";
-import { WeaForm } from "comsMobx";
-import { WeaTableNew } from "comsMobx";
-import { Modal, message } from "antd";
-import { i18n } from "../public/i18n";
+import {
+ observable,
+ action
+} from 'mobx';
+import * as mobx from 'mobx';
+import * as Api from '../apis/company'; // 引入API接口文件
+import {
+ WeaForm
+} from 'comsMobx';
+import {
+ WeaTableNew
+} from 'comsMobx';
+import {
+ Modal,
+ message,
+} from 'antd'
+import {
+ i18n
+} from '../public/i18n';
-const { TableStore } = WeaTableNew;
+const toJS = mobx.toJS;
+const {
+ TableStore
+} = WeaTableNew;
export class CompanyStore {
- @observable tableStore = new TableStore();
- @observable topMenu = [];
+ @observable topMenu = []
@observable rightMenu = [];
- @observable condition = [];
+ @observable dataSource = [];
+ @observable columns = [];
+ @observable tableStore = new TableStore();
@observable searchCondition = [];
- @observable isEdit = true;
- @observable isNew = true;
@observable isPanelShow = false; //高级搜索面板
- @observable form2 = new WeaForm();
@observable form = new WeaForm();
- @observable form1 = new WeaForm();
- @observable conditionNum = 2;
- @observable ids = ""; //选择行id
+ @observable companyName = '';
+ @observable conditionNum = 8;
+ @observable ids = ''; //选择行id
+ @observable id = ''; //页面跳转参数id
@observable searchConditionLoading = true;
@observable visible = false;
- @observable date = "";
+ @observable companyId = '';
+ @observable selectedRowKeys = '';
+ @observable date = '';
+
+
+ @action
+ getTableInfo() {
+ let params;
+ if (this.isEmptyObject(this.form.getFormParams())) {
+ params = {
+ ...this.form.getFormParams(),
+ //companyName: this.companyName,
+ };
+ } else {
+ params = {
+ ...this.form.getFormParams(),
+ };
+ }
+ Api.getSearchList(params).then(response => {
+ return response.json()
+ }).then(res => {
+ if (res.code === 200) {
+ res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
+ res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
+ } else {
+ message.warning(res.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
+
+ }
+
+ //删除
+ delete() {
+ let params = {
+ ids: this.ids
+ };
+ // Api.deleteTableData(params).then(response => {
+ // return response.json()
+ // }).then(data => {
+ // if (data.code === 200) {
+ // message.success(i18n.message.deleteSuccess());
+ // this.getTableInfo();
+ // } else {
+ // message.warning(data.msg);
+ // }
+ // }).catch(error => {
+ // message.warning(error.msg);
+ // })
+ }
+
+ updateForbiddenTag(checked, id) {
+ let params = {
+ forbiddenTag: checked,
+ id: id
+ }
+ Api.updateForbiddenTag(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+ }
+
+ getSearchCondition() {
+ this.setScLoadingStatus(true);
+ Api.getAdvanceSearchCondition().then(res => {
+ if (res.code === 200) {
+ this.setScLoadingStatus(false);
+ res.data.conditions && this.setSearchCondition(res.data.conditions);
+ res.data.conditions && this.form.initFormFields(res.data.conditions);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+ }
+
+
@action
getHasRight() {
-
+ Api.getHasRight().then(res => {
+ if (res.code === 200) {
+ res.data.rightMenu && this.setRightMenu(res.data.rightMenu);
+ res.data.topMenu && this.setTopMenu(res.data.topMenu);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
}
updateFields(val) {
- this.form2.updateFields({
- schemeName: {
- value: val,
- },
+ this.form.updateFields({
+ companyName: {
+ value: val
+ }
});
}
+ setSearchCondition(condition) {
+ this.searchCondition = condition;
+ }
+
+ setScLoadingStatus(bool) {
+ this.searchConditionLoading = bool;
+ }
+
+ setPanelStatus(bool) {
+ this.isPanelShow = bool;
+ bool && this.getSearchCondition();
+ if (!bool) {
+ this.scLoadingReset();
+ }
+ }
+
+ setCompanyName(val) {
+ this.companyName = val;
+ }
+
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+ setIds(ids) {
+ this.ids = ids;
+ }
+
+ scLoadingReset() {
+ this.searchConditionLoading = true;
+ }
+
+
formReset() {
this.form = new WeaForm();
}
-}
+
+
+ setVisible(bool) {
+ this.visible = bool;
+ this.formReset();
+ !bool && this.dialogLoadingReset();
+ }
+
+
+ setSearchCondition(searchCondition) {
+ this.searchCondition = searchCondition;
+ }
+
+ setCompanyId(companyId) {
+ this.companyId = companyId;
+ }
+
+ setDate(date) {
+ this.date = date;
+ }
+
+ setTopMenu(topMenu) {
+ this.topMenu = topMenu;
+ }
+
+ setRightMenu(rightMenu) {
+ this.rightMenu = rightMenu;
+ }
+
+ setDataSource(dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ setColumns(columns) {
+ this.columns = columns
+ }
+
+ setSelectedRowKeys(selectedRowKeys) {
+ this.selectedRowKeys = selectedRowKeys;
+ }
+
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js
index 7bf098a..8993851 100644
--- a/pc4mobx/organization/stores/companyextend.js
+++ b/pc4mobx/organization/stores/companyextend.js
@@ -4,6 +4,7 @@ import isEmpty from 'lodash/isEmpty'
import { WeaTableNew } from "comsMobx";
import { Modal, message } from "antd";
import { i18n } from "../public/i18n";
+import * as Api from '../apis/company'; // 引入API接口文件
export class CompanyExtendStore {