123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- import http from '../../base/httputil'
- const app = getApp()
- Page({
- /**
- * 组件的初始数据
- */
- data: {
- host: app.globalData.host,
- todayXunchaCount: 0,
- todayRiskCount: 0,
- todayEnterpriseCount: 0,
- xunchaList: null,
- menulist: [{
- "id": "1",
- "url": "icon-anquanxuncha",
- "title": "巡更",
- },
- {
- "id": "2",
- "url": "icon-xunjian",
- "title": "巡检",
- },
- ],
- mainmodel: {
- }
- },
- onLoad() {
- this.getXunchaCount()
- this.getXunchaList()
- },
- getXunchaCount() {
- http.post("/system/AppXunchaController/getXunchaCount", null, this.getXunchaCountSuccess)
- },
- getXunchaCountSuccess(res) {
-
- console.log("@@@@",res)
- if(res.code==200){
- this.setData({
- todayXunchaCount: res.data.xunchaCount.todayXunchaCount,
- todayRiskCount: res.data.xunchaCount.todayRiskCount,
- todayEnterpriseCount: res.data.xunchaCount.todayEnterpriseCount
- })
-
- }
-
- },
- getXunchaList() {
- let obj = new Object()
- obj.pageNum = this.data.pageNum
- obj.busEnterpriseName = ""
- obj.pageSize = 10
- obj.reasonable = true
- http.send_get("/system/AppXunchaController/getXunchaList", obj, this.getXunchaListSuccess)
- },
- getXunchaListSuccess(res) {
- console.log("@@@@",res)
- if(res.code==200){
- this.setData({
- xunchaList: res.data.rows
- })
- }
-
- },
- // 搜索结果跳页
- bindViewSearchEnd() {
- wx.navigateTo({
- url: '../xunchawu/xunchawu'
- })
- },
- toBindXunjinaMore(e){
- let isrisk = e.currentTarget.dataset.isrisk
- let buslogid = e.currentTarget.dataset.buslogid
- if(isrisk == 0){
- wx.showToast({
- title: '没有发现安全隐患,请放心!!',
- icon: "none"
- })
- }else{
- console.log(isrisk,"####",buslogid)
- wx.navigateTo({
- url: '../xunjianmore/xunjianmore?buslogid='+buslogid
- })
- }
-
- },
- menuItemClick: function (res) {
- //获取点击事件的信息
- let clickInfo = res.detail.iteminfo
- //巡更
- if(clickInfo.id ==1){
-
- wx.scanCode({
- onlyFromCamera: true,
- success: (res) => {
- wx.navigateTo({
- url: '../xungengdetails/xungengdetails?id='+res.result,
- })
- },
- fail: (res) => {
- // console.log(res);
- // wx.showToast({
- // title: '扫描失败',
- // icon:'none'
- // })
- }
- })
- }else if(clickInfo.id==2){
- //企业 巡检
- wx.navigateTo({
- url: '../search/search',
- })
- }
- // 根据不同类型进行判别处理
- //事件的处理 代码
- }
- })
|