From 0eacb2fbcaa01060f81219d1ce5b406ae50f0c80 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 06 四月 2023 17:48:10 +0800 Subject: [PATCH] Merge branch 'develop' --- src/templates/sharecomponent/settingcomponent/index.jsx | 1 src/menu/components/table/base-table/columns/index.scss | 3 src/menu/components/table/base-table/columns/editColumn/index.jsx | 21 ++ src/tabviews/custom/components/table/base-table/index.scss | 18 - src/tabviews/custom/components/card/double-data-card/index.scss | 4 src/tabviews/subtable/index.scss | 13 - src/menu/components/table/normal-table/options.jsx | 79 ++------ src/menu/components/table/base-table/options.jsx | 15 + src/tabviews/basetable/index.scss | 6 src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx | 2 src/tabviews/subtabtable/index.scss | 13 - src/templates/comtableconfig/updatetable/index.jsx | 103 +++++++--- src/tabviews/custom/components/share/normalTable/index.scss | 64 +++++++ src/tabviews/custom/popview/index.scss | 6 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 21 ++ src/tabviews/zshare/actionList/index.jsx | 54 ++++- src/menu/components/table/edit-table/columns/index.scss | 3 src/tabviews/custom/components/share/normalTable/index.jsx | 12 + src/tabviews/custom/index.scss | 6 src/menu/components/table/normal-table/columns/index.scss | 5 src/tabviews/custom/components/card/data-card/index.scss | 4 src/tabviews/custom/components/table/normal-table/index.scss | 17 - src/tabviews/custom/components/table/edit-table/index.scss | 47 ----- 23 files changed, 282 insertions(+), 235 deletions(-) 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 f7b9799..7af08ee 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { getColumnForm } from './formconfig' @@ -284,6 +284,25 @@ </Form.Item> </Col> ) + } else if (item.type === 'checkbox') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal + })( + <Checkbox.Group> + {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} + </Checkbox.Group> + )} + </Form.Item> + </Col> + ) } else if (item.type === 'multiselect') { // 澶氶�� fields.push( <Col span={12} key={index}> diff --git a/src/menu/components/table/base-table/columns/index.scss b/src/menu/components/table/base-table/columns/index.scss index 46cb41d..2970611 100644 --- a/src/menu/components/table/base-table/columns/index.scss +++ b/src/menu/components/table/base-table/columns/index.scss @@ -99,6 +99,9 @@ .ant-table-small > .ant-table-content > .ant-table-body { margin: 0; } + .ant-table-small > .ant-table-content .ant-table-thead > tr > th { + background-color: #fafafa!important; + } table, tr, th, td { border-color: var(--mk-table-border-color)!important; diff --git a/src/menu/components/table/base-table/options.jsx b/src/menu/components/table/base-table/options.jsx index 22efc6a..b8ae7e5 100644 --- a/src/menu/components/table/base-table/options.jsx +++ b/src/menu/components/table/base-table/options.jsx @@ -32,8 +32,8 @@ { type: 'radio', field: 'actionfixed', - label: '鎸夐挳鍥哄畾', - initval: wrap.actionfixed || 'false', + label: '鍥哄畾鎸夐挳', + initval: wrap.actionfixed !== 'true' ? 'false' : 'true', required: false, options: [ {value: 'true', label: '鏄�'}, @@ -41,6 +41,17 @@ ] }, { + type: 'checkbox', + field: 'colfixed', + label: '鍥哄畾鍒�', + initval: wrap.colfixed || [], + required: false, + options: [ + {value: 'first', label: '棣栧垪'}, + {value: 'last', label: '灏惧垪'}, + ] + }, + { type: 'radio', field: 'size', label: '琛ㄦ牸澶у皬', diff --git a/src/menu/components/table/edit-table/columns/index.scss b/src/menu/components/table/edit-table/columns/index.scss index 0accff1..b5001b6 100644 --- a/src/menu/components/table/edit-table/columns/index.scss +++ b/src/menu/components/table/edit-table/columns/index.scss @@ -128,6 +128,9 @@ .ant-table-small > .ant-table-content > .ant-table-body { margin: 0; } + .ant-table-small > .ant-table-content .ant-table-thead > tr > th { + background-color: #fafafa!important; + } table, tr, th, td { border-color: var(--mk-table-border-color)!important; 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 19aa359..d299f89 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { getColumnForm } from './formconfig' @@ -276,6 +276,25 @@ </Form.Item> </Col> ) + } else if (item.type === 'checkbox') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal + })( + <Checkbox.Group> + {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} + </Checkbox.Group> + )} + </Form.Item> + </Col> + ) } else if (item.type === 'multiselect') { // 澶氶�� fields.push( <Col span={12} key={index}> diff --git a/src/menu/components/table/normal-table/columns/index.scss b/src/menu/components/table/normal-table/columns/index.scss index 5de869d..ccb549b 100644 --- a/src/menu/components/table/normal-table/columns/index.scss +++ b/src/menu/components/table/normal-table/columns/index.scss @@ -137,6 +137,11 @@ color: var(--mk-table-color); } } +.normal-table-columns:not(.ghost) { + .ant-table-small > .ant-table-content .ant-table-thead > tr > th { + background-color: #fafafa!important; + } +} .normal-table-columns.false { .ant-pagination { display: none; diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx index b876e95..8cf29d7 100644 --- a/src/menu/components/table/normal-table/options.jsx +++ b/src/menu/components/table/normal-table/options.jsx @@ -82,6 +82,30 @@ }, { type: 'radio', + field: 'actionfixed', + label: '鍥哄畾鎸夐挳', + initval: wrap.actionfixed !== 'true' ? 'false' : 'true', + required: false, + options: [ + {value: 'true', label: '鏄�'}, + {value: 'false', label: '鍚�'}, + ], + forbid: appType === 'mob' || appType === 'pc' + }, + { + type: 'checkbox', + field: 'colfixed', + label: '鍥哄畾鍒�', + initval: wrap.colfixed || [], + required: false, + options: [ + {value: 'first', label: '棣栧垪'}, + {value: 'last', label: '灏惧垪'}, + ], + forbid: appType === 'mob' || appType === 'pc' + }, + { + type: 'radio', field: 'tableHeader', label: '琛ㄥご', initval: wrap.tableHeader || 'show', @@ -142,31 +166,6 @@ {value: 'sign', label: '閫変腑鏍囪'} ], }, - // { - // type: 'radio', - // field: 'selected', - // label: '棣栬閫変腑', - // initval: wrap.selected || 'false', - // tooltip: '褰撴寜閽墽琛屽畬鎴愬苟杩斿洖涓婚敭鍊兼椂锛岄粯璁ら�変腑涓婚敭鍊煎搴旇銆�', - // required: false, - // options: [ - // {value: 'false', label: '鏃�'}, - // {value: 'init', label: '鍒濆鍖�'}, - // {value: 'always', label: '鏁版嵁鍔犺浇'}, - // ] - // }, - // { - // type: 'radio', - // field: 'show', - // label: '鎼滅储鎸夐挳', - // initval: wrap.show || 'true', - // tooltip: '鎼滅储鏉′欢瀛樺湪鏃讹紝鍙�夋嫨鏄惁鏄剧ず鎼滅储鎸夐挳銆�', - // required: false, - // options: [ - // {value: 'true', label: '鏄剧ず'}, - // {value: 'false', label: '闅愯棌'}, - // ] - // }, { type: 'color', field: 'borderColor', @@ -188,36 +187,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, - // forbid: appType === 'mob' - // }, { type: 'number', field: 'btnlimit', diff --git a/src/tabviews/basetable/index.scss b/src/tabviews/basetable/index.scss index ca8acd1..8581886 100644 --- a/src/tabviews/basetable/index.scss +++ b/src/tabviews/basetable/index.scss @@ -43,12 +43,6 @@ .ant-btn-link:hover { opacity: 0.8; } - .button-list.toolbar-button { - button { - height: auto; - min-height: 28px; - } - } } .custom-table-wrap.loading { .ant-spin-spinning:not(.view-spin) { diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index 820b993..93dcf57 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -6,14 +6,12 @@ min-height: 20px; overflow-y: auto; - >.button-list.toolbar-button { + .button-list.toolbar-button { padding: 0; line-height: 45px; button { margin-right: 0px; margin-bottom: 0px; - min-height: 28px; - height: auto; } } 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 9ca06c2..af72222 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.scss +++ b/src/tabviews/custom/components/card/double-data-card/index.scss @@ -6,14 +6,12 @@ min-height: 20px; overflow-y: auto; - >.button-list.toolbar-button { + .button-list.toolbar-button { padding: 0; line-height: 45px; button { margin-right: 0px; margin-bottom: 0px; - min-height: 28px; - height: auto; } } diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 1926c23..07adac0 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -991,8 +991,18 @@ loading = false } + let fixed = '' + if (setting.colfixed && setting.colfixed.length) { + if (setting.colfixed.includes('first')) { + fixed = 'mk-fixed-first-col' + } + if (setting.colfixed.includes('last')) { + fixed += ' mk-fixed-last-col' + } + } + return ( - <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length}`} id={tableId}> + <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed}`} id={tableId}> {(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/share/normalTable/index.scss b/src/tabviews/custom/components/share/normalTable/index.scss index 5a96fe8..59eddc5 100644 --- a/src/tabviews/custom/components/share/normalTable/index.scss +++ b/src/tabviews/custom/components/share/normalTable/index.scss @@ -225,6 +225,11 @@ // } // } } +.normal-custom-table:not(.ghost) { + .ant-table-small > .ant-table-content .ant-table-thead > tr > th { + background-color: #fafafa!important; + } +} .normal-custom-table:not(.fixed-height) { .ant-table-body::-webkit-scrollbar { width: 8px; @@ -255,6 +260,65 @@ display: none; } } +.normal-custom-table.mk-fixed-last-col { + table { + .ant-table-thead { + tr:first-child { + th:last-child { + position: sticky !important; + z-index: 2; + right: 0px; + box-shadow: 0 1px 1px #bcbcbc; + } + } + } + .ant-table-tbody { + tr { + td:last-child { + position: sticky !important; + z-index: 2; + right: 0px; + background: #ffffff; + box-shadow: 0 1px 1px #bcbcbc; + } + } + } + } +} +.normal-custom-table.mk-fixed-first-col { + table { + .ant-table-thead { + tr:first-child { + th:first-child { + position: sticky !important; + z-index: 2; + left: 0px; + } + th.ant-table-selection-column + th { + position: sticky !important; + z-index: 2; + left: 60px; + } + } + } + .ant-table-tbody { + tr { + td:first-child { + position: sticky !important; + z-index: 2; + left: 0px; + background: #ffffff; + } + td.ant-table-selection-column + td{ + position: sticky !important; + z-index: 2; + left: 60px; + background: #ffffff; + } + } + } + } +} .normal-custom-table.ghost { .main-pickup { display: none; diff --git a/src/tabviews/custom/components/table/base-table/index.scss b/src/tabviews/custom/components/table/base-table/index.scss index 34f97b7..f48b15a 100644 --- a/src/tabviews/custom/components/table/base-table/index.scss +++ b/src/tabviews/custom/components/table/base-table/index.scss @@ -9,27 +9,11 @@ border-bottom: 1px solid #efefef; padding-top: 10px; } - >.button-list.toolbar-button { + .button-list.toolbar-button { min-height: 60px; padding-right: 60px; button { - margin-right: 0px; margin-bottom: 0px; - min-height: 28px; - height: auto; - } - } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); } } .main-table-box { diff --git a/src/tabviews/custom/components/table/edit-table/index.scss b/src/tabviews/custom/components/table/edit-table/index.scss index 16ea698..47c5027 100644 --- a/src/tabviews/custom/components/table/edit-table/index.scss +++ b/src/tabviews/custom/components/table/edit-table/index.scss @@ -9,7 +9,7 @@ border-bottom: 1px solid #efefef; padding-top: 10px; } - >.button-list.toolbar-button { + .button-list.toolbar-button { padding: 0; line-height: 45px; float: left; @@ -18,51 +18,6 @@ button { margin-right: 0px; margin-bottom: 0px; - min-height: 28px; - height: auto; - } - } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } - .ant-collapse { - background-color: transparent; - border-radius: 0px; - > .ant-collapse-item { - border: 0; - >.ant-collapse-header { - padding: 0; - .normal-header { - padding-right: 40px; - } - } - } - .ant-collapse-item:last-child > .ant-collapse-content { - border-radius: 0; - .ant-collapse-content-box { - padding: 0; - >.button-list.toolbar-button { - padding: 0; - line-height: 45px; - padding-right: 60px; - button { - margin-right: 0px; - margin-bottom: 0px; - min-height: 28px; - height: auto; - } - } - } } } } \ No newline at end of file diff --git a/src/tabviews/custom/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss index 84e78f6..7f55249 100644 --- a/src/tabviews/custom/components/table/normal-table/index.scss +++ b/src/tabviews/custom/components/table/normal-table/index.scss @@ -16,21 +16,6 @@ button { margin-right: 0px; margin-bottom: 0px; - min-height: 28px; - height: auto; - } - } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); } } .main-table-box { @@ -69,8 +54,6 @@ button { margin-right: 0px; margin-bottom: 0px; - min-height: 28px; - height: auto; } } } diff --git a/src/tabviews/custom/index.scss b/src/tabviews/custom/index.scss index 7d331eb..6799e47 100644 --- a/src/tabviews/custom/index.scss +++ b/src/tabviews/custom/index.scss @@ -43,12 +43,6 @@ .ant-btn-link:hover { opacity: 0.8; } - .button-list.toolbar-button { - button { - height: auto; - min-height: 28px; - } - } } .custom-page-wrap.loading { .ant-spin-spinning:not(.view-spin) { diff --git a/src/tabviews/custom/popview/index.scss b/src/tabviews/custom/popview/index.scss index b69e65d..c3e4b31 100644 --- a/src/tabviews/custom/popview/index.scss +++ b/src/tabviews/custom/popview/index.scss @@ -43,12 +43,6 @@ .ant-btn-link:hover { opacity: 0.8; } - .button-list.toolbar-button { - button { - height: auto; - min-height: 28px; - } - } } .pop-page-wrap.loading { .ant-spin-spinning:not(.view-spin) { diff --git a/src/tabviews/subtable/index.scss b/src/tabviews/subtable/index.scss index 9f855e4..6d16916 100644 --- a/src/tabviews/subtable/index.scss +++ b/src/tabviews/subtable/index.scss @@ -72,19 +72,6 @@ .box404 { padding-top: 30px; } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } > .ant-spin { position: absolute; left: calc(50% - 22px); diff --git a/src/tabviews/subtabtable/index.scss b/src/tabviews/subtabtable/index.scss index 85d52e8..77ab9cb 100644 --- a/src/tabviews/subtabtable/index.scss +++ b/src/tabviews/subtabtable/index.scss @@ -9,19 +9,6 @@ .box404 { padding-top: 30px; } - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } > .ant-spin { position: absolute; left: calc(50% - 22px); diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 6880a1f..df5de33 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -32,27 +32,60 @@ state = { actions: [], - mores: null + mores: null, + listId: '' } UNSAFE_componentWillMount() { const { setting, actions } = this.props + let listId = (() => { + let uuid = [] + let options = '0123456789abcdefghigklmnopqrstuv' + for (let i = 0; i < 32; i++) { + uuid.push(options.substr(Math.floor(Math.random() * 0x20), 1)) + } + return uuid.join('') + })() + if (!setting.btnlimit || setting.btnlimit >= actions.length) { - this.setState({actions: actions}) + this.setState({actions: actions, listId}) } else { let mores = fromJS(actions).toJS() this.setState({ actions: mores.splice(0, setting.btnlimit), - mores + mores, + listId }) } } componentDidMount() { - if (this.buttonRef && this.buttonRef.offsetHeight > 65) { - this.buttonRef.classList.add('double-line') + const { actions, listId } = this.state + + if (actions.length > 9) { + let node = document.getElementById(listId) + + // const resizeObserver = new ResizeObserver((entries) => { + + // }) + // resizeObserver.observe(node) + + let limit = 10 + let index = 1 + let check = () => { + if (node.offsetHeight > 65) { + node.classList.add('double-line') + } else if (index < limit) { + index++ + setTimeout(() => { + check() + }, 100) + } + } + + node && check() } } @@ -200,14 +233,13 @@ } render() { - const { setting, MenuID } = this.props - const { actions, mores } = this.state - let fixed = setting.actionfixed && setting.tabType === 'main' // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮� + const { setting } = this.props + const { actions, mores, listId } = this.state - if (fixed && MenuID) { + if (setting.actionfixed === 'true') { return ( <Affix offsetTop={48}> - <div className="button-list toolbar-button" ref={ref => this.buttonRef = ref} id={fixed ? MenuID + 'mainaction' : ''}> + <div className="button-list toolbar-button" id={listId}> {this.getButtonList(actions)} {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}> <div className="mk-button-more">鏇村<DownOutlined/></div> @@ -217,7 +249,7 @@ ) } else { return ( - <div className="button-list toolbar-button" ref={ref => this.buttonRef = ref} id={fixed ? MenuID + 'mainaction' : ''}> + <div className="button-list toolbar-button" id={listId}> {this.getButtonList(actions)} {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}> <div className="mk-button-more">鏇村<DownOutlined/></div> diff --git a/src/templates/comtableconfig/updatetable/index.jsx b/src/templates/comtableconfig/updatetable/index.jsx index d56aa9b..0523a29 100644 --- a/src/templates/comtableconfig/updatetable/index.jsx +++ b/src/templates/comtableconfig/updatetable/index.jsx @@ -264,7 +264,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: tab.components[0].uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -272,6 +271,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push(tab.label + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -288,7 +289,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: tab.components[0].uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -296,6 +296,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push(tab.label + '涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -313,7 +315,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: item.uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -321,6 +322,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push('涓昏〃涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -337,7 +340,6 @@ uuid: btn.uuid, MenuID: btn.uuid, ParentId: item.uuid, - enabled: false, MenuName: btn.label, tables: _config.tables || [], Template: 'BaseTable', @@ -345,6 +347,8 @@ viewType: 'popview', style: { backgroundColor: '#ffffff', backgroundImage: '', paddingTop: '16px', paddingBottom: '40px', paddingLeft: '16px', paddingRight: '16px' } } + + btn.config.enabled = this.setEnabled(btn.config) } else { errors.push('涓昏〃涓寜閽��' + btn.label + '銆嬮厤缃俊鎭涪澶�') } @@ -359,6 +363,25 @@ } else { this.setPopForm(_resolve, _config, formActions, formTabs, errors) } + } + + setEnabled = (config) => { + let enabled = true + config.components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + if (tab.components[0].errors.length > 0) { + enabled = false + } + }) + } else { + if (item.errors.length > 0) { + enabled = false + } + } + }) + + return enabled } setPopForm = (_resolve, _config, formActions, formTabs, errors) => { @@ -566,20 +589,6 @@ }) tab.components[0].$tables = getTables(tab.components[0]) - - tab.components[0].errors = [] - let columns = tab.components[0].columns.map(c => c.field) - if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute !== 'false' && !tab.components[0].setting.dataresource) { - tab.components[0].errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) - } else if (tab.components[0].setting.interType === 'system' && tab.components[0].setting.execute === 'false' && tab.components[0].scripts.filter(script => script.status !== 'false').length === 0) { - tab.components[0].errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) - } else if (!tab.components[0].setting.primaryKey) { - tab.components[0].errors.push({ level: 0, detail: '鏈缃富閿紒'}) - } else if (!columns.includes(tab.components[0].setting.primaryKey)) { - tab.components[0].errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) - } else if (!tab.components[0].setting.supModule) { - tab.components[0].errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) - } }) } else { item.action.forEach(btn => { @@ -597,20 +606,6 @@ }) item.$tables = getTables(item) - - item.errors = [] - let columns = item.columns.map(c => c.field) - if (item.setting.interType === 'system' && item.setting.execute !== 'false' && !item.setting.dataresource) { - item.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) - } else if (item.setting.interType === 'system' && item.setting.execute === 'false' && item.scripts.filter(script => script.status !== 'false').length === 0) { - item.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) - } else if (!item.setting.primaryKey) { - item.errors.push({ level: 0, detail: '鏈缃富閿紒'}) - } else if (!columns.includes(item.setting.primaryKey)) { - item.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) - } else if (!item.setting.supModule) { - item.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) - } } }) @@ -1214,6 +1209,50 @@ _card.wrap.doubleClick = '' } + _card.errors = [] + let columns = _card.columns.map(c => c.field) + if (_card.setting.interType === 'system' && _card.setting.execute !== 'false' && !_card.setting.dataresource) { + _card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) + } else if (_card.setting.interType === 'system' && _card.setting.execute === 'false' && _card.scripts.filter(script => script.status !== 'false').length === 0) { + _card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) + } else if (!_card.setting.primaryKey) { + _card.errors.push({ level: 0, detail: '鏈缃富閿紒'}) + } else if (!columns.includes(_card.setting.primaryKey)) { + _card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) + } else if (!_card.setting.supModule) { + _card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) + } + + _card.action.forEach(cell => { + if (cell.hidden === 'true') return + if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { + if (!cell.modal || cell.modal.fields.length === 0) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + } + } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣}) + } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣}) + } + }) + + _card.cols.forEach(col => { + if (col.type !== 'action') return + + col.elements.forEach(cell => { + if (cell.hidden === 'true') return + if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { + if (!cell.modal || cell.modal.fields.length === 0) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + } + } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣}) + } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) { + _card.errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣}) + } + }) + }) + return _card } diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx index 4886a07..3f9e0ce 100644 --- a/src/templates/sharecomponent/settingcomponent/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/index.jsx @@ -64,7 +64,6 @@ visible: false, loading: false }) - res.actionfixed = res.actionfixed === 'true' this.props.updatesetting({...config, setting: res}) }, () => { diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx index 9a7fd02..29f51db 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx @@ -450,7 +450,7 @@ {config.Template === 'CommonTable' ? <Col span={8}> <Form.Item label="鎸夐挳鍥哄畾"> {getFieldDecorator('actionfixed', { - initialValue: setting.actionfixed === 'true' || setting.actionfixed === true ? 'true' : 'false' + initialValue: setting.actionfixed === 'true' ? 'true' : 'false' })( <Radio.Group> <Radio value="true">鏄�</Radio> -- Gitblit v1.8.0