From 742f7d11557526038d332e60a8c8ca18177bc4e4 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 十月 2023 15:51:58 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/templates/zshare/modalform/index.jsx | 5 src/templates/sharecomponent/tabscomponent/formconfig.jsx | 87 src/menu/components/share/markcomponent/index.jsx | 2 src/tabviews/zshare/actionList/popupbutton/index.jsx | 4 src/utils/utils-custom.js | 14 src/menu/datasource/index.jsx | 10 src/tabviews/custom/popview/index.jsx | 2 src/menu/components/table/edit-table/options.jsx | 3 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 16 src/tabviews/basetable/index.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.scss | 30 src/views/billprint/index.jsx | 17 src/menu/components/share/colsControl/markform/index.scss | 18 src/menu/components/share/colsControl/markform/index.jsx | 144 + src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx | 172 + src/tabviews/commontable/index.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 125 + src/menu/datasource/verifycard/index.jsx | 13 src/tabviews/custom/components/card/data-card/index.jsx | 55 src/assets/css/main.scss | 20 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 154 + src/tabviews/custom/components/card/cardcellList/index.jsx | 9 src/tabviews/custom/components/card/prop-card/index.jsx | 2 src/menu/components/card/double-data-card/options.jsx | 14 src/menu/components/card/data-card/options.jsx | 34 src/tabviews/custom/components/table/normal-table/index.jsx | 29 src/mob/components/menubar/normal-menubar/menucomponent/options.jsx | 26 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 236 ++ src/templates/zshare/modalform/index.scss | 36 src/tabviews/custom/index.jsx | 8 src/templates/sharecomponent/columncomponent/formconfig.jsx | 366 +++ src/menu/components/table/normal-table/columns/index.jsx | 9 src/templates/sharecomponent/cardcomponent/formconfig.jsx | 322 +++ src/menu/components/table/edit-table/columns/index.jsx | 10 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 7 src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 10 src/menu/datasource/verifycard/utils.jsx | 6 src/templates/sharecomponent/actioncomponent/formconfig.jsx | 714 +++++++ src/tabviews/custom/components/card/double-data-card/index.scss | 18 src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 2 src/tabviews/custom/components/card/double-data-card/index.jsx | 57 src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx | 2 src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx | 278 ++ src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 10 src/tabviews/custom/components/table/edit-table/index.jsx | 33 src/templates/sharecomponent/columncomponent/index.jsx | 2 src/api/index.js | 2 src/tabviews/custom/components/share/normalTable/index.jsx | 97 src/tabviews/custom/components/form/simple-form/index.jsx | 6 src/templates/sharecomponent/cardcomponent/index.jsx | 2 src/tabviews/custom/components/card/data-card/index.scss | 17 src/templates/sharecomponent/tabscomponent/index.jsx | 2 src/menu/components/share/markcomponent/index.scss | 72 src/utils/utils.js | 3 src/tabviews/custom/components/form/tab-form/index.jsx | 6 src/menu/components/table/base-table/columns/editColumn/index.jsx | 16 src/mob/components/menubar/normal-menubar/menucomponent/index.jsx | 2 src/menu/components/share/colsControl/index.scss | 30 src/templates/zshare/formconfig.jsx | 2165 --------------------- src/menu/datasource/verifycard/settingform/index.jsx | 4 src/tabviews/custom/components/interfaces/interItem/index.jsx | 20 src/templates/sharecomponent/actioncomponent/index.jsx | 2 src/tabviews/custom/components/form/step-form/index.jsx | 6 src/menu/components/share/colsControl/index.jsx | 299 +++ src/templates/sharecomponent/chartgroupcomponent/index.jsx | 2 65 files changed, 3,441 insertions(+), 2,447 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 6bd3102..26b447f 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1138,6 +1138,8 @@ clearTimeout(timer) if (/Shared Memory Provider|浼氳瘽澶勪簬缁堟鐘舵�亅褰撳墠鍛戒护鍙戠敓浜嗕弗閲嶉敊璇�/.test(res.message)) { res.message = '楠岃瘉澶辫触锛岃妫�鏌QL涓槸鍚﹀瓨鍦ㄦ寰幆銆�' + } else if (res.message.indexOf('EXECUTE 鍚庣殑浜嬪姟璁℃暟鎸囩ず BEGIN 鍜� COMMIT 璇彞鐨勬暟鐩笉鍖归厤銆備笂涓�璁℃暟 = 1锛屽綋鍓嶈鏁� = 0') > -1) { + res.ErrCode = '-2' } resolve(res) }, () => { diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 9200e4f..c3dbad3 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -254,6 +254,9 @@ color: #ffffff; } } +.ant-notification .ant-notification-notice-message { + word-break: break-all; +} // 閲嶇疆鎻愮ず妗� .ant-tooltip { @@ -285,6 +288,23 @@ } } +// 娑堟伅鎻愮ず +.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; diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index adc2931..818913d 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -106,6 +106,7 @@ {field: 'broadcast', values: ['dynamic', 'public']}, {field: 'supModule', values: ['static']}, {field: 'publicId', values: ['public']}, + {field: 'emptyExec', values: ['dynamic', 'public']}, ], forbid: subtype !== 'propcard' }, @@ -204,7 +205,7 @@ {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' }, @@ -289,6 +290,19 @@ {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', @@ -401,7 +415,23 @@ 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', diff --git a/src/menu/components/card/double-data-card/options.jsx b/src/menu/components/card/double-data-card/options.jsx index 3bdc566..1941d17 100644 --- a/src/menu/components/card/double-data-card/options.jsx +++ b/src/menu/components/card/double-data-card/options.jsx @@ -91,6 +91,7 @@ controlFields: [ {field: 'selected', values: ['radio', 'checkbox']}, {field: 'selStyle', values: ['radio', 'checkbox']}, + {field: 'pickup', values: ['radio', 'checkbox']}, ], }, { @@ -125,6 +126,19 @@ }, { 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', diff --git a/src/menu/components/share/colsControl/index.jsx b/src/menu/components/share/colsControl/index.jsx new file mode 100644 index 0000000..8b0ec42 --- /dev/null +++ b/src/menu/components/share/colsControl/index.jsx @@ -0,0 +1,299 @@ +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 \ No newline at end of file diff --git a/src/menu/components/share/colsControl/index.scss b/src/menu/components/share/colsControl/index.scss new file mode 100644 index 0000000..ae2b530 --- /dev/null +++ b/src/menu/components/share/colsControl/index.scss @@ -0,0 +1,30 @@ +.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); + } + } +} \ No newline at end of file diff --git a/src/menu/components/share/colsControl/markform/index.jsx b/src/menu/components/share/colsControl/markform/index.jsx new file mode 100644 index 0000000..e718f56 --- /dev/null +++ b/src/menu/components/share/colsControl/markform/index.jsx @@ -0,0 +1,144 @@ +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) \ No newline at end of file diff --git a/src/menu/components/share/colsControl/markform/index.scss b/src/menu/components/share/colsControl/markform/index.scss new file mode 100644 index 0000000..f9a0afb --- /dev/null +++ b/src/menu/components/share/colsControl/markform/index.scss @@ -0,0 +1,18 @@ +.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; + } + } + } + } +} diff --git a/src/menu/components/share/markcomponent/index.jsx b/src/menu/components/share/markcomponent/index.jsx index f198d58..c95abda 100644 --- a/src/menu/components/share/markcomponent/index.jsx +++ b/src/menu/components/share/markcomponent/index.jsx @@ -418,7 +418,7 @@ <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'} diff --git a/src/menu/components/share/markcomponent/index.scss b/src/menu/components/share/markcomponent/index.scss index 9689a82..e92c10a 100644 --- a/src/menu/components/share/markcomponent/index.scss +++ b/src/menu/components/share/markcomponent/index.scss @@ -1,59 +1,25 @@ -#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; } } \ No newline at end of file diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx index aed7101..afb5789 100644 --- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -151,7 +151,7 @@ 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', @@ -162,6 +162,14 @@ }] }, { + type: 'select', + key: 'sortField', + label: '鎺掑簭瀛楁', + initVal: card.sortField || '', + required: true, + options: fields + }, + { type: 'radio', key: 'eval', label: '瑙f瀽鏂瑰紡', diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx index 7318054..3c5bc6b 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -16,7 +16,7 @@ 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'] @@ -95,10 +95,10 @@ } 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 @@ -109,6 +109,10 @@ this.record[key] = value if (key === 'type') { + if (['link', 'textarea', 'picture', 'custom'].includes(value)) { + this.record.IsSort = 'false' + } + let _options = this.getOptions() this.setState({ @@ -126,7 +130,7 @@ 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: ''}) @@ -173,7 +177,7 @@ } } 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({ diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index 0254d8b..da0ea0b 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -133,7 +133,7 @@ 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', @@ -142,6 +142,14 @@ value: 'false', text: '鍚�' }] + }, + { + type: 'select', + key: 'sortField', + label: '鎺掑簭瀛楁', + initVal: card.sortField || '', + required: true, + options: fields }, { type: 'radio', @@ -193,7 +201,7 @@ }] }, { - type: 'radio', + type: 'select', key: 'editType', label: '缂栬緫绫诲瀷', initVal: card.editType || 'text', @@ -210,6 +218,9 @@ }, { value: 'date', text: '鏃ユ湡锛堝ぉ锛�' + }, { + value: 'popSelect', + text: '閫夋嫨鍣�' }] }, { @@ -311,6 +322,141 @@ 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: '鍊悸峰瓧娈�', @@ -404,7 +550,7 @@ { type: 'select', key: 'ctrlField', - label: '绂佺敤瀛楁', + label: '绂佹缂栬緫', initVal: card.ctrlField || '', tooltip: '鎺у埗鍗曞厓鏍兼槸鍚﹀彲浠ョ紪杈戙��', allowClear: true, @@ -414,7 +560,7 @@ { type: 'text', key: 'ctrlValue', - label: '绂佺敤鍊�', + label: '绂佹鍊�', initVal: card.ctrlValue || '', tooltip: '澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', required: false diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx index 9a107bb..baca4f6 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -7,18 +7,20 @@ 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'], @@ -70,11 +72,13 @@ _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') @@ -90,6 +94,8 @@ } 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') @@ -142,6 +148,10 @@ this.record[key] = value if (key === 'type') { + if (['textarea', 'custom'].includes(value)) { + this.record.IsSort = 'false' + } + let _options = this.getOptions() let _field = '' @@ -161,7 +171,9 @@ 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 + '@'}) @@ -203,7 +215,7 @@ } } 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({ @@ -257,8 +269,8 @@ this.props.form.setFieldsValue({dataSource: resource}) } - changeOptions = (data) => { - this.record.options = data || [] + changeOptions = (data, key) => { + this.record[key] = data || [] } getFields() { @@ -303,6 +315,12 @@ 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} @@ -310,7 +328,7 @@ 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> @@ -338,7 +356,6 @@ </Select> } else if (item.type === 'textarea') { span = 24 - className = 'text-area' rules = [ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] @@ -371,9 +388,10 @@ { 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}</> } @@ -381,7 +399,6 @@ content = <CodeMirror /> } else if (item.type === 'options') { span = 24 - className = 'text-area' let linkSubFields = this.record.linkSubField || [] @@ -396,7 +413,14 @@ 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( @@ -495,9 +519,9 @@ } } - if (values.dataSource && /\s/.test(values.dataSource)) { + if (values.dataSource) { let error = Utils.verifySql(values.dataSource) - + if (error) { notification.warning({ top: 92, @@ -506,16 +530,17 @@ }) 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 @@ -533,6 +558,62 @@ }) } }) + } 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) diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.scss b/src/menu/components/table/edit-table/columns/editColumn/index.scss index 05b0e19..82b274d 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.scss +++ b/src/menu/components/table/edit-table/columns/editColumn/index.scss @@ -6,15 +6,22 @@ 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 { @@ -42,11 +49,6 @@ left: 0px; top: -25px; font-size: 14px; - } - >.ant-row >.ant-col { - display: inline-block; - vertical-align: top; - float: none; } } .formula-fields { diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 4897eff..f7d1ef3 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -16,6 +16,7 @@ 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')) @@ -249,13 +250,7 @@ } 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) => { @@ -696,6 +691,7 @@ </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> diff --git a/src/menu/components/table/edit-table/options.jsx b/src/menu/components/table/edit-table/options.jsx index 18fc7a4..cfaf7a2 100644 --- a/src/menu/components/table/edit-table/options.jsx +++ b/src/menu/components/table/edit-table/options.jsx @@ -105,12 +105,13 @@ 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']}, diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index 8dd1c49..ccd6013 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -143,7 +143,7 @@ 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', @@ -154,6 +154,14 @@ }] }, { + type: 'select', + key: 'sortField', + label: '鎺掑簭瀛楁', + initVal: card.sortField || '', + required: true, + options: fields + }, + { type: 'radio', key: 'eval', label: '瑙f瀽鏂瑰紡', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 6f51d09..8c88120 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -17,7 +17,7 @@ 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'] @@ -93,10 +93,10 @@ } 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 @@ -106,6 +106,10 @@ this.record[key] = value if (key === 'type') { + if (['link', 'textarea', 'picture', 'custom'].includes(value)) { + this.record.IsSort = 'false' + } + let _options = this.getOptions() let _field = '' @@ -125,7 +129,7 @@ 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: ''}) @@ -174,7 +178,7 @@ } } 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({ diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index cae43f6..585012a 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -17,6 +17,7 @@ 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 { @@ -277,12 +278,7 @@ } 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) => { @@ -659,6 +655,7 @@ <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> diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 68edece..31909af 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -32,11 +32,6 @@ 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() @@ -95,6 +90,11 @@ }) }) } + } 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 => { diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 0ed4d4c..8e452d1 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -659,6 +659,17 @@ 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 @@ -693,7 +704,7 @@ }) } - 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)) { diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 805305e..a97fa31 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -572,9 +572,9 @@ )} </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> diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index d2d224a..dcf3980 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -133,8 +133,10 @@ 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}` } @@ -205,6 +207,6 @@ }) } - return { error, sql, errors: errors.join('锛�') } + return { error, sql, errors: errors.join('锛�'), custompage } } } \ No newline at end of file diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx index 53aa073..2382fb8 100644 --- a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx +++ b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx @@ -118,7 +118,7 @@ <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}/> diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx index 5ce1a43..d61728f 100644 --- a/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx +++ b/src/mob/components/menubar/normal-menubar/menucomponent/options.jsx @@ -14,6 +14,14 @@ 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', @@ -39,15 +47,33 @@ {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: '灏忕▼搴廇ppID', + initval: setting.miniAppId || '', + required: true + }, + { + type: 'text', + field: 'miniPath', + label: '椤甸潰璺緞', + initval: setting.miniPath || '', + tooltip: '鍙寚瀹氳烦杞皬绋嬪簭椤甸潰璺緞銆�', + required: false + }, + { type: 'select', field: 'copyMenuId', label: '澶嶅埗鑿滃崟', diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 2999c50..6e2c374 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -215,7 +215,7 @@ 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 } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 865ed68..77ef6c6 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -209,7 +209,7 @@ // 瀛楁閫忚鍙婂繀濉爣蹇� 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 diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 58d36b8..6e0c8a1 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -278,8 +278,7 @@ _style.lineHeight = card.innerHeight + 'px' let mark = getMark(card.marks, data, _style) - - _style = mark.style + className = mark.signType } contents.push( @@ -418,8 +417,6 @@ 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> @@ -507,8 +504,6 @@ let className = '' if (card.marks) { let mark = getMark(card.marks, data, _style) - - _style = mark.style if (mark.icon) { if (mark.position === 'front') { @@ -883,8 +878,6 @@ let className = '' if (card.marks) { let mark = getMark(card.marks, data, _style) - - _style = mark.style if (mark.icon) { if (mark.position === 'front') { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 96e55f2..9cc9fcd 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -1,7 +1,7 @@ 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' @@ -37,13 +37,14 @@ selectedData: [], loading: false, card: null, - data: null, + data: [], total: null, precards: [], nextcards: [], selected: 'false', supNodes: [], - supComs: null + supComs: null, + pickup: false } loaded = false @@ -133,7 +134,7 @@ _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'] @@ -149,7 +150,7 @@ } } - let _data = null + let _data = [] if (_config.setting.sync === 'true') { _config.setting.onload = 'false' @@ -470,7 +471,7 @@ checkTopLine = (id) => { const { config, data, selected } = this.state - if (!data || data.length === 0) { + if (data.length === 0) { this.setState({ activeKey: '', selectKeys: [], @@ -592,7 +593,7 @@ 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 = '' @@ -822,6 +823,7 @@ selectedData: [], data: data, total: total, + pickup: false, loading: false }) @@ -1125,14 +1127,22 @@ }) } - 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 } @@ -1142,7 +1152,7 @@ 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 { @@ -1158,11 +1168,15 @@ } } + 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 } @@ -1177,6 +1191,7 @@ 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}> @@ -1189,7 +1204,7 @@ </CardItem>} </Col> ))} - {data && data.map((item, index) => { + {data.map((item, index) => { let className = 'mk-card ' if (config.wrap.parity === 'true') { if (index % 2 === 1) { @@ -1198,15 +1213,15 @@ } 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> @@ -1224,9 +1239,9 @@ </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> ) } diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index ea3ac4a..e56de99 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -6,6 +6,23 @@ 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; diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index d803a09..bda5137 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -1,7 +1,7 @@ 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' @@ -35,7 +35,7 @@ selectedData: [], // 閫変腑鏁版嵁锛岀敤浜庡伐鍏锋爮鎸夐挳 loading: false, // 鏁版嵁鍔犺浇鐘舵�� card: null, // 鍗$墖璁剧疆 - data: null, // 鏁版嵁 + data: [], // 鏁版嵁 total: null, precards: [], nextcards: [], @@ -43,7 +43,8 @@ opens: [], wrapStyle: null, subcard: null, - subconfig: null + subconfig: null, + pickup: false } loaded = false @@ -380,7 +381,7 @@ 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: [], @@ -462,7 +463,7 @@ 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 = '' @@ -723,6 +724,7 @@ selectedData: [], data: data, total: total, + pickup: false, loading: false }) @@ -1083,17 +1085,25 @@ }) } - 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 { @@ -1115,11 +1125,15 @@ 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 } @@ -1134,6 +1148,7 @@ 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 '}> @@ -1146,16 +1161,16 @@ </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' } @@ -1164,18 +1179,18 @@ 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}> @@ -1197,10 +1212,10 @@ ))} </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> ) } diff --git a/src/tabviews/custom/components/card/double-data-card/index.scss b/src/tabviews/custom/components/card/double-data-card/index.scss index e0b3f63..bb3872a 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.scss +++ b/src/tabviews/custom/components/card/double-data-card/index.scss @@ -6,6 +6,23 @@ 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; @@ -126,7 +143,6 @@ border-color: #ffffff; transform: rotate(45deg); } - .data-zoom.check.square { .circle-select { border-radius: 0!important; diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index f114efa..340d871 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -376,7 +376,7 @@ 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) diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index 68babea..605b841 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -350,7 +350,7 @@ _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))) { diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 5b3c32c..4491894 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -169,6 +169,12 @@ 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() } diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 895ff53..0ef5907 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -218,6 +218,12 @@ 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() } diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 01a21ed..7151d62 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -184,6 +184,12 @@ 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() } diff --git a/src/tabviews/custom/components/interfaces/interItem/index.jsx b/src/tabviews/custom/components/interfaces/interItem/index.jsx index fe1514e..0d86e30 100644 --- a/src/tabviews/custom/components/interfaces/interItem/index.jsx +++ b/src/tabviews/custom/components/interfaces/interItem/index.jsx @@ -47,6 +47,10 @@ MKEmitter.addListener('initFinish', this.initFinish) } + if (config.setting.useMSearch) { + MKEmitter.addListener('searchRefresh', this.searchRefresh) + } + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) } @@ -63,7 +67,16 @@ 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) => { @@ -108,9 +121,14 @@ 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) { diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index be531d2..b090fc7 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -132,9 +132,9 @@ } 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') { @@ -204,9 +204,9 @@ } 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') { @@ -389,9 +389,9 @@ } 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') { @@ -442,7 +442,9 @@ loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� chgSelectData: PropTypes.func, // 鏁版嵁鍒囨崲 - autoMatic: PropTypes.any + autoMatic: PropTypes.any, + allSearch: PropTypes.any, + colsCtrls: PropTypes.any } state = { @@ -455,11 +457,13 @@ rowspans: null, // 琛屽悎骞跺瓧娈典俊鎭� pickup: false, // 鏀惰捣鏈�夋嫨椤� orderfields: {}, // 鎺掑簭id涓巉ield杞崲 - 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 = [] @@ -483,7 +487,7 @@ 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') { @@ -502,13 +506,16 @@ 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, @@ -530,6 +537,7 @@ fields.push(item.field) _columns.push({ + $key: item.uuid, align: item.Align, dataIndex: item.field, title: item.label, @@ -562,9 +570,17 @@ 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, @@ -580,6 +596,20 @@ 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 () { @@ -608,6 +638,47 @@ 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) => { @@ -1002,7 +1073,9 @@ 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 diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index fd88ed1..359886a 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -35,7 +35,8 @@ pageIndex: 1, // 椤电爜 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 - search: '' // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + allSearch: null } /** @@ -163,6 +164,22 @@ _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 || '', @@ -172,7 +189,8 @@ setting: setting, actions: _config.action, columns: _columns, - search: _config.$searches + search: _config.$searches, + allSearch }, () => { if (_config.setting.onload === 'true') { setTimeout(() => { @@ -255,9 +273,16 @@ 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 }) @@ -585,7 +610,7 @@ } 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) { @@ -611,9 +636,11 @@ 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} diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 95e8350..bd322ed 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -407,9 +407,9 @@ } 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') { @@ -433,23 +433,23 @@ 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} @@ -465,7 +465,7 @@ </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>) } @@ -507,9 +507,9 @@ } 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') { @@ -536,11 +536,11 @@ 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>) } @@ -612,9 +612,9 @@ } 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') { @@ -840,6 +840,7 @@ 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]) } @@ -847,6 +848,7 @@ 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') { @@ -901,9 +903,9 @@ } 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') { @@ -932,6 +934,7 @@ } } 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) { @@ -976,9 +979,9 @@ } 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') { @@ -1070,9 +1073,9 @@ } 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') { @@ -1105,6 +1108,10 @@ ) } + 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>) } } @@ -1121,6 +1128,8 @@ loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� chgSelectData: PropTypes.func, + allSearch: PropTypes.any, + colsCtrls: PropTypes.any } state = { @@ -1137,11 +1146,13 @@ 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 = [] @@ -1155,7 +1166,7 @@ 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') { @@ -1200,15 +1211,18 @@ 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, @@ -1248,9 +1262,16 @@ 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, @@ -1312,13 +1333,54 @@ 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 = '' @@ -1358,7 +1420,24 @@ } 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: []}, () => { @@ -1552,7 +1631,21 @@ 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}) }) } @@ -1677,6 +1770,8 @@ this.setState({edData: _data}, () => { if (setting.commit === 'simple') { this.submit() + } else if (setting.commit === 'blur') { + this.submit(record) } }) } @@ -1688,7 +1783,9 @@ if (id !== tableId) return - if (!record.$sign) { + if (setting.commit === 'blur') { + + } else if (!record.$sign) { record.$origin = false record.$lock = true delete record.$forbid @@ -1719,7 +1816,11 @@ 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) => { @@ -1877,7 +1978,71 @@ 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 @@ -1893,7 +2058,14 @@ 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 @@ -2135,7 +2307,9 @@ 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: { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 63b75d4..97af3a8 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -38,7 +38,8 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - statFValue: [] // 鍚堣鍊� + statFValue: [], // 鍚堣鍊� + allSearch: null } loaded = false @@ -138,6 +139,18 @@ _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 || '', @@ -148,7 +161,8 @@ setting: setting, actions: _config.action, columns: _config.cols, - search: _config.$searches + search: _config.$searches, + allSearch }) } @@ -467,9 +481,16 @@ 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 }) @@ -801,7 +822,7 @@ } 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)) { @@ -825,9 +846,11 @@ 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} diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 55cf1da..7fea2ad 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -268,7 +268,7 @@ 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 } @@ -553,7 +553,7 @@ if (!inter) { item.wrap.datatype = 'static' } else { - item.setting = inter.setting + item.setting = {...inter.setting} } } } @@ -1173,6 +1173,7 @@ return interfaces.map(inter => { inter.MenuID = MenuID inter.setting.delay = delay + inter.$searchId = MenuID delay += 15 if (inter.setting.supModule) { @@ -1183,11 +1184,12 @@ 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 diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index d9fb7ac..9750fc1 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -136,7 +136,7 @@ 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 } diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index efd9c5c..5153d82 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -237,7 +237,7 @@ 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'} @@ -275,7 +275,7 @@ 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'} diff --git a/src/templates/sharecomponent/actioncomponent/formconfig.jsx b/src/templates/sharecomponent/actioncomponent/formconfig.jsx new file mode 100644 index 0000000..42ef767 --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/formconfig.jsx @@ -0,0 +1,714 @@ +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: '姝e紡鍦板潃', + initVal: card.proInterface || '', + tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', + 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: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + 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涓虹獥鍙e搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬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: '杩涘害鏉�' + }] + } + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 8f66baa..3d65364 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -6,7 +6,7 @@ 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' diff --git a/src/templates/sharecomponent/cardcomponent/formconfig.jsx b/src/templates/sharecomponent/cardcomponent/formconfig.jsx new file mode 100644 index 0000000..2ae0ec4 --- /dev/null +++ b/src/templates/sharecomponent/cardcomponent/formconfig.jsx @@ -0,0 +1,322 @@ +/** + * @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: '姝e父' + }, { + 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: '鑷姩' + }] + }, + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/cardcomponent/index.jsx b/src/templates/sharecomponent/cardcomponent/index.jsx index 9bf8922..795eb4c 100644 --- a/src/templates/sharecomponent/cardcomponent/index.jsx +++ b/src/templates/sharecomponent/cardcomponent/index.jsx @@ -5,7 +5,7 @@ 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' diff --git a/src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx b/src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx new file mode 100644 index 0000000..9a19c09 --- /dev/null +++ b/src/templates/sharecomponent/chartcomponent/chartcompile/formconfig.jsx @@ -0,0 +1,278 @@ +/** + * @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 + } + ] +} diff --git a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx index c46a8fc..be87511 100644 --- a/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx +++ b/src/templates/sharecomponent/chartcomponent/chartcompile/index.jsx @@ -4,7 +4,7 @@ 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' diff --git a/src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx b/src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx new file mode 100644 index 0000000..4fdfc5b --- /dev/null +++ b/src/templates/sharecomponent/chartgroupcomponent/formconfig.jsx @@ -0,0 +1,172 @@ +/** + * @description 鑾峰彇鍥捐〃瑙嗗浘澶栭儴閰嶇疆琛ㄥ崟 + * @param {object} card // 鎼滅储鏉′欢瀵硅薄 + * @param {Array} columns // 鏄剧ず鍒� + * @param {Array} actions // 鎸夐挳缁別xcel + * @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 + } + ] +} diff --git a/src/templates/sharecomponent/chartgroupcomponent/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/index.jsx index dcb8f2d..4c90686 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/index.jsx @@ -5,7 +5,7 @@ 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' diff --git a/src/templates/sharecomponent/columncomponent/formconfig.jsx b/src/templates/sharecomponent/columncomponent/formconfig.jsx new file mode 100644 index 0000000..ff5fb94 --- /dev/null +++ b/src/templates/sharecomponent/columncomponent/formconfig.jsx @@ -0,0 +1,366 @@ +/** + * @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 + } + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index e8172e2..c44b763 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -4,7 +4,7 @@ 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' diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 2acd0d3..efd4a13 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -97,10 +97,10 @@ 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'], @@ -606,6 +606,7 @@ columns.push({ title: 'url', key: '$url', type: 'file' }) } else if (this.record.display === 'color') { columns.push({ title: 'Color', key: '$color' }) + extra = <span>浣跨敤鍗佸叚杩涘埗鑹插僵浠g爜锛圚EX锛夋椂锛岃鍦ㄨ壊鍊煎墠娣诲姞 #</span> } fields.forEach(item => { diff --git a/src/templates/sharecomponent/tabscomponent/formconfig.jsx b/src/templates/sharecomponent/tabscomponent/formconfig.jsx new file mode 100644 index 0000000..2dc9860 --- /dev/null +++ b/src/templates/sharecomponent/tabscomponent/formconfig.jsx @@ -0,0 +1,87 @@ +/** + * @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: '涓嶄娇鐢�' + }] + } + ] +} \ No newline at end of file diff --git a/src/templates/sharecomponent/tabscomponent/index.jsx b/src/templates/sharecomponent/tabscomponent/index.jsx index 1f0b602..a95725d 100644 --- a/src/templates/sharecomponent/tabscomponent/index.jsx +++ b/src/templates/sharecomponent/tabscomponent/index.jsx @@ -5,7 +5,7 @@ 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' diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index a6170ab..7cd8e72 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1,287 +1,4 @@ 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 // 鎼滅储鏉′欢瀵硅薄 @@ -467,19 +184,6 @@ text: '鏁版嵁婧�' }] }, - // { - // type: 'radio', - // key: 'setAll', - // label: '璁剧疆鍏ㄩ儴', - // initVal: card.setAll || 'true', - // options: [{ - // value: 'true', - // text: '鏄�' - // }, { - // value: 'false', - // text: '鍚�' - // }] - // }, { type: 'radio', key: 'display', @@ -1014,1538 +718,6 @@ } /** - * @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: '姝e紡鍦板潃', - initVal: card.proInterface || '', - tooltip: '姝e紡绯荤粺鎵�浣跨敤鐨勬帴鍙e湴鍧�銆�', - 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: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - 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涓虹獥鍙e搴︼紙鎴栭珮搴︼級鐧惧垎姣旓紝澶т簬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 // 鎸夐挳缁別xcel - * @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 // 鍙啓鍏ヨ〃鍗� @@ -2956,19 +1128,6 @@ text: '16:9' }] }, - // { - // type: 'radio', - // key: 'setAll', - // label: '璁剧疆绌哄��', - // initVal: card.setAll || 'false', - // options: [{ - // value: 'true', - // text: '鏄�' - // }, { - // value: 'false', - // text: '鍚�' - // }] - // }, { type: 'codemirror', key: 'dataSource', @@ -3034,7 +1193,6 @@ {value: 'left', text: '灞呭乏'}, {value: 'center', text: '灞呬腑'}, {value: 'right', text: '灞呭彸'}, - // {value: 'justify', text: 'justify'} ], render: (text, record) => { if (text === 'center') { @@ -4464,328 +2622,5 @@ 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: '姝e父' - }, { - 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: '鑷姩' - }] - }, ] } \ No newline at end of file diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 0c6a6b7..310bdb6 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -745,7 +745,6 @@ { 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> @@ -757,7 +756,6 @@ content = <CodeMirror /> } else if (item.type === 'textarea') { span = 24 - className = 'text-msg' rules = [ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] @@ -765,7 +763,6 @@ 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 || [] @@ -818,6 +815,7 @@ columns.push({ title: 'url', key: '$url', type: 'file' }) } else if (this.record.display === 'color') { columns.push({ title: 'Color', key: '$color' }) + extra = <span>浣跨敤鍗佸叚杩涘埗鑹插僵浠g爜锛圚EX锛夋椂锛岃鍦ㄨ壊鍊煎墠娣诲姞 #</span> } fields.forEach(item => { @@ -835,7 +833,6 @@ } } else if (item.type === 'fields') { span = 24 - className = 'text-area' rules = [ { required: item.required, message: '璇锋坊鍔�' + item.label + '!' } ] diff --git a/src/templates/zshare/modalform/index.scss b/src/templates/zshare/modalform/index.scss index 23d5929..e718410 100644 --- a/src/templates/zshare/modalform/index.scss +++ b/src/templates/zshare/modalform/index.scss @@ -4,23 +4,22 @@ 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 { @@ -52,10 +51,5 @@ left: 0px; top: -25px; font-size: 14px; - } - >.ant-row >.ant-col { - display: inline-block; - vertical-align: top; - float: none; } } \ No newline at end of file diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 2af2a61..6e80931 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -558,6 +558,13 @@ } 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() @@ -851,6 +858,13 @@ } 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() diff --git a/src/utils/utils.js b/src/utils/utils.js index 7da4357..f640cee 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2394,9 +2394,8 @@ /** * @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]] diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index c46417f..f7d3a35 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -358,7 +358,20 @@ 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 @@ -596,6 +609,8 @@ 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) } } -- Gitblit v1.8.0