| | |
| | | { |
| | | "appId": "202109161556242376DEC38C96FFF414E8DEF", |
| | | "appkey": "20210916155606327FB54C811DE824AFEB22C", |
| | | "appId": "201912040924165801464FF1788654BC5AC73", |
| | | "appkey": "20191106103859640976D6E924E464D029CF0", |
| | | "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", |
| | | "systemType": "", |
| | | "externalDatabase": "", |
| | | "externalDatabase": "false", |
| | | "lineColor": "", |
| | | "filter": "false", |
| | | "defaultApp": "mk", |
| | |
| | | "licenseKey": "", |
| | | "probation": "", |
| | | "keepPassword": "true", |
| | | "host": "http://demo.mk9h.cn", |
| | | "service": "kalai_mes/" |
| | | "host": "http://qingqiumarket.cn", |
| | | "service": "MKWMS/" |
| | | } |
| | |
| | | * @description 获取图表视图配置表单 |
| | | * @param {object} card // 图表对象 |
| | | */ |
| | | export function getBaseForm (card) { |
| | | export function getBaseForm (card, columns = []) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let menulist = [] |
| | | |
| | | if (appType === 'pc') { |
| | | menulist = sessionStorage.getItem('appMenus') |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch (e) { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | } else if (appType === '') { |
| | | menulist = sessionStorage.getItem('fstMenuList') |
| | | if (menulist) { |
| | | try { |
| | | menulist = JSON.parse(menulist) |
| | | } catch (e) { |
| | | menulist = [] |
| | | } |
| | | } else { |
| | | menulist = [] |
| | | } |
| | | } |
| | | |
| | | return [ |
| | |
| | | options: roleList, |
| | | forbid: !!appType |
| | | }, |
| | | // { |
| | | // type: 'cascader', |
| | | // key: 'linkmenu', |
| | | // label: '关联菜单', |
| | | // initVal: card.linkmenu || [], |
| | | // tooltip: '在使用柱形图且未启用自定义设置时有效。', |
| | | // required: false, |
| | | // forbid: appType === 'pc' || appType === 'mob', |
| | | // options: menulist |
| | | // }, |
| | | // { |
| | | // type: 'select', |
| | | // key: 'linkmenu', |
| | | // label: '关联菜单', |
| | | // initVal: card.linkmenu || '', |
| | | // tooltip: '双击柱状图,会打开关联的菜单。', |
| | | // required: false, |
| | | // forbid: appType !== 'pc', |
| | | // options: menulist |
| | | // }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'open', |
| | | // label: '打开方式', |
| | | // initVal: card.open || 'blank', |
| | | // required: false, |
| | | // forbid: appType !== 'pc', |
| | | // options: [ |
| | | // { value: 'blank', text: '新窗口' }, |
| | | // { value: 'self', text: '当前窗口' } |
| | | // ] |
| | | // } |
| | | { |
| | | type: 'radio', |
| | | key: 'click', |
| | | label: '点击事件', |
| | | initVal: card.click || '', |
| | | tooltip: '当绑定点击事件时,柱形图的切换功能将失效。', |
| | | required: false, |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | options: [ |
| | | {value: '', label: '无'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'menus', label: '菜单组'} |
| | | ] |
| | | }, |
| | | { |
| | | type: appType === '' ? 'cascader' : 'select', |
| | | key: 'menu', |
| | | label: '关联菜单', |
| | | initVal: card.menu || (appType === '' ? [] : ''), |
| | | tooltip: '在使用柱形图且未启用自定义设置时有效。', |
| | | required: true, |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menu', |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'menuType', |
| | | label: '菜单类型', |
| | | initVal: card.menuType || '', |
| | | required: true, |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menus', |
| | | options: columns, |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'open', |
| | | label: '打开方式', |
| | | initVal: card.open || 'blank', |
| | | required: false, |
| | | options: [ |
| | | {value: 'blank', label: '新窗口'}, |
| | | {value: 'self', label: '当前窗口'}, |
| | | ], |
| | | forbid: appType !== 'pc' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menu' && card.click !== 'menus' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '参数拼接', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menu' && card.click !== 'menus' |
| | | }, |
| | | { |
| | | type: 'table', |
| | | key: 'menus', |
| | | label: '菜单组', |
| | | initVal: card.menus || [], |
| | | required: true, |
| | | span: 24, |
| | | actions: ['view'], |
| | | forbid: appType === 'mob' || card.chartType !== 'bar', |
| | | hidden: card.click !== 'menus', |
| | | columns: [ |
| | | { |
| | | title: '标识', |
| | | dataIndex: 'sign', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | required: false, |
| | | width: '35%' |
| | | }, |
| | | { |
| | | title: '菜单', |
| | | dataIndex: 'menu', |
| | | inputType: !appType ? 'cascader' : 'select', |
| | | editable: true, |
| | | required: true, |
| | | extends: !appType ? 'Menu' : [{key: 'label', value: 'label'}], |
| | | width: '35%', |
| | | render: (text, record) => record.label, |
| | | options: menulist |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | |
| | |
| | | }, { |
| | | type: labelOptions.length > 20 ? 'select' : 'radio', |
| | | key: 'label', |
| | | label: '标签', |
| | | label: '标注', |
| | | initVal: card.label || 'false', |
| | | tooltip: '图形节点处的数值。', |
| | | required: false, |
| | | options: labelOptions |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelColor', |
| | | label: '标签颜色', |
| | | label: '标注颜色', |
| | | initVal: card.labelColor || 'system', |
| | | tooltip: '使用系统色时,使用色系选项设置的系统颜色,使用自定义为颜色设置中定义的图形颜色。', |
| | | required: false, |
| | |
| | | datatype: config.plot.datatype || 'query', |
| | | fieldName: fieldName, |
| | | plot: fromJS(config.plot).toJS(), |
| | | baseFormlist: getBaseForm(config.plot), |
| | | baseFormlist: getBaseForm(config.plot, config.columns), |
| | | formlist: getOptionForm(config.plot, config.columns) |
| | | }) |
| | | } |
| | |
| | | this.baseRef.handleConfirm().then(res => { |
| | | let _plot = {...plot, ...res} |
| | | |
| | | if (res.click === 'menu') { |
| | | delete _plot.menus |
| | | } else if (res.click === 'menus') { |
| | | delete _plot.menu |
| | | } else { |
| | | delete _plot.menus |
| | | delete _plot.menu |
| | | } |
| | | |
| | | delete _plot.MenuID |
| | | delete _plot.MenuName |
| | | delete _plot.MenuNo |
| | | delete _plot.tabType |
| | | |
| | | if (_plot.click === 'menu' && sessionStorage.getItem('appType') === '' && _plot.menu) { |
| | | let list = null |
| | | try { |
| | | list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] |
| | | } catch (e) { |
| | | list = [] |
| | | } |
| | | |
| | | let id = _plot.menu[_plot.menu.length - 1] |
| | | |
| | | list.forEach(item => { |
| | | if (item.MenuID === id) { |
| | | _plot.MenuID = id |
| | | _plot.MenuName = item.MenuName |
| | | _plot.MenuNo = item.MenuNo |
| | | _plot.tabType = item.type |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | plot: _plot, |
| | | visible: false |
| | |
| | | }) |
| | | } else if (view === 'base') { |
| | | this.baseRef.handleConfirm().then(res => { |
| | | let _plot = {...plot, ...res} |
| | | |
| | | if (res.click === 'menu') { |
| | | delete _plot.menus |
| | | } else if (res.click === 'menus') { |
| | | delete _plot.menu |
| | | } else { |
| | | delete _plot.menus |
| | | delete _plot.menu |
| | | } |
| | | |
| | | delete _plot.MenuID |
| | | delete _plot.MenuName |
| | | delete _plot.MenuNo |
| | | delete _plot.tabType |
| | | |
| | | if (_plot.click === 'menu' && sessionStorage.getItem('appType') === '' && _plot.menu) { |
| | | let list = null |
| | | try { |
| | | list = JSON.parse(sessionStorage.getItem('thdMenuList')) || [] |
| | | } catch (e) { |
| | | list = [] |
| | | } |
| | | |
| | | let id = _plot.menu[_plot.menu.length - 1] |
| | | |
| | | list.forEach(item => { |
| | | if (item.MenuID === id) { |
| | | _plot.MenuID = id |
| | | _plot.MenuName = item.MenuName |
| | | _plot.MenuNo = item.MenuNo |
| | | _plot.tabType = item.type |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | plot: {...plot, ...res}, |
| | | plot: _plot, |
| | | view: tab |
| | | }) |
| | | }) |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Tooltip, InputNumber, Select, Radio, Cascader } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | // import './index.scss' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) |
| | | |
| | | class SettingForm extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.array, // 表单 |
| | | inputSubmit: PropTypes.func // 回车事件 |
| | | } |
| | | |
| | | state = { |
| | | formlist: [], |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { formlist } = this.props |
| | | |
| | | this.setState({formlist: fromJS(formlist).toJS()}) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | } |
| | | } |
| | | |
| | | getFields() { |
| | | const { formlist } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | optionChange = (item, val) => { |
| | | if (item.key === 'click') { |
| | | this.setState({formlist: fromJS(this.state.formlist).toJS().map(cell => { |
| | | if (!['menu', 'menuType', 'open', 'joint', 'menus'].includes(cell.key)) return cell |
| | | |
| | | if (val === 'menu') { |
| | | cell.hidden = !['menu', 'open', 'joint'].includes(cell.key) |
| | | } else if (val === 'menus') { |
| | | cell.hidden = !['menuType', 'open', 'joint', 'menus'].includes(cell.key) |
| | | } else { |
| | | cell.hidden = true |
| | | } |
| | | |
| | | if (!formlist) return [] |
| | | return cell |
| | | })}) |
| | | } |
| | | } |
| | | |
| | | getFields() { |
| | | const { formlist } = this.state |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | const fields = [] |
| | | |
| | | formlist.forEach((item, index) => { |
| | | if (item.hidden || item.forbid) return |
| | | |
| | | |
| | | let content = null |
| | | let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><QuestionCircleOutlined className="mk-form-tip" />{item.label}</Tooltip> : item.label |
| | | |
| | | if (item.type === 'text') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | content = (<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit}/>) |
| | | } else if (item.type === 'number') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select mode={item.multi ? 'multiple' : ''}> |
| | | {item.options.map((option, index) => |
| | | <Select.Option key={index} value={option.field || option.value}> |
| | | {option.label || option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | content = (<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>) |
| | | } else if (item.type === 'select') { |
| | | content = (<Select mode={item.multi ? 'multiple' : ''}> |
| | | {item.options.map((option, index) => |
| | | <Select.Option key={index} value={option.field || option.value}> |
| | | {option.label || option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select>) |
| | | } else if (item.type === 'radio') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Radio.Group disabled={item.readonly}> |
| | | {item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.value} value={option.value}>{option.text}</Radio> |
| | | ) |
| | | })} |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | content = (<Radio.Group onChange={(e) => this.optionChange(item, e.target.value)}> |
| | | {item.options.map(option => { |
| | | return ( |
| | | <Radio key={option.value} value={option.field || option.value}>{option.label || option.text}</Radio> |
| | | ) |
| | | })} |
| | | </Radio.Group>) |
| | | } else if (item.type === 'cascader') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || [], |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <Cascader options={item.options} placeholder=""/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | content = (<Cascader options={item.options} placeholder=""/>) |
| | | } else if (item.type === 'table') { |
| | | content = (<MKTable columns={item.columns || []} actions={item.actions || []}/>) |
| | | } |
| | | |
| | | if (!content) return |
| | | |
| | | fields.push( |
| | | <Col span={item.span || 12} key={index}> |
| | | <Form.Item label={label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: (item.type === 'select' || item.type === 'cascader' ? '请选择' : '请输入') + item.label + '!' |
| | | } |
| | | ] |
| | | })(content)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | }) |
| | | |
| | | return fields |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div> |
| | | <div className="plot-base-wrap"> |
| | | <Form {...formItemLayout}><Row gutter={16}>{this.getFields()}</Row></Form> |
| | | </div> |
| | | ) |
| | |
| | | .plot-base-wrap { |
| | | .ant-col-24 { |
| | | .ant-form-item-label { |
| | | width: 16.5%; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | width: 83.5%; |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | }) |
| | | } |
| | | console.log(vFields) |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | |
| | | |
| | | chart.on('element:click', (ev) => { |
| | | let data = ev.data.data |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) |
| | | |
| | | if (plot.click === 'menus') { |
| | | let menu = null |
| | | |
| | | if (plot.menus && plot.menus.length > 0) { |
| | | let s = data[plot.menuType] || '' |
| | | plot.menus.forEach(m => { |
| | | if (s !== m.sign) return |
| | | menu = m |
| | | }) |
| | | } |
| | | if (!menu || !menu.MenuID) return |
| | | |
| | | menu.type = menu.tabType |
| | | |
| | | let newtab = { |
| | | ...menu, |
| | | param: {} |
| | | } |
| | | |
| | | if (plot.joint === 'true') { |
| | | newtab.param.$BID = data.$$uuid || '' |
| | | } |
| | | |
| | | if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { |
| | | MKEmitter.emit('modifyTabs', newtab, 'replace') |
| | | } else { |
| | | MKEmitter.emit('modifyTabs', newtab, 'plus', true) |
| | | } |
| | | } else if (plot.click === 'menu' && plot.MenuID) { |
| | | let menu = { |
| | | MenuID: plot.MenuID, |
| | | MenuName: plot.MenuName, |
| | | MenuNo: plot.MenuNo, |
| | | type: plot.tabType |
| | | } |
| | | |
| | | let newtab = { |
| | | ...menu, |
| | | param: {} |
| | | } |
| | | |
| | | if (plot.joint === 'true') { |
| | | newtab.param.$BID = data.$$uuid || '' |
| | | } |
| | | |
| | | if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { |
| | | MKEmitter.emit('modifyTabs', newtab, 'replace') |
| | | } else { |
| | | MKEmitter.emit('modifyTabs', newtab, 'plus', true) |
| | | } |
| | | } |
| | | }) |
| | | |
| | | if (plot.interaction && plot.interaction.length) { |