From b883ae5d7d46fc7a3503236f16a250c2264ea7c7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 29 九月 2022 17:45:25 +0800 Subject: [PATCH] 2022-09-29 --- src/menu/components/chart/antv-bar/index.jsx | 46 +++++++--------------------------------------- 1 files changed, 7 insertions(+), 39 deletions(-) diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index ca919d0..bf52288 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -18,7 +18,6 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const ChartCompileForm = asyncIconComponent(() => import('./chartcompile')) -// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -91,7 +90,6 @@ search: [], action: [], plot: _plot, - btnlog: [], } if (card.config) { @@ -124,7 +122,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('plusSearch', this.plusSearch) MKEmitter.addListener('tabsChange', this.handleTabsChange) setTimeout(() => { @@ -143,7 +140,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('plusSearch', this.plusSearch) MKEmitter.removeListener('tabsChange', this.handleTabsChange) } @@ -1230,8 +1226,9 @@ card.width = card.plot.width card.name = card.plot.name - card.btnlog = [] card.errors = [] + + let columns = card.columns.map(c => c.field) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -1239,11 +1236,12 @@ card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) } else if (!card.setting.primaryKey) { card.errors.push({ level: 0, detail: '鏈缃富閿紒'}) + } else if (!columns.includes(card.setting.primaryKey)) { + card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) } else if (!card.setting.supModule) { card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) } - let columns = card.columns.map(c => c.field) if (!card.plot.Xaxis) { card.errors.push({ level: 0, detail: '鍧愭爣杞村皻鏈缃紒'}) } else if (card.plot.datatype === 'query') { @@ -1335,42 +1333,14 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } - - // handleLog = (type, logs, item) => { - // let card = fromJS(this.state.card).toJS() - - // if (type === 'revert') { - // card.action = card.action ? [...card.action, item] : [item] - // card.btnlog = logs - - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '鎭㈠鎴愬姛锛�', - // duration: 2 - // }) - // } else { - // card.btnlog = logs - // this.updateComponent(card) - // notification.success({ - // top: 92, - // message: '娓呴櫎鎴愬姛锛�', - // duration: 2 - // }) - // } - // } clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { @@ -1393,7 +1363,6 @@ <CopyComponent type="line" card={card}/> <PasteComponent config={card} options={['action', 'search']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> - {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> @@ -1405,7 +1374,6 @@ <NormalHeader config={card} updateComponent={this.updateComponent}/> <div className="canvas" id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div> {appType !== 'mob' ? <ActionComponent - type="chart" config={card} updateaction={this.updateComponent} /> : null} -- Gitblit v1.8.0