| | |
| | | return Promise.resolve(response.data) |
| | | } |
| | | }, (error) => { |
| | | // console.log(error.response.status) |
| | | return Promise.reject(error) |
| | | }) |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | addMvisible: false, |
| | | menulist: null |
| | | }) |
| | | this.addMenuFormRef.handleReset('add') |
| | | this.props.reload() |
| | | } else { |
| | | this.setState({ |
| | |
| | | confirmLoading: false, |
| | | addMvisible: false |
| | | }) |
| | | this.addMenuFormRef.handleReset('add') |
| | | } |
| | | |
| | | deleteMemu = () => { |
| | |
| | | onOk={this.addMemuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.addMemuCancel} |
| | | destroyOnClose |
| | | > |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | |
| | | 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}/>} |
| | |
| | | {/* 编辑菜单模态框 */} |
| | | <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} |
| | |
| | | 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> |
| | | ) |
| | |
| | | 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' |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | 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() { |
| | |
| | | .ant-advanced-search-form.commontable-action-form { |
| | | min-height: 190px; |
| | | .ant-form-item { |
| | | margin-bottom: 15px; |
| | | } |
| | | } |
| | |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = item.subType |
| | | newcard.icon = '' |
| | | newcard.class = 'green' |
| | | newcard.class = 'default' |
| | | newcard.intertype = 'inner' |
| | | newcard.interface = '' |
| | | newcard.callbackFunc = '' |
| | |
| | | |
| | | 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}> |
| | |
| | | <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>} |
| | |
| | | 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 { |
| | |
| | | } |
| | | |
| | | state = { |
| | | operaType: '', // 操作类型,新建或编辑 |
| | | dict: CommonDict, // 字典 |
| | | config: null, // 页面配置 |
| | | visible: false, // 搜索条件、按钮、显示列,模态框显示控制 |
| | |
| | | addType: '', // 添加类型-搜索条件或显示列 |
| | | tableColumns: [], // 表格显示列 |
| | | fields: null, // 搜索条件及显示列,可选字段 |
| | | loading: false, // 加载中(获取表数据) |
| | | menuformlist: null, // 基本信息表单字段 |
| | | formlist: null, // 搜索条件、按钮、显示列表单字段 |
| | | formtemp: '', // 表单类型,显示列、按钮、搜索条件 |
| | |
| | | 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) { |
| | |
| | | type: 'radio', |
| | | key: 'resourceType', |
| | | label: this.state.dict['header.form.resourceType'], |
| | | initVal: card.resourceType, |
| | | initVal: card.resourceType || '0', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: '0', |
| | |
| | | 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'] |
| | |
| | | type: 'textarea', |
| | | key: 'dataSource', |
| | | label: this.state.dict['header.form.datasource'], |
| | | initVal: card.dataSource, |
| | | initVal: card.dataSource || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | type: 'options', |
| | | key: 'options', |
| | | label: '', |
| | | initVal: card.options, |
| | | initVal: card.options || [], |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | type: 'text', |
| | | key: 'linkField', |
| | | label: this.state.dict['header.form.linkField'], |
| | | initVal: card.linkField, |
| | | initVal: card.linkField || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: this.state.dict['header.form.valueField'], |
| | | initVal: card.valueField, |
| | | initVal: card.valueField || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | type: 'text', |
| | | key: 'valueText', |
| | | label: this.state.dict['header.form.valueText'], |
| | | initVal: card.valueText, |
| | | initVal: card.valueText || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | |
| | | type: 'text', |
| | | key: 'orderBy', |
| | | label: this.state.dict['header.form.orderBy'], |
| | | initVal: card.orderBy, |
| | | initVal: card.orderBy || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | |
| | | 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'] |
| | |
| | | type: 'select', |
| | | key: 'display', |
| | | label: this.state.dict['header.form.display'], |
| | | initVal: card.display, |
| | | initVal: card.display || 'dropdown', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'dropdown', |
| | |
| | | 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 |
| | |
| | | resetFrom = () => { |
| | | setTimeout(() => { |
| | | this.setState({ |
| | | formtemp: '', |
| | | // formtemp: '', |
| | | searchloading: false, |
| | | actionloading: false, |
| | | columnsloading: false, |
| | | formlist: null |
| | | columnsloading: false |
| | | // formlist: null |
| | | }) |
| | | }, 300) |
| | | }, 10) |
| | | } |
| | | |
| | | changeTemplate = () => { |
| | |
| | | } |
| | | |
| | | 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) => { |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | addType: type, |
| | | tableVisible: true, |
| | |
| | | } |
| | | |
| | | 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() |
| | |
| | | field: item.field, |
| | | Hide: 'false', |
| | | IsSort: 'true', |
| | | type: 'text', |
| | | Width: 120 |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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, |
| | |
| | | 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)) { |
| | |
| | | }) |
| | | } |
| | | |
| | | 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"> |
| | |
| | | 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> |
| | |
| | | </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> |
| | |
| | | <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 |
| | |
| | | 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']} |
| | |
| | | {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> |
| | | ) |
| | | } |
| | |
| | | background: #ffffff; |
| | | border-right: 1px solid #d9d9d9; |
| | | height: 100%; |
| | | overflow-y: hidden; |
| | | overflow-y: auto; |
| | | padding-bottom: 30px; |
| | | .ant-collapse-item { |
| | | border: 0; |
| | |
| | | .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; |
| | |
| | | } |
| | | } |
| | | .ant-card-body { |
| | | position: relative; |
| | | padding: 0; |
| | | |
| | | .search-list { |
| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | } |
| | | // .close { |
| | | // position: absolute; |
| | | // right: 0; |
| | | // top: 0; |
| | | // cursor: pointer; |
| | | // :hover { |
| | | // color: #ffffff; |
| | | // } |
| | | // } |
| | | .edit { |
| | | position: absolute; |
| | | left: 0; |
| | |
| | | } |
| | | } |
| | | } |
| | | > .anticon-setting { |
| | | position: absolute; |
| | | font-size: 16px; |
| | | right: 10px; |
| | | top: 10px; |
| | | } |
| | | } |
| | | } |
| | | .setting:hover { |
| | |
| | | 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 { |
| | |
| | | if (!err) { |
| | | resolve(values) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.menu.basemsg'], |
| | | duration: 10 |
| | | }) |
| | | reject(err) |
| | | } |
| | | }) |
| | |
| | | width: 100%; |
| | | } |
| | | } |
| | | .ant-form-item { |
| | | margin-bottom: 15px; |
| | | } |
| | | } |
New file |
| | |
| | | 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) |
New file |
| | |
| | | .ant-advanced-search-form.commontable-setting-form { |
| | | .textarea { |
| | | .ant-form-item-label { |
| | | width: 16.3%; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | width: 83.33333333%; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | 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() |
| | |
| | | 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 = { |
| | |
| | | } |
| | | 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({ |
| | |
| | | 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({ |
| | |
| | | } |
| | | {/* 图片预览 */} |
| | | <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> */} |
| | | {/* 解冻菜单模态框 */} |
| | | <Modal |
| | | title={this.state.dict['header.thawmenu']} |
| | |
| | | 'header.cancel': 'Cancel', |
| | | 'header.edit': 'Edit', |
| | | 'header.return': 'Back', |
| | | 'header.save': 'Save', |
| | | 'header.notsave': '不保存', |
| | | 'header.close': 'Close', |
| | | 'header.menu.basemsg': '请完善菜单基本信息!', |
| | | 'header.menu.template.change': '切换模板', |
| | |
| | | 'header.cancel': '取消', |
| | | 'header.edit': '编辑', |
| | | 'header.return': '返回', |
| | | 'header.save': '保存', |
| | | 'header.notsave': '不保存', |
| | | 'header.close': '关闭', |
| | | 'header.menu.basemsg': '请完善菜单基本信息!', |
| | | 'header.menu.template.change': '切换模板', |
| | |
| | | import logourl from '../../assets/img/login-logo.png' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const { warning } = Modal |
| | | |
| | | class Login extends Component { |
| | | constructor (props) { |
| | |
| | | // 登录参数检验 |
| | | 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'], |