From d1e443953eae3c5bdb0b443b4f5c3b7ced9236d7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 03 十一月 2023 01:38:44 +0800 Subject: [PATCH] Merge branch 'positec' into bms --- src/templates/zshare/modalform/index.jsx | 5 src/templates/sharecomponent/tabscomponent/formconfig.jsx | 87 src/templates/zshare/editTable/index.jsx | 49 src/tabviews/zshare/actionList/editLine/index.jsx | 4 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/zshare/actionList/excelInbutton/excelin/index.jsx | 6 src/tabviews/custom/popview/index.jsx | 4 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 4 src/menu/components/table/edit-table/options.jsx | 131 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 | 27 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/tabviews/zshare/mutilform/mkPopSelect/index.scss | 9 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 132 src/tabviews/custom/components/table/normal-table/index.scss | 2 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 20 src/menu/datasource/verifycard/index.jsx | 31 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 | 258 + 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 | 1681 +++++++--- src/tabviews/zshare/mutilform/mkPopSelect/index.jsx | 12 src/templates/zshare/modalform/index.scss | 36 src/tabviews/custom/index.jsx | 8 src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.scss | 127 src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx | 2 src/menu/debug/index.jsx | 4 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 | 14 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 7 src/tabviews/zshare/actionList/index.scss | 5 src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 10 src/menu/datasource/verifycard/utils.jsx | 10 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 | 158 src/templates/sharecomponent/columncomponent/index.jsx | 2 src/api/index.js | 6 src/tabviews/custom/components/share/normalTable/index.jsx | 112 src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx | 4 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/menu/components/table/edit-table/index.jsx | 42 src/templates/sharecomponent/tabscomponent/index.jsx | 2 src/menu/components/share/markcomponent/index.scss | 72 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 2 src/utils/utils.js | 15 src/tabviews/custom/components/form/tab-form/index.jsx | 6 src/menu/components/table/base-table/columns/editColumn/index.jsx | 16 src/tabviews/custom/components/table/base-table/index.scss | 2 src/mob/components/menubar/normal-menubar/menucomponent/index.jsx | 2 src/menu/stylecontroller/index.jsx | 98 src/menu/components/share/colsControl/index.scss | 30 src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx | 385 ++ src/templates/zshare/formconfig.jsx | 2173 --------------- src/menu/datasource/verifycard/settingform/index.jsx | 4 src/tabviews/custom/components/interfaces/interItem/index.jsx | 20 src/menu/modulecell/index.jsx | 1 /dev/null | 40 src/tabviews/custom/components/table/edit-table/normalTable/index.scss | 14 src/tabviews/custom/components/module/voucher/voucherTable/index.jsx | 22 src/templates/sharecomponent/actioncomponent/index.jsx | 2 src/tabviews/custom/components/form/step-form/index.jsx | 6 src/templates/modalconfig/source.jsx | 5 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx | 2 src/menu/components/share/colsControl/index.jsx | 299 ++ src/templates/sharecomponent/chartgroupcomponent/index.jsx | 2 89 files changed, 5,376 insertions(+), 3,259 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index c539795..78b9552 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -714,7 +714,7 @@ /** * @description 鑾峰彇绯荤粺閰嶇疆锛屼紭鍏堜粠缂撳瓨涓彇鍊硷紝澧炲姞appkey * @param {Object} param 璇锋眰鍙傛暟 - * @param {Boolean} SSO 鏄惁涓哄崟鐐圭櫥褰曞湴鍧� + * @param {Boolean} cache 鏄惁浣跨敤缂撳瓨 */ getSystemCacheConfig (param, cache = true) { param.userid = param.userid || sessionStorage.getItem('UserID') || '' @@ -1109,6 +1109,8 @@ appkey: window.GLOB.appkey || '' } + let id = Utils.getuuid() + sql = sql.replace(/@time_id@/ig, `'${id}'`) if (window.GLOB.externalDatabase !== null) { sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) } @@ -1154,6 +1156,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 8d56325..9e795e5 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -2,7 +2,7 @@ * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� * @param {object} card // 鎼滅储鏉′欢瀵硅薄 */ -export function getColumnForm (card, fields = [], columns = []) { +export function getColumnForm (card, fields = [], columns = [], wrap) { let roleList = sessionStorage.getItem('sysRoles') if (roleList) { try { @@ -42,19 +42,26 @@ }] let editCols = [ + // { + // field: '$sub', + // label: '鎻愪氦' + // }, { - field: '$sub', - label: '鎻愪氦' + field: '$noAct', + label: '鏃犲姩浣�' }, { field: '$next', label: '涓嬩竴琛�' - }, - { - field: '$noAct', - label: '鏃犲姩浣�' } ] + + if (card.enter === '$sub') { + card.enter = '$noAct' + } + if (wrap.commit === 'change') { + editCols[0].label = '澶卞幓鐒︾偣' + } let cols = [] let getcols = (columns, suplabel = '') => { @@ -133,7 +140,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 +149,14 @@ value: 'false', text: '鍚�' }] + }, + { + type: 'select', + key: 'sortField', + label: '鎺掑簭瀛楁', + initVal: card.sortField || '', + required: true, + options: fields }, { type: 'radio', @@ -193,7 +208,7 @@ }] }, { - type: 'radio', + type: 'select', key: 'editType', label: '缂栬緫绫诲瀷', initVal: card.editType || 'text', @@ -207,6 +222,45 @@ }, { value: 'switch', text: '寮�鍏�' + }, { + value: 'date', + text: '鏃ユ湡锛堝ぉ锛�' + }, { + value: 'popSelect', + text: '閫夋嫨鍣�' + }] + }, + { + type: 'radio', + key: 'precision', + label: '绮剧‘搴�', + initVal: card.precision || 'day', + options: [{ + value: 'day', + text: '澶�' + }, { + value: 'hour', + text: '灏忔椂' + }, { + value: 'minute', + text: '鍒嗛挓' + }, { + value: 'second', + text: '绉�' + }] + }, + { + type: 'radio', + key: 'declareType', + label: '鏁版嵁绫诲瀷', + tooltip: '澹版槑鍙橀噺鏃剁殑绫诲瀷锛屾椂闂存牸寮廳atetime鎴栨枃鏈牸寮弉varchar(50)銆�', + initVal: card.declareType || 'datetime', + options: [{ + value: 'datetime', + text: 'datetime' + }, { + value: 'nvarchar(50)', + text: 'nvarchar(50)' }] }, { @@ -273,6 +327,176 @@ initVal: card.dataSource || '', placeholder: '绯荤粺鍙橀噺锛歮k_departmentcode銆乵k_organization銆乵k_user_type銆傚叕鍏卞�粿BID@銆�', 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: '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: 'radio', + key: 'laypage', + label: '鍒嗛〉', + initVal: card.laypage || 'true', + required: false, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }] + }, + { + type: 'radio', + key: 'onload', + label: '鍒濆鍖�', + initVal: card.onload || 'true', + tooltip: '褰撴病鏈夎缃悳绱㈠瓧娈垫椂锛屽垵濮嬪寲鍔犺浇鏁版嵁銆�', + required: false, + options: [{ + value: 'true', + text: '鍔犺浇' + }, { + value: 'false', + text: '涓嶅姞杞�' + }] + }, + { + type: 'radio', + key: 'cache', + label: '閫夐」鏌ヨ', + initVal: card.cache || 'true', + tooltip: '鏁版嵁鏌ヨ鏄惁浣跨敤缂撳瓨銆�', + required: false, + options: [{ + value: 'true', + text: '缂撳瓨' + }, { + value: 'false', + text: '瀹炴椂' + }] }, { type: 'text', @@ -362,13 +586,13 @@ key: 'enter', label: '鍥炶溅鍒囨崲', initVal: card.enter || '$noAct', - tooltip: '鍖呮嫭鏂囨湰鎴栨暟鍊煎洖杞︿簨浠躲�佷笅鎷夎彍鍗曢�変腑浜嬩欢銆佸紑鍏冲垏鎹簨浠躲��', + tooltip: '鍖呮嫭鏂囨湰鎴栨暟鍊煎洖杞︿簨浠躲�佷笅鎷夎彍鍗曘�侀�夋嫨鍣ㄣ�佹椂闂村彉鍖栦簨浠躲�佸紑鍏冲垏鎹簨浠躲��', options: editCols }, { type: 'select', key: 'ctrlField', - label: '绂佺敤瀛楁', + label: '绂佹缂栬緫', initVal: card.ctrlField || '', tooltip: '鎺у埗鍗曞厓鏍兼槸鍚﹀彲浠ョ紪杈戙��', allowClear: true, @@ -376,9 +600,19 @@ options: fields }, { + type: 'select', + key: 'clearField', + label: '娓呯┖瀛楁', + initVal: card.clearField || '', + tooltip: '褰撳墠瀛楁缂栬緫鏃堕渶瑕佹竻绌虹殑瀛楁銆�', + allowClear: true, + required: false, + options: fields + }, + { 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 595109f..ccd72fa 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'], @@ -28,6 +30,7 @@ class EdiTableColumn extends Component { static propTpyes = { column: PropTypes.object, + wrap: PropTypes.object, columns: PropTypes.array, fields: PropTypes.array, submitCol: PropTypes.func, // 鎻愪氦浜嬩欢 @@ -70,9 +73,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', 'controlField', 'searchKey', 'popWidth', 'laypage', 'cache', 'onload') } 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') @@ -83,11 +90,13 @@ _options.push('required', 'enter') } } else if (this.record.type === 'number') { - _options.push('max', 'min', 'enter') + _options.push('max', 'min', 'enter', 'clearField') } } 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') @@ -102,7 +111,7 @@ return item }) - let formlist = getColumnForm(column, fields, this.props.columns) + let formlist = getColumnForm(column, fields, this.props.columns, this.props.wrap) this.record = {} formlist.forEach(item => { @@ -140,6 +149,10 @@ this.record[key] = value if (key === 'type') { + if (['textarea', 'custom'].includes(value)) { + this.record.IsSort = 'false' + } + let _options = this.getOptions() let _field = '' @@ -159,7 +172,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 + '@'}) @@ -201,7 +216,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({ @@ -255,8 +270,8 @@ this.props.form.setFieldsValue({dataSource: resource}) } - changeOptions = (data) => { - this.record.options = data || [] + changeOptions = (data, key) => { + this.record[key] = data || [] } getFields() { @@ -301,6 +316,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} @@ -308,7 +329,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> @@ -336,7 +357,6 @@ </Select> } else if (item.type === 'textarea') { span = 24 - className = 'text-area' rules = [ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] @@ -369,9 +389,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}</> } @@ -379,7 +400,6 @@ content = <CodeMirror /> } else if (item.type === 'options') { span = 24 - className = 'text-area' let linkSubFields = this.record.linkSubField || [] @@ -394,7 +414,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( @@ -493,9 +520,9 @@ } } - if (values.dataSource && /\s/.test(values.dataSource)) { + if (values.dataSource) { let error = Utils.verifySql(values.dataSource) - + if (error) { notification.warning({ top: 92, @@ -504,16 +531,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 @@ -531,6 +559,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..e6e92ee 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) => { @@ -411,6 +406,8 @@ submitCol = (col) => { const { card } = this.state + + if (!card) return col.uuid = card.uuid col.isSub = card.isSub === true @@ -696,6 +693,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> @@ -718,7 +716,7 @@ }} /> </DndProvider> - <EditColumn column={card} columns={this.state.columns} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> + <EditColumn column={card} wrap={config.wrap} columns={this.state.columns} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> <Modal wrapClassName="mk-pop-modal" visible={visible} diff --git a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx index 180e506..78760b7 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx @@ -36,7 +36,7 @@ fields.push('jskey') let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '') - let _sql = `create table #${sheet} (${usefulfields.map(item => item.field + ' ' + item.type).join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50)) + let _sql = `create table #${sheet} (${usefulfields.map(item => item.field + ' ' + item.datatype).join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50)) Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='' ` diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index f211286..2595c3d 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -67,8 +67,19 @@ this.updateComponent(_card) } else { + let _card = fromJS(card).toJS() + + if (_card.mergeCol) { + let col = _card.cols[_card.mergeCol[0]] + _card.cols.splice(_card.mergeCol[0], 1, ...col.pops) + } + + if (_card.wrap.commit === 'simple') { + _card.wrap.commit = 'change' + } + this.setState({ - card: fromJS(card).toJS() + card: _card }) } } @@ -133,13 +144,27 @@ card: card }) - let _card = card.isNew ? fromJS(card).toJS() : card + let _card = card if (_card.isNew) { + _card = fromJS(card).toJS() _card.cols = _card.cols.filter(a => !a.origin) delete _card.isNew + delete _card.mergeCol + } else if (_card.mergeCol) { + _card = fromJS(card).toJS() + let col = {..._card.cols[_card.mergeCol[0]]} + col.initval = '' + col.pops = [] + + _card.mergeCol.forEach(index => { + col.pops.push(_card.cols[index]) + }) + + _card.cols = _card.cols.filter((col, index) => !_card.mergeCol.includes(index)) + _card.cols.splice(_card.mergeCol[0], 0, col) } - + this.props.updateConfig(_card) } @@ -270,7 +295,11 @@ updatecolumn = (config) => { config.absFields = [] - config.cols.forEach(col => { + config.mergeCol = false + + config.cols.forEach((col, index) => { + delete col.pops + if (col.type === 'number') { if (col.format === 'abs') { config.absFields.push(col.field) @@ -283,6 +312,11 @@ } } }) + } else if (col.type === 'text') { + if (col.editable === 'true' && col.editType === 'popSelect' && /^tab:/.test(col.initval)) { + config.mergeCol = config.mergeCol || [] + config.mergeCol.push(index) + } } }) diff --git a/src/menu/components/table/edit-table/options.jsx b/src/menu/components/table/edit-table/options.jsx index 18fc7a4..33616a8 100644 --- a/src/menu/components/table/edit-table/options.jsx +++ b/src/menu/components/table/edit-table/options.jsx @@ -53,81 +53,19 @@ precision: 0, required: false }, - // { - // type: 'radio', - // field: 'editable', - // label: '鍒濆鍖�', - // initval: wrap.editable || 'false', - // required: false, - // options: [ - // {value: 'true', label: '鍙紪杈�'}, - // {value: 'false', label: '涓嶅彲缂栬緫'}, - // ], - // controlFields: [ - // {field: 'switchable', values: ['true']}, - // ] - // }, - // { - // type: 'radio', - // field: 'submittal', - // label: '鎻愪氦鍚�', - // initval: wrap.submittal || 'false', - // required: false, - // options: [ - // {value: 'true', label: '鍙紪杈�'}, - // {value: 'false', label: '涓嶅彲缂栬緫'}, - // ] - // }, - // { - // type: 'radio', - // field: 'addable', - // label: '鍙柊澧�', - // initval: wrap.addable || 'false', - // required: false, - // options: [ - // {value: 'true', label: '鏄�'}, - // {value: 'false', label: '鍚�'}, - // ] - // }, - // { - // type: 'radio', - // field: 'delable', - // label: '鍙垹闄�', - // initval: wrap.delable || 'false', - // required: false, - // options: [ - // {value: 'true', label: '鏄�'}, - // {value: 'false', label: '鍚�'}, - // ] - // }, { type: 'radio', field: 'commit', label: '鏁版嵁鎻愪氦', initval: wrap.commit || 'all', - tooltip: '鍗曢」鎻愪氦鎸囧湪琛ㄥ崟涓洖杞︽垨鍒犻櫎琛屾椂锛岃缃负鍗曢」鏃跺鐐瑰嚮鎻愪氦鎸夐挳锛屼細鎻愪氦淇敼椤广��', + tooltip: '璁剧疆涓轰慨鏀归」鏃讹紝鍦ㄥけ鍘荤劍鐐逛笖涓嶅瓨鍦ㄥ繀濉」涓虹┖鏃惰Е鍙戞彁浜ゃ�傝缃负淇敼椤癸紙鍏級鏃讹紝鍦ㄧ偣鍑绘彁浜ゆ寜閽椂瑙﹀彂鎻愪氦銆�', required: false, options: [ {value: 'all', label: '鍏ㄩ儴'}, {value: 'change', label: '淇敼椤�'}, - {value: 'simple', label: '鍗曢」'}, - ], - controlFields: [ - {field: 'standard', values: ['change', 'simple']}, + {value: 'amend', label: '淇敼椤癸紙鍏級'}, ] }, - // { - // type: 'radio', - // field: 'operType', - // label: '缂栬緫鎸夐挳', - // initval: wrap.operType || 'btnMode', - // tooltip: '缂栬緫鏃剁殑娣诲姞銆佸垹闄ゆ寜閽樉绀轰綅缃紝娉細浣跨敤娴爣鏃惰〃鏍兼í鍚戞粴鍔ㄥけ鏁堬紝琛ㄦ牸璁剧疆楂樺害鏃舵诞鏍囨棤鏁堛��', - // required: false, - // options: [ - // {value: 'btnMode', label: '鎸夐挳寮�'}, - // {value: 'buoyMode', label: '娴爣寮�'}, - // ] - // }, { type: 'radio', field: 'editType', @@ -138,18 +76,6 @@ options: [ {value: 'simple', label: '鍗曢」'}, {value: 'multi', label: '鏁翠綋'}, - ] - }, - { - type: 'radio', - field: 'standard', - label: '淇敼鏍囧噯', - initval: wrap.standard || 'init', - tooltip: '濡備綍鍒ゆ柇琛屼俊鎭槸鍚﹀簲璇ユ彁浜ゃ��', - required: false, - options: [ - {value: 'init', label: '涓庡垵濮嬪�间笉鍚�'}, - {value: 'change', label: '瀛樺湪缂栬緫鐥曡抗'}, ] }, { @@ -223,18 +149,6 @@ {value: 'ghost', label: '閫忔槑'}, ] }, - // { - // type: 'radio', - // field: 'show', - // label: '鎼滅储鎸夐挳', - // initval: wrap.show || 'true', - // tooltip: '鎼滅储鏉′欢瀛樺湪鏃讹紝鍙�夋嫨鏄惁鏄剧ず鎼滅储鎸夐挳銆�', - // required: false, - // options: [ - // {value: 'true', label: '鏄剧ず'}, - // {value: 'false', label: '闅愯棌'}, - // ] - // }, { type: 'color', field: 'borderColor', @@ -256,35 +170,6 @@ {value: 'bottom', label: '鍚戜笅'}, ] }, - // { - // type: 'color', - // field: 'color', - // label: '瀛椾綋棰滆壊', - // initval: wrap.color || 'rgba(0, 0, 0, 0.65)', - // tooltip: '榛樿鍊� rgba(0, 0, 0, 0.65)銆�', - // required: false - // }, - // { - // type: 'number', - // field: 'fontSize', - // label: '瀛椾綋澶у皬', - // initval: wrap.fontSize || 14, - // min: 12, - // max: 30, - // precision: 0, - // required: false - // }, - // { - // type: 'number', - // field: 'advanceWidth', - // label: '楂樼骇鎼滅储', - // initval: wrap.advanceWidth || 1000, - // tooltip: '楂樼骇鎼滅储寮圭獥鐨勫搴︼紝娉細褰撳搴﹀�煎皬浜�100鏃惰〃绀哄崰绐楀彛鐨勭櫨鍒嗘瘮锛屽ぇ浜�100鏃惰〃绀哄搴︾殑缁濆鍊笺��', - // min: 10, - // max: 3000, - // precision: 0, - // required: false - // }, { type: 'radio', field: 'permission', @@ -297,18 +182,6 @@ ], forbid: sessionStorage.getItem('editMenuType') === 'popview' }, - // { - // type: 'radio', - // field: 'switchable', - // label: '鐘舵�佸垏鎹�', - // initval: wrap.switchable || 'true', - // tooltip: '鏄惁鍙互鍦ㄧ紪杈戝拰榛樿table鐘舵�侀棿鍒囨崲銆�', - // required: false, - // options: [ - // {value: 'true', label: '鍚敤'}, - // {value: 'false', label: '绂佺敤'}, - // ] - // }, { type: 'radio', field: 'empty', 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 1ef5833..ea27445 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 && setting.laypage === 'true' && _columns.findIndex(col => col.field === 'mk_total') === -1) { + Modal.warning({ + title: `鏁版嵁婧愭垨鑷畾涔夎剼鏈腑浣跨敤鑷畾涔夊垎椤垫帓搴忔椂锛岃鍦ㄥ瓧娈甸泦涓坊鍔� mk_total銆俙, + okText: '鐭ラ亾浜�', + onOk: () => { + reject() + } + }) + return + } + if (debugId === _debugId) { resolve() return @@ -681,17 +692,19 @@ if (/鍒楀悕\s*'[a-zA-Z0-9_-]+'\s*鏃犳晥/.test(result.message)) { let tail = '' let type = '' - searches.forEach(item => { - if (item.forbid) return - item.key.split(',').forEach(field => { - if (new RegExp(`'${field}'`).test(result.message)) { - tail = field - type = '鎼滅储鏉′欢' - } + if (setting.execute !== 'false' && setting.queryType !== 'statistics') { + searches.forEach(item => { + if (item.forbid) return + item.key.split(',').forEach(field => { + if (new RegExp(`'${field}'`).test(result.message)) { + tail = field + type = '鎼滅储鏉′欢' + } + }) }) - }) + } - 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..8d21423 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}` } @@ -146,7 +148,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' @@ -154,7 +156,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' @@ -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/menu/debug/index.jsx b/src/menu/debug/index.jsx index 91b7f27..d761bee 100644 --- a/src/menu/debug/index.jsx +++ b/src/menu/debug/index.jsx @@ -1720,7 +1720,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' @@ -1728,7 +1728,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' diff --git a/src/menu/modulecell/index.jsx b/src/menu/modulecell/index.jsx index e3825af..66e9f76 100644 --- a/src/menu/modulecell/index.jsx +++ b/src/menu/modulecell/index.jsx @@ -52,6 +52,7 @@ { subType: 'textarea', text: '澶氳鏂囨湰', type: 'form' }, { subType: 'multiselect', text: '涓嬫媺澶氶��', type: 'form' }, { subType: 'link', text: '鑱斿姩鑿滃崟', type: 'form' }, + { subType: 'popSelect', text: '閫夋嫨鍣�', type: 'form' }, { subType: 'switch', text: '寮�鍏�', type: 'form' }, { subType: 'checkbox', text: '澶氶�夋', type: 'form' }, { subType: 'radio', text: '鍗曢�夋', type: 'form' }, diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx index 163a7c6..b60a0b0 100644 --- a/src/menu/stylecontroller/index.jsx +++ b/src/menu/stylecontroller/index.jsx @@ -415,13 +415,105 @@ if (res.copyType !== 'style') { message.warning('閰嶇疆淇℃伅鏍煎紡閿欒锛�', 5) return - } else if (JSON.stringify(res.options) !== JSON.stringify(options)) { - message.warning('鏍峰紡閫夐」涓嶄竴鑷达紝涓嶅彲绮樿创锛�', 5) - return } let style = res.data || {} + if (JSON.stringify(res.options) !== JSON.stringify(options)) { + res.options.forEach(n => { + if (options.includes(n)) return + + if (n === 'width') { + delete style.width + } else if (n === 'height') { + delete style.height + } else if (n === 'font') { + if (options.includes('font1')) { + ['lineHeight', 'letterSpacing', 'fontStyle', 'textAlign', 'textDecoration'].forEach(m => { + delete style[m] + }) + } else if (options.includes('font2')) { + + } else { + ['fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'color', 'fontStyle', 'textAlign', 'textDecoration'].forEach(m => { + delete style[m] + }) + } + } else if (n === 'font1') { + if (options.includes('font') || options.includes('font2')) { + + } else { + ['fontSize', 'fontWeight', 'color'].forEach(m => { + delete style[m] + }) + } + } else if (n === 'font2') { + if (options.includes('font')) { + ['textIndent', 'wordBreak'].forEach(m => { + delete style[m] + }) + } else if (options.includes('font1')) { + ['lineHeight', 'letterSpacing', 'fontStyle', 'textAlign', 'textDecoration', 'textIndent', 'wordBreak'].forEach(m => { + delete style[m] + }) + } else { + ['fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'color', 'fontStyle', 'textAlign', 'textDecoration', 'textIndent', 'wordBreak'].forEach(m => { + delete style[m] + }) + } + } else if (n === 'background') { + if (!options.includes('backgroundColor')) { + delete style.backgroundColor + } + delete style.backgroundImage + delete style.backgroundSize + delete style.backgroundRepeat + delete style.backgroundPosition + } else if (n === 'backgroundColor') { + if (!options.includes('background')) { + delete style.backgroundColor + } + } else if (n === 'border') { + Object.keys(style).forEach(key => { + if (!/border/.test(key)) return + delete style[key] + }) + } else if (n === 'shadow') { + delete style.boxShadow + delete style.hShadow + delete style.vShadow + delete style.shadowBlur + delete style.shadowColor + } else if (n === 'margin') { + delete style.marginTop + delete style.marginBottom + delete style.marginLeft + delete style.marginRight + } else if (n === 'padding') { + delete style.paddingTop + delete style.paddingBottom + delete style.paddingLeft + delete style.paddingRight + } else if (n === 'float') { + delete style.float + } else if (n === 'minHeight') { + delete style.minHeight + } else if (n === 'clear') { + delete style.clear + } else if (n === 'display') { + delete style.display + } else if (n === 'position') { + delete style.position + delete style.top + delete style.bottom + delete style.left + delete style.right + } else if (n === 'transform') { + delete style.transform + } + }) + } + let backgroundImage = '' if (style.backgroundImage && /^url/ig.test(style.backgroundImage)) { backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '') 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/module/voucher/voucherTable/index.jsx b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx index ff923d4..ba436ea 100644 --- a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx +++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx @@ -237,9 +237,9 @@ setTimeout(() => { if (col.field === 'debit' && (line.debit || line.debit === 0)) { - MKEmitter.emit('nextLine', col, record) + MKEmitter.emit('nextVoucher', col, record) } else if (col.field === 'credit') { - MKEmitter.emit('nextLine', col, record) + MKEmitter.emit('nextVoucher', col, record) } else { let cl = {subject_voucher_text: 'subject_code', subject_code: 'debit', debit: 'credit'} MKEmitter.emit('tdFocus', cl[col.uuid] + record.uuid) @@ -327,10 +327,10 @@ MKEmitter.emit('plusLine', col.tableId, record) } - delRecord = () => { + delVoucher = () => { const { col, record } = this.props - MKEmitter.emit('delRecord', col.tableId, record) + MKEmitter.emit('delVoucher', col.tableId, record) } onSelectBlur = () => { @@ -936,7 +936,7 @@ </div> } } else if (col.field === 'credit') { - extra = <CloseOutlined onClick={this.delRecord}/> + extra = <CloseOutlined onClick={this.delVoucher}/> if (editing) { children = <InputNumber id={col.uuid + record.uuid} precision={2} defaultValue={record.credit} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> @@ -1049,10 +1049,10 @@ } componentDidMount () { - MKEmitter.addListener('nextLine', this.nextLine) MKEmitter.addListener('plusLine', this.plusLine) - MKEmitter.addListener('delRecord', this.delRecord) + MKEmitter.addListener('delVoucher', this.delVoucher) MKEmitter.addListener('cleartable', this.cleartable) + MKEmitter.addListener('nextVoucher', this.nextVoucher) MKEmitter.addListener('changeRecord', this.changeRecord) } @@ -1063,10 +1063,10 @@ this.setState = () => { return } - MKEmitter.removeListener('nextLine', this.nextLine) MKEmitter.removeListener('plusLine', this.plusLine) - MKEmitter.removeListener('delRecord', this.delRecord) + MKEmitter.removeListener('delVoucher', this.delVoucher) MKEmitter.removeListener('cleartable', this.cleartable) + MKEmitter.removeListener('nextVoucher', this.nextVoucher) MKEmitter.removeListener('changeRecord', this.changeRecord) } @@ -1240,7 +1240,7 @@ return ChineseStr } - nextLine = (col, record) => { + nextVoucher = (col, record) => { const { edData, tableId } = this.state if (col.tableId !== tableId) return @@ -1278,7 +1278,7 @@ this.props.onChange(_data) } - delRecord = (id, record) => { + delVoucher = (id, record) => { const { tableId, edData } = this.state if (id !== tableId) return diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index be531d2..840b824 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,24 +570,40 @@ 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, orderfields - }, () => { - const element = document.getElementById(tableId) - element && element.style.setProperty('--mk-table-border-color', setting.borderColor || '#e8e8e8') - element && element.style.setProperty('--mk-table-color', setting.color || 'rgba(0, 0, 0, 0.65)') - element && element.style.setProperty('--mk-table-font-size', setting.fontSize || '14px') - element && element.style.setProperty('--mk-table-font-weight', setting.fontWeight || 'normal') }) } 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 +632,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 +1067,9 @@ render() { const { setting, statFValue, lineMarks, data } = this.props - const { selectedRowKeys, activeIndex, pickup, tableId, pageOptions, columns } = this.state + const { selectedRowKeys, activeIndex, pickup, pageOptions, columns, reseting } = this.state + + if (reseting) return null // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙�� let rowSelection = null @@ -1070,8 +1137,15 @@ } } + let style = { + '--mk-table-border-color': setting.borderColor || '#e8e8e8', + '--mk-table-color': setting.color || 'rgba(0, 0, 0, 0.65)', + '--mk-table-font-size': setting.fontSize || '14px', + '--mk-table-font-weight': setting.fontWeight || 'normal' + } + return ( - <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed}`} id={tableId}> + <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed}`} style={style}> {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ? <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null } diff --git a/src/tabviews/custom/components/table/base-table/index.scss b/src/tabviews/custom/components/table/base-table/index.scss index 724b889..bc4f7bc 100644 --- a/src/tabviews/custom/components/table/base-table/index.scss +++ b/src/tabviews/custom/components/table/base-table/index.scss @@ -14,7 +14,7 @@ } .main-table-box { position: relative; - min-height: 150px; + min-height: 40px; .main-pickup { position: absolute; right: 5px; diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index fd88ed1..bcc54c6 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 } /** @@ -45,10 +46,10 @@ UNSAFE_componentWillMount () { let _config = fromJS(this.props.config).toJS() let setting = {..._config.setting, ..._config.wrap} - setting.tableId = Utils.getuuid() - let BID = '' let BData = '' + + setting.tableId = Utils.getuuid().substr(-6).toUpperCase() if (_config.setting.supModule) { BData = window.GLOB.CacheData.get(_config.setting.supModule) @@ -75,9 +76,12 @@ }) let _columns = [] - setting.initId = '' - let triMap = new Map() + let initId = '' + setting.hasSubmit = false + if (setting.commit === 'change' || setting.commit === 'simple') { + setting.commit = 'change' + } let getColumns = (cols) => { return cols.filter(item => { @@ -114,14 +118,25 @@ } if (item.editable === 'true') { - setting.hasSubmit = true - if (!setting.initId) { - setting.initId = item.uuid + setting.hasSubmit = setting.commit !== 'change' + item.$ctrl = setting.commit === 'change' + + if (!initId) { + initId = item.uuid } - if (item.type === 'text' && (item.editType === 'switch' || item.editType === 'select')) { - triMap.set(item.uuid, item.editType) + if (item.enter === '$sub') { + item.enter = '$noAct' + } else if (item.enter === '$next') { + item.enter = '$next_' + initId } - if (item.type === 'text' && item.editType === 'select') { + + if (item.linkSubField && item.linkSubField.length === 0) { + item.linkSubField = null + } + + if (item.type === 'number') { + + } else if (item.editType === 'select') { item.options = item.options || [] item.options = item.options.filter(cell => { cell.value = cell.Value @@ -129,6 +144,16 @@ return !cell.Hide }) + } else if (item.editType === 'popSelect') { + if (item.pops) { + item.pops.forEach(cell => { + cell.linkSubField = item.linkSubField + this.resetPop(cell) + cell.tabName = cell.initval.replace(/^tab:/, '') + }) + } else { + this.resetPop(item) + } } } } @@ -139,28 +164,22 @@ _columns = getColumns(_config.cols) - if (triMap.size > 0) { - let setColumns = (cols) => { - return cols.map(item => { - if (item.type === 'colspan') { - item.subcols = setColumns(item.subcols) - } else if (item.editable === 'true' && triMap.has(item.enter)) { - item.triType = 'click' - } - - return item - }) - } - - _columns = setColumns(_columns) - - if (setting.initId && triMap.has(setting.initId)) { - setting.triType = 'click' - } - } + setting.initId = initId if (!_config.lineMarks || _config.lineMarks.length === 0) { _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 } this.setState({ @@ -172,7 +191,8 @@ setting: setting, actions: _config.action, columns: _columns, - search: _config.$searches + search: _config.$searches, + allSearch }, () => { if (_config.setting.onload === 'true') { setTimeout(() => { @@ -180,6 +200,67 @@ }, _config.setting.delay || 0) } }) + } + + resetPop = (config) => { + let arrfield = config.columns.map(f => f.field) + + if (config.linkSubField && config.linkSubField.length > 0) { + config.linkSubField.forEach(n => { + if (!arrfield.includes(n)) { + arrfield.push(n) + } + }) + } + + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + config.dataSource = config.dataSource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + } else { + config.dataSource = config.dataSource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + } + + config.dataSource = config.dataSource.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + config.dataSource = config.dataSource.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + config.dataSource = config.dataSource.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + config.dataSource = config.dataSource.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + + if (/\s/.test(config.dataSource)) { // 鎷兼帴鍒悕 + config.dataSource = '(' + config.dataSource + ') tb' + } + + let labels = {} + config.cols = [] + config.columns.forEach(col => { + labels[col.field] = col.label + + if (col.Hide === 'true') return + + config.cols.push({ + dataIndex: col.field, + title: col.label, + sorter: col.IsSort === 'true', + width: col.Width || 120 + }) + }) + + let placeholder = '' + if (!config.searchKey) { + config.onload = 'true' + } else { + placeholder = [] + config.searchKey.split(',').forEach(key => { + if (!labels[key]) { + placeholder = '' + } else if (placeholder) { + placeholder.push(labels[key]) + } + }) + + placeholder = placeholder ? placeholder.join('銆�') : '' + } + + config.placeholder = placeholder + config.arr_field = arrfield.join(',') } /** @@ -255,14 +336,21 @@ 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 }) - MKEmitter.emit('transferData', config.uuid, data) + MKEmitter.emit('transferData' + setting.tableId, data) if (result.message) { if (result.ErrCode === 'Y') { @@ -370,7 +458,7 @@ return item }) - MKEmitter.emit('transferData', config.uuid, _data, 'line') + MKEmitter.emit('transferData' + setting.tableId, _data, 'line') MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) this.setState({ @@ -585,7 +673,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 +699,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/cusSwitch/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx deleted file mode 100644 index 6b16aea..0000000 --- a/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -// import { is, fromJS } from 'immutable' -import { Switch } from 'antd' - -import './index.scss' - -class ColorSketch extends Component { - static propTpyes = { - defaultValue: PropTypes.any, - autoFocus: PropTypes.any, - config: PropTypes.object, - onChange: PropTypes.func - } - state = { - status: false - } - - UNSAFE_componentWillMount () { - const { defaultValue, config } = this.props - - let status = false - - if (defaultValue === config.openVal) { - status = true - } - - this.setState({status}) - } - - changeStatus = (val) => { - const { config } = this.props - this.setState({ status: val }, () => { - let _val = val ? config.openVal : config.closeVal - let _text = val ? config.openText : config.closeText - this.props.onChange(_val, _text) - }) - } - - render() { - const { config, autoFocus } = this.props - const { status } = this.state - return ( - <Switch checkedChildren={config.openText} autoFocus={autoFocus} onBlur={this.props.onBlur} unCheckedChildren={config.closeText} checked={status} onChange={this.changeStatus} /> - ) - } -} - -export default ColorSketch \ No newline at end of file diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss deleted file mode 100644 index 96900ce..0000000 --- a/src/tabviews/custom/components/table/edit-table/normalTable/cusSwitch/index.scss +++ /dev/null @@ -1,40 +0,0 @@ -.color-sketch-block { - height: 25px; - width: 100%; - - .color-sketch-block-box { - display: inline-block; - width: calc(100% - 160px); - height: 100%; - border-radius: 2px; - background: #ffffff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==') left center; - } - .color-sketch-block-inner { - display: inline-block; - cursor: pointer; - border-radius: 2px; - box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); - width: 100%; - height: 100%; - } - .color-sketch-value { - display: inline-block; - width: 160px; - padding-left: 10px; - height: 25px; - line-height: 25px; - vertical-align: top; - white-space: nowrap; - overflow: visible; - } -} - -.color-sketch-popover { - z-index: 1090!important; - .ant-popover-inner-content { - padding: 0; - .sketch-picker { - width: 250px!important; - } - } -} \ No newline at end of file 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 0f95fec..ed634a0 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Table, Typography, Modal, Input, InputNumber, Button, notification, message, Select } from 'antd' +import { Table, Typography, Modal, Input, InputNumber, Switch, Button, notification, message, Select, DatePicker } from 'antd' import { EditOutlined, QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' import md5 from 'md5' @@ -10,13 +10,591 @@ import asyncComponent from '@/utils/asyncComponent' import Utils, { getEditTableSql, getMark } from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' -import CusSwitch from './cusSwitch' import Encrypts from '@/components/encrypts' import './index.scss' const { Paragraph } = Typography const MkIcon = asyncComponent(() => import('@/components/mk-icon')) +const MKPopSelect = asyncComponent(() => import('./mkPopSelect')) const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) + +class MkSwitch extends Component { + static propTpyes = { + autoFocus: PropTypes.bool, + defaultValue: PropTypes.any, + config: PropTypes.object, + onChange: PropTypes.func + } + + state = { + status: false + } + + node = null + + UNSAFE_componentWillMount () { + const { defaultValue, config } = this.props + + let status = false + + if (defaultValue === config.openVal) { + status = true + } + + this.setState({status}) + } + + changeStatus = (val) => { + const { config, lineId } = this.props + + this.setState({ status: val }) + + let values = {[config.field]: val ? config.openVal : config.closeVal} + + this.props.onChange(values, '') + + this.node.blur() + + if (config.enter === '$noAct') return + + if (/\$next/.test(config.enter)) { + MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) + } else { + MKEmitter.emit('setFocus' + config.tableId, lineId, config.enter) + } + } + + onFocus = () => { + const { config, lineId } = this.props + + if (!config.$ctrl) return + + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + + onBlur = () => { + const { config, lineId } = this.props + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + + this.props.onBlur && this.props.onBlur() + } + + render() { + const { config, autoFocus } = this.props + const { status } = this.state + + return ( + <Switch + ref={ref => this.node = ref} + checkedChildren={config.openText} + checked={status} + autoFocus={autoFocus} + onFocus={this.onFocus} + onBlur={this.onBlur} + unCheckedChildren={config.closeText} + onChange={this.changeStatus} + /> + ) + } +} + +class MkDatePicker extends Component { + static propTpyes = { + defaultValue: PropTypes.any, + config: PropTypes.object, + onChange: PropTypes.func + } + + state = { + value: null, + open: false + } + + UNSAFE_componentWillMount () { + const { defaultValue } = this.props + + let _value = defaultValue || null + if (_value) { + _value = moment(_value, 'YYYY-MM-DD HH:mm:ss') + } + + this.setState({value: _value}) + } + + componentDidMount() { + const { config, autoFocus, lineId } = this.props + + if (autoFocus === true) { + this.setState({open: true}) + + if (config.$ctrl) { + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + } + + MKEmitter.addListener('setFocus' + config.tableId, this.setFocus) + } + + componentWillUnmount () { + this.setState = () => { + return + } + + MKEmitter.removeListener('setFocus' + this.props.config.tableId, this.setFocus) + } + + setFocus = (lId, colId) => { + const { config, lineId } = this.props + + if (lId !== lineId || config.uuid !== colId) return + + this.setState({open: true}) + + if (config.$ctrl) { + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + } + + onOpenChange = (open) => { + const { config, lineId } = this.props + + this.setState({open}) + + if (!open) { + this.props.onBlur && this.props.onBlur() + } + + if (!config.$ctrl) return + + if (open) { + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } else { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + } + + onChange = (val) => { + const { config, lineId } = this.props + + let _val = val ? moment(val).format(config.format) : '' + + if (config.precision === 'hour') { + _val = _val + ':00:00' + } else if (config.precision === 'minute') { + _val = _val + ':00' + } + + let values = {[config.field]: _val} + + this.props.onChange(values) + + if (config.enter === '$noAct') return + + if (/\$next/.test(config.enter)) { + MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) + } else { + MKEmitter.emit('setFocus' + config.tableId, lineId, config.enter) + } + } + + render() { + const { config } = this.props + const { value, open } = this.state + + return ( + <DatePicker dropdownClassName={'mk-date-picker ' + config.precision} showTime={config.format !== 'YYYY-MM-DD'} format={config.format} open={open} defaultValue={value} onChange={this.onChange} onOpenChange={this.onOpenChange}/> + ) + } +} + +class MkSelect extends Component { + static propTpyes = { + defaultValue: PropTypes.any, + lineId: PropTypes.string, + config: PropTypes.object, + onChange: PropTypes.func, + } + + state = { + value: '' + } + + node = null + + UNSAFE_componentWillMount() { + const { defaultValue } = this.props + + this.setState({value: defaultValue}) + } + + componentDidMount() { + const { config, autoFocus, lineId } = this.props + + if (autoFocus) { + let node = document.getElementById(config.uuid + lineId) + node && node.click() + } + MKEmitter.addListener('setFocus' + config.tableId, this.setFocus) + } + + UNSAFE_componentWillReceiveProps(nextProps) { + if (nextProps.defaultValue !== this.props.defaultValue) { + this.setState({value: nextProps.defaultValue}) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + + MKEmitter.removeListener('setFocus' + this.props.config.tableId, this.setFocus) + } + + setFocus = (lId, colId) => { + const { config, lineId } = this.props + + if (lId !== lineId || config.uuid !== colId) return + + let node = document.getElementById(config.uuid + lineId) + node && node.click() + } + + onSelectChange = (val, option) => { + const { config, lineId } = this.props + + let values = {} + let _option = config.options.filter(m => m.key === option.key)[0] + + if (_option) { + if (config.linkSubField) { + config.linkSubField.forEach((m, i) => { + values[m] = _option[m] !== undefined ? _option[m] : '' + }) + } + + values[config.field] = val + } + + this.setState({value: val}) + + this.props.onChange(values, val) + + this.node.blur() + + if (config.enter === '$noAct') return + + setTimeout(() => { + if (/\$next/.test(config.enter)) { + MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) + } else { + MKEmitter.emit('setFocus' + config.tableId, lineId, config.enter) + } + }, 100) + } + + onFocus = () => { + const { config, lineId } = this.props + + if (!config.$ctrl) return + + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + + onBlur = () => { + const { config, lineId } = this.props + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + + setTimeout(() => { + this.props.onBlur && this.props.onBlur() + }, 10) + } + + render() { + const { config, lineId } = this.props + const { value } = this.state + + return ( + <Select + showSearch + dropdownClassName="edit-table-dropdown" + dropdownMatchSelectWidth={config.dropdown === 'fixed'} + value={value} + id={config.uuid + lineId} + ref={ref => this.node = ref} + onFocus={this.onFocus} + onBlur={this.onBlur} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onSelect={this.onSelectChange} + > + {config.options.map(item => (<Select.Option key={item.key} disabled={item.$disabled} value={item.value}>{item.label}</Select.Option>))} + </Select> + ) + } +} + +class MkInput extends Component { + static propTpyes = { + defaultValue: PropTypes.any, + lineId: PropTypes.string, + config: PropTypes.object, + onChange: PropTypes.func + } + + state = { + value: null, + err: null + } + + node = null + + UNSAFE_componentWillMount() { + const { defaultValue } = this.props + + this.setState({value: defaultValue}) + } + + componentDidMount() { + const { config, autoFocus } = this.props + + if (autoFocus) { + this.node.select() + } + MKEmitter.addListener('setFocus' + config.tableId, this.setFocus) + } + + UNSAFE_componentWillReceiveProps(nextProps) { + if (nextProps.defaultValue !== this.props.defaultValue) { + this.setState({value: nextProps.defaultValue}) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + + MKEmitter.removeListener('setFocus' + this.props.config.tableId, this.setFocus) + } + + setFocus = (lId, colId) => { + const { config, lineId } = this.props + + if (lId !== lineId || config.uuid !== colId) return + + this.node.select() + } + + onChange = (val) => { + this.setState({value: val}) + } + + onFocus = () => { + const { config, lineId } = this.props + + if (!config.$ctrl) return + + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + + enterPress = () => { + const { config, lineId } = this.props + + this.node.blur() + + if (config.enter === '$noAct') return + + if (/\$next/.test(config.enter)) { + MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) + } else { + MKEmitter.emit('setFocus' + config.tableId, lineId, config.enter) + } + } + + onBlur = () => { + const { config, lineId } = this.props + const { value } = this.state + + let err = null + + if (config.required === 'true' && !value) { + err = '璇峰~鍐�' + config.label + } + + this.setState({err}) + + this.props.onChange({[config.field]: value}) + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + + this.props.onBlur && this.props.onBlur() + } + + render() { + const { value, err } = this.state + + return ( + <Input + title={err} + className={err ? 'has-error' : ''} + ref={ref => this.node = ref} + value={value} + onChange={(e) => this.onChange(e.target.value)} + onPressEnter={this.enterPress} + onFocus={this.onFocus} + onBlur={this.onBlur} + /> + ) + } +} + +class MkInputNumber extends Component { + static propTpyes = { + defaultValue: PropTypes.any, + lineId: PropTypes.string, + config: PropTypes.object, + onChange: PropTypes.func + } + + state = { + value: null, + err: null, + clear: false + } + + node = null + + UNSAFE_componentWillMount() { + const { defaultValue } = this.props + + this.setState({value: defaultValue}) + } + + componentDidMount() { + const { config, autoFocus } = this.props + + if (autoFocus) { + this.node.focus() + } + MKEmitter.addListener('setFocus' + config.tableId, this.setFocus) + } + + UNSAFE_componentWillReceiveProps(nextProps) { + if (nextProps.defaultValue !== this.props.defaultValue) { + this.setState({value: nextProps.defaultValue}) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + + MKEmitter.removeListener('setFocus' + this.props.config.tableId, this.setFocus) + } + + setFocus = (lId, colId) => { + const { config, lineId } = this.props + + if (lId !== lineId || config.uuid !== colId) return + + this.node.focus() + } + + onChange = (val) => { + const { config } = this.props + + this.setState({value: val}) + + if (config.clearField && val && !this.state.clear) { + this.setState({clear: true}) + + this.props.onChange({[config.clearField]: ''}) + } + } + + onFocus = () => { + const { config, lineId } = this.props + + this.setState({clear: false}) + + if (!config.$ctrl) return + + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + + enterPress = () => { + const { config, lineId } = this.props + + this.node.blur() + + if (config.enter === '$noAct') return + + setTimeout(() => { + if (/\$next/.test(config.enter)) { + MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) + } else { + MKEmitter.emit('setFocus' + config.tableId, lineId, config.enter) + } + }, 10) + } + + onBlur = () => { + const { config, lineId } = this.props + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + + setTimeout(() => { + let err = null + let value = this.state.value + + if (config.noValue === 'hide' && !value) { + value = 0 + } else { + if (typeof(config.max) === 'number' && value > config.max) { + err = config.label + '鏈�澶т负' + config.max + } else if (typeof(config.min) === 'number' && value < config.min) { + err = config.label + '鏈�灏忎负' + config.min + } + } + + this.setState({err}) + + this.props.onChange({[config.field]: value}) + + this.props.onBlur && this.props.onBlur() + }, 5) + } + + render() { + const { config } = this.props + const { value, err } = this.state + + return ( + <InputNumber + title={err} + className={err ? 'has-error' : ''} + ref={ref => this.node = ref} + precision={config.decimal || 0} + value={value} + onChange={(value) => this.onChange(value)} + onPressEnter={this.enterPress} + onFocus={this.onFocus} + onBlur={this.onBlur} + /> + ) + } +} class BodyRow extends React.Component { shouldComponentUpdate (nextProps, nextState) { @@ -96,9 +674,15 @@ class BodyCell extends React.Component { state = { - editing: false, - err: null, - value: '' + editing: false + } + + componentDidMount() { + const { col } = this.props + + if (col && col.editable === 'true') { + MKEmitter.addListener('setFocus' + col.tableId, this.setFocus) + } } shouldComponentUpdate (nextProps, nextState) { @@ -112,163 +696,43 @@ this.setState = () => { return } + if (this.props.col) { + MKEmitter.removeListener('setFocus' + this.props.col.tableId, this.setFocus) + } } - enterPress = () => { + setFocus = (lId, colId) => { const { col, record } = this.props - const { value } = this.state - this.setState({editing: false}) - setTimeout(() => { - if (/\$next/.test(col.enter)) { - MKEmitter.emit('nextLine', col, record.$$uuid) - } else if (col.enter === '$sub') { - MKEmitter.emit('subLine', col, record) - } else if (col.enter !== '$noAct') { - let node = document.getElementById(col.enter + record.$$uuid) - node && node.click() - } - }, 50) + if (lId !== record.$$uuid || col.uuid !== colId) return + if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField] + '')) return - if (value !== record[col.field]) { - MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: value}) - } + this.setState({editing: true}) } focus = () => { const { col, record } = this.props - if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField])) return + if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField] + '')) return - if (col.editType === 'switch' || col.editType === 'select') { - this.setState({editing: true}, () => { - let node = document.getElementById(col.uuid + record.$$uuid) - node && node.click() - }) - } else { - let err = null - let val = record[col.field] !== undefined ? record[col.field] : '' - - if (col.type === 'number') { - val = +val - if (isNaN(val)) { - val = 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 - } - } else if (col.required === 'true' && !val) { - err = '璇峰~鍐�' + col.label - } - - this.setState({editing: true, value: val, err}, () => { - let node = document.getElementById(col.uuid + record.$$uuid) - node && node.select() - }) - } + this.setState({editing: true}) } - onBlur = () => { - const { col, record } = this.props - const { value } = this.state - - this.setState({editing: false}) - - if (value !== record[col.field]) { - MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: value}) - } - } - - onChange = (val) => { - const { col } = this.props - - let err = null - - if (col.type === 'number') { - val = +val - if (isNaN(val)) { - val = 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 - } - } else if (col.required === 'true' && !val) { - err = '璇峰~鍐�' + col.label - } - - this.setState({value: val, err}) - } - - onSwitchChange = (val, label) => { + onColChange = (values) => { const { col, record } = this.props - this.setState({editing: false}) - - setTimeout(() => { - if (/\$next/.test(col.enter)) { - MKEmitter.emit('nextLine', col, record.$$uuid) - } else if (col.enter === '$sub') { - MKEmitter.emit('subLine', col, record) - } else if (col.enter !== '$noAct') { - let node = document.getElementById(col.enter + record.$$uuid) - node && node.click() - } - }, 50) - - MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) - } - - onSelectChange = (val, option) => { - const { col, record } = this.props - - let values = {} - let _option = col.options.filter(m => m.key === option.key)[0] - - if (_option) { - if (col.linkSubField) { - col.linkSubField.forEach(m => { - values[m] = _option[m] !== undefined ? _option[m] : '' - }) - } - - values[col.field] = val - } - - this.setState({editing: false}) - - setTimeout(() => { - if (/\$next/.test(col.enter)) { - MKEmitter.emit('nextLine', col, record.$$uuid) - } else if (col.enter === '$sub') { - MKEmitter.emit('subLine', col, record) - } else if (col.enter !== '$noAct') { - let node = document.getElementById(col.enter + record.$$uuid) - node && node.click() - } - }, 50) - - MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) - } - - switchBlur = () => { - setTimeout(() => { - this.setState({editing: false}) - }, 10) + MKEmitter.emit('changeRecord' + col.tableId, {...record, ...values}) } render() { let { col, config, record, style, className, ...resProps } = this.props - const { editing, value, err } = this.state + const { editing } = this.state if (!col) return (<td {...resProps} className={className} style={style}/>) let disabled = false if (col.ctrlField) { - disabled = col.ctrlValue.includes(record[col.ctrlField]) + disabled = col.ctrlValue.includes(record[col.ctrlField] + '') } let children = null @@ -280,6 +744,12 @@ if (col.editType === 'select' && col.options.length > 0) { content = col.map.get(content) || content + } else if (col.editType === 'switch') { + if (content === config.openVal) { + content = config.openText + } else if (content === config.closeVal) { + content = config.closeText + } } if (content !== '') { @@ -297,9 +767,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') { @@ -322,36 +792,31 @@ if (col.editable === 'true' && !disabled) { if (editing) { + let _value = record[col.field] !== undefined ? record[col.field] : '' + if (!col.editType || col.editType === 'text') { - return (<td 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}/> + return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> + <MkInput config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={true} onChange={this.onColChange} onBlur={() => 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"> - <CusSwitch config={col} defaultValue={_value} autoFocus={true} onChange={this.onSwitchChange} onBlur={this.switchBlur}/> + return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> + <MkSwitch config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/> + </td>) + } else if (col.editType === 'date') { + return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> + <MkDatePicker config={col} lineId={record.$$uuid} defaultValue={_value || null} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/> + </td>) + } else if (col.editType === 'popSelect') { + return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> + <MKPopSelect config={col} lineId={record.$$uuid} defaultValue={_value} BID={record.$$BID} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/> </td>) } else { - let _value = record[col.field] !== undefined ? record[col.field] : '' - - return (<td className="editing_table_cell"> - <Select - showSearch - defaultValue={_value} - dropdownClassName="edit-table-dropdown" - dropdownMatchSelectWidth={col.dropdown === 'fixed'} - id={col.uuid + record.$$uuid} - onBlur={() => this.setState({editing: false})} - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onSelect={this.onSelectChange} - > - {col.options.map((item, i) => (<Select.Option key={item.key} disabled={item.$disabled} value={item.value}>{item.label}</Select.Option>))} - </Select> + return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> + <MkSelect config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/> </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>) } @@ -393,9 +858,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') { @@ -418,15 +883,15 @@ if (col.editable === 'true' && !disabled) { if (editing) { - let val = value - if (col.noValue === 'hide' && value === 0) { + let val = record[col.field] !== undefined ? record[col.field] : '' + if (col.noValue === 'hide' && val === 0) { val = '' } - return (<td 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}/> + return (<td onClick={(e) => e.stopPropagation()} className="editing_table_cell"> + <MkInputNumber config={col} lineId={record.$$uuid} defaultValue={val} autoFocus={true} onChange={this.onColChange} onBlur={() => this.setState({editing: false})}/> </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>) } @@ -498,9 +963,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') { @@ -538,30 +1003,10 @@ } class BodyAllCell extends React.Component { - state = { - err: null, - value: '' - } + state = {} shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props.record), fromJS(nextProps.record)) || !is(fromJS(this.state), fromJS(nextState)) - } - - UNSAFE_componentWillMount() { - const { col } = this.props - - if (col && col.editable === 'true') { - this.setState({value: this.props.record[col.field]}) - } - } - - UNSAFE_componentWillReceiveProps(nextProps) { - const { col } = this.props - const { value } = this.state - - if (col && col.editable === 'true' && nextProps.record[col.field] !== value) { - this.setState({value: nextProps.record[col.field]}) - } } /** @@ -573,165 +1018,49 @@ } } - enterPress = () => { + onColChange = (values) => { const { col, record } = this.props - this.onBlur() - - setTimeout(() => { - if (/\$next/.test(col.enter)) { - MKEmitter.emit('nextLine', col, record.$$uuid) - } else if (col.enter === '$sub') { - MKEmitter.emit('subLine', col, record) - } else if (col.enter !== '$noAct') { - let node = document.getElementById(col.enter + record.$$uuid) - - if (node) { - if (col.triType === 'click') { - node.click() - } else { - node.select && node.select() - } - } - } - }, 50) - } - - onChange = (val) => { - const { col } = this.props - - if (col.noValue === 'hide' && val === null) { - this.setState({value: 0}) - } else { - this.setState({value: val}) - } - } - - onBlur = () => { - const { col, record } = this.props - const { value } = this.state - - let err = null - let val = value - - if (col.type === 'number') { - val = +val - if (isNaN(val)) { - val = 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 - } - } else if (col.required === 'true' && !val) { - err = '璇峰~鍐�' + col.label - } - - this.setState({err}) - - if (value !== record[col.field]) { - MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) - } - } - - onSwitchChange = (val, label) => { - const { col, record } = this.props - - setTimeout(() => { - if (/\$next/.test(col.enter)) { - MKEmitter.emit('nextLine', col, record.$$uuid) - } else if (col.enter === '$sub') { - MKEmitter.emit('subLine', col, record) - } else if (col.enter !== '$noAct') { - let node = document.getElementById(col.enter + record.$$uuid) - if (node) { - if (col.triType === 'click') { - node.click() - } else { - node.select && node.select() - } - } - } - }, 50) - - MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) - } - - onSelectChange = (val, option) => { - const { col, record } = this.props - - let values = {} - let _option = col.options.filter(m => m.key === option.key)[0] - - if (_option) { - if (col.linkSubField) { - col.linkSubField.forEach(m => { - values[m] = _option[m] !== undefined ? _option[m] : '' - }) - } - - values[col.field] = val - } - - setTimeout(() => { - if (/\$next/.test(col.enter)) { - MKEmitter.emit('nextLine', col, record.$$uuid) - } else if (col.enter === '$sub') { - MKEmitter.emit('subLine', col, record) - } else if (col.enter !== '$noAct') { - let node = document.getElementById(col.enter + record.$$uuid) - if (node) { - if (col.triType === 'click') { - node.click() - } else { - node.select && node.select() - } - } - } - }, 50) - - MKEmitter.emit('changeRecord', col.tableId, {...record, ...values}) + MKEmitter.emit('changeRecord' + col.tableId, {...record, ...values}) } render() { let { col, config, record, style, className, ...resProps } = this.props - const { err } = this.state 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]) + disabled = col.ctrlValue.includes(record[col.ctrlField] + '') } let children = null if (col.type === 'text') { if (col.editable === 'true' && !disabled) { + editable = true let _value = record[col.field] !== undefined ? record[col.field] : '' if (!col.editType || col.editType === 'text') { - children = (<> - <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}/> - </>) + children = ( + <MkInput config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={false} onChange={this.onColChange}/> + ) } else if (col.editType === 'switch') { children = ( - <CusSwitch config={col} autoFocus={false} defaultValue={_value} onChange={this.onSwitchChange} onBlur={() => {}}/> + <MkSwitch config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={false} onChange={this.onColChange}/> + ) + } else if (col.editType === 'date') { + children = ( + <MkDatePicker config={col} lineId={record.$$uuid} defaultValue={_value || null} autoFocus={false} onChange={this.onColChange}/> + ) + } else if (col.editType === 'popSelect') { + children = ( + <MKPopSelect config={col} lineId={record.$$uuid} defaultValue={_value} BID={record.$$BID} autoFocus={false} onChange={this.onColChange}/> ) } else { - children = (<> - <Select - showSearch - dropdownClassName="edit-table-dropdown" - dropdownMatchSelectWidth={col.dropdown === 'fixed'} - defaultValue={_value} - id={col.uuid + record.$$uuid} - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onSelect={this.onSelectChange} - > - {col.options.map((item, i) => (<Select.Option key={item.key} disabled={item.$disabled} value={item.value}>{item.label}</Select.Option>))} - </Select> - </>) + children = ( + <MkSelect config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={false} onChange={this.onColChange} /> + ) } } else { let content = '' @@ -741,6 +1070,12 @@ if (col.editType === 'select' && col.options.length > 0) { content = col.map.get(content) || content + } else if (col.editType === 'switch') { + if (content === config.openVal) { + content = config.openText + } else if (content === config.closeVal) { + content = config.closeText + } } if (content !== '') { @@ -758,9 +1093,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') { @@ -789,15 +1124,16 @@ } } 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) { _value = '' } - children = (<> - <InputNumber className={err ? 'has-error' : ''} title={err} precision={col.decimal || 0} id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> - </>) + children = ( + <MkInputNumber config={col} lineId={record.$$uuid} defaultValue={_value} autoFocus={false} onChange={this.onColChange}/> + ) } else { let content = '' try { @@ -833,9 +1169,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') { @@ -927,9 +1263,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') { @@ -962,6 +1298,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>) } } @@ -978,6 +1318,8 @@ loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� chgSelectData: PropTypes.func, + allSearch: PropTypes.any, + colsCtrls: PropTypes.any } state = { @@ -988,43 +1330,61 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 columns: null, // 鏄剧ず鍒� forms: [], - signForms: [], orderfields: {}, // 鎺掑簭id涓巉ield杞崲 loading: false, pageOptions: [], deForms: null, visible: false, - midData: null + midData: null, + allColumns: null, + checkForms: [], + allForms: [], + reseting: false } + timer = null + focusId = '' + blurId = '' + UNSAFE_componentWillMount () { - const { setting, fields, columns, BID } = this.props + const { setting, fields, columns, BID, colsCtrls } = this.props let orderfields = {} let _columns = [] let deForms = [] let _forms = {} let hasBid = false - let signForms = [] + let index = 0 + let checkForms = [] + let allForms = [] - let getColumns = (cols) => { + let getColumns = (cols, sk) => { return cols.map(item => { let cell = null if (item.type === 'colspan') { - cell = { title: item.label, align: item.Align } - cell.children = getColumns(item.subcols) + cell = { title: item.label, align: item.Align, $key: item.uuid } + cell.children = getColumns(item.subcols, sk || item.uuid) } else { if (item.editable === 'true') { + item.$sort = index + index++ _forms[item.field] = item - signForms.push(item.field) + allForms.push({uuid: sk || item.uuid, field: item.field}) + checkForms.push(item.field) if (item.ctrlField) { item.ctrlValue = item.ctrlValue.split(',') } - if (item.type === 'text' && item.editType === 'select') { + if (item.type === 'number' && item.clearField) { + fields.forEach(cell => { + if (cell.field === item.clearField) { + item.clearName = cell.label + } + }) + } else if (item.type === 'text' && item.editType === 'select') { item.map = new Map() if (item.resourceType === '1') { let _option = Utils.getSelectQueryOptions(item) @@ -1042,20 +1402,32 @@ item.map.set(cell.value, cell.label) }) } + } else if (item.type === 'text' && item.editType === 'date') { + item.format = 'YYYY-MM-DD' + + if (item.precision === 'hour') { + item.format = 'YYYY-MM-DD HH' + } else if (item.precision === 'minute') { + item.format = 'YYYY-MM-DD HH:mm' + } else if (item.precision === 'second') { + item.format = 'YYYY-MM-DD HH:mm:ss' + } } } 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, + $key: item.uuid, onCell: record => ({ record, col: item, @@ -1075,11 +1447,20 @@ if (item.field === setting.primaryKey) return if (_forms[item.field]) { - forms.push({..._forms[item.field], datatype: item.datatype}) + let _item = {..._forms[item.field]} + if (_item.editType === 'date') { + _item.datatype = _item.declareType || 'datetime' + } else { + _item.datatype = item.datatype + } + + forms.push(_item) } else { - forms.push(item) + forms.push({...item, $sort: 999}) } }) + + forms.sort((a, b) => a.$sort - b.$sort) let size = (setting.pageSize || 10) + '' let pageOptions = ['10', '25', '50', '100', '500', '1000'] @@ -1089,9 +1470,22 @@ pageOptions = pageOptions.sort((a, b) => a - b) } + let allColumns = null + if (colsCtrls) { + allColumns = [..._columns] + checkForms = [] + _columns = this.getCurColumns(_columns, this.props.allSearch, allForms, checkForms) + } else { + allForms = null + } + + checkForms = Array.from(new Set(checkForms)) + this.setState({ forms, - signForms, + allForms, + allColumns, + checkForms, pageSize: setting.pageSize || 10, pageOptions, columns: _columns, @@ -1105,12 +1499,6 @@ this.improveActionForm(deForms, BID) } } - - const element = document.getElementById(setting.tableId) - element && element.style.setProperty('--mk-table-border-color', setting.borderColor || '#e8e8e8') - element && element.style.setProperty('--mk-table-color', setting.color || 'rgba(0, 0, 0, 0.65)') - element && element.style.setProperty('--mk-table-font-size', setting.fontSize || '14px') - element && element.style.setProperty('--mk-table-font-weight', setting.fontWeight || 'normal') }) } @@ -1128,53 +1516,216 @@ } componentDidMount () { - MKEmitter.addListener('subLine', this.subLine) - MKEmitter.addListener('nextLine', this.nextLine) - MKEmitter.addListener('addRecord', this.addRecord) - MKEmitter.addListener('delRecord', this.delRecord) + const { setting } = this.props + const { tableId } = this.state + + if (setting.commit === 'change') { + MKEmitter.addListener('colBlur' + tableId, this.colBlur) + MKEmitter.addListener('colFocus' + tableId, this.colFocus) + } + MKEmitter.addListener('resetTable', this.resetTable) - MKEmitter.addListener('transferData', this.transferData) - MKEmitter.addListener('changeRecord', this.changeRecord) + MKEmitter.addListener('nextLine' + tableId, this.nextLine) + MKEmitter.addListener('addRecord' + tableId, this.plusLine) + MKEmitter.addListener('delRecord' + tableId, this.delRecord) + MKEmitter.addListener('transferData' + tableId, this.transferData) + MKEmitter.addListener('changeRecord' + tableId, this.changeRecord) } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ componentWillUnmount () { + const { tableId } = this.state + this.setState = () => { return } - MKEmitter.removeListener('subLine', this.subLine) - MKEmitter.removeListener('nextLine', this.nextLine) - MKEmitter.removeListener('addRecord', this.addRecord) - MKEmitter.removeListener('delRecord', this.delRecord) + MKEmitter.removeListener('resetTable', this.resetTable) - MKEmitter.removeListener('transferData', this.transferData) - MKEmitter.removeListener('changeRecord', this.changeRecord) + MKEmitter.removeListener('colBlur' + tableId, this.colBlur) + MKEmitter.removeListener('colFocus' + tableId, this.colFocus) + MKEmitter.removeListener('nextLine' + tableId, this.nextLine) + MKEmitter.removeListener('addRecord' + tableId, this.plusLine) + MKEmitter.removeListener('delRecord' + tableId, this.delRecord) + MKEmitter.removeListener('transferData' + tableId, this.transferData) + MKEmitter.removeListener('changeRecord' + tableId, this.changeRecord) } - transferData = (menuid, data, type) => { - const { MenuID, setting } = this.props - const { edData, signForms } = this.state + colBlur = (lineId) => { + this.blurId = lineId + this.focusId = '' - if (menuid !== MenuID) return + this.timer && clearTimeout(this.timer) - if (setting.commit !== 'all' && setting.standard !== 'change') { - if (type !== 'line') { - data.forEach(item => { - let value = '' - signForms.forEach(field => { - value += item[field] - }) - item.$sign = md5(value) - }) - } else { - let value = '' - signForms.forEach(field => { - value += data[field] - }) - data.$sign = md5(value) + this.timer = setTimeout(() => { + if (!this.focusId || this.focusId !== this.blurId) { + this.checkLine() } + }, 150) + } + + colFocus = (lineId) => { + this.focusId = lineId + } + + checkLine = () => { + const { edData, forms, checkForms } = this.state + + let data = edData.filter(item => item.$$uuid === this.blurId)[0] + + if (!data) return + + let record = fromJS(data).toJS() + + let value = '' + Object.keys(record).sort().forEach(key => { + if (/^\$/.test(key)) return + value += record[key] + }) + + if (record.$sign === md5(value)) return + + let err = '' + forms.forEach(col => { + let check = true + if (col.editable !== 'true' || !checkForms.includes(col.field)) { + check = false + } + if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField] + '')) { + check = false + } + + if (!check) { + 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 (err) 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) { + if (col.clearField && checkForms.includes(col.clearField) && !record[col.clearField]) { + err = `璇峰~鍐� ${col.label} 鎴� ${col.clearName}` + } + val = 0 + } else if (!val && val !== 0) { + err = `${col.label}涓嶅彲涓虹┖` + } else { + 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) { + message.warning(err) + return + } + + this.submit(record) + } + + getCurColumns = (columns, allSearch, allForms, checkForms) => { + 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) { + allForms.forEach(item => { + if (cols.includes(item.uuid)) { + checkForms.push(item.field) + } + }) + + return columns.filter(col => cols.includes(col.$key)) + } + + allForms.forEach(item => { + checkForms.push(item.field) + }) + + return columns + } + + transferData = (data, type) => { + const { edData } = this.state + + if (type === 'line') { + let value = '' + Object.keys(data).sort().forEach(key => { + if (/^\$/.test(key)) return + value += data[key] + }) + data.$sign = md5(value) + } else { + data.forEach(item => { + let value = '' + Object.keys(item).sort().forEach(key => { + if (/^\$/.test(key)) return + value += item[key] + }) + item.$sign = md5(value) + }) } if (type !== 'line') { @@ -1194,16 +1745,41 @@ } }) - this.setState({edData: _edData}) + this.setState({edData: _edData, reseting: true}, () => { + this.setState({reseting: false}) + }) } } updateMutil = (data) => { - const { setting } = this.props + const { setting, colsCtrls, allSearch } = this.props + const { allColumns, allForms } = this.state + + if (colsCtrls) { + let checkForms = [] + let columns = this.getCurColumns(allColumns, allSearch, allForms, checkForms) + + checkForms = Array.from(new Set(checkForms)) + + this.setState({ + checkForms, + columns: columns, + reseting: true, + edData: data, + visible: false, + midData: null + }, () => { + this.setState({ + reseting: false + }) + }) + + return + } if (setting.editType === 'multi' && data.length > 0) { - this.setState({edData: []}, () => { - this.setState({edData: data, visible: false, midData: null}) + this.setState({edData: data, visible: false, midData: null, reseting: true}, () => { + this.setState({reseting: false}) }) } else { this.setState({edData: data, visible: false, midData: null}) @@ -1211,7 +1787,7 @@ if (setting.addable && data.length === 0) { setTimeout(() => { - this.plusLine(true) + this.plusLine() }, 10) } } @@ -1393,76 +1969,68 @@ 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}) }) } - nextLine = (col, uuid) => { + nextLine = (lineId, colId) => { const { setting } = this.props const { edData, tableId } = this.state - if (col.tableId !== tableId) return - - let index = edData.findIndex(item => item.$$uuid === uuid) + let index = edData.findIndex(item => item.$$uuid === lineId) let next = edData[index + 1] || null if (next) { - let nextId = setting.initId + next.$$uuid - if (/^\$next_/.test(col.enter)) { - nextId = col.enter.split('_')[1] + next.$$uuid - } - - let node = document.getElementById(nextId) - if (node) { - if (setting.editType === 'multi') { - if (setting.triType === 'click') { - node.click() - } else { - node.select && node.select() - } - } else { - node.click() - } - } + MKEmitter.emit('setFocus' + tableId, next.$$uuid, colId) } else if (setting.addable) { setTimeout(() => { - this.plusLine() + this.plusLine(colId) }, 10) - } else if (edData[index]) { + } else if (edData[index] && setting.commit !== 'change') { setTimeout(() => { - this.subLine(col, edData[index]) + this.submit() }, 10) } } - subLine = (col, record) => { - const { tableId, edData } = this.state + plusLine = (colId, lineId) => { + const { BID } = this.props + const { forms, tableId } = this.state - if (col && col.tableId !== tableId) return - - let _data = edData.map(item => { - if (item.$$uuid === record.$$uuid) { - item.$origin = false - } - return item - }) - - this.setState({edData: _data}, () => { - this.submit() - }) - } - - plusLine = (auto) => { - const { setting } = this.props - const { edData, forms } = this.state - + let edData = fromJS(this.state.edData).toJS() let item = edData.length > 0 ? {...edData[edData.length - 1]} : {} + let index = null + + if (lineId) { + index = edData.findIndex(item => lineId === item.$$uuid) + index = index === -1 ? null : index + + if (index !== null) { + item = {...edData[index]} + } + } + item.key = edData.length item.$$uuid = Utils.getguid() item.$type = 'add' item.$forbid = true item.$Index = '' + item.$$BID = BID || '' forms.forEach(col => { if (col.initval !== '$copy') { @@ -1479,28 +2047,30 @@ } }) - this.setState({edData: [...edData, item]}, () => { - let node = document.getElementById(setting.initId + item.$$uuid) - if (node && !auto) { - if (setting.editType === 'multi') { - if (setting.triType === 'click') { - node.click() - } else { - node.select && node.select() - } - } else { - node.click() - } + let value = '' + Object.keys(item).sort().forEach(key => { + if (/^\$/.test(key)) return + value += item[key] + }) + item.$sign = md5(value) + + if (index === null) { + edData.push(item) + } else { + edData.splice(index, 0, item) + } + + this.setState({edData: edData}, () => { + if (colId) { + MKEmitter.emit('setFocus' + tableId, item.$$uuid, colId) } }) } - delRecord = (id, record) => { + delRecord = (record) => { const { setting } = this.props - const { tableId, edData } = this.state + const { edData } = this.state - if (id !== tableId) return - if (record.$type === 'add') { let _data = edData.filter(item => item.$$uuid !== record.$$uuid) this.setState({edData: _data}) @@ -1510,45 +2080,52 @@ item.$deleted = true item.$origin = false item.$type = 'del' + + record.$deleted = true + record.$origin = false + record.$type = 'del' } return item }) this.setState({edData: _data}, () => { - if (setting.commit === 'simple') { - this.submit() + if (setting.commit === 'change') { + this.submit(record) } }) } } - changeRecord = (id, record) => { + changeRecord = (record) => { const { setting } = this.props - const { tableId, signForms } = this.state + const { edData } = this.state - if (id !== tableId) return + let data = edData.filter(item => item.$$uuid === record.$$uuid)[0] - if (!record.$sign) { + if (!data) return + + if (is(fromJS(data), fromJS(record))) return + + delete record.$forbid + + let value = '' + Object.keys(record).sort().forEach(key => { + if (/^\$/.test(key)) return + value += record[key] + }) + + let sign = md5(value) + + if (record.$sign === sign) { + record.$origin = true + record.$lock = false + } else { record.$origin = false record.$lock = true - delete record.$forbid - } else { - let value = '' - signForms.forEach(field => { - value += record[field] - }) - - if (record.$sign !== md5(value)) { - record.$origin = false - record.$lock = true - } else { - record.$origin = true - record.$lock = false - } } - let _data = this.state.edData.map(item => { + let _data = edData.map(item => { if (item.$$uuid === record.$$uuid) { return record } else { @@ -1563,76 +2140,15 @@ }) } - addRecord = (id, record) => { - const { BID } = this.props - const { edData, forms, tableId } = this.state - - if (id !== tableId) return - - let _edData = fromJS(edData).toJS() - let item = {} - let index = null - let copy = edData.length > 0 ? {...edData[edData.length - 1]} : null - - if (record) { - index = _edData.findIndex(item => record.$$uuid === item.$$uuid) - index = index === -1 ? null : index - - copy = {...record} - } - - if (copy) { - item = {...copy} - } - - item.$$uuid = Utils.getguid() - item.$type = 'add' - item.$Index = '' - item.$forbid = true - item.$$BID = BID || '' - - forms.forEach(col => { - if (col.initval !== '$copy') { - item[col.field] = col.initval - } - if (col.type === 'number') { - item[col.field] = +item[col.field] - if (isNaN(item[col.field])) { - item[col.field] = 0 - } - } - - if (item[col.field] === undefined) { - item[col.field] = '' - } - }) - - if (index === null) { - _edData.push(item) - } else { - _edData.splice(index, 0, item) - } - - this.setState({edData: _edData}) - } - checkData = () => { const { setting } = this.props - const { edData, forms } = this.state - - if (edData.length === 0) { - notification.warning({ - top: 92, - message: '鎻愪氦鏁版嵁涓嶅彲涓虹┖锛�', - duration: 5 - }) - return null - } + const { edData, forms, checkForms } = this.state let data = fromJS(edData).toJS() data = data.filter(item => !item.$forbid) - if (setting.commit === 'change' || setting.commit === 'simple') { + + if (setting.commit === 'amend') { data = data.filter(item => !item.$origin) } @@ -1650,7 +2166,15 @@ data = data.map(item => { let line = [] forms.forEach(col => { - if (col.editable !== 'true' || item.$deleted) { + let check = true + if (col.editable !== 'true' || item.$deleted || !checkForms.includes(col.field)) { + check = false + } + if (col.ctrlField && col.ctrlValue.includes(item[col.ctrlField] + '')) { + check = false + } + + if (!check) { if (col.type === 'number') { item[col.field] = +item[col.field] if (isNaN(item[col.field])) { @@ -1661,32 +2185,42 @@ } return } + if (col.type === 'text') { let val = item[col.field] !== undefined ? (item[col.field] + '') : '' if (col.required === 'true' && !val) { line.push(`${col.label}涓嶅彲涓虹┖`) + } else if (col.datatype === 'datetime' && !val) { + val = '1949-10-01' } item[col.field] = val } else if (col.type === 'number') { let val = item[col.field] if (col.noValue === 'hide' && !val) { + if (col.clearField && checkForms.includes(col.clearField) && !item[col.clearField]) { + let msg = `璇峰~鍐� ${col.label} 鎴� ${col.clearName}` + if (!line.includes(msg)) { + line.push(msg) + } + } val = 0 } else if (!val && val !== 0) { line.push(`${col.label}涓嶅彲涓虹┖`) return - } - val = +val - if (isNaN(val)) { - line.push(`${col.label}鏁版嵁鏍煎紡閿欒`) - return - } - - val = +val.toFixed(col.decimal || 0) - - if (typeof(col.max) === 'number' && val > col.max) { - line.push(`${col.label}涓嶅彲澶т簬${col.max}`) - } else if (typeof(col.min) === 'number' && val < col.min) { - line.push(`${col.label}涓嶅彲灏忎簬${col.min}`) + } else { + val = +val + if (isNaN(val)) { + line.push(`${col.label}鏁版嵁鏍煎紡閿欒`) + return + } + + val = +val.toFixed(col.decimal || 0) + + if (typeof(col.max) === 'number' && val > col.max) { + line.push(`${col.label}涓嶅彲澶т簬${col.max}`) + } else if (typeof(col.min) === 'number' && val < col.min) { + line.push(`${col.label}涓嶅彲灏忎簬${col.min}`) + } } item[col.field] = val @@ -1716,7 +2250,7 @@ return data } - submit = () => { + submit = (record) => { const { submit, BID, setting } = this.props const { forms } = this.state @@ -1732,7 +2266,12 @@ return } - let data = this.checkData() + let data = null + if (record) { + data = [record] + } else { + data = this.checkData() + } if (!data) return @@ -1816,11 +2355,24 @@ let _edData = fromJS(edData).toJS() - _edData = _edData.map(item => { + _edData = _edData.filter(item => { + if (item.$deleted) return false + if (!item.$forbid) { + item.$type = 'upt' item.$origin = true + item.$lock = false } - return item + + let value = '' + Object.keys(item).sort().forEach(key => { + if (/^\$/.test(key)) return + value += item[key] + }) + + item.$sign = md5(value) + + return true }) this.setState({ @@ -1974,7 +2526,9 @@ render() { const { setting, lineMarks, submit } = this.props - const { tableId, edData, columns, loading, pageOptions, selectedRowKeys, visible, midData } = this.state + const { edData, columns, loading, pageOptions, selectedRowKeys, visible, midData, reseting } = this.state + + if (reseting) return null const components = { body: { @@ -2012,12 +2566,19 @@ height = height + 'vh' } + let style = { + '--mk-table-border-color': setting.borderColor || '#e8e8e8', + '--mk-table-color': setting.color || 'rgba(0, 0, 0, 0.65)', + '--mk-table-font-size': setting.fontSize || '14px', + '--mk-table-font-weight': setting.fontWeight || 'normal' + } + return ( <> - {setting.hasSubmit ? <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}> + {setting.hasSubmit && edData.length > 0 ? <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}> <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> </div> : null} - <div className={`edit-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || ''} mk-edit-${setting.editType || 'simple'}`} id={tableId}> + <div className={`edit-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || ''} mk-edit-${setting.editType || 'simple'}`} style={style}> <Table rowKey="$$uuid" components={components} diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss index 873f7e7..be948ed 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss @@ -9,7 +9,7 @@ >.ant-table-wrapper { position: relative; - z-index: 1; + // z-index: 1; } .ant-table { color: inherit; @@ -188,6 +188,14 @@ border: 1px solid var(--mk-sys-color); } } + .ant-calendar-picker { + display: block; + position: absolute; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + } .has-error, .has-error .ant-input-number-input { border-color: #ff4d4f!important; } @@ -220,6 +228,10 @@ text-align: inherit; } } + .ant-calendar-picker { + display: block; + height: 30px; + } .has-error, .has-error .ant-input-number-input { border-color: #ff4d4f!important; } diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx new file mode 100644 index 0000000..e99578c --- /dev/null +++ b/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.jsx @@ -0,0 +1,385 @@ +import React, {Component} from 'react' +import { is, fromJS } from 'immutable' +import { notification, Modal, Table, Input, Tabs } from 'antd' +import moment from 'moment' +import { TableOutlined, CloseCircleFilled } from '@ant-design/icons' + +import Api from '@/api' +import Utils from '@/utils/utils.js' +import MKEmitter from '@/utils/events.js' +import './index.scss' + +const { Search } = Input +const { TabPane } = Tabs + +class PopTable extends Component { + state = { + options: [], + searchKey: '', + pageIndex: 1, + pageSize: 10, + orderBy: '', + loading: false + } + + timer = null + + componentDidMount () { + const { config } = this.props + const { options } = this.state + + if (config.onload === 'true' && options.length === 0) { + this.loadData() + } + } + + loadData () { + const { BID, ID, config } = this.props + const { pageIndex, pageSize, searchKey, orderBy } = this.state + + this.setState({ + loading: true + }) + + let param = { + func: 'sPC_Get_TableData', + obj_name: 'data', + exec_type: 'y', + arr_field: config.arr_field, + default_sql: 'true', + custom_script: '', + menuname: config.label + } + + let sql = '' + let DateCount = '' + let _search = '' + let _orderBy = orderBy || config.order || '' + let _datasource = config.dataSource + + if (config.searchKey && searchKey) { + let fields = config.searchKey.split(',').map(field => field + ` like '%${searchKey}%'`) + _search = 'where ' + fields.join(' OR ') + } + + _datasource = _datasource.replace(/@BID@/ig, `'${BID || ''}'`) + _datasource = _datasource.replace(/@ID@/ig, `'${ID || ''}'`) + + if (config.laypage === 'true') { + sql = `/*system_query*/select top ${pageSize} ${config.arr_field} from (select ${config.arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` + DateCount = `/*system_query*/select count(1) as total from ${_datasource} ${_search}` + } else if (_orderBy) { + sql = `/*system_query*/select ${config.arr_field} from (select ${config.arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_datasource} ${_search}) tmptable order by tmptable.rows ` + } else { + sql = `/*system_query*/select ${config.arr_field} from ${_datasource} ${_search} ` + } + + let departmentcode = sessionStorage.getItem('departmentcode') || '' + let organization = sessionStorage.getItem('organization') || '' + let mk_user_type = sessionStorage.getItem('mk_user_type') || '' + + sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + Select @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}' + ${sql}` + + // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 + if (window.GLOB.debugger === true) { + console.info(`/*${config.label} 鏁版嵁婧�*/\n` + sql.replace(/\n\s{6}/ig, '\n')) + DateCount && console.info(`/*${config.label} 鎬绘暟鏌ヨ*/\n` + DateCount.replace(/\n\s{6}/ig, '\n')) + } + + param.LText = Utils.formatOptions(sql) + param.DateCount = Utils.formatOptions(DateCount) + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + + param.username = sessionStorage.getItem('User_Name') || '' + param.fullname = sessionStorage.getItem('Full_Name') || '' + + Api.getSystemCacheConfig(param, config.cache === 'true').then(result => { + if (result.status) { + let options = result.data.map((item, index) => { + item.key = index + item.$$uuid = item[config.primaryKey] || '' + + if (config.controlField && item[config.controlField] === 'true') { + item.$disabled = true + } + + return item + }) + + this.setState({ + options: options, + total: result.total || 0, + loading: false + }) + + if (result.message) { + if (result.ErrCode === 'Y') { + Modal.success({ + title: result.message + }) + } else if (result.ErrCode === 'S') { + notification.success({ + top: 92, + message: result.message, + duration: 2 + }) + } + } + } else { + this.setState({ + loading: false + }) + + if (!result.message) return + if (result.ErrCode === 'N') { + Modal.error({ + title: result.message, + }) + } else if (result.ErrCode !== '-2') { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + }) + } + + searchOption = (val) => { + this.setState({searchKey: val}) + + if (this.timer) { + clearTimeout(this.timer) + } + + this.timer = setTimeout(() => { + this.loadData() + }, 500) + } + + changeRow = (record) => { + if (record.$disabled) return + + this.props.onChange(record) + } + + changeTable = (pagination, filters, sorter) => { + let orderBy = '' + + if (sorter.field && sorter.order) { + if (sorter.order === 'ascend') { + orderBy = `${sorter.field} asc` + } else { + orderBy = `${sorter.field} desc` + } + } + + this.setState({ + pageIndex: pagination.current, + pageSize: pagination.pageSize, + orderBy: orderBy, + }, () => { + this.loadData() + }) + } + + render() { + const { config, value } = this.props + const { options, loading, total, pageIndex, pageSize } = this.state + + return <> + {config.searchKey ? <Search placeholder={config.placeholder} onSearch={this.searchOption} enterButton /> : null} + <Table + rowKey="$$uuid" + bordered={true} + rowSelection={null} + columns={config.cols} + dataSource={options} + loading={loading} + onRow={(record) => { + let className = '' + + if (record.$disabled) { + className = ' mk-disable-line ' + } else if (value === record.$$uuid) { + className = ' ant-table-row-selected ' + } + + return { + className: className, + onClick: () => {this.changeRow(record)}, + } + }} + onChange={this.changeTable} + pagination={config.laypage === 'true' ? { + current: pageIndex, + pageSize: pageSize, + showSizeChanger: true, + total: total || 0, + showTotal: (total, range) => `${range[0]}-${range[1]} 鍏� ${total} 鏉 + } : false} + /> + </> + } +} + +class MKPopSelect extends Component { + constructor(props) { + super(props) + + this.state = { + value: props.defaultValue, + visible: false + } + } + + componentDidMount() { + const { autoFocus, config } = this.props + + MKEmitter.addListener('setFocus' + config.tableId, this.setFocus) + + if (autoFocus) { + this.trigger() + } + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('setFocus' + this.props.config.tableId, this.setFocus) + } + + setFocus = (lId, colId) => { + const { config, lineId } = this.props + + if (lId !== lineId || config.uuid !== colId) return + + if (config.$ctrl) { + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + + this.setState({visible: true}) + } + + selectChange = (record) => { + const { config, lineId } = this.props + + let values = {[config.field]: record.$$uuid} + + if (config.linkSubField) { + config.linkSubField.forEach((m, i) => { + values[m] = record[m] !== undefined ? record[m] : '' + }) + } + + this.props.onChange(values, record.$$uuid) + + this.setState({visible: false}) + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + + this.props.onBlur && this.props.onBlur() + + if (config.enter === '$noAct') return + + if (/\$next/.test(config.enter)) { + MKEmitter.emit('nextLine' + config.tableId, lineId, config.enter.replace('$next_', '')) + } else { + MKEmitter.emit('setFocus' + config.tableId, lineId, config.enter) + } + } + + trigger = (e) => { + const { config, lineId } = this.props + + e && e.stopPropagation() + + if (config.$ctrl) { + MKEmitter.emit('colFocus' + config.tableId, lineId, config.uuid) + } + + this.setState({visible: true}) + } + + clear = (e) => { + const { config, lineId } = this.props + + e.stopPropagation() + + let values = {[config.field]: ''} + + if (config.linkSubField) { + config.linkSubField.forEach((m, i) => { + values[m] = '' + }) + } + + this.props.onChange(values, '') + this.setState({value: ''}) + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + } + + cancel = () => { + const { config, lineId } = this.props + + this.setState({visible: false}) + + if (config.$ctrl) { + MKEmitter.emit('colBlur' + config.tableId, lineId, config.uuid) + } + + this.props.onBlur && this.props.onBlur() + } + + render() { + const { autoFocus, BID, lineId, config } = this.props + const { value, visible } = this.state + + return <> + {autoFocus ? <div className="mk-pop-select-mask" onClick={this.trigger}></div> : null} + <div className="mk-pop-select-wrap" onClick={this.trigger}> + {value} + {value && !autoFocus ? <CloseCircleFilled onClick={this.clear} /> : null} + <TableOutlined onClick={this.trigger}/> + </div> + <Modal + wrapClassName='mk-table-pop-select-modal' + title={config.label} + visible={visible} + closable={true} + centered={true} + maskClosable={false} + cancelText="鍏抽棴" + width={config.popWidth < 100 ? config.popWidth + 'vw' : config.popWidth} + onCancel={this.cancel} + destroyOnClose + > + {config.pops ? <Tabs> + {config.pops.map(tab => ( + <TabPane tab={tab.tabName} key={tab.uuid}> + <PopTable config={tab} BID={BID} ID={lineId} value={value} onChange={this.selectChange}/> + </TabPane> + ))} + </Tabs> : + <PopTable config={config} BID={BID} ID={lineId} value={value} onChange={this.selectChange}/>} + </Modal> + </> + } +} + +export default MKPopSelect \ No newline at end of file diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.scss new file mode 100644 index 0000000..3784895 --- /dev/null +++ b/src/tabviews/custom/components/table/edit-table/normalTable/mkPopSelect/index.scss @@ -0,0 +1,127 @@ +.mk-pop-select-wrap { + position: relative; + box-sizing: border-box; + margin: 0; + padding: 0 30px 0 11px; + color: rgba(0, 0, 0, 0.65); + font-size: 14px; + font-variant: tabular-nums; + list-style: none; + font-feature-settings: 'tnum'; + position: relative; + display: inline-block; + width: 100%; + outline: 0; + border: 1px solid #d9d9d9; + border-top-width: 1.02px; + background: #ffffff; + user-select: none; + height: 32px; + cursor: pointer; + transition: all 0.3s; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + line-height: 30px; + vertical-align: top; + + .anticon-table { + padding: 7px; + color: rgba(0, 0, 0, 0.25); + transition: color 0.3s; + font-size: 14px; + position: absolute; + right: 0px; + top: 0px; + } + .anticon-close-circle { + color: rgba(0, 0, 0, 0.25); + transition: all 0.3s; + padding: 7px; + opacity: 0; + position: absolute; + right: 25px; + } + .anticon-close-circle:hover { + color: rgba(0, 0, 0, 0.45); + } +} +.mk-pop-select-wrap:hover, .mk-pop-select-mask:hover + .mk-pop-select-wrap { + border-color: var(--mk-sys-color5); + box-shadow: 0 0 0 2px var(--mk-sys-color2); + + .anticon-table { + color: var(--mk-sys-color); + } + .anticon-close-circle { + opacity: 1; + } +} +.mk-pop-select-mask { + position: absolute; + background: #ffffff; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + height: auto; + border: 1px solid #d9d9d9; + cursor: pointer; +} +.mk-pop-select-mask + .mk-pop-select-wrap { + border: none; + box-shadow: none!important; + padding-left: 0px; +} +.mk-table-pop-select-modal { + .ant-modal-body { + min-height: 200px; + max-height: calc(100vh - 210px); + overflow-y: auto; + + .ant-input-search { + max-width: 300px; + margin-bottom: 20px; + } + .ant-tabs { + margin-top: -20px; + } + table { + td { + padding: 12px 16px; + } + tr:not(.ant-table-row-selected):hover > td { + background-color: var(--mk-sys-color1); + } + tr.ant-table-row-selected td { + background-color: var(--mk-sys-color3); + } + tr:not(.mk-disable-line) { + cursor: pointer; + } + .mk-disable-line { + color: rgba(0, 0, 0, 0.35); + } + } + } + .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); + } + + .ant-modal-footer { + .ant-btn-primary { + display: none; + } + } +} \ No newline at end of file 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/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss index 5a2828b..5f5f0da 100644 --- a/src/tabviews/custom/components/table/normal-table/index.scss +++ b/src/tabviews/custom/components/table/normal-table/index.scss @@ -14,7 +14,7 @@ } .main-table-box { position: relative; - min-height: 150px; + min-height: 40px; .main-pickup { position: absolute; right: 5px; 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..b2a01d8 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 } @@ -190,7 +190,7 @@ delete item.style.shadowColor } - item.$menuname = (Tab.label || '') + '-' + (item.name || '') + item.$menuname = (Tab.logLabel || Tab.label || '') + '-' + (item.name || '') if (item.type === 'tabs') { if ( diff --git a/src/tabviews/zshare/actionList/editLine/index.jsx b/src/tabviews/zshare/actionList/editLine/index.jsx index 7d29501..142d977 100644 --- a/src/tabviews/zshare/actionList/editLine/index.jsx +++ b/src/tabviews/zshare/actionList/editLine/index.jsx @@ -96,9 +96,9 @@ let data = selectedData || [] if (btn.funcType === 'addline') { - MKEmitter.emit('addRecord', btn.$tableId, data[0] || null) + MKEmitter.emit('addRecord' + btn.$tableId, '', data[0] ? data[0].$$uuid : null) } else { - MKEmitter.emit('delRecord', btn.$tableId, data[0] || null) + MKEmitter.emit('delRecord' + btn.$tableId, data[0] || null) } } diff --git a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx index ee873ec..ee748ae 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/excelin/index.jsx @@ -60,14 +60,16 @@ } else { let iserror = false btnColumns.forEach(op => { + if (iserror) return + let _name = typeof(header[op.Column]) === 'string' ? header[op.Column].replace(/(^\s*|\s*$)/g, '') : header[op.Column] let _text = op.Text ? op.Text.replace(/(^\s*|\s*$)/g, '') : op.Text - if (!_name && !iserror) { + if (!_name) { iserror = true errors = 'headerError' errDetail = `Excel涓笉瀛樺湪锛�${_text}锛夊垪锛乣 - } else if (_name !== _text && !iserror) { + } else if (_name !== _text) { iserror = true errors = 'headerError' errDetail = `Excel涓紙${_name}锛変笌鎸夐挳鍒椾俊鎭紙${_text}锛変笉涓�鑷达紒` diff --git a/src/tabviews/zshare/actionList/index.scss b/src/tabviews/zshare/actionList/index.scss index 1d31f09..23d8916 100644 --- a/src/tabviews/zshare/actionList/index.scss +++ b/src/tabviews/zshare/actionList/index.scss @@ -56,7 +56,10 @@ height: 34px; border-radius: 0px; padding-left: 15px!important; - border-bottom-width: 1px!important; + border: none; + color: rgba(0, 0, 0, 0.65)!important; + border-bottom: 1px solid #e8e8e8!important; + background: #ffffff!important; .anticon { display: none; } 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/tabviews/zshare/mutilform/mkPopSelect/index.jsx b/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx index 0181c89..320dceb 100644 --- a/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx +++ b/src/tabviews/zshare/mutilform/mkPopSelect/index.jsx @@ -55,7 +55,7 @@ dataIndex: col.field, title: col.label, sorter: col.IsSort === 'true', - width: 120 + width: col.Width || 120 }) }) @@ -350,8 +350,16 @@ dataSource={options} loading={loading} onRow={(record) => { + let className = '' + + if (record.$disabled) { + className = ' mk-disable-line ' + } else if (value === record.$$uuid) { + className = ' ant-table-row-selected ' + } + return { - className: value === record.$$uuid ? ' ant-table-row-selected ' : '', + className: className, onClick: () => {this.changeRow(record)}, } }} diff --git a/src/tabviews/zshare/mutilform/mkPopSelect/index.scss b/src/tabviews/zshare/mutilform/mkPopSelect/index.scss index 245486d..9663e3f 100644 --- a/src/tabviews/zshare/mutilform/mkPopSelect/index.scss +++ b/src/tabviews/zshare/mutilform/mkPopSelect/index.scss @@ -33,12 +33,21 @@ margin-bottom: 20px; } table { + td { + padding: 12px 16px; + } tr:not(.ant-table-row-selected):hover > td { background-color: var(--mk-sys-color1); } tr.ant-table-row-selected td { background-color: var(--mk-sys-color3); } + tr:not(.mk-disable-line) { + cursor: pointer; + } + .mk-disable-line { + color: rgba(0, 0, 0, 0.35); + } } } .ant-modal-body::-webkit-scrollbar { diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index 58be363..d5bce34 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -102,6 +102,11 @@ }, { type: 'form', + label: '閫夋嫨鍣�', + subType: 'popSelect', + }, + { + type: 'form', label: '寮�鍏�', subType: 'switch', }, 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/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 7b474da..c4708cd 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -530,7 +530,6 @@ changeColumns = (columns) => { const { verify } = this.state - let reset = false columns = columns.map(col => { col.type = col.type || 'Nvarchar(50)' if (col.type === 'text' || col.type === 'image') { @@ -539,19 +538,18 @@ col.type = 'Decimal(18,2)' } + if (col.import === 'init') { + col.required = 'false' + col.min = '' + col.max = '' + } + if (/^Nvarchar/ig.test(col.type)) { col.limit = col.type.match(/\d+/) ? col.type.match(/\d+/)[0] : '20000' } else if (/^Decimal/ig.test(col.type)) { col.limit = col.type.match(/\d+/ig)[1] - if (col.required === 'false') { - reset = true - } - col.required = 'true' } else if (/^int/ig.test(col.type)) { - if (col.required === 'false') { - reset = true - } - col.required = 'true' + } else { col.limit = '' } @@ -561,10 +559,6 @@ return col }) - - if (reset) { - message.warning('鏁板�肩被鍨嬪潎涓哄繀濉��') - } this.setState({verify: {...verify, columns}}, () => { this.resetUniqueColumns() diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index 20bb8e3..710956c 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -104,7 +104,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { sql = `${declare} @@ -112,7 +112,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { sql = `${declare} diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx index 6e3b387..1998688 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx @@ -69,7 +69,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' @@ -78,7 +78,7 @@ ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' 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/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx index c728c2b..ca11a57 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx @@ -105,7 +105,7 @@ ${_dataresource} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' 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/sharecomponent/treesettingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx index 6d3c3f2..7d91a7c 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx @@ -66,7 +66,7 @@ ${_dataresource} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { sql = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) select @ErrorCode='',@retmsg ='' diff --git a/src/templates/zshare/editTable/cusSwitch/index.jsx b/src/templates/zshare/editTable/cusSwitch/index.jsx deleted file mode 100644 index 82cd954..0000000 --- a/src/templates/zshare/editTable/cusSwitch/index.jsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -// import { is, fromJS } from 'immutable' -import { Switch } from 'antd' - -import './index.scss' - -class ColorSketch extends Component { - static propTpyes = { - defaultValue: PropTypes.any, - value: PropTypes.any, - onChange: PropTypes.func - } - state = { - status: true, - } - - UNSAFE_componentWillMount () { - const { defaultValue, value } = this.props - let initVal = 'true' - - if (this.props['data-__meta']) { - initVal = this.props['data-__meta'].initialValue - } else if (defaultValue) { - initVal = defaultValue - } else if (value) { - initVal = value - } - - if (initVal === 'false') { - initVal = false - } else { - initVal = true - } - - this.setState({status: initVal}) - } - - changeStatus = (val) => { - this.setState({ status: val }, () => { - let _val = val ? 'true' : 'false' - this.props.onChange && this.props.onChange(_val) - }) - } - - render() { - const { status } = this.state - return ( - <Switch checkedChildren="鏄�" unCheckedChildren="鍚�" checked={status} onChange={this.changeStatus} /> - ) - } -} - -export default ColorSketch \ No newline at end of file diff --git a/src/templates/zshare/editTable/cusSwitch/index.scss b/src/templates/zshare/editTable/cusSwitch/index.scss deleted file mode 100644 index 96900ce..0000000 --- a/src/templates/zshare/editTable/cusSwitch/index.scss +++ /dev/null @@ -1,40 +0,0 @@ -.color-sketch-block { - height: 25px; - width: 100%; - - .color-sketch-block-box { - display: inline-block; - width: calc(100% - 160px); - height: 100%; - border-radius: 2px; - background: #ffffff url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==') left center; - } - .color-sketch-block-inner { - display: inline-block; - cursor: pointer; - border-radius: 2px; - box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); - width: 100%; - height: 100%; - } - .color-sketch-value { - display: inline-block; - width: 160px; - padding-left: 10px; - height: 25px; - line-height: 25px; - vertical-align: top; - white-space: nowrap; - overflow: visible; - } -} - -.color-sketch-popover { - z-index: 1090!important; - .ant-popover-inner-content { - padding: 0; - .sketch-picker { - width: 250px!important; - } - } -} \ No newline at end of file diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx index 24902d3..eeb913e 100644 --- a/src/templates/zshare/editTable/index.jsx +++ b/src/templates/zshare/editTable/index.jsx @@ -2,13 +2,12 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { DndProvider, DragSource, DropTarget } from 'react-dnd' -import { Table, Input, InputNumber, Popconfirm, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd' +import { Table, Input, InputNumber, Popconfirm, Switch, Form, Select, Radio, Cascader, notification, message, Modal, Typography } from 'antd' import { CopyOutlined, EditOutlined, DeleteOutlined, SwapOutlined, PlusOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' import ColorSketch from '@/mob/colorsketch' import asyncComponent from '@/utils/asyncComponent' -import CusSwitch from './cusSwitch' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -19,6 +18,52 @@ let dragingIndex = -1 const { Paragraph } = Typography +class CusSwitch extends Component { + static propTpyes = { + defaultValue: PropTypes.any, + value: PropTypes.any, + onChange: PropTypes.func + } + state = { + status: true + } + + UNSAFE_componentWillMount () { + const { defaultValue, value } = this.props + let initVal = 'true' + + if (this.props['data-__meta']) { + initVal = this.props['data-__meta'].initialValue + } else if (defaultValue) { + initVal = defaultValue + } else if (value) { + initVal = value + } + + if (initVal === 'false') { + initVal = false + } else { + initVal = true + } + + this.setState({status: initVal}) + } + + changeStatus = (val) => { + this.setState({ status: val }, () => { + let _val = val ? 'true' : 'false' + this.props.onChange && this.props.onChange(_val) + }) + } + + render() { + const { status } = this.state + return ( + <Switch checkedChildren="鏄�" unCheckedChildren="鍚�" checked={status} onChange={this.changeStatus} /> + ) + } +} + class BodyRow extends React.Component { render() { const { isOver, moveAble, connectDragSource, connectDropTarget, moveRow, ...restProps } = this.props diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 6e13fc6..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') { @@ -3116,6 +1274,14 @@ return '鍚�' } } + }, + { + title: '鍒楀', + dataIndex: 'Width', + inputType: 'number', + editable: true, + width: '20%', + initval: 120 } ] }, @@ -4456,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..3c4adea 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -979,7 +979,11 @@ }) } } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) { - if (!val && val !== 0) { + if (col.required === 'false') { + if (!val || isNaN(val)) { + val = 0 + } + } else if (!val && val !== 0) { errors.push(_position + '鍐呭涓嶅彲涓虹┖') } else if (isNaN(val)) { // 妫�楠屾槸鍚︿负鏁板�� errors.push(_position + '鍐呭搴斾负鏁板��') @@ -2370,6 +2374,10 @@ _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) _sql = _sql.replace(/@typename@/ig, `'admin'`) + if (window.GLOB.externalDatabase !== null) { + _sql = _sql.replace(/@db@/ig, window.GLOB.externalDatabase) + } + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, `'Y'`) } else { @@ -2394,9 +2402,8 @@ /** * @description 鑾峰彇鏍囪淇℃伅 */ -export function getMark (marks, record, style = {}) { - let res = {} - style = JSON.parse(JSON.stringify(style)) +export function getMark (marks, record, style) { + let res = {signType: ''} 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..8012bf6 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 @@ -540,6 +553,16 @@ auto: config.printPage === 'auto', config }, () => { + if (config.normalcss) { + let node = document.getElementById(config.uuid) + node && node.remove() + + let ele = document.createElement('style') + ele.id = config.uuid + ele.innerHTML = config.normalcss + document.getElementsByTagName('head')[0].appendChild(ele) + } + if (params.length === 0 && initInters.length === 0) { this.setState({loadingview: false, pages: [config.components]}) } else if (initInters.length > 0) { @@ -596,6 +619,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