Merge branch 'master' into positec
| | |
| | | clearTimeout(timer) |
| | | if (/Shared Memory Provider|会话处于终止状态|当前命令发生了严重错误/.test(res.message)) { |
| | | res.message = '验证失败,请检查SQL中是否存在死循环。' |
| | | } else if (res.message.indexOf('EXECUTE 后的事务计数指示 BEGIN 和 COMMIT 语句的数目不匹配。上一计数 = 1,当前计数 = 0') > -1) { |
| | | res.ErrCode = '-2' |
| | | } |
| | | resolve(res) |
| | | }, () => { |
| | |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | .ant-notification .ant-notification-notice-message { |
| | | word-break: break-all; |
| | | } |
| | | |
| | | // 重置提示框 |
| | | .ant-tooltip { |
| | |
| | | } |
| | | } |
| | | |
| | | // 消息提示 |
| | | .ant-notification-notice.notification-custom-error { |
| | | background: #f5222d; |
| | | .anticon.ant-notification-notice-icon-error { |
| | | color: #ffffff; |
| | | } |
| | | .ant-notification-notice-message { |
| | | color: #ffffff; |
| | | } |
| | | .ant-notification-close-icon { |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | .ant-notification .ant-notification-notice-message { |
| | | word-break: break-all; |
| | | } |
| | | |
| | | .ant-modal-wrap.popview-modal { |
| | | .ant-modal { |
| | | top: 70px; |
| | |
| | | {field: 'broadcast', values: ['dynamic', 'public']}, |
| | | {field: 'supModule', values: ['static']}, |
| | | {field: 'publicId', values: ['public']}, |
| | | {field: 'emptyExec', values: ['dynamic', 'public']}, |
| | | ], |
| | | forbid: subtype !== 'propcard' |
| | | }, |
| | |
| | | {field: 'checkAll', values: ['checkbox']}, |
| | | {field: 'selected', values: ['radio', 'checkbox']}, |
| | | {field: 'selStyle', values: ['radio', 'checkbox']}, |
| | | // {field: 'priKeyType', values: ['radio', 'checkbox']}, |
| | | {field: 'pickup', values: ['radio', 'checkbox']}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | |
| | | {value: 'right', label: '右对齐'}, |
| | | ], |
| | | forbid: subtype === 'tablecard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'pickup', |
| | | label: '收起开关', |
| | | initval: wrap.pickup || 'false', |
| | | tooltip: '数据卡右上角会显示收起开关。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: subtype !== 'datacard' || appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | tooltip: '数据更新时自动执行按钮。注:此按钮执行成功后谨慎选择刷新项,避免造成循环执行。', |
| | | required: false, |
| | | options: buttons, |
| | | forbid: subtype !== 'propcard' |
| | | forbid: subtype !== 'propcard', |
| | | controlFields: [ |
| | | {field: 'emptyExec', notNull: true}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'emptyExec', |
| | | label: '空值执行', |
| | | initval: wrap.emptyExec || 'true', |
| | | tooltip: '当查询数据为空时,自动执行按钮是否执行。', |
| | | required: false, |
| | | forbid: subtype !== 'propcard', |
| | | options: [ |
| | | {value: 'true', label: '是'}, |
| | | {value: 'false', label: '否'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | controlFields: [ |
| | | {field: 'selected', values: ['radio', 'checkbox']}, |
| | | {field: 'selStyle', values: ['radio', 'checkbox']}, |
| | | {field: 'pickup', values: ['radio', 'checkbox']}, |
| | | ], |
| | | }, |
| | | { |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'pickup', |
| | | label: '收起开关', |
| | | initval: wrap.pickup || 'false', |
| | | tooltip: '数据卡右上角会显示收起开关。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | forbid: appType === 'mob' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'parity', |
| | | label: '奇偶背景', |
| | | initval: wrap.parity || 'false', |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Modal, notification, Popconfirm } from 'antd' |
| | | import { ApartmentOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import MarkForm from './markform' |
| | | import './index.scss' |
| | | |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | const { confirm } = Modal |
| | | |
| | | class ColsControl extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | onSubmit: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | searches: [], |
| | | visible: false, |
| | | colsCtrls: [], |
| | | cols: [], |
| | | svalues: {}, |
| | | cvalues: {}, |
| | | columns: [ |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | width: '18%' |
| | | }, |
| | | { |
| | | title: '对比方式', |
| | | dataIndex: 'match', |
| | | width: '18%', |
| | | }, |
| | | { |
| | | title: '对比值', |
| | | dataIndex: 'contrastValue', |
| | | width: '18%', |
| | | }, |
| | | { |
| | | title: '显示列', |
| | | dataIndex: 'cols', |
| | | width: '24%', |
| | | render: text => { |
| | | return text.length |
| | | } |
| | | }, |
| | | { |
| | | title: '操作', |
| | | align: 'center', |
| | | width: '18%', |
| | | dataIndex: 'operation', |
| | | render: (text, record) => |
| | | (<div style={{textAlign: 'center', cursor: 'default'}}> |
| | | <span title="编辑" onClick={() => this.handleEdit(record)} style={{color: '#1890ff', marginRight: '15px', cursor: 'pointer'}}><EditOutlined /></span> |
| | | <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title="确定删除吗?" |
| | | onConfirm={() => this.handleDelete(record) |
| | | }> |
| | | <span style={{color: '#ff4d4f', cursor: 'pointer'}}><DeleteOutlined /></span> |
| | | </Popconfirm> |
| | | </div>) |
| | | } |
| | | ] |
| | | } |
| | | |
| | | handleEdit = (record) => { |
| | | this.customForm.edit(record) |
| | | } |
| | | |
| | | markChange = (values) => { |
| | | let colsCtrls = fromJS(this.state.colsCtrls).toJS() |
| | | |
| | | let has = false |
| | | |
| | | if (!values.uuid) { |
| | | colsCtrls.forEach(item => { |
| | | if (item.field.join('') === values.field.join('') && item.match === values.match && item.contrastValue === values.contrastValue) { |
| | | has = true |
| | | } |
| | | }) |
| | | |
| | | values.uuid = Utils.getuuid() |
| | | colsCtrls.push(values) |
| | | } else { |
| | | colsCtrls = colsCtrls.map(item => { |
| | | if (values.uuid === item.uuid) { |
| | | return values |
| | | } |
| | | |
| | | if (item.field.join('') === values.field.join('') && item.match === values.match && item.contrastValue === values.contrastValue) { |
| | | has = true |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (has) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '此设置已存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | colsCtrls: colsCtrls |
| | | }) |
| | | } |
| | | |
| | | handleDelete = (record) => { |
| | | const { colsCtrls } = this.state |
| | | |
| | | this.setState({ colsCtrls: colsCtrls.filter(item => item.uuid !== record.uuid) }) |
| | | } |
| | | |
| | | resetMark = () => { |
| | | const { config } = this.props |
| | | const { columns } = this.state |
| | | |
| | | let search = config.search || [] |
| | | |
| | | if (config.setting.useMSearch === 'true') { // 使用主搜索条件 |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | |
| | | let filterComponent = (box, mainSearch) => { |
| | | box.components.forEach(item => { |
| | | if (item.type !== 'search') return |
| | | mainSearch = item.search |
| | | }) |
| | | let has = false |
| | | box.components.forEach(item => { |
| | | if (item.uuid === config.uuid) { |
| | | has = true |
| | | } else if (item.type === 'group') { |
| | | item.components.forEach(m => { |
| | | if (m.uuid !== config.uuid) return |
| | | has = true |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (has) { |
| | | search = [...search, ...(mainSearch || [])] |
| | | } else { |
| | | box.components.forEach(item => { |
| | | if (item.type !== 'tabs') return |
| | | |
| | | item.subtabs.forEach(tab => { |
| | | filterComponent(tab, mainSearch) |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | filterComponent(menu, null) |
| | | } |
| | | |
| | | let cvalues = {} |
| | | let cols = config.cols.map(item => { |
| | | let types = {custom: '自定义列', colspan: '合并列'} |
| | | let label = types[item.type] ? `${item.label}(${types[item.type]})` : item.label |
| | | |
| | | cvalues[item.uuid] = label |
| | | |
| | | return { |
| | | key: item.uuid, |
| | | title: label |
| | | } |
| | | }) |
| | | |
| | | let searches = [{value: 'BID', label: 'BID'}] |
| | | let svalues = {BID: 'BID'} |
| | | search.forEach(item => { |
| | | if (!item.field || item.type === 'group') return |
| | | |
| | | svalues[item.field] = item.label |
| | | searches.push({value: item.field, label: item.label}) |
| | | }) |
| | | |
| | | let colsCtrls = fromJS(config.colsCtrls || []).toJS() |
| | | colsCtrls = colsCtrls.map(col => { |
| | | col.cols = col.cols.filter(f => !!cvalues[f]) |
| | | return col |
| | | }) |
| | | |
| | | this.setState({ |
| | | cols, |
| | | svalues, |
| | | columns: columns.map(col => { |
| | | if (col.dataIndex === 'field') { |
| | | col.render = (text) => { |
| | | return text.map(cell => svalues[cell] || cell).join('、') |
| | | } |
| | | } else if (col.dataIndex === 'cols') { |
| | | col.render = (text) => { |
| | | return text.map(cell => cvalues[cell] || cell).join('、') |
| | | } |
| | | } |
| | | |
| | | return col |
| | | }), |
| | | visible: true, |
| | | searches: searches, |
| | | colsCtrls: colsCtrls |
| | | }) |
| | | } |
| | | |
| | | markSubmit = () => { |
| | | const { config } = this.props |
| | | const { colsCtrls, svalues } = this.state |
| | | |
| | | let _config = fromJS(config).toJS() |
| | | let s = [] |
| | | let c = [] |
| | | |
| | | colsCtrls.forEach((col, index) => { |
| | | if (col.field.findIndex(f => !svalues[f]) > -1) { |
| | | s.push(index + 1) |
| | | } |
| | | if (col.cols.length === 0) { |
| | | c.push(index + 1) |
| | | } |
| | | }) |
| | | |
| | | if (c.length > 0) { |
| | | Modal.warning({ |
| | | title: `第 ${c.join('、')} 行中显示列不可为空。`, |
| | | okText: '知道了' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _config.colsCtrls = colsCtrls |
| | | |
| | | if (this.customForm && this.customForm.state.editItem) { |
| | | const _this = this |
| | | let title = '存在未保存项,确定忽略吗?' |
| | | if (s.length > 0) { |
| | | title = `存在未保存项,且第 ${s.join('、')} 行中字段在搜索条件中不存在,确定忽略吗?` |
| | | } |
| | | confirm({ |
| | | title: title, |
| | | onOk() { |
| | | _this.setState({ visible: false }) |
| | | _this.props.onSubmit(_config) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else if (s.length > 0) { |
| | | const _this = this |
| | | confirm({ |
| | | title: `第 ${s.join('、')} 行中字段在搜索条件中不存在,确定忽略吗?`, |
| | | onOk() { |
| | | _this.setState({ visible: false }) |
| | | _this.props.onSubmit(_config) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | visible: false |
| | | }) |
| | | this.props.onSubmit(_config) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { colsCtrls, columns, visible, cols, searches } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <ApartmentOutlined style={{color: '#13c2c2'}} title="显示列控制" onClick={this.resetMark} /> |
| | | <Modal |
| | | wrapClassName="column-control-modal-wrap" |
| | | title="显示列控制" |
| | | visible={visible} |
| | | width={'75vw'} |
| | | maskClosable={false} |
| | | okText="提交" |
| | | onOk={this.markSubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | destroyOnClose |
| | | > |
| | | <MarkForm columns={cols} searches={searches} markChange={this.markChange} wrappedComponentRef={(inst) => this.customForm = inst}/> |
| | | <EditTable actions={['edit', 'move', 'del']} data={colsCtrls} columns={columns} onChange={(colsCtrls) => this.setState({colsCtrls})}/> |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default ColsControl |
New file |
| | |
| | | .column-control-modal-wrap { |
| | | .ant-modal { |
| | | top: 50px; |
| | | padding-bottom: 5px; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 190px); |
| | | min-height: 350px; |
| | | overflow-y: auto; |
| | | padding-bottom: 50px; |
| | | |
| | | .msg { |
| | | margin-bottom: 10px; |
| | | } |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select, Button, Input, Transfer } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | class ColsCtrlForm extends Component { |
| | | static propTpyes = { |
| | | columns: PropTypes.array, |
| | | markChange: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | targetKeys: [], |
| | | editItem: null |
| | | } |
| | | |
| | | edit = (item) => { |
| | | this.setState({editItem: item, targetKeys: item.cols}) |
| | | |
| | | this.props.form.setFieldsValue({ |
| | | field: item.field, |
| | | match: item.match, |
| | | contrastValue: item.contrastValue, |
| | | cols: item.cols |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { editItem } = this.state |
| | | |
| | | // 表单提交时检查输入值是否正确 |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | if (editItem) { |
| | | values.uuid = editItem.uuid |
| | | } |
| | | |
| | | this.props.markChange(values) |
| | | |
| | | this.setState({targetKeys: null}, () => { |
| | | this.setState({editItem: null, targetKeys: []}) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleCancel = () => { |
| | | this.setState({targetKeys: null}, () => { |
| | | this.setState({editItem: null, targetKeys: []}) |
| | | }) |
| | | } |
| | | |
| | | handleChange = (newTargetKeys) => { |
| | | this.setState({targetKeys: newTargetKeys}) |
| | | } |
| | | |
| | | render() { |
| | | const { columns, searches } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { targetKeys, editItem } = this.state |
| | | |
| | | return ( |
| | | <Form className="normal-table-cols-form"> |
| | | <Row gutter={24}> |
| | | <Col span={6}> |
| | | <Form.Item label="字段"> |
| | | {getFieldDecorator('field', { |
| | | initialValue: [], |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择字段!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select mode="multiple"> |
| | | {searches.map((item, i) => (<Select.Option key={i} value={item.value}> {item.label} </Select.Option>))} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label="对比方式"> |
| | | {getFieldDecorator('match', { |
| | | initialValue: '=', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择对比方式!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select> |
| | | <Select.Option value="="> = </Select.Option> |
| | | <Select.Option value="!="> != </Select.Option> |
| | | <Select.Option value=">"> > </Select.Option> |
| | | <Select.Option value="<"> < </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6}> |
| | | <Form.Item label="对比值"> |
| | | {getFieldDecorator('contrastValue', { |
| | | initialValue: '' |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={6} style={{padding: '5px 0px 0px 30px'}}> |
| | | <Button onClick={this.handleConfirm} type="primary" className="mk-green"> |
| | | {editItem ? '保存' : '添加'} |
| | | </Button> |
| | | {editItem ? <Button style={{marginLeft: '15px'}} onClick={this.handleCancel}> |
| | | 取消 |
| | | </Button> : null} |
| | | </Col> |
| | | {targetKeys ? <Col span={18}> |
| | | <Form.Item label="显示列"> |
| | | {getFieldDecorator('cols', { |
| | | initialValue: [], |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: '请选择显示列!' |
| | | } |
| | | ] |
| | | })( |
| | | <Transfer |
| | | targetKeys={targetKeys} |
| | | dataSource={columns} |
| | | render={item => item.title} |
| | | onChange={this.handleChange} |
| | | /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default Form.create()(ColsCtrlForm) |
New file |
| | |
| | | .normal-table-cols-form { |
| | | .ant-form-item { |
| | | display: flex; |
| | | .ant-form-item-label { |
| | | width: 80px; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | flex: 10; |
| | | |
| | | .ant-transfer { |
| | | .ant-transfer-list { |
| | | width: calc(50% - 20px); |
| | | height: 250px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <div style={{display: 'inline-block'}}> |
| | | <AntDesignOutlined className="profile" title="标记" onClick={this.resetMark} /> |
| | | <Modal |
| | | wrapClassName="model-table-column-mark-modal" |
| | | wrapClassName="mark-modal-wrap" |
| | | title="标记设置" |
| | | visible={visible} |
| | | width={'75vw'} |
| | |
| | | #mark-column-box-modal { |
| | | table tr td { |
| | | word-wrap: break-word; |
| | | word-break: break-word; |
| | | } |
| | | |
| | | .mingke-table .ant-empty { |
| | | margin: 20px 8px!important; |
| | | } |
| | | .mingke-table { |
| | | td { |
| | | position: relative; |
| | | .mark-modal-wrap { |
| | | .ant-modal { |
| | | top: 50px; |
| | | padding-bottom: 5px; |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 190px); |
| | | min-height: 350px; |
| | | overflow-y: auto; |
| | | } |
| | | } |
| | | .errorval { |
| | | display: inline-block; |
| | | width: 30px; |
| | | } |
| | | .operation-btn { |
| | | display: inline-block; |
| | | font-size: 16px; |
| | | padding: 0 5px; |
| | | cursor: pointer; |
| | | } |
| | | .ant-tabs-tabpane { |
| | | position: relative; |
| | | .excel-col-add { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 90px; |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | } |
| | | |
| | | .ant-table-tbody tr.background td { |
| | | background: unset!important; |
| | | } |
| | | .background { |
| | | .baseboard { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .content { |
| | | position: relative; |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | | |
| | | .mk-table-line.background { |
| | | .baseboard { |
| | | background: unset!important; |
| | | } |
| | | } |
| | | |
| | | .ant-form-item { |
| | | white-space: nowrap; |
| | | } |
| | | } |
| | |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: '排序', |
| | | initVal: card.IsSort || (card.isSub ? 'false' : 'true'), |
| | | initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'), |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'sortField', |
| | | label: '排序字段', |
| | | initVal: card.sortField || '', |
| | | required: true, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析方式', |
| | |
| | | picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], |
| | | video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'fieldlength', 'blacklist', 'aspectRatio'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | |
| | | } else if (this.record.perspective === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } |
| | | |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | } else if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { |
| | | _options.push('sortField') |
| | | } |
| | | |
| | | return _options |
| | |
| | | this.record[key] = value |
| | | |
| | | if (key === 'type') { |
| | | if (['link', 'textarea', 'picture', 'custom'].includes(value)) { |
| | | this.record.IsSort = 'false' |
| | | } |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | |
| | | return item |
| | | }) |
| | | }, () => { |
| | | if (value === 'link' || value === 'textarea' || value === 'picture') { |
| | | if (['link', 'textarea', 'picture', 'custom'].includes(value)) { |
| | | this.props.form.setFieldsValue({IsSort: 'false'}) |
| | | } else if (value === 'text' || value === 'number') { |
| | | this.props.form.setFieldsValue({perspective: ''}) |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (['perspective', 'eval'].includes(key)) { |
| | | } else if (['perspective', 'eval', 'IsSort'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: '排序', |
| | | initVal: card.IsSort || (card.isSub ? 'false' : 'true'), |
| | | initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'), |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'sortField', |
| | | label: '排序字段', |
| | | initVal: card.sortField || '', |
| | | required: true, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | type: 'select', |
| | | key: 'editType', |
| | | label: '编辑类型', |
| | | initVal: card.editType || 'text', |
| | |
| | | }, { |
| | | value: 'date', |
| | | text: '日期(天)' |
| | | }, { |
| | | value: 'popSelect', |
| | | text: '选择器' |
| | | }] |
| | | }, |
| | | { |
| | |
| | | required: true, |
| | | }, |
| | | { |
| | | type: 'fields', |
| | | key: 'columns', |
| | | label: '字段集', |
| | | initVal: card.columns || [], |
| | | required: true, |
| | | readonly: false, |
| | | columns: [ |
| | | { |
| | | title: '名称', |
| | | dataIndex: 'label', |
| | | inputType: 'input', |
| | | editable: true, |
| | | initval: 'label', |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '字段', |
| | | dataIndex: 'field', |
| | | inputType: 'input', |
| | | editable: true, |
| | | unique: true, |
| | | strict: true, |
| | | copy: true, |
| | | initval: 'field', |
| | | rules: [{ |
| | | pattern: /^[\u4E00-\u9FA50-9a-zA-Z_-]*$/ig, |
| | | message: '请使用数字、字母、汉字以及_-' |
| | | }], |
| | | width: '20%' |
| | | }, |
| | | { |
| | | title: '隐藏', |
| | | dataIndex: 'Hide', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 'false', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'}, |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'true') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '排序', |
| | | dataIndex: 'IsSort', |
| | | inputType: 'radio', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 'false', |
| | | options: [ |
| | | {value: 'true', text: '是'}, |
| | | {value: 'false', text: '否'}, |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'true') { |
| | | return '是' |
| | | } else { |
| | | return '否' |
| | | } |
| | | } |
| | | }, |
| | | { |
| | | title: '列宽', |
| | | dataIndex: 'Width', |
| | | inputType: 'number', |
| | | editable: true, |
| | | width: '20%', |
| | | initval: 120 |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'primaryKey', |
| | | label: '主键', |
| | | initVal: card.primaryKey || '', |
| | | required: true, |
| | | readonly: false, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'order', |
| | | label: '默认排序', |
| | | initVal: card.order || '', |
| | | placeholder: 'ID asc', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'showField', |
| | | label: '显示字段', |
| | | initVal: card.showField || '', |
| | | tooltip: '用于控制选择框中的显示内容。', |
| | | required: true, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '禁用字段', |
| | | initVal: card.controlField || '', |
| | | tooltip: '用于控制行数据是否可选择。字段值为true时,选项不可选。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: 'columns' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'searchKey', |
| | | label: '搜索字段', |
| | | initVal: card.searchKey || '', |
| | | tooltip: '多个值请用逗号分隔。', |
| | | required: false, |
| | | rules: [{ |
| | | pattern: /^[0-9a-zA-Z,_-]*$/ig, |
| | | message: '字段名只允许包含数字、字母以及_-', |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'popWidth', |
| | | label: '弹窗宽度', |
| | | initVal: card.popWidth || 60, |
| | | tooltip: '小于100时为百分率,大于100时为绝对值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: '值·字段', |
| | |
| | | { |
| | | type: 'select', |
| | | key: 'ctrlField', |
| | | label: '禁用字段', |
| | | label: '禁止编辑', |
| | | initVal: card.ctrlField || '', |
| | | tooltip: '控制单元格是否可以编辑。', |
| | | allowClear: true, |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'ctrlValue', |
| | | label: '禁用值', |
| | | label: '禁止值', |
| | | initVal: card.ctrlValue || '', |
| | | tooltip: '多个值用逗号分隔。', |
| | | required: false |
| | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getColumnForm } from './formconfig' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import { formRule } from '@/utils/option.js' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import EditTable from '@/templates/zshare/modalform/modaleditable' |
| | | import './index.scss' |
| | | |
| | | const FieldsTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | | |
| | | const { TextArea } = Input |
| | | const columnTypeOptions = { |
| | | text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'initval', 'blacklist'], |
| | | number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist'], |
| | | textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | |
| | | _options.push('editType') |
| | | |
| | | if (this.record.editType === 'switch') { |
| | | _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText', 'editField') |
| | | _options.push('enter', 'openVal', 'closeVal', 'openText', 'closeText') |
| | | } else if (this.record.editType === 'date') { |
| | | _options.push('required', 'precision', 'enter', 'declareType') |
| | | } else if (this.record.editType === 'popSelect') { |
| | | _options.push('required', 'enter', 'linkSubField', 'columns', 'dataSource', 'primaryKey', 'order', 'showField', 'controlField', 'searchKey', 'popWidth') |
| | | } else if (this.record.editType === 'select') { |
| | | _options.push('required', 'enter', 'resourceType', 'linkSubField', 'editField', 'dropdown') |
| | | _options.push('required', 'enter', 'resourceType', 'linkSubField', 'dropdown') |
| | | |
| | | if (this.record.resourceType === '0') { |
| | | _options.push('options') |
| | |
| | | } |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { |
| | | _options.push('sortField') |
| | | } |
| | | if (['number', 'formula'].includes(this.record.type) && this.record.Hide !== 'true') { |
| | | _options.push('noValue') |
| | |
| | | this.record[key] = value |
| | | |
| | | if (key === 'type') { |
| | | if (['textarea', 'custom'].includes(value)) { |
| | | this.record.IsSort = 'false' |
| | | } |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | let _field = '' |
| | |
| | | return item |
| | | }) |
| | | }, () => { |
| | | if (value === 'colspan') { |
| | | if (['textarea', 'custom'].includes(value)) { |
| | | this.props.form.setFieldsValue({IsSort: 'false'}) |
| | | } else if (value === 'colspan') { |
| | | this.props.form.setFieldsValue({Align: 'center'}) |
| | | } else if (value === 'formula' && _field) { |
| | | this.props.form.setFieldsValue({formula: '@' + _field + '@'}) |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide'].includes(key)) { |
| | | } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | | |
| | | changeOptions = (data) => { |
| | | this.record.options = data || [] |
| | | changeOptions = (data, key) => { |
| | | this.record[key] = data || [] |
| | | } |
| | | |
| | | getFields() { |
| | |
| | | rules = [ |
| | | { required: item.required, message: '请选择' + item.label + '!' } |
| | | ] |
| | | |
| | | let options = item.options |
| | | if (typeof(item.options) === 'string') { |
| | | options = this.record[item.options] || [] |
| | | } |
| | | |
| | | content = <Select |
| | | showSearch |
| | | allowClear={item.allowClear === true} |
| | |
| | | onChange={(value, option) => {this.typeChange(item.key, value, option)}} |
| | | getPopupContainer={() => document.getElementById('edit-table-column-winter')} |
| | | > |
| | | {item.options.map((option, i) => |
| | | {options.map((option, i) => |
| | | <Select.Option key={i} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> |
| | | {(option.text || option.label || option.MenuName)} |
| | | </Select.Option> |
| | |
| | | </Select> |
| | | } else if (item.type === 'textarea') { |
| | | span = 24 |
| | | className = 'text-area' |
| | | rules = [ |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | span = 24 |
| | | className = 'text-area' |
| | | |
| | | extra = <span className="add-resource-empty" onClick={this.handleEmpty}>空</span> |
| | | if (this.record.editType !== 'popSelect') { |
| | | extra = <span className="add-resource-empty" onClick={this.handleEmpty}>空</span> |
| | | } |
| | | if (item.placeholder) { |
| | | extra = <><span className="resource-public-var">{item.placeholder}</span>{extra}</> |
| | | } |
| | |
| | | content = <CodeMirror /> |
| | | } else if (item.type === 'options') { |
| | | span = 24 |
| | | className = 'text-area' |
| | | |
| | | let linkSubFields = this.record.linkSubField || [] |
| | | |
| | |
| | | columns.push({ title: transfield[field] || field, key: field }) |
| | | }) |
| | | |
| | | content = <EditTable columns={columns} module="form" onChange={this.changeOptions}/> |
| | | content = <EditTable columns={columns} module="form" onChange={(data) => this.changeOptions(data, item.key)}/> |
| | | } else if (item.type === 'fields') { |
| | | span = 24 |
| | | rules = [ |
| | | { required: item.required, message: '请添加' + item.label + '!' } |
| | | ] |
| | | |
| | | content = <FieldsTable indexShow={false} actions={['edit', 'move', 'del', 'add']} columns={item.columns} data={this.record[item.key] || []} onChange={(data) => this.changeOptions(data, item.key)}/> |
| | | } |
| | | |
| | | fields.push( |
| | |
| | | } |
| | | } |
| | | |
| | | if (values.dataSource && /\s/.test(values.dataSource)) { |
| | | if (values.dataSource) { |
| | | let error = Utils.verifySql(values.dataSource) |
| | | |
| | | |
| | | if (error) { |
| | | notification.warning({ |
| | | top: 92, |
| | |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | if (values.editType === 'select' && values.resourceType === '1' && values.dataSource) { |
| | | let _option = Utils.getSelectQueryOptions(values) |
| | | |
| | | let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${values.dataSource}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | ${_option.sql}` |
| | | |
| | | // LoginUID|SessionUid|UserID|Appkey 已替换 |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|time_id)@/ig, `'1949-10-01 15:00:00'`) |
| | | |
| | | let rduri = '' |
| | | if (window.GLOB.mainSystemApi && values.database === 'sso') { |
| | | rduri = window.GLOB.mainSystemApi |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } else if (values.editType === 'popSelect' && values.dataSource) { |
| | | let arrfield = values.columns.map(f => f.field) |
| | | |
| | | if (values.linkSubField && values.linkSubField.length > 0) { |
| | | values.linkSubField.forEach(n => { |
| | | if (!arrfield.includes(n)) { |
| | | arrfield.push(n) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let _datasource = values.dataSource |
| | | let sql = '' |
| | | |
| | | if (/\s/.test(_datasource)) { // 拼接别名 |
| | | _datasource = '(' + _datasource + ') tb' |
| | | } |
| | | |
| | | arrfield = arrfield.join(',') |
| | | |
| | | let _search = '' |
| | | |
| | | if (values.searchKey) { |
| | | let fields = values.searchKey.split(',').map(field => field + ' like \'%mk%\'') |
| | | _search = 'where ' + fields.join(' OR ') |
| | | } |
| | | |
| | | if (values.laypage === 'true') { |
| | | sql = `/*system_query*/select top 10 ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by ${values.order}) as rows from ${_datasource} ${_search}) tmptable where rows > 0 order by tmptable.rows ` |
| | | } else if (values.order) { |
| | | sql = `/*system_query*/select ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by ${values.order}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` |
| | | } else { |
| | | sql = `/*system_query*/select ${arrfield} from ${_datasource} ${_search} ` |
| | | } |
| | | |
| | | sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) |
| | | ${sql}` |
| | | |
| | | sql = sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') |
| | | sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) |
| | | sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) |
| | | sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) |
| | | sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) |
| | | |
| | | Api.sDebug(sql).then(result => { |
| | | if (result.status || result.ErrCode === '-2') { |
| | | this.setState({visible: false, loading: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | | this.record = null |
| | | } else { |
| | | this.setState({loading: false}) |
| | | Modal.error({ |
| | | title: result.message |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({visible: false, formlist: null}) |
| | | this.props.submitCol(values) |
| | |
| | | padding-right: 3px; |
| | | } |
| | | } |
| | | .ant-form-item.text-area { |
| | | >.ant-form-item-control-wrapper { |
| | | width: 88%; |
| | | } |
| | | >.ant-form-item-label { |
| | | width: 12%; |
| | | } |
| | | .CodeMirror { |
| | | height: 150px; |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | .ant-col-24 { |
| | | >.ant-form-item { |
| | | >.ant-form-item-label { |
| | | width: 12%; |
| | | } |
| | | >.ant-form-item-control-wrapper { |
| | | width: 88%; |
| | | } |
| | | .CodeMirror { |
| | | height: 150px; |
| | | } |
| | | } |
| | | } |
| | | .formula-icon { |
| | |
| | | left: 0px; |
| | | top: -25px; |
| | | font-size: 14px; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | | .formula-fields { |
| | |
| | | const EditColumn = asyncComponent(() => import('./editColumn')) |
| | | const TableVerify = asyncComponent(() => import('./tableIn')) |
| | | const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) |
| | | const ColsControl = asyncIconComponent(() => import('@/menu/components/share/colsControl')) |
| | | const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | |
| | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | const { config } = this.props |
| | | |
| | | return !is(fromJS(this.state), fromJS(nextState)) || |
| | | !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) || |
| | | !is(fromJS(config.submit), fromJS(nextProps.config.submit)) || |
| | | !is(fromJS(config.action), fromJS(nextProps.config.action)) || |
| | | config.setting.laypage !== nextProps.config.setting.laypage |
| | | return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.config), fromJS(nextProps.config)) |
| | | } |
| | | |
| | | moveCol = (dragIndex, hoverIndex) => { |
| | |
| | | </Popover> |
| | | <CopyOutlined title="复制显示列" onClick={this.copycolumn} /> |
| | | <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> |
| | | <ColsControl config={config} onSubmit={this.props.updatecolumn}/> |
| | | <FileSyncOutlined title="同步字段集" onClick={this.syncfield} /> |
| | | <DeleteOutlined title="清空显示列" onClick={this.clear}/> |
| | | </div> |
| | |
| | | field: 'commit', |
| | | label: '数据提交', |
| | | initval: wrap.commit || 'all', |
| | | tooltip: '单项提交指在表单中回车或删除行时,设置为单项时如点击提交按钮,会提交修改项。', |
| | | tooltip: '单项提交指在表单中回车或删除行时,设置为单项时如点击提交按钮,会提交修改项。失去焦点提交时会验证数据是否修改,未修改的数据不会提交。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'all', label: '全部'}, |
| | | {value: 'change', label: '修改项'}, |
| | | {value: 'simple', label: '单项'}, |
| | | {value: 'blur', label: '失去焦点'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'standard', values: ['change', 'simple']}, |
| | |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: '排序', |
| | | initVal: card.IsSort || (card.isSub ? 'false' : 'true'), |
| | | initVal: card.IsSort || (card.isSub || card.type === 'custom' ? 'false' : 'true'), |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'sortField', |
| | | label: '排序字段', |
| | | initVal: card.sortField || '', |
| | | required: true, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'eval', |
| | | label: '解析方式', |
| | |
| | | picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], |
| | | video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'blacklist', 'aspectRatio'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist', 'IsSort'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | |
| | | } else if (this.record.perspective === 'linkurl') { |
| | | _options.push('linkurl', 'linkfields', 'open') |
| | | } |
| | | } |
| | | |
| | | if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | } else if (this.record.type === 'formula' && this.record.eval === 'true') { |
| | | _options.push('decimal') |
| | | } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { |
| | | _options.push('sortField') |
| | | } |
| | | |
| | | return _options |
| | |
| | | this.record[key] = value |
| | | |
| | | if (key === 'type') { |
| | | if (['link', 'textarea', 'picture', 'custom'].includes(value)) { |
| | | this.record.IsSort = 'false' |
| | | } |
| | | |
| | | let _options = this.getOptions() |
| | | |
| | | let _field = '' |
| | |
| | | return item |
| | | }) |
| | | }, () => { |
| | | if (value === 'link' || value === 'textarea' || value === 'picture') { |
| | | if (['link', 'textarea', 'picture', 'custom'].includes(value)) { |
| | | this.props.form.setFieldsValue({IsSort: 'false'}) |
| | | } else if (value === 'text' || value === 'number') { |
| | | this.props.form.setFieldsValue({perspective: ''}) |
| | |
| | | } |
| | | } else if (key === 'format' && value === 'percent') { |
| | | this.props.form.setFieldsValue({postfix: '%'}) |
| | | } else if (['perspective', 'eval'].includes(key)) { |
| | | } else if (['perspective', 'eval', 'IsSort'].includes(key)) { |
| | | let _options = this.getOptions() |
| | | |
| | | this.setState({ |
| | |
| | | const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) |
| | | const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) |
| | | const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) |
| | | const ColsControl = asyncIconComponent(() => import('@/menu/components/share/colsControl')) |
| | | const PasteComponent = asyncIconComponent(() => import('@/components/paste')) |
| | | |
| | | class HeaderCol extends Component { |
| | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | const { config } = this.props |
| | | |
| | | return !is(fromJS(this.state), fromJS(nextState)) || |
| | | !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) || |
| | | !is(fromJS(config.action), fromJS(nextProps.config.action)) || |
| | | config.setting.laypage !== nextProps.config.setting.laypage |
| | | return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.config), fromJS(nextProps.config)) |
| | | } |
| | | |
| | | moveCol = (dragIndex, hoverIndex) => { |
| | |
| | | <PlusOutlined style={{color: '#26C281'}} title="添加列" onClick={this.addColumns}/> |
| | | <CopyOutlined title="复制显示列" onClick={this.copycolumn} /> |
| | | <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> |
| | | {appType !== 'mob' ? <ColsControl config={config} onSubmit={this.props.updatecolumn}/> : null} |
| | | <FileSyncOutlined title="同步字段集" onClick={this.syncfield} /> |
| | | <DeleteOutlined title="清空显示列" onClick={this.clear}/> |
| | | </div> |
| | |
| | | const { config } = this.props |
| | | const { appType } = this.state |
| | | |
| | | if (config.type === 'interface') { // 公共数据源不使用搜索 |
| | | this.setState({visible: true}) |
| | | return |
| | | } |
| | | |
| | | let search = [] |
| | | let menu = fromJS(window.GLOB.customMenu).toJS() |
| | | |
| | |
| | | }) |
| | | }) |
| | | } |
| | | } else if (config.type === 'interface') { |
| | | menu.components.forEach(item => { |
| | | if (item.type !== 'search') return |
| | | search = item.search |
| | | }) |
| | | } else { |
| | | let filterComponent = (box, mainSearch) => { |
| | | box.components.forEach(item => { |
| | |
| | | |
| | | let _debugId = md5(r.sql) |
| | | |
| | | if (r.custompage && _columns.findIndex(col => col.field === 'mk_total') === -1) { |
| | | Modal.warning({ |
| | | title: `数据源或自定义脚本中使用自定义分页排序时,请在字段集中添加 mk_total。`, |
| | | okText: '知道了', |
| | | onOk: () => { |
| | | reject() |
| | | } |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (debugId === _debugId) { |
| | | resolve() |
| | | return |
| | |
| | | }) |
| | | } |
| | | |
| | | if (!tail) { |
| | | if (!tail && setting.order) { |
| | | let keys = setting.order.replace(/\s+(asc|desc)/ig, '').replace(/\s+/g, '') |
| | | keys.split(',').forEach(field => { |
| | | if (new RegExp(`'${field}'`).test(result.message)) { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && !['basetable'].includes(config.subtype) ? <Col span={8}> |
| | | {!['navbar', 'balcony', 'menubar'].includes(config.type) && !['basetable'].includes(config.subtype) ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title={'优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}> |
| | | <Tooltip placement="topLeft" title={config.type === 'interface' ? '单独搜索组件可作为公共数据源的搜索条件。' : '优先使用同级的搜索条件组件,同级搜索不存在时,依次向上选取,与当前组件的搜索条件一同用作数据过滤(当前组件的搜索条件优先)。'}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 外部搜索 |
| | | </Tooltip> |
| | |
| | | if (_dataresource) { |
| | | if (custompage) { |
| | | _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` |
| | | } else if (setting.laypage === 'true' && setting.order) { |
| | | _dataresource = `/*system_query*/select top 10 ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable where rows > 0 order by tmptable.rows` |
| | | } else if (setting.order) { |
| | | _dataresource = `/*system_query*/select${setting.laypage === 'true' ? ' top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage === 'true' ? 'where rows > 0' : ''} order by tmptable.rows` |
| | | _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` |
| | | } else { |
| | | _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | return { error, sql, errors: errors.join(';') } |
| | | return { error, sql, errors: errors.join(';'), custompage } |
| | | } |
| | | } |
| | |
| | | <Col span={card.setting.width || 6}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <NormalForm title="菜单编辑" width={900} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <NormalForm title="菜单编辑" width={950} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="menucell" card={card}/> |
| | |
| | | menulist = [] |
| | | } |
| | | |
| | | let ops = [] |
| | | let adapters = sessionStorage.getItem('adapter') || '' |
| | | if (adapters.indexOf('wxmini') > -1) { |
| | | ops.push({value: 'miniprogram', label: '小程序'}) |
| | | } else if (setting.type === 'miniprogram') { |
| | | setting.type = '' |
| | | } |
| | | |
| | | const menuWrapForm = [ |
| | | { |
| | | type: 'text', |
| | |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'linkmenu', label: '关联菜单'}, |
| | | {value: 'link', label: '链接'}, |
| | | ...ops |
| | | ], |
| | | controlFields: [ |
| | | {field: 'copyMenuId', values: ['menu']}, |
| | | {field: 'linkMenuId', values: ['linkmenu']}, |
| | | {field: 'linkurl', values: ['link']}, |
| | | {field: 'primaryId', values: ['menu', 'linkmenu']}, |
| | | {field: 'miniAppId', values: ['miniprogram']}, |
| | | {field: 'miniPath', values: ['miniprogram']}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'miniAppId', |
| | | label: '小程序AppID', |
| | | initval: setting.miniAppId || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'miniPath', |
| | | label: '页面路径', |
| | | initval: setting.miniPath || '', |
| | | tooltip: '可指定跳转小程序页面路径。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'copyMenuId', |
| | | label: '复制菜单', |
| | |
| | | |
| | | if (param.$searchkey) { |
| | | component.search = component.search.map(item => { |
| | | if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { |
| | | if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | |
| | |
| | | |
| | | // 字段透视及必填标志 |
| | | config.search = config.search.map(item => { |
| | | if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) { |
| | | if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | return item |
| | |
| | | _style.lineHeight = card.innerHeight + 'px' |
| | | |
| | | let mark = getMark(card.marks, data, _style) |
| | | |
| | | _style = mark.style |
| | | |
| | | className = mark.signType |
| | | } |
| | | contents.push( |
| | |
| | | if (card.marks) { |
| | | let mark = getMark(card.marks, data, _style) |
| | | |
| | | _style = mark.style |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | | val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> |
| | |
| | | let className = '' |
| | | if (card.marks) { |
| | | let mark = getMark(card.marks, data, _style) |
| | | |
| | | _style = mark.style |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | let className = '' |
| | | if (card.marks) { |
| | | let mark = getMark(card.marks, data, _style) |
| | | |
| | | _style = mark.style |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, Empty, notification, message, Row, Col, Pagination, Modal } from 'antd' |
| | | import { Spin, Empty, notification, message, Row, Col, Pagination, Modal, Switch } from 'antd' |
| | | import { DownOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | |
| | | selectedData: [], |
| | | loading: false, |
| | | card: null, |
| | | data: null, |
| | | data: [], |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | | selected: 'false', |
| | | supNodes: [], |
| | | supComs: null |
| | | supComs: null, |
| | | pickup: false |
| | | } |
| | | |
| | | loaded = false |
| | |
| | | _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : '' |
| | | _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout float-' + (_config.wrap.cardFloat || 'left') |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}` |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale}` |
| | | |
| | | let pageOptions = ['10', '25', '50', '100', '500', '1000'] |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let _data = null |
| | | let _data = [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected } = this.state |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | const { config, data, selectedData } = this.state |
| | | |
| | | if (config.wrap.cardType !== 'checkbox') return |
| | | if (!data || data.length === 0) return |
| | | if (data.length === 0) return |
| | | |
| | | if (selectedData.length === 0 || selectedData.length < data.length) { |
| | | let index = '' |
| | |
| | | selectedData: [], |
| | | data: data, |
| | | total: total, |
| | | pickup: false, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state |
| | | pickupChange = () => { |
| | | this.setState({ |
| | | pickup: !this.state.pickup |
| | | }) |
| | | } |
| | | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | render() { |
| | | const { config, precards, nextcards, loading, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, pickup } = this.state |
| | | |
| | | let data = this.state.data |
| | | |
| | | if (config.wrap.empty === 'hidden' && data.length === 0) return null |
| | | |
| | | let _total = 0 |
| | | let switchable = false |
| | | if (config.wrap.pagestyle === 'switch' && total > pageSize && data) { |
| | | if (config.wrap.pagestyle === 'switch' && total > pageSize) { |
| | | _total = pageSize * pageIndex |
| | | switchable = true |
| | | } |
| | |
| | | if (config.$extend) { |
| | | extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | if (data[0]) { |
| | | if (selectedData[0]) { |
| | | extendData = {...extendData, ...selectedData[0]} |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | if (pickup) { |
| | | data = data.filter(item => selectKeys.includes(item.key)) |
| | | } |
| | | |
| | | return ( |
| | | <div className="custom-data-card-box" id={'anchor' + config.uuid} style={config.style}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | | {data.length ? <div className="ant-spin-blur"></div> : null} |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | |
| | | selectedData={selectedData} |
| | | /> : null |
| | | } |
| | | {config.wrap.pickup === 'true' && this.state.data.length > 0 ? <div className="pickup-wrap"><Switch title="收起" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} /></div> : null} |
| | | <div className={`data-zoom ${config.wrap.wrapClass}`}> |
| | | {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} |
| | | <Row className={'card-row-list ' + config.wrap.layout}> |
| | |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | | {data.map((item, index) => { |
| | | let className = 'mk-card ' |
| | | if (config.wrap.parity === 'true') { |
| | | if (index % 2 === 1) { |
| | |
| | | } |
| | | if (item.$disabled) { |
| | | className = 'mk-disabled' |
| | | } else if (activeKey === index) { |
| | | } else if (activeKey === item.key) { |
| | | className += 'active' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | | } else if (selectKeys.indexOf(item.key) > -1) { |
| | | className += 'selected' |
| | | } |
| | | |
| | | return ( |
| | | <Col className={className} key={index} style={card.wStyle} span={card.setting.width}> |
| | | <CardItem card={card} cards={config} data={item} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={card} cards={config} data={item} onClick={() => {this.changeCard(item.key, item)}}> |
| | | <span className="circle-select"></span> |
| | | </CardItem> |
| | | </Col> |
| | |
| | | </Row> |
| | | {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} |
| | | </div> |
| | | {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.$empty && data.length === 0 ? <Empty description={false}/> : null} |
| | | {config.wrap.pagestyle === 'page' ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | .pickup-wrap { |
| | | float: right; |
| | | button { |
| | | margin-top: 3px; |
| | | } |
| | | } |
| | | .pickup-wrap + div { |
| | | clear: both; |
| | | } |
| | | .button-list + .pickup-wrap { |
| | | position: relative; |
| | | button { |
| | | position: absolute; |
| | | bottom: 0; |
| | | right: 0; |
| | | } |
| | | } |
| | | .data-zoom { |
| | | display: flex; |
| | | position: relative; |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, Empty, notification, Row, Col, Pagination, Modal } from 'antd' |
| | | import { Spin, Empty, notification, Row, Col, Pagination, Modal, Switch } from 'antd' |
| | | import { DownOutlined, UpOutlined, PlusSquareOutlined, MinusSquareOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | |
| | | selectedData: [], // 选中数据,用于工具栏按钮 |
| | | loading: false, // 数据加载状态 |
| | | card: null, // 卡片设置 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | |
| | | opens: [], |
| | | wrapStyle: null, |
| | | subcard: null, |
| | | subconfig: null |
| | | subconfig: null, |
| | | pickup: false |
| | | } |
| | | |
| | | loaded = false |
| | |
| | | const { config, data, selected, card } = this.state |
| | | let _opens = [...this.state.opens] |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | |
| | | const { config, data, selectedData } = this.state |
| | | |
| | | if (config.wrap.cardType !== 'checkbox') return |
| | | if (!data || data.length === 0) return |
| | | if (data.length === 0) return |
| | | |
| | | if (selectedData.length === 0 || selectedData.length < data.length) { |
| | | let index = '' |
| | |
| | | selectedData: [], |
| | | data: data, |
| | | total: total, |
| | | pickup: false, |
| | | loading: false |
| | | }) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, subcard, subconfig, wrapStyle, opens } = this.state |
| | | pickupChange = () => { |
| | | this.setState({ |
| | | pickup: !this.state.pickup |
| | | }) |
| | | } |
| | | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | render() { |
| | | const { config, precards, nextcards, loading, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, subcard, subconfig, wrapStyle, opens, pickup } = this.state |
| | | |
| | | let data = this.state.data |
| | | |
| | | if (config.wrap.empty === 'hidden' && data.length === 0) return null |
| | | |
| | | let extendData = null |
| | | |
| | | if (config.$extend) { |
| | | extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | if (data[0]) { |
| | | if (selectedData[0]) { |
| | | extendData = {...extendData, ...selectedData[0]} |
| | | } else { |
| | |
| | | mainBox = 'flex-card ' |
| | | } |
| | | |
| | | if (pickup) { |
| | | data = data.filter(item => selectKeys.includes(item.key)) |
| | | } |
| | | |
| | | return ( |
| | | <div className="double-data-card-box" id={'anchor' + config.uuid} style={config.style}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | | {data.length ? <div className="ant-spin-blur"></div> : null} |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | |
| | | selectedData={selectedData} |
| | | /> : null |
| | | } |
| | | {config.wrap.pickup === 'true' && this.state.data.length > 0 ? <div className="pickup-wrap"><Switch title="收起" checkedChildren="开" unCheckedChildren="关" checked={pickup} onChange={this.pickupChange} /></div> : null} |
| | | <div className={config.wrap.zoomStyle ? 'data-zoom-box' : ''} style={config.wrap.zoomStyle}> |
| | | <div className={`data-zoom ${config.wrap.wrapClass}`} style={config.wrap.minWidth ? {minWidth: config.wrap.minWidth} : null}> |
| | | <Row className={'card-row-list '}> |
| | |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | | {data.map((item, index) => { |
| | | let className = 'card-item-wrap mk-card ' + mainBox |
| | | let subClass = 'mk-unfold' |
| | | let unfold = true |
| | | |
| | | if (item.$disabled) { |
| | | className = 'card-item-wrap mk-disabled ' + mainBox |
| | | } else if (activeKey === index) { |
| | | } else if (activeKey === item.key) { |
| | | className += 'active' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | | } else if (selectKeys.indexOf(item.key) > -1) { |
| | | className += 'selected' |
| | | } |
| | | |
| | |
| | | subClass = 'mk-disabled' |
| | | unfold = false |
| | | } else { |
| | | subClass = opens.indexOf(index) > -1 ? 'mk-unfold' : 'mk-collapse' |
| | | unfold = opens.indexOf(index) > -1 |
| | | subClass = opens.indexOf(item.key) > -1 ? 'mk-unfold' : 'mk-collapse' |
| | | unfold = opens.indexOf(item.key) > -1 |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Col key={index} span={card.setting.width} style={card.wStyle}> |
| | | <div className={className} style={wrapStyle}> |
| | | <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(index, subClass)} onClick={() => {this.changeCard(index, item, subClass)}}> |
| | | <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(item.key, subClass)} onClick={() => {this.changeCard(item.key, item, subClass)}}> |
| | | <span className="circle-select"></span> |
| | | {card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/>) : null} |
| | | {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : null} |
| | | {card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/>) : null} |
| | | {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/> : null} |
| | | </CardItem> |
| | | <div className={'sub-card-wrap ' + subClass + (config.wrap.parity === 'true' ? ' mk-parity-bg' : '')} onClick={() => this.changeSubCard(item)}> |
| | | {item.children.map((cell, index) => <Col key={'sub' + index} span={subcard.setting.width || 24}> |
| | |
| | | ))} |
| | | </Row> |
| | | </div> |
| | | {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {config.$empty && data.length === 0 ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.wrap.pagestyle === 'page' ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | .pickup-wrap { |
| | | float: right; |
| | | button { |
| | | margin-top: 3px; |
| | | } |
| | | } |
| | | .pickup-wrap + div { |
| | | clear: both; |
| | | } |
| | | .button-list + .pickup-wrap { |
| | | position: relative; |
| | | button { |
| | | position: absolute; |
| | | bottom: 0; |
| | | right: 0; |
| | | } |
| | | } |
| | | .data-zoom { |
| | | display: flex; |
| | | position: relative; |
| | |
| | | border-color: #ffffff; |
| | | transform: rotate(45deg); |
| | | } |
| | | |
| | | .data-zoom.check.square { |
| | | .circle-select { |
| | | border-radius: 0!important; |
| | |
| | | autoExec = (times) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (!config.wrap.autoExec) return |
| | | if (!config.wrap.autoExec || (config.wrap.emptyExec === 'false' && data.$$empty)) return |
| | | |
| | | let btn = document.getElementById('button' + config.wrap.autoExec) |
| | | |
| | |
| | | _data = result.data || [] |
| | | } else { |
| | | _data = result.data && result.data[0] ? result.data && result.data[0] : {} |
| | | _data.value = _data.value[config.plot.valueField] || 0 |
| | | _data.value = _data[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | |
| | | |
| | | if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { |
| | | MKEmitter.emit('reloadData', config.setting.supModule, BID) |
| | | } else if (position === 'grid' && config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: null |
| | | }, () => { |
| | | this.setState({data: {$$empty: true}}) |
| | | }) |
| | | } else { |
| | | this.loadData() |
| | | } |
| | |
| | | |
| | | if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { |
| | | MKEmitter.emit('reloadData', config.setting.supModule, BID) |
| | | } else if (position === 'grid' && config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: null |
| | | }, () => { |
| | | this.setState({data: {$$empty: true}}) |
| | | }) |
| | | } else { |
| | | this.loadData() |
| | | } |
| | |
| | | |
| | | if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { |
| | | MKEmitter.emit('reloadData', config.setting.supModule, BID) |
| | | } else if (position === 'grid' && config.wrap.datatype === 'static') { |
| | | this.setState({ |
| | | data: null |
| | | }, () => { |
| | | this.setState({data: {$$empty: true}}) |
| | | }) |
| | | } else { |
| | | this.loadData() |
| | | } |
| | |
| | | MKEmitter.addListener('initFinish', this.initFinish) |
| | | } |
| | | |
| | | if (config.setting.useMSearch) { |
| | | MKEmitter.addListener('searchRefresh', this.searchRefresh) |
| | | } |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | |
| | | this.timer && this.timer.stop() |
| | | MKEmitter.removeListener('initFinish', this.initFinish) |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('searchRefresh', this.searchRefresh) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | } |
| | | |
| | | searchRefresh = (searchId) => { |
| | | const { config } = this.props |
| | | |
| | | if (config.$searchId !== searchId) return |
| | | |
| | | this.loadData() |
| | | } |
| | | |
| | | initFinish = (MenuID) => { |
| | |
| | | |
| | | if (this.loading) return |
| | | |
| | | let searches = [] |
| | | if (config.setting.useMSearch) { |
| | | searches = window.GLOB.SearchBox.get(config.$searchId) || [] |
| | | } |
| | | |
| | | this.loading = true |
| | | |
| | | let param = UtilsDM.getQueryDataParams(config.setting, [], config.setting.order, 1, 1, BID) |
| | | let param = UtilsDM.getQueryDataParams(config.setting, searches, config.setting.order, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | chgSelectData: PropTypes.func, // 数据切换 |
| | | autoMatic: PropTypes.any |
| | | autoMatic: PropTypes.any, |
| | | allSearch: PropTypes.any, |
| | | colsCtrls: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | rowspans: null, // 行合并字段信息 |
| | | pickup: false, // 收起未选择项 |
| | | orderfields: {}, // 排序id与field转换 |
| | | pageOptions: [] |
| | | pageOptions: [], |
| | | allColumns: null, |
| | | reseting: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { setting, fields, columns } = this.props |
| | | const { setting, columns, fields, colsCtrls } = this.props |
| | | let radio = 5 // 虚化比例 |
| | | let _format = false // 是否虚化处理 |
| | | let rowspans = [] |
| | |
| | | let cell = null |
| | | |
| | | if (item.type === 'colspan') { |
| | | cell = { title: item.label, align: item.Align } |
| | | cell = { title: item.label, align: item.Align, $key: item.uuid } |
| | | cell.children = getColumns(item.subcols) |
| | | } else { |
| | | if (item.rowspan === 'true') { |
| | |
| | | |
| | | if (item.field) { |
| | | orderfields[item.uuid] = item.field |
| | | } else if (item.sortField) { |
| | | orderfields[item.uuid] = item.sortField |
| | | } |
| | | |
| | | cell = { |
| | | $key: item.uuid, |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | | title: item.label, |
| | | sorter: item.field && item.IsSort === 'true', |
| | | sorter: (item.field || item.sortField) && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | onCell: record => ({ |
| | | record, |
| | |
| | | fields.push(item.field) |
| | | |
| | | _columns.push({ |
| | | $key: item.uuid, |
| | | align: item.Align, |
| | | dataIndex: item.field, |
| | | title: item.label, |
| | |
| | | pageOptions = pageOptions.sort((a, b) => a - b) |
| | | } |
| | | |
| | | let allColumns = null |
| | | if (colsCtrls) { |
| | | rowspans = null |
| | | allColumns = [..._columns] |
| | | _columns = this.getCurColumns(_columns, this.props.allSearch) |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: setting.pageSize || 10, |
| | | pageOptions, |
| | | allColumns, |
| | | columns: _columns, |
| | | rowspans, |
| | | tableId, |
| | |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | const { allSearch } = this.props |
| | | const { allColumns } = this.state |
| | | |
| | | if (allSearch && !is(fromJS(allSearch), fromJS(nextProps.allSearch))) { |
| | | this.setState({ |
| | | reseting: true, |
| | | columns: this.getCurColumns(allColumns, nextProps.allSearch) |
| | | }, () => { |
| | | this.setState({reseting: false}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | MKEmitter.removeListener('autoQueryData', this.autoQueryData) |
| | | MKEmitter.removeListener('autoSelectData', this.autoSelectData) |
| | | MKEmitter.removeListener('mkCheckTopLine', this.mkCheckTopLine) |
| | | } |
| | | |
| | | getCurColumns = (columns, allSearch) => { |
| | | const { colsCtrls } = this.props |
| | | |
| | | let values = {} |
| | | allSearch.forEach(item => { |
| | | values[item.key] = item.value |
| | | }) |
| | | let cols = null |
| | | colsCtrls.some(item => { |
| | | let originVal = item.field.map(f => values[f] || '').join('') |
| | | let contrastVal = item.contrastValue |
| | | let result = false |
| | | |
| | | if (item.match === '=') { |
| | | result = originVal === contrastVal |
| | | } else if (item.match === '!=') { |
| | | result = originVal !== contrastVal |
| | | } else { |
| | | originVal = isNaN(originVal) ? originVal : +originVal |
| | | contrastVal = isNaN(contrastVal) ? contrastVal : +contrastVal |
| | | if (item.match === '>') { |
| | | result = originVal > contrastVal |
| | | } else if (item.match === '<') { |
| | | result = originVal < contrastVal |
| | | } |
| | | } |
| | | |
| | | if (!result) return false |
| | | |
| | | cols = item.cols |
| | | |
| | | return true |
| | | }) |
| | | |
| | | if (cols) { |
| | | return columns.filter(col => cols.includes(col.$key)) |
| | | } |
| | | |
| | | return columns |
| | | } |
| | | |
| | | autoSelectData = (id, index) => { |
| | |
| | | |
| | | render() { |
| | | const { setting, statFValue, lineMarks, data } = this.props |
| | | const { selectedRowKeys, activeIndex, pickup, tableId, pageOptions, columns } = this.state |
| | | const { selectedRowKeys, activeIndex, pickup, tableId, pageOptions, columns, reseting } = this.state |
| | | |
| | | if (reseting) return null |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | | let rowSelection = null |
| | |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, // 每页数据条数 |
| | | orderBy: '', // 排序 |
| | | search: '' // 搜索条件数组,使用时需分场景处理 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | allSearch: null |
| | | } |
| | | |
| | | /** |
| | |
| | | _config.lineMarks = null |
| | | } |
| | | |
| | | let allSearch = null |
| | | if (_config.colsCtrls && _config.colsCtrls.length > 0) { |
| | | allSearch = [{key: 'BID', value: BID || ''}] |
| | | allSearch.push(..._config.$searches) |
| | | if (_config.setting.useMSearch) { |
| | | let mainSearch = window.GLOB.SearchBox.get(_config.$searchId) || [] |
| | | allSearch.push(...mainSearch) |
| | | } |
| | | } else { |
| | | _config.colsCtrls = null |
| | | } |
| | | |
| | | if (setting.commit === 'blur') { |
| | | setting.hasSubmit = false |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: setting.pageSize || 10, |
| | | BID: BID || '', |
| | |
| | | setting: setting, |
| | | actions: _config.action, |
| | | columns: _columns, |
| | | search: _config.$searches |
| | | search: _config.$searches, |
| | | allSearch |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | let allSearch = null |
| | | if (config.colsCtrls) { |
| | | allSearch = [{key: 'BID', value: BID || ''}] |
| | | allSearch.push(...searches) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | allSearch: allSearch, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, setting, actions, config, columns, BData, data, selectedData } = this.state |
| | | const { BID, setting, actions, config, columns, BData, data, selectedData, allSearch } = this.state |
| | | |
| | | let style = {...config.style} |
| | | if (config.wrap.empty === 'hidden' && data.length === 0) { |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuID={config.uuid} |
| | | allSearch={allSearch} |
| | | submit={config.submit} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | colsCtrls={config.colsCtrls} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | if (col.editable === 'true' && !disabled) { |
| | | if (editing) { |
| | | if (!col.editType || col.editType === 'text') { |
| | | return (<td className="editing_table_cell"> |
| | | return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> |
| | | <Input className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | </td>) |
| | | } else if (col.editType === 'date') { |
| | | return (<td className="editing_table_cell"> |
| | | return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> |
| | | <CusDatePicker config={col} value={record[col.field] || null} open={true} onChange={this.onDateChange} blur={() => this.setState({editing: false})}/> |
| | | </td>) |
| | | } else if (col.editType === 'switch') { |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | return (<td className="editing_table_cell"> |
| | | return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> |
| | | <CusSwitch config={col} defaultValue={_value} autoFocus={true} onChange={this.onSwitchChange} onBlur={this.switchBlur}/> |
| | | </td>) |
| | | } else { |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | return (<td className="editing_table_cell"> |
| | | return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> |
| | | <Select |
| | | showSearch |
| | | defaultValue={_value} |
| | |
| | | </td>) |
| | | } |
| | | } else { |
| | | return (<td className={className + ' pointer'} style={style}> |
| | | return (<td onClick={(e) => e.stopPropagation()} className={className + ' pointer'} style={style}> |
| | | <div className="mk-mask" id={col.uuid + record.$$uuid} onClick={this.focus}></div>{content} |
| | | </td>) |
| | | } |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | if (col.noValue === 'hide' && value === 0) { |
| | | val = '' |
| | | } |
| | | return (<td className="editing_table_cell"> |
| | | return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> |
| | | <InputNumber className={err ? 'has-error' : ''} precision={col.decimal || 0} title={err} id={col.uuid + record.$$uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> |
| | | </td>) |
| | | } else { |
| | | return (<td className={className + ' pointer'} style={style}> |
| | | return (<td onClick={(e) => e.stopPropagation()} className={className + ' pointer'} style={style}> |
| | | <div className="mk-mask" id={col.uuid + record.$$uuid} onClick={this.focus}></div>{content} |
| | | </td>) |
| | | } |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | if (!col) return (<td {...resProps} className={className} style={style}/>) |
| | | |
| | | let disabled = false |
| | | let editable = false |
| | | if (col.ctrlField) { |
| | | disabled = col.ctrlValue.includes(record[col.ctrlField]) |
| | | } |
| | |
| | | let children = null |
| | | if (col.type === 'text') { |
| | | if (col.editable === 'true' && !disabled) { |
| | | editable = true |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | if (!col.editType || col.editType === 'text') { |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | } |
| | | } else if (col.type === 'number') { |
| | | if (col.editable === 'true' && !disabled) { |
| | | editable = true |
| | | let _value = record[col.field] !== undefined ? record[col.field] : '' |
| | | |
| | | if (col.noValue === 'hide' && _value === 0) { |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | } |
| | | |
| | | if (col.marks) { |
| | | let mark = getMark(col.marks, record, style) |
| | | style = style ? {...style} : {} |
| | | |
| | | style = mark.style |
| | | let mark = getMark(col.marks, record, style) |
| | | |
| | | if (mark.icon) { |
| | | if (mark.position === 'front') { |
| | |
| | | ) |
| | | } |
| | | |
| | | if (editable) { |
| | | return (<td onClick={(e) => e.stopPropagation()} className={'editing_all_table_cell ' + className} style={style}>{children}</td>) |
| | | } |
| | | |
| | | return (<td className={'editing_all_table_cell ' + className} style={style}>{children}</td>) |
| | | } |
| | | } |
| | |
| | | loading: PropTypes.bool, // 表格加载中 |
| | | refreshdata: PropTypes.func, // 表格中排序列、页码的变化时刷新 |
| | | chgSelectData: PropTypes.func, |
| | | allSearch: PropTypes.any, |
| | | colsCtrls: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | |
| | | pageOptions: [], |
| | | deForms: null, |
| | | visible: false, |
| | | midData: null |
| | | midData: null, |
| | | allColumns: null, |
| | | reseting: false |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { setting, fields, columns, BID } = this.props |
| | | const { setting, fields, columns, BID, colsCtrls } = this.props |
| | | let orderfields = {} |
| | | |
| | | let _columns = [] |
| | |
| | | let cell = null |
| | | |
| | | if (item.type === 'colspan') { |
| | | cell = { title: item.label, align: item.Align } |
| | | cell = { title: item.label, align: item.Align, $key: item.uuid } |
| | | cell.children = getColumns(item.subcols) |
| | | } else { |
| | | if (item.editable === 'true') { |
| | |
| | | |
| | | if (item.field) { |
| | | orderfields[item.uuid] = item.field |
| | | } else if (item.sortField) { |
| | | orderfields[item.uuid] = item.sortField |
| | | } |
| | | |
| | | cell = { |
| | | align: item.Align, |
| | | dataIndex: item.uuid, |
| | | title: item.editable === 'true' ? <span>{item.label}<EditOutlined className="system-color mk-edit-sign"/></span> : item.label, |
| | | sorter: !!(item.field && item.IsSort === 'true'), |
| | | sorter: (item.field || item.sortField) && item.IsSort === 'true', |
| | | width: item.Width || 120, |
| | | $type: item.type, |
| | | // $type: item.type, |
| | | $key: item.uuid, |
| | | onCell: record => ({ |
| | | record, |
| | | col: item, |
| | |
| | | pageOptions = pageOptions.sort((a, b) => a - b) |
| | | } |
| | | |
| | | let allColumns = null |
| | | if (colsCtrls) { |
| | | allColumns = [..._columns] |
| | | _columns = this.getCurColumns(_columns, this.props.allSearch) |
| | | } |
| | | |
| | | this.setState({ |
| | | forms, |
| | | signForms, |
| | | allColumns, |
| | | pageSize: setting.pageSize || 10, |
| | | pageOptions, |
| | | columns: _columns, |
| | |
| | | MKEmitter.removeListener('changeRecord', this.changeRecord) |
| | | } |
| | | |
| | | getCurColumns = (columns, allSearch) => { |
| | | const { colsCtrls } = this.props |
| | | |
| | | let values = {} |
| | | allSearch.forEach(item => { |
| | | values[item.key] = item.value |
| | | }) |
| | | let cols = null |
| | | colsCtrls.some(item => { |
| | | let originVal = item.field.map(f => values[f] || '').join('') |
| | | let contrastVal = item.contrastValue |
| | | let result = false |
| | | |
| | | if (item.match === '=') { |
| | | result = originVal === contrastVal |
| | | } else if (item.match === '!=') { |
| | | result = originVal !== contrastVal |
| | | } else { |
| | | originVal = isNaN(originVal) ? originVal : +originVal |
| | | contrastVal = isNaN(contrastVal) ? contrastVal : +contrastVal |
| | | if (item.match === '>') { |
| | | result = originVal > contrastVal |
| | | } else if (item.match === '<') { |
| | | result = originVal < contrastVal |
| | | } |
| | | } |
| | | |
| | | if (!result) return false |
| | | |
| | | cols = item.cols |
| | | |
| | | return true |
| | | }) |
| | | |
| | | if (cols) { |
| | | return columns.filter(col => cols.includes(col.$key)) |
| | | } |
| | | |
| | | return columns |
| | | } |
| | | |
| | | transferData = (menuid, data, type) => { |
| | | const { MenuID, setting } = this.props |
| | | const { edData, signForms } = this.state |
| | | |
| | | if (menuid !== MenuID) return |
| | | |
| | | if (setting.commit !== 'all' && setting.standard !== 'change') { |
| | | if (setting.commit !== 'all' && setting.commit !== 'blur' && setting.standard !== 'change') { |
| | | if (type !== 'line') { |
| | | data.forEach(item => { |
| | | let value = '' |
| | |
| | | } |
| | | |
| | | updateMutil = (data) => { |
| | | const { setting } = this.props |
| | | const { setting, colsCtrls, allSearch } = this.props |
| | | const { allColumns } = this.state |
| | | |
| | | if (colsCtrls) { |
| | | this.setState({ |
| | | columns: this.getCurColumns(allColumns, allSearch), |
| | | reseting: true, |
| | | edData: data, |
| | | visible: false, |
| | | midData: null |
| | | }, () => { |
| | | this.setState({ |
| | | reseting: false |
| | | }) |
| | | }) |
| | | |
| | | return |
| | | } |
| | | |
| | | if (setting.editType === 'multi' && data.length > 0) { |
| | | this.setState({edData: []}, () => { |
| | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({columns: [], edData: []}, () => { |
| | | let _cols = this.state.allColumns |
| | | if (_cols) { |
| | | _cols = _cols.map(item => { |
| | | if (reCols[item.dataIndex]) { |
| | | item.onCell = record => ({ |
| | | record, |
| | | col: reCols[item.dataIndex] |
| | | }) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | this.setState({columns: [], edData: [], allColumns: _cols}, () => { |
| | | this.setState({columns: _edColumns, edData: edData}) |
| | | }) |
| | | } |
| | |
| | | this.setState({edData: _data}, () => { |
| | | if (setting.commit === 'simple') { |
| | | this.submit() |
| | | } else if (setting.commit === 'blur') { |
| | | this.submit(record) |
| | | } |
| | | }) |
| | | } |
| | |
| | | |
| | | if (id !== tableId) return |
| | | |
| | | if (!record.$sign) { |
| | | if (setting.commit === 'blur') { |
| | | |
| | | } else if (!record.$sign) { |
| | | record.$origin = false |
| | | record.$lock = true |
| | | delete record.$forbid |
| | |
| | | if (setting.tableType && setting.hasAction && this.state.selectedRowKeys.includes(record.$$uuid)) { |
| | | this.selectdata(this.state.selectedRowKeys) |
| | | } |
| | | if (setting.commit === 'blur') { |
| | | this.submit(record) |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | addRecord = (id, record) => { |
| | |
| | | return data |
| | | } |
| | | |
| | | submit = () => { |
| | | checkLineData = (item) => { |
| | | const { forms } = this.state |
| | | |
| | | let record = fromJS(item).toJS() |
| | | let err = '' |
| | | forms.forEach(col => { |
| | | if (col.editable !== 'true' || record.$deleted) { |
| | | if (col.type === 'number') { |
| | | record[col.field] = +record[col.field] |
| | | if (isNaN(record[col.field])) { |
| | | record[col.field] = 0 |
| | | } |
| | | } else { |
| | | record[col.field] = record[col.field] !== undefined ? (record[col.field] + '') : '' |
| | | } |
| | | return |
| | | } |
| | | if (col.type === 'text') { |
| | | let val = record[col.field] !== undefined ? (record[col.field] + '') : '' |
| | | if (col.required === 'true' && !val) { |
| | | err = `${col.label}不可为空` |
| | | } else if (col.datatype === 'datetime' && !val) { |
| | | val = '1949-10-01' |
| | | } |
| | | record[col.field] = val |
| | | } else if (col.type === 'number') { |
| | | let val = record[col.field] |
| | | if (col.noValue === 'hide' && !val) { |
| | | val = 0 |
| | | } else if (!val && val !== 0) { |
| | | err = `${col.label}不可为空` |
| | | return |
| | | } |
| | | val = +val |
| | | if (isNaN(val)) { |
| | | err = `${col.label}数据格式错误` |
| | | return |
| | | } |
| | | |
| | | val = +val.toFixed(col.decimal || 0) |
| | | |
| | | if (typeof(col.max) === 'number' && val > col.max) { |
| | | err = `${col.label}不可大于${col.max}` |
| | | } else if (typeof(col.min) === 'number' && val < col.min) { |
| | | err = `${col.label}不可小于${col.min}` |
| | | } |
| | | |
| | | record[col.field] = val |
| | | } |
| | | }) |
| | | |
| | | if (err) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: err, |
| | | duration: 5 |
| | | }) |
| | | |
| | | return null |
| | | } |
| | | |
| | | return [record] |
| | | } |
| | | |
| | | submit = (record) => { |
| | | const { submit, BID, setting } = this.props |
| | | const { forms } = this.state |
| | | |
| | |
| | | return |
| | | } |
| | | |
| | | let data = this.checkData() |
| | | if (setting.commit === 'blur' && !record) return |
| | | |
| | | let data = null |
| | | if (setting.commit === 'blur') { |
| | | data = this.checkLineData(record) |
| | | } else { |
| | | data = this.checkData() |
| | | } |
| | | |
| | | if (!data) return |
| | | |
| | |
| | | |
| | | render() { |
| | | const { setting, lineMarks, submit } = this.props |
| | | const { tableId, edData, columns, loading, pageOptions, selectedRowKeys, visible, midData } = this.state |
| | | const { tableId, edData, columns, loading, pageOptions, selectedRowKeys, visible, midData, reseting } = this.state |
| | | |
| | | if (reseting) return null |
| | | |
| | | const components = { |
| | | body: { |
| | |
| | | pageSize: 10, // 每页数据条数 |
| | | orderBy: '', // 排序 |
| | | search: '', // 搜索条件数组,使用时需分场景处理 |
| | | statFValue: [] // 合计值 |
| | | statFValue: [], // 合计值 |
| | | allSearch: null |
| | | } |
| | | |
| | | loaded = false |
| | |
| | | |
| | | _config.style = _config.style || {} |
| | | |
| | | let allSearch = null |
| | | if (_config.colsCtrls && _config.colsCtrls.length > 0) { |
| | | allSearch = [{key: 'BID', value: BID || ''}] |
| | | allSearch.push(..._config.$searches) |
| | | if (_config.setting.useMSearch) { |
| | | let mainSearch = window.GLOB.SearchBox.get(_config.$searchId) || [] |
| | | allSearch.push(...mainSearch) |
| | | } |
| | | } else { |
| | | _config.colsCtrls = null |
| | | } |
| | | |
| | | this.setState({ |
| | | pageSize: setting.pageSize || 10, |
| | | BID: BID || '', |
| | |
| | | setting: setting, |
| | | actions: _config.action, |
| | | columns: _config.cols, |
| | | search: _config.$searches |
| | | search: _config.$searches, |
| | | allSearch |
| | | }) |
| | | } |
| | | |
| | |
| | | total = data[data.length - 1].mk_total || 0 |
| | | } |
| | | |
| | | let allSearch = null |
| | | if (config.colsCtrls) { |
| | | allSearch = [{key: 'BID', value: BID || ''}] |
| | | allSearch.push(...searches) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | selectedData: [], |
| | | allSearch: allSearch, |
| | | total: total, |
| | | loading: false |
| | | }) |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, setting, actions, config, columns, selectedData, BData, data } = this.state |
| | | const { BID, setting, actions, config, columns, selectedData, BData, data, allSearch } = this.state |
| | | |
| | | let style = {...config.style} |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) { |
| | |
| | | setting={setting} |
| | | columns={columns} |
| | | MenuID={config.uuid} |
| | | allSearch={allSearch} |
| | | data={this.state.data} |
| | | fields={config.columns} |
| | | total={this.state.total} |
| | | colsCtrls={config.colsCtrls} |
| | | lineMarks={config.lineMarks} |
| | | loading={this.state.loading} |
| | | refreshdata={this.refreshbytable} |
| | |
| | | |
| | | if (param.$searchkey) { |
| | | component.search = component.search.map(item => { |
| | | if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { |
| | | if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | |
| | |
| | | if (!inter) { |
| | | item.wrap.datatype = 'static' |
| | | } else { |
| | | item.setting = inter.setting |
| | | item.setting = {...inter.setting} |
| | | } |
| | | } |
| | | } |
| | |
| | | return interfaces.map(inter => { |
| | | inter.MenuID = MenuID |
| | | inter.setting.delay = delay |
| | | inter.$searchId = MenuID |
| | | delay += 15 |
| | | |
| | | if (inter.setting.supModule) { |
| | |
| | | inter.setting.supModule = '' |
| | | } |
| | | } |
| | | |
| | | |
| | | if (initlimit && inter.setting.loadlevel !== 'init') { |
| | | inter.setting.onload = 'false' |
| | | } |
| | | |
| | | inter.setting.useMSearch = inter.setting.useMSearch === 'true' |
| | | inter.setting.arr_field = inter.columns.map(col => col.field).join(',') |
| | | |
| | | if (inter.setting.interType !== 'system') return inter |
| | |
| | | |
| | | if (param.$searchkey) { |
| | | component.search = component.search.map(item => { |
| | | if (['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { |
| | | if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field) { |
| | | item.initval = param.$searchval |
| | | } |
| | | |
| | |
| | | ratio = ratio + 'vw' |
| | | } |
| | | return <Modal |
| | | wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} |
| | | wrapClassName={`popview-modal popview-${btn.uuid} ` + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} |
| | | title={btn.label} |
| | | width={ratio} |
| | | maskClosable={btn.clickouter === 'close'} |
| | |
| | | return ( |
| | | <Drawer |
| | | title={btn.label} |
| | | className={!btn.$view ? 'table-drawer-popview' : 'custom-drawer-popview' } |
| | | className={!btn.$view ? 'table-drawer-popview' : 'custom-drawer-popview popview-' + btn.uuid} |
| | | width={width} |
| | | height={height} |
| | | maskClosable={btn.clickouter === 'close'} |
New file |
| | |
| | | import { btnClasses } from '@/utils/option.js' |
| | | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | | * @param {*} card 编辑按钮 |
| | | * @param {*} config 页面配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | | text: '弹窗(表单)' |
| | | }, { |
| | | value: 'prompt', |
| | | text: '提示框' |
| | | }, { |
| | | value: 'exec', |
| | | text: '直接执行' |
| | | }, { |
| | | value: 'excelIn', |
| | | text: '导入Excel' |
| | | }, { |
| | | value: 'excelOut', |
| | | text: '导出Excel' |
| | | }, { |
| | | value: 'popview', |
| | | text: '弹窗(标签)' |
| | | }, { |
| | | value: 'tab', |
| | | text: '标签页' |
| | | }, { |
| | | value: 'innerpage', |
| | | text: '新页面' |
| | | }, { |
| | | value: 'funcbutton', |
| | | text: '功能按钮' |
| | | } |
| | | ] |
| | | |
| | | if (card.execSuccess === 'view' || card.execSuccess === 'refresh') { // refresh为表单标签页 |
| | | card.execSuccess = 'grid' |
| | | } |
| | | if (card.execError === 'view' || card.execError === 'refresh') { |
| | | card.execError = 'grid' |
| | | } |
| | | if (card.popClose === 'view') { |
| | | card.popClose = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'outerpage') { |
| | | card.pageTemplate = 'custom' |
| | | card.OpenType = 'innerpage' |
| | | } |
| | | |
| | | let refresh = [] |
| | | |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | | if (card.focus) { |
| | | card.popClose = 'maingrid' |
| | | } |
| | | refresh.push({ |
| | | value: 'maingrid', |
| | | text: '刷新主表(行)' |
| | | }, { |
| | | value: 'equaltab', |
| | | text: '刷新同级标签' |
| | | }) |
| | | } else if (card.execSuccess === 'maingrid') { |
| | | card.execSuccess = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'blank') { |
| | | card.OpenType = 'tab' |
| | | } |
| | | if (!card.control && card.controlField) { |
| | | card.control = 'disabled' |
| | | } |
| | | |
| | | if (card.intertype === 'outer' && !card.procMode && !card.innerFunc) { // 兼容外部函数直传类型 |
| | | card.procMode = 'none' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'select', |
| | | key: 'OpenType', |
| | | label: '打开方式', |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '按钮名称', |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'funcType', |
| | | label: '功能类型', |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: [{ |
| | | value: 'print', |
| | | text: '标签打印' |
| | | }, { |
| | | value: 'refund', |
| | | text: '退款' |
| | | }, { |
| | | value: 'changeuser', |
| | | text: '切换用户' |
| | | }, { |
| | | value: 'closetab', |
| | | text: '标签关闭' |
| | | }, { |
| | | value: 'megvii', |
| | | text: '旷视面板机' |
| | | }, { |
| | | value: 'filezip', |
| | | text: '文件压缩包' |
| | | }] |
| | | }, |
| | | { // 旷视面板机接口 待扩展 |
| | | type: 'radio', |
| | | key: 'subFunc', |
| | | label: '接口名称', |
| | | initVal: card.subFunc || 'addUser', |
| | | required: true, |
| | | options: [ |
| | | { value: 'addUser', text: '添加用户' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'execMode', |
| | | label: '执行方式', |
| | | initVal: card.execMode || 'exec', |
| | | required: true, |
| | | options: [{ |
| | | value: 'exec', |
| | | text: '直接执行' |
| | | }, { |
| | | value: 'prompt', |
| | | text: '提示框' |
| | | }, { |
| | | value: 'pop', |
| | | text: '弹窗(表单)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'intertype', |
| | | label: '接口类型', |
| | | initVal: card.intertype || 'system', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'procMode', |
| | | label: '参数处理', |
| | | initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), |
| | | tooltip: '当返回值存在 mk_ex_invoke 且值为 false 时,不会调用外部接口。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'system', |
| | | text: '系统函数' |
| | | }, { |
| | | value: 'inner', |
| | | text: '内部函数' |
| | | }, { |
| | | value: 'none', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sqlType', |
| | | label: '操作类型', |
| | | initVal: card.sqlType || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sql', |
| | | label: '表名', |
| | | initVal: card.sql || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: '内部函数', |
| | | initVal: card.innerFunc || '', |
| | | tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始。` : '', |
| | | fields: usefulFields, |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlkey', |
| | | label: '地址字段', |
| | | initVal: card.urlkey || '', |
| | | tooltip: '图片(文件)链接的字段名。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ...tabs |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'pageTemplate', |
| | | label: '页面类型', |
| | | initVal: card.pageTemplate || '', |
| | | required: true, |
| | | options: [{ |
| | | // value: 'print', |
| | | // text: '标签打印模板' |
| | | // }, { |
| | | // value: 'billprintTemp', |
| | | // text: '单据打印模板' |
| | | // }, { |
| | | value: 'billprint', |
| | | text: '单据打印' |
| | | }, { |
| | | value: 'pay', |
| | | text: '支付' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'printTemp', |
| | | label: '打印模板', |
| | | initVal: card.printTemp || '', |
| | | required: true, |
| | | options: printTemps |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'url', |
| | | label: '页面地址', |
| | | initVal: card.url || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysInterface', |
| | | label: '系统接口', |
| | | initVal: card.sysInterface || 'false', |
| | | tooltip: '单点登录系统', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'outerFunc', |
| | | label: '外部函数', |
| | | initVal: card.outerFunc || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'interface', |
| | | label: '测试地址', |
| | | initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), |
| | | required: true, |
| | | readonly: card.sysInterface === 'true' |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'proInterface', |
| | | label: '正式地址', |
| | | initVal: card.proInterface || '', |
| | | tooltip: '正式系统所使用的接口地址。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | | tooltip: '使用后台脚本执行时,需要配合计划任务。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'script', |
| | | text: '自定义脚本' |
| | | }, { |
| | | value: 'default', |
| | | text: '后台脚本' |
| | | }, { |
| | | value: 'func', |
| | | text: '回调函数' |
| | | }, { |
| | | value: 'none', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'cbTable', |
| | | label: '回调表名', |
| | | initVal: card.cbTable || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'callbackFunc', |
| | | label: '回调函数', |
| | | initVal: card.callbackFunc || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'position', |
| | | label: '显示位置', |
| | | initVal: card.position || 'toolbar', |
| | | required: true, |
| | | options: [{ |
| | | value: 'toolbar', |
| | | text: '工具栏' |
| | | }, { |
| | | value: 'grid', |
| | | text: '表格' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Ot', |
| | | label: '行设置', |
| | | initVal: card.Ot || 'requiredSgl', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'refreshTab', |
| | | label: '刷新标签', |
| | | initVal: card.refreshTab || [], |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execSuccess', |
| | | label: '成功后', |
| | | initVal: card.execSuccess || 'grid', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execError', |
| | | label: '失败后', |
| | | initVal: card.execError || 'never', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'popClose', |
| | | label: '关闭后', |
| | | initVal: card.popClose || 'grid', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resetPageIndex', |
| | | label: '刷新时', |
| | | initVal: card.resetPageIndex || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '重置页码' |
| | | }, { |
| | | value: 'false', |
| | | text: '不重置' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'class', |
| | | label: '颜色', |
| | | initVal: card.class, |
| | | required: false, |
| | | options: btnClasses |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'openmenu', |
| | | label: '打开菜单', |
| | | initVal: card.openmenu || [], |
| | | tooltip: '执行成功后需要打开的菜单。', |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | | tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。', |
| | | initVal: card.output || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tipTitle', |
| | | label: '确认提示', |
| | | initVal: card.tipTitle || '', |
| | | tooltip: '注:弹窗(表单)在显示为是否框时有效。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sheet', |
| | | label: '表名', |
| | | initVal: card.sheet || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pagination', |
| | | label: '分页', |
| | | initVal: card.pagination || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'search', |
| | | label: '搜索条件', |
| | | initVal: card.search || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '必填' |
| | | }, { |
| | | value: 'false', |
| | | text: '非必填' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示方式', |
| | | initVal: card.display || 'modal', |
| | | required: true, |
| | | options: [{ |
| | | value: 'modal', |
| | | text: '模态框' |
| | | }, { |
| | | value: 'drawer', |
| | | text: '抽屉' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'ratio', |
| | | min: 1, |
| | | max: 3000, |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | | tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'placement', |
| | | label: '弹出方向', |
| | | initVal: card.placement || 'right', |
| | | required: false, |
| | | options: [{ |
| | | value: 'right', |
| | | text: '右侧' |
| | | }, { |
| | | value: 'left', |
| | | text: '左侧' |
| | | }, { |
| | | value: 'top', |
| | | text: '上侧' |
| | | }, { |
| | | value: 'bottom', |
| | | text: '下侧' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'clickouter', |
| | | label: '点击蒙层', |
| | | initVal: card.clickouter || 'unclose', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unclose', |
| | | text: '不关闭' |
| | | }, { |
| | | value: 'close', |
| | | text: '关闭' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'control', |
| | | label: '按钮控制', |
| | | initVal: card.control || '', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'disabled', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'hidden', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '控制字段,可根据数据控制按钮的隐藏或禁用。', |
| | | initVal: card.controlField || '', |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会隐藏或禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'reason', |
| | | label: '禁用原因', |
| | | initVal: card.reason || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | | tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'progress', |
| | | label: '进度提示', |
| | | initVal: card.progress || 'number', |
| | | required: false, |
| | | options: [{ |
| | | value: 'number', |
| | | text: '剩余数' |
| | | }, { |
| | | value: 'progressbar', |
| | | text: '进度条' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import { getActionForm } from '@/templates/zshare/formconfig' |
| | | import { getActionForm } from './formconfig' |
| | | import asyncSpinComponent from '@/utils/asyncSpinComponent' |
| | | |
| | | import ActionForm from './actionform' |
New file |
| | |
| | | /** |
| | | * @description 获取子菜单基本信息表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {string} supMenu // 上级菜单ID |
| | | * @param {array} menus // 可选的上级菜单列表 |
| | | * @param {array} equalTab // 同级菜单IDs |
| | | * @param {array} equalTabs // 可选的同级菜单列表 |
| | | * @param {string} type // 菜单类型,主表或树形结构 |
| | | */ |
| | | export function getTabForm (card, supMenu, menus, equalTab, equalTabs, type) { |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '标签名称', |
| | | initVal: card.label || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: '上级标签', |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: '同级标签', |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'level', |
| | | label: '显示级别', |
| | | tooltip: '标签显示控制,选择指定级别时显示标签,级别为空时始终显示。', |
| | | initVal: card.level, |
| | | min: 0, |
| | | max: 10, |
| | | required: false, |
| | | forbid: type !== 'TreePage', |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchPass', |
| | | label: '主表搜索', |
| | | initVal: card.searchPass || 'false', |
| | | tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。', |
| | | required: false, |
| | | forbid: type !== 'CommonTable', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不使用' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取卡片详情表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {array} _columns // 显示列 |
| | | * @param {string} _type // 类型,卡片的部位 |
| | | * @param {array} _actions // 按钮列表 |
| | | */ |
| | | export function getCardDetailForm (card, _columns, _type, _actions = []) { |
| | | let actions = '' |
| | | if (_type === 'bottom') { |
| | | actions = card.actions ? card.actions.map(cell => cell.value) : [] |
| | | } else if (_type === 'header') { |
| | | _actions.unshift({ |
| | | value: '', |
| | | text: '空' |
| | | }) |
| | | actions = card.actions[0] ? card.actions[0].value : '' |
| | | } |
| | | return [ |
| | | { |
| | | type: 'radio', |
| | | key: 'datatype', |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'dynamic', |
| | | required: true, |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'dynamic', |
| | | text: '动态' |
| | | }, { |
| | | value: 'static', |
| | | text: '静态' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'type', |
| | | label: '类型', |
| | | initVal: card.type || 'picture', |
| | | required: true, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'icon', |
| | | text: '图标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'content', |
| | | label: '内容', |
| | | initVal: card.content || '', |
| | | required: _type !== 'header', |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'field', |
| | | label: '字段', |
| | | initVal: card.field || '', |
| | | required: true, |
| | | forbid: !['detail', 'header', 'avatar'].includes(_type), |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fontSize', |
| | | min: 12, |
| | | max: 50, |
| | | label: '字体大小', |
| | | initVal: card.fontSize || 14, |
| | | required: true, |
| | | forbid: !['detail'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'fontWeight', |
| | | label: '字体粗细', |
| | | initVal: card.fontWeight || 'normal', |
| | | required: true, |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '正常' |
| | | }, { |
| | | value: 'bold', |
| | | text: 'bold' |
| | | }, { |
| | | value: 'bolder', |
| | | text: 'bolder' |
| | | }, { |
| | | value: 'lighter', |
| | | text: 'lighter' |
| | | }, { |
| | | value: '100', |
| | | text: '100' |
| | | }, { |
| | | value: '200', |
| | | text: '200' |
| | | }, { |
| | | value: '300', |
| | | text: '300' |
| | | }, { |
| | | value: '400', |
| | | text: '400' |
| | | }, { |
| | | value: '500', |
| | | text: '500' |
| | | }, { |
| | | value: '600', |
| | | text: '600' |
| | | }, { |
| | | value: '700', |
| | | text: '700' |
| | | }, { |
| | | value: '800', |
| | | text: '800' |
| | | }, { |
| | | value: '900', |
| | | text: '900' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 10, |
| | | max: 100, |
| | | precision: 1, |
| | | label: '宽度(%)', |
| | | initVal: card.width || 100, |
| | | required: true, |
| | | forbid: !['detail', 'avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 1, |
| | | max: 10, |
| | | label: '高度(行)', |
| | | initVal: card.height || 1, |
| | | required: true, |
| | | forbid: !['detail'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'radius', |
| | | label: '圆角', |
| | | initVal: card.radius || 'true', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '有' |
| | | }, { |
| | | value: 'false', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'size', |
| | | label: '字体大小', |
| | | initVal: card.size || 28, |
| | | min: 12, |
| | | max: 500, |
| | | required: false, |
| | | hidden: true, |
| | | forbid: !['avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'align', |
| | | label: '对齐', |
| | | initVal: card.align || 'left', |
| | | required: false, |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'left', |
| | | text: '左' |
| | | }, { |
| | | value: 'align-center', |
| | | text: '居中' |
| | | }, { |
| | | value: 'align-right', |
| | | text: '右' |
| | | }] |
| | | }, |
| | | { |
| | | type: _type === 'bottom' ? 'multiselect' : 'select', |
| | | key: 'actions', |
| | | label: '按钮组', |
| | | tooltip: '', |
| | | initVal: actions, |
| | | required: false, |
| | | forbid: !['header', 'bottom'].includes(_type), |
| | | options: _actions |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: '显示', |
| | | initVal: card.show || 'icon', |
| | | required: false, |
| | | forbid: !['bottom', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'icon', |
| | | text: '图标' |
| | | }, { |
| | | value: 'text', |
| | | text: '文字' |
| | | }, { |
| | | value: 'all', |
| | | text: '全部' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示', |
| | | initVal: card.display || 'inline', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'block', |
| | | text: '整行' |
| | | }, { |
| | | value: 'inline', |
| | | text: '自动' |
| | | }] |
| | | }, |
| | | ] |
| | | } |
| | |
| | | import { EditOutlined, CloseOutlined, PlusOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import { getCardDetailForm } from '@/templates/zshare/formconfig' |
| | | import { getCardDetailForm } from './formconfig' |
| | | import MkIcon from '@/components/mk-icon' |
| | | import DragDetail from './dragdetail' |
| | | import CardDetailForm from './carddetailform' |
New file |
| | |
| | | /** |
| | | * @description 获取图表视图配置表单 |
| | | * @param {object} card // 图表对象 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {String} setting // 页面设置 |
| | | */ |
| | | export function getChartOptionForm (card, columns, setting) { |
| | | let shapes = [] |
| | | |
| | | if (card.chartType === 'line') { |
| | | shapes = [ |
| | | { field: 'smooth', label: 'smooth' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'dot', label: 'dot' }, |
| | | { field: 'dash', label: 'dash' }, |
| | | { field: 'hv', label: 'hv' }, |
| | | { field: 'vh', label: 'vh' }, |
| | | { field: 'hvh', label: 'hvh' }, |
| | | { field: 'vhv', label: 'vhv' } |
| | | ] |
| | | } else if (card.chartType === 'bar') { |
| | | shapes = [ |
| | | { field: 'rect', label: 'rect' }, |
| | | { field: 'hollow-rect', label: 'hollow-rect' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'tick', label: 'tick' }, |
| | | { field: 'funnel', label: 'funnel' }, |
| | | { field: 'pyramid', label: 'pyramid' } |
| | | ] |
| | | } else if (card.chartType === 'pie') { |
| | | shapes = [ |
| | | { field: 'pie', label: '饼图' }, |
| | | { field: 'ring', label: '环图' } |
| | | ] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'radio', |
| | | key: 'datatype', |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'query', |
| | | tooltip: '统计图表适用于表格不分页,且数据需要转换', |
| | | required: false, |
| | | readonly: !(setting.laypage === 'false'), |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [ |
| | | { value: 'query', text: '查询' }, |
| | | { value: 'statistics', text: '统计' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Xaxis', |
| | | label: card.chartType === 'pie' ? 'Text' : 'X-轴', |
| | | initVal: card.Xaxis || '', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Yaxis', |
| | | label: card.chartType === 'pie' ? 'Value' : 'Y-轴', |
| | | initVal: card.chartType === 'pie' ? card.Yaxis || '' : card.Yaxis || [], |
| | | multi: card.chartType !== 'pie', |
| | | hidden: card.datatype === 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'InfoType', |
| | | label: '类型', |
| | | initVal: card.InfoType || '', |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'InfoValue', |
| | | label: '值', |
| | | initVal: card.InfoValue || '', |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'legend', |
| | | label: '图例位置', |
| | | initVal: card.legend || 'bottom', |
| | | required: false, |
| | | options: [ |
| | | { field: 'top', label: 'top' }, |
| | | { field: 'top-left', label: 'top-left' }, |
| | | { field: 'top-right', label: 'top-right' }, |
| | | { field: 'right', label: 'right' }, |
| | | { field: 'right-top', label: 'right-top' }, |
| | | { field: 'right-bottom', label: 'right-bottom' }, |
| | | { field: 'left', label: 'left' }, |
| | | { field: 'left-top', label: 'left-top' }, |
| | | { field: 'left-bottom', label: 'left-bottom' }, |
| | | { field: 'bottom', label: 'bottom' }, |
| | | { field: 'bottom-left', label: 'bottom-left' }, |
| | | { field: 'bottom-right', label: 'bottom-right' }, |
| | | { field: 'hidden', label: 'hidden' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'shape', |
| | | label: '形状', |
| | | initVal: card.shape || (shapes[0] && shapes[0].field), |
| | | required: false, |
| | | forbid: !['line', 'bar', 'pie'].includes(card.chartType), |
| | | options: shapes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'tooltip', |
| | | label: '提示信息', |
| | | initVal: card.tooltip || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'coordinate', |
| | | label: '坐标', |
| | | initVal: card.coordinate || 'angle', |
| | | required: false, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'angle', |
| | | text: '二维坐标' |
| | | }, { |
| | | value: 'polar', |
| | | text: '极坐标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'point', |
| | | label: '点图', |
| | | initVal: card.point || 'false', |
| | | required: false, |
| | | forbid: !['line'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'transpose', |
| | | label: '变换', |
| | | initVal: card.transpose || 'false', |
| | | required: false, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pieshow', |
| | | label: '显示值', |
| | | initVal: card.pieshow || 'percent', |
| | | required: false, |
| | | forbid: !['pie'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'value', |
| | | text: '数值' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'label', |
| | | label: '标注-值', |
| | | initVal: card.label || (card.chartType === 'pie' ? 'true' : 'false'), |
| | | required: false, |
| | | forbid: !['pie', 'bar', 'line'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelLayout', |
| | | label: '标签布局', |
| | | initVal: card.labelLayout || 'normal', |
| | | required: false, |
| | | forbid: !['pie'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '常规' |
| | | }, { |
| | | value: 'overlap', |
| | | text: '防重叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'adjust', |
| | | label: '多柱排列', |
| | | initVal: card.adjust || 'dodge', |
| | | required: false, |
| | | forbid: !['bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'dodge', |
| | | text: '分组' |
| | | }, { |
| | | value: 'stack', |
| | | text: '堆叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'repeat', |
| | | label: '重复数据', |
| | | initVal: card.repeat || 'unrepeat', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unrepeat', |
| | | text: '去重' |
| | | }, { |
| | | value: 'average', |
| | | text: '平均' |
| | | }, { |
| | | value: 'cumsum', |
| | | text: '累加' |
| | | }] |
| | | }, { |
| | | type: 'number', |
| | | key: 'InfoDefNumber', |
| | | label: '展示数', |
| | | tooltip: '默认显示类型数量', |
| | | min: 1, |
| | | max: 50, |
| | | decimal: 0, |
| | | initVal: card.InfoDefNumber || 5, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true |
| | | }, { |
| | | type: 'number', |
| | | key: 'barSize', |
| | | label: '柱形宽度', |
| | | tooltip: '空值时,宽度自适应。', |
| | | min: 5, |
| | | max: 100, |
| | | decimal: 0, |
| | | initVal: card.barSize, |
| | | forbid: !['bar'].includes(card.chartType), |
| | | required: false |
| | | } |
| | | ] |
| | | } |
| | |
| | | import { Drawer, Form, Button, Col, Row, Select, Radio, Tooltip, Input, InputNumber, Cascader } from 'antd' |
| | | import { QuestionCircleOutlined, RightOutlined, EditOutlined, LeftOutlined } from '@ant-design/icons' |
| | | |
| | | import { getChartOptionForm } from '@/templates/zshare/formconfig' |
| | | import { getChartOptionForm } from './formconfig' |
| | | import { minkeColorSystem, colorTransform } from '@/utils/option.js' |
| | | import './index.scss' |
| | | |
New file |
| | |
| | | /** |
| | | * @description 获取图表视图外部配置表单 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {Array} actions // 按钮组excel |
| | | * @param {Array} extraActions // 常规按钮 |
| | | */ |
| | | export function getChartViewForm (card, _columns, actions, extraActions) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let _charts = [{ |
| | | value: 'line', |
| | | text: '折线图' |
| | | }, { |
| | | value: 'bar', |
| | | text: '柱状图' |
| | | }, { |
| | | value: 'pie', |
| | | text: '饼图' |
| | | }, { |
| | | value: 'card', |
| | | text: '卡片' |
| | | }] |
| | | |
| | | if (card.chartType === 'table') { |
| | | _charts = [{ |
| | | value: 'table', |
| | | text: '表格' |
| | | }] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'title', |
| | | label: '标题', |
| | | initVal: card.title, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'chartType', |
| | | label: '图表类型', |
| | | initVal: card.chartType, |
| | | required: true, |
| | | readonly: card.chartType === 'table', |
| | | options: _charts |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 100, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '高度', |
| | | initVal: card.height || 400, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: '隐藏', |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '图表宽度', |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width || 24, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'cardWidth', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '卡片宽度', |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.cardWidth || 6, |
| | | hidden: true, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'bgfield', |
| | | label: '背景控制', |
| | | initVal: card.bgfield || '', |
| | | required: false, |
| | | readonly: false, |
| | | hidden: true, |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hidden', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'switch', |
| | | label: '数据切换', |
| | | initVal: card.switch || 'true', |
| | | required: false, |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'extraAction', |
| | | label: '扩展卡片', |
| | | initVal: card.extraAction || '', |
| | | tooltip: '绑定不选行的按钮,卡片尾部会增加功能卡片', |
| | | required: false, |
| | | options: extraActions |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'actions', |
| | | label: '扩展按钮', |
| | | initVal: card.actions || [], |
| | | tooltip: '可绑定已有的excel导入、导出按钮', |
| | | required: false, |
| | | options: actions |
| | | } |
| | | ] |
| | | } |
| | |
| | | import { DownOutlined, UpOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import { getChartViewForm } from '@/templates/zshare/formconfig' |
| | | import { getChartViewForm } from './formconfig' |
| | | |
| | | import ChartForm from './chartform' |
| | | import DragChartView from './dragchartview' |
New file |
| | |
| | | /** |
| | | * @description 获取显示列表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} menulist // 菜单列表-用于字段透视 |
| | | */ |
| | | export function getColumnForm (card, menulist = [], fields = []) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '名称', |
| | | initVal: card.label, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: '字段', |
| | | initVal: card.field, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: '类型', |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: '文本' |
| | | }, { |
| | | value: 'number', |
| | | text: '数字' |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'video', |
| | | text: '视频' |
| | | }, { |
| | | value: 'link', |
| | | text: '链接' |
| | | }, { |
| | | value: 'textarea', |
| | | text: '多行文本' |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'nameField', |
| | | label: '名称字段', |
| | | initVal: card.nameField, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '列宽', |
| | | initVal: card.Width, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: '隐藏', |
| | | initVal: card.Hide || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: '排序', |
| | | initVal: card.IsSort || 'true', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Align', |
| | | label: '对齐方式', |
| | | initVal: card.Align || 'left', |
| | | required: true, |
| | | options: [{ |
| | | value: 'left', |
| | | text: '左对齐' |
| | | }, { |
| | | value: 'center', |
| | | text: '居中' |
| | | }, { |
| | | value: 'right', |
| | | text: '右对齐' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'startTime', |
| | | precision: 0, |
| | | label: '开始时间', |
| | | initVal: card.startTime || 0, |
| | | tooltip: '视频开始播放的时间,用于调整视频初始化展示的界面。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'aspectRatio', |
| | | label: '长宽比', |
| | | initVal: card.aspectRatio || '16:9', |
| | | required: true, |
| | | options: [ |
| | | { value: '4:3', text: '4:3' }, |
| | | { value: '16:9', text: '16:9' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'rowspan', |
| | | label: '行合并', |
| | | initVal: card.rowspan || 'false', |
| | | tooltip: '相邻行信息相同时,单元格合并。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sum', |
| | | label: '显示合计', |
| | | initVal: card.sum || 'false', |
| | | tooltip: '合计信息只在使用系统数据源,且当前列未隐藏时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | min: 0, |
| | | max: 18, |
| | | decimal: 0, |
| | | label: '小数位', |
| | | initVal: card.decimal || 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: '字段长度', |
| | | initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'format', |
| | | label: '格式化', |
| | | initVal: card.format || 'none', |
| | | options: [{ |
| | | value: 'none', |
| | | text: '无' |
| | | }, { |
| | | value: 'thdSeparator', |
| | | text: '千分位' |
| | | }, { |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'abs', |
| | | text: '绝对值' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'textFormat', |
| | | label: '格式化', |
| | | initVal: card.textFormat || 'none', |
| | | options: [{ |
| | | value: 'none', |
| | | text: '无' |
| | | }, { |
| | | value: 'encryption', |
| | | text: '加密' |
| | | }, { |
| | | value: 'YYYY-MM-DD', |
| | | text: 'YYYY-MM-DD' |
| | | }, { |
| | | value: 'YYYY-MM-DD HH:mm:ss', |
| | | text: 'YYYY-MM-DD HH:mm:ss' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'prefix', |
| | | label: '前缀', |
| | | initVal: card.prefix || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'postfix', |
| | | label: '后缀', |
| | | initVal: card.postfix || '', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'span', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '图片宽度', |
| | | initVal: card.span || 24, |
| | | tooltip: '栅格布局,等分为24份。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'lenWidRadio', |
| | | label: '长宽比', |
| | | initVal: card.lenWidRadio || '1:1', |
| | | required: true, |
| | | options: [ |
| | | { value: '1:1', text: '1:1' }, |
| | | { value: '4:3', text: '4:3' }, |
| | | { value: '3:2', text: '3:2' }, |
| | | { value: '16:9', text: '16:9' }, |
| | | { value: '2:1', text: '2:1' }, |
| | | { value: '3:1', text: '3:1' }, |
| | | { value: '4:1', text: '4:1' }, |
| | | { value: '5:1', text: '5:1' }, |
| | | { value: '6:1', text: '6:1' }, |
| | | { value: '7:1', text: '7:1' }, |
| | | { value: '8:1', text: '8:1' }, |
| | | { value: '9:1', text: '9:1' }, |
| | | { value: '10:1', text: '10:1' }, |
| | | { value: '3:4', text: '3:4' }, |
| | | { value: '2:3', text: '2:3' }, |
| | | { value: '9:16', text: '9:16' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'scale', |
| | | label: '点击缩放', |
| | | initVal: card.scale || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'perspective', |
| | | label: '字段透视', |
| | | initVal: card.perspective || '', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'linkmenu', |
| | | text: '菜单' |
| | | }, { |
| | | value: 'linkurl', |
| | | text: '链接' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'linkmenu', |
| | | label: '菜单', |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkfields', |
| | | label: '关联字段', |
| | | initVal: card.linkfields || [], |
| | | required: false, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | } |
| | | ] |
| | | } |
| | |
| | | import { Modal, notification, Switch, message } from 'antd' |
| | | import { CopyOutlined } from '@ant-design/icons' |
| | | |
| | | import { getColumnForm } from '@/templates/zshare/formconfig' |
| | | import { getColumnForm } from './formconfig' |
| | | |
| | | import ColumnForm from './columnform' |
| | | import ColspanForm from './colspanform' |
| | |
| | | |
| | | const searchTypeOptions = { |
| | | text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'inputType', 'advanced', 'query', 'labelwidth'], |
| | | select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], |
| | | radio: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'query', 'labelwidth'], |
| | | select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'dropdown', 'query', 'labelwidth'], |
| | | radio: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], |
| | | multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], |
| | | link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], |
| | | link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'dropdown', 'query', 'labelwidth'], |
| | | date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], |
| | | checkcard: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'resourceType', 'display', 'width', 'multiple', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], |
| | | dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], |
| | |
| | | columns.push({ title: 'url', key: '$url', type: 'file' }) |
| | | } else if (this.record.display === 'color') { |
| | | columns.push({ title: 'Color', key: '$color' }) |
| | | extra = <span>使用十六进制色彩代码(HEX)时,请在色值前添加 #</span> |
| | | } |
| | | |
| | | fields.forEach(item => { |
New file |
| | |
| | | /** |
| | | * @description 获取子菜单基本信息表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {string} supMenu // 上级菜单ID |
| | | * @param {array} menus // 可选的上级菜单列表 |
| | | * @param {array} equalTab // 同级菜单IDs |
| | | * @param {array} equalTabs // 可选的同级菜单列表 |
| | | * @param {string} type // 菜单类型,主表或树形结构 |
| | | */ |
| | | export function getTabForm (card, supMenu, menus, equalTab, equalTabs, type) { |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '标签名称', |
| | | initVal: card.label || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: '上级标签', |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: '同级标签', |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'level', |
| | | label: '显示级别', |
| | | tooltip: '标签显示控制,选择指定级别时显示标签,级别为空时始终显示。', |
| | | initVal: card.level, |
| | | min: 0, |
| | | max: 10, |
| | | required: false, |
| | | forbid: type !== 'TreePage', |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchPass', |
| | | label: '主表搜索', |
| | | initVal: card.searchPass || 'false', |
| | | tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。', |
| | | required: false, |
| | | forbid: type !== 'CommonTable', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不使用' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | |
| | | import { QuestionCircleOutlined, ArrowDownOutlined, ArrowUpOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import { getTabForm } from '@/templates/zshare/formconfig' |
| | | import { getTabForm } from './formconfig' |
| | | |
| | | import TabForm from './tabform' |
| | | import TabDragElement from './tabdragelement' |
| | |
| | | import React from 'react' |
| | | import { formRule, btnClasses } from '@/utils/option.js' |
| | | |
| | | /** |
| | | * @description 获取树形页面设置表单配置信息 |
| | | * @param {object} setting // 菜单全局设置信息 |
| | | * @param {array} usefulFields // 可用开始字符 |
| | | * @param {string} MenuID // 菜单ID |
| | | */ |
| | | export function getTreeSettingForm (setting, usefulFields = [], MenuID) { |
| | | let str = '^(' + usefulFields.join('|') + ')' |
| | | let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') |
| | | let rules = [{ |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | }] |
| | | |
| | | if (usefulFields.length > 0) { |
| | | rules.push({ |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }) |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'tableName', |
| | | label: '表名', |
| | | initVal: setting.tableName || '', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'title', |
| | | label: '标题', |
| | | initVal: setting.title || '', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'interType', |
| | | label: '接口类型', |
| | | initVal: setting.interType || 'inner', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'inner', text: '内部' }, |
| | | { value: 'outer', text: '外部' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysInterface', |
| | | label: '系统接口', |
| | | initVal: setting.sysInterface || 'false', |
| | | tooltip: '单点登录系统', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'interface', |
| | | label: '接口地址', |
| | | initVal: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (setting.interface || ''), |
| | | required: true, |
| | | readonly: setting.sysInterface === 'true', |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'outerFunc', |
| | | label: '外部函数', |
| | | initVal: setting.outerFunc || '', |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.func.pattern, |
| | | message: formRule.func.message |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: '内部函数', |
| | | initVal: setting.innerFunc || '', |
| | | tooltip: usefulFields.length ? '开头可用字符:' + usefulFields.join(', ') : '', |
| | | placement: 'bottomLeft', |
| | | required: false, |
| | | readonly: false, |
| | | rules: rules |
| | | }, |
| | | { |
| | | type: 'datasource', |
| | | key: 'dataresource', |
| | | label: '数据源', |
| | | initVal: setting.dataresource || '', |
| | | tooltip: '使用系统函数时,需填写数据源。注:数据权限替换符 $@ -> /* 或 \'\'、 @$ -> */ 或 \'\'', |
| | | help: '数据ID:' + MenuID, |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: _patten, |
| | | message: formRule.func.innerMessage |
| | | }, { |
| | | max: formRule.func.max, |
| | | message: formRule.func.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'valueField', |
| | | label: 'Value', |
| | | initVal: setting.valueField || '', |
| | | tooltip: '数据值字段。', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'labelField', |
| | | label: 'Label', |
| | | initVal: setting.labelField || '', |
| | | tooltip: '显示文字字段。', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'parentField', |
| | | label: 'Parent', |
| | | initVal: setting.parentField || '', |
| | | tooltip: '父级字段。', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | pattern: formRule.field.pattern, |
| | | message: formRule.field.message |
| | | }, { |
| | | max: formRule.field.max, |
| | | message: formRule.field.maxMessage |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'order', |
| | | label: '排序', |
| | | initVal: setting.order || '', |
| | | placeholder: 'ID asc, UID desc', |
| | | required: true, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'mark', |
| | | label: '顶级标识', |
| | | initVal: setting.mark || '', |
| | | tooltip: '父级字段值与顶级标识相同时,视为顶级节点。', |
| | | required: false, |
| | | readonly: false, |
| | | rules: [ |
| | | { |
| | | max: formRule.input.max, |
| | | message: formRule.input.message |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 2, |
| | | max: 12, |
| | | label: '宽度', |
| | | tooltip: '栅格布局,每行等分为24列,树形比例可设置为2-12(最大50%)', |
| | | initVal: setting.width || 5, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchable', |
| | | label: '搜索', |
| | | initVal: setting.searchable || 'true', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '显示' }, |
| | | { value: 'false', text: '隐藏' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'default', |
| | | label: '默认sql', |
| | | initVal: setting.default || 'true', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '执行' }, |
| | | { value: 'false', text: '不执行' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'showIcon', |
| | | label: '显示图标', |
| | | initVal: setting.showIcon || 'false', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'showLine', |
| | | label: '显示分割线', |
| | | initVal: setting.showLine || 'false', |
| | | required: false, |
| | | readonly: false, |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取搜索条件表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | |
| | | text: '数据源' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'setAll', |
| | | // label: '设置全部', |
| | | // initVal: card.setAll || 'true', |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: '是' |
| | | // }, { |
| | | // value: 'false', |
| | | // text: '否' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | | * @param {*} card 编辑按钮 |
| | | * @param {*} config 页面配置 |
| | | * @param {*} usefulFields 存储过程可用的开始字段 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | */ |
| | | export function getActionForm (card, config, usefulFields, type, menulist = [], printTemps = [], tabs = []) { |
| | | let columns = (config.columns || []).filter(col => col.field) |
| | | |
| | | let opentypes = [ |
| | | { |
| | | value: 'pop', |
| | | text: '弹窗(表单)' |
| | | }, { |
| | | value: 'prompt', |
| | | text: '提示框' |
| | | }, { |
| | | value: 'exec', |
| | | text: '直接执行' |
| | | }, { |
| | | value: 'excelIn', |
| | | text: '导入Excel' |
| | | }, { |
| | | value: 'excelOut', |
| | | text: '导出Excel' |
| | | }, { |
| | | value: 'popview', |
| | | text: '弹窗(标签)' |
| | | }, { |
| | | value: 'tab', |
| | | text: '标签页' |
| | | }, { |
| | | value: 'innerpage', |
| | | text: '新页面' |
| | | }, { |
| | | value: 'funcbutton', |
| | | text: '功能按钮' |
| | | } |
| | | ] |
| | | |
| | | if (card.execSuccess === 'view' || card.execSuccess === 'refresh') { // refresh为表单标签页 |
| | | card.execSuccess = 'grid' |
| | | } |
| | | if (card.execError === 'view' || card.execError === 'refresh') { |
| | | card.execError = 'grid' |
| | | } |
| | | if (card.popClose === 'view') { |
| | | card.popClose = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'outerpage') { |
| | | card.pageTemplate = 'custom' |
| | | card.OpenType = 'innerpage' |
| | | } |
| | | |
| | | let refresh = [] |
| | | |
| | | if (type === 'subtable') { // 子表页面,可设置刷新主表及同级标签 |
| | | if (card.focus) { |
| | | card.popClose = 'maingrid' |
| | | } |
| | | refresh.push({ |
| | | value: 'maingrid', |
| | | text: '刷新主表(行)' |
| | | }, { |
| | | value: 'equaltab', |
| | | text: '刷新同级标签' |
| | | }) |
| | | } else if (card.execSuccess === 'maingrid') { |
| | | card.execSuccess = 'grid' |
| | | } |
| | | |
| | | if (card.OpenType === 'blank') { |
| | | card.OpenType = 'tab' |
| | | } |
| | | if (!card.control && card.controlField) { |
| | | card.control = 'disabled' |
| | | } |
| | | |
| | | if (card.intertype === 'outer' && !card.procMode && !card.innerFunc) { // 兼容外部函数直传类型 |
| | | card.procMode = 'none' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'select', |
| | | key: 'OpenType', |
| | | label: '打开方式', |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: opentypes |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '按钮名称', |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'funcType', |
| | | label: '功能类型', |
| | | initVal: card.funcType || '', |
| | | required: true, |
| | | options: [{ |
| | | value: 'print', |
| | | text: '标签打印' |
| | | }, { |
| | | value: 'refund', |
| | | text: '退款' |
| | | }, { |
| | | value: 'changeuser', |
| | | text: '切换用户' |
| | | }, { |
| | | value: 'closetab', |
| | | text: '标签关闭' |
| | | }, { |
| | | value: 'megvii', |
| | | text: '旷视面板机' |
| | | }, { |
| | | value: 'filezip', |
| | | text: '文件压缩包' |
| | | }] |
| | | }, |
| | | { // 旷视面板机接口 待扩展 |
| | | type: 'radio', |
| | | key: 'subFunc', |
| | | label: '接口名称', |
| | | initVal: card.subFunc || 'addUser', |
| | | required: true, |
| | | options: [ |
| | | { value: 'addUser', text: '添加用户' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'execMode', |
| | | label: '执行方式', |
| | | initVal: card.execMode || 'exec', |
| | | required: true, |
| | | options: [{ |
| | | value: 'exec', |
| | | text: '直接执行' |
| | | }, { |
| | | value: 'prompt', |
| | | text: '提示框' |
| | | }, { |
| | | value: 'pop', |
| | | text: '弹窗(表单)' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'intertype', |
| | | label: '接口类型', |
| | | initVal: card.intertype || 'system', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'procMode', |
| | | label: '参数处理', |
| | | initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), |
| | | tooltip: '当返回值存在 mk_ex_invoke 且值为 false 时,不会调用外部接口。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'system', |
| | | text: '系统函数' |
| | | }, { |
| | | value: 'inner', |
| | | text: '内部函数' |
| | | }, { |
| | | value: 'none', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sqlType', |
| | | label: '操作类型', |
| | | initVal: card.sqlType || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sql', |
| | | label: '表名', |
| | | initVal: card.sql || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: '内部函数', |
| | | initVal: card.innerFunc || '', |
| | | tooltip: usefulFields.length ? `函数名称需以${usefulFields.join(', ')}等字符开始。` : '', |
| | | fields: usefulFields, |
| | | required: card.intertype === 'inner', |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'urlkey', |
| | | label: '地址字段', |
| | | initVal: card.urlkey || '', |
| | | tooltip: '图片(文件)链接的字段名。', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [ |
| | | { |
| | | value: '', |
| | | text: '新建' |
| | | }, |
| | | ...tabs |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'pageTemplate', |
| | | label: '页面类型', |
| | | initVal: card.pageTemplate || '', |
| | | required: true, |
| | | options: [{ |
| | | // value: 'print', |
| | | // text: '标签打印模板' |
| | | // }, { |
| | | // value: 'billprintTemp', |
| | | // text: '单据打印模板' |
| | | // }, { |
| | | value: 'billprint', |
| | | text: '单据打印' |
| | | }, { |
| | | value: 'pay', |
| | | text: '支付' |
| | | }, { |
| | | value: 'custom', |
| | | text: '自定义' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'printTemp', |
| | | label: '打印模板', |
| | | initVal: card.printTemp || '', |
| | | required: true, |
| | | options: printTemps |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'url', |
| | | label: '页面地址', |
| | | initVal: card.url || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sysInterface', |
| | | label: '系统接口', |
| | | initVal: card.sysInterface || 'false', |
| | | tooltip: '单点登录系统', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'outerFunc', |
| | | label: '外部函数', |
| | | initVal: card.outerFunc || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'interface', |
| | | label: '测试地址', |
| | | initVal: card.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (card.interface || ''), |
| | | required: true, |
| | | readonly: card.sysInterface === 'true' |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'proInterface', |
| | | label: '正式地址', |
| | | initVal: card.proInterface || '', |
| | | tooltip: '正式系统所使用的接口地址。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'callbackType', |
| | | label: '回调方式', |
| | | initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), |
| | | tooltip: '使用后台脚本执行时,需要配合计划任务。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'script', |
| | | text: '自定义脚本' |
| | | }, { |
| | | value: 'default', |
| | | text: '后台脚本' |
| | | }, { |
| | | value: 'func', |
| | | text: '回调函数' |
| | | }, { |
| | | value: 'none', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'cbTable', |
| | | label: '回调表名', |
| | | initVal: card.cbTable || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'callbackFunc', |
| | | label: '回调函数', |
| | | initVal: card.callbackFunc || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'method', |
| | | label: '请求方式', |
| | | initVal: card.method || 'post', |
| | | required: true, |
| | | options: [{ |
| | | value: 'get', |
| | | text: 'GET' |
| | | }, { |
| | | value: 'post', |
| | | text: 'POST' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'cross', |
| | | label: '接口跨域', |
| | | initVal: card.cross || 'true', |
| | | tooltip: '如果自定义接口不支持跨域请求,会通过当前系统转发。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '支持' |
| | | }, { |
| | | value: 'false', |
| | | text: '不支持' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'stringify', |
| | | label: '序列化', |
| | | initVal: card.stringify || 'text', |
| | | required: false, |
| | | options: [{ |
| | | value: 'text', |
| | | text: 'Text' |
| | | }, { |
| | | value: 'JSON', |
| | | text: 'JSON' |
| | | }, { |
| | | value: 'qs', |
| | | text: 'qs' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'position', |
| | | label: '显示位置', |
| | | initVal: card.position || 'toolbar', |
| | | required: true, |
| | | options: [{ |
| | | value: 'toolbar', |
| | | text: '工具栏' |
| | | }, { |
| | | value: 'grid', |
| | | text: '表格' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Ot', |
| | | label: '行设置', |
| | | initVal: card.Ot || 'requiredSgl', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'linkmenu', |
| | | label: '关联菜单', |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'refreshTab', |
| | | label: '刷新标签', |
| | | initVal: card.refreshTab || [], |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execSuccess', |
| | | label: '成功后', |
| | | initVal: card.execSuccess || 'grid', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'execError', |
| | | label: '失败后', |
| | | initVal: card.execError || 'never', |
| | | tooltip: '选择刷新行时,如果选择多条数据会刷新表格。如需语音播报请以@speak@开头,播报内容或文件放置于<<>>中。', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'line', |
| | | text: '刷新行' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: refresh.length === 0 ? 'radio' : 'select', |
| | | key: 'popClose', |
| | | label: '关闭后', |
| | | initVal: card.popClose || 'grid', |
| | | required: true, |
| | | options: [{ |
| | | value: 'never', |
| | | text: '不刷新' |
| | | }, { |
| | | value: 'grid', |
| | | text: '刷新表格' |
| | | }, |
| | | ...refresh] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'resetPageIndex', |
| | | label: '刷新时', |
| | | initVal: card.resetPageIndex || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '重置页码' |
| | | }, { |
| | | value: 'false', |
| | | text: '不重置' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'class', |
| | | label: '颜色', |
| | | initVal: card.class, |
| | | required: false, |
| | | options: btnClasses |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'openmenu', |
| | | label: '打开菜单', |
| | | initVal: card.openmenu || [], |
| | | tooltip: '执行成功后需要打开的菜单。', |
| | | required: false, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'output', |
| | | label: '返回值', |
| | | tooltip: '执行成功后的返回值。系统函数可指定返回的变量(以@符开头,返回id时可使用@id@);自定义函数可指定返回字段(如id)。', |
| | | initVal: card.output || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tipTitle', |
| | | label: '确认提示', |
| | | initVal: card.tipTitle || '', |
| | | tooltip: '注:弹窗(表单)在显示为是否框时有效。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'sheet', |
| | | label: '表名', |
| | | initVal: card.sheet || config.setting.tableName || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pagination', |
| | | label: '分页', |
| | | initVal: card.pagination || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'search', |
| | | label: '搜索条件', |
| | | initVal: card.search || 'false', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '必填' |
| | | }, { |
| | | value: 'false', |
| | | text: '非必填' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示方式', |
| | | initVal: card.display || 'modal', |
| | | required: true, |
| | | options: [{ |
| | | value: 'modal', |
| | | text: '模态框' |
| | | }, { |
| | | value: 'drawer', |
| | | text: '抽屉' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'ratio', |
| | | min: 1, |
| | | max: 3000, |
| | | precision: 0, |
| | | label: '比例', |
| | | initVal: card.ratio || 85, |
| | | tooltip: '模态框或抽屉的宽度,小于100为窗口宽度(或高度)百分比,大于100为像素值。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'placement', |
| | | label: '弹出方向', |
| | | initVal: card.placement || 'right', |
| | | required: false, |
| | | options: [{ |
| | | value: 'right', |
| | | text: '右侧' |
| | | }, { |
| | | value: 'left', |
| | | text: '左侧' |
| | | }, { |
| | | value: 'top', |
| | | text: '上侧' |
| | | }, { |
| | | value: 'bottom', |
| | | text: '下侧' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'clickouter', |
| | | label: '点击蒙层', |
| | | initVal: card.clickouter || 'unclose', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unclose', |
| | | text: '不关闭' |
| | | }, { |
| | | value: 'close', |
| | | text: '关闭' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'control', |
| | | label: '按钮控制', |
| | | initVal: card.control || '', |
| | | required: false, |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'disabled', |
| | | text: '禁用' |
| | | }, { |
| | | value: 'hidden', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'controlField', |
| | | label: '控制字段', |
| | | tooltip: '控制字段,可根据数据控制按钮的隐藏或禁用。', |
| | | initVal: card.controlField || '', |
| | | required: true, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'controlVal', |
| | | label: '控制值', |
| | | tooltip: '当选择控制字段,且字段值与控制值相等时,按钮会隐藏或禁用,多个值用逗号分隔。', |
| | | initVal: card.controlVal || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'reason', |
| | | label: '禁用原因', |
| | | initVal: card.reason || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'hidden', |
| | | label: '隐藏', |
| | | initVal: card.hidden || 'false', |
| | | tooltip: '隐藏后按钮在页面中不显示,且不参与权限分配。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'false', |
| | | text: '否' |
| | | }, { |
| | | value: 'true', |
| | | text: '是' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'progress', |
| | | label: '进度提示', |
| | | initVal: card.progress || 'number', |
| | | required: false, |
| | | options: [{ |
| | | value: 'number', |
| | | text: '剩余数' |
| | | }, { |
| | | value: 'progressbar', |
| | | text: '进度条' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取显示列表单配置信息 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} menulist // 菜单列表-用于字段透视 |
| | | */ |
| | | export function getColumnForm (card, menulist = [], fields = []) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { |
| | | card.perspective = '' |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '名称', |
| | | initVal: card.label, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: '字段', |
| | | initVal: card.field, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: '类型', |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | value: 'text', |
| | | text: '文本' |
| | | }, { |
| | | value: 'number', |
| | | text: '数字' |
| | | }, { |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'video', |
| | | text: '视频' |
| | | }, { |
| | | value: 'link', |
| | | text: '链接' |
| | | }, { |
| | | value: 'textarea', |
| | | text: '多行文本' |
| | | }, { |
| | | value: 'index', |
| | | text: '序号' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'nameField', |
| | | label: '名称字段', |
| | | initVal: card.nameField, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | min: 1, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '列宽', |
| | | initVal: card.Width, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'joint', |
| | | label: '拼接参数', |
| | | initVal: card.joint || 'true', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: '隐藏', |
| | | initVal: card.Hide || 'false', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'IsSort', |
| | | label: '排序', |
| | | initVal: card.IsSort || 'true', |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Align', |
| | | label: '对齐方式', |
| | | initVal: card.Align || 'left', |
| | | required: true, |
| | | options: [{ |
| | | value: 'left', |
| | | text: '左对齐' |
| | | }, { |
| | | value: 'center', |
| | | text: '居中' |
| | | }, { |
| | | value: 'right', |
| | | text: '右对齐' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'startTime', |
| | | precision: 0, |
| | | label: '开始时间', |
| | | initVal: card.startTime || 0, |
| | | tooltip: '视频开始播放的时间,用于调整视频初始化展示的界面。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'aspectRatio', |
| | | label: '长宽比', |
| | | initVal: card.aspectRatio || '16:9', |
| | | required: true, |
| | | options: [ |
| | | { value: '4:3', text: '4:3' }, |
| | | { value: '16:9', text: '16:9' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'rowspan', |
| | | label: '行合并', |
| | | initVal: card.rowspan || 'false', |
| | | tooltip: '相邻行信息相同时,单元格合并。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'sum', |
| | | label: '显示合计', |
| | | initVal: card.sum || 'false', |
| | | tooltip: '合计信息只在使用系统数据源,且当前列未隐藏时有效。', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'decimal', |
| | | min: 0, |
| | | max: 18, |
| | | decimal: 0, |
| | | label: '小数位', |
| | | initVal: card.decimal || 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fieldlength', |
| | | label: '字段长度', |
| | | initVal: card.fieldlength || (card.type === 'text' ? 50 : 512), |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'format', |
| | | label: '格式化', |
| | | initVal: card.format || 'none', |
| | | options: [{ |
| | | value: 'none', |
| | | text: '无' |
| | | }, { |
| | | value: 'thdSeparator', |
| | | text: '千分位' |
| | | }, { |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'abs', |
| | | text: '绝对值' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'textFormat', |
| | | label: '格式化', |
| | | initVal: card.textFormat || 'none', |
| | | options: [{ |
| | | value: 'none', |
| | | text: '无' |
| | | }, { |
| | | value: 'encryption', |
| | | text: '加密' |
| | | }, { |
| | | value: 'YYYY-MM-DD', |
| | | text: 'YYYY-MM-DD' |
| | | }, { |
| | | value: 'YYYY-MM-DD HH:mm:ss', |
| | | text: 'YYYY-MM-DD HH:mm:ss' |
| | | }], |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'prefix', |
| | | label: '前缀', |
| | | initVal: card.prefix || '', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'postfix', |
| | | label: '后缀', |
| | | initVal: card.postfix || '', |
| | | tooltipClass: 'middle', |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'span', |
| | | min: 1, |
| | | max: 24, |
| | | precision: 0, |
| | | label: '图片宽度', |
| | | initVal: card.span || 24, |
| | | tooltip: '栅格布局,等分为24份。', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'lenWidRadio', |
| | | label: '长宽比', |
| | | initVal: card.lenWidRadio || '1:1', |
| | | required: true, |
| | | options: [ |
| | | { value: '1:1', text: '1:1' }, |
| | | { value: '4:3', text: '4:3' }, |
| | | { value: '3:2', text: '3:2' }, |
| | | { value: '16:9', text: '16:9' }, |
| | | { value: '2:1', text: '2:1' }, |
| | | { value: '3:1', text: '3:1' }, |
| | | { value: '4:1', text: '4:1' }, |
| | | { value: '5:1', text: '5:1' }, |
| | | { value: '6:1', text: '6:1' }, |
| | | { value: '7:1', text: '7:1' }, |
| | | { value: '8:1', text: '8:1' }, |
| | | { value: '9:1', text: '9:1' }, |
| | | { value: '10:1', text: '10:1' }, |
| | | { value: '3:4', text: '3:4' }, |
| | | { value: '2:3', text: '2:3' }, |
| | | { value: '9:16', text: '9:16' }, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'scale', |
| | | label: '点击缩放', |
| | | initVal: card.scale || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'perspective', |
| | | label: '字段透视', |
| | | initVal: card.perspective || '', |
| | | options: [{ |
| | | value: '', |
| | | text: '无' |
| | | }, { |
| | | value: 'linkmenu', |
| | | text: '菜单' |
| | | }, { |
| | | value: 'linkurl', |
| | | text: '链接' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | key: 'linkmenu', |
| | | label: '菜单', |
| | | initVal: card.linkmenu || [], |
| | | required: true, |
| | | options: menulist |
| | | }, |
| | | { |
| | | type: 'textarea', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkfields', |
| | | label: '关联字段', |
| | | initVal: card.linkfields || [], |
| | | required: false, |
| | | options: fields |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取图表视图外部配置表单 |
| | | * @param {object} card // 搜索条件对象 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {Array} actions // 按钮组excel |
| | | * @param {Array} extraActions // 常规按钮 |
| | | */ |
| | | export function getChartViewForm (card, _columns, actions, extraActions) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | if (roleList) { |
| | | try { |
| | | roleList = JSON.parse(roleList) |
| | | } catch (e) { |
| | | roleList = [] |
| | | } |
| | | } else { |
| | | roleList = [] |
| | | } |
| | | |
| | | let _charts = [{ |
| | | value: 'line', |
| | | text: '折线图' |
| | | }, { |
| | | value: 'bar', |
| | | text: '柱状图' |
| | | }, { |
| | | value: 'pie', |
| | | text: '饼图' |
| | | }, { |
| | | value: 'card', |
| | | text: '卡片' |
| | | }] |
| | | |
| | | if (card.chartType === 'table') { |
| | | _charts = [{ |
| | | value: 'table', |
| | | text: '表格' |
| | | }] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'title', |
| | | label: '标题', |
| | | initVal: card.title, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'chartType', |
| | | label: '图表类型', |
| | | initVal: card.chartType, |
| | | required: true, |
| | | readonly: card.chartType === 'table', |
| | | options: _charts |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 100, |
| | | max: 1000, |
| | | decimal: 0, |
| | | label: '高度', |
| | | initVal: card.height || 400, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: '隐藏', |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '图表宽度', |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.width || 24, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'cardWidth', |
| | | min: 1, |
| | | max: 24, |
| | | decimal: 0, |
| | | label: '卡片宽度', |
| | | tooltip: '栅格布局,每行等分为24列。', |
| | | initVal: card.cardWidth || 6, |
| | | hidden: true, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'bgfield', |
| | | label: '背景控制', |
| | | initVal: card.bgfield || '', |
| | | required: false, |
| | | readonly: false, |
| | | hidden: true, |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'border', |
| | | label: '边框', |
| | | initVal: card.border || 'show', |
| | | required: false, |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'show', |
| | | text: '显示' |
| | | }, { |
| | | value: 'hidden', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'switch', |
| | | label: '数据切换', |
| | | initVal: card.switch || 'true', |
| | | required: false, |
| | | hidden: true, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'extraAction', |
| | | label: '扩展卡片', |
| | | initVal: card.extraAction || '', |
| | | tooltip: '绑定不选行的按钮,卡片尾部会增加功能卡片', |
| | | required: false, |
| | | options: extraActions |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | | initVal: card.blacklist || [], |
| | | required: false, |
| | | options: roleList |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'actions', |
| | | label: '扩展按钮', |
| | | initVal: card.actions || [], |
| | | tooltip: '可绑定已有的excel导入、导出按钮', |
| | | required: false, |
| | | options: actions |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取图表视图配置表单 |
| | | * @param {object} card // 图表对象 |
| | | * @param {Array} columns // 显示列 |
| | | * @param {String} setting // 页面设置 |
| | | */ |
| | | export function getChartOptionForm (card, columns, setting) { |
| | | let shapes = [] |
| | | |
| | | if (card.chartType === 'line') { |
| | | shapes = [ |
| | | { field: 'smooth', label: 'smooth' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'dot', label: 'dot' }, |
| | | { field: 'dash', label: 'dash' }, |
| | | { field: 'hv', label: 'hv' }, |
| | | { field: 'vh', label: 'vh' }, |
| | | { field: 'hvh', label: 'hvh' }, |
| | | { field: 'vhv', label: 'vhv' } |
| | | ] |
| | | } else if (card.chartType === 'bar') { |
| | | shapes = [ |
| | | { field: 'rect', label: 'rect' }, |
| | | { field: 'hollow-rect', label: 'hollow-rect' }, |
| | | { field: 'line', label: 'line' }, |
| | | { field: 'tick', label: 'tick' }, |
| | | { field: 'funnel', label: 'funnel' }, |
| | | { field: 'pyramid', label: 'pyramid' } |
| | | ] |
| | | } else if (card.chartType === 'pie') { |
| | | shapes = [ |
| | | { field: 'pie', label: '饼图' }, |
| | | { field: 'ring', label: '环图' } |
| | | ] |
| | | } |
| | | |
| | | return [ |
| | | { |
| | | type: 'radio', |
| | | key: 'datatype', |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'query', |
| | | tooltip: '统计图表适用于表格不分页,且数据需要转换', |
| | | required: false, |
| | | readonly: !(setting.laypage === 'false'), |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [ |
| | | { value: 'query', text: '查询' }, |
| | | { value: 'statistics', text: '统计' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Xaxis', |
| | | label: card.chartType === 'pie' ? 'Text' : 'X-轴', |
| | | initVal: card.Xaxis || '', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Yaxis', |
| | | label: card.chartType === 'pie' ? 'Value' : 'Y-轴', |
| | | initVal: card.chartType === 'pie' ? card.Yaxis || '' : card.Yaxis || [], |
| | | multi: card.chartType !== 'pie', |
| | | hidden: card.datatype === 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'InfoType', |
| | | label: '类型', |
| | | initVal: card.InfoType || '', |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'text') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'InfoValue', |
| | | label: '值', |
| | | initVal: card.InfoValue || '', |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true, |
| | | options: columns.filter(col => col.type === 'number') |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'legend', |
| | | label: '图例位置', |
| | | initVal: card.legend || 'bottom', |
| | | required: false, |
| | | options: [ |
| | | { field: 'top', label: 'top' }, |
| | | { field: 'top-left', label: 'top-left' }, |
| | | { field: 'top-right', label: 'top-right' }, |
| | | { field: 'right', label: 'right' }, |
| | | { field: 'right-top', label: 'right-top' }, |
| | | { field: 'right-bottom', label: 'right-bottom' }, |
| | | { field: 'left', label: 'left' }, |
| | | { field: 'left-top', label: 'left-top' }, |
| | | { field: 'left-bottom', label: 'left-bottom' }, |
| | | { field: 'bottom', label: 'bottom' }, |
| | | { field: 'bottom-left', label: 'bottom-left' }, |
| | | { field: 'bottom-right', label: 'bottom-right' }, |
| | | { field: 'hidden', label: 'hidden' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'shape', |
| | | label: '形状', |
| | | initVal: card.shape || (shapes[0] && shapes[0].field), |
| | | required: false, |
| | | forbid: !['line', 'bar', 'pie'].includes(card.chartType), |
| | | options: shapes |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'tooltip', |
| | | label: '提示信息', |
| | | initVal: card.tooltip || 'true', |
| | | required: false, |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'coordinate', |
| | | label: '坐标', |
| | | initVal: card.coordinate || 'angle', |
| | | required: false, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'angle', |
| | | text: '二维坐标' |
| | | }, { |
| | | value: 'polar', |
| | | text: '极坐标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'point', |
| | | label: '点图', |
| | | initVal: card.point || 'false', |
| | | required: false, |
| | | forbid: !['line'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'transpose', |
| | | label: '变换', |
| | | initVal: card.transpose || 'false', |
| | | required: false, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '是' |
| | | }, { |
| | | value: 'false', |
| | | text: '否' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'pieshow', |
| | | label: '显示值', |
| | | initVal: card.pieshow || 'percent', |
| | | required: false, |
| | | forbid: !['pie'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'percent', |
| | | text: '百分比' |
| | | }, { |
| | | value: 'value', |
| | | text: '数值' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'label', |
| | | label: '标注-值', |
| | | initVal: card.label || (card.chartType === 'pie' ? 'true' : 'false'), |
| | | required: false, |
| | | forbid: !['pie', 'bar', 'line'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '显示' |
| | | }, { |
| | | value: 'false', |
| | | text: '隐藏' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'labelLayout', |
| | | label: '标签布局', |
| | | initVal: card.labelLayout || 'normal', |
| | | required: false, |
| | | forbid: !['pie'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '常规' |
| | | }, { |
| | | value: 'overlap', |
| | | text: '防重叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'adjust', |
| | | label: '多柱排列', |
| | | initVal: card.adjust || 'dodge', |
| | | required: false, |
| | | forbid: !['bar'].includes(card.chartType), |
| | | options: [{ |
| | | value: 'dodge', |
| | | text: '分组' |
| | | }, { |
| | | value: 'stack', |
| | | text: '堆叠' |
| | | }] |
| | | }, { |
| | | type: 'radio', |
| | | key: 'repeat', |
| | | label: '重复数据', |
| | | initVal: card.repeat || 'unrepeat', |
| | | required: false, |
| | | options: [{ |
| | | value: 'unrepeat', |
| | | text: '去重' |
| | | }, { |
| | | value: 'average', |
| | | text: '平均' |
| | | }, { |
| | | value: 'cumsum', |
| | | text: '累加' |
| | | }] |
| | | }, { |
| | | type: 'number', |
| | | key: 'InfoDefNumber', |
| | | label: '展示数', |
| | | tooltip: '默认显示类型数量', |
| | | min: 1, |
| | | max: 50, |
| | | decimal: 0, |
| | | initVal: card.InfoDefNumber || 5, |
| | | forbid: !['line', 'bar'].includes(card.chartType), |
| | | hidden: card.datatype !== 'statistics', |
| | | required: true |
| | | }, { |
| | | type: 'number', |
| | | key: 'barSize', |
| | | label: '柱形宽度', |
| | | tooltip: '空值时,宽度自适应。', |
| | | min: 5, |
| | | max: 100, |
| | | decimal: 0, |
| | | initVal: card.barSize, |
| | | forbid: !['bar'].includes(card.chartType), |
| | | required: false |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表单配置信息 |
| | | * @param {*} card // 表单对象 |
| | | * @param {*} inputfields // 可写入表单 |
| | |
| | | text: '16:9' |
| | | }] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // key: 'setAll', |
| | | // label: '设置空值', |
| | | // initVal: card.setAll || 'false', |
| | | // options: [{ |
| | | // value: 'true', |
| | | // text: '是' |
| | | // }, { |
| | | // value: 'false', |
| | | // text: '否' |
| | | // }] |
| | | // }, |
| | | { |
| | | type: 'codemirror', |
| | | key: 'dataSource', |
| | |
| | | {value: 'left', text: '居左'}, |
| | | {value: 'center', text: '居中'}, |
| | | {value: 'right', text: '居右'}, |
| | | // {value: 'justify', text: 'justify'} |
| | | ], |
| | | render: (text, record) => { |
| | | if (text === 'center') { |
| | |
| | | options: roleList, |
| | | forbid: appType === 'mob' |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取子菜单基本信息表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {string} supMenu // 上级菜单ID |
| | | * @param {array} menus // 可选的上级菜单列表 |
| | | * @param {array} equalTab // 同级菜单IDs |
| | | * @param {array} equalTabs // 可选的同级菜单列表 |
| | | * @param {string} type // 菜单类型,主表或树形结构 |
| | | */ |
| | | export function getTabForm (card, supMenu, menus, equalTab, equalTabs, type) { |
| | | return [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '标签名称', |
| | | initVal: card.label || '', |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkTab', |
| | | label: '关联标签', |
| | | initVal: card.linkTab || '', |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'icon', |
| | | key: 'icon', |
| | | label: '图标', |
| | | initVal: card.icon || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'supMenu', |
| | | label: '上级标签', |
| | | initVal: supMenu, |
| | | required: false, |
| | | options: menus |
| | | }, |
| | | { |
| | | type: 'mutilselect', |
| | | key: 'equalTab', |
| | | label: '同级标签', |
| | | tooltip: '如果子标签中含有刷新同级标签的按钮,在此处添加需要刷新的标签。', |
| | | initVal: equalTab, |
| | | required: false, |
| | | options: equalTabs |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'foreignKey', |
| | | label: '外键', |
| | | tooltip: '外键旨在标签页中执行默认函数(添加)时,替换BID字段', |
| | | initVal: card.foreignKey || '', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'level', |
| | | label: '显示级别', |
| | | tooltip: '标签显示控制,选择指定级别时显示标签,级别为空时始终显示。', |
| | | initVal: card.level, |
| | | min: 0, |
| | | max: 10, |
| | | required: false, |
| | | forbid: type !== 'TreePage', |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'searchPass', |
| | | label: '主表搜索', |
| | | initVal: card.searchPass || 'false', |
| | | tooltip: '使用主表搜索条件时,主表的搜索条件会传入子表中。', |
| | | required: false, |
| | | forbid: type !== 'CommonTable', |
| | | options: [{ |
| | | value: 'true', |
| | | text: '使用' |
| | | }, { |
| | | value: 'false', |
| | | text: '不使用' |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | |
| | | /** |
| | | * @description 获取卡片详情表单配置信息 |
| | | * @param {object} card // 标签配置信息 |
| | | * @param {array} _columns // 显示列 |
| | | * @param {string} _type // 类型,卡片的部位 |
| | | * @param {array} _actions // 按钮列表 |
| | | */ |
| | | export function getCardDetailForm (card, _columns, _type, _actions = []) { |
| | | let actions = '' |
| | | if (_type === 'bottom') { |
| | | actions = card.actions ? card.actions.map(cell => cell.value) : [] |
| | | } else if (_type === 'header') { |
| | | _actions.unshift({ |
| | | value: '', |
| | | text: '空' |
| | | }) |
| | | actions = card.actions[0] ? card.actions[0].value : '' |
| | | } |
| | | return [ |
| | | { |
| | | type: 'radio', |
| | | key: 'datatype', |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'dynamic', |
| | | required: true, |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'dynamic', |
| | | text: '动态' |
| | | }, { |
| | | value: 'static', |
| | | text: '静态' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'type', |
| | | label: '类型', |
| | | initVal: card.type || 'picture', |
| | | required: true, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'picture', |
| | | text: '图片' |
| | | }, { |
| | | value: 'icon', |
| | | text: '图标' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'content', |
| | | label: '内容', |
| | | initVal: card.content || '', |
| | | required: _type !== 'header', |
| | | forbid: !['detail', 'header'].includes(_type), |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'field', |
| | | label: '字段', |
| | | initVal: card.field || '', |
| | | required: true, |
| | | forbid: !['detail', 'header', 'avatar'].includes(_type), |
| | | options: _columns |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'fontSize', |
| | | min: 12, |
| | | max: 50, |
| | | label: '字体大小', |
| | | initVal: card.fontSize || 14, |
| | | required: true, |
| | | forbid: !['detail'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'fontWeight', |
| | | label: '字体粗细', |
| | | initVal: card.fontWeight || 'normal', |
| | | required: true, |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'normal', |
| | | text: '正常' |
| | | }, { |
| | | value: 'bold', |
| | | text: 'bold' |
| | | }, { |
| | | value: 'bolder', |
| | | text: 'bolder' |
| | | }, { |
| | | value: 'lighter', |
| | | text: 'lighter' |
| | | }, { |
| | | value: '100', |
| | | text: '100' |
| | | }, { |
| | | value: '200', |
| | | text: '200' |
| | | }, { |
| | | value: '300', |
| | | text: '300' |
| | | }, { |
| | | value: '400', |
| | | text: '400' |
| | | }, { |
| | | value: '500', |
| | | text: '500' |
| | | }, { |
| | | value: '600', |
| | | text: '600' |
| | | }, { |
| | | value: '700', |
| | | text: '700' |
| | | }, { |
| | | value: '800', |
| | | text: '800' |
| | | }, { |
| | | value: '900', |
| | | text: '900' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'width', |
| | | min: 10, |
| | | max: 100, |
| | | precision: 1, |
| | | label: '宽度(%)', |
| | | initVal: card.width || 100, |
| | | required: true, |
| | | forbid: !['detail', 'avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'height', |
| | | min: 1, |
| | | max: 10, |
| | | label: '高度(行)', |
| | | initVal: card.height || 1, |
| | | required: true, |
| | | forbid: !['detail'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'radius', |
| | | label: '圆角', |
| | | initVal: card.radius || 'true', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'true', |
| | | text: '有' |
| | | }, { |
| | | value: 'false', |
| | | text: '无' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'size', |
| | | label: '字体大小', |
| | | initVal: card.size || 28, |
| | | min: 12, |
| | | max: 500, |
| | | required: false, |
| | | hidden: true, |
| | | forbid: !['avatar'].includes(_type) |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'align', |
| | | label: '对齐', |
| | | initVal: card.align || 'left', |
| | | required: false, |
| | | forbid: !['detail'].includes(_type), |
| | | options: [{ |
| | | value: 'left', |
| | | text: '左' |
| | | }, { |
| | | value: 'align-center', |
| | | text: '居中' |
| | | }, { |
| | | value: 'align-right', |
| | | text: '右' |
| | | }] |
| | | }, |
| | | { |
| | | type: _type === 'bottom' ? 'multiselect' : 'select', |
| | | key: 'actions', |
| | | label: '按钮组', |
| | | tooltip: '', |
| | | initVal: actions, |
| | | required: false, |
| | | forbid: !['header', 'bottom'].includes(_type), |
| | | options: _actions |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'show', |
| | | label: '显示', |
| | | initVal: card.show || 'icon', |
| | | required: false, |
| | | forbid: !['bottom', 'header'].includes(_type), |
| | | options: [{ |
| | | value: 'icon', |
| | | text: '图标' |
| | | }, { |
| | | value: 'text', |
| | | text: '文字' |
| | | }, { |
| | | value: 'all', |
| | | text: '全部' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'display', |
| | | label: '显示', |
| | | initVal: card.display || 'inline', |
| | | required: false, |
| | | forbid: !['avatar'].includes(_type), |
| | | options: [{ |
| | | value: 'block', |
| | | text: '整行' |
| | | }, { |
| | | value: 'inline', |
| | | text: '自动' |
| | | }] |
| | | }, |
| | | ] |
| | | } |
| | |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | | span = 24 |
| | | className = 'text-area' |
| | | |
| | | if (this.record.type === 'select' || this.record.type === 'link') { |
| | | extra = <span className="add-resource-empty" onClick={this.handleEmpty}>空</span> |
| | |
| | | content = <CodeMirror /> |
| | | } else if (item.type === 'textarea') { |
| | | span = 24 |
| | | className = 'text-msg' |
| | | rules = [ |
| | | { required: item.required, message: '请输入' + item.label + '!' } |
| | | ] |
| | |
| | | content = <TextArea rows={item.rows || 4}/> |
| | | } else if (item.type === 'options') { |
| | | span = 24 |
| | | className = 'text-area' |
| | | |
| | | let type = this.record.type |
| | | let linkSubFields = this.record.linkSubField || [] |
| | |
| | | columns.push({ title: 'url', key: '$url', type: 'file' }) |
| | | } else if (this.record.display === 'color') { |
| | | columns.push({ title: 'Color', key: '$color' }) |
| | | extra = <span>使用十六进制色彩代码(HEX)时,请在色值前添加 #</span> |
| | | } |
| | | |
| | | fields.forEach(item => { |
| | |
| | | } |
| | | } else if (item.type === 'fields') { |
| | | span = 24 |
| | | className = 'text-area' |
| | | rules = [ |
| | | { required: item.required, message: '请添加' + item.label + '!' } |
| | | ] |
| | |
| | | padding-left: 6px!important; |
| | | padding-bottom: 20px; |
| | | } |
| | | .ant-form-item.text-area { |
| | | >.ant-form-item-control-wrapper { |
| | | width: 84%; |
| | | } |
| | | >.ant-form-item-label { |
| | | width: 16%; |
| | | } |
| | | .CodeMirror { |
| | | height: 150px; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | .ant-form-item.text-msg { |
| | | >.ant-form-item-label { |
| | | width: 16%; |
| | | } |
| | | >.ant-form-item-control-wrapper { |
| | | width: 84%; |
| | | .ant-col-24 { |
| | | >.ant-form-item { |
| | | >.ant-form-item-label { |
| | | width: 16%; |
| | | } |
| | | >.ant-form-item-control-wrapper { |
| | | width: 84%; |
| | | } |
| | | .CodeMirror { |
| | | height: 150px; |
| | | } |
| | | } |
| | | } |
| | | .ant-radio-group { |
| | |
| | | left: 0px; |
| | | top: -25px; |
| | | font-size: 14px; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | item.cols = loopCol(item.cols) |
| | | |
| | | if (item.colsCtrls) { |
| | | item.colsCtrls = item.colsCtrls.map(col => { |
| | | col.cols = col.cols.map(f => md5(commonId + f)) |
| | | return col |
| | | }) |
| | | } |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | |
| | | } |
| | | |
| | | item.cols = loopCol(item.cols) |
| | | |
| | | if (item.colsCtrls) { |
| | | item.colsCtrls = item.colsCtrls.map(col => { |
| | | col.cols = col.cols.map(f => md5(commonId + f)) |
| | | return col |
| | | }) |
| | | } |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(cell => { |
| | | cell.uuid = this.getuuid() |
| | |
| | | /** |
| | | * @description 获取标记信息 |
| | | */ |
| | | export function getMark (marks, record, style = {}) { |
| | | export function getMark (marks, record, style) { |
| | | let res = {} |
| | | style = JSON.parse(JSON.stringify(style)) |
| | | |
| | | marks.some(mark => { |
| | | let originVal = record[mark.field[0]] |
| | |
| | | if (component.type === 'table') { |
| | | let getColumns = (cols) => { |
| | | return cols.filter(item => { |
| | | if (item.type === 'colspan') { |
| | | if (item.Hide === 'true') return false |
| | | |
| | | if (item.type === 'number') { |
| | | if (typeof(item.decimal) === 'number') { |
| | | item.round = Math.pow(10, item.decimal) |
| | | if (item.format === 'percent') { |
| | | item.decimal = item.decimal > 2 ? item.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (item.type === 'formula') { |
| | | if (typeof(item.decimal) === 'number') { |
| | | item.round = Math.pow(10, item.decimal) |
| | | } |
| | | } else if (item.type === 'colspan') { |
| | | item.subcols = getColumns(item.subcols) |
| | | if (item.subcols.length === 0) { |
| | | return false |
| | |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } else if (cell.eleType === 'formula' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | } |
| | | } |
| | | |