From 097985a7a3f9c869f7ee5692b163210ab647987f Mon Sep 17 00:00:00 2001
From: hailu <962012470@qq.com>
Date: 星期四, 07 十二月 2023 17:35:19 +0800
Subject: [PATCH] 备份
---
GoldC/pages/repairTicketDetail/repairTicketDetail.js | 192 ++++++++++++++++++++++++++++++++++++-----------
1 files changed, 145 insertions(+), 47 deletions(-)
diff --git a/GoldC/pages/repairTicketDetail/repairTicketDetail.js b/GoldC/pages/repairTicketDetail/repairTicketDetail.js
index 3fd542e..a6ce451 100644
--- a/GoldC/pages/repairTicketDetail/repairTicketDetail.js
+++ b/GoldC/pages/repairTicketDetail/repairTicketDetail.js
@@ -7,7 +7,7 @@
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- deviceList:[],
+ deviceList: [],
detailedaddress: '鑾峰彇鍦板潃',
showType: false,
deviceName: '璇烽�夋嫨',
@@ -17,12 +17,15 @@
selectDate: '',
show: 'none',
info: '',
+ personInfo: {},
+ yetSub: false,
+ tanantId: 0,
-
+ deviceId: 0,
userName: '',
userPhone: undefined,
address: '',
- description:'',
+ description: '',
time: '閫夋嫨棰勭害鏃堕棿',
multiArray: [],//piker鐨刬tem椤�
@@ -40,17 +43,20 @@
},
onChangeType(event) {
const { picker, value, index } = event.detail;
+ console.log(picker, value, index);
this.setData({
deviceName: value,
showType: false,
- deviceIndex: index
+ deviceIndex: index,
+ tanantId: this.data.deviceList[index].tenantId,
+ deviceId: this.data.deviceList[index].deviceId,
})
+ console.log(this.data.deviceId);
},
changeUserName(e) {
this.setData({
userName: e.detail.value
})
-
},
checkPhone(e) {
this.setData({
@@ -62,9 +68,10 @@
address: e.detail.value
})
},
- changeDescription(e){
+ changeDescription(e) {
+ console.log(e);
this.setData({
- description: e.detail.value
+ description: e.detail
})
},
closeType() {
@@ -77,8 +84,6 @@
showDate: true
})
},
-
-
bindMultiPickerChange: function (e) { //鏃堕棿鏃ユ湡picker閫夋嫨鏀瑰彉鍚庯紝鐐瑰嚮纭畾
// console.log('picker鍙戦�侀�夋嫨鏀瑰彉锛屾惡甯﹀�间负', e.detail.value)
this.setData({
@@ -342,19 +347,19 @@
icon: 'none'
});
return false
- }else if(!this.data.userName) {
+ } else if (!this.data.userName) {
wx.showToast({
title: '璇疯緭鍏ョ敤鎴峰悕',
icon: 'none'
});
return false
- }else if(!reg.test(this.data.userPhone)) {
+ } else if (!reg.test(this.data.userPhone)) {
wx.showToast({
title: '鎵嬫満鍙锋牸寮忎笉姝g‘',
icon: 'none'
});
return false
- }else if(!this.data.address) {
+ } else if (!this.data.address) {
wx.showToast({
title: '璇疯緭鍏ュ湴鍧�',
icon: 'none'
@@ -362,21 +367,91 @@
return false
}
let data = {
- deviceId: this.data.deviceList[this.data.deviceIndex].deviceId,
- erectoId: 0,
+ deviceId: this.data.deviceId,
+ erectoId: -1,
erectoName: '鏈寚娲�',
userName: this.data.userName,
userPhone: this.data.userPhone,
address: this.data.address,
- // appointmentTime:this.formatDate(this.data.time+':'+'00') ,
- appointmentTime:this.data.time+':'+'00',
- state: -1,
- orderType:'2'
+ appointmentTime: this.data.time + ':' + '00',
+ state: 0,
+ orderType: '2',
+ createUserId: this.data.tanantId,
+ userId: this.data.personInfo.userId,
+ repairFlag: 1,
+ description:this.data.description
}
console.log(data);
+ if (this.data.yetSub) {
+ data.id = this.data.personInfo.id
+ wx.request({
+ url: 'https://puyue.yhupai.com/prod-api/iot/deviceOrder',
+ method: "put",
+ header: {
+ "Access-Control-Allow-Headers": 'token',
+ Authorization: `Bearer ${wx.getStorageSync('token')}`
+ },
+ data: data,
+ success: (res, header) => {
+ console.log(res);
+ if (res.data.code != 200) {
+ wx.showToast({
+ title: res.data.msg,
+ icon: 'none'
+ });
+ } else {
+ wx.navigateBack()
+ }
+ }
+ })
+ } else {
+ wx.request({
+ url: 'https://puyue.yhupai.com/prod-api/iot/deviceOrder',
+ method: "POST",
+ header: {
+ "Access-Control-Allow-Headers": 'token',
+ Authorization: `Bearer ${wx.getStorageSync('token')}`
+ },
+ data: data,
+ success: (res, header) => {
+ console.log(res);
+ if (res.data.code != 200) {
+ wx.showToast({
+ title: res.data.msg,
+ icon: 'none'
+ });
+ } else {
+ wx.navigateBack()
+ }
+ }
+ })
+ }
+ console.log(data);
+
+ },
+ formatDate(dateStr) {
+ let date = new Date(dateStr);
+
+ let year = date.getFullYear();
+ let month = (date.getMonth() + 1).toString().padStart(2, '0'); // 娉ㄦ剰锛氭湀浠芥槸浠� 0 寮�濮嬬殑锛屾墍浠ラ渶瑕� +1
+ let day = date.getDate().toString().padStart(2, '0');
+ let hour = date.getHours().toString().padStart(2, '0');
+ let minute = date.getMinutes().toString().padStart(2, '0');
+ let second = date.getSeconds().toString().padStart(2, '0');
+ let millisecond = date.getMilliseconds().toString().padStart(3, '0');
+
+ return `${year}-${month}-${day}T${hour}:${minute}:${second}.${millisecond}Z`;
+ },
+ getShortList() {
+ // this.setData({
+ // manageList:[]
+ // })
+ let data = {
+ repairFlag: 0
+ }
wx.request({
- url: 'https://puyue.yhupai.com/prod-api/iot/deviceOrder',
- method: "POST",
+ url: 'https://puyue.yhupai.com/prod-api/iot/device/shortList',
+ method: "GET",
header: {
"Access-Control-Allow-Headers": 'token',
Authorization: `Bearer ${wx.getStorageSync('token')}`
@@ -389,43 +464,65 @@
icon: 'none'
});
} else {
- wx.navigateTo({
- url: '/pages/workOrder/workOrder',
+ let arr = res.data.rows
+ this.setData({
+ deviceList: arr
})
+
+ let dataDevice = []
+ for (let i = 0; i < this.data.deviceList.length; i++) {
+ dataDevice.push(this.data.deviceList[i].deviceName)
+ }
+ this.setData({
+ columns: dataDevice
+ })
+ // wx.setStorageSync('deviceList', arr)
}
}
})
},
- formatDate(dateStr) {
- let date = new Date(dateStr);
-
- let year = date.getFullYear();
- let month = (date.getMonth() + 1).toString().padStart(2, '0'); // 娉ㄦ剰锛氭湀浠芥槸浠� 0 寮�濮嬬殑锛屾墍浠ラ渶瑕� +1
- let day = date.getDate().toString().padStart(2, '0');
- let hour = date.getHours().toString().padStart(2, '0');
- let minute = date.getMinutes().toString().padStart(2, '0');
- let second = date.getSeconds().toString().padStart(2, '0');
- let millisecond = date.getMilliseconds().toString().padStart(3, '0');
-
- return `${year}-${month}-${day}T${hour}:${minute}:${second}.${millisecond}Z`;
- },
-
-
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
*/
onLoad(options) {
- this.setData({
- deviceList:wx.getStorageSync('deviceList')
- })
- let dataDevice = []
- for (let i = 0; i < this.data.deviceList.length; i++) {
- dataDevice.push(this.data.deviceList[i].productName)
- }
- this.setData({
- columns: dataDevice
- })
+ this.getShortList()
+ console.log(this.data.deviceList);
+
+ if (options.info) {
+ this.setData({
+ personInfo: JSON.parse(options.info),
+ yetSub: true
+ })
+ console.log(this.data.personInfo);
+ this.setData({
+ userName: this.data.personInfo.userName,
+ userPhone: this.data.personInfo.userPhone,
+ address: this.data.personInfo.address,
+ deviceName: this.data.personInfo.device.deviceName,
+ deviceId: this.data.personInfo.deviceId,
+ tanantId: this.data.personInfo.createUserId,
+ description:this.data.personInfo.description
+ })
+ for (let i = 0; i < this.data.deviceList.length; i++) {
+ console.log(this.data.deviceList[i], this.data.personInfo);
+ if (this.data.deviceList[i].deviceId == this.data.deviceId) {
+ this.setData({
+ deviceIndex: i
+ })
+ }
+ }
+ } else {
+ this.setData({
+ personInfo: wx.getStorageSync('userInfo')
+ })
+ this.setData({
+ userName: this.data.personInfo.nickName,
+ userPhone: this.data.personInfo.phonenumber,
+ address: this.data.personInfo.address,
+ })
+ }
+ console.log(this.data.personInfo);
},
/**
@@ -439,6 +536,7 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
*/
onShow() {
+
var loadPickerData = DatePickerUtil.loadPickerData()
var getCurrentDate = DatePickerUtil.getCurrentDate()
var GetMultiIndex = DatePickerUtil.GetMultiIndex()
--
Gitblit v1.8.0