From 9b6ce1a5778c6e1a813237e87588c0052aae1bbb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 29 四月 2020 17:26:15 +0800 Subject: [PATCH] 2020-04-29 --- src/templates/subtableconfig/index.jsx | 1697 ++++++++-------------------------------------------------- 1 files changed, 240 insertions(+), 1,457 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index dab3aa9..2b7b9df 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -4,39 +4,32 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip, message } from 'antd' +import { Button, Card, Modal, Collapse, notification, Spin, Icon, Switch, Tooltip, Col } from 'antd' import moment from 'moment' import Api from '@/api' -import options from '@/store/options.js' -import zhCN from '@/locales/zh-CN/comtable.js' -import enUS from '@/locales/en-US/comtable.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' import Utils from '@/utils/utils.js' -import { getSearchForm, getActionForm, getColumnForm } from '@/templates/zshare/formconfig' -import { queryTableSql } from '@/utils/option.js' -import ActionForm from './actionform' +import TableComponent from '@/templates/sharecomponent/tablecomponent' +import FieldsComponent from '@/templates/sharecomponent/fieldscomponent' +import ChartGroupComponent from '@/templates/sharecomponent/chartgroupcomponent' +import SearchComponent from '@/templates/sharecomponent/searchcomponent' +import ActionComponent from '@/templates/sharecomponent/actioncomponent' +import ColumnComponent from '@/templates/sharecomponent/columncomponent' + import SettingForm from './settingform' -import SearchForm from '@/templates/zshare/searchform' -import ColumnForm from '@/templates/zshare/columnform' -import DragElement from '@/templates/zshare/dragelement' -import ColspanForm from '@/templates/zshare/colspanform' -import GridBtnForm from '@/templates/zshare/gridbtnform' -import EditCard from '@/templates/zshare/editcard' -import VerifyCard from '@/templates/zshare/verifycard' -import VerifyCardPrint from '@/templates/zshare/verifycardprint' -import VerifyCardExcelIn from '@/templates/zshare/verifycardexcelin' -import VerifyCardExcelOut from '@/templates/zshare/verifycardexcelout' import MenuForm from '@/templates/zshare/menuform' import EditComponent from '@/templates/zshare/editcomponent' import SourceElement from '@/templates/zshare/dragelement/source' import CreateFunc from '@/templates/zshare/createfunc' import CreateInterface from '@/templates/zshare/createinterface' +import ChartComponent from '@/templates/zshare/chartcomponent' import Source from './source' import './index.scss' const { Panel } = Collapse -const { Option } = Select const { confirm } = Modal const CommonDict = (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS @@ -57,15 +50,11 @@ dict: CommonDict, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆 visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 - modalTitle: '', // 妯℃�佹鐨勬爣棰� - tableVisible: false, // 鏁版嵁琛ㄥ瓧娈垫ā鎬佹 - addType: '', // 娣诲姞绫诲瀷-鎼滅储鏉′欢鎴栨樉绀哄垪 - tableColumns: [], // 琛ㄦ牸鏄剧ず鍒� + tableFields: [], // 宸查�夎〃瀛楁闆� fields: null, // 鎼滅储鏉′欢鍙婃樉绀哄垪锛屽彲閫夊瓧娈� menuformlist: null, // 鍩烘湰淇℃伅琛ㄥ崟瀛楁 formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 formtemp: '', // 琛ㄥ崟绫诲瀷锛屾樉绀哄垪銆佹寜閽�佹悳绱㈡潯浠� - modaltype: '', // 妯℃�佹绫诲瀷锛屾帶鍒舵ā鎬佹鏄剧ず card: null, // 缂栬緫鍏冪礌 menuloading: false, // 鑿滃崟淇濆瓨涓� menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 @@ -78,13 +67,14 @@ originActions: null, // 鍘熷鎸夐挳淇℃伅锛屼娇鐢ㄥ凡鏈夌敤鎴锋ā鏉� delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 copyActions: [], // 澶嶅埗鎸夐挳缁� - showColumnName: false, // 鏄剧ず鍒楀瓧娈靛悕鎺у埗 tabviews: [], // 鎵�鏈夋爣绛鹃〉 profileVisible: false, // 楠岃瘉淇℃伅妯℃�佹 optionLibs: null, // 鑷畾涔変笅鎷夐�夐」搴� thawButtons: [], // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳 activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 - sqlVerifing: false // sql楠岃瘉 + sqlVerifing: false, // sql楠岃瘉 + chartview: null, // 褰撳墠瑙嗗浘 + pasteContent: null // 绮樿创鍐呭 } /** @@ -142,7 +132,22 @@ let _activeKey = editSubTab ? editSubTab.activeKey : editTab.activeKey + // 鍏煎 + if (!_config.charts) { + _config.expand = false + _config.charts = [{ + uuid: Utils.getuuid(), + label: '', + title: '', + chartType: 'table', + icon: 'table', + Hide: 'false', + blacklist: [] + }] + } + this.setState({ + chartview: _config.charts[0].uuid, originActions: _oriActions, optionLibs: optionLibs, config: _config, @@ -184,148 +189,46 @@ * 2銆佹牴鎹厤缃俊鎭腑宸蹭娇鐢ㄨ〃鑾峰彇鐩稿叧瀛楁淇℃伅 */ componentDidMount () { - let param = { - func: 'sPC_Get_SelectedList', - LText: queryTableSql, - 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: 5 - }) - } - }) - - let deffers = this.state.selectedTables.map(item => { - return new Promise(resolve => { - Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => { - res.TBName = item.TbName - resolve(res) - }) - }) - }) - Promise.all(deffers).then(response => { - let _columns = [] - response.forEach(res => { - if (res.status) { - let tabmsg = { - tableName: res.TBName, - columns: res.FDName.map(item => { - let _type = item.FieldType.toLowerCase() - let _decimal = 0 - if (/^nvarchar/.test(_type)) { - _type = 'text' - } else if (/^int/.test(_type)) { - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - if (_decimal > 4) { - _decimal = 4 - } - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - if (_decimal > 4) { - _decimal = 4 - } - _type = 'number' - } else if (/^datetime/.test(_type)) { - _type = 'datetime' - } else if (/^date/.test(_type)) { - _type = 'date' - } else { - _type = 'text' - } - - return { - field: item.FieldName, - label: item.FieldDec, - type: _type, - datatype: _type, - decimal: _decimal - } - }) - } - _columns.push(tabmsg) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - - this.setState({ - tableColumns: _columns - }) - }) - - 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 - } - }) - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) + this.reloadTab(false) } /** * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� */ - reloadTab = () => { + reloadTab = (type) => { this.setState({ - loading: true, + 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: res.UserTemp.map(temp => { - return { - uuid: temp.MenuID, - value: temp.MenuID, - text: temp.MenuName, - type: temp.Template, - MenuNo: temp.MenuNo - } + tabviews: _tabviews + }) + + if (type) { + notification.success({ + top: 92, + message: '鍒锋柊鎴愬姛銆�', + duration: 2 }) - }) - notification.success({ - top: 92, - message: '鍒锋柊鎴愬姛銆�', - duration: 2 - }) + } } else { this.setState({ loading: false @@ -392,583 +295,6 @@ } /** - * @description 鍏冪礌娣诲姞鎴栨嫋鍔ㄦ椂椤哄簭鍙樺寲 - */ - handleList = (type, list, card) => { - const { config } = this.state - - if (list.length > config[type].length) { - list = list.filter(item => !item.origin) - - if (type === 'search') { - this.handleSearch(card) - } else if (type === 'action') { - this.handleAction(card) - } else if (type === 'columns') { - this.handleColumn(card) - } - } - - this.setState({config: {...config, [type]: list}}) - } - - /** - * @description 鎼滅储鏉′欢缂栬緫锛岃幏鍙栨悳绱㈡潯浠惰〃鍗曚俊鎭� - */ - handleSearch = (card) => { - this.setState({ - modaltype: 'search', - card: card, - formlist: getSearchForm(card, this.props.sysRoles) - }) - } - - /** - * @description 鎸夐挳缂栬緫锛岃幏鍙栨寜閽〃鍗曚俊鎭� - */ - handleAction = (card, type) => { - let ableField = this.props.permFuncField.join(', ') - let functip = <div> - <p style={{marginBottom: '5px'}}>{this.state.dict['header.modal.func.innerface'].replace('@ableField', ableField)}</p> - <p>{this.state.dict['header.modal.func.outface']}</p> - </div> - - this.setState({ - modaltype: type === 'copy' ? 'actionCopy' : 'actionEdit', - card: card, - formlist: getActionForm(card, functip, this.state.config, this.props.permFuncField) - }) - } - - /** - * @description 鏄剧ず鍒椾笌鍚堝苟鍒楃紪杈戯紝鑾峰彇琛ㄥ崟淇℃伅 - */ - handleColumn = (card) => { - const { menu } = this.props - - if (card.type !== 'colspan') { - let menulist = menu.fstMenuList.map(item => { - return { - value: item.MenuID, - label: item.text, - isLeaf: false - } - }) - - if ((card.type === 'text' || card.type === 'number') && card.linkmenu && card.linkmenu.length > 0) { - let _param = { - func: 'sPC_Get_FunMenu', - ParentID: card.linkmenu[0], - systemType: options.systemType, - debug: 'Y' - } - - this.setState({ - loading: true - }) - - Api.getSystemConfig(_param).then(result => { - if (result.status) { - menulist = menulist.map(item => { - if (item.value === card.linkmenu[0]) { - item.children = result.data.map(item => { - let submenu = { - value: item.ParentID, - label: item.MenuNameP, - children: item.FunMenu.map(cell => { - return { - value: cell.MenuID, - label: cell.MenuName, - MenuID: cell.MenuID, - MenuName: cell.MenuName, - MenuNo: cell.MenuNo, - Ot: cell.Ot, - PageParam: cell.PageParam, - LinkUrl: cell.LinkUrl, - disabled: cell.MenuID === menu.MenuID - } - }) - } - - return submenu - }) - } - return item - }) - } else { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - - this.setState({ - loading: false, - modaltype: 'columns', - card: card, - formlist: getColumnForm(card, this.props.sysRoles, menulist) - }) - }) - } else { - this.setState({ - modaltype: 'columns', - card: card, - formlist: getColumnForm(card, this.props.sysRoles, menulist) - }) - } - } else { - this.setState({ - modaltype: 'colspan', - card: card - }) - } - } - - /** - * @description 鎿嶄綔鍒楃紪杈� - */ - handleGridBtn = () => { - this.setState({ - modaltype: 'gridbtn' - }) - } - - /** - * @description 鎼滅储銆佹寜閽�佹樉绀哄垪淇敼鍚庢彁浜や繚瀛� - * 1銆佹悳绱㈡潯浠朵繚瀛橈紝褰撶被鍨嬩负涓嬫媺妗嗕笖瀛樺湪鏁版嵁婧愭椂锛屽皢鏌ヨ鏉′欢鎷兼帴涓簊ql锛屽苟鐢╞ase64杞爜 - * 2銆佹寜閽寘鎷甯哥紪杈戝拰澶嶅埗锛屽鍒舵椂,鎸夐挳鍒楁湯灏炬坊鍔� - * 3銆佹坊鍔犳垨缂栬緫鍒楋紝淇濆瓨鏃讹紝濡傛寜閽綅缃缃负琛ㄦ牸锛屽垯淇敼鎿嶄綔鍒楁樉绀虹姸鎬� - */ - handleSubmit = () => { - const { card, config, modaltype, optionLibs } = this.state - - if (modaltype === 'search') { - this.searchFormRef.handleConfirm().then(res => { - if ( // 鏇存柊涓嬫媺瀛楀吀 - (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && - res.resourceType === '0' && - res.options && res.options.length > 0 - ) { - optionLibs.set(config.uuid + res.uuid, { - uuid: config.uuid + res.uuid, - label: res.label, - parname: config.tabName, - type: 'search', - options: res.options - }) - } - - let fieldrepet = false // 瀛楁閲嶅 - let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 - - let _search = config.search.map(item => { - if (item.uuid !== res.uuid && res.field && item.field) { - if (item.field === res.field) { - fieldrepet = true - } else if (item.label === res.label) { - labelrepet = true - } - } - - if (item.uuid === res.uuid) { - return res - } else { - return item - } - }) - - if (fieldrepet) { - notification.warning({ - top: 92, - message: '瀛楁宸插瓨鍦紒', - duration: 5 - }) - return - } else if (labelrepet) { - notification.warning({ - top: 92, - message: '鍚嶇О宸插瓨鍦紒', - duration: 5 - }) - return - } - - _search = _search.filter(item => !item.origin) - - if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { - this.setState({ - sqlVerifing: true - }) - - let param = { - func: 's_debug_sql', - LText: res.dataSource - } - 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) - - if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi - } - - Api.getLocalConfig(param).then(result => { - if (result.status) { - this.setState({ - sqlVerifing: false, - config: {...config, search: _search}, - optionLibs: optionLibs, - modaltype: '' - }) - } else { - this.setState({sqlVerifing: false}) - - Modal.error({ - title: result.message - }) - } - }) - } else { - this.setState({ - config: {...config, search: _search}, - optionLibs: optionLibs, - modaltype: '' - }) - } - }) - } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') { - this.actionFormRef.handleConfirm().then(res => { - let _action = config.action.map(item => { - if (item.uuid === res.uuid) { - return res - } else { - return item - } - }) - _action = _action.filter(item => !item.origin) - - if (modaltype === 'actionCopy') { - _action.push(res) - } - - // 澶嶅埗鎸夐挳鍓嶅悗鐨嗕负琛ㄥ崟鏃讹紝澶嶅埗琛ㄥ崟閰嶇疆淇℃伅锛宨d瀛樹簬澶嶅埗鍒楄〃 - if (res.OpenType === 'pop' && card.originCard && card.originCard.OpenType === 'pop') { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: card.originCard.uuid - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' - - // 瑙f瀽閰嶇疆锛屼慨鏀规ā鎬佹鏍囬鍚嶇О - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - if (_LongParam && _LongParam.type === 'Modal') { - try { - _LongParam.setting.title = res.label - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam))) - } catch { - console.warn('Stringify Failure') - _LongParam = '' - } - } else { - _LongParam = '' - } - - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: config.uuid, - MenuID: res.uuid, - MenuNo: config.tabNo, - Template: 'Modal', - MenuName: res.label, - PageParam: JSON.stringify({Template: 'Modal'}), - LongParam: _LongParam - } - Api.getSystemConfig(param).then(response => { - if (!response.status) { - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } else { - this.setState({ - copyActions: [...this.state.copyActions, res.uuid] - }) - } - }) - } - }) - } - - // 鍒ゆ柇鏄惁瀛樺湪鎿嶄綔鍒� - let _hasGridbtn = _action.filter(act => act.position === 'grid').length > 0 - let _gridBtn = config.gridBtn - - if (_gridBtn) { - _gridBtn.display = _hasGridbtn - } else { - _gridBtn = { - display: _hasGridbtn, - Align: 'center', - IsSort: 'false', - uuid: Utils.getuuid(), - label: this.state.dict['header.form.column.action'], - type: 'action', - style: 'button', - show: 'horizontal', - Width: 120 - } - } - - this.setState({ - config: {...config, action: _action, gridBtn: _gridBtn}, - modaltype: '' - }) - }) - } else if (modaltype === 'columns' || modaltype === 'colspan') { - this.columnFormRef.handleConfirm().then(res => { - let fieldrepet = false // 瀛楁閲嶅 - let labelrepet = false // 鎻愮ず鏂囧瓧閲嶅 - - let _columns = config.columns.map(item => { - if (item.uuid !== res.uuid && res.field && item.field) { - if (item.field === res.field) { - fieldrepet = true - } else if (item.label === res.label) { - labelrepet = true - } - } - - if (item.uuid === res.uuid) { - return res - } else { - return item - } - }) - - if (fieldrepet) { - notification.warning({ - top: 92, - message: '瀛楁宸插瓨鍦紒', - duration: 5 - }) - return - } else if (labelrepet) { - notification.warning({ - top: 92, - message: '鍚嶇О宸插瓨鍦紒', - duration: 5 - }) - return - } - - _columns = _columns.filter(item => !item.origin) - - this.setState({ - config: {...config, columns: _columns}, - modaltype: '' - }) - }) - } else if (modaltype === 'gridbtn') { - this.gridBtnFormRef.handleConfirm().then(res => { - this.setState({ - config: {...config, gridBtn: res}, - modaltype: '' - }) - }) - } - } - - /** - * @description 鍙栨秷淇濆瓨锛屽鏋滃厓绱犱负鏂版坊鍏冪礌锛屽垯浠庡簭鍒椾腑鍒犻櫎 - */ - editModalCancel = () => { - const { config, card, modaltype } = this.state - - if (card.focus) { - let _config = null - if (modaltype === 'search') { - let _search = config.search.filter(item => item.uuid !== card.uuid) - _config = {...config, search: _search} - } else if (modaltype === 'actionEdit') { - let _action = config.action.filter(item => item.uuid !== card.uuid) - _config = {...config, action: _action} - } else if (modaltype === 'columns' || modaltype === 'colspan') { - let _columns = config.columns.filter(item => item.uuid !== card.uuid) - _config = {...config, columns: _columns} - } else { - _config = config - } - - this.setState({ - card: null, - config: _config, - modaltype: '' - }) - } else { - this.setState({ - card: null, - modaltype: '' - }) - } - } - - /** - * @description 鍒涘缓鎸夐挳瀛樺偍杩囩▼ - */ - creatFunc = () => { - let _config = JSON.parse(JSON.stringify(this.state.config)) - - this.actionFormRef.handleConfirm().then(res => { - let btn = res // 鎸夐挳淇℃伅 - let newLText = '' // 鍒涘缓瀛樺偍杩囩▼sql - let DelText = '' // 鍒犻櫎瀛樺偍杩囩▼sql - - // 鍒涘缓瀛樺偍杩囩▼锛屽繀椤诲~鍐欏唴閮ㄥ嚱鏁板悕 - if (!btn.innerFunc) { - notification.warning({ - top: 92, - message: '璇峰~鍐欏唴閮ㄥ嚱鏁帮紒', - duration: 5 - }) - return - } - - new Promise(resolve => { - // 寮圭獥锛堣〃鍗曪級绫绘寜閽紝鍏堣幏鍙栨寜閽厤缃俊鎭紝濡傛灉灏氭湭閰嶇疆鎸夐挳鍒欎細鎶ラ敊骞剁粓姝€�� - // 鑾峰彇淇℃伅鍚庣敓鎴愬垹闄ゅ拰鍒涘缓瀛樺偍杩囩▼鐨勮鍙� - if (btn.OpenType === 'pop') { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: btn.uuid - }).then(res => { - let _LongParam = '' - if (res.status && res.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam) { - let fields = [] - if (_LongParam.groups.length > 0) { - _LongParam.groups.forEach(group => { - fields = [...fields, ...group.sublist] - }) - } else { - fields = _LongParam.fields - } - - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: fields, - menuNo: _config.tabNo - } - newLText = Utils.formatOptions(Utils.getfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName}, _config)) - DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) - } else { - notification.warning({ - top: 92, - message: '寮圭獥锛堣〃鍗曪級鎸夐挳锛岃鍏堥厤缃〃鍗曚俊鎭紒', - duration: 5 - }) - resolve(false) - } - }) - } else if (btn.OpenType === 'excelIn') { - if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) { - let _param = { - funcName: btn.innerFunc, - menuNo: _config.tabNo - } - newLText = Utils.formatOptions(Utils.getexcelInfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName})) - DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) - } else { - notification.warning({ - top: 92, - message: '璇峰畬鍠勫鍏xcel楠岃瘉淇℃伅锛�', - duration: 5 - }) - resolve(false) - } - } else if (btn.OpenType === 'excelOut') { - let _param = { - innerFunc: btn.innerFunc - } - - newLText = Utils.formatOptions(Utils.getTableFunc(_param, {MenuID: _config.uuid, MenuName: _config.tabName, MenuNo: _config.tabNo}, _config)) // 鍒涘缓瀛樺偍杩囩▼sql - DelText = Utils.formatOptions(Utils.dropfunc(btn.innerFunc)) - - resolve(true) - } else { - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: '', - menuNo: _config.tabNo - } - newLText = Utils.formatOptions(Utils.getfunc(_param, btn, {MenuID: _config.uuid, MenuName: _config.tabName}, _config)) - DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName)) - resolve(true) - } - }).then(res => { - if (!res) return - - this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { - if (result !== 'success') return - - _config.action = _config.action.map(item => { - if (item.uuid === btn.uuid) { - return btn - } else { - return item - } - }) - _config.action = _config.action.filter(item => !item.origin) - - // 鍒ゆ柇鏄惁瀛樺湪鎿嶄綔鍒� - let _hasGridbtn = _config.action.filter(act => act.position === 'grid').length > 0 - - if (_config.gridBtn) { - _config.gridBtn.display = _hasGridbtn - } else { - _config.gridBtn = { - display: _hasGridbtn, - Align: 'center', - IsSort: 'false', - uuid: Utils.getuuid(), - label: this.state.dict['header.form.column.action'], - type: 'action', - style: 'button', - show: 'horizontal', - Width: 120 - } - } - - this.setState({ - config: _config, - }) - }) - }) - }) - } - - /** * @description 鍒涘缓琛ㄦ牸瀛樺偍杩囩▼ */ tableCreatFunc = () => { @@ -999,90 +325,6 @@ }) } - deleteElement = (element) => { - const { thawButtons } = this.state - - let _this = this - confirm({ - content: `纭畾鍒犻櫎<<${element.card.label}>>鍚楋紵`, - okText: this.state.dict['header.confirm'], - cancelText: this.state.dict['header.cancel'], - onOk() { - let _config = JSON.parse(JSON.stringify(_this.state.config)) - _config[element.type] = _config[element.type].filter(item => { - if (item.uuid === element.card.uuid) { - return false - } else { - return true - } - }) - - // 鍒犻櫎鎸夐挳鍏冪礌 - let _delActions = _this.state.delActions - if (element.type === 'action') { - _delActions.push(element) - } - - _this.setState({ - config: _config, - delActions: _delActions, - thawButtons: thawButtons.filter(key => key !== element.card.uuid) - }) - }, - onCancel() {} - }) - } - - /** - * @description 楠岃瘉淇℃伅閰嶇疆 - */ - profileAction = (element) => { - this.setState({ - profileVisible: true, - card: element - }) - } - - /** - * @description 鎸夐挳鍙屽嚮瑙﹀彂瀛愰厤缃� - */ - btnDoubleClick = (element) => { - if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) { - this.setSubConfig(element) - } else { - notification.warning({ - top: 92, - message: '姝ゆ寜閽棤瀛愰厤缃」锛�', - duration: 5 - }) - } - } - - /** - * @description 楠岃瘉淇℃伅淇濆瓨 - */ - verifySubmit = () => { - const { card } = this.state - let config = JSON.parse(JSON.stringify(this.state.config)) - - this.verifyRef.handleConfirm().then(res => { - - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '' - }) - }) - } - /** * @description 鏍囩椤典繚瀛� */ @@ -1102,17 +344,6 @@ if (config.columns[0] && config.columns[0].origin) { config.columns = config.columns.filter(item => !item.origin) } - } - - let btnNames = config.action.map(item => item.label) - btnNames = Array.from(new Set(btnNames)) - if (btnNames.length < config.action.length) { - notification.warning({ - top: 92, - message: '鎸夐挳鍚嶇О涓嶅彲鐩稿悓锛�', - duration: 5 - }) - return } let _LongParam = '' @@ -1563,7 +794,7 @@ if (originConfig.isAdd) { confirm({ content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - okText: this.state.dict['header.confirm'], + okText: this.state.dict['model.confirm'], cancelText: this.state.dict['header.cancel'], onOk() { _this.handleViewBack() @@ -1587,265 +818,6 @@ }) }) } - } - - queryField = (type) => { - const {selectedTables, tableColumns, config} = this.state - // 鍒ゆ柇鏄惁宸查�夋嫨琛ㄥ悕 - if (selectedTables.length === 0) { - notification.warning({ - top: 92, - message: '璇烽�夋嫨琛ㄥ悕锛�', - duration: 5 - }) - return - } - - // 琛ㄥ瓧娈甸泦杞负map鏁版嵁 - let columns = new Map() - tableColumns.forEach(table => { - table.columns.forEach(column => { - columns.set(column.field, column) - }) - }) - - if (type === 'search') { - // 娣诲姞鎼滅储鏉′欢锛屽瓧娈甸泦涓瓨鍦ㄦ悳绱㈡潯浠跺瓧娈碉紝浣跨敤鎼滅储鏉′欢瀵硅薄鏇挎崲瀛楁闆嗭紝璁剧疆鏁版嵁绫诲瀷 - config.search.forEach(item => { - if (columns.has(item.field)) { - let _datatype = columns.get(item.field).datatype - columns.set(item.field, {...item, selected: true, datatype: _datatype}) - } - }) - } else if (type === 'columns') { - // 娣诲姞鏄剧ず鍒楋紝瀛楁闆嗕腑瀛樺湪鏄剧ず鍒楀瓧娈碉紝浣跨敤鏄剧ず鍒楀璞℃浛鎹㈠瓧娈甸泦锛岃缃暟鎹被鍨� - config.columns.forEach(item => { - if (columns.has(item.field)) { - let _datatype = columns.get(item.field).datatype - columns.set(item.field, {...item, selected: true, datatype: _datatype}) - } - }) - } - - // 鏄剧ず瀛楁闆嗗脊绐� - this.setState({ - addType: type, - tableVisible: true, - fields: [...columns.values()] - }) - } - - addFieldSubmit = () => { - // 瀛楁闆嗕负绌猴紝鍏抽棴寮圭獥 - if (!this.state.fields || this.state.fields.length === 0) { - this.setState({ - tableVisible: false, - addType: '' - }) - } - - const {addType, config} = this.state - const textmatch = { // 閫夋嫨text鏃跺尮閰嶈鍒� - text: 'like', - number: 'like', - datetime: 'like', - date: 'like' - } - const selectmatch = { // 閫夋嫨select鏃跺尮閰嶈鍒� - text: '=', - number: '=', - datetime: '=', - date: '=' - } - const datematch = { // 閫夋嫨dateRange鏃跺尮閰嶈鍒� - text: 'between', - number: 'between', - datetime: 'between', - date: 'between' - } - - // 鑾峰彇宸查�夊瓧娈甸泦鍚� - let cards = this.refs.searchcard.state.selectCards - let columnsMap = new Map() - cards.forEach(card => { - columnsMap.set(card.field, card) - }) - - let items = [] - if (addType === 'search') { - config.search.forEach(item => { - if (columnsMap.has(item.field)) { - let cell = columnsMap.get(item.field) - - if (cell.selected && cell.type === item.type) { // 鏁版嵁鏈慨鏀� - items.push(item) - } else if (cell.selected) { // 鏁版嵁绫诲瀷淇敼 - if (cell.type === 'text') { - item.match = textmatch[cell.datatype] - } else if (cell.type === 'select') { - item.match = selectmatch[cell.datatype] - } else if (cell.type === 'daterange') { - item.match = datematch[cell.datatype] - } else { - cell.type = 'text' - item.match = textmatch[cell.datatype] - } - - item.type = cell.type - item.initval = '' - items.push(item) - } - columnsMap.delete(item.field) - } else if (!item.origin) { - items.push(item) - } - }) - - let _columns = [...columnsMap.values()] - - _columns.forEach(item => { - if (item.selected) { - let _match = '' - if (item.type === 'text') { - _match = textmatch[item.datatype] - } else if (item.type === 'select') { - _match = selectmatch[item.datatype] - } else if (item.type === 'daterange') { - _match = datematch[item.datatype] - } else { - item.type = 'text' - _match = textmatch[item.datatype] - } - - let newcard = { - uuid: Utils.getuuid(), - label: item.label, - field: item.field, - initval: '', - type: item.type, - resourceType: '0', - setAll: 'false', - options: [], - dataSource: '', - linkField: '', - valueField: '', - valueText: '', - orderBy: '', - orderType: 'asc', - match: _match, - display: 'dropdown' - } - - items.push(newcard) - } - }) - } else { - config.columns.forEach(item => { - if (columnsMap.has(item.field)) { - let cell = columnsMap.get(item.field) - - if (cell.selected) { - items.push(item) - } - columnsMap.delete(item.field) - } else if (!item.origin) { - items.push(item) - } - }) - - let _columns = [...columnsMap.values()] - - _columns.forEach(item => { - if (item.selected) { - let newcard = { - uuid: Utils.getuuid(), - Align: 'left', - label: item.label, - field: item.field, - Hide: 'false', - IsSort: item.type === 'picture' ? 'false' : 'true', - type: item.type, - Width: 120 - } - - items.push(newcard) - } - }) - } - - this.setState({ - config: {...config, [addType]: items} - }) - - notification.success({ - top: 92, - message: '鎿嶄綔鎴愬姛', - duration: 2 - }) - } - - onTableChange = (value) => { - const {tables, selectedTables, tableColumns} = this.state - - let _table = tables.filter(item => item.TbName === value)[0] - let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] - if (!isSelected) { - this.setState({ - selectedTables: [...selectedTables, _table] - }) - Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { - if (res.status) { - let tabmsg = { - tableName: _table.name, - columns: res.FDName.map(item => { - let _type = item.FieldType.toLowerCase() - let _decimal = 0 - if (/^nvarchar/.test(_type)) { - _type = 'text' - } else if (/^int/.test(_type)) { - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - _type = 'number' - } else if (/^datetime/.test(_type)) { - _type = 'datetime' - } else if (/^date/.test(_type)) { - _type = 'date' - } else { - _type = 'text' - } - - return { - field: item.FieldName, - label: item.FieldDec, - type: _type, - datatype: _type, - decimal: _decimal - } - }) - } - this.setState({ - tableColumns: [...tableColumns, tabmsg] - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - } - - deleteTable = (table) => { - const {selectedTables, tableColumns} = this.state - - this.setState({ - selectedTables: selectedTables.filter(item => item.TbName !== table.TbName), - tableColumns: tableColumns.filter(item => item.tableName !== table.TbName) - }) } changeSetting = () => { @@ -2049,6 +1021,9 @@ } } + /** + * @description 鍒囨崲鏍囩鏄惁鍚敤 + */ onEnabledChange = () => { const { config } = this.state @@ -2069,66 +1044,6 @@ config: {...config, enabled: !config.enabled} }) } - } - - onColumnNameChange = () => { - const { showColumnName, config } = this.state - - if (!showColumnName) { - let fields = [] - config.columns.forEach(col => { - if (col.field) { - fields.push(col.field) - } - }) - - fields = fields.join(',') - - let textArea = document.createElement('textarea') - textArea.value = fields - document.body.appendChild(textArea) - textArea.select() - - try { - document.execCommand('copy') - document.body.removeChild(textArea) - } catch (err) { - document.body.removeChild(textArea) - } - } - - this.setState({ - showColumnName: !showColumnName - }) - } - - /** - * @description 鍒涘缓鎸夐挳鎺ュ彛锛堝啓鍏ワ級 - */ - btnCreatInterface = () => { - const { config } = this.state - - this.menuformRef.handleConfirm().then(res => { - this.actionFormRef.handleConfirm().then(result => { - if (!['pop', 'exec', 'prompt'].includes(result) || result.funcType || result.intertype !== 'inner' || result.innerFunc ) { - notification.warning({ - top: 92, - message: '鎵撳紑鏂瑰紡涓� 寮圭獥锛堣〃鍗曪級銆佹彁绀烘鎴栫洿鎺ユ墽琛岋紝涓斾娇鐢ㄧ郴缁熷嚱鏁版椂锛屾墠鍙互鍒涘缓鎺ュ彛锛�', - duration: 5 - }) - return - } - - let _menu = { - type: 'subtable', - MenuID: config.uuid, - menuName: res.tabName, - menuNo: res.tabNo - } - - this.refs.btnCreatInterface.triggerInInterface(result, config, _menu) - }) - }) } /** @@ -2161,27 +1076,9 @@ }) } - copycolumn = () => { - const { config } = this.state - - let oInput = document.createElement('input') - let val = { - copyType: 'columns', - columns: config.columns - } - - oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val))) - document.body.appendChild(oInput) - oInput.select() - document.execCommand('Copy') - oInput.className = 'oInput' - oInput.style.display = 'none' - - message.success('澶嶅埗鎴愬姛銆�') - - document.body.removeChild(oInput) - } - + /** + * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽�佺矘璐淬�佹浛鎹㈢瓑 + */ updateConfig = (res) => { if (res.type === 'thaw') { this.setState({ @@ -2189,36 +1086,119 @@ config: res.config }) } else if (res.type === 'paste') { - if (res.copyType === 'action') { - this.handleAction(res.content, 'copy') - } else if (res.copyType === 'columns') { + this.setState({ + pasteContent: res.content + }, () => { this.setState({ - config: res.config + pasteContent: null }) - } + }) } } + /** + * @description 鍥捐〃閰嶇疆淇敼鍚庝繚瀛� + */ + updateChart = (plot) => { + const { config } = this.state + let _charts = JSON.parse(JSON.stringify(config.charts)) + + _charts = _charts.map(item => { + if (item.uuid === plot.uuid) { + if (!is(fromJS(item), fromJS(plot))) { + let _element = document.getElementById(plot.uuid) + if (_element) { + _element.innerHTML = '' + } + } + return plot + } + return item + }) + + this.setState({ + config: {...config, charts: _charts} + }) + } + + /** + * @description 鏇存柊鎼滅储鏉′欢閰嶇疆淇℃伅 + */ + updatesearch = (config, options) => { + const { optionLibs } = this.state + + this.setState({ + config: config, + optionLibs: options || optionLibs + }) + } + + /** + * @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 鏇存柊鏄剧ず鍒楅厤缃俊鎭� + */ + updatecolumn = (config) => { + this.setState({ + config: config + }) + } + + /** + * @description 鏇存柊鍥捐〃缁勯厤缃俊鎭� + */ + updatechartgroup = (config, _chartview) => { + this.setState({ + config: config, + chartview: _chartview + }) + } + + /** + * @description 鏇存柊甯哥敤琛ㄤ俊鎭紝蹇嵎娣诲姞鍚庢洿鏂伴厤缃俊鎭� + */ + updatetable = (config, fields) => { + const { tableFields } = this.state + + this.setState({ + config: config, + tableFields: fields ? fields : tableFields + }) + } + + /** + * @description 鎵归噺娣诲姞锛屾洿鏂伴厤缃俊鎭� + */ + updatefield = (config) => { + this.setState({ + config: config + }) + } + render () { - const { modaltype, activeKey, config } = this.state + const { activeKey, config, chartview } = this.state - const configAction = config.action.filter(_action => - !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab') - ) - - let hasbtncrtinter = false - if (modaltype === 'actionEdit' && config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.dataresource) { - hasbtncrtinter = true - } + const confActions = config.action.filter(_action => !_action.origin && ['pop', 'popview', 'blank', 'tab'].includes(_action.OpenType)) return ( - <div className="common-table-board"> + <div className="model-subtable-board"> <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} - <Panel forceRender={true} header={'鏍囩鍩烘湰淇℃伅'} key="0" id="common-basedata"> + <Panel forceRender={true} header={'鏍囩鍩烘湰淇℃伅'} key="0" id="subtable-basedata"> {/* 鑿滃崟淇℃伅 */} <MenuForm dict={this.state.dict} @@ -2226,42 +1206,12 @@ wrappedComponentRef={(inst) => this.menuformRef = inst} /> {/* 琛ㄥ悕娣诲姞 */} - <div className="ant-col ant-form-item-label"> - <label> - <Tooltip placement="topLeft" title="姝ゅ鍙互娣诲姞閰嶇疆鐩稿叧鐨勫父鐢ㄨ〃锛屽湪娣诲姞鎼滅储鏉′欢鍜屾樉绀哄垪鏃讹紝鍙�氳繃宸ュ叿鏍忎腑鐨勬坊鍔犳寜閽紝鎵归噺娣诲姞琛ㄦ牸鐩稿叧瀛楁銆�"> - <Icon type="question-circle" /> - {this.state.dict['header.menu.table.add']} - </Tooltip> - </label> - </div> - <Select - showSearch - className="tables" - style={{ width: '100%' }} - optionFilterProp="children" - value={this.state.dict['header.menu.table.placeholder']} - onChange={this.onTableChange} - showArrow={false} - getPopupContainer={() => document.getElementById('common-basedata')} - filterOption={(input, option) => { - return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 || - option.props.value.toLowerCase().indexOf(input.toLowerCase()) >= 0 - }} - > - {this.state.tables.map((table, index) => ( - <Option key={index} title={table.TbName} value={table.TbName}>{table.Remark}</Option> - ))} - </Select> - {this.state.selectedTables.length > 0 && <List - size="small" - bordered - dataSource={this.state.selectedTables} - renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}> - {item.Remark + ' (' + item.TbName + ')'} - <Icon type="close" onClick={() => this.deleteTable(item)}/> - <div className="bottom-mask"></div> - </List.Item>} - />} + <TableComponent + config={config} + containerId="subtable-basedata" + selectedTables={config.tables || []} + updatetable={this.updatetable} + /> </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} <Panel header={this.state.dict['header.menu.search']} key="1"> @@ -2270,7 +1220,12 @@ return (<SourceElement key={index} content={item}/>) })} </div> - <Button type="primary" block onClick={() => this.queryField('search')}>{this.state.dict['header.menu.search.add']}</Button> + <FieldsComponent + config={config} + type="search" + tableFields={this.state.tableFields} + updatefield={this.updatefield} + /> </Panel> {/* 鎸夐挳娣诲姞 */} <Panel header={this.state.dict['header.menu.action']} key="2"> @@ -2280,7 +1235,7 @@ })} </div> <div className="config-btn"> - {configAction.length > 0 ? + {confActions.length > 0 ? <p className="config-btn-title"> <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫寜閽厤缃俊鎭��"> <Icon type="question-circle" /> @@ -2289,7 +1244,7 @@ </p> : null } </div> - {configAction.map((item, index) => { + {confActions.map((item, index) => { return ( <div key={index}> <Button @@ -2309,7 +1264,12 @@ return (<SourceElement key={index} content={item}/>) })} </div> - <Button type="primary" block onClick={() => this.queryField('columns')}>{this.state.dict['header.menu.column.add']}</Button> + <FieldsComponent + config={config} + type="columns" + tableFields={this.state.tableFields} + updatefield={this.updatefield} + /> </Panel> </Collapse> </div> @@ -2317,7 +1277,7 @@ <Card title={ <div> 鏍囩锛堝瓙琛級椤甸潰閰嶇疆 - <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={this.reloadTab} /> + <Icon type="redo" style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={() => this.reloadTab(true)} /> </div> } bordered={false} extra={ <div> @@ -2328,245 +1288,68 @@ </div> } style={{ width: '100%' }}> <Icon type="setting" onClick={this.changeSetting} /> - <div className="search-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> - <Icon type="question-circle" /> - </Tooltip> - <DragElement - type="search" - list={this.state.config.search} - handleList={this.handleList} - handleMenu={this.handleSearch} - deleteMenu={this.deleteElement} - placeholder={this.state.dict['header.form.search.placeholder']} + <SearchComponent + menu={{MenuID: this.state.config.uuid, MenuName: this.state.config.tabName}} + config={this.state.config} + pasteContent={this.state.pasteContent} + sysRoles={this.props.sysRoles} + optionLibs={this.state.optionLibs} + updatesearch={this.updatesearch} + /> + <div className="chart-view" style={{position: 'relative'}}> + {/* 瑙嗗浘缁� */} + <ChartGroupComponent + config={config} + sysRoles={this.props.sysRoles} + updatechartgroup={this.updatechartgroup} /> - </div> - {/* <div className="action-list"> - <DragElement - type="action" - list={this.state.config.action} - setting={this.state.config.setting} - handleList={this.handleList} - handleMenu={this.handleAction} - copyElement={(val) => this.handleAction(val, 'copy')} - deleteMenu={this.deleteElement} - profileMenu={this.profileAction} - doubleClickCard={this.btnDoubleClick} - placeholder={this.state.dict['header.form.action.placeholder']} - /> - </div> */} - <div className="action-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> - <Icon type="question-circle" /> - </Tooltip> - <DragElement - type="action" - list={this.state.config.action} - setting={this.state.config.setting} - handleList={this.handleList} - handleMenu={this.handleAction} - copyElement={(val) => this.handleAction(val, 'copy')} - deleteMenu={this.deleteElement} - profileMenu={this.profileAction} - doubleClickCard={this.btnDoubleClick} - placeholder={this.state.dict['header.form.action.placeholder']} - /> - </div> - <div className="column-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�"> - <Icon type="question-circle" /> - </Tooltip> - {config.columns && config.columns.length > 0 ? <Icon className="column-copy" title="copy" type="copy" onClick={this.copycolumn} /> : null} - <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} /> - <DragElement - type="columns" - list={this.state.config.columns} - setting={this.state.config.setting} - gridBtn={this.state.config.gridBtn} - handleList={this.handleList} - handleMenu={this.handleColumn} - deleteMenu={this.deleteElement} - handleGridBtn={this.handleGridBtn} - showfield={this.state.showColumnName} - placeholder={this.state.dict['header.form.column.placeholder']} - /> + {config.charts.map(item => { + if (!config.expand && chartview !== item.uuid) return '' + + if (item.chartType === 'table') { + return ( + <Col span={item.width || 24} key={item.uuid}> + {config.charts.length > 1 ? <p className="chart-title">{item.title}</p> : null} + <ActionComponent + type="subtable" + menu={{MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo}} + config={config} + tabs={this.state.tabviews} + pasteContent={this.state.pasteContent} + usefulFields={this.props.permFuncField} + setSubConfig={this.setSubConfig} + updateaction={this.updateaction} + /> + <ColumnComponent + config={config} + menu={this.props.menu} + sysRoles={this.props.sysRoles} + pasteContent={this.state.pasteContent} + updatecolumn={this.updatecolumn} + /> + </Col> + ) + } else { + return ( + <Col span={item.width} key={item.uuid}> + <ChartComponent + type={item.chartType} + dict={this.state.dict} + columns={config.columns} + plotchange={this.updateChart} + plot={item} + /> + </Col> + ) + } + })} </div> </Card> </div> </DndProvider> - {/* 缂栬緫鎼滅储鏉′欢 */} - <Modal - title={this.state.dict['header.modal.search.edit']} - visible={modaltype === 'search'} - width={750} - maskClosable={false} - onOk={this.handleSubmit} - confirmLoading={this.state.sqlVerifing} - onCancel={this.editModalCancel} - destroyOnClose - > - <SearchForm - dict={this.state.dict} - card={this.state.card} - formlist={this.state.formlist} - inputSubmit={this.handleSubmit} - optionLibs={this.state.optionLibs} - wrappedComponentRef={(inst) => this.searchFormRef = inst} - /> - </Modal> - {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} - <Modal - title={modaltype === 'actionEdit' ? this.state.dict['header.modal.action.edit'] : this.state.dict['header.modal.action.copy']} - visible={modaltype === 'actionEdit' || modaltype === 'actionCopy'} - width={750} - maskClosable={false} - onCancel={this.editModalCancel} - footer={[ - hasbtncrtinter ? <CreateInterface key="interface" dict={this.state.dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null, - modaltype === 'actionEdit' ? <CreateFunc key="create" dict={this.state.dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null, - <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>, - <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button> - ]} - destroyOnClose - > - <ActionForm - dict={this.state.dict} - card={this.state.card} - tabs={this.state.tabviews} - formlist={this.state.formlist} - inputSubmit={this.handleSubmit} - setting={this.state.config.setting} - wrappedComponentRef={(inst) => this.actionFormRef = inst} - /> - </Modal> - {/* 鏄剧ず鍒楃紪杈� */} - <Modal - title={this.state.dict['header.modal.column.edit']} - visible={modaltype === 'columns'} - width={750} - maskClosable={false} - onOk={this.handleSubmit} - onCancel={this.editModalCancel} - destroyOnClose - > - <ColumnForm - dict={this.state.dict} - card={this.state.card} - MenuID={this.props.menu.MenuID} - inputSubmit={this.handleSubmit} - formlist={this.state.formlist} - wrappedComponentRef={(inst) => this.columnFormRef = inst} - /> - </Modal> - {/* 鍚堝苟鍒楃紪杈� */} - <Modal - title={this.state.dict['header.modal.colspan.edit']} - visible={modaltype === 'colspan'} - width={750} - maskClosable={false} - onOk={this.handleSubmit} - onCancel={this.editModalCancel} - destroyOnClose - > - <ColspanForm - dict={this.state.dict} - card={this.state.card} - inputSubmit={this.handleSubmit} - columns={this.state.config.columns} - wrappedComponentRef={(inst) => this.columnFormRef = inst} - /> - </Modal> - {/* 鎿嶄綔鍒楃紪杈� */} - <Modal - title={this.state.dict['header.modal.gridbtn.edit']} - visible={modaltype === 'gridbtn'} - width={700} - maskClosable={false} - onOk={this.handleSubmit} - onCancel={this.editModalCancel} - destroyOnClose - > - <GridBtnForm - dict={this.state.dict} - inputSubmit={this.handleSubmit} - card={this.state.config.gridBtn} - wrappedComponentRef={(inst) => this.gridBtnFormRef = inst} - /> - </Modal> - {/* 鏍规嵁瀛楁鍚嶆坊鍔犳樉绀哄垪鍙婃悳绱㈡潯浠� */} - <Modal - wrapClassName="common-table-fields-modal" - title={this.state.dict['header.edit']} - visible={this.state.tableVisible} - width={'65vw'} - maskClosable={false} - style={{minWidth: '900px', maxWidth: '1200px'}} - cancelText={this.state.dict['header.close']} - onOk={this.addFieldSubmit} - onCancel={() => { // 鍙栨秷娣诲姞 - this.setState({ - tableVisible: false, - addType: '' - }) - }} - destroyOnClose - > - {this.state.addType && this.state.fields.length > 0 ? - <EditCard data={this.state.fields} ref="searchcard" type={this.state.addType} dict={this.state.dict} /> : null - } - {(!this.state.fields || this.state.fields.length === 0) && - <Empty /> - } - </Modal> - {/* 鎸夐挳浣跨敤绯荤粺瀛樺偍杩囩▼鏃讹紝楠岃瘉淇℃伅妯℃�佹 */} - <Modal - wrapClassName="common-table-fields-modal" - title={'楠岃瘉淇℃伅'} - visible={this.state.profileVisible} - width={'75vw'} - maskClosable={false} - style={{minWidth: '900px', maxWidth: '1200px'}} - okText={this.state.dict['header.submit']} - onOk={this.verifySubmit} - onCancel={() => { this.setState({ profileVisible: false }) }} - destroyOnClose - > - {this.state.card && !this.state.card.execMode && this.state.card.OpenType !== 'excelIn' && this.state.card.OpenType !== 'excelOut' ? - <VerifyCard - floor="subtable" - card={this.state.card} - dict={this.state.dict} - columns={this.state.config.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - {this.state.card && this.state.card.execMode ? - <VerifyCardPrint - card={this.state.card} - dict={this.state.dict} - columns={config.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - {this.state.card && this.state.card.OpenType === 'excelIn' ? - <VerifyCardExcelIn - card={this.state.card} - dict={this.state.dict} - columns={this.state.config.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - {this.state.card && this.state.card.OpenType === 'excelOut' ? - <VerifyCardExcelOut - card={this.state.card} - dict={this.state.dict} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> : null - } - </Modal> {/* 璁剧疆鍏ㄥ眬閰嶇疆鍙婂垪琛ㄦ暟鎹簮 */} <Modal - title={this.state.dict['header.edit']} + title={this.state.dict['model.edit']} visible={this.state.settingVisible} width={750} maskClosable={false} @@ -2579,7 +1362,7 @@ <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>, - <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button> + <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['model.confirm']}</Button> ]} destroyOnClose > -- Gitblit v1.8.0