|
|
@ -53,7 +53,7 @@ |
|
|
|
<!-- <Col span="8"> |
|
|
|
<div class="switch-4g"> |
|
|
|
<div class="switch-4g-label">GPS</div> |
|
|
|
true-value="1" true-false="0" |
|
|
|
true-value="1" true-false="0" |
|
|
|
<i-switch size="large" v-model="info.gps_enable" :true-value="1" :true-false="0"> |
|
|
|
<span slot="open">开启</span> |
|
|
|
<span slot="close">关闭</span> |
|
|
@ -105,21 +105,19 @@ |
|
|
|
<Col span="8"> |
|
|
|
<div class="switch-4g"> |
|
|
|
<div class="switch-4g-label">网关接收频率</div> |
|
|
|
<Select v-model="freq" @on-change="group = 1;freqChange()" placement="top"> |
|
|
|
<Select v-model="freq" @on-change="freqChange" placement="top"> |
|
|
|
<Option v-for="item in freqs" :value="item.value" :key="item.value">{{ item.label }}</Option> |
|
|
|
</Select> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
<Col span="8"> |
|
|
|
<div class="switch-4g"> |
|
|
|
<div class="switch-4g-label">接收频率组</div> |
|
|
|
<Select v-model="group" @on-change="freqChange" placement="top"> |
|
|
|
<Option v-for="idx in groups" :value="idx" :key="idx">{{ '第' + idx + '组' }}</Option> |
|
|
|
</Select> |
|
|
|
<div class="switch-4g-label">起始频率</div> |
|
|
|
<Input-number style="width: 200px" size="large" :max="max" :step="step" v-model="start" @keyup.enter.native="startFreqChange" @on-blur="startFreqChange"></Input-number> |
|
|
|
</div> |
|
|
|
</Col> |
|
|
|
<Col span="8"> |
|
|
|
<Alert type="success">当前频率段:{{init + '~' + end}}</Alert> |
|
|
|
<Alert type="success">当前频率段:{{start}}M~{{end}}M,步长:{{step}}M,通道数:8</Alert> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
<!-- <Row :gutter="10"> |
|
|
@ -221,8 +219,8 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { mapActions, mapGetters } from 'vuex' |
|
|
|
import { accAdd, accMul } from '@/libs/util' |
|
|
|
import { mapActions } from 'vuex' |
|
|
|
import { accAdd, accSub, accMul } from '@/libs/util' |
|
|
|
export default { |
|
|
|
name: 'gateway', |
|
|
|
data () { |
|
|
@ -232,81 +230,120 @@ export default { |
|
|
|
wifi: false, |
|
|
|
modal_loading: false, |
|
|
|
freq: '', |
|
|
|
group: 0, |
|
|
|
groups: 0, |
|
|
|
freqs: [ |
|
|
|
{ value: 'CN470', label: 'CN470', init: 470.3, len: 12 }, |
|
|
|
{ value: 'CN779', label: 'CN779', init: 779.5, len: 5 }, |
|
|
|
{ value: 'EU433', label: 'EU433', init: 433.175, len: 1 }, |
|
|
|
{ value: 'EU868', label: 'EU868', init: 864.1, len: 1 }, |
|
|
|
{ value: 'US915', label: 'US915', init: 902.3, len: 8 } |
|
|
|
{ value: 'EU868', label: 'EU868', init: 863.1, cnt: 16, interval: 0.2 }, |
|
|
|
{ value: 'US915', label: 'US915', init: 902.3, cnt: 64, interval: 0.2 }, |
|
|
|
// { value: 'US915-500', label: 'US915-500', init: 903, cnt: 8, interval: 1.6 }, |
|
|
|
{ value: 'CN779', label: 'CN779', init: 779.5, cnt: 36, interval: 0.2 }, |
|
|
|
{ value: 'EU433', label: 'EU433', init: 433.175, cnt: 16, interval: 0.2 }, |
|
|
|
{ value: 'AU915', label: 'AU915', init: 915.2, cnt: 64, interval: 0.2 }, |
|
|
|
// { value: 'AU915-500', label: 'AU915-500', init: 915.9, cnt: 8, interval: 1.6 }, |
|
|
|
{ value: 'KR920', label: 'KR920', init: 920.9, cnt: 16, interval: 0.2 }, |
|
|
|
{ value: 'CN470', label: 'CN470', init: 470.3, cnt: 96, interval: 0.2 }, |
|
|
|
{ value: 'IN865', label: 'IN865', init: 865.0625, cnt: 16, interval: 0.34 }, |
|
|
|
{ value: 'RU864', label: 'RU864', init: 868.9, cnt: 8, interval: 0.2 }, |
|
|
|
{ value: 'AS923', label: 'AS923', init: 923.2, cnt: 16, interval: 0.2 } |
|
|
|
], |
|
|
|
info: null, |
|
|
|
init: '', |
|
|
|
end: '' |
|
|
|
init: 0, |
|
|
|
initFreq: '', |
|
|
|
start: 0, |
|
|
|
min: 0, |
|
|
|
max: 0, |
|
|
|
step: 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted () { |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
end () { |
|
|
|
return accAdd(this.start, 7 * this.step) |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
...mapActions(['getGatewayConfig', 'saveGatewayConfig', 'setReboot']), |
|
|
|
getData(isRefresh) { |
|
|
|
this.loading = true; |
|
|
|
getData (isRefresh) { |
|
|
|
this.loading = true |
|
|
|
this.getGatewayConfig().then(res => { |
|
|
|
this.loading = false; |
|
|
|
if(isRefresh) { |
|
|
|
this.$Message.success(this.$t('freshen')); |
|
|
|
} |
|
|
|
let obj = JSON.parse(res); |
|
|
|
if(obj.gw_rx_freq && obj.gw_rx_freq.split('-').length) { |
|
|
|
this.freq = obj.gw_rx_freq.split('-')[0]; |
|
|
|
this.group = parseInt(obj.gw_rx_freq.split('-')[1]); |
|
|
|
this.freqChange() |
|
|
|
this.loading = false |
|
|
|
if (isRefresh) { |
|
|
|
this.$Message.success(this.$t('freshen')) |
|
|
|
} |
|
|
|
this.info = obj; |
|
|
|
let obj = JSON.parse(res) |
|
|
|
this.initFreq = obj.gw_rx_freq |
|
|
|
this.freq = obj.gw_rx_freq |
|
|
|
this.init = obj.gw_rx_freq1 / 1000000 |
|
|
|
this.freqChange() |
|
|
|
this.start = this.init |
|
|
|
this.info = obj |
|
|
|
console.log(obj) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
this.loading = false; |
|
|
|
this.loading = false |
|
|
|
this.$Message.error({ |
|
|
|
content: '刷新失败!' + ' 状态码:' + err.response.status, |
|
|
|
duration: 10 |
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
freqChange() { |
|
|
|
freqChange () { |
|
|
|
this.freqs.forEach(r => { |
|
|
|
if(r.value === this.freq) { |
|
|
|
this.groups = r.len; |
|
|
|
this.init = accAdd(r.init, accMul((this.group - 1), 1.6)); |
|
|
|
this.end = accAdd(this.init, 1.4) * 1000000; |
|
|
|
this.init = this.init * 1000000; |
|
|
|
if (r.value === this.freq) { |
|
|
|
this.max = r.init + ((r.cnt - 8) * r.interval) |
|
|
|
this.min = r.init |
|
|
|
this.step = r.interval |
|
|
|
this.start = r.init |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
onSave() { |
|
|
|
startFreqChange () { |
|
|
|
const r = accSub(this.start, this.min) |
|
|
|
if (r < 0) { |
|
|
|
this.$Notice.error({ |
|
|
|
title: '起始频率配置错误', |
|
|
|
desc: '该频段的最小值为:' + this.min, |
|
|
|
duration: 5 |
|
|
|
}) |
|
|
|
if (this.initFreq === this.freq) { |
|
|
|
this.start = this.init |
|
|
|
} else { |
|
|
|
this.start = this.min |
|
|
|
} |
|
|
|
} else if (accMul(r, 1000000) % accMul(this.step, 1000000)) { |
|
|
|
this.$Notice.error({ |
|
|
|
title: '起始频率配置错误', |
|
|
|
desc: '起始频率=:' + this.min + '(最小频率)' + ' + ' + this.step + '(步长)' + ' * n(n为自然数)', |
|
|
|
duration: 15 |
|
|
|
}) |
|
|
|
if (this.initFreq === this.freq) { |
|
|
|
this.start = this.init |
|
|
|
} else { |
|
|
|
this.start = this.min |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onSave () { |
|
|
|
let params = JSON.parse(JSON.stringify(this.info)) |
|
|
|
params.gw_rx_freq1 = this.init; |
|
|
|
params.gw_rx_freq2 = this.end; |
|
|
|
this.modal_loading = true; |
|
|
|
for(let k in params) { |
|
|
|
params[k]+='' |
|
|
|
params.gw_rx_freq = this.freq |
|
|
|
params.gw_rx_freq1 = this.start * 1000000 |
|
|
|
params.gw_rx_freq2 = this.end * 1000000 |
|
|
|
this.modal_loading = true |
|
|
|
for (let k in params) { |
|
|
|
params[k] += '' |
|
|
|
} |
|
|
|
console.log(params) |
|
|
|
this.saveGatewayConfig(params).then(res => { |
|
|
|
this.modal_loading = this.isSave = false; |
|
|
|
this.modal_loading = this.isSave = false |
|
|
|
// console.log(res) |
|
|
|
this.$Message.success({ |
|
|
|
content: '保存成功', |
|
|
|
duration: 10 |
|
|
|
}); |
|
|
|
}) |
|
|
|
// this.setReboot() |
|
|
|
}).catch(err => { |
|
|
|
this.modal_loading = false |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
this.modal_loading = false; |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|