From f0734d1c09b377d91953491f29c7af7e631fe729 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 21 十一月 2019 09:19:59 +0800 Subject: [PATCH] 2019-11-21-01 --- src/components/sidemenu/comtableconfig/dragelement/index.jsx | 2 src/components/sidemenu/comtableconfig/index.scss | 57 + src/components/sidemenu/comtableconfig/searchform/index.scss | 3 src/components/sidemenu/comtableconfig/source.jsx | 267 ++++++++++ src/components/sidemenu/editthdmenu/index.jsx | 125 ---- src/components/header/editmenu/index.jsx | 18 src/components/header/menuform/index.jsx | 37 - src/api/index.js | 1 src/components/sidemenu/comtableconfig/editcard/index.jsx | 14 src/components/sidemenu/comtableconfig/settingform/index.jsx | 92 +++ src/components/sidemenu/comtableconfig/settingform/index.scss | 10 src/components/sidemenu/comtableconfig/index.jsx | 870 +++++++++++++++++++-------------- src/locales/zh-CN/comtable.js | 2 src/locales/en-US/comtable.js | 2 src/components/sidemenu/comtableconfig/menuform/index.jsx | 7 src/assets/css/main.scss | 15 src/components/sidemenu/comtableconfig/actionform/index.scss | 3 src/views/login/index.jsx | 4 18 files changed, 936 insertions(+), 593 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 7e2ef7d..8eef60d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -35,6 +35,7 @@ return Promise.resolve(response.data) } }, (error) => { + // console.log(error.response.status) return Promise.reject(error) }) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 37432da..6210278 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -125,21 +125,6 @@ top: 38vh; } -// 鑷畾涔夋ā鎬佹鎸夐挳璁剧疆 -.edit-modal-footer{ - padding: 10px 16px; - text-align: right; - background: transparent; - border-top: 1px solid #e8e8e8; - border-radius: 0 0 4px 4px; - margin-left: -24px; - margin-right: -24px; - margin-bottom: -20px; - .ant-btn { - margin-right: 7px; - } -} - .ant-popover { z-index: 1090!important; } \ No newline at end of file diff --git a/src/components/header/editmenu/index.jsx b/src/components/header/editmenu/index.jsx index df719f4..554204b 100644 --- a/src/components/header/editmenu/index.jsx +++ b/src/components/header/editmenu/index.jsx @@ -107,7 +107,6 @@ addMvisible: false, menulist: null }) - this.addMenuFormRef.handleReset('add') this.props.reload() } else { this.setState({ @@ -129,7 +128,6 @@ confirmLoading: false, addMvisible: false }) - this.addMenuFormRef.handleReset('add') } deleteMemu = () => { @@ -323,6 +321,7 @@ onOk={this.addMemuSubmit} confirmLoading={this.state.confirmLoading} onCancel={this.addMemuCancel} + destroyOnClose > <MenuForm dict={this.state.dict} @@ -340,6 +339,7 @@ onOk={this.thawMemuSubmit} confirmLoading={this.state.confirmLoading} onCancel={this.thawMemuCancel} + destroyOnClose > {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>} @@ -347,11 +347,14 @@ {/* 缂栬緫鑿滃崟妯℃�佹 */} <Modal title={this.state.dict['header.menu.editTitle']} - // okText={this.state.dict['header.confirm']} - // cancelText={this.state.dict['header.cancel']} visible={this.state.editMvisible} - footer={null} + footer={[ + <Button key="cancel" onClick={this.editMemuCancel}>{this.state.dict['header.cancel']}</Button>, + <Button key="confirm" type="primary" onClick={this.editMemuSubmit} loading={this.state.confirmLoading}>{this.state.dict['header.confirm']}</Button>, + <Button key="delete" type="danger" onClick={this.deleteMemu}>{this.state.dict['header.delete']}</Button> + ]} onCancel={this.editMemuCancel} + destroyOnClose > <MenuForm dict={this.state.dict} @@ -359,11 +362,6 @@ menu={this.state.editMenu} wrappedComponentRef={(inst) => this.editMenuFormRef = inst} /> - <div className="edit-modal-footer"> - <Button onClick={this.editMemuCancel}>{this.state.dict['header.cancel']}</Button> - <Button type="primary" onClick={this.editMemuSubmit} loading={this.state.confirmLoading}>{this.state.dict['header.confirm']}</Button> - <Button type="danger" onClick={this.deleteMemu}>{this.state.dict['header.delete']}</Button> - </div> </Modal> </div> ) diff --git a/src/components/header/menuform/index.jsx b/src/components/header/menuform/index.jsx index ef42c63..dd26f5c 100644 --- a/src/components/header/menuform/index.jsx +++ b/src/components/header/menuform/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' import { Form, Row, Col, Input, Select } from 'antd' import Utils from '@/utils/utils.js' import './index.scss' @@ -69,28 +68,6 @@ if (this.props.menu.PageParam.OpenType === 'menu') { menu.hidden = true } else if (this.props.menu.PageParam.OpenType === 'newpage') { - menu.hidden = false - } - } - return menu - }) - }) - } - } - - UNSAFE_componentWillReceiveProps (nextProps) { - if (nextProps.menu && !is(fromJS(this.props.menu), fromJS(nextProps.menu))) { - this.setState({ - formlist: this.state.defaultMenu.map(menu => { - if (menu.key === 'menuName') { - menu.initVal = nextProps.menu.MenuName - } else if (menu.key === 'openType') { - menu.initVal = nextProps.menu.PageParam.OpenType - } else if (menu.key === 'linkUrl') { - menu.initVal = nextProps.menu.PageParam.linkUrl - if (nextProps.menu.PageParam.OpenType === 'menu') { - menu.hidden = true - } else if (nextProps.menu.PageParam.OpenType === 'newpage') { menu.hidden = false } } @@ -205,20 +182,6 @@ } }) }) - } - - handleReset = (type) => { - // 閲嶇疆 - if (type === 'add') { - let formlist = this.state.formlist.map(item => { - if (item.key === 'linkUrl') { - item.hidden = true - } - return item - }) - this.setState({formlist}) - } - this.props.form.resetFields() } render() { diff --git a/src/components/sidemenu/comtableconfig/actionform/index.scss b/src/components/sidemenu/comtableconfig/actionform/index.scss index 31e0221..28fc1a4 100644 --- a/src/components/sidemenu/comtableconfig/actionform/index.scss +++ b/src/components/sidemenu/comtableconfig/actionform/index.scss @@ -1,6 +1,3 @@ .ant-advanced-search-form.commontable-action-form { min-height: 190px; - .ant-form-item { - margin-bottom: 15px; - } } \ No newline at end of file diff --git a/src/components/sidemenu/comtableconfig/dragelement/index.jsx b/src/components/sidemenu/comtableconfig/dragelement/index.jsx index a94b7c7..6b0d6f3 100644 --- a/src/components/sidemenu/comtableconfig/dragelement/index.jsx +++ b/src/components/sidemenu/comtableconfig/dragelement/index.jsx @@ -96,7 +96,7 @@ newcard.Ot = 'requiredSgl' newcard.OpenType = item.subType newcard.icon = '' - newcard.class = 'green' + newcard.class = 'default' newcard.intertype = 'inner' newcard.interface = '' newcard.callbackFunc = '' diff --git a/src/components/sidemenu/comtableconfig/editcard/index.jsx b/src/components/sidemenu/comtableconfig/editcard/index.jsx index 0e81e79..f691210 100644 --- a/src/components/sidemenu/comtableconfig/editcard/index.jsx +++ b/src/components/sidemenu/comtableconfig/editcard/index.jsx @@ -28,6 +28,16 @@ render() { const { card, type } = this.state + let _type = card.type + if (type === 'columns') { + if (_type !== 'picture') { + _type = 'text' + } + } else if (type === 'search') { + if (_type === 'number') { + _type = 'text' + } + } return ( <div className={'ant-card ant-card-bordered ' + (card.selected ? 'selected' : '')} > <div className="base" onClick={this.changeSelect}> @@ -35,13 +45,13 @@ <p title={card.field}>瀛楁鍚�: {card.field}</p> <p title={card.label}>鎻愮ず鏂囧瓧: {card.label}</p> </div> - {type === 'search' && <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> + {type === 'search' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> <Radio value="text">text</Radio> <Radio value="select">select</Radio> <Radio value="date">date</Radio> <Radio value="datetime">datetime</Radio> </Radio.Group>} - {type === 'columns' && <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected}> + {type === 'columns' && <Radio.Group onChange={this.changeType} value={_type} disabled={!card.selected}> <Radio value="text">text</Radio> <Radio value="picture">picture</Radio> </Radio.Group>} diff --git a/src/components/sidemenu/comtableconfig/index.jsx b/src/components/sidemenu/comtableconfig/index.jsx index d37cf2a..478c4c4 100644 --- a/src/components/sidemenu/comtableconfig/index.jsx +++ b/src/components/sidemenu/comtableconfig/index.jsx @@ -1,24 +1,27 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -// import { is, fromJS } from 'immutable' +import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon } from 'antd' +import { Button, Card, Modal, Collapse, notification, Select, List, Icon, Empty } from 'antd' import DragElement from './dragelement' import SourceElement from './dragelement/source' import Api from '@/api' import SearchForm from './searchform' import ActionForm from './actionform' import ColumnForm from './columnform' +import SettingForm from './settingform' import EditCard from './editcard' import MenuForm from './menuform' import zhCN from '@/locales/zh-CN/comtable.js' import enUS from '@/locales/en-US/comtable.js' import Utils from '@/utils/utils.js' +import Source from './source' import './index.scss' const { Panel } = Collapse const { Option } = Select +const { confirm } = Modal const CommonDict = (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS class ComTableConfig extends Component { @@ -31,6 +34,7 @@ } state = { + operaType: '', // 鎿嶄綔绫诲瀷锛屾柊寤烘垨缂栬緫 dict: CommonDict, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆 visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 @@ -38,7 +42,6 @@ addType: '', // 娣诲姞绫诲瀷-鎼滅储鏉′欢鎴栨樉绀哄垪 tableColumns: [], // 琛ㄦ牸鏄剧ず鍒� fields: null, // 鎼滅储鏉′欢鍙婃樉绀哄垪锛屽彲閫夊瓧娈� - loading: false, // 鍔犺浇涓紙鑾峰彇琛ㄦ暟鎹級 menuformlist: null, // 鍩烘湰淇℃伅琛ㄥ崟瀛楁 formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 formtemp: '', // 琛ㄥ崟绫诲瀷锛屾樉绀哄垪銆佹寜閽�佹悳绱㈡潯浠� @@ -46,273 +49,188 @@ searchloading: false, // 鎼滅储鏉′欢鍔犺浇涓� actionloading: false, // 鎸夐挳鍔犺浇涓� columnsloading: false, // 鏄剧ず鍒楀姞杞戒腑 - tables: [{ - name: 'SUsers', - label: '鐢ㄦ埛琛�' - }, { - name: 'SMenus', - label: '鑿滃崟琛�' - }, { - name: 'SColumns', - label: '鏄剧ず鍒楄〃' - }, { - name: 'SActions', - label: '鎸夐挳琛�' - }], + menuloading: false, // 鑿滃崟淇濆瓨涓� + settingVisible: false, // 鍏ㄥ眬閰嶇疆妯℃�佹 + closeVisible: false, // 鍏抽棴妯℃�佹 + tables: [], // 鍙敤琛ㄥ悕 selectedTables: [], // 宸查�夎〃鍚� - baseconfig: { - type: 'system', - search: [ + originMenu: null // 鍘熷鑿滃崟 + } + + UNSAFE_componentWillMount () { + const {menu, supMenu} = this.props + + let _LongParam = menu.LongParam + let _config = '' + if (this.props.type === 'add' || !_LongParam) { + _config = JSON.parse(JSON.stringify((Source.baseConfig))) + } else { + let _setting = Source.baseConfig.setting + if (_LongParam.setting) { + _setting = {..._setting, ..._LongParam.setting} + } + _LongParam.setting = _setting + _config = _LongParam + } + + this.setState({ + operaType: this.props.type, + originMenu: JSON.parse(JSON.stringify({...menu, ParentID: supMenu.MenuID})), + config: _config, + selectedTables: _config.tables || [], + menuformlist: [ { - origin: true, - id: 0, - uuid: Utils.getuuid(), - label: 'text', - field: '', - initval: '', - type: 'text', - resourceType: '0', - setAll: 'false', - options: [], - dataSource: '', - linkField: '', - valueField: '', - valueText: '', - orderBy: '', - orderType: 'asc', - display: 'dropdown' - }, { - origin: true, - id: 1, - uuid: Utils.getuuid(), - label: 'select', - field: '', - initval: '', type: 'select', - resourceType: '0', - setAll: 'false', - options: [], - dataSource: '', - linkField: '', - valueField: '', - valueText: '', - orderBy: '', - orderType: 'asc', - display: 'dropdown' - }, { - origin: true, - id: 2, - uuid: Utils.getuuid(), - label: 'date', - field: '', - initval: '', - type: 'date', - resourceType: '0', - setAll: 'false', - options: [], - dataSource: '', - linkField: '', - valueField: '', - valueText: '', - orderBy: '', - orderType: 'asc', - display: 'dropdown' - } - ], - action: [ + key: 'parentId', + label: this.state.dict['header.menu.supMenu'], + initVal: this.props.supMenu.MenuID, + required: true, + readonly: false, + options: this.props.supMenuList + }, { - origin: true, - id: 0, - uuid: Utils.getuuid(), - label: 'add', - intertype: 'inner', - innerFunc: '', - interface: '', - outerFunc: '', - callbackFunc: '', - Ot: 'notRequired', - OpenType: 'pop', - pageTemplate: '', - icon: 'plus', - class: 'green' - }, { - origin: true, - id: 1, - uuid: Utils.getuuid(), - label: 'update', - intertype: 'inner', - innerFunc: '', - interface: '', - outerFunc: '', - callbackFunc: '', - Ot: 'requiredSgl', - OpenType: 'pop', - pageTemplate: '', - icon: 'form', - class: 'purple' - }, { - origin: true, - id: 2, - uuid: Utils.getuuid(), - label: 'delete', - intertype: 'inner', - innerFunc: '', - interface: '', - outerFunc: '', - callbackFunc: '', - Ot: 'required', - OpenType: 'prompt', - pageTemplate: '', - icon: 'delete', - class: 'red' - }, { - origin: true, - id: 3, - uuid: Utils.getuuid(), - label: 'freeze', - intertype: 'inner', - innerFunc: '', - interface: '', - outerFunc: '', - callbackFunc: '', - Ot: 'requiredOnce', - OpenType: 'exec', - pageTemplate: '', - icon: '', - class: 'default' - } - ], - columns: [ + type: 'text', + key: 'menuName', + label: this.state.dict['header.menu.menuName'], + initVal: menu.MenuName, + required: true, + readonly: false + }, { - origin: true, - id: 0, - uuid: Utils.getuuid(), - Align: 'left', - label: 'fieldName1', - field: '', - Hide: 'false', - IsSort: 'true', type: 'text', - Width: 120 - }, { - origin: true, - id: 1, - uuid: Utils.getuuid(), - Align: 'left', - label: 'fieldName2', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - id: 2, - uuid: Utils.getuuid(), - Align: 'left', - label: 'fieldName3', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - id: 3, - uuid: Utils.getuuid(), - Align: 'left', - label: 'fieldName4', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 + key: 'menuNo', + label: this.state.dict['header.menu.menuNo'], + initVal: menu.MenuNo, + required: true, + readonly: false + }, + { + type: 'select', + key: 'opentype', + label: this.state.dict['header.menu.openType'], + initVal: menu.PageParam.OpenType, + required: true, + options: [{ + MenuID: 'newtab', + text: this.state.dict['header.form.tab'] + }, { + MenuID: 'newpage', + text: this.state.dict['header.form.newpage'] + }] } ] - }, - searchItems: [ - { - type: 'search', - label: '鏂囨湰妗�', - subType: 'text', - url: '' - }, - { - type: 'search', - label: '涓嬫媺妗�', - subType: 'select', - url: '' - }, - { - type: 'search', - label: '鏃堕棿妗嗭紙澶╋級', - subType: 'date', - url: '' - }, - { - type: 'search', - label: '鏃堕棿妗嗭紙绉掞級', - subType: 'datetime', - url: '' - } - ], - actionItems: [ - { - type: 'action', - label: CommonDict['header.form.pop'], - subType: 'pop', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.prompt'], - subType: 'prompt', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.exec'], - subType: 'exec', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.tab'], - subType: 'tab', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.newpage'], - subType: 'newpage', - url: '' - }, - { - type: 'action', - label: CommonDict['header.form.blank'], - subType: 'blank', - url: '' - } - ], - columnItems: [ - { - type: 'columns', - label: CommonDict['header.form.text'], - subType: 'text', - url: '' - }, - { - type: 'columns', - label: CommonDict['header.form.picture'], - subType: 'picture', - url: '' - } - ] + }) + } + + componentDidMount () { + let _text = "select TbName ,Remark from sDataDictionary where IsKey!='' and Deleted =0" + _text = Utils.formatOptions(_text) + + Api.getSystemConfig({func: 'sPC_Get_SelectedList', LText: _text, obj_name: ''}).then(res => { + this.setState({ + tables: [ + { + TbName: 'SRMPurchaseOrder', + Remark: '閲囪喘鍗�' + }, + { + TbName: 'sOrganizationAccount', + Remark: '鍏徃璐﹀彿' + }, + { + TbName: 'sOrganization', + Remark: '鍏徃' + }, + { + TbName: 'BDFactory', + Remark: '宸ュ巶涓绘暟鎹�' + }, + { + TbName: 'BDWMSWareHouse', + Remark: '搴撳瓨鍦扮偣涓绘暟鎹�' + }, + { + TbName: 'BDFactoryPerson', + Remark: '宸ュ巶鑱旂郴浜�' + }, + { + TbName: 'BDWMSStockType', + Remark: '瀛樺偍绫诲瀷' + } + ] + }) + }) + + let deffers = this.state.selectedTables.map(item => { + return new Promise(resolve => { + Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => { + res.TBName = item.TbName + resolve(res) + }) + }) + }) + Promise.all(deffers).then(response => { + let _columns = [] + response.forEach(res => { + if (res.status) { + let tabmsg = { + tableName: res.TBName, + columns: res.FDName.map(item => { + let _type = item.FieldType.toLowerCase() + let _decimal = 0 + if (/^nvarchar/.test(_type)) { + _type = 'text' + } else if (/^int/.test(_type)) { + _type = 'number' + } else if (/^decimal/.test(_type)) { + _decimal = _type.split(',')[1] + _decimal = parseInt(_decimal) + if (_decimal > 4) { + _decimal = 4 + } + _type = 'number' + } else if (/^decimal/.test(_type)) { + _decimal = _type.split(',')[1] + _decimal = parseInt(_decimal) + if (_decimal > 4) { + _decimal = 4 + } + _type = 'number' + } else if (/^datetime/.test(_type)) { + _type = 'datetime' + } else if (/^date/.test(_type)) { + _type = 'date' + } else { + _type = 'text' + } + + return { + field: item.FieldName, + label: item.FieldDec, + type: _type, + decimal: _decimal + } + }) + } + _columns.push(tabmsg) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + + this.setState({ + tableColumns: _columns + }) + }) } handleList = (listObj) => { let config = this.state.config - if (this.props.type === 'add') { + if (this.state.operaType === 'add') { let key = Object.keys(listObj)[0] let newlength = listObj[key].length if (newlength > config[key].length) { @@ -392,7 +310,7 @@ type: 'radio', key: 'resourceType', label: this.state.dict['header.form.resourceType'], - initVal: card.resourceType, + initVal: card.resourceType || '0', required: true, options: [{ MenuID: '0', @@ -406,7 +324,7 @@ type: 'radio', key: 'setAll', label: this.state.dict['header.form.setAll'], - initVal: card.setAll, + initVal: card.setAll || 'false', options: [{ MenuID: 'true', text: this.state.dict['header.form.true'] @@ -419,7 +337,7 @@ type: 'textarea', key: 'dataSource', label: this.state.dict['header.form.datasource'], - initVal: card.dataSource, + initVal: card.dataSource || '', required: true, readonly: false }, @@ -427,7 +345,7 @@ type: 'options', key: 'options', label: '', - initVal: card.options, + initVal: card.options || [], required: true, readonly: false }, @@ -435,7 +353,7 @@ type: 'text', key: 'linkField', label: this.state.dict['header.form.linkField'], - initVal: card.linkField, + initVal: card.linkField || '', required: true, readonly: false }, @@ -443,7 +361,7 @@ type: 'text', key: 'valueField', label: this.state.dict['header.form.valueField'], - initVal: card.valueField, + initVal: card.valueField || '', required: true, readonly: false }, @@ -451,7 +369,7 @@ type: 'text', key: 'valueText', label: this.state.dict['header.form.valueText'], - initVal: card.valueText, + initVal: card.valueText || '', required: true, readonly: false }, @@ -459,7 +377,7 @@ type: 'text', key: 'orderBy', label: this.state.dict['header.form.orderBy'], - initVal: card.orderBy, + initVal: card.orderBy || '', required: false, readonly: false }, @@ -467,7 +385,7 @@ type: 'select', key: 'orderType', label: this.state.dict['header.form.orderType'], - initVal: card.orderType, + initVal: card.orderType || 'asc', options: [{ MenuID: 'asc', text: this.state.dict['header.form.asc'] @@ -480,7 +398,7 @@ type: 'select', key: 'display', label: this.state.dict['header.form.display'], - initVal: card.display, + initVal: card.display || 'dropdown', required: true, options: [{ MenuID: 'dropdown', @@ -724,7 +642,7 @@ this.formRef.handleConfirm().then(res => { let _config = this.state.config - if (this.props.type === 'add') { + if (this.state.operaType === 'add') { _config[res.type] = _config[res.type].map(item => { if (item.uuid === res.values.uuid) { return res.values @@ -779,13 +697,13 @@ resetFrom = () => { setTimeout(() => { this.setState({ - formtemp: '', + // formtemp: '', searchloading: false, actionloading: false, - columnsloading: false, - formlist: null + columnsloading: false + // formlist: null }) - }, 300) + }, 10) } changeTemplate = () => { @@ -793,14 +711,193 @@ } submitConfig = () => { + const { menu } = this.props + const { config, originMenu } = this.state this.menuformRef.handleConfirm().then(res => { - console.log(res) + if (config.search[0] && config.search[0].origin) { + notification.warning({ + top: 92, + message: '璇疯缃悳绱㈡潯浠�', + duration: 10 + }) + return + } + if (config.action[0] && config.action[0].origin) { + notification.warning({ + top: 92, + message: '璇疯缃寜閽�', + duration: 10 + }) + return + } + if (config.columns[0] && config.columns[0].origin) { + notification.warning({ + top: 92, + message: '璇疯缃樉绀哄垪', + duration: 10 + }) + return + } + + let _LongParam = '' + let _config = {...config, tables: this.state.selectedTables} + let _pageParam = {...menu.PageParam, OpenType: res.opentype} + + try { + _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) + } catch (e) { + notification.warning({ + top: 92, + message: '缂栬瘧閿欒', + duration: 10 + }) + return + } + + if (this.state.operaType === 'add') { + let param = { + func: 'sPC_TrdMenu_Add', + ParentID: res.parentId, + MenuID: menu.MenuID, + MenuNo: res.menuNo, + Template: menu.PageParam.Template || '', + MenuName: res.menuName, + PageParam: JSON.stringify(_pageParam), + LongParam: _LongParam + } + this.setState({ + menuloading: true + }) + + Api.getSystemConfig(param).then(response => { + if (response.status) { + this.setState({ + menuloading: false, + operaType: 'edit', + originMenu: { + ...originMenu, + LongParam: _config, + PageParam: _pageParam, + MenuName: res.menuName, + MenuNo: res.menuNo, + ParentID: res.parentId + } + }) + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 10 + }) + } else { + this.setState({ + menuloading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + } + }) + } else { + let param = { + func: 'sPC_TrdMenu_Upt', + ParentID: res.parentId, + MenuID: menu.MenuID, + MenuNo: res.menuNo, + Template: menu.PageParam.Template || '', + MenuName: res.menuName, + PageParam: JSON.stringify(_pageParam), + LongParam: _LongParam + } + this.setState({ + menuloading: true + }) + + Api.getSystemConfig(param).then(response => { + if (response.status) { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 10 + }) + if (this.state.closeVisible) { + this.props.handleConfig('') + } else { + this.setState({ + menuloading: false, + originMenu: { + ...originMenu, + LongParam: _config, + PageParam: _pageParam, + MenuName: res.menuName, + MenuNo: res.menuNo, + ParentID: res.parentId + } + }) + } + } else { + this.setState({ + menuloading: false + }) + notification.warning({ + top: 92, + message: response.message, + duration: 10 + }) + } + }) + } + }, () => { + notification.warning({ + top: 92, + message: this.state.dict['header.menu.basemsg'], + duration: 10 + }) }) - // this.props.handleConfig('') } cancelConfig = () => { - this.props.handleConfig('') + const { menu } = this.props + const { config, originMenu } = this.state + let _this = this + + if (this.state.operaType === 'add') { + confirm({ + content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', + okText: this.state.dict['header.confirm'], + cancelText: this.state.dict['header.cancel'], + onOk() { + _this.props.handleConfig('') + }, + onCancel() {} + }) + } else { + this.menuformRef.handleConfirm().then(res => { + let _config = {...config, tables: this.state.selectedTables} + let _pageParam = {...menu.PageParam, OpenType: res.opentype} + let _originMenu = { + ...originMenu, + LongParam: _config, + PageParam: _pageParam, + MenuName: res.menuName, + MenuNo: res.menuNo, + ParentID: res.parentId + } + + if (!is(fromJS(originMenu), fromJS(_originMenu))) { + this.setState({ + closeVisible: true + }) + } else { + this.props.handleConfig('') + } + }, () => { + this.setState({ + closeVisible: true + }) + }) + } } queryField = (type) => { @@ -834,6 +931,7 @@ } }) } + this.setState({ addType: type, tableVisible: true, @@ -842,6 +940,13 @@ } addFieldSubmit = () => { + if (!this.state.fields || this.state.fields.length === 0) { + this.setState({ + tableVisible: false, + addType: '' + }) + } + const {addType, config} = this.state let cards = this.refs.searchcard.getSelectedCard() @@ -922,6 +1027,7 @@ field: item.field, Hide: 'false', IsSort: 'true', + type: 'text', Width: 120 } @@ -951,75 +1057,16 @@ }) } - UNSAFE_componentWillMount () { - let _config = '' - if (this.props.type === 'add') { - _config = JSON.parse(JSON.stringify((this.state.baseconfig))) - } else { - _config = this.props.menu.LongParam - } - this.setState({ - config: _config, - menuformlist: [ - { - type: 'select', - key: 'parentId', - label: this.state.dict['header.menu.supMenu'], - initVal: this.props.supMenu.MenuID, - required: true, - readonly: false, - options: this.props.supMenuList - }, - { - type: 'text', - key: 'menuName', - label: this.state.dict['header.menu.menuName'], - initVal: this.props.menu.MenuName, - required: true, - readonly: false - }, - { - type: 'text', - key: 'menuNo', - label: this.state.dict['header.menu.menuNo'], - initVal: this.props.menu.MenuNo, - required: true, - readonly: false - }, - { - type: 'select', - key: 'opentype', - label: this.state.dict['header.menu.openType'], - initVal: this.props.menu.PageParam.OpenType, - required: true, - options: [{ - MenuID: 'newtab', - text: this.state.dict['header.form.tab'] - }, { - MenuID: 'newpage', - text: this.state.dict['header.form.newpage'] - }] - } - ] - }) - let _text = "select TbName ,Remark from sDataDictionary where IsKey!='' and Deleted =0" - _text = Utils.formatOptions(_text) - console.log(_text) - // Api.getSystemConfig({func: 'sPC_Get_SelectedList', LText: _text, obj_name: ''}).then(res => { - - // }) - } - onTableChange = (value) => { const {tables, selectedTables, tableColumns} = this.state - let _table = tables.filter(item => item.name === value)[0] - let isSelected = !!selectedTables.filter(cell => cell.name === value)[0] + let _table = tables.filter(item => item.TbName === value)[0] + let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] if (!isSelected) { this.setState({ selectedTables: [...selectedTables, _table] }) - Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: 'SRMPurchaseOrder'}).then(res => { + Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { if (res.status) { let tabmsg = { tableName: _table.name, @@ -1028,22 +1075,22 @@ let _decimal = 0 if (/^nvarchar/.test(_type)) { _type = 'text' - // } else if (/^int/.test(_type)) { - // _type = 'number' - // } else if (/^decimal/.test(_type)) { - // _decimal = _type.split(',')[1] - // _decimal = parseInt(_decimal) - // if (_decimal > 4) { - // _decimal = 4 - // } - // _type = 'number' - // } else if (/^decimal/.test(_type)) { - // _decimal = _type.split(',')[1] - // _decimal = parseInt(_decimal) - // if (_decimal > 4) { - // _decimal = 4 - // } - // _type = 'number' + } else if (/^int/.test(_type)) { + _type = 'number' + } else if (/^decimal/.test(_type)) { + _decimal = _type.split(',')[1] + _decimal = parseInt(_decimal) + if (_decimal > 4) { + _decimal = 4 + } + _type = 'number' + } else if (/^decimal/.test(_type)) { + _decimal = _type.split(',')[1] + _decimal = parseInt(_decimal) + if (_decimal > 4) { + _decimal = 4 + } + _type = 'number' } else if (/^datetime/.test(_type)) { _type = 'datetime' } else if (/^date/.test(_type)) { @@ -1083,6 +1130,28 @@ }) } + changeSetting = () => { + this.setState({ + settingVisible: true + }) + } + + settingSave = () => { + const {config} = this.state + this.settingRef.handleConfirm().then(res => { + this.setState({ + config: {...config, setting: res}, + settingVisible: false + }) + }) + } + + cancelSetting = () => { + this.setState({ + settingVisible: false + }) + } + render () { return ( <div className="common-table-board"> @@ -1107,27 +1176,29 @@ onChange={this.onTableChange} showArrow={false} getPopupContainer={() => document.getElementById('common-basedata')} - filterOption={(input, option) => - option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } + filterOption={(input, option) => { + console.log(option) + return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + }} > {this.state.tables.map((table, index) => ( - <Option key={index} value={table.name}>{table.label}</Option> + <Option key={index} value={table.TbName}>{table.Remark}</Option> ))} </Select> {this.state.selectedTables.length > 0 && <List size="small" bordered dataSource={this.state.selectedTables} - renderItem={(item, index) => <List.Item key={index} title={item.name + '--' + item.label}> - {item.name + '--' + item.label} + renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}> + {item.Remark + ' (' + item.TbName + ')'} <Icon type="close" onClick={() => this.deleteTable(item)}/> + <div className="bottom-mask"></div> </List.Item>} />} </Panel> <Panel header="鎼滅储" key="1"> <div className="search-element"> - {this.state.searchItems.map((item, index) => { + {Source.searchItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) })} </div> @@ -1135,14 +1206,33 @@ </Panel> <Panel header="鎸夐挳" key="2"> <div className="search-element"> - {this.state.actionItems.map((item, index) => { + {Source.actionItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) + })} + </div> + <div> + <p style={{marginTop: '20px', marginBottom: '10px', color: '#1890ff'}}>鍙厤缃寜閽細</p> + {this.state.config.action.map((item, index) => { + if (item.OpenType === 'pop' && !item.origin) { + return ( + <div key={index}> + <Button + icon={item.icon} + style={{marginBottom: '10px'}} + className={'mk-btn mk-' + item.class} + onClick={() => this.queryField('search')} + >{item.label}</Button> + </div> + ) + } else { + return '' + } })} </div> </Panel> <Panel header="鏄剧ず鍒�" key="3"> <div className="search-element"> - {this.state.columnItems.map((item, index) => { + {Source.columnItems.map((item, index) => { return (<SourceElement key={index} content={item}/>) })} </div> @@ -1154,10 +1244,11 @@ <Card title="椤甸潰閰嶇疆" bordered={false} extra={ <div> <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> - <Button type="primary" onClick={this.submitConfig}>{this.state.dict['header.submit']}</Button> - <Button onClick={this.cancelConfig}>{this.state.dict['header.cancel']}</Button> + <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> + <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> </div> } style={{ width: '100%' }}> + <Icon type="setting" onClick={this.changeSetting} /> <div className="search-list"> {this.state.config.search && !this.state.searchloading && <DragElement @@ -1196,32 +1287,31 @@ visible={this.state.visible} width={700} onCancel={this.handleCancel} - footer={null} + footer={[ + <Button key="delete" type="danger" onClick={this.deleteElement}>{this.state.dict['header.delete']}</Button>, + <Button key="cancel" onClick={this.handleCancel}>{this.state.dict['header.cancel']}</Button>, + <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> + ]} destroyOnClose > - {this.state.formlist && this.state.formtemp === 'search' && <SearchForm + {this.state.formtemp === 'search' && <SearchForm dict={this.state.dict} formlist={this.state.formlist} card={this.state.card} wrappedComponentRef={(inst) => this.formRef = inst} />} - {this.state.formlist && this.state.formtemp === 'action' && <ActionForm + {this.state.formtemp === 'action' && <ActionForm dict={this.state.dict} card={this.state.card} formlist={this.state.formlist} wrappedComponentRef={(inst) => this.formRef = inst} />} - {this.state.formlist && this.state.formtemp === 'columns' && <ColumnForm + {this.state.formtemp === 'columns' && <ColumnForm dict={this.state.dict} card={this.state.card} formlist={this.state.formlist} wrappedComponentRef={(inst) => this.formRef = inst} />} - <div className="edit-modal-footer"> - <Button type="danger" onClick={this.deleteElement}>{this.state.dict['header.delete']}</Button> - <Button onClick={this.handleCancel}>{this.state.dict['header.cancel']}</Button> - <Button type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> - </div> </Modal> <Modal title={this.state.dict['header.edit']} @@ -1238,8 +1328,38 @@ {this.state.addType === 'columns' && this.state.fields.length > 0 && <EditCard data={this.state.fields} ref="searchcard" type="columns" /> } + {(!this.state.fields || this.state.fields.length === 0) && + <Empty /> + } </Modal> - {this.state.loading && <Spin size="large" style={{position: 'fixed', left: '49vw', top: '230px'}} />} + <Modal + title={this.state.dict['header.edit']} + visible={this.state.settingVisible} + width={700} + onOk={this.settingSave} + onCancel={this.cancelSetting} + destroyOnClose + > + <SettingForm + data={this.state.config.setting} + dict={this.state.dict} + wrappedComponentRef={(inst) => this.settingRef = inst} + /> + </Modal> + <Modal + bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} + closable={false} + visible={this.state.closeVisible} + onCancel={() => { this.setState({closeVisible: false}) }} + footer={[ + <Button key="save" className="mk-btn mk-green" onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, + <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>, + <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> + ]} + destroyOnClose + > + 鑿滃崟閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� + </Modal> </div> ) } diff --git a/src/components/sidemenu/comtableconfig/index.scss b/src/components/sidemenu/comtableconfig/index.scss index 1de9418..ecb583f 100644 --- a/src/components/sidemenu/comtableconfig/index.scss +++ b/src/components/sidemenu/comtableconfig/index.scss @@ -13,7 +13,7 @@ background: #ffffff; border-right: 1px solid #d9d9d9; height: 100%; - overflow-y: hidden; + overflow-y: auto; padding-bottom: 30px; .ant-collapse-item { border: 0; @@ -55,38 +55,57 @@ .ant-list { margin-top: 20px; .ant-list-item { + display: -webkit-box; + padding-right: 20px; position: relative; padding-left: 5px; overflow: hidden; text-overflow: ellipsis; - white-space: nowrap; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + // white-space: nowrap; width: 100%; .anticon { position: absolute; top: 0px; right: 0px; - padding: 3px; + padding: 3px 3px 10px 10px; cursor: pointer; + } + .bottom-mask { + position: absolute; + width: 100%; + height: 8px; + bottom: 0; + left: 0; + background: #ffffff; + border-radius: 8px; } } } } - .tools:hover { - overflow-y: auto; - } + .tools::-webkit-scrollbar { width: 7px; } .tools::-webkit-scrollbar-thumb { border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0); + background: rgba(0, 0, 0, 0); + } + .tools::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0); + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0); + background: rgba(0, 0, 0, 0); + } + .tools:hover::-webkit-scrollbar-thumb { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); background: rgba(0, 0, 0, 0.13); } - .tools::-webkit-scrollbar-track { + .tools:hover::-webkit-scrollbar-track { box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.07); - background: rgba(0, 0, 0, 0); } .setting { position: relative; @@ -108,6 +127,7 @@ } } .ant-card-body { + position: relative; padding: 0; .search-list { @@ -124,14 +144,14 @@ padding: 0; } .page-card { - cursor: move; position: relative; background: #ffffff; border-radius: 2px; padding-top: 15px; .ant-form-item { + cursor: move; display: flex; - margin-bottom: 10px; + margin-bottom: 0px; .ant-form-item-label { width: 100px; height: 40px; @@ -163,15 +183,6 @@ } } } - // .close { - // position: absolute; - // right: 0; - // top: 0; - // cursor: pointer; - // :hover { - // color: #ffffff; - // } - // } .edit { position: absolute; left: 0; @@ -289,6 +300,12 @@ } } } + > .anticon-setting { + position: absolute; + font-size: 16px; + right: 10px; + top: 10px; + } } } .setting:hover { diff --git a/src/components/sidemenu/comtableconfig/menuform/index.jsx b/src/components/sidemenu/comtableconfig/menuform/index.jsx index 11b1b38..aa09a7c 100644 --- a/src/components/sidemenu/comtableconfig/menuform/index.jsx +++ b/src/components/sidemenu/comtableconfig/menuform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, notification } from 'antd' +import { Form, Row, Col, Input, Select } from 'antd' import './index.scss' class MainSearch extends Component { @@ -69,11 +69,6 @@ if (!err) { resolve(values) } else { - notification.warning({ - top: 92, - message: this.props.dict['header.menu.basemsg'], - duration: 10 - }) reject(err) } }) diff --git a/src/components/sidemenu/comtableconfig/searchform/index.scss b/src/components/sidemenu/comtableconfig/searchform/index.scss index 3ba26d4..1dc8fa9 100644 --- a/src/components/sidemenu/comtableconfig/searchform/index.scss +++ b/src/components/sidemenu/comtableconfig/searchform/index.scss @@ -10,7 +10,4 @@ width: 100%; } } - .ant-form-item { - margin-bottom: 15px; - } } \ No newline at end of file diff --git a/src/components/sidemenu/comtableconfig/settingform/index.jsx b/src/components/sidemenu/comtableconfig/settingform/index.jsx new file mode 100644 index 0000000..80780e0 --- /dev/null +++ b/src/components/sidemenu/comtableconfig/settingform/index.jsx @@ -0,0 +1,92 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Input, Radio } from 'antd' +import './index.scss' + +const { TextArea } = Input + +class SettingForm extends Component { + static propTpyes = { + dict: PropTypes.object, // 瀛楀吀椤� + formlist: PropTypes.any, + card: PropTypes.object + } + + state = { + + } + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + resolve(values) + } else { + reject(err) + } + }) + }) + } + + render() { + const { data, dict } = this.props + const { getFieldDecorator } = this.props.form + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + return ( + <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form"> + <Row gutter={24}> + <Col span={12}> + <Form.Item label="鍥哄畾鎸夐挳"> + {getFieldDecorator('actionfixed', { + initialValue: data.actionfixed + })( + <Radio.Group> + <Radio value={true}>鏄�</Radio> + <Radio value={false}>鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={12}> + <Form.Item label="鍥哄畾鍒�"> + {getFieldDecorator('columnfixed', { + initialValue: data.columnfixed + })( + <Radio.Group> + <Radio value={true}>鏄�</Radio> + <Radio value={false}>鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鏁版嵁婧�" className="textarea"> + {getFieldDecorator('dataresource', { + initialValue: data.dataresource, + rules: [ + { + required: true, + message: dict['form.required.input'] + '鏁版嵁婧�!' + } + ] + })(<TextArea rows={4} />)} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/components/sidemenu/comtableconfig/settingform/index.scss b/src/components/sidemenu/comtableconfig/settingform/index.scss new file mode 100644 index 0000000..bf9fa12 --- /dev/null +++ b/src/components/sidemenu/comtableconfig/settingform/index.scss @@ -0,0 +1,10 @@ +.ant-advanced-search-form.commontable-setting-form { + .textarea { + .ant-form-item-label { + width: 16.3%; + } + .ant-form-item-control-wrapper { + width: 83.33333333%; + } + } +} \ No newline at end of file diff --git a/src/components/sidemenu/comtableconfig/source.jsx b/src/components/sidemenu/comtableconfig/source.jsx new file mode 100644 index 0000000..f2c786b --- /dev/null +++ b/src/components/sidemenu/comtableconfig/source.jsx @@ -0,0 +1,267 @@ +import Utils from '@/utils/utils.js' +import zhCN from '@/locales/zh-CN/comtable.js' +import enUS from '@/locales/en-US/comtable.js' + +const CommonDict = (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS + +class CommonTableBaseData { + baseConfig = { + type: 'system', + setting: { + actionfixed: false, + columnfixed: false, + dataresource: '' + }, + tables: [], + search: [ + { + origin: true, + id: 0, + uuid: Utils.getuuid(), + label: 'text', + field: '', + initval: '', + type: 'text', + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + display: 'dropdown' + }, { + origin: true, + id: 1, + uuid: Utils.getuuid(), + label: 'select', + field: '', + initval: '', + type: 'select', + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + display: 'dropdown' + }, { + origin: true, + id: 2, + uuid: Utils.getuuid(), + label: 'date', + field: '', + initval: '', + type: 'date', + resourceType: '0', + setAll: 'false', + options: [], + dataSource: '', + linkField: '', + valueField: '', + valueText: '', + orderBy: '', + orderType: 'asc', + display: 'dropdown' + } + ], + action: [ + { + origin: true, + id: 0, + uuid: Utils.getuuid(), + label: 'add', + intertype: 'inner', + innerFunc: '', + interface: '', + outerFunc: '', + callbackFunc: '', + Ot: 'notRequired', + OpenType: 'pop', + pageTemplate: '', + icon: 'plus', + class: 'green' + }, { + origin: true, + id: 1, + uuid: Utils.getuuid(), + label: 'update', + intertype: 'inner', + innerFunc: '', + interface: '', + outerFunc: '', + callbackFunc: '', + Ot: 'requiredSgl', + OpenType: 'pop', + pageTemplate: '', + icon: 'form', + class: 'purple' + }, { + origin: true, + id: 2, + uuid: Utils.getuuid(), + label: 'delete', + intertype: 'inner', + innerFunc: '', + interface: '', + outerFunc: '', + callbackFunc: '', + Ot: 'required', + OpenType: 'prompt', + pageTemplate: '', + icon: 'delete', + class: 'red' + }, { + origin: true, + id: 3, + uuid: Utils.getuuid(), + label: 'freeze', + intertype: 'inner', + innerFunc: '', + interface: '', + outerFunc: '', + callbackFunc: '', + Ot: 'requiredOnce', + OpenType: 'exec', + pageTemplate: '', + icon: '', + class: 'default' + } + ], + columns: [ + { + origin: true, + id: 0, + uuid: Utils.getuuid(), + Align: 'left', + label: 'fieldName1', + field: '', + Hide: 'false', + IsSort: 'true', + type: 'text', + Width: 120 + }, { + origin: true, + id: 1, + uuid: Utils.getuuid(), + Align: 'left', + label: 'fieldName2', + field: '', + Hide: 'false', + IsSort: 'true', + type: 'text', + Width: 120 + }, { + origin: true, + id: 2, + uuid: Utils.getuuid(), + Align: 'left', + label: 'fieldName3', + field: '', + Hide: 'false', + IsSort: 'true', + type: 'text', + Width: 120 + }, { + origin: true, + id: 3, + uuid: Utils.getuuid(), + Align: 'left', + label: 'fieldName4', + field: '', + Hide: 'false', + IsSort: 'true', + type: 'text', + Width: 120 + } + ] + } + + searchItems = [ + { + type: 'search', + label: '鏂囨湰妗�', + subType: 'text', + url: '' + }, + { + type: 'search', + label: '涓嬫媺妗�', + subType: 'select', + url: '' + }, + { + type: 'search', + label: '鏃堕棿妗嗭紙澶╋級', + subType: 'date', + url: '' + }, + { + type: 'search', + label: '鏃堕棿妗嗭紙绉掞級', + subType: 'datetime', + url: '' + } + ] + + actionItems = [ + { + type: 'action', + label: CommonDict['header.form.pop'], + subType: 'pop', + url: '' + }, + { + type: 'action', + label: CommonDict['header.form.prompt'], + subType: 'prompt', + url: '' + }, + { + type: 'action', + label: CommonDict['header.form.exec'], + subType: 'exec', + url: '' + }, + { + type: 'action', + label: CommonDict['header.form.tab'], + subType: 'tab', + url: '' + }, + { + type: 'action', + label: CommonDict['header.form.newpage'], + subType: 'newpage', + url: '' + }, + { + type: 'action', + label: CommonDict['header.form.blank'], + subType: 'blank', + url: '' + } + ] + + columnItems = [ + { + type: 'columns', + label: CommonDict['header.form.text'], + subType: 'text', + url: '' + }, + { + type: 'columns', + label: CommonDict['header.form.picture'], + subType: 'picture', + url: '' + } + ] +} + +export default new CommonTableBaseData() diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index e566c2c..421da31 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -9,13 +9,15 @@ import Utils from '@/utils/utils.js' import DragElement from '../menuelement' // import MenuForm from '../menuform' -import ComTableConfig from '../comtableconfig' +// import ComTableConfig from '../comtableconfig' +import asyncComponent from '@/utils/asyncComponent' import Api from '@/api' import zhCN from '@/locales/zh-CN/header.js' import enUS from '@/locales/en-US/header.js' import nortable from '@/assets/img/normaltable.jpg' import './index.scss' +const ComTableConfig = asyncComponent(() => import('../comtableconfig')) const { confirm } = Modal const { TabPane } = Tabs const illust = { @@ -103,19 +105,20 @@ } Api.getSystemConfig(param).then(res => { if (res.status) { - let _LongParam = window.atob(res.LongParam) + let _LongParam = res.LongParam && window.decodeURIComponent(window.atob(res.LongParam)) try { _LongParam = JSON.parse(_LongParam) } catch (e) { _LongParam = { type: 'system', + setting: {}, search: [], action: [], columns: [] } } _menu.LongParam = _LongParam - console.log(_menu) + // console.log(_menu) // 妫�娴嬫ā鏉挎槸鍚﹀瓨鍦� let _Template = this.state.baseTemplates.filter(temp => temp.type === _menu.PageParam.Template) this.setState({ @@ -208,87 +211,6 @@ this.props.exitEdit() } } - - // memuHandleSubmit = () => { - // if (this.state.type === 'add') { - // // 鏂板缓鑿滃崟锛氭彁浜� - // this.menuFormRef.handleConfirm().then(values => { - // let param = { - // func: 'sPC_TrdMenu_Add', - // ParentID: this.props.supMenu.MenuID, - // MenuID: Utils.getuuid(), - // MenuNo: values.menuNo, - // Template: this.state.selectTemp.type, - // MenuName: values.menuName, - // Sort: (this.props.menulist.length + 1) * 10, - // PageParam: JSON.stringify({ - // OpenType: values.opentype, - // Template: this.state.selectTemp.type - // }), - // LongParam: window.btoa(JSON.stringify(this.state.selectTemp.baseconfig)) - // } - // this.setState({ - // confirmLoading: true - // }) - // Api.getSystemConfig(param).then(res => { - // if (res.status) { - // this.setState({ - // confirmLoading: false, - // tabview: '', - // visible: false - // }) - // this.props.reload() - // this.resetFormlist() - // } else { - // this.setState({ - // confirmLoading: false - // }) - // notification.warning({ - // top: 92, - // message: res.message, - // duration: 10 - // }) - // } - // }) - // }, () => {}) - // } else if (this.state.type === 'edit') { - // // 缂栬緫鑿滃崟锛氭彁浜� - // this.menuFormRef.handleConfirm().then(values => { - // let param = { - // func: 'sPC_TrdMenu_Upt', - // ParentID: values.parentId, - // MenuID: this.state.editMenu.MenuID, - // MenuNo: values.menuNo, - // Template: this.state.editMenu.PageParam.Template || '', - // MenuName: values.menuName, - // PageParam: JSON.stringify(this.state.editMenu.PageParam), - // LongParam: this.state.editMenu.LongParam ? window.btoa(this.state.editMenu.LongParam) : '' - // } - // this.setState({ - // confirmLoading: true - // }) - // Api.getSystemConfig(param).then(res => { - // if (res.status) { - // this.setState({ - // confirmLoading: false, - // editMvisible: false - // }) - // this.props.reload() - // this.resetFormlist() - // } else { - // this.setState({ - // confirmLoading: false - // }) - // notification.warning({ - // top: 92, - // message: res.message, - // duration: 10 - // }) - // } - // }) - // }, () => {}) - // } - // } // memuHandleCancel = () => { // this.setState({ @@ -621,41 +543,6 @@ } {/* 鍥剧墖棰勮 */} <Preview cancel={this.cancelPrePicture} preview={this.state.preview}/> - {/* 娣诲姞妯℃�佹 */} - {/* <Modal - title={this.state.title} - okText={this.state.dict['header.confirm']} - cancelText={this.state.dict['header.cancel']} - visible={this.state.visible} - onOk={this.memuHandleSubmit} - confirmLoading={this.state.confirmLoading} - onCancel={this.memuHandleCancel} - > - {this.state.formlist && this.state.type === 'add' && <MenuForm - dict={this.state.dict} - formlist={this.state.formlist} - wrappedComponentRef={(inst) => this.menuFormRef = inst} - />} - </Modal> */} - {/* 缂栬緫妯℃�佹 */} - {/* <Modal - title={this.state.title} - visible={this.state.editMvisible} - footer={null} - onCancel={this.memuHandleCancel} - > - {this.state.formlist && this.state.type === 'edit' && <MenuForm - dict={this.state.dict} - formlist={this.state.formlist} - wrappedComponentRef={(inst) => this.menuFormRef = inst} - />} - <div className="edit-modal-footer"> - <Button className="mk-btn mk-green" onClick={this.changeTemp}>鍒囨崲妯℃澘</Button> - <Button className="mk-btn mk-purple" onClick={this.changeConfig}>鏇存敼閰嶇疆</Button> - <Button onClick={this.memuHandleCancel}>{this.state.dict['header.cancel']}</Button> - <Button type="primary" onClick={this.memuHandleSubmit} loading={this.state.confirmLoading}>{this.state.dict['header.confirm']}</Button> - </div> - </Modal> */} {/* 瑙e喕鑿滃崟妯℃�佹 */} <Modal title={this.state.dict['header.thawmenu']} diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js index 3a6440f..5b1ad4c 100644 --- a/src/locales/en-US/comtable.js +++ b/src/locales/en-US/comtable.js @@ -5,6 +5,8 @@ 'header.cancel': 'Cancel', 'header.edit': 'Edit', 'header.return': 'Back', + 'header.save': 'Save', + 'header.notsave': '涓嶄繚瀛�', 'header.close': 'Close', 'header.menu.basemsg': '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', 'header.menu.template.change': '鍒囨崲妯℃澘', diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js index fcfe360..47593d8 100644 --- a/src/locales/zh-CN/comtable.js +++ b/src/locales/zh-CN/comtable.js @@ -5,6 +5,8 @@ 'header.cancel': '鍙栨秷', 'header.edit': '缂栬緫', 'header.return': '杩斿洖', + 'header.save': '淇濆瓨', + 'header.notsave': '涓嶄繚瀛�', 'header.close': '鍏抽棴', 'header.menu.basemsg': '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', 'header.menu.template.change': '鍒囨崲妯℃澘', diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 10a2908..ddbdb1f 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -10,7 +10,7 @@ import logourl from '../../assets/img/login-logo.png' import './index.scss' -const { confirm } = Modal +const { warning } = Modal class Login extends Component { constructor (props) { @@ -59,7 +59,7 @@ // 鐧诲綍鍙傛暟妫�楠� e.preventDefault() if (!this.state.auth) { - confirm({ + warning({ title: this.state.dict['login.auth.tip'], okText: this.state.dict['login.auth.ok'], cancelText: this.state.dict['login.auth.cancel'], -- Gitblit v1.8.0