From de7e0d50c64d01fe8c3640849607966b3b92384d Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 19 May 2022 16:15:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=8F=B8/=E5=88=86=E9=83=A8=E8=81=94?= =?UTF-8?q?=E6=9F=A5=E9=83=A8=E9=97=A8=20=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/components/NewTableDialog.js | 77 +++++++++++++ .../components/company/CompanyExtend.js | 8 +- .../components/company/company.js | 108 +++++++++++++----- .../organization/components/group/Group.js | 2 +- .../components/postionrank/JobGrade.js | 2 +- .../components/postionrank/JobLevel.js | 2 +- .../components/postionrank/RankScheme.js | 4 +- .../components/sequence/Sequence.js | 2 +- pc4mobx/organization/stores/company.js | 68 ++++++++++- pc4mobx/organization/stores/companyextend.js | 2 +- pc4mobx/organization/stores/rankscheme.js | 3 +- 11 files changed, 236 insertions(+), 42 deletions(-) create mode 100644 pc4mobx/organization/components/NewTableDialog.js diff --git a/pc4mobx/organization/components/NewTableDialog.js b/pc4mobx/organization/components/NewTableDialog.js new file mode 100644 index 0000000..bd7d2dc --- /dev/null +++ b/pc4mobx/organization/components/NewTableDialog.js @@ -0,0 +1,77 @@ +import { + WeaDialog, + WeaFormItem, + WeaNewScroll, + WeaSearchGroup, + WeaMoreButton, + WeaTable +} from 'ecCom' + +import { + Spin, + Button, +} from 'antd' + +import { + WeaSwitch +} from 'comsMobx' + +import { + i18n +} from '../public/i18n'; + +export default class NewTableDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + width: 800, + } + } + + + + render() { + const { + title, + visible, + onCancel, + loading, + height, + dataSource, + columns + } = this.props, { + width, + } = this.state; + + const buttons = [ + //(), + () + ]; + + return ( + onCancel()} + buttons={buttons} + style={{ width: width, height: height }} + > + { + loading ?
+ +
+ : record.id} + dataSource={dataSource} childrenColumnName="children" + columns={columns} + indentSize={15} + defaultExpandedRowKeys={[1, 2]} + /> + } +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/components/company/CompanyExtend.js b/pc4mobx/organization/components/company/CompanyExtend.js index c9ff330..291fb27 100644 --- a/pc4mobx/organization/components/company/CompanyExtend.js +++ b/pc4mobx/organization/components/company/CompanyExtend.js @@ -23,9 +23,9 @@ export default class CompanyExtend extends React.Component { init = () => { const { companyExtend,company } = this.props; //const {id} = company; - const {hash} = window.location; - let id = hash.replace("[^/]+(?=/$|$)"); - console.log("id",id) + let {hash} = window.location; + hash = hash.split("?")[0]; + let id = hash.match("[^/]+(?=/$|$)")[0]; companyExtend.init(); companyExtend.setId(id); companyExtend.getData(); @@ -221,7 +221,7 @@ export default class CompanyExtend extends React.Component { render() { const { companyExtend } = this.props; - const { loading, detailSelectedKey, tabInfo,topTab,selectedKey } = companyExtend; + const { loading, detailSelectedKey, tabInfo,topTab,selectedKey,date } = companyExtend; // if(!hasRight && !loading){ // return ( diff --git a/pc4mobx/organization/components/company/company.js b/pc4mobx/organization/components/company/company.js index 6d7bd83..7549a7a 100644 --- a/pc4mobx/organization/components/company/company.js +++ b/pc4mobx/organization/components/company/company.js @@ -1,3 +1,10 @@ +/** + * @Author: 程亮 + * @Date: 2022-05-18 16:23:32 + * @LastEditTime: 2022-05-19 15:00:16 + * @Description: + * @FilePath: /trunk/src4js/pc4mobx/organization/components/company/company.js + */ import React from 'react' import * as mobx from 'mobx' import { @@ -30,7 +37,9 @@ import { import '../../style/common.less'; +import NewTableDialog from '../NewTableDialog'; import NewAndEditDialog from '../NewAndEditDialog'; +import { renderLoading } from '../../util'; // 从util文件引入公共的方法 @@ -110,10 +119,23 @@ export default class Company extends React.Component { company } = this.props; - // company.setNeDialogTitle(i18n.label.newcompany()); - // company.setIsNew(true); - // company.setVisible(true); - // company.getForm(); + company.setNeDialogTitle(i18n.label.companyName()); + company.setNewVisible(true); + //company.getTable(); + company.setDialogLoadingStatus(false); + + } + + //联查部门 + select() { + const { + company + } = this.props; + + company.setNeDialogTitle(i18n.label.companyName()); + company.setVisible(true); + //company.getTable(); + company.setDialogLoadingStatus(false); } batchDelete() { @@ -201,8 +223,6 @@ export default class Company extends React.Component { } - - ///spa/organization/static/index.html#/main/organization/companyExtend reRenderColumns(columns) { const { company @@ -217,10 +237,20 @@ export default class Company extends React.Component { if (c.dataIndex == 'compName') { c.render = function (text, record) { return { - window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`,"_blank") + window.open(`/spa/organization/static/index.html#/main/organization/companyExtend/${record.id}`, "_blank") }}>{text} } } + if (c.dataIndex == 'operate') { + c.render = function (text, record) { + return + { _this.doDel(record.id) }}>删除 + + { _this.select() }}>联查部门 + + } + } + }) return columns; } @@ -240,17 +270,12 @@ export default class Company extends React.Component { this.showConfirm('del'); } - - handleSave() { - // const { - // company - // } = this.props; - // const { - // isNew - // } = company; - // isNew && company.save(); - // !isNew && company.edit(); + handleSave() { + const { + company + } = this.props; + company.save(); } getTabBtn() { @@ -334,8 +359,9 @@ export default class Company extends React.Component { company } = this.props; const { - isPanelShow, companyName, conditionNum, visible, condition, form, - tableStore, dataSource, columns,loading + isPanelShow, companyName, conditionNum, visible, condition, form, + tableStore, dataSource, columns, loading, date,nEdialogTitle,dialogLoading, + form1,isEdit,newVisible } = company; @@ -376,17 +402,43 @@ export default class Company extends React.Component { 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]} - loading={loading} - /> + { + loading ?
+ +
: + record.id} + dataSource={dataSource} childrenColumnName="children" + columns={this.reRenderColumns(columns)} + rowSelection={rowSelection} + indentSize={15} + /> + } + - + company.setVisible(false)} + /> + this.handleSave()} + onCancel={() => company.setNewVisible(false)} + enable={false} //是否开启字段联动 + /> ) } diff --git a/pc4mobx/organization/components/group/Group.js b/pc4mobx/organization/components/group/Group.js index 4e26c0b..c33be85 100644 --- a/pc4mobx/organization/components/group/Group.js +++ b/pc4mobx/organization/components/group/Group.js @@ -174,7 +174,7 @@ export default class Group extends React.Component { group } = this.props; const { - nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey + nEdialogTitle, visible, condition, form, dialogLoading, isEdit, topTab, selectedKey,date } = group; return ( diff --git a/pc4mobx/organization/components/postionrank/JobGrade.js b/pc4mobx/organization/components/postionrank/JobGrade.js index 061c8c6..39ef1cb 100644 --- a/pc4mobx/organization/components/postionrank/JobGrade.js +++ b/pc4mobx/organization/components/postionrank/JobGrade.js @@ -347,7 +347,7 @@ export default class JobGrade extends React.Component { } = this.props; const { isPanelShow, form2, gradeName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date } = jobGrade; diff --git a/pc4mobx/organization/components/postionrank/JobLevel.js b/pc4mobx/organization/components/postionrank/JobLevel.js index 61dedd5..b570e57 100644 --- a/pc4mobx/organization/components/postionrank/JobLevel.js +++ b/pc4mobx/organization/components/postionrank/JobLevel.js @@ -347,7 +347,7 @@ export default class JobLevel extends React.Component { } = this.props; const { isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date } = jobLevel; diff --git a/pc4mobx/organization/components/postionrank/RankScheme.js b/pc4mobx/organization/components/postionrank/RankScheme.js index d078ee6..2cb6601 100644 --- a/pc4mobx/organization/components/postionrank/RankScheme.js +++ b/pc4mobx/organization/components/postionrank/RankScheme.js @@ -2,7 +2,7 @@ import React from 'react' import * as mobx from 'mobx' import { inject, - observer, + observer } from 'mobx-react' import { WeaTop, @@ -340,7 +340,7 @@ export default class RankScheme extends React.Component { } = this.props; const { isPanelShow, form2, schemeName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit + form,dialogLoading,isEdit,date } = rankScheme; return ( diff --git a/pc4mobx/organization/components/sequence/Sequence.js b/pc4mobx/organization/components/sequence/Sequence.js index 2fa8554..78f702c 100644 --- a/pc4mobx/organization/components/sequence/Sequence.js +++ b/pc4mobx/organization/components/sequence/Sequence.js @@ -347,7 +347,7 @@ export default class Sequence extends React.Component { } = this.props; const { isPanelShow, form2, levelName, conditionNum, tableStore,nEdialogTitle,visible,condition, - form,dialogLoading,isEdit,selectedKey,topTab,topTabCount + form,dialogLoading,isEdit,selectedKey,topTab,topTabCount,date } = sequence; diff --git a/pc4mobx/organization/stores/company.js b/pc4mobx/organization/stores/company.js index f5d6826..768c606 100644 --- a/pc4mobx/organization/stores/company.js +++ b/pc4mobx/organization/stores/company.js @@ -23,6 +23,7 @@ const { TableStore } = WeaTableNew; + export class CompanyStore { @observable topMenu = [] @observable rightMenu = []; @@ -30,15 +31,21 @@ export class CompanyStore { @observable columns = []; @observable tableStore = new TableStore(); @observable loading = true; + @observable dialogLoading = true; + @observable isEdit = true; + @observable nEdialogTitle = ''; @observable searchCondition = []; + @observable condition = []; @observable isPanelShow = false; //高级搜索面板 @observable form = new WeaForm(); + @observable form1 = new WeaForm(); //新增主表表单 @observable companyName = ''; @observable conditionNum = 8; @observable ids = ''; //选择行id @observable id = ''; //页面跳转参数id @observable searchConditionLoading = true; @observable visible = false; + @observable newVisible = false; //新增弹窗 @observable companyId = ''; @observable selectedRowKeys = ''; @observable date = ''; @@ -52,6 +59,7 @@ export class CompanyStore { params = { ...this.form.getFormParams(), //companyName: this.companyName, + pageSize:20 }; } else { params = { @@ -128,6 +136,48 @@ export class CompanyStore { } + getForm() { + // this.setDialogLoadingStatus(true); + // Api.getCompanyForm(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); + // }) + +} + +save() { + // let params = { + // ...this.form1.getFormParams() + // }; + // this.form.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.setVisible(false); + // } else { + // message.warning(data.msg); + // } + // }).catch(error => { + // message.warning(error.msg); + // }) + // } else { + // f.showErrors(); + // this.setDate(new Date()); + // } + // }); +} + @action getHasRight() { @@ -198,10 +248,12 @@ export class CompanyStore { setVisible(bool) { this.visible = bool; - this.formReset(); - !bool && this.dialogLoadingReset(); } + setDialogLoadingStatus(bool) { + this.dialogLoading = bool; +} + setSearchCondition(searchCondition) { this.searchCondition = searchCondition; @@ -239,4 +291,16 @@ export class CompanyStore { this.loading = bool; } + setNeDialogTitle(title) { + this.nEdialogTitle = title + } + + setCondition(condition) { + this.condition = condition; + } + + setNewVisible(bool) { + this.newVisible = bool; + } + } \ No newline at end of file diff --git a/pc4mobx/organization/stores/companyextend.js b/pc4mobx/organization/stores/companyextend.js index 85cf6e5..d9b5d30 100644 --- a/pc4mobx/organization/stores/companyextend.js +++ b/pc4mobx/organization/stores/companyextend.js @@ -20,7 +20,7 @@ export class CompanyExtendStore { @observable topTab = []; @observable buttons = {}; @observable id = ''; //分部id - @observable date; + @observable date = ''; @observable personalEditTables; diff --git a/pc4mobx/organization/stores/rankscheme.js b/pc4mobx/organization/stores/rankscheme.js index adbe001..4705bd9 100644 --- a/pc4mobx/organization/stores/rankscheme.js +++ b/pc4mobx/organization/stores/rankscheme.js @@ -201,7 +201,7 @@ export class RankSchemeStore { @action - getHasRight() { + getHasRight() { Api.getHasRight().then(res => { if (res.code === 200) { res.data.rightMenu && this.setRightMenu(res.data.rightMenu); @@ -292,6 +292,7 @@ export class RankSchemeStore { this.schemeId = schemeId; } + @action setDate(date) { this.date = date; }