From 2c573446cd5059b09c06c8673eaf1f51f43967ce Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 14 六月 2024 13:44:27 +0800 Subject: [PATCH] 2024-06-14 --- src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 15 + src/views/design/header/index.jsx | 11 + src/utils/utils-custom.js | 51 +++-- src/menu/components/card/cardcellcomponent/elementform/index.jsx | 22 ++ src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 15 + src/views/design/header/transmenu/index.jsx | 194 +++++++++++++++++++++ src/menu/components/form/simple-form/options.jsx | 15 - src/menu/components/form/simple-form/index.jsx | 6 src/tabviews/custom/popview/index.jsx | 3 src/views/design/header/transmenu/index.scss | 16 + src/views/tabledesign/index.jsx | 18 + src/menu/components/table/normal-table/columns/editColumn/index.jsx | 9 src/api/index.js | 4 src/tabviews/custom/components/share/normalTable/index.jsx | 7 src/menu/components/table/edit-table/columns/editColumn/index.jsx | 20 + src/views/menudesign/index.jsx | 20 + src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 15 + src/tabviews/custom/components/card/cardcellList/index.jsx | 6 src/menu/components/table/base-table/columns/editColumn/index.jsx | 9 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 14 + src/menu/components/card/cardcellcomponent/formconfig.jsx | 15 + src/tabviews/custom/index.jsx | 3 src/menu/components/table/base-table/columns/index.jsx | 8 src/menu/components/table/normal-table/columns/index.jsx | 8 src/menu/components/table/edit-table/columns/index.jsx | 8 src/views/login/index.jsx | 18 + 26 files changed, 449 insertions(+), 81 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index fcf4748..d7b2088 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -115,10 +115,10 @@ url: _url, method: 'get' }).then(res => { - if (res.oa_access_token || res.mini_access_token) { + if (res.oa_access_token) { window.GLOB.accessToken.accessTime = parseInt(new Date().getTime() / 1000) window.GLOB.accessToken.oa_access_token = res.oa_access_token - window.GLOB.accessToken.mini_access_token = res.mini_access_token + // window.GLOB.accessToken.mini_access_token = res.mini_access_token } resolve(res) }) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 992eff8..0b03681 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Popover, message, AutoComplete } from 'antd' +import { Form, Row, Col, Input, Select, Radio, Checkbox, Tooltip, InputNumber, Cascader, Popover, message, AutoComplete } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' @@ -228,7 +228,7 @@ } } else if (this.record.eleType === 'formula') { if (this.record.eval !== 'func') { - _options.push('prefix', 'postfix', 'fixStyle', 'alignItems') + _options.push('prefix', 'postfix', 'fixStyle', 'alignItems', 'evalchars') } if (this.record.eval === 'true') { _options.push('decimal') @@ -578,6 +578,24 @@ </Form.Item> </Col> ) + } else if (item.type === 'checkbox') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal, + rules: [{ + required: item.required, + message: '璇烽�夋嫨' + item.label + '!' + }] + })( + <Checkbox.Group style={{whiteSpace: 'nowrap'}}> + {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} + </Checkbox.Group> + )} + </Form.Item> + </Col> + ) } else if (item.type === 'color') { fields.push( <Col span={12} key={index} className="color-form"> diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 7b651e9..32da945 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -695,6 +695,21 @@ required: true }, { + type: 'checkbox', + key: 'evalchars', + label: '鏇挎崲瀛楃', + initVal: card.evalchars || ['enter', 'space'], + tooltip: '鍏紡瑙f瀽鍚庯紝鍙浛鎹㈠洖杞︺�佺┖鏍肩瓑瀛楃锛屽疄鐜版崲琛屻�佸瓧闂磋窛鎺у埗绛夐〉闈㈡晥鏋溿��', + required: false, + options: [{ + value: 'enter', + text: '鍥炶溅绗�' + }, { + value: 'space', + text: '绌烘牸' + }] + }, + { type: 'radio', key: 'noValue', label: '绌哄��', diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index dabb6ca..a159f9b 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -7,7 +7,7 @@ import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' import { getModalForm } from '@/templates/zshare/formconfig' -import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js' +import { resetStyle, getTables, checkComponent, getInterfaces } from '@/utils/utils-custom.js' import MKEmitter from '@/utils/events.js' import Utils from '@/utils/utils.js' import getWrapForm from './options' @@ -468,9 +468,9 @@ _card.setting.supModule = '' } } else if (res.datatype === 'public') { - let interfaces = window.GLOB.customMenu.interfaces || [] + let interfaces = getInterfaces() - let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0] + let d = interfaces.filter(m => m.value === res.publicId)[0] if (d) { _card.columns = fromJS(d.columns).toJS() diff --git a/src/menu/components/form/simple-form/options.jsx b/src/menu/components/form/simple-form/options.jsx index b9108ff..a1a4dc4 100644 --- a/src/menu/components/form/simple-form/options.jsx +++ b/src/menu/components/form/simple-form/options.jsx @@ -1,4 +1,4 @@ -import MenuUtils from '@/utils/utils-custom.js' +import MenuUtils, { getInterfaces } from '@/utils/utils-custom.js' /** * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 @@ -45,18 +45,7 @@ } } - let interfaces = [] - if (menu.interfaces) { - menu.interfaces.forEach(item => { - if (item.status === 'true') { - interfaces.push({ - value: item.uuid, - label: item.name - }) - } - }) - } - + let interfaces = getInterfaces() let buttons = [] if (!wrap.enable || wrap.enable === 'true') { diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx index cd62ff5..9c10aac 100644 --- a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -442,6 +442,21 @@ required: true }, { + type: 'checkbox', + key: 'evalchars', + label: '鏇挎崲瀛楃', + initVal: card.evalchars || ['enter', 'space'], + tooltip: '鍏紡瑙f瀽鍚庯紝鍙浛鎹㈠洖杞︺�佺┖鏍肩瓑瀛楃锛屽疄鐜版崲琛屻�佸瓧闂磋窛鎺у埗绛夐〉闈㈡晥鏋溿��', + required: false, + options: [{ + value: 'enter', + text: '鍥炶溅绗�' + }, { + value: 'space', + text: '绌烘牸' + }] + }, + { type: 'radio', key: 'noValue', label: '绌哄��', diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx index dac43a3..fd0ad48 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -95,8 +95,13 @@ } else if (this.record.perspective === 'linkurl') { _options.push('linkurl', 'open') } - } else if (this.record.type === 'formula' && this.record.eval === 'true') { - _options.push('decimal') + } else if (this.record.type === 'formula') { + if (this.record.eval === 'true') { + _options.push('decimal') + } + if (this.record.eval !== 'func') { + _options.push('evalchars') + } } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { _options.push('sortField') } diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index aad0434..d36923a 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -193,10 +193,10 @@ val = '$Index' } else if (column.type === 'formula') { val = column.formula - if (column.eval === 'false') { - val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') - val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> - } + // if (column.eval === 'false') { + // val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + // val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> + // } } return ( <td style={{...style}} className={className}> diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index ac067ff..4ed0df1 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -832,6 +832,21 @@ options: fields }, { + type: 'checkbox', + key: 'evalchars', + label: '鏇挎崲瀛楃', + initVal: card.evalchars || ['enter', 'space'], + tooltip: '鍏紡瑙f瀽鍚庯紝鍙浛鎹㈠洖杞︺�佺┖鏍肩瓑瀛楃锛屽疄鐜版崲琛屻�佸瓧闂磋窛鎺у埗绛夐〉闈㈡晥鏋溿��', + required: false, + options: [{ + value: 'enter', + text: '鍥炶溅绗�' + }, { + value: 'space', + text: '绌烘牸' + }] + }, + { type: 'radio', key: 'noValue', label: '绌哄��', diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx index 4e086b5..4a6a3b5 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Checkbox, Tooltip, Modal, notification, Popover } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import Api from '@/api' @@ -107,8 +107,13 @@ _options.push('hourFormat') } } - if (this.record.type === 'formula' && this.record.eval === 'true') { - _options.push('decimal') + if (this.record.type === 'formula') { + if (this.record.eval === 'true') { + _options.push('decimal') + } + if (this.record.eval !== 'func') { + _options.push('evalchars') + } } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { _options.push('sortField') } @@ -402,6 +407,15 @@ content = <Radio.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> {item.options.map(option => <Radio key={option.value} value={option.value}>{option.text}</Radio>)} </Radio.Group> + } else if (item.type === 'checkbox') { + rules = [ + { required: item.required, message: '璇烽�夋嫨' + item.label + '!' } + ] + initVal = item.initVal + + content = <Checkbox.Group onChange={(e) => {this.typeChange(item.key, e.target.value)}}> + {item.options.map(option => <Checkbox key={option.value} value={option.value}>{option.text}</Checkbox>)} + </Checkbox.Group> } else if (item.type === 'multiselect') { // 澶氶�� content = <Select showSearch diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 120c12b..6cdaf67 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -195,10 +195,10 @@ val = '$Index' } else if (column.type === 'formula') { val = column.formula - if (column.eval === 'false') { - val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') - val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> - } + // if (column.eval === 'false') { + // val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + // val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> + // } } return ( <td style={style} className={className}> diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index 6ad02d3..e5c2d75 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -513,6 +513,21 @@ required: true }, { + type: 'checkbox', + key: 'evalchars', + label: '鏇挎崲瀛楃', + initVal: card.evalchars || ['enter', 'space'], + tooltip: '鍏紡瑙f瀽鍚庯紝鍙浛鎹㈠洖杞︺�佺┖鏍肩瓑瀛楃锛屽疄鐜版崲琛屻�佸瓧闂磋窛鎺у埗绛夐〉闈㈡晥鏋溿��', + required: false, + options: [{ + value: 'enter', + text: '鍥炶溅绗�' + }, { + value: 'space', + text: '绌烘牸' + }] + }, + { type: 'radio', key: 'noValue', label: '绌哄��', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 5f3d09c..9ec8a74 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -94,8 +94,13 @@ } else if (this.record.perspective === 'linkurl') { _options.push('linkurl', 'open') } - } else if (this.record.type === 'formula' && this.record.eval === 'true') { - _options.push('decimal') + } else if (this.record.type === 'formula') { + if (this.record.eval === 'true') { + _options.push('decimal') + } + if (this.record.eval !== 'func') { + _options.push('evalchars') + } } else if (this.record.type === 'custom' && this.record.IsSort === 'true') { _options.push('sortField') } else if (this.record.type === 'extend') { diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 0279ed8..17246ed 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -195,10 +195,10 @@ val = '$Index' } else if (column.type === 'formula') { val = column.formula - if (column.eval === 'false') { - val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') - val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> - } + // if (column.eval === 'false') { + // val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + // val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> + // } } return ( <td style={{...style}} className={className}> diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 16ec710..2412eb3 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -991,8 +991,10 @@ if (val !== '') { if (val && typeof(val) === 'string') { - val = val.replace(/\n/ig, '<br/>') - if (!/<(span|div|p|a|img)\s/g.test(val)) { + if (!card.evalchars || card.evalchars.includes('enter')) { + val = val.replace(/\n/ig, '<br/>') + } + if ((!card.evalchars || card.evalchars.includes('space')) && !/<(span|div|p|a|img)\s/g.test(val)) { val = val.replace(/\s/ig, ' ') } diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 5390036..25493d5 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -446,7 +446,12 @@ content = <span dangerouslySetInnerHTML={{__html: content}}></span> } else if (content !== '') { content = `${col.prefix || ''}${content}${col.postfix || ''}` - content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + if (!col.evalchars || col.evalchars.includes('enter')) { + content = content.replace(/\n/ig, '<br/>') + } + if (!col.evalchars || col.evalchars.includes('space')) { + content = content.replace(/\s/ig, ' ') + } content = <span dangerouslySetInnerHTML={{__html: content}}></span> } diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 916818a..4aba73f 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -978,7 +978,12 @@ content = <span dangerouslySetInnerHTML={{__html: content}}></span> } else if (content !== '') { content = `${col.prefix || ''}${content}${col.postfix || ''}` - content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + if (!col.evalchars || col.evalchars.includes('enter')) { + content = content.replace(/\n/ig, '<br/>') + } + if (!col.evalchars || col.evalchars.includes('space')) { + content = content.replace(/\s/ig, ' ') + } content = <span dangerouslySetInnerHTML={{__html: content}}></span> } @@ -1292,7 +1297,12 @@ content = <span dangerouslySetInnerHTML={{__html: content}}></span> } else if (content !== '') { content = `${col.prefix || ''}${content}${col.postfix || ''}` - content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + if (!col.evalchars || col.evalchars.includes('enter')) { + content = content.replace(/\n/ig, '<br/>') + } + if (!col.evalchars || col.evalchars.includes('space')) { + content = content.replace(/\s/ig, ' ') + } content = <span dangerouslySetInnerHTML={{__html: content}}></span> } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 9d8a16c..b8f54e8 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -791,6 +791,9 @@ return cell.eleType !== 'button' || pass || permAction[cell.uuid] || cell.permission === 'false' }) } else if (item.type === 'form') { + if (item.wrap.datatype === 'public') { + balMap.set(item.wrap.publicId + 'public', true) + } item.subcards = item.subcards.map(group => { group.subButton.uuid = group.uuid group.subButton.OpenType = 'formSubmit' diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index ff072e0..26bde98 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -513,6 +513,9 @@ return true }) } else if (item.type === 'form') { + if (item.wrap.datatype === 'public') { + balMap.set(item.wrap.publicId + 'public', true) + } item.subcards = item.subcards.map(group => { group.subButton.uuid = group.uuid group.subButton.OpenType = 'formSubmit' diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 3dd8fbb..644475e 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -2080,25 +2080,16 @@ * @description 鑾峰彇璇█杞崲淇℃伅 */ export function getLangTrans (config) { - let defLang = window.GLOB.defLang || '' let langList = sessionStorage.getItem('langList') - if (langList) { - try { - langList = JSON.parse(langList) - if (langList.length === 1) { - defLang = '' - } else if (!defLang || langList.findIndex(item => item.Lang === defLang) === -1) { - if (langList.findIndex(item => item.Lang === 'zh-CN') === -1) { - defLang = langList[0].Lang - } else { - defLang = 'zh-CN' - } - } - } catch (e) { - defLang = '' - } - } else { + if (!langList) return + + let defLang = '' + + try { + langList = JSON.parse(langList) + defLang = langList[0] + } catch (e) { defLang = '' } @@ -2110,7 +2101,7 @@ let text = [] let filterElement = (card) => { - if (card.datatype === 'static' && card.eleType === 'text') { + if (card.datatype === 'static' && card.eleType === 'text' && !/@.+@/g.test(card.value)) { sql.push(card.value) } if (card.prefix) { @@ -2362,15 +2353,35 @@ list.unshift(`'${config.MenuName}','menu'`) } + if (config.fstMenuId && config.parentId) { + let menulist = sessionStorage.getItem('fstMenuList') + try { + menulist = JSON.parse(menulist) + } catch(e) { + menulist = [] + } + + menulist.forEach(item => { + if (item.MenuID !== config.fstMenuId) return + list.unshift(`'${item.MenuName}','menu'`) + item.children.forEach(cell => { + if (cell.MenuID !== config.parentId) return + list.unshift(`'${cell.MenuName}','menu'`) + }) + }) + } + let result = [] langList.forEach(lan => { - if (lan.Lang === defLang) return + if (lan === defLang) return list.forEach(n => { - result.push(`'${lan.Lang}',${n}`) + result.push(`'${lan}',${n}`) }) }) + + config.trans = true return result.join(';') } \ No newline at end of file diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 70fd769..898be70 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -16,6 +16,8 @@ const VersionsUp = asyncComponent(() => import('./versions')) const ThawMenu = asyncComponent(() => import('@/components/thawmenu')) const MenuForm = asyncComponent(() => import('./editfirstmenu/menuform')) +const TransMenu = asyncComponent(() => import('./transmenu')) + const { confirm } = Modal class Header extends Component { @@ -24,6 +26,7 @@ userName: sessionStorage.getItem('CloudUserName'), avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar')), logo: sessionStorage.getItem('CloudLogo') || MainLogo, + subLang: sessionStorage.getItem('subLangList') !== null, visible: false, loading: false } @@ -409,7 +412,7 @@ render () { const { mainMenu, editLevel } = this.props - const { menulist, visible, loading, logo } = this.state + const { menulist, visible, loading, logo, subLang } = this.state return ( <header className={'sys-header-container ant-menu-dark ' + (['level2', 'level3'].includes(editLevel) ? 'mask' : '')} id="main-header-container"> @@ -493,6 +496,12 @@ 缂栬緫 </Button> </div> : null} + {window.GLOB.systemType !== 'production' && subLang ? <div className="entrance"> + <div className="icon"><PlusOutlined /></div> + <div className="title">娣诲姞鑿滃崟</div> + <div className="detail">鍙�夋嫨姣嶈绯荤粺鐨勮彍鍗曪紝蹇�熻浆鎹负褰撳墠璇█銆�</div> + <TransMenu reload={this.reload} menulist={menulist}/> + </div> : null} </div> {/* 缂栬緫鑿滃崟 */} {editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} diff --git a/src/views/design/header/transmenu/index.jsx b/src/views/design/header/transmenu/index.jsx new file mode 100644 index 0000000..c31228e --- /dev/null +++ b/src/views/design/header/transmenu/index.jsx @@ -0,0 +1,194 @@ +import React, { Component } from 'react' +import { is, fromJS } from 'immutable' +import { Modal, notification, Button, Spin, Cascader } from 'antd' +// import { ClockCircleOutlined, SyncOutlined, WarningOutlined, CheckCircleOutlined } from '@ant-design/icons' +import moment from 'moment' + +import Api from '@/api' +import Utils from '@/utils/utils.js' +import './index.scss' + +class TransMenu extends Component { + state = { + visible: false, + loading: false, + lang: '', + dicts: [], + menus: [], + values: [] + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + trigger = () => { + let langs = sessionStorage.getItem('subLangList') + langs = JSON.parse(langs) + + this.setState({ + lang: langs[0], + loading: true, + visible: true, + values: [] + }) + + this.getDicts() + this.getMenus(langs[0]) + } + + getDicts = () => { + // let sql = `select id,lang,lang_name,mother_tongue,translation,use_type,case when use_type='menu' then '鑿滃崟' when use_type='button' then '鎸夐挳' when use_type='title' then '鏍囬' when use_type='list' then '閫夐」' else '鏂囨湰' end as use_type_text from s_app_lang_translation where appkey=@appkey@ and deleted=0 and translation != ''` + let sql = `select mother_tongue as reg,translation as value,use_type as type,case when use_type='menu' then '鑿滃崟' when use_type='button' then '鎸夐挳' when use_type='title' then '鏍囬' when use_type='list' then '閫夐」' else '鏂囨湰' end as use_type_text from s_app_lang_translation where appkey=@appkey@ and deleted=0 and translation != '' and lang='${sessionStorage.getItem('lang') || ''}'` + + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(sql, 'x'), + obj_name: 'data', + arr_field: 'reg,value,type', + exec_type: 'x' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt('', param.timestamp) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + + Api.getCloudConfig(param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } + + this.setState({dicts: result.data || []}) + }) + } + + getMenus = (lang) => { + let _param = { + func: 's_get_pc_menus', + systemType: window.GLOB.sysType, + pro_sys: '', + lang: lang, + debug: 'Y' + } + + Api.getCloudConfig(_param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return + } + + let menus = [] + + res.fst_menu && res.fst_menu.forEach(fst => { + let fstItem = { + value: fst.MenuID, + label: fst.MenuName, + children: [] + } + + fst.snd_menu && fst.snd_menu.forEach(snd => { + let sndItem = { + value: snd.MenuID, + label: snd.MenuName, + children: [] + } + + snd.trd_menu && snd.trd_menu.forEach(trd => { + let trdItem = { + value: trd.MenuID, + label: trd.MenuName, + MenuNo: trd.MenuNo, + } + + if (!trd.PageParam) return + + let PageParam = null + try { + PageParam = JSON.parse(trd.PageParam) + } catch (e) { + PageParam = null + } + + if (!PageParam || !['BaseTable', 'CustomPage'].includes(PageParam.Template)) return + + trdItem.PageParam = PageParam + + sndItem.children.push(trdItem) + }) + + if (sndItem.children.length === 0) return + + fstItem.children.push(sndItem) + }) + + if (fstItem.children.length === 0) return + + menus.push(fstItem) + }) + + this.setState({menus: menus, loading: false}) + }) + } + + submit = () => { + const { menulist } = this.props + const { values } = this.state + + if (!values || values.length !== 3) { + notification.warning({ + top: 92, + message: '璇烽�夋嫨涓夌骇鑿滃崟锛�', + duration: 5 + }) + return + } + + console.log(values) + console.log(menulist) + } + + cancel = () => { + this.setState({ + loading: false, + visible: false + }) + } + + render () { + const { visible, loading, menus } = this.state + + return ( + <> + <Button type="primary" onClick={this.trigger}> + 娣诲姞 + </Button> + <Modal + wrapClassName="sync-menu-modal" + title="娣诲姞鑿滃崟" + visible={visible} + width={800} + closable={false} + maskClosable={false} + onOk={this.submit} + onCancel={this.cancel} + destroyOnClose + > + {loading ? <Spin /> : <div> + <Cascader onChange={(val) => this.setState({values: val})} options={menus} expandTrigger="hover" placeholder="璇烽�夋嫨妯℃澘鑿滃崟"/> + </div>} + </Modal> + </> + ) + } +} + +export default TransMenu \ No newline at end of file diff --git a/src/views/design/header/transmenu/index.scss b/src/views/design/header/transmenu/index.scss new file mode 100644 index 0000000..9189f7a --- /dev/null +++ b/src/views/design/header/transmenu/index.scss @@ -0,0 +1,16 @@ +.sync-menu-modal { + .ant-modal-body { + position: relative; + padding: 24px 50px; + min-height: 200px; + max-height: calc(100vh - 210px); + .ant-cascader-picker { + width: 300px; + } + .ant-spin { + position: absolute; + left: 50%; + top: 75px; + } + } +} \ No newline at end of file diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index e634a4b..05679ae 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -700,7 +700,23 @@ localStorage.removeItem(_loginurl) } - sessionStorage.setItem('langList', JSON.stringify(res.lang_data || [])) + if (res.lang_data && res.lang_data.length > 1 && window.GLOB.systemType !== 'production') { + let list = res.lang_data.map(item => item.Lang) + let lang = 'zh-CN' + 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') + } + } + } this.setState({ loginWays: login_ways, diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 7d92941..cee5ca7 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -773,13 +773,17 @@ }) return } else if (this.checklog()) { - notification.success({ - top: 92, - message: '褰撳墠閰嶇疆鏈慨鏀癸紝鏃犻渶淇濆瓨銆�', - duration: 5 - }) - MKEmitter.emit('completeSave') - return + if (MenuType !== 'billPrint' && sessionStorage.getItem('langList') && !config.trans) { + + } else { + notification.success({ + top: 92, + message: '褰撳墠閰嶇疆鏈慨鏀癸紝鏃犻渶淇濆瓨銆�', + duration: 5 + }) + MKEmitter.emit('completeSave') + return + } } this.setState({ @@ -842,7 +846,7 @@ let interfaces = getFuncsAndInters(config) let urlFields = config.urlFields ? config.urlFields.join(',') : '' - let langSql = getLangTrans(config) + let langSql = MenuType !== 'billPrint' ? getLangTrans(config) : '' let param = { func: 'sPC_TrdMenu_AddUpt', diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 1fa22f4..1a5906a 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -533,13 +533,17 @@ if (!this.checkBase()) { return } else if (this.checklog()) { - notification.success({ - top: 92, - message: '褰撳墠閰嶇疆鏈慨鏀癸紝鏃犻渶淇濆瓨銆�', - duration: 5 - }) - MKEmitter.emit('completeSave') - return + if (sessionStorage.getItem('langList') && !config.trans) { + + } else { + notification.success({ + top: 92, + message: '褰撳墠閰嶇疆鏈慨鏀癸紝鏃犻渶淇濆瓨銆�', + duration: 5 + }) + MKEmitter.emit('completeSave') + return + } } this.setState({ -- Gitblit v1.8.0