From 7b0dbecd1d6155d26ec67be0a47a16264c738c85 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 09 五月 2023 14:48:10 +0800 Subject: [PATCH] 2023-05-09 --- src/templates/zshare/modalform/index.jsx | 5 src/templates/zshare/verifycard/customscript/index.jsx | 2 src/tabviews/custom/popview/index.jsx | 10 src/menu/components/table/edit-table/options.jsx | 156 +- src/templates/modalconfig/index.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.scss | 18 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 2 src/mob/modalconfig/index.jsx | 2 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 39 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 21 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 45 src/tabviews/custom/components/table/edit-table/index.scss | 16 src/tabviews/custom/components/card/cardcellList/index.jsx | 25 src/menu/components/form/tab-form/index.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 75 src/menu/components/search/main-search/dragsearch/card.jsx | 6 src/templates/modalconfig/dragelement/index.scss | 13 src/templates/subtableconfig/index.jsx | 7 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 852 ++++++-------- src/tabviews/zshare/mutilform/index.jsx | 11 src/tabviews/commontable/index.scss | 2 src/menu/components/table/edit-table/columns/index.scss | 10 src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx | 6 src/menu/components/table/normal-table/columns/index.jsx | 2 src/menu/components/table/edit-table/columns/index.jsx | 3 src/menu/components/module/voucher/voucherTable/index.scss | 99 - src/assets/css/viewstyle.scss | 4 src/tabviews/zshare/topSearch/index.jsx | 8 src/templates/sharecomponent/actioncomponent/verifyexcelin/uniqueform/index.jsx | 6 src/templates/comtableconfig/index.jsx | 8 src/menu/components/form/simple-form/index.jsx | 2 src/tabviews/zshare/mutilform/mkCheck/index.jsx | 41 src/tabviews/custom/components/table/edit-table/index.jsx | 254 +-- src/tabviews/zshare/actionList/index.jsx | 84 src/tabviews/zshare/topSearch/index.scss | 4 src/menu/components/table/normal-table/columns/editColumn/index.scss | 18 src/menu/components/table/edit-table/index.jsx | 17 src/menu/components/table/base-table/columns/index.scss | 5 src/menu/components/table/base-table/columns/editColumn/index.jsx | 6 src/tabviews/custom/components/table/base-table/index.scss | 6 src/menu/components/form/step-form/index.jsx | 2 src/templates/comtableconfig/source.jsx | 230 +- src/menu/components/share/actioncomponent/index.jsx | 24 src/tabviews/zshare/mutilform/mkCheck/index.scss | 0 src/menu/components/table/edit-table/columns/tableIn/index.jsx | 21 src/tabviews/zshare/actionList/editLine/index.jsx | 149 ++ src/tabviews/zshare/actionList/popupbutton/index.jsx | 2 src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 2 src/tabviews/subtabtable/index.scss | 2 src/utils/utils-custom.js | 12 src/tabviews/custom/components/share/normalTable/index.scss | 10 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 2 src/menu/components/share/searchcomponent/dragsearch/card.jsx | 6 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 79 src/templates/calendarconfig/source.jsx | 37 src/tabviews/zshare/actionList/normalbutton/index.jsx | 18 src/templates/modalconfig/dragelement/card.jsx | 4 src/tabviews/custom/components/table/normal-table/index.scss | 19 src/menu/components/card/double-data-card/options.jsx | 20 src/tabviews/subtable/index.scss | 2 src/tabviews/calendar/index.scss | 2 src/menu/components/share/actioncomponent/formconfig.jsx | 30 src/tabviews/custom/components/group/normal-group/index.jsx | 94 - src/templates/calendarconfig/index.jsx | 5 src/templates/zshare/pasteform/index.jsx | 2 src/menu/components/card/double-data-card/index.jsx | 4 src/menu/components/card/data-card/index.jsx | 3 src/menu/components/table/base-table/columns/index.jsx | 2 src/menu/components/table/normal-table/index.jsx | 7 src/tabviews/zshare/normalTable/index.scss | 5 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 22 src/tabviews/zshare/actionList/index.scss | 14 src/tabviews/custom/components/card/double-data-card/index.scss | 21 src/templates/subtableconfig/source.jsx | 124 -- src/menu/components/table/normal-table/options.jsx | 12 src/tabviews/custom/components/card/double-data-card/index.jsx | 23 src/templates/zshare/verifycard/callbackcustomscript/index.jsx | 2 src/templates/sharecomponent/searchcomponent/index.jsx | 10 src/templates/sharecomponent/fieldscomponent/index.jsx | 8 src/templates/sharecomponent/columncomponent/index.jsx | 14 src/templates/zshare/verifycard/customform/index.jsx | 2 src/tabviews/custom/components/share/normalheader/index.scss | 2 src/tabviews/custom/components/share/normalTable/index.jsx | 4 src/menu/components/table/normal-table/columns/index.scss | 5 src/tabviews/custom/components/tree/antd-tree/index.scss | 24 src/components/breadview/index.scss | 2 src/tabviews/custom/components/card/data-card/index.scss | 9 src/utils/utils.js | 22 src/tabviews/zshare/actionList/tabbutton/index.jsx | 2 src/tabviews/zshare/actionList/editLine/index.scss | 0 src/tabviews/custom/components/share/tabtransfer/index.jsx | 13 src/templates/zshare/formconfig.jsx | 58 src/menu/components/table/base-table/options.jsx | 12 src/templates/zshare/verifycard/index.jsx | 8 src/menu/replaceField/index.jsx | 110 - src/tabviews/zshare/actionList/printbutton/index.jsx | 12 src/mob/components/formdragelement/card.jsx | 2 src/tabviews/custom/components/table/edit-table/normalTable/index.scss | 146 - src/menu/modalconfig/index.scss | 28 src/templates/sharecomponent/actioncomponent/index.jsx | 14 src/menu/modalconfig/index.jsx | 2 src/menu/components/table/base-table/index.jsx | 6 src/utils/option.js | 32 103 files changed, 1,703 insertions(+), 1,751 deletions(-) diff --git a/src/assets/css/viewstyle.scss b/src/assets/css/viewstyle.scss index 26c8c80..4ecf104 100644 --- a/src/assets/css/viewstyle.scss +++ b/src/assets/css/viewstyle.scss @@ -112,7 +112,7 @@ } } // 鎼滅储鏍� - .top-search { + .mk-search-wrap { >.ant-row { .ant-col.search-button { .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):active, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link).active, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):hover, .ant-btn:not(.ant-btn-primary):not(.ant-btn-link):focus { @@ -135,7 +135,7 @@ } } // 琛ㄦ牸 - .normal-data-table, .normal-custom-table { + .normal-data-table, .normal-custom-table, .edit-custom-table { table { .ant-table-tbody { > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) > td { diff --git a/src/components/breadview/index.scss b/src/components/breadview/index.scss index 52d908d..810603f 100644 --- a/src/components/breadview/index.scss +++ b/src/components/breadview/index.scss @@ -22,7 +22,7 @@ padding-right: 15px; } >.commontable, >.calendar-page { - > .top-search { + > .mk-search-wrap { padding-left: 0; padding-right: 0; margin: 0 24px; diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 56600cb..ae1bcf9 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -204,6 +204,9 @@ if (btn) { card.action = card.action.filter(item => item.uuid !== btn.uuid) + setTimeout(() => { + MKEmitter.emit('revertBtn', card.uuid) + }, 200) } this.updateComponent(card) diff --git a/src/menu/components/card/double-data-card/index.jsx b/src/menu/components/card/double-data-card/index.jsx index c4b9072..1a47d2b 100644 --- a/src/menu/components/card/double-data-card/index.jsx +++ b/src/menu/components/card/double-data-card/index.jsx @@ -197,6 +197,10 @@ if (btn) { card.action = card.action.filter(item => item.uuid !== btn.uuid) + + setTimeout(() => { + MKEmitter.emit('revertBtn', card.uuid) + }, 200) } this.updateComponent(card) diff --git a/src/menu/components/card/double-data-card/options.jsx b/src/menu/components/card/double-data-card/options.jsx index 235adfa..3ff8529 100644 --- a/src/menu/components/card/double-data-card/options.jsx +++ b/src/menu/components/card/double-data-card/options.jsx @@ -210,6 +210,26 @@ required: false }, { + type: 'number', + field: 'zHeight', + label: '楂樺害', + min: 10, + max: 5000, + precision: 0, + initval: wrap.zHeight, + tooltip: '鍗$墖鍖哄煙楂樺害锛屽唴瀹硅秴鍑烘椂绾靛悜婊氬姩銆傛敞锛氬皬浜庣瓑浜�100鏃朵负楂樺害鐨勭櫨鍒嗘瘮锛岀涓�涓墿灞曞睘鎬у崱灏嗗畾浣嶅湪椤堕儴銆�', + required: false, + forbid: appType === 'mob' + }, + { + type: 'color', + field: 'zBColor', + label: '杈规棰滆壊', + initval: wrap.zBColor || 'transparent', + tooltip: '鍗$墖鍖哄煙璁剧疆楂樺害鎴栨渶灏忓搴︽椂锛屾粴鍔ㄥ尯鍩熻竟妗嗙殑棰滆壊銆�', + required: false + }, + { type: 'radio', field: 'permission', label: '鏉冮檺楠岃瘉', diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index a3ad770..3f75c5d 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -357,7 +357,7 @@ }) } - if (item.type === 'switch') { + if (item.type === 'switch' || item.type === 'check') { _linksupFields.push({ field: item.field, label: item.label diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index b256034..c5624f9 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -459,7 +459,7 @@ }) } - if (item.type === 'switch') { + if (item.type === 'switch' || item.type === 'check') { _linksupFields.push({ field: item.field, label: item.label diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index 7f30bd1..ae873e0 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -464,7 +464,7 @@ }) } - if (item.type === 'switch') { + if (item.type === 'switch' || item.type === 'check') { _linksupFields.push({ field: item.field, label: item.label diff --git a/src/menu/components/module/voucher/voucherTable/index.scss b/src/menu/components/module/voucher/voucherTable/index.scss index 4b99f1f..bf74398 100644 --- a/src/menu/components/module/voucher/voucherTable/index.scss +++ b/src/menu/components/module/voucher/voucherTable/index.scss @@ -159,103 +159,4 @@ td.pointer { position: relative; } - td.pointer { - .mk-mask { - display: none; - cursor: pointer; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - } - } -} -.edit-custom-table.editable { - td { - background-color: #ffffff!important; - } - td.pointer .mk-mask { - display: block; - } - .mk-operation { - display: none; - } - .ant-table-placeholder { - display: none; - } -} -.edit-custom-table:not(.fixed-height) { - .ant-table-body::-webkit-scrollbar { - width: 8px; - height: 10px; - } - ::-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); - } - ::-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); - } -} -.edit-custom-table.fixed-height { - .ant-table-body { - border-bottom: 1px solid rgba(0, 0, 0, .05); - .ant-table-fixed { - border-bottom: 0; - } - } -} -.edit-custom-table.hidden { - thead { - display: none; - } -} -.edit-custom-table.ghost { - .ant-table-thead > tr { - > th { - color: inherit; - background: transparent; - .ant-table-column-sorter .ant-table-column-sorter-inner { - color: inherit; - } - } - > th:hover { - background: transparent; - } - } - .ant-table-body { - overflow-x: auto; - tr { - td { - background: transparent!important; - } - } - tr:hover td { - background: transparent!important; - } - } -} -.image-scale-modal { - width: 70vw; - min-height: 80vh; - top: 10vh; - .ant-modal-body { - min-height: calc(80vh - 110px); - line-height: calc(80vh - 160px); - text-align: center; - } - .ant-modal-footer { - text-align: center; - span { - display: inline-block; - color: #1890ff; - padding: 5px 15px; - cursor: pointer; - } - } } \ No newline at end of file diff --git a/src/menu/components/search/main-search/dragsearch/card.jsx b/src/menu/components/search/main-search/dragsearch/card.jsx index 4e36738..666ac3f 100644 --- a/src/menu/components/search/main-search/dragsearch/card.jsx +++ b/src/menu/components/search/main-search/dragsearch/card.jsx @@ -1,6 +1,6 @@ import React from 'react' import { useDrag, useDrop } from 'react-dnd' -import { Select, DatePicker, Input, Popover, Form } from 'antd' +import { Select, DatePicker, Input, Popover, Form, Switch, Checkbox } from 'antd' import { CopyOutlined, EditOutlined, CloseOutlined } from '@ant-design/icons' import moment from 'moment' @@ -109,6 +109,10 @@ formItem = (<DateGroup card={card} />) } else if (card.type === 'checkcard') { formItem = <CheckCard config={card} /> + } else if (card.type === 'switch') { + formItem = (<Switch checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''} style={{marginTop: '8px'}} checked={card.initval === card.openVal}/>) + } else if (card.type === 'check') { + formItem = <Checkbox style={{lineHeight: '36px'}} checked={card.initval === card.openVal}>{card.checkTip || ''}</Checkbox> } return ( diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 8167d07..a5a42e4 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -97,7 +97,6 @@ { value: 'print', text: '鏍囩鎵撳嵃' }, { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, - { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] @@ -150,7 +149,6 @@ opentypes = opentypes.filter(item => item.value !== 'tab') funTypes = [ { value: 'print', text: '鏍囩鎵撳嵃' }, - { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, ] pageTemps = [ { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, @@ -165,6 +163,19 @@ pageTemps.unshift({ value: 'billprintTemp', text: '鍗曟嵁鎵撳嵃妯℃澘' }) } } + + if (card.funcType === 'changeuser') { // 鍘熺被鍨嬫敮鎸� + funTypes.unshift({ value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }) + } + + if (config.subtype === 'editable') { // 缂栬緫琛ㄧ殑娣诲姞銆佸垹闄� + funTypes.push( + { value: 'addline', text: '澧炲姞琛岋紙缂栬緫琛級' }, + { value: 'delline', text: '鍒犻櫎琛岋紙缂栬緫琛級' } + ) + } else if (card.funcType === 'addline' || card.funcType === 'delline') { + card.funcType = '' + } if (type === 'chart' && appType !== 'mob') { opentypes = opentypes.filter(item => item.value === 'excelIn' || item.value === 'excelOut') @@ -176,7 +187,10 @@ let refresh = [] if (viewType === 'popview') { // 寮圭獥鏍囩 - opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') + opentypes = opentypes.filter(item => item.value !== 'popview') + + funTypes = funTypes.filter(item => item.value !== 'print') + refresh.push({ value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩 text: '鍏抽棴寮圭獥' @@ -1213,10 +1227,13 @@ { value: 'print', text: '鏍囩鎵撳嵃' }, { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, - { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] + + if (card.funcType === 'changeuser') { // 鍘熺被鍨嬫敮鎸� + funTypes.unshift({ value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }) + } let menulist = sessionStorage.getItem('fstMenuList') if (menulist) { @@ -1231,7 +1248,10 @@ let refresh = [] if (viewType === 'popview') { // 寮圭獥鏍囩 - opentypes = opentypes.filter(item => item.value !== 'popview' && item.value !== 'funcbutton') + opentypes = opentypes.filter(item => item.value !== 'popview') + + funTypes = funTypes.filter(item => item.value !== 'print') + refresh.push({ value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩 text: '鍏抽棴寮圭獥' diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 93e5bd9..89e63fa 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -60,7 +60,7 @@ } componentDidMount () { - MKEmitter.addListener('revert', this.revert) + MKEmitter.addListener('revertBtn', this.revertBtn) MKEmitter.addListener('addButton', this.addButton) MKEmitter.addListener('submitModal', this.handleSave) } @@ -76,12 +76,12 @@ this.setState = () => { return } - MKEmitter.removeListener('revert', this.revert) + MKEmitter.removeListener('revertBtn', this.revertBtn) MKEmitter.removeListener('addButton', this.addButton) MKEmitter.removeListener('submitModal', this.handleSave) } - revert = (id) => { + revertBtn = (id) => { if (id && id !== this.props.config.uuid) return this.setState({ @@ -609,6 +609,24 @@ return item.uuid !== id }) }) + } else if (config.type === 'card' && config.subcards) { + config.subcards.forEach(scard => { + scard.elements = scard.elements.filter(item => { + if (item.uuid === id) { + btn = item + _col = scard + } + return item.uuid !== id + }) + scard.backElements = scard.backElements.filter(item => { + if (item.uuid === id) { + btn = item + _col = scard + } + return item.uuid !== id + }) + return scard + }) } if (!btn) return diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index 2b6bbe1..7c6754f 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx @@ -1,6 +1,6 @@ import React from 'react' import { useDrag, useDrop } from 'react-dnd' -import { Select, DatePicker, Input, Popover, Form } from 'antd' +import { Select, DatePicker, Input, Popover, Form, Switch, Checkbox } from 'antd' import { EditOutlined, CopyOutlined, CloseOutlined } from '@ant-design/icons' import moment from 'moment' @@ -107,6 +107,10 @@ /> } else if (card.type === 'group') { formItem = <DateGroup card={card} /> + } else if (card.type === 'switch') { + formItem = (<Switch checkedChildren={card.openText || ''} unCheckedChildren={card.closeText || ''} style={{marginTop: '8px'}} checked={card.initval === card.openVal}/>) + } else if (card.type === 'check') { + formItem = <Checkbox style={{lineHeight: '36px'}} checked={card.initval === card.openVal}>{card.checkTip || ''}</Checkbox> } let labelwidth = card.labelwidth || 33.3 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 87fc195..1311e6e 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -96,8 +96,12 @@ this.props.form.setFieldsValue({IsSort: 'false'}) } else if (value === 'text' || value === 'number') { this.props.form.setFieldsValue({perspective: ''}) - } else if (value === 'action' || value === 'colspan') { + } else if (value === 'colspan') { this.props.form.setFieldsValue({Align: 'center'}) + } else if (value === 'action') { + this.props.form.setFieldsValue({Align: 'center', label: '鎿嶄綔'}) + } else if (value === 'index') { + this.props.form.setFieldsValue({label: '搴忓彿'}) } }) } else if (key === 'field') { diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index 27b02ee..a95701f 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -354,7 +354,7 @@ config.action = config.action.filter(item => item.uuid !== btn.uuid) setTimeout(() => { - MKEmitter.emit('revert', config.uuid) + MKEmitter.emit('revertBtn', config.uuid) }, 200) } diff --git a/src/menu/components/table/base-table/columns/index.scss b/src/menu/components/table/base-table/columns/index.scss index 2970611..2c350a3 100644 --- a/src/menu/components/table/base-table/columns/index.scss +++ b/src/menu/components/table/base-table/columns/index.scss @@ -102,8 +102,11 @@ .ant-table-small > .ant-table-content .ant-table-thead > tr > th { background-color: #fafafa!important; } + .ant-table-small.ant-table-bordered { + border-right: 1px solid #e8e8e8; + } - table, tr, th, td { + table, tr, th, td, .ant-table-small { border-color: var(--mk-table-border-color)!important; } table tr { diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx index 70765a7..30ad6c2 100644 --- a/src/menu/components/table/base-table/index.jsx +++ b/src/menu/components/table/base-table/index.jsx @@ -142,7 +142,9 @@ item.cols = item.cols.filter(a => !a.origin) delete item.isNew - this.setState({card: item}, () => { MKEmitter.emit('revert') }) + this.setState({card: null}, () => { + this.setState({card: item}) + }) } } @@ -346,6 +348,8 @@ const { card } = this.state let options = ['action', 'search', 'form', 'cols'] + if (!card) return null + return ( <div className="menu-base-table-edit-box" style={card.style} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ diff --git a/src/menu/components/table/base-table/options.jsx b/src/menu/components/table/base-table/options.jsx index b8ae7e5..3db5e1e 100644 --- a/src/menu/components/table/base-table/options.jsx +++ b/src/menu/components/table/base-table/options.jsx @@ -153,7 +153,7 @@ field: 'height', label: '琛ㄦ牸楂樺害', initval: wrap.height || '', - tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆�', + tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆傛敞锛氬皬浜庣瓑浜�100鏃朵负楂樺害鐨勭櫨鍒嗘瘮銆�', min: 10, max: 3000, precision: 0, @@ -171,6 +171,16 @@ }, { type: 'select', + field: 'tipField', + label: '淇℃伅鎻愮ず', + initval: wrap.tipField || '', + tooltip: '榧犳爣鎮诞浜庤涓婃柟鏃剁殑鎻愮ず淇℃伅銆�', + required: false, + allowClear: true, + options: columns + }, + { + type: 'select', field: 'controlField', label: '绂佺敤瀛楁', initval: wrap.controlField || '', 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 b0d7621..7b052f5 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -163,21 +163,21 @@ text: '鍙冲榻�' }] }, - { - type: 'radio', - key: 'sum', - label: '鏄剧ず鍚堣', - initVal: card.sum || '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: 'radio', key: 'editable', @@ -519,6 +519,21 @@ options: fields }, { + type: 'radio', + key: 'noValue', + label: '绌哄��', + initVal: card.noValue || 'show', + tooltip: '褰撳�间负0鏃舵槸鍚︽樉绀�', + required: false, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hide', + text: '闅愯棌' + }] + }, + { type: 'multiselect', key: 'blacklist', label: '榛戝悕鍗�', 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 ed167a3..6e92415 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-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, Modal, notification } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { getColumnForm } from './formconfig' @@ -14,12 +14,12 @@ 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'], + number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist', 'noValue'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'], custom: ['label', 'type', 'Align', 'Width', 'blacklist'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], action: ['label', 'type', 'Align', 'Width'], - formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], + formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist', 'noValue'], index: ['label', 'type', 'Align', 'Width'] } @@ -107,6 +107,11 @@ formlist: formlist.map(item => { item.hidden = !_options.includes(item.key) + if (item.key === 'formula') { + item.fields = this.props.fields.map(col => col.field) + item.fields = item.fields.join(', ') + } + return item }) }) @@ -141,10 +146,14 @@ return item }) }, () => { - if (value === 'action' || value === 'colspan') { + if (value === 'colspan') { this.props.form.setFieldsValue({Align: 'center'}) } else if (value === 'formula' && _field) { this.props.form.setFieldsValue({formula: '@' + _field + '@'}) + } else if (value === 'action') { + this.props.form.setFieldsValue({Align: 'center', label: '鎿嶄綔'}) + } else if (value === 'index') { + this.props.form.setFieldsValue({label: '搴忓彿'}) } }) } else if (key === 'field') { @@ -321,6 +330,28 @@ { required: item.required, message: '璇疯緭鍏�' + item.label + '!' } ] + if (item.key === 'formula') { + fields.push( + <Col span={span} key={index}> + <Form.Item className={className} extra={extra} label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: initVal, + rules: rules + })(<TextArea rows={item.rows || 2}/>)} + </Form.Item> + <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click"> + <span className="formula-icon">瀛楁闆�</span> + </Popover> + </Col> + ) + return + } + content = <TextArea rows={item.rows || 2}/> } else if (item.type === 'codemirror') { rules = [ 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 2ddf595..4b369ac 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.scss +++ b/src/menu/components/table/edit-table/columns/editColumn/index.scss @@ -17,6 +17,14 @@ height: 150px; } } + .formula-icon { + position: absolute; + bottom: 5px; + right: 15px; + cursor: pointer; + font-size: 12px; + color: #1890ff; + } .ant-form-extra { padding-top: 0px; min-height: 0px; @@ -35,3 +43,13 @@ float: none; } } +.formula-fields { + z-index: 1200!important; + + .ant-popover-inner-content { + div { + max-width: 750px; + word-break: break-all; + } + } +} \ No newline at end of file diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index eb85458..abd291a 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -339,7 +339,7 @@ config.action = config.action.filter(item => item.uuid !== btn.uuid) setTimeout(() => { - MKEmitter.emit('revert', config.uuid) + MKEmitter.emit('revertBtn', config.uuid) }, 200) } @@ -538,7 +538,6 @@ } else { cell.type = 'number' cell.format = 'none' - cell.sum = 'false' cell.decimal = item.decimal || 0 cell.Width = 80 } diff --git a/src/menu/components/table/edit-table/columns/index.scss b/src/menu/components/table/edit-table/columns/index.scss index b5001b6..dcf4a5b 100644 --- a/src/menu/components/table/edit-table/columns/index.scss +++ b/src/menu/components/table/edit-table/columns/index.scss @@ -15,11 +15,14 @@ max-width: 60px; } .submit-btn { - min-height: 24px; + min-height: 28px; + min-width: 65px; height: auto; margin-right: 10px; + margin-bottom: 10px!important; background-color: #1890ff; border-width: 0; + top: -2px; } .ant-table-thead > tr > th .ant-table-header-column .ant-table-column-sorters > .ant-table-column-title { position: unset; @@ -131,8 +134,11 @@ .ant-table-small > .ant-table-content .ant-table-thead > tr > th { background-color: #fafafa!important; } + .ant-table-small.ant-table-bordered { + border-right: 1px solid #e8e8e8; + } - table, tr, th, td { + table, tr, th, td, .ant-table-small { border-color: var(--mk-table-border-color)!important; } table tr { diff --git a/src/menu/components/table/edit-table/columns/tableIn/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/index.jsx index 144df97..e5b5702 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/index.jsx @@ -47,7 +47,7 @@ { title: '鎶ラ敊缂栫爜', dataIndex: 'errorCode', - width: '12%', + width: '10%', editable: true, inputType: 'select', options: [ @@ -60,13 +60,24 @@ { title: '楠岃瘉绫诲瀷', dataIndex: 'verifyType', - width: '12%', - render: (text, record) => record.verifyType === 'logic' ? '閫昏緫楠岃瘉' : '鐗╃悊楠岃瘉', + width: '14%', + render: (text, record) => { + let names = { + physical: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級', + logic: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級', + physical_temp: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級', + logic_temp: '閫昏緫楠岃瘉锛堜粎涓存椂琛級', + } + + return names[text] || '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' + }, inputType: 'select', editable: true, options: [ - { value: 'physical', text: '鐗╃悊楠岃瘉' }, - { value: 'logic', text: '閫昏緫楠岃瘉' } + { value: 'physical', text: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' }, + { value: 'logic', text: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級' }, + { value: 'physical_temp', text: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級' }, + { value: 'logic_temp', text: '閫昏緫楠岃瘉锛堜粎涓存椂琛級' } ] }, { diff --git a/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx index a83668d..fc5ff7d 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/uniqueform/index.jsx @@ -108,8 +108,10 @@ ] })( <Select> - <Select.Option value="physical"> 鐗╃悊楠岃瘉 </Select.Option> - <Select.Option value="logic"> 閫昏緫楠岃瘉 </Select.Option> + <Select.Option value="physical"> 鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級 </Select.Option> + <Select.Option value="logic"> 閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級 </Select.Option> + <Select.Option value="physical_temp"> 鐗╃悊楠岃瘉锛堜粎涓存椂琛級 </Select.Option> + <Select.Option value="logic_temp"> 閫昏緫楠岃瘉锛堜粎涓存椂琛級 </Select.Option> </Select> )} </Form.Item> diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index fd53e91..3cae9f5 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -141,7 +141,9 @@ delete item.isNew - this.setState({card: item}) + this.setState({card: null}, () => { + this.setState({card: item}) + }) } } @@ -158,6 +160,10 @@ card.$c_cl = true card.errors = checkComponent(card) + + if (!card.submit.sheet) { + card.errors.push({ level: 0, detail: '鎻愪氦鎸夐挳鏈缃紒'}) + } if (card.errors.length === 0) { card.$tables = getTables(card) @@ -273,9 +279,9 @@ } getWrapForms = () => { - const { wrap, action } = this.state.card + const { wrap, columns } = this.state.card - return getWrapForm(wrap, action) + return getWrapForm(wrap, columns) } updateWrap = (res) => { @@ -343,8 +349,11 @@ render() { const { card, appType } = this.state + + if (!card) return null + let _style = resetStyle(card.style) - + return ( <div className="menu-editable-table-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/> diff --git a/src/menu/components/table/edit-table/options.jsx b/src/menu/components/table/edit-table/options.jsx index e3c2fb5..c1dc662 100644 --- a/src/menu/components/table/edit-table/options.jsx +++ b/src/menu/components/table/edit-table/options.jsx @@ -1,7 +1,7 @@ /** * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 */ -export default function (wrap, action = []) { +export default function (wrap, columns = []) { let roleList = sessionStorage.getItem('sysRoles') let appType = sessionStorage.getItem('appType') @@ -47,59 +47,59 @@ field: 'height', label: '楂樺害', initval: wrap.height || '', - tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆�', + tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆傛敞锛氬皬浜庣瓑浜�100鏃朵负楂樺害鐨勭櫨鍒嗘瘮銆�', min: 10, max: 3000, 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 || 'true', - required: false, - options: [ - {value: 'true', label: '鏄�'}, - {value: 'false', label: '鍚�'}, - ] - }, + // { + // 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', @@ -113,18 +113,18 @@ {value: 'simple', label: '鍗曢」'}, ] }, - { - type: 'radio', - field: 'operType', - label: '缂栬緫鎸夐挳', - initval: wrap.operType || 'btnMode', - tooltip: '缂栬緫鏃剁殑娣诲姞銆佸垹闄ゆ寜閽樉绀轰綅缃紝娉細浣跨敤娴爣鏃惰〃鏍兼í鍚戞粴鍔ㄥけ鏁堬紝琛ㄦ牸璁剧疆楂樺害鏃舵诞鏍囨棤鏁堛��', - required: false, - options: [ - {value: 'btnMode', label: '鎸夐挳寮�'}, - {value: 'buoyMode', label: '娴爣寮�'}, - ] - }, + // { + // type: 'radio', + // field: 'operType', + // label: '缂栬緫鎸夐挳', + // initval: wrap.operType || 'btnMode', + // tooltip: '缂栬緫鏃剁殑娣诲姞銆佸垹闄ゆ寜閽樉绀轰綅缃紝娉細浣跨敤娴爣鏃惰〃鏍兼í鍚戞粴鍔ㄥけ鏁堬紝琛ㄦ牸璁剧疆楂樺害鏃舵诞鏍囨棤鏁堛��', + // required: false, + // options: [ + // {value: 'btnMode', label: '鎸夐挳寮�'}, + // {value: 'buoyMode', label: '娴爣寮�'}, + // ] + // }, { type: 'radio', field: 'editType', @@ -282,18 +282,18 @@ ], forbid: !appType || 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: 'switchable', + // label: '鐘舵�佸垏鎹�', + // initval: wrap.switchable || 'true', + // tooltip: '鏄惁鍙互鍦ㄧ紪杈戝拰榛樿table鐘舵�侀棿鍒囨崲銆�', + // required: false, + // options: [ + // {value: 'true', label: '鍚敤'}, + // {value: 'false', label: '绂佺敤'}, + // ] + // }, { type: 'radio', field: 'empty', @@ -307,6 +307,16 @@ ], }, { + type: 'select', + field: 'tipField', + label: '淇℃伅鎻愮ず', + initval: wrap.tipField || '', + tooltip: '榧犳爣鎮诞浜庤涓婃柟鏃剁殑鎻愮ず淇℃伅銆�', + required: false, + allowClear: true, + options: columns + }, + { type: 'multiselect', field: 'blacklist', label: '榛戝悕鍗�', 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 f855127..d971c8e 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, Checkbox } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal, Checkbox, Popover } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { getColumnForm } from './formconfig' @@ -65,6 +65,11 @@ formlist: formlist.map(item => { item.hidden = !_options.includes(item.key) + if (item.key === 'formula') { + item.fields = this.props.fields.map(col => col.field) + item.fields = item.fields.join(', ') + } + return item }) }) @@ -101,10 +106,14 @@ this.props.form.setFieldsValue({IsSort: 'false'}) } else if (value === 'text' || value === 'number') { this.props.form.setFieldsValue({perspective: ''}) - } else if (value === 'action' || value === 'colspan') { + } else if (value === 'colspan') { this.props.form.setFieldsValue({Align: 'center'}) } else if (value === 'formula' && _field) { this.props.form.setFieldsValue({formula: '@' + _field + '@'}) + } else if (value === 'action') { + this.props.form.setFieldsValue({Align: 'center', label: '鎿嶄綔'}) + } else if (value === 'index') { + this.props.form.setFieldsValue({label: '搴忓彿'}) } }) } else if (key === 'field') { @@ -345,26 +354,52 @@ </Col> ) } else if (item.type === 'textarea') { - fields.push( - <Col span={24} key={index} className="textarea"> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)} - </Form.Item> - </Col> - ) + if (item.key === 'formula') { + fields.push( + <Col span={24} className="textarea" key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: '璇疯緭鍏�' + item.label + '!' + } + ] + })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} + </Form.Item> + <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click"> + <span className="formula-icon">瀛楁闆�</span> + </Popover> + </Col> + ) + } else { + fields.push( + <Col span={24} key={index} className="textarea"> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: '璇疯緭鍏�' + item.label + '!' + } + ] + })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)} + </Form.Item> + </Col> + ) + } } }) return fields diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.scss b/src/menu/components/table/normal-table/columns/editColumn/index.scss index 6d72890..e653f84 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.scss +++ b/src/menu/components/table/normal-table/columns/editColumn/index.scss @@ -14,9 +14,27 @@ width: 88%; } } + .formula-icon { + position: absolute; + bottom: 5px; + right: 15px; + cursor: pointer; + font-size: 12px; + color: #1890ff; + } >.ant-row >.ant-col { display: inline-block; vertical-align: top; float: none; } } +.formula-fields { + z-index: 1200!important; + + .ant-popover-inner-content { + div { + max-width: 750px; + word-break: break-all; + } + } +} diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 755b5c9..f8ae9cd 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -330,7 +330,7 @@ config.action = config.action.filter(item => item.uuid !== btn.uuid) setTimeout(() => { - MKEmitter.emit('revert', config.uuid) + MKEmitter.emit('revertBtn', config.uuid) }, 200) } diff --git a/src/menu/components/table/normal-table/columns/index.scss b/src/menu/components/table/normal-table/columns/index.scss index ccb549b..b420128 100644 --- a/src/menu/components/table/normal-table/columns/index.scss +++ b/src/menu/components/table/normal-table/columns/index.scss @@ -119,8 +119,11 @@ .ant-table-small > .ant-table-content > .ant-table-body { margin: 0; } + .ant-table-small.ant-table-bordered { + border-right: 1px solid #e8e8e8; + } - table, tr, th, td { + table, tr, th, td, .ant-table-small { border-color: var(--mk-table-border-color)!important; } table tr { diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index e1e95f3..f4d4917 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -166,7 +166,9 @@ delete item.isNew - this.setState({card: item}, () => { MKEmitter.emit('revert') }) + this.setState({card: null}, () => { + this.setState({card: item}) + }) } } @@ -388,6 +390,9 @@ render() { const { card, appType } = this.state + + if (!card) return null + let options = ['action', 'search', 'form', 'cols'] let _style = resetStyle(card.style) diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx index 8cf29d7..8265890 100644 --- a/src/menu/components/table/normal-table/options.jsx +++ b/src/menu/components/table/normal-table/options.jsx @@ -47,7 +47,7 @@ field: 'height', label: '楂樺害', initval: wrap.height || '', - tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆�', + tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆傛敞锛氬皬浜庣瓑浜�100鏃朵负楂樺害鐨勭櫨鍒嗘瘮銆�', min: 10, max: 3000, precision: 0, @@ -212,6 +212,16 @@ }, { type: 'select', + field: 'tipField', + label: '淇℃伅鎻愮ず', + initval: wrap.tipField || '', + tooltip: '榧犳爣鎮诞浜庤涓婃柟鏃剁殑鎻愮ず淇℃伅銆�', + required: false, + allowClear: true, + options: columns + }, + { + type: 'select', field: 'controlField', label: '绂佺敤瀛楁', initval: wrap.controlField || '', diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 0a90bda..a0409b1 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -137,7 +137,7 @@ }) } - if (item.type === 'switch') { + if (item.type === 'switch' || item.type === 'check') { _linksupFields.push({ field: item.field, label: item.label diff --git a/src/menu/modalconfig/index.scss b/src/menu/modalconfig/index.scss index 4e0d628..723def0 100644 --- a/src/menu/modalconfig/index.scss +++ b/src/menu/modalconfig/index.scss @@ -93,20 +93,20 @@ position: relative; padding: 0; - .modal-fields-row.up_down { - .ant-form-item { - display: block!important; - .ant-form-item-label { - width: 100%!important; - text-align: left; - height: 24px; - line-height: 28px; - } - .ant-form-item-control-wrapper { - width: 100%!important; - } - } - } + // .modal-fields-row.up_down { + // .ant-form-item { + // display: block!important; + // .ant-form-item-label { + // width: 100%!important; + // text-align: left; + // height: 24px; + // line-height: 28px; + // } + // .ant-form-item-control-wrapper { + // width: 100%!important; + // } + // } + // } .ant-modal-content { max-width: 95%; diff --git a/src/menu/replaceField/index.jsx b/src/menu/replaceField/index.jsx index 64353b0..93a303e 100644 --- a/src/menu/replaceField/index.jsx +++ b/src/menu/replaceField/index.jsx @@ -9,7 +9,6 @@ import Utils from '@/utils/utils.js' import SettingForm from './settingform' import { queryTableSql } from '@/utils/option.js' -import MKEmitter from '@/utils/events.js' import './index.scss' class ReplaceField extends Component { @@ -420,35 +419,35 @@ } config.components = _replace(config.components) - } else if (type === 'table') { - config.columns = config.columns.map(col => { - if (col.field && map[col.field.toLowerCase()]) { - col.field = map[col.field.toLowerCase()].FieldName - } - return col - }) + // } else if (type === 'table') { + // config.columns = config.columns.map(col => { + // if (col.field && map[col.field.toLowerCase()]) { + // col.field = map[col.field.toLowerCase()].FieldName + // } + // return col + // }) - config.search = config.search.map(col => { - if (col.field && map[col.field.toLowerCase()]) { - col.field = map[col.field.toLowerCase()].FieldName - } - if (col.datefield && map[col.datefield.toLowerCase()]) { - col.datefield = map[col.datefield.toLowerCase()].FieldName - } - return col - }) + // config.search = config.search.map(col => { + // if (col.field && map[col.field.toLowerCase()]) { + // col.field = map[col.field.toLowerCase()].FieldName + // } + // if (col.datefield && map[col.datefield.toLowerCase()]) { + // col.datefield = map[col.datefield.toLowerCase()].FieldName + // } + // return col + // }) - config.action = config.action.map(m => { - if (m.verify && m.verify.columns) { - m.verify.columns = m.verify.columns.map(col => { - if (col.Column && map[col.Column.toLowerCase()]) { - col.Column = map[col.Column.toLowerCase()].FieldName - } - return col - }) - } - return m - }) + // config.action = config.action.map(m => { + // if (m.verify && m.verify.columns) { + // m.verify.columns = m.verify.columns.map(col => { + // if (col.Column && map[col.Column.toLowerCase()]) { + // col.Column = map[col.Column.toLowerCase()].FieldName + // } + // return col + // }) + // } + // return m + // }) } else if (type === 'form') { config.fields = config.fields.map(col => { if (col.field && map[col.field.toLowerCase()]) { @@ -469,10 +468,6 @@ duration: 3 }) this.props.updateConfig(config) - - setTimeout(() => { - MKEmitter.emit('revert') - }, 300) } // 渚濇嵁瀛楁鏇挎崲鍚嶇О @@ -590,32 +585,32 @@ } config.components = _replace(config.components) - } else if (type === 'table') { - config.columns = config.columns.map(col => { - if (col.field && map[col.field.toLowerCase()]) { - col.label = map[col.field.toLowerCase()].FieldDec - } - return col - }) + // } else if (type === 'table') { + // config.columns = config.columns.map(col => { + // if (col.field && map[col.field.toLowerCase()]) { + // col.label = map[col.field.toLowerCase()].FieldDec + // } + // return col + // }) - config.search = config.search.map(col => { - if (col.field && map[col.field.toLowerCase()]) { - col.label = map[col.field.toLowerCase()].FieldDec - } - return col - }) + // config.search = config.search.map(col => { + // if (col.field && map[col.field.toLowerCase()]) { + // col.label = map[col.field.toLowerCase()].FieldDec + // } + // return col + // }) - config.action = config.action.map(m => { - if (m.verify && m.verify.columns) { - m.verify.columns = m.verify.columns.map(col => { - if (col.Column && map[col.Column.toLowerCase()]) { - col.Text = map[col.Column.toLowerCase()].FieldDec - } - return col - }) - } - return m - }) + // config.action = config.action.map(m => { + // if (m.verify && m.verify.columns) { + // m.verify.columns = m.verify.columns.map(col => { + // if (col.Column && map[col.Column.toLowerCase()]) { + // col.Text = map[col.Column.toLowerCase()].FieldDec + // } + // return col + // }) + // } + // return m + // }) } else if (type === 'form') { config.fields = config.fields.map(col => { if (col.field && map[col.field.toLowerCase()]) { @@ -636,9 +631,6 @@ duration: 3 }) this.props.updateConfig(config) - setTimeout(() => { - MKEmitter.emit('revert') - }, 500) } render() { diff --git a/src/mob/components/formdragelement/card.jsx b/src/mob/components/formdragelement/card.jsx index 3fc1d10..0da78cd 100644 --- a/src/mob/components/formdragelement/card.jsx +++ b/src/mob/components/formdragelement/card.jsx @@ -127,6 +127,8 @@ formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-input-control">{card.linkfield}</div></div></div>) } else if (card.type === 'switch') { formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-list-switch"><Switch checked={card.initval}/></div></div></div>) + } else if (card.type === 'check') { + formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-list-switch"><Checkbox checked={card.initval}>{card.checkTip}</Checkbox></div></div></div>) } else if (card.type === 'radio') { let options = null if (card.options && card.options.length > 0) { diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx index 97841a6..baa3cb9 100644 --- a/src/mob/modalconfig/index.jsx +++ b/src/mob/modalconfig/index.jsx @@ -159,7 +159,7 @@ }) } - if (item.type === 'switch') { + if (item.type === 'switch' || item.type === 'check') { _linksupFields.push({ field: item.field, label: item.label diff --git a/src/tabviews/calendar/index.scss b/src/tabviews/calendar/index.scss index 74f1a08..23d25cf 100644 --- a/src/tabviews/calendar/index.scss +++ b/src/tabviews/calendar/index.scss @@ -6,7 +6,7 @@ .box404 { padding-top: 30px; } - >.top-search { + >.mk-search-wrap { padding: 0px 24px 5px; border-bottom: 1px solid #efefef; } diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 242cdf2..12b410e 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -6,7 +6,7 @@ .box404 { padding-top: 30px; } - >.top-search { + >.mk-search-wrap { padding: 0px 24px 5px; border-bottom: 1px solid #efefef; } diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index fe7a373..00fb6a8 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -24,6 +24,7 @@ const PrintButton = asyncComponent(() => import('@/tabviews/zshare/actionList/printbutton')) const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) +const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) const BarCode = asyncElementComponent(() => import('@/components/barcode')) const QrCode = asyncElementComponent(() => import('@/components/qrcode')) const MkProgress = asyncElementComponent(() => import('@/components/mkProgress')) @@ -316,7 +317,7 @@ val = data[card.field] } - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } @@ -646,7 +647,7 @@ val = data[card.field] || '' } - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } @@ -668,7 +669,7 @@ url = data[card.field] || '' } - if (url === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + if (!url && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } @@ -700,7 +701,7 @@ val = data[card.field] || '' } - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } @@ -757,6 +758,8 @@ val += _val }) + } else if (data && data.$$empty) { + val = '' } else if (data) { let _val = card.formula Object.keys(data).forEach(key => { @@ -776,7 +779,7 @@ val = _val === undefined ? '' : _val } - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } @@ -834,7 +837,7 @@ color = data[card.field] || '' } - if (color === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + if (!color && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } @@ -1015,6 +1018,16 @@ /> </div> ) + } else if (card.funcType === 'addline' || card.funcType === 'delline') { + contents.push( + <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> + <EditLine + btn={card} + disabled={_disabled} + selectedData={_data} + /> + </div> + ) } } } diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index 93dcf57..34a81cf 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -6,15 +6,6 @@ min-height: 20px; overflow-y: auto; - .button-list.toolbar-button { - padding: 0; - line-height: 45px; - button { - margin-right: 0px; - margin-bottom: 0px; - } - } - .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 e010304..3d10bf5 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -156,6 +156,19 @@ } } + if (_config.wrap.zHeight) { + _config.wrap.zHeight = _config.wrap.zHeight <= 100 ? _config.wrap.zHeight + 'vh' : _config.wrap.zHeight + } + + if (_config.wrap.zHeight || _config.wrap.minWidth) { + _config.wrap.zoomStyle = { + border: `1px solid ${_config.wrap.zBColor || 'transparent'}`, + height: _config.wrap.zHeight || 'auto' + } + } else { + _config.wrap.zoomStyle = null + } + this.setState({ pageSize: _config.setting.pageSize || 10, pageOptions, @@ -562,9 +575,8 @@ if (type === 'plus') { let _data = (this.state.data || []).concat(result.data || []) data = _data.map((item, index) => { - let children = [] - if (item[config.setting.subdata]) { + let children = [] let _children = item[config.setting.subdata] delete item[config.setting.subdata] @@ -581,9 +593,10 @@ children.push(cell) } }) + item.children = children + } else if (!item.children) { + item.children = [] } - - item.children = children item.key = index item.$$uuid = item[config.setting.primaryKey] || '' @@ -944,7 +957,7 @@ selectedData={selectedData} /> : null } - <div className={config.wrap.minWidth ? 'data-zoom-box' : ''}> + <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 '}> {precards.map((item, index) => ( 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 af72222..b3a5b8a 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.scss +++ b/src/tabviews/custom/components/card/double-data-card/index.scss @@ -6,15 +6,6 @@ min-height: 20px; overflow-y: auto; - .button-list.toolbar-button { - padding: 0; - line-height: 45px; - button { - margin-right: 0px; - margin-bottom: 0px; - } - } - .data-zoom { display: flex; position: relative; @@ -298,10 +289,20 @@ .data-zoom-box { width: 100%; overflow-x: auto; + overflow-y: auto; padding-bottom: 10px; + border: 1px solid #e8e8e8; + border-radius: 4px; + + .extend-card:first-child { + position: sticky; + top: 0px; + z-index: 2; + } } .data-zoom-box::-webkit-scrollbar { - height: 7px; + height: 9px; + width: 9px; } .data-zoom-box::-webkit-scrollbar-thumb { border-radius: 5px; diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index ff504f4..6cbc3cb 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -296,101 +296,8 @@ }) } - // canvasToImage(canvas) { - // let image = new Image() - // image.src = canvas.toDataURL('image/jpg') - // image.style = 'width:100%;height:100%;position:absolute;z-index:1;left:0px;top:0px;' - // return image - // } - - // print = () => { - // const { config } = this.props - // const { printing } = this.state - - // if (printing) return - // this.setState({printing: true}) - - // let qrcodes = document.getElementsByClassName('qrcode-box') - - // for (let i = 0; i < qrcodes.length; i++) { - // let canvas = qrcodes[i].getElementsByTagName('canvas')[0] - - // if (canvas) { - // let img = this.canvasToImage(canvas) - - // canvas.remove() - // qrcodes[i].append(img) - // } - // } - - // let pageSize = ['A4', 'A3', 'A5'].includes(config.setting.pageSize) ? config.setting.pageSize : 'A4' - // let pageLayout = config.setting.pageLayout !== 'horizontal' ? 'vertical' : 'horizontal' - // let hides = config.setting.hide || [] - - // let pageParam = { - // A4: { - // vertical: 980, - // horizontal: 1200, - // }, - // A3: { - // vertical: 1200, - // horizontal: 1600, - // }, - // A5: { - // vertical: 700, - // horizontal: 1000, - // } - // } - - // let width = pageParam[pageSize][pageLayout] - - // try { - // let jubuData = document.getElementById(config.uuid).innerHTML - - // let iframe = document.createElement('IFRAME') - // let linkList = document.getElementsByTagName('link') // 鑾峰彇鐖剁獥鍙ink鏍囩瀵硅薄鍒楄〃 - // let styleList = document.getElementsByTagName('style') // 鑾峰彇鐖剁獥鍙tyle鏍囩瀵硅薄鍒楄〃 - - // document.body.appendChild(iframe) - // let doc = iframe.contentWindow.document - - // doc.open() - // doc.write(`<!DOCTYPE html><html lang="en"><head>`) - // for (let i = 0;i < linkList.length;i++) { - // if (linkList[i].type === 'text/css') { - // doc.write(`<LINK rel="stylesheet" type="text/css" href="${linkList[i].href}">`) - // } - // } - // doc.write(`<style>body{width: ${width}px!important;} *{border-style: solid;border-width: 0;} .print-button{display: none!important;} ${hides.includes('search') ? '.top-search{display: none!important;}' : ''} ${hides.includes('button') ? '.ant-btn{opacity: 0!important;}' : ''}</style>`) - // for (let i = 0;i < styleList.length;i++) { - // doc.write('<style>' + styleList[i].innerHTML + '</style>') - // } - // doc.write(`</head><body>`) - // doc.write(jubuData) - // doc.write(`</body></html>`) - // doc.close() - - // setTimeout(() => { - // iframe.contentWindow.focus() - // iframe.contentWindow.print() - - // document.body.removeChild(iframe) - - // this.setState({printing: false}) - // }, 500) - // } catch (e) { - // this.setState({printing: false}) - // notification.warning({ - // top: 92, - // message: '鎵撳嵃寮傚父锛�', - // duration: 5 - // }) - // } - // } - render() { const { config } = this.props - // const { printing } = this.state if (!config.components || config.components.length === 0) return (<div style={config.style}></div>) @@ -399,7 +306,6 @@ {config.setting && config.setting.title ? <div className="group-header" style={config.headerStyle}> <span className="title">{config.setting.title}</span> </div> : null} - {/* {config.setting && config.setting.print === 'true' ? <Button className="print-button" icon="printer" loading={printing} onClick={this.print}></Button> : null} */} <Row className="component-wrap">{this.getComponents()}</Row> </div> ) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 38d3d69..33d8d9b 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -987,6 +987,9 @@ } let height = setting.height || false + if (height && height <= 100) { + height = height + 'vh' + } let loading = this.props.loading if (setting.mask === 'hidden') { loading = false @@ -1020,6 +1023,7 @@ return { lineMarks: setting.tableMode !== 'fast' ? lineMarks : null, data: record, + title: setting.tipField ? record[setting.tipField] : '', className: index === activeIndex ? ' mk-row-active ' : '', onClick: () => {this.changeRow(record, index)}, onDoubleClick: () => {this.doubleClickLine(record)} diff --git a/src/tabviews/custom/components/share/normalTable/index.scss b/src/tabviews/custom/components/share/normalTable/index.scss index 59eddc5..12ad8fd 100644 --- a/src/tabviews/custom/components/share/normalTable/index.scss +++ b/src/tabviews/custom/components/share/normalTable/index.scss @@ -198,8 +198,11 @@ display: block; } } + .ant-table-small.ant-table-bordered { + border-right: 1px solid #e8e8e8; + } - table, tr, th, td { + table, tr, th, td, .ant-table-small { border-color: var(--mk-table-border-color)!important; } table tr { @@ -219,11 +222,6 @@ table tbody tr { color: var(--mk-table-color); } - // table tbody { - // tr:nth-child(even) { - // background: #f5f5f5; - // } - // } } .normal-custom-table:not(.ghost) { .ant-table-small > .ant-table-content .ant-table-thead > tr > th { diff --git a/src/tabviews/custom/components/share/normalheader/index.scss b/src/tabviews/custom/components/share/normalheader/index.scss index 8816fb1..8de5a23 100644 --- a/src/tabviews/custom/components/share/normalheader/index.scss +++ b/src/tabviews/custom/components/share/normalheader/index.scss @@ -18,7 +18,7 @@ position: relative; z-index: 1; } - .top-search { + .mk-search-wrap { background: transparent; text-decoration: unset; font-weight: normal; diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index f7bbac1..79c6827 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -174,13 +174,10 @@ }) } - getComponents = () => { - const { config } = this.props + getComponents = (components) => { const { mainSearch, data } = this.state - if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) - - return config.components.map(item => { + return components.map(item => { let style = null if (item.style && item.style.clear === 'left') { @@ -355,8 +352,12 @@ } render() { + const { config } = this.props + + if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) + return ( - <Row className="component-wrap" gutter={8}>{this.getComponents()}</Row> + <Row className="component-wrap" id={'anchor' + config.uuid} gutter={8}>{this.getComponents(config.components)}</Row> ) } } diff --git a/src/tabviews/custom/components/table/base-table/index.scss b/src/tabviews/custom/components/table/base-table/index.scss index f48b15a..724b889 100644 --- a/src/tabviews/custom/components/table/base-table/index.scss +++ b/src/tabviews/custom/components/table/base-table/index.scss @@ -5,16 +5,12 @@ .normal-header { margin-bottom: 10px; } - .top-search { + .mk-search-wrap { border-bottom: 1px solid #efefef; padding-top: 10px; } .button-list.toolbar-button { - min-height: 60px; padding-right: 60px; - button { - margin-bottom: 0px; - } } .main-table-box { position: relative; diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index a0568c2..d0802d5 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -38,8 +38,6 @@ pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 orderBy: '', // 鎺掑簭 search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - statFValue: [], // 鍚堣鍊� - lock: false } /** @@ -65,69 +63,100 @@ _config.submit.style = _config.submit.style || {} _config.submit.wrapStyle = {} - _config.submit.hasAction = _config.action.length > 0 - if (!_config.submit.hasAction) { - if (_config.submit.style.marginTop) { - _config.submit.wrapStyle.paddingTop = _config.submit.style.marginTop + setting.hasAction = _config.action.length > 0 + + _config.action.forEach(btn => { + if (btn.funcType === 'addline') { + setting.addable = true } - if (_config.submit.style.marginBottom) { - _config.submit.wrapStyle.paddingBottom = _config.submit.style.marginBottom + btn.$tableId = setting.tableId + if (!btn.controlField) { + btn.controlField = '$lock' + btn.controlVals = [] } - } else { - _config.submit.wrapStyle.paddingTop = '15px' - } - - if (setting.height) { - setting.operType = 'btnMode' - } - - let _columns = [] - let signAdd = false - _config.cols.forEach(column => { - if (column.Hide === 'true') return - if (column.type === 'index') { - column.field = '$Index' - column.type = 'text' - } - - if (setting.addable === 'true' && setting.operType === 'buoyMode' && column.type !== 'action' && !signAdd) { - column.addable = true - signAdd = true - } - - if (column.marks && column.marks.length === 0) { - column.marks = '' - } - - column.tableId = setting.tableId - - if (column.type === 'text' && column.editable === 'true' && column.editType === 'select') { - column.options = column.options || [] - column.options = column.options.filter(cell => { - cell.value = cell.Value - cell.label = cell.Text - - return !cell.Hide - }) - } - - _columns.push(column) }) - if (setting.delable !== 'false' && setting.operType === 'buoyMode') { - if (_columns[_columns.length - 1] && _columns[_columns.length - 1].type !== 'action') { - _columns[_columns.length - 1].delable = true - } else if (_columns[_columns.length - 2] && _columns[_columns.length - 2].type !== 'action') { - _columns[_columns.length - 2].delable = true - } + let _columns = [] + setting.initId = '' + let triMap = new Map() + + let getColumns = (cols) => { + return cols.filter(item => { + if (item.Hide === 'true') return false + + item.tableId = setting.tableId + + if (item.type === 'colspan') { + item.subcols = getColumns(item.subcols) + + if (item.subcols.length === 0) { + return false + } + } else if (item.type === 'action') { + item.elements.forEach(btn => { + if (btn.funcType === 'addline') { + setting.addable = true + } + btn.$tableId = setting.tableId + if (!btn.controlField) { + btn.controlField = '$lock' + btn.controlVals = [] + } + }) + } else { + if (item.type === 'index') { + item.field = '$Index' + item.type = 'text' + } + + if (item.marks && item.marks.length === 0) { + item.marks = '' + } + + if (item.editable === 'true') { + if (!setting.initId) { + setting.initId = item.uuid + } + if (item.type === 'text' && (item.editType === 'switch' || item.editType === 'select')) { + triMap.set(item.uuid, item.editType) + } + if (item.type === 'text' && item.editType === 'select') { + item.options = item.options || [] + item.options = item.options.filter(cell => { + cell.value = cell.Value + cell.label = cell.Text + + return !cell.Hide + }) + } + } + } + + return true + }) } - // if (setting.color) { - // setting.style.color = setting.color - // } - // if (setting.fontSize) { - // setting.style.fontSize = setting.fontSize - // } + _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' + } + } if (!_config.lineMarks || _config.lineMarks.length === 0) { _config.lineMarks = null @@ -148,7 +177,6 @@ if (_config.setting.onload === 'true') { setTimeout(() => { this.loadmaindata() - this.getStatFieldsValue() }, _config.setting.delay || 0) } }) @@ -253,7 +281,7 @@ /** * @description 鑾峰彇鍗曡鏁版嵁 */ - async loadmainLinedata (id, line) { + async loadmainLinedata (id) { const { mainSearch } = this.props const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state @@ -276,10 +304,18 @@ let result = await Api.genericInterface(param) if (result.status) { + if (!result.data || !result.data[0]) { + this.setState({ + loading: false + }) + + return + } + let data = fromJS(this.state.data).toJS() let selectedData = fromJS(this.state.selectedData).toJS() - let _data = result.data[0] || {} + let _data = result.data[0] _data.$$uuid = _data[setting.primaryKey] || '' _data.$$BID = BID || '' _data.$$BData = BData || '' @@ -314,14 +350,8 @@ console.warn('鏁版嵁鏌ヨ閿欒') } - if (line) { - if (line.$type === 'del' && !result.data[0]) { - data = data.filter(m => m.$$uuid === line.$$uuid) - } - MKEmitter.emit('transferData', config.uuid, _data, 'line') - } else { - MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) - } + MKEmitter.emit('transferData', config.uuid, _data, 'line') + MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) this.setState({ data, @@ -341,72 +371,6 @@ } /** - * @description 鑾峰彇鍚堣瀛楁鍊� - */ - getStatFieldsValue = () => { - const { mainSearch } = this.props - const { setting, config, search, BID, orderBy } = this.state - - if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� - this.setState({ - statFValue: [] - }) - return - } - - if (config.statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return - - let searches = fromJS(search).toJS() - if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 - let keys = searches.map(item => item.key.toLowerCase()) - mainSearch.forEach(item => { - if (!keys.includes(item.key.toLowerCase())) { - searches.push(item) - } - }) - } - let requireFields = searches.filter(item => item.required && item.value === '') - if (requireFields.length > 0) { - return - } - - let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, config.statFields, searches, _orderBy, BID) - - Api.genericInterface(param).then(res => { - if (res.status) { - let _data = res.data[0] - let values = [] - - if (_data) { - config.statFields.forEach(item => { - if (_data[item.field] || _data[item.field] === 0) { - let val = +_data[item.field] - if (isNaN(val)) { - val = 0 - } - val = val.toFixed(item.decimal) - values.push({label: item.label, value: val}) - } - }) - } - this.setState({ - statFValue: values - }) - } else { - this.setState({ - statFValue: [] - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 - }) - } - }) - } - - /** * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� */ @@ -420,7 +384,6 @@ setting: {...setting, onload: 'true'} }, () => { this.loadmaindata() - this.getStatFieldsValue() }) } else { this.setState({ @@ -428,7 +391,6 @@ search: searches }, () => { this.loadmaindata(true, 'true') - this.getStatFieldsValue() }) } } @@ -463,11 +425,9 @@ pageIndex: 1 }, () => { this.loadmaindata(true, 'true') - this.getStatFieldsValue() }) } else { this.loadmaindata(true, 'false') - this.getStatFieldsValue() } } @@ -498,7 +458,7 @@ }) } - reloadData = (menuId, id, item) => { + reloadData = (menuId, id) => { const { config } = this.state if (config.uuid !== menuId) return @@ -506,7 +466,7 @@ if (!id) { this.reloadtable() } else { - this.loadmainLinedata(id, item) + this.loadmainLinedata(id) } } @@ -521,7 +481,6 @@ BData: data }, () => { this.loadmaindata(true, 'true') - this.getStatFieldsValue() }) } } @@ -589,7 +548,7 @@ } render() { - const { BID, setting, actions, config, columns, BData, data, selectedData, lock } = this.state + const { BID, setting, actions, config, columns, BData, data, selectedData } = this.state let style = {...config.style} if (config.wrap.empty === 'hidden' && data.length === 0) { @@ -602,15 +561,14 @@ {config.search && config.search.length ? <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null } - <MainAction + {actions.length > 0 ? <MainAction BID={BID} setting={setting} actions={actions} BData={BData} - lock={lock} columns={config.columns} selectedData={selectedData} - /> + /> : null} <MainTable BID={BID} setting={setting} @@ -623,8 +581,6 @@ loading={this.state.loading} refreshdata={this.refreshbytable} chgSelectData={(selects) => this.setState({selectedData: selects})} - changeLock={(lock) => this.setState({lock: lock})} - statFValue={this.state.statFValue} /> </div> ) diff --git a/src/tabviews/custom/components/table/edit-table/index.scss b/src/tabviews/custom/components/table/edit-table/index.scss index 47c5027..18e3dda 100644 --- a/src/tabviews/custom/components/table/edit-table/index.scss +++ b/src/tabviews/custom/components/table/edit-table/index.scss @@ -5,19 +5,19 @@ .normal-header { margin-bottom: 10px; } - .top-search { + .mk-search-wrap { border-bottom: 1px solid #efefef; padding-top: 10px; } .button-list.toolbar-button { - padding: 0; - line-height: 45px; - float: left; + float: right; + margin-right: 80px; position: relative; z-index: 2; - button { - margin-right: 0px; - margin-bottom: 0px; - } + } + .toolbar-button + .edit-custom-table-btn-wrap { + position: absolute; + right: 0px; + margin-top: 15px; } } \ 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 997e630..94d02eb 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -1,8 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Table, Typography, Switch, Modal, Input, InputNumber, Tooltip, Button, notification, message, Select } from 'antd' -import { ExclamationCircleOutlined, EditOutlined, PlusOutlined, PlusCircleOutlined, DeleteOutlined } from '@ant-design/icons' +import { Table, Typography, Modal, Input, InputNumber, Button, notification, message, Select } from 'antd' +import { EditOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' @@ -17,7 +17,6 @@ import './index.scss' const { Paragraph } = Typography -const { confirm } = Modal const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) class BodyRow extends React.Component { @@ -99,17 +98,12 @@ class BodyCell extends React.Component { state = { editing: false, - err: null + err: null, + value: '' } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props.record), fromJS(nextProps.record)) || - nextState.editing !== this.state.editing || - nextState.err !== this.state.err - } - - componentDidMount () { - MKEmitter.addListener('tdFocus', this.tdFocus) + return !is(fromJS(this.props.record), fromJS(nextProps.record)) || !is(fromJS(this.state), fromJS(nextState)) } /** @@ -119,17 +113,6 @@ this.setState = () => { return } - MKEmitter.removeListener('tdFocus', this.tdFocus) - } - - tdFocus = (id) => { - const { col, record } = this.props - - if (id !== col.uuid + record.$$uuid) return - - if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField])) return - - this.focus() } enterPress = () => { @@ -143,7 +126,8 @@ } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { - MKEmitter.emit('tdFocus', col.enter + record.$$uuid) + let node = document.getElementById(col.enter + record.$$uuid) + node && node.click() } }, 50) @@ -154,6 +138,8 @@ focus = () => { const { col, record } = this.props + + if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField])) return if (col.editType === 'switch' || col.editType === 'select') { this.setState({editing: true}, () => { @@ -214,6 +200,7 @@ } else if (col.required === 'true' && !val) { err = '璇峰~鍐�' + col.label } + this.setState({value: val, err}) } @@ -228,7 +215,8 @@ } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { - MKEmitter.emit('tdFocus', col.enter + record.$$uuid) + let node = document.getElementById(col.enter + record.$$uuid) + node && node.click() } }, 50) @@ -272,7 +260,8 @@ } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { - MKEmitter.emit('tdFocus', col.enter + record.$$uuid) + let node = document.getElementById(col.enter + record.$$uuid) + node && node.click() } }, 50) @@ -337,8 +326,7 @@ if (editing) { if (!col.editType || col.editType === 'text') { return (<td className="editing_table_cell"> - <Input id={col.uuid + record.$$uuid} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> - {err ? <Tooltip title={err}><ExclamationCircleOutlined /></Tooltip> : null} + <Input className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> </td>) } else if (col.editType === 'switch') { let _value = '' @@ -374,9 +362,7 @@ } } else { return (<td className={className + ' pointer'} style={style}> - {col.addable ? <PlusCircleOutlined onClick={() => MKEmitter.emit('addRecord', col.tableId, {...record})} className="mk-editable mk-plus"/> : null} - <div className="mk-mask" onClick={this.focus}></div>{content} - {col.delable ? <DeleteOutlined onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})} className="mk-editable mk-del"/> : null} + <div className="mk-mask" id={col.uuid + record.$$uuid} onClick={this.focus}></div>{content} </td>) } } else { @@ -387,6 +373,9 @@ try { content = parseFloat(record[col.field]) if (isNaN(content)) { + content = '' + } + if (col.noValue === 'hide' && content === 0) { content = '' } } catch (e) { @@ -431,15 +420,16 @@ if (col.editable === 'true' && !disabled) { if (editing) { + let val = value + if (col.noValue === 'hide' && value === 0) { + val = '' + } return (<td className="editing_table_cell"> - <InputNumber id={col.uuid + record.$$uuid} defaultValue={value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> - {err ? <Tooltip title={err}><ExclamationCircleOutlined /></Tooltip> : null} + <InputNumber className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={val} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> </td>) } else { return (<td className={className + ' pointer'} style={style}> - {col.addable ? <PlusCircleOutlined onClick={() => MKEmitter.emit('addRecord', col.tableId, {...record})} className="mk-editable mk-plus"/> : null} - <div className="mk-mask" onClick={this.focus}></div>{content} - {col.delable ? <DeleteOutlined onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})} className="mk-editable mk-del"/> : null} + <div className="mk-mask" id={col.uuid + record.$$uuid} onClick={this.focus}></div>{content} </td>) } } else { @@ -477,6 +467,10 @@ } content = content === undefined ? '' : content + + if (col.noValue === 'hide' && content === 0) { + content = '' + } if (content !== '') { content = `${col.prefix || ''}${content}${col.postfix || ''}` @@ -518,30 +512,37 @@ children = ( <CardCellComponent data={record} cards={config} elements={col.elements}/> ) - } else if (col.type === 'operation') { - style.padding = '0px 5px' - children = ( - <Button type="link" style={{color: 'rgb(255, 77, 79)', backgroundColor: 'transparent'}} onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})}>鍒犻櫎</Button> - ) } - return (<td className={className} style={style}>{col.addable ? <PlusCircleOutlined onClick={() => MKEmitter.emit('addRecord', col.tableId, {...record})} className="mk-editable mk-plus"/> : null}{children}{col.delable ? <DeleteOutlined onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})} className="mk-editable mk-del"/> : null}</td>) - // return (<td className={className} style={style}>{children}</td>) + return (<td className={className} style={style}>{children}</td>) } } class BodyAllCell extends React.Component { state = { - err: null + err: null, + value: '' } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props.record), fromJS(nextProps.record)) || - nextState.err !== this.state.err + return !is(fromJS(this.props.record), fromJS(nextProps.record)) || !is(fromJS(this.state), fromJS(nextState)) } - componentDidMount () { - MKEmitter.addListener('tdFocus', this.tdFocus) + 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]}) + } } /** @@ -551,18 +552,12 @@ this.setState = () => { return } - MKEmitter.removeListener('tdFocus', this.tdFocus) - } - - tdFocus = (id) => { - const { col, record } = this.props - - if (id !== col.uuid + record.$$uuid) return - this.focus() } enterPress = () => { const { col, record } = this.props + + this.onBlur() setTimeout(() => { if (col.enter === '$next') { @@ -570,46 +565,35 @@ } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { - MKEmitter.emit('tdFocus', col.enter + record.$$uuid) + let node = document.getElementById(col.enter + record.$$uuid) + + if (node) { + if (col.triType === 'click') { + node.click() + } else { + node.select && node.select() + } + } } }, 50) } - - focus = () => { - const { col, record } = this.props - - if (col.editType === 'switch' || col.editType === 'select') { - 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({err}, () => { - let node = document.getElementById(col.uuid + record.$$uuid) - node && node.select() - }) - } - } 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 @@ -624,8 +608,12 @@ } else if (col.required === 'true' && !val) { err = '璇峰~鍐�' + col.label } + this.setState({err}) - MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) + + if (value !== record[col.field]) { + MKEmitter.emit('changeRecord', col.tableId, {...record, [col.field]: val}) + } } onSwitchChange = (val, label) => { @@ -637,7 +625,14 @@ } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { - MKEmitter.emit('tdFocus', col.enter + record.$$uuid) + let node = document.getElementById(col.enter + record.$$uuid) + if (node) { + if (col.triType === 'click') { + node.click() + } else { + node.select && node.select() + } + } } }, 50) @@ -679,7 +674,14 @@ } else if (col.enter === '$sub') { MKEmitter.emit('subLine', col, record) } else if (col.enter !== '$noAct') { - MKEmitter.emit('tdFocus', col.enter + record.$$uuid) + let node = document.getElementById(col.enter + record.$$uuid) + if (node) { + if (col.triType === 'click') { + node.click() + } else { + node.select && node.select() + } + } } }, 50) @@ -687,8 +689,10 @@ } render() { - let { col, config, record, style, className } = this.props + 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 if (col.ctrlField) { @@ -707,8 +711,7 @@ if (!col.editType || col.editType === 'text') { children = (<> - <Input id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(e) => this.onChange(e.target.value)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> - {err ? <Tooltip title={err}><ExclamationCircleOutlined /></Tooltip> : null} + <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}/> </>) } else if (col.editType === 'switch') { children = ( @@ -769,15 +772,22 @@ } else if (col.type === 'number') { if (col.editable === 'true' && !disabled) { let _value = record[col.field] !== undefined ? record[col.field] : '' + + if (col.noValue === 'hide' && _value === 0) { + _value = '' + } + children = (<> - <InputNumber id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress}/> - {err ? <Tooltip title={err}><ExclamationCircleOutlined /></Tooltip> : null} + <InputNumber className={err ? 'has-error' : ''} title={err} id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/> </>) } else { let content = '' try { content = parseFloat(record[col.field]) if (isNaN(content)) { + content = '' + } + if (col.noValue === 'hide' && content === 0) { content = '' } } catch (e) { @@ -854,6 +864,10 @@ content = content === undefined ? '' : content + if (col.noValue === 'hide' && content === 0) { + content = '' + } + if (content !== '') { content = `${col.prefix || ''}${content}${col.postfix || ''}` content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') @@ -886,20 +900,22 @@ children = ( <CardCellComponent data={record} cards={config} elements={col.elements}/> ) - } else if (col.type === 'operation') { - style.padding = '0px 5px' + } else if (col.type === 'action') { + style.padding = '0px' + if (col.style) { + style = {...style, ...col.style} + } children = ( - <Button type="link" style={{color: 'rgb(255, 77, 79)', backgroundColor: 'transparent'}} onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})}>鍒犻櫎</Button> + <CardCellComponent data={record} cards={config} elements={col.elements}/> ) } - return (<td className={'editing_all_table_cell ' + className} style={style}>{col.addable ? <PlusCircleOutlined onClick={() => MKEmitter.emit('addRecord', col.tableId, {...record})} className="mk-editable mk-plus"/> : null}{children}{col.delable ? <DeleteOutlined onClick={() => MKEmitter.emit('delRecord', col.tableId, {...record})} className="mk-editable mk-del"/> : null}</td>) + return (<td className={'editing_all_table_cell ' + className} style={style}>{children}</td>) } } class NormalTable extends Component { static propTpyes = { - statFValue: PropTypes.any, // 鍚堣瀛楁鏁版嵁 MenuID: PropTypes.string, // 鑿滃崟Id setting: PropTypes.object, // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乤ctionfixed锛堟寜閽浐瀹氾級 columns: PropTypes.array, // 琛ㄦ牸鍒� @@ -909,37 +925,32 @@ total: PropTypes.any, // 鎬绘暟 loading: PropTypes.bool, // 琛ㄦ牸鍔犺浇涓� refreshdata: PropTypes.func, // 琛ㄦ牸涓帓搴忓垪銆侀〉鐮佺殑鍙樺寲鏃跺埛鏂� - changeLock: PropTypes.func, chgSelectData: PropTypes.func, } state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - data: [], edData: [], - edColumns: [], selectedRowKeys: [], // 琛ㄦ牸涓�変腑琛� tableId: '', // 琛ㄦ牸ID pageIndex: 1, // 鍒濆椤甸潰绱㈠紩 pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 columns: null, // 鏄剧ず鍒� forms: [], - pickup: false, // 鏀惰捣鏈�夋嫨椤� orderfields: {}, // 鎺掑簭id涓巉ield杞崲 loading: false, - editable: false, - pageOptions: [] + pageOptions: [], + deForms: null } UNSAFE_componentWillMount () { - const { setting, fields, columns } = this.props + const { setting, fields, columns, BID } = this.props let orderfields = {} - let initEditLine = null - let edColumns = [] let _columns = [] let deForms = [] let _forms = {} + let hasBid = false let getColumns = (cols) => { return cols.map(item => { @@ -951,26 +962,23 @@ } else { if (item.editable === 'true') { _forms[item.field] = item - if (!initEditLine) { - initEditLine = item - } if (item.ctrlField) { item.ctrlValue = item.ctrlValue.split(',') } - } - - if (item.type === 'text' && item.editable === 'true' && item.editType === 'select' && item.resourceType === '1') { - let _option = Utils.getSelectQueryOptions(item) - - if (window.GLOB.debugger === true || window.debugger === true) { - console.info(_option.sql) + + if (item.type === 'text' && item.editType === 'select' && item.resourceType === '1') { + let _option = Utils.getSelectQueryOptions(item) + + if (/@BID@/ig.test(_option.sql)) { + hasBid = true + } + + item.base_sql = _option.sql + item.arr_field = _option.field + + deForms.push(item) } - - item.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) - item.arr_field = _option.field - - deForms.push(item) } if (item.field) { @@ -980,7 +988,7 @@ cell = { align: item.Align, dataIndex: item.uuid, - title: item.label, + title: item.editable === 'true' ? <span>{item.label}<EditOutlined className="system-color mk-edit-sign"/></span> : item.label, sorter: !!(item.field && item.IsSort === 'true'), width: item.Width || 120, $type: item.type, @@ -995,6 +1003,7 @@ return cell }) } + _columns = getColumns(columns) let forms = [] @@ -1007,32 +1016,6 @@ forms.push(item) } }) - - _columns.forEach(item => { - if (item.$type === 'action') return - - let _copy = fromJS(item).toJS() - _copy.sorter = false - - if (item.editable === 'true') { - _copy.title = <span>{item.label}<EditOutlined className="system-color mk-edit-sign"/></span> - } - edColumns.push(_copy) - }) - - if (setting.delable !== 'false' && setting.operType !== 'buoyMode') { - edColumns.push({ - align: 'center', - dataIndex: 'mkoperation', - title: '鎿嶄綔', - sorter: false, - width: 100, - onCell: record => ({ - record, - col: {type: 'operation', tableId: setting.tableId}, - }) - }) - } let size = (setting.pageSize || 10) + '' let pageOptions = ['10', '25', '50', '100', '500', '1000'] @@ -1047,14 +1030,15 @@ pageSize: setting.pageSize || 10, pageOptions, columns: _columns, - edColumns, tableId: setting.tableId, - orderfields, - initEditLine, - editable: setting.editable === 'true' + orderfields }, () => { if (deForms.length > 0) { - this.improveActionForm(deForms) + if (hasBid && setting.supModule && !BID) { + this.setState({ deForms }) + } else { + this.improveActionForm(deForms, BID) + } } const element = document.getElementById(setting.tableId) @@ -1069,10 +1053,19 @@ return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } + UNSAFE_componentWillReceiveProps(nextProps) { + const { BID } = this.props + const { deForms } = this.state + + if (deForms && nextProps.BID !== BID) { + this.improveActionForm(deForms, nextProps.BID) + } + } + componentDidMount () { MKEmitter.addListener('subLine', this.subLine) MKEmitter.addListener('nextLine', this.nextLine) - MKEmitter.addListener('addRecord', this.addLine) + MKEmitter.addListener('addRecord', this.addRecord) MKEmitter.addListener('delRecord', this.delRecord) MKEmitter.addListener('resetTable', this.resetTable) MKEmitter.addListener('transferData', this.transferData) @@ -1088,7 +1081,7 @@ } MKEmitter.removeListener('subLine', this.subLine) MKEmitter.removeListener('nextLine', this.nextLine) - MKEmitter.removeListener('addRecord', this.addLine) + MKEmitter.removeListener('addRecord', this.addRecord) MKEmitter.removeListener('delRecord', this.delRecord) MKEmitter.removeListener('resetTable', this.resetTable) MKEmitter.removeListener('transferData', this.transferData) @@ -1096,24 +1089,19 @@ } transferData = (menuid, data, type) => { - if (menuid !== this.props.MenuID) return + const { MenuID, setting } = this.props + + if (menuid !== MenuID) return if (type !== 'line') { - this.setState({data: data || []}) + this.setState({edData: data}) - if (this.state.editable && !this.state.pickup) { + if (setting.addable && data.length === 0) { setTimeout(() => { - this.pickupChange() - }, 200) + this.plusLine(true) + }, 10) } - } else if (type === 'line' && data.$$uuid) { - let _data = this.state.data.map(item => { - if (item.$$uuid === data.$$uuid) { - return data - } else { - return item - } - }) + } else if (type === 'line') { let _edData = this.state.edData.map(item => { if (item.$$uuid === data.$$uuid) { return data @@ -1122,24 +1110,42 @@ } }) - this.setState({edData: _edData, data: _data}) + this.setState({edData: _edData}) } - this.setState({editable: false}) } - improveActionForm = (deForms) => { - const { BID, setting } = this.props + improveActionForm = (deForms, BID) => { + const { setting } = this.props let deffers = [] let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� let localItems = [] // 鏈湴鏁版嵁 let cache = setting.cache !== 'false' + let debug = window.GLOB.debugger === true || window.debugger === true + let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` + let _sso = _sql deForms.forEach(item => { if (item.database === 'sso') { - mainItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) + let sql = _sso + item.base_sql + _sso = '' + + sql = sql.replace(/@BID@/ig, `'${BID}'`) + + if (debug) { + console.info(sql) + } + mainItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) } else { - localItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`) + let sql = _sql + item.base_sql + _sql = '' + + sql = sql.replace(/@BID@/ig, `'${BID}'`) + + if (debug) { + console.info(sql) + } + localItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`) } }) @@ -1222,13 +1228,12 @@ } resetFormList = (result) => { - const { columns } = this.props - const { edColumns } = this.state + const { columns } = this.state let _edColumns = [] let reCols = {} - columns.forEach(item => { + this.props.columns.forEach(item => { if (item.resourceType === '1' && result[item.uuid] && result[item.uuid].length > 0) { let options = [] let _map = new Map() @@ -1270,7 +1275,7 @@ } }) - _edColumns = edColumns.map(item => { + _edColumns = columns.map(item => { if (reCols[item.dataIndex]) { item.onCell = record => ({ record, @@ -1281,29 +1286,34 @@ return item }) - if (this.state.pickup) { - this.setState({ - pickup: false - }, () => { - this.setState({pickup: true, edColumns: _edColumns}) - }) - } else { - this.setState({edColumns: _edColumns}) - } + this.setState({columns: []}, () => { + this.setState({columns: _edColumns}) + }) } nextLine = (col, uuid) => { const { setting } = this.props - const { edData, initEditLine, tableId } = this.state + const { edData, tableId } = this.state if (col.tableId !== tableId) return let index = edData.findIndex(item => item.$$uuid === uuid) let next = edData[index + 1] || null - - if (next && initEditLine) { - MKEmitter.emit('tdFocus', initEditLine.uuid + next.$$uuid) - } else if (setting.addable === 'true') { + + if (next) { + let node = document.getElementById(setting.initId + next.$$uuid) + if (node) { + if (setting.editType === 'multi') { + if (setting.triType === 'click') { + node.click() + } else { + node.select && node.select() + } + } else { + node.click() + } + } + } else if (setting.addable) { setTimeout(() => { this.plusLine() }, 10) @@ -1315,83 +1325,31 @@ } subLine = (col, record) => { - const { tableId, forms, edData } = this.state + const { tableId, edData } = this.state if (col && col.tableId !== tableId) return - if (edData.filter(item => !item.$origin).length > 1) { - setTimeout(() => { - this.submit(edData) - }, 10) - return - } - - setTimeout(() => { - let item = fromJS(record).toJS() - let line = [] - forms.forEach(col => { - if (col.editable !== 'true' || item.$deleted) { - if (col.type === 'number') { - item[col.field] = +item[col.field] - if (isNaN(item[col.field])) { - item[col.field] = 0 - } - } else { - item[col.field] = item[col.field] !== undefined ? (item[col.field] + '') : '' - } - return - } - if (col.type === 'text') { - let val = item[col.field] !== undefined ? (item[col.field] + '') : '' - if (col.required === 'true' && !val) { - line.push(`${col.label}涓嶅彲涓虹┖`) - } - item[col.field] = val - } else if (col.type === 'number') { - let val = item[col.field] - 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}`) - } - - item[col.field] = val - } - }) - - let err = line.join('锛�') - - if (err) { - notification.warning({ - top: 92, - message: err, - duration: 5 - }) - } else { - this.submit([item], 'simple') + let _data = edData.map(item => { + if (item.$$uuid === record.$$uuid) { + item.$origin = false } - }, 10) + return item + }) + + this.setState({edData: _data}, () => { + this.submit() + }) } - plusLine = () => { - const { edData, forms, initEditLine } = this.state + plusLine = (auto) => { + const { setting } = this.props + const { edData, forms } = this.state - let item = {...edData[edData.length - 1]} + let item = edData.length > 0 ? {...edData[edData.length - 1]} : {} item.$$uuid = Utils.getguid() item.$type = 'add' + item.$forbid = true item.$Index = '' forms.forEach(col => { @@ -1410,7 +1368,18 @@ }) this.setState({edData: [...edData, item]}, () => { - MKEmitter.emit('tdFocus', initEditLine.uuid + item.$$uuid) + 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() + } + } }) } @@ -1419,13 +1388,12 @@ const { tableId, edData } = this.state if (id !== tableId) return - - let _data = [] - + if (record.$type === 'add') { - _data = edData.filter(item => item.$$uuid !== record.$$uuid) + let _data = edData.filter(item => item.$$uuid !== record.$$uuid) + this.setState({edData: _data}) } else { - _data = edData.map(item => { + let _data = edData.map(item => { if (item.$$uuid === record.$$uuid) { record.$deleted = true record.$origin = false @@ -1436,101 +1404,97 @@ } }) - if (setting.commit === 'simple' && record.$deleted) { - this.subLine(null, record) - } + this.setState({edData: _data}, () => { + if (setting.commit === 'simple' && record.$deleted) { + this.submit() + } + }) } - - this.setState({edData: _data}) } changeRecord = (id, record) => { + const { setting } = this.props const { tableId } = this.state if (id !== tableId) return + let lock = record.$lock + let _data = this.state.edData.map(item => { if (item.$$uuid === record.$$uuid) { record.$origin = false + record.$lock = true + + delete record.$forbid + return record } else { return item } }) - this.setState({edData: _data}) + this.setState({edData: _data}, () => { + if (setting.tableType && setting.hasAction && !lock && this.state.selectedRowKeys.includes(record.$$uuid)) { + this.selectdata(this.state.selectedRowKeys) + } + }) } - addLine = (id, record) => { + addRecord = (id, record) => { const { BID } = this.props const { edData, forms, tableId } = this.state - if (id) { - if (id !== tableId) return - let _edData = fromJS(edData).toJS() - let index = _edData.findIndex(item => record.$$uuid === item.$$uuid) + if (id !== tableId) return - let item = {} + let _edData = fromJS(edData).toJS() + let item = {} + let index = null + let copy = edData.length > 0 ? {...edData[edData.length - 1]} : null - item.$$uuid = Utils.getguid() - item.$type = 'add' - item.$Index = '' - 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 (record) { + index = _edData.findIndex(item => record.$$uuid === item.$$uuid) + index = index === -1 ? null : index - _edData.splice(index, 0, item) - - this.setState({edData: _edData}) - } else { - let item = {} - if (edData.length > 0) { - item = {...edData[edData.length - 1]} - item.$$uuid = Utils.getguid() - item.$type = 'add' - item.$Index = '' - } else { - item.$$uuid = Utils.getguid() - item.$type = 'add' - item.$Index = '' - 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] = '' - } - }) - - this.setState({edData: [...edData, item]}) + 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) { @@ -1539,11 +1503,28 @@ message: '鎻愪氦鏁版嵁涓嶅彲涓虹┖锛�', duration: 5 }) - return + return null } + + let data = fromJS(edData).toJS() + + data = data.filter(item => !item.$forbid) + if (setting.commit === 'change' || setting.commit === 'simple') { + data = data.filter(item => !item.$origin) + } + + if (data.length === 0) { + notification.warning({ + top: 92, + message: '鏁版嵁鏈慨鏀癸紝涓嶅彲鎻愪氦锛�', + duration: 5 + }) + return null + } + let err = '' let Index = 1 - let data = fromJS(edData).toJS().map(item => { + data = data.map(item => { let line = [] forms.forEach(col => { if (col.editable !== 'true' || item.$deleted) { @@ -1565,7 +1546,9 @@ item[col.field] = val } else if (col.type === 'number') { let val = item[col.field] - if (!val && val !== 0) { + if (col.noValue === 'hide' && !val) { + val = 0 + } else if (!val && val !== 0) { line.push(`${col.label}涓嶅彲涓虹┖`) return } @@ -1603,27 +1586,30 @@ message: err, duration: 5 }) - } else { - this.submit(data) + + return null } + + return data } - submit = (data, type) => { + submit = () => { const { submit, BID, setting } = this.props const { forms } = this.state - if (type !== 'simple' && (setting.commit === 'change' || setting.commit === 'simple')) { - data = data.filter(item => !item.$origin) - } - - if (data.length === 0) { + if (setting.supModule && !BID) { notification.warning({ top: 92, - message: '鏁版嵁鏈慨鏀癸紝涓嶅彲鎻愪氦锛�', + message: '闇�瑕佷笂绾т富閿�硷紒', duration: 5 }) + return } + + let data = this.checkData() + + if (!data) return let result = getEditTableSql(submit, data, forms) @@ -1664,12 +1650,7 @@ Api.genericInterface(param).then((res) => { if (res.status) { - if (type === 'simple') { - this.updataLine(data[0]) - this.execSuccess(res, type) - } else { - this.execSuccess(res) - } + this.execSuccess(res) } else { this.execError(res) } @@ -1681,12 +1662,7 @@ Api.genericInterface(param).then((res) => { if (res.status) { - if (type === 'simple') { - this.updataLine(data[0]) - this.execSuccess(res, type) - } else { - this.execSuccess(res) - } + this.execSuccess(res) } else { this.execError(res) } @@ -1715,7 +1691,7 @@ MKEmitter.emit('reloadData', this.props.MenuID, item.$$uuid, item) } - execSuccess = (res, type) => { + execSuccess = (res) => { const { submit } = this.props if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 @@ -1736,13 +1712,11 @@ loading: false }) - if (type === 'simple') return - if (submit.closetab === 'true') { MKEmitter.emit('popclose') } + if (submit.execSuccess !== 'never') { - this.repick() MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execSuccess, submit) } } @@ -1776,33 +1750,12 @@ }) if (submit.execError !== 'never') { - this.repick() MKEmitter.emit('refreshByButtonResult', submit.$menuId, submit.execError, submit) } } - repick = () => { - const { setting } = this.props - const { data } = this.state - - if (setting.submittal === 'true') { - this.setState({editable: true}) - } - - this.props.changeLock(false) - this.setState({ - data: [], - edData: [], - pickup: false, - }, () => { - this.setState({ - data: data, - }) - }) - } - /** - * + * @description 閫変腑琛� */ onSelectChange = selectedRowKeys => { this.setState({ selectedRowKeys }) @@ -1818,28 +1771,28 @@ /** * @description 鐐瑰嚮鏁磋锛岃Е鍙戝垏鎹紝 鍒ゆ柇鏄惁鍙�夛紝鍗曢�夋垨澶氶�夛紝杩涜瀵瑰簲鎿嶄綔 */ - changeRow = (index) => { + changeRow = (id) => { const { setting } = this.props - if (!setting.tableType || this.state.pickup) return + if (!setting.tableType) return let newkeys = fromJS(this.state.selectedRowKeys).toJS() let activeId = '' if (setting.tableType === 'radio') { - activeId = index - newkeys = [index] + activeId = id + newkeys = [id] this.setState({ selectedRowKeys: newkeys }) } else { - if (newkeys.includes(index)) { - newkeys = newkeys.filter(item => item !== index) + if (newkeys.includes(id)) { + newkeys = newkeys.filter(item => item !== id) if (newkeys.length > 0) { activeId = newkeys.slice(-1)[0] } } else { - activeId = index - newkeys.push(index) + activeId = id + newkeys.push(id) } this.setState({ selectedRowKeys: newkeys }) @@ -1851,21 +1804,21 @@ changedata = (id) => { const { MenuID } = this.props - const { data } = this.state + const { edData } = this.state let _data = '' if (id) { - _data = data.filter(item => item.$$uuid === id)[0] || '' + _data = edData.filter(item => item.$$uuid === id)[0] || '' } MKEmitter.emit('resetSelectLine', MenuID, id, _data) } selectdata = (keys) => { - const { data } = this.state + const { edData } = this.state - let _data = data.filter(item => keys.includes(item.$$uuid)) + let _data = edData.filter(item => keys.includes(item.$$uuid)) this.props.chgSelectData(_data) } @@ -1901,96 +1854,23 @@ } } - pickupChange = () => { - const { submit, MenuID, setting } = this.props - const { data } = this.state - - let pickup = !this.state.pickup - - if (!submit.sheet) { - notification.warning({ - top: 92, - message: '鎻愪氦鎸夐挳灏氭湭璁剧疆锛屼笉鍙紪杈戯紒', - duration: 5 - }) - return - } - - if (!pickup && this.state.edData.filter(item => !item.$origin).length > 0) { - const _this = this - confirm({ - title: '鏁版嵁宸蹭慨鏀癸紝纭畾鏀惧純淇濆瓨鍚楋紵', - onOk() { - _this.setState({ - data: [], - edData: [], - pickup - }, () => { - _this.setState({ - data: data, - edData: pickup ? fromJS(data).toJS() : [] - }) - }) - }, - onCancel() {} - }) - } else { - pickup && MKEmitter.emit('resetSelectLine', MenuID, '', '') - pickup && this.props.chgSelectData([]) - let keys = this.state.selectedRowKeys - this.setState({ - data: [], - edData: [], - selectedRowKeys: [], - pickup, - loading: false, - editable: false - }, () => { - if (pickup && setting.tableType === 'checkbox' && keys.length > 0) { - this.setState({ - data: data, - edData: fromJS(data).toJS().filter(item => { - item.$origin = false - - return keys.includes(item.$$uuid) - }) - }) - } else { - this.setState({ - data: data, - edData: pickup ? fromJS(data).toJS() : [] - }) - } - }) - - } - this.props.changeLock(pickup) - } - render() { - const { setting, statFValue, lineMarks, submit } = this.props - const { pickup, tableId, data, edData, columns, edColumns, loading, pageOptions, selectedRowKeys } = this.state + const { setting, lineMarks, submit } = this.props + const { tableId, edData, columns, loading, pageOptions, selectedRowKeys } = this.state const components = { body: { row: BodyRow, - cell: setting.editType !== 'multi' || !pickup ? BodyCell : BodyAllCell + cell: setting.editType !== 'multi' ? BodyCell : BodyAllCell } } // 鏁版嵁鏀惰捣鏃讹紝杩囨护宸查�夋暟鎹� - let _data = data - let _columns = columns - - if (pickup) { - _data = edData - _data = _data.filter(item => !item.$deleted) - _columns = edColumns - } + let _data = edData.filter(item => !item.$deleted) // 璁剧疆琛ㄦ牸閫夋嫨灞炴�э細鍗曢�夈�佸閫夈�佷笉鍙�� let rowSelection = null - if (setting.tableType && !pickup) { + if (setting.tableType) { rowSelection = { selectedRowKeys, type: (setting.tableType === 'radio') ? 'radio' : 'checkbox', @@ -1999,7 +1879,7 @@ } let _pagination = false - if (!pickup && setting.laypage !== 'false' && setting.laypage !== false) { + if (setting.laypage) { _pagination = { current: this.state.pageIndex, pageSize: this.state.pageSize, @@ -2012,36 +1892,31 @@ let _footer = '' - if (!pickup && statFValue && statFValue.length > 0) { - _footer = statFValue.map(f => `${f.label}(鍚堣)锛�${f.value}`).join('锛�') - } - let height = setting.height || false + if (height && height <= 100) { + height = height + 'vh' + } return ( <> - {submit.hasAction && pickup ? <div className="edit-custom-table-leftbtn-wrap"> - <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> - </div> : null} <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}> - {!submit.hasAction && pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null} - {setting.switchable !== 'false' ? <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" disabled={loading || this.props.loading} checked={pickup} onChange={this.pickupChange} /> : null} + <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> </div> - <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${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'}`} id={tableId}> <Table rowKey="$$uuid" components={components} - // style={setting.style} size={setting.size || 'middle'} bordered={setting.bordered !== 'false'} rowSelection={rowSelection} - columns={_columns} + columns={columns} dataSource={_data} loading={this.props.loading} scroll={{ x: '100%', y: height }} onRow={(record, index) => { return { lineMarks, + title: setting.tipField ? record[setting.tipField] : '', data: record, onClick: () => {this.changeRow(record.$$uuid)}, } @@ -2050,8 +1925,7 @@ pagination={_pagination} /> {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null} - {pickup && setting.addable === 'true' ? <Button className="mk-add-line" onClick={() => this.addLine()} disabled={this.props.loading} type="link"><PlusOutlined /></Button> : null} - {pickup && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null} + {_data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.submit()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null} </div> </> ) 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 2d34aea..84cb88f 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss @@ -26,9 +26,9 @@ .mk-edit-sign { position: absolute; bottom: 2px; - right: 5px; - opacity: 0.7; - font-size: 14px; + right: 3px; + opacity: 0.5; + font-size: 10px; } table { @@ -151,6 +151,7 @@ height: auto; border-radius: 0; box-shadow: none!important; + text-align: inherit; } .ant-select { padding: 0px; @@ -174,15 +175,20 @@ position: unset; border: none; box-shadow: none!important; + text-align: inherit; .ant-input-number-handler-wrap { display: none; + } + .ant-input-number-input-wrap { + text-align: inherit; } .ant-input-number-input { border-radius: 0; padding: 0; height: auto; position: absolute; + text-align: inherit; top: 0px; left: 0px; right: 0px; @@ -190,17 +196,15 @@ border: 1px solid var(--mk-sys-color); } } - .anticon-exclamation-circle { - color: #ff4d4f; - position: absolute; - right: 3px; - top: calc(50% - 8px); + .has-error, .has-error .ant-input-number-input { + border-color: #ff4d4f!important; } } .editing_all_table_cell { .ant-input { border-radius: 0; padding: 4px 5px; + text-align: inherit; } .ant-select { width: 100%; @@ -210,28 +214,27 @@ } .ant-input-number { border-radius: 0; + text-align: inherit; .ant-input-number-handler-wrap { display: none; } + .ant-input-number-input-wrap { + text-align: inherit; + } .ant-input-number-input { border-radius: 0; padding: 4px 5px; + text-align: inherit; } } - .anticon-exclamation-circle { - color: #ff4d4f; - position: absolute; - right: 13px; - top: calc(50% - 8px); + .has-error, .has-error .ant-input-number-input { + border-color: #ff4d4f!important; } } td.pointer { position: relative; - } - td.pointer { .mk-mask { - display: none; cursor: pointer; position: absolute; top: 0; @@ -240,45 +243,11 @@ right: 0; } } - .mk-editable { - position: absolute; - display: none; - top: calc(50% - 18px); - cursor: pointer; - padding: 10px 5px; - opacity: 0; - } - tr:hover { - .mk-editable { - opacity: 1; - } - .mk-plus { - left: -25px; - } - .mk-del { - right: -25px; - } - } - .mk-plus { - left: 0px; - color: rgb(38, 194, 129); - padding-right: 10px; - } - .mk-del { - right: 0px; - color: rgb(255, 77, 79); - padding-left: 10px; - } - .mk-add-line { - width: 100px; - color: #26C281; - border-radius: 0; - font-size: 25px; - height: 45px; - } + .submit-footer-table { float: right; - min-height: 24px; + min-height: 28px; + min-width: 65px; height: auto; color: #ffffff; background-color: #1890ff; @@ -286,8 +255,10 @@ margin-top: 10px!important; margin-right: 10px!important; } - - table, tr, th, td { + .ant-table-small.ant-table-bordered { + border-right: 1px solid #e8e8e8; + } + table, tr, th, td, .ant-table-small { border-color: var(--mk-table-border-color)!important; } table tr { @@ -307,15 +278,22 @@ table tbody tr { color: var(--mk-table-color); } -} -.edit-custom-table.buoyMode { - .ant-table-scroll { - overflow: unset; - overflow-x: unset; - - .ant-table-body { - overflow-x: unset!important; + .ant-table-bordered { + table { + tbody { + tr:last-child { + td { + border-bottom: none; + } + } + } } + } +} +.edit-custom-table.mk-edit-simple { + table tbody tr td { + min-height: 32px; + height: 32px; } } .edit-custom-table.mk-edit-multi { @@ -324,20 +302,13 @@ } } .edit-custom-table.editable { - td { - background-color: #ffffff!important; - } - td.pointer .mk-mask { - display: block; - } - .mk-operation { - display: none; - } .ant-table-placeholder { display: none; } - .mk-editable { - display: inline-block; +} +.edit-custom-table:not(.ghost) { + .ant-table-small > .ant-table-content .ant-table-thead > tr > th { + background-color: #fafafa!important; } } .edit-custom-table:not(.fixed-height) { @@ -422,37 +393,16 @@ } .edit-custom-table-btn-wrap { float: right; - padding: 5px 0px; - .main-pickup { - position: relative; - z-index: 2; - margin-left: 10px; - } .submit-table { position: relative; z-index: 2; + min-width: 65px; margin-right: 15px; - min-height: 24px; - height: auto; - color: #ffffff; - background-color: #1890ff; - border-width: 0; - margin-top: 0px!important; - margin-bottom: 0px!important; - } -} -.edit-custom-table-leftbtn-wrap { - float: left; - line-height: 45px; - .submit-table { - position: relative; - z-index: 2; min-height: 28px; height: auto; color: #ffffff; background-color: #1890ff; border-width: 0; - margin-top: 0px; - margin-bottom: 0px; + margin-bottom: 10px!important; } -} \ 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 0dca1df..5788718 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -340,46 +340,53 @@ let result = await Api.genericInterface(param) if (result.status) { + if (!result.data || !result.data[0]) { + this.setState({ + loading: false + }) + + return + } + let data = fromJS(this.state.data).toJS() let selectedData = fromJS(this.state.selectedData).toJS() - if (result.data && result.data[0]) { - let _data = result.data[0] || {} - _data.$$uuid = _data[setting.primaryKey] || '' - _data.$$BID = BID || '' - _data.$$BData = BData || '' - if (config.absFields) { - config.absFields.forEach(f => { - if (!isNaN(_data[f])) { - _data[f] = Math.abs(_data[f]) - } - }) - } + let _data = result.data[0] + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' + _data.$$BData = BData || '' - try { - data = data.map(item => { - if (item.$$uuid === _data.$$uuid) { - _data.key = item.key - _data.$$key = '' + item.key + item.$$uuid - _data.$Index = item.$Index - return _data - } else { - return item - } - }) - selectedData = selectedData.map(item => { - if (_data.$$uuid === item.$$uuid) { - return _data - } - return item - }) - } catch (e) { - console.warn('鏁版嵁鏌ヨ閿欒') - } - - MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) + if (config.absFields) { + config.absFields.forEach(f => { + if (!isNaN(_data[f])) { + _data[f] = Math.abs(_data[f]) + } + }) } + try { + data = data.map(item => { + if (item.$$uuid === _data.$$uuid) { + _data.key = item.key + _data.$$key = '' + item.key + item.$$uuid + _data.$Index = item.$Index + return _data + } else { + return item + } + }) + selectedData = selectedData.map(item => { + if (_data.$$uuid === item.$$uuid) { + return _data + } + return item + }) + } catch (e) { + console.warn('鏁版嵁鏌ヨ閿欒') + } + + MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) + this.setState({ data, selectedData, diff --git a/src/tabviews/custom/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss index 7f55249..5a2828b 100644 --- a/src/tabviews/custom/components/table/normal-table/index.scss +++ b/src/tabviews/custom/components/table/normal-table/index.scss @@ -5,18 +5,12 @@ .normal-header { margin-bottom: 10px; } - .top-search { + .mk-search-wrap { border-bottom: 1px solid #efefef; padding-top: 10px; } - >.button-list.toolbar-button { - min-height: 60px; + .button-list.toolbar-button { padding-right: 60px; - line-height: 40px; - button { - margin-right: 0px; - margin-bottom: 0px; - } } .main-table-box { position: relative; @@ -47,15 +41,6 @@ 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; - } - } } } } diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index 9b46381..69b47b4 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -144,7 +144,7 @@ if (!tabs.subtabs.length) return null return ( - <div className={'menu-antv-tabs-wrap ' + (tabs.setting.tabLabel || '')} style={tabs.style}> + <div className={'menu-antv-tabs-wrap ' + (tabs.setting.tabLabel || '')} id={'anchor' + tabs.uuid} style={tabs.style}> <Tabs defaultActiveKey="1" tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> {tabs.subtabs.map(tab => ( <TabPane tab={<span id={'tab' + tab.uuid}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span>} style={{backgroundColor: tab.backgroundColor || 'transparent'}} key={tab.uuid}> diff --git a/src/tabviews/custom/components/tree/antd-tree/index.scss b/src/tabviews/custom/components/tree/antd-tree/index.scss index b384cef..eb5df34 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.scss +++ b/src/tabviews/custom/components/tree/antd-tree/index.scss @@ -120,18 +120,18 @@ min-width: 85px; .button-list.toolbar-button { padding: 0px; - } - button { - display: block; - margin: 0!important; - width: 100%; - border-radius: 0px; - padding-left: 15px!important; - .anticon { - display: none; - } - .anticon + span { - margin-left: 0px; + button { + display: block; + margin: 0!important; + width: 100%; + border-radius: 0px; + padding-left: 15px!important; + .anticon { + display: none; + } + .anticon + span { + margin-left: 0px; + } } } } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 903d3c9..a48c356 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -365,7 +365,7 @@ // 鏉冮檺杩囨护 if (item.action && item.action.length > 0) { item.action = item.action.filter(cell => { - if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false + if (cell.hidden === 'true' || cell.OpenType === 'popview') return false cell = this.resetButton(item, cell, Tab) cell.$toolbtn = true @@ -392,7 +392,7 @@ card.elements = card.elements.filter(cell => { if (cell.eleType === 'button') { - if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false + if (cell.hidden === 'true' || cell.OpenType === 'popview') return false cell = this.resetButton(item, cell, Tab) @@ -413,7 +413,7 @@ card.backElements = card.backElements.filter(cell => { if (cell.eleType === 'button') { - if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false + if (cell.hidden === 'true' || cell.OpenType === 'popview') return false cell = this.resetButton(item, cell, Tab) @@ -440,7 +440,7 @@ } item.elements = item.elements.filter(cell => { if (cell.eleType === 'button') { - if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false + if (cell.hidden === 'true' || cell.OpenType === 'popview') return false cell = this.resetButton(item, cell, Tab) @@ -460,7 +460,7 @@ item.cols = item.cols.filter(col => { if (col.type !== 'action') return true col.elements = col.elements.filter(cell => { - if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false + if (cell.hidden === 'true' || cell.OpenType === 'popview') return false cell = this.resetButton(item, cell, Tab) diff --git a/src/tabviews/subtable/index.scss b/src/tabviews/subtable/index.scss index 6d16916..3e12f6f 100644 --- a/src/tabviews/subtable/index.scss +++ b/src/tabviews/subtable/index.scss @@ -2,7 +2,7 @@ position: relative; min-height: 200px; - >.top-search { + >.mk-search-wrap { padding: 0px 0px 5px; border-bottom: 1px solid #efefef; } diff --git a/src/tabviews/subtabtable/index.scss b/src/tabviews/subtabtable/index.scss index 77ab9cb..534296f 100644 --- a/src/tabviews/subtabtable/index.scss +++ b/src/tabviews/subtabtable/index.scss @@ -2,7 +2,7 @@ position: relative; min-height: 200px; padding-top: 16px; - >.top-search { + >.mk-search-wrap { padding: 0px 0px 5px; border-bottom: 1px solid #efefef; } diff --git a/src/tabviews/zshare/actionList/editLine/index.jsx b/src/tabviews/zshare/actionList/editLine/index.jsx new file mode 100644 index 0000000..7d29501 --- /dev/null +++ b/src/tabviews/zshare/actionList/editLine/index.jsx @@ -0,0 +1,149 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button } from 'antd' + +import MkIcon from '@/components/mk-icon' +import MKEmitter from '@/utils/events.js' +// import './index.scss' + +class EditLine extends Component { + static propTpyes = { + btn: PropTypes.object, // 鎸夐挳 + disabled: PropTypes.any, // 琛屾寜閽鐢� + } + + state = { + disabled: false, + hidden: false + } + + UNSAFE_componentWillMount () { + const { btn, selectedData, BData, disabled } = this.props + + if (btn.controlField) { + this.setStatus(btn, selectedData || [], BData, disabled) + } else if (disabled) { + this.setState({disabled: true}) + } + } + + UNSAFE_componentWillReceiveProps (nextProps) { + const { btn } = this.props + + if (btn.controlField) { + this.setStatus(btn, nextProps.selectedData || [], nextProps.BData, nextProps.disabled) + } else { + this.setState({disabled: nextProps.disabled === true}) + } + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentWillUnmount () { + this.setState = () => { + return + } + } + + setStatus = (btn, data, BData, disprop) => { + let disabled = false + let hidden = false + + if (btn.control !== 'parent') { + if (data.length > 0) { + data.forEach(item => { + let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' + if (btn.controlVals.includes(s)) { + disabled = true + } + }) + } else if (btn.controlVals.includes('')) { + disabled = true + } + } else { + if (!BData || !BData.hasOwnProperty(btn.controlField)) { + hidden = true + } else { + let s = BData[btn.controlField] + '' + if (btn.controlVals.includes(s)) { + hidden = true + } + } + } + + if (disabled && btn.control === 'hidden') { + hidden = true + } + + if (disprop) { + disabled = true + } + + this.setState({hidden, disabled}) + } + + /** + * @description 瑙﹀彂鎸夐挳鎿嶄綔 + */ + actionTrigger = () => { + const { btn, selectedData } = this.props + + if (this.state.disabled) return + + let data = selectedData || [] + + if (btn.funcType === 'addline') { + MKEmitter.emit('addRecord', btn.$tableId, data[0] || null) + } else { + MKEmitter.emit('delRecord', btn.$tableId, data[0] || null) + } + } + + render() { + const { btn } = this.props + const { disabled, hidden } = this.state + + if (hidden) return null + + let label = '' + let icon = '' + let type = 'link' + let className = '' + + if (btn.show === 'button') { + label = btn.label + icon = btn.icon || '' + } else if (btn.show === 'link') { + label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span> + icon = '' + } else if (btn.show === 'icon') { + icon = btn.icon || '' + } else if (!btn.$toolbtn) { + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } else { + type = '' + icon = btn.icon || '' + label = btn.label + className = 'mk-btn mk-' + btn.class + } + + return ( + <Button + type={type} + title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} + disabled={disabled} + style={btn.style} + icon={icon} + className={className} + onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} + >{label}</Button> + ) + } +} + +export default EditLine \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/editLine/index.scss b/src/tabviews/zshare/actionList/editLine/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/tabviews/zshare/actionList/editLine/index.scss diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index d7f8069..8856f16 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -78,7 +78,7 @@ if (data.length > 0) { data.forEach(item => { let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' - if (btn.controlVals.includes(s)) { + if (btn.controlVals.includes(s) || item.$lock) { disabled = true } }) diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index df5de33..8723fa0 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -17,11 +17,11 @@ const PrintButton = asyncComponent(() => import('./printbutton')) const FuncMegvii = asyncComponent(() => import('./funcMegvii')) const FuncZip = asyncComponent(() => import('./funczip')) +const EditLine = asyncComponent(() => import('./editLine')) class ActionList extends Component { static propTpyes = { BID: PropTypes.any, // 涓昏〃ID - lock: PropTypes.any, // 鍙紪杈戣〃涓寜閽攣瀹� BData: PropTypes.any, // 涓昏〃鏁版嵁 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 MenuID: PropTypes.string, // 鑿滃崟ID @@ -32,60 +32,21 @@ state = { actions: [], - mores: null, - listId: '' + mores: null } 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, listId}) + this.setState({actions: actions}) } else { let mores = fromJS(actions).toJS() this.setState({ actions: mores.splice(0, setting.btnlimit), - mores, - listId + mores }) - } - } - - componentDidMount() { - 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() } } @@ -94,14 +55,14 @@ } getButtonList = (actions) => { - const { BID, BData, MenuID, columns, setting, selectedData, lock } = this.props + const { BID, BData, MenuID, columns, setting, selectedData } = this.props return actions.map(item => { if (['exec', 'prompt', 'pop'].includes(item.OpenType)) { return ( <NormalButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} BData={BData} @@ -115,7 +76,7 @@ <ExcelInButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} BData={BData} @@ -128,7 +89,7 @@ <ExcelOutButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} BData={BData} @@ -141,7 +102,7 @@ <PopupButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} BData={BData} @@ -154,7 +115,7 @@ <TabButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} btn={item} BID={BID} BData={BData} @@ -167,7 +128,7 @@ <NewPageButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} btn={item} BData={BData} selectedData={selectedData} @@ -179,7 +140,7 @@ <ChangeUserButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} BData={BData} @@ -193,7 +154,7 @@ <PrintButton key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} BData={BData} @@ -207,7 +168,7 @@ <FuncMegvii key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} setting={setting} @@ -219,10 +180,19 @@ <FuncZip key={item.uuid} show={item.show || 'actionList'} - disabled={lock || false} + disabled={false} BID={BID} btn={item} setting={setting} + selectedData={selectedData} + /> + ) + } else if (item.funcType === 'addline' || item.funcType === 'delline') { + return ( + <EditLine + key={item.uuid} + disabled={false} + btn={item} selectedData={selectedData} /> ) @@ -234,12 +204,12 @@ render() { const { setting } = this.props - const { actions, mores, listId } = this.state + const { actions, mores } = this.state if (setting.actionfixed === 'true') { return ( <Affix offsetTop={48}> - <div className="button-list toolbar-button" id={listId}> + <div className="button-list toolbar-button"> {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> @@ -249,7 +219,7 @@ ) } else { return ( - <div className="button-list toolbar-button" id={listId}> + <div className="button-list toolbar-button"> {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/tabviews/zshare/actionList/index.scss b/src/tabviews/zshare/actionList/index.scss index c811b15..42c8bcc 100644 --- a/src/tabviews/zshare/actionList/index.scss +++ b/src/tabviews/zshare/actionList/index.scss @@ -1,11 +1,13 @@ .button-list.toolbar-button { position: relative; - padding: 15px 0px 5px; + padding: 15px 0px 0px; background: #ffffff; + min-height: 55px; + button { min-width: 65px; margin-right: 15px; - margin-bottom: 10px; + margin-bottom: 10px!important; overflow: hidden; min-height: 28px; height: auto; @@ -26,13 +28,7 @@ display: none; } } -.button-list.toolbar-button.double-line { - padding-top: 10px; - padding-bottom: 0px; - button { - margin-bottom: 10px!important; - } -} + .mk-button-more { display: inline-block; height: 28px; diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 33f3232..94b50d8 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -69,7 +69,7 @@ if (data.length > 0) { data.forEach(item => { let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' - if (btn.controlVals.includes(s)) { + if (btn.controlVals.includes(s) || item.$lock) { disabled = true } }) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 52da922..3cab100 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -144,7 +144,7 @@ if (data.length > 0) { data.forEach(item => { let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' - if (btn.controlVals.includes(s)) { + if (btn.controlVals.includes(s) || item.$lock) { disabled = true } }) @@ -601,7 +601,7 @@ param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -964,7 +964,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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),@bid nvarchar(50)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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),@mk_deleted int,@bid nvarchar(50)${_declarefields} ` let userName = sessionStorage.getItem('User_Name') || '' @@ -987,7 +987,7 @@ // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 _sql += ` /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */ - select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @bid='${BID}', @BillCode='', @ModularDetailCode='' + select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @mk_deleted=1, @bid='${BID}', @BillCode='', @ModularDetailCode='' ` // 琛ㄥ崟鍙橀噺璧嬪�� @@ -2683,6 +2683,16 @@ _item.type = 'text' } else if (_item.type === 'date') { _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' + } else if (_item.type === 'switch' || _item.type === 'check') { + if (_readin) { + _item.value = _item.value === item.openVal ? item.openVal : item.closeVal + } else { + if (item.initval === true) { + _item.value = item.openVal + } else { + _item.value = item.closeVal + } + } } else if (_item.type === 'rate') { let count = item.rateCount || 5 _item.value = parseInt(_item.value) diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index c07cf91..247d5bb 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -84,7 +84,7 @@ if (data.length > 0) { data.forEach(item => { let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' - if (btn.controlVals.includes(s)) { + if (btn.controlVals.includes(s) || item.$lock) { disabled = true } }) diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 41bcd2f..367bec1 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -94,7 +94,7 @@ if (data.length > 0) { data.forEach(item => { let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' - if (btn.controlVals.includes(s)) { + if (btn.controlVals.includes(s) || item.$lock) { disabled = true } }) @@ -2189,6 +2189,16 @@ _item.type = 'text' } else if (_item.type === 'date') { _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' + } else if (_item.type === 'switch' || _item.type === 'check') { + if (_readin) { + _item.value = _item.value === item.openVal ? item.openVal : item.closeVal + } else { + if (item.initval === true) { + _item.value = item.openVal + } else { + _item.value = item.closeVal + } + } } else if (_item.type === 'rate') { let count = item.rateCount || 5 _item.value = parseInt(_item.value) diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index fbdfe15..9a7662a 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -69,7 +69,7 @@ if (data.length > 0) { data.forEach(item => { let s = item[btn.controlField] !== undefined ? item[btn.controlField] + '' : '' - if (btn.controlVals.includes(s)) { + if (btn.controlVals.includes(s) || item.$lock) { disabled = true } }) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 4a96938..f6f2a1c 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -19,6 +19,7 @@ const MKCheckCard = asyncComponent(() => import('./mkCheckCard')) const MKSwitch = asyncComponent(() => import('./mkSwitch')) +const MKCheck = asyncComponent(() => import('./mkCheck')) const MKCheckbox = asyncComponent(() => import('./mkCheckbox')) const MKRadio = asyncComponent(() => import('./mkRadio')) const MKDatePicker = asyncComponent(() => import('./mkDatePicker')) @@ -124,11 +125,13 @@ item.precision = 'second' } - if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color', 'vercode'].includes(item.type)) return false + if (!item.field || !['text', 'number', 'switch', 'check', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color', 'vercode'].includes(item.type)) return false if (/^\s+$/.test(item.label)) { item.style = item.style || {} - item.style.color = 'transparent' + item.style.opacity = 0 + item.style.width = 1 + item.style.display = 'inline-block' } // 鏁版嵁鑷姩濉厖 @@ -218,7 +221,7 @@ if (newval === '$empty' && item.initval) { newval = moment().subtract(item.initval, 'month').format('YYYY-MM') } - } else if (item.type === 'switch') { // 寮�鍏冲彧鎺ユ敹鍥哄畾鍊� + } else if (item.type === 'switch' || item.type === 'check') { // 寮�鍏冲嬀閫夋鍙帴鏀跺浐瀹氬�� if (newval !== '$empty' && (newval === item.closeVal || newval === item.openVal)) { } else if (item.initval === true) { @@ -995,6 +998,8 @@ content = (<MKCheckCard config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>) } else if (item.type === 'switch') { content = (<MKSwitch config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>) + } else if (item.type === 'check') { + content = (<MKCheck config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>) } else if (item.type === 'checkbox') { content = (<MKCheckbox config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) } else if (item.type === 'radio') { diff --git a/src/tabviews/zshare/mutilform/mkCheck/index.jsx b/src/tabviews/zshare/mutilform/mkCheck/index.jsx new file mode 100644 index 0000000..aea3f25 --- /dev/null +++ b/src/tabviews/zshare/mutilform/mkCheck/index.jsx @@ -0,0 +1,41 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Checkbox } from 'antd' + +class MKCheck extends Component { + static propTpyes = { + config: PropTypes.object, + onChange: PropTypes.func + } + + state = { + defaultChecked: this.props.config.initval === this.props.config.openVal + } + + onChange = (e) => { + const { config } = this.props + + if (e.target.checked) { + this.props.onChange(config.openVal) + } else { + this.props.onChange(config.closeVal) + } + } + + componentWillUnmount () { + this.setState = () => { + return + } + } + + render() { + const { config } = this.props + const { defaultChecked } = this.state + + return ( + <Checkbox disabled={config.readonly} defaultChecked={defaultChecked} onChange={this.onChange}>{config.checkTip}</Checkbox> + ) + } +} + +export default MKCheck \ No newline at end of file diff --git a/src/tabviews/zshare/mutilform/mkCheck/index.scss b/src/tabviews/zshare/mutilform/mkCheck/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/tabviews/zshare/mutilform/mkCheck/index.scss diff --git a/src/tabviews/zshare/normalTable/index.scss b/src/tabviews/zshare/normalTable/index.scss index 931fee4..75c4770 100644 --- a/src/tabviews/zshare/normalTable/index.scss +++ b/src/tabviews/zshare/normalTable/index.scss @@ -232,11 +232,6 @@ display: block; } } - // table tbody { - // tr:nth-child(even) { - // background: #f9f9f9; - // } - // } } .image-scale-modal { width: 70vw; diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 8f1b7d4..7bef081 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -16,6 +16,8 @@ const MutilForm = asyncSpinComponent(() => import('./advanceform')) const MKCheckCard = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheckCard')) +const MKCheck = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkCheck')) +const MKSwitch = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkSwitch')) const MKSelect = asyncComponent(() => import('./mkSelect')) const DateGroup = asyncComponent(() => import('./dategroup')) const MKDatePicker = asyncComponent(() => import('./mkDatePicker')) @@ -532,6 +534,10 @@ content = <DateGroup position={index} config={item} onChange={(val, type) => this.dateGroupChange(val, type, item)} /> } else if (item.type === 'checkcard') { content = <MKCheckCard config={item} onChange={(val) => this.cardChange(val, item)} /> + } else if (item.type === 'check') { + content = <MKCheck config={item} onChange={(val) => this.recordChange(val, false, item)} /> + } else if (item.type === 'switch') { + content = <MKSwitch config={item} onChange={(val) => this.recordChange(val, false, item)} /> } if (content) { @@ -836,7 +842,7 @@ return ( <> - <Form {...formItemLayout} className={`top-search mk-float-${setting.float}`} style={setting.style}> + <Form {...formItemLayout} className={`mk-search-wrap mk-float-${setting.float}`} style={setting.style}> <Row gutter={24}>{this.getFields()}</Row> {advanceValues.length && (setting.advanceType !== 'pulldown' || (setting.advanceType === 'pulldown' && !visible)) ? <Row gutter={24}> <div className="advanced-list"> diff --git a/src/tabviews/zshare/topSearch/index.scss b/src/tabviews/zshare/topSearch/index.scss index 1d7e1bc..6ac744d 100644 --- a/src/tabviews/zshare/topSearch/index.scss +++ b/src/tabviews/zshare/topSearch/index.scss @@ -1,4 +1,4 @@ -.top-search { +.mk-search-wrap { background: #ffffff; .mk-search-col { @@ -114,7 +114,7 @@ margin-top: 3px; } } -.top-search.mk-float-right { +.mk-search-wrap.mk-float-right { >.ant-row { text-align: right; } diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index 2bb9117..34f957a 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -8,7 +8,6 @@ import moment from 'moment' import Api from '@/api' -import MKEmitter from '@/utils/events.js' import Utils from '@/utils/utils.js' import asyncComponent from '@/utils/asyncComponent' @@ -399,8 +398,6 @@ // } resolve() }).then(() => { - let reload = _config.isAdd - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type delete _config.isAdd @@ -481,8 +478,6 @@ originMenu: fromJS(_config).toJS(), menuloading: false, menucloseloading: false - }, () => { - reload && MKEmitter.emit('revert') }) this.props.reloadmenu() diff --git a/src/templates/calendarconfig/source.jsx b/src/templates/calendarconfig/source.jsx index 8e500d9..9638d63 100644 --- a/src/templates/calendarconfig/source.jsx +++ b/src/templates/calendarconfig/source.jsx @@ -31,42 +31,7 @@ remarkfield: '', refresh: 'false' }, - search: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'text', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'like', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'select', - resourceType: '0', - options: [], - orderType: 'asc', - match: '=', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'date', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'greater', - } - ] + search: [] } searchItems = [ diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 62ac181..e55643e 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -9,7 +9,6 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import MKEmitter from '@/utils/events.js' import { updateCommonTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' @@ -27,7 +26,7 @@ const Versions = asyncComponent(() => import('@/menu/versions')) const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) -const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +// const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const UpdateTable = asyncComponent(() => import('./updatetable')) const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) @@ -357,7 +356,6 @@ } let _LongParam = '' - let reload = _config.isAdd // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type @@ -561,8 +559,6 @@ config: _config, openEdition: response.open_edition || '', originMenu: fromJS(_config).toJS() - }, () => { - reload && MKEmitter.emit('revert') }) localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' @@ -1202,7 +1198,7 @@ <div> <Unattended config={config} updateConfig={this.updateconfig}/> <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/> - <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> + {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={this.state.config} refresh={this.editConfig}/> <UpdateTable config={config}/> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> diff --git a/src/templates/comtableconfig/source.jsx b/src/templates/comtableconfig/source.jsx index 1b7d5de..f21ac4b 100644 --- a/src/templates/comtableconfig/source.jsx +++ b/src/templates/comtableconfig/source.jsx @@ -24,125 +24,125 @@ }, tables: [], search: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'text', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'like', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'select', - resourceType: '0', - options: [], - orderType: 'asc', - match: '=', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'date', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'greater', - } + // { + // origin: true, + // uuid: Utils.getuuid(), + // label: 'label', + // field: '', + // initval: '', + // type: 'text', + // resourceType: '0', + // options: [], + // orderType: 'asc', + // match: 'like', + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // label: 'label', + // field: '', + // initval: '', + // type: 'select', + // resourceType: '0', + // options: [], + // orderType: 'asc', + // match: '=', + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // label: 'label', + // field: '', + // initval: '', + // type: 'date', + // resourceType: '0', + // options: [], + // orderType: 'asc', + // match: 'greater', + // } ], action: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'add', - intertype: 'system', - Ot: 'notRequired', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'pop', - icon: 'plus', - class: 'green', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'update', - intertype: 'system', - Ot: 'requiredSgl', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'pop', - icon: 'form', - class: 'purple', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'delete', - intertype: 'system', - Ot: 'required', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'prompt', - icon: 'delete', - class: 'red', - verify: null - } + // { + // origin: true, + // uuid: Utils.getuuid(), + // label: 'add', + // intertype: 'system', + // Ot: 'notRequired', + // position: 'toolbar', + // execSuccess: 'grid', + // execError: 'never', + // OpenType: 'pop', + // icon: 'plus', + // class: 'green', + // verify: null + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // label: 'update', + // intertype: 'system', + // Ot: 'requiredSgl', + // position: 'toolbar', + // execSuccess: 'grid', + // execError: 'never', + // OpenType: 'pop', + // icon: 'form', + // class: 'purple', + // verify: null + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // label: 'delete', + // intertype: 'system', + // Ot: 'required', + // position: 'toolbar', + // execSuccess: 'grid', + // execError: 'never', + // OpenType: 'prompt', + // icon: 'delete', + // class: 'red', + // verify: null + // } ], columns: [ - { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - } + // { + // origin: true, + // uuid: Utils.getuuid(), + // Align: 'left', + // label: 'label', + // field: '', + // Hide: 'false', + // IsSort: 'true', + // type: 'text', + // Width: 120 + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // Align: 'left', + // label: 'label', + // field: '', + // Hide: 'false', + // IsSort: 'true', + // type: 'text', + // Width: 120 + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // Align: 'left', + // label: 'label', + // field: '', + // Hide: 'false', + // IsSort: 'true', + // type: 'text', + // Width: 120 + // }, { + // origin: true, + // uuid: Utils.getuuid(), + // Align: 'left', + // label: 'label', + // field: '', + // Hide: 'false', + // IsSort: 'true', + // type: 'text', + // Width: 120 + // } ], gridBtn: { display: false, diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx index 441de5b..063f651 100644 --- a/src/templates/modalconfig/dragelement/card.jsx +++ b/src/templates/modalconfig/dragelement/card.jsx @@ -129,6 +129,8 @@ <Checkbox value="C">C</Checkbox> <Checkbox value="D">D</Checkbox> </Checkbox.Group>) + } else if (card.type === 'check') { + formItem = <Checkbox checked={card.initval}>{card.checkTip || ''}</Checkbox> } else if (card.type === 'hint') { formItem = <div style={{marginTop: '8px', color: 'rgba(0, 0, 0, 0.85)', lineHeight: '1.5', ...card.style}}>{card.message}</div> } else if (card.type === 'formula') { @@ -146,7 +148,7 @@ formItem = <CheckCard config={card} /> } - let _label = <span className="mk-form-label" style={card.style}>{card.label}</span> + let _label = <span className={'mk-form-label ' + (/^\s+$/.test(card.label) ? 'no-colon' : '')} style={card.style}>{card.label}</span> if (card.tooltip) { _label = <><QuestionCircleOutlined className="mk-form-tip" /><span className="mk-form-label" style={card.style}>{card.label}</span></> diff --git a/src/templates/modalconfig/dragelement/index.scss b/src/templates/modalconfig/dragelement/index.scss index 1c12c6c..c99318b 100644 --- a/src/templates/modalconfig/dragelement/index.scss +++ b/src/templates/modalconfig/dragelement/index.scss @@ -38,12 +38,17 @@ color: #1890ff; } } - .mk-form-label::after { + .mk-form-label:after { content: ':'; position: relative; top: -0.5px; margin: 0 8px 0 2px; text-decoration: none; + } + .mk-form-label.no-colon { + opacity: 0; + width: 1px; + display: inline-block; } .ant-form-item-no-colon::after { content: none!important; @@ -135,12 +140,12 @@ } .modal-fields-row.up_down { .ant-form-item { - display: block; + display: block!important; .ant-form-item-label { width: 100%!important; text-align: left; - height: 24px; - line-height: 28px; + height: 24px!important; + line-height: 28px!important; } .ant-form-item-control-wrapper { width: 100%!important; diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 7d746e8..5291743 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -268,7 +268,7 @@ }) } - if (item.type === 'switch') { + if (item.type === 'switch' || item.type === 'check') { _linksupFields.push({ field: item.field, label: item.label diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 06d1cf2..b871c62 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -56,15 +56,15 @@ componentDidMount () { this.getBillPrintTemp() - MKEmitter.addListener('revert', this.revert) + // MKEmitter.addListener('revert', this.revert) MKEmitter.addListener('pasteButton', this.pasteButton) } - revert = () => { - this.setState({ - actionlist: fromJS(this.props.config.action).toJS() - }) - } + // revert = () => { + // this.setState({ + // actionlist: fromJS(this.props.config.action).toJS() + // }) + // } pasteButton = (MenuId, btn) => { const { config } = this.props @@ -847,7 +847,7 @@ this.setState = () => { return } - MKEmitter.removeListener('revert', this.revert) + // MKEmitter.removeListener('revert', this.revert) MKEmitter.removeListener('pasteButton', this.pasteButton) } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 249c732..4580eb7 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -122,7 +122,7 @@ { title: '鎶ラ敊缂栫爜', dataIndex: 'errorCode', - width: '12%', + width: '10%', editable: true, inputType: 'select', options: [ @@ -135,13 +135,24 @@ { title: '楠岃瘉绫诲瀷', dataIndex: 'verifyType', - width: '12%', - render: (text, record) => record.verifyType === 'logic' ? '閫昏緫楠岃瘉' : '鐗╃悊楠岃瘉', + width: '14%', + render: (text, record) => { + let names = { + physical: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級', + logic: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級', + physical_temp: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級', + logic_temp: '閫昏緫楠岃瘉锛堜粎涓存椂琛級', + } + + return names[text] || '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' + }, inputType: 'select', editable: true, options: [ - { value: 'physical', text: '鐗╃悊楠岃瘉' }, - { value: 'logic', text: '閫昏緫楠岃瘉' } + { value: 'physical', text: '鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級' }, + { value: 'logic', text: '閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級' }, + { value: 'physical_temp', text: '鐗╃悊楠岃瘉锛堜粎涓存椂琛級' }, + { value: 'logic_temp', text: '閫昏緫楠岃瘉锛堜粎涓存椂琛級' } ] }, { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/uniqueform/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/uniqueform/index.jsx index a6e9bf2..365f6b0 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/uniqueform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/uniqueform/index.jsx @@ -108,8 +108,10 @@ ] })( <Select> - <Select.Option value="physical"> 鐗╃悊楠岃瘉 </Select.Option> - <Select.Option value="logic"> 閫昏緫楠岃瘉 </Select.Option> + <Select.Option value="physical"> 鐗╃悊楠岃瘉锛堝叏閲忛獙璇侊級 </Select.Option> + <Select.Option value="logic"> 閫昏緫楠岃瘉锛堝叏閲忛獙璇侊級 </Select.Option> + <Select.Option value="physical_temp"> 鐗╃悊楠岃瘉锛堜粎涓存椂琛級 </Select.Option> + <Select.Option value="logic_temp"> 閫昏緫楠岃瘉锛堜粎涓存椂琛級 </Select.Option> </Select> )} </Form.Item> diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index 71179be..e8172e2 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -470,18 +470,18 @@ }) } - revert = () => { - this.setState({ - columnlist: fromJS(this.props.config.columns).toJS() - }) - } + // revert = () => { + // this.setState({ + // columnlist: fromJS(this.props.config.columns).toJS() + // }) + // } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } componentDidMount () { - MKEmitter.addListener('revert', this.revert) + // MKEmitter.addListener('revert', this.revert) MKEmitter.addListener('plusColumns', this.plusColumns) } @@ -492,7 +492,7 @@ this.setState = () => { return } - MKEmitter.removeListener('revert', this.revert) + // MKEmitter.removeListener('revert', this.revert) MKEmitter.removeListener('plusColumns', this.plusColumns) } diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index 4d8d96f..c493ccd 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -197,7 +197,13 @@ required: 'true' } - if (item.type === 'text' && item.length >= 256) { + if (/^icon|images?$/ig.test(item.field)) { + newcard.type = 'fileupload' + newcard.fileType = 'picture-card' + newcard.fieldlength = item.length || 512 + newcard.maxSize = 1 + newcard.maxfile = 1 + } else if (item.type === 'text' && item.length >= 256) { newcard.type = 'textarea' newcard.required = 'false' newcard.fieldlength = item.length diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index 2951024..6d282da 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -44,12 +44,12 @@ componentDidMount () { MKEmitter.addListener('plusSearch', this.plusSearch) - MKEmitter.addListener('revert', this.revert) + // MKEmitter.addListener('revert', this.revert) } - revert = () => { - this.setState({searchlist: fromJS(this.props.config.search).toJS()}) - } + // revert = () => { + // this.setState({searchlist: fromJS(this.props.config.search).toJS()}) + // } plusSearch = (MenuId, item, type) => { const { config } = this.props @@ -321,7 +321,7 @@ this.setState = () => { return } - MKEmitter.removeListener('revert', this.revert) + // MKEmitter.removeListener('revert', this.revert) MKEmitter.removeListener('plusSearch', this.plusSearch) } diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 6588635..9cb4ffc 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -104,6 +104,8 @@ datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow', 'query', 'labelwidth'], + switch: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'openVal', 'closeVal', 'openText', 'closeText', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], + check: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'openVal', 'closeVal', 'checkTip', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query', 'labelwidth'] } @@ -226,22 +228,24 @@ } if (type === 'text') { - reOptions.match = matchReg.text + reOptions.match = matchReg.class1 } else if (type === 'multiselect') { - reOptions.match = matchReg.multiselect + reOptions.match = matchReg.class3 } else if (type === 'select' || type === 'link') { - reOptions.match = matchReg.select + reOptions.match = matchReg.class1 + } else if (type === 'switch' || type === 'check') { + reOptions.match = matchReg.class2 } else if (type === 'date') { - reOptions.match = matchReg.date + reOptions.match = matchReg.class4 } else if (type === 'datemonth') { - reOptions.match = matchReg.datemonth + reOptions.match = matchReg.class5 } else if (type === 'dateweek' || type === 'daterange' || type === 'range') { - reOptions.match = matchReg.daterange + reOptions.match = matchReg.class5 } else if (type === 'checkcard') { if (this.record.multiple === 'false') { - reOptions.match = matchReg.select + reOptions.match = matchReg.class1 } else if (this.record.multiple === 'true') { - reOptions.match = matchReg.multiselect + reOptions.match = matchReg.class3 } } @@ -738,6 +742,8 @@ }) return } + } else if (values.type === 'switch' || values.type === 'check') { + values.initval = values.initval === values.openVal ? values.openVal : values.closeVal } ['linkField', 'valueField', 'valueText', 'orderBy'].forEach(item => { diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index c47ca6d..524b4f1 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -9,7 +9,6 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import MKEmitter from '@/utils/events.js' import { updateSubTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' @@ -26,7 +25,7 @@ const { confirm } = Modal const Versions = asyncComponent(() => import('@/menu/versions')) -const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +// const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) @@ -342,7 +341,6 @@ } let _LongParam = '' - let reload = _config.isAdd // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type @@ -502,7 +500,6 @@ config: _config, originConfig: fromJS(_config).toJS() }, () => { - reload && MKEmitter.emit('revert') this.setState({ menuloading: false, menucloseloading: false @@ -998,7 +995,7 @@ } bordered={false} extra={ <div> <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> - <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> + {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */} <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> diff --git a/src/templates/subtableconfig/source.jsx b/src/templates/subtableconfig/source.jsx index ef337b5..58b2581 100644 --- a/src/templates/subtableconfig/source.jsx +++ b/src/templates/subtableconfig/source.jsx @@ -22,127 +22,9 @@ outerFunc: '' }, tables: [], - search: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'text', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'like', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'select', - resourceType: '0', - options: [], - orderType: 'asc', - match: '=', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'date', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'greater', - } - ], - action: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'add', - intertype: 'system', - Ot: 'notRequired', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'pop', - icon: 'plus', - class: 'green', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'update', - intertype: 'system', - Ot: 'requiredSgl', - position: 'grid', - execSuccess: 'grid', - execError: 'never', - OpenType: 'pop', - icon: 'form', - class: 'purple', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'delete', - intertype: 'system', - Ot: 'required', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'prompt', - icon: 'delete', - class: 'red', - verify: null - } - ], - columns: [ - { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - } - ], + search: [], + action: [], + columns: [], gridBtn: { display: false, Align: 'center', diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 4c8a091..1fc2482 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -355,6 +355,12 @@ }, { value: 'group', text: '鏃ユ湡锛堢粍鍚堬級' + }, { + value: 'switch', + text: '寮�鍏�' + }, { + value: 'check', + text: '鍕鹃�夋' }] } @@ -834,6 +840,42 @@ value: 'custom', text: '鑷畾涔�' }] + }, + { + type: 'text', + key: 'openVal', + label: '寮�鍚��', + initVal: card.openVal || '', + required: false + }, + { + type: 'text', + key: 'closeVal', + label: '鍏抽棴鍊�', + initVal: card.closeVal || '', + required: false + }, + { + type: 'text', + key: 'openText', + label: '寮�鍚彁绀�', + initVal: card.openText || '', + required: false + }, + { + type: 'text', + key: 'closeText', + label: '鍏抽棴鎻愮ず', + initVal: card.closeText || '', + required: false + }, + { + type: 'text', + key: 'checkTip', + label: '鎻愮ず', + initVal: card.checkTip || '', + tooltip: '鍕鹃�夋鍚庣殑鎻愮ず鏂囧瓧', + required: false }, { type: 'color', @@ -2468,6 +2510,9 @@ value: 'switch', text: '寮�鍏�' }, { + value: 'check', + text: '鍕鹃�夋' + }, { value: 'checkbox', text: '澶氶�夋' }, { @@ -2542,6 +2587,9 @@ value: 'switch', text: '寮�鍏�' }, { + value: 'check', + text: '鍕鹃�夋' + }, { value: 'checkbox', text: '澶氶�夋' }, { @@ -2610,7 +2658,7 @@ } let initval = card.initval || '' - if (card.type === 'switch') { + if (card.type === 'switch' || card.type === 'check') { initval = card.initval === true } else if (card.type === 'number') { initval = card.initval || 0 @@ -2690,6 +2738,14 @@ required: false }, { + type: 'text', + key: 'checkTip', + label: '鎻愮ず', + initVal: card.checkTip || '', + tooltip: '鍕鹃�夋鍚庣殑鎻愮ず鏂囧瓧', + required: false + }, + { type: 'radio', key: 'resourceType', label: '閫夐」鏉ユ簮', diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 05f4698..4c6d8f7 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -29,6 +29,7 @@ link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'place', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'], + check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'place', 'marginTop', 'marginBottom'], datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'], @@ -236,7 +237,7 @@ } else if (['date', 'datemonth', 'datetime'].includes(type)) { reOptions.initval = dateOptions[type] reTypes.initval = 'select' - } else if (type === 'switch') { + } else if (type === 'switch' || type === 'check') { reOptions.initval = [ {value: true, text: '寮�'}, {value: false, text: '鍏�'} @@ -370,7 +371,7 @@ if (value === 'number' || value === 'rate') { this.record.initval = 0 _fieldval.initval = 0 - } else if (value === 'switch') { + } else if (value === 'switch' || value === 'check') { this.record.initval = false _fieldval.initval = false } diff --git a/src/templates/zshare/pasteform/index.jsx b/src/templates/zshare/pasteform/index.jsx index f44b6bb..3067ef0 100644 --- a/src/templates/zshare/pasteform/index.jsx +++ b/src/templates/zshare/pasteform/index.jsx @@ -66,7 +66,7 @@ let list = values.config.match(/[a-zA-Z0-9_]+\s+(nvarchar\(\d+\)|Decimal\(18,\d+\)|Int)/ig) list.forEach(item => { - _config.data.push({ + _config.data.unshift({ datatype: item.split(/\s+/)[1], field: item.split(/\s+/)[0], label: item.split(/\s+/)[0], diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx index 94bdc6e..ce0b0fd 100644 --- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx +++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx @@ -247,7 +247,7 @@ <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address, mk_deleted</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞跺湪鍗曞彿鐢熸垚鎴栧垱寤哄嚟璇佹椂浣跨敤銆�'}><span style={{color: '#13c2c2'}}>BillCode, BVoucher, FIBVoucherDate, FiYear, ModularDetailCode</span></Tooltip> {usefulfields ? <span>, {usefulfields}</span> : ''} </Form.Item> diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx index f7194b4..276694e 100644 --- a/src/templates/zshare/verifycard/customform/index.jsx +++ b/src/templates/zshare/verifycard/customform/index.jsx @@ -197,7 +197,7 @@ <Col span={21} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id</span></Tooltip>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address, mk_deleted</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞跺湪鍗曞彿鐢熸垚鎴栧垱寤哄嚟璇佹椂浣跨敤銆�'}><span style={{color: '#13c2c2'}}>BillCode, BVoucher, FIBVoucherDate, FiYear, ModularDetailCode</span></Tooltip> {usefulfields ? <span>, {usefulfields}</span> : ''} </Form.Item> diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 1244f5f..fd2f022 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -293,7 +293,7 @@ {!_type ? <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address, mk_deleted</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞跺湪鍗曞彿鐢熸垚鎴栧垱寤哄嚟璇佹椂浣跨敤銆�'}><span style={{color: '#13c2c2'}}>BillCode, BVoucher, FIBVoucherDate, FiYear, ModularDetailCode</span></Tooltip> {usefulfields ? <span>, {usefulfields}</span> : ''} </Form.Item> diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 12f861b..e688eb0 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -668,9 +668,9 @@ resolve(_fields) } }).then(_fields => { - let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid'] - let _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)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)'] - let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\''] + let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'tbid', 'mk_deleted'] + let _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)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)', '@tbid nvarchar(50)', '@mk_deleted int'] + let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\'', '@mk_deleted=1'] let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) let hasBid = false @@ -950,7 +950,7 @@ if (_verify.voucher && _verify.voucher.enabled) { _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear' } - _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@${_voucher} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` + _defaultsql = `update ${card.sql} set deleted=@mk_deleted,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@${_voucher} where ${_primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID from dbo.SplitComma(@ID@))'};` } else if (card.sqlType === 'delete') { let _msg = '' if (columns && columns.length > 0 && card.Ot !== 'notRequired') { diff --git a/src/utils/option.js b/src/utils/option.js index 7eb1b1d..2d60bbf 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -188,7 +188,7 @@ // 鍖归厤瑙勫垯 export const matchReg = { - text: [{ + class1: [{ value: 'like', text: 'like' }, { @@ -210,20 +210,7 @@ value: '<=', text: '<=' }], - multiselect: [{ - value: 'like', - text: 'like' - }, { - value: 'not like', - text: 'not like' - }], - select: [{ - value: 'like', - text: 'like' - }, { - value: 'not like', - text: 'not like' - }, { + class2: [{ value: '=', text: '=' }, { @@ -239,7 +226,14 @@ value: '<=', text: '<=' }], - date: [{ + class3: [{ + value: 'like', + text: 'like' + }, { + value: 'not like', + text: 'not like' + }], + class4: [{ value: '>=', text: '>=' }, { @@ -249,11 +243,7 @@ value: '=', text: '=' }], - datemonth: [{ - value: 'between', - text: 'between' - }], - daterange: [{ + class5: [{ value: 'between', text: 'between' }] diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 94e9705..9763056 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1399,12 +1399,12 @@ 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}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + 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}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣}) + 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}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣}) + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣}) } if (doubleClick === cell.uuid) { @@ -1414,16 +1414,16 @@ } else if (col.type === 'custom') { col.elements.forEach(cell => { if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { - card.errors.push({ level: 1, detail: `鏄剧ず鍒椻��${col.label}鈥濅腑鍔ㄦ�佸瓧娈碘��${cell.field}鈥濇棤鏁坄}) + errors.push({ level: 1, detail: `鏄剧ず鍒椻��${col.label}鈥濅腑鍔ㄦ�佸瓧娈碘��${cell.field}鈥濇棤鏁坄}) } }) } else if (col.field && !columns.includes(col.field)) { - card.errors.push({ level: 1, detail: `鏄剧ず鍒椻��${col.label}鈥濅腑瀛楁鈥�${col.field}鈥濇棤鏁坄}) + errors.push({ level: 1, detail: `鏄剧ず鍒椻��${col.label}鈥濅腑瀛楁鈥�${col.field}鈥濇棤鏁坄}) } }) if (doubleClick) { - card.errors.push({ level: 1, detail: `缁戝畾鐨勫弻鍑绘寜閽凡鍒犻櫎`}) + errors.push({ level: 1, detail: `缁戝畾鐨勫弻鍑绘寜閽凡鍒犻櫎`}) } } diff --git a/src/utils/utils.js b/src/utils/utils.js index 975b726..58e7ba8 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1070,14 +1070,14 @@ let _uniquesql = '' if (btn.uniques && btn.uniques.length > 0) { btn.uniques.forEach(unique => { - if (unique.status === 'false') return + if (unique.status === 'false' || !unique.verifyType) return let _fields = unique.field.split(',') let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) let _afields = _fields.map(_field => `a.${_field}`) _fields_ = _fields_.join(' and ') - if (unique.verifyType !== 'physical') { + if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { _fields_ += ' and b.deleted=0' } @@ -1092,14 +1092,14 @@ goto aaa end - Set @tbid='' + ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' Select top 1 @tbid=${_afields.join('+\' \'+')} from @${sheet} a Inner join ${sheet} b on ${_fields_} If @tbid!='' Begin select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�' goto aaa - end + end` : ''} ` }) } @@ -1291,14 +1291,14 @@ let _uniquesql = '' if (btn.uniques && btn.uniques.length > 0) { btn.uniques.forEach(unique => { - if (unique.status === 'false') return + if (unique.status === 'false' || !unique.verifyType) return let _fields = unique.field.split(',') let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) let _afields = _fields.map(_field => `a.${_field}`) _fields_ = _fields_.join(' and ') - if (unique.verifyType !== 'physical') { + if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { _fields_ += ' and b.deleted=0' } @@ -1313,14 +1313,14 @@ goto aaa end - Set @tbid='' + ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' Select top 1 @tbid=${_afields.join('+\' \'+')} from @${sheet} a Inner join ${sheet} b on ${_fields_} If @tbid!='' Begin select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�' goto aaa - end + end` : ''} ` }) } @@ -1582,7 +1582,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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),@bid nvarchar(50)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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),@mk_deleted int,@bid nvarchar(50)${_declarefields} ` let userName = sessionStorage.getItem('User_Name') || '' @@ -1605,7 +1605,7 @@ // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 _sql += ` /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */ - select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @bid='${BID}', @BillCode='', @ModularDetailCode='' + select @BVoucher='',@FIBVoucherDate='',@FiYear='',@ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @mk_deleted=1, @bid='${BID}', @BillCode='', @ModularDetailCode='' ` // 琛ㄥ崟鍙橀噺璧嬪�� @@ -2078,7 +2078,7 @@ _sql += ` /* 榛樿sql */ - update ${btn.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@ where ${primaryKey}${_ID};` + update ${btn.sql} set deleted=@mk_deleted,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@ where ${primaryKey}${_ID};` } else if (_actionType === 'delete') { // 鐗╃悊鍒犻櫎 let _msg = '' -- Gitblit v1.8.0