Ver Fonte

放开点位查询1年

hfxc226 há 1 ano atrás
pai
commit
1d2f975bb1

+ 3 - 2
src/api/influxDB/influxDB.js

@@ -37,8 +37,9 @@ export function updateInfluxDBBatch (parameter) {
  */
 export function queryInfluxDBHistory (parameter) {
   return axios({
-    url: '/influxDB/' + parameter.id + '/' + parameter.type,
+    url: '/influxDB/select?' + stringify(parameter),
     method: 'get',
+    data: parameter,
     headers: {
       'Content-Type': 'application/json;charset=UTF-8'
     }
@@ -53,7 +54,7 @@ export function queryInfluxDBHistory (parameter) {
  */
 export function exportInfluxDBHistory (parameter) {
   return axios({
-    url: '/influxDB/export/' + parameter.id + '/' + parameter.type,
+    url: '/influxDB/export?' + stringify(parameter),
     method: 'get',
     headers: {
       'Content-Type': 'application/json;charset=UTF-8'

+ 6 - 0
src/views/opc/OpcInfo.vue

@@ -118,6 +118,7 @@
     <div class="btn">
       <a-button-group>
         <a-button v-for="item in list" :key="item.id" :disabled="positionId===item.id" @click="getOpcInfo(item.id)">{{ item.name }}</a-button>
+        <a-button @click="back()">返回主页</a-button>
       </a-button-group>
     </div>
     <detail ref="detailModal" @ok="handleOk" />
@@ -217,6 +218,11 @@ export default {
     handleShow (val, key) {
       this.dotList[val].positionFlag = key
     },
+    back () {
+      const a = document.createElement('a')
+      a.href = '/sb/position/opc/for/producer'
+      a.click()
+    },
     getOpcInfo (positionId) {
       this.positionId = positionId
       queryRemoteOpc({ line: this.positionId })

+ 56 - 10
src/views/remote/opc-log/modules/Detail.vue

@@ -15,7 +15,7 @@
             :format="BaseTool.Date.PICKER_NORM_DATE_PATTERN"
             @change="onChange"
             v-model="searchDay"/>-->
-          <a-select v-model="searchDay" style="width: 120px" @change="onChange">
+<!--          <a-select v-model="searchDay" style="width: 120px" @change="onChange">
             <a-select-option :value="parseInt('1')">
               5分钟
             </a-select-option>
@@ -49,7 +49,28 @@
             <a-select-option value="11">
               一年
             </a-select-option>
-          </a-select>
+          </a-select>-->
+          <a-date-picker
+            style="margin-left: 8px"
+            :format="monthFormat"
+            showTime
+            v-model="startTime"
+            placeholder="开始月份"
+            @change="onStartChange" />
+          <a-date-picker
+            style="margin-left: 8px"
+            :format="monthFormat"
+            showTime
+            v-model="endTime"
+            placeholder="结束月份"
+            @change="onEndChange" />
+          <a-button
+            style="margin-left: 8px"
+            v-if="$auth('remote-opc-logs-export')"
+            type="primary"
+            :loading="confirmLoading"
+            @click="doSelect">查询
+          </a-button>
           <a-button
             style="margin-left: 8px"
             v-if="$auth('remote-opc-logs-export')"
@@ -118,6 +139,9 @@ export default {
       mdl: {},
       modalTitle: null,
       searchDay: 1,
+      startTime: null,
+      endTime: null,
+      monthFormat: 'YYYY-MM-DD HH:mm:ss',
       map: {},
       visible: false,
       // 下拉框map
@@ -172,10 +196,10 @@ export default {
   methods: {
     base (record) {
       this.visible = true
-      this.confirmLoading = true
+      this.confirmLoading = false
       this.modalTitle = '详情'
       this.model = record
-      this.onChange(1)
+      // this.onChange(1)
     },
     getCharts () {
       // this.chart && this.chart.destroy()// 防止点击搜索按钮新增一个
@@ -226,13 +250,25 @@ export default {
       this.chart.point().position('time*value')
       this.chart.render()
     },
-    onChange (value) {
+    onStartChange (date, dateString) {
+      this.startTime = this.BaseTool.Date.formatter(dateString, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+    },
+    onEndChange (date, dateString) {
+      this.endTime = this.BaseTool.Date.formatter(dateString, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
+    },
+    doSelect () {
+      if (this.startTime == null) {
+        this.$message.error('请选择查询开始时间')
+        return
+      }
+      if (this.endTime == null) {
+        this.$message.error('请选择查询截止时间')
+        return
+      }
       this.confirmLoading = true
-      this.searchDay = value
-      const parameter = {}
-      parameter.id = this.model.id
-      parameter.type = value
-      queryInfluxDBHistory(parameter).then(res => {
+      this.model.startTime = this.startTime
+      this.model.endTime = this.endTime
+      queryInfluxDBHistory(this.model).then(res => {
         this.model = res.data
         if (this.model.dataJsonStr == null) {
           this.$message.info('无数据')
@@ -247,7 +283,17 @@ export default {
       })
     },
     doExport () {
+      if (this.startTime == null) {
+        this.$message.error('请选择查询开始时间')
+        return
+      }
+      if (this.endTime == null) {
+        this.$message.error('请选择查询截止时间')
+        return
+      }
       this.confirmLoading = true
+      this.model.startTime = this.startTime
+      this.model.endTime = this.endTime
       exportInfluxDBHistory(this.model).then(file => {
         this.BaseTool.UPLOAD.downLoadExportExcel(file)
         this.confirmLoading = false

+ 2 - 2
src/views/remote/opc/RemoteOpc.vue

@@ -142,7 +142,7 @@
               v-if="record.type == 2"
               @click="handleAddFetch(record)">设置M点位
             </a>
-<!--            <a
+            <a
               style="margin-left: 8px"
               @click="doTestAdd(record)">测试写入
             </a>
@@ -155,7 +155,7 @@
             <a
               style="margin-left: 8px"
               @click="doTestSelect(record)">测试查询
-            </a>-->
+            </a>
           </template>
         </span>
       </s-table>