From e83e0dd1b6fffd09c48561f3b69fa5a50df4a942 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 04 二月 2021 19:01:01 +0800 Subject: [PATCH] 2021-02-04 --- src/components/header/index.scss | 60 -- src/api/cacheutils.js | 288 ++++++++++++++++ src/views/design/header/index.scss | 51 -- src/tabviews/formtab/index.jsx | 7 src/views/design/header/index.jsx | 44 +- src/components/header/index.jsx | 173 +++++--- src/tabviews/zshare/topSearch/index.jsx | 7 src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 17 src/templates/zshare/verifycard/index.jsx | 4 src/tabviews/zshare/actionList/printbutton/index.jsx | 13 src/menu/components/share/actioncomponent/actionform/index.jsx | 15 src/api/index.js | 335 ++++++------------ src/tabviews/zshare/actionList/normalbutton/index.jsx | 14 src/utils/utils.js | 13 14 files changed, 575 insertions(+), 466 deletions(-) diff --git a/src/api/cacheutils.js b/src/api/cacheutils.js new file mode 100644 index 0000000..409b427 --- /dev/null +++ b/src/api/cacheutils.js @@ -0,0 +1,288 @@ +/** + * @description 缂撳瓨宸ュ叿绫� + */ +export default class CacheUtils { + /** + * @description 鎵撳紑websql + */ + static openWebSql () { + let service = window.GLOB.service ? '-' + window.GLOB.service.replace('/', '') : '' + try { + window.GLOB.WebSql = openDatabase(`mkdb${service}`, '1', 'mk-pc-database', 50 * 1024 * 1024) + window.GLOB.WebSql.transaction(tx => { + tx.executeSql('CREATE TABLE IF NOT EXISTS VERSIONS (version varchar(50), createDate varchar(50), CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { + + }, () => { + // eslint-disable-next-line + throw 'CREATE TABLE ERROR' + }) + tx.executeSql('CREATE TABLE IF NOT EXISTS CONFIGS (menuid varchar(50), userid varchar(50), openEdition varchar(50), webEdition varchar(50), LongParam text, LongParamUser text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50), CDefine4 varchar(50), CDefine5 varchar(50))', [], () => { + + }, () => { + // eslint-disable-next-line + throw 'CREATE TABLE ERROR' + }) + }) + // window.GLOB.WebSql.transaction(tx => { + // tx.executeSql('DROP TABLE VERSIONS') + // tx.executeSql('DROP TABLE CONFIGS') + // }) + } catch (e) { + console.warn('WebSql 鍒濆鍖栧け璐ワ紒') + window.GLOB.WebSql = null + } + } + + /** + * @description 鑾峰彇websql涓繚瀛樹俊鎭増鏈� + */ + static getWebSqlVersion () { + if (!window.GLOB.WebSql) { + return Promise.reject() + } + return new Promise((resolve, reject) => { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql('SELECT * FROM VERSIONS', [], (tx, results) => { + if (results.rows.length === 0) { + tx.executeSql('DELETE FROM CONFIGS') + resolve({version: '', createDate: ''}) + } else if (results.rows.length === 1) { + resolve(results.rows[0]) + } else if (results.rows.length > 1) { + tx.executeSql('DELETE FROM VERSIONS') + tx.executeSql('DELETE FROM CONFIGS') + resolve({version: '', createDate: ''}) + } + }, (tx, results) => { + window.GLOB.WebSql = null + reject() + console.warn(results) + }) + }) + }) + } + + /** + * @description 娓呯┖websql涓繚瀛樼殑閰嶇疆淇℃伅 + */ + static clearWebSqlConfig () { + if (!window.GLOB.WebSql) return + window.GLOB.WebSql.transaction(tx => { + tx.executeSql(`DELETE FROM CONFIGS`, [], () => {}, () => { window.GLOB.WebSql = null }) + }) + } + + /** + * @description 鍒犻櫎websql涓繚瀛樼殑閰嶇疆淇℃伅 + */ + static delWebSqlConfig (keys) { + if (!window.GLOB.WebSql || !keys) return + window.GLOB.WebSql.transaction(tx => { + tx.executeSql(`DELETE FROM CONFIGS where menuid in (${keys})`, [], () => {}, () => { + window.GLOB.WebSql = null + }) + }) + } + + /** + * @description 鍒犻櫎websql涓繚瀛樼殑閰嶇疆淇℃伅 + */ + static delMenuWebSqlConfig (menuId) { + if (!window.GLOB.WebSql || !menuId) return Promise.resolve() + return new Promise(resolve => { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql(`DELETE FROM CONFIGS where menuid='${menuId}'`, [], () => { + resolve() + }, () => { + window.GLOB.WebSql = null + resolve() + }) + }) + }) + } + + /** + * @description 鏇存柊websql涓厤缃俊鎭殑淇濆瓨鏃堕棿 + */ + static updateWebSqlTime (curTime) { + if (!window.GLOB.WebSql || !curTime) return + window.GLOB.WebSql.transaction(tx => { + tx.executeSql(`UPDATE VERSIONS SET createDate='${curTime}'`, [], () => {}, () => { + window.GLOB.WebSql = null + }) + }) + } + + /** + * @description 鏇存柊websql涓厤缃俊鎭殑鐗堟湰 + */ + static updateWebSqlversion (version, curTime) { + if (!window.GLOB.WebSql || !curTime || !version) return + window.GLOB.WebSql.transaction(tx => { + tx.executeSql(`UPDATE VERSIONS SET version='${version}', createDate='${curTime}'`, [], () => {}, () => { + window.GLOB.WebSql = null + }) + }) + } + + /** + * @description 鍒涘缓websql涓厤缃俊鎭殑鐗堟湰 + */ + static createWebSqlversion (version, curTime) { + if (!window.GLOB.WebSql || !curTime || !version) return + window.GLOB.WebSql.transaction(tx => { + tx.executeSql('INSERT INTO VERSIONS (version, createDate) VALUES (?, ?)', [version, curTime], () => {}, () => { + window.GLOB.WebSql = null + }) + }) + } + + /** + * @description 鍒涘缓websql涓厤缃俊鎭殑淇濆瓨鏃堕棿 + */ + static getWebSqlMenuConfig (MenuID, userid) { + if (!window.GLOB.WebSql || !MenuID || !userid) return Promise.reject() + return new Promise((resolve, reject) => { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql(`SELECT * FROM CONFIGS WHERE menuid='${MenuID}' and userid='${userid}'`, [], (tx, results) => { + let paramItem = results.rows[0] + if (paramItem) { + resolve({ + ErrCode: 'S', + ErrMesg: '', + LongParam: paramItem.LongParam, + LongParamUser: paramItem.LongParamUser, + message: '', + open_edition: paramItem.openEdition, + status: true, + web_edition: paramItem.webEdition + }) + } else { + reject() + } + }, (tx, results) => { + window.GLOB.WebSql = null + console.warn(results) + reject() + }) + }) + }) + } + + /** + * @description 灏嗘暟鎹啓鍏ebsql + */ + static writeInWebSql (data) { + if (!window.GLOB.WebSql || !data) return + window.GLOB.WebSql.transaction(tx => { + tx.executeSql('INSERT INTO CONFIGS (menuid, userid, openEdition, webEdition, LongParam, LongParamUser) VALUES (?, ?, ?, ?, ?, ?)', data) + }) + } + + /** + * @description 鎵撳紑IndexedDB + */ + static openIndexDB () { + let service = window.GLOB.service ? '-' + window.GLOB.service.replace('/', '') : '' + try { + let request = window.indexedDB.open(`mkdb${service}`, 1) + request.onerror = () => { + console.warn('IndexedDB 鍒濆鍖栧け璐ワ紒') + } + request.onsuccess = () => { + window.GLOB.IndexDB = request.result + } + request.onupgradeneeded = (event) => { + window.GLOB.IndexDB = event.target.result + if (!window.GLOB.IndexDB.objectStoreNames.contains('version')) { + window.GLOB.IndexDB.createObjectStore('version', { keyPath: 'id' }) + } + if (!window.GLOB.IndexDB.objectStoreNames.contains('configs')) { + let objectStore = window.GLOB.IndexDB.createObjectStore('configs', { keyPath: 'id' }) + objectStore.createIndex('type', 'type', { unique: false }) + objectStore.createIndex('menuid', 'menuid', { unique: false }) + objectStore.createIndex('userid', 'userid', { unique: false }) + } + } + } catch (e) { + console.warn('IndexedDB 鍒濆鍖栧け璐ワ紒') + window.GLOB.IndexDB = null + } + } + + /** + * @description 鑾峰彇IndexedDB涓繚瀛樹俊鎭増鏈� + */ + static getIndexDBVersion () { + if (!window.GLOB.IndexDB) { + return Promise.reject() + } + return new Promise((resolve, reject) => { + let request = window.GLOB.IndexDB.transaction(['version']) + .objectStore('version') + .get('mksoft') + + request.onerror = (event) => { + window.GLOB.IndexDB = null + console.warn(event) + reject() + } + + request.onsuccess = () => { + if (request.result) { + resolve(request.result) + } else { + this.clearIndexDBConfig() + resolve({version: '', createDate: ''}) + } + } + }) + } + + /** + * @description 娓呯┖IndexedDB涓繚瀛樼殑閰嶇疆淇℃伅 + */ + static clearIndexDBConfig () { + if (!window.GLOB.IndexDB) return + let request = window.GLOB.IndexDB.transaction(['configs'], 'readwrite').objectStore('configs').clear() + + request.onerror = () => { + window.GLOB.IndexDB = null + } + } + + /** + * @description 鏇存柊IndexedDB涓厤缃俊鎭殑鐗堟湰 + */ + static updateIndexDBversion (version) { + if (!window.GLOB.IndexDB || !version) return + + version.id = 'mksoft' + + let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + let request = objectStore.get('mksoft') + + request.onerror = () => { + window.GLOB.IndexDB = null + } + + request.onsuccess = () => { + if (request.result) { + let put = objectStore.put(version) + + put.onerror = () => { + window.GLOB.IndexDB = null + } + } else { + this.clearIndexDBConfig() + + let add = objectStore.add(version) + + add.onerror = () => { + window.GLOB.IndexDB = null + } + } + } + } + +} \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index 6b43e5e..587fafd 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -4,36 +4,21 @@ import md5 from 'md5' import moment from 'moment' import Utils from '@/utils/utils.js' +import CacheUtils from './cacheutils' import options from '@/store/options.js' -let mkDataBase = null +window.GLOB.WebSql = null +window.GLOB.IndexDB = null +const systemMenuKeys = `1581067625930haged11ieaivpavv77k,1581734956310scks442ul2d955g9tu5,1583991994144ndddg0bhh0is6shi0v1,1583979633842550imkchl4qt4qppsiv,1578900109100np8aqd0a77q3na46oas,16044812935562g807p3p12huk8kokmb, + 1585192949946f3et2ts8tn82krmumdf,15855615451212m12ip23vpcm79kloro,1587005717541lov40vg61q7l1rbveon,1590458676585agbbr63t6ihighg2i1g,1602315375262ikd33ii0nii34pt861o,1582771068837vsv54a089lgp45migbg, + 1582777675954ifu05upurs465omoth7,158294809668898cklbv6c5bou8e1fpu,1584676379094iktph45fb8imhg96bql,1584695125339vo5g7iqgfn01qmrd6s2,1584699661372vhmpp9dn9foo0eob722,15848421131551gg04ie8sitsd3f7467, + 1589782279158ngr675kk3oksin35sul,1589788042787ffdt9hle4s45k9r1nvs,15900310928174dro07ihfckghpb5h13,1594095599055qicg2eb642v5qglhnuo,1599613340050c8nu6rbst9d4emnnbsq,1577972969199lei1g0qkvlh4tkc908m, + 1578479100252lfbp29v1kafk4s4q4ig,1577971621421tg4v0i1ur8873k7e0ob,1577929944419lgc5h3hepum765e2k7u,1588493493409k9guqp067d31lu7blsv` if (window.openDatabase) { - let service = window.GLOB.service ? '-' + window.GLOB.service.replace('/', '') : '' - try { - mkDataBase = openDatabase(`mkdb${service}`, '1', 'mk-pc-database', 50 * 1024 * 1024) - mkDataBase.transaction(tx => { - tx.executeSql('CREATE TABLE IF NOT EXISTS VERSIONS (version varchar(50), createDate varchar(50), CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { - - }, () => { - // eslint-disable-next-line - throw 'CREATE TABLE ERROR' - }) - tx.executeSql('CREATE TABLE IF NOT EXISTS CONFIGS (menuid varchar(50), userid varchar(50), openEdition varchar(50), webEdition varchar(50), LongParam text, LongParamUser text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50), CDefine4 varchar(50), CDefine5 varchar(50))', [], () => { - - }, () => { - // eslint-disable-next-line - throw 'CREATE TABLE ERROR' - }) - }) - // mkDataBase.transaction(tx => { - // tx.executeSql('DROP TABLE VERSIONS') - // tx.executeSql('DROP TABLE CONFIGS') - // }) - } catch (e) { - console.warn(e) - mkDataBase = null - } + CacheUtils.openWebSql() +} else if (window.indexedDB) { + CacheUtils.openIndexDB() } axios.defaults.crossDomain = true @@ -259,163 +244,106 @@ */ getAppVersion (_resolve, _reject) { let appVersion = {} - - new Promise((resolve, reject) => { - if (!mkDataBase) { - reject() - } else { - mkDataBase.transaction(tx => { - if (!mkDataBase) { - reject() - return - } - tx.executeSql('SELECT * FROM VERSIONS', [], (tx, results) => { - if (results.rows.length === 0) { - tx.executeSql('DELETE FROM CONFIGS') - resolve({version: '', createDate: ''}) - } else if (results.rows.length === 1) { - resolve(results.rows[0]) - } else if (results.rows.length > 1) { - tx.executeSql('DELETE FROM VERSIONS') - tx.executeSql('DELETE FROM CONFIGS') - resolve({version: '', createDate: ''}) - } - }, (tx, results) => { - reject() - console.warn(results) - }) - }) - } - }).then(msg => { - if (msg.version) { - appVersion.oldVersion = msg.version - } - let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { + return Promise.reject() + } - let param = { - func: 's_get_app_version', - modifydate: msg.createDate || curTime, - } - - param.userid = sessionStorage.getItem('UserID') || '' - param.lang = localStorage.getItem('lang') || '' - param.SessionUid = localStorage.getItem('SessionUid') || '' - param.LoginUID = sessionStorage.getItem('LoginUID') || '' - param.appkey = window.GLOB.appkey || '' - - if (window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } - - param = this.encryptParam(param) - + if (window.GLOB.WebSql) { return new Promise((resolve, reject) => { - axios({ - url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, - method: 'post', - data: param - }).then(res => { - if (!res.status) { - reject() - return + CacheUtils.getWebSqlVersion().then(msg => { + appVersion.oldVersion = msg.version || '' + let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let param = { + func: 's_get_app_version', + modifydate: msg.createDate || curTime, } - let clear = false - let version = res.app_version || '1.00' - appVersion.newVersion = version - appVersion.oldVersion = appVersion.oldVersion || version - - if (res.menu_data && res.menu_data.length > 0) { - let keys = `1581067625930haged11ieaivpavv77k,1581734956310scks442ul2d955g9tu5,1583991994144ndddg0bhh0is6shi0v1,1583979633842550imkchl4qt4qppsiv,1578900109100np8aqd0a77q3na46oas,16044812935562g807p3p12huk8kokmb, - 1585192949946f3et2ts8tn82krmumdf,15855615451212m12ip23vpcm79kloro,1587005717541lov40vg61q7l1rbveon,1590458676585agbbr63t6ihighg2i1g,1602315375262ikd33ii0nii34pt861o,1582771068837vsv54a089lgp45migbg, - 1582777675954ifu05upurs465omoth7,158294809668898cklbv6c5bou8e1fpu,1584676379094iktph45fb8imhg96bql,1584695125339vo5g7iqgfn01qmrd6s2,1584699661372vhmpp9dn9foo0eob722,15848421131551gg04ie8sitsd3f7467, - 1589782279158ngr675kk3oksin35sul,1589788042787ffdt9hle4s45k9r1nvs,15900310928174dro07ihfckghpb5h13,1594095599055qicg2eb642v5qglhnuo,1599613340050c8nu6rbst9d4emnnbsq,1577972969199lei1g0qkvlh4tkc908m, - 1578479100252lfbp29v1kafk4s4q4ig,1577971621421tg4v0i1ur8873k7e0ob,1577929944419lgc5h3hepum765e2k7u,1588493493409k9guqp067d31lu7blsv` - - res.menu_data.forEach(mid => { - if (keys.indexOf(mid.menuid) > -1) { - clear = true - } - }) - } - - mkDataBase.transaction(tx => { - if (clear) { - tx.executeSql(`DELETE FROM CONFIGS`, [], () => {}, () => { reject() }) - } else if (res.menu_data && res.menu_data.length > 0) { - let keys = res.menu_data.map(mid => `'${mid.menuid}'`) - tx.executeSql(`DELETE FROM CONFIGS where menuid in (${keys.join(',')})`, [], () => {}, () => { - reject() + + this.getSystemConfig(param).then(res => { + if (!res.status) { + reject() + return + } + let clear = false + let version = res.app_version || '1.00' + appVersion.newVersion = version + appVersion.oldVersion = appVersion.oldVersion || version + + if (res.menu_data && res.menu_data.length > 0) { + res.menu_data.forEach(mid => { + if (systemMenuKeys.indexOf(mid.menuid) > -1) { + clear = true + } }) + } + + if (clear) { + CacheUtils.clearWebSqlConfig() + } else if (res.menu_data && res.menu_data.length > 0) { + let keys = res.menu_data.map(mid => `'${mid.menuid}'`).join(',') + CacheUtils.delWebSqlConfig(keys) } if (msg.version) { - tx.executeSql(`UPDATE VERSIONS SET createDate='${curTime}'`, [], () => { - resolve() - }, () => { - reject() - }) + CacheUtils.updateWebSqlTime(curTime) } else { - tx.executeSql('INSERT INTO VERSIONS (version, createDate) VALUES (?, ?)', [version, curTime], () => { - resolve() - }, () => { - reject() - }) + CacheUtils.createWebSqlversion(version, curTime) } + + resolve(appVersion) }) + }, () => { + reject() }) - }) - }, () => { - mkDataBase = null - _reject() - return Promise.reject() - }).then(() => { - _resolve(appVersion) - }, () => { - mkDataBase = null - _reject() - }) + }) + } else { + return new Promise((resolve, reject) => { + CacheUtils.getIndexDBVersion().then(msg => { + appVersion.oldVersion = msg.version || '' + let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let param = { + func: 's_get_app_version', + modifydate: msg.createDate || curTime, + } + + this.getSystemConfig(param).then(res => { + if (!res.status) { + reject() + return + } + let version = res.app_version || '1.00' + appVersion.newVersion = version + appVersion.oldVersion = appVersion.oldVersion || version + + if (res.menu_data && res.menu_data.length > 0) { + CacheUtils.clearIndexDBConfig() + } + + CacheUtils.updateIndexDBversion({version: version, createDate: curTime}) + + resolve(appVersion) + }) + }, () => { + reject() + }) + }) + } } /** * @description 鏇存柊绯荤粺鐗堟湰淇℃伅锛屾竻绌洪厤缃俊鎭� */ updateAppVersion (newVersion) { - return new Promise(resolve => { - if (!mkDataBase) { - resolve({status: false}) - return - } - let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - - mkDataBase.transaction(tx => { - tx.executeSql(`DELETE FROM CONFIGS`, [], () => {}, () => { - resolve({status: false}) - }) - tx.executeSql(`UPDATE VERSIONS SET version='${newVersion}', createDate='${curTime}'`, [], () => { - resolve({status: true}) - }, () => { - resolve({status: false}) - }) - }) - }) + let curTime = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + CacheUtils.clearWebSqlConfig() + CacheUtils.updateWebSqlversion(newVersion, curTime) + CacheUtils.clearIndexDBConfig() + CacheUtils.updateIndexDBversion({version: newVersion, createDate: curTime}) } /** * @description 鍒犻櫎鏌愪釜鑿滃崟閰嶇疆淇℃伅 */ deleteMenuStorage (menuId) { - return new Promise(resolve => { - if (!mkDataBase) { - resolve() - return - } - mkDataBase.transaction(tx => { - tx.executeSql(`DELETE FROM CONFIGS where menuid='${menuId}'`, [], () => { - resolve() - }, () => { - mkDataBase = null - }) - }) - }) + return CacheUtils.delMenuWebSqlConfig(menuId) } /** @@ -570,50 +498,23 @@ _param = JSON.stringify(_param) _param = md5(_param) - if (mkDataBase) { - param = this.encryptParam(param) - + if (window.GLOB.WebSql) { return new Promise(resolve => { - mkDataBase.transaction(tx => { - tx.executeSql(`SELECT * FROM CONFIGS WHERE menuid='${param.MenuID}' and userid='${param.userid}'`, [], (tx, results) => { - let paramItem = results.rows[0] - if (paramItem) { - resolve({ - ErrCode: 'S', - ErrMesg: '', - LongParam: paramItem.LongParam, - LongParamUser: paramItem.LongParamUser, - message: '', - open_edition: paramItem.openEdition, - status: true, - web_edition: paramItem.webEdition - }) - } else { - axios({ - url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, - method: 'post', - data: param - }).then(res => { - if (res.status) { - this.writeInWebSql([param.MenuID, param.userid, res.open_edition, res.web_edition, res.LongParam, res.LongParamUser]) - } - resolve(res) - }) + CacheUtils.getWebSqlMenuConfig(param.MenuID, param.userid).then(res => { + resolve(res) + }, () => { + param = this.encryptParam(param) + axios({ + url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + method: 'post', + data: param + }).then(res => { + if (res.status && window.GLOB.WebSql) { + CacheUtils.writeInWebSql([param.MenuID, param.userid, res.open_edition, res.web_edition, res.LongParam, res.LongParamUser]) + } else if (res.status) { + window.GLOB.CacheMap.set(_param, res) } - }, (tx, results) => { - mkDataBase = null - console.warn(results) - - axios({ - url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, - method: 'post', - data: param - }).then(res => { - if (res.status) { - window.GLOB.CacheMap.set(_param, res) - } - resolve(res) - }) + resolve(res) }) }) }) @@ -654,20 +555,12 @@ let _param = md5(JSON.stringify(param)) - if (mkDataBase) { + if (window.GLOB.WebSql) { return new Promise(resolve => { - mkDataBase.transaction(tx => { - tx.executeSql(`SELECT * FROM CONFIGS WHERE menuid='${param.MenuID}' and userid='${param.userid}'`, [], (tx, results) => { - let paramItem = results.rows[0] - if (paramItem) { - resolve({ ErrCode: 'S', ErrMesg: '', LongParam: paramItem.LongParam, message: '', status: true }) - } else { - resolve({ ErrCode: 'S', ErrMesg: '', LongParam: '', message: '', status: false }) - } - }, (tx, results) => { - mkDataBase = null - resolve({ErrCode: 'S', ErrMesg: '', LongParam: '', message: '', status: false}) - }) + CacheUtils.getWebSqlMenuConfig(param.MenuID, param.userid).then(res => { + resolve(res) + }, () => { + resolve({ ErrCode: 'S', ErrMesg: '', LongParam: '', message: '', status: false }) }) }) } else if (window.GLOB.CacheMap.has(_param)) { @@ -675,16 +568,6 @@ } else { return Promise.resolve({ErrCode: 'S', ErrMesg: '', LongParam: '', message: '', status: false}) } - } - - /** - * @description 灏嗘暟鎹啓鍏ebsql - */ - writeInWebSql (data) { - if (!mkDataBase) return - mkDataBase.transaction(tx => { - tx.executeSql('INSERT INTO CONFIGS (menuid, userid, openEdition, webEdition, LongParam, LongParamUser) VALUES (?, ?, ?, ?, ?, ?)', data) - }) } /** diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index f3a13f8..073bf55 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -16,6 +16,7 @@ logout } from '@/store/action' import Api from '@/api' +import MKEmitter from '@/utils/events.js' import options from '@/store/options.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' @@ -457,26 +458,6 @@ } }) } - - selectMenu = (item) => { - let tabs = fromJS(this.props.tabviews).toJS() - let menu = fromJS(item).toJS() - menu.selected = true - - tabs = tabs.filter(tab => { - tab.selected = false - return tab.MenuID !== menu.MenuID - }) - - if (this.props.tabviews.length !== tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) - } - - this.setState({}, () => { - tabs.push(menu) - this.props.modifyTabview(tabs) - }) - } UNSAFE_componentWillMount () { // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 @@ -494,16 +475,12 @@ componentDidMount () { // 鑾峰彇绯荤粺鐨勭増鏈俊鎭紝寤舵椂鏌ヨ setTimeout(() => { - new Promise((resolve, reject) => { - Api.getAppVersion(resolve, reject) - }).then(res => { + Api.getAppVersion().then(res => { this.setState({ oriVersion: res.oldVersion, newVersion: res.newVersion }) - }, () => { - console.warn('websql 鍒濆鍖栭敊璇紒') - }) + }, () => {}) }, 1000) } @@ -529,23 +506,23 @@ content: `鏈�鏂扮増鏈�${newVersion}锛屽綋鍓嶇増鏈�${oriVersion}`, onOk() { return new Promise(resolve => { - Api.updateAppVersion(newVersion).then(res => { - if (res.status) { - notification.success({ - top: 92, - message: '鍗囩骇鎴愬姛锛�', - duration: 2 - }) - _this.setState({oriVersion: newVersion}) - } else { - notification.warning({ - top: 92, - message: '鍗囩骇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�', - duration: 2 - }) - } + if (!window.GLOB.WebSql) { + notification.warning({ + top: 92, + message: '鍗囩骇澶辫触锛岃鍒锋柊椤甸潰閲嶈瘯锛�', + duration: 2 + }) resolve() - }) + } else { + Api.updateAppVersion(newVersion) + notification.success({ + top: 92, + message: '鍗囩骇鎴愬姛锛�', + duration: 2 + }) + _this.setState({oriVersion: newVersion}) + resolve() + } }) }, onCancel() {} @@ -559,6 +536,43 @@ window.open(url) } else if (options.sysType === 'SSO' || options.sysType === 'cloud') { window.open(`${window.location.href.replace(/\/index.html(.*)|\/#(.*)/ig, '')}/doc/index.html#?appkey=${window.GLOB.appkey}&LoginUID=${sessionStorage.getItem('LoginUID')}`) + } + } + + changeVerMenu(menu, type) { + if (type === 'first') { + if (menu.PageParam.OpenType === 'menu') { + + } else if (menu.PageParam.OpenType === 'outpage') { + window.open(menu.PageParam.linkUrl) + } + } else { + if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { + window.open(menu.src) + } else if (menu.OpenType === 'blank') { + menu.selected = true + this.props.modifyTabview([menu]) + } else { + let tabs = fromJS(this.props.tabviews).toJS() + tabs = tabs.filter(tab => { + tab.selected = false + return tab.MenuID !== menu.MenuID + }) + + if (this.props.tabviews.length !== tabs.length) { + this.props.modifyTabview(fromJS(tabs).toJS()) + } + + this.setState({}, () => { + menu.selected = true + tabs.push(menu) + this.props.modifyTabview(tabs) + }) + } + + if (window.GLOB.systemType === 'production') { + MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '鑿滃崟'}) + } } } @@ -597,33 +611,6 @@ <ul className="header-menu">{ menulist.map(item => { return ( - // <Dropdown overlay={ - // <Menu mode="vertical"> - // {item.children.map(cell => { - // if (!cell.children || cell.children.length === 0) { - // return ( - // <Menu.Item key={cell.MenuID}> - // {cell.MenuName} - // </Menu.Item> - // ) - // } else { - // return ( - // <Menu.SubMenu key={cell.MenuID} title={cell.MenuName}> - // {cell.children.map(m => ( - // <Menu.Item key={m.MenuID}> - // {m.MenuName} - // </Menu.Item> - // ))} - // </Menu.SubMenu> - // ) - // } - // })} - // </Menu> - // }> - // <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> - // <span>{item.MenuName}</span> - // </li> - // </Dropdown> <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> <span>{item.MenuName}</span> </li> @@ -631,6 +618,50 @@ })} </ul> : null } + {/* 姝e父鑿滃崟 */} + {/* {menulist ? + <ul className="header-menu vertical-menu">{ + menulist.map(item => { + if (item.children && item.children.length > 0) { + return ( + <Dropdown key={item.MenuID} overlayClassName="vertical-dropdown-menu" overlay={ + <Menu mode="vertical"> + {item.children.map(cell => { + if (!cell.children || cell.children.length === 0) { + return ( + <Menu.Item key={cell.MenuID}> + {cell.MenuName} + </Menu.Item> + ) + } else { + return ( + <Menu.SubMenu popupClassName="vertical-dropdown-submenu" key={cell.MenuID} title={cell.MenuName}> + {cell.children.map(m => ( + <Menu.Item key={m.MenuID} onClick={() => {this.changeVerMenu(m)}}> + {m.MenuName} + </Menu.Item> + ))} + </Menu.SubMenu> + ) + } + })} + </Menu> + }> + <li> + <span>{item.MenuName}</span> + </li> + </Dropdown> + ) + } else { + return ( + <li key={item.MenuID} onClick={() => {this.changeVerMenu(item, 'first')}}> + <span>{item.MenuName}</span> + </li> + ) + } + })} + </ul> : null + } */} {/* 澶村儚銆佺敤鎴峰悕 */} <Dropdown className="header-setting" overlay={menu}> <div> @@ -662,12 +693,12 @@ option.MenuNo.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 || option.EasyCode.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 ) { - return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item> + return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item> } else { return null } } - return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item> + return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item> })} </Menu> </div> diff --git a/src/components/header/index.scss b/src/components/header/index.scss index 521f393..77b3ade 100644 --- a/src/components/header/index.scss +++ b/src/components/header/index.scss @@ -1,6 +1,6 @@ .header-container { position: fixed; - z-index: 1060; + z-index: 20; left: 0; top: 0; font-weight: bold!important; @@ -75,21 +75,13 @@ } } } - // .header-vertical-menu { - // float: left; - // margin: 0; - // line-height: 48px; - // background: transparent; - // .ant-menu-submenu { - // border-bottom: 0!important; - // } - // >li { - // >.ant-menu-submenu-title { - // color: rgba(255, 255, 255, 0.85); - // font-size: 1.3rem; - // } - // } - // } + .header-menu.vertical-menu { + >li { + >span { + border-color: transparent!important; + } + } + } .header-setting { float: right; @@ -114,25 +106,13 @@ } } } - .edit-check { - font-size: 18px; - margin-top: 14px; - margin-left: 10px; - cursor: pointer; - } + .search-menu { float: right; font-size: 18px; margin-top: 17px; margin-right: 20px; cursor: pointer; - } - .level4-close { - position: relative; - top: 13px; - left: 20px; - height: 26px; - padding: 0 10px; } .menu-select-dropdown { top: 48px!important; @@ -177,18 +157,6 @@ background: rgba(0, 0, 0, 0); } } - .mobile { - position: absolute; - top: 135px; - right: 50px; - color: #1890ff; - } - .home-edit { - position: absolute; - top: 100px; - right: 50px; - color: #1890ff; - } } .header-dropdown { >li { @@ -201,6 +169,12 @@ } } } -.ant-dropdown-menu-submenu-title { - padding-right: 30px; + +.vertical-dropdown-menu, .vertical-dropdown-submenu { + ul.ant-dropdown-menu { + min-width: 125px; + } + .ant-dropdown-menu-submenu-title { + padding-right: 30px; + } } diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index e584aea..8125051 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -604,13 +604,13 @@ } handleConfirm = () => { - const { setting } = this.props + const { setting, card } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - values.uuid = this.props.card.uuid - values.verify = this.props.card.verify || null + values.uuid = card.uuid + values.verify = card.verify || null if (values.show === 'icon' && !values.icon) { notification.warning({ @@ -631,9 +631,16 @@ values.Ot = 'notRequired' } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) { - if ((values.Ot === 'requiredOnce' || this.props.card.Ot === 'requiredOnce') && this.props.card.Ot !== values.Ot) { + if ((values.Ot === 'requiredOnce' || card.Ot === 'requiredOnce') && card.Ot !== values.Ot) { values.verify.uniques = [] } + if (card.Ot !== values.Ot) { + if (values.Ot === 'notRequired') { + values.verify.invalid = 'false' + } else if (card.Ot === 'notRequired' && values.Ot !== 'notRequired') { + values.verify.invalid = 'true' + } + } } resolve(values) diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 6d7a090..ed54cf2 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -198,13 +198,6 @@ obj_name: 'data', arr_field: _option.field } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*') - param.LText = param.LText.replace(/@\$/ig, '*/') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '') - } param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 792b7ef..6d7a9d4 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1451,12 +1451,6 @@ if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _option.sql = _option.sql.replace(/\$@/ig, '/*') - _option.sql = _option.sql.replace(/@\$/ig, '*/') - } else { - _option.sql = _option.sql.replace(/@\$|\$@/ig, '') - } // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { _option.sql = _option.sql.replace(/@db@/ig, window.GLOB.externalDatabase) @@ -1481,13 +1475,6 @@ // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _option.sql = _option.sql.replace(/\$@/ig, '/*') - _option.sql = _option.sql.replace(/@\$/ig, '*/') - } else { - _option.sql = _option.sql.replace(/@\$|\$@/ig, '') - } cell.data_sql = Utils.formatOptions(_option.sql) cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) @@ -1594,6 +1581,7 @@ readonly: item.readonly === 'true', readin: _readin, fieldlen: _fieldlen, + writein: item.writein !== 'false', type: item.type, value: _initval } diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 5557e08..a778431 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -1076,12 +1076,6 @@ if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _option.sql = _option.sql.replace(/\$@/ig, '/*') - _option.sql = _option.sql.replace(/@\$/ig, '*/') - } else { - _option.sql = _option.sql.replace(/@\$|\$@/ig, '') - } // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { _option.sql = _option.sql.replace(/@db@/ig, window.GLOB.externalDatabase) @@ -1106,13 +1100,6 @@ // 鏁版嵁婧恠ql璇彞锛岄澶勭悊 if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _option.sql = _option.sql.replace(/\$@/ig, '/*') - _option.sql = _option.sql.replace(/@\$/ig, '*/') - } else { - _option.sql = _option.sql.replace(/@\$|\$@/ig, '') - } cell.data_sql = Utils.formatOptions(_option.sql) cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 2b5ffe7..79a77e4 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -95,13 +95,6 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _option.sql = _option.sql.replace(/\$@/ig, '/*') - _option.sql = _option.sql.replace(/@\$/ig, '*/') - } else { - _option.sql = _option.sql.replace(/@\$|\$@/ig, '') - } - // 娴嬭瘯绯荤粺鍗曚釜璇锋眰 if (menuType !== 'HS' && options.sysType === 'local' && !window.GLOB.systemType) { deForms.push({ diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index 464e035..a77dfb6 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -676,13 +676,13 @@ } handleConfirm = () => { - const { setting } = this.props + const { setting, card } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - values.uuid = this.props.card.uuid - values.verify = this.props.card.verify || null + values.uuid = card.uuid + values.verify = card.verify || null if (values.OpenType === 'excelIn') { values.position = 'toolbar' @@ -704,10 +704,15 @@ } else if (values.OpenType === 'funcbutton') { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡 values.position = 'toolbar' } else if (['pop', 'prompt', 'exec'].includes(values.OpenType) && values.verify) { - if (values.Ot === 'requiredOnce' && ['notRequired', 'requiredSgl', 'required'].includes(this.props.card.Ot)) { + if ((values.Ot === 'requiredOnce' || card.Ot === 'requiredOnce') && card.Ot !== values.Ot) { values.verify.uniques = [] - } else if (this.props.card.Ot === 'requiredOnce' && ['notRequired', 'requiredSgl', 'required'].includes(values.Ot)) { - values.verify.uniques = [] + } + if (card.Ot !== values.Ot) { + if (values.Ot === 'notRequired') { + values.verify.invalid = 'false' + } else if (card.Ot === 'notRequired' && values.Ot !== 'notRequired') { + values.verify.invalid = 'true' + } } } diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 09a4338..ea076fe 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -473,11 +473,11 @@ if (record.TypeCharOne === 'n') { _text = record.ModularDetailCode + Array(_type).join('0') + '1' } else if (record.TypeCharOne === 'Y') { - _text = record.ModularDetailCode + moment().format('YYYYMMDD') + Array(_type).join('0') + '1' + _text = record.ModularDetailCode + moment().format('YYMMDD') + Array(_type).join('0') + '1' } else if (record.TypeCharOne === 'Lp') { _text = Array(_type).join('0') + '10' } else if (record.TypeCharOne === 'BN') { - _text = moment().format('YYYYMMDD') + Array(_type).join('0') + '1' + _text = moment().format('YYMMDD') + Array(_type).join('0') + '1' } return _text } diff --git a/src/utils/utils.js b/src/utils/utils.js index b1d5fcd..8d35665 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -718,6 +718,17 @@ sql = `select ${item.type === 'checkcard' ? 'top 20' : ''} ${arrfield} from (select distinct ${arrfield} from ${_datasource}) a` } + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + sql = sql.replace(/\$@/ig, '/*') + sql = sql.replace(/@\$/ig, '*/') + } else { + sql = sql.replace(/@\$|\$@/ig, '') + } + + if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) { + console.info(sql) + } + return { sql: sql, field: arrfield @@ -1266,7 +1277,7 @@ } // 澶辨晥楠岃瘉锛屾坊鍔犳暟鎹椂涓嶇敤 - if (btn.sqlType !== 'insert' && verify.invalid === 'true' && setting.dataresource) { + if (btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && verify.invalid === 'true' && setting.dataresource) { let datasource = setting.dataresource if (/\s/.test(datasource) && !/tb$/.test(datasource)) { // 鎷兼帴鍒悕 datasource = '(' + datasource + ') tb' diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index ddc65dd..99584b2 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -299,29 +299,18 @@ } render () { - const { mainMenu } = this.props + const { mainMenu, editLevel } = this.props const { menulist } = this.state - const menu = ( - <Menu className="header-dropdown"> - <Menu.Item key="switch"> - {this.state.dict['main.edit']} - <Switch size="small" style={{marginLeft: '7px'}} disabled={!!this.props.editLevel} checked={true} onChange={this.changeEditState} /> - </Menu.Item> - <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> - <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> - </Menu> - ) - return ( - <header className={'sys-header-container ant-menu-dark ' + (this.props.editLevel === 'level2' || this.props.editLevel === 'level3' ? 'mask' : '')} id="main-header-container"> + <header className={'sys-header-container ant-menu-dark ' + (['level2', 'level3', 'HS'].includes(editLevel) ? 'mask' : '')} id="main-header-container"> <div className="header-logo"><img src={MainLogo} alt=""/></div> <div className="header-collapse"> <Icon type="menu-fold"/> </div> {/* 姝e父鑿滃崟 */} - {this.props.editLevel !== 'level1' && menulist ? - <ul className={'header-menu ' + this.props.editLevel}>{ + {editLevel !== 'level1' && menulist ? + <ul className={'header-menu ' + editLevel}>{ menulist.map(item => { return ( <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}> @@ -329,29 +318,38 @@ </li> ) })} - {!this.props.editLevel || this.props.editLevel === 'HS' ? - <li key="HS" onClick={this.enterEditManage} className={this.props.editLevel === 'HS' ? 'active' : ''}> + {!editLevel || editLevel === 'HS' ? + <li key="HS" onClick={this.enterEditManage} className={editLevel === 'HS' ? 'active' : ''}> <span>HS</span> </li> : null } </ul> : null } - {this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} + {editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} - {!this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {/* {!this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? + {!editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} + {/* {!editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ? <a href="#/mobmanage" target="_blank" className="mobile" type="edit"> 搴旂敤绠$悊 <Icon type="arrow-right" /></a> : null } */} {/* window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'home', MenuId: 'home_page_id', MenuName: '棣栭〉' }))) */} - {!this.props.editLevel && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? + {!editLevel && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? <a className="home-edit" href={`#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=`} target="_blank" rel="noopener noreferrer"> 棣栭〉 <Icon type="arrow-right" /> </a> : null } {/* 缂栬緫鑿滃崟 */} - {this.props.editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} + {editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null} {/* 澶村儚銆佺敤鎴峰悕 */} - <Dropdown className="header-setting" overlay={menu}> + <Dropdown className="header-setting" overlay={ + <Menu className="header-dropdown"> + <Menu.Item key="switch"> + {this.state.dict['main.edit']} + <Switch size="small" style={{marginLeft: '7px'}} disabled={!!editLevel} checked={true} onChange={this.changeEditState} /> + </Menu.Item> + <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> + <Menu.Item key="logout" onClick={this.logout}>{this.state.dict['main.logout']}</Menu.Item> + </Menu> + }> <div> <img src={this.state.avatar || avatar} alt=""/> <span> diff --git a/src/views/design/header/index.scss b/src/views/design/header/index.scss index f26213a..166e21a 100644 --- a/src/views/design/header/index.scss +++ b/src/views/design/header/index.scss @@ -115,62 +115,13 @@ margin-left: 10px; cursor: pointer; } - .search-menu { - float: right; - font-size: 18px; - margin-top: 17px; - margin-right: 20px; - cursor: pointer; - } .level4-close { position: relative; top: 13px; left: 20px; height: 26px; padding: 0 10px; - } - .menu-select-dropdown { - top: 48px!important; - box-shadow: 0px 0px 2px #cdcdcd; - border-radius: 0 0 4px 4px; - background: #ffffff; - .ant-input-affix-wrapper { - margin-top: 2px; - } - .menu-select-box { - max-height: 200px; - min-height: 50px; - overflow-y: auto; - background: #ffffff; - margin-bottom: 3px; - .ant-menu { - border-radius: 0 0 4px 4px; - } - .ant-menu-item { - padding: 0px 25px; - height: 26px; - line-height: 26px; - color: rgba(0, 0, 0, 0.85); - cursor: pointer; - } - .ant-menu-item:hover { - background-color: #e6f7ff; - } - } - .menu-select-box::-webkit-scrollbar { - width: 7px; - } - .menu-select-box::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); - background: rgba(0, 0, 0, 0.13); - } - .menu-select-box::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border-radius: 3px; - border: 1px solid rgba(0, 0, 0, 0.07); - background: rgba(0, 0, 0, 0); - } + z-index: 2; } .mobile { position: absolute; -- Gitblit v1.8.0