diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml index ef1abb8..83b1465 100644 --- a/miniprogram/pages/indexapp/indexapp.wxml +++ b/miniprogram/pages/indexapp/indexapp.wxml @@ -3,12 +3,12 @@ - + - diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml index ef1abb8..83b1465 100644 --- a/miniprogram/pages/indexapp/indexapp.wxml +++ b/miniprogram/pages/indexapp/indexapp.wxml @@ -3,12 +3,12 @@ - + - diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss index 2ae0abb..ef5028b 100644 --- a/miniprogram/pages/indexapp/indexapp.wxss +++ b/miniprogram/pages/indexapp/indexapp.wxss @@ -3,6 +3,7 @@ height: 60%; min-height:60%; /* position:fixed */ + box-sizing: border-box; } .icon-finishi-area { position: fixed; diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml index ef1abb8..83b1465 100644 --- a/miniprogram/pages/indexapp/indexapp.wxml +++ b/miniprogram/pages/indexapp/indexapp.wxml @@ -3,12 +3,12 @@ - + - diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss index 2ae0abb..ef5028b 100644 --- a/miniprogram/pages/indexapp/indexapp.wxss +++ b/miniprogram/pages/indexapp/indexapp.wxss @@ -3,6 +3,7 @@ height: 60%; min-height:60%; /* position:fixed */ + box-sizing: border-box; } .icon-finishi-area { position: fixed; diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index 8df5de1..23e3257 100644 --- a/miniprogram/pages/login/login.js +++ b/miniprogram/pages/login/login.js @@ -248,11 +248,11 @@ }) } else if(res.data.code === 201) { // 未绑定 app.globalData.openid = res.data.data - that.fetchProjectList().then(() => { + // that.fetchProjectList().then(() => { wx.navigateTo({ url: '../validNameKeyword/validNameKeyword', }) - }) + // }) } }, fail: function (err) { @@ -277,6 +277,7 @@ }, // 获取项目列表 async fetchProjectList() { + var that = this await new Promise(resolve => { wx.request({ url: app.globalData.httpsUrl + "/app/user/project", diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml index ef1abb8..83b1465 100644 --- a/miniprogram/pages/indexapp/indexapp.wxml +++ b/miniprogram/pages/indexapp/indexapp.wxml @@ -3,12 +3,12 @@ - + - diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss index 2ae0abb..ef5028b 100644 --- a/miniprogram/pages/indexapp/indexapp.wxss +++ b/miniprogram/pages/indexapp/indexapp.wxss @@ -3,6 +3,7 @@ height: 60%; min-height:60%; /* position:fixed */ + box-sizing: border-box; } .icon-finishi-area { position: fixed; diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index 8df5de1..23e3257 100644 --- a/miniprogram/pages/login/login.js +++ b/miniprogram/pages/login/login.js @@ -248,11 +248,11 @@ }) } else if(res.data.code === 201) { // 未绑定 app.globalData.openid = res.data.data - that.fetchProjectList().then(() => { + // that.fetchProjectList().then(() => { wx.navigateTo({ url: '../validNameKeyword/validNameKeyword', }) - }) + // }) } }, fail: function (err) { @@ -277,6 +277,7 @@ }, // 获取项目列表 async fetchProjectList() { + var that = this await new Promise(resolve => { wx.request({ url: app.globalData.httpsUrl + "/app/user/project", diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js index 38d3a02..757725b 100644 --- a/miniprogram/pages/validNameKeyword/validNameKeyword.js +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -71,6 +71,7 @@ // 点击确认 confirm: function (e) { const { phone, password, nickname, avatarUrl} = this.data + var that = this console.log(nickname); console.log('00000', this.data ) if(!nickname) { @@ -112,9 +113,11 @@ success: function (res) { wx.hideLoading(); if(res.data.code === 200) { // 已绑定 - wx.switchTab({ - url: '../indexapp/indexapp' - }) + that.fetchProjectList().then(() => { + wx.switchTab({ + url: '../indexapp/indexapp' + }) + }) } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定 wx.showToast({ title: '绑定失败,请联系管理员', @@ -135,5 +138,30 @@ }) } }) - } + }, + // 获取项目列表 + async fetchProjectList() { + var that = this + await new Promise(resolve => { + wx.request({ + url: app.globalData.httpsUrl + "/app/user/project", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 已绑定 + app.globalData.projectList = res.data.data + resolve() + } + }, + fail: function (err) { + that.hideLoading(); + wx.showToast({ + title: '获取项目列表失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/app.js b/miniprogram/app.js index 7381a58..74840d6 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -20,10 +20,12 @@ globalData: { // httpsUrl: "https://logapi.smartlog.work/", // httpsUrl: "https://38ka911915.picp.vip/", // 柴壮本地 - httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 + // httpsUrl: "http://192.168.8.110:8083/",// 柴壮本地 // httpsUrl: "http://139.198.18.188:8083/", // url: "http://127.0.0.1:8083/", //httpsUrl: "http://127.0.0.1:8083/", + // httpsUrl: "http://111.198.10.15:21405", + httpsUrl: "https://gas.task.smartlog.work/", openid: null, indexCount:1, nickName:"", diff --git a/miniprogram/pages/addDevice/addDevice.js b/miniprogram/pages/addDevice/addDevice.js index 78f00b7..9bc59ce 100644 --- a/miniprogram/pages/addDevice/addDevice.js +++ b/miniprogram/pages/addDevice/addDevice.js @@ -9,6 +9,9 @@ * 页面的初始数据 */ data: { + wellActions: [], // 选择井编号 + wellShow: false, // 是否显示选择井编号 + projectName: '', // 项目名称 canvasHeight: '', canvasWidth: '', longitude: '', @@ -36,7 +39,7 @@ longitude84: "", latitude84: "", devicetype: "", - project: "", + project: '', area: "", street: "", wellname: "", @@ -44,7 +47,13 @@ photopath2: '', photopath3: '', }, - fileList: [] + fileList: [], + listQuery: { + wellCode: '', // wellCode + wellType: '', // 井类型 + position: '', // 位置 + projectId: '', // 所在项目 + }, }, onDisplay() { @@ -98,6 +107,12 @@ */ onLoad: function (options) { var that = this; + console.log(app.globalData.selectProjectId, '==='); + that.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, + }) + console.log('ppp', that.data.form.project); //初始化表单内容为上次填写值 var cacheForms = wx.getStorageSync('cacheList') if (cacheForms) { @@ -159,6 +174,7 @@ }; welltypeArr.push(type); } + console.log('------', welltypeArr) that.setData({ option1: welltypeArr }) @@ -166,7 +182,6 @@ } }) - //获取人员下拉列表 wx.request({ method: "POST", @@ -298,6 +313,82 @@ onPullDownRefresh: function () { }, + // 点击检索 + searchWellCode() { + this.setData({ + 'listQuery.wellCode': this.data.form.wellcode + }) + this.fetchWellPre() + }, + //获取井列表 + fetchWellPre() { + return new Promise((resolve, reject) => { + var that = this + wx.showLoading({ + mask: true + }) + wx.request({ + method: "POST", + url: app.globalData.httpsUrl + "well/pre/listPage" + `?offset=${1}&limit=${9999}`, + // header: { + // 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' + // }, + data: { + ...that.data.listQuery, + offset: 1, + limit: 9999 + }, + success(res) { + wx.hideLoading() + if (res.data) { + if(!res.data.data.rows.length) { + wx.showToast({ + icon: 'error', + title: '查无结果' + }) + } else { + const tempList = res.data.data.rows.map(item => { + return { + ...item, + name: item.wellName, + } + }) + that.setData({ + wellActions: tempList, + wellShow: true + }) + } + } + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + icon: 'none', + title: '查询失败,请手动输入' + }) + } + }) + }) + }, + // 点击选择器的取消 + cancleWellShow() { + this.setData({ + wellShow: false, + }) + }, + // 选择好井 + selectWells(e) { + var that = this + const val = e.detail + console.log(val); + that.setData({ + 'form.wellcode': val.wellCode, // 井编号 + 'form.wellname': val.wellName, // 井名称 + 'form.welltype': that.data.form.welltype ? that.data.form.welltype : val.wellType, // 井名称 + }) + console.log(this.data.form.wellCode); + that.cancleWellShow() + }, /** * 页面上拉触底事件的处理函数 diff --git a/miniprogram/pages/addDevice/addDevice.json b/miniprogram/pages/addDevice/addDevice.json index 8cb8657..a2c60e6 100644 --- a/miniprogram/pages/addDevice/addDevice.json +++ b/miniprogram/pages/addDevice/addDevice.json @@ -16,6 +16,7 @@ "van-dropdown-menu": "../../miniprogram_npm/@vant/weapp/dropdown-menu", "van-dropdown-item": "../../miniprogram_npm/@vant/weapp/dropdown-item", "van-dialog": "../../miniprogram_npm/@vant/weapp/dialog", - "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select" + "van-tree-select": "../../miniprogram_npm/@vant/weapp/tree-select", + "van-action-sheet": "@vant/weapp/action-sheet/index" } } \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxml b/miniprogram/pages/addDevice/addDevice.wxml index f12c254..3cdfa5d 100644 --- a/miniprogram/pages/addDevice/addDevice.wxml +++ b/miniprogram/pages/addDevice/addDevice.wxml @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml index ef1abb8..83b1465 100644 --- a/miniprogram/pages/indexapp/indexapp.wxml +++ b/miniprogram/pages/indexapp/indexapp.wxml @@ -3,12 +3,12 @@ - + - diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss index 2ae0abb..ef5028b 100644 --- a/miniprogram/pages/indexapp/indexapp.wxss +++ b/miniprogram/pages/indexapp/indexapp.wxss @@ -3,6 +3,7 @@ height: 60%; min-height:60%; /* position:fixed */ + box-sizing: border-box; } .icon-finishi-area { position: fixed; diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index 8df5de1..23e3257 100644 --- a/miniprogram/pages/login/login.js +++ b/miniprogram/pages/login/login.js @@ -248,11 +248,11 @@ }) } else if(res.data.code === 201) { // 未绑定 app.globalData.openid = res.data.data - that.fetchProjectList().then(() => { + // that.fetchProjectList().then(() => { wx.navigateTo({ url: '../validNameKeyword/validNameKeyword', }) - }) + // }) } }, fail: function (err) { @@ -277,6 +277,7 @@ }, // 获取项目列表 async fetchProjectList() { + var that = this await new Promise(resolve => { wx.request({ url: app.globalData.httpsUrl + "/app/user/project", diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js index 38d3a02..757725b 100644 --- a/miniprogram/pages/validNameKeyword/validNameKeyword.js +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -71,6 +71,7 @@ // 点击确认 confirm: function (e) { const { phone, password, nickname, avatarUrl} = this.data + var that = this console.log(nickname); console.log('00000', this.data ) if(!nickname) { @@ -112,9 +113,11 @@ success: function (res) { wx.hideLoading(); if(res.data.code === 200) { // 已绑定 - wx.switchTab({ - url: '../indexapp/indexapp' - }) + that.fetchProjectList().then(() => { + wx.switchTab({ + url: '../indexapp/indexapp' + }) + }) } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定 wx.showToast({ title: '绑定失败,请联系管理员', @@ -135,5 +138,30 @@ }) } }) - } + }, + // 获取项目列表 + async fetchProjectList() { + var that = this + await new Promise(resolve => { + wx.request({ + url: app.globalData.httpsUrl + "/app/user/project", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 已绑定 + app.globalData.projectList = res.data.data + resolve() + } + }, + fail: function (err) { + that.hideLoading(); + wx.showToast({ + title: '获取项目列表失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml index 266c316..555e414 100644 --- a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml @@ -1,6 +1,3 @@ - -pages/validNameKeyword/validNameKeyword.wxml - - + @@ -31,7 +31,7 @@ - + @@ -41,16 +41,19 @@ - - - + + + + + + - + @@ -67,16 +70,18 @@ - - + + @@ -101,4 +106,13 @@ 保存 - \ No newline at end of file + + + \ No newline at end of file diff --git a/miniprogram/pages/addDevice/addDevice.wxss b/miniprogram/pages/addDevice/addDevice.wxss index f74b471..c0da869 100644 --- a/miniprogram/pages/addDevice/addDevice.wxss +++ b/miniprogram/pages/addDevice/addDevice.wxss @@ -16,4 +16,11 @@ .van-cell{ height: 100rpx; -} \ No newline at end of file +} +.row-class { + background-color: #fff; +} + +.button-class { + margin-top: 10rpx; +} diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.js b/miniprogram/pages/addDevicelog/addDeviceLog.js index d5bef6e..45e067a 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.js +++ b/miniprogram/pages/addDevicelog/addDeviceLog.js @@ -8,6 +8,7 @@ * 页面的初始数据 */ data: { + projectName: '', // 项目名称 pageName: '', showMask: false, today: new Date().getTime(), @@ -111,6 +112,8 @@ onLoad: function (options) { var _this = this; _this.setData({ + 'form.project': app.globalData.selectProjectName, + 'projectName': app.globalData.selectProjectName, 'markers[0].latitude': Number(wx.getStorageSync('resultObject').latitude) , 'markers[0].longitude': Number(wx.getStorageSync('resultObject').longitude), // 'markers[0].label':'10', @@ -264,6 +267,10 @@ */ onShow: function () { wx.removeStorageSync('resultObject') + // this.setData({ + // 'form.project': app.globalData.selectProjectId, + // 'projectName': app.globalData.selectProjectName, + // }) }, /** @@ -307,7 +314,6 @@ **/ isNumber: function (val) { - var regPos = /^[0-9]*$/; //非负浮点数 var regNeg = /^(-?\d+)(\.\d+)?$/; //负浮点数 if (regPos.test(val) || regNeg.test(val)) { @@ -315,7 +321,6 @@ } else { return true; } - }, diff --git a/miniprogram/pages/addDevicelog/addDeviceLog.wxml b/miniprogram/pages/addDevicelog/addDeviceLog.wxml index b10cc7d..126f85c 100644 --- a/miniprogram/pages/addDevicelog/addDeviceLog.wxml +++ b/miniprogram/pages/addDevicelog/addDeviceLog.wxml @@ -73,7 +73,7 @@ - + + + diff --git a/miniprogram/pages/applog/applog.js b/miniprogram/pages/applog/applog.js index 7076480..7cd6f20 100644 --- a/miniprogram/pages/applog/applog.js +++ b/miniprogram/pages/applog/applog.js @@ -19,6 +19,7 @@ list_style: '' }, onLoad: function (options) { + console.log('-----', options, options.params); if (options.params) { this.setData({ params: JSON.parse(options.params), @@ -265,10 +266,11 @@ method: "POST", url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { + project: app.globalData.selectProjectName, devcode: that.data.params.devcode, devtype: that.data.params.devtype, installtimeFmt: that.data.params.installtimeFmt, - project: that.data.params.project, + // project: that.data.params.project, installPerson: that.data.params.installPerson, limit: 15, offset: offsetValue diff --git a/miniprogram/pages/indexapp/indexapp.js b/miniprogram/pages/indexapp/indexapp.js index 3479395..aa162d2 100644 --- a/miniprogram/pages/indexapp/indexapp.js +++ b/miniprogram/pages/indexapp/indexapp.js @@ -61,27 +61,27 @@ * 生命周期函数--监听页面显示 */ onShow: function () { - console.log('333333', app.globalData.safeBookStatus); - this.setData({ - isSign: app.globalData.safeBookStatus == '0' ? false : true - }) - if (this.data.onshow) { - this.initPages(); + if(app.globalData.selectProjectName) { + wx.showTabBar() + } else { + wx.hideTabBar() } - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - + console.log('333333', app.globalData.safeBookStatus); + this.getSafeBookStatus().then(() => { + this.setData({ + isSign: app.globalData.safeBookStatus == '0' ? false : true + }) + if(app.globalData.selectProjectName) { + if (this.data.onshow) { + this.initPages(); + } + } else { + this.setData({ + actionSheetShow: true + }) + } + + }) }, /** @@ -95,7 +95,14 @@ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - this.getlogs(this.data.devcode) + console.log('触底'); + if(app.globalData.selectProjectName) { + this.getlogs(this.data.devcode) + } else { + this.setData({ + actionSheetShow: true + }) + } }, /** @@ -215,6 +222,7 @@ data: { devcode: devcode, limit: 100, + project: app.globalData.selectProjectName, offset: that.data.deviceloglist.length % 100 > 0 ? parseInt(that.data.deviceloglist.length / 100) + 2 : parseInt(that.data.deviceloglist.length / 100) + 1 }, header: { @@ -239,6 +247,7 @@ url: app.globalData.httpsUrl + "appDeviceLog/listPage", data: { devcode: devcode, + project: app.globalData.selectProjectName, limit: 100, offset: 1 }, @@ -291,5 +300,31 @@ this.setData({ actionSheetShow: false }) - } + this.initPages(); + wx.showTabBar() + }, + // 查询安全生产责任书签署状态 + getSafeBookStatus() { + return new Promise((resolve, reject) => { + var that = this + wx.request({ + url: app.globalData.httpsUrl + "product/safe/sign-status", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 0未签署 1已签署 + app.globalData.safeBookStatus = res.data.data.signStatus + ''; + resolve() + } + }, + fail: function (err) { + wx.showToast({ + title: '获取安全生产责任书签署状态失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/indexapp/indexapp.wxml b/miniprogram/pages/indexapp/indexapp.wxml index ef1abb8..83b1465 100644 --- a/miniprogram/pages/indexapp/indexapp.wxml +++ b/miniprogram/pages/indexapp/indexapp.wxml @@ -3,12 +3,12 @@ - + - diff --git a/miniprogram/pages/indexapp/indexapp.wxss b/miniprogram/pages/indexapp/indexapp.wxss index 2ae0abb..ef5028b 100644 --- a/miniprogram/pages/indexapp/indexapp.wxss +++ b/miniprogram/pages/indexapp/indexapp.wxss @@ -3,6 +3,7 @@ height: 60%; min-height:60%; /* position:fixed */ + box-sizing: border-box; } .icon-finishi-area { position: fixed; diff --git a/miniprogram/pages/login/login.js b/miniprogram/pages/login/login.js index 8df5de1..23e3257 100644 --- a/miniprogram/pages/login/login.js +++ b/miniprogram/pages/login/login.js @@ -248,11 +248,11 @@ }) } else if(res.data.code === 201) { // 未绑定 app.globalData.openid = res.data.data - that.fetchProjectList().then(() => { + // that.fetchProjectList().then(() => { wx.navigateTo({ url: '../validNameKeyword/validNameKeyword', }) - }) + // }) } }, fail: function (err) { @@ -277,6 +277,7 @@ }, // 获取项目列表 async fetchProjectList() { + var that = this await new Promise(resolve => { wx.request({ url: app.globalData.httpsUrl + "/app/user/project", diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.js b/miniprogram/pages/validNameKeyword/validNameKeyword.js index 38d3a02..757725b 100644 --- a/miniprogram/pages/validNameKeyword/validNameKeyword.js +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.js @@ -71,6 +71,7 @@ // 点击确认 confirm: function (e) { const { phone, password, nickname, avatarUrl} = this.data + var that = this console.log(nickname); console.log('00000', this.data ) if(!nickname) { @@ -112,9 +113,11 @@ success: function (res) { wx.hideLoading(); if(res.data.code === 200) { // 已绑定 - wx.switchTab({ - url: '../indexapp/indexapp' - }) + that.fetchProjectList().then(() => { + wx.switchTab({ + url: '../indexapp/indexapp' + }) + }) } else if(res.data.code === 2405 || res.data.code === 2403) { // 未绑定 wx.showToast({ title: '绑定失败,请联系管理员', @@ -135,5 +138,30 @@ }) } }) - } + }, + // 获取项目列表 + async fetchProjectList() { + var that = this + await new Promise(resolve => { + wx.request({ + url: app.globalData.httpsUrl + "/app/user/project", + data: { + openId: app.globalData.openid + }, + success: function (res) { + if(res.data.code === 200) { // 已绑定 + app.globalData.projectList = res.data.data + resolve() + } + }, + fail: function (err) { + that.hideLoading(); + wx.showToast({ + title: '获取项目列表失败', + icon: 'none' + }) + } + }) + }) + }, }) \ No newline at end of file diff --git a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml index 266c316..555e414 100644 --- a/miniprogram/pages/validNameKeyword/validNameKeyword.wxml +++ b/miniprogram/pages/validNameKeyword/validNameKeyword.wxml @@ -1,6 +1,3 @@ - -pages/validNameKeyword/validNameKeyword.wxml -