From ca8a314835a4048b22af5f548b0529aaa9b9ab36 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 04 十二月 2024 17:49:13 +0800
Subject: [PATCH] 2024-12-04

---
 src/tabviews/custom/popview/index.jsx                       |   10 +
 src/tabviews/custom/components/table/base-table/index.jsx   |    6 
 src/tabviews/custom/index.jsx                               |   10 +
 src/menu/components/table/normal-table/options.jsx          |   61 +++++++
 src/tabviews/custom/components/share/normalTable/index.jsx  |  203 ++++++++++++++++++++++---
 src/tabviews/custom/components/table/normal-table/index.jsx |   96 +++++++++++
 src/templates/zshare/verifycard/index.jsx                   |    2 
 src/utils/utils-custom.js                                   |    2 
 src/tabviews/custom/components/share/normalTable/index.scss |   37 ++++
 src/tabviews/zshare/actionList/printbutton/index.jsx        |    2 
 10 files changed, 400 insertions(+), 29 deletions(-)

diff --git a/src/menu/components/table/normal-table/options.jsx b/src/menu/components/table/normal-table/options.jsx
index 3781664..d107f30 100644
--- a/src/menu/components/table/normal-table/options.jsx
+++ b/src/menu/components/table/normal-table/options.jsx
@@ -389,6 +389,67 @@
       forbid: !!appType || isprint
     },
     {
+      type: 'radio',
+      field: 'tree',
+      label: '缁撴瀯鏍�',
+      initval: wrap.tree || 'false',
+      tooltip: '浣跨敤缁撴瀯鏍戞椂锛屾樉绀哄垪棣栧垪璇蜂娇鐢ㄦ枃鏈被鍨嬨��',
+      required: false,
+      options: [
+        {value: 'true', label: '鍚敤'},
+        {value: 'false', label: '绂佺敤'},
+      ],
+      controlFields: [
+        {field: 'valueField', values: ['true']},
+        {field: 'parentField', values: ['true']},
+        {field: 'mark', values: ['true']},
+        {field: 'defOpen', values: ['true']},
+      ],
+      forbid: appType === 'mob' || isprint
+    },
+    {
+      type: 'select',
+      field: 'valueField',
+      label: '鍊煎瓧娈�',
+      initval: wrap.valueField || '',
+      tooltip: '鏁版嵁鍊煎瓧娈碉紝缁撴瀯鏍戜腑鑺傜偣ID鍊硷紝涓庝笂绾у瓧娈甸厤鍚堢粍缁囨暟鎹殑涓婁笅绾у叧绯汇��',
+      required: true,
+      options: columns,
+      forbid: appType === 'mob' || isprint
+    },
+    {
+      type: 'select',
+      field: 'parentField',
+      label: '涓婄骇瀛楁',
+      initval: wrap.parentField || '',
+      tooltip: '涓婄骇瀛楁锛岀敤浜庣粍缁囨暟鎹殑涓婁笅绾у叧绯汇��',
+      required: true,
+      options: columns,
+      forbid: appType === 'mob' || isprint
+    },
+    {
+      type: 'text',
+      field: 'mark',
+      label: '椤剁骇鏍囪瘑',
+      initval: wrap.mark || '',
+      tooltip: '涓婄骇瀛楁鍊间笌椤剁骇鏍囪瘑鐩稿悓鏃讹紝瑙嗕负椤剁骇鑺傜偣銆�',
+      required: false,
+      forbid: appType === 'mob' || isprint
+    },
+    {
+      type: 'radio',
+      field: 'defOpen',
+      label: '榛樿灞曞紑',
+      initval: wrap.defOpen || '',
+      required: false,
+      options: [
+        {value: '', label: '鏃�'},
+        {value: 'topline', label: '棣栬'},
+        {value: 'all', label: '鍏ㄩ儴'},
+      ],
+      forbid: appType === 'mob' || isprint
+    },
+    {
       type: 'multiselect',
       field: 'blacklist',
       label: '榛戝悕鍗�',
diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx
index dc47705..db3be11 100644
--- a/src/tabviews/custom/components/share/normalTable/index.jsx
+++ b/src/tabviews/custom/components/share/normalTable/index.jsx
@@ -2,7 +2,8 @@
 import PropTypes from 'prop-types'
 import md5 from 'md5'
 import { is, fromJS } from 'immutable'
-import { Table, Typography, Col, Switch, message } from 'antd'
+import { Table, Typography, Col, Switch, message, Pagination } from 'antd'
+import { CaretRightOutlined, CaretDownOutlined } from '@ant-design/icons'
 
 import asyncComponent from '@/utils/asyncComponent'
 import { getMark } from '@/utils/utils.js'
@@ -152,7 +153,7 @@
   }
 
   render() {
-    let { col, config, record, className, style, ...resProps } = this.props
+    let { col, config, record, className, style, openChange, ...resProps } = this.props
 
     if (!col) return (<td {...resProps} className={className} style={style}/>)
 
@@ -209,6 +210,21 @@
 
       if (col.rowspan === 'true') {
         resProps.rowSpan = record['$$' + col.field]
+      }
+
+      if (col.$tree && record.$mk_floor) {
+        className += ' mk-tree-td'
+        if (record.$open) {
+          content = <>
+            <span className="mk-tree-node" style={{width: `calc(var(--tree-node-width) * ${record.$mk_floor})`}}><CaretRightOutlined onClick={(e) => openChange(e, record.$key)} /><CaretDownOutlined onClick={(e) => openChange(e, record.$key)}/></span>
+            {content}
+          </>
+        } else {
+          content = <>
+            <span className="mk-tree-node" style={{width: `calc(var(--tree-node-width) * ${record.$mk_floor})`}}></span>
+            {content}
+          </>
+        }
       }
       
       resProps.children = content
@@ -539,11 +555,12 @@
     orderfields: {},      // 鎺掑簭id涓巉ield杞崲
     pageOptions: [],
     allColumns: null,
-    reseting: false
+    reseting: false,
+    openkeys: []
   }
 
   UNSAFE_componentWillMount () {
-    const { setting, columns, fields, colsCtrls } = this.props
+    const { setting, columns, fields, colsCtrls, data } = this.props
     let radio = 5          // 铏氬寲姣斾緥
     let _format = false    // 鏄惁铏氬寲澶勭悊
     let rowspans = []
@@ -594,6 +611,7 @@
                 record,
                 col: item,
                 config: item.type === 'custom' ? {setting, columns: fields} : null,
+                openChange: item.$tree ? this.openChange : null,
               })
             }
           }
@@ -653,6 +671,10 @@
       _columns = this.getCurColumns(_columns, this.props.allSearch)
     }
 
+    if (setting.$tree) {
+      this.resetOpenKeys(data)
+    }
+
     this.setState({
       pageSize: setting.pageSize || 10,
       pageOptions,
@@ -669,7 +691,7 @@
   }
 
   UNSAFE_componentWillReceiveProps(nextProps) {
-    const { allSearch, parCtrl } = this.props
+    const { allSearch, parCtrl, setting, data } = this.props
     const { allColumns } = this.state
 
     if (allSearch && !is(fromJS(allSearch), fromJS(nextProps.allSearch))) {
@@ -698,6 +720,7 @@
                 record,
                 col: item,
                 config: item.type === 'custom' ? {setting: this.props.setting, columns: this.props.fields} : null,
+                openChange: item.$tree ? this.openChange : null,
               })
             }
           }
@@ -709,6 +732,10 @@
       this.setState({
         columns: getColumns(nextProps.columns)
       })
+    }
+
+    if (setting.$tree && !is(fromJS(data), fromJS(nextProps.data))) {
+      this.resetOpenKeys(nextProps.data)
     }
   }
 
@@ -738,6 +765,83 @@
     MKEmitter.removeListener('autoQueryData', this.autoQueryData)
     MKEmitter.removeListener('autoSelectData', this.autoSelectData)
     MKEmitter.removeListener('mkCheckTopLine', this.mkCheckTopLine)
+  }
+
+  resetOpenKeys = (data) => {
+    const { setting } = this.props
+
+    if (!data || data.length === 0 || !setting.defOpen) {
+      this.setState({openkeys: []})
+    } else if (setting.defOpen === 'topline') {
+      let keys = []
+
+      if (data[0].$open) {
+        keys = [data[0].$key]
+
+        data.forEach(item => {
+          if (item.$pkeys && item.$pkeys.length > 1 && item.$pkeys.includes(data[0].$key)) {
+            keys.push(...item.$pkeys)
+          }
+        })
+
+        keys = Array.from(new Set(keys))
+      }
+
+      this.setState({openkeys: keys})
+    } else {
+      this.setState({openkeys: data.filter(item => !!item.$open).map(item => item.$key)})
+    }
+  }
+
+  openChange = (e, key) => {
+    const { setting, MenuID, data } = this.props
+    const { openkeys, selectedRowKeys } = this.state
+
+    e.stopPropagation()
+
+    let _openkeys = []
+
+    if (openkeys.includes(key)) {
+      _openkeys = openkeys.filter(k => k !== key)
+    } else {
+      _openkeys = [...openkeys, key]
+    }
+
+    if (!setting.tableType || _openkeys.length > openkeys.length) {
+      this.setState({openkeys: _openkeys})
+      return
+    }
+    
+    let newkeys = fromJS(selectedRowKeys).toJS()
+
+    newkeys = newkeys.filter(k => {
+      if (!data[k]) return false
+      if (!data[k].$pkeys) return true
+
+      return data[k].$pkeys.every(key => _openkeys.includes(key))
+    })
+
+    if (newkeys.length === selectedRowKeys.length) {
+      this.setState({openkeys: _openkeys})
+      return
+    }
+
+    let _index = ''
+    if (newkeys.length > 0) {
+      _index = newkeys.slice(-1)[0]
+    }
+
+    this.changedata(_index)
+    
+    this.setState({ openkeys: _openkeys, selectedRowKeys: newkeys, activeIndex: _index !== '' ? _index : null })
+
+    let selects = data.filter((item, _index) => newkeys.includes(_index))
+
+    this.props.chgSelectData(selects)
+
+    if (setting.$hasSyncModule) {
+      MKEmitter.emit('syncBalconyData', MenuID, selects, false)
+    }
   }
 
   getCurColumns = (columns, allSearch) => {
@@ -974,21 +1078,44 @@
   }
 
   changeTable = (pagination, filters, sorter) => {
-    const { orderfields } = this.state
-
-    this.setState({
-      pageIndex: pagination.current,
-      pageSize: pagination.pageSize,
-      selectedRowKeys: [],
-      activeIndex: null,
-      pickup: false
-    })
+    const { setting } = this.props
+    const { orderfields, pageSize } = this.state
 
     if (orderfields) {
       sorter.field = orderfields[sorter.field] || ''
     }
 
-    this.props.refreshdata(pagination, filters, sorter)
+    if (setting.$tree) {
+      this.setState({
+        pageIndex: 1,
+        selectedRowKeys: [],
+        activeIndex: null,
+        pickup: false
+      })
+  
+      this.props.refreshdata({current: 1, pageSize: pageSize}, sorter)
+    } else {
+      this.setState({
+        pageIndex: pagination.current,
+        pageSize: pagination.pageSize,
+        selectedRowKeys: [],
+        activeIndex: null,
+        pickup: false
+      })
+  
+      this.props.refreshdata(pagination, sorter)
+    }
+  }
+
+  onPaginationChange = (current, pageSize) => {
+    this.setState({
+      pageIndex: current,
+      pageSize: pageSize,
+      selectedRowKeys: [],
+      activeIndex: null
+    })
+
+    this.props.refreshdata({current: current, pageSize: pageSize, fixed: true}, {})
   }
 
   changedata = (index) => {
@@ -1125,7 +1252,7 @@
 
   render() {
     const { setting, statFValue, lineMarks, data } = this.props
-    const { selectedRowKeys, activeIndex, pickup, pageOptions, columns, reseting } = this.state
+    const { selectedRowKeys, activeIndex, pickup, pageOptions, columns, reseting, openkeys } = this.state
 
     if (reseting) return null
 
@@ -1152,14 +1279,16 @@
     // 鏁版嵁鏀惰捣鏃讹紝杩囨护宸查�夋暟鎹�
     let _data = data || []
 
-    if (pickup) {
-      _data = _data.filter((item, index) => selectedRowKeys.includes(index))
+    if (!setting.$tree) {
+      if (pickup) {
+        _data = _data.filter((item, index) => selectedRowKeys.includes(index))
+      }
+  
+      _data = this.handleRowspan(_data)
     }
-
-    _data = this.handleRowspan(_data)
     
     let _pagination = false
-    if (setting.laypage !== 'false' && setting.laypage !== false) {
+    if (setting.laypage && !setting.$tree) {
       _pagination = {
         current: this.state.pageIndex,
         pageSize: this.state.pageSize,
@@ -1210,7 +1339,7 @@
 
     return (
       <div className={`normal-custom-table ${setting.tableHeader || ''} ${setting.parity === 'true' ? 'mk-parity' : ''} ${height ? 'fixed-table-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || 'middle'} table-col-${columns.length} ${fixed} ${setting.empSign === 'hidden' ? 'mk-empty-hide' : ''}`} style={style}>
-        {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ?
+        {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 && !setting.$tree ?
           <Switch title="鏀惰捣" className="main-pickup" checkedChildren={window.GLOB.dict['open'] || '寮�'} unCheckedChildren={window.GLOB.dict['shut'] || '鍏�'} checked={pickup} onChange={this.pickupChange} /> : null
         }
         <Table
@@ -1223,11 +1352,26 @@
           loading={loading}
           scroll={{ x: '100%', y: height }}
           onRow={(record, index) => {
+            let className = ''
+
+            if (index === activeIndex) {
+              className = ' mk-row-active '
+            }
+
+            if (setting.$tree) {
+              if (record.$open && openkeys.includes(record.$key)) {
+                className += ' mk-tree-open '
+              }
+              if (record.$pkeys && !record.$pkeys.every(key => openkeys.includes(key))) {
+                className += ' mk-tree-hide '
+              }
+            }
+
             return {
-              lineMarks: setting.tableMode !== 'fast' ? lineMarks : null,
+              lineMarks: lineMarks,
               data: record,
               title: setting.tipField ? record[setting.tipField] : '',
-              className: index === activeIndex ? ' mk-row-active ' : '',
+              className: className,
               onClick: () => {this.changeRow(record, index)},
               onDoubleClick: () => {this.doubleClickLine(record)}
             }
@@ -1235,6 +1379,17 @@
           onChange={this.changeTable}
           pagination={_pagination}
         />
+        {setting.laypage && setting.$tree ? <Pagination
+          showSizeChanger
+          className="mk-tree-pagination"
+          onChange={this.onPaginationChange}
+          onShowSizeChange={this.onPaginationChange}
+          current={this.state.pageIndex}
+          pageSize={this.state.pageSize}
+          pageSizeOptions={pageOptions}
+          total={this.props.total || 0}
+          showTotal={(total, range) => `${range[0]}-${range[1]} ${window.GLOB.dict['of'] || '鍏�'} ${total} ${window.GLOB.dict['items'] || '鏉�'}`}
+        /> : null}
         {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null}
       </div>
     )
diff --git a/src/tabviews/custom/components/share/normalTable/index.scss b/src/tabviews/custom/components/share/normalTable/index.scss
index 120fac2..d23ed74 100644
--- a/src/tabviews/custom/components/share/normalTable/index.scss
+++ b/src/tabviews/custom/components/share/normalTable/index.scss
@@ -200,6 +200,43 @@
   table tbody tr {
     color: var(--mk-table-color);
   }
+
+  .mk-tree-node {
+    display: inline-block;
+    text-align: right;
+    --tree-node-width: 18px;
+    
+    .anticon-caret-right, .anticon-caret-down {
+      cursor: pointer;
+      padding-right: 3px;
+    }
+    .anticon-caret-down {
+      display: none;
+    }
+  }
+  .mk-tree-open {
+    .mk-tree-node {
+      .anticon-caret-right {
+        display: none;
+      }
+      .anticon-caret-down {
+        display: inline-block;
+      }
+    }
+  }
+  .mk-tree-hide {
+    display: none;
+  }
+  .mk-tree-td {
+    overflow: hidden;
+    word-break: break-word;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+  }
+  .mk-tree-pagination {
+    float: right;
+    margin: 16px 0;
+  }
 }
 .normal-custom-table.mk-parity {
   .ant-table-tbody tr:nth-child(even) {
diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx
index 939347e..d174da9 100644
--- a/src/tabviews/custom/components/table/base-table/index.jsx
+++ b/src/tabviews/custom/components/table/base-table/index.jsx
@@ -73,6 +73,10 @@
       _config.setting.onload = 'false'
     }
 
+    if (setting.tableMode === 'fast') {
+      _config.lineMarks = null
+    }
+
     _config.style = _config.style || {}
 
     this.setState({
@@ -454,7 +458,7 @@
   /**
    * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級
    */
-  refreshbytable = (pagination, filters, sorter) => {
+  refreshbytable = (pagination, sorter) => {
     if (!sorter) { // 鏃犱汉鍊煎畧
       this.setState({
         pageIndex: pagination.pageIndex
diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index 0b77025..a801362 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -153,6 +153,10 @@
       _config.colsCtrls = null
     }
 
+    if (setting.$tree && _config.cols[0]) {
+      _config.cols[0].$tree = true
+    }
+
     let columns = _config.cols
     if (_config.hasExtend) {
       columns = this.getCols(_config.cols, BData, _config.setting.extendTime)
@@ -610,6 +614,10 @@
         return item
       })
 
+      if (setting.$tree && data.length) {
+        data = this.getTree(data)
+      }
+
       let total = result.total || 0
       if (config.setting.custompage && data.length) {
         total = data[data.length - 1].mk_total || 0
@@ -665,6 +673,90 @@
       
       UtilsDM.queryFail(result)
     }
+  }
+
+  getTree = (data) => {
+    const { setting } = this.state
+
+    let options = []
+    let pnodes = []
+    let _data = []
+
+    data.forEach(item => {
+      let pval = item[setting.parentField] + ''
+      let val = item[setting.valueField] + ''
+
+      if (pval === setting.mark) {
+        pnodes.push({
+          ...item,
+          $mk_floor: 1,
+          $key: val,
+          $pid: ''
+        })
+      } else if (pval) {
+        options.push({
+          ...item,
+          $mk_floor: 0,
+          $key: val,
+          $pid: pval
+        })
+      }
+    })
+
+    let get_tree = (parents) => {
+      parents.forEach(parent => {
+        parent.children = []
+
+        options = options.filter(option => {
+          if (option.$pid === parent.$key) {
+            option.$mk_floor = parent.$mk_floor + 1
+            option.$pkeys = parent.$pkeys ? [...parent.$pkeys, parent.$key] : [parent.$key]
+
+            parent.children.push(option)
+            return false
+          }
+          return true
+        })
+  
+        if (parent.children.length === 0) {
+          parent.children = null
+        } else {
+          parent.$open = true
+          parent.children = get_tree(parent.children)
+        }
+      })
+      return parents
+    }
+
+    let tree = get_tree(pnodes)
+
+    let get_data = (parents) => {
+      parents.forEach(parent => {
+        let children = parent.children
+
+        delete parent.children
+
+        _data.push(parent)
+  
+        if (children) {
+          get_data(children)
+        }
+      })
+    }
+
+    get_data(tree)
+
+    if (options.length) {
+      _data.push(...options)
+    }
+
+    _data = _data.map((item, index) => {
+      item.key = index
+      
+      return item
+    })
+
+    return _data
   }
 
   /**
@@ -825,7 +917,7 @@
   /**
    * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級
    */
-  refreshbytable = (pagination, filters, sorter) => {
+  refreshbytable = (pagination, sorter) => {
     if (sorter.order) {
       let _chg = {
         ascend: 'asc',
@@ -837,7 +929,7 @@
     this.setState({
       pageIndex: pagination.current,
       pageSize: pagination.pageSize,
-      orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : ''
+      orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : (pagination.fixed ? this.state.orderBy : '')
     }, () => {
       this.loadData()
     })
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index b11b3f9..e1871a4 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -702,6 +702,12 @@
           item.colsCtrls = null
         }
 
+        if (item.wrap.tree === 'true') {
+          item.setting.sync = 'false'
+          item.$cache = false
+          item.setting.$tree = true
+        }
+
         if (item.subtype === 'editable') {
           item.submit.logLabel = item.$menuname + '-鎻愪氦'
           item.submit.$menuId = item.uuid
@@ -922,6 +928,10 @@
 
           item.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript)
 
+          if (item.setting.$tree) {
+            item.setting.custompage = true
+          }
+
           if (!item.setting.execute || item.setting.custompage) {
             item.forbidLine = true
           }
diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx
index 7e8fca6..57197b5 100644
--- a/src/tabviews/custom/popview/index.jsx
+++ b/src/tabviews/custom/popview/index.jsx
@@ -420,6 +420,12 @@
           item.colsCtrls = null
         }
 
+        if (item.wrap.tree === 'true') {
+          item.setting.sync = 'false'
+          item.$cache = false
+          item.setting.$tree = true
+        }
+
         if (item.subtype === 'editable') {
           item.submit.logLabel = item.$menuname + '-鎻愪氦'
           item.submit.$menuId = item.uuid
@@ -618,6 +624,10 @@
 
           item.setting.custompage = /@pageSize@|@orderBy@|@mk_total/i.test(item.setting.dataresource + item.setting.customScript)
 
+          if (item.setting.$tree) {
+            item.setting.custompage = true
+          }
+          
           if (!item.setting.execute || item.setting.custompage) {
             item.forbidLine = true
           }
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index 84ea3d6..e204a75 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -180,6 +180,7 @@
       let modal = this.state.btnconfig
       if (!modal && btn.modal) {
         modal = this.handleModelConfig(btn.modal)
+        modal.uuid = btn.uuid
       }
 
       this.setState({
@@ -2129,6 +2130,7 @@
         } else {
           _LongParam = updateForm(_LongParam)
           _LongParam = this.handleModelConfig(_LongParam)
+          _LongParam.uuid = btn.uuid
 
           this.setState({
             btnconfig: _LongParam
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 297e360..7d0eff2 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -1928,7 +1928,7 @@
       _sql = _insertsql
     } else if (_actionType === 'update' || _actionType === 'audit') {
       _sql = _updatesql
-    } else if (_actionType === 'LogicDelete') { // 閫昏緫鍒犻櫎
+    } else if (_actionType === 'LogicDelete' || _actionType === 'custom') { // 閫昏緫鍒犻櫎
       let _ID = '=@ID@'
       if (btn.Ot === 'requiredOnce') {
         _ID = ' in (select ID from  dbo.SplitComma(@ID@))'
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 27a4c57..36ec3ff 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -4890,7 +4890,7 @@
     let DateCount = ''
     if (_dataresource) {
       /*system_query*/
-      if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql)) {
+      if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql) || (item.wrap && item.wrap.tree === 'true')) {
         LText = `select ${arr_field} from ${_dataresource} ${_search} `
       } else if (item.setting.laypage === 'true' && item.setting.order) {
         LText = `select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows `

--
Gitblit v1.8.0