| | |
| | | return Promise.reject(error) |
| | | }) |
| | | |
| | | // const setCurrentUrl = () => { |
| | | // if (!!(window.history && window.history.pushState)) { |
| | | // window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | // window.location.reload() |
| | | // } |
| | | // } |
| | | const setCurrentUrl = () => { |
| | | if (!!(window.history && window.history.pushState)) { |
| | | window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') |
| | | window.location.reload() |
| | | } |
| | | } |
| | | |
| | | let GlobMap = new Map() |
| | | |
| | | axios.interceptors.response.use((response) => { |
| | | if (response.data.ErrCode === 'LoginError') { |
| | | // setCurrentUrl() |
| | | return Promise.resolve(response.data) |
| | | setCurrentUrl() |
| | | // return Promise.resolve(response.data) |
| | | } else { |
| | | return Promise.resolve(response.data) |
| | | } |
| | |
| | | if (window.GLOB.mainSystemApi) { |
| | | param.rduri = window.GLOB.mainSystemApi |
| | | } |
| | | if (param.isCache) { // 数据需要缓存时 |
| | | delete param.isCache |
| | | |
| | | if (GlobMap.has(param)) { |
| | | return Promise.resolve(GlobMap.get(param)) |
| | | } else { |
| | | return new Promise(resolve => { |
| | | axios({ |
| | | url: '/webapi/dostar', |
| | | data: param |
| | | }).then(res => { |
| | | console.log(res) |
| | | GlobMap.set(param, res) |
| | | resolve(res) |
| | | }) |
| | | }) |
| | | } |
| | | } else { |
| | | return axios({ |
| | | url: '/webapi/dostar', |
| | | data: param |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取业务通用接口 |
| | |
| | | handleSubConfig = (item, originMenu, config) => { |
| | | if (item.OpenType === 'pop') { |
| | | item.pageParam = '' |
| | | if (config && config.type === 'modal') { |
| | | if (config && config.type === 'Modal') { |
| | | item.pageParam = config |
| | | } |
| | | |
| | |
| | | 'header.form.pageTemplate': '页面模板', |
| | | 'header.form.type': 'Type', |
| | | 'header.form.text': 'Text', |
| | | 'header.form.textarea': '多行文本', |
| | | 'header.form.picture': '图片', |
| | | 'header.form.number': '数字', |
| | | 'header.form.colspan': '合并列', |
| | |
| | | 'header.form.dateyear': '日期(年)', |
| | | 'header.form.daterange': '日期(区间)', |
| | | 'header.form.initval': 'Initial Value', |
| | | 'header.form.decimal': '小数位', |
| | | 'header.form.format': '格式化', |
| | | 'header.form.empty': '空', |
| | | 'header.form.thdSeparator': '千分位', |
| | | 'header.form.prefix': '前置符', |
| | | 'header.form.isRequired': '行设置', |
| | | 'header.form.notRequired': '不选择行', |
| | | 'header.form.requiredSgl': '选择单行', |
| | |
| | | 'header.form.resourceType': '选项来源', |
| | | 'header.form.custom': '自定义', |
| | | 'header.form.datasource': '数据源', |
| | | 'header.form.datasource.actionhelp': '使用系统函数时,请填写数据源。', |
| | | 'header.form.actionhelp.datasource': '使用系统函数时,请填写数据源。', |
| | | 'header.form.actionhelp.sqlType': '使用系统函数时,请选择类型。', |
| | | 'header.form.action.type': '操作类型', |
| | | 'header.form.action.insert': '添加', |
| | | 'header.form.action.update': '修改', |
| | | 'header.form.action.LogicDelete': '逻辑删除', |
| | | 'header.form.action.delete': '物理删除', |
| | | 'header.form.valueField': '值·字段', |
| | | 'header.form.valueText': '文本·字段', |
| | | 'header.form.orderBy': '排序·字段', |
| | | 'header.form.orderType': '排序方式', |
| | | 'header.form.match': '匹配模式', |
| | | 'header.form.matchVal': '匹配值', |
| | | 'header.form.asc': '正序', |
| | | 'header.form.desc': '倒序', |
| | | 'header.form.linkField': '关联字段', |
| | |
| | | 'header.form.dropdown': '下拉菜单', |
| | | 'header.form.button': '按钮', |
| | | 'header.form.style': '风格', |
| | | 'header.form.color': '颜色', |
| | | 'header.form.order': '排列', |
| | | 'header.form.horizontal': '水平', |
| | | 'header.form.vertical': '垂直', |
| | | 'header.form.selectItem.error': '下拉选项设置错误!', |
| | | 'header.form.request.method': '请求方式', |
| | | 'header.form.readonly': '是否只读', |
| | | 'form.required.input': 'Please enter the ', |
| | | 'form.required.select': '请选择' |
| | | } |
| | |
| | | 'header.form.pageTemplate': '页面模板', |
| | | 'header.form.type': '类型', |
| | | 'header.form.text': '文本', |
| | | 'header.form.textarea': '多行文本', |
| | | 'header.form.picture': '图片', |
| | | 'header.form.number': '数字', |
| | | 'header.form.colspan': '合并列', |
| | |
| | | 'header.form.dateyear': '日期(年)', |
| | | 'header.form.daterange': '日期(区间)', |
| | | 'header.form.initval': '初始值', |
| | | 'header.form.decimal': '小数位', |
| | | 'header.form.format': '格式化', |
| | | 'header.form.empty': '空', |
| | | 'header.form.thdSeparator': '千分位', |
| | | 'header.form.prefix': '前置符', |
| | | 'header.form.isRequired': '行设置', |
| | | 'header.form.notRequired': '不选择行', |
| | | 'header.form.requiredSgl': '选择单行', |
| | |
| | | 'header.form.resourceType': '选项来源', |
| | | 'header.form.custom': '自定义', |
| | | 'header.form.datasource': '数据源', |
| | | 'header.form.datasource.actionhelp': '使用系统函数时,请填写数据源。', |
| | | 'header.form.actionhelp.datasource': '使用系统函数时,请填写数据源。', |
| | | 'header.form.actionhelp.sqlType': '使用系统函数时,请选择类型。', |
| | | 'header.form.action.type': '操作类型', |
| | | 'header.form.action.insert': '添加', |
| | | 'header.form.action.update': '修改', |
| | | 'header.form.action.LogicDelete': '逻辑删除', |
| | | 'header.form.action.delete': '物理删除', |
| | | 'header.form.valueField': '值·字段', |
| | | 'header.form.valueText': '文本·字段', |
| | | 'header.form.orderBy': '排序·字段', |
| | | 'header.form.orderType': '排序方式', |
| | | 'header.form.match': '匹配模式', |
| | | 'header.form.matchVal': '匹配值', |
| | | 'header.form.asc': '正序', |
| | | 'header.form.desc': '倒序', |
| | | 'header.form.linkField': '关联字段', |
| | |
| | | 'header.form.dropdown': '下拉菜单', |
| | | 'header.form.button': '按钮', |
| | | 'header.form.style': '风格', |
| | | 'header.form.color': '颜色', |
| | | 'header.form.order': '排列', |
| | | 'header.form.horizontal': '水平', |
| | | 'header.form.vertical': '垂直', |
| | | 'header.form.selectItem.error': '下拉选项设置错误!', |
| | | 'header.form.request.method': '请求方式', |
| | | 'header.form.readonly': '是否只读', |
| | | 'form.required.input': '请输入', |
| | | 'form.required.select': '请选择' |
| | | } |
| | |
| | | // 获取主菜单 |
| | | let param = { |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: this.props.MenuID |
| | | MenuID: this.props.MenuID, |
| | | isCache: true |
| | | } |
| | | let result = await Api.getSystemConfig(param) |
| | | if (result.status && result.LongParam) { |
| | |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } |
| | | } else { |
| | | if (_intertype === 'outer') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } |
| | | } |
| | | this.setState({ |
| | |
| | | if (this.state.interType === 'outer') { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method'] |
| | | } else { |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql'] |
| | | _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } |
| | | } else { |
| | | if (this.state.interType === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | |
| | | if (key === 'intertype') { |
| | | let _options = null |
| | | if (value === 'inner') { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql'] |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType'] |
| | | } else { |
| | | _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method'] |
| | | } |
| | |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | let help = '' |
| | | if (item.key === 'sql') { |
| | | help = this.props.dict['header.form.actionhelp.datasource'] |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.label} help={help}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | let help = '' |
| | | if (item.key === 'sqlType') { |
| | | help = this.props.dict['header.form.actionhelp.sqlType'] |
| | | } |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <Form.Item label={item.label} help={help}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | |
| | | } else if (item.type === 'textarea') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label} help={this.props.dict['header.form.datasource.actionhelp']} className="textarea"> |
| | | <Form.Item label={item.label} className="textarea"> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal |
| | | })(<TextArea rows={4} />)} |
| | |
| | | if (values.innerFunc === '' && values.sql === '') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.props.dict['header.form.datasource.actionhelp'], |
| | | message: this.props.dict['header.form.actionhelp.datasource'], |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | |
| | | } |
| | | |
| | | state = { |
| | | formlist: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | | |
| | | if (_type === 'text') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | } else if (_type === 'number') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color'] |
| | | } else if (_type === 'textarea') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | } |
| | | |
| | | this.setState({ |
| | | formlist: this.props.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | if (item.key === 'matchVal' && (_type === 'text' || _type === 'textarea')) { |
| | | item.type = 'text' |
| | | } else if (item.key === 'matchVal' && _type === 'number') { |
| | | item.type = 'number' |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | typeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width'] |
| | | |
| | | if (value === 'text') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | } else if (value === 'number') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color'] |
| | | } else if (value === 'textarea') { |
| | | _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color'] |
| | | } |
| | | |
| | | this.setState({ |
| | | formlist: this.props.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | if (item.key === 'matchVal' && (value === 'text' || value === 'textarea')) { |
| | | item.type = 'text' |
| | | } else if (item.key === 'matchVal' && value === 'number') { |
| | | item.type = 'number' |
| | | item.initVal = '' |
| | | item.hidden = true |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.props.formlist.map(item => { |
| | | if (item.key === 'matchVal' && value === 'number') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | this.props.formlist.forEach((item, index) => { |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.hidden) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={1} max={1000} precision={item.decimal} />)} |
| | | })(<InputNumber min={item.min} max={item.max} precision={item.decimal} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.typeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('columnwinter')} |
| | | > |
| | | {item.options.map(option => |
| | |
| | | const { card, index } = findCard(id) |
| | | const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) |
| | | setCards(_cards) |
| | | handleList({[type]: _cards}) |
| | | handleList(type, _cards) |
| | | // handleList({[type]: _cards}) |
| | | } |
| | | |
| | | const findCard = id => { |
| | |
| | | let copycard = JSON.parse(JSON.stringify(card)) |
| | | copycard.uuid = Utils.getuuid() |
| | | copycard.origin = false |
| | | // let names = cards.map(car => { return car.label }) |
| | | // let index = 1 |
| | | // let origin = copycard.label.split('(copy')[0] || 'button' |
| | | // let label = origin + '(copy)' |
| | | // while (names.includes(label)) { |
| | | // label = origin + `(copy${index})` |
| | | // index++ |
| | | // } |
| | | |
| | | copycard.label = copycard.label + '(copy)' |
| | | |
| | | let indexes = cards.map(car => { return car.id }) |
| | |
| | | newid++ |
| | | } |
| | | copycard.id = newid |
| | | |
| | | // const { index: overIndex } = findCard(`${card.id}`) |
| | | |
| | | // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) |
| | | // setCards(_cards) |
| | | // handleList({action: _cards}) |
| | | |
| | | copyElement(copycard) |
| | | } |
| | |
| | | newcard.innerFunc = '' |
| | | newcard.outerFunc = '' |
| | | newcard.sql = '' |
| | | newcard.sqlType = '' |
| | | newcard.Ot = 'requiredSgl' |
| | | newcard.OpenType = item.subType |
| | | newcard.icon = '' |
| | |
| | | |
| | | const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] }) |
| | | setCards(_cards) |
| | | handleList({[type]: _cards}) |
| | | handleList(type, _cards, newcard) |
| | | target = null |
| | | } |
| | | }) |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'style', |
| | | label: this.props.dict['header.form.align'], |
| | | label: this.props.dict['header.form.style'], |
| | | initVal: this.props.card.style, |
| | | required: true, |
| | | options: [{ |
| | |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty } from 'antd' |
| | | import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch } from 'antd' |
| | | import moment from 'moment' |
| | | import DragElement from './dragelement' |
| | | import SourceElement from './dragelement/source' |
| | |
| | | actionloading: false, // 按钮加载中 |
| | | columnsloading: false, // 显示列加载中 |
| | | menuloading: false, // 菜单保存中 |
| | | menucloseloading: false, // 菜单关闭时,选择保存 |
| | | loading: false, // 加载中,页面spin |
| | | settingVisible: false, // 全局配置模态框 |
| | | closeVisible: false, // 关闭模态框 |
| | |
| | | originActions: _oriActions, |
| | | config: _config, |
| | | operaType: _type, |
| | | originMenu: JSON.parse(JSON.stringify({...menu})), |
| | | originMenu: JSON.parse(JSON.stringify(menu)), |
| | | selectedTables: _config.tables || [], |
| | | menuformlist: [ |
| | | { |
| | |
| | | }) |
| | | } |
| | | |
| | | handleList = (listObj) => { |
| | | let config = this.state.config |
| | | if (this.state.operaType === 'add') { |
| | | let key = Object.keys(listObj)[0] |
| | | let newlength = listObj[key].length |
| | | if (newlength > config[key].length) { |
| | | listObj[key] = listObj[key].filter(item => !item.origin) |
| | | } |
| | | if (newlength > listObj[key].length) { |
| | | handleList = (type, list, card) => { |
| | | const { config } = this.state |
| | | |
| | | if (list.length > config[type].length) { |
| | | list = list.filter(item => !item.origin) |
| | | |
| | | this.setState({ |
| | | [key + 'loading']: true, |
| | | config: {...config, ...listObj} |
| | | [type + 'loading']: true, |
| | | config: {...config, [type]: list } |
| | | }, () => { |
| | | // 刷新对应的配置信息 |
| | | this.setState({ |
| | | [key + 'loading']: false |
| | | [type + 'loading']: false |
| | | }) |
| | | }) |
| | | } else { |
| | | this.setState({config: {...config, ...listObj}}) |
| | | |
| | | if (type === 'search') { |
| | | this.handleSearch(card) |
| | | } else if (type === 'action') { |
| | | this.handleAction(card) |
| | | } else if (type === 'columns') { |
| | | this.handleColumn(card) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({config: {...config, ...listObj}}) |
| | | this.setState({config: {...config, [type]: list}}) |
| | | } |
| | | } |
| | | |
| | |
| | | text: this.state.dict['header.form.refresh.view'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'method', |
| | | label: this.state.dict['header.form.request.method'], |
| | | initVal: card.method || 'POST', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'POST', |
| | | text: 'POST' |
| | | }, { |
| | | MenuID: 'GET', |
| | | text: 'GET' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'method', |
| | | // label: this.state.dict['header.form.request.method'], |
| | | // initVal: card.method || 'POST', |
| | | // required: true, |
| | | // options: [{ |
| | | // MenuID: 'POST', |
| | | // text: 'POST' |
| | | // }, { |
| | | // MenuID: 'GET', |
| | | // text: 'GET' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'select', |
| | | key: 'icon', |
| | |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | type: 'text', |
| | | key: 'sql', |
| | | label: this.state.dict['header.form.datasource'], |
| | | initVal: card.sql || '', |
| | | initVal: card.sql || this.state.config.setting.tableName || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'sqlType', |
| | | label: this.state.dict['header.form.action.type'], |
| | | initVal: card.sqlType || 'insert', |
| | | required: false, |
| | | options: [{ |
| | | MenuID: 'insert', |
| | | text: this.state.dict['header.form.action.insert'] |
| | | }, { |
| | | MenuID: 'update', |
| | | text: this.state.dict['header.form.action.update'] |
| | | }, { |
| | | MenuID: 'LogicDelete', |
| | | text: this.state.dict['header.form.action.LogicDelete'] |
| | | }, { |
| | | MenuID: 'delete', |
| | | text: this.state.dict['header.form.action.delete'] |
| | | }] |
| | | } |
| | | ] |
| | | }) |
| | |
| | | }, { |
| | | MenuID: 'picture', |
| | | text: this.state.dict['header.form.picture'] |
| | | }, { |
| | | MenuID: 'number', |
| | | text: this.state.dict['header.form.number'] |
| | | }, { |
| | | MenuID: 'textarea', |
| | | text: this.state.dict['header.form.textarea'] |
| | | }] |
| | | }, |
| | | { |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: this.state.dict['header.form.IsSort'], |
| | | initVal: card.IsSort, |
| | |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: this.state.dict['header.form.columnWidth'], |
| | | initVal: card.Width, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | min: 0, |
| | | max: 18, |
| | | decimal: 0, |
| | | label: this.state.dict['header.form.decimal'], |
| | | initVal: card.decimal, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'format', |
| | | label: this.state.dict['header.form.format'], |
| | | initVal: card.format || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'thdSeparator', |
| | | text: this.state.dict['header.form.thdSeparator'] |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'prefix', |
| | | label: this.state.dict['header.form.prefix'], |
| | | initVal: card.prefix || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'match', |
| | | label: this.state.dict['header.form.match'], |
| | | initVal: card.match || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: '>', |
| | | text: '>' |
| | | }, { |
| | | MenuID: '<', |
| | | text: '<' |
| | | }, { |
| | | MenuID: '>=', |
| | | text: '>=' |
| | | }, { |
| | | MenuID: '<=', |
| | | text: '<=' |
| | | }, { |
| | | MenuID: 'between', |
| | | text: 'between' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'matchVal', |
| | | min: -Infinity, |
| | | max: Infinity, |
| | | decimal: 0, |
| | | label: this.state.dict['header.form.matchVal'], |
| | | initVal: card.matchVal || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'color', |
| | | label: this.state.dict['header.form.color'], |
| | | initVal: card.color || '', |
| | | options: [{ |
| | | MenuID: '', |
| | | text: this.state.dict['header.form.empty'] |
| | | }, { |
| | | MenuID: 'red', |
| | | text: '红色(内容)' |
| | | }, { |
| | | MenuID: 'redbg', |
| | | text: '红色(背景)' |
| | | }, { |
| | | MenuID: 'orange', |
| | | text: '橙色(内容)' |
| | | }, { |
| | | MenuID: 'orangebg', |
| | | text: '橙色(背景)' |
| | | }, { |
| | | MenuID: 'green', |
| | | text: '绿色(内容)' |
| | | }, { |
| | | MenuID: 'greenbg', |
| | | text: '绿色(背景)' |
| | | }], |
| | | required: false |
| | | } |
| | | ] |
| | | }) |
| | |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | PageParam: JSON.stringify(_pageParam), |
| | | LongParam: _LongParam |
| | | } |
| | | |
| | | if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态 |
| | | this.setState({ |
| | | menucloseloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | |
| | | this.submitAction(btnParam) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | this.props.handleConfig('') |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | menuloading: false, |
| | | menucloseloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | } |
| | | } |
| | | |
| | | onEnabledChange = () => { |
| | | const { config } = this.state |
| | | |
| | | this.setState({ |
| | | config: {...config, enabled: !config.enabled} |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const configAction = this.state.config.action.filter(_action => |
| | | !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') |
| | |
| | | <div className="setting"> |
| | | <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="关" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> |
| | |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | |
| | | height: 100%; |
| | | overflow-y: hidden; |
| | | background: #ffffff; |
| | | .ant-switch.big { |
| | | min-width: 60px; |
| | | height: 28px; |
| | | line-height: 28px; |
| | | margin-top: -2px; |
| | | .ant-switch-inner { |
| | | font-size: 14px; |
| | | } |
| | | } |
| | | .ant-switch.big::after { |
| | | width: 24px; |
| | | height: 24px; |
| | | } |
| | | .ant-card-head { |
| | | min-height: 44px; |
| | | } |
| | |
| | | class CommonTableBaseData { |
| | | baseConfig = { |
| | | type: 'system', |
| | | enabled: false, |
| | | setting: { |
| | | actionfixed: false, |
| | | columnfixed: false, |
| | |
| | | method: 'POST', |
| | | outerFunc: '', |
| | | sql: '', |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'notRequired', |
| | | position: 'toolbar', |
| | |
| | | method: 'POST', |
| | | outerFunc: '', |
| | | sql: '', |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'requiredSgl', |
| | | position: 'grid', |
| | |
| | | method: 'POST', |
| | | outerFunc: '', |
| | | sql: '', |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'required', |
| | | position: 'toolbar', |
| | |
| | | method: 'POST', |
| | | outerFunc: '', |
| | | sql: '', |
| | | sqlType: '', |
| | | callbackFunc: '', |
| | | Ot: 'requiredOnce', |
| | | position: 'toolbar', |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Icon, Select, DatePicker, Input } from 'antd' |
| | | import { Icon, Select, DatePicker, Input, InputNumber } from 'antd' |
| | | import moment from 'moment' |
| | | import ItemTypes from './itemtypes' |
| | | import './index.scss' |
| | |
| | | hover({ id: draggedId }) { |
| | | if (!draggedId) return |
| | | if (draggedId !== id) { |
| | | console.log(id) |
| | | const { index: overIndex } = findCard(id) |
| | | console.log(overIndex) |
| | | console.log(draggedId) |
| | | moveCard(draggedId, overIndex) |
| | | } |
| | | }, |
| | |
| | | closeCard(id) |
| | | } |
| | | |
| | | let selectval = '' |
| | | if (card.type === 'select' || card.type === 'link') { |
| | | if (card.initval) { |
| | | let _option = card.options.filter(option => option.Value === card.initval)[0] |
| | | if (_option) { |
| | | selectval = _option.Text || '' |
| | | } else { |
| | | selectval = '' |
| | | } |
| | | } else if (card.setAll === 'true') { |
| | | selectval = '全部' |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="page-card" style={{ opacity: opacity}}> |
| | | <div ref={node => drag(drop(node))}> |
| | |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> |
| | | } |
| | | {card.type === 'number' && |
| | | <Input style={{marginTop: '4px'}} defaultValue={card.initval} /> |
| | | <InputNumber defaultValue={card.initval} precision={card.decimal} /> |
| | | } |
| | | {(card.type === 'select' || card.type === 'link') && |
| | | <Select defaultValue={card.initval}></Select> |
| | | <Select defaultValue={selectval}></Select> |
| | | } |
| | | {card.type === 'date' && |
| | | <DatePicker defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD') : null} /> |
| | | <DatePicker defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} /> |
| | | } |
| | | {card.type === 'datemonth' ? |
| | | <MonthPicker defaultValue={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null |
| | | } |
| | | {card.type === 'datetime' && |
| | | <DatePicker showTime defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD HH:mm:ss') : null} /> |
| | | <DatePicker showTime defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} /> |
| | | // <DatePicker showTime defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD HH:mm:ss') : null} /> |
| | | } |
| | | <div className="input-mask"></div> |
| | | </div> |
| | |
| | | newcard.valueText = '' |
| | | newcard.orderBy = '' |
| | | newcard.orderType = 'asc' |
| | | newcard.readonly = 'false' |
| | | |
| | | // let indexes = cards.map(car => {return car.id}) |
| | | // let newid = 0 |
| | |
| | | setCards(_cards) |
| | | |
| | | if (!group) { |
| | | handleList(_cards) |
| | | handleList(_cards, null, null, newcard) |
| | | } else { |
| | | handleList(_cards, group) |
| | | handleList(_cards, group, null, newcard) |
| | | } |
| | | |
| | | target = null |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, InputNumber } from 'antd' |
| | | import TransferForm from '../transferform' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | | |
| | | class SettingForm extends Component { |
| | |
| | | let _default = config.groups[config.groups.length - 1] |
| | | let _selectds = [] |
| | | |
| | | if (config.groups.length === 1) { |
| | | if (!_default) { |
| | | _default = { |
| | | label: '未分组', |
| | | default: true, |
| | | sort: 101, |
| | | uuid: Utils.getuuid(), |
| | | sublist: [] |
| | | } |
| | | } |
| | | |
| | | if (config.groups.length === 0) { |
| | | _source = config.fields.filter(item => !item.origin) |
| | | } else { |
| | | _source = [..._default.sublist, ...group.sublist] |
| | |
| | | card: null, // 编辑元素 |
| | | loading: false, // 表单刷新时使用 |
| | | menuloading: false, // 菜单保存中 |
| | | closeloading: false, // 菜单保存中 |
| | | settingVisible: false, // 全局配置模态框 |
| | | closeVisible: false, // 关闭模态框 |
| | | tables: [], // 可用表名 |
| | | selectedTables: [], // 已选表名 |
| | | originMenu: null, // 原始菜单 |
| | | originConfig: null, // 原始菜单 |
| | | groupVisible: false, // 全局配置模态框 |
| | | curgroup: null // 当前组,新建或编辑 |
| | | } |
| | |
| | | const {menu, editAction} = this.props |
| | | |
| | | let _config = '' |
| | | |
| | | if (editAction.pageParam) { |
| | | _config = editAction.pageParam |
| | | } else { |
| | |
| | | this.setState({ |
| | | config: _config, |
| | | selectedTables: _config.tables || [], |
| | | originConfig: JSON.parse(JSON.stringify(_config)), |
| | | modalformlist: [ |
| | | { |
| | | type: 'text', |
| | |
| | | * @description 表单变化 |
| | | * 1、表单拖拽添加时,检查是否存在示例表单,如存在则去除示例 |
| | | * 2、表单移动后,保存移动后的顺序 |
| | | * 3、新增表单时,直接打开编辑框 |
| | | */ |
| | | handleList = (list, group, elementId) => { |
| | | handleList = (list, group, elementId, newcard) => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if (!group && !elementId) { |
| | | // 没有分组时(拖拽添加) |
| | | if (list.length > _config.fields.length) { |
| | | _config.fields = list.filter(item => !item.origin) |
| | | |
| | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | this.handleForm(newcard) |
| | | }) |
| | | } else { |
| | | _config.fields = list |
| | | this.setState({config: _config}) |
| | | } |
| | | } else if (group && !elementId) { |
| | | // 存在分组时,拖拽添加 |
| | | if (list.length > group.sublist.length) { |
| | | group.sublist = list |
| | | _config.groups = _config.groups.map(item => { |
| | |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | this.handleForm(newcard) |
| | | }) |
| | | } else { |
| | | group.sublist = list |
| | |
| | | this.setState({config: _config}) |
| | | } |
| | | } else if (group && elementId) { |
| | | // 修改已有元素的分组 |
| | | let element = null |
| | | _config.groups.forEach(item => { |
| | | item.sublist = item.sublist.filter(cell => { |
| | |
| | | |
| | | /** |
| | | * @description 表单编辑 |
| | | * 1、显示编辑弹窗 |
| | | * 2、保存编辑项 |
| | | * 3、设置编辑参数项 |
| | | * 1、显示编辑弹窗-visible |
| | | * 2、保存编辑项-card |
| | | * 3、设置编辑参数项-formlist |
| | | */ |
| | | handleForm = (card) => { |
| | | this.setState({ |
| | |
| | | value: 'text', |
| | | text: this.state.dict['header.form.text'] |
| | | }, { |
| | | value: 'number', |
| | | text: this.state.dict['header.form.number'] |
| | | }, { |
| | | value: 'select', |
| | | text: this.state.dict['header.form.select'] |
| | | }, { |
| | |
| | | value: 'date', |
| | | text: this.state.dict['header.form.dateday'] |
| | | }, { |
| | | value: 'dateweek', |
| | | text: this.state.dict['header.form.dateweek'] |
| | | }, { |
| | | value: 'datemonth', |
| | | text: this.state.dict['header.form.datemonth'] |
| | | }, { |
| | | value: 'daterange', |
| | | text: this.state.dict['header.form.daterange'] |
| | | value: 'datetime', |
| | | text: this.state.dict['header.form.datetime'] |
| | | }] |
| | | }, |
| | | { |
| | |
| | | value: 'desc', |
| | | text: this.state.dict['header.form.desc'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | label: this.state.dict['header.form.decimal'], |
| | | initVal: card.decimal || 0, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'readonly', |
| | | label: this.state.dict['header.form.readonly'], |
| | | initVal: card.readonly || 'false', |
| | | options: [{ |
| | | value: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | value: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | } |
| | | ] |
| | | }) |
| | |
| | | handleSubmit = () => { |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') { |
| | | let sql = 'select ' + res.valueField + ',' + res.valueText + ' from (' + res.dataSource + ')' |
| | | if (res.orderBy) { |
| | | sql = sql + ' ld order by ' + res.orderBy + ' ' + res.orderType |
| | | } |
| | | res.dataSourceSql = Utils.formatOptions(sql) |
| | | } |
| | | |
| | | _config.fields = _config.fields.map(item => { |
| | | if (item.uuid === res.uuid) { |
| | |
| | | } |
| | | |
| | | submitConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | const { menu, editAction } = this.props |
| | | const { config } = this.state |
| | | |
| | | if (!config.fields[0] && config.fields[0].origin) { |
| | | if ((!config.groups[0] && !config.fields[0]) || (config.fields[0] && config.fields[0].origin)) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请添加表单', |
| | |
| | | |
| | | let _LongParam = '' |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | |
| | | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: res.parentId, |
| | | MenuID: menu.MenuID, |
| | | MenuNo: res.menuNo, |
| | | Template: menu.PageParam.Template || '', |
| | | MenuName: res.menuName, |
| | | PageParam: JSON.stringify(_pageParam), |
| | | ParentID: menu.MenuID, |
| | | MenuID: editAction.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: 'Modal', |
| | | MenuName: editAction.label, |
| | | PageParam: JSON.stringify({Template: 'Modal'}), |
| | | LongParam: _LongParam |
| | | } |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | | top: 92, |
| | | message: response.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // let param = { |
| | | // func: 'sPC_TrdMenu_Upt', |
| | | // ParentID: res.parentId, |
| | | // MenuID: menu.MenuID, |
| | | // MenuNo: res.menuNo, |
| | | // Template: menu.PageParam.Template || '', |
| | | // MenuName: res.menuName, |
| | | // PageParam: JSON.stringify(_pageParam), |
| | | // LongParam: _LongParam |
| | | // } |
| | | this.setState({ |
| | | menuloading: true |
| | | }) |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | this.setState({ |
| | | closeloading: true |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | | originMenu: { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | menuloading: true |
| | | }) |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(response => { |
| | | if (response.status) { |
| | | this.setState({ |
| | | menuloading: false, |
| | | closeloading: false, |
| | | originConfig: _config, |
| | | config: _config |
| | | }) |
| | | notification.success({ |
| | | top: 92, |
| | | message: '保存成功', |
| | | duration: 10 |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | closeloading: false, |
| | | menuloading: false |
| | | }) |
| | | notification.warning({ |
| | |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }, () => { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: this.state.dict['header.menu.basemsg'], |
| | | duration: 10 |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | | const { menu } = this.props |
| | | const { config, originMenu } = this.state |
| | | const { config, originConfig } = this.state |
| | | let _this = this |
| | | |
| | | let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | | if (isOrigin) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | content: '尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig('') |
| | | _this.props.handleConfig(menu.type) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | let _config = {...config, tables: this.state.selectedTables} |
| | | let _pageParam = {...menu.PageParam, OpenType: res.opentype} |
| | | let _originMenu = { |
| | | ...originMenu, |
| | | LongParam: _config, |
| | | PageParam: _pageParam, |
| | | MenuName: res.menuName, |
| | | MenuNo: res.menuNo, |
| | | ParentID: res.parentId |
| | | } |
| | | |
| | | if (!is(fromJS(originMenu), fromJS(_originMenu))) { |
| | | if (!is(fromJS(config), fromJS(originConfig))) { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig('') |
| | | this.props.handleConfig(menu.type) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | | closeVisible: true |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | readonly: 'false' |
| | | } |
| | | }) |
| | | _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems] |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | readonly: 'false' |
| | | } |
| | | |
| | | items.push(newcard) |
| | |
| | | const {selectedTables, tableColumns} = this.state |
| | | |
| | | this.setState({ |
| | | selectedTables: selectedTables.filter(item => item.name !== table.name), |
| | | tableColumns: tableColumns.filter(item => item.tableName !== table.name) |
| | | selectedTables: selectedTables.filter(item => item.TbName !== table.TbName), |
| | | tableColumns: tableColumns.filter(item => item.tableName !== table.TbName) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | if (_length === 1) { |
| | | _config.fields = [...group.sublist, ..._config.groups[0].sublist] |
| | | _config.groups[0].sublist = [] |
| | | _config.groups = [] |
| | | } else { |
| | | _config.groups[_length - 1].sublist = [...group.sublist, ..._config.groups[_length - 1].sublist] |
| | | } |
| | |
| | | if (_group.isnew) { |
| | | delete _group.isnew |
| | | config.groups.unshift(_group) |
| | | |
| | | if (config.groups.length > 1) { |
| | | config.groups = config.groups.map(item => { |
| | | if (item.default) { |
| | | return res.default |
| | |
| | | return item |
| | | } |
| | | }) |
| | | } else { |
| | | config.groups.push(res.default) |
| | | } |
| | | } else { |
| | | config.groups = config.groups.map(item => { |
| | | if (item.uuid === _group.uuid) { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { menu } = this.props |
| | | const { config } = this.state |
| | | |
| | | return ( |
| | |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | | formlist={this.state.modalformlist} |
| | | wrappedComponentRef={(inst) => this.menuformRef = inst} |
| | | /> |
| | | <div className="ant-col ant-form-item-label"> |
| | | <label title={this.state.dict['header.menu.table.add']}> |
| | |
| | | </div> |
| | | <div className="ant-modal-body"> |
| | | <div className="modal-form"> |
| | | {!this.state.loading && config.groups.length > 1 && |
| | | {!this.state.loading && config.groups.length > 0 && |
| | | config.groups.map(group => { |
| | | return ( |
| | | <div key={group.uuid}> |
| | |
| | | ) |
| | | }) |
| | | } |
| | | {!this.state.loading && config.groups.length === 1? |
| | | {!this.state.loading && config.groups.length === 0 ? |
| | | <DragElement |
| | | list={config.fields} |
| | | setting={config.setting} |
| | |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig(menu.type)}}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | | destroyOnClose |
| | |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | margin-top: 4px; |
| | | } |
| | | .input-mask { |
| | | position: absolute; |
| | | top: 0; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd' |
| | | import EditTable from '../editable' |
| | | import './index.scss' |
| | | |
| | |
| | | formlist: null, |
| | | dateoptions: { |
| | | date: [{value: '', text: '空'}, {value: '0', text: '当天'}, {value: 1, text: '前一天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | dateweek: [{value: '', text: '空'}, {value: '0', text: '本周'}, {value: 1, text: '上周'}, {value: 3, text: '前三周'}, {value: 7, text: '前七周'}], |
| | | datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 7, text: '前七月'}], |
| | | daterange: [{value: '', text: '空'}, {value: '0', text: '今天'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 6, text: '前六月'}], |
| | | datetime: [{value: '', text: '空'}, {value: '0', text: '现在'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}], |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let formlist = JSON.parse(JSON.stringify(this.props.formlist)) |
| | | |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly'] // 默认显示项 |
| | | |
| | | if ((type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options'] |
| | | } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } else if (type === 'number') { |
| | | _options = [..._options, 'decimal'] |
| | | } |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: type, |
| | | resourceType: resourceType, |
| | | formlist: formlist.map(form => { |
| | | if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') { |
| | | form.options = this.state.dateoptions[type] |
| | | form.type = 'select' |
| | | } else if (type === 'number' && form.key === 'initval') { |
| | | form.type = 'number' |
| | | form.initVal = 0 |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = ['label', 'field', 'initval', 'type'] |
| | | if (value === 'select' || value === 'link') { // 切换类型为选择或关联时,来源默认为自定义 |
| | | let _options = ['label', 'field', 'initval', 'type', 'readonly'] |
| | | |
| | | if ((value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options'] |
| | | } else if ((value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } else if (value === 'number') { |
| | | _options = [..._options, 'decimal'] |
| | | } |
| | | |
| | | if (value === 'link') { |
| | |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | | resourceType: '0', |
| | | formlist: this.state.formlist.map(form => { |
| | | form.hidden = !_options.includes(form.key) |
| | | if (form.key === 'initval') { |
| | | if (this.state.dateoptions.hasOwnProperty(value)) { |
| | | form.options = this.state.dateoptions[value] |
| | | form.type = 'select' |
| | | form.initVal = '' |
| | | } else if (value === 'number') { |
| | | form.type = 'number' |
| | | form.initVal = 0 |
| | | } else { |
| | | form.type = 'text' |
| | | } |
| | | form.initVal = '' |
| | | } |
| | | form.hidden = true |
| | | } |
| | | return form |
| | |
| | | const { openType } = this.state |
| | | let value = e.target.value |
| | | if (key === 'resourceType') { |
| | | let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'setAll'] |
| | | let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'setAll', 'readonly'] |
| | | if (value === '0') { |
| | | _options = [..._options, 'options'] |
| | | } else if (value === '1') { |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'number') { |
| | | if (item.key === 'decimal') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || 0, |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={0} max={18} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || 0, |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.openTypeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('commontable-search-form-box')} |
| | | getPopupContainer={() => document.getElementById('modal-fields-form-box')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.value} title={option.text} key={option.value} value={option.value}> |
| | |
| | | }) |
| | | } |
| | | |
| | | resetForm = (formlist) => { |
| | | if (!formlist) return |
| | | let type = formlist.filter(cell => cell.key === 'type')[0].initVal |
| | | let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal |
| | | let _options = ['label', 'field', 'initval', 'type'] // 默认显示项 |
| | | if ((type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'options'] |
| | | } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源 |
| | | _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType'] |
| | | } |
| | | |
| | | if (type === 'link') { // 关联类型、增加关联字段 |
| | | _options = [..._options, 'linkField'] |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: type, |
| | | resourceType: resourceType, |
| | | formlist: formlist.map(form => { |
| | | if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') { |
| | | form.options = this.state.dateoptions[type] |
| | | form.type = 'select' |
| | | } |
| | | form.hidden = !_options.includes(form.key) |
| | | return form |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.resetForm(this.props.formlist) |
| | | } |
| | | |
| | | render() { |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-search-form" id="commontable-search-form-box"> |
| | | <Form {...formItemLayout} className="ant-advanced-search-form modal-fields-form" id="modal-fields-form-box"> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |
| | |
| | | .ant-advanced-search-form.commontable-search-form { |
| | | .ant-advanced-search-form.modal-fields-form { |
| | | min-height: 180px; |
| | | .ant-col-offset-4 { |
| | | padding-left: 6px!important; |
| | |
| | | width: 100%; |
| | | } |
| | | } |
| | | .ant-input-number { |
| | | width: 100%; |
| | | } |
| | | } |
| | |
| | | |
| | | class CommonTableBaseData { |
| | | baseConfig = { |
| | | type: 'modal', |
| | | type: 'Modal', |
| | | setting: { |
| | | title: '', |
| | | width: 60, |
| | | cols: '2' |
| | | }, |
| | | tables: [], |
| | | groups: [{ |
| | | label: '未分组', |
| | | default: true, |
| | | sort: 101, |
| | | uuid: Utils.getuuid(), |
| | | sublist: [] |
| | | }], |
| | | groups: [], |
| | | fields: [ |
| | | { |
| | | origin: true, |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: 'text', |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'text', |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | display: 'dropdown' |
| | | readonly: 'false' |
| | | }, { |
| | | origin: true, |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: 'select', |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'select', |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | display: 'dropdown' |
| | | readonly: 'false' |
| | | }, { |
| | | origin: true, |
| | | id: Utils.getuuid(), |
| | | uuid: Utils.getuuid(), |
| | | label: 'date', |
| | | label: 'label', |
| | | field: '', |
| | | initval: '', |
| | | type: 'date', |
| | |
| | | valueText: '', |
| | | orderBy: '', |
| | | orderType: 'asc', |
| | | display: 'dropdown' |
| | | readonly: 'false' |
| | | } |
| | | ] |
| | | } |