From f45b2ad61211cf2821cdaab07676c7906c96410a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 05 七月 2023 18:23:56 +0800
Subject: [PATCH] 2023-07-05

---
 src/menu/components/calendar/index.jsx |   59 +++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/src/menu/components/calendar/index.jsx b/src/menu/components/calendar/index.jsx
index 6daaeb0..8338dbb 100644
--- a/src/menu/components/calendar/index.jsx
+++ b/src/menu/components/calendar/index.jsx
@@ -2,20 +2,22 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { Popover, message } from 'antd'
-import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons'
+import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, PlusCircleOutlined } from '@ant-design/icons'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
 import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import getWrapForm from './options'
+import Utils from '@/utils/utils.js'
 import './index.scss'
 
 const SettingComponent = asyncIconComponent(() => import('@/menu/datasource'))
 const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
+const SearchComponent = asyncComponent(() => import('@/templates/sharecomponent/searchcomponent'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
-const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
+const CalendarBoard = asyncComponent(() => import('./board'))
 
 class NormalCalendarComponent extends Component {
   static propTpyes = {
@@ -42,9 +44,10 @@
         name: card.name,
         subtype: card.subtype,
         setting: { interType: 'system' },
-        wrap: { title: '', name: card.name, width: card.width || 24 },
+        wrap: { title: '', name: card.name, width: card.width || 24, levels: ['day', 'month'] },
         style: { marginLeft: '0px', marginRight: '0px', marginTop: '0px', marginBottom: '0px' },
         headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
+        search: [],
         columns: [],
         scripts: [],
       }
@@ -90,7 +93,6 @@
     card.name = card.wrap.name
     if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌�
       card.$c_ds = true
-      card.$c_sc = true
       
       card.errors = checkComponent(card)
 
@@ -98,7 +100,7 @@
         card.$tables = getTables(card)
       }
     }
-    
+
     this.setState({
       card: card
     })
@@ -118,6 +120,12 @@
     this.updateComponent(_card)
   }
 
+  addSearch = () => {
+    const { card } = this.state
+
+    MKEmitter.emit('plusSearch', card.uuid, {uuid: Utils.getuuid(), focus: true, label: 'label', type: 'text', match: '='}, 'simple')
+  }
+
   getWrapForms = () => {
     const { card } = this.state
 
@@ -125,14 +133,35 @@
   }
 
   updateWrap = (res) => {
-    delete res.quick
+    const { card } = this.state
 
-    if (res.hmode) {
-      res.mode = res.hmode
-      delete res.hmode
+    res.show = card.wrap.show || 'true'
+    res.advanceType = card.wrap.advanceType || 'modal'
+    res.advanceWidth = card.wrap.advanceWidth || 1000
+    res.drawerPlacement = card.wrap.drawerPlacement || 'right'
+    res.searchRatio = card.wrap.searchRatio || 6
+    res.searchLwidth = card.wrap.searchLwidth !== undefined ? card.wrap.searchLwidth : 33.3
+    res.borderRadius = card.wrap.borderRadius || 0
+    res.resetContrl = card.wrap.resetContrl || 'init'
+
+    if (res.colorField && res.signs) {
+      res.signs = res.signs.map(item => {
+        try {
+          let colors = item.color.match(/\d+/g)
+          if ((colors[0] * 0.299 + colors[1] * 0.578 + colors[2] * 0.114) * colors[3] < 192) {
+            item.fontColor = '#ffffff'
+          } else {
+            item.fontColor = ''
+          }
+        } catch (e) {
+          item.fontColor = ''
+        }
+
+        return item
+      })
     }
-    
-    this.updateComponent({...this.state.card, wrap: res})
+
+    this.updateComponent({...card, wrap: res})
   }
 
   render() {
@@ -142,21 +171,23 @@
 
     return (
       <div className="menu-calendar-edit-box" style={_style} id={card.uuid}>
+        <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
-            <NormalForm title="鏃ュ巻璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
+            <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/>
+            <NormalForm title="鏃ュ巻璁剧疆" width={850} update={this.updateWrap} getForms={this.getWrapForms}>
               <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
             </NormalForm>
             <CopyComponent type="calendar" card={card}/>
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
-            <UserComponent config={card}/>
             <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} />
             <SettingComponent config={card} updateConfig={this.updateComponent} />
           </div>
         } trigger="hover">
           <ToolOutlined />
         </Popover>
-        <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/>
+        <SearchComponent config={card} updatesearch={this.updateComponent}/>
+        <CalendarBoard config={card} />
         <div className="component-name">
           <div className="center">
             <div className="title" onDoubleClick={() => {

--
Gitblit v1.8.0