From ac1d52c46ff9019fcc93cf3d5e7ab17cf850824e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 八月 2023 16:05:24 +0800
Subject: [PATCH] 2023-08-10

---
 src/menu/components/share/usercomponent/index.jsx |   90 +++++++++++++++++++++++----------------------
 1 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/src/menu/components/share/usercomponent/index.jsx b/src/menu/components/share/usercomponent/index.jsx
index 8a8aaf5..d3cec9a 100644
--- a/src/menu/components/share/usercomponent/index.jsx
+++ b/src/menu/components/share/usercomponent/index.jsx
@@ -1,25 +1,23 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Icon, Modal, notification } from 'antd'
+import { Modal, notification } from 'antd'
+import { UserOutlined } from '@ant-design/icons'
 import html2canvas from 'html2canvas'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
+import options from '@/store/options.js'
 import UserForm from './settingform'
 import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
-class DataSource extends Component {
+class UserComponent extends Component {
   static propTpyes = {
-    btnlog: PropTypes.array,
-    handlelog: PropTypes.func
+    config: PropTypes.object
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     visible: false,
     loading: false,
     name: '',
@@ -84,36 +82,30 @@
       return item
     })
 
-    _config.cols = _config.cols.map(col => {
-      if (col.type === 'colspan' && col.subcols) {
-        col = this.loopCol(col)
-      } else if (col.type === 'custom' && col.elements) {
-        col.elements = col.elements.map(cell => this.resetElement(cell))
-      } else if (col.type === 'action' && col.elements) {
-        col.elements = col.elements.map(cell => {
-          cell.verify = null
-          return cell
-        })
-      }
-      col.marks = null
-      return col
-    })
+    let loopCol = (cols) => {
+      return cols.map(col => {
+        col.uuid = Utils.getuuid()
+        col.marks = null
+
+        if (col.type === 'colspan' && col.subcols) {
+          col.subcols = loopCol(col.subcols)
+        } else if (col.type === 'custom' && col.elements) {
+          col.elements = col.elements.map(cell => {
+            if (cell.eleType === 'button') {
+              cell.verify = null
+            } else {
+              cell = this.resetElement(cell)
+            }
+            return cell
+          })
+        }
+        return col
+      })
+    }
+
+    _config.cols = loopCol(_config.cols)
 
     return _config
-  }
-
-  loopCol = (col) => {
-    col.subcols = col.subcols.map(c => {
-      if (c.type === 'colspan' && c.subcols) {
-        c = this.loopCol(c)
-      } else if (c.type === 'custom' && c.elements) {
-        c.elements = c.elements.map(cell => this.resetElement(cell))
-      }
-      c.marks = null
-      return c
-    })
-
-    return col
   }
 
   resetElement = (item) => {
@@ -145,15 +137,26 @@
       document.getElementsByClassName('menu-view')[0].classList.add('saving')
       this.setState({loading: true})
       setTimeout(() => {
-        let template = this.getUserComponent()
+        // let template = this.getUserComponent()
+        let template = fromJS(config).toJS()
         html2canvas(document.getElementById(config.uuid)).then(canvas => {
-          let img = canvas.toDataURL('image/png') // 鑾峰彇鐢熸垚鐨勫浘鐗�
-          Api.fileuploadbase64(img, 'cloud').then(result => {
+          let param = {
+            Base64Img: canvas.toDataURL('image/png') // 鑾峰彇鐢熸垚鐨勫浘鐗�
+          }
+
+          if (options.cloudServiceApi) {
+            param.rduri = options.cloudServiceApi
+            param.userid = sessionStorage.getItem('CloudUserID') || ''
+            param.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
+          }
+
+          Api.fileuploadbase64(param).then(result => {
             if (result.status) {
-              Api.getSystemConfig({
+              Api.getCloudConfig({
                 func: 's_custom_components_adduptdel',
                 c_id: config.uuid,
                 images: Utils.getcloudurl(result.Images),
+                typename: sessionStorage.getItem('appType') || '',
                 c_name: res.name,
                 long_param: window.btoa(window.encodeURIComponent(JSON.stringify(template))),
                 del_type: ''
@@ -196,13 +199,12 @@
   }
 
   render () {
-    const { visible, dict, loading, name } = this.state
+    const { visible, loading, name } = this.state
 
     return (
       <div className="user-component-wrap">
-        <Icon type="user" title="鐢熸垚鑷畾涔夌粍浠�" onClick={this.trigger} />
+        <UserOutlined title="鐢熸垚鑷畾涔夌粍浠�" onClick={this.trigger} />
         <Modal
-          wrapClassName="popview-modal"
           title="鑷畾涔夌粍浠�"
           visible={visible}
           width={500}
@@ -212,11 +214,11 @@
           onCancel={this.cancel}
           destroyOnClose
         >
-          <UserForm dict={dict} name={name} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/>
+          <UserForm name={name} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/>
         </Modal>
       </div>
     )
   }
 }
 
-export default DataSource
\ No newline at end of file
+export default UserComponent
\ No newline at end of file

--
Gitblit v1.8.0