From dbf30d9cf36e5356e12e8447662ead83edad396e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 11 三月 2023 17:50:28 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/modalconfig/index.jsx |   80 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx
index 7ed61f4..c0da35b 100644
--- a/src/menu/modalconfig/index.jsx
+++ b/src/menu/modalconfig/index.jsx
@@ -4,8 +4,8 @@
 import { DndProvider } from 'react-dnd'
 import HTML5Backend from 'react-dnd-html5-backend'
 import moment from 'moment'
-import { Button, Card, Modal, Collapse, notification, Switch } from 'antd'
-import { SettingOutlined } from '@ant-design/icons'
+import { Button, Card, Modal, Collapse, notification, Switch, message } from 'antd'
+import { SettingOutlined, CopyOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -265,7 +265,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 
@@ -456,8 +456,44 @@
     })
   }
 
-  plusFields = (items) => {
+  plusFields = (items, type) => {
     let _config = fromJS(this.state.config).toJS()
+
+    if (type === 'forms') {
+      if (_config.fields.length > 0) {
+        let that = this
+        _config.fields = items.fields.map(item => {
+          item.uuid = Utils.getuuid()
+          return item
+        })
+
+        confirm({
+          title: '纭畾鏇挎崲琛ㄥ崟鍚楋紵',
+          content: '鍘熻〃鍗曞皢鍒犻櫎銆�',
+          onOk() {
+            that.setState({
+              config: _config
+            })
+          },
+          onCancel() {}
+        })
+      } else {
+        _config.fields = items.fields.map(item => {
+          item.uuid = Utils.getuuid()
+          return item
+        })
+
+        this.setState({
+          config: _config
+        })
+        notification.success({
+          top: 92,
+          message: '绮樿创鎴愬姛锛�',
+          duration: 2
+        })
+      }
+      return
+    }
 
     _config.fields.push(...items)
 
@@ -468,6 +504,39 @@
         this.handleForm(items[0])
       }
     })
+  }
+
+  triggerCopy = () => {
+    const { config } = this.state
+
+    let val = {
+      copyType: 'forms',
+      fields: config.fields || []
+    }
+
+    if (val.fields.length === 0) {
+      message.warning('琛ㄥ崟鍏冪礌涓嶅彲涓虹┖锛�')
+      return
+    }
+
+    try {
+      val = window.btoa(window.encodeURIComponent(JSON.stringify(val)))
+    } catch (e) {
+      console.warn(e)
+      message.warning('澶嶅埗澶辫触锛岃閲嶈瘯锛�')
+      val = ''
+    }
+
+    if (val) {
+      let oInput = document.createElement('input')
+      oInput.value = val
+      document.body.appendChild(oInput)
+      oInput.select()
+      document.execCommand('Copy')
+      document.body.removeChild(oInput)
+
+      message.success('澶嶅埗鎴愬姛銆�')
+    }
   }
 
   render () {
@@ -493,7 +562,7 @@
             <Card title="琛ㄥ崟閰嶇疆" bordered={false} extra={
               <div>
                 <Button type="danger" onClick={this.clearConfig}>娓呯┖</Button>
-                <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/>
+                <EditComponent options={['form', 'forms']} type="formboard" config={this.state.config} plusFields={this.plusFields}/>
                 <Button type="primary" id="save-modal-config" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button>
                 <Button onClick={this.cancelConfig}>杩斿洖</Button>
               </div>
@@ -506,6 +575,7 @@
                   <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button>
                   <Button className="mk-cols-change" onClick={() => this.changecols(3)}>3鍒�</Button>
                   <Button className="mk-cols-change" onClick={() => this.changecols(4)}>4鍒�</Button>
+                  <CopyOutlined title="澶嶅埗" onClick={this.triggerCopy} />
                   <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} />
                 </div>
                 <div className="ant-modal-body">

--
Gitblit v1.8.0