From 753ac5f57b10588e225c1d82203b13a81bc9c9a7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 03 十二月 2020 18:36:26 +0800 Subject: [PATCH] 2020-12-03 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 2 src/menu/components/card/table-card/index.jsx | 2 src/tabviews/verupmanage/subtabtable/index.jsx | 6 src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 6 src/tabviews/zshare/normalTable/index.jsx | 10 src/mob/mobshell/index.jsx | 2 src/tabviews/commontable/secretKeyTable/index.jsx | 6 src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 2 src/templates/formtabconfig/dragelement/index.jsx | 2 src/menu/components/tabs/tabcomponents/index.jsx | 2 src/templates/modalconfig/index.jsx | 2 src/tabviews/subtable/index.jsx | 8 src/tabviews/subtabtable/index.jsx | 6 src/tabviews/commontable/index.jsx | 19 src/tabviews/custom/components/table/normal-table/index.scss | 237 ++++++++++++++ src/tabviews/custom/components/card/data-card/index.jsx | 2 src/tabviews/custom/components/card/table-card/index.jsx | 6 src/tabviews/custom/components/card/prop-card/index.jsx | 2 src/tabviews/zshare/actionList/tabbutton/index.jsx | 2 src/tabviews/custom/components/share/tabtransfer/index.jsx | 2 src/tabviews/zshare/calendar/index.jsx | 2 src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx | 7 src/tabviews/custom/components/table/normal-table/index.jsx | 535 +++++++++++++++++++++++++++++++++ src/tabviews/custom/components/chart/antv-pie/index.jsx | 23 + src/tabviews/zshare/verifycard/index.jsx | 6 src/tabviews/custom/index.jsx | 21 + src/menu/modalconfig/index.jsx | 2 src/tabviews/scriptmanage/index.jsx | 6 src/templates/sharecomponent/actioncomponent/dragaction/index.jsx | 2 src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx | 4 src/menu/components/card/prop-card/index.jsx | 2 src/menu/components/table/normal-table/index.jsx | 2 src/templates/modalconfig/groupform/index.jsx | 2 src/menu/components/table/normal-table/columns/index.jsx | 8 src/tabviews/verupmanage/index.jsx | 6 src/menu/menushell/index.jsx | 2 src/templates/zshare/modalform/modaleditable/index.jsx | 2 37 files changed, 884 insertions(+), 74 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index e71af59..60fbd7a 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -76,7 +76,7 @@ _imagestyle = {backgroundImage: `url('${card.url}')`} } else { let index = card.uuid.match(/\d{1}/g) - index = index[index.length - 1] % 5 + index = index.slice(-1)[0] % 5 let demos = [demo1, demo2, demo3, demo4, demo5] _imagestyle = {backgroundImage: `url('${demos[index]}')`} diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index 9288996..9bfb2f5 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -202,7 +202,7 @@ } if (card.subcards.length > 0) { - newcard = fromJS(card.subcards[card.subcards.length - 1]).toJS() + newcard = fromJS(card.subcards.slice(-1)[0]).toJS() newcard.uuid = Utils.getuuid() newcard.elements = newcard.elements.map(elem => { elem.uuid = Utils.getuuid() diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index cc606ed..3cd989b 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -207,7 +207,7 @@ } if (card.subcards.length > 0) { - newcard = fromJS(card.subcards[card.subcards.length - 1]).toJS() + newcard = fromJS(card.subcards.slice(-1)[0]).toJS() newcard.uuid = Utils.getuuid() newcard.elements = newcard.elements.map(elem => { elem.uuid = Utils.getuuid() diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index 70b2e48..20b75e5 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -182,8 +182,10 @@ if (!is(fromJS(this.state.columns), fromJS(nextProps.config.cols))) { let _columns = fromJS(nextProps.config.cols).toJS() this.setState({columns: _columns}) - if (_columns[_columns.length - 1] && _columns[_columns.length - 1].focus) { - this.editColumn(_columns[_columns.length - 1]) + + let lastcol = _columns.slice(-1)[0] + if (lastcol && lastcol.focus) { + this.editColumn(lastcol) } } else if (!is(fromJS(this.state.fields), fromJS(nextProps.config.columns))) { this.setState({fields: fromJS(nextProps.config.columns).toJS()}) @@ -395,7 +397,7 @@ <DndProvider> <Table rowKey="uuid" - bordered={config.wrap.border !== 'false'} + bordered={config.wrap.bordered !== 'false'} components={components} dataSource={this.state.data} rowSelection={config.wrap.tableType ? { type: 'radio' } : null} diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index d3831f8..d460388 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -63,7 +63,7 @@ name: card.name, subtype: card.subtype, setting: { interType: 'system' }, - wrap: { name: card.name, width: 24, border: 'true', tableType: 'checkbox' }, + wrap: { name: card.name, width: 24, bordered: 'true', tableType: 'checkbox' }, style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, columns: [], cols: [ diff --git a/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx b/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx index 3ed64be..801edc3 100644 --- a/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx +++ b/src/menu/components/table/normal-table/wrapsetting/settingform/index.jsx @@ -124,8 +124,8 @@ </Col> <Col span={12}> <Form.Item label="杈规"> - {getFieldDecorator('border', { - initialValue: wrap.border || 'true' + {getFieldDecorator('bordered', { + initialValue: wrap.bordered || 'true' })( <Radio.Group style={{whiteSpace: 'nowrap'}}> <Radio key="true" value={'true'}> 鏈� </Radio> diff --git a/src/menu/components/tabs/tabcomponents/index.jsx b/src/menu/components/tabs/tabcomponents/index.jsx index 7fc0e47..a67e744 100644 --- a/src/menu/components/tabs/tabcomponents/index.jsx +++ b/src/menu/components/tabs/tabcomponents/index.jsx @@ -130,7 +130,7 @@ targetId = item.dropTargetId delete item.dropTargetId } else if (cards.length > 0) { - targetId = cards[cards.length - 1].uuid + targetId = cards.slice(-1)[0].uuid } const { index: overIndex } = findCard(`${targetId}`) diff --git a/src/menu/menushell/index.jsx b/src/menu/menushell/index.jsx index 382b732..afd6277 100644 --- a/src/menu/menushell/index.jsx +++ b/src/menu/menushell/index.jsx @@ -120,7 +120,7 @@ targetId = item.dropTargetId delete item.dropTargetId } else if (cards.length > 0) { - targetId = cards[cards.length - 1].uuid + targetId = cards.slice(-1)[0].uuid } const { index: overIndex } = findCard(`${targetId}`) diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 93ca009..c27c42e 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -510,7 +510,7 @@ required: 'true' } }) - _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems] + _config.groups[_config.groups.length - 1].sublist = [..._config.groups.slice(-1)[0].sublist, ..._additems] } else { let items = [] diff --git a/src/mob/mobshell/index.jsx b/src/mob/mobshell/index.jsx index d803eb8..2dd4b00 100644 --- a/src/mob/mobshell/index.jsx +++ b/src/mob/mobshell/index.jsx @@ -56,7 +56,7 @@ targetId = item.dropTargetId delete item.dropTargetId } else if (cards.length > 0) { - targetId = cards[cards.length - 1].uuid + targetId = cards.slice(-1)[0].uuid } const { index: overIndex } = findCard(`${targetId}`) // cards涓虹┖鏃� overIndex 涓� -1 diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index d5e7747..8d087d5 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -319,7 +319,7 @@ if (_hideCol.includes(col.uuid)) return if (col.linkmenu && col.linkmenu.length > 0) { - let menu_id = col.linkmenu[col.linkmenu.length - 1] + let menu_id = col.linkmenu.slice(-1)[0] col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' } else { col.linkThdMenu = '' @@ -329,13 +329,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = fromJS(col).toJS() - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) @@ -465,13 +465,10 @@ _ActiveTabId = _tab.uuid }) - this.setState({ - tabActive: {...this.state.tabActive, [_groupId]: _ActiveTabId} - }, () => { + if (_ActiveTabId && this.state.tabActive[_groupId] === _ActiveTabId) { MKEmitter.emit('triggerBtnId', triggerId) - }) - - return true + return true + } } return false }) @@ -1056,7 +1053,7 @@ </Row> : null } {setting && setting.onload !== 'false' && config.tabgroups.map(group => ( - <Tabs activeKey={tabActive[group.uuid]} key={group.uuid} onChange={(key) => this.setState({tabActive: {...tabActive, [group.uuid]: key}})}> + <Tabs key={group.uuid} onChange={(key) => this.setState({tabActive: {...tabActive, [group.uuid]: key}})}> {group.sublist.map(_tab => { return ( <TabPane tab={ diff --git a/src/tabviews/commontable/secretKeyTable/index.jsx b/src/tabviews/commontable/secretKeyTable/index.jsx index 982cd31..1f5aa55 100644 --- a/src/tabviews/commontable/secretKeyTable/index.jsx +++ b/src/tabviews/commontable/secretKeyTable/index.jsx @@ -94,13 +94,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 81112d1..a3c9629 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -174,7 +174,7 @@ if (type === 'refresh' && position === 'grid') { this.loadData() if (btn && btn.syncComponent && btn.syncComponent[0]) { - let syncId = btn.syncComponent[btn.syncComponent.length - 1] + let syncId = btn.syncComponent.slice(-1)[0] if (config.uuid !== syncId) { MKEmitter.emit('syncRefreshComponentId', syncId) } diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 54c3194..1a31450 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -189,7 +189,7 @@ if (type === 'refresh' && position === 'grid') { this.loadData() if (btn && btn.syncComponent && btn.syncComponent[0]) { - let syncId = btn.syncComponent[btn.syncComponent.length - 1] + let syncId = btn.syncComponent.slice(-1)[0] if (config.uuid !== syncId) { MKEmitter.emit('syncRefreshComponentId', syncId) } diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 63a2e77..6459618 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -33,6 +33,10 @@ showHeader: false // 瀛樺湪鏍囬銆佹悳绱� } + /** + * @description 鍒濆鍖栧鐞� + * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 + */ UNSAFE_componentWillMount () { const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() @@ -188,7 +192,7 @@ if (type === 'refresh' && position === 'grid') { this.loadData() if (btn && btn.syncComponent && btn.syncComponent[0]) { - let syncId = btn.syncComponent[btn.syncComponent.length - 1] + let syncId = btn.syncComponent.slice(-1)[0] if (config.uuid !== syncId) { MKEmitter.emit('syncRefreshComponentId', syncId) } diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 23f1f6a..dfce38e 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -1160,7 +1160,7 @@ } if (plot.linkmenu && plot.linkmenu.length > 0) { - let menu_id = plot.linkmenu[plot.linkmenu.length - 1] + let menu_id = plot.linkmenu.slice(-1)[0] let menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' chart.on('element:dblclick', (ev) => { diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index dd7fa3f..0e4995f 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -25,6 +25,7 @@ } state = { + BID: '', // 涓婄骇ID config: null, // 鍥捐〃閰嶇疆淇℃伅 empty: true, // 鍥捐〃鏁版嵁涓虹┖ loading: false, // 鏁版嵁鍔犺浇鐘舵�� @@ -38,7 +39,7 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata } = this.props + const { config, data, initdata, BID } = this.props let _config = fromJS(config).toJS() let _data = null @@ -66,9 +67,16 @@ _config.style = {minHeight: (config.plot.height || 400)} } + let _BID = BID || '' + if (config.setting.supModule && config.setting.supModule[0] !== 'empty') { + _BID = '' + } + sessionStorage.setItem(config.uuid, 'bid') + this.setState({ config: _config, data: _data, + BID: _BID, arr_field: _config.columns.map(col => col.field).join(','), plot: _config.plot, sync: _sync, @@ -85,10 +93,11 @@ } /** - * @description 鏍¢獙鍥捐〃鐨勬寜閽粍锛屽鏋滀负缁熻鍥捐〃锛岃绠楀浘琛ㄥ瓧娈� + * @description 缁勪欢閿�姣� */ - componentDidMount () { - + componentWillUnmount () { + const { config } = this.state + sessionStorage.removeItem(config.uuid) } /** @@ -128,8 +137,8 @@ } async loadData () { - const { mainSearch, BID, menuType, dataManager } = this.props - const { config, arr_field, search } = this.state + const { mainSearch, menuType, dataManager } = this.props + const { config, arr_field, search, BID } = this.state let searches = fromJS(search).toJS() if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 @@ -476,7 +485,7 @@ } if (plot.linkmenu && plot.linkmenu.length > 0) { - let menu_id = plot.linkmenu[plot.linkmenu.length - 1] + let menu_id = plot.linkmenu.slice(-1)[0] let menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' chart.on('element:dblclick', (ev) => { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index fd9c277..0938b83 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -271,7 +271,7 @@ } else if (item.type === 'search') { return ( <Col span={item.width} key={item.uuid}> - <MainSearch config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> + <MainSearch config={item} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> </Col> ) } else if (item.type === 'tabs') { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx new file mode 100644 index 0000000..28544c6 --- /dev/null +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -0,0 +1,535 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import {connect} from 'react-redux' +import { is, fromJS } from 'immutable' +import { notification, Switch } from 'antd' + +import Api from '@/api' +import Utils from '@/utils/utils.js' +import zhCN from '@/locales/zh-CN/main.js' +import enUS from '@/locales/en-US/main.js' +import UtilsDM from '@/utils/utils-datamanage.js' +import asyncSpinComponent from '@/utils/asyncSpinComponent' +import MKEmitter from '@/utils/events.js' + +import MainSearch from '@/tabviews/zshare/topSearch' +import './index.scss' + +// 閫氱敤缁勪欢 +const MainAction = asyncSpinComponent(() => import('@/tabviews/zshare/actionList')) +const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) + +class NormalTable extends Component { + static propTpyes = { + param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鎼滅储鏉′欢绛夊弬鏁� + MenuID: PropTypes.string, // 鑿滃崟Id + MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 + MenuName: PropTypes.string // 鑿滃崟鍚嶇О + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + BID: null, // 椤甸潰璺宠浆鏃舵惡甯D + config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 + searchlist: null, // 鎼滅储鏉′欢 + actions: null, // 鎸夐挳闆� + columns: null, // 鏄剧ず鍒� + logcolumns: null, // 鏃ュ織涓樉绀虹殑鍒椾俊鎭� (澧炲姞鑷冲叏閮ㄥ垪锛岄櫎鍘诲悎骞跺垪) + arr_field: '', // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆� + setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 + data: null, // 鍒楄〃鏁版嵁闆� + selectedData: [], // 宸查�夎〃鏍兼暟鎹� + total: 0, // 鎬绘暟 + loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� + pageIndex: 1, // 椤电爜 + pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 + orderBy: '', // 鎺掑簭 + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + BIDs: {}, // 涓婄骇琛╥d + pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + statFields: [], // 鍚堣瀛楁 + statFValue: [] // 鍚堣鍊� + } + + /** + * @description 鍒濆鍖栧鐞� + * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 + */ + UNSAFE_componentWillMount () { + const { data, initdata } = this.props + let _config = fromJS(this.props.config).toJS() + let _cols = new Map() + + let _data = null + let _sync = _config.setting.sync === 'true' + + if (_config.setting.sync === 'true' && data) { + _data = data[_config.dataName] || [] + _sync = false + } else if (_config.setting.sync === 'true' && initdata) { + _data = initdata || [] + _sync = false + } + + _config.columns.forEach(item => { + _cols.set(item.field, item) + }) + + _config.cols.forEach(column => { + if (column.type === 'custom') { + column.elements = column.elements.map(item => { + if (item.field && _cols.has(item.field)) { + item.col = _cols.get(item.field) + } + return item + }) + } else if (column.type === 'colspan') { + column.unfold = 'true' + } else if (column.type === 'action') { + column.operations = column.elements + } + }) + + this.setState({ + title: _config.wrap.title, + sync: _sync, + data: _data, + config: _config, + setting: {..._config.setting, ..._config.wrap}, + searchlist: _config.search, + actions: _config.action, + columns: _config.cols, + arr_field: _config.columns.map(col => col.field).join(','), + search: Utils.initMainSearch(_config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 + }, () => { + if (_config.setting.sync !== 'true' && _config.setting.onload === 'true') { + this.loadmaindata() + this.getStatFieldsValue() + } + }) + } + + /** + * @description 涓昏〃鏁版嵁鍔犺浇 + */ + async loadmaindata () { + const { setting, arr_field, BIDs, search, orderBy, BID, pageIndex, pageSize } = this.state + let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) + + this.setState({ + selectedData: [], + BIDs: { + ...BIDs, + mainTable: '', + mainTabledata: '' + } + }) + + if (requireFields.length > 0) { + let labels = requireFields.map(item => item.label) + labels = Array.from(new Set(labels)) + + notification.warning({ + top: 92, + message: this.state.dict['form.required.input'] + labels.join('銆�') + ' !', + duration: 3 + }) + return + } + + this.setState({ + loading: true + }) + + let _orderBy = orderBy || setting.order + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) + + if (param.func === 'sPC_Get_TableData') { + param.menuname = this.props.MenuName || '' + } + + let result = await Api.genericInterface(param) + if (result.status) { + this.setState({ + data: result.data.map((item, index) => { + item.key = index + return item + }), + total: result.total, + loading: false, + pickup: false + }) + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + /** + * @description 鑾峰彇鍗曡鏁版嵁 + */ + async loadmainLinedata (id) { + const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize } = this.state + + this.setState({ + loading: true + }) + + let _orderBy = orderBy || setting.order + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id) + + if (param.func === 'sPC_Get_TableData') { + param.menuname = this.props.MenuName || '' + } + + let result = await Api.genericInterface(param) + if (result.status) { + let data = fromJS(this.state.data).toJS() + if (result.data && result.data[0]) { + let _data = result.data[0] + + try { + data = data.map(item => { + if (item[setting.primaryKey] === _data[setting.primaryKey]) { + _data.key = item.key + return _data + } else { + return item + } + }) + } catch { + console.warn('鏁版嵁鏌ヨ閿欒') + } + } + + this.setState({ + data: data, + loading: false + }) + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + /** + * @description 鑾峰彇鍚堣瀛楁鍊� + */ + getStatFieldsValue = () => { + const { setting, search, BID, orderBy, statFields } = this.state + + if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return + + let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) + if (requireFields.length > 0) { + return + } + + let _orderBy = orderBy || setting.order + let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType, this.props.dataManager) + + if (param.func === 'sPC_Get_TableData') { + param.menuname = this.props.MenuName || '' + } + + Api.genericInterface(param).then(res => { + if (res.status) { + let _data = res.data[0] + let values = [] + + if (_data) { + statFields.forEach(item => { + if (_data[item.field] || _data[item.field] === 0) { + let val = +_data[item.field] + if (isNaN(val)) { + val = 0 + } + val = val.toFixed(item.decimal) + values.push({label: item.label, value: val}) + } + }) + } + this.setState({ + statFValue: values + }) + } else { + this.setState({ + statFValue: [] + }) + notification.error({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + } + + /** + * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 + * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� + */ + refreshbysearch = (searches) => { + const { setting } = this.state + + if (setting.onload === 'false') { + this.setState({ + pageIndex: 1, + search: searches, + setting: {...setting, onload: 'true'} + }, () => { + this.loadmaindata() + this.getStatFieldsValue() + }) + } else { + MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆 + this.setState({ + pageIndex: 1, + search: searches + }, () => { + this.loadmaindata() + this.getStatFieldsValue() + }) + } + } + + /** + * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 + */ + refreshbytable = (pagination, filters, sorter) => { + if (sorter.order) { + let _chg = { + ascend: 'asc', + descend: 'desc' + } + sorter.order = _chg[sorter.order] + } + + this.setState({ + pageIndex: pagination.current, + pageSize: pagination.pageSize, + orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' + }, () => { + this.loadmaindata() + }) + } + + /** + * @description 琛ㄦ牸鍒锋柊 + */ + reloadtable = (btn) => { + if (!btn || btn.resetPageIndex !== 'false') { + MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable') // 鍒楄〃閲嶇疆 + this.setState({ + pageIndex: 1 + }, () => { + this.loadmaindata() + this.getStatFieldsValue() + }) + } else { + MKEmitter.emit('resetTable', this.props.MenuID + 'mainTable', 'false') // 鍒楄〃閲嶇疆 + this.loadmaindata() + this.getStatFieldsValue() + } + } + + /** + * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� + */ + refreshbyaction = (position, btn) => { + if (position === 'grid' || position === 'view') { + this.reloadtable(btn) + } + } + + /** + * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� + */ + getexceloutparam = () => { + const { MenuName } = this.props + const { arr_field, orderBy, search, setting} = this.state + + return { + arr_field: arr_field, + orderBy: orderBy || setting.order, + search: search, + menuName: MenuName + } + } + + /** + * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� + */ + changeSelectedData = (selectedData) => { + this.setState({selectedData}) + } + + /** + * @description 琛ㄦ牸Id鍙樺寲 + */ + handleTableId = (type, id, data) => { + const { BIDs } = this.state + + this.setState({ + BIDs: { + ...BIDs, + [type]: id, + [type + 'data']: data + } + }) + } + + /** + * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 + */ + pickupChange = () => { + const { pickup } = this.state + this.setState({ + pickup: !pickup + }) + } + + reloadData = (menuId, id, btn) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + if (id === 'empty') return + + if (id === 'formtab') { // 琛ㄥ崟鏍囩椤靛埛鏂� + this.reloadtable(btn) + return + } + + if (!id) { + this.reloadtable() + } else { + this.loadmainLinedata(id) + } + } + + UNSAFE_componentWillReceiveProps(nextProps) { + const { sync, config } = this.state + + if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { + let _data = [] + if (nextProps.data && nextProps.data[config.dataName]) { + _data = nextProps.data[config.dataName] || [] + } + + this.setState({sync: false, data: _data}) + } else if (!is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { + if (config.setting.syncRefresh === 'true') { + this.setState({}, () => { + this.reloadtable() + }) + } + } + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + MKEmitter.addListener('reloadData', this.reloadData) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('reloadData', this.reloadData) + } + + render() { + const { MenuName } = this.props + const { BID, setting, searchlist, pageSize, actions, columns, pickup, config, selectedData } = this.state + + return ( + <div className="commontable"> + {searchlist && searchlist.length > 0 ? + <MainSearch + BID={BID} + dict={this.state.dict} + searchlist={searchlist} + menuType={this.props.menuType} + dataManager={this.props.dataManager} + refreshdata={this.refreshbysearch} + /> : null + } + <div className="commontable-main-action"> + <MainAction + BID={BID} + setting={setting} + actions={actions} + MenuName={MenuName} + dict={this.state.dict} + MenuID={this.props.MenuID} + selectedData={selectedData} + logcolumns={this.state.logcolumns} + refreshdata={this.refreshbyaction} + getexceloutparam={this.getexceloutparam} + /> + </div> + <div className="main-table-box"> + {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? + <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null + } + <MainTable + tableId="mainTable" + BID={BID} + pickup={pickup} + config={config} + setting={setting} + columns={columns} + MenuName={MenuName} + pageSize={pageSize} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + MenuID={this.props.MenuID} + loading={this.state.loading} + refreshdata={this.refreshbytable} + logcolumns={this.state.logcolumns} + statFValue={this.state.statFValue} + handleTableId={this.handleTableId} + refreshbyaction={this.refreshbyaction} + chgSelectData={this.changeSelectedData} + /> + </div> + </div> + ) + } +} + +const mapStateToProps = (state) => { + return { + menuType: state.editLevel, + tabviews: state.tabviews, + permAction: state.permAction, + permMenus: state.permMenus, + permRoles: state.permRoles, + dataManager: state.dataManager + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file diff --git a/src/tabviews/custom/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss new file mode 100644 index 0000000..3d3f54b --- /dev/null +++ b/src/tabviews/custom/components/table/normal-table/index.scss @@ -0,0 +1,237 @@ +.commontable { + position: relative; + min-height: calc(100vh - 94px); + padding-top: 16px; + padding-bottom: 80px; + .box404 { + padding-top: 30px; + } + .commontable-main-action { + min-height: 25px; + .button-list { + padding-right: 110px; + } + } + .ant-modal-mask { + position: absolute; + } + .ant-modal-wrap { + position: absolute; + } + .action-modal .ant-modal { + top: 40px; + max-width: 95%; + .ant-modal-body { + max-height: calc(100vh - 265px); + } + } + > .ant-spin { + position: absolute; + z-index: 10; + left: calc(50% - 22px); + top: calc(50vh - 70px); + } + > .ant-card { + margin: 0 20px 20px; + > .ant-card-head { + border: 0; + padding: 0; + min-height: 30px; + .ant-card-head-title { + padding: 10px 0 0; + span { + color: #1890ff; + display: inline-block; + padding: 0 10px; + font-size: 15px; + border-bottom: 1px solid #1890ff; + i { + margin-right: 10px; + } + } + } + } + > .ant-card-body { + padding: 0; + } + } + .main-table-box { + position: relative; + .main-pickup { + position: absolute; + right: 35px; + top: -22px; + z-index: 1; + } + .custom-control { + position: absolute; + z-index: 1; + right: 0px; + top: -23px; + font-size: 18px; + padding: 3px; + cursor: pointer; + } + >.async-spin { + line-height: 150px!important; + } + } + > .ant-tabs { + width: 100%; + padding: 0px 20px; + margin-bottom: 20px; + .ant-tabs-tab:not(.ant-tabs-tab-active) { + cursor: pointer; + } + .ant-tabs-tab.ant-tabs-tab-active { + cursor: default; + } + } + .common-table-copy { + position: fixed; + z-index: 2; + bottom: 65px; + right: 30px; + width: 40px; + height: 40px; + } + .ant-table-fixed-left, .ant-table-fixed-right { + z-index: 1; + } + > .chart-view { + position: relative; + padding: 0 20px; + >.ant-tabs { + .ant-tabs-bar { + position: relative; + z-index: 1; + margin: 0; + border: 0; + .ant-tabs-nav-scroll { + text-align: right; + padding-right: 20px; + .ant-tabs-ink-bar { + display: none!important; + } + .ant-tabs-tab { + padding: 6px 5px; + margin-right: 5px; + } + } + } + } + >.ant-col { + min-height: 100px; + } + >.card-view.ant-col-24 { + padding: 0!important; + .card-row-box { + padding: 0; + } + } + .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: 0px; + padding: 5px 10px; + float: left; + max-width: 50%; + } + .chart-table.chart-title { + position: absolute; + top: 0px; + } + .canvas { + clear: both; + } + } +} + +.menu-tree-modal { + .ant-modal-body { + min-height: 300px; + .menu-header { + text-align: center; + span { + font-weight: 600; + margin-right: 20px; + } + .ant-typography { + font-weight: 600; + display: inline-block; + } + } + .ant-tree li .ant-tree-node-content-wrapper { + cursor: default; + } + } +} + +.commontable.bg-gray { + background: #f0f2f5; + >.top-search { + background: #ffffff; + padding: 10px 10px; + margin: 0 20px; + } + .chart-view { + margin-bottom: 20px; + .ant-col:last-child { + .line-chart-plot-box { + margin-bottom: 0px; + } + .card-row-box { + margin-bottom: 0px; + } + .normal-data-table { + margin-bottom: 0px; + } + } + >.ant-col { + min-height: 50px; + } + } + .line-chart-plot-box { + background: #ffffff; + padding: 10px; + margin-bottom: 20px; + } + .card-row-box { + min-height: 130px; + background: #ffffff; + padding-bottom: 10px; + margin-bottom: 20px; + } + .commontable-main-action { + padding: 0 10px; + background: #ffffff; + } + .normal-data-table { + padding: 0 10px 10px; + margin-bottom: 20px; + background: #ffffff; + } + .main-pickup { + right: 45px; + } + .custom-control { + right: 10px; + } + > .ant-tabs { + margin: 0px 20px 20px; + padding: 0px; + width: calc(100% - 40px); + background: #ffffff; + .top-search { + padding: 0 10px 10px; + } + .button-list.toolbar-button { + padding: 15px 10px 5px; + } + } +} \ No newline at end of file diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index d8ef472..ec047e3 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -20,13 +20,15 @@ } state = { - tabs: null + tabs: null, + parentIds: [] } UNSAFE_componentWillMount () { const { config } = this.props this.setState({ - tabs: config + tabs: config, + parentIds: config.parentIds || [] }) } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index e9ac035..54586f4 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -24,6 +24,7 @@ const PropCard = asyncComponent(() => import('./components/card/prop-card')) const TableCard = asyncComponent(() => import('./components/card/table-card')) const MainSearch = asyncComponent(() => import('./components/search/main-search')) +const NormalTable = asyncComponent(() => import('./components/table/normal-table')) class CustomPage extends Component { static propTpyes = { @@ -203,6 +204,18 @@ tab.components = this.filterComponent(tab.components) return tab }) + + let supIds = [] + item.subtabs.forEach(tab => { + tab.components.forEach(comp => { + if (comp.type === 'tabs' && comp.parentIds) { + supIds.push(...comp.parentIds) + } else if (comp.setting.supModule && comp.setting.supModule[0] !== 'empty') { + supIds.push(...comp.setting.supModule.slice(-1)) + } + }) + }) + item.parentIds = supIds } else if (item.type === 'pie' || item.type === 'bar' || item.type === 'line') { if (item.plot.blacklist && item.plot.blacklist.length > 0) { let _black = item.plot.blacklist.filter(v => { @@ -542,7 +555,7 @@ } else if (item.type === 'tabs') { return ( <Col span={item.width} key={item.uuid}> - <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> + <AntvTabs config={item} mainSearch={mainSearch} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { @@ -563,6 +576,12 @@ <TableCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> </Col> ) + } else if (item.type === 'table' && item.subtype === 'normaltable') { + return ( + <Col span={item.width} key={item.uuid}> + <NormalTable config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + </Col> + ) } else { return null } diff --git a/src/tabviews/scriptmanage/index.jsx b/src/tabviews/scriptmanage/index.jsx index 83b17f8..f9e24df 100644 --- a/src/tabviews/scriptmanage/index.jsx +++ b/src/tabviews/scriptmanage/index.jsx @@ -81,13 +81,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 6a9bdbd..08fb464 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -246,7 +246,7 @@ if (_hideCol.includes(col.uuid)) return if (col.linkmenu && col.linkmenu.length > 0) { - let menu_id = col.linkmenu[col.linkmenu.length - 1] + let menu_id = col.linkmenu.slice(-1)[0] col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' } else { col.linkThdMenu = '' @@ -256,13 +256,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 7c85792..f25fe28 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -227,13 +227,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx index 4cfd03f..09955fb 100644 --- a/src/tabviews/verupmanage/index.jsx +++ b/src/tabviews/verupmanage/index.jsx @@ -86,13 +86,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx index 21f2026..522dfb7 100644 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ b/src/tabviews/verupmanage/subtabtable/index.jsx @@ -109,13 +109,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 26220ab..9861fe6 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -100,7 +100,7 @@ let menu = null if (btn.linkmenu && btn.linkmenu.length > 0) { - let menu_id = btn.linkmenu[btn.linkmenu.length - 1] + let menu_id = btn.linkmenu.slice(-1)[0] menu = this.props.permMenus.filter(m => m.MenuID === menu_id)[0] || '' } diff --git a/src/tabviews/zshare/calendar/index.jsx b/src/tabviews/zshare/calendar/index.jsx index 67a2bf2..75ffdf7 100644 --- a/src/tabviews/zshare/calendar/index.jsx +++ b/src/tabviews/zshare/calendar/index.jsx @@ -194,7 +194,7 @@ } } - let re = 7 - _weeklist[_weeklist.length - 1].sublist.length + let re = 7 - _weeklist.slice(-1)[0].sublist.length for (let i = 0; i < re; i++) { _weeklist[_weeklist.length - 1].sublist.push(null) } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 73ab9d6..e606eb0 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -110,7 +110,7 @@ if (item.type === 'colspan' && item.unfold === 'true') { cell = {title: item.label, children: []} - item.subColumn.forEach(col => { + item.subcols.forEach(col => { if (col.rowspan === 'true') { rowspan = col @@ -617,12 +617,12 @@ </div> ) } else if (item.type === 'colspan') { - if (item.subColumn.length === 0) return '' + if (item.subcols.length === 0) return '' let ordertype = item.order let contents = [] let images = [] - item.subColumn.forEach(col => { + item.subcols.forEach(col => { if (!col.field || !record.hasOwnProperty(col.field)) return if (col.type === 'number') { @@ -885,7 +885,7 @@ let index = '' let _activeIndex = null if (selectedRowKeys.length > 0) { - index = selectedRowKeys[selectedRowKeys.length - 1] + index = selectedRowKeys.slice(-1)[0] } if (setting.tableType === 'checkbox') { @@ -918,7 +918,7 @@ if (newkeys.includes(index)) { newkeys = newkeys.filter(item => item !== index) if (newkeys.length > 0) { - _index = newkeys[newkeys.length - 1] + _index = newkeys.slice(-1)[0] } this.changedata(_index) } else { diff --git a/src/tabviews/zshare/verifycard/index.jsx b/src/tabviews/zshare/verifycard/index.jsx index 0678cf7..7fcbeee 100644 --- a/src/tabviews/zshare/verifycard/index.jsx +++ b/src/tabviews/zshare/verifycard/index.jsx @@ -183,13 +183,13 @@ if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) - let subColumn = [] + let subcols = [] _col.sublist.forEach(sub => { if (colMap.has(sub)) { - subColumn.push(colMap.get(sub)) + subcols.push(colMap.get(sub)) } }) - _col.subColumn = subColumn + _col.subcols = subcols _columns.push(_col) } else { _columns.push(col) diff --git a/src/templates/formtabconfig/dragelement/index.jsx b/src/templates/formtabconfig/dragelement/index.jsx index 9776ef4..cbd7e79 100644 --- a/src/templates/formtabconfig/dragelement/index.jsx +++ b/src/templates/formtabconfig/dragelement/index.jsx @@ -141,7 +141,7 @@ targetId = item.dropTargetId delete item.dropTargetId } else if (cards.length > 0) { - targetId = cards[cards.length - 1].uuid + targetId = cards.slice(-1)[0].uuid } const { index: overIndex } = findCard(`${targetId}`) diff --git a/src/templates/modalconfig/groupform/index.jsx b/src/templates/modalconfig/groupform/index.jsx index 77863ce..423e7a5 100644 --- a/src/templates/modalconfig/groupform/index.jsx +++ b/src/templates/modalconfig/groupform/index.jsx @@ -24,7 +24,7 @@ const { config, group } = this.props let _source = null - let _default = config.groups[config.groups.length - 1] + let _default = config.groups.slice(-1)[0] let _selectds = [] if (!_default) { diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 58e2a55..dde833a 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -793,7 +793,7 @@ required: 'true' } }) - _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems] + _config.groups[_config.groups.length - 1].sublist = [..._config.groups.slice(-1)[0].sublist, ..._additems] } else { let items = [] diff --git a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx index 9d610bd..e640a0e 100644 --- a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx @@ -134,7 +134,7 @@ targetId = item.dropTargetId delete item.dropTargetId } else if (cards.length > 0) { - targetId = cards[cards.length - 1].uuid + targetId = cards.slice(-1)[0].uuid } const { index: overIndex } = findCard(`${targetId}`) diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx index c37066a..7521f34 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx @@ -412,7 +412,12 @@ </Form.Item> </Col> : null} {type === 'main' ? <Col span={12}> - <Form.Item label="琛ㄥご鍥哄畾"> + <Form.Item label={ + <Tooltip placement="topLeft" title={'鍚湁鍚堝苟鍒楁垨琛ㄦ牸鍑虹幇妯悜婊氬姩鏃朵細鏄剧ず寮傚父锛岃鎱庣敤锛�'}> + <Icon type="question-circle" /> + 琛ㄥご鍥哄畾 + </Tooltip> + }> {getFieldDecorator('columnfixed', { initialValue: setting.columnfixed === 'true' || setting.columnfixed === true ? 'true' : 'false' })( diff --git a/src/templates/zshare/modalform/modaleditable/index.jsx b/src/templates/zshare/modalform/modaleditable/index.jsx index 9b5f7d7..314fe78 100644 --- a/src/templates/zshare/modalform/modaleditable/index.jsx +++ b/src/templates/zshare/modalform/modaleditable/index.jsx @@ -339,7 +339,7 @@ let fields = [] if ((type === 'select' || type === 'radio') && linkSubFields.length > this.state.linkSubFields) { - let addcol = linkSubFields[linkSubFields.length - 1] + let addcol = linkSubFields.slice(-1)[0] dataSource = dataSource.map(data => { data[addcol.field] = data.Text return data -- Gitblit v1.8.0