From 80deba0c2dcffd9e6b6f07815c7c52199309ce42 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 23 六月 2025 17:36:03 +0800 Subject: [PATCH] 2025-06-23 --- src/views/syscheck/index.jsx | 884 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 795 insertions(+), 89 deletions(-) diff --git a/src/views/syscheck/index.jsx b/src/views/syscheck/index.jsx index 3c8d786..dfe1de8 100644 --- a/src/views/syscheck/index.jsx +++ b/src/views/syscheck/index.jsx @@ -1,35 +1,44 @@ import React, {Component} from 'react' import { fromJS } from 'immutable' -import { Spin, notification, Button } from 'antd' +import { Spin, notification, Button, Modal } from 'antd' +import { SwapOutlined } from '@ant-design/icons' import moment from 'moment' -// import { QuestionCircleOutlined } from '@ant-design/icons' +import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' import asyncComponent from '@/utils/asyncComponent' -import { getAllSqls } from '@/utils/utils-custom.js' import './index.scss' const Header = asyncComponent(() => import('./header')) +const { confirm } = Modal class SysCheck extends Component { state = { + stop: false, loading: false, menulist: [], - thdMenuList: [], - applist: [], + activeMenu: null, + remain: 0, lackmenus: [], + lacklinks: [], outmenus: [], backmenus: [], + appbackmenus: [], + btnmenus: [], + appbtnmenus: [], unablemenus: [], } sqlmap = null - repmap = null + btnmap = null + allMenus = [] + appMenus = {} + + // delete _val.controlField 鍒犻櫎鎸夐挳鎺у埗瀛楁 UNSAFE_componentWillMount() { document.body.className = '' - window.GLOB.syscheck = true } componentDidMount() { @@ -50,69 +59,101 @@ getMenus = () => { this.setState({ + stop: false, + activeMenu: null, + remain: 0, + menulist: [], + lackmenus: [], + lacklinks: [], + outmenus: [], + backmenus: [], + appbackmenus: [], + btnmenus: [], + appbtnmenus: [], + unablemenus: [], loading: true }) + + this.allMenus = [] 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 => { + this.allMenus.push(trd.MenuID) + + 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.sqlmap = new Map() - this.repmap = new Map() - this.getMenuParam(fromJS(thdMenuList).toJS()) + this.btnmap = new Map() + + let errlist = sessionStorage.getItem('syscheck_main') + errlist = errlist ? JSON.parse(errlist) : null + + if (!errlist) { + this.setState({ + menulist + }) + this.getMenuParam(fromJS(menulist).toJS()) + } else { + const that = this + confirm({ + title: '鏄惁璺宠繃妫�鏌ュ悎鏍艰彍鍗曪紵', + content: '', + okText: '璺宠繃', + cancelText: '涓嶈烦杩�', + onOk() { + menulist = menulist.filter(item => errlist.includes(item.MenuID)) + + that.setState({ + menulist + }) + that.getMenuParam(fromJS(menulist).toJS()) + }, + onCancel() { + that.setState({ + menulist + }) + that.getMenuParam(fromJS(menulist).toJS()) + } + }) + } } } else { this.setState({ @@ -133,9 +174,23 @@ } this.setState({ + stop: false, + activeMenu: null, + remain: 0, + menulist: [], + lackmenus: [], + lacklinks: [], + outmenus: [], + backmenus: [], + appbackmenus: [], + btnmenus: [], + appbtnmenus: [], + unablemenus: [], loading: true }) + this.allMenus = [] + this.appMenus = {} Api.getCloudConfig(param).then(result => { if (result.status) { let applist = [] @@ -157,6 +212,11 @@ this.setState({ loading: false }) + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌鑿滃崟淇℃伅锛�', + duration: 5 + }) } else { let deffers = applist.map((app, i) => new Promise(resolve => { @@ -173,17 +233,15 @@ 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 = [] + + this.appMenus[app.ID] = [] result.menus.forEach(m => { + this.appMenus[app.ID].push(m.MenuID) + if (m.menus_rolelist) { try { let pageParam = JSON.parse(window.decodeURIComponent(window.atob(m.menus_rolelist))) @@ -196,12 +254,14 @@ if (m.type === 'navbar') return } delete m.menus_rolelist + m.$pid = app.ID - result.menus.push(m) + app.menus.push(m) }) + resolve(app) + } else { + resolve(result) } - - resolve(result) }) }, 200 * i) }) @@ -219,11 +279,64 @@ 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.sqlmap = new Map() + this.btnmap = new Map() + + let errlist = sessionStorage.getItem('syscheck_app') + errlist = errlist ? JSON.parse(errlist) : null + + if (!errlist) { + this.setState({ + menulist: list + }) + this.getMenuParam(fromJS(list).toJS()) + } else { + const that = this + confirm({ + title: '鏄惁璺宠繃妫�鏌ュ悎鏍艰彍鍗曪紵', + content: '', + okText: '璺宠繃', + cancelText: '涓嶈烦杩�', + onOk() { + list = list.filter(item => errlist.includes(item.MenuID)) + + that.setState({ + menulist: list + }) + that.getMenuParam(fromJS(list).toJS()) + }, + onCancel() { + that.setState({ + menulist: list + }) + that.getMenuParam(fromJS(list).toJS()) + } + }) + } + } } }) } @@ -241,15 +354,33 @@ } getMenuParam = (menus) => { - const { lackmenus, outmenus, unablemenus, backmenus } = this.state + const { lackmenus, lacklinks, outmenus, unablemenus, backmenus, appbackmenus, btnmenus, appbtnmenus, stop } = this.state let menu = menus.shift() - const { MenuID } = menu let param = { func: 'sPC_Get_LongParam', - MenuID: MenuID + MenuID: menu.MenuID } + + let appType = 'admin' + if (menu.kei_no) { + param.TypeCharOne = menu.kei_no + param.typename = menu.typename + param.lang = menu.lang + + appType = 'pc' + if (['pad', 'mob'].includes(menu.typename)) { + appType = 'mob' + } + + this.allMenus = this.appMenus[menu.$pid] || [] + } + + this.setState({ + activeMenu: menu, + remain: menus.length + }) Api.getCloudConfig(param).then(result => { if (result.status) { @@ -264,32 +395,90 @@ 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) { this.setState({unablemenus: [...unablemenus, menu]}) } else { - let sqls = getAllSqls(config) - let keys = sqls.map(item => item.uuid) + let sqls = [] + let btns = [] + let links = [] - sqls.forEach(item => { - if (this.sqlmap.has(item.uuid)) { - if (!this.repmap.has(item.uuid)) { - this.repmap.set(item.uuid, menu) - } + this.getAllSqls(config, appType, sqls, btns, links) + + if (links.length) { + links.forEach(item => { + window.mkInfo(menu.pName + '锛�' + item) + }) + this.setState({lacklinks: [...lacklinks, menu]}) + } + + if (sqls.length) { + let keys = sqls.map(item => item.uuid) + + if (keys.length > Array.from(new Set(keys)).length) { + this.setState({backmenus: [...backmenus, menu]}) } else { - this.sqlmap.set(item.uuid, menu) + 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 (keys.length > Array.from(new Set(keys)).length) { - this.setState({backmenus: [...backmenus, menu]}) + if (btns.length) { + let keys = btns.map(item => item.uuid) + if (keys.length > Array.from(new Set(keys)).length) { + this.setState({btnmenus: [...btnmenus, menu]}) + } else { + let repeat = false + let premenu = null + btns.forEach(item => { + if (this.btnmap.has(item.uuid)) { + window.mkInfo(item) + if (repeat) return + repeat = true + premenu = this.btnmap.get(item.uuid) + } else { + this.btnmap.set(item.uuid, menu) + } + }) + if (premenu) { + this.setState({appbtnmenus: [...appbtnmenus, [premenu, menu]]}) + } + } } } + + if (menus.length > 0 && !stop) { + setTimeout(() => { + this.getMenuParam(menus) + }, 200) + } else { + this.setState({ + loading: false + }, () => { + this.record(menu.kei_no ? 'app' : '') + }) + } } else { + this.setState({ + loading: false + }) notification.warning({ top: 92, message: result.message, @@ -299,24 +488,541 @@ }) } + getAllSqls = (config, appType, sqls, btns, links) => { + let filterComponent = (components, label = '') => { + components.forEach(item => { + item.$menuname = (config.MenuName || '') + label + '-' + (item.name || '') + + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + filterComponent(tab.components, label) + }) + } else if (item.type === 'group') { + filterComponent(item.components, label) + } else { + if (item.wrap && item.setting) { + if (item.wrap.datatype === 'public' || item.wrap.datatype === 'static') { + item.setting.interType = 'other' + } + } + + if (appType === 'mob' && item.type !== 'search' && item.type !== 'topbar' && item.search && item.search.length > 0) { + item.search = [] + } + if (appType !== 'mob' && item.search && item.search.length > 0) { + item.search.forEach(cell => { + if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { + sqls.push({uuid: md5(item.uuid + cell.uuid), type: 'sForm', LText: `${item.$menuname}-${cell.label}锛堟悳绱級`}) + } + }) + } + + if (item.subtype === 'tablecard') { // 鍏煎 + item.type = 'card' + } + + if (item.setting && item.setting.interType === 'system') { + item.setting.$name = item.$menuname || '' + + if (!item.setting.primaryKey) { + window.mkInfo(`${item.$menuname} 鏈缃富閿紒`) + } else if (item.columns) { + let columns = item.columns.map(c => c.field) + if (!columns.includes(item.setting.primaryKey)) { + window.mkInfo(`${item.$menuname} 涓婚敭宸插け鏁堬紒`) + } + } + + item.scripts && item.scripts.forEach(c => { + if (/"ErrCode":\s*"true"/.test(c.sql)) { + window.mkInfo(`${item.$menuname} 鏁版嵁婧愯嚜瀹氫箟鑴氭湰涓娇鐢ㄤ簡"ErrCode":"true"锛乣) + } + }) + + sqls.push({uuid: item.uuid, type: 'datasource', LText: item.setting.$name}) + } + + item.action && item.action.forEach(cell => { + cell.logLabel = item.$menuname + '-' + cell.label + + btns.push({uuid: cell.uuid, label: cell.logLabel}) + + if (cell.hidden === 'true') return false + + resetButton(item, cell) + }) + + if (item.type === 'table') { + let getCols = (cols) => { + cols.forEach(col => { + if (col.type === 'action') { + col.type = 'custom' + } + if (col.type === 'colspan') { + getCols(col.subcols || []) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType !== 'button') { + resetElement(item, cell) + return + } + + cell.logLabel = item.$menuname + '-' + cell.label + + btns.push({uuid: cell.uuid, label: cell.logLabel}) + + if (cell.hidden === 'true') return + + resetButton(item, cell) + }) + } else if (item.subtype === 'editable' && col.editable === 'true') { + if (col.editType === 'select' && col.resourceType === '1') { + sqls.push({uuid: col.uuid, type: 'tbForm', LText: `${item.$menuname}-${col.label}锛堝垪琛ㄥ崟锛塦}) + } else if (col.editType === 'popSelect') { + if (col.pops) { + col.pops.forEach(n => { + sqls.push({uuid: n.uuid, type: 'popSource', LText: `${item.$menuname}-${col.label}锛堝垪琛ㄥ崟锛塦}) + }) + } else { + sqls.push({uuid: col.uuid, type: 'popSource', LText: `${item.$menuname}-${col.label}锛堝垪琛ㄥ崟锛塦}) + } + } + } + }) + } + + getCols(item.cols) + + if (item.subtype === 'editable' && item.submit.intertype === 'system') { + item.submit.logLabel = item.$menuname + '-鎻愪氦' + + sqls.push({uuid: 'submit_' + item.uuid, type: 'editable', LText: item.submit.logLabel}) + } + } else if (['card', 'carousel', 'timeline'].includes(item.type)) { + item.subcards && item.subcards.forEach(card => { + if (card.setting.click === 'menu' && card.setting.menu) { + if (appType === 'admin') { + if (!Array.isArray(card.setting.menu)) { + links.push(item.$menuname) + } else { + let menuId = card.setting.menu.slice(-1)[0] + if (!this.allMenus.includes(menuId)) { + links.push(item.$menuname) + } + } + } else { + if (typeof(card.setting.menu) !== 'string') { + links.push(item.$menuname) + } else if (!this.allMenus.includes(card.setting.menu)) { + links.push(item.$menuname) + } + } + } else if (card.setting.click === 'menus' && card.menus && card.menus.length > 0) { + if (appType === 'admin') { + card.menus.forEach(m => { + if (!m.MenuID || !this.allMenus.includes(m.MenuID)) { + links.push(item.$menuname) + } + }) + } else { + card.menus.forEach(m => { + if (typeof(m.menu) !== 'string' || !this.allMenus.includes(m.menu)) { + links.push(item.$menuname) + } + }) + } + } + + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') { + resetElement(item, cell) + return + } + + cell.logLabel = item.$menuname + '-' + cell.label + + btns.push({uuid: cell.uuid, label: cell.logLabel}) + + if (cell.hidden === 'true') return + + resetButton(item, cell) + }) + + if (!card.backElements || card.backElements.length === 0) return + + card.backElements.forEach(cell => { + if (cell.eleType !== 'button') { + resetElement(item, cell) + return + } + + cell.logLabel = item.$menuname + '-' + cell.label + + btns.push({uuid: cell.uuid, label: cell.logLabel}) + + if (cell.hidden === 'true') return + + resetButton(item, cell) + }) + }) + } else if (item.type === 'balcony') { + item.elements.forEach(cell => { + if (cell.eleType !== 'button') { + resetElement(item, cell) + return + } + + cell.logLabel = item.$menuname + '-' + cell.label + + btns.push({uuid: cell.uuid, label: cell.logLabel}) + + if (cell.hidden === 'true') return + + resetButton(item, cell) + }) + } else if (item.type === 'form') { + item.subcards.forEach(group => { + group.subButton.OpenType = 'formSubmit' + group.subButton.uuid = group.uuid + group.subButton.modal = { + fields: group.fields + } + + group.subButton.logLabel = item.$menuname + '-' + group.subButton.label + + btns.push({uuid: group.uuid, label: group.subButton.logLabel}) + + resetButton(item, group.subButton) + }) + } else if (item.type === 'module' && item.subtype === 'invoice') { + if (item.buyer.setting && item.buyer.setting.interType === 'system') { + sqls.push({uuid: item.uuid + 'buyer', type: 'datasource', LText: item.$menuname + '-buyer'}) + } + + if (item.detail.setting && item.detail.setting.interType === 'system') { + sqls.push({uuid: item.uuid + 'detail', type: 'datasource', LText: item.$menuname + '-detail'}) + } + + sqls.push({uuid: item.uuid + item.billSaveBtn.type, type: 'button', LText: item.$menuname + '-' + item.billSaveBtn.label}) + + sqls.push({uuid: item.uuid + item.billOutBtn.type, type: 'button', LText: item.$menuname + '-' + item.billOutBtn.label}) + + sqls.push({uuid: item.uuid + 'billback', type: 'btnCallBack', LText: item.$menuname + '-' + item.billOutBtn.label + '(鍥炶皟)'}) + } else if (item.type === 'menubar') { + item.subMenus.forEach(cell => { + if (cell.setting.type === 'menu') { + if (!this.allMenus.includes(cell.uuid)) { + links.push(item.$menuname + '-' + cell.setting.name) + } + } else if (cell.setting.type === 'linkmenu') { + if (!this.allMenus.includes(cell.setting.linkMenuId)) { + links.push(item.$menuname + '-' + cell.setting.name) + } + } + }) + } else if (item.type === 'login') { + if (!item.wrap.linkmenu || !this.allMenus.includes(item.wrap.linkmenu)) { + links.push(item.$menuname) + } + } else if (item.type === 'topbar') { + if (item.wrap.menus) { + item.wrap.menus.forEach(m => { + if (!this.allMenus.includes(m.menu)) { + links.push(item.$menuname) + } + }) + } + } + } + }) + } + + let resetElement = (item, cell) => { + if (cell.linkmenu && cell.linkmenu.length) { + if (appType === 'admin') { + if (!Array.isArray(cell.linkmenu)) { + links.push(item.$menuname) + } else { + let menuId = cell.linkmenu.slice(-1)[0] + if (!this.allMenus.includes(menuId)) { + links.push(item.$menuname) + } + } + } else { + if (cell.linkmenu !== 'goback' && (typeof(cell.linkmenu) !== 'string' || !this.allMenus.includes(cell.linkmenu))) { + links.push(item.$menuname) + } + } + } + } + + let resetButton = (item, cell) => { + if (['exec', 'prompt', 'pop', 'form', 'formSubmit'].includes(cell.OpenType)) { + if (cell.intertype === 'system' || cell.procMode === 'system') { // 绯荤粺鎺ュ彛 + sqls.push({uuid: cell.uuid, type: 'button', LText: cell.logLabel}) + } + if (cell.callbackType === 'script' && cell.verify && cell.verify.cbScripts) { + sqls.push({uuid: 'back_' + cell.uuid, type: 'btnCallBack', LText: cell.logLabel}) + } + + if (cell.verify) { + cell.verify.scripts && cell.verify.scripts.forEach(c => { + if (/"ErrCode":\s*"true"/.test(c.sql)) { + window.mkInfo(`${cell.logLabel} 鑷畾涔夎剼鏈腑浣跨敤浜�"ErrCode":"true"锛乣) + } + }) + cell.verify.cbScripts && cell.verify.cbScripts.forEach(c => { + if (/"ErrCode":\s*"true"/.test(c.sql)) { + window.mkInfo(`${cell.logLabel} 鍥炶皟鑴氭湰涓娇鐢ㄤ簡"ErrCode":"true"锛乣) + } + }) + } + + if (['pop', 'formSubmit'].includes(cell.OpenType) && cell.modal && cell.modal.fields) { + cell.modal.fields.forEach(form => { + // if (form.type === 'fileupload' && form.compress !== 'oss') { + // window.mkInfo(`${cell.logLabel}-${form.label}`) + // } + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� + if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { + sqls.push({uuid: md5(cell.uuid + form.uuid), type: 'form', LText: `${cell.logLabel}-${form.label}锛堣〃鍗曪級`}) + } else if (form.type === 'popSelect') { + sqls.push({uuid: md5(cell.uuid + form.uuid), type: 'popSource', LText: `${cell.logLabel}-${form.label}锛堣〃鍗曪級`}) + } + }) + } + } else if (cell.OpenType === 'excelIn') { + if (cell.intertype === 'system') { + sqls.push({uuid: cell.uuid, type: 'excelIn', LText: cell.logLabel}) + } + } else if (cell.OpenType === 'excelOut') { + if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { + sqls.push({uuid: cell.uuid, type: 'excelOut', LText: cell.logLabel || ''}) + } else if (cell.intertype === 'system' && cell.verify && item.setting && item.setting.interType === 'system') { + if (appType === 'mob') { + cell.pagination = 'false' + } + if (item.subtype === 'dualdatacard' || item.setting.laypage !== cell.pagination) { + sqls.push({uuid: cell.uuid, type: 'excelOut', LText: cell.logLabel || ''}) + } + } + } else if (cell.OpenType === 'funcbutton') { + if (cell.funcType === 'print') { + if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { + sqls.push({uuid: cell.uuid, type: 'print', LText: cell.logLabel || ''}) + } + if (cell.execMode === 'pop' && cell.modal && cell.modal.fields) { + cell.modal.fields.forEach(form => { + // if (form.type === 'fileupload' && form.compress !== 'oss') { + // window.mkInfo(`${cell.logLabel}-${form.label}`) + // } + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� + if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { + sqls.push({uuid: md5(cell.uuid + form.uuid), type: 'form', LText: `${cell.logLabel}-${form.label}锛堣〃鍗曪級`}) + } else if (form.type === 'popSelect') { + sqls.push({uuid: md5(cell.uuid + form.uuid), type: 'popSource', LText: `${cell.logLabel}-${form.label}锛堣〃鍗曪級`}) + } + }) + } + } else if ((cell.funcType === 'refund' || cell.funcType === 'pay') && cell.payMode === 'system') { + sqls.push({uuid: cell.uuid, type: 'pay', LText: cell.logLabel}) + } + } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') { + if (cell.pageTemplate === 'pay' && cell.payMode === 'system') { + sqls.push({uuid: cell.uuid, type: 'pay', LText: cell.logLabel}) + } + } else if (cell.OpenType === 'popview') { + if (cell.config && cell.config.components && cell.config.enabled) { + let label = (item.name ? '-' + item.name : '') + '-' + cell.label + + filterComponent(cell.config.components, label, true) + } + } + + if (appType === 'admin') { + if (cell.refreshTab && cell.refreshTab.length) { + let tabId = cell.refreshTab[cell.refreshTab.length - 1] + if (!this.allMenus.includes(tabId)) { + links.push(cell.logLabel) + } + } + if (cell.openmenu && cell.openmenu.length) { + if (!Array.isArray(cell.openmenu)) { + links.push(cell.logLabel) + } else { + let menuId = cell.openmenu.slice(-1)[0] + if (!this.allMenus.includes(menuId)) { + links.push(cell.logLabel) + } + } + } + if (cell.linkmenu && cell.linkmenu.length) { + if (!Array.isArray(cell.linkmenu)) { + links.push(cell.logLabel) + } else { + let menuId = cell.linkmenu.slice(-1)[0] + if (!this.allMenus.includes(menuId)) { + links.push(cell.logLabel) + } + } + } + } else { + if (cell.openmenu && cell.openmenu.length && cell.openmenu !== 'goback' && (typeof(cell.openmenu) !== 'string' || !this.allMenus.includes(cell.openmenu))) { + links.push(cell.logLabel) + } + if (cell.linkmenu && cell.linkmenu.length && cell.linkmenu !== 'goback' && (typeof(cell.linkmenu) !== 'string' || !this.allMenus.includes(cell.linkmenu))) { + links.push(cell.logLabel) + } + } + } + + if (appType === 'mob') { + config.components.forEach(item => { + if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { + let search = [] + search.push(...item.search.fields) + + item.search.groups.forEach(group => { + search.push(...group.fields) + }) + + if (search.length > 0) { + search.forEach(cell => { + if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { + sqls.push({uuid: cell.uuid, type: 'sForm', LText: `鎼滅储鏍�-${cell.label}锛堣〃鍗曪級`}) + } + }) + } + } + }) + } + + if (config.interfaces && config.interfaces.length > 0) { + config.interfaces.forEach(m => { + if (m.status !== 'true' || m.setting.interType !== 'system') return false + + m.setting.$name = (config.MenuName || '') + '-' + (m.name || '') + + sqls.push({uuid: m.uuid, type: 'interface', LText: m.setting.$name}) + }) + } + + filterComponent(config.components) + } + + record = (type) => { + const { lackmenus, lacklinks, outmenus, unablemenus, backmenus, appbackmenus, btnmenus, appbtnmenus } = this.state + + let menus = [] + + lackmenus.forEach(item => { + menus.push(item.MenuID) + }) + lacklinks.forEach(item => { + menus.push(item.MenuID) + }) + outmenus.forEach(item => { + menus.push(item.MenuID) + }) + unablemenus.forEach(item => { + menus.push(item.MenuID) + }) + backmenus.forEach(item => { + menus.push(item.MenuID) + }) + appbackmenus.forEach(item => { + menus.push(item[0].MenuID) + menus.push(item[1].MenuID) + }) + btnmenus.forEach(item => { + menus.push(item.MenuID) + }) + appbtnmenus.forEach(item => { + menus.push(item[0].MenuID) + menus.push(item[1].MenuID) + }) + + menus = Array.from(new Set(menus)) + + if (type === 'app') { + if (menus.length) { + sessionStorage.setItem('syscheck_app', JSON.stringify(menus)) + } else { + sessionStorage.removeItem('syscheck_app') + } + } else { + if (menus.length) { + sessionStorage.setItem('syscheck_main', JSON.stringify(menus)) + } else { + sessionStorage.removeItem('syscheck_main') + } + } + } + render () { - const { loading } = this.state + const { loading, activeMenu, menulist, remain, lackmenus, lacklinks, outmenus, unablemenus, backmenus, appbackmenus, btnmenus, appbtnmenus } = 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} + {lacklinks.length ? <div className="item-wrap"> + <div className="title">鍏宠仈鑿滃崟涓嶅瓨鍦�</div> + {lacklinks.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} + {btnmenus.length ? <div className="item-wrap"> + <div className="title">鑿滃崟鎸夐挳ID閲嶅</div> + {btnmenus.map((item, i) => { + return <div key={i}>{item.MenuName} <span></span> {item.pName}</div> + })} + </div> : null} + {appbtnmenus.length ? <div className="item-wrap"> + <div className="title">鑿滃崟鎸夐挳ID閲嶅锛堣彍鍗曢棿锛�</div> + {appbtnmenus.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> ) -- Gitblit v1.8.0