diff --git a/src/components/CustomTree/index.vue b/src/components/CustomTree/index.vue index 3be4ae1..e99f4fb 100644 --- a/src/components/CustomTree/index.vue +++ b/src/components/CustomTree/index.vue @@ -116,8 +116,11 @@ export default { } }, watch: { - value() { - this.checkedKeys = this.value + value: { + handler() { + this.checkedKeys = this.value + }, + immediate: true }, checkedKeys() { this.$emit('input', this.checkedKeys) diff --git a/src/views/stationOperation/components/MapMarker.vue b/src/views/stationOperation/components/MapMarker.vue index 72ed333..7780c0e 100644 --- a/src/views/stationOperation/components/MapMarker.vue +++ b/src/views/stationOperation/components/MapMarker.vue @@ -122,7 +122,7 @@ export default { // 显示地图弹窗 async showMapPopup(stationInfo) { this.popupOverlay.setPosition(fromLonLat([stationInfo.lon, stationInfo.lat])) - this.popupOverlay.setOffset([stationInfo.stationType == MarkerType.NuclearFacility ? 10 : 0, 27]) + this.popupOverlay.setOffset([stationInfo.stationType == MarkerType.NuclearFacility ? 10 : 0, 32]) this.columns = PopupColumns[stationInfo.stationType] this.popupTitle = stationInfo.stationType this.isGettingInfo = true diff --git a/src/views/stationOperation/components/MapPane.vue b/src/views/stationOperation/components/MapPane.vue index 0f21742..47166ee 100644 --- a/src/views/stationOperation/components/MapPane.vue +++ b/src/views/stationOperation/components/MapPane.vue @@ -176,32 +176,48 @@
- + day - + min - + min - + min
+
+ @@ -232,7 +248,7 @@ import CustomModal from '@/components/CustomModal/index.vue' import CustomTree from '@/components/CustomTree/index.vue' import RealTimeDataChart from './RealTimeDataChart.vue' -import { postAction } from '../../../api/manage' +import { getAction, postAction } from '../../../api/manage' import { MarkerType, FilterIcon } from './markerEnum' import { Vector as VectorLayer } from 'ol/layer' @@ -361,14 +377,25 @@ const legendList = [ } ] -const statusList = [ - { - title: 'JPX38 23803' +// Attribute Configuration 检验规则(自定义,非a-form校验) +const rules = { + cacheTime: { + required: true, + message: 'Please Input Cache Time' }, - { - title: 'JPX38 23804' + scaleInterval: { + required: true, + message: 'Please Input Scale Interval' + }, + timelineLength: { + required: true, + message: 'Please Input Timeline Length' + }, + updateIntervalTime: { + required: true, + message: 'Please Input Update Interval' } -] +} export default { props: { @@ -402,12 +429,21 @@ export default { isGettingInfomationList: false, dataStatusModalVisible: false, // 分析弹窗是否可见 - dataStatusCheckedKeys: [], // 分析弹窗-左侧树选中的 + initialDataRecieveSettings: {}, // 初始未改变的数据接收状态设置 + dataStatusCheckedKeys: [], // 分析弹窗-左侧树选中的keys + dataRecieveStatusModel: { + cacheTime: 15, + scaleInterval: 120, + timelineLength: 1440, + updateIntervalTime: 5 + }, // 数据接收状态配置 + isSavingDataRecieveSettings: false, leftPaneShow: true, // 左侧抽屉 legendList, // 图例列表 - statusList, + statusList: [], // 数据接收状态列表 + isGettingStatusList: false, showChart: true, markerList: [] // 要在地图上展示的marker列表 @@ -417,6 +453,8 @@ export default { this.initParentMapProps() document.addEventListener('fullscreenchange', this.onFullScreenChange) this.stationList = [] + + this.getDataRecieveSettings() }, destroyed() { document.removeEventListener('fullscreenchange', this.onFullScreenChange) @@ -660,6 +698,123 @@ export default { this.$nextTick(() => { this.showChart = true }) + }, + + // 保存数据接收状态的配置 + async onSaveDataRecieveSettings() { + if (!this.dataStatusCheckedKeys.length) { + this.$message.warn('Please Select Particulate Station') + return + } + try { + await this.validateForm(this.dataRecieveStatusModel, rules) + try { + const stationIds = this.dataStatusCheckedKeys.filter(key => -1 == key.toString().indexOf('root_')) + this.isSavingDataRecieveSettings = true + const { success, message } = await postAction( + '/jeecg-station-operation/sysUserFocusStation/saveUserFocusByUserId', + { + stationIds, + ...this.dataRecieveStatusModel + } + ) + if (success) { + this.$message.success('Save Success') + await this.getDataRecieveSettings() + this.startGetDataReceiveStatusList() + } else { + this.$message.error(message) + } + } catch (error) { + console.error(error) + } finally { + this.isSavingDataRecieveSettings = false + } + } catch (error) { + this.$message.warn(error) + } + }, + + // 验证表单 + validateForm(model, rules) { + return new Promise((resolve, reject) => { + const rulesKey = Object.keys(rules) + for (const key of rulesKey) { + const rule = rules[key], + value = model[key] + if (rule.required && !value) { + reject(rule.message) + return + } + } + resolve() + }) + }, + + // 获取数据接收状态配置 + async getDataRecieveSettings() { + try { + const { success, result, message } = await getAction( + '/jeecg-station-operation/sysUserFocusStation/findUserFocusByUserId', + { + userId: this.$store.getters.userInfo.id + } + ) + if (success) { + this.initialDataRecieveSettings = result + } else { + this.$message.error(message) + } + } catch (error) { + console.error(error) + this.$message.error(error) + } + }, + + // 开始获取数据状态列表的定时器 + startGetDataReceiveStatusList() { + if (this.timer) { + clearInterval(this.timer) + } + this.getDataRecieveStatusList() + this.timer = setInterval(() => { + this.getDataRecieveStatusList() + }, this.dataRecieveStatusModel.updateIntervalTime * 60 * 1000) + }, + + // 获取数据接收状态列表 + async getDataRecieveStatusList() { + try { + console.log('%c [ ]-777', 'font-size:13px; background:pink; color:#bf2c9f;', this.initialDataRecieveSettings) + this.isGettingStatusList = true + const res = await getAction('/jeecg-station-operation/stationOperation/getDataReceivingStatus', { + userId: this.$store.getters.userInfo.id + }) + console.log('%c [ res ]-640', 'font-size:13px; background:pink; color:#bf2c9f;', res) + } catch (error) { + console.error(error) + } finally { + this.isGettingStatusList = false + } + } + }, + watch: { + dataStatusModalVisible(val) { + if (val) { + this.dataStatusCheckedKeys = this.initialDataRecieveSettings.sysUserFocusStations.map(item => + parseInt(item.stationId) + ) + this.dataRecieveStatusModel = { + cacheTime: this.initialDataRecieveSettings.cacheTime, + scaleInterval: this.initialDataRecieveSettings.scaleInterval, + timelineLength: this.initialDataRecieveSettings.timelineLength, + updateIntervalTime: this.initialDataRecieveSettings.updateIntervalTime + } + + this.startGetDataReceiveStatusList() + } else { + clearInterval(this.timer) + } } } } diff --git a/src/views/stationOperation/components/markerPopupColumns.js b/src/views/stationOperation/components/markerPopupColumns.js index d136704..b9febda 100644 --- a/src/views/stationOperation/components/markerPopupColumns.js +++ b/src/views/stationOperation/components/markerPopupColumns.js @@ -153,5 +153,42 @@ export default { }, { label: 'TYPE', key: 'type' + }], + [MarkerType.NRL]: [{ + label: 'COUNTRYCODE', + key: 'countryCode' + }, { + label: 'DATEBEGIN', + key: 'dateBegin' + }, { + label: 'DATEEND', + key: 'dateEnd' + }, { + label: 'DESCRIPTION', + key: 'description' + }, { + label: 'ELEVATION', + key: 'elevation' + }, { + label: 'LATITUDE', + key: 'lat' + }, { + label: 'LONGITUDE', + key: 'lon' + }, { + label: 'MODDATE', + key: 'moddate' + }, { + label: 'STATIONCODE', + key: 'stationCode' + }, { + label: 'STATIONID', + key: 'stationId' + }, { + label: 'STATUS', + key: 'status' + }, { + label: 'TYPE', + key: 'type' }] } \ No newline at end of file diff --git a/src/views/stationOperation/index.vue b/src/views/stationOperation/index.vue index 1d8957e..a04c56a 100644 --- a/src/views/stationOperation/index.vue +++ b/src/views/stationOperation/index.vue @@ -1,10 +1,10 @@