Quellcode durchsuchen

产品详情接口完善

13219261128 vor 3 Jahren
Ursprung
Commit
e321e1653f

+ 0 - 8
src/api/modules/equipmentManage.api.js

@@ -65,14 +65,6 @@ export default ({
65
           method: 'get',
65
           method: 'get',
66
         })
66
         })
67
       },
67
       },
68
-        //设备详情-运行数据
69
-      runData( data ) {
70
-        return request({
71
-          url: `/device-data/getPageList`,
72
-          method: 'post',
73
-          data
74
-        })
75
-      },
76
         //设备详情-设备运行历史数据
68
         //设备详情-设备运行历史数据
77
       getPintsPageList( data ) {
69
       getPintsPageList( data ) {
78
         return request({
70
         return request({

+ 40 - 1
src/api/modules/productManage.api.js

@@ -82,7 +82,46 @@ export default ({
82
             url: `/productCategory/getSonList/${orgCode}`,
82
             url: `/productCategory/getSonList/${orgCode}`,
83
             method: 'get',
83
             method: 'get',
84
           })
84
           })
85
-        }
85
+        },
86
+        //产品详情-运行数据
87
+        runData( data ) {
88
+          return request({
89
+            url: `/productInfo/getDeviceRunDataPageList`,
90
+            method: 'post',
91
+            data
92
+          })
93
+        },
86
 
94
 
95
+        //产品详情-运行数据-开始检测
96
+        ordersSend( data ) {
97
+          return request({
98
+            url: `/gotOrders/send`,
99
+            method: 'post',
100
+            data
101
+          })
102
+        },
103
+        //产品详情-运行数据-查看详情
104
+        runDataDetail( id ) {
105
+          return request({
106
+            url: `/productInfo/getDeviceRunData/${id}`,
107
+            method: 'get'
108
+          })
109
+        },
110
+        //产品详情-设备信息-添加关联
111
+        addAssociationsProduct( data ) {
112
+          return request({
113
+            url: `/productInfo/addAssociationsProduct`,
114
+            method: 'post',
115
+            data
116
+          })
117
+        },
118
+        //产品详情-设备信息-取消关联
119
+        disassociateProduct( id ) {
120
+          return request({
121
+            url: `productInfo/disassociateProduct/${id}`,
122
+            method: 'get',
123
+          })
124
+        },
125
+        
87
   })
126
   })
88
   
127
   

+ 1 - 1
src/views/demo/equipmentManage/equipmentInfo/index.vue

@@ -651,7 +651,7 @@ export default {
651
           console.log('收到来着',topic,'的信息',message.toString())
651
           console.log('收到来着',topic,'的信息',message.toString())
652
           const res = JSON.parse(message.toString())
652
           const res = JSON.parse(message.toString())
653
           this.runData=res.data
653
           this.runData=res.data
654
-          //console.log(res, 'res')
654
+          console.log(res, 'res',this.runData,'runData')
655
           // switch(topic) {
655
           // switch(topic) {
656
           //    case 'top/lll' :
656
           //    case 'top/lll' :
657
           //      this.msg = res.msg
657
           //      this.msg = res.msg

+ 231 - 35
src/views/demo/productManage/productInfo/index.vue

@@ -143,7 +143,7 @@
143
                     <el-form-item label="时间:">
143
                     <el-form-item label="时间:">
144
                       <el-date-picker
144
                       <el-date-picker
145
                         size="mini"
145
                         size="mini"
146
-                        v-model="formTime.time"
146
+                        v-model="formTime.dataTime"
147
                         type="date"
147
                         type="date"
148
                         placeholder="请选择">
148
                         placeholder="请选择">
149
                       </el-date-picker>
149
                       </el-date-picker>
@@ -153,6 +153,7 @@
153
                         size="mini"
153
                         size="mini"
154
                         type="primary"
154
                         type="primary"
155
                         icon="el-icon-search"
155
                         icon="el-icon-search"
156
+                        @click="getRun()"
156
                         >查询</el-button
157
                         >查询</el-button
157
                       >
158
                       >
158
                     </el-form-item>
159
                     </el-form-item>
@@ -162,7 +163,7 @@
162
                         size="mini"
163
                         size="mini"
163
                         type="primary"
164
                         type="primary"
164
                         icon="el-icon-refresh-left"
165
                         icon="el-icon-refresh-left"
165
-                        @click="formTime.time = ''"
166
+                        @click="formTime.dataTime = '';getRun()"
166
                         >重置</el-button
167
                         >重置</el-button
167
                       >
168
                       >
168
                     </el-form-item>
169
                     </el-form-item>
@@ -187,9 +188,9 @@
187
                     :index="indexMethod"
188
                     :index="indexMethod"
188
                     show-overflow-tooltip
189
                     show-overflow-tooltip
189
                   ></el-table-column>
190
                   ></el-table-column>
190
-                  <!-- <el-table-column prop="device" label="检测时间" align="center">
191
+                  <el-table-column prop="dataTime" label="检测时间" width="200" align="center">
191
                   </el-table-column>
192
                   </el-table-column>
192
-                  <el-table-column prop="device" label="设备编号" align="center">
193
+                  <!-- <el-table-column prop="device" label="设备编号" align="center">
193
                   </el-table-column>
194
                   </el-table-column>
194
                   <el-table-column prop="tempValue" label="温度(℃)" align="center">
195
                   <el-table-column prop="tempValue" label="温度(℃)" align="center">
195
                   </el-table-column>
196
                   </el-table-column>
@@ -216,21 +217,21 @@
216
                   >
217
                   >
217
                   </el-table-column> -->
218
                   </el-table-column> -->
218
 
219
 
219
-                  <el-table-column prop="scanNum" label="最高温度(℃)" align="center">
220
+                  <el-table-column prop="maxValue" label="最高温度(℃)" align="center">
220
                   </el-table-column>
221
                   </el-table-column>
221
 
222
 
222
-                  <el-table-column prop="scanNum" label="最低温度(℃)" align="center">
223
+                  <el-table-column prop="minValue" label="最低温度(℃)" align="center">
223
                   </el-table-column>
224
                   </el-table-column>
224
-                  <el-table-column prop="scanNum" label="平均温度(℃)" align="center">
225
+                  <el-table-column prop="avgValue" label="平均温度(℃)" align="center">
225
                   </el-table-column>
226
                   </el-table-column>
226
-                  <el-table-column prop="scanNum" label="最高湿度(%RH)" align="center">
227
+                  <el-table-column prop="maxWet" label="最高湿度(%RH)" align="center">
227
                   </el-table-column>
228
                   </el-table-column>
228
 
229
 
229
-                  <el-table-column prop="scanNum" label="最低湿度(%RH)" align="center">
230
+                  <el-table-column prop="minWet" label="最低湿度(%RH)" align="center">
230
                   </el-table-column>
231
                   </el-table-column>
231
-                  <el-table-column prop="scanNum" label="平均湿度(%RH)" align="center">
232
+                  <el-table-column prop="avgWet" label="平均湿度(%RH)" align="center">
232
                   </el-table-column>
233
                   </el-table-column>
233
-                  <el-table-column prop="scanNum" label="平均露点温度(℃)" align="center">
234
+                  <el-table-column prop="avgDew" label="平均露点温度(℃)" align="center">
234
                   </el-table-column>
235
                   </el-table-column>
235
                   <el-table-column label="操作" width="140" align="center">
236
                   <el-table-column label="操作" width="140" align="center">
236
                     <template slot-scope="scope">
237
                     <template slot-scope="scope">
@@ -243,6 +244,16 @@
243
                     </template>
244
                     </template>
244
                   </el-table-column>
245
                   </el-table-column>
245
                 </el-table>
246
                 </el-table>
247
+                <el-pagination
248
+                  @size-change="handleSizeChange2"
249
+                  @current-change="handleCurrentChange2"
250
+                  :current-page="1"
251
+                  :page-sizes="[10, 20, 30, 40]"
252
+                  :page-size="pagination2.pageSize"
253
+                  layout="total, sizes, prev, pager, next, jumper"
254
+                  :total="pagination2.total"
255
+                >
256
+                </el-pagination>
246
               </el-tab-pane>
257
               </el-tab-pane>
247
 
258
 
248
               <el-tab-pane label="报警记录" name="fourth"></el-tab-pane>
259
               <el-tab-pane label="报警记录" name="fourth"></el-tab-pane>
@@ -264,14 +275,14 @@
264
                   <el-form-item label="设备名称:">
275
                   <el-form-item label="设备名称:">
265
                   <el-select
276
                   <el-select
266
                     size="mini"
277
                     size="mini"
267
-                    v-model="formInline.eqName"
278
+                    v-model="formInline.eqCode"
268
                     placeholder="请选择"
279
                     placeholder="请选择"
269
                   >
280
                   >
270
                     <el-option
281
                     <el-option
271
-                      v-for="item in productData"
282
+                      v-for="item in productData1"
272
                       :key="item.id"
283
                       :key="item.id"
273
                       :label="item.eqName"
284
                       :label="item.eqName"
274
-                      :value="item.eqName"
285
+                      :value="item.eqCode"
275
                     >
286
                     >
276
                     </el-option>
287
                     </el-option>
277
                   </el-select>
288
                   </el-select>
@@ -298,8 +309,9 @@
298
             
309
             
299
               <el-table
310
               <el-table
300
               ref="multipleTable"
311
               ref="multipleTable"
301
-                :data="productData"
312
+                :data="productData1"
302
                 border
313
                 border
314
+                @selection-change="handleSelectionChange"
303
                 style="width: 100%"
315
                 style="width: 100%"
304
               >
316
               >
305
     <el-table-column
317
     <el-table-column
@@ -521,8 +533,9 @@ export default {
521
       info:{},
533
       info:{},
522
       dialogTableVisible:false,
534
       dialogTableVisible:false,
523
       formInline:{},
535
       formInline:{},
524
-      formTime:{time:''},
536
+      formTime:{dataTime:''},
525
       productData:[{}],
537
       productData:[{}],
538
+      productData1:[{}],
526
       activeName: "first",
539
       activeName: "first",
527
       checkInfo: [
540
       checkInfo: [
528
         {
541
         {
@@ -585,6 +598,7 @@ export default {
585
           val1: [""],
598
           val1: [""],
586
         },
599
         },
587
       ],
600
       ],
601
+      deviceInfoList:[],
588
       //分页
602
       //分页
589
       pagination: {
603
       pagination: {
590
         // 每页显示的条数
604
         // 每页显示的条数
@@ -603,14 +617,52 @@ export default {
603
         // 总数
617
         // 总数
604
         total: 20,
618
         total: 20,
605
       },
619
       },
620
+      //运行数据分页
621
+      pagination2: {
622
+        // 每页显示的条数
623
+        pageSize: 10,
624
+        // 当前页
625
+        curPage: 1,
626
+        // 总数
627
+        total: 20,
628
+      },
606
     };
629
     };
607
   },
630
   },
608
   created(){
631
   created(){
609
     this.getBasic()
632
     this.getBasic()
610
-    this.getList()
611
 
633
 
612
   },
634
   },
613
   methods: {
635
   methods: {
636
+    //添加关联
637
+    sure(){
638
+      let data={
639
+        deviceInfoList:this.deviceInfoList,
640
+        proCode:this.info.proCode
641
+      }
642
+      api.addAssociationsProduct(data)
643
+        .then((res) => {
644
+          if (res.code == 200) {
645
+            this.dialogTableVisible = false;
646
+            this.getList()
647
+            this.$message({
648
+              type: "success",
649
+              message: "关联成功",
650
+            });
651
+          }else{
652
+            this.$message({
653
+              type: "error",
654
+              message: res.msg,
655
+            });
656
+          }
657
+        })
658
+        .catch((err) => {
659
+          console.log(err);
660
+        });
661
+    },
662
+    handleSelectionChange(val) {
663
+      console.log(val);
664
+      this.deviceInfoList = val;
665
+    },
614
     //检测开始
666
     //检测开始
615
     checkStart() {
667
     checkStart() {
616
       this.$confirm("确认发送温湿度检测请求?", "检测操作提示", {
668
       this.$confirm("确认发送温湿度检测请求?", "检测操作提示", {
@@ -618,10 +670,32 @@ export default {
618
         cancelButtonText: "取消",
670
         cancelButtonText: "取消",
619
         type: "warning",
671
         type: "warning",
620
       }).then(() => {
672
       }).then(() => {
621
-        this.$message({
622
-          type: "success",
623
-          message: "发送成功",
673
+        console.log(this.info);
674
+        let data={
675
+          orgCode: this.info.orgCode,
676
+          labelCode: this.runData[0].labelCode,
677
+          // eqCode: this.info.eqCode,
678
+          proCategoryCode: this.info.proCategoryCode
679
+        }
680
+        api.ordersSend(data)
681
+        .then((res) => {
682
+          if (res.code == 200) {
683
+            this.getRun();
684
+            this.$message({
685
+              type: "success",
686
+              message: "发送成功",
687
+            });
688
+          }else{
689
+            this.$message({
690
+              type: "error",
691
+              message: res.msg,
692
+            });
693
+          }
694
+        })
695
+        .catch((err) => {
696
+          console.log(err);
624
         });
697
         });
698
+
625
       });
699
       });
626
     },
700
     },
627
     // 查看检测信息
701
     // 查看检测信息
@@ -629,16 +703,69 @@ export default {
629
       console.log(12);
703
       console.log(12);
630
       this.$set(this, "checkDialog", true);
704
       this.$set(this, "checkDialog", true);
631
       this.checkDialog = true;
705
       this.checkDialog = true;
706
+      this.checkInfo=[
707
+        {
708
+          name: "检测时间",
709
+          val: [row.dataTime],
710
+        },
711
+        {
712
+          name: "最高温度(℃)",
713
+          val: [row.maxValue],
714
+          name1: "最低温度(℃)",
715
+          val1: [row.minValue],
716
+          name2: "平均温度(℃)",
717
+          val2: [row.avgValue],
718
+        },
719
+        {
720
+          name: "最高湿度(%RH)",
721
+          val: [row.maxWet],
722
+          name1: "最低湿度(%RH)",
723
+          val1: [row.minWet],
724
+          name2: "平均湿度(%RH)",
725
+          val2: [row.avgWet],
726
+        },
727
+        {
728
+          name: "最高露点温度(℃)",
729
+          val: [row.maxDew],
730
+          name1: "最低露点温度(℃)",
731
+          val1: [row.minDew],
732
+          name2: "平均露点温度(℃)",
733
+          val2: [row.avgDew],
734
+        },
735
+      ]
736
+      api.runDataDetail(row.id)
737
+        .then((res) => {
738
+          if (res.code == 200) {
739
+            let data=res.data
740
+            this.checkInfo1=[]
741
+            data.forEach(item=>{
742
+              this.checkInfo1.push(
743
+                {
744
+                  title:item.sign,
745
+                  name: "温度(℃)",
746
+                  val: [item.tempValue],
747
+                  name1: "湿度(%RH)",
748
+                  val1: [item.wetValue],
749
+                  name2: "露点温度(℃)",
750
+                  val2: [item.dewValue],
751
+                }
752
+              )
753
+            })
754
+          }
755
+        })
756
+        .catch((err) => {
757
+          console.log(err);
758
+        });
632
     },
759
     },
633
     search() {
760
     search() {
634
-      this.getList()
761
+      this.getList1()
635
 
762
 
636
     },
763
     },
637
     reset() {
764
     reset() {
638
-      this.pagination.curPage=1;
639
-      this.pagination.pageSize=10;
765
+      this.pagination1.curPage=1;
766
+      this.pagination1.pageSize=10;
640
       this.formInline={}
767
       this.formInline={}
641
-      this.getList()
768
+      this.getList1()
642
     },
769
     },
643
     closeAddSb() {
770
     closeAddSb() {
644
       this.formInline = {};
771
       this.formInline = {};
@@ -649,10 +776,11 @@ export default {
649
     },
776
     },
650
     //获取列表数据
777
     //获取列表数据
651
     getList() {
778
     getList() {
652
-      var condition = this.formInline;
653
-      condition = JSON.stringify(condition);
779
+      let condition = {};
654
       condition.org_code=localStorage.getItem("orgCode");
780
       condition.org_code=localStorage.getItem("orgCode");
655
-      var data = {
781
+      condition.proCode=this.info.proCode;
782
+      condition = JSON.stringify(condition);
783
+      let data = {
656
         pageIndex: this.pagination.curPage,
784
         pageIndex: this.pagination.curPage,
657
         pageSize: this.pagination.pageSize,
785
         pageSize: this.pagination.pageSize,
658
         condition: condition,
786
         condition: condition,
@@ -660,6 +788,7 @@ export default {
660
       api.equipmentList(data)
788
       api.equipmentList(data)
661
         .then((res) => {
789
         .then((res) => {
662
           if (res.code == 200) {
790
           if (res.code == 200) {
791
+            console.log(res.data,11);
663
             this.productData = res.data.records;
792
             this.productData = res.data.records;
664
             this.pagination.pageSize = res.data.size;
793
             this.pagination.pageSize = res.data.size;
665
             this.pagination.total = res.data.total;
794
             this.pagination.total = res.data.total;
@@ -669,6 +798,29 @@ export default {
669
           console.log(err);
798
           console.log(err);
670
         });
799
         });
671
     },
800
     },
801
+    //获取列表数据
802
+    getList1() {
803
+      let condition = this.formInline;
804
+      condition.org_code=localStorage.getItem("orgCode");
805
+      condition = JSON.stringify(condition);
806
+      let data = {
807
+        pageIndex: this.pagination.curPage,
808
+        pageSize: this.pagination.pageSize,
809
+        condition: condition,
810
+      };
811
+      api.equipmentList(data)
812
+        .then((res) => {
813
+          if (res.code == 200) {
814
+            console.log(res.data,11);
815
+            this.productData1 = res.data.records;
816
+            this.pagination1.pageSize = res.data.size;
817
+            this.pagination1.total = res.data.total;
818
+          }
819
+        })
820
+        .catch((err) => {
821
+          console.log(err);
822
+        });
823
+    },
672
     edit(){
824
     edit(){
673
       this.$refs.addDialog.dialogFormVisible=true
825
       this.$refs.addDialog.dialogFormVisible=true
674
             this.$refs.addDialog.getInfo(this.info)
826
             this.$refs.addDialog.getInfo(this.info)
@@ -719,9 +871,23 @@ export default {
719
           cancelButtonText: '取消',
871
           cancelButtonText: '取消',
720
           type: 'warning'
872
           type: 'warning'
721
         }).then(() => {
873
         }).then(() => {
722
-          this.$message({
723
-            type: 'success',
724
-            message: '取消关联成功'
874
+          api.disassociateProduct(row.id)
875
+          .then((res) => {
876
+            if (res.code == 200) {
877
+              this.getList()
878
+              this.$message({
879
+                type: "success",
880
+                message: "取消成功",
881
+              });
882
+            }else{
883
+              this.$message({
884
+                type: "error",
885
+                message: res.msg,
886
+              });
887
+            }
888
+          })
889
+          .catch((err) => {
890
+            console.log(err);
725
           });
891
           });
726
         })
892
         })
727
     },
893
     },
@@ -733,19 +899,39 @@ export default {
733
       if(v.name=='fourth'){
899
       if(v.name=='fourth'){
734
         this.$router.push({ path: "alarmRecord" })
900
         this.$router.push({ path: "alarmRecord" })
735
       }else if(v.name=='second'){
901
       }else if(v.name=='second'){
736
-        api
737
-          .runData()
902
+        this.getRun()
903
+      }else if(v.name=='third'){
904
+        this.getList()
905
+        this.getList1()
906
+      }
907
+    },
908
+    //获取历史定时任务数据
909
+    getRun(){
910
+      var condition = this.formTime;
911
+      condition.proCode = this.info.proCode;
912
+      condition.orgCode = this.info.orgCode;
913
+      condition = JSON.stringify(condition);
914
+      var data = {
915
+          pageIndex: this.pagination2.curPage,
916
+          pageSize: this.pagination2.pageSize,
917
+          condition: condition,
918
+        };
919
+      api
920
+          .runData(data)
738
           .then((res) => {
921
           .then((res) => {
739
             if (res.code == 200) {
922
             if (res.code == 200) {
740
-              this.runData=res.data.records
923
+              this.runData=res.data.records;
924
+              this.runData.forEach(item=>{
925
+                item.points=JSON.parse(item.points)
926
+              })
927
+              this.pagination2.pageSize = res.data.size;
928
+              this.pagination2.total = res.data.total;
741
             }
929
             }
742
           })
930
           })
743
           .catch((err) => {
931
           .catch((err) => {
744
             console.log(err);
932
             console.log(err);
745
           });
933
           });
746
-      }
747
     },
934
     },
748
-
749
     //表格序号
935
     //表格序号
750
     indexMethod(index) {
936
     indexMethod(index) {
751
       return (
937
       return (
@@ -772,6 +958,16 @@ export default {
772
       this.pagination1.curPage = val;
958
       this.pagination1.curPage = val;
773
       this.getList();
959
       this.getList();
774
     },
960
     },
961
+    // 每页条数改变
962
+    handleSizeChange2(val) {
963
+      this.pagination2.pageSize = val;
964
+      this.getRun();
965
+    },
966
+    // 当前页改变
967
+    handleCurrentChange2(val) {
968
+      this.pagination2.curPage = val;
969
+      this.getRun();
970
+    },
775
   },
971
   },
776
   mounted() {},
972
   mounted() {},
777
 };
973
 };