From d1cd5af5adb53e91efdd278328e1b6f8ad834fb5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 06 二月 2025 21:11:56 +0800
Subject: [PATCH] Merge branch 'positec' into dms

---
 src/menu/components/card/table-card/index.jsx |  141 +++++++++++++++-------------------------------
 1 files changed, 46 insertions(+), 95 deletions(-)

diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx
index f42e90f..2cb6e75 100644
--- a/src/menu/components/card/table-card/index.jsx
+++ b/src/menu/components/card/table-card/index.jsx
@@ -1,12 +1,12 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Popover, Modal, Pagination } from 'antd'
+import { Popover, Modal, Pagination, message } from 'antd'
 import { PlusOutlined, PlusCircleOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, DownOutlined } from '@ant-design/icons'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
-import { resetStyle, getTables } 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 '../data-card/options'
@@ -18,7 +18,6 @@
 const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
 const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
-const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
 const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent'))
 const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent'))
@@ -67,38 +66,6 @@
           elements: []
         }],
         action: [],
-      }
-      
-      if (card.config) {
-        let config = fromJS(card.config).toJS()
-
-        _card.wrap = config.wrap
-        _card.wrap.name = card.name
-        _card.style = config.style
-        _card.headerStyle = config.headerStyle
-
-        _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
-        })
-        _card.search = config.search.map(col => {
-          col.uuid = Utils.getuuid()
-          return col
-        })
-        if (config.action) {
-          _card.action = config.action.map(col => {
-            col.uuid = Utils.getuuid()
-            return col
-          })
-        }
       }
 
       this.updateComponent(_card)
@@ -161,56 +128,15 @@
       return
     }
 
-    card.errors = []
-
-    // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : ''
-    // if (supModule === 'empty') {
-    //   supModule = ''
-    // }
-    let columns = card.columns.map(c => c.field)
-    // let lowcols = card.columns.map(c => c.field.toLowerCase())
-
-    if (card.subcards.length === 0) {
-      card.errors.push({ level: 0, detail: '鍗$墖涓嶅彲涓虹┖锛�'})
-    }
-
-    if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) {
-      card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'})
-    } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) {
-      card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'})
-    } else if (!card.setting.primaryKey) {
-      card.errors.push({ level: 0, detail: '鏈缃富閿紒'})
-    } else if (!columns.includes(card.setting.primaryKey)) {
-      card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'})
-    } else if (!card.setting.supModule) {
-      card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'})
-    }
+    card.$c_ds = true
+    card.$c_ac = false
+    card.$c_sc = true
+    
+    card.errors = checkComponent(card)
 
     if (card.errors.length === 0) {
       card.$tables = getTables(card)
     }
-
-    card.subcards.forEach((item, i) => {
-      let linkbtn = item.setting.linkbtn || ''
-      item.elements.forEach(cell => {
-        if (cell.eleType === 'button') {
-          if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
-            if (!cell.modal || cell.modal.fields.length === 0) {
-              card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
-            }
-          }
-          if (linkbtn && linkbtn === cell.uuid) {
-            linkbtn = ''
-          }
-        } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) {
-          card.errors.push({ level: 1, detail: `鍗$墖涓姩鎬佸瓧娈碘��${cell.field}鈥濇棤鏁坄})
-        }
-      })
-
-      if (linkbtn) {
-        card.errors.push({ level: 1, detail: `绗�${i + 1}寮犲崱鐗囦腑缁戝畾鎸夐挳宸插垹闄})
-      }
-    })
 
     this.setState({
       card: card
@@ -238,14 +164,14 @@
    */
   deleteCard = (cell) => {
     let card = fromJS(this.state.card).toJS()
-    let _this = this
+    let that = this
 
     confirm({
       content: '纭畾鍒犻櫎鍗$墖鍚楋紵',
       onOk() {
         card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid)
 
-        _this.updateComponent(card)
+        that.updateComponent(card)
       },
       onCancel() {}
     })
@@ -254,7 +180,7 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle)
+    MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear', 'minHeight'], card.style, this.getStyle)
   }
 
   getStyle = (style) => {
@@ -294,7 +220,7 @@
     this.updateComponent(card)
   }
 
-  addSearch = (copy) => {
+  addSearch = (copy, type = '') => {
     const { card } = this.state
 
     let newcard = {}
@@ -316,7 +242,7 @@
     }
 
     // 娉ㄥ唽浜嬩欢-娣诲姞鎼滅储
-    MKEmitter.emit('addSearch', card.uuid, newcard)
+    MKEmitter.emit('addSearch', card.uuid, newcard, type)
   }
 
   move = (item, direction) => {
@@ -345,6 +271,15 @@
   }
 
   updateWrap = (res) => {
+    if (res.interaction) {
+      if (res.interaction.includes('parity')) {
+        res.parity = 'true'
+      }
+      if (res.interaction.includes('hover')) {
+        res.hover = 'true'
+      }
+      delete res.interaction
+    }
     this.updateComponent({...this.state.card, wrap: res})
   }
 
@@ -359,7 +294,7 @@
       res.setting = res.setting || {}
       res.setting.width = res.setting.width || 6
 
-      let mobtypes = ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton']
+      let mobtypes = ['pop', 'prompt', 'exec', 'innerpage', 'funcbutton', 'form']
 
       let elements = []
       res.elements && res.elements.forEach(cell => {
@@ -402,13 +337,22 @@
         }
   
         if (res.field && keys.includes(res.field.toLowerCase())) {
-          resolve({status: false, message: '鎼滅储瀛楁宸插瓨鍦紒'})
-          return
+          resolve({status: false})
+          const that = this
+          confirm({
+            title: '鎼滅储瀛楁宸插瓨鍦紒',
+            okText: '鐭ラ亾浜�',
+            cancelText: '鏇挎崲',
+            onOk() {},
+            onCancel() {
+              that.addSearch(res, 'replace')
+            }
+          })
+        } else {
+          resolve({status: true})
+  
+          this.addSearch(res)
         }
-
-        resolve({status: true})
-
-        this.addSearch(res)
       }
     }
   }
@@ -497,7 +441,6 @@
             <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
             <ClockComponent config={card} updateConfig={this.updateComponent}/>
-            <UserComponent config={card}/>
             <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} />
             {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
           </div>
@@ -513,7 +456,15 @@
         {card.setting.laypage === 'true' && card.wrap.pagestyle === 'more' ? <div className="mk-more">鏌ョ湅鏇村<DownOutlined/></div> : null}
         <div className="component-name">
           <div className="center">
-            <div className="title">{card.name}</div>
+            <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) {

--
Gitblit v1.8.0