From b488c2f9630583a72e2bcae3df68f4227622ec78 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 15 六月 2024 13:42:21 +0800 Subject: [PATCH] 2024-06-15 --- src/views/design/header/index.jsx | 1 src/components/header/index.jsx | 1 src/views/pcdesign/index.jsx | 8 src/utils/utils-custom.js | 409 ++++++++++++++++++++++++++-- src/pc/createview/index.jsx | 4 src/views/design/header/transmenu/index.jsx | 350 ++++++++++++++++++++++++ src/views/tabledesign/index.jsx | 11 src/views/design/sidemenu/index.jsx | 4 src/views/imdesign/index.jsx | 4 src/views/design/sidemenu/editthdmenu/index.jsx | 4 src/views/mobdesign/index.jsx | 8 src/views/design/sidemenu/thdmenuplus/index.jsx | 4 src/views/menudesign/index.jsx | 15 src/views/login/index.jsx | 6 14 files changed, 758 insertions(+), 71 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 1a8b396..5e547d7 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -123,6 +123,7 @@ onOk() { sessionStorage.clear() _this.props.history.replace('/login') + window.location.reload() }, onCancel() {} }) diff --git a/src/pc/createview/index.jsx b/src/pc/createview/index.jsx index 856e54c..2465808 100644 --- a/src/pc/createview/index.jsx +++ b/src/pc/createview/index.jsx @@ -87,8 +87,8 @@ MenuName: res.MenuName || '', PageParam: JSON.stringify({Template: 'webPage'}), open_edition: '', - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 644475e..7673d36 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1108,6 +1108,8 @@ value = item.initval || `${item.minValue || '-999999999'},${item.maxValue || '999999999'}` } else if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) { type = 'multi' + } else { + value = item.initval || '0' } newsearches.push({ @@ -2145,6 +2147,17 @@ } } + let filterForm = (n) => { + sql.push(n.label) + if (n.resourceType === '1') { + filterSql(n.dataSource) + } else if (n.options) { + n.options.forEach(o => { + ops.push(o.Text) + }) + } + } + let traversal = (components) => { if (!components) return @@ -2173,15 +2186,7 @@ } if (item.search) { item.search.forEach(cell => { - sql.push(cell.label) - if (cell.options) { - cell.options.forEach(o => { - ops.push(o.Text) - }) - } - if (cell.resourceType === '1') { - filterSql(cell.dataSource) - } + filterForm(cell) }) } if (item.action) { @@ -2193,10 +2198,7 @@ } else if (cell.OpenType === 'pop') { if (cell.modal && cell.modal.fields.length) { cell.modal.fields.forEach(n => { - sql.push(n.label) - if (n.resourceType === '1') { - filterSql(n.dataSource) - } + filterForm(n) }) } } @@ -2214,10 +2216,7 @@ } else if (cell.OpenType === 'pop') { if (cell.modal && cell.modal.fields.length) { cell.modal.fields.forEach(n => { - sql.push(n.label) - if (n.resourceType === '1') { - filterSql(n.dataSource) - } + filterForm(n) }) } } @@ -2234,10 +2233,7 @@ } else if (cell.OpenType === 'pop') { if (cell.modal && cell.modal.fields.length) { cell.modal.fields.forEach(n => { - sql.push(n.label) - if (n.resourceType === '1') { - filterSql(n.dataSource) - } + filterForm(n) }) } } @@ -2256,10 +2252,7 @@ } else if (cell.OpenType === 'pop') { if (cell.modal && cell.modal.fields.length) { cell.modal.fields.forEach(n => { - sql.push(n.label) - if (n.resourceType === '1') { - filterSql(n.dataSource) - } + filterForm(n) }) } } @@ -2289,10 +2282,7 @@ } else if (cell.OpenType === 'pop') { if (cell.modal && cell.modal.fields.length) { cell.modal.fields.forEach(n => { - sql.push(n.label) - if (n.resourceType === '1') { - filterSql(n.dataSource) - } + filterForm(n) }) } } @@ -2308,10 +2298,7 @@ item.subcards.forEach(cell => { filterBtn(cell.subButton) cell.fields.forEach(n => { - sql.push(n.label) - if (n.resourceType === '1') { - filterSql(n.dataSource) - } + filterForm(n) }) }) } @@ -2353,7 +2340,7 @@ list.unshift(`'${config.MenuName}','menu'`) } - if (config.fstMenuId && config.parentId) { + if (config.fstMenuId && config.parentId && config.fstMenuId !== 'BillPrintTemp') { let menulist = sessionStorage.getItem('fstMenuList') try { menulist = JSON.parse(menulist) @@ -2384,4 +2371,358 @@ config.trans = true return result.join(';') +} + +/** + * @description 璇█杞崲 + */ +export function setLangTrans (config, btnDict, titDict, lisDict, regs, tail) { + let filterElement = (card) => { + if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) { + if (card.value && titDict[card.value]) { + card.value = titDict[card.value] + } + } + if (card.prefix && titDict[card.prefix]) { + card.prefix = titDict[card.prefix] + } + if (card.postfix && titDict[card.postfix]) { + card.postfix = titDict[card.postfix] + } + } + + let filterSql = (sl) => { + if (!sl) return + + regs.forEach(item => { + sl = sl.replace(item.reg, item.value) + }) + + return sl + } + + let filterBtn = (btn) => { + if (btn.label && btnDict[btn.label]) { + btn.label = btnDict[btn.label] + } + + if (btn.OpenType === 'tab' && btn.linkmenu) { + if (btn.linkmenu[0] === 'multiMenu') { + btn.multiMenus.forEach(menu => { + menu.menuId = menu.menuId.map(c => { + if (c.length <= 24) { + return md5(window.GLOB.appkey + c + sessionStorage.getItem('lang')).toLowerCase() + } else { + return c.slice(0, 24) + tail + } + }) + + menu.MenuID = menu.menuId[menu.menuId.length - 1] + }) + } else { + btn.linkmenu = btn.linkmenu.map(c => { + if (c.length <= 24) { + return md5(window.GLOB.appkey + c + sessionStorage.getItem('lang')).toLowerCase() + } else { + return c.slice(0, 24) + tail + } + }) + btn.MenuID = btn.linkmenu[btn.linkmenu.length - 1] + } + } else { + if (btn.refreshTab && btn.refreshTab.length > 0) { + btn.refreshTab = btn.refreshTab.map(c => { + if (c.length <= 24) { + return md5(window.GLOB.appkey + c + sessionStorage.getItem('lang')).toLowerCase() + } else { + return c.slice(0, 24) + tail + } + }) + } + if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0) { + btn.openmenu = btn.openmenu.map(c => { + if (c.length <= 24) { + return md5(window.GLOB.appkey + c + sessionStorage.getItem('lang')).toLowerCase() + } else { + return c.slice(0, 24) + tail + } + }) + btn.MenuID = btn.openmenu[btn.openmenu.length - 1] + } else if (btn.openmenu && typeof(btn.openmenu) === 'string' && btn.openmenu !== 'goback') { + btn.openmenu = btn.openmenu.slice(0, 24) + tail + } + + if (btn.pageTemplate === 'linkpage' && btn.linkmenu && typeof(btn.linkmenu) === 'string') { + btn.linkmenu = btn.linkmenu.slice(0, 24) + tail + } + } + + if (!btn.verify) return + + btn.verify.customverifys && btn.verify.customverifys.forEach(script => { + script.sql = filterSql(script.sql) + }) + btn.verify.scripts && btn.verify.scripts.forEach(script => { + script.sql = filterSql(script.sql) + }) + btn.verify.cbScripts && btn.verify.cbScripts.forEach(script => { + script.sql = filterSql(script.sql) + }) + + if (btn.OpenType === 'funcbutton') { + if (btn.intertype === 'system' && btn.verify.dataType === 'custom' && btn.verify.setting) { + btn.verify.setting.dataresource = filterSql(btn.verify.setting.dataresource) + } + } else if (btn.OpenType === 'excelOut' && btn.verify.dataresource) { + btn.verify.dataresource = filterSql(btn.verify.dataresource) + } + } + + let filterForm = (n) => { + if (n.label && titDict[n.label]) { + n.label = titDict[n.label] + } + if (n.resourceType === '1') { + n.dataSource = filterSql(n.dataSource) + } else if (n.options) { + n.options.forEach(o => { + if (o.Text && lisDict[o.Text]) { + o.Text = lisDict[o.Text] + } + }) + } + } + + let resetMenu = (wrap) => { + if (!wrap.menu) return + + if (typeof(wrap.menu) === 'string') { + wrap.menu = wrap.menu.slice(0, 24) + tail + if (wrap.MenuID) { + wrap.MenuID = wrap.menu + } + } else { + wrap.menu = wrap.menu.map(c => { + if (c.length <= 24) { + return md5(window.GLOB.appkey + c + sessionStorage.getItem('lang')).toLowerCase() + } else { + return c.slice(0, 24) + tail + } + }) + if (wrap.MenuID) { + wrap.MenuID = wrap.menu[wrap.menu.length - 1] + } + } + } + let resetMenus = (wrap) => { + if (!wrap.menus) return + + wrap.menus.forEach(m => { + if (typeof(m.menu) === 'string') { + m.menu = m.menu.slice(0, 24) + tail + } else { + m.menu = m.menu.map(c => { + if (c.length <= 24) { + return md5(window.GLOB.appkey + c + sessionStorage.getItem('lang')).toLowerCase() + } else { + return c.slice(0, 24) + tail + } + }) + if (m.MenuID) { + m.MenuID = m.menu[m.menu.length - 1] + } + } + }) + } + + let traversal = (components) => { + if (!components) return + + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + if (tab.label && titDict[tab.label]) { + tab.label = titDict[tab.label] + } + traversal(tab.components) + }) + } else if (item.type === 'group') { + traversal(item.components) + } else { + if (item.wrap && (item.wrap.click === 'menu' || item.wrap.click === 'menus')) { + if (item.wrap.click === 'menu') { + resetMenu(item.wrap) + } else if (item.wrap.click === 'menus') { + resetMenus(config.wrap) + } + } else if (item.plot && (item.plot.click === 'menu' || item.plot.click === 'menus')) { + if (item.plot.click === 'menu') { + resetMenu(item.plot) + } else if (item.plot.click === 'menus') { + resetMenus(config.plot) + } + } + if (item.setting && (!item.wrap || !item.wrap.datatype || item.wrap.datatype === 'dynamic')) { + if (item.setting.interType === 'system') { + item.setting.dataresource = filterSql(item.setting.dataresource) + item.scripts && item.scripts.forEach(script => { + script.sql = filterSql(script.sql) + }) + } + } + + if (item.columns) { + item.columns.forEach(cell => { + if (cell.label && titDict[cell.label]) { + cell.label = titDict[cell.label] + } + }) + } + if (item.search) { + item.search.forEach(cell => { + filterForm(cell) + }) + } + if (item.action) { + item.action.forEach(cell => { + filterBtn(cell) + if (cell.OpenType === 'popview' && cell.config) { + traversal(cell.config.components) + } else if (cell.OpenType === 'pop') { + if (cell.modal && cell.modal.fields.length) { + cell.modal.fields.forEach(n => { + filterForm(n) + }) + } + } + }) + } + + if (item.type === 'menubar') { + item.subMenus = item.subMenus.map(cell => { + if (cell.setting.type === 'linkmenu') { + cell.setting.linkMenuId = cell.setting.linkMenuId.slice(0, 24) + tail + } + return cell + }) + } else if (item.type === 'topbar') { + if (item.wrap.menus) { + resetMenus(item.wrap) + } + } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { + item.subcards.forEach(card => { + if (card.setting.click === 'menus') { + resetMenus(card) + } else if (card.setting.click === 'menu') { + resetMenu(card.setting) + } + card.elements && card.elements.forEach(cell => { + if (cell.eleType === 'button') { + filterBtn(cell) + if (cell.OpenType === 'popview' && cell.config) { + traversal(cell.config.components) + } else if (cell.OpenType === 'pop') { + if (cell.modal && cell.modal.fields.length) { + cell.modal.fields.forEach(n => { + filterForm(n) + }) + } + } + } else { + filterElement(cell) + } + }) + card.backElements && card.backElements.forEach(cell => { + if (cell.eleType === 'button') { + filterBtn(cell) + if (cell.OpenType === 'popview' && cell.config) { + traversal(cell.config.components) + } else if (cell.OpenType === 'pop') { + if (cell.modal && cell.modal.fields.length) { + cell.modal.fields.forEach(n => { + filterForm(n) + }) + } + } + } else { + filterElement(cell) + } + }) + }) + } else if (item.type === 'balcony') { + item.elements && item.elements.forEach(cell => { + if (cell.eleType === 'button') { + filterBtn(cell) + if (cell.OpenType === 'popview' && cell.config) { + traversal(cell.config.components) + } else if (cell.OpenType === 'pop') { + if (cell.modal && cell.modal.fields.length) { + cell.modal.fields.forEach(n => { + filterForm(n) + }) + } + } + } else { + filterElement(cell) + } + }) + } else if (item.type === 'table') { + let loopCol = (cols) => { + cols.forEach(col => { + if (col.label && titDict[col.label]) { + col.label = titDict[col.label] + } + if (col.prefix && titDict[col.prefix]) { + col.prefix = titDict[col.prefix] + } + if (col.postfix && titDict[col.postfix]) { + col.postfix = titDict[col.postfix] + } + if (col.type === 'colspan') { + loopCol(col.subcols) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType === 'button') { + filterBtn(cell) + if (cell.OpenType === 'popview' && cell.config) { + traversal(cell.config.components) + } else if (cell.OpenType === 'pop') { + if (cell.modal && cell.modal.fields.length) { + cell.modal.fields.forEach(n => { + filterForm(n) + }) + } + } + } else { + filterElement(cell) + } + }) + } + }) + } + loopCol(item.cols) + } else if (item.type === 'form') { + item.subcards.forEach(cell => { + filterBtn(cell.subButton) + cell.fields.forEach(n => { + filterForm(n) + }) + }) + } + } + }) + } + + if (config.interfaces) { + config.interfaces.forEach(item => { + if (item.setting.interType === 'system') { + item.setting.dataresource = filterSql(item.setting.dataresource) + item.scripts && item.scripts.forEach(script => { + script.sql = filterSql(script.sql) + }) + } + }) + } + + traversal(config.components) } \ No newline at end of file diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 898be70..d04454b 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -40,6 +40,7 @@ onOk() { sessionStorage.clear() _this.props.history.replace('/login') + window.location.reload() }, onCancel() {} }) diff --git a/src/views/design/header/transmenu/index.jsx b/src/views/design/header/transmenu/index.jsx index c31228e..67cba4f 100644 --- a/src/views/design/header/transmenu/index.jsx +++ b/src/views/design/header/transmenu/index.jsx @@ -3,15 +3,20 @@ import { Modal, notification, Button, Spin, Cascader } from 'antd' // import { ClockCircleOutlined, SyncOutlined, WarningOutlined, CheckCircleOutlined } from '@ant-design/icons' import moment from 'moment' +import md5 from 'md5' import Api from '@/api' import Utils from '@/utils/utils.js' +import MenuUtils, { setLangTrans } from '@/utils/utils-custom.js' import './index.scss' + +const { confirm } = Modal class TransMenu extends Component { state = { visible: false, loading: false, + saveing: false, lang: '', dicts: [], menus: [], @@ -30,6 +35,7 @@ lang: langs[0], loading: true, visible: true, + saveing: false, values: [] }) @@ -135,25 +141,354 @@ menus.push(fstItem) }) + menus.push({ + value: 'home_page_id', + label: '棣栭〉', + }) + this.setState({menus: menus, loading: false}) }) } submit = () => { - const { menulist } = this.props const { values } = this.state - if (!values || values.length !== 3) { + if (!values || (values.length !== 3 && values[0] !== 'home_page_id')) { notification.warning({ top: 92, - message: '璇烽�夋嫨涓夌骇鑿滃崟锛�', + message: '璇烽�夋嫨鑿滃崟锛�', duration: 5 }) return } - - console.log(values) - console.log(menulist) + + this.setState({saveing: true}) + + if (values[0] === 'home_page_id') { + this.transThdMenu({ + value: 'home_page_id', + MenuID: 'home_page_id', + label: '棣栭〉' + }) + } else { + this.transFirstMenu(values[0], values[1], values[2]) + } + } + + transFirstMenu = (firstId, secId, thdId) => { + const { menulist } = this.props + const { menus, dicts } = this.state + let tail = md5(window.GLOB.appkey + sessionStorage.getItem('lang')).toLowerCase() + + tail = tail.slice(-8) + + let oriFirstMenu = menus.filter(item => item.value === firstId)[0] + let oriSecMenu = oriFirstMenu.children.filter(item => item.value === secId)[0] + let oriThdMenu = oriSecMenu.children.filter(item => item.value === thdId)[0] + + oriThdMenu = fromJS(oriThdMenu).toJS() + + let curFirstId = firstId + if (curFirstId.length <= 24) { + curFirstId = md5(window.GLOB.appkey + curFirstId + sessionStorage.getItem('lang')).toLowerCase() + } else { + curFirstId = curFirstId.slice(0, 24) + tail + } + + let curSectId = secId + if (curSectId.length <= 24) { + curSectId = md5(window.GLOB.appkey + curSectId + sessionStorage.getItem('lang')).toLowerCase() + } else { + curSectId = curSectId.slice(0, 24) + tail + } + + let curThdId = thdId + if (curThdId.length <= 24) { + curThdId = md5(window.GLOB.appkey + curThdId + sessionStorage.getItem('lang')).toLowerCase() + } else { + curThdId = curThdId.slice(0, 24) + tail + } + + let firstName = oriFirstMenu.label + let secName = oriSecMenu.label + + dicts.forEach(item => { + if (item.type !== 'menu') return + if (item.reg === firstName) { + firstName = item.value + } + if (item.reg === secName) { + secName = item.value + } + if (item.reg === oriThdMenu.label) { + oriThdMenu.label = item.value + } + }) + + let firstParam = { + func: 'sPC_MainMenu_Add', + MenuID: curFirstId, + MenuName: firstName, + PageParam: JSON.stringify({ + OpenType: 'menu', + linkUrl: '' + }) + } + + let secParam = { + func: 'sPC_SndMenu_Add', + ParentID: curFirstId, + MenuID: curSectId, + MenuName: secName, + PageParam: JSON.stringify({ + Icon: '' + }) + } + + oriThdMenu.fstMenuId = curFirstId + oriThdMenu.parentId = curSectId + oriThdMenu.MenuID = curThdId + + if (menulist.findIndex(item => item.MenuID === firstParam.MenuID) === -1) { + Api.getCloudConfig(firstParam).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + this.setState({saveing: false}) + return + } + + this.transSecondMenu(secParam, oriThdMenu, true) + }) + } else { + this.transSecondMenu(secParam, oriThdMenu) + } + } + + transSecondMenu = (secParam, oriThdMenu, reload) => { + const { menulist } = this.props + + let creat = true + + menulist.forEach(item => { + if (item.children.findIndex(cell => cell.MenuID === secParam.MenuID) > -1) { + creat = false + } + }) + + if (creat) { + Api.getCloudConfig(secParam).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + this.setState({saveing: false}) + return + } + + this.transThdMenu(oriThdMenu, true) + }) + } else { + this.transThdMenu(oriThdMenu, reload) + } + } + + transThdMenu = (menu, reload) => { + const { menulist } = this.props + const { lang, dicts } = this.state + + let _param = { + func: 'sPC_Get_LongParam', + MenuID: menu.value, + lang: lang + } + + let creat = true + + if (menu.MenuID === 'home_page_id') { + creat = false + } else { + menulist.forEach(item => { + item.children.forEach(cell => { + if (cell.children.findIndex(n => n.MenuID === menu.MenuID) > -1) { + creat = false + } + }) + }) + } + + Api.getCloudConfig(_param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + this.setState({saveing: false}) + return + } + + let config = null + if (res.LongParam) { + try { + config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) + } catch (e) { + console.warn('Parse Failure') + config = '' + } + } + + if (!config) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌鑿滃崟閰嶇疆淇℃伅', + duration: 5 + }) + this.setState({saveing: false}) + + if (reload) { + this.props.reload() + } + return + } + + let btnDict = {} + let titDict = {} + let lisDict = {} + let regs = [] + + dicts.forEach(item => { + if (item.type === 'button') { + btnDict[item.reg] = item.value + } else if (item.type === 'title') { + titDict[item.reg] = item.value + } else if (item.type === 'list') { + lisDict[item.reg] = item.value + } else if (item.type === 'text') { + regs.push({reg: new RegExp(item.reg, 'g'), value: item.value, sort: item.reg.length}) + } + }) + + regs.sort((a, b) => b.sort - a.sort) + + let tail = md5(window.GLOB.appkey + sessionStorage.getItem('lang')).toLowerCase() + + tail = tail.slice(-8) + + setLangTrans(config, btnDict, titDict, lisDict, regs, tail) + + if (config.components) { + let commonId = Utils.getuuid() + if (config.interfaces && config.interfaces.length > 0) { + config.interfaces = config.interfaces.map(inter => { + inter.uuid = md5(commonId + inter.uuid) + return inter + }) + } + config.components = MenuUtils.resetConfig(config.components, commonId, false) + config.tables = config.tables || [] + config.style = config.style || {} + } + + config.MenuName = menu.label + config.fstMenuId = menu.fstMenuId || '' + config.parentId = menu.parentId || '' + config.uuid = menu.MenuID || '' + config.open_edition = '' + if (config.MenuNo) { + config.MenuNo = config.MenuNo + '_' + sessionStorage.getItem('lang') + } + + let param = { + func: 'sPC_TrdMenu_AddUpt', + FstID: config.fstMenuId, + SndID: config.parentId, + ParentID: config.parentId, + MenuID: config.uuid, + MenuNo: config.MenuNo || '', + EasyCode: config.easyCode || '', + Template: config.Template, + MenuName: config.MenuName || '', + PageParam: JSON.stringify({Template: config.Template, OpenType: config.OpenType || 'newtab'}) + } + + if (creat) { + param.open_edition = config.open_edition + param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config))) + + this.setMenu(param, true) + } else { + Api.getCloudConfig({ + func: 'sPC_Get_LongParam', + MenuID: menu.MenuID + }).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + this.setState({saveing: false}) + return + } + + config.open_edition = res.open_edition || '' + param.open_edition = config.open_edition + param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config))) + + if (res.LongParam) { + const that = this + confirm({ + title: '鑿滃崟宸插瓨鍦紝纭畾閲嶆柊鐢熸垚鍚�?', + content: '', + onOk() { + that.setMenu(param, true) + }, + onCancel() {} + }) + } else { + this.setMenu(param, true) + } + }) + } + }) + } + + setMenu = (param, reload) => { + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + + Api.getCloudConfig(param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + this.setState({saveing: false}) + return + } + + notification.success({ + top: 92, + message: '娣诲姞鎴愬姛銆�', + duration: 5 + }) + + this.setState({ + loading: false, + visible: false + }) + + if (reload) { + this.props.reload() + } + }) } cancel = () => { @@ -164,7 +499,7 @@ } render () { - const { visible, loading, menus } = this.state + const { visible, loading, saveing, menus } = this.state return ( <> @@ -180,6 +515,7 @@ maskClosable={false} onOk={this.submit} onCancel={this.cancel} + confirmLoading={saveing} destroyOnClose > {loading ? <Spin /> : <div> diff --git a/src/views/design/sidemenu/editthdmenu/index.jsx b/src/views/design/sidemenu/editthdmenu/index.jsx index d482996..e90f4a7 100644 --- a/src/views/design/sidemenu/editthdmenu/index.jsx +++ b/src/views/design/sidemenu/editthdmenu/index.jsx @@ -214,8 +214,8 @@ MenuName: res.MenuName, PageParam: JSON.stringify(PageParam), LongParam: '', - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/design/sidemenu/index.jsx b/src/views/design/sidemenu/index.jsx index d43da38..7f9b43f 100644 --- a/src/views/design/sidemenu/index.jsx +++ b/src/views/design/sidemenu/index.jsx @@ -249,8 +249,8 @@ MenuName: res.MenuName, PageParam: JSON.stringify(PageParam), LongParam: '', - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/design/sidemenu/thdmenuplus/index.jsx b/src/views/design/sidemenu/thdmenuplus/index.jsx index be78279..a159c98 100644 --- a/src/views/design/sidemenu/thdmenuplus/index.jsx +++ b/src/views/design/sidemenu/thdmenuplus/index.jsx @@ -174,8 +174,8 @@ MenuName: values.MenuName, PageParam: JSON.stringify(PageParam), LongParam: '', - LText: '', - LTexttb: '', + // LText: '', + // LTexttb: '', Sort: sysMenu.menuSort } diff --git a/src/views/imdesign/index.jsx b/src/views/imdesign/index.jsx index 6bd3c0c..564d8c6 100644 --- a/src/views/imdesign/index.jsx +++ b/src/views/imdesign/index.jsx @@ -361,8 +361,8 @@ PageParam: JSON.stringify({Template: 'imPage'}), open_edition: config.open_edition, menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify({type: 'im', key: config.uuid, title: config.MenuName, children: []}))), - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 05679ae..711501d 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -310,6 +310,9 @@ // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4") + sessionStorage.removeItem('subLangList') + sessionStorage.removeItem('langList') + setTimeout(() => { Api.delCacheConfig() }, 50) @@ -706,14 +709,13 @@ if (window.GLOB.defLang && list.includes(window.GLOB.defLang)) { lang = window.GLOB.defLang } + if (list.includes(lang)) { list = [lang, ...list.filter(item => item !== lang)] if (lang === sessionStorage.getItem('lang')) { sessionStorage.setItem('langList', JSON.stringify(list)) - sessionStorage.removeItem('subLangList') } else { sessionStorage.setItem('subLangList', JSON.stringify(list)) - sessionStorage.removeItem('langList') } } } diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index cee5ca7..b084ffc 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -773,7 +773,7 @@ }) return } else if (this.checklog()) { - if (MenuType !== 'billPrint' && sessionStorage.getItem('langList') && !config.trans) { + if (sessionStorage.getItem('langList') && !config.trans) { } else { notification.success({ @@ -846,7 +846,7 @@ let interfaces = getFuncsAndInters(config) let urlFields = config.urlFields ? config.urlFields.join(',') : '' - let langSql = MenuType !== 'billPrint' ? getLangTrans(config) : '' + let langSql = getLangTrans(config) let param = { func: 'sPC_TrdMenu_AddUpt', @@ -860,13 +860,16 @@ MenuName: config.MenuName || '', PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), open_edition: config.open_edition, - LText: '', - LTexttb: '', + // LText: '', + // LTexttb: '', debug_md5: key, debug_url: url, debug_list: window.btoa(tbs), - LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), - lang_translation: window.btoa(window.encodeURIComponent(langSql)) + LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))) + } + + if (langSql) { + param.lang_translation = window.btoa(window.encodeURIComponent(langSql)) } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index da497bd..941955e 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -1533,8 +1533,8 @@ PageParam: JSON.stringify({Template: 'webPage', interfaces}), open_edition: config.open_edition, menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), - LText: '', - LTexttb: '', + // LText: '', + // LTexttb: '', menus_used_list, debug_md5: key, debug_url: url, @@ -1602,8 +1602,8 @@ PageParam: JSON.stringify({Template: NavBar.type}), open_edition: _item ? (_item.open_edition || '') : '', menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roles))), - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } _param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(NavBar))) diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 25f47c6..76582d4 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1232,8 +1232,8 @@ PageParam: JSON.stringify({Template: 'webPage', interfaces}), menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), open_edition: config.open_edition, - LText: '', - LTexttb: '', + // LText: '', + // LTexttb: '', menus_used_list, debug_md5: key, debug_url: url, @@ -1318,8 +1318,8 @@ PageParam: JSON.stringify({Template: NavBar.type}), menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roles))), open_edition: NavBar.open_edition, - LText: '', - LTexttb: '' + // LText: '', + // LTexttb: '' } _param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(NavBar))) diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 1a5906a..d4a4218 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -608,13 +608,16 @@ MenuName: config.MenuName || '', PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), open_edition: config.open_edition, - LText: '', - LTexttb: '', + // LText: '', + // LTexttb: '', debug_md5: key, debug_url: url, debug_list: window.btoa(tbs), - LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), - lang_translation: window.btoa(window.encodeURIComponent(langSql)) + LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))) + } + + if (langSql) { + param.lang_translation = window.btoa(window.encodeURIComponent(langSql)) } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') -- Gitblit v1.8.0