Browse Source

能源时间优化

Shannon_mu 3 years ago
parent
commit
0a77513d1d

+ 0 - 46
energyManagement/src/views/instrumentManagement/baseData.js

@@ -753,51 +753,5 @@ export const AlertsCols = [
     prop: 'alarmDescribe'
   }]
 
-/* 设备详情-阀控记录列表展示信息配置 */
-export const valveInfoCols = [
-  {
-    label: '操作原因',
-    prop: 'operationCause',
-  },
-  {
-    label: '操作类型',
-    prop: 'operationType',
-    format(val, data) {
-      let name = '';
-      switch (val) {
-        case 0:
-          return '关' + name;
-        case 1:
-          return '开' + name;
-        default:
-          return '-';
-      }
-    }
-  }, {
-    label: '操作结果',
-    prop: 'operationResult',
-    format(val, data) {
-      switch (val) {
-        case 0:
-          return '发送';
-        case 1:
-          return '超时';
-        case 2:
-          return '成功';
-        case 3:
-          return '失败';
-        default:
-          return '-';
-      }
-    }
-  }, {
-    label: '操作时间',
-    prop: 'operationDate'
-  },
-  {
-    label: '处理时间',
-    prop: 'finishDate'
-  }
-]
 
 

+ 68 - 18
energyManagement/src/views/instrumentManagement/popups/tabIndex.vue

@@ -19,7 +19,7 @@
                             :value-format="dateType"
                             :picker-options="endDatePicker"
                             @change="timeQuery"
-                            :clearable="false"
+                            clearable
                         >
                         </el-date-picker>
                     </span>
@@ -86,6 +86,7 @@ export default {
     props: ['params'],
     components: {},
     data() {
+        let _this = this;
         return {
             deviceLoader,
             type: '',
@@ -131,7 +132,58 @@ export default {
                 { label: '设备状态', prop: 'receiveTime' }
             ],
             AlertsCols,
-            valveInfoCols,
+            /* 设备详情-阀控记录列表展示信息配置 */
+            valveInfoCols: [
+                {
+                    label: '操作原因',
+                    prop: 'operationCause'
+                },
+                {
+                    label: '操作类型',
+                    prop: 'operationType',
+                    format(val, data) {
+                        let name = '';
+                        switch (val) {
+                            case 0:
+                                return '关' + name;
+                            case 1:
+                                return '开' + name;
+                            default:
+                                return '-';
+                        }
+                    }
+                },
+                {
+                    label: '操作结果',
+                    prop: 'operationResult',
+                    format(val, data) {
+                        let name = '';
+                        if (_this.mixins_query.categoryId === 1) {
+                            name = '阀';
+                        } else {
+                            name = '闸';
+                        }
+                        switch (val) {
+                            case 0:
+                                return name + '关';
+                            case 1:
+                                return name + '开';
+                            case 2:
+                                return '执行中';
+                            default:
+                                return '-';
+                        }
+                    }
+                },
+                {
+                    label: '操作时间',
+                    prop: 'operationDate'
+                },
+                {
+                    label: '处理时间',
+                    prop: 'finishDate'
+                }
+            ],
             historyCols, //告警列表表头
             getRowStr,
             historyDataList: []
@@ -144,8 +196,8 @@ export default {
         this.initDate('YYYYMMDD');
         this.mixins_query = {
             deviceId: this.params.id || '',
-            startDate: this.dataValue.length ? `${this.dataValue[0]}` : '',
-            endDate: this.dataValue.length ? `${this.dataValue[1]}` : ''
+            startDate: !!this.dataValue ? `${this.dataValue[0]}` : '',
+            endDate: !!this.dataValue ? `${this.dataValue[1]}` : ''
         };
 
         new Promise((resolve) => {
@@ -211,8 +263,8 @@ export default {
             // 获取历史数据列表
             this.mixins_query = {
                 deviceId: this.params.id || '',
-                startDate: this.dataValue.length ? `${this.dataValue[0]}` : '',
-                endDate: this.dataValue.length ? `${this.dataValue[1]}` : ''
+                startDate: !!this.dataValue ? `${this.dataValue[0]}` : '',
+                endDate: !!this.dataValue ? `${this.dataValue[1]}` : ''
             };
             if (this.params.productId) {
                 this.$http
@@ -252,8 +304,8 @@ export default {
             this.mixins_query = {
                 categoryId: this.params.categoryId || '',
                 deviceId: this.params.id || '',
-                startDate: this.dataValue.length ? `${this.dataValue[0]}` : '',
-                endDate: this.dataValue.length ? `${this.dataValue[1]}` : ''
+                startDate: !!this.dataValue ? `${this.dataValue[0]}` : '',
+                endDate: !!this.dataValue ? `${this.dataValue[1]}` : ''
             };
             this.mixins_search();
         },
@@ -263,18 +315,16 @@ export default {
             this.mixins_post = 'get';
             this.mixins_dataUrl = '/sc-energy/device/command/page';
             this.mixins_query = {
-                // categoryId: this.params.categoryId || '',
-                // communityId: this.params.communityId || '',
                 deviceId: this.params.id || '',
-                startDate: this.dataValue.length ? `${this.dataValue[0]}` : '',
-                endDate: this.dataValue.length ? `${this.dataValue[1]}` : ''
+                startDate: !!this.dataValue ? `${this.dataValue[0]}` : '',
+                endDate: !!this.dataValue ? `${this.dataValue[1]}` : ''
             };
             this.mixins_search();
         },
 
         timeQuery() {
-            (this.mixins_query.startDate = this.dataValue.length ? `${this.dataValue[0]}` : ''),
-                (this.mixins_query.endDate = this.dataValue.length ? `${this.dataValue[1]}` : '');
+            (this.mixins_query.startDate = !!this.dataValue ? `${this.dataValue[0]}` : ''),
+                (this.mixins_query.endDate = !!this.dataValue ? `${this.dataValue[1]}` : '');
             this.change(this.value);
         },
         getDeviceMeasuringPoint(resolve) {
@@ -330,8 +380,8 @@ export default {
             let downurl = '';
             let params = {
                 deviceId: this.params.id || '',
-                startDate: this.dataValue.length ? `${this.dataValue[0]}` : '',
-                endDate: this.dataValue.length ? `${this.dataValue[1]}` : ''
+                startDate: !!this.dataValue ? `${this.dataValue[0]}` : '',
+                endDate: !!this.dataValue ? `${this.dataValue[1]}` : ''
             };
             if (this.value == 'history') {
                 params = {
@@ -350,8 +400,8 @@ export default {
                 downurl = '/sc-energy/device/command/export/excel';
                 params = {
                     deviceId: this.params.id || '',
-                    startDate: this.dataValue.length ? `${this.dataValue[0]}` : '',
-                    endDate: this.dataValue.length ? `${this.dataValue[1]}` : ''
+                    startDate: !!this.dataValue ? `${this.dataValue[0]}` : '',
+                    endDate: !!this.dataValue ? `${this.dataValue[1]}` : ''
                 };
             }
             this.__exportExcel(downurl, params);

+ 16 - 2
operationSupport/src/views/operationManagement/workOrders/index.vue

@@ -126,8 +126,22 @@ export default {
 
                 .catch(function () {});
         },
-        dispatchTask(row) {
-            console.log(row);
+        dispatchTask(data = {}) {
+            new Promise((resolve) => {
+                let title = '派单';
+                this.$store.dispatch('addPopup', {
+                    url: '/operationManagement/workOrders/stepPage/dispatchTsk.vue',
+                    width: '500px',
+                    height: '100px',
+                    props: {
+                        data,
+                        callback: resolve
+                    },
+                    title: title
+                });
+            }).then(() => {
+                this.mixins_search();
+            });
         },
         closeTask(data = {}) {
             new Promise((resolve) => {

+ 57 - 0
operationSupport/src/views/operationManagement/workOrders/stepPage/dispatchTsk.vue

@@ -0,0 +1,57 @@
+<template>
+    <zz-form :cols="formCols" :data="formData" :rules="formRules" labelWidth="90" ref="form"> </zz-form>
+</template>
+<script >
+export default {
+    props: ['params'],
+    data() {
+        return {
+            formData: {
+                cause: '',
+                orderId: ''
+            },
+            formRules: {
+                cause: [this.$valid.inputRequired('关闭原因')]
+            },
+            formCols: [
+                [
+                    {
+                        label: '关闭原因',
+                        prop: 'cause',
+                        input: true
+                    }
+                ]
+            ]
+        };
+    },
+
+    methods: {
+        submit() {
+            new Promise((resolve) => {
+                this.$refs.form.validate(resolve);
+            }).then(() => {
+                var loading = this.$loading();
+                let url = '/sc-community/workOrder/close';
+                this.$http
+                    .post(url, this.formData)
+                    .then(({ status, msg }) => {
+                        if (status == 0) {
+                            this.$message.success(msg);
+                            this.params.callback();
+                            this.$emit('close');
+                        } else {
+                            this.$message.error(msg);
+                        }
+                        loading.close();
+                    })
+                    .catch(() => {
+                        loading.close();
+                    });
+            });
+        }
+    },
+    created() {
+        this.formData.orderId = JSON.parse(JSON.stringify(this.params.data)).id;
+    }
+};
+</script>