From ed698a4ef051a13fe22c9ccfe121232c753725c1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 12 二月 2025 00:45:40 +0800
Subject: [PATCH] 2025-02-12

---
 src/menu/components/timeline/normal-timeline/index.jsx |  121 ++++++++++++++++++++--------------------
 1 files changed, 60 insertions(+), 61 deletions(-)

diff --git a/src/menu/components/timeline/normal-timeline/index.jsx b/src/menu/components/timeline/normal-timeline/index.jsx
index d6ad7e9..f8fdcae 100644
--- a/src/menu/components/timeline/normal-timeline/index.jsx
+++ b/src/menu/components/timeline/normal-timeline/index.jsx
@@ -1,12 +1,12 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Popover } from 'antd'
+import { Popover, message } from 'antd'
 import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
-import { resetStyle } from '@/utils/utils-custom.js'
+import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
 import getWrapForm from './options'
@@ -16,7 +16,7 @@
 const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
 const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
-const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
+const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
 
 class NormalTimelineComponent extends Component {
@@ -27,8 +27,7 @@
   }
 
   state = {
-    card: null,
-    back: false
+    card: null
   }
 
   UNSAFE_componentWillMount () {
@@ -38,18 +37,16 @@
       let _card = {
         uuid: card.uuid,
         type: card.type,
-        tabId: card.tabId || '',
-        parentId: card.parentId || '',
         format: 'array',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
-        dataName: card.dataName || '',
         width: card.width || 24,
         name: card.name,
         subtype: card.subtype,
         setting: { interType: 'system' },
-        wrap: { title: '', name: card.name, width: card.width || 24, color: '#1890ff', mode: 'left' },
+        wrap: { title: '', name: card.name, direction: 'vertical', width: card.width || 24, color: '#1890ff', mode: 'left' },
         style: { marginLeft: '0px', marginRight: '0px', marginTop: '0px', marginBottom: '0px' },
+        headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
         subcards: [{
           uuid: Utils.getuuid(),
           setting: { width: 24, type: 'simple'},
@@ -62,39 +59,12 @@
         scripts: [],
       }
 
-      if (card.config) {
-        let config = fromJS(card.config).toJS()
-
-        _card.wrap = config.wrap
-        _card.wrap.name = card.name
-        _card.style = config.style
-
-        _card.setting = config.setting
-        _card.columns = config.columns
-        _card.scripts = config.scripts
-
-        _card.subcards = config.subcards.map(scard => {
-          scard.uuid = Utils.getuuid()
-          scard.elements = scard.elements.map(elem => {
-            elem.uuid = Utils.getuuid()
-            return elem
-          })
-          return scard
-        })
-      }
-      this.setState({
-        card: _card
-      })
-      this.props.updateConfig(_card)
+      this.updateComponent(_card)
     } else {
       this.setState({
         card: fromJS(card).toJS()
       })
     }
-  }
-
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -108,21 +78,33 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
 
   /**
    * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級
    */
-  updateComponent = (component) => {
+  updateComponent = (card) => {
+    card.width = card.wrap.width
+    card.name = card.wrap.name
+    if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌�
+      card.$c_ds = true
+      card.$c_sc = true
+      
+      card.errors = checkComponent(card)
+
+      if (card.errors.length === 0) {
+        card.$tables = getTables(card)
+      }
+
+      delete card.$c_ds
+      delete card.$c_sc
+    }
+    
     this.setState({
-      card: component
+      card: card
     })
 
-    component.width = component.wrap.width
-    component.name = component.wrap.name
-
-    this.props.updateConfig(component)
+    this.props.updateConfig(card)
   }
 
   updateCard = (cell) => {
@@ -133,29 +115,19 @@
       return item
     })
 
-    this.setState({card})
-
-    this.props.updateConfig(card)
+    this.updateComponent(card)
   }
 
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style)
+    MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { card } = this.state
-
-    if (comIds.length !== 1 || comIds[0] !== card.uuid) return
-
-    let _card = {...card, style}
-
-    this.setState({
-      card: _card
-    })
+  getStyle = (style) => {
+    let _card = {...this.state.card, style}
     
-    this.props.updateConfig(_card)
+    this.updateComponent(_card)
   }
 
   getWrapForms = () => {
@@ -166,6 +138,12 @@
 
   updateWrap = (res) => {
     delete res.quick
+
+    if (res.hmode) {
+      res.mode = res.hmode
+      delete res.hmode
+    }
+    
     this.updateComponent({...this.state.card, wrap: res})
   }
 
@@ -183,7 +161,7 @@
             </NormalForm>
             <CopyComponent type="timeline" card={card}/>
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
-            <UserComponent config={card}/>
+            <ClockComponent config={card} updateConfig={this.updateComponent}/>
             <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} />
             <SettingComponent config={card} updateConfig={this.updateComponent} />
           </div>
@@ -192,7 +170,28 @@
         </Popover>
         <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/>
         {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard}/>))}
-        <div className="component-name"><div className="center">{card.name}</div></div>
+        <div className="component-name">
+          <div className="center">
+            <div className="title" onDoubleClick={() => {
+              let oInput = document.createElement('input')
+              oInput.value = 'anchor' + card.uuid
+              document.body.appendChild(oInput)
+              oInput.select()
+              document.execCommand('Copy')
+              document.body.removeChild(oInput)
+              message.success('澶嶅埗鎴愬姛銆�')
+            }}>{card.name}</div>
+            <div className="content">
+              {card.errors && card.errors.map((err, index) => {
+                if (err.level === 0) {
+                  return <span key={index} className="error">{err.detail}</span>
+                } else {
+                  return <span key={index} className="waring">{err.detail}锛�</span>
+                }
+              })}
+            </div>
+          </div>
+        </div>
       </div>
     )
   }

--
Gitblit v1.8.0