| | |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.state.dict['header.password.resetsuccess'], |
| | | duration: 5 |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | |
| | | this.state.menulist.map(item => { |
| | | return ( |
| | | <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={this.props.selectmenu.MenuID === item.MenuID ? 'active' : ''}> |
| | | {item.MenuName} |
| | | <span>{item.MenuName}</span> |
| | | </li> |
| | | ) |
| | | })} |
| | |
| | | line-height: 48px; |
| | | li { |
| | | float: left; |
| | | // color: $header-font; |
| | | font-size: 1.7rem; |
| | | margin: 0 10px; |
| | | font-size: 1.8rem; |
| | | cursor: pointer; |
| | | span { |
| | | padding: 0 10px; |
| | | height: 42px; |
| | | display: inline-block; |
| | | } |
| | | |
| | | &:hover { |
| | | height: 42px; |
| | | color: #eeeeee; |
| | | border-bottom: 4px solid #fafcfb; |
| | | } |
| | | &.active { |
| | | height: 42px; |
| | | color: #ffffff; |
| | | font-weight: bold; |
| | | // font-weight: bold; |
| | | border-bottom: 4px solid #06b4f7; |
| | | } |
| | | } |
| | | } |
| | |
| | | }) |
| | | menu.selected = true |
| | | tabs.push(menu) |
| | | |
| | | this.props.modifyTabview(tabs) |
| | | e.preventDefault() |
| | | } |
| | |
| | | position: relative; |
| | | } |
| | | .ant-menu-sub.ant-menu-inline > .ant-menu-item { // 重置三级菜单行高 |
| | | height: 30px; |
| | | line-height: 30px; |
| | | height: 38px; |
| | | line-height: 38px; |
| | | margin: 0px; |
| | | border-bottom: 1px solid #000c17; |
| | | .edit-check { |
| | | top: -5px; |
| | | } |
| | | } |
| | | .ant-menu-sub.ant-menu-inline > .ant-menu-item.ant-menu-item-active { // 重置三级菜单行高 |
| | | background: #06b4f7; |
| | | } |
| | | .ant-menu-sub.ant-menu-inline > .ant-menu-item.ant-menu-item-selected { // 重置三级菜单行高 |
| | | background: #06b4f7; |
| | | } |
| | | .ant-menu-inline .ant-menu-item { |
| | | font-size: 1.5rem; |
| | | } |
| | |
| | | this.setState({ |
| | | selectedTabId: menu.MenuID |
| | | }) |
| | | |
| | | let tabs = JSON.parse(JSON.stringify(this.props.tabviews)) |
| | | tabs = tabs.map(tab => { |
| | | if (tab.MenuID === menu.MenuID) { |
| | | tab.selected = true |
| | | } else { |
| | | tab.selected = false |
| | | } |
| | | return tab |
| | | }) |
| | | this.props.modifyTabview(tabs) |
| | | this.resetWindow(menu) |
| | | } |
| | | |
| | |
| | | this.setState({ |
| | | selectedTabId: view ? view.MenuID : '' |
| | | }) |
| | | |
| | | this.resetWindow(view) |
| | | } |
| | | } |
| | |
| | | 'header.form.format': '格式化', |
| | | 'header.form.empty': '空', |
| | | 'header.form.thdSeparator': '千分位', |
| | | 'header.form.prefix': '前置符', |
| | | 'header.form.prefix': '前缀', |
| | | 'header.form.postfix': '后缀', |
| | | 'header.form.isRequired': '行设置', |
| | | 'header.form.notRequired': '不选择行', |
| | | 'header.form.requiredSgl': '选择单行', |
| | |
| | | 'header.form.format': '格式化', |
| | | 'header.form.empty': '空', |
| | | 'header.form.thdSeparator': '千分位', |
| | | 'header.form.prefix': '前置符', |
| | | 'header.form.prefix': '前缀', |
| | | 'header.form.postfix': '后缀', |
| | | 'header.form.isRequired': '行设置', |
| | | 'header.form.notRequired': '不选择行', |
| | | 'header.form.requiredSgl': '选择单行', |
| | |
| | | loading: true |
| | | }, () => { |
| | | this.improveSearch() |
| | | this.improveAction() |
| | | this.loadmaindata() |
| | | }) |
| | | } else { |
| | |
| | | }) |
| | | } |
| | | |
| | | improveAction = () => { |
| | | const { config } = this.state |
| | | |
| | | let conAction = config.action.filter(item => (item.OpenType === 'pop' || item.OpenType === 'tab' || item.OpenType === 'blank')) |
| | | |
| | | if (conAction.length > 0) { |
| | | let deffers = conAction.map(item => { |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: item.uuid |
| | | }).then(res => { |
| | | res.uuid = item.uuid |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | let _action = {} |
| | | let error = '' |
| | | Promise.all(deffers).then(result => { |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | let _LongParam = '' |
| | | if (res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (_LongParam) { |
| | | _action[res.uuid] = _LongParam |
| | | } |
| | | } else { |
| | | error = res |
| | | |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | configMap: {...this.state.configMap, ..._action} |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.improveActionForm(Object.values(_action)) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | improveActionForm = (actions) => { |
| | | let subfields = [] |
| | | actions.forEach(item => { |
| | | if (item.groups.length > 0) { |
| | | item.groups.forEach(group => { |
| | | group.sublist.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | item.fields.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | let deffers = subfields.map(item => { |
| | | let arrfield = item.valueField + ',' + item.valueText |
| | | |
| | | if (item.type === 'link') { |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.dataSourceSql, |
| | | obj_name: 'data', |
| | | arr_field: arrfield |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | console.log(item) |
| | | return new Promise(resolve => { |
| | | Api.getSystemCacheConfig(param).then(res => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | let _field = {} |
| | | let error = '' |
| | | Promise.all(deffers).then(result => { |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | let options = res.data.map(cell => { |
| | | return { |
| | | key: Utils.getuuid(), |
| | | Value: cell[res.search.valueField], |
| | | Text: cell[res.search.valueText] |
| | | } |
| | | }) |
| | | |
| | | _field[res.search.uuid] = options |
| | | } else { |
| | | error = res |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | configMap: {...this.state.configMap, ..._field} |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | async loadmaindata () { |
| | | const { arr_field, pageIndex, pageSize, orderColumn, orderType, search, setting } = this.state |
| | |
| | | <MainAction |
| | | MenuID={this.props.MenuID} |
| | | setting={setting} |
| | | configMap={this.state.configMap} |
| | | refreshdata={this.refreshbyaction} |
| | | gettableselected={this.gettableselected} |
| | | actions={actions} |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import moment from 'moment' |
| | | import { Button, Affix, Modal, notification } from 'antd' |
| | | import { Button, Affix, Modal, notification, Spin } from 'antd' |
| | | import MutilForm from '../mutilform' |
| | | import Utils from '@/utils/utils.js' |
| | | import Api from '@/api' |
| | |
| | | MenuID: PropTypes.string, |
| | | actions: PropTypes.array, // 搜索条件列表 |
| | | dict: PropTypes.object, // 字典项 |
| | | setting: PropTypes.any, |
| | | configMap: PropTypes.object |
| | | setting: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | tabledata: null, |
| | | confirmLoading: false, |
| | | execAction: null, |
| | | loadingUuid: '' |
| | | loadingUuid: '', |
| | | btnloading: false, |
| | | configMap: {} |
| | | } |
| | | |
| | | refreshdata = (item, type) => { |
| | | this.props.refreshdata(item, type) |
| | | } |
| | | actionTrigger = (item) => { |
| | | const { setting, configMap } = this.props |
| | | const { setting } = this.props |
| | | |
| | | let _this = this |
| | | let data = this.props.gettableselected() || [] |
| | | |
| | |
| | | this.setState({loadingUuid: ''}) |
| | | }) |
| | | } else if (item.OpenType === 'pop') { |
| | | let param = configMap[item.uuid] |
| | | |
| | | if (!param || param.type !== 'Modal') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到按钮配置信息!', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: true, |
| | | execAction: {...param, ...item}, |
| | | tabledata: data |
| | | }) |
| | | } |
| | | this.setState({ |
| | | execAction: item, |
| | | tabledata: data, |
| | | btnloading: true |
| | | }, () => { |
| | | this.improveAction(item) |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }).then(res => { |
| | | if (!res) return |
| | | // 外部请求 |
| | | console.log(res) |
| | | return Api.genericInterface(res) |
| | | }).then(response => { |
| | | // 回调请求 |
| | |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.success'], |
| | | duration: 5 |
| | | duration: 2 |
| | | }) |
| | | if (btn.OpenType === 'pop') { |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | improveAction = (action) => { |
| | | const { configMap, execAction } = this.state |
| | | |
| | | let _config = configMap[action.uuid] |
| | | |
| | | if (_config) { |
| | | this.setState({ |
| | | execAction: {..._config, ...execAction} |
| | | }, () => { |
| | | this.improveActionForm() |
| | | }) |
| | | } else { |
| | | Api.getSystemCacheConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: action.uuid |
| | | }).then(res => { |
| | | let _LongParam = '' |
| | | |
| | | if (res.status && res.LongParam) { |
| | | _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | try { |
| | | _LongParam = JSON.parse(_LongParam) |
| | | } catch (e) { |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | this.setState({ |
| | | execAction: null, |
| | | tabledata: null, |
| | | btnloading: false |
| | | }) |
| | | } else if (!_LongParam || (action.OpenType === 'pop' && _LongParam.type !== 'Modal')) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未获取到按钮配置信息!', |
| | | duration: 10 |
| | | }) |
| | | this.setState({ |
| | | execAction: null, |
| | | tabledata: null, |
| | | btnloading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | configMap: {...configMap, [action.uuid]: _LongParam}, |
| | | execAction: {..._LongParam, ...execAction} |
| | | }, () => { |
| | | this.improveActionForm() |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | improveActionForm = () => { |
| | | const { configMap, execAction } = this.state |
| | | let subfields = [] |
| | | |
| | | if (execAction.groups.length > 0) { |
| | | execAction.groups.forEach(group => { |
| | | group.sublist.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | execAction.fields.forEach(field => { |
| | | if ((field.type === 'select' || field.type === 'link') && field.resourceType === '1') { |
| | | subfields.push(field) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (subfields.length === 0) { |
| | | this.setState({ |
| | | visible: true, |
| | | btnloading: false |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let deffers = subfields.map(item => { |
| | | let arrfield = item.valueField + ',' + item.valueText |
| | | |
| | | if (item.type === 'link') { |
| | | arrfield = arrfield + ',' + item.linkField |
| | | } |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: item.dataSourceSql, |
| | | obj_name: 'data', |
| | | arr_field: arrfield |
| | | } |
| | | |
| | | 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 => { |
| | | res.search = item |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | let _field = {} |
| | | let error = '' |
| | | Promise.all(deffers).then(result => { |
| | | result.forEach(res => { |
| | | if (res.status) { |
| | | let options = res.data.map(cell => { |
| | | let item = { |
| | | key: Utils.getuuid(), |
| | | Value: cell[res.search.valueField], |
| | | Text: cell[res.search.valueText] |
| | | } |
| | | |
| | | if (res.search.type === 'link') { |
| | | item.parentId = cell[res.search.linkField] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | _field[res.search.uuid] = options |
| | | } else { |
| | | error = res |
| | | } |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: error.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | configMap: {...configMap, ..._field} |
| | | }, () => { |
| | | this.setState({ |
| | | visible: true, |
| | | btnloading: false |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | handleOk = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | this.setState({ |
| | |
| | | confirmLoading: false |
| | | }) |
| | | }, res) |
| | | console.log(res) |
| | | }, () => {}) |
| | | } |
| | | |
| | |
| | | <MutilForm |
| | | dict={this.props.dict} |
| | | action={execAction} |
| | | configMap={this.props.configMap} |
| | | configMap={this.state.configMap} |
| | | data={this.state.tabledata[0]} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | /> |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { loadingUuid } = this.state |
| | | const { loadingUuid, btnloading } = this.state |
| | | |
| | | if (this.props.setting.actionfixed) { // 按钮是否固定在头部 |
| | | return ( |
| | |
| | | } |
| | | })} |
| | | {this.getModels()} |
| | | {btnloading && <Spin size="large" />} |
| | | </div> |
| | | </Affix> |
| | | ) |
| | |
| | | } |
| | | })} |
| | | {this.getModels()} |
| | | {btnloading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | margin-right: 15px; |
| | | margin-bottom: 10px; |
| | | } |
| | | .ant-spin { |
| | | position: fixed; |
| | | z-index: 1010; |
| | | left: 50vw; |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | |
| | | width: item.Width || 120, |
| | | render: (text, record) => { |
| | | return this.getContent(item, record) |
| | | // let content = '' |
| | | // if (item.field) { |
| | | // content = record[item.field] || '' |
| | | // } |
| | | // return ( |
| | | // <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | // {content} |
| | | // </div> |
| | | // ) |
| | | } |
| | | } |
| | | _columns.push(cell) |
| | |
| | | } |
| | | |
| | | getContent = (item, record) => { |
| | | if (item.type === 'operation') { |
| | | if (item.type === 'text') { |
| | | let content = '' |
| | | let match = false |
| | | if (item.field && record.hasOwnProperty(item.field)) { |
| | | content = `${record[item.field]}` |
| | | } |
| | | |
| | | if (content && item.matchVal && content.indexOf(item.matchVal) > 0) { |
| | | match = true |
| | | } |
| | | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | |
| | | return ( |
| | | <div className={match ? item.color : ''}> |
| | | <div className="background"></div> |
| | | <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | {content} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } else if (item.type === 'number') { |
| | | let content = '' |
| | | let match = false |
| | | if (item.field && record.hasOwnProperty(item.field)) { |
| | | content = +record[item.field] |
| | | } |
| | | |
| | | if (content && item.match && item.matchVal) { |
| | | if (item.match === '>') { |
| | | if (content > item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '<') { |
| | | if (content < item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '>=') { |
| | | if (content >= item.matchVal) { |
| | | match = true |
| | | } |
| | | } else if (item.match === '<=') { |
| | | if (content <= item.matchVal) { |
| | | match = true |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (content && item.format === 'thdSeparator') { |
| | | |
| | | } |
| | | |
| | | content = (item.prefix || '') + content + (item.postfix || '') |
| | | |
| | | return ( |
| | | <div className={match ? item.color : ''}> |
| | | <div className={'background'}></div> |
| | | <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | {content} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } else if (item.type === 'operation') { |
| | | return ( |
| | | <div className={item.style} style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | {item.operations.map(btn => { |
| | |
| | | })} |
| | | </div> |
| | | ) |
| | | } else { |
| | | let content = '' |
| | | if (item.field) { |
| | | content = record[item.field] || '' |
| | | } else if (item.type === 'colspan') { |
| | | let contents = '' |
| | | if (item.subColumn.length > 0) { |
| | | contents = item.subColumn.map(col => { |
| | | let content = '' |
| | | if (col.type === 'text' || col.type === 'textarea') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = `${record[col.field]}` |
| | | } |
| | | |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } else if (col.type === 'number') { |
| | | if (col.field && record.hasOwnProperty(col.field)) { |
| | | content = +record[col.field] |
| | | } |
| | | if (content && col.format === 'thdSeparator') { |
| | | |
| | | } |
| | | content = (col.prefix || '') + content + (col.postfix || '') |
| | | } |
| | | return content |
| | | }) |
| | | } |
| | | |
| | | return ( |
| | | // <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | <div> |
| | | <div className={'background'}></div> |
| | | <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}> |
| | | {content} |
| | | {contents && item.order === 'vertical' && contents.map((content, index) => { |
| | | return (<p key={index}>{content}</p>) |
| | | })} |
| | | {contents && item.order === 'horizontal' && contents.map((content, index) => { |
| | | return (<span key={index}>{content}</span>) |
| | | })} |
| | | </div> |
| | | </div> |
| | | ) |
| | |
| | | right: 0px; |
| | | bottom: 0px; |
| | | } |
| | | .background.lightblue { |
| | | background: lightblue; |
| | | } |
| | | |
| | | .content { |
| | | position: relative; |
| | | z-index: 1; |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | .red { |
| | | .content { |
| | | color: red; |
| | | } |
| | | } |
| | | .redbg { |
| | | .background { |
| | | background: lightcoral; |
| | | } |
| | | } |
| | | } |
| | | .ant-table-tbody > tr > td .content { |
| | | p { |
| | | margin-bottom: 5px; |
| | | } |
| | | span { |
| | | display: inline-block; |
| | | margin-right: 5px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker } from 'antd' |
| | | import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd' |
| | | import moment from 'moment' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { action } = this.props |
| | | let action = JSON.parse(JSON.stringify(this.props.action)) |
| | | |
| | | let datatype = {} |
| | | let readtype = {} |
| | | let formlist = [] |
| | |
| | | datatype[item.field] = item.type |
| | | readtype[item.field] = item.readonly === 'true' |
| | | |
| | | if (item.type === 'select' || item.type === 'link') { |
| | | if (item.setAll === 'true') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | | Value: '', |
| | | Text: this.props.dict['main.all'] |
| | | }) |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) { |
| | | item.options = [...item.options, ...this.props.configMap[item.uuid]] |
| | | } |
| | | console.log(item) |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'select' || item.type === 'link') { |
| | | if (item.setAll === 'true') { |
| | | item.options.unshift({ |
| | | key: Utils.getuuid(), |
| | | Value: '', |
| | | Text: this.props.dict['main.all'] |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) { |
| | | item.options = [...item.options, ...this.props.configMap[item.uuid]] |
| | | } |
| | | |
| | | item.oriOptions = item.options |
| | | } |
| | | |
| | | if (!/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) { |
| | | item.initval = this.props.data[item.field] |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | let error = false |
| | | |
| | | formlist = formlist.map(item => { |
| | | if (item.type === 'link') { |
| | | let supItem = formlist.filter(form => form.field === item.linkField)[0] |
| | | if (!supItem) { |
| | | error = true |
| | | } else { |
| | | item.options = item.oriOptions.filter(option => option.parentId === supItem.initval) |
| | | } |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '关联菜单设置错误!', |
| | | duration: 10 |
| | | }) |
| | | } |
| | | |
| | |
| | | readtype: readtype, |
| | | datatype: datatype, |
| | | formlist: formlist |
| | | }) |
| | | } |
| | | |
| | | resetform = (formlist, supfields, index) => { |
| | | 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 : '' |
| | | item.hiden = true |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | if (subfields.length === 0 || index > 6) { |
| | | return formlist |
| | | } else { |
| | | return this.resetform(formlist, subfields, index) |
| | | } |
| | | } |
| | | |
| | | selectChange = (_field, value) => { |
| | | let formlist = JSON.parse(JSON.stringify(this.state.formlist)) |
| | | |
| | | let subfields = [] |
| | | 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 : '' |
| | | item.hiden = true |
| | | |
| | | subfields.push(item) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (subfields.length === 0) return |
| | | |
| | | formlist = this.resetform(formlist, subfields, 0) |
| | | this.setState({ |
| | | formlist: formlist |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: formlist.map(item => { |
| | | item.hiden = false |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (!item.field && item.type !== 'title') return |
| | | if ((!item.field && item.type !== 'title') || item.hiden) return |
| | | |
| | | if (item.type === 'title') { |
| | | fields.push( |
| | |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: this.props.data ? this.props.data[item.field] : item.initval, |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | |
| | | } else if (item.type === 'number') { // 数字 |
| | | let min = (item.min || item.min === 0) ? item.min : -Infinity |
| | | let max = (item.max || item.max === 0) ? item.max : Infinity |
| | | let _initval = this.props.data ? this.props.data[item.field] : item.initval |
| | | let _initval = item.initval |
| | | let precision = (item.decimal || item.decimal === 0) ? item.decimal : null |
| | | |
| | | fields.push( |
| | |
| | | <Col span={24 / cols} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: this.props.data ? this.props.data[item.field] : item.initval, |
| | | initialValue: item.initval, |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.selectChange(item, value)}} |
| | | // getPopupContainer={() => document.getElementById('form-box')} |
| | | > |
| | | {item.options.map(option => |
| | |
| | | readonly: this.state.readtype[key], |
| | | key: key, |
| | | value: values[key].replace(/(^\s*|\s*$)/ig, '') |
| | | // value: values[key].replace(/[\x00-\xff]+/ig, '') |
| | | }) |
| | | } |
| | | }) |
| | |
| | | padding: 0px 24px 20px; |
| | | .ant-form-item { |
| | | display: flex; |
| | | margin-bottom: 10px; |
| | | // margin-bottom: 10px; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 1; |
| | |
| | | if (!iserror) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: _this.props.dict['main.action.confirm.success'] |
| | | message: _this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | |
| | | _this.props.refreshdata(item.ReloadForm) // 刷新页面 |
| | |
| | | if (res.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: _this.props.dict['main.action.confirm.success'] |
| | | message: _this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | |
| | | _this.props.refreshdata(item.ReloadForm) // 刷新页面 |
| | |
| | | if (!iserror) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.success'] |
| | | message: this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | |
| | | this.props.refreshdata(item.ReloadForm) // 刷新页面 |
| | |
| | | if (res.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.success'] |
| | | message: this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | |
| | | this.props.refreshdata(item.ReloadForm) // 刷新页面 |
| | |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.dict['main.action.confirm.success'] |
| | | message: this.props.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | this.setState({ |
| | | confirmLoading: false, |
| | |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.state.dict['main.action.confirm.success'] |
| | | message: this.state.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | |
| | | this.refreshbyaction(_param.execAction.ReloadForm) // 刷新主列表页面 |
| | |
| | | if (result.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: this.props.param.dict['main.action.confirm.success'] |
| | | message: this.props.param.dict['main.action.confirm.success'], |
| | | duration: 2 |
| | | }) |
| | | |
| | | // 刷新主列表页面 |
| | |
| | | } |
| | | delete values.type |
| | | |
| | | let _card = {...this.props.card, ...values, sublist: targetKeys} |
| | | let subfield = [] // 用于查看合并列字段 |
| | | this.props.columns.forEach(col => { |
| | | if (col.field && targetKeys.includes(col.uuid)) { |
| | | subfield.push(col.field) |
| | | } |
| | | }) |
| | | subfield = subfield.join(', ') |
| | | |
| | | let _card = {...this.props.card, ...values, sublist: targetKeys, subfield: subfield} |
| | | |
| | | resolve({ |
| | | type: 'columns', |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio } from 'antd' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon } from 'antd' |
| | | import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | | |
| | | if (_type === 'text') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | } else if (_type === 'number') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] |
| | | } else if (_type === 'textarea') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | | |
| | | if (value === 'text') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | } else if (value === 'number') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'match', 'matchVal', 'color'] |
| | | } else if (value === 'textarea') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'matchVal', 'color'] |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | |
| | | width: 100%; |
| | | } |
| | | } |
| | | .anticon-question-circle { |
| | | color: #c49f47; |
| | | position: relative; |
| | | left: -3px; |
| | | } |
| | | } |
| | |
| | | |
| | | const { MonthPicker, WeekPicker, RangePicker } = DatePicker |
| | | |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, hasDrop }) => { |
| | | const Card = ({ id, type, card, moveCard, findCard, editCard, delCard, copyCard, hasDrop, showfield }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: ItemTypes[type], id, originalIndex }, |
| | |
| | | <Icon type="caret-down" /> |
| | | </span>} |
| | | </div> |
| | | {showfield ? <div className="ant-table-column-fields"> |
| | | <span className="ant-table-column-title">{card.type === 'colspan' ? card.subfield : card.field}</span> |
| | | </div> : null} |
| | | </span> |
| | | } |
| | | </div> |
| | |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn }) => { |
| | | const Container = ({list, setting, gridBtn, type, placeholder, handleList, handleMenu, deleteMenu, copyElement, handleGridBtn, showfield }) => { |
| | | let target = null |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | |
| | | newcard.Width = 120 |
| | | if (item.subType === 'colspan') { |
| | | newcard.sublist = [] |
| | | newcard.subfield = [] |
| | | newcard.IsSort = 'false' |
| | | newcard.order = 'vertical' |
| | | } |
| | |
| | | id={`${card.uuid}`} |
| | | type={type} |
| | | card={card} |
| | | showfield={showfield} |
| | | moveCard={moveCard} |
| | | editCard={editCard} |
| | | delCard={delCard} |
| | |
| | | tables: [], // 可用表名 |
| | | selectedTables: [], // 已选表名 |
| | | originMenu: null, // 原始菜单 |
| | | originActions: null, |
| | | delActions: [], |
| | | funcLoading: false |
| | | originActions: null, // 原始按钮信息,使用已有用户模板 |
| | | delActions: [], // 删除按钮列表 |
| | | funcLoading: false, // 存储过程创建中 |
| | | showColumnName: false // 显示列字段名控制 |
| | | } |
| | | |
| | | /** |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'postfix', |
| | | label: this.state.dict['header.form.postfix'], |
| | | initVal: card.postfix || '', |
| | | // tooltip: '后缀值设置为"\\n",表示换行', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'match', |
| | | label: this.state.dict['header.form.match'], |
| | |
| | | }, { |
| | | MenuID: '<=', |
| | | text: '<=' |
| | | }, { |
| | | MenuID: 'between', |
| | | text: 'between' |
| | | }], |
| | | required: false |
| | | }, |
| | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '创建成功', |
| | | duration: 5 |
| | | duration: 2 |
| | | }) |
| | | return true |
| | | } |
| | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '操作成功', |
| | | duration: 5 |
| | | duration: 2 |
| | | }) |
| | | this.setState({ |
| | | [addType + 'loading']: false |
| | |
| | | }) |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | | const { showColumnName } = this.state |
| | | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const configAction = this.state.config.action.filter(_action => |
| | | !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') |
| | |
| | | <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《显示列》中,选择对应类型的显示列拖至此处添加;或点击《添加显示列》按钮批量添加,选择批量添加时,需提前选择使用表。注:添加合并列时,需设置可选列。"> |
| | | <Icon type="question-circle" /> |
| | | </Tooltip> |
| | | <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} /> |
| | | {!this.state.columnsloading ? |
| | | <DragElement |
| | | list={this.state.config.columns} |
| | |
| | | handleMenu={this.handleColumn} |
| | | deleteMenu={this.deleteElement} |
| | | handleGridBtn={this.handleGridBtn} |
| | | showfield={this.state.showColumnName} |
| | | /> : null |
| | | } |
| | | </div> |
| | |
| | | } |
| | | } |
| | | .column-list { |
| | | position: relative; |
| | | padding: 0px 20px; |
| | | .ant-switch { |
| | | position: absolute; |
| | | right: 20px; |
| | | top: -10px; |
| | | } |
| | | > .ant-row { |
| | | background: #fafafa; |
| | | border-radius: 4px; |
| | |
| | | padding: 0px; |
| | | min-height: 45px; |
| | | > div { |
| | | padding: 12px 8px; |
| | | padding: 12px 0px 0px; |
| | | cursor: move; |
| | | height: 100%; |
| | | .ant-table-column-sorters { |
| | | padding: 0px 8px 12px; |
| | | } |
| | | .ant-table-column-fields { |
| | | padding: 0px 8px 5px; |
| | | } |
| | | } |
| | | .ant-table-column-sorter { |
| | | position: relative; |
| | |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | duration: 2 |
| | | }) |
| | | } else { |
| | | this.setState({ |