From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/tabviews/custom/components/calendar/board/index.jsx | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 112 insertions(+), 8 deletions(-) diff --git a/src/tabviews/custom/components/calendar/board/index.jsx b/src/tabviews/custom/components/calendar/board/index.jsx index 44c208d..f4e1e3b 100644 --- a/src/tabviews/custom/components/calendar/board/index.jsx +++ b/src/tabviews/custom/components/calendar/board/index.jsx @@ -1,15 +1,18 @@ 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 -moment.locale('zh-cn') +if (sessionStorage.getItem('lang') === 'zh-CN') { + moment.locale('zh-cn') +} class CalendarBoard extends Component { static propTpyes = { @@ -429,6 +432,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 +450,84 @@ }) } + 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.menu.slice(-1)[0] + let menu = null + + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (config.wrap.MenuID) { + menu = { + MenuID: config.wrap.MenuID, + MenuName: config.wrap.MenuName, + type: config.wrap.tabType + } + } + + if (!menu) return + + menu.param = {$BID: data.$$uuid || ''} + + Object.keys(data).forEach(key => { + if (/^\$/.test(key)) return + menu.param[key] = data[key] + }) + + MKEmitter.emit('modifyTabs', menu, 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> ))} -- Gitblit v1.8.0