| | |
| | | .ant-popover { |
| | | z-index: 1070!important; |
| | | } |
| | | // 气泡确认框 |
| | | .ant-popover.popover-confirm { |
| | | z-index: 1080!important; |
| | | } |
| | | |
| | | .ant-notification-notice.notification-custom-error { |
| | | background: #f5222d; |
| | |
| | | } |
| | | .mk-popover-control { |
| | | i { |
| | | padding: 0 5px; |
| | | padding: 5px 8px; |
| | | cursor: pointer; |
| | | font-size: 16px; |
| | | } |
| | | .edit { |
| | | color: #1890ff; |
| | |
| | | } |
| | | } |
| | | .ant-popover-inner-content { |
| | | padding: 5px 10px; |
| | | padding: 5px 20px; |
| | | } |
| | | } |
| | | } |
| | |
| | | confirm({ |
| | | title: this.state.dict['main.logout.hint'], |
| | | content: '', |
| | | okText: this.state.dict['main.confirm'], |
| | | cancelText: this.state.dict['main.cancel'], |
| | | onOk() { |
| | | sessionStorage.clear() |
| | | _this.props.logout() |
| | |
| | | confirm({ |
| | | title: this.state.dict['main.verup'], |
| | | content: `最新版本${newVersion},当前版本${oriVersion}`, |
| | | okText: this.state.dict['main.confirm'], |
| | | cancelText: this.state.dict['main.cancel'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | Api.updateAppVersion(newVersion).then(res => { |
| | |
| | | {/* 修改密码 */} |
| | | <Modal |
| | | title={this.state.dict['main.password']} |
| | | okText={this.state.dict['main.confirm']} |
| | | cancelText={this.state.dict['main.cancel']} |
| | | visible={this.state.visible} |
| | | onOk={this.resetPwdSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | |
| | | {/* 编辑状态登录 */} |
| | | <Modal |
| | | title={this.state.dict['main.login.develop']} |
| | | okText={this.state.dict['main.confirm']} |
| | | cancelText={this.state.dict['main.cancel']} |
| | | visible={this.state.loginVisible} |
| | | onOk={this.loginSubmit} |
| | | width={'430px'} |
| | |
| | | import PropTypes from 'prop-types' |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import {Tabs, Icon, Button, ConfigProvider, message, BackTop} from 'antd' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | import {Tabs, Icon, Button, message, BackTop} from 'antd' |
| | | import moment from 'moment' |
| | | import 'moment/locale/zh-cn' |
| | | |
| | |
| | | state = { |
| | | tabviews: null, // 标签集 |
| | | iFrameHeight: 0, |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS, |
| | | locale: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS |
| | | } |
| | | |
| | | handleTabview = (e, menu) => { |
| | |
| | | |
| | | return ( |
| | | <section className={'flex-container content-box' + (this.props.collapse ? ' collapsed' : '')}> |
| | | <ConfigProvider locale={this.state.locale}> |
| | | <div className="content-header"> |
| | | {tabviews && tabviews.length > 0 && |
| | | <Tabs activeKey={selectedTabId}> |
| | | {tabviews.map(view => { |
| | | return ( |
| | | <Tabs.TabPane |
| | | tab={ |
| | | <span className="tab-control"> |
| | | {['CommonTable', 'FormTab', 'TreePage', 'CalendarPage', 'CustomPage'].includes(view.type) ? |
| | | <Icon type="redo" onClick={(e) => {this.refreshTabview(e, view)}}/> : null |
| | | } |
| | | <span className="tab-name" onClick={(e) => {this.changeTab(e, view)}}> |
| | | {view.MenuName} |
| | | </span> |
| | | {view.type !== 'Home' ? |
| | | <Icon type="close" onClick={(e) => {this.handleTabview(e, view)}}/> : null |
| | | } |
| | | <div className="content-header"> |
| | | {tabviews && tabviews.length > 0 && |
| | | <Tabs activeKey={selectedTabId}> |
| | | {tabviews.map(view => { |
| | | return ( |
| | | <Tabs.TabPane |
| | | tab={ |
| | | <span className="tab-control"> |
| | | {['CommonTable', 'FormTab', 'TreePage', 'CalendarPage', 'CustomPage'].includes(view.type) ? |
| | | <Icon type="redo" onClick={(e) => {this.refreshTabview(e, view)}}/> : null |
| | | } |
| | | <span className="tab-name" onClick={(e) => {this.changeTab(e, view)}}> |
| | | {view.MenuName} |
| | | </span> |
| | | } |
| | | key={view.MenuID} |
| | | > |
| | | {this.selectcomponent(view)} |
| | | {options.sysType !== 'cloud' && !['CommonTable', 'TreePage', 'ManageTable', 'CalendarPage'].includes(view.type) ? |
| | | <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} |
| | | data-menuno={view.MenuNo} |
| | | onClick={this.copyMenuNo} |
| | | /> : null |
| | | } |
| | | <BackTop> |
| | | <div className="ant-back-top"> |
| | | <div className="ant-back-top-content"> |
| | | <div className="ant-back-top-icon"></div> |
| | | </div> |
| | | {view.type !== 'Home' ? |
| | | <Icon type="close" onClick={(e) => {this.handleTabview(e, view)}}/> : null |
| | | } |
| | | </span> |
| | | } |
| | | key={view.MenuID} |
| | | > |
| | | {this.selectcomponent(view)} |
| | | {options.sysType !== 'cloud' && !['CommonTable', 'TreePage', 'ManageTable', 'CalendarPage'].includes(view.type) ? |
| | | <Button |
| | | icon="copy" |
| | | shape="circle" |
| | | className={'main-copy ' + (view.type === 'iframe' ? 'ifr-copy' : '')} |
| | | data-menuno={view.MenuNo} |
| | | onClick={this.copyMenuNo} |
| | | /> : null |
| | | } |
| | | <BackTop> |
| | | <div className="ant-back-top"> |
| | | <div className="ant-back-top-content"> |
| | | <div className="ant-back-top-icon"></div> |
| | | </div> |
| | | </BackTop> |
| | | </Tabs.TabPane> |
| | | ) |
| | | })} |
| | | </Tabs> |
| | | } |
| | | </div> |
| | | </ConfigProvider> |
| | | </div> |
| | | </BackTop> |
| | | </Tabs.TabPane> |
| | | ) |
| | | })} |
| | | </Tabs> |
| | | } |
| | | </div> |
| | | </section> |
| | | ) |
| | | } |
| | |
| | | 'main.excel.content.limitmax': '大于最大值', |
| | | 'main.form.link.error': '联动菜单设置错误!', |
| | | 'main.form.picture.check': '查看图片', |
| | | 'main.thawmenu.source': 'Frozen', |
| | | 'main.thawmenu.target': 'Unfreeze', |
| | | 'main.thawmenu.itemUnit': 'item', |
| | | 'main.thawmenu.itemsUnit': 'items', |
| | | 'main.role.title': 'The role list', |
| | | 'main.view.notFound': '抱歉,你访问的页面不存在,请联系管理员。', |
| | | 'form.required.input': 'Please enter the ', |
| | |
| | | 'model.menu.level1': 'Level 1 menu', |
| | | 'model.menu.level2': 'Level 2 menu', |
| | | 'model.menu.level3': 'Level 3 menu', |
| | | 'model.menu.all': 'All', |
| | | 'model.menu.selected': 'Selected', |
| | | 'model.menu.itemUnit': 'Item', |
| | | 'model.menu.itemsUnit': 'Items', |
| | | 'model.menu.close': 'Are you sure to delete the menu <<@M>> ?', |
| | | 'model.menu.resetorder': 'Are you sure to adjust the menu sequence ?', |
| | | 'model.menu.basemsg': 'Please complete the basic information !', |
| | |
| | | 'header.form.modal.placeholder': 'Please add the form', |
| | | 'header.form.action.placeholder': 'Please add buttons', |
| | | 'header.form.column.placeholder': 'Please add columns', |
| | | 'header.form.column.source': 'Columns', |
| | | 'header.form.column.target': 'Have been added', |
| | | 'header.form.column.itemUnit': 'Item', |
| | | 'header.form.column.itemsUnit': 'Items', |
| | | 'model.form.column.action': 'Action', |
| | | 'model.form.width': 'Width', |
| | | 'header.form.title': 'Title', |
| | |
| | | 'header.form.status.change': '状态切换', |
| | | 'header.form.status.forbidden': '禁用', |
| | | 'header.form.status.open': '启用', |
| | | 'header.form.readin': '数据写入', |
| | | 'header.form.readin.tooltip': '是否将表格或主表中的数据写入表单', |
| | | 'header.form.readin': '自动填充', |
| | | 'header.form.readin.tooltip': '是否将表格选中的数据自动填充到表单(字段相同)', |
| | | 'header.form.afterExecSuccess': '成功后', |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.form.pagination': '分页', |
| | |
| | | 'main.excel.content.limitmax': '大于最大值', |
| | | 'main.form.link.error': '联动菜单设置错误!', |
| | | 'main.form.picture.check': '查看图片', |
| | | 'main.thawmenu.source': '全部', |
| | | 'main.thawmenu.target': '已选择', |
| | | 'main.thawmenu.itemUnit': '项', |
| | | 'main.thawmenu.itemsUnit': '项', |
| | | 'main.role.title': '角色列表', |
| | | 'main.view.notFound': '抱歉,你访问的页面不存在,请联系管理员。', |
| | | 'form.required.input': '请输入', |
| | |
| | | 'model.menu.level1': '一级菜单', |
| | | 'model.menu.level2': '二级菜单', |
| | | 'model.menu.level3': '三级菜单', |
| | | 'model.menu.all': '全部', |
| | | 'model.menu.selected': '已选择', |
| | | 'model.menu.itemUnit': '项', |
| | | 'model.menu.itemsUnit': '项', |
| | | 'model.menu.close': '确定删除《@M》菜单吗?', |
| | | 'model.menu.resetorder': '确认调整菜单顺序吗?', |
| | | 'model.menu.basemsg': '请完善菜单基本信息!', |
| | |
| | | 'header.form.modal.placeholder': '请添加表单', |
| | | 'header.form.action.placeholder': '请添加按钮', |
| | | 'header.form.column.placeholder': '请添加显示列', |
| | | 'header.form.column.source': '显示列', |
| | | 'header.form.column.target': '已添加', |
| | | 'header.form.column.itemUnit': '项', |
| | | 'header.form.column.itemsUnit': '项', |
| | | 'model.form.column.action': '操作', |
| | | 'model.form.width': '宽度', |
| | | 'header.form.title': '标题', |
| | |
| | | 'header.form.status.change': '状态切换', |
| | | 'header.form.status.forbidden': '禁用', |
| | | 'header.form.status.open': '启用', |
| | | 'header.form.readin': '数据写入', |
| | | 'header.form.readin.tooltip': '是否将表格中的数据写入表单', |
| | | 'header.form.readin': '自动填充', |
| | | 'header.form.readin.tooltip': '是否将表格选中的数据自动填充到表单(字段相同)', |
| | | 'header.form.afterExecSuccess': '成功后', |
| | | 'header.form.afterExecError': '失败后', |
| | | 'header.form.pagination': '分页', |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _actionlist = fromJS(_this.state.actionlist).toJS() |
| | | |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | verify: { |
| | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | resolve(_verify) |
| | | }, |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | onConfirm={() => this.handleDelete(record) |
| | | }> |
| | | <span style={{color: '#ff4d4f', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | | </Popconfirm> |
| | | </div> |
| | | ) |
| | |
| | | }) |
| | | } |
| | | |
| | | handleDelete = (record, type) => { |
| | | handleDelete = (record) => { |
| | | const { verify } = this.state |
| | | |
| | | verify.columns = verify.columns.filter(item => item.uuid !== record.uuid) |
| | |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | verify: { |
| | |
| | | <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={props.dict['header.form.query.delete']} |
| | | okText={props.dict['model.confirm']} |
| | | cancelText={props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict } = this.props |
| | | const { view, visible, disabled } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | visible={visible} |
| | | width={850} |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | cancelText={dict['model.cancel']} |
| | | onOk={this.onSubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | destroyOnClose |
| | |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | okText={dict['model.submit']} |
| | | cancelText={dict['model.cancel']} |
| | | onOk={this.verifySubmit} |
| | | confirmLoading={loading} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.deleteColumn(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['model.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.deleteScript(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | // confirm({ |
| | | // title: this.state.dict['mob.logout.hint'], |
| | | // content: '', |
| | | // okText: this.state.dict['mob.confirm'], |
| | | // cancelText: this.state.dict['mob.cancel'], |
| | | // onOk() { |
| | | // sessionStorage.clear() |
| | | // _this.props.logout() |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | onOk() { |
| | | let _searchlist = fromJS(_this.state.searchlist).toJS() |
| | | |
| | |
| | | width={850} |
| | | maskClosable={false} |
| | | onOk={this.handleSubmit} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | confirmLoading={sqlVerifing} |
| | | onCancel={this.editModalCancel} |
| | | destroyOnClose |
| | |
| | | <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={props.dict['header.form.query.delete']} |
| | | okText={props.dict['model.confirm']} |
| | | cancelText={props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | |
| | | confirm({ |
| | | title: '确定删除元素吗?', |
| | | okText: this.state.dict['mob.confirm'], |
| | | cancelText: this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | _this.props.updateContent({...list, subItems: list.subItems.filter(item => item.uuid !== element.uuid)}) |
| | | }, |
| | |
| | | |
| | | confirm({ |
| | | title: '确定删除元素吗?', |
| | | okText: this.state.dict['mob.confirm'], |
| | | cancelText: this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | _this.props.updateContent(null) |
| | | }, |
| | |
| | | confirm({ |
| | | title: '确定删除数据源吗?', |
| | | content: '', |
| | | okText: _this.state.dict['mob.confirm'], |
| | | cancelText: _this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | _this.setState({sourcelist}) |
| | | _this.props.updateConfig({...config, sourcelist: fromJS(sourcelist).toJS()}) |
| | |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | okText={dict['mob.submit']} |
| | | cancelText={dict['mob.cancel']} |
| | | onOk={this.verifySubmit} |
| | | confirmLoading={loading} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['mob.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['mob.query.delete']} |
| | | okText={this.props.dict['mob.confirm']} |
| | | cancelText={this.props.dict['mob.cancel']} |
| | | onConfirm={() => this.deleteColumn(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['mob.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['mob.query.delete']} |
| | | okText={this.props.dict['mob.confirm']} |
| | | cancelText={this.props.dict['mob.cancel']} |
| | | onConfirm={() => this.deleteScript(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | confirm({ |
| | | title: this.state.dict['mob.logout.hint'], |
| | | content: '', |
| | | okText: this.state.dict['mob.confirm'], |
| | | cancelText: this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | sessionStorage.clear() |
| | | _this.props.logout() |
| | |
| | | confirm({ |
| | | title: '确定删除《' + card.name + '》吗?', |
| | | content: '', |
| | | okText: this.state.dict['mob.confirm'], |
| | | cancelText: this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | return new Promise(resolve => { |
| | | let param = { |
| | |
| | | width={'600px'} |
| | | maskClosable={false} |
| | | visible={this.state.visible} |
| | | okText={this.state.dict['mob.confirm']} |
| | | cancelText={this.state.dict['mob.cancel']} |
| | | onCancel={() => this.setState({visible: false})} |
| | | confirmLoading={this.state.confirmloading} |
| | | onOk={this.submitCard} |
| | |
| | | sysType: 'bG9j$mkYWw=', // yun ( Y2xv$mkdWQ= ) 、 dandian ( U1$mkNP ) 、 yewu ( bG9j$mkYWw= ) |
| | | caId: 'MjAyMDAxMTYxMjMzMzU1MDd$mkGQzkyMzI1Rjk4MDY0QUNGQjQ2Mg==', |
| | | cakey: 'MjAyMDAxMTYxMjQwMDQ2NDM$mk2N0QzODE2MjExNUI0MTc4OTVDMQ==', |
| | | cdomain: 'aHR0cDovL2Nsb3V$mkkLm1rOWguY24=', // window.btoa('') 域名 不带 / |
| | | // cdomain: 'aHR0cDovL2Nsb3VkLnBv$mkc2l0ZWNncm91cC5jb206ODA4MA==', // bao—shi-de |
| | | cdomain: 'aHR0cDovL2Nsb3V$mkkLm1rOWguY24=', // window.btoa('') 域名 不带 /; baoshide ( aHR0cDovL2Nsb3VkLnBv$mkc2l0ZWNncm91cC5jb206ODA4MA== ) |
| | | styles: { |
| | | white: 'mk-white' |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | console.log(_columns) |
| | | |
| | | this.setState({ |
| | | BID: param && param.BID ? param.BID : '', |
| | | loadingview: false, |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Chart } from '@antv/g2' |
| | | import DataSet from '@antv/data-set' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import './index.scss' |
| | | |
| | | const SettingComponent = asyncComponent(() => import('@/menu/datasourcecomponent')) |
| | | const SearchComponent = asyncComponent(() => import('@/menu/searchcomponent')) |
| | | const ActionComponent = asyncComponent(() => import('@/menu/actioncomponent')) |
| | | |
| | | class antvBarLineChart extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | card: PropTypes.object, |
| | | editId: PropTypes.any, |
| | | triggerEdit: PropTypes.func, |
| | | updateConfig: PropTypes.func, |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null, |
| | | visible: true |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card, config } = this.props |
| | | |
| | | if (card.isNew) { |
| | | let _plot = { |
| | | chartType: card.type, // 图表类型 |
| | | enabled: 'false', // 是否使用自定义设置 |
| | | datatype: 'query', // 数据类型查询或统计 |
| | | customs: [] |
| | | } |
| | | |
| | | if (card.subtype === 'bar') { |
| | | _plot.coordinate = 'angle' // 二维坐标或极坐标 |
| | | _plot.transpose = 'false' // 坐标轴变换 |
| | | } else if (card.subtype === 'bar1') { |
| | | _plot.coordinate = 'angle' |
| | | _plot.transpose = 'true' |
| | | } else if (card.subtype === 'line') { |
| | | _plot.shape = 'smooth' |
| | | } else if (card.subtype === 'line1') { |
| | | _plot.shape = 'hv' |
| | | } |
| | | |
| | | let name = '' |
| | | let names = { |
| | | bar: '柱状图', |
| | | line: '折线图', |
| | | } |
| | | let i = 1 |
| | | |
| | | while (!name) { |
| | | let _name = names[card.type] + i |
| | | if (config.components.filter(com => com.setting && com.setting.name === _name).length === 0) { |
| | | name = _name |
| | | } |
| | | i++ |
| | | } |
| | | |
| | | let _card = { |
| | | uuid: card.uuid, |
| | | type: card.type, |
| | | subtype: card.subtype, |
| | | setting: {span: 12, height: 400, name}, |
| | | columns: [], |
| | | scripts: [], |
| | | search: [], |
| | | action: [], |
| | | plot: _plot |
| | | } |
| | | this.setState({ |
| | | card: _card |
| | | }) |
| | | this.props.updateConfig(_card) |
| | | } else { |
| | | this.setState({ |
| | | card: fromJS(card).toJS() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | | this.viewrender() |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.plot), fromJS(nextProps.plot))) { |
| | | |
| | | } |
| | | } |
| | | |
| | | getdata = (X_axis, Y_axis) => { |
| | | let data = [] |
| | | let xdata = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] |
| | | let point = 7 |
| | | |
| | | for (let i = 0; i < point; i++) { |
| | | let item = {} |
| | | |
| | | item[X_axis] = xdata[i] |
| | | |
| | | if (typeof(Y_axis) === 'string') { |
| | | item[Y_axis] = Math.floor(Math.random() * 5 * (i + 1)) + i |
| | | } else { |
| | | Y_axis.forEach(y => { |
| | | item[y] = Math.floor(Math.random() * 5 * (i + 1)) + i |
| | | }) |
| | | } |
| | | |
| | | data.push(item) |
| | | } |
| | | |
| | | return data |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { card } = this.state |
| | | |
| | | if (card.plot.chartType === 'line') { |
| | | this.linerender() |
| | | } else if (card.plot.chartType === 'bar') { |
| | | this.barrender() |
| | | } |
| | | } |
| | | |
| | | linerender = () => { |
| | | const { card } = this.state |
| | | let plot = {...card.plot, height: card.setting.height - 70} |
| | | |
| | | let transfield = {} |
| | | card.columns.forEach(col => { |
| | | if (col.field) { |
| | | transfield[col.field] = col.label |
| | | } |
| | | }) |
| | | |
| | | let X_axis = plot.Xaxis || 'x' |
| | | let Y_axis = plot.Yaxis || ['y'] |
| | | |
| | | let data = this.getdata(X_axis, Y_axis) |
| | | |
| | | if (plot.enabled !== 'true') { |
| | | const ds = new DataSet() |
| | | const dv = ds.createView().source(data) |
| | | |
| | | dv.transform({ |
| | | type: 'fold', |
| | | fields: [...Y_axis], |
| | | key: 'key', |
| | | value: 'value' |
| | | }) |
| | | |
| | | if (plot.Xaxis) { |
| | | dv.transform({ |
| | | type: 'map', |
| | | callback(row) { |
| | | row.key = transfield[row.key] |
| | | return row |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | const chart = new Chart({ |
| | | container: card.uuid, |
| | | autoFit: true, |
| | | height: plot.height || 400 |
| | | }) |
| | | |
| | | chart.data(dv.rows) |
| | | |
| | | if (plot.coordinate !== 'polar') { |
| | | chart.scale(X_axis, { |
| | | range: [0, 1] |
| | | }) |
| | | } |
| | | chart.scale('value', { |
| | | nice: true |
| | | }) |
| | | |
| | | if (!plot.legend || plot.legend === 'hidden') { |
| | | chart.legend(false) |
| | | } else { |
| | | chart.legend({ |
| | | position: plot.legend |
| | | }) |
| | | } |
| | | |
| | | if (plot.tooltip !== 'true') { |
| | | chart.tooltip(false) |
| | | } else { |
| | | chart.tooltip({ |
| | | shared: true |
| | | }) |
| | | } |
| | | |
| | | if (plot.transpose === 'true') { |
| | | chart.coordinate().transpose() |
| | | } |
| | | |
| | | if (plot.coordinate === 'polar') { |
| | | chart.coordinate('polar', { |
| | | innerRadius: 0.1, |
| | | radius: 0.8 |
| | | }) |
| | | } |
| | | |
| | | let _chart = chart |
| | | .line() |
| | | .position(`${X_axis}*value`) |
| | | .color('key') |
| | | .shape(plot.shape || 'smooth') |
| | | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | |
| | | if (plot.point === 'true') { |
| | | chart |
| | | .point() |
| | | .position(`${X_axis}*value`) |
| | | .color('key') |
| | | .size(3) |
| | | .shape('circle') |
| | | } |
| | | chart.render() |
| | | } else { |
| | | this.customrender(data, transfield) |
| | | } |
| | | } |
| | | |
| | | customrender = (data, transfield) => { |
| | | const { plot } = this.props |
| | | |
| | | let barfields = [] |
| | | let fields = [] |
| | | let legends = [] |
| | | |
| | | plot.customs.forEach(item => { |
| | | item.name = transfield[item.field] || item.field |
| | | if (item.axis === 'left') { |
| | | item.index = 0 |
| | | } else if (item.axis === 'right') { |
| | | item.index = 1 |
| | | } else { |
| | | item.index = 2 |
| | | } |
| | | |
| | | if (item.chartType === 'bar') { |
| | | barfields.push(item.field) |
| | | fields.unshift(item) |
| | | } else { |
| | | fields.push(item) |
| | | } |
| | | |
| | | legends.push({ |
| | | value: item.name, |
| | | name: item.name, |
| | | marker: { symbol: item.chartType === 'bar' ? 'square' : 'hyphen', style: { stroke: item.color,fill: item.color, r: 5, lineWidth: 2 } } |
| | | }) |
| | | }) |
| | | |
| | | fields.sort((a, b) => a.index - b.index) |
| | | |
| | | const ds = new DataSet() |
| | | const dv = ds.createView().source(data) |
| | | dv.transform({ |
| | | type: 'map', |
| | | callback(row) { |
| | | fields.forEach(line => { |
| | | row[line.name] = row[line.field] |
| | | }) |
| | | return row |
| | | } |
| | | }) |
| | | |
| | | const chart = new Chart({ |
| | | container: plot.uuid, |
| | | autoFit: true, |
| | | height: plot.height || 400 |
| | | }) |
| | | |
| | | chart.data(dv.rows) |
| | | |
| | | if (plot.coordinate !== 'polar' && barfields.length === 0) { |
| | | chart.scale(plot.Xaxis, { |
| | | range: [0, 1] |
| | | }) |
| | | } |
| | | |
| | | if (!plot.legend || plot.legend === 'hidden') { |
| | | chart.legend(false) |
| | | } else { |
| | | chart.legend({ |
| | | custom: true, |
| | | position: plot.legend, |
| | | items: legends, |
| | | }) |
| | | } |
| | | |
| | | if (plot.tooltip !== 'true') { |
| | | chart.tooltip(false) |
| | | } else { |
| | | chart.tooltip({ |
| | | shared: true |
| | | }) |
| | | } |
| | | |
| | | if (plot.transpose === 'true') { |
| | | chart.coordinate().transpose() |
| | | } |
| | | |
| | | if (plot.coordinate === 'polar') { |
| | | chart.coordinate('polar', { |
| | | innerRadius: 0.1, |
| | | radius: 0.8 |
| | | }) |
| | | } |
| | | |
| | | chart.scale({ |
| | | nice: true |
| | | }) |
| | | |
| | | fields.forEach((item, i) => { |
| | | if (i === 0) { |
| | | chart.axis(item.name, { |
| | | grid: {}, |
| | | title: {}, |
| | | label: {} |
| | | }) |
| | | } else if (i === 1 && item.axis !== 'unset') { |
| | | chart.axis(item.name, { |
| | | grid: null, |
| | | title: {}, |
| | | label: {} |
| | | }) |
| | | } else { |
| | | chart.axis(item.name, { |
| | | grid: null, |
| | | title: null, |
| | | label: null |
| | | }) |
| | | } |
| | | |
| | | if (item.chartType === 'bar') { |
| | | let _chart = chart |
| | | .interval() |
| | | .position(`${plot.Xaxis}*${item.name}`) |
| | | .color(item.color) |
| | | .shape(item.shape) |
| | | |
| | | if (item.label === 'true') { |
| | | _chart.label(item.name) |
| | | } |
| | | } else if (item.chartType === 'line') { |
| | | let _chart = chart |
| | | .line() |
| | | .position(`${plot.Xaxis}*${item.name}`) |
| | | .color(item.color) |
| | | .shape(item.shape) |
| | | |
| | | if (item.label === 'true') { |
| | | _chart.label(item.name) |
| | | } |
| | | |
| | | if (plot.point === 'true') { |
| | | chart |
| | | .point() |
| | | .position(`${plot.Xaxis}*${item.name}`) |
| | | .color(item.color) |
| | | .size(3) |
| | | .shape('circle') |
| | | } |
| | | } |
| | | }) |
| | | |
| | | chart.render() |
| | | } |
| | | |
| | | barrender = () => { |
| | | const { card } = this.state |
| | | |
| | | let plot = {...card.plot, height: card.setting.height - 70} |
| | | |
| | | let transfield = {} |
| | | card.columns.forEach(col => { |
| | | if (col.field) { |
| | | transfield[col.field] = col.label |
| | | } |
| | | }) |
| | | let X_axis = plot.Xaxis || 'x' |
| | | let Y_axis = plot.Yaxis || ['y'] |
| | | |
| | | let data = this.getdata(X_axis, Y_axis) |
| | | |
| | | if (plot.enabled !== 'true') { |
| | | const ds = new DataSet() |
| | | const dv = ds.createView().source(data) |
| | | |
| | | dv.transform({ |
| | | type: 'fold', |
| | | fields: [...Y_axis], |
| | | key: 'key', |
| | | value: 'value' |
| | | }) |
| | | |
| | | if (plot.Xaxis) { |
| | | dv.transform({ |
| | | type: 'map', |
| | | callback(row) { |
| | | row.key = transfield[row.key] |
| | | return row |
| | | }, |
| | | }) |
| | | } |
| | | |
| | | const chart = new Chart({ |
| | | container: card.uuid, |
| | | autoFit: true, |
| | | height: plot.height || 400 |
| | | }) |
| | | |
| | | chart.data(dv.rows) |
| | | |
| | | chart.scale('value', { |
| | | nice: true |
| | | }) |
| | | |
| | | if (!plot.legend || plot.legend === 'hidden') { |
| | | chart.legend(false) |
| | | } else { |
| | | chart.legend({ |
| | | position: plot.legend |
| | | }) |
| | | } |
| | | |
| | | if (plot.tooltip !== 'true') { |
| | | chart.tooltip(false) |
| | | } else { |
| | | chart.tooltip({ |
| | | shared: true |
| | | }) |
| | | } |
| | | |
| | | if (plot.transpose === 'true') { |
| | | chart.coordinate().transpose() |
| | | } |
| | | |
| | | if (plot.coordinate === 'polar') { |
| | | chart.coordinate('polar', { |
| | | innerRadius: 0.1, |
| | | radius: 0.8 |
| | | }) |
| | | } |
| | | |
| | | if (plot.adjust !== 'stack') { |
| | | let _chart = chart |
| | | .interval() |
| | | .position(`${X_axis}*value`) |
| | | .color('key') |
| | | .adjust([ |
| | | { |
| | | type: 'dodge', |
| | | marginRatio: 0 |
| | | } |
| | | ]) |
| | | .shape(plot.shape || 'rect') |
| | | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | } else if (plot.adjust === 'stack') { |
| | | let _chart = chart |
| | | .interval() |
| | | .position(`${X_axis}*value`) |
| | | .color('key') |
| | | .adjust('stack') |
| | | .shape(plot.shape || 'rect') |
| | | |
| | | if (plot.label === 'true') { |
| | | _chart.label('value') |
| | | } |
| | | } |
| | | |
| | | chart.render() |
| | | } else { |
| | | this.customrender(data, transfield) |
| | | } |
| | | } |
| | | |
| | | plotChange = (_plot) => { |
| | | const { config } = this.props |
| | | |
| | | if (_plot.datatype === 'statistics') { |
| | | _plot.Yaxis = [_plot.InfoValue] |
| | | } |
| | | |
| | | let _charts = fromJS(config.charts).toJS() |
| | | |
| | | _charts = _charts.map(item => { |
| | | if (item.uuid === _plot.uuid) { |
| | | if (!is(fromJS(item), fromJS(_plot))) { |
| | | let _element = document.getElementById(_plot.uuid) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | } |
| | | return _plot |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.props.plotchange({...config, charts: _charts}) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | updateComponent = (component) => { |
| | | const card = fromJS(this.state.card).toJS() |
| | | let refresh = false |
| | | if (card.setting.span !== component.setting.span || card.setting.height !== component.setting.height || !is(fromJS(component.plot), fromJS(card.plot))) { |
| | | let _element = document.getElementById(card.uuid) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | refresh = true |
| | | } |
| | | |
| | | this.setState({ |
| | | card: component |
| | | }, () => { |
| | | if (refresh) { |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | }) |
| | | this.props.updateConfig(component) |
| | | } |
| | | |
| | | render() { |
| | | const { card } = this.state |
| | | const { config } = this.props |
| | | |
| | | return ( |
| | | <div className="menu-line-chart-edit-box" style={{height: card.setting.height || 400}}> |
| | | <div className="chart-header"> |
| | | <span className="chart-title">{card.setting.title || ''}</span> |
| | | <SearchComponent |
| | | menu={config} |
| | | config={card} |
| | | sysRoles={config.sysRoles} |
| | | optionLibs={null} |
| | | updatesearch={this.updateComponent} |
| | | /> |
| | | </div> |
| | | <ActionComponent |
| | | type="chart" |
| | | menu={config} |
| | | config={card} |
| | | tabs={[]} |
| | | usefulFields={config.permFuncField || []} |
| | | // setSubConfig={(_btn) => this.setSubConfig(_btn, 'button')} |
| | | updateaction={this.updateComponent} |
| | | /> |
| | | <div className="canvas" id={card.uuid}></div> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default antvBarLineChart |
New file |
| | |
| | | .menu-line-chart-edit-box { |
| | | position: relative; |
| | | // margin-bottom: 0px; |
| | | border: 1px solid #e8e8e8; |
| | | |
| | | .canvas { |
| | | margin: 0px; |
| | | padding: 10px 15px; |
| | | } |
| | | |
| | | .chart-header { |
| | | height: 50px; |
| | | border-bottom: 1px solid #e8e8e8; |
| | | overflow: hidden; |
| | | |
| | | .chart-title { |
| | | font-size: 16px; |
| | | float: left; |
| | | line-height: 50px; |
| | | margin-left: 10px; |
| | | } |
| | | } |
| | | |
| | | .model-custom-chart-action-list { |
| | | position: absolute; |
| | | right: 0px; |
| | | z-index: 4; |
| | | padding-top: 10px; |
| | | |
| | | .ant-row .anticon-plus { |
| | | float: right; |
| | | } |
| | | |
| | | .page-card { |
| | | float: right; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Button, Select, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | | import options from '@/store/options.js' |
| | | import DateGroup from '@/tabviews/zshare/dategroup' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | const {MonthPicker, WeekPicker, RangePicker} = DatePicker |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | BID: PropTypes.any, // 父级Id,用于查询下拉选择项 |
| | | dataManager: PropTypes.any, // 数据权限 |
| | | menuType: PropTypes.any, // 菜单权限,是否为HS |
| | | searchlist: PropTypes.array, // 搜索条件列表 |
| | | dict: PropTypes.object // 字典项 |
| | | } |
| | | |
| | | state = { |
| | | match: null, // 搜索条件匹配规则 |
| | | style: null, // 搜索条件类型 |
| | | label: null, // 提示文字 |
| | | required: null, // 是否必填 |
| | | searchlist: null, // 搜索项 |
| | | groups: null, // 组合搜索项 |
| | | formId: Utils.getuuid() // 搜索表单Id |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let searchlist = fromJS(this.props.searchlist).toJS() |
| | | let match = {} |
| | | let label = {} |
| | | let style = {} |
| | | let required = {} |
| | | let _list = [] |
| | | let fieldMap = new Map() |
| | | let mainItems = [] // 云端或单点数据 |
| | | let localItems = [] // 本地数据 |
| | | let deForms = [] // 测试系统,单个请求 |
| | | |
| | | searchlist.forEach(item => { |
| | | if (fieldMap.has(item.field)) { |
| | | item.field = item.field + '@tail@' |
| | | } |
| | | fieldMap.set(item.field, true) |
| | | |
| | | match[item.field] = item.match |
| | | label[item.field] = item.label |
| | | style[item.field] = item.type |
| | | required[item.field] = item.required === 'true' |
| | | |
| | | if (['select', 'link', 'multiselect'].includes(item.type)) { |
| | | if (item.setAll === 'true' && item.type !== 'multiselect') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | | Value: '', |
| | | Text: this.props.dict['main.all'] |
| | | }) |
| | | } |
| | | |
| | | // 数据源查询语句 |
| | | if (item.resourceType === '1' && item.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(item) |
| | | |
| | | if (this.props.dataManager) { // 数据权限 |
| | | _option.sql = _option.sql.replace(/\$@/ig, '/*') |
| | | _option.sql = _option.sql.replace(/@\$/ig, '*/') |
| | | } else { |
| | | _option.sql = _option.sql.replace(/@\$|\$@/ig, '') |
| | | } |
| | | |
| | | // 测试系统单个请求 |
| | | if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { |
| | | deForms.push({ |
| | | ...item, |
| | | arr_field: _option.field, |
| | | data_sql: Utils.formatOptions(_option.sql) |
| | | }) |
| | | } else { // 合并请求,区分本地及系统 |
| | | if (item.database === 'sso') { |
| | | mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) |
| | | } else { |
| | | localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`) |
| | | } |
| | | } |
| | | } |
| | | item.oriOptions = fromJS(item.options).toJS() |
| | | } |
| | | |
| | | _list.push(item) |
| | | }) |
| | | |
| | | let _groups = [] |
| | | _list = _list.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = _list.filter(form => form.field === item.linkField)[0] |
| | | |
| | | if (!supItem) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未查询到搜索条件《' + item.label + '》关联字段!', |
| | | duration: 5 |
| | | }) |
| | | item.supInitVal = '' |
| | | } else { |
| | | item.supInitVal = supItem.initval |
| | | item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) |
| | | } |
| | | } else if (item.type === 'group' && item.Hide !== 'true') { |
| | | _groups.push(fromJS(item).toJS()) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | match: match, |
| | | label: label, |
| | | style: style, |
| | | required: required, |
| | | searchlist: _list, |
| | | groups: _groups |
| | | }, () => { |
| | | if (this.props.menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { |
| | | this.improveSimpleSearch(deForms) |
| | | } else { |
| | | this.improveSearch(mainItems, localItems) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 查询下拉菜单 |
| | | improveSearch = (mainItems, localItems) => { |
| | | const { menuType, BID } = this.props |
| | | let deffers = [] |
| | | |
| | | if (menuType !== 'HS' && window.GLOB.systemType !== 'production') { |
| | | localItems = [...localItems, ...mainItems] |
| | | mainItems = [] |
| | | } |
| | | |
| | | // 本地请求 |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: localItems.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | if (BID) { |
| | | param.BID = BID |
| | | } |
| | | |
| | | if (param.LText) { |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | if (menuType === 'HS') { // 云端数据验证 |
| | | param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) |
| | | } |
| | | |
| | | deffers.push( |
| | | new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | ) |
| | | } |
| | | |
| | | // 系统请求 |
| | | let mainparam = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: mainItems.join(' union all '), |
| | | obj_name: '', |
| | | arr_field: '', |
| | | table_type: 'Y' |
| | | } |
| | | |
| | | if (BID) { |
| | | mainparam.BID = BID |
| | | } |
| | | |
| | | if (mainparam.LText) { |
| | | mainparam.LText = Utils.formatOptions(mainparam.LText) |
| | | mainparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) |
| | | |
| | | if (menuType === 'HS') { // 云端数据验证 |
| | | mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) |
| | | if (options.cloudServiceApi) { |
| | | mainparam.rduri = options.cloudServiceApi |
| | | mainparam.userid = sessionStorage.getItem('CloudUserID') || '' |
| | | mainparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' |
| | | } |
| | | } else if (window.GLOB.mainSystemApi) { |
| | | mainparam.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | |
| | | deffers.push( |
| | | new Promise(resolve => { |
| | | Api.getSystemCacheConfig(mainparam).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | ) |
| | | } |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {...response[0], ...(response[1] || {})} |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | let _searchlist = this.state.searchlist.map(item => { |
| | | if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[item.valueField], |
| | | Text: cell[item.valueText] |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _item.ParentID = cell[item.linkField] |
| | | } |
| | | |
| | | return _item |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | searchlist: _searchlist.map(item => { |
| | | if (item.type === 'link') { |
| | | if (item.supInitVal) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | item.options = item.oriOptions |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | // 测试系统单个请求下拉选项 |
| | | improveSimpleSearch = (deForms) => { |
| | | if (deForms.length === 0) return |
| | | |
| | | let deffers = deForms.map(item => { |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.data_sql, |
| | | obj_name: item.field, |
| | | arr_field: item.arr_field |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | | param.BID = this.props.BID |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | return ( |
| | | new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | } |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | ) |
| | | }) |
| | | |
| | | Promise.all(deffers).then(response => { |
| | | let result = {} |
| | | |
| | | response.forEach(res => { |
| | | result = {...result, ...res} |
| | | }) |
| | | |
| | | delete result.ErrCode |
| | | delete result.ErrMesg |
| | | delete result.message |
| | | delete result.status |
| | | |
| | | let _searchlist = this.state.searchlist.map(item => { |
| | | if (['select', 'link', 'multiselect'].includes(item.type) && result[item.field] && result[item.field].length > 0) { |
| | | let options = result[item.field].map(cell => { |
| | | let _item = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[item.valueField], |
| | | Text: cell[item.valueText] |
| | | } |
| | | |
| | | if (item.type === 'link') { |
| | | _item.ParentID = cell[item.linkField] |
| | | } |
| | | |
| | | return _item |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | searchlist: _searchlist.map(item => { |
| | | if (item.type === 'link') { |
| | | if (item.supInitVal) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal) |
| | | } else { |
| | | item.options = item.oriOptions |
| | | } |
| | | } else if (item.type === 'select' || item.type === 'multiselect') { |
| | | item.options = item.oriOptions |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | resetform = (formlist, supfields, index, fieldsvalue) => { |
| | | index++ |
| | | let subfields = [] |
| | | |
| | | supfields.forEach(supfield => { |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === supfield.field) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === supfield.initval) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | if (this.props.form.getFieldValue(item.field) !== undefined) { |
| | | fieldsvalue[item.field] = item.initval |
| | | } |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | return formlist |
| | | } else { |
| | | return this.resetform(formlist, subfields, index, fieldsvalue) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value) => { |
| | | let formlist = fromJS(this.state.searchlist).toJS() |
| | | |
| | | let subfields = [] |
| | | let fieldsvalue = {} |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link' && item.linkField === _field.field) { |
| | | item.options = item.oriOptions.filter(option => option.ParentID === value) |
| | | item.initval = item.options[0] ? item.options[0].Value : '' |
| | | |
| | | if (this.props.form.getFieldValue(item.field) !== undefined) { |
| | | fieldsvalue[item.field] = item.initval |
| | | } |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (subfields.length === 0) { |
| | | this.searchChange() |
| | | return |
| | | } |
| | | |
| | | formlist = this.resetform(formlist, subfields, 0, fieldsvalue) |
| | | |
| | | if (Object.keys(fieldsvalue).length > 0) { |
| | | this.props.form.setFieldsValue(fieldsvalue) |
| | | } |
| | | |
| | | this.setState({ |
| | | searchlist: formlist |
| | | }, () => { |
| | | this.searchChange() |
| | | }) |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | |
| | | this.state.searchlist.forEach((item, index) => { |
| | | if (item.Hide === 'true') return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | onChange={(value) => {this.selectChange(item, value)}} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById(this.state.formId)} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'multiselect') { // 下拉多选 |
| | | let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: _initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | mode="multiple" |
| | | onChange={this.searchChange} |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | getPopupContainer={() => document.getElementById(this.state.formId)} |
| | | > |
| | | {item.options.map((option, i) => |
| | | <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval ? moment().subtract(item.initval, 'days') : null, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'datemonth') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval ? moment().subtract(item.initval, 'month') : null, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'dateweek') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'daterange') { |
| | | let _defaultValue = [null, null] |
| | | |
| | | if (item.initval) { |
| | | try { |
| | | let _initval = JSON.parse(item.initval) |
| | | _defaultValue = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] |
| | | } catch { |
| | | _defaultValue = [null, null] |
| | | } |
| | | } |
| | | |
| | | fields.push( |
| | | <Col className="daterange" span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, |
| | | { |
| | | initialValue: _defaultValue, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <RangePicker |
| | | placeholder={['开始日期', '结束日期']} |
| | | renderExtraFooter={() => 'extra footer'} |
| | | onChange={this.searchChange} |
| | | getCalendarContainer={() => document.getElementById(this.state.formId)} |
| | | /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'group') { |
| | | fields.push( |
| | | <Col span={item.ratio || 6} key={index}> |
| | | <Form.Item label={item.label} className={item.required === 'true' ? 'group-required' : ''}> |
| | | <DateGroup ref={item.uuid} position={index} card={item} onGroupChange={this.searchChange} /> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | |
| | | fields.push( |
| | | <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions"> |
| | | <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}> |
| | | <Button type="primary" htmlType="submit"> |
| | | {this.props.dict['main.search']} |
| | | </Button> |
| | | <Button style={{ marginLeft: 8 }} onClick={this.handleReset}> |
| | | {this.props.dict['main.reset']} |
| | | </Button> |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | |
| | | return fields |
| | | } |
| | | |
| | | addHideFieldValue = (values) => { |
| | | const { searchlist } = this.state |
| | | let hideValue = {} |
| | | searchlist.forEach(item => { |
| | | if (item.Hide === 'true') { |
| | | let value = '' |
| | | |
| | | if (item.type === 'multiselect') { // 下拉多选 |
| | | value = item.initval ? item.initval.split(',').filter(Boolean) : [] |
| | | } else if (item.type === 'date') { // 时间搜索 |
| | | value = item.initval ? moment().subtract(item.initval, 'days') : '' |
| | | } else if (item.type === 'datemonth') { |
| | | value = item.initval ? moment().subtract(item.initval, 'month') : '' |
| | | } else if (item.type === 'dateweek') { |
| | | value = item.initval ? moment().subtract(item.initval * 7, 'days') : '' |
| | | } else if (item.type === 'daterange') { |
| | | if (item.initval) { |
| | | try { |
| | | let _initval = JSON.parse(item.initval) |
| | | value = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] |
| | | } catch { |
| | | value = '' |
| | | } |
| | | } |
| | | } else if (item.type !== 'group') { |
| | | value = item.initval |
| | | } |
| | | |
| | | hideValue[item.field] = value |
| | | } |
| | | }) |
| | | |
| | | return {...hideValue, ...values} |
| | | } |
| | | |
| | | handleSearch = (e) => { |
| | | // 回车或点击搜索 |
| | | e.preventDefault() |
| | | this.props.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | values = this.addHideFieldValue(values) |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | searchChange = () => { |
| | | this.setState({}, () => { |
| | | this.props.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | values = this.addHideFieldValue(values) |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件重置 |
| | | */ |
| | | handleReset = () => { |
| | | const { groups } = this.state |
| | | |
| | | if (groups.length > 0) { |
| | | groups.forEach(item => { |
| | | this.refs[item.uuid].reset() |
| | | }) |
| | | } |
| | | |
| | | let searchlist = this.state.searchlist.map(item => { |
| | | item.initval = item.oriInitval |
| | | return item |
| | | }) |
| | | |
| | | this.setState({searchlist}, () => { |
| | | this.props.form.resetFields() |
| | | this.props.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | // 异步获取更新后的时间组 |
| | | this.setState({}, () => { |
| | | values = this.addHideFieldValue(values) |
| | | let searches = this.getFieldsValues(values) |
| | | this.props.refreshdata(searches) |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getFieldsValues = (values) => { |
| | | const { groups } = this.state |
| | | // 获取搜索条件值 |
| | | let search = [] |
| | | Object.keys(values).forEach(key => { |
| | | let _value = '' |
| | | if (this.state.style[key] === 'daterange') { |
| | | if (values[key].length > 0 && values[key][0] && values[key][1]) { |
| | | _value = [moment(values[key][0]).format('YYYY-MM-DD'), moment(values[key][1]).format('YYYY-MM-DD')] |
| | | } |
| | | } else if (this.state.style[key] === 'dateweek') { |
| | | if (values[key]) { |
| | | _value = [moment(values[key]).startOf('week').format('YYYY-MM-DD'), moment(values[key]).endOf('week').format('YYYY-MM-DD')] |
| | | } |
| | | } else if (this.state.style[key] === 'date') { |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM-DD') |
| | | } |
| | | } else if (this.state.style[key] === 'datemonth') { |
| | | if (values[key]) { |
| | | _value = moment(values[key]).format('YYYY-MM') |
| | | } |
| | | } else if (this.state.style[key] === 'multiselect') { |
| | | _value = values[key] || [] |
| | | |
| | | } else { |
| | | _value = (values[key] || values[key] === 0) ? values[key] : '' |
| | | |
| | | _value = _value.replace(/(^\s*|\s*$)/ig, '') |
| | | } |
| | | |
| | | search.push({ |
| | | type: this.state.style[key], |
| | | key: key.replace(/@tail@$/, ''), |
| | | value: _value, |
| | | label: this.state.label[key], |
| | | match: this.state.match[key], |
| | | required: this.state.required[key] |
| | | }) |
| | | }) |
| | | |
| | | if (groups.length > 0) { |
| | | groups.forEach(item => { |
| | | let items = this.refs[item.uuid].getSearchItems() |
| | | search.push(...items) |
| | | }) |
| | | } |
| | | |
| | | return search |
| | | } |
| | | |
| | | render() { |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 8 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(MainSearch) |
New file |
| | |
| | | .ant-advanced-search-form.top-search { |
| | | padding: 0px 24px 10px; |
| | | border-bottom: 1px solid #efefef; |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 0px; |
| | | min-height: 60px; |
| | | .ant-form-explain { |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | | width: calc(100% - 100px); |
| | | } |
| | | .ant-form-item-label { |
| | | // width: 100px; |
| | | text-overflow: ellipsis; |
| | | } |
| | | .daterange .ant-calendar-picker-input { |
| | | padding: 4px 20px 4px 5px; |
| | | font-size: 13px; |
| | | } |
| | | .ant-select-dropdown { |
| | | z-index: 10 !important; |
| | | } |
| | | .ant-calendar-picker-container { |
| | | z-index: 10 !important; |
| | | } |
| | | .group-required { |
| | | label::before { |
| | | display: inline-block; |
| | | margin-right: 4px; |
| | | color: #f5222d; |
| | | font-size: 14px; |
| | | font-family: SimSun, sans-serif; |
| | | line-height: 1; |
| | | content: '*'; |
| | | } |
| | | } |
| | | } |
| | |
| | | {/* 解冻标签模态框 */} |
| | | <Modal |
| | | title="标签解除冻结" |
| | | okText={this.state.dict['main.confirm']} |
| | | cancelText={this.state.dict['main.cancel']} |
| | | visible={this.state.thawVisible} |
| | | width={600} |
| | | onOk={this.thawMenuSubmit} |
| | | confirmLoading={this.state.submitloading} |
| | | onCancel={() => {this.setState({thawVisible: false, thawmenulist: null})}} |
| | | 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}/>} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} |
| | | </Modal> |
| | | </div> |
| | | ) |
| | |
| | | |
| | | class TransferForm extends Component { |
| | | static propTypes = { |
| | | menulist: PropTypes.array, |
| | | dict: PropTypes.object |
| | | menulist: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict } = this.props |
| | | const { targetKeys, selectedKeys } = this.state |
| | | |
| | | return ( |
| | | <div className="trawmenutransfer"> |
| | | <Transfer |
| | | dataSource={this.props.menulist} |
| | | titles={[dict['main.thawmenu.source'], dict['main.thawmenu.target']]} |
| | | targetKeys={targetKeys} |
| | | locale={{itemUnit: dict['main.thawmenu.itemUnit'], itemsUnit: dict['main.thawmenu.itemsUnit']}} |
| | | selectedKeys={selectedKeys} |
| | | onChange={this.handleChange} |
| | | onSelectChange={this.handleSelectChange} |
| | |
| | | .trawmenutransfer { |
| | | .ant-transfer-list { |
| | | width: 210px; |
| | | width: calc(50% - 20px); |
| | | height: 250px; |
| | | } |
| | | } |
| | |
| | | datatype: null, // 数据类型 |
| | | readtype: null, // 是否只读 |
| | | readin: null, // 行数据是否写入 |
| | | writein: null, // 执行时是否填入默认sql |
| | | fieldlen: null, // 字段长度 |
| | | formlist: [], // 表单项 |
| | | encrypts: [], // 加密字段 |
| | |
| | | let datatype = {} |
| | | let readtype = {} |
| | | let readin = {} |
| | | let writein = {} |
| | | let fieldlen = {} |
| | | let formlist = [] |
| | | let encrypts = [] |
| | |
| | | intercepts.push(item.field) |
| | | } |
| | | |
| | | // 数据写入 |
| | | // 数据自动填充 |
| | | let _readin = item.readin !== 'false' |
| | | if (item.type === 'linkMain' || item.type === 'funcvar') { |
| | | _readin = false |
| | |
| | | datatype[item.field] = item.type |
| | | readtype[item.field] = item.readonly === 'true' |
| | | readin[item.field] = _readin |
| | | writein[item.field] = item.writein !== 'false' |
| | | fieldlen[item.field] = _fieldlen |
| | | |
| | | if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { |
| | |
| | | readtype: readtype, |
| | | datatype: datatype, |
| | | readin: readin, |
| | | writein: writein, |
| | | fieldlen: fieldlen, |
| | | encrypts: encrypts, |
| | | intercepts: intercepts, |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { record, intercepts } = this.state |
| | | const { record, intercepts, writein } = this.state |
| | | let _encrypts = fromJS(this.state.encrypts).toJS() |
| | | let _format = { |
| | | date: 'YYYY-MM-DD', |
| | |
| | | type: 'funcvar', |
| | | readonly: 'true', |
| | | readin: false, |
| | | writein: writein[item.field], |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: '' |
| | |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | readin: this.state.readin[item.field], |
| | | writein: writein[item.field], |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: _val |
| | |
| | | type: this.state.datatype[item.field], |
| | | readonly: this.state.readtype[item.field], |
| | | readin: this.state.readin[item.field], |
| | | writein: writein[item.field], |
| | | fieldlen: this.state.fieldlen[item.field], |
| | | key: item.field, |
| | | value: item.initval |
| | |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | writein: writein[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: '' |
| | |
| | | type: this.state.datatype[key], |
| | | readonly: this.state.readtype[key], |
| | | readin: this.state.readin[key], |
| | | writein: writein[key], |
| | | fieldlen: this.state.fieldlen[key], |
| | | key: key, |
| | | value: _value |
| | |
| | | let contents = [] |
| | | let images = [] |
| | | |
| | | item.subColumn.forEach((col, index) => { |
| | | item.subColumn.forEach(col => { |
| | | if (!col.field || !record.hasOwnProperty(col.field)) return |
| | | if (index) { |
| | | col.Align = 'right' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | | let content = '' |
| | |
| | | width={700} |
| | | maskClosable={false} |
| | | onCancel={() => { this.setState({ visible: false })}} |
| | | cancelText={this.state.dict['model.cancel']} |
| | | okText={this.state.dict['model.confirm']} |
| | | onOk={this.calendarSave} |
| | | destroyOnClose |
| | | > |
| | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.props.handleView() |
| | | }, |
| | |
| | | |
| | | confirm({ |
| | | content: '确定删除标签吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.props.updateConfig({...config, tab: ''}) |
| | | }, |
| | |
| | | width={900} |
| | | maskClosable={false} |
| | | onCancel={() => { this.setState({ visible: false })}} |
| | | cancelText={this.state.dict['model.cancel']} |
| | | okText={this.state.dict['model.confirm']} |
| | | onOk={this.tabSave} |
| | | destroyOnClose |
| | | > |
| | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.props.handleView() |
| | | }, |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | {!group.isDefault ? <Col span={24}> |
| | | <TransferForm dict={this.props.dict} fields={this.state.source} ref="fields-transfer" selected={this.state.selectds}/> |
| | | <TransferForm fields={this.state.source} ref="fields-transfer" selected={this.state.selectds}/> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | |
| | | let _this = this |
| | | confirm({ |
| | | content: `确定删除<<${element.card.label}>>吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | let _delActions = _this.state.delActions |
| | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '按钮配置尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.handleViewBack() |
| | | }, |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除分组<<${group.label}>>吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let groups = config.groups.filter(item => !(item.uuid === group.uuid)) |
| | | groups = groups.map(item => { |
| | |
| | | class TransferForm extends Component { |
| | | static propTypes = { |
| | | fields: PropTypes.array, |
| | | selected: PropTypes.array, |
| | | dict: PropTypes.object, // 字典项 |
| | | selected: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | <div className="modal-fields-transfer"> |
| | | <Transfer |
| | | dataSource={data} |
| | | titles={[this.props.dict['header.form.column.source'], this.props.dict['header.form.column.target']]} |
| | | targetKeys={targetKeys} |
| | | locale={{itemUnit: this.props.dict['header.form.column.itemUnit'], itemsUnit: this.props.dict['header.form.column.itemsUnit']}} |
| | | selectedKeys={selectedKeys} |
| | | onChange={this.handleChange} |
| | | onSelectChange={this.handleSelectChange} |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon } from 'antd' |
| | | import { Icon, Popover } from 'antd' |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, text, moveCard, findCard, editCard }) => { |
| | | const Card = ({ id, text, moveCard, findCard, editCard, delCard }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes.CARD, id, originalIndex }, |
| | |
| | | const edit = () => { |
| | | editCard(id) |
| | | } |
| | | |
| | | const del = () => { |
| | | delCard(id) |
| | | } |
| | | |
| | | return ( |
| | | <div className="card" style={{ opacity }}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {text} |
| | | <Popover overlayClassName="mk-popover-control-wrap header-menu" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" type="edit" onClick={edit} /> |
| | | <Icon className="close" type="close" onClick={del} /> |
| | | </div> |
| | | <Icon className="edit" type="edit" onClick={edit} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="card" style={{ opacity }}> |
| | | <div ref={node => drag(drop(node))}> |
| | | {text} |
| | | </div> |
| | | </div> |
| | | </Popover> |
| | | ) |
| | | } |
| | | export default Card |
| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Container = ({dict, list, handlePreviewList, handleMenu, handleButton }) => { |
| | | const Container = ({dict, list, handlePreviewList, handleMenu, deleteMemu, handleButton }) => { |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | index, |
| | | type: 'edit' |
| | | }) |
| | | } |
| | | |
| | | const delCard = id => { |
| | | const { card } = findCard(id) |
| | | deleteMemu(card) |
| | | } |
| | | |
| | | const add = () => { |
| | |
| | | text={card.text} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | | /> |
| | | ))} |
| | |
| | | .btn-group { |
| | | display: inline-block; |
| | | } |
| | | } |
| | | .card { |
| | | position: relative; |
| | | border: 1px dashed gray; |
| | | margin-top: 7px; |
| | | margin-right: 10px; |
| | | float: left; |
| | | div { |
| | | padding: 5px 20px 5px 5px; |
| | | cursor: move; |
| | | min-width: 43px; |
| | | max-width: 85px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | .close { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | cursor: pointer; |
| | | :hover { |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | .edit { |
| | | display: none; |
| | | position: absolute; |
| | | right: 0; |
| | | bottom: 0; |
| | | cursor: pointer; |
| | | :hover { |
| | | color: #ffffff; |
| | | .card { |
| | | position: relative; |
| | | border: 1px dashed gray; |
| | | margin-top: 8px; |
| | | margin-right: 5px; |
| | | float: left; |
| | | div { |
| | | padding: 3px 6px; |
| | | font-size: 16px; |
| | | cursor: move; |
| | | min-width: 43px; |
| | | max-width: 85px; |
| | | overflow: hidden; |
| | | text-overflow: ellipsis; |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | | } |
| | | .card:hover { |
| | | .edit { |
| | | display: inline-block; |
| | | |
| | | .mk-popover-control-wrap.header-menu { |
| | | .ant-popover-content { |
| | | position: relative; |
| | | top: -8px; |
| | | .ant-popover-arrow { |
| | | top: -3.8px!important; |
| | | } |
| | | } |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { notification, Modal, Button, Spin } from 'antd' |
| | | import { notification, Modal, Spin } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import TransferForm from '@/templates/zshare/basetransferform' |
| | |
| | | }) |
| | | } |
| | | |
| | | deleteMemu = () => { |
| | | deleteMemu = (item) => { |
| | | let _this = this |
| | | confirm({ |
| | | title: this.state.dict['model.menu.close'].replace('@M', this.state.editMenu.MenuName), |
| | | title: this.state.dict['model.menu.close'].replace('@M', item.MenuName), |
| | | content: '', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let param = { |
| | | func: 'sPC_MainMenu_Del', |
| | | MenuID: _this.state.editMenu.MenuID |
| | | MenuID: item.MenuID |
| | | } |
| | | return Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | | _this.setState({ |
| | | editMvisible: false, |
| | | editMenu: null, |
| | | }) |
| | | _this.props.reload() |
| | | } else { |
| | | notification.warning({ |
| | |
| | | confirm({ |
| | | title: this.state.dict['model.menu.resetorder'], |
| | | content: '', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | return Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | |
| | | list={this.props.menulist} |
| | | handlePreviewList={this.handlePreviewList} |
| | | handleMenu={this.editMenuModal} |
| | | deleteMemu={this.deleteMemu} |
| | | handleButton={this.handleButton} |
| | | /> |
| | | </DndProvider>} |
| | | {/* 新建菜单模态框 */} |
| | | <Modal |
| | | title={dict['model.add'] + dict['model.menu']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.addMvisible} |
| | | onOk={this.addMemuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | |
| | | {/* 解除冻结菜单模态框 */} |
| | | <Modal |
| | | title={dict['model.thaw'] + dict['model.menu']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.thawMvisible} |
| | | width={600} |
| | | 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={dict} menulist={this.state.thawmenulist}/>} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} |
| | | </Modal> |
| | | {/* 编辑菜单模态框 */} |
| | | <Modal |
| | | title={dict['model.edit'] + dict['model.menu']} |
| | | visible={this.state.editMvisible} |
| | | footer={[ |
| | | <Button key="cancel" onClick={this.editMemuCancel}>{dict['model.cancel']}</Button>, |
| | | <Button key="confirm" type="primary" onClick={this.editMemuSubmit} loading={this.state.confirmLoading}>{dict['model.confirm']}</Button>, |
| | | <Button key="delete" type="danger" onClick={this.deleteMemu}>{dict['model.delete']}</Button> |
| | | ]} |
| | | onOk={this.editMemuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.editMemuCancel} |
| | | destroyOnClose |
| | | > |
| | |
| | | confirm({ |
| | | title: dict['model.menu.close'].replace('@M', menu.card.text), |
| | | content: '', |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | onOk() { |
| | | let param = { |
| | | func: 'sPC_MainMenu_Del', |
| | |
| | | confirm({ |
| | | title: this.state.dict['model.menu.resetorder'], |
| | | content: '', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | return Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | |
| | | </div> |
| | | <Modal |
| | | title={this.state.title} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.visible} |
| | | onOk={this.memuHandleSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | |
| | | </Modal> |
| | | <Modal |
| | | title={dict['model.thaw'] + dict['model.menu']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | width={600} |
| | | visible={this.state.thawMvisible} |
| | | onOk={this.thawMemuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | | onCancel={this.thawMemuCancel} |
| | | > |
| | | {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={dict} menulist={this.state.thawmenulist}/>} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} |
| | | </Modal> |
| | | </div> |
| | | ) |
| | |
| | | confirm({ |
| | | title: this.state.dict['model.menu.close'].replace('@M', menu.card.text), |
| | | content: '', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let param = { |
| | | func: 'sPC_MainMenu_Del', |
| | |
| | | confirm({ |
| | | title: this.state.dict['model.menu.resetorder'], |
| | | content: '', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | return Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | |
| | | {/* 解冻菜单模态框 */} |
| | | <Modal |
| | | title={dict['model.thaw'] + dict['model.menu']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | width={600} |
| | | visible={this.state.thawMvisible} |
| | | onOk={this.thawMemuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | |
| | | destroyOnClose |
| | | > |
| | | {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={dict} menulist={this.state.thawmenulist}/>} |
| | | {this.state.thawmenulist && <TransferForm ref="trawmenu" menulist={this.state.thawmenulist}/>} |
| | | </Modal> |
| | | {/* 添加系统菜单 */} |
| | | <Modal |
| | | title={this.state.sysMenu && this.state.sysMenu.isSystem ? dict['model.add'] + dict['model.menu'] : dict['model.update'] + dict['model.menu']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.handleMVisible} |
| | | onOk={this.memuSubmit} |
| | | confirmLoading={this.state.confirmLoading} |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <TransferForm dict={this.props.dict} fields={this.state.source} ref="fields-transfer" selected={this.state.selectds}/> |
| | | <TransferForm fields={this.state.source} ref="fields-transfer" selected={this.state.selectds}/> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除<<${card.label}>>吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | |
| | |
| | | if (isOrigin) { |
| | | confirm({ |
| | | content: '尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.handleViewBack() |
| | | }, |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除分组<<${group.label}>>吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _config = JSON.parse(JSON.stringify(_this.state.config)) |
| | | _config.groups = _config.groups.filter(item => !(item.uuid === group.uuid)) |
| | |
| | | class TransferForm extends Component { |
| | | static propTypes = { |
| | | fields: PropTypes.array, |
| | | selected: PropTypes.array, |
| | | dict: PropTypes.object, // 字典项 |
| | | selected: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | <div className="modal-fields-transfer"> |
| | | <Transfer |
| | | dataSource={data} |
| | | titles={[this.props.dict['header.form.column.source'], this.props.dict['header.form.column.target']]} |
| | | targetKeys={targetKeys} |
| | | locale={{itemUnit: this.props.dict['header.form.column.itemUnit'], itemsUnit: this.props.dict['header.form.column.itemsUnit']}} |
| | | selectedKeys={selectedKeys} |
| | | onChange={this.handleChange} |
| | | onSelectChange={this.handleSelectChange} |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _actionlist = fromJS(_this.state.actionlist).toJS() |
| | | |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | verify: { |
| | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | resolve(_verify) |
| | | }, |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'columns', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'columns', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'columns') |
| | | }> |
| | | <span style={{color: '#ff4d4f', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | |
| | | confirm({ |
| | | content: `确定清空Excel列吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | verify: { |
| | |
| | | <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={props.dict['header.form.query.delete']} |
| | | okText={props.dict['model.confirm']} |
| | | cancelText={props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon } from 'antd' |
| | | import { Icon, Popover } from 'antd' |
| | | import './index.scss' |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, editCard, delCard }) => { |
| | |
| | | }) |
| | | |
| | | return ( |
| | | <div ref={node => drag(drop(node))} className={'mk-card-meta-item ' + card.align} style={{opacity: opacity, width: card.width + '%'}}> |
| | | <div className={'content line' + card.height} style={{fontWeight: card.fontWeight, fontSize: card.fontSize + 'px', height: card.height * card.fontSize * 1.5}} title={card.content}>{card.content}</div> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => editCard(card)} /> |
| | | <Icon className="edit close" title="删除" type="close" onClick={() => delCard(card)} /> |
| | | </div> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => editCard(card)} /> |
| | | <Icon className="edit close" title="删除" type="close" onClick={() => delCard(card)} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div ref={node => drag(drop(node))} className={'mk-card-meta-item ' + card.align} style={{opacity: opacity, width: card.width + '%'}}> |
| | | <div className={'content line' + card.height} style={{fontWeight: card.fontWeight, fontSize: card.fontSize + 'px', height: card.height * card.fontSize * 1.5}} title={card.content}>{card.content}</div> |
| | | </div> |
| | | </Popover> |
| | | ) |
| | | } |
| | | export default Card |
| | |
| | | vertical-align: top; |
| | | font-size: 14px; |
| | | margin-bottom: 2px; |
| | | |
| | | transition: box-shadow 0.2s; |
| | | |
| | | .content.line1 { |
| | | overflow: hidden; |
| | |
| | | text-align: right; |
| | | } |
| | | |
| | | .edit { |
| | | position: absolute; |
| | | left: 0; |
| | | top: -10px; |
| | | font-size: 13px; |
| | | color: #1890ff; |
| | | cursor: pointer; |
| | | display: none; |
| | | padding: 0 5px; |
| | | } |
| | | .edit.close { |
| | | left: 20px; |
| | | color: #ff4d4f; |
| | | } |
| | | |
| | | .mk-card-meta-item:hover .edit { |
| | | display: inline-block; |
| | | .mk-card-meta-item:hover, .mk-card-meta-item.ant-popover-open { |
| | | box-shadow: 0px 0px 1px #1890ff; |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Modal } from 'antd' |
| | | import { Icon, Modal, Popover } from 'antd' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | |
| | | } |
| | | } |
| | | |
| | | let _columns = config.columns.filter(col => ['text', 'number', 'link'].includes(col.type)) |
| | | let _columns = config.columns.filter(col => ['text', 'number', 'link', 'textarea'].includes(col.type)) |
| | | _columns = _columns.map(col => { |
| | | return { |
| | | uuid: col.uuid, |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${cell.content} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | onOk() { |
| | | let _details = fromJS(card.details).toJS() |
| | | |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + '?', |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | onOk() { |
| | | let _subelement = fromJS(_this.props.card.subelement).toJS() |
| | | _subelement = _subelement.filter(_type => _type !== type) |
| | |
| | | style={card.widthType === 'absolute' ? { width: card.cardWidth } : null} |
| | | > |
| | | {card.subelement.includes('header') ? |
| | | <div className="ant-card-head"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editHeader} /> |
| | | <Icon className="edit close" title="close" type="close" onClick={() => this.deleteElem('header')} /> |
| | | <div className="ant-card-head-wrapper"> |
| | | <div className="ant-card-head-title">{card.header.content}</div> |
| | | {card.header.actions && card.header.actions.length > 0 ? |
| | | <div className="ant-card-extra"> |
| | | <span> |
| | | {['icon', 'all'].includes(card.header.show) ? <Icon type={card.header.actions[0].icon || 'dash'}/> : null} |
| | | {['text', 'all'].includes(card.header.show) ? card.header.actions[0].text : null} |
| | | </span> |
| | | </div> : null |
| | | } |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editHeader} /> |
| | | <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('header')} /> |
| | | </div> |
| | | </div> : null |
| | | } trigger="hover"> |
| | | <div className="ant-card-head"> |
| | | <div className="ant-card-head-wrapper"> |
| | | <div className="ant-card-head-title">{card.header.content}</div> |
| | | {card.header.actions && card.header.actions.length > 0 ? |
| | | <div className="ant-card-extra"> |
| | | <span> |
| | | {['icon', 'all'].includes(card.header.show) ? <Icon type={card.header.actions[0].icon || 'dash'}/> : null} |
| | | {['text', 'all'].includes(card.header.show) ? card.header.actions[0].text : null} |
| | | </span> |
| | | </div> : null |
| | | } |
| | | </div> |
| | | </div> |
| | | </Popover> : null |
| | | } |
| | | <div className="ant-card-body"> |
| | | <div className="ant-card-meta" style={metastyle}> |
| | | <Icon type="plus" onClick={() => this.editdetail()} /> |
| | | {card.subelement.includes('avatar') ? |
| | | <div className="ant-card-meta-avatar" style={{width: card.avatar.avatarWidth || 32, paddingTop: card.avatar.avatarWidth || 32}}> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editAvatar} /> |
| | | <Icon className="edit close" title="close" type="close" onClick={() => this.deleteElem('avatar')} /> |
| | | <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{borderRadius: card.avatar.radius === 'true' ? '50%' : 0}}> |
| | | {card.avatar.type === 'picture' ? <img src={avatar} alt=""/> : null} |
| | | {card.avatar.type === 'icon' ? <Icon className={'font ' + card.avatar.color} style={{fontSize: card.avatar.size + 'px'}} type={card.avatar.icon} /> : null} |
| | | </span> |
| | | </div> : null |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editAvatar} /> |
| | | <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('avatar')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <div className="ant-card-meta-avatar" style={{width: card.avatar.avatarWidth || 32, paddingTop: card.avatar.avatarWidth || 32}}> |
| | | <span className="ant-avatar ant-avatar-circle ant-avatar-image" style={{borderRadius: card.avatar.radius === 'true' ? '50%' : 0}}> |
| | | {card.avatar.type === 'picture' ? <img src={avatar} alt=""/> : null} |
| | | {card.avatar.type === 'icon' ? <Icon className={'font ' + card.avatar.color} style={{fontSize: card.avatar.size + 'px'}} type={card.avatar.icon} /> : null} |
| | | </span> |
| | | </div> |
| | | </Popover> : null |
| | | } |
| | | <div className="ant-card-meta-detail" style={metastyle.display ? {flex: 1} : null}> |
| | | <DragDetail |
| | |
| | | </div> |
| | | </div> |
| | | {card.subelement.includes('bottom') ? |
| | | <ul className="ant-card-actions"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editBottom} /> |
| | | <Icon className="edit close" title="close" type="close" onClick={() => this.deleteElem('bottom')} /> |
| | | {card.bottom.actions.map((item, i) => (<li key={i} style={{width: _width}}> |
| | | <span> |
| | | {['icon', 'all'].includes(card.bottom.show) ? <Icon type={item.icon || 'dash'}/> : null} |
| | | {['text', 'all'].includes(card.bottom.show) ? item.text : null} |
| | | </span> |
| | | </li>))} |
| | | </ul> : null |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="Edit" type="edit" onClick={this.editBottom} /> |
| | | <Icon className="close" title="close" type="close" onClick={() => this.deleteElem('bottom')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <ul className="ant-card-actions"> |
| | | {card.bottom.actions.map((item, i) => (<li key={i} style={{width: _width}}> |
| | | <span> |
| | | {['icon', 'all'].includes(card.bottom.show) ? <Icon type={item.icon || 'dash'}/> : null} |
| | | {['text', 'all'].includes(card.bottom.show) ? item.text : null} |
| | | </span> |
| | | </li>))} |
| | | </ul> |
| | | </Popover> : null |
| | | } |
| | | </div> |
| | | {card.extraAction ? |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` ${plot.title} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: dict['model.cancel'], |
| | | onOk() { |
| | | let _chartlist = fromJS(_this.state.chartlist).toJS() |
| | | let _chartview = _this.state.chartview |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <TransferForm dict={this.props.dict} columns={this.props.columns} ref="column-transfer" selected={this.props.card.sublist}/> |
| | | <TransferForm columns={this.props.columns} ref="column-transfer" selected={this.props.card.sublist}/> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _columnlist = fromJS(_this.state.columnlist).toJS() |
| | | |
| | |
| | | </Modal> |
| | | {/* 合并列编辑 */} |
| | | <Modal |
| | | title={dict['model.modal.colspan'] + '-' + dict['model.edit']} |
| | | title={dict['model.form.colspan'] + '-' + dict['model.edit']} |
| | | visible={modaltype === 'colspan'} |
| | | width={800} |
| | | maskClosable={false} |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | maskClosable={false} |
| | | style={{minWidth: '900px', maxWidth: '1200px'}} |
| | | okText={dict['model.submit']} |
| | | cancelText={dict['model.cancel']} |
| | | onOk={this.verifySubmit} |
| | | confirmLoading={loading} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | |
| | | (<div> |
| | | <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'columns')} style={{color: '#1890ff'}}><Icon type="edit" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.deleteColumn(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['model.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['model.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.deleteScript(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | Width: 120 |
| | | } |
| | | |
| | | if (item.type === 'number') { |
| | | newcard.decimal = item.decimal |
| | | } else { |
| | | newcard.fieldlength = item.length || 50 |
| | | } |
| | | |
| | | items.push(newcard) |
| | | } |
| | | }) |
| | |
| | | |
| | | confirm({ |
| | | content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`, |
| | | okText: dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | let _searchlist = fromJS(_this.state.searchlist).toJS() |
| | | |
| | |
| | | <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={props.dict['header.form.query.delete']} |
| | | okText={props.dict['model.confirm']} |
| | | cancelText={props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.sqlverify(_setting, resolve, reject) |
| | | }, |
| | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定切换吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | view: 'normal' |
| | |
| | | columns: res.FDName.map(item => { |
| | | let _type = item.FieldType.toLowerCase() |
| | | let _decimal = 0 |
| | | let _length = 50 |
| | | if (/^nvarchar/.test(_type)) { |
| | | _length = +_type.match(/\d+/)[0] || 50 |
| | | _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' |
| | |
| | | label: item.FieldDec, |
| | | type: _type, |
| | | datatype: _type, |
| | | decimal: _decimal |
| | | decimal: _decimal, |
| | | length: _length, |
| | | } |
| | | }) |
| | | } |
| | |
| | | columns: res.FDName.map(item => { |
| | | let _type = item.FieldType.toLowerCase() |
| | | let _decimal = 0 |
| | | let _length = 50 |
| | | if (/^nvarchar/.test(_type)) { |
| | | _length = +_type.match(/\d+/)[0] || 50 |
| | | _type = 'text' |
| | | } else if (/^int/.test(_type)) { |
| | | _type = 'number' |
| | |
| | | label: item.FieldDec, |
| | | type: _type, |
| | | datatype: _type, |
| | | decimal: _decimal |
| | | decimal: _decimal, |
| | | length: _length |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除<<${card.label}>>吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | tabgroups = tabgroups.map(_group => { |
| | | if (_group.uuid === group.uuid) { |
| | |
| | | |
| | | confirm({ |
| | | content: `确定新建标签组吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | if (_tabgroups.length === 1) { |
| | | _tabgroups.forEach(group => { |
| | |
| | | |
| | | confirm({ |
| | | content: `确定删除标签组吗?`, |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _tabgroups = _tabgroups.filter(_group => _group.uuid !== group.uuid) |
| | | |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record) |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql')) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.sqlverify(_setting, resolve, reject) |
| | | }, |
| | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定切换吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | _this.setState({ |
| | | view: 'normal' |
| | |
| | | if (originConfig.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.handleViewBack() |
| | | }, |
| | |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['model.confirm'], |
| | | cancelText: this.state.dict['model.cancel'], |
| | | onOk() { |
| | | _this.props.handleView() |
| | | }, |
| | |
| | | |
| | | class TransferForm extends Component { |
| | | static propTypes = { |
| | | menulist: PropTypes.array, |
| | | dict: PropTypes.object |
| | | menulist: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict } = this.props |
| | | const { targetKeys, selectedKeys } = this.state |
| | | |
| | | return ( |
| | | <div className="trawmenutransfer"> |
| | | <Transfer |
| | | dataSource={this.props.menulist} |
| | | titles={[dict['model.menu.all'], dict['model.menu.selected']]} |
| | | targetKeys={targetKeys} |
| | | locale={{itemUnit: dict['model.menu.itemUnit'], itemsUnit: dict['model.menu.itemsUnit']}} |
| | | selectedKeys={selectedKeys} |
| | | onChange={this.handleChange} |
| | | onSelectChange={this.handleSelectChange} |
| | |
| | | .trawmenutransfer { |
| | | .ant-transfer-list { |
| | | width: 210px; |
| | | width: calc(50% - 20px); |
| | | height: 250px; |
| | | } |
| | | } |
| | |
| | | {/* 解冻按钮模态框 */} |
| | | <Modal |
| | | title={dict['header.form.thawbutton']} |
| | | okText={dict['model.confirm']} |
| | | cancelText={dict['model.cancel']} |
| | | visible={this.state.thawVisible} |
| | | onOk={this.thawBtnSubmit} |
| | | onCancel={() => {this.setState({thawVisible: false, thawbtnlist: null})}} |
| | | destroyOnClose |
| | | > |
| | | {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} |
| | | {this.state.thawbtnlist && <TransferForm ref="trawmenu" dict={dict} menulist={this.state.thawbtnlist}/>} |
| | | {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>} |
| | | </Modal> |
| | | {/* 按钮配置信息粘贴复制 */} |
| | | <Modal |
| | |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | |
| | | { |
| | | type: 'radio', |
| | | key: 'writein', |
| | | label: '写入', |
| | | tooltip: '表单提交时,是否将该字段值写入默认sql语句中。', |
| | | initVal: card.writein || 'true', |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: Formdict['model.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'encryption', |
| | |
| | | key: 'content', |
| | | label: '内容', |
| | | initVal: card.content || '', |
| | | required: true, |
| | | required: _type !== 'header', |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | }, |
| | | { |
| | |
| | | import './index.scss' |
| | | |
| | | const modalTypeOptions = { |
| | | text: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'regular', 'interception'], |
| | | number: ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist'], |
| | | select: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'setAll', 'linkSubField'], |
| | | multiselect: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'fieldlength'], |
| | | link: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'setAll', 'linkField'], |
| | | fileupload: ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist', 'maxfile', 'fileType'], |
| | | date: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'], |
| | | datemonth: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'], |
| | | datetime: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist'], |
| | | textarea: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'maxRows', 'encryption', 'interception'], |
| | | color: ['label', 'field', 'type', 'blacklist', 'readonly', 'required', 'hidden', 'readin'], |
| | | funcvar: ['label', 'field', 'type', 'blacklist', 'hidden'], |
| | | linkMain: ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist'] |
| | | text: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'regular', 'interception', 'writein'], |
| | | number: ['label', 'field', 'initval', 'type', 'readonly', 'hidden', 'decimal', 'min', 'max', 'readin', 'blacklist', 'writein'], |
| | | select: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'setAll', 'linkSubField', 'writein'], |
| | | multiselect: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'fieldlength', 'writein'], |
| | | link: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'resourceType', 'setAll', 'linkField', 'writein'], |
| | | fileupload: ['label', 'field', 'type', 'readonly', 'required', 'readin', 'fieldlength', 'blacklist', 'maxfile', 'fileType', 'writein'], |
| | | date: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'writein'], |
| | | datemonth: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'writein'], |
| | | datetime: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'writein'], |
| | | textarea: ['label', 'field', 'initval', 'type', 'readonly', 'required', 'hidden', 'readin', 'blacklist', 'fieldlength', 'maxRows', 'encryption', 'interception', 'writein'], |
| | | color: ['label', 'field', 'type', 'blacklist', 'readonly', 'required', 'hidden', 'readin', 'writein'], |
| | | funcvar: ['label', 'field', 'type', 'blacklist', 'hidden', 'writein'], |
| | | linkMain: ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength', 'blacklist', 'writein'] |
| | | } |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | <span className="operation-btn" title={props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={props.dict['header.form.query.delete']} |
| | | okText={props.dict['model.confirm']} |
| | | cancelText={props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record.key) |
| | | }> |
| | | <span style={{color: '#1890ff', cursor: 'pointer'}}><Icon type="delete" /></span> |
| | |
| | | class TransferForm extends Component { |
| | | static propTypes = { |
| | | columns: PropTypes.array, |
| | | selected: PropTypes.array, |
| | | dict: PropTypes.object, // 字典项 |
| | | selected: PropTypes.array |
| | | } |
| | | |
| | | state = { |
| | |
| | | key: item.uuid, |
| | | title: item.label, |
| | | field: item.field, |
| | | description: '' |
| | | description: item.label + '(' + item.field + ')' |
| | | } |
| | | }), |
| | | targetKeys: selecteds |
| | |
| | | } |
| | | |
| | | getItem = (item) => { |
| | | let content = item.title + '(' + item.field + ')' |
| | | return <span title={content}> |
| | | {content} |
| | | <Icon type="arrow-up" onClick={(e) => {this.changeorder(e, item, 'up')}} /> |
| | | <Icon type="arrow-down" onClick={(e) => {this.changeorder(e, item, 'down')}} /> |
| | | </span> |
| | | const { targetKeys } = this.state |
| | | |
| | | if (targetKeys.includes(item.key)) { |
| | | return <span title={item.description}> |
| | | {item.description} |
| | | <Icon type="arrow-up" onClick={(e) => {this.changeorder(e, item, 'up')}} /> |
| | | <Icon type="arrow-down" onClick={(e) => {this.changeorder(e, item, 'down')}} /> |
| | | </span> |
| | | } else { |
| | | return item.description |
| | | } |
| | | } |
| | | |
| | | filterdata = (inputValue, option) => { |
| | | if (!inputValue) return true |
| | | |
| | | return option.description.toLowerCase().indexOf(inputValue.toLowerCase()) > -1 |
| | | } |
| | | |
| | | render() { |
| | |
| | | <div className="common-table-columns-transfer"> |
| | | <Transfer |
| | | dataSource={this.state.data} |
| | | titles={[this.props.dict['header.form.column.source'], this.props.dict['header.form.column.target']]} |
| | | showSearch={this.state.data.length > 10} |
| | | filterOption={this.filterdata} |
| | | targetKeys={targetKeys} |
| | | locale={{itemUnit: this.props.dict['header.form.column.itemUnit'], itemsUnit: this.props.dict['header.form.column.itemsUnit']}} |
| | | selectedKeys={selectedKeys} |
| | | onChange={this.handleChange} |
| | | onSelectChange={this.handleSelectChange} |
| | |
| | | .common-table-columns-transfer { |
| | | padding-left: 18px; |
| | | |
| | | .ant-transfer { |
| | | white-space: nowrap; |
| | | } |
| | | .ant-transfer-list-body-with-search { |
| | | padding-top: 45px; |
| | | .ant-transfer-list-body-search-wrapper { |
| | | padding: 5px; |
| | | } |
| | | } |
| | | .ant-transfer-list { |
| | | width: 296px; |
| | | width: calc(50% - 20px); |
| | | height: 250px; |
| | | i { |
| | | display: none; |
| | | } |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'unique', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'unique')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'unique') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'contrast', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'contrast')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'contrast') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'customverify') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'scripts') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span> |
| | | <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={this.props.dict['header.form.query.delete']} |
| | | okText={this.props.dict['model.confirm']} |
| | | cancelText={this.props.dict['model.cancel']} |
| | | onConfirm={() => this.handleDelete(record, 'ordercode') |
| | | }> |
| | | <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span> |
| | |
| | | if (_loading) { |
| | | confirm({ |
| | | content: `存在未保存项,确定提交吗?`, |
| | | okText: this.props.dict['model.confirm'], |
| | | cancelText: this.props.dict['model.cancel'], |
| | | onOk() { |
| | | resolve(verify) |
| | | }, |
| | |
| | | let values = [] |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.writein === false) return |
| | | |
| | | keys.push(item.key.toLowerCase()) |
| | | values.push('@' + item.key) |
| | | }) |
| | |
| | | let _arr = [] |
| | | |
| | | formdata.forEach(item => { |
| | | if (item.writein === false) return |
| | | |
| | | _arr.push(item.key.toLowerCase()) |
| | | _form.push(item.key + '=@' + item.key) |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import { ConfigProvider } from 'antd' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | import Header from '@/components/header' |
| | | import Sidemenu from '@/components/sidemenu' |
| | | import Tabview from '@/components/tabview' |
| | | import './index.scss' |
| | | |
| | | const _locale = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | class Main extends Component { |
| | | render () { |
| | | return ( |
| | | <div className="flex-container"> |
| | | <Header key="header"/> |
| | | <Sidemenu key="sidemenu"/> |
| | | <Tabview key="tabview"/> |
| | | <ConfigProvider locale={_locale}> |
| | | <Header key="header"/> |
| | | <Sidemenu key="sidemenu"/> |
| | | <Tabview key="tabview"/> |
| | | </ConfigProvider> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import moment from 'moment' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { notification, Modal, Collapse, Card, Icon, Switch, Button } from 'antd' |
| | | import { ConfigProvider, notification, Modal, Collapse, Card, Icon, Switch, Button } from 'antd' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/mob.js' |
| | | import enUS from '@/locales/en-US/mob.js' |
| | | import antdEnUS from 'antd/es/locale/en_US' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import './index.scss' |
| | |
| | | // const { TabPane } = Tabs |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const _locale = localStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS |
| | | |
| | | const Header = asyncComponent(() => import('@/menu/header')) |
| | | const MenuForm = asyncComponent(() => import('@/menu/menuform')) |
| | |
| | | |
| | | closeView = () => { |
| | | const { oriConfig, config } = this.state |
| | | const _this = this |
| | | |
| | | if (!is(fromJS(oriConfig), fromJS(config))) { |
| | | confirm({ |
| | | title: '配置已修改,放弃保存吗?', |
| | | content: '', |
| | | okText: _this.state.dict['mob.confirm'], |
| | | cancelText: _this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | window.close() |
| | | }, |
| | |
| | | confirm({ |
| | | title: '确定删除元素吗?', |
| | | content: '', |
| | | okText: this.state.dict['mob.confirm'], |
| | | cancelText: this.state.dict['mob.cancel'], |
| | | onOk() { |
| | | config.components = config.components.filter(item => item.uuid !== id) |
| | | |
| | |
| | | const { activeKey, dict, MenuId, config } = this.state |
| | | |
| | | return ( |
| | | <div className="pc-menu-view" id="view"> |
| | | <Header view="design" closeView={this.closeView} /> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="menu-body"> |
| | | <div className="menu-setting"> |
| | | <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel header={dict['mob.basemsg']} key="basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm |
| | | dict={dict} |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={this.props.match.params.ParentId} |
| | | MenuName={this.props.match.params.MenuName} |
| | | MenuNo={this.props.match.params.MenuNo} |
| | | initMenuList={this.initMenuList} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} |
| | | </Panel> |
| | | {/* 组件添加 */} |
| | | <Panel header={dict['mob.component']} key="component"> |
| | | <SourceWrap /> |
| | | </Panel> |
| | | {/* <Panel header={dict['mob.style']} key="style"> |
| | | <Controller /> |
| | | </Panel> */} |
| | | </Collapse> |
| | | <ConfigProvider locale={_locale}> |
| | | <div className="pc-menu-view" id="view"> |
| | | <Header view="design" closeView={this.closeView} /> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="menu-body"> |
| | | <div className="menu-setting"> |
| | | <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> |
| | | {/* 基本信息 */} |
| | | <Panel header={dict['mob.basemsg']} key="basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm |
| | | dict={dict} |
| | | config={config} |
| | | MenuId={MenuId} |
| | | parentId={this.props.match.params.ParentId} |
| | | MenuName={this.props.match.params.MenuName} |
| | | MenuNo={this.props.match.params.MenuNo} |
| | | initMenuList={this.initMenuList} |
| | | updateConfig={this.updateConfig} |
| | | /> |
| | | {/* 表名添加 */} |
| | | {config ? <TableComponent config={config} updatetable={this.updatetable}/> : null} |
| | | </Panel> |
| | | {/* 组件添加 */} |
| | | <Panel header={dict['mob.component']} key="component"> |
| | | <SourceWrap /> |
| | | </Panel> |
| | | {/* <Panel header={dict['mob.style']} key="style"> |
| | | <Controller /> |
| | | </Panel> */} |
| | | </Collapse> |
| | | </div> |
| | | <div className="menu-view"> |
| | | <Card title={ |
| | | <div> |
| | | {config && config.MenuName} |
| | | <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={() => this.reloadTab()} /> |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | {config ? <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config.enabled} onChange={this.onEnabledChange} /> : null} |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['mob.save']}</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {config && config.components ? <MenuShell config={config} handleList={this.updateConfig} deleteCard={this.deleteCard} /> : null} |
| | | </Card> |
| | | </div> |
| | | </div> |
| | | <div className="menu-view"> |
| | | <Card title={ |
| | | <div> |
| | | {config && config.MenuName} |
| | | <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={() => this.reloadTab()} /> |
| | | </div> |
| | | } bordered={false} extra={ |
| | | <div> |
| | | {config ? <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config.enabled} onChange={this.onEnabledChange} /> : null} |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['mob.save']}</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {config && config.components ? <MenuShell config={config} handleList={this.updateConfig} deleteCard={this.deleteCard} /> : null} |
| | | </Card> |
| | | </div> |
| | | </div> |
| | | </DndProvider> |
| | | </div> |
| | | </DndProvider> |
| | | </div> |
| | | </ConfigProvider> |
| | | ) |
| | | } |
| | | } |