From a7a0de166e0abc4a9c96c21a035724f036085d9f Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Mon, 21 Aug 2023 18:09:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E9=80=9A=E5=AD=A6=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/organization/apis/qtxConfig.js | 6 + .../components/fieldDefinedSet/QtxConfig.js | 176 ++++++++++++++++++ pc4mobx/organization/index.js | 2 + pc4mobx/organization/stores/index.js | 4 +- pc4mobx/organization/stores/qtxConfig.js | 155 +++++++++++++++ pc4mobx/organization/stores/quickSearch.js | 4 - 6 files changed, 342 insertions(+), 5 deletions(-) create mode 100644 pc4mobx/organization/apis/qtxConfig.js create mode 100644 pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js create mode 100644 pc4mobx/organization/stores/qtxConfig.js diff --git a/pc4mobx/organization/apis/qtxConfig.js b/pc4mobx/organization/apis/qtxConfig.js new file mode 100644 index 0000000..08e84ad --- /dev/null +++ b/pc4mobx/organization/apis/qtxConfig.js @@ -0,0 +1,6 @@ +import { WeaTools } from 'ecCom'; + + +export const getQtxConfigInfo = (params) => { + return WeaTools.callApi('/api/bs/hrmorganization/cardAccess/getCardButtonTable', 'GET', params); +} \ No newline at end of file diff --git a/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js b/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js new file mode 100644 index 0000000..115515c --- /dev/null +++ b/pc4mobx/organization/components/fieldDefinedSet/QtxConfig.js @@ -0,0 +1,176 @@ +import React from 'react' +import * as mobx from 'mobx' +import { + inject, + observer +} from 'mobx-react' +import { + WeaTop, WeaFormItem, WeaTable, WeaRightMenu, WeaHelpfulTip, + WeaNewScroll, WeaSearchGroup, WeaLocaleProvider, WeaTab, WeaTableEdit +} from 'ecCom' +import { + Row, Col, Button, Modal, message, Input, Dropdown, Icon, Menu +} from 'antd' +import { WeaSwitch } from 'comsMobx' +import { + i18n +} from '../../public/i18n'; +const getLabel = WeaLocaleProvider.getLabel; + +const toJS = mobx.toJS; +const confirm = Modal.confirm; + + + +@inject('qtxConfig') +@observer +export default class QtxConfig extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + } + + componentDidMount() { + const { + qtxConfig + } = this.props; + qtxConfig.initList(); + } + + componentWillUnmount() { + } + + + componentWillReceiveProps(nextProps) { + const { + qtxConfig + } = this.props; + + if (this.props.location.key !== nextProps.location.key) { + qtxConfig.initList(); + } + } + + getDropMenuDatas() { + const { + qtxConfig + } = this.props, { + rightMenu + } = qtxConfig + + let menus = []; + toJS(rightMenu).map((item, index) => { + let obj = { + key: item.menuFun, + icon: , + content: item.menuName, + } + menus.push(obj); + }) + return menus; + } + + getTopMenuBtns() { + const { + qtxConfig + } = this.props, { + topMenu + } = qtxConfig + + let btns = []; + topMenu.map((item, i) => { + btns.push(); + }); + return btns; + } + + save = () => { + const { + qtxConfig + } = this.props; + //qtxConfig.saveQuickSearchInfo(); + } + + login = () => { + window.open("/api/bs/hrmorganization/config/ssoLogin", "_blank") + } + + + + + getFormItems = () => { + const { qtxConfig } = this.props; + const { configFields, configForm } = qtxConfig; + const arr = []; + const formParams = configForm.getFormParams(); + const { isFormInit } = configForm; + isFormInit && configFields.map((field, index) => { + arr.push( +
+ + {} + {} + +
+ ) + }) + + return {arr} + } + + + + render() { + const { qtxConfig: store } = this.props; + const { editTableData } = store, { + datas, columns, selectedData, loading + } = editTableData; + + return ( +
+ { this[key] && this[key]() }} + > + } + iconBgcolor='#217346' + loading={true} + buttons={this.getTopMenuBtns()} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + onDropMenuClick={(key) => { this[key] && this[key]() }} + > + + + {this.getFormItems()} + + + store.setTableEditDatas(e)} + /> + + + + +
+ ) + } +} \ No newline at end of file diff --git a/pc4mobx/organization/index.js b/pc4mobx/organization/index.js index af92242..444140a 100644 --- a/pc4mobx/organization/index.js +++ b/pc4mobx/organization/index.js @@ -34,6 +34,7 @@ import ManagerDetach from "./components/detach/ManagerDetach"; import ColumnSetting from "./components/columnSetting"; import PersonnelResume from "./components/resource/PersonnelResume"; import QuickSearch from "./components/fieldDefinedSet/QuickSearch"; +import QtxConfig from "./components/fieldDefinedSet/QtxConfig"; import stores from "./stores"; import "./style/index"; @@ -106,6 +107,7 @@ const Routes = ( + ); diff --git a/pc4mobx/organization/stores/index.js b/pc4mobx/organization/stores/index.js index da356c6..c0f3814 100644 --- a/pc4mobx/organization/stores/index.js +++ b/pc4mobx/organization/stores/index.js @@ -28,6 +28,7 @@ import {ManagerDetachStore} from "./managerDetach"; import {ColumnSetting} from './columnSetting'; import {PersonnelResumeStore} from './personnelResume'; import { QuickSearchStore } from "./quickSearch"; +import { QtxConfigStore } from "./qtxConfig"; module.exports = { @@ -60,5 +61,6 @@ module.exports = { managerDetach: new ManagerDetachStore(), columnSetting: new ColumnSetting(), personnelResume:new PersonnelResumeStore(), - quickSearch:new QuickSearchStore() + quickSearch:new QuickSearchStore(), + qtxConfig: new QtxConfigStore() }; diff --git a/pc4mobx/organization/stores/qtxConfig.js b/pc4mobx/organization/stores/qtxConfig.js new file mode 100644 index 0000000..b773c9b --- /dev/null +++ b/pc4mobx/organization/stores/qtxConfig.js @@ -0,0 +1,155 @@ +import { + observable, + action, + computed, extendObservable +} from 'mobx'; +import * as mobx from 'mobx'; +import * as API from '../apis/qtxConfig'; +import { + WeaForm +} from 'comsMobx'; +import { + Modal, + message, +} from 'antd' +import { + i18n +} from '../public/i18n'; +import { WeaLocaleProvider } from 'ecCom'; + +const toJS = mobx.toJS; +const getLabel = WeaLocaleProvider.getLabel; + + +export class QtxConfigStore { + + @observable configForm = new WeaForm(); + @observable editTableData = { + datas: [], + columns: [], + loading: true, + selectedData: {} + }; + + @observable configFields = [ + { + domkey: ['isopenconfig'], + conditionType: 'SWITCH', + label: getLabel('-1', "是否开启数据库配置"), + labelcol: 5, + fieldcol: 19, + viewAttr: 3, + } + ] + + @action("初始化页面") initList = () => { + this.configForm.initFormFields([{ items: this.configFields.slice() }]); + this.getQtxConfigInfo(); + } + + @action clearConfigData = () => { + this.editTableData.datas = []; + this.editTableData.columns = []; + this.editTableData.loading = true; + + } + + @action("数据获取") getQtxConfigInfo = () => { + this.clearConfigData(); + API.getQtxConfigInfo().then(action(({ code, data, msg }) => { + if (code == 200) { + const { columns, datas } = data; + extendObservable(this.editTableData, { + datas: datas, + columns: columns, + loading: false + }); + // this.configForm.updateFields({ + // isquicksearch: data.setting.isquicksearch, + // }); + } else { + message.error(`[${getLabel(127353, "错误") + code}]:${msg}`); + } + })); + } + + setTableEditDatas = (e) => { + debugger; + if(e.length > 1) { + e.pop(); + message.error("默认只能添加一条配置数据!!!") + } + extendObservable(this.editTableData, { + datas: e + }); + } + + @action("保存页面") saveQtxConfigInfo = () => { + // let datas = this.quickSearchData.datas; + // datas.map((data, index) => { + // data.orderid = index + // }); + + // let formparm = this.configForm.getFormParams(); + // if (!this.checkQuickSearchData()) { + // message.error(getLabel('387954', "条件字段不能重复")); + // return; + // } + // let id = this.quickSearchData.setting.id; + // if (id == null) { + // return; + // } + // API.saveQuickSearchInfo({ + // id: id, + // data: JSON.stringify(datas), ...formparm + // }).then(({ code, data, msg }) => { + // if (code == 200) { + // message.success(getLabel(83551, '保存成功!')); + // this.qcSelectedRowKeys = []; + // this.getQuickSearchInfo(); + // } else { + // message.error(`[${getLabel(127353, "错误") + code}]:${msg}`); + // } + // }); + // this.quickSearchData.setting.id = null; + } + + /**===========================buttons=========================== */ + rightMenu = [ + { + "isBatch": "0", + "isTop": "1", + "menuFun": "save", + "menuIcon": "icon-coms-Preservation", + "menuName": "保存", + "type": "BTN_save" + }, + { + "isBatch": "0", + "isTop": "0", + "menuFun": "login", + "menuIcon": "icon-coms-link", + "menuName": "单点登录", + "type": "BTN_link" + } + ]; + topMenu = [ + { + "isBatch": "1", + "isTop": "1", + "menuFun": "save", + "menuIcon": "icon-coms-Preservation", + "menuName": "保存", + "type": "BTN_save" + }, + { + "isBatch": "1", + "isTop": "1", + "menuFun": "login", + "menuIcon": "icon-coms-link", + "menuName": "单点登录", + "type": "BTN_link" + } + ] + +} \ No newline at end of file diff --git a/pc4mobx/organization/stores/quickSearch.js b/pc4mobx/organization/stores/quickSearch.js index 08c456a..328b76e 100644 --- a/pc4mobx/organization/stores/quickSearch.js +++ b/pc4mobx/organization/stores/quickSearch.js @@ -129,10 +129,6 @@ export class QuickSearchStore { this.quickSearchData.datas = datas; } - @action setQuickSearchData = (datas) => { - this.quickSearchData.datas = datas; - } - /**============================quickdetail===================== */ @action("设置") openQuickSearchDetail = (record) => { this.quickSearchDetailVisable = true;