var dateTimePicker = require('../../utils/dateTimePicker.js'); //日期控件
|
var WxSearch = require('../../components/wxSearch/wxSearch');
|
var Constant = require('../../utils/constant.js');
|
var fun = require('../../utils/function.js');
|
var util = require('../../utils/util');
|
import Request from "../../utils/api"
|
var app = getApp();
|
|
|
Page({
|
data: {
|
floatMenu: {
|
animation: '',
|
bindtaps: "expand_floatMenu"
|
},
|
tabIndex: 1,
|
currentCorpID: 1,
|
currentEmployeeID: 1, //当前用户ID
|
listUnApprove:{
|
bottomStatus: false, //是否到底部
|
hasUnApproveData: true, // 是否有待确认的订单数据
|
startDate: util.formatDay(util.GetBeforeDate(7)), //开始时间
|
//endDate: util.formatDay(new Date()), //结束时间
|
endDate: util.formatDay(util.GetNextDate(new Date(), 1)), //结束时间
|
PageIndex: 1, //当前页数
|
PageSize: 20, //每页数据数量
|
dataList:[]
|
},
|
listIng:{
|
bottomStatus: false, //是否到底部
|
hasProgressData: true, // 是否有进行中的订单数据
|
startDate: util.formatDay(util.GetBeforeDate(7)), //开始时间
|
//endDate: util.formatDay(new Date()), //结束时间
|
endDate: util.formatDay(util.GetNextDate(new Date(), 1)), //结束时间
|
PageIndex: 1, //当前页数
|
PageSize: 20, //每页数据数量
|
dataList:[]
|
},
|
listFinish:{
|
bottomStatus: false, //是否到底部
|
hasFinishData: true, // 是否有进行中的订单数据
|
startDate: util.formatDay(util.GetBeforeDate(7)), //开始时间
|
//endDate: util.formatDay(new Date()), //结束时间
|
endDate: util.formatDay(util.GetNextDate(new Date(), 1)), //结束时间
|
PageIndex: 1, //当前页数
|
PageSize: 20, //每页数据数量
|
dataList:[]
|
},
|
sort: {
|
onClick: "sortDown",
|
text: "降序"
|
}, //排序
|
|
/** */
|
showsearch: false, //显示搜索按钮
|
searchtext: '', //搜索文字
|
filterdata: {}, //筛选条件数据
|
showfilter: false, //是否显示下拉筛选
|
showfilterindex: null, //显示哪个筛选类目
|
sortindex: 0, //排序索引
|
sortid: null, //排序id
|
filter: {},
|
productlist: [], //产品列表
|
scrolltop: null, //滚动位置
|
previewMode: false, // 图片预览模式
|
isShowFooter: false,
|
// 当前预览索引
|
previewIndex: 0, // 图片预览模式
|
|
isShowSelStation: false,
|
coordinate: [0, 0]
|
},
|
//
|
onLoad: function (options) {
|
var userInfo = app.globalData.userInfo;
|
// if (userInfo && userInfo.EmployeeID) {
|
// this.setData({
|
// currentCorpID: userInfo.CorpID,
|
// currentEmployeeID: userInfo.EmployeeID
|
// });
|
// } else {
|
// wx.navigateTo({
|
// url: '/login/login/index',
|
// });
|
// return;
|
// }
|
// console.log(userInfo)
|
//
|
this.intialUnApproveList();
|
//
|
this.intialSearch();
|
//获取当前日期
|
this.dateTimePicker();
|
},
|
onShareAppMessage: function () {
|
return Constant.Share;
|
},
|
//外部页面调用刷新
|
refreshRepairInfo: function () {
|
let tabIndex = this.data.tabIndex
|
if(tabIndex == 1){
|
this.setData({
|
"listUnApprove.dataList":[],
|
"listUnApprove.PageIndex":1,
|
"listUnApprove.PageSize":20,
|
})
|
this.intialUnApproveList();
|
}else if(tabIndex == 2){
|
this.setData({
|
"listIng.dataList":[],
|
"listIng.PageIndex":1,
|
"listIng.PageSize":20,
|
})
|
this.initialProgressList();
|
}else if(tabIndex == 3){
|
this.setData({
|
"listFinish.dataList":[],
|
"listFinish.PageIndex":1,
|
"listFinish.PageSize":20,
|
})
|
this.initialFinishList()
|
}
|
},
|
//获取我的待确定订单
|
intialUnApproveList: function () {
|
//console.log(Constant.BASE_SERVER_URL + "Repair/Mobile/TaskForm/GetList4RepairEmployee",
|
//this.data.currentCorpID,
|
//this.data.currentEmployeeID);
|
var that = this;
|
Request({
|
url: Constant.BASE_SERVER_URL + "Repair/Task/Form/GetMyAssignedPageList@V1.0",
|
method: 'GET',
|
data: {
|
|
StartTime: "",
|
EndTime: "",
|
PageIndex : that.data.listUnApprove.PageIndex,
|
PageSize:that.data.listUnApprove.PageSize,
|
},
|
header: {
|
'content-type': 'application/json'
|
},
|
fail: function (err) {
|
// wx.showModal({
|
// title: '',
|
// content: '通讯失败',
|
// })
|
}, //请求失败
|
complete: function () {}, //请求完成后执行的函数
|
success: function (res) {
|
// console.log(res.data,101)
|
var result = res.data;
|
if (result.Code != 0) {
|
wx.showModal({
|
title: '',
|
content: result.message,
|
});
|
return;
|
}
|
var allList = result.Data.List;
|
if (allList.length == 0) {
|
wx.showToast({
|
title: '未有您的维修记录',
|
icon:"none",
|
duration:1000
|
})
|
that.setData({
|
"listUnApprove.hasUnApproveData":false
|
})
|
return;
|
}
|
var listUnApprove = [];
|
for (var i in allList) {
|
var item = allList[i];
|
// if (item.FormStatus == 10) { //派单
|
// listUnApprove.push(item)
|
// } else if (item.FormStatus == 200) {
|
// //item.FormStatusName = "已验收";
|
// listFinish.push(item)
|
// } else if (item.FormStatus == 100) {
|
// item.CheckTime = "已完工,待验收";
|
// listFinish.push(item)
|
// } else {
|
// if (item.FormStatus == 20) { //接单
|
// item.FormStatusName = "已接单,待开工";
|
// } else if (item.FormStatus == 40) { //已开工 维修中
|
// item.FormStatusName = "维修中";
|
// } else if (item.FormStatus == 41) { //暂停
|
// item.FormStatusName = "已暂停,待重启";
|
// }
|
// //console.log(item)
|
// listIng.push(item);
|
// }
|
listUnApprove.push(item)
|
}
|
|
if (that.data.listUnApprove.PageIndex * that.data.listUnApprove.PageSize > res.data.Data.Total) {
|
that.setData({
|
"listUnApprove.bottomStatus": true,
|
"listUnApprove.hasUnApproveData": false,
|
"listUnApprove.dataList": that.data.listUnApprove.dataList.concat(listUnApprove),
|
})
|
// console.log(listIng,241)
|
return;
|
}
|
var pageIndex = that.data.listUnApprove.PageIndex
|
//
|
that.setData({
|
"listUnApprove.hasUnApproveData": true,
|
"listUnApprove.dataList": that.data.listUnApprove.dataList.concat(listUnApprove),
|
"listUnApprove.PageIndex": pageIndex++
|
});
|
// console.log(listIng)
|
}
|
});
|
},
|
//获取我的进行中的订单
|
initialProgressList:function(){
|
var that = this;
|
Request({
|
url: Constant.BASE_SERVER_URL + "Repair/Task/Form/GetMyProgressPageList@V1.0",
|
method: 'GET',
|
data: {
|
StartTime: "",
|
EndTime: "",
|
PageIndex : that.data.listIng.PageIndex,
|
PageSize:that.data.listIng.PageSize,
|
},
|
header: {
|
'content-type': 'application/json'
|
},
|
fail: function (err) {
|
console.log(err)
|
wx.showModal({
|
title: '',
|
content: '通讯失败',
|
})
|
}, //请求失败
|
complete: function () {}, //请求完成后执行的函数
|
success: function (res) {
|
// console.log(res.data,210)
|
var result = res.data;
|
if (result.Code != 0) {
|
wx.showModal({
|
title: '',
|
content: result.message,
|
});
|
return;
|
}
|
var allList = result.Data.List;
|
if (allList.length == 0) {
|
wx.showToast({
|
title: '未有您进行中的维修单',
|
icon:"none",
|
duration:1000
|
})
|
that.setData({
|
"listIng.hasProgressData":false
|
})
|
return;
|
}
|
var listIng = [];
|
for (var i in allList) {
|
var item = allList[i];
|
listIng.push(item)
|
}
|
|
if (that.data.listIng.PageIndex * that.data.listIng.PageSize > res.data.Data.Total) {
|
that.setData({
|
"listIng.bottomStatus": true,
|
"listIng.hasProgressData": false,
|
"listIng.dataList": that.data.listIng.dataList.concat(listIng),
|
})
|
// console.log(listIng,274)
|
return;
|
}
|
var pageIndex = that.data.listIng.PageIndex
|
//
|
that.setData({
|
"listIng.hasProgressData": true,
|
"listIng.dataList": that.data.listIng.dataList.concat(listIng),
|
"listIng.PageIndex": pageIndex++
|
});
|
// console.log(listIng)
|
}
|
});
|
},
|
//获取我的已完成订单
|
initialFinishList:function(){
|
var that = this;
|
Request({
|
url: Constant.BASE_SERVER_URL + "Repair/Task/Form/GetMyHasFinishedPageList@V1.0",
|
method: 'GET',
|
data: {
|
StartTime: that.data.listFinish.startDate,
|
EndTime: that.data.listFinish.endDate,
|
PageIndex : that.data.listFinish.PageIndex,
|
PageSize:that.data.listFinish.PageSize,
|
},
|
header: {
|
'content-type': 'application/json'
|
},
|
fail: function (err) {
|
console.log(err)
|
wx.showModal({
|
title: '',
|
content: '通讯失败',
|
})
|
}, //请求失败
|
complete: function () {}, //请求完成后执行的函数
|
success: function (res) {
|
// console.log(res.data,312)
|
var result = res.data;
|
if (result.Code != 0) {
|
wx.showModal({
|
title: '',
|
content: result.message,
|
});
|
return;
|
}
|
var allList = result.Data.List;
|
if (allList.length == 0) {
|
wx.showToast({
|
title: '未有您已完成的维修单',
|
icon:"none",
|
duration:1000
|
})
|
that.setData({
|
"listFinish.hasFinishData":false
|
})
|
return;
|
}
|
var listFinish = [];
|
for (var i in allList) {
|
var item = allList[i];
|
listFinish.push(item)
|
}
|
|
if (that.data.listFinish.PageIndex * that.data.listFinish.PageSize > res.data.Data.Total) {
|
that.setData({
|
"listFinish.bottomStatus": true,
|
"listFinish.hasFinishData": false,
|
"listFinish.dataList": that.data.listFinish.dataList.concat(listFinish),
|
})
|
// console.log(listIng,241)
|
return;
|
}
|
var pageIndex = that.data.listFinish.PageIndex
|
//
|
that.setData({
|
"listFinish.hasProgressData": true,
|
"listFinish.dataList": that.data.listFinish.dataList.concat(listFinish),
|
"listFinish.PageIndex": pageIndex++
|
});
|
// console.log(listIng,355)
|
}
|
});
|
},
|
//
|
tabFun(e) {
|
var y_index = e.currentTarget.dataset.index;
|
//console.log(y_index,this.data.list)
|
if(y_index == 1){
|
this.intialUnApproveList()
|
this.setData({
|
tabIndex: e.currentTarget.dataset.index,
|
"listUnApprove.dataList":[],
|
sort: {
|
onClick: "sortDown",
|
text: "降序"
|
} //排序
|
});
|
}
|
if(y_index == 2){
|
this.setData({
|
tabIndex: e.currentTarget.dataset.index,
|
"listIng.dataList":[],
|
sort: {
|
onClick: "sortDown",
|
text: "降序"
|
} //排序
|
});
|
this.initialProgressList()
|
return
|
}
|
if (y_index == 3) {
|
this.setData({
|
tabIndex: e.currentTarget.dataset.index,
|
"listFinish.dataList":[],
|
sort: {
|
onClick: "sortDown",
|
text: "筛选"
|
} //排序
|
});
|
this.initialFinishList()
|
return;
|
}
|
},
|
|
expand_floatMenu: function () {
|
this.setData({
|
floatMenu: {
|
animation: 'animation',
|
bindtaps: "unExpand_floatMenu"
|
}
|
})
|
},
|
unExpand_floatMenu: function () {
|
this.setData({
|
floatMenu: {
|
animation: 'animations',
|
bindtaps: "expand_floatMenu"
|
}
|
})
|
},
|
tapUnProveItem(e) {
|
console.log(e.currentTarget.dataset);
|
var taskformid = e.currentTarget.dataset.taskformid;
|
var requestformid = e.currentTarget.dataset.requestformid;
|
wx.navigateTo({
|
url: '/repair/receiveTask/index?requestformid=' + requestformid + "&taskformid=" + taskformid,
|
});
|
},
|
tapFinishItem(e) {
|
//console.log(e.currentTarget.dataset);
|
var taskformid = e.currentTarget.dataset.taskformid;
|
var requestformid = e.currentTarget.dataset.requestformid;
|
wx.navigateTo({
|
url: '/repair/taskFinishDetail/index?requestformid=' + requestformid + "&taskformid=" + taskformid,
|
});
|
},
|
tapIngItem(e) {
|
console.log(e.currentTarget.dataset);
|
var taskformid = e.currentTarget.dataset.taskformid;
|
var requestformid = e.currentTarget.dataset.requestformid;
|
var formStatus = e.currentTarget.dataset.formstatus;
|
// console.log(formStatus, requestformid, taskformid,437);
|
//已接单,下一步到场开工
|
if (formStatus == 20) {
|
wx.navigateTo({
|
url: '/repair/startTask/index?requestformid=' + requestformid + "&taskformid=" + taskformid
|
});
|
} else if (formStatus == 40 || formStatus == 41 || formStatus == 42) { //到场或 暂停
|
wx.navigateTo({
|
url: '/repair/ingTask/index?requestformid=' + requestformid + "&taskformid=" + taskformid
|
});
|
} else { //
|
|
}
|
|
},
|
|
//刷新
|
tapRefreshBtn() {
|
|
wx.showToast({
|
title: '刷新成功',
|
icon: 'none',
|
});
|
// this.initialFinishList()
|
},
|
//切换
|
tranRoleBtn() {
|
return;
|
var user_demo = ''
|
wx.showActionSheet({
|
itemList: ['报修人', '维修员', '管理员'],
|
success(res) {
|
if (res.tapIndex == 0) {
|
user_demo = "报修人"
|
} else if (res.tapIndex == 1) {
|
user_demo = "维修员"
|
} else if (res.tapIndex == 2) {
|
user_demo = "管理员"
|
}
|
wx.setStorage({
|
key: 'user_demo',
|
data: user_demo
|
})
|
|
wx.switchTab({
|
url: '/workDesktop/index/index',
|
})
|
},
|
fail(res) {
|
console.log(res.errMsg)
|
}
|
})
|
},
|
|
|
|
|
|
|
|
|
|
|
/**升序 降序
|
* console.log(this.data.listUnApprove, 234)
|
console.log(this.data.listIng, 235)
|
console.log(this.data.listFinish, 236)
|
*/
|
sortUp(e) {
|
var tabindex = e.currentTarget.dataset.tabindex;
|
var listUnApprove = this.data.listUnApprove;
|
var listIng = this.data.listIng;
|
var listFinish = this.data.listFinish;
|
if (tabindex == 1) {
|
listUnApprove.dataList.sort(util.pcompare("AssignTime", false));
|
this.setData({
|
sort: {
|
onClick: "sortDown",
|
text: "降序"
|
},
|
listUnApprove: listUnApprove
|
})
|
return;
|
} else if (tabindex == 2) {
|
listIng.dataList.sort(util.pcompare("AssignTime", false));
|
this.setData({
|
sort: {
|
onClick: "sortDown",
|
text: "降序"
|
},
|
listIng: listIng
|
})
|
return;
|
} else if (tabindex == 3) {
|
this.setData({
|
sort: {
|
onClick: "sortDown",
|
text: "展开"
|
},
|
// listFinish: listFinish
|
})
|
return;
|
}
|
},
|
sortDown(e) {
|
var tabindex = e.currentTarget.dataset.tabindex;
|
var listUnApprove = this.data.listUnApprove;
|
var listIng = this.data.listIng;
|
var listFinish = this.data.listFinish;
|
// console.log(tabindex, listUnApprove, listIng, listFinish);
|
if (tabindex == 1) {
|
listUnApprove.dataList.sort(util.pcompare("AssignTime"));
|
this.setData({
|
sort: {
|
onClick: "sortUp",
|
text: "升序"
|
},
|
listUnApprove: listUnApprove
|
})
|
return;
|
} else if (tabindex == 2) {
|
listIng.dataList.sort(util.pcompare("AssignTime"));
|
this.setData({
|
sort: {
|
onClick: "sortUp",
|
text: "升序"
|
},
|
listIng: listIng
|
})
|
return;
|
} else if (tabindex == 3) {
|
this.setData({
|
sort: {
|
onClick: "sortUp",
|
text: "收起"
|
},
|
// listFinish: listFinish
|
})
|
return;
|
}
|
},
|
|
|
|
|
|
|
|
|
/**search */
|
intialSearch() {
|
this.fetchFilterData();
|
|
var that = this;
|
|
//初始化的时候渲染wxSearchdata
|
var initial4FilterParas4cache = wx.getStorageSync('Initial4FilterParas');
|
if (initial4FilterParas4cache) {
|
//console.log("from cache")
|
WxSearch.init(that, 43, initial4FilterParas4cache.HotKeys);
|
WxSearch.initMindKeys(initial4FilterParas4cache.MindKeys);
|
} else {
|
return;
|
wx.request({
|
url: Constant.ProductLibrary_SERVER_URL,
|
method: 'GET',
|
data: {
|
cmd: "Initial4FilterParas"
|
},
|
header: {
|
'content-type': 'application/json'
|
},
|
success: function (res) {
|
|
WxSearch.init(that, 43, res.data.HotKeys);
|
WxSearch.initMindKeys(res.data.MindKeys);
|
|
wx.setStorage({
|
key: 'Initial4FilterParas',
|
data: res.data
|
});
|
}
|
});
|
}
|
},
|
|
|
|
|
|
|
|
|
|
|
wxSearchFn: function (e) {
|
var that = this
|
WxSearch.wxSearchAddHisKey(that);
|
console.log(that, this.data.wxSearchData.value)
|
this.fetchProductData(this.data.wxSearchData.value);
|
},
|
wxSearchInput: function (e) {
|
var that = this
|
WxSearch.wxSearchInput(e, that);
|
//this.fetchProductData(this.data.wxSearchData.value);
|
},
|
wxSerchFocus: function (e) {
|
var that = this
|
WxSearch.wxSearchFocus(e, that);
|
|
},
|
wxSearchBlur: function (e) {
|
var that = this
|
WxSearch.wxSearchBlur(e, that);
|
},
|
wxSearchKeyTap: function (e) {
|
var that = this
|
WxSearch.wxSearchKeyTap(e, that);
|
this.fetchProductData(this.data.wxSearchData.value);
|
},
|
wxSearchDeleteKey: function (e) {
|
var that = this
|
WxSearch.wxSearchDeleteKey(e, that);
|
},
|
wxSearchDeleteAll: function (e) {
|
var that = this;
|
WxSearch.wxSearchDeleteAll(that);
|
},
|
wxSearchTap: function (e) {
|
var that = this
|
WxSearch.wxSearchHiddenPancel(that);
|
},
|
fetchFilterData: function () { //获取筛选条件
|
this.setData({
|
filterdata: {
|
"sort": [{
|
"id": 0,
|
"title": "默认"
|
},
|
{
|
"id": 1,
|
"title": "厂家"
|
},
|
{
|
"id": 2,
|
"title": "系列名"
|
},
|
],
|
"pumpType": [{
|
"id": 0,
|
"title": "离心泵"
|
},
|
{
|
"id": 1,
|
"title": "容积泵"
|
},
|
{
|
"id": 2,
|
"title": "混流泵"
|
}
|
|
],
|
"hangye": [{
|
"id": 0,
|
"title": "污水"
|
},
|
{
|
"id": 1,
|
"title": "化工"
|
},
|
{
|
"id": 2,
|
"title": "建筑"
|
},
|
{
|
"id": 3,
|
"title": "供水"
|
},
|
{
|
"id": 4,
|
"title": "排污"
|
},
|
{
|
"id": 5,
|
"title": "农业"
|
},
|
],
|
}
|
})
|
},
|
fetchProductData: function (keyWrd) { //获取产品列表
|
if (keyWrd == null || keyWrd == "")
|
return;
|
if (keyWrd.length < 2)
|
return;
|
var that = this;
|
|
this.setData({
|
isShowFooter: true
|
});
|
|
return;
|
wx.request({
|
url: Constant.ProductLibrary_SERVER_URL,
|
method: 'GET',
|
data: {
|
cmd: "GetByFilter",
|
KeyWrd: keyWrd
|
},
|
header: {
|
'content-type': 'application/json'
|
},
|
success: function (res) {
|
//console.log(res)
|
var productList = res.data;
|
//console.log(productList);
|
//return;
|
|
if (productList.length == 0) {
|
wx.showToast({ //期间为了显示效果可以添加一个过度的弹出框提示“加载中”
|
title: '未砸到',
|
icon: 'success',
|
duration: 300
|
});
|
return;
|
}
|
|
|
|
|
wx.showLoading({ //期间为了显示效果可以添加一个过度的弹出框提示“加载中”
|
title: '加载中',
|
icon: 'loading',
|
});
|
|
setTimeout(() => {
|
that.setData({
|
productlist: productList
|
});
|
wx.hideLoading();
|
}, 800);
|
|
}
|
|
});
|
|
|
|
|
|
},
|
//展开筛选面板
|
setFilterPanel: function (e) {
|
const d = this.data;
|
const i = e.currentTarget.dataset.findex;
|
if (d.showfilterindex == i) {
|
this.setData({
|
showfilter: false,
|
showfilterindex: null
|
})
|
} else {
|
this.setData({
|
showfilter: true,
|
showfilterindex: i,
|
})
|
}
|
},
|
//关闭筛选面板
|
hideFilter: function () {
|
this.setData({
|
showfilter: false,
|
showfilterindex: null
|
})
|
},
|
clickItemBtn: function (e) {
|
console.log(e.target.dataset)
|
//wx.navigateTo({
|
// url: '../new/new?id=' + e.target.dataset.id,
|
//});
|
},
|
//选择排序方式
|
setSort: function (e) {
|
const d = this.data;
|
const dataset = e.currentTarget.dataset;
|
this.setData({
|
sortindex: dataset.sortindex,
|
sortid: dataset.sortid
|
})
|
console.log('排序方式id:' + this.data.sortid);
|
},
|
|
|
|
|
//选择类型
|
chooseProductType: function (e) {
|
this.setData({
|
filter: Object.assign({}, this.data.filter, {
|
typeid: e.currentTarget.dataset.id
|
})
|
})
|
console.log('选择的类型id:' + this.data.filter.containid);
|
},
|
//选择行业
|
chooseHangYe: function (e) {
|
const hangyes = this.data.filter.hangyes || [];
|
const eid = e.currentTarget.dataset.id;
|
this.setData({
|
filter: Object.assign({}, this.data.filter, {
|
hangyes: hangyes.indexOf(eid) > -1 ? hangyes.filter(i => i != eid) : hangyes.concat([eid])
|
})
|
})
|
console.log('选择的行业id:' + this.data.filter.hangyes);
|
},
|
setClass: function (e) { //设置选中设备样式
|
return this.data.filter.hangyes.indexOf(e.currentTarget.dataset.id) > -1 ? 'active' : ''
|
},
|
cleanFilter: function () { //清空筛选条件
|
this.setData({
|
filter: {}
|
})
|
},
|
submitFilter: function () { //提交筛选条件
|
console.log(this.data.filter);
|
},
|
scrollHandle: function (e) { //滚动事件
|
/* this.setData({
|
scrolltop: e.detail.scrollTop
|
})*/
|
},
|
|
|
inputSearch: function (e) { //输入搜索文字
|
this.setData({
|
showsearch: e.detail.cursor > 0,
|
searchtext: e.detail.value
|
})
|
},
|
submitSearch: function () { //提交搜索
|
console.log(this.data.searchtext);
|
this.fetchServiceData();
|
},
|
|
// 进入预览模式
|
enterPreviewMode(event) {
|
let productid = event.target.dataset.productid;
|
//console.log(productid)
|
let ids = this.data.productlist.map(media => media.ID);
|
//console.log(ids)
|
let previewIndex = ids.indexOf(productid);
|
//console.log(previewIndex)
|
this.setData({
|
previewMode: true,
|
previewIndex
|
});
|
},
|
|
// 退出预览模式
|
leavePreviewMode() {
|
this.setData({
|
previewMode: false,
|
previewIndex: 0
|
});
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** */
|
closePopUpSelStation() {
|
this.setData({
|
isShowSelStation: false
|
})
|
},
|
|
stationChange(e) {
|
//
|
var selRegionIndex = e.detail.value[0];
|
var selStationIndex = e.detail.value[0];
|
// console.log(e.detail.value)
|
|
var allRegion = this.data.allRegionList;
|
var allStation = this.data.allStationList;
|
|
var sel_region_id = allRegion[selRegionIndex].ID;
|
var filterStationList = [];
|
for (var i = 0; i < allStation.length; i++) {
|
if (sel_region_id == allStation[i].ParentID) {
|
filterStationList.push(allStation[i])
|
}
|
}
|
//console.log(e.detail.value)
|
//此时还是选择,还未确认
|
this.setData({
|
selStationIndexArr: e.detail.value,
|
filterStationList: filterStationList
|
});
|
},
|
|
// 点击选择泵站 取消按钮
|
cancelSelStation(e) {
|
this.setData({
|
isShowSelStation: false
|
})
|
},
|
// 点击选择泵站 确定按钮
|
commitSelStation(e) {
|
var that = this;
|
this.setData({
|
isShowSelStation: false
|
})
|
//
|
var selRegionIndex = this.data.selStationIndexArr[0];
|
var selStationIndex = this.data.selStationIndexArr[1]; ////第一个成员是区域index 第二个成员是泵站索引
|
var filterStationList = this.data.filterStationList;
|
var coordinate = this.data.selStationIndexArr;
|
var allRegion = this.data.allRegionList;
|
var selRegion = allRegion[selRegionIndex];
|
var selStation = filterStationList[selStationIndex];
|
var picker_view_start = this.data.picker_view_start;
|
// console.log(selRegion, selStation, 773)
|
this.setData({
|
tailorism: selRegion.Name + '---' + selStation.Name,
|
coordinate: coordinate
|
});
|
|
|
//初始化产品列表
|
// this.initialProductListInStation(selStation.ID, 0);
|
|
},
|
|
//获取日期
|
dateTimePicker: function () {
|
var that = this;
|
var setDateStart = dateTimePicker.getDate(1);
|
var setDateEnd = dateTimePicker.getDate();
|
//console.log('起始日期', setDateStart, '结束日期', setDateEnd)
|
|
that.setData({
|
dateStart: setDateStart,
|
dateEnd: setDateEnd,
|
startDate: setDateStart,
|
endDate: setDateEnd
|
});
|
},
|
|
|
|
//获取开始日期
|
changeDateStart(e) {
|
this.setData({
|
"listFinish.startDate": e.detail.value,
|
"listFinish.PageIndex":1,
|
"listFinish.PageSize":20,
|
"listFinish.dataList":[]
|
});
|
this.initialFinishList()
|
},
|
|
//获取结束日期
|
changeDateEnd(e) {
|
this.setData({
|
"listFinish.endDate": e.detail.value,
|
"listFinish.PageIndex":1,
|
"listFinish.PageSize":20,
|
"listFinish.dataList":[]
|
});
|
this.initialFinishList()
|
},
|
|
|
//选择报修人
|
onApplicantBtn(e) {
|
var that = this;
|
that.initialStationTree();
|
that.setData({
|
isShowSelStation: true
|
})
|
return;
|
},
|
initialStationTree(selDefaultStationId, selDefaultProductId) {
|
return;
|
if (selDefaultStationId == null || selDefaultStationId == "")
|
selDefaultStationId = 0;
|
var that = this;
|
wx.request({
|
url: Constant.BASE_SERVER_URL + "Station/Service/MiniProgramHandler.ashx",
|
method: 'GET',
|
data: {
|
SoftType: Constant.SoftType,
|
PortType: Constant.PortType,
|
CorpID: this.data.currentCorpID,
|
UserID: this.data.currentEmployeeID
|
},
|
header: {
|
'content-type': 'application/json'
|
},
|
fail: function (err) {}, //请求失败
|
success: function (res) {
|
if (res.data.Status == "error" || res.data.Status == "exception") {
|
wx.showModal({
|
title: '',
|
content: res.data.Info,
|
})
|
return;
|
}
|
|
//
|
var selStationIndexArray = that.data.coordinate;
|
var allStation = res.data.StationList;
|
var allRegion = res.data.RegionList;
|
// console.log(selStationIndexArray, that.data.coordinate, allRegion, 652)
|
//默认选择的泵站
|
var selStationIndex = selStationIndexArray[0];
|
var sel_region_id = allRegion[selStationIndex].ID;
|
var selStationIndexArr = selStationIndexArray; //默认第一个
|
var filterStationList = []; //选择第一个区域下的泵站
|
//console.log(allStation)
|
for (var i = 0; i < allStation.length; i++) {
|
if (sel_region_id == allStation[i].ParentID) {
|
filterStationList.push(allStation[i]);
|
}
|
}
|
that.setData({
|
allRegionList: allRegion,
|
allStationList: allStation,
|
filterStationList: filterStationList,
|
selStationIndexArr: selStationIndexArr
|
});
|
|
if (selDefaultStationId > 0) {
|
that.setSelStation(selDefaultStationId, selDefaultProductId);
|
}
|
}
|
});
|
},
|
|
/**filterProductList */
|
onApplicantBtnCode(e) {
|
var that = this;
|
var Code = ["CDL32-40-2", "CDL32-40", "CDL32-30-2", "CDL32-20", "CDL32-60-2"];
|
wx.showActionSheet({
|
itemList: Code,
|
itemColor: '#16b5cb',
|
success: function (res) {
|
var index = res.tapIndex;
|
that.setData({
|
filterProductListCode: Code[index]
|
})
|
return;
|
},
|
fail: function (res) {},
|
})
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|