| xqd
@@ -50,9 +50,25 @@
|
|
|
{{item}}
|
|
|
</div>
|
|
|
<input class="inputstyle" type="text" v-model="value" placeholder="请输入你需要升级的设备IMEI号码">
|
|
|
- <button class="btnstyle" @click="installbtn">点击设置</button>
|
|
|
+ <button class="btnstyle" @click="installbtn">点击搜索</button>
|
|
|
</div>
|
|
|
- <div class="container" style="align-items: flex-start;" v-else>
|
|
|
+ <div v-if="isshezhi" style="margin-top: 1rem; text-align: center">
|
|
|
+ <h1 style="font-size: 0.7rem;text-align: center">绿色地球</h1>
|
|
|
+ <input type="text" class="inputstyle" disabled v-model="value" placeholder="">
|
|
|
+ <div v-for="(item,index) in phonedata" style="font-size: .5rem;margin-top: .3rem;" @click="tapphone(item)">
|
|
|
+ {{item}}
|
|
|
+ </div>
|
|
|
+ <input type="text" class="inputstyle" v-model="phone" placeholder="请输入DTU绑定手机卡号">
|
|
|
+ <br />
|
|
|
+ <select class="inputstyle" v-model="typevalue" @change="changeProduct($event)">
|
|
|
+ <option value="1">四箱</option>
|
|
|
+ <option value="2">五箱</option>
|
|
|
+ <option value="3">四箱可回收</option>
|
|
|
+ <option value="4">五箱可回收</option>
|
|
|
+ </select>
|
|
|
+ <button @click="shezhi" class="btnstyle">立即设置</button>
|
|
|
+ </div>
|
|
|
+ <div class="container" style="align-items: flex-start;" v-if="isbox">
|
|
|
<div style="font-size: .5rem;">
|
|
|
设备IMEI号:{{equipment}}
|
|
|
</div>
|
| xqd
@@ -94,10 +110,18 @@
|
|
|
versionNum: "",
|
|
|
isnew: "",
|
|
|
Numarr: [],
|
|
|
- list: []
|
|
|
+ list: [],
|
|
|
+ typevalue: "1",
|
|
|
+ phone: "",
|
|
|
+ type: 1,
|
|
|
+ isbox: false,
|
|
|
+ isshezhi: false,
|
|
|
+ phoneList: [],
|
|
|
+ phonedata: []
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getNum()
|
|
|
+ this.getphone()
|
|
|
},
|
|
|
watch: {
|
|
|
value(newdata, jiu) {
|
| xqd
@@ -109,9 +133,40 @@
|
|
|
if (newdata == "") {
|
|
|
this.list = []
|
|
|
}
|
|
|
+ },
|
|
|
+ phone(newdata, jiu) {
|
|
|
+ console.log(newdata)
|
|
|
+ if (typeof newdata === 'string') {
|
|
|
+ if (newdata.trim().length !== 0) {
|
|
|
+ this.debounce(this.phonechange, 1500);
|
|
|
+ } else { }
|
|
|
+ }
|
|
|
+ if (newdata == "") {
|
|
|
+ this.phonedata = []
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ shezhi() {
|
|
|
+ if (this.phone != "") {
|
|
|
+ if (confirm("请再次确定选择的手机号和箱体类型选择正确,提交后不可变更")) {
|
|
|
+ axios.get("/updateDevice?id=" + this.value + "&type=" + this.type + "&phone=" + this.phone).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.data.status == 200) {
|
|
|
+ this.isshezhi = false
|
|
|
+ this.isbox = true
|
|
|
+ alert('设备更新中')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ alert("请输入手机号")
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeProduct(e) {
|
|
|
+ console.log(e)
|
|
|
+ this.type = e.target.value
|
|
|
+ },
|
|
|
getNum() {
|
|
|
axios.get("/getDevcielist").then(res => {
|
|
|
this.Numarr = res.data.data
|
| xqd
@@ -121,6 +176,10 @@
|
|
|
this.value = item
|
|
|
this.list = []
|
|
|
},
|
|
|
+ tapphone(item) {
|
|
|
+ this.phone = item
|
|
|
+ this.phonedata = []
|
|
|
+ },
|
|
|
changeStr() {
|
|
|
this.list = []
|
|
|
this.Numarr.forEach(item => {
|
| xqd
@@ -130,6 +189,15 @@
|
|
|
})
|
|
|
console.log(this.list)
|
|
|
},
|
|
|
+ phonechange() {
|
|
|
+ this.phonedata = []
|
|
|
+ this.phoneList.forEach(item => {
|
|
|
+ if (item.substr(item.length - 4) == this.phone) {
|
|
|
+ this.phonedata.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(this.phonedata)
|
|
|
+ },
|
|
|
debounce(fn, wait) {
|
|
|
if (this.fun !== null) {
|
|
|
clearTimeout(this.fun)
|
| xqd
@@ -152,11 +220,24 @@
|
|
|
axios.get("/getDevice?id=" + this.value).then(res => {
|
|
|
console.log(res)
|
|
|
if (res.data.status == 200) {
|
|
|
- this.isInstall = false
|
|
|
- this.equipment = res.data.data.id
|
|
|
- this.isxian = res.data.data.status
|
|
|
- this.versionNum = res.data.data.version
|
|
|
- this.isnew = res.data.data.is_last
|
|
|
+ if (res.data.data.phone != null && res.data.data.device_type != null && res.data.data.is_last == 0) {
|
|
|
+ this.isInstall = false
|
|
|
+ this.isbox = true
|
|
|
+ this.equipment = res.data.data.id
|
|
|
+ this.isxian = res.data.data.status
|
|
|
+ this.versionNum = res.data.data.version
|
|
|
+ this.isnew = res.data.data.is_last
|
|
|
+ } else if (res.data.data.phone == null && res.data.data.device_type == null && res.data.data.is_last == 0) {
|
|
|
+ this.isInstall = false
|
|
|
+ this.isshezhi = true
|
|
|
+ this.equipment = res.data.data.id
|
|
|
+ this.isxian = res.data.data.status
|
|
|
+ this.versionNum = res.data.data.version
|
|
|
+ this.isnew = res.data.data.is_last
|
|
|
+ } else {
|
|
|
+ alert('当前设备已是最新版本,已有箱体和已绑定手机号无需设置升级')
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
alert("无效设备")
|
|
|
}
|
| xqd
@@ -178,6 +259,11 @@
|
|
|
} else {
|
|
|
alert('设备已是最新版本,无需更新')
|
|
|
}
|
|
|
+ },
|
|
|
+ getphone() {
|
|
|
+ axios.get("/getPhonelist").then(res => {
|
|
|
+ this.phoneList = res.data.data
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|