From d52169be5ed98d6846bb07f75e5a305271e374d4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 27 四月 2023 18:07:05 +0800
Subject: [PATCH] 2023-04-27

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
index 3aea5ea..997e630 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -126,6 +126,9 @@
     const { col, record } = this.props
 
     if (id !== col.uuid + record.$$uuid) return
+
+    if (col.ctrlField && col.ctrlValue.includes(record[col.ctrlField])) return
+
     this.focus()
   }
 
@@ -288,6 +291,11 @@
 
     if (!col) return (<td {...resProps} className={className} style={style}/>)
 
+    let disabled = false
+    if (col.ctrlField) {
+      disabled = col.ctrlValue.includes(record[col.ctrlField])
+    }
+
     let children = null
     if (col.type === 'text') {
       let content = ''
@@ -325,7 +333,7 @@
         }
       }
 
-      if (col.editable === 'true') {
+      if (col.editable === 'true' && !disabled) {
         if (editing) {
           if (!col.editType || col.editType === 'text') {
             return (<td className="editing_table_cell">
@@ -421,7 +429,7 @@
         }
       }
 
-      if (col.editable === 'true') {
+      if (col.editable === 'true' && !disabled) {
         if (editing) {
           return (<td className="editing_table_cell">
             <InputNumber id={col.uuid + record.$$uuid} defaultValue={value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress} onBlur={this.onBlur}/>
@@ -472,11 +480,8 @@
 
       if (content !== '') {
         content = `${col.prefix || ''}${content}${col.postfix || ''}`
-
-        if (col.eval === 'false') {
-          content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, '&nbsp;')
-          content = <span dangerouslySetInnerHTML={{__html: content}}></span>
-        }
+        content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, '&nbsp;')
+        content = <span dangerouslySetInnerHTML={{__html: content}}></span>
       }
 
       if (col.marks) {
@@ -685,9 +690,14 @@
     let { col, config, record, style, className } = this.props
     const { err } = this.state
 
+    let disabled = false
+    if (col.ctrlField) {
+      disabled = col.ctrlValue.includes(record[col.ctrlField])
+    }
+
     let children = null
     if (col.type === 'text') {
-      if (col.editable === 'true') {
+      if (col.editable === 'true' && !disabled) {
         let _value = ''
         if (col.editField) {
           _value = record[col.editField] !== undefined ? record[col.editField] : ''
@@ -757,7 +767,7 @@
         children = content
       }
     } else if (col.type === 'number') {
-      if (col.editable === 'true') {
+      if (col.editable === 'true' && !disabled) {
         let _value = record[col.field] !== undefined ? record[col.field] : ''
         children = (<>
           <InputNumber id={col.uuid + record.$$uuid} defaultValue={_value} onChange={(val) => this.onChange(val)} onPressEnter={this.enterPress}/>
@@ -846,11 +856,8 @@
 
       if (content !== '') {
         content = `${col.prefix || ''}${content}${col.postfix || ''}`
-
-        if (col.eval === 'false') {
-          content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, '&nbsp;')
-          content = <span dangerouslySetInnerHTML={{__html: content}}></span>
-        }
+        content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, '&nbsp;')
+        content = <span dangerouslySetInnerHTML={{__html: content}}></span>
       }
 
       if (col.marks) {
@@ -947,6 +954,10 @@
             if (!initEditLine) {
               initEditLine = item
             }
+
+            if (item.ctrlField) {
+              item.ctrlValue = item.ctrlValue.split(',')
+            }
           }
     
           if (item.type === 'text' && item.editable === 'true' && item.editType === 'select' && item.resourceType === '1') {

--
Gitblit v1.8.0