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/workOrder/workOrder.js | 264 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 224 insertions(+), 40 deletions(-)
diff --git a/GoldC/pages/workOrder/workOrder.js b/GoldC/pages/workOrder/workOrder.js
index 9b4bbb3..6eec639 100644
--- a/GoldC/pages/workOrder/workOrder.js
+++ b/GoldC/pages/workOrder/workOrder.js
@@ -5,7 +5,7 @@
* 椤甸潰鐨勫垵濮嬫暟鎹�
*/
data: {
- tabs: [0, 2, 3] ,
+ form: {},
showPage: false,
showNull: false,
roleKey: wx.getStorageSync('roleKey'),
@@ -26,6 +26,13 @@
// totalPage:0,
index: 1,
total: 10,
+ modalHidden: true,
+ delModal: true,
+ info1: 0,
+ info2: 0,
+ info3: 0,
+ info4: 0,
+ delDeviceId: 0,
pageMask: false,
prevBtnDis: true,
@@ -49,7 +56,6 @@
})
}
},
-
// 璇︽儏灞曠ず
toxiangqin(e) {
console.log(e.target.dataset.id)
@@ -63,6 +69,49 @@
*/
onLoad: function (options) {
},
+
+ delAZ(e) {
+ console.log(e);
+ var item = e.currentTarget.dataset.base
+ this.setData({
+ delModal: false,
+ form: item,
+ })
+
+ },
+ DelChange() {
+ wx.request({
+ url: `https://puyue.yhupai.com/prod-api/iot/deviceOrder/${this.data.form.id}/${this.data.form.deviceId}`,
+ method: "DELETE",
+ header: {
+ "Access-Control-Allow-Headers": 'token',
+ Authorization: `Bearer ${wx.getStorageSync('token')}`
+ },
+ success: (res, header) => {
+ if (res.data.code == 200) {
+ this.setData({
+ index: 1,
+ delModal: true
+ })
+ this.getNumInfo()
+ this.getList()
+ } else {
+ this.setData({
+ index: 1,
+ delModal: true
+ })
+ this.getNumInfo()
+ this.getList()
+ }
+ }
+ })
+ },
+ DelCancel() {
+ this.setData({
+ delModal: true
+ })
+ },
+
// 璁剧疆寮傛璇锋眰涔嬪悗鐨勯〉闈€�佹�昏褰曟暟
setPage(index, total) {
this.setData({
@@ -111,10 +160,21 @@
},
//涓婁竴椤电偣鍑讳簨浠�
prevPage: function () {
- if (this.data.index <= 1) return;
+ if (this.data.index <= 1) {
+ this.setData({
+ prevBtnDis: false,
+ })
+ return false
+ }
+ if (this.data.index <= this.data.total) {
+ this.setData({
+ nextBtnDis: false,
+ })
+ }
let num = this.data.index - 1;
this.setData({
- index: num
+ index: num,
+ prevBtnDis: true
})
this.getList()
this.triggerParent();
@@ -123,7 +183,20 @@
},
//涓嬩竴椤电偣鍑讳簨浠�
nextPage: function () {
- if (this.data.index >= this.data.total) return;
+ if (this.data.index >= this.data.total) {
+ this.setData({
+ nextBtnDis: false,
+ })
+ return false
+ }
+ this.setData({
+ nextBtnDis: true,
+ })
+ if (this.data.index >= 1) {
+ this.setData({
+ prevBtnDis: false
+ })
+ }
let num = this.data.index + 1;
this.setData({
index: num
@@ -135,11 +208,17 @@
this.updateBtnDis();
},
onChange(event) {
- // this.setData({
- // state:this.data.tabs[event.detail.index]
- // })
- this.data.state=this.data.tabs[event.detail.index]
+ this.setData({
+ state: event.detail.index
+ })
+ this.getNumInfo()
this.getList()
+ },
+ goTop() { // 涓�閿洖鍒伴《閮�
+ wx.pageScrollTo({
+ scrollTop: 0,
+ duration: 300
+ });
},
getList() {
wx.showLoading({
@@ -152,9 +231,97 @@
var roleKey = wx.getStorageSync('roleKey')
let data = {
pageNum: this.data.index,
- pageSize: 10,
+ pageSize: 5,
state: this.data.state,
orderType: 2,
+ userId: erectoId
+ }
+ // if (roleKey == 'tenantservice') {
+ // data.createUserId = 0
+ // data.erectoId = erectoId
+ // }
+ // if (roleKey == 'admin') {
+ // data.createUserId = 0;
+ // data.erectoId = 0;
+ // }
+ // if (roleKey == 'tenant' || roleKey == 'tenanthelper') {
+ // data.createUserId = erectoId;
+ // data.erectoId = 0;
+ // }
+ // if (this.data.active2 == 1) { //褰撻�夋嫨涓嬬骇鏃禱
+ // data.createUserId = this.data.nextlevel
+ // }
+ console.log(data);
+ wx.request({
+ url: 'https://puyue.yhupai.com/prod-api/iot/deviceOrder/list',
+ method: "GET",
+ header: {
+ "Access-Control-Allow-Headers": 'token',
+ Authorization: `Bearer ${wx.getStorageSync('token')}`
+ },
+ data: data,
+ success: (res, header) => {
+ console.log(res);
+ if (res.data.code == 200 && res.data.rows.length > 0) {
+ let data = res.data
+ let total = Math.ceil(res.data.total / 5)
+ this.setData({
+ listdata: data.rows,
+ total: total,
+ showPage: true,
+ showNull: false
+ })
+ console.log(this.data.listdata);
+ this.goTop()
+ wx.hideLoading()
+ } else {
+ this.setData({
+ listdata: [],
+ total: 0,
+ showPage: false,
+ showNull: true
+ })
+ this.goTop()
+ wx.hideLoading()
+ }
+ }
+ })
+ },
+ openAddModal() {
+ let data = {
+ repairFlag: 0
+ }
+ wx.request({
+ url: 'https://puyue.yhupai.com/prod-api/iot/device/shortListRepair',
+ method: "GET",
+ header: {
+ "Access-Control-Allow-Headers": 'token',
+ Authorization: `Bearer ${wx.getStorageSync('token')}`
+ },
+ // data: data,
+ success: (res, header) => {
+ if (res.data.code != 200 || res.data.rows.length == 0) {
+ wx.showToast({
+ title: '璇峰厛娣诲姞璁惧',
+ icon:'none'
+ })
+ return false
+ } else {
+ wx.navigateTo({
+ url: '/pages/repairTicketDetail/repairTicketDetail',
+ })
+ }
+ }
+ })
+
+ },
+ getNumInfo() {
+ var erectoId = wx.getStorageSync("erectoId")
+ var roleKey = wx.getStorageSync('roleKey')
+ let data = {
+ orderType: '2',
+ userId: erectoId,
+ // state:this.data.state
}
if (roleKey == 'tenantservice') {
data.createUserId = 0
@@ -171,9 +338,8 @@
if (this.data.active2 == 1) { //褰撻�夋嫨涓嬬骇鏃禱
data.createUserId = this.data.nextlevel
}
- console.log(data);
wx.request({
- url: 'https://puyue.yhupai.com/prod-api/iot/deviceOrder/list',
+ url: `https://puyue.yhupai.com/prod-api/iot/deviceOrder/get`,
method: "GET",
header: {
"Access-Control-Allow-Headers": 'token',
@@ -181,45 +347,62 @@
},
data: data,
success: (res, header) => {
- if (res.data.code == 200 && res.data.rows.length > 0) {
-
- let data = res.data
- let total = Math.ceil(res.data.total / 10)
+ if (res.data.code == 200) {
+ console.log(res);
this.setData({
- listdata: data.rows,
- total: total,
- showPage:true,
- showNull:false
+ info1: res.data.data.deviceOrderUndeliveredorders,
+ info2: res.data.data.deviceOrderDispatchedorders,
+ info3: res.data.data.deviceOrderReceivedorders,
+ info4: res.data.data.deviceOrderCompleted,
})
- console.log(this.data.listdata)
- wx.hideLoading()
-
} else {
this.setData({
- listdata: [],
- total: 0,
- showPage:false,
- showNull:true
+ info1: 0,
+ info2: 0,
+ info3: 0,
+ info4: 0,
})
- wx.hideLoading()
}
}
})
},
- openAddModal(){
- let deviceList=wx.getStorageSync('deviceList')
- if(deviceList.length>0){
- wx.navigateTo({
- url: '/pages/repairTicketDetail/repairTicketDetail',
- })
- }else{
- wx.showToast({
- title: '璇峰厛娣诲姞璁惧',
- })
+ rate(e) {
+ let item = JSON.parse(JSON.stringify(e.currentTarget.dataset.base))
+ let data = {
+ id: item.id,
+ userId: item.userId,
+ orderType: item.orderType,
+ isRate: 0,
}
-
+ wx.navigateTo({
+ url: `/pages/rate/rate?params=${JSON.stringify(data)}`,
+ })
},
-
+ seeRate(e) {
+ // let item = JSON.parse(JSON.stringify(e.currentTarget.dataset.base))
+ // let data = {
+ // id: item.id,
+ // userId: item.userId,
+ // orderType: item.orderType,
+ // isRate:1,
+ // score:item.score,
+ // evaluate:item.evaluate
+ // }
+ // wx.navigateTo({
+ // url: `/pages/rate/rate?params=${JSON.stringify(data)}`,
+ // })
+ let item = JSON.parse(JSON.stringify(e.currentTarget.dataset.base))
+ wx.navigateTo({
+ url: '/pages/yetWX/yetWX?info=' + JSON.stringify(item),
+ })
+ },
+ edit(e) {
+ console.log(e);
+ var item = e.currentTarget.dataset.base
+ wx.navigateTo({
+ url: '/pages/repairTicketDetail/repairTicketDetail?info=' + JSON.stringify(item),
+ })
+ },
/**
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
*/
@@ -230,6 +413,7 @@
* 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
*/
onShow: function () {
+ this.getNumInfo()
this.getList()
},
--
Gitblit v1.8.0