Переглянути джерело

6月20号第12.3和15条需求。

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@9 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b
yinwei 2 роки тому
батько
коміт
d66d0f3786

+ 1 - 0
2.Web/.gitignore

@@ -1,6 +1,7 @@
 .DS_Store
 node_modules/
 /dist/
+/版本发布/
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*

+ 16 - 1
2.Web/src/api/axios.js

@@ -97,5 +97,20 @@ const post = (url, params, headers) => {
    })
  })
 }
+// 封装 put 请求
+const put = (url, params, headers) => {
+ return new Promise((resolve, reject) => {
+  axios
+   .put(url, params, {
+    headers: headers,
+   })
+   .then(res => {
+    resolve(res)
+   })
+   .catch(e => {
+    reject(e)
+   })
+ })
+}
 
-export { get, post }
+export { get, post, put }

+ 2 - 1
2.Web/src/api/index.js

@@ -1,4 +1,4 @@
-import { get, post } from './axios'
+import { get, post, put } from './axios'
 // let url = 'http://118.31.39.28:21008/api'
 // let url = 'http://202.107.226.68:21008/api'
 // let url = '/api'
@@ -78,6 +78,7 @@ export const equip_unbind_list = params => get(url + '/equip/unbind_list.cpp', p
 // export const get_mo_list = params => get(url + '/mo/get_list2.cpp', params) // 获取道岔名称(完成)
 export const add_equ = params => post(url + '/equip/new.cpp', params) // 新增设备(完成)
 export const update_equ = params => post(url + '/equip/update.cpp', params) // 更新设备(完成)
+export const put_zzjno = params => put(data_url + '/zzjno', params) // 修改编号(完成)
 
 // 报警管理,1个
 export const get_alarm_list = params => get(url + '/get/alarm_list.cpp', params) // 获取报警数据-旧(完成)

+ 26 - 21
2.Web/src/chart/force-curve.js

@@ -29,6 +29,7 @@ function forceOption({
  if (curve_data_list && curve_data_list.length) {
   legend_data = curve_data_list.map(item => item.name)
   curve_data_list.forEach(element => {
+   let name_list = series.map(item => item.name).filter(Boolean)
    if (element.mark_points && element.mark_points.length) {
     let mark_points = []
     element.mark_points.forEach(item => {
@@ -49,28 +50,32 @@ function forceOption({
       },
      })
     })
-    series.push({
-     name: element.name,
-     type: 'line',
-     symbol: 'none',
-     silent: true, // 开启静默模式
-     data: element.points || element.data || [],
-     color: element.color,
-     animation: false,
-     markPoint: {
-      data: mark_points,
-     },
-    })
+    if (!name_list.includes(element.name)) {
+     series.push({
+      name: element.name,
+      type: 'line',
+      symbol: 'none',
+      silent: true, // 开启静默模式
+      data: element.points || element.data || [],
+      color: element.color,
+      animation: false,
+      markPoint: {
+       data: mark_points,
+      },
+     })
+    }
    } else {
-    series.push({
-     name: element.name,
-     type: 'line',
-     symbol: 'none',
-     silent: true, // 开启静默模式
-     data: element.points || element.data || [],
-     color: element.color,
-     animation: false,
-    })
+    if (!name_list.includes(element.name)) {
+     series.push({
+      name: element.name,
+      type: 'line',
+      symbol: 'none',
+      silent: true, // 开启静默模式
+      data: element.points || element.data || [],
+      color: element.color,
+      animation: false,
+     })
+    }
    }
   })
  }

+ 0 - 1
2.Web/src/views/AlarmManagement.vue

@@ -387,7 +387,6 @@
      placeholder="请输入处理信息(非必填)"
      size="normal"
      clearable
-     @change=""
     ></el-input>
     <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="cancel_handle">取 消</el-button>

+ 8 - 1
2.Web/src/views/CurveCompare.vue

@@ -295,11 +295,18 @@ export default {
   },
   // 解析参数
   format_query(query) {
-   console.log(query)
    this.first_time = Number(query.starttime)
    this.second_time = Number(query.endtime)
    this.click_id = query.tag
    this.title = query.name
+   setTimeout(() => {
+    if (this.title.includes('.')) {
+     let target_search = this.title.split('.')
+     this.search_data = target_search[0]
+    } else {
+     this.search_data = this.title
+    }
+   }, 300)
    let mo_mp = query.tag.split('.')
    this.mo_mp.mo = mo_mp[0]
    this.mo_mp.mp = mo_mp[1]

+ 101 - 116
2.Web/src/views/CurveStatistical.vue

@@ -51,19 +51,6 @@
      end-placeholder="结束日期"
     >
     </el-date-picker>
-    <!-- <el-date-picker
-     type="date"
-     v-model="times"
-     size="small"
-     :clearable="false"
-     style="width:180px;"
-     format="yyyy年MM月dd日"
-     start-placeholder="开始日期"
-     end-placeholder="结束日期"
-     value-format="timestamp"
-     placeholder="选择日期"
-    >
-    </el-date-picker> -->
     <el-button
      style="margin-left:8px;"
      icon="el-icon-search"
@@ -72,6 +59,25 @@
      @click="get_has_records"
      >查询</el-button
     >
+    <el-button
+     icon="el-icon-arrow-left"
+     type="primary"
+     style="margin-left: 5px;"
+     size="mini"
+     v-debounce="handle_time_left"
+     >前一天</el-button
+    >
+    <el-button
+     icon="el-icon-arrow-right"
+     style="margin-left: 5px;"
+     type="primary"
+     size="mini"
+     v-debounce="handle_time_right"
+     >后一天</el-button
+    >
+    <el-button style="margin-left: 5px;" type="primary" size="mini" @click="localtion_history"
+     >历史数据</el-button
+    >
     <el-button
      style="margin-left:8px;"
      type="primary"
@@ -277,106 +283,6 @@ export default {
    /**曲线数据*/
    one_curve: {},
    two_curve: {},
-   //  one_curve: {
-   //   name: '21.J1',
-   //   unit: 'N',
-   //   time: 1673020800,
-   //   title: '转换阻力峰值统计图',
-   //   curve_data: [
-   //    {
-   //     name: '定扳反转换阻力峰值',
-   //     color: '#a8ff78',
-   //     data: [
-   //      [1673079611000, 11],
-   //      [1673086811000, 21],
-   //      [1673090411000, 17],
-   //      [1673094020000, 14],
-   //     ],
-   //    },
-   //    {
-   //     name: '反扳定转换阻力峰值',
-   //     color: '#FFE000',
-   //     data: [
-   //      [1673079611000, -18],
-   //      [1673086811000, -7],
-   //      [1673090411000, -15],
-   //      [1673094020000, -12],
-   //     ],
-   //    },
-   //   ],
-   //   line: [
-   //    {
-   //     name: '定扳反预警线',
-   //     value: 10,
-   //     color: 'yellow',
-   //    },
-   //    {
-   //     name: '定扳反告警线',
-   //     value: 26,
-   //     color: 'red',
-   //    },
-   //    {
-   //     name: '反扳定预警线',
-   //     value: -10,
-   //     color: 'yellow',
-   //    },
-   //    {
-   //     name: '反扳定告警线',
-   //     value: -16,
-   //     color: 'red',
-   //    },
-   //   ],
-   //  },
-   //  two_curve: {
-   //   name: '21.J1',
-   //   unit: 'N',
-   //   time: 1673020800,
-   //   title: '定反位锁闭力值统计图',
-   //   curve_data: [
-   //    {
-   //     name: '定位锁闭力值',
-   //     color: '#a8ff78',
-   //     data: [
-   //      [1673079611000, 11],
-   //      [1673086811000, 7],
-   //      [1673090411000, 17],
-   //      [1673094020000, 14],
-   //     ],
-   //    },
-   //    {
-   //     name: '反位锁闭力值',
-   //     color: '#FFE000',
-   //     data: [
-   //      [1673079611000, -18],
-   //      [1673086811000, -7],
-   //      [1673090411000, -15],
-   //      [1673094020000, -12],
-   //     ],
-   //    },
-   //   ],
-   //   line: [
-   //    {
-   //     name: '定位锁闭力预警线',
-   //     value: 10,
-   //     color: 'yellow',
-   //    },
-   //    {
-   //     name: '定位锁闭力告警线',
-   //     value: 16,
-   //     color: 'red',
-   //    },
-   //    {
-   //     name: '反位锁闭力预警线',
-   //     value: -10,
-   //     color: 'yellow',
-   //    },
-   //    {
-   //     name: '反位锁闭力告警线',
-   //     value: -16,
-   //     color: 'red',
-   //    },
-   //   ],
-   //  },
    /**转换阻力报警值设置*/
    convert_resist: {
     enable: false,
@@ -416,6 +322,44 @@ export default {
   }
  },
  methods: {
+  // 前往历史数据
+  localtion_history() {
+   if (!this.send_data.mo || !this.send_data.mp)
+    return this.$message({
+     type: 'warning',
+     showClose: true,
+     duration: 1500,
+     message: '请选择重要信息',
+    })
+   let route_data = {
+    name: 'force',
+    query: {
+     tag: this.click_id,
+     time: this.times[0] / 1000,
+     endtime: this.times[1] / 1000 + 24 * 60 * 60 - 1,
+     title: this.send_data.name,
+    },
+   }
+   this.$router.push(route_data)
+   this.$store.state.defaultActive = '/layout/force'
+   this.$store.commit('handle_save_defaultActive', '/layout/force')
+  },
+  // 前一天
+  handle_time_left() {
+   let start_time = this.times[0] - 24 * 60 * 60 * 1000
+   let end_time = this.times[1] - 24 * 60 * 60 * 1000
+   this.times = [start_time, end_time]
+   if (!this.click_id) return
+   return this.get_has_records()
+  },
+  // 后一天
+  handle_time_right() {
+   let start_time = this.times[0] + 24 * 60 * 60 * 1000
+   let end_time = this.times[1] + 24 * 60 * 60 * 1000
+   this.times = [start_time, end_time]
+   if (!this.click_id) return
+   return this.get_has_records()
+  },
   // 导出Image
   export_img() {
    if (!this.send_data.mo || !this.send_data.mp)
@@ -655,7 +599,6 @@ export default {
     myCharts = this.$echarts.init(document.getElementById('one'))
    }
    let option = curveStatisticalOption(this.one_curve)
-   console.log(1, option)
    myCharts.setOption(option, true)
    window.addEventListener('resize', () => {
     myCharts.resize()
@@ -674,7 +617,6 @@ export default {
     myCharts = this.$echarts.init(document.getElementById('two'))
    }
    let option = curveStatisticalOption(this.two_curve)
-   console.log(2, option)
    myCharts.setOption(option, true)
    window.addEventListener('resize', () => {
     myCharts.resize()
@@ -711,11 +653,54 @@ export default {
    this.draw_position_curve()
    this.draw_invert_curve()
   },
+  // 判断URL中是否有参数
+  url_is_query() {
+   if (this.$route.query.tag) {
+    let query = this.$route.query
+    return this.format_query(query)
+   }
+   return this.get_time()
+  },
+  // 解析query
+  format_query(query) {
+   let tag = query.tag.split('.')
+   let title = query.title
+   if (tag.length == 3) {
+    tag.splice(-1, 1)
+   }
+   this.send_data.mo = tag[0]
+   this.send_data.mp = tag[1]
+   this.send_data.name = title
+   this.click_id = query.tag
+   let start_time = null,
+    end_time = null
+   if (query.time && query.endtime) {
+    start_time = this.$dayjs(query.time * 1000).format('YYYY-MM-DD 00:00:00')
+    end_time = this.$dayjs(query.endtime * 1000).format('YYYY-MM-DD 00:00:00')
+    start_time = this.$dayjs(start_time).valueOf()
+    end_time = this.$dayjs(end_time).valueOf()
+   } else {
+    return this.get_time()
+   }
+   setTimeout(() => {
+    if (title.includes('.')) {
+     let target_search = title.split('.')
+     this.search_data = target_search[0]
+    } else {
+     this.search_data = title
+    }
+   }, 300)
+   this.times = [start_time, end_time]
+   setTimeout(() => {
+    return this.get_curve_data()
+   }, 100)
+  },
  },
  mounted() {
-  this.get_time()
+  this.url_is_query()
  },
  activated() {
+  this.url_is_query()
   if (this.click_id) {
    this.res_time = +new Date()
   } else {

+ 121 - 6
2.Web/src/views/Equipment.vue

@@ -42,6 +42,8 @@
     :data="getSearchInfo.slice((currpage - 1) * pageSize, currpage * pageSize)"
     max-height="600px"
     style="width: 100%"
+    @sort-change="handleSortChange"
+    :default-sort="{ prop: 'zzjno', order: 'ascending' }"
    >
     <el-table-column prop="up_name" show-overflow-tooltip width="200px" label="站" align="center">
     </el-table-column>
@@ -56,7 +58,18 @@
       <span>{{ scope.row.zzj_type || '-' }}</span>
      </template>
     </el-table-column>
-    <el-table-column prop="zzjno" label="转辙机编号" width="110" align="center"> </el-table-column>
+    <el-table-column prop="zzjno" sortable="custom" label="转辙机编号" width="120" align="center">
+     <template slot-scope="scope">
+      <template v-if="scope.row.zzjno">
+       <el-link type="primary" @click="zzjno_modify(scope.row)" title="点击可修改">{{
+        scope.row.zzjno
+       }}</el-link>
+      </template>
+      <template v-else>
+       <span>-</span>
+      </template>
+     </template>
+    </el-table-column>
     <el-table-column prop="mp" label="牵引点名称" width="110" align="center"> </el-table-column>
     <el-table-column prop="iMEI" label="设备号" show-overflow-tooltip width="155" align="center">
      <template slot-scope="scope">
@@ -456,15 +469,53 @@
     </span>
    </el-dialog>
   </div>
+  <!-- 修改zzjno -->
+  <div class="upload_bin">
+   <el-dialog
+    width="400px"
+    title="修改转辙机编号"
+    :lock-scroll="true"
+    :show-close="true"
+    @close="handle_zzjno_modify('cancel')"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :visible.sync="modify_zzjno_dialogVisible"
+   >
+    <div style="text-align:left;">
+     <p>
+      <span
+       >相关信息:<b
+        >{{ source_data.up_name }}({{ source_data.mo_name }}.{{ source_data.mp }})</b
+       ></span
+      >
+     </p>
+     <p>
+      <span
+       >原始编号:<b>{{ source_data.zzjno }}</b></span
+      >
+     </p>
+     <p>
+      <span>新的编号:</span>
+      <el-input
+       v-model="zzjno_modify_data.newNumber"
+       placeholder="请输入新编号"
+       style="margin-bottom:5px;width:200px;"
+       size="small"
+      ></el-input>
+     </p>
+    </div>
+    <span slot="footer" class="dialog-footer">
+     <el-button size="small" @click="handle_zzjno_modify('cancel')">取 消</el-button>
+     <el-button size="small" type="primary" @click="handle_zzjno_modify('confirm')"
+      >确 定</el-button
+     >
+    </span>
+   </el-dialog>
+  </div>
  </div>
 </template>
 
 <script>
-/**
- * 明日任务:
- *  -新增;
- *  -编辑
- */
 import {
  equip_list,
  equip_delete,
@@ -475,12 +526,14 @@ import {
  update_equ,
  station_list,
  equ_post_soft,
+ put_zzjno,
 } from '../api'
 import ExportExcel from '../commonTools/ExportExcel.vue' // 导出表格组件
 export default {
  name: 'Equipment',
  data() {
   return {
+   modify_zzjno_dialogVisible: false,
    bind_dialogVisible: false,
    add_edit_dialogVisible: false,
    upload_dialogVisible: false,
@@ -654,6 +707,12 @@ export default {
    ],
    export_table: [], // 导出的数据
    btnSize: 'small',
+   source_data: {},
+   zzjno_modify_data: {
+    mo: null,
+    mp: null,
+    newNumber: null,
+   },
   }
  },
  components: {
@@ -691,6 +750,62 @@ export default {
   },
  },
  methods: {
+  // 点击zzjno修改
+  zzjno_modify(row) {
+   let copy_data = _.cloneDeep(row)
+   this.source_data = _.cloneDeep(row)
+   this.zzjno_modify_data.mo = copy_data.mo
+   this.zzjno_modify_data.mp = copy_data.mp
+   this.modify_zzjno_dialogVisible = true
+  },
+  // 判断是否为数字
+  isPositiveInteger(str) {
+   let regex = /^[1-9]\d*$/
+   return regex.test(str)
+  },
+  // 排序
+  handleSortChange({ column, prop, order }) {
+   if (prop != 'zzjno') return
+   if (!this.tableData.length) return
+   let order_map = {
+    ascending: 'asc',
+    descending: 'desc',
+   }
+   this.tableData = _.orderBy(this.tableData, ['zzjno'], [order_map[order]])
+  },
+  // 确认/取消修改zzjno
+  handle_zzjno_modify(type) {
+   switch (type) {
+    case 'cancel':
+     this.zzjno_modify_data = {
+      mo: null,
+      mp: null,
+      newNumber: null,
+     }
+     this.source_data = {}
+     this.modify_zzjno_dialogVisible = false
+     break
+    default:
+     if (!this.zzjno_modify_data.newNumber) return this.$message.warning('请输入新编号...')
+     if (!this.isPositiveInteger(this.zzjno_modify_data.newNumber))
+      return this.$message.warning('请输入正确的编号...')
+     let zzjno_list = this.copy_tableData.map(item => item.zzjno)
+     let num = Number(this.zzjno_modify_data.newNumber)
+     if (zzjno_list.includes(num)) return this.$message.warning('该编号已存在...')
+     this.zzjno_modify_data.newNumber = num
+     let send_data = _.cloneDeep(this.zzjno_modify_data)
+     put_zzjno(send_data)
+      .then(res => {
+       this.handle_zzjno_modify('cancel')
+       this.$message.success('修改成功!')
+       return this.get_equip_list()
+      })
+      .catch(e => {
+       console.log(e)
+      })
+     break
+   }
+  },
   // 设备在离线变化
   equ_state_change(val) {
    if (val == 0) {

+ 54 - 12
2.Web/src/views/Force.vue

@@ -72,6 +72,9 @@
      v-debounce="handle_time_right"
      >后一天</el-button
     >
+    <el-button style="margin-left: 5px;" type="primary" size="mini" @click="localtion_curve_statics"
+     >曲线统计</el-button
+    >
     <el-button
      style="margin-left:8px;"
      v-show="$route.query.type"
@@ -548,14 +551,14 @@ export default {
   },
  },
  methods: {
-  // 前两个小时
+  // 前一天
   handle_time_left() {
    let start_time = this.times[0] - 24 * 60 * 60 * 1000
    let end_time = this.times[1] - 24 * 60 * 60 * 1000
    this.times = [start_time, end_time]
    return this.get_curve_data('is_query')
   },
-  // 后两个小时
+  // 后一天
   handle_time_right() {
    let start_time = this.times[0] + 24 * 60 * 60 * 1000
    let end_time = this.times[1] + 24 * 60 * 60 * 1000
@@ -1135,6 +1138,7 @@ export default {
    }
    this.curve_data = new Object()
    let date_num = +new Date()
+   this.curve_data.title = this.title
    resist_data(send_data)
     .then(res => {
      console.log(`1.获取数据耗时:${+new Date() - date_num} ms`)
@@ -1189,6 +1193,28 @@ export default {
      console.log(e)
     })
   },
+  // 前往历史数据
+  localtion_curve_statics() {
+   if (!this.get_tem.mo || !this.get_tem.mp)
+    return this.$message({
+     type: 'warning',
+     showClose: true,
+     duration: 1500,
+     message: '请选择重要信息',
+    })
+   let route_data = {
+    name: 'curve_statistical',
+    query: {
+     tag: this.click_id,
+     time: this.times[0] / 1000,
+     endtime: this.times[1] / 1000,
+     title: this.title,
+    },
+   }
+   this.$router.push(route_data)
+   this.$store.state.defaultActive = '/layout/curve_statistical'
+   this.$store.commit('handle_save_defaultActive', '/layout/curve_statistical')
+  },
   // 获取更多数据
   get_more_data(data, source, count, points_num) {
    let date_num = +new Date()
@@ -1747,12 +1773,13 @@ export default {
     let query = this.$route.query
     return this.format_query(query)
    }
-   return
+   return this.get_time()
   },
   // 解析query
   format_query(query) {
    this.is_query = true
    let tag = query.tag.split('.')
+   let title = query.title
    if (tag.length == 3) {
     tag.splice(-1, 1)
    }
@@ -1760,29 +1787,44 @@ export default {
    this.get_tem.mp = tag[1]
    this.send_data.tag = tag.join('.') + '.resist'
    this.query_hist_confirm.tag = tag.join('.') + '.resist'
-   if (!query.time || !query.time.length) {
+   this.click_id = query.tag
+   if (!query.time) {
     this.get_max_over_tag = tag.join('.')
     this.get_time()
     this.show_chart = true
     this.loading = true
-    this.title = query.title
+    this.title = title
     setTimeout(() => {
      this.get_curve_data()
     }, 150)
     return
    }
-   let time = this.$dayjs(query.time).unix()
-   let start_time = (time - 600) * 1000
-   let end_time = (time + 600) * 1000
+   let time = null,
+    start_time = null,
+    end_time = null
+   if (query.time && query.endtime) {
+    start_time = query.time * 1000
+    end_time = query.endtime * 1000
+   } else {
+    time = this.$dayjs(query.time).unix()
+    start_time = (time - 600) * 1000
+    end_time = (time + 600) * 1000
+   }
    this.times = [start_time, end_time]
    this.title = tag.join('.')
-   if (query.title) {
-    this.title = query.title
-   }
+   if (title) this.title = title
    if (query.alarm_layer) {
     let content = query.alarm_layer.split('.')
     this.title = content[1] + '.' + content[2]
    }
+   setTimeout(() => {
+    if (this.title.includes('.')) {
+     let target_search = this.title.split('.')
+     this.search_data = target_search[0]
+    } else {
+     this.search_data = this.title
+    }
+   }, 300)
    this.get_max_over_tag = tag.join('.')
    this.show_chart = true
    this.loading = true
@@ -1792,6 +1834,7 @@ export default {
   },
   // 获取默认时间
   get_time() {
+   console.log(1)
    let threshold_val = localStorage.getItem('threshold_val')
    if (threshold_val) this.threshold_val = Number(threshold_val)
    let start_times = this.$dayjs().format('YYYY-MM-DD 00:00:00')
@@ -1825,7 +1868,6 @@ export default {
   },
  },
  mounted() {
-  this.get_time()
   this.get_conf_read()
   this.url_is_query()
  },