forked from floraachy/xiuos_IoT
add webnet data get & save
This commit is contained in:
parent
15bc202629
commit
a22dad62c7
|
@ -131,7 +131,7 @@
|
||||||
<el-input v-model="form.username" />
|
<el-input v-model="form.username" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="密码:" prop="password">
|
<el-form-item label="密码:" prop="password">
|
||||||
<el-input v-model="form.password" />
|
<el-input v-model="form.password" show-password />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="客户端id:" prop="clientid">
|
<el-form-item label="客户端id:" prop="clientid">
|
||||||
<el-input v-model="form.clientid" />
|
<el-input v-model="form.clientid" />
|
||||||
|
@ -152,7 +152,7 @@
|
||||||
<el-input v-model="form.privateserverusername" />
|
<el-input v-model="form.privateserverusername" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="密码:" prop="privateserverpassword">
|
<el-form-item label="密码:" prop="privateserverpassword">
|
||||||
<el-input v-model="form.privateserverpassword" />
|
<el-input v-model="form.privateserverpassword" show-password />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -170,6 +170,7 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import { remove, getList, add, active } from '@/api/terminal/add'
|
import { remove, getList, add, active } from '@/api/terminal/add'
|
||||||
|
import axios from 'axios'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -303,6 +304,33 @@ export default {
|
||||||
this.date = new Date().toLocaleDateString()
|
this.date = new Date().toLocaleDateString()
|
||||||
this.getList(0)
|
this.getList(0)
|
||||||
this.getList(1)
|
this.getList(1)
|
||||||
|
axios.get('/cgi-bin/mqtt_get', { headers: {
|
||||||
|
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||||
|
}}).then(res => {
|
||||||
|
this.form.topic = res.data.pub_topic
|
||||||
|
this.form.serveraddr = res.data.server_addr
|
||||||
|
this.form.serverport = res.data.server_port
|
||||||
|
this.form.username = res.data.username
|
||||||
|
this.form.password = res.data.password
|
||||||
|
this.form.clientid = res.data.clientID
|
||||||
|
})
|
||||||
|
axios.get('/cgi-bin/tcpip_get', { headers: {
|
||||||
|
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||||
|
}}).then(res => {
|
||||||
|
this.form.ipaddr = res.data.local_ipaddr
|
||||||
|
this.form.netmask = res.data.netmask_addr
|
||||||
|
this.form.gateway = res.data.gateway_addr
|
||||||
|
this.form.dnsserver0 = res.data.dns_server0
|
||||||
|
this.form.dnsserver1 = res.data.dns_server1
|
||||||
|
})
|
||||||
|
axios.get('/cgi-bin/private_prt_get', { headers: {
|
||||||
|
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||||
|
}}).then(res => {
|
||||||
|
this.form.privateserveraddr = res.data.server_addr
|
||||||
|
this.form.privateserverport = res.data.server_port
|
||||||
|
this.form.privateserverusername = res.data.username
|
||||||
|
this.form.privateserverpassword = res.data.passward
|
||||||
|
})
|
||||||
// this.randomData()
|
// this.randomData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -368,7 +396,6 @@ export default {
|
||||||
},
|
},
|
||||||
chooseCard(list) {
|
chooseCard(list) {
|
||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
console.log('productList', this.productList)
|
|
||||||
const temp = this.productList.filter(product => product.name === item.productname)
|
const temp = this.productList.filter(product => product.name === item.productname)
|
||||||
item.color = temp[0].color
|
item.color = temp[0].color
|
||||||
item.src = temp[0].src
|
item.src = temp[0].src
|
||||||
|
@ -377,7 +404,6 @@ export default {
|
||||||
remove(device, index) {
|
remove(device, index) {
|
||||||
remove({ no: device.no }).then(res => {
|
remove({ no: device.no }).then(res => {
|
||||||
if (res.code === '200000') {
|
if (res.code === '200000') {
|
||||||
console.log('activatedDevice', this.$refs.activatedDevice[index])
|
|
||||||
this.$refs.activatedDevice[index].classList.add('fadeOut')
|
this.$refs.activatedDevice[index].classList.add('fadeOut')
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.activeList.splice(index, 1)
|
this.activeList.splice(index, 1)
|
||||||
|
@ -408,7 +434,7 @@ export default {
|
||||||
},
|
},
|
||||||
handleTabClick(tab, event) {},
|
handleTabClick(tab, event) {},
|
||||||
submit() {
|
submit() {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.form.validate(async valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const { src, productname, type, no, devicedesc, color } = this.form
|
const { src, productname, type, no, devicedesc, color } = this.form
|
||||||
const temp = {
|
const temp = {
|
||||||
|
@ -435,11 +461,34 @@ export default {
|
||||||
privateserverport: this.form.privateserverport || '9898',
|
privateserverport: this.form.privateserverport || '9898',
|
||||||
privateserverusername: this.form.privateserverusername || 'admin'
|
privateserverusername: this.form.privateserverusername || 'admin'
|
||||||
}
|
}
|
||||||
add({
|
await add({ productname, type, no, devicedesc, activestatus: this.form.activestatus, ...dataTemplate })
|
||||||
productname, type, no, devicedesc, activestatus: this.form.activestatus, ...dataTemplate
|
await axios.post('/cgi-bin/tcpip_save', {
|
||||||
}).then(res => {
|
local_ipaddr: this.form.ipaddr,
|
||||||
}).catch(err => {
|
netmask_addr: this.form.netmask,
|
||||||
})
|
gateway_addr: this.form.gateway,
|
||||||
|
dns_server0: this.form.dnsserver0,
|
||||||
|
dns_server1: this.form.dnsserver1
|
||||||
|
}, { headers: {
|
||||||
|
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||||
|
}})
|
||||||
|
await axios.post('/cgi-bin/mqtt_save', {
|
||||||
|
pub_topic: this.form.topic,
|
||||||
|
server_addr: this.form.serveraddr,
|
||||||
|
server_port: this.form.serverport,
|
||||||
|
username: this.form.username,
|
||||||
|
password: this.form.password,
|
||||||
|
clientID: this.form.clientid
|
||||||
|
}, { headers: {
|
||||||
|
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||||
|
}})
|
||||||
|
await axios.post('/cgi-bin/private_prt_save', {
|
||||||
|
server_addr: this.form.privateserveraddr,
|
||||||
|
server_port: this.form.privateserverport,
|
||||||
|
username: this.form.privateserverusername,
|
||||||
|
passward: this.form.privateserverpassword
|
||||||
|
}, { headers: {
|
||||||
|
Authorization: 'Basic YWRtaW46YWRtaW4='
|
||||||
|
}})
|
||||||
if (this.form.activestatus === 0) {
|
if (this.form.activestatus === 0) {
|
||||||
this.disactiveList.push(temp)
|
this.disactiveList.push(temp)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,6 +37,13 @@ module.exports = {
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
'^/dashengda': ''
|
'^/dashengda': ''
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'/cgi-bin': {
|
||||||
|
target: 'http://192.168.131.29/', // webnet
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: {
|
||||||
|
'^/cgi-bin': '/cgi-bin'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
open: true,
|
open: true,
|
||||||
|
|
Loading…
Reference in New Issue