From 063b983daaf51a7f1e8677bde1e9c0e618866c91 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 二月 2020 10:30:19 +0800
Subject: [PATCH] 2020-02-21

---
 src/components/header/editmenu/index.jsx |   78 +++++++++++++++++++++++++--------------
 1 files changed, 50 insertions(+), 28 deletions(-)

diff --git a/src/components/header/editmenu/index.jsx b/src/components/header/editmenu/index.jsx
index 1a4c061..52528e2 100644
--- a/src/components/header/editmenu/index.jsx
+++ b/src/components/header/editmenu/index.jsx
@@ -4,12 +4,14 @@
 import { DndProvider } from 'react-dnd'
 import HTML5Backend from 'react-dnd-html5-backend'
 import { notification, Modal, Button, Spin } from 'antd'
+import moment from 'moment'
 import TransferForm from '@/components/transferform'
 import DragElement from '../dragelement'
 import MenuForm from '../menuform'
-import Api from '@/api'
+import Utils from '@/utils/utils.js'
 import zhCN from '@/locales/zh-CN/header.js'
 import enUS from '@/locales/en-US/header.js'
+import Api from '@/api'
 import './index.scss'
 
 const { confirm } = Modal
@@ -61,7 +63,7 @@
       this.setState({
         confirmLoading: true
       })
-      Api.submitInterface(param).then(res => {
+      Api.getSystemConfig(param).then(res => {
         if (res.status) {
           this.setState({
             confirmLoading: false,
@@ -96,18 +98,16 @@
     // 鏂板缓鑿滃崟锛氭彁浜�
     this.addMenuFormRef.handleConfirm().then(param => {
       param.func = 'sPC_MainMenu_Add'
-      param.Sort = (this.state.menulist.length + 1) * 10
+      param.Sort = (this.props.menulist.length + 1) * 10
       this.setState({
         confirmLoading: true
       })
-      Api.submitInterface(param).then(res => {
+      Api.getSystemConfig(param).then(res => {
         if (res.status) {
           this.setState({
             confirmLoading: false,
             addMvisible: false,
-            menulist: null
           })
-          this.addMenuFormRef.handleReset('add')
           this.props.reload()
         } else {
           this.setState({
@@ -129,7 +129,6 @@
       confirmLoading: false,
       addMvisible: false
     })
-    this.addMenuFormRef.handleReset('add')
   }
 
   deleteMemu = () => {
@@ -144,12 +143,11 @@
           func: 'sPC_MainMenu_Del',
           MenuID: _this.state.editMenu.MenuID
         }
-        return Api.submitInterface(param).then(res => {
+        return Api.getSystemConfig(param).then(res => {
           if (res.status) {
             _this.setState({
               editMvisible: false,
               editMenu: null,
-              menulist: null
             })
             _this.props.reload()
           } else {
@@ -178,7 +176,7 @@
       })
       let defers = this.refs.trawmenu.state.targetKeys.map(item => {
         return new Promise((resolve) => {
-          Api.submitInterface({
+          Api.getSystemConfig({
             func: 'sPC_MainMenu_ReDel',
             MenuID: item
           }).then(res => {
@@ -233,20 +231,25 @@
       })
     } else if (type === 'confirm' && _menuchange) {
       let _this = this
-      let param  = {}
-      param.func = 'sPC_Menu_SortUpt'
-      param.LText = []
-      previewList.forEach((item, index) => {
-        param.LText.push('selectmspace\'' + item.MenuID + '\'mspaceasmspaceMenuid,' + (index + 1) * 10 + 'mspaceasmspacesort')
-      })
-      param.LText = param.LText.join('mspaceunionmspace')
+      let param  = {
+        func: 'sPC_Menu_SortUpt',
+        LText: previewList.map((item, index) => {
+          return 'select \'' + item.MenuID + '\' as Menuid,' + (index + 1) * 10 + ' as sort'
+        })
+      }
+
+      param.LText = param.LText.join(' union ') // sql鎷兼帴
+      param.LText = Utils.formatOptions(param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑
+      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 鏃堕棿鎴�
+      param.secretkey = Utils.encrypt(param.LText, param.timestamp) // md5瀵嗛挜
+
       confirm({
         title: this.state.dict['header.menu.resetorder'],
         content: '',
         okText: this.state.dict['header.confirm'],
         cancelText: this.state.dict['header.cancel'],
         onOk() {
-          return Api.submitInterface(param).then(res => {
+          return Api.getSystemConfig(param).then(res => {
             if (res.status) {
               _this.props.reload()
             } else {
@@ -264,7 +267,7 @@
       this.setState({
         thawMvisible: true
       })
-      Api.submitInterface({
+      Api.getSystemConfig({
         func: 'sPC_Get_FrozenMenu',
         ParentID: '0',
         TYPE: 10
@@ -304,7 +307,26 @@
   render () {
     return (
       <div className="header-edit-box">
-        <div className="mask"></div>
+        <div className="mask">
+          <div className="tipcard card1">
+            鎷栧姩涓�绾ц彍鍗曞彲璋冩暣椤哄簭锛岄『搴忚皟鏁村悗锛岃鐐瑰嚮纭畾鎸夐挳淇濆瓨銆�
+          </div>
+          <div className="tipcard card2">
+            榧犳爣缁忚繃鑿滃崟鏃朵細鏄剧ず缂栬緫鍥炬爣锛岀偣鍑荤紪杈戝彲淇敼鍜屽垹闄よ彍鍗曘��
+          </div>
+          <div className="tipcard card3">
+            鐐瑰嚮瑙i櫎鍐荤粨鎸夐挳锛屽彲杩樺師宸插垹闄ょ殑涓�绾ц彍鍗曘��
+          </div>
+          <div className="tipcard card4">
+            鐐瑰嚮娣诲姞鍥炬爣锛屽彲鏂板涓�绾ц彍鍗曘��
+          </div>
+          <div className="tipcard card5">
+            <p>缂栬緫鐘舵�佷腑锛岃彍鍗曚箣澶栧尯鍩熶細閿佸畾锛屾煡鐪嬬郴缁熸暟鎹鐐瑰嚮銆�</p>
+            <div>
+              <a target="blank" href="#/main" >鏂伴〉闈�</a>
+            </div>
+          </div>
+        </div>
         {this.props.menulist && <DndProvider backend={HTML5Backend}>
           <DragElement
             dict={this.state.dict}
@@ -323,6 +345,7 @@
           onOk={this.addMemuSubmit}
           confirmLoading={this.state.confirmLoading}
           onCancel={this.addMemuCancel}
+          destroyOnClose
         >
           <MenuForm
             dict={this.state.dict}
@@ -340,6 +363,7 @@
           onOk={this.thawMemuSubmit}
           confirmLoading={this.state.confirmLoading}
           onCancel={this.thawMemuCancel}
+          destroyOnClose
         >
           {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />}
           {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>}
@@ -347,11 +371,14 @@
         {/* 缂栬緫鑿滃崟妯℃�佹 */}
         <Modal
           title={this.state.dict['header.menu.editTitle']}
-          okText={this.state.dict['header.confirm']}
-          cancelText={this.state.dict['header.cancel']}
           visible={this.state.editMvisible}
-          footer={null}
+          footer={[
+            <Button key="cancel" onClick={this.editMemuCancel}>{this.state.dict['header.cancel']}</Button>,
+            <Button key="confirm" type="primary" onClick={this.editMemuSubmit} loading={this.state.confirmLoading}>{this.state.dict['header.confirm']}</Button>,
+            <Button key="delete" type="danger" onClick={this.deleteMemu}>{this.state.dict['header.delete']}</Button>
+          ]}
           onCancel={this.editMemuCancel}
+          destroyOnClose
         >
           <MenuForm
             dict={this.state.dict}
@@ -359,11 +386,6 @@
             menu={this.state.editMenu}
             wrappedComponentRef={(inst) => this.editMenuFormRef = inst}
           />
-          <div className="edit-modal-footer">
-            <Button onClick={this.editMemuCancel}>{this.state.dict['header.cancel']}</Button>
-            <Button type="primary" onClick={this.editMemuSubmit} loading={this.state.confirmLoading}>{this.state.dict['header.confirm']}</Button>
-            <Button type="danger" onClick={this.deleteMemu}>{this.state.dict['header.delete']}</Button>
-          </div>
         </Modal>
       </div>
     )

--
Gitblit v1.8.0