From d38dc481492878c04ddf2d6bc2e9bf7d44c57fd7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 23 十二月 2019 18:29:38 +0800 Subject: [PATCH] 2019-12-23 --- src/components/tabview/index.jsx | 2 src/index.js | 13 + src/components/tabview/index.scss | 2 src/assets/css/viewstyle.scss | 80 ++++++ src/tabviews/subtable/index.scss | 8 src/components/header/index.jsx | 2 src/templates/comtableconfig/source.jsx | 1 src/tabviews/subtable/subAction/index.jsx | 23 - src/components/sidemenu/editthdmenu/index.jsx | 203 ++++++++++------ src/templates/comtableconfig/index.jsx | 131 ++++------ src/templates/subtableconfig/index.jsx | 1 src/templates/comtableconfig/settingform/index.jsx | 12 + src/tabviews/commontable/index.scss | 3 src/templates/comtableconfig/tabdragelement/index.jsx | 3 src/tabviews/subtable/index.jsx | 22 + src/tabviews/commontable/index.jsx | 61 +++- src/components/sidemenu/editthdmenu/index.scss | 6 public/options.js | 3 src/templates/comtableconfig/tabform/index.jsx | 91 +++++- src/utils/option.js | 10 src/tabviews/subtable/subSearch/index.scss | 2 src/views/login/index.jsx | 4 22 files changed, 451 insertions(+), 232 deletions(-) diff --git a/public/options.js b/public/options.js index 2c13d14..2c96305 100644 --- a/public/options.js +++ b/public/options.js @@ -11,5 +11,6 @@ icp: '', bgColor: '', lineColor: '', - website: '' + website: '', + style: '' // 榛樿涓洪粦鑹诧紝鍙�変负white } \ No newline at end of file diff --git a/src/assets/css/viewstyle.scss b/src/assets/css/viewstyle.scss new file mode 100644 index 0000000..d4d9dab --- /dev/null +++ b/src/assets/css/viewstyle.scss @@ -0,0 +1,80 @@ +.mk-white { + > .flex-container { + > .header-container { + background: #ffffff; + color: #000000; + box-shadow: 0 2px 8px #f0f1f2; + + > .header-collapse i { + color: #000000; + } + > .header-menu { + li { + span { + color: #000000; + } + + &:hover { + span { + color: #06B4F7; + border-bottom: 4px solid #06B4F7; + } + } + &.active { + span { + color: #1890ff; + border-bottom: 4px solid #1890ff; + } + } + } + } + > .header-setting span { + color: #000000; + } + > .header-edit-box .dragdashboard { + background: #ffffff; + } + } + > .side-menu { + border-right: 1px solid #d9d9d9; + background: #ffffff; + > .ant-menu { + background: #ffffff; + > .ant-menu-submenu { + color: #000000; + background: #ffffff; + > .ant-menu-submenu-title { + background: #ffffff; + &:hover { + color: #1890ff; + } + > .ant-menu-submenu-arrow:before { + background: #000000; + } + > .ant-menu-submenu-arrow:after { + background: #000000; + } + } + > .ant-menu-sub { + background: #ffffff; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25) inset; + .ant-menu-item { + border-bottom: 1px solid #d9d9d9; + // background-color: #c4ebfd; + a { + color: #000000; + } + } + } + } + > .ant-menu-submenu.ant-menu-submenu-open { + color: #1890ff; + } + } + // .ant-menu-inline.ant-menu-sub { + // background: #ffffff; + // color: #000000; + // } + } + } +} \ No newline at end of file diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 0e9da9a..305f2f8 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -41,7 +41,7 @@ visible: false, // 淇敼瀵嗙爜妯℃�佹 dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, confirmLoading: false, - userName: localStorage.getItem('username'), + userName: sessionStorage.getItem('User_Name'), logourl: window.GLOB.mainlogo || logourl } diff --git a/src/components/sidemenu/editthdmenu/index.jsx b/src/components/sidemenu/editthdmenu/index.jsx index 5b14802..3c26b4e 100644 --- a/src/components/sidemenu/editthdmenu/index.jsx +++ b/src/components/sidemenu/editthdmenu/index.jsx @@ -10,6 +10,7 @@ import Utils from '@/utils/utils.js' import DragElement from '../menuelement' import asyncLoadComponent from '@/utils/asyncLoadComponent' +import { sysTemps } from '@/utils/option.js' import Api from '@/api' import zhCN from '@/locales/zh-CN/header.js' import enUS from '@/locales/en-US/header.js' @@ -23,56 +24,56 @@ const { confirm } = Modal const { TabPane } = Tabs const { Search } = Input -const illust = { + +const illust = { // 妯℃澘鍥剧墖锛岀敤浜庡凡浣跨敤妯℃澘 CommonTable: nortable } -let previewList = null + +let previewList = null // 鍒濆鑿滃崟鍒楄〃 class EditMenu extends Component { static propTpyes = { - menulist: PropTypes.any, - supMenuList: PropTypes.array, - supMenu: PropTypes.object, - reload: PropTypes.func, - exitEdit: PropTypes.func + reload: PropTypes.func, // 鑿滃崟淇敼鍚庡埛鏂� + menulist: PropTypes.any, // 涓夌骇鑿滃崟鍒楄〃 + exitEdit: PropTypes.func, // 閫�鍑虹紪杈戠姸鎬� + supMenu: PropTypes.object, // 瀵瑰簲鐨勪笂绾ц彍鍗� + supMenuList: PropTypes.array // 涓婄骇鑿滃崟鍒楄〃锛岀敤浜庝笁绾ц彍鍗曞垏鎹笂绾ц彍鍗� } state = { dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS, - show: true, - thawmenulist: null, // 宸插喕缁撶殑浜岀骇鑿滃崟 - visible: null, - title: '', - type: '', - tabview: '', // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛� - formlist: null, + show: true, // 鎺у埗鑿滃崟鍒锋柊 + thawmenulist: null, // 宸插喕缁撶殑浜岀骇鑿滃崟 + type: '', // 鎿嶄綔绫诲瀷锛屾柊寤烘垨缂栬緫鑿滃崟 + tabview: '', // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛夈�佽〃鍗曪紙Modal锛夈�佸瓙琛紙SubTable锛� editMenu: null, // 缂栬緫鑿滃崟 editAction: null, // 缂栬緫鎸夐挳 editTab: null, // 缂栬緫鏍囩 thawMvisible: false, // 瑙i櫎鍐荤粨妯℃�佹 confirmLoading: false, // 鎻愪氦涓�傘�傘�� selectTemp: '', // 閫夋嫨妯℃澘 - usedTemplates: null, - menuConfig: '', - tempSearchKey: '', - loading: false, - preview: null, - pretemplate: null, - baseTemplates: [{ - title: '鍩虹琛ㄦ牸', - type: 'CommonTable', - url: illust['CommonTable'], - baseconfig: '' - }] + usedTemplates: null, // 宸蹭娇鐢ㄦā鏉垮垪琛� + tempSearchKey: '', // 鑿滃崟鍚嶇О杩囨护鍊� + loading: false, // 缂栬緫鑿滃崟鎴栦娇鐢ㄥ凡浣跨敤妯℃澘鏃讹紝鑾峰彇閰嶇疆淇℃伅 + preview: null, // 鍥剧墖棰勮url + pretemplate: null, // 棰勮妯℃澘 + sysTemplates: sysTemps // 绯荤粺妯℃澘 } + /** + * @description 鑿滃崟椤哄簭鏀瑰彉鏃讹紝淇濆瓨涓棿鐘舵�� + */ handlePreviewList = (List) => { - // 鑿滃崟椤哄簭鏀瑰彉鏃讹紝淇濆瓨涓棿鐘舵�� previewList = List } + /** + * @description 鑿滃崟缂栬緫锛氫慨鏀广�佸垹闄� + * 1銆佽彍鍗曚慨鏀规垨鍒犻櫎鏃讹紝鍏堟煡鐪嬭彍鍗曢『搴忔槸鍚︽敼鍙� + * 2銆佽彍鍗曞垹闄� + * 3銆佽彍鍗曠紪杈戯紝鏌ヨ鑿滃崟閰嶇疆淇℃伅锛屼俊鎭纭紝杩涘叆瀵瑰簲缂栬緫椤甸潰 + */ handleMenu = (menu) => { - // 鑿滃崟缂栬緫锛氫慨鏀广�佸垹闄� const _this = this if (previewList && !is(fromJS(previewList), fromJS(this.state.subMenulist))) { notification.warning({ @@ -122,25 +123,23 @@ try { _LongParam = JSON.parse(_LongParam) } catch (e) { - _LongParam = { - type: 'system', - setting: {}, - search: [], - action: [], - columns: [] - } + _LongParam = '' } + _menu.LongParam = _LongParam _menu.ParentID = this.props.supMenu.MenuID // 妫�娴嬫ā鏉挎槸鍚﹀瓨鍦� - let _Template = this.state.baseTemplates.filter(temp => temp.type === _menu.PageParam.Template) + let _Template = this.state.sysTemplates.filter(temp => temp.type === _menu.PageParam.Template) + this.setState({ type: 'edit', editMenu: _menu, loading: false, tabview: _Template.length > 0 ? _menu.PageParam.Template : 'template' }) + + // 妯℃澘涓嶅瓨鍦ㄦ椂閿欒鎻愮ず if (_Template.length === 0) { notification.warning({ top: 92, @@ -320,57 +319,104 @@ }) } - useTemplate = (template) => { + useTemplate = (template, useType) => { const { type, editMenu } = this.state - // 閫夋嫨妯℃澘锛氭坊鍔犺彍鍗曟椂 - if (type === 'add') { - this.setState({ - tabview: template.type, - editMenu: { - MenuID: Utils.getuuid(), - MenuName: '', - MenuNo: '', - id: this.props.menulist.length, - src: '', - text: '', - type: template.type, - PageParam: {OpenType: 'newtab', Template: template.type}, - LongParam: template.baseconfig, - ParentID: this.props.supMenu.MenuID + new Promise(resolve => { + if (useType === 'sys') { + resolve(true) + } else { + let param = { + func: 'sPC_Get_LongParam', + MenuID: template.uuid } - }) - } else { - let _PageParam = {OpenType: editMenu.PageParam.OpenType || 'newtab', Template: template.type} + this.setState({ + loading: true + }) - this.setState({ - tabview: template.type, - editMenu: {...editMenu, LongParam: template.baseconfig, PageParam: _PageParam, type: template.type} - }) - } - document.getElementById('root').style.overflowY = 'hidden' + Api.getSystemConfig(param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 10 + }) + resolve(false) + } else { + let _config = '' + if (result.LongParam) { + try { + _config = window.decodeURIComponent(window.atob(result.LongParam)) + _config = JSON.parse(_config) + _config.type = 'user' + } catch (e) { + _config = '' + } + } + + if (_config) { + template.baseconfig = _config + resolve(true) + } else { + notification.warning({ + top: 92, + message: '妯℃澘淇℃伅鑾峰彇澶辫触锛�', + duration: 10 + }) + resolve(false) + } + } + }) + } + }).then(res => { + if (!res) { + this.setState({ + loading: false + }) + return + } + + // 閫夋嫨妯℃澘锛氭坊鍔犺彍鍗曟椂 + if (type === 'add') { + this.setState({ + tabview: template.type, + loading: false, + editMenu: { + MenuID: Utils.getuuid(), + MenuName: '', + MenuNo: '', + id: this.props.menulist.length, + src: '', + text: '', + type: template.type, + PageParam: {OpenType: 'newtab', Template: template.type}, + LongParam: template.baseconfig, + ParentID: this.props.supMenu.MenuID + } + }) + } else { + let _PageParam = {OpenType: editMenu.PageParam.OpenType || 'newtab', Template: template.type} + + this.setState({ + loading: false, + tabview: template.type, + editMenu: {...editMenu, LongParam: template.baseconfig, PageParam: _PageParam, type: template.type} + }) + } + document.getElementById('root').style.overflowY = 'hidden' + }) } getUsedTemplate = () => { - Api.getSystemConfig({func: 'sPC_Get_UserTemp'}).then(res => { + Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'menu'}).then(res => { this.setState({ usedTemplates: res.UserTemp.map(temp => { - let _config = '' - if (temp.LongParam) { - _config = window.decodeURIComponent(window.atob(temp.LongParam)) - try { - _config = JSON.parse(_config) - _config.type = 'user' - } catch (e) { - _config = '' - } - } return { + uuid: temp.MenuID, title: temp.MenuName, type: temp.Template, - url: illust[temp.Template], - baseconfig: _config + url: illust[temp.Template] } }) }) @@ -401,7 +447,6 @@ }) } } else if (type === 'tab') { - console.log(item) if (item.type === 'SubTable') { this.setState({ editMenu: originMenu, @@ -478,14 +523,14 @@ {this.state.tabview === 'template' && <Tabs defaultActiveKey="1"> <TabPane tab="绯荤粺妯℃澘" key="1"> <Row> - {this.state.baseTemplates.map(template => { + {this.state.sysTemplates.map(template => { return ( <Col key={template.type} span={8}> <Card title={template.title}> <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> <div className="card-operation"> - <Button type="primary" onClick={() => {this.useTemplate(template)}}>浣跨敤妯℃澘</Button> + <Button type="primary" onClick={() => {this.useTemplate(template, 'sys')}}>浣跨敤妯℃澘</Button> </div> </Card> </Col> @@ -508,7 +553,7 @@ title={template.title}> <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> <div className="card-operation"> - <Button type="primary" onClick={() => {this.useTemplate(template)}}>浣跨敤妯℃澘</Button> + <Button type="primary" onClick={() => {this.useTemplate(template, 'user')}}>浣跨敤妯℃澘</Button> </div> </Card> </Col> @@ -561,7 +606,7 @@ {!this.state.thawmenulist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />} {this.state.thawmenulist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawmenulist}/>} </Modal> - {this.state.loading && <Spin style={{position: 'fixed', left: 'calc(50vw - 22px)', top: 'calc(50vh - 70px)'}} size="large" />} + {this.state.loading && <Spin className="loading-thdmenu" size="large" />} </div> ) } diff --git a/src/components/sidemenu/editthdmenu/index.scss b/src/components/sidemenu/editthdmenu/index.scss index 832bbaf..7304371 100644 --- a/src/components/sidemenu/editthdmenu/index.scss +++ b/src/components/sidemenu/editthdmenu/index.scss @@ -163,4 +163,10 @@ } } } + > .loading-thdmenu { + position: fixed; + left: calc(50vw - 22px); + top: calc(50vh - 70px); + z-index: 1100; + } } diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index 415ba69..9d6f23e 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -174,7 +174,7 @@ <Tabs.TabPane className="test" tab={ - <span> + <span className="tab-control"> <span className="tab-name" onClick={() => {this.changeTab(view)}}> {view.MenuName} </span> diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index a506fe2..f333dd3 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -14,7 +14,7 @@ .ant-tabs-tab { padding: 18px 16px 6px; cursor: default; - span i { + span.tab-control i { position: relative; left: 7px; top: -6px; diff --git a/src/index.js b/src/index.js index 46ab291..2763702 100644 --- a/src/index.js +++ b/src/index.js @@ -7,6 +7,7 @@ import '@/assets/css/main.scss' import '@/assets/css/action.scss' import '@/assets/css/minkeicon.css' +import '@/assets/css/viewstyle.scss' if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) { window.location.replace(window.location.href.split('build/')[0] + 'index.html') @@ -21,7 +22,17 @@ ) } -document.title = window.GLOB.title || 'MinkeSoft' +document.title = (window.GLOB && window.GLOB.title) || 'MinkeSoft' + +const option = { + white: 'mk-white' +} + +if (window.GLOB && window.GLOB.style && option[window.GLOB.style]) { + document.getElementById('root').className = option[window.GLOB.style] +} + + render(Route) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 2e4b459..b8fe773 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { BackTop, notification, Spin, Tabs} from 'antd' +import { BackTop, notification, Spin, Tabs, Icon} from 'antd' import moment from 'moment' import Api from '@/api' import MainSearch from './mainSearch' @@ -56,7 +56,7 @@ MenuID: this.props.MenuID } let result = await Api.getSystemCacheConfig(param) - if (result.status && result.LongParam) { + if (result.status) { let config = '' try { // 閰嶇疆淇℃伅瑙f瀽 @@ -68,10 +68,9 @@ // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� if (!config) { - notification.warning({ - top: 92, - message: this.state.dict['main.page.settingerror'], - duration: 10 + this.setState({ + loadingview: false, + viewlost: true }) return } @@ -147,7 +146,9 @@ loading: true }, () => { this.improveSearch() - this.loadmaindata() + if (config.setting.onload !== 'false') { + this.loadmaindata() + } }) } else { this.setState({ @@ -321,16 +322,29 @@ } refreshbysearch = (searches) => { + const { setting } = this.state // 鎼滅储鏉′欢鍙樺寲 - this.refs.mainTable.resetTable() - this.setState({ - loading: true, - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata() - }) + if (setting.onload === 'false') { + this.setState({ + loading: true, + pageIndex: 1, + search: searches, + setting: {...setting, onload: 'true'} + }, () => { + this.loadmaindata() + }) + } else { + this.refs.mainTable.resetTable() + + this.setState({ + loading: true, + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata() + }) + } } refreshbytable = (pagination, filters, sorter) => { @@ -474,7 +488,7 @@ render() { const { setting, searchlist, actions, columns, loadingview, viewlost, tabviews } = this.state - console.log(setting) + return ( <div className="commontable" id={'commontable' + this.props.MenuID}> {loadingview && <Spin size="large" />} @@ -485,7 +499,7 @@ dict={this.state.dict} /> : null } - {actions && + {actions && setting.onload !== 'false' && <MainAction ref="mainButton" MenuID={this.props.MenuID} @@ -496,7 +510,7 @@ dict={this.state.dict} /> } - {columns && + {columns && setting.onload !== 'false' && <MainTable ref="mainTable" dict={this.state.dict} @@ -510,11 +524,16 @@ buttonTrigger={this.buttonTrigger} /> } - {setting && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 && + {setting && setting.onload !== 'false' && setting.tabshow !== 'vertical' && tabviews && tabviews.length > 0 && <Tabs defaultActiveKey="0" tabPosition="top"> {tabviews.map((_tab, index) => ( - <TabPane tab={ _tab.label } key={`${index}`}> - {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={this.props.MenuID} BID={this.state.BID} /> : null} + <TabPane tab={ + <span> + {_tab.icon ? <Icon type={_tab.icon} /> : null} + {_tab.label} + </span> + } key={`${index}`}> + {_tab.type === 'SubTable' ? <SubTable SupMenuID={this.props.MenuID} MenuID={_tab.linkTab} BID={this.state.BID} /> : null} </TabPane> ))} </Tabs> diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index e986ad2..0f94b69 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -26,6 +26,9 @@ } > .ant-tabs { padding: 0px 20px; + .ant-tabs-tab:not(.ant-tabs-tab-active) { + cursor: pointer; + } } } .ant-back-top { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 87912f2..ad1d646 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -15,9 +15,9 @@ export default class NormalTable extends Component { static propTpyes = { - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuID: PropTypes.string // 鑿滃崟Id + BID: PropTypes.string, // 涓婄骇鏁版嵁ID + MenuID: PropTypes.string, // 鑿滃崟Id + SupMenuID: PropTypes.string // 涓婄骇鑿滃崟Id } state = { @@ -51,7 +51,7 @@ MenuID: this.props.MenuID } let result = await Api.getSystemCacheConfig(param) - if (result.status && result.LongParam) { + if (result.status) { let config = '' try { // 閰嶇疆淇℃伅瑙f瀽 @@ -63,10 +63,15 @@ // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� if (!config) { - notification.warning({ - top: 92, - message: this.state.dict['main.page.settingerror'], - duration: 10 + // notification.warning({ + // top: 92, + // message: this.state.dict['main.page.settingerror'], + // duration: 10 + // }) + this.setState({ + loadingview: false, + viewlost: true + // lostmsg: this.state.dict['main.page.settingerror'] }) return } @@ -483,6 +488,7 @@ <SubAction ref="subButton" MenuID={this.props.MenuID} + BID={this.props.BID} setting={setting} refreshdata={this.refreshbyaction} gettableselected={this.gettableselected} diff --git a/src/tabviews/subtable/index.scss b/src/tabviews/subtable/index.scss index f43f186..1fbaa49 100644 --- a/src/tabviews/subtable/index.scss +++ b/src/tabviews/subtable/index.scss @@ -1,6 +1,6 @@ .subtable { position: relative; - min-height: calc(100vh - 94px); + min-height: 200px; padding-top: 16px; .box404 { padding-top: 30px; @@ -19,9 +19,9 @@ } } > .ant-spin { - position: fixed; - left: calc(50vw - 22px); - top: calc(50vh - 70px); + position: absolute; + left: calc(50% - 22px); + top: 100px; } } .ant-back-top { diff --git a/src/tabviews/subtable/subAction/index.jsx b/src/tabviews/subtable/subAction/index.jsx index 051f3b8..be1c35b 100644 --- a/src/tabviews/subtable/subAction/index.jsx +++ b/src/tabviews/subtable/subAction/index.jsx @@ -11,9 +11,10 @@ class MainAction extends Component { static propTpyes = { + BID: PropTypes.string, + dict: PropTypes.object, // 瀛楀吀椤� MenuID: PropTypes.string, actions: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 - dict: PropTypes.object, // 瀛楀吀椤� setting: PropTypes.any } @@ -120,7 +121,8 @@ (btn.OpenType === 'pop' && !btn.innerFunc && btn.sql && btn.sqlType === 'insert') ) { let param = { // 绯荤粺瀛樺偍杩囩▼ - func: 'sPC_TableData_InUpDe' + func: 'sPC_TableData_InUpDe', + BID: this.props.BID } if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� @@ -135,7 +137,6 @@ } param.ID = ID - param.BID = '' if (btn.innerFunc) { param.func = btn.innerFunc @@ -159,18 +160,13 @@ if (!param.hasOwnProperty('ID') && setting.primaryKey && data[0] && data[0][setting.primaryKey]) { param.ID = data[0][setting.primaryKey] } - if (!param.hasOwnProperty('BID')) { - param.BID = '' - } } else if (btn.sql && btn.sqlType === 'insert') { param.ID = Utils.getguid() - param.BID = '' param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) } else if (btn.sql) { param.ID = data[0][setting.primaryKey] - param.BID = '' param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) @@ -189,12 +185,12 @@ } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { let deffers = data.map(cell => { let param = { - func: 'sPC_TableData_InUpDe' + func: 'sPC_TableData_InUpDe', + BID: this.props.BID } if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� param.ID = cell[setting.primaryKey] - param.BID = '' if (btn.innerFunc) { param.func = btn.innerFunc @@ -218,7 +214,6 @@ } } else if (btn.sql) { param.ID = cell[setting.primaryKey] - param.BID = '' param.LText = Utils.formatOptions(Utils.getSysDefaultSql(btn, setting, formdata)) // 鏁版嵁婧� param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) @@ -263,7 +258,7 @@ /** *********************璋冪敤澶栭儴鎺ュ彛************************* */ let param = { ID: '', - BID: '' + BID: this.props.BID } if (!btn.interface) { // 鎺ュ彛鍦板潃涓嶅瓨鍦ㄦ椂鎶ラ敊 @@ -359,7 +354,7 @@ if (btn.innerFunc) { let deffers = data.map(cell => { let _param = { - BID: '', + BID: this.props.BID, func: btn.innerFunc } _param.ID = cell[setting.primaryKey] @@ -393,7 +388,7 @@ } else { let params = data.map(cell => { return { - BID: '', + BID: this.props.BID, ID: cell[setting.primaryKey] } }) diff --git a/src/tabviews/subtable/subSearch/index.scss b/src/tabviews/subtable/subSearch/index.scss index 5ff9aea..5e53e65 100644 --- a/src/tabviews/subtable/subSearch/index.scss +++ b/src/tabviews/subtable/subSearch/index.scss @@ -1,6 +1,6 @@ .ant-advanced-search-form.subtable-main-search { padding: 0px 0px 20px; - border-bottom: 1px solid #e9e9e9; + border-bottom: 1px solid #efefef; .ant-form-item { display: flex; margin-bottom: 10px; diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 02c1f4d..447b25a 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -69,7 +69,7 @@ delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 funcLoading: false, // 瀛樺偍杩囩▼鍒涘缓涓� showColumnName: false, // 鏄剧ず鍒楀瓧娈靛悕鎺у埗 - tabviews: false // 鎵�鏈夋爣绛鹃〉 + tabviews: [] // 鎵�鏈夋爣绛鹃〉 } /** @@ -261,30 +261,21 @@ }) }) - // let param = { - // func: 'sPC_Get_SelectedList', - // LText: 'select TbName ,Remark from sDataDictionary where IsKey!=\'\' and Deleted =0', - // obj_name: 'data', - // arr_field: 'TbName,Remark' - // } - - // param.LText = Utils.formatOptions(param.LText) - // param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - // param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - // Api.getSystemConfig(param).then(res => { - // if (res.status) { - // this.setState({ - // tables: res.data - // }) - // } else { - // notification.warning({ - // top: 92, - // message: res.message, - // duration: 10 - // }) - // } - // }) + Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { + if (res.status) { + this.setState({ + tabviews: res.UserTemp.map(temp => { + return { + uuid: temp.MenuID, + value: temp.MenuID, + text: temp.MenuName, + type: temp.Template, + MenuNo: temp.MenuNo + } + }) + }) + } + }) } handleList = (type, list, card) => { @@ -986,19 +977,7 @@ label: '鍏宠仈鏍囩', initVal: card.linkTab || '', required: false, - options: [{ - value: '', - text: '鏂板缓' - }, { - value: 'jadisfjiasodjIjjaidfoasdf', - text: '瀛愯〃1' - }, { - value: 'dasjfsioafjiaga', - text: '瀛愯〃2' - }, { - value: 'jadsifjasgfisag', - text: '瀛愯〃3' - }] + options: [] }, { type: 'select', @@ -2465,47 +2444,46 @@ } }) } else if (type === 'tab') { - if (btn.linkTab) { - - } else { - let _tab = { - uuid: btn.linkId, - create: true - } - this.props.handleSubConfig(btn, originMenu, _tab, type) - } this.setState({ loading: true }) - // Api.getSystemConfig({ - // func: 'sPC_Get_LongParam', - // MenuID: btn.linkId - // }).then(res => { - // if (res.status) { - // this.setState({ - // loading: false - // }) - // let _LongParam = '' - // if (res.LongParam) { - // _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) - // try { - // _LongParam = JSON.parse(_LongParam) - // } catch (e) { - // _LongParam = '' - // } - // } - // console.log(_LongParam) - // } else { - // this.setState({ - // loading: false - // }) - // notification.warning({ - // top: 92, - // message: res.message, - // duration: 10 - // }) - // } - // }) + Api.getSystemConfig({ + func: 'sPC_Get_LongParam', + MenuID: btn.linkTab + }).then(res => { + if (res.status) { + this.setState({ + loading: false + }) + let _LongParam = '' + if (res.LongParam) { + _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) + try { + _LongParam = JSON.parse(_LongParam) + } catch (e) { + _LongParam = '' + } + } + if (!_LongParam) { + _LongParam = { + ...btn, + uuid: btn.linkTab, + create: true + } + } + + this.props.handleSubConfig(btn, originMenu, _LongParam, type) + } else { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) } }, () => { notification.warning({ @@ -2801,6 +2779,7 @@ {this.state.formtemp === 'tabs' ? <TabForm type="tabs" + tabs={this.state.tabviews} dict={this.state.dict} card={this.state.card} formlist={this.state.formlist} diff --git a/src/templates/comtableconfig/settingform/index.jsx b/src/templates/comtableconfig/settingform/index.jsx index 52fa1cf..8833c31 100644 --- a/src/templates/comtableconfig/settingform/index.jsx +++ b/src/templates/comtableconfig/settingform/index.jsx @@ -240,6 +240,18 @@ )} </Form.Item> </Col> + <Col span={12}> + <Form.Item label="鍒濆鍖�"> + {getFieldDecorator('onload', { + initialValue: data.onload || 'true' + })( + <Select> + <Select.Option value="true">鍔犺浇鏁版嵁</Select.Option> + <Select.Option value="false">涓嶅姞杞芥暟鎹�</Select.Option> + </Select> + )} + </Form.Item> + </Col> </Row> </Form> ) diff --git a/src/templates/comtableconfig/source.jsx b/src/templates/comtableconfig/source.jsx index 398db0c..c269728 100644 --- a/src/templates/comtableconfig/source.jsx +++ b/src/templates/comtableconfig/source.jsx @@ -20,6 +20,7 @@ innerFunc: '', interface: '', outerFunc: '', + onload: 'true', tabshow: 'horizontal' }, tables: [], diff --git a/src/templates/comtableconfig/tabdragelement/index.jsx b/src/templates/comtableconfig/tabdragelement/index.jsx index cc6637a..cb04567 100644 --- a/src/templates/comtableconfig/tabdragelement/index.jsx +++ b/src/templates/comtableconfig/tabdragelement/index.jsx @@ -43,8 +43,7 @@ newcard.label = 'tab' newcard.icon = '' newcard.type = item.subType - newcard.linkTab = '' - newcard.linkId = Utils.getuuid() + newcard.linkTab = Utils.getuuid() newcard.supMenu = '' let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0 diff --git a/src/templates/comtableconfig/tabform/index.jsx b/src/templates/comtableconfig/tabform/index.jsx index e6b8254..d338f64 100644 --- a/src/templates/comtableconfig/tabform/index.jsx +++ b/src/templates/comtableconfig/tabform/index.jsx @@ -7,6 +7,7 @@ class MainTab extends Component { static propTpyes = { + tabs: PropTypes.array, // 绫诲瀷 type: PropTypes.string, // 绫诲瀷 dict: PropTypes.object, // 瀛楀吀椤� formlist: PropTypes.any, // 琛ㄥ崟 @@ -14,7 +15,7 @@ } state = { - formlist: null // 琛ㄥ崟 + formlist: null // 琛ㄥ崟 } /** @@ -22,11 +23,30 @@ */ UNSAFE_componentWillMount () { const { formlist } = this.props + let type = formlist.filter(cell => cell.key === 'type')[0].initVal - console.log(type) - + let _initval = formlist.filter(cell => cell.key === 'linkTab')[0].initVal + + let _tabs = this.props.tabs.filter(tab => tab.type === type) + let initTab = _tabs.filter(tab => tab.uuid === _initval)[0] + console.log(_tabs) this.setState({ - formlist: formlist + formlist: formlist.map(item => { + if (item.key === 'linkTab') { + item.options = [ + { + value: '', + text: '鏂板缓' + }, + ..._tabs + ] + if (!initTab) { + item.initVal = '' + } + } + + return item + }) }) } @@ -34,22 +54,51 @@ * @description 鏍囩椤电被鍨嬪垏鎹� */ openTypeChange = (key, value) => { - console.log(value) - // if (key === 'type') { - // console.log(value) + const { formlist } = this.state - // this.setState({ - // formlist: this.state.formlist.map(form => { - // return form - // }) - // }, () => { - // this.setState({ - // formlist: this.state.formlist.map(form => { - // return form - // }) - // }) - // }) - // } + if (key === 'type') { + let _tabs = this.props.tabs.filter(tab => tab.type === value) + + this.setState({ + formlist: formlist.map(item => { + if (item.key === 'linkTab') { + item.options = [ + { + value: '', + text: '鏂板缓' + }, + ..._tabs + ] + item.initVal = '' + item.hidden = true + } + return item + }) + }, () => { + this.setState({ + formlist: this.state.formlist.map(item => { + if (item.key === 'linkTab') { + item.hidden = false + } + return item + }) + }) + }) + + console.log(value) + + this.setState({ + formlist: this.state.formlist.map(form => { + return form + }) + }, () => { + this.setState({ + formlist: this.state.formlist.map(form => { + return form + }) + }) + }) + } } getFields() { @@ -94,7 +143,7 @@ onChange={(value) => {this.openTypeChange(item.key, value)}} > {item.options.map((option, i) => - <Select.Option id={`${i}`} title={option.text} key={`${i}`} value={option.value}> + <Select.Option id={'mk' + i} title={option.text} key={'mk' + i} value={option.value}> {item.key === 'icon' && i !== 0 ? <Icon type={option.text} /> : option.text} </Select.Option> )} @@ -118,7 +167,7 @@ values.uuid = this.props.card.uuid if (!values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d - values.linkId = Utils.getuuid() + values.linkTab = Utils.getuuid() } resolve({ diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index bef5538..aa2766b 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -80,6 +80,7 @@ _config = JSON.parse(JSON.stringify(Source.baseConfig)) if (config.uuid) { _config.uuid = config.uuid + _config.tabName = config.label } } else { _config = JSON.parse(JSON.stringify(config)) diff --git a/src/utils/option.js b/src/utils/option.js index 13e7123..6895417 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -1,8 +1,18 @@ import zhCN from '@/locales/zh-CN/share.js' import enUS from '@/locales/en-US/share.js' +import nortable from '@/assets/img/normaltable.jpg' const _dict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +export const sysTemps = [ + { + title: '鍩虹琛ㄦ牸', + type: 'CommonTable', + url: nortable, + baseconfig: '' + } +] + export const dateOptions = { date: [ {value: '', text: _dict['date.empty']}, diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 90fe6b8..eab86ed 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -64,8 +64,10 @@ sessionStorage.setItem('UserID', res.UserID) sessionStorage.setItem('SessionUid', Utils.getuuid()) sessionStorage.setItem('LoginUID', res.LoginUID) + sessionStorage.setItem('User_Name', res.UserName) + localStorage.setItem('lang', param.lang) - + let _url = window.location.href.split('#')[0] if (param.remember) { // 璁颁綇瀵嗙爜鏃惰处鍙峰瘑鐮佸瓨鍏ocalStorage -- Gitblit v1.8.0