diff --git a/app.json b/app.json
index cb6b4b9..6f72462 100644
--- a/app.json
+++ b/app.json
@@ -86,7 +86,9 @@
"pages/inspect/handle",
"pages/train/access",
"pages/dickey/treeselect",
- "pages/troublefollow/index"
+ "pages/troublefollow/index",
+ "pages/troublefollow/handle",
+ "pages/troublefollow/detail"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/pages/troublefollow/detail.js b/pages/troublefollow/detail.js
new file mode 100644
index 0000000..e1c2f61
--- /dev/null
+++ b/pages/troublefollow/detail.js
@@ -0,0 +1,84 @@
+// pages/inspect/detail.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ wx.request({
+ url: getApp().globalData.serverUrl + 'api/troublefollowtask?a=detail&id=' + options.id,
+ header: {
+ 'content-type': 'application/json', //
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ method: 'GET',
+ success: res => {
+ if (res.statusCode === 200) {
+ this.setData(res.data)
+ }
+ }
+ })
+ },
+ previewImage: function (e) {
+ var current = e.target.dataset.src
+ wx.previewImage({
+ current: current,
+ urls: [current]
+ })
+ },
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/troublefollow/detail.json b/pages/troublefollow/detail.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/troublefollow/detail.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/troublefollow/detail.wxml b/pages/troublefollow/detail.wxml
new file mode 100644
index 0000000..3c0fd2f
--- /dev/null
+++ b/pages/troublefollow/detail.wxml
@@ -0,0 +1,48 @@
+隐患跟踪任务信息
+
+
+ 隐患编号
+
+ {{trouble__yhnum}}
+
+
+
+ 网格级别
+ {{gridlevel__dickeyname}}
+
+
+ 任务开启
+ {{taskadd}}
+
+
+ 任务关闭
+ {{taskexpire}}
+
+
+
+ 跟踪备注
+
+ {{tasknote}}
+
+
+
+
+ 任务状态
+
+ 已执行
+ 未执行
+
+
+
+ 执行时间
+ {{taskdo}}
+
+
+
+ 跟踪描述
+
+ {{desc}}
+
+
+
+
diff --git a/pages/troublefollow/detail.wxss b/pages/troublefollow/detail.wxss
new file mode 100644
index 0000000..7df1b17
--- /dev/null
+++ b/pages/troublefollow/detail.wxss
@@ -0,0 +1 @@
+/* pages/troublefollow/detail.wxss */
\ No newline at end of file
diff --git a/pages/troublefollow/handle.js b/pages/troublefollow/handle.js
new file mode 100644
index 0000000..ac0637a
--- /dev/null
+++ b/pages/troublefollow/handle.js
@@ -0,0 +1,180 @@
+// pages/inspect/detail.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ desc:'',
+ img:''
+ },
+ binddescInput: function (e) {
+ this.data.desc = e.detail.value
+ },
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ this.data.id=options.id;
+ wx.request({
+ url: getApp().globalData.serverUrl + 'api/troublefollowtask?a=detail&id=' + options.id,
+ header: {
+ 'content-type': 'application/json', //
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ method: 'GET',
+ success: res => {
+ if (res.statusCode === 200) {
+ // if (res.data.img) {
+ // res.data.img = getApp().globalData.serverUrl + res.data.img
+ // }
+ this.setData(res.data)
+ }
+ }
+ })
+ },
+ previewImage: function (e) {
+ var current = e.target.dataset.src
+ wx.previewImage({
+ current: current,
+ urls: [current]
+ })
+ },
+ deleteImage: function (e) {
+ var that = this;
+ //var index = e.currentTarget.dataset.index; //获取当前长按图片下标
+ wx.showModal({
+ title: '系统提醒',
+ content: '确定要删除此图片吗?',
+ success: function (res) {
+ if (res.confirm) {
+ that.data.img2 = null
+ } else if (res.cancel) {
+ return false
+ }
+ that.setData({
+ img2: that.data.img2
+ });
+ }
+ })
+ },
+ chooseImage: function (e) {
+ var that = this
+ wx.chooseImage({
+ count: 1,
+ sizeType: ['original', 'compressed'],
+ sourceType: ['album', 'camera'],
+ success: function (res) {
+ wx.showLoading({
+ title: '上传图片..',
+ mask: true
+ })
+ wx.uploadFile({
+ header: {
+ 'content-type': 'application/json', // 默认值
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ url: getApp().globalData.serverUrl + 'upfile',
+ filePath: res.tempFilePaths[0],
+ name: 'upfile',
+ success(res) {
+ wx.hideLoading()
+ var obj = JSON.parse(res.data);
+ that.data.img2 = getApp().globalData.serverUrl + obj['filepath']
+ that.setData({
+ img2: that.data.img2
+ })
+
+ },
+ complete: function (res) {
+ wx.hideLoading()
+ }
+ })
+ }
+ })
+ },
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide: function () {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload: function () {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh: function () {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom: function () {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage: function () {
+
+ },
+ submit: function () {
+ var that = this
+ if(that.data.desc){
+ let data = {
+ id:that.data.id,
+ desc: that.data.desc,
+ }
+ // if (that.data.img2 && that.data.img2.indexOf(getApp().globalData.serverUrl) != -1) {
+ // data.img2 = data.img2.replace(getApp().globalData.serverUrl, '')
+ // }
+ wx.showLoading({
+ title: '提交中',
+ })
+ wx.request({
+ url: getApp().globalData.serverUrl + 'api/troublefollowtask/?a=handle',
+ header: {
+ 'content-type': 'application/json', // 默认值
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ method: 'POST',
+ data: data,
+ success: res => {
+ wx.navigateBack({
+
+ })
+ wx.hideLoading();
+ }
+ });
+ }else{
+ wx.showToast({
+ title: '未填写跟踪描述',
+ icon:'none'
+ })
+ }
+
+ },
+})
\ No newline at end of file
diff --git a/pages/troublefollow/handle.json b/pages/troublefollow/handle.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/troublefollow/handle.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/troublefollow/handle.wxml b/pages/troublefollow/handle.wxml
new file mode 100644
index 0000000..d3b6a44
--- /dev/null
+++ b/pages/troublefollow/handle.wxml
@@ -0,0 +1,49 @@
+隐患跟踪任务信息
+
+
+
+
+ 隐患编号
+
+ {{trouble__yhnum}}
+
+
+
+ 网格级别
+ {{gridlevel__dickeyname}}
+
+
+ 任务开启
+ {{taskadd}}
+
+
+ 任务关闭
+ {{taskexpire}}
+
+
+
+ 跟踪备注
+
+ {{tasknote}}
+
+
+
+
+跟踪描述
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/troublefollow/handle.wxss b/pages/troublefollow/handle.wxss
new file mode 100644
index 0000000..bd57101
--- /dev/null
+++ b/pages/troublefollow/handle.wxss
@@ -0,0 +1,4 @@
+/* pages/inspect/handle.wxss */
+.btn-area{
+ margin:5px
+}
\ No newline at end of file
diff --git a/pages/troublefollow/index.js b/pages/troublefollow/index.js
index 8b6b002..eee73d0 100644
--- a/pages/troublefollow/index.js
+++ b/pages/troublefollow/index.js
@@ -1,18 +1,47 @@
-// pages/troublefollow/index.js
+
+var sliderWidth = 96;
Page({
/**
* 页面的初始数据
*/
data: {
-
+ page: 1,
+ serverUrl: getApp().globalData.serverUrl,
+ todoList: [],
+ tabs: ["待执行任务", "已完成"],
+ activeIndex: 0,
+ sliderOffset: 0,
+ sliderLeft: 0
+ },
+ tabClick: function (e) {
+ var that = this
+ that.setData({
+ sliderOffset: e.currentTarget.offsetLeft,
+ activeIndex: e.currentTarget.id
+ });
+ if (that.data.activeIndex == 0) {
+ that.gettodoList(1)
+ that.data.page = 1
+ }
+ else if (that.data.activeIndex == 1) {
+ that.getdoneList(1)
+ that.data.page2 = 1
+ }
},
-
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ var that = this
+ wx.getSystemInfo({
+ success: function (res) {
+ that.setData({
+ sliderLeft: (res.windowWidth / that.data.tabs.length - sliderWidth) / 2,
+ sliderOffset: res.windowWidth / that.data.tabs.length * that.data.activeIndex
+ });
+ }
+ });
},
/**
@@ -26,7 +55,8 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
-
+ var that = this;
+ that.onPullDownRefresh();
},
/**
@@ -42,25 +72,133 @@ Page({
onUnload: function () {
},
-
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
- onPullDownRefresh: function () {
-
- },
/**
* 页面上拉触底事件的处理函数
*/
- onReachBottom: function () {
-
- },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
- }
+ },
+ onPullDownRefresh: function () {
+ var that = this
+ if (that.data.activeIndex == 0) {
+ that.gettodoList(1)
+ that.data.page = 1
+ } else {
+ that.getdoneList(1)
+ that.data.page2 = 1
+ }
+ wx.stopPullDownRefresh();
+
+ },
+ onReachBottom: function () {
+ //上拉分页,将页码加1,然后调用分页函数
+ var that = this
+ if (that.data.activeIndex == 0) {
+ that.data.page = that.data.page + 1
+ that.gettodoList()
+ } else {
+ that.data.page2 = that.data.page2 + 1
+ that.getdoneList()
+ }
+
+
+ },
+ gettodoList: function (page) {
+ var that = this;
+ if (page != 1) { page = that.data.page }
+ wx.showLoading({
+ title: '加载中',
+ }),
+ wx.request({
+ url: this.data.serverUrl + 'api/troublefollowtask?a=listtodo&rows=10&page=' + page,
+ header: {
+ 'content-type': 'application/json', // 默认值
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ success: res => {
+ if (res.statusCode === 200) {
+ if (res.data.rows.length == 0) {
+ if (page == 1) {
+ this.setData({
+ total: 0,
+ todoList: []
+ })
+ }
+ else {
+ wx.showModal({
+ content: "已经到底啦!",
+ showCancel: false,
+ confirmText: "确定",
+ })
+ }
+ } else {
+ let list
+ if (page == 1) {
+ list = res.data.rows
+ } else {
+ list = this.data.todoList.concat(res.data.rows)
+ }
+ this.setData({
+ total: res.data.total,
+ todoList: list
+ })
+ }
+ }
+ wx.hideLoading();
+ }
+ });
+ },
+ getdoneList: function (page) {
+ var that = this;
+ if (page != 1) { page = that.data.page2 }
+ wx.showLoading({
+ title: '加载中',
+ }),
+ wx.request({
+ url: this.data.serverUrl + 'api/troublefollowtask?a=listdone&rows=10&page=' + page,
+ header: {
+ 'content-type': 'application/json', // 默认值
+ 'Cookie': getApp().globalData.sessionId,
+ },
+ success: res => {
+ if (res.statusCode === 200) {
+ if (res.data.rows.length == 0) {
+ if (page == 1) {
+ this.setData({
+ total: 0,
+ doneList: []
+ })
+ }
+ else {
+ wx.showModal({
+ content: "已经到底啦!",
+ showCancel: false,
+ confirmText: "确定",
+ })
+ }
+ } else {
+ let list
+ if (page == 1) {
+ list = res.data.rows
+ } else {
+ list = this.data.doneList.concat(res.data.rows)
+ }
+ this.setData({
+ total: res.data.total,
+ doneList: list
+ })
+ }
+ }
+ wx.hideLoading();
+ }
+ });
+ },
})
\ No newline at end of file
diff --git a/pages/troublefollow/index.json b/pages/troublefollow/index.json
index 8835af0..f2df298 100644
--- a/pages/troublefollow/index.json
+++ b/pages/troublefollow/index.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "navigationBarTitleText": "隐患跟踪",
+ "enablePullDownRefresh": true,
+ "onReachBottomDistance": 50
}
\ No newline at end of file
diff --git a/pages/troublefollow/index.wxml b/pages/troublefollow/index.wxml
index 3450fb0..185a60a 100644
--- a/pages/troublefollow/index.wxml
+++ b/pages/troublefollow/index.wxml
@@ -1,2 +1,67 @@
-
-pages/troublefollow/index.wxml
+
+
+
+
+
+ {{item}}
+
+
+
+
+
+
+ 共{{total}}条待执行任务
+
+
+
+
+
+ {{item.gridlevel__dickeyname}}
+ {{item.trouble__yhnum}}
+
+
+ {{tools.sub(item.trouble__yhms)}}
+
+
+ 任务开启:
+ {{item.taskadd}}
+ -任务过期:
+ {{item.taskexpire}}
+
+
+
+
+
+
+
+已完成{{total}}条任务
+
+
+
+
+
+ 已执行
+ 未执行
+ {{item.gridlevel__dickeyname}}
+ {{item.trouble__yhnum}}
+
+
+ {{tools.sub(item.trouble__yhms)}}
+
+
+ 执行时间:
+ {{item.taskdo}}
+
+
+ 任务开启:
+ {{item.taskadd}}
+ -任务过期:
+ {{item.taskexpire}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/troublefollow/index.wxss b/pages/troublefollow/index.wxss
index 8f81dd9..ef15154 100644
--- a/pages/troublefollow/index.wxss
+++ b/pages/troublefollow/index.wxss
@@ -1 +1,14 @@
-/* pages/troublefollow/index.wxss */
\ No newline at end of file
+.weui-btn{
+ width:auto;
+ margin: 5px;
+}
+.container {
+ background-color: #fff;
+ color: #939393;
+}
+.head{
+ color:#fff;
+ background-color: cornflowerblue;
+ text-align: center;
+}
+
\ No newline at end of file
diff --git a/utils/util.js b/utils/util.js
index ca4ae76..ce776c1 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -70,11 +70,21 @@ function formatSeconds(value) {
return result;
}
-
+function toSubString(value) {
+ if (value.length>=14){
+ var str = value.substring(0, 14)
+ return str + "..."
+ } else {
+ return value
+ }
+
+}
+
module.exports = {
getQueryString: getQueryString,
formatTime: formatTime,
formatTime2:formatTime2,
formatSeconds:formatSeconds,
+ toSubString: toSubString
}
diff --git a/wxs/subutil.wxs b/wxs/subutil.wxs
new file mode 100644
index 0000000..e4222bc
--- /dev/null
+++ b/wxs/subutil.wxs
@@ -0,0 +1,11 @@
+var sub = function(val) {
+ if (val.length == 0 || val == undefined) {
+ return;
+ }
+ if (val.length > 17) {
+ return val.substring(0, 17) + "...";
+ } else {
+ return val;
+ }
+}
+module.exports.sub = sub;
\ No newline at end of file