From f5afc77283d37250a0faec3dca44ff3d251dfa81 Mon Sep 17 00:00:00 2001
From: Chengliang <1546584672@qq.com>
Date: Thu, 2 Jun 2022 16:51:21 +0800
Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/organization/apis/department.js | 89 +++
.../components/department/NewPopconfirm.js | 92 +++
.../components/department/department.js | 635 ++++++++++++++++++
.../components/department/departmentExtend.js | 282 ++++++++
pc4mobx/organization/components/job/Job.js | 15 +-
pc4mobx/organization/index.js | 5 +-
pc4mobx/organization/public/i18n.js | 4 +-
pc4mobx/organization/stores/company.js | 1 +
pc4mobx/organization/stores/department.js | 457 +++++++++++++
.../organization/stores/departmentextend.js | 235 +++++++
pc4mobx/organization/stores/index.js | 5 +
pc4mobx/organization/stores/job.js | 42 +-
12 files changed, 1825 insertions(+), 37 deletions(-)
create mode 100644 pc4mobx/organization/apis/department.js
create mode 100644 pc4mobx/organization/components/department/NewPopconfirm.js
create mode 100644 pc4mobx/organization/components/department/department.js
create mode 100644 pc4mobx/organization/components/department/departmentExtend.js
create mode 100644 pc4mobx/organization/stores/department.js
create mode 100644 pc4mobx/organization/stores/departmentextend.js
diff --git a/pc4mobx/organization/apis/department.js b/pc4mobx/organization/apis/department.js
new file mode 100644
index 0000000..47ddcd6
--- /dev/null
+++ b/pc4mobx/organization/apis/department.js
@@ -0,0 +1,89 @@
+
+import {
+ WeaTools
+} from 'ecCom'
+
+export const getSearchList = (params) => {
+ return fetch('/api/bs/hrmorganization/dept/listPage', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const deleteTableData = (params) => {
+ return fetch('/api/bs/hrmorganization/dept/deleteByIds', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const getAdvanceSearchCondition = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/dept/getSearchCondition', 'GET', params);
+}
+
+export const getHrmListByJobId = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/job/getHrmListByJobId', 'GET', params);
+}
+
+export const getCopyForm = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/job/getCopyForm', 'GET', params);
+}
+
+export const add = (params) => {
+ return fetch('/api/bs/hrmorganization/dept/saveBaseForm', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const copy = (params) => {
+ return fetch('/api/bs/hrmorganization/job/copyJobItem', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const editResource = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/dept/updateForm', 'POST', params);
+}
+
+export const updateForbiddenTag = (params) => {
+ return fetch('/api/bs/hrmorganization/dept/updateForbiddenTagById', {
+ method: 'POST',
+ mode: 'cors',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(params)
+ })
+}
+
+export const getDeptForm = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/dept/getSaveForm', 'GET', params);
+}
+
+
+export const getDeptExtendForm = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/dept/getDeptBaseForm', 'GET', params);
+}
+
+
+export const getHasRight = (params) => {
+ return WeaTools.callApi('/api/bs/hrmorganization/dept/getHasRight', 'GET', params);
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/components/department/NewPopconfirm.js b/pc4mobx/organization/components/department/NewPopconfirm.js
new file mode 100644
index 0000000..e68370e
--- /dev/null
+++ b/pc4mobx/organization/components/department/NewPopconfirm.js
@@ -0,0 +1,92 @@
+import {
+ WeaDialog,
+ WeaFormItem,
+ WeaNewScroll,
+ WeaSearchGroup,
+ WeaMoreButton,
+} from 'ecCom'
+
+import {
+ Spin,
+ Button,
+} from 'antd'
+
+import {
+ WeaSwitch
+} from 'comsMobx'
+
+import {
+ i18n
+} from '../../public/i18n';
+
+export default class NewPopconfirm extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ width: 700,
+ }
+ }
+
+
+ getForm() {
+ const {
+ condition,
+ form,
+ isFormInit,
+ } = this.props;
+
+ let arr = [];
+ isFormInit && condition.map(c => {
+ c.items.map((field, index) => {
+ arr.push(
+ {}
+ )
+ })
+ })
+ return
{arr}
+ }
+
+ render() {
+ const {
+ title,
+ visible,
+ save,
+ onCancel,
+ loading,
+ height,
+ } = this.props, {
+ width,
+ } = this.state;
+
+ const buttons = [
+ (),
+ ()
+ ];
+
+ return (
+ onCancel()}
+ buttons={buttons}
+ style={{ width: width, height: height }}
+ >
+ {
+ loading ?
+
+
+ : this.getForm()
+ }
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/pc4mobx/organization/components/department/department.js b/pc4mobx/organization/components/department/department.js
new file mode 100644
index 0000000..dccdfe1
--- /dev/null
+++ b/pc4mobx/organization/components/department/department.js
@@ -0,0 +1,635 @@
+/**
+ * @Author: 程亮
+ * @Date: 2022-06-02 09:19:37
+ * @LastEditTime: 2022-06-02 16:41:55
+ * @Description:
+ * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/department.js
+ */
+
+ import React from 'react'
+ import * as mobx from 'mobx'
+ import {
+ inject,
+ observer,
+ } from 'mobx-react'
+ import {
+ WeaTop,
+ WeaTab,
+ WeaFormItem,
+ WeaRightMenu,
+ WeaTable,
+ WeaLeftRightLayout,
+ WeaOrgTree
+ } from 'ecCom'
+ import {
+ Row,
+ Col,
+ Spin,
+ Modal,
+ Button,
+ message,
+ Switch,
+ Menu, Dropdown, Icon
+ } from 'antd'
+ import {
+ WeaSwitch,
+ WeaTableNew
+ } from 'comsMobx'
+ import {
+ i18n
+ } from '../../public/i18n';
+
+ import '../../style/common.less';
+
+ import NewAndEditDialog from '../NewAndEditDialog';
+ import NewWeaTableDialog from '../NewWeaTableDialog';
+import NewPopconfirm from './NewPopconfirm'
+
+ const toJS = mobx.toJS;
+ const confirm = Modal.confirm;
+
+
+ @inject('department')
+ @observer
+ export default class Department extends React.Component {
+ constructor(props) {
+ super(props);
+ }
+
+ componentWillMount() {
+ }
+
+ componentDidMount() {
+ this.init();
+ }
+
+ componentWillReceiveProps(nextProps) {
+ const {
+ department
+ } = this.props;
+
+ if (this.props.location.key !== nextProps.location.key) {
+ this.init();
+ }
+ }
+
+ init() {
+ const {
+ department
+ } = this.props;
+ department.getTableInfo();
+ department.getHasRight();
+ department.getCopyForm();
+ }
+
+ getTopMenuBtns() {
+ const {
+ department
+ } = this.props;
+ const {
+ topMenu,
+ selectedRowKeys
+ } = department;
+
+ let btns = [];
+ topMenu.map((item, i) => {
+ if (item.menuFun === 'batchDelete') {
+ btns.push();
+ } else if (item.menuFun === 'copy') {
+ btns.push();
+ } else {
+ btns.push();
+
+ }
+
+ });
+
+ return btns;
+ }
+
+ handleClick(item) {
+ const {
+ department
+ } = this.props;
+ const {
+ isPanelShow
+ } = department;
+
+ isPanelShow && department.setPanelStatus(false);
+ this[item.menuFun] && this[item.menuFun]();
+ }
+
+ new() {
+ const {
+ department
+ } = this.props;
+
+ department.setNeDialogTitle(i18n.label.deptManage());
+ department.setNewVisible(true);
+ department.getDeptForm();
+
+ }
+
+ //联查岗位
+ select(id) {
+ // const {
+ // department
+ // } = this.props;
+
+ // department.setNeDialogTitle("联查人员");
+ // department.setVisible(true);
+ // department.getHrmTable(id);
+ }
+
+
+ //合并
+ merge(id){
+ const {
+ department
+ } = this.props;
+
+ department.setNeDialogTitle(i18n.label.mergeDept());
+ department.confirmVisible(true);
+ department.getMergeForm();
+ }
+
+ //转移
+ transfer(id) {
+ const {
+ department
+ } = this.props;
+
+ department.setNeDialogTitle(i18n.label.mergeDept());
+ department.confirmVisible(true);
+ department.getTransferForm();
+
+ }
+
+ copy() {
+ const {
+ department
+ } = this.props;
+ const {
+ selectedRowKeys
+ } = department;
+ let keys = toJS(selectedRowKeys).toString();
+ department.setIds(keys);
+ confirm({
+ title: i18n.confirm.defaultTitle(),
+ content: this.getCopyForm(),
+ okText: i18n.button.ok(),
+ cancelText: i18n.button.cancel(),
+ onOk() {
+ department.copy()
+ },
+ onCancel() {
+ return false;
+ },
+ });
+ }
+
+ getCopyForm() {
+ const {
+ department
+ } = this.props;
+ const {
+ copyCondition,
+ form2,
+ } = department;
+ let formParams = form2.getFormParams();
+ const {
+ isFormInit
+ } = form2;
+ let arr = [];
+ isFormInit && copyCondition.map(c => {
+ c.items.map((field, index) => {
+ arr.push(
+
+ {}
+
+ )
+ })
+ })
+ return arr;
+ }
+
+ batchDelete() {
+ const {
+ department
+ } = this.props;
+ const {
+ selectedRowKeys
+ } = department;
+ let keys = toJS(selectedRowKeys).toString();
+ department.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 {
+ department
+ } = this.props;
+ department.delete();
+ }
+
+
+ getDropMenuDatas() {
+ const {
+ department
+ } = this.props;
+ const {
+ rightMenu
+ } = department;
+
+ 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 {
+ department
+ } = this.props;
+ const {
+ isPanelShow
+ } = department;
+
+ isPanelShow && department.setPanelStatus(false);
+ this[key] && this[key]();
+ }
+
+ updateForbiddenTag(checked, id) {
+ const {
+ department
+ } = this.props;
+ department.updateForbiddenTag(checked, id);
+ }
+
+
+
+ onSearchChange(val) {
+ const {
+ department
+ } = this.props;
+ const {
+ form
+ } = department;
+
+ department.setDepartmentName(val);
+ !this.isEmptyObject(form.getFormParams()) && department.updateFields(val);
+ }
+
+
+ reRenderColumns(columns) {
+ const {
+ department
+ } = this.props;
+ 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 == 'deptName') {
+ c.render = function (text, record) {
+ return {
+ window.open(`/spa/organization/static/index.html#/main/organization/departmentExtend/${record.id}`, "_blank")
+ }}>{text}
+ }
+ }
+ if (c.dataIndex == 'operate') {
+ c.className = "wea-table-operates"
+ c.width = 80
+ c.render = function (text, record) {
+ const menu = (
+
+ )
+ return
+
+
+ }
+ }
+ })
+ return columns;
+ }
+
+
+ doDel(id) {
+ const {
+ department
+ } = this.props;
+ department.setIds(id);
+ this.showConfirm('del');
+ }
+
+
+ handleSave() {
+ const {
+ department
+ } = this.props;
+ department.save();
+ }
+
+ getTabBtn() {
+ const {
+ department
+ } = this.props;
+ const {
+ form
+ } = department;
+
+ const btn = [
+ (),
+ (),
+ (),
+ ];
+
+ return btn;
+ }
+
+ getPanelComponents() {
+ const {
+ department
+ } = this.props;
+ const {
+ searchCondition,
+ form,
+ searchConditionLoading
+ } = department;
+
+ 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") {
+ department.getTableInfo();
+ department.setPanelStatus(false)
+ }
+ }}>{arr}
+ }
+
+ }
+
+ //非空判断
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+ //左侧树
+ getTree = () => {
+ const {
+ department
+ } = this.props;
+ const {
+ companysId,
+ } = department
+
+ let tree = (
+ ${i18n.label.organization()}`}
+ treeNodeClick={this.treeNodeClick}
+ expandAllChildrenOnSearch={true}
+ />
+ )
+
+ return tree;
+ }
+
+ treeNodeClick = (event, ids, nodeids, nodes) => {
+ const {
+ department
+ } = this.props;
+ const {
+ form,
+ companysId
+ } = department;
+ const type = event.node.props.type || '0';
+ const id = event.node.props.id || '';
+ let params = {};
+ form.resetConditionValue();
+ department.setPanelStatus(false)
+ // department.tabkey = 'default_3';
+ department.nodeType = type;
+ if (type == '0') {
+ params['virtualtype'] = companysId;
+ }
+ if (type == '1') {
+ params['subcompanyid1'] = id;
+ }
+ if (type == '2') {
+ params['departmentid'] = id;
+ }
+ department.doSearch(params);
+ }
+
+
+
+ render() {
+
+ const {
+ department
+ } = this.props;
+ const {
+ isPanelShow, departmentName, conditionNum, visible, condition, form,
+ tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
+ form1, isEdit, newVisible, jobDataSource, jobColumns, selectedRowKeys, total, current, pageSize, init,
+ defaultShowLeft,confirmVisible,confirmLoading
+ } = department;
+
+ const rowSelection = {
+ onChange(selectedRowKeys, selectedRows) {
+ department.setSelectedRowKeys(selectedRowKeys);
+ },
+ getCheckboxProps: record => ({
+ disabled: record.isUsed === 1, // 配置无法勾选的列
+ }),
+ };
+
+ const pagination = {
+ current: current,
+ pageSize: pageSize,
+ total: total,
+ showSizeChanger: true,
+ showQuickJumper: true,
+ onShowSizeChange(current, pageSize) {
+ },
+ onChange(current) {
+ },
+ showTotal(total) {
+ return `共 ${total} 条`
+ }
+ };
+
+
+ return (
+
+
this.handleMenuClick(key)}
+ >
+ }
+ iconBgcolor='#217346'
+ loading={true}
+ buttons={this.getTopMenuBtns()}
+ showDropIcon={true}
+ dropMenuDatas={this.getDropMenuDatas()}
+ onDropMenuClick={(e) => this.handleMenuClick(e)}
+ >
+
+ department.setPanelStatus(bool)}
+ hideSearchAd={() => department.setPanelStatus(false)}
+ searchsAd={isPanelShow ? this.getPanelComponents() : }
+ advanceHeight={Math.ceil(conditionNum / 2) * 52 + 20}
+ hasMask={false}
+ buttonsAd={this.getTabBtn()}
+ onSearch={() => {
+ department.setCurrent(1);
+ department.setPageSize(10);
+ department.getTableInfo()
+ }}
+ onSearchChange={val => this.onSearchChange(val)}
+ />
+ {
+ init ?
+
+
:
+ record.id} ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@pgmg3x`}
+ loading={loading}
+ dataSource={dataSource} childrenColumnName="children"
+ columns={this.reRenderColumns(columns)}
+ rowSelection={rowSelection}
+ pagination={pagination}
+ onChange={(pagination, filters, sorter) => {
+ department.setCurrent(pagination.current);
+ department.setPageSize(pagination.pageSize);
+ department.getTableInfo();
+ }}
+ indentSize={15}
+ />
+ }
+
+
+
+
department.setVisible(false)}
+ />
+ this.handleSave()}
+ onCancel={() => department.setNewVisible(false)}
+ enable={false} //是否开启字段联动
+ />
+ this.handleSave()}
+ onCancel={() => department.setNewVisible(false)}
+ />
+
+ )
+ }
+ }
\ No newline at end of file
diff --git a/pc4mobx/organization/components/department/departmentExtend.js b/pc4mobx/organization/components/department/departmentExtend.js
new file mode 100644
index 0000000..e54a2cb
--- /dev/null
+++ b/pc4mobx/organization/components/department/departmentExtend.js
@@ -0,0 +1,282 @@
+/**
+ * @Author: 程亮
+ * @Date: 2022-06-02 09:20:03
+ * @LastEditTime: 2022-06-02 11:40:57
+ * @Description:
+ * @FilePath: /trunk/src4js/pc4mobx/organization/components/department/departmentExtend.js
+ */
+
+
+ import { Button, Modal, message, Row, Col, Spin } from 'antd';
+ import isEmpty from 'lodash/isEmpty'
+ import cloneDeep from 'lodash/cloneDeep'
+ import forEach from 'lodash/forEach'
+ import { WeaAlertPage, WeaTools, WeaTableEdit, WeaSearchGroup, WeaRightMenu, WeaFormItem, WeaTab,WeaTop } from 'ecCom'
+ import { WeaSwitch } from 'comsMobx';
+ import { inject, observer } from 'mobx-react';
+ import * as mobx from 'mobx';
+ import { i18n } from '../../public/i18n';
+
+ const toJS = mobx.toJS;
+ import '../../style/common.less';
+
+
+ @inject('departmentExtend')
+ @inject('department')
+ @observer
+ export default class DepartmentExtendStore extends React.Component {
+
+ componentDidMount() {
+ this.init();
+ }
+ init = () => {
+ const { departmentExtend,department } = this.props;
+ let {hash} = window.location;
+ hash = hash.split("?")[0];
+ let id = hash.match("[^/]+(?=/$|$)")[0];
+ departmentExtend.init();
+ departmentExtend.setId(id);
+ departmentExtend.getData();
+ }
+
+ getTabChildren = () => {
+ const { departmentExtend } = this.props;
+ let { tableInfo, isEditor, tabkey, onRowSelect, selectedRowKeys,detailSelectedKey } = departmentExtend;
+ let tabChildren = [];
+ tableInfo = toJS(tableInfo);
+ tableInfo && tableInfo.map((t, i) => {
+ if (detailSelectedKey == i) {
+ tabChildren.push(
+ departmentExtend.setPersonalEditTables(ref)}
+ showTitle={isEditor}
+ // title={'列表信息'}
+ //addFirstRow={isEditor}
+ columns={t.tabinfo.columns}
+ datas={t.tabinfo.datas}
+ onChange={this.tableEditChange}
+ selectedRowKeys={toJS(selectedRowKeys)}
+ onRowSelect={keys => onRowSelect(keys)}
+ onBtnsSelect={key => this.onBtnsSelect(key, i)}
+ viewAttr={isEditor ? 2 : 1}
+ getRowSelection={isEditor ? (rowSelection) => {
+ Object.assign(rowSelection, {
+ getCheckboxProps: record => ({
+ disabled: record.viewAttr === 1, // 配置无法勾选的列
+ })
+ })
+ return rowSelection;
+ } : () => null}
+ />
+ );
+ }
+ })
+ return tabChildren;
+ }
+
+ onBtnsSelect = (key, index) => {
+ const {
+ departmentExtend
+ } = this.props, {
+ tableInfo,
+ selectedRows,
+ setSelectedRowKeys,
+ selectedRowKeys
+ } = departmentExtend;
+
+ const datas = tableInfo[index].tabinfo.datas;
+ if (key === 'copy') {
+ tableInfo[index].tabinfo.datas = datas.map((data, i) => {
+ if (!selectedRows[index].includes(i)) {
+ data.viewAttr = 2;
+ }
+ return data
+ })
+ }
+ if (key === 'delete') {
+ tableInfo[index].tabinfo.datas = datas.map((data, i) => {
+ if (selectedRows[index].includes(i)) {
+ data.viewAttr = 1;
+ }
+ return data
+ });
+ setSelectedRowKeys(selectedRowKeys.filter(row => !selectedRows[index].includes(row)))
+ }
+ }
+
+ getSearchs = () => {
+ const { departmentExtend } = this.props;
+ let { form, conditions, isEditor } = departmentExtend;
+ const { isFormInit } = form;
+ let group = [];
+ let tipPosition = 'bottom';
+ window.e9HideFormFieldKeys = [];
+ isFormInit && conditions.forEach((c, i) => {
+ let items = [];
+ c.items.forEach((field, j) => {
+ if (c.hide || (!isEmpty(field.otherParams) && field.otherParams.hide)) {
+ window.e9HideFormFieldKeys.push(field.domkey[0]);
+ } else {
+ items.push({
+ com: (
+
+ ),
+ colSpan: 1
+ });
+ }
+ });
+ group.push()
+ });
+ return group;
+ }
+
+ tableEditChange = (data) => {
+ const { departmentExtend } = this.props;
+ let { detailSelectedKey = '0', tableInfo } = departmentExtend;
+ tableInfo = toJS(tableInfo);
+ let d = cloneDeep(tableInfo);
+ d[Number(detailSelectedKey)].tabinfo.datas = data;
+ departmentExtend.updateTableInfo(d);
+ }
+
+ getRightMenu = () => {
+ const { departmentExtend } = this.props;
+ const { isEditor, buttons } = departmentExtend;
+ let arr = [];
+ try {
+ if (buttons.hasEdit) {
+ if (isEditor) {
+ arr = [{
+ icon: ,
+ content: i18n.button.save(),
+ key: 'save',
+ onClick: key => {
+ this.saveEditCard();
+ }
+ }, {
+ icon: ,
+ content: i18n.button.back(),
+ key: 'back',
+ onClick: key => {
+ this.backCard();
+ }
+ }]
+ } else {
+ arr = [{
+ icon: ,
+ content: i18n.button.modify(),
+ key: 'editCard',
+ onClick: key => {
+ this.editCard();
+ }
+ }
+ ]
+ }
+ }
+ } catch (e) { }
+ return arr;
+ }
+
+ getTopButtons = () => {
+ const { departmentExtend } = this.props;
+ const { isEditor, buttons } = departmentExtend;
+ const save = ;
+ const back = ;
+ const edit = ;
+ const btns = [];
+ try {
+ if (isEditor) {
+ if (buttons.hasSave) {
+ btns.push(save);
+ btns.push(back);
+ }
+ } else {
+ if (buttons.hasEdit) {
+ btns.push(edit);
+ }
+ }
+ } catch (e) { }
+ return btns;
+ }
+
+ editCard = () => {
+ const { departmentExtend } = this.props;
+ departmentExtend.edit();
+ }
+
+ saveEditCard = () => {
+ const { departmentExtend } = this.props;
+ departmentExtend.save();
+ }
+
+ backCard = () => {
+ this.init();
+ }
+
+ changeData(key) {
+ const {
+ departmentExtend
+ } = this.props;
+ departmentExtend.changeData(key);
+ }
+
+ render() {
+ const { departmentExtend } = this.props;
+ const { loading, tabkey, tabInfo,topTab,selectedKey,date,detailSelectedKey } = departmentExtend;
+
+ try {
+ return (
+
+
+
+
+
+ {this.getSearchs()}
+ {
+ !isEmpty(tabInfo) &&
+ {
+ departmentExtend.updateDetailSelectedKey(v);
+ }}
+ />
+ {this.getTabChildren()}
+
+ }
+
+
+
+
+
+ )
+ } catch (e) {
+ return
+ {i18n.message.authFailed()}
+
+ }
+ }
+ }
+
+
\ No newline at end of file
diff --git a/pc4mobx/organization/components/job/Job.js b/pc4mobx/organization/components/job/Job.js
index ad7a849..f02b16a 100644
--- a/pc4mobx/organization/components/job/Job.js
+++ b/pc4mobx/organization/components/job/Job.js
@@ -1,9 +1,9 @@
/**
* @Author: 程亮
* @Date: 2022-05-26 14:05:59
- * @LastEditTime: 2022-06-01 17:16:00
+ * @LastEditTime: 2022-06-02 15:51:37
* @Description:
- * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/job.js
+ * @FilePath: /trunk/src4js/pc4mobx/organization/components/job/Job.js
*/
import React from 'react'
import * as mobx from 'mobx'
@@ -81,7 +81,7 @@ export default class Job extends React.Component {
} = this.props;
job.getTableInfo();
job.getHasRight();
- job.getCopyForm();
+ job.getCopyForm()
}
getTopMenuBtns() {
@@ -143,12 +143,13 @@ export default class Job extends React.Component {
job.getHrmTable(id);
}
- copy() {
+
+ copy() {
const {
job
} = this.props;
const {
- selectedRowKeys
+ selectedRowKeys,
} = job;
let keys = toJS(selectedRowKeys).toString();
job.setIds(keys);
@@ -485,8 +486,8 @@ export default class Job extends React.Component {
const {
isPanelShow, jobName, conditionNum, visible, condition, form,
tableStore, dataSource, columns, loading, date, nEdialogTitle, dialogLoading,
- form1, isEdit, newVisible, deptDataSource, deptColumns, selectedRowKeys, total, current, pageSize, init,
- defaultShowLeft
+ form1, isEdit, newVisible,selectedRowKeys, total, current, pageSize, init,
+ defaultShowLeft,form2
} = job;
const rowSelection = {
diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js
index 10abab7..fbfbc1b 100644
--- a/pc4mobx/organization/index.js
+++ b/pc4mobx/organization/index.js
@@ -17,6 +17,8 @@ import StaffScheme from "./components/staff/StaffScheme";
import Staff from "./components/staff/Staff";
import Job from "./components/job/Job";
import JobExtend from "./components/job/JobExtend";
+import Department from "./components/department/department";
+import DepartmentExtendStore from "./components/department/departmentExtend";
import stores from "./stores";
import "./style/index";
@@ -51,7 +53,8 @@ const Routes = (
-
+
+
diff --git a/pc4mobx/organization/public/i18n.js b/pc4mobx/organization/public/i18n.js
index 5832fae..b322bdf 100644
--- a/pc4mobx/organization/public/i18n.js
+++ b/pc4mobx/organization/public/i18n.js
@@ -139,7 +139,9 @@ export const i18n = {
jobName: () => getLabel(385936, '岗位'),
newJob: () => getLabel(386246, '新建岗位'),
editJob: () => getLabel(386247, '编辑岗位'),
-
+ deptManage: () => getLabel(385936, '部门管理'),
+ newDept: () => getLabel(386246, '新建部门'),
+ mergeDept:()=> getLabel(386246, '合并部门'),
diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js
index 169abd3..a4e7768 100644
--- a/pc4mobx/organization/stores/company.js
+++ b/pc4mobx/organization/stores/company.js
@@ -130,6 +130,7 @@ export class CompanyStore {
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
+ this.setSelectedRowKeys('');
this.getTableInfo();
} else {
message.warning(data.msg);
diff --git a/pc4mobx/organization/stores/department.js b/pc4mobx/organization/stores/department.js
new file mode 100644
index 0000000..fa19819
--- /dev/null
+++ b/pc4mobx/organization/stores/department.js
@@ -0,0 +1,457 @@
+import {
+ observable,
+ action
+ } from 'mobx';
+ import * as mobx from 'mobx';
+ import * as Api from '../apis/department'; // 引入API接口文件
+ import {
+ WeaForm
+ } from 'comsMobx';
+ import {
+ WeaTableNew
+ } from 'comsMobx';
+ import {
+ Modal,
+ message,
+ } from 'antd'
+ import {
+ i18n
+ } from '../public/i18n';
+
+ const toJS = mobx.toJS;
+ const {
+ TableStore
+ } = WeaTableNew;
+
+
+ export class DepartmentStore {
+ @observable tableStore = new TableStore();
+ @observable topMenu = []
+ @observable rightMenu = [];
+ @observable dataSource = [];
+ @observable columns = [];
+ @observable jobDataSource = [];
+ @observable jobColumns = [];
+ @observable loading = true;
+ @observable dialogLoading = true;
+ @observable isEdit = true;
+ @observable nEdialogTitle = '';
+ @observable searchCondition = [];
+ @observable condition = [];
+ @observable copyCondition = [];
+ @observable isPanelShow = false; //高级搜索面板
+ @observable form = new WeaForm();
+ @observable form1 = new WeaForm(); //新增主表表单
+ @observable form2 = new WeaForm(); //复制表单
+ @observable departmentName = '';
+ @observable conditionNum = 8;
+ @observable ids = ''; //选择行id
+ @observable id = ''; //页面跳转参数id
+ @observable searchConditionLoading = true;
+ @observable visible = false;
+ @observable newVisible = false; //新增弹窗
+ @observable departmentId = '';
+ @observable selectedRowKeys = '';
+ @observable date = '';
+ @observable init = true; //是否首次加载
+ @observable total = '';
+ @observable current = 1;
+ @observable pageSize = 10;
+
+ @observable defaultShowLeft = true;
+ @observable companysId = 1 //集团id
+
+ @observable confirmVisible = false;
+ @observable confirmLoading = true;
+
+
+ @action
+ getTableInfo(params) {
+ this.setLoading(true);
+ params = {
+ ...params,
+ current: this.current,
+ pageSize: this.pageSize
+ }
+ if (this.isEmptyObject(this.form.getFormParams())) {
+ params = {
+ ...params,
+ ...this.form.getFormParams(),
+ departmentName: this.departmentName
+ };
+ } else {
+ params = {
+ ...params,
+ ...this.form.getFormParams(),
+ };
+ }
+ Api.getSearchList(params).then(response => {
+ return response.json()
+ }).then(res => {
+ if (res.code === 200) {
+ res.data.pageInfo.columns && this.setColumns(res.data.pageInfo.columns);
+ this.setTotal(res.data.pageInfo.total);
+ res.data.pageInfo.list && this.setDataSource(res.data.pageInfo.list);
+ this.setLoading(false);
+ this.setInit(false);
+ } else {
+ message.warning(res.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+ }
+
+ @action("nodetree事件")
+ doSearch(params) {
+ this.setInit(true);
+ this.getTableInfo(params);
+ }
+
+ @action("联查人员")
+ getHrmTable(id) {
+ // let params = {
+ // departmentId: id
+ // }
+ // this.tableStore = new TableStore();
+ // Api.getHrmListBydepartmentId(params).then(res => {
+ // if (res.code === 200) {
+ // res.data.datas && this.tableStore.getDatas(res.data.datas, 1);
+ // } else {
+ // message.warning(res.msg);
+ // }
+ // }, 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.setSelectedRowKeys('');
+ 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, 1);
+ } 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);
+ })
+ }
+
+
+ getDeptForm() {
+ let params = {};
+ this.setDialogLoadingStatus(true);
+ Api.getDeptForm(params).then(res => {
+ if (res.code === 200) {
+ this.setDialogLoadingStatus(false);
+ res.data.condition && this.setCondition(res.data.condition);
+ res.data.condition && this.form1.initFormFields(res.data.condition);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+ }
+
+ @action("合并部门")
+ getMergeForm() {
+ // let params = {};
+ // this.setConfirmLoading(true);
+ // Api.getDeptForm(params).then(res => {
+ // if (res.code === 200) {
+ // this.setConfirmLoading(false);
+ // res.data.condition && this.setCondition(res.data.condition);
+ // res.data.condition && this.form1.initFormFields(res.data.condition);
+ // } else {
+ // message.warning(res.msg);
+ // }
+ // }, error => {
+ // message.warning(error.msg);
+ // })
+ }
+
+ @action("转移部门")
+ getTransferForm() {
+ // let params = {};
+ // this.setConfirmLoading(true);
+ // Api.getDeptForm(params).then(res => {
+ // if (res.code === 200) {
+ // this.setConfirmLoading(false);
+ // res.data.condition && this.setCondition(res.data.condition);
+ // res.data.condition && this.form1.initFormFields(res.data.condition);
+ // } else {
+ // message.warning(res.msg);
+ // }
+ // }, error => {
+ // message.warning(error.msg);
+ // })
+ }
+
+ @action("复制表单")
+ getCopyForm() {
+ let params = {};
+ Api.getCopyForm(params).then(res => {
+ if (res.code === 200) {
+ res.data && this.setCopyCondition(res.data);
+ res.data && this.form2.initFormFields(res.data);
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+ }
+
+
+ save() {
+ let params = {
+ ...this.form1.getFormParams()
+ };
+ this.form1.validateForm().then(f => {
+ if (f.isValid) {
+ Api.add(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ this.getTableInfo();
+ this.setNewVisible(false);
+ } else {
+ message.warning(data.msg);
+ }
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+ } else {
+ f.showErrors();
+ this.setDate(new Date());
+ }
+ });
+ }
+
+ copy() {
+ let params = {
+ ids: this.ids,
+ ...this.form2.getFormParams()
+ };
+ Api.copy(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ this.getTableInfo();
+ this.form2 = new WeaForm();
+ this.setSelectedRowKeys('');
+ } else {
+ message.error(data.msg);
+ }
+ }).catch(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.form.updateFields({
+ compName: {
+ value: val
+ }
+ });
+ }
+
+ setSearchCondition(condition) {
+ this.searchCondition = condition;
+ }
+
+ setScLoadingStatus(bool) {
+ this.searchConditionLoading = bool;
+ }
+
+ setPanelStatus(bool) {
+ this.isPanelShow = bool;
+ bool && this.getSearchCondition();
+ if (!bool) {
+ this.scLoadingReset();
+ }
+ }
+
+ setDepartmentName(val) {
+ this.departmentName = val;
+ }
+
+ isEmptyObject(obj) {
+ for (let key in obj) {
+ return false;
+ }
+ return true;
+ }
+
+ setIds(ids) {
+ this.ids = ids;
+ }
+
+ setId(id) {
+ this.id = id;
+ }
+
+ scLoadingReset() {
+ this.searchConditionLoading = true;
+ }
+
+
+ formReset() {
+ this.form1 = new WeaForm();
+ }
+
+
+ setVisible(bool) {
+ this.visible = bool;
+ }
+
+ setDialogLoadingStatus(bool) {
+ this.dialogLoading = bool;
+ }
+
+
+ setSearchCondition(searchCondition) {
+ this.searchCondition = searchCondition;
+ }
+
+ setDepartmentId(departmentId) {
+ this.departmentId = departmentId;
+ }
+
+ setDate(date) {
+ this.date = date;
+ }
+
+ setTopMenu(topMenu) {
+ this.topMenu = topMenu;
+ }
+
+ setRightMenu(rightMenu) {
+ this.rightMenu = rightMenu;
+ }
+
+ setDataSource(dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ setJobDataSource(jobDataSource) {
+ this.jobDataSource = jobDataSource;
+ }
+
+ setColumns(columns) {
+ this.columns = columns
+ }
+
+ setJobColumns(jobColumns) {
+ this.jobColumns = jobColumns
+ }
+
+ setSelectedRowKeys(selectedRowKeys) {
+ this.selectedRowKeys = selectedRowKeys;
+ }
+
+ setLoading(bool) {
+ this.loading = bool;
+ }
+
+ setNeDialogTitle(title) {
+ this.nEdialogTitle = title
+ }
+
+ setCondition(condition) {
+ this.condition = condition;
+ }
+
+ setCopyCondition(copyCondition) {
+ this.copyCondition = copyCondition;
+ }
+
+ setNewVisible(bool) {
+ this.formReset();
+ this.newVisible = bool;
+ }
+
+ setTotal(total) {
+ this.total = total;
+ }
+
+ setCurrent(current) {
+ this.current = current;
+ }
+
+ setPageSize(pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ setInit(bool) {
+ this.init = bool;
+ }
+
+ setConfirmVisible(confirmVisible) {
+ this.confirmVisible = confirmVisible;
+ }
+
+ setConfirmLoading(confirmLoading) {
+ this.confirmLoading = confirmLoading;
+ }
+ }
\ No newline at end of file
diff --git a/pc4mobx/organization/stores/departmentextend.js b/pc4mobx/organization/stores/departmentextend.js
new file mode 100644
index 0000000..d95c3ec
--- /dev/null
+++ b/pc4mobx/organization/stores/departmentextend.js
@@ -0,0 +1,235 @@
+import { observable, action, toJS } from "mobx";
+import { WeaForm } from "comsMobx";
+import isEmpty from 'lodash/isEmpty'
+import { WeaTableNew } from "comsMobx";
+import { Modal, message } from "antd";
+import { i18n } from "../public/i18n";
+import forEach from 'lodash/forEach'
+import * as Api from '../apis/department'; // 引入API接口文件
+
+
+export class DepartmentExtendStore {
+ @observable form = new WeaForm();
+ @observable tableInfo = []
+ @observable conditions = [];
+ @observable isEditor = false;
+ @observable isNew = true;
+ @observable loading = true;
+ @observable tabInfo = [];
+ @observable selectedKey = '0';
+ @observable detailSelectedKey = '0';
+ @observable topTab = [];
+ @observable buttons = {};
+ @observable id = ''; //部门id
+ @observable date = '';
+ @observable personalEditTables;
+ @observable tabkey = '0'
+
+ @observable selectedRowKeys = [];
+ @observable selectedRows = [];
+
+ @action onRowSelect = (keys) => {
+ this.setSelectedRowKeys(keys);
+ }
+
+ @action setSelectedRowKeys = (keys) => {
+ this.selectedRowKeys = keys;
+ }
+
+
+ @action
+ edit = () => {
+ this.isEditor = true;
+ this.getData();
+ this.getTabInfo();
+ this.detailSelectedKey = '0'
+ }
+
+ init = () => {
+ this.detailSelectedKey = '0'
+ this.isEditor = false;
+ }
+
+ save = () => {
+ if (this.loading)
+ return;
+ this.loading = true;
+ this.form.validateForm().then(f => {
+ if (f.isValid) {
+ if (this.personalEditTables) {
+ const targetDatas = this.tableInfo[this.detailSelectedKey].tabinfo.datas,
+ isPass = (targetDatas.length > 0) ? this.personalEditTables.refs.edit.doRequiredCheck().pass : true
+ if (isPass) {
+ this.editResource()
+ } else {
+ this.loading = false;
+ }
+ } else {
+ this.editResource();
+ }
+ } else {
+ f.showErrors();
+ this.setDate(new Date());
+ this.loading = false;
+ }
+ })
+ }
+
+ editResource = () => {
+ let pDatas = this.form.getFormParams();
+ Api.editResource({ ...{
+ id: this.id
+ },
+ ...pDatas,
+ ...this.getTableEditParams()
+ }).then(data => {
+ if (data.code == 200) {
+ message.success(i18n.message.saveSuccess());
+ this.init();
+ this.getData();
+ this.selectedRowKeys = [];
+ } else {
+ message.warning(data.message);
+ }
+ this.loading = false;
+ }, error => {
+ message.warning(error.message);
+ this.loading = false;
+ })
+ }
+
+ getTableEditParams = () => {
+ const params = {};
+ this.tableInfo && this.tableInfo.forEach(t => {
+ t.tabinfo.datas = t.tabinfo.datas || [];
+ params[t.tabinfo.rownum] = t.tabinfo.datas.length;
+ t.tabinfo && t.tabinfo.datas && t.tabinfo.datas.forEach((item, index) => {
+ !isEmpty(item) && forEach(item, (value, key) => {
+ Object.assign(params, {
+ [`${key}_${index}`]: value
+ });
+ })
+ })
+ })
+ return params
+ }
+
+
+
+ getData = () => {
+ this.setLoading(true);
+ let params = {
+ viewAttr: this.isEditor ? 2 : 1,
+ id: this.id,
+ viewCondition:this.selectedKey
+ }
+ Api.getDeptExtendForm(params).then((res) => {
+ if (res.code === 200) {
+ res.data.result.conditions && this.form.initFormFields(res.data.result.conditions);
+ res.data.result.conditions && this.setConditions(res.data.result.conditions);
+ this.tableInfo = this.handleTable(res.data.result.tables);
+ this.getTabInfo();
+ res.data.result.buttons && this.setButtons(res.data.result.buttons);
+ res.data.result.tabInfo && this.setTopTab(res.data.result.tabInfo);
+ this.isEditor && this.getSelectedRows();
+ this.setLoading(false);
+
+ } else {
+ message.warning(res.msg);
+ }
+ }, error => {
+ message.warning(error.msg);
+ })
+
+
+
+
+ }
+
+ handleTable = (datas) => {
+ return datas && datas.map(data => {
+ const { tabinfo: { columns } } = data;
+ const length = columns.length;
+ columns.map(c => {
+ c.width = `${95 / length}%`
+ })
+ return data
+ })
+ }
+
+ getTabInfo = () => {
+ this.tabInfo = [];
+ this.tableInfo && this.tableInfo.forEach((c, idx) => {
+ if (!c.hide) {
+ this.tabInfo.push({
+ key: `${idx}`,
+ title: c.tabname,
+ })
+ }
+ })
+ if (!isEmpty(this.tabInfo)) this.detailSelectedKey = this.tabInfo[0].key;
+ }
+
+ setLoading(val) {
+ this.loading = val;
+ }
+
+
+ updateTabKey = (key) => {
+ this.tabKey = key;
+ }
+
+ updateDetailSelectedKey =(key) => {
+ this.detailSelectedKey = key;
+ }
+
+ updateTableInfo = (data) => {
+ this.tableInfo = data
+ }
+
+ setSelectedKey = (key) => {
+ this.selectedKey = key;
+ }
+
+ getSelectedRows = () => {
+ const selectedRows = [];
+ this.tableInfo.forEach(t => {
+ const singleTableRows = [];
+ t.tabinfo.datas.forEach((data, i) => {
+ if (data.viewAttr === 1) {
+ singleTableRows.push(i);
+ }
+ });
+ selectedRows.push(singleTableRows);
+ })
+ this.selectedRows = selectedRows;
+ }
+
+
+ setTopTab(topTab) {
+ this.topTab = topTab;
+ }
+
+ changeData(key) {
+ this.setSelectedKey(key);
+ this.getData();
+ }
+
+ setId(id) {
+ this.id = id;
+ }
+
+ setPersonalEditTables = (ref) => {
+ this.personalEditTables = ref;
+ }
+
+ setConditions(conditions) {
+ this.conditions = conditions;
+ }
+
+ setButtons(buttons) {
+ this.buttons = buttons;
+ }
+
+
+}
diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js
index 678cb77..ca257b8 100644
--- a/pc4mobx/organization/stores/index.js
+++ b/pc4mobx/organization/stores/index.js
@@ -8,11 +8,14 @@ import { SequenceStore } from "./sequence";
import { GroupStore } from "./group";
import {CompanyExtendStore} from "./companyextend";
import {CompanyStore} from "./company";
+import {DepartmentStore} from "./department";
+import {DepartmentExtendStore} from "./departmentextend";
import {StaffSchemeStore} from "./staffscheme";
import {StaffStore} from "./staff";
import {JobStore} from "./job";
import {JobExtendStore} from "./jobextend";
+
module.exports = {
simpleOrgStore: new SimpleOrgStore(),
standardOrgStore: new StandardOrgStore(),
@@ -24,6 +27,8 @@ module.exports = {
group: new GroupStore(),
companyExtend: new CompanyExtendStore(),
company: new CompanyStore(),
+ department: new DepartmentStore(),
+ departmentExtend: new DepartmentExtendStore(),
staffScheme: new StaffSchemeStore(),
staff: new StaffStore(),
job: new JobStore(),
diff --git a/pc4mobx/organization/stores/job.js b/pc4mobx/organization/stores/job.js
index 8a06544..063d4d1 100644
--- a/pc4mobx/organization/stores/job.js
+++ b/pc4mobx/organization/stores/job.js
@@ -30,8 +30,6 @@ export class JobStore {
@observable rightMenu = [];
@observable dataSource = [];
@observable columns = [];
- @observable deptDataSource = [];
- @observable deptColumns = [];
@observable loading = true;
@observable dialogLoading = true;
@observable isEdit = true;
@@ -63,7 +61,6 @@ export class JobStore {
-
@action
getTableInfo(params) {
this.setLoading(true);
@@ -134,6 +131,7 @@ export class JobStore {
}).then(data => {
if (data.code === 200) {
message.success(i18n.message.deleteSuccess());
+ this.setSelectedRowKeys('');
this.getTableInfo();
} else {
message.warning(data.msg);
@@ -236,30 +234,25 @@ export class JobStore {
}
copy() {
- debugger
let params = {
ids: this.ids,
...this.form2.getFormParams()
};
- this.form2.validateForm().then(f => {
- if (f.isValid) {
- Api.copy(params).then(response => {
- return response.json()
- }).then(data => {
- if (data.code === 200) {
- message.success(data.msg);
- this.getTableInfo();
- } else {
- message.error(data.msg);
- }
- }).catch(error => {
- message.warning(error.msg);
- })
+ Api.copy(params).then(response => {
+ return response.json()
+ }).then(data => {
+ if (data.code === 200) {
+ message.success(data.msg);
+ this.getTableInfo();
+ this.form2 = new WeaForm();
+ this.setSelectedRowKeys('');
} else {
- f.showErrors();
- this.setDate(new Date());
+ message.error(data.msg);
}
- });
+ }).catch(error => {
+ message.warning(error.msg);
+ })
+
}
@@ -363,17 +356,10 @@ export class JobStore {
this.dataSource = dataSource;
}
- setDeptDataSource(deptDataSource) {
- this.deptDataSource = deptDataSource;
- }
-
setColumns(columns) {
this.columns = columns
}
- setDeptColumns(deptColumns) {
- this.deptColumns = deptColumns
- }
setSelectedRowKeys(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys;