From bd6521dcc02d1b224016c4df9e36388668989d0c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 10 七月 2023 00:58:17 +0800 Subject: [PATCH] 2023-07-10 --- src/menu/components/form/formaction/formconfig.jsx | 15 ++ src/tabviews/custom/components/form/tab-form/index.jsx | 6 + src/tabviews/custom/popview/index.jsx | 1 src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/tabviews/custom/components/calendar/board/index.jsx | 118 ++++++++++++++++++++++- src/tabviews/custom/components/calendar/board/index.scss | 55 ++++++++++ src/tabviews/custom/components/calendar/index.jsx | 20 +++ src/tabviews/custom/components/form/step-form/index.jsx | 6 + src/tabviews/custom/components/form/simple-form/index.jsx | 6 + src/tabviews/zshare/actionList/popupbutton/index.jsx | 4 src/menu/components/share/actioncomponent/formconfig.jsx | 30 ++++++ src/tabviews/zshare/actionList/popupbutton/index.scss | 15 ++ 12 files changed, 259 insertions(+), 19 deletions(-) diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index ace6550..ca29b86 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -6,6 +6,7 @@ export function getActionForm (card, functip, tableName, usefulFields, modules, anchors) { const appType = sessionStorage.getItem('appType') + let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview let _type = '鎻愪氦' if (card.type === 'prev') { _type = '涓婁竴姝�' @@ -40,6 +41,18 @@ } else { menulist = [] } + } + + let refresh = [] + if (!appType && viewType === 'popview') { // 寮圭獥鏍囩 + refresh.push({ + value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩 + text: '鍏抽棴寮圭獥' + }) + refresh.push({ + value: 'popclose', // 鎵ц寮圭獥鍏抽棴鏃剁殑鍒锋柊 + text: '鍒锋柊婧愮粍浠�' + }) } return [ @@ -310,7 +323,7 @@ }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' - }] + }, ...refresh] }, { type: (appType === 'pc' || appType === 'mob') ? 'select' : 'cascader', diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 5a87254..608130d 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -388,6 +388,8 @@ shows.push('placement') } else if (this.record.display === 'drawer') { shows.push('placement') + } else if (this.record.display === 'modal') { + shows.push('popshow') } if (this.record.popClose === 'grid') { shows.push('resetPageIndex') diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 30d6719..a3a4634 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -961,6 +961,21 @@ }, { type: 'radio', + key: 'popshow', + label: '寮圭獥灞曠ず', + initVal: card.popshow || 'default', + tooltip: '灏忕獥鍙e睍绀哄皢闅愯棌鏍囬鍙婂簳閮ㄦ寜閽��', + required: false, + options: [{ + value: 'default', + text: '榛樿' + }, { + value: 'miniview', + text: '灏忕獥鍙�' + }] + }, + { + type: 'radio', key: 'maskStyle', label: '钂欏眰鏍峰紡', initVal: card.maskStyle || 'default', @@ -1939,6 +1954,21 @@ }] }, { + type: 'radio', + key: 'popshow', + label: '寮圭獥灞曠ず', + initVal: card.popshow || 'default', + tooltip: '灏忕獥鍙e睍绀哄皢闅愯棌鏍囬鍙婂簳閮ㄦ寜閽��', + required: false, + options: [{ + value: 'default', + text: '榛樿' + }, { + value: 'miniview', + text: '灏忕獥鍙�' + }] + }, + { type: 'text', key: 'preFunc', label: '鍓嶇疆鍑芥暟', diff --git a/src/tabviews/custom/components/calendar/board/index.jsx b/src/tabviews/custom/components/calendar/board/index.jsx index 44c208d..77727e6 100644 --- a/src/tabviews/custom/components/calendar/board/index.jsx +++ b/src/tabviews/custom/components/calendar/board/index.jsx @@ -1,10 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Select, Radio, Row, Col } from 'antd' +import { Select, Radio, Row, Col, Popover, Badge } from 'antd' import moment from 'moment' import 'moment/locale/zh-cn' +import MKEmitter from '@/utils/events.js' import './index.scss' const { Option } = Select @@ -429,6 +430,8 @@ let monthlist = datelist.filter(item => item.month === selectMonth)[0].children.filter(cell => !cell.children[0].$disable || !cell.children[6].$disable) this.setState({ selectYear: value, datelist, monthlist }) + + this.props.yearChange(value) } monthChange = (value) => { @@ -445,12 +448,86 @@ }) } + triggerDay = (d) => { + const { config } = this.props + + if (!config.setting.linkbtn) return + + let id = d.time + '' + id = id.substr(0, 4) + '-' + id.substr(4, 2) + '-' + id.substr(6) + + MKEmitter.emit('triggerBtnId', config.setting.linkbtn, [{$$uuid: id}]) + } + + openView = (data, e) => { + const { config } = this.props + + if (!config.wrap.click) return + + e && e.stopPropagation() + + if (config.wrap.click === 'menus') { + let menu = null + + if (config.wrap.menus && config.wrap.menus.length > 0) { + let s = data[config.wrap.menuType] + '' + config.wrap.menus.forEach(m => { + if (s !== m.sign) return + menu = m + }) + } + if (!menu) return + + let newtab = { + MenuID: menu.MenuID, + MenuName: menu.MenuName, + MenuNo: menu.MenuNo || '', + type: menu.tabType, + param: {$BID: data.$$uuid || ''} + } + + Object.keys(data).forEach(key => { + if (/^\$/.test(key)) return + newtab.param[key] = data[key] + }) + + MKEmitter.emit('modifyTabs', newtab, true) + } else if (config.wrap.click === 'menu') { + let menuId = config.wrap.MenuID || config.wrap.menu.slice(-1)[0] + let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + + if (!menu && config.wrap.MenuName && config.wrap.tabType) { + menu = { + MenuID: menuId, + MenuName: config.wrap.MenuName, + MenuNo: config.wrap.MenuNo || '', + type: config.wrap.tabType + } + } + + if (!menu) return + + let newtab = { + ...menu, + param: {$BID: data.$$uuid || ''} + } + + Object.keys(data).forEach(key => { + if (/^\$/.test(key)) return + newtab.param[key] = data[key] + }) + + MKEmitter.emit('modifyTabs', newtab, true) + } + } + render() { + const { config } = this.props const { level, selectYear, selectMonth, yearlist, levels, datelist, monthlist } = this.state const _levelName = {day: '鏃�', month: '鏈�', year: '骞�'} return ( - <div className="mk-calendar"> + <div className={'mk-calendar' + (config.setting.linkbtn ? ' open-pop' : '') + (config.wrap.click ? ' open-menu' : '')}> <div className="mk-calendar-control"> <Select value={selectYear} onChange={this.yearChange}> {yearlist.map(item => (<Option key={item} value={item}>{item}骞�</Option>))} @@ -491,8 +568,23 @@ <tr key={m}> {cell.children.map((d, i) => ( <td key={i}> - <div style={d.style} className={'day-wrap' + (d.$disable ? ' disabled' : '')}> - {d.label} + <div style={d.style} className={'day-wrap' + (d.$disable ? ' disabled' : '')} onClick={() => !d.$disable && this.triggerDay(d)}> + {d.subData.length > 0 ? <Popover mouseEnterDelay={0.3} overlayClassName={'calendar-day-pop' + (config.wrap.click ? ' open-menu' : '')} content={ + <div onClick={(e) => e.stopPropagation()}> + {d.subData.map((data, index) => ( + <div key={index} className="message" onClick={() => this.openView(data)}> + <Badge color={data.$color} text={ + <span> + {data.$message} + <span style={{color: 'rgba(0,0,0,.45)'}}>({data.$startTime + ' ~ ' + data.$endTime})</span> + </span>} + /> + </div> + ))} + </div> + } trigger="hover"> + {d.label} + </Popover> : d.label} </div> </td> ))} @@ -515,7 +607,7 @@ <tr key={m}> {cell.children.map((d, i) => ( <td key={i}> - <div className={'month-wrap' + (d.$disable ? ' disabled' : '')}> + <div className={'month-wrap' + (d.$disable ? ' disabled' : '')} onClick={() => !d.$disable && this.triggerDay(d)}> <div className="header"> <div className="message"> {d.label} @@ -526,7 +618,13 @@ <span className="right">{d.jr}</span> </div> </div> - <ul className="content"></ul> + <ul className="content"> + {d.subData.map((data, index) => ( + <li key={index} className="message" onClick={(e) => this.openView(data, e)}> + <Badge color={data.$color} text={data.$message} /> + </li> + ))} + </ul> </div> </td> ))} @@ -542,7 +640,13 @@ <div className="header"> {item.label} </div> - <ul className="content"></ul> + <ul className="content"> + {item.subData.map((data, index) => ( + <li key={index} className="message" onClick={() => this.openView(data)}> + <Badge color={data.$color} text={`${data.$message} (${data.$startTime} ~ ${data.$endTime})`}/> + </li> + ))} + </ul> </div> </Col> ))} diff --git a/src/tabviews/custom/components/calendar/board/index.scss b/src/tabviews/custom/components/calendar/board/index.scss index b79db1a..c455faa 100644 --- a/src/tabviews/custom/components/calendar/board/index.scss +++ b/src/tabviews/custom/components/calendar/board/index.scss @@ -111,15 +111,28 @@ } .content { padding: 0 10px 10px; - height: 70px; + height: 55px; overflow-y: auto; position: absolute; left: 0; right: 0; .message { width: 100%; + white-space: nowrap; + overflow: hidden; + .ant-badge { + width: 100%; + } .ant-badge-status-text { - color: inherit; + font-size: 13px; + width: calc(100% - 15px); + overflow: hidden; + word-break: break-word; + white-space: nowrap; + text-overflow: ellipsis; + height: 21px; + display: inline-block; + vertical-align: top; } } } @@ -163,7 +176,6 @@ .year-wrap { width: calc(100% - 2px); box-shadow: 0px 0px 3px var(--mk-sys-color2); - cursor: pointer; transition: background 0.1s; .header { text-align: center; @@ -182,7 +194,20 @@ width: 100%; overflow: hidden; margin-bottom: 5px; - text-overflow: ellipsis; + .ant-badge { + width: 100%; + } + .ant-badge-status-text { + font-size: 13px; + width: calc(100% - 15px); + overflow: hidden; + word-break: break-word; + white-space: nowrap; + text-overflow: ellipsis; + height: 21px; + display: inline-block; + vertical-align: top; + } } } .content::-webkit-scrollbar { @@ -206,6 +231,28 @@ } } } +.mk-calendar:not(.open-pop) { + .day-wrap { + cursor: default!important; + } + .month-wrap { + cursor: default!important; + } +} +.mk-calendar.open-menu { + .month-wrap, .year-wrap { + .content { + .message { + cursor: pointer; + } + } + } +} +.calendar-day-pop.open-menu { + .message { + cursor: pointer; + } +} .calendar-day-pop { .message { .ant-badge-status-text { diff --git a/src/tabviews/custom/components/calendar/index.jsx b/src/tabviews/custom/components/calendar/index.jsx index 0d7c725..628bfeb 100644 --- a/src/tabviews/custom/components/calendar/index.jsx +++ b/src/tabviews/custom/components/calendar/index.jsx @@ -59,6 +59,12 @@ _config.wrap.colorField = '' } + if (_config.action[0] && _config.action[0].config && _config.action[0].config.enabled) { + _config.setting.linkbtn = _config.action[0].uuid + } else { + _config.action = [] + } + this.setState({ BID: BData ? (BData.$BID || '') : '', BData: BData, @@ -301,6 +307,18 @@ }) } + yearChange = (value) => { + const { config } = this.state + + if (!config.setting.$re_year) return + + this.setState({ + year: value + }, () => { + this.loadData() + }) + } + render() { const { config, loading, data, BID, BData } = this.state @@ -319,7 +337,7 @@ {config.action[0] ? <PopupButton disabled={false} BID={BID} btn={config.action[0]} BData={BData} setting={config.setting} selectedData={[]}/> : null } - <CalendarBoard config={config} data={data}/> + <CalendarBoard config={config} data={data} yearChange={this.yearChange}/> </div> ) } diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 9aa9dcb..929162f 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -158,7 +158,7 @@ if (group.uuid !== menuId) return - if (position === 'mainline' && config.setting.supModule && BID) { + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { this.loadData() @@ -169,6 +169,10 @@ } this.execSuccess(btn, id) + + if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 + btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) + } } resetParentParam = (MenuID, id, data) => { diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 50d09cc..6ee6d07 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -205,7 +205,7 @@ if (group.uuid !== menuId) return - if (position === 'mainline' && config.setting.supModule && BID) { + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { this.loadData() @@ -216,6 +216,10 @@ } this.execSuccess(btn, id) + + if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 + btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) + } } resetParentParam = (MenuID, id, data) => { diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 4909bf9..20c122b 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -175,7 +175,7 @@ if (group.uuid !== menuId) return - if (position === 'mainline' && config.setting.supModule && BID) { + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { this.loadData() @@ -186,6 +186,10 @@ } this.execSuccess(btn, id) + + if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 + btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) + } } resetParentParam = (MenuID, id, data) => { diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 7c45f53..8bad71b 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -497,6 +497,7 @@ group.subButton.OpenType = 'formSubmit' group.subButton.execError = 'never' group.subButton.logLabel = item.$menuname + '-' + group.subButton.label + group.subButton.$tabId = Tab.uuid if (!group.subButton.Ot) { group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index f61eadf..a472218 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -186,7 +186,7 @@ if (btn.Ot === 'requiredSgl' && setting.primaryKey) { _data = data[0] - primaryId = _data[setting.primaryKey] || '' + primaryId = _data.$$uuid || _data[setting.primaryKey] || '' } this.setState({ @@ -248,7 +248,7 @@ ratio = ratio + 'vw' } return <Modal - wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview')} + wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} title={btn.label} width={ratio} maskClosable={btn.clickouter === 'close'} diff --git a/src/tabviews/zshare/actionList/popupbutton/index.scss b/src/tabviews/zshare/actionList/popupbutton/index.scss index 72a6a3c..5dee830 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.scss +++ b/src/tabviews/zshare/actionList/popupbutton/index.scss @@ -1,5 +1,5 @@ .custom-popview.popview-modal { - >.ant-modal-content >.ant-modal-body { + .ant-modal-content .ant-modal-body { padding: 0; .custom-page-wrap { min-height: 200px; @@ -9,6 +9,19 @@ } } } +.custom-popview.popview-modal.miniview { + .ant-modal-header { + display: none; + } + .ant-modal-footer { + display: none; + } + .ant-modal-body { + padding: 0px; + border-radius: 4px; + max-height: calc(100vh - 110px); + } +} .table-drawer-popview { .close-drawer { position: absolute; -- Gitblit v1.8.0