From f0bf8c399c354c22227f8f1a76ed806098db59c0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 21 五月 2024 16:51:02 +0800
Subject: [PATCH] 2024-05-21

---
 src/tabviews/custom/popview/index.jsx |   98 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 60 insertions(+), 38 deletions(-)

diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index ca70341..4213bf9 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -2,6 +2,7 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { notification, Spin, Row, Col, Modal } from 'antd'
+import moment from 'moment'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -61,7 +62,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { Tab } = this.props
+    const { Tab, param } = this.props
 
     let config = Tab.config || ''
 
@@ -105,9 +106,18 @@
     // 鏉冮檺杩囨护
     let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
     let balMap = new Map()
-    let param = this.props.param || {} // url鍙傛暟
+    let urlparam = {} // url鍙傛暟
+    if (param) {
+      Object.keys(param).forEach(key => {
+        if (/^\$/.test(key)) {
+          urlparam[key] = param[key]
+        } else {
+          urlparam[key.toLowerCase()] = param[key]
+        }
+      })
+    }
 
-    window.GLOB.CacheData.set(Tab.uuid, param)
+    window.GLOB.CacheData.set(Tab.uuid, urlparam)
 
     let userName = sessionStorage.getItem('User_Name') || ''
     let fullName = sessionStorage.getItem('Full_Name') || ''
@@ -129,23 +139,11 @@
       regs.push({ reg: /@works_flow_code@/ig, value: `'${flow.flow_code || ''}'` })
     }
 
-    config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid)
+    config.components = this.filterComponent(config.components, roleId, balMap, urlparam, Tab, Tab.uuid, Tab.uuid)
     
     // 鑾峰彇涓绘悳绱㈡潯浠�
     config.components.forEach(component => {
       if (component.type !== 'search') return
-
-      if (param.$searchkey) {
-        component.search = component.search.map(item => {
-          if (['text', 'select', 'link', 'checkcard'].includes(item.type) && param.$searchkey === item.field) {
-            item.initval = param.$searchval
-          }
-
-          return item
-        })
-
-        component.$searches = Utils.initMainSearch(component.search)
-      }
 
       window.GLOB.SearchBox.set(Tab.uuid, component.$searches)
 
@@ -155,7 +153,7 @@
     })
 
     let params = []
-    let BID = param.$BID || ''
+    let BID = urlparam.$BID || ''
 
     config.components = this.formatSetting(config.components, params, regs, balMap)
 
@@ -238,12 +236,7 @@
 
           if (item.setting.supModule === 'preview') {
             item.setting.supModule = ''
-            let val = ''
-            Object.keys(urlparam).forEach(key => {
-              if (key.toLowerCase() === item.setting.controlField) {
-                val = urlparam[key]
-              }
-            })
+            let val = urlparam[item.setting.controlField] || ''
 
             item.subtabs = item.subtabs.filter(tab => {
               if (tab.$pass) return true
@@ -256,12 +249,7 @@
         if (item.setting.selectField) {
           item.setting.selectField = item.setting.selectField.toLowerCase()
 
-          let val = ''
-          Object.keys(urlparam).forEach(key => {
-            if (key.toLowerCase() === item.setting.selectField) {
-              val = urlparam[key]
-            }
-          })
+          let val = urlparam[item.setting.selectField] || ''
 
           let activeKey = ''
 
@@ -326,8 +314,14 @@
         }
       }
 
-      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢
-        item.setting.supModule = item.supNodes[0].componentId
+      if (item.wrap && item.wrap.supType === 'multi') { // 鏁版嵁鍗°�乼able澶氫笂绾х粍浠�
+        item.supNodes = item.supNodes.map(node => node.componentId)
+        if (item.supNodes[0]) {
+          item.setting.supModule = item.supNodes[0]
+        } else {
+          item.supNodes = null
+          item.setting.supModule = ''
+        }
       } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') {
         let pid = item.setting.supModule.pop()
         if (pid && pid !== 'empty') {
@@ -367,7 +361,10 @@
               col.type = 'custom'
             }
             
-            if (col.type === 'number') {
+            if (col.type === 'index') {
+              col.field = '$Index'
+              col.type = 'text'
+            } else if (col.type === 'number') {
               if (typeof(col.decimal) === 'number') {
                 col.round = Math.pow(10, col.decimal)
                 if (col.format === 'percent') {
@@ -417,6 +414,13 @@
         }
         
         item.cols = getCols(item.cols)
+
+        if (item.hasExtend) {
+          item.setting.hasExtend = true
+          item.setting.tableMode = 'compatible'
+          item.setting.extendTime = moment().format('YYYY-MM-DD HH:mm:ss')
+          item.colsCtrls = null
+        }
 
         if (item.subtype === 'editable') {
           item.submit.logLabel = item.$menuname + '-鎻愪氦'
@@ -663,7 +667,7 @@
     if (cell.syncComponentId) {
       if (cell.syncComponentId === item.setting.supModule) {
         cell.syncComponentId = ''
-        if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+        if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
           cell.execSuccess = 'mainline'
         }
       } else if (cell.syncComponentId === 'multiComponent') {
@@ -671,8 +675,17 @@
           return m.syncComId.pop() || ''
         })
 
-        if (item.setting.supModule && ids.includes(item.setting.supModule)) {
-          if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+        if (item.supNodes) {
+          item.supNodes.forEach(node => {
+            if (!ids.includes(node)) return
+
+            if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
+              cell.execSuccess = 'mainline'
+            }
+            ids = ids.filter(id => id !== node)
+          })
+        } else if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+          if (['line', 'grid', 'line_grid'].includes(cell.execSuccess)) {
             cell.execSuccess = 'mainline'
           }
           ids = ids.filter(id => id !== item.setting.supModule)
@@ -698,6 +711,17 @@
 
     if (cell.marks && cell.marks.length === 0) {
       cell.marks = null
+    }
+    if (cell.anchors && cell.anchors.length === 0) {
+      cell.anchors = null
+    }
+
+    if (cell.linkmenu && cell.linkmenu.length > 0) {
+      let menu_id = cell.linkmenu.pop()
+      cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || ''
+      if (!cell.linkThdMenu) {
+        cell.link = ''
+      }
     }
 
     if (['text', 'number', 'formula'].includes(cell.eleType)) {
@@ -1121,9 +1145,7 @@
         )
       } else if (item.type === 'group' && item.subtype === 'normalgroup') {
         return (
-          <Col span={item.width} style={style} key={item.uuid}>
-            <NormalGroup config={item}/>
-          </Col>
+          <NormalGroup config={item} style={style} key={item.uuid}/>
         )
       } else if (item.type === 'editor') {
         return (

--
Gitblit v1.8.0