|
@@ -44,7 +44,9 @@ Component({
|
|
|
classId: '',
|
|
|
initFirst: true,
|
|
|
deviceId: '',
|
|
|
- describe: ""
|
|
|
+ describe: "",
|
|
|
+ //报修记录用到的参数
|
|
|
+ faultList: []
|
|
|
|
|
|
},
|
|
|
|
|
@@ -70,6 +72,9 @@ Component({
|
|
|
//选择是故障报修界面还是报修记录界面
|
|
|
bindPageChange: function (event: any) {
|
|
|
console.log("event.detail.value:", event.detail.value)
|
|
|
+ if (event.detail.value == 1) {
|
|
|
+ this.getFaultByUserId();
|
|
|
+ }
|
|
|
this.setData({
|
|
|
pageState: event.detail.value
|
|
|
})
|
|
@@ -204,11 +209,11 @@ Component({
|
|
|
//查询班级
|
|
|
changeClass: function () {
|
|
|
let params = {
|
|
|
- "city": this.data.cityValue,
|
|
|
- "father": this.data.schoolId,//学校ID
|
|
|
- "province": this.data.provinceValue,
|
|
|
- "region": this.data.regionValue,
|
|
|
- "type": 2,
|
|
|
+ city: this.data.cityValue,
|
|
|
+ father: this.data.schoolId,//学校ID
|
|
|
+ province: this.data.provinceValue,
|
|
|
+ region: this.data.regionValue,
|
|
|
+ type: 2,
|
|
|
}
|
|
|
httpUtil.wxGet(httpUtil.interfaces.getSchoolOrClass, params).then((res: any) => {
|
|
|
this.setData({
|
|
@@ -293,9 +298,40 @@ Component({
|
|
|
classIndex: event.detail.value,
|
|
|
classId: this.data.classData[event.detail.value].id
|
|
|
})
|
|
|
+
|
|
|
+ this.getDeviceByRSC()
|
|
|
+
|
|
|
},
|
|
|
|
|
|
|
|
|
+ //根据地区,学校,班级获取deviceId
|
|
|
+ getDeviceByRSC: function () {
|
|
|
+ let params = {
|
|
|
+ city: this.data.cityValue,
|
|
|
+ classId: this.data.classId,
|
|
|
+ province: this.data.provinceValue,//省份
|
|
|
+ region: this.data.regionValue,//地区
|
|
|
+ schoolId: this.data.schoolId,
|
|
|
+ }
|
|
|
+ httpUtil.wxGet(httpUtil.interfaces.getDevideIdByRSC, params).then((res: any) => {
|
|
|
+ console.log("根据省市学校班级获取deviceId成功:", res)
|
|
|
+ if (res.data.success) {
|
|
|
+ this.setData({
|
|
|
+ deviceId: res.data.data.deviceId
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.setData({
|
|
|
+ deviceId: ''
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch((res) => {
|
|
|
+ console.log("根据省市学校班级获取deviceId失败:", res)
|
|
|
+ this.setData({
|
|
|
+ deviceId: '暂无设备'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
//获取设备ID的输入
|
|
|
bindDeviceInput(event: any) {
|
|
|
this.setData({
|
|
@@ -328,9 +364,16 @@ Component({
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
+ if (!this.data.deviceId || this.data.deviceId === '暂无设备') {
|
|
|
+ wx.showToast({
|
|
|
+ title: '暂无设备',
|
|
|
+ icon: 'none', //如果要纯文本,不要icon,将值设为'none'
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
let params = {
|
|
|
-
|
|
|
city: this.data.cityValue,
|
|
|
classId: this.data.classId,
|
|
|
province: this.data.provinceValue,//省份
|
|
@@ -353,6 +396,7 @@ Component({
|
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
|
console.log('点击确认回调')
|
|
|
+ that.getFaultByUserId();
|
|
|
that.setData({
|
|
|
pageState: 1
|
|
|
})
|
|
@@ -370,6 +414,22 @@ Component({
|
|
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
+
|
|
|
+ getFaultByUserId: function () {
|
|
|
+ console.log("获取报修记录")
|
|
|
+ let params = {
|
|
|
+ pageNo: 1,
|
|
|
+ pageSize: 10000
|
|
|
+ }
|
|
|
+ httpUtil.wxGet(httpUtil.interfaces.getDeviceFault, params).then((res: any) => {
|
|
|
+ console.log("获取报修记录成功:", res)
|
|
|
+ this.setData({
|
|
|
+ faultList: res.data.data.list
|
|
|
+ })
|
|
|
+ }).catch((res) => {
|
|
|
+ console.log("获取报修记录失败:", res)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
}
|