作者 刘晓艳

预警

@@ -4,23 +4,24 @@ @@ -4,23 +4,24 @@
4 "pages/companybox/zhishudetail/shebei/shebeidetail/shebeidetail", 4 "pages/companybox/zhishudetail/shebei/shebeidetail/shebeidetail",
5 "pages/changqu/changqu", 5 "pages/changqu/changqu",
6 "pages/companybox/zhishudetail/yuanliaomsg/yuanliao/yuanliao", 6 "pages/companybox/zhishudetail/yuanliaomsg/yuanliao/yuanliao",
7 -  
8 "pages/companybox/zhishudetail/qiyeyongdian/detail/detail", 7 "pages/companybox/zhishudetail/qiyeyongdian/detail/detail",
9 "pages/companybox/qiyedetail/qiyedetail", 8 "pages/companybox/qiyedetail/qiyedetail",
10 "pages/companybox/defendetail/defendetail", 9 "pages/companybox/defendetail/defendetail",
11 "pages/companybox/jichuxinxi/jichuxinxi", 10 "pages/companybox/jichuxinxi/jichuxinxi",
12 "pages/qiye/qiye", 11 "pages/qiye/qiye",
13 "pages/login/login", 12 "pages/login/login",
14 -  
15 "pages/mine/mine", 13 "pages/mine/mine",
16 "pages/index/index", 14 "pages/index/index",
17 "pages/logs/logs", 15 "pages/logs/logs",
18 - "pages/yujing/yujing", 16 + "pages/yujing/yujing/yujing",
19 "pages/companybox/zhishudetail/qiyeyongdian/qyyd/qyyd", 17 "pages/companybox/zhishudetail/qiyeyongdian/qyyd/qyyd",
20 "pages/companybox/zhishudetail/member/member", 18 "pages/companybox/zhishudetail/member/member",
21 "pages/companybox/zhishudetail/chengpin/chengpin", 19 "pages/companybox/zhishudetail/chengpin/chengpin",
22 -  
23 - "pages/companybox/zhishudetail/yuanliaomsg/yuanliaoDetail/yuanliaoDetail" 20 + "pages/companybox/zhishudetail/yuanliaomsg/yuanliaoDetail/yuanliaoDetail",
  21 + "pages/yujing/yujingSet/yujingSet/yujingSet",
  22 + "pages/yujing/yujingSet/yujingAdd/yujingAdd",
  23 + "pages/yujing/yujingSet/yujingType/yujingType",
  24 + "pages/yujing/yujingSet/yujingPerson/yujingPerson"
24 ], 25 ],
25 "window": { 26 "window": {
26 "backgroundTextStyle": "light", 27 "backgroundTextStyle": "light",
@@ -46,7 +47,7 @@ @@ -46,7 +47,7 @@
46 "selectedIconPath": "img/demo (16).png" 47 "selectedIconPath": "img/demo (16).png"
47 }, 48 },
48 { 49 {
49 - "pagePath": "pages/yujing/yujing", 50 + "pagePath": "pages/yujing/yujing/yujing",
50 "text": "预警", 51 "text": "预警",
51 "selectedColor": "#FF9400", 52 "selectedColor": "#FF9400",
52 "iconPath": "img/demo (12).png", 53 "iconPath": "img/demo (12).png",
@@ -23,4 +23,33 @@ image{ @@ -23,4 +23,33 @@ image{
23 left: 0; 23 left: 0;
24 right: 0; 24 right: 0;
25 z-index: 5; 25 z-index: 5;
  26 +}
  27 +/* 预警 */
  28 +/* 添加 */
  29 +.add_btn{
  30 + width: 100%;
  31 + height: 80rpx;
  32 + background-color: #fff;
  33 + color: #FF9400;
  34 + position: fixed;
  35 + bottom: 0;
  36 + left: 0;
  37 + font-size: 30rpx;
  38 + text-align: center;
  39 + line-height: 80rpx;
  40 +}
  41 +.type_box{
  42 + border-top:1rpx solid #f5f5f5;
  43 +}
  44 +.type_single{
  45 + display: flex;
  46 + flex-direction: row;
  47 + padding: 30rpx;
  48 + border-bottom: 1rpx solid #f5f5f5;
  49 + align-items: center;
  50 +}
  51 +.type_img{
  52 + width: 36rpx;
  53 + height: 36rpx;
  54 + margin-right: 15rpx;
26 } 55 }

592 字节

1 -<!--pages/yujing/yujing.wxml-->  
2 -<text>pages/yujing/yujing.wxml</text>  
1 -/* pages/yujing/yujing.wxss */  
1 -// pages/yujing/yujing.js 1 +// pages/yujing/yujing/yujing.js
2 Page({ 2 Page({
3 3
4 /** 4 /**
  1 +<!--pages/yujing/yujing/yujing.wxml-->
  2 +<text>pages/yujing/yujing/yujing.wxml</text>
  1 +/* pages/yujing/yujing/yujing.wxss */
  1 +// pages/yujing/yujingSet/yujingAdd/yujingAdd.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + haveType:0,
  9 + havePerson:0,
  10 + type1:"",
  11 + person:"",
  12 + typeId: '',
  13 + personId:""
  14 + },
  15 + toType(){
  16 + wx.navigateTo({
  17 + url: '/pages/yujing/yujingSet/yujingType/yujingType',
  18 + })
  19 + },
  20 + toPerson(){
  21 + wx.navigateTo({
  22 + url: '/pages/yujing/yujingSet/yujingPerson/yujingPerson',
  23 + })
  24 + },
  25 + /**
  26 + * 生命周期函数--监听页面加载
  27 + */
  28 + onLoad: function (options) {
  29 +
  30 + },
  31 +
  32 + /**
  33 + * 生命周期函数--监听页面初次渲染完成
  34 + */
  35 + onReady: function () {
  36 +
  37 + },
  38 +
  39 + /**
  40 + * 生命周期函数--监听页面显示
  41 + */
  42 + onShow: function () {
  43 +
  44 + },
  45 +
  46 + /**
  47 + * 生命周期函数--监听页面隐藏
  48 + */
  49 + onHide: function () {
  50 +
  51 + },
  52 +
  53 + /**
  54 + * 生命周期函数--监听页面卸载
  55 + */
  56 + onUnload: function () {
  57 +
  58 + },
  59 +
  60 + /**
  61 + * 页面相关事件处理函数--监听用户下拉动作
  62 + */
  63 + onPullDownRefresh: function () {
  64 +
  65 + },
  66 +
  67 + /**
  68 + * 页面上拉触底事件的处理函数
  69 + */
  70 + onReachBottom: function () {
  71 +
  72 + },
  73 +
  74 + /**
  75 + * 用户点击右上角分享
  76 + */
  77 + onShareAppMessage: function () {
  78 +
  79 + }
  80 +})
  1 +{
  2 + "navigationBarTextStyle": "black",
  3 + "navigationBarTitleText": "预警设置",
  4 + "usingComponents": {}
  5 +}
  1 +<!--pages/yujing/yujingSet/yujingAdd/yujingAdd.wxml-->
  2 +
  3 +
  4 +
  5 +<view class="add_box">
  6 + <view class="add_wrap" bindtap='toType'>
  7 + <view class="warn_type">
  8 + <view class="{{type1?'isBlue':''}}">{{type1?type1:'预警类型'}}</view>
  9 + <view class="right_img">
  10 + <image src='/img/row.png'></image>
  11 + </view>
  12 + </view>
  13 + </view>
  14 + <view class="add_wrap" bindtap='toPerson'>
  15 + <view class="warn_type">
  16 + <view>请选择推送人员
  17 + <view class="isBlue person_name">{{person}}</view>
  18 + </view>
  19 + <view class="right_img">
  20 + <image src='/img/row.png'></image>
  21 + </view>
  22 + </view>
  23 + </view>
  24 + <view class="add_wrap">
  25 + <view class="uni-form-item uni-column warn_type">
  26 + <view class="title">参数值</view>
  27 + <input class="uni-input" type="number" placeholder="请输入参数值" />
  28 + </view>
  29 + </view>
  30 +</view>
  31 +
  32 +
  33 +
  34 +
  35 +<view class="add_btn" bindtap='submit'>保存</view>
  1 +/* pages/yujing/yujingSet/yujingAdd/yujingAdd.wxss */
  2 +
  3 +
  4 +
  5 +.add_box{
  6 + border-top:1rpx solid #f5f5f5;
  7 +}
  8 +.add_wrap{
  9 + padding: 30rpx;
  10 + border-bottom: 1rpx solid #f5f5f5;
  11 +}
  12 +.warn_type{
  13 + font-size: 32rpx;
  14 + color: #333;
  15 + display: flex;
  16 + flex-direction: row;
  17 + align-items: center;
  18 + justify-content: space-between;
  19 +}
  20 +.right_img{
  21 + width: 30rpx;
  22 + height: 30rpx;
  23 + line-height: 30rpx;
  24 +}
  25 +.person_name{
  26 + margin-top: 10rpx
  27 +}
  28 +.uni-column{
  29 + justify-content: flex-start;
  30 +}
  31 +.uni-input{
  32 + margin-left: 20rpx;
  33 + font-size: 28rpx;
  34 + color: #5797F5
  35 +}
  36 +.isBlue{
  37 + color: #5797F5
  38 +}
  39 +/* 保存 */
  40 +.add_btn{
  41 + background-color: #f5f5f5;
  42 +}
  1 +// pages/yujing/yujingSet/yujingPerson/yujingPerson.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + typeList: [{
  9 + id: 1,
  10 + type: false,
  11 + name: "张三"
  12 + }, {
  13 + id: 2,
  14 + type: false,
  15 + name: "张三1"
  16 + }, {
  17 + id: 3,
  18 + type: false,
  19 + name: "张三2"
  20 + }, {
  21 + id: 4,
  22 + type: false,
  23 + name: "张三3"
  24 + }],
  25 + // arr :[]
  26 + },
  27 + choicePerson(e) {
  28 + let list = this.data.typeList;
  29 + let index = e.currentTarget.dataset.index;
  30 + let id = e.currentTarget.dataset.id;
  31 + list[index].type = !list[index].type;
  32 + this.setData({
  33 + typeList: list
  34 + });
  35 + let arr = [];
  36 + for (let obj of list) {
  37 + if (obj.type) {
  38 + arr.push(obj.name)
  39 + }
  40 + }
  41 + let pages = getCurrentPages();
  42 + let currPage = pages[pages.length - 1]; //当前页面
  43 + let prevPage = pages[pages.length - 2]; //上一个页面
  44 + let person = prevPage.data.person;
  45 + let personId = prevPage.data.personId;
  46 + person = arr;
  47 + personId = id;
  48 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去
  49 + prevPage.setData({
  50 + person: person,
  51 + personId: personId
  52 + });
  53 +
  54 + },
  55 + /**
  56 + * 生命周期函数--监听页面加载
  57 + */
  58 + onLoad: function(options) {
  59 +
  60 + },
  61 +
  62 + /**
  63 + * 生命周期函数--监听页面初次渲染完成
  64 + */
  65 + onReady: function() {
  66 +
  67 + },
  68 +
  69 + /**
  70 + * 生命周期函数--监听页面显示
  71 + */
  72 + onShow: function() {
  73 +
  74 + },
  75 +
  76 + /**
  77 + * 生命周期函数--监听页面隐藏
  78 + */
  79 + onHide: function() {
  80 +
  81 + },
  82 +
  83 + /**
  84 + * 生命周期函数--监听页面卸载
  85 + */
  86 + onUnload: function() {
  87 +
  88 + },
  89 +
  90 + /**
  91 + * 页面相关事件处理函数--监听用户下拉动作
  92 + */
  93 + onPullDownRefresh: function() {
  94 +
  95 + },
  96 +
  97 + /**
  98 + * 页面上拉触底事件的处理函数
  99 + */
  100 + onReachBottom: function() {
  101 +
  102 + },
  103 +
  104 + /**
  105 + * 用户点击右上角分享
  106 + */
  107 + onShareAppMessage: function() {
  108 +
  109 + }
  110 +})
  1 +{
  2 + "navigationBarTextStyle": "black",
  3 + "navigationBarTitleText": "推送人员",
  4 + "usingComponents": {}
  5 +}
  1 +<!--pages/yujing/yujingSet/yujingPerson/yujingPerson.wxml-->
  2 +<!--pages/yujing/yujingSet/yujingType/yujingType.wxml-->
  3 +<view class="type_box">
  4 + <view class="type_single" wx:for="{{typeList}}" wx:key="" bindtap='choicePerson' data-id="{{item.id}}" data-index="{{index}}" data-name="{{item.name}}">
  5 + <view class="type_img">
  6 + <image src='{{item.type?"/img/perYes.png":"/img/perNo.png"}}'></image>
  7 + </view>
  8 + <view>{{item.name}}</view>
  9 + </view>
  10 +</view>
  1 +/* pages/yujing/yujingSet/yujingPerson/yujingPerson.wxss */
  1 +// pages/yujing/yujingSet/yujingSet/yujingSet.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + list:[
  9 + {
  10 + title:"连续不开工时长(天):5",
  11 + msg:"推送人员:张三、李四、王五"
  12 + },
  13 + {
  14 + title: "电量持续减少时长(天):3",
  15 + msg: "推送人员:张三、李四、王五"
  16 + },
  17 + {
  18 + title: "企业平均开工时间下限(小时):6",
  19 + msg: "推送人员:张三、李四、王五"
  20 + },
  21 + ]
  22 + },
  23 + addWarn(){
  24 + wx.navigateTo({
  25 + url: '/pages/yujing/yujingSet/yujingAdd/yujingAdd',
  26 + })
  27 + },
  28 + /**
  29 + * 生命周期函数--监听页面加载
  30 + */
  31 + onLoad: function (options) {
  32 +
  33 + },
  34 +
  35 + /**
  36 + * 生命周期函数--监听页面初次渲染完成
  37 + */
  38 + onReady: function () {
  39 +
  40 + },
  41 +
  42 + /**
  43 + * 生命周期函数--监听页面显示
  44 + */
  45 + onShow: function () {
  46 +
  47 + },
  48 +
  49 + /**
  50 + * 生命周期函数--监听页面隐藏
  51 + */
  52 + onHide: function () {
  53 +
  54 + },
  55 +
  56 + /**
  57 + * 生命周期函数--监听页面卸载
  58 + */
  59 + onUnload: function () {
  60 +
  61 + },
  62 +
  63 + /**
  64 + * 页面相关事件处理函数--监听用户下拉动作
  65 + */
  66 + onPullDownRefresh: function () {
  67 +
  68 + },
  69 +
  70 + /**
  71 + * 页面上拉触底事件的处理函数
  72 + */
  73 + onReachBottom: function () {
  74 +
  75 + },
  76 +
  77 + /**
  78 + * 用户点击右上角分享
  79 + */
  80 + onShareAppMessage: function () {
  81 +
  82 + }
  83 +})
  1 +{
  2 + "navigationBarTextStyle": "black",
  3 + "navigationBarTitleText": "预警设置",
  4 + "usingComponents": {
  5 + }
  6 +}
  1 +<view class="warn_box">
  2 + <view class="warn_single"wx:for="{{list}}" wx:key="">
  3 + <view class="warn_wrap">
  4 + <view class="warn_title">{{item.title}}</view>
  5 + </view>
  6 + <view class="warn_wrap">
  7 + <view class="warn_msg">{{item.msg}}</view>
  8 + </view>
  9 + <view class="warn_btns">
  10 + <view class="modify_btn">修改</view>
  11 + <view class="cancle_btn">删除</view>
  12 + </view>
  13 + </view>
  14 +</view>
  15 +<view class="add_btn" bindtap='addWarn'>添加</view>
  1 +/* pages/yujing/yujingSet/yujingSet/yujingSet.wxss */
  2 +
  3 +
  4 +page{
  5 + background-color: #f5f5f5;
  6 +}
  7 +.warn_box{
  8 + padding:30rpx;
  9 +}
  10 +.warn_single{
  11 + background-color: #fff;
  12 + width: 100%;
  13 + border:1rpx solid rgba(197,197,197,1);
  14 + border-radius: 10rpx;
  15 + height: 300rpx;
  16 + display: flex;
  17 + flex-direction: column;
  18 + align-items:left;
  19 + margin-bottom: 30rpx;
  20 +}
  21 +.warn_wrap{
  22 + width: 100%;
  23 +}
  24 +.warn_title,.warn_msg{
  25 + padding: 32rpx;
  26 + border-bottom: 1rpx solid #e5e5e5;
  27 +}
  28 +.warn_title{
  29 + color: #333;
  30 + font-size: 32rpx;
  31 + font-weight: 600
  32 +}
  33 +.warn_msg{
  34 + font-size: 24rpx;
  35 + color: #666;
  36 +}
  37 +.warn_btns{
  38 + display: flex;
  39 + flex-direction: row;
  40 + align-items: center;
  41 + line-height: 102rpx;
  42 + color: #FF9400;
  43 + font-size: 30rpx;
  44 + width: 100%;
  45 +}
  46 +.modify_btn,.cancle_btn{
  47 + width: 50%;
  48 + border-right: 1rpx solid #e5e5e5;
  49 + text-align: center
  50 +}
  51 +.cancle_btn{
  52 + border:none;
  53 + color: #FF3038
  54 +}
  1 +// pages/yujing/yujingSet/yujingType/yujingType.js
  2 +Page({
  3 +
  4 + /**
  5 + * 页面的初始数据
  6 + */
  7 + data: {
  8 + typeList: [{
  9 + id: 1,
  10 + type: false,
  11 + name: "连续不开工预警"
  12 + }, {
  13 + id: 2,
  14 + type: false,
  15 + name: "电量低预警"
  16 + }, {
  17 + id: 3,
  18 + type: false,
  19 + name: "啦啦啦啦啊啦啦啦啦"
  20 + }, {
  21 + id: 4,
  22 + type: false,
  23 + name: "时长低预警"
  24 + }]
  25 + },
  26 + choiceType(e) {
  27 + let t = this;
  28 + let list = this.data.typeList;
  29 + let id = e.currentTarget.dataset.id;
  30 + let name = e.currentTarget.dataset.name;
  31 +
  32 +
  33 + let arr = [];
  34 + for (let obj of list) {
  35 + obj.type = false;
  36 + if (obj.id == id) {
  37 + obj.type = true
  38 + }
  39 + }
  40 + this.setData({
  41 + typeList: list
  42 + })
  43 + let pages = getCurrentPages();
  44 + let currPage = pages[pages.length - 1]; //当前页面
  45 + let prevPage = pages[pages.length - 2]; //上一个页面
  46 + let type = prevPage.data.type;
  47 + let type1 = prevPage.data.type1;
  48 + let typeId = prevPage.data.typeId;
  49 + type = name;
  50 + type1 = name;
  51 + typeId = id;
  52 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去
  53 + prevPage.setData({
  54 + type: type,
  55 + typeId: typeId,
  56 + type1:type1
  57 + });
  58 + // 选择后立刻返回
  59 + // wx.navigateBack({
  60 + // delta: 1
  61 + // })
  62 + },
  63 + /**
  64 + * 生命周期函数--监听页面加载
  65 + */
  66 + onLoad: function(options) {
  67 + wx.removeStorage({
  68 + key: 'type',
  69 + success: function(res) {},
  70 + })
  71 + },
  72 +
  73 + /**
  74 + * 生命周期函数--监听页面初次渲染完成
  75 + */
  76 + onReady: function() {
  77 +
  78 + },
  79 +
  80 + /**
  81 + * 生命周期函数--监听页面显示
  82 + */
  83 + onShow: function() {
  84 +
  85 + },
  86 +
  87 + /**
  88 + * 生命周期函数--监听页面隐藏
  89 + */
  90 + onHide: function() {
  91 +
  92 + },
  93 +
  94 + /**
  95 + * 生命周期函数--监听页面卸载
  96 + */
  97 + onUnload: function() {
  98 +
  99 + },
  100 +
  101 + /**
  102 + * 页面相关事件处理函数--监听用户下拉动作
  103 + */
  104 + onPullDownRefresh: function() {
  105 +
  106 + },
  107 +
  108 + /**
  109 + * 页面上拉触底事件的处理函数
  110 + */
  111 + onReachBottom: function() {
  112 +
  113 + },
  114 +
  115 + /**
  116 + * 用户点击右上角分享
  117 + */
  118 + onShareAppMessage: function() {
  119 +
  120 + }
  121 +})
  1 +{
  2 + "navigationBarTextStyle": "black",
  3 + "navigationBarTitleText": "预警类型",
  4 + "usingComponents": {}
  5 +}
  1 +<!--pages/yujing/yujingSet/yujingType/yujingType.wxml-->
  2 +<view class="type_box">
  3 + <view class="type_single" wx:for="{{typeList}}" wx:key="" bindtap='choiceType' data-id="{{item.id}}" data-name="{{item.name}}">
  4 + <view class="type_img">
  5 + <image src='{{item.type?"/img/yes.png":"/img/no.png"}}'></image>
  6 + </view>
  7 + <view>{{item.name}}</view>
  8 + </view>
  9 +</view>
  1 +/* pages/yujing/yujingSet/yujingType/yujingType.wxss */
@@ -39,17 +39,10 @@ @@ -39,17 +39,10 @@
39 "list": [] 39 "list": []
40 }, 40 },
41 "miniprogram": { 41 "miniprogram": {
42 - "current": 5, 42 + "current": 9,
43 "list": [ 43 "list": [
44 { 44 {
45 "id": -1, 45 "id": -1,
46 - "name": "qiyeyongdian",  
47 - "pathName": "pages/qiyeyongdian/qyyd/qyyd",  
48 - "query": "",  
49 - "scene": null  
50 - },  
51 - {  
52 - "id": -1,  
53 "name": "企业用电", 46 "name": "企业用电",
54 "pathName": "pages/qiyeyongdian/detail/detail", 47 "pathName": "pages/qiyeyongdian/detail/detail",
55 "query": "", 48 "query": "",
@@ -72,7 +65,7 @@ @@ -72,7 +65,7 @@
72 { 65 {
73 "id": 4, 66 "id": 4,
74 "name": "原料", 67 "name": "原料",
75 - "pathName": "pages/yuanliaomsg/yuanliao/yuanliao", 68 + "pathName": "pages/companybox/zhishudetail/yuanliaomsg/yuanliao/yuanliao",
76 "query": "", 69 "query": "",
77 "scene": null 70 "scene": null
78 }, 71 },
@@ -82,6 +75,41 @@ @@ -82,6 +75,41 @@
82 "pathName": "pages/yuanliaomsg/yuanliaoDetail/yuanliaoDetail", 75 "pathName": "pages/yuanliaomsg/yuanliaoDetail/yuanliaoDetail",
83 "query": "", 76 "query": "",
84 "scene": null 77 "scene": null
  78 + },
  79 + {
  80 + "id": 5,
  81 + "name": "预警",
  82 + "pathName": "pages/yujing/yujing/yujing",
  83 + "query": "",
  84 + "scene": null
  85 + },
  86 + {
  87 + "id": -1,
  88 + "name": "预警设置",
  89 + "pathName": "pages/yujing/yujingSet/yujingSet/yujingSet",
  90 + "query": "",
  91 + "scene": null
  92 + },
  93 + {
  94 + "id": -1,
  95 + "name": "预警设置添加",
  96 + "pathName": "pages/yujing/yujingSet/yujingAdd/yujingAdd",
  97 + "query": "",
  98 + "scene": null
  99 + },
  100 + {
  101 + "id": -1,
  102 + "name": "预警类型",
  103 + "pathName": "pages/yujing/yujingSet/yujingType/yujingType",
  104 + "query": "",
  105 + "scene": null
  106 + },
  107 + {
  108 + "id": -1,
  109 + "name": "推送人员",
  110 + "pathName": "pages/yujing/yujingSet/yujingPerson/yujingPerson",
  111 + "query": "",
  112 + "scene": null
85 } 113 }
86 ] 114 ]
87 } 115 }