From 68e178709892cf8bf95573def01cf29cf243c6e4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 十二月 2024 16:53:54 +0800
Subject: [PATCH] 2024-12-31

---
 src/views/syscheck/index.jsx  |  259 ++++++++++++++++++++++++------------
 src/views/syscheck/index.scss |  112 ++++-----------
 src/utils/utils-custom.js     |   38 ++--
 3 files changed, 226 insertions(+), 183 deletions(-)

diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 8058453..4cac796 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -6423,25 +6423,27 @@
 
   let keys = sqls.map(item => item.uuid)
   if (keys.length > Array.from(new Set(keys)).length && !window.GLOB.syscheck) {
-    let m = new Map()
-    let n = new Map()
-    sqls.forEach(item => {
-      if (m.has(item.uuid)) {
-        if (!n.has(item.uuid)) {
-          window.mkInfo(m.get(item.uuid))
-          n.set(item.uuid, true)
+    if (window.backend) {
+      let m = new Map()
+      let n = new Map()
+      sqls.forEach(item => {
+        if (m.has(item.uuid)) {
+          if (!n.has(item.uuid)) {
+            window.mkInfo(m.get(item.uuid))
+            n.set(item.uuid, true)
+          }
+          window.mkInfo(item)
+        } else {
+          m.set(item.uuid, item)
         }
-        window.mkInfo(item)
-      } else {
-        m.set(item.uuid, item)
-      }
-    })
-
-    notification.warning({
-      top: 92,
-      message: '瀛樺湪閲嶅鐨勫悗绔剼鏈琁D锛�',
-      duration: 5
-    })
+      })
+  
+      notification.warning({
+        top: 92,
+        message: '瀛樺湪閲嶅鐨勫悗绔剼鏈琁D锛�',
+        duration: 5
+      })
+    }
 
     return []
   }
diff --git a/src/views/syscheck/index.jsx b/src/views/syscheck/index.jsx
index 3c8d786..acee1d2 100644
--- a/src/views/syscheck/index.jsx
+++ b/src/views/syscheck/index.jsx
@@ -2,7 +2,7 @@
 import { fromJS } from 'immutable'
 import { Spin, notification, Button } from 'antd'
 import moment from 'moment'
-// import { QuestionCircleOutlined } from '@ant-design/icons'
+import { SwapOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -14,18 +14,19 @@
 
 class SysCheck extends Component {
   state = {
+    stop: false,
     loading: false,
     menulist: [],
-    thdMenuList: [],
-    applist: [],
+    activeMenu: null,
+    remain: 0,
     lackmenus: [],
     outmenus: [],
     backmenus: [],
+    appbackmenus: [],
     unablemenus: [],
   }
 
   sqlmap = null
-  repmap = null
 
   UNSAFE_componentWillMount() {
     document.body.className = ''
@@ -50,69 +51,66 @@
 
   getMenus = () => {
     this.setState({
+      stop: false,
+      activeMenu: null,
+      remain: 0,
+      menulist: [],
+      lackmenus: [],
+      outmenus: [],
+      backmenus: [],
+      appbackmenus: [],
+      unablemenus: [],
       loading: true
     })
     Api.getCloudConfig({func: 's_get_pc_menus', systemType: window.GLOB.sysType, debug: 'Y'}).then(result => {
       if (result.status) {
-        let thdMenuList = []
-        let menulist = result.fst_menu.map(fst => {
-          let fstItem = {
-            MenuID: fst.MenuID,
-            MenuName: fst.MenuName,
-            children: []
-          }
-    
+        let menulist = []
+        result.fst_menu.forEach(fst => {
           if (fst.snd_menu) {
-            fstItem.children = fst.snd_menu.map(snd => {
-              let sndItem = {
-                MenuID: snd.MenuID,
-                MenuName: snd.MenuName,
-                children: []
-              }
-    
+            fst.snd_menu.forEach(snd => {
               if (snd.trd_menu) {
-                sndItem.children = snd.trd_menu.map(trd => {
-                  let trdItem = {
+                snd.trd_menu.forEach(trd => {
+                  if (trd.PageParam) {
+                    let pass = false
+                    try {
+                      let PageParam = JSON.parse(trd.PageParam)
+                      if (PageParam && PageParam.Template === 'RolePermission') {
+                        pass = true
+                      }
+                    } catch (e) {
+
+                    }
+                    if (pass) return
+                  }
+
+                  menulist.push({
                     MenuID: trd.MenuID,
                     MenuName: trd.MenuName,
                     MenuNo: trd.MenuNo,
                     pName: fst.MenuName + '-' + snd.MenuName,
-                    type: 'CustomPage',
-                  }
-
-                  if (trd.PageParam) {
-                    try {
-                      trd.PageParam = JSON.parse(trd.PageParam)
-                      trdItem.type = trd.PageParam.Template || 'CustomPage'
-                    } catch (e) {
-
-                    }
-                  }
-
-                  thdMenuList.push(trdItem)
-
-                  return trdItem
+                  })
                 })
               }
-              return sndItem
             })
           }
-          return fstItem
         })
 
-        this.setState({
-          menulist,
-          thdMenuList
-        })
-
-        if (thdMenuList.length === 0) {
+        if (menulist.length === 0) {
           this.setState({
             loading: false
           })
+          notification.warning({
+            top: 92,
+            message: '鏈煡璇㈠埌鑿滃崟淇℃伅锛�',
+            duration: 5
+          })
         } else {
+          this.setState({
+            menulist
+          })
+
           this.sqlmap = new Map()
-          this.repmap = new Map()
-          this.getMenuParam(fromJS(thdMenuList).toJS())
+          this.getMenuParam(fromJS(menulist).toJS())
         }
       } else {
         this.setState({
@@ -133,6 +131,15 @@
     }
 
     this.setState({
+      stop: false,
+      activeMenu: null,
+      remain: 0,
+      menulist: [],
+      lackmenus: [],
+      outmenus: [],
+      backmenus: [],
+      appbackmenus: [],
+      unablemenus: [],
       loading: true
     })
 
@@ -157,6 +164,11 @@
           this.setState({
             loading: false
           })
+          notification.warning({
+            top: 92,
+            message: '鏈煡璇㈠埌鑿滃崟淇℃伅锛�',
+            duration: 5
+          })
         } else {
           let deffers = applist.map((app, i) =>
             new Promise(resolve => {
@@ -173,15 +185,9 @@
 
               setTimeout(() => {
                 Api.getCloudConfig(param).then(result => {
-                  delete result.ErrCode
-                  delete result.ErrMesg
-
                   if (result.status) {
-                    result = {
-                      ...app,
-                      status: true,
-                      menus: []
-                    }
+                    app.status = true
+                    app.menus = []
 
                     result.menus.forEach(m => {
                       if (m.menus_rolelist) {
@@ -197,11 +203,12 @@
                       }
                       delete m.menus_rolelist
                       
-                      result.menus.push(m)
+                      app.menus.push(m)
                     })
+                    resolve(app)
+                  } else {
+                    resolve(result)
                   }
-  
-                  resolve(result)
                 })
               }, 200 * i)
             })
@@ -219,11 +226,36 @@
                 loading: false
               })
             } else {
-              let list = response.filter(cell => cell.menus.length > 0)
-              this.setState({
-                loading: false,
-                applist: list
+              let list = []
+              response.forEach(item => {
+                item.menus.forEach(cell => {
+                  list.push({
+                    ...cell,
+                    lang: item.lang,
+                    kei_no: item.kei_no,
+                    typename: item.typename,
+                    pName: `${item.name}锛�${item.typename} / ${item.lang}锛塦,
+                  })
+                })
               })
+
+              if (list.length === 0) {
+                this.setState({
+                  loading: false
+                })
+                notification.warning({
+                  top: 92,
+                  message: '鏈煡璇㈠埌鑿滃崟淇℃伅锛�',
+                  duration: 5
+                })
+              } else {
+                this.setState({
+                  menulist: list
+                })
+
+                this.sqlmap = new Map()
+                this.getMenuParam(fromJS(list).toJS())
+              }
             }
           })
         }
@@ -241,15 +273,25 @@
   }
 
   getMenuParam = (menus) => {
-    const { lackmenus, outmenus, unablemenus, backmenus } = this.state
+    const { lackmenus, outmenus, unablemenus, backmenus, appbackmenus, stop } = this.state
 
     let menu = menus.shift()
-    const { MenuID } = menu
 
     let param = {
       func: 'sPC_Get_LongParam',
-      MenuID: MenuID
+      MenuID: menu.MenuID
     }
+
+    if (menu.kei_no) {
+      param.TypeCharOne = menu.kei_no
+      param.typename = menu.typename
+      param.lang = menu.lang
+    }
+
+    this.setState({
+      activeMenu: menu,
+      remain: menus.length
+    })
 
     Api.getCloudConfig(param).then(result => {
       if (result.status) {
@@ -264,9 +306,9 @@
 
         if (!config) {
           this.setState({lackmenus: [...lackmenus, menu]})
-        } else if (!['CustomPage', 'BaseTable'].includes(config.Template)) {
+        } else if (!menu.kei_no && !['CustomPage', 'BaseTable'].includes(config.Template)) {
           this.setState({outmenus: [...outmenus, menu]})
-        } else if (config.Template === 'CustomPage' && config.version !== 2.0) {
+        } else if (!menu.kei_no && config.Template === 'CustomPage' && config.version !== 2.0) {
           menu.version = config.version
           this.setState({outmenus: [...outmenus, menu]})
         } else if (!config.enabled) {
@@ -275,21 +317,40 @@
           let sqls = getAllSqls(config)
           let keys = sqls.map(item => item.uuid)
 
-          sqls.forEach(item => {
-            if (this.sqlmap.has(item.uuid)) {
-              if (!this.repmap.has(item.uuid)) {
-                this.repmap.set(item.uuid, menu)
-              }
-            } else {
-              this.sqlmap.set(item.uuid, menu)
-            }
-          })
-
           if (keys.length > Array.from(new Set(keys)).length) {
             this.setState({backmenus: [...backmenus, menu]})
+          } else {
+            let repeat = false
+            let premenu = null
+            sqls.forEach(item => {
+              if (this.sqlmap.has(item.uuid)) {
+                window.mkInfo(item)
+                if (repeat) return
+                repeat = true
+                premenu = this.sqlmap.get(item.uuid)
+              } else {
+                this.sqlmap.set(item.uuid, menu)
+              }
+            })
+            if (premenu) {
+              this.setState({appbackmenus: [...appbackmenus, [premenu, menu]]})
+            }
           }
         }
+
+        if (menus.length > 0 && !stop) {
+          setTimeout(() => {
+            this.getMenuParam(menus)
+          }, 200)
+        } else {
+          this.setState({
+            loading: false
+          })
+        }
       } else {
+        this.setState({
+          loading: false
+        })
         notification.warning({
           top: 92,
           message: result.message,
@@ -300,23 +361,51 @@
   }
 
   render () {
-    const { loading } = this.state
+    const { loading, activeMenu, menulist, remain, lackmenus, outmenus, unablemenus, backmenus, appbackmenus } = this.state
 
     if (!sessionStorage.getItem('UserID')) return null
 
     return (
       <div className="mk-app-check">
         <Header view="manage" />
-        {loading ?
-          <div className="loading-mask">
-            <Spin size="large" />
-          </div> : null
-        }
+        {loading ? <Spin size="large" /> : null}
         <div className="view-wrap">
-          <div>
-            <Button disabled={loading} type="primary" style={{marginRight: '15px'}} onClick={this.getMenus}>妫�鏌ョ鐞嗙郴缁熻彍鍗�</Button>
-            <Button disabled={loading} type="primary" onClick={this.getAppList}>妫�鏌ュ瓙搴旂敤鑿滃崟</Button>
+          <div className="action">
+            <Button disabled={loading} style={{marginRight: '15px'}} onClick={this.getMenus}>妫�鏌ョ鐞嗙郴缁熻彍鍗�</Button>
+            <Button disabled={loading} style={{marginRight: '15px'}} onClick={this.getAppList}>妫�鏌ュ瓙搴旂敤鑿滃崟</Button>
+            <Button onClick={() => this.setState({stop: true})}>鍋滄</Button>
           </div>
+          {activeMenu ? <div className="menu-msg">褰撳墠鑿滃崟锛歿activeMenu.MenuName} <span></span> {activeMenu.pName} <span></span> 杩涘害锛坽menulist.length - remain} / {menulist.length}锛�</div> : null}
+          {lackmenus.length ? <div className="item-wrap">
+            <div className="title">鑿滃崟閰嶇疆涓嶅瓨鍦�</div>
+            {lackmenus.map((item, i) => {
+              return <div key={i}>{item.MenuName} <span></span> {item.pName}</div>
+            })}
+          </div> : null}
+          {outmenus.length ? <div className="item-wrap">
+            <div className="title">鑿滃崟閰嶇疆闇�瑕佸崌绾�</div>
+            {outmenus.map((item, i) => {
+              return <div key={i}>{item.MenuName} <span></span> {item.pName}</div>
+            })}
+          </div> : null}
+          {unablemenus.length ? <div className="item-wrap">
+            <div className="title">鑿滃崟鏈惎鐢�</div>
+            {unablemenus.map((item, i) => {
+              return <div key={i}>{item.MenuName} <span></span> {item.pName}</div>
+            })}
+          </div> : null}
+          {backmenus.length ? <div className="item-wrap">
+            <div className="title">鑿滃崟鍚庣鑴氭湰ID閲嶅</div>
+            {backmenus.map((item, i) => {
+              return <div key={i}>{item.MenuName} <span></span> {item.pName}</div>
+            })}
+          </div> : null}
+          {appbackmenus.length ? <div className="item-wrap">
+            <div className="title">鑿滃崟鍚庣鑴氭湰ID閲嶅锛堣彍鍗曢棿锛�</div>
+            {appbackmenus.map((item, i) => {
+              return <div key={i}>{item[0].MenuName} <span></span> {item[0].pName} <SwapOutlined /> {item[1].MenuName} <span></span> {item[1].pName}</div>
+            })}
+          </div> : null}
         </div>
       </div>
     )
diff --git a/src/views/syscheck/index.scss b/src/views/syscheck/index.scss
index 0b78ef2..d12dea7 100644
--- a/src/views/syscheck/index.scss
+++ b/src/views/syscheck/index.scss
@@ -3,97 +3,49 @@
   min-height: 100vh;
   padding: 70px 30px;
 
-  .loading-mask {
+  .ant-spin {
     position: fixed;
-    top: 0px;
-    bottom: 0px;
-    left: 0px;
-    right: 0px;
     z-index: 2;
-    background: rgba(255, 255, 255, 0.35);
-
-    .ant-spin {
-      position: absolute;
-      left: 50%;
-      top: 50%;
-    }
+    left: calc(50% - 22px);
+    top: 50%;
   }
   .view-wrap {
     width: 100%;
     position: relative;
-    display: flex;
 
-    .left-view {
-      flex: 1;
-      width: 60%;
-      padding-right: 5px;
-      .app-table {
-        padding-top: 30px;
+    .action {
+      .ant-btn {
+        color: #fff!important;
+        background-color: #1890ff!important;
+        border-color: #1890ff!important;
       }
     }
-    .right-view {
-      width: 40%;
-      padding-left: 20px;
-
-      .app-title {
-        font-size: 16px;
-        font-weight: 500;
-        height: 30px;
-        line-height: 30px;
-        border-bottom: 1px solid #d8d8d8;
-        margin-bottom: 17px;
-      }
-      .sub-app {
-        margin: 10px 10px 25px;
-        border: 1px solid #e8e8e8;
-        height: 210px;
-        border-radius: 4px;
-        padding-top: 10px;
-
-        .app-item {
-          height: 30px;
-          line-height: 30px;
-          div {
-            display: inline-block;
-            white-space: nowrap;
-            overflow: hidden;
-            white-space: nowrap;
-            text-overflow: ellipsis;
-            line-height: 30px;
-          }
-          .label {
-            width: 40%;
-            text-align: right;
-            color: rgba(0, 0, 0, 0.65);
-          }
-          .content {
-            width: 60%;
-            padding-left: 10px;
-            color: rgba(0, 0, 0, 0.85);
-          }
-        }
-        .action {
-          text-align: right;
-          padding: 5px 20px;
-          margin-top: 5px;
-          border-top: 1px solid #e8e8e8;
-
-          .ant-typography-copy {
-            color: #26C281;
-          }
-        }
+    .menu-msg {
+      margin-top: 15px;
+      color: #1890ff;
+      span {
+        display: inline-block;
+        width: 20px;
+        height: 15px;
       }
     }
-  }
-  .ant-table-wrapper {
-    .ant-table-body {
-      border: 1px solid #e8e8e8;
-      border-bottom: 0;
-      border-radius: 4px;
-    }
-    .ant-table-tbody {
-      > tr.ant-table-row-selected td {
-        background: #bae7ff;
+    .item-wrap {
+      width: 50%;
+      display: inline-block;
+      margin-top: 30px;
+      color: rgba(0, 0, 0, 0.85);
+      vertical-align: top;
+      .title {
+        color: #1890ff;
+        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
+        margin-bottom: 10px;
+        margin-right: 20px;
+        padding-bottom: 5px;
+      }
+      span {
+        display: inline-block;
+        width: 20px;
+        height: 15px;
       }
     }
   }

--
Gitblit v1.8.0