From ed818fbca1a913065a6a3c2c767714efe5b18685 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 八月 2020 11:21:22 +0800 Subject: [PATCH] 2020-08-17 --- src/templates/calendarconfig/index.jsx | 44 ++++++++++++++++++++------------------------ 1 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index 7edfa86..2b46ea7 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -59,7 +59,6 @@ pasteContent: null, // 绮樿创鍐呭 openEdition: '', // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� mockdata: [], // 娴嬭瘯鏁版嵁 - mockloading: false // 鏁版嵁鍔犺浇涓� } /** @@ -122,14 +121,14 @@ getMockData = (year) => { let msgs = [ - {color: 'red', remark: '鏈嶅姟鍣ㄥ紓甯革紝璇疯仈绯昏繍缁翠汉鍛橈紒'}, - {color: 'orange', remark: '绯荤粺寮傚父锛岃鍙婃椂澶勭悊锛�'}, - {color: 'yellow', remark: '鎮ㄧ殑璁㈠崟寮傚父锛岃鑱旂郴瀹㈡湇锛�'}, - {color: 'green', remark: '鎮ㄧ殑璁㈠崟宸插畬鎴愩��'}, + {color: 'red', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, + {color: 'orange', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, + {color: 'yellow', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, + {color: 'green', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'}, {color: 'cyan', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'}, - {color: 'blue', remark: '浠诲姟鏈畬鎴愶紝璇锋敞鎰忓悗缁伐浣溿��'}, - {color: 'purple', remark: '鎮ㄦ湁鏂扮殑浠诲姟绛夊緟澶勭悊锛�'}, - {color: 'gray', remark: '鎮ㄦ湁涓�灏佹湭璇婚偖浠躲��'} + {color: 'blue', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, + {color: 'purple', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'}, + {color: 'gray', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'} ] let mockdata = [] @@ -693,15 +692,15 @@ * @description 鏍¢獙閰嶇疆淇℃伅鐨勫悎娉曟�� */ verifyconfig = (config) => { - let hasKey = false + // let hasKey = false let cols = [] config.columns.forEach(col => { if (col.field) { cols.push(col.field) } - if (config.setting.primaryKey === col.field) { - hasKey = true - } + // if (config.setting.primaryKey === col.field) { + // hasKey = true + // } }) let calvaild = true @@ -717,10 +716,10 @@ if (config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.default !== 'false' && !config.setting.dataresource) { return '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�' - } else if (!config.setting.primaryKey) { - return '鑿滃崟灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒' - } else if (!hasKey) { - return '鏄剧ず鍒椾腑涓嶅瓨鍦ㄤ富閿瓧娈碉紝涓嶅彲鍚敤锛�' + // } else if (!config.setting.primaryKey) { + // return '鑿滃崟灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒' + // } else if (!hasKey) { + // return '鏄剧ず鍒椾腑涓嶅瓨鍦ㄤ富閿瓧娈碉紝涓嶅彲鍚敤锛�' } else if (!calvaild) { return '鏃ュ巻鍏宠仈瀛楁鏈缃紝涓嶅彲鍚敤锛�' } else { @@ -791,16 +790,13 @@ // 骞村垏鎹㈡椂閲嶆柊鐢熸垚鏁版嵁 changeDate = (year) => { - this.setState({mockloading: true}, () => { - this.setState({ - mockloading: false, - mockdata: this.getMockData(year) - }) + this.setState({ + mockdata: this.getMockData(year) }) } render () { - const { activeKey, config, tabviews, mockdata, mockloading } = this.state + const { activeKey, config, tabviews, mockdata } = this.state return ( <div className="model-calendar-board"> @@ -873,8 +869,8 @@ <TabComponent config={config} updateConfig={this.updateconfig} tabviews={tabviews} setSubConfig={this.setSubConfig} /> <CalComponent config={config} updateConfig={this.updateconfig} /> <CalendarComponent calendar={{ - levels: config.calendar.levels, startfield: 'start', endfield: 'end', colorfield: 'color', remarkfield: 'remark' - }} loading={mockloading} data={mockdata} changeDate={this.changeDate}/> + levels: config.calendar.levels, startfield: 'start', endfield: 'end', colorfield: 'color', remarkfield: 'remark', refresh: config.calendar.refresh + }} data={mockdata} changeDate={this.changeDate}/> </div> </Card> </div> -- Gitblit v1.8.0