From 04dc8530bf6241573fe788e0e74a5cf4d9a8e0b3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 25 八月 2022 18:29:56 +0800 Subject: [PATCH] 2022-08-25 --- src/menu/picturecontroller/index.jsx | 2 src/views/design/header/index.jsx | 161 +++ src/components/header/index.jsx | 200 ---- src/tabviews/zshare/normalTable/index.jsx | 38 src/views/mainparams/index.scss | 7 src/menu/picturecontroller/index.scss | 2 src/router/index.js | 51 - /dev/null | 339 -------- src/views/tabledesign/index.jsx | 982 +++++++++++++++++++--- src/views/tabledesign/menuform/index.jsx | 323 +++++- src/views/mainparams/index.jsx | 50 + src/api/index.js | 5 src/tabviews/custom/components/share/normalTable/index.jsx | 38 src/views/menudesign/index.scss | 4 src/components/sidemenu/index.jsx | 2 src/views/tabledesign/index.scss | 245 +++++ src/views/menudesign/index.jsx | 2 src/views/tabledesign/menuform/index.scss | 8 src/views/login/index.jsx | 4 19 files changed, 1,572 insertions(+), 891 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index d57ee32..1311362 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -42,11 +42,6 @@ const setCurrentUrl = (res) => { if (!!(window.history && window.history.pushState)) { - if (window.location.href.indexOf('paramsmain') > -1) { - let _href = window.location.href.split('#') - localStorage.setItem(_href[0] + 'paramsmain', _href[1]) - } - sessionStorage.clear() sessionStorage.setItem('loginError', JSON.stringify({url: res.config ? res.config.url : '', request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index afbac7f..0b74be7 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -222,12 +222,6 @@ let ThirdMenuId = sessionStorage.getItem('ThirdMenu') _menu = thdMenuList.filter(item => item.MenuID === ThirdMenuId)[0] // 閫氳繃url涓璵enuid绛涢�夊嚭閫変腑鐨勪富鑿滃崟 - if (_menu) { - mainMenu = menulist.filter(item => item.MenuID === _menu.FstId)[0] - mainMenu = fromJS(mainMenu).toJS() - mainMenu.openId = _menu.ParentId - } - sessionStorage.removeItem('ThirdMenu') } @@ -253,7 +247,6 @@ getMenulist = (result) => { let thdMenuList = [] - let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] let menulist = [] result.fst_menu && result.fst_menu.forEach(fst => { let fstItem = { @@ -264,14 +257,13 @@ } if (fst.PageParam) { try { - fstItem.PageParam = JSON.parse(fst.PageParam) - } catch (e) { - fstItem.PageParam = null - } - if (fstItem.PageParam && fstItem.PageParam.OpenType === 'outpage' && fstItem.PageParam.linkUrl) { - fstItem.OpenType = 'outpage' - fstItem.linkUrl = fstItem.PageParam.linkUrl - } + let PageParam = JSON.parse(fst.PageParam) + + if (PageParam.OpenType === 'outpage' && PageParam.linkUrl) { + fstItem.OpenType = 'outpage' + fstItem.linkUrl = PageParam.linkUrl + } + } catch (e) {} } if (fst.snd_menu) { @@ -280,31 +272,16 @@ ParentId: fst.MenuID, MenuID: snd.MenuID, MenuName: snd.MenuName, - PageParam: {Icon: 'folder'}, + Icon: 'folder', children: [] } if (snd.PageParam) { try { - sndItem.PageParam = JSON.parse(snd.PageParam) - } catch (e) { - sndItem.PageParam = {Icon: 'folder'} - } - } + let PageParam = JSON.parse(snd.PageParam) - let msg = { - UserID: sessionStorage.getItem('UserID'), - LoginUID: sessionStorage.getItem('LoginUID'), - User_Name: sessionStorage.getItem('User_Name'), - Full_Name: sessionStorage.getItem('Full_Name'), - Member_Level: sessionStorage.getItem('Member_Level'), - dataM: sessionStorage.getItem('dataM'), - avatar: sessionStorage.getItem('avatar'), - debug: sessionStorage.getItem('debug'), - role_id: sessionStorage.getItem('role_id'), - mainlogo: window.GLOB.mainlogo, - navBar: window.GLOB.navBar || '', - mstyle: window.GLOB.style + sndItem.Icon = PageParam.Icon || 'folder' + } catch (e) {} } if (snd.trd_menu) { @@ -321,46 +298,23 @@ OpenType: 'newtab', hidden: 'false' } - - if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { - trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') - } else { + + if (trd.PageParam) { try { - trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} - } catch (e) { - trdItem.PageParam = {OpenType: 'newtab'} - } + let PageParam = JSON.parse(trd.PageParam) - trdItem.type = trdItem.PageParam.Template || trdItem.type - trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType - trdItem.hidden = trdItem.PageParam.hidden || trdItem.hidden + trdItem.type = PageParam.Template || trdItem.type + trdItem.OpenType = PageParam.OpenType || trdItem.OpenType + trdItem.hidden = PageParam.hidden || trdItem.hidden - if (trdItem.type === 'NewPage') { - trdItem.src = trdItem.PageParam.url || '' - - if (trdItem.src.indexOf('paramsmain/') > -1) { - try { - let _url = trdItem.src.split('paramsmain/')[0] + 'paramsmain/' - let _param = JSON.parse(window.decodeURIComponent(window.atob(trdItem.src.split('paramsmain/')[1]))) - _param.UserID = sessionStorage.getItem('UserID') - _param.LoginUID = sessionStorage.getItem('LoginUID') - _param.User_Name = sessionStorage.getItem('User_Name') - _param.Full_Name = sessionStorage.getItem('Full_Name') - - trdItem.src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } + if (trdItem.type === 'NewPage') { + trdItem.src = PageParam.url || '' } - } else { - // 鎵撳紑鏂伴〉闈㈤摼鎺� - trdItem.src = '#/paramsmain/' + window.btoa(window.encodeURIComponent(JSON.stringify({ - ...msg, - ThirdMenu: trd.MenuID - }))) - } + } catch (e) {} } + + // 鎵撳紑鏂伴〉闈㈤摼鎺� + trdItem.src = '#/mainparams/' + trd.MenuID thdMenuList.push(trdItem) @@ -444,7 +398,6 @@ localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: param.password})))) } - this.setSystemFuncs() this.props.modifyMainMenu(null) this.props.history.replace('/design') } else { @@ -462,106 +415,6 @@ }) } }) - }) - } - - setSystemFuncs = () => { - if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { - return - } - this.getfuncTime().then(res => { - Api.getSystemFuncs(res.createDate).then(result => { - if (!result.status) { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } else if (result.func_detail && result.func_detail.length > 0) { - this.writeFuncs(result.func_detail) - } - }) - }) - } - - writeFuncs = (funcs) => { - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - - let sys_datetime = sessionStorage.getItem('sys_datetime') - let app_datetime = sessionStorage.getItem('app_datetime') - if (sys_datetime && app_datetime) { - let seconds = Math.floor((new Date().getTime() - app_datetime) / 1000) - timestamp = moment(sys_datetime, 'YYYY-MM-DD HH:mm:ss').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss') - } - - if (window.GLOB.WebSql) { - window.GLOB.WebSql.transaction(tx => { - tx.executeSql('DELETE FROM FUNCS') - - funcs.forEach(item => { - if (!item.key_sql) return - tx.executeSql('INSERT INTO FUNCS (func_code, key_sql) VALUES (?, ?)', [item.func_code, item.key_sql]) - }) - tx.executeSql(`UPDATE VERSIONS SET createDate='${timestamp}' where CDefine1='funcs'`) - }) - } else { - let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') - - objectStore.clear() - - funcs.forEach(item => { - if (!item.key_sql) return - item.id = item.func_code - objectStore.add(item) - }) - - let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) - } - } - - getfuncTime = () => { - return new Promise((resolve, reject) => { - if (window.GLOB.WebSql) { - window.GLOB.WebSql.transaction(tx => { - tx.executeSql("SELECT * FROM VERSIONS where CDefine1='funcs'", [], (tx, results) => { - let rows = results.rows - if (rows.length === 0) { - tx.executeSql('DELETE FROM FUNCS') - tx.executeSql('INSERT INTO VERSIONS (version, createDate, CDefine1) VALUES (?, ?, ?)', ['1.0', '1970-01-01 14:59:09.000', 'funcs']) - resolve({createDate: '1970-01-01 14:59:09.000'}) - } else { - resolve(rows[0]) - } - }, (tx, results) => { - reject() - console.warn(results) - }) - }) - } else { - let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - let request = objectStore.get('funcs') - - request.onerror = (event) => { - console.warn(event) - reject() - } - - request.onsuccess = () => { - if (request.result) { - resolve(request.result) - } else { - let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - - add.onerror = () => { - reject() - } - add.onsuccess = () => { - resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - } - } - } - } }) } @@ -653,6 +506,13 @@ // search_type: '' // }).then(res => { // }) + + // sessionStorage 璺ㄩ〉闈㈠叡浜� + window.addEventListener('storage', (e) => { + if (e.key === 'getSessionStorage' && e.newValue) { + localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) + } + }) } shouldComponentUpdate (nextProps, nextState) { diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index 4df598a..2e040f5 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -103,7 +103,7 @@ key={item.MenuID} title={ <span> - <MkIcon type={item.PageParam.Icon} /> + <MkIcon type={item.Icon} /> <span>{item.MenuName}</span> </span> } diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index 9f41000..ec99c44 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -247,7 +247,7 @@ <div style={{display: 'inline-block'}}> <Button className="mk-border-purple" onClick={this.trigger}><PictureOutlined /> 璧勬簮绠$悊</Button> <Modal - title="绮樿创" + title="璧勬簮绠$悊" wrapClassName="picture-control-model" visible={visible} width={1200} diff --git a/src/menu/picturecontroller/index.scss b/src/menu/picturecontroller/index.scss index c059029..5cf5400 100644 --- a/src/menu/picturecontroller/index.scss +++ b/src/menu/picturecontroller/index.scss @@ -4,7 +4,7 @@ .ant-modal-body { max-height: calc(100vh - 120px); min-height: 510px; - padding-top: 5px; + padding: 10px 5px 24px; } } .ant-tabs-tabpane { diff --git a/src/router/index.js b/src/router/index.js index 0d98df5..5d1c87e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,15 +2,15 @@ import {HashRouter, Switch, Route, Redirect} from 'react-router-dom' import md5 from 'md5' import moment from 'moment' -import { styles } from '@/store/options.js' import asyncComponent from '@/utils/asyncComponent' import asyncLoadComponent from '@/utils/asyncLoadComponent' -const Pay = asyncLoadComponent(() => import('@/views/pay')) -const Sso = asyncLoadComponent(() => import('@/views/sso')) -const Main = asyncLoadComponent(() => import('@/views/main')) -const Design = asyncLoadComponent(() => import('@/views/design')) const Login = asyncLoadComponent(() => import('@/views/login')) +const Main = asyncLoadComponent(() => import('@/views/main')) +const Sso = asyncLoadComponent(() => import('@/views/sso')) +const Pay = asyncLoadComponent(() => import('@/views/pay')) +const MainParams = asyncLoadComponent(() => import('@/views/mainparams')) +const Design = asyncLoadComponent(() => import('@/views/design')) const NotFound = asyncComponent(() => import('@/views/404')) const AppManage = asyncLoadComponent(() => import('@/views/appmanage')) const AppCheck = asyncLoadComponent(() => import('@/views/appcheck')) @@ -29,10 +29,10 @@ const routers = [ {path: '/login', name: 'login', component: Login, auth: false}, + {path: '/main', name: 'main', component: Main, auth: true}, {path: '/pay/:param', name: 'pay', component: Pay, auth: false}, {path: '/print/:param', name: 'print', component: PrintT, auth: false}, {path: '/ssologin/:param', name: 'ssologin', component: Sso, auth: false}, - {path: '/main', name: 'main', component: Main, auth: true}, {path: '/design', name: 'design', component: Design, auth: true}, {path: '/appmanage', name: 'appmanage', component: AppManage, auth: true}, {path: '/appcheck', name: 'appcheck', component: AppCheck, auth: true}, @@ -46,7 +46,7 @@ {path: '/billprint/:param', name: 'billprint', component: BillPrint, auth: true}, {path: '/docprint/:menuId', name: 'docprint', component: BillPrint, auth: false}, {path: '/docprint/:menuId/:id', name: 'docprint', component: BillPrint, auth: false}, - {path: '/paramsmain/:param', name: 'pmain', component: Main, auth: true}, + {path: '/mainparams/:menuId', name: 'mainparams', component: MainParams, auth: false}, {path: '/role/:param', name: 'role', component: RoleManage, auth: true}, {path: '/hs', name: 'hs', component: SystemFunc, auth: true}, {path: '/interface', name: 'interface', component: Interface, auth: true} @@ -57,41 +57,7 @@ if (!item.auth) { // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆 return (<item.component {...props}/>) } - - if (item.name === 'pmain') { // 鏂扮獥鍙f墦寮�锛屽彇url鍙傛暟鏀惧叆sessionStorage - try { - let _param = JSON.parse(window.decodeURIComponent(window.atob(props.match.params.param))) - - if (typeof(_param) === 'object') { - _param.UserID && sessionStorage.setItem('UserID', _param.UserID) - _param.LoginUID && sessionStorage.setItem('LoginUID', _param.LoginUID) - _param.User_Name && sessionStorage.setItem('User_Name', _param.User_Name) - _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name) - _param.debug && sessionStorage.setItem('debug', _param.debug) - _param.dataM && sessionStorage.setItem('dataM', _param.dataM) - _param.dataM && sessionStorage.setItem('localDataM', _param.dataM) - _param.avatar && sessionStorage.setItem('avatar', _param.avatar) - _param.role_id && sessionStorage.setItem('role_id', _param.role_id) - _param.dataM && sessionStorage.setItem('localRole_id', _param.dataM) - _param.Member_Level && sessionStorage.setItem('Member_Level', _param.Member_Level) - _param.ThirdMenu && sessionStorage.setItem('ThirdMenu', _param.ThirdMenu) - - window.GLOB.mainlogo = _param.mainlogo || '' - window.GLOB.navBar = _param.navBar || '' - - if (_param.mstyle && styles[_param.mstyle]) { - document.body.className = styles[_param.mstyle] - } - } - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } - - return (<item.component {...props}/>) - } - let userId = sessionStorage.getItem('UserID') // 鍒ゆ柇鏄惁瀛樺湪userid - let authCode = localStorage.getItem(window.location.href.split('#')[0] + 'AuthCode') // 鍒ゆ柇绯荤粺鏄惁鍦ㄦ巿鏉冩湡闄愬唴 let _s = md5('mksoft' + moment().format('YYYYMMDD')) let isauth = authCode && authCode.includes(_s) @@ -102,10 +68,9 @@ isauth = true } - if (userId && isauth) { + if (isauth) { return (<item.component {...props}/>) } else { - // return (<Redirect to={{ pathname: '/login', state: {from: props.location}}}/>) return (<Redirect to={{ pathname: '/login'}}/>) } } diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 4654657..4c99a8d 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -632,35 +632,21 @@ } else if (item.linkurl) { let src = item.linkurl - if (src.indexOf('paramsmain/') > -1) { - try { - let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/' - let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1]))) - _param.UserID = sessionStorage.getItem('UserID') - _param.LoginUID = sessionStorage.getItem('LoginUID') - _param.User_Name = sessionStorage.getItem('User_Name') - _param.param = __param - src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } - } else { - let con = '?' + let con = '?' - if (/\?/ig.test(src)) { - con = '&' - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - if (field.toLowerCase() === 'id') return - con += `${field}=${record[field] || ''}&` - }) - } - - src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + if (/\?/ig.test(src)) { + con = '&' } + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + window.open(src) } } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 8ba59fb..259b6c7 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -361,35 +361,21 @@ } else if (item.linkurl) { let src = item.linkurl - if (src.indexOf('paramsmain/') > -1) { - try { - let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/' - let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1]))) - _param.UserID = sessionStorage.getItem('UserID') - _param.LoginUID = sessionStorage.getItem('LoginUID') - _param.User_Name = sessionStorage.getItem('User_Name') - _param.param = __param - src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } - } else { - let con = '?' + let con = '?' - if (/\?/ig.test(src)) { - con = '&' - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - if (field.toLowerCase() === 'id') return - con += `${field}=${record[field] || ''}&` - }) - } - - src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + if (/\?/ig.test(src)) { + con = '&' } + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + window.open(src) } } diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index f341544..01a85fd 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -3,6 +3,7 @@ import {connect} from 'react-redux' import { Dropdown, Menu, Modal, notification, Switch, Button, Popover } from 'antd' import { MenuFoldOutlined, SettingOutlined, AppstoreOutlined, DownOutlined, HomeOutlined, ApiOutlined, PlusOutlined, EditOutlined, MenuOutlined } from '@ant-design/icons' +import moment from 'moment' import asyncComponent from '@/utils/asyncComponent' import { @@ -61,8 +62,12 @@ async loadmenu () { // 鑾峰彇涓昏彍鍗� - let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'} - _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' + let _param = { + func: 's_get_pc_menus', + systemType: options.sysType, + pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '', + debug: 'Y' + } let result = await Api.getSystemConfig(_param) @@ -99,7 +104,6 @@ } getMenulist = (result) => { - let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] let menulist = [] let thdMenuList = [] result.fst_menu && result.fst_menu.forEach(fst => { @@ -150,23 +154,17 @@ level: 'third' } - if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { - trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') - trdItem.forbidden = true - } else { - try { - trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} - } catch (e) { - trdItem.PageParam = {OpenType: 'newtab'} - } + try { + trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} trdItem.type = trdItem.PageParam.Template || trdItem.type - trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType + trdItem.OpenType = trdItem.PageParam.OpenType + } catch (e) { + trdItem.PageParam = {OpenType: 'newtab'} + } - if (trdItem.type === 'CustomPage' && this.state.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄� - trdItem.forbidden = true - } + if (trdItem.type === 'CustomPage' && this.state.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄� + trdItem.forbidden = true } thdMenuList.push(trdItem) @@ -207,7 +205,6 @@ this.props.modifyMainMenu(this.state.menulist[0] || null) } - addMemuSubmit = () => { // 鏂板缓鑿滃崟锛氭彁浜� this.addMenuFormRef.handleConfirm().then(param => { @@ -238,6 +235,106 @@ }) }, () => {}) } + + setSystemFuncs = () => { + if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { + return + } + this.getfuncTime().then(res => { + Api.getSystemFuncs(res.createDate).then(result => { + if (!result.status) { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } else if (result.func_detail && result.func_detail.length > 0) { + this.writeFuncs(result.func_detail) + } + }) + }) + } + + writeFuncs = (funcs) => { + let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + + let sys_datetime = sessionStorage.getItem('sys_datetime') + let app_datetime = sessionStorage.getItem('app_datetime') + if (sys_datetime && app_datetime) { + let seconds = Math.floor((new Date().getTime() - app_datetime) / 1000) + timestamp = moment(sys_datetime, 'YYYY-MM-DD HH:mm:ss').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss') + } + + if (window.GLOB.WebSql) { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql('DELETE FROM FUNCS') + + funcs.forEach(item => { + if (!item.key_sql) return + tx.executeSql('INSERT INTO FUNCS (func_code, key_sql) VALUES (?, ?)', [item.func_code, item.key_sql]) + }) + tx.executeSql(`UPDATE VERSIONS SET createDate='${timestamp}' where CDefine1='funcs'`) + }) + } else { + let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') + + objectStore.clear() + + funcs.forEach(item => { + if (!item.key_sql) return + item.id = item.func_code + objectStore.add(item) + }) + + let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) + } + } + + getfuncTime = () => { + return new Promise((resolve, reject) => { + if (window.GLOB.WebSql) { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql("SELECT * FROM VERSIONS where CDefine1='funcs'", [], (tx, results) => { + let rows = results.rows + if (rows.length === 0) { + tx.executeSql('DELETE FROM FUNCS') + tx.executeSql('INSERT INTO VERSIONS (version, createDate, CDefine1) VALUES (?, ?, ?)', ['1.0', '1970-01-01 14:59:09.000', 'funcs']) + resolve({createDate: '1970-01-01 14:59:09.000'}) + } else { + resolve(rows[0]) + } + }, (tx, results) => { + reject() + console.warn(results) + }) + }) + } else { + let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + let request = objectStore.get('funcs') + + request.onerror = (event) => { + console.warn(event) + reject() + } + + request.onsuccess = () => { + if (request.result) { + resolve(request.result) + } else { + let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + + add.onerror = () => { + reject() + } + add.onsuccess = () => { + resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + } + } + } + } + }) + } UNSAFE_componentWillMount () { sessionStorage.setItem('isEditState', 'true') @@ -248,6 +345,17 @@ } componentDidMount () { + window.addEventListener('storage', (e) => { + if (e.key === 'menuUpdate') { + this.reload() + } else if (e.key === 'wxTemplates') { + if (e.newValue) { + sessionStorage.setItem('wxTemplates', e.newValue) + } + } + }) + MKEmitter.addListener('mkUpdateMenuList', this.reload) + if (window.GLOB.systemType !== 'production') { setTimeout(() => { Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { @@ -278,19 +386,12 @@ sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) } }) - }, 50) - } + }, 100) - window.addEventListener('storage', (e) => { - if (e.key === 'menuUpdate') { - this.reload() - } else if (e.key === 'wxTemplates') { - if (e.newValue) { - sessionStorage.setItem('wxTemplates', e.newValue) - } - } - }) - MKEmitter.addListener('mkUpdateMenuList', this.reload) + setTimeout(() => { + this.setSystemFuncs() + }, 200) + } } /** diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 7d5d094..b4f267e 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -18,10 +18,6 @@ const iszhCN = sessionStorage.getItem('lang') !== 'en-US' const _href = window.location.href.split('#')[0] -if (localStorage.getItem(_href + 'paramsmain')) { - sessionStorage.setItem('history', localStorage.getItem(_href + 'paramsmain')) - localStorage.removeItem(_href + 'paramsmain') -} class Login extends Component { state = { diff --git a/src/views/mainparams/index.jsx b/src/views/mainparams/index.jsx new file mode 100644 index 0000000..eb69a21 --- /dev/null +++ b/src/views/mainparams/index.jsx @@ -0,0 +1,50 @@ +import React, {Component} from 'react' +import { Spin } from 'antd' + +import './index.scss' + +class MainParams extends Component { + UNSAFE_componentWillMount() { + sessionStorage.setItem('ThirdMenu', this.props.match.params.menuId) + } + + componentDidMount() { + if (sessionStorage.getItem('UserID')) { + this.props.history.replace('/main') + } else { + localStorage.setItem('getSessionStorage', Date.now()) + + window.addEventListener('storage', function(event) { + if (event.key === 'sessionStorage' && event.newValue && !sessionStorage.getItem('UserID')) { + let values = event.newValue + values = JSON.parse(values) + + Object.keys(values).forEach(key => { + sessionStorage.setItem(key, values[key]) + }) + } + }) + + setTimeout(() => { + localStorage.removeItem('getSessionStorage') + localStorage.removeItem('sessionStorage') + + if (sessionStorage.getItem('UserID')) { + this.props.history.replace('/main') + } else { + this.props.history.replace('/login') + } + }, 20) + } + } + + render () { + return ( + <div className="main-params-login"> + <Spin size="large" /> + </div> + ) + } +} + +export default MainParams \ No newline at end of file diff --git a/src/views/mainparams/index.scss b/src/views/mainparams/index.scss new file mode 100644 index 0000000..d2a3dd5 --- /dev/null +++ b/src/views/mainparams/index.scss @@ -0,0 +1,7 @@ +.main-params-login { + .ant-spin { + position: absolute; + left: calc(50vw - 22px); + top: 45vh; + } +} \ No newline at end of file diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 4d65fa0..df6d527 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -1073,7 +1073,7 @@ return ( <ConfigProvider locale={_locale}> - <div className={'pc-menu-view ' + (MenuType || '')} id="mk-menu-design-view"> + <div className={'pc-menu-view ' + (MenuType || '')}> <Header /> <DndProvider backend={HTML5Backend}> <div className="menu-body"> diff --git a/src/views/menudesign/index.scss b/src/views/menudesign/index.scss index 1c3cc47..ceeac78 100644 --- a/src/views/menudesign/index.scss +++ b/src/views/menudesign/index.scss @@ -1,5 +1,6 @@ body { overflow-x: hidden; + overflow-y: hidden; } .pc-menu-view { background: #000; @@ -248,7 +249,4 @@ background: transparent!important; border-radius: 0!important; } -} -body { - overflow-y: hidden; } \ No newline at end of file diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 27dffe6..22235cd 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -1,46 +1,78 @@ -import React, {Component} from 'react' -import { notification, Spin, ConfigProvider } from 'antd' -import enUS from 'antd/es/locale/en_US' -import zhCN from 'antd/es/locale/zh_CN' +import React, { Component } from 'react' +import { DndProvider } from 'react-dnd' +import { withRouter } from 'react-router' +import { is, fromJS } from 'immutable' +import moment from 'moment' +import HTML5Backend from 'react-dnd-html5-backend' +import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons' import Api from '@/api' +import Utils, { setGLOBFuncs } from '@/utils/utils.js' +import antdZhCN from 'antd/es/locale/zh_CN' +import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' -import asyncLoadComponent from '@/utils/asyncLoadComponent' + import './index.scss' -const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS -const Header = asyncComponent(() => import('@/menu/header')) -const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig')) -const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig')) +const { Panel } = Collapse +const { confirm } = Modal +const { Paragraph } = Typography +const _locale = antdZhCN -document.body.className = '' +const MenuForm = asyncComponent(() => import('./menuform')) +const Header = asyncComponent(() => import('@/menu/header')) +const MenuShell = asyncComponent(() => import('@/menu/menushell')) +const BgController = asyncComponent(() => import('@/pc/bgcontroller')) +const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) +const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const Versions = asyncComponent(() => import('@/menu/versions')) +const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) +const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) +const PictureController = asyncComponent(() => import('@/menu/picturecontroller')) +const ModalController = asyncComponent(() => import('@/menu/modalconfig/controller')) +const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) + sessionStorage.setItem('isEditState', 'true') +sessionStorage.setItem('appType', '') // 搴旂敤绫诲瀷 +document.body.className = '' class TableDesign extends Component { state = { - loading: false, // 缂栬緫鑿滃崟鎴栦娇鐢ㄥ凡浣跨敤妯℃澘鏃讹紝鑾峰彇閰嶇疆淇℃伅 - btnParam: null, // 缂栬緫鎸夐挳鐨勯厤缃俊鎭� - menulist: null, // 缂栬緫涓殑鑿滃崟 - tabview: '', // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛夈�佽〃鍗曪紙Modal锛夈�佸瓙琛紙SubTable锛� - editMenu: null, // 缂栬緫鑿滃崟 - editAction: null, // 缂栬緫鎸夐挳 - editTab: null, // 缂栬緫鏍囩 - tabConfig: null, // 鏍囩閰嶇疆淇℃伅 - editSubTab: null, // 缂栬緫瀛愭爣绛撅紙鏍囩涓殑鏍囩锛� - subTabConfig: null, // 瀛愭爣绛鹃厤缃俊鎭� - subConfig: null, // 瀛愰厤缃俊鎭� - btnTab: null, // 鎵撳紑鏂版爣绛炬垨褰撳墠椤甸潰鍒锋柊鐨勬寜閽� - btnTabConfig: null, // 鎵撳紑鏂版爣绛炬寜閽厤缃� - handleMVisible: false, // 娣诲姞鎴栦慨鏀硅彍鍗曟ā鎬佹锛堣鑹叉潈闄愬垎閰嶇瓑锛� - sysMenu: null, // 娣诲姞鎴栫紪杈戣彍鍗曪紙瑙掕壊鏉冮檺鍒嗛厤绛夛級 - change: false + MenuId: '', + ParentId: '', + MenuName: '', + MenuNo: '', + delButtons: [], + activeKey: 'basedata', + menuloading: false, + oriConfig: null, + config: null, + customComponents: [], + comloading: false, + settingshow: true, + modalStatus: false // 寮圭獥鏄惁寮�鍚紝鍒ゆ柇ctrl+s鏄惁鍙敤 } UNSAFE_componentWillMount() { + sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷 + + window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� + window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 + window.GLOB.urlFields = [] // url鍙橀噺 + window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) - this.getMenuParam(param) + this.setState({ + MenuId: param.MenuID, + ParentId: param.ParentId || '', + MenuName: param.MenuName || '', + MenuNo: param.MenuNo || '', + }, () => { + this.getMenuParam() + }) } catch (e) { notification.warning({ top: 92, @@ -50,101 +82,71 @@ } } - getMenuParam = (editMenu) => { - editMenu.fstMenuId = editMenu.FstId - editMenu.supMenuList = [] - editMenu.fstMenuList = [] + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } - let tree = sessionStorage.getItem('menuTree') - if (tree) { - tree = JSON.parse(tree) - editMenu.fstMenuList = tree + componentDidMount () { + MKEmitter.addListener('delButtons', this.delButtons) + MKEmitter.addListener('modalStatus', this.modalStatus) + MKEmitter.addListener('changePopview', this.initPopview) + MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) + MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) + MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) + setTimeout(() => { + if (sessionStorage.getItem('app_custom_components')) { + let list = sessionStorage.getItem('app_custom_components') + list = JSON.parse(list) - tree.forEach(item => { - if (item.MenuID === editMenu.FstId) { - editMenu.supMenuList = item.children - } - }) - } - - let param = { - func: 'sPC_Get_LongParam', - MenuID: editMenu.MenuID - } - - this.setState({ - loading: true - }) - - Api.getSystemConfig(param).then(res => { - if (res.status) { - editMenu.open_edition = res.open_edition || '' - editMenu.LongParam = '' - - if (res.LongParam) { - let _LongParam = '' - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - editMenu.LongParam = _LongParam - } else if (editMenu.PageParam.copyMenuId) { - let _param = { - func: 'sPC_Get_LongParam', - MenuID: editMenu.PageParam.copyMenuId - } - - Api.getSystemConfig(_param).then(res => { - if (res.status) { - if (res.LongParam) { - let _LongParam = '' - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - _LongParam.type = 'user' - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - editMenu.LongParam = _LongParam - } - - this.setState({ - editMenu: editMenu, - loading: false, - tabview: editMenu.type - }) - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - return - } - - this.setState({ - editMenu: editMenu, - loading: false, - tabview: editMenu.type - }) + this.setCustomComponent(list) } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + this.updateCustomComponent() } - }) + this.getAppPictures() + this.getPrintTemp() + this.getRoleFields() + setGLOBFuncs() + }, 1000) + + document.onkeydown = (event) => { + let e = event || window.event + let keyCode = e.keyCode || e.which || e.charCode + let preKey = '' + + if (e.ctrlKey) { + preKey = 'ctrl' + } + if (e.shiftKey) { + preKey = 'shift' + } else if (e.altKey) { + preKey = 'alt' + } + + if (!preKey || !keyCode) return + + let _shortcut = `${preKey}+${keyCode}` + + if (_shortcut === 'ctrl+83') { + if (this.state.modalStatus) { + notification.warning({ + top: 92, + message: '璇蜂繚瀛�' + this.state.modalStatus, + duration: 5 + }) + return false + } + + let node = document.getElementById('save-modal-config') + if (!node) { + node = document.getElementById('save-config') + } + + if (node) { + node.click() + } + return false + } + } } /** @@ -154,53 +156,723 @@ this.setState = () => { return } + MKEmitter.removeListener('delButtons', this.delButtons) + MKEmitter.removeListener('modalStatus', this.modalStatus) + MKEmitter.removeListener('changePopview', this.initPopview) + MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) + MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) + MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) } - handleView = (param) => { - this.setState({ - tabview: '' - }, () => { - if (param) { - this.setState(param) - } else { - window.close() + modalStatus = (val) => { + this.setState({modalStatus: val}) + } + + triggerMenuSave = () => { + this.submitConfig() + } + + getPrintTemp = () => { + if (!sessionStorage.getItem('printTemps')) { + let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate + where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' + union select ID,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + on a.PrintTempNO=b.PrintTempNO + left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c + on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` + + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(_sql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getSystemConfig(param).then(res => { + if (res.status) { + let temps = res.data.map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + + sessionStorage.setItem('printTemps', JSON.stringify(temps)) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + }) + } + } + + getAppPictures = () => { + if (sessionStorage.getItem('app_videos') || sessionStorage.getItem('app_pictures')) return + + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'image', + type: 'search' + }).then(res => { + if (res.status) { + sessionStorage.setItem('app_pictures', JSON.stringify(res.data || [])) + } + + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'video', + type: 'search' + }).then(res => { + if (res.status) { + sessionStorage.setItem('app_videos', JSON.stringify(res.data || [])) + } + }) + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'color', + type: 'search' + }).then(res => { + if (res.status) { + sessionStorage.setItem('app_colors', JSON.stringify(res.data || [])) + } + }) + }) + } + + updateCustomComponent = () => { + Api.getSystemConfig({ + func: 's_get_custom_components', + typename: '', + typecharone: '' + }).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } else if (res.cus_list) { + sessionStorage.setItem('app_custom_components', JSON.stringify(res.cus_list)) + this.setCustomComponent(res.cus_list) } }) } + setCustomComponent = (cus_list) => { + let coms = [] + + cus_list.forEach(item => { + let config = '' + + try { + config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param))) + } catch (e) { + console.warn('Parse Failure') + config = '' + } + + if (!config || !item.c_name) return + + window.GLOB.UserComponentMap.set(item.c_id, item.c_name) + coms.push({ + uuid: item.c_id, + type: 'menu', + title: item.c_name, + url: item.images, + component: config.type, + subtype: config.subtype, + config + }) + }) + this.setState({customComponents: coms}) + } + + updateComponentStyle = (parentId, keys, style) => { + const { config } = this.state + + if (config.uuid !== parentId) return + + let components = config.components.map(item => { + if (keys.includes(item.uuid)) { + item.style = {...item.style, ...style} + } + return item + }) + + this.setState({ + config: {...config, components}, + comloading: true + }, () => { + this.setState({ + comloading: false + }) + }) + } + + delButtons = (items) => { + this.setState({ delButtons: [...this.state.delButtons, ...items] }) + } + + initPopview = (card, btn) => { + const { oriConfig, config } = this.state + + if (!is(fromJS(oriConfig), fromJS(config))) { + notification.warning({ + top: 92, + message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', + duration: 5 + }) + return + } + + let _btn = fromJS(btn).toJS() + _btn.MenuName = config.MenuName + '-' + card.name + '-' + btn.label + _btn.ParentMenuID = config.uuid + + this.props.history.push('/popdesign/' + window.btoa(window.encodeURIComponent((JSON.stringify(_btn))))) + } + + closeView = () => { + const { oriConfig, config } = this.state + + if (!config) { + window.close() + return + } + + if (!is(fromJS(oriConfig), fromJS(config))) { + confirm({ + title: '閰嶇疆宸蹭慨鏀癸紝鏀惧純淇濆瓨鍚楋紵', + content: '', + onOk() { + window.close() + }, + onCancel() {} + }) + } else { + window.close() + } + } + + getMenuParam = () => { + const { MenuId, ParentId, MenuName, MenuNo } = this.state + + let param = { + func: 'sPC_Get_LongParam', + MenuID: MenuId + } + + Api.getSystemConfig(param).then(result => { + if (result.status) { + let config = null + + try { + config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null + } catch (e) { + console.warn('Parse Failure') + config = null + } + + if (!config) { + config = { + version: 1.0, + uuid: MenuId, + MenuID: MenuId, + parentId: ParentId, + Template: 'BaseTable', + easyCode: '', + enabled: false, + MenuName: MenuName, + MenuNo: MenuNo, + tables: [], + components: [], + viewType: 'menu', + style: { + backgroundColor: '#ffffff', backgroundImage: '', + paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px' + }, + } + } else { + config.uuid = MenuId + config.MenuID = MenuId + config.Template = 'BaseTable' + } + + config.open_edition = result.open_edition || '' + window.GLOB.urlFields = config.urlFields || [] + + this.setState({ + oriConfig: config, + config: fromJS(config).toJS() + }) + window.GLOB.customMenu = config + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + } + + getMenuMessage = (delButtons) => { + const { config } = this.state + let buttons = [] + let _sort = 1 + + let traversal = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + traversal(tab.components) + }) + } else if (item.type === 'group') { + traversal(item.components) + } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { + item.action && item.action.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + card.backElements && card.backElements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } else if (item.type === 'carousel' || item.type === 'timeline') { + item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } else if (item.type === 'balcony') { + item.elements && item.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + } else if (item.type === 'line' || item.type === 'bar' || item.type === 'chart') { + item.action && item.action.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) { + item.action && item.action.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + item.cols && item.cols.forEach(col => { + if (col.type !== 'action') return + col.elements.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } + }) + } + + traversal(config.components) + + return buttons + } + + submitConfig = () => { + let config = fromJS(this.state.config).toJS() + + if (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId) { + notification.warning({ + top: 92, + message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + duration: 5 + }) + return + } + + this.setState({ + menuloading: true + }) + + setTimeout(() => { + if (config.enabled && this.verifyConfig()) { + config.enabled = false + } + + 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: 'BaseTable', + MenuName: config.MenuName || '', + PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}), + LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), + open_edition: config.open_edition, + LText: '', + LTexttb: '' + } + + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 + func: 'sPC_Button_AddUpt', + Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 + ParentID: config.uuid, + MenuNo: config.MenuNo, + Template: 'BaseTable', + PageParam: '', + LongParam: '', + LText: [] + } + + let delButtons = fromJS(this.state.delButtons).toJS() + + btnParam.LText = this.getMenuMessage(delButtons) + btnParam.LText = btnParam.LText.join(' union all ') + + btnParam.LText = Utils.formatOptions(btnParam.LText) + btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) + + new Promise(resolve => { + resolve(true) + }).then(res => { // 鎸夐挳鍒犻櫎 + if (delButtons.length === 0) { + return { + status: true + } + } else { + let _param = { + func: 'sPC_MainMenu_Del', + MenuID: delButtons.join(',') + } + return Api.getSystemConfig(_param) + } + }).then(res => { // 椤甸潰淇濆瓨 + if (!res) return + + if (res.status) { + return Api.getSystemConfig(param) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return false + } + }).then(res => { // 椤甸潰鎸夐挳鍏崇郴淇濆瓨 + if (!res) return + + if (res.status) { + let ori = this.state.oriConfig + if (config.MenuName !== ori.MenuName || config.MenuNo !== ori.MenuNo || config.parentId !== ori.parentId) { + localStorage.setItem('menuUpdate', new Date().getTime()) + } + config.open_edition = res.open_edition || '' + this.setState({ + config, + oriConfig: fromJS(config).toJS(), + }) + + if (btnParam.LText) { + return Api.getSystemConfig(btnParam) + } else { + return { + status: true + } + } + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return false + } + }).then(res => { // 鎸夐挳澶嶅埗 + if (!res) return + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return false + } + }).then(res => { + if (res && res.status) { + this.setState({ + delButtons: [], + menuloading: false + }) + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 2 + }) + } else { + this.setState({ + menuloading: false + }) + } + MKEmitter.emit('completeSave') + }) + }, 300 + (+sessionStorage.getItem('mkDelay'))) + } + + getRoleFields = () => { + if (sessionStorage.getItem('sysRoles')) return + Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { + if (res.status) { + let _permFuncField = [] + let _sysRoles = [] + + if (res.Roles && res.Roles.length > 0) { + _sysRoles = res.Roles.map(role => { + return { + uuid: Utils.getuuid(), + value: role.RoleID, + text: role.RoleName + } + }) + } + + if (res.sModular && res.sModular.length > 0) { + res.sModular.forEach(field => { + if (field.ModularNo) { + _permFuncField.push(field.ModularNo) + } + }) + _permFuncField = _permFuncField.sort() + } + + sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles)) + sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) + } + }) + } + + onEnabledChange = () => { + const { config } = this.state + + if (!config || (!config.enabled && this.verifyConfig(true))) { + return + } + + this.setState({ + config: {...config, enabled: !config.enabled} + }) + } + + verifyConfig = (show) => { + const { config } = this.state + let error = '' + + let check = (components) => { + components.forEach(item => { + if (error) return + + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + check(tab.components) + }) + return + } else if (item.type === 'group') { + check(item.components) + return + } else if (!item.errors || item.errors.length === 0) { + return + } + + item.errors.forEach(err => { + if (err.level !== 0 || error) return + error = `缁勪欢銆�${item.name}銆�${err.detail}` + }) + }) + } + + check(config.components) + + if (show && error) { + notification.warning({ + top: 92, + message: error, + duration: 5 + }) + } + + return error + } + + // 鏇存柊閰嶇疆淇℃伅 + updateConfig = (config) => { + this.setState({ + config: config + }) + window.GLOB.customMenu = config + } + + resetConfig = (config) => { + this.setState({ + config, + comloading: true + }, () => { + this.setState({ + comloading: false + }) + }) + window.GLOB.customMenu = config + } + + insert = (item) => { + let config = fromJS(this.state.config).toJS() + + config.components.push(item) + + this.setState({config}) + window.GLOB.customMenu = config + + notification.success({ + top: 92, + message: '绮樿创鎴愬姛锛�', + duration: 2 + }) + } + + changeSetting = () => { + this.setState({settingshow: !this.state.settingshow}) + + setTimeout(() => { + MKEmitter.emit('tabsChange', 'all') + }, 400) + } + render () { - const { loading } = this.state + const { activeKey, comloading, MenuId, config, settingshow, ParentId, menuloading } = this.state return ( - <div className="mk-base-design-wrap"> - <ConfigProvider locale={_locale}> - <Header/> - {this.state.tabview === 'CommonTable' ? - <ComTableConfig - menu={this.state.editMenu} - reloadmenu={() => {localStorage.setItem('menuUpdate', new Date().getTime())}} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'Modal' ? - <ModalConfig - menu={this.state.editMenu} - editTab={this.state.editTab} - tabConfig={this.state.tabConfig} - editSubTab={this.state.editSubTab} - subTabConfig={this.state.subTabConfig} - btnTab={this.state.btnTab} - btnTabConfig={this.state.btnTabConfig} - editAction={this.state.editAction} - subConfig={this.state.subConfig} - handleView={this.handleView} - /> : null - } - {loading ? <Spin className="loading-view" size="large"/> : null} - </ConfigProvider> - </div> + <ConfigProvider locale={_locale}> + <div className="pc-table-view"> + <Header /> + <DndProvider backend={HTML5Backend}> + <div className="menu-body"> + <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}> + <div className="draw"> + {settingshow ? <DoubleLeftOutlined onClick={this.changeSetting}/> : <DoubleRightOutlined onClick={this.changeSetting}/>} + </div> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + {/* 鍩烘湰淇℃伅 */} + <Panel header="鍩烘湰淇℃伅" key="basedata"> + {/* 鑿滃崟淇℃伅 */} + {config ? <MenuForm + config={config} + MenuId={MenuId} + parentId={ParentId} + MenuName={config.MenuName} + MenuNo={config.MenuNo} + updateConfig={this.updateConfig} + /> : null} + {config ? <UrlFieldComponent + config={config} + updateConfig={this.updateConfig} + /> : null} + {/* 琛ㄥ悕娣诲姞 */} + {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} + {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> : null} + </Panel> + <Panel header="椤甸潰鏍峰紡" key="background"> + {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} + </Panel> + </Collapse> + </div> + <div className={'menu-view' + (menuloading ? ' saving' : '')}> + <Card title={ + <div style={{paddingLeft: '15px'}}> {config && config.MenuName} </div> + } bordered={false} extra={ + <div> + <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> + <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <SysInterface config={config} updateConfig={this.updateConfig}/> + <PictureController/> + <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} /> + <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> + <Button type="default" onClick={this.closeView}>鍏抽棴</Button> + </div> + } style={{ width: '100%' }}> + {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} + </Card> + </div> + </div> + </DndProvider> + <StyleController /> + <ModalController /> + </div> + </ConfigProvider> ) } } -export default TableDesign \ No newline at end of file +export default withRouter(TableDesign) \ No newline at end of file diff --git a/src/views/tabledesign/index.scss b/src/views/tabledesign/index.scss index e6d64bb..2286991 100644 --- a/src/views/tabledesign/index.scss +++ b/src/views/tabledesign/index.scss @@ -1,7 +1,240 @@ -.mk-base-design-wrap { - .loading-view { - position: absolute; - left: calc(50vw - 22px); - top: calc(30vh + 48px); - } +body { + overflow-x: hidden; + overflow-y: hidden; } +.pc-table-view { + background: #000; + min-height: 100vh; + .mk-hidden { + text-decoration: line-through!important; + span { + text-decoration: line-through!important; + } + } + .eye-open { + .component-name { + display: block; + } + .anticon-tool { + display: none; + } + } + .component-name { + position: absolute; + z-index: 9; + display: none; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.9); + border: 1px solid #1890ff; + .center { + position: absolute; + font-size: 16px; + left: 50%; + top: 50%; + color: #1890ff; + transform: translate(-50%, -50%); + max-width: 70%; + .title { + text-align: center; + } + } + .error { + text-align: center; + color: red; + display: block; + } + .waring { + color: orange; + } + } + >.menu-body { + width: 100vw; + height: 100vh; + overflow-x: hidden; + position: relative; + background: #ffffff; + padding: 50px 0px 0px 0px; + + .menu-setting { + position: fixed; + left: 0; + top: 48px; + z-index: 10; + height: calc(100vh - 48px); + width: 300px; + background: #ffffff; + box-shadow: 0px 2px 5px #bcbcbc; + transition: left 0.3s; + + .draw { + position: absolute; + z-index: 11; + background: #ffffff; + right: -20px; + top: 0px; + box-shadow: 0 0 1px #959595; + border-radius: 0 2px 2px 0px; + + .anticon { + padding: 12px 3px; + } + } + > .ant-collapse { + height: 100%; + overflow-y: auto; + overflow-x: hidden; + background-color: #ffffff; + border-radius: 0px; + padding-bottom: 30px; + .ant-collapse-item.ant-collapse-item-active { + border-bottom: 1px solid #d9d9d9; + } + .ant-collapse-header { + padding: 11px 16px 10px 40px; + border-bottom: 1px solid #d9d9d9; + background: #1890ff; + color: #ffffff; + } + .ant-collapse-content-box { + .ant-form-item { + margin-bottom: 10px; + } + .model-table-tablemanage-view { + >.ant-list { + margin-top: 20px; + .ant-list-item { + display: -webkit-box; + padding-right: 20px; + position: relative; + padding-left: 5px; + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + min-height: 55px; + width: 100%; + .anticon { + position: absolute; + top: 0px; + right: 0px; + padding: 3px 3px 10px 10px; + cursor: pointer; + } + } + } + >.tables { + width: 66.66666667%!important; + } + >.ant-form-item-label { + width: 33.33333333%; + } + } + } + } + + >.ant-tabs { + >.ant-tabs-bar { + border-bottom: 1px solid #181F29; + margin-bottom: 0px; + min-height: 48px; + .ant-tabs-tab { + padding: 14px 16px; + color: rgba(255, 255, 255, 0.85); + } + .ant-tabs-tab-active.ant-tabs-tab { + color: #1890ff; + } + } + } + } + .menu-setting >.ant-collapse::-webkit-scrollbar { + width: 4px; + } + .menu-setting >.ant-collapse::-webkit-scrollbar-thumb { + border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); + background: rgba(0, 0, 0, 0.08); + } + .menu-setting >.ant-collapse::-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); + } + + .menu-setting.hidden { + left: -300px; + } + .menu-setting.hidden + .menu-view { + width: 100vw; + margin-left: 0px; + } + + .menu-view { + position: relative; + width: calc(100vw - 300px); + margin-left: 300px; + height: calc(100vh - 50px); + overflow-y: auto; + transition: all 0.3s; + + > .ant-card { + >.ant-card-head { + margin-bottom: 0px; + position: relative; + .ant-card-head-title { + color: #1890ff; + padding: 5px 0; + } + .ant-card-extra { + padding: 5px 0; + button { + margin-left: 10px; + } + >div >div >button, .style-control-button { + padding: 0px 7px; + } + .ant-switch.big { + min-width: 60px; + height: 28px; + line-height: 28px; + margin-top: -2px; + .ant-switch-inner { + font-size: 14px; + } + } + .ant-switch.big:after { + width: 24px; + height: 24px; + } + } + } + >.ant-card-body { + padding: 0px; + } + } + } + .menu-view.saving { + .anticon-tool { + display: none; + } + } + .menu-view::-webkit-scrollbar { + width: 7px; + } + .menu-view::-webkit-scrollbar-thumb { + border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); + background: rgba(0, 0, 0, 0.08); + } + .menu-view::-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); + } + } +} \ No newline at end of file diff --git a/src/views/tabledesign/menuform/index.jsx b/src/views/tabledesign/menuform/index.jsx index 5e09244..4b68d28 100644 --- a/src/views/tabledesign/menuform/index.jsx +++ b/src/views/tabledesign/menuform/index.jsx @@ -1,69 +1,190 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select } from 'antd' +import { Form, Row, Col, Input, Select, notification, Radio, Tooltip, Switch } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' + +import Api from '@/api' +import options from '@/store/options.js' import './index.scss' const { TextArea } = Input -class MainSearch extends Component { +class CustomMenuForm extends Component { static propTpyes = { - menu: PropTypes.object, // 鑿滃崟淇℃伅 - inputSubmit: PropTypes.func // 鍥炶溅鎻愪氦 + config: PropTypes.object, + MenuId: PropTypes.string, + MenuName: PropTypes.string, + MenuNo: PropTypes.string, + parentId: PropTypes.string, + updateConfig: PropTypes.func } state = { - supMenuList: [] + fstMenuId: '', + menulist: [], + smenulist: [] } UNSAFE_componentWillMount () { - this.setState({ - supMenuList: this.props.menu.supMenuList + const { MenuId, config } = this.props + Api.getSystemConfig({func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}).then(result => { + if (result.status) { + let thdMenu = null + let thdMenuList = [] + let menulist = result.fst_menu.map(fst => { + let fstItem = { + MenuID: fst.MenuID, + MenuName: fst.MenuName, + value: fst.MenuID, + label: fst.MenuName, + isLeaf: false, + children: [] + } + + if (fst.snd_menu) { + fstItem.children = fst.snd_menu.map(snd => { + let sndItem = { + ParentId: fst.MenuID, + MenuID: snd.MenuID, + MenuName: snd.MenuName, + value: snd.MenuID, + label: snd.MenuName, + children: [] + } + + if (snd.trd_menu) { + sndItem.children = snd.trd_menu.map(trd => { + let trdItem = { + FstId: fst.MenuID, + ParentId: snd.MenuID, + MenuID: trd.MenuID, + MenuName: trd.MenuName, + MenuNo: trd.MenuNo, + EasyCode: trd.EasyCode, + value: trd.MenuID, + label: trd.MenuName, + type: 'CommonTable', + // disabled: trd.MenuID === MenuId + disabled: false + } + + if (MenuId === trd.MenuID) { + thdMenu = trdItem + } + + if (trd.PageParam) { + try { + trd.PageParam = JSON.parse(trd.PageParam) + trdItem.type = trd.PageParam.Template || 'CommonTable' + } catch (e) { + + } + } + + thdMenuList.push(trdItem) + + return trdItem + }) + } + return sndItem + }) + } + return fstItem + }) + + let smenulist = [] + menulist.forEach(item => { + if (thdMenu && (item.MenuID === thdMenu.FstId)) { + smenulist = item.children + } + }) + sessionStorage.setItem('fstMenuList', JSON.stringify(menulist)) + sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList)) + this.props.updateConfig({...config, fstMenuId: thdMenu ? thdMenu.FstId : ''}) + + this.setState({ + fstMenuId: thdMenu ? thdMenu.FstId : '', + menulist, + smenulist + }, () => { + this.props.form.setFieldsValue({ + fstMenuId: thdMenu ? thdMenu.FstId : '', + parentId: thdMenu ? thdMenu.ParentId : '' + }) + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } }) } - changeMenu = (val) => { - const { menu } = this.state + // 涓�浜岀骇鑿滃崟鍒囨崲 + selectChange = (key, value) => { + const { config } = this.props + const { menulist } = this.state - let submenu = menu.fstMenuList.filter(item => item.MenuID === val)[0] + if (key === 'fstMenuId') { + let smenulist = [] + menulist.forEach(item => { + if (item.MenuID === value) { + smenulist = item.children + } + }) - if (submenu) { this.setState({ - supMenuList: submenu.children + smenulist }, () => { - this.props.form.setFieldsValue({ParentID: submenu.children[0] ? submenu.children[0].MenuID : ''}) + let _id = smenulist[0] ? smenulist[0].MenuID : '' + this.props.form.setFieldsValue({parentId: _id}) + this.props.updateConfig({...config, fstMenuId: value, parentId: _id}) }) - } else { - this.setState({ - supMenuList: [] - }, () => { - this.props.form.setFieldsValue({ParentID: ''}) - }) + } else if (key === 'parentId') { + this.props.updateConfig({...config, parentId: value}) + } else if (key === 'timeUnit') { + this.props.updateConfig({...config, timeUnit: value}) + } else if (key === 'OpenType') { + this.props.updateConfig({...config, OpenType: value}) + } else if (key === 'hidden') { + this.props.updateConfig({...config, hidden: value}) + } else if (key === 'permission') { + this.props.updateConfig({...config, permission: value}) } } - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) + // 鑿滃崟鍚嶇О + changeName = (e) => { + this.props.updateConfig({...this.props.config, MenuName: e.target.value}) } - onEnterSubmit = (e) => { - // 琛ㄥ崟鍥炶溅鎻愪氦 - if (e.key !== 'Enter') return - - this.props.inputSubmit && this.props.inputSubmit() + // 鑿滃崟鍙傛暟 + changeNo = (e) => { + this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) + } + + // 鍔╄鐮� + changeEasyCode = (e) => { + this.props.updateConfig({...this.props.config, easyCode: e.target.value}) + } + + changeRemark = (e) => { + this.props.updateConfig({...this.props.config, Remark: e.target.value}) + } + + changeCacheDay = (val) => { + if (typeof(val) !== 'number') { + val = '' + } + this.props.updateConfig({...this.props.config, cacheTime: val}) } render() { + const { MenuName, MenuNo, config } = this.props + const { menulist, smenulist } = this.state const { getFieldDecorator } = this.props.form - const { menu } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -76,100 +197,142 @@ } return ( - <Form {...formItemLayout} style={{paddingRight: '20px'}} onKeyDown={this.onEnterSubmit}> - <Row gutter={24}> - <Col span={22}> - <Form.Item label={'涓�绾ц彍鍗�'}> + <Form {...formItemLayout} className="custom-menu-form"> + <Row> + <Col span={24}> + <Form.Item label="涓�绾ц彍鍗�"> {getFieldDecorator('fstMenuId', { - initialValue: menu.fstMenuId, + initialValue: '', rules: [ { required: true, - message: '璇烽�夋嫨涓婄骇鑿滃崟!' + message: '璇烽�夋嫨涓�绾ц彍鍗�!' } ] })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={this.changeMenu} - > - {menu.fstMenuList.map(option => - <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> + <Select onChange={(value) => {this.selectChange('fstMenuId', value)}}> + {menulist.map(option => + <Select.Option key={option.MenuID} value={option.MenuID}> + {option.MenuName} + </Select.Option> )} </Select> )} </Form.Item> </Col> - <Col span={22}> - <Form.Item label={'浜岀骇鑿滃崟'}> - {getFieldDecorator('ParentID', { - initialValue: menu.ParentId, + <Col span={24}> + <Form.Item label="浜岀骇鑿滃崟"> + {getFieldDecorator('parentId', { + initialValue: '', rules: [ { required: true, - message: '璇烽�夋嫨涓婄骇鑿滃崟!' + message: '璇烽�夋嫨浜岀骇鑿滃崟!' } ] })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - > - {menu.supMenuList.map(option => - <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> + <Select onChange={(value) => {this.selectChange('parentId', value)}}> + {smenulist.map(option => + <Select.Option key={option.MenuID} value={option.MenuID}> + {option.MenuName} + </Select.Option> )} </Select> )} </Form.Item> </Col> - <Col span={22}> - <Form.Item label={'鑿滃崟鍚嶇О'}> + <Col span={24}> + <Form.Item label="鑿滃崟鍚嶇О"> {getFieldDecorator('MenuName', { - initialValue: menu.MenuName || '', + initialValue: MenuName, rules: [ { required: true, message: '璇疯緭鍏ヨ彍鍗曞悕绉�!' } ] - })(<Input placeholder="" autoFocus autoComplete="off" />)} + })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} </Form.Item> </Col> - <Col span={22}> - <Form.Item label={'鑿滃崟鍙傛暟'}> + <Col span={24}> + <Form.Item label="鑿滃崟鍙傛暟"> {getFieldDecorator('MenuNo', { - initialValue: menu.MenuNo || '', + initialValue: MenuNo, rules: [ { required: true, message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!' } ] - })(<Input placeholder="" autoComplete="off" />)} + })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} </Form.Item> </Col> - {menu.Template === 'NewPage' ? <Col span={22}> - <Form.Item label={'閾炬帴鍦板潃'}> - {getFieldDecorator('url', { - initialValue: menu.url || '', + <Col span={24}> + <Form.Item label="鎵撳紑鏂瑰紡"> + {getFieldDecorator('OpenType', { + initialValue: config.OpenType || 'newtab', rules: [ { required: true, - message: '璇疯緭鍏ラ〉闈㈠湴鍧�!' - }, - { - max: 1024, - message: '鍦板潃鏈�闀夸负1024涓瓧绗�!' + message: '璇烽�夋嫨鎵撳紑鏂瑰紡!' } ] - })(<TextArea rows={2} />)} + })( + <Radio.Group onChange={(e) => {this.selectChange('OpenType', e.target.value)}}> + <Radio value="newtab">鏍囩椤�</Radio> + <Radio value="newpage">鏂伴〉闈�</Radio> + </Radio.Group> + )} </Form.Item> - </Col> : null} + </Col> + <Col span={24}> + <Form.Item label={ + <Tooltip placement="topLeft" title="璺宠繃鏉冮檺楠岃瘉鏃讹紝椤甸潰涓粍浠跺強鎸夐挳涓嶅湪杩涜鏉冮檺鎺у埗銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鏉冮檺楠岃瘉 + </Tooltip> + }> + {getFieldDecorator('permission', { + initialValue: config.permission || 'true' + })( + <Radio.Group onChange={(e) => {this.selectChange('permission', e.target.value)}}> + <Radio value="true">浣跨敤</Radio> + <Radio value="false">涓嶄娇鐢�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鍔╄鐮�"> + {getFieldDecorator('easyCode', { + initialValue: config.easyCode + })(<Input placeholder="" autoComplete="off" onChange={this.changeEasyCode}/>)} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label={'闅愯棌鑿滃崟'}> + <Switch checkedChildren={'鏄�'} checked={config.hidden === 'true'} unCheckedChildren={'鍚�'} onChange={(value) => { + this.selectChange('hidden', value + '') + }} /> + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: config.Remark || '', + rules: [ + { + max: 512, + message: '澶囨敞鏈�澶�512涓瓧绗︼紒' + } + ] + })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} + </Form.Item> + </Col> </Row> </Form> ) } } -export default Form.create()(MainSearch) \ No newline at end of file +export default Form.create()(CustomMenuForm) \ No newline at end of file diff --git a/src/views/tabledesign/menuform/index.scss b/src/views/tabledesign/menuform/index.scss index e69de29..fa61282 100644 --- a/src/views/tabledesign/menuform/index.scss +++ b/src/views/tabledesign/menuform/index.scss @@ -0,0 +1,8 @@ +.custom-menu-form { + .ant-form-item { + height: 50px; + .ant-form-explain { + font-size: 12px; + } + } +} \ No newline at end of file diff --git a/src/views/tabledesign/tableconfig/index.jsx b/src/views/tabledesign/tableconfig/index.jsx deleted file mode 100644 index a233a6a..0000000 --- a/src/views/tabledesign/tableconfig/index.jsx +++ /dev/null @@ -1,1046 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { DndProvider } from 'react-dnd' -import HTML5Backend from 'react-dnd-html5-backend' -import { Modal, notification } from 'antd' -import moment from 'moment' - -import Api from '@/api' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' -import Utils from '@/utils/utils.js' -import MKEmitter from '@/utils/events.js' -import { updateSubTable } from '@/utils/utils-update.js' - -import asyncComponent from '@/utils/asyncComponent' -import SearchComponent from '@/templates/sharecomponent/searchcomponent' -import ActionComponent from '@/templates/sharecomponent/actioncomponent' -import ColumnComponent from '@/templates/sharecomponent/columncomponent' - -import Source from './source' -import './index.scss' - -const { confirm } = Modal - -const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent')) - -class TableConfig extends Component { - static propTpyes = { - menu: PropTypes.any, - editTab: PropTypes.any, - tabConfig: PropTypes.any, - editSubTab: PropTypes.any, - btnTab: PropTypes.any, - btnTabConfig: PropTypes.any, - config: PropTypes.any, - handleView: PropTypes.func - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 - config: null, // 椤甸潰閰嶇疆 - visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 - menuloading: false, // 鑿滃崟淇濆瓨涓� - menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 - loading: false, // 鍔犺浇涓紝椤甸潰spin - closeVisible: false, // 鍏抽棴妯℃�佹 - originConfig: null, // 鍘熼厤缃� - originActions: null, // 鍘熷鎸夐挳淇℃伅锛屼娇鐢ㄥ凡鏈夌敤鎴锋ā鏉� - delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 - copyActions: [], // 澶嶅埗鎸夐挳缁� - tabviews: [], // 鎵�鏈夋爣绛鹃〉 - thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 - activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 - chartview: null, // 褰撳墠瑙嗗浘 - openEdition: '', // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� - modalStatus: false // 寮圭獥鏄惁寮�鍚紝鍒ゆ柇ctrl+s鏄惁鍙敤 - } - - /** - * @description 鏁版嵁棰勫鐞� - * 1銆佽缃〉闈㈤厤缃俊鎭紝鏂板缓鎴栨棤閰嶇疆淇℃伅鏃讹紙鍒囨崲妯℃澘鍚庢棤閰嶇疆淇℃伅锛夛紝浣跨敤妯℃澘榛樿閰嶇疆 - * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟 - */ - UNSAFE_componentWillMount () { - const { config, editTab, editSubTab } = this.props - - let _config = null - - if (!config) { - _config = fromJS(Source.baseConfig).toJS() - _config.uuid = editSubTab ? editSubTab.linkTab : editTab.linkTab - _config.tabName = editSubTab ? editSubTab.label : editTab.label - _config.isAdd = true - } else { - _config = fromJS(config).toJS() - } - - let _oriActions = [] - - if (_config.type === 'user') { - _config.action = _config.action.map(item => { - let uuid = Utils.getuuid() - - if (item.linkTab) { - item.linkTab = '' - } - - if (item.OpenType === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽� - _oriActions.push({ - prebtn: fromJS(item).toJS(), - curuuid: uuid, - Template: 'Modal' - }) - } - - item.uuid = uuid - return item - }) - } - - let _activeKey = editSubTab ? editSubTab.activeKey : editTab.activeKey - - // 鐗堟湰鍏煎 - _config = updateSubTable(_config) - - this.setState({ - openEdition: editSubTab ? (editSubTab.open_edition || '') : (editTab.open_edition || ''), - chartview: _config.charts ? _config.charts[0].uuid : '', - originActions: _oriActions, - config: _config, - activeKey: _activeKey || '0', - originConfig: fromJS(_config).toJS(), - }) - } - - /** - * @description 鍔犺浇瀹屾垚鍚� - * 1銆佽幏鍙栫郴缁熷彲浣跨敤琛� - * 2銆佹牴鎹厤缃俊鎭腑宸蹭娇鐢ㄨ〃鑾峰彇鐩稿叧瀛楁淇℃伅 - */ - componentDidMount () { - this.reloadTab(false) - document.onkeydown = (event) => { - let e = event || window.event - let keyCode = e.keyCode || e.which || e.charCode - let preKey = '' - - if (e.ctrlKey) { - preKey = 'ctrl' - } - if (e.shiftKey) { - preKey = 'shift' - } else if (e.altKey) { - preKey = 'alt' - } - - if (!preKey || !keyCode) return - - let _shortcut = `${preKey}+${keyCode}` - - if (_shortcut === 'ctrl+83') { - if (this.state.modalStatus) { - notification.warning({ - top: 92, - message: '璇蜂繚瀛�' + this.state.modalStatus, - duration: 5 - }) - return false - } - - let node = document.getElementById('save-config') - if (node && node.click) { - node.click() - } - return false - } - } - MKEmitter.addListener('modalStatus', this.modalStatus) - } - - /** - * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� - */ - reloadTab = (type) => { - this.setState({ - loading: type, - tabviews: [] - }) - Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { - if (res.status) { - let _tabviews = [] - res.UserTemp.forEach(temp => { - let item = { - uuid: temp.MenuID, - value: temp.MenuID, - text: temp.MenuName, - type: temp.Template, - MenuNo: temp.MenuNo - } - - if (this.props.config && temp.MenuID === this.props.config.uuid) return - - _tabviews.push(item) - }) - - this.setState({ - loading: false, - tabviews: _tabviews - }) - - if (type) { - notification.success({ - top: 92, - message: '鍒锋柊鎴愬姛銆�', - duration: 2 - }) - } - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - document.onkeydown = () => {} - MKEmitter.removeListener('modalStatus', this.modalStatus) - } - - modalStatus = (val) => { - this.setState({modalStatus: val}) - } - - // 椤甸潰杩斿洖 - handleViewBack = () => { - const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props - let _tabview = menu ? menu.LongParam.Template : '' - let _subconfig = null - - if (editSubTab) { - _subconfig = tabConfig - if (editTab.hasOwnProperty('OpenType')) { - _tabview = editTab.tabType || 'SubTable' - } else { - _tabview = editTab.type - } - } else if (!editSubTab && btnTab) { - _tabview = btnTab.tabTemplate - _subconfig = btnTabConfig - } - - let param = { - editMenu: menu, - editTab: editSubTab ? editTab : null, - tabConfig: null, - editSubTab: null, - subTabConfig: null, - btnTab: btnTab, - btnTabConfig: btnTabConfig, - editAction: null, - subConfig: _subconfig, - tabview: _tabview - } - - this.state.copyActions.forEach(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item - } - Api.getSystemConfig(_param) - }) - - this.props.handleView(param) - } - - /** - * @description 鏍囩椤典繚瀛� - */ - submitConfig = () => { - const { delActions, thawButtons, openEdition } = this.state - let _config = fromJS(this.state.config).toJS() - let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig - - // 鍩烘湰淇℃伅楠岃瘉 - if (!_config.tabName || !_config.tabNo) { - notification.warning({ - top: 92, - message: this.state.dict['model.menu.basemsg'], - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } - - if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) { - notification.warning({ - top: 92, - message: '姝ゆ爣绛句负澶嶅埗鏍囩锛岃淇敼鏍囩鍚嶇О鍜屾爣绛惧弬鏁帮紝涓嶅彲浠ユ椂闂存牸寮� YYYY-MM-DD HH:mm:ss 缁撳熬锛�', - duration: 5 - }) - return - } - - if (_config.isAdd) { - if (_config.search[0] && _config.search[0].origin) { - _config.search = _config.search.filter(item => !item.origin) - } - if (_config.action[0] && _config.action[0].origin) { - _config.action = _config.action.filter(item => !item.origin) - } - if (_config.columns[0] && _config.columns[0].origin) { - _config.columns = _config.columns.filter(item => !item.origin) - } - } - - if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) { - _config.setting.doubleClick = '' - } - - // 鏈缃暟鎹簮鎴栦富閿椂锛屽惎鐢ㄧ姸鎬佷负false - let result = this.verifyconfig(_config) - - if (result !== true) { - _config.enabled = false - } - - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } - - let _LongParam = '' - let reload = _config.isAdd - - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd - - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) - - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } - - let btnParam = { - func: 'sPC_Button_AddUpt', - Type: 40, - ParentID: _config.uuid, - MenuNo: _config.tabNo, - Template: 'SubTable', - PageParam: '', - LongParam: '', - LText: [] - } - - let btntabs = [] - - _config.action.forEach((item, index) => { - if (item.hidden === 'true') return - if (item.OpenType === 'popview') { - btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`) - } - btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`) - }) - - btnParam.LText = btnParam.LText.join(' union all ') - btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - - let tabParam = { // 娣诲姞鏍囩鎸夐挳tab椤� - func: 'sPC_sMenusTab_AddUpt', - MenuID: _config.uuid, - LText: btntabs.join(' union all ') - } - - tabParam.LText = Utils.formatOptions(tabParam.LText) - tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - - let param = { - func: 'sPC_Tab_AddUpt', - MenuID: _config.uuid, - MenuNo: _config.tabNo, - Template: 'SubTable', - MenuName: _config.tabName, - Remark: _config.Remark, - Sort: 0, - PageParam: JSON.stringify({Template: 'SubTable'}), - LongParam: _LongParam - } - - if (openEdition) { - param.open_edition = openEdition - } - - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 - new Promise(resolve => { - if (delActions.length > 0) { - let deffers = delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item.card.uuid - } - - let _ParentParam = null - - try { - _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card))) - } catch (e) { - console.warn('Stringify Failure') - _ParentParam = null - } - - if (_ParentParam) { // 鍒犻櫎鎸夐挳鏃讹紝淇濆瓨鎸夐挳閰嶇疆淇℃伅锛岀敤浜庢仮澶嶆寜閽� - _param.ParentParam = _ParentParam - } - - return new Promise(resolve => { - Api.getSystemConfig(_param).then(response => { - resolve(response) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response - } - }) - - if (error) { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(true) - } - }) - } else if (delActions.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return - - if (thawButtons.length > 0) { - let defers = thawButtons.map(item => { - return new Promise((resolve) => { - Api.getSystemConfig({ - func: 'sPC_MainMenu_ReDel', - MenuID: item - }).then(res => { - if (res.status) { - resolve('') - } else { - resolve(res.message) - } - }) - }) - }) - - return Promise.all(defers) - } else { - return true - } - }).then(res => { - if (res === true || res === false) return res - - let msg = res.filter(Boolean)[0] - if (msg) { - notification.warning({ - top: 92, - message: msg, - duration: 5 - }) - return false - } else { - this.setState({ - thawButtons: [] - }) - return true - } - }).then(resp => { - if (resp === false) return - - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - openEdition: response.open_edition || '', - config: _config, - originConfig: fromJS(_config).toJS() - }, () => { - reload && MKEmitter.emit('revert') - this.setState({ - menuloading: false, - menucloseloading: false - }) - this.submitAction(btnParam, tabParam) - }) - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - } - - /** - * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� - */ - submitAction = (btnParam, tabParam) => { - const { config } = this.state - - new Promise(resolve => { - let deffers = [] - - if (tabParam.LText) { - let defer = new Promise(resolve => { - Api.getSystemConfig(tabParam).then(result => { - resolve(result) - }) - }) - deffers.push(defer) - } - - if (btnParam.LText) { - let defer = new Promise(resolve => { - Api.getSystemConfig(btnParam).then(result => { - if (result.status) { - this.setState({ // 淇濆瓨鎴愬姛鍚庢竻绌哄鍒跺垪琛� - copyActions: [] - }) - } - resolve(result) - }) - }) - deffers.push(defer) - } - - if (deffers.length === 0) { - resolve(true) - } else { - Promise.all(deffers).then(result => { - let error = false - result.forEach(res => { - if (!res.status) { - error = res - } - }) - - if (error) { - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - resolve(true) - } - }) - } - }).then(response => { - if (response === false) return response - - let oriActions = [] - this.state.originActions.forEach(item => { - let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 鏌ョ湅鍒濆鍖栨寜閽槸鍚﹀瓨鍦� - if (!curBtn) return - if (curBtn.OpenType !== item.prebtn.OpenType) return - if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return - - oriActions.push({ - prebtn: item.prebtn, - curBtn: curBtn - }) - }) - - if (oriActions.length === 0) return 'true' - - oriActions.forEach(action => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: action.prebtn ? action.prebtn.uuid : '' - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' - - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam) { - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: config.uuid, - MenuID: action.curBtn.uuid, - MenuNo: config.tabNo, - Template: _LongParam.type, - MenuName: action.curBtn.label, - PageParam: JSON.stringify({Template: _LongParam.type}), - LongParam: result.LongParam - } - Api.getSystemConfig(param).then(() => {}) - } - } - }) - }) - return 'true' - }).then(response => { - if (response === 'true') { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - if (this.state.closeVisible) { - this.handleViewBack() - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - } - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - } - }) - } - - cancelConfig = () => { - const { config, originConfig } = this.state - - let _this = this - - if (originConfig.isAdd) { - confirm({ - content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.handleViewBack() - }, - onCancel() {} - }) - } else { - if (!is(fromJS(originConfig), fromJS(config))) { - this.setState({ - closeVisible: true - }) - } else { - this.handleViewBack() - } - } - } - - /** - * @description 璁剧疆鍙厤缃寜閽� - */ - setSubConfig = (btn) => { - const {menu, editTab, tabConfig, editSubTab, btnTab, btnTabConfig} = this.props - const { config, originConfig, activeKey, openEdition } = this.state - - if (originConfig.isAdd) { - notification.warning({ - top: 92, - message: '鑿滃崟灏氭湭淇濆瓨锛岃淇濆瓨鑿滃崟閰嶇疆锛�', - duration: 5 - }) - } else { - if (!is(fromJS(originConfig), fromJS(config))) { - notification.warning({ - top: 92, - message: '鑿滃崟閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', - duration: 5 - }) - } else { - // 瀛愯彍鍗曚俊鎭獙璇侀�氳繃鍚庯紝璺宠浆瀛愭寜閽厤缃〉闈� - let _view = '' - let _subtab = editSubTab - - if (btn.OpenType === 'pop' || btn.execMode === 'pop') { - _view = 'Modal' // 琛ㄥ崟椤甸潰 - } else if (btn.OpenType === 'popview') { - _view = 'SubTable' // 鏂板脊绐楁爣绛炬ā鏉� tabType 灞炴�у凡鍘婚櫎 - _subtab = btn - - if (editSubTab) { - notification.warning({ - top: 92, - message: '寮圭獥(鏍囩)涓笉鏀寔姝ゆ寜閽墦寮�鏂瑰紡锛�', - duration: 5 - }) - return - } - } - - if (editSubTab) { - editSubTab.activeKey = activeKey - editSubTab.open_edition = openEdition // 鏇存柊鐗堟湰鍙� - } else { - editTab.activeKey = activeKey - editTab.open_edition = openEdition // 鏇存柊鐗堟湰鍙� - } - - let param = { - editMenu: menu, - editTab: editTab, - tabConfig: editSubTab ? tabConfig : originConfig, - editSubTab: _subtab, - subTabConfig: editSubTab ? originConfig : null, - btnTab: btnTab, - btnTabConfig: btnTabConfig, - editAction: btn, - subConfig: '', - tabview: _view - } - - this.setState({ - loading: true - }) - - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: btn.OpenType === 'popview' ? btn.linkTab : btn.uuid - }).then(res => { - if (res.status) { - this.setState({ - loading: false - }) - let _LongParam = '' - if (res.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam && param.tabview === 'Modal' && _LongParam.type === 'Modal') { - param.subConfig = _LongParam - } else if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { - param.subConfig = _LongParam - } - - if (param.editAction) { - param.editAction.open_edition = res.open_edition || '' - } else if (param.editSubTab) { - param.editSubTab.open_edition = res.open_edition || '' - } - - this.props.handleView(param) - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - } - } - - /** - * @description 鍒囨崲鏍囩鏄惁鍚敤 - */ - onEnabledChange = () => { - const { config } = this.state - - let _enabled = !config.enabled - let result = this.verifyconfig(config) - - if (_enabled && result !== true) { - notification.warning({ - top: 92, - message: result, - duration: 5 - }) - return - } - - this.setState({ - config: {...config, enabled: _enabled} - }) - } - - /** - * @description 鏍¢獙閰嶇疆淇℃伅鐨勫悎娉曟�� - */ - verifyconfig = (config) => { - let hasKey = false - let chartcols = [] - config.columns.forEach(col => { - if (col.field) { - chartcols.push(col.field) - } - if (config.setting.primaryKey === col.field) { - hasKey = true - } - }) - - let chartError = '' - config.charts && config.charts.forEach((chart, index) => { - if (chartError) return - if (chart.Hide === 'true') return - if (!['line', 'bar', 'pie'].includes(chart.chartType)) return - - if (!chart.Xaxis) { - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛皻鏈缃紝涓嶅彲鍚敤锛乣 - } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype !== 'statistics' && (!chart.Yaxis || chart.Yaxis.length === 0)) { // query 鏌ヨ鏁版嵁 - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛皻鏈缃紝涓嶅彲鍚敤锛乣 - } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype === 'statistics' && (!chart.InfoType || !chart.InfoValue)) { // statistics 缁熻鏁版嵁 - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛皻鏈缃紝涓嶅彲鍚敤锛乣 - } else if (chart.chartType === 'pie' && !chart.Yaxis) { - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛皻鏈缃紝涓嶅彲鍚敤锛乣 - } else if (!chartcols.includes(chart.Xaxis)) { - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛湪鏄剧ず鍒椾腑涓嶅瓨鍦紝涓嶅彲鍚敤锛乣 - } else if (chart.chartType === 'pie' && !chartcols.includes(chart.Yaxis)) { - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛湪鏄剧ず鍒椾腑涓嶅瓨鍦紝涓嶅彲鍚敤锛乣 - } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype === 'statistics' && (!chartcols.includes(chart.InfoType) || !chartcols.includes(chart.InfoValue))) { // statistics 缁熻鏁版嵁 - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛湪鏄剧ず鍒椾腑涓嶅瓨鍦紝涓嶅彲鍚敤锛乣 - } else if (['line', 'bar'].includes(chart.chartType) && chart.datatype !== 'statistics' && chart.Yaxis.filter(yaxis => !chartcols.includes(yaxis)).length > 0) { - chartError = `鍥捐〃${chart.title ? '銆�' + chart.title + '銆�' : index + 1}鍧愭爣杞村瓧娈靛湪鏄剧ず鍒椾腑涓嶅瓨鍦紝涓嶅彲鍚敤锛乣 - } - }) - - config.action && config.action.forEach((btn) => { - if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) { - let hascheck = false - btn.verify.scripts.forEach(item => { - if (item.status === 'false') return - - if (/\$check@|@check\$/ig.test(item.sql)) { - hascheck = true - } - }) - if (hascheck) { - notification.warning({ - top: 92, - message: `鍙�夋嫨澶氳鐨勬寜閽��${btn.label}銆嬩腑 $check@ 鎴� @check$ 灏嗕笉浼氱敓鏁堬紒`, - duration: 5 - }) - } - } - }) - - if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { - return '鏁版嵁婧愪腑涓嶆墽琛岄粯璁ql锛屼笖鏈坊鍔犺嚜瀹氫箟鑴氭湰锛屼笉鍙惎鐢紒' - } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { - return '鏁版嵁婧愭湭璁剧疆鍓嶇疆鑴氭湰锛屼笉鍙惎鐢紒' - } else if (config.setting.interType === 'custom' && config.setting.callbackType === 'script' && config.setting.cbScripts && config.setting.cbScripts.filter(item => item.status !== 'false').length === 0) { - return '鏁版嵁婧愭湭璁剧疆鍥炶皟鑴氭湰锛屼笉鍙惎鐢紒' - } else if (!config.setting.primaryKey) { - return '灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒' - } else if (config.columns.length === 0) { - return '灏氭湭璁剧疆鏄剧ず鍒楋紝涓嶅彲鍚敤锛�' - } else if (!hasKey) { - return '鏄剧ず鍒椾腑涓嶅瓨鍦ㄤ富閿瓧娈碉紝涓嶅彲鍚敤锛�' - } else if (chartError) { - return chartError - } else { - return true - } - } - - /** - * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽瓑 - */ - updateConfig = (res) => { - this.setState({ - thawButtons: res.thawButtons, - config: res.config - }) - } - - /** - * @description 鏇存柊鎼滅储鏉′欢閰嶇疆淇℃伅 - */ - updatesearch = (config) => { - - this.setState({ - config: config - }) - } - - /** - * @description 鏇存柊鎸夐挳閰嶇疆淇℃伅 - */ - updateaction = (config, copyId, delcard) => { - const { copyActions, delActions } = this.state - - this.setState({ - config: config, - copyActions: copyId ? [...copyActions, copyId] : copyActions, - delActions: delcard ? [...delActions, delcard] : delActions - }) - } - - /** - * @description 鏇存柊鏄剧ず鍒楅厤缃俊鎭� - */ - updateconfig = (config) => { - this.setState({ - config: config - }) - } - - /** - * @description 鏇存柊鍥捐〃缁勯厤缃俊鎭� - */ - updatechartgroup = (config, _chartview) => { - this.setState({ - config: config, - chartview: _chartview - }) - } - - - refreshConfig = () => { - const { config } = this.props - - let param = { - func: 'sPC_Get_LongParam', - MenuID: config.uuid - } - - Api.getSystemConfig(param).then(res => { - if (res.status) { - let _config = '' - 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 - }) - return - } - - // 鐗堟湰鍏煎 - _config = updateSubTable(_config) - - this.setState({ - config: null - }, () => { - this.setState({ - chartview: _config.charts ? _config.charts[0].uuid : '', - config: _config, - openEdition: res.open_edition || '', - activeKey: '0', - originActions: [], - originConfig: fromJS(_config).toJS() - }) - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - render () { - const { config } = this.state - - return ( - <div className="model-subtable-board"> - <DndProvider backend={HTML5Backend}> - <SettingComponent - config={config} - mainsearch={!this.props.editSubTab && this.props.editTab.mainsearch ? this.props.editTab.mainsearch : ''} - MenuID={config.uuid} - updatesetting={this.updateconfig} - /> - <SearchComponent - config={config} - updatesearch={this.updatesearch} - /> - <ActionComponent - type="subtable" - menu={{MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo, fstMenuList: this.props.menu.fstMenuList}} - config={config} - tabs={this.state.tabviews} - setSubConfig={this.setSubConfig} - updateaction={this.updateaction} - /> - <ColumnComponent - config={config} - menu={this.props.menu} - updatecolumn={this.updateconfig} - /> - </DndProvider> - </div> - ) - } -} - -export default TableConfig diff --git a/src/views/tabledesign/tableconfig/index.scss b/src/views/tabledesign/tableconfig/index.scss deleted file mode 100644 index 0adcbba..0000000 --- a/src/views/tabledesign/tableconfig/index.scss +++ /dev/null @@ -1,203 +0,0 @@ -.model-subtable-board { - position: fixed; - z-index: 1; - padding-top: 48px; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - background: rgba(0, 0, 0, 0.35); - display: flex; - .tools { - flex: 1; - background: #ffffff; - border-right: 1px solid #d9d9d9; - height: 100%; - overflow-y: hidden; - padding-bottom: 30px; - .ant-collapse-borderless { - background-color: #ffffff; - } - .ant-collapse-item { - position: relative; - border: 0; - } - .ant-input-search { - margin-top: 10px; - } - .ant-collapse-item.ant-collapse-item-active { - border-bottom: 1px solid #d9d9d9; - } - .ant-collapse .ant-collapse-header { - padding: 11px 16px 10px 40px; - border-bottom: 1px solid #d9d9d9; - background: #1890ff; - color: #ffffff; - } - .ant-collapse-content-box { - .ant-form-item { - margin-bottom: 10px; - .ant-form-item-label { - text-align: left; - height: 25px; - line-height: 25px; - } - } - } - .search-element { - padding-top: 10px; - li { - padding: 0px 16px 10px; - div { - cursor: move; - } - } - } - .config-btn { - position: relative; - - .config-btn-title { - margin-top: 20px; - margin-bottom: 10px; - color: #1890ff; - border-bottom: 1px solid #e8e8e8; - } - } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } - .config-button { - min-width: 65px; - } - } - .tools { - overflow-y: auto; - } - .tools::-webkit-scrollbar { - width: 4px; - } - .tools::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); - background: rgba(0, 0, 0, 0.08); - } - .tools::-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); - } - - .setting { - position: relative; - width: calc(100vw - 235px); - height: 100%; - background: #ffffff; - .ant-switch.big { - min-width: 60px; - height: 28px; - line-height: 28px; - margin-top: -2px; - .ant-switch-inner { - font-size: 14px; - } - } - .ant-switch.big::after { - width: 24px; - height: 24px; - } - .ant-card-head { - min-height: 44px; - } - .ant-card-head-title { - padding: 5px 0; - color: #1890ff; - } - .ant-card-extra { - padding: 5px 0; - button { - margin-left: 20px; - } - } - .ant-card-body { - position: relative; - padding: 0; - - .chart-view { - margin-bottom: 70px; - - .chart-title { - position: relative; - color: rgba(0, 0, 0, 0.65); - font-weight: 400; - font-size: 16px; - text-overflow: ellipsis; - white-space: nowrap; - overflow: hidden; - margin: 0 20px; - padding: 10px 5px 5px; - } - } - > .anticon-setting { - position: absolute; - font-size: 18px; - right: 7px; - top: 10px; - } - } - } - .setting { - overflow-y: scroll; - } - .setting::-webkit-scrollbar { - width: 7px; - } - .setting::-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); - display: none; - } - .setting::-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); - } - .setting:hover::-webkit-scrollbar-thumb { - display: block; - } - .ant-spin { - position: absolute; - margin-left: calc(50vw - 22px); - margin-top: 30vh; - } -} diff --git a/src/views/tabledesign/tableconfig/menuform/index.jsx b/src/views/tabledesign/tableconfig/menuform/index.jsx deleted file mode 100644 index 72f493f..0000000 --- a/src/views/tabledesign/tableconfig/menuform/index.jsx +++ /dev/null @@ -1,116 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input } from 'antd' -import { formRule } from '@/utils/option.js' -import './index.scss' - -const { TextArea } = Input - -class MainSearch extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - config: PropTypes.object, - updatemenu: PropTypes.func - } - - changeName = (e) => { - let value = e.target.value || '' - if (value.length > 100) return - - this.setState({}, () => { - this.props.updatemenu({...this.props.config, tabName: value}) - }) - } - - changeNo = (e) => { - let value = e.target.value || '' - if (value.length > 100) return - this.setState({}, () => { - this.props.updatemenu({...this.props.config, tabNo: value}) - }) - } - - changeRemark = (e) => { - let value = e.target.value || '' - if (value.length > 100) return - this.setState({}, () => { - this.props.updatemenu({...this.props.config, Remark: value}) - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return is(fromJS(this.props), fromJS(nextProps)) - } - - render() { - const { dict, config } = this.props - const { getFieldDecorator } = this.props.form - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 24 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 24 } - } - } - - return ( - <Form {...formItemLayout} className="ant-advanced-search-form" id="subqazxcvbn"> - <Row gutter={24}> - <Col span={24}> - <Form.Item label="椤甸潰鍚嶇О"> - {getFieldDecorator('tabName', { - initialValue: config.tabName, - rules: [ - { - required: true, - message: dict['form.required.input'] + '椤甸潰鍚嶇О!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label={dict['model.menu'] + dict['model.param']}> - {getFieldDecorator('tabNo', { - initialValue: config.tabNo, - rules: [ - { - required: true, - message: dict['form.required.input'] + dict['model.menu'] + dict['model.param'] + '!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label={dict['header.menu.Remark']}> - {getFieldDecorator('Remark', { - initialValue: config.Remark, - rules: [ - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<TextArea rows={2} placeholder="" autoComplete="off" onChange={this.changeRemark}/>)} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/views/tabledesign/tableconfig/menuform/index.scss b/src/views/tabledesign/tableconfig/menuform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/views/tabledesign/tableconfig/menuform/index.scss +++ /dev/null diff --git a/src/views/tabledesign/tableconfig/source.jsx b/src/views/tabledesign/tableconfig/source.jsx deleted file mode 100644 index bb48d97..0000000 --- a/src/views/tabledesign/tableconfig/source.jsx +++ /dev/null @@ -1,339 +0,0 @@ -import Utils from '@/utils/utils.js' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' - -const CommonDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS - -class SubTableBaseData { - baseConfig = { - version: '1.0', - type: 'system', - Template: 'SubTable', - enabled: false, - tabName: '', - tabNo: '', - Remark: '', - uuid: Utils.getuuid(), - setting: { - tableName: '', - tableType: 'checkbox', - primaryKey: '', - order: '', - dataresource: '', - interType: 'system', - innerFunc: '', - interface: '', - outerFunc: '' - }, - tables: [], - search: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'text', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'like', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'select', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'equal', - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'date', - resourceType: '0', - options: [], - orderType: 'asc', - match: 'greater', - } - ], - action: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'add', - intertype: 'system', - Ot: 'notRequired', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'pop', - icon: 'plus', - class: 'green', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'update', - intertype: 'system', - Ot: 'requiredSgl', - position: 'grid', - execSuccess: 'grid', - execError: 'never', - OpenType: 'pop', - icon: 'form', - class: 'purple', - verify: null - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'delete', - intertype: 'system', - Ot: 'required', - position: 'toolbar', - execSuccess: 'grid', - execError: 'never', - OpenType: 'prompt', - icon: 'delete', - class: 'red', - verify: null - } - ], - columns: [ - { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - }, { - origin: true, - uuid: Utils.getuuid(), - Align: 'left', - label: 'label', - field: '', - Hide: 'false', - IsSort: 'true', - type: 'text', - Width: 120 - } - ], - gridBtn: { - display: false, - Align: 'center', - IsSort: 'false', - uuid: Utils.getuuid(), - label: CommonDict['model.operation'], - type: 'action', - style: 'button', - show: 'horizontal', - Width: 120 - }, - expand: false, - charts: [{ - uuid: Utils.getuuid(), - label: '', - title: '', - chartType: 'table', - icon: 'table', - Hide: 'false', - blacklist: [] - }] - } - - searchItems = [ - { - type: 'search', - label: CommonDict['model.form.text'], - subType: 'text', - url: '' - }, - { - type: 'search', - label: CommonDict['model.form.select'], - subType: 'select', - url: '' - }, - { - type: 'search', - label: CommonDict['model.form.multiselect'], - subType: 'multiselect', - url: '' - }, - { - type: 'search', - label: CommonDict['model.form.link'], - subType: 'link', - url: '' - }, - { - type: 'search', - label: '閫夐」鍗�', - subType: 'checkcard', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堝ぉ锛�', - subType: 'date', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堝懆锛�', - subType: 'dateweek', - url: '' - }, - { - type: 'search', - label: CommonDict['model.form.datemonth'], - subType: 'datemonth', - url: '' - }, - { - type: 'search', - label: CommonDict['model.form.daterange'], - subType: 'daterange', - url: '' - }, - { - type: 'search', - label: CommonDict['model.form.dategroup'], - subType: 'group', - url: '' - } - ] - - actionItems = [ - { - type: 'action', - label: CommonDict['model.form.popform'], - subType: 'pop', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.prompt'], - subType: 'prompt', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.exec'], - subType: 'exec', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.excelIn'], - subType: 'excelIn', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.excelOut'], - subType: 'excelOut', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.popview'], - subType: 'popview', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.tab'], - subType: 'tab', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.newpage'], - subType: 'innerpage', - url: '' - }, - { - type: 'action', - label: CommonDict['model.form.funcbutton'], - subType: 'funcbutton', - url: '' - } - ] - - columnItems = [ - { - type: 'columns', - label: CommonDict['model.form.text'], - subType: 'text', - url: '' - }, - { - type: 'columns', - label: CommonDict['model.form.picture'], - subType: 'picture', - url: '' - }, - { - type: 'columns', - label: CommonDict['model.form.number'], - subType: 'number', - url: '' - }, - { - type: 'columns', - label: CommonDict['model.form.href'], - subType: 'link', - url: '' - }, - { - type: 'columns', - label: CommonDict['model.form.textarea'], - subType: 'textarea', - url: '' - }, - { - type: 'columns', - label: CommonDict['model.form.colspan'], - subType: 'colspan', - url: '' - }, - { - type: 'columns', - label: '搴忓彿', - subType: 'index', - url: '' - } - ] -} - -export default new SubTableBaseData() -- Gitblit v1.8.0