Parcourir la source

日常巡检记录保存及历史记录查询
忽略target目录和.idea目录

xyg il y a 3 ans
Parent
commit
d19379fa75

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+target
+.idea

+ 2 - 1
light-application-wx/app.json

@@ -18,7 +18,8 @@
         "pages/meeting-cover/meeting-cover",
         "pages/meeting-inspection-abnormal/meeting-inspection-abnormal",
         "pages/meeting-inspection-history/meeting-inspection-history",
-        "pages/meeting-inspection-history-detail/meeting-inspection-history-detail"
+        "pages/meeting-inspection-history-detail/meeting-inspection-history-detail",
+        "pages/daily-inspection/daily-inspection"
     ],
     "window": {
         "backgroundTextStyle": "light",

+ 199 - 0
light-application-wx/pages/daily-inspection/daily-inspection.js

@@ -0,0 +1,199 @@
+// pages/daily-inspection/daily-inspection.js
+const util = require('../../utils/util.js');
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        inspectionProjectList: [],
+        inspectionType: 10,//10:日常巡检,20:会议巡检
+        inspectionResultList: [],
+        abnormalIndex: null,
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+        let that = this;
+        util.get({
+            url: '/api/inspection/template/getDailyInspectionProject',
+            header: {
+                'Content-Type': 'application/x-www-form-urlencoded'
+            },
+            success: (res) => {
+                wx.hideLoading();
+                console.info(res)
+                if (res.data.code != 200) {
+                    util.toast(res.data.msg);
+                } else {
+                    that.setData({
+                        inspectionProjectList: res.data.data
+                    });
+                }
+            }
+        });
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        let that = this;
+        let item = wx.getStorageSync('inspectionResultItem');
+        if (item) {
+            let obj = JSON.parse(item);
+            let index = that.data.abnormalIndex;
+
+            that.data.inspectionProjectList[index].result = 20;
+            that.data.inspectionProjectList[index].color = '#E95543';
+            that.data.inspectionProjectList[index].results = '不正常';
+            let list = that.data.inspectionResultList;
+            list.push(obj);
+            that.setData({
+                inspectionProjectList: that.data.inspectionProjectList,
+                inspectionResultList: list,
+                abnormalIndex: null
+            });
+            wx.removeStorageSync('inspectionResultItem');
+        }
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    },
+
+    /**
+     * 历史记录
+     */
+    history: function () {
+        wx.navigateTo({
+            url: '../meeting-inspection-history/meeting-inspection-history?inspectionType=10&meetingId=',
+        });
+    },
+
+
+    /**
+     * 巡检结果不正常
+     * @param {*} e 
+     */
+    abnormal: function (e) {
+        this.setData({
+            abnormalIndex: e.currentTarget.dataset.index
+        });
+        wx.navigateTo({
+            url: '../meeting-inspection-abnormal/meeting-inspection-abnormal?inspectionProjectId=' + e.currentTarget.dataset.id,
+        })
+    },
+
+
+    /**
+     * 巡检结果正常
+     * @param {*} e 
+     */
+    normal: function (e) {
+        let that = this;
+        // 修改巡检结果为正常(10)
+        that.data.inspectionProjectList[e.currentTarget.dataset.index].result = 10;
+        that.data.inspectionProjectList[e.currentTarget.dataset.index].color = '#2EC3CD';
+        that.data.inspectionProjectList[e.currentTarget.dataset.index].results = '正常';
+        let list = that.data.inspectionResultList;
+        list.push({
+            inspectionProjectId: e.currentTarget.dataset.id,
+            result: 10
+        });
+        that.setData({
+            inspectionProjectList: that.data.inspectionProjectList,
+            inspectionResultList: list
+        });
+    },
+
+
+    /**
+     * 提交巡检结果
+     */
+    submitInspection: function () {
+        let that = this;
+        let inspectionResultList = that.data.inspectionResultList;
+        if (!inspectionResultList || inspectionResultList.length < 1) {
+            util.toast('请选择巡检结果');
+            return;
+        }
+
+        wx.showModal({
+            cancelColor: 'cancelColor',
+            title: '巡检工程师',
+            showCancel: false,
+            editable: true,
+            placeholderText: '请输入姓名',
+            success: (res) => {
+                if (!res.content) {
+                    util.toast('请输入姓名');
+                    return;
+                } else {
+                    util.post({
+                        url: '/api/inspection/record/addBean',
+                        data: {
+                            inspectionType: that.data.inspectionType,
+                            inspectionResultList: inspectionResultList,
+                            inspectionPersonnel: res.content
+                        },
+                        success: (res) => {
+                            wx.hideLoading();
+                            if (res.data.code != 200) {
+                                util.toast(res.data.msg);
+                            } else {
+                                util.toast(res.data.msg);
+                                setTimeout(() => {
+                                    wx.navigateBack({
+                                        delta: -1,
+                                    });
+                                }, 1000);
+                            }
+                        }
+                    });
+                }
+            }
+        });
+    }
+
+})

+ 4 - 0
light-application-wx/pages/daily-inspection/daily-inspection.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "日常巡检"
+}

+ 23 - 0
light-application-wx/pages/daily-inspection/daily-inspection.wxml

@@ -0,0 +1,23 @@
+<!--pages/daily-inspection/daily-inspection.wxml-->
+<view class="container">
+    <view class="history-record-buju">
+        <view class="history-record" bindtap="history">历史记录</view>
+    </view>
+    <scroll-view scroll-y="true" class="body">
+        <view class="inspection-project" wx:for="{{inspectionProjectList}}" wx:key="i" wx:index="index">
+            <view>
+                <text class="project-name">{{item.name}}</text>
+                <view class="divider"></view>
+                <view class="buju">
+                    <text class="status-title">设备运行状态</text>
+                    <view class="buju1" wx:if="{{!item.result}}">
+                        <view class="button" data-index="{{index}}" data-id="{{item.id}}" bindtap="abnormal">不正常</view>
+                        <view class="button" data-index="{{index}}" data-id="{{item.id}}" bindtap="normal">正常</view>
+                    </view>
+                    <text class="results" wx:if="{{item.result}}" style="color: {{item.color}};">{{item.results}}</text>
+                </view>
+            </view>
+        </view>
+    </scroll-view>
+    <button style="width:80%;" class="submit-button" bindtap="submitInspection">提交</button>
+</view>

+ 100 - 0
light-application-wx/pages/daily-inspection/daily-inspection.wxss

@@ -0,0 +1,100 @@
+/* pages/daily-inspection/daily-inspection.wxss */
+.container {
+    background-color: #F0F4F7;
+    display: block;
+    height: 100%;
+}
+
+.body {
+    margin-top: 20rpx;
+    margin-bottom: 70rpx;
+    overflow-y: scroll;
+    height: calc(100vh - 330rpx);
+}
+
+.history-record-buju {
+    display: flex;
+    justify-content: flex-end;
+}
+
+.history-record {
+    margin-top: 20rpx;
+    text-align: center;
+    border-radius: 40rpx;
+    font-size: 26rpx;
+    width: 160rpx;
+    height: 60rpx;
+    line-height: 60rpx;
+    margin-right: 40rpx;
+    border: 1rpx solid #CECECE;
+}
+
+.inspection-project {
+    margin-left: 40rpx;
+    margin-right: 40rpx;
+    background-color: #FFFFFF;
+    border-radius: 20rpx;
+    height: 200rpx;
+    margin-bottom: 10rpx;
+}
+
+.inspection-project .project-name {
+    line-height: 80rpx;
+    margin-left: 30rpx;
+}
+
+.inspection-project .status-title {
+    margin-top: 10rpx;
+    font-size: 22rpx;
+    color: #999999;
+    line-height: 80rpx;
+    margin-left: 30rpx;
+}
+
+.inspection-project .divider {
+    margin-top: 10rpx;
+    border: 1rpx solid #EBE8E3;
+    margin-left: 30rpx;
+    margin-right: 30rpx;
+}
+
+.inspection-project .buju {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.inspection-project .buju1 {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
+
+.inspection-project .button {
+    margin-top: 10rpx;
+    text-align: center;
+    border-radius: 40rpx;
+    font-size: 26rpx;
+    width: 160rpx;
+    height: 50rpx;
+    line-height: 50rpx;
+    border: 1rpx solid #CECECE;
+    margin: 26rpx 30rpx 0 0;
+}
+
+.results {
+    line-height: 50rpx;
+    margin-right: 40rpx;
+}
+
+.submit-button {
+    border-radius: 45rpx;
+    background-color: #3D5C92;
+    color: #FFFFFF;
+    font-size: 28rpx;
+    text-align: center;
+    margin-top: 10rpx;
+    position: absolute;
+    bottom: 40rpx;
+    left: 10%;
+}

+ 21 - 1
light-application-wx/pages/index/index.js

@@ -157,7 +157,9 @@ Page({
      * 日常巡检
      */
     dailyInspection: function () {
-
+        wx.navigateTo({
+            url: '../daily-inspection/daily-inspection',
+        })
     },
 
     /**
@@ -206,6 +208,24 @@ Page({
         });
     },
 
+    /**
+     * 内容投屏
+     */
+    contentScreen: function () {
+        wx.startWifi({
+            success: (res) => {
+                //{errCode:0,errMsg:startWifi:ok}
+                util.toast(JSON.stringify(res));
+                if (res.errCode == 0) {
+
+                } else {
+                    util.toast(res.errMsg);
+                }
+            },
+            fail: (e) => { }
+        });
+    },
+
     changeRole: function () {
         wx.redirectTo({
             url: '../index-admin/index-admin',

+ 1 - 1
light-application-wx/pages/index/index.wxml

@@ -45,7 +45,7 @@
             <image mode="heightFix" src="{{imgPath}}/index-light2.png"></image>
             <text>图片回传</text>
         </view>
-        <view class="big">
+        <view class="big" bindtap="contentScreen">
             <image mode="heightFix" src="{{imgPath}}/index-light5.png"></image>
             <text>内容投屏</text>
         </view>

+ 14 - 0
light-application-wx/pages/meeting-inspection-history-detail/meeting-inspection-history-detail.js

@@ -13,6 +13,7 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        let that = this;
         util.post({
             url: '/api/inspection/record/queryDetails',
             header: {
@@ -24,6 +25,19 @@ Page({
             success: (res) => {
                 console.info(res)
                 wx.hideLoading();
+                let arr = res.data.data.inspectionResultVoList;
+                for (let i in arr) {
+                    if (arr[i].result == 10) {
+                        arr[i].results = '正常';
+                        arr[i].color = '#2EC3CD';
+                    } else {
+                        arr[i].results = '不正常';
+                        arr[i].color = '#E95543';
+                    }
+                }
+                that.setData({
+                    list: arr
+                });
             }
         });
     },

+ 2 - 2
light-application-wx/pages/meeting-inspection-history-detail/meeting-inspection-history-detail.wxml

@@ -1,10 +1,10 @@
 <!--pages/meeting-inspection-history-detail/meeting-inspection-history-detail.wxml-->
 <scroll-view class="list" scroll-y="true">
     <view class="item" wx:for="{{list}}" wx:for-item="item" wx:key="i">
-        <view class="name">{{item.name}}</view>
+        <view class="name">{{item.inspectionProjectName}}</view>
         <view class="result">
             <text class="result-text">设备运行状态</text>
-            <text class="result-status" style="color: {{item.color}};">{{item.status}}</text>
+            <text class="result-status" style="color: {{item.color}};">{{item.results}}</text>
         </view>
     </view>
 </scroll-view>

+ 6 - 2
light-application-wx/pages/meeting-inspection-history/meeting-inspection-history.js

@@ -17,11 +17,15 @@ Page({
      */
     onLoad: function (options) {
         let that = this;
+        let inspectionType = options.inspectionType;
+        let meetingId = options.meetingId;
         util.get({
             url: '/api/inspection/record/list',
             data: {
                 current: that.data.current,
-                size: that.data.size
+                size: that.data.size,
+                inspectionType: inspectionType,
+                meetingId: meetingId
             },
             success: function (res) {
                 console.info(res)
@@ -145,7 +149,7 @@ Page({
      */
     openDetail: function (e) {
         wx.navigateTo({
-            url: '../meeting-inspection-history-detail/meeting-inspection-history-detail?id='+e.currentTarget.dataset.id,
+            url: '../meeting-inspection-history-detail/meeting-inspection-history-detail?id=' + e.currentTarget.dataset.id,
         });
     }
 })

+ 2 - 3
light-application-wx/pages/meeting-inspection/meeting-inspection.js

@@ -148,11 +148,10 @@ Page({
 
     /**
      * 历史记录
-     * @param {*} e 
      */
-    history: function (e) {
+    history: function () {
         wx.navigateTo({
-            url: '../meeting-inspection-history/meeting-inspection-history',
+            url: '../meeting-inspection-history/meeting-inspection-history?inspectionType=20&meetingId=' + this.data.meetingId,
         });
     },
 

+ 2 - 2
light-application-wx/pages/meeting-inspection/meeting-inspection.wxml

@@ -1,6 +1,6 @@
 <!--pages/meeting-inspection/meeting-inspection.wxml-->
 <view class="container">
-    <view class="head">
+    <!-- <view class="head">
         <view style="margin-left: 40rpx;" data-no="20" bindtap="switchTab">
             <text class="{{currentTab==20?'select':'no-select'}}">会前</text>
             <view class="sign-buju">
@@ -19,7 +19,7 @@
                 <view wx:if="{{currentTab==40}}" class="sign"></view>
             </view>
         </view>
-    </view>
+    </view> -->
     <view class="history-record-buju">
         <view class="history-record" bindtap="history">历史记录</view>
     </view>

+ 1 - 1
light-application-wx/project.config.json

@@ -23,7 +23,7 @@
         "scopeDataCheck": false,
         "uglifyFileName": false,
         "checkInvalidKey": true,
-        "checkSiteMap": true,
+        "checkSiteMap": false,
         "uploadWithSourceMap": true,
         "compileHotReLoad": true,
         "lazyloadPlaceholderEnable": false,